File: /var/www/html/laravel/node_modules/ol/dist/ol.js.map
{"version":3,"file":"ol.js","sources":["../ol/CollectionEventType.js","../ol/ObjectEventType.js","../ol/events/EventType.js","../ol/Disposable.js","../ol/array.js","../ol/functions.js","../ol/obj.js","../ol/events/Event.js","../ol/events/Target.js","../ol/events.js","../ol/Observable.js","../ol/util.js","../ol/Object.js","../ol/Collection.js","../ol/TileState.js","../ol/easing.js","../ol/Tile.js","../ol/has.js","../ol/dom.js","../ol/DataTile.js","../ol/asserts.js","../ol/Feature.js","../ol/extent/Relationship.js","../ol/extent.js","../ol/math.js","../ol/sphere.js","../ol/console.js","../ol/string.js","../ol/coordinate.js","../ol/proj/Units.js","../ol/proj/Projection.js","../ol/proj/epsg3857.js","../ol/proj/epsg4326.js","../ol/proj/projections.js","../ol/proj/transforms.js","../ol/proj/utm.js","../ol/proj.js","../ol/transform.js","../ol/geom/flat/transform.js","../ol/geom/Geometry.js","../ol/geom/SimpleGeometry.js","../ol/geom/flat/area.js","../ol/geom/flat/closest.js","../ol/geom/flat/deflate.js","../ol/geom/flat/inflate.js","../ol/geom/flat/simplify.js","../ol/geom/LinearRing.js","../ol/geom/Point.js","../ol/geom/flat/contains.js","../ol/geom/flat/interiorpoint.js","../ol/geom/flat/segments.js","../ol/geom/flat/intersectsextent.js","../ol/geom/flat/reverse.js","../ol/geom/flat/orient.js","../ol/geom/Polygon.js","../ol/Geolocation.js","../ol/ImageState.js","../ol/Image.js","../ol/ImageCanvas.js","../ol/ImageTile.js","../ol/Kinetic.js","../ol/MapEvent.js","../ol/MapBrowserEvent.js","../ol/MapBrowserEventType.js","../ol/pointer/EventType.js","../ol/MapBrowserEventHandler.js","../ol/MapEventType.js","../ol/MapProperty.js","../ol/structs/PriorityQueue.js","../ol/TileQueue.js","../ol/ViewHint.js","../ol/ViewProperty.js","../ol/centerconstraint.js","../ol/resolutionconstraint.js","../ol/rotationconstraint.js","../ol/tilegrid/common.js","../ol/View.js","../ol/css.js","../ol/control/Control.js","../ol/control/Attribution.js","../ol/control/Rotate.js","../ol/control/Zoom.js","../ol/control/defaults.js","../ol/interaction/Property.js","../ol/interaction/Interaction.js","../ol/interaction/DoubleClickZoom.js","../ol/events/condition.js","../ol/interaction/Pointer.js","../ol/interaction/DragPan.js","../ol/interaction/DragRotate.js","../ol/render/Box.js","../ol/interaction/DragBox.js","../ol/interaction/DragZoom.js","../ol/events/Key.js","../ol/interaction/KeyboardPan.js","../ol/interaction/KeyboardZoom.js","../ol/interaction/MouseWheelZoom.js","../ol/interaction/PinchRotate.js","../ol/interaction/PinchZoom.js","../ol/interaction/defaults.js","../ol/layer/Property.js","../ol/layer/Base.js","../ol/layer/Group.js","../ol/render/EventType.js","../ol/layer/Layer.js","../../node_modules/quickselect/index.js","../../node_modules/rbush/index.js","../ol/color.js","../ol/size.js","../ol/expr/expression.js","../ol/expr/cpu.js","../ol/style/IconImageCache.js","../ol/style/IconImage.js","../ol/colorlike.js","../ol/render/canvas.js","../ol/style/Image.js","../ol/style/RegularShape.js","../ol/style/Circle.js","../ol/style/Fill.js","../ol/style/Icon.js","../ol/style/Stroke.js","../ol/style/Style.js","../ol/style/Text.js","../ol/render/canvas/style.js","../ol/layer/BaseVector.js","../ol/render/Event.js","../ol/renderer/Map.js","../ol/renderer/Composite.js","../ol/Map.js","../ol/Overlay.js","../ol/TileRange.js","../ol/VectorRenderTile.js","../ol/net.js","../ol/VectorTile.js","../ol/featureloader.js","../ol/loadingstrategy.js","../ol/render/VectorContext.js","../ol/render/canvas/Immediate.js","../ol/renderer/vector.js","../ol/render.js","../ol/reproj.js","../ol/resolution.js","../ol/structs/LRUCache.js","../ol/tilecoord.js","../ol/tilegrid/TileGrid.js","../ol/tilegrid/WMTS.js","../ol/tilegrid.js","../ol/uri.js","../ol/tileurlfunction.js","../ol/reproj/Triangulation.js","../ol/reproj/common.js","../ol/reproj/Tile.js","../ol/source/Source.js","../ol/source/Tile.js","../ol/source/TileEventType.js","../ol/source/UrlTile.js","../ol/source/TileImage.js","../ol/source/BingMaps.js","../ol/source/XYZ.js","../ol/geom/flat/center.js","../ol/geom/flat/interpolate.js","../ol/geom/Circle.js","../ol/geom/GeometryCollection.js","../ol/geom/flat/length.js","../ol/geom/LineString.js","../ol/geom/MultiLineString.js","../ol/geom/MultiPoint.js","../ol/geom/MultiPolygon.js","../ol/render/Feature.js","../ol/structs/RBush.js","../ol/source/VectorEventType.js","../ol/source/Vector.js","../ol/vec/mat4.js","../ol/webgl/Canvas.js","../ol/reproj/glreproj.js","../ol/reproj/DataTile.js","../ol/source/DataTile.js","../ol/source/GeoTIFF.js","../ol/format/IIIFInfo.js","../ol/source/Zoomify.js","../ol/source/IIIF.js","../ol/reproj/Image.js","../ol/source/common.js","../ol/source/Image.js","../ol/source/arcgisRest.js","../ol/source/mapguide.js","../ol/source/static.js","../ol/source/ImageTile.js","../ol/source/wms.js","../ol/source/ogcTileUtil.js","../ol/source/VectorTile.js","../ol/source/OSM.js","../ol/render/canvas/ZIndexContext.js","../ol/renderer/Layer.js","../ol/renderer/canvas/Layer.js","../ol/renderer/canvas/ImageLayer.js","../ol/layer/BaseImage.js","../ol/layer/Image.js","../ol/renderer/canvas/TileLayer.js","../ol/layer/TileProperty.js","../ol/layer/BaseTile.js","../ol/layer/Tile.js","../ol/source/Raster.js","../ol/source/StadiaMaps.js","../ol/source/UTFGrid.js","../ol/webgl.js","../ol/xml.js","../ol/webgl/BaseTileRepresentation.js","../ol/webgl/Buffer.js","../ol/webgl/ContextEventType.js","../ol/webgl/PostProcessingPass.js","../ol/webgl/Helper.js","../ol/webgl/PaletteTexture.js","../ol/webgl/RenderTarget.js","../ol/render/webgl/MixedGeometryBatch.js","../ol/webgl/TileGeometry.js","../ol/webgl/TileTexture.js","../ol/style/flat.js","../ol/source/SentinelHub.js","../ol/renderer/webgl/Layer.js","../ol/renderer/webgl/TileLayerBase.js","../ol/renderer/webgl/TileLayer.js","../ol/renderer/webgl/FlowLayer.js","../ol/render/webgl/constants.js","../ol/render/webgl/encodeUtil.js","../ol/worker/webgl.js","../ol/renderer/webgl/worldUtil.js","../ol/renderer/webgl/PointsLayer.js","../ol/expr/gpu.js","../ol/render/webgl/renderinstructions.js","../../node_modules/earcut/src/earcut.js","../ol/render/webgl/bufferUtil.js","../ol/render/webgl/ShaderBuilder.js","../ol/render/webgl/compileUtil.js","../ol/render/webgl/style.js","../ol/render/webgl/VectorStyleRenderer.js","../ol/renderer/webgl/VectorLayer.js","../ol/renderer/webgl/VectorTileLayer.js","../ol/render/canvas/Instruction.js","../ol/render/canvas/Builder.js","../ol/render/canvas/ImageBuilder.js","../ol/render/canvas/LineStringBuilder.js","../ol/render/canvas/PolygonBuilder.js","../ol/geom/flat/linechunk.js","../ol/geom/flat/straightchunk.js","../ol/render/canvas/TextBuilder.js","../ol/render/canvas/BuilderGroup.js","../ol/geom/flat/textpath.js","../ol/render/canvas/Executor.js","../ol/render/canvas/ExecutorGroup.js","../ol/render/canvas/hitdetect.js","../ol/renderer/canvas/VectorLayer.js","../ol/renderer/canvas/VectorImageLayer.js","../ol/renderer/canvas/VectorTileLayer.js","../ol/proj/proj4.js","../ol/layer/Flow.js","../ol/geom/flat/geodesic.js","../ol/layer/Vector.js","../ol/layer/Graticule.js","../ol/layer/Heatmap.js","../ol/layer/WebGLTile.js","../ol/interaction/DragAndDrop.js","../ol/interaction/Draw.js","../ol/interaction/Extent.js","../ol/interaction/Link.js","../ol/interaction/Modify.js","../ol/interaction/Select.js","../ol/events/SnapEvent.js","../ol/interaction/Snap.js","../ol/interaction/Translate.js","../ol/geom/flat/flip.js","../ol/format/Feature.js","../ol/format/JSONFeature.js","../ol/format/EsriJSON.js","../ol/format/XMLFeature.js","../ol/format/GMLBase.js","../ol/format/xsd.js","../ol/format/GML2.js","../ol/format/GML3.js","../ol/format/GML.js","../ol/format/GML32.js","../ol/format/GPX.js","../ol/format/GeoJSON.js","../ol/format/TextFeature.js","../ol/format/IGC.js","../ol/format/KML.js","../../node_modules/pbf/index.js","../ol/format/MVT.js","../ol/format/OSMXML.js","../ol/format/XML.js","../ol/format/xlink.js","../ol/format/OWS.js","../ol/format/Polyline.js","../ol/format/TopoJSON.js","../ol/format/filter/Filter.js","../ol/format/filter/LogicalNary.js","../ol/format/filter/And.js","../ol/format/filter/Bbox.js","../ol/format/filter/Spatial.js","../ol/format/filter/Contains.js","../ol/format/filter/DWithin.js","../ol/format/filter/Disjoint.js","../ol/format/filter/Comparison.js","../ol/format/filter/During.js","../ol/format/filter/ComparisonBinary.js","../ol/format/filter/EqualTo.js","../ol/format/filter/GreaterThan.js","../ol/format/filter/GreaterThanOrEqualTo.js","../ol/format/filter/Intersects.js","../ol/format/filter/IsBetween.js","../ol/format/filter/IsLike.js","../ol/format/filter/IsNull.js","../ol/format/filter/LessThan.js","../ol/format/filter/LessThanOrEqualTo.js","../ol/format/filter/Not.js","../ol/format/filter/NotEqualTo.js","../ol/format/filter/Or.js","../ol/format/filter/ResourceId.js","../ol/format/filter/Within.js","../ol/format/filter.js","../ol/format/WFS.js","../ol/format/WKB.js","../ol/format/WKT.js","../ol/format/WMSCapabilities.js","../ol/format/WMTSCapabilities.js","../ol/control/FullScreen.js","../ol/control/MousePosition.js","../ol/control/OverviewMap.js","../ol/control/ScaleLine.js","../ol/control/ZoomSlider.js","../ol/dist/ol.js","../ol/control/ZoomToExtent.js","../ol/format/WMSGetFeatureInfo.js","../ol/geom/flat/topology.js","../ol/interaction/DblClickDragZoom.js","../ol/interaction/DragRotateAndZoom.js","../ol/layer/VectorImage.js","../ol/layer/VectorTile.js","../ol/layer/WebGLPoints.js","../ol/layer/WebGLVector.js","../ol/layer/WebGLVectorTile.js","../ol/source/CartoDB.js","../ol/source/Cluster.js","../ol/source/Google.js","../ol/source/ImageArcGISRest.js","../ol/source/ImageCanvas.js","../ol/source/ImageMapGuide.js","../ol/source/ImageStatic.js","../ol/source/ImageWMS.js","../ol/source/OGCMapTile.js","../ol/source/OGCVectorTile.js","../ol/source/TileArcGISRest.js","../ol/source/TileDebug.js","../ol/source/TileJSON.js","../ol/source/TileWMS.js","../ol/source/WMTS.js","../ol/source/mapserver.js","../ol/source.js"],"sourcesContent":["/**\n * @module ol/CollectionEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when an item is added to the collection.\n * @event module:ol/Collection.CollectionEvent#add\n * @api\n */\n ADD: 'add',\n /**\n * Triggered when an item is removed from the collection.\n * @event module:ol/Collection.CollectionEvent#remove\n * @api\n */\n REMOVE: 'remove',\n};\n","/**\n * @module ol/ObjectEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a property is changed.\n * @event module:ol/Object.ObjectEvent#propertychange\n * @api\n */\n PROPERTYCHANGE: 'propertychange',\n};\n\n/**\n * @typedef {'propertychange'} Types\n */\n","/**\n * @module ol/events/EventType\n */\n\n/**\n * @enum {string}\n * @const\n */\nexport default {\n /**\n * Generic change event. Triggered when the revision counter is increased.\n * @event module:ol/events/Event~BaseEvent#change\n * @api\n */\n CHANGE: 'change',\n\n /**\n * Generic error event. Triggered when an error occurs.\n * @event module:ol/events/Event~BaseEvent#error\n * @api\n */\n ERROR: 'error',\n\n BLUR: 'blur',\n CLEAR: 'clear',\n CONTEXTMENU: 'contextmenu',\n CLICK: 'click',\n DBLCLICK: 'dblclick',\n DRAGENTER: 'dragenter',\n DRAGOVER: 'dragover',\n DROP: 'drop',\n FOCUS: 'focus',\n KEYDOWN: 'keydown',\n KEYPRESS: 'keypress',\n LOAD: 'load',\n RESIZE: 'resize',\n TOUCHMOVE: 'touchmove',\n WHEEL: 'wheel',\n};\n","/**\n * @module ol/Disposable\n */\n\n/**\n * @classdesc\n * Objects that need to clean up after themselves.\n */\nclass Disposable {\n constructor() {\n /**\n * The object has already been disposed.\n * @type {boolean}\n * @protected\n */\n this.disposed = false;\n }\n\n /**\n * Clean up.\n */\n dispose() {\n if (!this.disposed) {\n this.disposed = true;\n this.disposeInternal();\n }\n }\n\n /**\n * Extension point for disposable objects.\n * @protected\n */\n disposeInternal() {}\n}\n\nexport default Disposable;\n","/**\n * @module ol/array\n */\n\n/**\n * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.\n * https://github.com/darkskyapp/binary-search\n *\n * @param {Array<*>} haystack Items to search through.\n * @param {*} needle The item to look for.\n * @param {Function} [comparator] Comparator function.\n * @return {number} The index of the item if found, -1 if not.\n */\nexport function binarySearch(haystack, needle, comparator) {\n let mid, cmp;\n comparator = comparator || ascending;\n let low = 0;\n let high = haystack.length;\n let found = false;\n\n while (low < high) {\n /* Note that \"(low + high) >>> 1\" may overflow, and results in a typecast\n * to double (which gives the wrong results). */\n mid = low + ((high - low) >> 1);\n cmp = +comparator(haystack[mid], needle);\n\n if (cmp < 0.0) {\n /* Too low. */\n low = mid + 1;\n } else {\n /* Key found or too high */\n high = mid;\n found = !cmp;\n }\n }\n\n /* Key not found. */\n return found ? low : ~low;\n}\n\n/**\n * Compare function sorting arrays in ascending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nexport function ascending(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\n/**\n * Compare function sorting arrays in descending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is greater than, equal to, or less than the second.\n */\nexport function descending(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n}\n\n/**\n * {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution} can use a function\n * of this type to determine which nearest resolution to use.\n *\n * This function takes a `{number}` representing a value between two array entries,\n * a `{number}` representing the value of the nearest higher entry and\n * a `{number}` representing the value of the nearest lower entry\n * as arguments and returns a `{number}`. If a negative number or zero is returned\n * the lower value will be used, if a positive number is returned the higher value\n * will be used.\n * @typedef {function(number, number, number): number} NearestDirectionFunction\n * @api\n */\n\n/**\n * @param {Array<number>} arr Array in descending order.\n * @param {number} target Target.\n * @param {number|NearestDirectionFunction} direction\n * 0 means return the nearest,\n * > 0 means return the largest nearest,\n * < 0 means return the smallest nearest.\n * @return {number} Index.\n */\nexport function linearFindNearest(arr, target, direction) {\n if (arr[0] <= target) {\n return 0;\n }\n\n const n = arr.length;\n if (target <= arr[n - 1]) {\n return n - 1;\n }\n\n if (typeof direction === 'function') {\n for (let i = 1; i < n; ++i) {\n const candidate = arr[i];\n if (candidate === target) {\n return i;\n }\n if (candidate < target) {\n if (direction(target, arr[i - 1], candidate) > 0) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n }\n\n if (direction > 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] < target) {\n return i - 1;\n }\n }\n return n - 1;\n }\n\n if (direction < 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] <= target) {\n return i;\n }\n }\n return n - 1;\n }\n\n for (let i = 1; i < n; ++i) {\n if (arr[i] == target) {\n return i;\n }\n if (arr[i] < target) {\n if (arr[i - 1] - target < target - arr[i]) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n}\n\n/**\n * @param {Array<*>} arr Array.\n * @param {number} begin Begin index.\n * @param {number} end End index.\n */\nexport function reverseSubArray(arr, begin, end) {\n while (begin < end) {\n const tmp = arr[begin];\n arr[begin] = arr[end];\n arr[end] = tmp;\n ++begin;\n --end;\n }\n}\n\n/**\n * @param {Array<VALUE>} arr The array to modify.\n * @param {!Array<VALUE>|VALUE} data The elements or arrays of elements to add to arr.\n * @template VALUE\n */\nexport function extend(arr, data) {\n const extension = Array.isArray(data) ? data : [data];\n const length = extension.length;\n for (let i = 0; i < length; i++) {\n arr[arr.length] = extension[i];\n }\n}\n\n/**\n * @param {Array<VALUE>} arr The array to modify.\n * @param {VALUE} obj The element to remove.\n * @template VALUE\n * @return {boolean} If the element was removed.\n */\nexport function remove(arr, obj) {\n const i = arr.indexOf(obj);\n const found = i > -1;\n if (found) {\n arr.splice(i, 1);\n }\n return found;\n}\n\n/**\n * @param {Array<any>|Uint8ClampedArray} arr1 The first array to compare.\n * @param {Array<any>|Uint8ClampedArray} arr2 The second array to compare.\n * @return {boolean} Whether the two arrays are equal.\n */\nexport function equals(arr1, arr2) {\n const len1 = arr1.length;\n if (len1 !== arr2.length) {\n return false;\n }\n for (let i = 0; i < len1; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Sort the passed array such that the relative order of equal elements is preserved.\n * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.\n * @param {Array<*>} arr The array to sort (modifies original).\n * @param {!function(*, *): number} compareFnc Comparison function.\n * @api\n */\nexport function stableSort(arr, compareFnc) {\n const length = arr.length;\n const tmp = Array(arr.length);\n let i;\n for (i = 0; i < length; i++) {\n tmp[i] = {index: i, value: arr[i]};\n }\n tmp.sort(function (a, b) {\n return compareFnc(a.value, b.value) || a.index - b.index;\n });\n for (i = 0; i < arr.length; i++) {\n arr[i] = tmp[i].value;\n }\n}\n\n/**\n * @param {Array<*>} arr The array to test.\n * @param {Function} [func] Comparison function.\n * @param {boolean} [strict] Strictly sorted (default false).\n * @return {boolean} Return index.\n */\nexport function isSorted(arr, func, strict) {\n const compare = func || ascending;\n return arr.every(function (currentVal, index) {\n if (index === 0) {\n return true;\n }\n const res = compare(arr[index - 1], currentVal);\n return !(res > 0 || (strict && res === 0));\n });\n}\n","/**\n * @module ol/functions\n */\n\nimport {equals as arrayEquals} from './array.js';\n\n/**\n * Always returns true.\n * @return {boolean} true.\n */\nexport function TRUE() {\n return true;\n}\n\n/**\n * Always returns false.\n * @return {boolean} false.\n */\nexport function FALSE() {\n return false;\n}\n\n/**\n * A reusable function, used e.g. as a default for callbacks.\n *\n * @return {void} Nothing.\n */\nexport function VOID() {}\n\n/**\n * Wrap a function in another function that remembers the last return. If the\n * returned function is called twice in a row with the same arguments and the same\n * this object, it will return the value from the first call in the second call.\n *\n * @param {function(...any): ReturnType} fn The function to memoize.\n * @return {function(...any): ReturnType} The memoized function.\n * @template ReturnType\n */\nexport function memoizeOne(fn) {\n /** @type {ReturnType} */\n let lastResult;\n\n /** @type {Array<any>|undefined} */\n let lastArgs;\n\n let lastThis;\n\n /**\n * @this {*} Only need to know if `this` changed, don't care what type\n * @return {ReturnType} Memoized value\n */\n return function () {\n const nextArgs = Array.prototype.slice.call(arguments);\n if (!lastArgs || this !== lastThis || !arrayEquals(nextArgs, lastArgs)) {\n lastThis = this;\n lastArgs = nextArgs;\n lastResult = fn.apply(this, arguments);\n }\n return lastResult;\n };\n}\n\n/**\n * @template T\n * @param {function(): (T | Promise<T>)} getter A function that returns a value or a promise for a value.\n * @return {Promise<T>} A promise for the value.\n */\nexport function toPromise(getter) {\n function promiseGetter() {\n let value;\n try {\n value = getter();\n } catch (err) {\n return Promise.reject(err);\n }\n if (value instanceof Promise) {\n return value;\n }\n return Promise.resolve(value);\n }\n return promiseGetter();\n}\n","/**\n * @module ol/obj\n */\n\n/**\n * Removes all properties from an object.\n * @param {Object<string, unknown>} object The object to clear.\n */\nexport function clear(object) {\n for (const property in object) {\n delete object[property];\n }\n}\n\n/**\n * Determine if an object has any properties.\n * @param {Object} object The object to check.\n * @return {boolean} The object is empty.\n */\nexport function isEmpty(object) {\n let property;\n for (property in object) {\n return false;\n }\n return !property;\n}\n","/**\n * @module ol/events/Event\n */\n\n/**\n * @classdesc\n * Stripped down implementation of the W3C DOM Level 2 Event interface.\n * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.\n *\n * This implementation only provides `type` and `target` properties, and\n * `stopPropagation` and `preventDefault` methods. It is meant as base class\n * for higher level events defined in the library, and works with\n * {@link module:ol/events/Target~Target}.\n */\nclass BaseEvent {\n /**\n * @param {string} type Type.\n */\n constructor(type) {\n /**\n * @type {boolean}\n */\n this.propagationStopped;\n\n /**\n * @type {boolean}\n */\n this.defaultPrevented;\n\n /**\n * The event type.\n * @type {string}\n * @api\n */\n this.type = type;\n\n /**\n * The event target.\n * @type {Object}\n * @api\n */\n this.target = null;\n }\n\n /**\n * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events\n * will be fired.\n * @api\n */\n preventDefault() {\n this.defaultPrevented = true;\n }\n\n /**\n * Stop event propagation.\n * @api\n */\n stopPropagation() {\n this.propagationStopped = true;\n }\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function stopPropagation(evt) {\n evt.stopPropagation();\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function preventDefault(evt) {\n evt.preventDefault();\n}\n\nexport default BaseEvent;\n","/**\n * @module ol/events/Target\n */\nimport Disposable from '../Disposable.js';\nimport {VOID} from '../functions.js';\nimport {clear} from '../obj.js';\nimport Event from './Event.js';\n\n/**\n * @typedef {EventTarget|Target} EventTargetLike\n */\n\n/**\n * @classdesc\n * A simplified implementation of the W3C DOM Level 2 EventTarget interface.\n * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.\n *\n * There are two important simplifications compared to the specification:\n *\n * 1. The handling of `useCapture` in `addEventListener` and\n * `removeEventListener`. There is no real capture model.\n * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.\n * There is no event target hierarchy. When a listener calls\n * `stopPropagation` or `preventDefault` on an event object, it means that no\n * more listeners after this one will be called. Same as when the listener\n * returns false.\n */\nclass Target extends Disposable {\n /**\n * @param {*} [target] Default event target for dispatched events.\n */\n constructor(target) {\n super();\n\n /**\n * @private\n * @type {*}\n */\n this.eventTarget_ = target;\n\n /**\n * @private\n * @type {Object<string, number>|null}\n */\n this.pendingRemovals_ = null;\n\n /**\n * @private\n * @type {Object<string, number>|null}\n */\n this.dispatching_ = null;\n\n /**\n * @private\n * @type {Object<string, Array<import(\"../events.js\").Listener>>|null}\n */\n this.listeners_ = null;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n addEventListener(type, listener) {\n if (!type || !listener) {\n return;\n }\n const listeners = this.listeners_ || (this.listeners_ = {});\n const listenersForType = listeners[type] || (listeners[type] = []);\n if (!listenersForType.includes(listener)) {\n listenersForType.push(listener);\n }\n }\n\n /**\n * Dispatches an event and calls all listeners listening for events\n * of this type. The event parameter can either be a string or an\n * Object with a `type` property.\n *\n * @param {import(\"./Event.js\").default|string} event Event object.\n * @return {boolean|undefined} `false` if anyone called preventDefault on the\n * event object or if any of the listeners returned false.\n * @api\n */\n dispatchEvent(event) {\n const isString = typeof event === 'string';\n const type = isString ? event : event.type;\n const listeners = this.listeners_ && this.listeners_[type];\n if (!listeners) {\n return;\n }\n\n const evt = isString ? new Event(event) : /** @type {Event} */ (event);\n if (!evt.target) {\n evt.target = this.eventTarget_ || this;\n }\n const dispatching = this.dispatching_ || (this.dispatching_ = {});\n const pendingRemovals =\n this.pendingRemovals_ || (this.pendingRemovals_ = {});\n if (!(type in dispatching)) {\n dispatching[type] = 0;\n pendingRemovals[type] = 0;\n }\n ++dispatching[type];\n let propagate;\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n if ('handleEvent' in listeners[i]) {\n propagate = /** @type {import(\"../events.js\").ListenerObject} */ (\n listeners[i]\n ).handleEvent(evt);\n } else {\n propagate = /** @type {import(\"../events.js\").ListenerFunction} */ (\n listeners[i]\n ).call(this, evt);\n }\n if (propagate === false || evt.propagationStopped) {\n propagate = false;\n break;\n }\n }\n if (--dispatching[type] === 0) {\n let pr = pendingRemovals[type];\n delete pendingRemovals[type];\n while (pr--) {\n this.removeEventListener(type, VOID);\n }\n delete dispatching[type];\n }\n return propagate;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.listeners_ && clear(this.listeners_);\n }\n\n /**\n * Get the listeners for a specified event type. Listeners are returned in the\n * order that they will be called in.\n *\n * @param {string} type Type.\n * @return {Array<import(\"../events.js\").Listener>|undefined} Listeners.\n */\n getListeners(type) {\n return (this.listeners_ && this.listeners_[type]) || undefined;\n }\n\n /**\n * @param {string} [type] Type. If not provided,\n * `true` will be returned if this event target has any listeners.\n * @return {boolean} Has listeners.\n */\n hasListener(type) {\n if (!this.listeners_) {\n return false;\n }\n return type\n ? type in this.listeners_\n : Object.keys(this.listeners_).length > 0;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n removeEventListener(type, listener) {\n if (!this.listeners_) {\n return;\n }\n const listeners = this.listeners_[type];\n if (!listeners) {\n return;\n }\n const index = listeners.indexOf(listener);\n if (index !== -1) {\n if (this.pendingRemovals_ && type in this.pendingRemovals_) {\n // make listener a no-op, and remove later in #dispatchEvent()\n listeners[index] = VOID;\n ++this.pendingRemovals_[type];\n } else {\n listeners.splice(index, 1);\n if (listeners.length === 0) {\n delete this.listeners_[type];\n }\n }\n }\n }\n}\n\nexport default Target;\n","/**\n * @module ol/events\n */\nimport {clear} from './obj.js';\n\n/**\n * Key to use with {@link module:ol/Observable.unByKey}.\n * @typedef {Object} EventsKey\n * @property {ListenerFunction} listener Listener.\n * @property {import(\"./events/Target.js\").EventTargetLike} target Target.\n * @property {string} type Type.\n * @api\n */\n\n/**\n * Listener function. This function is called with an event object as argument.\n * When the function returns `false`, event propagation will stop.\n *\n * @typedef {function((Event|import(\"./events/Event.js\").default)): (void|boolean)} ListenerFunction\n * @api\n */\n\n/**\n * @typedef {Object} ListenerObject\n * @property {ListenerFunction} handleEvent HandleEvent listener function.\n */\n\n/**\n * @typedef {ListenerFunction|ListenerObject} Listener\n */\n\n/**\n * Registers an event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` to a `this` object, and returns\n * a key for use with {@link module:ol/events.unlistenByKey}.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @param {boolean} [once] If true, add the listener as one-off listener.\n * @return {EventsKey} Unique key for the listener.\n */\nexport function listen(target, type, listener, thisArg, once) {\n if (once) {\n const originalListener = listener;\n /**\n * @param {Event|import('./events/Event.js').default} event The event\n * @return {void|boolean} When the function returns `false`, event propagation will stop.\n * @this {typeof target}\n */\n listener = function (event) {\n target.removeEventListener(type, listener);\n return originalListener.call(thisArg ?? this, event);\n };\n } else if (thisArg && thisArg !== target) {\n listener = listener.bind(thisArg);\n }\n const eventsKey = {\n target: target,\n type: type,\n listener: listener,\n };\n target.addEventListener(type, listener);\n return eventsKey;\n}\n\n/**\n * Registers a one-off event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` as self-unregistering listener\n * to a `this` object, and returns a key for use with\n * {@link module:ol/events.unlistenByKey} in case the listener needs to be\n * unregistered before it is called.\n *\n * When {@link module:ol/events.listen} is called with the same arguments after this\n * function, the self-unregistering listener will be turned into a permanent\n * listener.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @return {EventsKey} Key for unlistenByKey.\n */\nexport function listenOnce(target, type, listener, thisArg) {\n return listen(target, type, listener, thisArg, true);\n}\n\n/**\n * Unregisters event listeners on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * The argument passed to this function is the key returned from\n * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}.\n *\n * @param {EventsKey} key The key.\n */\nexport function unlistenByKey(key) {\n if (key && key.target) {\n key.target.removeEventListener(key.type, key.listener);\n clear(key);\n }\n}\n","/**\n * @module ol/Observable\n */\nimport EventType from './events/EventType.js';\nimport EventTarget from './events/Target.js';\nimport {listen, listenOnce, unlistenByKey} from './events.js';\n\n/***\n * @template {string} Type\n * @template {Event|import(\"./events/Event.js\").default} EventClass\n * @template Return\n * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature\n */\n\n/***\n * @template {string} Type\n * @template Return\n * @typedef {(type: Type[], listener: (event: Event|import(\"./events/Event\").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature\n */\n\n/**\n * @typedef {'change'|'error'} EventTypes\n */\n\n/***\n * @template Return\n * @typedef {OnSignature<EventTypes, import(\"./events/Event.js\").default, Return> & CombinedOnSignature<EventTypes, Return>} ObservableOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * An event target providing convenient methods for listener registration\n * and unregistration. A generic `change` event is always available through\n * {@link module:ol/Observable~Observable#changed}.\n *\n * @fires import(\"./events/Event.js\").default\n * @api\n */\nclass Observable extends EventTarget {\n constructor() {\n super();\n\n this.on =\n /** @type {ObservableOnSignature<import(\"./events\").EventsKey>} */ (\n this.onInternal\n );\n\n this.once =\n /** @type {ObservableOnSignature<import(\"./events\").EventsKey>} */ (\n this.onceInternal\n );\n\n this.un = /** @type {ObservableOnSignature<void>} */ (this.unInternal);\n\n /**\n * @private\n * @type {number}\n */\n this.revision_ = 0;\n }\n\n /**\n * Increases the revision counter and dispatches a 'change' event.\n * @api\n */\n changed() {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Get the version number for this object. Each time the object is modified,\n * its version number will be incremented.\n * @return {number} Revision.\n * @api\n */\n getRevision() {\n return this.revision_;\n }\n\n /**\n * @param {string|Array<string>} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} Event key.\n * @protected\n */\n onInternal(type, listener) {\n if (Array.isArray(type)) {\n const len = type.length;\n const keys = new Array(len);\n for (let i = 0; i < len; ++i) {\n keys[i] = listen(this, type[i], listener);\n }\n return keys;\n }\n return listen(this, /** @type {string} */ (type), listener);\n }\n\n /**\n * @param {string|Array<string>} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} Event key.\n * @protected\n */\n onceInternal(type, listener) {\n let key;\n if (Array.isArray(type)) {\n const len = type.length;\n key = new Array(len);\n for (let i = 0; i < len; ++i) {\n key[i] = listenOnce(this, type[i], listener);\n }\n } else {\n key = listenOnce(this, /** @type {string} */ (type), listener);\n }\n /** @type {Object} */ (listener).ol_key = key;\n return key;\n }\n\n /**\n * Unlisten for a certain type of event.\n * @param {string|Array<string>} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @protected\n */\n unInternal(type, listener) {\n const key = /** @type {Object} */ (listener).ol_key;\n if (key) {\n unByKey(key);\n } else if (Array.isArray(type)) {\n for (let i = 0, ii = type.length; i < ii; ++i) {\n this.removeEventListener(type[i], listener);\n }\n } else {\n this.removeEventListener(type, listener);\n }\n }\n}\n\n/**\n * Listen for a certain type of event.\n * @function\n * @param {string|Array<string>} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.on;\n\n/**\n * Listen once for a certain type of event.\n * @function\n * @param {string|Array<string>} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.once;\n\n/**\n * Unlisten for a certain type of event.\n * @function\n * @param {string|Array<string>} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @api\n */\nObservable.prototype.un;\n\n/**\n * Removes an event listener using the key returned by `on()` or `once()`.\n * @param {import(\"./events.js\").EventsKey|Array<import(\"./events.js\").EventsKey>} key The key returned by `on()`\n * or `once()` (or an array of keys).\n * @api\n */\nexport function unByKey(key) {\n if (Array.isArray(key)) {\n for (let i = 0, ii = key.length; i < ii; ++i) {\n unlistenByKey(key[i]);\n }\n } else {\n unlistenByKey(/** @type {import(\"./events.js\").EventsKey} */ (key));\n }\n}\n\nexport default Observable;\n","/**\n * @module ol/util\n */\n\n/**\n * @return {never} Any return.\n */\nexport function abstract() {\n throw new Error('Unimplemented abstract method.');\n}\n\n/**\n * Counter for getUid.\n * @type {number}\n * @private\n */\nlet uidCounter_ = 0;\n\n/**\n * Gets a unique ID for an object. This mutates the object so that further calls\n * with the same object as a parameter returns the same value. Unique IDs are generated\n * as a strictly increasing sequence. Adapted from goog.getUid.\n *\n * @param {Object} obj The object to get the unique ID for.\n * @return {string} The unique ID for the object.\n * @api\n */\nexport function getUid(obj) {\n return obj.ol_uid || (obj.ol_uid = String(++uidCounter_));\n}\n\n/**\n * OpenLayers version.\n * @type {string}\n */\nexport const VERSION = '10.6.1';\n","/**\n * @module ol/Object\n */\nimport ObjectEventType from './ObjectEventType.js';\nimport Observable from './Observable.js';\nimport Event from './events/Event.js';\nimport {isEmpty} from './obj.js';\nimport {getUid} from './util.js';\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.\n */\nexport class ObjectEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {string} key The property name.\n * @param {*} oldValue The old value for `key`.\n */\n constructor(type, key, oldValue) {\n super(type);\n\n /**\n * The name of the property whose value is changing.\n * @type {string}\n * @api\n */\n this.key = key;\n\n /**\n * The old value. To get the new value use `e.target.get(e.key)` where\n * `e` is the event object.\n * @type {*}\n * @api\n */\n this.oldValue = oldValue;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<import(\"./ObjectEventType\").Types, ObjectEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|import(\"./ObjectEventType\").Types, Return>} ObjectOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Most non-trivial classes inherit from this.\n *\n * This extends {@link module:ol/Observable~Observable} with observable\n * properties, where each property is observable as well as the object as a\n * whole.\n *\n * Classes that inherit from this have pre-defined properties, to which you can\n * add your owns. The pre-defined properties are listed in this documentation as\n * 'Observable Properties', and have their own accessors; for example,\n * {@link module:ol/Map~Map} has a `target` property, accessed with\n * `getTarget()` and changed with `setTarget()`. Not all properties are however\n * settable. There are also general-purpose accessors `get()` and `set()`. For\n * example, `get('target')` is equivalent to `getTarget()`.\n *\n * The `set` accessors trigger a change event, and you can monitor this by\n * registering a listener. For example, {@link module:ol/View~View} has a\n * `center` property, so `view.on('change:center', function(evt) {...});` would\n * call the function whenever the value of the center property changes. Within\n * the function, `evt.target` would be the view, so `evt.target.getCenter()`\n * would return the new center.\n *\n * You can add your own observable properties with\n * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.\n * You can listen for changes on that property value with\n * `object.on('change:prop', listener)`. You can get a list of all\n * properties with {@link module:ol/Object~BaseObject#getProperties}.\n *\n * Note that the observable properties are separate from standard JS properties.\n * You can, for example, give your map object a title with\n * `map.title='New title'` and with `map.set('title', 'Another title')`. The\n * first will be a `hasOwnProperty`; the second will appear in\n * `getProperties()`. Only the second is observable.\n *\n * Properties can be deleted by using the unset method. E.g.\n * object.unset('foo').\n *\n * @fires ObjectEvent\n * @api\n */\nclass BaseObject extends Observable {\n /**\n * @param {Object<string, *>} [values] An object with key-value pairs.\n */\n constructor(values) {\n super();\n\n /***\n * @type {ObjectOnSignature<import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ObjectOnSignature<import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ObjectOnSignature<void>}\n */\n this.un;\n\n // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is\n // the same as the order in which they were created. This also helps to\n // ensure that object properties are always added in the same order, which\n // helps many JavaScript engines generate faster code.\n getUid(this);\n\n /**\n * @private\n * @type {Object<string, *>|null}\n */\n this.values_ = null;\n\n if (values !== undefined) {\n this.setProperties(values);\n }\n }\n\n /**\n * Gets a value.\n * @param {string} key Key name.\n * @return {*} Value.\n * @api\n */\n get(key) {\n let value;\n if (this.values_ && this.values_.hasOwnProperty(key)) {\n value = this.values_[key];\n }\n return value;\n }\n\n /**\n * Get a list of object property names.\n * @return {Array<string>} List of property names.\n * @api\n */\n getKeys() {\n return (this.values_ && Object.keys(this.values_)) || [];\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Object<string, *>} Object.\n * @api\n */\n getProperties() {\n return (this.values_ && Object.assign({}, this.values_)) || {};\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Object<string, *>?} Object.\n */\n getPropertiesInternal() {\n return this.values_;\n }\n\n /**\n * @return {boolean} The object has properties.\n */\n hasProperties() {\n return !!this.values_;\n }\n\n /**\n * @param {string} key Key name.\n * @param {*} oldValue Old value.\n */\n notify(key, oldValue) {\n let eventType;\n eventType = `change:${key}`;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n eventType = ObjectEventType.PROPERTYCHANGE;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n addChangeListener(key, listener) {\n this.addEventListener(`change:${key}`, listener);\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n removeChangeListener(key, listener) {\n this.removeEventListener(`change:${key}`, listener);\n }\n\n /**\n * Sets a value.\n * @param {string} key Key name.\n * @param {*} value Value.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n set(key, value, silent) {\n const values = this.values_ || (this.values_ = {});\n if (silent) {\n values[key] = value;\n } else {\n const oldValue = values[key];\n values[key] = value;\n if (oldValue !== value) {\n this.notify(key, oldValue);\n }\n }\n }\n\n /**\n * Sets a collection of key-value pairs. Note that this changes any existing\n * properties and adds new ones (it does not remove any existing properties).\n * @param {Object<string, *>} values Values.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n setProperties(values, silent) {\n for (const key in values) {\n this.set(key, values[key], silent);\n }\n }\n\n /**\n * Apply any properties from another object without triggering events.\n * @param {BaseObject} source The source object.\n * @protected\n */\n applyProperties(source) {\n if (!source.values_) {\n return;\n }\n Object.assign(this.values_ || (this.values_ = {}), source.values_);\n }\n\n /**\n * Unsets a property.\n * @param {string} key Key name.\n * @param {boolean} [silent] Unset without triggering an event.\n * @api\n */\n unset(key, silent) {\n if (this.values_ && key in this.values_) {\n const oldValue = this.values_[key];\n delete this.values_[key];\n if (isEmpty(this.values_)) {\n this.values_ = null;\n }\n if (!silent) {\n this.notify(key, oldValue);\n }\n }\n }\n}\n\nexport default BaseObject;\n","/**\n * @module ol/Collection\n */\nimport CollectionEventType from './CollectionEventType.js';\nimport BaseObject from './Object.js';\nimport Event from './events/Event.js';\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LENGTH: 'length',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this\n * type.\n * @template T\n */\nexport class CollectionEvent extends Event {\n /**\n * @param {import(\"./CollectionEventType.js\").default} type Type.\n * @param {T} element Element.\n * @param {number} index The index of the added or removed element.\n */\n constructor(type, element, index) {\n super(type);\n\n /**\n * The element that is added to or removed from the collection.\n * @type {T}\n * @api\n */\n this.element = element;\n\n /**\n * The index of the added or removed element.\n * @type {number}\n * @api\n */\n this.index = index;\n }\n}\n\n/***\n * @template T\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<import(\"./ObjectEventType\").Types|'change:length', import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").OnSignature<'add'|'remove', CollectionEvent<T>, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|import(\"./ObjectEventType\").Types|\n * 'change:length'|'add'|'remove',Return>} CollectionOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [unique=false] Disallow the same item from being added to\n * the collection twice.\n */\n\n/**\n * @classdesc\n * An expanded version of standard JS Array, adding convenience methods for\n * manipulation. Add and remove changes to the Collection trigger a Collection\n * event. Note that this does not cover changes to the objects _within_ the\n * Collection; they trigger events on the appropriate object, not on the\n * Collection as a whole.\n *\n * @fires CollectionEvent\n *\n * @template T\n * @api\n */\nclass Collection extends BaseObject {\n /**\n * @param {Array<T>} [array] Array.\n * @param {Options} [options] Collection options.\n */\n constructor(array, options) {\n super();\n\n /***\n * @type {CollectionOnSignature<T, import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {CollectionOnSignature<T, import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {CollectionOnSignature<T, void>}\n */\n this.un;\n\n options = options || {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.unique_ = !!options.unique;\n\n /**\n * @private\n * @type {!Array<T>}\n */\n this.array_ = array ? array : [];\n\n if (this.unique_) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n this.assertUnique_(this.array_[i], i);\n }\n }\n\n this.updateLength_();\n }\n\n /**\n * Remove all elements from the collection.\n * @api\n */\n clear() {\n while (this.getLength() > 0) {\n this.pop();\n }\n }\n\n /**\n * Add elements to the collection. This pushes each item in the provided array\n * to the end of the collection.\n * @param {!Array<T>} arr Array.\n * @return {Collection<T>} This collection.\n * @api\n */\n extend(arr) {\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n this.push(arr[i]);\n }\n return this;\n }\n\n /**\n * Iterate over each element, calling the provided callback.\n * @param {function(T, number, Array<T>): *} f The function to call\n * for every element. This function takes 3 arguments (the element, the\n * index and the array). The return value is ignored.\n * @api\n */\n forEach(f) {\n const array = this.array_;\n for (let i = 0, ii = array.length; i < ii; ++i) {\n f(array[i], i, array);\n }\n }\n\n /**\n * Get a reference to the underlying Array object. Warning: if the array\n * is mutated, no events will be dispatched by the collection, and the\n * collection's \"length\" property won't be in sync with the actual length\n * of the array.\n * @return {!Array<T>} Array.\n * @api\n */\n getArray() {\n return this.array_;\n }\n\n /**\n * Get the element at the provided index.\n * @param {number} index Index.\n * @return {T} Element.\n * @api\n */\n item(index) {\n return this.array_[index];\n }\n\n /**\n * Get the length of this collection.\n * @return {number} The length of the array.\n * @observable\n * @api\n */\n getLength() {\n return this.get(Property.LENGTH);\n }\n\n /**\n * Insert an element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n insertAt(index, elem) {\n if (index < 0 || index > this.getLength()) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n this.array_.splice(index, 0, elem);\n this.updateLength_();\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.ADD, elem, index),\n );\n }\n\n /**\n * Remove the last element of the collection and return it.\n * Return `undefined` if the collection is empty.\n * @return {T|undefined} Element.\n * @api\n */\n pop() {\n return this.removeAt(this.getLength() - 1);\n }\n\n /**\n * Insert the provided element at the end of the collection.\n * @param {T} elem Element.\n * @return {number} New length of the collection.\n * @api\n */\n push(elem) {\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n const n = this.getLength();\n this.insertAt(n, elem);\n return this.getLength();\n }\n\n /**\n * Remove the first occurrence of an element from the collection.\n * @param {T} elem Element.\n * @return {T|undefined} The removed element or undefined if none found.\n * @api\n */\n remove(elem) {\n const arr = this.array_;\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n if (arr[i] === elem) {\n return this.removeAt(i);\n }\n }\n return undefined;\n }\n\n /**\n * Remove the element at the provided index and return it.\n * Return `undefined` if the collection does not contain this index.\n * @param {number} index Index.\n * @return {T|undefined} Value.\n * @api\n */\n removeAt(index) {\n if (index < 0 || index >= this.getLength()) {\n return undefined;\n }\n const prev = this.array_[index];\n this.array_.splice(index, 1);\n this.updateLength_();\n this.dispatchEvent(\n /** @type {CollectionEvent<T>} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n ),\n );\n return prev;\n }\n\n /**\n * Set the element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n setAt(index, elem) {\n const n = this.getLength();\n if (index >= n) {\n this.insertAt(index, elem);\n return;\n }\n if (index < 0) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem, index);\n }\n const prev = this.array_[index];\n this.array_[index] = elem;\n this.dispatchEvent(\n /** @type {CollectionEvent<T>} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n ),\n );\n this.dispatchEvent(\n /** @type {CollectionEvent<T>} */ (\n new CollectionEvent(CollectionEventType.ADD, elem, index)\n ),\n );\n }\n\n /**\n * @private\n */\n updateLength_() {\n this.set(Property.LENGTH, this.array_.length);\n }\n\n /**\n * @private\n * @param {T} elem Element.\n * @param {number} [except] Optional index to ignore.\n */\n assertUnique_(elem, except) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n if (this.array_[i] === elem && i !== except) {\n throw new Error('Duplicate item added to a unique collection');\n }\n }\n }\n}\n\nexport default Collection;\n","/**\n * @module ol/TileState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n /**\n * Indicates that tile loading failed\n * @type {number}\n */\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/easing\n */\n\n/**\n * Start slow and speed up.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeIn(t) {\n return Math.pow(t, 3);\n}\n\n/**\n * Start fast and slow down.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeOut(t) {\n return 1 - easeIn(1 - t);\n}\n\n/**\n * Start slow, speed up, and then slow down again.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function inAndOut(t) {\n return 3 * t * t - 2 * t * t * t;\n}\n\n/**\n * Maintain a constant speed over time.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function linear(t) {\n return t;\n}\n\n/**\n * Start slow, speed up, and at the very end slow down again. This has the\n * same general behavior as {@link module:ol/easing.inAndOut}, but the final\n * slowdown is delayed.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function upAndDown(t) {\n if (t < 0.5) {\n return inAndOut(2 * t);\n }\n return 1 - inAndOut(2 * (t - 0.5));\n}\n","/**\n * @module ol/Tile\n */\nimport TileState from './TileState.js';\nimport {easeIn} from './easing.js';\nimport EventType from './events/EventType.js';\nimport EventTarget from './events/Target.js';\nimport {abstract} from './util.js';\n\n/**\n * A function that takes a {@link module:ol/Tile~Tile} for the tile and a\n * `{string}` for the url as arguments. The default is\n * ```js\n * source.setTileLoadFunction(function(tile, src) {\n * tile.getImage().src = src;\n * });\n * ```\n * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve\n * error handling:\n *\n * ```js\n * import TileState from 'ol/TileState.js';\n *\n * source.setTileLoadFunction(function(tile, src) {\n * const xhr = new XMLHttpRequest();\n * xhr.responseType = 'blob';\n * xhr.addEventListener('loadend', function (evt) {\n * const data = this.response;\n * if (data !== undefined) {\n * tile.getImage().src = URL.createObjectURL(data);\n * } else {\n * tile.setState(TileState.ERROR);\n * }\n * });\n * xhr.addEventListener('error', function () {\n * tile.setState(TileState.ERROR);\n * });\n * xhr.open('GET', src);\n * xhr.send();\n * });\n * ```\n *\n * @typedef {function(Tile, string): void} LoadFunction\n * @api\n */\n\n/**\n * {@link module:ol/source/Tile~TileSource} sources use a function of this type to get\n * the url that provides a tile for a given tile coordinate.\n *\n * This function takes a {@link module:ol/tilecoord~TileCoord} for the tile\n * coordinate, a `{number}` representing the pixel ratio and a\n * {@link module:ol/proj/Projection~Projection} for the projection as arguments\n * and returns a `{string}` representing the tile URL, or undefined if no tile\n * should be requested for the passed tile coordinate.\n *\n * @typedef {function(import(\"./tilecoord.js\").TileCoord, number,\n * import(\"./proj/Projection.js\").default): (string|undefined)} UrlFunction\n * @api\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @api\n */\n\n/**\n * @classdesc\n * Base class for tiles.\n *\n * @abstract\n */\nclass Tile extends EventTarget {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {Options} [options] Tile options.\n */\n constructor(tileCoord, state, options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.tileCoord = tileCoord;\n\n /**\n * @protected\n * @type {import(\"./TileState.js\").default}\n */\n this.state = state;\n\n /**\n * A key assigned to the tile. This is used in conjunction with a source key\n * to determine if a cached version of this tile may be used by the renderer.\n * @type {string}\n */\n this.key = '';\n\n /**\n * The duration for the opacity transition.\n * @private\n * @type {number}\n */\n this.transition_ =\n options.transition === undefined ? 250 : options.transition;\n\n /**\n * Lookup of start times for rendering transitions. If the start time is\n * equal to -1, the transition is complete.\n * @private\n * @type {Object<string, number>}\n */\n this.transitionStarts_ = {};\n\n /**\n * @type {boolean}\n */\n this.interpolate = !!options.interpolate;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Called by the tile cache when the tile is removed from the cache due to expiry\n */\n release() {\n // to remove the `change` listener on this tile in `ol/TileQueue#handleTileChange`\n this.setState(TileState.EMPTY);\n }\n\n /**\n * @return {string} Key.\n */\n getKey() {\n return this.key + '/' + this.tileCoord;\n }\n\n /**\n * Get the tile coordinate for this tile.\n * @return {import(\"./tilecoord.js\").TileCoord} The tile coordinate.\n * @api\n */\n getTileCoord() {\n return this.tileCoord;\n }\n\n /**\n * @return {import(\"./TileState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,\n * it is important to set the state correctly to {@link module:ol/TileState~ERROR}\n * when the tile cannot be loaded. Otherwise the tile cannot be removed from\n * the tile queue and will block other requests.\n * @param {import(\"./TileState.js\").default} state State.\n * @api\n */\n setState(state) {\n if (this.state === TileState.EMPTY) {\n // no more state changes\n return;\n }\n if (this.state !== TileState.ERROR && this.state > state) {\n throw new Error('Tile load sequence violation');\n }\n this.state = state;\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n * @abstract\n * @api\n */\n load() {\n abstract();\n }\n\n /**\n * Get the alpha value for rendering.\n * @param {string} id An id for the renderer.\n * @param {number} time The render frame time.\n * @return {number} A number between 0 and 1.\n */\n getAlpha(id, time) {\n if (!this.transition_) {\n return 1;\n }\n\n let start = this.transitionStarts_[id];\n if (!start) {\n start = time;\n this.transitionStarts_[id] = start;\n } else if (start === -1) {\n return 1;\n }\n\n const delta = time - start + 1000 / 60; // avoid rendering at 0\n if (delta >= this.transition_) {\n return 1;\n }\n return easeIn(delta / this.transition_);\n }\n\n /**\n * Determine if a tile is in an alpha transition. A tile is considered in\n * transition if tile.getAlpha() has not yet been called or has been called\n * and returned 1.\n * @param {string} id An id for the renderer.\n * @return {boolean} The tile is in transition.\n */\n inTransition(id) {\n if (!this.transition_) {\n return false;\n }\n return this.transitionStarts_[id] !== -1;\n }\n\n /**\n * Mark a transition as complete.\n * @param {string} id An id for the renderer.\n */\n endTransition(id) {\n if (this.transition_) {\n this.transitionStarts_[id] = -1;\n }\n }\n\n /**\n * @override\n */\n disposeInternal() {\n this.release();\n super.disposeInternal();\n }\n}\n\nexport default Tile;\n","/**\n * @module ol/has\n */\n\nconst ua =\n typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined'\n ? navigator.userAgent.toLowerCase()\n : '';\n\n/**\n * User agent string says we are dealing with Safari as browser.\n * @type {boolean}\n */\nexport const SAFARI = ua.includes('safari') && !ua.includes('chrom');\n\n/**\n * https://bugs.webkit.org/show_bug.cgi?id=237906\n * @type {boolean}\n */\nexport const SAFARI_BUG_237906 =\n SAFARI &&\n (ua.includes('version/15.4') ||\n /cpu (os|iphone os) 15_4 like mac os x/.test(ua));\n\n/**\n * User agent string says we are dealing with a WebKit engine.\n * @type {boolean}\n */\nexport const WEBKIT = ua.includes('webkit') && !ua.includes('edge');\n\n/**\n * User agent string says we are dealing with a Mac as platform.\n * @type {boolean}\n */\nexport const MAC = ua.includes('macintosh');\n\n/**\n * The ratio between physical pixels and device-independent pixels\n * (dips) on the device (`window.devicePixelRatio`).\n * @const\n * @type {number}\n * @api\n */\nexport const DEVICE_PIXEL_RATIO =\n typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1;\n\n/**\n * The execution context is a worker with OffscreenCanvas available.\n * @const\n * @type {boolean}\n */\nexport const WORKER_OFFSCREEN_CANVAS =\n typeof WorkerGlobalScope !== 'undefined' &&\n typeof OffscreenCanvas !== 'undefined' &&\n self instanceof WorkerGlobalScope; //eslint-disable-line\n\n/**\n * Image.prototype.decode() is supported.\n * @type {boolean}\n */\nexport const IMAGE_DECODE =\n typeof Image !== 'undefined' && Image.prototype.decode;\n\n/**\n * createImageBitmap() is supported.\n * @type {boolean}\n */\nexport const CREATE_IMAGE_BITMAP = typeof createImageBitmap === 'function';\n\n/**\n * @type {boolean}\n */\nexport const PASSIVE_EVENT_LISTENERS = (function () {\n let passive = false;\n try {\n const options = Object.defineProperty({}, 'passive', {\n get: function () {\n passive = true;\n },\n });\n\n // @ts-ignore Ignore invalid event type '_'\n window.addEventListener('_', null, options);\n // @ts-ignore Ignore invalid event type '_'\n window.removeEventListener('_', null, options);\n } catch {\n // passive not supported\n }\n return passive;\n})();\n","import {WORKER_OFFSCREEN_CANVAS} from './has.js';\n\n/**\n * @module ol/dom\n */\n\n//FIXME Move this function to the canvas module\n/**\n * Create an html canvas element and returns its 2d context.\n * @param {number} [width] Canvas width.\n * @param {number} [height] Canvas height.\n * @param {Array<HTMLCanvasElement>} [canvasPool] Canvas pool to take existing canvas from.\n * @param {CanvasRenderingContext2DSettings} [settings] CanvasRenderingContext2DSettings\n * @return {CanvasRenderingContext2D} The context.\n */\nexport function createCanvasContext2D(width, height, canvasPool, settings) {\n /** @type {HTMLCanvasElement|OffscreenCanvas} */\n let canvas;\n if (canvasPool && canvasPool.length) {\n canvas = /** @type {HTMLCanvasElement} */ (canvasPool.shift());\n } else if (WORKER_OFFSCREEN_CANVAS) {\n canvas = new OffscreenCanvas(width || 300, height || 300);\n } else {\n canvas = document.createElement('canvas');\n }\n if (width) {\n canvas.width = width;\n }\n if (height) {\n canvas.height = height;\n }\n //FIXME Allow OffscreenCanvasRenderingContext2D as return type\n return /** @type {CanvasRenderingContext2D} */ (\n canvas.getContext('2d', settings)\n );\n}\n\n/** @type {CanvasRenderingContext2D} */\nlet sharedCanvasContext;\n\n/**\n * @return {CanvasRenderingContext2D} Shared canvas context.\n */\nexport function getSharedCanvasContext2D() {\n if (!sharedCanvasContext) {\n sharedCanvasContext = createCanvasContext2D(1, 1);\n }\n return sharedCanvasContext;\n}\n\n/**\n * Releases canvas memory to avoid exceeding memory limits in Safari.\n * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/\n * @param {CanvasRenderingContext2D} context Context.\n */\nexport function releaseCanvas(context) {\n const canvas = context.canvas;\n canvas.width = 1;\n canvas.height = 1;\n context.clearRect(0, 0, 1, 1);\n}\n\n/**\n * Get the current computed width for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerWidth(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The width.\n */\nexport function outerWidth(element) {\n let width = element.offsetWidth;\n const style = getComputedStyle(element);\n width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);\n\n return width;\n}\n\n/**\n * Get the current computed height for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerHeight(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The height.\n */\nexport function outerHeight(element) {\n let height = element.offsetHeight;\n const style = getComputedStyle(element);\n height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);\n\n return height;\n}\n\n/**\n * @param {Node} newNode Node to replace old node\n * @param {Node} oldNode The node to be replaced\n */\nexport function replaceNode(newNode, oldNode) {\n const parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n}\n\n/**\n * @param {Node} node The node to remove the children from.\n */\nexport function removeChildren(node) {\n while (node.lastChild) {\n node.lastChild.remove();\n }\n}\n\n/**\n * Transform the children of a parent node so they match the\n * provided list of children. This function aims to efficiently\n * remove, add, and reorder child nodes while maintaining a simple\n * implementation (it is not guaranteed to minimize DOM operations).\n * @param {Node} node The parent node whose children need reworking.\n * @param {Array<Node>} children The desired children.\n */\nexport function replaceChildren(node, children) {\n const oldChildren = node.childNodes;\n\n for (let i = 0; true; ++i) {\n const oldChild = oldChildren[i];\n const newChild = children[i];\n\n // check if our work is done\n if (!oldChild && !newChild) {\n break;\n }\n\n // check if children match\n if (oldChild === newChild) {\n continue;\n }\n\n // check if a new child needs to be added\n if (!oldChild) {\n node.appendChild(newChild);\n continue;\n }\n\n // check if an old child needs to be removed\n if (!newChild) {\n node.removeChild(oldChild);\n --i;\n continue;\n }\n\n // reorder\n node.insertBefore(newChild, oldChild);\n }\n}\n","/**\n * @module ol/DataTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\n\n/**\n * @typedef {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap} ImageLike\n */\n\n/**\n * @typedef {Uint8Array|Uint8ClampedArray|Float32Array|DataView} ArrayLike\n */\n\n/**\n * Data that can be used with a DataTile.\n * @typedef {ArrayLike|ImageLike} Data\n */\n\n/**\n * @param {Data} data Tile data.\n * @return {ImageLike|null} The image-like data.\n */\nexport function asImageLike(data) {\n return data instanceof Image ||\n data instanceof HTMLCanvasElement ||\n data instanceof HTMLVideoElement ||\n data instanceof ImageBitmap\n ? data\n : null;\n}\n\n/**\n * @param {Data} data Tile data.\n * @return {ArrayLike|null} The array-like data.\n */\nexport function asArrayLike(data) {\n return data instanceof Uint8Array ||\n data instanceof Uint8ClampedArray ||\n data instanceof Float32Array ||\n data instanceof DataView\n ? data\n : null;\n}\n\n/**\n * This is set as the cancellation reason when a tile is disposed.\n */\nexport const disposedError = new Error('disposed');\n\n/**\n * @type {CanvasRenderingContext2D|null}\n */\nlet sharedContext = null;\n\n/**\n * @param {ImageLike} image The image.\n * @return {Uint8ClampedArray} The data.\n */\nexport function toArray(image) {\n if (!sharedContext) {\n sharedContext = createCanvasContext2D(\n image.width,\n image.height,\n undefined,\n {willReadFrequently: true},\n );\n }\n const canvas = sharedContext.canvas;\n const width = image.width;\n if (canvas.width !== width) {\n canvas.width = width;\n }\n const height = image.height;\n if (canvas.height !== height) {\n canvas.height = height;\n }\n sharedContext.clearRect(0, 0, width, height);\n sharedContext.drawImage(image, 0, 0);\n return sharedContext.getImageData(0, 0, width, height).data;\n}\n\n/**\n * @type {import('./size.js').Size}\n */\nconst defaultSize = [256, 256];\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @property {function(): Promise<Data>} loader Data loader. For loaders that generate images,\n * the promise should not resolve until the image is loaded.\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @property {import('./size.js').Size} [size=[256, 256]] Tile size.\n * @property {AbortController} [controller] An abort controller.\n * @api\n */\n\nclass DataTile extends Tile {\n /**\n * @param {Options} options Tile options.\n */\n constructor(options) {\n const state = TileState.IDLE;\n\n super(options.tileCoord, state, {\n transition: options.transition,\n interpolate: options.interpolate,\n });\n\n /**\n * @type {function(): Promise<Data>}\n * @private\n */\n this.loader_ = options.loader;\n\n /**\n * @type {Data}\n * @private\n */\n this.data_ = null;\n\n /**\n * @type {Error}\n * @private\n */\n this.error_ = null;\n\n /**\n * @type {import('./size.js').Size|null}\n * @private\n */\n this.size_ = options.size || null;\n\n /**\n * @type {AbortController|null}\n * @private\n */\n this.controller_ = options.controller || null;\n }\n\n /**\n * Get the tile size.\n * @return {import('./size.js').Size} Tile size.\n */\n getSize() {\n if (this.size_) {\n return this.size_;\n }\n const imageData = asImageLike(this.data_);\n if (imageData) {\n return [imageData.width, imageData.height];\n }\n return defaultSize;\n }\n\n /**\n * Get the data for the tile.\n * @return {Data} Tile data.\n * @api\n */\n getData() {\n return this.data_;\n }\n\n /**\n * Get any loading error.\n * @return {Error} Loading error.\n * @api\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Load the tile data.\n * @api\n * @override\n */\n load() {\n if (this.state !== TileState.IDLE && this.state !== TileState.ERROR) {\n return;\n }\n this.state = TileState.LOADING;\n this.changed();\n\n const self = this;\n this.loader_()\n .then(function (data) {\n self.data_ = data;\n self.state = TileState.LOADED;\n self.changed();\n })\n .catch(function (error) {\n self.error_ = error;\n self.state = TileState.ERROR;\n self.changed();\n });\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n if (this.controller_) {\n this.controller_.abort(disposedError);\n this.controller_ = null;\n }\n super.disposeInternal();\n }\n}\n\nexport default DataTile;\n","/**\n * @module ol/asserts\n */\n\n/**\n * @param {*} assertion Assertion we expected to be truthy.\n * @param {string} errorMessage Error message.\n */\nexport function assert(assertion, errorMessage) {\n if (!assertion) {\n throw new Error(errorMessage);\n }\n}\n","/**\n * @module ol/Feature\n */\nimport BaseObject from './Object.js';\nimport {assert} from './asserts.js';\nimport EventType from './events/EventType.js';\nimport {listen, unlistenByKey} from './events.js';\n\n/**\n * @typedef {typeof Feature|typeof import(\"./render/Feature.js\").default} FeatureClass\n */\n\n/**\n * @typedef {Feature|import(\"./render/Feature.js\").default} FeatureLike\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<import(\"./ObjectEventType\").Types|'change:geometry', import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|import(\"./ObjectEventType\").Types\n * |'change:geometry', Return>} FeatureOnSignature\n */\n\n/***\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n * @typedef {Object<string, *> & { geometry?: Geometry }} ObjectWithGeometry\n */\n\n/**\n * @classdesc\n * A vector object for geographic features with a geometry and other\n * attribute properties, similar to the features in vector file formats like\n * GeoJSON.\n *\n * Features can be styled individually with `setStyle`; otherwise they use the\n * style of their vector layer.\n *\n * Note that attribute properties are set as {@link module:ol/Object~BaseObject} properties on\n * the feature object, so they are observable, and have get/set accessors.\n *\n * Typically, a feature has a single geometry property. You can set the\n * geometry using the `setGeometry` method and get it with `getGeometry`.\n * It is possible to store more than one geometry on a feature using attribute\n * properties. By default, the geometry used for rendering is identified by\n * the property name `geometry`. If you want to use another geometry property\n * for rendering, use the `setGeometryName` method to change the attribute\n * property associated with the geometry for the feature. For example:\n *\n * ```js\n *\n * import Feature from 'ol/Feature.js';\n * import Polygon from 'ol/geom/Polygon.js';\n * import Point from 'ol/geom/Point.js';\n *\n * const feature = new Feature({\n * geometry: new Polygon(polyCoords),\n * labelPoint: new Point(labelCoords),\n * name: 'My Polygon',\n * });\n *\n * // get the polygon geometry\n * const poly = feature.getGeometry();\n *\n * // Render the feature as a point using the coordinates from labelPoint\n * feature.setGeometryName('labelPoint');\n *\n * // get the point geometry\n * const point = feature.getGeometry();\n * ```\n *\n * @api\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n */\nclass Feature extends BaseObject {\n /**\n * @param {Geometry|ObjectWithGeometry<Geometry>} [geometryOrProperties]\n * You may pass a Geometry object directly, or an object literal containing\n * properties. If you pass an object literal, you may include a Geometry\n * associated with a `geometry` key.\n */\n constructor(geometryOrProperties) {\n super();\n\n /***\n * @type {FeatureOnSignature<import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {FeatureOnSignature<import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {FeatureOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = undefined;\n\n /**\n * @type {string}\n * @private\n */\n this.geometryName_ = 'geometry';\n\n /**\n * User provided style.\n * @private\n * @type {import(\"./style/Style.js\").StyleLike}\n */\n this.style_ = null;\n\n /**\n * @private\n * @type {import(\"./style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction_ = undefined;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.geometryChangeKey_ = null;\n\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n\n if (geometryOrProperties) {\n if (\n typeof (\n /** @type {?} */ (geometryOrProperties).getSimplifiedGeometry\n ) === 'function'\n ) {\n const geometry = /** @type {Geometry} */ (geometryOrProperties);\n this.setGeometry(geometry);\n } else {\n /** @type {Object<string, *>} */\n const properties = geometryOrProperties;\n this.setProperties(properties);\n }\n }\n }\n\n /**\n * Clone this feature. If the original feature has a geometry it\n * is also cloned. The feature id is not set in the clone.\n * @return {Feature<Geometry>} The clone.\n * @api\n */\n clone() {\n const clone = /** @type {Feature<Geometry>} */ (\n new Feature(this.hasProperties() ? this.getProperties() : null)\n );\n clone.setGeometryName(this.getGeometryName());\n const geometry = this.getGeometry();\n if (geometry) {\n clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));\n }\n const style = this.getStyle();\n if (style) {\n clone.setStyle(style);\n }\n return clone;\n }\n\n /**\n * Get the feature's default geometry. A feature may have any number of named\n * geometries. The \"default\" geometry (the one that is rendered by default) is\n * set when calling {@link module:ol/Feature~Feature#setGeometry}.\n * @return {Geometry|undefined} The default geometry for the feature.\n * @api\n * @observable\n */\n getGeometry() {\n return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is either set when reading data from a remote source or set explicitly by\n * calling {@link module:ol/Feature~Feature#setId}.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * Get the name of the feature's default geometry. By default, the default\n * geometry is named `geometry`.\n * @return {string} Get the property name associated with the default geometry\n * for this feature.\n * @api\n */\n getGeometryName() {\n return this.geometryName_;\n }\n\n /**\n * Get the feature's style. Will return what was provided to the\n * {@link module:ol/Feature~Feature#setStyle} method.\n * @return {import(\"./style/Style.js\").StyleLike|undefined} The feature style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the feature's style function.\n * @return {import(\"./style/Style.js\").StyleFunction|undefined} Return a function\n * representing the current style of this feature.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @private\n */\n handleGeometryChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleGeometryChanged_() {\n if (this.geometryChangeKey_) {\n unlistenByKey(this.geometryChangeKey_);\n this.geometryChangeKey_ = null;\n }\n const geometry = this.getGeometry();\n if (geometry) {\n this.geometryChangeKey_ = listen(\n geometry,\n EventType.CHANGE,\n this.handleGeometryChange_,\n this,\n );\n }\n this.changed();\n }\n\n /**\n * Set the default geometry for the feature. This will update the property\n * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.\n * @param {Geometry|undefined} geometry The new geometry.\n * @api\n * @observable\n */\n setGeometry(geometry) {\n this.set(this.geometryName_, geometry);\n }\n\n /**\n * Set the style for the feature to override the layer style. This can be a\n * single style object, an array of styles, or a function that takes a\n * resolution and returns an array of styles. To unset the feature style, call\n * `setStyle()` without arguments or a falsey value.\n * @param {import(\"./style/Style.js\").StyleLike} [style] Style for this feature.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setStyle(style) {\n this.style_ = style;\n this.styleFunction_ = !style ? undefined : createStyleFunction(style);\n this.changed();\n }\n\n /**\n * Set the feature id. The feature id is considered stable and may be used when\n * requesting features or comparing identifiers returned from a remote source.\n * The feature id can be used with the\n * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.\n * @param {number|string|undefined} id The feature id.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setId(id) {\n this.id_ = id;\n this.changed();\n }\n\n /**\n * Set the property name to be used when getting the feature's default geometry.\n * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with\n * this name will be returned.\n * @param {string} name The property name of the default geometry.\n * @api\n */\n setGeometryName(name) {\n this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.geometryName_ = name;\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.handleGeometryChanged_();\n }\n}\n\n/**\n * Convert the provided object into a feature style function. Functions passed\n * through unchanged. Arrays of Style or single style objects wrapped\n * in a new feature style function.\n * @param {!import(\"./style/Style.js\").StyleFunction|!Array<import(\"./style/Style.js\").default>|!import(\"./style/Style.js\").default} obj\n * A feature style function, a single style, or an array of styles.\n * @return {import(\"./style/Style.js\").StyleFunction} A style function.\n */\nexport function createStyleFunction(obj) {\n if (typeof obj === 'function') {\n return obj;\n }\n /**\n * @type {Array<import(\"./style/Style.js\").default>}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(\n typeof (/** @type {?} */ (obj).getZIndex) === 'function',\n 'Expected an `ol/style/Style` or an array of `ol/style/Style.js`',\n );\n const style = /** @type {import(\"./style/Style.js\").default} */ (obj);\n styles = [style];\n }\n return function () {\n return styles;\n };\n}\nexport default Feature;\n","/**\n * @module ol/extent/Relationship\n */\n\n/**\n * Relationship to an extent.\n * @enum {number}\n */\nexport default {\n UNKNOWN: 0,\n INTERSECTING: 1,\n ABOVE: 2,\n RIGHT: 4,\n BELOW: 8,\n LEFT: 16,\n};\n","/**\n * @module ol/extent\n */\nimport Relationship from './extent/Relationship.js';\n\n/**\n * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.\n * @typedef {Array<number>} Extent\n * @api\n */\n\n/**\n * Extent corner.\n * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner\n */\n\n/**\n * Build an extent that includes all given coordinates.\n *\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates Coordinates.\n * @return {Extent} Bounding extent.\n * @api\n */\nexport function boundingExtent(coordinates) {\n const extent = createEmpty();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Array<number>} xs Xs.\n * @param {Array<number>} ys Ys.\n * @param {Extent} [dest] Destination extent.\n * @private\n * @return {Extent} Extent.\n */\nfunction _boundingExtentXYs(xs, ys, dest) {\n const minX = Math.min.apply(null, xs);\n const minY = Math.min.apply(null, ys);\n const maxX = Math.max.apply(null, xs);\n const maxY = Math.max.apply(null, ys);\n return createOrUpdate(minX, minY, maxX, maxY, dest);\n}\n\n/**\n * Return extent increased by the provided value.\n * @param {Extent} extent Extent.\n * @param {number} value The amount by which the extent should be buffered.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n * @api\n */\nexport function buffer(extent, value, dest) {\n if (dest) {\n dest[0] = extent[0] - value;\n dest[1] = extent[1] - value;\n dest[2] = extent[2] + value;\n dest[3] = extent[3] + value;\n return dest;\n }\n return [\n extent[0] - value,\n extent[1] - value,\n extent[2] + value,\n extent[3] + value,\n ];\n}\n\n/**\n * Creates a clone of an extent.\n *\n * @param {Extent} extent Extent to clone.\n * @param {Extent} [dest] Extent.\n * @return {Extent} The clone.\n */\nexport function clone(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent.slice();\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {number} Closest squared distance.\n */\nexport function closestSquaredDistanceXY(extent, x, y) {\n let dx, dy;\n if (x < extent[0]) {\n dx = extent[0] - x;\n } else if (extent[2] < x) {\n dx = x - extent[2];\n } else {\n dx = 0;\n }\n if (y < extent[1]) {\n dy = extent[1] - y;\n } else if (extent[3] < y) {\n dy = y - extent[3];\n } else {\n dy = 0;\n }\n return dx * dx + dy * dy;\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} The coordinate is contained in the extent.\n * @api\n */\nexport function containsCoordinate(extent, coordinate) {\n return containsXY(extent, coordinate[0], coordinate[1]);\n}\n\n/**\n * Check if one extent contains another.\n *\n * An extent is deemed contained if it lies completely within the other extent,\n * including if they share one or more edges.\n *\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The second extent is contained by or on the edge of the\n * first.\n * @api\n */\nexport function containsExtent(extent1, extent2) {\n return (\n extent1[0] <= extent2[0] &&\n extent2[2] <= extent1[2] &&\n extent1[1] <= extent2[1] &&\n extent2[3] <= extent1[3]\n );\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {number} x X coordinate.\n * @param {number} y Y coordinate.\n * @return {boolean} The x, y values are contained in the extent.\n * @api\n */\nexport function containsXY(extent, x, y) {\n return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];\n}\n\n/**\n * Get the relationship between a coordinate and extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate The coordinate.\n * @return {import(\"./extent/Relationship.js\").default} The relationship (bitwise compare with\n * import(\"./extent/Relationship.js\").Relationship).\n */\nexport function coordinateRelationship(extent, coordinate) {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const x = coordinate[0];\n const y = coordinate[1];\n let relationship = Relationship.UNKNOWN;\n if (x < minX) {\n relationship = relationship | Relationship.LEFT;\n } else if (x > maxX) {\n relationship = relationship | Relationship.RIGHT;\n }\n if (y < minY) {\n relationship = relationship | Relationship.BELOW;\n } else if (y > maxY) {\n relationship = relationship | Relationship.ABOVE;\n }\n if (relationship === Relationship.UNKNOWN) {\n relationship = Relationship.INTERSECTING;\n }\n return relationship;\n}\n\n/**\n * Create an empty extent.\n * @return {Extent} Empty extent.\n * @api\n */\nexport function createEmpty() {\n return [Infinity, Infinity, -Infinity, -Infinity];\n}\n\n/**\n * Create a new extent or update the provided extent.\n * @param {number} minX Minimum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxX Maximum X.\n * @param {number} maxY Maximum Y.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdate(minX, minY, maxX, maxY, dest) {\n if (dest) {\n dest[0] = minX;\n dest[1] = minY;\n dest[2] = maxX;\n dest[3] = maxY;\n return dest;\n }\n return [minX, minY, maxX, maxY];\n}\n\n/**\n * Create a new empty extent or make the provided one empty.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateEmpty(dest) {\n return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, dest);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinate(coordinate, dest) {\n const x = coordinate[0];\n const y = coordinate[1];\n return createOrUpdate(x, y, x, y, dest);\n}\n\n/**\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinates(coordinates, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendCoordinates(extent, coordinates);\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n dest,\n) {\n const extent = createOrUpdateEmpty(dest);\n return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);\n}\n\n/**\n * @param {Array<Array<import(\"./coordinate.js\").Coordinate>>} rings Rings.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromRings(rings, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendRings(extent, rings);\n}\n\n/**\n * Determine if two extents are equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The two extents are equivalent.\n * @api\n */\nexport function equals(extent1, extent2) {\n return (\n extent1[0] == extent2[0] &&\n extent1[2] == extent2[2] &&\n extent1[1] == extent2[1] &&\n extent1[3] == extent2[3]\n );\n}\n\n/**\n * Determine if two extents are approximately equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {number} tolerance Tolerance in extent coordinate units.\n * @return {boolean} The two extents differ by less than the tolerance.\n */\nexport function approximatelyEquals(extent1, extent2, tolerance) {\n return (\n Math.abs(extent1[0] - extent2[0]) < tolerance &&\n Math.abs(extent1[2] - extent2[2]) < tolerance &&\n Math.abs(extent1[1] - extent2[1]) < tolerance &&\n Math.abs(extent1[3] - extent2[3]) < tolerance\n );\n}\n\n/**\n * Modify an extent to include another extent.\n * @param {Extent} extent1 The extent to be modified.\n * @param {Extent} extent2 The extent that will be included in the first.\n * @return {Extent} A reference to the first (extended) extent.\n * @api\n */\nexport function extend(extent1, extent2) {\n if (extent2[0] < extent1[0]) {\n extent1[0] = extent2[0];\n }\n if (extent2[2] > extent1[2]) {\n extent1[2] = extent2[2];\n }\n if (extent2[1] < extent1[1]) {\n extent1[1] = extent2[1];\n }\n if (extent2[3] > extent1[3]) {\n extent1[3] = extent2[3];\n }\n return extent1;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n */\nexport function extendCoordinate(extent, coordinate) {\n if (coordinate[0] < extent[0]) {\n extent[0] = coordinate[0];\n }\n if (coordinate[0] > extent[2]) {\n extent[2] = coordinate[0];\n }\n if (coordinate[1] < extent[1]) {\n extent[1] = coordinate[1];\n }\n if (coordinate[1] > extent[3]) {\n extent[3] = coordinate[1];\n }\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates Coordinates.\n * @return {Extent} Extent.\n */\nexport function extendCoordinates(extent, coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Extent} Extent.\n */\nexport function extendFlatCoordinates(\n extent,\n flatCoordinates,\n offset,\n end,\n stride,\n) {\n for (; offset < end; offset += stride) {\n extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array<Array<import(\"./coordinate.js\").Coordinate>>} rings Rings.\n * @return {Extent} Extent.\n */\nexport function extendRings(extent, rings) {\n for (let i = 0, ii = rings.length; i < ii; ++i) {\n extendCoordinates(extent, rings[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n */\nexport function extendXY(extent, x, y) {\n extent[0] = Math.min(extent[0], x);\n extent[1] = Math.min(extent[1], y);\n extent[2] = Math.max(extent[2], x);\n extent[3] = Math.max(extent[3], y);\n}\n\n/**\n * This function calls `callback` for each corner of the extent. If the\n * callback returns a truthy value the function returns that value\n * immediately. Otherwise the function returns `false`.\n * @param {Extent} extent Extent.\n * @param {function(import(\"./coordinate.js\").Coordinate): S} callback Callback.\n * @return {S|boolean} Value.\n * @template S\n */\nexport function forEachCorner(extent, callback) {\n let val;\n val = callback(getBottomLeft(extent));\n if (val) {\n return val;\n }\n val = callback(getBottomRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopLeft(extent));\n if (val) {\n return val;\n }\n return false;\n}\n\n/**\n * Get the size of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Area.\n * @api\n */\nexport function getArea(extent) {\n let area = 0;\n if (!isEmpty(extent)) {\n area = getWidth(extent) * getHeight(extent);\n }\n return area;\n}\n\n/**\n * Get the bottom left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom left coordinate.\n * @api\n */\nexport function getBottomLeft(extent) {\n return [extent[0], extent[1]];\n}\n\n/**\n * Get the bottom right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom right coordinate.\n * @api\n */\nexport function getBottomRight(extent) {\n return [extent[2], extent[1]];\n}\n\n/**\n * Get the center coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Center.\n * @api\n */\nexport function getCenter(extent) {\n return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];\n}\n\n/**\n * Get a corner coordinate of an extent.\n * @param {Extent} extent Extent.\n * @param {Corner} corner Corner.\n * @return {import(\"./coordinate.js\").Coordinate} Corner coordinate.\n */\nexport function getCorner(extent, corner) {\n let coordinate;\n if (corner === 'bottom-left') {\n coordinate = getBottomLeft(extent);\n } else if (corner === 'bottom-right') {\n coordinate = getBottomRight(extent);\n } else if (corner === 'top-left') {\n coordinate = getTopLeft(extent);\n } else if (corner === 'top-right') {\n coordinate = getTopRight(extent);\n } else {\n throw new Error('Invalid corner');\n }\n return coordinate;\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Enlarged area.\n */\nexport function getEnlargedArea(extent1, extent2) {\n const minX = Math.min(extent1[0], extent2[0]);\n const minY = Math.min(extent1[1], extent2[1]);\n const maxX = Math.max(extent1[2], extent2[2]);\n const maxY = Math.max(extent1[3], extent2[3]);\n return (maxX - minX) * (maxY - minY);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function getForViewAndSize(center, resolution, rotation, size, dest) {\n const [x0, y0, x1, y1, x2, y2, x3, y3] = getRotatedViewport(\n center,\n resolution,\n rotation,\n size,\n );\n return createOrUpdate(\n Math.min(x0, x1, x2, x3),\n Math.min(y0, y1, y2, y3),\n Math.max(x0, x1, x2, x3),\n Math.max(y0, y1, y2, y3),\n dest,\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array<number>} Linear ring representing the viewport.\n */\nexport function getRotatedViewport(center, resolution, rotation, size) {\n const dx = (resolution * size[0]) / 2;\n const dy = (resolution * size[1]) / 2;\n const cosRotation = Math.cos(rotation);\n const sinRotation = Math.sin(rotation);\n const xCos = dx * cosRotation;\n const xSin = dx * sinRotation;\n const yCos = dy * cosRotation;\n const ySin = dy * sinRotation;\n const x = center[0];\n const y = center[1];\n return [\n x - xCos + ySin,\n y - xSin - yCos,\n x - xCos - ySin,\n y - xSin + yCos,\n x + xCos - ySin,\n y + xSin + yCos,\n x + xCos + ySin,\n y + xSin - yCos,\n x - xCos + ySin,\n y - xSin - yCos,\n ];\n}\n\n/**\n * Get the height of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Height.\n * @api\n */\nexport function getHeight(extent) {\n return extent[3] - extent[1];\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Intersection area.\n */\nexport function getIntersectionArea(extent1, extent2) {\n const intersection = getIntersection(extent1, extent2);\n return getArea(intersection);\n}\n\n/**\n * Get the intersection of two extents.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {Extent} [dest] Optional extent to populate with intersection.\n * @return {Extent} Intersecting extent.\n * @api\n */\nexport function getIntersection(extent1, extent2, dest) {\n const intersection = dest ? dest : createEmpty();\n if (intersects(extent1, extent2)) {\n if (extent1[0] > extent2[0]) {\n intersection[0] = extent1[0];\n } else {\n intersection[0] = extent2[0];\n }\n if (extent1[1] > extent2[1]) {\n intersection[1] = extent1[1];\n } else {\n intersection[1] = extent2[1];\n }\n if (extent1[2] < extent2[2]) {\n intersection[2] = extent1[2];\n } else {\n intersection[2] = extent2[2];\n }\n if (extent1[3] < extent2[3]) {\n intersection[3] = extent1[3];\n } else {\n intersection[3] = extent2[3];\n }\n } else {\n createOrUpdateEmpty(intersection);\n }\n return intersection;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @return {number} Margin.\n */\nexport function getMargin(extent) {\n return getWidth(extent) + getHeight(extent);\n}\n\n/**\n * Get the size (width, height) of an extent.\n * @param {Extent} extent The extent.\n * @return {import(\"./size.js\").Size} The extent size.\n * @api\n */\nexport function getSize(extent) {\n return [extent[2] - extent[0], extent[3] - extent[1]];\n}\n\n/**\n * Get the top left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top left coordinate.\n * @api\n */\nexport function getTopLeft(extent) {\n return [extent[0], extent[3]];\n}\n\n/**\n * Get the top right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top right coordinate.\n * @api\n */\nexport function getTopRight(extent) {\n return [extent[2], extent[3]];\n}\n\n/**\n * Get the width of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Width.\n * @api\n */\nexport function getWidth(extent) {\n return extent[2] - extent[0];\n}\n\n/**\n * Determine if one extent intersects another.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent.\n * @return {boolean} The two extents intersect.\n * @api\n */\nexport function intersects(extent1, extent2) {\n return (\n extent1[0] <= extent2[2] &&\n extent1[2] >= extent2[0] &&\n extent1[1] <= extent2[3] &&\n extent1[3] >= extent2[1]\n );\n}\n\n/**\n * Determine if an extent is empty.\n * @param {Extent} extent Extent.\n * @return {boolean} Is empty.\n * @api\n */\nexport function isEmpty(extent) {\n return extent[2] < extent[0] || extent[3] < extent[1];\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function returnOrUpdate(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} value Value.\n */\nexport function scaleFromCenter(extent, value) {\n const deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);\n const deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);\n extent[0] -= deltaX;\n extent[2] += deltaX;\n extent[1] -= deltaY;\n extent[3] += deltaY;\n}\n\n/**\n * Determine if the segment between two coordinates intersects (crosses,\n * touches, or is contained by) the provided extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} start Segment start coordinate.\n * @param {import(\"./coordinate.js\").Coordinate} end Segment end coordinate.\n * @return {boolean} The segment intersects the extent.\n */\nexport function intersectsSegment(extent, start, end) {\n let intersects = false;\n const startRel = coordinateRelationship(extent, start);\n const endRel = coordinateRelationship(extent, end);\n if (\n startRel === Relationship.INTERSECTING ||\n endRel === Relationship.INTERSECTING\n ) {\n intersects = true;\n } else {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const startX = start[0];\n const startY = start[1];\n const endX = end[0];\n const endY = end[1];\n const slope = (endY - startY) / (endX - startX);\n let x, y;\n if (!!(endRel & Relationship.ABOVE) && !(startRel & Relationship.ABOVE)) {\n // potentially intersects top\n x = endX - (endY - maxY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.RIGHT) &&\n !(startRel & Relationship.RIGHT)\n ) {\n // potentially intersects right\n y = endY - (endX - maxX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.BELOW) &&\n !(startRel & Relationship.BELOW)\n ) {\n // potentially intersects bottom\n x = endX - (endY - minY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.LEFT) &&\n !(startRel & Relationship.LEFT)\n ) {\n // potentially intersects left\n y = endY - (endX - minX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n }\n return intersects;\n}\n\n/**\n * Apply a transform function to the extent.\n * @param {Extent} extent Extent.\n * @param {import(\"./proj.js\").TransformFunction} transformFn Transform function.\n * Called with `[minX, minY, maxX, maxY]` extent coordinates.\n * @param {Extent} [dest] Destination extent.\n * @param {number} [stops] Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {Extent} Extent.\n * @api\n */\nexport function applyTransform(extent, transformFn, dest, stops) {\n if (isEmpty(extent)) {\n return createOrUpdateEmpty(dest);\n }\n let coordinates = [];\n if (stops > 1) {\n const width = extent[2] - extent[0];\n const height = extent[3] - extent[1];\n for (let i = 0; i < stops; ++i) {\n coordinates.push(\n extent[0] + (width * i) / stops,\n extent[1],\n extent[2],\n extent[1] + (height * i) / stops,\n extent[2] - (width * i) / stops,\n extent[3],\n extent[0],\n extent[3] - (height * i) / stops,\n );\n }\n } else {\n coordinates = [\n extent[0],\n extent[1],\n extent[2],\n extent[1],\n extent[2],\n extent[3],\n extent[0],\n extent[3],\n ];\n }\n transformFn(coordinates, coordinates, 2);\n const xs = [];\n const ys = [];\n for (let i = 0, l = coordinates.length; i < l; i += 2) {\n xs.push(coordinates[i]);\n ys.push(coordinates[i + 1]);\n }\n return _boundingExtentXYs(xs, ys, dest);\n}\n\n/**\n * Modifies the provided extent in-place to be within the real world\n * extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @return {Extent} The extent within the real world extent.\n */\nexport function wrapX(extent, projection) {\n const projectionExtent = projection.getExtent();\n const center = getCenter(extent);\n if (\n projection.canWrapX() &&\n (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])\n ) {\n const worldWidth = getWidth(projectionExtent);\n const worldsAway = Math.floor(\n (center[0] - projectionExtent[0]) / worldWidth,\n );\n const offset = worldsAway * worldWidth;\n extent[0] -= offset;\n extent[2] -= offset;\n }\n return extent;\n}\n\n/**\n * Fits the extent to the real world\n *\n * If the extent does not cross the anti meridian, this will return the extent in an array\n * If the extent crosses the anti meridian, the extent will be sliced, so each part fits within the\n * real world\n *\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @param {boolean} [multiWorld] Return all worlds\n * @return {Array<Extent>} The extent within the real world extent.\n */\nexport function wrapAndSliceX(extent, projection, multiWorld) {\n if (projection.canWrapX()) {\n const projectionExtent = projection.getExtent();\n\n if (!isFinite(extent[0]) || !isFinite(extent[2])) {\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n\n wrapX(extent, projection);\n const worldWidth = getWidth(projectionExtent);\n\n if (getWidth(extent) > worldWidth && !multiWorld) {\n // the extent wraps around on itself\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n if (extent[0] < projectionExtent[0]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0] + worldWidth, extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2], extent[3]],\n ];\n }\n if (extent[2] > projectionExtent[2]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0], extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2] - worldWidth, extent[3]],\n ];\n }\n }\n\n return [extent];\n}\n","/**\n * @module ol/math\n */\n\n/**\n * Takes a number and clamps it to within the provided bounds.\n * @param {number} value The input number.\n * @param {number} min The minimum value to return.\n * @param {number} max The maximum value to return.\n * @return {number} The input number if it is within bounds, or the nearest\n * number within the bounds.\n */\nexport function clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Returns the square of the closest distance between the point (x, y) and the\n * line segment (x1, y1) to (x2, y2).\n * @param {number} x X.\n * @param {number} y Y.\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredSegmentDistance(x, y, x1, y1, x2, y2) {\n const dx = x2 - x1;\n const dy = y2 - y1;\n if (dx !== 0 || dy !== 0) {\n const t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x1 = x2;\n y1 = y2;\n } else if (t > 0) {\n x1 += dx * t;\n y1 += dy * t;\n }\n }\n return squaredDistance(x, y, x1, y1);\n}\n\n/**\n * Returns the square of the distance between the points (x1, y1) and (x2, y2).\n * @param {number} x1 X1.\n * @param {number} y1 Y1.\n * @param {number} x2 X2.\n * @param {number} y2 Y2.\n * @return {number} Squared distance.\n */\nexport function squaredDistance(x1, y1, x2, y2) {\n const dx = x2 - x1;\n const dy = y2 - y1;\n return dx * dx + dy * dy;\n}\n\n/**\n * Solves system of linear equations using Gaussian elimination method.\n *\n * @param {Array<Array<number>>} mat Augmented matrix (n x n + 1 column)\n * in row-major order.\n * @return {Array<number>|null} The resulting vector.\n */\nexport function solveLinearSystem(mat) {\n const n = mat.length;\n\n for (let i = 0; i < n; i++) {\n // Find max in the i-th column (ignoring i - 1 first rows)\n let maxRow = i;\n let maxEl = Math.abs(mat[i][i]);\n for (let r = i + 1; r < n; r++) {\n const absValue = Math.abs(mat[r][i]);\n if (absValue > maxEl) {\n maxEl = absValue;\n maxRow = r;\n }\n }\n\n if (maxEl === 0) {\n return null; // matrix is singular\n }\n\n // Swap max row with i-th (current) row\n const tmp = mat[maxRow];\n mat[maxRow] = mat[i];\n mat[i] = tmp;\n\n // Subtract the i-th row to make all the remaining rows 0 in the i-th column\n for (let j = i + 1; j < n; j++) {\n const coef = -mat[j][i] / mat[i][i];\n for (let k = i; k < n + 1; k++) {\n if (i == k) {\n mat[j][k] = 0;\n } else {\n mat[j][k] += coef * mat[i][k];\n }\n }\n }\n }\n\n // Solve Ax=b for upper triangular matrix A (mat)\n const x = new Array(n);\n for (let l = n - 1; l >= 0; l--) {\n x[l] = mat[l][n] / mat[l][l];\n for (let m = l - 1; m >= 0; m--) {\n mat[m][n] -= mat[m][l] * x[l];\n }\n }\n return x;\n}\n\n/**\n * Converts radians to to degrees.\n *\n * @param {number} angleInRadians Angle in radians.\n * @return {number} Angle in degrees.\n */\nexport function toDegrees(angleInRadians) {\n return (angleInRadians * 180) / Math.PI;\n}\n\n/**\n * Converts degrees to radians.\n *\n * @param {number} angleInDegrees Angle in degrees.\n * @return {number} Angle in radians.\n */\nexport function toRadians(angleInDegrees) {\n return (angleInDegrees * Math.PI) / 180;\n}\n\n/**\n * Returns the modulo of a / b, depending on the sign of b.\n *\n * @param {number} a Dividend.\n * @param {number} b Divisor.\n * @return {number} Modulo.\n */\nexport function modulo(a, b) {\n const r = a % b;\n return r * b < 0 ? r + b : r;\n}\n\n/**\n * Calculates the linearly interpolated value of x between a and b.\n *\n * @param {number} a Number\n * @param {number} b Number\n * @param {number} x Value to be interpolated.\n * @return {number} Interpolated value.\n */\nexport function lerp(a, b, x) {\n return a + x * (b - a);\n}\n\n/**\n * Returns a number with a limited number of decimal digits.\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The input number with a limited number of decimal digits.\n */\nexport function toFixed(n, decimals) {\n const factor = Math.pow(10, decimals);\n return Math.round(n * factor) / factor;\n}\n\n/**\n * Rounds a number to the nearest integer value considering only the given number\n * of decimal digits (with rounding on the final digit).\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The nearest integer.\n */\nexport function round(n, decimals) {\n return Math.round(toFixed(n, decimals));\n}\n\n/**\n * Rounds a number to the next smaller integer considering only the given number\n * of decimal digits (with rounding on the final digit).\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The next smaller integer.\n */\nexport function floor(n, decimals) {\n return Math.floor(toFixed(n, decimals));\n}\n\n/**\n * Rounds a number to the next bigger integer considering only the given number\n * of decimal digits (with rounding on the final digit).\n * @param {number} n The input number.\n * @param {number} decimals The maximum number of decimal digits.\n * @return {number} The next bigger integer.\n */\nexport function ceil(n, decimals) {\n return Math.ceil(toFixed(n, decimals));\n}\n\n/**\n * Wraps a number between some minimum and maximum values.\n * @param {number} n The number to wrap.\n * @param {number} min The minimum of the range (inclusive).\n * @param {number} max The maximum of the range (exclusive).\n * @return {number} The wrapped number.\n */\nexport function wrap(n, min, max) {\n if (n >= min && n < max) {\n return n;\n }\n const range = max - min;\n return ((((n - min) % range) + range) % range) + min;\n}\n","/**\n * @module ol/sphere\n */\nimport {toDegrees, toRadians} from './math.js';\n\n/**\n * Object literal with options for the {@link getLength} or {@link getArea}\n * functions.\n * @typedef {Object} SphereMetricOptions\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857']\n * Projection of the geometry. By default, the geometry is assumed to be in\n * Web Mercator.\n * @property {number} [radius=6371008.8] Sphere radius. By default, the\n * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius)\n * for the WGS84 ellipsoid is used.\n */\n\n/**\n * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid.\n * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius\n * @type {number}\n */\nexport const DEFAULT_RADIUS = 6371008.8;\n\n/**\n * Get the great circle distance (in meters) between two geographic coordinates.\n * @param {Array} c1 Starting coordinate.\n * @param {Array} c2 Ending coordinate.\n * @param {number} [radius] The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {number} The great circle distance between the points (in meters).\n * @api\n */\nexport function getDistance(c1, c2, radius) {\n radius = radius || DEFAULT_RADIUS;\n const lat1 = toRadians(c1[1]);\n const lat2 = toRadians(c2[1]);\n const deltaLatBy2 = (lat2 - lat1) / 2;\n const deltaLonBy2 = toRadians(c2[0] - c1[0]) / 2;\n const a =\n Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) +\n Math.sin(deltaLonBy2) *\n Math.sin(deltaLonBy2) *\n Math.cos(lat1) *\n Math.cos(lat2);\n return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n}\n\n/**\n * Get the cumulative great circle length of linestring coordinates (geographic).\n * @param {Array} coordinates Linestring coordinates.\n * @param {number} radius The sphere radius to use.\n * @return {number} The length (in meters).\n */\nfunction getLengthInternal(coordinates, radius) {\n let length = 0;\n for (let i = 0, ii = coordinates.length; i < ii - 1; ++i) {\n length += getDistance(coordinates[i], coordinates[i + 1], radius);\n }\n return length;\n}\n\n/**\n * Get the spherical length of a geometry. This length is the sum of the\n * great circle distances between coordinates. For polygons, the length is\n * the sum of all rings. For points, the length is zero. For multi-part\n * geometries, the length is the sum of the length of each part.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions} [options] Options for the\n * length calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical length (in meters).\n * @api\n */\nexport function getLength(geometry, options) {\n options = options || {};\n const radius = options.radius || DEFAULT_RADIUS;\n const projection = options.projection || 'EPSG:3857';\n const type = geometry.getType();\n if (type !== 'GeometryCollection') {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n let length = 0;\n let coordinates, coords, i, ii, j, jj;\n switch (type) {\n case 'Point':\n case 'MultiPoint': {\n break;\n }\n case 'LineString':\n case 'LinearRing': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n length = getLengthInternal(coordinates, radius);\n break;\n }\n case 'MultiLineString':\n case 'Polygon': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n length += getLengthInternal(coordinates[i], radius);\n }\n break;\n }\n case 'MultiPolygon': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n for (j = 0, jj = coords.length; j < jj; ++j) {\n length += getLengthInternal(coords[j], radius);\n }\n }\n break;\n }\n case 'GeometryCollection': {\n const geometries =\n /** @type {import(\"./geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n length += getLength(geometries[i], options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return length;\n}\n\n/**\n * Returns the spherical area for a list of coordinates.\n *\n * [Reference](https://trs.jpl.nasa.gov/handle/2014/40409)\n * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for\n * Polygons on a Sphere\", JPL Publication 07-03, Jet Propulsion\n * Laboratory, Pasadena, CA, June 2007\n *\n * @param {Array<import(\"./coordinate.js\").Coordinate>} coordinates List of coordinates of a linear\n * ring. If the ring is oriented clockwise, the area will be positive,\n * otherwise it will be negative.\n * @param {number} radius The sphere radius.\n * @return {number} Area (in square meters).\n */\nfunction getAreaInternal(coordinates, radius) {\n let area = 0;\n const len = coordinates.length;\n let x1 = coordinates[len - 1][0];\n let y1 = coordinates[len - 1][1];\n for (let i = 0; i < len; i++) {\n const x2 = coordinates[i][0];\n const y2 = coordinates[i][1];\n area +=\n toRadians(x2 - x1) *\n (2 + Math.sin(toRadians(y1)) + Math.sin(toRadians(y2)));\n x1 = x2;\n y1 = y2;\n }\n return (area * radius * radius) / 2.0;\n}\n\n/**\n * Get the spherical area of a geometry. This is the area (in meters) assuming\n * that polygon edges are segments of great circles on a sphere.\n * @param {import(\"./geom/Geometry.js\").default} geometry A geometry.\n * @param {SphereMetricOptions} [options] Options for the area\n * calculation. By default, geometries are assumed to be in 'EPSG:3857'.\n * You can change this by providing a `projection` option.\n * @return {number} The spherical area (in square meters).\n * @api\n */\nexport function getArea(geometry, options) {\n options = options || {};\n const radius = options.radius || DEFAULT_RADIUS;\n const projection = options.projection || 'EPSG:3857';\n const type = geometry.getType();\n if (type !== 'GeometryCollection') {\n geometry = geometry.clone().transform(projection, 'EPSG:4326');\n }\n let area = 0;\n let coordinates, coords, i, ii, j, jj;\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n case 'LineString':\n case 'MultiLineString':\n case 'LinearRing': {\n break;\n }\n case 'Polygon': {\n coordinates = /** @type {import(\"./geom/Polygon.js\").default} */ (\n geometry\n ).getCoordinates();\n area = Math.abs(getAreaInternal(coordinates[0], radius));\n for (i = 1, ii = coordinates.length; i < ii; ++i) {\n area -= Math.abs(getAreaInternal(coordinates[i], radius));\n }\n break;\n }\n case 'MultiPolygon': {\n coordinates = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometry\n ).getCoordinates();\n for (i = 0, ii = coordinates.length; i < ii; ++i) {\n coords = coordinates[i];\n area += Math.abs(getAreaInternal(coords[0], radius));\n for (j = 1, jj = coords.length; j < jj; ++j) {\n area -= Math.abs(getAreaInternal(coords[j], radius));\n }\n }\n break;\n }\n case 'GeometryCollection': {\n const geometries =\n /** @type {import(\"./geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries();\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n area += getArea(geometries[i], options);\n }\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return area;\n}\n\n/**\n * Returns the coordinate at the given distance and bearing from `c1`.\n *\n * @param {import(\"./coordinate.js\").Coordinate} c1 The origin point (`[lon, lat]` in degrees).\n * @param {number} distance The great-circle distance between the origin\n * point and the target point.\n * @param {number} bearing The bearing (in radians).\n * @param {number} [radius] The sphere radius to use. Defaults to the Earth's\n * mean radius using the WGS84 ellipsoid.\n * @return {import(\"./coordinate.js\").Coordinate} The target point.\n */\nexport function offset(c1, distance, bearing, radius) {\n radius = radius || DEFAULT_RADIUS;\n const lat1 = toRadians(c1[1]);\n const lon1 = toRadians(c1[0]);\n const dByR = distance / radius;\n const lat = Math.asin(\n Math.sin(lat1) * Math.cos(dByR) +\n Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing),\n );\n const lon =\n lon1 +\n Math.atan2(\n Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),\n Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat),\n );\n return [toDegrees(lon), toDegrees(lat)];\n}\n","/**\n * @module ol/console\n */\n\n/**\n * @typedef {'info'|'warn'|'error'|'none'} Level\n */\n\n/**\n * @type {Object<Level, number>}\n */\nconst levels = {\n info: 1,\n warn: 2,\n error: 3,\n none: 4,\n};\n\n/**\n * @type {number}\n */\nlet level = levels.info;\n\n/**\n * Set the logging level. By default, the level is set to 'info' and all\n * messages will be logged. Set to 'warn' to only display warnings and errors.\n * Set to 'error' to only display errors. Set to 'none' to silence all messages.\n *\n * @param {Level} l The new level.\n */\nexport function setLevel(l) {\n level = levels[l];\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function log(...args) {\n if (level > levels.info) {\n return;\n }\n console.log(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function warn(...args) {\n if (level > levels.warn) {\n return;\n }\n console.warn(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function error(...args) {\n if (level > levels.error) {\n return;\n }\n console.error(...args); // eslint-disable-line no-console\n}\n","/**\n * @module ol/string\n */\n\n/**\n * @param {number} number Number to be formatted\n * @param {number} width The desired width\n * @param {number} [precision] Precision of the output string (i.e. number of decimal places)\n * @return {string} Formatted string\n */\nexport function padNumber(number, width, precision) {\n const numberString =\n precision !== undefined ? number.toFixed(precision) : '' + number;\n let decimal = numberString.indexOf('.');\n decimal = decimal === -1 ? numberString.length : decimal;\n return decimal > width\n ? numberString\n : new Array(1 + width - decimal).join('0') + numberString;\n}\n\n/**\n * Adapted from https://github.com/omichelsen/compare-versions/blob/master/index.js\n * @param {string|number} v1 First version\n * @param {string|number} v2 Second version\n * @return {number} Value\n */\nexport function compareVersions(v1, v2) {\n const s1 = ('' + v1).split('.');\n const s2 = ('' + v2).split('.');\n\n for (let i = 0; i < Math.max(s1.length, s2.length); i++) {\n const n1 = parseInt(s1[i] || '0', 10);\n const n2 = parseInt(s2[i] || '0', 10);\n\n if (n1 > n2) {\n return 1;\n }\n if (n2 > n1) {\n return -1;\n }\n }\n\n return 0;\n}\n","/**\n * @module ol/coordinate\n */\nimport {getWidth} from './extent.js';\nimport {modulo, toFixed} from './math.js';\nimport {padNumber} from './string.js';\n\n/**\n * An array of numbers representing an `xy`, `xyz` or `xyzm` coordinate.\n * Example: `[16, 48]`.\n * @typedef {Array<number>} Coordinate\n * @api\n */\n\n/**\n * A function that takes a {@link module:ol/coordinate~Coordinate} and\n * transforms it into a `{string}`.\n *\n * @typedef {function((Coordinate|undefined)): string} CoordinateFormat\n * @api\n */\n\n/**\n * Add `delta` to `coordinate`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {add} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * add(coord, [-2, 4]);\n * // coord is now [5.85, 51.983333]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {Coordinate} delta Delta.\n * @return {Coordinate} The input coordinate adjusted by\n * the given delta.\n * @api\n */\nexport function add(coordinate, delta) {\n coordinate[0] += +delta[0];\n coordinate[1] += +delta[1];\n return coordinate;\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed circle.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {import(\"./geom/Circle.js\").default} circle The circle.\n * @return {Coordinate} Closest point on the circumference.\n */\nexport function closestOnCircle(coordinate, circle) {\n const r = circle.getRadius();\n const center = circle.getCenter();\n const x0 = center[0];\n const y0 = center[1];\n const x1 = coordinate[0];\n const y1 = coordinate[1];\n\n let dx = x1 - x0;\n const dy = y1 - y0;\n if (dx === 0 && dy === 0) {\n dx = 1;\n }\n const d = Math.sqrt(dx * dx + dy * dy);\n\n const x = x0 + (r * dx) / d;\n const y = y0 + (r * dy) / d;\n\n return [x, y];\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed segment.\n * This is the foot of the perpendicular of the coordinate to the segment when\n * the foot is on the segment, or the closest segment coordinate when the foot\n * is outside the segment.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {Array<Coordinate>} segment The two coordinates\n * of the segment.\n * @return {Coordinate} The foot of the perpendicular of\n * the coordinate to the segment.\n */\nexport function closestOnSegment(coordinate, segment) {\n const x0 = coordinate[0];\n const y0 = coordinate[1];\n const start = segment[0];\n const end = segment[1];\n const x1 = start[0];\n const y1 = start[1];\n const x2 = end[0];\n const y2 = end[1];\n const dx = x2 - x1;\n const dy = y2 - y1;\n const along =\n dx === 0 && dy === 0\n ? 0\n : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);\n let x, y;\n if (along <= 0) {\n x = x1;\n y = y1;\n } else if (along >= 1) {\n x = x2;\n y = y2;\n } else {\n x = x1 + along * dx;\n y = y1 + along * dy;\n }\n return [x, y];\n}\n\n/**\n * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be\n * used to format\n * a {Coordinate} to a string.\n *\n * Example without specifying the fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY();\n * const out = stringifyFunc(coord);\n * // out is now '8, 48'\n *\n * Example with explicitly specifying 2 fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY(2);\n * const out = stringifyFunc(coord);\n * // out is now '7.85, 47.98'\n *\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {CoordinateFormat} Coordinate format.\n * @api\n */\nexport function createStringXY(fractionDigits) {\n return (\n /**\n * @param {Coordinate} coordinate Coordinate.\n * @return {string} String XY.\n */\n function (coordinate) {\n return toStringXY(coordinate, fractionDigits);\n }\n );\n}\n\n/**\n * @param {string} hemispheres Hemispheres.\n * @param {number} degrees Degrees.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} String.\n */\nexport function degreesToStringHDMS(hemispheres, degrees, fractionDigits) {\n const normalizedDegrees = modulo(degrees + 180, 360) - 180;\n const x = Math.abs(3600 * normalizedDegrees);\n const decimals = fractionDigits || 0;\n\n let deg = Math.floor(x / 3600);\n let min = Math.floor((x - deg * 3600) / 60);\n let sec = toFixed(x - deg * 3600 - min * 60, decimals);\n\n if (sec >= 60) {\n sec = 0;\n min += 1;\n }\n\n if (min >= 60) {\n min = 0;\n deg += 1;\n }\n\n let hdms = deg + '\\u00b0';\n if (min !== 0 || sec !== 0) {\n hdms += ' ' + padNumber(min, 2) + '\\u2032';\n }\n if (sec !== 0) {\n hdms += ' ' + padNumber(sec, 2, decimals) + '\\u2033';\n }\n if (normalizedDegrees !== 0) {\n hdms += ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);\n }\n\n return hdms;\n}\n\n/**\n * Transforms the given {@link module:ol/coordinate~Coordinate} to a string\n * using the given string template. The strings `{x}` and `{y}` in the template\n * will be replaced with the first and second coordinate values respectively.\n *\n * Example without specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template);\n * // out is now 'Coordinate is (8|48).'\n *\n * Example explicitly specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template, 2);\n * // out is now 'Coordinate is (7.85|47.98).'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {string} template A template string with `{x}` and `{y}` placeholders\n * that will be replaced by first and second coordinate values.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Formatted coordinate.\n * @api\n */\nexport function format(coordinate, template, fractionDigits) {\n if (coordinate) {\n return template\n .replace('{x}', coordinate[0].toFixed(fractionDigits))\n .replace('{y}', coordinate[1].toFixed(fractionDigits));\n }\n return '';\n}\n\n/**\n * @param {Coordinate} coordinate1 First coordinate.\n * @param {Coordinate} coordinate2 Second coordinate.\n * @return {boolean} The two coordinates are equal.\n */\nexport function equals(coordinate1, coordinate2) {\n let equals = true;\n for (let i = coordinate1.length - 1; i >= 0; --i) {\n if (coordinate1[i] != coordinate2[i]) {\n equals = false;\n break;\n }\n }\n return equals;\n}\n\n/**\n * Rotate `coordinate` by `angle`. `coordinate` is modified in place and\n * returned by the function.\n *\n * Example:\n *\n * import {rotate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const rotateRadians = Math.PI / 2; // 90 degrees\n * rotate(coord, rotateRadians);\n * // coord is now [-47.983333, 7.85]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} angle Angle in radian.\n * @return {Coordinate} Coordinate.\n * @api\n */\nexport function rotate(coordinate, angle) {\n const cosAngle = Math.cos(angle);\n const sinAngle = Math.sin(angle);\n const x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n const y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n coordinate[0] = x;\n coordinate[1] = y;\n return coordinate;\n}\n\n/**\n * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {scale as scaleCoordinate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const scale = 1.2;\n * scaleCoordinate(coord, scale);\n * // coord is now [9.42, 57.5799996]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} scale Scale factor.\n * @return {Coordinate} Coordinate.\n */\nexport function scale(coordinate, scale) {\n coordinate[0] *= scale;\n coordinate[1] *= scale;\n return coordinate;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Squared distance between coord1 and coord2.\n */\nexport function squaredDistance(coord1, coord2) {\n const dx = coord1[0] - coord2[0];\n const dy = coord1[1] - coord2[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Distance between coord1 and coord2.\n */\nexport function distance(coord1, coord2) {\n return Math.sqrt(squaredDistance(coord1, coord2));\n}\n\n/**\n * Calculate the squared distance from a coordinate to a line segment.\n *\n * @param {Coordinate} coordinate Coordinate of the point.\n * @param {Array<Coordinate>} segment Line segment (2\n * coordinates).\n * @return {number} Squared distance from the point to the line segment.\n */\nexport function squaredDistanceToSegment(coordinate, segment) {\n return squaredDistance(coordinate, closestOnSegment(coordinate, segment));\n}\n\n/**\n * Format a geographic coordinate with the hemisphere, degrees, minutes, and\n * seconds.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord);\n * // out is now '47° 58′ 60″ N 7° 50′ 60″ E'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord, 1);\n * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Hemisphere, degrees, minutes and seconds.\n * @api\n */\nexport function toStringHDMS(coordinate, fractionDigits) {\n if (coordinate) {\n return (\n degreesToStringHDMS('NS', coordinate[1], fractionDigits) +\n ' ' +\n degreesToStringHDMS('EW', coordinate[0], fractionDigits)\n );\n }\n return '';\n}\n\n/**\n * Format a coordinate as a comma delimited string.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord);\n * // out is now '8, 48'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord, 1);\n * // out is now '7.8, 48.0'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} XY.\n * @api\n */\nexport function toStringXY(coordinate, fractionDigits) {\n return format(coordinate, '{x}, {y}', fractionDigits);\n}\n\n/**\n * Modifies the provided coordinate in-place to be within the real world\n * extent. The lower projection extent boundary is inclusive, the upper one\n * exclusive.\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {Coordinate} The coordinate within the real world extent.\n */\nexport function wrapX(coordinate, projection) {\n if (projection.canWrapX()) {\n const worldWidth = getWidth(projection.getExtent());\n const worldsAway = getWorldsAway(coordinate, projection, worldWidth);\n if (worldsAway) {\n coordinate[0] -= worldsAway * worldWidth;\n }\n }\n return coordinate;\n}\n/**\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {number} [sourceExtentWidth] Width of the source extent.\n * @return {number} Offset in world widths.\n */\nexport function getWorldsAway(coordinate, projection, sourceExtentWidth) {\n const projectionExtent = projection.getExtent();\n let worldsAway = 0;\n if (\n projection.canWrapX() &&\n (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])\n ) {\n sourceExtentWidth = sourceExtentWidth || getWidth(projectionExtent);\n worldsAway = Math.floor(\n (coordinate[0] - projectionExtent[0]) / sourceExtentWidth,\n );\n }\n return worldsAway;\n}\n","/**\n * @module ol/proj/Units\n */\n\n/**\n * @typedef {'radians' | 'degrees' | 'ft' | 'm' | 'pixels' | 'tile-pixels' | 'us-ft'} Units\n * Projection units.\n */\n\n/**\n * See http://duff.ess.washington.edu/data/raster/drg/docs/geotiff.txt\n * @type {Object<number, Units>}\n */\nconst unitByCode = {\n '9001': 'm',\n '9002': 'ft',\n '9003': 'us-ft',\n '9101': 'radians',\n '9102': 'degrees',\n};\n\n/**\n * @param {number} code Unit code.\n * @return {Units} Units.\n */\nexport function fromCode(code) {\n return unitByCode[code];\n}\n\n/**\n * @typedef {Object} MetersPerUnitLookup\n * @property {number} radians Radians\n * @property {number} degrees Degrees\n * @property {number} ft Feet\n * @property {number} m Meters\n * @property {number} us-ft US feet\n */\n\n/**\n * Meters per unit lookup table.\n * @const\n * @type {MetersPerUnitLookup}\n * @api\n */\nexport const METERS_PER_UNIT = {\n // use the radius of the Normal sphere\n 'radians': 6370997 / (2 * Math.PI),\n 'degrees': (2 * Math.PI * 6370997) / 360,\n 'ft': 0.3048,\n 'm': 1,\n 'us-ft': 1200 / 3937,\n};\n","/**\n * @module ol/proj/Projection\n */\nimport {METERS_PER_UNIT} from './Units.js';\n\n/**\n * The function is called with a `number` view resolution and a\n * {@link module:ol/coordinate~Coordinate} as arguments, and returns the `number` resolution\n * in projection units at the passed coordinate.\n * @typedef {function(number, import(\"../coordinate.js\").Coordinate):number} GetPointResolution\n * @api\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} code The SRS identifier code, e.g. `EPSG:4326`.\n * @property {import(\"./Units.js\").Units} [units] Units. Required unless a\n * proj4 projection is defined for `code`.\n * @property {import(\"../extent.js\").Extent} [extent] The validity extent for the SRS.\n * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.\n * @property {boolean} [global=false] Whether the projection is valid for the whole globe.\n * @property {number} [metersPerUnit] The meters per unit for the SRS.\n * If not provided, the `units` are used to get the meters per unit from the {@link METERS_PER_UNIT}\n * lookup table.\n * @property {import(\"../extent.js\").Extent} [worldExtent] The world extent for the SRS.\n * @property {GetPointResolution} [getPointResolution]\n * Function to determine resolution at a point. The function is called with a\n * `number` view resolution and a {@link module:ol/coordinate~Coordinate} as arguments, and returns\n * the `number` resolution in projection units at the passed coordinate. If this is `undefined`,\n * the default {@link module:ol/proj.getPointResolution} function will be used.\n */\n\n/**\n * @classdesc\n * In most cases, you should not need to create instances of this class.\n * Instead, where projection information is required, you can use a string\n * projection code or identifier (e.g. `EPSG:4326`) instead of a projection\n * instance.\n *\n * The library includes support for transforming coordinates between the following\n * projections:\n *\n * WGS 84 / Geographic - Using codes `EPSG:4326`, `CRS:84`, `urn:ogc:def:crs:EPSG:6.6:4326`,\n * `urn:ogc:def:crs:OGC:1.3:CRS84`, `urn:ogc:def:crs:OGC:2:84`, `http://www.opengis.net/gml/srs/epsg.xml#4326`,\n * or `urn:x-ogc:def:crs:EPSG:4326`\n * WGS 84 / Spherical Mercator - Using codes `EPSG:3857`, `EPSG:102100`, `EPSG:102113`, `EPSG:900913`,\n * `urn:ogc:def:crs:EPSG:6.18:3:3857`, or `http://www.opengis.net/gml/srs/epsg.xml#3857`\n * WGS 84 / UTM zones - Using codes `EPSG:32601` through `EPSG:32660` for northern zones\n * and `EPSG:32701` through `EPSG:32760` for southern zones. Note that the built-in UTM transforms\n * are lower accuracy (with errors on the order of 0.1 m) than those that you might get in a\n * library like [proj4js](https://github.com/proj4js/proj4js).\n *\n * For additional projection support, or to use higher accuracy transforms than the built-in ones, you can use\n * the [proj4js](https://github.com/proj4js/proj4js) library. With `proj4js`, after adding any new projection\n * definitions, call the {@link module:ol/proj/proj4.register} function.\n *\n * You can use the {@link module:ol/proj.get} function to retrieve a projection instance\n * for one of the registered projections.\n *\n * @api\n */\nclass Projection {\n /**\n * @param {Options} options Projection options.\n */\n constructor(options) {\n /**\n * @private\n * @type {string}\n */\n this.code_ = options.code;\n\n /**\n * Units of projected coordinates. When set to `TILE_PIXELS`, a\n * `this.extent_` and `this.worldExtent_` must be configured properly for each\n * tile.\n * @private\n * @type {import(\"./Units.js\").Units}\n */\n this.units_ = /** @type {import(\"./Units.js\").Units} */ (options.units);\n\n /**\n * Validity extent of the projection in projected coordinates. For projections\n * with `TILE_PIXELS` units, this is the extent of the tile in\n * tile pixel space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = options.extent !== undefined ? options.extent : null;\n\n /**\n * Extent of the world in EPSG:4326. For projections with\n * `TILE_PIXELS` units, this is the extent of the tile in\n * projected coordinate space.\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.worldExtent_ =\n options.worldExtent !== undefined ? options.worldExtent : null;\n\n /**\n * @private\n * @type {string}\n */\n this.axisOrientation_ =\n options.axisOrientation !== undefined ? options.axisOrientation : 'enu';\n\n /**\n * @private\n * @type {boolean}\n */\n this.global_ = options.global !== undefined ? options.global : false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.canWrapX_ = !!(this.global_ && this.extent_);\n\n /**\n * @private\n * @type {GetPointResolution|undefined}\n */\n this.getPointResolutionFunc_ = options.getPointResolution;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.defaultTileGrid_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.metersPerUnit_ = options.metersPerUnit;\n }\n\n /**\n * @return {boolean} The projection is suitable for wrapping the x-axis\n */\n canWrapX() {\n return this.canWrapX_;\n }\n\n /**\n * Get the code for this projection, e.g. 'EPSG:4326'.\n * @return {string} Code.\n * @api\n */\n getCode() {\n return this.code_;\n }\n\n /**\n * Get the validity extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent() {\n return this.extent_;\n }\n\n /**\n * Get the units of this projection.\n * @return {import(\"./Units.js\").Units} Units.\n * @api\n */\n getUnits() {\n return this.units_;\n }\n\n /**\n * Get the amount of meters per unit of this projection. If the projection is\n * not configured with `metersPerUnit` or a units identifier, the return is\n * `undefined`.\n * @return {number|undefined} Meters.\n * @api\n */\n getMetersPerUnit() {\n return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];\n }\n\n /**\n * Get the world extent for this projection.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getWorldExtent() {\n return this.worldExtent_;\n }\n\n /**\n * Get the axis orientation of this projection.\n * Example values are:\n * enu - the default easting, northing, elevation.\n * neu - northing, easting, up - useful for \"lat/long\" geographic coordinates,\n * or south orientated transverse mercator.\n * wnu - westing, northing, up - some planetary coordinate systems have\n * \"west positive\" coordinate systems\n * @return {string} Axis orientation.\n * @api\n */\n getAxisOrientation() {\n return this.axisOrientation_;\n }\n\n /**\n * Is this projection a global projection which spans the whole world?\n * @return {boolean} Whether the projection is global.\n * @api\n */\n isGlobal() {\n return this.global_;\n }\n\n /**\n * Set if the projection is a global projection which spans the whole world\n * @param {boolean} global Whether the projection is global.\n * @api\n */\n setGlobal(global) {\n this.global_ = global;\n this.canWrapX_ = !!(global && this.extent_);\n }\n\n /**\n * @return {import(\"../tilegrid/TileGrid.js\").default} The default tile grid.\n */\n getDefaultTileGrid() {\n return this.defaultTileGrid_;\n }\n\n /**\n * @param {import(\"../tilegrid/TileGrid.js\").default} tileGrid The default tile grid.\n */\n setDefaultTileGrid(tileGrid) {\n this.defaultTileGrid_ = tileGrid;\n }\n\n /**\n * Set the validity extent for this projection.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n setExtent(extent) {\n this.extent_ = extent;\n this.canWrapX_ = !!(this.global_ && extent);\n }\n\n /**\n * Set the world extent for this projection.\n * @param {import(\"../extent.js\").Extent} worldExtent World extent\n * [minlon, minlat, maxlon, maxlat].\n * @api\n */\n setWorldExtent(worldExtent) {\n this.worldExtent_ = worldExtent;\n }\n\n /**\n * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution}\n * for this projection.\n * @param {function(number, import(\"../coordinate.js\").Coordinate):number} func Function\n * @api\n */\n setGetPointResolution(func) {\n this.getPointResolutionFunc_ = func;\n }\n\n /**\n * Get the custom point resolution function for this projection (if set).\n * @return {GetPointResolution|undefined} The custom point\n * resolution function (if set).\n */\n getPointResolutionFunc() {\n return this.getPointResolutionFunc_;\n }\n}\n\nexport default Projection;\n","/**\n * @module ol/proj/epsg3857\n */\nimport Projection from './Projection.js';\n\n/**\n * Radius of WGS84 sphere\n *\n * @const\n * @type {number}\n */\nexport const RADIUS = 6378137;\n\n/**\n * @const\n * @type {number}\n */\nexport const HALF_SIZE = Math.PI * RADIUS;\n\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE];\n\n/**\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const WORLD_EXTENT = [-180, -85, 180, 85];\n\n/**\n * Maximum safe value in y direction\n * @const\n * @type {number}\n */\nexport const MAX_SAFE_Y = RADIUS * Math.log(Math.tan(Math.PI / 2));\n\n/**\n * @classdesc\n * Projection object for web/spherical Mercator (EPSG:3857).\n */\nclass EPSG3857Projection extends Projection {\n /**\n * @param {string} code Code.\n */\n constructor(code) {\n super({\n code: code,\n units: 'm',\n extent: EXTENT,\n global: true,\n worldExtent: WORLD_EXTENT,\n getPointResolution: function (resolution, point) {\n return resolution / Math.cosh(point[1] / RADIUS);\n },\n });\n }\n}\n\n/**\n * Projections equal to EPSG:3857.\n *\n * @const\n * @type {Array<import(\"./Projection.js\").default>}\n */\nexport const PROJECTIONS = [\n new EPSG3857Projection('EPSG:3857'),\n new EPSG3857Projection('EPSG:102100'),\n new EPSG3857Projection('EPSG:102113'),\n new EPSG3857Projection('EPSG:900913'),\n new EPSG3857Projection('http://www.opengis.net/def/crs/EPSG/0/3857'),\n new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'),\n];\n\n/**\n * Transformation from EPSG:4326 to EPSG:3857.\n *\n * @param {Array<number>} input Input array of coordinate values.\n * @param {Array<number>} [output] Output array of coordinate values.\n * @param {number} [dimension] Dimension (default is `2`).\n * @param {number} [stride] Stride (default is `dimension`).\n * @return {Array<number>} Output array of coordinate values.\n */\nexport function fromEPSG4326(input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension > 1 ? dimension : 2;\n stride = stride ?? dimension;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n for (let i = 0; i < length; i += stride) {\n output[i] = (HALF_SIZE * input[i]) / 180;\n let y = RADIUS * Math.log(Math.tan((Math.PI * (+input[i + 1] + 90)) / 360));\n if (y > MAX_SAFE_Y) {\n y = MAX_SAFE_Y;\n } else if (y < -MAX_SAFE_Y) {\n y = -MAX_SAFE_Y;\n }\n output[i + 1] = y;\n }\n return output;\n}\n\n/**\n * Transformation from EPSG:3857 to EPSG:4326.\n *\n * @param {Array<number>} input Input array of coordinate values.\n * @param {Array<number>} [output] Output array of coordinate values.\n * @param {number} [dimension] Dimension (default is `2`).\n * @param {number} [stride] Stride (default is `dimension`).\n * @return {Array<number>} Output array of coordinate values.\n */\nexport function toEPSG4326(input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension > 1 ? dimension : 2;\n stride = stride ?? dimension;\n if (output === undefined) {\n if (dimension > 2) {\n // preserve values beyond second dimension\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n for (let i = 0; i < length; i += stride) {\n output[i] = (180 * input[i]) / HALF_SIZE;\n output[i + 1] =\n (360 * Math.atan(Math.exp(input[i + 1] / RADIUS))) / Math.PI - 90;\n }\n return output;\n}\n","/**\n * @module ol/proj/epsg4326\n */\nimport Projection from './Projection.js';\n\n/**\n * Semi-major radius of the WGS84 ellipsoid.\n *\n * @const\n * @type {number}\n */\nexport const RADIUS = 6378137;\n\n/**\n * Extent of the EPSG:4326 projection which is the whole world.\n *\n * @const\n * @type {import(\"../extent.js\").Extent}\n */\nexport const EXTENT = [-180, -90, 180, 90];\n\n/**\n * @const\n * @type {number}\n */\nexport const METERS_PER_UNIT = (Math.PI * RADIUS) / 180;\n\n/**\n * @classdesc\n * Projection object for WGS84 geographic coordinates (EPSG:4326).\n *\n * Note that OpenLayers does not strictly comply with the EPSG definition.\n * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).\n * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.\n */\nclass EPSG4326Projection extends Projection {\n /**\n * @param {string} code Code.\n * @param {string} [axisOrientation] Axis orientation.\n */\n constructor(code, axisOrientation) {\n super({\n code: code,\n units: 'degrees',\n extent: EXTENT,\n axisOrientation: axisOrientation,\n global: true,\n metersPerUnit: METERS_PER_UNIT,\n worldExtent: EXTENT,\n });\n }\n}\n\n/**\n * Projections equal to EPSG:4326.\n *\n * @const\n * @type {Array<import(\"./Projection.js\").default>}\n */\nexport const PROJECTIONS = [\n new EPSG4326Projection('CRS:84'),\n new EPSG4326Projection('EPSG:4326', 'neu'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),\n new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),\n new EPSG4326Projection('http://www.opengis.net/def/crs/OGC/1.3/CRS84'),\n new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),\n new EPSG4326Projection('http://www.opengis.net/def/crs/EPSG/0/4326', 'neu'),\n];\n","/**\n * @module ol/proj/projections\n */\n\n/**\n * @type {Object<string, import(\"./Projection.js\").default>}\n */\nlet cache = {};\n\n/**\n * Clear the projections cache.\n */\nexport function clear() {\n cache = {};\n}\n\n/**\n * Get a cached projection by code.\n * @param {string} code The code for the projection.\n * @return {import(\"./Projection.js\").default|null} The projection (if cached).\n */\nexport function get(code) {\n return (\n cache[code] ||\n cache[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\\w+)$/, 'EPSG:$3')] ||\n null\n );\n}\n\n/**\n * Add a projection to the cache.\n * @param {string} code The projection code.\n * @param {import(\"./Projection.js\").default} projection The projection to cache.\n */\nexport function add(code, projection) {\n cache[code] = projection;\n}\n","/**\n * @module ol/proj/transforms\n */\nimport {isEmpty} from '../obj.js';\n\n/**\n * @private\n * @type {!Object<string, Object<string, import(\"../proj.js\").TransformFunction>>}\n */\nlet transforms = {};\n\n/**\n * Clear the transform cache.\n */\nexport function clear() {\n transforms = {};\n}\n\n/**\n * Registers a conversion function to convert coordinates from the source\n * projection to the destination projection.\n *\n * @param {import(\"./Projection.js\").default} source Source.\n * @param {import(\"./Projection.js\").default} destination Destination.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform.\n */\nexport function add(source, destination, transformFn) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n if (!(sourceCode in transforms)) {\n transforms[sourceCode] = {};\n }\n transforms[sourceCode][destinationCode] = transformFn;\n}\n\n/**\n * Unregisters the conversion function to convert coordinates from the source\n * projection to the destination projection. This method is used to clean up\n * cached transforms during testing.\n *\n * @param {import(\"./Projection.js\").default} source Source projection.\n * @param {import(\"./Projection.js\").default} destination Destination projection.\n * @return {import(\"../proj.js\").TransformFunction} transformFn The unregistered transform.\n */\nexport function remove(source, destination) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n const transform = transforms[sourceCode][destinationCode];\n delete transforms[sourceCode][destinationCode];\n if (isEmpty(transforms[sourceCode])) {\n delete transforms[sourceCode];\n }\n return transform;\n}\n\n/**\n * Get a transform given a source code and a destination code.\n * @param {string} sourceCode The code for the source projection.\n * @param {string} destinationCode The code for the destination projection.\n * @return {import(\"../proj.js\").TransformFunction|null} The transform function (if found).\n */\nexport function get(sourceCode, destinationCode) {\n if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {\n return transforms[sourceCode][destinationCode];\n }\n return null;\n}\n","/**\n * @module ol/proj/utm\n */\n\n/**\n * Adapted from https://github.com/Turbo87/utm\n * Copyright (c) 2012-2017 Tobias Bieniek\n *\n * The functions here provide approximate transforms to and from UTM.\n * They are not appropriate for use beyond the validity extend of a UTM\n * zone, and the accuracy of the transform decreases toward the zone\n * edges.\n */\n\nimport {toDegrees, toRadians, wrap} from '../math.js';\nimport Projection from './Projection.js';\n\n/**\n * @typedef {Object} UTMZone\n * @property {number} number The zone number (1 - 60).\n * @property {boolean} north The northern hemisphere.\n */\n\nconst K0 = 0.9996;\n\nconst E = 0.00669438;\nconst E2 = E * E;\nconst E3 = E2 * E;\nconst E_P2 = E / (1 - E);\n\nconst SQRT_E = Math.sqrt(1 - E);\nconst _E = (1 - SQRT_E) / (1 + SQRT_E);\nconst _E2 = _E * _E;\nconst _E3 = _E2 * _E;\nconst _E4 = _E3 * _E;\nconst _E5 = _E4 * _E;\n\nconst M1 = 1 - E / 4 - (3 * E2) / 64 - (5 * E3) / 256;\nconst M2 = (3 * E) / 8 + (3 * E2) / 32 + (45 * E3) / 1024;\nconst M3 = (15 * E2) / 256 + (45 * E3) / 1024;\nconst M4 = (35 * E3) / 3072;\n\nconst P2 = (3 / 2) * _E - (27 / 32) * _E3 + (269 / 512) * _E5;\nconst P3 = (21 / 16) * _E2 - (55 / 32) * _E4;\nconst P4 = (151 / 96) * _E3 - (417 / 128) * _E5;\nconst P5 = (1097 / 512) * _E4;\n\nconst R = 6378137;\n\n/**\n * @param {number} easting Easting value of coordinate.\n * @param {number} northing Northing value of coordinate.\n * @param {UTMZone} zone The UTM zone.\n * @return {import(\"../coordinate.js\").Coordinate} The transformed coordinate.\n */\nfunction toLonLat(easting, northing, zone) {\n const x = easting - 500000;\n const y = zone.north ? northing : northing - 10000000;\n\n const m = y / K0;\n const mu = m / (R * M1);\n\n const pRad =\n mu +\n P2 * Math.sin(2 * mu) +\n P3 * Math.sin(4 * mu) +\n P4 * Math.sin(6 * mu) +\n P5 * Math.sin(8 * mu);\n\n const pSin = Math.sin(pRad);\n const pSin2 = pSin * pSin;\n\n const pCos = Math.cos(pRad);\n\n const pTan = pSin / pCos;\n const pTan2 = pTan * pTan;\n const pTan4 = pTan2 * pTan2;\n\n const epSin = 1 - E * pSin2;\n const epSinSqrt = Math.sqrt(1 - E * pSin2);\n\n const n = R / epSinSqrt;\n const r = (1 - E) / epSin;\n\n const c = E_P2 * pCos ** 2;\n const c2 = c * c;\n\n const d = x / (n * K0);\n const d2 = d * d;\n const d3 = d2 * d;\n const d4 = d3 * d;\n const d5 = d4 * d;\n const d6 = d5 * d;\n\n const latitude =\n pRad -\n (pTan / r) *\n (d2 / 2 - (d4 / 24) * (5 + 3 * pTan2 + 10 * c - 4 * c2 - 9 * E_P2)) +\n (d6 / 720) * (61 + 90 * pTan2 + 298 * c + 45 * pTan4 - 252 * E_P2 - 3 * c2);\n\n let longitude =\n (d -\n (d3 / 6) * (1 + 2 * pTan2 + c) +\n (d5 / 120) * (5 - 2 * c + 28 * pTan2 - 3 * c2 + 8 * E_P2 + 24 * pTan4)) /\n pCos;\n\n longitude = wrap(\n longitude + toRadians(zoneToCentralLongitude(zone.number)),\n -Math.PI,\n Math.PI,\n );\n\n return [toDegrees(longitude), toDegrees(latitude)];\n}\n\nconst MIN_LATITUDE = -80;\nconst MAX_LATITUDE = 84;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n\n/**\n * @param {number} longitude The longitude.\n * @param {number} latitude The latitude.\n * @param {UTMZone} zone The UTM zone.\n * @return {import('../coordinate.js').Coordinate} The UTM coordinate.\n */\nfunction fromLonLat(longitude, latitude, zone) {\n longitude = wrap(longitude, MIN_LONGITUDE, MAX_LONGITUDE);\n\n if (latitude < MIN_LATITUDE) {\n latitude = MIN_LATITUDE;\n } else if (latitude > MAX_LATITUDE) {\n latitude = MAX_LATITUDE;\n }\n\n const latRad = toRadians(latitude);\n const latSin = Math.sin(latRad);\n const latCos = Math.cos(latRad);\n\n const latTan = latSin / latCos;\n const latTan2 = latTan * latTan;\n const latTan4 = latTan2 * latTan2;\n\n const lonRad = toRadians(longitude);\n const centralLon = zoneToCentralLongitude(zone.number);\n const centralLonRad = toRadians(centralLon);\n\n const n = R / Math.sqrt(1 - E * latSin ** 2);\n const c = E_P2 * latCos ** 2;\n\n const a = latCos * wrap(lonRad - centralLonRad, -Math.PI, Math.PI);\n const a2 = a * a;\n const a3 = a2 * a;\n const a4 = a3 * a;\n const a5 = a4 * a;\n const a6 = a5 * a;\n\n const m =\n R *\n (M1 * latRad -\n M2 * Math.sin(2 * latRad) +\n M3 * Math.sin(4 * latRad) -\n M4 * Math.sin(6 * latRad));\n\n const easting =\n K0 *\n n *\n (a +\n (a3 / 6) * (1 - latTan2 + c) +\n (a5 / 120) * (5 - 18 * latTan2 + latTan4 + 72 * c - 58 * E_P2)) +\n 500000;\n\n let northing =\n K0 *\n (m +\n n *\n latTan *\n (a2 / 2 +\n (a4 / 24) * (5 - latTan2 + 9 * c + 4 * c ** 2) +\n (a6 / 720) * (61 - 58 * latTan2 + latTan4 + 600 * c - 330 * E_P2)));\n\n if (!zone.north) {\n northing += 10000000;\n }\n\n return [easting, northing];\n}\n\n/**\n * @param {number} zone The zone number.\n * @return {number} The central longitude in degrees.\n */\nfunction zoneToCentralLongitude(zone) {\n return (zone - 1) * 6 - 180 + 3;\n}\n\n/**\n * @type {Array<RegExp>}\n */\nconst epsgRegExes = [\n /^EPSG:(\\d+)$/,\n /^urn:ogc:def:crs:EPSG::(\\d+)$/,\n /^http:\\/\\/www\\.opengis\\.net\\/def\\/crs\\/EPSG\\/0\\/(\\d+)$/,\n];\n\n/**\n * @param {string} code The projection code.\n * @return {UTMZone|null} The UTM zone info (or null if not UTM).\n */\nexport function zoneFromCode(code) {\n let epsgId = 0;\n for (const re of epsgRegExes) {\n const match = code.match(re);\n if (match) {\n epsgId = parseInt(match[1]);\n break;\n }\n }\n if (!epsgId) {\n return null;\n }\n\n let number = 0;\n let north = false;\n if (epsgId > 32700 && epsgId < 32761) {\n number = epsgId - 32700;\n } else if (epsgId > 32600 && epsgId < 32661) {\n north = true;\n number = epsgId - 32600;\n }\n if (!number) {\n return null;\n }\n\n return {number, north};\n}\n\n/**\n * @param {function(number, number, UTMZone): import('../coordinate.js').Coordinate} transformer The transformer.\n * @param {UTMZone} zone The UTM zone.\n * @return {import('../proj.js').TransformFunction} The transform function.\n */\nfunction makeTransformFunction(transformer, zone) {\n return function (input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension > 1 ? dimension : 2;\n stride = stride ?? dimension;\n if (!output) {\n if (dimension > 2) {\n output = input.slice();\n } else {\n output = new Array(length);\n }\n }\n for (let i = 0; i < length; i += stride) {\n const x = input[i];\n const y = input[i + 1];\n const coord = transformer(x, y, zone);\n output[i] = coord[0];\n output[i + 1] = coord[1];\n }\n return output;\n };\n}\n\n/**\n * @param {string} code The projection code.\n * @return {import('./Projection.js').default|null} A projection or null if unable to create one.\n */\nexport function makeProjection(code) {\n const zone = zoneFromCode(code);\n if (!zone) {\n return null;\n }\n return new Projection({code, units: 'm'});\n}\n\n/**\n * @param {import('./Projection.js').default} projection The projection.\n * @return {import('../proj.js').Transforms|null} The transforms lookup or null if unable to handle projection.\n */\nexport function makeTransforms(projection) {\n const zone = zoneFromCode(projection.getCode());\n if (!zone) {\n return null;\n }\n\n return {\n forward: makeTransformFunction(fromLonLat, zone),\n inverse: makeTransformFunction(toLonLat, zone),\n };\n}\n","/**\n * @module ol/proj\n */\n\n/**\n * The ol/proj module stores:\n * a list of {@link module:ol/proj/Projection~Projection}\n * objects, one for each projection supported by the application\n * a list of transform functions needed to convert coordinates in one projection\n * into another.\n *\n * The static functions are the methods used to maintain these.\n * Each transform function can handle not only simple coordinate pairs, but also\n * large arrays of coordinates such as vector geometries.\n *\n * When loaded, the library adds projection objects for EPSG:4326 (WGS84\n * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used\n * for example by Bing Maps or OpenStreetMap), together with the relevant\n * transform functions.\n *\n * Additional transforms may be added by using the http://proj4js.org/\n * library (version 2.2 or later). You can use the full build supplied by\n * Proj4js, or create a custom build to support those projections you need; see\n * the Proj4js website for how to do this. You also need the Proj4js definitions\n * for the required projections. These definitions can be obtained from\n * https://epsg.io/, and are a JS function, so can be loaded in a script\n * tag (as in the examples) or pasted into your application.\n *\n * After all required projection definitions are added to proj4's registry (by\n * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`\n * package. Existing transforms are not changed by this function. See\n * examples/wms-image-custom-proj for an example of this.\n *\n * Additional projection definitions can be registered with `proj4.defs()` any\n * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't\n * know in advance what projections are needed, you can initially load minimal\n * support and then load whichever are requested.\n *\n * Note that Proj4js does not support projection extents. If you want to add\n * one for creating default tile grids, you can add it after the Projection\n * object has been created with `setExtent`, for example,\n * `get('EPSG:1234').setExtent(extent)`.\n *\n * In addition to Proj4js support, any transform functions can be added with\n * {@link module:ol/proj.addCoordinateTransforms}. To use this, you must first create\n * a {@link module:ol/proj/Projection~Projection} object for the new projection and add it with\n * {@link module:ol/proj.addProjection}. You can then add the forward and inverse\n * functions with {@link module:ol/proj.addCoordinateTransforms}. See\n * examples/wms-custom-proj for an example of this.\n *\n * Note that if no transforms are needed and you only need to define the\n * projection, just add a {@link module:ol/proj/Projection~Projection} with\n * {@link module:ol/proj.addProjection}. See examples/wms-no-proj for an example of\n * this.\n */\nimport {warn} from './console.js';\nimport {equals, getWorldsAway} from './coordinate.js';\nimport {applyTransform, getWidth} from './extent.js';\nimport {clamp, modulo} from './math.js';\nimport Projection from './proj/Projection.js';\nimport {METERS_PER_UNIT} from './proj/Units.js';\nimport {\n PROJECTIONS as EPSG3857_PROJECTIONS,\n fromEPSG4326,\n toEPSG4326,\n} from './proj/epsg3857.js';\nimport {PROJECTIONS as EPSG4326_PROJECTIONS} from './proj/epsg4326.js';\nimport {\n add as addProj,\n clear as clearProj,\n get as getProj,\n} from './proj/projections.js';\nimport {\n add as addTransformFunc,\n clear as clearTransformFuncs,\n get as getTransformFunc,\n} from './proj/transforms.js';\nimport {\n makeProjection as makeUTMProjection,\n makeTransforms as makeUTMTransforms,\n} from './proj/utm.js';\nimport {getDistance} from './sphere.js';\n\n/**\n * A projection as {@link module:ol/proj/Projection~Projection}, SRS identifier\n * string or undefined.\n * @typedef {Projection|string|undefined} ProjectionLike\n * @api\n */\n\n/**\n * @typedef {Object} Transforms\n * @property {TransformFunction} forward The forward transform (from geographic).\n * @property {TransformFunction} inverse The inverse transform (to geographic).\n */\n\n/**\n * @type {Array<function(Projection): Transforms|null>}\n */\nconst transformFactories = [makeUTMTransforms];\n\n/**\n * @type {Array<function(string): Projection|null>}\n */\nconst projectionFactories = [makeUTMProjection];\n\n/**\n * A transform function accepts an array of input coordinate values, an optional\n * output array, and an optional dimension (default should be 2). The function\n * transforms the input coordinate values, populates the output array, and\n * returns the output array.\n *\n * @callback TransformFunction\n * @param {Array<number>} input\n * @param {Array<number>} [output]\n * @param {number} [dimension]\n * @param {number} [stride]\n * @return {Array<number>}\n *\n * @api\n */\n\nexport {METERS_PER_UNIT};\n\nexport {Projection};\n\nlet showCoordinateWarning = true;\n\n/**\n * @param {boolean} [disable] Disable console info about `useGeographic()`\n */\nexport function disableCoordinateWarning(disable) {\n const hide = disable === undefined ? true : disable;\n showCoordinateWarning = !hide;\n}\n\n/**\n * @param {Array<number>} input Input coordinate array.\n * @param {Array<number>} [output] Output array of coordinate values.\n * @return {Array<number>} Output coordinate array (new array, same coordinate\n * values).\n */\nexport function cloneTransform(input, output) {\n if (output !== undefined) {\n for (let i = 0, ii = input.length; i < ii; ++i) {\n output[i] = input[i];\n }\n output = output;\n } else {\n output = input.slice();\n }\n return output;\n}\n\n/**\n * @param {Array<number>} input Input coordinate array.\n * @param {Array<number>} [output] Output array of coordinate values.\n * @return {Array<number>} Input coordinate array (same array as input).\n */\nexport function identityTransform(input, output) {\n if (output !== undefined && input !== output) {\n for (let i = 0, ii = input.length; i < ii; ++i) {\n output[i] = input[i];\n }\n input = output;\n }\n return input;\n}\n\n/**\n * Add a Projection object to the list of supported projections that can be\n * looked up by their code.\n *\n * @param {Projection} projection Projection instance.\n * @api\n */\nexport function addProjection(projection) {\n addProj(projection.getCode(), projection);\n addTransformFunc(projection, projection, cloneTransform);\n}\n\n/**\n * @param {Array<Projection>} projections Projections.\n */\nexport function addProjections(projections) {\n projections.forEach(addProjection);\n}\n\n/**\n * Fetches a Projection object for the code specified.\n *\n * @param {ProjectionLike} projectionLike Either a code string which is\n * a combination of authority and identifier such as \"EPSG:4326\", or an\n * existing projection object, or undefined.\n * @return {Projection|null} Projection object, or null if not in list.\n * @api\n */\nexport function get(projectionLike) {\n if (!(typeof projectionLike === 'string')) {\n return projectionLike;\n }\n const projection = getProj(projectionLike);\n if (projection) {\n return projection;\n }\n for (const makeProjection of projectionFactories) {\n const projection = makeProjection(projectionLike);\n if (projection) {\n return projection;\n }\n }\n return null;\n}\n\n/**\n * Get the resolution of the point in degrees or distance units.\n * For projections with degrees as the unit this will simply return the\n * provided resolution. For other projections the point resolution is\n * by default estimated by transforming the `point` pixel to EPSG:4326,\n * measuring its width and height on the normal sphere,\n * and taking the average of the width and height.\n * A custom function can be provided for a specific projection, either\n * by setting the `getPointResolution` option in the\n * {@link module:ol/proj/Projection~Projection} constructor or by using\n * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing\n * projection object.\n * @param {ProjectionLike} projection The projection.\n * @param {number} resolution Nominal resolution in projection units.\n * @param {import(\"./coordinate.js\").Coordinate} point Point to find adjusted resolution at.\n * @param {import(\"./proj/Units.js\").Units} [units] Units to get the point resolution in.\n * Default is the projection's units.\n * @return {number} Point resolution.\n * @api\n */\nexport function getPointResolution(projection, resolution, point, units) {\n projection = get(projection);\n let pointResolution;\n const getter = projection.getPointResolutionFunc();\n if (getter) {\n pointResolution = getter(resolution, point);\n if (units && units !== projection.getUnits()) {\n const metersPerUnit = projection.getMetersPerUnit();\n if (metersPerUnit) {\n pointResolution =\n (pointResolution * metersPerUnit) / METERS_PER_UNIT[units];\n }\n }\n } else {\n const projUnits = projection.getUnits();\n if ((projUnits == 'degrees' && !units) || units == 'degrees') {\n pointResolution = resolution;\n } else {\n // Estimate point resolution by transforming the center pixel to EPSG:4326,\n // measuring its width and height on the normal sphere, and taking the\n // average of the width and height.\n const toEPSG4326 = getTransformFromProjections(\n projection,\n get('EPSG:4326'),\n );\n if (!toEPSG4326 && projUnits !== 'degrees') {\n // no transform is available\n pointResolution = resolution * projection.getMetersPerUnit();\n } else {\n let vertices = [\n point[0] - resolution / 2,\n point[1],\n point[0] + resolution / 2,\n point[1],\n point[0],\n point[1] - resolution / 2,\n point[0],\n point[1] + resolution / 2,\n ];\n vertices = toEPSG4326(vertices, vertices, 2);\n const width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4));\n const height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));\n pointResolution = (width + height) / 2;\n }\n const metersPerUnit = units\n ? METERS_PER_UNIT[units]\n : projection.getMetersPerUnit();\n if (metersPerUnit !== undefined) {\n pointResolution /= metersPerUnit;\n }\n }\n }\n return pointResolution;\n}\n\n/**\n * Registers transformation functions that don't alter coordinates. Those allow\n * to transform between projections with equal meaning.\n *\n * @param {Array<Projection>} projections Projections.\n * @api\n */\nexport function addEquivalentProjections(projections) {\n addProjections(projections);\n projections.forEach(function (source) {\n projections.forEach(function (destination) {\n if (source !== destination) {\n addTransformFunc(source, destination, cloneTransform);\n }\n });\n });\n}\n\n/**\n * Registers transformation functions to convert coordinates in any projection\n * in projection1 to any projection in projection2.\n *\n * @param {Array<Projection>} projections1 Projections with equal\n * meaning.\n * @param {Array<Projection>} projections2 Projections with equal\n * meaning.\n * @param {TransformFunction} forwardTransform Transformation from any\n * projection in projection1 to any projection in projection2.\n * @param {TransformFunction} inverseTransform Transform from any projection\n * in projection2 to any projection in projection1..\n */\nexport function addEquivalentTransforms(\n projections1,\n projections2,\n forwardTransform,\n inverseTransform,\n) {\n projections1.forEach(function (projection1) {\n projections2.forEach(function (projection2) {\n addTransformFunc(projection1, projection2, forwardTransform);\n addTransformFunc(projection2, projection1, inverseTransform);\n });\n });\n}\n\n/**\n * Clear all cached projections and transforms.\n */\nexport function clearAllProjections() {\n clearProj();\n clearTransformFuncs();\n}\n\n/**\n * @param {Projection|string|undefined} projection Projection.\n * @param {string} defaultCode Default code.\n * @return {Projection} Projection.\n */\nexport function createProjection(projection, defaultCode) {\n if (!projection) {\n return get(defaultCode);\n }\n if (typeof projection === 'string') {\n return get(projection);\n }\n return /** @type {Projection} */ (projection);\n}\n\n/**\n * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform\n * function.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} coordTransform Coordinate\n * transform.\n * @return {TransformFunction} Transform function.\n */\nexport function createTransformFromCoordinateTransform(coordTransform) {\n return (\n /**\n * @param {Array<number>} input Input.\n * @param {Array<number>} [output] Output.\n * @param {number} [dimension] Dimensions that should be transformed.\n * @param {number} [stride] Stride.\n * @return {Array<number>} Output.\n */\n function (input, output, dimension, stride) {\n const length = input.length;\n dimension = dimension !== undefined ? dimension : 2;\n stride = stride ?? dimension;\n output = output !== undefined ? output : new Array(length);\n for (let i = 0; i < length; i += stride) {\n const point = coordTransform(input.slice(i, i + dimension));\n const pointLength = point.length;\n for (let j = 0, jj = stride; j < jj; ++j) {\n output[i + j] = j >= pointLength ? input[i + j] : point[j];\n }\n }\n return output;\n }\n );\n}\n\n/**\n * Registers coordinate transform functions to convert coordinates between the\n * source projection and the destination projection.\n * The forward and inverse functions convert coordinate pairs; this function\n * converts these into the functions used internally which also handle\n * extents and coordinate arrays.\n *\n * @param {ProjectionLike} source Source projection.\n * @param {ProjectionLike} destination Destination projection.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} forward The forward transform\n * function (that is, from the source projection to the destination\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} inverse The inverse transform\n * function (that is, from the destination projection to the source\n * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns\n * the transformed {@link module:ol/coordinate~Coordinate}. If the transform function can only\n * transform less dimensions than the input coordinate, it is supposeed to return a coordinate\n * with only the length it can transform. The other dimensions will be taken unchanged from the\n * source.\n * @api\n */\nexport function addCoordinateTransforms(source, destination, forward, inverse) {\n const sourceProj = get(source);\n const destProj = get(destination);\n addTransformFunc(\n sourceProj,\n destProj,\n createTransformFromCoordinateTransform(forward),\n );\n addTransformFunc(\n destProj,\n sourceProj,\n createTransformFromCoordinateTransform(inverse),\n );\n}\n\n/**\n * Transforms a coordinate from longitude/latitude to a different projection.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate as longitude and latitude, i.e.\n * an array with longitude as 1st and latitude as 2nd element.\n * @param {ProjectionLike} [projection] Target projection. The\n * default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate projected to the target projection.\n * @api\n */\nexport function fromLonLat(coordinate, projection) {\n disableCoordinateWarning();\n return transform(\n coordinate,\n 'EPSG:4326',\n projection !== undefined ? projection : 'EPSG:3857',\n );\n}\n\n/**\n * Transforms a coordinate to longitude/latitude.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Projected coordinate.\n * @param {ProjectionLike} [projection] Projection of the coordinate.\n * The default is Web Mercator, i.e. 'EPSG:3857'.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate as longitude and latitude, i.e. an array\n * with longitude as 1st and latitude as 2nd element.\n * @api\n */\nexport function toLonLat(coordinate, projection) {\n const lonLat = transform(\n coordinate,\n projection !== undefined ? projection : 'EPSG:3857',\n 'EPSG:4326',\n );\n const lon = lonLat[0];\n if (lon < -180 || lon > 180) {\n lonLat[0] = modulo(lon + 180, 360) - 180;\n }\n return lonLat;\n}\n\n/**\n * Checks if two projections are the same, that is every coordinate in one\n * projection does represent the same geographic point as the same coordinate in\n * the other projection.\n *\n * @param {Projection} projection1 Projection 1.\n * @param {Projection} projection2 Projection 2.\n * @return {boolean} Equivalent.\n * @api\n */\nexport function equivalent(projection1, projection2) {\n if (projection1 === projection2) {\n return true;\n }\n const equalUnits = projection1.getUnits() === projection2.getUnits();\n if (projection1.getCode() === projection2.getCode()) {\n return equalUnits;\n }\n const transformFunc = getTransformFromProjections(projection1, projection2);\n return transformFunc === cloneTransform && equalUnits;\n}\n\n/**\n * Searches in the list of transform functions for the function for converting\n * coordinates from the source projection to the destination projection.\n *\n * @param {Projection} source Source Projection object.\n * @param {Projection} destination Destination Projection\n * object.\n * @return {TransformFunction|null} Transform function.\n */\nexport function getTransformFromProjections(source, destination) {\n const sourceCode = source.getCode();\n const destinationCode = destination.getCode();\n let transformFunc = getTransformFunc(sourceCode, destinationCode);\n if (transformFunc) {\n return transformFunc;\n }\n\n /**\n * @type {Transforms|null}\n */\n let sourceTransforms = null;\n\n /**\n * @type {Transforms|null}\n */\n let destinationTransforms = null;\n\n // lazily add projections if we have supported transforms\n for (const makeTransforms of transformFactories) {\n if (!sourceTransforms) {\n sourceTransforms = makeTransforms(source);\n }\n if (!destinationTransforms) {\n destinationTransforms = makeTransforms(destination);\n }\n }\n\n if (!sourceTransforms && !destinationTransforms) {\n return null;\n }\n\n const intermediateCode = 'EPSG:4326';\n if (!destinationTransforms) {\n const toDestination = getTransformFunc(intermediateCode, destinationCode);\n if (toDestination) {\n transformFunc = composeTransformFuncs(\n sourceTransforms.inverse,\n toDestination,\n );\n }\n } else if (!sourceTransforms) {\n const fromSource = getTransformFunc(sourceCode, intermediateCode);\n if (fromSource) {\n transformFunc = composeTransformFuncs(\n fromSource,\n destinationTransforms.forward,\n );\n }\n } else {\n transformFunc = composeTransformFuncs(\n sourceTransforms.inverse,\n destinationTransforms.forward,\n );\n }\n\n if (transformFunc) {\n addProjection(source);\n addProjection(destination);\n addTransformFunc(source, destination, transformFunc);\n }\n\n return transformFunc;\n}\n\n/**\n * @param {TransformFunction} t1 The first transform function.\n * @param {TransformFunction} t2 The second transform function.\n * @return {TransformFunction} The composed transform function.\n */\nfunction composeTransformFuncs(t1, t2) {\n return function (input, output, dimensions, stride) {\n output = t1(input, output, dimensions, stride);\n return t2(output, output, dimensions, stride);\n };\n}\n\n/**\n * Given the projection-like objects, searches for a transformation\n * function to convert a coordinates array from the source projection to the\n * destination projection.\n *\n * @param {ProjectionLike} source Source.\n * @param {ProjectionLike} destination Destination.\n * @return {TransformFunction} Transform function.\n * @api\n */\nexport function getTransform(source, destination) {\n const sourceProjection = get(source);\n const destinationProjection = get(destination);\n return getTransformFromProjections(sourceProjection, destinationProjection);\n}\n\n/**\n * Transforms a coordinate from source projection to destination projection.\n * This returns a new coordinate (and does not modify the original). If there\n * is no available transform between the two projection, the function will throw\n * an error.\n *\n * See {@link module:ol/proj.transformExtent} for extent transformation.\n * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its\n * subclasses for geometry transforms.\n *\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\nexport function transform(coordinate, source, destination) {\n const transformFunc = getTransform(source, destination);\n if (!transformFunc) {\n const sourceCode = get(source).getCode();\n const destinationCode = get(destination).getCode();\n throw new Error(\n `No transform available between ${sourceCode} and ${destinationCode}`,\n );\n }\n return transformFunc(coordinate, undefined, coordinate.length);\n}\n\n/**\n * Transforms an extent from source projection to destination projection. This\n * returns a new extent (and does not modify the original).\n *\n * @param {import(\"./extent.js\").Extent} extent The extent to transform.\n * @param {ProjectionLike} source Source projection-like.\n * @param {ProjectionLike} destination Destination projection-like.\n * @param {number} [stops] Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {import(\"./extent.js\").Extent} The transformed extent.\n * @api\n */\nexport function transformExtent(extent, source, destination, stops) {\n const transformFunc = getTransform(source, destination);\n return applyTransform(extent, transformFunc, undefined, stops);\n}\n\n/**\n * Transforms the given point to the destination projection.\n *\n * @param {import(\"./coordinate.js\").Coordinate} point Point.\n * @param {Projection} sourceProjection Source projection.\n * @param {Projection} destinationProjection Destination projection.\n * @return {import(\"./coordinate.js\").Coordinate} Point.\n */\nexport function transformWithProjections(\n point,\n sourceProjection,\n destinationProjection,\n) {\n const transformFunc = getTransformFromProjections(\n sourceProjection,\n destinationProjection,\n );\n return transformFunc(point);\n}\n\n/**\n * @type {Projection|null}\n */\nlet userProjection = null;\n\n/**\n * Set the projection for coordinates supplied from and returned by API methods.\n * This includes all API methods except for those interacting with tile grids,\n * plus {@link import(\"./Map.js\").FrameState} and {@link import(\"./View.js\").State}.\n * @param {ProjectionLike} projection The user projection.\n * @api\n */\nexport function setUserProjection(projection) {\n userProjection = get(projection);\n}\n\n/**\n * Clear the user projection if set.\n * @api\n */\nexport function clearUserProjection() {\n userProjection = null;\n}\n\n/**\n * Get the projection for coordinates supplied from and returned by API methods.\n * @return {Projection|null} The user projection (or null if not set).\n * @api\n */\nexport function getUserProjection() {\n return userProjection;\n}\n\n/**\n * Use geographic coordinates (WGS-84 datum) in API methods.\n * This includes all API methods except for those interacting with tile grids,\n * plus {@link import(\"./Map.js\").FrameState} and {@link import(\"./View.js\").State}.\n * @api\n */\nexport function useGeographic() {\n setUserProjection('EPSG:4326');\n}\n\n/**\n * Return a coordinate transformed into the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array<number>} coordinate Input coordinate.\n * @param {ProjectionLike} sourceProjection The input coordinate projection.\n * @return {Array<number>} The input coordinate in the user projection.\n */\nexport function toUserCoordinate(coordinate, sourceProjection) {\n if (!userProjection) {\n return coordinate;\n }\n return transform(coordinate, sourceProjection, userProjection);\n}\n\n/**\n * Return a coordinate transformed from the user projection. If no user projection\n * is set, the original coordinate is returned.\n * @param {Array<number>} coordinate Input coordinate.\n * @param {ProjectionLike} destProjection The destination projection.\n * @return {Array<number>} The input coordinate transformed.\n */\nexport function fromUserCoordinate(coordinate, destProjection) {\n if (!userProjection) {\n if (\n showCoordinateWarning &&\n !equals(coordinate, [0, 0]) &&\n coordinate[0] >= -180 &&\n coordinate[0] <= 180 &&\n coordinate[1] >= -90 &&\n coordinate[1] <= 90\n ) {\n showCoordinateWarning = false;\n warn(\n 'Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.',\n );\n }\n return coordinate;\n }\n return transform(coordinate, userProjection, destProjection);\n}\n\n/**\n * Return an extent transformed into the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} sourceProjection The input extent projection.\n * @return {import(\"./extent.js\").Extent} The input extent in the user projection.\n */\nexport function toUserExtent(extent, sourceProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, sourceProjection, userProjection);\n}\n\n/**\n * Return an extent transformed from the user projection. If no user projection\n * is set, the original extent is returned.\n * @param {import(\"./extent.js\").Extent} extent Input extent.\n * @param {ProjectionLike} destProjection The destination projection.\n * @return {import(\"./extent.js\").Extent} The input extent transformed.\n */\nexport function fromUserExtent(extent, destProjection) {\n if (!userProjection) {\n return extent;\n }\n return transformExtent(extent, userProjection, destProjection);\n}\n\n/**\n * Return the resolution in user projection units per pixel. If no user projection\n * is set, or source or user projection are missing units, the original resolution\n * is returned.\n * @param {number} resolution Resolution in input projection units per pixel.\n * @param {ProjectionLike} sourceProjection The input projection.\n * @return {number} Resolution in user projection units per pixel.\n */\nexport function toUserResolution(resolution, sourceProjection) {\n if (!userProjection) {\n return resolution;\n }\n const sourceMetersPerUnit = get(sourceProjection).getMetersPerUnit();\n const userMetersPerUnit = userProjection.getMetersPerUnit();\n return sourceMetersPerUnit && userMetersPerUnit\n ? (resolution * sourceMetersPerUnit) / userMetersPerUnit\n : resolution;\n}\n\n/**\n * Return the resolution in user projection units per pixel. If no user projection\n * is set, or source or user projection are missing units, the original resolution\n * is returned.\n * @param {number} resolution Resolution in user projection units per pixel.\n * @param {ProjectionLike} destProjection The destination projection.\n * @return {number} Resolution in destination projection units per pixel.\n */\nexport function fromUserResolution(resolution, destProjection) {\n if (!userProjection) {\n return resolution;\n }\n const destMetersPerUnit = get(destProjection).getMetersPerUnit();\n const userMetersPerUnit = userProjection.getMetersPerUnit();\n return destMetersPerUnit && userMetersPerUnit\n ? (resolution * userMetersPerUnit) / destMetersPerUnit\n : resolution;\n}\n\n/**\n * Creates a safe coordinate transform function from a coordinate transform function.\n * \"Safe\" means that it can handle wrapping of x-coordinates for global projections,\n * and that coordinates exceeding the source projection validity extent's range will be\n * clamped to the validity range.\n * @param {Projection} sourceProj Source projection.\n * @param {Projection} destProj Destination projection.\n * @param {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} transform Transform function (source to destination).\n * @return {function(import(\"./coordinate.js\").Coordinate): import(\"./coordinate.js\").Coordinate} Safe transform function (source to destination).\n */\nexport function createSafeCoordinateTransform(sourceProj, destProj, transform) {\n return function (coord) {\n let transformed, worldsAway;\n if (sourceProj.canWrapX()) {\n const sourceExtent = sourceProj.getExtent();\n const sourceExtentWidth = getWidth(sourceExtent);\n coord = coord.slice(0);\n worldsAway = getWorldsAway(coord, sourceProj, sourceExtentWidth);\n if (worldsAway) {\n // Move x to the real world\n coord[0] = coord[0] - worldsAway * sourceExtentWidth;\n }\n coord[0] = clamp(coord[0], sourceExtent[0], sourceExtent[2]);\n coord[1] = clamp(coord[1], sourceExtent[1], sourceExtent[3]);\n transformed = transform(coord);\n } else {\n transformed = transform(coord);\n }\n if (worldsAway && destProj.canWrapX()) {\n // Move transformed coordinate back to the offset world\n transformed[0] += worldsAway * getWidth(destProj.getExtent());\n }\n return transformed;\n };\n}\n\n/**\n * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called\n * by when this module is executed and should only need to be called again after\n * `clearAllProjections()` is called (e.g. in tests).\n */\nexport function addCommon() {\n // Add transformations that don't alter coordinates to convert within set of\n // projections with equal meaning.\n addEquivalentProjections(EPSG3857_PROJECTIONS);\n addEquivalentProjections(EPSG4326_PROJECTIONS);\n // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like\n // coordinates and back.\n addEquivalentTransforms(\n EPSG4326_PROJECTIONS,\n EPSG3857_PROJECTIONS,\n fromEPSG4326,\n toEPSG4326,\n );\n}\n\naddCommon();\n","/**\n * @module ol/transform\n */\nimport {assert} from './asserts.js';\n\n/**\n * An array representing an affine 2d transformation for use with\n * {@link module:ol/transform} functions. The array has 6 elements.\n * @typedef {!Array<number>} Transform\n * @api\n */\n\n/**\n * Collection of affine 2d transformation functions. The functions work on an\n * array of 6 elements. The element order is compatible with the [SVGMatrix\n * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is\n * a subset (elements a to f) of a 3×3 matrix:\n * ```\n * [ a c e ]\n * [ b d f ]\n * [ 0 0 1 ]\n * ```\n */\n\n/**\n * @private\n * @type {Transform}\n */\nconst tmp_ = new Array(6);\n\n/**\n * Create an identity transform.\n * @return {!Transform} Identity transform.\n */\nexport function create() {\n return [1, 0, 0, 1, 0, 0];\n}\n\n/**\n * Resets the given transform to an identity transform.\n * @param {!Transform} transform Transform.\n * @return {!Transform} Transform.\n */\nexport function reset(transform) {\n return set(transform, 1, 0, 0, 1, 0, 0);\n}\n\n/**\n * Multiply the underlying matrices of two transforms and return the result in\n * the first transform.\n * @param {!Transform} transform1 Transform parameters of matrix 1.\n * @param {!Transform} transform2 Transform parameters of matrix 2.\n * @return {!Transform} transform1 multiplied with transform2.\n */\nexport function multiply(transform1, transform2) {\n const a1 = transform1[0];\n const b1 = transform1[1];\n const c1 = transform1[2];\n const d1 = transform1[3];\n const e1 = transform1[4];\n const f1 = transform1[5];\n const a2 = transform2[0];\n const b2 = transform2[1];\n const c2 = transform2[2];\n const d2 = transform2[3];\n const e2 = transform2[4];\n const f2 = transform2[5];\n\n transform1[0] = a1 * a2 + c1 * b2;\n transform1[1] = b1 * a2 + d1 * b2;\n transform1[2] = a1 * c2 + c1 * d2;\n transform1[3] = b1 * c2 + d1 * d2;\n transform1[4] = a1 * e2 + c1 * f2 + e1;\n transform1[5] = b1 * e2 + d1 * f2 + f1;\n\n return transform1;\n}\n\n/**\n * Set the transform components a-f on a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} a The a component of the transform.\n * @param {number} b The b component of the transform.\n * @param {number} c The c component of the transform.\n * @param {number} d The d component of the transform.\n * @param {number} e The e component of the transform.\n * @param {number} f The f component of the transform.\n * @return {!Transform} Matrix with transform applied.\n */\nexport function set(transform, a, b, c, d, e, f) {\n transform[0] = a;\n transform[1] = b;\n transform[2] = c;\n transform[3] = d;\n transform[4] = e;\n transform[5] = f;\n return transform;\n}\n\n/**\n * Set transform on one matrix from another matrix.\n * @param {!Transform} transform1 Matrix to set transform to.\n * @param {!Transform} transform2 Matrix to set transform from.\n * @return {!Transform} transform1 with transform from transform2 applied.\n */\nexport function setFromArray(transform1, transform2) {\n transform1[0] = transform2[0];\n transform1[1] = transform2[1];\n transform1[2] = transform2[2];\n transform1[3] = transform2[3];\n transform1[4] = transform2[4];\n transform1[5] = transform2[5];\n return transform1;\n}\n\n/**\n * Transforms the given coordinate with the given transform returning the\n * resulting, transformed coordinate. The coordinate will be modified in-place.\n *\n * @param {Transform} transform The transformation.\n * @param {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} coordinate The coordinate to transform.\n * @return {import(\"./coordinate.js\").Coordinate|import(\"./pixel.js\").Pixel} return coordinate so that operations can be\n * chained together.\n */\nexport function apply(transform, coordinate) {\n const x = coordinate[0];\n const y = coordinate[1];\n coordinate[0] = transform[0] * x + transform[2] * y + transform[4];\n coordinate[1] = transform[1] * x + transform[3] * y + transform[5];\n return coordinate;\n}\n\n/**\n * Applies rotation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} angle Angle in radians.\n * @return {!Transform} The rotated transform.\n */\nexport function rotate(transform, angle) {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0));\n}\n\n/**\n * Applies scale to a given transform.\n * @param {!Transform} transform Transform.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scaled transform.\n */\nexport function scale(transform, x, y) {\n return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0));\n}\n\n/**\n * Creates a scale transform.\n * @param {!Transform} target Transform to overwrite.\n * @param {number} x Scale factor x.\n * @param {number} y Scale factor y.\n * @return {!Transform} The scale transform.\n */\nexport function makeScale(target, x, y) {\n return set(target, x, 0, 0, y, 0, 0);\n}\n\n/**\n * Applies translation to the given transform.\n * @param {!Transform} transform Transform.\n * @param {number} dx Translation x.\n * @param {number} dy Translation y.\n * @return {!Transform} The translated transform.\n */\nexport function translate(transform, dx, dy) {\n return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy));\n}\n\n/**\n * Creates a composite transform given an initial translation, scale, rotation, and\n * final translation (in that order only, not commutative).\n * @param {!Transform} transform The transform (will be modified in place).\n * @param {number} dx1 Initial translation x.\n * @param {number} dy1 Initial translation y.\n * @param {number} sx Scale factor x.\n * @param {number} sy Scale factor y.\n * @param {number} angle Rotation (in counter-clockwise radians).\n * @param {number} dx2 Final translation x.\n * @param {number} dy2 Final translation y.\n * @return {!Transform} The composite transform.\n */\nexport function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) {\n const sin = Math.sin(angle);\n const cos = Math.cos(angle);\n transform[0] = sx * cos;\n transform[1] = sy * sin;\n transform[2] = -sx * sin;\n transform[3] = sy * cos;\n transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1;\n transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1;\n return transform;\n}\n\n/**\n * Creates a composite transform given an initial translation, scale, rotation, and\n * final translation (in that order only, not commutative). The resulting transform\n * string can be applied as `transform` property of an HTMLElement's style.\n * @param {number} dx1 Initial translation x.\n * @param {number} dy1 Initial translation y.\n * @param {number} sx Scale factor x.\n * @param {number} sy Scale factor y.\n * @param {number} angle Rotation (in counter-clockwise radians).\n * @param {number} dx2 Final translation x.\n * @param {number} dy2 Final translation y.\n * @return {string} The composite css transform.\n * @api\n */\nexport function composeCssTransform(dx1, dy1, sx, sy, angle, dx2, dy2) {\n return toString(compose(create(), dx1, dy1, sx, sy, angle, dx2, dy2));\n}\n\n/**\n * Invert the given transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (source) transform.\n */\nexport function invert(source) {\n return makeInverse(source, source);\n}\n\n/**\n * Invert the given transform.\n * @param {!Transform} target Transform to be set as the inverse of\n * the source transform.\n * @param {!Transform} source The source transform to invert.\n * @return {!Transform} The inverted (target) transform.\n */\nexport function makeInverse(target, source) {\n const det = determinant(source);\n assert(det !== 0, 'Transformation matrix cannot be inverted');\n\n const a = source[0];\n const b = source[1];\n const c = source[2];\n const d = source[3];\n const e = source[4];\n const f = source[5];\n\n target[0] = d / det;\n target[1] = -b / det;\n target[2] = -c / det;\n target[3] = a / det;\n target[4] = (c * f - d * e) / det;\n target[5] = -(a * f - b * e) / det;\n\n return target;\n}\n\n/**\n * Returns the determinant of the given matrix.\n * @param {!Transform} mat Matrix.\n * @return {number} Determinant.\n */\nexport function determinant(mat) {\n return mat[0] * mat[3] - mat[1] * mat[2];\n}\n\n/**\n * @type {Array}\n */\nconst matrixPrecision = [1e5, 1e5, 1e5, 1e5, 2, 2];\n\n/**\n * A matrix string version of the transform. This can be used\n * for CSS transforms.\n * @param {!Transform} mat Matrix.\n * @return {string} The transform as a string.\n */\nexport function toString(mat) {\n const transformString = 'matrix(' + mat.join(', ') + ')';\n return transformString;\n}\n\n/**\n * Create a transform from a CSS transform matrix string.\n * @param {string} cssTransform The CSS string to parse.\n * @return {!Transform} The transform.\n */\nfunction fromString(cssTransform) {\n const values = cssTransform.substring(7, cssTransform.length - 1).split(',');\n return values.map(parseFloat);\n}\n\n/**\n * Compare two matrices for equality.\n * @param {!string} cssTransform1 A CSS transform matrix string.\n * @param {!string} cssTransform2 A CSS transform matrix string.\n * @return {boolean} The two matrices are equal.\n */\nexport function equivalent(cssTransform1, cssTransform2) {\n const mat1 = fromString(cssTransform1);\n const mat2 = fromString(cssTransform2);\n for (let i = 0; i < 6; ++i) {\n if (Math.round((mat1[i] - mat2[i]) * matrixPrecision[i]) !== 0) {\n return false;\n }\n }\n return true;\n}\n","/**\n * @module ol/geom/flat/transform\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array<number>} [dest] Destination.\n * @param {number} [destinationStride] Stride of destination coordinates; if unspecified, assumed to be 2.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n transform,\n dest,\n destinationStride,\n) {\n dest = dest ? dest : [];\n destinationStride = destinationStride ? destinationStride : 2;\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const x = flatCoordinates[j];\n const y = flatCoordinates[j + 1];\n dest[i++] = transform[0] * x + transform[2] * y + transform[4];\n dest[i++] = transform[1] * x + transform[3] * y + transform[5];\n\n for (let k = 2; k < destinationStride; k++) {\n dest[i++] = flatCoordinates[j + k];\n }\n }\n\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} angle Angle.\n * @param {Array<number>} anchor Rotation anchor point.\n * @param {Array<number>} [dest] Destination.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function rotate(\n flatCoordinates,\n offset,\n end,\n stride,\n angle,\n anchor,\n dest,\n) {\n dest = dest ? dest : [];\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + deltaX * cos - deltaY * sin;\n dest[i++] = anchorY + deltaX * sin + deltaY * cos;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * Scale the coordinates.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} sx Scale factor in the x-direction.\n * @param {number} sy Scale factor in the y-direction.\n * @param {Array<number>} anchor Scale anchor point.\n * @param {Array<number>} [dest] Destination.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function scale(\n flatCoordinates,\n offset,\n end,\n stride,\n sx,\n sy,\n anchor,\n dest,\n) {\n dest = dest ? dest : [];\n const anchorX = anchor[0];\n const anchorY = anchor[1];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n const deltaX = flatCoordinates[j] - anchorX;\n const deltaY = flatCoordinates[j + 1] - anchorY;\n dest[i++] = anchorX + sx * deltaX;\n dest[i++] = anchorY + sy * deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @param {Array<number>} [dest] Destination.\n * @return {Array<number>} Transformed coordinates.\n */\nexport function translate(\n flatCoordinates,\n offset,\n end,\n stride,\n deltaX,\n deltaY,\n dest,\n) {\n dest = dest ? dest : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n dest[i++] = flatCoordinates[j] + deltaX;\n dest[i++] = flatCoordinates[j + 1] + deltaY;\n for (let k = j + 2; k < j + stride; ++k) {\n dest[i++] = flatCoordinates[k];\n }\n }\n if (dest && dest.length != i) {\n dest.length = i;\n }\n return dest;\n}\n","/**\n * @module ol/geom/Geometry\n */\nimport BaseObject from '../Object.js';\nimport {\n createEmpty,\n createOrUpdateEmpty,\n getHeight,\n returnOrUpdate,\n} from '../extent.js';\nimport {memoizeOne} from '../functions.js';\nimport {get as getProjection, getTransform} from '../proj.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../transform.js';\nimport {abstract} from '../util.js';\nimport {transform2D} from './flat/transform.js';\n\n/**\n * @typedef {'XY' | 'XYZ' | 'XYM' | 'XYZM'} GeometryLayout\n * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')\n * or measure ('M') coordinate is available.\n */\n\n/**\n * @typedef {'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'GeometryCollection' | 'Circle'} Type\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,\n * `'GeometryCollection'`, or `'Circle'`.\n */\n\n/**\n * @type {import(\"../transform.js\").Transform}\n */\nconst tmpTransform = createTransform();\n\n/** @type {import('../coordinate.js').Coordinate} */\nconst tmpPoint = [NaN, NaN];\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for vector geometries.\n *\n * To get notified of changes to the geometry, register a listener for the\n * generic `change` event on your geometry instance.\n *\n * @abstract\n * @api\n */\nclass Geometry extends BaseObject {\n constructor() {\n super();\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = createEmpty();\n\n /**\n * @private\n * @type {number}\n */\n this.extentRevision_ = -1;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n\n /**\n * @protected\n * @type {number}\n */\n this.simplifiedGeometryRevision = 0;\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} revision The geometry revision.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n this.simplifyTransformedInternal = memoizeOne(\n (revision, squaredTolerance, transform) => {\n if (!transform) {\n return this.getSimplifiedGeometry(squaredTolerance);\n }\n const clone = this.clone();\n clone.applyTransform(transform);\n return clone.getSimplifiedGeometry(squaredTolerance);\n },\n );\n }\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {Geometry} Simplified geometry.\n */\n simplifyTransformed(squaredTolerance, transform) {\n return this.simplifyTransformedInternal(\n this.getRevision(),\n squaredTolerance,\n transform,\n );\n }\n\n /**\n * Make a complete copy of the geometry.\n * @abstract\n * @return {!Geometry} Clone.\n */\n clone() {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n return abstract();\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\n containsXY(x, y) {\n return this.closestPointXY(x, y, tmpPoint, Number.MIN_VALUE) === 0;\n }\n\n /**\n * Return the closest point of the geometry to the passed point as\n * {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} point Point.\n * @param {import(\"../coordinate.js\").Coordinate} [closestPoint] Closest point.\n * @return {import(\"../coordinate.js\").Coordinate} Closest point.\n * @api\n */\n getClosestPoint(point, closestPoint) {\n closestPoint = closestPoint ? closestPoint : [NaN, NaN];\n this.closestPointXY(point[0], point[1], closestPoint, Infinity);\n return closestPoint;\n }\n\n /**\n * Returns true if this geometry includes the specified coordinate. If the\n * coordinate is on the boundary of the geometry, returns false.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains coordinate.\n * @api\n */\n intersectsCoordinate(coordinate) {\n return this.containsXY(coordinate[0], coordinate[1]);\n }\n\n /**\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n */\n computeExtent(extent) {\n return abstract();\n }\n\n /**\n * Get the extent of the geometry.\n * @param {import(\"../extent.js\").Extent} [extent] Extent.\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n getExtent(extent) {\n if (this.extentRevision_ != this.getRevision()) {\n const extent = this.computeExtent(this.extent_);\n if (isNaN(extent[0]) || isNaN(extent[1])) {\n createOrUpdateEmpty(extent);\n }\n this.extentRevision_ = this.getRevision();\n }\n return returnOrUpdate(this.extent_, extent);\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n */\n rotate(angle, anchor) {\n abstract();\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n */\n scale(sx, sy, anchor) {\n abstract();\n }\n\n /**\n * Create a simplified version of this geometry. For linestrings, this uses\n * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)\n * algorithm. For polygons, a quantization-based\n * simplification is used to preserve topology.\n * @param {number} tolerance The tolerance distance for simplification.\n * @return {Geometry} A new, simplified version of the original geometry.\n * @api\n */\n simplify(tolerance) {\n return this.getSimplifiedGeometry(tolerance * tolerance);\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker\n * algorithm.\n * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.\n * @abstract\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Geometry} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n return abstract();\n }\n\n /**\n * Get the type of this geometry.\n * @abstract\n * @return {Type} Geometry type.\n */\n getType() {\n return abstract();\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @abstract\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n */\n applyTransform(transformFn) {\n abstract();\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n */\n intersectsExtent(extent) {\n return abstract();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @abstract\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n */\n translate(deltaX, deltaY) {\n abstract();\n }\n\n /**\n * Transform each coordinate of the geometry from one coordinate reference\n * system to another. The geometry is modified in place.\n * For example, a line will be transformed to a line and a circle to a circle.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {this} This geometry. Note that original geometry is\n * modified in place.\n * @api\n */\n transform(source, destination) {\n /** @type {import(\"../proj/Projection.js\").default} */\n const sourceProj = getProjection(source);\n const transformFn =\n sourceProj.getUnits() == 'tile-pixels'\n ? function (inCoordinates, outCoordinates, stride) {\n const pixelExtent = sourceProj.getExtent();\n const projectedExtent = sourceProj.getWorldExtent();\n const scale = getHeight(projectedExtent) / getHeight(pixelExtent);\n composeTransform(\n tmpTransform,\n projectedExtent[0],\n projectedExtent[3],\n scale,\n -scale,\n 0,\n 0,\n 0,\n );\n const transformed = transform2D(\n inCoordinates,\n 0,\n inCoordinates.length,\n stride,\n tmpTransform,\n outCoordinates,\n );\n const projTransform = getTransform(sourceProj, destination);\n if (projTransform) {\n return projTransform(transformed, transformed, stride);\n }\n return transformed;\n }\n : getTransform(sourceProj, destination);\n this.applyTransform(transformFn);\n return this;\n }\n}\n\nexport default Geometry;\n","/**\n * @module ol/geom/SimpleGeometry\n */\nimport {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';\nimport {abstract} from '../util.js';\nimport Geometry from './Geometry.js';\nimport {rotate, scale, transform2D, translate} from './flat/transform.js';\n\n/**\n * @classdesc\n * Abstract base class; only used for creating subclasses; do not instantiate\n * in apps, as cannot be rendered.\n *\n * @abstract\n * @api\n */\nclass SimpleGeometry extends Geometry {\n constructor() {\n super();\n\n /**\n * @protected\n * @type {import(\"./Geometry.js\").GeometryLayout}\n */\n this.layout = 'XY';\n\n /**\n * @protected\n * @type {number}\n */\n this.stride = 2;\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.flatCoordinates;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n return createOrUpdateFromFlatCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent,\n );\n }\n\n /**\n * @abstract\n * @return {Array<*> | null} Coordinates.\n */\n getCoordinates() {\n return abstract();\n }\n\n /**\n * Return the first coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} First coordinate.\n * @api\n */\n getFirstCoordinate() {\n return this.flatCoordinates.slice(0, this.stride);\n }\n\n /**\n * @return {Array<number>} Flat coordinates.\n */\n getFlatCoordinates() {\n return this.flatCoordinates;\n }\n\n /**\n * Return the last coordinate of the geometry.\n * @return {import(\"../coordinate.js\").Coordinate} Last point.\n * @api\n */\n getLastCoordinate() {\n return this.flatCoordinates.slice(\n this.flatCoordinates.length - this.stride,\n );\n }\n\n /**\n * Return the {@link import(\"./Geometry.js\").GeometryLayout layout} of the geometry.\n * @return {import(\"./Geometry.js\").GeometryLayout} Layout.\n * @api\n */\n getLayout() {\n return this.layout;\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker algorithm.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n * @override\n */\n getSimplifiedGeometry(squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n // If squaredTolerance is negative or if we know that simplification will not\n // have any effect then just return this.\n if (\n squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)\n ) {\n return this;\n }\n\n const simplifiedGeometry =\n this.getSimplifiedGeometryInternal(squaredTolerance);\n const simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates();\n if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) {\n return simplifiedGeometry;\n }\n // Simplification did not actually remove any coordinates. We now know\n // that any calls to getSimplifiedGeometry with a squaredTolerance less\n // than or equal to the current squaredTolerance will also not have any\n // effect. This allows us to short circuit simplification (saving CPU\n // cycles) and prevents the cache of simplified geometries from filling\n // up with useless identical copies of this geometry (saving memory).\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {SimpleGeometry} Simplified geometry.\n * @protected\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n return this;\n }\n\n /**\n * @return {number} Stride.\n */\n getStride() {\n return this.stride;\n }\n\n /**\n * @param {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n */\n setFlatCoordinates(layout, flatCoordinates) {\n this.stride = getStrideForLayout(layout);\n this.layout = layout;\n this.flatCoordinates = flatCoordinates;\n }\n\n /**\n * @abstract\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n setCoordinates(coordinates, layout) {\n abstract();\n }\n\n /**\n * @param {import(\"./Geometry.js\").GeometryLayout|undefined} layout Layout.\n * @param {Array<*>} coordinates Coordinates.\n * @param {number} nesting Nesting.\n * @protected\n */\n setLayout(layout, coordinates, nesting) {\n let stride;\n if (layout) {\n stride = getStrideForLayout(layout);\n } else {\n for (let i = 0; i < nesting; ++i) {\n if (coordinates.length === 0) {\n this.layout = 'XY';\n this.stride = 2;\n return;\n }\n coordinates = /** @type {Array<unknown>} */ (coordinates[0]);\n }\n stride = coordinates.length;\n layout = getLayoutForStride(stride);\n }\n this.layout = layout;\n this.stride = stride;\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n * @override\n */\n applyTransform(transformFn) {\n if (this.flatCoordinates) {\n transformFn(\n this.flatCoordinates,\n this.flatCoordinates,\n this.layout.startsWith('XYZ') ? 3 : 2,\n this.stride,\n );\n this.changed();\n }\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in counter-clockwise radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n * @override\n */\n rotate(angle, anchor) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n rotate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n angle,\n anchor,\n flatCoordinates,\n );\n this.changed();\n }\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n * @override\n */\n scale(sx, sy, anchor) {\n if (sy === undefined) {\n sy = sx;\n }\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n scale(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n sx,\n sy,\n anchor,\n flatCoordinates,\n );\n this.changed();\n }\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n * @override\n */\n translate(deltaX, deltaY) {\n const flatCoordinates = this.getFlatCoordinates();\n if (flatCoordinates) {\n const stride = this.getStride();\n translate(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n deltaX,\n deltaY,\n flatCoordinates,\n );\n this.changed();\n }\n }\n}\n\n/**\n * @param {number} stride Stride.\n * @return {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n */\nexport function getLayoutForStride(stride) {\n let layout;\n if (stride == 2) {\n layout = 'XY';\n } else if (stride == 3) {\n layout = 'XYZ';\n } else if (stride == 4) {\n layout = 'XYZM';\n }\n return /** @type {import(\"./Geometry.js\").GeometryLayout} */ (layout);\n}\n\n/**\n * @param {import(\"./Geometry.js\").GeometryLayout} layout Layout.\n * @return {number} Stride.\n */\nexport function getStrideForLayout(layout) {\n let stride;\n if (layout == 'XY') {\n stride = 2;\n } else if (layout == 'XYZ' || layout == 'XYM') {\n stride = 3;\n } else if (layout == 'XYZM') {\n stride = 4;\n }\n return /** @type {number} */ (stride);\n}\n\n/**\n * @param {SimpleGeometry} simpleGeometry Simple geometry.\n * @param {import(\"../transform.js\").Transform} transform Transform.\n * @param {Array<number>} [dest] Destination.\n * @return {Array<number>} Transformed flat coordinates.\n */\nexport function transformGeom2D(simpleGeometry, transform, dest) {\n const flatCoordinates = simpleGeometry.getFlatCoordinates();\n if (!flatCoordinates) {\n return null;\n }\n const stride = simpleGeometry.getStride();\n return transform2D(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n transform,\n dest,\n );\n}\n\nexport default SimpleGeometry;\n","/**\n * @module ol/geom/flat/area\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRing(flatCoordinates, offset, end, stride) {\n let twiceArea = 0;\n const x0 = flatCoordinates[end - stride];\n const y0 = flatCoordinates[end - stride + 1];\n let dx1 = 0;\n let dy1 = 0;\n for (; offset < end; offset += stride) {\n const dx2 = flatCoordinates[offset] - x0;\n const dy2 = flatCoordinates[offset + 1] - y0;\n twiceArea += dy1 * dx2 - dx1 * dy2;\n dx1 = dx2;\n dy1 = dy2;\n }\n return twiceArea / 2;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRings(flatCoordinates, offset, ends, stride) {\n let area = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n area += linearRing(flatCoordinates, offset, end, stride);\n offset = end;\n }\n return area;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @return {number} Area.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n let area = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n area += linearRings(flatCoordinates, offset, ends, stride);\n offset = ends[ends.length - 1];\n }\n return area;\n}\n","/**\n * @module ol/geom/flat/closest\n */\nimport {lerp, squaredDistance as squaredDx} from '../../math.js';\n\n/**\n * Returns the point on the 2D line segment flatCoordinates[offset1] to\n * flatCoordinates[offset2] that is closest to the point (x, y). Extra\n * dimensions are linearly interpolated.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset1 Offset 1.\n * @param {number} offset2 Offset 2.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n */\nfunction assignClosest(\n flatCoordinates,\n offset1,\n offset2,\n stride,\n x,\n y,\n closestPoint,\n) {\n const x1 = flatCoordinates[offset1];\n const y1 = flatCoordinates[offset1 + 1];\n const dx = flatCoordinates[offset2] - x1;\n const dy = flatCoordinates[offset2 + 1] - y1;\n let offset;\n if (dx === 0 && dy === 0) {\n offset = offset1;\n } else {\n const t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n offset = offset2;\n } else if (t > 0) {\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = lerp(\n flatCoordinates[offset1 + i],\n flatCoordinates[offset2 + i],\n t,\n );\n }\n closestPoint.length = stride;\n return;\n } else {\n offset = offset1;\n }\n }\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n}\n\n/**\n * Return the squared of the largest distance between any pair of consecutive\n * coordinates.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function maxSquaredDelta(flatCoordinates, offset, end, stride, max) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n for (offset += stride; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n const squaredDelta = squaredDx(x1, y1, x2, y2);\n if (squaredDelta > max) {\n max = squaredDelta;\n }\n x1 = x2;\n y1 = y2;\n }\n return max;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function arrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n ends,\n stride,\n max,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n max = maxSquaredDelta(flatCoordinates, offset, end, stride, max);\n offset = end;\n }\n return max;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} max Max squared delta.\n * @return {number} Max squared delta.\n */\nexport function multiArrayMaxSquaredDelta(\n flatCoordinates,\n offset,\n endss,\n stride,\n max,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max);\n offset = ends[ends.length - 1];\n }\n return max;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array<number>} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n if (offset == end) {\n return minSquaredDistance;\n }\n let i, squaredDistance;\n if (maxDelta === 0) {\n // All points are identical, so just test the first point.\n squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[offset],\n flatCoordinates[offset + 1],\n );\n if (squaredDistance < minSquaredDistance) {\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[offset + i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n let index = offset + stride;\n while (index < end) {\n assignClosest(\n flatCoordinates,\n index - stride,\n index,\n stride,\n x,\n y,\n tmpPoint,\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n index += stride;\n } else {\n // Skip ahead multiple points, because we know that all the skipped\n // points cannot be any closer than the closest point we have found so\n // far. We know this because we know how close the current point is, how\n // close the closest point we have found so far is, and the maximum\n // distance between consecutive points. For example, if we're currently\n // at distance 10, the best we've found so far is 3, and that the maximum\n // distance between consecutive points is 2, then we'll need to skip at\n // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of\n // finding a closer point. We use Math.max(..., 1) to ensure that we\n // always advance at least one point, to avoid an infinite loop.\n index +=\n stride *\n Math.max(\n ((Math.sqrt(squaredDistance) - Math.sqrt(minSquaredDistance)) /\n maxDelta) |\n 0,\n 1,\n );\n }\n }\n if (isRing) {\n // Check the closing segment.\n assignClosest(\n flatCoordinates,\n end - stride,\n offset,\n stride,\n x,\n y,\n tmpPoint,\n );\n squaredDistance = squaredDx(x, y, tmpPoint[0], tmpPoint[1]);\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (i = 0; i < stride; ++i) {\n closestPoint[i] = tmpPoint[i];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array<number>} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n minSquaredDistance = assignClosestPoint(\n flatCoordinates,\n offset,\n end,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n );\n offset = end;\n }\n return minSquaredDistance;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} maxDelta Max delta.\n * @param {boolean} isRing Is ring.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {Array<number>} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @param {Array<number>} [tmpPoint] Temporary point object.\n * @return {number} Minimum squared distance.\n */\nexport function assignClosestMultiArrayPoint(\n flatCoordinates,\n offset,\n endss,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n) {\n tmpPoint = tmpPoint ? tmpPoint : [NaN, NaN];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n minSquaredDistance = assignClosestArrayPoint(\n flatCoordinates,\n offset,\n ends,\n stride,\n maxDelta,\n isRing,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n tmpPoint,\n );\n offset = ends[ends.length - 1];\n }\n return minSquaredDistance;\n}\n","/**\n * @module ol/geom/flat/deflate\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinate(flatCoordinates, offset, coordinate, stride) {\n for (let i = 0, ii = coordinate.length; i < ii; ++i) {\n flatCoordinates[offset++] = coordinate[i];\n }\n return offset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<import(\"../../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {number} stride Stride.\n * @return {number} offset Offset.\n */\nexport function deflateCoordinates(\n flatCoordinates,\n offset,\n coordinates,\n stride,\n) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n const coordinate = coordinates[i];\n for (let j = 0; j < stride; ++j) {\n flatCoordinates[offset++] = coordinate[j];\n }\n }\n return offset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<import(\"../../coordinate.js\").Coordinate>>} coordinatess Coordinatess.\n * @param {number} stride Stride.\n * @param {Array<number>} [ends] Ends.\n * @return {Array<number>} Ends.\n */\nexport function deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatess,\n stride,\n ends,\n) {\n ends = ends ? ends : [];\n let i = 0;\n for (let j = 0, jj = coordinatess.length; j < jj; ++j) {\n const end = deflateCoordinates(\n flatCoordinates,\n offset,\n coordinatess[j],\n stride,\n );\n ends[i++] = end;\n offset = end;\n }\n ends.length = i;\n return ends;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<Array<import(\"../../coordinate.js\").Coordinate>>>} coordinatesss Coordinatesss.\n * @param {number} stride Stride.\n * @param {Array<Array<number>>} [endss] Endss.\n * @return {Array<Array<number>>} Endss.\n */\nexport function deflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss,\n stride,\n endss,\n) {\n endss = endss ? endss : [];\n let i = 0;\n for (let j = 0, jj = coordinatesss.length; j < jj; ++j) {\n const ends = deflateCoordinatesArray(\n flatCoordinates,\n offset,\n coordinatesss[j],\n stride,\n endss[i],\n );\n if (ends.length === 0) {\n ends[0] = offset;\n }\n endss[i++] = ends;\n offset = ends[ends.length - 1];\n }\n endss.length = i;\n return endss;\n}\n","/**\n * @module ol/geom/flat/inflate\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Array<import(\"../../coordinate.js\").Coordinate>} [coordinates] Coordinates.\n * @return {Array<import(\"../../coordinate.js\").Coordinate>} Coordinates.\n */\nexport function inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinates,\n) {\n coordinates = coordinates !== undefined ? coordinates : [];\n let i = 0;\n for (let j = offset; j < end; j += stride) {\n coordinates[i++] = flatCoordinates.slice(j, j + stride);\n }\n coordinates.length = i;\n return coordinates;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Array<Array<import(\"../../coordinate.js\").Coordinate>>} [coordinatess] Coordinatess.\n * @return {Array<Array<import(\"../../coordinate.js\").Coordinate>>} Coordinatess.\n */\nexport function inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n coordinatess,\n) {\n coordinatess = coordinatess !== undefined ? coordinatess : [];\n let i = 0;\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n const end = ends[j];\n coordinatess[i++] = inflateCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinatess[i],\n );\n offset = end;\n }\n coordinatess.length = i;\n return coordinatess;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array<Array<Array<import(\"../../coordinate.js\").Coordinate>>>} [coordinatesss]\n * Coordinatesss.\n * @return {Array<Array<Array<import(\"../../coordinate.js\").Coordinate>>>} Coordinatesss.\n */\nexport function inflateMultiCoordinatesArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n coordinatesss,\n) {\n coordinatesss = coordinatesss !== undefined ? coordinatesss : [];\n let i = 0;\n for (let j = 0, jj = endss.length; j < jj; ++j) {\n const ends = endss[j];\n coordinatesss[i++] =\n ends.length === 1 && ends[0] === offset\n ? []\n : inflateCoordinatesArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n coordinatesss[i],\n );\n offset = ends[ends.length - 1];\n }\n coordinatesss.length = i;\n return coordinatesss;\n}\n","/**\n * @module ol/geom/flat/simplify\n */\n// Based on simplify-js https://github.com/mourner/simplify-js\n// Copyright (c) 2012, Vladimir Agafonkin\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are met:\n//\n// 1. Redistributions of source code must retain the above copyright notice,\n// this list of conditions and the following disclaimer.\n//\n// 2. Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n// POSSIBILITY OF SUCH DAMAGE.\n\nimport {squaredDistance, squaredSegmentDistance} from '../../math.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {boolean} highQuality Highest quality.\n * @param {Array<number>} [simplifiedFlatCoordinates] Simplified flat\n * coordinates.\n * @return {Array<number>} Simplified line string.\n */\nexport function simplifyLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n highQuality,\n simplifiedFlatCoordinates,\n) {\n simplifiedFlatCoordinates =\n simplifiedFlatCoordinates !== undefined ? simplifiedFlatCoordinates : [];\n if (!highQuality) {\n end = radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n flatCoordinates = simplifiedFlatCoordinates;\n offset = 0;\n stride = 2;\n }\n simplifiedFlatCoordinates.length = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return simplifiedFlatCoordinates;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n const n = (end - offset) / stride;\n if (n < 3) {\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n /** @type {Array<number>} */\n const markers = new Array(n);\n markers[0] = 1;\n markers[n - 1] = 1;\n /** @type {Array<number>} */\n const stack = [offset, end - stride];\n let index = 0;\n while (stack.length > 0) {\n const last = stack.pop();\n const first = stack.pop();\n let maxSquaredDistance = 0;\n const x1 = flatCoordinates[first];\n const y1 = flatCoordinates[first + 1];\n const x2 = flatCoordinates[last];\n const y2 = flatCoordinates[last + 1];\n for (let i = first + stride; i < last; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n const squaredDistance = squaredSegmentDistance(x, y, x1, y1, x2, y2);\n if (squaredDistance > maxSquaredDistance) {\n index = i;\n maxSquaredDistance = squaredDistance;\n }\n }\n if (maxSquaredDistance > squaredTolerance) {\n markers[(index - offset) / stride] = 1;\n if (first + stride < index) {\n stack.push(first, index);\n }\n if (index + stride < last) {\n stack.push(index, last);\n }\n }\n }\n for (let i = 0; i < n; ++i) {\n if (markers[i]) {\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + i * stride + 1];\n }\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<number>} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = douglasPeucker(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<Array<number>>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function douglasPeuckerMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n /** @type {Array<number>} */\n const simplifiedEnds = [];\n simplifiedOffset = douglasPeuckerArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function radialDistance(\n flatCoordinates,\n offset,\n end,\n stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n if (end <= offset + stride) {\n // zero or one point, no simplification possible, so copy and return\n for (; offset < end; offset += stride) {\n simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];\n simplifiedFlatCoordinates[simplifiedOffset++] =\n flatCoordinates[offset + 1];\n }\n return simplifiedOffset;\n }\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n // copy first point\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n let x2 = x1;\n let y2 = y1;\n for (offset += stride; offset < end; offset += stride) {\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n if (squaredDistance(x1, y1, x2, y2) > squaredTolerance) {\n // copy point at offset\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n }\n }\n if (x2 != x1 || y2 != y1) {\n // copy last point\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {number} value Value.\n * @param {number} tolerance Tolerance.\n * @return {number} Rounded value.\n */\nexport function snap(value, tolerance) {\n return tolerance * Math.round(value / tolerance);\n}\n\n/**\n * Simplifies a line string using an algorithm designed by Tim Schaub.\n * Coordinates are snapped to the nearest value in a virtual grid and\n * consecutive duplicate coordinates are discarded. This effectively preserves\n * topology as the simplification of any subsection of a line string is\n * independent of the rest of the line string. This means that, for examples,\n * the common edge between two polygons will be simplified to the same line\n * string independently in both polygons. This implementation uses a single\n * pass over the coordinates and eliminates intermediate collinear points.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @return {number} Simplified offset.\n */\nexport function quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n) {\n // do nothing if the line is empty\n if (offset == end) {\n return simplifiedOffset;\n }\n // snap the first coordinate (P1)\n let x1 = snap(flatCoordinates[offset], tolerance);\n let y1 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // add the first coordinate to the output\n simplifiedFlatCoordinates[simplifiedOffset++] = x1;\n simplifiedFlatCoordinates[simplifiedOffset++] = y1;\n // find the next coordinate that does not snap to the same value as the first\n // coordinate (P2)\n let x2, y2;\n do {\n x2 = snap(flatCoordinates[offset], tolerance);\n y2 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n if (offset == end) {\n // all coordinates snap to the same value, the line collapses to a point\n // push the last snapped value anyway to ensure that the output contains\n // at least two points\n // FIXME should we really return at least two points anyway?\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n }\n } while (x2 == x1 && y2 == y1);\n while (offset < end) {\n // snap the next coordinate (P3)\n const x3 = snap(flatCoordinates[offset], tolerance);\n const y3 = snap(flatCoordinates[offset + 1], tolerance);\n offset += stride;\n // skip P3 if it is equal to P2\n if (x3 == x2 && y3 == y2) {\n continue;\n }\n // calculate the delta between P1 and P2\n const dx1 = x2 - x1;\n const dy1 = y2 - y1;\n // calculate the delta between P3 and P1\n const dx2 = x3 - x1;\n const dy2 = y3 - y1;\n // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from\n // P1 in the same direction then P2 is on the straight line between P1 and\n // P3\n if (\n dx1 * dy2 == dy1 * dx2 &&\n ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&\n ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))\n ) {\n // discard P2 and set P2 = P3\n x2 = x3;\n y2 = y3;\n continue;\n }\n // either P1, P2, and P3 are not colinear, or they are colinear but P3 is\n // between P3 and P1 or on the opposite half of the line to P2. add P2,\n // and continue with P1 = P2 and P2 = P3\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n x1 = x2;\n y1 = y2;\n x2 = x3;\n y2 = y3;\n }\n // add the last point (P2)\n simplifiedFlatCoordinates[simplifiedOffset++] = x2;\n simplifiedFlatCoordinates[simplifiedOffset++] = y2;\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<number>} simplifiedEnds Simplified ends.\n * @return {number} Simplified offset.\n */\nexport function quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n simplifiedOffset = quantize(\n flatCoordinates,\n offset,\n end,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n );\n simplifiedEnds.push(simplifiedOffset);\n offset = end;\n }\n return simplifiedOffset;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} tolerance Tolerance.\n * @param {Array<number>} simplifiedFlatCoordinates Simplified flat\n * coordinates.\n * @param {number} simplifiedOffset Simplified offset.\n * @param {Array<Array<number>>} simplifiedEndss Simplified endss.\n * @return {number} Simplified offset.\n */\nexport function quantizeMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEndss,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n /** @type {Array<number>} */\n const simplifiedEnds = [];\n simplifiedOffset = quantizeArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n tolerance,\n simplifiedFlatCoordinates,\n simplifiedOffset,\n simplifiedEnds,\n );\n simplifiedEndss.push(simplifiedEnds);\n offset = ends[ends.length - 1];\n }\n return simplifiedOffset;\n}\n","/**\n * @module ol/geom/LinearRing\n */\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {linearRing as linearRingArea} from './flat/area.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {douglasPeucker} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Linear ring geometry. Only used as part of polygon; cannot be rendered\n * on its own.\n *\n * @api\n */\nclass LinearRing extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LinearRing} Clone.\n * @api\n * @override\n */\n clone() {\n return new LinearRing(this.flatCoordinates.slice(), this.layout);\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Return the area of the linear ring on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingArea(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the coordinates of the linear ring.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LinearRing} Simplified LinearRing.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return new LinearRing(simplifiedFlatCoordinates, 'XY');\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'LinearRing';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return false;\n }\n\n /**\n * Set the coordinates of the linear ring.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default LinearRing;\n","/**\n * @module ol/geom/Point\n */\nimport {containsXY, createOrUpdateFromCoordinate} from '../extent.js';\nimport {squaredDistance as squaredDx} from '../math.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {deflateCoordinate} from './flat/deflate.js';\n\n/**\n * @classdesc\n * Point geometry.\n *\n * @api\n */\nclass Point extends SimpleGeometry {\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n this.setCoordinates(coordinates, layout);\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Point} Clone.\n * @api\n * @override\n */\n clone() {\n const point = new Point(this.flatCoordinates.slice(), this.layout);\n point.applyProperties(this);\n return point;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n const flatCoordinates = this.flatCoordinates;\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[0],\n flatCoordinates[1],\n );\n if (squaredDistance < minSquaredDistance) {\n const stride = this.stride;\n for (let i = 0; i < stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n closestPoint.length = stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n\n /**\n * Return the coordinate of the point.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return this.flatCoordinates.slice();\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n return createOrUpdateFromCoordinate(this.flatCoordinates, extent);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'Point';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return containsXY(extent, this.flatCoordinates[0], this.flatCoordinates[1]);\n }\n\n /**\n * @param {!Array<*>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinate(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default Point;\n","/**\n * @module ol/geom/flat/contains\n */\nimport {forEachCorner} from '../../extent.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} Contains extent.\n */\nexport function linearRingContainsExtent(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n) {\n const outside = forEachCorner(\n extent,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} Contains (x, y).\n */\n function (coordinate) {\n return !linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n coordinate[0],\n coordinate[1],\n );\n },\n );\n return !outside;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n x,\n y,\n) {\n // https://web.archive.org/web/20210504233957/http://geomalgorithms.com/a03-_inclusion.html\n // Copyright 2000 softSurfer, 2012 Dan Sunday\n // This code may be freely used and modified for any purpose\n // providing that this copyright notice is included with it.\n // SoftSurfer makes no warranty for this code, and cannot be held\n // liable for any real or imagined damage resulting from its use.\n // Users of this code must verify correctness for their application.\n let wn = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n if (y1 <= y) {\n if (y2 > y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) > 0) {\n wn++;\n }\n } else if (y2 <= y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) < 0) {\n wn--;\n }\n x1 = x2;\n y1 = y2;\n }\n return wn !== 0;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingsContainsXY(\n flatCoordinates,\n offset,\n ends,\n stride,\n x,\n y,\n) {\n if (ends.length === 0) {\n return false;\n }\n if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) {\n return false;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)\n ) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n */\nexport function linearRingssContainsXY(\n flatCoordinates,\n offset,\n endss,\n stride,\n x,\n y,\n) {\n if (endss.length === 0) {\n return false;\n }\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/interiorpoint\n */\nimport {ascending} from '../../array.js';\nimport {linearRingsContainsXY} from './contains.js';\n\n/**\n * Calculates a point that is likely to lie in the interior of the linear rings.\n * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Array<number>} flatCenters Flat centers.\n * @param {number} flatCentersOffset Flat center offset.\n * @param {Array<number>} [dest] Destination.\n * @return {Array<number>} Destination point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n flatCentersOffset,\n dest,\n) {\n let i, ii, x, x1, x2, y1, y2;\n const y = flatCenters[flatCentersOffset + 1];\n /** @type {Array<number>} */\n const intersections = [];\n // Calculate intersections with the horizontal line\n for (let r = 0, rr = ends.length; r < rr; ++r) {\n const end = ends[r];\n x1 = flatCoordinates[end - stride];\n y1 = flatCoordinates[end - stride + 1];\n for (i = offset; i < end; i += stride) {\n x2 = flatCoordinates[i];\n y2 = flatCoordinates[i + 1];\n if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {\n x = ((y - y1) / (y2 - y1)) * (x2 - x1) + x1;\n intersections.push(x);\n }\n x1 = x2;\n y1 = y2;\n }\n }\n // Find the longest segment of the horizontal line that has its center point\n // inside the linear ring.\n let pointX = NaN;\n let maxSegmentLength = -Infinity;\n intersections.sort(ascending);\n x1 = intersections[0];\n for (i = 1, ii = intersections.length; i < ii; ++i) {\n x2 = intersections[i];\n const segmentLength = Math.abs(x2 - x1);\n if (segmentLength > maxSegmentLength) {\n x = (x1 + x2) / 2;\n if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {\n pointX = x;\n maxSegmentLength = segmentLength;\n }\n }\n x1 = x2;\n }\n if (isNaN(pointX)) {\n // There is no horizontal line that has its center point inside the linear\n // ring. Use the center of the the linear ring's extent.\n pointX = flatCenters[flatCentersOffset];\n }\n if (dest) {\n dest.push(pointX, y, maxSegmentLength);\n return dest;\n }\n return [pointX, y, maxSegmentLength];\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {Array<number>} flatCenters Flat centers.\n * @return {Array<number>} Interior points as XYM coordinates, where M is the\n * length of the horizontal intersection that the point belongs to.\n */\nexport function getInteriorPointsOfMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n flatCenters,\n) {\n /** @type {Array<number>} */\n let interiorPoints = [];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n interiorPoints = getInteriorPointOfArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n flatCenters,\n 2 * i,\n interiorPoints,\n );\n offset = ends[ends.length - 1];\n }\n return interiorPoints;\n}\n","/**\n * @module ol/geom/flat/segments\n */\n\n/**\n * This function calls `callback` for each segment of the flat coordinates\n * array. If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {function(import(\"../../coordinate.js\").Coordinate, import(\"../../coordinate.js\").Coordinate): T} callback Function\n * called for each segment.\n * @return {T|boolean} Value.\n * @template T\n */\nexport function forEach(flatCoordinates, offset, end, stride, callback) {\n let ret;\n offset += stride;\n for (; offset < end; offset += stride) {\n ret = callback(\n flatCoordinates.slice(offset - stride, offset),\n flatCoordinates.slice(offset, offset + stride),\n );\n if (ret) {\n return ret;\n }\n }\n return false;\n}\n\n/**\n * Calculate the intersection point of two line segments.\n * Reference: https://stackoverflow.com/a/72474223/2389327\n * @param {Array<import(\"../../coordinate.js\").Coordinate>} segment1 The first line segment as an array of two points.\n * @param {Array<import(\"../../coordinate.js\").Coordinate>} segment2 The second line segment as an array of two points.\n * @return {import(\"../../coordinate.js\").Coordinate|undefined} The intersection point or `undefined` if no intersection.\n */\nexport function getIntersectionPoint(segment1, segment2) {\n const [a, b] = segment1;\n const [c, d] = segment2;\n const t =\n ((a[0] - c[0]) * (c[1] - d[1]) - (a[1] - c[1]) * (c[0] - d[0])) /\n ((a[0] - b[0]) * (c[1] - d[1]) - (a[1] - b[1]) * (c[0] - d[0]));\n const u =\n ((a[0] - c[0]) * (a[1] - b[1]) - (a[1] - c[1]) * (a[0] - b[0])) /\n ((a[0] - b[0]) * (c[1] - d[1]) - (a[1] - b[1]) * (c[0] - d[0]));\n\n // Check if lines actually intersect\n if (0 <= t && t <= 1 && 0 <= u && u <= 1) {\n return [a[0] + t * (b[0] - a[0]), a[1] + t * (b[1] - a[1])];\n }\n return undefined;\n}\n","/**\n * @module ol/geom/flat/intersectsextent\n */\nimport {\n createEmpty,\n extendFlatCoordinates,\n intersects,\n intersectsSegment,\n} from '../../extent.js';\nimport {linearRingContainsExtent, linearRingContainsXY} from './contains.js';\nimport {forEach as forEachSegment} from './segments.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @param {import('../../extent.js').Extent} [coordinatesExtent] Coordinates extent\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineString(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n coordinatesExtent,\n) {\n coordinatesExtent =\n coordinatesExtent ??\n extendFlatCoordinates(createEmpty(), flatCoordinates, offset, end, stride);\n if (!intersects(extent, coordinatesExtent)) {\n return false;\n }\n if (\n (coordinatesExtent[0] >= extent[0] && coordinatesExtent[2] <= extent[2]) ||\n (coordinatesExtent[1] >= extent[1] && coordinatesExtent[3] <= extent[3])\n ) {\n return true;\n }\n return forEachSegment(\n flatCoordinates,\n offset,\n end,\n stride,\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} point1 Start point.\n * @param {import(\"../../coordinate.js\").Coordinate} point2 End point.\n * @return {boolean} `true` if the segment and the extent intersect,\n * `false` otherwise.\n */\n function (point1, point2) {\n return intersectsSegment(extent, point1, point2);\n },\n );\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLineStringArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent,\n) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n if (\n intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)\n ) {\n return true;\n }\n offset = ends[i];\n }\n return false;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRing(\n flatCoordinates,\n offset,\n end,\n stride,\n extent,\n) {\n if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[1],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[0],\n extent[3],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[1],\n )\n ) {\n return true;\n }\n if (\n linearRingContainsXY(\n flatCoordinates,\n offset,\n end,\n stride,\n extent[2],\n extent[3],\n )\n ) {\n return true;\n }\n return false;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingArray(\n flatCoordinates,\n offset,\n ends,\n stride,\n extent,\n) {\n if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) {\n return false;\n }\n if (ends.length === 1) {\n return true;\n }\n for (let i = 1, ii = ends.length; i < ii; ++i) {\n if (\n linearRingContainsExtent(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent,\n )\n ) {\n if (\n !intersectsLineString(\n flatCoordinates,\n ends[i - 1],\n ends[i],\n stride,\n extent,\n )\n ) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {boolean} True if the geometry and the extent intersect.\n */\nexport function intersectsLinearRingMultiArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n extent,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (\n intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)\n ) {\n return true;\n }\n offset = ends[ends.length - 1];\n }\n return false;\n}\n","/**\n * @module ol/geom/flat/reverse\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n */\nexport function coordinates(flatCoordinates, offset, end, stride) {\n while (offset < end - stride) {\n for (let i = 0; i < stride; ++i) {\n const tmp = flatCoordinates[offset + i];\n flatCoordinates[offset + i] = flatCoordinates[end - stride + i];\n flatCoordinates[end - stride + i] = tmp;\n }\n offset += stride;\n end -= stride;\n }\n}\n","/**\n * @module ol/geom/flat/orient\n */\nimport {coordinates as reverseCoordinates} from './reverse.js';\n\n/**\n * Is the linear ring oriented clockwise in a coordinate system with a bottom-left\n * coordinate origin? For a coordinate system with a top-left coordinate origin,\n * the ring's orientation is clockwise when this function returns false.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {boolean|undefined} Is clockwise.\n */\nexport function linearRingIsClockwise(flatCoordinates, offset, end, stride) {\n // https://stackoverflow.com/q/1165647/clockwise-method#1165943\n // https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrlinearring.cpp\n let edge = 0;\n let x1 = flatCoordinates[end - stride];\n let y1 = flatCoordinates[end - stride + 1];\n for (; offset < end; offset += stride) {\n const x2 = flatCoordinates[offset];\n const y2 = flatCoordinates[offset + 1];\n edge += (x2 - x1) * (y2 + y1);\n x1 = x2;\n y1 = y2;\n }\n return edge === 0 ? undefined : edge > 0;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingsAreOriented(\n flatCoordinates,\n offset,\n ends,\n stride,\n right,\n) {\n right = right !== undefined ? right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride,\n );\n if (i === 0) {\n if ((right && isClockwise) || (!right && !isClockwise)) {\n return false;\n }\n } else {\n if ((right && !isClockwise) || (!right && isClockwise)) {\n return false;\n }\n }\n offset = end;\n }\n return true;\n}\n\n/**\n * Determines if linear rings are oriented. By default, left-hand orientation\n * is tested (first ring must be clockwise, remaining rings counter-clockwise).\n * To test for right-hand orientation, use the `right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Test for right-hand orientation\n * (counter-clockwise exterior ring and clockwise interior rings).\n * @return {boolean} Rings are correctly oriented.\n */\nexport function linearRingssAreOriented(\n flatCoordinates,\n offset,\n endss,\n stride,\n right,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, right)) {\n return false;\n }\n if (ends.length) {\n offset = ends[ends.length - 1];\n }\n }\n return true;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {boolean} [right] Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRings(\n flatCoordinates,\n offset,\n ends,\n stride,\n right,\n) {\n right = right !== undefined ? right : false;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const isClockwise = linearRingIsClockwise(\n flatCoordinates,\n offset,\n end,\n stride,\n );\n const reverse =\n i === 0\n ? (right && isClockwise) || (!right && !isClockwise)\n : (right && !isClockwise) || (!right && isClockwise);\n if (reverse) {\n reverseCoordinates(flatCoordinates, offset, end, stride);\n }\n offset = end;\n }\n return offset;\n}\n\n/**\n * Orient coordinates in a flat array of linear rings. By default, rings\n * are oriented following the left-hand rule (clockwise for exterior and\n * counter-clockwise for interior rings). To orient according to the\n * right-hand rule, use the `right` argument.\n *\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Array of array of end indexes.\n * @param {number} stride Stride.\n * @param {boolean} [right] Follow the right-hand rule for orientation.\n * @return {number} End.\n */\nexport function orientLinearRingsArray(\n flatCoordinates,\n offset,\n endss,\n stride,\n right,\n) {\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = orientLinearRings(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n right,\n );\n }\n return offset;\n}\n\n/**\n * Return a two-dimensional endss\n * @param {Array<number>} flatCoordinates Flat coordinates\n * @param {Array<number>} ends Linear ring end indexes\n * @return {Array<Array<number>>} Two dimensional endss array that can\n * be used to construct a MultiPolygon\n */\nexport function inflateEnds(flatCoordinates, ends) {\n const endss = [];\n let offset = 0;\n let prevEndIndex = 0;\n let startOrientation;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n // classifies an array of rings into polygons with outer rings and holes\n const orientation = linearRingIsClockwise(flatCoordinates, offset, end, 2);\n if (startOrientation === undefined) {\n startOrientation = orientation;\n }\n if (orientation === startOrientation) {\n endss.push(ends.slice(prevEndIndex, i + 1));\n } else {\n if (endss.length === 0) {\n continue;\n }\n endss[endss.length - 1].push(ends[prevEndIndex]);\n }\n prevEndIndex = i + 1;\n offset = end;\n }\n return endss;\n}\n","/**\n * @module ol/geom/Polygon\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY, getCenter, isEmpty} from '../extent.js';\nimport {modulo} from '../math.js';\nimport {offset as sphereOffset} from '../sphere.js';\nimport LinearRing from './LinearRing.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {linearRings as linearRingsArea} from './flat/area.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {linearRingsContainsXY} from './flat/contains.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {getInteriorPointOfArray} from './flat/interiorpoint.js';\nimport {intersectsLinearRingArray} from './flat/intersectsextent.js';\nimport {linearRingsAreOriented, orientLinearRings} from './flat/orient.js';\nimport {quantizeArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Polygon geometry.\n *\n * @api\n */\nclass Polygon extends SimpleGeometry {\n /**\n * @param {!Array<Array<import(\"../coordinate.js\").Coordinate>>|!Array<number>} coordinates\n * Array of linear rings that define the polygon. The first linear ring of the\n * array defines the outer-boundary or surface of the polygon. Each subsequent\n * linear ring defines a hole in the surface of the polygon. A linear ring is\n * an array of vertices' coordinates where the first coordinate and the last are\n * equivalent. (For internal use, flat coordinates in combination with\n * `layout` and `ends` are also accepted.)\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array<number>} [ends] Ends (for internal use with flat coordinates).\n */\n constructor(coordinates, layout, ends) {\n super();\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointRevision_ = -1;\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate|null}\n */\n this.flatInteriorPoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (layout !== undefined && ends) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n this.ends_ = ends;\n } else {\n this.setCoordinates(\n /** @type {Array<Array<import(\"../coordinate.js\").Coordinate>>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed linear ring to this polygon.\n * @param {LinearRing} linearRing Linear ring.\n * @api\n */\n appendLinearRing(linearRing) {\n if (!this.flatCoordinates) {\n this.flatCoordinates = linearRing.getFlatCoordinates().slice();\n } else {\n extend(this.flatCoordinates, linearRing.getFlatCoordinates());\n }\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Polygon} Clone.\n * @api\n * @override\n */\n clone() {\n const polygon = new Polygon(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice(),\n );\n polygon.applyProperties(this);\n return polygon;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n return linearRingsContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n x,\n y,\n );\n }\n\n /**\n * Return the area of the polygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingsArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for polygons.\n *\n * @param {boolean} [right] Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array<Array<import(\"../coordinate.js\").Coordinate>>} Coordinates.\n * @api\n * @override\n */\n getCoordinates(right) {\n let flatCoordinates;\n if (right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRings(flatCoordinates, 0, this.ends_, this.stride, right);\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateCoordinatesArray(flatCoordinates, 0, this.ends_, this.stride);\n }\n\n /**\n * @return {Array<number>} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * @return {Array<number>} Interior point.\n */\n getFlatInteriorPoint() {\n if (this.flatInteriorPointRevision_ != this.getRevision()) {\n const flatCenter = getCenter(this.getExtent());\n this.flatInteriorPoint_ = getInteriorPointOfArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n flatCenter,\n 0,\n );\n this.flatInteriorPointRevision_ = this.getRevision();\n }\n return /** @type {import(\"../coordinate.js\").Coordinate} */ (\n this.flatInteriorPoint_\n );\n }\n\n /**\n * Return an interior point of the polygon.\n * @return {Point} Interior point as XYM coordinate, where M is the\n * length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoint() {\n return new Point(this.getFlatInteriorPoint(), 'XYM');\n }\n\n /**\n * Return the number of rings of the polygon, this includes the exterior\n * ring and any interior rings.\n *\n * @return {number} Number of rings.\n * @api\n */\n getLinearRingCount() {\n return this.ends_.length;\n }\n\n /**\n * Return the Nth linear ring of the polygon geometry. Return `null` if the\n * given index is out of range.\n * The exterior linear ring is available at index `0` and the interior rings\n * at index `1` and beyond.\n *\n * @param {number} index Index.\n * @return {LinearRing|null} Linear ring.\n * @api\n */\n getLinearRing(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LinearRing(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index],\n ),\n this.layout,\n );\n }\n\n /**\n * Return the linear rings of the polygon.\n * @return {Array<LinearRing>} Linear rings.\n * @api\n */\n getLinearRings() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const linearRings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const linearRing = new LinearRing(\n flatCoordinates.slice(offset, end),\n layout,\n );\n linearRings.push(linearRing);\n offset = end;\n }\n return linearRings;\n }\n\n /**\n * @return {Array<number>} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (linearRingsAreOriented(flatCoordinates, 0, this.ends_, this.stride)) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRings(\n this.orientedFlatCoordinates_,\n 0,\n this.ends_,\n this.stride,\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return /** @type {Array<number>} */ (this.orientedFlatCoordinates_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Polygon} Simplified Polygon.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array<number>} */\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = quantizeArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n return new Polygon(simplifiedFlatCoordinates, 'XY', simplifiedEnds);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'Polygon';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLinearRingArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.ends_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the polygon.\n * @param {!Array<Array<import(\"../coordinate.js\").Coordinate>>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_,\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default Polygon;\n\n/**\n * Create an approximation of a circle on the surface of a sphere.\n * @param {import(\"../coordinate.js\").Coordinate} center Center (`[lon, lat]` in degrees).\n * @param {number} radius The great-circle distance from the center to\n * the polygon vertices in meters.\n * @param {number} [n] Optional number of vertices for the resulting\n * polygon. Default is `32`.\n * @param {number} [sphereRadius] Optional radius for the sphere (defaults to\n * the Earth's mean radius using the WGS84 ellipsoid).\n * @return {Polygon} The \"circular\" polygon.\n * @api\n */\nexport function circular(center, radius, n, sphereRadius) {\n n = n ? n : 32;\n /** @type {Array<number>} */\n const flatCoordinates = [];\n for (let i = 0; i < n; ++i) {\n extend(\n flatCoordinates,\n sphereOffset(center, radius, (2 * Math.PI * i) / n, sphereRadius),\n );\n }\n flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);\n return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);\n}\n\n/**\n * Create a polygon from an extent. The layout used is `XY`.\n * @param {import(\"../extent.js\").Extent} extent The extent.\n * @return {Polygon} The polygon.\n * @api\n */\nexport function fromExtent(extent) {\n if (isEmpty(extent)) {\n throw new Error('Cannot create polygon from empty extent');\n }\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const flatCoordinates = [\n minX,\n minY,\n minX,\n maxY,\n maxX,\n maxY,\n maxX,\n minY,\n minX,\n minY,\n ];\n return new Polygon(flatCoordinates, 'XY', [flatCoordinates.length]);\n}\n\n/**\n * Create a regular polygon from a circle.\n * @param {import(\"./Circle.js\").default} circle Circle geometry.\n * @param {number} [sides] Number of sides of the polygon. Default is 32.\n * @param {number} [angle] Start angle for the first vertex of the polygon in\n * counter-clockwise radians. 0 means East. Default is 0.\n * @return {Polygon} Polygon geometry.\n * @api\n */\nexport function fromCircle(circle, sides, angle) {\n sides = sides ? sides : 32;\n const stride = circle.getStride();\n const layout = circle.getLayout();\n const center = circle.getCenter();\n const arrayLength = stride * (sides + 1);\n const flatCoordinates = new Array(arrayLength);\n for (let i = 0; i < arrayLength; i += stride) {\n flatCoordinates[i] = 0;\n flatCoordinates[i + 1] = 0;\n for (let j = 2; j < stride; j++) {\n flatCoordinates[i + j] = center[j];\n }\n }\n const ends = [flatCoordinates.length];\n const polygon = new Polygon(flatCoordinates, layout, ends);\n makeRegular(polygon, center, circle.getRadius(), angle);\n return polygon;\n}\n\n/**\n * Modify the coordinates of a polygon to make it a regular polygon.\n * @param {Polygon} polygon Polygon geometry.\n * @param {import(\"../coordinate.js\").Coordinate} center Center of the regular polygon.\n * @param {number} radius Radius of the regular polygon.\n * @param {number} [angle] Start angle for the first vertex of the polygon in\n * counter-clockwise radians. 0 means East. Default is 0.\n */\nexport function makeRegular(polygon, center, radius, angle) {\n const flatCoordinates = polygon.getFlatCoordinates();\n const stride = polygon.getStride();\n const sides = flatCoordinates.length / stride - 1;\n const startAngle = angle ? angle : 0;\n for (let i = 0; i <= sides; ++i) {\n const offset = i * stride;\n const angle = startAngle + (modulo(i, sides) * 2 * Math.PI) / sides;\n flatCoordinates[offset] = center[0] + radius * Math.cos(angle);\n flatCoordinates[offset + 1] = center[1] + radius * Math.sin(angle);\n }\n polygon.changed();\n}\n","/**\n * @module ol/Geolocation\n */\nimport BaseObject from './Object.js';\nimport BaseEvent from './events/Event.js';\nimport {circular as circularPolygon} from './geom/Polygon.js';\nimport {toRadians} from './math.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n identityTransform,\n} from './proj.js';\n\n/**\n * @enum {string}\n */\nconst Property = {\n ACCURACY: 'accuracy',\n ACCURACY_GEOMETRY: 'accuracyGeometry',\n ALTITUDE: 'altitude',\n ALTITUDE_ACCURACY: 'altitudeAccuracy',\n HEADING: 'heading',\n POSITION: 'position',\n PROJECTION: 'projection',\n SPEED: 'speed',\n TRACKING: 'tracking',\n TRACKING_OPTIONS: 'trackingOptions',\n};\n\n/**\n * @enum string\n */\nconst GeolocationErrorType = {\n /**\n * Triggered when a `GeolocationPositionError` occurs.\n * @event module:ol/Geolocation.GeolocationError#error\n * @api\n */\n ERROR: 'error',\n};\n\n/**\n * @classdesc\n * Events emitted on [GeolocationPositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError).\n */\nexport class GeolocationError extends BaseEvent {\n /**\n * @param {GeolocationPositionError} error error object.\n */\n constructor(error) {\n super(GeolocationErrorType.ERROR);\n\n /**\n * Code of the underlying `GeolocationPositionError`.\n * @type {number}\n * @api\n */\n this.code = error.code;\n\n /**\n * Message of the underlying `GeolocationPositionError`.\n * @type {string}\n * @api\n */\n this.message = error.message;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [tracking=false] Start Tracking right after\n * instantiation.\n * @property {PositionOptions} [trackingOptions] Tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position_options_interface.\n * @property {import(\"./proj.js\").ProjectionLike} [projection] The projection the position\n * is reported in.\n */\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:accuracy'|'change:accuracyGeometry'|'change:altitude'|\n * 'change:altitudeAccuracy'|'change:heading'|'change:position'|'change:projection'|'change:speed'|'change:tracking'|\n * 'change:trackingOptions'} GeolocationObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<GeolocationObjectEventTypes, import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").OnSignature<'error', GeolocationError, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|GeolocationObjectEventTypes, Return> &\n * import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return>} GeolocationOnSignature\n */\n\n/**\n * @classdesc\n * Helper class for providing HTML5 Geolocation capabilities.\n * The [Geolocation API](https://www.w3.org/TR/geolocation-API/)\n * is used to locate a user's position.\n *\n * To get notified of position changes and errors, register listeners for the generic\n * `change` event and the `error` event on your instance of {@link module:ol/Geolocation~Geolocation}.\n *\n * Example:\n *\n * const geolocation = new Geolocation({\n * // take the projection to use from the map's view\n * projection: view.getProjection()\n * });\n * // listen to changes in position\n * geolocation.on('change', function(evt) {\n * console.log(geolocation.getPosition());\n * });\n * // listen to error\n * geolocation.on('error', function(evt) {\n * window.console.log(evt.message);\n * });\n *\n * @fires GeolocationError\n * @api\n */\nclass Geolocation extends BaseObject {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {GeolocationOnSignature<import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {GeolocationOnSignature<import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {GeolocationOnSignature<void>}\n */\n this.un;\n\n options = options || {};\n\n /**\n * The unprojected (EPSG:4326) device position.\n * @private\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.position_ = null;\n\n /**\n * @private\n * @type {import(\"./proj.js\").TransformFunction}\n */\n this.transform_ = identityTransform;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.watchId_ = undefined;\n\n this.addChangeListener(Property.PROJECTION, this.handleProjectionChanged_);\n this.addChangeListener(Property.TRACKING, this.handleTrackingChanged_);\n\n if (options.projection !== undefined) {\n this.setProjection(options.projection);\n }\n if (options.trackingOptions !== undefined) {\n this.setTrackingOptions(options.trackingOptions);\n }\n\n this.setTracking(options.tracking !== undefined ? options.tracking : false);\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.setTracking(false);\n super.disposeInternal();\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n getProjection('EPSG:4326'),\n projection,\n );\n if (this.position_) {\n this.set(Property.POSITION, this.transform_(this.position_));\n }\n }\n }\n\n /**\n * @private\n */\n handleTrackingChanged_() {\n if ('geolocation' in navigator) {\n const tracking = this.getTracking();\n if (tracking && this.watchId_ === undefined) {\n this.watchId_ = navigator.geolocation.watchPosition(\n this.positionChange_.bind(this),\n this.positionError_.bind(this),\n this.getTrackingOptions(),\n );\n } else if (!tracking && this.watchId_ !== undefined) {\n navigator.geolocation.clearWatch(this.watchId_);\n this.watchId_ = undefined;\n }\n }\n }\n\n /**\n * @private\n * @param {GeolocationPosition} position position event.\n */\n positionChange_(position) {\n const coords = position.coords;\n this.set(Property.ACCURACY, coords.accuracy);\n this.set(\n Property.ALTITUDE,\n coords.altitude === null ? undefined : coords.altitude,\n );\n this.set(\n Property.ALTITUDE_ACCURACY,\n coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy,\n );\n this.set(\n Property.HEADING,\n coords.heading === null ? undefined : toRadians(coords.heading),\n );\n if (!this.position_) {\n this.position_ = [coords.longitude, coords.latitude];\n } else {\n this.position_[0] = coords.longitude;\n this.position_[1] = coords.latitude;\n }\n const projectedPosition = this.transform_(this.position_);\n this.set(Property.POSITION, projectedPosition.slice());\n this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);\n const geometry = circularPolygon(this.position_, coords.accuracy);\n geometry.applyTransform(this.transform_);\n this.set(Property.ACCURACY_GEOMETRY, geometry);\n this.changed();\n }\n\n /**\n * @private\n * @param {GeolocationPositionError} error error object.\n */\n positionError_(error) {\n this.dispatchEvent(new GeolocationError(error));\n }\n\n /**\n * Get the accuracy of the position in meters.\n * @return {number|undefined} The accuracy of the position measurement in\n * meters.\n * @observable\n * @api\n */\n getAccuracy() {\n return /** @type {number|undefined} */ (this.get(Property.ACCURACY));\n }\n\n /**\n * Get a geometry of the position accuracy.\n * @return {?import(\"./geom/Polygon.js\").default} A geometry of the position accuracy.\n * @observable\n * @api\n */\n getAccuracyGeometry() {\n return /** @type {?import(\"./geom/Polygon.js\").default} */ (\n this.get(Property.ACCURACY_GEOMETRY) || null\n );\n }\n\n /**\n * Get the altitude associated with the position.\n * @return {number|undefined} The altitude of the position in meters above mean\n * sea level.\n * @observable\n * @api\n */\n getAltitude() {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));\n }\n\n /**\n * Get the altitude accuracy of the position.\n * @return {number|undefined} The accuracy of the altitude measurement in\n * meters.\n * @observable\n * @api\n */\n getAltitudeAccuracy() {\n return /** @type {number|undefined} */ (\n this.get(Property.ALTITUDE_ACCURACY)\n );\n }\n\n /**\n * Get the heading as radians clockwise from North.\n * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`\n * is set to `true` in the tracking options.\n * @return {number|undefined} The heading of the device in radians from north.\n * @observable\n * @api\n */\n getHeading() {\n return /** @type {number|undefined} */ (this.get(Property.HEADING));\n }\n\n /**\n * Get the position of the device.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The current position of the device reported\n * in the current projection.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(Property.POSITION)\n );\n }\n\n /**\n * Get the projection associated with the position.\n * @return {import(\"./proj/Projection.js\").default|undefined} The projection the position is\n * reported in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"./proj/Projection.js\").default|undefined} */ (\n this.get(Property.PROJECTION)\n );\n }\n\n /**\n * Get the speed in meters per second.\n * @return {number|undefined} The instantaneous speed of the device in meters\n * per second.\n * @observable\n * @api\n */\n getSpeed() {\n return /** @type {number|undefined} */ (this.get(Property.SPEED));\n }\n\n /**\n * Determine if the device location is being tracked.\n * @return {boolean} The device location is being tracked.\n * @observable\n * @api\n */\n getTracking() {\n return /** @type {boolean} */ (this.get(Property.TRACKING));\n }\n\n /**\n * Get the tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position-options.\n * @return {PositionOptions|undefined} PositionOptions as defined by\n * the [HTML5 Geolocation spec\n * ](https://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n getTrackingOptions() {\n return /** @type {PositionOptions|undefined} */ (\n this.get(Property.TRACKING_OPTIONS)\n );\n }\n\n /**\n * Set the projection to use for transforming the coordinates.\n * @param {import(\"./proj.js\").ProjectionLike} projection The projection the position is\n * reported in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(Property.PROJECTION, getProjection(projection));\n }\n\n /**\n * Enable or disable tracking.\n * @param {boolean} tracking Enable tracking.\n * @observable\n * @api\n */\n setTracking(tracking) {\n this.set(Property.TRACKING, tracking);\n }\n\n /**\n * Set the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @param {PositionOptions} options PositionOptions as defined by the\n * [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n setTrackingOptions(options) {\n this.set(Property.TRACKING_OPTIONS, options);\n }\n}\n\nexport default Geolocation;\n","/**\n * @module ol/ImageState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/Image\n */\nimport ImageState from './ImageState.js';\nimport EventType from './events/EventType.js';\nimport EventTarget from './events/Target.js';\nimport {listenOnce, unlistenByKey} from './events.js';\nimport {toPromise} from './functions.js';\nimport {CREATE_IMAGE_BITMAP, IMAGE_DECODE} from './has.js';\n\n/**\n * A function that takes an {@link module:ol/Image~ImageWrapper} for the image and a\n * `{string}` for the src as arguments. It is supposed to make it so the\n * underlying image {@link module:ol/Image~ImageWrapper#getImage} is assigned the\n * content specified by the src. If not specified, the default is\n *\n * function(image, src) {\n * image.getImage().src = src;\n * }\n *\n * Providing a custom `imageLoadFunction` can be useful to load images with\n * post requests or - in general - through XHR requests, where the src of the\n * image element would be set to a data URI when the content is loaded.\n *\n * @typedef {function(import(\"./Image.js\").default, string): void} LoadFunction\n * @api\n */\n\n/**\n * @typedef {Object} ImageObject\n * @property {import(\"./extent.js\").Extent} [extent] Extent, if different from the requested one.\n * @property {import(\"./resolution.js\").ResolutionLike} [resolution] Resolution, if different from the requested one.\n * When x and y resolution are different, use the array type (`[xResolution, yResolution]`).\n * @property {number} [pixelRatio] Pixel ratio, if different from the requested one.\n * @property {import('./DataTile.js').ImageLike} image Image.\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * For images that cover any extent and resolution (static images), the loader function should not accept\n * any arguments. The function returns an {@link import(\"./DataTile.js\").ImageLike image}, an\n * {@link import(\"./Image.js\").ImageObject image object}, or a promise for the same.\n * For loaders that generate images, the promise should not resolve until the image is loaded.\n * If the returned image does not match the extent, resolution or pixel ratio passed to the loader,\n * it has to return an {@link import(\"./Image.js\").ImageObject image object} with the `image` and the\n * correct `extent`, `resolution` and `pixelRatio`.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): import(\"./DataTile.js\").ImageLike|ImageObject|Promise<import(\"./DataTile.js\").ImageLike|ImageObject>} Loader\n * @api\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * The function returns a promise for an {@link import(\"./Image.js\").ImageObject image object}.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): Promise<import(\"./DataTile.js\").ImageLike|ImageObject>} ImageObjectPromiseLoader\n */\n\nclass ImageWrapper extends EventTarget {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number|Array<number>|undefined} resolution Resolution. If provided as array, x and y\n * resolution will be assumed.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./ImageState.js\").default|Loader} stateOrLoader State.\n */\n constructor(extent, resolution, pixelRatio, stateOrLoader) {\n super();\n\n /**\n * @protected\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = extent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @protected\n * @type {number|Array<number>|undefined}\n */\n this.resolution = resolution;\n\n /**\n * @protected\n * @type {import(\"./ImageState.js\").default}\n */\n this.state =\n typeof stateOrLoader === 'function' ? ImageState.IDLE : stateOrLoader;\n\n /**\n * @private\n * @type {import('./DataTile.js').ImageLike|null}\n */\n this.image_ = null;\n\n /**\n * @protected\n * @type {Loader|null}\n */\n this.loader = typeof stateOrLoader === 'function' ? stateOrLoader : null;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n getExtent() {\n return this.extent;\n }\n\n /**\n * @return {import('./DataTile.js').ImageLike} Image.\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * @return {number} PixelRatio.\n */\n getPixelRatio() {\n return this.pixelRatio_;\n }\n\n /**\n * @return {number|Array<number>} Resolution.\n */\n getResolution() {\n return /** @type {number} */ (this.resolution);\n }\n\n /**\n * @return {import(\"./ImageState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == ImageState.IDLE) {\n if (this.loader) {\n this.state = ImageState.LOADING;\n this.changed();\n const resolution = this.getResolution();\n const requestResolution = Array.isArray(resolution)\n ? resolution[0]\n : resolution;\n toPromise(() =>\n this.loader(\n this.getExtent(),\n requestResolution,\n this.getPixelRatio(),\n ),\n )\n .then((image) => {\n if ('image' in image) {\n this.image_ = image.image;\n }\n if ('extent' in image) {\n this.extent = image.extent;\n }\n if ('resolution' in image) {\n this.resolution = image.resolution;\n }\n if ('pixelRatio' in image) {\n this.pixelRatio_ = image.pixelRatio;\n }\n if (\n image instanceof HTMLImageElement ||\n (CREATE_IMAGE_BITMAP && image instanceof ImageBitmap) ||\n image instanceof HTMLCanvasElement ||\n image instanceof HTMLVideoElement\n ) {\n this.image_ = image;\n }\n this.state = ImageState.LOADED;\n })\n .catch((error) => {\n this.state = ImageState.ERROR;\n console.error(error); // eslint-disable-line no-console\n })\n .finally(() => this.changed());\n }\n }\n }\n\n /**\n * @param {import('./DataTile.js').ImageLike} image The image.\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * @param {number|Array<number>} resolution Resolution.\n */\n setResolution(resolution) {\n this.resolution = resolution;\n }\n}\n\n/**\n * @param {import('./DataTile.js').ImageLike} image Image element.\n * @param {function():any} loadHandler Load callback function.\n * @param {function():any} errorHandler Error callback function.\n * @return {function():void} Callback to stop listening.\n */\nexport function listenImage(image, loadHandler, errorHandler) {\n const img = /** @type {HTMLImageElement} */ (image);\n let listening = true;\n let decoding = false;\n let loaded = false;\n\n const listenerKeys = [\n listenOnce(img, EventType.LOAD, function () {\n loaded = true;\n if (!decoding) {\n loadHandler();\n }\n }),\n ];\n\n if (img.src && IMAGE_DECODE) {\n decoding = true;\n img\n .decode()\n .then(function () {\n if (listening) {\n loadHandler();\n }\n })\n .catch(function (error) {\n if (listening) {\n if (loaded) {\n loadHandler();\n } else {\n errorHandler();\n }\n }\n });\n } else {\n listenerKeys.push(listenOnce(img, EventType.ERROR, errorHandler));\n }\n\n return function unlisten() {\n listening = false;\n listenerKeys.forEach(unlistenByKey);\n };\n}\n\n/**\n * Loads an image.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise<HTMLImageElement>} Promise resolving to an `HTMLImageElement`.\n * @api\n */\nexport function load(image, src) {\n return new Promise((resolve, reject) => {\n function handleLoad() {\n unlisten();\n resolve(image);\n }\n function handleError() {\n unlisten();\n reject(new Error('Image load error'));\n }\n function unlisten() {\n image.removeEventListener('load', handleLoad);\n image.removeEventListener('error', handleError);\n }\n image.addEventListener('load', handleLoad);\n image.addEventListener('error', handleError);\n if (src) {\n image.src = src;\n }\n });\n}\n\n/**\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise<HTMLImageElement>} Promise resolving to an `HTMLImageElement`.\n */\nexport function decodeFallback(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE\n ? new Promise((resolve, reject) =>\n image\n .decode()\n .then(() => resolve(image))\n .catch((e) =>\n image.complete && image.width ? resolve(image) : reject(e),\n ),\n )\n : load(image);\n}\n\n/**\n * Loads an image and decodes it to an `ImageBitmap` if `createImageBitmap()` is supported. Returns\n * the loaded image otherwise.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise<ImageBitmap|HTMLImageElement>} Promise resolving to an `ImageBitmap` or an\n * `HTMLImageElement` if `createImageBitmap()` is not supported.\n * @api\n */\nexport function decode(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE && CREATE_IMAGE_BITMAP\n ? image\n .decode()\n .then(() => createImageBitmap(image))\n .catch((e) => {\n if (image.complete && image.width) {\n return image;\n }\n throw e;\n })\n : decodeFallback(image);\n}\n\nexport default ImageWrapper;\n","/**\n * @module ol/ImageCanvas\n */\nimport ImageWrapper from './Image.js';\nimport ImageState from './ImageState.js';\n\n/**\n * A function that is called to trigger asynchronous canvas drawing. It is\n * called with a \"done\" callback that should be called when drawing is done.\n * If any error occurs during drawing, the \"done\" callback should be called with\n * that error.\n *\n * @typedef {function(function(Error=): void): void} Loader\n */\n\nclass ImageCanvas extends ImageWrapper {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {HTMLCanvasElement} canvas Canvas.\n * @param {Loader} [loader] Optional loader function to\n * support asynchronous canvas drawing.\n */\n constructor(extent, resolution, pixelRatio, canvas, loader) {\n const state = loader !== undefined ? ImageState.IDLE : ImageState.LOADED;\n\n super(extent, resolution, pixelRatio, state);\n\n /**\n * Optional canvas loader function.\n * @type {?Loader}\n * @private\n */\n this.loader_ = loader !== undefined ? loader : null;\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.canvas_ = canvas;\n\n /**\n * @private\n * @type {?Error}\n */\n this.error_ = null;\n }\n\n /**\n * Get any error associated with asynchronous rendering.\n * @return {?Error} Any error that occurred during rendering.\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Handle async drawing complete.\n * @param {Error} [err] Any error during drawing.\n * @private\n */\n handleLoad_(err) {\n if (err) {\n this.error_ = err;\n this.state = ImageState.ERROR;\n } else {\n this.state = ImageState.LOADED;\n }\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {\n if (this.state == ImageState.IDLE) {\n this.state = ImageState.LOADING;\n this.changed();\n this.loader_(this.handleLoad_.bind(this));\n }\n }\n\n /**\n * @return {HTMLCanvasElement} Canvas element.\n * @override\n */\n getImage() {\n return this.canvas_;\n }\n}\n\nexport default ImageCanvas;\n","/**\n * @module ol/ImageTile\n */\nimport {listenImage} from './Image.js';\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\n\nclass ImageTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Image source URI.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options} [options] Tile options.\n */\n constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, options) {\n super(tileCoord, state, options);\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ = crossOrigin;\n\n /**\n * Image URI\n *\n * @private\n * @type {string}\n */\n this.src_ = src;\n\n this.key = src;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement}\n */\n this.image_ = new Image();\n if (crossOrigin !== null) {\n this.image_.crossOrigin = crossOrigin;\n }\n\n /**\n * @private\n * @type {?function():void}\n */\n this.unlisten_ = null;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n }\n\n /**\n * Get the HTML image element for this tile (may be a Canvas, Image, or Video).\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * Sets an HTML image element for this tile (may be a Canvas or preloaded Image).\n * @param {HTMLCanvasElement|HTMLImageElement} element Element.\n */\n setImage(element) {\n this.image_ = element;\n this.state = TileState.LOADED;\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Tracks loading or read errors.\n *\n * @private\n */\n handleImageError_() {\n this.state = TileState.ERROR;\n this.unlistenImage_();\n this.image_ = getBlankImage();\n this.changed();\n }\n\n /**\n * Tracks successful image load.\n *\n * @private\n */\n handleImageLoad_() {\n const image = /** @type {HTMLImageElement} */ (this.image_);\n if (image.naturalWidth && image.naturalHeight) {\n this.state = TileState.LOADED;\n } else {\n this.state = TileState.EMPTY;\n }\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n *\n * To retry loading tiles on failed requests, use a custom `tileLoadFunction`\n * that checks for error status codes and reloads only when the status code is\n * 408, 429, 500, 502, 503 and 504, and only when not too many retries have been\n * made already:\n *\n * ```js\n * const retryCodes = [408, 429, 500, 502, 503, 504];\n * const retries = {};\n * source.setTileLoadFunction((tile, src) => {\n * const image = tile.getImage();\n * fetch(src)\n * .then((response) => {\n * if (retryCodes.includes(response.status)) {\n * retries[src] = (retries[src] || 0) + 1;\n * if (retries[src] <= 3) {\n * setTimeout(() => tile.load(), retries[src] * 1000);\n * }\n * return Promise.reject();\n * }\n * return response.blob();\n * })\n * .then((blob) => {\n * const imageUrl = URL.createObjectURL(blob);\n * image.src = imageUrl;\n * setTimeout(() => URL.revokeObjectURL(imageUrl), 5000);\n * })\n * .catch(() => tile.setState(3)); // error\n * });\n * ```\n * @api\n * @override\n */\n load() {\n if (this.state == TileState.ERROR) {\n this.state = TileState.IDLE;\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n }\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n this.changed();\n this.tileLoadFunction_(this, this.src_);\n this.unlisten_ = listenImage(\n this.image_,\n this.handleImageLoad_.bind(this),\n this.handleImageError_.bind(this),\n );\n }\n }\n\n /**\n * Discards event handlers which listen for load completion or errors.\n *\n * @private\n */\n unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }\n\n /**\n * @override\n */\n disposeInternal() {\n this.unlistenImage_();\n this.image_ = null;\n super.disposeInternal();\n }\n}\n\n/**\n * Get a 1-pixel blank image.\n * @return {HTMLCanvasElement} Blank image.\n */\nfunction getBlankImage() {\n const ctx = createCanvasContext2D(1, 1);\n ctx.fillStyle = 'rgba(0,0,0,0)';\n ctx.fillRect(0, 0, 1, 1);\n return ctx.canvas;\n}\n\nexport default ImageTile;\n","/**\n * @module ol/Kinetic\n */\n\n/**\n * @classdesc\n * Implementation of inertial deceleration for map movement.\n *\n * @api\n */\nclass Kinetic {\n /**\n * @param {number} decay Rate of decay (must be negative).\n * @param {number} minVelocity Minimum velocity (pixels/millisecond).\n * @param {number} delay Delay to consider to calculate the kinetic\n * initial values (milliseconds).\n */\n constructor(decay, minVelocity, delay) {\n /**\n * @private\n * @type {number}\n */\n this.decay_ = decay;\n\n /**\n * @private\n * @type {number}\n */\n this.minVelocity_ = minVelocity;\n\n /**\n * @private\n * @type {number}\n */\n this.delay_ = delay;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.points_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.angle_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.initialVelocity_ = 0;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n begin() {\n this.points_.length = 0;\n this.angle_ = 0;\n this.initialVelocity_ = 0;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n */\n update(x, y) {\n this.points_.push(x, y, Date.now());\n }\n\n /**\n * @return {boolean} Whether we should do kinetic animation.\n */\n end() {\n if (this.points_.length < 6) {\n // at least 2 points are required (i.e. there must be at least 6 elements\n // in the array)\n return false;\n }\n const delay = Date.now() - this.delay_;\n const lastIndex = this.points_.length - 3;\n if (this.points_[lastIndex + 2] < delay) {\n // the last tracked point is too old, which means that the user stopped\n // panning before releasing the map\n return false;\n }\n\n // get the first point which still falls into the delay time\n let firstIndex = lastIndex - 3;\n while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) {\n firstIndex -= 3;\n }\n\n const duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2];\n // we don't want a duration of 0 (divide by zero)\n // we also make sure the user panned for a duration of at least one frame\n // (1/60s) to compute sane displacement values\n if (duration < 1000 / 60) {\n return false;\n }\n\n const dx = this.points_[lastIndex] - this.points_[firstIndex];\n const dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1];\n this.angle_ = Math.atan2(dy, dx);\n this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration;\n return this.initialVelocity_ > this.minVelocity_;\n }\n\n /**\n * @return {number} Total distance travelled (pixels).\n */\n getDistance() {\n return (this.minVelocity_ - this.initialVelocity_) / this.decay_;\n }\n\n /**\n * @return {number} Angle of the kinetic panning animation (radians).\n */\n getAngle() {\n return this.angle_;\n }\n}\n\nexport default Kinetic;\n","/**\n * @module ol/MapEvent\n */\nimport Event from './events/Event.js';\n\n/**\n * @classdesc\n * Events emitted as map events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map event.\n */\nclass MapEvent extends Event {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {?import(\"./Map.js\").FrameState} [frameState] Frame state.\n */\n constructor(type, map, frameState) {\n super(type);\n\n /**\n * The map where the event occurred.\n * @type {import(\"./Map.js\").default}\n * @api\n */\n this.map = map;\n\n /**\n * The frame state at the time of the event.\n * @type {?import(\"./Map.js\").FrameState}\n * @api\n */\n this.frameState = frameState !== undefined ? frameState : null;\n }\n}\n\nexport default MapEvent;\n","/**\n * @module ol/MapBrowserEvent\n */\nimport MapEvent from './MapEvent.js';\n\n/**\n * @classdesc\n * Events emitted as map browser events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map browser event.\n * @template {PointerEvent|KeyboardEvent|WheelEvent} [EVENT=PointerEvent|KeyboardEvent|WheelEvent]\n */\nclass MapBrowserEvent extends MapEvent {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {EVENT} originalEvent Original event.\n * @param {boolean} [dragging] Is the map currently being dragged?\n * @param {import(\"./Map.js\").FrameState} [frameState] Frame state.\n * @param {Array<PointerEvent>} [activePointers] Active pointers.\n */\n constructor(type, map, originalEvent, dragging, frameState, activePointers) {\n super(type, map, frameState);\n\n /**\n * The original browser event.\n * @const\n * @type {EVENT}\n * @api\n */\n this.originalEvent = originalEvent;\n\n /**\n * The map pixel relative to the viewport corresponding to the original browser event.\n * @type {?import(\"./pixel.js\").Pixel}\n * @private\n */\n this.pixel_ = null;\n\n /**\n * The coordinate in the user projection corresponding to the original browser event.\n * @type {?import(\"./coordinate.js\").Coordinate}\n * @private\n */\n this.coordinate_ = null;\n\n /**\n * Indicates if the map is currently being dragged. Only set for\n * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.\n *\n * @type {boolean}\n * @api\n */\n this.dragging = dragging !== undefined ? dragging : false;\n\n /**\n * @type {Array<PointerEvent>|undefined}\n */\n this.activePointers = activePointers;\n }\n\n /**\n * The map pixel relative to the viewport corresponding to the original event.\n * @type {import(\"./pixel.js\").Pixel}\n * @api\n */\n get pixel() {\n if (!this.pixel_) {\n this.pixel_ = this.map.getEventPixel(this.originalEvent);\n }\n return this.pixel_;\n }\n set pixel(pixel) {\n this.pixel_ = pixel;\n }\n\n /**\n * The coordinate corresponding to the original browser event. This will be in the user\n * projection if one is set. Otherwise it will be in the view projection.\n * @type {import(\"./coordinate.js\").Coordinate}\n * @api\n */\n get coordinate() {\n if (!this.coordinate_) {\n this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);\n }\n return this.coordinate_;\n }\n set coordinate(coordinate) {\n this.coordinate_ = coordinate;\n }\n\n /**\n * Prevents the default browser action.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.\n * @api\n * @override\n */\n preventDefault() {\n super.preventDefault();\n if ('preventDefault' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).preventDefault();\n }\n }\n\n /**\n * Prevents further propagation of the current event.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.\n * @api\n * @override\n */\n stopPropagation() {\n super.stopPropagation();\n if ('stopPropagation' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).stopPropagation();\n }\n }\n}\n\nexport default MapBrowserEvent;\n","/**\n * @module ol/MapBrowserEventType\n */\nimport EventType from './events/EventType.js';\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n /**\n * A true single click with no dragging and no double click. Note that this\n * event is delayed by 250 ms to ensure that it is not a double click.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick\n * @api\n */\n SINGLECLICK: 'singleclick',\n\n /**\n * A click with no dragging. A double click will fire two of this.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#click\n * @api\n */\n CLICK: EventType.CLICK,\n\n /**\n * A true double click, with no dragging.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick\n * @api\n */\n DBLCLICK: EventType.DBLCLICK,\n\n /**\n * Triggered when a pointer is dragged.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag\n * @api\n */\n POINTERDRAG: 'pointerdrag',\n\n /**\n * Triggered when a pointer is moved. Note that on touch devices this is\n * triggered when the map is panned, so is not the same as mousemove.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove\n * @api\n */\n POINTERMOVE: 'pointermove',\n\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n\n/***\n * @typedef {'singleclick'|'click'|'dblclick'|'pointerdrag'|'pointermove'} Types\n */\n","/**\n * @module ol/pointer/EventType\n */\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n POINTERMOVE: 'pointermove',\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n","/**\n * @module ol/MapBrowserEventHandler\n */\n\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport EventType from './events/EventType.js';\nimport Target from './events/Target.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {PASSIVE_EVENT_LISTENERS} from './has.js';\nimport PointerEventType from './pointer/EventType.js';\n\nclass MapBrowserEventHandler extends Target {\n /**\n * @param {import(\"./Map.js\").default} map The map with the viewport to listen to events on.\n * @param {number} [moveTolerance] The minimal distance the pointer must travel to trigger a move.\n */\n constructor(map, moveTolerance) {\n super(map);\n\n /**\n * This is the element that we will listen to the real events on.\n * @type {import(\"./Map.js\").default}\n * @private\n */\n this.map_ = map;\n\n /**\n * @type {ReturnType<typeof setTimeout>}\n * @private\n */\n this.clickTimeoutId_;\n\n /**\n * Emulate dblclick and singleclick. Will be true when only one pointer is active.\n * @type {boolean}\n */\n this.emulateClicks_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_ = false;\n\n /**\n * @type {!Array<import(\"./events.js\").EventsKey>}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * @type {number}\n * @private\n */\n this.moveTolerance_ = moveTolerance === undefined ? 1 : moveTolerance;\n\n /**\n * The most recent \"down\" type event (or null if none have occurred).\n * Set on pointerdown.\n * @type {PointerEvent|null}\n * @private\n */\n this.down_ = null;\n\n const element = this.map_.getViewport();\n\n /**\n * @type {Array<PointerEvent>}\n * @private\n */\n this.activePointers_ = [];\n\n /**\n * @type {!Object<number, Event>}\n * @private\n */\n this.trackedTouches_ = {};\n\n /**\n * @private\n */\n this.element_ = element;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.pointerdownListenerKey_ = listen(\n element,\n PointerEventType.POINTERDOWN,\n this.handlePointerDown_,\n this,\n );\n\n /**\n * @type {PointerEvent}\n * @private\n */\n this.originalPointerMoveEvent_;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.relayedListenerKey_ = listen(\n element,\n PointerEventType.POINTERMOVE,\n this.relayMoveEvent_,\n this,\n );\n\n /**\n * @private\n */\n this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this);\n\n this.element_.addEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false,\n );\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n emulateClick_(pointerEvent) {\n let newEvent = new MapBrowserEvent(\n MapBrowserEventType.CLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n if (this.clickTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.clickTimeoutId_);\n this.clickTimeoutId_ = undefined;\n newEvent = new MapBrowserEvent(\n MapBrowserEventType.DBLCLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n } else {\n // click\n this.clickTimeoutId_ = setTimeout(() => {\n this.clickTimeoutId_ = undefined;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.SINGLECLICK,\n this.map_,\n pointerEvent,\n );\n this.dispatchEvent(newEvent);\n }, 250);\n }\n }\n\n /**\n * Keeps track on how many pointers are currently active.\n *\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n updateActivePointers_(pointerEvent) {\n const event = pointerEvent;\n const id = event.pointerId;\n\n if (\n event.type == MapBrowserEventType.POINTERUP ||\n event.type == MapBrowserEventType.POINTERCANCEL\n ) {\n delete this.trackedTouches_[id];\n for (const pointerId in this.trackedTouches_) {\n if (this.trackedTouches_[pointerId].target !== event.target) {\n // Some platforms assign a new pointerId when the target changes.\n // If this happens, delete one tracked pointer. If there is more\n // than one tracked pointer for the old target, it will be cleared\n // by subsequent POINTERUP events from other pointers.\n delete this.trackedTouches_[pointerId];\n break;\n }\n }\n } else if (\n event.type == MapBrowserEventType.POINTERDOWN ||\n event.type == MapBrowserEventType.POINTERMOVE\n ) {\n this.trackedTouches_[id] = event;\n }\n this.activePointers_ = Object.values(this.trackedTouches_);\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerUp_(pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERUP,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n\n // We emulate click events on left mouse button click, touch contact, and pen\n // contact. isMouseActionButton returns true in these cases (evt.button is set\n // to 0).\n // See http://www.w3.org/TR/pointerevents/#button-states\n // We only fire click, singleclick, and doubleclick if nobody has called\n // event.preventDefault().\n if (\n this.emulateClicks_ &&\n !newEvent.defaultPrevented &&\n !this.dragging_ &&\n this.isMouseActionButton_(pointerEvent)\n ) {\n this.emulateClick_(this.down_);\n }\n\n if (this.activePointers_.length === 0) {\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n this.dragging_ = false;\n this.down_ = null;\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} If the left mouse button was pressed.\n * @private\n */\n isMouseActionButton_(pointerEvent) {\n return pointerEvent.button === 0;\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerDown_(pointerEvent) {\n this.emulateClicks_ = this.activePointers_.length === 0;\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDOWN,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n\n this.down_ = new PointerEvent(pointerEvent.type, pointerEvent);\n Object.defineProperty(this.down_, 'target', {\n writable: false,\n value: pointerEvent.target,\n });\n\n if (this.dragListenerKeys_.length === 0) {\n const doc = this.map_.getOwnerDocument();\n this.dragListenerKeys_.push(\n listen(\n doc,\n MapBrowserEventType.POINTERMOVE,\n this.handlePointerMove_,\n this,\n ),\n listen(doc, MapBrowserEventType.POINTERUP, this.handlePointerUp_, this),\n /* Note that the listener for `pointercancel is set up on\n * `pointerEventHandler_` and not `documentPointerEventHandler_` like\n * the `pointerup` and `pointermove` listeners.\n *\n * The reason for this is the following: `TouchSource.vacuumTouches_()`\n * issues `pointercancel` events, when there was no `touchend` for a\n * `touchstart`. Now, let's say a first `touchstart` is registered on\n * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.\n * But `documentPointerEventHandler_` doesn't know about the first\n * `touchstart`. If there is no `touchend` for the `touchstart`, we can\n * only receive a `touchcancel` from `pointerEventHandler_`, because it is\n * only registered there.\n */\n listen(\n this.element_,\n MapBrowserEventType.POINTERCANCEL,\n this.handlePointerUp_,\n this,\n ),\n );\n if (this.element_.getRootNode && this.element_.getRootNode() !== doc) {\n this.dragListenerKeys_.push(\n listen(\n this.element_.getRootNode(),\n MapBrowserEventType.POINTERUP,\n this.handlePointerUp_,\n this,\n ),\n );\n }\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerMove_(pointerEvent) {\n // Between pointerdown and pointerup, pointermove events are triggered.\n // To avoid a 'false' touchmove event to be dispatched, we test if the pointer\n // moved a significant distance.\n if (this.isMoving_(pointerEvent)) {\n this.updateActivePointers_(pointerEvent);\n this.dragging_ = true;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDRAG,\n this.map_,\n pointerEvent,\n this.dragging_,\n undefined,\n this.activePointers_,\n );\n this.dispatchEvent(newEvent);\n }\n }\n\n /**\n * Wrap and relay a pointermove event.\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n relayMoveEvent_(pointerEvent) {\n this.originalPointerMoveEvent_ = pointerEvent;\n const dragging = !!(this.down_ && this.isMoving_(pointerEvent));\n this.dispatchEvent(\n new MapBrowserEvent(\n MapBrowserEventType.POINTERMOVE,\n this.map_,\n pointerEvent,\n dragging,\n ),\n );\n }\n\n /**\n * Flexible handling of a `touch-action: none` css equivalent: because calling\n * `preventDefault()` on a `pointermove` event does not stop native page scrolling\n * and zooming, we also listen for `touchmove` and call `preventDefault()` on it\n * when an interaction (currently `DragPan` handles the event.\n * @param {TouchEvent} event Event.\n * @private\n */\n handleTouchMove_(event) {\n // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_`\n // may not be initialized yet when we get here on a platform without native pointer events,\n // when elm-pep is used as pointer events polyfill.\n const originalEvent = this.originalPointerMoveEvent_;\n if (\n (!originalEvent || originalEvent.defaultPrevented) &&\n (typeof event.cancelable !== 'boolean' || event.cancelable === true)\n ) {\n event.preventDefault();\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} Is moving.\n * @private\n */\n isMoving_(pointerEvent) {\n return (\n this.dragging_ ||\n Math.abs(pointerEvent.clientX - this.down_.clientX) >\n this.moveTolerance_ ||\n Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_\n );\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n if (this.relayedListenerKey_) {\n unlistenByKey(this.relayedListenerKey_);\n this.relayedListenerKey_ = null;\n }\n this.element_.removeEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n );\n\n if (this.pointerdownListenerKey_) {\n unlistenByKey(this.pointerdownListenerKey_);\n this.pointerdownListenerKey_ = null;\n }\n\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n\n this.element_ = null;\n super.disposeInternal();\n }\n}\n\nexport default MapBrowserEventHandler;\n","/**\n * @module ol/MapEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered after a map frame is rendered.\n * @event module:ol/MapEvent~MapEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered when the map starts moving.\n * @event module:ol/MapEvent~MapEvent#movestart\n * @api\n */\n MOVESTART: 'movestart',\n\n /**\n * Triggered after the map is moved.\n * @event module:ol/MapEvent~MapEvent#moveend\n * @api\n */\n MOVEEND: 'moveend',\n\n /**\n * Triggered when loading of additional map data (tiles, images, features) starts.\n * @event module:ol/MapEvent~MapEvent#loadstart\n * @api\n */\n LOADSTART: 'loadstart',\n\n /**\n * Triggered when loading of additional map data has completed.\n * @event module:ol/MapEvent~MapEvent#loadend\n * @api\n */\n LOADEND: 'loadend',\n};\n\n/***\n * @typedef {'postrender'|'movestart'|'moveend'|'loadstart'|'loadend'} Types\n */\n","/**\n * @module ol/MapProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n LAYERGROUP: 'layergroup',\n SIZE: 'size',\n TARGET: 'target',\n VIEW: 'view',\n};\n","/**\n * @module ol/structs/PriorityQueue\n */\nimport {assert} from '../asserts.js';\nimport {clear} from '../obj.js';\n\n/**\n * @type {number}\n */\nexport const DROP = Infinity;\n\n/**\n * @classdesc\n * Priority queue.\n *\n * The implementation is inspired from the Closure Library's Heap class and\n * Python's heapq module.\n *\n * See https://github.com/google/closure-library/blob/master/closure/goog/structs/heap.js\n * and https://hg.python.org/cpython/file/2.7/Lib/heapq.py.\n *\n * @template T\n */\nclass PriorityQueue {\n /**\n * @param {function(T): number} priorityFunction Priority function.\n * @param {function(T): string} keyFunction Key function.\n */\n constructor(priorityFunction, keyFunction) {\n /**\n * @type {function(T): number}\n * @private\n */\n this.priorityFunction_ = priorityFunction;\n\n /**\n * @type {function(T): string}\n * @private\n */\n this.keyFunction_ = keyFunction;\n\n /**\n * @type {Array<T>}\n * @private\n */\n this.elements_ = [];\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.priorities_ = [];\n\n /**\n * @type {!Object<string, boolean>}\n * @private\n */\n this.queuedElements_ = {};\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.elements_.length = 0;\n this.priorities_.length = 0;\n clear(this.queuedElements_);\n }\n\n /**\n * Remove and return the highest-priority element. O(log N).\n * @return {T} Element.\n */\n dequeue() {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[0];\n if (elements.length == 1) {\n elements.length = 0;\n priorities.length = 0;\n } else {\n elements[0] = /** @type {T} */ (elements.pop());\n priorities[0] = /** @type {number} */ (priorities.pop());\n this.siftUp_(0);\n }\n const elementKey = this.keyFunction_(element);\n delete this.queuedElements_[elementKey];\n return element;\n }\n\n /**\n * Enqueue an element. O(log N).\n * @param {T} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n assert(\n !(this.keyFunction_(element) in this.queuedElements_),\n 'Tried to enqueue an `element` that was already added to the queue',\n );\n const priority = this.priorityFunction_(element);\n if (priority != DROP) {\n this.elements_.push(element);\n this.priorities_.push(priority);\n this.queuedElements_[this.keyFunction_(element)] = true;\n this.siftDown_(0, this.elements_.length - 1);\n return true;\n }\n return false;\n }\n\n /**\n * @return {number} Count.\n */\n getCount() {\n return this.elements_.length;\n }\n\n /**\n * Gets the index of the left child of the node at the given index.\n * @param {number} index The index of the node to get the left child for.\n * @return {number} The index of the left child.\n * @private\n */\n getLeftChildIndex_(index) {\n return index * 2 + 1;\n }\n\n /**\n * Gets the index of the right child of the node at the given index.\n * @param {number} index The index of the node to get the right child for.\n * @return {number} The index of the right child.\n * @private\n */\n getRightChildIndex_(index) {\n return index * 2 + 2;\n }\n\n /**\n * Gets the index of the parent of the node at the given index.\n * @param {number} index The index of the node to get the parent for.\n * @return {number} The index of the parent.\n * @private\n */\n getParentIndex_(index) {\n return (index - 1) >> 1;\n }\n\n /**\n * Make this a heap. O(N).\n * @private\n */\n heapify_() {\n let i;\n for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {\n this.siftUp_(i);\n }\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.elements_.length === 0;\n }\n\n /**\n * @param {string} key Key.\n * @return {boolean} Is key queued.\n */\n isKeyQueued(key) {\n return key in this.queuedElements_;\n }\n\n /**\n * @param {T} element Element.\n * @return {boolean} Is queued.\n */\n isQueued(element) {\n return this.isKeyQueued(this.keyFunction_(element));\n }\n\n /**\n * @param {number} index The index of the node to move down.\n * @private\n */\n siftUp_(index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const count = elements.length;\n const element = elements[index];\n const priority = priorities[index];\n const startIndex = index;\n\n while (index < count >> 1) {\n const lIndex = this.getLeftChildIndex_(index);\n const rIndex = this.getRightChildIndex_(index);\n\n const smallerChildIndex =\n rIndex < count && priorities[rIndex] < priorities[lIndex]\n ? rIndex\n : lIndex;\n\n elements[index] = elements[smallerChildIndex];\n priorities[index] = priorities[smallerChildIndex];\n index = smallerChildIndex;\n }\n\n elements[index] = element;\n priorities[index] = priority;\n this.siftDown_(startIndex, index);\n }\n\n /**\n * @param {number} startIndex The index of the root.\n * @param {number} index The index of the node to move up.\n * @private\n */\n siftDown_(startIndex, index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[index];\n const priority = priorities[index];\n\n while (index > startIndex) {\n const parentIndex = this.getParentIndex_(index);\n if (priorities[parentIndex] > priority) {\n elements[index] = elements[parentIndex];\n priorities[index] = priorities[parentIndex];\n index = parentIndex;\n } else {\n break;\n }\n }\n elements[index] = element;\n priorities[index] = priority;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n reprioritize() {\n const priorityFunction = this.priorityFunction_;\n const elements = this.elements_;\n const priorities = this.priorities_;\n let index = 0;\n const n = elements.length;\n let element, i, priority;\n for (i = 0; i < n; ++i) {\n element = elements[i];\n priority = priorityFunction(element);\n if (priority == DROP) {\n delete this.queuedElements_[this.keyFunction_(element)];\n } else {\n priorities[index] = priority;\n elements[index++] = element;\n }\n }\n elements.length = index;\n priorities.length = index;\n this.heapify_();\n }\n}\n\nexport default PriorityQueue;\n","/**\n * @module ol/TileQueue\n */\nimport TileState from './TileState.js';\nimport EventType from './events/EventType.js';\nimport PriorityQueue, {DROP} from './structs/PriorityQueue.js';\n\n/**\n * @typedef {function(import(\"./Tile.js\").default, string, import('./tilecoord.js').TileCoord, number): number} PriorityFunction\n */\n\n/**\n * @typedef {[import('./Tile.js').default, string, import('./tilecoord.js').TileCoord, number]} TileQueueElement\n */\n\n/**\n * @extends PriorityQueue<TileQueueElement>}\n */\nclass TileQueue extends PriorityQueue {\n /**\n * @param {PriorityFunction} tilePriorityFunction Tile priority function.\n * @param {function(): ?} tileChangeCallback Function called on each tile change event.\n */\n constructor(tilePriorityFunction, tileChangeCallback) {\n super(\n (element) => tilePriorityFunction.apply(null, element),\n (element) => element[0].getKey(),\n );\n\n /** @private */\n this.boundHandleTileChange_ = this.handleTileChange.bind(this);\n\n /**\n * @private\n * @type {function(): ?}\n */\n this.tileChangeCallback_ = tileChangeCallback;\n\n /**\n * @private\n * @type {number}\n */\n this.tilesLoading_ = 0;\n\n /**\n * @private\n * @type {!Object<string,boolean>}\n */\n this.tilesLoadingKeys_ = {};\n }\n\n /**\n * @param {TileQueueElement} element Element.\n * @return {boolean} The element was added to the queue.\n * @override\n */\n enqueue(element) {\n const added = super.enqueue(element);\n if (added) {\n const tile = element[0];\n tile.addEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n return added;\n }\n\n /**\n * @return {number} Number of tiles loading.\n */\n getTilesLoading() {\n return this.tilesLoading_;\n }\n\n /**\n * @param {import(\"./events/Event.js\").default} event Event.\n * @protected\n */\n handleTileChange(event) {\n const tile = /** @type {import(\"./Tile.js\").default} */ (event.target);\n const state = tile.getState();\n if (\n state === TileState.LOADED ||\n state === TileState.ERROR ||\n state === TileState.EMPTY\n ) {\n if (state !== TileState.ERROR) {\n tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n const tileKey = tile.getKey();\n if (tileKey in this.tilesLoadingKeys_) {\n delete this.tilesLoadingKeys_[tileKey];\n --this.tilesLoading_;\n }\n this.tileChangeCallback_();\n }\n }\n\n /**\n * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.\n * @param {number} maxNewLoads Maximum number of new tiles to load.\n */\n loadMoreTiles(maxTotalLoading, maxNewLoads) {\n let newLoads = 0;\n while (\n this.tilesLoading_ < maxTotalLoading &&\n newLoads < maxNewLoads &&\n this.getCount() > 0\n ) {\n const tile = this.dequeue()[0];\n const tileKey = tile.getKey();\n const state = tile.getState();\n if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {\n this.tilesLoadingKeys_[tileKey] = true;\n ++this.tilesLoading_;\n ++newLoads;\n tile.load();\n }\n }\n }\n}\n\nexport default TileQueue;\n\n/**\n * @param {import('./Map.js').FrameState} frameState Frame state.\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\nexport function getTilePriority(\n frameState,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution,\n) {\n // Filter out tiles at higher zoom levels than the current zoom level, or that\n // are outside the visible extent.\n if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {\n return DROP;\n }\n if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {\n return DROP;\n }\n // Prioritize the highest zoom level tiles closest to the focus.\n // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).\n // Within a zoom level, tiles are prioritized by the distance in pixels between\n // the center of the tile and the center of the viewport. The factor of 65536\n // means that the prioritization should behave as desired for tiles up to\n // 65536 * Math.log(2) = 45426 pixels from the focus.\n const center = frameState.viewState.center;\n const deltaX = tileCenter[0] - center[0];\n const deltaY = tileCenter[1] - center[1];\n return (\n 65536 * Math.log(tileResolution) +\n Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution\n );\n}\n","/**\n * @module ol/ViewHint\n */\n\n/**\n * @enum {number}\n */\nexport default {\n ANIMATING: 0,\n INTERACTING: 1,\n};\n","/**\n * @module ol/ViewProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n CENTER: 'center',\n RESOLUTION: 'resolution',\n ROTATION: 'rotation',\n};\n","/**\n * @module ol/centerconstraint\n */\nimport {clamp} from './math.js';\n\n/**\n * @typedef {function((import(\"./coordinate.js\").Coordinate|undefined), number, import(\"./size.js\").Size, boolean=, Array<number>=): (import(\"./coordinate.js\").Coordinate|undefined)} Type\n */\n\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.\n * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent\n * (only during interaction and animation).\n * @return {Type} The constraint.\n */\nexport function createExtent(extent, onlyCenter, smooth) {\n return (\n /**\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center Center.\n * @param {number|undefined} resolution Resolution.\n * @param {import(\"./size.js\").Size} size Viewport size; unused if `onlyCenter` was specified.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @param {Array<number>} [centerShift] Shift between map center and viewport center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\n function (center, resolution, size, isMoving, centerShift) {\n if (!center) {\n return undefined;\n }\n if (!resolution && !onlyCenter) {\n return center;\n }\n const viewWidth = onlyCenter ? 0 : size[0] * resolution;\n const viewHeight = onlyCenter ? 0 : size[1] * resolution;\n const shiftX = centerShift ? centerShift[0] : 0;\n const shiftY = centerShift ? centerShift[1] : 0;\n let minX = extent[0] + viewWidth / 2 + shiftX;\n let maxX = extent[2] - viewWidth / 2 + shiftX;\n let minY = extent[1] + viewHeight / 2 + shiftY;\n let maxY = extent[3] - viewHeight / 2 + shiftY;\n\n // note: when zooming out of bounds, min and max values for x and y may\n // end up inverted (min > max); this has to be accounted for\n if (minX > maxX) {\n minX = (maxX + minX) / 2;\n maxX = minX;\n }\n if (minY > maxY) {\n minY = (maxY + minY) / 2;\n maxY = minY;\n }\n\n let x = clamp(center[0], minX, maxX);\n let y = clamp(center[1], minY, maxY);\n\n // during an interaction, allow some overscroll\n if (isMoving && smooth && resolution) {\n const ratio = 30 * resolution;\n x +=\n -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);\n y +=\n -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);\n }\n\n return [x, y];\n }\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} [center] Center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\nexport function none(center) {\n return center;\n}\n","/**\n * @module ol/resolutionconstraint\n */\nimport {linearFindNearest} from './array.js';\nimport {getHeight, getWidth} from './extent.js';\nimport {clamp} from './math.js';\n\n/**\n * @typedef {function((number|undefined), number, import(\"./size.js\").Size, boolean=): (number|undefined)} Type\n */\n\n/**\n * Returns a modified resolution taking into account the viewport size and maximum\n * allowed extent.\n * @param {number} resolution Resolution\n * @param {import(\"./extent.js\").Extent} maxExtent Maximum allowed extent.\n * @param {import(\"./size.js\").Size} viewportSize Viewport size.\n * @param {boolean} showFullExtent Whether to show the full extent.\n * @return {number} Capped resolution.\n */\nfunction getViewportClampedResolution(\n resolution,\n maxExtent,\n viewportSize,\n showFullExtent,\n) {\n const xResolution = getWidth(maxExtent) / viewportSize[0];\n const yResolution = getHeight(maxExtent) / viewportSize[1];\n\n if (showFullExtent) {\n return Math.min(resolution, Math.max(xResolution, yResolution));\n }\n return Math.min(resolution, Math.min(xResolution, yResolution));\n}\n\n/**\n * Returns a modified resolution to be between maxResolution and minResolution while\n * still allowing the value to be slightly out of bounds.\n * Note: the computation is based on the logarithm function (ln):\n * - at 1, ln(x) is 0\n * - above 1, ln(x) keeps increasing but at a much slower pace than x\n * The final result is clamped to prevent getting too far away from bounds.\n * @param {number} resolution Resolution.\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @return {number} Smoothed resolution.\n */\nfunction getSmoothClampedResolution(resolution, maxResolution, minResolution) {\n let result = Math.min(resolution, maxResolution);\n const ratio = 50;\n\n result *=\n Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio +\n 1;\n if (minResolution) {\n result = Math.max(result, minResolution);\n result /=\n Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) /\n ratio +\n 1;\n }\n return clamp(result, minResolution / 2, maxResolution * 2);\n}\n\n/**\n * @param {Array<number>} resolutions Resolutions.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToResolutions(\n resolutions,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const maxResolution = resolutions[0];\n const minResolution = resolutions[resolutions.length - 1];\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n\n const capped = Math.min(cappedMaxRes, resolution);\n const z = Math.floor(linearFindNearest(resolutions, capped, direction));\n if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {\n return resolutions[z + 1];\n }\n return resolutions[z];\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} power Power.\n * @param {number} maxResolution Maximum resolution.\n * @param {number} [minResolution] Minimum resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToPower(\n power,\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n minResolution = minResolution !== undefined ? minResolution : 0;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n\n const tolerance = 1e-9;\n const minZoomLevel = Math.ceil(\n Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance,\n );\n const offset = -direction * (0.5 - tolerance) + 0.5;\n const capped = Math.min(cappedMaxRes, resolution);\n const cappedZoomLevel = Math.floor(\n Math.log(maxResolution / capped) / Math.log(power) + offset,\n );\n const zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);\n const newResolution = maxResolution / Math.pow(power, zoomLevel);\n return clamp(newResolution, minResolution, cappedMaxRes);\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent,\n) {\n smooth = smooth !== undefined ? smooth : true;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent,\n )\n : maxResolution;\n\n if (!smooth || !isMoving) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution,\n );\n }\n return undefined;\n }\n );\n}\n","/**\n * @module ol/rotationconstraint\n */\nimport {toRadians} from './math.js';\n\n/**\n * @typedef {function((number|undefined), boolean=): (number|undefined)} Type\n */\n\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function disable(rotation) {\n if (rotation !== undefined) {\n return 0;\n }\n return undefined;\n}\n\n/**\n * @param {number|undefined} rotation Rotation.\n * @return {number|undefined} Rotation.\n */\nexport function none(rotation) {\n if (rotation !== undefined) {\n return rotation;\n }\n return undefined;\n}\n\n/**\n * @param {number} n N.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToN(n) {\n const theta = (2 * Math.PI) / n;\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, isMoving) {\n if (isMoving) {\n return rotation;\n }\n\n if (rotation !== undefined) {\n rotation = Math.floor(rotation / theta + 0.5) * theta;\n return rotation;\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} [tolerance] Tolerance.\n * @return {Type} Rotation constraint.\n */\nexport function createSnapToZero(tolerance) {\n const t = tolerance === undefined ? toRadians(5) : tolerance;\n return (\n /**\n * @param {number|undefined} rotation Rotation.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Rotation.\n */\n function (rotation, isMoving) {\n if (isMoving || rotation === undefined) {\n return rotation;\n }\n\n if (Math.abs(rotation) <= t) {\n return 0;\n }\n return rotation;\n }\n );\n}\n","/**\n * @module ol/tilegrid/common\n */\n\n/**\n * Default maximum zoom for default tile grids.\n * @type {number}\n */\nexport const DEFAULT_MAX_ZOOM = 42;\n\n/**\n * Default tile size.\n * @type {number}\n */\nexport const DEFAULT_TILE_SIZE = 256;\n","/**\n * @module ol/View\n */\nimport BaseObject from './Object.js';\nimport ViewHint from './ViewHint.js';\nimport ViewProperty from './ViewProperty.js';\nimport {linearFindNearest} from './array.js';\nimport {assert} from './asserts.js';\nimport {createExtent, none as centerNone} from './centerconstraint.js';\nimport {\n add as addCoordinate,\n equals,\n equals as coordinatesEqual,\n rotate as rotateCoordinate,\n} from './coordinate.js';\nimport {easeOut, inAndOut} from './easing.js';\nimport {\n getCenter,\n getForViewAndSize,\n getHeight,\n getWidth,\n isEmpty,\n} from './extent.js';\nimport {VOID} from './functions.js';\nimport {fromExtent as polygonFromExtent} from './geom/Polygon.js';\nimport {clamp, modulo} from './math.js';\nimport {\n METERS_PER_UNIT,\n createProjection,\n disableCoordinateWarning,\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from './proj.js';\nimport {\n createMinMaxResolution,\n createSnapToPower,\n createSnapToResolutions,\n} from './resolutionconstraint.js';\nimport {\n createSnapToN,\n createSnapToZero,\n disable,\n none as rotationNone,\n} from './rotationconstraint.js';\nimport {DEFAULT_TILE_SIZE} from './tilegrid/common.js';\n\n/**\n * An animation configuration\n *\n * @typedef {Object} Animation\n * @property {import(\"./coordinate.js\").Coordinate} [sourceCenter] Source center.\n * @property {import(\"./coordinate.js\").Coordinate} [targetCenter] Target center.\n * @property {number} [sourceResolution] Source resolution.\n * @property {number} [targetResolution] Target resolution.\n * @property {number} [sourceRotation] Source rotation.\n * @property {number} [targetRotation] Target rotation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Anchor.\n * @property {number} start Start.\n * @property {number} duration Duration.\n * @property {boolean} complete Complete.\n * @property {function(number):number} easing Easing.\n * @property {function(boolean):void} callback Callback.\n */\n\n/**\n * @typedef {Object} Constraints\n * @property {import(\"./centerconstraint.js\").Type} center Center.\n * @property {import(\"./resolutionconstraint.js\").Type} resolution Resolution.\n * @property {import(\"./rotationconstraint.js\").Type} rotation Rotation.\n */\n\n/**\n * @typedef {Object} FitOptions\n * @property {import(\"./size.js\").Size} [size] The size in pixels of the box to\n * fit the extent into. Defaults to the size of the map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired box size\n * (e.g. `map.getSize()`).\n * @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in pixels) to be\n * cleared inside the view. Values in the array are top, right, bottom and left\n * padding.\n * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,\n * get the nearest extent instead of the closest that actually fits the view.\n * @property {number} [minResolution=0] Minimum resolution that we zoom to.\n * @property {number} [maxZoom] Maximum zoom level that we zoom to. If\n * `minResolution` is given, this property is ignored.\n * @property {number} [duration] The duration of the animation in milliseconds.\n * By default, there is no animation to the target extent.\n * @property {function(number):number} [easing] The easing function used during\n * the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n * @property {function(boolean):void} [callback] Function called when the view is in\n * its final position. The callback will be called with `true` if the animation\n * series completed on its own or `false` if it was cancelled.\n */\n\n/**\n * @typedef {Object} ViewOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The initial center for\n * the view. If a user projection is not set, the coordinate system for the center is\n * specified with the `projection` option. Layer sources will not be fetched if this\n * is not set, but the center can be set later with {@link #setCenter}.\n * @property {boolean|number} [constrainRotation=true] Rotation constraint.\n * `false` means no constraint. `true` means no constraint, but snap to zero\n * near zero. A number constrains the rotation to that number of values. For\n * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.\n * @property {boolean} [enableRotation=true] Enable rotation.\n * If `false`, a rotation constraint that always sets the rotation to zero is\n * used. The `constrainRotation` option has no effect if `enableRotation` is\n * `false`.\n * @property {import(\"./extent.js\").Extent} [extent] The extent that constrains the\n * view, in other words, nothing outside of this extent can be visible on the map.\n * @property {boolean} [constrainOnlyCenter=false] If true, the extent\n * constraint will only apply to the view center and not the whole extent.\n * @property {boolean} [smoothExtentConstraint=true] If true, the extent\n * constraint will be applied smoothly, i.e. allow the view to go slightly outside\n * of the given `extent`.\n * @property {number} [maxResolution] The maximum resolution used to determine\n * the resolution constraint. It is used together with `minResolution` (or\n * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way\n * that the projection's validity extent fits in a 256x256 px tile. If the\n * projection is Spherical Mercator (the default) then `maxResolution` defaults\n * to `40075016.68557849 / 256 = 156543.03392804097`.\n * @property {number} [minResolution] The minimum resolution used to determine\n * the resolution constraint. It is used together with `maxResolution` (or\n * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29\n * zoom levels (with a factor of 2). If the projection is Spherical Mercator\n * (the default) then `minResolution` defaults to\n * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.\n * @property {number} [maxZoom=28] The maximum zoom level used to determine the\n * resolution constraint. It is used together with `minZoom` (or\n * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also\n * provided, it is given precedence over `maxZoom`.\n * @property {number} [minZoom=0] The minimum zoom level used to determine the\n * resolution constraint. It is used together with `maxZoom` (or\n * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also\n * provided, it is given precedence over `minZoom`.\n * @property {boolean} [multiWorld=false] If `false` the view is constrained so\n * only one world is visible, and you cannot pan off the edge. If `true` the map\n * may show multiple worlds at low zoom levels. Only used if the `projection` is\n * global. Note that if `extent` is also provided it is given precedence.\n * @property {boolean} [constrainResolution=false] If true, the view will always\n * animate to the closest zoom level after an interaction; false means\n * intermediary zoom levels are allowed.\n * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution\n * min/max values will be applied smoothly, i. e. allow the view to exceed slightly\n * the given resolution or zoom bounds.\n * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to\n * show the full configured extent. By default, when a view is configured with an\n * extent, users will not be able to zoom out so the viewport exceeds the extent in\n * either dimension. This means the full extent may not be visible if the viewport\n * is taller or wider than the aspect ratio of the configured extent. If\n * showFullExtent is true, the user will be able to zoom out so that the viewport\n * exceeds the height or width of the configured extent, but not both, allowing the\n * full extent to be shown.\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857'] The\n * projection. The default is Spherical Mercator.\n * @property {number} [resolution] The initial resolution for the view. The\n * units are `projection` units per pixel (e.g. meters per pixel). An\n * alternative to setting this is to set `zoom`. Layer sources will not be\n * fetched if neither this nor `zoom` are defined, but they can be set later\n * with {@link #setZoom} or {@link #setResolution}.\n * @property {Array<number>} [resolutions] Resolutions that determine the\n * zoom levels if specified. The index in the array corresponds to the zoom level,\n * therefore the resolution values have to be in descending order. It also constrains\n * the resolution by the minimum and maximum value. If set the `maxResolution`,\n * `minResolution`, `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.\n * @property {number} [rotation=0] The initial rotation for the view in radians\n * (positive rotation clockwise, 0 means North).\n * @property {number} [zoom] Only used if `resolution` is not defined. Zoom\n * level used to calculate the initial resolution for the view.\n * @property {number} [zoomFactor=2] The zoom factor used to compute the\n * corresponding resolution.\n * @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from\n * that content. The order of the values is top, right, bottom, left.\n */\n\n/**\n * @typedef {Object} AnimationOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The center of the view at the end of\n * the animation.\n * @property {number} [zoom] The zoom level of the view at the end of the\n * animation. This takes precedence over `resolution`.\n * @property {number} [resolution] The resolution of the view at the end\n * of the animation. If `zoom` is also provided, this option will be ignored.\n * @property {number} [rotation] The rotation of the view at the end of\n * the animation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Optional anchor to remain fixed\n * during a rotation or resolution animation.\n * @property {number} [duration=1000] The duration of the animation in milliseconds.\n * @property {function(number):number} [easing] The easing function used\n * during the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./coordinate.js\").Coordinate} center Center (in view projection coordinates).\n * @property {import(\"./proj/Projection.js\").default} projection Projection.\n * @property {number} resolution Resolution.\n * @property {import(\"./coordinate.js\").Coordinate} [nextCenter] The next center during an animation series.\n * @property {number} [nextResolution] The next resolution during an animation series.\n * @property {number} [nextRotation] The next rotation during an animation series.\n * @property {number} rotation Rotation.\n * @property {number} zoom Zoom.\n */\n\n/**\n * Like {@link import(\"./Map.js\").FrameState}, but just `viewState` and `extent`.\n * @typedef {Object} ViewStateLayerStateExtent\n * @property {State} viewState View state.\n * @property {import(\"./extent.js\").Extent} extent Extent (in user projection coordinates).\n * @property {Array<import(\"./layer/Layer.js\").State>} [layerStatesArray] Layer states.\n */\n\n/**\n * Default min zoom level for the map view.\n * @type {number}\n */\nconst DEFAULT_MIN_ZOOM = 0;\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:center'|'change:resolution'|'change:rotation'} ViewObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<ViewObjectEventTypes, import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|ViewObjectEventTypes, Return>} ViewOnSignature\n */\n\n/**\n * @classdesc\n * A View object represents a simple 2D view of the map.\n *\n * This is the object to act upon to change the center, resolution,\n * and rotation of the map.\n *\n * A View has a `projection`. The projection determines the\n * coordinate system of the center, and its units determine the units of the\n * resolution (projection units per pixel). The default projection is\n * Web Mercator (EPSG:3857).\n *\n * ### The view states\n *\n * A View is determined by three states: `center`, `resolution`,\n * and `rotation`. Each state has a corresponding getter and setter, e.g.\n * `getCenter` and `setCenter` for the `center` state.\n *\n * The `zoom` state is actually not saved on the view: all computations\n * internally use the `resolution` state. Still, the `setZoom` and `getZoom`\n * methods are available, as well as `getResolutionForZoom` and\n * `getZoomForResolution` to switch from one system to the other.\n *\n * ### The constraints\n *\n * `setCenter`, `setResolution` and `setRotation` can be used to change the\n * states of the view, but any constraint defined in the constructor will\n * be applied along the way.\n *\n * A View object can have a *resolution constraint*, a *rotation constraint*\n * and a *center constraint*.\n *\n * The *resolution constraint* typically restricts min/max values and\n * snaps to specific resolutions. It is determined by the following\n * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.\n * If `resolutions` is set, the other three options are ignored. See\n * documentation for each option for more information. By default, the view\n * only has a min/max restriction and allow intermediary zoom levels when\n * pinch-zooming for example.\n *\n * The *rotation constraint* snaps to specific angles. It is determined\n * by the following options: `enableRotation` and `constrainRotation`.\n * By default rotation is allowed and its value is snapped to zero when approaching the\n * horizontal.\n *\n * The *center constraint* is determined by the `extent` option. By\n * default the view center is not constrained at all.\n *\n * ### Changing the view state\n *\n * It is important to note that `setZoom`, `setResolution`, `setCenter` and\n * `setRotation` are subject to the above mentioned constraints. As such, it\n * may sometimes not be possible to know in advance the resulting state of the\n * View. For example, calling `setResolution(10)` does not guarantee that\n * `getResolution()` will return `10`.\n *\n * A consequence of this is that, when applying a delta on the view state, one\n * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`\n * rather than the corresponding setters. This will let view do its internal\n * computations. Besides, the `adjust*` methods also take an `anchor`\n * argument which allows specifying an origin for the transformation.\n *\n * ### Interacting with the view\n *\n * View constraints are usually only applied when the view is *at rest*, meaning that\n * no interaction or animation is ongoing. As such, if the user puts the view in a\n * state that is not equivalent to a constrained one (e.g. rotating the view when\n * the snap angle is 0), an animation will be triggered at the interaction end to\n * put back the view to a stable state;\n *\n * @api\n */\nclass View extends BaseObject {\n /**\n * @param {ViewOptions} [options] View options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {ViewOnSignature<import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ViewOnSignature<import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ViewOnSignature<void>}\n */\n this.un;\n\n options = Object.assign({}, options);\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.hints_ = [0, 0];\n\n /**\n * @private\n * @type {Array<Array<Animation>>}\n */\n this.animations_ = [];\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.updateAnimationKey_;\n\n /**\n * @private\n * @const\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection_ = createProjection(options.projection, 'EPSG:3857');\n\n /**\n * @private\n * @type {import(\"./size.js\").Size}\n */\n this.viewportSize_ = [100, 100];\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.targetCenter_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetResolution_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate}\n */\n this.nextCenter_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.nextResolution_;\n\n /**\n * @private\n * @type {number}\n */\n this.nextRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.cancelAnchor_ = undefined;\n\n if (options.projection) {\n disableCoordinateWarning();\n }\n if (options.center) {\n options.center = fromUserCoordinate(options.center, this.projection_);\n }\n if (options.extent) {\n options.extent = fromUserExtent(options.extent, this.projection_);\n }\n\n this.applyOptions_(options);\n }\n\n /**\n * Set up the view with the given options.\n * @param {ViewOptions} options View options.\n */\n applyOptions_(options) {\n const properties = Object.assign({}, options);\n for (const key in ViewProperty) {\n delete properties[key];\n }\n this.setProperties(properties, true);\n\n const resolutionConstraintInfo = createResolutionConstraint(options);\n\n /**\n * @private\n * @type {number}\n */\n this.maxResolution_ = resolutionConstraintInfo.maxResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.minResolution_ = resolutionConstraintInfo.minResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;\n\n /**\n * @private\n * @type {Array<number>|undefined}\n */\n this.resolutions_ = options.resolutions;\n\n /**\n * @type {Array<number>|undefined}\n * @private\n */\n this.padding_ = options.padding;\n\n /**\n * @private\n * @type {number}\n */\n this.minZoom_ = resolutionConstraintInfo.minZoom;\n\n const centerConstraint = createCenterConstraint(options);\n const resolutionConstraint = resolutionConstraintInfo.constraint;\n const rotationConstraint = createRotationConstraint(options);\n\n /**\n * @private\n * @type {Constraints}\n */\n this.constraints_ = {\n center: centerConstraint,\n resolution: resolutionConstraint,\n rotation: rotationConstraint,\n };\n\n this.setRotation(options.rotation !== undefined ? options.rotation : 0);\n this.setCenterInternal(\n options.center !== undefined ? options.center : null,\n );\n if (options.resolution !== undefined) {\n this.setResolution(options.resolution);\n } else if (options.zoom !== undefined) {\n this.setZoom(options.zoom);\n }\n }\n\n /**\n * Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from that\n * content. The order of the values in the array is top, right, bottom, left.\n * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.\n * @type {Array<number>|undefined}\n * @api\n */\n get padding() {\n return this.padding_;\n }\n set padding(padding) {\n let oldPadding = this.padding_;\n this.padding_ = padding;\n const center = this.getCenterInternal();\n if (center) {\n const newPadding = padding || [0, 0, 0, 0];\n oldPadding = oldPadding || [0, 0, 0, 0];\n const resolution = this.getResolution();\n const offsetX =\n (resolution / 2) *\n (newPadding[3] - oldPadding[3] + oldPadding[1] - newPadding[1]);\n const offsetY =\n (resolution / 2) *\n (newPadding[0] - oldPadding[0] + oldPadding[2] - newPadding[2]);\n this.setCenterInternal([center[0] + offsetX, center[1] - offsetY]);\n }\n }\n\n /**\n * Get an updated version of the view options used to construct the view. The\n * current resolution (or zoom), center, and rotation are applied to any stored\n * options. The provided options can be used to apply new min/max zoom or\n * resolution limits.\n * @param {ViewOptions} newOptions New options to be applied.\n * @return {ViewOptions} New options updated with the current view state.\n */\n getUpdatedOptions_(newOptions) {\n const options = this.getProperties();\n\n // preserve resolution (or zoom)\n if (options.resolution !== undefined) {\n options.resolution = this.getResolution();\n } else {\n options.zoom = this.getZoom();\n }\n\n // preserve center\n options.center = this.getCenterInternal();\n\n // preserve rotation\n options.rotation = this.getRotation();\n\n return Object.assign({}, options, newOptions);\n }\n\n /**\n * Animate the view. The view's center, zoom (or resolution), and rotation\n * can be animated for smooth transitions between view states. For example,\n * to animate the view to a new zoom level:\n *\n * view.animate({zoom: view.getZoom() + 1});\n *\n * By default, the animation lasts one second and uses in-and-out easing. You\n * can customize this behavior by including `duration` (in milliseconds) and\n * `easing` options (see {@link module:ol/easing}).\n *\n * To chain together multiple animations, call the method with multiple\n * animation objects. For example, to first zoom and then pan:\n *\n * view.animate({zoom: 10}, {center: [0, 0]});\n *\n * If you provide a function as the last argument to the animate method, it\n * will get called at the end of an animation series. The callback will be\n * called with `true` if the animation series completed on its own or `false`\n * if it was cancelled.\n *\n * Animations are cancelled by user interactions (e.g. dragging the map) or by\n * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`\n * (or another method that calls one of these).\n *\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation\n * options. Multiple animations can be run in series by passing multiple\n * options objects. To run multiple animations in parallel, call the method\n * multiple times. An optional callback can be provided as a final\n * argument. The callback will be called with a boolean indicating whether\n * the animation completed without being cancelled.\n * @api\n */\n animate(var_args) {\n if (this.isDef() && !this.getAnimating()) {\n this.resolveConstraints(0);\n }\n const args = new Array(arguments.length);\n for (let i = 0; i < args.length; ++i) {\n let options = arguments[i];\n if (options.center) {\n options = Object.assign({}, options);\n options.center = fromUserCoordinate(\n options.center,\n this.getProjection(),\n );\n }\n if (options.anchor) {\n options = Object.assign({}, options);\n options.anchor = fromUserCoordinate(\n options.anchor,\n this.getProjection(),\n );\n }\n args[i] = options;\n }\n this.animateInternal.apply(this, args);\n }\n\n /**\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.\n */\n animateInternal(var_args) {\n let animationCount = arguments.length;\n let callback;\n if (\n animationCount > 1 &&\n typeof arguments[animationCount - 1] === 'function'\n ) {\n callback = arguments[animationCount - 1];\n --animationCount;\n }\n\n let i = 0;\n for (; i < animationCount && !this.isDef(); ++i) {\n // if view properties are not yet set, shortcut to the final state\n const state = arguments[i];\n if (state.center) {\n this.setCenterInternal(state.center);\n }\n if (state.zoom !== undefined) {\n this.setZoom(state.zoom);\n } else if (state.resolution) {\n this.setResolution(state.resolution);\n }\n if (state.rotation !== undefined) {\n this.setRotation(state.rotation);\n }\n }\n if (i === animationCount) {\n if (callback) {\n animationCallback(callback, true);\n }\n return;\n }\n\n let start = Date.now();\n let center = this.targetCenter_.slice();\n let resolution = this.targetResolution_;\n let rotation = this.targetRotation_;\n const series = [];\n for (; i < animationCount; ++i) {\n const options = /** @type {AnimationOptions} */ (arguments[i]);\n\n const animation = {\n start: start,\n complete: false,\n anchor: options.anchor,\n duration: options.duration !== undefined ? options.duration : 1000,\n easing: options.easing || inAndOut,\n callback: callback,\n };\n\n if (options.center) {\n animation.sourceCenter = center;\n animation.targetCenter = options.center.slice();\n center = animation.targetCenter;\n }\n\n if (options.zoom !== undefined) {\n animation.sourceResolution = resolution;\n animation.targetResolution = this.getResolutionForZoom(options.zoom);\n resolution = animation.targetResolution;\n } else if (options.resolution) {\n animation.sourceResolution = resolution;\n animation.targetResolution = options.resolution;\n resolution = animation.targetResolution;\n }\n\n if (options.rotation !== undefined) {\n animation.sourceRotation = rotation;\n const delta =\n modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;\n animation.targetRotation = rotation + delta;\n rotation = animation.targetRotation;\n }\n\n // check if animation is a no-op\n if (isNoopAnimation(animation)) {\n animation.complete = true;\n // we still push it onto the series for callback handling\n } else {\n start += animation.duration;\n }\n series.push(animation);\n }\n this.animations_.push(series);\n this.setHint(ViewHint.ANIMATING, 1);\n this.updateAnimations_();\n }\n\n /**\n * Determine if the view is being animated.\n * @return {boolean} The view is being animated.\n * @api\n */\n getAnimating() {\n return this.hints_[ViewHint.ANIMATING] > 0;\n }\n\n /**\n * Determine if the user is interacting with the view, such as panning or zooming.\n * @return {boolean} The view is being interacted with.\n * @api\n */\n getInteracting() {\n return this.hints_[ViewHint.INTERACTING] > 0;\n }\n\n /**\n * Cancel any ongoing animations.\n * @api\n */\n cancelAnimations() {\n this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);\n let anchor;\n for (let i = 0, ii = this.animations_.length; i < ii; ++i) {\n const series = this.animations_[i];\n if (series[0].callback) {\n animationCallback(series[0].callback, false);\n }\n if (!anchor) {\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (!animation.complete) {\n anchor = animation.anchor;\n break;\n }\n }\n }\n }\n this.animations_.length = 0;\n this.cancelAnchor_ = anchor;\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n }\n\n /**\n * Update all animations.\n */\n updateAnimations_() {\n if (this.updateAnimationKey_ !== undefined) {\n cancelAnimationFrame(this.updateAnimationKey_);\n this.updateAnimationKey_ = undefined;\n }\n if (!this.getAnimating()) {\n return;\n }\n const now = Date.now();\n let more = false;\n for (let i = this.animations_.length - 1; i >= 0; --i) {\n const series = this.animations_[i];\n let seriesComplete = true;\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (animation.complete) {\n continue;\n }\n const elapsed = now - animation.start;\n let fraction =\n animation.duration > 0 ? elapsed / animation.duration : 1;\n if (fraction >= 1) {\n animation.complete = true;\n fraction = 1;\n } else {\n seriesComplete = false;\n }\n const progress = animation.easing(fraction);\n if (animation.sourceCenter) {\n const x0 = animation.sourceCenter[0];\n const y0 = animation.sourceCenter[1];\n const x1 = animation.targetCenter[0];\n const y1 = animation.targetCenter[1];\n this.nextCenter_ = animation.targetCenter;\n const x = x0 + progress * (x1 - x0);\n const y = y0 + progress * (y1 - y0);\n this.targetCenter_ = [x, y];\n }\n if (animation.sourceResolution && animation.targetResolution) {\n const resolution =\n progress === 1\n ? animation.targetResolution\n : animation.sourceResolution +\n progress *\n (animation.targetResolution - animation.sourceResolution);\n if (animation.anchor) {\n const size = this.getViewportSize_(this.getRotation());\n const constrainedResolution = this.constraints_.resolution(\n resolution,\n 0,\n size,\n true,\n );\n this.targetCenter_ = this.calculateCenterZoom(\n constrainedResolution,\n animation.anchor,\n );\n }\n this.nextResolution_ = animation.targetResolution;\n this.targetResolution_ = resolution;\n this.applyTargetState_(true);\n }\n if (\n animation.sourceRotation !== undefined &&\n animation.targetRotation !== undefined\n ) {\n const rotation =\n progress === 1\n ? modulo(animation.targetRotation + Math.PI, 2 * Math.PI) -\n Math.PI\n : animation.sourceRotation +\n progress *\n (animation.targetRotation - animation.sourceRotation);\n if (animation.anchor) {\n const constrainedRotation = this.constraints_.rotation(\n rotation,\n true,\n );\n this.targetCenter_ = this.calculateCenterRotate(\n constrainedRotation,\n animation.anchor,\n );\n }\n this.nextRotation_ = animation.targetRotation;\n this.targetRotation_ = rotation;\n }\n this.applyTargetState_(true);\n more = true;\n if (!animation.complete) {\n break;\n }\n }\n if (seriesComplete) {\n this.animations_[i] = null;\n this.setHint(ViewHint.ANIMATING, -1);\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n const callback = series[0].callback;\n if (callback) {\n animationCallback(callback, true);\n }\n }\n }\n // prune completed series\n this.animations_ = this.animations_.filter(Boolean);\n if (more && this.updateAnimationKey_ === undefined) {\n this.updateAnimationKey_ = requestAnimationFrame(\n this.updateAnimations_.bind(this),\n );\n }\n }\n\n /**\n * @param {number} rotation Target rotation.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Rotation anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for rotation and anchor.\n */\n calculateCenterRotate(rotation, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n if (currentCenter !== undefined) {\n center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];\n rotateCoordinate(center, rotation - this.getRotation());\n addCoordinate(center, anchor);\n }\n return center;\n }\n\n /**\n * @param {number} resolution Target resolution.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Zoom anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for resolution and anchor.\n */\n calculateCenterZoom(resolution, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n const currentResolution = this.getResolution();\n if (currentCenter !== undefined && currentResolution !== undefined) {\n const x =\n anchor[0] -\n (resolution * (anchor[0] - currentCenter[0])) / currentResolution;\n const y =\n anchor[1] -\n (resolution * (anchor[1] - currentCenter[1])) / currentResolution;\n center = [x, y];\n }\n return center;\n }\n\n /**\n * Returns the current viewport size.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size or `[100, 100]` when no viewport is found.\n */\n getViewportSize_(rotation) {\n const size = this.viewportSize_;\n if (rotation) {\n const w = size[0];\n const h = size[1];\n return [\n Math.abs(w * Math.cos(rotation)) + Math.abs(h * Math.sin(rotation)),\n Math.abs(w * Math.sin(rotation)) + Math.abs(h * Math.cos(rotation)),\n ];\n }\n return size;\n }\n\n /**\n * Stores the viewport size on the view. The viewport size is not read every time from the DOM\n * to avoid performance hit and layout reflow.\n * This should be done on map size change.\n * Note: the constraints are not resolved during an animation to avoid stopping it\n * @param {import(\"./size.js\").Size} [size] Viewport size; if undefined, [100, 100] is assumed\n */\n setViewportSize(size) {\n this.viewportSize_ = Array.isArray(size) ? size.slice() : [100, 100];\n if (!this.getAnimating()) {\n this.resolveConstraints(0);\n }\n }\n\n /**\n * Get the view center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n * @observable\n * @api\n */\n getCenter() {\n const center = this.getCenterInternal();\n if (!center) {\n return center;\n }\n return toUserCoordinate(center, this.getProjection());\n }\n\n /**\n * Get the view center without transforming to user projection.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n */\n getCenterInternal() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(ViewProperty.CENTER)\n );\n }\n\n /**\n * @return {Constraints} Constraints.\n */\n getConstraints() {\n return this.constraints_;\n }\n\n /**\n * @return {boolean} Resolution constraint is set\n */\n getConstrainResolution() {\n return this.get('constrainResolution');\n }\n\n /**\n * @param {Array<number>} [hints] Destination array.\n * @return {Array<number>} Hint.\n */\n getHints(hints) {\n if (hints !== undefined) {\n hints[0] = this.hints_[0];\n hints[1] = this.hints_[1];\n return hints;\n }\n return this.hints_.slice();\n }\n\n /**\n * Calculate the extent for the current view state and the passed box size.\n * @param {import(\"./size.js\").Size} [size] The pixel dimensions of the box\n * into which the calculated extent should fit. Defaults to the size of the\n * map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired\n * box size (e.g. `map.getSize()`).\n * @return {import(\"./extent.js\").Extent} Extent.\n * @api\n */\n calculateExtent(size) {\n const extent = this.calculateExtentInternal(size);\n return toUserExtent(extent, this.getProjection());\n }\n\n /**\n * @param {import(\"./size.js\").Size} [size] Box pixel size. If not provided,\n * the map's last known viewport size will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n calculateExtentInternal(size) {\n size = size || this.getViewportSizeMinusPadding_();\n const center = /** @type {!import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n assert(center, 'The view center is not defined');\n const resolution = /** @type {!number} */ (this.getResolution());\n assert(resolution !== undefined, 'The view resolution is not defined');\n const rotation = /** @type {!number} */ (this.getRotation());\n assert(rotation !== undefined, 'The view rotation is not defined');\n\n return getForViewAndSize(center, resolution, rotation, size);\n }\n\n /**\n * Get the maximum resolution of the view.\n * @return {number} The maximum resolution of the view.\n * @api\n */\n getMaxResolution() {\n return this.maxResolution_;\n }\n\n /**\n * Get the minimum resolution of the view.\n * @return {number} The minimum resolution of the view.\n * @api\n */\n getMinResolution() {\n return this.minResolution_;\n }\n\n /**\n * Get the maximum zoom level for the view.\n * @return {number} The maximum zoom level.\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.minResolution_)\n );\n }\n\n /**\n * Set a new maximum zoom level for the view.\n * @param {number} zoom The maximum zoom level.\n * @api\n */\n setMaxZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom}));\n }\n\n /**\n * Get the minimum zoom level for the view.\n * @return {number} The minimum zoom level.\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.maxResolution_)\n );\n }\n\n /**\n * Set a new minimum zoom level for the view.\n * @param {number} zoom The minimum zoom level.\n * @api\n */\n setMinZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom}));\n }\n\n /**\n * Set whether the view should allow intermediary zoom levels.\n * @param {boolean} enabled Whether the resolution is constrained.\n * @api\n */\n setConstrainResolution(enabled) {\n this.applyOptions_(this.getUpdatedOptions_({constrainResolution: enabled}));\n }\n\n /**\n * Get the view projection.\n * @return {import(\"./proj/Projection.js\").default} The projection of the view.\n * @api\n */\n getProjection() {\n return this.projection_;\n }\n\n /**\n * Get the view resolution.\n * @return {number|undefined} The resolution of the view.\n * @observable\n * @api\n */\n getResolution() {\n return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));\n }\n\n /**\n * Get the resolutions for the view. This returns the array of resolutions\n * passed to the constructor of the View, or undefined if none were given.\n * @return {Array<number>|undefined} The resolutions of the view.\n * @api\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n * @api\n */\n getResolutionForExtent(extent, size) {\n return this.getResolutionForExtentInternal(\n fromUserExtent(extent, this.getProjection()),\n size,\n );\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n */\n getResolutionForExtentInternal(extent, size) {\n size = size || this.getViewportSizeMinusPadding_();\n const xResolution = getWidth(extent) / size[0];\n const yResolution = getHeight(extent) / size[1];\n return Math.max(xResolution, yResolution);\n }\n\n /**\n * Return a function that returns a value between 0 and 1 for a\n * resolution. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Resolution for value function.\n */\n getResolutionForValueFunction(power) {\n power = power || 2;\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / Math.log(power);\n return (\n /**\n * @param {number} value Value.\n * @return {number} Resolution.\n */\n function (value) {\n const resolution = maxResolution / Math.pow(power, value * max);\n return resolution;\n }\n );\n }\n\n /**\n * Get the view rotation.\n * @return {number} The rotation of the view in radians.\n * @observable\n * @api\n */\n getRotation() {\n return /** @type {number} */ (this.get(ViewProperty.ROTATION));\n }\n\n /**\n * Return a function that returns a resolution for a value between\n * 0 and 1. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Value for resolution function.\n */\n getValueForResolutionFunction(power) {\n const logPower = Math.log(power || 2);\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / logPower;\n return (\n /**\n * @param {number} resolution Resolution.\n * @return {number} Value.\n */\n function (resolution) {\n const value = Math.log(maxResolution / resolution) / logPower / max;\n return value;\n }\n );\n }\n\n /**\n * Returns the size of the viewport minus padding.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size reduced by the padding.\n */\n getViewportSizeMinusPadding_(rotation) {\n let size = this.getViewportSize_(rotation);\n const padding = this.padding_;\n if (padding) {\n size = [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ];\n }\n return size;\n }\n\n /**\n * @return {State} View state.\n */\n getState() {\n const projection = this.getProjection();\n const resolution = this.getResolution();\n const rotation = this.getRotation();\n let center = /** @type {import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n const padding = this.padding_;\n if (padding) {\n const reducedSize = this.getViewportSizeMinusPadding_();\n center = calculateCenterOn(\n center,\n this.getViewportSize_(),\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation,\n );\n }\n return {\n center: center.slice(0),\n projection: projection !== undefined ? projection : null,\n resolution: resolution,\n nextCenter: this.nextCenter_,\n nextResolution: this.nextResolution_,\n nextRotation: this.nextRotation_,\n rotation: rotation,\n zoom: this.getZoom(),\n };\n }\n\n /**\n * @return {ViewStateLayerStateExtent} Like `FrameState`, but just `viewState` and `extent`.\n */\n getViewStateAndExtent() {\n return {\n viewState: this.getState(),\n extent: this.calculateExtent(),\n };\n }\n\n /**\n * Get the current zoom level. This method may return non-integer zoom levels\n * if the view does not constrain the resolution, or if an interaction or\n * animation is underway.\n * @return {number|undefined} Zoom.\n * @api\n */\n getZoom() {\n let zoom;\n const resolution = this.getResolution();\n if (resolution !== undefined) {\n zoom = this.getZoomForResolution(resolution);\n }\n return zoom;\n }\n\n /**\n * Get the zoom level for a resolution.\n * @param {number} resolution The resolution.\n * @return {number|undefined} The zoom level for the provided resolution.\n * @api\n */\n getZoomForResolution(resolution) {\n let offset = this.minZoom_ || 0;\n let max, zoomFactor;\n if (this.resolutions_) {\n const nearest = linearFindNearest(this.resolutions_, resolution, 1);\n offset = nearest;\n max = this.resolutions_[nearest];\n if (nearest == this.resolutions_.length - 1) {\n zoomFactor = 2;\n } else {\n zoomFactor = max / this.resolutions_[nearest + 1];\n }\n } else {\n max = this.maxResolution_;\n zoomFactor = this.zoomFactor_;\n }\n return offset + Math.log(max / resolution) / Math.log(zoomFactor);\n }\n\n /**\n * Get the resolution for a zoom level.\n * @param {number} zoom Zoom level.\n * @return {number} The view resolution for the provided zoom level.\n * @api\n */\n getResolutionForZoom(zoom) {\n if (this.resolutions_?.length) {\n if (this.resolutions_.length === 1) {\n return this.resolutions_[0];\n }\n const baseLevel = clamp(\n Math.floor(zoom),\n 0,\n this.resolutions_.length - 2,\n );\n const zoomFactor =\n this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];\n return (\n this.resolutions_[baseLevel] /\n Math.pow(zoomFactor, clamp(zoom - baseLevel, 0, 1))\n );\n }\n return (\n this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_)\n );\n }\n\n /**\n * Fit the given geometry or extent based on the given map size and border.\n * The size is pixel dimensions of the box to fit the extent into.\n * In most cases you will want to use the map size, that is `map.getSize()`.\n * Takes care of the map angle.\n * @param {import(\"./geom/SimpleGeometry.js\").default|import(\"./extent.js\").Extent} geometryOrExtent The geometry or\n * extent to fit the view to.\n * @param {FitOptions} [options] Options.\n * @api\n */\n fit(geometryOrExtent, options) {\n /** @type {import(\"./geom/SimpleGeometry.js\").default} */\n let geometry;\n assert(\n Array.isArray(geometryOrExtent) ||\n typeof (/** @type {?} */ (geometryOrExtent).getSimplifiedGeometry) ===\n 'function',\n 'Invalid extent or geometry provided as `geometry`',\n );\n if (Array.isArray(geometryOrExtent)) {\n assert(\n !isEmpty(geometryOrExtent),\n 'Cannot fit empty extent provided as `geometry`',\n );\n const extent = fromUserExtent(geometryOrExtent, this.getProjection());\n geometry = polygonFromExtent(extent);\n } else if (geometryOrExtent.getType() === 'Circle') {\n const extent = fromUserExtent(\n geometryOrExtent.getExtent(),\n this.getProjection(),\n );\n geometry = polygonFromExtent(extent);\n geometry.rotate(this.getRotation(), getCenter(extent));\n } else {\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometryOrExtent\n .clone()\n .transform(userProjection, this.getProjection())\n );\n } else {\n geometry = geometryOrExtent;\n }\n }\n\n this.fitInternal(geometry, options);\n }\n\n /**\n * Calculate rotated extent\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @return {import(\"./extent\").Extent} The rotated extent for the geometry.\n */\n rotatedExtentForGeometry(geometry) {\n const rotation = this.getRotation();\n const cosAngle = Math.cos(rotation);\n const sinAngle = Math.sin(-rotation);\n const coords = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n let minRotX = +Infinity;\n let minRotY = +Infinity;\n let maxRotX = -Infinity;\n let maxRotY = -Infinity;\n for (let i = 0, ii = coords.length; i < ii; i += stride) {\n const rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;\n const rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;\n minRotX = Math.min(minRotX, rotX);\n minRotY = Math.min(minRotY, rotY);\n maxRotX = Math.max(maxRotX, rotX);\n maxRotY = Math.max(maxRotY, rotY);\n }\n return [minRotX, minRotY, maxRotX, maxRotY];\n }\n\n /**\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @param {FitOptions} [options] Options.\n */\n fitInternal(geometry, options) {\n options = options || {};\n let size = options.size;\n if (!size) {\n size = this.getViewportSizeMinusPadding_();\n }\n const padding =\n options.padding !== undefined ? options.padding : [0, 0, 0, 0];\n const nearest = options.nearest !== undefined ? options.nearest : false;\n let minResolution;\n if (options.minResolution !== undefined) {\n minResolution = options.minResolution;\n } else if (options.maxZoom !== undefined) {\n minResolution = this.getResolutionForZoom(options.maxZoom);\n } else {\n minResolution = 0;\n }\n\n const rotatedExtent = this.rotatedExtentForGeometry(geometry);\n\n // calculate resolution\n let resolution = this.getResolutionForExtentInternal(rotatedExtent, [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ]);\n resolution = isNaN(resolution)\n ? minResolution\n : Math.max(resolution, minResolution);\n resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);\n\n // calculate center\n const rotation = this.getRotation();\n const sinAngle = Math.sin(rotation);\n const cosAngle = Math.cos(rotation);\n const centerRot = getCenter(rotatedExtent);\n centerRot[0] += ((padding[1] - padding[3]) / 2) * resolution;\n centerRot[1] += ((padding[0] - padding[2]) / 2) * resolution;\n const centerX = centerRot[0] * cosAngle - centerRot[1] * sinAngle;\n const centerY = centerRot[1] * cosAngle + centerRot[0] * sinAngle;\n const center = this.getConstrainedCenter([centerX, centerY], resolution);\n const callback = options.callback ? options.callback : VOID;\n\n if (options.duration !== undefined) {\n this.animateInternal(\n {\n resolution: resolution,\n center: center,\n duration: options.duration,\n easing: options.easing,\n },\n callback,\n );\n } else {\n this.targetResolution_ = resolution;\n this.targetCenter_ = center;\n this.applyTargetState_(false, true);\n animationCallback(callback, true);\n }\n }\n\n /**\n * Center on coordinate and view position.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @api\n */\n centerOn(coordinate, size, position) {\n this.centerOnInternal(\n fromUserCoordinate(coordinate, this.getProjection()),\n size,\n position,\n );\n }\n\n /**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n */\n centerOnInternal(coordinate, size, position) {\n this.setCenterInternal(\n calculateCenterOn(\n coordinate,\n size,\n position,\n this.getResolution(),\n this.getRotation(),\n ),\n );\n }\n\n /**\n * Calculates the shift between map and viewport center.\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array<number>|undefined} Center shift.\n */\n calculateCenterShift(center, resolution, rotation, size) {\n let centerShift;\n const padding = this.padding_;\n if (padding && center) {\n const reducedSize = this.getViewportSizeMinusPadding_(-rotation);\n const shiftedCenter = calculateCenterOn(\n center,\n size,\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation,\n );\n centerShift = [\n center[0] - shiftedCenter[0],\n center[1] - shiftedCenter[1],\n ];\n }\n return centerShift;\n }\n\n /**\n * @return {boolean} Is defined.\n */\n isDef() {\n return !!this.getCenterInternal() && this.getResolution() !== undefined;\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n * @api\n */\n adjustCenter(deltaCoordinates) {\n const center = toUserCoordinate(this.targetCenter_, this.getProjection());\n this.setCenter([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n */\n adjustCenterInternal(deltaCoordinates) {\n const center = this.targetCenter_;\n this.setCenterInternal([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustResolution(ratio, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.adjustResolutionInternal(ratio, anchor);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n adjustResolutionInternal(ratio, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const size = this.getViewportSize_(this.getRotation());\n const newResolution = this.constraints_.resolution(\n this.targetResolution_ * ratio,\n 0,\n size,\n isMoving,\n );\n\n if (anchor) {\n this.targetCenter_ = this.calculateCenterZoom(newResolution, anchor);\n }\n\n this.targetResolution_ *= ratio;\n this.applyTargetState_();\n }\n\n /**\n * Adds a value to the view zoom level, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom level.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustZoom(delta, anchor) {\n this.adjustResolution(Math.pow(this.zoomFactor_, -delta), anchor);\n }\n\n /**\n * Adds a value to the view rotation, optionally using an anchor. Any rotation\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n * @api\n */\n adjustRotation(delta, anchor) {\n if (anchor) {\n anchor = fromUserCoordinate(anchor, this.getProjection());\n }\n this.adjustRotationInternal(delta, anchor);\n }\n\n /**\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n */\n adjustRotationInternal(delta, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const newRotation = this.constraints_.rotation(\n this.targetRotation_ + delta,\n isMoving,\n );\n if (anchor) {\n this.targetCenter_ = this.calculateCenterRotate(newRotation, anchor);\n }\n this.targetRotation_ += delta;\n this.applyTargetState_();\n }\n\n /**\n * Set the center of the current view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n * @observable\n * @api\n */\n setCenter(center) {\n this.setCenterInternal(\n center ? fromUserCoordinate(center, this.getProjection()) : center,\n );\n }\n\n /**\n * Set the center using the view projection (not the user projection).\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n */\n setCenterInternal(center) {\n this.targetCenter_ = center;\n this.applyTargetState_();\n }\n\n /**\n * @param {import(\"./ViewHint.js\").default} hint Hint.\n * @param {number} delta Delta.\n * @return {number} New value.\n */\n setHint(hint, delta) {\n this.hints_[hint] += delta;\n this.changed();\n return this.hints_[hint];\n }\n\n /**\n * Set the resolution for this view. Any resolution constraint will apply.\n * @param {number|undefined} resolution The resolution of the view.\n * @observable\n * @api\n */\n setResolution(resolution) {\n this.targetResolution_ = resolution;\n this.applyTargetState_();\n }\n\n /**\n * Set the rotation for this view. Any rotation constraint will apply.\n * @param {number} rotation The rotation of the view in radians.\n * @observable\n * @api\n */\n setRotation(rotation) {\n this.targetRotation_ = rotation;\n this.applyTargetState_();\n }\n\n /**\n * Zoom to a specific zoom level. Any resolution constrain will apply.\n * @param {number} zoom Zoom level.\n * @api\n */\n setZoom(zoom) {\n this.setResolution(this.getResolutionForZoom(zoom));\n }\n\n /**\n * Recompute rotation/resolution/center based on target values.\n * Note: we have to compute rotation first, then resolution and center considering that\n * parameters can influence one another in case a view extent constraint is present.\n * @param {boolean} [doNotCancelAnims] Do not cancel animations.\n * @param {boolean} [forceMoving] Apply constraints as if the view is moving.\n * @private\n */\n applyTargetState_(doNotCancelAnims, forceMoving) {\n const isMoving =\n this.getAnimating() || this.getInteracting() || forceMoving;\n\n // compute rotation\n const newRotation = this.constraints_.rotation(\n this.targetRotation_,\n isMoving,\n );\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n 0,\n size,\n isMoving,\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n isMoving,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size,\n ),\n );\n\n if (this.get(ViewProperty.ROTATION) !== newRotation) {\n this.set(ViewProperty.ROTATION, newRotation);\n }\n if (this.get(ViewProperty.RESOLUTION) !== newResolution) {\n this.set(ViewProperty.RESOLUTION, newResolution);\n this.set('zoom', this.getZoom(), true);\n }\n if (\n !newCenter ||\n !this.get(ViewProperty.CENTER) ||\n !equals(this.get(ViewProperty.CENTER), newCenter)\n ) {\n this.set(ViewProperty.CENTER, newCenter);\n }\n\n if (this.getAnimating() && !doNotCancelAnims) {\n this.cancelAnimations();\n }\n this.cancelAnchor_ = undefined;\n }\n\n /**\n * If any constraints need to be applied, an animation will be triggered.\n * This is typically done on interaction end.\n * Note: calling this with a duration of 0 will apply the constrained values straight away,\n * without animation.\n * @param {number} [duration] The animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n resolveConstraints(duration, resolutionDirection, anchor) {\n duration = duration !== undefined ? duration : 200;\n const direction = resolutionDirection || 0;\n\n const newRotation = this.constraints_.rotation(this.targetRotation_);\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n direction,\n size,\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n false,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size,\n ),\n );\n\n if (duration === 0 && !this.cancelAnchor_) {\n this.targetResolution_ = newResolution;\n this.targetRotation_ = newRotation;\n this.targetCenter_ = newCenter;\n this.applyTargetState_();\n return;\n }\n\n anchor = anchor || (duration === 0 ? this.cancelAnchor_ : undefined);\n this.cancelAnchor_ = undefined;\n\n if (\n this.getResolution() !== newResolution ||\n this.getRotation() !== newRotation ||\n !this.getCenterInternal() ||\n !equals(this.getCenterInternal(), newCenter)\n ) {\n if (this.getAnimating()) {\n this.cancelAnimations();\n }\n\n this.animateInternal({\n rotation: newRotation,\n center: newCenter,\n resolution: newResolution,\n duration: duration,\n easing: easeOut,\n anchor: anchor,\n });\n }\n }\n\n /**\n * Notify the View that an interaction has started.\n * The view state will be resolved to a stable one if needed\n * (depending on its constraints).\n * @api\n */\n beginInteraction() {\n this.resolveConstraints(0);\n\n this.setHint(ViewHint.INTERACTING, 1);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n endInteraction(duration, resolutionDirection, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.endInteractionInternal(duration, resolutionDirection, anchor);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n endInteractionInternal(duration, resolutionDirection, anchor) {\n if (!this.getInteracting()) {\n return;\n }\n this.setHint(ViewHint.INTERACTING, -1);\n this.resolveConstraints(duration, resolutionDirection, anchor);\n }\n\n /**\n * Get a valid position for the view center according to the current constraints.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} targetCenter Target center position.\n * @param {number} [targetResolution] Target resolution. If not supplied, the current one will be used.\n * This is useful to guess a valid center position at a different zoom level.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Valid center position.\n */\n getConstrainedCenter(targetCenter, targetResolution) {\n const size = this.getViewportSize_(this.getRotation());\n return this.constraints_.center(\n targetCenter,\n targetResolution || this.getResolution(),\n size,\n );\n }\n\n /**\n * Get a valid zoom level according to the current view constraints.\n * @param {number|undefined} targetZoom Target zoom.\n * @param {number} [direction] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid zoom level.\n */\n getConstrainedZoom(targetZoom, direction) {\n const targetRes = this.getResolutionForZoom(targetZoom);\n return this.getZoomForResolution(\n this.getConstrainedResolution(targetRes, direction),\n );\n }\n\n /**\n * Get a valid resolution according to the current view constraints.\n * @param {number|undefined} targetResolution Target resolution.\n * @param {number} [direction] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid resolution.\n */\n getConstrainedResolution(targetResolution, direction) {\n direction = direction || 0;\n const size = this.getViewportSize_(this.getRotation());\n\n return this.constraints_.resolution(targetResolution, direction, size);\n }\n}\n\n/**\n * @param {Function} callback Callback.\n * @param {*} returnValue Return value.\n */\nfunction animationCallback(callback, returnValue) {\n setTimeout(function () {\n callback(returnValue);\n }, 0);\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./centerconstraint.js\").Type} The constraint.\n */\nexport function createCenterConstraint(options) {\n if (options.extent !== undefined) {\n const smooth =\n options.smoothExtentConstraint !== undefined\n ? options.smoothExtentConstraint\n : true;\n return createExtent(options.extent, options.constrainOnlyCenter, smooth);\n }\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n if (options.multiWorld !== true && projection.isGlobal()) {\n const extent = projection.getExtent().slice();\n extent[0] = -Infinity;\n extent[2] = Infinity;\n return createExtent(extent, false, false);\n }\n\n return centerNone;\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {{constraint: import(\"./resolutionconstraint.js\").Type, maxResolution: number,\n * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.\n */\nexport function createResolutionConstraint(options) {\n let resolutionConstraint;\n let maxResolution;\n let minResolution;\n\n // TODO: move these to be ol constants\n // see https://github.com/openlayers/openlayers/issues/2076\n const defaultMaxZoom = 28;\n const defaultZoomFactor = 2;\n\n let minZoom =\n options.minZoom !== undefined ? options.minZoom : DEFAULT_MIN_ZOOM;\n\n let maxZoom =\n options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom;\n\n const zoomFactor =\n options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor;\n\n const multiWorld =\n options.multiWorld !== undefined ? options.multiWorld : false;\n\n const smooth =\n options.smoothResolutionConstraint !== undefined\n ? options.smoothResolutionConstraint\n : true;\n\n const showFullExtent =\n options.showFullExtent !== undefined ? options.showFullExtent : false;\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n const projExtent = projection.getExtent();\n let constrainOnlyCenter = options.constrainOnlyCenter;\n let extent = options.extent;\n if (!multiWorld && !extent && projection.isGlobal()) {\n constrainOnlyCenter = false;\n extent = projExtent;\n }\n\n if (options.resolutions !== undefined) {\n const resolutions = options.resolutions;\n maxResolution = resolutions[minZoom];\n minResolution =\n resolutions[maxZoom] !== undefined\n ? resolutions[maxZoom]\n : resolutions[resolutions.length - 1];\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToResolutions(\n resolutions,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n }\n } else {\n // calculate the default min and max resolution\n const size = !projExtent\n ? // use an extent that can fit the whole world if need be\n (360 * METERS_PER_UNIT.degrees) / projection.getMetersPerUnit()\n : Math.max(getWidth(projExtent), getHeight(projExtent));\n\n const defaultMaxResolution =\n size / DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);\n\n const defaultMinResolution =\n defaultMaxResolution /\n Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);\n\n // user provided maxResolution takes precedence\n maxResolution = options.maxResolution;\n if (maxResolution !== undefined) {\n minZoom = 0;\n } else {\n maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);\n }\n\n // user provided minResolution takes precedence\n minResolution = options.minResolution;\n if (minResolution === undefined) {\n if (options.maxZoom !== undefined) {\n if (options.maxResolution !== undefined) {\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);\n } else {\n minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);\n }\n } else {\n minResolution = defaultMinResolution;\n }\n }\n\n // given discrete zoom levels, minResolution may be different than provided\n maxZoom =\n minZoom +\n Math.floor(\n Math.log(maxResolution / minResolution) / Math.log(zoomFactor),\n );\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToPower(\n zoomFactor,\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent,\n );\n }\n }\n return {\n constraint: resolutionConstraint,\n maxResolution: maxResolution,\n minResolution: minResolution,\n minZoom: minZoom,\n zoomFactor: zoomFactor,\n };\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./rotationconstraint.js\").Type} Rotation constraint.\n */\nexport function createRotationConstraint(options) {\n const enableRotation =\n options.enableRotation !== undefined ? options.enableRotation : true;\n if (enableRotation) {\n const constrainRotation = options.constrainRotation;\n if (constrainRotation === undefined || constrainRotation === true) {\n return createSnapToZero();\n }\n if (constrainRotation === false) {\n return rotationNone;\n }\n if (typeof constrainRotation === 'number') {\n return createSnapToN(constrainRotation);\n }\n return rotationNone;\n }\n return disable;\n}\n\n/**\n * Determine if an animation involves no view change.\n * @param {Animation} animation The animation.\n * @return {boolean} The animation involves no view change.\n */\nexport function isNoopAnimation(animation) {\n if (animation.sourceCenter && animation.targetCenter) {\n if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) {\n return false;\n }\n }\n if (animation.sourceResolution !== animation.targetResolution) {\n return false;\n }\n if (animation.sourceRotation !== animation.targetRotation) {\n return false;\n }\n return true;\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @return {import(\"./coordinate.js\").Coordinate} Shifted center.\n */\nfunction calculateCenterOn(coordinate, size, position, resolution, rotation) {\n // calculate rotated position\n const cosAngle = Math.cos(-rotation);\n let sinAngle = Math.sin(-rotation);\n let rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n let rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n rotX += (size[0] / 2 - position[0]) * resolution;\n rotY += (position[1] - size[1] / 2) * resolution;\n\n // go back to original angle\n sinAngle = -sinAngle; // go back to original rotation\n const centerX = rotX * cosAngle - rotY * sinAngle;\n const centerY = rotY * cosAngle + rotX * sinAngle;\n\n return [centerX, centerY];\n}\n\nexport default View;\n","/**\n * @module ol/css\n */\n\n/**\n * @typedef {Object} FontParameters\n * @property {string} style Style.\n * @property {string} variant Variant.\n * @property {string} weight Weight.\n * @property {string} size Size.\n * @property {string} lineHeight LineHeight.\n * @property {string} family Family.\n * @property {Array<string>} families Families.\n */\n\n/**\n * The CSS class for hidden feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_HIDDEN = 'ol-hidden';\n\n/**\n * The CSS class that we'll give the DOM elements to have them selectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_SELECTABLE = 'ol-selectable';\n\n/**\n * The CSS class that we'll give the DOM elements to have them unselectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSELECTABLE = 'ol-unselectable';\n\n/**\n * The CSS class for unsupported feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSUPPORTED = 'ol-unsupported';\n\n/**\n * The CSS class for controls.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_CONTROL = 'ol-control';\n\n/**\n * The CSS class that we'll give the DOM elements that are collapsed, i.e.\n * to those elements which usually can be expanded.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_COLLAPSED = 'ol-collapsed';\n\n/**\n * From https://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font\n * @type {RegExp}\n */\nconst fontRegEx = new RegExp(\n [\n '^\\\\s*(?=(?:(?:[-a-z]+\\\\s*){0,2}(italic|oblique))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(small-caps))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',\n '(?:(?:normal|\\\\1|\\\\2|\\\\3)\\\\s*){0,3}((?:xx?-)?',\n '(?:small|large)|medium|smaller|larger|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx]))',\n '(?:\\\\s*\\\\/\\\\s*(normal|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx])?))',\n '?\\\\s*([-,\\\\\"\\\\\\'\\\\sa-z0-9]+?)\\\\s*$',\n ].join(''),\n 'i',\n);\n/** @type {Array<'style'|'variant'|'weight'|'size'|'lineHeight'|'family'>} */\nconst fontRegExMatchIndex = [\n 'style',\n 'variant',\n 'weight',\n 'size',\n 'lineHeight',\n 'family',\n];\n\n/** @type {Object<string|number, number>} */\nexport const fontWeights = {\n normal: 400,\n bold: 700,\n};\n\n/**\n * Get the list of font families from a font spec. Note that this doesn't work\n * for font families that have commas in them.\n * @param {string} fontSpec The CSS font property.\n * @return {FontParameters|null} The font parameters (or null if the input spec is invalid).\n */\nexport const getFontParameters = function (fontSpec) {\n const match = fontSpec.match(fontRegEx);\n if (!match) {\n return null;\n }\n const style = /** @type {FontParameters} */ ({\n lineHeight: 'normal',\n size: '1.2em',\n style: 'normal',\n weight: '400',\n variant: 'normal',\n });\n for (let i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {\n const value = match[i + 1];\n if (value !== undefined) {\n style[fontRegExMatchIndex[i]] =\n typeof value === 'string' ? value.trim() : value;\n }\n }\n if (isNaN(Number(style.weight)) && style.weight in fontWeights) {\n style.weight = fontWeights[style.weight];\n }\n style.families = style.family\n .split(/,\\s?/)\n .map((f) => f.trim().replace(/^['\"]|['\"]$/g, ''));\n return style;\n};\n","/**\n * @module ol/control/Control\n */\nimport MapEventType from '../MapEventType.js';\nimport BaseObject from '../Object.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {VOID} from '../functions.js';\n\n/**\n * @typedef {Object} Options\n * @property {HTMLElement} [element] The element is the control's\n * container element. This only needs to be specified if you're developing\n * a custom control.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want\n * the control to be rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control is a visible widget with a DOM element in a fixed position on the\n * screen. They can involve user input (buttons), or be informational only;\n * the position is determined using CSS. By default these are placed in the\n * container with CSS class name `ol-overlaycontainer-stopevent`, but can use\n * any outside DOM element.\n *\n * This is the base class for controls. You can use it for simple custom\n * controls by creating the element with listeners, creating an instance:\n * ```js\n * const myControl = new Control({element: myElement});\n * ```\n * and then adding this to the map.\n *\n * The main advantage of having this as a control rather than a simple separate\n * DOM element is that preventing propagation is handled for you. Controls\n * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.\n *\n * You can also extend this base for your own control class. See\n * examples/custom-controls for an example of how to do this.\n *\n * @api\n */\nclass Control extends BaseObject {\n /**\n * @param {Options} options Control options.\n */\n constructor(options) {\n super();\n\n const element = options.element;\n if (element && !options.target && !element.style.pointerEvents) {\n element.style.pointerEvents = 'auto';\n }\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = element ? element : null;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.target_ = null;\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n /**\n * @protected\n * @type {!Array<import(\"../events.js\").EventsKey>}\n */\n this.listenerKeys = [];\n\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.target) {\n this.setTarget(options.target);\n }\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.element?.remove();\n super.disposeInternal();\n }\n\n /**\n * Get the map associated with this control.\n * @return {import(\"../Map.js\").default|null} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n if (this.map_) {\n this.element?.remove();\n }\n for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) {\n unlistenByKey(this.listenerKeys[i]);\n }\n this.listenerKeys.length = 0;\n this.map_ = map;\n if (map) {\n const target = this.target_ ?? map.getOverlayContainerStopEvent();\n if (this.element) {\n target.appendChild(this.element);\n }\n if (this.render !== VOID) {\n this.listenerKeys.push(\n listen(map, MapEventType.POSTRENDER, this.render, this),\n );\n }\n map.render();\n }\n }\n\n /**\n * Renders the control.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @api\n */\n render(mapEvent) {}\n\n /**\n * This function is used to set a target element for the control. It has no\n * effect if it is called after the control has been added to the map (i.e.\n * after `setMap` is called on the control). If no `target` is set in the\n * options passed to the control constructor and if `setTarget` is not called\n * then the control is added to the map's overlay container.\n * @param {HTMLElement|string} target Target.\n * @api\n */\n setTarget(target) {\n this.target_ =\n typeof target === 'string' ? document.getElementById(target) : target;\n }\n}\n\nexport default Control;\n","/**\n * @module ol/control/Attribution\n */\nimport {equals} from '../array.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {removeChildren, replaceNode} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {toPromise} from '../functions.js';\nimport Control from './Control.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-attribution'] CSS class name.\n * @property {HTMLElement|string} [target] Specify a target if you\n * want the control to be rendered outside of the map's\n * viewport.\n * @property {boolean} [collapsible] Specify if attributions can\n * be collapsed. If not specified, sources control this behavior with their\n * `attributionsCollapsible` setting.\n * @property {boolean} [collapsed=true] Specify if attributions should\n * be collapsed at startup.\n * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.\n * @property {string|HTMLElement} [label='i'] Text label to use for the\n * collapsed attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [expandClassName=className + '-expand'] CSS class name for the\n * collapsed attributions button.\n * @property {string|HTMLElement} [collapseLabel='›'] Text label to use\n * for the expanded attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [collapseClassName=className + '-collapse'] CSS class name for the\n * expanded attributions button.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {string|Array<string>|undefined} [attributions] Optional attribution(s) that will always be\n * displayed regardless of the layers rendered.\n * **Caution:** Attributions are rendered dynamically using `innerHTML`, which can lead to potential\n * [**XSS (Cross-Site Scripting)**](https://en.wikipedia.org/wiki/Cross-site_scripting) vulnerabilities.\n * Use this feature only for trusted content\n * or ensure that the content is properly sanitized before inserting it.\n */\n\n/**\n * @classdesc\n * Control to show all the attributions associated with the layer sources\n * in the map. This control is one of the default controls included in maps.\n * By default it will show in the bottom right portion of the map, but this can\n * be changed by using a css selector for `.ol-attribution`.\n *\n * @api\n */\nclass Attribution extends Control {\n /**\n * @param {Options} [options] Attribution options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.ulElement_ = document.createElement('ul');\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.userCollapsed_ = this.collapsed_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overrideCollapsible_ = options.collapsible !== undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n /**\n * @private\n * @type {string | Array<string> | undefined}\n */\n this.attributions_ = options.attributions;\n\n const className =\n options.className !== undefined ? options.className : 'ol-attribution';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Attributions';\n\n const expandClassName =\n options.expandClassName !== undefined\n ? options.expandClassName\n : className + '-expand';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u203A';\n\n const collapseClassName =\n options.collapseClassName !== undefined\n ? options.collapseClassName\n : className + '-collapse';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n this.collapseLabel_.className = collapseClassName;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : 'i';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n this.label_.className = expandClassName;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.toggleButton_ = document.createElement('button');\n this.toggleButton_.setAttribute('type', 'button');\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n this.toggleButton_.title = tipLabel;\n this.toggleButton_.appendChild(activeLabel);\n\n this.toggleButton_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.toggleButton_);\n element.appendChild(this.ulElement_);\n\n /**\n * A list of currently rendered resolutions.\n * @type {Array<string>}\n * @private\n */\n this.renderedAttributions_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * Collect a list of visible attributions and set the collapsible state.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @return {Array<string>} Attributions.\n * @private\n */\n collectSourceAttributions_(frameState) {\n const layers = this.getMap().getAllLayers();\n const visibleAttributions = new Set(\n layers.flatMap((layer) => layer.getAttributions(frameState)),\n );\n if (this.attributions_ !== undefined) {\n Array.isArray(this.attributions_)\n ? this.attributions_.forEach((item) => visibleAttributions.add(item))\n : visibleAttributions.add(this.attributions_);\n }\n\n if (!this.overrideCollapsible_) {\n const collapsible = !layers.some(\n (layer) => layer.getSource()?.getAttributionsCollapsible() === false,\n );\n this.setCollapsible(collapsible);\n }\n return Array.from(visibleAttributions);\n }\n\n /**\n * @private\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n async updateElement_(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const attributions = await Promise.all(\n this.collectSourceAttributions_(frameState).map((attribution) =>\n toPromise(() => attribution),\n ),\n );\n\n const visible = attributions.length > 0;\n if (this.renderedVisible_ != visible) {\n this.element.style.display = visible ? '' : 'none';\n this.renderedVisible_ = visible;\n }\n\n if (equals(attributions, this.renderedAttributions_)) {\n return;\n }\n\n removeChildren(this.ulElement_);\n\n // append the attributions\n for (let i = 0, ii = attributions.length; i < ii; ++i) {\n const element = document.createElement('li');\n element.innerHTML = attributions[i];\n this.ulElement_.appendChild(element);\n }\n\n this.renderedAttributions_ = attributions;\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n this.userCollapsed_ = this.collapsed_;\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n }\n\n /**\n * Return `true` if the attribution is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the attribution should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (this.userCollapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the attribution according to the passed parameter. Will\n * not do anything if the attribution isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n this.userCollapsed_ = collapsed;\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Return `true` when the attribution is currently collapsed or `false`\n * otherwise.\n * @return {boolean} True if the widget is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Update the attribution element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.updateElement_(mapEvent.frameState);\n }\n}\n\nexport default Attribution;\n","/**\n * @module ol/control/Rotate\n */\nimport {CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\nimport EventType from '../events/EventType.js';\nimport Control from './Control.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-rotate'] CSS class name.\n * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.\n * @property {string} [compassClassName='ol-compass'] CSS class name for the compass.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {boolean} [autoHide=true] Hide the control when rotation is 0.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control should\n * be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {function():void} [resetNorth] Function called when the control is clicked.\n * This will override the default `resetNorth`.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A button control to reset rotation to 0.\n * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css\n * selector is added to the button when the rotation is 0.\n *\n * @api\n */\nclass Rotate extends Control {\n /**\n * @param {Options} [options] Rotate options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-rotate';\n\n const label = options.label !== undefined ? options.label : '\\u21E7';\n\n const compassClassName =\n options.compassClassName !== undefined\n ? options.compassClassName\n : 'ol-compass';\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.label_ = null;\n\n if (typeof label === 'string') {\n this.label_ = document.createElement('span');\n this.label_.className = compassClassName;\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n this.label_.classList.add(compassClassName);\n }\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';\n\n const button = document.createElement('button');\n button.className = className + '-reset';\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(this.label_);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(button);\n\n /**\n * @private\n */\n this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @type {boolean}\n * @private\n */\n this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n if (this.autoHide_) {\n this.element.classList.add(CLASS_HIDDEN);\n }\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n if (this.callResetNorth_ !== undefined) {\n this.callResetNorth_();\n } else {\n this.resetNorth_();\n }\n }\n\n /**\n * @private\n */\n resetNorth_() {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const rotation = view.getRotation();\n if (rotation !== undefined) {\n if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {\n view.animate({\n rotation: 0,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setRotation(0);\n }\n }\n }\n\n /**\n * Update the rotate control element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n return;\n }\n const rotation = frameState.viewState.rotation;\n if (rotation != this.rotation_) {\n const transform = 'rotate(' + rotation + 'rad)';\n if (this.autoHide_) {\n const contains = this.element.classList.contains(CLASS_HIDDEN);\n if (!contains && rotation === 0) {\n this.element.classList.add(CLASS_HIDDEN);\n } else if (contains && rotation !== 0) {\n this.element.classList.remove(CLASS_HIDDEN);\n }\n }\n this.label_.style.transform = transform;\n }\n this.rotation_ = rotation;\n }\n}\n\nexport default Rotate;\n","/**\n * @module ol/control/Zoom\n */\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\nimport EventType from '../events/EventType.js';\nimport Control from './Control.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {string} [className='ol-zoom'] CSS class name.\n * @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button.\n * @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button.\n * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in\n * button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.\n * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.\n * @property {number} [delta=1] The zoom delta applied on each click.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control with 2 buttons, one for zoom in and one for zoom out.\n * This control is one of the default controls of a map. To style this control\n * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.\n *\n * @api\n */\nclass Zoom extends Control {\n /**\n * @param {Options} [options] Zoom options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoom';\n\n const delta = options.delta !== undefined ? options.delta : 1;\n\n const zoomInClassName =\n options.zoomInClassName !== undefined\n ? options.zoomInClassName\n : className + '-in';\n\n const zoomOutClassName =\n options.zoomOutClassName !== undefined\n ? options.zoomOutClassName\n : className + '-out';\n\n const zoomInLabel =\n options.zoomInLabel !== undefined ? options.zoomInLabel : '+';\n const zoomOutLabel =\n options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\\u2013';\n\n const zoomInTipLabel =\n options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in';\n const zoomOutTipLabel =\n options.zoomOutTipLabel !== undefined\n ? options.zoomOutTipLabel\n : 'Zoom out';\n\n const inElement = document.createElement('button');\n inElement.className = zoomInClassName;\n inElement.setAttribute('type', 'button');\n inElement.title = zoomInTipLabel;\n inElement.appendChild(\n typeof zoomInLabel === 'string'\n ? document.createTextNode(zoomInLabel)\n : zoomInLabel,\n );\n\n inElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, delta),\n false,\n );\n\n const outElement = document.createElement('button');\n outElement.className = zoomOutClassName;\n outElement.setAttribute('type', 'button');\n outElement.title = zoomOutTipLabel;\n outElement.appendChild(\n typeof zoomOutLabel === 'string'\n ? document.createTextNode(zoomOutLabel)\n : zoomOutLabel,\n );\n\n outElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, -delta),\n false,\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(inElement);\n element.appendChild(outElement);\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(delta, event) {\n event.preventDefault();\n this.zoomByDelta_(delta);\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @private\n */\n zoomByDelta_(delta) {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const currentZoom = view.getZoom();\n if (currentZoom !== undefined) {\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n if (this.duration_ > 0) {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n zoom: newZoom,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setZoom(newZoom);\n }\n }\n }\n}\n\nexport default Zoom;\n","/**\n * @module ol/control/defaults\n */\nimport Collection from '../Collection.js';\nimport Attribution from './Attribution.js';\nimport Rotate from './Rotate.js';\nimport Zoom from './Zoom.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [attribution=true] Include\n * {@link module:ol/control/Attribution~Attribution}.\n * @property {import(\"./Attribution.js\").Options} [attributionOptions]\n * Options for {@link module:ol/control/Attribution~Attribution}.\n * @property {boolean} [rotate=true] Include\n * {@link module:ol/control/Rotate~Rotate}.\n * @property {import(\"./Rotate.js\").Options} [rotateOptions] Options\n * for {@link module:ol/control/Rotate~Rotate}.\n * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.\n * @property {import(\"./Zoom.js\").Options} [zoomOptions] Options for\n * {@link module:ol/control/Zoom~Zoom}.\n */\n\n/**\n * Set of controls included in maps by default. Unless configured otherwise,\n * this returns a collection containing an instance of each of the following\n * controls:\n * {@link module:ol/control/Zoom~Zoom}\n * {@link module:ol/control/Rotate~Rotate}\n * {@link module:ol/control/Attribution~Attribution}\n *\n * @param {DefaultsOptions} [options] Options for the default controls.\n * @return {Collection<import(\"./Control.js\").default>} A collection of controls\n * to be used with the {@link module:ol/Map~Map} constructor's `controls` option.\n * @api\n */\nexport function defaults(options) {\n options = options ? options : {};\n\n /** @type {Collection<import(\"./Control.js\").default>} */\n const controls = new Collection();\n\n const zoomControl = options.zoom !== undefined ? options.zoom : true;\n if (zoomControl) {\n controls.push(new Zoom(options.zoomOptions));\n }\n\n const rotateControl = options.rotate !== undefined ? options.rotate : true;\n if (rotateControl) {\n controls.push(new Rotate(options.rotateOptions));\n }\n\n const attributionControl =\n options.attribution !== undefined ? options.attribution : true;\n if (attributionControl) {\n controls.push(new Attribution(options.attributionOptions));\n }\n\n return controls;\n}\n","/**\n * @module ol/interaction/Property\n */\n\n/**\n * @enum {string}\n */\nexport default {\n ACTIVE: 'active',\n};\n","/**\n * @module ol/interaction/Interaction\n */\nimport BaseObject from '../Object.js';\nimport {easeOut, linear} from '../easing.js';\nimport InteractionProperty from './Property.js';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active', Return>} InteractionOnSignature\n */\n\n/**\n * Object literal with config options for interactions.\n * @typedef {Object} InteractionOptions\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleEvent]\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. If the function returns a falsy value, propagation of\n * the event to other interactions in the map's interactions chain will be\n * prevented (this includes functions with no explicit return). The interactions\n * are traversed in reverse order of the interactions collection of the map.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * User actions that change the state of the map. Some are similar to controls,\n * but are not associated with a DOM element.\n * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is\n * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered\n * by a keyboard event not a button element event.\n * Although interactions do not have a DOM element, some of them do render\n * vectors and so are visible on the screen.\n * @api\n */\nclass Interaction extends BaseObject {\n /**\n * @param {InteractionOptions} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {InteractionOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {InteractionOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {InteractionOnSignature<void>}\n */\n this.un;\n\n if (options && options.handleEvent) {\n this.handleEvent = options.handleEvent;\n }\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n this.setActive(true);\n }\n\n /**\n * Return whether the interaction is currently active.\n * @return {boolean} `true` if the interaction is active, `false` otherwise.\n * @observable\n * @api\n */\n getActive() {\n return /** @type {boolean} */ (this.get(InteractionProperty.ACTIVE));\n }\n\n /**\n * Get the map associated with this interaction.\n * @return {import(\"../Map.js\").default|null} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n */\n handleEvent(mapBrowserEvent) {\n return true;\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n */\n setActive(active) {\n this.set(InteractionProperty.ACTIVE, active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMap(map) {\n this.map_ = map;\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {import(\"../coordinate.js\").Coordinate} delta Delta.\n * @param {number} [duration] Duration.\n */\nexport function pan(view, delta, duration) {\n const currentCenter = view.getCenterInternal();\n if (currentCenter) {\n const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];\n view.animateInternal({\n duration: duration !== undefined ? duration : 250,\n easing: linear,\n center: view.getConstrainedCenter(center),\n });\n }\n}\n\n/**\n * @param {import(\"../View.js\").default} view View.\n * @param {number} delta Delta from previous zoom level.\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] Anchor coordinate in the user projection.\n * @param {number} [duration] Duration.\n */\nexport function zoomByDelta(view, delta, anchor, duration) {\n const currentZoom = view.getZoom();\n\n if (currentZoom === undefined) {\n return;\n }\n\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n const newResolution = view.getResolutionForZoom(newZoom);\n\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n resolution: newResolution,\n anchor: anchor,\n duration: duration !== undefined ? duration : 250,\n easing: easeOut,\n });\n}\n\nexport default Interaction;\n","/**\n * @module ol/interaction/DoubleClickZoom\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [delta=1] The zoom delta applied on each double click.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom by double-clicking on the map.\n * @api\n */\nclass DoubleClickZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a\n * doubleclick) and eventually zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {\n const browserEvent = /** @type {MouseEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const map = mapBrowserEvent.map;\n const anchor = mapBrowserEvent.coordinate;\n const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, anchor, this.duration_);\n browserEvent.preventDefault();\n stopEvent = true;\n }\n return !stopEvent;\n }\n}\n\nexport default DoubleClickZoom;\n","/**\n * @module ol/events/condition\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {MAC, WEBKIT} from '../has.js';\n\n/**\n * A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * `{boolean}`. If the condition is met, true should be returned.\n *\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default): boolean} Condition\n */\n\n/**\n * Creates a condition function that passes when all provided conditions pass.\n * @param {...Condition} var_args Conditions to check.\n * @return {Condition} Condition function.\n */\nexport function all(var_args) {\n const conditions = arguments;\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} All conditions passed.\n */\n return function (event) {\n let pass = true;\n for (let i = 0, ii = conditions.length; i < ii; ++i) {\n pass = pass && conditions[i](event);\n if (!pass) {\n break;\n }\n }\n return pass;\n };\n}\n\n/**\n * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when\n * additionally the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt key is pressed.\n * @api\n */\nexport const altKeyOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise\n * (e.g. when additionally the platform-modifier-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt and shift keys are pressed.\n * @api\n */\nexport const altShiftKeysOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the map has the focus. This condition requires a map target\n * element with a `tabindex` attribute, e.g. `<div id=\"map\" tabindex=\"1\">`.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map has the focus.\n * @api\n */\nexport const focus = function (event) {\n const targetElement = event.map.getTargetElement();\n const rootNode = targetElement.getRootNode();\n const activeElement = event.map.getOwnerDocument().activeElement;\n\n return rootNode instanceof ShadowRoot\n ? rootNode.host.contains(activeElement)\n : targetElement.contains(activeElement);\n};\n\n/**\n * Return `true` if the map has the focus or no 'tabindex' attribute set.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map container has the focus or no 'tabindex' attribute.\n */\nexport const focusWithTabindex = function (event) {\n const targetElement = event.map.getTargetElement();\n const rootNode = targetElement.getRootNode();\n const tabIndexCandidate =\n rootNode instanceof ShadowRoot ? rootNode.host : targetElement;\n\n return tabIndexCandidate.hasAttribute('tabindex') ? focus(event) : true;\n};\n\n/**\n * Return always true.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True.\n * @api\n */\nexport const always = TRUE;\n\n/**\n * Return `true` if the event is a `click` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `click` event.\n * @api\n */\nexport const click = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.CLICK;\n};\n\n/**\n * Return `true` if the event has an \"action\"-producing mouse button.\n *\n * By definition, this includes left-click on windows/linux, and left-click\n * without the ctrl key on Macs.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} The result.\n */\nexport const mouseActionButton = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n 'pointerId' in originalEvent &&\n originalEvent.button == 0 &&\n !(WEBKIT && MAC && originalEvent.ctrlKey)\n );\n};\n\n/**\n * Return always false.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} False.\n * @api\n */\nexport const never = FALSE;\n\n/**\n * Return `true` if the browser event is a `pointermove` event, `false`\n * otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the browser event is a `pointermove` event.\n * @api\n */\nexport const pointerMove = function (mapBrowserEvent) {\n return mapBrowserEvent.type == 'pointermove';\n};\n\n/**\n * Return `true` if the event is a map `singleclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `singleclick` event.\n * @api\n */\nexport const singleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;\n};\n\n/**\n * Return `true` if the event is a map `dblclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `dblclick` event.\n * @api\n */\nexport const doubleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;\n};\n\n/**\n * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is\n * pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if there no modifier keys are pressed.\n * @api\n */\nexport const noModifierKeys = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally\n * the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKeyOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n !originalEvent.altKey &&\n (MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKey = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return MAC ? originalEvent.metaKey : originalEvent.ctrlKey;\n};\n\n/**\n * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when\n * additionally the alt-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the shift key is pressed.\n * @api\n */\nexport const shiftKeyOnly = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the target element is not editable, i.e. not an `input`,\n * `select`, or `textarea` element and no `contenteditable` attribute is\n * set or inherited, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if the target element is not editable.\n * @api\n */\nexport const targetNotEditable = function (mapBrowserEvent) {\n const originalEvent = mapBrowserEvent.originalEvent;\n const tagName = /** @type {Element} */ (originalEvent.target).tagName;\n return (\n tagName !== 'INPUT' &&\n tagName !== 'SELECT' &&\n tagName !== 'TEXTAREA' &&\n // `isContentEditable` is only available on `HTMLElement`, but it may also be a\n // different type like `SVGElement`.\n // @ts-ignore\n !originalEvent.target.isContentEditable\n );\n};\n\n/**\n * Return `true` if the event originates from a mouse device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a mouse device.\n * @api\n */\nexport const mouseOnly = function (mapBrowserEvent) {\n const pointerEvent = mapBrowserEvent.originalEvent;\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return 'pointerId' in pointerEvent && pointerEvent.pointerType == 'mouse';\n};\n\n/**\n * Return `true` if the event originates from a touchable device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a touchable device.\n * @api\n */\nexport const touchOnly = function (mapBrowserEvent) {\n const pointerEvt = mapBrowserEvent.originalEvent;\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return 'pointerId' in pointerEvt && pointerEvt.pointerType === 'touch';\n};\n\n/**\n * Return `true` if the event originates from a digital pen.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a digital pen.\n * @api\n */\nexport const penOnly = function (mapBrowserEvent) {\n const pointerEvt = mapBrowserEvent.originalEvent;\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return 'pointerId' in pointerEvt && pointerEvt.pointerType === 'pen';\n};\n\n/**\n * Return `true` if the event originates from a primary pointer in\n * contact with the surface or if the left mouse button is pressed.\n * See https://www.w3.org/TR/pointerevents/#button-states.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a primary pointer.\n * @api\n */\nexport const primaryAction = function (mapBrowserEvent) {\n const pointerEvent = mapBrowserEvent.originalEvent;\n return (\n 'pointerId' in pointerEvent &&\n pointerEvent.isPrimary &&\n pointerEvent.button === 0\n );\n};\n","/**\n * @module ol/interaction/Pointer\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleDownEvent]\n * Function handling \"down\" events. If the function returns `true` then a drag\n * sequence is started.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleDragEvent]\n * Function handling \"drag\" events. This function is called on \"move\" events\n * during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleEvent]\n * Method called by the map to notify the interaction that a browser event was\n * dispatched to the map. The function may return `false` to prevent the\n * propagation of the event to other interactions in the map's interactions\n * chain.\n * @property {function(import(\"../MapBrowserEvent.js\").default):void} [handleMoveEvent]\n * Function handling \"move\" events. This function is called on \"move\" events.\n * This functions is also called during a drag sequence, so during a drag\n * sequence both the `handleDragEvent` function and this function are called.\n * If `handleDownEvent` is defined and it returns true this function will not\n * be called during a drag sequence.\n * @property {function(import(\"../MapBrowserEvent.js\").default):boolean} [handleUpEvent]\n * Function handling \"up\" events. If the function returns `false` then the\n * current drag sequence is stopped.\n * @property {function(boolean):boolean} [stopDown]\n * Should the down event be propagated to other interactions, or should be\n * stopped?\n */\n\n/**\n * @classdesc\n * Base class that calls user-defined functions on `down`, `move` and `up`\n * events. This class also manages \"drag sequences\".\n *\n * When the `handleDownEvent` user function returns `true` a drag sequence is\n * started. During a drag sequence the `handleDragEvent` user function is\n * called on `move` events. The drag sequence ends when the `handleUpEvent`\n * user function is called and returns `false`.\n * @api\n */\nclass PointerInteraction extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n if (options.handleDownEvent) {\n this.handleDownEvent = options.handleDownEvent;\n }\n\n if (options.handleDragEvent) {\n this.handleDragEvent = options.handleDragEvent;\n }\n\n if (options.handleMoveEvent) {\n this.handleMoveEvent = options.handleMoveEvent;\n }\n\n if (options.handleUpEvent) {\n this.handleUpEvent = options.handleUpEvent;\n }\n\n if (options.stopDown) {\n this.stopDown = options.stopDown;\n }\n\n /**\n * @type {boolean}\n * @protected\n */\n this.handlingDownUpSequence = false;\n\n /**\n * @type {Array<PointerEvent>}\n * @protected\n */\n this.targetPointers = [];\n }\n\n /**\n * Returns the current number of pointers involved in the interaction,\n * e.g. `2` when two fingers are used.\n * @return {number} The number of pointers.\n * @api\n */\n getPointerCount() {\n return this.targetPointers.length;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleDownEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleDragEvent(mapBrowserEvent) {}\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into\n * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are\n * detected.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n\n let stopEvent = false;\n this.updateTrackedPointers_(mapBrowserEvent);\n if (this.handlingDownUpSequence) {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {\n this.handleDragEvent(mapBrowserEvent);\n // prevent page scrolling during dragging\n mapBrowserEvent.originalEvent.preventDefault();\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n const handledUp = this.handleUpEvent(mapBrowserEvent);\n this.handlingDownUpSequence =\n handledUp && this.targetPointers.length > 0;\n }\n } else {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n const handled = this.handleDownEvent(mapBrowserEvent);\n this.handlingDownUpSequence = handled;\n stopEvent = this.stopDown(handled);\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE) {\n this.handleMoveEvent(mapBrowserEvent);\n }\n }\n return !stopEvent;\n }\n\n /**\n * Handle pointer move events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @protected\n */\n handleMoveEvent(mapBrowserEvent) {}\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @protected\n */\n handleUpEvent(mapBrowserEvent) {\n return false;\n }\n\n /**\n * This function is used to determine if \"down\" events should be propagated\n * to other interactions or should be stopped.\n * @param {boolean} handled Was the event handled by the interaction?\n * @return {boolean} Should the `down` event be stopped?\n */\n stopDown(handled) {\n return handled;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @private\n */\n updateTrackedPointers_(mapBrowserEvent) {\n if (mapBrowserEvent.activePointers) {\n this.targetPointers = mapBrowserEvent.activePointers;\n }\n }\n}\n\n/**\n * @param {Array<PointerEvent>} pointerEvents List of events.\n * @return {{clientX: number, clientY: number}} Centroid pixel.\n */\nexport function centroid(pointerEvents) {\n const length = pointerEvents.length;\n let clientX = 0;\n let clientY = 0;\n for (let i = 0; i < length; i++) {\n clientX += pointerEvents[i].clientX;\n clientY += pointerEvents[i].clientY;\n }\n return {clientX: clientX / length, clientY: clientY / length};\n}\n\nexport default PointerInteraction;\n","/**\n * @module ol/interaction/DragPan\n */\nimport {\n rotate as rotateCoordinate,\n scale as scaleCoordinate,\n} from '../coordinate.js';\nimport {easeOut} from '../easing.js';\nimport {\n all,\n focusWithTabindex,\n noModifierKeys,\n primaryAction,\n} from '../events/condition.js';\nimport {FALSE} from '../functions.js';\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.noModifierKeys} and {@link module:ol/events/condition.primaryAction}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {import(\"../Kinetic.js\").default} [kinetic] Kinetic inertia to apply to the pan.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map by dragging the map.\n * @api\n */\nclass DragPan extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super({\n stopDown: FALSE,\n });\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {import(\"../Kinetic.js\").default|undefined}\n */\n this.kinetic_ = options.kinetic;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.lastCentroid = null;\n\n /**\n * @type {number}\n * @private\n */\n this.lastPointersCount_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.panning_ = false;\n\n const condition = options.condition\n ? options.condition\n : all(noModifierKeys, primaryAction);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {boolean}\n */\n this.noKinetic_ = false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n const map = mapBrowserEvent.map;\n if (!this.panning_) {\n this.panning_ = true;\n map.getView().beginInteraction();\n }\n const targetPointers = this.targetPointers;\n const centroid = map.getEventPixel(centroidFromPointers(targetPointers));\n if (targetPointers.length == this.lastPointersCount_) {\n if (this.kinetic_) {\n this.kinetic_.update(centroid[0], centroid[1]);\n }\n if (this.lastCentroid) {\n const delta = [\n this.lastCentroid[0] - centroid[0],\n centroid[1] - this.lastCentroid[1],\n ];\n const map = mapBrowserEvent.map;\n const view = map.getView();\n scaleCoordinate(delta, view.getResolution());\n rotateCoordinate(delta, view.getRotation());\n view.adjustCenterInternal(delta);\n }\n } else if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger down, tiny drag, second finger down\n this.kinetic_.begin();\n }\n this.lastCentroid = centroid;\n this.lastPointersCount_ = targetPointers.length;\n mapBrowserEvent.originalEvent.preventDefault();\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (this.targetPointers.length === 0) {\n if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {\n const distance = this.kinetic_.getDistance();\n const angle = this.kinetic_.getAngle();\n const center = view.getCenterInternal();\n const centerpx = map.getPixelFromCoordinateInternal(center);\n const dest = map.getCoordinateFromPixelInternal([\n centerpx[0] - distance * Math.cos(angle),\n centerpx[1] - distance * Math.sin(angle),\n ]);\n view.animateInternal({\n center: view.getConstrainedCenter(dest),\n duration: 500,\n easing: easeOut,\n });\n }\n if (this.panning_) {\n this.panning_ = false;\n view.endInteraction();\n }\n return false;\n }\n if (this.kinetic_) {\n // reset so we don't overestimate the kinetic energy after\n // after one finger up, tiny drag, second finger up\n this.kinetic_.begin();\n }\n this.lastCentroid = null;\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n this.lastCentroid = null;\n // stop any current animation\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n if (this.kinetic_) {\n this.kinetic_.begin();\n }\n // No kinetic as soon as more than one pointer on the screen is\n // detected. This is to prevent nasty pans after pinch.\n this.noKinetic_ = this.targetPointers.length > 1;\n return true;\n }\n return false;\n }\n}\n\nexport default DragPan;\n","/**\n * @module ol/interaction/DragRotate\n */\nimport {\n altShiftKeysOnly,\n mouseActionButton,\n mouseOnly,\n} from '../events/condition.js';\nimport {FALSE} from '../functions.js';\nimport {disable} from '../rotationconstraint.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes a\n * {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.altShiftKeysOnly}.\n * @property {number} [duration=250] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by clicking and dragging on the map,\n * normally combined with a {@link module:ol/events/condition} that limits\n * it to when the alt and shift keys are held down.\n *\n * This interaction is only supported for mouse devices.\n * @api\n */\nclass DragRotate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n stopDown: FALSE,\n });\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : altShiftKeysOnly;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n const size = map.getSize();\n const offset = mapBrowserEvent.pixel;\n const theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);\n if (this.lastAngle_ !== undefined) {\n const delta = theta - this.lastAngle_;\n view.adjustRotationInternal(-delta);\n }\n this.lastAngle_ = theta;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return false;\n }\n\n if (\n mouseActionButton(mapBrowserEvent) &&\n this.condition_(mapBrowserEvent)\n ) {\n const map = mapBrowserEvent.map;\n map.getView().beginInteraction();\n this.lastAngle_ = undefined;\n return true;\n }\n return false;\n }\n}\n\nexport default DragRotate;\n","/**\n * @module ol/render/Box\n */\n\nimport Disposable from '../Disposable.js';\nimport Polygon from '../geom/Polygon.js';\n\nclass RenderBox extends Disposable {\n /**\n * @param {string} className CSS class name.\n */\n constructor(className) {\n super();\n\n /**\n * @type {import(\"../geom/Polygon.js\").default}\n * @private\n */\n this.geometry_ = null;\n\n /**\n * @type {HTMLDivElement}\n * @private\n */\n this.element_ = document.createElement('div');\n this.element_.style.position = 'absolute';\n this.element_.style.pointerEvents = 'auto';\n this.element_.className = 'ol-box ' + className;\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../pixel.js\").Pixel}\n */\n this.endPixel_ = null;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.setMap(null);\n }\n\n /**\n * @private\n */\n render_() {\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const px = 'px';\n const style = this.element_.style;\n style.left = Math.min(startPixel[0], endPixel[0]) + px;\n style.top = Math.min(startPixel[1], endPixel[1]) + px;\n style.width = Math.abs(endPixel[0] - startPixel[0]) + px;\n style.height = Math.abs(endPixel[1] - startPixel[1]) + px;\n }\n\n /**\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMap(map) {\n if (this.map_) {\n this.map_.getOverlayContainer().removeChild(this.element_);\n const style = this.element_.style;\n style.left = 'inherit';\n style.top = 'inherit';\n style.width = 'inherit';\n style.height = 'inherit';\n }\n this.map_ = map;\n if (this.map_) {\n this.map_.getOverlayContainer().appendChild(this.element_);\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} startPixel Start pixel.\n * @param {import(\"../pixel.js\").Pixel} endPixel End pixel.\n */\n setPixels(startPixel, endPixel) {\n this.startPixel_ = startPixel;\n this.endPixel_ = endPixel;\n this.createOrUpdateGeometry();\n this.render_();\n }\n\n /**\n * Creates or updates the cached geometry.\n */\n createOrUpdateGeometry() {\n if (!this.map_) {\n return;\n }\n\n const startPixel = this.startPixel_;\n const endPixel = this.endPixel_;\n const pixels = [\n startPixel,\n [startPixel[0], endPixel[1]],\n endPixel,\n [endPixel[0], startPixel[1]],\n ];\n const coordinates = pixels.map(\n this.map_.getCoordinateFromPixelInternal,\n this.map_,\n );\n // close the polygon\n coordinates[4] = coordinates[0].slice();\n if (!this.geometry_) {\n this.geometry_ = new Polygon([coordinates]);\n } else {\n this.geometry_.setCoordinates([coordinates]);\n }\n }\n\n /**\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n */\n getGeometry() {\n return this.geometry_;\n }\n}\n\nexport default RenderBox;\n","/**\n * @module ol/interaction/DragBox\n */\n// FIXME draw drag box\nimport Event from '../events/Event.js';\nimport {mouseActionButton} from '../events/condition.js';\nimport RenderBox from '../render/Box.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,\n * true should be returned.\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default, import(\"../pixel.js\").Pixel, import(\"../pixel.js\").Pixel):boolean} EndCondition\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragbox'] CSS class name for styling the box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean\n * to indicate whether that event should be handled.\n * Default is {@link ol/events/condition~mouseActionButton}.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default\n * `boxEndCondition` function.\n * @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two\n * {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.\n * Default is `true` if the area of the box is bigger than the `minArea` option.\n * @property {function(this:DragBox, import(\"../MapBrowserEvent.js\").default):void} [onBoxEnd] Code to execute just\n * before `boxend` is fired.\n */\n\n/**\n * @enum {string}\n */\nconst DragBoxEventType = {\n /**\n * Triggered upon drag box start.\n * @event DragBoxEvent#boxstart\n * @api\n */\n BOXSTART: 'boxstart',\n\n /**\n * Triggered on drag when box is active.\n * @event DragBoxEvent#boxdrag\n * @api\n */\n BOXDRAG: 'boxdrag',\n\n /**\n * Triggered upon drag box end.\n * @event DragBoxEvent#boxend\n * @api\n */\n BOXEND: 'boxend',\n\n /**\n * Triggered upon drag box canceled.\n * @event DragBoxEvent#boxcancel\n * @api\n */\n BOXCANCEL: 'boxcancel',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of\n * this type.\n */\nexport class DragBoxEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The event coordinate.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Originating event.\n */\n constructor(type, coordinate, mapBrowserEvent) {\n super(type);\n\n /**\n * The coordinate of the drag event.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.coordinate = coordinate;\n\n /**\n * @const\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'boxcancel'|'boxdrag'|'boxend'|'boxstart', DragBoxEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'boxcancel'|'boxdrag'|'boxend', Return>} DragBoxOnSignature\n */\n\n/**\n * @classdesc\n * Allows the user to draw a vector box by clicking and dragging on the map,\n * normally combined with a {@link module:ol/events/condition} that limits\n * it to when the shift or other key is held down. This is used, for example,\n * for zooming to a specific area of the map\n * (see {@link module:ol/interaction/DragZoom~DragZoom} and\n * {@link module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}).\n *\n * @fires DragBoxEvent\n * @api\n */\nclass DragBox extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {DragBoxOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {DragBoxOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {DragBoxOnSignature<void>}\n */\n this.un;\n\n options = options ?? {};\n\n /**\n * @type {import(\"../render/Box.js\").default}\n * @private\n */\n this.box_ = new RenderBox(options.className || 'ol-dragbox');\n\n /**\n * @type {number}\n * @private\n */\n this.minArea_ = options.minArea ?? 64;\n\n if (options.onBoxEnd) {\n this.onBoxEnd = options.onBoxEnd;\n }\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.startPixel_ = null;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ?? mouseActionButton;\n\n /**\n * @private\n * @type {EndCondition}\n */\n this.boxEndCondition_ =\n options.boxEndCondition ?? this.defaultBoxEndCondition;\n }\n\n /**\n * The default condition for determining whether the boxend event\n * should fire.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent The originating MapBrowserEvent\n * leading to the box end.\n * @param {import(\"../pixel.js\").Pixel} startPixel The starting pixel of the box.\n * @param {import(\"../pixel.js\").Pixel} endPixel The end pixel of the box.\n * @return {boolean} Whether or not the boxend condition should be fired.\n */\n defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {\n const width = endPixel[0] - startPixel[0];\n const height = endPixel[1] - startPixel[1];\n return width * width + height * height >= this.minArea_;\n }\n\n /**\n * Returns geometry of last drawn box.\n * @return {import(\"../geom/Polygon.js\").default} Geometry.\n * @api\n */\n getGeometry() {\n return this.box_.getGeometry();\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n if (!this.startPixel_) {\n return;\n }\n\n this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);\n\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXDRAG,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (!this.startPixel_) {\n return false;\n }\n\n const completeBox = this.boxEndCondition_(\n mapBrowserEvent,\n this.startPixel_,\n mapBrowserEvent.pixel,\n );\n if (completeBox) {\n this.onBoxEnd(mapBrowserEvent);\n }\n this.dispatchEvent(\n new DragBoxEvent(\n completeBox ? DragBoxEventType.BOXEND : DragBoxEventType.BOXCANCEL,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n\n this.box_.setMap(null);\n this.startPixel_ = null;\n\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.condition_(mapBrowserEvent)) {\n this.startPixel_ = mapBrowserEvent.pixel;\n this.box_.setMap(mapBrowserEvent.map);\n this.box_.setPixels(this.startPixel_, this.startPixel_);\n this.dispatchEvent(\n new DragBoxEvent(\n DragBoxEventType.BOXSTART,\n mapBrowserEvent.coordinate,\n mapBrowserEvent,\n ),\n );\n return true;\n }\n return false;\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n */\n onBoxEnd(event) {}\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (!active) {\n this.box_.setMap(null);\n if (this.startPixel_) {\n this.dispatchEvent(\n new DragBoxEvent(DragBoxEventType.BOXCANCEL, this.startPixel_, null),\n );\n this.startPixel_ = null;\n }\n }\n\n super.setActive(active);\n }\n\n /**\n * @param {import(\"../Map.js\").default|null} map Map.\n * @override\n */\n setMap(map) {\n const oldMap = this.getMap();\n\n if (oldMap) {\n this.box_.setMap(null);\n\n if (this.startPixel_) {\n this.dispatchEvent(\n new DragBoxEvent(DragBoxEventType.BOXCANCEL, this.startPixel_, null),\n );\n this.startPixel_ = null;\n }\n }\n\n super.setMap(map);\n }\n}\n\nexport default DragBox;\n","/**\n * @module ol/interaction/DragZoom\n */\nimport {easeOut} from '../easing.js';\nimport {shiftKeyOnly} from '../events/condition.js';\nimport DragBox from './DragBox.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-dragzoom'] CSS class name for styling the\n * box.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.shiftKeyOnly}.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {boolean} [out=false] Use interaction for zooming out.\n * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default\n * `boxEndCondition` function.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by clicking and dragging on the map,\n * normally combined with a {@link module:ol/events/condition} that limits\n * it to when a key, shift by default, is held down.\n *\n * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or\n * your custom one configured with `className`.\n * @api\n */\nclass DragZoom extends DragBox {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const condition = options.condition ? options.condition : shiftKeyOnly;\n\n super({\n condition: condition,\n className: options.className || 'ol-dragzoom',\n minArea: options.minArea,\n });\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n /**\n * @private\n * @type {boolean}\n */\n this.out_ = options.out !== undefined ? options.out : false;\n }\n\n /**\n * Function to execute just before `onboxend` is fired\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @override\n */\n onBoxEnd(event) {\n const map = this.getMap();\n const view = /** @type {!import(\"../View.js\").default} */ (map.getView());\n let geometry = this.getGeometry();\n\n if (this.out_) {\n const rotatedExtent = view.rotatedExtentForGeometry(geometry);\n const resolution = view.getResolutionForExtentInternal(rotatedExtent);\n const factor = view.getResolution() / resolution;\n geometry = geometry.clone();\n geometry.scale(factor * factor);\n }\n\n view.fitInternal(geometry, {\n duration: this.duration_,\n easing: easeOut,\n });\n }\n}\n\nexport default DragZoom;\n","/**\n * @module ol/events/Key\n */\n\n/**\n * @enum {string}\n * @const\n */\nexport default {\n LEFT: 'ArrowLeft',\n UP: 'ArrowUp',\n RIGHT: 'ArrowRight',\n DOWN: 'ArrowDown',\n};\n","/**\n * @module ol/interaction/KeyboardPan\n */\nimport {rotate as rotateCoordinate} from '../coordinate.js';\nimport EventType from '../events/EventType.js';\nimport Key from '../events/Key.js';\nimport {noModifierKeys, targetNotEditable} from '../events/condition.js';\nimport Interaction, {pan} from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition.noModifierKeys} and\n * {@link module:ol/events/condition.targetNotEditable}.\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {number} [pixelDelta=128] The amount of pixels to pan on each key\n * press.\n */\n\n/**\n * @classdesc\n * Allows the user to pan the map using keyboard arrows.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.\n * @api\n */\nclass KeyboardPan extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options || {};\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultCondition_ = function (mapBrowserEvent) {\n return (\n noModifierKeys(mapBrowserEvent) && targetNotEditable(mapBrowserEvent)\n );\n };\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ =\n options.condition !== undefined\n ? options.condition\n : this.defaultCondition_;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelDelta_ =\n options.pixelDelta !== undefined ? options.pixelDelta : 128;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides the direction to pan to (if an arrow key was\n * pressed).\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (mapBrowserEvent.type == EventType.KEYDOWN) {\n const keyEvent = /** @type {KeyboardEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const key = keyEvent.key;\n if (\n this.condition_(mapBrowserEvent) &&\n (key == Key.DOWN ||\n key == Key.LEFT ||\n key == Key.RIGHT ||\n key == Key.UP)\n ) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const mapUnitsDelta = view.getResolution() * this.pixelDelta_;\n let deltaX = 0,\n deltaY = 0;\n if (key == Key.DOWN) {\n deltaY = -mapUnitsDelta;\n } else if (key == Key.LEFT) {\n deltaX = -mapUnitsDelta;\n } else if (key == Key.RIGHT) {\n deltaX = mapUnitsDelta;\n } else {\n deltaY = mapUnitsDelta;\n }\n const delta = [deltaX, deltaY];\n rotateCoordinate(delta, view.getRotation());\n pan(view, delta, this.duration_);\n keyEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardPan;\n","/**\n * @module ol/interaction/KeyboardZoom\n */\nimport EventType from '../events/EventType.js';\nimport {platformModifierKey, targetNotEditable} from '../events/condition.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=100] Animation duration in milliseconds.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. The default condition is\n * that {@link module:ol/events/condition.targetNotEditable} is fulfilled and that\n * the platform modifier key isn't pressed\n * (!{@link module:ol/events/condition.platformModifierKey}).\n * @property {number} [delta=1] The zoom level delta on each key press.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map using keyboard + and -.\n * Note that, although this interaction is by default included in maps,\n * the keys can only be used when browser focus is on the element to which\n * the keyboard events are attached. By default, this is the map div,\n * though you can change this with the `keyboardEventTarget` in\n * {@link module:ol/Map~Map}. `document` never loses focus but, for any other\n * element, focus will have to be on, and returned to, this element if the keys\n * are to function.\n * See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.\n * @api\n */\nclass KeyboardZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition\n ? options.condition\n : function (mapBrowserEvent) {\n return (\n !platformModifierKey(mapBrowserEvent) &&\n targetNotEditable(mapBrowserEvent)\n );\n };\n\n /**\n * @private\n * @type {number}\n */\n this.delta_ = options.delta ? options.delta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 100;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a\n * `KeyEvent`, and decides whether to zoom in or out (depending on whether the\n * key pressed was '+' or '-').\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n let stopEvent = false;\n if (\n mapBrowserEvent.type == EventType.KEYDOWN ||\n mapBrowserEvent.type == EventType.KEYPRESS\n ) {\n const keyEvent = /** @type {KeyboardEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const key = keyEvent.key;\n if (this.condition_(mapBrowserEvent) && (key === '+' || key === '-')) {\n const map = mapBrowserEvent.map;\n const delta = key === '+' ? this.delta_ : -this.delta_;\n const view = map.getView();\n zoomByDelta(view, delta, undefined, this.duration_);\n keyEvent.preventDefault();\n stopEvent = true;\n }\n }\n return !stopEvent;\n }\n}\n\nexport default KeyboardZoom;\n","/**\n * @module ol/interaction/MouseWheelZoom\n */\nimport EventType from '../events/EventType.js';\nimport {all, always, focusWithTabindex} from '../events/condition.js';\nimport {clamp} from '../math.js';\nimport Interaction, {zoomByDelta} from './Interaction.js';\n\n/**\n * @typedef {'trackpad' | 'wheel'} Mode\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. Default is\n * {@link module:ol/events/condition.always}.\n * @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,\n * the interaction will only handle events when the map has the focus.\n * @property {number} [maxDelta=1] Maximum mouse wheel delta.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.\n * @property {boolean} [useAnchor=true] Enable zooming using the mouse's\n * location as the anchor. When set to `false`, zooming in and out will zoom to\n * the center of the screen instead of zooming on the mouse's location.\n * @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom\n * event will always animate to the closest zoom level after an interaction;\n * false means intermediary zoom levels are allowed.\n */\n\n/**\n * Mutliplier for the DOM_DELTA_LINE delta value.\n * @type {number}\n */\nconst DELTA_LINE_MULTIPLIER = 40;\n\n/**\n * Mutliplier for the DOM_DELTA_PAGE delta value.\n * @type {number}\n */\nconst DELTA_PAGE_MULTIPLIER = 300;\n\n/**\n * @classdesc\n * Allows the user to zoom the map by scrolling the mouse wheel.\n * @api\n */\nclass MouseWheelZoom extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n /**\n * @private\n * @type {number}\n */\n this.totalDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.lastDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @private\n * @type {number}\n */\n this.timeout_ = options.timeout !== undefined ? options.timeout : 80;\n\n /**\n * @private\n * @type {boolean}\n */\n this.useAnchor_ =\n options.useAnchor !== undefined ? options.useAnchor : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.constrainResolution_ =\n options.constrainResolution !== undefined\n ? options.constrainResolution\n : false;\n\n const condition = options.condition ? options.condition : always;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.onFocusOnly\n ? all(focusWithTabindex, condition)\n : condition;\n\n /**\n * @private\n * @type {?import(\"../pixel.js\").Pixel}\n */\n this.lastAnchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.startTime_ = undefined;\n\n /**\n * @private\n * @type {ReturnType<typeof setTimeout>}\n */\n this.timeoutId_;\n\n /**\n * @private\n * @type {Mode|undefined}\n */\n this.mode_ = undefined;\n\n /**\n * Trackpad events separated by this delay will be considered separate\n * interactions.\n * @private\n * @type {number}\n */\n this.trackpadEventGap_ = 400;\n\n /**\n * @private\n * @type {ReturnType<typeof setTimeout>}\n */\n this.trackpadTimeoutId_;\n\n /**\n * The number of delta values per zoom level\n * @private\n * @type {number}\n */\n this.deltaPerZoom_ = 300;\n }\n\n /**\n * @private\n */\n endInteraction_() {\n this.trackpadTimeoutId_ = undefined;\n const map = this.getMap();\n if (!map) {\n return;\n }\n const view = map.getView();\n view.endInteraction(\n undefined,\n this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0,\n this.lastAnchor_ ? map.getCoordinateFromPixel(this.lastAnchor_) : null,\n );\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually\n * zooms the map.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!this.condition_(mapBrowserEvent)) {\n return true;\n }\n const type = mapBrowserEvent.type;\n if (type !== EventType.WHEEL) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const wheelEvent = /** @type {WheelEvent} */ (\n mapBrowserEvent.originalEvent\n );\n wheelEvent.preventDefault();\n\n if (this.useAnchor_) {\n this.lastAnchor_ = mapBrowserEvent.pixel;\n }\n\n // Delta normalisation inspired by\n // https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js\n let delta = wheelEvent.deltaY;\n\n switch (wheelEvent.deltaMode) {\n case WheelEvent.DOM_DELTA_LINE:\n delta *= DELTA_LINE_MULTIPLIER;\n break;\n case WheelEvent.DOM_DELTA_PAGE:\n delta *= DELTA_PAGE_MULTIPLIER;\n break;\n default:\n // pass\n }\n\n if (delta === 0) {\n return false;\n }\n this.lastDelta_ = delta;\n\n const now = Date.now();\n\n if (this.startTime_ === undefined) {\n this.startTime_ = now;\n }\n\n if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {\n this.mode_ = Math.abs(delta) < 4 ? 'trackpad' : 'wheel';\n }\n\n const view = map.getView();\n if (\n this.mode_ === 'trackpad' &&\n !(view.getConstrainResolution() || this.constrainResolution_)\n ) {\n if (this.trackpadTimeoutId_) {\n clearTimeout(this.trackpadTimeoutId_);\n } else {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.beginInteraction();\n }\n this.trackpadTimeoutId_ = setTimeout(\n this.endInteraction_.bind(this),\n this.timeout_,\n );\n view.adjustZoom(\n -delta / this.deltaPerZoom_,\n this.lastAnchor_ ? map.getCoordinateFromPixel(this.lastAnchor_) : null,\n );\n this.startTime_ = now;\n return false;\n }\n\n this.totalDelta_ += delta;\n\n const timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0);\n\n clearTimeout(this.timeoutId_);\n this.timeoutId_ = setTimeout(\n this.handleWheelZoom_.bind(this, map),\n timeLeft,\n );\n\n return false;\n }\n\n /**\n * @private\n * @param {import(\"../Map.js\").default} map Map.\n */\n handleWheelZoom_(map) {\n const view = map.getView();\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n let delta =\n -clamp(\n this.totalDelta_,\n -this.maxDelta_ * this.deltaPerZoom_,\n this.maxDelta_ * this.deltaPerZoom_,\n ) / this.deltaPerZoom_;\n if (view.getConstrainResolution() || this.constrainResolution_) {\n // view has a zoom constraint, zoom by 1\n delta = delta ? (delta > 0 ? 1 : -1) : 0;\n }\n zoomByDelta(\n view,\n delta,\n this.lastAnchor_ ? map.getCoordinateFromPixel(this.lastAnchor_) : null,\n this.duration_,\n );\n\n this.mode_ = undefined;\n this.totalDelta_ = 0;\n this.lastAnchor_ = null;\n this.startTime_ = undefined;\n this.timeoutId_ = undefined;\n }\n\n /**\n * Enable or disable using the mouse's location as an anchor when zooming\n * @param {boolean} useAnchor true to zoom to the mouse's location, false\n * to zoom to the center of the map\n * @api\n */\n setMouseAnchor(useAnchor) {\n this.useAnchor_ = useAnchor;\n if (!useAnchor) {\n this.lastAnchor_ = null;\n }\n }\n}\n\nexport default MouseWheelZoom;\n","/**\n * @module ol/interaction/PinchRotate\n */\nimport {FALSE} from '../functions.js';\nimport {disable} from '../rotationconstraint.js';\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] The duration of the animation in\n * milliseconds.\n * @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.\n */\n\n/**\n * @classdesc\n * Allows the user to rotate the map by twisting with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchRotate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotating_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.rotationDelta_ = 0.0;\n\n /**\n * @private\n * @type {number}\n */\n this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n let rotationDelta = 0.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n\n // angle between touches\n const angle = Math.atan2(\n touch1.clientY - touch0.clientY,\n touch1.clientX - touch0.clientX,\n );\n\n if (this.lastAngle_ !== undefined) {\n const delta = angle - this.lastAngle_;\n this.rotationDelta_ += delta;\n if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) {\n this.rotating_ = true;\n }\n rotationDelta = delta;\n }\n this.lastAngle_ = angle;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n if (view.getConstraints().rotation === disable) {\n return;\n }\n\n // rotate anchor point.\n // FIXME: should be the intersection point between the lines:\n // touch0,touch1 and previousTouch0,previousTouch1\n this.anchor_ = map.getCoordinateFromPixelInternal(\n map.getEventPixel(centroidFromPointers(this.targetPointers)),\n );\n\n // rotate\n if (this.rotating_) {\n map.render();\n view.adjustRotationInternal(rotationDelta, this.anchor_);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n view.endInteraction(this.duration_);\n return false;\n }\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastAngle_ = undefined;\n this.rotating_ = false;\n this.rotationDelta_ = 0.0;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n}\n\nexport default PinchRotate;\n","/**\n * @module ol/interaction/PinchZoom\n */\nimport {FALSE} from '../functions.js';\nimport PointerInteraction, {\n centroid as centroidFromPointers,\n} from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=400] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by pinching with two fingers\n * on a touch screen.\n * @api\n */\nclass PinchZoom extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate}\n */\n this.anchor_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 400;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastDistance_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.lastScaleDelta_ = 1;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n let scaleDelta = 1.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.targetPointers[1];\n const dx = touch0.clientX - touch1.clientX;\n const dy = touch0.clientY - touch1.clientY;\n\n // distance between touches\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (this.lastDistance_ !== undefined) {\n scaleDelta = this.lastDistance_ / distance;\n }\n this.lastDistance_ = distance;\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n\n if (scaleDelta != 1.0) {\n this.lastScaleDelta_ = scaleDelta;\n }\n\n // scale anchor point.\n this.anchor_ = map.getCoordinateFromPixelInternal(\n map.getEventPixel(centroidFromPointers(this.targetPointers)),\n );\n\n // scale, bypass the resolution constraint\n map.render();\n view.adjustResolutionInternal(scaleDelta, this.anchor_);\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length < 2) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n return false;\n }\n return true;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length >= 2) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastDistance_ = undefined;\n this.lastScaleDelta_ = 1;\n if (!this.handlingDownUpSequence) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n}\n\nexport default PinchZoom;\n","/**\n * @module ol/interaction/defaults\n */\nimport Collection from '../Collection.js';\nimport Kinetic from '../Kinetic.js';\nimport DoubleClickZoom from './DoubleClickZoom.js';\nimport DragPan from './DragPan.js';\nimport DragRotate from './DragRotate.js';\nimport DragZoom from './DragZoom.js';\nimport KeyboardPan from './KeyboardPan.js';\nimport KeyboardZoom from './KeyboardZoom.js';\nimport MouseWheelZoom from './MouseWheelZoom.js';\nimport PinchRotate from './PinchRotate.js';\nimport PinchZoom from './PinchZoom.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is\n * desired.\n * @property {boolean} [onFocusOnly=false] Interact only when the map has the\n * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is\n * useful when page scroll is desired for maps that do not have the browser's\n * focus.\n * @property {boolean} [doubleClickZoom=true] Whether double click zoom is\n * desired.\n * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.\n * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.\n * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.\n * @property {boolean} [dragPan=true] Whether drag pan is desired.\n * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.\n * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.\n * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.\n * @property {number} [zoomDuration] Duration of the zoom animation in\n * milliseconds.\n */\n\n/**\n * Set of interactions included in maps by default. Specific interactions can be\n * excluded by setting the appropriate option to false in the constructor\n * options, but the order of the interactions is fixed. If you want to specify\n * a different order for interactions, you will need to create your own\n * {@link module:ol/interaction/Interaction~Interaction} instances and insert\n * them into a {@link module:ol/Collection~Collection} in the order you want\n * before creating your {@link module:ol/Map~Map} instance. Changing the order can\n * be of interest if the event propagation needs to be stopped at a point.\n * The default set of interactions, in sequence, is:\n * {@link module:ol/interaction/DragRotate~DragRotate}\n * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}\n * {@link module:ol/interaction/DragPan~DragPan}\n * {@link module:ol/interaction/PinchRotate~PinchRotate}\n * {@link module:ol/interaction/PinchZoom~PinchZoom}\n * {@link module:ol/interaction/KeyboardPan~KeyboardPan}\n * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}\n * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}\n * {@link module:ol/interaction/DragZoom~DragZoom}\n *\n * @param {DefaultsOptions} [options] Defaults options.\n * @return {Collection<import(\"./Interaction.js\").default>}\n * A collection of interactions to be used with the {@link module:ol/Map~Map}\n * constructor's `interactions` option.\n * @api\n */\nexport function defaults(options) {\n options = options ? options : {};\n\n /** @type {Collection<import(\"./Interaction.js\").default>} */\n const interactions = new Collection();\n\n const kinetic = new Kinetic(-0.005, 0.05, 100);\n\n const altShiftDragRotate =\n options.altShiftDragRotate !== undefined\n ? options.altShiftDragRotate\n : true;\n if (altShiftDragRotate) {\n interactions.push(new DragRotate());\n }\n\n const doubleClickZoom =\n options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;\n if (doubleClickZoom) {\n interactions.push(\n new DoubleClickZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const dragPan = options.dragPan !== undefined ? options.dragPan : true;\n if (dragPan) {\n interactions.push(\n new DragPan({\n onFocusOnly: options.onFocusOnly,\n kinetic: kinetic,\n }),\n );\n }\n\n const pinchRotate =\n options.pinchRotate !== undefined ? options.pinchRotate : true;\n if (pinchRotate) {\n interactions.push(new PinchRotate());\n }\n\n const pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;\n if (pinchZoom) {\n interactions.push(\n new PinchZoom({\n duration: options.zoomDuration,\n }),\n );\n }\n\n const keyboard = options.keyboard !== undefined ? options.keyboard : true;\n if (keyboard) {\n interactions.push(new KeyboardPan());\n interactions.push(\n new KeyboardZoom({\n delta: options.zoomDelta,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const mouseWheelZoom =\n options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;\n if (mouseWheelZoom) {\n interactions.push(\n new MouseWheelZoom({\n onFocusOnly: options.onFocusOnly,\n duration: options.zoomDuration,\n }),\n );\n }\n\n const shiftDragZoom =\n options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;\n if (shiftDragZoom) {\n interactions.push(\n new DragZoom({\n duration: options.zoomDuration,\n }),\n );\n }\n\n return interactions;\n}\n","/**\n * @module ol/layer/Property\n */\n\n/**\n * @enum {string}\n */\nexport default {\n OPACITY: 'opacity',\n VISIBLE: 'visible',\n EXTENT: 'extent',\n Z_INDEX: 'zIndex',\n MAX_RESOLUTION: 'maxResolution',\n MIN_RESOLUTION: 'minResolution',\n MAX_ZOOM: 'maxZoom',\n MIN_ZOOM: 'minZoom',\n SOURCE: 'source',\n MAP: 'map',\n};\n","/**\n * @module ol/layer/Base\n */\nimport BaseObject from '../Object.js';\nimport {assert} from '../asserts.js';\nimport {clamp} from '../math.js';\nimport {abstract} from '../util.js';\nimport LayerProperty from './Property.js';\n\n/**\n * A css color, or a function called with a view resolution returning a css color.\n *\n * @typedef {string|function(number):string} BackgroundColor\n * @api\n */\n\n/**\n * @typedef {import(\"../ObjectEventType\").Types|'change:extent'|'change:maxResolution'|'change:maxZoom'|\n * 'change:minResolution'|'change:minZoom'|'change:opacity'|'change:visible'|'change:zIndex'} BaseLayerObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<BaseLayerObjectEventTypes, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|BaseLayerObjectEventTypes, Return>} BaseLayerOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number | undefined} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Note that with {@link module:ol/layer/Base~BaseLayer} and all its subclasses, any property set in\n * the options is set as a {@link module:ol/Object~BaseObject} property on the layer object, so\n * is observable, and has get/set accessors.\n *\n * @api\n */\nclass BaseLayer extends BaseObject {\n /**\n * @param {Options} options Layer options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {BaseLayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {BaseLayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {BaseLayerOnSignature<void>}\n */\n this.un;\n\n /**\n * @type {BackgroundColor|false}\n * @private\n */\n this.background_ = options.background;\n\n /**\n * @type {Object<string, *>}\n */\n const properties = Object.assign({}, options);\n if (typeof options.properties === 'object') {\n delete properties.properties;\n Object.assign(properties, options.properties);\n }\n\n properties[LayerProperty.OPACITY] =\n options.opacity !== undefined ? options.opacity : 1;\n assert(\n typeof properties[LayerProperty.OPACITY] === 'number',\n 'Layer opacity must be a number',\n );\n\n properties[LayerProperty.VISIBLE] =\n options.visible !== undefined ? options.visible : true;\n properties[LayerProperty.Z_INDEX] = options.zIndex;\n properties[LayerProperty.MAX_RESOLUTION] =\n options.maxResolution !== undefined ? options.maxResolution : Infinity;\n properties[LayerProperty.MIN_RESOLUTION] =\n options.minResolution !== undefined ? options.minResolution : 0;\n properties[LayerProperty.MIN_ZOOM] =\n options.minZoom !== undefined ? options.minZoom : -Infinity;\n properties[LayerProperty.MAX_ZOOM] =\n options.maxZoom !== undefined ? options.maxZoom : Infinity;\n\n /**\n * @type {string}\n * @private\n */\n this.className_ =\n properties.className !== undefined ? properties.className : 'ol-layer';\n delete properties.className;\n\n this.setProperties(properties);\n\n /**\n * @type {import(\"./Layer.js\").State}\n * @private\n */\n this.state_ = null;\n }\n\n /**\n * Get the background for this layer.\n * @return {BackgroundColor|false} Layer background.\n */\n getBackground() {\n return this.background_;\n }\n\n /**\n * @return {string} CSS class name.\n */\n getClassName() {\n return this.className_;\n }\n\n /**\n * This method is not meant to be called by layers or layer renderers because the state\n * is incorrect if the layer is included in a layer group.\n *\n * @param {boolean} [managed] Layer is managed.\n * @return {import(\"./Layer.js\").State} Layer state.\n */\n getLayerState(managed) {\n /** @type {import(\"./Layer.js\").State} */\n const state =\n this.state_ ||\n /** @type {?} */ ({\n layer: this,\n managed: managed === undefined ? true : managed,\n });\n const zIndex = this.getZIndex();\n state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);\n state.visible = this.getVisible();\n state.extent = this.getExtent();\n state.zIndex = zIndex === undefined && !state.managed ? Infinity : zIndex;\n state.maxResolution = this.getMaxResolution();\n state.minResolution = Math.max(this.getMinResolution(), 0);\n state.minZoom = this.getMinZoom();\n state.maxZoom = this.getMaxZoom();\n this.state_ = state;\n\n return state;\n }\n\n /**\n * @abstract\n * @param {Array<import(\"./Layer.js\").default>} [array] Array of layers (to be\n * modified in place).\n * @return {Array<import(\"./Layer.js\").default>} Array of layers.\n */\n getLayersArray(array) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {Array<import(\"./Layer.js\").State>} [states] Optional list of layer\n * states (to be modified in place).\n * @return {Array<import(\"./Layer.js\").State>} List of layer states.\n */\n getLayerStatesArray(states) {\n return abstract();\n }\n\n /**\n * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it\n * will be visible regardless of extent.\n * @return {import(\"../extent.js\").Extent|undefined} The layer extent.\n * @observable\n * @api\n */\n getExtent() {\n return /** @type {import(\"../extent.js\").Extent|undefined} */ (\n this.get(LayerProperty.EXTENT)\n );\n }\n\n /**\n * Return the maximum resolution of the layer. Returns Infinity if\n * the layer has no maximum resolution set.\n * @return {number} The maximum resolution of the layer.\n * @observable\n * @api\n */\n getMaxResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_RESOLUTION));\n }\n\n /**\n * Return the minimum resolution of the layer. Returns 0 if\n * the layer has no minimum resolution set.\n * @return {number} The minimum resolution of the layer.\n * @observable\n * @api\n */\n getMinResolution() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_RESOLUTION));\n }\n\n /**\n * Return the minimum zoom level of the layer. Returns -Infinity if\n * the layer has no minimum zoom set.\n * @return {number} The minimum zoom level of the layer.\n * @observable\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MIN_ZOOM));\n }\n\n /**\n * Return the maximum zoom level of the layer. Returns Infinity if\n * the layer has no maximum zoom set.\n * @return {number} The maximum zoom level of the layer.\n * @observable\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (this.get(LayerProperty.MAX_ZOOM));\n }\n\n /**\n * Return the opacity of the layer (between 0 and 1).\n * @return {number} The opacity of the layer.\n * @observable\n * @api\n */\n getOpacity() {\n return /** @type {number} */ (this.get(LayerProperty.OPACITY));\n }\n\n /**\n * @abstract\n * @return {import(\"../source/Source.js\").State} Source state.\n */\n getSourceState() {\n return abstract();\n }\n\n /**\n * Return the value of this layer's `visible` property. To find out whether the layer\n * is visible on a map, use `isVisible()` instead.\n * @return {boolean} The value of the `visible` property of the layer.\n * @observable\n * @api\n */\n getVisible() {\n return /** @type {boolean} */ (this.get(LayerProperty.VISIBLE));\n }\n\n /**\n * Return the Z-index of the layer, which is used to order layers before\n * rendering. Returns undefined if the layer is unmanaged.\n * @return {number|undefined} The Z-index of the layer.\n * @observable\n * @api\n */\n getZIndex() {\n return /** @type {number|undefined} */ (this.get(LayerProperty.Z_INDEX));\n }\n\n /**\n * Sets the background color.\n * @param {BackgroundColor} [background] Background color.\n */\n setBackground(background) {\n this.background_ = background;\n this.changed();\n }\n\n /**\n * Set the extent at which the layer is visible. If `undefined`, the layer\n * will be visible at all extents.\n * @param {import(\"../extent.js\").Extent|undefined} extent The extent of the layer.\n * @observable\n * @api\n */\n setExtent(extent) {\n this.set(LayerProperty.EXTENT, extent);\n }\n\n /**\n * Set the maximum resolution at which the layer is visible.\n * @param {number} maxResolution The maximum resolution of the layer.\n * @observable\n * @api\n */\n setMaxResolution(maxResolution) {\n this.set(LayerProperty.MAX_RESOLUTION, maxResolution);\n }\n\n /**\n * Set the minimum resolution at which the layer is visible.\n * @param {number} minResolution The minimum resolution of the layer.\n * @observable\n * @api\n */\n setMinResolution(minResolution) {\n this.set(LayerProperty.MIN_RESOLUTION, minResolution);\n }\n\n /**\n * Set the maximum zoom (exclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} maxZoom The maximum zoom of the layer.\n * @observable\n * @api\n */\n setMaxZoom(maxZoom) {\n this.set(LayerProperty.MAX_ZOOM, maxZoom);\n }\n\n /**\n * Set the minimum zoom (inclusive) at which the layer is visible.\n * Note that the zoom levels for layer visibility are based on the\n * view zoom level, which may be different from a tile source zoom level.\n * @param {number} minZoom The minimum zoom of the layer.\n * @observable\n * @api\n */\n setMinZoom(minZoom) {\n this.set(LayerProperty.MIN_ZOOM, minZoom);\n }\n\n /**\n * Set the opacity of the layer, allowed values range from 0 to 1.\n * @param {number} opacity The opacity of the layer.\n * @observable\n * @api\n */\n setOpacity(opacity) {\n assert(typeof opacity === 'number', 'Layer opacity must be a number');\n this.set(LayerProperty.OPACITY, opacity);\n }\n\n /**\n * Set the visibility of the layer (`true` or `false`).\n * @param {boolean} visible The visibility of the layer.\n * @observable\n * @api\n */\n setVisible(visible) {\n this.set(LayerProperty.VISIBLE, visible);\n }\n\n /**\n * Set Z-index of the layer, which is used to order layers before rendering.\n * The default Z-index is 0.\n * @param {number} zindex The z-index of the layer.\n * @observable\n * @api\n */\n setZIndex(zindex) {\n this.set(LayerProperty.Z_INDEX, zindex);\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n if (this.state_) {\n this.state_.layer = null;\n this.state_ = null;\n }\n super.disposeInternal();\n }\n}\n\nexport default BaseLayer;\n","/**\n * @module ol/layer/Group\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport {assert} from '../asserts.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {getIntersection} from '../extent.js';\nimport {clear} from '../obj.js';\nimport {getUid} from '../util.js';\nimport BaseLayer from './Base.js';\n\n/**\n * @typedef {'addlayer'|'removelayer'} GroupEventType\n */\n\n/**\n * @classdesc\n * A layer group triggers 'addlayer' and 'removelayer' events when layers are added to or removed from\n * the group or one of its child groups. When a layer group is added to or removed from another layer group,\n * a single event will be triggered (instead of one per layer in the group added or removed).\n */\nexport class GroupEvent extends Event {\n /**\n * @param {GroupEventType} type The event type.\n * @param {BaseLayer} layer The layer.\n */\n constructor(type, layer) {\n super(type);\n\n /**\n * The added or removed layer.\n * @type {BaseLayer}\n * @api\n */\n this.layer = layer;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"./Base\").BaseLayerObjectEventTypes|\n * 'change:layers', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"./Base\").BaseLayerObjectEventTypes|'change:layers', Return>} GroupOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {Array<import(\"./Base.js\").default>|Collection<import(\"./Base.js\").default>} [layers] Child layers.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LAYERS: 'layers',\n};\n\n/**\n * @classdesc\n * A {@link module:ol/Collection~Collection} of layers that are handled together.\n *\n * A generic `change` event is triggered when the group/Collection changes.\n *\n * @api\n */\nclass LayerGroup extends BaseLayer {\n /**\n * @param {Options} [options] Layer options.\n */\n constructor(options) {\n options = options || {};\n const baseOptions = /** @type {Options} */ (Object.assign({}, options));\n delete baseOptions.layers;\n\n let layers = options.layers;\n\n super(baseOptions);\n\n /***\n * @type {GroupOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {GroupOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {GroupOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {Array<import(\"../events.js\").EventsKey>}\n */\n this.layersListenerKeys_ = [];\n\n /**\n * @private\n * @type {Object<string, Array<import(\"../events.js\").EventsKey>>}\n */\n this.listenerKeys_ = {};\n\n this.addChangeListener(Property.LAYERS, this.handleLayersChanged_);\n\n if (layers) {\n if (Array.isArray(layers)) {\n layers = new Collection(layers.slice(), {unique: true});\n } else {\n assert(\n typeof (/** @type {?} */ (layers).getArray) === 'function',\n 'Expected `layers` to be an array or a `Collection`',\n );\n }\n } else {\n layers = new Collection(undefined, {unique: true});\n }\n\n this.setLayers(layers);\n }\n\n /**\n * @private\n */\n handleLayerChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleLayersChanged_() {\n this.layersListenerKeys_.forEach(unlistenByKey);\n this.layersListenerKeys_.length = 0;\n\n const layers = this.getLayers();\n this.layersListenerKeys_.push(\n listen(layers, CollectionEventType.ADD, this.handleLayersAdd_, this),\n listen(\n layers,\n CollectionEventType.REMOVE,\n this.handleLayersRemove_,\n this,\n ),\n );\n\n for (const id in this.listenerKeys_) {\n this.listenerKeys_[id].forEach(unlistenByKey);\n }\n clear(this.listenerKeys_);\n\n const layersArray = layers.getArray();\n for (let i = 0, ii = layersArray.length; i < ii; i++) {\n const layer = layersArray[i];\n this.registerLayerListeners_(layer);\n this.dispatchEvent(new GroupEvent('addlayer', layer));\n }\n this.changed();\n }\n\n /**\n * @param {BaseLayer} layer The layer.\n */\n registerLayerListeners_(layer) {\n const listenerKeys = [\n listen(\n layer,\n ObjectEventType.PROPERTYCHANGE,\n this.handleLayerChange_,\n this,\n ),\n listen(layer, EventType.CHANGE, this.handleLayerChange_, this),\n ];\n\n if (layer instanceof LayerGroup) {\n listenerKeys.push(\n listen(layer, 'addlayer', this.handleLayerGroupAdd_, this),\n listen(layer, 'removelayer', this.handleLayerGroupRemove_, this),\n );\n }\n\n this.listenerKeys_[getUid(layer)] = listenerKeys;\n }\n\n /**\n * @param {GroupEvent} event The layer group event.\n */\n handleLayerGroupAdd_(event) {\n this.dispatchEvent(new GroupEvent('addlayer', event.layer));\n }\n\n /**\n * @param {GroupEvent} event The layer group event.\n */\n handleLayerGroupRemove_(event) {\n this.dispatchEvent(new GroupEvent('removelayer', event.layer));\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<import(\"./Base.js\").default>} collectionEvent CollectionEvent.\n * @private\n */\n handleLayersAdd_(collectionEvent) {\n const layer = collectionEvent.element;\n this.registerLayerListeners_(layer);\n this.dispatchEvent(new GroupEvent('addlayer', layer));\n this.changed();\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<import(\"./Base.js\").default>} collectionEvent CollectionEvent.\n * @private\n */\n handleLayersRemove_(collectionEvent) {\n const layer = collectionEvent.element;\n const key = getUid(layer);\n this.listenerKeys_[key].forEach(unlistenByKey);\n delete this.listenerKeys_[key];\n this.dispatchEvent(new GroupEvent('removelayer', layer));\n this.changed();\n }\n\n /**\n * Returns the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @return {!Collection<import(\"./Base.js\").default>} Collection of\n * {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.\n * @observable\n * @api\n */\n getLayers() {\n return /** @type {!Collection<import(\"./Base.js\").default>} */ (\n this.get(Property.LAYERS)\n );\n }\n\n /**\n * Set the {@link module:ol/Collection~Collection collection} of {@link module:ol/layer/Layer~Layer layers}\n * in this group.\n * @param {!Collection<import(\"./Base.js\").default>} layers Collection of\n * {@link module:ol/layer/Base~BaseLayer layers} that are part of this group.\n * @observable\n * @api\n */\n setLayers(layers) {\n const collection = this.getLayers();\n if (collection) {\n const currentLayers = collection.getArray();\n for (let i = 0, ii = currentLayers.length; i < ii; ++i) {\n this.dispatchEvent(new GroupEvent('removelayer', currentLayers[i]));\n }\n }\n\n this.set(Property.LAYERS, layers);\n }\n\n /**\n * @param {Array<import(\"./Layer.js\").default>} [array] Array of layers (to be modified in place).\n * @return {Array<import(\"./Layer.js\").default>} Array of layers.\n * @override\n */\n getLayersArray(array) {\n array = array !== undefined ? array : [];\n this.getLayers().forEach(function (layer) {\n layer.getLayersArray(array);\n });\n return array;\n }\n\n /**\n * Get the layer states list and use this groups z-index as the default\n * for all layers in this and nested groups, if it is unset at this point.\n * If dest is not provided and this group's z-index is undefined\n * 0 is used a the default z-index.\n * @param {Array<import(\"./Layer.js\").State>} [dest] Optional list\n * of layer states (to be modified in place).\n * @return {Array<import(\"./Layer.js\").State>} List of layer states.\n * @override\n */\n getLayerStatesArray(dest) {\n const states = dest !== undefined ? dest : [];\n const pos = states.length;\n\n this.getLayers().forEach(function (layer) {\n layer.getLayerStatesArray(states);\n });\n\n const ownLayerState = this.getLayerState();\n let defaultZIndex = ownLayerState.zIndex;\n if (!dest && ownLayerState.zIndex === undefined) {\n defaultZIndex = 0;\n }\n for (let i = pos, ii = states.length; i < ii; i++) {\n const layerState = states[i];\n layerState.opacity *= ownLayerState.opacity;\n layerState.visible = layerState.visible && ownLayerState.visible;\n layerState.maxResolution = Math.min(\n layerState.maxResolution,\n ownLayerState.maxResolution,\n );\n layerState.minResolution = Math.max(\n layerState.minResolution,\n ownLayerState.minResolution,\n );\n layerState.minZoom = Math.max(layerState.minZoom, ownLayerState.minZoom);\n layerState.maxZoom = Math.min(layerState.maxZoom, ownLayerState.maxZoom);\n if (ownLayerState.extent !== undefined) {\n if (layerState.extent !== undefined) {\n layerState.extent = getIntersection(\n layerState.extent,\n ownLayerState.extent,\n );\n } else {\n layerState.extent = ownLayerState.extent;\n }\n }\n if (layerState.zIndex === undefined) {\n layerState.zIndex = defaultZIndex;\n }\n }\n\n return states;\n }\n\n /**\n * @return {import(\"../source/Source.js\").State} Source state.\n * @override\n */\n getSourceState() {\n return 'ready';\n }\n}\n\nexport default LayerGroup;\n","/**\n * @module ol/render/EventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered before a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#prerender\n * @api\n */\n PRERENDER: 'prerender',\n\n /**\n * Triggered after a layer is rendered.\n * @event module:ol/render/Event~RenderEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered before layers are composed. When dispatched by the map, the event object will not have\n * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only\n * WebGL layers currently dispatch this event.\n * @event module:ol/render/Event~RenderEvent#precompose\n * @api\n */\n PRECOMPOSE: 'precompose',\n\n /**\n * Triggered after layers are composed. When dispatched by the map, the event object will not have\n * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only\n * WebGL layers currently dispatch this event.\n * @event module:ol/render/Event~RenderEvent#postcompose\n * @api\n */\n POSTCOMPOSE: 'postcompose',\n\n /**\n * Triggered when rendering is complete, i.e. all sources and tiles have\n * finished loading for the current viewport, and all tiles are faded in.\n * The event object will not have a `context` set.\n * @event module:ol/render/Event~RenderEvent#rendercomplete\n * @api\n */\n RENDERCOMPLETE: 'rendercomplete',\n};\n\n/**\n * @typedef {'postrender'|'precompose'|'postcompose'|'rendercomplete'} MapRenderEventTypes\n */\n\n/**\n * @typedef {'postrender'|'prerender'} LayerRenderEventTypes\n */\n","/**\n * @module ol/layer/Layer\n */\nimport View from '../View.js';\nimport {assert} from '../asserts.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {intersects} from '../extent.js';\nimport RenderEventType from '../render/EventType.js';\nimport BaseLayer from './Base.js';\nimport LayerProperty from './Property.js';\n\n/**\n * @typedef {function(import(\"../Map.js\").FrameState):HTMLElement} RenderFunction\n */\n\n/**\n * @typedef {'sourceready'|'change:source'} LayerEventType\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"./Base\").BaseLayerObjectEventTypes|\n * LayerEventType, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<import(\"../render/EventType\").LayerRenderEventTypes, import(\"../render/Event\").default, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"./Base\").BaseLayerObjectEventTypes|LayerEventType|\n * import(\"../render/EventType\").LayerRenderEventTypes, Return>} LayerOnSignature\n */\n\n/**\n * @template {import(\"../source/Source.js\").default} [SourceType=import(\"../source/Source.js\").default]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {SourceType} [source] Source for this layer. If not provided to the constructor,\n * the source can be set by calling {@link module:ol/layer/Layer~Layer#setSource layer.setSource(source)} after\n * construction.\n * @property {import(\"../Map.js\").default|null} [map] Map.\n * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an\n * HTML element. Will overwrite the default rendering for the layer.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./Layer.js\").default} layer Layer.\n * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.\n * @property {boolean} visible Visible.\n * @property {boolean} managed Managed.\n * @property {import(\"../extent.js\").Extent} [extent] Extent.\n * @property {number} zIndex ZIndex.\n * @property {number} maxResolution Maximum resolution.\n * @property {number} minResolution Minimum resolution.\n * @property {number} minZoom Minimum zoom.\n * @property {number} maxZoom Maximum zoom.\n */\n\n/**\n * @classdesc\n * Base class from which all layer types are derived. This should only be instantiated\n * in the case where a custom layer is added to the map with a custom `render` function.\n * Such a function can be specified in the `options` object, and is expected to return an HTML element.\n *\n * A visual representation of raster or vector map data.\n * Layers group together those properties that pertain to how the data is to be\n * displayed, irrespective of the source of that data.\n *\n * Layers are usually added to a map with [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * Components like {@link module:ol/interaction/Draw~Draw} use unmanaged layers\n * internally. These unmanaged layers are associated with the map using\n * [layer.setMap()]{@link module:ol/layer/Layer~Layer#setMap} instead.\n *\n * A generic `change` event is fired when the state of the source changes.\n * A `sourceready` event is fired when the layer's source is ready.\n *\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n * @fires import(\"../events/Event.js\").BaseEvent#sourceready\n *\n * @template {import(\"../source/Source.js\").default} [SourceType=import(\"../source/Source.js\").default]\n * @template {import(\"../renderer/Layer.js\").default} [RendererType=import(\"../renderer/Layer.js\").default]\n * @api\n */\nclass Layer extends BaseLayer {\n /**\n * @param {Options<SourceType>} options Layer options.\n */\n constructor(options) {\n const baseOptions = Object.assign({}, options);\n delete baseOptions.source;\n\n super(baseOptions);\n\n /***\n * @type {LayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {LayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {LayerOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.mapPrecomposeKey_ = null;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.mapRenderKey_ = null;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.sourceChangeKey_ = null;\n\n /**\n * @private\n * @type {RendererType}\n */\n this.renderer_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.sourceReady_ = false;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.rendered = false;\n\n // Overwrite default render method with a custom one\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.map) {\n this.setMap(options.map);\n }\n\n this.addChangeListener(\n LayerProperty.SOURCE,\n this.handleSourcePropertyChange_,\n );\n\n const source = options.source\n ? /** @type {SourceType} */ (options.source)\n : null;\n this.setSource(source);\n }\n\n /**\n * @param {Array<import(\"./Layer.js\").default>} [array] Array of layers (to be modified in place).\n * @return {Array<import(\"./Layer.js\").default>} Array of layers.\n * @override\n */\n getLayersArray(array) {\n array = array ? array : [];\n array.push(this);\n return array;\n }\n\n /**\n * @param {Array<import(\"./Layer.js\").State>} [states] Optional list of layer states (to be modified in place).\n * @return {Array<import(\"./Layer.js\").State>} List of layer states.\n * @override\n */\n getLayerStatesArray(states) {\n states = states ? states : [];\n states.push(this.getLayerState());\n return states;\n }\n\n /**\n * Get the layer source.\n * @return {SourceType|null} The layer source (or `null` if not yet set).\n * @observable\n * @api\n */\n getSource() {\n return /** @type {SourceType} */ (this.get(LayerProperty.SOURCE)) || null;\n }\n\n /**\n * @return {SourceType|null} The source being rendered.\n */\n getRenderSource() {\n return this.getSource();\n }\n\n /**\n * @return {import(\"../source/Source.js\").State} Source state.\n * @override\n */\n getSourceState() {\n const source = this.getSource();\n return !source ? 'undefined' : source.getState();\n }\n\n /**\n * @private\n */\n handleSourceChange_() {\n this.changed();\n if (this.sourceReady_ || this.getSource().getState() !== 'ready') {\n return;\n }\n this.sourceReady_ = true;\n this.dispatchEvent('sourceready');\n }\n\n /**\n * @private\n */\n handleSourcePropertyChange_() {\n if (this.sourceChangeKey_) {\n unlistenByKey(this.sourceChangeKey_);\n this.sourceChangeKey_ = null;\n }\n this.sourceReady_ = false;\n const source = this.getSource();\n if (source) {\n this.sourceChangeKey_ = listen(\n source,\n EventType.CHANGE,\n this.handleSourceChange_,\n this,\n );\n if (source.getState() === 'ready') {\n this.sourceReady_ = true;\n setTimeout(() => {\n this.dispatchEvent('sourceready');\n }, 0);\n }\n }\n this.changed();\n }\n\n /**\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../Feature\").FeatureLike>>} Promise that resolves with\n * an array of features.\n */\n getFeatures(pixel) {\n if (!this.renderer_) {\n return Promise.resolve([]);\n }\n return this.renderer_.getFeatures(pixel);\n }\n\n /**\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.\n */\n getData(pixel) {\n if (!this.renderer_ || !this.rendered) {\n return null;\n }\n return this.renderer_.getData(pixel);\n }\n\n /**\n * The layer is visible on the map view, i.e. within its min/max resolution or zoom and\n * extent, not set to `visible: false`, and not inside a layer group that is set\n * to `visible: false`.\n * @param {View|import(\"../View.js\").ViewStateLayerStateExtent} [view] View or {@link import(\"../Map.js\").FrameState}.\n * Only required when the layer is not added to a map.\n * @return {boolean} The layer is visible in the map view.\n * @api\n */\n isVisible(view) {\n let frameState;\n const map = this.getMapInternal();\n if (!view && map) {\n view = map.getView();\n }\n if (view instanceof View) {\n frameState = {\n viewState: view.getState(),\n extent: view.calculateExtent(),\n };\n } else {\n frameState = view;\n }\n if (!frameState.layerStatesArray && map) {\n frameState.layerStatesArray = map.getLayerGroup().getLayerStatesArray();\n }\n let layerState;\n if (frameState.layerStatesArray) {\n layerState = frameState.layerStatesArray.find(\n (layerState) => layerState.layer === this,\n );\n if (!layerState) {\n return false;\n }\n } else {\n layerState = this.getLayerState();\n }\n\n const layerExtent = this.getExtent();\n\n return (\n inView(layerState, frameState.viewState) &&\n (!layerExtent || intersects(layerExtent, frameState.extent))\n );\n }\n\n /**\n * Get the attributions of the source of this layer for the given view.\n * @param {View|import(\"../View.js\").ViewStateLayerStateExtent} [view] View or {@link import(\"../Map.js\").FrameState}.\n * Only required when the layer is not added to a map.\n * @return {Array<string>} Attributions for this layer at the given view.\n * @api\n */\n getAttributions(view) {\n if (!this.isVisible(view)) {\n return [];\n }\n const getAttributions = this.getSource()?.getAttributions();\n if (!getAttributions) {\n return [];\n }\n const frameState =\n view instanceof View ? view.getViewStateAndExtent() : view;\n let attributions = getAttributions(frameState);\n if (!Array.isArray(attributions)) {\n attributions = [attributions];\n }\n return attributions;\n }\n\n /**\n * In charge to manage the rendering of the layer. One layer type is\n * bounded with one layer renderer.\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target which the renderer may (but need not) use\n * for rendering its content.\n * @return {HTMLElement|null} The rendered element.\n */\n render(frameState, target) {\n const layerRenderer = this.getRenderer();\n\n if (layerRenderer.prepareFrame(frameState)) {\n this.rendered = true;\n return layerRenderer.renderFrame(frameState, target);\n }\n return null;\n }\n\n /**\n * Called when a layer is not visible during a map render.\n */\n unrender() {\n this.rendered = false;\n }\n\n /** @return {string} Declutter */\n getDeclutter() {\n return undefined;\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../layer/Layer.js\").State} layerState Layer state.\n */\n renderDeclutter(frameState, layerState) {}\n\n /**\n * When the renderer follows a layout -> render approach, do the final rendering here.\n * @param {import('../Map.js').FrameState} frameState Frame state\n */\n renderDeferred(frameState) {\n const layerRenderer = this.getRenderer();\n if (!layerRenderer) {\n return;\n }\n layerRenderer.renderDeferred(frameState);\n }\n\n /**\n * For use inside the library only.\n * @param {import(\"../Map.js\").default|null} map Map.\n */\n setMapInternal(map) {\n if (!map) {\n this.unrender();\n }\n this.set(LayerProperty.MAP, map);\n }\n\n /**\n * For use inside the library only.\n * @return {import(\"../Map.js\").default|null} Map.\n */\n getMapInternal() {\n return this.get(LayerProperty.MAP);\n }\n\n /**\n * Sets the layer to be rendered on top of other layers on a map. The map will\n * not manage this layer in its layers collection. This\n * is useful for temporary layers. To remove an unmanaged layer from the map,\n * use `#setMap(null)`.\n *\n * To add the layer to a map and have it managed by the map, use\n * {@link module:ol/Map~Map#addLayer} instead.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n if (this.mapPrecomposeKey_) {\n unlistenByKey(this.mapPrecomposeKey_);\n this.mapPrecomposeKey_ = null;\n }\n if (!map) {\n this.changed();\n }\n if (this.mapRenderKey_) {\n unlistenByKey(this.mapRenderKey_);\n this.mapRenderKey_ = null;\n }\n if (map) {\n this.mapPrecomposeKey_ = listen(\n map,\n RenderEventType.PRECOMPOSE,\n this.handlePrecompose_,\n this,\n );\n this.mapRenderKey_ = listen(this, EventType.CHANGE, map.render, map);\n this.changed();\n }\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} renderEvent Render event\n * @private\n */\n handlePrecompose_(renderEvent) {\n const layerStatesArray =\n /** @type {import(\"../render/Event.js\").default} */ (renderEvent)\n .frameState.layerStatesArray;\n const layerState = this.getLayerState(false);\n assert(\n !layerStatesArray.some(\n (arrayLayerState) => arrayLayerState.layer === layerState.layer,\n ),\n 'A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both.',\n );\n layerStatesArray.push(layerState);\n }\n\n /**\n * Set the layer source.\n * @param {SourceType|null} source The layer source.\n * @observable\n * @api\n */\n setSource(source) {\n this.set(LayerProperty.SOURCE, source);\n }\n\n /**\n * Get the renderer for this layer.\n * @return {RendererType|null} The layer renderer.\n */\n getRenderer() {\n if (!this.renderer_) {\n this.renderer_ = this.createRenderer();\n }\n return this.renderer_;\n }\n\n /**\n * @return {boolean} The layer has a renderer.\n */\n hasRenderer() {\n return !!this.renderer_;\n }\n\n /**\n * Create a renderer for this layer.\n * @return {RendererType} A layer renderer.\n * @protected\n */\n createRenderer() {\n return null;\n }\n\n /**\n * This will clear the renderer so that a new one can be created next time it is needed\n */\n clearRenderer() {\n if (this.renderer_) {\n this.renderer_.dispose();\n delete this.renderer_;\n }\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.clearRenderer();\n this.setSource(null);\n super.disposeInternal();\n }\n}\n\n/**\n * Return `true` if the layer is visible and if the provided view state\n * has resolution and zoom levels that are in range of the layer's min/max.\n * @param {State} layerState Layer state.\n * @param {import(\"../View.js\").State} viewState View state.\n * @return {boolean} The layer is visible at the given view state.\n */\nexport function inView(layerState, viewState) {\n if (!layerState.visible) {\n return false;\n }\n const resolution = viewState.resolution;\n if (\n resolution < layerState.minResolution ||\n resolution >= layerState.maxResolution\n ) {\n return false;\n }\n const zoom = viewState.zoom;\n return zoom > layerState.minZoom && zoom <= layerState.maxZoom;\n}\n\nexport default Layer;\n","\n/**\n * Rearranges items so that all items in the [left, k] are the smallest.\n * The k-th element will have the (k - left + 1)-th smallest value in [left, right].\n *\n * @template T\n * @param {T[]} arr the array to partially sort (in place)\n * @param {number} k middle index for partial sorting (as defined above)\n * @param {number} [left=0] left index of the range to sort\n * @param {number} [right=arr.length-1] right index\n * @param {(a: T, b: T) => number} [compare = (a, b) => a - b] compare function\n */\nexport default function quickselect(arr, k, left = 0, right = arr.length - 1, compare = defaultCompare) {\n\n while (right > left) {\n if (right - left > 600) {\n const n = right - left + 1;\n const m = k - left + 1;\n const z = Math.log(n);\n const s = 0.5 * Math.exp(2 * z / 3);\n const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselect(arr, k, newLeft, newRight, compare);\n }\n\n const t = arr[k];\n let i = left;\n /** @type {number} */\n let j = right;\n\n swap(arr, left, k);\n if (compare(arr[right], t) > 0) swap(arr, left, right);\n\n while (i < j) {\n swap(arr, i, j);\n i++;\n j--;\n while (compare(arr[i], t) < 0) i++;\n while (compare(arr[j], t) > 0) j--;\n }\n\n if (compare(arr[left], t) === 0) swap(arr, left, j);\n else {\n j++;\n swap(arr, j, right);\n }\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n}\n\n/**\n * @template T\n * @param {T[]} arr\n * @param {number} i\n * @param {number} j\n */\nfunction swap(arr, i, j) {\n const tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\n/**\n * @template T\n * @param {T} a\n * @param {T} b\n * @returns {number}\n */\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","import quickselect from 'quickselect';\n\nexport default class RBush {\n constructor(maxEntries = 9) {\n // max entries in a node is 9 by default; min node fill is 40% for best performance\n this._maxEntries = Math.max(4, maxEntries);\n this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));\n this.clear();\n }\n\n all() {\n return this._all(this.data, []);\n }\n\n search(bbox) {\n let node = this.data;\n const result = [];\n\n if (!intersects(bbox, node)) return result;\n\n const toBBox = this.toBBox;\n const nodesToSearch = [];\n\n while (node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const childBBox = node.leaf ? toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf) result.push(child);\n else if (contains(bbox, childBBox)) this._all(child, result);\n else nodesToSearch.push(child);\n }\n }\n node = nodesToSearch.pop();\n }\n\n return result;\n }\n\n collides(bbox) {\n let node = this.data;\n\n if (!intersects(bbox, node)) return false;\n\n const nodesToSearch = [];\n while (node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const childBBox = node.leaf ? this.toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf || contains(bbox, childBBox)) return true;\n nodesToSearch.push(child);\n }\n }\n node = nodesToSearch.pop();\n }\n\n return false;\n }\n\n load(data) {\n if (!(data && data.length)) return this;\n\n if (data.length < this._minEntries) {\n for (let i = 0; i < data.length; i++) {\n this.insert(data[i]);\n }\n return this;\n }\n\n // recursively build the tree with the given data from scratch using OMT algorithm\n let node = this._build(data.slice(), 0, data.length - 1, 0);\n\n if (!this.data.children.length) {\n // save as is if tree is empty\n this.data = node;\n\n } else if (this.data.height === node.height) {\n // split root if trees have the same height\n this._splitRoot(this.data, node);\n\n } else {\n if (this.data.height < node.height) {\n // swap trees if inserted one is bigger\n const tmpNode = this.data;\n this.data = node;\n node = tmpNode;\n }\n\n // insert the small tree into the large tree at appropriate level\n this._insert(node, this.data.height - node.height - 1, true);\n }\n\n return this;\n }\n\n insert(item) {\n if (item) this._insert(item, this.data.height - 1);\n return this;\n }\n\n clear() {\n this.data = createNode([]);\n return this;\n }\n\n remove(item, equalsFn) {\n if (!item) return this;\n\n let node = this.data;\n const bbox = this.toBBox(item);\n const path = [];\n const indexes = [];\n let i, parent, goingUp;\n\n // depth-first iterative tree traversal\n while (node || path.length) {\n\n if (!node) { // go up\n node = path.pop();\n parent = path[path.length - 1];\n i = indexes.pop();\n goingUp = true;\n }\n\n if (node.leaf) { // check current node\n const index = findItem(item, node.children, equalsFn);\n\n if (index !== -1) {\n // item found, remove the item and condense tree upwards\n node.children.splice(index, 1);\n path.push(node);\n this._condense(path);\n return this;\n }\n }\n\n if (!goingUp && !node.leaf && contains(node, bbox)) { // go down\n path.push(node);\n indexes.push(i);\n i = 0;\n parent = node;\n node = node.children[0];\n\n } else if (parent) { // go right\n i++;\n node = parent.children[i];\n goingUp = false;\n\n } else node = null; // nothing found\n }\n\n return this;\n }\n\n toBBox(item) { return item; }\n\n compareMinX(a, b) { return a.minX - b.minX; }\n compareMinY(a, b) { return a.minY - b.minY; }\n\n toJSON() { return this.data; }\n\n fromJSON(data) {\n this.data = data;\n return this;\n }\n\n _all(node, result) {\n const nodesToSearch = [];\n while (node) {\n if (node.leaf) result.push(...node.children);\n else nodesToSearch.push(...node.children);\n\n node = nodesToSearch.pop();\n }\n return result;\n }\n\n _build(items, left, right, height) {\n\n const N = right - left + 1;\n let M = this._maxEntries;\n let node;\n\n if (N <= M) {\n // reached leaf level; return leaf\n node = createNode(items.slice(left, right + 1));\n calcBBox(node, this.toBBox);\n return node;\n }\n\n if (!height) {\n // target height of the bulk-loaded tree\n height = Math.ceil(Math.log(N) / Math.log(M));\n\n // target number of root entries to maximize storage utilization\n M = Math.ceil(N / Math.pow(M, height - 1));\n }\n\n node = createNode([]);\n node.leaf = false;\n node.height = height;\n\n // split the items into M mostly square tiles\n\n const N2 = Math.ceil(N / M);\n const N1 = N2 * Math.ceil(Math.sqrt(M));\n\n multiSelect(items, left, right, N1, this.compareMinX);\n\n for (let i = left; i <= right; i += N1) {\n\n const right2 = Math.min(i + N1 - 1, right);\n\n multiSelect(items, i, right2, N2, this.compareMinY);\n\n for (let j = i; j <= right2; j += N2) {\n\n const right3 = Math.min(j + N2 - 1, right2);\n\n // pack each entry recursively\n node.children.push(this._build(items, j, right3, height - 1));\n }\n }\n\n calcBBox(node, this.toBBox);\n\n return node;\n }\n\n _chooseSubtree(bbox, node, level, path) {\n while (true) {\n path.push(node);\n\n if (node.leaf || path.length - 1 === level) break;\n\n let minArea = Infinity;\n let minEnlargement = Infinity;\n let targetNode;\n\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const area = bboxArea(child);\n const enlargement = enlargedArea(bbox, child) - area;\n\n // choose entry with the least area enlargement\n if (enlargement < minEnlargement) {\n minEnlargement = enlargement;\n minArea = area < minArea ? area : minArea;\n targetNode = child;\n\n } else if (enlargement === minEnlargement) {\n // otherwise choose one with the smallest area\n if (area < minArea) {\n minArea = area;\n targetNode = child;\n }\n }\n }\n\n node = targetNode || node.children[0];\n }\n\n return node;\n }\n\n _insert(item, level, isNode) {\n const bbox = isNode ? item : this.toBBox(item);\n const insertPath = [];\n\n // find the best node for accommodating the item, saving all nodes along the path too\n const node = this._chooseSubtree(bbox, this.data, level, insertPath);\n\n // put the item into the node\n node.children.push(item);\n extend(node, bbox);\n\n // split on node overflow; propagate upwards if necessary\n while (level >= 0) {\n if (insertPath[level].children.length > this._maxEntries) {\n this._split(insertPath, level);\n level--;\n } else break;\n }\n\n // adjust bboxes along the insertion path\n this._adjustParentBBoxes(bbox, insertPath, level);\n }\n\n // split overflowed node into two\n _split(insertPath, level) {\n const node = insertPath[level];\n const M = node.children.length;\n const m = this._minEntries;\n\n this._chooseSplitAxis(node, m, M);\n\n const splitIndex = this._chooseSplitIndex(node, m, M);\n\n const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));\n newNode.height = node.height;\n newNode.leaf = node.leaf;\n\n calcBBox(node, this.toBBox);\n calcBBox(newNode, this.toBBox);\n\n if (level) insertPath[level - 1].children.push(newNode);\n else this._splitRoot(node, newNode);\n }\n\n _splitRoot(node, newNode) {\n // split root node\n this.data = createNode([node, newNode]);\n this.data.height = node.height + 1;\n this.data.leaf = false;\n calcBBox(this.data, this.toBBox);\n }\n\n _chooseSplitIndex(node, m, M) {\n let index;\n let minOverlap = Infinity;\n let minArea = Infinity;\n\n for (let i = m; i <= M - m; i++) {\n const bbox1 = distBBox(node, 0, i, this.toBBox);\n const bbox2 = distBBox(node, i, M, this.toBBox);\n\n const overlap = intersectionArea(bbox1, bbox2);\n const area = bboxArea(bbox1) + bboxArea(bbox2);\n\n // choose distribution with minimum overlap\n if (overlap < minOverlap) {\n minOverlap = overlap;\n index = i;\n\n minArea = area < minArea ? area : minArea;\n\n } else if (overlap === minOverlap) {\n // otherwise choose distribution with minimum area\n if (area < minArea) {\n minArea = area;\n index = i;\n }\n }\n }\n\n return index || M - m;\n }\n\n // sorts node children by the best axis for split\n _chooseSplitAxis(node, m, M) {\n const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;\n const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;\n const xMargin = this._allDistMargin(node, m, M, compareMinX);\n const yMargin = this._allDistMargin(node, m, M, compareMinY);\n\n // if total distributions margin value is minimal for x, sort by minX,\n // otherwise it's already sorted by minY\n if (xMargin < yMargin) node.children.sort(compareMinX);\n }\n\n // total margin of all possible split distributions where each node is at least m full\n _allDistMargin(node, m, M, compare) {\n node.children.sort(compare);\n\n const toBBox = this.toBBox;\n const leftBBox = distBBox(node, 0, m, toBBox);\n const rightBBox = distBBox(node, M - m, M, toBBox);\n let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);\n\n for (let i = m; i < M - m; i++) {\n const child = node.children[i];\n extend(leftBBox, node.leaf ? toBBox(child) : child);\n margin += bboxMargin(leftBBox);\n }\n\n for (let i = M - m - 1; i >= m; i--) {\n const child = node.children[i];\n extend(rightBBox, node.leaf ? toBBox(child) : child);\n margin += bboxMargin(rightBBox);\n }\n\n return margin;\n }\n\n _adjustParentBBoxes(bbox, path, level) {\n // adjust bboxes along the given tree path\n for (let i = level; i >= 0; i--) {\n extend(path[i], bbox);\n }\n }\n\n _condense(path) {\n // go through the path, removing empty nodes and updating bboxes\n for (let i = path.length - 1, siblings; i >= 0; i--) {\n if (path[i].children.length === 0) {\n if (i > 0) {\n siblings = path[i - 1].children;\n siblings.splice(siblings.indexOf(path[i]), 1);\n\n } else this.clear();\n\n } else calcBBox(path[i], this.toBBox);\n }\n }\n}\n\nfunction findItem(item, items, equalsFn) {\n if (!equalsFn) return items.indexOf(item);\n\n for (let i = 0; i < items.length; i++) {\n if (equalsFn(item, items[i])) return i;\n }\n return -1;\n}\n\n// calculate node's bbox from bboxes of its children\nfunction calcBBox(node, toBBox) {\n distBBox(node, 0, node.children.length, toBBox, node);\n}\n\n// min bounding rectangle of node children from k to p-1\nfunction distBBox(node, k, p, toBBox, destNode) {\n if (!destNode) destNode = createNode(null);\n destNode.minX = Infinity;\n destNode.minY = Infinity;\n destNode.maxX = -Infinity;\n destNode.maxY = -Infinity;\n\n for (let i = k; i < p; i++) {\n const child = node.children[i];\n extend(destNode, node.leaf ? toBBox(child) : child);\n }\n\n return destNode;\n}\n\nfunction extend(a, b) {\n a.minX = Math.min(a.minX, b.minX);\n a.minY = Math.min(a.minY, b.minY);\n a.maxX = Math.max(a.maxX, b.maxX);\n a.maxY = Math.max(a.maxY, b.maxY);\n return a;\n}\n\nfunction compareNodeMinX(a, b) { return a.minX - b.minX; }\nfunction compareNodeMinY(a, b) { return a.minY - b.minY; }\n\nfunction bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }\nfunction bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }\n\nfunction enlargedArea(a, b) {\n return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *\n (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));\n}\n\nfunction intersectionArea(a, b) {\n const minX = Math.max(a.minX, b.minX);\n const minY = Math.max(a.minY, b.minY);\n const maxX = Math.min(a.maxX, b.maxX);\n const maxY = Math.min(a.maxY, b.maxY);\n\n return Math.max(0, maxX - minX) *\n Math.max(0, maxY - minY);\n}\n\nfunction contains(a, b) {\n return a.minX <= b.minX &&\n a.minY <= b.minY &&\n b.maxX <= a.maxX &&\n b.maxY <= a.maxY;\n}\n\nfunction intersects(a, b) {\n return b.minX <= a.maxX &&\n b.minY <= a.maxY &&\n b.maxX >= a.minX &&\n b.maxY >= a.minY;\n}\n\nfunction createNode(children) {\n return {\n children,\n height: 1,\n leaf: true,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n}\n\n// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;\n// combines selection algorithm with binary divide & conquer approach\n\nfunction multiSelect(arr, left, right, n, compare) {\n const stack = [left, right];\n\n while (stack.length) {\n right = stack.pop();\n left = stack.pop();\n\n if (right - left <= n) continue;\n\n const mid = left + Math.ceil((right - left) / n / 2) * n;\n quickselect(arr, mid, left, right, compare);\n\n stack.push(left, mid, mid, right);\n }\n}\n","/**\n * @module ol/color\n */\nimport {createCanvasContext2D} from './dom.js';\nimport {clamp, toFixed} from './math.js';\n\n/**\n * A color represented as a short array [red, green, blue, alpha].\n * red, green, and blue should be integers in the range 0..255 inclusive.\n * alpha should be a float in the range 0..1 inclusive. If no alpha value is\n * given then `1` will be used.\n * @typedef {Array<number>} Color\n * @api\n */\n\n/**\n * Color to indicate that no color should be rendered. This is meant to be used for per-reference\n * comparisons only.\n * @type {Color}\n */\nexport const NO_COLOR = [NaN, NaN, NaN, 0];\n\nlet colorParseContext;\n/**\n * @return {CanvasRenderingContext2D} The color parse context\n */\nfunction getColorParseContext() {\n if (!colorParseContext) {\n colorParseContext = createCanvasContext2D(1, 1, undefined, {\n willReadFrequently: true,\n desynchronized: true,\n });\n }\n return colorParseContext;\n}\n\nconst rgbModernRegEx =\n /^rgba?\\(\\s*(\\d+%?)\\s+(\\d+%?)\\s+(\\d+%?)(?:\\s*\\/\\s*(\\d+%|\\d*\\.\\d+|[01]))?\\s*\\)$/i;\nconst rgbLegacyAbsoluteRegEx =\n /^rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)(?:\\s*,\\s*(\\d+%|\\d*\\.\\d+|[01]))?\\s*\\)$/i;\nconst rgbLegacyPercentageRegEx =\n /^rgba?\\(\\s*(\\d+%)\\s*,\\s*(\\d+%)\\s*,\\s*(\\d+%)(?:\\s*,\\s*(\\d+%|\\d*\\.\\d+|[01]))?\\s*\\)$/i;\nconst hexRegEx = /^#([\\da-f]{3,4}|[\\da-f]{6}|[\\da-f]{8})$/i;\n\n/**\n * @param {string} s Color component as number or percentage.\n * @param {number} divider Divider for percentage.\n * @return {number} Color component.\n */\nfunction toColorComponent(s, divider) {\n return s.endsWith('%')\n ? Number(s.substring(0, s.length - 1)) / divider\n : Number(s);\n}\n\n/**\n * @param {string} color Color string.\n */\nfunction throwInvalidColor(color) {\n throw new Error('failed to parse \"' + color + '\" as color');\n}\n\n/**\n * @param {string} color Color string.\n * @return {Color} RGBa color array.\n */\nfunction parseRgba(color) {\n // Fast lane for rgb(a) colors\n if (color.toLowerCase().startsWith('rgb')) {\n const rgb =\n color.match(rgbLegacyAbsoluteRegEx) ||\n color.match(rgbModernRegEx) ||\n color.match(rgbLegacyPercentageRegEx);\n if (rgb) {\n const alpha = rgb[4];\n const rgbDivider = 100 / 255;\n return [\n clamp((toColorComponent(rgb[1], rgbDivider) + 0.5) | 0, 0, 255),\n clamp((toColorComponent(rgb[2], rgbDivider) + 0.5) | 0, 0, 255),\n clamp((toColorComponent(rgb[3], rgbDivider) + 0.5) | 0, 0, 255),\n alpha !== undefined ? clamp(toColorComponent(alpha, 100), 0, 1) : 1,\n ];\n }\n throwInvalidColor(color);\n }\n // Fast lane for hex colors (also with alpha)\n if (color.startsWith('#')) {\n if (hexRegEx.test(color)) {\n const hex = color.substring(1);\n const step = hex.length <= 4 ? 1 : 2;\n const colorFromHex = [0, 0, 0, 255];\n for (let i = 0, ii = hex.length; i < ii; i += step) {\n let colorComponent = parseInt(hex.substring(i, i + step), 16);\n if (step === 1) {\n colorComponent += colorComponent << 4;\n }\n colorFromHex[i / step] = colorComponent;\n }\n colorFromHex[3] = colorFromHex[3] / 255;\n return colorFromHex;\n }\n throwInvalidColor(color);\n }\n // Use canvas color serialization to parse the color into hex or rgba\n // See https://www.w3.org/TR/2021/SPSD-2dcontext-20210128/#serialization-of-a-color\n const context = getColorParseContext();\n context.fillStyle = '#abcdef';\n let invalidCheckFillStyle = context.fillStyle;\n context.fillStyle = color;\n if (context.fillStyle === invalidCheckFillStyle) {\n context.fillStyle = '#fedcba';\n invalidCheckFillStyle = context.fillStyle;\n context.fillStyle = color;\n if (context.fillStyle === invalidCheckFillStyle) {\n throwInvalidColor(color);\n }\n }\n const colorString = context.fillStyle;\n if (colorString.startsWith('#') || colorString.startsWith('rgba')) {\n return parseRgba(colorString);\n }\n context.clearRect(0, 0, 1, 1);\n context.fillRect(0, 0, 1, 1);\n const colorFromImage = Array.from(context.getImageData(0, 0, 1, 1).data);\n colorFromImage[3] = toFixed(colorFromImage[3] / 255, 3);\n return colorFromImage;\n}\n\n/**\n * Return the color as an rgba string.\n * @param {Color|string} color Color.\n * @return {string} Rgba string.\n * @api\n */\nexport function asString(color) {\n if (typeof color === 'string') {\n return color;\n }\n return toString(color);\n}\n\n/**\n * @type {number}\n */\nconst MAX_CACHE_SIZE = 1024;\n\n/**\n * We maintain a small cache of parsed strings. Whenever the cache grows too large,\n * we delete an arbitrary set of the entries.\n *\n * @type {Object<string, Color>}\n */\nconst cache = {};\n\n/**\n * @type {number}\n */\nlet cacheSize = 0;\n\n/**\n * @param {Color} color A color that may or may not have an alpha channel.\n * @return {Color} The input color with an alpha channel. If the input color has\n * an alpha channel, the input color will be returned unchanged. Otherwise, a new\n * array will be returned with the input color and an alpha channel of 1.\n */\nexport function withAlpha(color) {\n if (color.length === 4) {\n return color;\n }\n const output = color.slice();\n output[3] = 1;\n return output;\n}\n\n// The functions b1, b2, a1, a2, rgbaToLcha and lchaToRgba below are adapted from\n// https://stackoverflow.com/a/67219995/2389327\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction b1(v) {\n return v > 0.0031308 ? Math.pow(v, 1 / 2.4) * 269.025 - 14.025 : v * 3294.6;\n}\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction b2(v) {\n return v > 0.2068965 ? Math.pow(v, 3) : (v - 4 / 29) * (108 / 841);\n}\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction a1(v) {\n return v > 10.314724 ? Math.pow((v + 14.025) / 269.025, 2.4) : v / 3294.6;\n}\n\n/**\n * @param {number} v Input value.\n * @return {number} Output value.\n */\nfunction a2(v) {\n return v > 0.0088564 ? Math.pow(v, 1 / 3) : v / (108 / 841) + 4 / 29;\n}\n\n/**\n * @param {Color} color RGBA color.\n * @return {Color} LCHuv color with alpha.\n */\nexport function rgbaToLcha(color) {\n const r = a1(color[0]);\n const g = a1(color[1]);\n const b = a1(color[2]);\n const y = a2(r * 0.222488403 + g * 0.716873169 + b * 0.06060791);\n const l = 500 * (a2(r * 0.452247074 + g * 0.399439023 + b * 0.148375274) - y);\n const q = 200 * (y - a2(r * 0.016863605 + g * 0.117638439 + b * 0.865350722));\n const h = Math.atan2(q, l) * (180 / Math.PI);\n return [\n 116 * y - 16,\n Math.sqrt(l * l + q * q),\n h < 0 ? h + 360 : h,\n color[3],\n ];\n}\n\n/**\n * @param {Color} color LCHuv color with alpha.\n * @return {Color} RGBA color.\n */\nexport function lchaToRgba(color) {\n const l = (color[0] + 16) / 116;\n const c = color[1];\n const h = (color[2] * Math.PI) / 180;\n const y = b2(l);\n const x = b2(l + (c / 500) * Math.cos(h));\n const z = b2(l - (c / 200) * Math.sin(h));\n const r = b1(x * 3.021973625 - y * 1.617392459 - z * 0.404875592);\n const g = b1(x * -0.943766287 + y * 1.916279586 + z * 0.027607165);\n const b = b1(x * 0.069407491 - y * 0.22898585 + z * 1.159737864);\n return [\n clamp((r + 0.5) | 0, 0, 255),\n clamp((g + 0.5) | 0, 0, 255),\n clamp((b + 0.5) | 0, 0, 255),\n color[3],\n ];\n}\n\n/**\n * @param {string} s String.\n * @return {Color} Color.\n */\nexport function fromString(s) {\n if (s === 'none') {\n return NO_COLOR;\n }\n if (cache.hasOwnProperty(s)) {\n return cache[s];\n }\n if (cacheSize >= MAX_CACHE_SIZE) {\n let i = 0;\n for (const key in cache) {\n if ((i++ & 3) === 0) {\n delete cache[key];\n --cacheSize;\n }\n }\n }\n\n const color = parseRgba(s);\n if (color.length !== 4) {\n throwInvalidColor(s);\n }\n for (const c of color) {\n if (isNaN(c)) {\n throwInvalidColor(s);\n }\n }\n cache[s] = color;\n ++cacheSize;\n return color;\n}\n\n/**\n * Return the color as an array. This function maintains a cache of calculated\n * arrays which means the result should not be modified.\n * @param {Color|string} color Color.\n * @return {Color} Color.\n * @api\n */\nexport function asArray(color) {\n if (Array.isArray(color)) {\n return color;\n }\n return fromString(color);\n}\n\n/**\n * @param {Color} color Color.\n * @return {string} String.\n */\nexport function toString(color) {\n let r = color[0];\n if (r != (r | 0)) {\n r = (r + 0.5) | 0;\n }\n let g = color[1];\n if (g != (g | 0)) {\n g = (g + 0.5) | 0;\n }\n let b = color[2];\n if (b != (b | 0)) {\n b = (b + 0.5) | 0;\n }\n const a = color[3] === undefined ? 1 : Math.round(color[3] * 1000) / 1000;\n return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';\n}\n\n/**\n * @param {string} s String.\n * @return {boolean} Whether the string is actually a valid color\n */\nexport function isStringColor(s) {\n try {\n fromString(s);\n return true;\n } catch {\n return false;\n }\n}\n","/**\n * @module ol/size\n */\n\n/**\n * An array of numbers representing a size: `[width, height]`.\n * @typedef {Array<number>} Size\n * @api\n */\n\n/**\n * Returns a buffered size.\n * @param {Size} size Size.\n * @param {number} num The amount by which to buffer.\n * @param {Size} [dest] Optional reusable size array.\n * @return {Size} The buffered size.\n */\nexport function buffer(size, num, dest) {\n if (dest === undefined) {\n dest = [0, 0];\n }\n dest[0] = size[0] + 2 * num;\n dest[1] = size[1] + 2 * num;\n return dest;\n}\n\n/**\n * Determines if a size has a positive area.\n * @param {Size} size The size to test.\n * @return {boolean} The size has a positive area.\n */\nexport function hasArea(size) {\n return size[0] > 0 && size[1] > 0;\n}\n\n/**\n * Returns a size scaled by a ratio. The result will be an array of integers.\n * @param {Size} size Size.\n * @param {number} ratio Ratio.\n * @param {Size} [dest] Optional reusable size array.\n * @return {Size} The scaled size.\n */\nexport function scale(size, ratio, dest) {\n if (dest === undefined) {\n dest = [0, 0];\n }\n dest[0] = (size[0] * ratio + 0.5) | 0;\n dest[1] = (size[1] * ratio + 0.5) | 0;\n return dest;\n}\n\n/**\n * Returns an `Size` array for the passed in number (meaning: square) or\n * `Size` array.\n * (meaning: non-square),\n * @param {number|Size} size Width and height.\n * @param {Size} [dest] Optional reusable size array.\n * @return {Size} Size.\n * @api\n */\nexport function toSize(size, dest) {\n if (Array.isArray(size)) {\n return size;\n }\n if (dest === undefined) {\n dest = [size, size];\n } else {\n dest[0] = size;\n dest[1] = size;\n }\n return dest;\n}\n","/**\n * @module ol/expr/expression\n */\nimport {ascending} from '../array.js';\nimport {fromString as colorFromString} from '../color.js';\nimport {toSize} from '../size.js';\n\n/**\n * @fileoverview This module includes types and functions for parsing array encoded expressions.\n * The result of parsing an encoded expression is one of the specific expression classes.\n * During parsing, information is added to the parsing context about the data accessed by the\n * expression.\n */\n\n/**\n * Base type used for literal style parameters; can be a number literal or the output of an operator,\n * which in turns takes {@link import(\"./expression.js\").ExpressionValue} arguments.\n *\n * See below for details on the available operators (with notes for those that are WebGL or Canvas only).\n *\n * Reading operators:\n * * `['band', bandIndex, xOffset, yOffset]` For tile layers only. Fetches pixel values from band\n * `bandIndex` of the source's data. The first `bandIndex` of the source data is `1`. Fetched values\n * are in the 0..1 range. {@link import(\"../source/TileImage.js\").default} sources have 4 bands: red,\n * green, blue and alpha. {@link import(\"../source/DataTile.js\").default} sources can have any number\n * of bands, depending on the underlying data source and\n * {@link import(\"../source/GeoTIFF.js\").Options configuration}. `xOffset` and `yOffset` are optional\n * and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels (WebGL only).\n * * `['get', attributeName]` fetches a feature property value, similar to `feature.get('attributeName')`.\n * * `['get', attributeName, keyOrArrayIndex, ...]` (Canvas only) Access nested properties and array items of a\n * feature property. The result is `undefined` when there is nothing at the specified key or index.\n * * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'\n * `Multi*` values are returned as their singular equivalent\n * `Circle` geometries are returned as 'Polygon'\n * `GeometryCollection` geometries are returned as the type of the first geometry found in the collection (WebGL only).\n * * `['resolution']` returns the current resolution\n * * `['time']` The time in seconds since the creation of the layer (WebGL only).\n * * `['var', 'varName']` fetches a value from the style variables; will throw an error if that variable is undefined\n * * `['zoom']` The current zoom level (WebGL only).\n * * `['line-metric']` returns the M component of the current point on a line (WebGL only); in case where the geometry layout of the line\n * does not contain an M component (e.g. XY or XYZ), 0 is returned; 0 is also returned for geometries other than lines.\n * Please note that the M component will be linearly interpolated between the two points composing a segment.\n *\n * Math operators:\n * * `['*', value1, value2, ...]` multiplies the values (either numbers or colors)\n * * `['/', value1, value2]` divides `value1` by `value2`\n * * `['+', value1, value2, ...]` adds the values\n * * `['-', value1, value2]` subtracts `value2` from `value1`\n * * `['clamp', value, low, high]` clamps `value` between `low` and `high`\n * * `['%', value1, value2]` returns the result of `value1 % value2` (modulo)\n * * `['^', value1, value2]` returns the value of `value1` raised to the `value2` power\n * * `['abs', value1]` returns the absolute value of `value1`\n * * `['floor', value1]` returns the nearest integer less than or equal to `value1`\n * * `['round', value1]` returns the nearest integer to `value1`\n * * `['ceil', value1]` returns the nearest integer greater than or equal to `value1`\n * * `['sin', value1]` returns the sine of `value1`\n * * `['cos', value1]` returns the cosine of `value1`\n * * `['atan', value1, value2]` returns `atan2(value1, value2)`. If `value2` is not provided, returns `atan(value1)`\n * * `['sqrt', value1]` returns the square root of `value1`\n *\n * * Transform operators:\n * * `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding\n * condition evaluates to `true`. If no match is found, returns the `fallback` value.\n * All conditions should be `boolean`, output and fallback can be any kind.\n * * `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all\n * provided `matchX` values, returning the output associated with the first valid match. If no match is found,\n * returns the `fallback` value.\n * `input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and\n * `fallback` values must be of the same type, and can be of any kind.\n * * `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between\n * pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is\n * the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value\n * of 1 is equivalent to `['linear']`.\n * `input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.\n * Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised\n * between `output1` and `outputN`.\n * * `['string', value1, value2, ...]` returns the first value in the list that evaluates to a string.\n * An example would be to provide a default value for get: `['string', ['get', 'propertyname'], 'default value']]`\n * (Canvas only).\n * * `['number', value1, value2, ...]` returns the first value in the list that evaluates to a number.\n * An example would be to provide a default value for get: `['string', ['get', 'propertyname'], 42]]`\n * (Canvas only).\n * * `['coalesce', value1, value2, ...]` returns the first value in the list which is not null or undefined.\n * An example would be to provide a default value for get: `['coalesce', ['get','propertyname'], 'default value']]`\n * (Canvas only).\n *\n * * Logical operators:\n * * `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.\n * * `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.\n * * `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.\n * * `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.\n * * `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.\n * * `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.\n * * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.\n * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.\n * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.\n * * `['has', attributeName, keyOrArrayIndex, ...]` returns `true` if feature properties include the (nested) key `attributeName`,\n * `false` otherwise.\n * Note that for WebGL layers, the hardcoded value `-9999999` is used to distinguish when a property is not defined.\n * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`\n * (inclusively), or `false` otherwise.\n * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and\n * `false` otherwise.\n * This operator has the following limitations:\n * * `haystack` has to be an array of numbers or strings (searching for a substring in a string is not supported yet)\n * * Only literal arrays are supported as `haystack` for now; this means that `haystack` cannot be the result of an\n * expression. If `haystack` is an array of strings, use the `literal` operator to disambiguate from an expression:\n * `['literal', ['abc', 'def', 'ghi']]`\n *\n * * Conversion operators:\n * * `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of\n * values can currently only be 2, 3 or 4 (WebGL only).\n * * `['color', red, green, blue, alpha]` or `['color', shade, alpha]` creates a `color` value from `number` values;\n * the `alpha` parameter is optional; if not specified, it will be set to 1 (WebGL only).\n * Note: `red`, `green` and `blue` or `shade` components must be values between 0 and 255; `alpha` between 0 and 1.\n * * `['palette', index, colors]` picks a `color` value from an array of colors using the given index; the `index`\n * expression must evaluate to a number; the items in the `colors` array must be strings with hex colors\n * (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),\n * named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b\n * in the 0-255 range and a in the 0-1 range) (WebGL only).\n * * `['to-string', value]` converts the input value to a string. If the input is a boolean, the result is \"true\" or \"false\".\n * If the input is a number, it is converted to a string as specified by the \"NumberToString\" algorithm of the ECMAScript\n * Language Specification. If the input is a color, it is converted to a string of the form \"rgba(r,g,b,a)\". (Canvas only)\n *\n * Values can either be literals or another operator, as they will be evaluated recursively.\n * Literal values can be of the following types:\n * * `boolean`\n * * `number`\n * * `number[]` (number arrays can only have a length of 2, 3 or 4)\n * * `string`\n * * {@link module:ol/color~Color}\n *\n * @typedef {Array<*>|import(\"../color.js\").Color|string|number|boolean} ExpressionValue\n * @api\n */\n\nlet numTypes = 0;\nexport const NoneType = 0;\nexport const BooleanType = 1 << numTypes++;\nexport const NumberType = 1 << numTypes++;\nexport const StringType = 1 << numTypes++;\nexport const ColorType = 1 << numTypes++;\nexport const NumberArrayType = 1 << numTypes++;\nexport const SizeType = 1 << numTypes++;\nexport const AnyType = Math.pow(2, numTypes) - 1;\n\nconst typeNames = {\n [BooleanType]: 'boolean',\n [NumberType]: 'number',\n [StringType]: 'string',\n [ColorType]: 'color',\n [NumberArrayType]: 'number[]',\n [SizeType]: 'size',\n};\n\nconst namedTypes = Object.keys(typeNames).map(Number).sort(ascending);\n\n/**\n * @param {number} type The type.\n * @return {boolean} The type is one of the specific types (not any or a union type).\n */\nfunction isSpecific(type) {\n return type in typeNames;\n}\n\n/**\n * Get a string representation for a type.\n * @param {number} type The type.\n * @return {string} The type name.\n */\nexport function typeName(type) {\n const names = [];\n for (const namedType of namedTypes) {\n if (includesType(type, namedType)) {\n names.push(typeNames[namedType]);\n }\n }\n if (names.length === 0) {\n return 'untyped';\n }\n if (names.length < 3) {\n return names.join(' or ');\n }\n return names.slice(0, -1).join(', ') + ', or ' + names[names.length - 1];\n}\n\n/**\n * @param {number} broad The broad type.\n * @param {number} specific The specific type.\n * @return {boolean} The broad type includes the specific type.\n */\nexport function includesType(broad, specific) {\n return (broad & specific) === specific;\n}\n\n/**\n * @param {number} oneType One type.\n * @param {number} otherType Another type.\n * @return {boolean} The set of types overlap (share a common specific type)\n */\nexport function overlapsType(oneType, otherType) {\n return !!(oneType & otherType);\n}\n\n/**\n * @param {number} type The type.\n * @param {number} expected The expected type.\n * @return {boolean} The given type is exactly the expected type.\n */\nexport function isType(type, expected) {\n return type === expected;\n}\n\n/**\n * @typedef {boolean|number|string|Array<number>} LiteralValue\n */\n\nexport class LiteralExpression {\n /**\n * @param {number} type The value type.\n * @param {LiteralValue} value The literal value.\n */\n constructor(type, value) {\n if (!isSpecific(type)) {\n throw new Error(\n `literal expressions must have a specific type, got ${typeName(type)}`,\n );\n }\n this.type = type;\n this.value = value;\n }\n}\n\nexport class CallExpression {\n /**\n * @param {number} type The return type.\n * @param {string} operator The operator.\n * @param {...Expression} args The arguments.\n */\n constructor(type, operator, ...args) {\n this.type = type;\n this.operator = operator;\n this.args = args;\n }\n}\n\n/**\n * @typedef {LiteralExpression|CallExpression} Expression\n */\n\n/**\n * @typedef {Object} ParsingContext\n * @property {Set<string>} variables Variables referenced with the 'var' operator.\n * @property {Set<string>} properties Properties referenced with the 'get' operator.\n * @property {boolean} featureId The style uses the feature id.\n * @property {boolean} geometryType The style uses the feature geometry type.\n * @property {boolean} mapState The style uses the map state (view state or time elapsed).\n */\n\n/**\n * @return {ParsingContext} A new parsing context.\n */\nexport function newParsingContext() {\n return {\n variables: new Set(),\n properties: new Set(),\n featureId: false,\n geometryType: false,\n mapState: false,\n };\n}\n\n/**\n * @typedef {LiteralValue|Array} EncodedExpression\n */\n\n/**\n * @param {EncodedExpression} encoded The encoded expression.\n * @param {number} expectedType The expected type.\n * @param {ParsingContext} context The parsing context.\n * @return {Expression} The parsed expression result.\n */\nexport function parse(encoded, expectedType, context) {\n switch (typeof encoded) {\n case 'boolean': {\n if (isType(expectedType, StringType)) {\n return new LiteralExpression(StringType, encoded ? 'true' : 'false');\n }\n if (!includesType(expectedType, BooleanType)) {\n throw new Error(\n `got a boolean, but expected ${typeName(expectedType)}`,\n );\n }\n return new LiteralExpression(BooleanType, encoded);\n }\n case 'number': {\n if (isType(expectedType, SizeType)) {\n return new LiteralExpression(SizeType, toSize(encoded));\n }\n if (isType(expectedType, BooleanType)) {\n return new LiteralExpression(BooleanType, !!encoded);\n }\n if (isType(expectedType, StringType)) {\n return new LiteralExpression(StringType, encoded.toString());\n }\n if (!includesType(expectedType, NumberType)) {\n throw new Error(`got a number, but expected ${typeName(expectedType)}`);\n }\n return new LiteralExpression(NumberType, encoded);\n }\n case 'string': {\n if (isType(expectedType, ColorType)) {\n return new LiteralExpression(ColorType, colorFromString(encoded));\n }\n if (isType(expectedType, BooleanType)) {\n return new LiteralExpression(BooleanType, !!encoded);\n }\n if (!includesType(expectedType, StringType)) {\n throw new Error(`got a string, but expected ${typeName(expectedType)}`);\n }\n return new LiteralExpression(StringType, encoded);\n }\n default: {\n // pass\n }\n }\n\n if (!Array.isArray(encoded)) {\n throw new Error('expression must be an array or a primitive value');\n }\n\n if (encoded.length === 0) {\n throw new Error('empty expression');\n }\n\n if (typeof encoded[0] === 'string') {\n return parseCallExpression(encoded, expectedType, context);\n }\n\n for (const item of encoded) {\n if (typeof item !== 'number') {\n throw new Error('expected an array of numbers');\n }\n }\n\n if (isType(expectedType, SizeType)) {\n if (encoded.length !== 2) {\n throw new Error(\n `expected an array of two values for a size, got ${encoded.length}`,\n );\n }\n return new LiteralExpression(SizeType, encoded);\n }\n\n if (isType(expectedType, ColorType)) {\n if (encoded.length === 3) {\n return new LiteralExpression(ColorType, [...encoded, 1]);\n }\n if (encoded.length === 4) {\n return new LiteralExpression(ColorType, encoded);\n }\n throw new Error(\n `expected an array of 3 or 4 values for a color, got ${encoded.length}`,\n );\n }\n\n if (!includesType(expectedType, NumberArrayType)) {\n throw new Error(\n `got an array of numbers, but expected ${typeName(expectedType)}`,\n );\n }\n\n return new LiteralExpression(NumberArrayType, encoded);\n}\n\n/**\n * @type {Object<string, string>}\n */\nexport const Ops = {\n Get: 'get',\n Var: 'var',\n Concat: 'concat',\n GeometryType: 'geometry-type',\n LineMetric: 'line-metric',\n Any: 'any',\n All: 'all',\n Not: '!',\n Resolution: 'resolution',\n Zoom: 'zoom',\n Time: 'time',\n Equal: '==',\n NotEqual: '!=',\n GreaterThan: '>',\n GreaterThanOrEqualTo: '>=',\n LessThan: '<',\n LessThanOrEqualTo: '<=',\n Multiply: '*',\n Divide: '/',\n Add: '+',\n Subtract: '-',\n Clamp: 'clamp',\n Mod: '%',\n Pow: '^',\n Abs: 'abs',\n Floor: 'floor',\n Ceil: 'ceil',\n Round: 'round',\n Sin: 'sin',\n Cos: 'cos',\n Atan: 'atan',\n Sqrt: 'sqrt',\n Match: 'match',\n Between: 'between',\n Interpolate: 'interpolate',\n Coalesce: 'coalesce',\n Case: 'case',\n In: 'in',\n Number: 'number',\n String: 'string',\n Array: 'array',\n Color: 'color',\n Id: 'id',\n Band: 'band',\n Palette: 'palette',\n ToString: 'to-string',\n Has: 'has',\n};\n\n/**\n * @typedef {function(Array, number, ParsingContext):Expression} Parser\n *\n * Second argument is the expected type.\n */\n\n/**\n * @type {Object<string, Parser>}\n */\nconst parsers = {\n [Ops.Get]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),\n [Ops.Var]: createCallExpressionParser(hasArgsCount(1, 1), withVarArgs),\n [Ops.Has]: createCallExpressionParser(hasArgsCount(1, Infinity), withGetArgs),\n [Ops.Id]: createCallExpressionParser(usesFeatureId, withNoArgs),\n [Ops.Concat]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(StringType),\n ),\n [Ops.GeometryType]: createCallExpressionParser(usesGeometryType, withNoArgs),\n [Ops.LineMetric]: createCallExpressionParser(withNoArgs),\n [Ops.Resolution]: createCallExpressionParser(usesMapState, withNoArgs),\n [Ops.Zoom]: createCallExpressionParser(usesMapState, withNoArgs),\n [Ops.Time]: createCallExpressionParser(usesMapState, withNoArgs),\n [Ops.Any]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(BooleanType),\n ),\n [Ops.All]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(BooleanType),\n ),\n [Ops.Not]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(BooleanType),\n ),\n [Ops.Equal]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(AnyType),\n ),\n [Ops.NotEqual]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(AnyType),\n ),\n [Ops.GreaterThan]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.GreaterThanOrEqualTo]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.LessThan]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.LessThanOrEqualTo]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Multiply]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfReturnType,\n ),\n [Ops.Coalesce]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfReturnType,\n ),\n [Ops.Divide]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Add]: createCallExpressionParser(\n hasArgsCount(2, Infinity),\n withArgsOfType(NumberType),\n ),\n [Ops.Subtract]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Clamp]: createCallExpressionParser(\n hasArgsCount(3, 3),\n withArgsOfType(NumberType),\n ),\n [Ops.Mod]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Pow]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Abs]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Floor]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Ceil]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Round]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Sin]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Cos]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Atan]: createCallExpressionParser(\n hasArgsCount(1, 2),\n withArgsOfType(NumberType),\n ),\n [Ops.Sqrt]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(NumberType),\n ),\n [Ops.Match]: createCallExpressionParser(\n hasArgsCount(4, Infinity),\n hasEvenArgs,\n withMatchArgs,\n ),\n [Ops.Between]: createCallExpressionParser(\n hasArgsCount(3, 3),\n withArgsOfType(NumberType),\n ),\n [Ops.Interpolate]: createCallExpressionParser(\n hasArgsCount(6, Infinity),\n hasEvenArgs,\n withInterpolateArgs,\n ),\n [Ops.Case]: createCallExpressionParser(\n hasArgsCount(3, Infinity),\n hasOddArgs,\n withCaseArgs,\n ),\n [Ops.In]: createCallExpressionParser(hasArgsCount(2, 2), withInArgs),\n [Ops.Number]: createCallExpressionParser(\n hasArgsCount(1, Infinity),\n withArgsOfType(AnyType),\n ),\n [Ops.String]: createCallExpressionParser(\n hasArgsCount(1, Infinity),\n withArgsOfType(AnyType),\n ),\n [Ops.Array]: createCallExpressionParser(\n hasArgsCount(1, Infinity),\n withArgsOfType(NumberType),\n ),\n [Ops.Color]: createCallExpressionParser(\n hasArgsCount(1, 4),\n withArgsOfType(NumberType),\n ),\n [Ops.Band]: createCallExpressionParser(\n hasArgsCount(1, 3),\n withArgsOfType(NumberType),\n ),\n [Ops.Palette]: createCallExpressionParser(\n hasArgsCount(2, 2),\n withPaletteArgs,\n ),\n [Ops.ToString]: createCallExpressionParser(\n hasArgsCount(1, 1),\n withArgsOfType(BooleanType | NumberType | StringType | ColorType),\n ),\n};\n\n/**\n * @typedef {function(Array<EncodedExpression>, number, ParsingContext):Array<Expression>|void} ArgValidator\n *\n * An argument validator applies various checks to an encoded expression arguments and\n * returns the parsed arguments if any. The second argument is the return type of the call expression.\n */\n\n/**\n * @type {ArgValidator}\n */\nfunction withGetArgs(encoded, returnType, context) {\n const argsCount = encoded.length - 1;\n const args = new Array(argsCount);\n for (let i = 0; i < argsCount; ++i) {\n const key = encoded[i + 1];\n switch (typeof key) {\n case 'number': {\n args[i] = new LiteralExpression(NumberType, key);\n break;\n }\n case 'string': {\n args[i] = new LiteralExpression(StringType, key);\n break;\n }\n default: {\n throw new Error(\n `expected a string key or numeric array index for a get operation, got ${key}`,\n );\n }\n }\n if (i === 0) {\n context.properties.add(String(key));\n }\n }\n return args;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withVarArgs(encoded, returnType, context) {\n const name = encoded[1];\n if (typeof name !== 'string') {\n throw new Error('expected a string argument for var operation');\n }\n context.variables.add(name);\n\n return [new LiteralExpression(StringType, name)];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction usesFeatureId(encoded, returnType, context) {\n context.featureId = true;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction usesGeometryType(encoded, returnType, context) {\n context.geometryType = true;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction usesMapState(encoded, returnType, context) {\n context.mapState = true;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withNoArgs(encoded, returnType, context) {\n const operation = encoded[0];\n if (encoded.length !== 1) {\n throw new Error(`expected no arguments for ${operation} operation`);\n }\n return [];\n}\n\n/**\n * @param {number} minArgs The minimum number of arguments.\n * @param {number} maxArgs The maximum number of arguments.\n * @return {ArgValidator} The argument validator\n */\nfunction hasArgsCount(minArgs, maxArgs) {\n return function (encoded, returnType, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (minArgs === maxArgs) {\n if (argCount !== minArgs) {\n const plural = minArgs === 1 ? '' : 's';\n throw new Error(\n `expected ${minArgs} argument${plural} for ${operation}, got ${argCount}`,\n );\n }\n } else if (argCount < minArgs || argCount > maxArgs) {\n const range =\n maxArgs === Infinity\n ? `${minArgs} or more`\n : `${minArgs} to ${maxArgs}`;\n throw new Error(\n `expected ${range} arguments for ${operation}, got ${argCount}`,\n );\n }\n };\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withArgsOfReturnType(encoded, returnType, context) {\n const argCount = encoded.length - 1;\n /**\n * @type {Array<Expression>}\n */\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n const expression = parse(encoded[i + 1], returnType, context);\n args[i] = expression;\n }\n return args;\n}\n\n/**\n * @param {number} argType The argument type.\n * @return {ArgValidator} The argument validator\n */\nfunction withArgsOfType(argType) {\n return function (encoded, returnType, context) {\n const argCount = encoded.length - 1;\n /**\n * @type {Array<Expression>}\n */\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n const expression = parse(encoded[i + 1], argType, context);\n args[i] = expression;\n }\n return args;\n };\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction hasOddArgs(encoded, returnType, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 0) {\n throw new Error(\n `expected an odd number of arguments for ${operation}, got ${argCount} instead`,\n );\n }\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction hasEvenArgs(encoded, returnType, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 1) {\n throw new Error(\n `expected an even number of arguments for operation ${operation}, got ${argCount} instead`,\n );\n }\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withMatchArgs(encoded, returnType, context) {\n const argsCount = encoded.length - 1;\n\n const inputType = StringType | NumberType | BooleanType;\n\n const input = parse(encoded[1], inputType, context);\n\n const fallback = parse(encoded[encoded.length - 1], returnType, context);\n\n const args = new Array(argsCount - 2);\n for (let i = 0; i < argsCount - 2; i += 2) {\n try {\n const match = parse(encoded[i + 2], input.type, context);\n args[i] = match;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 1} of match expression: ${err.message}`,\n );\n }\n try {\n const output = parse(encoded[i + 3], fallback.type, context);\n args[i + 1] = output;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 2} of match expression: ${err.message}`,\n );\n }\n }\n\n return [input, ...args, fallback];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withInterpolateArgs(encoded, returnType, context) {\n const interpolationType = encoded[1];\n /**\n * @type {number}\n */\n let base;\n switch (interpolationType[0]) {\n case 'linear':\n base = 1;\n break;\n case 'exponential':\n const b = interpolationType[1];\n if (typeof b !== 'number' || b <= 0) {\n throw new Error(\n `expected a number base for exponential interpolation` +\n `, got ${JSON.stringify(b)} instead`,\n );\n }\n base = b;\n break;\n default:\n throw new Error(\n `invalid interpolation type: ${JSON.stringify(interpolationType)}`,\n );\n }\n\n const interpolation = new LiteralExpression(NumberType, base);\n\n let input;\n try {\n input = parse(encoded[2], NumberType, context);\n } catch (err) {\n throw new Error(\n `failed to parse argument 1 in interpolate expression: ${err.message}`,\n );\n }\n\n const args = new Array(encoded.length - 3);\n for (let i = 0; i < args.length; i += 2) {\n try {\n const stop = parse(encoded[i + 3], NumberType, context);\n args[i] = stop;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 2} for interpolate expression: ${err.message}`,\n );\n }\n try {\n const output = parse(encoded[i + 4], returnType, context);\n args[i + 1] = output;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 3} for interpolate expression: ${err.message}`,\n );\n }\n }\n\n return [interpolation, input, ...args];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withCaseArgs(encoded, returnType, context) {\n const fallback = parse(encoded[encoded.length - 1], returnType, context);\n\n const args = new Array(encoded.length - 1);\n for (let i = 0; i < args.length - 1; i += 2) {\n try {\n const condition = parse(encoded[i + 1], BooleanType, context);\n args[i] = condition;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i} of case expression: ${err.message}`,\n );\n }\n try {\n const output = parse(encoded[i + 2], fallback.type, context);\n args[i + 1] = output;\n } catch (err) {\n throw new Error(\n `failed to parse argument ${i + 1} of case expression: ${err.message}`,\n );\n }\n }\n\n args[args.length - 1] = fallback;\n return args;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withInArgs(encoded, returnType, context) {\n let haystack = encoded[2];\n if (!Array.isArray(haystack)) {\n throw new Error(\n `the second argument for the \"in\" operator must be an array`,\n );\n }\n /**\n * @type {number}\n */\n let needleType;\n if (typeof haystack[0] === 'string') {\n if (haystack[0] !== 'literal') {\n throw new Error(\n `for the \"in\" operator, a string array should be wrapped in a \"literal\" operator to disambiguate from expressions`,\n );\n }\n if (!Array.isArray(haystack[1])) {\n throw new Error(\n `failed to parse \"in\" expression: the literal operator must be followed by an array`,\n );\n }\n haystack = haystack[1];\n needleType = StringType;\n } else {\n needleType = NumberType;\n }\n\n const args = new Array(haystack.length);\n for (let i = 0; i < args.length; i++) {\n try {\n const arg = parse(haystack[i], needleType, context);\n args[i] = arg;\n } catch (err) {\n throw new Error(\n `failed to parse haystack item ${i} for \"in\" expression: ${err.message}`,\n );\n }\n }\n\n const needle = parse(encoded[1], needleType, context);\n return [needle, ...args];\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withPaletteArgs(encoded, returnType, context) {\n let index;\n try {\n index = parse(encoded[1], NumberType, context);\n } catch (err) {\n throw new Error(\n `failed to parse first argument in palette expression: ${err.message}`,\n );\n }\n const colors = encoded[2];\n if (!Array.isArray(colors)) {\n throw new Error('the second argument of palette must be an array');\n }\n const parsedColors = new Array(colors.length);\n for (let i = 0; i < parsedColors.length; i++) {\n let color;\n try {\n color = parse(colors[i], ColorType, context);\n } catch (err) {\n throw new Error(\n `failed to parse color at index ${i} in palette expression: ${err.message}`,\n );\n }\n if (!(color instanceof LiteralExpression)) {\n throw new Error(\n `the palette color at index ${i} must be a literal value`,\n );\n }\n parsedColors[i] = color;\n }\n return [index, ...parsedColors];\n}\n\n/**\n * @param {Array<ArgValidator>} validators A chain of argument validators. The last validator is expected\n * to return the parsed arguments.\n * @return {Parser} The parser.\n */\nfunction createCallExpressionParser(...validators) {\n return function (encoded, returnType, context) {\n const operator = encoded[0];\n\n /**\n * @type {Array<Expression>}\n */\n let args;\n for (let i = 0; i < validators.length; i++) {\n const parsed = validators[i](encoded, returnType, context);\n if (i == validators.length - 1) {\n if (!parsed) {\n throw new Error(\n 'expected last argument validator to return the parsed args',\n );\n }\n args = parsed;\n }\n }\n return new CallExpression(returnType, operator, ...args);\n };\n}\n\n/**\n * @param {Array} encoded The encoded expression.\n * @param {number} returnType The expected return type of the call expression.\n * @param {ParsingContext} context The parsing context.\n * @return {Expression} The parsed expression.\n */\nfunction parseCallExpression(encoded, returnType, context) {\n const operator = encoded[0];\n\n const parser = parsers[operator];\n if (!parser) {\n throw new Error(`unknown operator: ${operator}`);\n }\n return parser(encoded, returnType, context);\n}\n\n/**\n * Returns a simplified geometry type suited for the `geometry-type` operator\n * @param {import('../geom/Geometry.js').default|import('../render/Feature.js').default} geometry Geometry object\n * @return {'Point'|'LineString'|'Polygon'|''} Simplified geometry type; empty string of no geometry found\n */\nexport function computeGeometryType(geometry) {\n if (!geometry) {\n return '';\n }\n const type = geometry.getType();\n switch (type) {\n case 'Point':\n case 'LineString':\n case 'Polygon':\n return type;\n case 'MultiPoint':\n case 'MultiLineString':\n case 'MultiPolygon':\n return /** @type {'Point'|'LineString'|'Polygon'} */ (type.substring(5));\n case 'Circle':\n return 'Polygon';\n case 'GeometryCollection':\n return computeGeometryType(\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries()[0],\n );\n default:\n return '';\n }\n}\n","/**\n * @module ol/expr/cpu\n */\n\nimport {\n fromString,\n lchaToRgba,\n rgbaToLcha,\n toString,\n withAlpha,\n} from '../color.js';\nimport {ColorType, LiteralExpression, Ops, parse} from './expression.js';\n\n/**\n * @fileoverview This module includes functions to build expressions for evaluation on the CPU.\n * Building is composed of two steps: parsing and compiling. The parsing step takes an encoded\n * expression and returns an instance of one of the expression classes. The compiling step takes\n * the expression instance and returns a function that can be evaluated in to return a literal\n * value. The evaluator function should do as little allocation and work as possible.\n */\n\n/**\n * @typedef {Object} EvaluationContext\n * @property {Object} properties The values for properties used in 'get' expressions.\n * @property {Object} variables The values for variables used in 'var' expressions.\n * @property {number} resolution The map resolution.\n * @property {string|number|null} featureId The feature id.\n * @property {string} geometryType Geometry type of the current object.\n */\n\n/**\n * @return {EvaluationContext} A new evaluation context.\n */\nexport function newEvaluationContext() {\n return {\n variables: {},\n properties: {},\n resolution: NaN,\n featureId: null,\n geometryType: '',\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):import(\"./expression.js\").LiteralValue} ExpressionEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):boolean} BooleanEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):number} NumberEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):string} StringEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array<number>|string)} ColorLikeEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array<number>} NumberArrayEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):Array<number>} CoordinateEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array<number>)} SizeEvaluator\n */\n\n/**\n * @typedef {function(EvaluationContext):(Array<number>|number)} SizeLikeEvaluator\n */\n\n/**\n * @param {import('./expression.js').EncodedExpression} encoded The encoded expression.\n * @param {number} type The expected type.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The expression evaluator.\n */\nexport function buildExpression(encoded, type, context) {\n const expression = parse(encoded, type, context);\n return compileExpression(expression, context);\n}\n\n/**\n * @param {import(\"./expression.js\").Expression} expression The expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileExpression(expression, context) {\n if (expression instanceof LiteralExpression) {\n // convert colors to array if possible\n if (expression.type === ColorType && typeof expression.value === 'string') {\n const colorValue = fromString(expression.value);\n return function () {\n return colorValue;\n };\n }\n return function () {\n return expression.value;\n };\n }\n const operator = expression.operator;\n switch (operator) {\n case Ops.Number:\n case Ops.String:\n case Ops.Coalesce: {\n return compileAssertionExpression(expression, context);\n }\n case Ops.Get:\n case Ops.Var:\n case Ops.Has: {\n return compileAccessorExpression(expression, context);\n }\n case Ops.Id: {\n return (context) => context.featureId;\n }\n case Ops.GeometryType: {\n return (context) => context.geometryType;\n }\n case Ops.Concat: {\n const args = expression.args.map((e) => compileExpression(e, context));\n return (context) =>\n ''.concat(...args.map((arg) => arg(context).toString()));\n }\n case Ops.Resolution: {\n return (context) => context.resolution;\n }\n case Ops.Any:\n case Ops.All:\n case Ops.Between:\n case Ops.In:\n case Ops.Not: {\n return compileLogicalExpression(expression, context);\n }\n case Ops.Equal:\n case Ops.NotEqual:\n case Ops.LessThan:\n case Ops.LessThanOrEqualTo:\n case Ops.GreaterThan:\n case Ops.GreaterThanOrEqualTo: {\n return compileComparisonExpression(expression, context);\n }\n case Ops.Multiply:\n case Ops.Divide:\n case Ops.Add:\n case Ops.Subtract:\n case Ops.Clamp:\n case Ops.Mod:\n case Ops.Pow:\n case Ops.Abs:\n case Ops.Floor:\n case Ops.Ceil:\n case Ops.Round:\n case Ops.Sin:\n case Ops.Cos:\n case Ops.Atan:\n case Ops.Sqrt: {\n return compileNumericExpression(expression, context);\n }\n case Ops.Case: {\n return compileCaseExpression(expression, context);\n }\n case Ops.Match: {\n return compileMatchExpression(expression, context);\n }\n case Ops.Interpolate: {\n return compileInterpolateExpression(expression, context);\n }\n case Ops.ToString: {\n return compileConvertExpression(expression, context);\n }\n default: {\n throw new Error(`Unsupported operator ${operator}`);\n }\n // TODO: unimplemented\n // Ops.Zoom\n // Ops.Time\n // Ops.Array\n // Ops.Color\n // Ops.Band\n // Ops.Palette\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAssertionExpression(expression, context) {\n const type = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (type) {\n case Ops.Coalesce: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n const value = args[i](context);\n if (typeof value !== 'undefined' && value !== null) {\n return value;\n }\n }\n throw new Error('Expected one of the values to be non-null');\n };\n }\n case Ops.Number:\n case Ops.String: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n const value = args[i](context);\n if (typeof value === type) {\n return value;\n }\n }\n throw new Error(`Expected one of the values to be a ${type}`);\n };\n }\n default: {\n throw new Error(`Unsupported assertion operator ${type}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileAccessorExpression(expression, context) {\n const nameExpression = /** @type {LiteralExpression} */ (expression.args[0]);\n const name = /** @type {string} */ (nameExpression.value);\n switch (expression.operator) {\n case Ops.Get: {\n return (context) => {\n const args = expression.args;\n let value = context.properties[name];\n for (let i = 1, ii = args.length; i < ii; ++i) {\n const keyExpression = /** @type {LiteralExpression} */ (args[i]);\n const key = /** @type {string|number} */ (keyExpression.value);\n value = value[key];\n }\n return value;\n };\n }\n case Ops.Var: {\n return (context) => context.variables[name];\n }\n case Ops.Has: {\n return (context) => {\n const args = expression.args;\n if (!(name in context.properties)) {\n return false;\n }\n let value = context.properties[name];\n for (let i = 1, ii = args.length; i < ii; ++i) {\n const keyExpression = /** @type {LiteralExpression} */ (args[i]);\n const key = /** @type {string|number} */ (keyExpression.value);\n if (!value || !Object.hasOwn(value, key)) {\n return false;\n }\n value = value[key];\n }\n return true;\n };\n }\n default: {\n throw new Error(`Unsupported accessor operator ${expression.operator}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileComparisonExpression(expression, context) {\n const op = expression.operator;\n const left = compileExpression(expression.args[0], context);\n const right = compileExpression(expression.args[1], context);\n switch (op) {\n case Ops.Equal: {\n return (context) => left(context) === right(context);\n }\n case Ops.NotEqual: {\n return (context) => left(context) !== right(context);\n }\n case Ops.LessThan: {\n return (context) => left(context) < right(context);\n }\n case Ops.LessThanOrEqualTo: {\n return (context) => left(context) <= right(context);\n }\n case Ops.GreaterThan: {\n return (context) => left(context) > right(context);\n }\n case Ops.GreaterThanOrEqualTo: {\n return (context) => left(context) >= right(context);\n }\n default: {\n throw new Error(`Unsupported comparison operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {BooleanEvaluator} The evaluator function.\n */\nfunction compileLogicalExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.Any: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (args[i](context)) {\n return true;\n }\n }\n return false;\n };\n }\n case Ops.All: {\n return (context) => {\n for (let i = 0; i < length; ++i) {\n if (!args[i](context)) {\n return false;\n }\n }\n return true;\n };\n }\n case Ops.Between: {\n return (context) => {\n const value = args[0](context);\n const min = args[1](context);\n const max = args[2](context);\n return value >= min && value <= max;\n };\n }\n case Ops.In: {\n return (context) => {\n const value = args[0](context);\n for (let i = 1; i < length; ++i) {\n if (value === args[i](context)) {\n return true;\n }\n }\n return false;\n };\n }\n case Ops.Not: {\n return (context) => !args[0](context);\n }\n default: {\n throw new Error(`Unsupported logical operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {NumberEvaluator} The evaluator function.\n */\nfunction compileNumericExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.Multiply: {\n return (context) => {\n let value = 1;\n for (let i = 0; i < length; ++i) {\n value *= args[i](context);\n }\n return value;\n };\n }\n case Ops.Divide: {\n return (context) => args[0](context) / args[1](context);\n }\n case Ops.Add: {\n return (context) => {\n let value = 0;\n for (let i = 0; i < length; ++i) {\n value += args[i](context);\n }\n return value;\n };\n }\n case Ops.Subtract: {\n return (context) => args[0](context) - args[1](context);\n }\n case Ops.Clamp: {\n return (context) => {\n const value = args[0](context);\n const min = args[1](context);\n if (value < min) {\n return min;\n }\n const max = args[2](context);\n if (value > max) {\n return max;\n }\n return value;\n };\n }\n case Ops.Mod: {\n return (context) => args[0](context) % args[1](context);\n }\n case Ops.Pow: {\n return (context) => Math.pow(args[0](context), args[1](context));\n }\n case Ops.Abs: {\n return (context) => Math.abs(args[0](context));\n }\n case Ops.Floor: {\n return (context) => Math.floor(args[0](context));\n }\n case Ops.Ceil: {\n return (context) => Math.ceil(args[0](context));\n }\n case Ops.Round: {\n return (context) => Math.round(args[0](context));\n }\n case Ops.Sin: {\n return (context) => Math.sin(args[0](context));\n }\n case Ops.Cos: {\n return (context) => Math.cos(args[0](context));\n }\n case Ops.Atan: {\n if (length === 2) {\n return (context) => Math.atan2(args[0](context), args[1](context));\n }\n return (context) => Math.atan(args[0](context));\n }\n case Ops.Sqrt: {\n return (context) => Math.sqrt(args[0](context));\n }\n default: {\n throw new Error(`Unsupported numeric operator ${op}`);\n }\n }\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileCaseExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n for (let i = 0; i < length - 1; i += 2) {\n const condition = args[i](context);\n if (condition) {\n return args[i + 1](context);\n }\n }\n return args[length - 1](context);\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileMatchExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n const value = args[0](context);\n for (let i = 1; i < length - 1; i += 2) {\n if (value === args[i](context)) {\n return args[i + 1](context);\n }\n }\n return args[length - 1](context);\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileInterpolateExpression(expression, context) {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n return (context) => {\n const base = args[0](context);\n const value = args[1](context);\n\n let previousInput;\n let previousOutput;\n for (let i = 2; i < length; i += 2) {\n const input = args[i](context);\n let output = args[i + 1](context);\n const isColor = Array.isArray(output);\n if (isColor) {\n output = withAlpha(output);\n }\n if (input >= value) {\n if (i === 2) {\n return output;\n }\n if (isColor) {\n return interpolateColor(\n base,\n value,\n previousInput,\n previousOutput,\n input,\n output,\n );\n }\n return interpolateNumber(\n base,\n value,\n previousInput,\n previousOutput,\n input,\n output,\n );\n }\n previousInput = input;\n previousOutput = output;\n }\n return previousOutput;\n };\n}\n\n/**\n * @param {import('./expression.js').CallExpression} expression The call expression.\n * @param {import('./expression.js').ParsingContext} context The parsing context.\n * @return {ExpressionEvaluator} The evaluator function.\n */\nfunction compileConvertExpression(expression, context) {\n const op = expression.operator;\n const length = expression.args.length;\n\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compileExpression(expression.args[i], context);\n }\n switch (op) {\n case Ops.ToString: {\n return (context) => {\n const value = args[0](context);\n if (expression.args[0].type === ColorType) {\n return toString(value);\n }\n return value.toString();\n };\n }\n default: {\n throw new Error(`Unsupported convert operator ${op}`);\n }\n }\n}\n\n/**\n * @param {number} base The base.\n * @param {number} value The value.\n * @param {number} input1 The first input value.\n * @param {number} output1 The first output value.\n * @param {number} input2 The second input value.\n * @param {number} output2 The second output value.\n * @return {number} The interpolated value.\n */\nfunction interpolateNumber(base, value, input1, output1, input2, output2) {\n const delta = input2 - input1;\n if (delta === 0) {\n return output1;\n }\n const along = value - input1;\n const factor =\n base === 1\n ? along / delta\n : (Math.pow(base, along) - 1) / (Math.pow(base, delta) - 1);\n return output1 + factor * (output2 - output1);\n}\n\n/**\n * @param {number} base The base.\n * @param {number} value The value.\n * @param {number} input1 The first input value.\n * @param {import('../color.js').Color} rgba1 The first output value.\n * @param {number} input2 The second input value.\n * @param {import('../color.js').Color} rgba2 The second output value.\n * @return {import('../color.js').Color} The interpolated color.\n */\nfunction interpolateColor(base, value, input1, rgba1, input2, rgba2) {\n const delta = input2 - input1;\n if (delta === 0) {\n return rgba1;\n }\n const lcha1 = rgbaToLcha(rgba1);\n const lcha2 = rgbaToLcha(rgba2);\n let deltaHue = lcha2[2] - lcha1[2];\n if (deltaHue > 180) {\n deltaHue -= 360;\n } else if (deltaHue < -180) {\n deltaHue += 360;\n }\n\n const lcha = [\n interpolateNumber(base, value, input1, lcha1[0], input2, lcha2[0]),\n interpolateNumber(base, value, input1, lcha1[1], input2, lcha2[1]),\n lcha1[2] + interpolateNumber(base, value, input1, 0, input2, deltaHue),\n interpolateNumber(base, value, input1, rgba1[3], input2, rgba2[3]),\n ];\n return lchaToRgba(lcha);\n}\n","/**\n * @module ol/style/IconImageCache\n */\nimport ImageState from '../ImageState.js';\nimport {asArray} from '../color.js';\nimport {getSharedCanvasContext2D} from '../dom.js';\n\n/**\n * @classdesc\n * Singleton class. Available through {@link module:ol/style/IconImageCache.shared}.\n */\nclass IconImageCache {\n constructor() {\n /**\n * @type {!Object<string, import(\"./IconImage.js\").default>}\n * @private\n */\n this.cache_ = {};\n\n /**\n * @type {!Object<string, CanvasPattern>}\n * @private\n */\n this.patternCache_ = {};\n\n /**\n * @type {number}\n * @private\n */\n this.cacheSize_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.maxCacheSize_ = 1024;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.cache_ = {};\n this.patternCache_ = {};\n this.cacheSize_ = 0;\n }\n\n /**\n * @return {boolean} Can expire cache.\n */\n canExpireCache() {\n return this.cacheSize_ > this.maxCacheSize_;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n expire() {\n if (this.canExpireCache()) {\n let i = 0;\n for (const key in this.cache_) {\n const iconImage = this.cache_[key];\n if ((i++ & 3) === 0 && !iconImage.hasListener()) {\n delete this.cache_[key];\n delete this.patternCache_[key];\n --this.cacheSize_;\n }\n }\n }\n }\n\n /**\n * @param {string} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @return {import(\"./IconImage.js\").default} Icon image.\n */\n get(src, crossOrigin, color) {\n const key = getCacheKey(src, crossOrigin, color);\n return key in this.cache_ ? this.cache_[key] : null;\n }\n\n /**\n * @param {string} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @return {CanvasPattern} Icon image.\n */\n getPattern(src, crossOrigin, color) {\n const key = getCacheKey(src, crossOrigin, color);\n return key in this.patternCache_ ? this.patternCache_[key] : null;\n }\n\n /**\n * @param {string} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @param {import(\"./IconImage.js\").default|null} iconImage Icon image.\n * @param {boolean} [pattern] Also cache a `'repeat'` pattern with this `iconImage`.\n */\n set(src, crossOrigin, color, iconImage, pattern) {\n const key = getCacheKey(src, crossOrigin, color);\n const update = key in this.cache_;\n this.cache_[key] = iconImage;\n if (pattern) {\n if (iconImage.getImageState() === ImageState.IDLE) {\n iconImage.load();\n }\n if (iconImage.getImageState() === ImageState.LOADING) {\n iconImage.ready().then(() => {\n this.patternCache_[key] = getSharedCanvasContext2D().createPattern(\n iconImage.getImage(1),\n 'repeat',\n );\n });\n } else {\n this.patternCache_[key] = getSharedCanvasContext2D().createPattern(\n iconImage.getImage(1),\n 'repeat',\n );\n }\n }\n if (!update) {\n ++this.cacheSize_;\n }\n }\n\n /**\n * Set the cache size of the icon cache. Default is `1024`. Change this value when\n * your map uses more than 1024 different icon images and you are not caching icon\n * styles on the application level.\n * @param {number} maxCacheSize Cache max size.\n * @api\n */\n setSize(maxCacheSize) {\n this.maxCacheSize_ = maxCacheSize;\n this.expire();\n }\n}\n\n/**\n * @param {string} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @return {string} Cache key.\n */\nexport function getCacheKey(src, crossOrigin, color) {\n const colorString = color ? asArray(color) : 'null';\n return crossOrigin + ':' + src + ':' + colorString;\n}\n\nexport default IconImageCache;\n\n/**\n * The {@link module:ol/style/IconImageCache~IconImageCache} for\n * {@link module:ol/style/Icon~Icon} images.\n * @api\n */\nexport const shared = new IconImageCache();\n","/**\n * @module ol/style/IconImage\n */\n\nimport {decodeFallback} from '../Image.js';\nimport ImageState from '../ImageState.js';\nimport {asString} from '../color.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport EventTarget from '../events/Target.js';\nimport {shared as iconImageCache} from './IconImageCache.js';\n\n/**\n * @type {CanvasRenderingContext2D}\n */\nlet taintedTestContext = null;\n\nclass IconImage extends EventTarget {\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|ImageBitmap|null} image Image.\n * @param {string|undefined} src Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../ImageState.js\").default|undefined} imageState Image state.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n */\n constructor(image, src, crossOrigin, imageState, color) {\n super();\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement|ImageBitmap}\n */\n this.hitDetectionImage_ = null;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement|ImageBitmap|null}\n */\n this.image_ = image;\n\n /**\n * @private\n * @type {string|null}\n */\n this.crossOrigin_ = crossOrigin;\n\n /**\n * @private\n * @type {Object<number, HTMLCanvasElement>}\n */\n this.canvas_ = {};\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|string|null}\n */\n this.color_ = color;\n\n /**\n * @private\n * @type {import(\"../ImageState.js\").default}\n */\n this.imageState_ = imageState === undefined ? ImageState.IDLE : imageState;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size|null}\n */\n this.size_ =\n image && image.width && image.height ? [image.width, image.height] : null;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.src_ = src;\n\n /**\n * @private\n */\n this.tainted_;\n\n /**\n * @private\n * @type {Promise<void>|null}\n */\n this.ready_ = null;\n }\n\n /**\n * @private\n */\n initializeImage_() {\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n }\n\n /**\n * @private\n * @return {boolean} The image canvas is tainted.\n */\n isTainted_() {\n if (this.tainted_ === undefined && this.imageState_ === ImageState.LOADED) {\n if (!taintedTestContext) {\n taintedTestContext = createCanvasContext2D(1, 1, undefined, {\n willReadFrequently: true,\n });\n }\n taintedTestContext.drawImage(this.image_, 0, 0);\n try {\n taintedTestContext.getImageData(0, 0, 1, 1);\n this.tainted_ = false;\n } catch {\n taintedTestContext = null;\n this.tainted_ = true;\n }\n }\n return this.tainted_ === true;\n }\n\n /**\n * @private\n */\n dispatchChangeEvent_() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @private\n */\n handleImageError_() {\n this.imageState_ = ImageState.ERROR;\n this.dispatchChangeEvent_();\n }\n\n /**\n * @private\n */\n handleImageLoad_() {\n this.imageState_ = ImageState.LOADED;\n this.size_ = [this.image_.width, this.image_.height];\n this.dispatchChangeEvent_();\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLImageElement|HTMLCanvasElement|ImageBitmap} Image or Canvas element or image bitmap.\n */\n getImage(pixelRatio) {\n if (!this.image_) {\n this.initializeImage_();\n }\n this.replaceColor_(pixelRatio);\n return this.canvas_[pixelRatio] ? this.canvas_[pixelRatio] : this.image_;\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Image or Canvas element.\n */\n getPixelRatio(pixelRatio) {\n this.replaceColor_(pixelRatio);\n return this.canvas_[pixelRatio] ? pixelRatio : 1;\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return this.imageState_;\n }\n\n /**\n * @return {HTMLImageElement|HTMLCanvasElement|ImageBitmap} Image element.\n */\n getHitDetectionImage() {\n if (!this.image_) {\n this.initializeImage_();\n }\n if (!this.hitDetectionImage_) {\n if (this.isTainted_()) {\n const width = this.size_[0];\n const height = this.size_[1];\n const context = createCanvasContext2D(width, height);\n context.fillRect(0, 0, width, height);\n this.hitDetectionImage_ = context.canvas;\n } else {\n this.hitDetectionImage_ = this.image_;\n }\n }\n return this.hitDetectionImage_;\n }\n\n /**\n * Get the size of the icon (in pixels).\n * @return {import(\"../size.js\").Size} Image size.\n */\n getSize() {\n return this.size_;\n }\n\n /**\n * @return {string|undefined} Image src.\n */\n getSrc() {\n return this.src_;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.imageState_ !== ImageState.IDLE) {\n return;\n }\n if (!this.image_) {\n this.initializeImage_();\n }\n\n this.imageState_ = ImageState.LOADING;\n try {\n if (this.src_ !== undefined) {\n /** @type {HTMLImageElement} */ (this.image_).src = this.src_;\n }\n } catch {\n this.handleImageError_();\n }\n if (this.image_ instanceof HTMLImageElement) {\n decodeFallback(this.image_, this.src_)\n .then((image) => {\n this.image_ = image;\n this.handleImageLoad_();\n })\n .catch(this.handleImageError_.bind(this));\n }\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @private\n */\n replaceColor_(pixelRatio) {\n if (\n !this.color_ ||\n this.canvas_[pixelRatio] ||\n this.imageState_ !== ImageState.LOADED\n ) {\n return;\n }\n\n const image = this.image_;\n const ctx = createCanvasContext2D(\n Math.ceil(image.width * pixelRatio),\n Math.ceil(image.height * pixelRatio),\n );\n const canvas = ctx.canvas;\n\n ctx.scale(pixelRatio, pixelRatio);\n ctx.drawImage(image, 0, 0);\n\n ctx.globalCompositeOperation = 'multiply';\n ctx.fillStyle = asString(this.color_);\n ctx.fillRect(0, 0, canvas.width / pixelRatio, canvas.height / pixelRatio);\n\n ctx.globalCompositeOperation = 'destination-in';\n ctx.drawImage(image, 0, 0);\n\n this.canvas_[pixelRatio] = canvas;\n }\n\n /**\n * @return {Promise<void>} Promise that resolves when the image is loaded.\n */\n ready() {\n if (!this.ready_) {\n this.ready_ = new Promise((resolve) => {\n if (\n this.imageState_ === ImageState.LOADED ||\n this.imageState_ === ImageState.ERROR\n ) {\n resolve();\n } else {\n const onChange = () => {\n if (\n this.imageState_ === ImageState.LOADED ||\n this.imageState_ === ImageState.ERROR\n ) {\n this.removeEventListener(EventType.CHANGE, onChange);\n resolve();\n }\n };\n this.addEventListener(EventType.CHANGE, onChange);\n }\n });\n }\n return this.ready_;\n }\n}\n\n/**\n * @param {HTMLImageElement|HTMLCanvasElement|ImageBitmap|null} image Image.\n * @param {string|undefined} cacheKey Src.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../ImageState.js\").default|undefined} imageState Image state.\n * @param {import(\"../color.js\").Color|string|null} color Color.\n * @param {boolean} [pattern] Also cache a `repeat` pattern with the icon image.\n * @return {IconImage} Icon image.\n */\nexport function get(image, cacheKey, crossOrigin, imageState, color, pattern) {\n let iconImage =\n cacheKey === undefined\n ? undefined\n : iconImageCache.get(cacheKey, crossOrigin, color);\n if (!iconImage) {\n iconImage = new IconImage(\n image,\n image && 'src' in image ? image.src || undefined : cacheKey,\n crossOrigin,\n imageState,\n color,\n );\n iconImageCache.set(cacheKey, crossOrigin, color, iconImage, pattern);\n }\n if (\n pattern &&\n iconImage &&\n !iconImageCache.getPattern(cacheKey, crossOrigin, color)\n ) {\n iconImageCache.set(cacheKey, crossOrigin, color, iconImage, pattern);\n }\n return iconImage;\n}\n\nexport default IconImage;\n","/**\n * @module ol/colorlike\n */\nimport ImageState from './ImageState.js';\nimport {toString} from './color.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {get as getIconImage} from './style/IconImage.js';\nimport {shared as iconCache} from './style/IconImageCache.js';\n\n/**\n * @typedef {Object} PatternDescriptor\n * @property {string} src Pattern image URL\n * @property {import(\"./color.js\").Color|string} [color] Color to tint the pattern with.\n * @property {import(\"./size.js\").Size} [size] Size of the desired slice from the pattern image.\n * Use this together with `offset` when the pattern image is a sprite sheet.\n * @property {import(\"./size.js\").Size} [offset] Offset of the desired slice from the pattern image.\n * Use this together with `size` when the pattern image is a sprite sheet.\n */\n\n/**\n * A type accepted by CanvasRenderingContext2D.fillStyle\n * or CanvasRenderingContext2D.strokeStyle.\n * Represents a color, [CanvasPattern](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern),\n * or [CanvasGradient](https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient). The origin for\n * patterns and gradients as fill style is an increment of 512 css pixels from map coordinate\n * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image\n * must be a factor of two (2, 4, 8, ..., 512).\n *\n * @typedef {string|CanvasPattern|CanvasGradient} ColorLike\n * @api\n */\n\n/**\n * @param {import(\"./color.js\").Color|ColorLike|PatternDescriptor|null} color Color.\n * @return {ColorLike|null} The color as an {@link ol/colorlike~ColorLike}.\n * @api\n */\nexport function asColorLike(color) {\n if (!color) {\n return null;\n }\n if (Array.isArray(color)) {\n return toString(color);\n }\n if (typeof color === 'object' && 'src' in color) {\n return asCanvasPattern(color);\n }\n return color;\n}\n\n/**\n * @param {PatternDescriptor} pattern Pattern descriptor.\n * @return {CanvasPattern|null} Canvas pattern or null if the pattern referenced in the\n * PatternDescriptor was not found in the icon image cache.\n */\nfunction asCanvasPattern(pattern) {\n if (!pattern.offset || !pattern.size) {\n return iconCache.getPattern(pattern.src, 'anonymous', pattern.color);\n }\n\n const cacheKey = pattern.src + ':' + pattern.offset;\n\n const canvasPattern = iconCache.getPattern(\n cacheKey,\n undefined,\n pattern.color,\n );\n if (canvasPattern) {\n return canvasPattern;\n }\n\n const iconImage = iconCache.get(pattern.src, 'anonymous', null);\n if (iconImage.getImageState() !== ImageState.LOADED) {\n return null;\n }\n const patternCanvasContext = createCanvasContext2D(\n pattern.size[0],\n pattern.size[1],\n );\n patternCanvasContext.drawImage(\n iconImage.getImage(1),\n pattern.offset[0],\n pattern.offset[1],\n pattern.size[0],\n pattern.size[1],\n 0,\n 0,\n pattern.size[0],\n pattern.size[1],\n );\n getIconImage(\n patternCanvasContext.canvas,\n cacheKey,\n undefined,\n ImageState.LOADED,\n pattern.color,\n true,\n );\n return iconCache.getPattern(cacheKey, undefined, pattern.color);\n}\n","/**\n * @module ol/render/canvas\n */\nimport BaseObject from '../Object.js';\nimport {fontWeights, getFontParameters} from '../css.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {WORKER_OFFSCREEN_CANVAS} from '../has.js';\nimport {clear} from '../obj.js';\n\n/**\n * @typedef {'Circle' | 'Image' | 'LineString' | 'Polygon' | 'Text' | 'Default'} BuilderType\n */\n\n/**\n * @typedef {Object} FillState\n * @property {import(\"../colorlike.js\").ColorLike} fillStyle FillStyle.\n */\n\n/**\n * @typedef Label\n * @property {number} width Width.\n * @property {number} height Height.\n * @property {Array<string|number>} contextInstructions ContextInstructions.\n */\n\n/**\n * @typedef {Object} FillStrokeState\n * @property {import(\"../colorlike.js\").ColorLike} [currentFillStyle] Current FillStyle.\n * @property {import(\"../colorlike.js\").ColorLike} [currentStrokeStyle] Current StrokeStyle.\n * @property {CanvasLineCap} [currentLineCap] Current LineCap.\n * @property {Array<number>} currentLineDash Current LineDash.\n * @property {number} [currentLineDashOffset] Current LineDashOffset.\n * @property {CanvasLineJoin} [currentLineJoin] Current LineJoin.\n * @property {number} [currentLineWidth] Current LineWidth.\n * @property {number} [currentMiterLimit] Current MiterLimit.\n * @property {number} [lastStroke] Last stroke.\n * @property {import(\"../colorlike.js\").ColorLike} [fillStyle] FillStyle.\n * @property {import(\"../colorlike.js\").ColorLike} [strokeStyle] StrokeStyle.\n * @property {CanvasLineCap} [lineCap] LineCap.\n * @property {Array<number>} lineDash LineDash.\n * @property {number} [lineDashOffset] LineDashOffset.\n * @property {CanvasLineJoin} [lineJoin] LineJoin.\n * @property {number} [lineWidth] LineWidth.\n * @property {number} [miterLimit] MiterLimit.\n * @property {number} [fillPatternScale] Fill pattern scale.\n */\n\n/**\n * @typedef {Object} StrokeState\n * @property {CanvasLineCap} lineCap LineCap.\n * @property {Array<number>} lineDash LineDash.\n * @property {number} lineDashOffset LineDashOffset.\n * @property {CanvasLineJoin} lineJoin LineJoin.\n * @property {number} lineWidth LineWidth.\n * @property {number} miterLimit MiterLimit.\n * @property {import(\"../colorlike.js\").ColorLike} strokeStyle StrokeStyle.\n */\n\n/**\n * @typedef {Object} TextState\n * @property {string} font Font.\n * @property {CanvasTextAlign} [textAlign] TextAlign.\n * @property {number} [repeat] Repeat.\n * @property {import(\"../style/Text.js\").TextJustify} [justify] Justify.\n * @property {CanvasTextBaseline} textBaseline TextBaseline.\n * @property {import(\"../style/Text.js\").TextPlacement} [placement] Placement.\n * @property {number} [maxAngle] MaxAngle.\n * @property {boolean} [overflow] Overflow.\n * @property {import(\"../style/Fill.js\").default} [backgroundFill] BackgroundFill.\n * @property {import(\"../style/Stroke.js\").default} [backgroundStroke] BackgroundStroke.\n * @property {import(\"../size.js\").Size} [scale] Scale.\n * @property {Array<number>} [padding] Padding.\n */\n\n/**\n * @typedef {Object} SerializableInstructions\n * @property {Array<*>} instructions The rendering instructions.\n * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.\n * @property {Array<number>} coordinates The array of all coordinates.\n * @property {!Object<string, TextState>} [textStates] The text states (decluttering).\n * @property {!Object<string, FillState>} [fillStates] The fill states (decluttering).\n * @property {!Object<string, StrokeState>} [strokeStates] The stroke states (decluttering).\n */\n\n/**\n * @typedef {Object<number, import(\"./canvas/Executor.js\").ReplayImageOrLabelArgs>} DeclutterImageWithText\n */\n\n/**\n * @const\n * @type {string}\n */\nexport const defaultFont = '10px sans-serif';\n\n/**\n * @const\n * @type {string}\n */\nexport const defaultFillStyle = '#000';\n\n/**\n * @const\n * @type {CanvasLineCap}\n */\nexport const defaultLineCap = 'round';\n\n/**\n * @const\n * @type {Array<number>}\n */\nexport const defaultLineDash = [];\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultLineDashOffset = 0;\n\n/**\n * @const\n * @type {CanvasLineJoin}\n */\nexport const defaultLineJoin = 'round';\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultMiterLimit = 10;\n\n/**\n * @const\n * @type {import(\"../colorlike.js\").ColorLike}\n */\nexport const defaultStrokeStyle = '#000';\n\n/**\n * @const\n * @type {CanvasTextAlign}\n */\nexport const defaultTextAlign = 'center';\n\n/**\n * @const\n * @type {CanvasTextBaseline}\n */\nexport const defaultTextBaseline = 'middle';\n\n/**\n * @const\n * @type {Array<number>}\n */\nexport const defaultPadding = [0, 0, 0, 0];\n\n/**\n * @const\n * @type {number}\n */\nexport const defaultLineWidth = 1;\n\n/**\n * @type {BaseObject}\n */\nexport const checkedFonts = new BaseObject();\n\n/**\n * @type {CanvasRenderingContext2D}\n */\nlet measureContext = null;\n\n/**\n * @type {string}\n */\nlet measureFont;\n\n/**\n * @type {!Object<string, number>}\n */\nexport const textHeights = {};\n\nconst genericFontFamilies = new Set([\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-monospace',\n 'ui-rounded',\n 'emoji',\n 'math',\n 'fangsong',\n]);\n\n/**\n * @param {string} style Css font-style\n * @param {string} weight Css font-weight\n * @param {string} family Css font-family\n * @return {string} Font key.\n */\nfunction getFontKey(style, weight, family) {\n return `${style} ${weight} 16px \"${family}\"`;\n}\n\n/**\n * Clears the label cache when a font becomes available.\n * @param {string} fontSpec CSS font spec.\n */\nexport const registerFont = (function () {\n const retries = 100;\n let timeout, fontFaceSet;\n\n /**\n * @param {string} fontSpec Css font spec\n * @return {Promise<boolean>} Font with style and weight is available\n */\n async function isAvailable(fontSpec) {\n await fontFaceSet.ready;\n const fontFaces = await fontFaceSet.load(fontSpec);\n if (fontFaces.length === 0) {\n return false;\n }\n const font = getFontParameters(fontSpec);\n const checkFamily = font.families[0].toLowerCase();\n const checkWeight = font.weight;\n return fontFaces.some(\n /**\n * @param {import('../css.js').FontParameters} f Font.\n * @return {boolean} Font matches.\n */\n (f) => {\n const family = f.family.replace(/^['\"]|['\"]$/g, '').toLowerCase();\n const weight = fontWeights[f.weight] || f.weight;\n return (\n family === checkFamily &&\n f.style === font.style &&\n weight == checkWeight\n );\n },\n );\n }\n\n async function check() {\n await fontFaceSet.ready;\n let done = true;\n const checkedFontsProperties = checkedFonts.getProperties();\n const fonts = Object.keys(checkedFontsProperties).filter(\n (key) => checkedFontsProperties[key] < retries,\n );\n for (let i = fonts.length - 1; i >= 0; --i) {\n const font = fonts[i];\n let currentRetries = checkedFontsProperties[font];\n if (currentRetries < retries) {\n if (await isAvailable(font)) {\n clear(textHeights);\n checkedFonts.set(font, retries);\n } else {\n currentRetries += 10;\n checkedFonts.set(font, currentRetries, true);\n if (currentRetries < retries) {\n done = false;\n }\n }\n }\n }\n timeout = undefined;\n if (!done) {\n timeout = setTimeout(check, 100);\n }\n }\n\n return async function (fontSpec) {\n if (!fontFaceSet) {\n fontFaceSet = WORKER_OFFSCREEN_CANVAS ? self.fonts : document.fonts;\n }\n const font = getFontParameters(fontSpec);\n if (!font) {\n return;\n }\n const families = font.families;\n let needCheck = false;\n for (const family of families) {\n if (genericFontFamilies.has(family)) {\n continue;\n }\n const key = getFontKey(font.style, font.weight, family);\n if (checkedFonts.get(key) !== undefined) {\n continue;\n }\n checkedFonts.set(key, 0, true);\n needCheck = true;\n }\n if (needCheck) {\n clearTimeout(timeout);\n timeout = setTimeout(check, 100);\n }\n };\n})();\n\n/**\n * @param {string} font Font to use for measuring.\n * @return {import(\"../size.js\").Size} Measurement.\n */\nexport const measureTextHeight = (function () {\n /**\n * @type {HTMLDivElement}\n */\n let measureElement;\n return function (fontSpec) {\n let height = textHeights[fontSpec];\n if (height == undefined) {\n if (WORKER_OFFSCREEN_CANVAS) {\n const font = getFontParameters(fontSpec);\n const metrics = measureText(fontSpec, 'Žg');\n const lineHeight = isNaN(Number(font.lineHeight))\n ? 1.2\n : Number(font.lineHeight);\n height =\n lineHeight *\n (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);\n } else {\n if (!measureElement) {\n measureElement = document.createElement('div');\n measureElement.innerHTML = 'M';\n measureElement.style.minHeight = '0';\n measureElement.style.maxHeight = 'none';\n measureElement.style.height = 'auto';\n measureElement.style.padding = '0';\n measureElement.style.border = 'none';\n measureElement.style.position = 'absolute';\n measureElement.style.display = 'block';\n measureElement.style.left = '-99999px';\n }\n measureElement.style.font = fontSpec;\n document.body.appendChild(measureElement);\n height = measureElement.offsetHeight;\n document.body.removeChild(measureElement);\n }\n textHeights[fontSpec] = height;\n }\n return height;\n };\n})();\n\n/**\n * @param {string} font Font.\n * @param {string} text Text.\n * @return {TextMetrics} Text metrics.\n */\nfunction measureText(font, text) {\n if (!measureContext) {\n measureContext = createCanvasContext2D(1, 1);\n }\n if (font != measureFont) {\n measureContext.font = font;\n measureFont = measureContext.font;\n }\n return measureContext.measureText(text);\n}\n\n/**\n * @param {string} font Font.\n * @param {string} text Text.\n * @return {number} Width.\n */\nexport function measureTextWidth(font, text) {\n return measureText(font, text).width;\n}\n\n/**\n * Measure text width using a cache.\n * @param {string} font The font.\n * @param {string} text The text to measure.\n * @param {Object<string, number>} cache A lookup of cached widths by text.\n * @return {number} The text width.\n */\nexport function measureAndCacheTextWidth(font, text, cache) {\n if (text in cache) {\n return cache[text];\n }\n const width = text\n .split('\\n')\n .reduce((prev, curr) => Math.max(prev, measureTextWidth(font, curr)), 0);\n cache[text] = width;\n return width;\n}\n\n/**\n * @param {TextState} baseStyle Base style.\n * @param {Array<string>} chunks Text chunks to measure.\n * @return {{width: number, height: number, widths: Array<number>, heights: Array<number>, lineWidths: Array<number>}}} Text metrics.\n */\nexport function getTextDimensions(baseStyle, chunks) {\n const widths = [];\n const heights = [];\n const lineWidths = [];\n let width = 0;\n let lineWidth = 0;\n let height = 0;\n let lineHeight = 0;\n for (let i = 0, ii = chunks.length; i <= ii; i += 2) {\n const text = chunks[i];\n if (text === '\\n' || i === ii) {\n width = Math.max(width, lineWidth);\n lineWidths.push(lineWidth);\n lineWidth = 0;\n height += lineHeight;\n lineHeight = 0;\n continue;\n }\n const font = chunks[i + 1] || baseStyle.font;\n const currentWidth = measureTextWidth(font, text);\n widths.push(currentWidth);\n lineWidth += currentWidth;\n const currentHeight = measureTextHeight(font);\n heights.push(currentHeight);\n lineHeight = Math.max(lineHeight, currentHeight);\n }\n return {width, height, widths, heights, lineWidths};\n}\n\n/**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} rotation Rotation.\n * @param {number} offsetX X offset.\n * @param {number} offsetY Y offset.\n */\nexport function rotateAtOffset(context, rotation, offsetX, offsetY) {\n if (rotation !== 0) {\n context.translate(offsetX, offsetY);\n context.rotate(rotation);\n context.translate(-offsetX, -offsetY);\n }\n}\n\n/**\n * @param {CanvasRenderingContext2D|import(\"../render/canvas/ZIndexContext.js\").ZIndexContextProxy} context Context.\n * @param {import(\"../transform.js\").Transform|null} transform Transform.\n * @param {number} opacity Opacity.\n * @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label.\n * @param {number} originX Origin X.\n * @param {number} originY Origin Y.\n * @param {number} w Width.\n * @param {number} h Height.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../size.js\").Size} scale Scale.\n */\nexport function drawImageOrLabel(\n context,\n transform,\n opacity,\n labelOrImage,\n originX,\n originY,\n w,\n h,\n x,\n y,\n scale,\n) {\n context.save();\n\n if (opacity !== 1) {\n if (context.globalAlpha === undefined) {\n context.globalAlpha = (context) => (context.globalAlpha *= opacity);\n } else {\n context.globalAlpha *= opacity;\n }\n }\n if (transform) {\n context.transform.apply(context, transform);\n }\n\n if (/** @type {*} */ (labelOrImage).contextInstructions) {\n // label\n context.translate(x, y);\n context.scale(scale[0], scale[1]);\n executeLabelInstructions(/** @type {Label} */ (labelOrImage), context);\n } else if (scale[0] < 0 || scale[1] < 0) {\n // flipped image\n context.translate(x, y);\n context.scale(scale[0], scale[1]);\n context.drawImage(\n /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (\n labelOrImage\n ),\n originX,\n originY,\n w,\n h,\n 0,\n 0,\n w,\n h,\n );\n } else {\n // if image not flipped translate and scale can be avoided\n context.drawImage(\n /** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (\n labelOrImage\n ),\n originX,\n originY,\n w,\n h,\n x,\n y,\n w * scale[0],\n h * scale[1],\n );\n }\n\n context.restore();\n}\n\n/**\n * @param {Label} label Label.\n * @param {CanvasRenderingContext2D} context Context.\n */\nfunction executeLabelInstructions(label, context) {\n const contextInstructions = label.contextInstructions;\n for (let i = 0, ii = contextInstructions.length; i < ii; i += 2) {\n if (Array.isArray(contextInstructions[i + 1])) {\n context[contextInstructions[i]].apply(\n context,\n contextInstructions[i + 1],\n );\n } else {\n context[contextInstructions[i]] = contextInstructions[i + 1];\n }\n }\n}\n","/**\n * @module ol/style/Image\n */\nimport {toSize} from '../size.js';\nimport {abstract} from '../util.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} opacity Opacity.\n * @property {boolean} rotateWithView If the image should get rotated with the view.\n * @property {number} rotation Rotation.\n * @property {number|import(\"../size.js\").Size} scale Scale.\n * @property {Array<number>} displacement Displacement.\n * @property {import('../style/Style.js').DeclutterMode} declutterMode Declutter mode: `declutter`, `obstacle`, `none`.\n */\n\n/**\n * @classdesc\n * A base class used for creating subclasses and not instantiated in\n * apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and\n * {@link module:ol/style/RegularShape~RegularShape}.\n * @abstract\n * @api\n */\nclass ImageStyle {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n /**\n * @private\n * @type {number}\n */\n this.opacity_ = options.opacity;\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotateWithView_ = options.rotateWithView;\n\n /**\n * @private\n * @type {number}\n */\n this.rotation_ = options.rotation;\n\n /**\n * @private\n * @type {number|import(\"../size.js\").Size}\n */\n this.scale_ = options.scale;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.scaleArray_ = toSize(options.scale);\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.displacement_ = options.displacement;\n\n /**\n * @private\n * @type {import('../style/Style.js').DeclutterMode}\n */\n this.declutterMode_ = options.declutterMode;\n }\n\n /**\n * Clones the style.\n * @return {ImageStyle} The cloned style.\n * @api\n */\n clone() {\n const scale = this.getScale();\n return new ImageStyle({\n opacity: this.getOpacity(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n }\n\n /**\n * Get the symbolizer opacity.\n * @return {number} Opacity.\n * @api\n */\n getOpacity() {\n return this.opacity_;\n }\n\n /**\n * Determine whether the symbolizer rotates with the map.\n * @return {boolean} Rotate with map.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Get the symoblizer rotation.\n * @return {number} Rotation.\n * @api\n */\n getRotation() {\n return this.rotation_;\n }\n\n /**\n * Get the symbolizer scale.\n * @return {number|import(\"../size.js\").Size} Scale.\n * @api\n */\n getScale() {\n return this.scale_;\n }\n\n /**\n * Get the symbolizer scale array.\n * @return {import(\"../size.js\").Size} Scale array.\n */\n getScaleArray() {\n return this.scaleArray_;\n }\n\n /**\n * Get the displacement of the shape\n * @return {Array<number>} Shape's center displacement\n * @api\n */\n getDisplacement() {\n return this.displacement_;\n }\n\n /**\n * Get the declutter mode of the shape\n * @return {import(\"./Style.js\").DeclutterMode} Shape's declutter mode\n * @api\n */\n getDeclutterMode() {\n return this.declutterMode_;\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @abstract\n * @return {Array<number>} Anchor.\n */\n getAnchor() {\n return abstract();\n }\n\n /**\n * Get the image element for the symbolizer.\n * @abstract\n * @param {number} pixelRatio Pixel ratio.\n * @return {import('../DataTile.js').ImageLike} Image element.\n */\n getImage(pixelRatio) {\n return abstract();\n }\n\n /**\n * @abstract\n * @return {import('../DataTile.js').ImageLike} Image element.\n */\n getHitDetectionImage() {\n return abstract();\n }\n\n /**\n * Get the image pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Pixel ratio.\n */\n getPixelRatio(pixelRatio) {\n return 1;\n }\n\n /**\n * @abstract\n * @return {import(\"../ImageState.js\").default} Image state.\n */\n getImageState() {\n return abstract();\n }\n\n /**\n * @abstract\n * @return {import(\"../size.js\").Size} Image size.\n */\n getImageSize() {\n return abstract();\n }\n\n /**\n * Get the origin of the symbolizer.\n * @abstract\n * @return {Array<number>} Origin.\n */\n getOrigin() {\n return abstract();\n }\n\n /**\n * Get the size of the symbolizer (in pixels).\n * @abstract\n * @return {import(\"../size.js\").Size} Size.\n */\n getSize() {\n return abstract();\n }\n\n /**\n * Set the displacement.\n *\n * @param {Array<number>} displacement Displacement.\n * @api\n */\n setDisplacement(displacement) {\n this.displacement_ = displacement;\n }\n\n /**\n * Set the opacity.\n *\n * @param {number} opacity Opacity.\n * @api\n */\n setOpacity(opacity) {\n this.opacity_ = opacity;\n }\n\n /**\n * Set whether to rotate the style with the view.\n *\n * @param {boolean} rotateWithView Rotate with map.\n * @api\n */\n setRotateWithView(rotateWithView) {\n this.rotateWithView_ = rotateWithView;\n }\n\n /**\n * Set the rotation.\n *\n * @param {number} rotation Rotation.\n * @api\n */\n setRotation(rotation) {\n this.rotation_ = rotation;\n }\n\n /**\n * Set the scale.\n *\n * @param {number|import(\"../size.js\").Size} scale Scale.\n * @api\n */\n setScale(scale) {\n this.scale_ = scale;\n this.scaleArray_ = toSize(scale);\n }\n\n /**\n * @abstract\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n listenImageChange(listener) {\n abstract();\n }\n\n /**\n * Load not yet loaded URI.\n * @abstract\n */\n load() {\n abstract();\n }\n\n /**\n * @abstract\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n */\n unlistenImageChange(listener) {\n abstract();\n }\n\n /**\n * @return {Promise<void>} `false` or Promise that resolves when the style is ready to use.\n */\n ready() {\n return Promise.resolve();\n }\n}\n\nexport default ImageStyle;\n","/**\n * @module ol/style/RegularShape\n */\n\nimport ImageState from '../ImageState.js';\nimport {asArray} from '../color.js';\nimport {asColorLike} from '../colorlike.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {\n defaultFillStyle,\n defaultLineCap,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n} from '../render/canvas.js';\nimport IconImage from './IconImage.js';\nimport {shared as iconImageCache} from './IconImageCache.js';\nimport ImageStyle from './Image.js';\n\n/**\n * Specify radius for regular polygons, or both radius and radius2 for stars.\n * @typedef {Object} Options\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points\n * is the number of sides.\n * @property {number} radius Radius of a regular polygon.\n * @property {number} [radius2] Second radius to make a star instead of a regular polygon.\n * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's points facing up.\n * @property {Array<number>} [displacement=[0, 0]] Displacement of the shape in pixels.\n * Positive values will shift the shape right and up.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.\n * @property {number|import(\"../size.js\").Size} [scale=1] Scale. Unless two dimensional scaling is required a better\n * result may be obtained with appropriate settings for `radius` and `radius2`.\n * @property {import('./Style.js').DeclutterMode} [declutterMode] Declutter mode.\n */\n\n/**\n * @typedef {Object} RenderOptions\n * @property {import(\"../colorlike.js\").ColorLike|undefined} strokeStyle StrokeStyle.\n * @property {number} strokeWidth StrokeWidth.\n * @property {number} size Size.\n * @property {CanvasLineCap} lineCap LineCap.\n * @property {Array<number>|null} lineDash LineDash.\n * @property {number} lineDashOffset LineDashOffset.\n * @property {CanvasLineJoin} lineJoin LineJoin.\n * @property {number} miterLimit MiterLimit.\n */\n\n/**\n * @classdesc\n * Set regular shape style for vector features. The resulting shape will be\n * a regular polygon when `radius` is provided, or a star when both `radius` and\n * `radius2` are provided.\n * @api\n */\nclass RegularShape extends ImageStyle {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n super({\n opacity: 1,\n rotateWithView:\n options.rotateWithView !== undefined ? options.rotateWithView : false,\n rotation: options.rotation !== undefined ? options.rotation : 0,\n scale: options.scale !== undefined ? options.scale : 1,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n declutterMode: options.declutterMode,\n });\n\n /**\n * @private\n * @type {HTMLCanvasElement|null}\n */\n this.hitDetectionCanvas_ = null;\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default|null}\n */\n this.fill_ = options.fill !== undefined ? options.fill : null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.origin_ = [0, 0];\n\n /**\n * @private\n * @type {number}\n */\n this.points_ = options.points;\n\n /**\n * @protected\n * @type {number}\n */\n this.radius = options.radius;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.radius2_ = options.radius2;\n\n /**\n * @private\n * @type {number}\n */\n this.angle_ = options.angle !== undefined ? options.angle : 0;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default|null}\n */\n this.stroke_ = options.stroke !== undefined ? options.stroke : null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.size_;\n\n /**\n * @private\n * @type {RenderOptions}\n */\n this.renderOptions_;\n\n /**\n * @private\n */\n this.imageState_ =\n this.fill_ && this.fill_.loading()\n ? ImageState.LOADING\n : ImageState.LOADED;\n if (this.imageState_ === ImageState.LOADING) {\n this.ready().then(() => (this.imageState_ = ImageState.LOADED));\n }\n this.render();\n }\n\n /**\n * Clones the style.\n * @return {RegularShape} The cloned style.\n * @api\n * @override\n */\n clone() {\n const scale = this.getScale();\n const style = new RegularShape({\n fill: this.getFill() ? this.getFill().clone() : undefined,\n points: this.getPoints(),\n radius: this.getRadius(),\n radius2: this.getRadius2(),\n angle: this.getAngle(),\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n style.setOpacity(this.getOpacity());\n return style;\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @return {Array<number>} Anchor.\n * @api\n * @override\n */\n getAnchor() {\n const size = this.size_;\n const displacement = this.getDisplacement();\n const scale = this.getScaleArray();\n // anchor is scaled by renderer but displacement should not be scaled\n // so divide by scale here\n return [\n size[0] / 2 - displacement[0] / scale[0],\n size[1] / 2 + displacement[1] / scale[1],\n ];\n }\n\n /**\n * Get the angle used in generating the shape.\n * @return {number} Shape's rotation in radians.\n * @api\n */\n getAngle() {\n return this.angle_;\n }\n\n /**\n * Get the fill style for the shape.\n * @return {import(\"./Fill.js\").default|null} Fill style.\n * @api\n */\n getFill() {\n return this.fill_;\n }\n\n /**\n * Set the fill style.\n * @param {import(\"./Fill.js\").default|null} fill Fill style.\n * @api\n */\n setFill(fill) {\n this.fill_ = fill;\n this.render();\n }\n\n /**\n * @return {HTMLCanvasElement} Image element.\n * @override\n */\n getHitDetectionImage() {\n if (!this.hitDetectionCanvas_) {\n this.hitDetectionCanvas_ = this.createHitDetectionCanvas_(\n this.renderOptions_,\n );\n }\n return this.hitDetectionCanvas_;\n }\n\n /**\n * Get the image icon.\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLCanvasElement} Image or Canvas element.\n * @api\n * @override\n */\n getImage(pixelRatio) {\n const fillKey = this.fill_?.getKey();\n const cacheKey =\n `${pixelRatio},${this.angle_},${this.radius},${this.radius2_},${this.points_},${fillKey}` +\n Object.values(this.renderOptions_).join(',');\n let image = /** @type {HTMLCanvasElement} */ (\n iconImageCache.get(cacheKey, null, null)?.getImage(1)\n );\n if (!image) {\n const renderOptions = this.renderOptions_;\n const size = Math.ceil(renderOptions.size * pixelRatio);\n const context = createCanvasContext2D(size, size);\n this.draw_(renderOptions, context, pixelRatio);\n\n image = context.canvas;\n iconImageCache.set(\n cacheKey,\n null,\n null,\n new IconImage(image, undefined, null, ImageState.LOADED, null),\n );\n }\n return image;\n }\n\n /**\n * Get the image pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Pixel ratio.\n * @override\n */\n getPixelRatio(pixelRatio) {\n return pixelRatio;\n }\n\n /**\n * @return {import(\"../size.js\").Size} Image size.\n * @override\n */\n getImageSize() {\n return this.size_;\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n * @override\n */\n getImageState() {\n return this.imageState_;\n }\n\n /**\n * Get the origin of the symbolizer.\n * @return {Array<number>} Origin.\n * @api\n * @override\n */\n getOrigin() {\n return this.origin_;\n }\n\n /**\n * Get the number of points for generating the shape.\n * @return {number} Number of points for stars and regular polygons.\n * @api\n */\n getPoints() {\n return this.points_;\n }\n\n /**\n * Get the (primary) radius for the shape.\n * @return {number} Radius.\n * @api\n */\n getRadius() {\n return this.radius;\n }\n\n /**\n * Get the secondary radius for the shape.\n * @return {number|undefined} Radius2.\n * @api\n */\n getRadius2() {\n return this.radius2_;\n }\n\n /**\n * Get the size of the symbolizer (in pixels).\n * @return {import(\"../size.js\").Size} Size.\n * @api\n * @override\n */\n getSize() {\n return this.size_;\n }\n\n /**\n * Get the stroke style for the shape.\n * @return {import(\"./Stroke.js\").default|null} Stroke style.\n * @api\n */\n getStroke() {\n return this.stroke_;\n }\n\n /**\n * Set the stroke style.\n * @param {import(\"./Stroke.js\").default|null} stroke Stroke style.\n * @api\n */\n setStroke(stroke) {\n this.stroke_ = stroke;\n this.render();\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n listenImageChange(listener) {}\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {}\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n unlistenImageChange(listener) {}\n\n /**\n * Calculate additional canvas size needed for the miter.\n * @param {string} lineJoin Line join\n * @param {number} strokeWidth Stroke width\n * @param {number} miterLimit Miter limit\n * @return {number} Additional canvas size needed\n * @private\n */\n calculateLineJoinSize_(lineJoin, strokeWidth, miterLimit) {\n if (\n strokeWidth === 0 ||\n this.points_ === Infinity ||\n (lineJoin !== 'bevel' && lineJoin !== 'miter')\n ) {\n return strokeWidth;\n }\n // m | ^\n // i | |\\ .\n // t >| #\\\n // e | |\\ \\ .\n // r \\s\\\n // | \\t\\ . .\n // \\r\\ . .\n // | \\o\\ . . . . .\n // e \\k\\ . . . .\n // | \\e\\ . . . . .\n // d \\ \\ . . . .\n // | _ _a_ _\\# . . .\n // r1 / ` . .\n // | . .\n // b / . .\n // | . .\n // / r2 . .\n // | . .\n // / . .\n // |α . .\n // / . .\n // ° center\n let r1 = this.radius;\n let r2 = this.radius2_ === undefined ? r1 : this.radius2_;\n if (r1 < r2) {\n const tmp = r1;\n r1 = r2;\n r2 = tmp;\n }\n const points =\n this.radius2_ === undefined ? this.points_ : this.points_ * 2;\n const alpha = (2 * Math.PI) / points;\n const a = r2 * Math.sin(alpha);\n const b = Math.sqrt(r2 * r2 - a * a);\n const d = r1 - b;\n const e = Math.sqrt(a * a + d * d);\n const miterRatio = e / a;\n if (lineJoin === 'miter' && miterRatio <= miterLimit) {\n return miterRatio * strokeWidth;\n }\n // Calculate the distance from center to the stroke corner where\n // it was cut short because of the miter limit.\n // l\n // ----+---- <= distance from center to here is maxr\n // /####|k ##\\\n // /#####^#####\\\n // /#### /+\\# s #\\\n // /### h/+++\\# t #\\\n // /### t/+++++\\# r #\\\n // /### a/+++++++\\# o #\\\n // /### p/++ fill +\\# k #\\\n ///#### /+++++^+++++\\# e #\\\n //#####/+++++/+\\+++++\\#####\\\n const k = strokeWidth / 2 / miterRatio;\n const l = (strokeWidth / 2) * (d / e);\n const maxr = Math.sqrt((r1 + k) * (r1 + k) + l * l);\n const bevelAdd = maxr - r1;\n if (this.radius2_ === undefined || lineJoin === 'bevel') {\n return bevelAdd * 2;\n }\n // If outer miter is over the miter limit the inner miter may reach through the\n // center and be longer than the bevel, same calculation as above but swap r1 / r2.\n const aa = r1 * Math.sin(alpha);\n const bb = Math.sqrt(r1 * r1 - aa * aa);\n const dd = r2 - bb;\n const ee = Math.sqrt(aa * aa + dd * dd);\n const innerMiterRatio = ee / aa;\n if (innerMiterRatio <= miterLimit) {\n const innerLength = (innerMiterRatio * strokeWidth) / 2 - r2 - r1;\n return 2 * Math.max(bevelAdd, innerLength);\n }\n return bevelAdd * 2;\n }\n\n /**\n * @return {RenderOptions} The render options\n * @protected\n */\n createRenderOptions() {\n let lineCap = defaultLineCap;\n let lineJoin = defaultLineJoin;\n let miterLimit = 0;\n let lineDash = null;\n let lineDashOffset = 0;\n let strokeStyle;\n let strokeWidth = 0;\n\n if (this.stroke_) {\n strokeStyle = asColorLike(this.stroke_.getColor() ?? defaultStrokeStyle);\n strokeWidth = this.stroke_.getWidth() ?? defaultLineWidth;\n lineDash = this.stroke_.getLineDash();\n lineDashOffset = this.stroke_.getLineDashOffset() ?? 0;\n lineJoin = this.stroke_.getLineJoin() ?? defaultLineJoin;\n lineCap = this.stroke_.getLineCap() ?? defaultLineCap;\n miterLimit = this.stroke_.getMiterLimit() ?? defaultMiterLimit;\n }\n\n const add = this.calculateLineJoinSize_(lineJoin, strokeWidth, miterLimit);\n const maxRadius = Math.max(this.radius, this.radius2_ || 0);\n const size = Math.ceil(2 * maxRadius + add);\n\n return {\n strokeStyle: strokeStyle,\n strokeWidth: strokeWidth,\n size: size,\n lineCap: lineCap,\n lineDash: lineDash,\n lineDashOffset: lineDashOffset,\n lineJoin: lineJoin,\n miterLimit: miterLimit,\n };\n }\n\n /**\n * @protected\n */\n render() {\n this.renderOptions_ = this.createRenderOptions();\n const size = this.renderOptions_.size;\n this.hitDetectionCanvas_ = null;\n this.size_ = [size, size];\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @param {CanvasRenderingContext2D} context The rendering context.\n * @param {number} pixelRatio The pixel ratio.\n */\n draw_(renderOptions, context, pixelRatio) {\n context.scale(pixelRatio, pixelRatio);\n // set origin to canvas center\n context.translate(renderOptions.size / 2, renderOptions.size / 2);\n\n this.createPath_(context);\n\n if (this.fill_) {\n let color = this.fill_.getColor();\n if (color === null) {\n color = defaultFillStyle;\n }\n context.fillStyle = asColorLike(color);\n context.fill();\n }\n if (renderOptions.strokeStyle) {\n context.strokeStyle = renderOptions.strokeStyle;\n context.lineWidth = renderOptions.strokeWidth;\n if (renderOptions.lineDash) {\n context.setLineDash(renderOptions.lineDash);\n context.lineDashOffset = renderOptions.lineDashOffset;\n }\n context.lineCap = renderOptions.lineCap;\n context.lineJoin = renderOptions.lineJoin;\n context.miterLimit = renderOptions.miterLimit;\n context.stroke();\n }\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @return {HTMLCanvasElement} Canvas containing the icon\n */\n createHitDetectionCanvas_(renderOptions) {\n let context;\n if (this.fill_) {\n let color = this.fill_.getColor();\n\n // determine if fill is transparent (or pattern or gradient)\n let opacity = 0;\n if (typeof color === 'string') {\n color = asArray(color);\n }\n if (color === null) {\n opacity = 1;\n } else if (Array.isArray(color)) {\n opacity = color.length === 4 ? color[3] : 1;\n }\n if (opacity === 0) {\n // if a transparent fill style is set, create an extra hit-detection image\n // with a default fill style\n context = createCanvasContext2D(renderOptions.size, renderOptions.size);\n this.drawHitDetectionCanvas_(renderOptions, context);\n }\n }\n return context ? context.canvas : this.getImage(1);\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context The context to draw in.\n */\n createPath_(context) {\n let points = this.points_;\n const radius = this.radius;\n if (points === Infinity) {\n context.arc(0, 0, radius, 0, 2 * Math.PI);\n } else {\n const radius2 = this.radius2_ === undefined ? radius : this.radius2_;\n if (this.radius2_ !== undefined) {\n points *= 2;\n }\n const startAngle = this.angle_ - Math.PI / 2;\n const step = (2 * Math.PI) / points;\n for (let i = 0; i < points; i++) {\n const angle0 = startAngle + i * step;\n const radiusC = i % 2 === 0 ? radius : radius2;\n context.lineTo(radiusC * Math.cos(angle0), radiusC * Math.sin(angle0));\n }\n context.closePath();\n }\n }\n\n /**\n * @private\n * @param {RenderOptions} renderOptions Render options.\n * @param {CanvasRenderingContext2D} context The context.\n */\n drawHitDetectionCanvas_(renderOptions, context) {\n // set origin to canvas center\n context.translate(renderOptions.size / 2, renderOptions.size / 2);\n\n this.createPath_(context);\n\n context.fillStyle = defaultFillStyle;\n context.fill();\n if (renderOptions.strokeStyle) {\n context.strokeStyle = renderOptions.strokeStyle;\n context.lineWidth = renderOptions.strokeWidth;\n if (renderOptions.lineDash) {\n context.setLineDash(renderOptions.lineDash);\n context.lineDashOffset = renderOptions.lineDashOffset;\n }\n context.lineJoin = renderOptions.lineJoin;\n context.miterLimit = renderOptions.miterLimit;\n context.stroke();\n }\n }\n\n /**\n * @override\n */\n ready() {\n return this.fill_ ? this.fill_.ready() : Promise.resolve();\n }\n}\n\nexport default RegularShape;\n","/**\n * @module ol/style/Circle\n */\n\nimport RegularShape from './RegularShape.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {number} radius Circle radius.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {Array<number>} [displacement=[0,0]] displacement\n * @property {number|import(\"../size.js\").Size} [scale=1] Scale. A two dimensional scale will produce an ellipse.\n * Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `radius`.\n * @property {number} [rotation=0] Rotation in radians\n * (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).\n * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view\n * (meaningful only when used in conjunction with a two dimensional scale).\n * @property {import('./Style.js').DeclutterMode} [declutterMode] Declutter mode\n */\n\n/**\n * @classdesc\n * Set circle style for vector features.\n * @api\n */\nclass CircleStyle extends RegularShape {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {radius: 5};\n\n super({\n points: Infinity,\n fill: options.fill,\n radius: options.radius,\n stroke: options.stroke,\n scale: options.scale !== undefined ? options.scale : 1,\n rotation: options.rotation !== undefined ? options.rotation : 0,\n rotateWithView:\n options.rotateWithView !== undefined ? options.rotateWithView : false,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n declutterMode: options.declutterMode,\n });\n }\n\n /**\n * Clones the style.\n * @return {CircleStyle} The cloned style.\n * @api\n * @override\n */\n clone() {\n const scale = this.getScale();\n const style = new CircleStyle({\n fill: this.getFill() ? this.getFill().clone() : undefined,\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n radius: this.getRadius(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n style.setOpacity(this.getOpacity());\n return style;\n }\n\n /**\n * Set the circle radius.\n *\n * @param {number} radius Circle radius.\n * @api\n */\n setRadius(radius) {\n this.radius = radius;\n this.render();\n }\n}\n\nexport default CircleStyle;\n","/**\n * @module ol/style/Fill\n */\n\nimport ImageState from '../ImageState.js';\nimport {asArray} from '../color.js';\nimport {getUid} from '../util.js';\nimport {get as getIconImage} from './IconImage.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null} [color=null] A color,\n * gradient or pattern.\n * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats. For polygon fills (not for {@link import(\"./RegularShape.js\").default} fills),\n * a pattern can also be provided as {@link module:ol/colorlike~PatternDescriptor}.\n * Default null; if null, the Canvas/renderer default black will be used.\n */\n\n/**\n * @classdesc\n * Set fill style for vector features.\n * @api\n */\nclass Fill {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @private\n * @type {import(\"./IconImage.js\").default|null}\n */\n this.patternImage_ = null;\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null}\n */\n this.color_ = null;\n if (options.color !== undefined) {\n this.setColor(options.color);\n }\n }\n\n /**\n * Clones the style. The color is not cloned if it is a {@link module:ol/colorlike~ColorLike}.\n * @return {Fill} The cloned style.\n * @api\n */\n clone() {\n const color = this.getColor();\n return new Fill({\n color: Array.isArray(color) ? color.slice() : color || undefined,\n });\n }\n\n /**\n * Get the fill color.\n * @return {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Set the color.\n *\n * @param {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike|import('../colorlike.js').PatternDescriptor|null} color Color.\n * @api\n */\n setColor(color) {\n if (color !== null && typeof color === 'object' && 'src' in color) {\n const patternImage = getIconImage(\n null,\n color.src,\n 'anonymous',\n undefined,\n color.offset ? null : color.color ? color.color : null,\n !(color.offset && color.size),\n );\n patternImage.ready().then(() => {\n this.patternImage_ = null;\n });\n if (patternImage.getImageState() === ImageState.IDLE) {\n patternImage.load();\n }\n if (patternImage.getImageState() === ImageState.LOADING) {\n this.patternImage_ = patternImage;\n }\n }\n this.color_ = color;\n }\n\n /**\n * @return {string} Key of the fill for cache lookup.\n */\n getKey() {\n const fill = this.getColor();\n if (!fill) {\n return '';\n }\n return fill instanceof CanvasPattern || fill instanceof CanvasGradient\n ? getUid(fill)\n : typeof fill === 'object' && 'src' in fill\n ? fill.src + ':' + fill.offset\n : asArray(fill).toString();\n }\n\n /**\n * @return {boolean} The fill style is loading an image pattern.\n */\n loading() {\n return !!this.patternImage_;\n }\n\n /**\n * @return {Promise<void>} `false` or a promise that resolves when the style is ready to use.\n */\n ready() {\n return this.patternImage_ ? this.patternImage_.ready() : Promise.resolve();\n }\n}\n\nexport default Fill;\n","/**\n * @module ol/style/Icon\n */\nimport ImageState from '../ImageState.js';\nimport {assert} from '../asserts.js';\nimport {asArray} from '../color.js';\nimport EventType from '../events/EventType.js';\nimport {getUid} from '../util.js';\nimport {get as getIconImage} from './IconImage.js';\nimport ImageStyle from './Image.js';\n\n/**\n * @typedef {'fraction' | 'pixels'} IconAnchorUnits\n * Anchor unit can be either a fraction of the icon size or in pixels.\n */\n\n/**\n * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} IconOrigin\n * Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.\n */\n\n/**\n * @typedef {Object} Options\n * @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.\n * @property {IconOrigin} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {IconAnchorUnits} [anchorXUnits='fraction'] Units in which the anchor x value is\n * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates\n * the x value in pixels.\n * @property {IconAnchorUnits} [anchorYUnits='fraction'] Units in which the anchor y value is\n * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates\n * the y value in pixels.\n * @property {import(\"../color.js\").Color|string} [color] Color to tint the icon. If not specified,\n * the icon will be left as is.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a\n * `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {HTMLImageElement|HTMLCanvasElement|ImageBitmap} [img] Image object for the icon.\n * @property {Array<number>} [displacement=[0, 0]] Displacement of the icon in pixels.\n * Positive values will shift the icon right and up.\n * @property {number} [opacity=1] Opacity of the icon.\n * @property {number} [width] The width of the icon in pixels. This can't be used together with `scale`.\n * @property {number} [height] The height of the icon in pixels. This can't be used together with `scale`.\n * @property {number|import(\"../size.js\").Size} [scale=1] Scale.\n * @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {Array<number>} [offset=[0, 0]] Offset which, together with `size` and `offsetOrigin`, defines the\n * sub-rectangle to use from the original (sprite) image.\n * @property {IconOrigin} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {import(\"../size.js\").Size} [size] Icon size in pixels. Used together with `offset` to define the\n * sub-rectangle to use from the original (sprite) image.\n * @property {string} [src] Image source URI.\n * @property {import(\"./Style.js\").DeclutterMode} [declutterMode] Declutter mode.\n */\n\n/**\n * @param {number} width The width.\n * @param {number} height The height.\n * @param {number|undefined} wantedWidth The wanted width.\n * @param {number|undefined} wantedHeight The wanted height.\n * @return {number|Array<number>} The scale.\n */\nfunction calculateScale(width, height, wantedWidth, wantedHeight) {\n if (wantedWidth !== undefined && wantedHeight !== undefined) {\n return [wantedWidth / width, wantedHeight / height];\n }\n if (wantedWidth !== undefined) {\n return wantedWidth / width;\n }\n if (wantedHeight !== undefined) {\n return wantedHeight / height;\n }\n return 1;\n}\n\n/**\n * @classdesc\n * Set icon style for vector features.\n * @api\n */\nclass Icon extends ImageStyle {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @type {number}\n */\n const opacity = options.opacity !== undefined ? options.opacity : 1;\n\n /**\n * @type {number}\n */\n const rotation = options.rotation !== undefined ? options.rotation : 0;\n\n /**\n * @type {number|import(\"../size.js\").Size}\n */\n const scale = options.scale !== undefined ? options.scale : 1;\n\n /**\n * @type {boolean}\n */\n const rotateWithView =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n super({\n opacity: opacity,\n rotation: rotation,\n scale: scale,\n displacement:\n options.displacement !== undefined ? options.displacement : [0, 0],\n rotateWithView: rotateWithView,\n declutterMode: options.declutterMode,\n });\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5];\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.normalizedAnchor_ = null;\n\n /**\n * @private\n * @type {IconOrigin}\n */\n this.anchorOrigin_ =\n options.anchorOrigin !== undefined ? options.anchorOrigin : 'top-left';\n\n /**\n * @private\n * @type {IconAnchorUnits}\n */\n this.anchorXUnits_ =\n options.anchorXUnits !== undefined ? options.anchorXUnits : 'fraction';\n\n /**\n * @private\n * @type {IconAnchorUnits}\n */\n this.anchorYUnits_ =\n options.anchorYUnits !== undefined ? options.anchorYUnits : 'fraction';\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n const image = options.img !== undefined ? options.img : null;\n\n let cacheKey = options.src;\n\n assert(\n !(cacheKey !== undefined && image),\n '`image` and `src` cannot be provided at the same time',\n );\n\n if ((cacheKey === undefined || cacheKey.length === 0) && image) {\n cacheKey = /** @type {HTMLImageElement} */ (image).src || getUid(image);\n }\n assert(\n cacheKey !== undefined && cacheKey.length > 0,\n 'A defined and non-empty `src` or `image` must be provided',\n );\n\n assert(\n !(\n (options.width !== undefined || options.height !== undefined) &&\n options.scale !== undefined\n ),\n '`width` or `height` cannot be provided together with `scale`',\n );\n\n let imageState;\n if (options.src !== undefined) {\n imageState = ImageState.IDLE;\n } else if (image !== undefined) {\n if ('complete' in image) {\n if (image.complete) {\n imageState = image.src ? ImageState.LOADED : ImageState.IDLE;\n } else {\n imageState = ImageState.LOADING;\n }\n } else {\n imageState = ImageState.LOADED;\n }\n }\n\n /**\n * @private\n * @type {import(\"../color.js\").Color}\n */\n this.color_ = options.color !== undefined ? asArray(options.color) : null;\n\n /**\n * @private\n * @type {import(\"./IconImage.js\").default}\n */\n this.iconImage_ = getIconImage(\n image,\n /** @type {string} */ (cacheKey),\n this.crossOrigin_,\n imageState,\n this.color_,\n );\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.offset_ = options.offset !== undefined ? options.offset : [0, 0];\n /**\n * @private\n * @type {IconOrigin}\n */\n this.offsetOrigin_ =\n options.offsetOrigin !== undefined ? options.offsetOrigin : 'top-left';\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.origin_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.size_ = options.size !== undefined ? options.size : null;\n\n /**\n * @private\n */\n this.initialOptions_;\n\n /**\n * Calculate the scale if width or height were given.\n */\n if (options.width !== undefined || options.height !== undefined) {\n let width, height;\n if (options.size) {\n [width, height] = options.size;\n } else {\n const image = this.getImage(1);\n if (image.width && image.height) {\n width = image.width;\n height = image.height;\n } else if (image instanceof HTMLImageElement) {\n this.initialOptions_ = options;\n const onload = () => {\n this.unlistenImageChange(onload);\n if (!this.initialOptions_) {\n return;\n }\n const imageSize = this.iconImage_.getSize();\n this.setScale(\n calculateScale(\n imageSize[0],\n imageSize[1],\n options.width,\n options.height,\n ),\n );\n };\n this.listenImageChange(onload);\n return;\n }\n }\n if (width !== undefined) {\n this.setScale(\n calculateScale(width, height, options.width, options.height),\n );\n }\n }\n }\n\n /**\n * Clones the style. The underlying Image/HTMLCanvasElement is not cloned.\n * @return {Icon} The cloned style.\n * @api\n * @override\n */\n clone() {\n let scale, width, height;\n if (this.initialOptions_) {\n width = this.initialOptions_.width;\n height = this.initialOptions_.height;\n } else {\n scale = this.getScale();\n scale = Array.isArray(scale) ? scale.slice() : scale;\n }\n return new Icon({\n anchor: this.anchor_.slice(),\n anchorOrigin: this.anchorOrigin_,\n anchorXUnits: this.anchorXUnits_,\n anchorYUnits: this.anchorYUnits_,\n color:\n this.color_ && this.color_.slice\n ? this.color_.slice()\n : this.color_ || undefined,\n crossOrigin: this.crossOrigin_,\n offset: this.offset_.slice(),\n offsetOrigin: this.offsetOrigin_,\n opacity: this.getOpacity(),\n rotateWithView: this.getRotateWithView(),\n rotation: this.getRotation(),\n scale,\n width,\n height,\n size: this.size_ !== null ? this.size_.slice() : undefined,\n src: this.getSrc(),\n displacement: this.getDisplacement().slice(),\n declutterMode: this.getDeclutterMode(),\n });\n }\n\n /**\n * Get the anchor point in pixels. The anchor determines the center point for the\n * symbolizer.\n * @return {Array<number>} Anchor.\n * @api\n * @override\n */\n getAnchor() {\n let anchor = this.normalizedAnchor_;\n if (!anchor) {\n anchor = this.anchor_;\n const size = this.getSize();\n if (\n this.anchorXUnits_ == 'fraction' ||\n this.anchorYUnits_ == 'fraction'\n ) {\n if (!size) {\n return null;\n }\n anchor = this.anchor_.slice();\n if (this.anchorXUnits_ == 'fraction') {\n anchor[0] *= size[0];\n }\n if (this.anchorYUnits_ == 'fraction') {\n anchor[1] *= size[1];\n }\n }\n\n if (this.anchorOrigin_ != 'top-left') {\n if (!size) {\n return null;\n }\n if (anchor === this.anchor_) {\n anchor = this.anchor_.slice();\n }\n if (\n this.anchorOrigin_ == 'top-right' ||\n this.anchorOrigin_ == 'bottom-right'\n ) {\n anchor[0] = -anchor[0] + size[0];\n }\n if (\n this.anchorOrigin_ == 'bottom-left' ||\n this.anchorOrigin_ == 'bottom-right'\n ) {\n anchor[1] = -anchor[1] + size[1];\n }\n }\n this.normalizedAnchor_ = anchor;\n }\n const displacement = this.getDisplacement();\n const scale = this.getScaleArray();\n // anchor is scaled by renderer but displacement should not be scaled\n // so divide by scale here\n return [\n anchor[0] - displacement[0] / scale[0],\n anchor[1] + displacement[1] / scale[1],\n ];\n }\n\n /**\n * Set the anchor point. The anchor determines the center point for the\n * symbolizer.\n *\n * @param {Array<number>} anchor Anchor.\n * @api\n */\n setAnchor(anchor) {\n this.anchor_ = anchor;\n this.normalizedAnchor_ = null;\n }\n\n /**\n * Get the icon color.\n * @return {import(\"../color.js\").Color} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Get the image icon.\n * @param {number} pixelRatio Pixel ratio.\n * @return {HTMLImageElement|HTMLCanvasElement|ImageBitmap} Image or Canvas element. If the Icon\n * style was configured with `src` or with a not let loaded `img`, an `ImageBitmap` will be returned.\n * @api\n * @override\n */\n getImage(pixelRatio) {\n return this.iconImage_.getImage(pixelRatio);\n }\n\n /**\n * Get the pixel ratio.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} The pixel ratio of the image.\n * @api\n * @override\n */\n getPixelRatio(pixelRatio) {\n return this.iconImage_.getPixelRatio(pixelRatio);\n }\n\n /**\n * @return {import(\"../size.js\").Size} Image size.\n * @override\n */\n getImageSize() {\n return this.iconImage_.getSize();\n }\n\n /**\n * @return {import(\"../ImageState.js\").default} Image state.\n * @override\n */\n getImageState() {\n return this.iconImage_.getImageState();\n }\n\n /**\n * @return {HTMLImageElement|HTMLCanvasElement|ImageBitmap} Image element.\n * @override\n */\n getHitDetectionImage() {\n return this.iconImage_.getHitDetectionImage();\n }\n\n /**\n * Get the origin of the symbolizer.\n * @return {Array<number>} Origin.\n * @api\n * @override\n */\n getOrigin() {\n if (this.origin_) {\n return this.origin_;\n }\n let offset = this.offset_;\n\n if (this.offsetOrigin_ != 'top-left') {\n const size = this.getSize();\n const iconImageSize = this.iconImage_.getSize();\n if (!size || !iconImageSize) {\n return null;\n }\n offset = offset.slice();\n if (\n this.offsetOrigin_ == 'top-right' ||\n this.offsetOrigin_ == 'bottom-right'\n ) {\n offset[0] = iconImageSize[0] - size[0] - offset[0];\n }\n if (\n this.offsetOrigin_ == 'bottom-left' ||\n this.offsetOrigin_ == 'bottom-right'\n ) {\n offset[1] = iconImageSize[1] - size[1] - offset[1];\n }\n }\n this.origin_ = offset;\n return this.origin_;\n }\n\n /**\n * Get the image URL.\n * @return {string|undefined} Image src.\n * @api\n */\n getSrc() {\n return this.iconImage_.getSrc();\n }\n\n /**\n * Get the size of the icon (in pixels).\n * @return {import(\"../size.js\").Size} Image size.\n * @api\n * @override\n */\n getSize() {\n return !this.size_ ? this.iconImage_.getSize() : this.size_;\n }\n\n /**\n * Get the width of the icon (in pixels). Will return undefined when the icon image is not yet loaded.\n * @return {number} Icon width (in pixels).\n * @api\n */\n getWidth() {\n const scale = this.getScaleArray();\n if (this.size_) {\n return this.size_[0] * scale[0];\n }\n if (this.iconImage_.getImageState() == ImageState.LOADED) {\n return this.iconImage_.getSize()[0] * scale[0];\n }\n return undefined;\n }\n\n /**\n * Get the height of the icon (in pixels). Will return undefined when the icon image is not yet loaded.\n * @return {number} Icon height (in pixels).\n * @api\n */\n getHeight() {\n const scale = this.getScaleArray();\n if (this.size_) {\n return this.size_[1] * scale[1];\n }\n if (this.iconImage_.getImageState() == ImageState.LOADED) {\n return this.iconImage_.getSize()[1] * scale[1];\n }\n return undefined;\n }\n\n /**\n * Set the scale.\n *\n * @param {number|import(\"../size.js\").Size} scale Scale.\n * @api\n * @override\n */\n setScale(scale) {\n delete this.initialOptions_;\n super.setScale(scale);\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n listenImageChange(listener) {\n this.iconImage_.addEventListener(EventType.CHANGE, listener);\n }\n\n /**\n * Load not yet loaded URI.\n * When rendering a feature with an icon style, the vector renderer will\n * automatically call this method. However, you might want to call this\n * method yourself for preloading or other purposes.\n * @api\n * @override\n */\n load() {\n this.iconImage_.load();\n }\n\n /**\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @override\n */\n unlistenImageChange(listener) {\n this.iconImage_.removeEventListener(EventType.CHANGE, listener);\n }\n\n /**\n * @override\n */\n ready() {\n return this.iconImage_.ready();\n }\n}\n\nexport default Icon;\n","/**\n * @module ol/style/Stroke\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} [color] A color, gradient or pattern.\n * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.\n * Default null; if null, the Canvas/renderer default black will be used.\n * @property {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.\n * @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`.\n * @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).\n * @property {number} [lineDashOffset=0] Line dash offset.\n * @property {number} [miterLimit=10] Miter limit.\n * @property {number} [width] Width.\n */\n\n/**\n * @classdesc\n * Set stroke style for vector features.\n * Note that the defaults given are the Canvas defaults, which will be used if\n * option is not defined. The `get` functions return whatever was entered in\n * the options; they will not return the default.\n * @api\n */\nclass Stroke {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @private\n * @type {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike}\n */\n this.color_ = options.color !== undefined ? options.color : null;\n\n /**\n * @private\n * @type {CanvasLineCap|undefined}\n */\n this.lineCap_ = options.lineCap;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lineDashOffset_ = options.lineDashOffset;\n\n /**\n * @private\n * @type {CanvasLineJoin|undefined}\n */\n this.lineJoin_ = options.lineJoin;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.miterLimit_ = options.miterLimit;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.width_ = options.width;\n }\n\n /**\n * Clones the style.\n * @return {Stroke} The cloned style.\n * @api\n */\n clone() {\n const color = this.getColor();\n return new Stroke({\n color: Array.isArray(color) ? color.slice() : color || undefined,\n lineCap: this.getLineCap(),\n lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,\n lineDashOffset: this.getLineDashOffset(),\n lineJoin: this.getLineJoin(),\n miterLimit: this.getMiterLimit(),\n width: this.getWidth(),\n });\n }\n\n /**\n * Get the stroke color.\n * @return {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} Color.\n * @api\n */\n getColor() {\n return this.color_;\n }\n\n /**\n * Get the line cap type for the stroke.\n * @return {CanvasLineCap|undefined} Line cap.\n * @api\n */\n getLineCap() {\n return this.lineCap_;\n }\n\n /**\n * Get the line dash style for the stroke.\n * @return {Array<number>|null} Line dash.\n * @api\n */\n getLineDash() {\n return this.lineDash_;\n }\n\n /**\n * Get the line dash offset for the stroke.\n * @return {number|undefined} Line dash offset.\n * @api\n */\n getLineDashOffset() {\n return this.lineDashOffset_;\n }\n\n /**\n * Get the line join type for the stroke.\n * @return {CanvasLineJoin|undefined} Line join.\n * @api\n */\n getLineJoin() {\n return this.lineJoin_;\n }\n\n /**\n * Get the miter limit for the stroke.\n * @return {number|undefined} Miter limit.\n * @api\n */\n getMiterLimit() {\n return this.miterLimit_;\n }\n\n /**\n * Get the stroke width.\n * @return {number|undefined} Width.\n * @api\n */\n getWidth() {\n return this.width_;\n }\n\n /**\n * Set the color.\n *\n * @param {import(\"../color.js\").Color|import(\"../colorlike.js\").ColorLike} color Color.\n * @api\n */\n setColor(color) {\n this.color_ = color;\n }\n\n /**\n * Set the line cap.\n *\n * @param {CanvasLineCap|undefined} lineCap Line cap.\n * @api\n */\n setLineCap(lineCap) {\n this.lineCap_ = lineCap;\n }\n\n /**\n * Set the line dash.\n *\n * @param {Array<number>|null} lineDash Line dash.\n * @api\n */\n setLineDash(lineDash) {\n this.lineDash_ = lineDash;\n }\n\n /**\n * Set the line dash offset.\n *\n * @param {number|undefined} lineDashOffset Line dash offset.\n * @api\n */\n setLineDashOffset(lineDashOffset) {\n this.lineDashOffset_ = lineDashOffset;\n }\n\n /**\n * Set the line join.\n *\n * @param {CanvasLineJoin|undefined} lineJoin Line join.\n * @api\n */\n setLineJoin(lineJoin) {\n this.lineJoin_ = lineJoin;\n }\n\n /**\n * Set the miter limit.\n *\n * @param {number|undefined} miterLimit Miter limit.\n * @api\n */\n setMiterLimit(miterLimit) {\n this.miterLimit_ = miterLimit;\n }\n\n /**\n * Set the width.\n *\n * @param {number|undefined} width Width.\n * @api\n */\n setWidth(width) {\n this.width_ = width;\n }\n}\n\nexport default Stroke;\n","/**\n * @module ol/style/Style\n */\n\nimport {assert} from '../asserts.js';\nimport CircleStyle from './Circle.js';\nimport Fill from './Fill.js';\nimport Stroke from './Stroke.js';\n\n/**\n * Defines how symbols and text are decluttered on layers ith `declutter` set to `true`\n * **declutter**: Overlapping symbols and text are decluttered.\n * **obstacle**: Symbols and text are rendered, but serve as obstacle for subsequent attempts\n * to place a symbol or text at the same location.\n * **none**: No decluttering is done.\n *\n * @typedef {\"declutter\"|\"obstacle\"|\"none\"} DeclutterMode\n */\n\n/**\n * A function that takes a {@link module:ol/Feature~Feature} and a `{number}`\n * representing the view's resolution. The function should return a\n * {@link module:ol/style/Style~Style} or an array of them. This way e.g. a\n * vector layer can be styled. If the function returns `undefined`, the\n * feature will not be rendered.\n *\n * @typedef {function(import(\"../Feature.js\").FeatureLike, number):(Style|Array<Style>|void)} StyleFunction\n */\n\n/**\n * A {@link Style}, an array of {@link Style}, or a {@link StyleFunction}.\n * @typedef {Style|Array<Style>|StyleFunction} StyleLike\n */\n\n/**\n * A function that takes a {@link module:ol/Feature~Feature} as argument and returns an\n * {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.\n *\n * @typedef {function(import(\"../Feature.js\").FeatureLike):\n * (import(\"../geom/Geometry.js\").default|import(\"../render/Feature.js\").default|undefined)} GeometryFunction\n */\n\n/**\n * Custom renderer function. Takes two arguments:\n *\n * 1. The pixel coordinates of the geometry in GeoJSON notation.\n * 2. The {@link module:ol/render~State} of the layer renderer.\n *\n * @typedef {function((import(\"../coordinate.js\").Coordinate|Array<import(\"../coordinate.js\").Coordinate>|Array<Array<import(\"../coordinate.js\").Coordinate>>|Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>),import(\"../render.js\").State): void} RenderFunction\n */\n\n/**\n * @typedef {Object} Options\n * @property {string|import(\"../geom/Geometry.js\").default|GeometryFunction} [geometry] Feature property or geometry\n * or function returning a geometry to render for this style.\n * @property {import(\"./Fill.js\").default} [fill] Fill style.\n * @property {import(\"./Image.js\").default} [image] Image style.\n * @property {RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be\n * ignored, and the provided function will be called with each render frame for each geometry.\n * @property {RenderFunction} [hitDetectionRenderer] Custom renderer for hit detection. If provided will be used\n * in hit detection rendering.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {import(\"./Text.js\").default} [text] Text style.\n * @property {number} [zIndex] Z index.\n */\n\n/**\n * @classdesc\n * Container for vector feature rendering styles. Any changes made to the style\n * or its children through `set*()` methods will not take effect until the\n * feature or layer that uses the style is re-rendered.\n *\n * ## Feature styles\n *\n * If no style is defined, the following default style is used:\n * ```js\n * import {Circle, Fill, Stroke, Style} from 'ol/style.js';\n *\n * const fill = new Fill({\n * color: 'rgba(255,255,255,0.4)',\n * });\n * const stroke = new Stroke({\n * color: '#3399CC',\n * width: 1.25,\n * });\n * const styles = [\n * new Style({\n * image: new Circle({\n * fill: fill,\n * stroke: stroke,\n * radius: 5,\n * }),\n * fill: fill,\n * stroke: stroke,\n * }),\n * ];\n * ```\n *\n * A separate editing style has the following defaults:\n * ```js\n * import {Circle, Fill, Stroke, Style} from 'ol/style.js';\n *\n * const styles = {};\n * const white = [255, 255, 255, 1];\n * const blue = [0, 153, 255, 1];\n * const width = 3;\n * styles['Polygon'] = [\n * new Style({\n * fill: new Fill({\n * color: [255, 255, 255, 0.5],\n * }),\n * }),\n * ];\n * styles['MultiPolygon'] =\n * styles['Polygon'];\n * styles['LineString'] = [\n * new Style({\n * stroke: new Stroke({\n * color: white,\n * width: width + 2,\n * }),\n * }),\n * new Style({\n * stroke: new Stroke({\n * color: blue,\n * width: width,\n * }),\n * }),\n * ];\n * styles['MultiLineString'] = styles['LineString'];\n *\n * styles['Circle'] = styles['Polygon'].concat(\n * styles['LineString']\n * );\n *\n * styles['Point'] = [\n * new Style({\n * image: new Circle({\n * radius: width * 2,\n * fill: new Fill({\n * color: blue,\n * }),\n * stroke: new Stroke({\n * color: white,\n * width: width / 2,\n * }),\n * }),\n * zIndex: Infinity,\n * }),\n * ];\n * styles['MultiPoint'] =\n * styles['Point'];\n * styles['GeometryCollection'] =\n * styles['Polygon'].concat(\n * styles['LineString'],\n * styles['Point']\n * );\n * ```\n *\n * @api\n */\nclass Style {\n /**\n * @param {Options} [options] Style options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @private\n * @type {string|import(\"../geom/Geometry.js\").default|GeometryFunction|null}\n */\n this.geometry_ = null;\n\n /**\n * @private\n * @type {!GeometryFunction}\n */\n this.geometryFunction_ = defaultGeometryFunction;\n\n if (options.geometry !== undefined) {\n this.setGeometry(options.geometry);\n }\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default|null}\n */\n this.fill_ = options.fill !== undefined ? options.fill : null;\n\n /**\n * @private\n * @type {import(\"./Image.js\").default|null}\n */\n this.image_ = options.image !== undefined ? options.image : null;\n\n /**\n * @private\n * @type {RenderFunction|null}\n */\n this.renderer_ = options.renderer !== undefined ? options.renderer : null;\n\n /**\n * @private\n * @type {RenderFunction|null}\n */\n this.hitDetectionRenderer_ =\n options.hitDetectionRenderer !== undefined\n ? options.hitDetectionRenderer\n : null;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default|null}\n */\n this.stroke_ = options.stroke !== undefined ? options.stroke : null;\n\n /**\n * @private\n * @type {import(\"./Text.js\").default|null}\n */\n this.text_ = options.text !== undefined ? options.text : null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.zIndex_ = options.zIndex;\n }\n\n /**\n * Clones the style.\n * @return {Style} The cloned style.\n * @api\n */\n clone() {\n let geometry = this.getGeometry();\n if (geometry && typeof geometry === 'object') {\n geometry = /** @type {import(\"../geom/Geometry.js\").default} */ (\n geometry\n ).clone();\n }\n return new Style({\n geometry: geometry ?? undefined,\n fill: this.getFill() ? this.getFill().clone() : undefined,\n image: this.getImage() ? this.getImage().clone() : undefined,\n renderer: this.getRenderer() ?? undefined,\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n text: this.getText() ? this.getText().clone() : undefined,\n zIndex: this.getZIndex(),\n });\n }\n\n /**\n * Get the custom renderer function that was configured with\n * {@link #setRenderer} or the `renderer` constructor option.\n * @return {RenderFunction|null} Custom renderer function.\n * @api\n */\n getRenderer() {\n return this.renderer_;\n }\n\n /**\n * Sets a custom renderer function for this style. When set, `fill`, `stroke`\n * and `image` options of the style will be ignored.\n * @param {RenderFunction|null} renderer Custom renderer function.\n * @api\n */\n setRenderer(renderer) {\n this.renderer_ = renderer;\n }\n\n /**\n * Sets a custom renderer function for this style used\n * in hit detection.\n * @param {RenderFunction|null} renderer Custom renderer function.\n * @api\n */\n setHitDetectionRenderer(renderer) {\n this.hitDetectionRenderer_ = renderer;\n }\n\n /**\n * Get the custom renderer function that was configured with\n * {@link #setHitDetectionRenderer} or the `hitDetectionRenderer` constructor option.\n * @return {RenderFunction|null} Custom renderer function.\n * @api\n */\n getHitDetectionRenderer() {\n return this.hitDetectionRenderer_;\n }\n\n /**\n * Get the geometry to be rendered.\n * @return {string|import(\"../geom/Geometry.js\").default|GeometryFunction|null}\n * Feature property or geometry or function that returns the geometry that will\n * be rendered with this style.\n * @api\n */\n getGeometry() {\n return this.geometry_;\n }\n\n /**\n * Get the function used to generate a geometry for rendering.\n * @return {!GeometryFunction} Function that is called with a feature\n * and returns the geometry to render instead of the feature's geometry.\n * @api\n */\n getGeometryFunction() {\n return this.geometryFunction_;\n }\n\n /**\n * Get the fill style.\n * @return {import(\"./Fill.js\").default|null} Fill style.\n * @api\n */\n getFill() {\n return this.fill_;\n }\n\n /**\n * Set the fill style.\n * @param {import(\"./Fill.js\").default|null} fill Fill style.\n * @api\n */\n setFill(fill) {\n this.fill_ = fill;\n }\n\n /**\n * Get the image style.\n * @return {import(\"./Image.js\").default|null} Image style.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * Set the image style.\n * @param {import(\"./Image.js\").default} image Image style.\n * @api\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * Get the stroke style.\n * @return {import(\"./Stroke.js\").default|null} Stroke style.\n * @api\n */\n getStroke() {\n return this.stroke_;\n }\n\n /**\n * Set the stroke style.\n * @param {import(\"./Stroke.js\").default|null} stroke Stroke style.\n * @api\n */\n setStroke(stroke) {\n this.stroke_ = stroke;\n }\n\n /**\n * Get the text style.\n * @return {import(\"./Text.js\").default|null} Text style.\n * @api\n */\n getText() {\n return this.text_;\n }\n\n /**\n * Set the text style.\n * @param {import(\"./Text.js\").default} text Text style.\n * @api\n */\n setText(text) {\n this.text_ = text;\n }\n\n /**\n * Get the z-index for the style.\n * @return {number|undefined} ZIndex.\n * @api\n */\n getZIndex() {\n return this.zIndex_;\n }\n\n /**\n * Set a geometry that is rendered instead of the feature's geometry.\n *\n * @param {string|import(\"../geom/Geometry.js\").default|GeometryFunction|null} geometry\n * Feature property or geometry or function returning a geometry to render\n * for this style.\n * @api\n */\n setGeometry(geometry) {\n if (typeof geometry === 'function') {\n this.geometryFunction_ = geometry;\n } else if (typeof geometry === 'string') {\n this.geometryFunction_ = function (feature) {\n return /** @type {import(\"../geom/Geometry.js\").default} */ (\n feature.get(geometry)\n );\n };\n } else if (!geometry) {\n this.geometryFunction_ = defaultGeometryFunction;\n } else if (geometry !== undefined) {\n this.geometryFunction_ = function () {\n return /** @type {import(\"../geom/Geometry.js\").default} */ (geometry);\n };\n }\n this.geometry_ = geometry;\n }\n\n /**\n * Set the z-index.\n *\n * @param {number|undefined} zIndex ZIndex.\n * @api\n */\n setZIndex(zIndex) {\n this.zIndex_ = zIndex;\n }\n}\n\n/**\n * Convert the provided object into a style function. Functions passed through\n * unchanged. Arrays of Style or single style objects wrapped in a\n * new style function.\n * @param {StyleFunction|Array<Style>|Style} obj\n * A style function, a single style, or an array of styles.\n * @return {StyleFunction} A style function.\n */\nexport function toFunction(obj) {\n let styleFunction;\n\n if (typeof obj === 'function') {\n styleFunction = obj;\n } else {\n /**\n * @type {Array<Style>}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(\n typeof (/** @type {?} */ (obj).getZIndex) === 'function',\n 'Expected an `Style` or an array of `Style`',\n );\n const style = /** @type {Style} */ (obj);\n styles = [style];\n }\n styleFunction = function () {\n return styles;\n };\n }\n return styleFunction;\n}\n\n/**\n * @type {Array<Style>|null}\n */\nlet defaultStyles = null;\n\n/**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} resolution Resolution.\n * @return {Array<Style>} Style.\n */\nexport function createDefaultStyle(feature, resolution) {\n // We don't use an immediately-invoked function\n // and a closure so we don't get an error at script evaluation time in\n // browsers that do not support Canvas. (import(\"./Circle.js\").CircleStyle does\n // canvas.getContext('2d') at construction time, which will cause an.error\n // in such browsers.)\n if (!defaultStyles) {\n const fill = new Fill({\n color: 'rgba(255,255,255,0.4)',\n });\n const stroke = new Stroke({\n color: '#3399CC',\n width: 1.25,\n });\n defaultStyles = [\n new Style({\n image: new CircleStyle({\n fill: fill,\n stroke: stroke,\n radius: 5,\n }),\n fill: fill,\n stroke: stroke,\n }),\n ];\n }\n return defaultStyles;\n}\n\n/**\n * Default styles for editing features.\n * @return {Object<import(\"../geom/Geometry.js\").Type, Array<Style>>} Styles\n */\nexport function createEditingStyle() {\n /** @type {Object<import(\"../geom/Geometry.js\").Type, Array<Style>>} */\n const styles = {};\n const white = [255, 255, 255, 1];\n const blue = [0, 153, 255, 1];\n const width = 3;\n styles['Polygon'] = [\n new Style({\n fill: new Fill({\n color: [255, 255, 255, 0.5],\n }),\n }),\n ];\n styles['MultiPolygon'] = styles['Polygon'];\n\n styles['LineString'] = [\n new Style({\n stroke: new Stroke({\n color: white,\n width: width + 2,\n }),\n }),\n new Style({\n stroke: new Stroke({\n color: blue,\n width: width,\n }),\n }),\n ];\n styles['MultiLineString'] = styles['LineString'];\n\n styles['Circle'] = styles['Polygon'].concat(styles['LineString']);\n\n styles['Point'] = [\n new Style({\n image: new CircleStyle({\n radius: width * 2,\n fill: new Fill({\n color: blue,\n }),\n stroke: new Stroke({\n color: white,\n width: width / 2,\n }),\n }),\n zIndex: Infinity,\n }),\n ];\n styles['MultiPoint'] = styles['Point'];\n\n styles['GeometryCollection'] = styles['Polygon'].concat(\n styles['LineString'],\n styles['Point'],\n );\n\n return styles;\n}\n\n/**\n * Function that is called with a feature and returns its default geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature to get the geometry for.\n * @return {import(\"../geom/Geometry.js\").default|import(\"../render/Feature.js\").default|undefined} Geometry to render.\n */\nfunction defaultGeometryFunction(feature) {\n return feature.getGeometry();\n}\n\nexport default Style;\n","/**\n * @module ol/style/Text\n */\nimport {toSize} from '../size.js';\nimport Fill from './Fill.js';\n\n/**\n * @typedef {'point' | 'line'} TextPlacement\n * Default text placement is `'point'`. Note that\n * `'line'` requires the underlying geometry to be a {@link module:ol/geom/LineString~LineString},\n * {@link module:ol/geom/Polygon~Polygon}, {@link module:ol/geom/MultiLineString~MultiLineString} or\n * {@link module:ol/geom/MultiPolygon~MultiPolygon}.\n */\n\n/**\n * @typedef {'left' | 'center' | 'right'} TextJustify\n */\n\n/**\n * The default fill color to use if no fill was set at construction time; a\n * blackish `#333`.\n *\n * @const {string}\n */\nconst DEFAULT_FILL_COLOR = '#333';\n\n/**\n * @typedef {Object} Options\n * @property {string} [font] Font style as CSS `font` value, see:\n * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is `'10px sans-serif'`\n * @property {number} [maxAngle=Math.PI/4] When `placement` is set to `'line'`, allow a maximum angle between adjacent characters.\n * The expected value is in radians, and the default is 45° (`Math.PI / 4`).\n * @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right.\n * @property {number} [offsetY=0] Vertical text offset in pixels. A positive will shift the text down.\n * @property {boolean} [overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed\n * the width of the polygon at the label position or the length of the path that it follows.\n * @property {TextPlacement} [placement='point'] Text placement.\n * @property {number} [repeat] Repeat interval. When set, the text will be repeated at this interval, which specifies\n * the distance between two text anchors in pixels. Only available when `placement` is set to `'line'`. Overrides 'textAlign'.\n * @property {number|import(\"../size.js\").Size} [scale] Scale.\n * @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.\n * @property {boolean} [keepUpright=true] Whether the text can be rotated 180° to prevent being rendered upside down.\n * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {string|Array<string>} [text] Text content or rich text content. For plain text provide a string, which can\n * contain line breaks (`\\n`). For rich text provide an array of text/font tuples. A tuple consists of the text to\n * render and the font to use (or `''` to use the text style's font). A line break has to be a separate tuple (i.e. `'\\n', ''`).\n * **Example:** `['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']` will yield \"**foo** *bar* baz\".\n * **Note:** Rich text is not supported for `placement: 'line'` or the immediate rendering API.\n * @property {CanvasTextAlign} [textAlign] Text alignment. Possible values: `'left'`, `'right'`, `'center'`, `'end'` or `'start'`.\n * Default is `'center'` for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a\n * placement where `maxAngle` is not exceeded.\n * @property {TextJustify} [justify] Text justification within the text box.\n * If not set, text is justified towards the `textAlign` anchor.\n * Otherwise, use options `'left'`, `'center'`, or `'right'` to justify the text within the text box.\n * **Note:** `justify` is ignored for immediate rendering and also for `placement: 'line'`.\n * @property {CanvasTextBaseline} [textBaseline='middle'] Text base line. Possible values: `'bottom'`, `'top'`, `'middle'`, `'alphabetic'`,\n * `'hanging'`, `'ideographic'`.\n * @property {import(\"./Fill.js\").default|null} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333). Specify `null` for no fill.\n * @property {import(\"./Stroke.js\").default} [stroke] Stroke style.\n * @property {import(\"./Fill.js\").default} [backgroundFill] Fill style for the text background when `placement` is\n * `'point'`. Default is no fill.\n * @property {import(\"./Stroke.js\").default} [backgroundStroke] Stroke style for the text background when `placement`\n * is `'point'`. Default is no stroke.\n * @property {Array<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of\n * values in the array is `[top, right, bottom, left]`.\n * @property {import('../style/Style.js').DeclutterMode} [declutterMode] Declutter mode: `declutter`, `obstacle`, `none`\n */\n\n/**\n * @classdesc\n * Set text style for vector features.\n * @api\n */\nclass Text {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.font_ = options.font;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = options.rotation;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.rotateWithView_ = options.rotateWithView;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.keepUpright_ = options.keepUpright;\n\n /**\n * @private\n * @type {number|import(\"../size.js\").Size|undefined}\n */\n this.scale_ = options.scale;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.scaleArray_ = toSize(options.scale !== undefined ? options.scale : 1);\n\n /**\n * @private\n * @type {string|Array<string>|undefined}\n */\n this.text_ = options.text;\n\n /**\n * @private\n * @type {CanvasTextAlign|undefined}\n */\n this.textAlign_ = options.textAlign;\n\n /**\n * @private\n * @type {TextJustify|undefined}\n */\n this.justify_ = options.justify;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.repeat_ = options.repeat;\n\n /**\n * @private\n * @type {CanvasTextBaseline|undefined}\n */\n this.textBaseline_ = options.textBaseline;\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default|null}\n */\n this.fill_ =\n options.fill !== undefined\n ? options.fill\n : new Fill({color: DEFAULT_FILL_COLOR});\n\n /**\n * @private\n * @type {number}\n */\n this.maxAngle_ =\n options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4;\n\n /**\n * @private\n * @type {TextPlacement}\n */\n this.placement_ =\n options.placement !== undefined ? options.placement : 'point';\n\n /**\n * @private\n * @type {boolean}\n */\n this.overflow_ = !!options.overflow;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default|null}\n */\n this.stroke_ = options.stroke !== undefined ? options.stroke : null;\n\n /**\n * @private\n * @type {number}\n */\n this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0;\n\n /**\n * @private\n * @type {number}\n */\n this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0;\n\n /**\n * @private\n * @type {import(\"./Fill.js\").default|null}\n */\n this.backgroundFill_ = options.backgroundFill\n ? options.backgroundFill\n : null;\n\n /**\n * @private\n * @type {import(\"./Stroke.js\").default|null}\n */\n this.backgroundStroke_ = options.backgroundStroke\n ? options.backgroundStroke\n : null;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.padding_ = options.padding === undefined ? null : options.padding;\n\n /**\n * @private\n * @type {import('../style/Style.js').DeclutterMode}\n */\n this.declutterMode_ = options.declutterMode;\n }\n\n /**\n * Clones the style.\n * @return {Text} The cloned style.\n * @api\n */\n clone() {\n const scale = this.getScale();\n return new Text({\n font: this.getFont(),\n placement: this.getPlacement(),\n repeat: this.getRepeat(),\n maxAngle: this.getMaxAngle(),\n overflow: this.getOverflow(),\n rotation: this.getRotation(),\n rotateWithView: this.getRotateWithView(),\n keepUpright: this.getKeepUpright(),\n scale: Array.isArray(scale) ? scale.slice() : scale,\n text: this.getText(),\n textAlign: this.getTextAlign(),\n justify: this.getJustify(),\n textBaseline: this.getTextBaseline(),\n fill: this.getFill() ? this.getFill().clone() : undefined,\n stroke: this.getStroke() ? this.getStroke().clone() : undefined,\n offsetX: this.getOffsetX(),\n offsetY: this.getOffsetY(),\n backgroundFill: this.getBackgroundFill()\n ? this.getBackgroundFill().clone()\n : undefined,\n backgroundStroke: this.getBackgroundStroke()\n ? this.getBackgroundStroke().clone()\n : undefined,\n padding: this.getPadding() || undefined,\n declutterMode: this.getDeclutterMode(),\n });\n }\n\n /**\n * Get the `overflow` configuration.\n * @return {boolean} Let text overflow the length of the path they follow.\n * @api\n */\n getOverflow() {\n return this.overflow_;\n }\n\n /**\n * Get the font name.\n * @return {string|undefined} Font.\n * @api\n */\n getFont() {\n return this.font_;\n }\n\n /**\n * Get the maximum angle between adjacent characters.\n * @return {number} Angle in radians.\n * @api\n */\n getMaxAngle() {\n return this.maxAngle_;\n }\n\n /**\n * Get the label placement.\n * @return {TextPlacement} Text placement.\n * @api\n */\n getPlacement() {\n return this.placement_;\n }\n\n /**\n * Get the repeat interval of the text.\n * @return {number|undefined} Repeat interval in pixels.\n * @api\n */\n getRepeat() {\n return this.repeat_;\n }\n\n /**\n * Get the x-offset for the text.\n * @return {number} Horizontal text offset.\n * @api\n */\n getOffsetX() {\n return this.offsetX_;\n }\n\n /**\n * Get the y-offset for the text.\n * @return {number} Vertical text offset.\n * @api\n */\n getOffsetY() {\n return this.offsetY_;\n }\n\n /**\n * Get the fill style for the text.\n * @return {import(\"./Fill.js\").default|null} Fill style.\n * @api\n */\n getFill() {\n return this.fill_;\n }\n\n /**\n * Determine whether the text rotates with the map.\n * @return {boolean|undefined} Rotate with map.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Determine whether the text can be rendered upside down.\n * @return {boolean|undefined} Keep text upright.\n * @api\n */\n getKeepUpright() {\n return this.keepUpright_;\n }\n\n /**\n * Get the text rotation.\n * @return {number|undefined} Rotation.\n * @api\n */\n getRotation() {\n return this.rotation_;\n }\n\n /**\n * Get the text scale.\n * @return {number|import(\"../size.js\").Size|undefined} Scale.\n * @api\n */\n getScale() {\n return this.scale_;\n }\n\n /**\n * Get the symbolizer scale array.\n * @return {import(\"../size.js\").Size} Scale array.\n */\n getScaleArray() {\n return this.scaleArray_;\n }\n\n /**\n * Get the stroke style for the text.\n * @return {import(\"./Stroke.js\").default|null} Stroke style.\n * @api\n */\n getStroke() {\n return this.stroke_;\n }\n\n /**\n * Get the text to be rendered.\n * @return {string|Array<string>|undefined} Text.\n * @api\n */\n getText() {\n return this.text_;\n }\n\n /**\n * Get the text alignment.\n * @return {CanvasTextAlign|undefined} Text align.\n * @api\n */\n getTextAlign() {\n return this.textAlign_;\n }\n\n /**\n * Get the justification.\n * @return {TextJustify|undefined} Justification.\n * @api\n */\n getJustify() {\n return this.justify_;\n }\n\n /**\n * Get the text baseline.\n * @return {CanvasTextBaseline|undefined} Text baseline.\n * @api\n */\n getTextBaseline() {\n return this.textBaseline_;\n }\n\n /**\n * Get the background fill style for the text.\n * @return {import(\"./Fill.js\").default|null} Fill style.\n * @api\n */\n getBackgroundFill() {\n return this.backgroundFill_;\n }\n\n /**\n * Get the background stroke style for the text.\n * @return {import(\"./Stroke.js\").default|null} Stroke style.\n * @api\n */\n getBackgroundStroke() {\n return this.backgroundStroke_;\n }\n\n /**\n * Get the padding for the text.\n * @return {Array<number>|null} Padding.\n * @api\n */\n getPadding() {\n return this.padding_;\n }\n\n /**\n * Get the declutter mode of the shape\n * @return {import(\"./Style.js\").DeclutterMode} Shape's declutter mode\n * @api\n */\n getDeclutterMode() {\n return this.declutterMode_;\n }\n\n /**\n * Set the `overflow` property.\n *\n * @param {boolean} overflow Let text overflow the path that it follows.\n * @api\n */\n setOverflow(overflow) {\n this.overflow_ = overflow;\n }\n\n /**\n * Set the font.\n *\n * @param {string|undefined} font Font.\n * @api\n */\n setFont(font) {\n this.font_ = font;\n }\n\n /**\n * Set the maximum angle between adjacent characters.\n *\n * @param {number} maxAngle Angle in radians.\n * @api\n */\n setMaxAngle(maxAngle) {\n this.maxAngle_ = maxAngle;\n }\n\n /**\n * Set the x offset.\n *\n * @param {number} offsetX Horizontal text offset.\n * @api\n */\n setOffsetX(offsetX) {\n this.offsetX_ = offsetX;\n }\n\n /**\n * Set the y offset.\n *\n * @param {number} offsetY Vertical text offset.\n * @api\n */\n setOffsetY(offsetY) {\n this.offsetY_ = offsetY;\n }\n\n /**\n * Set the text placement.\n *\n * @param {TextPlacement} placement Placement.\n * @api\n */\n setPlacement(placement) {\n this.placement_ = placement;\n }\n\n /**\n * Set the repeat interval of the text.\n * @param {number|undefined} [repeat] Repeat interval in pixels.\n * @api\n */\n setRepeat(repeat) {\n this.repeat_ = repeat;\n }\n\n /**\n * Set whether to rotate the text with the view.\n *\n * @param {boolean} rotateWithView Rotate with map.\n * @api\n */\n setRotateWithView(rotateWithView) {\n this.rotateWithView_ = rotateWithView;\n }\n\n /**\n * Set whether the text can be rendered upside down.\n *\n * @param {boolean} keepUpright Keep text upright.\n * @api\n */\n setKeepUpright(keepUpright) {\n this.keepUpright_ = keepUpright;\n }\n\n /**\n * Set the fill.\n *\n * @param {import(\"./Fill.js\").default|null} fill Fill style.\n * @api\n */\n setFill(fill) {\n this.fill_ = fill;\n }\n\n /**\n * Set the rotation.\n *\n * @param {number|undefined} rotation Rotation.\n * @api\n */\n setRotation(rotation) {\n this.rotation_ = rotation;\n }\n\n /**\n * Set the scale.\n *\n * @param {number|import(\"../size.js\").Size|undefined} scale Scale.\n * @api\n */\n setScale(scale) {\n this.scale_ = scale;\n this.scaleArray_ = toSize(scale !== undefined ? scale : 1);\n }\n\n /**\n * Set the stroke.\n *\n * @param {import(\"./Stroke.js\").default|null} stroke Stroke style.\n * @api\n */\n setStroke(stroke) {\n this.stroke_ = stroke;\n }\n\n /**\n * Set the text.\n *\n * @param {string|Array<string>|undefined} text Text.\n * @api\n */\n setText(text) {\n this.text_ = text;\n }\n\n /**\n * Set the text alignment.\n *\n * @param {CanvasTextAlign|undefined} textAlign Text align.\n * @api\n */\n setTextAlign(textAlign) {\n this.textAlign_ = textAlign;\n }\n\n /**\n * Set the justification.\n *\n * @param {TextJustify|undefined} justify Justification.\n * @api\n */\n setJustify(justify) {\n this.justify_ = justify;\n }\n\n /**\n * Set the text baseline.\n *\n * @param {CanvasTextBaseline|undefined} textBaseline Text baseline.\n * @api\n */\n setTextBaseline(textBaseline) {\n this.textBaseline_ = textBaseline;\n }\n\n /**\n * Set the background fill.\n *\n * @param {import(\"./Fill.js\").default|null} fill Fill style.\n * @api\n */\n setBackgroundFill(fill) {\n this.backgroundFill_ = fill;\n }\n\n /**\n * Set the background stroke.\n *\n * @param {import(\"./Stroke.js\").default|null} stroke Stroke style.\n * @api\n */\n setBackgroundStroke(stroke) {\n this.backgroundStroke_ = stroke;\n }\n\n /**\n * Set the padding (`[top, right, bottom, left]`).\n *\n * @param {Array<number>|null} padding Padding.\n * @api\n */\n setPadding(padding) {\n this.padding_ = padding;\n }\n}\n\nexport default Text;\n","/**\n * @module ol/render/canvas/style\n */\n\nimport {NO_COLOR} from '../../color.js';\nimport {buildExpression, newEvaluationContext} from '../../expr/cpu.js';\nimport {\n BooleanType,\n ColorType,\n NumberArrayType,\n NumberType,\n StringType,\n computeGeometryType,\n newParsingContext,\n} from '../../expr/expression.js';\nimport {isEmpty} from '../../obj.js';\nimport {toSize} from '../../size.js';\nimport Circle from '../../style/Circle.js';\nimport Fill from '../../style/Fill.js';\nimport Icon from '../../style/Icon.js';\nimport RegularShape from '../../style/RegularShape.js';\nimport Stroke from '../../style/Stroke.js';\nimport Style from '../../style/Style.js';\nimport Text from '../../style/Text.js';\n\n/**\n * @fileoverview This module includes functions to build styles for the canvas renderer. Building\n * is composed of two steps: parsing and compiling. The parsing step takes an encoded expression\n * and returns an instance of one of the expression classes. The compiling step takes the\n * expression instance and returns a function that can be evaluated to return a literal value. The\n * evaluator function should do as little allocation and work as possible.\n */\n\n/**\n * @typedef {import(\"../../style/flat.js\").FlatStyle} FlatStyle\n */\n\n/**\n * @typedef {import(\"../../expr/expression.js\").EncodedExpression} EncodedExpression\n */\n\n/**\n * @typedef {import(\"../../expr/expression.js\").ParsingContext} ParsingContext\n */\n\n/**\n * @typedef {import(\"../../expr/expression.js\").CallExpression} CallExpression\n */\n\n/**\n * @typedef {import(\"../../expr/cpu.js\").EvaluationContext} EvaluationContext\n */\n\n/**\n * @typedef {import(\"../../expr/cpu.js\").ExpressionEvaluator} ExpressionEvaluator\n */\n\n/**\n * @param {EvaluationContext} context The evaluation context.\n * @return {boolean} Always true.\n */\nfunction always(context) {\n return true;\n}\n\n/**\n * This function adapts a rule evaluator to the existing style function interface.\n * After we have deprecated the style function, we can use the compiled rules directly\n * and pass a more complete evaluation context (variables, zoom, time, etc.).\n *\n * @param {Array<import('../../style/flat.js').Rule>} rules The rules.\n * @return {import('../../style/Style.js').StyleFunction} A style function.\n */\nexport function rulesToStyleFunction(rules) {\n const parsingContext = newParsingContext();\n const evaluator = buildRuleSet(rules, parsingContext);\n const evaluationContext = newEvaluationContext();\n return function (feature, resolution) {\n evaluationContext.properties = feature.getPropertiesInternal();\n evaluationContext.resolution = resolution;\n if (parsingContext.featureId) {\n const id = feature.getId();\n if (id !== undefined) {\n evaluationContext.featureId = id;\n } else {\n evaluationContext.featureId = null;\n }\n }\n if (parsingContext.geometryType) {\n evaluationContext.geometryType = computeGeometryType(\n feature.getGeometry(),\n );\n }\n return evaluator(evaluationContext);\n };\n}\n\n/**\n * This function adapts a style evaluator to the existing style function interface.\n * After we have deprecated the style function, we can use the compiled rules directly\n * and pass a more complete evaluation context (variables, zoom, time, etc.).\n *\n * @param {Array<import('../../style/flat.js').FlatStyle>} flatStyles The flat styles.\n * @return {import('../../style/Style.js').StyleFunction} A style function.\n */\nexport function flatStylesToStyleFunction(flatStyles) {\n const parsingContext = newParsingContext();\n const length = flatStyles.length;\n\n /**\n * @type {Array<StyleEvaluator>}\n */\n const evaluators = new Array(length);\n for (let i = 0; i < length; ++i) {\n evaluators[i] = buildStyle(flatStyles[i], parsingContext);\n }\n const evaluationContext = newEvaluationContext();\n\n /**\n * @type {Array<Style>}\n */\n const styles = new Array(length);\n\n return function (feature, resolution) {\n evaluationContext.properties = feature.getPropertiesInternal();\n evaluationContext.resolution = resolution;\n if (parsingContext.featureId) {\n const id = feature.getId();\n if (id !== undefined) {\n evaluationContext.featureId = id;\n } else {\n evaluationContext.featureId = null;\n }\n }\n let nonNullCount = 0;\n for (let i = 0; i < length; ++i) {\n const style = evaluators[i](evaluationContext);\n if (style) {\n styles[nonNullCount] = style;\n nonNullCount += 1;\n }\n }\n styles.length = nonNullCount;\n return styles;\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):Array<Style>} RuleSetEvaluator\n */\n\n/**\n * @typedef {Object} CompiledRule\n * @property {ExpressionEvaluator} filter The compiled filter evaluator.\n * @property {Array<StyleEvaluator>} styles The list of compiled style evaluators.\n */\n\n/**\n * @param {Array<import('../../style/flat.js').Rule>} rules The rules.\n * @param {ParsingContext} context The parsing context.\n * @return {RuleSetEvaluator} The evaluator function.\n */\nexport function buildRuleSet(rules, context) {\n const length = rules.length;\n\n /**\n * @type {Array<CompiledRule>}\n */\n const compiledRules = new Array(length);\n\n for (let i = 0; i < length; ++i) {\n const rule = rules[i];\n const filter =\n 'filter' in rule\n ? buildExpression(rule.filter, BooleanType, context)\n : always;\n\n /**\n * @type {Array<StyleEvaluator>}\n */\n let styles;\n if (Array.isArray(rule.style)) {\n const styleLength = rule.style.length;\n styles = new Array(styleLength);\n for (let j = 0; j < styleLength; ++j) {\n styles[j] = buildStyle(rule.style[j], context);\n }\n } else {\n styles = [buildStyle(rule.style, context)];\n }\n\n compiledRules[i] = {filter, styles};\n }\n\n return function (context) {\n /**\n * @type {Array<Style>}\n */\n const styles = [];\n\n let someMatched = false;\n for (let i = 0; i < length; ++i) {\n const filterEvaluator = compiledRules[i].filter;\n if (!filterEvaluator(context)) {\n continue;\n }\n if (rules[i].else && someMatched) {\n continue;\n }\n someMatched = true;\n for (const styleEvaluator of compiledRules[i].styles) {\n const style = styleEvaluator(context);\n if (!style) {\n continue;\n }\n styles.push(style);\n }\n }\n\n return styles;\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):Style|null} StyleEvaluator\n */\n\n/**\n * @param {FlatStyle} flatStyle A flat style literal.\n * @param {ParsingContext} context The parsing context.\n * @return {StyleEvaluator} A function that evaluates to a style. The style returned by\n * this function will be reused between invocations.\n */\nexport function buildStyle(flatStyle, context) {\n const evaluateFill = buildFill(flatStyle, '', context);\n const evaluateStroke = buildStroke(flatStyle, '', context);\n const evaluateText = buildText(flatStyle, context);\n const evaluateImage = buildImage(flatStyle, context);\n const evaluateZIndex = numberEvaluator(flatStyle, 'z-index', context);\n\n if (\n !evaluateFill &&\n !evaluateStroke &&\n !evaluateText &&\n !evaluateImage &&\n !isEmpty(flatStyle)\n ) {\n // assume this is a user error\n // would be nice to check the properties and suggest \"did you mean...\"\n throw new Error(\n 'No fill, stroke, point, or text symbolizer properties in style: ' +\n JSON.stringify(flatStyle),\n );\n }\n\n const style = new Style();\n return function (context) {\n let empty = true;\n if (evaluateFill) {\n const fill = evaluateFill(context);\n if (fill) {\n empty = false;\n }\n style.setFill(fill);\n }\n if (evaluateStroke) {\n const stroke = evaluateStroke(context);\n if (stroke) {\n empty = false;\n }\n style.setStroke(stroke);\n }\n if (evaluateText) {\n const text = evaluateText(context);\n if (text) {\n empty = false;\n }\n style.setText(text);\n }\n if (evaluateImage) {\n const image = evaluateImage(context);\n if (image) {\n empty = false;\n }\n style.setImage(image);\n }\n if (evaluateZIndex) {\n style.setZIndex(evaluateZIndex(context));\n }\n if (empty) {\n return null;\n }\n return style;\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):Fill|null} FillEvaluator\n */\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} prefix The property prefix.\n * @param {ParsingContext} context The parsing context.\n * @return {FillEvaluator?} A function that evaluates to a fill.\n */\nfunction buildFill(flatStyle, prefix, context) {\n let evaluateColor;\n if (prefix + 'fill-pattern-src' in flatStyle) {\n evaluateColor = patternEvaluator(flatStyle, prefix + 'fill-', context);\n } else {\n if (flatStyle[prefix + 'fill-color'] === 'none') {\n // avoids hit detection\n return (context) => null;\n }\n\n evaluateColor = colorLikeEvaluator(\n flatStyle,\n prefix + 'fill-color',\n context,\n );\n }\n if (!evaluateColor) {\n return null;\n }\n\n const fill = new Fill();\n return function (context) {\n const color = evaluateColor(context);\n if (color === NO_COLOR) {\n return null;\n }\n fill.setColor(color);\n return fill;\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):Stroke|null} StrokeEvaluator\n */\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} prefix The property prefix.\n * @param {ParsingContext} context The parsing context.\n * @return {StrokeEvaluator?} A function the evaluates to a stroke.\n */\nfunction buildStroke(flatStyle, prefix, context) {\n const evaluateWidth = numberEvaluator(\n flatStyle,\n prefix + 'stroke-width',\n context,\n );\n\n const evaluateColor = colorLikeEvaluator(\n flatStyle,\n prefix + 'stroke-color',\n context,\n );\n\n if (!evaluateWidth && !evaluateColor) {\n return null;\n }\n\n const evaluateLineCap = stringEvaluator(\n flatStyle,\n prefix + 'stroke-line-cap',\n context,\n );\n\n const evaluateLineJoin = stringEvaluator(\n flatStyle,\n prefix + 'stroke-line-join',\n context,\n );\n\n const evaluateLineDash = numberArrayEvaluator(\n flatStyle,\n prefix + 'stroke-line-dash',\n context,\n );\n\n const evaluateLineDashOffset = numberEvaluator(\n flatStyle,\n prefix + 'stroke-line-dash-offset',\n context,\n );\n\n const evaluateMiterLimit = numberEvaluator(\n flatStyle,\n prefix + 'stroke-miter-limit',\n context,\n );\n\n const stroke = new Stroke();\n return function (context) {\n if (evaluateColor) {\n const color = evaluateColor(context);\n if (color === NO_COLOR) {\n return null;\n }\n stroke.setColor(color);\n }\n\n if (evaluateWidth) {\n stroke.setWidth(evaluateWidth(context));\n }\n\n if (evaluateLineCap) {\n const lineCap = evaluateLineCap(context);\n if (lineCap !== 'butt' && lineCap !== 'round' && lineCap !== 'square') {\n throw new Error('Expected butt, round, or square line cap');\n }\n stroke.setLineCap(lineCap);\n }\n\n if (evaluateLineJoin) {\n const lineJoin = evaluateLineJoin(context);\n if (\n lineJoin !== 'bevel' &&\n lineJoin !== 'round' &&\n lineJoin !== 'miter'\n ) {\n throw new Error('Expected bevel, round, or miter line join');\n }\n stroke.setLineJoin(lineJoin);\n }\n\n if (evaluateLineDash) {\n stroke.setLineDash(evaluateLineDash(context));\n }\n\n if (evaluateLineDashOffset) {\n stroke.setLineDashOffset(evaluateLineDashOffset(context));\n }\n\n if (evaluateMiterLimit) {\n stroke.setMiterLimit(evaluateMiterLimit(context));\n }\n\n return stroke;\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):Text} TextEvaluator\n */\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {ParsingContext} context The parsing context.\n * @return {TextEvaluator?} A function that evaluates to a text symbolizer.\n */\nfunction buildText(flatStyle, context) {\n const prefix = 'text-';\n\n // Currently, an Array<string> may be used for rich text support. This doesn't\n // work with our expression syntax where arrays of strings are interpreted as\n // call expressions. To support rich text, we could add a 'strings' operator\n // where all the following arguments would be string values.\n const evaluateValue = stringEvaluator(flatStyle, prefix + 'value', context);\n if (!evaluateValue) {\n return null;\n }\n\n const evaluateFill = buildFill(flatStyle, prefix, context);\n\n const evaluateBackgroundFill = buildFill(\n flatStyle,\n prefix + 'background-',\n context,\n );\n\n const evaluateStroke = buildStroke(flatStyle, prefix, context);\n\n const evaluateBackgroundStroke = buildStroke(\n flatStyle,\n prefix + 'background-',\n context,\n );\n\n const evaluateFont = stringEvaluator(flatStyle, prefix + 'font', context);\n\n const evaluateMaxAngle = numberEvaluator(\n flatStyle,\n prefix + 'max-angle',\n context,\n );\n\n const evaluateOffsetX = numberEvaluator(\n flatStyle,\n prefix + 'offset-x',\n context,\n );\n\n const evaluateOffsetY = numberEvaluator(\n flatStyle,\n prefix + 'offset-y',\n context,\n );\n\n const evaluateOverflow = booleanEvaluator(\n flatStyle,\n prefix + 'overflow',\n context,\n );\n\n const evaluatePlacement = stringEvaluator(\n flatStyle,\n prefix + 'placement',\n context,\n );\n\n const evaluateRepeat = numberEvaluator(flatStyle, prefix + 'repeat', context);\n\n const evaluateScale = sizeLikeEvaluator(flatStyle, prefix + 'scale', context);\n\n const evaluateRotateWithView = booleanEvaluator(\n flatStyle,\n prefix + 'rotate-with-view',\n context,\n );\n\n const evaluateRotation = numberEvaluator(\n flatStyle,\n prefix + 'rotation',\n context,\n );\n\n const evaluateAlign = stringEvaluator(flatStyle, prefix + 'align', context);\n\n const evaluateJustify = stringEvaluator(\n flatStyle,\n prefix + 'justify',\n context,\n );\n\n const evaluateBaseline = stringEvaluator(\n flatStyle,\n prefix + 'baseline',\n context,\n );\n\n const evaluateKeepUpright = booleanEvaluator(\n flatStyle,\n prefix + 'keep-upright',\n context,\n );\n\n const evaluatePadding = numberArrayEvaluator(\n flatStyle,\n prefix + 'padding',\n context,\n );\n\n // The following properties are not currently settable\n const declutterMode = optionalDeclutterMode(\n flatStyle,\n prefix + 'declutter-mode',\n );\n\n const text = new Text({declutterMode});\n\n return function (context) {\n text.setText(evaluateValue(context));\n\n if (evaluateFill) {\n text.setFill(evaluateFill(context));\n }\n\n if (evaluateBackgroundFill) {\n text.setBackgroundFill(evaluateBackgroundFill(context));\n }\n\n if (evaluateStroke) {\n text.setStroke(evaluateStroke(context));\n }\n\n if (evaluateBackgroundStroke) {\n text.setBackgroundStroke(evaluateBackgroundStroke(context));\n }\n\n if (evaluateFont) {\n text.setFont(evaluateFont(context));\n }\n\n if (evaluateMaxAngle) {\n text.setMaxAngle(evaluateMaxAngle(context));\n }\n\n if (evaluateOffsetX) {\n text.setOffsetX(evaluateOffsetX(context));\n }\n\n if (evaluateOffsetY) {\n text.setOffsetY(evaluateOffsetY(context));\n }\n\n if (evaluateOverflow) {\n text.setOverflow(evaluateOverflow(context));\n }\n\n if (evaluatePlacement) {\n const placement = evaluatePlacement(context);\n if (placement !== 'point' && placement !== 'line') {\n throw new Error('Expected point or line for text-placement');\n }\n text.setPlacement(placement);\n }\n\n if (evaluateRepeat) {\n text.setRepeat(evaluateRepeat(context));\n }\n\n if (evaluateScale) {\n text.setScale(evaluateScale(context));\n }\n\n if (evaluateRotateWithView) {\n text.setRotateWithView(evaluateRotateWithView(context));\n }\n\n if (evaluateRotation) {\n text.setRotation(evaluateRotation(context));\n }\n\n if (evaluateAlign) {\n const textAlign = evaluateAlign(context);\n if (\n textAlign !== 'left' &&\n textAlign !== 'center' &&\n textAlign !== 'right' &&\n textAlign !== 'end' &&\n textAlign !== 'start'\n ) {\n throw new Error(\n 'Expected left, right, center, start, or end for text-align',\n );\n }\n text.setTextAlign(textAlign);\n }\n\n if (evaluateJustify) {\n const justify = evaluateJustify(context);\n if (justify !== 'left' && justify !== 'right' && justify !== 'center') {\n throw new Error('Expected left, right, or center for text-justify');\n }\n text.setJustify(justify);\n }\n\n if (evaluateBaseline) {\n const textBaseline = evaluateBaseline(context);\n if (\n textBaseline !== 'bottom' &&\n textBaseline !== 'top' &&\n textBaseline !== 'middle' &&\n textBaseline !== 'alphabetic' &&\n textBaseline !== 'hanging'\n ) {\n throw new Error(\n 'Expected bottom, top, middle, alphabetic, or hanging for text-baseline',\n );\n }\n text.setTextBaseline(textBaseline);\n }\n\n if (evaluatePadding) {\n text.setPadding(evaluatePadding(context));\n }\n\n if (evaluateKeepUpright) {\n text.setKeepUpright(evaluateKeepUpright(context));\n }\n\n return text;\n };\n}\n\n/**\n * @typedef {function(EvaluationContext):import(\"../../style/Image.js\").default} ImageEvaluator\n */\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {ParsingContext} context The parsing context.\n * @return {ImageEvaluator?} A function that evaluates to an image symbolizer.\n */\nfunction buildImage(flatStyle, context) {\n if ('icon-src' in flatStyle) {\n return buildIcon(flatStyle, context);\n }\n\n if ('shape-points' in flatStyle) {\n return buildShape(flatStyle, context);\n }\n\n if ('circle-radius' in flatStyle) {\n return buildCircle(flatStyle, context);\n }\n\n return null;\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {ParsingContext} context The parsing context.\n * @return {ImageEvaluator} A function that evaluates to an image symbolizer.\n */\nfunction buildIcon(flatStyle, context) {\n const prefix = 'icon-';\n\n // required property\n const srcName = prefix + 'src';\n const src = requireString(flatStyle[srcName], srcName);\n\n // settable properties\n const evaluateAnchor = coordinateEvaluator(\n flatStyle,\n prefix + 'anchor',\n context,\n );\n\n const evaluateScale = sizeLikeEvaluator(flatStyle, prefix + 'scale', context);\n\n const evaluateOpacity = numberEvaluator(\n flatStyle,\n prefix + 'opacity',\n context,\n );\n\n const evaluateDisplacement = coordinateEvaluator(\n flatStyle,\n prefix + 'displacement',\n context,\n );\n\n const evaluateRotation = numberEvaluator(\n flatStyle,\n prefix + 'rotation',\n context,\n );\n\n const evaluateRotateWithView = booleanEvaluator(\n flatStyle,\n prefix + 'rotate-with-view',\n context,\n );\n\n // the remaining symbolizer properties are not currently settable\n const anchorOrigin = optionalIconOrigin(flatStyle, prefix + 'anchor-origin');\n const anchorXUnits = optionalIconAnchorUnits(\n flatStyle,\n prefix + 'anchor-x-units',\n );\n const anchorYUnits = optionalIconAnchorUnits(\n flatStyle,\n prefix + 'anchor-y-units',\n );\n const color = optionalColorLike(flatStyle, prefix + 'color');\n const crossOrigin = optionalString(flatStyle, prefix + 'cross-origin');\n const offset = optionalNumberArray(flatStyle, prefix + 'offset');\n const offsetOrigin = optionalIconOrigin(flatStyle, prefix + 'offset-origin');\n const width = optionalNumber(flatStyle, prefix + 'width');\n const height = optionalNumber(flatStyle, prefix + 'height');\n const size = optionalSize(flatStyle, prefix + 'size');\n const declutterMode = optionalDeclutterMode(\n flatStyle,\n prefix + 'declutter-mode',\n );\n\n const icon = new Icon({\n src,\n anchorOrigin,\n anchorXUnits,\n anchorYUnits,\n color,\n crossOrigin,\n offset,\n offsetOrigin,\n height,\n width,\n size,\n declutterMode,\n });\n\n return function (context) {\n if (evaluateOpacity) {\n icon.setOpacity(evaluateOpacity(context));\n }\n\n if (evaluateDisplacement) {\n icon.setDisplacement(evaluateDisplacement(context));\n }\n\n if (evaluateRotation) {\n icon.setRotation(evaluateRotation(context));\n }\n\n if (evaluateRotateWithView) {\n icon.setRotateWithView(evaluateRotateWithView(context));\n }\n\n if (evaluateScale) {\n icon.setScale(evaluateScale(context));\n }\n\n if (evaluateAnchor) {\n icon.setAnchor(evaluateAnchor(context));\n }\n return icon;\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {ParsingContext} context The parsing context.\n * @return {ImageEvaluator} A function that evaluates to an icon symbolizer.\n */\nfunction buildShape(flatStyle, context) {\n const prefix = 'shape-';\n\n // required property\n const pointsName = prefix + 'points';\n const radiusName = prefix + 'radius';\n const points = requireNumber(flatStyle[pointsName], pointsName);\n const radius = requireNumber(flatStyle[radiusName], radiusName);\n\n // settable properties\n const evaluateFill = buildFill(flatStyle, prefix, context);\n const evaluateStroke = buildStroke(flatStyle, prefix, context);\n const evaluateScale = sizeLikeEvaluator(flatStyle, prefix + 'scale', context);\n const evaluateDisplacement = coordinateEvaluator(\n flatStyle,\n prefix + 'displacement',\n context,\n );\n const evaluateRotation = numberEvaluator(\n flatStyle,\n prefix + 'rotation',\n context,\n );\n const evaluateRotateWithView = booleanEvaluator(\n flatStyle,\n prefix + 'rotate-with-view',\n context,\n );\n\n // the remaining properties are not currently settable\n const radius2 = optionalNumber(flatStyle, prefix + 'radius2');\n const angle = optionalNumber(flatStyle, prefix + 'angle');\n const declutterMode = optionalDeclutterMode(\n flatStyle,\n prefix + 'declutter-mode',\n );\n\n const shape = new RegularShape({\n points,\n radius,\n radius2,\n angle,\n declutterMode,\n });\n\n return function (context) {\n if (evaluateFill) {\n shape.setFill(evaluateFill(context));\n }\n if (evaluateStroke) {\n shape.setStroke(evaluateStroke(context));\n }\n if (evaluateDisplacement) {\n shape.setDisplacement(evaluateDisplacement(context));\n }\n if (evaluateRotation) {\n shape.setRotation(evaluateRotation(context));\n }\n if (evaluateRotateWithView) {\n shape.setRotateWithView(evaluateRotateWithView(context));\n }\n if (evaluateScale) {\n shape.setScale(evaluateScale(context));\n }\n\n return shape;\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {ParsingContext} context The parsing context.\n * @return {ImageEvaluator} A function that evaluates to a circle symbolizer.\n */\nfunction buildCircle(flatStyle, context) {\n const prefix = 'circle-';\n\n // settable properties\n const evaluateFill = buildFill(flatStyle, prefix, context);\n const evaluateStroke = buildStroke(flatStyle, prefix, context);\n const evaluateRadius = numberEvaluator(flatStyle, prefix + 'radius', context);\n const evaluateScale = sizeLikeEvaluator(flatStyle, prefix + 'scale', context);\n const evaluateDisplacement = coordinateEvaluator(\n flatStyle,\n prefix + 'displacement',\n context,\n );\n const evaluateRotation = numberEvaluator(\n flatStyle,\n prefix + 'rotation',\n context,\n );\n const evaluateRotateWithView = booleanEvaluator(\n flatStyle,\n prefix + 'rotate-with-view',\n context,\n );\n\n // the remaining properties are not currently settable\n const declutterMode = optionalDeclutterMode(\n flatStyle,\n prefix + 'declutter-mode',\n );\n\n const circle = new Circle({\n radius: 5, // this is arbitrary, but required - the evaluated radius is used below\n declutterMode,\n });\n\n return function (context) {\n if (evaluateRadius) {\n circle.setRadius(evaluateRadius(context));\n }\n if (evaluateFill) {\n circle.setFill(evaluateFill(context));\n }\n if (evaluateStroke) {\n circle.setStroke(evaluateStroke(context));\n }\n if (evaluateDisplacement) {\n circle.setDisplacement(evaluateDisplacement(context));\n }\n if (evaluateRotation) {\n circle.setRotation(evaluateRotation(context));\n }\n if (evaluateRotateWithView) {\n circle.setRotateWithView(evaluateRotateWithView(context));\n }\n if (evaluateScale) {\n circle.setScale(evaluateScale(context));\n }\n\n return circle;\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').NumberEvaluator|undefined} The expression evaluator or undefined.\n */\nfunction numberEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return undefined;\n }\n const evaluator = buildExpression(flatStyle[name], NumberType, context);\n return function (context) {\n return requireNumber(evaluator(context), name);\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').StringEvaluator?} The expression evaluator.\n */\nfunction stringEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return null;\n }\n const evaluator = buildExpression(flatStyle[name], StringType, context);\n return function (context) {\n return requireString(evaluator(context), name);\n };\n}\n\nfunction patternEvaluator(flatStyle, prefix, context) {\n const srcEvaluator = stringEvaluator(\n flatStyle,\n prefix + 'pattern-src',\n context,\n );\n const offsetEvaluator = sizeEvaluator(\n flatStyle,\n prefix + 'pattern-offset',\n context,\n );\n const patternSizeEvaluator = sizeEvaluator(\n flatStyle,\n prefix + 'pattern-size',\n context,\n );\n const colorEvaluator = colorLikeEvaluator(\n flatStyle,\n prefix + 'color',\n context,\n );\n return function (context) {\n return {\n src: srcEvaluator(context),\n offset: offsetEvaluator && offsetEvaluator(context),\n size: patternSizeEvaluator && patternSizeEvaluator(context),\n color: colorEvaluator && colorEvaluator(context),\n };\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').BooleanEvaluator?} The expression evaluator.\n */\nfunction booleanEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return null;\n }\n const evaluator = buildExpression(flatStyle[name], BooleanType, context);\n return function (context) {\n const value = evaluator(context);\n if (typeof value !== 'boolean') {\n throw new Error(`Expected a boolean for ${name}`);\n }\n return value;\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').ColorLikeEvaluator?} The expression evaluator.\n */\nfunction colorLikeEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return null;\n }\n const evaluator = buildExpression(flatStyle[name], ColorType, context);\n return function (context) {\n return requireColorLike(evaluator(context), name);\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').NumberArrayEvaluator?} The expression evaluator.\n */\nfunction numberArrayEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return null;\n }\n const evaluator = buildExpression(flatStyle[name], NumberArrayType, context);\n return function (context) {\n return requireNumberArray(evaluator(context), name);\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').CoordinateEvaluator?} The expression evaluator.\n */\nfunction coordinateEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return null;\n }\n const evaluator = buildExpression(flatStyle[name], NumberArrayType, context);\n return function (context) {\n const array = requireNumberArray(evaluator(context), name);\n if (array.length !== 2) {\n throw new Error(`Expected two numbers for ${name}`);\n }\n return array;\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').SizeEvaluator?} The expression evaluator.\n */\nfunction sizeEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return null;\n }\n const evaluator = buildExpression(flatStyle[name], NumberArrayType, context);\n return function (context) {\n return requireSize(evaluator(context), name);\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} name The property name.\n * @param {ParsingContext} context The parsing context.\n * @return {import('../../expr/cpu.js').SizeLikeEvaluator?} The expression evaluator.\n */\nfunction sizeLikeEvaluator(flatStyle, name, context) {\n if (!(name in flatStyle)) {\n return null;\n }\n const evaluator = buildExpression(\n flatStyle[name],\n NumberArrayType | NumberType,\n context,\n );\n return function (context) {\n return requireSizeLike(evaluator(context), name);\n };\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {number|undefined} A number or undefined.\n */\nfunction optionalNumber(flatStyle, property) {\n const value = flatStyle[property];\n if (value === undefined) {\n return undefined;\n }\n if (typeof value !== 'number') {\n throw new Error(`Expected a number for ${property}`);\n }\n return value;\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {import(\"../../size.js\").Size|undefined} A size or undefined.\n */\nfunction optionalSize(flatStyle, property) {\n const encoded = flatStyle[property];\n if (encoded === undefined) {\n return undefined;\n }\n if (typeof encoded === 'number') {\n return toSize(encoded);\n }\n if (!Array.isArray(encoded)) {\n throw new Error(`Expected a number or size array for ${property}`);\n }\n if (\n encoded.length !== 2 ||\n typeof encoded[0] !== 'number' ||\n typeof encoded[1] !== 'number'\n ) {\n throw new Error(`Expected a number or size array for ${property}`);\n }\n return encoded;\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {string|undefined} A string or undefined.\n */\nfunction optionalString(flatStyle, property) {\n const encoded = flatStyle[property];\n if (encoded === undefined) {\n return undefined;\n }\n if (typeof encoded !== 'string') {\n throw new Error(`Expected a string for ${property}`);\n }\n return encoded;\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {import(\"../../style/Icon.js\").IconOrigin|undefined} An icon origin or undefined.\n */\nfunction optionalIconOrigin(flatStyle, property) {\n const encoded = flatStyle[property];\n if (encoded === undefined) {\n return undefined;\n }\n if (\n encoded !== 'bottom-left' &&\n encoded !== 'bottom-right' &&\n encoded !== 'top-left' &&\n encoded !== 'top-right'\n ) {\n throw new Error(\n `Expected bottom-left, bottom-right, top-left, or top-right for ${property}`,\n );\n }\n return encoded;\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {import(\"../../style/Icon.js\").IconAnchorUnits|undefined} Icon anchor units or undefined.\n */\nfunction optionalIconAnchorUnits(flatStyle, property) {\n const encoded = flatStyle[property];\n if (encoded === undefined) {\n return undefined;\n }\n if (encoded !== 'pixels' && encoded !== 'fraction') {\n throw new Error(`Expected pixels or fraction for ${property}`);\n }\n return encoded;\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {Array<number>|undefined} An array of numbers or undefined.\n */\nfunction optionalNumberArray(flatStyle, property) {\n const encoded = flatStyle[property];\n if (encoded === undefined) {\n return undefined;\n }\n return requireNumberArray(encoded, property);\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {import('../../style/Style.js').DeclutterMode} Icon declutter mode.\n */\nfunction optionalDeclutterMode(flatStyle, property) {\n const encoded = flatStyle[property];\n if (encoded === undefined) {\n return undefined;\n }\n if (typeof encoded !== 'string') {\n throw new Error(`Expected a string for ${property}`);\n }\n if (encoded !== 'declutter' && encoded !== 'obstacle' && encoded !== 'none') {\n throw new Error(`Expected declutter, obstacle, or none for ${property}`);\n }\n return encoded;\n}\n\n/**\n * @param {FlatStyle} flatStyle The flat style.\n * @param {string} property The symbolizer property.\n * @return {string|Array<number>|undefined} A string or an array of color values or undefined.\n */\nfunction optionalColorLike(flatStyle, property) {\n const encoded = flatStyle[property];\n if (encoded === undefined) {\n return undefined;\n }\n return requireColorLike(encoded, property);\n}\n\n/**\n * @param {any} value The value.\n * @param {string} property The property.\n * @return {Array<number>} An array of numbers.\n */\nfunction requireNumberArray(value, property) {\n if (!Array.isArray(value)) {\n throw new Error(`Expected an array for ${property}`);\n }\n const length = value.length;\n for (let i = 0; i < length; ++i) {\n if (typeof value[i] !== 'number') {\n throw new Error(`Expected an array of numbers for ${property}`);\n }\n }\n return value;\n}\n\n/**\n * @param {any} value The value.\n * @param {string} property The property.\n * @return {string} A string.\n */\nfunction requireString(value, property) {\n if (typeof value !== 'string') {\n throw new Error(`Expected a string for ${property}`);\n }\n return value;\n}\n\n/**\n * @param {any} value The value.\n * @param {string} property The property.\n * @return {number} A number.\n */\nfunction requireNumber(value, property) {\n if (typeof value !== 'number') {\n throw new Error(`Expected a number for ${property}`);\n }\n return value;\n}\n\n/**\n * @param {any} value The value.\n * @param {string} property The property.\n * @return {Array<number>|string} A color.\n */\nfunction requireColorLike(value, property) {\n if (typeof value === 'string') {\n return value;\n }\n const array = requireNumberArray(value, property);\n const length = array.length;\n if (length < 3 || length > 4) {\n throw new Error(`Expected a color with 3 or 4 values for ${property}`);\n }\n return array;\n}\n\n/**\n * @param {any} value The value.\n * @param {string} property The property.\n * @return {Array<number>} A number or an array of two numbers.\n */\nfunction requireSize(value, property) {\n const size = requireNumberArray(value, property);\n if (size.length !== 2) {\n throw new Error(`Expected an array of two numbers for ${property}`);\n }\n return size;\n}\n\n/**\n * @param {any} value The value.\n * @param {string} property The property.\n * @return {number|Array<number>} A number or an array of two numbers.\n */\nfunction requireSizeLike(value, property) {\n if (typeof value === 'number') {\n return value;\n }\n return requireSize(value, property);\n}\n","/**\n * @module ol/layer/BaseVector\n */\nimport RBush from 'rbush';\nimport {\n flatStylesToStyleFunction,\n rulesToStyleFunction,\n} from '../render/canvas/style.js';\nimport Style, {\n createDefaultStyle,\n toFunction as toStyleFunction,\n} from '../style/Style.js';\nimport Layer from './Layer.js';\n\n/***\n * @template T\n * @typedef {T extends import(\"../source/Vector.js\").default<infer U extends import(\"../Feature.js\").FeatureLike> ? U : never} ExtractedFeatureType\n */\n\n/**\n * @template {import('../Feature').FeatureLike} FeatureType\n * @template {import(\"../source/Vector.js\").default<FeatureType>|import(\"../source/VectorTile.js\").default<FeatureType>} VectorSourceType<FeatureType>\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the\n * renderer when getting features from the vector source for the rendering or hit-detection.\n * Recommended value: the size of the largest symbol, line width or label.\n * @property {VectorSourceType} [source] Source.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * @property {boolean|string|number} [declutter=false] Declutter images and text. Any truthy value will enable\n * decluttering. Within a layer, a feature rendered before another has higher priority. All layers with the\n * same `declutter` value will be decluttered together. The priority is determined by the drawing order of the\n * layers with the same `declutter` value. Higher in the layer stack means higher priority. To declutter distinct\n * layers or groups of layers separately, use different truthy values for `declutter`.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will\n * be recreated during animations. This means that no vectors will be shown clipped, but the\n * setting will have a performance impact for large amounts of vector data. When set to `false`,\n * batches will be recreated when no animation is active.\n * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will\n * be recreated during interactions. See also `updateWhileAnimating`.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n RENDER_ORDER: 'renderOrder',\n};\n\n/**\n * @classdesc\n * Vector data that is rendered client-side.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import('../Feature').FeatureLike} FeatureType\n * @template {import(\"../source/Vector.js\").default<FeatureType>|import(\"../source/VectorTile.js\").default<FeatureType>} VectorSourceType<FeatureType>\n * @extends {Layer<VectorSourceType, RendererType>}\n * @template {import(\"../renderer/canvas/VectorLayer.js\").default|import(\"../renderer/canvas/VectorTileLayer.js\").default|import(\"../renderer/canvas/VectorImageLayer.js\").default|import(\"../renderer/webgl/VectorLayer.js\").default|import(\"../renderer/webgl/PointsLayer.js\").default} RendererType\n * @api\n */\nclass BaseVectorLayer extends Layer {\n /**\n * @param {Options<FeatureType, VectorSourceType>} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign({}, options);\n\n delete baseOptions.style;\n delete baseOptions.renderBuffer;\n delete baseOptions.updateWhileAnimating;\n delete baseOptions.updateWhileInteracting;\n super(baseOptions);\n\n /**\n * @private\n * @type {string}\n */\n this.declutter_ = options.declutter ? String(options.declutter) : undefined;\n\n /**\n * @type {number}\n * @private\n */\n this.renderBuffer_ =\n options.renderBuffer !== undefined ? options.renderBuffer : 100;\n\n /**\n * User provided style.\n * @type {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike}\n * @private\n */\n this.style_ = null;\n\n /**\n * Style function for use within the library.\n * @type {import(\"../style/Style.js\").StyleFunction|undefined}\n * @private\n */\n this.styleFunction_ = undefined;\n\n this.setStyle(options.style);\n\n /**\n * @type {boolean}\n * @private\n */\n this.updateWhileAnimating_ =\n options.updateWhileAnimating !== undefined\n ? options.updateWhileAnimating\n : false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.updateWhileInteracting_ =\n options.updateWhileInteracting !== undefined\n ? options.updateWhileInteracting\n : false;\n }\n\n /**\n * @return {string} Declutter group.\n * @override\n */\n getDeclutter() {\n return this.declutter_;\n }\n\n /**\n * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise\n * that resolves with an array of features. The array will either contain the topmost feature\n * when a hit was detected, or it will be empty.\n *\n * The hit detection algorithm used for this method is optimized for performance, but is less\n * accurate than the one used in [map.getFeaturesAtPixel()]{@link import(\"../Map.js\").default#getFeaturesAtPixel}.\n * Text is not considered, and icons are only represented by their bounding box instead of the exact\n * image.\n *\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../Feature\").FeatureLike>>} Promise that resolves with an array of features.\n * @api\n * @override\n */\n getFeatures(pixel) {\n return super.getFeatures(pixel);\n }\n\n /**\n * @return {number|undefined} Render buffer.\n */\n getRenderBuffer() {\n return this.renderBuffer_;\n }\n\n /**\n * @return {import(\"../render.js\").OrderFunction|null|undefined} Render order.\n */\n getRenderOrder() {\n return /** @type {import(\"../render.js\").OrderFunction|null|undefined} */ (\n this.get(Property.RENDER_ORDER)\n );\n }\n\n /**\n * Get the style for features. This returns whatever was passed to the `style`\n * option at construction or to the `setStyle` method.\n * @return {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null|undefined} Layer style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the style function.\n * @return {import(\"../style/Style.js\").StyleFunction|undefined} Layer style function.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @return {boolean} Whether the rendered layer should be updated while\n * animating.\n */\n getUpdateWhileAnimating() {\n return this.updateWhileAnimating_;\n }\n\n /**\n * @return {boolean} Whether the rendered layer should be updated while\n * interacting.\n */\n getUpdateWhileInteracting() {\n return this.updateWhileInteracting_;\n }\n\n /**\n * Render declutter items for this layer\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../layer/Layer.js\").State} layerState Layer state.\n * @override\n */\n renderDeclutter(frameState, layerState) {\n const declutterGroup = this.getDeclutter();\n if (declutterGroup in frameState.declutter === false) {\n frameState.declutter[declutterGroup] = new RBush(9);\n }\n this.getRenderer().renderDeclutter(frameState, layerState);\n }\n\n /**\n * @param {import(\"../render.js\").OrderFunction|null|undefined} renderOrder\n * Render order.\n */\n setRenderOrder(renderOrder) {\n this.set(Property.RENDER_ORDER, renderOrder);\n }\n\n /**\n * Set the style for features. This can be a single style object, an array\n * of styles, or a function that takes a feature and resolution and returns\n * an array of styles. If set to `null`, the layer has no style (a `null` style),\n * so only features that have their own styles will be rendered in the layer. Call\n * `setStyle()` without arguments to reset to the default style. See\n * [the ol/style/Style module]{@link module:ol/style/Style~Style} for information on the default style.\n *\n * If your layer has a static style, you can use [flat style]{@link module:ol/style/flat~FlatStyle} object\n * literals instead of using the `Style` and symbolizer constructors (`Fill`, `Stroke`, etc.):\n * ```js\n * vectorLayer.setStyle({\n * \"fill-color\": \"yellow\",\n * \"stroke-color\": \"black\",\n * \"stroke-width\": 4\n * })\n * ```\n *\n * @param {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style.\n * @api\n */\n setStyle(style) {\n this.style_ = style === undefined ? createDefaultStyle : style;\n const styleLike = toStyleLike(style);\n this.styleFunction_ =\n style === null ? undefined : toStyleFunction(styleLike);\n this.changed();\n }\n\n /**\n * @param {boolean|string|number} declutter Declutter images and text.\n * @api\n */\n setDeclutter(declutter) {\n this.declutter_ = declutter ? String(declutter) : undefined;\n this.changed();\n }\n}\n\n/**\n * Coerce the allowed style types into a shorter list of types. Flat styles, arrays of flat\n * styles, and arrays of rules are converted into style functions.\n *\n * @param {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style.\n * @return {import(\"../style/Style.js\").StyleLike|null} The style.\n */\nfunction toStyleLike(style) {\n if (style === undefined) {\n return createDefaultStyle;\n }\n if (!style) {\n return null;\n }\n if (typeof style === 'function') {\n return style;\n }\n if (style instanceof Style) {\n return style;\n }\n if (!Array.isArray(style)) {\n return flatStylesToStyleFunction([style]);\n }\n if (style.length === 0) {\n return [];\n }\n\n const length = style.length;\n const first = style[0];\n\n if (first instanceof Style) {\n /**\n * @type {Array<Style>}\n */\n const styles = new Array(length);\n for (let i = 0; i < length; ++i) {\n const candidate = style[i];\n if (!(candidate instanceof Style)) {\n throw new Error('Expected a list of style instances');\n }\n styles[i] = candidate;\n }\n return styles;\n }\n\n if ('style' in first) {\n /**\n * @type {Array<import(\"../style/flat.js\").Rule>}\n */\n const rules = new Array(length);\n for (let i = 0; i < length; ++i) {\n const candidate = style[i];\n if (!('style' in candidate)) {\n throw new Error('Expected a list of rules with a style property');\n }\n rules[i] = candidate;\n }\n return rulesToStyleFunction(rules);\n }\n\n const flatStyles =\n /** @type {Array<import(\"../style/flat.js\").FlatStyle>} */ (style);\n return flatStylesToStyleFunction(flatStyles);\n}\n\nexport default BaseVectorLayer;\n","/**\n * @module ol/render/Event\n */\n\nimport Event from '../events/Event.js';\n\nclass RenderEvent extends Event {\n /**\n * @param {import(\"./EventType.js\").default} type Type.\n * @param {import(\"../transform.js\").Transform} [inversePixelTransform] Transform for\n * CSS pixels to rendered pixels.\n * @param {import(\"../Map.js\").FrameState} [frameState] Frame state.\n * @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [context] Context.\n */\n constructor(type, inversePixelTransform, frameState, context) {\n super(type);\n\n /**\n * Transform from CSS pixels (relative to the top-left corner of the map viewport)\n * to rendered pixels on this event's `context`. Only available when a Canvas renderer is used, null otherwise.\n * @type {import(\"../transform.js\").Transform|undefined}\n * @api\n */\n this.inversePixelTransform = inversePixelTransform;\n\n /**\n * An object representing the current render frame state.\n * @type {import(\"../Map.js\").FrameState|undefined}\n * @api\n */\n this.frameState = frameState;\n\n /**\n * Canvas context. Not available when the event is dispatched by the map. For Canvas 2D layers,\n * the context will be the 2D rendering context. For WebGL layers, the context will be the WebGL\n * context.\n * @type {CanvasRenderingContext2D|WebGLRenderingContext|undefined}\n * @api\n */\n this.context = context;\n }\n}\n\nexport default RenderEvent;\n","/**\n * @module ol/renderer/Map\n */\nimport Disposable from '../Disposable.js';\nimport {wrapX} from '../coordinate.js';\nimport {getWidth} from '../extent.js';\nimport {TRUE} from '../functions.js';\nimport {inView} from '../layer/Layer.js';\nimport {shared as iconImageCache} from '../style/IconImageCache.js';\nimport {compose as composeTransform, makeInverse} from '../transform.js';\nimport {abstract} from '../util.js';\n\n/**\n * @template T\n * @typedef HitMatch\n * @property {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @property {import(\"../layer/Layer.js\").default} layer Layer.\n * @property {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @property {number} distanceSq Squared distance.\n * @property {import(\"./vector.js\").FeatureCallback<T>} callback Callback.\n */\n\n/**\n * @abstract\n */\nclass MapRenderer extends Disposable {\n /**\n * @param {import(\"../Map.js\").default} map Map.\n */\n constructor(map) {\n super();\n\n /**\n * @private\n * @type {import(\"../Map.js\").default}\n */\n this.map_ = map;\n }\n\n /**\n * @abstract\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n dispatchRenderEvent(type, frameState) {\n abstract();\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @protected\n */\n calculateMatrices2D(frameState) {\n const viewState = frameState.viewState;\n const coordinateToPixelTransform = frameState.coordinateToPixelTransform;\n const pixelToCoordinateTransform = frameState.pixelToCoordinateTransform;\n\n composeTransform(\n coordinateToPixelTransform,\n frameState.size[0] / 2,\n frameState.size[1] / 2,\n 1 / viewState.resolution,\n -1 / viewState.resolution,\n -viewState.rotation,\n -viewState.center[0],\n -viewState.center[1],\n );\n\n makeInverse(pixelToCoordinateTransform, coordinateToPixelTransform);\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {import(\"./vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {S} thisArg Value to use as `this` when executing `callback`.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`.\n * @return {T|undefined} Callback result.\n * @template S,T,U\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n callback,\n thisArg,\n layerFilter,\n thisArg2,\n ) {\n let result;\n const viewState = frameState.viewState;\n\n /**\n * @param {boolean} managed Managed layer.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @return {T|undefined} Callback result.\n */\n function forEachFeatureAtCoordinate(managed, feature, layer, geometry) {\n return callback.call(thisArg, feature, managed ? layer : null, geometry);\n }\n\n const projection = viewState.projection;\n\n const translatedCoordinate = wrapX(coordinate.slice(), projection);\n const offsets = [[0, 0]];\n if (projection.canWrapX() && checkWrapped) {\n const projectionExtent = projection.getExtent();\n const worldWidth = getWidth(projectionExtent);\n offsets.push([-worldWidth, 0], [worldWidth, 0]);\n }\n\n const layerStates = frameState.layerStatesArray;\n const numLayers = layerStates.length;\n\n const matches = /** @type {Array<HitMatch<T>>} */ ([]);\n const tmpCoord = [];\n for (let i = 0; i < offsets.length; i++) {\n for (let j = numLayers - 1; j >= 0; --j) {\n const layerState = layerStates[j];\n const layer = layerState.layer;\n if (\n layer.hasRenderer() &&\n inView(layerState, viewState) &&\n layerFilter.call(thisArg2, layer)\n ) {\n const layerRenderer = layer.getRenderer();\n const source = layer.getSource();\n if (layerRenderer && source) {\n const coordinates = source.getWrapX()\n ? translatedCoordinate\n : coordinate;\n const callback = forEachFeatureAtCoordinate.bind(\n null,\n layerState.managed,\n );\n tmpCoord[0] = coordinates[0] + offsets[i][0];\n tmpCoord[1] = coordinates[1] + offsets[i][1];\n result = layerRenderer.forEachFeatureAtCoordinate(\n tmpCoord,\n frameState,\n hitTolerance,\n callback,\n matches,\n );\n }\n if (result) {\n return result;\n }\n }\n }\n }\n if (matches.length === 0) {\n return undefined;\n }\n const order = 1 / matches.length;\n matches.forEach((m, i) => (m.distanceSq += i * order));\n matches.sort((a, b) => a.distanceSq - b.distanceSq);\n matches.some((m) => {\n return (result = m.callback(m.feature, m.layer, m.geometry));\n });\n return result;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg Value to use as `this` when executing `layerFilter`.\n * @return {boolean} Is there a feature at the given coordinate?\n * @template U\n */\n hasFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n layerFilter,\n thisArg,\n ) {\n const hasFeature = this.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n TRUE,\n this,\n layerFilter,\n thisArg,\n );\n\n return hasFeature !== undefined;\n }\n\n /**\n * @return {import(\"../Map.js\").default} Map.\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Render.\n * @abstract\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n renderFrame(frameState) {\n abstract();\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n scheduleExpireIconCache(frameState) {\n if (iconImageCache.canExpireCache()) {\n frameState.postRenderFunctions.push(expireIconCache);\n }\n }\n}\n\n/**\n * @param {import(\"../Map.js\").default} map Map.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\nfunction expireIconCache(map, frameState) {\n iconImageCache.expire();\n}\n\nexport default MapRenderer;\n","/**\n * @module ol/renderer/Composite\n */\nimport ObjectEventType from '../ObjectEventType.js';\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {replaceChildren} from '../dom.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport BaseVectorLayer from '../layer/BaseVector.js';\nimport {inView} from '../layer/Layer.js';\nimport RenderEvent from '../render/Event.js';\nimport RenderEventType from '../render/EventType.js';\nimport {checkedFonts} from '../render/canvas.js';\nimport MapRenderer from './Map.js';\n\n/**\n * @classdesc\n * Canvas map renderer.\n * @api\n */\nclass CompositeMapRenderer extends MapRenderer {\n /**\n * @param {import(\"../Map.js\").default} map Map.\n */\n constructor(map) {\n super(map);\n\n /**\n * @private\n * @type {import(\"../events.js\").EventsKey}\n */\n this.fontChangeListenerKey_ = listen(\n checkedFonts,\n ObjectEventType.PROPERTYCHANGE,\n map.redrawText,\n map,\n );\n\n /**\n * @private\n * @type {HTMLDivElement}\n */\n this.element_ = document.createElement('div');\n const style = this.element_.style;\n style.position = 'absolute';\n style.width = '100%';\n style.height = '100%';\n style.zIndex = '0';\n\n this.element_.className = CLASS_UNSELECTABLE + ' ol-layers';\n\n const container = map.getViewport();\n container.insertBefore(this.element_, container.firstChild || null);\n\n /**\n * @private\n * @type {Array<HTMLElement>}\n */\n this.children_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @override\n */\n dispatchRenderEvent(type, frameState) {\n const map = this.getMap();\n if (map.hasListener(type)) {\n const event = new RenderEvent(type, undefined, frameState);\n map.dispatchEvent(event);\n }\n }\n\n /**\n * @override\n */\n disposeInternal() {\n unlistenByKey(this.fontChangeListenerKey_);\n this.element_.remove();\n super.disposeInternal();\n }\n\n /**\n * Render.\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n * @override\n */\n renderFrame(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element_.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n this.calculateMatrices2D(frameState);\n this.dispatchRenderEvent(RenderEventType.PRECOMPOSE, frameState);\n\n const layerStatesArray = frameState.layerStatesArray.sort(\n (a, b) => a.zIndex - b.zIndex,\n );\n const declutter = layerStatesArray.some(\n (layerState) =>\n layerState.layer instanceof BaseVectorLayer &&\n layerState.layer.getDeclutter(),\n );\n if (declutter) {\n // Some layers need decluttering, turn on deferred rendering hint\n frameState.declutter = {};\n }\n const viewState = frameState.viewState;\n\n this.children_.length = 0;\n\n const renderedLayerStates = [];\n let previousElement = null;\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const layerState = layerStatesArray[i];\n frameState.layerIndex = i;\n\n const layer = layerState.layer;\n const sourceState = layer.getSourceState();\n if (\n !inView(layerState, viewState) ||\n (sourceState != 'ready' && sourceState != 'undefined')\n ) {\n layer.unrender();\n continue;\n }\n\n const element = layer.render(frameState, previousElement);\n if (!element) {\n continue;\n }\n if (element !== previousElement) {\n this.children_.push(element);\n previousElement = element;\n }\n\n renderedLayerStates.push(layerState);\n }\n\n this.declutter(frameState, renderedLayerStates);\n\n replaceChildren(this.element_, this.children_);\n\n this.dispatchRenderEvent(RenderEventType.POSTCOMPOSE, frameState);\n\n if (!this.renderedVisible_) {\n this.element_.style.display = '';\n this.renderedVisible_ = true;\n }\n\n this.scheduleExpireIconCache(frameState);\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {Array<import('../layer/Layer.js').State>} layerStates Layers.\n */\n declutter(frameState, layerStates) {\n if (!frameState.declutter) {\n return;\n }\n for (let i = layerStates.length - 1; i >= 0; --i) {\n const layerState = layerStates[i];\n const layer = layerState.layer;\n if (layer.getDeclutter()) {\n layer.renderDeclutter(frameState, layerState);\n }\n }\n layerStates.forEach((layerState) =>\n layerState.layer.renderDeferred(frameState),\n );\n }\n}\n\nexport default CompositeMapRenderer;\n","/**\n * @module ol/Map\n */\nimport Collection from './Collection.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventHandler from './MapBrowserEventHandler.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport MapEvent from './MapEvent.js';\nimport MapEventType from './MapEventType.js';\nimport MapProperty from './MapProperty.js';\nimport BaseObject from './Object.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport TileQueue, {getTilePriority} from './TileQueue.js';\nimport View from './View.js';\nimport ViewHint from './ViewHint.js';\nimport {equals} from './array.js';\nimport {assert} from './asserts.js';\nimport {warn} from './console.js';\nimport {defaults as defaultControls} from './control/defaults.js';\nimport EventType from './events/EventType.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {\n clone,\n createOrUpdateEmpty,\n equals as equalsExtent,\n getForViewAndSize,\n isEmpty,\n} from './extent.js';\nimport {TRUE} from './functions.js';\nimport {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';\nimport {defaults as defaultInteractions} from './interaction/defaults.js';\nimport LayerGroup, {GroupEvent} from './layer/Group.js';\nimport Layer from './layer/Layer.js';\nimport PointerEventType from './pointer/EventType.js';\nimport {fromUserCoordinate, toUserCoordinate} from './proj.js';\nimport RenderEventType from './render/EventType.js';\nimport CompositeMapRenderer from './renderer/Composite.js';\nimport {hasArea} from './size.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n} from './transform.js';\nimport {getUid} from './util.js';\n\n/**\n * State of the current frame. Only `pixelRatio`, `time` and `viewState` should\n * be used in applications.\n * @typedef {Object} FrameState\n * @property {number} pixelRatio The pixel ratio of the frame.\n * @property {number} time The time when rendering of the frame was requested.\n * @property {import(\"./View.js\").State} viewState The state of the current view.\n * @property {boolean} animate Animate.\n * @property {import(\"./transform.js\").Transform} coordinateToPixelTransform CoordinateToPixelTransform.\n * @property {Object<string, import(\"rbush\").default<import('./render/canvas/Executor.js').DeclutterEntry>>|null} declutter\n * Declutter trees by declutter group.\n * When null, no decluttering is needed because no layers have decluttering enabled.\n * @property {null|import(\"./extent.js\").Extent} extent Extent (in view projection coordinates).\n * @property {import(\"./extent.js\").Extent} [nextExtent] Next extent during an animation series.\n * @property {number} index Index.\n * @property {Array<import(\"./layer/Layer.js\").State>} layerStatesArray LayerStatesArray.\n * @property {number} layerIndex LayerIndex.\n * @property {import(\"./transform.js\").Transform} pixelToCoordinateTransform PixelToCoordinateTransform.\n * @property {Array<PostRenderFunction>} postRenderFunctions PostRenderFunctions.\n * @property {import(\"./size.js\").Size} size Size.\n * @property {TileQueue} tileQueue TileQueue.\n * @property {!Object<string, Object<string, boolean>>} usedTiles UsedTiles.\n * @property {Array<number>} viewHints ViewHints.\n * @property {!Object<string, Object<string, boolean>>} wantedTiles WantedTiles.\n * @property {string} mapId The id of the map.\n * @property {Object<string, boolean>} renderTargets Identifiers of previously rendered elements.\n */\n\n/**\n * @typedef {function(Map, FrameState): any} PostRenderFunction\n */\n\n/**\n * @typedef {Object} AtPixelOptions\n * @property {undefined|function(import(\"./layer/Layer.js\").default<import(\"./source/Source\").default>): boolean} [layerFilter] Layer filter\n * function. The filter function will receive one argument, the\n * {@link module:ol/layer/Layer~Layer layer-candidate} and it should return a boolean value.\n * Only layers which are visible and for which this function returns `true`\n * will be tested for features. By default, all visible layers will be tested.\n * @property {number} [hitTolerance=0] Hit-detection tolerance in css pixels. Pixels\n * inside the radius around the given position will be checked for features.\n * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for wrapped geometries inside the range of\n * +/- 1 world width. Works only if a projection is used that can be wrapped.\n */\n\n/**\n * @typedef {Object} MapOptionsInternal\n * @property {Collection<import(\"./control/Control.js\").default>} [controls] Controls.\n * @property {Collection<import(\"./interaction/Interaction.js\").default>} [interactions] Interactions.\n * @property {HTMLElement|Document} keyboardEventTarget KeyboardEventTarget.\n * @property {Collection<import(\"./Overlay.js\").default>} overlays Overlays.\n * @property {Object<string, *>} values Values.\n */\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:layergroup'|'change:size'|'change:target'|'change:view'} MapObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<MapObjectEventTypes, import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").OnSignature<import(\"./MapBrowserEventType\").Types, import(\"./MapBrowserEvent\").default, Return> &\n * import(\"./Observable\").OnSignature<import(\"./MapEventType\").Types, import(\"./MapEvent\").default, Return> &\n * import(\"./Observable\").OnSignature<import(\"./render/EventType\").MapRenderEventTypes, import(\"./render/Event\").default, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|MapObjectEventTypes|\n * import(\"./MapBrowserEventType\").Types|import(\"./MapEventType\").Types|\n * import(\"./render/EventType\").MapRenderEventTypes, Return>} MapEventHandler\n */\n\n/**\n * Object literal with config options for the map.\n * @typedef {Object} MapOptions\n * @property {Collection<import(\"./control/Control.js\").default>|Array<import(\"./control/Control.js\").default>} [controls]\n * Controls initially added to the map. If not specified,\n * {@link module:ol/control/defaults.defaults} is used.\n * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between\n * physical pixels and device-independent pixels (dips) on the device.\n * @property {Collection<import(\"./interaction/Interaction.js\").default>|Array<import(\"./interaction/Interaction.js\").default>} [interactions]\n * Interactions that are initially added to the map. If not specified,\n * {@link module:ol/interaction/defaults.defaults} is used.\n * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to\n * listen to keyboard events on. This determines when the `KeyboardPan` and\n * `KeyboardZoom` interactions trigger. For example, if this option is set to\n * `document` the keyboard interactions will always trigger. If this option is\n * not specified, the element the library listens to keyboard events on is the\n * map target (i.e. the user-provided div for the map). If this is not\n * `document`, the target element needs to be focused for key events to be\n * emitted, requiring that the target element has a `tabindex` attribute.\n * @property {Array<import(\"./layer/Base.js\").default>|Collection<import(\"./layer/Base.js\").default>|LayerGroup} [layers]\n * Layers. If this is not defined, a map with no layers will be rendered. Note\n * that layers are rendered in the order supplied, so if you want, for example,\n * a vector layer to appear on top of a tile layer, it must come after the tile\n * layer.\n * @property {number} [maxTilesLoading=16] Maximum number tiles to load\n * simultaneously.\n * @property {number} [moveTolerance=1] The minimum distance in pixels the\n * cursor must move to be detected as a map move event instead of a click.\n * Increasing this value can make it easier to click on the map.\n * @property {Collection<import(\"./Overlay.js\").default>|Array<import(\"./Overlay.js\").default>} [overlays]\n * Overlays initially added to the map. By default, no overlays are added.\n * @property {HTMLElement|string} [target] The container for the map, either the\n * element itself or the `id` of the element. If not specified at construction\n * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be\n * rendered. If passed by element, the container can be in a secondary document.\n * For accessibility (focus and keyboard events for map navigation), the `target` element must have a\n * properly configured `tabindex` attribute. If the `target` element is inside a Shadow DOM, the\n * `tabindex` atribute must be set on the custom element's host element.\n * **Note:** CSS `transform` support for the target element is limited to `scale`.\n * @property {View|Promise<import(\"./View.js\").ViewOptions>} [view] The map's view. No layer sources will be\n * fetched unless this is specified at construction time or through\n * {@link module:ol/Map~Map#setView}.\n */\n\n/**\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n */\nfunction removeLayerMapProperty(layer) {\n if (layer instanceof Layer) {\n layer.setMapInternal(null);\n return;\n }\n if (layer instanceof LayerGroup) {\n layer.getLayers().forEach(removeLayerMapProperty);\n }\n}\n\n/**\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @param {Map} map Map.\n */\nfunction setLayerMapProperty(layer, map) {\n if (layer instanceof Layer) {\n layer.setMapInternal(map);\n return;\n }\n if (layer instanceof LayerGroup) {\n const layers = layer.getLayers().getArray();\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n setLayerMapProperty(layers[i], map);\n }\n }\n}\n\n/**\n * @classdesc\n * The map is the core component of OpenLayers. For a map to render, a view,\n * one or more layers, and a target container are needed:\n *\n * import Map from 'ol/Map.js';\n * import View from 'ol/View.js';\n * import TileLayer from 'ol/layer/Tile.js';\n * import OSM from 'ol/source/OSM.js';\n *\n * const map = new Map({\n * view: new View({\n * center: [0, 0],\n * zoom: 1,\n * }),\n * layers: [\n * new TileLayer({\n * source: new OSM(),\n * }),\n * ],\n * target: 'map',\n * });\n *\n * The above snippet creates a map using a {@link module:ol/layer/Tile~TileLayer} to\n * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM\n * element with the id `map`.\n *\n * The constructor places a viewport container (with CSS class name\n * `ol-viewport`) in the target element (see `getViewport()`), and then two\n * further elements within the viewport: one with CSS class name\n * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with\n * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent`\n * option of {@link module:ol/Overlay~Overlay} for the difference). The map\n * itself is placed in a further element within the viewport.\n *\n * Layers are stored as a {@link module:ol/Collection~Collection} in\n * layerGroups. A top-level group is provided by the library. This is what is\n * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the\n * options are added to this group, and `addLayer` and `removeLayer` change the\n * layer collection in the group. `getLayers` is a convenience function for\n * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~LayerGroup}\n * is a subclass of {@link module:ol/layer/Base~BaseLayer}, so layers entered in the\n * options or added with `addLayer` can be groups, which can contain further\n * groups, and so on.\n *\n * @fires import(\"./MapBrowserEvent.js\").MapBrowserEvent\n * @fires import(\"./MapEvent.js\").MapEvent\n * @fires import(\"./render/Event.js\").default#precompose\n * @fires import(\"./render/Event.js\").default#postcompose\n * @fires import(\"./render/Event.js\").default#rendercomplete\n * @api\n */\nclass Map extends BaseObject {\n /**\n * @param {MapOptions} [options] Map options.\n */\n constructor(options) {\n super();\n\n options = options || {};\n\n /***\n * @type {MapEventHandler<import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {MapEventHandler<import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {MapEventHandler<void>}\n */\n this.un;\n\n const optionsInternal = createOptionsInternal(options);\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderComplete_ = false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.loaded_ = true;\n\n /** @private */\n this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this);\n\n /**\n * @type {number}\n * @private\n */\n this.maxTilesLoading_ =\n options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ =\n options.pixelRatio !== undefined\n ? options.pixelRatio\n : DEVICE_PIXEL_RATIO;\n\n /**\n * @private\n * @type {ReturnType<typeof setTimeout>}\n */\n this.postRenderTimeoutHandle_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.animationDelayKey_;\n\n /**\n * @private\n */\n this.animationDelay_ = this.animationDelay_.bind(this);\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.coordinateToPixelTransform_ = createTransform();\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.pixelToCoordinateTransform_ = createTransform();\n\n /**\n * @private\n * @type {number}\n */\n this.frameIndex_ = 0;\n\n /**\n * @private\n * @type {?FrameState}\n */\n this.frameState_ = null;\n\n /**\n * The extent at the previous 'moveend' event.\n * @private\n * @type {import(\"./extent.js\").Extent}\n */\n this.previousExtent_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewPropertyListenerKey_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewChangeListenerKey_ = null;\n\n /**\n * @private\n * @type {?Array<import(\"./events.js\").EventsKey>}\n */\n this.layerGroupPropertyListenerKeys_ = null;\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.viewport_ = document.createElement('div');\n this.viewport_.className =\n 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : '');\n this.viewport_.style.position = 'relative';\n this.viewport_.style.overflow = 'hidden';\n this.viewport_.style.width = '100%';\n this.viewport_.style.height = '100%';\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainer_ = document.createElement('div');\n this.overlayContainer_.style.position = 'absolute';\n this.overlayContainer_.style.zIndex = '0';\n this.overlayContainer_.style.width = '100%';\n this.overlayContainer_.style.height = '100%';\n this.overlayContainer_.style.pointerEvents = 'none';\n this.overlayContainer_.className = 'ol-overlaycontainer';\n this.viewport_.appendChild(this.overlayContainer_);\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainerStopEvent_ = document.createElement('div');\n this.overlayContainerStopEvent_.style.position = 'absolute';\n this.overlayContainerStopEvent_.style.zIndex = '0';\n this.overlayContainerStopEvent_.style.width = '100%';\n this.overlayContainerStopEvent_.style.height = '100%';\n this.overlayContainerStopEvent_.style.pointerEvents = 'none';\n this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';\n this.viewport_.appendChild(this.overlayContainerStopEvent_);\n\n /**\n * @private\n * @type {MapBrowserEventHandler}\n */\n this.mapBrowserEventHandler_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.moveTolerance_ = options.moveTolerance;\n\n /**\n * @private\n * @type {HTMLElement|Document}\n */\n this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;\n\n /**\n * @private\n * @type {?Array<import(\"./events.js\").EventsKey>}\n */\n this.targetChangeHandlerKeys_ = null;\n\n /**\n * @private\n * @type {HTMLElement|null}\n */\n this.targetElement_ = null;\n\n /**\n * @private\n * @type {ResizeObserver}\n */\n this.resizeObserver_ = new ResizeObserver(() => this.updateSize());\n\n /**\n * @type {Collection<import(\"./control/Control.js\").default>}\n * @protected\n */\n this.controls = optionsInternal.controls || defaultControls();\n\n /**\n * @type {Collection<import(\"./interaction/Interaction.js\").default>}\n * @protected\n */\n this.interactions =\n optionsInternal.interactions ||\n defaultInteractions({\n onFocusOnly: true,\n });\n\n /**\n * @type {Collection<import(\"./Overlay.js\").default>}\n * @private\n */\n this.overlays_ = optionsInternal.overlays;\n\n /**\n * A lookup of overlays by id.\n * @private\n * @type {Object<string, import(\"./Overlay.js\").default>}\n */\n this.overlayIdIndex_ = {};\n\n /**\n * @type {import(\"./renderer/Map.js\").default|null}\n * @private\n */\n this.renderer_ = null;\n\n /**\n * @private\n * @type {!Array<PostRenderFunction>}\n */\n this.postRenderFunctions_ = [];\n\n /**\n * @private\n * @type {TileQueue}\n */\n this.tileQueue_ = new TileQueue(\n this.getTilePriority.bind(this),\n this.handleTileChange_.bind(this),\n );\n\n this.addChangeListener(\n MapProperty.LAYERGROUP,\n this.handleLayerGroupChanged_,\n );\n this.addChangeListener(MapProperty.VIEW, this.handleViewChanged_);\n this.addChangeListener(MapProperty.SIZE, this.handleSizeChanged_);\n this.addChangeListener(MapProperty.TARGET, this.handleTargetChanged_);\n\n // setProperties will trigger the rendering of the map if the map\n // is \"defined\" already.\n this.setProperties(optionsInternal.values);\n\n const map = this;\n if (options.view && !(options.view instanceof View)) {\n options.view.then(function (viewOptions) {\n map.setView(new View(viewOptions));\n });\n }\n\n this.controls.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent<import(\"./control/Control.js\").default>} event CollectionEvent\n */\n (event) => {\n event.element.setMap(this);\n },\n );\n\n this.controls.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent<import(\"./control/Control.js\").default>} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(null);\n },\n );\n\n this.interactions.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent<import(\"./interaction/Interaction.js\").default>} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(this);\n },\n );\n\n this.interactions.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent<import(\"./interaction/Interaction.js\").default>} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(null);\n },\n );\n\n this.overlays_.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent<import(\"./Overlay.js\").default>} event CollectionEvent.\n */\n (event) => {\n this.addOverlayInternal_(event.element);\n },\n );\n\n this.overlays_.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent<import(\"./Overlay.js\").default>} event CollectionEvent.\n */\n (event) => {\n const id = event.element.getId();\n if (id !== undefined) {\n delete this.overlayIdIndex_[id.toString()];\n }\n event.element.setMap(null);\n },\n );\n\n this.controls.forEach(\n /**\n * @param {import(\"./control/Control.js\").default} control Control.\n */\n (control) => {\n control.setMap(this);\n },\n );\n\n this.interactions.forEach(\n /**\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction.\n */\n (interaction) => {\n interaction.setMap(this);\n },\n );\n\n this.overlays_.forEach(this.addOverlayInternal_.bind(this));\n }\n\n /**\n * Add the given control to the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @api\n */\n addControl(control) {\n this.getControls().push(control);\n }\n\n /**\n * Add the given interaction to the map. If you want to add an interaction\n * at another point of the collection use `getInteractions()` and the methods\n * available on {@link module:ol/Collection~Collection}. This can be used to\n * stop the event propagation from the handleEvent function. The interactions\n * get to handle the events in the reverse order of this collection.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to add.\n * @api\n */\n addInteraction(interaction) {\n this.getInteractions().push(interaction);\n }\n\n /**\n * Adds the given layer to the top of this map. If you want to add a layer\n * elsewhere in the stack, use `getLayers()` and the methods available on\n * {@link module:ol/Collection~Collection}.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @api\n */\n addLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n layers.push(layer);\n }\n\n /**\n * @param {import(\"./layer/Group.js\").GroupEvent} event The layer add event.\n * @private\n */\n handleLayerAdd_(event) {\n setLayerMapProperty(event.layer, this);\n }\n\n /**\n * Add the given overlay to the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @api\n */\n addOverlay(overlay) {\n this.getOverlays().push(overlay);\n }\n\n /**\n * This deals with map's overlay collection changes.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @private\n */\n addOverlayInternal_(overlay) {\n const id = overlay.getId();\n if (id !== undefined) {\n this.overlayIdIndex_[id.toString()] = overlay;\n }\n overlay.setMap(this);\n }\n\n /**\n *\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.controls.clear();\n this.interactions.clear();\n this.overlays_.clear();\n this.resizeObserver_.disconnect();\n this.setTarget(null);\n super.disposeInternal();\n }\n\n /**\n * Detect features that intersect a pixel on the viewport, and execute a\n * callback with each intersecting feature. Layers included in the detection can\n * be configured through the `layerFilter` option in `options`.\n * For polygons without a fill, only the stroke will be used for hit detection.\n * Polygons must have a fill style applied to ensure that pixels inside a polygon are detected.\n * The fill can be transparent.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {function(import(\"./Feature.js\").FeatureLike, import(\"./layer/Layer.js\").default<import(\"./source/Source\").default>, import(\"./geom/SimpleGeometry.js\").default): T} callback Feature callback. The callback will be\n * called with two arguments. The first argument is one\n * {@link module:ol/Feature~Feature feature} or\n * {@link module:ol/render/Feature~RenderFeature render feature} at the pixel, the second is\n * the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for\n * unmanaged layers. To stop detection, callback functions can return a\n * truthy value.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {T|undefined} Callback result, i.e. the return value of last\n * callback execution, or the first truthy callback return value.\n * @template T\n * @api\n */\n forEachFeatureAtPixel(pixel, callback, options) {\n if (!this.frameState_ || !this.renderer_) {\n return;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n options = options !== undefined ? options : {};\n const hitTolerance =\n options.hitTolerance !== undefined ? options.hitTolerance : 0;\n const layerFilter =\n options.layerFilter !== undefined ? options.layerFilter : TRUE;\n const checkWrapped = options.checkWrapped !== false;\n return this.renderer_.forEachFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n callback,\n null,\n layerFilter,\n null,\n );\n }\n\n /**\n * Get all features that intersect a pixel on the viewport.\n * For polygons without a fill, only the stroke will be used for hit detection.\n * Polygons must have a fill style applied to ensure that pixels inside a polygon are detected.\n * The fill can be transparent.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {Array<import(\"./Feature.js\").FeatureLike>} The detected features or\n * an empty array if none were found.\n * @api\n */\n getFeaturesAtPixel(pixel, options) {\n const features = [];\n this.forEachFeatureAtPixel(\n pixel,\n function (feature) {\n features.push(feature);\n },\n options,\n );\n return features;\n }\n\n /**\n * Get all layers from all layer groups.\n * @return {Array<import(\"./layer/Layer.js\").default>} Layers.\n * @api\n */\n getAllLayers() {\n const layers = [];\n function addLayersFrom(layerGroup) {\n layerGroup.forEach(function (layer) {\n if (layer instanceof LayerGroup) {\n addLayersFrom(layer.getLayers());\n } else {\n layers.push(layer);\n }\n });\n }\n addLayersFrom(this.getLayers());\n return layers;\n }\n\n /**\n * Detect if features intersect a pixel on the viewport. Layers included in the\n * detection can be configured through the `layerFilter` option.\n * For polygons without a fill, only the stroke will be used for hit detection.\n * Polygons must have a fill style applied to ensure that pixels inside a polygon are detected.\n * The fill can be transparent.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {boolean} Is there a feature at the given pixel?\n * @api\n */\n hasFeatureAtPixel(pixel, options) {\n if (!this.frameState_ || !this.renderer_) {\n return false;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n options = options !== undefined ? options : {};\n const layerFilter =\n options.layerFilter !== undefined ? options.layerFilter : TRUE;\n const hitTolerance =\n options.hitTolerance !== undefined ? options.hitTolerance : 0;\n const checkWrapped = options.checkWrapped !== false;\n return this.renderer_.hasFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n layerFilter,\n null,\n );\n }\n\n /**\n * Returns the coordinate in user projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\n getEventCoordinate(event) {\n return this.getCoordinateFromPixel(this.getEventPixel(event));\n }\n\n /**\n * Returns the coordinate in view projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n */\n getEventCoordinateInternal(event) {\n return this.getCoordinateFromPixelInternal(this.getEventPixel(event));\n }\n\n /**\n * Returns the map pixel position for a browser event relative to the viewport.\n * @param {UIEvent|{clientX: number, clientY: number}} event Event.\n * @return {import(\"./pixel.js\").Pixel} Pixel.\n * @api\n */\n getEventPixel(event) {\n const viewport = this.viewport_;\n const viewportPosition = viewport.getBoundingClientRect();\n const viewportSize = this.getSize();\n const scaleX = viewportPosition.width / viewportSize[0];\n const scaleY = viewportPosition.height / viewportSize[1];\n const eventPosition =\n //FIXME Are we really calling this with a TouchEvent anywhere?\n 'changedTouches' in event\n ? /** @type {TouchEvent} */ (event).changedTouches[0]\n : /** @type {MouseEvent} */ (event);\n\n return [\n (eventPosition.clientX - viewportPosition.left) / scaleX,\n (eventPosition.clientY - viewportPosition.top) / scaleY,\n ];\n }\n\n /**\n * Get the target in which this map is rendered.\n * Note that this returns what is entered as an option or in setTarget:\n * if that was an element, it returns an element; if a string, it returns that.\n * @return {HTMLElement|string|undefined} The Element or id of the Element that the\n * map is rendered in.\n * @observable\n * @api\n */\n getTarget() {\n return /** @type {HTMLElement|string|undefined} */ (\n this.get(MapProperty.TARGET)\n );\n }\n\n /**\n * Get the DOM element into which this map is rendered. In contrast to\n * `getTarget` this method always return an `Element`, or `null` if the\n * map has no target.\n * @return {HTMLElement} The element that the map is rendered in.\n * @api\n */\n getTargetElement() {\n return this.targetElement_;\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * user projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n * @api\n */\n getCoordinateFromPixel(pixel) {\n return toUserCoordinate(\n this.getCoordinateFromPixelInternal(pixel),\n this.getView().getProjection(),\n );\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * map view projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n */\n getCoordinateFromPixelInternal(pixel) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n return applyTransform(frameState.pixelToCoordinateTransform, pixel.slice());\n }\n\n /**\n * Get the map controls. Modifying this collection changes the controls\n * associated with the map.\n * @return {Collection<import(\"./control/Control.js\").default>} Controls.\n * @api\n */\n getControls() {\n return this.controls;\n }\n\n /**\n * Get the map overlays. Modifying this collection changes the overlays\n * associated with the map.\n * @return {Collection<import(\"./Overlay.js\").default>} Overlays.\n * @api\n */\n getOverlays() {\n return this.overlays_;\n }\n\n /**\n * Get an overlay by its identifier (the value returned by overlay.getId()).\n * Note that the index treats string and numeric identifiers as the same. So\n * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.\n * @param {string|number} id Overlay identifier.\n * @return {import(\"./Overlay.js\").default|null} Overlay.\n * @api\n */\n getOverlayById(id) {\n const overlay = this.overlayIdIndex_[id.toString()];\n return overlay !== undefined ? overlay : null;\n }\n\n /**\n * Get the map interactions. Modifying this collection changes the interactions\n * associated with the map.\n *\n * Interactions are used for e.g. pan, zoom and rotate.\n * @return {Collection<import(\"./interaction/Interaction.js\").default>} Interactions.\n * @api\n */\n getInteractions() {\n return this.interactions;\n }\n\n /**\n * Get the layergroup associated with this map.\n * @return {LayerGroup} A layer group containing the layers in this map.\n * @observable\n * @api\n */\n getLayerGroup() {\n return /** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP));\n }\n\n /**\n * Clear any existing layers and add layers to the map.\n * @param {Array<import(\"./layer/Base.js\").default>|Collection<import(\"./layer/Base.js\").default>} layers The layers to be added to the map.\n * @api\n */\n setLayers(layers) {\n const group = this.getLayerGroup();\n if (layers instanceof Collection) {\n group.setLayers(layers);\n return;\n }\n\n const collection = group.getLayers();\n collection.clear();\n collection.extend(layers);\n }\n\n /**\n * Get the collection of layers associated with this map.\n * @return {!Collection<import(\"./layer/Base.js\").default>} Layers.\n * @api\n */\n getLayers() {\n const layers = this.getLayerGroup().getLayers();\n return layers;\n }\n\n /**\n * @return {boolean} Layers have sources that are still loading.\n */\n getLoadingOrNotReady() {\n const layerStatesArray = this.getLayerGroup().getLayerStatesArray();\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const state = layerStatesArray[i];\n if (!state.visible) {\n continue;\n }\n const renderer = state.layer.getRenderer();\n if (renderer && !renderer.ready) {\n return true;\n }\n const source = state.layer.getSource();\n if (source && source.loading) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the user\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n * @api\n */\n getPixelFromCoordinate(coordinate) {\n const viewCoordinate = fromUserCoordinate(\n coordinate,\n this.getView().getProjection(),\n );\n return this.getPixelFromCoordinateInternal(viewCoordinate);\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the map view\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n */\n getPixelFromCoordinateInternal(coordinate) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n return applyTransform(\n frameState.coordinateToPixelTransform,\n coordinate.slice(0, 2),\n );\n }\n\n /**\n * Get the map renderer.\n * @return {import(\"./renderer/Map.js\").default|null} Renderer\n */\n getRenderer() {\n return this.renderer_;\n }\n\n /**\n * Get the size of this map.\n * @return {import(\"./size.js\").Size|undefined} The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n getSize() {\n return /** @type {import(\"./size.js\").Size|undefined} */ (\n this.get(MapProperty.SIZE)\n );\n }\n\n /**\n * Get the view associated with this map. A view manages properties such as\n * center and resolution.\n * @return {View} The view that controls this map.\n * @observable\n * @api\n */\n getView() {\n return /** @type {View} */ (this.get(MapProperty.VIEW));\n }\n\n /**\n * Get the element that serves as the map viewport.\n * @return {HTMLElement} Viewport.\n * @api\n */\n getViewport() {\n return this.viewport_;\n }\n\n /**\n * Get the element that serves as the container for overlays. Elements added to\n * this container will let mousedown and touchstart events through to the map,\n * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}\n * events.\n * @return {!HTMLElement} The map's overlay container.\n */\n getOverlayContainer() {\n return this.overlayContainer_;\n }\n\n /**\n * Get the element that serves as a container for overlays that don't allow\n * event propagation. Elements added to this container won't let mousedown and\n * touchstart events through to the map, so clicks and gestures on an overlay\n * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @return {!HTMLElement} The map's overlay container that stops events.\n */\n getOverlayContainerStopEvent() {\n return this.overlayContainerStopEvent_;\n }\n\n /**\n * @return {!Document} The document where the map is displayed.\n */\n getOwnerDocument() {\n const targetElement = this.getTargetElement();\n return targetElement ? targetElement.ownerDocument : document;\n }\n\n /**\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\n getTilePriority(tile, tileSourceKey, tileCenter, tileResolution) {\n return getTilePriority(\n this.frameState_,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution,\n );\n }\n\n /**\n * @param {PointerEvent|KeyboardEvent|WheelEvent} browserEvent Browser event.\n * @param {string} [type] Type.\n */\n handleBrowserEvent(browserEvent, type) {\n type = type || browserEvent.type;\n const mapBrowserEvent = new MapBrowserEvent(type, this, browserEvent);\n this.handleMapBrowserEvent(mapBrowserEvent);\n }\n\n /**\n * @param {MapBrowserEvent} mapBrowserEvent The event to handle.\n */\n handleMapBrowserEvent(mapBrowserEvent) {\n if (!this.frameState_) {\n // With no view defined, we cannot translate pixels into geographical\n // coordinates so interactions cannot be used.\n return;\n }\n const originalEvent = mapBrowserEvent.originalEvent;\n const eventType = originalEvent.type;\n if (\n eventType === PointerEventType.POINTERDOWN ||\n eventType === EventType.WHEEL ||\n eventType === EventType.KEYDOWN\n ) {\n const doc = this.getOwnerDocument();\n const rootNode = this.viewport_.getRootNode\n ? this.viewport_.getRootNode()\n : doc;\n const target = /** @type {Node} */ (originalEvent.target);\n\n const currentDoc =\n rootNode instanceof ShadowRoot\n ? rootNode.host === target\n ? rootNode.host.ownerDocument\n : rootNode\n : rootNode === doc\n ? doc.documentElement\n : rootNode;\n if (\n // Abort if the target is a child of the container for elements whose events are not meant\n // to be handled by map interactions.\n this.overlayContainerStopEvent_.contains(target) ||\n // Abort if the event target is a child of the container that is no longer in the page.\n // It's possible for the target to no longer be in the page if it has been removed in an\n // event listener, this might happen in a Control that recreates it's content based on\n // user interaction either manually or via a render in something like https://reactjs.org/\n !currentDoc.contains(target)\n ) {\n return;\n }\n }\n mapBrowserEvent.frameState = this.frameState_;\n if (this.dispatchEvent(mapBrowserEvent) !== false) {\n const interactionsArray = this.getInteractions().getArray().slice();\n for (let i = interactionsArray.length - 1; i >= 0; i--) {\n const interaction = interactionsArray[i];\n if (\n interaction.getMap() !== this ||\n !interaction.getActive() ||\n !this.getTargetElement()\n ) {\n continue;\n }\n const cont = interaction.handleEvent(mapBrowserEvent);\n if (!cont || mapBrowserEvent.propagationStopped) {\n break;\n }\n }\n }\n }\n\n /**\n * @protected\n */\n handlePostRender() {\n const frameState = this.frameState_;\n\n // Manage the tile queue\n // Image loads are expensive and a limited resource, so try to use them\n // efficiently:\n // * When the view is static we allow a large number of parallel tile loads\n // to complete the frame as quickly as possible.\n // * When animating or interacting, image loads can cause janks, so we reduce\n // the maximum number of loads per frame and limit the number of parallel\n // tile loads to remain reactive to view changes and to reduce the chance of\n // loading tiles that will quickly disappear from view.\n const tileQueue = this.tileQueue_;\n if (!tileQueue.isEmpty()) {\n let maxTotalLoading = this.maxTilesLoading_;\n let maxNewLoads = maxTotalLoading;\n if (frameState) {\n const hints = frameState.viewHints;\n if (hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]) {\n const lowOnFrameBudget = Date.now() - frameState.time > 8;\n maxTotalLoading = lowOnFrameBudget ? 0 : 8;\n maxNewLoads = lowOnFrameBudget ? 0 : 2;\n }\n }\n if (tileQueue.getTilesLoading() < maxTotalLoading) {\n tileQueue.reprioritize(); // FIXME only call if view has changed\n tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);\n }\n }\n\n if (frameState && this.renderer_ && !frameState.animate) {\n if (this.renderComplete_) {\n if (this.hasListener(RenderEventType.RENDERCOMPLETE)) {\n this.renderer_.dispatchRenderEvent(\n RenderEventType.RENDERCOMPLETE,\n frameState,\n );\n }\n if (this.loaded_ === false) {\n this.loaded_ = true;\n this.dispatchEvent(\n new MapEvent(MapEventType.LOADEND, this, frameState),\n );\n }\n } else if (this.loaded_ === true) {\n this.loaded_ = false;\n this.dispatchEvent(\n new MapEvent(MapEventType.LOADSTART, this, frameState),\n );\n }\n }\n\n const postRenderFunctions = this.postRenderFunctions_;\n if (frameState) {\n for (let i = 0, ii = postRenderFunctions.length; i < ii; ++i) {\n postRenderFunctions[i](this, frameState);\n }\n }\n postRenderFunctions.length = 0;\n }\n\n /**\n * @private\n */\n handleSizeChanged_() {\n if (this.getView() && !this.getView().getAnimating()) {\n this.getView().resolveConstraints(0);\n }\n\n this.render();\n }\n\n /**\n * @private\n */\n handleTargetChanged_() {\n if (this.mapBrowserEventHandler_) {\n for (let i = 0, ii = this.targetChangeHandlerKeys_.length; i < ii; ++i) {\n unlistenByKey(this.targetChangeHandlerKeys_[i]);\n }\n this.targetChangeHandlerKeys_ = null;\n this.viewport_.removeEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_,\n );\n this.viewport_.removeEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_,\n );\n this.mapBrowserEventHandler_.dispose();\n this.mapBrowserEventHandler_ = null;\n this.viewport_.remove();\n }\n\n if (this.targetElement_) {\n this.resizeObserver_.unobserve(this.targetElement_);\n const rootNode = this.targetElement_.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n this.resizeObserver_.unobserve(rootNode.host);\n }\n this.setSize(undefined);\n }\n\n // target may be undefined, null, a string or an Element.\n // If it's a string we convert it to an Element before proceeding.\n // If it's not now an Element we remove the viewport from the DOM.\n // If it's an Element we append the viewport element to it.\n\n const target = this.getTarget();\n const targetElement =\n typeof target === 'string' ? document.getElementById(target) : target;\n this.targetElement_ = targetElement;\n if (!targetElement) {\n if (this.renderer_) {\n clearTimeout(this.postRenderTimeoutHandle_);\n this.postRenderTimeoutHandle_ = undefined;\n this.postRenderFunctions_.length = 0;\n this.renderer_.dispose();\n this.renderer_ = null;\n }\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n this.animationDelayKey_ = undefined;\n }\n } else {\n targetElement.appendChild(this.viewport_);\n if (!this.renderer_) {\n this.renderer_ = new CompositeMapRenderer(this);\n }\n\n this.mapBrowserEventHandler_ = new MapBrowserEventHandler(\n this,\n this.moveTolerance_,\n );\n for (const key in MapBrowserEventType) {\n this.mapBrowserEventHandler_.addEventListener(\n MapBrowserEventType[key],\n this.handleMapBrowserEvent.bind(this),\n );\n }\n this.viewport_.addEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_,\n false,\n );\n this.viewport_.addEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false,\n );\n\n let keyboardEventTarget;\n if (!this.keyboardEventTarget_) {\n // check if map target is in shadowDOM, if yes use host element as target\n const targetRoot = targetElement.getRootNode();\n const targetCandidate =\n targetRoot instanceof ShadowRoot ? targetRoot.host : targetElement;\n keyboardEventTarget = targetCandidate;\n } else {\n keyboardEventTarget = this.keyboardEventTarget_;\n }\n\n this.targetChangeHandlerKeys_ = [\n listen(\n keyboardEventTarget,\n EventType.KEYDOWN,\n this.handleBrowserEvent,\n this,\n ),\n listen(\n keyboardEventTarget,\n EventType.KEYPRESS,\n this.handleBrowserEvent,\n this,\n ),\n ];\n const rootNode = targetElement.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n this.resizeObserver_.observe(rootNode.host);\n }\n this.resizeObserver_.observe(targetElement);\n }\n\n this.updateSize();\n // updateSize calls setSize, so no need to call this.render\n // ourselves here.\n }\n\n /**\n * @private\n */\n handleTileChange_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewPropertyChanged_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewChanged_() {\n if (this.viewPropertyListenerKey_) {\n unlistenByKey(this.viewPropertyListenerKey_);\n this.viewPropertyListenerKey_ = null;\n }\n if (this.viewChangeListenerKey_) {\n unlistenByKey(this.viewChangeListenerKey_);\n this.viewChangeListenerKey_ = null;\n }\n const view = this.getView();\n if (view) {\n this.updateViewportSize_(this.getSize());\n\n this.viewPropertyListenerKey_ = listen(\n view,\n ObjectEventType.PROPERTYCHANGE,\n this.handleViewPropertyChanged_,\n this,\n );\n this.viewChangeListenerKey_ = listen(\n view,\n EventType.CHANGE,\n this.handleViewPropertyChanged_,\n this,\n );\n\n view.resolveConstraints(0);\n }\n this.render();\n }\n\n /**\n * @private\n */\n handleLayerGroupChanged_() {\n if (this.layerGroupPropertyListenerKeys_) {\n this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey);\n this.layerGroupPropertyListenerKeys_ = null;\n }\n const layerGroup = this.getLayerGroup();\n if (layerGroup) {\n this.handleLayerAdd_(new GroupEvent('addlayer', layerGroup));\n this.layerGroupPropertyListenerKeys_ = [\n listen(layerGroup, ObjectEventType.PROPERTYCHANGE, this.render, this),\n listen(layerGroup, EventType.CHANGE, this.render, this),\n listen(layerGroup, 'addlayer', this.handleLayerAdd_, this),\n listen(layerGroup, 'removelayer', this.handleLayerRemove_, this),\n ];\n }\n this.render();\n }\n\n /**\n * @return {boolean} Is rendered.\n */\n isRendered() {\n return !!this.frameState_;\n }\n\n /**\n * @private\n */\n animationDelay_() {\n this.animationDelayKey_ = undefined;\n this.renderFrame_(Date.now());\n }\n\n /**\n * Requests an immediate render in a synchronous manner.\n * @api\n */\n renderSync() {\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n }\n this.animationDelay_();\n }\n\n /**\n * Redraws all text after new fonts have loaded\n */\n redrawText() {\n if (!this.frameState_) {\n return;\n }\n const layerStates = this.frameState_.layerStatesArray;\n for (let i = 0, ii = layerStates.length; i < ii; ++i) {\n const layer = layerStates[i].layer;\n if (layer.hasRenderer()) {\n layer.getRenderer().handleFontsChanged();\n }\n }\n }\n\n /**\n * Request a map rendering (at the next animation frame).\n * @api\n */\n render() {\n if (this.renderer_ && this.animationDelayKey_ === undefined) {\n this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);\n }\n }\n\n /**\n * Remove the given control from the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @return {import(\"./control/Control.js\").default|undefined} The removed control (or undefined\n * if the control was not found).\n * @api\n */\n removeControl(control) {\n return this.getControls().remove(control);\n }\n\n /**\n * Remove the given interaction from the map.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to remove.\n * @return {import(\"./interaction/Interaction.js\").default|undefined} The removed interaction (or\n * undefined if the interaction was not found).\n * @api\n */\n removeInteraction(interaction) {\n return this.getInteractions().remove(interaction);\n }\n\n /**\n * Removes the given layer from the map.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @return {import(\"./layer/Base.js\").default|undefined} The removed layer (or undefined if the\n * layer was not found).\n * @api\n */\n removeLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n return layers.remove(layer);\n }\n\n /**\n * @param {import(\"./layer/Group.js\").GroupEvent} event The layer remove event.\n * @private\n */\n handleLayerRemove_(event) {\n removeLayerMapProperty(event.layer);\n }\n\n /**\n * Remove the given overlay from the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @return {import(\"./Overlay.js\").default|undefined} The removed overlay (or undefined\n * if the overlay was not found).\n * @api\n */\n removeOverlay(overlay) {\n return this.getOverlays().remove(overlay);\n }\n\n /**\n * @param {number} time Time.\n * @private\n */\n renderFrame_(time) {\n const size = this.getSize();\n const view = this.getView();\n const previousFrameState = this.frameState_;\n /** @type {?FrameState} */\n let frameState = null;\n if (size !== undefined && hasArea(size) && view && view.isDef()) {\n const viewHints = view.getHints(\n this.frameState_ ? this.frameState_.viewHints : undefined,\n );\n const viewState = view.getState();\n frameState = {\n animate: false,\n coordinateToPixelTransform: this.coordinateToPixelTransform_,\n declutter: null,\n extent: getForViewAndSize(\n viewState.center,\n viewState.resolution,\n viewState.rotation,\n size,\n ),\n index: this.frameIndex_++,\n layerIndex: 0,\n layerStatesArray: this.getLayerGroup().getLayerStatesArray(),\n pixelRatio: this.pixelRatio_,\n pixelToCoordinateTransform: this.pixelToCoordinateTransform_,\n postRenderFunctions: [],\n size: size,\n tileQueue: this.tileQueue_,\n time: time,\n usedTiles: {},\n viewState: viewState,\n viewHints: viewHints,\n wantedTiles: {},\n mapId: getUid(this),\n renderTargets: {},\n };\n if (viewState.nextCenter && viewState.nextResolution) {\n const rotation = isNaN(viewState.nextRotation)\n ? viewState.rotation\n : viewState.nextRotation;\n\n frameState.nextExtent = getForViewAndSize(\n viewState.nextCenter,\n viewState.nextResolution,\n rotation,\n size,\n );\n }\n }\n\n this.frameState_ = frameState;\n this.renderer_.renderFrame(frameState);\n\n if (frameState) {\n if (frameState.animate) {\n this.render();\n }\n Array.prototype.push.apply(\n this.postRenderFunctions_,\n frameState.postRenderFunctions,\n );\n\n if (previousFrameState) {\n const moveStart =\n !this.previousExtent_ ||\n (!isEmpty(this.previousExtent_) &&\n !equalsExtent(frameState.extent, this.previousExtent_));\n if (moveStart) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVESTART, this, previousFrameState),\n );\n this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);\n }\n }\n\n const idle =\n this.previousExtent_ &&\n !frameState.viewHints[ViewHint.ANIMATING] &&\n !frameState.viewHints[ViewHint.INTERACTING] &&\n !equalsExtent(frameState.extent, this.previousExtent_);\n\n if (idle) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVEEND, this, frameState),\n );\n clone(frameState.extent, this.previousExtent_);\n }\n }\n\n this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState));\n\n this.renderComplete_ =\n (this.hasListener(MapEventType.LOADSTART) ||\n this.hasListener(MapEventType.LOADEND) ||\n this.hasListener(RenderEventType.RENDERCOMPLETE)) &&\n !this.tileQueue_.getTilesLoading() &&\n !this.tileQueue_.getCount() &&\n !this.getLoadingOrNotReady();\n\n if (!this.postRenderTimeoutHandle_) {\n this.postRenderTimeoutHandle_ = setTimeout(() => {\n this.postRenderTimeoutHandle_ = undefined;\n this.handlePostRender();\n }, 0);\n }\n }\n\n /**\n * Sets the layergroup of this map.\n * @param {LayerGroup} layerGroup A layer group containing the layers in this map.\n * @observable\n * @api\n */\n setLayerGroup(layerGroup) {\n const oldLayerGroup = this.getLayerGroup();\n if (oldLayerGroup) {\n this.handleLayerRemove_(new GroupEvent('removelayer', oldLayerGroup));\n }\n this.set(MapProperty.LAYERGROUP, layerGroup);\n }\n\n /**\n * Set the size of this map.\n * @param {import(\"./size.js\").Size|undefined} size The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n setSize(size) {\n this.set(MapProperty.SIZE, size);\n }\n\n /**\n * Set the target element to render this map into.\n * For accessibility (focus and keyboard events for map navigation), the `target` element must have a\n * properly configured `tabindex` attribute. If the `target` element is inside a Shadow DOM, the\n * `tabindex` atribute must be set on the custom element's host element.\n * @param {HTMLElement|string} [target] The Element or id of the Element\n * that the map is rendered in.\n * @observable\n * @api\n */\n setTarget(target) {\n this.set(MapProperty.TARGET, target);\n }\n\n /**\n * Set the view for this map.\n * @param {View|Promise<import(\"./View.js\").ViewOptions>|null} view The view that controls this map.\n * It is also possible to pass a promise that resolves to options for constructing a view. This\n * alternative allows view properties to be resolved by sources or other components that load\n * view-related metadata.\n * @observable\n * @api\n */\n setView(view) {\n if (!view || view instanceof View) {\n this.set(MapProperty.VIEW, view);\n return;\n }\n this.set(MapProperty.VIEW, new View());\n\n const map = this;\n view.then(function (viewOptions) {\n map.setView(new View(viewOptions));\n });\n }\n\n /**\n * Force a recalculation of the map viewport size. This should be called when\n * third-party code changes the size of the map viewport.\n * @api\n */\n updateSize() {\n const targetElement = this.getTargetElement();\n\n let size = undefined;\n if (targetElement) {\n const computedStyle = getComputedStyle(targetElement);\n const width =\n targetElement.offsetWidth -\n parseFloat(computedStyle['borderLeftWidth']) -\n parseFloat(computedStyle['paddingLeft']) -\n parseFloat(computedStyle['paddingRight']) -\n parseFloat(computedStyle['borderRightWidth']);\n const height =\n targetElement.offsetHeight -\n parseFloat(computedStyle['borderTopWidth']) -\n parseFloat(computedStyle['paddingTop']) -\n parseFloat(computedStyle['paddingBottom']) -\n parseFloat(computedStyle['borderBottomWidth']);\n if (!isNaN(width) && !isNaN(height)) {\n size = [Math.max(0, width), Math.max(0, height)];\n if (\n !hasArea(size) &&\n !!(\n targetElement.offsetWidth ||\n targetElement.offsetHeight ||\n targetElement.getClientRects().length\n )\n ) {\n warn(\n \"No map visible because the map container's width or height are 0.\",\n );\n }\n }\n }\n\n const oldSize = this.getSize();\n if (size && (!oldSize || !equals(size, oldSize))) {\n this.setSize(size);\n this.updateViewportSize_(size);\n }\n }\n\n /**\n * Recomputes the viewport size and save it on the view object (if any)\n * @param {import(\"./size.js\").Size|undefined} size The size.\n * @private\n */\n updateViewportSize_(size) {\n const view = this.getView();\n if (view) {\n view.setViewportSize(size);\n }\n }\n}\n\n/**\n * @param {MapOptions} options Map options.\n * @return {MapOptionsInternal} Internal map options.\n */\nfunction createOptionsInternal(options) {\n /**\n * @type {HTMLElement|Document}\n */\n let keyboardEventTarget = null;\n if (options.keyboardEventTarget !== undefined) {\n keyboardEventTarget =\n typeof options.keyboardEventTarget === 'string'\n ? document.getElementById(options.keyboardEventTarget)\n : options.keyboardEventTarget;\n }\n\n /**\n * @type {Object<string, *>}\n */\n const values = {};\n\n const layerGroup =\n options.layers &&\n typeof (/** @type {?} */ (options.layers).getLayers) === 'function'\n ? /** @type {LayerGroup} */ (options.layers)\n : new LayerGroup({\n layers:\n /** @type {Collection<import(\"./layer/Base.js\").default>|Array<import(\"./layer/Base.js\").default>} */ (\n options.layers\n ),\n });\n values[MapProperty.LAYERGROUP] = layerGroup;\n\n values[MapProperty.TARGET] = options.target;\n\n values[MapProperty.VIEW] =\n options.view instanceof View ? options.view : new View();\n\n /** @type {Collection<import(\"./control/Control.js\").default>} */\n let controls;\n if (options.controls !== undefined) {\n if (Array.isArray(options.controls)) {\n controls = new Collection(options.controls.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.controls).getArray) === 'function',\n 'Expected `controls` to be an array or an `ol/Collection.js`',\n );\n controls = options.controls;\n }\n }\n\n /** @type {Collection<import(\"./interaction/Interaction\").default>} */\n let interactions;\n if (options.interactions !== undefined) {\n if (Array.isArray(options.interactions)) {\n interactions = new Collection(options.interactions.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.interactions).getArray) ===\n 'function',\n 'Expected `interactions` to be an array or an `ol/Collection.js`',\n );\n interactions = options.interactions;\n }\n }\n\n /** @type {Collection<import(\"./Overlay.js\").default>} */\n let overlays;\n if (options.overlays !== undefined) {\n if (Array.isArray(options.overlays)) {\n overlays = new Collection(options.overlays.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.overlays).getArray) === 'function',\n 'Expected `overlays` to be an array or an `ol/Collection.js`',\n );\n overlays = options.overlays;\n }\n } else {\n overlays = new Collection();\n }\n\n return {\n controls: controls,\n interactions: interactions,\n keyboardEventTarget: keyboardEventTarget,\n overlays: overlays,\n values: values,\n };\n}\nexport default Map;\n","/**\n * @module ol/Overlay\n */\nimport MapEventType from './MapEventType.js';\nimport BaseObject from './Object.js';\nimport {CLASS_SELECTABLE} from './css.js';\nimport {outerHeight, outerWidth, removeChildren} from './dom.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {containsExtent} from './extent.js';\n\n/**\n * @typedef {'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right'} Positioning\n * The overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, or `'top-right'`.\n */\n\n/**\n * @typedef {Object} Options\n * @property {number|string} [id] Set the overlay id. The overlay id can be used\n * with the {@link module:ol/Map~Map#getOverlayById} method.\n * @property {HTMLElement} [element] The overlay element.\n * @property {Array<number>} [offset=[0, 0]] Offsets in pixels used when positioning\n * the overlay. The first element in the\n * array is the horizontal offset. A positive value shifts the overlay right.\n * The second element in the array is the vertical offset. A positive value\n * shifts the overlay down.\n * @property {import(\"./coordinate.js\").Coordinate} [position] The overlay position\n * in map projection.\n * @property {Positioning} [positioning='top-left'] Defines how\n * the overlay is actually positioned with respect to its `position` property.\n * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, and `'top-right'`.\n * @property {boolean} [stopEvent=true] Whether event propagation to the map\n * viewport should be stopped. If `true` the overlay is placed in the same\n * container as that of the controls (CSS class name\n * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container\n * with CSS class name specified by the `className` property.\n * @property {boolean} [insertFirst=true] Whether the overlay is inserted first\n * in the overlay container, or appended. If the overlay is placed in the same\n * container as that of the controls (see the `stopEvent` option) you will\n * probably set `insertFirst` to `true` so the overlay is displayed below the\n * controls.\n * @property {PanIntoViewOptions|boolean} [autoPan=false] Pan the map when calling\n * `setPosition`, so that the overlay is entirely visible in the current viewport.\n * @property {string} [className='ol-overlay-container ol-selectable'] CSS class\n * name.\n */\n\n/**\n * @typedef {Object} PanOptions\n * @property {number} [duration=1000] The duration of the animation in\n * milliseconds.\n * @property {function(number):number} [easing] The easing function to use. Can\n * be one from {@link module:ol/easing} or a custom function.\n * Default is {@link module:ol/easing.inAndOut}.\n */\n\n/**\n * @typedef {Object} PanIntoViewOptions\n * @property {PanOptions} [animation={}] The animation parameters for the pan\n * @property {number} [margin=20] The margin (in pixels) between the\n * overlay and the borders of the map when panning into view.\n */\n\n/**\n * @enum {string}\n * @protected\n */\nconst Property = {\n ELEMENT: 'element',\n MAP: 'map',\n OFFSET: 'offset',\n POSITION: 'position',\n POSITIONING: 'positioning',\n};\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:element'|'change:map'|'change:offset'|'change:position'|\n * 'change:positioning'} OverlayObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature<import(\"./Observable\").EventTypes, import(\"./events/Event.js\").default, Return> &\n * import(\"./Observable\").OnSignature<OverlayObjectEventTypes, import(\"./Object\").ObjectEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature<import(\"./Observable\").EventTypes|OverlayObjectEventTypes, Return>} OverlayOnSignature\n */\n\n/**\n * @classdesc\n * An element to be displayed over the map and attached to a single map\n * location. Like {@link module:ol/control/Control~Control}, Overlays are\n * visible widgets. Unlike Controls, they are not in a fixed position on the\n * screen, but are tied to a geographical coordinate, so panning the map will\n * move an Overlay but not a Control.\n *\n * Example:\n *\n * import Overlay from 'ol/Overlay.js';\n *\n * // ...\n * const popup = new Overlay({\n * element: document.getElementById('popup'),\n * });\n * popup.setPosition(coordinate);\n * map.addOverlay(popup);\n *\n * @api\n */\nclass Overlay extends BaseObject {\n /**\n * @param {Options} options Overlay options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {OverlayOnSignature<import(\"./events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {OverlayOnSignature<import(\"./events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {OverlayOnSignature<void>}\n */\n this.un;\n\n /**\n * @protected\n * @type {Options}\n */\n this.options = options;\n\n /**\n * @protected\n * @type {number|string|undefined}\n */\n this.id = options.id;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.insertFirst =\n options.insertFirst !== undefined ? options.insertFirst : true;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.stopEvent = options.stopEvent !== undefined ? options.stopEvent : true;\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = document.createElement('div');\n this.element.className =\n options.className !== undefined\n ? options.className\n : 'ol-overlay-container ' + CLASS_SELECTABLE;\n this.element.style.position = 'absolute';\n this.element.style.pointerEvents = 'auto';\n\n /**\n * @protected\n * @type {PanIntoViewOptions|undefined}\n */\n this.autoPan = options.autoPan === true ? {} : options.autoPan || undefined;\n\n /**\n * @protected\n * @type {{transform_: string,\n * visible: boolean}}\n */\n this.rendered = {\n transform_: '',\n visible: true,\n };\n\n /**\n * @protected\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.mapPostrenderListenerKey = null;\n\n this.addChangeListener(Property.ELEMENT, this.handleElementChanged);\n this.addChangeListener(Property.MAP, this.handleMapChanged);\n this.addChangeListener(Property.OFFSET, this.handleOffsetChanged);\n this.addChangeListener(Property.POSITION, this.handlePositionChanged);\n this.addChangeListener(Property.POSITIONING, this.handlePositioningChanged);\n\n if (options.element !== undefined) {\n this.setElement(options.element);\n }\n\n this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);\n\n this.setPositioning(options.positioning || 'top-left');\n\n if (options.position !== undefined) {\n this.setPosition(options.position);\n }\n }\n\n /**\n * Get the DOM element of this overlay.\n * @return {HTMLElement|undefined} The Element containing the overlay.\n * @observable\n * @api\n */\n getElement() {\n return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT));\n }\n\n /**\n * Get the overlay identifier which is set on constructor.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id;\n }\n\n /**\n * Get the map associated with this overlay.\n * @return {import(\"./Map.js\").default|null} The map that the\n * overlay is part of.\n * @observable\n * @api\n */\n getMap() {\n return /** @type {import(\"./Map.js\").default|null} */ (\n this.get(Property.MAP) || null\n );\n }\n\n /**\n * Get the offset of this overlay.\n * @return {Array<number>} The offset.\n * @observable\n * @api\n */\n getOffset() {\n return /** @type {Array<number>} */ (this.get(Property.OFFSET));\n }\n\n /**\n * Get the current position of this overlay.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The spatial point that the overlay is\n * anchored at.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(Property.POSITION)\n );\n }\n\n /**\n * Get the current positioning of this overlay.\n * @return {Positioning} How the overlay is positioned\n * relative to its point on the map.\n * @observable\n * @api\n */\n getPositioning() {\n return /** @type {Positioning} */ (this.get(Property.POSITIONING));\n }\n\n /**\n * @protected\n */\n handleElementChanged() {\n removeChildren(this.element);\n const element = this.getElement();\n if (element) {\n this.element.appendChild(element);\n }\n }\n\n /**\n * @protected\n */\n handleMapChanged() {\n if (this.mapPostrenderListenerKey) {\n this.element?.remove();\n unlistenByKey(this.mapPostrenderListenerKey);\n this.mapPostrenderListenerKey = null;\n }\n const map = this.getMap();\n if (map) {\n this.mapPostrenderListenerKey = listen(\n map,\n MapEventType.POSTRENDER,\n this.render,\n this,\n );\n this.updatePixelPosition();\n const container = this.stopEvent\n ? map.getOverlayContainerStopEvent()\n : map.getOverlayContainer();\n if (this.insertFirst) {\n container.insertBefore(this.element, container.childNodes[0] || null);\n } else {\n container.appendChild(this.element);\n }\n this.performAutoPan();\n }\n }\n\n /**\n * @protected\n */\n render() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handleOffsetChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handlePositionChanged() {\n this.updatePixelPosition();\n this.performAutoPan();\n }\n\n /**\n * @protected\n */\n handlePositioningChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * Set the DOM element to be associated with this overlay.\n * @param {HTMLElement|undefined} element The Element containing the overlay.\n * @observable\n * @api\n */\n setElement(element) {\n this.set(Property.ELEMENT, element);\n }\n\n /**\n * Set the map to be associated with this overlay.\n * @param {import(\"./Map.js\").default|null} map The map that the\n * overlay is part of. Pass `null` to just remove the overlay from the current map.\n * @observable\n * @api\n */\n setMap(map) {\n this.set(Property.MAP, map);\n }\n\n /**\n * Set the offset for this overlay.\n * @param {Array<number>} offset Offset.\n * @observable\n * @api\n */\n setOffset(offset) {\n this.set(Property.OFFSET, offset);\n }\n\n /**\n * Set the position for this overlay. If the position is `undefined` the\n * overlay is hidden.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} position The spatial point that the overlay\n * is anchored at.\n * @observable\n * @api\n */\n setPosition(position) {\n this.set(Property.POSITION, position);\n }\n\n /**\n * Pan the map so that the overlay is entirely visible in the current viewport\n * (if necessary) using the configured autoPan parameters\n * @protected\n */\n performAutoPan() {\n if (this.autoPan) {\n this.panIntoView(this.autoPan);\n }\n }\n\n /**\n * Pan the map so that the overlay is entirely visible in the current viewport\n * (if necessary).\n * @param {PanIntoViewOptions} [panIntoViewOptions] Options for the pan action\n * @api\n */\n panIntoView(panIntoViewOptions) {\n const map = this.getMap();\n\n if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {\n return;\n }\n\n const mapRect = this.getRect(map.getTargetElement(), map.getSize());\n const element = this.getElement();\n const overlayRect = this.getRect(element, [\n outerWidth(element),\n outerHeight(element),\n ]);\n\n panIntoViewOptions = panIntoViewOptions || {};\n\n const myMargin =\n panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin;\n if (!containsExtent(mapRect, overlayRect)) {\n // the overlay is not completely inside the viewport, so pan the map\n const offsetLeft = overlayRect[0] - mapRect[0];\n const offsetRight = mapRect[2] - overlayRect[2];\n const offsetTop = overlayRect[1] - mapRect[1];\n const offsetBottom = mapRect[3] - overlayRect[3];\n\n const delta = [0, 0];\n if (offsetLeft < 0) {\n // move map to the left\n delta[0] = offsetLeft - myMargin;\n } else if (offsetRight < 0) {\n // move map to the right\n delta[0] = Math.abs(offsetRight) + myMargin;\n }\n if (offsetTop < 0) {\n // move map up\n delta[1] = offsetTop - myMargin;\n } else if (offsetBottom < 0) {\n // move map down\n delta[1] = Math.abs(offsetBottom) + myMargin;\n }\n\n if (delta[0] !== 0 || delta[1] !== 0) {\n const center = /** @type {import(\"./coordinate.js\").Coordinate} */ (\n map.getView().getCenterInternal()\n );\n const centerPx = map.getPixelFromCoordinateInternal(center);\n if (!centerPx) {\n return;\n }\n const newCenterPx = [centerPx[0] + delta[0], centerPx[1] + delta[1]];\n\n const panOptions = panIntoViewOptions.animation || {};\n map.getView().animateInternal({\n center: map.getCoordinateFromPixelInternal(newCenterPx),\n duration: panOptions.duration,\n easing: panOptions.easing,\n });\n }\n }\n }\n\n /**\n * Get the extent of an element relative to the document\n * @param {HTMLElement} element The element.\n * @param {import(\"./size.js\").Size} size The size of the element.\n * @return {import(\"./extent.js\").Extent} The extent.\n * @protected\n */\n getRect(element, size) {\n const box = element.getBoundingClientRect();\n const offsetX = box.left + window.pageXOffset;\n const offsetY = box.top + window.pageYOffset;\n return [offsetX, offsetY, offsetX + size[0], offsetY + size[1]];\n }\n\n /**\n * Set the positioning for this overlay.\n * @param {Positioning} positioning how the overlay is\n * positioned relative to its point on the map.\n * @observable\n * @api\n */\n setPositioning(positioning) {\n this.set(Property.POSITIONING, positioning);\n }\n\n /**\n * Modify the visibility of the element.\n * @param {boolean} visible Element visibility.\n * @protected\n */\n setVisible(visible) {\n if (this.rendered.visible !== visible) {\n this.element.style.display = visible ? '' : 'none';\n this.rendered.visible = visible;\n }\n }\n\n /**\n * Update pixel position.\n * @protected\n */\n updatePixelPosition() {\n const map = this.getMap();\n const position = this.getPosition();\n if (!map || !map.isRendered() || !position) {\n this.setVisible(false);\n return;\n }\n\n const pixel = map.getPixelFromCoordinate(position);\n const mapSize = map.getSize();\n this.updateRenderedPosition(pixel, mapSize);\n }\n\n /**\n * @param {import(\"./pixel.js\").Pixel} pixel The pixel location.\n * @param {import(\"./size.js\").Size|undefined} mapSize The map size.\n * @protected\n */\n updateRenderedPosition(pixel, mapSize) {\n const style = this.element.style;\n const offset = this.getOffset();\n\n const positioning = this.getPositioning();\n\n this.setVisible(true);\n\n const x = `${pixel[0] + offset[0]}px`;\n const y = `${pixel[1] + offset[1]}px`;\n let posX = '0%';\n let posY = '0%';\n if (\n positioning == 'bottom-right' ||\n positioning == 'center-right' ||\n positioning == 'top-right'\n ) {\n posX = '-100%';\n } else if (\n positioning == 'bottom-center' ||\n positioning == 'center-center' ||\n positioning == 'top-center'\n ) {\n posX = '-50%';\n }\n if (\n positioning == 'bottom-left' ||\n positioning == 'bottom-center' ||\n positioning == 'bottom-right'\n ) {\n posY = '-100%';\n } else if (\n positioning == 'center-left' ||\n positioning == 'center-center' ||\n positioning == 'center-right'\n ) {\n posY = '-50%';\n }\n const transform = `translate(${posX}, ${posY}) translate(${x}, ${y})`;\n if (this.rendered.transform_ != transform) {\n this.rendered.transform_ = transform;\n style.transform = transform;\n }\n }\n\n /**\n * returns the options this Overlay has been created with\n * @return {Options} overlay options\n */\n getOptions() {\n return this.options;\n }\n}\n\nexport default Overlay;\n","/**\n * @module ol/TileRange\n */\n\n/**\n * A representation of a contiguous block of tiles. A tile range is specified\n * by its min/max tile coordinates and is inclusive of coordinates.\n */\nclass TileRange {\n /**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n */\n constructor(minX, maxX, minY, maxY) {\n /**\n * @type {number}\n */\n this.minX = minX;\n\n /**\n * @type {number}\n */\n this.maxX = maxX;\n\n /**\n * @type {number}\n */\n this.minY = minY;\n\n /**\n * @type {number}\n */\n this.maxY = maxY;\n }\n\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {boolean} Contains tile coordinate.\n */\n contains(tileCoord) {\n return this.containsXY(tileCoord[1], tileCoord[2]);\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Contains.\n */\n containsTileRange(tileRange) {\n return (\n this.minX <= tileRange.minX &&\n tileRange.maxX <= this.maxX &&\n this.minY <= tileRange.minY &&\n tileRange.maxY <= this.maxY\n );\n }\n\n /**\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @return {boolean} Contains coordinate.\n */\n containsXY(x, y) {\n return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Equals.\n */\n equals(tileRange) {\n return (\n this.minX == tileRange.minX &&\n this.minY == tileRange.minY &&\n this.maxX == tileRange.maxX &&\n this.maxY == tileRange.maxY\n );\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n */\n extend(tileRange) {\n if (tileRange.minX < this.minX) {\n this.minX = tileRange.minX;\n }\n if (tileRange.maxX > this.maxX) {\n this.maxX = tileRange.maxX;\n }\n if (tileRange.minY < this.minY) {\n this.minY = tileRange.minY;\n }\n if (tileRange.maxY > this.maxY) {\n this.maxY = tileRange.maxY;\n }\n }\n\n /**\n * @return {number} Height.\n */\n getHeight() {\n return this.maxY - this.minY + 1;\n }\n\n /**\n * @return {import(\"./size.js\").Size} Size.\n */\n getSize() {\n return [this.getWidth(), this.getHeight()];\n }\n\n /**\n * @return {number} Width.\n */\n getWidth() {\n return this.maxX - this.minX + 1;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Intersects.\n */\n intersects(tileRange) {\n return (\n this.minX <= tileRange.maxX &&\n this.maxX >= tileRange.minX &&\n this.minY <= tileRange.maxY &&\n this.maxY >= tileRange.minY\n );\n }\n}\n\n/**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n * @param {TileRange} [tileRange] TileRange.\n * @return {TileRange} Tile range.\n */\nexport function createOrUpdate(minX, maxX, minY, maxY, tileRange) {\n if (tileRange !== undefined) {\n tileRange.minX = minX;\n tileRange.maxX = maxX;\n tileRange.minY = minY;\n tileRange.maxY = maxY;\n return tileRange;\n }\n return new TileRange(minX, maxX, minY, maxY);\n}\n\nexport default TileRange;\n","/**\n * @module ol/VectorRenderTile\n */\nimport Tile from './Tile.js';\nimport {createCanvasContext2D, releaseCanvas} from './dom.js';\nimport {getUid} from './util.js';\n\n/**\n * @typedef {Object} ReplayState\n * @property {boolean} dirty Dirty.\n * @property {null|import(\"./render.js\").OrderFunction} renderedRenderOrder RenderedRenderOrder.\n * @property {number} renderedTileRevision RenderedTileRevision.\n * @property {number} renderedResolution RenderedResolution.\n * @property {number} renderedRevision RenderedRevision.\n * @property {number} renderedTileResolution RenderedTileResolution.\n * @property {number} renderedTileZ RenderedTileZ.\n */\n\n/**\n * @type {Array<HTMLCanvasElement>}\n */\nconst canvasPool = [];\n\nclass VectorRenderTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {import(\"./tilecoord.js\").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.\n * @param {function(VectorRenderTile):Array<import(\"./VectorTile\").default>} getSourceTiles Function.\n * @param {function(VectorRenderTile):void} removeSourceTiles Function.\n */\n constructor(\n tileCoord,\n state,\n urlTileCoord,\n getSourceTiles,\n removeSourceTiles,\n ) {\n super(tileCoord, state, {transition: 0});\n\n /**\n * @private\n * @type {CanvasRenderingContext2D|null}\n */\n this.context_ = null;\n\n /**\n * Executor groups. Read/written by the renderer.\n * @type {Object<string, Array<import(\"./render/canvas/ExecutorGroup.js\").default>>}\n */\n this.executorGroups = {};\n\n /**\n * Number of loading source tiles. Read/written by the source.\n * @type {number}\n */\n this.loadingSourceTiles = 0;\n\n /**\n * @type {Object<string, ImageData>}\n */\n this.hitDetectionImageData = {};\n\n /**\n * @private\n * @type {!Object<string, ReplayState>}\n */\n this.replayState_ = {};\n\n /**\n * @type {Array<import(\"./VectorTile.js\").default>}\n */\n this.sourceTiles = [];\n\n /**\n * @type {Object<string, boolean>}\n */\n this.errorTileKeys = {};\n\n /**\n * @type {number}\n */\n this.wantedResolution;\n\n /**\n * @type {!function():Array<import(\"./VectorTile.js\").default>}\n */\n this.getSourceTiles = getSourceTiles.bind(undefined, this);\n\n /**\n * @type {!function(VectorRenderTile):void}\n * @private\n */\n this.removeSourceTiles_ = removeSourceTiles;\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.wrappedTileCoord = urlTileCoord;\n }\n\n /**\n * @return {CanvasRenderingContext2D} The rendering context.\n */\n getContext() {\n if (!this.context_) {\n this.context_ = createCanvasContext2D(1, 1, canvasPool);\n }\n return this.context_;\n }\n\n /**\n * @return {boolean} Tile has a rendering context.\n */\n hasContext() {\n return !!this.context_;\n }\n\n /**\n * Get the Canvas for this tile.\n * @return {HTMLCanvasElement} Canvas.\n */\n getImage() {\n return this.hasContext() ? this.getContext().canvas : null;\n }\n\n /**\n * @param {import(\"./layer/Layer.js\").default} layer Layer.\n * @return {ReplayState} The replay state.\n */\n getReplayState(layer) {\n const key = getUid(layer);\n if (!(key in this.replayState_)) {\n this.replayState_[key] = {\n dirty: false,\n renderedRenderOrder: null,\n renderedResolution: NaN,\n renderedRevision: -1,\n renderedTileResolution: NaN,\n renderedTileRevision: -1,\n renderedTileZ: -1,\n };\n }\n return this.replayState_[key];\n }\n\n /**\n * Load the tile.\n * @override\n */\n load() {\n this.getSourceTiles();\n }\n\n /**\n * Remove from the cache due to expiry\n * @override\n */\n release() {\n if (this.context_) {\n releaseCanvas(this.context_);\n canvasPool.push(this.context_.canvas);\n this.context_ = null;\n }\n this.removeSourceTiles_(this);\n this.sourceTiles.length = 0;\n super.release();\n }\n}\n\nexport default VectorRenderTile;\n","/**\n * @module ol/net\n */\nimport {getUid} from './util.js';\n\n/**\n * Simple JSONP helper. Supports error callbacks and a custom callback param.\n * The error callback will be called when no JSONP is executed after 10 seconds.\n *\n * @param {string} url Request url. A 'callback' query parameter will be\n * appended.\n * @param {Function} callback Callback on success.\n * @param {Function} [errback] Callback on error.\n * @param {string} [callbackParam] Custom query parameter for the JSONP\n * callback. Default is 'callback'.\n */\nexport function jsonp(url, callback, errback, callbackParam) {\n const script = document.createElement('script');\n const key = 'olc_' + getUid(callback);\n function cleanup() {\n delete window[key];\n script.parentNode.removeChild(script);\n }\n script.async = true;\n script.src =\n url +\n (url.includes('?') ? '&' : '?') +\n (callbackParam || 'callback') +\n '=' +\n key;\n const timer = setTimeout(function () {\n cleanup();\n if (errback) {\n errback();\n }\n }, 10000);\n window[key] = function (data) {\n clearTimeout(timer);\n cleanup();\n callback(data);\n };\n document.head.appendChild(script);\n}\n\nexport class ResponseError extends Error {\n /**\n * @param {XMLHttpRequest} response The XHR object.\n */\n constructor(response) {\n const message = 'Unexpected response status: ' + response.status;\n super(message);\n\n /**\n * @type {string}\n */\n this.name = 'ResponseError';\n\n /**\n * @type {XMLHttpRequest}\n */\n this.response = response;\n }\n}\n\nexport class ClientError extends Error {\n /**\n * @param {XMLHttpRequest} client The XHR object.\n */\n constructor(client) {\n super('Failed to issue request');\n\n /**\n * @type {string}\n */\n this.name = 'ClientError';\n\n /**\n * @type {XMLHttpRequest}\n */\n this.client = client;\n }\n}\n\n/**\n * @param {string} url The URL.\n * @return {Promise<Object>} A promise that resolves to the JSON response.\n */\nexport function getJSON(url) {\n return new Promise(function (resolve, reject) {\n /**\n * @param {ProgressEvent<XMLHttpRequest>} event The load event.\n */\n function onLoad(event) {\n const client = event.target;\n // status will be 0 for file:// urls\n if (!client.status || (client.status >= 200 && client.status < 300)) {\n let data;\n try {\n data = JSON.parse(client.responseText);\n } catch (err) {\n const message = 'Error parsing response text as JSON: ' + err.message;\n reject(new Error(message));\n return;\n }\n resolve(data);\n return;\n }\n\n reject(new ResponseError(client));\n }\n\n /**\n * @param {ProgressEvent<XMLHttpRequest>} event The error event.\n */\n function onError(event) {\n reject(new ClientError(event.target));\n }\n\n const client = new XMLHttpRequest();\n client.addEventListener('load', onLoad);\n client.addEventListener('error', onError);\n client.open('GET', url);\n client.setRequestHeader('Accept', 'application/json');\n client.send();\n });\n}\n\n/**\n * @param {string} base The base URL.\n * @param {string} url The potentially relative URL.\n * @return {string} The full URL.\n */\nexport function resolveUrl(base, url) {\n if (url.includes('://')) {\n return url;\n }\n return new URL(url, base).href;\n}\n\nlet originalXHR;\nexport function overrideXHR(xhr) {\n if (typeof XMLHttpRequest !== 'undefined') {\n originalXHR = XMLHttpRequest;\n }\n global.XMLHttpRequest = xhr;\n}\n\nexport function restoreXHR() {\n global.XMLHttpRequest = originalXHR;\n}\n","/**\n * @module ol/VectorTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\n\n/**\n * @template {import('./Feature.js').FeatureLike} FeatureType\n */\nclass VectorTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Data source url.\n * @param {import(\"./format/Feature.js\").default<FeatureType>} format Feature format.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options} [options] Tile options.\n */\n constructor(tileCoord, state, src, format, tileLoadFunction, options) {\n super(tileCoord, state, options);\n\n /**\n * Extent of this tile; set by the source.\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = null;\n\n /**\n * @private\n * @type {import(\"./format/Feature.js\").default<FeatureType>}\n */\n this.format_ = format;\n\n /**\n * @private\n * @type {Array<FeatureType>}\n */\n this.features_ = null;\n\n /**\n * @private\n * @type {import(\"./featureloader.js\").FeatureLoader}\n */\n this.loader_;\n\n /**\n * Feature projection of this tile; set by the source.\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection = null;\n\n /**\n * Resolution of this tile; set by the source.\n * @type {number}\n */\n this.resolution;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n\n /**\n * @private\n * @type {string}\n */\n this.url_ = src;\n\n this.key = src;\n }\n\n /**\n * @return {string} Tile url.\n */\n getTileUrl() {\n return this.url_;\n }\n\n /**\n * Get the feature format assigned for reading this tile's features.\n * @return {import(\"./format/Feature.js\").default<FeatureType>} Feature format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * Get the features for this tile. Geometries will be in the view projection.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeatures() {\n return this.features_;\n }\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {\n if (this.state == TileState.IDLE) {\n this.setState(TileState.LOADING);\n this.tileLoadFunction_(this, this.url_);\n if (this.loader_) {\n this.loader_(this.extent, this.resolution, this.projection);\n }\n }\n }\n\n /**\n * Handler for successful tile load.\n * @param {Array<FeatureType>} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data projection.\n */\n onLoad(features, dataProjection) {\n this.setFeatures(features);\n }\n\n /**\n * Handler for tile load errors.\n */\n onError() {\n this.setState(TileState.ERROR);\n }\n\n /**\n * Function for use in a {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`.\n * Sets the features for the tile.\n * @param {Array<FeatureType>} features Features.\n * @api\n */\n setFeatures(features) {\n this.features_ = features;\n this.setState(TileState.LOADED);\n }\n\n /**\n * Set the feature loader for reading this tile's features.\n * @param {import(\"./featureloader.js\").FeatureLoader<FeatureType>} loader Feature loader.\n * @api\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n}\n\nexport default VectorTile;\n","/**\n * @module ol/featureloader\n */\n\n/**\n *\n * @type {boolean}\n * @private\n */\nlet withCredentials = false;\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * load features.\n *\n * This function takes up to 5 arguments. These are an {@link module:ol/extent~Extent} representing\n * the area to be loaded, a `{number}` representing the resolution (map units per pixel), a\n * {@link module:ol/proj/Projection~Projection} for the projection, an optional success callback that should get\n * the loaded features passed as an argument and an optional failure callback with no arguments. If\n * the callbacks are not used, the corresponding vector source will not fire `'featuresloadend'` and\n * `'featuresloaderror'` events. `this` within the function is bound to the\n * {@link module:ol/source/Vector~VectorSource} it's called from.\n *\n * The function is responsible for loading the features and adding them to the\n * source.\n *\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").FeatureLike]\n * @typedef {(\n * extent: import(\"./extent.js\").Extent,\n * resolution: number,\n * projection: import(\"./proj/Projection.js\").default,\n * success?: (features: Array<FeatureType>) => void,\n * failure?: () => void) => void} FeatureLoader\n * @api\n */\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * get the url to load features from.\n *\n * This function takes an {@link module:ol/extent~Extent} representing the area\n * to be loaded, a `{number}` representing the resolution (map units per pixel)\n * and an {@link module:ol/proj/Projection~Projection} for the projection as\n * arguments and returns a `{string}` representing the URL.\n * @typedef {function(import(\"./extent.js\").Extent, number, import(\"./proj/Projection.js\").default): string} FeatureUrlFunction\n * @api\n */\n\n/**\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").default]\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default<FeatureType>} format Feature format.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array<FeatureType>, import(\"./proj/Projection.js\").default): void} success Success\n * Function called with the loaded features and optionally with the data projection.\n * @param {function(): void} failure Failure\n * Function called when loading failed.\n */\nexport function loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n success,\n failure,\n) {\n const xhr = new XMLHttpRequest();\n xhr.open(\n 'GET',\n typeof url === 'function' ? url(extent, resolution, projection) : url,\n true,\n );\n if (format.getType() == 'arraybuffer') {\n xhr.responseType = 'arraybuffer';\n }\n xhr.withCredentials = withCredentials;\n /**\n * @param {Event} event Event.\n * @private\n */\n xhr.onload = function (event) {\n // status will be 0 for file:// urls\n if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {\n const type = format.getType();\n try {\n /** @type {Document|Node|Object|string|undefined} */\n let source;\n if (type == 'text' || type == 'json') {\n source = xhr.responseText;\n } else if (type == 'xml') {\n source = xhr.responseXML || xhr.responseText;\n } else if (type == 'arraybuffer') {\n source = /** @type {ArrayBuffer} */ (xhr.response);\n }\n if (source) {\n success(\n /** @type {Array<FeatureType>} */\n (\n format.readFeatures(source, {\n extent: extent,\n featureProjection: projection,\n })\n ),\n format.readProjection(source),\n );\n } else {\n failure();\n }\n } catch {\n failure();\n }\n } else {\n failure();\n }\n };\n /**\n * @private\n */\n xhr.onerror = failure;\n xhr.send();\n}\n\n/**\n * Create an XHR feature loader for a `url` and `format`. The feature loader\n * loads features (with XHR), parses the features, and adds them to the\n * vector source.\n *\n * @template {import(\"./Feature.js\").FeatureLike} [FeatureType=import(\"./Feature.js\").default]\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default<FeatureType>} format Feature format.\n * @return {FeatureLoader<FeatureType>} The feature loader.\n * @api\n */\nexport function xhr(url, format) {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array<FeatureType>): void} [success] Success\n * Function called when loading succeeded.\n * @param {function(): void} [failure] Failure\n * Function called when loading failed.\n * @this {import(\"./source/Vector.js\").default<FeatureType>}\n */\n return function (extent, resolution, projection, success, failure) {\n loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n /**\n * @param {Array<FeatureType>} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data\n * projection.\n */\n (features, dataProjection) => {\n this.addFeatures(features);\n if (success !== undefined) {\n success(features);\n }\n },\n () => {\n this.changed();\n if (failure !== undefined) {\n failure();\n }\n },\n );\n };\n}\n\n/**\n * Setter for the withCredentials configuration for the XHR.\n *\n * @param {boolean} xhrWithCredentials The value of withCredentials to set.\n * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/\n * @api\n */\nexport function setWithCredentials(xhrWithCredentials) {\n withCredentials = xhrWithCredentials;\n}\n","/**\n * @module ol/loadingstrategy\n */\n\nimport {fromUserExtent, fromUserResolution, toUserExtent} from './proj.js';\n\n/**\n * Strategy function for loading all features with a single request.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n * @api\n */\nexport function all(extent, resolution) {\n return [[-Infinity, -Infinity, Infinity, Infinity]];\n}\n\n/**\n * Strategy function for loading features based on the view's extent and\n * resolution.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n * @api\n */\nexport function bbox(extent, resolution) {\n return [extent];\n}\n\n/**\n * Creates a strategy function for loading features based on a tile grid.\n * @param {import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {function(import(\"./extent.js\").Extent, number, import(\"./proj.js\").Projection): Array<import(\"./extent.js\").Extent>} Loading strategy.\n * @api\n */\nexport function tile(tileGrid) {\n return (\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj.js\").Projection} projection Projection.\n * @return {Array<import(\"./extent.js\").Extent>} Extents.\n */\n function (extent, resolution, projection) {\n const z = tileGrid.getZForResolution(\n fromUserResolution(resolution, projection),\n );\n const tileRange = tileGrid.getTileRangeForExtentAndZ(\n fromUserExtent(extent, projection),\n z,\n );\n /** @type {Array<import(\"./extent.js\").Extent>} */\n const extents = [];\n /** @type {import(\"./tilecoord.js\").TileCoord} */\n const tileCoord = [z, 0, 0];\n for (\n tileCoord[1] = tileRange.minX;\n tileCoord[1] <= tileRange.maxX;\n ++tileCoord[1]\n ) {\n for (\n tileCoord[2] = tileRange.minY;\n tileCoord[2] <= tileRange.maxY;\n ++tileCoord[2]\n ) {\n extents.push(\n toUserExtent(tileGrid.getTileCoordExtent(tileCoord), projection),\n );\n }\n }\n return extents;\n }\n );\n}\n","/**\n * @module ol/render/VectorContext\n */\n\n/**\n * @classdesc\n * Context for drawing geometries. A vector context is available on render\n * events and does not need to be constructed directly.\n * @api\n */\nclass VectorContext {\n /**\n * Render a geometry with a custom renderer.\n *\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {Function} renderer Renderer.\n * @param {Function} hitDetectionRenderer Renderer.\n * @param {number} [index] Render order index.\n */\n drawCustom(geometry, feature, renderer, hitDetectionRenderer, index) {}\n\n /**\n * Render a geometry.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry The geometry to render.\n */\n drawGeometry(geometry) {}\n\n /**\n * Set the rendering style.\n *\n * @param {import(\"../style/Style.js\").default} style The rendering style.\n */\n setStyle(style) {}\n\n /**\n * @param {import(\"../geom/Circle.js\").default} circleGeometry Circle geometry.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawCircle(circleGeometry, feature, index) {}\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} [index] Render order index.\n */\n drawFeature(feature, style, index) {}\n\n /**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometryCollectionGeometry Geometry collection.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawGeometryCollection(geometryCollectionGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/LineString.js\").default|import(\"./Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawLineString(lineStringGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiLineString.js\").default|import(\"./Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiLineString(multiLineStringGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiPoint.js\").default|import(\"./Feature.js\").default} multiPointGeometry MultiPoint geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiPoint(multiPointGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/MultiPolygon.js\").default} multiPolygonGeometry MultiPolygon geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawMultiPolygon(multiPolygonGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/Point.js\").default|import(\"./Feature.js\").default} pointGeometry Point geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawPoint(pointGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/Polygon.js\").default|import(\"./Feature.js\").default} polygonGeometry Polygon geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawPolygon(polygonGeometry, feature, index) {}\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default|import(\"./Feature.js\").default} geometry Geometry.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\n drawText(geometry, feature, index) {}\n\n /**\n * @param {import(\"../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../style/Stroke.js\").default} strokeStyle Stroke style.\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {}\n\n /**\n * @param {import(\"../style/Image.js\").default} imageStyle Image style.\n * @param {import(\"../render/canvas.js\").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with a text style.\n */\n setImageStyle(imageStyle, declutterImageWithText) {}\n\n /**\n * @param {import(\"../style/Text.js\").default} textStyle Text style.\n * @param {import(\"../render/canvas.js\").DeclutterImageWithText} [declutterImageWithText] Shared data for combined decluttering with an image style.\n */\n setTextStyle(textStyle, declutterImageWithText) {}\n}\n\nexport default VectorContext;\n","/**\n * @module ol/render/canvas/Immediate\n */\n// FIXME test, especially polygons with holes and multipolygons\n// FIXME need to handle large thick features (where pixel size matters)\n// FIXME add offset and end to ol/geom/flat/transform~transform2D?\n\nimport {equals} from '../../array.js';\nimport {asColorLike} from '../../colorlike.js';\nimport {intersects} from '../../extent.js';\nimport {transformGeom2D} from '../../geom/SimpleGeometry.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {toFixed} from '../../math.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport VectorContext from '../VectorContext.js';\nimport {\n defaultFillStyle,\n defaultFont,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n defaultTextAlign,\n defaultTextBaseline,\n} from '../canvas.js';\n\n/**\n * @classdesc\n * A concrete subclass of {@link module:ol/render/VectorContext~VectorContext} that implements\n * direct rendering of features and geometries to an HTML5 Canvas context.\n * Instances of this class are created internally by the library and\n * provided to application code as vectorContext member of the\n * {@link module:ol/render/Event~RenderEvent} object associated with postcompose, precompose and\n * render events emitted by layers and maps.\n */\nclass CanvasImmediateRenderer extends VectorContext {\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {number} [squaredTolerance] Optional squared tolerance for simplification.\n * @param {import(\"../../proj.js\").TransformFunction} [userTransform] Transform from user to view projection.\n */\n constructor(\n context,\n pixelRatio,\n extent,\n transform,\n viewRotation,\n squaredTolerance,\n userTransform,\n ) {\n super();\n\n /**\n * @private\n * @type {CanvasRenderingContext2D}\n */\n this.context_ = context;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.extent_ = extent;\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.transform_ = transform;\n\n /**\n * @private\n * @type {number}\n */\n this.transformRotation_ = transform\n ? toFixed(Math.atan2(transform[1], transform[0]), 10)\n : 0;\n\n /**\n * @private\n * @type {number}\n */\n this.viewRotation_ = viewRotation;\n\n /**\n * @private\n * @type {number}\n */\n this.squaredTolerance_ = squaredTolerance;\n\n /**\n * @private\n * @type {import(\"../../proj.js\").TransformFunction}\n */\n this.userTransform_ = userTransform;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.contextFillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.contextStrokeState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").TextState}\n */\n this.contextTextState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.fillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.strokeState_ = null;\n\n /**\n * @private\n * @type {import('../../DataTile.js').ImageLike}\n */\n this.image_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.imageAnchorX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageAnchorY_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageHeight_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOpacity_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOriginX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.imageOriginY_ = 0;\n\n /**\n * @private\n * @type {boolean}\n */\n this.imageRotateWithView_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.imageRotation_ = 0;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size}\n */\n this.imageScale_ = [0, 0];\n\n /**\n * @private\n * @type {number}\n */\n this.imageWidth_ = 0;\n\n /**\n * @private\n * @type {string}\n */\n this.text_ = '';\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetY_ = 0;\n\n /**\n * @private\n * @type {boolean}\n */\n this.textRotateWithView_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.textRotation_ = 0;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size}\n */\n this.textScale_ = [0, 0];\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.textFillState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.textStrokeState_ = null;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").TextState}\n */\n this.textState_ = null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.pixelCoordinates_ = [];\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.tmpLocalTransform_ = createTransform();\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n */\n drawImages_(flatCoordinates, offset, end, stride) {\n if (!this.image_) {\n return;\n }\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_,\n );\n const context = this.context_;\n const localTransform = this.tmpLocalTransform_;\n const alpha = context.globalAlpha;\n if (this.imageOpacity_ != 1) {\n context.globalAlpha = alpha * this.imageOpacity_;\n }\n let rotation = this.imageRotation_;\n if (this.transformRotation_ === 0) {\n rotation -= this.viewRotation_;\n }\n if (this.imageRotateWithView_) {\n rotation += this.viewRotation_;\n }\n for (let i = 0, ii = pixelCoordinates.length; i < ii; i += 2) {\n const x = pixelCoordinates[i] - this.imageAnchorX_;\n const y = pixelCoordinates[i + 1] - this.imageAnchorY_;\n if (\n rotation !== 0 ||\n this.imageScale_[0] != 1 ||\n this.imageScale_[1] != 1\n ) {\n const centerX = x + this.imageAnchorX_;\n const centerY = y + this.imageAnchorY_;\n composeTransform(\n localTransform,\n centerX,\n centerY,\n 1,\n 1,\n rotation,\n -centerX,\n -centerY,\n );\n context.save();\n context.transform.apply(context, localTransform);\n context.translate(centerX, centerY);\n context.scale(this.imageScale_[0], this.imageScale_[1]);\n context.drawImage(\n this.image_,\n this.imageOriginX_,\n this.imageOriginY_,\n this.imageWidth_,\n this.imageHeight_,\n -this.imageAnchorX_,\n -this.imageAnchorY_,\n this.imageWidth_,\n this.imageHeight_,\n );\n context.restore();\n } else {\n context.drawImage(\n this.image_,\n this.imageOriginX_,\n this.imageOriginY_,\n this.imageWidth_,\n this.imageHeight_,\n x,\n y,\n this.imageWidth_,\n this.imageHeight_,\n );\n }\n }\n if (this.imageOpacity_ != 1) {\n context.globalAlpha = alpha;\n }\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n */\n drawText_(flatCoordinates, offset, end, stride) {\n if (!this.textState_ || this.text_ === '') {\n return;\n }\n if (this.textFillState_) {\n this.setContextFillState_(this.textFillState_);\n }\n if (this.textStrokeState_) {\n this.setContextStrokeState_(this.textStrokeState_);\n }\n this.setContextTextState_(this.textState_);\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_,\n );\n const context = this.context_;\n let rotation = this.textRotation_;\n if (this.transformRotation_ === 0) {\n rotation -= this.viewRotation_;\n }\n if (this.textRotateWithView_) {\n rotation += this.viewRotation_;\n }\n for (; offset < end; offset += stride) {\n const x = pixelCoordinates[offset] + this.textOffsetX_;\n const y = pixelCoordinates[offset + 1] + this.textOffsetY_;\n if (\n rotation !== 0 ||\n this.textScale_[0] != 1 ||\n this.textScale_[1] != 1\n ) {\n context.save();\n context.translate(x - this.textOffsetX_, y - this.textOffsetY_);\n context.rotate(rotation);\n context.translate(this.textOffsetX_, this.textOffsetY_);\n context.scale(this.textScale_[0], this.textScale_[1]);\n if (this.textStrokeState_) {\n context.strokeText(this.text_, 0, 0);\n }\n if (this.textFillState_) {\n context.fillText(this.text_, 0, 0);\n }\n context.restore();\n } else {\n if (this.textStrokeState_) {\n context.strokeText(this.text_, x, y);\n }\n if (this.textFillState_) {\n context.fillText(this.text_, x, y);\n }\n }\n }\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {boolean} close Close.\n * @private\n * @return {number} end End.\n */\n moveToLineTo_(flatCoordinates, offset, end, stride, close) {\n const context = this.context_;\n const pixelCoordinates = transform2D(\n flatCoordinates,\n offset,\n end,\n stride,\n this.transform_,\n this.pixelCoordinates_,\n );\n context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);\n let length = pixelCoordinates.length;\n if (close) {\n length -= 2;\n }\n for (let i = 2; i < length; i += 2) {\n context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]);\n }\n if (close) {\n context.closePath();\n }\n return end;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @private\n * @return {number} End.\n */\n drawRings_(flatCoordinates, offset, ends, stride) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.moveToLineTo_(\n flatCoordinates,\n offset,\n ends[i],\n stride,\n true,\n );\n }\n return offset;\n }\n\n /**\n * Render a circle geometry into the canvas. Rendering is immediate and uses\n * the current fill and stroke styles.\n *\n * @param {import(\"../../geom/Circle.js\").default} geometry Circle geometry.\n * @api\n * @override\n */\n drawCircle(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Circle.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.fillState_ || this.strokeState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const pixelCoordinates = transformGeom2D(\n geometry,\n this.transform_,\n this.pixelCoordinates_,\n );\n const dx = pixelCoordinates[2] - pixelCoordinates[0];\n const dy = pixelCoordinates[3] - pixelCoordinates[1];\n const radius = Math.sqrt(dx * dx + dy * dy);\n const context = this.context_;\n context.beginPath();\n context.arc(\n pixelCoordinates[0],\n pixelCoordinates[1],\n radius,\n 0,\n 2 * Math.PI,\n );\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n this.drawText_(geometry.getCenter(), 0, 2, 2);\n }\n }\n\n /**\n * Set the rendering style. Note that since this is an immediate rendering API,\n * any `zIndex` on the provided style will be ignored.\n *\n * @param {import(\"../../style/Style.js\").default} style The rendering style.\n * @api\n * @override\n */\n setStyle(style) {\n this.setFillStrokeStyle(style.getFill(), style.getStroke());\n this.setImageStyle(style.getImage());\n this.setTextStyle(style.getText());\n }\n\n /**\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n */\n setTransform(transform) {\n this.transform_ = transform;\n }\n\n /**\n * Render a geometry into the canvas. Call\n * {@link module:ol/render/canvas/Immediate~CanvasImmediateRenderer#setStyle renderer.setStyle()} first to set the rendering style.\n *\n * @param {import(\"../../geom/Geometry.js\").default|import(\"../Feature.js\").default} geometry The geometry to render.\n * @api\n * @override\n */\n drawGeometry(geometry) {\n const type = geometry.getType();\n switch (type) {\n case 'Point':\n this.drawPoint(\n /** @type {import(\"../../geom/Point.js\").default} */ (geometry),\n );\n break;\n case 'LineString':\n this.drawLineString(\n /** @type {import(\"../../geom/LineString.js\").default} */ (geometry),\n );\n break;\n case 'Polygon':\n this.drawPolygon(\n /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry),\n );\n break;\n case 'MultiPoint':\n this.drawMultiPoint(\n /** @type {import(\"../../geom/MultiPoint.js\").default} */ (geometry),\n );\n break;\n case 'MultiLineString':\n this.drawMultiLineString(\n /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ),\n );\n break;\n case 'MultiPolygon':\n this.drawMultiPolygon(\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ),\n );\n break;\n case 'GeometryCollection':\n this.drawGeometryCollection(\n /** @type {import(\"../../geom/GeometryCollection.js\").default} */ (\n geometry\n ),\n );\n break;\n case 'Circle':\n this.drawCircle(\n /** @type {import(\"../../geom/Circle.js\").default} */ (geometry),\n );\n break;\n default:\n }\n }\n\n /**\n * Render a feature into the canvas. Note that any `zIndex` on the provided\n * style will be ignored - features are rendered immediately in the order that\n * this method is called. If you need `zIndex` support, you should be using an\n * {@link module:ol/layer/Vector~VectorLayer} instead.\n *\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {import(\"../../style/Style.js\").default} style Style.\n * @api\n * @override\n */\n drawFeature(feature, style) {\n const geometry = style.getGeometryFunction()(feature);\n if (!geometry) {\n return;\n }\n this.setStyle(style);\n this.drawGeometry(geometry);\n }\n\n /**\n * Render a GeometryCollection to the canvas. Rendering is immediate and\n * uses the current styles appropriate for each geometry in the collection.\n *\n * @param {import(\"../../geom/GeometryCollection.js\").default} geometry Geometry collection.\n * @override\n */\n drawGeometryCollection(geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n this.drawGeometry(geometries[i]);\n }\n }\n\n /**\n * Render a Point geometry into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/Point.js\").default|import(\"../Feature.js\").default} geometry Point geometry.\n * @override\n */\n drawPoint(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Point.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n const flatCoordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n if (this.image_) {\n this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n if (this.text_ !== '') {\n this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n }\n\n /**\n * Render a MultiPoint geometry into the canvas. Rendering is immediate and\n * uses the current style.\n *\n * @param {import(\"../../geom/MultiPoint.js\").default|import(\"../Feature.js\").default} geometry MultiPoint geometry.\n * @override\n */\n drawMultiPoint(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/MultiPoint.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n const flatCoordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n if (this.image_) {\n this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n if (this.text_ !== '') {\n this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);\n }\n }\n\n /**\n * Render a LineString into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/LineString.js\").default|import(\"../Feature.js\").default} geometry LineString geometry.\n * @override\n */\n drawLineString(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/LineString.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n const context = this.context_;\n const flatCoordinates = geometry.getFlatCoordinates();\n context.beginPath();\n this.moveToLineTo_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n geometry.getStride(),\n false,\n );\n context.stroke();\n }\n if (this.text_ !== '') {\n const flatMidpoint = geometry.getFlatMidpoint();\n this.drawText_(flatMidpoint, 0, 2, 2);\n }\n }\n\n /**\n * Render a MultiLineString geometry into the canvas. Rendering is immediate\n * and uses the current style.\n *\n * @param {import(\"../../geom/MultiLineString.js\").default|import(\"../Feature.js\").default} geometry MultiLineString geometry.\n * @override\n */\n drawMultiLineString(geometry) {\n if (this.squaredTolerance_) {\n geometry =\n /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n const geometryExtent = geometry.getExtent();\n if (!intersects(this.extent_, geometryExtent)) {\n return;\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n const context = this.context_;\n const flatCoordinates = geometry.getFlatCoordinates();\n let offset = 0;\n const ends = /** @type {Array<number>} */ (geometry.getEnds());\n const stride = geometry.getStride();\n context.beginPath();\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.moveToLineTo_(\n flatCoordinates,\n offset,\n ends[i],\n stride,\n false,\n );\n }\n context.stroke();\n }\n if (this.text_ !== '') {\n const flatMidpoints = geometry.getFlatMidpoints();\n this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2);\n }\n }\n\n /**\n * Render a Polygon geometry into the canvas. Rendering is immediate and uses\n * the current style.\n *\n * @param {import(\"../../geom/Polygon.js\").default|import(\"../Feature.js\").default} geometry Polygon geometry.\n * @override\n */\n drawPolygon(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/Polygon.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_ || this.fillState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const context = this.context_;\n context.beginPath();\n this.drawRings_(\n geometry.getOrientedFlatCoordinates(),\n 0,\n /** @type {Array<number>} */ (geometry.getEnds()),\n geometry.getStride(),\n );\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n const flatInteriorPoint = geometry.getFlatInteriorPoint();\n this.drawText_(flatInteriorPoint, 0, 2, 2);\n }\n }\n\n /**\n * Render MultiPolygon geometry into the canvas. Rendering is immediate and\n * uses the current style.\n * @param {import(\"../../geom/MultiPolygon.js\").default} geometry MultiPolygon geometry.\n * @override\n */\n drawMultiPolygon(geometry) {\n if (this.squaredTolerance_) {\n geometry = /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry.simplifyTransformed(\n this.squaredTolerance_,\n this.userTransform_,\n )\n );\n }\n if (!intersects(this.extent_, geometry.getExtent())) {\n return;\n }\n if (this.strokeState_ || this.fillState_) {\n if (this.fillState_) {\n this.setContextFillState_(this.fillState_);\n }\n if (this.strokeState_) {\n this.setContextStrokeState_(this.strokeState_);\n }\n const context = this.context_;\n const flatCoordinates = geometry.getOrientedFlatCoordinates();\n let offset = 0;\n const endss = geometry.getEndss();\n const stride = geometry.getStride();\n context.beginPath();\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n offset = this.drawRings_(flatCoordinates, offset, ends, stride);\n }\n if (this.fillState_) {\n context.fill();\n }\n if (this.strokeState_) {\n context.stroke();\n }\n }\n if (this.text_ !== '') {\n const flatInteriorPoints = geometry.getFlatInteriorPoints();\n this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2);\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").FillState} fillState Fill state.\n * @private\n */\n setContextFillState_(fillState) {\n const context = this.context_;\n const contextFillState = this.contextFillState_;\n if (!contextFillState) {\n context.fillStyle = fillState.fillStyle;\n this.contextFillState_ = {\n fillStyle: fillState.fillStyle,\n };\n } else {\n if (contextFillState.fillStyle != fillState.fillStyle) {\n contextFillState.fillStyle = fillState.fillStyle;\n context.fillStyle = fillState.fillStyle;\n }\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").StrokeState} strokeState Stroke state.\n * @private\n */\n setContextStrokeState_(strokeState) {\n const context = this.context_;\n const contextStrokeState = this.contextStrokeState_;\n if (!contextStrokeState) {\n context.lineCap = strokeState.lineCap;\n context.setLineDash(strokeState.lineDash);\n context.lineDashOffset = strokeState.lineDashOffset;\n context.lineJoin = strokeState.lineJoin;\n context.lineWidth = strokeState.lineWidth;\n context.miterLimit = strokeState.miterLimit;\n context.strokeStyle = strokeState.strokeStyle;\n this.contextStrokeState_ = {\n lineCap: strokeState.lineCap,\n lineDash: strokeState.lineDash,\n lineDashOffset: strokeState.lineDashOffset,\n lineJoin: strokeState.lineJoin,\n lineWidth: strokeState.lineWidth,\n miterLimit: strokeState.miterLimit,\n strokeStyle: strokeState.strokeStyle,\n };\n } else {\n if (contextStrokeState.lineCap != strokeState.lineCap) {\n contextStrokeState.lineCap = strokeState.lineCap;\n context.lineCap = strokeState.lineCap;\n }\n if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {\n context.setLineDash(\n (contextStrokeState.lineDash = strokeState.lineDash),\n );\n }\n if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {\n contextStrokeState.lineDashOffset = strokeState.lineDashOffset;\n context.lineDashOffset = strokeState.lineDashOffset;\n }\n if (contextStrokeState.lineJoin != strokeState.lineJoin) {\n contextStrokeState.lineJoin = strokeState.lineJoin;\n context.lineJoin = strokeState.lineJoin;\n }\n if (contextStrokeState.lineWidth != strokeState.lineWidth) {\n contextStrokeState.lineWidth = strokeState.lineWidth;\n context.lineWidth = strokeState.lineWidth;\n }\n if (contextStrokeState.miterLimit != strokeState.miterLimit) {\n contextStrokeState.miterLimit = strokeState.miterLimit;\n context.miterLimit = strokeState.miterLimit;\n }\n if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {\n contextStrokeState.strokeStyle = strokeState.strokeStyle;\n context.strokeStyle = strokeState.strokeStyle;\n }\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").TextState} textState Text state.\n * @private\n */\n setContextTextState_(textState) {\n const context = this.context_;\n const contextTextState = this.contextTextState_;\n const textAlign = textState.textAlign\n ? textState.textAlign\n : defaultTextAlign;\n if (!contextTextState) {\n context.font = textState.font;\n context.textAlign = textAlign;\n context.textBaseline = textState.textBaseline;\n this.contextTextState_ = {\n font: textState.font,\n textAlign: textAlign,\n textBaseline: textState.textBaseline,\n };\n } else {\n if (contextTextState.font != textState.font) {\n contextTextState.font = textState.font;\n context.font = textState.font;\n }\n if (contextTextState.textAlign != textAlign) {\n contextTextState.textAlign = textAlign;\n context.textAlign = textAlign;\n }\n if (contextTextState.textBaseline != textState.textBaseline) {\n contextTextState.textBaseline = textState.textBaseline;\n context.textBaseline = textState.textBaseline;\n }\n }\n }\n\n /**\n * Set the fill and stroke style for subsequent draw operations. To clear\n * either fill or stroke styles, pass null for the appropriate parameter.\n *\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n * @override\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {\n if (!fillStyle) {\n this.fillState_ = null;\n } else {\n const fillStyleColor = fillStyle.getColor();\n this.fillState_ = {\n fillStyle: asColorLike(\n fillStyleColor ? fillStyleColor : defaultFillStyle,\n ),\n };\n }\n if (!strokeStyle) {\n this.strokeState_ = null;\n } else {\n const strokeStyleColor = strokeStyle.getColor();\n const strokeStyleLineCap = strokeStyle.getLineCap();\n const strokeStyleLineDash = strokeStyle.getLineDash();\n const strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();\n const strokeStyleLineJoin = strokeStyle.getLineJoin();\n const strokeStyleWidth = strokeStyle.getWidth();\n const strokeStyleMiterLimit = strokeStyle.getMiterLimit();\n const lineDash = strokeStyleLineDash\n ? strokeStyleLineDash\n : defaultLineDash;\n this.strokeState_ = {\n lineCap:\n strokeStyleLineCap !== undefined\n ? strokeStyleLineCap\n : defaultLineCap,\n lineDash:\n this.pixelRatio_ === 1\n ? lineDash\n : lineDash.map((n) => n * this.pixelRatio_),\n lineDashOffset:\n (strokeStyleLineDashOffset\n ? strokeStyleLineDashOffset\n : defaultLineDashOffset) * this.pixelRatio_,\n lineJoin:\n strokeStyleLineJoin !== undefined\n ? strokeStyleLineJoin\n : defaultLineJoin,\n lineWidth:\n (strokeStyleWidth !== undefined\n ? strokeStyleWidth\n : defaultLineWidth) * this.pixelRatio_,\n miterLimit:\n strokeStyleMiterLimit !== undefined\n ? strokeStyleMiterLimit\n : defaultMiterLimit,\n strokeStyle: asColorLike(\n strokeStyleColor ? strokeStyleColor : defaultStrokeStyle,\n ),\n };\n }\n }\n\n /**\n * Set the image style for subsequent draw operations. Pass null to remove\n * the image style.\n *\n * @param {import(\"../../style/Image.js\").default} imageStyle Image style.\n * @override\n */\n setImageStyle(imageStyle) {\n let imageSize;\n if (!imageStyle || !(imageSize = imageStyle.getSize())) {\n this.image_ = null;\n return;\n }\n const imagePixelRatio = imageStyle.getPixelRatio(this.pixelRatio_);\n const imageAnchor = imageStyle.getAnchor();\n const imageOrigin = imageStyle.getOrigin();\n this.image_ = imageStyle.getImage(this.pixelRatio_);\n this.imageAnchorX_ = imageAnchor[0] * imagePixelRatio;\n this.imageAnchorY_ = imageAnchor[1] * imagePixelRatio;\n this.imageHeight_ = imageSize[1] * imagePixelRatio;\n this.imageOpacity_ = imageStyle.getOpacity();\n this.imageOriginX_ = imageOrigin[0];\n this.imageOriginY_ = imageOrigin[1];\n this.imageRotateWithView_ = imageStyle.getRotateWithView();\n this.imageRotation_ = imageStyle.getRotation();\n const imageScale = imageStyle.getScaleArray();\n this.imageScale_ = [\n (imageScale[0] * this.pixelRatio_) / imagePixelRatio,\n (imageScale[1] * this.pixelRatio_) / imagePixelRatio,\n ];\n this.imageWidth_ = imageSize[0] * imagePixelRatio;\n }\n\n /**\n * Set the text style for subsequent draw operations. Pass null to\n * remove the text style.\n *\n * @param {import(\"../../style/Text.js\").default} textStyle Text style.\n * @override\n */\n setTextStyle(textStyle) {\n if (!textStyle) {\n this.text_ = '';\n } else {\n const textFillStyle = textStyle.getFill();\n if (!textFillStyle) {\n this.textFillState_ = null;\n } else {\n const textFillStyleColor = textFillStyle.getColor();\n this.textFillState_ = {\n fillStyle: asColorLike(\n textFillStyleColor ? textFillStyleColor : defaultFillStyle,\n ),\n };\n }\n const textStrokeStyle = textStyle.getStroke();\n if (!textStrokeStyle) {\n this.textStrokeState_ = null;\n } else {\n const textStrokeStyleColor = textStrokeStyle.getColor();\n const textStrokeStyleLineCap = textStrokeStyle.getLineCap();\n const textStrokeStyleLineDash = textStrokeStyle.getLineDash();\n const textStrokeStyleLineDashOffset =\n textStrokeStyle.getLineDashOffset();\n const textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();\n const textStrokeStyleWidth = textStrokeStyle.getWidth();\n const textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();\n this.textStrokeState_ = {\n lineCap:\n textStrokeStyleLineCap !== undefined\n ? textStrokeStyleLineCap\n : defaultLineCap,\n lineDash: textStrokeStyleLineDash\n ? textStrokeStyleLineDash\n : defaultLineDash,\n lineDashOffset: textStrokeStyleLineDashOffset\n ? textStrokeStyleLineDashOffset\n : defaultLineDashOffset,\n lineJoin:\n textStrokeStyleLineJoin !== undefined\n ? textStrokeStyleLineJoin\n : defaultLineJoin,\n lineWidth:\n textStrokeStyleWidth !== undefined\n ? textStrokeStyleWidth\n : defaultLineWidth,\n miterLimit:\n textStrokeStyleMiterLimit !== undefined\n ? textStrokeStyleMiterLimit\n : defaultMiterLimit,\n strokeStyle: asColorLike(\n textStrokeStyleColor ? textStrokeStyleColor : defaultStrokeStyle,\n ),\n };\n }\n const textFont = textStyle.getFont();\n const textOffsetX = textStyle.getOffsetX();\n const textOffsetY = textStyle.getOffsetY();\n const textRotateWithView = textStyle.getRotateWithView();\n const textRotation = textStyle.getRotation();\n const textScale = textStyle.getScaleArray();\n const textText = textStyle.getText();\n const textTextAlign = textStyle.getTextAlign();\n const textTextBaseline = textStyle.getTextBaseline();\n this.textState_ = {\n font: textFont !== undefined ? textFont : defaultFont,\n textAlign:\n textTextAlign !== undefined ? textTextAlign : defaultTextAlign,\n textBaseline:\n textTextBaseline !== undefined\n ? textTextBaseline\n : defaultTextBaseline,\n };\n this.text_ =\n textText !== undefined\n ? Array.isArray(textText)\n ? textText.reduce((acc, t, i) => (acc += i % 2 ? ' ' : t), '')\n : textText\n : '';\n this.textOffsetX_ =\n textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0;\n this.textOffsetY_ =\n textOffsetY !== undefined ? this.pixelRatio_ * textOffsetY : 0;\n this.textRotateWithView_ =\n textRotateWithView !== undefined ? textRotateWithView : false;\n this.textRotation_ = textRotation !== undefined ? textRotation : 0;\n this.textScale_ = [\n this.pixelRatio_ * textScale[0],\n this.pixelRatio_ * textScale[1],\n ];\n }\n }\n}\n\nexport default CanvasImmediateRenderer;\n","/**\n * @module ol/renderer/vector\n */\nimport ImageState from '../ImageState.js';\nimport {getUid} from '../util.js';\n\n/**\n * Feature callback. The callback will be called with three arguments. The first\n * argument is one {@link module:ol/Feature~Feature feature} or {@link module:ol/render/Feature~RenderFeature render feature}\n * at the pixel, the second is the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for\n * unmanaged layers. The third is the {@link module:ol/geom/SimpleGeometry~SimpleGeometry} of the feature. For features\n * with a GeometryCollection geometry, it will be the first detected geometry from the collection.\n * @template T\n * @typedef {function(import(\"../Feature.js\").FeatureLike, import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>, import(\"../geom/SimpleGeometry.js\").default): T} FeatureCallback\n */\n\n/**\n * Tolerance for geometry simplification in device pixels.\n * @type {number}\n */\nconst SIMPLIFY_TOLERANCE = 0.5;\n\n/**\n * @const\n * @type {Object<import(\"../geom/Geometry.js\").Type,\n * function(import(\"../render/canvas/BuilderGroup.js\").default, import(\"../geom/Geometry.js\").default,\n * import(\"../style/Style.js\").default, Object): void>}\n */\nconst GEOMETRY_RENDERERS = {\n 'Point': renderPointGeometry,\n 'LineString': renderLineStringGeometry,\n 'Polygon': renderPolygonGeometry,\n 'MultiPoint': renderMultiPointGeometry,\n 'MultiLineString': renderMultiLineStringGeometry,\n 'MultiPolygon': renderMultiPolygonGeometry,\n 'GeometryCollection': renderGeometryCollectionGeometry,\n 'Circle': renderCircleGeometry,\n};\n\n/**\n * @param {import(\"../Feature.js\").FeatureLike} feature1 Feature 1.\n * @param {import(\"../Feature.js\").FeatureLike} feature2 Feature 2.\n * @return {number} Order.\n */\nexport function defaultOrder(feature1, feature2) {\n return parseInt(getUid(feature1), 10) - parseInt(getUid(feature2), 10);\n}\n\n/**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Squared pixel tolerance.\n */\nexport function getSquaredTolerance(resolution, pixelRatio) {\n const tolerance = getTolerance(resolution, pixelRatio);\n return tolerance * tolerance;\n}\n\n/**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Pixel tolerance.\n */\nexport function getTolerance(resolution, pixelRatio) {\n return (SIMPLIFY_TOLERANCE * resolution) / pixelRatio;\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Builder group.\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderCircleGeometry(builderGroup, geometry, style, feature, index) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (fillStyle || strokeStyle) {\n const circleReplay = builderGroup.getBuilder(style.getZIndex(), 'Circle');\n circleReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n circleReplay.drawCircle(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {function(import(\"../events/Event.js\").default): void} listener Listener function.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Transform from user to view projection.\n * @param {boolean} [declutter] Enable decluttering.\n * @param {number} [index] Render order index..\n * @return {boolean} `true` if style is loading.\n */\nexport function renderFeature(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n listener,\n transform,\n declutter,\n index,\n) {\n const loadingPromises = [];\n const imageStyle = style.getImage();\n if (imageStyle) {\n let loading = true;\n const imageState = imageStyle.getImageState();\n if (imageState == ImageState.LOADED || imageState == ImageState.ERROR) {\n loading = false;\n } else {\n if (imageState == ImageState.IDLE) {\n imageStyle.load();\n }\n }\n if (loading) {\n loadingPromises.push(imageStyle.ready());\n }\n }\n const fillStyle = style.getFill();\n if (fillStyle && fillStyle.loading()) {\n loadingPromises.push(fillStyle.ready());\n }\n const loading = loadingPromises.length > 0;\n if (loading) {\n Promise.all(loadingPromises).then(() => listener(null));\n }\n renderFeatureInternal(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n transform,\n declutter,\n index,\n );\n\n return loading;\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @param {boolean} [declutter] Enable decluttering.\n * @param {number} [index] Render order index..\n */\nfunction renderFeatureInternal(\n replayGroup,\n feature,\n style,\n squaredTolerance,\n transform,\n declutter,\n index,\n) {\n const geometry = style.getGeometryFunction()(feature);\n if (!geometry) {\n return;\n }\n const simplifiedGeometry = geometry.simplifyTransformed(\n squaredTolerance,\n transform,\n );\n const renderer = style.getRenderer();\n if (renderer) {\n renderGeometry(replayGroup, simplifiedGeometry, style, feature, index);\n } else {\n const geometryRenderer = GEOMETRY_RENDERERS[simplifiedGeometry.getType()];\n geometryRenderer(\n replayGroup,\n simplifiedGeometry,\n style,\n feature,\n index,\n declutter,\n );\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../geom/Geometry.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderGeometry(replayGroup, geometry, style, feature, index) {\n if (geometry.getType() == 'GeometryCollection') {\n const geometries =\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometries();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n renderGeometry(replayGroup, geometries[i], style, feature, index);\n }\n return;\n }\n const replay = replayGroup.getBuilder(style.getZIndex(), 'Default');\n replay.drawCustom(\n /** @type {import(\"../geom/SimpleGeometry.js\").default} */ (geometry),\n feature,\n style.getRenderer(),\n style.getHitDetectionRenderer(),\n index,\n );\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} replayGroup Replay group.\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} [declutterBuilderGroup] Builder for decluttering.\n * @param {number} [index] Render order index.\n */\nfunction renderGeometryCollectionGeometry(\n replayGroup,\n geometry,\n style,\n feature,\n declutterBuilderGroup,\n index,\n) {\n const geometries = geometry.getGeometriesArray();\n let i, ii;\n for (i = 0, ii = geometries.length; i < ii; ++i) {\n const geometryRenderer = GEOMETRY_RENDERERS[geometries[i].getType()];\n geometryRenderer(\n replayGroup,\n geometries[i],\n style,\n feature,\n declutterBuilderGroup,\n index,\n );\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/LineString.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderLineStringGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n) {\n const strokeStyle = style.getStroke();\n if (strokeStyle) {\n const lineStringReplay = builderGroup.getBuilder(\n style.getZIndex(),\n 'LineString',\n );\n lineStringReplay.setFillStrokeStyle(null, strokeStyle);\n lineStringReplay.drawLineString(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiLineString.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderMultiLineStringGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n) {\n const strokeStyle = style.getStroke();\n if (strokeStyle) {\n const lineStringReplay = builderGroup.getBuilder(\n style.getZIndex(),\n 'LineString',\n );\n lineStringReplay.setFillStrokeStyle(null, strokeStyle);\n lineStringReplay.drawMultiLineString(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderMultiPolygonGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (strokeStyle || fillStyle) {\n const polygonReplay = builderGroup.getBuilder(style.getZIndex(), 'Polygon');\n polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n polygonReplay.drawMultiPolygon(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/Point.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @param {boolean} [declutter] Enable decluttering.\n */\nfunction renderPointGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n declutter,\n) {\n const imageStyle = style.getImage();\n const textStyle = style.getText();\n const hasText = textStyle && textStyle.getText();\n /** @type {import(\"../render/canvas.js\").DeclutterImageWithText} */\n const declutterImageWithText =\n declutter && imageStyle && hasText ? {} : undefined;\n if (imageStyle) {\n if (imageStyle.getImageState() != ImageState.LOADED) {\n return;\n }\n const imageReplay = builderGroup.getBuilder(style.getZIndex(), 'Image');\n imageReplay.setImageStyle(imageStyle, declutterImageWithText);\n imageReplay.drawPoint(geometry, feature, index);\n }\n if (hasText) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle, declutterImageWithText);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/MultiPoint.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @param {boolean} [declutter] Enable decluttering.\n */\nfunction renderMultiPointGeometry(\n builderGroup,\n geometry,\n style,\n feature,\n index,\n declutter,\n) {\n const imageStyle = style.getImage();\n const hasImage = imageStyle && imageStyle.getOpacity() !== 0;\n const textStyle = style.getText();\n const hasText = textStyle && textStyle.getText();\n /** @type {import(\"../render/canvas.js\").DeclutterImageWithText} */\n const declutterImageWithText =\n declutter && hasImage && hasText ? {} : undefined;\n if (hasImage) {\n if (imageStyle.getImageState() != ImageState.LOADED) {\n return;\n }\n const imageReplay = builderGroup.getBuilder(style.getZIndex(), 'Image');\n imageReplay.setImageStyle(imageStyle, declutterImageWithText);\n imageReplay.drawMultiPoint(geometry, feature, index);\n }\n if (hasText) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle, declutterImageWithText);\n textReplay.drawText(geometry, feature, index);\n }\n}\n\n/**\n * @param {import(\"../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {import(\"../geom/Polygon.js\").default|import(\"../render/Feature.js\").default} geometry Geometry.\n * @param {import(\"../style/Style.js\").default} style Style.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n */\nfunction renderPolygonGeometry(builderGroup, geometry, style, feature, index) {\n const fillStyle = style.getFill();\n const strokeStyle = style.getStroke();\n if (fillStyle || strokeStyle) {\n const polygonReplay = builderGroup.getBuilder(style.getZIndex(), 'Polygon');\n polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);\n polygonReplay.drawPolygon(geometry, feature, index);\n }\n const textStyle = style.getText();\n if (textStyle && textStyle.getText()) {\n const textReplay = builderGroup.getBuilder(style.getZIndex(), 'Text');\n textReplay.setTextStyle(textStyle);\n textReplay.drawText(geometry, feature, index);\n }\n}\n","/**\n * @module ol/render\n */\nimport {DEVICE_PIXEL_RATIO} from './has.js';\nimport {getTransformFromProjections, getUserProjection} from './proj.js';\nimport CanvasImmediateRenderer from './render/canvas/Immediate.js';\nimport {getSquaredTolerance} from './renderer/vector.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n multiply as multiplyTransform,\n scale as scaleTransform,\n} from './transform.js';\n\n/**\n * @typedef {Object} State\n * @property {CanvasRenderingContext2D} context Canvas context that the layer is being rendered to.\n * @property {import(\"./Feature.js\").FeatureLike} feature Feature.\n * @property {import(\"./geom/SimpleGeometry.js\").default} geometry Geometry.\n * @property {number} pixelRatio Pixel ratio used by the layer renderer.\n * @property {number} resolution Resolution that the render batch was created and optimized for.\n * This is not the view's resolution that is being rendered.\n * @property {number} rotation Rotation of the rendered layer in radians.\n */\n\n/**\n * A function to be used when sorting features before rendering.\n * It takes two instances of {@link module:ol/Feature~Feature} or\n * {@link module:ol/render/Feature~RenderFeature} and returns a `{number}`.\n *\n * @typedef {function(import(\"./Feature.js\").FeatureLike, import(\"./Feature.js\").FeatureLike):number} OrderFunction\n */\n\n/**\n * @typedef {Object} ToContextOptions\n * @property {import(\"./size.js\").Size} [size] Desired size of the canvas in css\n * pixels. When provided, both canvas and css size will be set according to the\n * `pixelRatio`. If not provided, the current canvas and css sizes will not be\n * altered.\n * @property {number} [pixelRatio=window.devicePixelRatio] Pixel ratio (canvas\n * pixel to css pixel ratio) for the canvas.\n */\n\n/**\n * Binds a Canvas Immediate API to a canvas context, to allow drawing geometries\n * to the context's canvas.\n *\n * The units for geometry coordinates are css pixels relative to the top left\n * corner of the canvas element.\n * ```js\n * import {toContext} from 'ol/render.js';\n * import Fill from 'ol/style/Fill.js';\n * import Polygon from 'ol/geom/Polygon.js';\n *\n * const canvas = document.createElement('canvas');\n * const render = toContext(\n * canvas.getContext('2d'),\n * {size: [100, 100]}\n * );\n * render.setFillStrokeStyle(new Fill({ color: blue }));\n * render.drawPolygon(\n * new Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]])\n * );\n * ```\n *\n * @param {CanvasRenderingContext2D} context Canvas context.\n * @param {ToContextOptions} [options] Options.\n * @return {CanvasImmediateRenderer} Canvas Immediate.\n * @api\n */\nexport function toContext(context, options) {\n const canvas = context.canvas;\n options = options ? options : {};\n const pixelRatio = options.pixelRatio || DEVICE_PIXEL_RATIO;\n const size = options.size;\n if (size) {\n canvas.width = size[0] * pixelRatio;\n canvas.height = size[1] * pixelRatio;\n canvas.style.width = size[0] + 'px';\n canvas.style.height = size[1] + 'px';\n }\n const extent = [0, 0, canvas.width, canvas.height];\n const transform = scaleTransform(createTransform(), pixelRatio, pixelRatio);\n return new CanvasImmediateRenderer(context, pixelRatio, extent, transform, 0);\n}\n\n/**\n * Gets a vector context for drawing to the event's canvas.\n * @param {import(\"./render/Event.js\").default} event Render event.\n * @return {CanvasImmediateRenderer} Vector context.\n * @api\n */\nexport function getVectorContext(event) {\n if (!(event.context instanceof CanvasRenderingContext2D)) {\n throw new Error('Only works for render events from Canvas 2D layers');\n }\n\n // canvas may be at a different pixel ratio than frameState.pixelRatio\n const a = event.inversePixelTransform[0];\n const b = event.inversePixelTransform[1];\n const canvasPixelRatio = Math.sqrt(a * a + b * b);\n const frameState = event.frameState;\n const transform = multiplyTransform(\n event.inversePixelTransform.slice(),\n frameState.coordinateToPixelTransform,\n );\n const squaredTolerance = getSquaredTolerance(\n frameState.viewState.resolution,\n canvasPixelRatio,\n );\n let userTransform;\n const userProjection = getUserProjection();\n if (userProjection) {\n userTransform = getTransformFromProjections(\n userProjection,\n frameState.viewState.projection,\n );\n }\n\n return new CanvasImmediateRenderer(\n event.context,\n canvasPixelRatio,\n frameState.extent,\n transform,\n frameState.viewState.rotation,\n squaredTolerance,\n userTransform,\n );\n}\n\n/**\n * Gets the pixel of the event's canvas context from the map viewport's CSS pixel.\n * @param {import(\"./render/Event.js\").default} event Render event.\n * @param {import(\"./pixel.js\").Pixel} pixel CSS pixel relative to the top-left\n * corner of the map viewport.\n * @return {import(\"./pixel.js\").Pixel} Pixel on the event's canvas context.\n * @api\n */\nexport function getRenderPixel(event, pixel) {\n return applyTransform(event.inversePixelTransform, pixel.slice(0));\n}\n","/**\n * @module ol/reproj\n */\nimport {createCanvasContext2D, releaseCanvas} from './dom.js';\nimport {\n containsCoordinate,\n createEmpty,\n extend,\n forEachCorner,\n getCenter,\n getHeight,\n getTopLeft,\n getWidth,\n} from './extent.js';\nimport {solveLinearSystem} from './math.js';\nimport {getPointResolution, transform} from './proj.js';\n\nlet brokenDiagonalRendering_;\n\n/**\n * @type {Array<HTMLCanvasElement>}\n */\nexport const canvasPool = [];\n\n/**\n * This draws a small triangle into a canvas by setting the triangle as the clip region\n * and then drawing a (too large) rectangle\n *\n * @param {CanvasRenderingContext2D} ctx The context in which to draw the triangle\n * @param {number} u1 The x-coordinate of the second point. The first point is 0,0.\n * @param {number} v1 The y-coordinate of the second point.\n * @param {number} u2 The x-coordinate of the third point.\n * @param {number} v2 The y-coordinate of the third point.\n */\nfunction drawTestTriangle(ctx, u1, v1, u2, v2) {\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.lineTo(u1, v1);\n ctx.lineTo(u2, v2);\n ctx.closePath();\n ctx.save();\n ctx.clip();\n ctx.fillRect(0, 0, Math.max(u1, u2) + 1, Math.max(v1, v2));\n ctx.restore();\n}\n\n/**\n * Given the data from getImageData, see if the right values appear at the provided offset.\n * Returns true if either the color or transparency is off\n *\n * @param {Uint8ClampedArray} data The data returned from getImageData\n * @param {number} offset The pixel offset from the start of data.\n * @return {boolean} true if the diagonal rendering is broken\n */\nfunction verifyBrokenDiagonalRendering(data, offset) {\n // the values ought to be close to the rgba(210, 0, 0, 0.75)\n return (\n Math.abs(data[offset * 4] - 210) > 2 ||\n Math.abs(data[offset * 4 + 3] - 0.75 * 255) > 2\n );\n}\n\n/**\n * Determines if the current browser configuration can render triangular clip regions correctly.\n * This value is cached so the function is only expensive the first time called.\n * Firefox on Windows (as of now) does not if HWA is enabled. See https://bugzilla.mozilla.org/show_bug.cgi?id=1606976\n * Chrome works, and everything seems to work on OSX and Android. This function caches the\n * result. I suppose that it is conceivably possible that a browser might flip modes while the app is\n * running, but lets hope not.\n *\n * @return {boolean} true if the Diagonal Rendering is broken.\n */\nfunction isBrokenDiagonalRendering() {\n if (brokenDiagonalRendering_ === undefined) {\n const ctx = createCanvasContext2D(6, 6, canvasPool);\n ctx.globalCompositeOperation = 'lighter';\n ctx.fillStyle = 'rgba(210, 0, 0, 0.75)';\n drawTestTriangle(ctx, 4, 5, 4, 0);\n drawTestTriangle(ctx, 4, 5, 0, 5);\n const data = ctx.getImageData(0, 0, 3, 3).data;\n brokenDiagonalRendering_ =\n verifyBrokenDiagonalRendering(data, 0) ||\n verifyBrokenDiagonalRendering(data, 4) ||\n verifyBrokenDiagonalRendering(data, 8);\n releaseCanvas(ctx);\n canvasPool.push(ctx.canvas);\n }\n\n return brokenDiagonalRendering_;\n}\n\n/**\n * Calculates ideal resolution to use from the source in order to achieve\n * pixel mapping as close as possible to 1:1 during reprojection.\n * The resolution is calculated regardless of what resolutions\n * are actually available in the dataset (TileGrid, Image, ...).\n *\n * @param {import(\"./proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"./proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"./coordinate.js\").Coordinate} targetCenter Target center.\n * @param {number} targetResolution Target resolution.\n * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.\n */\nexport function calculateSourceResolution(\n sourceProj,\n targetProj,\n targetCenter,\n targetResolution,\n) {\n const sourceCenter = transform(targetCenter, targetProj, sourceProj);\n\n // calculate the ideal resolution of the source data\n let sourceResolution = getPointResolution(\n targetProj,\n targetResolution,\n targetCenter,\n );\n\n const targetMetersPerUnit = targetProj.getMetersPerUnit();\n if (targetMetersPerUnit !== undefined) {\n sourceResolution *= targetMetersPerUnit;\n }\n const sourceMetersPerUnit = sourceProj.getMetersPerUnit();\n if (sourceMetersPerUnit !== undefined) {\n sourceResolution /= sourceMetersPerUnit;\n }\n\n // Based on the projection properties, the point resolution at the specified\n // coordinates may be slightly different. We need to reverse-compensate this\n // in order to achieve optimal results.\n\n const sourceExtent = sourceProj.getExtent();\n if (!sourceExtent || containsCoordinate(sourceExtent, sourceCenter)) {\n const compensationFactor =\n getPointResolution(sourceProj, sourceResolution, sourceCenter) /\n sourceResolution;\n if (isFinite(compensationFactor) && compensationFactor > 0) {\n sourceResolution /= compensationFactor;\n }\n }\n\n return sourceResolution;\n}\n\n/**\n * Calculates ideal resolution to use from the source in order to achieve\n * pixel mapping as close as possible to 1:1 during reprojection.\n * The resolution is calculated regardless of what resolutions\n * are actually available in the dataset (TileGrid, Image, ...).\n *\n * @param {import(\"./proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"./proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"./extent.js\").Extent} targetExtent Target extent\n * @param {number} targetResolution Target resolution.\n * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.\n */\nexport function calculateSourceExtentResolution(\n sourceProj,\n targetProj,\n targetExtent,\n targetResolution,\n) {\n const targetCenter = getCenter(targetExtent);\n let sourceResolution = calculateSourceResolution(\n sourceProj,\n targetProj,\n targetCenter,\n targetResolution,\n );\n\n if (!isFinite(sourceResolution) || sourceResolution <= 0) {\n forEachCorner(targetExtent, function (corner) {\n sourceResolution = calculateSourceResolution(\n sourceProj,\n targetProj,\n corner,\n targetResolution,\n );\n return isFinite(sourceResolution) && sourceResolution > 0;\n });\n }\n\n return sourceResolution;\n}\n\n/**\n * @typedef {Object} ImageExtent\n * @property {import(\"./extent.js\").Extent} extent Extent.\n * @property {import(\"./extent.js\").Extent} [clipExtent] Clip extent.\n * @property {import('./DataTile.js').ImageLike} image Image.\n */\n\n/**\n * Renders the source data into new canvas based on the triangulation.\n *\n * @param {number} width Width of the canvas.\n * @param {number} height Height of the canvas.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} sourceResolution Source resolution.\n * @param {import(\"./extent.js\").Extent} sourceExtent Extent of the data source.\n * @param {number} targetResolution Target resolution.\n * @param {import(\"./extent.js\").Extent} targetExtent Target extent.\n * @param {import(\"./reproj/Triangulation.js\").default} triangulation Calculated triangulation.\n * @param {Array<ImageExtent>} sources Array of sources.\n * @param {number} gutter Gutter of the sources.\n * @param {boolean} [renderEdges] Render reprojection edges.\n * @param {boolean} [interpolate] Use linear interpolation when resampling.\n * @param {boolean} [drawSingle] Draw single source images directly without stitchContext.\n * @param {boolean} [clipExtent] Clip stitchContext to sourceExtent.\n * @return {HTMLCanvasElement} Canvas with reprojected data.\n */\nexport function render(\n width,\n height,\n pixelRatio,\n sourceResolution,\n sourceExtent,\n targetResolution,\n targetExtent,\n triangulation,\n sources,\n gutter,\n renderEdges,\n interpolate,\n drawSingle,\n clipExtent,\n) {\n const context = createCanvasContext2D(\n Math.round(pixelRatio * width),\n Math.round(pixelRatio * height),\n canvasPool,\n );\n\n if (!interpolate) {\n context.imageSmoothingEnabled = false;\n }\n\n if (sources.length === 0) {\n return context.canvas;\n }\n\n context.scale(pixelRatio, pixelRatio);\n\n function pixelRound(value) {\n return Math.round(value * pixelRatio) / pixelRatio;\n }\n\n context.globalCompositeOperation = 'lighter';\n\n const sourceDataExtent = createEmpty();\n sources.forEach(function (src, i, arr) {\n extend(sourceDataExtent, src.extent);\n });\n\n let stitchContext;\n const stitchScale = pixelRatio / sourceResolution;\n // Round up Float32 scale values to prevent interpolation in Firefox.\n const inverseScale = (interpolate ? 1 : 1 + Math.pow(2, -24)) / stitchScale;\n\n if (!drawSingle || sources.length !== 1 || gutter !== 0) {\n stitchContext = createCanvasContext2D(\n Math.round(getWidth(sourceDataExtent) * stitchScale),\n Math.round(getHeight(sourceDataExtent) * stitchScale),\n canvasPool,\n );\n\n if (!interpolate) {\n stitchContext.imageSmoothingEnabled = false;\n }\n if (sourceExtent && clipExtent) {\n const xPos = (sourceExtent[0] - sourceDataExtent[0]) * stitchScale;\n const yPos = -(sourceExtent[3] - sourceDataExtent[3]) * stitchScale;\n const width = getWidth(sourceExtent) * stitchScale;\n const height = getHeight(sourceExtent) * stitchScale;\n stitchContext.rect(xPos, yPos, width, height);\n stitchContext.clip();\n }\n\n sources.forEach(function (src, i, arr) {\n // This test should never fail -- but it does. Need to find a fix the upstream condition\n if (src.image.width > 0 && src.image.height > 0) {\n if (src.clipExtent) {\n stitchContext.save();\n const xPos = (src.clipExtent[0] - sourceDataExtent[0]) * stitchScale;\n const yPos = -(src.clipExtent[3] - sourceDataExtent[3]) * stitchScale;\n const width = getWidth(src.clipExtent) * stitchScale;\n const height = getHeight(src.clipExtent) * stitchScale;\n stitchContext.rect(\n interpolate ? xPos : Math.round(xPos),\n interpolate ? yPos : Math.round(yPos),\n interpolate ? width : Math.round(xPos + width) - Math.round(xPos),\n interpolate ? height : Math.round(yPos + height) - Math.round(yPos),\n );\n stitchContext.clip();\n }\n\n const xPos = (src.extent[0] - sourceDataExtent[0]) * stitchScale;\n const yPos = -(src.extent[3] - sourceDataExtent[3]) * stitchScale;\n const srcWidth = getWidth(src.extent) * stitchScale;\n const srcHeight = getHeight(src.extent) * stitchScale;\n stitchContext.drawImage(\n src.image,\n gutter,\n gutter,\n src.image.width - 2 * gutter,\n src.image.height - 2 * gutter,\n interpolate ? xPos : Math.round(xPos),\n interpolate ? yPos : Math.round(yPos),\n interpolate\n ? srcWidth\n : Math.round(xPos + srcWidth) - Math.round(xPos),\n interpolate\n ? srcHeight\n : Math.round(yPos + srcHeight) - Math.round(yPos),\n );\n\n if (src.clipExtent) {\n stitchContext.restore();\n }\n }\n });\n }\n const targetTopLeft = getTopLeft(targetExtent);\n\n triangulation.getTriangles().forEach(function (triangle, i, arr) {\n /* Calculate affine transform (src -> dst)\n * Resulting matrix can be used to transform coordinate\n * from `sourceProjection` to destination pixels.\n *\n * To optimize number of context calls and increase numerical stability,\n * we also do the following operations:\n * trans(-topLeftExtentCorner), scale(1 / targetResolution), scale(1, -1)\n * here before solving the linear system so [ui, vi] are pixel coordinates.\n *\n * Src points: xi, yi\n * Dst points: ui, vi\n * Affine coefficients: aij\n *\n * | x0 y0 1 0 0 0 | |a00| |u0|\n * | x1 y1 1 0 0 0 | |a01| |u1|\n * | x2 y2 1 0 0 0 | x |a02| = |u2|\n * | 0 0 0 x0 y0 1 | |a10| |v0|\n * | 0 0 0 x1 y1 1 | |a11| |v1|\n * | 0 0 0 x2 y2 1 | |a12| |v2|\n */\n const source = triangle.source;\n const target = triangle.target;\n let x0 = source[0][0],\n y0 = source[0][1];\n let x1 = source[1][0],\n y1 = source[1][1];\n let x2 = source[2][0],\n y2 = source[2][1];\n // Make sure that everything is on pixel boundaries\n const u0 = pixelRound((target[0][0] - targetTopLeft[0]) / targetResolution);\n const v0 = pixelRound(\n -(target[0][1] - targetTopLeft[1]) / targetResolution,\n );\n const u1 = pixelRound((target[1][0] - targetTopLeft[0]) / targetResolution);\n const v1 = pixelRound(\n -(target[1][1] - targetTopLeft[1]) / targetResolution,\n );\n const u2 = pixelRound((target[2][0] - targetTopLeft[0]) / targetResolution);\n const v2 = pixelRound(\n -(target[2][1] - targetTopLeft[1]) / targetResolution,\n );\n\n // Shift all the source points to improve numerical stability\n // of all the subsequent calculations. The [x0, y0] is used here.\n // This is also used to simplify the linear system.\n const sourceNumericalShiftX = x0;\n const sourceNumericalShiftY = y0;\n x0 = 0;\n y0 = 0;\n x1 -= sourceNumericalShiftX;\n y1 -= sourceNumericalShiftY;\n x2 -= sourceNumericalShiftX;\n y2 -= sourceNumericalShiftY;\n\n const augmentedMatrix = [\n [x1, y1, 0, 0, u1 - u0],\n [x2, y2, 0, 0, u2 - u0],\n [0, 0, x1, y1, v1 - v0],\n [0, 0, x2, y2, v2 - v0],\n ];\n const affineCoefs = solveLinearSystem(augmentedMatrix);\n if (!affineCoefs) {\n return;\n }\n\n context.save();\n context.beginPath();\n\n if (isBrokenDiagonalRendering() || !interpolate) {\n // Make sure that all lines are horizontal or vertical\n context.moveTo(u1, v1);\n // This is the diagonal line. Do it in 4 steps\n const steps = 4;\n const ud = u0 - u1;\n const vd = v0 - v1;\n for (let step = 0; step < steps; step++) {\n // Go horizontally\n context.lineTo(\n u1 + pixelRound(((step + 1) * ud) / steps),\n v1 + pixelRound((step * vd) / (steps - 1)),\n );\n // Go vertically\n if (step != steps - 1) {\n context.lineTo(\n u1 + pixelRound(((step + 1) * ud) / steps),\n v1 + pixelRound(((step + 1) * vd) / (steps - 1)),\n );\n }\n }\n // We are almost at u0r, v0r\n context.lineTo(u2, v2);\n } else {\n context.moveTo(u1, v1);\n context.lineTo(u0, v0);\n context.lineTo(u2, v2);\n }\n\n context.clip();\n\n context.transform(\n affineCoefs[0],\n affineCoefs[2],\n affineCoefs[1],\n affineCoefs[3],\n u0,\n v0,\n );\n\n context.translate(\n sourceDataExtent[0] - sourceNumericalShiftX,\n sourceDataExtent[3] - sourceNumericalShiftY,\n );\n\n let image;\n if (stitchContext) {\n image = stitchContext.canvas;\n context.scale(inverseScale, -inverseScale);\n } else {\n const source = sources[0];\n const extent = source.extent;\n image = source.image;\n context.scale(\n getWidth(extent) / image.width,\n -getHeight(extent) / image.height,\n );\n }\n\n context.drawImage(image, 0, 0);\n context.restore();\n });\n\n if (stitchContext) {\n releaseCanvas(stitchContext);\n canvasPool.push(stitchContext.canvas);\n }\n\n if (renderEdges) {\n context.save();\n\n context.globalCompositeOperation = 'source-over';\n context.strokeStyle = 'black';\n context.lineWidth = 1;\n\n triangulation.getTriangles().forEach(function (triangle, i, arr) {\n const target = triangle.target;\n const u0 = (target[0][0] - targetTopLeft[0]) / targetResolution;\n const v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution;\n const u1 = (target[1][0] - targetTopLeft[0]) / targetResolution;\n const v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution;\n const u2 = (target[2][0] - targetTopLeft[0]) / targetResolution;\n const v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution;\n\n context.beginPath();\n context.moveTo(u1, v1);\n context.lineTo(u0, v0);\n context.lineTo(u2, v2);\n context.closePath();\n context.stroke();\n });\n\n context.restore();\n }\n return context.canvas;\n}\n","/**\n * @module ol/resolution\n */\n\n/**\n * @typedef {number|Array<number>} ResolutionLike\n */\n\n/**\n * @param {ResolutionLike} resolution Resolution.\n * @return {number} Resolution.\n */\nexport function fromResolutionLike(resolution) {\n if (Array.isArray(resolution)) {\n return Math.min(...resolution);\n }\n return resolution;\n}\n","/**\n * @module ol/structs/LRUCache\n */\n\nimport Disposable from '../Disposable.js';\nimport {assert} from '../asserts.js';\n\n/**\n * @typedef {Object} Entry\n * @property {string} key_ Key.\n * @property {Entry|null} newer Newer.\n * @property {Entry|null} older Older.\n * @property {*} value_ Value.\n */\n\n/**\n * @classdesc\n * Implements a Least-Recently-Used cache where the keys do not conflict with\n * Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring\n * items from the cache is the responsibility of the user.\n *\n * @fires import(\"../events/Event.js\").default\n * @template T\n */\nclass LRUCache {\n /**\n * @param {number} [highWaterMark] High water mark.\n */\n constructor(highWaterMark) {\n /**\n * Desired max cache size after expireCache(). If set to 0, no cache entries\n * will be pruned at all.\n * @type {number}\n */\n this.highWaterMark = highWaterMark !== undefined ? highWaterMark : 2048;\n\n /**\n * @private\n * @type {number}\n */\n this.count_ = 0;\n\n /**\n * @private\n * @type {!Object<string, Entry>}\n */\n this.entries_ = {};\n\n /**\n * @private\n * @type {?Entry}\n */\n this.oldest_ = null;\n\n /**\n * @private\n * @type {?Entry}\n */\n this.newest_ = null;\n }\n\n deleteOldest() {\n const entry = this.pop();\n if (entry instanceof Disposable) {\n entry.dispose();\n }\n }\n\n /**\n * @return {boolean} Can expire cache.\n */\n canExpireCache() {\n return this.highWaterMark > 0 && this.getCount() > this.highWaterMark;\n }\n\n /**\n * Expire the cache. When the cache entry is a {@link module:ol/Disposable~Disposable},\n * the entry will be disposed.\n * @param {!Object<string, boolean>} [keep] Keys to keep. To be implemented by subclasses.\n */\n expireCache(keep) {\n while (this.canExpireCache()) {\n this.deleteOldest();\n }\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n while (this.oldest_) {\n this.deleteOldest();\n }\n }\n\n /**\n * @param {string} key Key.\n * @return {boolean} Contains key.\n */\n containsKey(key) {\n return this.entries_.hasOwnProperty(key);\n }\n\n /**\n * @param {function(T, string, LRUCache<T>): ?} f The function\n * to call for every entry from the oldest to the newer. This function takes\n * 3 arguments (the entry value, the entry key and the LRUCache object).\n * The return value is ignored.\n */\n forEach(f) {\n let entry = this.oldest_;\n while (entry) {\n f(entry.value_, entry.key_, this);\n entry = entry.newer;\n }\n }\n\n /**\n * @param {string} key Key.\n * @param {*} [options] Options (reserved for subclasses).\n * @return {T} Value.\n */\n get(key, options) {\n const entry = this.entries_[key];\n assert(\n entry !== undefined,\n 'Tried to get a value for a key that does not exist in the cache',\n );\n if (entry === this.newest_) {\n return entry.value_;\n }\n if (entry === this.oldest_) {\n this.oldest_ = /** @type {Entry} */ (this.oldest_.newer);\n this.oldest_.older = null;\n } else {\n entry.newer.older = entry.older;\n entry.older.newer = entry.newer;\n }\n entry.newer = null;\n entry.older = this.newest_;\n this.newest_.newer = entry;\n this.newest_ = entry;\n return entry.value_;\n }\n\n /**\n * Remove an entry from the cache.\n * @param {string} key The entry key.\n * @return {T} The removed entry.\n */\n remove(key) {\n const entry = this.entries_[key];\n assert(\n entry !== undefined,\n 'Tried to get a value for a key that does not exist in the cache',\n );\n if (entry === this.newest_) {\n this.newest_ = /** @type {Entry} */ (entry.older);\n if (this.newest_) {\n this.newest_.newer = null;\n }\n } else if (entry === this.oldest_) {\n this.oldest_ = /** @type {Entry} */ (entry.newer);\n if (this.oldest_) {\n this.oldest_.older = null;\n }\n } else {\n entry.newer.older = entry.older;\n entry.older.newer = entry.newer;\n }\n delete this.entries_[key];\n --this.count_;\n return entry.value_;\n }\n\n /**\n * @return {number} Count.\n */\n getCount() {\n return this.count_;\n }\n\n /**\n * @return {Array<string>} Keys.\n */\n getKeys() {\n const keys = new Array(this.count_);\n let i = 0;\n let entry;\n for (entry = this.newest_; entry; entry = entry.older) {\n keys[i++] = entry.key_;\n }\n return keys;\n }\n\n /**\n * @return {Array<T>} Values.\n */\n getValues() {\n const values = new Array(this.count_);\n let i = 0;\n let entry;\n for (entry = this.newest_; entry; entry = entry.older) {\n values[i++] = entry.value_;\n }\n return values;\n }\n\n /**\n * @return {T} Last value.\n */\n peekLast() {\n return this.oldest_.value_;\n }\n\n /**\n * @return {string} Last key.\n */\n peekLastKey() {\n return this.oldest_.key_;\n }\n\n /**\n * Get the key of the newest item in the cache. Throws if the cache is empty.\n * @return {string} The newest key.\n */\n peekFirstKey() {\n return this.newest_.key_;\n }\n\n /**\n * Return an entry without updating least recently used time.\n * @param {string} key Key.\n * @return {T|undefined} Value.\n */\n peek(key) {\n return this.entries_[key]?.value_;\n }\n\n /**\n * @return {T} value Value.\n */\n pop() {\n const entry = this.oldest_;\n delete this.entries_[entry.key_];\n if (entry.newer) {\n entry.newer.older = null;\n }\n this.oldest_ = /** @type {Entry} */ (entry.newer);\n if (!this.oldest_) {\n this.newest_ = null;\n }\n --this.count_;\n return entry.value_;\n }\n\n /**\n * @param {string} key Key.\n * @param {T} value Value.\n */\n replace(key, value) {\n this.get(key); // update `newest_`\n this.entries_[key].value_ = value;\n }\n\n /**\n * @param {string} key Key.\n * @param {T} value Value.\n */\n set(key, value) {\n assert(\n !(key in this.entries_),\n 'Tried to set a value for a key that is used already',\n );\n const entry = {\n key_: key,\n newer: null,\n older: this.newest_,\n value_: value,\n };\n if (!this.newest_) {\n this.oldest_ = entry;\n } else {\n this.newest_.newer = entry;\n }\n this.newest_ = entry;\n this.entries_[key] = entry;\n ++this.count_;\n }\n\n /**\n * Set a maximum number of entries for the cache.\n * @param {number} size Cache size.\n * @api\n */\n setSize(size) {\n this.highWaterMark = size;\n }\n}\n\nexport default LRUCache;\n","/**\n * @module ol/tilecoord\n */\n\n/**\n * An array of three numbers representing the location of a tile in a tile\n * grid. The order is `z` (zoom level), `x` (column), and `y` (row).\n * @typedef {Array<number>} TileCoord\n * @api\n */\n\n/**\n * @param {number} z Z.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {TileCoord} [tileCoord] Tile coordinate.\n * @return {TileCoord} Tile coordinate.\n */\nexport function createOrUpdate(z, x, y, tileCoord) {\n if (tileCoord !== undefined) {\n tileCoord[0] = z;\n tileCoord[1] = x;\n tileCoord[2] = y;\n return tileCoord;\n }\n return [z, x, y];\n}\n\n/**\n * @param {number} z Z.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {string} Key.\n */\nexport function getKeyZXY(z, x, y) {\n return z + '/' + x + '/' + y;\n}\n\n/**\n * Get the key for a tile coord.\n * @param {TileCoord} tileCoord The tile coord.\n * @return {string} Key.\n */\nexport function getKey(tileCoord) {\n return getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]);\n}\n\n/**\n * Get the tile cache key for a tile key obtained through `tile.getKey()`.\n * @param {string} tileKey The tile key.\n * @return {string} The cache key.\n */\nexport function getCacheKeyForTileKey(tileKey) {\n const [z, x, y] = tileKey\n .substring(tileKey.lastIndexOf('/') + 1, tileKey.length)\n .split(',')\n .map(Number);\n return getKeyZXY(z, x, y);\n}\n\n/**\n * Get a tile coord given a key.\n * @param {string} key The tile coord key.\n * @return {TileCoord} The tile coord.\n */\nexport function fromKey(key) {\n return key.split('/').map(Number);\n}\n\n/**\n * @param {TileCoord} tileCoord Tile coord.\n * @return {number} Hash.\n */\nexport function hash(tileCoord) {\n return hashZXY(tileCoord[0], tileCoord[1], tileCoord[2]);\n}\n\n/**\n * @param {number} z The tile z coordinate.\n * @param {number} x The tile x coordinate.\n * @param {number} y The tile y coordinate.\n * @return {number} Hash.\n */\nexport function hashZXY(z, x, y) {\n return (x << z) + y;\n}\n\n/**\n * @param {TileCoord} tileCoord Tile coordinate.\n * @param {!import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {boolean} Tile coordinate is within extent and zoom level range.\n */\nexport function withinExtentAndZ(tileCoord, tileGrid) {\n const z = tileCoord[0];\n const x = tileCoord[1];\n const y = tileCoord[2];\n\n if (tileGrid.getMinZoom() > z || z > tileGrid.getMaxZoom()) {\n return false;\n }\n const tileRange = tileGrid.getFullTileRange(z);\n if (!tileRange) {\n return true;\n }\n return tileRange.containsXY(x, y);\n}\n","/**\n * @module ol/tilegrid/TileGrid\n */\nimport TileRange, {\n createOrUpdate as createOrUpdateTileRange,\n} from '../TileRange.js';\nimport {isSorted, linearFindNearest} from '../array.js';\nimport {assert} from '../asserts.js';\nimport {createOrUpdate, getTopLeft} from '../extent.js';\nimport {intersectsLinearRing} from '../geom/flat/intersectsextent.js';\nimport {ceil, clamp, floor} from '../math.js';\nimport {toSize} from '../size.js';\nimport {createOrUpdate as createOrUpdateTileCoord} from '../tilecoord.js';\nimport {DEFAULT_TILE_SIZE} from './common.js';\n\n/**\n * @private\n * @type {import(\"../tilecoord.js\").TileCoord}\n */\nconst tmpTileCoord = [0, 0, 0];\n\n/**\n * Number of decimal digits to consider in integer values when rounding.\n * @type {number}\n */\nconst DECIMALS = 5;\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../extent.js\").Extent} [extent] Extent for the tile grid. No tiles outside this\n * extent will be requested by {@link module:ol/source/Tile~TileSource} sources. When no `origin` or\n * `origins` are configured, the `origin` will be set to the top-left corner of the extent.\n * @property {number} [minZoom=0] Minimum zoom.\n * @property {import(\"../coordinate.js\").Coordinate} [origin] The tile grid origin, i.e. where the `x`\n * and `y` axes meet (`[z, 0, 0]`). Tile coordinates increase left to right and downwards. If not\n * specified, `extent` or `origins` must be provided.\n * @property {Array<import(\"../coordinate.js\").Coordinate>} [origins] Tile grid origins, i.e. where\n * the `x` and `y` axes meet (`[z, 0, 0]`), for each zoom level. If given, the array length\n * should match the length of the `resolutions` array, i.e. each resolution can have a different\n * origin. Tile coordinates increase left to right and downwards. If not specified, `extent` or\n * `origin` must be provided.\n * @property {!Array<number>} resolutions Resolutions. The array index of each resolution needs\n * to match the zoom level. This means that even if a `minZoom` is configured, the resolutions\n * array will have a length of `maxZoom + 1`.\n * @property {Array<import(\"../size.js\").Size>} [sizes] Number of tile rows and columns\n * of the grid for each zoom level. If specified the values\n * define each zoom level's extent together with the `origin` or `origins`.\n * A grid `extent` can be configured in addition, and will further limit the extent\n * for which tile requests are made by sources. If the bottom-left corner of\n * an extent is used as `origin` or `origins`, then the `y` value must be\n * negative because OpenLayers tile coordinates use the top left as the origin.\n * @property {number|import(\"../size.js\").Size} [tileSize] Tile size.\n * Default is `[256, 256]`.\n * @property {Array<number|import(\"../size.js\").Size>} [tileSizes] Tile sizes. If given, the array length\n * should match the length of the `resolutions` array, i.e. each resolution can have a different\n * tile size.\n */\n\n/**\n * @classdesc\n * Base class for setting the grid pattern for sources accessing tiled-image\n * servers.\n * @api\n */\nclass TileGrid {\n /**\n * @param {Options} options Tile grid options.\n */\n constructor(options) {\n /**\n * @protected\n * @type {number}\n */\n this.minZoom = options.minZoom !== undefined ? options.minZoom : 0;\n\n /**\n * @private\n * @type {!Array<number>}\n */\n this.resolutions_ = options.resolutions;\n assert(\n isSorted(\n this.resolutions_,\n /**\n * @param {number} a First resolution\n * @param {number} b Second resolution\n * @return {number} Comparison result\n */\n (a, b) => b - a,\n true,\n ),\n '`resolutions` must be sorted in descending order',\n );\n\n // check if we've got a consistent zoom factor and origin\n let zoomFactor;\n if (!options.origins) {\n for (let i = 0, ii = this.resolutions_.length - 1; i < ii; ++i) {\n if (!zoomFactor) {\n zoomFactor = this.resolutions_[i] / this.resolutions_[i + 1];\n } else {\n if (this.resolutions_[i] / this.resolutions_[i + 1] !== zoomFactor) {\n zoomFactor = undefined;\n break;\n }\n }\n }\n }\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.zoomFactor_ = zoomFactor;\n\n /**\n * @protected\n * @type {number}\n */\n this.maxZoom = this.resolutions_.length - 1;\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate|null}\n */\n this.origin_ = options.origin !== undefined ? options.origin : null;\n\n /**\n * @private\n * @type {Array<import(\"../coordinate.js\").Coordinate>}\n */\n this.origins_ = null;\n if (options.origins !== undefined) {\n this.origins_ = options.origins;\n assert(\n this.origins_.length == this.resolutions_.length,\n 'Number of `origins` and `resolutions` must be equal',\n );\n }\n\n const extent = options.extent;\n\n if (extent !== undefined && !this.origin_ && !this.origins_) {\n this.origin_ = getTopLeft(extent);\n }\n\n assert(\n (!this.origin_ && this.origins_) || (this.origin_ && !this.origins_),\n 'Either `origin` or `origins` must be configured, never both',\n );\n\n /**\n * @private\n * @type {Array<number|import(\"../size.js\").Size>}\n */\n this.tileSizes_ = null;\n if (options.tileSizes !== undefined) {\n this.tileSizes_ = options.tileSizes;\n assert(\n this.tileSizes_.length == this.resolutions_.length,\n 'Number of `tileSizes` and `resolutions` must be equal',\n );\n }\n\n /**\n * @private\n * @type {number|import(\"../size.js\").Size}\n */\n this.tileSize_ =\n options.tileSize !== undefined\n ? options.tileSize\n : !this.tileSizes_\n ? DEFAULT_TILE_SIZE\n : null;\n assert(\n (!this.tileSize_ && this.tileSizes_) ||\n (this.tileSize_ && !this.tileSizes_),\n 'Either `tileSize` or `tileSizes` must be configured, never both',\n );\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = extent !== undefined ? extent : null;\n\n /**\n * @private\n * @type {Array<import(\"../TileRange.js\").default>}\n */\n this.fullTileRanges_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.tmpSize_ = [0, 0];\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.tmpExtent_ = [0, 0, 0, 0];\n\n if (options.sizes !== undefined) {\n this.fullTileRanges_ = options.sizes.map((size, z) => {\n const tileRange = new TileRange(\n Math.min(0, size[0]),\n Math.max(size[0] - 1, -1),\n Math.min(0, size[1]),\n Math.max(size[1] - 1, -1),\n );\n if (extent) {\n const restrictedTileRange = this.getTileRangeForExtentAndZ(extent, z);\n tileRange.minX = Math.max(restrictedTileRange.minX, tileRange.minX);\n tileRange.maxX = Math.min(restrictedTileRange.maxX, tileRange.maxX);\n tileRange.minY = Math.max(restrictedTileRange.minY, tileRange.minY);\n tileRange.maxY = Math.min(restrictedTileRange.maxY, tileRange.maxY);\n }\n return tileRange;\n });\n } else if (extent) {\n this.calculateTileRanges_(extent);\n }\n }\n\n /**\n * Call a function with each tile coordinate for a given extent and zoom level.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} zoom Integer zoom level.\n * @param {function(import(\"../tilecoord.js\").TileCoord): void} callback Function called with each tile coordinate.\n * @api\n */\n forEachTileCoord(extent, zoom, callback) {\n const tileRange = this.getTileRangeForExtentAndZ(extent, zoom);\n for (let i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {\n for (let j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {\n callback([zoom, i, j]);\n }\n }\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {function(number, import(\"../TileRange.js\").default): boolean} callback Callback.\n * @param {import(\"../TileRange.js\").default} [tempTileRange] Temporary import(\"../TileRange.js\").default object.\n * @param {import(\"../extent.js\").Extent} [tempExtent] Temporary import(\"../extent.js\").Extent object.\n * @return {boolean} Callback succeeded.\n */\n forEachTileCoordParentTileRange(\n tileCoord,\n callback,\n tempTileRange,\n tempExtent,\n ) {\n let tileRange, x, y;\n let tileCoordExtent = null;\n let z = tileCoord[0] - 1;\n if (this.zoomFactor_ === 2) {\n x = tileCoord[1];\n y = tileCoord[2];\n } else {\n tileCoordExtent = this.getTileCoordExtent(tileCoord, tempExtent);\n }\n while (z >= this.minZoom) {\n if (x !== undefined && y !== undefined) {\n x = Math.floor(x / 2);\n y = Math.floor(y / 2);\n tileRange = createOrUpdateTileRange(x, x, y, y, tempTileRange);\n } else {\n tileRange = this.getTileRangeForExtentAndZ(\n tileCoordExtent,\n z,\n tempTileRange,\n );\n }\n if (callback(z, tileRange)) {\n return true;\n }\n --z;\n }\n return false;\n }\n\n /**\n * Get the extent for this tile grid, if it was configured.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent() {\n return this.extent_;\n }\n\n /**\n * Get the maximum zoom level for the grid.\n * @return {number} Max zoom.\n * @api\n */\n getMaxZoom() {\n return this.maxZoom;\n }\n\n /**\n * Get the minimum zoom level for the grid.\n * @return {number} Min zoom.\n * @api\n */\n getMinZoom() {\n return this.minZoom;\n }\n\n /**\n * Get the origin for the grid at the given zoom level.\n * @param {number} z Integer zoom level.\n * @return {import(\"../coordinate.js\").Coordinate} Origin.\n * @api\n */\n getOrigin(z) {\n if (this.origin_) {\n return this.origin_;\n }\n return this.origins_[z];\n }\n\n /**\n * Get the resolution for the given zoom level.\n * @param {number} z Integer zoom level.\n * @return {number} Resolution.\n * @api\n */\n getResolution(z) {\n return this.resolutions_[z];\n }\n\n /**\n * Get the list of resolutions for the tile grid.\n * @return {Array<number>} Resolutions.\n * @api\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../TileRange.js\").default} [tempTileRange] Temporary import(\"../TileRange.js\").default object.\n * @param {import(\"../extent.js\").Extent} [tempExtent] Temporary import(\"../extent.js\").Extent object.\n * @return {import(\"../TileRange.js\").default|null} Tile range.\n */\n getTileCoordChildTileRange(tileCoord, tempTileRange, tempExtent) {\n if (tileCoord[0] < this.maxZoom) {\n if (this.zoomFactor_ === 2) {\n const minX = tileCoord[1] * 2;\n const minY = tileCoord[2] * 2;\n return createOrUpdateTileRange(\n minX,\n minX + 1,\n minY,\n minY + 1,\n tempTileRange,\n );\n }\n const tileCoordExtent = this.getTileCoordExtent(\n tileCoord,\n tempExtent || this.tmpExtent_,\n );\n return this.getTileRangeForExtentAndZ(\n tileCoordExtent,\n tileCoord[0] + 1,\n tempTileRange,\n );\n }\n return null;\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {number} z Integer zoom level.\n * @param {import(\"../TileRange.js\").default} [tempTileRange] Temporary import(\"../TileRange.js\").default object.\n * @return {import(\"../TileRange.js\").default|null} Tile range.\n */\n getTileRangeForTileCoordAndZ(tileCoord, z, tempTileRange) {\n if (z > this.maxZoom || z < this.minZoom) {\n return null;\n }\n\n const tileCoordZ = tileCoord[0];\n const tileCoordX = tileCoord[1];\n const tileCoordY = tileCoord[2];\n\n if (z === tileCoordZ) {\n return createOrUpdateTileRange(\n tileCoordX,\n tileCoordY,\n tileCoordX,\n tileCoordY,\n tempTileRange,\n );\n }\n\n if (this.zoomFactor_) {\n const factor = Math.pow(this.zoomFactor_, z - tileCoordZ);\n const minX = Math.floor(tileCoordX * factor);\n const minY = Math.floor(tileCoordY * factor);\n if (z < tileCoordZ) {\n return createOrUpdateTileRange(minX, minX, minY, minY, tempTileRange);\n }\n\n const maxX = Math.floor(factor * (tileCoordX + 1)) - 1;\n const maxY = Math.floor(factor * (tileCoordY + 1)) - 1;\n return createOrUpdateTileRange(minX, maxX, minY, maxY, tempTileRange);\n }\n\n const tileCoordExtent = this.getTileCoordExtent(tileCoord, this.tmpExtent_);\n return this.getTileRangeForExtentAndZ(tileCoordExtent, z, tempTileRange);\n }\n\n /**\n * Get a tile range for the given extent and integer zoom level.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} z Integer zoom level.\n * @param {import(\"../TileRange.js\").default} [tempTileRange] Temporary tile range object.\n * @return {import(\"../TileRange.js\").default} Tile range.\n */\n getTileRangeForExtentAndZ(extent, z, tempTileRange) {\n this.getTileCoordForXYAndZ_(extent[0], extent[3], z, false, tmpTileCoord);\n const minX = tmpTileCoord[1];\n const minY = tmpTileCoord[2];\n this.getTileCoordForXYAndZ_(extent[2], extent[1], z, true, tmpTileCoord);\n const maxX = tmpTileCoord[1];\n const maxY = tmpTileCoord[2];\n return createOrUpdateTileRange(minX, maxX, minY, maxY, tempTileRange);\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {import(\"../coordinate.js\").Coordinate} Tile center.\n */\n getTileCoordCenter(tileCoord) {\n const origin = this.getOrigin(tileCoord[0]);\n const resolution = this.getResolution(tileCoord[0]);\n const tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);\n return [\n origin[0] + (tileCoord[1] + 0.5) * tileSize[0] * resolution,\n origin[1] - (tileCoord[2] + 0.5) * tileSize[1] * resolution,\n ];\n }\n\n /**\n * Get the extent of a tile coordinate.\n *\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../extent.js\").Extent} [tempExtent] Temporary extent object.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getTileCoordExtent(tileCoord, tempExtent) {\n const origin = this.getOrigin(tileCoord[0]);\n const resolution = this.getResolution(tileCoord[0]);\n const tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);\n const minX = origin[0] + tileCoord[1] * tileSize[0] * resolution;\n const minY = origin[1] - (tileCoord[2] + 1) * tileSize[1] * resolution;\n const maxX = minX + tileSize[0] * resolution;\n const maxY = minY + tileSize[1] * resolution;\n return createOrUpdate(minX, minY, maxX, maxY, tempExtent);\n }\n\n /**\n * Get the tile coordinate for the given map coordinate and resolution. This\n * method considers that coordinates that intersect tile boundaries should be\n * assigned the higher tile coordinate.\n *\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {import(\"../tilecoord.js\").TileCoord} [opt_tileCoord] Destination import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @api\n */\n getTileCoordForCoordAndResolution(coordinate, resolution, opt_tileCoord) {\n return this.getTileCoordForXYAndResolution_(\n coordinate[0],\n coordinate[1],\n resolution,\n false,\n opt_tileCoord,\n );\n }\n\n /**\n * Note that this method should not be called for resolutions that correspond\n * to an integer zoom level. Instead call the `getTileCoordForXYAndZ_` method.\n * @param {number} x X.\n * @param {number} y Y.\n * @param {number} resolution Resolution (for a non-integer zoom level).\n * @param {boolean} reverseIntersectionPolicy Instead of letting edge\n * intersections go to the higher tile coordinate, let edge intersections\n * go to the lower tile coordinate.\n * @param {import(\"../tilecoord.js\").TileCoord} [opt_tileCoord] Temporary import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @private\n */\n getTileCoordForXYAndResolution_(\n x,\n y,\n resolution,\n reverseIntersectionPolicy,\n opt_tileCoord,\n ) {\n const z = this.getZForResolution(resolution);\n const scale = resolution / this.getResolution(z);\n const origin = this.getOrigin(z);\n const tileSize = toSize(this.getTileSize(z), this.tmpSize_);\n\n let tileCoordX = (scale * (x - origin[0])) / resolution / tileSize[0];\n let tileCoordY = (scale * (origin[1] - y)) / resolution / tileSize[1];\n\n if (reverseIntersectionPolicy) {\n tileCoordX = ceil(tileCoordX, DECIMALS) - 1;\n tileCoordY = ceil(tileCoordY, DECIMALS) - 1;\n } else {\n tileCoordX = floor(tileCoordX, DECIMALS);\n tileCoordY = floor(tileCoordY, DECIMALS);\n }\n\n return createOrUpdateTileCoord(z, tileCoordX, tileCoordY, opt_tileCoord);\n }\n\n /**\n * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,\n * they should have separate implementations. This method is for integer zoom\n * levels. The other method should only be called for resolutions corresponding\n * to non-integer zoom levels.\n * @param {number} x Map x coordinate.\n * @param {number} y Map y coordinate.\n * @param {number} z Integer zoom level.\n * @param {boolean} reverseIntersectionPolicy Instead of letting edge\n * intersections go to the higher tile coordinate, let edge intersections\n * go to the lower tile coordinate.\n * @param {import(\"../tilecoord.js\").TileCoord} [opt_tileCoord] Temporary import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @private\n */\n getTileCoordForXYAndZ_(x, y, z, reverseIntersectionPolicy, opt_tileCoord) {\n const origin = this.getOrigin(z);\n const resolution = this.getResolution(z);\n const tileSize = toSize(this.getTileSize(z), this.tmpSize_);\n\n let tileCoordX = (x - origin[0]) / resolution / tileSize[0];\n let tileCoordY = (origin[1] - y) / resolution / tileSize[1];\n\n if (reverseIntersectionPolicy) {\n tileCoordX = ceil(tileCoordX, DECIMALS) - 1;\n tileCoordY = ceil(tileCoordY, DECIMALS) - 1;\n } else {\n tileCoordX = floor(tileCoordX, DECIMALS);\n tileCoordY = floor(tileCoordY, DECIMALS);\n }\n\n return createOrUpdateTileCoord(z, tileCoordX, tileCoordY, opt_tileCoord);\n }\n\n /**\n * Get a tile coordinate given a map coordinate and zoom level.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} z Integer zoom level, e.g. the result of a `getZForResolution()` method call\n * @param {import(\"../tilecoord.js\").TileCoord} [opt_tileCoord] Destination import(\"../tilecoord.js\").TileCoord object.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate.\n * @api\n */\n getTileCoordForCoordAndZ(coordinate, z, opt_tileCoord) {\n return this.getTileCoordForXYAndZ_(\n coordinate[0],\n coordinate[1],\n z,\n false,\n opt_tileCoord,\n );\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {number} Tile resolution.\n */\n getTileCoordResolution(tileCoord) {\n return this.resolutions_[tileCoord[0]];\n }\n\n /**\n * Get the tile size for a zoom level. The type of the return value matches the\n * `tileSize` or `tileSizes` that the tile grid was configured with. To always\n * get an {@link import(\"../size.js\").Size}, run the result through {@link module:ol/size.toSize}.\n * @param {number} z Z.\n * @return {number|import(\"../size.js\").Size} Tile size.\n * @api\n */\n getTileSize(z) {\n if (this.tileSize_) {\n return this.tileSize_;\n }\n return this.tileSizes_[z];\n }\n\n /**\n * @param {number} z Zoom level.\n * @return {import(\"../TileRange.js\").default|null} Extent tile range for the specified zoom level.\n */\n getFullTileRange(z) {\n if (!this.fullTileRanges_) {\n return this.extent_\n ? this.getTileRangeForExtentAndZ(this.extent_, z)\n : null;\n }\n return this.fullTileRanges_[z];\n }\n\n /**\n * @param {number} resolution Resolution.\n * @param {number|import(\"../array.js\").NearestDirectionFunction} [opt_direction]\n * If 0, the nearest resolution will be used.\n * If 1, the nearest higher resolution (lower Z) will be used. If -1, the\n * nearest lower resolution (higher Z) will be used. Default is 0.\n * Use a {@link module:ol/array~NearestDirectionFunction} for more precise control.\n *\n * For example to change tile Z at the midpoint of zoom levels\n * ```js\n * function(value, high, low) {\n * return value - low * Math.sqrt(high / low);\n * }\n * ```\n * @return {number} Z.\n * @api\n */\n getZForResolution(resolution, opt_direction) {\n const z = linearFindNearest(\n this.resolutions_,\n resolution,\n opt_direction || 0,\n );\n return clamp(z, this.minZoom, this.maxZoom);\n }\n\n /**\n * The tile with the provided tile coordinate intersects the given viewport.\n * @param {import('../tilecoord.js').TileCoord} tileCoord Tile coordinate.\n * @param {Array<number>} viewport Viewport as returned from {@link module:ol/extent.getRotatedViewport}.\n * @return {boolean} The tile with the provided tile coordinate intersects the given viewport.\n */\n tileCoordIntersectsViewport(tileCoord, viewport) {\n return intersectsLinearRing(\n viewport,\n 0,\n viewport.length,\n 2,\n this.getTileCoordExtent(tileCoord),\n );\n }\n\n /**\n * @param {!import(\"../extent.js\").Extent} extent Extent for this tile grid.\n * @private\n */\n calculateTileRanges_(extent) {\n const length = this.resolutions_.length;\n const fullTileRanges = new Array(length);\n for (let z = this.minZoom; z < length; ++z) {\n fullTileRanges[z] = this.getTileRangeForExtentAndZ(extent, z);\n }\n this.fullTileRanges_ = fullTileRanges;\n }\n}\n\nexport default TileGrid;\n","/**\n * @module ol/tilegrid/WMTS\n */\n\nimport {get as getProjection} from '../proj.js';\nimport TileGrid from './TileGrid.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../extent.js\").Extent} [extent] Extent for the tile grid. No tiles\n * outside this extent will be requested by {@link module:ol/source/Tile~TileSource} sources.\n * When no `origin` or `origins` are configured, the `origin` will be set to the\n * top-left corner of the extent.\n * @property {import(\"../coordinate.js\").Coordinate} [origin] The tile grid origin, i.e.\n * where the `x` and `y` axes meet (`[z, 0, 0]`). Tile coordinates increase left\n * to right and downwards. If not specified, `extent` or `origins` must be provided.\n * @property {Array<import(\"../coordinate.js\").Coordinate>} [origins] Tile grid origins,\n * i.e. where the `x` and `y` axes meet (`[z, 0, 0]`), for each zoom level. If\n * given, the array length should match the length of the `resolutions` array, i.e.\n * each resolution can have a different origin. Tile coordinates increase left to\n * right and downwards. If not specified, `extent` or `origin` must be provided.\n * @property {!Array<number>} resolutions Resolutions. The array index of each\n * resolution needs to match the zoom level. This means that even if a `minZoom`\n * is configured, the resolutions array will have a length of `maxZoom + 1`\n * @property {!Array<string>} matrixIds matrix IDs. The length of this array needs\n * to match the length of the `resolutions` array.\n * @property {Array<import(\"../size.js\").Size>} [sizes] Number of tile rows and columns\n * of the grid for each zoom level. The values here are the `TileMatrixWidth` and\n * `TileMatrixHeight` advertised in the GetCapabilities response of the WMTS, and\n * define each zoom level's extent together with the `origin` or `origins`.\n * A grid `extent` can be configured in addition, and will further limit the extent for\n * which tile requests are made by sources. If the bottom-left corner of\n * an extent is used as `origin` or `origins`, then the `y` value must be\n * negative because OpenLayers tile coordinates use the top left as the origin.\n * @property {number|import(\"../size.js\").Size} [tileSize] Tile size.\n * @property {Array<number|import(\"../size.js\").Size>} [tileSizes] Tile sizes. The length of\n * this array needs to match the length of the `resolutions` array.\n */\n\n/**\n * @classdesc\n * Set the grid pattern for sources accessing WMTS tiled-image servers.\n * @api\n */\nclass WMTSTileGrid extends TileGrid {\n /**\n * @param {Options} options WMTS options.\n */\n constructor(options) {\n super({\n extent: options.extent,\n origin: options.origin,\n origins: options.origins,\n resolutions: options.resolutions,\n tileSize: options.tileSize,\n tileSizes: options.tileSizes,\n sizes: options.sizes,\n });\n\n /**\n * @private\n * @type {!Array<string>}\n */\n this.matrixIds_ = options.matrixIds;\n }\n\n /**\n * @param {number} z Z.\n * @return {string} MatrixId..\n */\n getMatrixId(z) {\n return this.matrixIds_[z];\n }\n\n /**\n * Get the list of matrix identifiers.\n * @return {Array<string>} MatrixIds.\n * @api\n */\n getMatrixIds() {\n return this.matrixIds_;\n }\n}\n\nexport default WMTSTileGrid;\n\n/**\n * Create a tile grid from a WMTS capabilities matrix set and an\n * optional TileMatrixSetLimits.\n * @param {Object} matrixSet An object representing a matrixSet in the\n * capabilities document.\n * @param {import(\"../extent.js\").Extent} [extent] An optional extent to restrict the tile\n * ranges the server provides.\n * @param {Array<Object>} [matrixLimits] An optional object representing\n * the available matrices for tileGrid.\n * @return {WMTSTileGrid} WMTS tileGrid instance.\n * @api\n */\nexport function createFromCapabilitiesMatrixSet(\n matrixSet,\n extent,\n matrixLimits,\n) {\n /** @type {!Array<number>} */\n const resolutions = [];\n /** @type {!Array<string>} */\n const matrixIds = [];\n /** @type {!Array<import(\"../coordinate.js\").Coordinate>} */\n const origins = [];\n /** @type {!Array<number|import(\"../size.js\").Size>} */\n const tileSizes = [];\n /** @type {!Array<import(\"../size.js\").Size>} */\n const sizes = [];\n\n matrixLimits = matrixLimits !== undefined ? matrixLimits : [];\n\n const supportedCRSPropName = 'SupportedCRS';\n const matrixIdsPropName = 'TileMatrix';\n const identifierPropName = 'Identifier';\n const scaleDenominatorPropName = 'ScaleDenominator';\n const topLeftCornerPropName = 'TopLeftCorner';\n const tileWidthPropName = 'TileWidth';\n const tileHeightPropName = 'TileHeight';\n\n const code = matrixSet[supportedCRSPropName];\n const projection = getProjection(code);\n const metersPerUnit = projection.getMetersPerUnit();\n // swap origin x and y coordinates if axis orientation is lat/long\n const switchOriginXY = projection.getAxisOrientation().startsWith('ne');\n\n matrixSet[matrixIdsPropName].sort(function (a, b) {\n return b[scaleDenominatorPropName] - a[scaleDenominatorPropName];\n });\n\n matrixSet[matrixIdsPropName].forEach(function (elt) {\n let matrixAvailable;\n // use of matrixLimits to filter TileMatrices from GetCapabilities\n // TileMatrixSet from unavailable matrix levels.\n if (matrixLimits.length > 0) {\n matrixAvailable = matrixLimits.find(function (elt_ml) {\n if (elt[identifierPropName] == elt_ml[matrixIdsPropName]) {\n return true;\n }\n // Fallback for tileMatrix identifiers that don't get prefixed\n // by their tileMatrixSet identifiers.\n if (!elt[identifierPropName].includes(':')) {\n return (\n matrixSet[identifierPropName] + ':' + elt[identifierPropName] ===\n elt_ml[matrixIdsPropName]\n );\n }\n return false;\n });\n } else {\n matrixAvailable = true;\n }\n\n if (matrixAvailable) {\n matrixIds.push(elt[identifierPropName]);\n const resolution =\n (elt[scaleDenominatorPropName] * 0.28e-3) / metersPerUnit;\n const tileWidth = elt[tileWidthPropName];\n const tileHeight = elt[tileHeightPropName];\n if (switchOriginXY) {\n origins.push([\n elt[topLeftCornerPropName][1],\n elt[topLeftCornerPropName][0],\n ]);\n } else {\n origins.push(elt[topLeftCornerPropName]);\n }\n resolutions.push(resolution);\n tileSizes.push(\n tileWidth == tileHeight ? tileWidth : [tileWidth, tileHeight],\n );\n sizes.push([elt['MatrixWidth'], elt['MatrixHeight']]);\n }\n });\n\n return new WMTSTileGrid({\n extent: extent,\n origins: origins,\n resolutions: resolutions,\n matrixIds: matrixIds,\n tileSizes: tileSizes,\n sizes: sizes,\n });\n}\n","/**\n * @module ol/tilegrid\n */\nimport {\n containsCoordinate,\n createOrUpdate,\n getCorner,\n getHeight,\n getWidth,\n} from './extent.js';\nimport {METERS_PER_UNIT, get as getProjection} from './proj.js';\nimport {toSize} from './size.js';\nimport TileGrid from './tilegrid/TileGrid.js';\nimport {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from './tilegrid/common.js';\n\nexport {TileGrid};\nexport {default as WMTS} from './tilegrid/WMTS.js';\n\n/**\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {!TileGrid} Default tile grid for the\n * passed projection.\n */\nexport function getForProjection(projection) {\n let tileGrid = projection.getDefaultTileGrid();\n if (!tileGrid) {\n tileGrid = createForProjection(projection);\n projection.setDefaultTileGrid(tileGrid);\n }\n return tileGrid;\n}\n\n/**\n * @param {TileGrid} tileGrid Tile grid.\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {import(\"./tilecoord.js\").TileCoord} Tile coordinate.\n */\nexport function wrapX(tileGrid, tileCoord, projection) {\n const z = tileCoord[0];\n const center = tileGrid.getTileCoordCenter(tileCoord);\n const projectionExtent = extentFromProjection(projection);\n if (!containsCoordinate(projectionExtent, center)) {\n const worldWidth = getWidth(projectionExtent);\n const worldsAway = Math.ceil(\n (projectionExtent[0] - center[0]) / worldWidth,\n );\n center[0] += worldWidth * worldsAway;\n return tileGrid.getTileCoordForCoordAndZ(center, z);\n }\n return tileCoord;\n}\n\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} [maxZoom] Maximum zoom level (default is\n * DEFAULT_MAX_ZOOM).\n * @param {number|import(\"./size.js\").Size} [tileSize] Tile size (default uses\n * DEFAULT_TILE_SIZE).\n * @param {import(\"./extent.js\").Corner} [corner] Extent corner (default is `'top-left'`).\n * @return {!TileGrid} TileGrid instance.\n */\nexport function createForExtent(extent, maxZoom, tileSize, corner) {\n corner = corner !== undefined ? corner : 'top-left';\n\n const resolutions = resolutionsFromExtent(extent, maxZoom, tileSize);\n\n return new TileGrid({\n extent: extent,\n origin: getCorner(extent, corner),\n resolutions: resolutions,\n tileSize: tileSize,\n });\n}\n\n/**\n * @typedef {Object} XYZOptions\n * @property {import(\"./extent.js\").Extent} [extent] Extent for the tile grid. The origin for an XYZ tile grid is the\n * top-left corner of the extent. If `maxResolution` is not provided the zero level of the grid is defined by the resolution\n * at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used.\n * @property {number} [maxResolution] Resolution at level zero.\n * @property {number} [maxZoom] Maximum zoom. The default is `42`. This determines the number of levels\n * in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set.\n * @property {number} [minZoom=0] Minimum zoom.\n * @property {number|import(\"./size.js\").Size} [tileSize=[256, 256]] Tile size in pixels.\n */\n\n/**\n * Creates a tile grid with a standard XYZ tiling scheme.\n * @param {XYZOptions} [options] Tile grid options.\n * @return {!TileGrid} Tile grid instance.\n * @api\n */\nexport function createXYZ(options) {\n const xyzOptions = options || {};\n\n const extent = xyzOptions.extent || getProjection('EPSG:3857').getExtent();\n\n const gridOptions = {\n extent: extent,\n minZoom: xyzOptions.minZoom,\n tileSize: xyzOptions.tileSize,\n resolutions: resolutionsFromExtent(\n extent,\n xyzOptions.maxZoom,\n xyzOptions.tileSize,\n xyzOptions.maxResolution,\n ),\n };\n return new TileGrid(gridOptions);\n}\n\n/**\n * Create a resolutions array from an extent. A zoom factor of 2 is assumed.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} [maxZoom] Maximum zoom level (default is\n * DEFAULT_MAX_ZOOM).\n * @param {number|import(\"./size.js\").Size} [tileSize] Tile size (default uses\n * DEFAULT_TILE_SIZE).\n * @param {number} [maxResolution] Resolution at level zero.\n * @return {!Array<number>} Resolutions array.\n */\nfunction resolutionsFromExtent(extent, maxZoom, tileSize, maxResolution) {\n maxZoom = maxZoom !== undefined ? maxZoom : DEFAULT_MAX_ZOOM;\n tileSize = toSize(tileSize !== undefined ? tileSize : DEFAULT_TILE_SIZE);\n\n const height = getHeight(extent);\n const width = getWidth(extent);\n\n maxResolution =\n maxResolution > 0\n ? maxResolution\n : Math.max(width / tileSize[0], height / tileSize[1]);\n\n const length = maxZoom + 1;\n const resolutions = new Array(length);\n for (let z = 0; z < length; ++z) {\n resolutions[z] = maxResolution / Math.pow(2, z);\n }\n return resolutions;\n}\n\n/**\n * @param {import(\"./proj.js\").ProjectionLike} projection Projection.\n * @param {number} [maxZoom] Maximum zoom level (default is\n * DEFAULT_MAX_ZOOM).\n * @param {number|import(\"./size.js\").Size} [tileSize] Tile size (default uses\n * DEFAULT_TILE_SIZE).\n * @param {import(\"./extent.js\").Corner} [corner] Extent corner (default is `'top-left'`).\n * @return {!TileGrid} TileGrid instance.\n */\nexport function createForProjection(projection, maxZoom, tileSize, corner) {\n const extent = extentFromProjection(projection);\n return createForExtent(extent, maxZoom, tileSize, corner);\n}\n\n/**\n * Generate a tile grid extent from a projection. If the projection has an\n * extent, it is used. If not, a global extent is assumed.\n * @param {import(\"./proj.js\").ProjectionLike} projection Projection.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\nexport function extentFromProjection(projection) {\n projection = getProjection(projection);\n let extent = projection.getExtent();\n if (!extent) {\n const half =\n (180 * METERS_PER_UNIT.degrees) / projection.getMetersPerUnit();\n extent = createOrUpdate(-half, -half, half, half);\n }\n return extent;\n}\n","/**\n * @module ol/uri\n */\n\nimport {modulo} from './math.js';\nimport {hashZXY} from './tilecoord.js';\n\n/**\n * Appends query parameters to a URI.\n *\n * @param {string} uri The original URI, which may already have query data.\n * @param {!Object} params An object where keys are URI-encoded parameter keys,\n * and the values are arbitrary types or arrays.\n * @return {string} The new URI.\n */\nexport function appendParams(uri, params) {\n /** @type {Array<string>} */\n const keyParams = [];\n // Skip any null or undefined parameter values\n Object.keys(params).forEach(function (k) {\n if (params[k] !== null && params[k] !== undefined) {\n keyParams.push(k + '=' + encodeURIComponent(params[k]));\n }\n });\n const qs = keyParams.join('&');\n // remove any trailing ? or &\n uri = uri.replace(/[?&]$/, '');\n // append ? or & depending on whether uri has existing parameters\n uri += uri.includes('?') ? '&' : '?';\n return uri + qs;\n}\n\nconst zRegEx = /\\{z\\}/g;\nconst xRegEx = /\\{x\\}/g;\nconst yRegEx = /\\{y\\}/g;\nconst dashYRegEx = /\\{-y\\}/g;\n\n/**\n * @param {string} template The URL template. Should have `{x}`, `{y}`, and `{z}` placeholders. If\n * the template has a `{-y}` placeholder, the `maxY` parameter must be supplied.\n * @param {number} z The tile z coordinate.\n * @param {number} x The tile x coordinate.\n * @param {number} y The tile y coordinate.\n * @param {number} [maxY] The maximum y coordinate at the given z level.\n * @return {string} The URL.\n */\nexport function renderXYZTemplate(template, z, x, y, maxY) {\n return template\n .replace(zRegEx, z.toString())\n .replace(xRegEx, x.toString())\n .replace(yRegEx, y.toString())\n .replace(dashYRegEx, function () {\n if (maxY === undefined) {\n throw new Error(\n 'If the URL template has a {-y} placeholder, the grid extent must be known',\n );\n }\n return (maxY - y).toString();\n });\n}\n\n/**\n * @param {Array<string>} urls List of URLs.\n * @param {number} z The tile z coordinate.\n * @param {number} x The tile x coordinate.\n * @param {number} y The tile y coordinate.\n * @return {string} The chosen URL.\n */\nexport function pickUrl(urls, z, x, y) {\n const hash = hashZXY(z, x, y);\n const index = modulo(hash, urls.length);\n return urls[index];\n}\n\n/**\n * @param {string} url URL.\n * @return {Array<string>} Array of urls.\n */\nexport function expandUrl(url) {\n const urls = [];\n let match = /\\{([a-z])-([a-z])\\}/.exec(url);\n if (match) {\n // char range\n const startCharCode = match[1].charCodeAt(0);\n const stopCharCode = match[2].charCodeAt(0);\n let charCode;\n for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) {\n urls.push(url.replace(match[0], String.fromCharCode(charCode)));\n }\n return urls;\n }\n match = /\\{(\\d+)-(\\d+)\\}/.exec(url);\n if (match) {\n // number range\n const stop = parseInt(match[2], 10);\n for (let i = parseInt(match[1], 10); i <= stop; i++) {\n urls.push(url.replace(match[0], i.toString()));\n }\n return urls;\n }\n urls.push(url);\n return urls;\n}\n","/**\n * @module ol/tileurlfunction\n */\nimport {modulo} from './math.js';\nimport {hash as tileCoordHash} from './tilecoord.js';\nimport {renderXYZTemplate} from './uri.js';\n\n/**\n * @param {string} template Template.\n * @param {import(\"./tilegrid/TileGrid.js\").default|null} tileGrid Tile grid.\n * @return {import(\"./Tile.js\").UrlFunction} Tile URL function.\n */\nexport function createFromTemplate(template, tileGrid) {\n return (\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile Coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n function (tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n }\n let maxY;\n const z = tileCoord[0];\n if (tileGrid) {\n // The `{-y}` placeholder only works for sources that have a tile grid at construction\n const range = tileGrid.getFullTileRange(z);\n if (range) {\n maxY = range.getHeight() - 1;\n }\n }\n return renderXYZTemplate(template, z, tileCoord[1], tileCoord[2], maxY);\n }\n );\n}\n\n/**\n * @param {Array<string>} templates Templates.\n * @param {import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @return {import(\"./Tile.js\").UrlFunction} Tile URL function.\n */\nexport function createFromTemplates(templates, tileGrid) {\n const len = templates.length;\n const tileUrlFunctions = new Array(len);\n for (let i = 0; i < len; ++i) {\n tileUrlFunctions[i] = createFromTemplate(templates[i], tileGrid);\n }\n return createFromTileUrlFunctions(tileUrlFunctions);\n}\n\n/**\n * @param {Array<import(\"./Tile.js\").UrlFunction>} tileUrlFunctions Tile URL Functions.\n * @return {import(\"./Tile.js\").UrlFunction} Tile URL function.\n */\nexport function createFromTileUrlFunctions(tileUrlFunctions) {\n if (tileUrlFunctions.length === 1) {\n return tileUrlFunctions[0];\n }\n return (\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile Coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n function (tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n }\n const h = tileCoordHash(tileCoord);\n const index = modulo(h, tileUrlFunctions.length);\n return tileUrlFunctions[index](tileCoord, pixelRatio, projection);\n }\n );\n}\n\n/**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\nexport function nullTileUrlFunction(tileCoord, pixelRatio, projection) {\n return undefined;\n}\n","/**\n * @module ol/reproj/Triangulation\n */\nimport {\n boundingExtent,\n createEmpty,\n extendCoordinate,\n getArea,\n getBottomLeft,\n getBottomRight,\n getTopLeft,\n getTopRight,\n getWidth,\n intersects,\n} from '../extent.js';\nimport {modulo} from '../math.js';\nimport {\n createTransformFromCoordinateTransform,\n getTransform,\n transform,\n} from '../proj.js';\nimport {apply as applyMatrix} from '../transform.js';\n\n/**\n * Single triangle; consists of 3 source points and 3 target points.\n * @typedef {Object} Triangle\n * @property {Array<import(\"../coordinate.js\").Coordinate>} source Source.\n * @property {Array<import(\"../coordinate.js\").Coordinate>} target Target.\n */\n\n/**\n * Maximum number of subdivision steps during raster reprojection triangulation.\n * Prevents high memory usage and large number of proj4 calls (for certain\n * transformations and areas). At most `2*(2^this)` triangles are created for\n * each triangulated extent (tile/image).\n * @type {number}\n */\nconst MAX_SUBDIVISION = 10;\n\n/**\n * Maximum allowed size of triangle relative to world width. When transforming\n * corners of world extent between certain projections, the resulting\n * triangulation seems to have zero error and no subdivision is performed. If\n * the triangle width is more than this (relative to world width; 0-1),\n * subdivison is forced (up to `MAX_SUBDIVISION`). Default is `0.25`.\n * @type {number}\n */\nconst MAX_TRIANGLE_WIDTH = 0.25;\n\n/**\n * @classdesc\n * Class containing triangulation of the given target extent.\n * Used for determining source data and the reprojection itself.\n */\nclass Triangulation {\n /**\n * @param {import(\"../proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"../proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"../extent.js\").Extent} targetExtent Target extent to triangulate.\n * @param {import(\"../extent.js\").Extent} maxSourceExtent Maximal source extent that can be used.\n * @param {number} errorThreshold Acceptable error (in source units).\n * @param {?number} destinationResolution The (optional) resolution of the destination.\n * @param {import(\"../transform.js\").Transform} [sourceMatrix] Source transform matrix.\n */\n constructor(\n sourceProj,\n targetProj,\n targetExtent,\n maxSourceExtent,\n errorThreshold,\n destinationResolution,\n sourceMatrix,\n ) {\n /**\n * @type {import(\"../proj/Projection.js\").default}\n * @private\n */\n this.sourceProj_ = sourceProj;\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n * @private\n */\n this.targetProj_ = targetProj;\n\n /** @type {!Object<string, import(\"../coordinate.js\").Coordinate>} */\n let transformInvCache = {};\n const transformInv = sourceMatrix\n ? createTransformFromCoordinateTransform((input) =>\n applyMatrix(\n sourceMatrix,\n transform(input, this.targetProj_, this.sourceProj_),\n ),\n )\n : getTransform(this.targetProj_, this.sourceProj_);\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} c A coordinate.\n * @return {import(\"../coordinate.js\").Coordinate} Transformed coordinate.\n * @private\n */\n this.transformInv_ = function (c) {\n const key = c[0] + '/' + c[1];\n if (!transformInvCache[key]) {\n transformInvCache[key] = transformInv(c);\n }\n return transformInvCache[key];\n };\n\n /**\n * @type {import(\"../extent.js\").Extent}\n * @private\n */\n this.maxSourceExtent_ = maxSourceExtent;\n\n /**\n * @type {number}\n * @private\n */\n this.errorThresholdSquared_ = errorThreshold * errorThreshold;\n\n /**\n * @type {Array<Triangle>}\n * @private\n */\n this.triangles_ = [];\n\n /**\n * Indicates that the triangulation crosses edge of the source projection.\n * @type {boolean}\n * @private\n */\n this.wrapsXInSource_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.canWrapXInSource_ =\n this.sourceProj_.canWrapX() &&\n !!maxSourceExtent &&\n !!this.sourceProj_.getExtent() &&\n getWidth(maxSourceExtent) >= getWidth(this.sourceProj_.getExtent());\n\n /**\n * @type {?number}\n * @private\n */\n this.sourceWorldWidth_ = this.sourceProj_.getExtent()\n ? getWidth(this.sourceProj_.getExtent())\n : null;\n\n /**\n * @type {?number}\n * @private\n */\n this.targetWorldWidth_ = this.targetProj_.getExtent()\n ? getWidth(this.targetProj_.getExtent())\n : null;\n\n const destinationTopLeft = getTopLeft(targetExtent);\n const destinationTopRight = getTopRight(targetExtent);\n const destinationBottomRight = getBottomRight(targetExtent);\n const destinationBottomLeft = getBottomLeft(targetExtent);\n const sourceTopLeft = this.transformInv_(destinationTopLeft);\n const sourceTopRight = this.transformInv_(destinationTopRight);\n const sourceBottomRight = this.transformInv_(destinationBottomRight);\n const sourceBottomLeft = this.transformInv_(destinationBottomLeft);\n\n /*\n * The maxSubdivision controls how many splittings of the target area can\n * be done. The idea here is to do a linear mapping of the target areas\n * but the actual overall reprojection (can be) extremely non-linear. The\n * default value of MAX_SUBDIVISION was chosen based on mapping a 256x256\n * tile size. However this function is also called to remap canvas rendered\n * layers which can be much larger. This calculation increases the maxSubdivision\n * value by the right factor so that each 256x256 pixel area has\n * MAX_SUBDIVISION divisions.\n */\n const maxSubdivision =\n MAX_SUBDIVISION +\n (destinationResolution\n ? Math.max(\n 0,\n Math.ceil(\n Math.log2(\n getArea(targetExtent) /\n (destinationResolution * destinationResolution * 256 * 256),\n ),\n ),\n )\n : 0);\n\n this.addQuad_(\n destinationTopLeft,\n destinationTopRight,\n destinationBottomRight,\n destinationBottomLeft,\n sourceTopLeft,\n sourceTopRight,\n sourceBottomRight,\n sourceBottomLeft,\n maxSubdivision,\n );\n\n if (this.wrapsXInSource_) {\n let leftBound = Infinity;\n this.triangles_.forEach(function (triangle, i, arr) {\n leftBound = Math.min(\n leftBound,\n triangle.source[0][0],\n triangle.source[1][0],\n triangle.source[2][0],\n );\n });\n\n // Shift triangles to be as close to `leftBound` as possible\n // (if the distance is more than `worldWidth / 2` it can be closer.\n this.triangles_.forEach((triangle) => {\n if (\n Math.max(\n triangle.source[0][0],\n triangle.source[1][0],\n triangle.source[2][0],\n ) -\n leftBound >\n this.sourceWorldWidth_ / 2\n ) {\n const newTriangle = [\n [triangle.source[0][0], triangle.source[0][1]],\n [triangle.source[1][0], triangle.source[1][1]],\n [triangle.source[2][0], triangle.source[2][1]],\n ];\n if (newTriangle[0][0] - leftBound > this.sourceWorldWidth_ / 2) {\n newTriangle[0][0] -= this.sourceWorldWidth_;\n }\n if (newTriangle[1][0] - leftBound > this.sourceWorldWidth_ / 2) {\n newTriangle[1][0] -= this.sourceWorldWidth_;\n }\n if (newTriangle[2][0] - leftBound > this.sourceWorldWidth_ / 2) {\n newTriangle[2][0] -= this.sourceWorldWidth_;\n }\n\n // Rarely (if the extent contains both the dateline and prime meridian)\n // the shift can in turn break some triangles.\n // Detect this here and don't shift in such cases.\n const minX = Math.min(\n newTriangle[0][0],\n newTriangle[1][0],\n newTriangle[2][0],\n );\n const maxX = Math.max(\n newTriangle[0][0],\n newTriangle[1][0],\n newTriangle[2][0],\n );\n if (maxX - minX < this.sourceWorldWidth_ / 2) {\n triangle.source = newTriangle;\n }\n }\n });\n }\n\n transformInvCache = {};\n }\n\n /**\n * Adds triangle to the triangulation.\n * @param {import(\"../coordinate.js\").Coordinate} a The target a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} b The target b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} c The target c coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} aSrc The source a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} bSrc The source b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} cSrc The source c coordinate.\n * @private\n */\n addTriangle_(a, b, c, aSrc, bSrc, cSrc) {\n this.triangles_.push({\n source: [aSrc, bSrc, cSrc],\n target: [a, b, c],\n });\n }\n\n /**\n * Adds quad (points in clock-wise order) to the triangulation\n * (and reprojects the vertices) if valid.\n * Performs quad subdivision if needed to increase precision.\n *\n * @param {import(\"../coordinate.js\").Coordinate} a The target a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} b The target b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} c The target c coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} d The target d coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} aSrc The source a coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} bSrc The source b coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} cSrc The source c coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} dSrc The source d coordinate.\n * @param {number} maxSubdivision Maximal allowed subdivision of the quad.\n * @private\n */\n addQuad_(a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) {\n const sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]);\n const sourceCoverageX = this.sourceWorldWidth_\n ? getWidth(sourceQuadExtent) / this.sourceWorldWidth_\n : null;\n const sourceWorldWidth = /** @type {number} */ (this.sourceWorldWidth_);\n\n // when the quad is wrapped in the source projection\n // it covers most of the projection extent, but not fully\n const wrapsX =\n this.sourceProj_.canWrapX() &&\n sourceCoverageX > 0.5 &&\n sourceCoverageX < 1;\n\n let needsSubdivision = false;\n\n if (maxSubdivision > 0) {\n if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {\n const targetQuadExtent = boundingExtent([a, b, c, d]);\n const targetCoverageX =\n getWidth(targetQuadExtent) / this.targetWorldWidth_;\n needsSubdivision =\n targetCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision;\n }\n if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) {\n needsSubdivision =\n sourceCoverageX > MAX_TRIANGLE_WIDTH || needsSubdivision;\n }\n }\n\n if (!needsSubdivision && this.maxSourceExtent_) {\n if (\n isFinite(sourceQuadExtent[0]) &&\n isFinite(sourceQuadExtent[1]) &&\n isFinite(sourceQuadExtent[2]) &&\n isFinite(sourceQuadExtent[3])\n ) {\n if (!intersects(sourceQuadExtent, this.maxSourceExtent_)) {\n // whole quad outside source projection extent -> ignore\n return;\n }\n }\n }\n\n let isNotFinite = 0;\n\n if (!needsSubdivision) {\n if (\n !isFinite(aSrc[0]) ||\n !isFinite(aSrc[1]) ||\n !isFinite(bSrc[0]) ||\n !isFinite(bSrc[1]) ||\n !isFinite(cSrc[0]) ||\n !isFinite(cSrc[1]) ||\n !isFinite(dSrc[0]) ||\n !isFinite(dSrc[1])\n ) {\n if (maxSubdivision > 0) {\n needsSubdivision = true;\n } else {\n // It might be the case that only 1 of the points is infinite. In this case\n // we can draw a single triangle with the other three points\n isNotFinite =\n (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) ? 8 : 0) +\n (!isFinite(bSrc[0]) || !isFinite(bSrc[1]) ? 4 : 0) +\n (!isFinite(cSrc[0]) || !isFinite(cSrc[1]) ? 2 : 0) +\n (!isFinite(dSrc[0]) || !isFinite(dSrc[1]) ? 1 : 0);\n if (\n isNotFinite != 1 &&\n isNotFinite != 2 &&\n isNotFinite != 4 &&\n isNotFinite != 8\n ) {\n return;\n }\n }\n }\n }\n\n if (maxSubdivision > 0) {\n if (!needsSubdivision) {\n const center = [(a[0] + c[0]) / 2, (a[1] + c[1]) / 2];\n const centerSrc = this.transformInv_(center);\n\n let dx;\n if (wrapsX) {\n const centerSrcEstimX =\n (modulo(aSrc[0], sourceWorldWidth) +\n modulo(cSrc[0], sourceWorldWidth)) /\n 2;\n dx = centerSrcEstimX - modulo(centerSrc[0], sourceWorldWidth);\n } else {\n dx = (aSrc[0] + cSrc[0]) / 2 - centerSrc[0];\n }\n const dy = (aSrc[1] + cSrc[1]) / 2 - centerSrc[1];\n const centerSrcErrorSquared = dx * dx + dy * dy;\n needsSubdivision = centerSrcErrorSquared > this.errorThresholdSquared_;\n }\n if (needsSubdivision) {\n if (Math.abs(a[0] - c[0]) <= Math.abs(a[1] - c[1])) {\n // split horizontally (top & bottom)\n const bc = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2];\n const bcSrc = this.transformInv_(bc);\n const da = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2];\n const daSrc = this.transformInv_(da);\n\n this.addQuad_(\n a,\n b,\n bc,\n da,\n aSrc,\n bSrc,\n bcSrc,\n daSrc,\n maxSubdivision - 1,\n );\n this.addQuad_(\n da,\n bc,\n c,\n d,\n daSrc,\n bcSrc,\n cSrc,\n dSrc,\n maxSubdivision - 1,\n );\n } else {\n // split vertically (left & right)\n const ab = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n const abSrc = this.transformInv_(ab);\n const cd = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2];\n const cdSrc = this.transformInv_(cd);\n\n this.addQuad_(\n a,\n ab,\n cd,\n d,\n aSrc,\n abSrc,\n cdSrc,\n dSrc,\n maxSubdivision - 1,\n );\n this.addQuad_(\n ab,\n b,\n c,\n cd,\n abSrc,\n bSrc,\n cSrc,\n cdSrc,\n maxSubdivision - 1,\n );\n }\n return;\n }\n }\n\n if (wrapsX) {\n if (!this.canWrapXInSource_) {\n return;\n }\n this.wrapsXInSource_ = true;\n }\n\n // Exactly zero or one of *Src is not finite\n // The triangles must have the diagonal line as the first side\n // This is to allow easy code in reproj.s to make it straight for broken\n // browsers that can't handle diagonal clipping\n if ((isNotFinite & 0xb) == 0) {\n this.addTriangle_(a, c, d, aSrc, cSrc, dSrc);\n }\n if ((isNotFinite & 0xe) == 0) {\n this.addTriangle_(a, c, b, aSrc, cSrc, bSrc);\n }\n if (isNotFinite) {\n // Try the other two triangles\n if ((isNotFinite & 0xd) == 0) {\n this.addTriangle_(b, d, a, bSrc, dSrc, aSrc);\n }\n if ((isNotFinite & 0x7) == 0) {\n this.addTriangle_(b, d, c, bSrc, dSrc, cSrc);\n }\n }\n }\n\n /**\n * Calculates extent of the `source` coordinates from all the triangles.\n *\n * @return {import(\"../extent.js\").Extent} Calculated extent.\n */\n calculateSourceExtent() {\n const extent = createEmpty();\n\n this.triangles_.forEach(function (triangle, i, arr) {\n const src = triangle.source;\n extendCoordinate(extent, src[0]);\n extendCoordinate(extent, src[1]);\n extendCoordinate(extent, src[2]);\n });\n\n return extent;\n }\n\n /**\n * @return {Array<Triangle>} Array of the calculated triangles.\n */\n getTriangles() {\n return this.triangles_;\n }\n}\n\nexport default Triangulation;\n","/**\n * @module ol/reproj/common\n */\n\n/**\n * Default maximum allowed threshold (in pixels) for reprojection\n * triangulation.\n * @type {number}\n */\nexport const ERROR_THRESHOLD = 0.5;\n","/**\n * @module ol/reproj/Tile\n */\n\nimport Tile from '../Tile.js';\nimport TileState from '../TileState.js';\nimport {releaseCanvas} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {getArea, getIntersection, getWidth, wrapAndSliceX} from '../extent.js';\nimport {clamp} from '../math.js';\nimport {\n calculateSourceExtentResolution,\n canvasPool,\n render as renderReprojected,\n} from '../reproj.js';\nimport Triangulation from './Triangulation.js';\nimport {ERROR_THRESHOLD} from './common.js';\n\n/**\n * @typedef {function(number, number, number, number) : (import(\"../ImageTile.js\").default)} FunctionType\n */\n\n/**\n * @typedef {Object} TileOffset\n * @property {import(\"../ImageTile.js\").default} tile Tile.\n * @property {number} offset Offset.\n */\n\n/**\n * @classdesc\n * Class encapsulating single reprojected tile.\n * See {@link module:ol/source/TileImage~TileImage}.\n *\n */\nclass ReprojTile extends Tile {\n /**\n * @param {import(\"../proj/Projection.js\").default} sourceProj Source projection.\n * @param {import(\"../tilegrid/TileGrid.js\").default} sourceTileGrid Source tile grid.\n * @param {import(\"../proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"../tilegrid/TileGrid.js\").default} targetTileGrid Target tile grid.\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Coordinate of the tile.\n * @param {import(\"../tilecoord.js\").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} gutter Gutter of the source tiles.\n * @param {FunctionType} getTileFunction\n * Function returning source tiles (z, x, y, pixelRatio).\n * @param {number} [errorThreshold] Acceptable reprojection error (in px).\n * @param {boolean} [renderEdges] Render reprojection edges.\n * @param {import(\"../Tile.js\").Options} [options] Tile options.\n */\n constructor(\n sourceProj,\n sourceTileGrid,\n targetProj,\n targetTileGrid,\n tileCoord,\n wrappedTileCoord,\n pixelRatio,\n gutter,\n getTileFunction,\n errorThreshold,\n renderEdges,\n options,\n ) {\n super(tileCoord, TileState.IDLE, options);\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderEdges_ = renderEdges !== undefined ? renderEdges : false;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.gutter_ = gutter;\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.canvas_ = null;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.sourceTileGrid_ = sourceTileGrid;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.targetTileGrid_ = targetTileGrid;\n\n /**\n * @private\n * @type {import(\"../tilecoord.js\").TileCoord}\n */\n this.wrappedTileCoord_ = wrappedTileCoord ? wrappedTileCoord : tileCoord;\n\n /**\n * @private\n * @type {!Array<TileOffset>}\n */\n this.sourceTiles_ = [];\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.sourcesListenerKeys_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.sourceZ_ = 0;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.clipExtent_ = sourceProj.canWrapX()\n ? sourceProj.getExtent()\n : undefined;\n\n const targetExtent = targetTileGrid.getTileCoordExtent(\n this.wrappedTileCoord_,\n );\n const maxTargetExtent = this.targetTileGrid_.getExtent();\n let maxSourceExtent = this.sourceTileGrid_.getExtent();\n\n const limitedTargetExtent = maxTargetExtent\n ? getIntersection(targetExtent, maxTargetExtent)\n : targetExtent;\n\n if (getArea(limitedTargetExtent) === 0) {\n // Tile is completely outside range -> EMPTY\n // TODO: is it actually correct that the source even creates the tile ?\n this.state = TileState.EMPTY;\n return;\n }\n\n const sourceProjExtent = sourceProj.getExtent();\n if (sourceProjExtent) {\n if (!maxSourceExtent) {\n maxSourceExtent = sourceProjExtent;\n } else {\n maxSourceExtent = getIntersection(maxSourceExtent, sourceProjExtent);\n }\n }\n\n const targetResolution = targetTileGrid.getResolution(\n this.wrappedTileCoord_[0],\n );\n\n const sourceResolution = calculateSourceExtentResolution(\n sourceProj,\n targetProj,\n limitedTargetExtent,\n targetResolution,\n );\n\n if (!isFinite(sourceResolution) || sourceResolution <= 0) {\n // invalid sourceResolution -> EMPTY\n // probably edges of the projections when no extent is defined\n this.state = TileState.EMPTY;\n return;\n }\n\n const errorThresholdInPixels =\n errorThreshold !== undefined ? errorThreshold : ERROR_THRESHOLD;\n\n /**\n * @private\n * @type {!import(\"./Triangulation.js\").default}\n */\n this.triangulation_ = new Triangulation(\n sourceProj,\n targetProj,\n limitedTargetExtent,\n maxSourceExtent,\n sourceResolution * errorThresholdInPixels,\n targetResolution,\n );\n\n if (this.triangulation_.getTriangles().length === 0) {\n // no valid triangles -> EMPTY\n this.state = TileState.EMPTY;\n return;\n }\n\n this.sourceZ_ = sourceTileGrid.getZForResolution(sourceResolution);\n let sourceExtent = this.triangulation_.calculateSourceExtent();\n\n if (maxSourceExtent) {\n if (sourceProj.canWrapX()) {\n sourceExtent[1] = clamp(\n sourceExtent[1],\n maxSourceExtent[1],\n maxSourceExtent[3],\n );\n sourceExtent[3] = clamp(\n sourceExtent[3],\n maxSourceExtent[1],\n maxSourceExtent[3],\n );\n } else {\n sourceExtent = getIntersection(sourceExtent, maxSourceExtent);\n }\n }\n\n if (!getArea(sourceExtent)) {\n this.state = TileState.EMPTY;\n } else {\n let worldWidth = 0;\n let worldsAway = 0;\n if (sourceProj.canWrapX()) {\n worldWidth = getWidth(sourceProjExtent);\n worldsAway = Math.floor(\n (sourceExtent[0] - sourceProjExtent[0]) / worldWidth,\n );\n }\n\n const sourceExtents = wrapAndSliceX(\n sourceExtent.slice(),\n sourceProj,\n true,\n );\n sourceExtents.forEach((extent) => {\n const sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(\n extent,\n this.sourceZ_,\n );\n\n for (let srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {\n for (let srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) {\n const tile = getTileFunction(this.sourceZ_, srcX, srcY, pixelRatio);\n if (tile) {\n const offset = worldsAway * worldWidth;\n this.sourceTiles_.push({tile, offset});\n }\n }\n }\n ++worldsAway;\n });\n\n if (this.sourceTiles_.length === 0) {\n this.state = TileState.EMPTY;\n }\n }\n }\n\n /**\n * Get the HTML Canvas element for this tile.\n * @return {HTMLCanvasElement} Canvas.\n */\n getImage() {\n return this.canvas_;\n }\n\n /**\n * @private\n */\n reproject_() {\n const sources = [];\n this.sourceTiles_.forEach((source) => {\n const tile = source.tile;\n if (tile && tile.getState() == TileState.LOADED) {\n const extent = this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord);\n extent[0] += source.offset;\n extent[2] += source.offset;\n const clipExtent = this.clipExtent_?.slice();\n if (clipExtent) {\n clipExtent[0] += source.offset;\n clipExtent[2] += source.offset;\n }\n sources.push({\n extent: extent,\n clipExtent: clipExtent,\n image: tile.getImage(),\n });\n }\n });\n this.sourceTiles_.length = 0;\n\n if (sources.length === 0) {\n this.state = TileState.ERROR;\n } else {\n const z = this.wrappedTileCoord_[0];\n const size = this.targetTileGrid_.getTileSize(z);\n const width = typeof size === 'number' ? size : size[0];\n const height = typeof size === 'number' ? size : size[1];\n const targetResolution = this.targetTileGrid_.getResolution(z);\n const sourceResolution = this.sourceTileGrid_.getResolution(\n this.sourceZ_,\n );\n\n const targetExtent = this.targetTileGrid_.getTileCoordExtent(\n this.wrappedTileCoord_,\n );\n\n this.canvas_ = renderReprojected(\n width,\n height,\n this.pixelRatio_,\n sourceResolution,\n this.sourceTileGrid_.getExtent(),\n targetResolution,\n targetExtent,\n this.triangulation_,\n sources,\n this.gutter_,\n this.renderEdges_,\n this.interpolate,\n );\n\n this.state = TileState.LOADED;\n }\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n this.changed();\n\n let leftToLoad = 0;\n\n this.sourcesListenerKeys_ = [];\n this.sourceTiles_.forEach(({tile}) => {\n const state = tile.getState();\n if (state == TileState.IDLE || state == TileState.LOADING) {\n leftToLoad++;\n\n const sourceListenKey = listen(tile, EventType.CHANGE, (e) => {\n const state = tile.getState();\n if (\n state == TileState.LOADED ||\n state == TileState.ERROR ||\n state == TileState.EMPTY\n ) {\n unlistenByKey(sourceListenKey);\n leftToLoad--;\n if (leftToLoad === 0) {\n this.unlistenSources_();\n this.reproject_();\n }\n }\n });\n this.sourcesListenerKeys_.push(sourceListenKey);\n }\n });\n\n if (leftToLoad === 0) {\n setTimeout(this.reproject_.bind(this), 0);\n } else {\n this.sourceTiles_.forEach(function ({tile}, i, arr) {\n const state = tile.getState();\n if (state == TileState.IDLE) {\n tile.load();\n }\n });\n }\n }\n }\n\n /**\n * @private\n */\n unlistenSources_() {\n this.sourcesListenerKeys_.forEach(unlistenByKey);\n this.sourcesListenerKeys_ = null;\n }\n\n /**\n * Remove from the cache due to expiry\n * @override\n */\n release() {\n if (this.canvas_) {\n releaseCanvas(this.canvas_.getContext('2d'));\n canvasPool.push(this.canvas_);\n this.canvas_ = null;\n }\n super.release();\n }\n}\n\nexport default ReprojTile;\n","/**\n * @module ol/source/Source\n */\nimport BaseObject from '../Object.js';\nimport {get as getProjection} from '../proj.js';\n\n/**\n * @typedef {'undefined' | 'loading' | 'ready' | 'error'} State\n * State of the source, one of 'undefined', 'loading', 'ready' or 'error'.\n */\n\n/**\n * A function that takes a {@link import(\"../View.js\").ViewStateLayerStateExtent} and returns a string or\n * an array of strings representing source attributions.\n *\n * @typedef {function(import(\"../View.js\").ViewStateLayerStateExtent): (string|Array<string>)} Attribution\n */\n\n/**\n * A type that can be used to provide attribution information for data sources.\n *\n * It represents either\n * a simple string (e.g. `'© Acme Inc.'`)\n * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`)\n * a function that returns a string or array of strings ({@link module:ol/source/Source~Attribution})\n *\n * @typedef {string|Array<string>|Attribution} AttributionLike\n */\n\n/**\n * @typedef {Object} Options\n * @property {AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {import(\"./Source.js\").State} [state='ready'] State.\n * @property {boolean} [wrapX=false] WrapX.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for {@link module:ol/layer/Layer~Layer} sources.\n *\n * A generic `change` event is triggered when the state of the source changes.\n * @abstract\n * @api\n */\nclass Source extends BaseObject {\n /**\n * @param {Options} options Source options.\n */\n constructor(options) {\n super();\n\n /**\n * @protected\n * @type {import(\"../proj/Projection.js\").default|null}\n */\n this.projection = getProjection(options.projection);\n\n /**\n * @private\n * @type {?Attribution}\n */\n this.attributions_ = adaptAttributions(options.attributions);\n\n /**\n * @private\n * @type {boolean}\n */\n this.attributionsCollapsible_ = options.attributionsCollapsible ?? true;\n\n /**\n * This source is currently loading data. Sources that defer loading to the\n * map's tile queue never set this to `true`.\n * @type {boolean}\n */\n this.loading = false;\n\n /**\n * @private\n * @type {import(\"./Source.js\").State}\n */\n this.state_ = options.state !== undefined ? options.state : 'ready';\n\n /**\n * @private\n * @type {boolean}\n */\n this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.interpolate_ = !!options.interpolate;\n\n /**\n * @protected\n * @type {function(import(\"../View.js\").ViewOptions):void}\n */\n this.viewResolver = null;\n\n /**\n * @protected\n * @type {function(Error):void}\n */\n this.viewRejector = null;\n\n const self = this;\n /**\n * @private\n * @type {Promise<import(\"../View.js\").ViewOptions>}\n */\n this.viewPromise_ = new Promise(function (resolve, reject) {\n self.viewResolver = resolve;\n self.viewRejector = reject;\n });\n }\n\n /**\n * Get the attribution function for the source.\n * @return {?Attribution} Attribution function.\n * @api\n */\n getAttributions() {\n return this.attributions_;\n }\n\n /**\n * @return {boolean} Attributions are collapsible.\n * @api\n */\n getAttributionsCollapsible() {\n return this.attributionsCollapsible_;\n }\n\n /**\n * Get the projection of the source.\n * @return {import(\"../proj/Projection.js\").default|null} Projection.\n * @api\n */\n getProjection() {\n return this.projection;\n }\n\n /**\n * @param {import(\"../proj/Projection\").default} [projection] Projection.\n * @return {Array<number>|null} Resolutions.\n */\n getResolutions(projection) {\n return null;\n }\n\n /**\n * @return {Promise<import(\"../View.js\").ViewOptions>} A promise for view-related properties.\n */\n getView() {\n return this.viewPromise_;\n }\n\n /**\n * Get the state of the source, see {@link import(\"./Source.js\").State} for possible states.\n * @return {import(\"./Source.js\").State} State.\n * @api\n */\n getState() {\n return this.state_;\n }\n\n /**\n * @return {boolean|undefined} Wrap X.\n */\n getWrapX() {\n return this.wrapX_;\n }\n\n /**\n * @return {boolean} Use linear interpolation when resampling.\n */\n getInterpolate() {\n return this.interpolate_;\n }\n\n /**\n * Refreshes the source. The source will be cleared, and data from the server will be reloaded.\n * @api\n */\n refresh() {\n this.changed();\n }\n\n /**\n * Set the attributions of the source.\n * @param {AttributionLike|undefined} attributions Attributions.\n * Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution},\n * or `undefined`.\n * @api\n */\n setAttributions(attributions) {\n this.attributions_ = adaptAttributions(attributions);\n this.changed();\n }\n\n /**\n * Set the state of the source.\n * @param {import(\"./Source.js\").State} state State.\n */\n setState(state) {\n this.state_ = state;\n this.changed();\n }\n}\n\n/**\n * Turns the attributions option into an attributions function.\n * @param {AttributionLike|undefined} attributionLike The attribution option.\n * @return {Attribution|null} An attribution function (or null).\n */\nfunction adaptAttributions(attributionLike) {\n if (!attributionLike) {\n return null;\n }\n if (typeof attributionLike === 'function') {\n return attributionLike;\n }\n if (!Array.isArray(attributionLike)) {\n attributionLike = [attributionLike];\n }\n return (frameState) => attributionLike;\n}\n\nexport default Source;\n","/**\n * @module ol/source/Tile\n */\nimport Event from '../events/Event.js';\nimport {scale as scaleSize, toSize} from '../size.js';\nimport {withinExtentAndZ} from '../tilecoord.js';\nimport {\n getForProjection as getTileGridForProjection,\n wrapX,\n} from '../tilegrid.js';\nimport {abstract, getUid} from '../util.js';\nimport Source from './Source.js';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<import(\"./TileEventType\").TileSourceEventTypes, TileSourceEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * import(\"./TileEventType\").TileSourceEventTypes, Return>} TileSourceOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {number} [tilePixelRatio] TilePixelRatio.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection.\n * @property {import(\"./Source.js\").State} [state] State.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] TileGrid.\n * @property {boolean} [wrapX=false] WrapX.\n * @property {number} [transition] Transition.\n * @property {string} [key] Key.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0] ZDirection.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for sources providing images divided into a tile grid.\n *\n * @template {import(\"../Tile.js\").default} [TileType=import(\"../Tile.js\").default]\n * @abstract\n * @api\n */\nclass TileSource extends Source {\n /**\n * @param {Options} options SourceTile source options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n projection: options.projection,\n state: options.state,\n wrapX: options.wrapX,\n interpolate: options.interpolate,\n });\n\n /***\n * @type {TileSourceOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {TileSourceOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {TileSourceOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {number}\n */\n this.tilePixelRatio_ =\n options.tilePixelRatio !== undefined ? options.tilePixelRatio : 1;\n\n /**\n * @type {import(\"../tilegrid/TileGrid.js\").default|null}\n * @protected\n */\n this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;\n\n const tileSize = [256, 256];\n if (this.tileGrid) {\n toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), tileSize);\n }\n\n /**\n * @protected\n * @type {import(\"../size.js\").Size}\n */\n this.tmpSize = [0, 0];\n\n /**\n * @private\n * @type {string}\n */\n this.key_ = options.key || getUid(this);\n\n /**\n * @protected\n * @type {import(\"../Tile.js\").Options}\n */\n this.tileOptions = {\n transition: options.transition,\n interpolate: options.interpolate,\n };\n\n /**\n * zDirection hint, read by the renderer. Indicates which resolution should be used\n * by a renderer if the views resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @type {number|import(\"../array.js\").NearestDirectionFunction}\n */\n this.zDirection = options.zDirection ? options.zDirection : 0;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {number} Gutter.\n */\n getGutterForProjection(projection) {\n return 0;\n }\n\n /**\n * Return the key to be used for all tiles in the source.\n * @return {string} The key for all tiles.\n */\n getKey() {\n return this.key_;\n }\n\n /**\n * Set the value to be used as the key for all tiles in the source.\n * @param {string} key The key for tiles.\n * @protected\n */\n setKey(key) {\n if (this.key_ !== key) {\n this.key_ = key;\n this.changed();\n }\n }\n\n /**\n * @param {import(\"../proj/Projection\").default} [projection] Projection.\n * @return {Array<number>|null} Resolutions.\n * @override\n */\n getResolutions(projection) {\n const tileGrid = projection\n ? this.getTileGridForProjection(projection)\n : this.tileGrid;\n if (!tileGrid) {\n return null;\n }\n return tileGrid.getResolutions();\n }\n\n /**\n * @abstract\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {TileType|null} Tile.\n */\n getTile(z, x, y, pixelRatio, projection) {\n return abstract();\n }\n\n /**\n * Return the tile grid of the tile source.\n * @return {import(\"../tilegrid/TileGrid.js\").default|null} Tile grid.\n * @api\n */\n getTileGrid() {\n return this.tileGrid;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../tilegrid/TileGrid.js\").default} Tile grid.\n */\n getTileGridForProjection(projection) {\n if (!this.tileGrid) {\n return getTileGridForProjection(projection);\n }\n return this.tileGrid;\n }\n\n /**\n * Get the tile pixel ratio for this source. Subclasses may override this\n * method, which is meant to return a supported pixel ratio that matches the\n * provided `pixelRatio` as close as possible.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Tile pixel ratio.\n */\n getTilePixelRatio(pixelRatio) {\n return this.tilePixelRatio_;\n }\n\n /**\n * @param {number} z Z.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../size.js\").Size} Tile size.\n */\n getTilePixelSize(z, pixelRatio, projection) {\n const tileGrid = this.getTileGridForProjection(projection);\n const tilePixelRatio = this.getTilePixelRatio(pixelRatio);\n const tileSize = toSize(tileGrid.getTileSize(z), this.tmpSize);\n if (tilePixelRatio == 1) {\n return tileSize;\n }\n return scaleSize(tileSize, tilePixelRatio, this.tmpSize);\n }\n\n /**\n * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate\n * is outside the resolution and extent range of the tile grid, `null` will be\n * returned.\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../proj/Projection.js\").default} [projection] Projection.\n * @return {import(\"../tilecoord.js\").TileCoord} Tile coordinate to be passed to the tileUrlFunction or\n * null if no tile URL should be created for the passed `tileCoord`.\n */\n getTileCoordForTileUrlFunction(tileCoord, projection) {\n const gridProjection =\n projection !== undefined ? projection : this.getProjection();\n const tileGrid =\n projection !== undefined\n ? this.getTileGridForProjection(gridProjection)\n : this.tileGrid || this.getTileGridForProjection(gridProjection);\n if (this.getWrapX() && gridProjection.isGlobal()) {\n tileCoord = wrapX(tileGrid, tileCoord, gridProjection);\n }\n return withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;\n }\n\n /**\n * Remove all cached reprojected tiles from the source. The next render cycle will create new tiles.\n * @api\n */\n clear() {}\n\n /**\n * @override\n */\n refresh() {\n this.clear();\n super.refresh();\n }\n}\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/source/Tile~TileSource} instances are instances of this\n * type.\n */\nexport class TileSourceEvent extends Event {\n /**\n * @param {string} type Type.\n * @param {import(\"../Tile.js\").default} tile The tile.\n */\n constructor(type, tile) {\n super(type);\n\n /**\n * The tile related to the event.\n * @type {import(\"../Tile.js\").default}\n * @api\n */\n this.tile = tile;\n }\n}\n\nexport default TileSource;\n","/**\n * @module ol/source/TileEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a tile starts loading.\n * @event module:ol/source/Tile.TileSourceEvent#tileloadstart\n * @api\n */\n TILELOADSTART: 'tileloadstart',\n\n /**\n * Triggered when a tile finishes loading, either when its data is loaded,\n * or when loading was aborted because the tile is no longer needed.\n * @event module:ol/source/Tile.TileSourceEvent#tileloadend\n * @api\n */\n TILELOADEND: 'tileloadend',\n\n /**\n * Triggered if tile loading results in an error. Note that this is not the\n * right place to re-fetch tiles. See {@link module:ol/ImageTile~ImageTile#load}\n * for details.\n * @event module:ol/source/Tile.TileSourceEvent#tileloaderror\n * @api\n */\n TILELOADERROR: 'tileloaderror',\n};\n\n/**\n * @typedef {'tileloadstart'|'tileloadend'|'tileloaderror'} TileSourceEventTypes\n */\n","/**\n * @module ol/source/UrlTile\n */\nimport TileState from '../TileState.js';\nimport {createFromTemplates} from '../tileurlfunction.js';\nimport {expandUrl} from '../uri.js';\nimport {getUid} from '../util.js';\nimport TileSource, {TileSourceEvent} from './Tile.js';\nimport TileEventType from './TileEventType.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection.\n * @property {import(\"./Source.js\").State} [state] State.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] TileGrid.\n * @property {import(\"../Tile.js\").LoadFunction} tileLoadFunction TileLoadFunction.\n * @property {number} [tilePixelRatio] TilePixelRatio.\n * @property {import(\"../Tile.js\").UrlFunction} [tileUrlFunction] Deprecated. Use an ImageTile source and provide a function\n * for the url option instead.\n * @property {string} [url] Url.\n * @property {Array<string>} [urls] Urls.\n * @property {boolean} [wrapX=true] WrapX.\n * @property {number} [transition] Transition.\n * @property {string} [key] Key.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0] ZDirection.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n */\n\n/**\n * @deprecated Use the ol/source/ImageTile.js instead.\n *\n * @fires import(\"./Tile.js\").TileSourceEvent\n */\nclass UrlTile extends TileSource {\n /**\n * @param {Options} options Image tile options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n projection: options.projection,\n state: options.state,\n tileGrid: options.tileGrid,\n tilePixelRatio: options.tilePixelRatio,\n wrapX: options.wrapX,\n transition: options.transition,\n interpolate: options.interpolate,\n key: options.key,\n attributionsCollapsible: options.attributionsCollapsible,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {boolean}\n */\n this.generateTileUrlFunction_ =\n this.tileUrlFunction === UrlTile.prototype.tileUrlFunction;\n\n /**\n * @protected\n * @type {import(\"../Tile.js\").LoadFunction}\n */\n this.tileLoadFunction = options.tileLoadFunction;\n\n if (options.tileUrlFunction) {\n this.tileUrlFunction = options.tileUrlFunction;\n }\n\n /**\n * @protected\n * @type {!Array<string>|null}\n */\n this.urls = null;\n\n if (options.urls) {\n this.setUrls(options.urls);\n } else if (options.url) {\n this.setUrl(options.url);\n }\n\n /**\n * @private\n * @type {!Object<string, boolean>}\n */\n this.tileLoadingKeys_ = {};\n }\n\n /**\n * Deprecated. Use an ImageTile source instead.\n * Return the tile load function of the source.\n * @return {import(\"../Tile.js\").LoadFunction} TileLoadFunction\n * @api\n */\n getTileLoadFunction() {\n return this.tileLoadFunction;\n }\n\n /**\n * Deprecated. Use an ImageTile source instead.\n * Return the tile URL function of the source.\n * @return {import(\"../Tile.js\").UrlFunction} TileUrlFunction\n * @api\n */\n getTileUrlFunction() {\n return Object.getPrototypeOf(this).tileUrlFunction === this.tileUrlFunction\n ? this.tileUrlFunction.bind(this)\n : this.tileUrlFunction;\n }\n\n /**\n * Deprecated. Use an ImageTile source instead.\n * Return the URLs used for this source.\n * When a tileUrlFunction is used instead of url or urls,\n * null will be returned.\n * @return {!Array<string>|null} URLs.\n * @api\n */\n getUrls() {\n return this.urls;\n }\n\n /**\n * Handle tile change events.\n * @param {import(\"../events/Event.js\").default} event Event.\n * @protected\n */\n handleTileChange(event) {\n const tile = /** @type {import(\"../Tile.js\").default} */ (event.target);\n const uid = getUid(tile);\n const tileState = tile.getState();\n let type;\n if (tileState == TileState.LOADING) {\n this.tileLoadingKeys_[uid] = true;\n type = TileEventType.TILELOADSTART;\n } else if (uid in this.tileLoadingKeys_) {\n delete this.tileLoadingKeys_[uid];\n type =\n tileState == TileState.ERROR\n ? TileEventType.TILELOADERROR\n : tileState == TileState.LOADED\n ? TileEventType.TILELOADEND\n : undefined;\n }\n if (type != undefined) {\n this.dispatchEvent(new TileSourceEvent(type, tile));\n }\n }\n\n /**\n * Deprecated. Use an ImageTile source instead.\n * Set the tile load function of the source.\n * @param {import(\"../Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @api\n */\n setTileLoadFunction(tileLoadFunction) {\n this.tileLoadFunction = tileLoadFunction;\n this.changed();\n }\n\n /**\n * Deprecated. Use an ImageTile source instead.\n * Set the tile URL function of the source.\n * @param {import(\"../Tile.js\").UrlFunction} tileUrlFunction Tile URL function.\n * @param {string} [key] Optional new tile key for the source.\n * @api\n */\n setTileUrlFunction(tileUrlFunction, key) {\n this.tileUrlFunction = tileUrlFunction;\n if (typeof key !== 'undefined') {\n this.setKey(key);\n } else {\n this.changed();\n }\n }\n\n /**\n * Set the URL to use for requests.\n * @param {string} url URL.\n * @api\n */\n setUrl(url) {\n const urls = expandUrl(url);\n this.urls = urls;\n this.setUrls(urls);\n }\n\n /**\n * Deprecated. Use an ImageTile source instead.\n * Set the URLs to use for requests.\n * @param {Array<string>} urls URLs.\n * @api\n */\n setUrls(urls) {\n this.urls = urls;\n const key = urls.join('\\n');\n if (this.generateTileUrlFunction_) {\n this.setTileUrlFunction(createFromTemplates(urls, this.tileGrid), key);\n } else {\n this.setKey(key);\n }\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n tileUrlFunction(tileCoord, pixelRatio, projection) {\n return undefined;\n }\n}\n\nexport default UrlTile;\n","/**\n * @module ol/source/TileImage\n */\nimport ImageTile from '../ImageTile.js';\nimport TileState from '../TileState.js';\nimport EventType from '../events/EventType.js';\nimport {equivalent, get as getProjection} from '../proj.js';\nimport ReprojTile from '../reproj/Tile.js';\nimport {getForProjection as getTileGridForProjection} from '../tilegrid.js';\nimport {getUid} from '../util.js';\nimport UrlTile from './UrlTile.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"./Source.js\").State} [state] Source state.\n * @property {typeof import(\"../ImageTile.js\").default} [tileClass] Class used to instantiate image tiles.\n * Default is {@link module:ol/ImageTile~ImageTile}.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile\n * service advertizes 256px by 256px tiles but actually sends 512px\n * by 512px images (for retina/hidpi devices) then `tilePixelRatio`\n * should be set to `2`.\n * @property {import(\"../Tile.js\").UrlFunction} [tileUrlFunction] Deprecated. Use an ImageTile source and provide a function\n * for the url option instead.\n * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.\n * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be\n * used instead of defining each one separately in the `urls` option.\n * @property {Array<string>} [urls] An array of URL templates.\n * @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to\n * request out-of-bounds tiles from the server. When set to `false`, only one\n * world will be rendered. When set to `true`, tiles will be requested for one\n * world only, but they will be wrapped horizontally to render multiple worlds.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {string} [key] Optional tile key for proper cache fetching\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @deprecated Use the ol/source/ImageTile.js instead.\n *\n * @fires import(\"./Tile.js\").TileSourceEvent\n * @api\n */\nclass TileImage extends UrlTile {\n /**\n * @param {!Options} options Image tile options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n projection: options.projection,\n state: options.state,\n tileGrid: options.tileGrid,\n tileLoadFunction: options.tileLoadFunction\n ? options.tileLoadFunction\n : defaultTileLoadFunction,\n tilePixelRatio: options.tilePixelRatio,\n tileUrlFunction: options.tileUrlFunction,\n url: options.url,\n urls: options.urls,\n wrapX: options.wrapX,\n transition: options.transition,\n interpolate:\n options.interpolate !== undefined ? options.interpolate : true,\n key: options.key,\n attributionsCollapsible: options.attributionsCollapsible,\n zDirection: options.zDirection,\n });\n\n /**\n * @protected\n * @type {?string}\n */\n this.crossOrigin =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n /**\n * @protected\n * @type {typeof ImageTile}\n */\n this.tileClass =\n options.tileClass !== undefined ? options.tileClass : ImageTile;\n\n /**\n * @protected\n * @type {!Object<string, import(\"../tilegrid/TileGrid.js\").default>}\n */\n this.tileGridForProjection = {};\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderReprojectionEdges_ = false;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {number} Gutter.\n * @override\n */\n getGutterForProjection(projection) {\n if (\n this.getProjection() &&\n projection &&\n !equivalent(this.getProjection(), projection)\n ) {\n return 0;\n }\n return this.getGutter();\n }\n\n /**\n * @return {number} Gutter.\n */\n getGutter() {\n return 0;\n }\n\n /**\n * Return the key to be used for all tiles in the source.\n * @return {string} The key for all tiles.\n * @override\n */\n getKey() {\n let key = super.getKey();\n if (!this.getInterpolate()) {\n key += ':disable-interpolation';\n }\n return key;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../tilegrid/TileGrid.js\").default} Tile grid.\n * @override\n */\n getTileGridForProjection(projection) {\n const thisProj = this.getProjection();\n if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) {\n return this.tileGrid;\n }\n const projKey = getUid(projection);\n if (!(projKey in this.tileGridForProjection)) {\n this.tileGridForProjection[projKey] =\n getTileGridForProjection(projection);\n }\n return this.tileGridForProjection[projKey];\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {string} key The key set on the tile.\n * @return {!ImageTile} Tile.\n * @private\n */\n createTile_(z, x, y, pixelRatio, projection, key) {\n const tileCoord = [z, x, y];\n const urlTileCoord = this.getTileCoordForTileUrlFunction(\n tileCoord,\n projection,\n );\n const tileUrl = urlTileCoord\n ? this.tileUrlFunction(urlTileCoord, pixelRatio, projection)\n : undefined;\n const tile = new this.tileClass(\n tileCoord,\n tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY,\n tileUrl !== undefined ? tileUrl : '',\n this.crossOrigin,\n this.tileLoadFunction,\n this.tileOptions,\n );\n tile.key = key;\n tile.addEventListener(EventType.CHANGE, this.handleTileChange.bind(this));\n return tile;\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!(ImageTile|ReprojTile)} Tile.\n * @override\n */\n getTile(z, x, y, pixelRatio, projection) {\n const sourceProjection = this.getProjection();\n if (\n !sourceProjection ||\n !projection ||\n equivalent(sourceProjection, projection)\n ) {\n return this.getTileInternal(\n z,\n x,\n y,\n pixelRatio,\n sourceProjection || projection,\n );\n }\n const tileCoord = [z, x, y];\n const key = this.getKey();\n const sourceTileGrid = this.getTileGridForProjection(sourceProjection);\n const targetTileGrid = this.getTileGridForProjection(projection);\n const wrappedTileCoord = this.getTileCoordForTileUrlFunction(\n tileCoord,\n projection,\n );\n const tile = new ReprojTile(\n sourceProjection,\n sourceTileGrid,\n projection,\n targetTileGrid,\n tileCoord,\n wrappedTileCoord,\n this.getTilePixelRatio(pixelRatio),\n this.getGutter(),\n (z, x, y, pixelRatio) =>\n this.getTileInternal(z, x, y, pixelRatio, sourceProjection),\n this.reprojectionErrorThreshold_,\n this.renderReprojectionEdges_,\n this.tileOptions,\n );\n tile.key = key;\n return tile;\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {!import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!ImageTile} Tile.\n * @protected\n */\n getTileInternal(z, x, y, pixelRatio, projection) {\n const key = this.getKey();\n return this.createTile_(z, x, y, pixelRatio, projection, key);\n }\n\n /**\n * Sets whether to render reprojection edges or not (usually for debugging).\n * @param {boolean} render Render the edges.\n * @api\n */\n setRenderReprojectionEdges(render) {\n if (this.renderReprojectionEdges_ == render) {\n return;\n }\n this.renderReprojectionEdges_ = render;\n this.changed();\n }\n\n /**\n * Sets the tile grid to use when reprojecting the tiles to the given\n * projection instead of the default tile grid for the projection.\n *\n * This can be useful when the default tile grid cannot be created\n * (e.g. projection has no extent defined) or\n * for optimization reasons (custom tile size, resolutions, ...).\n *\n * @param {import(\"../proj.js\").ProjectionLike} projection Projection.\n * @param {import(\"../tilegrid/TileGrid.js\").default} tilegrid Tile grid to use for the projection.\n * @api\n */\n setTileGridForProjection(projection, tilegrid) {\n const proj = getProjection(projection);\n if (proj) {\n const projKey = getUid(proj);\n if (!(projKey in this.tileGridForProjection)) {\n this.tileGridForProjection[projKey] = tilegrid;\n }\n }\n }\n}\n\n/**\n * @param {ImageTile} imageTile Image tile.\n * @param {string} src Source.\n */\nfunction defaultTileLoadFunction(imageTile, src) {\n /** @type {HTMLImageElement|HTMLVideoElement} */ (imageTile.getImage()).src =\n src;\n}\n\nexport default TileImage;\n","/**\n * @module ol/source/BingMaps\n */\n\nimport {applyTransform, intersects} from '../extent.js';\nimport {get as getProjection, getTransformFromProjections} from '../proj.js';\nimport {createOrUpdate} from '../tilecoord.js';\nimport {createXYZ, extentFromProjection} from '../tilegrid.js';\nimport {createFromTileUrlFunctions} from '../tileurlfunction.js';\nimport TileImage from './TileImage.js';\n\n/**\n * @param {import('../tilecoord.js').TileCoord} tileCoord Tile coord.\n * @return {string} Quad key.\n */\nexport function quadKey(tileCoord) {\n const z = tileCoord[0];\n const digits = new Array(z);\n let mask = 1 << (z - 1);\n let i, charCode;\n for (i = 0; i < z; ++i) {\n // 48 is charCode for 0 - '0'.charCodeAt(0)\n charCode = 48;\n if (tileCoord[1] & mask) {\n charCode += 1;\n }\n if (tileCoord[2] & mask) {\n charCode += 2;\n }\n digits[i] = String.fromCharCode(charCode);\n mask >>= 1;\n }\n return digits.join('');\n}\n\n/**\n * The attribution containing a link to the Microsoft® Bing™ Maps Platform APIs’\n * Terms Of Use.\n * @const\n * @type {string}\n */\nconst TOS_ATTRIBUTION =\n '<a class=\"ol-attribution-bing-tos\" ' +\n 'href=\"https://www.microsoft.com/maps/product/terms.html\" target=\"_blank\">' +\n 'Terms of Use</a>';\n\n/**\n * @typedef {Object} Options\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {boolean} [hidpi=false] If `true` hidpi tiles will be requested.\n * @property {string} [culture='en-us'] Culture code.\n * @property {string} key Bing Maps API key. Get yours at https://www.bingmapsportal.com/.\n * @property {string} imagerySet Type of imagery.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {number} [maxZoom=21] Max zoom. Default is what's advertized by the BingMaps service.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n * @property {boolean} [placeholderTiles] Whether to show BingMaps placeholder tiles when zoomed past the maximum level provided in an area. When `false`, requests beyond\n * the maximum zoom level will return no tile. When `true`, the placeholder tile will be returned. When not set, the default behaviour of the imagery set takes place,\n * which is unique for each imagery set in BingMaps.\n */\n\n/**\n * @typedef {Object} BingMapsImageryMetadataResponse\n * @property {number} statusCode The response status code\n * @property {string} statusDescription The response status description\n * @property {string} authenticationResultCode The authentication result code\n * @property {Array<ResourceSet>} resourceSets The array of resource sets\n */\n\n/**\n * @typedef {Object} ResourceSet\n * @property {Array<Resource>} resources Resources.\n */\n\n/**\n * @typedef {Object} Resource\n * @property {number} imageHeight The image height\n * @property {number} imageWidth The image width\n * @property {number} zoomMin The minimum zoom level\n * @property {number} zoomMax The maximum zoom level\n * @property {string} imageUrl The image URL\n * @property {Array<string>} imageUrlSubdomains The image URL subdomains for rotation\n * @property {Array<ImageryProvider>} [imageryProviders] The array of ImageryProviders\n */\n\n/**\n * @typedef {Object} ImageryProvider\n * @property {Array<CoverageArea>} coverageAreas The coverage areas\n * @property {string} [attribution] The attribution\n */\n\n/**\n * @typedef {Object} CoverageArea\n * @property {number} zoomMin The minimum zoom\n * @property {number} zoomMax The maximum zoom\n * @property {Array<number>} bbox The coverage bounding box\n */\n\n/**\n * @classdesc\n * Layer source for Bing Maps tile data.\n * @api\n */\nclass BingMaps extends TileImage {\n /**\n * @param {Options} options Bing Maps options.\n */\n constructor(options) {\n const hidpi = options.hidpi !== undefined ? options.hidpi : false;\n\n super({\n cacheSize: options.cacheSize,\n crossOrigin: 'anonymous',\n interpolate: options.interpolate,\n projection: getProjection('EPSG:3857'),\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n state: 'loading',\n tileLoadFunction: options.tileLoadFunction,\n tilePixelRatio: hidpi ? 2 : 1,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {boolean}\n */\n this.hidpi_ = hidpi;\n\n /**\n * @private\n * @type {string}\n */\n this.culture_ = options.culture !== undefined ? options.culture : 'en-us';\n\n /**\n * @private\n * @type {number}\n */\n this.maxZoom_ = options.maxZoom !== undefined ? options.maxZoom : -1;\n\n /**\n * @private\n * @type {string}\n */\n this.apiKey_ = options.key;\n\n /**\n * @private\n * @type {string}\n */\n this.imagerySet_ = options.imagerySet;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.placeholderTiles_ = options.placeholderTiles;\n\n const url =\n 'https://dev.virtualearth.net/REST/v1/Imagery/Metadata/' +\n this.imagerySet_ +\n '?uriScheme=https&include=ImageryProviders&key=' +\n this.apiKey_ +\n '&c=' +\n this.culture_;\n\n fetch(url)\n .then((response) => response.json())\n .then((json) => this.handleImageryMetadataResponse(json));\n }\n\n /**\n * Get the api key used for this source.\n *\n * @return {string} The api key.\n * @api\n */\n getApiKey() {\n return this.apiKey_;\n }\n\n /**\n * Get the imagery set associated with this source.\n *\n * @return {string} The imagery set.\n * @api\n */\n getImagerySet() {\n return this.imagerySet_;\n }\n\n /**\n * @param {BingMapsImageryMetadataResponse} response Response.\n */\n handleImageryMetadataResponse(response) {\n if (\n response.statusCode != 200 ||\n response.statusDescription != 'OK' ||\n response.authenticationResultCode != 'ValidCredentials' ||\n response.resourceSets.length != 1 ||\n response.resourceSets[0].resources.length != 1\n ) {\n this.setState('error');\n return;\n }\n\n const resource = response.resourceSets[0].resources[0];\n const maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_;\n\n const sourceProjection = this.getProjection();\n const extent = extentFromProjection(sourceProjection);\n const scale = this.hidpi_ ? 2 : 1;\n const tileSize =\n resource.imageWidth == resource.imageHeight\n ? resource.imageWidth / scale\n : [resource.imageWidth / scale, resource.imageHeight / scale];\n\n const tileGrid = createXYZ({\n extent: extent,\n minZoom: resource.zoomMin,\n maxZoom: maxZoom,\n tileSize: tileSize,\n });\n this.tileGrid = tileGrid;\n\n const culture = this.culture_;\n const hidpi = this.hidpi_;\n const placeholderTiles = this.placeholderTiles_;\n this.tileUrlFunction = createFromTileUrlFunctions(\n resource.imageUrlSubdomains.map(function (subdomain) {\n /** @type {import('../tilecoord.js').TileCoord} */\n const quadKeyTileCoord = [0, 0, 0];\n const imageUrl = resource.imageUrl\n .replace('{subdomain}', subdomain)\n .replace('{culture}', culture);\n return (\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n function (tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n }\n createOrUpdate(\n tileCoord[0],\n tileCoord[1],\n tileCoord[2],\n quadKeyTileCoord,\n );\n const url = new URL(\n imageUrl.replace('{quadkey}', quadKey(quadKeyTileCoord)),\n );\n const params = url.searchParams;\n if (hidpi) {\n params.set('dpi', 'd1');\n params.set('device', 'mobile');\n }\n if (placeholderTiles === true) {\n params.delete('n');\n } else if (placeholderTiles === false) {\n params.set('n', 'z');\n }\n return url.toString();\n }\n );\n }),\n );\n\n if (resource.imageryProviders) {\n const transform = getTransformFromProjections(\n getProjection('EPSG:4326'),\n this.getProjection(),\n );\n\n this.setAttributions((frameState) => {\n const attributions = [];\n const viewState = frameState.viewState;\n const tileGrid = this.getTileGrid();\n const z = tileGrid.getZForResolution(\n viewState.resolution,\n this.zDirection,\n );\n const tileCoord = tileGrid.getTileCoordForCoordAndZ(\n viewState.center,\n z,\n );\n const zoom = tileCoord[0];\n resource.imageryProviders.map(function (imageryProvider) {\n let intersecting = false;\n const coverageAreas = imageryProvider.coverageAreas;\n for (let i = 0, ii = coverageAreas.length; i < ii; ++i) {\n const coverageArea = coverageAreas[i];\n if (zoom >= coverageArea.zoomMin && zoom <= coverageArea.zoomMax) {\n const bbox = coverageArea.bbox;\n const epsg4326Extent = [bbox[1], bbox[0], bbox[3], bbox[2]];\n const extent = applyTransform(epsg4326Extent, transform);\n if (intersects(extent, frameState.extent)) {\n intersecting = true;\n break;\n }\n }\n }\n if (intersecting) {\n attributions.push(imageryProvider.attribution);\n }\n });\n\n attributions.push(TOS_ATTRIBUTION);\n return attributions;\n });\n }\n\n this.setState('ready');\n }\n}\n\nexport default BingMaps;\n","/**\n * @module ol/source/XYZ\n */\n\nimport {createXYZ, extentFromProjection} from '../tilegrid.js';\nimport TileImage from './TileImage.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Projection.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {number} [maxZoom=42] Optional max zoom level. Not used if `tileGrid` is provided.\n * @property {number} [minZoom=0] Optional min zoom level. Not used if `tileGrid` is provided.\n * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Deprecated. Use an ImageTile source with a loader\n * instead. Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.\n * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px\n * by 512px images (for retina/hidpi devices) then `tilePixelRatio`\n * should be set to `2`.\n * @property {number|import(\"../size.js\").Size} [tileSize=[256, 256]] The tile size used by the tile service.\n * Not used if `tileGrid` is provided.\n * @property {number} [gutter=0] The size in pixels of the gutter around image tiles to ignore.\n * This allows artifacts of rendering at tile edges to be ignored.\n * Supported images should be wider and taller than the tile size by a value of `2 x gutter`.\n * @property {import(\"../Tile.js\").UrlFunction} [tileUrlFunction] Deprecated. Use an ImageTile source and provide a function\n * for the url option instead.\n * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`,\n * and `{z}` placeholders. A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`,\n * may be used instead of defining each one separately in the `urls` option.\n * @property {Array<string>} [urls] Deprecated. Use an ImageTile source and provide an array of URLs for the\n * url option instead.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number} [transition=250] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for tile data with URLs in a set XYZ format that are\n * defined in a URL template. By default, this follows the widely-used\n * Google grid where `x` 0 and `y` 0 are in the top left. Grids like\n * TMS where `x` 0 and `y` 0 are in the bottom left can be used by\n * using the `{-y}` placeholder in the URL template, so long as the\n * source does not have a custom tile grid. In this case\n * a `tileUrlFunction` can be used, such as:\n * ```js\n * tileUrlFunction: function(coordinate) {\n * return 'http://mapserver.com/' + coordinate[0] + '/' +\n * coordinate[1] + '/' + (-coordinate[2] - 1) + '.png';\n * }\n * ```\n * @api\n */\nclass XYZ extends TileImage {\n /**\n * @param {Options} [options] XYZ options.\n */\n constructor(options) {\n options = options || {};\n\n const projection =\n options.projection !== undefined ? options.projection : 'EPSG:3857';\n\n const tileGrid =\n options.tileGrid !== undefined\n ? options.tileGrid\n : createXYZ({\n extent: extentFromProjection(projection),\n maxResolution: options.maxResolution,\n maxZoom: options.maxZoom,\n minZoom: options.minZoom,\n tileSize: options.tileSize,\n });\n\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n interpolate: options.interpolate,\n projection: projection,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileGrid: tileGrid,\n tileLoadFunction: options.tileLoadFunction,\n tilePixelRatio: options.tilePixelRatio,\n tileUrlFunction: options.tileUrlFunction,\n url: options.url,\n urls: options.urls,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n attributionsCollapsible: options.attributionsCollapsible,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {number}\n */\n this.gutter_ = options.gutter !== undefined ? options.gutter : 0;\n }\n\n /**\n * @return {number} Gutter.\n * @override\n */\n getGutter() {\n return this.gutter_;\n }\n}\n\nexport default XYZ;\n","/**\n * @module ol/geom/flat/center\n */\nimport {createEmpty, createOrUpdateFromFlatCoordinates} from '../../extent.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<Array<number>>} endss Endss.\n * @param {number} stride Stride.\n * @return {Array<number>} Flat centers.\n */\nexport function linearRingss(flatCoordinates, offset, endss, stride) {\n const flatCenters = [];\n let extent = createEmpty();\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n extent = createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n ends[0],\n stride,\n );\n flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);\n offset = ends[ends.length - 1];\n }\n return flatCenters;\n}\n","/**\n * @module ol/geom/flat/interpolate\n */\nimport {binarySearch} from '../../array.js';\nimport {lerp} from '../../math.js';\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} fraction Fraction.\n * @param {Array<number>} [dest] Destination.\n * @param {number} [dimension] Destination dimension (default is `2`)\n * @return {Array<number>} Destination.\n */\nexport function interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n fraction,\n dest,\n dimension,\n) {\n let o, t;\n const n = (end - offset) / stride;\n if (n === 1) {\n o = offset;\n } else if (n === 2) {\n o = offset;\n t = fraction;\n } else if (n !== 0) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n const cumulativeLengths = [0];\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n cumulativeLengths.push(length);\n x1 = x2;\n y1 = y2;\n }\n const target = fraction * length;\n const index = binarySearch(cumulativeLengths, target);\n if (index < 0) {\n t =\n (target - cumulativeLengths[-index - 2]) /\n (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);\n o = offset + (-index - 2) * stride;\n } else {\n o = offset + index * stride;\n }\n }\n dimension = dimension > 1 ? dimension : 2;\n dest = dest ? dest : new Array(dimension);\n for (let i = 0; i < dimension; ++i) {\n dest[i] =\n o === undefined\n ? NaN\n : t === undefined\n ? flatCoordinates[o + i]\n : lerp(flatCoordinates[o + i], flatCoordinates[o + stride + i], t);\n }\n return dest;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @return {import(\"../../coordinate.js\").Coordinate|null} Coordinate.\n */\nexport function lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n extrapolate,\n) {\n if (end == offset) {\n return null;\n }\n let coordinate;\n if (m < flatCoordinates[offset + stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(offset, offset + stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n if (flatCoordinates[end - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(end - stride, end);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n // FIXME use O(1) search\n if (m == flatCoordinates[offset + stride - 1]) {\n return flatCoordinates.slice(offset, offset + stride);\n }\n let lo = offset / stride;\n let hi = end / stride;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m < flatCoordinates[(mid + 1) * stride - 1]) {\n hi = mid;\n } else {\n lo = mid + 1;\n }\n }\n const m0 = flatCoordinates[lo * stride - 1];\n if (m == m0) {\n return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride);\n }\n const m1 = flatCoordinates[(lo + 1) * stride - 1];\n const t = (m - m0) / (m1 - m0);\n coordinate = [];\n for (let i = 0; i < stride - 1; ++i) {\n coordinate.push(\n lerp(\n flatCoordinates[(lo - 1) * stride + i],\n flatCoordinates[lo * stride + i],\n t,\n ),\n );\n }\n coordinate.push(m);\n return coordinate;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {number} m M.\n * @param {boolean} extrapolate Extrapolate.\n * @param {boolean} interpolate Interpolate.\n * @return {import(\"../../coordinate.js\").Coordinate|null} Coordinate.\n */\nexport function lineStringsCoordinateAtM(\n flatCoordinates,\n offset,\n ends,\n stride,\n m,\n extrapolate,\n interpolate,\n) {\n if (interpolate) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n ends[ends.length - 1],\n stride,\n m,\n extrapolate,\n );\n }\n let coordinate;\n if (m < flatCoordinates[stride - 1]) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(0, stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n if (flatCoordinates[flatCoordinates.length - 1] < m) {\n if (extrapolate) {\n coordinate = flatCoordinates.slice(flatCoordinates.length - stride);\n coordinate[stride - 1] = m;\n return coordinate;\n }\n return null;\n }\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n if (offset == end) {\n continue;\n }\n if (m < flatCoordinates[offset + stride - 1]) {\n return null;\n }\n if (m <= flatCoordinates[end - 1]) {\n return lineStringCoordinateAtM(\n flatCoordinates,\n offset,\n end,\n stride,\n m,\n false,\n );\n }\n offset = end;\n }\n return null;\n}\n","/**\n * @module ol/geom/Circle\n */\nimport {createOrUpdate, forEachCorner, intersects} from '../extent.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {deflateCoordinate} from './flat/deflate.js';\nimport {rotate} from './flat/transform.js';\n\n/**\n * @classdesc\n * Circle geometry.\n *\n * @api\n */\nclass Circle extends SimpleGeometry {\n /**\n * @param {!import(\"../coordinate.js\").Coordinate} center Center.\n * For internal use, flat coordinates in combination with `layout` and no\n * `radius` are also accepted.\n * @param {number} [radius] Radius in units of the projection.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(center, radius, layout) {\n super();\n if (layout !== undefined && radius === undefined) {\n this.setFlatCoordinates(layout, center);\n } else {\n radius = radius ? radius : 0;\n this.setCenterAndRadius(center, radius, layout);\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!Circle} Clone.\n * @api\n * @override\n */\n clone() {\n const circle = new Circle(\n this.flatCoordinates.slice(),\n undefined,\n this.layout,\n );\n circle.applyProperties(this);\n return circle;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n const flatCoordinates = this.flatCoordinates;\n const dx = x - flatCoordinates[0];\n const dy = y - flatCoordinates[1];\n const squaredDistance = dx * dx + dy * dy;\n if (squaredDistance < minSquaredDistance) {\n if (squaredDistance === 0) {\n for (let i = 0; i < this.stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n } else {\n const delta = this.getRadius() / Math.sqrt(squaredDistance);\n closestPoint[0] = flatCoordinates[0] + delta * dx;\n closestPoint[1] = flatCoordinates[1] + delta * dy;\n for (let i = 2; i < this.stride; ++i) {\n closestPoint[i] = flatCoordinates[i];\n }\n }\n closestPoint.length = this.stride;\n return squaredDistance;\n }\n return minSquaredDistance;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n const flatCoordinates = this.flatCoordinates;\n const dx = x - flatCoordinates[0];\n const dy = y - flatCoordinates[1];\n return dx * dx + dy * dy <= this.getRadiusSquared_();\n }\n\n /**\n * Return the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.\n * @return {import(\"../coordinate.js\").Coordinate} Center.\n * @api\n */\n getCenter() {\n return this.flatCoordinates.slice(0, this.stride);\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n const flatCoordinates = this.flatCoordinates;\n const radius = flatCoordinates[this.stride] - flatCoordinates[0];\n return createOrUpdate(\n flatCoordinates[0] - radius,\n flatCoordinates[1] - radius,\n flatCoordinates[0] + radius,\n flatCoordinates[1] + radius,\n extent,\n );\n }\n\n /**\n * Return the radius of the circle.\n * @return {number} Radius.\n * @api\n */\n getRadius() {\n return Math.sqrt(this.getRadiusSquared_());\n }\n\n /**\n * @private\n * @return {number} Radius squared.\n */\n getRadiusSquared_() {\n const dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0];\n const dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1];\n return dx * dx + dy * dy;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'Circle';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n const circleExtent = this.getExtent();\n if (intersects(extent, circleExtent)) {\n const center = this.getCenter();\n\n if (extent[0] <= center[0] && extent[2] >= center[0]) {\n return true;\n }\n if (extent[1] <= center[1] && extent[3] >= center[1]) {\n return true;\n }\n\n return forEachCorner(extent, this.intersectsCoordinate.bind(this));\n }\n return false;\n }\n\n /**\n * Set the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.\n * @param {import(\"../coordinate.js\").Coordinate} center Center.\n * @api\n */\n setCenter(center) {\n const stride = this.stride;\n const radius = this.flatCoordinates[stride] - this.flatCoordinates[0];\n const flatCoordinates = center.slice();\n flatCoordinates[stride] = flatCoordinates[0] + radius;\n for (let i = 1; i < stride; ++i) {\n flatCoordinates[stride + i] = center[i];\n }\n this.setFlatCoordinates(this.layout, flatCoordinates);\n this.changed();\n }\n\n /**\n * Set the center (as {@link module:ol/coordinate~Coordinate coordinate}) and the radius (as\n * number) of the circle.\n * @param {!import(\"../coordinate.js\").Coordinate} center Center.\n * @param {number} radius Radius.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n */\n setCenterAndRadius(center, radius, layout) {\n this.setLayout(layout, center, 0);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n /** @type {Array<number>} */\n const flatCoordinates = this.flatCoordinates;\n let offset = deflateCoordinate(flatCoordinates, 0, center, this.stride);\n flatCoordinates[offset++] = flatCoordinates[0] + radius;\n for (let i = 1, ii = this.stride; i < ii; ++i) {\n flatCoordinates[offset++] = flatCoordinates[i];\n }\n flatCoordinates.length = offset;\n this.changed();\n }\n\n /**\n * @override\n */\n getCoordinates() {\n return null;\n }\n\n /**\n * @override\n */\n setCoordinates(coordinates, layout) {}\n\n /**\n * Set the radius of the circle. The radius is in the units of the projection.\n * @param {number} radius Radius.\n * @api\n */\n setRadius(radius) {\n this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;\n this.changed();\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in counter-clockwise radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n * @override\n */\n rotate(angle, anchor) {\n const center = this.getCenter();\n const stride = this.getStride();\n this.setCenter(\n rotate(center, 0, center.length, stride, angle, anchor, center),\n );\n this.changed();\n }\n}\n\n/**\n * Transform each coordinate of the circle from one coordinate reference system\n * to another. The geometry is modified in place.\n * If you do not want the geometry modified in place, first clone() it and\n * then use this function on the clone.\n *\n * Internally a circle is currently represented by two points: the center of\n * the circle `[cx, cy]`, and the point to the right of the circle\n * `[cx + r, cy]`. This `transform` function just transforms these two points.\n * So the resulting geometry is also a circle, and that circle does not\n * correspond to the shape that would be obtained by transforming every point\n * of the original circle.\n *\n * @param {import(\"../proj.js\").ProjectionLike} source The current projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @param {import(\"../proj.js\").ProjectionLike} destination The desired projection. Can be a\n * string identifier or a {@link module:ol/proj/Projection~Projection} object.\n * @return {Circle} This geometry. Note that original geometry is\n * modified in place.\n * @function\n * @api\n */\nCircle.prototype.transform;\nexport default Circle;\n","/**\n * @module ol/geom/GeometryCollection\n */\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {\n closestSquaredDistanceXY,\n createOrUpdateEmpty,\n extend,\n getCenter,\n} from '../extent.js';\nimport Geometry from './Geometry.js';\n\n/**\n * @classdesc\n * An array of {@link module:ol/geom/Geometry~Geometry} objects.\n *\n * @api\n */\nclass GeometryCollection extends Geometry {\n /**\n * @param {Array<Geometry>} geometries Geometries.\n */\n constructor(geometries) {\n super();\n\n /**\n * @private\n * @type {Array<Geometry>}\n */\n this.geometries_ = geometries;\n\n /**\n * @private\n * @type {Array<import(\"../events.js\").EventsKey>}\n */\n this.changeEventsKeys_ = [];\n\n this.listenGeometriesChange_();\n }\n\n /**\n * @private\n */\n unlistenGeometriesChange_() {\n this.changeEventsKeys_.forEach(unlistenByKey);\n this.changeEventsKeys_.length = 0;\n }\n\n /**\n * @private\n */\n listenGeometriesChange_() {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n this.changeEventsKeys_.push(\n listen(geometries[i], EventType.CHANGE, this.changed, this),\n );\n }\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!GeometryCollection} Clone.\n * @api\n * @override\n */\n clone() {\n const geometryCollection = new GeometryCollection(\n cloneGeometries(this.geometries_),\n );\n geometryCollection.applyProperties(this);\n return geometryCollection;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n minSquaredDistance = geometries[i].closestPointXY(\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n return minSquaredDistance;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].containsXY(x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @protected\n * @return {import(\"../extent.js\").Extent} extent Extent.\n * @override\n */\n computeExtent(extent) {\n createOrUpdateEmpty(extent);\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n extend(extent, geometries[i].getExtent());\n }\n return extent;\n }\n\n /**\n * Return the geometries that make up this geometry collection.\n * @return {Array<Geometry>} Geometries.\n * @api\n */\n getGeometries() {\n return cloneGeometries(this.geometries_);\n }\n\n /**\n * @return {Array<Geometry>} Geometries.\n */\n getGeometriesArray() {\n return this.geometries_;\n }\n\n /**\n * @return {Array<Geometry>} Geometries.\n */\n getGeometriesArrayRecursive() {\n /** @type {Array<Geometry>} */\n let geometriesArray = [];\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].getType() === this.getType()) {\n geometriesArray = geometriesArray.concat(\n /** @type {GeometryCollection} */ (\n geometries[i]\n ).getGeometriesArrayRecursive(),\n );\n } else {\n geometriesArray.push(geometries[i]);\n }\n }\n return geometriesArray;\n }\n\n /**\n * Create a simplified version of this geometry using the Douglas Peucker algorithm.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {GeometryCollection} Simplified GeometryCollection.\n * @override\n */\n getSimplifiedGeometry(squaredTolerance) {\n if (this.simplifiedGeometryRevision !== this.getRevision()) {\n this.simplifiedGeometryMaxMinSquaredTolerance = 0;\n this.simplifiedGeometryRevision = this.getRevision();\n }\n if (\n squaredTolerance < 0 ||\n (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&\n squaredTolerance < this.simplifiedGeometryMaxMinSquaredTolerance)\n ) {\n return this;\n }\n\n const simplifiedGeometries = [];\n const geometries = this.geometries_;\n let simplified = false;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n const geometry = geometries[i];\n const simplifiedGeometry =\n geometry.getSimplifiedGeometry(squaredTolerance);\n simplifiedGeometries.push(simplifiedGeometry);\n if (simplifiedGeometry !== geometry) {\n simplified = true;\n }\n }\n if (simplified) {\n const simplifiedGeometryCollection = new GeometryCollection(\n simplifiedGeometries,\n );\n return simplifiedGeometryCollection;\n }\n this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;\n return this;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'GeometryCollection';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n if (geometries[i].intersectsExtent(extent)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.geometries_.length === 0;\n }\n\n /**\n * Rotate the geometry around a given coordinate. This modifies the geometry\n * coordinates in place.\n * @param {number} angle Rotation angle in radians.\n * @param {import(\"../coordinate.js\").Coordinate} anchor The rotation center.\n * @api\n * @override\n */\n rotate(angle, anchor) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].rotate(angle, anchor);\n }\n this.changed();\n }\n\n /**\n * Scale the geometry (with an optional origin). This modifies the geometry\n * coordinates in place.\n * @abstract\n * @param {number} sx The scaling factor in the x-direction.\n * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).\n * @param {import(\"../coordinate.js\").Coordinate} [anchor] The scale origin (defaults to the center\n * of the geometry extent).\n * @api\n * @override\n */\n scale(sx, sy, anchor) {\n if (!anchor) {\n anchor = getCenter(this.getExtent());\n }\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].scale(sx, sy, anchor);\n }\n this.changed();\n }\n\n /**\n * Set the geometries that make up this geometry collection.\n * @param {Array<Geometry>} geometries Geometries.\n * @api\n */\n setGeometries(geometries) {\n this.setGeometriesArray(cloneGeometries(geometries));\n }\n\n /**\n * @param {Array<Geometry>} geometries Geometries.\n */\n setGeometriesArray(geometries) {\n this.unlistenGeometriesChange_();\n this.geometries_ = geometries;\n this.listenGeometriesChange_();\n this.changed();\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n * Called with a flat array of geometry coordinates.\n * @api\n * @override\n */\n applyTransform(transformFn) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].applyTransform(transformFn);\n }\n this.changed();\n }\n\n /**\n * Translate the geometry. This modifies the geometry coordinates in place. If\n * instead you want a new geometry, first `clone()` this geometry.\n * @param {number} deltaX Delta X.\n * @param {number} deltaY Delta Y.\n * @api\n * @override\n */\n translate(deltaX, deltaY) {\n const geometries = this.geometries_;\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n geometries[i].translate(deltaX, deltaY);\n }\n this.changed();\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.unlistenGeometriesChange_();\n super.disposeInternal();\n }\n}\n\n/**\n * @param {Array<Geometry>} geometries Geometries.\n * @return {Array<Geometry>} Cloned geometries.\n */\nfunction cloneGeometries(geometries) {\n return geometries.map((geometry) => geometry.clone());\n}\n\nexport default GeometryCollection;\n","/**\n * @module ol/geom/flat/length\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Length.\n */\nexport function lineStringLength(flatCoordinates, offset, end, stride) {\n let x1 = flatCoordinates[offset];\n let y1 = flatCoordinates[offset + 1];\n let length = 0;\n for (let i = offset + stride; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n x1 = x2;\n y1 = y2;\n }\n return length;\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {number} Perimeter.\n */\nexport function linearRingLength(flatCoordinates, offset, end, stride) {\n let perimeter = lineStringLength(flatCoordinates, offset, end, stride);\n const dx = flatCoordinates[end - stride] - flatCoordinates[offset];\n const dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];\n perimeter += Math.sqrt(dx * dx + dy * dy);\n return perimeter;\n}\n","/**\n * @module ol/geom/LineString\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {assignClosestPoint, maxSquaredDelta} from './flat/closest.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {inflateCoordinates} from './flat/inflate.js';\nimport {interpolatePoint, lineStringCoordinateAtM} from './flat/interpolate.js';\nimport {intersectsLineString} from './flat/intersectsextent.js';\nimport {lineStringLength} from './flat/length.js';\nimport {forEach as forEachSegment} from './flat/segments.js';\nimport {douglasPeucker} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Linestring geometry.\n *\n * @api\n */\nclass LineString extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n\n /**\n * @private\n * @type {import(\"../coordinate.js\").Coordinate|null}\n */\n this.flatMidpoint_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.flatMidpointRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (layout !== undefined && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed coordinate to the coordinates of the linestring.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @api\n */\n appendCoordinate(coordinate) {\n extend(this.flatCoordinates, coordinate);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!LineString} Clone.\n * @api\n * @override\n */\n clone() {\n const lineString = new LineString(\n this.flatCoordinates.slice(),\n this.layout,\n );\n lineString.applyProperties(this);\n return lineString;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n maxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestPoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Iterate over each segment, calling the provided callback.\n * If the callback returns a truthy value the function returns that\n * value immediately. Otherwise the function returns `false`.\n *\n * @param {function(this: S, import(\"../coordinate.js\").Coordinate, import(\"../coordinate.js\").Coordinate): T} callback Function\n * called for each segment. The function will receive two arguments, the start and end coordinates of the segment.\n * @return {T|boolean} Value.\n * @template T,S\n * @api\n */\n forEachSegment(callback) {\n return forEachSegment(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n callback,\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * @param {number} m M.\n * @param {boolean} [extrapolate] Extrapolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate|null} Coordinate.\n * @api\n */\n getCoordinateAtM(m, extrapolate) {\n if (this.layout != 'XYM' && this.layout != 'XYZM') {\n return null;\n }\n extrapolate = extrapolate !== undefined ? extrapolate : false;\n return lineStringCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n m,\n extrapolate,\n );\n }\n\n /**\n * Return the coordinates of the linestring.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the coordinate at the provided fraction along the linestring.\n * The `fraction` is a number between 0 and 1, where 0 is the start of the\n * linestring and 1 is the end.\n * @param {number} fraction Fraction.\n * @param {import(\"../coordinate.js\").Coordinate} [dest] Optional coordinate whose values will\n * be modified. If not provided, a new coordinate will be returned.\n * @return {import(\"../coordinate.js\").Coordinate} Coordinate of the interpolated point.\n * @api\n */\n getCoordinateAt(fraction, dest) {\n return interpolatePoint(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n fraction,\n dest,\n this.stride,\n );\n }\n\n /**\n * Return the length of the linestring on projected plane.\n * @return {number} Length (on projected plane).\n * @api\n */\n getLength() {\n return lineStringLength(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * @return {Array<number>} Flat midpoint.\n */\n getFlatMidpoint() {\n if (this.flatMidpointRevision_ != this.getRevision()) {\n this.flatMidpoint_ = this.getCoordinateAt(\n 0.5,\n this.flatMidpoint_ ?? undefined,\n );\n this.flatMidpointRevision_ = this.getRevision();\n }\n return /** @type {Array<number>} */ (this.flatMidpoint_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} Simplified LineString.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n simplifiedFlatCoordinates.length = douglasPeucker(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n return new LineString(simplifiedFlatCoordinates, 'XY');\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'LineString';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLineString(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n extent,\n this.getExtent(),\n );\n }\n\n /**\n * Set the coordinates of the linestring.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default LineString;\n","/**\n * @module ol/geom/MultiLineString\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport LineString from './LineString.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {arrayMaxSquaredDelta, assignClosestArrayPoint} from './flat/closest.js';\nimport {deflateCoordinatesArray} from './flat/deflate.js';\nimport {inflateCoordinatesArray} from './flat/inflate.js';\nimport {\n interpolatePoint,\n lineStringsCoordinateAtM,\n} from './flat/interpolate.js';\nimport {intersectsLineStringArray} from './flat/intersectsextent.js';\nimport {lineStringLength} from './flat/length.js';\nimport {douglasPeuckerArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Multi-linestring geometry.\n *\n * @api\n */\nclass MultiLineString extends SimpleGeometry {\n /**\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>|LineString>|Array<number>} coordinates\n * Coordinates or LineString geometries. (For internal use, flat coordinates in\n * combination with `layout` and `ends` are also accepted.)\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array<number>} [ends] Flat coordinate ends for internal use.\n */\n constructor(coordinates, layout, ends) {\n super();\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.ends_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n if (Array.isArray(coordinates[0])) {\n this.setCoordinates(\n /** @type {Array<Array<import(\"../coordinate.js\").Coordinate>>} */ (\n coordinates\n ),\n layout,\n );\n } else if (layout !== undefined && ends) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n this.ends_ = ends;\n } else {\n const lineStrings = /** @type {Array<LineString>} */ (coordinates);\n /** @type {Array<number>} */\n const flatCoordinates = [];\n const ends = [];\n for (let i = 0, ii = lineStrings.length; i < ii; ++i) {\n const lineString = lineStrings[i];\n extend(flatCoordinates, lineString.getFlatCoordinates());\n ends.push(flatCoordinates.length);\n }\n const layout =\n lineStrings.length === 0\n ? this.getLayout()\n : lineStrings[0].getLayout();\n this.setFlatCoordinates(layout, flatCoordinates);\n this.ends_ = ends;\n }\n }\n\n /**\n * Append the passed linestring to the multilinestring.\n * @param {LineString} lineString LineString.\n * @api\n */\n appendLineString(lineString) {\n extend(this.flatCoordinates, lineString.getFlatCoordinates().slice());\n this.ends_.push(this.flatCoordinates.length);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiLineString} Clone.\n * @api\n * @override\n */\n clone() {\n const multiLineString = new MultiLineString(\n this.flatCoordinates.slice(),\n this.layout,\n this.ends_.slice(),\n );\n multiLineString.applyProperties(this);\n return multiLineString;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n arrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestArrayPoint(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n this.maxDelta_,\n false,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * Returns the coordinate at `m` using linear interpolation, or `null` if no\n * such coordinate exists.\n *\n * `extrapolate` controls extrapolation beyond the range of Ms in the\n * MultiLineString. If `extrapolate` is `true` then Ms less than the first\n * M will return the first coordinate and Ms greater than the last M will\n * return the last coordinate.\n *\n * `interpolate` controls interpolation between consecutive LineStrings\n * within the MultiLineString. If `interpolate` is `true` the coordinates\n * will be linearly interpolated between the last coordinate of one LineString\n * and the first coordinate of the next LineString. If `interpolate` is\n * `false` then the function will return `null` for Ms falling between\n * LineStrings.\n *\n * @param {number} m M.\n * @param {boolean} [extrapolate] Extrapolate. Default is `false`.\n * @param {boolean} [interpolate] Interpolate. Default is `false`.\n * @return {import(\"../coordinate.js\").Coordinate|null} Coordinate.\n * @api\n */\n getCoordinateAtM(m, extrapolate, interpolate) {\n if (\n (this.layout != 'XYM' && this.layout != 'XYZM') ||\n this.flatCoordinates.length === 0\n ) {\n return null;\n }\n extrapolate = extrapolate !== undefined ? extrapolate : false;\n interpolate = interpolate !== undefined ? interpolate : false;\n return lineStringsCoordinateAtM(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n m,\n extrapolate,\n interpolate,\n );\n }\n\n /**\n * Return the coordinates of the multilinestring.\n * @return {Array<Array<import(\"../coordinate.js\").Coordinate>>} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n );\n }\n\n /**\n * @return {Array<number>} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * Return the linestring at the specified index.\n * @param {number} index Index.\n * @return {LineString} LineString.\n * @api\n */\n getLineString(index) {\n if (index < 0 || this.ends_.length <= index) {\n return null;\n }\n return new LineString(\n this.flatCoordinates.slice(\n index === 0 ? 0 : this.ends_[index - 1],\n this.ends_[index],\n ),\n this.layout,\n );\n }\n\n /**\n * Return the linestrings of this multilinestring.\n * @return {Array<LineString>} LineStrings.\n * @api\n */\n getLineStrings() {\n const flatCoordinates = this.flatCoordinates;\n const ends = this.ends_;\n const layout = this.layout;\n /** @type {Array<LineString>} */\n const lineStrings = [];\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const lineString = new LineString(\n flatCoordinates.slice(offset, end),\n layout,\n );\n lineStrings.push(lineString);\n offset = end;\n }\n return lineStrings;\n }\n\n /**\n * Return the sum of all line string lengths\n * @return {number} Length (on projected plane).\n * @api\n */\n getLength() {\n const ends = this.ends_;\n let start = 0;\n let length = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n length += lineStringLength(\n this.flatCoordinates,\n start,\n ends[i],\n this.stride,\n );\n start = ends[i];\n }\n return length;\n }\n\n /**\n * @return {Array<number>} Flat midpoints.\n */\n getFlatMidpoints() {\n /** @type {Array<number>} */\n const midpoints = [];\n const flatCoordinates = this.flatCoordinates;\n let offset = 0;\n const ends = this.ends_;\n const stride = this.stride;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const midpoint = interpolatePoint(\n flatCoordinates,\n offset,\n end,\n stride,\n 0.5,\n );\n extend(midpoints, midpoint);\n offset = end;\n }\n return midpoints;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiLineString} Simplified MultiLineString.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array<number>} */\n const simplifiedEnds = [];\n simplifiedFlatCoordinates.length = douglasPeuckerArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n return new MultiLineString(simplifiedFlatCoordinates, 'XY', simplifiedEnds);\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'MultiLineString';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLineStringArray(\n this.flatCoordinates,\n 0,\n this.ends_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the multilinestring.\n * @param {!Array<Array<import(\"../coordinate.js\").Coordinate>>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 2);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const ends = deflateCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.ends_,\n );\n this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];\n this.changed();\n }\n}\n\nexport default MultiLineString;\n","/**\n * @module ol/geom/MultiPoint\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY, containsXY} from '../extent.js';\nimport {squaredDistance as squaredDx} from '../math.js';\nimport Point from './Point.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {deflateCoordinates} from './flat/deflate.js';\nimport {inflateCoordinates} from './flat/inflate.js';\n\n/**\n * @classdesc\n * Multi-point geometry.\n *\n * @api\n */\nclass MultiPoint extends SimpleGeometry {\n /**\n * @param {Array<import(\"../coordinate.js\").Coordinate>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n */\n constructor(coordinates, layout) {\n super();\n if (layout && !Array.isArray(coordinates[0])) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n } else {\n this.setCoordinates(\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed point to this multipoint.\n * @param {Point} point Point.\n * @api\n */\n appendPoint(point) {\n extend(this.flatCoordinates, point.getFlatCoordinates());\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPoint} Clone.\n * @api\n * @override\n */\n clone() {\n const multiPoint = new MultiPoint(\n this.flatCoordinates.slice(),\n this.layout,\n );\n multiPoint.applyProperties(this);\n return multiPoint;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const squaredDistance = squaredDx(\n x,\n y,\n flatCoordinates[i],\n flatCoordinates[i + 1],\n );\n if (squaredDistance < minSquaredDistance) {\n minSquaredDistance = squaredDistance;\n for (let j = 0; j < stride; ++j) {\n closestPoint[j] = flatCoordinates[i + j];\n }\n closestPoint.length = stride;\n }\n }\n return minSquaredDistance;\n }\n\n /**\n * Return the coordinates of the multipoint.\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates.\n * @api\n * @override\n */\n getCoordinates() {\n return inflateCoordinates(\n this.flatCoordinates,\n 0,\n this.flatCoordinates.length,\n this.stride,\n );\n }\n\n /**\n * Return the point at the specified index.\n * @param {number} index Index.\n * @return {Point} Point.\n * @api\n */\n getPoint(index) {\n const n = this.flatCoordinates.length / this.stride;\n if (index < 0 || n <= index) {\n return null;\n }\n return new Point(\n this.flatCoordinates.slice(\n index * this.stride,\n (index + 1) * this.stride,\n ),\n this.layout,\n );\n }\n\n /**\n * Return the points of this multipoint.\n * @return {Array<Point>} Points.\n * @api\n */\n getPoints() {\n const flatCoordinates = this.flatCoordinates;\n const layout = this.layout;\n const stride = this.stride;\n /** @type {Array<Point>} */\n const points = [];\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const point = new Point(flatCoordinates.slice(i, i + stride), layout);\n points.push(point);\n }\n return points;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'MultiPoint';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n const flatCoordinates = this.flatCoordinates;\n const stride = this.stride;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n const x = flatCoordinates[i];\n const y = flatCoordinates[i + 1];\n if (containsXY(extent, x, y)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Set the coordinates of the multipoint.\n * @param {!Array<import(\"../coordinate.js\").Coordinate>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 1);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n this.flatCoordinates.length = deflateCoordinates(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n );\n this.changed();\n }\n}\n\nexport default MultiPoint;\n","/**\n * @module ol/geom/MultiPolygon\n */\nimport {extend} from '../array.js';\nimport {closestSquaredDistanceXY} from '../extent.js';\nimport MultiPoint from './MultiPoint.js';\nimport Polygon from './Polygon.js';\nimport SimpleGeometry from './SimpleGeometry.js';\nimport {linearRingss as linearRingssArea} from './flat/area.js';\nimport {linearRingss as linearRingssCenter} from './flat/center.js';\nimport {\n assignClosestMultiArrayPoint,\n multiArrayMaxSquaredDelta,\n} from './flat/closest.js';\nimport {linearRingssContainsXY} from './flat/contains.js';\nimport {deflateMultiCoordinatesArray} from './flat/deflate.js';\nimport {inflateMultiCoordinatesArray} from './flat/inflate.js';\nimport {getInteriorPointsOfMultiArray} from './flat/interiorpoint.js';\nimport {intersectsLinearRingMultiArray} from './flat/intersectsextent.js';\nimport {\n linearRingssAreOriented,\n orientLinearRingsArray,\n} from './flat/orient.js';\nimport {quantizeMultiArray} from './flat/simplify.js';\n\n/**\n * @classdesc\n * Multi-polygon geometry.\n *\n * @api\n */\nclass MultiPolygon extends SimpleGeometry {\n /**\n * @param {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.\n * For internal use, flat coordinates in combination with `layout` and `endss` are also accepted.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @param {Array<Array<number>>} [endss] Array of ends for internal use with flat coordinates.\n */\n constructor(coordinates, layout, endss) {\n super();\n\n /**\n * @type {Array<Array<number>>}\n * @private\n */\n this.endss_ = [];\n\n /**\n * @private\n * @type {number}\n */\n this.flatInteriorPointsRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.flatInteriorPoints_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDelta_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.maxDeltaRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.orientedRevision_ = -1;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.orientedFlatCoordinates_ = null;\n\n if (!endss && !Array.isArray(coordinates[0])) {\n const polygons = /** @type {Array<Polygon>} */ (coordinates);\n /** @type {Array<number>} */\n const flatCoordinates = [];\n const thisEndss = [];\n for (let i = 0, ii = polygons.length; i < ii; ++i) {\n const polygon = polygons[i];\n const offset = flatCoordinates.length;\n const ends = polygon.getEnds();\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] += offset;\n }\n extend(flatCoordinates, polygon.getFlatCoordinates());\n thisEndss.push(ends);\n }\n layout =\n polygons.length === 0 ? this.getLayout() : polygons[0].getLayout();\n coordinates = flatCoordinates;\n endss = thisEndss;\n }\n if (layout !== undefined && endss) {\n this.setFlatCoordinates(\n layout,\n /** @type {Array<number>} */ (coordinates),\n );\n this.endss_ = endss;\n } else {\n this.setCoordinates(\n /** @type {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} */ (\n coordinates\n ),\n layout,\n );\n }\n }\n\n /**\n * Append the passed polygon to this multipolygon.\n * @param {Polygon} polygon Polygon.\n * @api\n */\n appendPolygon(polygon) {\n /** @type {Array<number>} */\n let ends;\n if (!this.flatCoordinates) {\n this.flatCoordinates = polygon.getFlatCoordinates().slice();\n ends = polygon.getEnds().slice();\n this.endss_.push();\n } else {\n const offset = this.flatCoordinates.length;\n extend(this.flatCoordinates, polygon.getFlatCoordinates());\n ends = polygon.getEnds().slice();\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] += offset;\n }\n }\n this.endss_.push(ends);\n this.changed();\n }\n\n /**\n * Make a complete copy of the geometry.\n * @return {!MultiPolygon} Clone.\n * @api\n * @override\n */\n clone() {\n const len = this.endss_.length;\n const newEndss = new Array(len);\n for (let i = 0; i < len; ++i) {\n newEndss[i] = this.endss_[i].slice();\n }\n\n const multiPolygon = new MultiPolygon(\n this.flatCoordinates.slice(),\n this.layout,\n newEndss,\n );\n multiPolygon.applyProperties(this);\n\n return multiPolygon;\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @param {import(\"../coordinate.js\").Coordinate} closestPoint Closest point.\n * @param {number} minSquaredDistance Minimum squared distance.\n * @return {number} Minimum squared distance.\n * @override\n */\n closestPointXY(x, y, closestPoint, minSquaredDistance) {\n if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {\n return minSquaredDistance;\n }\n if (this.maxDeltaRevision_ != this.getRevision()) {\n this.maxDelta_ = Math.sqrt(\n multiArrayMaxSquaredDelta(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n 0,\n ),\n );\n this.maxDeltaRevision_ = this.getRevision();\n }\n return assignClosestMultiArrayPoint(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n this.maxDelta_,\n true,\n x,\n y,\n closestPoint,\n minSquaredDistance,\n );\n }\n\n /**\n * @param {number} x X.\n * @param {number} y Y.\n * @return {boolean} Contains (x, y).\n * @override\n */\n containsXY(x, y) {\n return linearRingssContainsXY(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n x,\n y,\n );\n }\n\n /**\n * Return the area of the multipolygon on projected plane.\n * @return {number} Area (on projected plane).\n * @api\n */\n getArea() {\n return linearRingssArea(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n );\n }\n\n /**\n * Get the coordinate array for this geometry. This array has the structure\n * of a GeoJSON coordinate array for multi-polygons.\n *\n * @param {boolean} [right] Orient coordinates according to the right-hand\n * rule (counter-clockwise for exterior and clockwise for interior rings).\n * If `false`, coordinates will be oriented according to the left-hand rule\n * (clockwise for exterior and counter-clockwise for interior rings).\n * By default, coordinate orientation will depend on how the geometry was\n * constructed.\n * @return {Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} Coordinates.\n * @api\n * @override\n */\n getCoordinates(right) {\n let flatCoordinates;\n if (right !== undefined) {\n flatCoordinates = this.getOrientedFlatCoordinates().slice();\n orientLinearRingsArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n right,\n );\n } else {\n flatCoordinates = this.flatCoordinates;\n }\n\n return inflateMultiCoordinatesArray(\n flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n );\n }\n\n /**\n * @return {Array<Array<number>>} Endss.\n */\n getEndss() {\n return this.endss_;\n }\n\n /**\n * @return {Array<number>} Flat interior points.\n */\n getFlatInteriorPoints() {\n if (this.flatInteriorPointsRevision_ != this.getRevision()) {\n const flatCenters = linearRingssCenter(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n );\n this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n flatCenters,\n );\n this.flatInteriorPointsRevision_ = this.getRevision();\n }\n return /** @type {Array<number>} */ (this.flatInteriorPoints_);\n }\n\n /**\n * Return the interior points as {@link module:ol/geom/MultiPoint~MultiPoint multipoint}.\n * @return {MultiPoint} Interior points as XYM coordinates, where M is\n * the length of the horizontal intersection that the point belongs to.\n * @api\n */\n getInteriorPoints() {\n return new MultiPoint(this.getFlatInteriorPoints().slice(), 'XYM');\n }\n\n /**\n * @return {Array<number>} Oriented flat coordinates.\n */\n getOrientedFlatCoordinates() {\n if (this.orientedRevision_ != this.getRevision()) {\n const flatCoordinates = this.flatCoordinates;\n if (\n linearRingssAreOriented(flatCoordinates, 0, this.endss_, this.stride)\n ) {\n this.orientedFlatCoordinates_ = flatCoordinates;\n } else {\n this.orientedFlatCoordinates_ = flatCoordinates.slice();\n this.orientedFlatCoordinates_.length = orientLinearRingsArray(\n this.orientedFlatCoordinates_,\n 0,\n this.endss_,\n this.stride,\n );\n }\n this.orientedRevision_ = this.getRevision();\n }\n return /** @type {Array<number>} */ (this.orientedFlatCoordinates_);\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {MultiPolygon} Simplified MultiPolygon.\n * @protected\n * @override\n */\n getSimplifiedGeometryInternal(squaredTolerance) {\n /** @type {Array<number>} */\n const simplifiedFlatCoordinates = [];\n /** @type {Array<Array<number>>} */\n const simplifiedEndss = [];\n simplifiedFlatCoordinates.length = quantizeMultiArray(\n this.flatCoordinates,\n 0,\n this.endss_,\n this.stride,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEndss,\n );\n return new MultiPolygon(simplifiedFlatCoordinates, 'XY', simplifiedEndss);\n }\n\n /**\n * Return the polygon at the specified index.\n * @param {number} index Index.\n * @return {Polygon} Polygon.\n * @api\n */\n getPolygon(index) {\n if (index < 0 || this.endss_.length <= index) {\n return null;\n }\n let offset;\n if (index === 0) {\n offset = 0;\n } else {\n const prevEnds = this.endss_[index - 1];\n offset = prevEnds[prevEnds.length - 1];\n }\n const ends = this.endss_[index].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n ends[i] -= offset;\n }\n }\n return new Polygon(\n this.flatCoordinates.slice(offset, end),\n this.layout,\n ends,\n );\n }\n\n /**\n * Return the polygons of this multipolygon.\n * @return {Array<Polygon>} Polygons.\n * @api\n */\n getPolygons() {\n const layout = this.layout;\n const flatCoordinates = this.flatCoordinates;\n const endss = this.endss_;\n const polygons = [];\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i].slice();\n const end = ends[ends.length - 1];\n if (offset !== 0) {\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n ends[j] -= offset;\n }\n }\n const polygon = new Polygon(\n flatCoordinates.slice(offset, end),\n layout,\n ends,\n );\n polygons.push(polygon);\n offset = end;\n }\n return polygons;\n }\n\n /**\n * Get the type of this geometry.\n * @return {import(\"./Geometry.js\").Type} Geometry type.\n * @api\n * @override\n */\n getType() {\n return 'MultiPolygon';\n }\n\n /**\n * Test if the geometry and the passed extent intersect.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {boolean} `true` if the geometry and the extent intersect.\n * @api\n * @override\n */\n intersectsExtent(extent) {\n return intersectsLinearRingMultiArray(\n this.getOrientedFlatCoordinates(),\n 0,\n this.endss_,\n this.stride,\n extent,\n );\n }\n\n /**\n * Set the coordinates of the multipolygon.\n * @param {!Array<Array<Array<import(\"../coordinate.js\").Coordinate>>>} coordinates Coordinates.\n * @param {import(\"./Geometry.js\").GeometryLayout} [layout] Layout.\n * @api\n * @override\n */\n setCoordinates(coordinates, layout) {\n this.setLayout(layout, coordinates, 3);\n if (!this.flatCoordinates) {\n this.flatCoordinates = [];\n }\n const endss = deflateMultiCoordinatesArray(\n this.flatCoordinates,\n 0,\n coordinates,\n this.stride,\n this.endss_,\n );\n if (endss.length === 0) {\n this.flatCoordinates.length = 0;\n } else {\n const lastEnds = endss[endss.length - 1];\n this.flatCoordinates.length =\n lastEnds.length === 0 ? 0 : lastEnds[lastEnds.length - 1];\n }\n this.changed();\n }\n}\n\nexport default MultiPolygon;\n","/**\n * @module ol/render/Feature\n */\nimport Feature from '../Feature.js';\nimport {extend} from '../array.js';\nimport {\n createOrUpdateFromCoordinate,\n createOrUpdateFromFlatCoordinates,\n getCenter,\n getHeight,\n} from '../extent.js';\nimport {memoizeOne} from '../functions.js';\nimport {linearRingss as linearRingssCenter} from '../geom/flat/center.js';\nimport {\n getInteriorPointOfArray,\n getInteriorPointsOfMultiArray,\n} from '../geom/flat/interiorpoint.js';\nimport {interpolatePoint} from '../geom/flat/interpolate.js';\nimport {inflateEnds} from '../geom/flat/orient.js';\nimport {\n douglasPeucker,\n douglasPeuckerArray,\n quantizeArray,\n} from '../geom/flat/simplify.js';\nimport {transform2D} from '../geom/flat/transform.js';\nimport {\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from '../geom.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../transform.js';\n\n/**\n * @typedef {'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString'} Type\n * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,\n * `'Polygon'`, `'MultiPoint'` or 'MultiLineString'`.\n */\n\n/**\n * @type {import(\"../transform.js\").Transform}\n */\nconst tmpTransform = createTransform();\n\n/**\n * Lightweight, read-only, {@link module:ol/Feature~Feature} and {@link module:ol/geom/Geometry~Geometry} like\n * structure, optimized for vector tile rendering and styling. Geometry access\n * through the API is limited to getting the type and extent of the geometry.\n */\nclass RenderFeature {\n /**\n * @param {Type} type Geometry type.\n * @param {Array<number>} flatCoordinates Flat coordinates. These always need\n * to be right-handed for polygons.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Object<string, *>} properties Properties.\n * @param {number|string|undefined} id Feature id.\n */\n constructor(type, flatCoordinates, ends, stride, properties, id) {\n /**\n * @type {import(\"../style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent|undefined}\n */\n this.extent_;\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = id;\n\n /**\n * @private\n * @type {Type}\n */\n this.type_ = type;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.flatCoordinates_ = flatCoordinates;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.flatInteriorPoints_ = null;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.flatMidpoints_ = null;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.ends_ = ends || null;\n\n /**\n * @private\n * @type {Object<string, *>}\n */\n this.properties_ = properties;\n\n /**\n * @private\n * @type {number}\n */\n this.squaredTolerance_;\n\n /**\n * @private\n * @type {number}\n */\n this.stride_ = stride;\n\n /**\n * @private\n * @type {RenderFeature}\n */\n this.simplifiedGeometry_;\n }\n\n /**\n * Get a feature property by its key.\n * @param {string} key Key\n * @return {*} Value for the requested key.\n * @api\n */\n get(key) {\n return this.properties_[key];\n }\n\n /**\n * Get the extent of this feature's geometry.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent() {\n if (!this.extent_) {\n this.extent_ =\n this.type_ === 'Point'\n ? createOrUpdateFromCoordinate(this.flatCoordinates_)\n : createOrUpdateFromFlatCoordinates(\n this.flatCoordinates_,\n 0,\n this.flatCoordinates_.length,\n 2,\n );\n }\n return this.extent_;\n }\n\n /**\n * @return {Array<number>} Flat interior points.\n */\n getFlatInteriorPoint() {\n if (!this.flatInteriorPoints_) {\n const flatCenter = getCenter(this.getExtent());\n this.flatInteriorPoints_ = getInteriorPointOfArray(\n this.flatCoordinates_,\n 0,\n this.ends_,\n 2,\n flatCenter,\n 0,\n );\n }\n return this.flatInteriorPoints_;\n }\n\n /**\n * @return {Array<number>} Flat interior points.\n */\n getFlatInteriorPoints() {\n if (!this.flatInteriorPoints_) {\n const ends = inflateEnds(this.flatCoordinates_, this.ends_);\n const flatCenters = linearRingssCenter(this.flatCoordinates_, 0, ends, 2);\n this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(\n this.flatCoordinates_,\n 0,\n ends,\n 2,\n flatCenters,\n );\n }\n return this.flatInteriorPoints_;\n }\n\n /**\n * @return {Array<number>} Flat midpoint.\n */\n getFlatMidpoint() {\n if (!this.flatMidpoints_) {\n this.flatMidpoints_ = interpolatePoint(\n this.flatCoordinates_,\n 0,\n this.flatCoordinates_.length,\n 2,\n 0.5,\n );\n }\n return this.flatMidpoints_;\n }\n\n /**\n * @return {Array<number>} Flat midpoints.\n */\n getFlatMidpoints() {\n if (!this.flatMidpoints_) {\n this.flatMidpoints_ = [];\n const flatCoordinates = this.flatCoordinates_;\n let offset = 0;\n const ends = /** @type {Array<number>} */ (this.ends_);\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const midpoint = interpolatePoint(flatCoordinates, offset, end, 2, 0.5);\n extend(this.flatMidpoints_, midpoint);\n offset = end;\n }\n }\n return this.flatMidpoints_;\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is set when reading data from a remote source.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * @return {Array<number>} Flat coordinates.\n */\n getOrientedFlatCoordinates() {\n return this.flatCoordinates_;\n }\n\n /**\n * For API compatibility with {@link module:ol/Feature~Feature}, this method is useful when\n * determining the geometry type in style function (see {@link #getType}).\n * @return {RenderFeature} Feature.\n * @api\n */\n getGeometry() {\n return this;\n }\n\n /**\n * @param {number} squaredTolerance Squared tolerance.\n * @return {RenderFeature} Simplified geometry.\n */\n getSimplifiedGeometry(squaredTolerance) {\n return this;\n }\n\n /**\n * Get a transformed and simplified version of the geometry.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../proj.js\").TransformFunction} [transform] Optional transform function.\n * @return {RenderFeature} Simplified geometry.\n */\n simplifyTransformed(squaredTolerance, transform) {\n return this;\n }\n\n /**\n * Get the feature properties.\n * @return {Object<string, *>} Feature properties.\n * @api\n */\n getProperties() {\n return this.properties_;\n }\n\n /**\n * Get an object of all property names and values. This has the same behavior as getProperties,\n * but is here to conform with the {@link module:ol/Feature~Feature} interface.\n * @return {Object<string, *>?} Object.\n */\n getPropertiesInternal() {\n return this.properties_;\n }\n\n /**\n * @return {number} Stride.\n */\n getStride() {\n return this.stride_;\n }\n\n /**\n * @return {import('../style/Style.js').StyleFunction|undefined} Style\n */\n getStyleFunction() {\n return this.styleFunction;\n }\n\n /**\n * Get the type of this feature's geometry.\n * @return {Type} Geometry type.\n * @api\n */\n getType() {\n return this.type_;\n }\n\n /**\n * Transform geometry coordinates from tile pixel space to projected.\n *\n * @param {import(\"../proj.js\").ProjectionLike} projection The data projection\n */\n transform(projection) {\n projection = getProjection(projection);\n const pixelExtent = projection.getExtent();\n const projectedExtent = projection.getWorldExtent();\n if (pixelExtent && projectedExtent) {\n const scale = getHeight(projectedExtent) / getHeight(pixelExtent);\n composeTransform(\n tmpTransform,\n projectedExtent[0],\n projectedExtent[3],\n scale,\n -scale,\n 0,\n 0,\n 0,\n );\n transform2D(\n this.flatCoordinates_,\n 0,\n this.flatCoordinates_.length,\n 2,\n tmpTransform,\n this.flatCoordinates_,\n );\n }\n }\n\n /**\n * Apply a transform function to the coordinates of the geometry.\n * The geometry is modified in place.\n * If you do not want the geometry modified in place, first `clone()` it and\n * then use this function on the clone.\n * @param {import(\"../proj.js\").TransformFunction} transformFn Transform function.\n */\n applyTransform(transformFn) {\n transformFn(this.flatCoordinates_, this.flatCoordinates_, this.stride_);\n }\n\n /**\n * @return {RenderFeature} A cloned render feature.\n */\n clone() {\n return new RenderFeature(\n this.type_,\n this.flatCoordinates_.slice(),\n this.ends_?.slice(),\n this.stride_,\n Object.assign({}, this.properties_),\n this.id_,\n );\n }\n\n /**\n * @return {Array<number>|null} Ends.\n */\n getEnds() {\n return this.ends_;\n }\n\n /**\n * Add transform and resolution based geometry simplification to this instance.\n * @return {RenderFeature} This render feature.\n */\n enableSimplifyTransformed() {\n this.simplifyTransformed = memoizeOne((squaredTolerance, transform) => {\n if (squaredTolerance === this.squaredTolerance_) {\n return this.simplifiedGeometry_;\n }\n this.simplifiedGeometry_ = this.clone();\n if (transform) {\n this.simplifiedGeometry_.applyTransform(transform);\n }\n const simplifiedFlatCoordinates =\n this.simplifiedGeometry_.getFlatCoordinates();\n let simplifiedEnds;\n switch (this.type_) {\n case 'LineString':\n simplifiedFlatCoordinates.length = douglasPeucker(\n simplifiedFlatCoordinates,\n 0,\n this.simplifiedGeometry_.flatCoordinates_.length,\n this.simplifiedGeometry_.stride_,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n );\n simplifiedEnds = [simplifiedFlatCoordinates.length];\n break;\n case 'MultiLineString':\n simplifiedEnds = [];\n simplifiedFlatCoordinates.length = douglasPeuckerArray(\n simplifiedFlatCoordinates,\n 0,\n this.simplifiedGeometry_.ends_,\n this.simplifiedGeometry_.stride_,\n squaredTolerance,\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n break;\n case 'Polygon':\n simplifiedEnds = [];\n simplifiedFlatCoordinates.length = quantizeArray(\n simplifiedFlatCoordinates,\n 0,\n this.simplifiedGeometry_.ends_,\n this.simplifiedGeometry_.stride_,\n Math.sqrt(squaredTolerance),\n simplifiedFlatCoordinates,\n 0,\n simplifiedEnds,\n );\n break;\n default:\n }\n if (simplifiedEnds) {\n this.simplifiedGeometry_ = new RenderFeature(\n this.type_,\n simplifiedFlatCoordinates,\n simplifiedEnds,\n 2,\n this.properties_,\n this.id_,\n );\n }\n this.squaredTolerance_ = squaredTolerance;\n return this.simplifiedGeometry_;\n });\n return this;\n }\n}\n\n/**\n * @return {Array<number>} Flat coordinates.\n */\nRenderFeature.prototype.getFlatCoordinates =\n RenderFeature.prototype.getOrientedFlatCoordinates;\n\n/**\n * Create a geometry from an `ol/render/Feature`\n * @param {RenderFeature} renderFeature\n * Render Feature\n * @return {Point|MultiPoint|LineString|MultiLineString|Polygon|MultiPolygon}\n * New geometry instance.\n * @api\n */\nexport function toGeometry(renderFeature) {\n const geometryType = renderFeature.getType();\n switch (geometryType) {\n case 'Point':\n return new Point(renderFeature.getFlatCoordinates());\n case 'MultiPoint':\n return new MultiPoint(renderFeature.getFlatCoordinates(), 'XY');\n case 'LineString':\n return new LineString(renderFeature.getFlatCoordinates(), 'XY');\n case 'MultiLineString':\n return new MultiLineString(\n renderFeature.getFlatCoordinates(),\n 'XY',\n /** @type {Array<number>} */ (renderFeature.getEnds()),\n );\n case 'Polygon':\n const flatCoordinates = renderFeature.getFlatCoordinates();\n const ends = renderFeature.getEnds();\n const endss = inflateEnds(flatCoordinates, ends);\n return endss.length > 1\n ? new MultiPolygon(flatCoordinates, 'XY', endss)\n : new Polygon(flatCoordinates, 'XY', ends);\n default:\n throw new Error('Invalid geometry type:' + geometryType);\n }\n}\n\n/**\n * Create an `ol/Feature` from an `ol/render/Feature`\n * @param {RenderFeature} renderFeature RenderFeature\n * @param {string} [geometryName] Geometry name to use\n * when creating the Feature.\n * @return {Feature} Newly constructed `ol/Feature` with properties,\n * geometry, and id copied over.\n * @api\n */\nexport function toFeature(renderFeature, geometryName) {\n const id = renderFeature.getId();\n const geometry = toGeometry(renderFeature);\n const properties = renderFeature.getProperties();\n const feature = new Feature();\n if (geometryName !== undefined) {\n feature.setGeometryName(geometryName);\n }\n feature.setGeometry(geometry);\n if (id !== undefined) {\n feature.setId(id);\n }\n feature.setProperties(properties, true);\n return feature;\n}\n\nexport default RenderFeature;\n","/**\n * @module ol/structs/RBush\n */\nimport RBush_ from 'rbush';\nimport {createOrUpdate, equals} from '../extent.js';\nimport {isEmpty} from '../obj.js';\nimport {getUid} from '../util.js';\n\n/**\n * @typedef {import(\"rbush\").BBox & {value: T}} Entry\n * @template T\n */\n\n/**\n * @classdesc\n * Wrapper around the RBush by Vladimir Agafonkin.\n * See https://github.com/mourner/rbush.\n *\n * @template {Object} T\n */\nclass RBush {\n /**\n * @param {number} [maxEntries] Max entries.\n */\n constructor(maxEntries) {\n /**\n * @private\n * @type {RBush_<Entry<T>>}\n */\n this.rbush_ = new RBush_(maxEntries);\n\n /**\n * A mapping between the objects added to this rbush wrapper\n * and the objects that are actually added to the internal rbush.\n * @private\n * @type {Object<string, Entry<T>>}\n */\n this.items_ = {};\n }\n\n /**\n * Insert a value into the RBush.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {T} value Value.\n */\n insert(extent, value) {\n /** @type {Entry<T>} */\n const item = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n value: value,\n };\n\n this.rbush_.insert(item);\n this.items_[getUid(value)] = item;\n }\n\n /**\n * Bulk-insert values into the RBush.\n * @param {Array<import(\"../extent.js\").Extent>} extents Extents.\n * @param {Array<T>} values Values.\n */\n load(extents, values) {\n const items = new Array(values.length);\n for (let i = 0, l = values.length; i < l; i++) {\n const extent = extents[i];\n const value = values[i];\n\n /** @type {Entry<T>} */\n const item = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n value: value,\n };\n items[i] = item;\n this.items_[getUid(value)] = item;\n }\n this.rbush_.load(items);\n }\n\n /**\n * Remove a value from the RBush.\n * @param {T} value Value.\n * @return {boolean} Removed.\n */\n remove(value) {\n const uid = getUid(value);\n\n // get the object in which the value was wrapped when adding to the\n // internal rbush. then use that object to do the removal.\n const item = this.items_[uid];\n delete this.items_[uid];\n return this.rbush_.remove(item) !== null;\n }\n\n /**\n * Update the extent of a value in the RBush.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {T} value Value.\n */\n update(extent, value) {\n const item = this.items_[getUid(value)];\n const bbox = [item.minX, item.minY, item.maxX, item.maxY];\n if (!equals(bbox, extent)) {\n this.remove(value);\n this.insert(extent, value);\n }\n }\n\n /**\n * Return all values in the RBush.\n * @return {Array<T>} All.\n */\n getAll() {\n const items = this.rbush_.all();\n return items.map(function (item) {\n return item.value;\n });\n }\n\n /**\n * Return all values in the given extent.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {Array<T>} All in extent.\n */\n getInExtent(extent) {\n /** @type {import(\"rbush\").BBox} */\n const bbox = {\n minX: extent[0],\n minY: extent[1],\n maxX: extent[2],\n maxY: extent[3],\n };\n const items = this.rbush_.search(bbox);\n return items.map(function (item) {\n return item.value;\n });\n }\n\n /**\n * Calls a callback function with each value in the tree.\n * If the callback returns a truthy value, this value is returned without\n * checking the rest of the tree.\n * @param {function(T): R} callback Callback.\n * @return {R|undefined} Callback return value.\n * @template R\n */\n forEach(callback) {\n return this.forEach_(this.getAll(), callback);\n }\n\n /**\n * Calls a callback function with each value in the provided extent.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(T): R} callback Callback.\n * @return {R|undefined} Callback return value.\n * @template R\n */\n forEachInExtent(extent, callback) {\n return this.forEach_(this.getInExtent(extent), callback);\n }\n\n /**\n * @param {Array<T>} values Values.\n * @param {function(T): R} callback Callback.\n * @return {R|undefined} Callback return value.\n * @template R\n * @private\n */\n forEach_(values, callback) {\n let result;\n for (let i = 0, l = values.length; i < l; i++) {\n result = callback(values[i]);\n if (result) {\n return result;\n }\n }\n return result;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return isEmpty(this.items_);\n }\n\n /**\n * Remove all values from the RBush.\n */\n clear() {\n this.rbush_.clear();\n this.items_ = {};\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} [extent] Extent.\n * @return {import(\"../extent.js\").Extent} Extent.\n */\n getExtent(extent) {\n const data = this.rbush_.toJSON();\n return createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, extent);\n }\n\n /**\n * @param {RBush<T>} rbush R-Tree.\n */\n concat(rbush) {\n this.rbush_.load(rbush.rbush_.all());\n for (const i in rbush.items_) {\n this.items_[i] = rbush.items_[i];\n }\n }\n}\n\nexport default RBush;\n","/**\n * @module ol/source/VectorEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a feature is added to the source.\n * @event module:ol/source/Vector.VectorSourceEvent#addfeature\n * @api\n */\n ADDFEATURE: 'addfeature',\n\n /**\n * Triggered when a feature is updated.\n * @event module:ol/source/Vector.VectorSourceEvent#changefeature\n * @api\n */\n CHANGEFEATURE: 'changefeature',\n\n /**\n * Triggered when the clear method is called on the source.\n * @event module:ol/source/Vector.VectorSourceEvent#clear\n * @api\n */\n CLEAR: 'clear',\n\n /**\n * Triggered when a feature is removed from the source.\n * See {@link module:ol/source/Vector~VectorSource#clear source.clear()} for exceptions.\n * @event module:ol/source/Vector.VectorSourceEvent#removefeature\n * @api\n */\n REMOVEFEATURE: 'removefeature',\n\n /**\n * Triggered when features starts loading.\n * @event module:ol/source/Vector.VectorSourceEvent#featuresloadstart\n * @api\n */\n FEATURESLOADSTART: 'featuresloadstart',\n\n /**\n * Triggered when features finishes loading.\n * @event module:ol/source/Vector.VectorSourceEvent#featuresloadend\n * @api\n */\n FEATURESLOADEND: 'featuresloadend',\n\n /**\n * Triggered if feature loading results in an error.\n * @event module:ol/source/Vector.VectorSourceEvent#featuresloaderror\n * @api\n */\n FEATURESLOADERROR: 'featuresloaderror',\n};\n\n/**\n * @typedef {'addfeature'|'changefeature'|'clear'|'removefeature'|'featuresloadstart'|'featuresloadend'|'featuresloaderror'} VectorSourceEventTypes\n */\n","/**\n * @module ol/source/Vector\n */\n\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport {extend} from '../array.js';\nimport {assert} from '../asserts.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {containsExtent, equals, wrapAndSliceX} from '../extent.js';\nimport {xhr} from '../featureloader.js';\nimport {TRUE, VOID} from '../functions.js';\nimport {all as allStrategy} from '../loadingstrategy.js';\nimport {isEmpty} from '../obj.js';\nimport RenderFeature from '../render/Feature.js';\nimport RBush from '../structs/RBush.js';\nimport {getUid} from '../util.js';\nimport Source from './Source.js';\nimport VectorEventType from './VectorEventType.js';\n\n/**\n * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and\n * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this\n * is one of the standard {@link module:ol/loadingstrategy} strategies.\n *\n * @typedef {function(import(\"../extent.js\").Extent, number, import(\"../proj/Projection.js\").default): Array<import(\"../extent.js\").Extent>} LoadingStrategy\n * @api\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/source/Vector~VectorSource} instances are instances of this\n * type.\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n */\nexport class VectorSourceEvent extends Event {\n /**\n * @param {string} type Type.\n * @param {FeatureType} [feature] Feature.\n * @param {Array<FeatureType>} [features] Features.\n */\n constructor(type, feature, features) {\n super(type);\n\n /**\n * The added or removed feature for the `ADDFEATURE` and `REMOVEFEATURE` events, `undefined` otherwise.\n * @type {FeatureType|undefined}\n * @api\n */\n this.feature = feature;\n\n /**\n * The loaded features for the `FEATURESLOADED` event, `undefined` otherwise.\n * @type {Array<FeatureType>|undefined}\n * @api\n */\n this.features = features;\n }\n}\n\n/***\n * @template {import(\"../Feature.js\").FeatureLike} [T=import(\"../Feature.js\").default]\n * @typedef {T extends RenderFeature ? T|Array<T> : T} FeatureClassOrArrayOfRenderFeatures\n */\n\n/***\n * @template Return\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<import(\"./VectorEventType\").VectorSourceEventTypes, VectorSourceEvent<FeatureType>, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * import(\"./VectorEventType\").VectorSourceEventTypes, Return>} VectorSourceOnSignature\n */\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {Array<FeatureType>|Collection<FeatureType>} [features]\n * Features. If provided as {@link module:ol/Collection~Collection}, the features in the source\n * and the collection will stay in sync.\n * @property {import(\"../format/Feature.js\").default<FeatureType>} [format] The feature format used by the XHR\n * feature loader when `url` is set. Required if `url` is set, otherwise ignored.\n * @property {import(\"../featureloader.js\").FeatureLoader<FeatureType>} [loader]\n * The loader function used to load features, from a remote source for example.\n * If this is not set and `url` is set, the source will create and use an XHR\n * feature loader. The `'featuresloadend'` and `'featuresloaderror'` events\n * will only fire if the `success` and `failure` callbacks are used.\n *\n * Example:\n *\n * ```js\n * import Vector from 'ol/source/Vector.js';\n * import GeoJSON from 'ol/format/GeoJSON.js';\n * import {bbox} from 'ol/loadingstrategy.js';\n *\n * const vectorSource = new Vector({\n * format: new GeoJSON(),\n * loader: function(extent, resolution, projection, success, failure) {\n * const proj = projection.getCode();\n * const url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +\n * 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +\n * 'outputFormat=application/json&srsname=' + proj + '&' +\n * 'bbox=' + extent.join(',') + ',' + proj;\n * const xhr = new XMLHttpRequest();\n * xhr.open('GET', url);\n * const onError = function() {\n * vectorSource.removeLoadedExtent(extent);\n * failure();\n * }\n * xhr.onerror = onError;\n * xhr.onload = function() {\n * if (xhr.status == 200) {\n * const features = vectorSource.getFormat().readFeatures(xhr.responseText);\n * vectorSource.addFeatures(features);\n * success(features);\n * } else {\n * onError();\n * }\n * }\n * xhr.send();\n * },\n * strategy: bbox,\n * });\n * ```\n * @property {boolean} [overlaps=true] This source may have overlapping geometries.\n * Setting this to `false` (e.g. for sources with polygons that represent administrative\n * boundaries or TopoJSON sources) allows the renderer to optimise fill and\n * stroke operations.\n * @property {LoadingStrategy} [strategy] The loading strategy to use.\n * By default an {@link module:ol/loadingstrategy.all}\n * strategy is used, a one-off strategy which loads all features at once.\n * @property {string|import(\"../featureloader.js\").FeatureUrlFunction} [url]\n * Setting this option instructs the source to load features using an XHR loader\n * (see {@link module:ol/featureloader.xhr}). Use a `string` and an\n * {@link module:ol/loadingstrategy.all} for a one-off download of all features from\n * the given URL. Use a {@link module:ol/featureloader~FeatureUrlFunction} to generate the url with\n * other loading strategies.\n * Requires `format` to be set as well.\n * When default XHR feature loader is provided, the features will\n * be transformed from the data projection to the view projection\n * during parsing. If your remote data source does not advertise its projection\n * properly, this transformation will be incorrect. For some formats, the\n * default projection (usually EPSG:4326) can be overridden by setting the\n * dataProjection constructor option on the format.\n * Note that if a source contains non-feature data, such as a GeoJSON geometry\n * or a KML NetworkLink, these will be ignored. Use a custom loader to load these.\n * @property {boolean} [useSpatialIndex=true]\n * By default, an RTree is used as spatial index. When features are removed and\n * added frequently, and the total number of features is low, setting this to\n * `false` may improve performance.\n *\n * Note that\n * {@link module:ol/source/Vector~VectorSource#getFeaturesInExtent},\n * {@link module:ol/source/Vector~VectorSource#getClosestFeatureToCoordinate} and\n * {@link module:ol/source/Vector~VectorSource#getExtent} cannot be used when `useSpatialIndex` is\n * set to `false`, and {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent} will loop\n * through all features.\n *\n * When set to `false`, the features will be maintained in an\n * {@link module:ol/Collection~Collection}, which can be retrieved through\n * {@link module:ol/source/Vector~VectorSource#getFeaturesCollection}.\n * @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the\n * -180° and 180° meridians to work properly, this should be set to `false`. The\n * resulting geometry coordinates will then exceed the world bounds.\n */\n\n/**\n * @classdesc\n * Provides a source of features for vector layers. Vector features provided\n * by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for\n * vector data that is optimized for rendering.\n *\n * @fires VectorSourceEvent\n * @api\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n */\nclass VectorSource extends Source {\n /**\n * @param {Options<FeatureType>} [options] Vector source options.\n */\n constructor(options) {\n options = options || {};\n\n super({\n attributions: options.attributions,\n interpolate: true,\n projection: undefined,\n state: 'ready',\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n });\n\n /***\n * @type {VectorSourceOnSignature<import(\"../events\").EventsKey, FeatureType>}\n */\n this.on;\n\n /***\n * @type {VectorSourceOnSignature<import(\"../events\").EventsKey, FeatureType>}\n */\n this.once;\n\n /***\n * @type {VectorSourceOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {import(\"../featureloader.js\").FeatureLoader<import(\"../Feature.js\").FeatureLike>}\n */\n this.loader_ = VOID;\n\n /**\n * @private\n * @type {import(\"../format/Feature.js\").default<FeatureType>|null}\n */\n this.format_ = options.format || null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overlaps_ = options.overlaps === undefined ? true : options.overlaps;\n\n /**\n * @private\n * @type {string|import(\"../featureloader.js\").FeatureUrlFunction|undefined}\n */\n this.url_ = options.url;\n\n if (options.loader !== undefined) {\n this.loader_ = options.loader;\n } else if (this.url_ !== undefined) {\n assert(this.format_, '`format` must be set when `url` is set');\n // create a XHR feature loader for \"url\" and \"format\"\n this.loader_ = xhr(this.url_, this.format_);\n }\n\n /**\n * @private\n * @type {LoadingStrategy}\n */\n this.strategy_ =\n options.strategy !== undefined ? options.strategy : allStrategy;\n\n const useSpatialIndex =\n options.useSpatialIndex !== undefined ? options.useSpatialIndex : true;\n\n /**\n * @private\n * @type {RBush<FeatureType>}\n */\n this.featuresRtree_ = useSpatialIndex ? new RBush() : null;\n\n /**\n * @private\n * @type {RBush<{extent: import(\"../extent.js\").Extent}>}\n */\n this.loadedExtentsRtree_ = new RBush();\n\n /**\n * @type {number}\n * @private\n */\n this.loadingExtentsCount_ = 0;\n\n /**\n * @private\n * @type {!Object<string, FeatureType>}\n */\n this.nullGeometryFeatures_ = {};\n\n /**\n * A lookup of features by id (the return from feature.getId()).\n * @private\n * @type {!Object<string, import('../Feature.js').FeatureLike|Array<import('../Feature.js').FeatureLike>>}\n */\n this.idIndex_ = {};\n\n /**\n * A lookup of features by uid (using getUid(feature)).\n * @private\n * @type {!Object<string, FeatureType>}\n */\n this.uidIndex_ = {};\n\n /**\n * @private\n * @type {Object<string, Array<import(\"../events.js\").EventsKey>>}\n */\n this.featureChangeKeys_ = {};\n\n /**\n * @private\n * @type {Collection<FeatureType>|null}\n */\n this.featuresCollection_ = null;\n\n /** @type {Collection<FeatureType>} */\n let collection;\n /** @type {Array<FeatureType>} */\n let features;\n if (Array.isArray(options.features)) {\n features = options.features;\n } else if (options.features) {\n collection = options.features;\n features = collection.getArray();\n }\n if (!useSpatialIndex && collection === undefined) {\n collection = new Collection(features);\n }\n if (features !== undefined) {\n this.addFeaturesInternal(features);\n }\n if (collection !== undefined) {\n this.bindFeaturesCollection_(collection);\n }\n }\n\n /**\n * Add a single feature to the source. If you want to add a batch of features\n * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()}\n * instead. A feature will not be added to the source if feature with\n * the same id is already there. The reason for this behavior is to avoid\n * feature duplication when using bbox or tile loading strategies.\n * Note: this also applies if a {@link module:ol/Collection~Collection} is used for features,\n * meaning that if a feature with a duplicate id is added in the collection, it will\n * be removed from it right away.\n * @param {FeatureType} feature Feature to add.\n * @api\n */\n addFeature(feature) {\n this.addFeatureInternal(feature);\n this.changed();\n }\n\n /**\n * Add a feature without firing a `change` event.\n * @param {FeatureType} feature Feature.\n * @protected\n */\n addFeatureInternal(feature) {\n const featureKey = getUid(feature);\n\n if (!this.addToIndex_(featureKey, feature)) {\n if (this.featuresCollection_) {\n this.featuresCollection_.remove(feature);\n }\n return;\n }\n\n this.setupChangeEvents_(featureKey, feature);\n\n const geometry = feature.getGeometry();\n if (geometry) {\n const extent = geometry.getExtent();\n if (this.featuresRtree_) {\n this.featuresRtree_.insert(extent, feature);\n }\n } else {\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.ADDFEATURE, feature),\n );\n }\n\n /**\n * @param {string} featureKey Unique identifier for the feature.\n * @param {FeatureType} feature The feature.\n * @private\n */\n setupChangeEvents_(featureKey, feature) {\n if (feature instanceof RenderFeature) {\n return;\n }\n this.featureChangeKeys_[featureKey] = [\n listen(feature, EventType.CHANGE, this.handleFeatureChange_, this),\n listen(\n feature,\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n this,\n ),\n ];\n }\n\n /**\n * @param {string} featureKey Unique identifier for the feature.\n * @param {FeatureType} feature The feature.\n * @return {boolean} The feature is \"valid\", in the sense that it is also a\n * candidate for insertion into the Rtree.\n * @private\n */\n addToIndex_(featureKey, feature) {\n let valid = true;\n if (feature.getId() !== undefined) {\n const id = String(feature.getId());\n if (!(id in this.idIndex_)) {\n this.idIndex_[id] = feature;\n } else if (feature instanceof RenderFeature) {\n const indexedFeature = this.idIndex_[id];\n if (!(indexedFeature instanceof RenderFeature)) {\n valid = false;\n } else if (!Array.isArray(indexedFeature)) {\n this.idIndex_[id] = [indexedFeature, feature];\n } else {\n indexedFeature.push(feature);\n }\n } else {\n valid = false;\n }\n }\n if (valid) {\n assert(\n !(featureKey in this.uidIndex_),\n 'The passed `feature` was already added to the source',\n );\n this.uidIndex_[featureKey] = feature;\n }\n return valid;\n }\n\n /**\n * Add a batch of features to the source.\n * @param {Array<FeatureType>} features Features to add.\n * @api\n */\n addFeatures(features) {\n this.addFeaturesInternal(features);\n this.changed();\n }\n\n /**\n * Add features without firing a `change` event.\n * @param {Array<FeatureType>} features Features.\n * @protected\n */\n addFeaturesInternal(features) {\n const extents = [];\n /** @type {Array<FeatureType>} */\n const newFeatures = [];\n /** @type {Array<FeatureType>} */\n const geometryFeatures = [];\n\n for (let i = 0, length = features.length; i < length; i++) {\n const feature = features[i];\n const featureKey = getUid(feature);\n if (this.addToIndex_(featureKey, feature)) {\n newFeatures.push(feature);\n }\n }\n\n for (let i = 0, length = newFeatures.length; i < length; i++) {\n const feature = newFeatures[i];\n const featureKey = getUid(feature);\n this.setupChangeEvents_(featureKey, feature);\n\n const geometry = feature.getGeometry();\n if (geometry) {\n const extent = geometry.getExtent();\n extents.push(extent);\n geometryFeatures.push(feature);\n } else {\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n }\n if (this.featuresRtree_) {\n this.featuresRtree_.load(extents, geometryFeatures);\n }\n\n if (this.hasListener(VectorEventType.ADDFEATURE)) {\n for (let i = 0, length = newFeatures.length; i < length; i++) {\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.ADDFEATURE, newFeatures[i]),\n );\n }\n }\n }\n\n /**\n * @param {!Collection<FeatureType>} collection Collection.\n * @private\n */\n bindFeaturesCollection_(collection) {\n let modifyingCollection = false;\n this.addEventListener(\n VectorEventType.ADDFEATURE,\n /**\n * @param {VectorSourceEvent<FeatureType>} evt The vector source event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n collection.push(evt.feature);\n modifyingCollection = false;\n }\n },\n );\n this.addEventListener(\n VectorEventType.REMOVEFEATURE,\n /**\n * @param {VectorSourceEvent<FeatureType>} evt The vector source event\n */\n function (evt) {\n if (!modifyingCollection) {\n modifyingCollection = true;\n collection.remove(evt.feature);\n modifyingCollection = false;\n }\n },\n );\n collection.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<FeatureType>} evt The collection event\n */\n (evt) => {\n if (!modifyingCollection) {\n modifyingCollection = true;\n this.addFeature(evt.element);\n modifyingCollection = false;\n }\n },\n );\n collection.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<FeatureType>} evt The collection event\n */\n (evt) => {\n if (!modifyingCollection) {\n modifyingCollection = true;\n this.removeFeature(evt.element);\n modifyingCollection = false;\n }\n },\n );\n this.featuresCollection_ = collection;\n }\n\n /**\n * Remove all features from the source.\n * @param {boolean} [fast] Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#event:removefeature} events.\n * @api\n */\n clear(fast) {\n if (fast) {\n for (const featureId in this.featureChangeKeys_) {\n const keys = this.featureChangeKeys_[featureId];\n keys.forEach(unlistenByKey);\n }\n if (!this.featuresCollection_) {\n this.featureChangeKeys_ = {};\n this.idIndex_ = {};\n this.uidIndex_ = {};\n }\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.forEach((feature) => {\n this.removeFeatureInternal(feature);\n });\n for (const id in this.nullGeometryFeatures_) {\n this.removeFeatureInternal(this.nullGeometryFeatures_[id]);\n }\n }\n }\n if (this.featuresCollection_) {\n this.featuresCollection_.clear();\n }\n\n if (this.featuresRtree_) {\n this.featuresRtree_.clear();\n }\n this.nullGeometryFeatures_ = {};\n\n const clearEvent = new VectorSourceEvent(VectorEventType.CLEAR);\n this.dispatchEvent(clearEvent);\n this.changed();\n }\n\n /**\n * Iterate through all features on the source, calling the provided callback\n * with each one. If the callback returns any \"truthy\" value, iteration will\n * stop and the function will return the same value.\n * Note: this function only iterate through the feature that have a defined geometry.\n *\n * @param {function(FeatureType): T} callback Called with each feature\n * on the source. Return a truthy value to stop iteration.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeature(callback) {\n if (this.featuresRtree_) {\n return this.featuresRtree_.forEach(callback);\n }\n if (this.featuresCollection_) {\n this.featuresCollection_.forEach(callback);\n }\n }\n\n /**\n * Iterate through all features whose geometries contain the provided\n * coordinate, calling the callback with each feature. If the callback returns\n * a \"truthy\" value, iteration will stop and the function will return the same\n * value.\n *\n * For {@link module:ol/render/Feature~RenderFeature} features, the callback will be\n * called for all features.\n *\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {function(FeatureType): T} callback Called with each feature\n * whose goemetry contains the provided coordinate.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n */\n forEachFeatureAtCoordinateDirect(coordinate, callback) {\n const extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];\n return this.forEachFeatureInExtent(extent, function (feature) {\n const geometry = feature.getGeometry();\n if (\n geometry instanceof RenderFeature ||\n geometry.intersectsCoordinate(coordinate)\n ) {\n return callback(feature);\n }\n return undefined;\n });\n }\n\n /**\n * Iterate through all features whose bounding box intersects the provided\n * extent (note that the feature's geometry may not intersect the extent),\n * calling the callback with each feature. If the callback returns a \"truthy\"\n * value, iteration will stop and the function will return the same value.\n *\n * If you are interested in features whose geometry intersects an extent, call\n * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.\n *\n * When `useSpatialIndex` is set to false, this method will loop through all\n * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(FeatureType): T} callback Called with each feature\n * whose bounding box intersects the provided extent.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeatureInExtent(extent, callback) {\n if (this.featuresRtree_) {\n return this.featuresRtree_.forEachInExtent(extent, callback);\n }\n if (this.featuresCollection_) {\n this.featuresCollection_.forEach(callback);\n }\n }\n\n /**\n * Iterate through all features whose geometry intersects the provided extent,\n * calling the callback with each feature. If the callback returns a \"truthy\"\n * value, iteration will stop and the function will return the same value.\n *\n * If you only want to test for bounding box intersection, call the\n * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {function(FeatureType): T} callback Called with each feature\n * whose geometry intersects the provided extent.\n * @return {T|undefined} The return value from the last call to the callback.\n * @template T\n * @api\n */\n forEachFeatureIntersectingExtent(extent, callback) {\n return this.forEachFeatureInExtent(\n extent,\n /**\n * @param {FeatureType} feature Feature.\n * @return {T|undefined} The return value from the last call to the callback.\n */\n function (feature) {\n const geometry = feature.getGeometry();\n if (\n geometry instanceof RenderFeature ||\n geometry.intersectsExtent(extent)\n ) {\n const result = callback(feature);\n if (result) {\n return result;\n }\n }\n },\n );\n }\n\n /**\n * Get the features collection associated with this source. Will be `null`\n * unless the source was configured with `useSpatialIndex` set to `false`, or\n * with a {@link module:ol/Collection~Collection} as `features`.\n * @return {Collection<FeatureType>|null} The collection of features.\n * @api\n */\n getFeaturesCollection() {\n return this.featuresCollection_;\n }\n\n /**\n * Get a snapshot of the features currently on the source in random order. The returned array\n * is a copy, the features are references to the features in the source.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeatures() {\n let features;\n if (this.featuresCollection_) {\n features = this.featuresCollection_.getArray().slice(0);\n } else if (this.featuresRtree_) {\n features = this.featuresRtree_.getAll();\n if (!isEmpty(this.nullGeometryFeatures_)) {\n extend(features, Object.values(this.nullGeometryFeatures_));\n }\n }\n return features;\n }\n\n /**\n * Get all features whose geometry intersects the provided coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeaturesAtCoordinate(coordinate) {\n /** @type {Array<FeatureType>} */\n const features = [];\n this.forEachFeatureAtCoordinateDirect(coordinate, function (feature) {\n features.push(feature);\n });\n return features;\n }\n\n /**\n * Get all features whose bounding box intersects the provided extent. Note that this returns an array of\n * all features intersecting the given extent in random order (so it may include\n * features whose geometries do not intersect the extent).\n *\n * When `useSpatialIndex` is set to false, this method will return all\n * features.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {import(\"../proj/Projection.js\").default} [projection] Include features\n * where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeaturesInExtent(extent, projection) {\n if (this.featuresRtree_) {\n const multiWorld = projection && projection.canWrapX() && this.getWrapX();\n\n if (!multiWorld) {\n return this.featuresRtree_.getInExtent(extent);\n }\n\n const extents = wrapAndSliceX(extent, projection);\n\n return [].concat(\n ...extents.map((anExtent) => this.featuresRtree_.getInExtent(anExtent)),\n );\n }\n if (this.featuresCollection_) {\n return this.featuresCollection_.getArray().slice(0);\n }\n return [];\n }\n\n /**\n * Get the closest feature to the provided coordinate.\n *\n * This method is not available when the source is configured with\n * `useSpatialIndex` set to `false` and the features in this source are of type\n * {@link module:ol/Feature~Feature}.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {function(FeatureType):boolean} [filter] Feature filter function.\n * The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}\n * and it should return a boolean value. By default, no filtering is made.\n * @return {FeatureType|null} Closest feature (or `null` if none found).\n * @api\n */\n getClosestFeatureToCoordinate(coordinate, filter) {\n // Find the closest feature using branch and bound. We start searching an\n // infinite extent, and find the distance from the first feature found. This\n // becomes the closest feature. We then compute a smaller extent which any\n // closer feature must intersect. We continue searching with this smaller\n // extent, trying to find a closer feature. Every time we find a closer\n // feature, we update the extent being searched so that any even closer\n // feature must intersect it. We continue until we run out of features.\n const x = coordinate[0];\n const y = coordinate[1];\n let closestFeature = null;\n const closestPoint = [NaN, NaN];\n let minSquaredDistance = Infinity;\n const extent = [-Infinity, -Infinity, Infinity, Infinity];\n filter = filter ? filter : TRUE;\n this.featuresRtree_.forEachInExtent(\n extent,\n /**\n * @param {FeatureType} feature Feature.\n */\n function (feature) {\n if (filter(feature)) {\n const geometry = feature.getGeometry();\n const previousMinSquaredDistance = minSquaredDistance;\n minSquaredDistance =\n geometry instanceof RenderFeature\n ? 0\n : geometry.closestPointXY(x, y, closestPoint, minSquaredDistance);\n if (minSquaredDistance < previousMinSquaredDistance) {\n closestFeature = feature;\n // This is sneaky. Reduce the extent that it is currently being\n // searched while the R-Tree traversal using this same extent object\n // is still in progress. This is safe because the new extent is\n // strictly contained by the old extent.\n const minDistance = Math.sqrt(minSquaredDistance);\n extent[0] = x - minDistance;\n extent[1] = y - minDistance;\n extent[2] = x + minDistance;\n extent[3] = y + minDistance;\n }\n }\n },\n );\n return closestFeature;\n }\n\n /**\n * Get the extent of the features currently in the source.\n *\n * This method is not available when the source is configured with\n * `useSpatialIndex` set to `false`.\n * @param {import(\"../extent.js\").Extent} [extent] Destination extent. If provided, no new extent\n * will be created. Instead, that extent's coordinates will be overwritten.\n * @return {import(\"../extent.js\").Extent} Extent.\n * @api\n */\n getExtent(extent) {\n return this.featuresRtree_.getExtent(extent);\n }\n\n /**\n * Get a feature by its identifier (the value returned by feature.getId()). When `RenderFeature`s\n * are used, `getFeatureById()` can return an array of `RenderFeature`s. This allows for handling\n * of `GeometryCollection` geometries, where format readers create one `RenderFeature` per\n * `GeometryCollection` member.\n * Note that the index treats string and numeric identifiers as the same. So\n * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.\n *\n * @param {string|number} id Feature identifier.\n * @return {FeatureClassOrArrayOfRenderFeatures<FeatureType>|null} The feature (or `null` if not found).\n * @api\n */\n getFeatureById(id) {\n const feature = this.idIndex_[id.toString()];\n return feature !== undefined\n ? /** @type {FeatureClassOrArrayOfRenderFeatures<FeatureType>} */ (\n feature\n )\n : null;\n }\n\n /**\n * Get a feature by its internal unique identifier (using `getUid`).\n *\n * @param {string} uid Feature identifier.\n * @return {FeatureType|null} The feature (or `null` if not found).\n */\n getFeatureByUid(uid) {\n const feature = this.uidIndex_[uid];\n return feature !== undefined ? feature : null;\n }\n\n /**\n * Get the format associated with this source.\n *\n * @return {import(\"../format/Feature.js\").default<FeatureType>|null}} The feature format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * @return {boolean} The source can have overlapping geometries.\n */\n getOverlaps() {\n return this.overlaps_;\n }\n\n /**\n * Get the url associated with this source.\n *\n * @return {string|import(\"../featureloader.js\").FeatureUrlFunction|undefined} The url.\n * @api\n */\n getUrl() {\n return this.url_;\n }\n\n /**\n * @param {Event} event Event.\n * @private\n */\n handleFeatureChange_(event) {\n const feature = /** @type {FeatureType} */ (event.target);\n const featureKey = getUid(feature);\n const geometry = feature.getGeometry();\n if (!geometry) {\n if (!(featureKey in this.nullGeometryFeatures_)) {\n if (this.featuresRtree_) {\n this.featuresRtree_.remove(feature);\n }\n this.nullGeometryFeatures_[featureKey] = feature;\n }\n } else {\n const extent = geometry.getExtent();\n if (featureKey in this.nullGeometryFeatures_) {\n delete this.nullGeometryFeatures_[featureKey];\n if (this.featuresRtree_) {\n this.featuresRtree_.insert(extent, feature);\n }\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.update(extent, feature);\n }\n }\n }\n const id = feature.getId();\n if (id !== undefined) {\n const sid = id.toString();\n if (this.idIndex_[sid] !== feature) {\n this.removeFromIdIndex_(feature);\n this.idIndex_[sid] = feature;\n }\n } else {\n this.removeFromIdIndex_(feature);\n this.uidIndex_[featureKey] = feature;\n }\n this.changed();\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.CHANGEFEATURE, feature),\n );\n }\n\n /**\n * Returns true if the feature is contained within the source.\n * @param {FeatureType} feature Feature.\n * @return {boolean} Has feature.\n * @api\n */\n hasFeature(feature) {\n const id = feature.getId();\n if (id !== undefined) {\n return id in this.idIndex_;\n }\n return getUid(feature) in this.uidIndex_;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n if (this.featuresRtree_) {\n return (\n this.featuresRtree_.isEmpty() && isEmpty(this.nullGeometryFeatures_)\n );\n }\n if (this.featuresCollection_) {\n return this.featuresCollection_.getLength() === 0;\n }\n return true;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n */\n loadFeatures(extent, resolution, projection) {\n const loadedExtentsRtree = this.loadedExtentsRtree_;\n const extentsToLoad = this.strategy_(extent, resolution, projection);\n for (let i = 0, ii = extentsToLoad.length; i < ii; ++i) {\n const extentToLoad = extentsToLoad[i];\n const alreadyLoaded = loadedExtentsRtree.forEachInExtent(\n extentToLoad,\n /**\n * @param {{extent: import(\"../extent.js\").Extent}} object Object.\n * @return {boolean} Contains.\n */\n function (object) {\n return containsExtent(object.extent, extentToLoad);\n },\n );\n if (!alreadyLoaded) {\n ++this.loadingExtentsCount_;\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.FEATURESLOADSTART),\n );\n this.loader_.call(\n this,\n extentToLoad,\n resolution,\n projection,\n /**\n * @param {Array<FeatureType>} features Loaded features\n */\n (features) => {\n --this.loadingExtentsCount_;\n this.dispatchEvent(\n new VectorSourceEvent(\n VectorEventType.FEATURESLOADEND,\n undefined,\n features,\n ),\n );\n },\n () => {\n --this.loadingExtentsCount_;\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.FEATURESLOADERROR),\n );\n },\n );\n loadedExtentsRtree.insert(extentToLoad, {extent: extentToLoad.slice()});\n }\n }\n this.loading =\n this.loader_.length < 4 ? false : this.loadingExtentsCount_ > 0;\n }\n\n /**\n * @override\n */\n refresh() {\n this.clear(true);\n this.loadedExtentsRtree_.clear();\n super.refresh();\n }\n\n /**\n * Remove an extent from the list of loaded extents.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @api\n */\n removeLoadedExtent(extent) {\n const loadedExtentsRtree = this.loadedExtentsRtree_;\n const obj = loadedExtentsRtree.forEachInExtent(extent, function (object) {\n if (equals(object.extent, extent)) {\n return object;\n }\n });\n if (obj) {\n loadedExtentsRtree.remove(obj);\n }\n }\n\n /**\n * Batch remove features from the source. If you want to remove all features\n * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method\n * instead.\n * @param {Array<FeatureType>} features Features to remove.\n * @api\n */\n removeFeatures(features) {\n let removed = false;\n for (let i = 0, ii = features.length; i < ii; ++i) {\n removed = this.removeFeatureInternal(features[i]) || removed;\n }\n if (removed) {\n this.changed();\n }\n }\n\n /**\n * Remove a single feature from the source. If you want to batch remove\n * features, use the {@link module:ol/source/Vector~VectorSource#removeFeatures #removeFeatures()} method\n * instead.\n * @param {FeatureType} feature Feature to remove.\n * @api\n */\n removeFeature(feature) {\n if (!feature) {\n return;\n }\n const removed = this.removeFeatureInternal(feature);\n if (removed) {\n this.changed();\n }\n }\n\n /**\n * Remove feature without firing a `change` event.\n * @param {FeatureType} feature Feature.\n * @return {boolean} True if the feature was removed, false if it was not found.\n * @protected\n */\n removeFeatureInternal(feature) {\n const featureKey = getUid(feature);\n if (!(featureKey in this.uidIndex_)) {\n return false;\n }\n\n if (featureKey in this.nullGeometryFeatures_) {\n delete this.nullGeometryFeatures_[featureKey];\n } else {\n if (this.featuresRtree_) {\n this.featuresRtree_.remove(feature);\n }\n }\n\n const featureChangeKeys = this.featureChangeKeys_[featureKey];\n featureChangeKeys?.forEach(unlistenByKey);\n delete this.featureChangeKeys_[featureKey];\n\n const id = feature.getId();\n if (id !== undefined) {\n const idString = id.toString();\n const indexedFeature = this.idIndex_[idString];\n if (indexedFeature === feature) {\n delete this.idIndex_[idString];\n } else if (Array.isArray(indexedFeature)) {\n indexedFeature.splice(indexedFeature.indexOf(feature), 1);\n if (indexedFeature.length === 1) {\n this.idIndex_[idString] = indexedFeature[0];\n }\n }\n }\n delete this.uidIndex_[featureKey];\n if (this.hasListener(VectorEventType.REMOVEFEATURE)) {\n this.dispatchEvent(\n new VectorSourceEvent(VectorEventType.REMOVEFEATURE, feature),\n );\n }\n return true;\n }\n\n /**\n * Remove a feature from the id index. Called internally when the feature id\n * may have changed.\n * @param {FeatureType} feature The feature.\n * @private\n */\n removeFromIdIndex_(feature) {\n for (const id in this.idIndex_) {\n if (this.idIndex_[id] === feature) {\n delete this.idIndex_[id];\n break;\n }\n }\n }\n\n /**\n * Set the new loader of the source. The next render cycle will use the\n * new loader.\n * @param {import(\"../featureloader.js\").FeatureLoader} loader The loader to set.\n * @api\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n\n /**\n * Points the source to a new url. The next render cycle will use the new url.\n * @param {string|import(\"../featureloader.js\").FeatureUrlFunction} url Url.\n * @api\n */\n setUrl(url) {\n assert(this.format_, '`format` must be set when `url` is set');\n this.url_ = url;\n this.setLoader(xhr(url, this.format_));\n }\n\n /**\n * @param {boolean} overlaps The source can have overlapping geometries.\n */\n setOverlaps(overlaps) {\n this.overlaps_ = overlaps;\n this.changed();\n }\n}\n\nexport default VectorSource;\n","/**\n * @module ol/vec/mat4\n */\n\n/** @typedef {Array<number>} Mat4 */\n\n/**\n * @return {Mat4} \"4x4 matrix representing a 3D identity transform.\"\n */\nexport function create() {\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n}\n\n/**\n * @param {Mat4} mat4 Flattened 4x4 matrix receiving the result.\n * @param {import(\"../transform.js\").Transform} transform Transformation matrix.\n * @return {Mat4} \"2D transformation matrix as flattened 4x4 matrix.\"\n */\nexport function fromTransform(mat4, transform) {\n mat4[0] = transform[0];\n mat4[1] = transform[1];\n mat4[4] = transform[2];\n mat4[5] = transform[3];\n mat4[12] = transform[4];\n mat4[13] = transform[5];\n return mat4;\n}\n\n/**\n * Generates a orthogonal projection matrix with the given bounds\n *\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 * @param {Mat4} [out] mat4 frustum matrix will be written into\n * @return {Mat4} out\n */\nexport function orthographic(left, right, bottom, top, near, far, out) {\n out = out ?? create();\n const lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n 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 * Scales the mat4 by the dimensions in the given vec3\n *\n * @param {Mat4} m The matrix to scale.\n * @param {number} x How much to scale in the x direction.\n * @param {number} y How much to scale in the y direction.\n * @param {number} z How much to scale in the z direction.\n * @param {Mat4} [out] The matrix to write to.\n * @return {Mat4} out\n */\nexport function scale(m, x, y, z, out) {\n out = out ?? create();\n out[0] = m[0] * x;\n out[1] = m[1] * x;\n out[2] = m[2] * x;\n out[3] = m[3] * x;\n out[4] = m[4] * y;\n out[5] = m[5] * y;\n out[6] = m[6] * y;\n out[7] = m[7] * y;\n out[8] = m[8] * z;\n out[9] = m[9] * z;\n out[10] = m[10] * z;\n out[11] = m[11] * z;\n out[12] = m[12];\n out[13] = m[13];\n out[14] = m[14];\n out[15] = m[15];\n return out;\n}\n\n/**\n * Translate a matrix.\n *\n * @param {Mat4} m the matrix to translate\n * @param {number} x How much to translate in the x direction.\n * @param {number} y How much to translate in the y direction.\n * @param {number} z How much to translate in the z direction.\n * @param {Mat4} [out] the receiving matrix\n * @return {Mat4} out\n */\nexport function translate(m, x, y, z, out) {\n out = out ?? create();\n let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;\n\n if (m === out) {\n out[12] = m[0] * x + m[4] * y + m[8] * z + m[12];\n out[13] = m[1] * x + m[5] * y + m[9] * z + m[13];\n out[14] = m[2] * x + m[6] * y + m[10] * z + m[14];\n out[15] = m[3] * x + m[7] * y + m[11] * z + m[15];\n } else {\n a00 = m[0];\n a01 = m[1];\n a02 = m[2];\n a03 = m[3];\n a10 = m[4];\n a11 = m[5];\n a12 = m[6];\n a13 = m[7];\n a20 = m[8];\n a21 = m[9];\n a22 = m[10];\n a23 = m[11];\n\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\n out[12] = a00 * x + a10 * y + a20 * z + m[12];\n out[13] = a01 * x + a11 * y + a21 * z + m[13];\n out[14] = a02 * x + a12 * y + a22 * z + m[14];\n out[15] = a03 * x + a13 * y + a23 * z + m[15];\n }\n\n return out;\n}\n\n/**\n * @param {number} x x translation.\n * @param {number} y y translation.\n * @param {number} z z translation.\n * @param {Mat4} [out] optional matrix to store result\n * @return {Mat4} out\n */\nexport function translation(x, y, z, out) {\n out = out ?? create();\n\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] = x;\n out[13] = y;\n out[14] = z;\n out[15] = 1;\n\n return out;\n}\n","import * as mat4 from '../vec/mat4.js';\n\n/**\n * @module ol/webgl/Canvas\n */\n\nconst VERTEX_SHADER = `\n attribute vec4 a_position;\n attribute vec4 a_texcoord;\n\n uniform mat4 u_matrix;\n uniform mat4 u_textureMatrix;\n\n varying vec2 v_texcoord;\n\n void main() {\n gl_Position = u_matrix * a_position;\n vec2 texcoord = (u_textureMatrix * a_texcoord).xy;\n v_texcoord = texcoord;\n }\n`;\n\nconst FRAGMENT_SHADER = `\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (\n v_texcoord.x < 0.0 ||\n v_texcoord.y < 0.0 ||\n v_texcoord.x > 1.0 ||\n v_texcoord.y > 1.0\n ) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n`;\n\n/** @typedef {import(\"../transform.js\").Transform} Matrix */\n\n/**\n * Canvas-like operations implemented in webgl.\n */\nexport class Canvas {\n /**\n * @param {WebGLRenderingContext} gl Context to render in.\n */\n constructor(gl) {\n /**\n * @private\n * @type {WebGLRenderingContext}\n */\n this.gl_ = gl;\n\n /**\n * @private\n * @type {WebGLProgram}\n */\n this.program_ = createProgram(gl, FRAGMENT_SHADER, VERTEX_SHADER);\n\n this.positionLocation = gl.getAttribLocation(this.program_, 'a_position');\n this.texcoordLocation = gl.getAttribLocation(this.program_, 'a_texcoord');\n\n this.matrixLocation = gl.getUniformLocation(this.program_, 'u_matrix');\n this.textureMatrixLocation = gl.getUniformLocation(\n this.program_,\n 'u_textureMatrix',\n );\n this.textureLocation = gl.getUniformLocation(this.program_, 'u_texture');\n\n this.positionBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer);\n\n this.positions = [0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1];\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array(this.positions),\n gl.STATIC_DRAW,\n );\n\n this.texcoordBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.texcoordBuffer);\n\n this.texcoords = [0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1];\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array(this.texcoords),\n gl.STATIC_DRAW,\n );\n }\n\n /**\n * 2dContext drawImage call implemented in webgl.\n * Unlike images, textures do not have a width and height associated\n * with them so we'll pass in the width and height of the texture.\n *\n * @param {WebGLTexture} tex Image to draw.\n * @param {number} texWidth Image width.\n * @param {number} texHeight Image height.\n * @param {number} srcX Top-left x-point to read src image.\n * @param {number} srcY Top-left y-point to read src image.\n * @param {number} [srcWidth] Width of source to read.\n * @param {number} [srcHeight] Height of source to read.\n * @param {number} [dstX] Top-left x-point of destination.\n * @param {number} [dstY] Top-left y-point of destination.\n * @param {number} [dstWidth] Width of written image in destination.\n * @param {number} [dstHeight] Height of written image in destination.\n * @param {number} [width] Width of canvas.\n * @param {number} [height] Height of canvas.\n */\n drawImage(\n tex,\n texWidth,\n texHeight,\n srcX,\n srcY,\n srcWidth,\n srcHeight,\n dstX,\n dstY,\n dstWidth,\n dstHeight,\n width,\n height,\n ) {\n const gl = this.gl_;\n\n if (dstX === undefined) {\n dstX = srcX;\n }\n if (dstY === undefined) {\n dstY = srcY;\n }\n if (srcWidth === undefined) {\n srcWidth = texWidth;\n }\n if (srcHeight === undefined) {\n srcHeight = texHeight;\n }\n if (dstWidth === undefined) {\n dstWidth = srcWidth;\n }\n if (dstHeight === undefined) {\n dstHeight = srcHeight;\n }\n if (width === undefined) {\n width = gl.canvas.width;\n }\n if (height === undefined) {\n height = gl.canvas.height;\n }\n\n gl.bindTexture(gl.TEXTURE_2D, tex);\n\n gl.useProgram(this.program_);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer);\n gl.enableVertexAttribArray(this.positionLocation);\n gl.vertexAttribPointer(this.positionLocation, 2, gl.FLOAT, false, 0, 0);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.texcoordBuffer);\n gl.enableVertexAttribArray(this.texcoordLocation);\n gl.vertexAttribPointer(this.texcoordLocation, 2, gl.FLOAT, false, 0, 0);\n\n // matrix for converting pixels to clip space\n let matrix = mat4.orthographic(0, width, 0, height, -1, 1);\n matrix = mat4.translate(matrix, dstX, dstY, 0);\n matrix = mat4.scale(matrix, dstWidth, dstHeight, 1);\n gl.uniformMatrix4fv(this.matrixLocation, false, matrix);\n\n let texMatrix = mat4.translation(srcX / texWidth, srcY / texHeight, 0);\n texMatrix = mat4.scale(\n texMatrix,\n srcWidth / texWidth,\n srcHeight / texHeight,\n 1,\n );\n\n gl.uniformMatrix4fv(this.textureMatrixLocation, false, texMatrix);\n gl.uniform1i(this.textureLocation, 0);\n gl.drawArrays(gl.TRIANGLES, 0, this.positions.length / 2);\n }\n}\n\n/**\n * @param {WebGLRenderingContext} gl Rendering Context.\n * @param {GLenum} type Type of shader.\n * @param {string} source source of shader.\n * @return {WebGLShader} [progam] The program.\n */\nfunction createShader(gl, type, source) {\n const shader = gl.createShader(type);\n\n if (shader === null) {\n throw new Error('Shader compilation failed');\n }\n\n gl.shaderSource(shader, source);\n\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const log = gl.getShaderInfoLog(shader);\n if (log === null) {\n throw new Error('Shader info log creation failed');\n }\n throw new Error(log);\n }\n\n return shader;\n}\n\n/**\n * @param {WebGLRenderingContext} gl Rendering Context.\n * @param {string} fragmentSource Fragment shader source.\n * @param {string} vertexSource Vertex shader source.\n * @return {WebGLProgram} [progam] The program.\n */\nexport function createProgram(gl, fragmentSource, vertexSource) {\n const program = gl.createProgram();\n\n const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexSource);\n const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentSource);\n if (program === null) {\n throw new Error('Program creation failed');\n }\n\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n const log = gl.getProgramInfoLog(program);\n if (log === null) {\n throw new Error('Program info log creation failed');\n }\n throw new Error();\n }\n return program;\n}\n","/**\n * @module ol/reproj/glreproj\n */\nimport {\n createEmpty,\n extend,\n getHeight,\n getTopLeft,\n getWidth,\n} from '../extent.js';\nimport {WORKER_OFFSCREEN_CANVAS} from '../has.js';\nimport * as mat4 from '../vec/mat4.js';\nimport {Canvas as WebGLCanvas, createProgram} from '../webgl/Canvas.js';\n\nconst EDGE_VERTEX_SHADER = `\n attribute vec4 a_position;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n }\n`;\nconst EDGE_FRAGMENT_SHADER = `\n precision mediump float;\n\n uniform vec4 u_val;\n void main() {\n gl_FragColor = u_val;\n }\n`;\n\nconst TRIANGLE_VERTEX_SHADER = `\n attribute vec4 a_position;\n attribute vec2 a_texcoord;\n\n varying vec2 v_texcoord;\n\n uniform mat4 u_matrix;\n\n void main() {\n gl_Position = u_matrix * a_position;\n v_texcoord = a_texcoord;\n }\n`;\nconst TRIANGLE_FRAGMENT_SHADER = `\n precision mediump float;\n\n varying vec2 v_texcoord;\n\n uniform sampler2D u_texture;\n\n void main() {\n if (v_texcoord.x < 0.0 || v_texcoord.x > 1.0 || v_texcoord.y < 0.0 || v_texcoord.y > 1.0) {\n discard;\n }\n gl_FragColor = texture2D(u_texture, v_texcoord);\n }\n`;\n\n/**\n * Create an html canvas element and returns its webgl context.\n * @param {number} [width] Canvas width.\n * @param {number} [height] Canvas height.\n * @param {Array<HTMLCanvasElement | OffscreenCanvas>} [canvasPool] Canvas pool to take existing canvas from.\n * @param {WebGLContextAttributes} [settings] CanvasRenderingContext2DSettings\n * @return {WebGLRenderingContext} The context.\n */\nexport function createCanvasContextWebGL(width, height, canvasPool, settings) {\n /** @type {HTMLCanvasElement|OffscreenCanvas} */\n let canvas;\n if (canvasPool && canvasPool.length) {\n canvas = /** @type {HTMLCanvasElement} */ (canvasPool.shift());\n } else if (WORKER_OFFSCREEN_CANVAS) {\n canvas = new OffscreenCanvas(width || 300, height || 300);\n } else {\n canvas = document.createElement('canvas');\n }\n if (width) {\n canvas.width = width;\n }\n if (height) {\n canvas.height = height;\n }\n //FIXME Allow OffscreenCanvasRenderingContext2D as return type\n return /** @type {WebGLRenderingContext} */ (\n canvas.getContext('webgl', settings)\n );\n}\n\n/**\n * Releases canvas memory to avoid exceeding memory limits in Safari.\n * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/\n * @param {WebGLRenderingContext} gl Context.\n */\nexport function releaseGLCanvas(gl) {\n const canvas = gl.canvas;\n canvas.width = 1;\n canvas.height = 1;\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n}\n\n/**\n * @type {Array<HTMLCanvasElement | OffscreenCanvas>}\n */\nexport const canvasGLPool = [];\n\n/**\n * @typedef {Object} ImageExtent\n * @property {import(\"../extent.js\").Extent} extent Extent.\n * @property {import(\"../extent.js\").Extent} [clipExtent] Clip extent.\n * @property {WebGLTexture} texture Texture.\n * @property {number} width Width of texture.\n * @property {number} height Height of texture.\n */\n\n/**\n * Renders the source data into new canvas based on the triangulation.\n *\n * @param {WebGLRenderingContext} gl the context to render in.\n * @param {number} width_ Width of the canvas.\n * @param {number} height_ Height of the canvas.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} sourceResolution Source resolution.\n * @param {number} targetResolution Target resolution.\n * @param {import(\"../extent.js\").Extent} targetExtent Target extent (tile).\n * @param {import(\"../reproj/Triangulation.js\").default} triangulation Calculated triangulation.\n * @param {Array<ImageExtent>} sources Array of sources.\n * @param {number} gutter Gutter of the sources.\n * @param {number} dataType What kind of data is the textures, must be gl.FLOAT or gl.UNSIGNED_BYTE\n * TODO: Allow setting renderEdges value in the data as this is done in \"data-space\".\n * @param {boolean | Array<number>} [renderEdges] Render reprojection edges.\n * @param {boolean} [interpolate] Use linear interpolation when resampling.\n * @param {boolean} [drawSingle] Draw single source images directly without stitchTexture.\n * @return {{framebuffer: WebGLFramebuffer, width: number, height: number, texture: WebGLTexture}} Canvas with reprojected data.\n */\nexport function render(\n gl,\n width_,\n height_,\n pixelRatio,\n sourceResolution,\n targetResolution,\n targetExtent,\n triangulation,\n sources,\n gutter,\n dataType,\n renderEdges,\n interpolate,\n drawSingle,\n) {\n const width = Math.round(pixelRatio * width_);\n const height = Math.round(pixelRatio * height_);\n gl.canvas.width = width;\n gl.canvas.height = height;\n\n /** @type {WebGLFramebuffer | null} */\n let resultFrameBuffer;\n /** @type {WebGLTexture | null} */\n let resultTexture;\n {\n resultTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, resultTexture);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n if (interpolate) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n } else {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n }\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n width,\n height,\n 0,\n gl.RGBA,\n dataType,\n null,\n );\n\n resultFrameBuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, resultFrameBuffer);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n resultTexture,\n 0,\n );\n }\n\n if (resultFrameBuffer === null) {\n throw new Error('Could not create framebuffer');\n }\n if (resultTexture === null) {\n throw new Error('Could not create texture');\n }\n\n if (sources.length === 0) {\n return {\n width,\n height,\n framebuffer: resultFrameBuffer,\n texture: resultTexture,\n };\n }\n\n const sourceDataExtent = createEmpty();\n sources.forEach(function (src, i, arr) {\n extend(sourceDataExtent, src.extent);\n });\n\n /** @type {WebGLTexture | null} */\n let stitchTexture;\n /** @type {number} */\n let stitchWidth;\n /** @type {number} */\n let stitchHeight;\n const stitchScale = 1 / sourceResolution;\n\n if (!drawSingle || sources.length !== 1 || gutter !== 0) {\n stitchTexture = gl.createTexture();\n if (resultTexture === null) {\n throw new Error('Could not create texture');\n }\n stitchWidth = Math.round(getWidth(sourceDataExtent) * stitchScale);\n stitchHeight = Math.round(getHeight(sourceDataExtent) * stitchScale);\n\n // Make sure we do not exceed the max texture size by lowering the resolution for this image.\n // https://github.com/openlayers/openlayers/pull/15860#issuecomment-2254123580\n const maxTexSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n const largeSide = Math.max(stitchWidth, stitchHeight);\n const scaleFactor = largeSide > maxTexSize ? maxTexSize / largeSide : 1;\n const stitchWidthFixed = Math.round(stitchWidth * scaleFactor);\n const stitchHeightFixed = Math.round(stitchHeight * scaleFactor);\n\n gl.bindTexture(gl.TEXTURE_2D, stitchTexture);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n if (interpolate) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n } else {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n }\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n stitchWidthFixed,\n stitchHeightFixed,\n 0,\n gl.RGBA,\n dataType,\n null,\n );\n\n const fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n stitchTexture,\n 0,\n );\n const webGLCanvas = new WebGLCanvas(gl);\n\n sources.forEach(function (src, i, arr) {\n const xPos =\n (src.extent[0] - sourceDataExtent[0]) * stitchScale * scaleFactor;\n const yPos =\n -(src.extent[3] - sourceDataExtent[3]) * stitchScale * scaleFactor;\n const srcWidth = getWidth(src.extent) * stitchScale * scaleFactor;\n const srcHeight = getHeight(src.extent) * stitchScale * scaleFactor;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.viewport(0, 0, stitchWidthFixed, stitchHeightFixed);\n\n if (src.clipExtent) {\n const xPos =\n (src.clipExtent[0] - sourceDataExtent[0]) * stitchScale * scaleFactor;\n const yPos =\n -(src.clipExtent[3] - sourceDataExtent[3]) *\n stitchScale *\n scaleFactor;\n const width = getWidth(src.clipExtent) * stitchScale * scaleFactor;\n const height = getHeight(src.clipExtent) * stitchScale * scaleFactor;\n gl.enable(gl.SCISSOR_TEST);\n gl.scissor(\n interpolate ? xPos : Math.round(xPos),\n interpolate ? yPos : Math.round(yPos),\n interpolate ? width : Math.round(xPos + width) - Math.round(xPos),\n interpolate ? height : Math.round(yPos + height) - Math.round(yPos),\n );\n }\n\n webGLCanvas.drawImage(\n src.texture,\n src.width,\n src.height,\n gutter,\n gutter,\n src.width - 2 * gutter,\n src.height - 2 * gutter,\n interpolate ? xPos : Math.round(xPos),\n interpolate ? yPos : Math.round(yPos),\n interpolate ? srcWidth : Math.round(xPos + srcWidth) - Math.round(xPos),\n interpolate\n ? srcHeight\n : Math.round(yPos + srcHeight) - Math.round(yPos),\n stitchWidthFixed,\n stitchHeightFixed,\n );\n\n gl.disable(gl.SCISSOR_TEST);\n });\n gl.deleteFramebuffer(fb);\n } else {\n stitchTexture = sources[0].texture;\n stitchWidth = sources[0].width;\n stitchHeight = sources[0].width;\n }\n\n const targetTopLeft = getTopLeft(targetExtent);\n const sourceTopLeft = getTopLeft(sourceDataExtent);\n\n const getUVs = (\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */ target,\n ) => {\n const u0 =\n ((target[0][0] - targetTopLeft[0]) / targetResolution) * pixelRatio;\n const v0 =\n (-(target[0][1] - targetTopLeft[1]) / targetResolution) * pixelRatio;\n const u1 =\n ((target[1][0] - targetTopLeft[0]) / targetResolution) * pixelRatio;\n const v1 =\n (-(target[1][1] - targetTopLeft[1]) / targetResolution) * pixelRatio;\n const u2 =\n ((target[2][0] - targetTopLeft[0]) / targetResolution) * pixelRatio;\n const v2 =\n (-(target[2][1] - targetTopLeft[1]) / targetResolution) * pixelRatio;\n return {u1, v1, u0, v0, u2, v2};\n };\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, resultFrameBuffer);\n gl.viewport(0, 0, width, height);\n\n // Draw source to reprojtile\n {\n /** @type {Array<number>} */\n const vertices = [];\n /** @type {Array<number>} */\n const texcoords = [];\n\n const triProgram = createProgram(\n gl,\n TRIANGLE_FRAGMENT_SHADER,\n TRIANGLE_VERTEX_SHADER,\n );\n gl.useProgram(triProgram);\n\n // Bind image\n const textureLocation = gl.getUniformLocation(triProgram, 'u_texture');\n gl.bindTexture(gl.TEXTURE_2D, stitchTexture);\n\n // Tell the shader to get the texture from texture unit 0\n gl.uniform1i(textureLocation, 0);\n\n // Calculate vert and tex coordinates.\n triangulation.getTriangles().forEach(function (triangle, i, arr) {\n const source = triangle.source;\n const target = triangle.target;\n // Make sure that everything is on pixel boundaries\n const {u1, v1, u0, v0, u2, v2} = getUVs(target);\n\n const su0 =\n (source[0][0] - sourceTopLeft[0]) / sourceResolution / stitchWidth;\n const sv0 =\n -(source[0][1] - sourceTopLeft[1]) / sourceResolution / stitchHeight;\n const su1 =\n (source[1][0] - sourceTopLeft[0]) / sourceResolution / stitchWidth;\n const sv1 =\n -(source[1][1] - sourceTopLeft[1]) / sourceResolution / stitchHeight;\n const su2 =\n (source[2][0] - sourceTopLeft[0]) / sourceResolution / stitchWidth;\n const sv2 =\n -(source[2][1] - sourceTopLeft[1]) / sourceResolution / stitchHeight;\n\n vertices.push(u1, v1, u0, v0, u2, v2);\n texcoords.push(su1, sv1, su0, sv0, su2, sv2);\n });\n\n // Convert pixel space to clip space.\n const matrix = mat4.orthographic(0, width, height, 0, -1, 1);\n const matrixLocation = gl.getUniformLocation(triProgram, 'u_matrix');\n gl.uniformMatrix4fv(matrixLocation, false, matrix);\n\n const positionLocation = gl.getAttribLocation(triProgram, 'a_position');\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 gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(positionLocation);\n\n const texcoordLocation = gl.getAttribLocation(triProgram, 'a_texcoord');\n const texcoordBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, texcoordBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(texcoords), gl.STATIC_DRAW);\n gl.vertexAttribPointer(texcoordLocation, 2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(texcoordLocation);\n\n gl.drawArrays(gl.TRIANGLES, 0, vertices.length / 2);\n }\n\n if (renderEdges) {\n const edgeProgram = createProgram(\n gl,\n EDGE_FRAGMENT_SHADER,\n EDGE_VERTEX_SHADER,\n );\n gl.useProgram(edgeProgram);\n const matrix = mat4.orthographic(0, width, height, 0, -1, 1);\n const matrixLocation = gl.getUniformLocation(edgeProgram, 'u_matrix');\n gl.uniformMatrix4fv(matrixLocation, false, matrix);\n\n const burnval = Array.isArray(renderEdges) ? renderEdges : [0, 0, 0, 255];\n const burnvalLocation = gl.getUniformLocation(edgeProgram, 'u_val');\n const isFloat = true;\n if (isFloat) {\n gl.uniform4fv(burnvalLocation, burnval);\n } else {\n gl.uniform4iv(burnvalLocation, burnval);\n }\n\n const positionLocation = gl.getAttribLocation(edgeProgram, 'a_position');\n const positionBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);\n gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(positionLocation);\n\n /** @type {Array<number>} */\n const lines = triangulation.getTriangles().reduce(function (\n /** @type {Array<number>} */ lines,\n triangle,\n ) {\n const target = triangle.target;\n const {u1, v1, u0, v0, u2, v2} = getUVs(target);\n\n return lines.concat([u1, v1, u0, v0, u0, v0, u2, v2, u2, v2, u1, v1]);\n }, []);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(lines), gl.STATIC_DRAW);\n gl.drawArrays(gl.LINES, 0, lines.length / 2);\n }\n\n return {\n width,\n height,\n framebuffer: resultFrameBuffer,\n texture: resultTexture,\n };\n}\n","/**\n * @module ol/reproj/DataTile\n */\n\nimport DataTile, {asArrayLike, asImageLike, toArray} from '../DataTile.js';\nimport TileState from '../TileState.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {getArea, getIntersection, getWidth, wrapAndSliceX} from '../extent.js';\nimport {clamp} from '../math.js';\nimport {calculateSourceExtentResolution} from '../reproj.js';\nimport Triangulation from './Triangulation.js';\nimport {ERROR_THRESHOLD} from './common.js';\nimport {\n canvasGLPool,\n createCanvasContextWebGL,\n releaseGLCanvas,\n render as renderReprojected,\n} from './glreproj.js';\n\n/**\n * @typedef {function(number, number, number, number) : import(\"../DataTile.js\").default} TileGetter\n */\n\n/**\n * @typedef {Object} TileOffset\n * @property {DataTile} tile Tile.\n * @property {number} offset Offset.\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../proj/Projection.js\").default} sourceProj Source projection.\n * @property {import(\"../tilegrid/TileGrid.js\").default} sourceTileGrid Source tile grid.\n * @property {import(\"../proj/Projection.js\").default} targetProj Target projection.\n * @property {import(\"../tilegrid/TileGrid.js\").default} targetTileGrid Target tile grid.\n * @property {import(\"../tilecoord.js\").TileCoord} tileCoord Coordinate of the tile.\n * @property {import(\"../tilecoord.js\").TileCoord} [wrappedTileCoord] Coordinate of the tile wrapped in X.\n * @property {number} pixelRatio Pixel ratio.\n * @property {number} gutter Gutter of the source tiles.\n * @property {TileGetter} getTileFunction Function returning source tiles (z, x, y, pixelRatio).\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @property {number} [errorThreshold] Acceptable reprojection error (in px).\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {import(\"../transform.js\").Transform} [transformMatrix] Source transform matrix.\n * @property {boolean} [renderEdges] Render reprojection edges.\n */\n\n/**\n * @classdesc\n * Class encapsulating single reprojected data tile.\n * See {@link module:ol/source/DataTile~DataTileSource}.\n *\n */\nclass ReprojDataTile extends DataTile {\n /**\n * @param {Options} options Tile options.\n */\n constructor(options) {\n super({\n tileCoord: options.tileCoord,\n loader: () => Promise.resolve(new Uint8ClampedArray(4)),\n interpolate: options.interpolate,\n transition: options.transition,\n });\n\n /**\n * @private\n * @type {boolean | Array<number>}\n */\n this.renderEdges_ =\n options.renderEdges !== undefined ? options.renderEdges : false;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = options.pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.gutter_ = options.gutter;\n\n /**\n * @type {import(\"../DataTile.js\").Data}\n * @private\n */\n this.reprojData_ = null;\n\n /**\n * @type {Error}\n * @private\n */\n this.reprojError_ = null;\n\n /**\n * @type {import('../size.js').Size}\n * @private\n */\n this.reprojSize_ = undefined;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.sourceTileGrid_ = options.sourceTileGrid;\n\n /**\n * @private\n * @type {import(\"../tilegrid/TileGrid.js\").default}\n */\n this.targetTileGrid_ = options.targetTileGrid;\n\n /**\n * @private\n * @type {import(\"../tilecoord.js\").TileCoord}\n */\n this.wrappedTileCoord_ = options.wrappedTileCoord || options.tileCoord;\n\n /**\n * @private\n * @type {!Array<TileOffset>}\n */\n this.sourceTiles_ = [];\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.sourcesListenerKeys_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.sourceZ_ = 0;\n\n const sourceProj = options.sourceProj;\n const sourceProjExtent = sourceProj.getExtent();\n const sourceTileGridExtent = options.sourceTileGrid.getExtent();\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.clipExtent_ = sourceProj.canWrapX()\n ? sourceTileGridExtent\n ? getIntersection(sourceProjExtent, sourceTileGridExtent)\n : sourceProjExtent\n : sourceTileGridExtent;\n\n const targetExtent = this.targetTileGrid_.getTileCoordExtent(\n this.wrappedTileCoord_,\n );\n const maxTargetExtent = this.targetTileGrid_.getExtent();\n let maxSourceExtent = this.sourceTileGrid_.getExtent();\n\n const limitedTargetExtent = maxTargetExtent\n ? getIntersection(targetExtent, maxTargetExtent)\n : targetExtent;\n\n if (getArea(limitedTargetExtent) === 0) {\n // Tile is completely outside range -> EMPTY\n // TODO: is it actually correct that the source even creates the tile ?\n this.state = TileState.EMPTY;\n return;\n }\n\n if (sourceProjExtent) {\n if (!maxSourceExtent) {\n maxSourceExtent = sourceProjExtent;\n } else {\n maxSourceExtent = getIntersection(maxSourceExtent, sourceProjExtent);\n }\n }\n\n const targetResolution = this.targetTileGrid_.getResolution(\n this.wrappedTileCoord_[0],\n );\n\n const targetProj = options.targetProj;\n const sourceResolution = calculateSourceExtentResolution(\n sourceProj,\n targetProj,\n limitedTargetExtent,\n targetResolution,\n );\n\n if (!isFinite(sourceResolution) || sourceResolution <= 0) {\n // invalid sourceResolution -> EMPTY\n // probably edges of the projections when no extent is defined\n this.state = TileState.EMPTY;\n return;\n }\n\n const errorThresholdInPixels =\n options.errorThreshold !== undefined\n ? options.errorThreshold\n : ERROR_THRESHOLD;\n\n /**\n * @private\n * @type {!import(\"./Triangulation.js\").default}\n */\n this.triangulation_ = new Triangulation(\n sourceProj,\n targetProj,\n limitedTargetExtent,\n maxSourceExtent,\n sourceResolution * errorThresholdInPixels,\n targetResolution,\n options.transformMatrix,\n );\n\n if (this.triangulation_.getTriangles().length === 0) {\n // no valid triangles -> EMPTY\n this.state = TileState.EMPTY;\n return;\n }\n\n this.sourceZ_ = this.sourceTileGrid_.getZForResolution(sourceResolution);\n let sourceExtent = this.triangulation_.calculateSourceExtent();\n\n if (maxSourceExtent) {\n if (sourceProj.canWrapX()) {\n sourceExtent[1] = clamp(\n sourceExtent[1],\n maxSourceExtent[1],\n maxSourceExtent[3],\n );\n sourceExtent[3] = clamp(\n sourceExtent[3],\n maxSourceExtent[1],\n maxSourceExtent[3],\n );\n } else {\n sourceExtent = getIntersection(sourceExtent, maxSourceExtent);\n }\n }\n\n if (!getArea(sourceExtent)) {\n this.state = TileState.EMPTY;\n } else {\n let worldWidth = 0;\n let worldsAway = 0;\n if (sourceProj.canWrapX()) {\n worldWidth = getWidth(sourceProjExtent);\n worldsAway = Math.floor(\n (sourceExtent[0] - sourceProjExtent[0]) / worldWidth,\n );\n }\n\n const sourceExtents = wrapAndSliceX(\n sourceExtent.slice(),\n sourceProj,\n true,\n );\n sourceExtents.forEach((extent) => {\n const sourceRange = this.sourceTileGrid_.getTileRangeForExtentAndZ(\n extent,\n this.sourceZ_,\n );\n const getTile = options.getTileFunction;\n for (let srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {\n for (let srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) {\n const tile = getTile(this.sourceZ_, srcX, srcY, this.pixelRatio_);\n if (tile) {\n const offset = worldsAway * worldWidth;\n this.sourceTiles_.push({tile, offset});\n }\n }\n }\n ++worldsAway;\n });\n\n if (this.sourceTiles_.length === 0) {\n this.state = TileState.EMPTY;\n }\n }\n }\n\n /**\n * Get the tile size.\n * @return {import('../size.js').Size} Tile size.\n * @override\n */\n getSize() {\n return this.reprojSize_;\n }\n\n /**\n * Get the data for the tile.\n * @return {import(\"../DataTile.js\").Data} Tile data.\n * @override\n */\n getData() {\n return this.reprojData_;\n }\n\n /**\n * Get any loading error.\n * @return {Error} Loading error.\n * @override\n */\n getError() {\n return this.reprojError_;\n }\n\n /**\n * @private\n */\n reproject_() {\n const dataSources = [];\n let imageLike = false;\n this.sourceTiles_.forEach((source) => {\n const tile = source.tile;\n if (!tile || tile.getState() !== TileState.LOADED) {\n return;\n }\n const size = tile.getSize();\n const gutter = this.gutter_;\n /**\n * @type {import(\"../DataTile.js\").ArrayLike}\n */\n let tileData;\n const arrayData = asArrayLike(tile.getData());\n if (arrayData) {\n tileData = arrayData;\n } else {\n imageLike = true;\n tileData = toArray(asImageLike(tile.getData()));\n }\n const pixelSize = [size[0] + 2 * gutter, size[1] + 2 * gutter];\n const isFloat = tileData instanceof Float32Array;\n const pixelCount = pixelSize[0] * pixelSize[1];\n const DataType = isFloat ? Float32Array : Uint8ClampedArray;\n const tileDataR = new DataType(tileData.buffer);\n const bytesPerElement = DataType.BYTES_PER_ELEMENT;\n const bytesPerPixel = (bytesPerElement * tileDataR.length) / pixelCount;\n const bytesPerRow = tileDataR.byteLength / pixelSize[1];\n const bandCount = Math.floor(\n bytesPerRow / bytesPerElement / pixelSize[0],\n );\n const extent = this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord);\n extent[0] += source.offset;\n extent[2] += source.offset;\n const clipExtent = this.clipExtent_?.slice();\n if (clipExtent) {\n clipExtent[0] += source.offset;\n clipExtent[2] += source.offset;\n }\n dataSources.push({\n extent: extent,\n clipExtent: clipExtent,\n data: tileDataR,\n dataType: DataType,\n bytesPerPixel: bytesPerPixel,\n pixelSize: pixelSize,\n bandCount: bandCount,\n });\n });\n this.sourceTiles_.length = 0;\n\n if (dataSources.length === 0) {\n this.state = TileState.ERROR;\n this.changed();\n return;\n }\n\n const z = this.wrappedTileCoord_[0];\n const size = this.targetTileGrid_.getTileSize(z);\n const targetWidth = typeof size === 'number' ? size : size[0];\n const targetHeight = typeof size === 'number' ? size : size[1];\n const outWidth = targetWidth * this.pixelRatio_;\n const outHeight = targetHeight * this.pixelRatio_;\n const targetResolution = this.targetTileGrid_.getResolution(z);\n const sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_);\n\n const targetExtent = this.targetTileGrid_.getTileCoordExtent(\n this.wrappedTileCoord_,\n );\n\n const bandCount = dataSources[0].bandCount;\n const dataR = new dataSources[0].dataType(bandCount * outWidth * outHeight);\n\n const gl = createCanvasContextWebGL(outWidth, outHeight, canvasGLPool, {\n premultipliedAlpha: false,\n antialias: false,\n });\n\n let willInterpolate;\n const format = gl.RGBA;\n let textureType;\n if (dataSources[0].dataType == Float32Array) {\n textureType = gl.FLOAT;\n gl.getExtension('WEBGL_color_buffer_float');\n gl.getExtension('OES_texture_float');\n gl.getExtension('EXT_float_blend');\n const extension = gl.getExtension('OES_texture_float_linear');\n const canInterpolate = extension !== null;\n willInterpolate = canInterpolate && this.interpolate;\n } else {\n textureType = gl.UNSIGNED_BYTE;\n willInterpolate = this.interpolate;\n }\n\n const BANDS_PR_REPROJ = 4;\n const reprojs = Math.ceil(bandCount / BANDS_PR_REPROJ);\n for (let reproj = reprojs - 1; reproj >= 0; --reproj) {\n const sources = [];\n for (let i = 0, len = dataSources.length; i < len; ++i) {\n const dataSource = dataSources[i];\n\n const pixelSize = dataSource.pixelSize;\n const width = pixelSize[0];\n const height = pixelSize[1];\n\n const data = new dataSource.dataType(BANDS_PR_REPROJ * width * height);\n const dataS = dataSource.data;\n let offset = reproj * BANDS_PR_REPROJ;\n for (let j = 0, len = data.length; j < len; j += BANDS_PR_REPROJ) {\n data[j] = dataS[offset];\n data[j + 1] = dataS[offset + 1];\n data[j + 2] = dataS[offset + 2];\n data[j + 3] = dataS[offset + 3];\n offset += bandCount;\n }\n\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n if (willInterpolate) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n } else {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n }\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n format,\n width,\n height,\n 0,\n format,\n textureType,\n data,\n );\n\n sources.push({\n extent: dataSource.extent,\n clipExtent: dataSource.clipExtent,\n texture: texture,\n width: width,\n height: height,\n });\n }\n\n const {framebuffer, width, height} = renderReprojected(\n gl,\n targetWidth,\n targetHeight,\n this.pixelRatio_,\n sourceResolution,\n targetResolution,\n targetExtent,\n this.triangulation_,\n sources,\n this.gutter_,\n textureType,\n this.renderEdges_,\n willInterpolate,\n );\n\n // The texture is always RGBA.\n const rows = width;\n const cols = height * BANDS_PR_REPROJ;\n const data = new dataSources[0].dataType(rows * cols);\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n gl.readPixels(0, 0, width, height, gl.RGBA, textureType, data);\n\n let offset = reproj * BANDS_PR_REPROJ;\n for (let i = 0, len = data.length; i < len; i += BANDS_PR_REPROJ) {\n // The data read by `readPixels` is flipped in the y-axis so flip it again.\n const flipY = (rows - 1 - ((i / cols) | 0)) * cols + (i % cols);\n dataR[offset] = data[flipY];\n dataR[offset + 1] = data[flipY + 1];\n dataR[offset + 2] = data[flipY + 2];\n dataR[offset + 3] = data[flipY + 3];\n offset += bandCount;\n }\n }\n\n releaseGLCanvas(gl);\n canvasGLPool.push(gl.canvas);\n\n if (imageLike) {\n const context = createCanvasContext2D(targetWidth, targetHeight);\n const imageData = new ImageData(dataR, targetWidth);\n context.putImageData(imageData, 0, 0);\n this.reprojData_ = context.canvas;\n } else {\n this.reprojData_ = dataR;\n }\n this.reprojSize_ = [Math.round(outWidth), Math.round(outHeight)];\n this.state = TileState.LOADED;\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {\n if (this.state !== TileState.IDLE && this.state !== TileState.ERROR) {\n return;\n }\n this.state = TileState.LOADING;\n this.changed();\n\n let leftToLoad = 0;\n\n this.sourcesListenerKeys_ = [];\n this.sourceTiles_.forEach(({tile}) => {\n const state = tile.getState();\n if (state !== TileState.IDLE && state !== TileState.LOADING) {\n return;\n }\n leftToLoad++;\n\n const sourceListenKey = listen(tile, EventType.CHANGE, () => {\n const state = tile.getState();\n if (\n state == TileState.LOADED ||\n state == TileState.ERROR ||\n state == TileState.EMPTY\n ) {\n unlistenByKey(sourceListenKey);\n leftToLoad--;\n if (leftToLoad === 0) {\n this.unlistenSources_();\n this.reproject_();\n }\n }\n });\n this.sourcesListenerKeys_.push(sourceListenKey);\n });\n\n if (leftToLoad === 0) {\n setTimeout(this.reproject_.bind(this), 0);\n } else {\n this.sourceTiles_.forEach(function ({tile}) {\n const state = tile.getState();\n if (state == TileState.IDLE) {\n tile.load();\n }\n });\n }\n }\n\n /**\n * @private\n */\n unlistenSources_() {\n this.sourcesListenerKeys_.forEach(unlistenByKey);\n this.sourcesListenerKeys_ = null;\n }\n}\n\nexport default ReprojDataTile;\n","/**\n * @module ol/source/DataTile\n */\nimport DataTile from '../DataTile.js';\nimport TileState from '../TileState.js';\nimport EventType from '../events/EventType.js';\nimport {toPromise} from '../functions.js';\nimport {equivalent, get as getProjection} from '../proj.js';\nimport ReprojDataTile from '../reproj/DataTile.js';\nimport {toSize} from '../size.js';\nimport {\n createXYZ,\n extentFromProjection,\n getForProjection as getTileGridForProjection,\n} from '../tilegrid.js';\nimport {getUid} from '../util.js';\nimport TileSource, {TileSourceEvent} from './Tile.js';\nimport TileEventType from './TileEventType.js';\n\n/**\n * @typedef {'anonymous'|'use-credentials'} CrossOriginAttribute\n */\n\n/**\n * @typedef {Object} LoaderOptions\n * @property {AbortSignal} signal An abort controller signal.\n * @property {CrossOriginAttribute} [crossOrigin] The cross-origin attribute for images.\n * @property {number} [maxY] The maximum y coordinate at the given z level. Will be undefined if the\n * underlying tile grid does not have a known extent.\n */\n\n/**\n * Data tile loading function. The function is called with z, x, and y tile coordinates and\n * returns {@link import(\"../DataTile.js\").Data data} for a tile or a promise for the same.\n * @typedef {function(number, number, number, LoaderOptions) : (import(\"../DataTile.js\").Data|Promise<import(\"../DataTile.js\").Data>)} Loader\n */\n\n/**\n * @typedef {Object} Options\n * @property {Loader} [loader] Data loader. Called with z, x, and y tile coordinates.\n * Returns {@link import(\"../DataTile.js\").Data data} for a tile or a promise for the same.\n * For loaders that generate images, the promise should not resolve until the image is loaded.\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [maxZoom=42] Optional max zoom level. Not used if `tileGrid` is provided.\n * @property {number} [minZoom=0] Optional min zoom level. Not used if `tileGrid` is provided.\n * @property {number|import(\"../size.js\").Size} [tileSize=[256, 256]] The pixel width and height of the source tiles.\n * This may be different than the rendered pixel size if a `tileGrid` is provided.\n * @property {number} [gutter=0] The size in pixels of the gutter around data tiles to ignore.\n * This allows artifacts of rendering at tile edges to be ignored.\n * Supported data should be wider and taller than the tile size by a value of `2 x gutter`.\n * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Tile projection.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {import(\"./Source.js\").State} [state] The source state.\n * @property {boolean} [wrapX=false] Render tiles beyond the antimeridian.\n * @property {number} [transition] Transition time when fading in new tiles (in milliseconds).\n * @property {number} [bandCount=4] Number of bands represented in the data.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @property {CrossOriginAttribute} [crossOrigin='anonymous'] The crossOrigin property to pass to loaders for image data.\n * @property {string} [key] Key for use in caching tiles.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * A source for typed array data tiles.\n *\n * @fires import(\"./Tile.js\").TileSourceEvent\n * @template {import(\"../Tile.js\").default} [TileType=DataTile]\n * @extends TileSource<TileType>\n * @api\n */\nclass DataTileSource extends TileSource {\n /**\n * @param {Options} options DataTile source options.\n */\n constructor(options) {\n const projection =\n options.projection === undefined ? 'EPSG:3857' : options.projection;\n\n let tileGrid = options.tileGrid;\n if (tileGrid === undefined && projection) {\n tileGrid = createXYZ({\n extent: extentFromProjection(projection),\n maxResolution: options.maxResolution,\n maxZoom: options.maxZoom,\n minZoom: options.minZoom,\n tileSize: options.tileSize,\n });\n }\n\n super({\n cacheSize: 0.1, // don't cache on the source\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n projection: projection,\n tileGrid: tileGrid,\n state: options.state,\n wrapX: options.wrapX,\n transition: options.transition,\n interpolate: options.interpolate,\n key: options.key,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {number}\n */\n this.gutter_ = options.gutter !== undefined ? options.gutter : 0;\n\n /**\n * @private\n * @type {import('../size.js').Size|null}\n */\n this.tileSize_ = options.tileSize ? toSize(options.tileSize) : null;\n\n /**\n * @private\n * @type {Array<import('../size.js').Size>|null}\n */\n this.tileSizes_ = null;\n\n /**\n * @private\n * @type {!Object<string, boolean>}\n */\n this.tileLoadingKeys_ = {};\n\n /**\n * @private\n */\n this.loader_ = options.loader;\n\n /**\n * @private\n */\n this.handleTileChange_ = this.handleTileChange_.bind(this);\n\n /**\n * @type {number}\n */\n this.bandCount = options.bandCount === undefined ? 4 : options.bandCount; // assume RGBA if undefined\n\n /**\n * @private\n * @type {!Object<string, import(\"../tilegrid/TileGrid.js\").default>}\n */\n this.tileGridForProjection_ = {};\n\n /**\n * @private\n * @type {CrossOriginAttribute}\n */\n this.crossOrigin_ = options.crossOrigin || 'anonymous';\n\n /**\n * @type {import(\"../transform.js\").Transform|null}\n */\n this.transformMatrix = null;\n }\n\n /**\n * Set the source tile sizes. The length of the array is expected to match the number of\n * levels in the tile grid.\n * @protected\n * @param {Array<import('../size.js').Size>} tileSizes An array of tile sizes.\n */\n setTileSizes(tileSizes) {\n this.tileSizes_ = tileSizes;\n }\n\n /**\n * Get the source tile size at the given zoom level. This may be different than the rendered tile\n * size.\n * @protected\n * @param {number} z Tile zoom level.\n * @return {import('../size.js').Size} The source tile size.\n */\n getTileSize(z) {\n if (this.tileSizes_) {\n return this.tileSizes_[z];\n }\n if (this.tileSize_) {\n return this.tileSize_;\n }\n const tileGrid = this.getTileGrid();\n return tileGrid ? toSize(tileGrid.getTileSize(z)) : [256, 256];\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {number} Gutter.\n * @override\n */\n getGutterForProjection(projection) {\n const thisProj = this.getProjection();\n if (\n (!thisProj || equivalent(thisProj, projection)) &&\n !this.transformMatrix\n ) {\n return this.gutter_;\n }\n\n return 0;\n }\n\n /**\n * @param {Loader} loader The data loader.\n * @protected\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {import(\"../proj/Projection.js\").default} targetProj The output projection.\n * @param {import(\"../proj/Projection.js\").default} sourceProj The input projection.\n * @return {!TileType} Tile.\n */\n getReprojTile_(z, x, y, targetProj, sourceProj) {\n const sourceTileGrid =\n this.tileGrid || this.getTileGridForProjection(sourceProj || targetProj);\n const reprojTilePixelRatio = Math.max.apply(\n null,\n sourceTileGrid.getResolutions().map((r, z) => {\n const tileSize = toSize(sourceTileGrid.getTileSize(z));\n const textureSize = this.getTileSize(z);\n return Math.max(\n textureSize[0] / tileSize[0],\n textureSize[1] / tileSize[1],\n );\n }),\n );\n\n const targetTileGrid = this.getTileGridForProjection(targetProj);\n const tileCoord = [z, x, y];\n const wrappedTileCoord = this.getTileCoordForTileUrlFunction(\n tileCoord,\n targetProj,\n );\n\n const options = Object.assign(\n {\n sourceProj: sourceProj || targetProj,\n sourceTileGrid,\n targetProj,\n targetTileGrid,\n tileCoord,\n wrappedTileCoord,\n pixelRatio: reprojTilePixelRatio,\n gutter: this.gutter_,\n getTileFunction: (z, x, y, pixelRatio) =>\n this.getTile(z, x, y, pixelRatio),\n transformMatrix: this.transformMatrix,\n },\n /** @type {import(\"../reproj/DataTile.js\").Options} */ (this.tileOptions),\n );\n const tile = /** @type {TileType} */ (\n /** @type {*} */ (new ReprojDataTile(options))\n );\n tile.key = this.getKey();\n return tile;\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} [projection] Projection.\n * @return {TileType|null} Tile (or null if outside source extent).\n * @override\n */\n getTile(z, x, y, pixelRatio, projection) {\n const sourceProjection = this.getProjection();\n if (\n projection &&\n ((sourceProjection && !equivalent(sourceProjection, projection)) ||\n this.transformMatrix)\n ) {\n return this.getReprojTile_(z, x, y, projection, sourceProjection);\n }\n\n const size = this.getTileSize(z);\n\n const sourceLoader = this.loader_;\n\n const controller = new AbortController();\n\n /**\n * @type {LoaderOptions}\n */\n const loaderOptions = {\n signal: controller.signal,\n crossOrigin: this.crossOrigin_,\n };\n\n const tileCoord = this.getTileCoordForTileUrlFunction([z, x, y]);\n if (!tileCoord) {\n return null;\n }\n\n const requestZ = tileCoord[0];\n const requestX = tileCoord[1];\n const requestY = tileCoord[2];\n const range = this.getTileGrid()?.getFullTileRange(requestZ);\n if (range) {\n loaderOptions.maxY = range.getHeight() - 1;\n }\n function loader() {\n return toPromise(function () {\n return sourceLoader(requestZ, requestX, requestY, loaderOptions);\n });\n }\n\n /**\n * @type {import(\"../DataTile.js\").Options}\n */\n const options = Object.assign(\n {\n tileCoord: [z, x, y],\n loader: loader,\n size: size,\n controller: controller,\n },\n this.tileOptions,\n );\n\n const tile = /** @type {TileType} */ (\n /** @type {*} */ (new DataTile(options))\n );\n tile.key = this.getKey();\n tile.addEventListener(EventType.CHANGE, this.handleTileChange_);\n\n return tile;\n }\n\n /**\n * Handle tile change events.\n * @param {import(\"../events/Event.js\").default} event Event.\n */\n handleTileChange_(event) {\n const tile = /** @type {import(\"../Tile.js\").default} */ (event.target);\n const uid = getUid(tile);\n const tileState = tile.getState();\n let type;\n if (tileState == TileState.LOADING) {\n this.tileLoadingKeys_[uid] = true;\n type = TileEventType.TILELOADSTART;\n } else if (uid in this.tileLoadingKeys_) {\n delete this.tileLoadingKeys_[uid];\n type =\n tileState == TileState.ERROR\n ? TileEventType.TILELOADERROR\n : tileState == TileState.LOADED\n ? TileEventType.TILELOADEND\n : undefined;\n }\n if (type) {\n this.dispatchEvent(new TileSourceEvent(type, tile));\n }\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../tilegrid/TileGrid.js\").default} Tile grid.\n * @override\n */\n getTileGridForProjection(projection) {\n const thisProj = this.getProjection();\n if (\n this.tileGrid &&\n (!thisProj || equivalent(thisProj, projection)) &&\n !this.transformMatrix\n ) {\n return this.tileGrid;\n }\n\n const projKey = getUid(projection);\n if (!(projKey in this.tileGridForProjection_)) {\n this.tileGridForProjection_[projKey] =\n getTileGridForProjection(projection);\n }\n return this.tileGridForProjection_[projKey];\n }\n\n /**\n * Sets the tile grid to use when reprojecting the tiles to the given\n * projection instead of the default tile grid for the projection.\n *\n * This can be useful when the default tile grid cannot be created\n * (e.g. projection has no extent defined) or\n * for optimization reasons (custom tile size, resolutions, ...).\n *\n * @param {import(\"../proj.js\").ProjectionLike} projection Projection.\n * @param {import(\"../tilegrid/TileGrid.js\").default} tilegrid Tile grid to use for the projection.\n * @api\n */\n setTileGridForProjection(projection, tilegrid) {\n const proj = getProjection(projection);\n if (proj) {\n const projKey = getUid(proj);\n if (!(projKey in this.tileGridForProjection_)) {\n this.tileGridForProjection_[projKey] = tilegrid;\n }\n }\n }\n}\n\nexport default DataTileSource;\n","/**\n * @module ol/source/GeoTIFF\n */\nimport {\n Pool,\n fromBlob as tiffFromBlob,\n fromUrl as tiffFromUrl,\n fromUrls as tiffFromUrls,\n globals as geotiffGlobals,\n} from 'geotiff';\nimport {error as logError} from '../console.js';\nimport {applyTransform, getCenter, getIntersection} from '../extent.js';\nimport {clamp} from '../math.js';\nimport {fromCode as unitsFromCode} from '../proj/Units.js';\nimport {\n Projection,\n createTransformFromCoordinateTransform,\n get as getCachedProjection,\n toUserCoordinate,\n toUserExtent,\n} from '../proj.js';\nimport TileGrid from '../tilegrid/TileGrid.js';\nimport {\n apply as applyMatrix,\n create as createMatrix,\n makeInverse,\n multiply as multiplyTransform,\n} from '../transform.js';\nimport DataTile from './DataTile.js';\n\n/**\n * Determine if an image type is a mask.\n * See https://www.awaresystems.be/imaging/tiff/tifftags/newsubfiletype.html\n * @param {GeoTIFFImage} image The image.\n * @return {boolean} The image is a mask.\n */\nfunction isMask(image) {\n const fileDirectory = image.fileDirectory;\n const type = fileDirectory.NewSubfileType || 0;\n return (type & 4) === 4;\n}\n\n/**\n * @param {true|false|'auto'} preference The convertToRGB option.\n * @param {GeoTIFFImage} image The image.\n * @return {boolean} Use the `image.readRGB()` method.\n */\nfunction readRGB(preference, image) {\n if (!preference) {\n return false;\n }\n if (preference === true) {\n return true;\n }\n if (image.getSamplesPerPixel() !== 3) {\n return false;\n }\n const interpretation = image.fileDirectory.PhotometricInterpretation;\n const interpretations = geotiffGlobals.photometricInterpretations;\n return (\n interpretation === interpretations.CMYK ||\n interpretation === interpretations.YCbCr ||\n interpretation === interpretations.CIELab ||\n interpretation === interpretations.ICCLab\n );\n}\n\n/**\n * @typedef {Object} SourceInfo\n * @property {string} [url] URL for the source GeoTIFF.\n * @property {Array<string>} [overviews] List of any overview URLs, only applies if the url parameter is given.\n * @property {Blob} [blob] Blob containing the source GeoTIFF. `blob` and `url` are mutually exclusive.\n * @property {number} [min=0] The minimum source data value. Rendered values are scaled from 0 to 1 based on\n * the configured min and max. If not provided and raster statistics are available, those will be used instead.\n * If neither are available, the minimum for the data type will be used. To disable this behavior, set\n * the `normalize` option to `false` in the constructor.\n * @property {number} [max] The maximum source data value. Rendered values are scaled from 0 to 1 based on\n * the configured min and max. If not provided and raster statistics are available, those will be used instead.\n * If neither are available, the maximum for the data type will be used. To disable this behavior, set\n * the `normalize` option to `false` in the constructor.\n * @property {number} [nodata] Values to discard (overriding any nodata values in the metadata).\n * When provided, an additional alpha band will be added to the data. Often the GeoTIFF metadata\n * will include information about nodata values, so you should only need to set this property if\n * you find that it is not already extracted from the metadata.\n * @property {Array<number>} [bands] Band numbers to be read from (where the first band is `1`). If not provided, all bands will\n * be read. For example, if a GeoTIFF has blue (1), green (2), red (3), and near-infrared (4) bands, and you only need the\n * near-infrared band, configure `bands: [4]`.\n */\n\n/**\n * @typedef {Object} GeoKeys\n * @property {number} GTModelTypeGeoKey Model type.\n * @property {number} GTRasterTypeGeoKey Raster type.\n * @property {number} GeogAngularUnitsGeoKey Angular units.\n * @property {number} GeogInvFlatteningGeoKey Inverse flattening.\n * @property {number} GeogSemiMajorAxisGeoKey Semi-major axis.\n * @property {number} GeographicTypeGeoKey Geographic coordinate system code.\n * @property {number} ProjLinearUnitsGeoKey Projected linear unit code.\n * @property {number} ProjectedCSTypeGeoKey Projected coordinate system code.\n */\n\n/**\n * @typedef {import(\"geotiff\").GeoTIFF} GeoTIFF\n */\n\n/**\n * @typedef {import(\"geotiff\").MultiGeoTIFF} MultiGeoTIFF\n */\n\n/**\n * @typedef {Object} GDALMetadata\n * @property {string} STATISTICS_MINIMUM The minimum value (as a string).\n * @property {string} STATISTICS_MAXIMUM The maximum value (as a string).\n */\n\nconst STATISTICS_MAXIMUM = 'STATISTICS_MAXIMUM';\nconst STATISTICS_MINIMUM = 'STATISTICS_MINIMUM';\n\nconst defaultTileSize = 256;\n\n/**\n * @typedef {import(\"geotiff\").GeoTIFFImage} GeoTIFFImage\n */\n\nlet workerPool;\nfunction getWorkerPool() {\n if (!workerPool) {\n workerPool = new Pool();\n }\n return workerPool;\n}\n\n/**\n * Get the bounding box of an image. If the image does not have an affine transform,\n * the pixel bounds are returned.\n * @param {GeoTIFFImage} image The image.\n * @return {Array<number>} The image bounding box.\n */\nfunction getBoundingBox(image) {\n try {\n return image.getBoundingBox(true);\n } catch {\n return [0, 0, image.getWidth(), image.getHeight()];\n }\n}\n\n/**\n * Get the origin of an image. If the image does not have an affine transform,\n * the top-left corner of the pixel bounds is returned.\n * @param {GeoTIFFImage} image The image.\n * @return {Array<number>} The image origin.\n */\nfunction getOrigin(image) {\n try {\n return image.getOrigin().slice(0, 2);\n } catch {\n return [0, image.getHeight()];\n }\n}\n\n/**\n * Get the resolution of an image. If the image does not have an affine transform,\n * the width of the image is compared with the reference image.\n * @param {GeoTIFFImage} image The image.\n * @param {GeoTIFFImage} referenceImage The reference image.\n * @return {Array<number>} The map x and y units per pixel.\n */\nfunction getResolutions(image, referenceImage) {\n try {\n return image.getResolution(referenceImage);\n } catch {\n return [\n referenceImage.getWidth() / image.getWidth(),\n referenceImage.getHeight() / image.getHeight(),\n ];\n }\n}\n\n/**\n * @param {GeoTIFFImage} image A GeoTIFF.\n * @return {import(\"../proj/Projection.js\").default} The image projection.\n */\nfunction getProjection(image) {\n const geoKeys = image.geoKeys;\n if (!geoKeys) {\n return null;\n }\n\n if (\n geoKeys.ProjectedCSTypeGeoKey &&\n geoKeys.ProjectedCSTypeGeoKey !== 32767\n ) {\n const code = 'EPSG:' + geoKeys.ProjectedCSTypeGeoKey;\n let projection = getCachedProjection(code);\n if (!projection) {\n const units = unitsFromCode(geoKeys.ProjLinearUnitsGeoKey);\n if (units) {\n projection = new Projection({\n code: code,\n units: units,\n });\n }\n }\n return projection;\n }\n\n if (geoKeys.GeographicTypeGeoKey && geoKeys.GeographicTypeGeoKey !== 32767) {\n const code = 'EPSG:' + geoKeys.GeographicTypeGeoKey;\n let projection = getCachedProjection(code);\n if (!projection) {\n const units = unitsFromCode(geoKeys.GeogAngularUnitsGeoKey);\n if (units) {\n projection = new Projection({\n code: code,\n units: units,\n });\n }\n }\n return projection;\n }\n\n return null;\n}\n\n/**\n * @param {GeoTIFF|MultiGeoTIFF} tiff A GeoTIFF.\n * @return {Promise<Array<GeoTIFFImage>>} Resolves to a list of images.\n */\nfunction getImagesForTIFF(tiff) {\n return tiff.getImageCount().then(function (count) {\n const requests = new Array(count);\n for (let i = 0; i < count; ++i) {\n requests[i] = tiff.getImage(i);\n }\n return Promise.all(requests);\n });\n}\n\n/**\n * @param {SourceInfo} source The GeoTIFF source.\n * @param {Object} options Options for the GeoTIFF source.\n * @return {Promise<Array<GeoTIFFImage>>} Resolves to a list of images.\n */\nfunction getImagesForSource(source, options) {\n let request;\n if (source.blob) {\n request = tiffFromBlob(source.blob);\n } else if (source.overviews) {\n request = tiffFromUrls(source.url, source.overviews, options);\n } else {\n request = tiffFromUrl(source.url, options);\n }\n return request.then(getImagesForTIFF);\n}\n\n/**\n * @param {number|Array<number>|Array<Array<number>>} expected Expected value.\n * @param {number|Array<number>|Array<Array<number>>} got Actual value.\n * @param {number} tolerance Accepted tolerance in fraction of expected between expected and got.\n * @param {string} message The error message.\n * @param {function(Error):void} rejector A function to be called with any error.\n */\nfunction assertEqual(expected, got, tolerance, message, rejector) {\n if (Array.isArray(expected)) {\n const length = expected.length;\n if (!Array.isArray(got) || length != got.length) {\n const error = new Error(message);\n rejector(error);\n throw error;\n }\n for (let i = 0; i < length; ++i) {\n assertEqual(expected[i], got[i], tolerance, message, rejector);\n }\n return;\n }\n\n got = /** @type {number} */ (got);\n if (Math.abs(expected - got) > tolerance * expected) {\n throw new Error(message);\n }\n}\n\n/**\n * @param {Array} array The data array.\n * @return {number} The minimum value.\n */\nfunction getMinForDataType(array) {\n if (array instanceof Int8Array) {\n return -128;\n }\n if (array instanceof Int16Array) {\n return -32768;\n }\n if (array instanceof Int32Array) {\n return -2147483648;\n }\n if (array instanceof Float32Array) {\n return 1.2e-38;\n }\n return 0;\n}\n\n/**\n * @param {Array} array The data array.\n * @return {number} The maximum value.\n */\nfunction getMaxForDataType(array) {\n if (array instanceof Int8Array) {\n return 127;\n }\n if (array instanceof Uint8Array) {\n return 255;\n }\n if (array instanceof Uint8ClampedArray) {\n return 255;\n }\n if (array instanceof Int16Array) {\n return 32767;\n }\n if (array instanceof Uint16Array) {\n return 65535;\n }\n if (array instanceof Int32Array) {\n return 2147483647;\n }\n if (array instanceof Uint32Array) {\n return 4294967295;\n }\n if (array instanceof Float32Array) {\n return 3.4e38;\n }\n return 255;\n}\n\n/**\n * @typedef {Object} GeoTIFFSourceOptions\n * @property {boolean} [forceXHR=false] Whether to force the usage of the browsers XMLHttpRequest API.\n * @property {Object<string, string>} [headers] additional key-value pairs of headers to be passed with each request. Key is the header name, value the header value.\n * @property {string} [credentials] How credentials shall be handled. See\n * https://developer.mozilla.org/en-US/docs/Web/API/fetch for reference and possible values\n * @property {number} [maxRanges] The maximum amount of ranges to request in a single multi-range request.\n * By default only a single range is used.\n * @property {boolean} [allowFullFile=false] Whether or not a full file is accepted when only a portion is\n * requested. Only use this when you know the source image to be small enough to fit in memory.\n * @property {number} [blockSize=65536] The block size to use.\n * @property {number} [cacheSize=100] The number of blocks that shall be held in a LRU cache.\n */\n\n/**\n * @typedef {Object} Options\n * @property {Array<SourceInfo>} sources List of information about GeoTIFF sources.\n * Multiple sources can be combined when their resolution sets are equal after applying a scale.\n * The list of sources defines a mapping between input bands as they are read from each GeoTIFF and\n * the output bands that are provided by data tiles. To control which bands to read from each GeoTIFF,\n * use the {@link import(\"./GeoTIFF.js\").SourceInfo bands} property. If, for example, you specify two\n * sources, one with 3 bands and {@link import(\"./GeoTIFF.js\").SourceInfo nodata} configured, and\n * another with 1 band, the resulting data tiles will have 5 bands: 3 from the first source, 1 alpha\n * band from the first source, and 1 band from the second source.\n * @property {GeoTIFFSourceOptions} [sourceOptions] Additional options to be passed to [geotiff.js](https://geotiffjs.github.io/geotiff.js/module-geotiff.html)'s `fromUrl` or `fromUrls` methods.\n * @property {true|false|'auto'} [convertToRGB=false] By default, bands from the sources are read as-is. When\n * reading GeoTIFFs with the purpose of displaying them as RGB images, setting this to `true` will\n * convert other color spaces (YCbCr, CMYK) to RGB. Setting the option to `'auto'` will make it so CMYK, YCbCr,\n * CIELab, and ICCLab images will automatically be converted to RGB.\n * @property {boolean} [normalize=true] By default, the source data is normalized to values between\n * 0 and 1 with scaling factors based on the raster statistics or `min` and `max` properties of each source.\n * If instead you want to work with the raw values in a style expression, set this to `false`. Setting this option\n * to `false` will make it so any `min` and `max` properties on sources are ignored.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Source projection. If not provided, the GeoTIFF metadata\n * will be read for projection information.\n * @property {number} [transition=250] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {boolean} [wrapX=false] Render tiles beyond the tile grid extent.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * the linear interpolation is used to resample the data. If false, nearest neighbor is used.\n */\n\n/**\n * @classdesc\n * A source for working with GeoTIFF data.\n * **Note for users of the full build**: The `GeoTIFF` source requires the\n * [geotiff.js](https://github.com/geotiffjs/geotiff.js) library to be loaded as well.\n *\n * @api\n */\nclass GeoTIFFSource extends DataTile {\n /**\n * @param {Options} options Data tile options.\n */\n constructor(options) {\n super({\n state: 'loading',\n tileGrid: null,\n projection: options.projection || null,\n transition: options.transition,\n interpolate: options.interpolate !== false,\n wrapX: options.wrapX,\n });\n\n /**\n * @type {Array<SourceInfo>}\n * @private\n */\n this.sourceInfo_ = options.sources;\n\n const numSources = this.sourceInfo_.length;\n\n /**\n * @type {Object}\n * @private\n */\n this.sourceOptions_ = options.sourceOptions;\n\n /**\n * @type {Array<Array<GeoTIFFImage>>}\n * @private\n */\n this.sourceImagery_ = new Array(numSources);\n\n /**\n * @type {Array<Array<GeoTIFFImage>>}\n * @private\n */\n this.sourceMasks_ = new Array(numSources);\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.resolutionFactors_ = new Array(numSources);\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.samplesPerPixel_;\n\n /**\n * @type {Array<Array<number>>}\n * @private\n */\n this.nodataValues_;\n\n /**\n * @type {Array<Array<GDALMetadata>>}\n * @private\n */\n this.metadata_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.normalize_ = options.normalize !== false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.addAlpha_ = false;\n\n /**\n * @type {Error}\n * @private\n */\n this.error_ = null;\n\n /**\n * @type {true|false|'auto'}\n * @private\n */\n this.convertToRGB_ = options.convertToRGB || false;\n\n this.setKey(this.sourceInfo_.map((source) => source.url).join(','));\n\n const self = this;\n const requests = new Array(numSources);\n for (let i = 0; i < numSources; ++i) {\n requests[i] = getImagesForSource(\n this.sourceInfo_[i],\n this.sourceOptions_,\n );\n }\n Promise.all(requests)\n .then(function (sources) {\n self.configure_(sources);\n })\n .catch(function (error) {\n logError(error);\n self.error_ = error;\n self.setState('error');\n });\n }\n\n /**\n * @return {Error} A source loading error. When the source state is `error`, use this function\n * to get more information about the error. To debug a faulty configuration, you may want to use\n * a listener like\n * ```js\n * geotiffSource.on('change', () => {\n * if (geotiffSource.getState() === 'error') {\n * console.error(geotiffSource.getError());\n * }\n * });\n * ```\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Determine the projection of the images in this GeoTIFF.\n * The default implementation looks at the ProjectedCSTypeGeoKey and the GeographicTypeGeoKey\n * of each image in turn.\n * You can override this method in a subclass to support more projections.\n *\n * @param {Array<Array<GeoTIFFImage>>} sources Each source is a list of images\n * from a single GeoTIFF.\n */\n determineProjection(sources) {\n const firstSource = sources[0];\n for (let i = firstSource.length - 1; i >= 0; --i) {\n const image = firstSource[i];\n const projection = getProjection(image);\n if (projection) {\n this.projection = projection;\n break;\n }\n }\n }\n\n /**\n * Determine any transform matrix for the images in this GeoTIFF.\n *\n * @param {Array<Array<GeoTIFFImage>>} sources Each source is a list of images\n * from a single GeoTIFF.\n */\n determineTransformMatrix(sources) {\n const firstSource = sources[0];\n for (let i = firstSource.length - 1; i >= 0; --i) {\n const image = firstSource[i];\n const modelTransformation = image.fileDirectory.ModelTransformation;\n if (modelTransformation) {\n // eslint-disable-next-line no-unused-vars\n const [a, b, c, d, e, f, g, h] = modelTransformation;\n const matrix = multiplyTransform(\n multiplyTransform(\n [\n 1 / Math.sqrt(a * a + e * e),\n 0,\n 0,\n -1 / Math.sqrt(b * b + f * f),\n d,\n h,\n ],\n [a, e, b, f, 0, 0],\n ),\n [1, 0, 0, 1, -d, -h],\n );\n this.transformMatrix = matrix;\n this.addAlpha_ = true;\n break;\n }\n }\n }\n\n /**\n * Configure the tile grid based on images within the source GeoTIFFs. Each GeoTIFF\n * must have the same internal tiled structure.\n * @param {Array<Array<GeoTIFFImage>>} sources Each source is a list of images\n * from a single GeoTIFF.\n * @private\n */\n configure_(sources) {\n let extent;\n let origin;\n let commonRenderTileSizes;\n let commonSourceTileSizes;\n let resolutions;\n const samplesPerPixel = new Array(sources.length);\n const nodataValues = new Array(sources.length);\n const metadata = new Array(sources.length);\n let minZoom = 0;\n\n const sourceCount = sources.length;\n for (let sourceIndex = 0; sourceIndex < sourceCount; ++sourceIndex) {\n const images = [];\n const masks = [];\n sources[sourceIndex].forEach((item) => {\n if (isMask(item)) {\n masks.push(item);\n } else {\n images.push(item);\n }\n });\n\n const imageCount = images.length;\n if (masks.length > 0 && masks.length !== imageCount) {\n throw new Error(\n `Expected one mask per image found ${masks.length} masks and ${imageCount} images`,\n );\n }\n\n let sourceExtent;\n let sourceOrigin;\n const sourceTileSizes = new Array(imageCount);\n const renderTileSizes = new Array(imageCount);\n const sourceResolutions = new Array(imageCount);\n\n nodataValues[sourceIndex] = new Array(imageCount);\n metadata[sourceIndex] = new Array(imageCount);\n\n for (let imageIndex = 0; imageIndex < imageCount; ++imageIndex) {\n const image = images[imageIndex];\n const nodataValue = image.getGDALNoData();\n metadata[sourceIndex][imageIndex] = image.getGDALMetadata(0);\n nodataValues[sourceIndex][imageIndex] = nodataValue;\n\n const wantedSamples = this.sourceInfo_[sourceIndex].bands;\n samplesPerPixel[sourceIndex] = wantedSamples\n ? wantedSamples.length\n : image.getSamplesPerPixel();\n const level = imageCount - (imageIndex + 1);\n\n if (!sourceExtent) {\n sourceExtent = getBoundingBox(image);\n }\n\n if (!sourceOrigin) {\n sourceOrigin = getOrigin(image);\n }\n\n const imageResolutions = getResolutions(image, images[0]);\n sourceResolutions[level] = imageResolutions[0];\n\n const sourceTileSize = [image.getTileWidth(), image.getTileHeight()];\n\n // request larger blocks for untiled layouts\n if (\n sourceTileSize[0] !== sourceTileSize[1] &&\n sourceTileSize[1] < defaultTileSize\n ) {\n sourceTileSize[0] = defaultTileSize;\n sourceTileSize[1] = defaultTileSize;\n }\n\n sourceTileSizes[level] = sourceTileSize;\n\n const aspectRatio = imageResolutions[0] / Math.abs(imageResolutions[1]);\n renderTileSizes[level] = [\n sourceTileSize[0],\n sourceTileSize[1] / aspectRatio,\n ];\n }\n\n if (!extent) {\n extent = sourceExtent;\n } else {\n getIntersection(extent, sourceExtent, extent);\n }\n\n if (!origin) {\n origin = sourceOrigin;\n } else {\n const message = `Origin mismatch for source ${sourceIndex}, got [${sourceOrigin}] but expected [${origin}]`;\n assertEqual(origin, sourceOrigin, 0, message, this.viewRejector);\n }\n\n if (!resolutions) {\n resolutions = sourceResolutions;\n this.resolutionFactors_[sourceIndex] = 1;\n } else {\n if (resolutions.length - minZoom > sourceResolutions.length) {\n minZoom = resolutions.length - sourceResolutions.length;\n }\n const resolutionFactor =\n resolutions[resolutions.length - 1] /\n sourceResolutions[sourceResolutions.length - 1];\n this.resolutionFactors_[sourceIndex] = resolutionFactor;\n const scaledSourceResolutions = sourceResolutions.map(\n (resolution) => (resolution *= resolutionFactor),\n );\n const message = `Resolution mismatch for source ${sourceIndex}, got [${scaledSourceResolutions}] but expected [${resolutions}]`;\n assertEqual(\n resolutions.slice(minZoom, resolutions.length),\n scaledSourceResolutions,\n 0.02,\n message,\n this.viewRejector,\n );\n }\n\n if (!commonRenderTileSizes) {\n commonRenderTileSizes = renderTileSizes;\n } else {\n assertEqual(\n commonRenderTileSizes.slice(minZoom, commonRenderTileSizes.length),\n renderTileSizes,\n 0.01,\n `Tile size mismatch for source ${sourceIndex}`,\n this.viewRejector,\n );\n }\n\n if (!commonSourceTileSizes) {\n commonSourceTileSizes = sourceTileSizes;\n } else {\n assertEqual(\n commonSourceTileSizes.slice(minZoom, commonSourceTileSizes.length),\n sourceTileSizes,\n 0,\n `Tile size mismatch for source ${sourceIndex}`,\n this.viewRejector,\n );\n }\n\n this.sourceImagery_[sourceIndex] = images.reverse();\n this.sourceMasks_[sourceIndex] = masks.reverse();\n }\n\n for (let i = 0, ii = this.sourceImagery_.length; i < ii; ++i) {\n const sourceImagery = this.sourceImagery_[i];\n while (sourceImagery.length < resolutions.length) {\n sourceImagery.unshift(undefined);\n }\n }\n\n if (!this.getProjection()) {\n this.determineProjection(sources);\n }\n this.determineTransformMatrix(sources);\n\n this.samplesPerPixel_ = samplesPerPixel;\n this.nodataValues_ = nodataValues;\n this.metadata_ = metadata;\n\n // decide if we need to add an alpha band to handle nodata\n outer: for (let sourceIndex = 0; sourceIndex < sourceCount; ++sourceIndex) {\n // option 1: source is configured with a nodata value\n if (this.sourceInfo_[sourceIndex].nodata !== undefined) {\n this.addAlpha_ = true;\n break;\n }\n if (this.sourceMasks_[sourceIndex].length) {\n this.addAlpha_ = true;\n break;\n }\n\n const values = nodataValues[sourceIndex];\n\n // option 2: check image metadata for limited bands\n const bands = this.sourceInfo_[sourceIndex].bands;\n if (bands) {\n for (let i = 0; i < bands.length; ++i) {\n if (values[bands[i] - 1] !== null) {\n this.addAlpha_ = true;\n break outer;\n }\n }\n continue;\n }\n\n // option 3: check image metadata for all bands\n for (let imageIndex = 0; imageIndex < values.length; ++imageIndex) {\n if (values[imageIndex] !== null) {\n this.addAlpha_ = true;\n break outer;\n }\n }\n }\n\n let bandCount = this.addAlpha_ ? 1 : 0;\n for (let sourceIndex = 0; sourceIndex < sourceCount; ++sourceIndex) {\n bandCount += samplesPerPixel[sourceIndex];\n }\n this.bandCount = bandCount;\n\n const tileGrid = new TileGrid({\n extent: extent,\n minZoom: minZoom,\n origin: origin,\n resolutions: resolutions,\n tileSizes: commonRenderTileSizes,\n });\n\n this.tileGrid = tileGrid;\n this.setTileSizes(commonSourceTileSizes);\n\n this.setLoader(this.loadTile_.bind(this));\n this.setState('ready');\n\n const zoom = 1;\n if (resolutions.length === 2) {\n resolutions = [resolutions[0], resolutions[1], resolutions[1] / 2];\n } else if (resolutions.length === 1) {\n resolutions = [resolutions[0] * 2, resolutions[0], resolutions[0] / 2];\n }\n\n let viewExtent = extent;\n if (this.transformMatrix) {\n const matrix = makeInverse(createMatrix(), this.transformMatrix.slice());\n const transformFn = createTransformFromCoordinateTransform((input) =>\n applyMatrix(matrix, input),\n );\n viewExtent = applyTransform(extent, transformFn);\n }\n\n this.viewResolver({\n showFullExtent: true,\n projection: this.projection,\n resolutions: resolutions,\n center: toUserCoordinate(getCenter(viewExtent), this.projection),\n extent: toUserExtent(viewExtent, this.projection),\n zoom: zoom,\n });\n }\n\n /**\n * @param {number} z The z tile index.\n * @param {number} x The x tile index.\n * @param {number} y The y tile index.\n * @param {import('./DataTile.js').LoaderOptions} options The loader options.\n * @return {Promise} The composed tile data.\n * @private\n */\n loadTile_(z, x, y, options) {\n const sourceTileSize = this.getTileSize(z);\n const sourceCount = this.sourceImagery_.length;\n const requests = new Array(sourceCount * 2);\n const nodataValues = this.nodataValues_;\n const sourceInfo = this.sourceInfo_;\n const pool = getWorkerPool();\n for (let sourceIndex = 0; sourceIndex < sourceCount; ++sourceIndex) {\n const source = sourceInfo[sourceIndex];\n const resolutionFactor = this.resolutionFactors_[sourceIndex];\n const pixelBounds = [\n Math.round(x * (sourceTileSize[0] * resolutionFactor)),\n Math.round(y * (sourceTileSize[1] * resolutionFactor)),\n Math.round((x + 1) * (sourceTileSize[0] * resolutionFactor)),\n Math.round((y + 1) * (sourceTileSize[1] * resolutionFactor)),\n ];\n const image = this.sourceImagery_[sourceIndex][z];\n let samples;\n if (source.bands) {\n samples = source.bands.map(function (bandNumber) {\n return bandNumber - 1;\n });\n }\n\n /** @type {number|Array<number>} */\n let fillValue;\n if ('nodata' in source && source.nodata !== null) {\n fillValue = source.nodata;\n } else {\n if (!samples) {\n fillValue = nodataValues[sourceIndex];\n } else {\n fillValue = samples.map(function (sampleIndex) {\n return nodataValues[sourceIndex][sampleIndex];\n });\n }\n }\n\n const readOptions = {\n window: pixelBounds,\n width: sourceTileSize[0],\n height: sourceTileSize[1],\n samples: samples,\n fillValue: fillValue,\n pool: pool,\n interleave: false,\n signal: options.signal,\n };\n if (readRGB(this.convertToRGB_, image)) {\n requests[sourceIndex] = image.readRGB(readOptions);\n } else {\n requests[sourceIndex] = image.readRasters(readOptions);\n }\n\n // requests after `sourceCount` are for mask data (if any)\n const maskIndex = sourceCount + sourceIndex;\n const mask = this.sourceMasks_[sourceIndex][z];\n if (!mask) {\n requests[maskIndex] = Promise.resolve(null);\n continue;\n }\n\n requests[maskIndex] = mask.readRasters({\n window: pixelBounds,\n width: sourceTileSize[0],\n height: sourceTileSize[1],\n samples: [0],\n pool: pool,\n interleave: false,\n });\n }\n\n return Promise.all(requests)\n .then(this.composeTile_.bind(this, sourceTileSize))\n .catch(function (error) {\n logError(error);\n throw error;\n });\n }\n\n /**\n * @param {import(\"../size.js\").Size} sourceTileSize The source tile size.\n * @param {Array} sourceSamples The source samples.\n * @return {import(\"../DataTile.js\").Data} The composed tile data.\n * @private\n */\n composeTile_(sourceTileSize, sourceSamples) {\n const metadata = this.metadata_;\n const sourceInfo = this.sourceInfo_;\n const sourceCount = this.sourceImagery_.length;\n const bandCount = this.bandCount;\n const samplesPerPixel = this.samplesPerPixel_;\n const nodataValues = this.nodataValues_;\n const normalize = this.normalize_;\n const addAlpha = this.addAlpha_;\n\n const pixelCount = sourceTileSize[0] * sourceTileSize[1];\n const dataLength = pixelCount * bandCount;\n\n /** @type {Uint8Array|Float32Array} */\n let data;\n if (normalize) {\n data = new Uint8Array(dataLength);\n } else {\n data = new Float32Array(dataLength);\n }\n\n let dataIndex = 0;\n for (let pixelIndex = 0; pixelIndex < pixelCount; ++pixelIndex) {\n let transparent = addAlpha;\n for (let sourceIndex = 0; sourceIndex < sourceCount; ++sourceIndex) {\n const source = sourceInfo[sourceIndex];\n\n let min = source.min;\n let max = source.max;\n let gain, bias;\n if (normalize) {\n const stats = metadata[sourceIndex][0];\n if (min === undefined) {\n if (stats && STATISTICS_MINIMUM in stats) {\n min = parseFloat(stats[STATISTICS_MINIMUM]);\n } else {\n min = getMinForDataType(sourceSamples[sourceIndex][0]);\n }\n }\n if (max === undefined) {\n if (stats && STATISTICS_MAXIMUM in stats) {\n max = parseFloat(stats[STATISTICS_MAXIMUM]);\n } else {\n max = getMaxForDataType(sourceSamples[sourceIndex][0]);\n }\n }\n\n gain = 255 / (max - min);\n bias = -min * gain;\n }\n\n for (\n let sampleIndex = 0;\n sampleIndex < samplesPerPixel[sourceIndex];\n ++sampleIndex\n ) {\n const sourceValue =\n sourceSamples[sourceIndex][sampleIndex][pixelIndex];\n\n let value;\n if (normalize) {\n value = clamp(gain * sourceValue + bias, 0, 255);\n } else {\n value = sourceValue;\n }\n\n if (!addAlpha) {\n data[dataIndex] = value;\n } else {\n let nodata = source.nodata;\n if (nodata === undefined) {\n let bandIndex;\n if (source.bands) {\n bandIndex = source.bands[sampleIndex] - 1;\n } else {\n bandIndex = sampleIndex;\n }\n nodata = nodataValues[sourceIndex][bandIndex];\n }\n\n const nodataIsNaN = isNaN(nodata);\n if (\n (!nodataIsNaN && sourceValue !== nodata) ||\n (nodataIsNaN && !isNaN(sourceValue))\n ) {\n transparent = false;\n data[dataIndex] = value;\n }\n }\n dataIndex++;\n }\n if (!transparent) {\n const maskIndex = sourceCount + sourceIndex;\n const mask = sourceSamples[maskIndex];\n if (mask && !mask[0][pixelIndex]) {\n transparent = true;\n }\n }\n }\n if (addAlpha) {\n if (!transparent) {\n data[dataIndex] = 255;\n }\n dataIndex++;\n }\n }\n\n return data;\n }\n}\n\n/**\n * Get a promise for view properties based on the source. Use the result of this function\n * as the `view` option in a map constructor.\n *\n * const source = new GeoTIFF(options);\n *\n * const map = new Map({\n * target: 'map',\n * layers: [\n * new TileLayer({\n * source: source,\n * }),\n * ],\n * view: source.getView(),\n * });\n *\n * @function\n * @return {Promise<import(\"../View.js\").ViewOptions>} A promise for view-related properties.\n * @api\n *\n */\nGeoTIFFSource.prototype.getView;\n\nexport default GeoTIFFSource;\n","/**\n * @module ol/format/IIIFInfo\n */\n\nimport {assert} from '../asserts.js';\n\n/**\n * @typedef {Object} PreferredOptions\n * @property {string} [format] Preferred image format. Will be used if the image information\n * indicates support for that format.\n * @property {string} [quality] IIIF image qualitiy. Will be used if the image information\n * indicates support for that quality.\n */\n\n/**\n * @typedef {Object} SupportedFeatures\n * @property {Array<string>} [supports] Supported IIIF image size and region\n * calculation features.\n * @property {Array<string>} [formats] Supported image formats.\n * @property {Array<string>} [qualities] Supported IIIF image qualities.\n */\n\n/**\n * @typedef {Object} TileInfo\n * @property {Array<number>} scaleFactors Supported resolution scaling factors.\n * @property {number} width Tile width in pixels.\n * @property {number} [height] Tile height in pixels. Same as tile width if height is\n * not given.\n */\n\n/**\n * @typedef {Object} IiifProfile\n * @property {Array<string>} [formats] Supported image formats for the image service.\n * @property {Array<string>} [qualities] Supported IIIF image qualities.\n * @property {Array<string>} [supports] Supported features.\n * @property {number} [maxArea] Maximum area (pixels) available for this image service.\n * @property {number} [maxHeight] Maximum height.\n * @property {number} [maxWidth] Maximum width.\n */\n\n/**\n * @typedef {Object<string,string|number|Array<number|string|IiifProfile|Object<string, number>|TileInfo>>}\n * ImageInformationResponse\n */\n\n/**\n * Enum representing the major IIIF Image API versions\n * @enum {string}\n */\nexport const Versions = {\n VERSION1: 'version1',\n VERSION2: 'version2',\n VERSION3: 'version3',\n};\n\n/**\n * Supported image formats, qualities and supported region / size calculation features\n * for different image API versions and compliance levels\n * @const\n * @type {Object<string, Object<string, SupportedFeatures>>}\n */\nconst IIIF_PROFILE_VALUES = {};\nIIIF_PROFILE_VALUES[Versions.VERSION1] = {\n 'level0': {\n supports: [],\n formats: [],\n qualities: ['native'],\n },\n 'level1': {\n supports: ['regionByPx', 'sizeByW', 'sizeByH', 'sizeByPct'],\n formats: ['jpg'],\n qualities: ['native'],\n },\n 'level2': {\n supports: [\n 'regionByPx',\n 'regionByPct',\n 'sizeByW',\n 'sizeByH',\n 'sizeByPct',\n 'sizeByConfinedWh',\n 'sizeByWh',\n ],\n formats: ['jpg', 'png'],\n qualities: ['native', 'color', 'grey', 'bitonal'],\n },\n};\nIIIF_PROFILE_VALUES[Versions.VERSION2] = {\n 'level0': {\n supports: [],\n formats: ['jpg'],\n qualities: ['default'],\n },\n 'level1': {\n supports: ['regionByPx', 'sizeByW', 'sizeByH', 'sizeByPct'],\n formats: ['jpg'],\n qualities: ['default'],\n },\n 'level2': {\n supports: [\n 'regionByPx',\n 'regionByPct',\n 'sizeByW',\n 'sizeByH',\n 'sizeByPct',\n 'sizeByConfinedWh',\n 'sizeByDistortedWh',\n 'sizeByWh',\n ],\n formats: ['jpg', 'png'],\n qualities: ['default', 'bitonal'],\n },\n};\nIIIF_PROFILE_VALUES[Versions.VERSION3] = {\n 'level0': {\n supports: [],\n formats: ['jpg'],\n qualities: ['default'],\n },\n 'level1': {\n supports: ['regionByPx', 'regionSquare', 'sizeByW', 'sizeByH', 'sizeByWh'],\n formats: ['jpg'],\n qualities: ['default'],\n },\n 'level2': {\n supports: [\n 'regionByPx',\n 'regionSquare',\n 'regionByPct',\n 'sizeByW',\n 'sizeByH',\n 'sizeByPct',\n 'sizeByConfinedWh',\n 'sizeByWh',\n ],\n formats: ['jpg', 'png'],\n qualities: ['default'],\n },\n};\nIIIF_PROFILE_VALUES['none'] = {\n 'none': {\n supports: [],\n formats: [],\n qualities: [],\n },\n};\n\nconst COMPLIANCE_VERSION1 =\n /^https?:\\/\\/library\\.stanford\\.edu\\/iiif\\/image-api\\/(?:1\\.1\\/)?compliance\\.html#level[0-2]$/;\nconst COMPLIANCE_VERSION2 =\n /^https?:\\/\\/iiif\\.io\\/api\\/image\\/2\\/level[0-2](?:\\.json)?$/;\nconst COMPLIANCE_VERSION3 =\n /(^https?:\\/\\/iiif\\.io\\/api\\/image\\/3\\/level[0-2](?:\\.json)?$)|(^level[0-2]$)/;\n\nfunction generateVersion1Options(iiifInfo) {\n let levelProfile = iiifInfo.getComplianceLevelSupportedFeatures();\n // Version 1.0 and 1.1 do not require a profile.\n if (levelProfile === undefined) {\n levelProfile = IIIF_PROFILE_VALUES[Versions.VERSION1]['level0'];\n }\n return {\n url:\n iiifInfo.imageInfo['@id'] === undefined\n ? undefined\n : iiifInfo.imageInfo['@id'].replace(/\\/?(?:info\\.json)?$/g, ''),\n supports: levelProfile.supports,\n formats: [\n ...levelProfile.formats,\n iiifInfo.imageInfo.formats === undefined\n ? []\n : iiifInfo.imageInfo.formats,\n ],\n qualities: [\n ...levelProfile.qualities,\n iiifInfo.imageInfo.qualities === undefined\n ? []\n : iiifInfo.imageInfo.qualities,\n ],\n resolutions: iiifInfo.imageInfo.scale_factors,\n tileSize:\n iiifInfo.imageInfo.tile_width !== undefined\n ? iiifInfo.imageInfo.tile_height !== undefined\n ? [iiifInfo.imageInfo.tile_width, iiifInfo.imageInfo.tile_height]\n : [iiifInfo.imageInfo.tile_width, iiifInfo.imageInfo.tile_width]\n : iiifInfo.imageInfo.tile_height != undefined\n ? [iiifInfo.imageInfo.tile_height, iiifInfo.imageInfo.tile_height]\n : undefined,\n };\n}\n\nfunction generateVersion2Options(iiifInfo) {\n const levelProfile = iiifInfo.getComplianceLevelSupportedFeatures(),\n additionalProfile =\n Array.isArray(iiifInfo.imageInfo.profile) &&\n iiifInfo.imageInfo.profile.length > 1,\n profileSupports =\n additionalProfile && iiifInfo.imageInfo.profile[1].supports\n ? iiifInfo.imageInfo.profile[1].supports\n : [],\n profileFormats =\n additionalProfile && iiifInfo.imageInfo.profile[1].formats\n ? iiifInfo.imageInfo.profile[1].formats\n : [],\n profileQualities =\n additionalProfile && iiifInfo.imageInfo.profile[1].qualities\n ? iiifInfo.imageInfo.profile[1].qualities\n : [];\n return {\n url: iiifInfo.imageInfo['@id'].replace(/\\/?(?:info\\.json)?$/g, ''),\n sizes:\n iiifInfo.imageInfo.sizes === undefined\n ? undefined\n : iiifInfo.imageInfo.sizes.map(function (size) {\n return [size.width, size.height];\n }),\n tileSize:\n iiifInfo.imageInfo.tiles === undefined\n ? undefined\n : [\n iiifInfo.imageInfo.tiles.map(function (tile) {\n return tile.width;\n })[0],\n iiifInfo.imageInfo.tiles.map(function (tile) {\n return tile.height === undefined ? tile.width : tile.height;\n })[0],\n ],\n resolutions:\n iiifInfo.imageInfo.tiles === undefined\n ? undefined\n : iiifInfo.imageInfo.tiles.map(function (tile) {\n return tile.scaleFactors;\n })[0],\n supports: [...levelProfile.supports, ...profileSupports],\n formats: [...levelProfile.formats, ...profileFormats],\n qualities: [...levelProfile.qualities, ...profileQualities],\n };\n}\n\nfunction generateVersion3Options(iiifInfo) {\n const levelProfile = iiifInfo.getComplianceLevelSupportedFeatures(),\n formats =\n iiifInfo.imageInfo.extraFormats === undefined\n ? levelProfile.formats\n : [...levelProfile.formats, ...iiifInfo.imageInfo.extraFormats],\n preferredFormat =\n iiifInfo.imageInfo.preferredFormats !== undefined &&\n Array.isArray(iiifInfo.imageInfo.preferredFormats) &&\n iiifInfo.imageInfo.preferredFormats.length > 0\n ? iiifInfo.imageInfo.preferredFormats\n .filter(function (format) {\n return ['jpg', 'png', 'gif'].includes(format);\n })\n .reduce(function (acc, format) {\n return acc === undefined && formats.includes(format)\n ? format\n : acc;\n }, undefined)\n : undefined;\n return {\n url: iiifInfo.imageInfo['id'],\n sizes:\n iiifInfo.imageInfo.sizes === undefined\n ? undefined\n : iiifInfo.imageInfo.sizes.map(function (size) {\n return [size.width, size.height];\n }),\n tileSize:\n iiifInfo.imageInfo.tiles === undefined\n ? undefined\n : [\n iiifInfo.imageInfo.tiles.map(function (tile) {\n return tile.width;\n })[0],\n iiifInfo.imageInfo.tiles.map(function (tile) {\n return tile.height;\n })[0],\n ],\n resolutions:\n iiifInfo.imageInfo.tiles === undefined\n ? undefined\n : iiifInfo.imageInfo.tiles.map(function (tile) {\n return tile.scaleFactors;\n })[0],\n supports:\n iiifInfo.imageInfo.extraFeatures === undefined\n ? levelProfile.supports\n : [...levelProfile.supports, ...iiifInfo.imageInfo.extraFeatures],\n formats: formats,\n qualities:\n iiifInfo.imageInfo.extraQualities === undefined\n ? levelProfile.qualities\n : [...levelProfile.qualities, ...iiifInfo.imageInfo.extraQualities],\n preferredFormat: preferredFormat,\n };\n}\n\nconst versionFunctions = {};\nversionFunctions[Versions.VERSION1] = generateVersion1Options;\nversionFunctions[Versions.VERSION2] = generateVersion2Options;\nversionFunctions[Versions.VERSION3] = generateVersion3Options;\n\n/**\n * @classdesc\n * Format for transforming IIIF Image API image information responses into\n * IIIF tile source ready options\n *\n * @api\n */\nclass IIIFInfo {\n /**\n * @param {string|ImageInformationResponse} imageInfo\n * Deserialized image information JSON response object or JSON response as string\n */\n constructor(imageInfo) {\n this.setImageInfo(imageInfo);\n }\n\n /**\n * @param {string|ImageInformationResponse} imageInfo\n * Deserialized image information JSON response object or JSON response as string\n * @api\n */\n setImageInfo(imageInfo) {\n if (typeof imageInfo == 'string') {\n this.imageInfo = JSON.parse(imageInfo);\n } else {\n this.imageInfo = imageInfo;\n }\n }\n\n /**\n * @return {Versions|undefined} Major IIIF version.\n * @api\n */\n getImageApiVersion() {\n if (this.imageInfo === undefined) {\n return undefined;\n }\n let context = this.imageInfo['@context'] || 'ol-no-context';\n if (typeof context == 'string') {\n context = [context];\n }\n for (let i = 0; i < context.length; i++) {\n switch (context[i]) {\n case 'http://library.stanford.edu/iiif/image-api/1.1/context.json':\n case 'http://iiif.io/api/image/1/context.json':\n return Versions.VERSION1;\n case 'http://iiif.io/api/image/2/context.json':\n return Versions.VERSION2;\n case 'http://iiif.io/api/image/3/context.json':\n return Versions.VERSION3;\n case 'ol-no-context':\n // Image API 1.0 has no '@context'\n if (\n this.getComplianceLevelEntryFromProfile(Versions.VERSION1) &&\n this.imageInfo.identifier\n ) {\n return Versions.VERSION1;\n }\n break;\n default:\n }\n }\n assert(\n false,\n 'Cannot determine IIIF Image API version from provided image information JSON',\n );\n }\n\n /**\n * @param {Versions} version Optional IIIF image API version\n * @return {string|undefined} Compliance level as it appears in the IIIF image information\n * response.\n */\n getComplianceLevelEntryFromProfile(version) {\n if (this.imageInfo === undefined || this.imageInfo.profile === undefined) {\n return undefined;\n }\n if (version === undefined) {\n version = this.getImageApiVersion();\n }\n switch (version) {\n case Versions.VERSION1:\n if (COMPLIANCE_VERSION1.test(this.imageInfo.profile)) {\n return this.imageInfo.profile;\n }\n break;\n case Versions.VERSION3:\n if (COMPLIANCE_VERSION3.test(this.imageInfo.profile)) {\n return this.imageInfo.profile;\n }\n break;\n case Versions.VERSION2:\n if (\n typeof this.imageInfo.profile === 'string' &&\n COMPLIANCE_VERSION2.test(this.imageInfo.profile)\n ) {\n return this.imageInfo.profile;\n }\n if (\n Array.isArray(this.imageInfo.profile) &&\n this.imageInfo.profile.length > 0 &&\n typeof this.imageInfo.profile[0] === 'string' &&\n COMPLIANCE_VERSION2.test(this.imageInfo.profile[0])\n ) {\n return this.imageInfo.profile[0];\n }\n break;\n default:\n }\n return undefined;\n }\n\n /**\n * @param {Versions} version Optional IIIF image API version\n * @return {string} Compliance level, on of 'level0', 'level1' or 'level2' or undefined\n */\n getComplianceLevelFromProfile(version) {\n const complianceLevel = this.getComplianceLevelEntryFromProfile(version);\n if (complianceLevel === undefined) {\n return undefined;\n }\n const level = complianceLevel.match(/level[0-2](?:\\.json)?$/g);\n return Array.isArray(level) ? level[0].replace('.json', '') : undefined;\n }\n\n /**\n * @return {SupportedFeatures|undefined} Image formats, qualities and region / size calculation\n * methods that are supported by the IIIF service.\n */\n getComplianceLevelSupportedFeatures() {\n if (this.imageInfo === undefined) {\n return undefined;\n }\n const version = this.getImageApiVersion();\n const level = this.getComplianceLevelFromProfile(version);\n if (level === undefined) {\n return IIIF_PROFILE_VALUES['none']['none'];\n }\n return IIIF_PROFILE_VALUES[version][level];\n }\n\n /**\n * @param {PreferredOptions} [preferredOptions] Optional options for preferred format and quality.\n * @return {import(\"../source/IIIF.js\").Options|undefined} IIIF tile source ready constructor options.\n * @api\n */\n getTileSourceOptions(preferredOptions) {\n const options = preferredOptions || {},\n version = this.getImageApiVersion();\n if (version === undefined) {\n return undefined;\n }\n const imageOptions =\n version === undefined ? undefined : versionFunctions[version](this);\n if (imageOptions === undefined) {\n return undefined;\n }\n return {\n url: imageOptions.url,\n version: version,\n size: [this.imageInfo.width, this.imageInfo.height],\n sizes: imageOptions.sizes,\n format:\n options.format !== undefined &&\n imageOptions.formats.includes(options.format)\n ? options.format\n : imageOptions.preferredFormat !== undefined\n ? imageOptions.preferredFormat\n : 'jpg',\n supports: imageOptions.supports,\n quality:\n options.quality && imageOptions.qualities.includes(options.quality)\n ? options.quality\n : imageOptions.qualities.includes('native')\n ? 'native'\n : 'default',\n resolutions: Array.isArray(imageOptions.resolutions)\n ? imageOptions.resolutions.sort(function (a, b) {\n return b - a;\n })\n : undefined,\n tileSize: imageOptions.tileSize,\n };\n }\n}\n\nexport default IIIFInfo;\n","/**\n * @module ol/source/Zoomify\n */\n\nimport ImageTile from '../ImageTile.js';\nimport TileState from '../TileState.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport {getCenter} from '../extent.js';\nimport {toSize} from '../size.js';\nimport TileGrid from '../tilegrid/TileGrid.js';\nimport {DEFAULT_TILE_SIZE} from '../tilegrid/common.js';\nimport {createFromTileUrlFunctions} from '../tileurlfunction.js';\nimport {expandUrl} from '../uri.js';\nimport TileImage from './TileImage.js';\n\n/**\n * @typedef {'default' | 'truncated'} TierSizeCalculation\n */\n\nexport class CustomTile extends ImageTile {\n /**\n * @param {import(\"../size.js\").Size} tileSize Full tile size.\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../TileState.js\").default} state State.\n * @param {string} src Image source URI.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"../Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"../Tile.js\").Options} [options] Tile options.\n */\n constructor(\n tileSize,\n tileCoord,\n state,\n src,\n crossOrigin,\n tileLoadFunction,\n options,\n ) {\n super(tileCoord, state, src, crossOrigin, tileLoadFunction, options);\n\n /**\n * @private\n * @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}\n */\n this.zoomifyImage_ = null;\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.tileSize_ = tileSize;\n }\n\n /**\n * Get the image element for this tile.\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @override\n */\n getImage() {\n if (this.zoomifyImage_) {\n return this.zoomifyImage_;\n }\n const image = super.getImage();\n if (this.state == TileState.LOADED) {\n const tileSize = this.tileSize_;\n if (image.width == tileSize[0] && image.height == tileSize[1]) {\n this.zoomifyImage_ = image;\n return image;\n }\n const context = createCanvasContext2D(tileSize[0], tileSize[1]);\n context.drawImage(image, 0, 0);\n this.zoomifyImage_ = context.canvas;\n return context.canvas;\n }\n return image;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection.\n * @property {number} [tilePixelRatio] The pixel ratio used by the tile service. For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px by 512px images (for retina/hidpi devices) then `tilePixelRatio` should be set to `2`\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {string} url URL template or base URL of the Zoomify service.\n * A base URL is the fixed part\n * of the URL, excluding the tile group, z, x, and y folder structure, e.g.\n * `http://my.zoomify.info/IMAGE.TIF/`. A URL template must include\n * `{TileGroup}`, `{x}`, `{y}`, and `{z}` placeholders, e.g.\n * `http://my.zoomify.info/IMAGE.TIF/{TileGroup}/{z}-{x}-{y}.jpg`.\n * Internet Imaging Protocol (IIP) with JTL extension can be also used with\n * `{tileIndex}` and `{z}` placeholders, e.g.\n * `http://my.zoomify.info?FIF=IMAGE.TIF&JTL={z},{tileIndex}`.\n * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be\n * used instead of defining each one separately in the `urls` option.\n * @property {TierSizeCalculation} [tierSizeCalculation] Tier size calculation method: `default` or `truncated`.\n * @property {import(\"../size.js\").Size} size Size.\n * @property {import(\"../extent.js\").Extent} [extent] Extent for the TileGrid that is created.\n * Default sets the TileGrid in the\n * fourth quadrant, meaning extent is `[0, -height, width, 0]`. To change the\n * extent to the first quadrant (the default for OpenLayers 2) set the extent\n * as `[0, 0, width, height]`.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number} [tileSize=256] Tile size. Same tile size is used for all zoom levels.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for tile data in Zoomify format (both Zoomify and Internet\n * Imaging Protocol are supported).\n * @api\n */\nclass Zoomify extends TileImage {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n const size = options.size;\n const tierSizeCalculation =\n options.tierSizeCalculation !== undefined\n ? options.tierSizeCalculation\n : 'default';\n\n const tilePixelRatio = options.tilePixelRatio || 1;\n const imageWidth = size[0];\n const imageHeight = size[1];\n const tierSizeInTiles = [];\n const tileSize = options.tileSize || DEFAULT_TILE_SIZE;\n let tileSizeForTierSizeCalculation = tileSize * tilePixelRatio;\n\n switch (tierSizeCalculation) {\n case 'default':\n while (\n imageWidth > tileSizeForTierSizeCalculation ||\n imageHeight > tileSizeForTierSizeCalculation\n ) {\n tierSizeInTiles.push([\n Math.ceil(imageWidth / tileSizeForTierSizeCalculation),\n Math.ceil(imageHeight / tileSizeForTierSizeCalculation),\n ]);\n tileSizeForTierSizeCalculation += tileSizeForTierSizeCalculation;\n }\n break;\n case 'truncated':\n let width = imageWidth;\n let height = imageHeight;\n while (\n width > tileSizeForTierSizeCalculation ||\n height > tileSizeForTierSizeCalculation\n ) {\n tierSizeInTiles.push([\n Math.ceil(width / tileSizeForTierSizeCalculation),\n Math.ceil(height / tileSizeForTierSizeCalculation),\n ]);\n width >>= 1;\n height >>= 1;\n }\n break;\n default:\n throw new Error('Unknown `tierSizeCalculation` configured');\n }\n\n tierSizeInTiles.push([1, 1]);\n tierSizeInTiles.reverse();\n\n const resolutions = [tilePixelRatio];\n const tileCountUpToTier = [0];\n for (let i = 1, ii = tierSizeInTiles.length; i < ii; i++) {\n resolutions.push(tilePixelRatio << i);\n tileCountUpToTier.push(\n tierSizeInTiles[i - 1][0] * tierSizeInTiles[i - 1][1] +\n tileCountUpToTier[i - 1],\n );\n }\n resolutions.reverse();\n\n const tileGrid = new TileGrid({\n tileSize: tileSize,\n extent: options.extent || [0, -imageHeight, imageWidth, 0],\n resolutions: resolutions,\n });\n\n let url = options.url;\n if (url && !url.includes('{TileGroup}') && !url.includes('{tileIndex}')) {\n url += '{TileGroup}/{z}-{x}-{y}.jpg';\n }\n const urls = expandUrl(url);\n\n let tileWidth = tileSize * tilePixelRatio;\n\n /**\n * @param {string} template Template.\n * @return {import(\"../Tile.js\").UrlFunction} Tile URL function.\n */\n function createFromTemplate(template) {\n return (\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile Coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n function (tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n }\n const tileCoordZ = tileCoord[0];\n const tileCoordX = tileCoord[1];\n const tileCoordY = tileCoord[2];\n const tileIndex =\n tileCoordX + tileCoordY * tierSizeInTiles[tileCoordZ][0];\n const tileGroup =\n ((tileIndex + tileCountUpToTier[tileCoordZ]) / tileWidth) | 0;\n const localContext = {\n 'z': tileCoordZ,\n 'x': tileCoordX,\n 'y': tileCoordY,\n 'tileIndex': tileIndex,\n 'TileGroup': 'TileGroup' + tileGroup,\n };\n return template.replace(/\\{(\\w+?)\\}/g, function (m, p) {\n return localContext[p];\n });\n }\n );\n }\n\n const tileUrlFunction = createFromTileUrlFunctions(\n urls.map(createFromTemplate),\n );\n\n const ZoomifyTileClass = CustomTile.bind(\n null,\n toSize(tileSize * tilePixelRatio),\n );\n\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n interpolate: options.interpolate,\n projection: options.projection,\n tilePixelRatio: tilePixelRatio,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileClass: ZoomifyTileClass,\n tileGrid: tileGrid,\n tileUrlFunction: tileUrlFunction,\n transition: options.transition,\n });\n\n /**\n * @type {number|import(\"../array.js\").NearestDirectionFunction}\n */\n this.zDirection = options.zDirection;\n\n // Server retina tile detection (non-standard):\n // Try loading the center tile for the highest resolution. If it is not\n // available, we are dealing with retina tiles, and need to adjust the\n // tile url calculation.\n const tileUrl = tileGrid.getTileCoordForCoordAndResolution(\n getCenter(tileGrid.getExtent()),\n resolutions[resolutions.length - 1],\n );\n const testTileUrl = tileUrlFunction(tileUrl, 1, null);\n const image = new Image();\n image.addEventListener('error', () => {\n tileWidth = tileSize;\n this.changed();\n });\n image.src = testTileUrl;\n }\n}\n\nexport default Zoomify;\n","/**\n * @module ol/source/IIIF\n */\n\nimport {assert} from '../asserts.js';\nimport {getTopLeft} from '../extent.js';\nimport {Versions} from '../format/IIIFInfo.js';\nimport {toSize} from '../size.js';\nimport TileGrid from '../tilegrid/TileGrid.js';\nimport {DEFAULT_TILE_SIZE} from '../tilegrid/common.js';\nimport TileImage from './TileImage.js';\nimport {CustomTile} from './Zoomify.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The value for the crossOrigin option of the request.\n * @property {import(\"../extent.js\").Extent} [extent=[0, -height, width, 0]] The extent.\n * @property {string} [format='jpg'] Requested image format.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection.\n * @property {string} [quality] Requested IIIF image quality. Default is 'native'\n * for version 1, 'default' for versions 2 and 3.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {Array<number>} [resolutions] Supported resolutions as given in IIIF 'scaleFactors'\n * @property {import(\"../size.js\").Size} size Size of the image [width, height].\n * @property {Array<import(\"../size.js\").Size>} [sizes] Supported scaled image sizes.\n * Content of the IIIF info.json 'sizes' property, but as array of Size objects.\n * @property {import(\"./Source.js\").State} [state] Source state.\n * @property {Array<string>} [supports=[]] Supported IIIF region and size calculation\n * features.\n * @property {number} [tilePixelRatio] Tile pixel ratio.\n * @property {number|import(\"../size.js\").Size} [tileSize] Tile size.\n * Same tile size is used for all zoom levels. If tile size is a number,\n * a square tile is assumed. If the IIIF image service supports arbitrary\n * tiling (sizeByH, sizeByW, sizeByWh or sizeByPct as well as regionByPx or regionByPct\n * are supported), the default tilesize is 256.\n * @property {number} [transition] Transition.\n * @property {string} [url] Base URL of the IIIF Image service.\n * This should be the same as the IIIF Image ID.\n * @property {import(\"../format/IIIFInfo.js\").Versions} [version=Versions.VERSION2] Service's IIIF Image API version.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\nfunction formatPercentage(percentage) {\n return percentage.toLocaleString('en', {maximumFractionDigits: 10});\n}\n\n/**\n * @classdesc\n * Layer source for IIIF Image API services.\n * @api\n */\nclass IIIF extends TileImage {\n /**\n * @param {Options} [options] Tile source options. Use {@link import(\"../format/IIIFInfo.js\").IIIFInfo}\n * to parse Image API service information responses into constructor options.\n * @api\n */\n constructor(options) {\n /**\n * @type {Partial<Options>}\n */\n const partialOptions = options || {};\n\n let baseUrl = partialOptions.url || '';\n baseUrl =\n baseUrl +\n (baseUrl.lastIndexOf('/') === baseUrl.length - 1 || baseUrl === ''\n ? ''\n : '/');\n const version = partialOptions.version || Versions.VERSION2;\n const sizes = partialOptions.sizes || [];\n const size = partialOptions.size;\n assert(\n size != undefined &&\n Array.isArray(size) &&\n size.length == 2 &&\n !isNaN(size[0]) &&\n size[0] > 0 &&\n !isNaN(size[1]) &&\n size[1] > 0,\n 'Missing or invalid `size`',\n );\n const width = size[0];\n const height = size[1];\n const tileSize = partialOptions.tileSize;\n const tilePixelRatio = partialOptions.tilePixelRatio || 1;\n const format = partialOptions.format || 'jpg';\n const quality =\n partialOptions.quality ||\n (partialOptions.version == Versions.VERSION1 ? 'native' : 'default');\n let resolutions = partialOptions.resolutions || [];\n const supports = partialOptions.supports || [];\n const extent = partialOptions.extent || [0, -height, width, 0];\n\n const supportsListedSizes =\n sizes != undefined && Array.isArray(sizes) && sizes.length > 0;\n const supportsListedTiles =\n tileSize !== undefined &&\n ((typeof tileSize === 'number' &&\n Number.isInteger(tileSize) &&\n tileSize > 0) ||\n (Array.isArray(tileSize) && tileSize.length > 0));\n const supportsArbitraryTiling =\n supports != undefined &&\n Array.isArray(supports) &&\n (supports.includes('regionByPx') || supports.includes('regionByPct')) &&\n (supports.includes('sizeByWh') ||\n supports.includes('sizeByH') ||\n supports.includes('sizeByW') ||\n supports.includes('sizeByPct'));\n\n let tileWidth, tileHeight, maxZoom;\n\n resolutions.sort(function (a, b) {\n return b - a;\n });\n\n if (supportsListedTiles || supportsArbitraryTiling) {\n if (tileSize != undefined) {\n if (\n typeof tileSize === 'number' &&\n Number.isInteger(tileSize) &&\n tileSize > 0\n ) {\n tileWidth = tileSize;\n tileHeight = tileSize;\n } else if (Array.isArray(tileSize) && tileSize.length > 0) {\n if (\n tileSize.length == 1 ||\n (tileSize[1] == undefined && Number.isInteger(tileSize[0]))\n ) {\n tileWidth = tileSize[0];\n tileHeight = tileSize[0];\n }\n if (tileSize.length == 2) {\n if (\n Number.isInteger(tileSize[0]) &&\n Number.isInteger(tileSize[1])\n ) {\n tileWidth = tileSize[0];\n tileHeight = tileSize[1];\n } else if (\n tileSize[0] == undefined &&\n Number.isInteger(tileSize[1])\n ) {\n tileWidth = tileSize[1];\n tileHeight = tileSize[1];\n }\n }\n }\n }\n if (tileWidth === undefined || tileHeight === undefined) {\n tileWidth = DEFAULT_TILE_SIZE;\n tileHeight = DEFAULT_TILE_SIZE;\n }\n if (resolutions.length == 0) {\n maxZoom = Math.max(\n Math.ceil(Math.log(width / tileWidth) / Math.LN2),\n Math.ceil(Math.log(height / tileHeight) / Math.LN2),\n );\n for (let i = maxZoom; i >= 0; i--) {\n resolutions.push(Math.pow(2, i));\n }\n } else {\n const maxScaleFactor = Math.max(...resolutions);\n // TODO maxScaleFactor might not be a power to 2\n maxZoom = Math.round(Math.log(maxScaleFactor) / Math.LN2);\n }\n } else {\n // No tile support.\n tileWidth = width;\n tileHeight = height;\n resolutions = [];\n if (supportsListedSizes) {\n /*\n * 'sizes' provided. Use full region in different resolutions. Every\n * resolution has only one tile.\n */\n sizes.sort(function (a, b) {\n return a[0] - b[0];\n });\n maxZoom = -1;\n const ignoredSizesIndex = [];\n for (let i = 0; i < sizes.length; i++) {\n const resolution = width / sizes[i][0];\n if (\n resolutions.length > 0 &&\n resolutions[resolutions.length - 1] == resolution\n ) {\n ignoredSizesIndex.push(i);\n continue;\n }\n resolutions.push(resolution);\n maxZoom++;\n }\n if (ignoredSizesIndex.length > 0) {\n for (let i = 0; i < ignoredSizesIndex.length; i++) {\n sizes.splice(ignoredSizesIndex[i] - i, 1);\n }\n }\n } else {\n // No useful image information at all. Try pseudo tile with full image.\n resolutions.push(1);\n sizes.push([width, height]);\n maxZoom = 0;\n }\n }\n\n const tileGrid = new TileGrid({\n tileSize: [tileWidth, tileHeight],\n extent: extent,\n origin: getTopLeft(extent),\n resolutions: resolutions,\n });\n\n const tileUrlFunction = function (tileCoord, pixelRatio, projection) {\n let regionParam, sizeParam;\n const zoom = tileCoord[0];\n if (zoom > maxZoom) {\n return;\n }\n const tileX = tileCoord[1],\n tileY = tileCoord[2],\n scale = resolutions[zoom];\n if (\n tileX === undefined ||\n tileY === undefined ||\n scale === undefined ||\n tileX < 0 ||\n Math.ceil(width / scale / tileWidth) <= tileX ||\n tileY < 0 ||\n Math.ceil(height / scale / tileHeight) <= tileY\n ) {\n return;\n }\n if (supportsArbitraryTiling || supportsListedTiles) {\n const regionX = tileX * tileWidth * scale,\n regionY = tileY * tileHeight * scale;\n let regionW = tileWidth * scale,\n regionH = tileHeight * scale,\n sizeW = tileWidth,\n sizeH = tileHeight;\n if (regionX + regionW > width) {\n regionW = width - regionX;\n }\n if (regionY + regionH > height) {\n regionH = height - regionY;\n }\n if (regionX + tileWidth * scale > width) {\n sizeW = Math.floor((width - regionX + scale - 1) / scale);\n }\n if (regionY + tileHeight * scale > height) {\n sizeH = Math.floor((height - regionY + scale - 1) / scale);\n }\n if (\n regionX == 0 &&\n regionW == width &&\n regionY == 0 &&\n regionH == height\n ) {\n // canonical full image region parameter is 'full', not 'x,y,w,h'\n regionParam = 'full';\n } else if (\n !supportsArbitraryTiling ||\n supports.includes('regionByPx')\n ) {\n regionParam = regionX + ',' + regionY + ',' + regionW + ',' + regionH;\n } else if (supports.includes('regionByPct')) {\n const pctX = formatPercentage((regionX / width) * 100),\n pctY = formatPercentage((regionY / height) * 100),\n pctW = formatPercentage((regionW / width) * 100),\n pctH = formatPercentage((regionH / height) * 100);\n regionParam = 'pct:' + pctX + ',' + pctY + ',' + pctW + ',' + pctH;\n }\n if (\n version == Versions.VERSION3 &&\n (!supportsArbitraryTiling || supports.includes('sizeByWh'))\n ) {\n sizeParam = sizeW + ',' + sizeH;\n } else if (!supportsArbitraryTiling || supports.includes('sizeByW')) {\n sizeParam = sizeW + ',';\n } else if (supports.includes('sizeByH')) {\n sizeParam = ',' + sizeH;\n } else if (supports.includes('sizeByWh')) {\n sizeParam = sizeW + ',' + sizeH;\n } else if (supports.includes('sizeByPct')) {\n sizeParam = 'pct:' + formatPercentage(100 / scale);\n }\n } else {\n regionParam = 'full';\n if (supportsListedSizes) {\n const regionWidth = sizes[zoom][0],\n regionHeight = sizes[zoom][1];\n if (version == Versions.VERSION3) {\n if (regionWidth == width && regionHeight == height) {\n sizeParam = 'max';\n } else {\n sizeParam = regionWidth + ',' + regionHeight;\n }\n } else {\n if (regionWidth == width) {\n sizeParam = 'full';\n } else {\n sizeParam = regionWidth + ',';\n }\n }\n } else {\n sizeParam = version == Versions.VERSION3 ? 'max' : 'full';\n }\n }\n return (\n baseUrl + regionParam + '/' + sizeParam + '/0/' + quality + '.' + format\n );\n };\n\n const IiifTileClass = CustomTile.bind(\n null,\n toSize(tileSize || 256).map(function (size) {\n return size * tilePixelRatio;\n }),\n );\n\n super({\n attributions: partialOptions.attributions,\n attributionsCollapsible: partialOptions.attributionsCollapsible,\n cacheSize: partialOptions.cacheSize,\n crossOrigin: partialOptions.crossOrigin,\n interpolate: partialOptions.interpolate,\n projection: partialOptions.projection,\n reprojectionErrorThreshold: partialOptions.reprojectionErrorThreshold,\n state: partialOptions.state,\n tileClass: IiifTileClass,\n tileGrid: tileGrid,\n tilePixelRatio: partialOptions.tilePixelRatio,\n tileUrlFunction: tileUrlFunction,\n transition: partialOptions.transition,\n });\n\n /**\n * @type {number|import(\"../array.js\").NearestDirectionFunction}\n */\n this.zDirection = partialOptions.zDirection;\n }\n}\n\nexport default IIIF;\n","/**\n * @module ol/reproj/Image\n */\n\nimport ImageWrapper from '../Image.js';\nimport ImageState from '../ImageState.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {\n getCenter,\n getHeight,\n getIntersection,\n getWidth,\n isEmpty,\n} from '../extent.js';\nimport {\n calculateSourceResolution,\n render as renderReprojected,\n} from '../reproj.js';\nimport {fromResolutionLike} from '../resolution.js';\nimport Triangulation from './Triangulation.js';\nimport {ERROR_THRESHOLD} from './common.js';\n\n/**\n * @typedef {function(import(\"../extent.js\").Extent, number, number) : import(\"../Image.js\").default} FunctionType\n */\n\n/**\n * @classdesc\n * Class encapsulating single reprojected image.\n * See {@link module:ol/source/Image~ImageSource}.\n */\nclass ReprojImage extends ImageWrapper {\n /**\n * @param {import(\"../proj/Projection.js\").default} sourceProj Source projection (of the data).\n * @param {import(\"../proj/Projection.js\").default} targetProj Target projection.\n * @param {import(\"../extent.js\").Extent} targetExtent Target extent.\n * @param {number} targetResolution Target resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {FunctionType} getImageFunction\n * Function returning source images (extent, resolution, pixelRatio).\n * @param {boolean} interpolate Use linear interpolation when resampling.\n */\n constructor(\n sourceProj,\n targetProj,\n targetExtent,\n targetResolution,\n pixelRatio,\n getImageFunction,\n interpolate,\n ) {\n let maxSourceExtent = sourceProj.getExtent();\n if (maxSourceExtent && sourceProj.canWrapX()) {\n maxSourceExtent = maxSourceExtent.slice();\n maxSourceExtent[0] = -Infinity;\n maxSourceExtent[2] = Infinity;\n }\n let maxTargetExtent = targetProj.getExtent();\n if (maxTargetExtent && targetProj.canWrapX()) {\n maxTargetExtent = maxTargetExtent.slice();\n maxTargetExtent[0] = -Infinity;\n maxTargetExtent[2] = Infinity;\n }\n\n const limitedTargetExtent = maxTargetExtent\n ? getIntersection(targetExtent, maxTargetExtent)\n : targetExtent;\n\n const targetCenter = getCenter(limitedTargetExtent);\n const sourceResolution = calculateSourceResolution(\n sourceProj,\n targetProj,\n targetCenter,\n targetResolution,\n );\n\n const errorThresholdInPixels = ERROR_THRESHOLD;\n\n const triangulation = new Triangulation(\n sourceProj,\n targetProj,\n limitedTargetExtent,\n maxSourceExtent,\n sourceResolution * errorThresholdInPixels,\n targetResolution,\n );\n\n const sourceExtent = triangulation.calculateSourceExtent();\n const sourceImage = isEmpty(sourceExtent)\n ? null\n : getImageFunction(sourceExtent, sourceResolution, pixelRatio);\n const state = sourceImage ? ImageState.IDLE : ImageState.EMPTY;\n const sourcePixelRatio = sourceImage ? sourceImage.getPixelRatio() : 1;\n\n super(targetExtent, targetResolution, sourcePixelRatio, state);\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.targetProj_ = targetProj;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.maxSourceExtent_ = maxSourceExtent;\n\n /**\n * @private\n * @type {!import(\"./Triangulation.js\").default}\n */\n this.triangulation_ = triangulation;\n\n /**\n * @private\n * @type {number}\n */\n this.targetResolution_ = targetResolution;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.targetExtent_ = targetExtent;\n\n /**\n * @private\n * @type {import(\"../Image.js\").default}\n */\n this.sourceImage_ = sourceImage;\n\n /**\n * @private\n * @type {number}\n */\n this.sourcePixelRatio_ = sourcePixelRatio;\n\n /**\n * @private\n * @type {boolean}\n */\n this.interpolate_ = interpolate;\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.canvas_ = null;\n\n /**\n * @private\n * @type {?import(\"../events.js\").EventsKey}\n */\n this.sourceListenerKey_ = null;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n if (this.state == ImageState.LOADING) {\n this.unlistenSource_();\n }\n super.disposeInternal();\n }\n\n /**\n * @return {HTMLCanvasElement} Image.\n * @override\n */\n getImage() {\n return this.canvas_;\n }\n\n /**\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n getProjection() {\n return this.targetProj_;\n }\n\n /**\n * @private\n */\n reproject_() {\n const sourceState = this.sourceImage_.getState();\n if (sourceState == ImageState.LOADED) {\n const width = getWidth(this.targetExtent_) / this.targetResolution_;\n const height = getHeight(this.targetExtent_) / this.targetResolution_;\n this.canvas_ = renderReprojected(\n width,\n height,\n this.sourcePixelRatio_,\n fromResolutionLike(this.sourceImage_.getResolution()),\n this.maxSourceExtent_,\n this.targetResolution_,\n this.targetExtent_,\n this.triangulation_,\n [\n {\n extent: this.sourceImage_.getExtent(),\n image: this.sourceImage_.getImage(),\n },\n ],\n 0,\n undefined,\n this.interpolate_,\n true,\n );\n }\n this.state = sourceState;\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n * @override\n */\n load() {\n if (this.state == ImageState.IDLE) {\n this.state = ImageState.LOADING;\n this.changed();\n\n const sourceState = this.sourceImage_.getState();\n if (sourceState == ImageState.LOADED || sourceState == ImageState.ERROR) {\n this.reproject_();\n } else {\n this.sourceListenerKey_ = listen(\n this.sourceImage_,\n EventType.CHANGE,\n (e) => {\n const sourceState = this.sourceImage_.getState();\n if (\n sourceState == ImageState.LOADED ||\n sourceState == ImageState.ERROR\n ) {\n this.unlistenSource_();\n this.reproject_();\n }\n },\n );\n this.sourceImage_.load();\n }\n }\n }\n\n /**\n * @private\n */\n unlistenSource_() {\n unlistenByKey(\n /** @type {!import(\"../events.js\").EventsKey} */ (\n this.sourceListenerKey_\n ),\n );\n this.sourceListenerKey_ = null;\n }\n}\n\nexport default ReprojImage;\n","/**\n * @module ol/source/common\n */\n\n/**\n * Default WMS version.\n * @type {string}\n */\nexport const DEFAULT_WMS_VERSION = '1.3.0';\n\n/**\n * Number of decimal digits to consider in integer values when rounding.\n * @type {number}\n */\nexport const DECIMALS = 4;\n","/**\n * @module ol/source/Image\n */\nimport ImageWrapper from '../Image.js';\nimport ImageState from '../ImageState.js';\nimport {linearFindNearest} from '../array.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {\n containsExtent,\n equals,\n getCenter,\n getForViewAndSize,\n getHeight,\n getWidth,\n} from '../extent.js';\nimport {ceil} from '../math.js';\nimport {equivalent} from '../proj.js';\nimport ReprojImage from '../reproj/Image.js';\nimport {fromResolutionLike} from '../resolution.js';\nimport Source from './Source.js';\nimport {DECIMALS} from './common.js';\n\n/**\n * @enum {string}\n */\nexport const ImageSourceEventType = {\n /**\n * Triggered when an image starts loading.\n * @event module:ol/source/Image.ImageSourceEvent#imageloadstart\n * @api\n */\n IMAGELOADSTART: 'imageloadstart',\n\n /**\n * Triggered when an image finishes loading.\n * @event module:ol/source/Image.ImageSourceEvent#imageloadend\n * @api\n */\n IMAGELOADEND: 'imageloadend',\n\n /**\n * Triggered if image loading results in an error.\n * @event module:ol/source/Image.ImageSourceEvent#imageloaderror\n * @api\n */\n IMAGELOADERROR: 'imageloaderror',\n};\n\n/**\n * @typedef {'imageloadend'|'imageloaderror'|'imageloadstart'} ImageSourceEventTypes\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/source/Image~ImageSource} instances are instances of this\n * type.\n */\nexport class ImageSourceEvent extends Event {\n /**\n * @param {string} type Type.\n * @param {import(\"../Image.js\").default} image The image.\n */\n constructor(type, image) {\n super(type);\n\n /**\n * The image related to the event.\n * @type {import(\"../Image.js\").default}\n * @api\n */\n this.image = image;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<ImageSourceEventTypes, ImageSourceEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types\n * |ImageSourceEventTypes, Return>} ImageSourceOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../Image.js\").Loader} [loader] Loader. Can either be a custom loader, or one of the\n * loaders created with a `createLoader()` function ({@link module:ol/source/wms.createLoader wms},\n * {@link module:ol/source/arcgisRest.createLoader arcgisRest}, {@link module:ol/source/mapguide.createLoader mapguide},\n * {@link module:ol/source/static.createLoader static}).\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection.\n * @property {Array<number>} [resolutions] Resolutions.\n * @property {import(\"./Source.js\").State} [state] State.\n */\n\n/**\n * @classdesc\n * Base class for sources providing a single image.\n * @fires module:ol/source/Image.ImageSourceEvent\n * @api\n */\nclass ImageSource extends Source {\n /**\n * @param {Options} options Single image source options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n projection: options.projection,\n state: options.state,\n interpolate:\n options.interpolate !== undefined ? options.interpolate : true,\n });\n\n /***\n * @type {ImageSourceOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ImageSourceOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ImageSourceOnSignature<void>}\n */\n this.un;\n\n /**\n * @protected\n * @type {import(\"../Image.js\").Loader}\n */\n this.loader = options.loader || null;\n\n /**\n * @private\n * @type {Array<number>|null}\n */\n this.resolutions_ =\n options.resolutions !== undefined ? options.resolutions : null;\n\n /**\n * @private\n * @type {import(\"../reproj/Image.js\").default}\n */\n this.reprojectedImage_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.reprojectedRevision_ = 0;\n\n /**\n * @protected\n * @type {import(\"../Image.js\").default}\n */\n this.image = null;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.wantedExtent_;\n\n /**\n * @private\n * @type {number}\n */\n this.wantedResolution_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.static_ = options.loader ? options.loader.length === 0 : false;\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.wantedProjection_ = null;\n }\n\n /**\n * @return {Array<number>|null} Resolutions.\n * @override\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * @param {Array<number>|null} resolutions Resolutions.\n */\n setResolutions(resolutions) {\n this.resolutions_ = resolutions;\n }\n\n /**\n * @protected\n * @param {number} resolution Resolution.\n * @return {number} Resolution.\n */\n findNearestResolution(resolution) {\n const resolutions = this.getResolutions();\n if (resolutions) {\n const idx = linearFindNearest(resolutions, resolution, 0);\n resolution = resolutions[idx];\n }\n return resolution;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../Image.js\").default} Single image.\n */\n getImage(extent, resolution, pixelRatio, projection) {\n const sourceProjection = this.getProjection();\n if (\n !sourceProjection ||\n !projection ||\n equivalent(sourceProjection, projection)\n ) {\n if (sourceProjection) {\n projection = sourceProjection;\n }\n\n return this.getImageInternal(extent, resolution, pixelRatio, projection);\n }\n if (this.reprojectedImage_) {\n if (\n this.reprojectedRevision_ == this.getRevision() &&\n equivalent(this.reprojectedImage_.getProjection(), projection) &&\n this.reprojectedImage_.getResolution() == resolution &&\n equals(this.reprojectedImage_.getExtent(), extent)\n ) {\n return this.reprojectedImage_;\n }\n this.reprojectedImage_.dispose();\n this.reprojectedImage_ = null;\n }\n\n this.reprojectedImage_ = new ReprojImage(\n sourceProjection,\n projection,\n extent,\n resolution,\n pixelRatio,\n (extent, resolution, pixelRatio) =>\n this.getImageInternal(extent, resolution, pixelRatio, sourceProjection),\n this.getInterpolate(),\n );\n this.reprojectedRevision_ = this.getRevision();\n\n return this.reprojectedImage_;\n }\n\n /**\n * @abstract\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../Image.js\").default} Single image.\n * @protected\n */\n getImageInternal(extent, resolution, pixelRatio, projection) {\n if (this.loader) {\n const requestExtent = getRequestExtent(extent, resolution, pixelRatio, 1);\n const requestResolution = this.findNearestResolution(resolution);\n if (\n this.image &&\n (this.static_ ||\n (this.wantedProjection_ === projection &&\n ((this.wantedExtent_ &&\n containsExtent(this.wantedExtent_, requestExtent)) ||\n containsExtent(this.image.getExtent(), requestExtent)) &&\n ((this.wantedResolution_ &&\n fromResolutionLike(this.wantedResolution_) ===\n requestResolution) ||\n fromResolutionLike(this.image.getResolution()) ===\n requestResolution)))\n ) {\n return this.image;\n }\n this.wantedProjection_ = projection;\n this.wantedExtent_ = requestExtent;\n this.wantedResolution_ = requestResolution;\n this.image = new ImageWrapper(\n requestExtent,\n requestResolution,\n pixelRatio,\n this.loader,\n );\n this.image.addEventListener(\n EventType.CHANGE,\n this.handleImageChange.bind(this),\n );\n }\n return this.image;\n }\n\n /**\n * Handle image change events.\n * @param {import(\"../events/Event.js\").default} event Event.\n * @protected\n */\n handleImageChange(event) {\n const image = /** @type {import(\"../Image.js\").default} */ (event.target);\n let type;\n switch (image.getState()) {\n case ImageState.LOADING:\n this.loading = true;\n type = ImageSourceEventType.IMAGELOADSTART;\n break;\n case ImageState.LOADED:\n this.loading = false;\n type = ImageSourceEventType.IMAGELOADEND;\n break;\n case ImageState.ERROR:\n this.loading = false;\n type = ImageSourceEventType.IMAGELOADERROR;\n break;\n default:\n return;\n }\n if (this.hasListener(type)) {\n this.dispatchEvent(new ImageSourceEvent(type, image));\n }\n }\n}\n\n/**\n * Default image load function for image sources that use import(\"../Image.js\").Image image\n * instances.\n * @param {import(\"../Image.js\").default} image Image.\n * @param {string} src Source.\n */\nexport function defaultImageLoadFunction(image, src) {\n /** @type {HTMLImageElement|HTMLVideoElement} */ (image.getImage()).src = src;\n}\n\n/**\n * Adjusts the extent so it aligns with pixel boundaries.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Reolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} ratio Ratio between request size and view size.\n * @return {import(\"../extent.js\").Extent} Request extent.\n */\nexport function getRequestExtent(extent, resolution, pixelRatio, ratio) {\n const imageResolution = resolution / pixelRatio;\n const center = getCenter(extent);\n const viewWidth = ceil(getWidth(extent) / imageResolution, DECIMALS);\n const viewHeight = ceil(getHeight(extent) / imageResolution, DECIMALS);\n const marginWidth = ceil(((ratio - 1) * viewWidth) / 2, DECIMALS);\n const requestWidth = viewWidth + 2 * marginWidth;\n const marginHeight = ceil(((ratio - 1) * viewHeight) / 2, DECIMALS);\n const requestHeight = viewHeight + 2 * marginHeight;\n return getForViewAndSize(center, imageResolution, 0, [\n requestWidth,\n requestHeight,\n ]);\n}\n\nexport default ImageSource;\n","/**\n * @module ol/source/arcgisRest\n */\n\nimport {decode} from '../Image.js';\nimport {getHeight, getWidth} from '../extent.js';\nimport {round} from '../math.js';\nimport {get as getProjection} from '../proj.js';\nimport {appendParams} from '../uri.js';\nimport {getRequestExtent} from './Image.js';\nimport {DECIMALS} from './common.js';\n\n/**\n * @param {string} baseUrl Base URL for the ArcGIS Rest service.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {Object} params Params.\n * @return {string} Request URL.\n */\nexport function getRequestUrl(\n baseUrl,\n extent,\n resolution,\n pixelRatio,\n projection,\n params,\n) {\n // ArcGIS Server only wants the numeric portion of the projection ID.\n // (if there is no numeric portion the entire projection code must\n // form a valid ArcGIS SpatialReference definition).\n const srid = projection\n .getCode()\n .split(/:(?=\\d+$)/)\n .pop();\n\n const imageResolution = resolution / pixelRatio;\n\n const imageSize = [\n round(getWidth(extent) / imageResolution, DECIMALS),\n round(getHeight(extent) / imageResolution, DECIMALS),\n ];\n\n params['SIZE'] = imageSize[0] + ',' + imageSize[1];\n params['BBOX'] = extent.join(',');\n params['BBOXSR'] = srid;\n params['IMAGESR'] = srid;\n params['DPI'] = Math.round(\n params['DPI'] ? params['DPI'] * pixelRatio : 90 * pixelRatio,\n );\n\n const modifiedUrl = baseUrl\n .replace(/MapServer\\/?$/, 'MapServer/export')\n .replace(/ImageServer\\/?$/, 'ImageServer/exportImage');\n return appendParams(modifiedUrl, params);\n}\n\n/**\n * @typedef {Object} LoaderOptions\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting the image from\n * the remote server.\n * @property {Object<string,*>} [params] ArcGIS Rest parameters. This field is optional. Service\n * defaults will be used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is\n * `IMAGE` by default. `TRANSPARENT` is `true` by default. `BBOX`, `SIZE`, `BBOXSR`, and `IMAGESR`\n * will be set dynamically. Set `LAYERS` to override the default service layer visibility. See\n * https://developers.arcgis.com/rest/services-reference/export-map.htm\n * for further reference.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is 'EPSG:3857'.\n * The projection code must contain a numeric end portion separated by :\n * or the entire code must form a valid ArcGIS SpatialReference definition.\n * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport,\n * `2` means twice the size of the map viewport, and so on.\n * @property {string} url ArcGIS Rest service URL for a Map Service or Image Service. The url\n * should include /MapServer or /ImageServer.\n * @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function\n * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and\n * returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.\n */\n\n/**\n * Creates a loader for ArcGIS Rest images.\n * @param {LoaderOptions} options Image ArcGIS Rest Options.\n * @return {import('../Image.js').ImageObjectPromiseLoader} ArcGIS Rest image.\n * @api\n */\nexport function createLoader(options) {\n const load = options.load ? options.load : decode;\n const projection = getProjection(options.projection || 'EPSG:3857');\n const ratio = options.ratio ?? 1.5;\n const crossOrigin = options.crossOrigin ?? null;\n\n return function (extent, resolution, pixelRatio) {\n pixelRatio = options.hidpi ? pixelRatio : 1;\n\n const params = {\n 'F': 'image',\n 'FORMAT': 'PNG32',\n 'TRANSPARENT': true,\n };\n Object.assign(params, options.params);\n\n extent = getRequestExtent(extent, resolution, pixelRatio, ratio);\n\n const src = getRequestUrl(\n options.url,\n extent,\n resolution,\n pixelRatio,\n projection,\n params,\n );\n\n const image = new Image();\n image.crossOrigin = crossOrigin;\n\n return load(image, src).then((image) => {\n // Update resolution, because the server may return a smaller size than requested\n const resolution = (getWidth(extent) / image.width) * pixelRatio;\n return {image, extent, resolution, pixelRatio};\n });\n };\n}\n","/**\n * @module ol/source/mapguide\n */\n\nimport {decode} from '../Image.js';\nimport {getCenter, getHeight, getWidth} from '../extent.js';\nimport {appendParams} from '../uri.js';\nimport {getRequestExtent} from './Image.js';\n\n/**\n * @typedef {Object} LoaderOptions\n * @property {string} url The mapagent url.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {number} [displayDpi=96] The display resolution.\n * @property {number} [metersPerUnit=1] The meters-per-unit value.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting\n * the image from the remote server.\n * @property {boolean} [useOverlay] If `true`, will use `GETDYNAMICMAPOVERLAYIMAGE`.\n * @property {number} [ratio=1] Ratio. `1` means image requests are the size of the map viewport, `2` means\n * twice the width and height of the map viewport, and so on. Must be `1` or higher.\n * @property {Object} [params] Additional query parameters.\n * @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function\n * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and\n * returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.\n */\n\n/**\n * @param {import(\"../extent.js\").Extent} extent The map extents.\n * @param {import(\"../size.js\").Size} size The viewport size.\n * @param {number} metersPerUnit The meters-per-unit value.\n * @param {number} dpi The display resolution.\n * @return {number} The computed map scale.\n */\nfunction getScale(extent, size, metersPerUnit, dpi) {\n const mcsW = getWidth(extent);\n const mcsH = getHeight(extent);\n const devW = size[0];\n const devH = size[1];\n const mpp = 0.0254 / dpi;\n if (devH * mcsW > devW * mcsH) {\n return (mcsW * metersPerUnit) / (devW * mpp); // width limited\n }\n return (mcsH * metersPerUnit) / (devH * mpp); // height limited\n}\n\n/**\n * @param {string} baseUrl The mapagent url.\n * @param {Object<string, string|number>} params Request parameters.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {import(\"../size.js\").Size} size Size.\n * @param {boolean} useOverlay If `true`, will use `GETDYNAMICMAPOVERLAYIMAGE`.\n * @param {number} metersPerUnit The meters-per-unit value.\n * @param {number} displayDpi The display resolution.\n * @return {string} The mapagent map image request URL.\n */\nfunction getUrl(\n baseUrl,\n params,\n extent,\n size,\n useOverlay,\n metersPerUnit,\n displayDpi,\n) {\n const scale = getScale(extent, size, metersPerUnit, displayDpi);\n const center = getCenter(extent);\n const baseParams = {\n 'OPERATION': useOverlay ? 'GETDYNAMICMAPOVERLAYIMAGE' : 'GETMAPIMAGE',\n 'VERSION': '2.0.0',\n 'LOCALE': 'en',\n 'CLIENTAGENT': 'ol/source/ImageMapGuide source',\n 'CLIP': '1',\n 'SETDISPLAYDPI': displayDpi,\n 'SETDISPLAYWIDTH': Math.round(size[0]),\n 'SETDISPLAYHEIGHT': Math.round(size[1]),\n 'SETVIEWSCALE': scale,\n 'SETVIEWCENTERX': center[0],\n 'SETVIEWCENTERY': center[1],\n };\n Object.assign(baseParams, params);\n return appendParams(baseUrl, baseParams);\n}\n\n/**\n * Creates a loader for MapGuide images.\n * @param {LoaderOptions} options Image ArcGIS Rest Options.\n * @return {import('../Image.js').ImageObjectPromiseLoader} ArcGIS Rest image.\n * @api\n */\nexport function createLoader(options) {\n const load = options.load || decode;\n const useOverlay = options.useOverlay ?? false;\n const metersPerUnit = options.metersPerUnit || 1;\n const displayDpi = options.displayDpi || 96;\n const ratio = options.ratio ?? 1;\n const crossOrigin = options.crossOrigin ?? null;\n\n return function (extent, resolution, pixelRatio) {\n const image = new Image();\n image.crossOrigin = crossOrigin;\n extent = getRequestExtent(extent, resolution, pixelRatio, ratio);\n const width = getWidth(extent) / resolution;\n const height = getHeight(extent) / resolution;\n const size = [width * pixelRatio, height * pixelRatio];\n const src = getUrl(\n options.url,\n options.params,\n extent,\n size,\n useOverlay,\n metersPerUnit,\n displayDpi,\n );\n return load(image, src).then((image) => ({image, extent, pixelRatio}));\n };\n}\n","/**\n * @module ol/source/static\n */\n\nimport {decode} from '../Image.js';\nimport {getHeight, getWidth} from '../extent.js';\n\n/**\n * @typedef {Object} LoaderOptions\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {import(\"../extent.js\").Extent} imageExtent Extent of the image in map coordinates.\n * This is the [left, bottom, right, top] map coordinates of your image. When using this loader with an\n * `ol/source/Image`, the same extent must be set as `extent` of the `ol/layer/Image`.\n * @property {string} url Image URL.\n * @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function\n * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and\n * returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.\n */\n\n/**\n * Creates a loader for static images.\n * @param {LoaderOptions} options Loader options.\n * @return {import(\"../Image.js\").ImageObjectPromiseLoader} Loader.\n * @api\n */\nexport function createLoader(options) {\n const load = options.load || decode;\n const extent = options.imageExtent;\n const crossOrigin = options.crossOrigin ?? null;\n\n return () => {\n const image = new Image();\n image.crossOrigin = crossOrigin;\n return load(image, options.url).then((image) => {\n const resolutionX = getWidth(extent) / image.width;\n const resolutionY = getHeight(extent) / image.height;\n const resolution =\n resolutionX !== resolutionY ? [resolutionX, resolutionY] : resolutionY;\n return {image, extent, resolution, pixelRatio: 1};\n });\n };\n}\n","/**\n * @module ol/source/ImageTile\n */\nimport {expandUrl, pickUrl, renderXYZTemplate} from '../uri.js';\nimport DataTileSource from './DataTile.js';\n\n/**\n * Image tile loading function. The function is called with z, x, and y tile coordinates and\n * returns an {@link import(\"../DataTile.js\").ImageLike image} or a promise for the same.\n *\n * @typedef {function(number, number, number, import(\"./DataTile.js\").LoaderOptions):(import(\"../DataTile.js\").ImageLike|Promise<import(\"../DataTile.js\").ImageLike>)} Loader\n */\n\n/**\n * @typedef {function(number, number, number, import(\"./DataTile.js\").LoaderOptions):string} UrlGetter\n */\n\n/**\n * @typedef {string | Array<string> | UrlGetter} UrlLike\n */\n\n/**\n * @typedef {Object} Options\n * @property {UrlLike} [url] The image URL template. In addition to a single URL template, an array of URL templates or a function\n * can be provided. If a function is provided, it will be called with z, x, y tile coordinates and loader options and should\n * return a URL.\n * @property {Loader} [loader] Data loader. Called with z, x, and y tile coordinates.\n * Returns an {@link import(\"../DataTile.js\").ImageLike image} for a tile or a promise for the same.\n * The promise should not resolve until the image is loaded. If the `url` option is provided, a loader will be created.\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [maxZoom=42] Optional max zoom level. Not used if `tileGrid` is provided.\n * @property {number} [minZoom=0] Optional min zoom level. Not used if `tileGrid` is provided.\n * @property {number|import(\"../size.js\").Size} [tileSize=[256, 256]] The pixel width and height of the source tiles.\n * This may be different than the rendered pixel size if a `tileGrid` is provided.\n * @property {number} [gutter=0] The size in pixels of the gutter around data tiles to ignore.\n * This allows artifacts of rendering at tile edges to be ignored.\n * Supported data should be wider and taller than the tile size by a value of `2 x gutter`.\n * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Tile projection.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {import(\"./Source.js\").State} [state] The source state.\n * @property {boolean} [wrapX=true] Render tiles beyond the antimeridian.\n * @property {number} [transition] Transition time when fading in new tiles (in miliseconds).\n * @property {boolean} [interpolate=true] Use interpolated values when resampling.\n * @property {import('./DataTile.js').CrossOriginAttribute} [crossOrigin='anonymous'] The crossOrigin property to pass to loaders for image data.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\nconst loadError = new Error('Image failed to load');\n\n/**\n * @param {string} template The image url template.\n * @param {number} z The tile z coordinate.\n * @param {number} x The tile x coordinate.\n * @param {number} y The tile y coordinate.\n * @param {import('./DataTile.js').LoaderOptions} options The loader options.\n * @return {Promise<HTMLImageElement>} Resolves with a loaded image.\n */\nfunction loadImage(template, z, x, y, options) {\n return new Promise((resolve, reject) => {\n const image = new Image();\n image.crossOrigin = options.crossOrigin ?? null;\n image.addEventListener('load', () => resolve(image));\n image.addEventListener('error', () => reject(loadError));\n image.src = renderXYZTemplate(template, z, x, y, options.maxY);\n });\n}\n\n/**\n * @param {Array<string>} templates The url templates.\n * @return {Loader} The image loader.\n */\nfunction makeLoaderFromTemplates(templates) {\n return function (z, x, y, options) {\n const template = pickUrl(templates, z, x, y);\n return loadImage(template, z, x, y, options);\n };\n}\n\n/**\n * @param {UrlGetter} getter The url getter.\n * @return {Loader} The image loader.\n */\nfunction makeLoaderFromGetter(getter) {\n return function (z, x, y, options) {\n const url = getter(z, x, y, options);\n return loadImage(url, z, x, y, options);\n };\n}\n\n/**\n * @param {UrlLike} url The URL-like option.\n * @return {Loader} The tile loader.\n */\nfunction makeLoaderFromUrlLike(url) {\n /**\n * @type {Loader}\n */\n let loader;\n\n if (Array.isArray(url)) {\n loader = makeLoaderFromTemplates(url);\n } else if (typeof url === 'string') {\n const urls = expandUrl(url);\n loader = makeLoaderFromTemplates(urls);\n } else if (typeof url === 'function') {\n loader = makeLoaderFromGetter(url);\n } else {\n throw new Error(\n 'The url option must be a single template, an array of templates, or a function for getting a URL',\n );\n }\n return loader;\n}\n\nlet keyCount = 0;\n\n/**\n * @param {UrlLike} url The URL-like option.\n * @return {string} A key for the URL.\n */\nfunction keyFromUrlLike(url) {\n if (Array.isArray(url)) {\n return url.join('\\n');\n }\n\n if (typeof url === 'string') {\n return url;\n }\n\n ++keyCount;\n return 'url-function-key-' + keyCount;\n}\n\n/**\n * @classdesc\n * A source for typed array data tiles.\n *\n * @extends DataTileSource<import(\"../ImageTile.js\").default>\n * @fires import(\"./Tile.js\").TileSourceEvent\n * @api\n */\nclass ImageTileSource extends DataTileSource {\n /**\n * @param {Options} [options] DataTile source options.\n */\n constructor(options) {\n options = options || {};\n\n /**\n * @type {Loader}\n */\n let loader = options.loader;\n\n /**\n * @type {string}\n */\n let key;\n\n if (options.url) {\n loader = makeLoaderFromUrlLike(options.url);\n key = keyFromUrlLike(options.url);\n }\n\n /**\n * @type {import('./Source.js').State}\n */\n const state = !loader ? 'loading' : options.state;\n\n const wrapX = options.wrapX === undefined ? true : options.wrapX;\n\n super({\n loader: loader,\n key: key,\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n maxZoom: options.maxZoom,\n minZoom: options.minZoom,\n tileSize: options.tileSize,\n gutter: options.gutter,\n maxResolution: options.maxResolution,\n projection: options.projection,\n tileGrid: options.tileGrid,\n state: state,\n wrapX: wrapX,\n transition: options.transition,\n interpolate: options.interpolate !== false,\n crossOrigin: options.crossOrigin,\n zDirection: options.zDirection,\n });\n }\n\n /**\n * @param {UrlLike} url The new URL.\n * @api\n */\n setUrl(url) {\n const loader = makeLoaderFromUrlLike(url);\n this.setLoader(loader);\n this.setKey(keyFromUrlLike(url));\n if (this.getState() !== 'ready') {\n this.setState('ready');\n }\n }\n}\n\nexport default ImageTileSource;\n","/**\n * @module ol/source/wms\n */\n\nimport {decode} from '../Image.js';\nimport {getForViewAndSize, getHeight, getWidth} from '../extent.js';\nimport {floor, round} from '../math.js';\nimport {get as getProjection} from '../proj.js';\nimport {compareVersions} from '../string.js';\nimport {appendParams} from '../uri.js';\nimport {getRequestExtent} from './Image.js';\nimport {DECIMALS} from './common.js';\n\n/**\n * Default WMS version.\n * @type {string}\n */\nexport const DEFAULT_VERSION = '1.3.0';\n\n/**\n * @const\n * @type {import(\"../size.js\").Size}\n */\nconst GETFEATUREINFO_IMAGE_SIZE = [101, 101];\n\n/**\n * @api\n * @typedef {'carmentaserver' | 'geoserver' | 'mapserver' | 'qgis'} ServerType\n * Set the server type to use implementation-specific parameters beyond the WMS specification.\n * - `'carmentaserver'`: HiDPI support for [Carmenta Server](https://www.carmenta.com/en/products/carmenta-server)\n * - `'geoserver'`: HiDPI support for [GeoServer](https://geoserver.org/)\n * - `'mapserver'`: HiDPI support for [MapServer](https://mapserver.org/)\n * - `'qgis'`: HiDPI support for [QGIS](https://qgis.org/)\n */\n\n/**\n * @param {string} baseUrl Base URL.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {import(\"../size.js\").Size} size Size.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {Object} params WMS params. Will be modified in place.\n * @return {string} Request URL.\n */\nexport function getRequestUrl(baseUrl, extent, size, projection, params) {\n params['WIDTH'] = size[0];\n params['HEIGHT'] = size[1];\n\n const axisOrientation = projection.getAxisOrientation();\n const v13 = compareVersions(params['VERSION'], '1.3') >= 0;\n params[v13 ? 'CRS' : 'SRS'] = projection.getCode();\n const bbox =\n v13 && axisOrientation.startsWith('ne')\n ? [extent[1], extent[0], extent[3], extent[2]]\n : extent;\n params['BBOX'] = bbox.join(',');\n\n return appendParams(baseUrl, params);\n}\n\n/**\n * @param {import(\"../extent\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio pixel ratio.\n * @param {import(\"../proj.js\").Projection} projection Projection.\n * @param {string} url WMS service url.\n * @param {Object} params WMS params.\n * @param {import(\"./wms.js\").ServerType} serverType The type of the remote WMS server.\n * @return {string} Image src.\n */\nexport function getImageSrc(\n extent,\n resolution,\n pixelRatio,\n projection,\n url,\n params,\n serverType,\n) {\n params = Object.assign({REQUEST: 'GetMap'}, params);\n\n const imageResolution = resolution / pixelRatio;\n\n const imageSize = [\n round(getWidth(extent) / imageResolution, DECIMALS),\n round(getHeight(extent) / imageResolution, DECIMALS),\n ];\n\n if (pixelRatio != 1) {\n switch (serverType) {\n case 'geoserver':\n const dpi = (90 * pixelRatio + 0.5) | 0;\n if ('FORMAT_OPTIONS' in params) {\n params['FORMAT_OPTIONS'] += ';dpi:' + dpi;\n } else {\n params['FORMAT_OPTIONS'] = 'dpi:' + dpi;\n }\n break;\n case 'mapserver':\n params['MAP_RESOLUTION'] = 90 * pixelRatio;\n break;\n case 'carmentaserver':\n case 'qgis':\n params['DPI'] = 90 * pixelRatio;\n break;\n default:\n throw new Error('Unknown `serverType` configured');\n }\n }\n\n const src = getRequestUrl(url, extent, imageSize, projection, params);\n return src;\n}\n\n/**\n * @param {Object} params WMS params.\n * @param {string} request WMS `REQUEST`.\n * @return {Object} WMS params with required properties set.\n */\nexport function getRequestParams(params, request) {\n return Object.assign(\n {\n 'REQUEST': request,\n 'SERVICE': 'WMS',\n 'VERSION': DEFAULT_VERSION,\n 'FORMAT': 'image/png',\n 'STYLES': '',\n 'TRANSPARENT': 'TRUE',\n },\n params,\n );\n}\n\n/**\n * @typedef {Object} LoaderOptions\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting\n * the image from the remote server.\n * @property {Object<string,*>} [params] WMS request parameters.\n * At least a `LAYERS` param is required. `STYLES` is\n * `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT` and `BBOX` will be set\n * dynamically. `CRS` (`SRS` for WMS version < 1.3.0) will is derived from the `proection` config.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is 'EPSG:3857'.\n * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means\n * twice the width and height of the map viewport, and so on. Must be `1` or higher.\n * @property {import(\"./wms.js\").ServerType} [serverType] The type of\n * the remote WMS server: `mapserver`, `geoserver`, `carmentaserver`, or `qgis`.\n * Only needed if `hidpi` is `true`.\n * @property {string} url WMS service URL.\n * @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function\n * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and\n * returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.\n */\n\n/**\n * Creates a loader for WMS images.\n * @param {LoaderOptions} options Loader options.\n * @return {import(\"../Image.js\").ImageObjectPromiseLoader} Loader.\n * @api\n */\nexport function createLoader(options) {\n const hidpi = options.hidpi === undefined ? true : options.hidpi;\n const projection = getProjection(options.projection || 'EPSG:3857');\n const ratio = options.ratio || 1.5;\n const load = options.load || decode;\n const crossOrigin = options.crossOrigin ?? null;\n\n return (extent, resolution, pixelRatio) => {\n extent = getRequestExtent(extent, resolution, pixelRatio, ratio);\n if (pixelRatio != 1 && (!hidpi || options.serverType === undefined)) {\n pixelRatio = 1;\n }\n const src = getImageSrc(\n extent,\n resolution,\n pixelRatio,\n projection,\n options.url,\n getRequestParams(options.params, 'GetMap'),\n options.serverType,\n );\n const image = new Image();\n image.crossOrigin = crossOrigin;\n return load(image, src).then((image) => ({image, extent, pixelRatio}));\n };\n}\n\n/**\n * Get the GetFeatureInfo URL for the passed coordinate and resolution. Returns `undefined` if the\n * GetFeatureInfo URL cannot be constructed.\n * @param {LoaderOptions} options Options passed the `createWMSLoader()` function. In addition to\n * the params required by the loader, `INFO_FORMAT` should be specified, it defaults to\n * `application/json`. If `QUERY_LAYERS` is not provided, then the layers specified in the `LAYERS`\n * parameter will be used.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @return {string|undefined} GetFeatureInfo URL.\n * @api\n */\nexport function getFeatureInfoUrl(options, coordinate, resolution) {\n if (options.url === undefined) {\n return undefined;\n }\n\n const projectionObj = getProjection(options.projection || 'EPSG:3857');\n\n const extent = getForViewAndSize(\n coordinate,\n resolution,\n 0,\n GETFEATUREINFO_IMAGE_SIZE,\n );\n\n const baseParams = {\n 'QUERY_LAYERS': options.params['LAYERS'],\n 'INFO_FORMAT': 'application/json',\n };\n Object.assign(\n baseParams,\n getRequestParams(options.params, 'GetFeatureInfo'),\n options.params,\n );\n\n const x = floor((coordinate[0] - extent[0]) / resolution, DECIMALS);\n const y = floor((extent[3] - coordinate[1]) / resolution, DECIMALS);\n const v13 = compareVersions(baseParams['VERSION'], '1.3') >= 0;\n baseParams[v13 ? 'I' : 'X'] = x;\n baseParams[v13 ? 'J' : 'Y'] = y;\n\n return getRequestUrl(\n options.url,\n extent,\n GETFEATUREINFO_IMAGE_SIZE,\n projectionObj,\n baseParams,\n );\n}\n\n/**\n * Get the GetLegendGraphic URL, optionally optimized for the passed resolution and possibly\n * including any passed specific parameters. Returns `undefined` if the GetLegendGraphic URL\n * cannot be constructed.\n *\n * @param {LoaderOptions} options Options passed the `createWMSLoader()` function.\n * @param {number} [resolution] Resolution. If not provided, `SCALE` will not be calculated and\n * included in URL.\n * @return {string|undefined} GetLegendGraphic URL.\n * @api\n */\nexport function getLegendUrl(options, resolution) {\n if (options.url === undefined) {\n return undefined;\n }\n\n const baseParams = {\n 'SERVICE': 'WMS',\n 'VERSION': DEFAULT_VERSION,\n 'REQUEST': 'GetLegendGraphic',\n 'FORMAT': 'image/png',\n };\n\n if (resolution !== undefined) {\n const mpu =\n getProjection(options.projection || 'EPSG:3857').getMetersPerUnit() || 1;\n const pixelSize = 0.00028;\n baseParams['SCALE'] = (resolution * mpu) / pixelSize;\n }\n\n Object.assign(baseParams, options.params);\n\n if (options.params !== undefined && baseParams['LAYER'] === undefined) {\n const layers = baseParams['LAYERS'];\n const isSingleLayer = !Array.isArray(layers) || layers.length !== 1;\n if (!isSingleLayer) {\n return undefined;\n }\n baseParams['LAYER'] = layers;\n }\n\n return appendParams(options.url, baseParams);\n}\n","/**\n * @module ol/source/ogcTileUtil\n */\n\nimport {error as logError} from '../console.js';\nimport {getIntersection as intersectExtents} from '../extent.js';\nimport {getJSON, resolveUrl} from '../net.js';\nimport {get as getProjection} from '../proj.js';\nimport TileGrid from '../tilegrid/TileGrid.js';\n\n/**\n * See https://ogcapi.ogc.org/tiles/.\n */\n\n/**\n * @typedef {'map' | 'vector'} TileType\n */\n\n/**\n * @typedef {'topLeft' | 'bottomLeft'} CornerOfOrigin\n */\n\n/**\n * @typedef {Object} TileSet\n * @property {TileType} dataType Type of data represented in the tileset.\n * @property {string} [tileMatrixSetDefinition] Reference to a tile matrix set definition.\n * @property {TileMatrixSet} [tileMatrixSet] Tile matrix set definition.\n * @property {Array<TileMatrixSetLimit>} [tileMatrixSetLimits] Tile matrix set limits.\n * @property {Array<Link>} links Tileset links.\n */\n\n/**\n * @typedef {Object} Link\n * @property {string} rel The link rel attribute.\n * @property {string} href The link URL.\n * @property {string} type The link type.\n */\n\n/**\n * @typedef {Object} TileMatrixSetLimit\n * @property {string} tileMatrix The tile matrix id.\n * @property {number} minTileRow The minimum tile row.\n * @property {number} maxTileRow The maximum tile row.\n * @property {number} minTileCol The minimum tile column.\n * @property {number} maxTileCol The maximum tile column.\n */\n\n/**\n * @typedef {Object} TileMatrixSet\n * @property {string} id The tile matrix set identifier.\n * @property {string|CrsUri|CrsWkt|CrsReferenceSystem} crs The coordinate reference system.\n * @property {Array<string>} [orderedAxes] Axis order.\n * @property {Array<TileMatrix>} tileMatrices Array of tile matrices.\n */\n\n/**\n * @typedef {Object} CrsUri\n * @property {string} uri Reference to one coordinate reference system (CRS).\n */\n\n/**\n * @typedef {Object} CrsWkt\n * @property {Object} wkt JSON encoding for WKT representation of CRS 2.0.\n */\n\n/**\n * @typedef {Object} CrsReferenceSystem\n * @property {Object} referenceSystem Data structure as defined in the MD_ReferenceSystem of the ISO 19115.\n */\n\n/**\n * @typedef {Object} TileMatrix\n * @property {string} id The tile matrix identifier.\n * @property {number} cellSize The pixel resolution (map units per pixel).\n * @property {Array<number>} pointOfOrigin The map location of the matrix origin.\n * @property {CornerOfOrigin} [cornerOfOrigin='topLeft'] The corner of the matrix that represents the origin ('topLeft' or 'bottomLeft').\n * @property {number} matrixWidth The number of columns.\n * @property {number} matrixHeight The number of rows.\n * @property {number} tileWidth The pixel width of a tile.\n * @property {number} tileHeight The pixel height of a tile.\n */\n\n/**\n * @type {Object<string, boolean>}\n */\nconst knownMapMediaTypes = {\n 'image/png': true,\n 'image/jpeg': true,\n 'image/gif': true,\n 'image/webp': true,\n};\n\n/**\n * @type {Object<string, boolean>}\n */\nconst knownVectorMediaTypes = {\n 'application/vnd.mapbox-vector-tile': true,\n 'application/geo+json': true,\n};\n\n/**\n * @typedef {Object} TileSetInfo\n * @property {string} urlTemplate The tile URL template.\n * @property {import(\"../proj/Projection.js\").default} projection The source projection.\n * @property {import(\"../tilegrid/TileGrid.js\").default} grid The tile grid.\n * @property {import(\"../Tile.js\").UrlFunction} urlFunction The tile URL function.\n */\n\n/**\n * @typedef {Object} SourceInfo\n * @property {string} url The tile set URL.\n * @property {string} mediaType The preferred tile media type.\n * @property {Array<string>} [supportedMediaTypes] The supported media types.\n * @property {import(\"../proj/Projection.js\").default} projection The source projection.\n * @property {Object} [context] Optional context for constructing the URL.\n * @property {Array<string>} [collections] Optional collections to append the URL with.\n */\n\n/**\n * @param {string} tileUrlTemplate Tile URL template.\n * @param {Array<string>} collections List of collections to include as query parameter.\n * @return {string} The tile URL template with appended collections query parameter.\n */\nexport function appendCollectionsQueryParam(tileUrlTemplate, collections) {\n if (!collections.length) {\n return tileUrlTemplate;\n }\n\n // making sure we can always construct a URL instance.\n const url = new URL(tileUrlTemplate, 'file:/');\n\n if (url.pathname.split('/').includes('collections')) {\n logError(\n 'The \"collections\" query parameter cannot be added to collection endpoints',\n );\n return tileUrlTemplate;\n }\n // According to conformance class\n // http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection\n // commata in the identifiers of the `collections` query parameter\n // need to be URLEncoded, while the commata separating the identifiers\n // should not.\n const encodedCollections = collections\n .map((c) => encodeURIComponent(c))\n .join(',');\n\n url.searchParams.append('collections', encodedCollections);\n const baseUrl = tileUrlTemplate.split('?')[0];\n const queryParams = decodeURIComponent(url.searchParams.toString());\n return `${baseUrl}?${queryParams}`;\n}\n\n/**\n * @param {Array<Link>} links Tileset links.\n * @param {string} [mediaType] The preferred media type.\n * @param {Array<string>} [collections] Optional collections to append the URL with.\n * @return {string} The tile URL template.\n */\nexport function getMapTileUrlTemplate(links, mediaType, collections) {\n let tileUrlTemplate;\n let fallbackUrlTemplate;\n for (let i = 0; i < links.length; ++i) {\n const link = links[i];\n if (link.rel === 'item') {\n if (link.type === mediaType) {\n tileUrlTemplate = link.href;\n break;\n }\n if (knownMapMediaTypes[link.type]) {\n fallbackUrlTemplate = link.href;\n } else if (!fallbackUrlTemplate && link.type.startsWith('image/')) {\n fallbackUrlTemplate = link.href;\n }\n }\n }\n\n if (!tileUrlTemplate) {\n if (fallbackUrlTemplate) {\n tileUrlTemplate = fallbackUrlTemplate;\n } else {\n throw new Error('Could not find \"item\" link');\n }\n }\n\n if (collections) {\n tileUrlTemplate = appendCollectionsQueryParam(tileUrlTemplate, collections);\n }\n\n return tileUrlTemplate;\n}\n\n/**\n * @param {Array<Link>} links Tileset links.\n * @param {string} [mediaType] The preferred media type.\n * @param {Array<string>} [supportedMediaTypes] The media types supported by the parser.\n * @param {Array<string>} [collections] Optional collections to append the URL with.\n * @return {string} The tile URL template.\n */\nexport function getVectorTileUrlTemplate(\n links,\n mediaType,\n supportedMediaTypes,\n collections,\n) {\n let tileUrlTemplate;\n let fallbackUrlTemplate;\n\n /**\n * Lookup of URL by media type.\n * @type {Object<string, string>}\n */\n const hrefLookup = {};\n\n for (let i = 0; i < links.length; ++i) {\n const link = links[i];\n hrefLookup[link.type] = link.href;\n if (link.rel === 'item') {\n if (link.type === mediaType) {\n tileUrlTemplate = link.href;\n break;\n }\n if (knownVectorMediaTypes[link.type]) {\n fallbackUrlTemplate = link.href;\n }\n }\n }\n\n if (!tileUrlTemplate && supportedMediaTypes) {\n for (let i = 0; i < supportedMediaTypes.length; ++i) {\n const supportedMediaType = supportedMediaTypes[i];\n if (hrefLookup[supportedMediaType]) {\n tileUrlTemplate = hrefLookup[supportedMediaType];\n break;\n }\n }\n }\n\n if (!tileUrlTemplate) {\n if (fallbackUrlTemplate) {\n tileUrlTemplate = fallbackUrlTemplate;\n } else {\n throw new Error('Could not find \"item\" link');\n }\n }\n\n if (collections) {\n tileUrlTemplate = appendCollectionsQueryParam(tileUrlTemplate, collections);\n }\n\n return tileUrlTemplate;\n}\n\n/**\n * @param {SourceInfo} sourceInfo The source info.\n * @param {TileMatrixSet} tileMatrixSet Tile matrix set.\n * @param {string} tileUrlTemplate Tile URL template.\n * @param {Array<TileMatrixSetLimit>} [tileMatrixSetLimits] Tile matrix set limits.\n * @return {TileSetInfo} Tile set info.\n */\nfunction parseTileMatrixSet(\n sourceInfo,\n tileMatrixSet,\n tileUrlTemplate,\n tileMatrixSetLimits,\n) {\n let projection = sourceInfo.projection;\n if (!projection) {\n if (typeof tileMatrixSet.crs === 'string') {\n projection = getProjection(tileMatrixSet.crs);\n } else if ('uri' in tileMatrixSet.crs) {\n projection = getProjection(tileMatrixSet.crs.uri);\n }\n if (!projection) {\n throw new Error(`Unsupported CRS: ${JSON.stringify(tileMatrixSet.crs)}`);\n }\n }\n const orderedAxes = tileMatrixSet.orderedAxes;\n const axisOrientation = orderedAxes\n ? orderedAxes\n .slice(0, 2)\n .map((s) => s.replace(/E|X|Lon/i, 'e').replace(/N|Y|Lat/i, 'n'))\n .join('')\n : projection.getAxisOrientation();\n const backwards = !axisOrientation.startsWith('en');\n\n const matrices = tileMatrixSet.tileMatrices;\n\n /**\n * @type {Object<string, TileMatrix>}\n */\n const matrixLookup = {};\n for (let i = 0; i < matrices.length; ++i) {\n const matrix = matrices[i];\n matrixLookup[matrix.id] = matrix;\n }\n\n /**\n * @type {Object<string, TileMatrixSetLimit>}\n */\n const limitLookup = {};\n\n /**\n * @type {Array<string>}\n */\n const matrixIds = [];\n\n if (tileMatrixSetLimits) {\n for (let i = 0; i < tileMatrixSetLimits.length; ++i) {\n const limit = tileMatrixSetLimits[i];\n const id = limit.tileMatrix;\n matrixIds.push(id);\n limitLookup[id] = limit;\n }\n } else {\n for (let i = 0; i < matrices.length; ++i) {\n const id = matrices[i].id;\n matrixIds.push(id);\n }\n }\n\n const length = matrixIds.length;\n const origins = new Array(length);\n const resolutions = new Array(length);\n const sizes = new Array(length);\n const tileSizes = new Array(length);\n const extent = [-Infinity, -Infinity, Infinity, Infinity];\n\n for (let i = 0; i < length; ++i) {\n const id = matrixIds[i];\n const matrix = matrixLookup[id];\n const origin = matrix.pointOfOrigin;\n if (backwards) {\n origins[i] = [origin[1], origin[0]];\n } else {\n origins[i] = origin;\n }\n resolutions[i] = matrix.cellSize;\n sizes[i] = [matrix.matrixWidth, matrix.matrixHeight];\n tileSizes[i] = [matrix.tileWidth, matrix.tileHeight];\n const limit = limitLookup[id];\n if (limit) {\n const tileMapWidth = matrix.cellSize * matrix.tileWidth;\n const minX = origins[i][0] + limit.minTileCol * tileMapWidth;\n const maxX = origins[i][0] + (limit.maxTileCol + 1) * tileMapWidth;\n\n const tileMapHeight = matrix.cellSize * matrix.tileHeight;\n const upsideDown = matrix.cornerOfOrigin === 'bottomLeft';\n\n let minY;\n let maxY;\n if (upsideDown) {\n minY = origins[i][1] + limit.minTileRow * tileMapHeight;\n maxY = origins[i][1] + (limit.maxTileRow + 1) * tileMapHeight;\n } else {\n minY = origins[i][1] - (limit.maxTileRow + 1) * tileMapHeight;\n maxY = origins[i][1] - limit.minTileRow * tileMapHeight;\n }\n\n intersectExtents(extent, [minX, minY, maxX, maxY], extent);\n }\n }\n\n const tileGrid = new TileGrid({\n origins: origins,\n resolutions: resolutions,\n sizes: sizes,\n tileSizes: tileSizes,\n extent: tileMatrixSetLimits ? extent : undefined,\n });\n\n const context = sourceInfo.context;\n const base = sourceInfo.url;\n\n /** @type {import('../Tile.js').UrlFunction} */\n function tileUrlFunction(tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n }\n\n const id = matrixIds[tileCoord[0]];\n const matrix = matrixLookup[id];\n const upsideDown = matrix.cornerOfOrigin === 'bottomLeft';\n\n const localContext = {\n tileMatrix: id,\n tileCol: tileCoord[1],\n tileRow: upsideDown ? -tileCoord[2] - 1 : tileCoord[2],\n };\n\n if (tileMatrixSetLimits) {\n const limit = limitLookup[matrix.id];\n if (\n localContext.tileCol < limit.minTileCol ||\n localContext.tileCol > limit.maxTileCol ||\n localContext.tileRow < limit.minTileRow ||\n localContext.tileRow > limit.maxTileRow\n ) {\n return undefined;\n }\n }\n\n Object.assign(localContext, context);\n\n const url = tileUrlTemplate.replace(/\\{(\\w+?)\\}/g, function (m, p) {\n return localContext[p];\n });\n\n return resolveUrl(base, url);\n }\n\n return {\n grid: tileGrid,\n projection: projection,\n urlTemplate: tileUrlTemplate,\n urlFunction: tileUrlFunction,\n };\n}\n\n/**\n * @param {SourceInfo} sourceInfo The source info.\n * @param {TileSet} tileSet Tile set.\n * @return {TileSetInfo|Promise<TileSetInfo>} Tile set info.\n */\nfunction parseTileSetMetadata(sourceInfo, tileSet) {\n const tileMatrixSetLimits = tileSet.tileMatrixSetLimits;\n /** @type {string} */\n let tileUrlTemplate;\n\n if (tileSet.dataType === 'map') {\n tileUrlTemplate = getMapTileUrlTemplate(\n tileSet.links,\n sourceInfo.mediaType,\n sourceInfo.collections,\n );\n } else if (tileSet.dataType === 'vector') {\n tileUrlTemplate = getVectorTileUrlTemplate(\n tileSet.links,\n sourceInfo.mediaType,\n sourceInfo.supportedMediaTypes,\n sourceInfo.collections,\n );\n } else {\n throw new Error('Expected tileset data type to be \"map\" or \"vector\"');\n }\n\n if (tileSet.tileMatrixSet) {\n return parseTileMatrixSet(\n sourceInfo,\n tileSet.tileMatrixSet,\n tileUrlTemplate,\n tileMatrixSetLimits,\n );\n }\n\n const tileMatrixSetLink = tileSet.links.find(\n (link) =>\n link.rel === 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme',\n );\n if (!tileMatrixSetLink) {\n throw new Error(\n 'Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet',\n );\n }\n const tileMatrixSetDefinition = tileMatrixSetLink.href;\n\n const url = resolveUrl(sourceInfo.url, tileMatrixSetDefinition);\n return getJSON(url).then(function (tileMatrixSet) {\n return parseTileMatrixSet(\n sourceInfo,\n tileMatrixSet,\n tileUrlTemplate,\n tileMatrixSetLimits,\n );\n });\n}\n\n/**\n * @param {SourceInfo} sourceInfo Source info.\n * @return {Promise<TileSetInfo>} Tile set info.\n */\nexport function getTileSetInfo(sourceInfo) {\n return getJSON(sourceInfo.url).then(function (tileSet) {\n return parseTileSetMetadata(sourceInfo, tileSet);\n });\n}\n","/**\n * @module ol/source/VectorTile\n */\n\nimport TileState from '../TileState.js';\nimport VectorRenderTile from '../VectorRenderTile.js';\nimport Tile from '../VectorTile.js';\nimport {assert} from '../asserts.js';\nimport EventType from '../events/EventType.js';\nimport {\n buffer as bufferExtent,\n getIntersection,\n intersects,\n} from '../extent.js';\nimport {loadFeaturesXhr} from '../featureloader.js';\nimport {isEmpty} from '../obj.js';\nimport {equivalent} from '../proj.js';\nimport {toSize} from '../size.js';\nimport TileGrid from '../tilegrid/TileGrid.js';\nimport {DEFAULT_MAX_ZOOM} from '../tilegrid/common.js';\nimport {createXYZ, extentFromProjection} from '../tilegrid.js';\nimport UrlTile from './UrlTile.js';\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../render/Feature.js\").default]\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least twice the number of tiles in the viewport.\n * @property {import(\"../extent.js\").Extent} [extent] Extent.\n * @property {import(\"../format/Feature.js\").default<FeatureType>} [format] Feature format for tiles. Used and required by the default.\n * @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this\n * to `false` (e.g. for sources with polygons that represent administrative\n * boundaries or TopoJSON sources) allows the renderer to optimise fill and\n * stroke operations.\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Projection of the tile grid.\n * @property {import(\"./Source.js\").State} [state] Source state.\n * @property {typeof import(\"../VectorTile.js\").default} [tileClass] Class used to instantiate tiles.\n * Default is {@link module:ol/VectorTile~VectorTile}.\n * @property {number} [maxZoom=22] Optional max zoom level. Not used if `tileGrid` is provided.\n * @property {number} [minZoom] Optional min zoom level. Not used if `tileGrid` is provided.\n * @property {number|import(\"../size.js\").Size} [tileSize=512] Optional tile size. Not used if `tileGrid` is provided.\n * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction]\n * Optional function to load a tile given a URL. Could look like this for pbf tiles:\n * ```js\n * function(tile, url) {\n * tile.setLoader(function(extent, resolution, projection) {\n * fetch(url).then(function(response) {\n * response.arrayBuffer().then(function(data) {\n * const format = tile.getFormat() // ol/format/MVT configured as source format\n * const features = format.readFeatures(data, {\n * extent: extent,\n * featureProjection: projection\n * });\n * tile.setFeatures(features);\n * });\n * });\n * });\n * }\n * ```\n * If you do not need extent, resolution and projection to get the features for a tile (e.g.\n * for GeoJSON tiles), your `tileLoadFunction` does not need a `setLoader()` call. Only make sure\n * to call `setFeatures()` on the tile:\n * ```js\n * const format = new GeoJSON({featureProjection: map.getView().getProjection()});\n * async function tileLoadFunction(tile, url) {\n * const response = await fetch(url);\n * const data = await response.json();\n * tile.setFeatures(format.readFeatures(data));\n * }\n * ```\n * @property {import(\"../Tile.js\").UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.\n * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.\n * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be\n * used instead of defining each one separately in the `urls` option.\n * @property {number} [transition] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {Array<string>} [urls] An array of URL templates.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * When set to `false`, only one world\n * will be rendered. When set to `true`, tiles will be wrapped horizontally to\n * render multiple worlds.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=1]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Class for layer sources providing vector data divided into a tile grid, to be\n * used with {@link module:ol/layer/VectorTile~VectorTileLayer}. Although this source receives tiles\n * with vector features from the server, it is not meant for feature editing.\n * Features are optimized for rendering, their geometries are clipped at or near\n * tile boundaries and simplified for a view resolution. See\n * {@link module:ol/source/Vector~VectorSource} for vector sources that are suitable for feature\n * editing.\n *\n * @fires import(\"./Tile.js\").TileSourceEvent\n * @api\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../render/Feature.js\").default]\n */\nclass VectorTile extends UrlTile {\n /**\n * @param {!Options<FeatureType>} options Vector tile options.\n */\n constructor(options) {\n const projection = options.projection || 'EPSG:3857';\n\n const extent = options.extent || extentFromProjection(projection);\n\n const tileGrid =\n options.tileGrid ||\n createXYZ({\n extent: extent,\n maxResolution: options.maxResolution,\n maxZoom: options.maxZoom !== undefined ? options.maxZoom : 22,\n minZoom: options.minZoom,\n tileSize: options.tileSize || 512,\n });\n\n super({\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n cacheSize: options.cacheSize,\n interpolate: true,\n projection: projection,\n state: options.state,\n tileGrid: tileGrid,\n tileLoadFunction: options.tileLoadFunction\n ? options.tileLoadFunction\n : defaultLoadFunction,\n tileUrlFunction: options.tileUrlFunction,\n url: options.url,\n urls: options.urls,\n wrapX: options.wrapX === undefined ? true : options.wrapX,\n transition: options.transition,\n zDirection: options.zDirection === undefined ? 1 : options.zDirection,\n });\n\n /**\n * @private\n * @type {import(\"../format/Feature.js\").default<FeatureType>|null}\n */\n this.format_ = options.format ? options.format : null;\n\n /**\n * @type {Object<string, Array<string>>}\n * @private\n */\n this.tileKeysBySourceTileUrl_ = {};\n\n /**\n @type {Object<string, Tile<FeatureType>>}\n */\n this.sourceTiles_ = {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.overlaps_ = options.overlaps == undefined ? true : options.overlaps;\n\n /**\n * @protected\n * @type {typeof import(\"../VectorTile.js\").default}\n */\n this.tileClass = options.tileClass ? options.tileClass : Tile;\n\n /**\n * @private\n * @type {Object<string, import(\"../tilegrid/TileGrid.js\").default>}\n */\n this.tileGrids_ = {};\n }\n\n /**\n * @return {boolean} The source can have overlapping geometries.\n */\n getOverlaps() {\n return this.overlaps_;\n }\n\n /**\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection\").default} projection Projection.\n * @param {VectorRenderTile} tile Vector render tile.\n * @return {Array<import(\"../VectorTile\").default>} Tile keys.\n */\n getSourceTiles(pixelRatio, projection, tile) {\n if (tile.getState() === TileState.IDLE) {\n tile.setState(TileState.LOADING);\n const urlTileCoord = tile.wrappedTileCoord;\n const tileGrid = this.getTileGridForProjection(projection);\n const extent = tileGrid.getTileCoordExtent(urlTileCoord);\n const z = urlTileCoord[0];\n const resolution = tileGrid.getResolution(z);\n // make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space\n bufferExtent(extent, -resolution, extent);\n const sourceTileGrid = this.tileGrid;\n const sourceExtent = sourceTileGrid.getExtent();\n if (sourceExtent) {\n getIntersection(extent, sourceExtent, extent);\n }\n const sourceZ = sourceTileGrid.getZForResolution(\n resolution,\n this.zDirection,\n );\n\n sourceTileGrid.forEachTileCoord(extent, sourceZ, (sourceTileCoord) => {\n const tileUrl = this.tileUrlFunction(\n sourceTileCoord,\n pixelRatio,\n projection,\n );\n if (!this.sourceTiles_[tileUrl]) {\n this.sourceTiles_[tileUrl] = new this.tileClass(\n sourceTileCoord,\n tileUrl ? TileState.IDLE : TileState.EMPTY,\n tileUrl,\n this.format_,\n this.tileLoadFunction,\n );\n }\n const sourceTile = this.sourceTiles_[tileUrl];\n tile.sourceTiles.push(sourceTile);\n if (!this.tileKeysBySourceTileUrl_[tileUrl]) {\n this.tileKeysBySourceTileUrl_[tileUrl] = [];\n }\n this.tileKeysBySourceTileUrl_[tileUrl].push(tile.getKey());\n const sourceTileState = sourceTile.getState();\n if (sourceTileState < TileState.LOADED) {\n const listenChange = (event) => {\n this.handleTileChange(event);\n const state = sourceTile.getState();\n if (state === TileState.LOADED || state === TileState.ERROR) {\n const sourceTileKey = sourceTile.getKey();\n if (sourceTileKey in tile.errorTileKeys) {\n if (sourceTile.getState() === TileState.LOADED) {\n delete tile.errorTileKeys[sourceTileKey];\n }\n } else {\n tile.loadingSourceTiles--;\n }\n if (state === TileState.ERROR) {\n tile.errorTileKeys[sourceTileKey] = true;\n } else {\n sourceTile.removeEventListener(EventType.CHANGE, listenChange);\n }\n if (tile.loadingSourceTiles === 0) {\n tile.setState(\n isEmpty(tile.errorTileKeys)\n ? TileState.LOADED\n : TileState.ERROR,\n );\n }\n }\n };\n sourceTile.addEventListener(EventType.CHANGE, listenChange);\n tile.loadingSourceTiles++;\n }\n if (sourceTileState === TileState.IDLE) {\n sourceTile.extent =\n sourceTileGrid.getTileCoordExtent(sourceTileCoord);\n sourceTile.projection = projection;\n sourceTile.resolution = sourceTileGrid.getResolution(\n sourceTileCoord[0],\n );\n sourceTile.load();\n }\n });\n if (!tile.loadingSourceTiles) {\n tile.setState(\n tile.sourceTiles.some(\n (sourceTile) => sourceTile.getState() === TileState.ERROR,\n )\n ? TileState.ERROR\n : TileState.LOADED,\n );\n }\n }\n\n return tile.sourceTiles;\n }\n\n /**\n * @param {VectorRenderTile} tile Vector render tile.\n */\n removeSourceTiles(tile) {\n const tileKey = tile.getKey();\n const sourceTiles = tile.sourceTiles;\n for (let i = 0, ii = sourceTiles.length; i < ii; ++i) {\n const sourceTileUrl = sourceTiles[i].getTileUrl();\n if (!this.tileKeysBySourceTileUrl_[sourceTileUrl]) {\n return;\n }\n const index =\n this.tileKeysBySourceTileUrl_[sourceTileUrl].indexOf(tileKey);\n if (index === -1) {\n continue;\n }\n this.tileKeysBySourceTileUrl_[sourceTileUrl].splice(index, 1);\n if (this.tileKeysBySourceTileUrl_[sourceTileUrl].length === 0) {\n delete this.tileKeysBySourceTileUrl_[sourceTileUrl];\n delete this.sourceTiles_[sourceTileUrl];\n }\n }\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!VectorRenderTile} Tile.\n * @override\n */\n getTile(z, x, y, pixelRatio, projection) {\n const tileCoord = [z, x, y];\n let urlTileCoord = this.getTileCoordForTileUrlFunction(\n tileCoord,\n projection,\n );\n const sourceExtent = this.getTileGrid().getExtent();\n const tileGrid = this.getTileGridForProjection(projection);\n if (urlTileCoord && sourceExtent) {\n const tileExtent = tileGrid.getTileCoordExtent(urlTileCoord);\n // make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space\n bufferExtent(tileExtent, -tileGrid.getResolution(z), tileExtent);\n if (!intersects(sourceExtent, tileExtent)) {\n urlTileCoord = null;\n }\n }\n let empty = true;\n if (urlTileCoord !== null) {\n const sourceTileGrid = this.tileGrid;\n const resolution = tileGrid.getResolution(z);\n const sourceZ = sourceTileGrid.getZForResolution(resolution, 1);\n // make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space\n const extent = tileGrid.getTileCoordExtent(urlTileCoord);\n bufferExtent(extent, -resolution, extent);\n sourceTileGrid.forEachTileCoord(extent, sourceZ, (sourceTileCoord) => {\n empty =\n empty &&\n !this.tileUrlFunction(sourceTileCoord, pixelRatio, projection);\n });\n }\n const newTile = new VectorRenderTile(\n tileCoord,\n empty ? TileState.EMPTY : TileState.IDLE,\n urlTileCoord,\n this.getSourceTiles.bind(this, pixelRatio, projection),\n this.removeSourceTiles.bind(this),\n );\n newTile.key = this.getKey();\n return newTile;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!import(\"../tilegrid/TileGrid.js\").default} Tile grid.\n * @override\n */\n getTileGridForProjection(projection) {\n const code = projection.getCode();\n let tileGrid = this.tileGrids_[code];\n if (!tileGrid) {\n const sourceProjection = this.getProjection();\n assert(\n sourceProjection === null || equivalent(sourceProjection, projection),\n 'A VectorTile source can only be rendered if it has a projection compatible with the view projection.',\n );\n\n // A tile grid that matches the tile size of the source tile grid is more\n // likely to have 1:1 relationships between source tiles and rendered tiles.\n const sourceTileGrid = this.tileGrid;\n const resolutions = sourceTileGrid.getResolutions().slice();\n const origins = resolutions.map(function (resolution, z) {\n return sourceTileGrid.getOrigin(z);\n });\n const tileSizes = resolutions.map(function (resolution, z) {\n return sourceTileGrid.getTileSize(z);\n });\n const length = DEFAULT_MAX_ZOOM + 1;\n for (let z = resolutions.length; z < length; ++z) {\n resolutions.push(resolutions[z - 1] / 2);\n origins.push(origins[z - 1]);\n tileSizes.push(tileSizes[z - 1]);\n }\n tileGrid = new TileGrid({\n extent: sourceTileGrid.getExtent(),\n origins: origins,\n resolutions: resolutions,\n tileSizes: tileSizes,\n });\n this.tileGrids_[code] = tileGrid;\n }\n return tileGrid;\n }\n\n /**\n * Get the tile pixel ratio for this source.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Tile pixel ratio.\n * @override\n */\n getTilePixelRatio(pixelRatio) {\n return pixelRatio;\n }\n\n /**\n * @param {number} z Z.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../size.js\").Size} Tile size.\n * @override\n */\n getTilePixelSize(z, pixelRatio, projection) {\n const tileGrid = this.getTileGridForProjection(projection);\n const tileSize = toSize(tileGrid.getTileSize(z), this.tmpSize);\n return [\n Math.round(tileSize[0] * pixelRatio),\n Math.round(tileSize[1] * pixelRatio),\n ];\n }\n\n /**\n * @param {boolean} overlaps The source has overlapping geometries.\n */\n setOverlaps(overlaps) {\n this.overlaps_ = overlaps;\n this.changed();\n }\n}\n\nexport default VectorTile;\n\n/**\n * Sets the loader for a tile.\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../render/Feature.js\").default]\n * @param {import(\"../VectorTile.js\").default<FeatureType>} tile Vector tile.\n * @param {string} url URL.\n */\nexport function defaultLoadFunction(tile, url) {\n tile.setLoader(\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n */\n function (extent, resolution, projection) {\n loadFeaturesXhr(\n url,\n tile.getFormat(),\n extent,\n resolution,\n projection,\n tile.onLoad.bind(tile),\n tile.onError.bind(tile),\n );\n },\n );\n}\n","/**\n * @module ol/source/OSM\n */\n\nimport XYZ from './XYZ.js';\n\n/**\n * The attribution containing a link to the OpenStreetMap Copyright and License\n * page.\n * @const\n * @type {string}\n * @api\n */\nexport const ATTRIBUTION =\n '© ' +\n '<a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> ' +\n 'contributors.';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {number} [maxZoom=19] Max zoom.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {number} [transition=250] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {string} [url='https://tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template.\n * Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for the OpenStreetMap tile server.\n * @api\n */\nclass OSM extends XYZ {\n /**\n * @param {Options} [options] Open Street Map options.\n */\n constructor(options) {\n options = options || {};\n\n let attributions;\n if (options.attributions !== undefined) {\n attributions = options.attributions;\n } else {\n attributions = [ATTRIBUTION];\n }\n\n const crossOrigin =\n options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';\n\n const url =\n options.url !== undefined\n ? options.url\n : 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';\n\n super({\n attributions: attributions,\n attributionsCollapsible: false,\n cacheSize: options.cacheSize,\n crossOrigin: crossOrigin,\n interpolate: options.interpolate,\n maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileLoadFunction: options.tileLoadFunction,\n transition: options.transition,\n url: url,\n wrapX: options.wrapX,\n zDirection: options.zDirection,\n });\n }\n}\n\nexport default OSM;\n","/**\n * @module ol/render/canvas/ZIndexContext\n */\n\nimport {getSharedCanvasContext2D} from '../../dom.js';\n\n/** @typedef {CanvasRenderingContext2D & {globalAlpha: any}} ZIndexContextProxy */\n\n/**\n * @extends {CanvasRenderingContext2D}\n */\nclass ZIndexContext {\n constructor() {\n /**\n * @private\n * @type {Array<Array<*>>}\n */\n this.instructions_ = [];\n /**\n * @type {number}\n */\n this.zIndex = 0;\n /**\n * @private\n * @type {number}\n */\n this.offset_ = 0;\n\n /**\n * @private\n * @type {ZIndexContextProxy}\n */\n this.context_ = /** @type {ZIndexContextProxy} */ (\n new Proxy(getSharedCanvasContext2D(), {\n get: (target, property) => {\n if (\n typeof (/** @type {*} */ (getSharedCanvasContext2D())[property]) !==\n 'function'\n ) {\n // we only accept calling functions on the proxy, not accessing properties\n return undefined;\n }\n this.push_(property);\n return this.pushMethodArgs_;\n },\n set: (target, property, value) => {\n this.push_(property, value);\n return true;\n },\n })\n );\n }\n\n /**\n * @param {...*} args Arguments to push to the instructions array.\n * @private\n */\n push_(...args) {\n const instructions = this.instructions_;\n const index = this.zIndex + this.offset_;\n if (!instructions[index]) {\n instructions[index] = [];\n }\n instructions[index].push(...args);\n }\n\n /**\n * @private\n * @param {...*} args Args.\n * @return {ZIndexContext} This.\n */\n pushMethodArgs_ = (...args) => {\n this.push_(args);\n return this;\n };\n\n /**\n * Push a function that renders to the context directly.\n * @param {function(CanvasRenderingContext2D): void} render Function.\n */\n pushFunction(render) {\n this.push_(render);\n }\n\n /**\n * Get a proxy for CanvasRenderingContext2D which does not support getting state\n * (e.g. `context.globalAlpha`, which will return `undefined`). To set state, if it relies on a\n * previous state (e.g. `context.globalAlpha = context.globalAlpha / 2`), set a function,\n * e.g. `context.globalAlpha = (context) => context.globalAlpha / 2`.\n * @return {ZIndexContextProxy} Context.\n */\n getContext() {\n return this.context_;\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n */\n draw(context) {\n this.instructions_.forEach((instructionsAtIndex) => {\n for (let i = 0, ii = instructionsAtIndex.length; i < ii; ++i) {\n const property = instructionsAtIndex[i];\n if (typeof property === 'function') {\n property(context);\n continue;\n }\n const instructionAtIndex = instructionsAtIndex[++i];\n if (typeof (/** @type {*} */ (context)[property]) === 'function') {\n /** @type {*} */ (context)[property](...instructionAtIndex);\n } else {\n if (typeof instructionAtIndex === 'function') {\n /** @type {*} */ (context)[property] = instructionAtIndex(context);\n continue;\n }\n /** @type {*} */ (context)[property] = instructionAtIndex;\n }\n }\n });\n }\n\n clear() {\n this.instructions_.length = 0;\n this.zIndex = 0;\n this.offset_ = 0;\n }\n\n /**\n * Offsets the zIndex by the highest current zIndex. Useful for rendering multiple worlds or tiles, to\n * avoid conflicting context.clip() or context.save()/restore() calls.\n */\n offset() {\n this.offset_ = this.instructions_.length;\n this.zIndex = 0;\n }\n}\n\nexport default ZIndexContext;\n","/**\n * @module ol/renderer/Layer\n */\nimport ImageState from '../ImageState.js';\nimport Observable from '../Observable.js';\nimport EventType from '../events/EventType.js';\nimport {abstract} from '../util.js';\n\nconst maxStaleKeys = 5;\n\n/**\n * @template {import(\"../layer/Layer.js\").default} LayerType\n */\nclass LayerRenderer extends Observable {\n /**\n * @param {LayerType} layer Layer.\n */\n constructor(layer) {\n super();\n\n /**\n * The renderer is initialized and ready to render.\n * @type {boolean}\n */\n this.ready = true;\n\n /** @private */\n this.boundHandleImageChange_ = this.handleImageChange_.bind(this);\n\n /**\n * @private\n * @type {LayerType}\n */\n this.layer_ = layer;\n\n /**\n * @type {Array<string>}\n * @private\n */\n this.staleKeys_ = new Array();\n\n /**\n * @type {number}\n * @protected\n */\n this.maxStaleKeys = maxStaleKeys;\n }\n\n /**\n * @return {Array<string>} Get the list of stale keys.\n */\n getStaleKeys() {\n return this.staleKeys_;\n }\n\n /**\n * @param {string} key The new stale key.\n */\n prependStaleKey(key) {\n this.staleKeys_.unshift(key);\n if (this.staleKeys_.length > this.maxStaleKeys) {\n this.staleKeys_.length = this.maxStaleKeys;\n }\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../Feature\").FeatureLike>>} Promise that resolves with\n * an array of features.\n */\n getFeatures(pixel) {\n return abstract();\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.\n */\n getData(pixel) {\n return null;\n }\n\n /**\n * Determine whether render should be called.\n * @abstract\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n */\n prepareFrame(frameState) {\n return abstract();\n }\n\n /**\n * Render the layer.\n * @abstract\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement|null} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n */\n renderFrame(frameState, target) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"./vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {Array<import(\"./Map.js\").HitMatch<T>>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n return undefined;\n }\n\n /**\n * @return {LayerType} Layer.\n */\n getLayer() {\n return this.layer_;\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n * @abstract\n */\n handleFontsChanged() {}\n\n /**\n * Handle changes in image state.\n * @param {import(\"../events/Event.js\").default} event Image change event.\n * @private\n */\n handleImageChange_(event) {\n const image = /** @type {import(\"../Image.js\").default} */ (event.target);\n if (\n image.getState() === ImageState.LOADED ||\n image.getState() === ImageState.ERROR\n ) {\n this.renderIfReadyAndVisible();\n }\n }\n\n /**\n * Load the image if not already loaded, and register the image change\n * listener if needed.\n * @param {import(\"../Image.js\").default} image Image.\n * @return {boolean} `true` if the image is already loaded, `false` otherwise.\n * @protected\n */\n loadImage(image) {\n let imageState = image.getState();\n if (imageState != ImageState.LOADED && imageState != ImageState.ERROR) {\n image.addEventListener(EventType.CHANGE, this.boundHandleImageChange_);\n }\n if (imageState == ImageState.IDLE) {\n image.load();\n imageState = image.getState();\n }\n return imageState == ImageState.LOADED;\n }\n\n /**\n * @protected\n */\n renderIfReadyAndVisible() {\n const layer = this.getLayer();\n if (layer && layer.getVisible() && layer.getSourceState() === 'ready') {\n layer.changed();\n }\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n renderDeferred(frameState) {}\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n delete this.layer_;\n super.disposeInternal();\n }\n}\n\nexport default LayerRenderer;\n","/**\n * @module ol/renderer/canvas/Layer\n */\nimport {equals} from '../../array.js';\nimport {asArray} from '../../color.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {\n getBottomLeft,\n getBottomRight,\n getHeight,\n getTopLeft,\n getTopRight,\n getWidth,\n} from '../../extent.js';\nimport RenderEvent from '../../render/Event.js';\nimport RenderEventType from '../../render/EventType.js';\nimport ZIndexContext from '../../render/canvas/ZIndexContext.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n create as createTransform,\n equivalent,\n makeInverse,\n toString as toTransformString,\n} from '../../transform.js';\nimport LayerRenderer from '../Layer.js';\n\n/**\n * @type {Array<HTMLCanvasElement>}\n */\nexport const canvasPool = [];\n\n/**\n * @type {CanvasRenderingContext2D}\n */\nlet pixelContext = null;\n\nfunction createPixelContext() {\n pixelContext = createCanvasContext2D(1, 1, undefined, {\n willReadFrequently: true,\n });\n}\n\n/**\n * @abstract\n * @template {import(\"../../layer/Layer.js\").default} LayerType\n * @extends {LayerRenderer<LayerType>}\n */\nclass CanvasLayerRenderer extends LayerRenderer {\n /**\n * @param {LayerType} layer Layer.\n */\n constructor(layer) {\n super(layer);\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.container = null;\n\n /**\n * @protected\n * @type {number}\n */\n this.renderedResolution;\n\n /**\n * A temporary transform. The values in this transform should only be used in a\n * function that sets the values.\n * @protected\n * @type {import(\"../../transform.js\").Transform}\n */\n this.tempTransform = createTransform();\n\n /**\n * The transform for rendered pixels to viewport CSS pixels. This transform must\n * be set when rendering a frame and may be used by other functions after rendering.\n * @protected\n * @type {import(\"../../transform.js\").Transform}\n */\n this.pixelTransform = createTransform();\n\n /**\n * The transform for viewport CSS pixels to rendered pixels. This transform must\n * be set when rendering a frame and may be used by other functions after rendering.\n * @protected\n * @type {import(\"../../transform.js\").Transform}\n */\n this.inversePixelTransform = createTransform();\n\n /**\n * @type {CanvasRenderingContext2D}\n */\n this.context = null;\n\n /**\n * @private\n * @type {ZIndexContext}\n */\n this.deferredContext_ = null;\n\n /**\n * @type {boolean}\n */\n this.containerReused = false;\n\n /**\n * @protected\n * @type {import(\"../../Map.js\").FrameState|null}\n */\n this.frameState = null;\n }\n\n /**\n * @param {import('../../DataTile.js').ImageLike} image Image.\n * @param {number} col The column index.\n * @param {number} row The row index.\n * @return {Uint8ClampedArray|null} The image data.\n */\n getImageData(image, col, row) {\n if (!pixelContext) {\n createPixelContext();\n }\n pixelContext.clearRect(0, 0, 1, 1);\n\n let data;\n try {\n pixelContext.drawImage(image, col, row, 1, 1, 0, 0, 1, 1);\n data = pixelContext.getImageData(0, 0, 1, 1).data;\n } catch {\n pixelContext = null;\n return null;\n }\n return data;\n }\n\n /**\n * @param {import('../../Map.js').FrameState} frameState Frame state.\n * @return {string} Background color.\n */\n getBackground(frameState) {\n const layer = this.getLayer();\n let background = layer.getBackground();\n if (typeof background === 'function') {\n background = background(frameState.viewState.resolution);\n }\n return background || undefined;\n }\n\n /**\n * Get a rendering container from an existing target, if compatible.\n * @param {HTMLElement} target Potential render target.\n * @param {string} transform CSS transform matrix.\n * @param {string} [backgroundColor] Background color.\n */\n useContainer(target, transform, backgroundColor) {\n const layerClassName = this.getLayer().getClassName();\n let container, context;\n if (\n target &&\n target.className === layerClassName &&\n (!backgroundColor ||\n (target &&\n target.style.backgroundColor &&\n equals(\n asArray(target.style.backgroundColor),\n asArray(backgroundColor),\n )))\n ) {\n const canvas = target.firstElementChild;\n if (canvas instanceof HTMLCanvasElement) {\n context = canvas.getContext('2d');\n }\n }\n if (context && equivalent(context.canvas.style.transform, transform)) {\n // Container of the previous layer renderer can be used.\n this.container = target;\n this.context = context;\n this.containerReused = true;\n } else if (this.containerReused) {\n // Previously reused container cannot be used any more.\n this.container = null;\n this.context = null;\n this.containerReused = false;\n } else if (this.container) {\n this.container.style.backgroundColor = null;\n }\n if (!this.container) {\n container = document.createElement('div');\n container.className = layerClassName;\n let style = container.style;\n style.position = 'absolute';\n style.width = '100%';\n style.height = '100%';\n context = createCanvasContext2D();\n const canvas = context.canvas;\n container.appendChild(canvas);\n style = canvas.style;\n style.position = 'absolute';\n style.left = '0';\n style.transformOrigin = 'top left';\n this.container = container;\n this.context = context;\n }\n if (\n !this.containerReused &&\n backgroundColor &&\n !this.container.style.backgroundColor\n ) {\n this.container.style.backgroundColor = backgroundColor;\n }\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../../extent.js\").Extent} extent Clip extent.\n * @protected\n */\n clipUnrotated(context, frameState, extent) {\n const topLeft = getTopLeft(extent);\n const topRight = getTopRight(extent);\n const bottomRight = getBottomRight(extent);\n const bottomLeft = getBottomLeft(extent);\n\n applyTransform(frameState.coordinateToPixelTransform, topLeft);\n applyTransform(frameState.coordinateToPixelTransform, topRight);\n applyTransform(frameState.coordinateToPixelTransform, bottomRight);\n applyTransform(frameState.coordinateToPixelTransform, bottomLeft);\n\n const inverted = this.inversePixelTransform;\n applyTransform(inverted, topLeft);\n applyTransform(inverted, topRight);\n applyTransform(inverted, bottomRight);\n applyTransform(inverted, bottomLeft);\n\n context.save();\n context.beginPath();\n context.moveTo(Math.round(topLeft[0]), Math.round(topLeft[1]));\n context.lineTo(Math.round(topRight[0]), Math.round(topRight[1]));\n context.lineTo(Math.round(bottomRight[0]), Math.round(bottomRight[1]));\n context.lineTo(Math.round(bottomLeft[0]), Math.round(bottomLeft[1]));\n context.clip();\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target that may be used to render content to.\n * @protected\n */\n prepareContainer(frameState, target) {\n const extent = frameState.extent;\n const resolution = frameState.viewState.resolution;\n const rotation = frameState.viewState.rotation;\n const pixelRatio = frameState.pixelRatio;\n const width = Math.round((getWidth(extent) / resolution) * pixelRatio);\n const height = Math.round((getHeight(extent) / resolution) * pixelRatio);\n // set forward and inverse pixel transforms\n composeTransform(\n this.pixelTransform,\n frameState.size[0] / 2,\n frameState.size[1] / 2,\n 1 / pixelRatio,\n 1 / pixelRatio,\n rotation,\n -width / 2,\n -height / 2,\n );\n makeInverse(this.inversePixelTransform, this.pixelTransform);\n\n const canvasTransform = toTransformString(this.pixelTransform);\n this.useContainer(target, canvasTransform, this.getBackground(frameState));\n\n if (!this.containerReused) {\n const canvas = this.context.canvas;\n if (canvas.width != width || canvas.height != height) {\n canvas.width = width;\n canvas.height = height;\n } else {\n this.context.clearRect(0, 0, width, height);\n }\n if (canvasTransform !== canvas.style.transform) {\n canvas.style.transform = canvasTransform;\n }\n }\n }\n\n /**\n * @param {import(\"../../render/EventType.js\").default} type Event type.\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @private\n */\n dispatchRenderEvent_(type, context, frameState) {\n const layer = this.getLayer();\n if (layer.hasListener(type)) {\n const event = new RenderEvent(\n type,\n this.inversePixelTransform,\n frameState,\n context,\n );\n layer.dispatchEvent(event);\n }\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n preRender(context, frameState) {\n this.frameState = frameState;\n if (frameState.declutter) {\n return;\n }\n this.dispatchRenderEvent_(RenderEventType.PRERENDER, context, frameState);\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n postRender(context, frameState) {\n if (frameState.declutter) {\n return;\n }\n this.dispatchRenderEvent_(RenderEventType.POSTRENDER, context, frameState);\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n renderDeferredInternal(frameState) {}\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {import('../../render/canvas/ZIndexContext.js').ZIndexContextProxy} Context.\n */\n getRenderContext(frameState) {\n if (frameState.declutter && !this.deferredContext_) {\n this.deferredContext_ = new ZIndexContext();\n }\n return frameState.declutter\n ? this.deferredContext_.getContext()\n : this.context;\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @override\n */\n renderDeferred(frameState) {\n if (!frameState.declutter) {\n return;\n }\n this.dispatchRenderEvent_(\n RenderEventType.PRERENDER,\n this.context,\n frameState,\n );\n if (frameState.declutter && this.deferredContext_) {\n this.deferredContext_.draw(this.context);\n this.deferredContext_.clear();\n }\n this.renderDeferredInternal(frameState);\n this.dispatchRenderEvent_(\n RenderEventType.POSTRENDER,\n this.context,\n frameState,\n );\n }\n\n /**\n * Creates a transform for rendering to an element that will be rotated after rendering.\n * @param {import(\"../../coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {number} pixelRatio Pixel ratio.\n * @param {number} width Width of the rendered element (in pixels).\n * @param {number} height Height of the rendered element (in pixels).\n * @param {number} offsetX Offset on the x-axis in view coordinates.\n * @protected\n * @return {!import(\"../../transform.js\").Transform} Transform.\n */\n getRenderTransform(\n center,\n resolution,\n rotation,\n pixelRatio,\n width,\n height,\n offsetX,\n ) {\n const dx1 = width / 2;\n const dy1 = height / 2;\n const sx = pixelRatio / resolution;\n const sy = -sx;\n const dx2 = -center[0] + offsetX;\n const dy2 = -center[1];\n return composeTransform(\n this.tempTransform,\n dx1,\n dy1,\n sx,\n sy,\n -rotation,\n dx2,\n dy2,\n );\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n delete this.frameState;\n super.disposeInternal();\n }\n}\n\nexport default CanvasLayerRenderer;\n","/**\n * @module ol/renderer/canvas/ImageLayer\n */\nimport ImageState from '../../ImageState.js';\nimport ViewHint from '../../ViewHint.js';\nimport {\n containsCoordinate,\n containsExtent,\n getHeight,\n getIntersection,\n getWidth,\n intersects as intersectsExtent,\n isEmpty,\n} from '../../extent.js';\nimport {fromUserExtent} from '../../proj.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n} from '../../transform.js';\nimport CanvasLayerRenderer from './Layer.js';\n\n/**\n * @classdesc\n * Canvas renderer for image layers.\n * @api\n */\nclass CanvasImageLayerRenderer extends CanvasLayerRenderer {\n /**\n * @param {import(\"../../layer/Image.js\").default} imageLayer Image layer.\n */\n constructor(imageLayer) {\n super(imageLayer);\n\n /**\n * @protected\n * @type {?import(\"../../Image.js\").default}\n */\n this.image = null;\n }\n\n /**\n * @return {import('../../DataTile.js').ImageLike} Image.\n */\n getImage() {\n return !this.image ? null : this.image.getImage();\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrame(frameState) {\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n const pixelRatio = frameState.pixelRatio;\n const viewState = frameState.viewState;\n const viewResolution = viewState.resolution;\n\n const imageSource = this.getLayer().getSource();\n\n const hints = frameState.viewHints;\n\n let renderedExtent = frameState.extent;\n if (layerState.extent !== undefined) {\n renderedExtent = getIntersection(\n renderedExtent,\n fromUserExtent(layerState.extent, viewState.projection),\n );\n }\n\n if (\n !hints[ViewHint.ANIMATING] &&\n !hints[ViewHint.INTERACTING] &&\n !isEmpty(renderedExtent)\n ) {\n if (imageSource) {\n const projection = viewState.projection;\n const image = imageSource.getImage(\n renderedExtent,\n viewResolution,\n pixelRatio,\n projection,\n );\n if (image) {\n if (this.loadImage(image)) {\n this.image = image;\n } else if (image.getState() === ImageState.EMPTY) {\n this.image = null;\n }\n }\n } else {\n this.image = null;\n }\n }\n\n return !!this.image;\n }\n\n /**\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray} Data at the pixel location.\n * @override\n */\n getData(pixel) {\n const frameState = this.frameState;\n if (!frameState) {\n return null;\n }\n\n const layer = this.getLayer();\n const coordinate = applyTransform(\n frameState.pixelToCoordinateTransform,\n pixel.slice(),\n );\n\n const layerExtent = layer.getExtent();\n if (layerExtent) {\n if (!containsCoordinate(layerExtent, coordinate)) {\n return null;\n }\n }\n\n const imageExtent = this.image.getExtent();\n const img = this.image.getImage();\n\n const imageMapWidth = getWidth(imageExtent);\n const col = Math.floor(\n img.width * ((coordinate[0] - imageExtent[0]) / imageMapWidth),\n );\n if (col < 0 || col >= img.width) {\n return null;\n }\n\n const imageMapHeight = getHeight(imageExtent);\n const row = Math.floor(\n img.height * ((imageExtent[3] - coordinate[1]) / imageMapHeight),\n );\n if (row < 0 || row >= img.height) {\n return null;\n }\n\n return this.getImageData(img, col, row);\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n renderFrame(frameState, target) {\n const image = this.image;\n const imageExtent = image.getExtent();\n const imageResolution = image.getResolution();\n const [imageResolutionX, imageResolutionY] = Array.isArray(imageResolution)\n ? imageResolution\n : [imageResolution, imageResolution];\n const imagePixelRatio = image.getPixelRatio();\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n const pixelRatio = frameState.pixelRatio;\n const viewState = frameState.viewState;\n const viewCenter = viewState.center;\n const viewResolution = viewState.resolution;\n const scaleX =\n (pixelRatio * imageResolutionX) / (viewResolution * imagePixelRatio);\n const scaleY =\n (pixelRatio * imageResolutionY) / (viewResolution * imagePixelRatio);\n\n this.prepareContainer(frameState, target);\n\n // desired dimensions of the canvas in pixels\n const width = this.context.canvas.width;\n const height = this.context.canvas.height;\n\n const context = this.getRenderContext(frameState);\n\n // clipped rendering if layer extent is set\n let clipped = false;\n let render = true;\n if (layerState.extent) {\n const layerExtent = fromUserExtent(\n layerState.extent,\n viewState.projection,\n );\n render = intersectsExtent(layerExtent, frameState.extent);\n clipped = render && !containsExtent(layerExtent, frameState.extent);\n if (clipped) {\n this.clipUnrotated(context, frameState, layerExtent);\n }\n }\n\n const img = image.getImage();\n\n const transform = composeTransform(\n this.tempTransform,\n width / 2,\n height / 2,\n scaleX,\n scaleY,\n 0,\n (imagePixelRatio * (imageExtent[0] - viewCenter[0])) / imageResolutionX,\n (imagePixelRatio * (viewCenter[1] - imageExtent[3])) / imageResolutionY,\n );\n\n this.renderedResolution = (imageResolutionY * pixelRatio) / imagePixelRatio;\n\n const dw = img.width * transform[0];\n const dh = img.height * transform[3];\n\n if (!this.getLayer().getSource().getInterpolate()) {\n context.imageSmoothingEnabled = false;\n }\n\n this.preRender(context, frameState);\n if (render && dw >= 0.5 && dh >= 0.5) {\n const dx = transform[4];\n const dy = transform[5];\n const opacity = layerState.opacity;\n if (opacity !== 1) {\n context.save();\n context.globalAlpha = opacity;\n }\n context.drawImage(img, 0, 0, +img.width, +img.height, dx, dy, dw, dh);\n if (opacity !== 1) {\n context.restore();\n }\n }\n this.postRender(this.context, frameState);\n\n if (clipped) {\n context.restore();\n }\n context.imageSmoothingEnabled = true;\n\n return this.container;\n }\n}\n\nexport default CanvasImageLayerRenderer;\n","/**\n * @module ol/layer/BaseImage\n */\nimport Layer from './Layer.js';\n\n/**\n * @template {import(\"../source/Image.js\").default} ImageSourceType\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use {@link import(\"../Map.js\").default#addLayer map.addLayer()}.\n * @property {ImageSourceType} [source] Source for this layer.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Server-rendered images that are available for arbitrary extents and\n * resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Image.js\").default} ImageSourceType\n * @template {import(\"../renderer/Layer.js\").default} RendererType\n * @extends {Layer<ImageSourceType, RendererType>}\n * @api\n */\nclass BaseImageLayer extends Layer {\n /**\n * @param {Options<ImageSourceType>} [options] Layer options.\n */\n constructor(options) {\n options = options ? options : {};\n super(options);\n }\n}\n\nexport default BaseImageLayer;\n","/**\n * @module ol/layer/Image\n */\nimport CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js';\nimport BaseImageLayer from './BaseImage.js';\n\n/**\n * @classdesc\n * Server-rendered images that are available for arbitrary extents and\n * resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Image.js\").default} ImageSourceType\n * @extends {BaseImageLayer<ImageSourceType, CanvasImageLayerRenderer>}\n * @api\n */\nclass ImageLayer extends BaseImageLayer {\n /**\n * @param {import(\"./BaseImage.js\").Options<ImageSourceType>} [options] Layer options.\n */\n constructor(options) {\n super(options);\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new CanvasImageLayerRenderer(this);\n }\n\n /**\n * Get data for a pixel location. A four element RGBA array will be returned. For requests outside the\n * layer extent, `null` will be returned. Data for an image can only be retrieved if the\n * source's `crossOrigin` property is set.\n *\n * ```js\n * // display layer data on every pointer move\n * map.on('pointermove', (event) => {\n * console.log(layer.getData(event.pixel));\n * });\n * ```\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.\n * @api\n * @override\n */\n getData(pixel) {\n return super.getData(pixel);\n }\n}\n\nexport default ImageLayer;\n","/**\n * @module ol/renderer/canvas/TileLayer\n */\nimport DataTile, {asImageLike} from '../../DataTile.js';\nimport ImageTile from '../../ImageTile.js';\nimport TileRange from '../../TileRange.js';\nimport TileState from '../../TileState.js';\nimport {ascending} from '../../array.js';\nimport {\n containsCoordinate,\n createEmpty,\n equals,\n getIntersection,\n getRotatedViewport,\n getTopLeft,\n intersects,\n} from '../../extent.js';\nimport {fromUserExtent} from '../../proj.js';\nimport ReprojTile from '../../reproj/Tile.js';\nimport {toSize} from '../../size.js';\nimport LRUCache from '../../structs/LRUCache.js';\nimport {createOrUpdate as createTileCoord, getKeyZXY} from '../../tilecoord.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n} from '../../transform.js';\nimport {getUid} from '../../util.js';\nimport CanvasLayerRenderer from './Layer.js';\n\n/**\n * @param {import(\"../../source/Tile.js\").default} source The tile source.\n * @param {string} sourceKey The source key.\n * @param {number} z The tile z level.\n * @param {number} x The tile x level.\n * @param {number} y The tile y level.\n * @return {string} The cache key.\n */\nfunction getCacheKey(source, sourceKey, z, x, y) {\n return `${getUid(source)},${sourceKey},${getKeyZXY(z, x, y)}`;\n}\n\n/**\n * @typedef {Object<number, Set<import(\"../../Tile.js\").default>>} TileLookup\n */\n\n/**\n * Add a tile to the lookup.\n * @param {TileLookup} tilesByZ Lookup of tiles by zoom level.\n * @param {import(\"../../Tile.js\").default} tile A tile.\n * @param {number} z The zoom level.\n * @return {boolean} The tile was added to the lookup.\n */\nfunction addTileToLookup(tilesByZ, tile, z) {\n if (!(z in tilesByZ)) {\n tilesByZ[z] = new Set([tile]);\n return true;\n }\n const set = tilesByZ[z];\n const existing = set.has(tile);\n if (!existing) {\n set.add(tile);\n }\n return !existing;\n}\n\n/**\n * Remove a tile from the lookup.\n * @param {TileLookup} tilesByZ Lookup of tiles by zoom level.\n * @param {import(\"../../Tile.js\").default} tile A tile.\n * @param {number} z The zoom level.\n * @return {boolean} The tile was removed from the lookup.\n */\nfunction removeTileFromLookup(tilesByZ, tile, z) {\n const set = tilesByZ[z];\n if (set) {\n return set.delete(tile);\n }\n return false;\n}\n\n/**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../../extent.js\").Extent} extent The frame extent.\n * @return {import(\"../../extent.js\").Extent} Frame extent intersected with layer extents.\n */\nfunction getRenderExtent(frameState, extent) {\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n if (layerState.extent) {\n extent = getIntersection(\n extent,\n fromUserExtent(layerState.extent, frameState.viewState.projection),\n );\n }\n const source = /** @type {import(\"../../source/Tile.js\").default} */ (\n layerState.layer.getRenderSource()\n );\n if (!source.getWrapX()) {\n const gridExtent = source\n .getTileGridForProjection(frameState.viewState.projection)\n .getExtent();\n if (gridExtent) {\n extent = getIntersection(extent, gridExtent);\n }\n }\n return extent;\n}\n\n/**\n * @typedef {Object} Options\n * @property {number} [cacheSize=512] The cache size.\n */\n\n/**\n * @classdesc\n * Canvas renderer for tile layers.\n * @api\n * @template {import(\"../../layer/Tile.js\").default|import(\"../../layer/VectorTile.js\").default} [LayerType=import(\"../../layer/Tile.js\").default<import(\"../../source/Tile.js\").default>|import(\"../../layer/VectorTile.js\").default]\n * @extends {CanvasLayerRenderer<LayerType>}\n */\nclass CanvasTileLayerRenderer extends CanvasLayerRenderer {\n /**\n * @param {LayerType} tileLayer Tile layer.\n * @param {Options} [options] Options.\n */\n constructor(tileLayer, options) {\n super(tileLayer);\n\n options = options || {};\n\n /**\n * Rendered extent has changed since the previous `renderFrame()` call\n * @type {boolean}\n */\n this.extentChanged = true;\n\n /**\n * The last call to `renderFrame` was completed with all tiles loaded\n * @type {boolean}\n */\n this.renderComplete = false;\n\n /**\n * @private\n * @type {?import(\"../../extent.js\").Extent}\n */\n this.renderedExtent_ = null;\n\n /**\n * @protected\n * @type {number}\n */\n this.renderedPixelRatio;\n\n /**\n * @protected\n * @type {import(\"../../proj/Projection.js\").default|null}\n */\n this.renderedProjection = null;\n\n /**\n * @protected\n * @type {!Array<import(\"../../Tile.js\").default>}\n */\n this.renderedTiles = [];\n\n /**\n * @private\n * @type {string}\n */\n this.renderedSourceKey_;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedSourceRevision_;\n\n /**\n * @protected\n * @type {import(\"../../extent.js\").Extent}\n */\n this.tempExtent = createEmpty();\n\n /**\n * @private\n * @type {import(\"../../TileRange.js\").default}\n */\n this.tempTileRange_ = new TileRange(0, 0, 0, 0);\n\n /**\n * @type {import(\"../../tilecoord.js\").TileCoord}\n * @private\n */\n this.tempTileCoord_ = createTileCoord(0, 0, 0);\n\n const cacheSize = options.cacheSize !== undefined ? options.cacheSize : 512;\n\n /**\n * @type {import(\"../../structs/LRUCache.js\").default<import(\"../../Tile.js\").default>}\n * @private\n */\n this.tileCache_ = new LRUCache(cacheSize);\n\n this.maxStaleKeys = cacheSize * 0.5;\n }\n\n /**\n * @return {LRUCache} Tile cache.\n */\n getTileCache() {\n return this.tileCache_;\n }\n\n /**\n * Get a tile from the cache or create one if needed.\n *\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {import(\"../../Tile.js\").default|null} Tile (or null if outside source extent).\n * @protected\n */\n getOrCreateTile(z, x, y, frameState) {\n const tileCache = this.tileCache_;\n const tileLayer = this.getLayer();\n const tileSource = tileLayer.getSource();\n const cacheKey = getCacheKey(tileSource, tileSource.getKey(), z, x, y);\n\n /** @type {import(\"../../Tile.js\").default} */\n let tile;\n\n if (tileCache.containsKey(cacheKey)) {\n tile = tileCache.get(cacheKey);\n } else {\n tile = tileSource.getTile(\n z,\n x,\n y,\n frameState.pixelRatio,\n frameState.viewState.projection,\n );\n if (!tile) {\n return null;\n }\n tileCache.set(cacheKey, tile);\n }\n return tile;\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {import(\"../../Tile.js\").default|null} Tile (or null if outside source extent).\n * @protected\n */\n getTile(z, x, y, frameState) {\n const tile = this.getOrCreateTile(z, x, y, frameState);\n if (!tile) {\n return null;\n }\n return tile;\n }\n\n /**\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray} Data at the pixel location.\n * @override\n */\n getData(pixel) {\n const frameState = this.frameState;\n if (!frameState) {\n return null;\n }\n\n const layer = this.getLayer();\n const coordinate = applyTransform(\n frameState.pixelToCoordinateTransform,\n pixel.slice(),\n );\n\n const layerExtent = layer.getExtent();\n if (layerExtent) {\n if (!containsCoordinate(layerExtent, coordinate)) {\n return null;\n }\n }\n\n const viewState = frameState.viewState;\n const source = layer.getRenderSource();\n const tileGrid = source.getTileGridForProjection(viewState.projection);\n const tilePixelRatio = source.getTilePixelRatio(frameState.pixelRatio);\n\n for (\n let z = tileGrid.getZForResolution(viewState.resolution);\n z >= tileGrid.getMinZoom();\n --z\n ) {\n const tileCoord = tileGrid.getTileCoordForCoordAndZ(coordinate, z);\n const tile = this.getTile(z, tileCoord[1], tileCoord[2], frameState);\n if (!tile || tile.getState() !== TileState.LOADED) {\n continue;\n }\n\n const tileOrigin = tileGrid.getOrigin(z);\n const tileSize = toSize(tileGrid.getTileSize(z));\n const tileResolution = tileGrid.getResolution(z);\n\n /**\n * @type {import('../../DataTile.js').ImageLike}\n */\n let image;\n if (tile instanceof ImageTile || tile instanceof ReprojTile) {\n image = tile.getImage();\n } else if (tile instanceof DataTile) {\n image = asImageLike(tile.getData());\n if (!image) {\n continue;\n }\n } else {\n continue;\n }\n\n const col = Math.floor(\n tilePixelRatio *\n ((coordinate[0] - tileOrigin[0]) / tileResolution -\n tileCoord[1] * tileSize[0]),\n );\n\n const row = Math.floor(\n tilePixelRatio *\n ((tileOrigin[1] - coordinate[1]) / tileResolution -\n tileCoord[2] * tileSize[1]),\n );\n\n const gutter = Math.round(\n tilePixelRatio * source.getGutterForProjection(viewState.projection),\n );\n\n return this.getImageData(image, col + gutter, row + gutter);\n }\n\n return null;\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrame(frameState) {\n if (!this.renderedProjection) {\n this.renderedProjection = frameState.viewState.projection;\n } else if (frameState.viewState.projection !== this.renderedProjection) {\n this.tileCache_.clear();\n this.renderedProjection = frameState.viewState.projection;\n }\n\n const source = this.getLayer().getSource();\n if (!source) {\n return false;\n }\n const sourceRevision = source.getRevision();\n if (!this.renderedSourceRevision_) {\n this.renderedSourceRevision_ = sourceRevision;\n } else if (this.renderedSourceRevision_ !== sourceRevision) {\n this.renderedSourceRevision_ = sourceRevision;\n if (this.renderedSourceKey_ === source.getKey()) {\n this.tileCache_.clear();\n }\n }\n return true;\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../../extent.js\").Extent} extent The extent to be rendered.\n * @param {number} initialZ The zoom level.\n * @param {TileLookup} tilesByZ Lookup of tiles by zoom level.\n * @param {number} preload Number of additional levels to load.\n */\n enqueueTiles(frameState, extent, initialZ, tilesByZ, preload) {\n const viewState = frameState.viewState;\n const tileLayer = this.getLayer();\n const tileSource = tileLayer.getRenderSource();\n const tileGrid = tileSource.getTileGridForProjection(viewState.projection);\n\n const tileSourceKey = getUid(tileSource);\n if (!(tileSourceKey in frameState.wantedTiles)) {\n frameState.wantedTiles[tileSourceKey] = {};\n }\n\n const wantedTiles = frameState.wantedTiles[tileSourceKey];\n\n const map = tileLayer.getMapInternal();\n const minZ = Math.max(\n initialZ - preload,\n tileGrid.getMinZoom(),\n tileGrid.getZForResolution(\n Math.min(\n tileLayer.getMaxResolution(),\n map\n ? map\n .getView()\n .getResolutionForZoom(Math.max(tileLayer.getMinZoom(), 0))\n : tileGrid.getResolution(0),\n ),\n tileSource.zDirection,\n ),\n );\n const rotation = viewState.rotation;\n const viewport = rotation\n ? getRotatedViewport(\n viewState.center,\n viewState.resolution,\n rotation,\n frameState.size,\n )\n : undefined;\n for (let z = initialZ; z >= minZ; --z) {\n const tileRange = tileGrid.getTileRangeForExtentAndZ(\n extent,\n z,\n this.tempTileRange_,\n );\n\n const tileResolution = tileGrid.getResolution(z);\n\n for (let x = tileRange.minX; x <= tileRange.maxX; ++x) {\n for (let y = tileRange.minY; y <= tileRange.maxY; ++y) {\n if (\n rotation &&\n !tileGrid.tileCoordIntersectsViewport([z, x, y], viewport)\n ) {\n continue;\n }\n const tile = this.getTile(z, x, y, frameState);\n if (!tile) {\n continue;\n }\n const added = addTileToLookup(tilesByZ, tile, z);\n if (!added) {\n continue;\n }\n\n const tileQueueKey = tile.getKey();\n wantedTiles[tileQueueKey] = true;\n\n if (tile.getState() === TileState.IDLE) {\n if (!frameState.tileQueue.isKeyQueued(tileQueueKey)) {\n const tileCoord = createTileCoord(z, x, y, this.tempTileCoord_);\n frameState.tileQueue.enqueue([\n tile,\n tileSourceKey,\n tileGrid.getTileCoordCenter(tileCoord),\n tileResolution,\n ]);\n }\n }\n }\n }\n }\n }\n\n /**\n * Look for tiles covering the provided tile coordinate at an alternate\n * zoom level. Loaded tiles will be added to the provided tile texture lookup.\n * @param {import(\"../../tilecoord.js\").TileCoord} tileCoord The target tile coordinate.\n * @param {TileLookup} tilesByZ Lookup of tiles by zoom level.\n * @return {boolean} The tile coordinate is covered by loaded tiles at the alternate zoom level.\n * @private\n */\n findStaleTile_(tileCoord, tilesByZ) {\n const tileCache = this.tileCache_;\n const z = tileCoord[0];\n const x = tileCoord[1];\n const y = tileCoord[2];\n const staleKeys = this.getStaleKeys();\n for (let i = 0; i < staleKeys.length; ++i) {\n const cacheKey = getCacheKey(\n this.getLayer().getSource(),\n staleKeys[i],\n z,\n x,\n y,\n );\n if (tileCache.containsKey(cacheKey)) {\n const tile = tileCache.peek(cacheKey);\n if (tile.getState() === TileState.LOADED) {\n tile.endTransition(getUid(this));\n addTileToLookup(tilesByZ, tile, z);\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Look for tiles covering the provided tile coordinate at an alternate\n * zoom level. Loaded tiles will be added to the provided tile texture lookup.\n * @param {import(\"../../tilegrid/TileGrid.js\").default} tileGrid The tile grid.\n * @param {import(\"../../tilecoord.js\").TileCoord} tileCoord The target tile coordinate.\n * @param {number} altZ The alternate zoom level.\n * @param {TileLookup} tilesByZ Lookup of tiles by zoom level.\n * @return {boolean} The tile coordinate is covered by loaded tiles at the alternate zoom level.\n * @private\n */\n findAltTiles_(tileGrid, tileCoord, altZ, tilesByZ) {\n const tileRange = tileGrid.getTileRangeForTileCoordAndZ(\n tileCoord,\n altZ,\n this.tempTileRange_,\n );\n\n if (!tileRange) {\n return false;\n }\n\n let covered = true;\n const tileCache = this.tileCache_;\n const source = this.getLayer().getRenderSource();\n const sourceKey = source.getKey();\n for (let x = tileRange.minX; x <= tileRange.maxX; ++x) {\n for (let y = tileRange.minY; y <= tileRange.maxY; ++y) {\n const cacheKey = getCacheKey(source, sourceKey, altZ, x, y);\n let loaded = false;\n if (tileCache.containsKey(cacheKey)) {\n const tile = tileCache.peek(cacheKey);\n if (tile.getState() === TileState.LOADED) {\n addTileToLookup(tilesByZ, tile, altZ);\n loaded = true;\n }\n }\n if (!loaded) {\n covered = false;\n }\n }\n }\n return covered;\n }\n\n /**\n * Render the layer.\n *\n * The frame rendering logic has three parts:\n *\n * 1. Enqueue tiles\n * 2. Find alt tiles for those that are not yet loaded\n * 3. Render loaded tiles\n *\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n renderFrame(frameState, target) {\n this.renderComplete = true;\n\n /**\n * TODO:\n * maybe skip transition when not fully opaque\n * decide if this.renderComplete is useful\n */\n\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n const viewState = frameState.viewState;\n const projection = viewState.projection;\n const viewResolution = viewState.resolution;\n const viewCenter = viewState.center;\n const pixelRatio = frameState.pixelRatio;\n\n const tileLayer = this.getLayer();\n const tileSource = tileLayer.getSource();\n const tileGrid = tileSource.getTileGridForProjection(projection);\n const z = tileGrid.getZForResolution(viewResolution, tileSource.zDirection);\n const tileResolution = tileGrid.getResolution(z);\n\n const sourceKey = tileSource.getKey();\n if (!this.renderedSourceKey_) {\n this.renderedSourceKey_ = sourceKey;\n } else if (this.renderedSourceKey_ !== sourceKey) {\n this.prependStaleKey(this.renderedSourceKey_);\n this.renderedSourceKey_ = sourceKey;\n }\n\n let frameExtent = frameState.extent;\n const tilePixelRatio = tileSource.getTilePixelRatio(pixelRatio);\n\n this.prepareContainer(frameState, target);\n\n // desired dimensions of the canvas in pixels\n const width = this.context.canvas.width;\n const height = this.context.canvas.height;\n\n const layerExtent =\n layerState.extent && fromUserExtent(layerState.extent, projection);\n if (layerExtent) {\n frameExtent = getIntersection(\n frameExtent,\n fromUserExtent(layerState.extent, projection),\n );\n }\n\n const dx = (tileResolution * width) / 2 / tilePixelRatio;\n const dy = (tileResolution * height) / 2 / tilePixelRatio;\n const canvasExtent = [\n viewCenter[0] - dx,\n viewCenter[1] - dy,\n viewCenter[0] + dx,\n viewCenter[1] + dy,\n ];\n\n /**\n * @type {TileLookup}\n */\n const tilesByZ = {};\n\n this.renderedTiles.length = 0;\n\n /**\n * Part 1: Enqueue tiles\n */\n\n const preload = tileLayer.getPreload();\n if (frameState.nextExtent) {\n const targetZ = tileGrid.getZForResolution(\n viewState.nextResolution,\n tileSource.zDirection,\n );\n const nextExtent = getRenderExtent(frameState, frameState.nextExtent);\n this.enqueueTiles(frameState, nextExtent, targetZ, tilesByZ, preload);\n }\n\n const renderExtent = getRenderExtent(frameState, frameExtent);\n this.enqueueTiles(frameState, renderExtent, z, tilesByZ, 0);\n if (preload > 0) {\n setTimeout(() => {\n this.enqueueTiles(\n frameState,\n renderExtent,\n z - 1,\n tilesByZ,\n preload - 1,\n );\n }, 0);\n }\n\n if (!(z in tilesByZ)) {\n return this.container;\n }\n\n /**\n * Part 2: Find alt tiles for those that are not yet loaded\n */\n\n const uid = getUid(this);\n const time = frameState.time;\n\n // look for cached tiles to use if a target tile is not ready\n for (const tile of tilesByZ[z]) {\n const tileState = tile.getState();\n if (tileState === TileState.EMPTY) {\n continue;\n }\n const tileCoord = tile.tileCoord;\n\n if (tileState === TileState.LOADED) {\n const alpha = tile.getAlpha(uid, time);\n if (alpha === 1) {\n // no need to look for alt tiles\n tile.endTransition(uid);\n continue;\n }\n }\n if (tileState !== TileState.ERROR) {\n this.renderComplete = false;\n }\n\n const hasStaleTile = this.findStaleTile_(tileCoord, tilesByZ);\n if (hasStaleTile) {\n // use the stale tile before the new tile's transition has completed\n removeTileFromLookup(tilesByZ, tile, z);\n frameState.animate = true;\n continue;\n }\n\n // first look for child tiles (at z + 1)\n const coveredByChildren = this.findAltTiles_(\n tileGrid,\n tileCoord,\n z + 1,\n tilesByZ,\n );\n\n if (coveredByChildren) {\n continue;\n }\n\n // next look for parent tiles\n const minZoom = tileGrid.getMinZoom();\n for (let parentZ = z - 1; parentZ >= minZoom; --parentZ) {\n const coveredByParent = this.findAltTiles_(\n tileGrid,\n tileCoord,\n parentZ,\n tilesByZ,\n );\n\n if (coveredByParent) {\n break;\n }\n }\n }\n\n /**\n * Part 3: Render loaded tiles\n */\n\n const canvasScale =\n ((tileResolution / viewResolution) * pixelRatio) / tilePixelRatio;\n\n const context = this.getRenderContext(frameState);\n\n // set scale transform for calculating tile positions on the canvas\n composeTransform(\n this.tempTransform,\n width / 2,\n height / 2,\n canvasScale,\n canvasScale,\n 0,\n -width / 2,\n -height / 2,\n );\n\n if (layerState.extent) {\n this.clipUnrotated(context, frameState, layerExtent);\n }\n\n if (!tileSource.getInterpolate()) {\n context.imageSmoothingEnabled = false;\n }\n\n this.preRender(context, frameState);\n\n /** @type {Array<number>} */\n const zs = Object.keys(tilesByZ).map(Number);\n zs.sort(ascending);\n\n let currentClip;\n const clips = [];\n const clipZs = [];\n for (let i = zs.length - 1; i >= 0; --i) {\n const currentZ = zs[i];\n const currentTilePixelSize = tileSource.getTilePixelSize(\n currentZ,\n pixelRatio,\n projection,\n );\n const currentResolution = tileGrid.getResolution(currentZ);\n const currentScale = currentResolution / tileResolution;\n const dx = currentTilePixelSize[0] * currentScale * canvasScale;\n const dy = currentTilePixelSize[1] * currentScale * canvasScale;\n const originTileCoord = tileGrid.getTileCoordForCoordAndZ(\n getTopLeft(canvasExtent),\n currentZ,\n );\n const originTileExtent = tileGrid.getTileCoordExtent(originTileCoord);\n const origin = applyTransform(this.tempTransform, [\n (tilePixelRatio * (originTileExtent[0] - canvasExtent[0])) /\n tileResolution,\n (tilePixelRatio * (canvasExtent[3] - originTileExtent[3])) /\n tileResolution,\n ]);\n const tileGutter =\n tilePixelRatio * tileSource.getGutterForProjection(projection);\n for (const tile of tilesByZ[currentZ]) {\n if (tile.getState() !== TileState.LOADED) {\n continue;\n }\n const tileCoord = tile.tileCoord;\n\n // Calculate integer positions and sizes so that tiles align\n const xIndex = originTileCoord[1] - tileCoord[1];\n const nextX = Math.round(origin[0] - (xIndex - 1) * dx);\n const yIndex = originTileCoord[2] - tileCoord[2];\n const nextY = Math.round(origin[1] - (yIndex - 1) * dy);\n const x = Math.round(origin[0] - xIndex * dx);\n const y = Math.round(origin[1] - yIndex * dy);\n const w = nextX - x;\n const h = nextY - y;\n const transition = zs.length === 1;\n\n let contextSaved = false;\n\n // Clip mask for regions in this tile that already filled by a higher z tile\n currentClip = [x, y, x + w, y, x + w, y + h, x, y + h];\n for (let i = 0, ii = clips.length; i < ii; ++i) {\n if (!transition && currentZ < clipZs[i]) {\n const clip = clips[i];\n if (\n intersects(\n [x, y, x + w, y + h],\n [clip[0], clip[3], clip[4], clip[7]],\n )\n ) {\n if (!contextSaved) {\n context.save();\n contextSaved = true;\n }\n context.beginPath();\n // counter-clockwise (outer ring) for current tile\n context.moveTo(currentClip[0], currentClip[1]);\n context.lineTo(currentClip[2], currentClip[3]);\n context.lineTo(currentClip[4], currentClip[5]);\n context.lineTo(currentClip[6], currentClip[7]);\n // clockwise (inner ring) for higher z tile\n context.moveTo(clip[6], clip[7]);\n context.lineTo(clip[4], clip[5]);\n context.lineTo(clip[2], clip[3]);\n context.lineTo(clip[0], clip[1]);\n context.clip();\n }\n }\n }\n clips.push(currentClip);\n clipZs.push(currentZ);\n\n this.drawTile(tile, frameState, x, y, w, h, tileGutter, transition);\n if (contextSaved) {\n context.restore();\n }\n this.renderedTiles.unshift(tile);\n\n // TODO: decide if this is necessary\n this.updateUsedTiles(frameState.usedTiles, tileSource, tile);\n }\n }\n\n this.renderedResolution = tileResolution;\n this.extentChanged =\n !this.renderedExtent_ || !equals(this.renderedExtent_, canvasExtent);\n this.renderedExtent_ = canvasExtent;\n this.renderedPixelRatio = pixelRatio;\n\n this.postRender(this.context, frameState);\n\n if (layerState.extent) {\n context.restore();\n }\n context.imageSmoothingEnabled = true;\n\n if (this.renderComplete) {\n /**\n * @param {import(\"../../Map.js\").default} map Map.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n const postRenderFunction = (map, frameState) => {\n const tileSourceKey = getUid(tileSource);\n const wantedTiles = frameState.wantedTiles[tileSourceKey];\n const tilesCount = wantedTiles ? Object.keys(wantedTiles).length : 0;\n this.updateCacheSize(tilesCount);\n this.tileCache_.expireCache();\n };\n\n frameState.postRenderFunctions.push(postRenderFunction);\n }\n\n return this.container;\n }\n\n /**\n * Increases the cache size if needed\n * @param {number} tileCount Minimum number of tiles needed.\n */\n updateCacheSize(tileCount) {\n this.tileCache_.highWaterMark = Math.max(\n this.tileCache_.highWaterMark,\n tileCount * 2,\n );\n }\n\n /**\n * @param {import(\"../../Tile.js\").default} tile Tile.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} x Left of the tile.\n * @param {number} y Top of the tile.\n * @param {number} w Width of the tile.\n * @param {number} h Height of the tile.\n * @param {number} gutter Tile gutter.\n * @param {boolean} transition Apply an alpha transition.\n * @protected\n */\n drawTile(tile, frameState, x, y, w, h, gutter, transition) {\n let image;\n if (tile instanceof DataTile) {\n image = asImageLike(tile.getData());\n if (!image) {\n throw new Error('Rendering array data is not yet supported');\n }\n } else {\n image = this.getTileImage(\n /** @type {import(\"../../ImageTile.js\").default} */ (tile),\n );\n }\n if (!image) {\n return;\n }\n const context = this.getRenderContext(frameState);\n const uid = getUid(this);\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n const alpha =\n layerState.opacity *\n (transition ? tile.getAlpha(uid, frameState.time) : 1);\n const alphaChanged = alpha !== context.globalAlpha;\n if (alphaChanged) {\n context.save();\n context.globalAlpha = alpha;\n }\n context.drawImage(\n image,\n gutter,\n gutter,\n image.width - 2 * gutter,\n image.height - 2 * gutter,\n x,\n y,\n w,\n h,\n );\n\n if (alphaChanged) {\n context.restore();\n }\n if (alpha !== layerState.opacity) {\n frameState.animate = true;\n } else if (transition) {\n tile.endTransition(uid);\n }\n }\n\n /**\n * @return {HTMLCanvasElement} Image\n */\n getImage() {\n const context = this.context;\n return context ? context.canvas : null;\n }\n\n /**\n * Get the image from a tile.\n * @param {import(\"../../ImageTile.js\").default} tile Tile.\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @protected\n */\n getTileImage(tile) {\n return tile.getImage();\n }\n\n /**\n * @param {!Object<string, !Object<string, boolean>>} usedTiles Used tiles.\n * @param {import(\"../../source/Tile.js\").default} tileSource Tile source.\n * @param {import('../../Tile.js').default} tile Tile.\n * @protected\n */\n updateUsedTiles(usedTiles, tileSource, tile) {\n // FIXME should we use tilesToDrawByZ instead?\n const tileSourceKey = getUid(tileSource);\n if (!(tileSourceKey in usedTiles)) {\n usedTiles[tileSourceKey] = {};\n }\n usedTiles[tileSourceKey][tile.getKey()] = true;\n }\n}\n\nexport default CanvasTileLayerRenderer;\n","/**\n * @module ol/layer/TileProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n PRELOAD: 'preload',\n USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError',\n};\n","/**\n * @module ol/layer/BaseTile\n */\nimport Layer from './Layer.js';\nimport TileProperty from './TileProperty.js';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"./Base\").BaseLayerObjectEventTypes|\n * import(\"./Layer.js\").LayerEventType|'change:preload'|'change:useInterimTilesOnError', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<import(\"../render/EventType\").LayerRenderEventTypes, import(\"../render/Event\").default, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"./Base\").BaseLayerObjectEventTypes|\n * import(\"./Layer.js\").LayerEventType|'change:preload'|'change:useInterimTilesOnError'|import(\"../render/EventType\").LayerRenderEventTypes, Return>} BaseTileLayerOnSignature\n */\n\n/**\n * @template {import(\"../source/Tile.js\").default} TileSourceType\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`\n * means no preloading.\n * @property {TileSourceType} [source] Source for this layer.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use {@link import(\"../Map.js\").default#addLayer map.addLayer()}.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {boolean} [useInterimTilesOnError=true] Deprecated. Use interim tiles on error.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n * @property {number} [cacheSize=512] The internal tile cache size. This needs to be large enough to render\n * two zoom levels worth of tiles.\n */\n\n/**\n * @classdesc\n * For layer sources that provide pre-rendered, tiled images in grids that are\n * organized by zoom levels for specific resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Tile.js\").default} TileSourceType\n * @template {import(\"../renderer/Layer.js\").default} RendererType\n * @extends {Layer<TileSourceType, RendererType>}\n * @api\n */\nclass BaseTileLayer extends Layer {\n /**\n * @param {Options<TileSourceType>} [options] Tile layer options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign({}, options);\n\n const cacheSize = options.cacheSize;\n delete options.cacheSize;\n\n delete baseOptions.preload;\n delete baseOptions.useInterimTilesOnError;\n super(baseOptions);\n\n /***\n * @type {BaseTileLayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {BaseTileLayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {BaseTileLayerOnSignature<void>}\n */\n this.un;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.cacheSize_ = cacheSize;\n\n this.setPreload(options.preload !== undefined ? options.preload : 0);\n this.setUseInterimTilesOnError(\n options.useInterimTilesOnError !== undefined\n ? options.useInterimTilesOnError\n : true,\n );\n }\n\n /**\n * @return {number|undefined} The suggested cache size\n * @protected\n */\n getCacheSize() {\n return this.cacheSize_;\n }\n\n /**\n * Return the level as number to which we will preload tiles up to.\n * @return {number} The level to preload tiles up to.\n * @observable\n * @api\n */\n getPreload() {\n return /** @type {number} */ (this.get(TileProperty.PRELOAD));\n }\n\n /**\n * Set the level as number to which we will preload tiles up to.\n * @param {number} preload The level to preload tiles up to.\n * @observable\n * @api\n */\n setPreload(preload) {\n this.set(TileProperty.PRELOAD, preload);\n }\n\n /**\n * Deprecated. Whether we use interim tiles on error.\n * @return {boolean} Use interim tiles on error.\n * @observable\n * @api\n */\n getUseInterimTilesOnError() {\n return /** @type {boolean} */ (\n this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR)\n );\n }\n\n /**\n * Deprecated. Set whether we use interim tiles on error.\n * @param {boolean} useInterimTilesOnError Use interim tiles on error.\n * @observable\n * @api\n */\n setUseInterimTilesOnError(useInterimTilesOnError) {\n this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);\n }\n\n /**\n * Get data for a pixel location. The return type depends on the source data. For image tiles,\n * a four element RGBA array will be returned. For data tiles, the array length will match the\n * number of bands in the dataset. For requests outside the layer extent, `null` will be returned.\n * Data for a image tiles can only be retrieved if the source's `crossOrigin` property is set.\n *\n * ```js\n * // display layer data on every pointer move\n * map.on('pointermove', (event) => {\n * console.log(layer.getData(event.pixel));\n * });\n * ```\n * @param {import(\"../pixel\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.\n * @api\n * @override\n */\n getData(pixel) {\n return super.getData(pixel);\n }\n}\n\nexport default BaseTileLayer;\n","/**\n * @module ol/layer/Tile\n */\nimport CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js';\nimport BaseTileLayer from './BaseTile.js';\n\n/**\n * @classdesc\n * For layer sources that provide pre-rendered, tiled images in grids that are\n * organized by zoom levels for specific resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Tile.js\").default} [TileSourceType=import(\"../source/Tile.js\").default]\n * @extends BaseTileLayer<TileSourceType, CanvasTileLayerRenderer>\n * @api\n */\nclass TileLayer extends BaseTileLayer {\n /**\n * @param {import(\"./BaseTile.js\").Options<TileSourceType>} [options] Tile layer options.\n */\n constructor(options) {\n super(options);\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new CanvasTileLayerRenderer(this, {\n cacheSize: this.getCacheSize(),\n });\n }\n}\n\nexport default TileLayer;\n","/**\n * @module ol/source/Raster\n */\nimport Disposable from '../Disposable.js';\nimport ImageCanvas from '../ImageCanvas.js';\nimport TileQueue from '../TileQueue.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {equals, getCenter, getHeight, getWidth} from '../extent.js';\nimport ImageLayer from '../layer/Image.js';\nimport TileLayer from '../layer/Tile.js';\nimport {create as createTransform} from '../transform.js';\nimport {getUid} from '../util.js';\nimport ImageSource from './Image.js';\nimport Source from './Source.js';\nimport TileSource from './Tile.js';\n\n/**\n * @typedef {Object} MinionData\n * @property {Array<ArrayBuffer>} buffers Array of buffers.\n * @property {Object} meta Operation metadata.\n * @property {boolean} imageOps The operation is an image operation.\n * @property {number} width The width of the image.\n * @property {number} height The height of the image.\n */\n\n/* istanbul ignore next */\n/**\n * Create a function for running operations. This function is serialized for\n * use in a worker.\n * @param {function(Array, Object):*} operation The operation.\n * @return {function(MinionData):ArrayBuffer} A function that takes an object with\n * buffers, meta, imageOps, width, and height properties and returns an array\n * buffer.\n */\nfunction createMinion(operation) {\n return function (data) {\n // bracket notation for minification support\n const buffers = data['buffers'];\n const meta = data['meta'];\n const imageOps = data['imageOps'];\n const width = data['width'];\n const height = data['height'];\n\n const numBuffers = buffers.length;\n const numBytes = buffers[0].byteLength;\n\n if (imageOps) {\n const images = new Array(numBuffers);\n for (let b = 0; b < numBuffers; ++b) {\n images[b] = new ImageData(\n new Uint8ClampedArray(buffers[b]),\n width,\n height,\n );\n }\n const output = operation(images, meta).data;\n return output.buffer;\n }\n\n const output = new Uint8ClampedArray(numBytes);\n const arrays = new Array(numBuffers);\n const pixels = new Array(numBuffers);\n for (let b = 0; b < numBuffers; ++b) {\n arrays[b] = new Uint8ClampedArray(buffers[b]);\n pixels[b] = [0, 0, 0, 0];\n }\n for (let i = 0; i < numBytes; i += 4) {\n for (let j = 0; j < numBuffers; ++j) {\n const array = arrays[j];\n pixels[j][0] = array[i];\n pixels[j][1] = array[i + 1];\n pixels[j][2] = array[i + 2];\n pixels[j][3] = array[i + 3];\n }\n const pixel = operation(pixels, meta);\n output[i] = pixel[0];\n output[i + 1] = pixel[1];\n output[i + 2] = pixel[2];\n output[i + 3] = pixel[3];\n }\n return output.buffer;\n };\n}\n\n/**\n * Create a worker for running operations.\n * @param {ProcessorOptions} config Processor options.\n * @param {function(MessageEvent): void} onMessage Called with a message event.\n * @return {Worker} The worker.\n */\nfunction createWorker(config, onMessage) {\n const lib = Object.keys(config.lib || {}).map(function (name) {\n return 'const ' + name + ' = ' + config.lib[name].toString() + ';';\n });\n\n const lines = lib.concat([\n 'const __minion__ = (' + createMinion.toString() + ')(',\n config.operation.toString(),\n ');',\n 'self.addEventListener(\"message\", function(event) {',\n ' const buffer = __minion__(event.data);',\n ' self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);',\n '});',\n ]);\n\n const worker = new Worker(\n typeof Blob === 'undefined'\n ? 'data:text/javascript;base64,' +\n Buffer.from(lines.join('\\n'), 'binary').toString('base64')\n : URL.createObjectURL(new Blob(lines, {type: 'text/javascript'})),\n );\n worker.addEventListener('message', onMessage);\n return worker;\n}\n\n/**\n * @typedef {Object} FauxMessageEvent\n * @property {Object} data Message data.\n */\n\n/**\n * Create a faux worker for running operations.\n * @param {ProcessorOptions} config Configuration.\n * @param {function(FauxMessageEvent): void} onMessage Called with a message event.\n * @return {Object} The faux worker.\n */\nfunction createFauxWorker(config, onMessage) {\n const minion = createMinion(config.operation);\n let terminated = false;\n return {\n postMessage: function (data) {\n setTimeout(function () {\n if (terminated) {\n return;\n }\n onMessage({data: {buffer: minion(data), meta: data['meta']}});\n }, 0);\n },\n terminate: function () {\n terminated = true;\n },\n };\n}\n\n/**\n * @typedef {function(Error, ImageData, (Object|Array<Object>)): void} JobCallback\n */\n\n/**\n * @typedef {Object} Job\n * @property {Object} meta Job metadata.\n * @property {Array<ImageData>} inputs Array of input data.\n * @property {JobCallback} callback Called when the job is complete.\n */\n\n/**\n * @typedef {Object} ProcessorOptions\n * @property {number} threads Number of workers to spawn.\n * @property {Operation} operation The operation.\n * @property {Object<string, Function>} [lib] Functions that will be made available to operations run in a worker.\n * @property {number} queue The number of queued jobs to allow.\n * @property {boolean} [imageOps=false] Pass all the image data to the operation instead of a single pixel.\n */\n\n/**\n * @classdesc\n * A processor runs pixel or image operations in workers.\n */\nexport class Processor extends Disposable {\n /**\n * @param {ProcessorOptions} config Configuration.\n */\n constructor(config) {\n super();\n\n /**\n * @type {boolean}\n * @private\n */\n this.imageOps_ = !!config.imageOps;\n let threads;\n if (config.threads === 0) {\n threads = 0;\n } else if (this.imageOps_) {\n threads = 1;\n } else {\n threads = config.threads || 1;\n }\n\n /**\n * @type {Array<Worker>}\n */\n const workers = new Array(threads);\n if (threads) {\n for (let i = 0; i < threads; ++i) {\n workers[i] = createWorker(config, this.onWorkerMessage_.bind(this, i));\n }\n } else {\n workers[0] = createFauxWorker(\n config,\n this.onWorkerMessage_.bind(this, 0),\n );\n }\n /**\n * @type {Array<Worker>}\n * @private\n */\n this.workers_ = workers;\n\n /**\n * @type {Array<Job>}\n * @private\n */\n this.queue_ = [];\n\n /**\n * @type {number}\n * @private\n */\n this.maxQueueLength_ = config.queue || Infinity;\n /**\n * @type {number}\n * @private\n */\n this.running_ = 0;\n\n /**\n * @type {Object<number, any>}\n * @private\n */\n this.dataLookup_ = {};\n\n /**\n * @type {Job|null}\n * @private\n */\n this.job_ = null;\n }\n\n /**\n * Run operation on input data.\n * @param {Array<ImageData>} inputs Array of image data.\n * @param {Object} meta A user data object. This is passed to all operations\n * and must be serializable.\n * @param {function(Error, ImageData, Object): void} callback Called when work\n * completes. The first argument is any error. The second is the ImageData\n * generated by operations. The third is the user data object.\n */\n process(inputs, meta, callback) {\n this.enqueue_({\n inputs: inputs,\n meta: meta,\n callback: callback,\n });\n this.dispatch_();\n }\n\n /**\n * Add a job to the queue.\n * @param {Job} job The job.\n */\n enqueue_(job) {\n this.queue_.push(job);\n while (this.queue_.length > this.maxQueueLength_) {\n this.queue_.shift().callback(null, null);\n }\n }\n\n /**\n * Dispatch a job.\n */\n dispatch_() {\n if (this.running_ || this.queue_.length === 0) {\n return;\n }\n\n const job = this.queue_.shift();\n this.job_ = job;\n const width = job.inputs[0].width;\n const height = job.inputs[0].height;\n const buffers = job.inputs.map(function (input) {\n return input.data.buffer;\n });\n const threads = this.workers_.length;\n this.running_ = threads;\n if (threads === 1) {\n this.workers_[0].postMessage(\n {\n buffers: buffers,\n meta: job.meta,\n imageOps: this.imageOps_,\n width: width,\n height: height,\n },\n buffers,\n );\n return;\n }\n\n const length = job.inputs[0].data.length;\n const segmentLength = 4 * Math.ceil(length / 4 / threads);\n for (let i = 0; i < threads; ++i) {\n const offset = i * segmentLength;\n const slices = [];\n for (let j = 0, jj = buffers.length; j < jj; ++j) {\n slices.push(buffers[j].slice(offset, offset + segmentLength));\n }\n this.workers_[i].postMessage(\n {\n buffers: slices,\n meta: job.meta,\n imageOps: this.imageOps_,\n width: width,\n height: height,\n },\n slices,\n );\n }\n }\n\n /**\n * Handle messages from the worker.\n * @param {number} index The worker index.\n * @param {MessageEvent} event The message event.\n */\n onWorkerMessage_(index, event) {\n if (this.disposed) {\n return;\n }\n this.dataLookup_[index] = event.data;\n --this.running_;\n if (this.running_ === 0) {\n this.resolveJob_();\n }\n }\n\n /**\n * Resolve a job. If there are no more worker threads, the processor callback\n * will be called.\n */\n resolveJob_() {\n const job = this.job_;\n const threads = this.workers_.length;\n let data, meta;\n if (threads === 1) {\n data = new Uint8ClampedArray(this.dataLookup_[0]['buffer']);\n meta = this.dataLookup_[0]['meta'];\n } else {\n const length = job.inputs[0].data.length;\n data = new Uint8ClampedArray(length);\n meta = new Array(threads);\n const segmentLength = 4 * Math.ceil(length / 4 / threads);\n for (let i = 0; i < threads; ++i) {\n const buffer = this.dataLookup_[i]['buffer'];\n const offset = i * segmentLength;\n data.set(new Uint8ClampedArray(buffer), offset);\n meta[i] = this.dataLookup_[i]['meta'];\n }\n }\n this.job_ = null;\n this.dataLookup_ = {};\n job.callback(\n null,\n new ImageData(data, job.inputs[0].width, job.inputs[0].height),\n meta,\n );\n this.dispatch_();\n }\n\n /**\n * Terminate all workers associated with the processor.\n * @override\n */\n disposeInternal() {\n for (let i = 0; i < this.workers_.length; ++i) {\n this.workers_[i].terminate();\n }\n this.workers_.length = 0;\n }\n}\n\n/**\n * A function that takes an array of input data, performs some operation, and\n * returns an array of output data.\n * For `pixel` type operations, the function will be called with an array of\n * pixels, where each pixel is an array of four numbers (`[r, g, b, a]`) in the\n * range of 0 - 255. It should return a single pixel array.\n * For `'image'` type operations, functions will be called with an array of\n * [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData)\n * and should return a single\n * [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData).\n * The operations\n * are called with a second \"data\" argument, which can be used for storage. The\n * data object is accessible from raster events, where it can be initialized in\n * \"beforeoperations\" and accessed again in \"afteroperations\".\n *\n * @typedef {function((Array<Array<number>>|Array<ImageData>), Object):\n * (Array<number>|ImageData)} Operation\n */\n\n/**\n * @enum {string}\n */\nconst RasterEventType = {\n /**\n * Triggered before operations are run. Listeners will receive an event object with\n * a `data` property that can be used to make data available to operations.\n * @event module:ol/source/Raster.RasterSourceEvent#beforeoperations\n * @api\n */\n BEFOREOPERATIONS: 'beforeoperations',\n\n /**\n * Triggered after operations are run. Listeners will receive an event object with\n * a `data` property. If more than one thread is used, `data` will be an array of\n * objects. If a single thread is used, `data` will be a single object.\n * @event module:ol/source/Raster.RasterSourceEvent#afteroperations\n * @api\n */\n AFTEROPERATIONS: 'afteroperations',\n};\n\n/**\n * @typedef {'pixel' | 'image'} RasterOperationType\n * Raster operation type. Supported values are `'pixel'` and `'image'`.\n */\n\n/**\n * @typedef {import(\"./Image.js\").ImageSourceEventTypes|'beforeoperations'|'afteroperations'} RasterSourceEventTypes\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/source/Raster~RasterSource} instances are instances of this\n * type.\n */\nexport class RasterSourceEvent extends Event {\n /**\n * @param {string} type Type.\n * @param {import(\"../Map.js\").FrameState} frameState The frame state.\n * @param {Object|Array<Object>} data An object made available to operations. For \"afteroperations\" evenets\n * this will be an array of objects if more than one thread is used.\n */\n constructor(type, frameState, data) {\n super(type);\n\n /**\n * The raster extent.\n * @type {import(\"../extent.js\").Extent}\n * @api\n */\n this.extent = frameState.extent;\n\n /**\n * The pixel resolution (map units per pixel).\n * @type {number}\n * @api\n */\n this.resolution = frameState.viewState.resolution / frameState.pixelRatio;\n\n /**\n * An object made available to all operations. This can be used by operations\n * as a storage object (e.g. for calculating statistics).\n * @type {Object}\n * @api\n */\n this.data = data;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {Array<import(\"./Source.js\").default|import(\"../layer/Layer.js\").default>} sources Input\n * sources or layers. For vector data, use an VectorImage layer.\n * @property {Operation} [operation] Raster operation.\n * The operation will be called with data from input sources\n * and the output will be assigned to the raster source.\n * @property {Object} [lib] Functions that will be made available to operations run in a worker.\n * @property {number} [threads] By default, operations will be run in a single worker thread.\n * To avoid using workers altogether, set `threads: 0`. For pixel operations, operations can\n * be run in multiple worker threads. Note that there is additional overhead in\n * transferring data to multiple workers, and that depending on the user's\n * system, it may not be possible to parallelize the work.\n * @property {RasterOperationType} [operationType='pixel'] Operation type.\n * Supported values are `'pixel'` and `'image'`. By default,\n * `'pixel'` operations are assumed, and operations will be called with an\n * array of pixels from input sources. If set to `'image'`, operations will\n * be called with an array of ImageData objects from input sources.\n * @property {Array<number>|null} [resolutions] Resolutions. If specified, raster operations will only\n * be run at the given resolutions. By default, the resolutions of the first source with resolutions\n * specified will be used, if any. Set to `null` to use any view resolution instead.\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<import(\"./Image.js\").ImageSourceEventTypes, import(\"./Image.js\").ImageSourceEvent, Return> &\n * import(\"../Observable\").OnSignature<RasterSourceEventTypes, RasterSourceEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types\n * |RasterSourceEventTypes, Return>} RasterSourceOnSignature\n */\n\n/**\n * @classdesc\n * A source that transforms data from any number of input sources using an\n * {@link module:ol/source/Raster~Operation} function to transform input pixel values into\n * output pixel values.\n *\n * @fires module:ol/source/Raster.RasterSourceEvent\n * @api\n */\nclass RasterSource extends ImageSource {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n super({\n projection: null,\n });\n\n /***\n * @type {RasterSourceOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {RasterSourceOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {RasterSourceOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {Processor}\n */\n this.processor_ = null;\n\n /**\n * @private\n * @type {RasterOperationType}\n */\n this.operationType_ =\n options.operationType !== undefined ? options.operationType : 'pixel';\n\n /**\n * @private\n * @type {number}\n */\n this.threads_ = options.threads !== undefined ? options.threads : 1;\n\n /**\n * @private\n * @type {Array<import(\"../layer/Layer.js\").default>}\n */\n this.layers_ = createLayers(options.sources);\n\n const changed = this.changed.bind(this);\n for (let i = 0, ii = this.layers_.length; i < ii; ++i) {\n this.layers_[i].addEventListener(EventType.CHANGE, changed);\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.useResolutions_ = options.resolutions !== null;\n\n /**\n * @private\n * @type {import(\"../TileQueue.js\").default}\n */\n this.tileQueue_ = new TileQueue(function () {\n return 1;\n }, this.processSources_.bind(this));\n\n /**\n * The most recently requested frame state.\n * @type {import(\"../Map.js\").FrameState}\n * @private\n */\n this.requestedFrameState_;\n\n /**\n * The most recently rendered image canvas.\n * @type {import(\"../ImageCanvas.js\").default}\n * @private\n */\n this.renderedImageCanvas_ = null;\n\n /**\n * The most recently rendered revision.\n * @type {number}\n * @private\n */\n this.renderedRevision_;\n\n /**\n * @private\n * @type {import(\"../Map.js\").FrameState}\n */\n this.frameState_ = {\n animate: false,\n coordinateToPixelTransform: createTransform(),\n declutter: null,\n extent: null,\n index: 0,\n layerIndex: 0,\n layerStatesArray: getLayerStatesArray(this.layers_),\n pixelRatio: 1,\n pixelToCoordinateTransform: createTransform(),\n postRenderFunctions: [],\n size: [0, 0],\n tileQueue: this.tileQueue_,\n time: Date.now(),\n usedTiles: {},\n viewState: /** @type {import(\"../View.js\").State} */ ({\n rotation: 0,\n }),\n viewHints: [],\n wantedTiles: {},\n mapId: getUid(this),\n renderTargets: {},\n };\n\n this.setAttributions(function (frameState) {\n /** @type {Array<string>} */\n const attributions = [];\n for (let i = 0, iMax = options.sources.length; i < iMax; ++i) {\n const sourceOrLayer = options.sources[i];\n const source =\n sourceOrLayer instanceof Source\n ? sourceOrLayer\n : sourceOrLayer.getSource();\n if (!source) {\n continue;\n }\n const sourceAttributions = source.getAttributions()?.(frameState);\n if (typeof sourceAttributions === 'string') {\n attributions.push(sourceAttributions);\n } else if (sourceAttributions !== undefined) {\n attributions.push(...sourceAttributions);\n }\n }\n return attributions;\n });\n\n if (options.operation !== undefined) {\n this.setOperation(options.operation, options.lib);\n }\n }\n\n /**\n * Set the operation.\n * @param {Operation} operation New operation.\n * @param {Object} [lib] Functions that will be available to operations run\n * in a worker.\n * @api\n */\n setOperation(operation, lib) {\n if (this.processor_) {\n this.processor_.dispose();\n }\n\n this.processor_ = new Processor({\n operation: operation,\n imageOps: this.operationType_ === 'image',\n queue: 1,\n lib: lib,\n threads: this.threads_,\n });\n this.changed();\n }\n\n /**\n * Update the stored frame state.\n * @param {import(\"../extent.js\").Extent} extent The view extent (in map units).\n * @param {number} resolution The view resolution.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../Map.js\").FrameState} The updated frame state.\n * @private\n */\n updateFrameState_(extent, resolution, projection) {\n const frameState = /** @type {import(\"../Map.js\").FrameState} */ (\n Object.assign({}, this.frameState_)\n );\n\n frameState.viewState = /** @type {import(\"../View.js\").State} */ (\n Object.assign({}, frameState.viewState)\n );\n\n const center = getCenter(extent);\n\n frameState.size[0] = Math.ceil(getWidth(extent) / resolution);\n frameState.size[1] = Math.ceil(getHeight(extent) / resolution);\n frameState.extent = [\n center[0] - (frameState.size[0] * resolution) / 2,\n center[1] - (frameState.size[1] * resolution) / 2,\n center[0] + (frameState.size[0] * resolution) / 2,\n center[1] + (frameState.size[1] * resolution) / 2,\n ];\n frameState.time = Date.now();\n\n const viewState = frameState.viewState;\n viewState.center = center;\n viewState.projection = projection;\n viewState.resolution = resolution;\n return frameState;\n }\n\n /**\n * Determine if all sources are ready.\n * @return {boolean} All sources are ready.\n * @private\n */\n allSourcesReady_() {\n let ready = true;\n let source;\n for (let i = 0, ii = this.layers_.length; i < ii; ++i) {\n source = this.layers_[i].getSource();\n if (!source || source.getState() !== 'ready') {\n ready = false;\n break;\n }\n }\n return ready;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../ImageCanvas.js\").default} Single image.\n * @override\n */\n getImage(extent, resolution, pixelRatio, projection) {\n if (!this.allSourcesReady_()) {\n return null;\n }\n\n this.tileQueue_.loadMoreTiles(16, 16);\n\n resolution = this.findNearestResolution(resolution);\n const frameState = this.updateFrameState_(extent, resolution, projection);\n this.requestedFrameState_ = frameState;\n\n // check if we can't reuse the existing ol/ImageCanvas\n if (this.renderedImageCanvas_) {\n const renderedResolution = this.renderedImageCanvas_.getResolution();\n const renderedExtent = this.renderedImageCanvas_.getExtent();\n if (\n resolution !== renderedResolution ||\n !equals(frameState.extent, renderedExtent)\n ) {\n this.renderedImageCanvas_ = null;\n }\n }\n\n if (\n !this.renderedImageCanvas_ ||\n this.getRevision() !== this.renderedRevision_\n ) {\n this.processSources_();\n }\n\n if (frameState.animate) {\n requestAnimationFrame(this.changed.bind(this));\n }\n\n return this.renderedImageCanvas_;\n }\n\n /**\n * Start processing source data.\n * @private\n */\n processSources_() {\n const frameState = this.requestedFrameState_;\n const len = this.layers_.length;\n const imageDatas = new Array(len);\n for (let i = 0; i < len; ++i) {\n frameState.layerIndex = i;\n frameState.renderTargets = {};\n const imageData = getImageData(this.layers_[i], frameState);\n if (imageData) {\n imageDatas[i] = imageData;\n } else {\n return;\n }\n }\n\n const data = {};\n this.dispatchEvent(\n new RasterSourceEvent(RasterEventType.BEFOREOPERATIONS, frameState, data),\n );\n this.processor_.process(\n imageDatas,\n data,\n this.onWorkerComplete_.bind(this, frameState),\n );\n }\n\n /**\n * Called when pixel processing is complete.\n * @param {import(\"../Map.js\").FrameState} frameState The frame state.\n * @param {Error} err Any error during processing.\n * @param {ImageData} output The output image data.\n * @param {Object|Array<Object>} data The user data (or an array if more than one thread).\n * @private\n */\n onWorkerComplete_(frameState, err, output, data) {\n if (err || !output) {\n return;\n }\n\n // do nothing if extent or resolution changed\n const extent = frameState.extent;\n const resolution = frameState.viewState.resolution;\n if (\n resolution !== this.requestedFrameState_.viewState.resolution ||\n !equals(extent, this.requestedFrameState_.extent)\n ) {\n return;\n }\n\n let context;\n if (this.renderedImageCanvas_) {\n context = this.renderedImageCanvas_.getImage().getContext('2d');\n } else {\n const width = Math.round(getWidth(extent) / resolution);\n const height = Math.round(getHeight(extent) / resolution);\n context = createCanvasContext2D(width, height);\n this.renderedImageCanvas_ = new ImageCanvas(\n extent,\n resolution,\n 1,\n context.canvas,\n );\n }\n context.putImageData(output, 0, 0);\n\n if (frameState.animate) {\n requestAnimationFrame(this.changed.bind(this));\n } else {\n this.changed();\n }\n this.renderedRevision_ = this.getRevision();\n\n this.dispatchEvent(\n new RasterSourceEvent(RasterEventType.AFTEROPERATIONS, frameState, data),\n );\n }\n\n /**\n * @param {import(\"../proj/Projection\").default} [projection] Projection.\n * @return {Array<number>|null} Resolutions.\n * @override\n */\n getResolutions(projection) {\n if (!this.useResolutions_) {\n return null;\n }\n let resolutions = super.getResolutions();\n if (!resolutions) {\n for (let i = 0, ii = this.layers_.length; i < ii; ++i) {\n const source = this.layers_[i].getSource();\n resolutions = source.getResolutions(projection);\n if (resolutions) {\n break;\n }\n }\n }\n return resolutions;\n }\n\n /**\n * @override\n */\n disposeInternal() {\n if (this.processor_) {\n this.processor_.dispose();\n }\n super.disposeInternal();\n }\n}\n\n/**\n * Clean up and unregister the worker.\n * @function\n * @api\n */\nRasterSource.prototype.dispose;\n\n/**\n * A reusable canvas context.\n * @type {CanvasRenderingContext2D}\n * @private\n */\nlet sharedContext = null;\n\n/**\n * Get image data from a layer.\n * @param {import(\"../layer/Layer.js\").default} layer Layer to render.\n * @param {import(\"../Map.js\").FrameState} frameState The frame state.\n * @return {ImageData} The image data.\n */\nfunction getImageData(layer, frameState) {\n const renderer = layer.getRenderer();\n if (!renderer) {\n throw new Error('Unsupported layer type: ' + layer);\n }\n\n if (!renderer.prepareFrame(frameState)) {\n return null;\n }\n const width = frameState.size[0];\n const height = frameState.size[1];\n if (width === 0 || height === 0) {\n return null;\n }\n const container = renderer.renderFrame(frameState, null);\n let element;\n if (container instanceof HTMLCanvasElement) {\n element = container;\n } else {\n if (container) {\n element = container.firstElementChild;\n }\n if (!(element instanceof HTMLCanvasElement)) {\n throw new Error('Unsupported rendered element: ' + element);\n }\n if (element.width === width && element.height === height) {\n const context = element.getContext('2d');\n return context.getImageData(0, 0, width, height);\n }\n }\n\n if (!sharedContext) {\n sharedContext = createCanvasContext2D(width, height, undefined, {\n willReadFrequently: true,\n });\n } else {\n const canvas = sharedContext.canvas;\n if (canvas.width !== width || canvas.height !== height) {\n sharedContext = createCanvasContext2D(width, height, undefined, {\n willReadFrequently: true,\n });\n } else {\n sharedContext.clearRect(0, 0, width, height);\n }\n }\n sharedContext.drawImage(element, 0, 0, width, height);\n return sharedContext.getImageData(0, 0, width, height);\n}\n\n/**\n * Get a list of layer states from a list of layers.\n * @param {Array<import(\"../layer/Layer.js\").default>} layers Layers.\n * @return {Array<import(\"../layer/Layer.js\").State>} The layer states.\n */\nfunction getLayerStatesArray(layers) {\n return layers.map(function (layer) {\n return layer.getLayerState();\n });\n}\n\n/**\n * Create layers for all sources.\n * @param {Array<import(\"./Source.js\").default|import(\"../layer/Layer.js\").default>} sources The sources.\n * @return {Array<import(\"../layer/Layer.js\").default>} Array of layers.\n */\nfunction createLayers(sources) {\n const len = sources.length;\n const layers = new Array(len);\n for (let i = 0; i < len; ++i) {\n layers[i] = createLayer(sources[i]);\n }\n return layers;\n}\n\n/**\n * Create a layer for the provided source.\n * @param {import(\"./Source.js\").default|import(\"../layer/Layer.js\").default} layerOrSource The layer or source.\n * @return {import(\"../layer/Layer.js\").default} The layer.\n */\nfunction createLayer(layerOrSource) {\n // @type {import(\"../layer/Layer.js\").default}\n let layer;\n if (layerOrSource instanceof Source) {\n if (layerOrSource instanceof TileSource) {\n layer = new TileLayer({source: layerOrSource});\n } else if (layerOrSource instanceof ImageSource) {\n layer = new ImageLayer({source: layerOrSource});\n }\n } else {\n layer = layerOrSource;\n }\n return layer;\n}\n\nexport default RasterSource;\n","/**\n * @module ol/source/StadiaMaps\n */\n\nimport {ATTRIBUTION as OSM_ATTRIBUTION} from './OSM.js';\nimport XYZ from './XYZ.js';\n\n/**\n * @type {string}\n */\nconst STADIA_ATTRIBUTION =\n '© <a href=\"https://www.stadiamaps.com/\" target=\"_blank\">Stadia Maps</a>';\n\n/**\n * @type {string}\n */\nconst OMT_ATTRIBUTION =\n '© <a href=\"https://openmaptiles.org/\" target=\"_blank\">OpenMapTiles</a>';\n\n/**\n * @type {string}\n */\nconst STAMEN_ATTRIBUTION =\n '© <a href=\"https://stamen.com/\" target=\"_blank\">Stamen Design</a>';\n\n/**\n * @type {Object<string, {extension: string}>}\n */\nconst LayerConfig = {\n 'stamen_terrain': {\n extension: 'png',\n },\n 'stamen_terrain_background': {\n extension: 'png',\n },\n 'stamen_terrain_labels': {\n extension: 'png',\n },\n 'stamen_terrain_lines': {\n extension: 'png',\n },\n 'stamen_toner_background': {\n extension: 'png',\n },\n 'stamen_toner': {\n extension: 'png',\n },\n 'stamen_toner_labels': {\n extension: 'png',\n },\n 'stamen_toner_lines': {\n extension: 'png',\n },\n 'stamen_toner_lite': {\n extension: 'png',\n },\n 'stamen_watercolor': {\n extension: 'jpg',\n },\n 'alidade_smooth': {\n extension: 'png',\n },\n 'alidade_smooth_dark': {\n extension: 'png',\n },\n 'alidade_satellite': {\n extension: 'png',\n },\n 'outdoors': {\n extension: 'png',\n },\n 'osm_bright': {\n extension: 'png',\n },\n};\n\n/**\n * @type {Object<string, {minZoom: number, maxZoom: number, retina: boolean}>}\n */\nconst ProviderConfig = {\n 'stamen_terrain': {\n minZoom: 0,\n maxZoom: 18,\n retina: true,\n },\n 'stamen_toner': {\n minZoom: 0,\n maxZoom: 20,\n retina: true,\n },\n 'stamen_watercolor': {\n minZoom: 1,\n maxZoom: 18,\n retina: false,\n },\n};\n\n/**\n * @typedef {Object} Options\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {string} layer Layer name. Valid values: `alidade_smooth`, `alidade_smooth_dark`, `outdoors`, `stamen_terrain`, `stamen_terrain_background`, `stamen_terrain_labels`, `stamen_terrain_lines`, `stamen_toner_background`, `stamen_toner`, `stamen_toner_labels`, `stamen_toner_lines`, `stamen_toner_lite`, `stamen_watercolor`, and `osm_bright`.\n * @property {number} [minZoom] Minimum zoom.\n * @property {number} [maxZoom] Maximum zoom.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction]\n * Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {number} [transition=250] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n * @property {string} [apiKey] Stadia Maps API key. Not required for localhost or most public web deployments. See https://docs.stadiamaps.com/authentication/ for details.\n * @property {boolean} [retina] Use retina tiles (if available; not available for Stamen Watercolor).\n */\n\n/**\n * @classdesc\n * Layer source for the Stadia Maps tile server.\n * @api\n */\nclass StadiaMaps extends XYZ {\n /**\n * @param {Options} options StadiaMaps options.\n */\n constructor(options) {\n const i = options.layer.indexOf('-');\n const provider = i == -1 ? options.layer : options.layer.slice(0, i);\n const providerConfig = ProviderConfig[provider] || {\n 'minZoom': 0,\n 'maxZoom': 20,\n 'retina': true,\n };\n\n const layerConfig = LayerConfig[options.layer];\n const query = options.apiKey ? '?api_key=' + options.apiKey : '';\n const retina = providerConfig.retina && options.retina ? '@2x' : '';\n\n const url =\n options.url !== undefined\n ? options.url\n : 'https://tiles.stadiamaps.com/tiles/' +\n options.layer +\n '/{z}/{x}/{y}' +\n retina +\n '.' +\n layerConfig.extension +\n query;\n\n const attributions = [STADIA_ATTRIBUTION, OMT_ATTRIBUTION, OSM_ATTRIBUTION];\n\n if (options.layer.startsWith('stamen_')) {\n attributions.splice(1, 0, STAMEN_ATTRIBUTION);\n }\n\n super({\n attributions: attributions,\n cacheSize: options.cacheSize,\n crossOrigin: 'anonymous',\n interpolate: options.interpolate,\n maxZoom:\n options.maxZoom !== undefined\n ? options.maxZoom\n : providerConfig.maxZoom,\n minZoom:\n options.minZoom !== undefined\n ? options.minZoom\n : providerConfig.minZoom,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileLoadFunction: options.tileLoadFunction,\n transition: options.transition,\n url: url,\n tilePixelRatio: retina ? 2 : 1,\n wrapX: options.wrapX,\n zDirection: options.zDirection,\n });\n }\n}\n\nexport default StadiaMaps;\n","/**\n * @module ol/source/UTFGrid\n */\n\nimport Tile from '../Tile.js';\nimport TileState from '../TileState.js';\nimport EventType from '../events/EventType.js';\nimport {listenOnce} from '../events.js';\nimport {applyTransform, intersects} from '../extent.js';\nimport {jsonp as requestJSONP} from '../net.js';\nimport {get as getProjection, getTransformFromProjections} from '../proj.js';\nimport LRUCache from '../structs/LRUCache.js';\nimport {getKeyZXY} from '../tilecoord.js';\nimport {createXYZ, extentFromProjection} from '../tilegrid.js';\nimport {createFromTemplates, nullTileUrlFunction} from '../tileurlfunction.js';\nimport TileSource from './Tile.js';\n\n/**\n * @typedef {Object} UTFGridJSON\n * @property {Array<string>} grid The grid.\n * @property {Array<string>} keys The keys.\n * @property {Object<string, Object>} [data] Optional data.\n */\n\nexport class CustomTile extends Tile {\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../TileState.js\").default} state State.\n * @param {string} src Image source URI.\n * @param {import(\"../extent.js\").Extent} extent Extent of the tile.\n * @param {boolean} preemptive Load the tile when visible (before it's needed).\n * @param {boolean} jsonp Load the tile as a script.\n */\n constructor(tileCoord, state, src, extent, preemptive, jsonp) {\n super(tileCoord, state);\n\n /**\n * @private\n * @type {string}\n */\n this.src_ = src;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.extent_ = extent;\n\n /**\n * @private\n * @type {boolean}\n */\n this.preemptive_ = preemptive;\n\n /**\n * @private\n * @type {Array<string>}\n */\n this.grid_ = null;\n\n /**\n * @private\n * @type {Array<string>}\n */\n this.keys_ = null;\n\n /**\n * @private\n * @type {Object<string, Object>|undefined}\n */\n this.data_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.jsonp_ = jsonp;\n }\n\n /**\n * Get the image element for this tile.\n * @return {HTMLImageElement} Image.\n */\n getImage() {\n return null;\n }\n\n /**\n * Synchronously returns data at given coordinate (if available).\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {*} The data.\n */\n getData(coordinate) {\n if (!this.grid_ || !this.keys_) {\n return null;\n }\n const xRelative =\n (coordinate[0] - this.extent_[0]) / (this.extent_[2] - this.extent_[0]);\n const yRelative =\n (coordinate[1] - this.extent_[1]) / (this.extent_[3] - this.extent_[1]);\n\n const row = this.grid_[Math.floor((1 - yRelative) * this.grid_.length)];\n\n if (typeof row !== 'string') {\n return null;\n }\n\n let code = row.charCodeAt(Math.floor(xRelative * row.length));\n if (code >= 93) {\n code--;\n }\n if (code >= 35) {\n code--;\n }\n code -= 32;\n\n let data = null;\n if (code in this.keys_) {\n const id = this.keys_[code];\n if (this.data_ && id in this.data_) {\n data = this.data_[id];\n } else {\n data = id;\n }\n }\n return data;\n }\n\n /**\n * Calls the callback (synchronously by default) with the available data\n * for given coordinate (or `null` if not yet loaded).\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {function(*): void} callback Callback.\n * @param {boolean} [request] If `true` the callback is always async.\n * The tile data is requested if not yet loaded.\n */\n forDataAtCoordinate(coordinate, callback, request) {\n if (this.state == TileState.EMPTY && request === true) {\n this.state = TileState.IDLE;\n listenOnce(this, EventType.CHANGE, (e) => {\n callback(this.getData(coordinate));\n });\n this.loadInternal_();\n } else {\n if (request === true) {\n setTimeout(() => {\n callback(this.getData(coordinate));\n }, 0);\n } else {\n callback(this.getData(coordinate));\n }\n }\n }\n\n /**\n * Return the key to be used for all tiles in the source.\n * @return {string} The key for all tiles.\n * @override\n */\n getKey() {\n return this.src_;\n }\n\n /**\n * @private\n */\n handleError_() {\n this.state = TileState.ERROR;\n this.changed();\n }\n\n /**\n * @param {!UTFGridJSON} json UTFGrid data.\n * @private\n */\n handleLoad_(json) {\n this.grid_ = json['grid'];\n this.keys_ = json['keys'];\n this.data_ = json['data'];\n\n this.state = TileState.LOADED;\n this.changed();\n }\n\n /**\n * @private\n */\n loadInternal_() {\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n if (this.jsonp_) {\n requestJSONP(\n this.src_,\n this.handleLoad_.bind(this),\n this.handleError_.bind(this),\n );\n } else {\n const client = new XMLHttpRequest();\n client.addEventListener('load', this.onXHRLoad_.bind(this));\n client.addEventListener('error', this.onXHRError_.bind(this));\n client.open('GET', this.src_);\n client.send();\n }\n }\n }\n\n /**\n * @private\n * @param {Event} event The load event.\n */\n onXHRLoad_(event) {\n const client = /** @type {XMLHttpRequest} */ (event.target);\n // status will be 0 for file:// urls\n if (!client.status || (client.status >= 200 && client.status < 300)) {\n let response;\n try {\n response = /** @type {!UTFGridJSON} */ (\n JSON.parse(client.responseText)\n );\n } catch {\n this.handleError_();\n return;\n }\n this.handleLoad_(response);\n } else {\n this.handleError_();\n }\n }\n\n /**\n * @private\n * @param {Event} event The error event.\n */\n onXHRError_(event) {\n this.handleError_();\n }\n\n /**\n * @override\n */\n load() {\n if (this.preemptive_) {\n this.loadInternal_();\n } else {\n this.setState(TileState.EMPTY);\n }\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [preemptive=true]\n * If `true` the UTFGrid source loads the tiles based on their \"visibility\".\n * This improves the speed of response, but increases traffic.\n * Note that if set to `false` (lazy loading), you need to pass `true` as\n * `request` to the `forDataAtCoordinateAndResolution` method otherwise no\n * data will ever be loaded.\n * @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON.\n * Useful when the server does not support CORS..\n * @property {import(\"./TileJSON.js\").Config} [tileJSON] TileJSON configuration for this source.\n * If not provided, `url` must be configured.\n * @property {string} [url] TileJSON endpoint that provides the configuration for this source.\n * Request will be made through JSONP. If not provided, `tileJSON` must be configured.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for UTFGrid interaction data loaded from TileJSON format.\n * @api\n */\nclass UTFGrid extends TileSource {\n /**\n * @param {Options} options Source options.\n */\n constructor(options) {\n super({\n projection: getProjection('EPSG:3857'),\n state: 'loading',\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {boolean}\n */\n this.preemptive_ =\n options.preemptive !== undefined ? options.preemptive : true;\n\n /**\n * @private\n * @type {!import(\"../Tile.js\").UrlFunction}\n */\n this.tileUrlFunction_ = nullTileUrlFunction;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.template_ = undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.jsonp_ = options.jsonp || false;\n\n /**\n * @private\n * @type {LRUCache}\n */\n this.tileCache_ = new LRUCache(512);\n\n if (options.url) {\n if (this.jsonp_) {\n requestJSONP(\n options.url,\n this.handleTileJSONResponse.bind(this),\n this.handleTileJSONError.bind(this),\n );\n } else {\n const client = new XMLHttpRequest();\n client.addEventListener('load', this.onXHRLoad_.bind(this));\n client.addEventListener('error', this.onXHRError_.bind(this));\n client.open('GET', options.url);\n client.send();\n }\n } else if (options.tileJSON) {\n this.handleTileJSONResponse(options.tileJSON);\n } else {\n throw new Error('Either `url` or `tileJSON` options must be provided');\n }\n }\n\n /**\n * @private\n * @param {Event} event The load event.\n */\n onXHRLoad_(event) {\n const client = /** @type {XMLHttpRequest} */ (event.target);\n // status will be 0 for file:// urls\n if (!client.status || (client.status >= 200 && client.status < 300)) {\n let response;\n try {\n response = /** @type {import(\"./TileJSON.js\").Config} */ (\n JSON.parse(client.responseText)\n );\n } catch {\n this.handleTileJSONError();\n return;\n }\n this.handleTileJSONResponse(response);\n } else {\n this.handleTileJSONError();\n }\n }\n\n /**\n * @private\n * @param {Event} event The error event.\n */\n onXHRError_(event) {\n this.handleTileJSONError();\n }\n\n /**\n * Return the template from TileJSON.\n * @return {string|undefined} The template from TileJSON.\n * @api\n */\n getTemplate() {\n return this.template_;\n }\n\n /**\n * Calls the callback (synchronously by default) with the available data\n * for given coordinate and resolution (or `null` if not yet loaded or\n * in case of an error).\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {function(*): void} callback Callback.\n * @param {boolean} [request] If `true` the callback is always async.\n * The tile data is requested if not yet loaded.\n * @api\n */\n forDataAtCoordinateAndResolution(coordinate, resolution, callback, request) {\n if (this.tileGrid) {\n const z = this.tileGrid.getZForResolution(resolution, this.zDirection);\n const tileCoord = this.tileGrid.getTileCoordForCoordAndZ(coordinate, z);\n const tile = /** @type {!CustomTile} */ (\n this.getTile(\n tileCoord[0],\n tileCoord[1],\n tileCoord[2],\n 1,\n this.getProjection(),\n )\n );\n if (tile.getState() == TileState.IDLE) {\n tile.load();\n }\n tile.forDataAtCoordinate(coordinate, callback, request);\n } else {\n if (request === true) {\n setTimeout(function () {\n callback(null);\n }, 0);\n } else {\n callback(null);\n }\n }\n }\n\n /**\n * @protected\n */\n handleTileJSONError() {\n this.setState('error');\n }\n\n /**\n * TODO: very similar to ol/source/TileJSON#handleTileJSONResponse\n * @protected\n * @param {import(\"./TileJSON.js\").Config} tileJSON Tile JSON.\n */\n handleTileJSONResponse(tileJSON) {\n const epsg4326Projection = getProjection('EPSG:4326');\n\n const sourceProjection = this.getProjection();\n let extent;\n if (tileJSON['bounds'] !== undefined) {\n const transform = getTransformFromProjections(\n epsg4326Projection,\n sourceProjection,\n );\n extent = applyTransform(tileJSON['bounds'], transform);\n }\n\n const gridExtent = extentFromProjection(sourceProjection);\n const minZoom = tileJSON['minzoom'] || 0;\n const maxZoom = tileJSON['maxzoom'] || 22;\n const tileGrid = createXYZ({\n extent: gridExtent,\n maxZoom: maxZoom,\n minZoom: minZoom,\n });\n this.tileGrid = tileGrid;\n\n this.template_ = tileJSON['template'];\n\n const grids = tileJSON['grids'];\n if (!grids) {\n this.setState('error');\n return;\n }\n\n this.tileUrlFunction_ = createFromTemplates(grids, tileGrid);\n\n if (tileJSON['attribution']) {\n const attributionExtent = extent !== undefined ? extent : gridExtent;\n this.setAttributions(function (frameState) {\n if (intersects(attributionExtent, frameState.extent)) {\n return [tileJSON['attribution']];\n }\n return null;\n });\n }\n\n this.setState('ready');\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {!CustomTile} Tile.\n * @override\n */\n getTile(z, x, y, pixelRatio, projection) {\n const tileCoord = [z, x, y];\n const urlTileCoord = this.getTileCoordForTileUrlFunction(\n tileCoord,\n projection,\n );\n const tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);\n const tileKey = `${this.getKey()},${getKeyZXY(z, x, y)}`;\n if (this.tileCache_.containsKey(tileKey)) {\n return this.tileCache_.get(tileKey);\n }\n this.tileCache_.expireCache();\n const tile = new CustomTile(\n tileCoord,\n tileUrl !== undefined ? TileState.IDLE : TileState.EMPTY,\n tileUrl !== undefined ? tileUrl : '',\n this.tileGrid.getTileCoordExtent(tileCoord),\n this.preemptive_,\n this.jsonp_,\n );\n this.tileCache_.set(tileKey, tile);\n return tile;\n }\n}\n\nexport default UTFGrid;\n","/**\n * @module ol/webgl\n */\n\nimport {SAFARI_BUG_237906} from './has.js';\n\n/**\n * Constants taken from goog.webgl\n */\n\n/**\n * Used by {@link module:ol/webgl/Helper~WebGLHelper} for buffers containing vertices data, such as\n * position, color, texture coordinate, etc. These vertices are then referenced by an index buffer\n * to be drawn on screen (see {@link module:ol/webgl.ELEMENT_ARRAY_BUFFER}).\n * @const\n * @type {number}\n * @api\n */\nexport const ARRAY_BUFFER = 0x8892;\n\n/**\n * Used by {@link module:ol/webgl/Helper~WebGLHelper} for buffers containing indices data.\n * Index buffers are essentially lists of references to vertices defined in a vertex buffer\n * (see {@link module:ol/webgl.ARRAY_BUFFER}), and define the primitives (triangles) to be drawn.\n * @const\n * @type {number}\n * @api\n */\nexport const ELEMENT_ARRAY_BUFFER = 0x8893;\n\n/**\n * Used by {link module:ol/webgl/Buffer~WebGLArrayBuffer}.\n * @const\n * @type {number}\n * @api\n */\nexport const STREAM_DRAW = 0x88e0;\n\n/**\n * Used by {link module:ol/webgl/Buffer~WebGLArrayBuffer}.\n * @const\n * @type {number}\n * @api\n */\nexport const STATIC_DRAW = 0x88e4;\n\n/**\n * Used by {link module:ol/webgl/Buffer~WebGLArrayBuffer}.\n * @const\n * @type {number}\n * @api\n */\nexport const DYNAMIC_DRAW = 0x88e8;\n\n/**\n * @const\n * @type {number}\n */\nexport const UNSIGNED_BYTE = 0x1401;\n\n/**\n * @const\n * @type {number}\n */\nexport const UNSIGNED_SHORT = 0x1403;\n\n/**\n * @const\n * @type {number}\n */\nexport const UNSIGNED_INT = 0x1405;\n\n/**\n * @const\n * @type {number}\n */\nexport const FLOAT = 0x1406;\n\n/**\n end of goog.webgl constants\n */\n\n/**\n * @const\n * @type {Array<string>}\n */\nconst CONTEXT_IDS = ['experimental-webgl', 'webgl', 'webkit-3d', 'moz-webgl'];\n\n/**\n * @param {HTMLCanvasElement} canvas Canvas.\n * @param {Object} [attributes] Attributes.\n * @return {WebGLRenderingContext|null} WebGL rendering context.\n */\nexport function getContext(canvas, attributes) {\n attributes = Object.assign(\n {\n preserveDrawingBuffer: true,\n antialias: SAFARI_BUG_237906 ? false : true, // https://bugs.webkit.org/show_bug.cgi?id=237906\n },\n attributes,\n );\n const ii = CONTEXT_IDS.length;\n for (let i = 0; i < ii; ++i) {\n try {\n const context = canvas.getContext(CONTEXT_IDS[i], attributes);\n if (context) {\n return /** @type {!WebGLRenderingContext} */ (context);\n }\n } catch {\n // pass\n }\n }\n return null;\n}\n\n/**\n * @type {Array<string>|null}\n */\nlet supportedExtensions = null;\n\n/**\n * @return {Array<string>|null} List of supported WebGL extensions.\n */\nexport function getSupportedExtensions() {\n if (!supportedExtensions) {\n const canvas = document.createElement('canvas');\n const gl = getContext(canvas);\n if (gl) {\n supportedExtensions = gl.getSupportedExtensions();\n }\n }\n return supportedExtensions;\n}\n","/**\n * @module ol/xml\n */\nimport {extend} from './array.js';\n\n/**\n * When using {@link module:ol/xml.makeChildAppender} or\n * {@link module:ol/xml.makeSimpleNodeFactory}, the top `objectStack` item needs\n * to have this structure.\n * @typedef {Object} NodeStackItem\n * @property {Element} node Node.\n */\n\n/**\n * @typedef {function(Element, Array<*>): void} Parser\n */\n\n/**\n * @typedef {function(Element, *, Array<*>): void} Serializer\n */\n\n/**\n * @type {string}\n */\nexport const XML_SCHEMA_INSTANCE_URI =\n 'http://www.w3.org/2001/XMLSchema-instance';\n\n/**\n * @param {string} namespaceURI Namespace URI.\n * @param {string} qualifiedName Qualified name.\n * @return {Element} Node.\n */\nexport function createElementNS(namespaceURI, qualifiedName) {\n return getDocument().createElementNS(namespaceURI, qualifiedName);\n}\n\n/**\n * Recursively grab all text content of child nodes into a single string.\n * @param {Node} node Node.\n * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line\n * breaks.\n * @return {string} All text content.\n * @api\n */\nexport function getAllTextContent(node, normalizeWhitespace) {\n return getAllTextContent_(node, normalizeWhitespace, []).join('');\n}\n\n/**\n * Recursively grab all text content of child nodes into a single string.\n * @param {Node} node Node.\n * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line\n * breaks.\n * @param {Array<string>} accumulator Accumulator.\n * @private\n * @return {Array<string>} Accumulator.\n */\nexport function getAllTextContent_(node, normalizeWhitespace, accumulator) {\n if (\n node.nodeType == Node.CDATA_SECTION_NODE ||\n node.nodeType == Node.TEXT_NODE\n ) {\n if (normalizeWhitespace) {\n accumulator.push(String(node.nodeValue).replace(/(\\r\\n|\\r|\\n)/g, ''));\n } else {\n accumulator.push(node.nodeValue);\n }\n } else {\n let n;\n for (n = node.firstChild; n; n = n.nextSibling) {\n getAllTextContent_(n, normalizeWhitespace, accumulator);\n }\n }\n return accumulator;\n}\n\n/**\n * @param {Object} object Object.\n * @return {boolean} Is a document.\n */\nexport function isDocument(object) {\n return 'documentElement' in object;\n}\n\n/**\n * @param {Element} node Node.\n * @param {?string} namespaceURI Namespace URI.\n * @param {string} name Attribute name.\n * @return {string} Value\n */\nexport function getAttributeNS(node, namespaceURI, name) {\n return node.getAttributeNS(namespaceURI, name) || '';\n}\n\n/**\n * Parse an XML string to an XML Document.\n * @param {string} xml XML.\n * @return {Document} Document.\n * @api\n */\nexport function parse(xml) {\n return new DOMParser().parseFromString(xml, 'application/xml');\n}\n\n/**\n * Make an array extender function for extending the array at the top of the\n * object stack.\n * @param {function(this: T, Node, Array<*>): (Array<*>|undefined)} valueReader Value reader.\n * @param {T} [thisArg] The object to use as `this` in `valueReader`.\n * @return {Parser} Parser.\n * @template T\n */\nexport function makeArrayExtender(valueReader, thisArg) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @this {*}\n */\n function (node, objectStack) {\n const value = valueReader.call(thisArg ?? this, node, objectStack);\n if (value !== undefined) {\n const array = /** @type {Array<*>} */ (\n objectStack[objectStack.length - 1]\n );\n extend(array, value);\n }\n }\n );\n}\n\n/**\n * Make an array pusher function for pushing to the array at the top of the\n * object stack.\n * @param {function(this: T, Element, Array<*>): *} valueReader Value reader.\n * @param {T} [thisArg] The object to use as `this` in `valueReader`.\n * @return {Parser} Parser.\n * @template T\n */\nexport function makeArrayPusher(valueReader, thisArg) {\n return (\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @this {*}\n */\n function (node, objectStack) {\n const value = valueReader.call(thisArg ?? this, node, objectStack);\n if (value !== undefined) {\n const array = /** @type {Array<*>} */ (\n objectStack[objectStack.length - 1]\n );\n array.push(value);\n }\n }\n );\n}\n\n/**\n * Make an object stack replacer function for replacing the object at the\n * top of the stack.\n * @param {function(this: T, Node, Array<*>): *} valueReader Value reader.\n * @param {T} [thisArg] The object to use as `this` in `valueReader`.\n * @return {Parser} Parser.\n * @template T\n */\nexport function makeReplacer(valueReader, thisArg) {\n return (\n /**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @this {*}\n */\n function (node, objectStack) {\n const value = valueReader.call(thisArg ?? this, node, objectStack);\n if (value !== undefined) {\n objectStack[objectStack.length - 1] = value;\n }\n }\n );\n}\n\n/**\n * Make an object property pusher function for adding a property to the\n * object at the top of the stack.\n * @param {function(this: T, Element, Array<*>): *} valueReader Value reader.\n * @param {string} [property] Property.\n * @param {T} [thisArg] The object to use as `this` in `valueReader`.\n * @return {Parser} Parser.\n * @template T\n */\nexport function makeObjectPropertyPusher(valueReader, property, thisArg) {\n return (\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @this {*}\n */\n function (node, objectStack) {\n const value = valueReader.call(thisArg ?? this, node, objectStack);\n if (value !== undefined) {\n const object = /** @type {!Object} */ (\n objectStack[objectStack.length - 1]\n );\n const name = property !== undefined ? property : node.localName;\n let array;\n if (name in object) {\n array = object[name];\n } else {\n array = [];\n object[name] = array;\n }\n array.push(value);\n }\n }\n );\n}\n\n/**\n * Make an object property setter function.\n * @param {function(this: T, Element, Array<*>): *} valueReader Value reader.\n * @param {string} [property] Property.\n * @param {T} [thisArg] The object to use as `this` in `valueReader`.\n * @return {Parser} Parser.\n * @template T\n */\nexport function makeObjectPropertySetter(valueReader, property, thisArg) {\n return (\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @this {*}\n */\n function (node, objectStack) {\n const value = valueReader.call(thisArg ?? this, node, objectStack);\n if (value !== undefined) {\n const object = /** @type {!Object} */ (\n objectStack[objectStack.length - 1]\n );\n const name = property !== undefined ? property : node.localName;\n object[name] = value;\n }\n }\n );\n}\n\n/**\n * Create a serializer that appends nodes written by its `nodeWriter` to its\n * designated parent. The parent is the `node` of the\n * {@link module:ol/xml~NodeStackItem} at the top of the `objectStack`.\n * @param {function(this: T, Node, V, Array<*>): void} nodeWriter Node writer.\n * @param {T} [thisArg] The object to use as `this` in `nodeWriter`.\n * @return {Serializer} Serializer.\n * @template T, V\n */\nexport function makeChildAppender(nodeWriter, thisArg) {\n return (\n /**\n * @param {Element} node Node.\n * @param {*} value Value to be written.\n * @param {Array<*>} objectStack Object stack.\n * @this {*}\n */\n function (node, value, objectStack) {\n nodeWriter.call(thisArg ?? this, node, value, objectStack);\n const parent = /** @type {NodeStackItem} */ (\n objectStack[objectStack.length - 1]\n );\n const parentNode = parent.node;\n parentNode.appendChild(node);\n }\n );\n}\n\n/**\n * Create a serializer that calls the provided `nodeWriter` from\n * {@link module:ol/xml.serialize}. This can be used by the parent writer to have the\n * `nodeWriter` called with an array of values when the `nodeWriter` was\n * designed to serialize a single item. An example would be a LineString\n * geometry writer, which could be reused for writing MultiLineString\n * geometries.\n * @param {function(this: T, Element, V, Array<*>): void} nodeWriter Node writer.\n * @param {T} [thisArg] The object to use as `this` in `nodeWriter`.\n * @return {Serializer} Serializer.\n * @template T, V\n */\nexport function makeArraySerializer(nodeWriter, thisArg) {\n let serializersNS, nodeFactory;\n return function (node, value, objectStack) {\n if (serializersNS === undefined) {\n serializersNS = {};\n const serializers = {};\n serializers[node.localName] = nodeWriter;\n serializersNS[node.namespaceURI] = serializers;\n nodeFactory = makeSimpleNodeFactory(node.localName);\n }\n serialize(serializersNS, nodeFactory, value, objectStack);\n };\n}\n\n/**\n * Create a node factory which can use the `keys` passed to\n * {@link module:ol/xml.serialize} or {@link module:ol/xml.pushSerializeAndPop} as node names,\n * or a fixed node name. The namespace of the created nodes can either be fixed,\n * or the parent namespace will be used.\n * @param {string} [fixedNodeName] Fixed node name which will be used for all\n * created nodes. If not provided, the 3rd argument to the resulting node\n * factory needs to be provided and will be the nodeName.\n * @param {string} [fixedNamespaceURI] Fixed namespace URI which will be used for\n * all created nodes. If not provided, the namespace of the parent node will\n * be used.\n * @return {function(*, Array<*>, string=): (Node|undefined)} Node factory.\n */\nexport function makeSimpleNodeFactory(fixedNodeName, fixedNamespaceURI) {\n return (\n /**\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [newNodeName] Node name.\n * @return {Node} Node.\n */\n function (value, objectStack, newNodeName) {\n const context = /** @type {NodeStackItem} */ (\n objectStack[objectStack.length - 1]\n );\n const node = context.node;\n let nodeName = fixedNodeName;\n if (nodeName === undefined) {\n nodeName = newNodeName;\n }\n\n const namespaceURI =\n fixedNamespaceURI !== undefined ? fixedNamespaceURI : node.namespaceURI;\n return createElementNS(namespaceURI, /** @type {string} */ (nodeName));\n }\n );\n}\n\n/**\n * A node factory that creates a node using the parent's `namespaceURI` and the\n * `nodeName` passed by {@link module:ol/xml.serialize} or\n * {@link module:ol/xml.pushSerializeAndPop} to the node factory.\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nexport const OBJECT_PROPERTY_NODE_FACTORY = makeSimpleNodeFactory();\n\n/**\n * Create an array of `values` to be used with {@link module:ol/xml.serialize} or\n * {@link module:ol/xml.pushSerializeAndPop}, where `orderedKeys` has to be provided as\n * `key` argument.\n * @param {Object<string, *>} object Key-value pairs for the sequence. Keys can\n * be a subset of the `orderedKeys`.\n * @param {Array<string>} orderedKeys Keys in the order of the sequence.\n * @return {Array<*>} Values in the order of the sequence. The resulting array\n * has the same length as the `orderedKeys` array. Values that are not\n * present in `object` will be `undefined` in the resulting array.\n */\nexport function makeSequence(object, orderedKeys) {\n const length = orderedKeys.length;\n const sequence = new Array(length);\n for (let i = 0; i < length; ++i) {\n sequence[i] = object[orderedKeys[i]];\n }\n return sequence;\n}\n\n/**\n * Create a namespaced structure, using the same values for each namespace.\n * This can be used as a starting point for versioned parsers, when only a few\n * values are version specific.\n * @param {Array<string>} namespaceURIs Namespace URIs.\n * @param {T} structure Structure.\n * @param {Object<string, T>} [structureNS] Namespaced structure to add to.\n * @return {Object<string, T>} Namespaced structure.\n * @template T\n */\nexport function makeStructureNS(namespaceURIs, structure, structureNS) {\n structureNS = structureNS !== undefined ? structureNS : {};\n let i, ii;\n for (i = 0, ii = namespaceURIs.length; i < ii; ++i) {\n structureNS[namespaceURIs[i]] = structure;\n }\n return structureNS;\n}\n\n/**\n * Parse a node using the parsers and object stack.\n * @param {Object<string, Object<string, Parser>>} parsersNS\n * Parsers by namespace.\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @param {*} [thisArg] The object to use as `this`.\n */\nexport function parseNode(parsersNS, node, objectStack, thisArg) {\n let n;\n for (n = node.firstElementChild; n; n = n.nextElementSibling) {\n const parsers = parsersNS[n.namespaceURI];\n if (parsers !== undefined) {\n const parser = parsers[n.localName];\n if (parser !== undefined) {\n parser.call(thisArg, n, objectStack);\n }\n }\n }\n}\n\n/**\n * Push an object on top of the stack, parse and return the popped object.\n * @param {T} object Object.\n * @param {Object<string, Object<string, Parser>>} parsersNS\n * Parsers by namespace.\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @param {*} [thisArg] The object to use as `this`.\n * @return {T} Object.\n * @template T\n */\nexport function pushParseAndPop(object, parsersNS, node, objectStack, thisArg) {\n objectStack.push(object);\n parseNode(parsersNS, node, objectStack, thisArg);\n return /** @type {T} */ (objectStack.pop());\n}\n\n/**\n * Walk through an array of `values` and call a serializer for each value.\n * @param {Object<string, Object<string, Serializer>>} serializersNS\n * Namespaced serializers.\n * @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory\n * Node factory. The `nodeFactory` creates the node whose namespace and name\n * will be used to choose a node writer from `serializersNS`. This\n * separation allows us to decide what kind of node to create, depending on\n * the value we want to serialize. An example for this would be different\n * geometry writers based on the geometry type.\n * @param {Array<*>} values Values to serialize. An example would be an array\n * of {@link module:ol/Feature~Feature} instances.\n * @param {Array<*>} objectStack Node stack.\n * @param {Array<string>} [keys] Keys of the `values`. Will be passed to the\n * `nodeFactory`. This is used for serializing object literals where the\n * node name relates to the property key. The array length of `keys` has\n * to match the length of `values`. For serializing a sequence, `keys`\n * determines the order of the sequence.\n * @param {T} [thisArg] The object to use as `this` for the node factory and\n * serializers.\n * @template T\n */\nexport function serialize(\n serializersNS,\n nodeFactory,\n values,\n objectStack,\n keys,\n thisArg,\n) {\n const length = (keys !== undefined ? keys : values).length;\n let value, node;\n for (let i = 0; i < length; ++i) {\n value = values[i];\n if (value !== undefined) {\n node = nodeFactory.call(\n thisArg,\n value,\n objectStack,\n keys !== undefined ? keys[i] : undefined,\n );\n if (node !== undefined) {\n serializersNS[node.namespaceURI][node.localName].call(\n thisArg,\n node,\n value,\n objectStack,\n );\n }\n }\n }\n}\n\n/**\n * @param {O} object Object.\n * @param {Object<string, Object<string, Serializer>>} serializersNS\n * Namespaced serializers.\n * @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory\n * Node factory. The `nodeFactory` creates the node whose namespace and name\n * will be used to choose a node writer from `serializersNS`. This\n * separation allows us to decide what kind of node to create, depending on\n * the value we want to serialize. An example for this would be different\n * geometry writers based on the geometry type.\n * @param {Array<*>} values Values to serialize. An example would be an array\n * of {@link module:ol/Feature~Feature} instances.\n * @param {Array<*>} objectStack Node stack.\n * @param {Array<string>} [keys] Keys of the `values`. Will be passed to the\n * `nodeFactory`. This is used for serializing object literals where the\n * node name relates to the property key. The array length of `keys` has\n * to match the length of `values`. For serializing a sequence, `keys`\n * determines the order of the sequence.\n * @param {T} [thisArg] The object to use as `this` for the node factory and\n * serializers.\n * @return {O|undefined} Object.\n * @template O, T\n */\nexport function pushSerializeAndPop(\n object,\n serializersNS,\n nodeFactory,\n values,\n objectStack,\n keys,\n thisArg,\n) {\n objectStack.push(object);\n serialize(serializersNS, nodeFactory, values, objectStack, keys, thisArg);\n return /** @type {O|undefined} */ (objectStack.pop());\n}\n\nlet xmlSerializer_ = undefined;\n\n/**\n * Register a XMLSerializer. Can be used to inject a XMLSerializer\n * where there is no globally available implementation.\n *\n * @param {XMLSerializer} xmlSerializer A XMLSerializer.\n * @api\n */\nexport function registerXMLSerializer(xmlSerializer) {\n xmlSerializer_ = xmlSerializer;\n}\n\n/**\n * @return {XMLSerializer} The XMLSerializer.\n */\nexport function getXMLSerializer() {\n if (xmlSerializer_ === undefined && typeof XMLSerializer !== 'undefined') {\n xmlSerializer_ = new XMLSerializer();\n }\n return xmlSerializer_;\n}\n\nlet document_ = undefined;\n\n/**\n * Register a Document to use when creating nodes for XML serializations. Can be used\n * to inject a Document where there is no globally available implementation.\n *\n * @param {Document} document A Document.\n * @api\n */\nexport function registerDocument(document) {\n document_ = document;\n}\n\n/**\n * Get a document that should be used when creating nodes for XML serializations.\n * @return {Document} The document.\n */\nexport function getDocument() {\n if (document_ === undefined && typeof document !== 'undefined') {\n document_ = document.implementation.createDocument('', '', null);\n }\n return document_;\n}\n","/**\n * @module ol/webgl/BaseTileRepresentation\n */\n\nimport ImageTile from '../ImageTile.js';\nimport TileState from '../TileState.js';\nimport EventType from '../events/EventType.js';\nimport EventTarget from '../events/Target.js';\nimport {abstract} from '../util.js';\n\n/**\n * @typedef {import(\"../Tile.js\").default} BaseTileType\n */\n\n/**\n * @template {BaseTileType} TileType\n * @typedef {Object} TileRepresentationOptions\n * @property {TileType} tile The tile.\n * @property {import(\"../tilegrid/TileGrid.js\").default} grid Tile grid.\n * @property {import(\"../webgl/Helper.js\").default} helper WebGL helper.\n * @property {number} [gutter=0] The size in pixels of the gutter around image tiles to ignore.\n */\n\n/**\n * @classdesc\n * Base class for representing a tile in a webgl context\n * @template {import(\"../Tile.js\").default} TileType\n * @abstract\n */\nclass BaseTileRepresentation extends EventTarget {\n /**\n * @param {TileRepresentationOptions<TileType>} options The tile representation options.\n */\n constructor(options) {\n super();\n\n /**\n * @type {TileType}\n */\n this.tile;\n\n /**\n * @private\n */\n this.handleTileChange_ = this.handleTileChange_.bind(this);\n\n /**\n * @type {number}\n * @protected\n */\n this.gutter = options.gutter || 0;\n\n /**\n * @type {import(\"../webgl/Helper.js\").default}\n * @protected\n */\n this.helper = options.helper;\n\n this.loaded = false;\n this.ready = false;\n }\n\n /**\n * @param {TileType} tile Tile.\n */\n setTile(tile) {\n if (tile !== this.tile) {\n if (this.tile) {\n this.tile.removeEventListener(EventType.CHANGE, this.handleTileChange_);\n }\n this.tile = tile;\n this.loaded = tile.getState() === TileState.LOADED;\n if (this.loaded) {\n this.uploadTile();\n } else {\n if (tile instanceof ImageTile) {\n const image = tile.getImage();\n if (image instanceof Image && !image.crossOrigin) {\n image.crossOrigin = 'anonymous';\n }\n }\n tile.addEventListener(EventType.CHANGE, this.handleTileChange_);\n }\n }\n }\n\n /**\n * @abstract\n * @protected\n */\n uploadTile() {\n abstract();\n }\n\n setReady() {\n this.ready = true;\n this.dispatchEvent(EventType.CHANGE);\n }\n\n handleTileChange_() {\n if (this.tile.getState() === TileState.LOADED) {\n this.loaded = true;\n this.uploadTile();\n }\n }\n\n /**\n * @param {import(\"./Helper.js\").default} helper The WebGL helper.\n */\n setHelper(helper) {\n this.helper = helper;\n if (this.helper && this.loaded) {\n this.uploadTile();\n }\n }\n\n /**\n * @override\n */\n disposeInternal() {\n this.setHelper(null);\n this.tile.removeEventListener(EventType.CHANGE, this.handleTileChange_);\n }\n}\n\nexport default BaseTileRepresentation;\n","/**\n * @module ol/webgl/Buffer\n */\nimport {assert} from '../asserts.js';\nimport {\n ARRAY_BUFFER,\n DYNAMIC_DRAW,\n ELEMENT_ARRAY_BUFFER,\n STATIC_DRAW,\n STREAM_DRAW,\n} from '../webgl.js';\n\n/**\n * Used to describe the intended usage for the data: `STATIC_DRAW`, `STREAM_DRAW`\n * or `DYNAMIC_DRAW`.\n * @enum {number}\n */\nexport const BufferUsage = {\n STATIC_DRAW: STATIC_DRAW,\n STREAM_DRAW: STREAM_DRAW,\n DYNAMIC_DRAW: DYNAMIC_DRAW,\n};\n\n/**\n * @classdesc\n * Object used to store an array of data as well as usage information for that data.\n * Stores typed arrays internally, either Float32Array or Uint16/32Array depending on\n * the buffer type (ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER) and available extensions.\n *\n * To populate the array, you can either use:\n * A size using `#ofSize(buffer)`\n * An `ArrayBuffer` object using `#fromArrayBuffer(buffer)`\n * A plain array using `#fromArray(array)`\n *\n * Note:\n * See the documentation of [WebGLRenderingContext.bufferData](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData)\n * for more info on buffer usage.\n */\nclass WebGLArrayBuffer {\n /**\n * @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.\n * @param {number} [usage] Intended usage, either `STATIC_DRAW`, `STREAM_DRAW` or `DYNAMIC_DRAW`.\n * Default is `STATIC_DRAW`.\n */\n constructor(type, usage) {\n /**\n * @private\n * @type {Float32Array|Uint32Array|null}\n */\n this.array_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.type_ = type;\n\n assert(\n type === ARRAY_BUFFER || type === ELEMENT_ARRAY_BUFFER,\n 'A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`',\n );\n\n /**\n * @private\n * @type {number}\n */\n this.usage_ = usage !== undefined ? usage : BufferUsage.STATIC_DRAW;\n }\n\n /**\n * Populates the buffer with an array of the given size (all values will be zeroes).\n * @param {number} size Array size\n * @return {WebGLArrayBuffer} This\n */\n ofSize(size) {\n this.array_ = new (getArrayClassForType(this.type_))(size);\n return this;\n }\n\n /**\n * Populates the buffer with an array of the given size.\n * @param {Array<number>} array Numerical array\n * @return {WebGLArrayBuffer} This\n */\n fromArray(array) {\n this.array_ = getArrayClassForType(this.type_).from(array);\n return this;\n }\n\n /**\n * Populates the buffer with a raw binary array buffer.\n * @param {ArrayBuffer} buffer Raw binary buffer to populate the array with. Note that this buffer must have been\n * initialized for the same typed array class.\n * @return {WebGLArrayBuffer} This\n */\n fromArrayBuffer(buffer) {\n this.array_ = new (getArrayClassForType(this.type_))(buffer);\n return this;\n }\n\n /**\n * @return {number} Buffer type.\n */\n getType() {\n return this.type_;\n }\n\n /**\n * Will return null if the buffer was not initialized\n * @return {Float32Array|Uint32Array|null} Array.\n */\n getArray() {\n return this.array_;\n }\n\n /**\n * @param {Float32Array|Uint32Array} array Array.\n */\n setArray(array) {\n const ArrayType = getArrayClassForType(this.type_);\n if (!(array instanceof ArrayType)) {\n throw new Error(`Expected ${ArrayType}`);\n }\n this.array_ = array;\n }\n\n /**\n * @return {number} Usage.\n */\n getUsage() {\n return this.usage_;\n }\n\n /**\n * Will return 0 if the buffer is not initialized\n * @return {number} Array size\n */\n getSize() {\n return this.array_ ? this.array_.length : 0;\n }\n}\n\n/**\n * Returns a typed array constructor based on the given buffer type\n * @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.\n * @return {Float32ArrayConstructor|Uint32ArrayConstructor} The typed array class to use for this buffer.\n */\nexport function getArrayClassForType(type) {\n switch (type) {\n case ARRAY_BUFFER:\n return Float32Array;\n case ELEMENT_ARRAY_BUFFER:\n return Uint32Array;\n default:\n return Float32Array;\n }\n}\n\nexport default WebGLArrayBuffer;\n","/**\n * @module ol/webgl/ContextEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n LOST: 'webglcontextlost',\n RESTORED: 'webglcontextrestored',\n};\n","/**\n * @module ol/webgl/PostProcessingPass\n */\n\nimport {getUid} from '../util.js';\n\nconst DEFAULT_VERTEX_SHADER = `\n precision mediump float;\n\n attribute vec2 a_position;\n varying vec2 v_texCoord;\n varying vec2 v_screenCoord;\n\n uniform vec2 u_screenSize;\n\n void main() {\n v_texCoord = a_position * 0.5 + 0.5;\n v_screenCoord = v_texCoord * u_screenSize;\n gl_Position = vec4(a_position, 0.0, 1.0);\n }\n`;\n\nconst DEFAULT_FRAGMENT_SHADER = `\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;\n }\n`;\n\n/**\n * @typedef {Object} Options\n * @property {WebGLRenderingContext} webGlContext WebGL context; mandatory.\n * @property {number} [scaleRatio] Scale ratio; if < 1, the post process will render to a texture smaller than\n * the main canvas that will then be sampled up (useful for saving resource on blur steps).\n * @property {string} [vertexShader] Vertex shader source\n * @property {string} [fragmentShader] Fragment shader source\n * @property {Object<string,import(\"./Helper\").UniformValue>} [uniforms] Uniform definitions for the post process step\n */\n\n/**\n * @typedef {Object} UniformInternalDescription\n * @property {import(\"./Helper\").UniformValue} value Value\n * @property {WebGLUniformLocation} location Location\n * @property {WebGLTexture} [texture] Texture\n * @private\n */\n\n/**\n * @classdesc\n * This class is used to define Post Processing passes with custom shaders and uniforms.\n * This is used internally by {@link module:ol/webgl/Helper~WebGLHelper}.\n *\n * Please note that the final output on the DOM canvas is expected to have premultiplied alpha, which means that\n * a pixel which is 100% red with an opacity of 50% must have a color of (r=0.5, g=0, b=0, a=0.5).\n * Failing to provide pixel colors with premultiplied alpha will result in render anomalies.\n *\n * The default post-processing pass does *not* multiply color values with alpha value, it expects color values to be\n * premultiplied.\n *\n * Default shaders are shown hereafter:\n *\n * Vertex shader:\n *\n * ```\n * precision mediump float;\n *\n * attribute vec2 a_position;\n * varying vec2 v_texCoord;\n * varying vec2 v_screenCoord;\n *\n * uniform vec2 u_screenSize;\n *\n * void main() {\n * v_texCoord = a_position * 0.5 + 0.5;\n * v_screenCoord = v_texCoord * u_screenSize;\n * gl_Position = vec4(a_position, 0.0, 1.0);\n * }\n * ```\n *\n * Fragment shader:\n *\n * ```\n * precision mediump float;\n *\n * uniform sampler2D u_image;\n * uniform float u_opacity;\n *\n * varying vec2 v_texCoord;\n *\n * void main() {\n * gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;\n * }\n * ```\n */\nclass WebGLPostProcessingPass {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n /**\n * @private\n */\n this.gl_ = options.webGlContext;\n const gl = this.gl_;\n\n /**\n * @private\n */\n this.scaleRatio_ = options.scaleRatio || 1;\n\n /**\n * @type {WebGLTexture}\n * @private\n */\n this.renderTargetTexture_ = gl.createTexture();\n\n /**\n * @type {import('../size.js').Size|null}\n * @private\n */\n this.renderTargetTextureSize_ = null;\n\n /**\n * @private\n */\n this.frameBuffer_ = gl.createFramebuffer();\n /**\n * @private\n */\n this.depthBuffer_ = gl.createRenderbuffer();\n\n // compile the program for the frame buffer\n // TODO: make compilation errors show up\n const vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(\n vertexShader,\n options.vertexShader || DEFAULT_VERTEX_SHADER,\n );\n gl.compileShader(vertexShader);\n const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(\n fragmentShader,\n options.fragmentShader || DEFAULT_FRAGMENT_SHADER,\n );\n gl.compileShader(fragmentShader);\n /**\n * @private\n */\n this.renderTargetProgram_ = gl.createProgram();\n gl.attachShader(this.renderTargetProgram_, vertexShader);\n gl.attachShader(this.renderTargetProgram_, fragmentShader);\n gl.linkProgram(this.renderTargetProgram_);\n\n // bind the vertices buffer for the frame buffer\n /**\n * @private\n */\n this.renderTargetVerticesBuffer_ = gl.createBuffer();\n const verticesArray = [-1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1];\n gl.bindBuffer(gl.ARRAY_BUFFER, this.renderTargetVerticesBuffer_);\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array(verticesArray),\n gl.STATIC_DRAW,\n );\n\n /**\n * @private\n */\n this.renderTargetAttribLocation_ = gl.getAttribLocation(\n this.renderTargetProgram_,\n 'a_position',\n );\n /**\n * @private\n */\n this.renderTargetUniformLocation_ = gl.getUniformLocation(\n this.renderTargetProgram_,\n 'u_screenSize',\n );\n /**\n * @private\n */\n this.renderTargetOpacityLocation_ = gl.getUniformLocation(\n this.renderTargetProgram_,\n 'u_opacity',\n );\n /**\n * @private\n */\n this.renderTargetTextureLocation_ = gl.getUniformLocation(\n this.renderTargetProgram_,\n 'u_image',\n );\n\n /**\n * Holds info about custom uniforms used in the post processing pass\n * @type {Array<UniformInternalDescription>}\n * @private\n */\n this.uniforms_ = [];\n options.uniforms &&\n Object.keys(options.uniforms).forEach((name) => {\n this.uniforms_.push({\n value: options.uniforms[name],\n location: gl.getUniformLocation(this.renderTargetProgram_, name),\n });\n });\n }\n\n getRenderTargetTexture() {\n return this.renderTargetTexture_;\n }\n\n /**\n * Get the WebGL rendering context\n * @return {WebGLRenderingContext} The rendering context.\n */\n getGL() {\n return this.gl_;\n }\n\n /**\n * Initialize the render target texture of the post process, make sure it is at the\n * right size and bind it as a render target for the next draw calls.\n * The last step to be initialized will be the one where the primitives are rendered.\n * @param {import(\"../Map.js\").FrameState} frameState current frame state\n */\n init(frameState) {\n const gl = this.getGL();\n const textureSize = [\n gl.drawingBufferWidth * this.scaleRatio_,\n gl.drawingBufferHeight * this.scaleRatio_,\n ];\n\n // rendering goes to my buffer\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.getFrameBuffer());\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.getDepthBuffer());\n gl.viewport(0, 0, textureSize[0], textureSize[1]);\n\n // if size has changed: adjust canvas & render target texture\n if (\n !this.renderTargetTextureSize_ ||\n this.renderTargetTextureSize_[0] !== textureSize[0] ||\n this.renderTargetTextureSize_[1] !== textureSize[1]\n ) {\n this.renderTargetTextureSize_ = textureSize;\n\n // create a new texture\n const level = 0;\n const internalFormat = gl.RGBA;\n const border = 0;\n const format = gl.RGBA;\n const type = gl.UNSIGNED_BYTE;\n const data = null;\n gl.bindTexture(gl.TEXTURE_2D, this.renderTargetTexture_);\n gl.texImage2D(\n gl.TEXTURE_2D,\n level,\n internalFormat,\n textureSize[0],\n textureSize[1],\n border,\n format,\n type,\n data,\n );\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n // bind the texture to the framebuffer\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n this.renderTargetTexture_,\n 0,\n );\n\n gl.renderbufferStorage(\n gl.RENDERBUFFER,\n gl.DEPTH_COMPONENT16,\n textureSize[0],\n textureSize[1],\n );\n gl.framebufferRenderbuffer(\n gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.RENDERBUFFER,\n this.depthBuffer_,\n );\n }\n }\n\n /**\n * Render to the next postprocessing pass (or to the canvas if final pass).\n * @param {import(\"../Map.js\").FrameState} frameState current frame state\n * @param {WebGLPostProcessingPass} [nextPass] Next pass, optional\n * @param {function(WebGLRenderingContext, import(\"../Map.js\").FrameState):void} [preCompose] Called before composing.\n * @param {function(WebGLRenderingContext, import(\"../Map.js\").FrameState):void} [postCompose] Called before composing.\n */\n apply(frameState, nextPass, preCompose, postCompose) {\n const gl = this.getGL();\n const size = frameState.size;\n\n gl.bindFramebuffer(\n gl.FRAMEBUFFER,\n nextPass ? nextPass.getFrameBuffer() : null,\n );\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, this.renderTargetTexture_);\n\n if (!nextPass) {\n // clear the canvas if we are the first to render to it\n // and preserveDrawingBuffer is true\n const canvasId = getUid(gl.canvas);\n if (!frameState.renderTargets[canvasId]) {\n const attributes = gl.getContextAttributes();\n if (attributes && attributes.preserveDrawingBuffer) {\n gl.clearColor(0.0, 0.0, 0.0, 0.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n }\n\n frameState.renderTargets[canvasId] = true;\n }\n }\n\n gl.disable(gl.DEPTH_TEST);\n gl.enable(gl.BLEND);\n gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.renderTargetVerticesBuffer_);\n\n gl.useProgram(this.renderTargetProgram_);\n gl.enableVertexAttribArray(this.renderTargetAttribLocation_);\n gl.vertexAttribPointer(\n this.renderTargetAttribLocation_,\n 2,\n gl.FLOAT,\n false,\n 0,\n 0,\n );\n gl.uniform2f(this.renderTargetUniformLocation_, size[0], size[1]);\n gl.uniform1i(this.renderTargetTextureLocation_, 0);\n\n const opacity = frameState.layerStatesArray[frameState.layerIndex].opacity;\n gl.uniform1f(this.renderTargetOpacityLocation_, opacity);\n\n this.applyUniforms(frameState);\n\n if (preCompose) {\n preCompose(gl, frameState);\n }\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n if (postCompose) {\n postCompose(gl, frameState);\n }\n }\n\n /**\n * @return {WebGLFramebuffer} Frame buffer\n */\n getFrameBuffer() {\n return this.frameBuffer_;\n }\n\n /**\n * @return {WebGLRenderbuffer} Depth buffer\n */\n getDepthBuffer() {\n return this.depthBuffer_;\n }\n\n /**\n * Sets the custom uniforms based on what was given in the constructor.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @private\n */\n applyUniforms(frameState) {\n const gl = this.getGL();\n\n let value;\n let textureSlot = 1;\n this.uniforms_.forEach(function (uniform) {\n value =\n typeof uniform.value === 'function'\n ? uniform.value(frameState)\n : uniform.value;\n\n // apply value based on type\n if (value instanceof HTMLCanvasElement || value instanceof ImageData) {\n // create a texture & put data\n if (!uniform.texture) {\n uniform.texture = gl.createTexture();\n }\n gl.activeTexture(gl[`TEXTURE${textureSlot}`]);\n gl.bindTexture(gl.TEXTURE_2D, uniform.texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n if (value instanceof ImageData) {\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n gl.RGBA,\n value.width,\n value.height,\n 0,\n gl.UNSIGNED_BYTE,\n new Uint8Array(value.data),\n );\n } else {\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n value,\n );\n }\n\n // fill texture slots\n gl.uniform1i(uniform.location, textureSlot++);\n } else if (Array.isArray(value)) {\n switch (value.length) {\n case 2:\n gl.uniform2f(uniform.location, value[0], value[1]);\n return;\n case 3:\n gl.uniform3f(uniform.location, value[0], value[1], value[2]);\n return;\n case 4:\n gl.uniform4f(\n uniform.location,\n value[0],\n value[1],\n value[2],\n value[3],\n );\n return;\n default:\n return;\n }\n } else if (typeof value === 'number') {\n gl.uniform1f(uniform.location, value);\n }\n });\n }\n}\n\nexport default WebGLPostProcessingPass;\n","/**\n * @module ol/webgl/Helper\n */\nimport Disposable from '../Disposable.js';\nimport {clear} from '../obj.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../transform.js';\nimport {getUid} from '../util.js';\nimport {create, fromTransform} from '../vec/mat4.js';\nimport ContextEventType from '../webgl/ContextEventType.js';\nimport {\n FLOAT,\n UNSIGNED_BYTE,\n UNSIGNED_INT,\n UNSIGNED_SHORT,\n getContext,\n} from '../webgl.js';\nimport WebGLPostProcessingPass from './PostProcessingPass.js';\n\n/**\n * @typedef {Object} BufferCacheEntry\n * @property {import(\"./Buffer.js\").default} buffer Buffer.\n * @property {WebGLBuffer} webGlBuffer WebGlBuffer.\n */\n\n/**\n * Shader types, either `FRAGMENT_SHADER` or `VERTEX_SHADER`.\n * @enum {number}\n */\nexport const ShaderType = {\n FRAGMENT_SHADER: 0x8b30,\n VERTEX_SHADER: 0x8b31,\n};\n\n/**\n * Names of uniforms made available to all shaders.\n * Please note: changing these *will* break custom shaders!\n * @enum {string}\n */\nexport const DefaultUniform = {\n PROJECTION_MATRIX: 'u_projectionMatrix',\n SCREEN_TO_WORLD_MATRIX: 'u_screenToWorldMatrix',\n TIME: 'u_time',\n ZOOM: 'u_zoom',\n RESOLUTION: 'u_resolution',\n ROTATION: 'u_rotation',\n VIEWPORT_SIZE_PX: 'u_viewportSizePx',\n PIXEL_RATIO: 'u_pixelRatio',\n HIT_DETECTION: 'u_hitDetection',\n};\n\n/**\n * Attribute types, either `UNSIGNED_BYTE`, `UNSIGNED_SHORT`, `UNSIGNED_INT` or `FLOAT`\n * Note: an attribute stored in a `Float32Array` should be of type `FLOAT`.\n * @enum {number}\n */\nexport const AttributeType = {\n UNSIGNED_BYTE: UNSIGNED_BYTE,\n UNSIGNED_SHORT: UNSIGNED_SHORT,\n UNSIGNED_INT: UNSIGNED_INT,\n FLOAT: FLOAT,\n};\n\n/**\n * Description of an attribute in a buffer\n * @typedef {Object} AttributeDescription\n * @property {string} name Attribute name to use in shaders\n * @property {number} size Number of components per attributes\n * @property {AttributeType} [type] Attribute type, i.e. number of bytes used to store the value. This is\n * determined by the class of typed array which the buffer uses (eg. `Float32Array` for a `FLOAT` attribute).\n * Default is `FLOAT`.\n */\n\n/**\n * @typedef {number|Array<number>|HTMLCanvasElement|HTMLImageElement|ImageData|WebGLTexture|import(\"../transform\").Transform} UniformLiteralValue\n */\n\n/**\n * Uniform value can be a number, array of numbers (2 to 4), canvas element or a callback returning\n * one of the previous types.\n * @typedef {UniformLiteralValue|function(import(\"../Map.js\").FrameState):UniformLiteralValue} UniformValue\n */\n\n/**\n * @typedef {Object} PostProcessesOptions\n * @property {number} [scaleRatio] Scale ratio; if < 1, the post process will render to a texture smaller than\n * the main canvas which will then be sampled up (useful for saving resource on blur steps).\n * @property {string} [vertexShader] Vertex shader source\n * @property {string} [fragmentShader] Fragment shader source\n * @property {Object<string,UniformValue>} [uniforms] Uniform definitions for the post process step\n */\n\n/**\n * @typedef {Object} Options\n * @property {Object<string,UniformValue>} [uniforms] Uniform definitions; property names must match the uniform\n * names in the provided or default shaders.\n * @property {Array<PostProcessesOptions>} [postProcesses] Post-processes definitions\n * @property {string} [canvasCacheKey] The cache key for the canvas.\n */\n\n/**\n * @typedef {Object} UniformInternalDescription\n * @property {string} name Name\n * @property {UniformValue} [value] Value\n * @property {UniformValue} [prevValue] The previous value.\n * @property {WebGLTexture} [texture] Texture\n * @private\n */\n\n/**\n * @typedef {Object} CanvasCacheItem\n * @property {WebGLRenderingContext} context The context of this canvas.\n * @property {number} users The count of users of this canvas.\n */\n\n/**\n * @type {Object<string,CanvasCacheItem>}\n */\nconst canvasCache = {};\n\n/**\n * @param {string} key The cache key for the canvas.\n * @return {string} The shared cache key.\n */\nfunction getSharedCanvasCacheKey(key) {\n return 'shared/' + key;\n}\n\nlet uniqueCanvasCacheKeyCount = 0;\n\n/**\n * @return {string} The unique cache key.\n */\nfunction getUniqueCanvasCacheKey() {\n const key = 'unique/' + uniqueCanvasCacheKeyCount;\n uniqueCanvasCacheKeyCount += 1;\n return key;\n}\n\n/**\n * @param {string} key The cache key for the canvas.\n * @return {WebGLRenderingContext} The canvas.\n */\nfunction getOrCreateContext(key) {\n let cacheItem = canvasCache[key];\n if (!cacheItem) {\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n canvas.style.position = 'absolute';\n canvas.style.left = '0';\n const context = getContext(canvas);\n cacheItem = {users: 0, context};\n canvasCache[key] = cacheItem;\n }\n\n cacheItem.users += 1;\n return cacheItem.context;\n}\n\n/**\n * @param {string} key The cache key for the canvas.\n */\nfunction releaseCanvas(key) {\n const cacheItem = canvasCache[key];\n if (!cacheItem) {\n return;\n }\n\n cacheItem.users -= 1;\n if (cacheItem.users > 0) {\n return;\n }\n\n const gl = cacheItem.context;\n const extension = gl.getExtension('WEBGL_lose_context');\n if (extension) {\n extension.loseContext();\n }\n const canvas = gl.canvas;\n canvas.width = 1;\n canvas.height = 1;\n\n delete canvasCache[key];\n}\n\n/**\n * @classdesc\n * This class is intended to provide low-level functions related to WebGL rendering, so that accessing\n * directly the WebGL API should not be required anymore.\n *\n * Several operations are handled by the `WebGLHelper` class:\n *\n * ### Define custom shaders and uniforms\n *\n * Shaders* are low-level programs executed on the GPU and written in GLSL. There are two types of shaders:\n *\n * Vertex shaders are used to manipulate the position and attribute of *vertices* of rendered primitives (ie. corners of a square).\n * Outputs are:\n *\n * `gl_Position`: position of the vertex in screen space\n *\n * Varyings usually prefixed with `v_` are passed on to the fragment shader\n *\n * Fragment shaders are used to control the actual color of the pixels drawn on screen. Their only output is `gl_FragColor`.\n *\n * Both shaders can take *uniforms* or *attributes* as input. Attributes are explained later. Uniforms are common, read-only values that\n * can be changed at every frame and can be of type float, arrays of float or images.\n *\n * Shaders must be compiled and assembled into a program like so:\n * ```js\n * // here we simply create two shaders and assemble them in a program which is then used\n * // for subsequent rendering calls; note how a frameState is required to set up a program,\n * // as several default uniforms are computed from it (projection matrix, zoom level, etc.)\n * const vertexShader = new WebGLVertex(VERTEX_SHADER);\n * const fragmentShader = new WebGLFragment(FRAGMENT_SHADER);\n * const program = this.context.getProgram(fragmentShader, vertexShader);\n * helper.useProgram(this.program, frameState);\n * ```\n *\n * Uniforms are defined using the `uniforms` option and can either be explicit values or callbacks taking the frame state as argument.\n * You can also change their value along the way like so:\n * ```js\n * helper.setUniformFloatValue('u_value', valueAsNumber);\n * ```\n *\n * ### Defining post processing passes\n *\n * Post processing* describes the act of rendering primitives to a texture, and then rendering this texture to the final canvas\n * while applying special effects in screen space.\n * Typical uses are: blurring, color manipulation, depth of field, filtering...\n *\n * The `WebGLHelper` class offers the possibility to define post processes at creation time using the `postProcesses` option.\n * A post process step accepts the following options:\n *\n * `fragmentShader` and `vertexShader`: text literals in GLSL language that will be compiled and used in the post processing step.\n * `uniforms`: uniforms can be defined for the post processing steps just like for the main render.\n * `scaleRatio`: allows using an intermediate texture smaller or higher than the final canvas in the post processing step.\n * This is typically used in blur steps to reduce the performance overhead by using an already downsampled texture as input.\n *\n * The {@link module:ol/webgl/PostProcessingPass~WebGLPostProcessingPass} class is used internally, refer to its documentation for more info.\n *\n * ### Binding WebGL buffers and flushing data into them\n *\n * Data that must be passed to the GPU has to be transferred using {@link module:ol/webgl/Buffer~WebGLArrayBuffer} objects.\n * A buffer has to be created only once, but must be bound every time the buffer content will be used for rendering.\n * This is done using {@link bindBuffer}.\n * When the buffer's array content has changed, the new data has to be flushed to the GPU memory; this is done using\n * {@link flushBufferData}. Note: this operation is expensive and should be done as infrequently as possible.\n *\n * When binding an array buffer, a `target` parameter must be given: it should be either {@link module:ol/webgl.ARRAY_BUFFER}\n * (if the buffer contains vertices data) or {@link module:ol/webgl.ELEMENT_ARRAY_BUFFER} (if the buffer contains indices data).\n *\n * Examples below:\n * ```js\n * // at initialization phase\n * const verticesBuffer = new WebGLArrayBuffer([], DYNAMIC_DRAW);\n * const indicesBuffer = new WebGLArrayBuffer([], DYNAMIC_DRAW);\n *\n * // when array values have changed\n * helper.flushBufferData(ARRAY_BUFFER, this.verticesBuffer);\n * helper.flushBufferData(ELEMENT_ARRAY_BUFFER, this.indicesBuffer);\n *\n * // at rendering phase\n * helper.bindBuffer(ARRAY_BUFFER, this.verticesBuffer);\n * helper.bindBuffer(ELEMENT_ARRAY_BUFFER, this.indicesBuffer);\n * ```\n *\n * ### Specifying attributes\n *\n * The GPU only receives the data as arrays of numbers. These numbers must be handled differently depending on what it describes (position, texture coordinate...).\n * Attributes are used to specify these uses. Specify the attribute names with\n * {@link module:ol/webgl/Helper~WebGLHelper#enableAttributes} (see code snippet below).\n *\n * Please note that you will have to specify the type and offset of the attributes in the data array. You can refer to the documentation of [WebGLRenderingContext.vertexAttribPointer](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer) for more explanation.\n * ```js\n * // here we indicate that the data array has the following structure:\n * // [posX, posY, offsetX, offsetY, texCoordU, texCoordV, posX, posY, ...]\n * helper.enableAttributes([\n * {\n * name: 'a_position',\n * size: 2\n * },\n * {\n * name: 'a_offset',\n * size: 2\n * },\n * {\n * name: 'a_texCoord',\n * size: 2\n * }\n * ])\n * ```\n *\n * ### Rendering primitives\n *\n * Once all the steps above have been achieved, rendering primitives to the screen is done using {@link prepareDraw}, {@link drawElements} and {@link finalizeDraw}.\n * ```js\n * // frame preparation step\n * helper.prepareDraw(frameState);\n *\n * // call this for every data array that has to be rendered on screen\n * helper.drawElements(0, this.indicesBuffer.getArray().length);\n *\n * // finalize the rendering by applying post processes\n * helper.finalizeDraw(frameState);\n * ```\n *\n * For an example usage of this class, refer to {@link module:ol/renderer/webgl/PointsLayer~WebGLPointsLayerRenderer}.\n */\nclass WebGLHelper extends Disposable {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n options = options || {};\n\n /** @private */\n this.boundHandleWebGLContextLost_ = this.handleWebGLContextLost.bind(this);\n\n /** @private */\n this.boundHandleWebGLContextRestored_ =\n this.handleWebGLContextRestored.bind(this);\n\n /**\n * @private\n * @type {string}\n */\n this.canvasCacheKey_ = options.canvasCacheKey\n ? getSharedCanvasCacheKey(options.canvasCacheKey)\n : getUniqueCanvasCacheKey();\n\n /**\n * @private\n * @type {WebGLRenderingContext}\n */\n this.gl_ = getOrCreateContext(this.canvasCacheKey_);\n\n /**\n * @private\n * @type {!Object<string, BufferCacheEntry>}\n */\n this.bufferCache_ = {};\n\n /**\n * @private\n * @type {Object<string, Object>}\n */\n this.extensionCache_ = {};\n\n /**\n * @private\n * @type {WebGLProgram}\n */\n this.currentProgram_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.needsToBeRecreated_ = false;\n\n const canvas = this.gl_.canvas;\n\n canvas.addEventListener(\n ContextEventType.LOST,\n this.boundHandleWebGLContextLost_,\n );\n canvas.addEventListener(\n ContextEventType.RESTORED,\n this.boundHandleWebGLContextRestored_,\n );\n\n /**\n * @private\n * @type {import(\"../transform.js\").Transform}\n */\n this.offsetRotateMatrix_ = createTransform();\n\n /**\n * @private\n * @type {import(\"../transform.js\").Transform}\n */\n this.offsetScaleMatrix_ = createTransform();\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.tmpMat4_ = create();\n\n /**\n * @private\n * @type {Object<string, Object<string, WebGLUniformLocation>>}\n */\n this.uniformLocationsByProgram_ = {};\n\n /**\n * @private\n * @type {Object<string, Object<string, number>>}\n */\n this.attribLocationsByProgram_ = {};\n\n /**\n * Holds info about custom uniforms used in the post processing pass.\n * If the uniform is a texture, the WebGL Texture object will be stored here.\n * @type {Array<UniformInternalDescription>}\n * @private\n */\n this.uniforms_ = [];\n if (options.uniforms) {\n this.setUniforms(options.uniforms);\n }\n\n /**\n * An array of PostProcessingPass objects is kept in this variable, built from the steps provided in the\n * options. If no post process was given, a default one is used (so as not to have to make an exception to\n * the frame buffer logic).\n * @type {Array<WebGLPostProcessingPass>}\n * @private\n */\n this.postProcessPasses_ = options.postProcesses\n ? options.postProcesses.map(\n (options) =>\n new WebGLPostProcessingPass({\n webGlContext: this.gl_,\n scaleRatio: options.scaleRatio,\n vertexShader: options.vertexShader,\n fragmentShader: options.fragmentShader,\n uniforms: options.uniforms,\n }),\n )\n : [new WebGLPostProcessingPass({webGlContext: this.gl_})];\n\n /**\n * @type {string|null}\n * @private\n */\n this.shaderCompileErrors_ = null;\n\n /**\n * @type {number}\n * @private\n */\n this.startTime_ = Date.now();\n\n /**\n * @type {number}\n * @private\n */\n this.maxAttributeCount_ = this.gl_.getParameter(\n this.gl_.MAX_VERTEX_ATTRIBS,\n );\n }\n\n /**\n * @param {Object<string, UniformValue>} uniforms Uniform definitions.\n */\n setUniforms(uniforms) {\n this.uniforms_ = [];\n this.addUniforms(uniforms);\n }\n\n /**\n * @param {Object<string, UniformValue>} uniforms Uniform definitions.\n */\n addUniforms(uniforms) {\n for (const name in uniforms) {\n this.uniforms_.push({\n name: name,\n value: uniforms[name],\n });\n }\n }\n\n /**\n * @param {string} canvasCacheKey The canvas cache key.\n * @return {boolean} The provided key matches the one this helper was constructed with.\n */\n canvasCacheKeyMatches(canvasCacheKey) {\n return this.canvasCacheKey_ === getSharedCanvasCacheKey(canvasCacheKey);\n }\n\n /**\n * Get a WebGL extension. If the extension is not supported, null is returned.\n * Extensions are cached after they are enabled for the first time.\n * @param {string} name The extension name.\n * @return {Object|null} The extension or null if not supported.\n */\n getExtension(name) {\n if (name in this.extensionCache_) {\n return this.extensionCache_[name];\n }\n const extension = this.gl_.getExtension(name);\n this.extensionCache_[name] = extension;\n return extension;\n }\n\n /**\n * Just bind the buffer if it's in the cache. Otherwise create\n * the WebGL buffer, bind it, populate it, and add an entry to\n * the cache.\n * @param {import(\"./Buffer\").default} buffer Buffer.\n */\n bindBuffer(buffer) {\n const gl = this.gl_;\n const bufferKey = getUid(buffer);\n let bufferCache = this.bufferCache_[bufferKey];\n if (!bufferCache) {\n const webGlBuffer = gl.createBuffer();\n bufferCache = {\n buffer: buffer,\n webGlBuffer: webGlBuffer,\n };\n this.bufferCache_[bufferKey] = bufferCache;\n }\n gl.bindBuffer(buffer.getType(), bufferCache.webGlBuffer);\n }\n\n /**\n * Update the data contained in the buffer array; this is required for the\n * new data to be rendered\n * @param {import(\"./Buffer\").default} buffer Buffer.\n */\n flushBufferData(buffer) {\n const gl = this.gl_;\n this.bindBuffer(buffer);\n gl.bufferData(buffer.getType(), buffer.getArray(), buffer.getUsage());\n }\n\n /**\n * @param {import(\"./Buffer.js\").default} buf Buffer.\n */\n deleteBuffer(buf) {\n const bufferKey = getUid(buf);\n // Note: gl.deleteBuffer is not called here since we let WebGL garbage collect it automatically\n delete this.bufferCache_[bufferKey];\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n const canvas = this.gl_.canvas;\n canvas.removeEventListener(\n ContextEventType.LOST,\n this.boundHandleWebGLContextLost_,\n );\n canvas.removeEventListener(\n ContextEventType.RESTORED,\n this.boundHandleWebGLContextRestored_,\n );\n\n releaseCanvas(this.canvasCacheKey_);\n\n delete this.gl_;\n }\n\n /**\n * Clear the buffer & set the viewport to draw.\n * Post process passes will be initialized here, the first one being bound as a render target for\n * subsequent draw calls.\n * @param {import(\"../Map.js\").FrameState} frameState current frame state\n * @param {boolean} [disableAlphaBlend] If true, no alpha blending will happen.\n * @param {boolean} [enableDepth] If true, enables depth testing.\n */\n prepareDraw(frameState, disableAlphaBlend, enableDepth) {\n const gl = this.gl_;\n const canvas = this.getCanvas();\n const size = frameState.size;\n const pixelRatio = frameState.pixelRatio;\n\n if (\n canvas.width !== size[0] * pixelRatio ||\n canvas.height !== size[1] * pixelRatio\n ) {\n canvas.width = size[0] * pixelRatio;\n canvas.height = size[1] * pixelRatio;\n canvas.style.width = size[0] + 'px';\n canvas.style.height = size[1] + 'px';\n }\n\n // loop backwards in post processes list\n for (let i = this.postProcessPasses_.length - 1; i >= 0; i--) {\n this.postProcessPasses_[i].init(frameState);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, null);\n\n gl.clearColor(0.0, 0.0, 0.0, 0.0);\n gl.depthRange(0.0, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n gl.enable(gl.BLEND);\n gl.blendFunc(gl.ONE, disableAlphaBlend ? gl.ZERO : gl.ONE_MINUS_SRC_ALPHA);\n if (enableDepth) {\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n } else {\n gl.disable(gl.DEPTH_TEST);\n }\n }\n\n /**\n * @param {WebGLFramebuffer|null} frameBuffer The frame buffer.\n * @param {WebGLTexture} [texture] The texture.\n */\n bindFrameBuffer(frameBuffer, texture) {\n const gl = this.getGL();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n if (texture) {\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0,\n );\n }\n }\n\n /**\n * Bind the frame buffer from the initial render.\n */\n bindInitialFrameBuffer() {\n const gl = this.getGL();\n const frameBuffer = this.postProcessPasses_[0].getFrameBuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n const texture = this.postProcessPasses_[0].getRenderTargetTexture();\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n texture,\n 0,\n );\n }\n\n /**\n * Prepare a program to use a texture.\n * @param {WebGLTexture} texture The texture.\n * @param {number} slot The texture slot.\n * @param {string} uniformName The corresponding uniform name.\n */\n bindTexture(texture, slot, uniformName) {\n const gl = this.gl_;\n gl.activeTexture(gl.TEXTURE0 + slot);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.uniform1i(this.getUniformLocation(uniformName), slot);\n }\n\n /**\n * Set up an attribute array buffer for use in the vertex shader.\n * @param {import(\"./Buffer\").default} buffer The buffer.\n * @param {string} attributeName The attribute name.\n * @param {number} size The number of components per attribute vertex.\n */\n bindAttribute(buffer, attributeName, size) {\n const gl = this.getGL();\n this.bindBuffer(buffer);\n const index = this.getAttributeLocation(attributeName);\n gl.enableVertexAttribArray(index);\n gl.vertexAttribPointer(index, size, gl.FLOAT, false, 0, 0);\n }\n\n /**\n * Clear the render target & bind it for future draw operations.\n * This is similar to `prepareDraw`, only post processes will not be applied.\n * Note: the whole viewport will be drawn to the render target, regardless of its size.\n * @param {import(\"../Map.js\").FrameState} frameState current frame state\n * @param {import(\"./RenderTarget.js\").default} renderTarget Render target to draw to\n * @param {boolean} [disableAlphaBlend] If true, no alpha blending will happen.\n * @param {boolean} [enableDepth] If true, enables depth testing.\n */\n prepareDrawToRenderTarget(\n frameState,\n renderTarget,\n disableAlphaBlend,\n enableDepth,\n ) {\n const gl = this.gl_;\n const size = renderTarget.getSize();\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, renderTarget.getFramebuffer());\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderTarget.getDepthbuffer());\n gl.viewport(0, 0, size[0], size[1]);\n gl.bindTexture(gl.TEXTURE_2D, renderTarget.getTexture());\n gl.clearColor(0.0, 0.0, 0.0, 0.0);\n gl.depthRange(0.0, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n gl.enable(gl.BLEND);\n gl.blendFunc(gl.ONE, disableAlphaBlend ? gl.ZERO : gl.ONE_MINUS_SRC_ALPHA);\n if (enableDepth) {\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n } else {\n gl.disable(gl.DEPTH_TEST);\n }\n }\n\n /**\n * Execute a draw call based on the currently bound program, texture, buffers, attributes.\n * @param {number} start Start index.\n * @param {number} end End index.\n */\n drawElements(start, end) {\n const gl = this.gl_;\n this.getExtension('OES_element_index_uint');\n\n const elementType = gl.UNSIGNED_INT;\n const elementSize = 4;\n\n const numItems = end - start;\n const offsetInBytes = start * elementSize;\n gl.drawElements(gl.TRIANGLES, numItems, elementType, offsetInBytes);\n }\n\n /**\n * Apply the successive post process passes which will eventually render to the actual canvas.\n * @param {import(\"../Map.js\").FrameState} frameState current frame state\n * @param {function(WebGLRenderingContext, import(\"../Map.js\").FrameState):void} [preCompose] Called before composing.\n * @param {function(WebGLRenderingContext, import(\"../Map.js\").FrameState):void} [postCompose] Called before composing.\n */\n finalizeDraw(frameState, preCompose, postCompose) {\n // apply post processes using the next one as target\n for (let i = 0, ii = this.postProcessPasses_.length; i < ii; i++) {\n if (i === ii - 1) {\n this.postProcessPasses_[i].apply(\n frameState,\n null,\n preCompose,\n postCompose,\n );\n } else {\n this.postProcessPasses_[i].apply(\n frameState,\n this.postProcessPasses_[i + 1],\n );\n }\n }\n }\n\n /**\n * @return {HTMLCanvasElement} Canvas.\n */\n getCanvas() {\n return /** @type {HTMLCanvasElement} */ (this.gl_.canvas);\n }\n\n /**\n * Get the WebGL rendering context\n * @return {WebGLRenderingContext} The rendering context.\n */\n getGL() {\n return this.gl_;\n }\n\n /**\n * Sets the default matrix uniforms for a given frame state. This is called internally in `prepareDraw`.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n applyFrameState(frameState) {\n const size = frameState.size;\n const rotation = frameState.viewState.rotation;\n const pixelRatio = frameState.pixelRatio;\n\n this.setUniformFloatValue(\n DefaultUniform.TIME,\n (Date.now() - this.startTime_) * 0.001,\n );\n this.setUniformFloatValue(DefaultUniform.ZOOM, frameState.viewState.zoom);\n this.setUniformFloatValue(\n DefaultUniform.RESOLUTION,\n frameState.viewState.resolution,\n );\n this.setUniformFloatValue(DefaultUniform.PIXEL_RATIO, pixelRatio);\n this.setUniformFloatVec2(DefaultUniform.VIEWPORT_SIZE_PX, [\n size[0],\n size[1],\n ]);\n this.setUniformFloatValue(DefaultUniform.ROTATION, rotation);\n }\n\n /**\n * Sets the `u_hitDetection` uniform.\n * @param {boolean} enabled Whether to enable the hit detection code path\n */\n applyHitDetectionUniform(enabled) {\n const loc = this.getUniformLocation(DefaultUniform.HIT_DETECTION);\n this.getGL().uniform1i(loc, enabled ? 1 : 0);\n\n // hit detection uses a fixed pixel ratio\n if (enabled) {\n this.setUniformFloatValue(DefaultUniform.PIXEL_RATIO, 0.5);\n }\n }\n\n /**\n * Sets the custom uniforms based on what was given in the constructor. This is called internally in `prepareDraw`.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n applyUniforms(frameState) {\n const gl = this.gl_;\n\n let value;\n let textureSlot = 0;\n this.uniforms_.forEach((uniform) => {\n value =\n typeof uniform.value === 'function'\n ? uniform.value(frameState)\n : uniform.value;\n\n // apply value based on type\n if (\n value instanceof HTMLCanvasElement ||\n value instanceof HTMLImageElement ||\n value instanceof ImageData ||\n value instanceof WebGLTexture\n ) {\n // create a texture & put data\n if (value instanceof WebGLTexture && !uniform.texture) {\n uniform.prevValue = undefined;\n uniform.texture = value;\n } else if (!uniform.texture) {\n uniform.prevValue = undefined;\n uniform.texture = gl.createTexture();\n }\n this.bindTexture(uniform.texture, textureSlot, uniform.name);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n const imageReady =\n !(value instanceof HTMLImageElement) ||\n /** @type {HTMLImageElement} */ (value).complete;\n if (\n !(value instanceof WebGLTexture) &&\n imageReady &&\n uniform.prevValue !== value\n ) {\n uniform.prevValue = value;\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n value,\n );\n }\n textureSlot++;\n } else if (Array.isArray(value) && value.length === 6) {\n this.setUniformMatrixValue(\n uniform.name,\n fromTransform(this.tmpMat4_, value),\n );\n } else if (Array.isArray(value) && value.length <= 4) {\n switch (value.length) {\n case 2:\n gl.uniform2f(\n this.getUniformLocation(uniform.name),\n value[0],\n value[1],\n );\n return;\n case 3:\n gl.uniform3f(\n this.getUniformLocation(uniform.name),\n value[0],\n value[1],\n value[2],\n );\n return;\n case 4:\n gl.uniform4f(\n this.getUniformLocation(uniform.name),\n value[0],\n value[1],\n value[2],\n value[3],\n );\n return;\n default:\n return;\n }\n } else if (typeof value === 'number') {\n gl.uniform1f(this.getUniformLocation(uniform.name), value);\n }\n });\n }\n\n /**\n * Set up a program for use. The program will be set as the current one. Then, the uniforms used\n * in the program will be set based on the current frame state and the helper configuration.\n * @param {WebGLProgram} program Program.\n * @param {import(\"../Map.js\").FrameState} [frameState] Frame state.\n */\n useProgram(program, frameState) {\n this.disableAllAttributes_();\n const gl = this.gl_;\n gl.useProgram(program);\n this.currentProgram_ = program;\n if (frameState) {\n this.applyFrameState(frameState);\n this.applyUniforms(frameState);\n }\n }\n\n /**\n * Will attempt to compile a vertex or fragment shader based on source\n * On error, the shader will be returned but\n * `gl.getShaderParameter(shader, gl.COMPILE_STATUS)` will return `true`\n * Use `gl.getShaderInfoLog(shader)` to have details\n * @param {string} source Shader source\n * @param {ShaderType} type VERTEX_SHADER or FRAGMENT_SHADER\n * @return {WebGLShader} Shader object\n */\n compileShader(source, type) {\n const gl = this.gl_;\n const shader = gl.createShader(type);\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n return shader;\n }\n\n /**\n * Create a program for a vertex and fragment shader. Throws if shader compilation fails.\n * @param {string} fragmentShaderSource Fragment shader source.\n * @param {string} vertexShaderSource Vertex shader source.\n * @return {WebGLProgram} Program\n */\n getProgram(fragmentShaderSource, vertexShaderSource) {\n const gl = this.gl_;\n\n const fragmentShader = this.compileShader(\n fragmentShaderSource,\n gl.FRAGMENT_SHADER,\n );\n\n const vertexShader = this.compileShader(\n vertexShaderSource,\n gl.VERTEX_SHADER,\n );\n\n const program = gl.createProgram();\n gl.attachShader(program, fragmentShader);\n gl.attachShader(program, vertexShader);\n gl.linkProgram(program);\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n const message = `Fragment shader compilation failed: ${gl.getShaderInfoLog(\n fragmentShader,\n )}`;\n throw new Error(message);\n }\n gl.deleteShader(fragmentShader);\n\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n const message = `Vertex shader compilation failed: ${gl.getShaderInfoLog(\n vertexShader,\n )}`;\n throw new Error(message);\n }\n gl.deleteShader(vertexShader);\n\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n const message = `GL program linking failed: ${gl.getProgramInfoLog(\n program,\n )}`;\n throw new Error(message);\n }\n\n return program;\n }\n\n /**\n * Will get the location from the shader or the cache\n * @param {string} name Uniform name\n * @return {WebGLUniformLocation} uniformLocation\n */\n getUniformLocation(name) {\n const programUid = getUid(this.currentProgram_);\n if (this.uniformLocationsByProgram_[programUid] === undefined) {\n this.uniformLocationsByProgram_[programUid] = {};\n }\n if (this.uniformLocationsByProgram_[programUid][name] === undefined) {\n this.uniformLocationsByProgram_[programUid][name] =\n this.gl_.getUniformLocation(this.currentProgram_, name);\n }\n return this.uniformLocationsByProgram_[programUid][name];\n }\n\n /**\n * Will get the location from the shader or the cache\n * @param {string} name Attribute name\n * @return {number} attribLocation\n */\n getAttributeLocation(name) {\n const programUid = getUid(this.currentProgram_);\n if (this.attribLocationsByProgram_[programUid] === undefined) {\n this.attribLocationsByProgram_[programUid] = {};\n }\n if (this.attribLocationsByProgram_[programUid][name] === undefined) {\n this.attribLocationsByProgram_[programUid][name] =\n this.gl_.getAttribLocation(this.currentProgram_, name);\n }\n return this.attribLocationsByProgram_[programUid][name];\n }\n\n /**\n * Sets the given transform to apply the rotation/translation/scaling of the given frame state.\n * The resulting transform can be used to convert world space coordinates to view coordinates in the [-1, 1] range.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../transform\").Transform} transform Transform to update.\n * @return {import(\"../transform\").Transform} The updated transform object.\n */\n makeProjectionTransform(frameState, transform) {\n const size = frameState.size;\n const rotation = frameState.viewState.rotation;\n const resolution = frameState.viewState.resolution;\n const center = frameState.viewState.center;\n composeTransform(\n transform,\n 0,\n 0,\n 2 / (resolution * size[0]),\n 2 / (resolution * size[1]),\n -rotation,\n -center[0],\n -center[1],\n );\n return transform;\n }\n\n /**\n * Give a value for a standard float uniform\n * @param {string} uniform Uniform name\n * @param {number} value Value\n */\n setUniformFloatValue(uniform, value) {\n this.gl_.uniform1f(this.getUniformLocation(uniform), value);\n }\n\n /**\n * Give a value for a vec2 uniform\n * @param {string} uniform Uniform name\n * @param {Array<number>} value Array of length 4.\n */\n setUniformFloatVec2(uniform, value) {\n this.gl_.uniform2fv(this.getUniformLocation(uniform), value);\n }\n\n /**\n * Give a value for a vec4 uniform\n * @param {string} uniform Uniform name\n * @param {Array<number>} value Array of length 4.\n */\n setUniformFloatVec4(uniform, value) {\n this.gl_.uniform4fv(this.getUniformLocation(uniform), value);\n }\n\n /**\n * Give a value for a standard matrix4 uniform\n * @param {string} uniform Uniform name\n * @param {Array<number>} value Matrix value\n */\n setUniformMatrixValue(uniform, value) {\n this.gl_.uniformMatrix4fv(this.getUniformLocation(uniform), false, value);\n }\n\n /**\n * Disable all vertex attributes.\n * @private\n */\n disableAllAttributes_() {\n for (let i = 0; i < this.maxAttributeCount_; i++) {\n this.gl_.disableVertexAttribArray(i);\n }\n }\n\n /**\n * Will set the currently bound buffer to an attribute of the shader program. Used by `#enableAttributes`\n * internally.\n * @param {string} attribName Attribute name\n * @param {number} size Number of components per attributes\n * @param {number} type UNSIGNED_INT, UNSIGNED_BYTE, UNSIGNED_SHORT or FLOAT\n * @param {number} stride Stride in bytes (0 means attribs are packed)\n * @param {number} offset Offset in bytes\n * @private\n */\n enableAttributeArray_(attribName, size, type, stride, offset) {\n const location = this.getAttributeLocation(attribName);\n // the attribute has not been found in the shaders or is not used; do not enable it\n if (location < 0) {\n return;\n }\n this.gl_.enableVertexAttribArray(location);\n this.gl_.vertexAttribPointer(location, size, type, false, stride, offset);\n }\n\n /**\n * Will enable the following attributes to be read from the currently bound buffer,\n * i.e. tell the GPU where to read the different attributes in the buffer. An error in the\n * size/type/order of attributes will most likely break the rendering and throw a WebGL exception.\n * @param {Array<AttributeDescription>} attributes Ordered list of attributes to read from the buffer\n */\n enableAttributes(attributes) {\n const stride = computeAttributesStride(attributes);\n let offset = 0;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes[i];\n this.enableAttributeArray_(\n attr.name,\n attr.size,\n attr.type || FLOAT,\n stride,\n offset,\n );\n offset += attr.size * getByteSizeFromType(attr.type);\n }\n }\n\n /**\n * WebGL context was lost\n * @param {WebGLContextEvent} event The context loss event.\n * @private\n */\n handleWebGLContextLost(event) {\n clear(this.bufferCache_);\n this.currentProgram_ = null;\n\n event.preventDefault();\n }\n\n /**\n * WebGL context was restored\n * @private\n */\n handleWebGLContextRestored() {\n this.needsToBeRecreated_ = true;\n }\n\n /**\n * Returns whether this helper needs to be recreated, as the context was lost and then restored.\n * @return {boolean} Whether this helper needs to be recreated.\n */\n needsToBeRecreated() {\n return this.needsToBeRecreated_;\n }\n\n /**\n * Will create or reuse a given webgl texture and apply the given size. If no image data\n * specified, the texture will be empty, otherwise image data will be used and the `size`\n * parameter will be ignored. If a Uint8Array is provided for data, a size must also be provided.\n * Note: wrap parameters are set to clamp to edge, min filter is set to linear.\n * @param {Array<number>} size Expected size of the texture\n * @param {ImageData|HTMLImageElement|HTMLCanvasElement|Uint8Array|null} data Image data/object to bind to the texture\n * @param {WebGLTexture} [texture] Existing texture to reuse\n * @param {boolean} [nearest] Use gl.NEAREST for min/mag filter.\n * @return {WebGLTexture} The generated texture\n */\n createTexture(size, data, texture, nearest) {\n const gl = this.gl_;\n texture = texture || gl.createTexture();\n const filter = nearest ? gl.NEAREST : gl.LINEAR;\n\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n const level = 0;\n const internalFormat = gl.RGBA;\n const border = 0;\n const format = gl.RGBA;\n const type = gl.UNSIGNED_BYTE;\n\n if (data instanceof Uint8Array) {\n gl.texImage2D(\n gl.TEXTURE_2D,\n level,\n internalFormat,\n size[0],\n size[1],\n border,\n format,\n type,\n data,\n );\n } else if (data) {\n gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, format, type, data);\n } else {\n gl.texImage2D(\n gl.TEXTURE_2D,\n level,\n internalFormat,\n size[0],\n size[1],\n border,\n format,\n type,\n null,\n );\n }\n return texture;\n }\n}\n\n/**\n * Compute a stride in bytes based on a list of attributes\n * @param {Array<AttributeDescription>} attributes Ordered list of attributes\n * @return {number} Stride, ie amount of values for each vertex in the vertex buffer\n */\nexport function computeAttributesStride(attributes) {\n let stride = 0;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes[i];\n stride += attr.size * getByteSizeFromType(attr.type);\n }\n return stride;\n}\n\n/**\n * Computes the size in byte of an attribute type.\n * @param {AttributeType} type Attribute type\n * @return {number} The size in bytes\n */\nfunction getByteSizeFromType(type) {\n switch (type) {\n case AttributeType.UNSIGNED_BYTE:\n return Uint8Array.BYTES_PER_ELEMENT;\n case AttributeType.UNSIGNED_SHORT:\n return Uint16Array.BYTES_PER_ELEMENT;\n case AttributeType.UNSIGNED_INT:\n return Uint32Array.BYTES_PER_ELEMENT;\n case AttributeType.FLOAT:\n default:\n return Float32Array.BYTES_PER_ELEMENT;\n }\n}\n\nexport default WebGLHelper;\n","/**\n * @module ol/webgl/PaletteTexture\n */\n\nclass PaletteTexture {\n /**\n * @param {string} name The name of the texture.\n * @param {Uint8Array} data The texture data.\n */\n constructor(name, data) {\n this.name = name;\n this.data = data;\n\n /**\n * @type {WebGLTexture|null}\n * @private\n */\n this.texture_ = null;\n }\n\n /**\n * @param {WebGLRenderingContext} gl Rendering context.\n * @return {WebGLTexture} The texture.\n */\n getTexture(gl) {\n if (!this.texture_) {\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n this.data.length / 4,\n 1,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n this.data,\n );\n this.texture_ = texture;\n }\n return this.texture_;\n }\n\n /**\n * @param {WebGLRenderingContext} gl Rendering context.\n */\n delete(gl) {\n if (this.texture_) {\n gl.deleteTexture(this.texture_);\n }\n this.texture_ = null;\n }\n}\n\nexport default PaletteTexture;\n","/**\n * A wrapper class to simplify rendering to a texture instead of the final canvas\n * @module ol/webgl/RenderTarget\n */\nimport {equals} from '../array.js';\n\n// for pixel color reading\nconst tmpArray4 = new Uint8Array(4);\n\n/**\n * @classdesc\n * This class is a wrapper around the association of both a `WebGLTexture` and a `WebGLFramebuffer` instances,\n * simplifying initialization and binding for rendering.\n */\nclass WebGLRenderTarget {\n /**\n * @param {import(\"./Helper.js\").default} helper WebGL helper; mandatory.\n * @param {Array<number>} [size] Expected size of the render target texture; note: this can be changed later on.\n */\n constructor(helper, size) {\n /**\n * @private\n * @type {import(\"./Helper.js\").default}\n */\n this.helper_ = helper;\n const gl = helper.getGL();\n\n /**\n * @private\n * @type {WebGLTexture}\n */\n this.texture_ = gl.createTexture();\n\n /**\n * @private\n * @type {WebGLFramebuffer}\n */\n this.framebuffer_ = gl.createFramebuffer();\n\n /**\n * @private\n * @type {WebGLRenderbuffer}\n */\n this.depthbuffer_ = gl.createRenderbuffer();\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.size_ = size || [1, 1];\n\n /**\n * @type {Uint8Array}\n * @private\n */\n this.data_ = new Uint8Array(0);\n\n /**\n * @type {boolean}\n * @private\n */\n this.dataCacheDirty_ = true;\n\n this.updateSize_();\n }\n\n /**\n * Changes the size of the render target texture. Note: will do nothing if the size\n * is already the same.\n * @param {Array<number>} size Expected size of the render target texture\n */\n setSize(size) {\n if (equals(size, this.size_)) {\n return;\n }\n this.size_[0] = size[0];\n this.size_[1] = size[1];\n this.updateSize_();\n }\n\n /**\n * Returns the size of the render target texture\n * @return {Array<number>} Size of the render target texture\n */\n getSize() {\n return this.size_;\n }\n\n /**\n * This will cause following calls to `#readAll` or `#readPixel` to download the content of the\n * render target into memory, which is an expensive operation.\n * This content will be kept in cache but should be cleared after each new render.\n */\n clearCachedData() {\n this.dataCacheDirty_ = true;\n }\n\n /**\n * Returns the full content of the frame buffer as a series of r, g, b, a components\n * in the 0-255 range (unsigned byte).\n * @return {Uint8Array} Integer array of color values\n */\n readAll() {\n if (this.dataCacheDirty_) {\n const size = this.size_;\n const gl = this.helper_.getGL();\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer_);\n gl.readPixels(\n 0,\n 0,\n size[0],\n size[1],\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n this.data_,\n );\n this.dataCacheDirty_ = false;\n }\n return this.data_;\n }\n\n /**\n * Reads one pixel of the frame buffer as an array of r, g, b, a components\n * in the 0-255 range (unsigned byte).\n * If x and/or y are outside of existing data, an array filled with 0 is returned.\n * @param {number} x Pixel coordinate\n * @param {number} y Pixel coordinate\n * @return {Uint8Array} Integer array with one color value (4 components)\n */\n readPixel(x, y) {\n if (x < 0 || y < 0 || x > this.size_[0] || y >= this.size_[1]) {\n tmpArray4[0] = 0;\n tmpArray4[1] = 0;\n tmpArray4[2] = 0;\n tmpArray4[3] = 0;\n return tmpArray4;\n }\n\n this.readAll();\n const index =\n Math.floor(x) + (this.size_[1] - Math.floor(y) - 1) * this.size_[0];\n tmpArray4[0] = this.data_[index * 4];\n tmpArray4[1] = this.data_[index * 4 + 1];\n tmpArray4[2] = this.data_[index * 4 + 2];\n tmpArray4[3] = this.data_[index * 4 + 3];\n return tmpArray4;\n }\n\n /**\n * @return {WebGLTexture} Texture to render to\n */\n getTexture() {\n return this.texture_;\n }\n\n /**\n * @return {WebGLFramebuffer} Frame buffer of the render target\n */\n getFramebuffer() {\n return this.framebuffer_;\n }\n\n /**\n * @return {WebGLRenderbuffer} Depth buffer of the render target\n */\n getDepthbuffer() {\n return this.depthbuffer_;\n }\n\n /**\n * @private\n */\n updateSize_() {\n const size = this.size_;\n const gl = this.helper_.getGL();\n\n this.texture_ = this.helper_.createTexture(size, null, this.texture_);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer_);\n gl.viewport(0, 0, size[0], size[1]);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0,\n gl.TEXTURE_2D,\n this.texture_,\n 0,\n );\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.depthbuffer_);\n gl.renderbufferStorage(\n gl.RENDERBUFFER,\n gl.DEPTH_COMPONENT16,\n size[0],\n size[1],\n );\n gl.framebufferRenderbuffer(\n gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.RENDERBUFFER,\n this.depthbuffer_,\n );\n\n this.data_ = new Uint8Array(size[0] * size[1] * 4);\n }\n}\n\nexport default WebGLRenderTarget;\n","/**\n * @module ol/render/webgl/MixedGeometryBatch\n */\nimport {inflateEnds} from '../../geom/flat/orient.js';\nimport RenderFeature from '../../render/Feature.js';\nimport {getUid} from '../../util.js';\n\n/**\n * @typedef {import(\"../../Feature.js\").default} Feature\n */\n/**\n * @typedef {import(\"../../geom/Geometry.js\").Type} GeometryType\n */\n\n/**\n * @typedef {Object} GeometryBatchItem Object that holds a reference to a feature as well as the raw coordinates of its various geometries\n * @property {Feature|RenderFeature} feature Feature\n * @property {Array<Array<number>>} flatCoordss Array of flat coordinates arrays, one for each geometry related to the feature\n * @property {number} [verticesCount] Only defined for linestring and polygon batches\n * @property {number} [ringsCount] Only defined for polygon batches\n * @property {Array<Array<number>>} [ringsVerticesCounts] Array of vertices counts in each ring for each geometry; only defined for polygons batches\n * @property {number} [ref] The reference in the global batch (used for hit detection)\n */\n\n/**\n * @typedef {PointGeometryBatch|LineStringGeometryBatch|PolygonGeometryBatch} GeometryBatch\n */\n\n/**\n * @typedef {Object} PolygonGeometryBatch A geometry batch specific to polygons\n * @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.\n * One entry corresponds to one feature. Key is feature uid.\n * @property {number} geometriesCount Amount of geometries in the batch.\n * @property {number} verticesCount Amount of vertices from geometries in the batch.\n * @property {number} ringsCount How many outer and inner rings in this batch.\n */\n\n/**\n * @typedef {Object} LineStringGeometryBatch A geometry batch specific to lines\n * @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.\n * One entry corresponds to one feature. Key is feature uid.\n * @property {number} geometriesCount Amount of geometries in the batch.\n * @property {number} verticesCount Amount of vertices from geometries in the batch.\n */\n\n/**\n * @typedef {Object} PointGeometryBatch A geometry batch specific to points\n * @property {Object<string, GeometryBatchItem>} entries Dictionary of all entries in the batch with associated computed values.\n * One entry corresponds to one feature. Key is feature uid.\n * @property {number} geometriesCount Amount of geometries in the batch.\n */\n\n/**\n * @classdesc This class is used to group several geometries of various types together for faster rendering.\n * Three inner batches are maintained for polygons, lines and points. Each time a feature is added, changed or removed\n * from the batch, these inner batches are modified accordingly in order to keep them up-to-date.\n *\n * A feature can be present in several inner batches, for example a polygon geometry will be present in the polygon batch\n * and its linear rings will be present in the line batch. Multi geometries are also broken down into individual geometries\n * and added to the corresponding batches in a recursive manner.\n *\n * Corresponding {@link module:ol/render/webgl/BatchRenderer} instances are then used to generate the render instructions\n * and WebGL buffers (vertices and indices) for each inner batches; render instructions are stored on the inner batches,\n * alongside the transform used to convert world coords to screen coords at the time these instructions were generated.\n * The resulting WebGL buffers are stored on the batches as well.\n *\n * An important aspect of geometry batches is that there is no guarantee that render instructions and WebGL buffers\n * are synchronized, i.e. render instructions can describe a new state while WebGL buffers might not have been written yet.\n * This is why two world-to-screen transforms are stored on each batch: one for the render instructions and one for\n * the WebGL buffers.\n */\nclass MixedGeometryBatch {\n constructor() {\n /**\n * @private\n */\n this.globalCounter_ = 0;\n\n /**\n * Refs are used as keys for hit detection.\n * @type {Map<number, Feature|RenderFeature>}\n * @private\n */\n this.refToFeature_ = new Map();\n\n /**\n * Features are split in \"entries\", which are individual geometries. We use the following map to share a single ref for all those entries.\n * @type {Map<string, number>}\n * @private\n */\n this.uidToRef_ = new Map();\n\n /**\n * The precision in WebGL shaders is limited.\n * To keep the refs as small as possible we maintain an array of freed up references.\n * @type {Array<number>}\n * @private\n */\n this.freeGlobalRef_ = [];\n\n /**\n * @type {PolygonGeometryBatch}\n */\n this.polygonBatch = {\n entries: {},\n geometriesCount: 0,\n verticesCount: 0,\n ringsCount: 0,\n };\n\n /**\n * @type {PointGeometryBatch}\n */\n this.pointBatch = {\n entries: {},\n geometriesCount: 0,\n };\n\n /**\n * @type {LineStringGeometryBatch}\n */\n this.lineStringBatch = {\n entries: {},\n geometriesCount: 0,\n verticesCount: 0,\n };\n }\n\n /**\n * @param {Array<Feature|RenderFeature>} features Array of features to add to the batch\n * @param {import(\"../../proj.js\").TransformFunction} [projectionTransform] Projection transform.\n */\n addFeatures(features, projectionTransform) {\n for (let i = 0; i < features.length; i++) {\n this.addFeature(features[i], projectionTransform);\n }\n }\n\n /**\n * @param {Feature|RenderFeature} feature Feature to add to the batch\n * @param {import(\"../../proj.js\").TransformFunction} [projectionTransform] Projection transform.\n */\n addFeature(feature, projectionTransform) {\n let geometry = feature.getGeometry();\n if (!geometry) {\n return;\n }\n if (projectionTransform) {\n geometry = geometry.clone();\n geometry.applyTransform(projectionTransform);\n }\n this.addGeometry_(geometry, feature);\n }\n\n /**\n * @param {Feature|RenderFeature} feature Feature\n * @return {GeometryBatchItem|void} the cleared entry\n * @private\n */\n clearFeatureEntryInPointBatch_(feature) {\n const featureUid = getUid(feature);\n const entry = this.pointBatch.entries[featureUid];\n if (!entry) {\n return;\n }\n this.pointBatch.geometriesCount -= entry.flatCoordss.length;\n delete this.pointBatch.entries[featureUid];\n return entry;\n }\n\n /**\n * @param {Feature|RenderFeature} feature Feature\n * @return {GeometryBatchItem|void} the cleared entry\n * @private\n */\n clearFeatureEntryInLineStringBatch_(feature) {\n const featureUid = getUid(feature);\n const entry = this.lineStringBatch.entries[featureUid];\n if (!entry) {\n return;\n }\n this.lineStringBatch.verticesCount -= entry.verticesCount;\n this.lineStringBatch.geometriesCount -= entry.flatCoordss.length;\n delete this.lineStringBatch.entries[featureUid];\n return entry;\n }\n\n /**\n * @param {Feature|RenderFeature} feature Feature\n * @return {GeometryBatchItem|void} the cleared entry\n * @private\n */\n clearFeatureEntryInPolygonBatch_(feature) {\n const featureUid = getUid(feature);\n const entry = this.polygonBatch.entries[featureUid];\n if (!entry) {\n return;\n }\n this.polygonBatch.verticesCount -= entry.verticesCount;\n this.polygonBatch.ringsCount -= entry.ringsCount;\n this.polygonBatch.geometriesCount -= entry.flatCoordss.length;\n delete this.polygonBatch.entries[featureUid];\n return entry;\n }\n\n /**\n * @param {import(\"../../geom.js\").Geometry|RenderFeature} geometry Geometry\n * @param {Feature|RenderFeature} feature Feature\n * @private\n */\n addGeometry_(geometry, feature) {\n const type = geometry.getType();\n switch (type) {\n case 'GeometryCollection': {\n const geometries =\n /** @type {import(\"../../geom.js\").GeometryCollection} */ (\n geometry\n ).getGeometriesArray();\n for (const geometry of geometries) {\n this.addGeometry_(geometry, feature);\n }\n break;\n }\n case 'MultiPolygon': {\n const multiPolygonGeom =\n /** @type {import(\"../../geom.js\").MultiPolygon} */ (geometry);\n this.addCoordinates_(\n type,\n multiPolygonGeom.getFlatCoordinates(),\n multiPolygonGeom.getEndss(),\n feature,\n getUid(feature),\n multiPolygonGeom.getStride(),\n );\n break;\n }\n case 'MultiLineString': {\n const multiLineGeom =\n /** @type {import(\"../../geom.js\").MultiLineString|RenderFeature} */ (\n geometry\n );\n this.addCoordinates_(\n type,\n multiLineGeom.getFlatCoordinates(),\n multiLineGeom.getEnds(),\n feature,\n getUid(feature),\n multiLineGeom.getStride(),\n );\n break;\n }\n case 'MultiPoint': {\n const multiPointGeom =\n /** @type {import(\"../../geom.js\").MultiPoint|RenderFeature} */ (\n geometry\n );\n this.addCoordinates_(\n type,\n multiPointGeom.getFlatCoordinates(),\n null,\n feature,\n getUid(feature),\n multiPointGeom.getStride(),\n );\n break;\n }\n case 'Polygon': {\n const polygonGeom =\n /** @type {import(\"../../geom.js\").Polygon|RenderFeature} */ (\n geometry\n );\n this.addCoordinates_(\n type,\n polygonGeom.getFlatCoordinates(),\n polygonGeom.getEnds(),\n feature,\n getUid(feature),\n polygonGeom.getStride(),\n );\n break;\n }\n case 'Point': {\n const pointGeom = /** @type {import(\"../../geom.js\").Point} */ (\n geometry\n );\n this.addCoordinates_(\n type,\n pointGeom.getFlatCoordinates(),\n null,\n feature,\n getUid(feature),\n pointGeom.getStride(),\n );\n break;\n }\n case 'LineString':\n case 'LinearRing': {\n const lineGeom = /** @type {import(\"../../geom.js\").LineString} */ (\n geometry\n );\n\n const stride = lineGeom.getStride();\n\n this.addCoordinates_(\n type,\n lineGeom.getFlatCoordinates(),\n null,\n feature,\n getUid(feature),\n stride,\n lineGeom.getLayout?.(),\n );\n break;\n }\n default:\n // pass\n }\n }\n\n /**\n * @param {GeometryType} type Geometry type\n * @param {Array<number>} flatCoords Flat coordinates\n * @param {Array<number> | Array<Array<number>> | null} ends Coordinate ends\n * @param {Feature|RenderFeature} feature Feature\n * @param {string} featureUid Feature uid\n * @param {number} stride Stride\n * @param {import('../../geom/Geometry.js').GeometryLayout} [layout] Layout\n * @private\n */\n addCoordinates_(type, flatCoords, ends, feature, featureUid, stride, layout) {\n /** @type {number} */\n let verticesCount;\n switch (type) {\n case 'MultiPolygon': {\n const multiPolygonEndss = /** @type {Array<Array<number>>} */ (ends);\n for (let i = 0, ii = multiPolygonEndss.length; i < ii; i++) {\n let polygonEnds = multiPolygonEndss[i];\n const prevPolygonEnds = i > 0 ? multiPolygonEndss[i - 1] : null;\n const startIndex = prevPolygonEnds\n ? prevPolygonEnds[prevPolygonEnds.length - 1]\n : 0;\n const endIndex = polygonEnds[polygonEnds.length - 1];\n polygonEnds =\n startIndex > 0\n ? polygonEnds.map((end) => end - startIndex)\n : polygonEnds;\n this.addCoordinates_(\n 'Polygon',\n flatCoords.slice(startIndex, endIndex),\n polygonEnds,\n feature,\n featureUid,\n stride,\n layout,\n );\n }\n break;\n }\n case 'MultiLineString': {\n const multiLineEnds = /** @type {Array<number>} */ (ends);\n for (let i = 0, ii = multiLineEnds.length; i < ii; i++) {\n const startIndex = i > 0 ? multiLineEnds[i - 1] : 0;\n this.addCoordinates_(\n 'LineString',\n flatCoords.slice(startIndex, multiLineEnds[i]),\n null,\n feature,\n featureUid,\n stride,\n layout,\n );\n }\n break;\n }\n case 'MultiPoint':\n for (let i = 0, ii = flatCoords.length; i < ii; i += stride) {\n this.addCoordinates_(\n 'Point',\n flatCoords.slice(i, i + 2),\n null,\n feature,\n featureUid,\n null,\n null,\n );\n }\n break;\n case 'Polygon': {\n const polygonEnds = /** @type {Array<number>} */ (ends);\n if (feature instanceof RenderFeature) {\n const multiPolygonEnds = inflateEnds(flatCoords, polygonEnds);\n if (multiPolygonEnds.length > 1) {\n this.addCoordinates_(\n 'MultiPolygon',\n flatCoords,\n multiPolygonEnds,\n feature,\n featureUid,\n stride,\n layout,\n );\n return;\n }\n }\n if (!this.polygonBatch.entries[featureUid]) {\n this.polygonBatch.entries[featureUid] = this.addRefToEntry_(\n featureUid,\n {\n feature: feature,\n flatCoordss: [],\n verticesCount: 0,\n ringsCount: 0,\n ringsVerticesCounts: [],\n },\n );\n }\n verticesCount = flatCoords.length / stride;\n const ringsCount = ends.length;\n const ringsVerticesCount = ends.map((end, ind, arr) =>\n ind > 0 ? (end - arr[ind - 1]) / stride : end / stride,\n );\n this.polygonBatch.verticesCount += verticesCount;\n this.polygonBatch.ringsCount += ringsCount;\n this.polygonBatch.geometriesCount++;\n this.polygonBatch.entries[featureUid].flatCoordss.push(\n getFlatCoordinatesXY(flatCoords, stride),\n );\n this.polygonBatch.entries[featureUid].ringsVerticesCounts.push(\n ringsVerticesCount,\n );\n this.polygonBatch.entries[featureUid].verticesCount += verticesCount;\n this.polygonBatch.entries[featureUid].ringsCount += ringsCount;\n for (let i = 0, ii = polygonEnds.length; i < ii; i++) {\n const startIndex = i > 0 ? polygonEnds[i - 1] : 0;\n this.addCoordinates_(\n 'LinearRing',\n flatCoords.slice(startIndex, polygonEnds[i]),\n null,\n feature,\n featureUid,\n stride,\n layout,\n );\n }\n break;\n }\n case 'Point':\n if (!this.pointBatch.entries[featureUid]) {\n this.pointBatch.entries[featureUid] = this.addRefToEntry_(\n featureUid,\n {\n feature: feature,\n flatCoordss: [],\n },\n );\n }\n this.pointBatch.geometriesCount++;\n this.pointBatch.entries[featureUid].flatCoordss.push(flatCoords);\n break;\n case 'LineString':\n case 'LinearRing':\n if (!this.lineStringBatch.entries[featureUid]) {\n this.lineStringBatch.entries[featureUid] = this.addRefToEntry_(\n featureUid,\n {\n feature: feature,\n flatCoordss: [],\n verticesCount: 0,\n },\n );\n }\n verticesCount = flatCoords.length / stride;\n this.lineStringBatch.verticesCount += verticesCount;\n this.lineStringBatch.geometriesCount++;\n this.lineStringBatch.entries[featureUid].flatCoordss.push(\n getFlatCoordinatesXYM(flatCoords, stride, layout),\n );\n this.lineStringBatch.entries[featureUid].verticesCount += verticesCount;\n break;\n default:\n // pass\n }\n }\n\n /**\n * @param {string} featureUid Feature uid\n * @param {GeometryBatchItem} entry The entry to add\n * @return {GeometryBatchItem} the added entry\n * @private\n */\n addRefToEntry_(featureUid, entry) {\n const currentRef = this.uidToRef_.get(featureUid);\n\n // the ref starts at 1 to distinguish from white color (no feature)\n const ref =\n currentRef || this.freeGlobalRef_.pop() || ++this.globalCounter_;\n entry.ref = ref;\n if (!currentRef) {\n this.refToFeature_.set(ref, entry.feature);\n this.uidToRef_.set(featureUid, ref);\n }\n return entry;\n }\n\n /**\n * Return a ref to the pool of available refs.\n * @param {number} ref the ref to return\n * @param {string} featureUid the feature uid\n * @private\n */\n removeRef_(ref, featureUid) {\n if (!ref) {\n throw new Error('This feature has no ref: ' + featureUid);\n }\n this.refToFeature_.delete(ref);\n this.uidToRef_.delete(featureUid);\n this.freeGlobalRef_.push(ref);\n }\n\n /**\n * @param {Feature|RenderFeature} feature Feature\n * @param {import(\"../../proj.js\").TransformFunction} [projectionTransform] Projection transform.\n */\n changeFeature(feature, projectionTransform) {\n // the feature is not present in the batch; do not add it to avoid unexpected behaviors\n if (!this.uidToRef_.get(getUid(feature))) {\n return;\n }\n this.removeFeature(feature);\n let geometry = feature.getGeometry();\n if (!geometry) {\n return;\n }\n if (projectionTransform) {\n geometry = geometry.clone();\n geometry.applyTransform(projectionTransform);\n }\n this.addGeometry_(geometry, feature);\n }\n\n /**\n * @param {Feature|RenderFeature} feature Feature\n */\n removeFeature(feature) {\n let entry = this.clearFeatureEntryInPointBatch_(feature);\n entry = this.clearFeatureEntryInPolygonBatch_(feature) || entry;\n entry = this.clearFeatureEntryInLineStringBatch_(feature) || entry;\n if (entry) {\n this.removeRef_(entry.ref, getUid(entry.feature));\n }\n }\n\n clear() {\n this.polygonBatch.entries = {};\n this.polygonBatch.geometriesCount = 0;\n this.polygonBatch.verticesCount = 0;\n this.polygonBatch.ringsCount = 0;\n this.lineStringBatch.entries = {};\n this.lineStringBatch.geometriesCount = 0;\n this.lineStringBatch.verticesCount = 0;\n this.pointBatch.entries = {};\n this.pointBatch.geometriesCount = 0;\n this.globalCounter_ = 0;\n this.freeGlobalRef_ = [];\n this.refToFeature_.clear();\n this.uidToRef_.clear();\n }\n\n /**\n * Resolve the feature associated to a ref.\n * @param {number} ref Hit detected ref\n * @return {Feature|RenderFeature} feature\n */\n getFeatureFromRef(ref) {\n return this.refToFeature_.get(ref);\n }\n\n isEmpty() {\n return this.globalCounter_ === 0;\n }\n\n /**\n * Will return a new instance of this class that only contains the features\n * for which the provided callback returned true\n * @param {function((Feature|RenderFeature)): boolean} featureFilter Feature filter callback\n * @return {MixedGeometryBatch} Filtered geometry batch\n */\n filter(featureFilter) {\n const filtered = new MixedGeometryBatch();\n filtered.globalCounter_ = this.globalCounter_;\n filtered.uidToRef_ = this.uidToRef_;\n filtered.refToFeature_ = this.refToFeature_;\n let empty = true;\n for (const feature of this.refToFeature_.values()) {\n if (featureFilter(feature)) {\n filtered.addFeature(feature);\n empty = false;\n }\n }\n // no feature was added at all; simply return an empty batch for consistency downstream\n if (empty) {\n return new MixedGeometryBatch();\n }\n return filtered;\n }\n}\n\n/**\n * @param {Array<number>} flatCoords Flat coords\n * @param {number} stride Stride\n * @return {Array<number>} Flat coords with only XY components\n */\nfunction getFlatCoordinatesXY(flatCoords, stride) {\n if (stride === 2) {\n return flatCoords;\n }\n return flatCoords.filter((v, i) => i % stride < 2);\n}\n\n/**\n * @param {Array<number>} flatCoords Flat coords\n * @param {number} stride Stride\n * @param {string} layout Layout\n * @return {Array<number>} Flat coords with only XY components\n */\nfunction getFlatCoordinatesXYM(flatCoords, stride, layout) {\n if (stride === 3 && layout === 'XYM') {\n return flatCoords;\n }\n // this is XYZM layout\n if (stride === 4) {\n return flatCoords.filter((v, i) => i % stride !== 2);\n }\n // this is XYZ layout\n if (stride === 3) {\n return flatCoords.map((v, i) => (i % stride !== 2 ? v : 0));\n }\n // this is XY layout\n return new Array(flatCoords.length * 1.5)\n .fill(0)\n .map((v, i) => (i % 3 === 2 ? 0 : flatCoords[Math.round(i / 1.5)]));\n}\n\nexport default MixedGeometryBatch;\n","/**\n * @module ol/webgl/TileGeometry\n */\n\nimport MixedGeometryBatch from '../render/webgl/MixedGeometryBatch.js';\nimport {\n create as createTransform,\n translate as translateTransform,\n} from '../transform.js';\nimport {ARRAY_BUFFER, STATIC_DRAW} from '../webgl.js';\nimport BaseTileRepresentation from './BaseTileRepresentation.js';\nimport WebGLArrayBuffer from './Buffer.js';\n\n/**\n * @typedef {import(\"../VectorRenderTile\").default} TileType\n */\n\n/**\n * @extends {BaseTileRepresentation<TileType>}\n */\nclass TileGeometry extends BaseTileRepresentation {\n /**\n * @param {import(\"./BaseTileRepresentation.js\").TileRepresentationOptions<TileType>} options The tile texture options.\n * @param {Array<import(\"../render/webgl/VectorStyleRenderer.js\").default>} styleRenderers Array of vector style renderers\n */\n constructor(options, styleRenderers) {\n super(options);\n\n /**\n * @private\n */\n this.batch_ = new MixedGeometryBatch();\n\n /**\n * @private\n */\n this.styleRenderers_ = styleRenderers;\n\n /**\n * @type {Array<import(\"../render/webgl/VectorStyleRenderer.js\").WebGLBuffers>}\n */\n this.buffers = [];\n\n /**\n * Each geometry tile also has a mask which consisted of a quad (two triangles); this mask is intended to\n * be rendered to an offscreen buffer, and be used to correctly mask tiles according to their zoom level\n * during rendering\n */\n this.maskVertices = new WebGLArrayBuffer(ARRAY_BUFFER, STATIC_DRAW);\n\n this.setTile(options.tile);\n }\n\n /**\n * @private\n */\n generateMaskBuffer_() {\n const extent = this.tile.getSourceTiles()[0].extent;\n this.maskVertices.fromArray([\n extent[0],\n extent[1],\n extent[2],\n extent[1],\n extent[2],\n extent[3],\n extent[0],\n extent[3],\n ]);\n this.helper.flushBufferData(this.maskVertices);\n }\n\n /**\n * @override\n */\n uploadTile() {\n this.generateMaskBuffer_();\n\n this.batch_.clear();\n const sourceTiles = this.tile.getSourceTiles();\n const features = sourceTiles.reduce(\n (accumulator, sourceTile) => accumulator.concat(sourceTile.getFeatures()),\n [],\n );\n this.batch_.addFeatures(features);\n\n const tileOriginX = sourceTiles[0].extent[0];\n const tileOriginY = sourceTiles[0].extent[1];\n const transform = translateTransform(\n createTransform(),\n -tileOriginX,\n -tileOriginY,\n );\n\n const generatePromises = this.styleRenderers_.map((renderer, i) =>\n renderer.generateBuffers(this.batch_, transform).then((buffers) => {\n this.buffers[i] = buffers;\n }),\n );\n Promise.all(generatePromises).then(() => {\n this.setReady();\n });\n }\n\n /**\n * @override\n */\n disposeInternal() {\n this.buffers.forEach((buffers) => {\n this.disposeBuffers(buffers);\n });\n super.disposeInternal();\n }\n\n /**\n * Will release a set of Webgl buffers\n * @param {import('../render/webgl/VectorStyleRenderer.js').WebGLBuffers|null} buffers Buffers\n */\n disposeBuffers(buffers) {\n if (!buffers) {\n return;\n }\n /**\n * @param {Array<WebGLArrayBuffer>} typeBuffers Buffers\n */\n const disposeBuffersOfType = (typeBuffers) => {\n for (const buffer of typeBuffers) {\n if (buffer) {\n this.helper.deleteBuffer(buffer);\n }\n }\n };\n if (buffers.pointBuffers) {\n disposeBuffersOfType(buffers.pointBuffers);\n }\n if (buffers.lineStringBuffers) {\n disposeBuffersOfType(buffers.lineStringBuffers);\n }\n if (buffers.polygonBuffers) {\n disposeBuffersOfType(buffers.polygonBuffers);\n }\n }\n}\n\nexport default TileGeometry;\n","/**\n * @module ol/webgl/TileTexture\n */\n\nimport DataTile, {asArrayLike, asImageLike} from '../DataTile.js';\nimport ImageTile from '../ImageTile.js';\nimport {createCanvasContext2D} from '../dom.js';\nimport ReprojTile from '../reproj/Tile.js';\nimport {toSize} from '../size.js';\nimport {ARRAY_BUFFER, STATIC_DRAW} from '../webgl.js';\nimport BaseTileRepresentation from './BaseTileRepresentation.js';\nimport WebGLArrayBuffer from './Buffer.js';\n\n/**\n * @param {WebGLRenderingContext} gl The WebGL context.\n * @param {WebGLTexture} texture The texture.\n * @param {boolean} interpolate Interpolate when resampling.\n */\nfunction bindAndConfigure(gl, texture, interpolate) {\n const resampleFilter = interpolate ? gl.LINEAR : gl.NEAREST;\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, resampleFilter);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, resampleFilter);\n}\n\n/**\n * @param {WebGLRenderingContext} gl The WebGL context.\n * @param {WebGLTexture} texture The texture.\n * @param {import(\"../DataTile.js\").ImageLike} image The image.\n * @param {boolean} interpolate Interpolate when resampling.\n */\nfunction uploadImageTexture(gl, texture, image, interpolate) {\n bindAndConfigure(gl, texture, interpolate);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n}\n\n/**\n * @param {import(\"./Helper.js\").default} helper The WebGL helper.\n * @param {WebGLTexture} texture The texture.\n * @param {import(\"../DataTile.js\").ArrayLike} data The pixel data.\n * @param {import(\"../size.js\").Size} size The pixel size.\n * @param {number} bandCount The band count.\n * @param {boolean} interpolate Interpolate when resampling.\n */\nfunction uploadDataTexture(\n helper,\n texture,\n data,\n size,\n bandCount,\n interpolate,\n) {\n const gl = helper.getGL();\n let textureType;\n let canInterpolate;\n if (data instanceof Float32Array) {\n textureType = gl.FLOAT;\n helper.getExtension('OES_texture_float');\n const extension = helper.getExtension('OES_texture_float_linear');\n canInterpolate = extension !== null;\n } else {\n textureType = gl.UNSIGNED_BYTE;\n canInterpolate = true;\n }\n bindAndConfigure(gl, texture, interpolate && canInterpolate);\n\n const bytesPerRow = data.byteLength / size[1];\n let unpackAlignment = 1;\n if (bytesPerRow % 8 === 0) {\n unpackAlignment = 8;\n } else if (bytesPerRow % 4 === 0) {\n unpackAlignment = 4;\n } else if (bytesPerRow % 2 === 0) {\n unpackAlignment = 2;\n }\n\n let format;\n switch (bandCount) {\n case 1: {\n format = gl.LUMINANCE;\n break;\n }\n case 2: {\n format = gl.LUMINANCE_ALPHA;\n break;\n }\n case 3: {\n format = gl.RGB;\n break;\n }\n case 4: {\n format = gl.RGBA;\n break;\n }\n default: {\n throw new Error(`Unsupported number of bands: ${bandCount}`);\n }\n }\n\n const oldUnpackAlignment = gl.getParameter(gl.UNPACK_ALIGNMENT);\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n format,\n size[0],\n size[1],\n 0,\n format,\n textureType,\n data,\n );\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, oldUnpackAlignment);\n}\n\n/**\n * @type {CanvasRenderingContext2D}\n */\nlet pixelContext = null;\n\nfunction createPixelContext() {\n pixelContext = createCanvasContext2D(1, 1, undefined, {\n willReadFrequently: true,\n });\n}\n\n/**\n * @typedef {import(\"../DataTile.js\").default|ImageTile|ReprojTile} TileType\n */\n\n/**\n * @extends {BaseTileRepresentation<TileType>}\n */\nclass TileTexture extends BaseTileRepresentation {\n /**\n * @param {import(\"./BaseTileRepresentation.js\").TileRepresentationOptions<TileType>} options The tile texture options.\n */\n constructor(options) {\n super(options);\n\n /**\n * @type {Array<WebGLTexture>}\n */\n this.textures = [];\n\n /**\n * @type {import(\"../size.js\").Size}\n * @private\n */\n this.renderSize_ = toSize(\n options.grid.getTileSize(options.tile.tileCoord[0]),\n );\n\n /**\n * @type {number}\n */\n this.bandCount = NaN;\n\n const coords = new WebGLArrayBuffer(ARRAY_BUFFER, STATIC_DRAW);\n coords.fromArray([\n 0, // P0\n 1,\n 1, // P1\n 1,\n 1, // P2\n 0,\n 0, // P3\n 0,\n ]);\n this.helper.flushBufferData(coords);\n\n /**\n * @type {WebGLArrayBuffer}\n */\n this.coords = coords;\n\n this.setTile(options.tile);\n }\n\n /**\n * @override\n * @param {import(\"./Helper.js\").default} helper The WebGL helper.\n */\n setHelper(helper) {\n const gl = this.helper?.getGL();\n if (gl) {\n this.helper.deleteBuffer(this.coords);\n for (let i = 0; i < this.textures.length; ++i) {\n gl.deleteTexture(this.textures[i]);\n }\n }\n\n super.setHelper(helper);\n\n if (helper) {\n helper.flushBufferData(this.coords);\n }\n }\n\n /**\n * @override\n */\n uploadTile() {\n const helper = this.helper;\n const gl = helper.getGL();\n const tile = this.tile;\n\n this.textures.length = 0;\n\n /**\n * @type {import(\"../DataTile.js\").Data}\n */\n let data;\n\n if (tile instanceof ImageTile || tile instanceof ReprojTile) {\n data = tile.getImage();\n } else {\n data = tile.getData();\n }\n\n const image = asImageLike(data);\n if (image) {\n const texture = gl.createTexture();\n this.textures.push(texture);\n this.bandCount = 4;\n uploadImageTexture(gl, texture, image, tile.interpolate);\n this.setReady();\n return;\n }\n\n data = asArrayLike(data);\n\n const sourceTileSize = /** @type {DataTile} */ (tile).getSize();\n const pixelSize = [\n sourceTileSize[0] + 2 * this.gutter,\n sourceTileSize[1] + 2 * this.gutter,\n ];\n const isFloat = data instanceof Float32Array;\n const pixelCount = pixelSize[0] * pixelSize[1];\n const DataType = isFloat ? Float32Array : Uint8Array;\n const bytesPerElement = DataType.BYTES_PER_ELEMENT;\n const bytesPerRow = data.byteLength / pixelSize[1];\n\n this.bandCount = Math.floor(bytesPerRow / bytesPerElement / pixelSize[0]);\n const textureCount = Math.ceil(this.bandCount / 4);\n\n if (textureCount === 1) {\n const texture = gl.createTexture();\n this.textures.push(texture);\n uploadDataTexture(\n helper,\n texture,\n data,\n pixelSize,\n this.bandCount,\n tile.interpolate,\n );\n this.setReady();\n return;\n }\n\n const textureDataArrays = new Array(textureCount);\n for (let textureIndex = 0; textureIndex < textureCount; ++textureIndex) {\n const texture = gl.createTexture();\n this.textures.push(texture);\n\n const bandCount =\n textureIndex < textureCount - 1 ? 4 : ((this.bandCount - 1) % 4) + 1;\n textureDataArrays[textureIndex] = new DataType(pixelCount * bandCount);\n }\n\n let dataIndex = 0;\n let rowOffset = 0;\n const colCount = pixelSize[0] * this.bandCount;\n for (let rowIndex = 0; rowIndex < pixelSize[1]; ++rowIndex) {\n for (let colIndex = 0; colIndex < colCount; ++colIndex) {\n const dataValue = data[rowOffset + colIndex];\n\n const pixelIndex = Math.floor(dataIndex / this.bandCount);\n const bandIndex = colIndex % this.bandCount;\n const textureIndex = Math.floor(bandIndex / 4);\n const textureData = textureDataArrays[textureIndex];\n const bandCount = textureData.length / pixelCount;\n const textureBandIndex = bandIndex % 4;\n textureData[pixelIndex * bandCount + textureBandIndex] = dataValue;\n\n ++dataIndex;\n }\n rowOffset += bytesPerRow / bytesPerElement;\n }\n\n for (let textureIndex = 0; textureIndex < textureCount; ++textureIndex) {\n const texture = this.textures[textureIndex];\n const textureData = textureDataArrays[textureIndex];\n const bandCount = textureData.length / pixelCount;\n uploadDataTexture(\n helper,\n texture,\n textureData,\n pixelSize,\n bandCount,\n tile.interpolate,\n );\n }\n\n this.setReady();\n }\n\n /**\n * @param {import(\"../DataTile.js\").ImageLike} image The image.\n * @param {number} renderCol The column index (in rendered tile space).\n * @param {number} renderRow The row index (in rendered tile space).\n * @return {Uint8ClampedArray|null} The data.\n * @private\n */\n getImagePixelData_(image, renderCol, renderRow) {\n const gutter = this.gutter;\n const renderWidth = this.renderSize_[0];\n const renderHeight = this.renderSize_[1];\n\n if (!pixelContext) {\n createPixelContext();\n }\n pixelContext.clearRect(0, 0, 1, 1);\n\n const sourceWidth = image.width;\n const sourceHeight = image.height;\n\n const sourceWidthWithoutGutter = sourceWidth - 2 * gutter;\n const sourceHeightWithoutGutter = sourceHeight - 2 * gutter;\n\n const sourceCol =\n gutter + Math.floor(sourceWidthWithoutGutter * (renderCol / renderWidth));\n\n const sourceRow =\n gutter +\n Math.floor(sourceHeightWithoutGutter * (renderRow / renderHeight));\n\n let data;\n try {\n pixelContext.drawImage(image, sourceCol, sourceRow, 1, 1, 0, 0, 1, 1);\n data = pixelContext.getImageData(0, 0, 1, 1).data;\n } catch {\n pixelContext = null;\n return null;\n }\n return data;\n }\n\n /**\n * @param {import(\"../DataTile.js\").ArrayLike} data The data.\n * @param {import(\"../size.js\").Size} sourceSize The size.\n * @param {number} renderCol The column index (in rendered tile space).\n * @param {number} renderRow The row index (in rendered tile space).\n * @return {import(\"../DataTile.js\").ArrayLike|null} The data.\n * @private\n */\n getArrayPixelData_(data, sourceSize, renderCol, renderRow) {\n const gutter = this.gutter;\n const renderWidth = this.renderSize_[0];\n const renderHeight = this.renderSize_[1];\n\n const sourceWidthWithoutGutter = sourceSize[0];\n const sourceHeightWithoutGutter = sourceSize[1];\n const sourceWidth = sourceWidthWithoutGutter + 2 * gutter;\n const sourceHeight = sourceHeightWithoutGutter + 2 * gutter;\n\n const sourceCol =\n gutter + Math.floor(sourceWidthWithoutGutter * (renderCol / renderWidth));\n\n const sourceRow =\n gutter +\n Math.floor(sourceHeightWithoutGutter * (renderRow / renderHeight));\n\n if (data instanceof DataView) {\n const bytesPerPixel = data.byteLength / (sourceWidth * sourceHeight);\n const offset = bytesPerPixel * (sourceRow * sourceWidth + sourceCol);\n const buffer = data.buffer.slice(offset, offset + bytesPerPixel);\n return new DataView(buffer);\n }\n\n const offset = this.bandCount * (sourceRow * sourceWidth + sourceCol);\n return data.slice(offset, offset + this.bandCount);\n }\n\n /**\n * Get data for a pixel. If the tile is not loaded, null is returned.\n * @param {number} renderCol The column index (in rendered tile space).\n * @param {number} renderRow The row index (in rendered tile space).\n * @return {import(\"../DataTile.js\").ArrayLike|null} The data.\n */\n getPixelData(renderCol, renderRow) {\n if (!this.loaded) {\n return null;\n }\n\n if (this.tile instanceof DataTile) {\n const data = this.tile.getData();\n const arrayData = asArrayLike(data);\n if (arrayData) {\n const sourceSize = this.tile.getSize();\n return this.getArrayPixelData_(\n arrayData,\n sourceSize,\n renderCol,\n renderRow,\n );\n }\n return this.getImagePixelData_(asImageLike(data), renderCol, renderRow);\n }\n\n return this.getImagePixelData_(this.tile.getImage(), renderCol, renderRow);\n }\n}\n\nexport default TileTexture;\n","/**\n * @module ol/style/flat\n */\n\n/**\n * @api\n * @fileoverview Vector layers can be styled with an object literal containing properties for\n * stroke, fill, image, and text styles. The types below can be composed into a single object.\n * For example, a style with both stroke and fill properties could look like this:\n *\n * const style = {\n * 'stroke-color': 'yellow',\n * 'stroke-width': 1.5,\n * 'fill-color': 'orange',\n * };\n *\n * See details about the available properties depending on what type of symbolizer should be applied:\n * {@link module:ol/style/flat~FlatStroke Stroke} - properties for applying a stroke to lines and polygons\n * {@link module:ol/style/flat~FlatFill Fill} - properties for filling polygons\n * {@link module:ol/style/flat~FlatText Text} - properties for labeling points, lines, and polygons\n * {@link module:ol/style/flat~FlatIcon Icon} - properties for rendering points with an icon\n * {@link module:ol/style/flat~FlatCircle Circle} - properties for rendering points with a circle\n * {@link module:ol/style/flat~FlatShape Shape} - properties for rendering points with a regular shape\n *\n * To conditionally apply styles based on a filter, a list of {@link module:ol/style/flat~Rule rules} can be used.\n * For example, to style points with a big orange circle if the population is greater than 1 million and\n * a smaller blue circle otherwise:\n *\n * const rules = [\n * {\n * filter: ['>', ['get', 'population'], 1_000_000],\n * style: {\n * 'circle-radius': 10,\n * 'circle-fill-color': 'red',\n * }\n * },\n * {\n * else: true,\n * style: {\n * 'circle-radius': 5,\n * 'circle-fill-color': 'blue',\n * },\n * },\n * ];\n */\n\n/**\n * A literal boolean (e.g. `true`) or an expression that evaluates to a boolean (e.g. `['>', ['get', 'population'], 1_000_000]`).\n *\n * @typedef {boolean|Array} BooleanExpression\n */\n\n/**\n * A literal string (e.g. `'hello'`) or an expression that evaluates to a string (e.g. `['get', 'greeting']`).\n *\n * @typedef {string|Array} StringExpression\n */\n\n/**\n * A literal number (e.g. `42`) or an expression that evaluates to a number (e.g. `['+', 40, 2]`).\n *\n * @typedef {number|Array} NumberExpression\n */\n\n/**\n * A CSS named color (e.g. `'blue'`), an array of 3 RGB values (e.g. `[0, 255, 0]`), an array of 4 RGBA values\n * (e.g. `[0, 255, 0, 0.5]`), or an expression that evaluates to one of these color types (e.g. `['get', 'color']`).\n *\n * @typedef {import(\"../color.js\").Color|string|Array} ColorExpression\n */\n\n/**\n * An array of numbers (e.g. `[1, 2, 3]`) or an expression that evaluates to the same (e.g. `['get', 'values']`).\n *\n * @typedef {Array<number>|Array} NumberArrayExpression\n */\n\n/**\n * An array of two numbers (e.g. `[10, 20]`) or an expression that evaluates to the same (e.g. `['get', 'size']`).\n *\n * @typedef {number|Array<number>|Array} SizeExpression\n */\n\n/**\n * For static styling, the [layer.setStyle()]{@link module:ol/layer/Vector~VectorLayer#setStyle} method\n * can be called with an object literal that has fill, stroke, text, icon, regular shape, and/or circle properties.\n * @api\n *\n * @typedef {FlatFill & FlatStroke & FlatText & FlatIcon & FlatShape & FlatCircle} FlatStyle\n */\n\n/**\n * A flat style literal or an array of the same.\n *\n * @typedef {FlatStyle|Array<FlatStyle>|Array<Rule>} FlatStyleLike\n */\n\n/**\n * Fill style properties applied to polygon features.\n *\n * @typedef {Object} FlatFill\n * @property {ColorExpression} [fill-color] The fill color. `'none'` means no fill and no hit detection (applies to Canvas only).\n * @property {StringExpression} [fill-pattern-src] Fill pattern image source URI. If `fill-color` is defined as well,\n * it will be used to tint this image. (Expressions only in Canvas)\n * @property {SizeExpression} [fill-pattern-size] Fill pattern image size in pixels.\n * Can be used together with `fill-pattern-offset` to define the sub-rectangle to use\n * from a fill pattern image sprite sheet.\n * @property {SizeExpression} [fill-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin, define the\n * sub-rectangle to use from the original fill pattern image.\n * @property {import(\"./Icon.js\").IconOrigin} [fill-pattern-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`. (WebGL only)\n */\n\n/**\n * Stroke style properties applied to line strings and polygon boundaries. To apply a stroke, at least one of\n * `stroke-color` or `stroke-width` must be provided.\n *\n * @typedef {Object} FlatStroke\n * @property {ColorExpression} [stroke-color] The stroke color.\n * @property {NumberExpression} [stroke-width] Stroke pixel width.\n * @property {StringExpression} [stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.\n * @property {StringExpression} [stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.\n * @property {NumberArrayExpression} [stroke-line-dash] Line dash pattern.\n * @property {NumberExpression} [stroke-line-dash-offset=0] Line dash offset.\n * @property {NumberExpression} [stroke-miter-limit=10] Miter limit.\n * @property {NumberExpression} [stroke-offset] Stroke offset in pixel. A positive value offsets the line to the right,\n * relative to the direction of the line. (WebGL only)\n * @property {string} [stroke-pattern-src] Stroke pattern image source URI. If `stroke-color` is defined as well,\n * it will be used to tint this image. (WebGL only)\n * @property {SizeExpression} [stroke-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin,\n * define the sub-rectangle to use from the original fill pattern image. (WebGL only)\n * @property {import(\"./Icon.js\").IconOrigin} [stroke-pattern-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`. (WebGL only)\n * @property {SizeExpression} [stroke-pattern-size] Stroke pattern image size in pixel. Can be used together with `stroke-pattern-offset` to define the\n * sub-rectangle to use from the origin (sprite) fill pattern image. (WebGL only)\n * @property {NumberExpression} [stroke-pattern-spacing] Spacing between each pattern occurrence in pixels; 0 if undefined.\n * @property {NumberExpression} [z-index] The zIndex of the style.\n */\n\n/**\n * Label style properties applied to all features. At a minimum, a `text-value` must be provided.\n * Note: text style is currently not supported in WebGL layers\n *\n * @typedef {Object} FlatText\n * @property {StringExpression} [text-value] Text content (with `\\n` for line breaks).\n * @property {StringExpression} [text-font='10px sans-serif'] Font style as [CSS `font`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font) value.\n * @property {NumberExpression} [text-max-angle=Math.PI/4] When `text-placement` is set to `'line'`, allow a maximum angle between adjacent characters.\n * The expected value is in radians, and the default is 45° (`Math.PI / 4`).\n * @property {NumberExpression} [text-offset-x=0] Horizontal text offset in pixels. A positive will shift the text right.\n * @property {NumberExpression} [text-offset-y=0] Vertical text offset in pixels. A positive will shift the text down.\n * @property {BooleanExpression} [text-overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed\n * the width of the polygon at the label position or the length of the path that it follows.\n * @property {StringExpression} [text-placement='point'] Text placement.\n * @property {NumberExpression} [text-repeat] Repeat interval in pixels. When set, the text will be repeated at this interval. Only available when\n * `text-placement` is set to `'line'`. Overrides `text-align`.\n * @property {SizeExpression} [text-scale] Scale.\n * @property {BooleanExpression} [text-rotate-with-view=false] Whether to rotate the text with the view.\n * @property {NumberExpression} [text-rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {StringExpression} [text-align] Text alignment. Possible values: `'left'`, `'right'`, `'center'`, `'end'` or `'start'`.\n * Default is `'center'` for `'text-placement': 'point'`. For `'text-placement': 'line'`, the default is to let the renderer choose a\n * placement where `text-max-angle` is not exceeded.\n * @property {StringExpression} [text-justify] Text justification within the text box.\n * If not set, text is justified towards the `textAlign` anchor.\n * Otherwise, use options `'left'`, `'center'`, or `'right'` to justify the text within the text box.\n * **Note:** `text-justify` is ignored for immediate rendering and also for `'text-placement': 'line'`.\n * @property {StringExpression} [text-baseline='middle'] Text base line. Possible values: `'bottom'`, `'top'`, `'middle'`, `'alphabetic'`,\n * `'hanging'`, `'ideographic'`.\n * @property {NumberArrayExpression} [text-padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of\n * values in the array is `[top, right, bottom, left]`.\n * @property {ColorExpression} [text-fill-color] The fill color. `'none'` means no fill and no hit detection.\n * @property {ColorExpression} [text-background-fill-color] The fill color. `'none'` means no fill and no hit detection.\n * @property {ColorExpression} [text-stroke-color] The stroke color.\n * @property {StringExpression} [text-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.\n * @property {StringExpression} [text-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.\n * @property {NumberArrayExpression} [text-stroke-line-dash] Line dash pattern.\n * @property {NumberExpression} [text-stroke-line-dash-offset=0] Line dash offset.\n * @property {NumberExpression} [text-stroke-miter-limit=10] Miter limit.\n * @property {NumberExpression} [text-stroke-width] Stroke pixel width.\n * @property {ColorExpression} [text-background-stroke-color] The stroke color.\n * @property {StringExpression} [text-background-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`.\n * @property {StringExpression} [text-background-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`.\n * @property {NumberArrayExpression} [text-background-stroke-line-dash] Line dash pattern.\n * @property {NumberExpression} [text-background-stroke-line-dash-offset=0] Line dash offset.\n * @property {NumberExpression} [text-background-stroke-miter-limit=10] Miter limit.\n * @property {NumberExpression} [text-background-stroke-width] Stroke pixel width.\n * @property {import(\"./Style.js\").DeclutterMode} [text-declutter-mode] Declutter mode\n * @property {NumberExpression} [z-index] The zIndex of the style.\n */\n\n/**\n * Icon style properties applied to point features. `icon-src` must be provided to render\n * points with an icon.\n *\n * @typedef {Object} FlatIcon\n * @property {string} [icon-src] Image source URI.\n * @property {NumberArrayExpression} [icon-anchor=[0.5, 0.5]] Anchor. Default value is the icon center.\n * @property {import(\"./Icon.js\").IconOrigin} [icon-anchor-origin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {import(\"./Icon.js\").IconAnchorUnits} [icon-anchor-x-units='fraction'] Units in which the anchor x value is\n * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates\n * the x value in pixels.\n * @property {import(\"./Icon.js\").IconAnchorUnits} [icon-anchor-y-units='fraction'] Units in which the anchor y value is\n * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates\n * the y value in pixels.\n * @property {ColorExpression} [icon-color] Color to tint the icon. If not specified,\n * the icon will be left as is.\n * @property {null|string} [icon-cross-origin] The `crossOrigin` attribute for loaded images. Note that you must provide a\n * `icon-cross-origin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {SizeExpression} [icon-offset=[0, 0]] Offset, which, together with the size and the offset origin, define the\n * sub-rectangle to use from the original icon image.\n * @property {NumberArrayExpression} [icon-displacement=[0,0]] Displacement of the icon.\n * @property {import(\"./Icon.js\").IconOrigin} [icon-offset-origin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,\n * `top-left` or `top-right`.\n * @property {NumberExpression} [icon-opacity=1] Opacity of the icon.\n * @property {SizeExpression} [icon-scale=1] Scale.\n * @property {NumberExpression} [icon-width] Width of the icon. If not specified, the actual image width will be used. Cannot be combined\n * with `scale`. (Expressions only in WebGL)\n * @property {NumberExpression} [icon-height] Height of the icon. If not specified, the actual image height will be used. Cannot be combined\n * with `scale`. (Expressions only in WebGL)\n * @property {NumberExpression} [icon-rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {BooleanExpression} [icon-rotate-with-view=false] Whether to rotate the icon with the view. (Expressions only supported in Canvas)\n * @property {SizeExpression} [icon-size] Icon size in pixel. Can be used together with `icon-offset` to define the\n * sub-rectangle to use from the origin (sprite) icon image. (Expressions only in WebGL)\n * @property {import(\"./Style.js\").DeclutterMode} [icon-declutter-mode] Declutter mode (Canvas only)\n * @property {NumberExpression} [z-index] The zIndex of the style. (Canvas only)\n */\n\n/**\n * Regular shape style properties for rendering point features. At least `shape-points` must be provided.\n *\n * @typedef {Object} FlatShape\n * @property {NumberExpression} [shape-points] Number of points for stars and regular polygons. In case of a polygon, the number of points\n * is the number of sides. (Expressions only in WebGL)\n * @property {ColorExpression} [shape-fill-color] The fill color. `'none'` means no fill and no hit detection.\n * @property {ColorExpression} [shape-stroke-color] The stroke color.\n * @property {NumberExpression} [shape-stroke-width] Stroke pixel width.\n * @property {StringExpression} [shape-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`. (Canvas only)\n * @property {StringExpression} [shape-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`. (Canvas only)\n * @property {NumberArrayExpression} [shape-stroke-line-dash] Line dash pattern. (Canvas only)\n * @property {NumberExpression} [shape-stroke-line-dash-offset=0] Line dash offset. (Canvas only)\n * @property {NumberExpression} [shape-stroke-miter-limit=10] Miter limit. (Canvas only)\n * @property {NumberExpression} [shape-radius] Radius of a regular polygon. (Expressions only in WebGL)\n * @property {NumberExpression} [shape-radius2] Second radius to make a star instead of a regular polygon. (Expressions only in WebGL)\n * @property {NumberExpression} [shape-angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up. (Expressions only in WebGL)\n * @property {NumberArrayExpression} [shape-displacement=[0,0]] Displacement of the shape\n * @property {NumberExpression} [shape-opacity] Shape opacity. (WebGL only)\n * @property {NumberExpression} [shape-rotation=0] Rotation in radians (positive rotation clockwise).\n * @property {BooleanExpression} [shape-rotate-with-view=false] Whether to rotate the shape with the view. (Expression only supported in Canvas)\n * @property {SizeExpression} [shape-scale=1] Scale. Unless two-dimensional scaling is required a better\n * result may be obtained with appropriate settings for `shape-radius` and `shape-radius2`.\n * @property {import(\"./Style.js\").DeclutterMode} [shape-declutter-mode] Declutter mode. (Canvas only)\n * @property {NumberExpression} [z-index] The zIndex of the style. (Canvas only)\n */\n\n/**\n * Circle style properties for rendering point features. At least `circle-radius` must be provided.\n *\n * @typedef {Object} FlatCircle\n * @property {NumberExpression} [circle-radius] Circle radius.\n * @property {ColorExpression} [circle-fill-color] The fill color. `'none'` means no fill and no hit detection.\n * @property {ColorExpression} [circle-stroke-color] The stroke color.\n * @property {NumberExpression} [circle-stroke-width] Stroke pixel width.\n * @property {StringExpression} [circle-stroke-line-cap='round'] Line cap style: `butt`, `round`, or `square`. (Canvas only)\n * @property {StringExpression} [circle-stroke-line-join='round'] Line join style: `bevel`, `round`, or `miter`. (Canvas only)\n * @property {NumberArrayExpression} [circle-stroke-line-dash] Line dash pattern. (Canvas only)\n * @property {NumberExpression} [circle-stroke-line-dash-offset=0] Line dash offset. (Canvas only)\n * @property {NumberExpression} [circle-stroke-miter-limit=10] Miter limit. (Canvas only)\n * @property {NumberArrayExpression} [circle-displacement=[0,0]] displacement\n * @property {SizeExpression} [circle-scale=1] Scale. A two-dimensional scale will produce an ellipse.\n * Unless two-dimensional scaling is required a better result may be obtained with an appropriate setting for `circle-radius`.\n * @property {NumberExpression} [circle-opacity] Circle opacity. (WebGL only)\n * @property {NumberExpression} [circle-rotation=0] Rotation in radians\n * (positive rotation clockwise, meaningful only when used in conjunction with a two-dimensional scale).\n * @property {BooleanExpression} [circle-rotate-with-view=false] Whether to rotate the shape with the view (Expression only supported in Canvas)\n * (meaningful only when used in conjunction with a two-dimensional scale).\n * @property {import(\"./Style.js\").DeclutterMode} [circle-declutter-mode] Declutter mode (Canvas only)\n * @property {NumberExpression} [z-index] The zIndex of the style. (Canvas only)\n */\n\n/**\n * These default style properties are applied when no other style is given.\n *\n * @typedef {Object} DefaultStyle\n * @property {string} fill-color `'rgba(255,255,255,0.4)'`\n * @property {string} stroke-color `'#3399CC'`\n * @property {number} stroke-width `1.25`\n * @property {number} circle-radius `5`\n * @property {string} circle-fill-color `'rgba(255,255,255,0.4)'`\n * @property {number} circle-stroke-width `1.25`\n * @property {string} circle-stroke-color `'#3399CC'`\n */\n\n/**\n * @return {DefaultStyle} The default flat style.\n */\nexport function createDefaultStyle() {\n return {\n 'fill-color': 'rgba(255,255,255,0.4)',\n 'stroke-color': '#3399CC',\n 'stroke-width': 1.25,\n 'circle-radius': 5,\n 'circle-fill-color': 'rgba(255,255,255,0.4)',\n 'circle-stroke-width': 1.25,\n 'circle-stroke-color': '#3399CC',\n };\n}\n\n/**\n * A rule is used to conditionally apply a style. If the rule's filter evaluates to true,\n * the style will be applied.\n *\n * @typedef {Object} Rule\n * @property {FlatStyle|Array<FlatStyle>} style The style to be applied if the filter matches.\n * @property {import(\"../expr/expression.js\").EncodedExpression} [filter] The filter used\n * to determine if a style applies. If no filter is included, the rule always applies\n * (unless it is an else rule).\n * @property {boolean} [else] If true, the rule applies only if no other previous rule applies.\n * If the else rule also has a filter, the rule will not apply if the filter does not match.\n */\n\n/**\n * Style variables are provided as an object. The variables can be read in a {@link import(\"../expr/expression.js\").ExpressionValue style expression}\n * using the `['var', 'varName']` operator.\n * Each variable must hold a literal value (not an expression).\n * @typedef {Object<string, number|Array<number>|string|boolean>} StyleVariables\n */\n","/**\n * @module ol/source/SentinelHub\n */\n\nimport {\n equivalent as equivalentProjections,\n get as getProjection,\n} from '../proj.js';\nimport DataTileSource from './DataTile.js';\n\nconst defaultProcessUrl = 'https://services.sentinel-hub.com/api/v1/process';\n\nconst defaultTokenUrl =\n 'https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token';\n\nconst defaultEvalscriptVersion = '3';\n\n/**\n * @type {import('../size.js').Size}\n */\nconst defaultTileSize = [512, 512];\n\nconst maxRetries = 10;\nconst baseDelay = 500;\n\n/**\n * @typedef {Object} AuthConfig\n * @property {string} [tokenUrl='https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token'] The URL to get the authentication token.\n * @property {string} clientId The client ID.\n * @property {string} clientSecret The client secret.\n */\n\n/**\n * @typedef {Object} AccessTokenClaims\n * @property {number} exp The expiration time of the token (in seconds).\n */\n\n/**\n * @typedef {Object} Evalscript\n * @property {Setup} setup The setup function.\n * @property {EvaluatePixel} evaluatePixel The function to transform input samples into output values.\n * @property {UpdateOutput} [updateOutput] Optional function to adjust the output bands.\n * @property {UpdateOutputMetadata} [updateOutputMetadata] Optional function to update the output metadata.\n * @property {Collections} [preProcessScenes] Optional function called before processing.\n * @property {string} [version='3'] The Evalscript version.\n */\n\n/**\n * @typedef {function(): SetupResult} Setup\n */\n\n/**\n * @typedef {function(Sample|Array<Sample>, Scenes, InputMetadata, CustomData, OutputMetadata): OutputValues|Array<number>|void} EvaluatePixel\n */\n\n/**\n * @typedef {function(Object<string, UpdatedOutputDescription>): void} UpdateOutput\n */\n\n/**\n * @typedef {function(Scenes, InputMetadata, OutputMetadata): void} UpdateOutputMetadata\n */\n\n/**\n * @typedef {Object} SetupResult\n * @property {Array<string>|Array<InputDescription>} input Description of the input data.\n * @property {OutputDescription|Array<OutputDescription>} output Description of the output data.\n * @property {'SIMPLE'|'ORBIT'|'TILE'} [mosaicking='SIMPLE'] Control how samples from input scenes are composed.\n */\n\n/**\n * @typedef {Object} InputDescription\n * @property {Array<string>} bands Input band identifiers.\n * @property {string|Array<string>} [units] Input band units.\n * @property {Array<string>} [metadata] Properties to include in the input metadata.\n */\n\n/**\n * @typedef {Object} OutputDescription\n * @property {string} [id='default'] Output identifier.\n * @property {number} bands Number of output bands.\n * @property {SampleType} [sampleType='AUTO'] Output sample type.\n * @property {number} [nodataValue] Output nodata value.\n */\n\n/**\n * @typedef {Object} UpdatedOutputDescription\n * @property {number} bands Number of output bands.\n */\n\n/**\n * @typedef {'INT8'|'UINT8'|'INT16'|'UINT16'|'FLOAT32'|'AUTO'} SampleType\n */\n\n/**\n * @typedef {Object<string, number>} Sample\n */\n\n/**\n * @typedef {Object} Collections\n * @property {string} [from] For 'ORBIT' mosaicking, this will be the start of the search interval.\n * @property {string} [to] For 'ORBIT' mosaicking, this will be the end of the search interval.\n * @property {Scenes} scenes The scenes in the collection.\n */\n\n/**\n * @typedef {Object} Scenes\n * @property {Array<Orbit>} [orbit] Information about scenes included in the tile when 'mosaicking' is 'ORBIT'.\n * @property {Array<Tile>} [tiles] Information about scenes included in the tile when 'mosaicking' is 'TILE'.\n */\n\n/**\n * @typedef {Object} Orbit\n * @property {string} dateFrom The earliest date for all scenes included in the tile.\n * @property {string} dateTo The latest date for scenes included in the tile.\n * @property {Array} tiles Metadata for each tile.\n */\n\n/**\n * @typedef {Object} Tile\n * @property {string} date The date of scene used in the tile.\n * @property {number} cloudCoverage The estimated percentage of pixels obscured by clouds in the scene.\n * @property {string} dataPath The path to the data in storage.\n * @property {number} shId The internal identifier for the scene.\n */\n\n/**\n * @typedef {Object} InputMetadata\n * @property {string} serviceVersion The version of the service used for processing.\n * @property {number} normalizationFactor The factor used to convert digital number (DN) values to reflectance.\n */\n\n/**\n * @typedef {Object<string, unknown>} CustomData\n */\n\n/**\n * @typedef {Object} OutputMetadata\n * @property {Object} userData Arbitrary user data.\n */\n\n/**\n * @typedef {Object<string, Array<number>>} OutputValues\n */\n\n/**\n * @typedef {Object} ProcessRequest\n * @property {ProcessRequestInput} input Input data configuration.\n * @property {string} evalscript The Evalscript used for processing.\n * @property {ProcessRequestOutput} [output] The output configuration.\n */\n\n/**\n * @typedef {Object} ProcessRequestInput\n * @property {ProcessRequestInputBounds} bounds The bounding box of the input data.\n * @property {Array<ProcessRequestInputDataItem>} data The intput data.\n */\n\n/**\n * @typedef {Object} ProcessRequestInputDataItem\n * @property {string} [type] The type of the input data.\n * @property {string} [id] The identifier of the input data.\n * @property {DataFilter} [dataFilter] The filter to apply to the input data.\n * @property {Object<string, unknown>} [processing] The processing to apply to the input data.\n */\n\n/**\n * @typedef {Object} DataFilter\n * @property {TimeRange} [timeRange] The data time range.\n * @property {number} [maxCloudCoverage] The maximum cloud coverage (0-100).\n */\n\n/**\n * @typedef {Object} TimeRange\n * @property {string} [from] The start time (inclusive).\n * @property {string} [to] The end time (inclusive).\n */\n\n/**\n * @typedef {Object} ProcessRequestInputBounds\n * @property {Array<number>} [bbox] The bounding box of the input data.\n * @property {ProcessRequestInputBoundsProperties} [properties] The properties of the bounding box.\n * @property {import(\"geojson\").Geometry} [geometry] The geometry of the bounding box.\n */\n\n/**\n * @typedef {Object} ProcessRequestInputBoundsProperties\n * @property {string} crs The coordinate reference system of the bounding box.\n */\n\n/**\n * @typedef {Object} ProcessRequestOutput\n * @property {number} [width] Image width in pixels.\n * @property {number} [height] Image height in pixels.\n * @property {number} [resx] Spatial resolution in the x direction.\n * @property {number} [resy] Spatial resolution in the y direction.\n * @property {Array<ProcessRequestOutputResponse>} [responses] Response configuration.\n */\n\n/**\n * @typedef {Object} ProcessRequestOutputResponse\n * @property {string} [identifier] Identifier used to connect results to outputs from the setup.\n * @property {ProcessRequestOutputFormat} [format] Response format.\n */\n\n/**\n * @typedef {Object} ProcessRequestOutputFormat\n * @property {string} [type] The output format type.\n */\n\n/**\n * @param {Evalscript} evalscript The object to serialize.\n * @return {string} The serialized Evalscript.\n */\nfunction serializeEvalscript(evalscript) {\n const version = evalscript.version || defaultEvalscriptVersion;\n return `//VERSION=${version}\n ${serializeFunction('setup', evalscript.setup)}\n ${serializeFunction('evaluatePixel', evalscript.evaluatePixel)}\n ${serializeFunction('updateOutput', evalscript.updateOutput)}\n `;\n}\n\n/**\n * Get a loaded image given a response.\n *\n * @param {Response} response The response.\n * @return {Promise<HTMLImageElement>} The image.\n */\nasync function imageFromResponse(response) {\n const blob = await response.blob();\n\n return new Promise((resolve, reject) => {\n const image = new Image();\n const blobUrl = URL.createObjectURL(blob);\n image.onload = () => {\n URL.revokeObjectURL(blobUrl);\n resolve(image);\n };\n image.onerror = () => {\n URL.revokeObjectURL(blobUrl);\n reject(new Error('Failed to load image'));\n };\n image.src = blobUrl;\n });\n}\n\n/**\n * @param {number} ms Milliseconds.\n * @return {Promise<void>} A promise that resolves after the given time.\n */\nfunction delay(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * @param {AuthConfig} auth The authentication configuration.\n * @return {Promise<string>} The authentication token.\n */\nasync function getToken(auth) {\n const url = auth.tokenUrl || defaultTokenUrl;\n const body = new URLSearchParams();\n body.append('grant_type', 'client_credentials');\n body.append('client_id', auth.clientId);\n body.append('client_secret', auth.clientSecret);\n\n /**\n * @type {RequestInit}\n */\n const options = {\n method: 'POST',\n headers: {'Content-Type': 'application/x-www-form-urlencoded'},\n body,\n };\n const response = await fetch(url, options);\n if (!response.ok) {\n if (response.status === 401) {\n throw new Error('Bad client id or secret');\n }\n throw new Error('Failed to get token');\n }\n const data = await response.json();\n return data.access_token;\n}\n\n/**\n * @param {string} token The access token to parse.\n * @return {AccessTokenClaims} The parsed token claims.\n */\nexport function parseTokenClaims(token) {\n const base64EncodedClaims = token\n .split('.')[1]\n .replace(/-/g, '+')\n .replace(/_/g, '/');\n\n const chars = atob(base64EncodedClaims).split('');\n const count = chars.length;\n const uriEncodedChars = new Array(count);\n for (let i = 0; i < count; ++i) {\n const c = chars[i];\n uriEncodedChars[i] = '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }\n\n return JSON.parse(decodeURIComponent(uriEncodedChars.join('')));\n}\n\n/**\n * Gets a CRS identifier accepted by Sentinel Hub.\n * See https://docs.sentinel-hub.com/api/latest/api/process/crs/.\n *\n * @param {import(\"../proj/Projection.js\").default} projection The projection.\n * @return {string} The projection identifier accepted by Sentinel Hub.\n */\nexport function getProjectionIdentifier(projection) {\n const ogcId = 'http://www.opengis.net/def/crs/';\n const code = projection.getCode();\n if (code.startsWith(ogcId)) {\n return code;\n }\n if (code.startsWith('EPSG:')) {\n return `${ogcId}EPSG/0/${code.slice(5)}`;\n }\n if (equivalentProjections(projection, getProjection('EPSG:4326'))) {\n return `${ogcId}EPSG/0/4326`;\n }\n\n // hope for the best\n return code;\n}\n\n/**\n * This is intended to work with named functions, anonymous functions, arrow functions, and object methods.\n * Due to how the Evalscript is executed, these are serialized as function expressions using `var`.\n *\n * @param {string} name The name of the function.\n * @param {Function|undefined} func The function to serialize.\n * @return {string} The serialized function.\n */\nexport function serializeFunction(name, func) {\n if (!func) {\n return '';\n }\n let expression = func.toString();\n if (\n func.name &&\n func.name !== 'function' &&\n expression.match(new RegExp('^' + func.name.replace('$', '\\\\$') + '\\\\b'))\n ) {\n // assume function came from an object property using method syntax\n expression = 'function ' + expression;\n }\n return `var ${name} = ${expression};`;\n}\n\n/**\n * @typedef {Object} Options\n * @property {AuthConfig|string} [auth] The authentication configuration with `clientId` and `clientSecret` or an access token.\n * See [Sentinel Hub authentication](https://docs.sentinel-hub.com/api/latest/api/overview/authentication/)\n * for details. If not provided in the constructor, the source will not be rendered until {@link module:ol/source/SentinelHub~SentinelHub#setAuth}\n * is called.\n * @property {Array<ProcessRequestInputDataItem>} [data] The input data configuration. If not provided in the constructor,\n * the source will not be rendered until {@link module:ol/source/SentinelHub~SentinelHub#setData} is called.\n * @property {Evalscript|string} [evalscript] The process applied to the input data. If not provided in the constructor,\n * the source will not be rendered until {@link module:ol/source/SentinelHub~SentinelHub#setEvalscript} is called. See the\n * `setEvalscript` documentation for details on the restrictions when passing process functions.\n * @property {number|import(\"../size.js\").Size} [tileSize=[512, 512]] The pixel width and height of the source tiles.\n * @property {string} [url='https://services.sentinel-hub.com/api/v1/process'] The Sentinel Hub Processing API URL.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {boolean} [attributionsCollapsible=true] Allow the attributions to be collapsed.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {boolean} [wrapX=true] Wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n */\n\n/**\n * @classdesc\n * A tile source that generates tiles using the Sentinel Hub [Processing API](https://docs.sentinel-hub.com/api/latest/api/process/).\n * All of the constructor options are optional, however the source will not be ready for rendering until the `auth`, `data`,\n * and `evalscript` properties are provided. These can be set after construction with the {@link module:ol/source/SentinelHub~SentinelHub#setAuth},\n * {@link module:ol/source/SentinelHub~SentinelHub#setData}, and {@link module:ol/source/SentinelHub~SentinelHub#setEvalscript}\n * methods.\n *\n * If there are errors while configuring the source or fetching an access token, the `change` event will be fired and the\n * source state will be set to `error`. See the {@link module:ol/source/SentinelHub~SentinelHub#getError} method for\n * details on handling these errors.\n * @api\n */\nclass SentinelHub extends DataTileSource {\n /**\n * @param {Options} [options] Sentinel Hub options.\n */\n constructor(options) {\n /**\n * @type {Options}\n */\n const config = options || {};\n\n super({\n state: 'loading',\n projection: config.projection,\n attributionsCollapsible: config.attributionsCollapsible,\n interpolate: config.interpolate,\n tileSize: config.tileSize || defaultTileSize,\n wrapX: config.wrapX !== undefined ? config.wrapX : true,\n transition: config.transition,\n });\n\n this.setLoader((x, y, z) => this.loadTile_(x, y, z, 1));\n\n /**\n * @type {Error|null}\n */\n this.error_ = null;\n\n /**\n * @type {string}\n * @private\n */\n this.evalscript_ = '';\n\n /**\n * @type {Array<ProcessRequestInputDataItem>|null}\n * @private\n */\n this.inputData_ = null;\n\n /**\n * @type {string}\n * @private\n */\n this.processUrl_ = config.url || defaultProcessUrl;\n\n /**\n * @type {string}\n * @private\n */\n this.token_ = '';\n\n /**\n * @type {ReturnType<typeof setTimeout>}\n * @private\n */\n this.tokenRenewalId_;\n\n if (config.auth) {\n this.setAuth(config.auth);\n }\n\n if (config.data) {\n this.setData(config.data);\n }\n\n if (config.evalscript) {\n this.setEvalscript(config.evalscript);\n }\n }\n\n /**\n * Set the authentication configuration for the source (if not provided in the constructor).\n * If an object with `clientId` and `clientSecret` is provided, an access token will be fetched\n * and used with processing requests. Alternatively, an access token can be supplied directly.\n *\n * @param {AuthConfig|string} auth The auth config or access token.\n * @api\n */\n async setAuth(auth) {\n clearTimeout(this.tokenRenewalId_);\n\n if (typeof auth === 'string') {\n this.token_ = auth;\n this.fireWhenReady_();\n return;\n }\n\n /**\n * @type {string}\n */\n let token;\n\n /**\n * @type {AccessTokenClaims}\n */\n let claims;\n\n try {\n token = await getToken(auth);\n claims = parseTokenClaims(token);\n } catch (error) {\n this.error_ = error;\n this.setState('error');\n return;\n }\n this.token_ = token;\n\n const expiry = claims.exp * 1000;\n const timeout = Math.max(expiry - Date.now() - 60 * 1000, 1);\n this.tokenRenewalId_ = setTimeout(() => this.setAuth(auth), timeout);\n this.fireWhenReady_();\n }\n\n /**\n * Set or update the input data used.\n *\n * @param {Array<ProcessRequestInputDataItem>} data The input data configuration.\n * @api\n */\n setData(data) {\n this.inputData_ = data;\n this.fireWhenReady_();\n }\n\n /**\n * Set or update the Evalscript used to process the data. Either a process object or a string\n * Evalscript can be provided. If a process object is provided, it will be serialized to produce the\n * Evalscript string. Because these functions will be serialized and executed by the Processing API,\n * they cannot refer to other variables or functions that are not provided by the Processing API\n * context.\n *\n * @param {Evalscript|string} evalscript The process to apply to the input data.\n * @api\n */\n setEvalscript(evalscript) {\n let script;\n if (typeof evalscript === 'string') {\n script = evalscript;\n } else {\n try {\n script = serializeEvalscript(evalscript);\n } catch (error) {\n this.error_ = error;\n this.setState('error');\n return;\n }\n }\n this.evalscript_ = script;\n this.fireWhenReady_();\n }\n\n fireWhenReady_() {\n if (!this.token_ || !this.evalscript_ || !this.inputData_) {\n return;\n }\n const state = this.getState();\n if (state === 'ready') {\n this.changed();\n return;\n }\n this.setState('ready');\n }\n\n /**\n * @param {number} z The z tile index.\n * @param {number} x The x tile index.\n * @param {number} y The y tile index.\n * @param {number} attempt The attempt number (starting with 1). Incremented with retries.\n * @return {Promise<import('../DataTile.js').Data>} The composed tile data.\n * @private\n */\n async loadTile_(z, x, y, attempt) {\n const tileGrid = this.getTileGrid();\n const extent = tileGrid.getTileCoordExtent([z, x, y]);\n const tileSize = this.getTileSize(z);\n const projection = this.getProjection();\n\n /**\n * @type {ProcessRequest}\n */\n const body = {\n input: {\n bounds: {\n bbox: extent,\n properties: {crs: getProjectionIdentifier(projection)},\n },\n data: this.inputData_,\n },\n output: {\n width: tileSize[0],\n height: tileSize[1],\n },\n evalscript: this.evalscript_,\n };\n\n /**\n * @type {RequestInit}\n */\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${this.token_}`,\n 'Access-Control-Request-Headers': 'Retry-After',\n },\n body: JSON.stringify(body),\n credentials: 'include',\n };\n\n const response = await fetch(this.processUrl_, options);\n if (!response.ok) {\n if (response.status === 429 && attempt < maxRetries - 1) {\n // The Retry-After header includes unreasonable wait times, instead use exponential backoff.\n const retryAfter = baseDelay * 2 ** attempt;\n await delay(retryAfter);\n return this.loadTile_(x, y, z, attempt + 1);\n }\n throw new Error(`Failed to get tile: ${response.statusText}`);\n }\n\n return imageFromResponse(response);\n }\n\n /**\n * When the source state is `error`, use this function to get more information about the error.\n * To debug a faulty configuration, you may want to use a listener like this:\n * ```js\n * source.on('change', () => {\n * if (source.getState() === 'error') {\n * console.error(source.getError());\n * }\n * });\n * ```\n *\n * @return {Error|null} A source loading error.\n * @api\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n clearTimeout(this.tokenRenewalId_);\n super.disposeInternal();\n }\n}\n\nexport default SentinelHub;\n","/**\n * @module ol/renderer/webgl/Layer\n */\nimport LayerProperty from '../../layer/Property.js';\nimport RenderEvent from '../../render/Event.js';\nimport RenderEventType from '../../render/EventType.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport WebGLHelper from '../../webgl/Helper.js';\nimport LayerRenderer from '../Layer.js';\n\n/**\n * @typedef {Object} PostProcessesOptions\n * @property {number} [scaleRatio] Scale ratio; if < 1, the post process will render to a texture smaller than\n * the main canvas that will then be sampled up (useful for saving resource on blur steps).\n * @property {string} [vertexShader] Vertex shader source\n * @property {string} [fragmentShader] Fragment shader source\n * @property {Object<string,import(\"../../webgl/Helper\").UniformValue>} [uniforms] Uniform definitions for the post process step\n */\n\n/**\n * @typedef {Object} Options\n * @property {Object<string,import(\"../../webgl/Helper\").UniformValue>} [uniforms] Uniform definitions for the post process steps\n * @property {Array<PostProcessesOptions>} [postProcesses] Post-processes definitions\n */\n\n/**\n * @classdesc\n * Base WebGL renderer class.\n * Holds all logic related to data manipulation & some common rendering logic\n * @template {import(\"../../layer/Layer.js\").default} LayerType\n * @extends {LayerRenderer<LayerType>}\n */\nclass WebGLLayerRenderer extends LayerRenderer {\n /**\n * @param {LayerType} layer Layer.\n * @param {Options} [options] Options.\n */\n constructor(layer, options) {\n super(layer);\n\n options = options || {};\n\n /**\n * The transform for viewport CSS pixels to rendered pixels. This transform is only\n * set before dispatching rendering events.\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.inversePixelTransform_ = createTransform();\n\n /**\n * @private\n */\n this.postProcesses_ = options.postProcesses;\n\n /**\n * @private\n */\n this.uniforms_ = options.uniforms;\n\n /**\n * @type {WebGLHelper}\n * @protected\n */\n this.helper;\n\n this.onMapChanged_ = () => {\n this.clearCache();\n this.removeHelper();\n };\n\n layer.addChangeListener(LayerProperty.MAP, this.onMapChanged_);\n\n this.dispatchPreComposeEvent = this.dispatchPreComposeEvent.bind(this);\n this.dispatchPostComposeEvent = this.dispatchPostComposeEvent.bind(this);\n }\n\n /**\n * @param {WebGLRenderingContext} context The WebGL rendering context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n dispatchPreComposeEvent(context, frameState) {\n const layer = this.getLayer();\n if (layer.hasListener(RenderEventType.PRECOMPOSE)) {\n const event = new RenderEvent(\n RenderEventType.PRECOMPOSE,\n undefined,\n frameState,\n context,\n );\n layer.dispatchEvent(event);\n }\n }\n\n /**\n * @param {WebGLRenderingContext} context The WebGL rendering context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n dispatchPostComposeEvent(context, frameState) {\n const layer = this.getLayer();\n if (layer.hasListener(RenderEventType.POSTCOMPOSE)) {\n const event = new RenderEvent(\n RenderEventType.POSTCOMPOSE,\n undefined,\n frameState,\n context,\n );\n layer.dispatchEvent(event);\n }\n }\n\n /**\n * Reset options (only handles uniforms).\n * @param {Options} options Options.\n */\n reset(options) {\n this.uniforms_ = options.uniforms;\n if (this.helper) {\n this.helper.setUniforms(this.uniforms_);\n }\n }\n\n /**\n * @protected\n */\n removeHelper() {\n if (this.helper) {\n this.helper.dispose();\n delete this.helper;\n }\n }\n\n /**\n * Determine whether renderFrame should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrame(frameState) {\n if (this.getLayer().getRenderSource()) {\n let incrementGroup = true;\n let groupNumber = -1;\n let className;\n for (let i = 0, ii = frameState.layerStatesArray.length; i < ii; i++) {\n const layer = frameState.layerStatesArray[i].layer;\n const renderer = layer.getRenderer();\n if (!(renderer instanceof WebGLLayerRenderer)) {\n incrementGroup = true;\n continue;\n }\n const layerClassName = layer.getClassName();\n if (incrementGroup || layerClassName !== className) {\n groupNumber += 1;\n incrementGroup = false;\n }\n className = layerClassName;\n if (renderer === this) {\n break;\n }\n }\n\n const canvasCacheKey =\n 'map/' + frameState.mapId + '/group/' + groupNumber;\n\n if (\n !this.helper ||\n !this.helper.canvasCacheKeyMatches(canvasCacheKey) ||\n this.helper.needsToBeRecreated()\n ) {\n this.removeHelper();\n\n this.helper = new WebGLHelper({\n postProcesses: this.postProcesses_,\n uniforms: this.uniforms_,\n canvasCacheKey: canvasCacheKey,\n });\n\n if (className) {\n this.helper.getCanvas().className = className;\n }\n\n this.afterHelperCreated();\n }\n }\n\n return this.prepareFrameInternal(frameState);\n }\n\n /**\n * @protected\n */\n afterHelperCreated() {}\n\n /**\n * Determine whether renderFrame should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @protected\n */\n prepareFrameInternal(frameState) {\n return true;\n }\n\n /**\n * @protected\n */\n clearCache() {}\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.clearCache();\n this.removeHelper();\n this.getLayer()?.removeChangeListener(\n LayerProperty.MAP,\n this.onMapChanged_,\n );\n super.disposeInternal();\n }\n\n /**\n * @param {import(\"../../render/EventType.js\").default} type Event type.\n * @param {WebGLRenderingContext} context The rendering context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @private\n */\n dispatchRenderEvent_(type, context, frameState) {\n const layer = this.getLayer();\n if (layer.hasListener(type)) {\n composeTransform(\n this.inversePixelTransform_,\n 0,\n 0,\n frameState.pixelRatio,\n -frameState.pixelRatio,\n 0,\n 0,\n -frameState.size[1],\n );\n\n const event = new RenderEvent(\n type,\n this.inversePixelTransform_,\n frameState,\n context,\n );\n layer.dispatchEvent(event);\n }\n }\n\n /**\n * @param {WebGLRenderingContext} context The rendering context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n preRender(context, frameState) {\n this.dispatchRenderEvent_(RenderEventType.PRERENDER, context, frameState);\n }\n\n /**\n * @param {WebGLRenderingContext} context The rendering context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n postRender(context, frameState) {\n this.dispatchRenderEvent_(RenderEventType.POSTRENDER, context, frameState);\n }\n}\n\nexport default WebGLLayerRenderer;\n","/**\n * @module ol/renderer/webgl/TileLayerBase\n */\nimport TileRange from '../../TileRange.js';\nimport TileState from '../../TileState.js';\nimport {descending} from '../../array.js';\nimport {getIntersection, getRotatedViewport, isEmpty} from '../../extent.js';\nimport {fromUserExtent} from '../../proj.js';\nimport {toSize} from '../../size.js';\nimport LRUCache from '../../structs/LRUCache.js';\nimport {\n createOrUpdate as createTileCoord,\n getKey as getTileCoordKey,\n} from '../../tilecoord.js';\nimport {\n create as createTransform,\n reset as resetTransform,\n rotate as rotateTransform,\n scale as scaleTransform,\n translate as translateTransform,\n} from '../../transform.js';\nimport {abstract, getUid} from '../../util.js';\nimport {create as createMat4} from '../../vec/mat4.js';\nimport WebGLLayerRenderer from './Layer.js';\n\nexport const Uniforms = {\n TILE_TRANSFORM: 'u_tileTransform',\n TRANSITION_ALPHA: 'u_transitionAlpha',\n DEPTH: 'u_depth',\n RENDER_EXTENT: 'u_renderExtent', // intersection of layer, source, and view extent\n PATTERN_ORIGIN: 'u_patternOrigin',\n RESOLUTION: 'u_resolution',\n ZOOM: 'u_zoom',\n GLOBAL_ALPHA: 'u_globalAlpha',\n PROJECTION_MATRIX: 'u_projectionMatrix',\n SCREEN_TO_WORLD_MATRIX: 'u_screenToWorldMatrix',\n};\n\n/**\n * Transform a zoom level into a depth value; zoom level zero has a depth value of 0.5, and increasing values\n * have a depth trending towards 0\n * @param {number} z A zoom level.\n * @return {number} A depth value.\n */\nfunction depthForZ(z) {\n return 1 / (z + 2);\n}\n\n/**\n * @typedef {import(\"../../webgl/BaseTileRepresentation.js\").default<import(\"../../Tile.js\").default>} AbstractTileRepresentation\n */\n/**\n * @typedef {Object} TileRepresentationLookup\n * @property {Set<string>} tileIds The set of tile ids in the lookup.\n * @property {Object<number, Set<AbstractTileRepresentation>>} representationsByZ Tile representations by zoom level.\n */\n\n/**\n * @return {TileRepresentationLookup} A new tile representation lookup.\n */\nexport function newTileRepresentationLookup() {\n return {tileIds: new Set(), representationsByZ: {}};\n}\n\n/**\n * Check if a tile is already in the tile representation lookup.\n * @param {TileRepresentationLookup} tileRepresentationLookup Lookup of tile representations by zoom level.\n * @param {import(\"../../Tile.js\").default} tile A tile.\n * @return {boolean} The tile is already in the lookup.\n */\nfunction lookupHasTile(tileRepresentationLookup, tile) {\n return tileRepresentationLookup.tileIds.has(getUid(tile));\n}\n\n/**\n * Add a tile representation to the lookup.\n * @param {TileRepresentationLookup} tileRepresentationLookup Lookup of tile representations by zoom level.\n * @param {AbstractTileRepresentation} tileRepresentation A tile representation.\n * @param {number} z The zoom level.\n */\nfunction addTileRepresentationToLookup(\n tileRepresentationLookup,\n tileRepresentation,\n z,\n) {\n const representationsByZ = tileRepresentationLookup.representationsByZ;\n if (!(z in representationsByZ)) {\n representationsByZ[z] = new Set();\n }\n representationsByZ[z].add(tileRepresentation);\n tileRepresentationLookup.tileIds.add(getUid(tileRepresentation.tile));\n}\n\n/**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../../extent.js\").Extent} extent The frame extent.\n * @return {import(\"../../extent.js\").Extent} Frame extent intersected with layer extents.\n */\nfunction getRenderExtent(frameState, extent) {\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n if (layerState.extent) {\n extent = getIntersection(\n extent,\n fromUserExtent(layerState.extent, frameState.viewState.projection),\n );\n }\n const source = /** @type {import(\"../../source/Tile.js\").default} */ (\n layerState.layer.getRenderSource()\n );\n if (!source.getWrapX()) {\n const gridExtent = source\n .getTileGridForProjection(frameState.viewState.projection)\n .getExtent();\n if (gridExtent) {\n extent = getIntersection(extent, gridExtent);\n }\n }\n return extent;\n}\n\n/**\n * @param {import(\"../../source/Tile.js\").default} source The source.\n * @param {import('../../tilecoord.js').TileCoord} tileCoord The tile coordinate.\n * @return {string} The cache key.\n */\nexport function getCacheKey(source, tileCoord) {\n return `${getUid(source)},${source.getKey()},${source.getRevision()},${getTileCoordKey(tileCoord)}`;\n}\n\n/**\n * @typedef {Object} Options\n * @property {Object<string, import(\"../../webgl/Helper\").UniformValue>} [uniforms] Additional uniforms\n * made available to shaders.\n * @property {number} [cacheSize=512] The tile representation cache size.\n * @property {Array<import('./Layer.js').PostProcessesOptions>} [postProcesses] Post-processes definitions.\n */\n\n/**\n * @typedef {import(\"../../layer/BaseTile.js\").default} BaseLayerType\n */\n\n/**\n * @classdesc\n * Base WebGL renderer for tile layers.\n * @template {BaseLayerType} LayerType\n * @template {import(\"../../Tile.js\").default} TileType\n * @template {import(\"../../webgl/BaseTileRepresentation.js\").default<TileType>} TileRepresentation\n * @extends {WebGLLayerRenderer<LayerType>}\n */\nclass WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {\n /**\n * @param {LayerType} tileLayer Tile layer.\n * @param {Options} options Options.\n */\n constructor(tileLayer, options) {\n super(tileLayer, {\n uniforms: options.uniforms,\n postProcesses: options.postProcesses,\n });\n\n /**\n * The last call to `renderFrame` was completed with all tiles loaded\n * @type {boolean}\n */\n this.renderComplete = false;\n\n /**\n * This transform converts representation coordinates to screen coordinates.\n * @type {import(\"../../transform.js\").Transform}\n * @private\n */\n this.tileTransform_ = createTransform();\n\n /**\n * @type {Array<number>}\n * @protected\n */\n this.tempMat4 = createMat4();\n\n /**\n * @type {import(\"../../TileRange.js\").default}\n * @private\n */\n this.tempTileRange_ = new TileRange(0, 0, 0, 0);\n\n /**\n * @type {import(\"../../tilecoord.js\").TileCoord}\n * @private\n */\n this.tempTileCoord_ = createTileCoord(0, 0, 0);\n\n /**\n * @type {import(\"../../size.js\").Size}\n * @private\n */\n this.tempSize_ = [0, 0];\n\n const cacheSize = options.cacheSize !== undefined ? options.cacheSize : 512;\n /**\n * @type {import(\"../../structs/LRUCache.js\").default<TileRepresentation>}\n * @protected\n */\n this.tileRepresentationCache = new LRUCache(cacheSize);\n\n /**\n * @protected\n * @type {import(\"../../Map.js\").FrameState|null}\n */\n this.frameState = null;\n\n /**\n * @private\n * @type {import(\"../../proj/Projection.js\").default}\n */\n this.renderedProjection_ = undefined;\n }\n\n /**\n * @param {Options} options Options.\n * @override\n */\n reset(options) {\n super.reset({\n uniforms: options.uniforms,\n });\n }\n\n /**\n * Determine whether renderFrame should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrameInternal(frameState) {\n if (!this.renderedProjection_) {\n this.renderedProjection_ = frameState.viewState.projection;\n } else if (frameState.viewState.projection !== this.renderedProjection_) {\n this.clearCache();\n this.renderedProjection_ = frameState.viewState.projection;\n }\n\n const layer = this.getLayer();\n const source = layer.getRenderSource();\n if (!source) {\n return false;\n }\n\n if (isEmpty(getRenderExtent(frameState, frameState.extent))) {\n return false;\n }\n return source.getState() === 'ready';\n }\n\n /**\n * @abstract\n * @param {import(\"../../webgl/BaseTileRepresentation.js\").TileRepresentationOptions<TileType>} options tile representation options\n * @return {TileRepresentation} A new tile representation\n * @protected\n */\n createTileRepresentation(options) {\n return abstract();\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../../extent.js\").Extent} extent The extent to be rendered.\n * @param {number} initialZ The zoom level.\n * @param {TileRepresentationLookup} tileRepresentationLookup The zoom level.\n * @param {number} preload Number of additional levels to load.\n */\n enqueueTiles(\n frameState,\n extent,\n initialZ,\n tileRepresentationLookup,\n preload,\n ) {\n const viewState = frameState.viewState;\n const tileLayer = this.getLayer();\n const tileSource = tileLayer.getRenderSource();\n const tileGrid = tileSource.getTileGridForProjection(viewState.projection);\n const gutter = tileSource.getGutterForProjection(viewState.projection);\n\n const tileSourceKey = getUid(tileSource);\n if (!(tileSourceKey in frameState.wantedTiles)) {\n frameState.wantedTiles[tileSourceKey] = {};\n }\n\n const wantedTiles = frameState.wantedTiles[tileSourceKey];\n const tileRepresentationCache = this.tileRepresentationCache;\n\n const map = tileLayer.getMapInternal();\n const minZ = Math.max(\n initialZ - preload,\n tileGrid.getMinZoom(),\n tileGrid.getZForResolution(\n Math.min(\n tileLayer.getMaxResolution(),\n map\n ? map\n .getView()\n .getResolutionForZoom(Math.max(tileLayer.getMinZoom(), 0))\n : tileGrid.getResolution(0),\n ),\n tileSource.zDirection,\n ),\n );\n const rotation = viewState.rotation;\n const viewport = rotation\n ? getRotatedViewport(\n viewState.center,\n viewState.resolution,\n rotation,\n frameState.size,\n )\n : undefined;\n for (let z = initialZ; z >= minZ; --z) {\n const tileRange = tileGrid.getTileRangeForExtentAndZ(\n extent,\n z,\n this.tempTileRange_,\n );\n\n const tileResolution = tileGrid.getResolution(z);\n\n for (let x = tileRange.minX; x <= tileRange.maxX; ++x) {\n for (let y = tileRange.minY; y <= tileRange.maxY; ++y) {\n if (\n rotation &&\n !tileGrid.tileCoordIntersectsViewport([z, x, y], viewport)\n ) {\n continue;\n }\n const tileCoord = createTileCoord(z, x, y, this.tempTileCoord_);\n const cacheKey = getCacheKey(tileSource, tileCoord);\n\n /** @type {TileRepresentation} */\n let tileRepresentation;\n\n /** @type {TileType} */\n let tile;\n\n if (tileRepresentationCache.containsKey(cacheKey)) {\n tileRepresentation = tileRepresentationCache.get(cacheKey);\n tile = tileRepresentation.tile;\n }\n if (\n !tileRepresentation ||\n tileRepresentation.tile.key !== tileSource.getKey()\n ) {\n tile = tileSource.getTile(\n z,\n x,\n y,\n frameState.pixelRatio,\n viewState.projection,\n );\n if (!tile) {\n continue;\n }\n }\n\n if (lookupHasTile(tileRepresentationLookup, tile)) {\n continue;\n }\n\n if (!tileRepresentation) {\n tileRepresentation = this.createTileRepresentation({\n tile: tile,\n grid: tileGrid,\n helper: this.helper,\n gutter: gutter,\n });\n tileRepresentationCache.set(cacheKey, tileRepresentation);\n } else {\n tileRepresentation.setTile(tile);\n }\n\n addTileRepresentationToLookup(\n tileRepresentationLookup,\n tileRepresentation,\n z,\n );\n\n const tileQueueKey = tile.getKey();\n wantedTiles[tileQueueKey] = true;\n\n if (tile.getState() === TileState.IDLE) {\n if (!frameState.tileQueue.isKeyQueued(tileQueueKey)) {\n frameState.tileQueue.enqueue([\n tile,\n tileSourceKey,\n tileGrid.getTileCoordCenter(tileCoord),\n tileResolution,\n ]);\n }\n }\n }\n }\n }\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {boolean} tilesWithAlpha True if at least one of the rendered tiles has alpha\n * @protected\n */\n beforeTilesRender(frameState, tilesWithAlpha) {\n this.helper.prepareDraw(this.frameState, !tilesWithAlpha, true);\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} If returns false, tile mask rendering will be skipped\n * @protected\n */\n beforeTilesMaskRender(frameState) {\n return false;\n }\n\n /**\n * @param {TileRepresentation} tileRepresentation Tile representation\n * @param {import(\"../../transform.js\").Transform} tileTransform Tile transform\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state\n * @param {import(\"../../extent.js\").Extent} renderExtent Render extent\n * @param {number} tileResolution Tile resolution\n * @param {import(\"../../size.js\").Size} tileSize Tile size\n * @param {import(\"../../coordinate.js\").Coordinate} tileOrigin Tile origin\n * @param {import(\"../../extent.js\").Extent} tileExtent tile Extent\n * @param {number} depth Depth\n * @param {number} gutter Gutter\n * @param {number} alpha Alpha\n * @protected\n */\n renderTile(\n tileRepresentation,\n tileTransform,\n frameState,\n renderExtent,\n tileResolution,\n tileSize,\n tileOrigin,\n tileExtent,\n depth,\n gutter,\n alpha,\n ) {}\n\n /**\n * @param {TileRepresentation} tileRepresentation Tile representation\n * @param {number} tileZ Tile Z\n * @param {import(\"../../extent.js\").Extent} extent Render extent\n * @param {number} depth Depth\n * @protected\n */\n renderTileMask(tileRepresentation, tileZ, extent, depth) {}\n\n drawTile_(\n frameState,\n tileRepresentation,\n tileZ,\n gutter,\n extent,\n alphaLookup,\n tileGrid,\n ) {\n if (!tileRepresentation.ready) {\n return;\n }\n const tile = tileRepresentation.tile;\n const tileCoord = tile.tileCoord;\n const tileCoordKey = getTileCoordKey(tileCoord);\n const alpha = tileCoordKey in alphaLookup ? alphaLookup[tileCoordKey] : 1;\n\n const tileResolution = tileGrid.getResolution(tileZ);\n const tileSize = toSize(tileGrid.getTileSize(tileZ), this.tempSize_);\n const tileOrigin = tileGrid.getOrigin(tileZ);\n const tileExtent = tileGrid.getTileCoordExtent(tileCoord);\n // tiles with alpha are rendered last to allow blending\n const depth = alpha < 1 ? -1 : depthForZ(tileZ);\n if (alpha < 1) {\n frameState.animate = true;\n }\n\n const viewState = frameState.viewState;\n const centerX = viewState.center[0];\n const centerY = viewState.center[1];\n\n const tileWidthWithGutter = tileSize[0] + 2 * gutter;\n const tileHeightWithGutter = tileSize[1] + 2 * gutter;\n\n const aspectRatio = tileWidthWithGutter / tileHeightWithGutter;\n\n const centerI = (centerX - tileOrigin[0]) / (tileSize[0] * tileResolution);\n const centerJ = (tileOrigin[1] - centerY) / (tileSize[1] * tileResolution);\n\n const tileScale = viewState.resolution / tileResolution;\n\n const tileCenterI = tileCoord[1];\n const tileCenterJ = tileCoord[2];\n\n resetTransform(this.tileTransform_);\n scaleTransform(\n this.tileTransform_,\n 2 / ((frameState.size[0] * tileScale) / tileWidthWithGutter),\n -2 / ((frameState.size[1] * tileScale) / tileWidthWithGutter),\n );\n rotateTransform(this.tileTransform_, viewState.rotation);\n scaleTransform(this.tileTransform_, 1, 1 / aspectRatio);\n translateTransform(\n this.tileTransform_,\n (tileSize[0] * (tileCenterI - centerI) - gutter) / tileWidthWithGutter,\n (tileSize[1] * (tileCenterJ - centerJ) - gutter) / tileHeightWithGutter,\n );\n\n this.renderTile(\n /** @type {TileRepresentation} */ (tileRepresentation),\n this.tileTransform_,\n frameState,\n extent,\n tileResolution,\n tileSize,\n tileOrigin,\n tileExtent,\n depth,\n gutter,\n alpha,\n );\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n renderFrame(frameState) {\n this.frameState = frameState;\n this.renderComplete = true;\n const gl = this.helper.getGL();\n this.preRender(gl, frameState);\n\n const viewState = frameState.viewState;\n const tileLayer = this.getLayer();\n const tileSource = tileLayer.getRenderSource();\n const tileGrid = tileSource.getTileGridForProjection(viewState.projection);\n const gutter = tileSource.getGutterForProjection(viewState.projection);\n const extent = getRenderExtent(frameState, frameState.extent);\n const z = tileGrid.getZForResolution(\n viewState.resolution,\n tileSource.zDirection,\n );\n\n /**\n * @type {TileRepresentationLookup}\n */\n const tileRepresentationLookup = newTileRepresentationLookup();\n\n const preload = tileLayer.getPreload();\n if (frameState.nextExtent) {\n const targetZ = tileGrid.getZForResolution(\n viewState.nextResolution,\n tileSource.zDirection,\n );\n const nextExtent = getRenderExtent(frameState, frameState.nextExtent);\n this.enqueueTiles(\n frameState,\n nextExtent,\n targetZ,\n tileRepresentationLookup,\n preload,\n );\n }\n\n this.enqueueTiles(frameState, extent, z, tileRepresentationLookup, 0);\n if (preload > 0) {\n setTimeout(() => {\n this.enqueueTiles(\n frameState,\n extent,\n z - 1,\n tileRepresentationLookup,\n preload - 1,\n );\n }, 0);\n }\n\n /**\n * A lookup of alpha values for tiles at the target rendering resolution\n * for tiles that are in transition. If a tile coord key is absent from\n * this lookup, the tile should be rendered at alpha 1.\n * @type {Object<string, number>}\n */\n const alphaLookup = {};\n\n let blend = false;\n const representationsByZ = tileRepresentationLookup.representationsByZ;\n\n // look for cached tiles to use if a target tile is not ready\n if (z in representationsByZ) {\n const uid = getUid(this);\n const time = frameState.time;\n for (const tileRepresentation of representationsByZ[z]) {\n const tile = tileRepresentation.tile;\n if (tile.getState() === TileState.EMPTY) {\n continue;\n }\n const tileCoord = tile.tileCoord;\n\n if (tileRepresentation.ready) {\n const alpha = tile.getAlpha(uid, time);\n if (alpha === 1) {\n // no need to look for alt tiles\n tile.endTransition(uid);\n continue;\n }\n blend = true;\n const tileCoordKey = getTileCoordKey(tileCoord);\n alphaLookup[tileCoordKey] = alpha;\n }\n this.renderComplete = false;\n\n // first look for child tiles (at z + 1)\n const coveredByChildren = this.findAltTiles_(\n tileGrid,\n tileCoord,\n z + 1,\n tileRepresentationLookup,\n );\n\n if (coveredByChildren) {\n continue;\n }\n\n // next look for parent tiles\n const minZoom = tileGrid.getMinZoom();\n for (let parentZ = z - 1; parentZ >= minZoom; --parentZ) {\n const coveredByParent = this.findAltTiles_(\n tileGrid,\n tileCoord,\n parentZ,\n tileRepresentationLookup,\n );\n\n if (coveredByParent) {\n break;\n }\n }\n }\n }\n\n const zs = Object.keys(representationsByZ).map(Number).sort(descending);\n\n const renderTileMask = this.beforeTilesMaskRender(frameState);\n\n if (renderTileMask) {\n for (let j = 0, jj = zs.length; j < jj; ++j) {\n const tileZ = zs[j];\n for (const tileRepresentation of representationsByZ[tileZ]) {\n const tileCoord = tileRepresentation.tile.tileCoord;\n const tileCoordKey = getTileCoordKey(tileCoord);\n // do not render the tile mask if alpha < 1\n if (tileCoordKey in alphaLookup) {\n continue;\n }\n const tileExtent = tileGrid.getTileCoordExtent(tileCoord);\n this.renderTileMask(\n /** @type {TileRepresentation} */ (tileRepresentation),\n tileZ,\n tileExtent,\n depthForZ(tileZ),\n );\n }\n }\n }\n\n this.beforeTilesRender(frameState, blend);\n\n for (let j = 0, jj = zs.length; j < jj; ++j) {\n const tileZ = zs[j];\n for (const tileRepresentation of representationsByZ[tileZ]) {\n const tileCoord = tileRepresentation.tile.tileCoord;\n const tileCoordKey = getTileCoordKey(tileCoord);\n if (tileCoordKey in alphaLookup) {\n continue;\n }\n\n this.drawTile_(\n frameState,\n tileRepresentation,\n tileZ,\n gutter,\n extent,\n alphaLookup,\n tileGrid,\n );\n }\n }\n\n if (z in representationsByZ) {\n for (const tileRepresentation of representationsByZ[z]) {\n const tileCoord = tileRepresentation.tile.tileCoord;\n const tileCoordKey = getTileCoordKey(tileCoord);\n if (tileCoordKey in alphaLookup) {\n this.drawTile_(\n frameState,\n tileRepresentation,\n z,\n gutter,\n extent,\n alphaLookup,\n tileGrid,\n );\n }\n }\n }\n\n this.beforeFinalize(frameState);\n this.helper.finalizeDraw(\n frameState,\n this.dispatchPreComposeEvent,\n this.dispatchPostComposeEvent,\n );\n\n const canvas = this.helper.getCanvas();\n\n const tileRepresentationCache = this.tileRepresentationCache;\n while (tileRepresentationCache.canExpireCache()) {\n const tileRepresentation = tileRepresentationCache.pop();\n tileRepresentation.dispose();\n }\n\n this.postRender(gl, frameState);\n return canvas;\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n beforeFinalize(frameState) {\n return;\n }\n\n /**\n * Look for tiles covering the provided tile coordinate at an alternate\n * zoom level. Loaded tiles will be added to the provided tile representation lookup.\n * @param {import(\"../../tilegrid/TileGrid.js\").default} tileGrid The tile grid.\n * @param {import(\"../../tilecoord.js\").TileCoord} tileCoord The target tile coordinate.\n * @param {number} altZ The alternate zoom level.\n * @param {TileRepresentationLookup} tileRepresentationLookup Lookup of\n * tile representations by zoom level.\n * @return {boolean} The tile coordinate is covered by loaded tiles at the alternate zoom level.\n * @private\n */\n findAltTiles_(tileGrid, tileCoord, altZ, tileRepresentationLookup) {\n const tileRange = tileGrid.getTileRangeForTileCoordAndZ(\n tileCoord,\n altZ,\n this.tempTileRange_,\n );\n\n if (!tileRange) {\n return false;\n }\n\n let covered = true;\n const tileRepresentationCache = this.tileRepresentationCache;\n const source = this.getLayer().getRenderSource();\n for (let x = tileRange.minX; x <= tileRange.maxX; ++x) {\n for (let y = tileRange.minY; y <= tileRange.maxY; ++y) {\n const cacheKey = getCacheKey(source, [altZ, x, y]);\n let loaded = false;\n if (tileRepresentationCache.containsKey(cacheKey)) {\n const tileRepresentation = tileRepresentationCache.get(cacheKey);\n if (\n tileRepresentation.ready &&\n !lookupHasTile(tileRepresentationLookup, tileRepresentation.tile)\n ) {\n addTileRepresentationToLookup(\n tileRepresentationLookup,\n tileRepresentation,\n altZ,\n );\n loaded = true;\n }\n }\n if (!loaded) {\n covered = false;\n }\n }\n }\n return covered;\n }\n\n /**\n * @override\n */\n clearCache() {\n super.clearCache();\n\n const tileRepresentationCache = this.tileRepresentationCache;\n tileRepresentationCache.forEach((tileRepresentation) =>\n tileRepresentation.dispose(),\n );\n tileRepresentationCache.clear();\n }\n\n /**\n * @override\n */\n afterHelperCreated() {\n super.afterHelperCreated();\n\n this.tileRepresentationCache.forEach((tileRepresentation) =>\n tileRepresentation.setHelper(this.helper),\n );\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n super.disposeInternal();\n delete this.frameState;\n }\n}\n\nexport default WebGLBaseTileLayerRenderer;\n","/**\n * @module ol/renderer/webgl/TileLayer\n */\nimport TileState from '../../TileState.js';\nimport {\n boundingExtent,\n containsCoordinate,\n getIntersection,\n} from '../../extent.js';\nimport {fromUserExtent} from '../../proj.js';\nimport {toSize} from '../../size.js';\nimport {apply as applyTransform} from '../../transform.js';\nimport {fromTransform as mat4FromTransform} from '../../vec/mat4.js';\nimport WebGLArrayBuffer from '../../webgl/Buffer.js';\nimport {AttributeType} from '../../webgl/Helper.js';\nimport TileTexture from '../../webgl/TileTexture.js';\nimport {ELEMENT_ARRAY_BUFFER, STATIC_DRAW} from '../../webgl.js';\nimport WebGLBaseTileLayerRenderer, {\n Uniforms as BaseUniforms,\n getCacheKey,\n} from './TileLayerBase.js';\n\nexport const Uniforms = {\n ...BaseUniforms,\n TILE_TEXTURE_ARRAY: 'u_tileTextures',\n TEXTURE_PIXEL_WIDTH: 'u_texturePixelWidth',\n TEXTURE_PIXEL_HEIGHT: 'u_texturePixelHeight',\n TEXTURE_RESOLUTION: 'u_textureResolution', // map units per texture pixel\n TEXTURE_ORIGIN_X: 'u_textureOriginX', // map x coordinate of left edge of texture\n TEXTURE_ORIGIN_Y: 'u_textureOriginY', // map y coordinate of top edge of texture\n};\n\nexport const Attributes = {\n TEXTURE_COORD: 'a_textureCoord',\n};\n\n/**\n * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}\n */\nconst attributeDescriptions = [\n {\n name: Attributes.TEXTURE_COORD,\n size: 2,\n type: AttributeType.FLOAT,\n },\n];\n\n/**\n * @typedef {Object} Options\n * @property {string} vertexShader Vertex shader source.\n * @property {string} fragmentShader Fragment shader source.\n * @property {Object<string, import(\"../../webgl/Helper\").UniformValue>} [uniforms] Additional uniforms\n * made available to shaders.\n * @property {Array<import(\"../../webgl/PaletteTexture.js\").default>} [paletteTextures] Palette textures.\n * @property {number} [cacheSize=512] The texture cache size.\n * @property {Array<import('./Layer.js').PostProcessesOptions>} [postProcesses] Post-processes definitions.\n */\n\n/**\n * @typedef {import(\"../../webgl/TileTexture.js\").TileType} TileTextureType\n */\n\n/**\n * @typedef {import(\"../../webgl/TileTexture.js\").default} TileTextureRepresentation\n */\n\n/**\n * @classdesc\n * WebGL renderer for tile layers.\n * @template {import(\"../../layer/WebGLTile.js\").default|import(\"../../layer/Flow.js\").default} LayerType\n * @extends {WebGLBaseTileLayerRenderer<LayerType, TileTextureType, TileTextureRepresentation>}\n * @api\n */\nclass WebGLTileLayerRenderer extends WebGLBaseTileLayerRenderer {\n /**\n * @param {LayerType} tileLayer Tile layer.\n * @param {Options} options Options.\n */\n constructor(tileLayer, options) {\n super(tileLayer, options);\n\n /**\n * @type {WebGLProgram}\n * @private\n */\n this.program_;\n\n /**\n * @private\n */\n this.vertexShader_ = options.vertexShader;\n\n /**\n * @private\n */\n this.fragmentShader_ = options.fragmentShader;\n\n /**\n * Tiles are rendered as a quad with the following structure:\n *\n * [P3]---------[P2]\n * |` |\n * | ` B |\n * | ` |\n * | ` |\n * | A ` |\n * | ` |\n * [P0]---------[P1]\n *\n * Triangle A: P0, P1, P3\n * Triangle B: P1, P2, P3\n *\n * @private\n */\n this.indices_ = new WebGLArrayBuffer(ELEMENT_ARRAY_BUFFER, STATIC_DRAW);\n this.indices_.fromArray([0, 1, 3, 1, 2, 3]);\n\n /**\n * @type {Array<import(\"../../webgl/PaletteTexture.js\").default>}\n * @private\n */\n this.paletteTextures_ = options.paletteTextures || [];\n }\n\n /**\n * @param {Options} options Options.\n * @override\n */\n reset(options) {\n super.reset(options);\n if (this.helper) {\n const gl = this.helper.getGL();\n for (const paletteTexture of this.paletteTextures_) {\n paletteTexture.delete(gl);\n }\n }\n\n this.vertexShader_ = options.vertexShader;\n this.fragmentShader_ = options.fragmentShader;\n this.paletteTextures_ = options.paletteTextures || [];\n\n if (this.helper) {\n this.program_ = this.helper.getProgram(\n this.fragmentShader_,\n this.vertexShader_,\n );\n const gl = this.helper.getGL();\n for (const paletteTexture of this.paletteTextures_) {\n // upload the texture data\n paletteTexture.getTexture(gl);\n }\n }\n }\n\n /**\n * @override\n */\n afterHelperCreated() {\n super.afterHelperCreated();\n\n const gl = this.helper.getGL();\n for (const paletteTexture of this.paletteTextures_) {\n // upload the texture data\n paletteTexture.getTexture(gl);\n }\n\n this.program_ = this.helper.getProgram(\n this.fragmentShader_,\n this.vertexShader_,\n );\n this.helper.flushBufferData(this.indices_);\n }\n\n /**\n * @override\n */\n removeHelper() {\n if (this.helper) {\n const gl = this.helper.getGL();\n for (const paletteTexture of this.paletteTextures_) {\n paletteTexture.delete(gl);\n }\n }\n\n super.removeHelper();\n }\n\n /**\n * @override\n */\n createTileRepresentation(options) {\n return new TileTexture(options);\n }\n\n /**\n * @override\n */\n beforeTilesRender(frameState, tilesWithAlpha) {\n super.beforeTilesRender(frameState, tilesWithAlpha);\n this.helper.useProgram(this.program_, frameState);\n }\n\n /**\n * @override\n */\n renderTile(\n tileTexture,\n tileTransform,\n frameState,\n renderExtent,\n tileResolution,\n tileSize,\n tileOrigin,\n tileExtent,\n depth,\n gutter,\n alpha,\n ) {\n const gl = this.helper.getGL();\n this.helper.bindBuffer(tileTexture.coords);\n this.helper.bindBuffer(this.indices_);\n this.helper.enableAttributes(attributeDescriptions);\n\n let textureSlot = 0;\n while (textureSlot < tileTexture.textures.length) {\n const uniformName = `${Uniforms.TILE_TEXTURE_ARRAY}[${textureSlot}]`;\n this.helper.bindTexture(\n tileTexture.textures[textureSlot],\n textureSlot,\n uniformName,\n );\n ++textureSlot;\n }\n\n for (\n let paletteIndex = 0;\n paletteIndex < this.paletteTextures_.length;\n ++paletteIndex\n ) {\n const paletteTexture = this.paletteTextures_[paletteIndex];\n const texture = paletteTexture.getTexture(gl);\n this.helper.bindTexture(texture, textureSlot, paletteTexture.name);\n ++textureSlot;\n }\n\n const viewState = frameState.viewState;\n\n const tileWidthWithGutter = tileSize[0] + 2 * gutter;\n const tileHeightWithGutter = tileSize[1] + 2 * gutter;\n\n const tile = tileTexture.tile;\n const tileCoord = tile.tileCoord;\n\n const tileCenterI = tileCoord[1];\n const tileCenterJ = tileCoord[2];\n\n this.helper.setUniformMatrixValue(\n Uniforms.TILE_TRANSFORM,\n mat4FromTransform(this.tempMat4, tileTransform),\n );\n\n this.helper.setUniformFloatValue(Uniforms.TRANSITION_ALPHA, alpha);\n this.helper.setUniformFloatValue(Uniforms.DEPTH, depth);\n\n let gutterExtent = renderExtent;\n if (gutter > 0) {\n gutterExtent = tileExtent;\n getIntersection(gutterExtent, renderExtent, gutterExtent);\n }\n this.helper.setUniformFloatVec4(Uniforms.RENDER_EXTENT, gutterExtent);\n\n this.helper.setUniformFloatValue(Uniforms.RESOLUTION, viewState.resolution);\n this.helper.setUniformFloatValue(Uniforms.ZOOM, viewState.zoom);\n\n this.helper.setUniformFloatValue(\n Uniforms.TEXTURE_PIXEL_WIDTH,\n tileWidthWithGutter,\n );\n this.helper.setUniformFloatValue(\n Uniforms.TEXTURE_PIXEL_HEIGHT,\n tileHeightWithGutter,\n );\n this.helper.setUniformFloatValue(\n Uniforms.TEXTURE_RESOLUTION,\n tileResolution,\n );\n this.helper.setUniformFloatValue(\n Uniforms.TEXTURE_ORIGIN_X,\n tileOrigin[0] +\n tileCenterI * tileSize[0] * tileResolution -\n gutter * tileResolution,\n );\n this.helper.setUniformFloatValue(\n Uniforms.TEXTURE_ORIGIN_Y,\n tileOrigin[1] -\n tileCenterJ * tileSize[1] * tileResolution +\n gutter * tileResolution,\n );\n\n this.helper.drawElements(0, this.indices_.getSize());\n }\n\n /**\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView} Data at the pixel location.\n * @override\n */\n getData(pixel) {\n const gl = this.helper.getGL();\n if (!gl) {\n return null;\n }\n\n const frameState = this.frameState;\n if (!frameState) {\n return null;\n }\n\n const layer = this.getLayer();\n const coordinate = applyTransform(\n frameState.pixelToCoordinateTransform,\n pixel.slice(),\n );\n\n const viewState = frameState.viewState;\n const layerExtent = layer.getExtent();\n if (layerExtent) {\n if (\n !containsCoordinate(\n fromUserExtent(layerExtent, viewState.projection),\n coordinate,\n )\n ) {\n return null;\n }\n }\n\n // determine last source suitable for rendering at coordinate\n const sources = layer.getSources(\n boundingExtent([coordinate]),\n viewState.resolution,\n );\n let i, source, tileGrid;\n for (i = sources.length - 1; i >= 0; --i) {\n source = sources[i];\n if (source.getState() === 'ready') {\n tileGrid = source.getTileGridForProjection(viewState.projection);\n if (source.getWrapX()) {\n break;\n }\n const gridExtent = tileGrid.getExtent();\n if (!gridExtent || containsCoordinate(gridExtent, coordinate)) {\n break;\n }\n }\n }\n if (i < 0) {\n return null;\n }\n\n const tileTextureCache = this.tileRepresentationCache;\n for (\n let z = tileGrid.getZForResolution(viewState.resolution);\n z >= tileGrid.getMinZoom();\n --z\n ) {\n const tileCoord = tileGrid.getTileCoordForCoordAndZ(coordinate, z);\n const cacheKey = getCacheKey(source, tileCoord);\n if (!tileTextureCache.containsKey(cacheKey)) {\n continue;\n }\n const tileTexture = tileTextureCache.get(cacheKey);\n const tile = tileTexture.tile;\n if (tile.getState() === TileState.EMPTY) {\n return null;\n }\n if (!tileTexture.loaded) {\n continue;\n }\n const tileOrigin = tileGrid.getOrigin(z);\n const tileSize = toSize(tileGrid.getTileSize(z));\n const tileResolution = tileGrid.getResolution(z);\n\n const col =\n (coordinate[0] - tileOrigin[0]) / tileResolution -\n tileCoord[1] * tileSize[0];\n\n const row =\n (tileOrigin[1] - coordinate[1]) / tileResolution -\n tileCoord[2] * tileSize[1];\n\n return tileTexture.getPixelData(col, row);\n }\n return null;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n const helper = this.helper;\n if (helper) {\n const gl = helper.getGL();\n for (const paletteTexture of this.paletteTextures_) {\n paletteTexture.delete(gl);\n }\n this.paletteTextures_.length = 0;\n\n gl.deleteProgram(this.program_);\n delete this.program_;\n helper.deleteBuffer(this.indices_);\n }\n super.disposeInternal();\n delete this.indices_;\n }\n}\n\nexport default WebGLTileLayerRenderer;\n","/**\n * @module ol/renderer/webgl/FlowLayer\n */\nimport WebGLArrayBuffer from '../../webgl/Buffer.js';\nimport {DefaultUniform} from '../../webgl/Helper.js';\nimport {ARRAY_BUFFER, STATIC_DRAW} from '../../webgl.js';\nimport WebGLTileLayerRenderer from './TileLayer.js';\n\n/**\n * @typedef {import(\"../../layer/Flow.js\").default} LayerType\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} maxSpeed The maximum particle speed in the input data.\n * @property {number} [speedFactor=0.001] A larger factor increases the rate at which particles cross the screen.\n * @property {number} [particles=65536] The number of particles to render.\n * @property {number} [cacheSize=512] The texture cache size.\n * @property {string} tileVertexShader The flow tile vertex shader.\n * @property {string} tileFragmentShader The flow tile fragment shader.\n * @property {string} textureVertexShader Generic texture fragment shader.\n * @property {string} textureFragmentShader Generic texture fragment shader.\n * @property {string} particlePositionVertexShader The particle position vertex shader.\n * @property {string} particlePositionFragmentShader The particle position fragment shader.\n * @property {string} particleColorVertexShader The particle color vertex shader.\n * @property {string} particleColorFragmentShader The particle color fragment shader.\n */\n\n/**\n * Shader uniforms.\n * @enum {string}\n */\nexport const U = {\n TEXTURE: 'u_texture',\n VELOCITY_TEXTURE: 'u_velocityTexture',\n POSITION_TEXTURE: 'u_positionTexture',\n PARTICLE_COUNT_SQRT: 'u_particleCountSqrt',\n MAX_SPEED: 'u_maxSpeed',\n GAIN: 'u_gain',\n OFFSET: 'u_offset',\n IS_FLOAT: 'u_isFloat',\n RANDOM_SEED: 'u_randomSeed',\n SPEED_FACTOR: 'u_speedFactor',\n DROP_RATE: 'u_dropRate',\n DROP_RATE_BUMP: 'u_dropRateBump',\n OPACITY: 'u_opacity',\n ROTATION: DefaultUniform.ROTATION,\n VIEWPORT_SIZE_PX: DefaultUniform.VIEWPORT_SIZE_PX,\n};\n\n/**\n * Shader attributes.\n * @enum {string}\n */\nexport const A = {\n POSITION: 'a_position',\n INDEX: 'a_index',\n};\n\n/**\n * Shader varyings.\n * @enum {string}\n */\nexport const V = {\n POSITION: 'v_position',\n};\n\n/**\n * @classdesc\n * Experimental WebGL renderer for vector fields.\n * @extends {WebGLTileLayerRenderer<LayerType>}\n */\nclass FlowLayerRenderer extends WebGLTileLayerRenderer {\n /**\n * @param {LayerType} layer The tiled field layer.\n * @param {Options} options The renderer options.\n */\n constructor(layer, options) {\n super(layer, {\n vertexShader: options.tileVertexShader,\n fragmentShader: options.tileFragmentShader,\n cacheSize: options.cacheSize,\n // TODO: rework the post-processing logic\n // see https://github.com/openlayers/openlayers/issues/16120\n postProcesses: [{}],\n uniforms: {\n [U.MAX_SPEED]: options.maxSpeed,\n },\n });\n\n /**\n * @type {string}\n * @private\n */\n this.particleColorFragmentShader_ = options.particleColorFragmentShader;\n\n /**\n * @type {WebGLTexture|null}\n * @private\n */\n this.velocityTexture_ = null;\n\n /**\n * @type {number}\n * @private\n */\n this.particleCountSqrt_ = options.particles\n ? Math.ceil(Math.sqrt(options.particles))\n : 256;\n\n /**\n * @type {WebGLArrayBuffer}\n * @private\n */\n this.particleIndexBuffer_;\n\n /**\n * @type {WebGLArrayBuffer}\n * @private\n */\n this.quadBuffer_;\n\n /**\n * @type {WebGLProgram}\n * @private\n */\n this.particlePositionProgram_;\n\n /**\n * @type {string}\n * @private\n */\n this.particlePositionVertexShader_ = options.particlePositionVertexShader;\n\n /**\n * @type {string}\n * @private\n */\n this.particlePositionFragmentShader_ =\n options.particlePositionFragmentShader;\n\n /**\n * @type {WebGLTexture}\n * @private\n */\n this.previousPositionTexture_;\n\n /**\n * @type {WebGLTexture}\n * @private\n */\n this.nextPositionTexture_;\n\n /**\n * @type {WebGLProgram}\n * @private\n */\n this.particleColorProgram_;\n\n /**\n * @type {string}\n * @private\n */\n this.particleColorVertexShader_ = options.particleColorVertexShader;\n\n /**\n * @type {string}\n * @private\n */\n this.particleColorFragmentShader_ = options.particleColorFragmentShader;\n\n /**\n * @type {WebGLProgram}\n * @private\n */\n this.textureProgram_;\n\n /**\n * @type {string}\n * @private\n */\n this.textureVertexShader_ = options.textureVertexShader;\n\n /**\n * @type {string}\n * @private\n */\n this.textureFragmentShader_ = options.textureFragmentShader;\n\n /**\n * @type {WebGLTexture}\n * @private\n */\n this.previousTrailsTexture_;\n\n /**\n * @type {WebGLTexture}\n * @private\n */\n this.nextTrailsTexture_;\n\n /**\n * @type {number}\n * @private\n */\n this.fadeOpacity_ = 0.996; // how fast the particle trails fade on each frame\n\n /**\n * @type {number}\n * @private\n */\n this.maxSpeed_ = options.maxSpeed;\n\n /**\n * @type {number}\n * @private\n */\n this.speedFactor_ = options.speedFactor || 0.001;\n\n /**\n * @type {number}\n * @private\n */\n this.dropRate_ = 0.003; // how often the particles move to a random place\n\n /**\n * @type {number}\n * @private\n */\n this.dropRateBump_ = 0.01; // drop rate increase relative to individual particle speed\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.tempVec2_ = [0, 0];\n\n /**\n * @type {number}\n * @private\n */\n this.renderedWidth_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.renderedHeight_ = 0;\n }\n\n /**\n * @override\n */\n afterHelperCreated() {\n super.afterHelperCreated();\n const helper = this.helper;\n\n const gl = helper.getGL();\n this.framebuffer_ = gl.createFramebuffer();\n\n const particleCount = this.particleCountSqrt_ * this.particleCountSqrt_;\n const particleIndices = new Float32Array(particleCount);\n for (let i = 0; i < particleCount; ++i) {\n particleIndices[i] = i;\n }\n const particleIndexBuffer = new WebGLArrayBuffer(ARRAY_BUFFER, STATIC_DRAW);\n particleIndexBuffer.setArray(particleIndices);\n helper.flushBufferData(particleIndexBuffer);\n this.particleIndexBuffer_ = particleIndexBuffer;\n\n const quadIndices = new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]);\n const quadBuffer = new WebGLArrayBuffer(ARRAY_BUFFER, STATIC_DRAW);\n quadBuffer.setArray(quadIndices);\n helper.flushBufferData(quadBuffer);\n this.quadBuffer_ = quadBuffer;\n\n const particlePositions = new Uint8Array(particleCount * 4);\n for (let i = 0; i < particlePositions.length; ++i) {\n particlePositions[i] = Math.floor(Math.random() * 256);\n }\n\n this.previousPositionTexture_ = helper.createTexture(\n [this.particleCountSqrt_, this.particleCountSqrt_],\n particlePositions,\n null,\n true,\n );\n\n this.nextPositionTexture_ = helper.createTexture(\n [this.particleCountSqrt_, this.particleCountSqrt_],\n particlePositions,\n null,\n true,\n );\n\n this.particlePositionProgram_ = helper.getProgram(\n this.particlePositionFragmentShader_,\n this.particlePositionVertexShader_,\n );\n\n this.particleColorProgram_ = helper.getProgram(\n this.particleColorFragmentShader_,\n this.particleColorVertexShader_,\n );\n\n this.textureProgram_ = helper.getProgram(\n this.textureFragmentShader_,\n this.textureVertexShader_,\n );\n }\n\n createSizeDependentTextures_() {\n const helper = this.helper;\n const gl = helper.getGL();\n const canvas = helper.getCanvas();\n const screenWidth = canvas.width;\n const screenHeight = canvas.height;\n\n const blank = new Uint8Array(screenWidth * screenHeight * 4);\n\n if (this.nextTrailsTexture_) {\n gl.deleteTexture(this.nextTrailsTexture_);\n }\n this.nextTrailsTexture_ = helper.createTexture(\n [screenWidth, screenHeight],\n blank,\n null,\n true,\n );\n\n if (this.previousTrailsTexture_) {\n gl.deleteTexture(this.previousTrailsTexture_);\n }\n this.previousTrailsTexture_ = helper.createTexture(\n [screenWidth, screenHeight],\n blank,\n null,\n true,\n );\n }\n\n /**\n * @override\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n beforeFinalize(frameState) {\n const helper = this.helper;\n const gl = helper.getGL();\n const canvas = helper.getCanvas();\n const screenWidth = canvas.width;\n const screenHeight = canvas.height;\n\n if (\n this.renderedWidth_ != screenWidth ||\n this.renderedHeight_ != screenHeight\n ) {\n this.createSizeDependentTextures_();\n }\n\n const size = [screenWidth, screenHeight];\n\n // copy current frame buffer to the velocity texture\n this.velocityTexture_ = helper.createTexture(\n size,\n null,\n this.velocityTexture_,\n );\n gl.copyTexImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n 0,\n 0,\n screenWidth,\n screenHeight,\n 0,\n );\n\n this.drawParticleTrails_(frameState);\n this.updateParticlePositions_(frameState);\n\n frameState.animate = true;\n this.renderedWidth_ = screenWidth;\n this.renderedHeight_ = screenHeight;\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n drawParticleTrails_(frameState) {\n const helper = this.helper;\n const gl = helper.getGL();\n\n helper.bindFrameBuffer(this.framebuffer_, this.nextTrailsTexture_);\n\n this.drawTexture_(this.previousTrailsTexture_, this.fadeOpacity_);\n this.drawParticleColor_(frameState);\n\n helper.bindInitialFrameBuffer();\n gl.clearColor(0.0, 0.0, 0.0, 0.0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n\n gl.enable(gl.BLEND);\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);\n this.drawTexture_(this.nextTrailsTexture_, 1);\n gl.disable(gl.BLEND);\n\n const current = this.nextTrailsTexture_;\n this.nextTrailsTexture_ = this.previousTrailsTexture_;\n this.previousTrailsTexture_ = current;\n }\n\n /**\n * @param {WebGLTexture} texture The texture to draw.\n * @param {number} opacity The opacity.\n */\n drawTexture_(texture, opacity) {\n const helper = this.helper;\n const gl = helper.getGL();\n\n helper.useProgram(this.textureProgram_);\n helper.bindTexture(texture, 0, U.TEXTURE);\n helper.bindAttribute(this.quadBuffer_, A.POSITION, 2);\n this.helper.setUniformFloatValue(U.OPACITY, opacity);\n\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n drawParticleColor_(frameState) {\n const helper = this.helper;\n const gl = helper.getGL();\n\n helper.useProgram(this.particleColorProgram_);\n\n const particleCount = this.particleCountSqrt_ * this.particleCountSqrt_;\n\n helper.bindAttribute(this.particleIndexBuffer_, A.INDEX, 1);\n\n helper.bindTexture(this.previousPositionTexture_, 0, U.POSITION_TEXTURE);\n helper.bindTexture(this.velocityTexture_, 1, U.VELOCITY_TEXTURE);\n\n this.helper.setUniformFloatValue(\n U.PARTICLE_COUNT_SQRT,\n this.particleCountSqrt_,\n );\n\n const rotation = this.tempVec2_;\n rotation[0] = Math.cos(-frameState.viewState.rotation);\n rotation[1] = Math.sin(-frameState.viewState.rotation);\n this.helper.setUniformFloatVec2(U.ROTATION, rotation);\n\n this.helper.setUniformFloatValue(U.MAX_SPEED, this.maxSpeed_);\n\n gl.drawArrays(gl.POINTS, 0, particleCount);\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n updateParticlePositions_(frameState) {\n const helper = this.helper;\n const gl = helper.getGL();\n\n helper.useProgram(this.particlePositionProgram_);\n gl.viewport(0, 0, this.particleCountSqrt_, this.particleCountSqrt_);\n helper.bindFrameBuffer(this.framebuffer_, this.nextPositionTexture_);\n\n helper.bindTexture(this.previousPositionTexture_, 0, U.POSITION_TEXTURE);\n helper.bindTexture(this.velocityTexture_, 1, U.VELOCITY_TEXTURE);\n helper.bindAttribute(this.quadBuffer_, A.POSITION, 2);\n\n helper.setUniformFloatValue(U.RANDOM_SEED, Math.random());\n helper.setUniformFloatValue(U.SPEED_FACTOR, this.speedFactor_);\n helper.setUniformFloatValue(U.DROP_RATE, this.dropRate_);\n helper.setUniformFloatValue(U.DROP_RATE_BUMP, this.dropRateBump_);\n\n const rotation = this.tempVec2_;\n rotation[0] = Math.cos(-frameState.viewState.rotation);\n rotation[1] = Math.sin(-frameState.viewState.rotation);\n this.helper.setUniformFloatVec2(U.ROTATION, rotation);\n\n const size = frameState.size;\n this.helper.setUniformFloatVec2(U.VIEWPORT_SIZE_PX, [size[0], size[1]]);\n\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n const current = this.nextPositionTexture_;\n this.nextPositionTexture_ = this.previousPositionTexture_;\n this.previousPositionTexture_ = current;\n }\n}\n\nexport default FlowLayerRenderer;\n","/**\n * @module ol/render/webgl/constants\n */\n\n/**\n * @enum {string}\n */\nexport const WebGLWorkerMessageType = {\n GENERATE_POLYGON_BUFFERS: 'GENERATE_POLYGON_BUFFERS',\n GENERATE_POINT_BUFFERS: 'GENERATE_POINT_BUFFERS',\n GENERATE_LINE_STRING_BUFFERS: 'GENERATE_LINE_STRING_BUFFERS',\n};\n\n/**\n * @typedef {Object} WebGLWorkerGenerateBuffersMessage\n * This message will trigger the generation of a vertex and an index buffer based on the given render instructions.\n * When the buffers are generated, the worked will send a message of the same type to the main thread, with\n * the generated buffers in it.\n * Note that any addition properties present in the message *will* be sent back to the main thread.\n * @property {number} id Message id; will be used both in request and response as a means of identification\n * @property {WebGLWorkerMessageType} type Message type\n * @property {ArrayBuffer} renderInstructions render instructions raw binary buffer.\n * @property {number} [customAttributesSize] Amount of hit detection + custom attributes count in the render instructions.\n * @property {ArrayBuffer} [vertexBuffer] Vertices array raw binary buffer (sent by the worker).\n * @property {ArrayBuffer} [indexBuffer] Indices array raw binary buffer (sent by the worker).\n * @property {import(\"../../transform\").Transform} [renderInstructionsTransform] Transformation matrix used to project the instructions coordinates\n */\n","/**\n * Utilities for encoding/decoding values to be used in shaders\n * @module ol/render/webgl/encodeUtil\n */\n\n/**\n * Generates a color array based on a numerical id\n * Note: the range for each component is 0 to 1 with 256 steps\n * @param {number} id Id\n * @param {Array<number>} [array] Reusable array\n * @return {Array<number>} Color array containing the encoded id\n */\nexport function colorEncodeId(id, array) {\n array = array || [];\n const radix = 256;\n const divide = radix - 1;\n array[0] = Math.floor(id / radix / radix / radix) / divide;\n array[1] = (Math.floor(id / radix / radix) % radix) / divide;\n array[2] = (Math.floor(id / radix) % radix) / divide;\n array[3] = (id % radix) / divide;\n return array;\n}\n\n/**\n * Reads an id from a color-encoded array\n * Note: the expected range for each component is 0 to 1 with 256 steps.\n * @param {Array<number>} color Color array containing the encoded id\n * @return {number} Decoded id\n */\nexport function colorDecodeId(color) {\n let id = 0;\n const radix = 256;\n const mult = radix - 1;\n id += Math.round(color[0] * radix * radix * radix * mult);\n id += Math.round(color[1] * radix * radix * mult);\n id += Math.round(color[2] * radix * mult);\n id += Math.round(color[3] * mult);\n return id;\n}\n","\n export function create() {\n const source = \"function t(t,n,x=2){const o=n&&n.length,i=o?n[0]*x:t.length;let u=e(t,0,i,x,!0);const l=[];if(!u||u.next===u.prev)return l;let c,h,y;if(o&&(u=function(t,n,r,x){const o=[];for(let r=0,i=n.length;r<i;r++){const u=e(t,n[r]*x,r<i-1?n[r+1]*x:t.length,x,!1);u===u.next&&(u.steiner=!0),o.push(a(u))}o.sort(f);for(let t=0;t<o.length;t++)r=s(o[t],r);return r}(t,n,u,x)),t.length>80*x){c=1/0,h=1/0;let e=-1/0,n=-1/0;for(let r=x;r<i;r+=x){const x=t[r],o=t[r+1];x<c&&(c=x),o<h&&(h=o),x>e&&(e=x),o>n&&(n=o)}y=Math.max(e-c,n-h),y=0!==y?32767/y:0}return r(u,l,x,c,h,y,0),l}function e(t,e,n,r,x){let o;if(x===function(t,e,n,r){let x=0;for(let o=e,i=n-r;o<n;o+=r)x+=(t[i]-t[o])*(t[o+1]+t[i+1]),i=o;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)o=w(x/r|0,t[x],t[x+1],o);else for(let x=n-r;x>=e;x-=r)o=w(x/r|0,t[x],t[x+1],o);return o&&g(o,o.next)&&(A(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!g(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(A(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,f,s,l,a,h){if(!t)return;!h&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let o=null;for(e=0;x;){e++;let i=x,u=0;for(let t=0;t<n&&(u++,i=i.nextZ,i);t++);let f=n;for(;u>0||f>0&&i;)0!==u&&(0===f||!i||x.z<=i.z)?(r=x,x=x.nextZ,u--):(r=i,i=i.nextZ,f--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;x=i}o.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let y=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?o(t,s,l,a):x(t))e.push(c.i,t.i,p.i),A(t),t=p.next,y=p.next;else if((t=p)===y){h?1===h?r(t=i(n(t),e),e,f,s,l,a,2):2===h&&u(t,e,f,s,l,a):r(n(t),e,f,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,o=n.x,i=r.x,u=e.y,f=n.y,s=r.y,l=Math.min(x,o,i),c=Math.min(u,f,s),a=Math.max(x,o,i),h=Math.max(u,f,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=h&&y(x,u,o,f,i,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){const x=t.prev,o=t,i=t.next;if(v(x,o,i)>=0)return!1;const u=x.x,f=o.x,s=i.x,l=x.y,a=o.y,h=i.y,p=Math.min(u,f,s),g=Math.min(l,a,h),b=Math.max(u,f,s),M=Math.max(l,a,h),m=c(p,g,e,n,r),Z=c(b,M,e,n,r);let d=t.prevZ,w=t.nextZ;for(;d&&d.z>=m&&w&&w.z<=Z;){if(d.x>=p&&d.x<=b&&d.y>=g&&d.y<=M&&d!==x&&d!==i&&y(u,l,f,a,s,h,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,w.x>=p&&w.x<=b&&w.y>=g&&w.y<=M&&w!==x&&w!==i&&y(u,l,f,a,s,h,w.x,w.y)&&v(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;d&&d.z>=m;){if(d.x>=p&&d.x<=b&&d.y>=g&&d.y<=M&&d!==x&&d!==i&&y(u,l,f,a,s,h,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;w&&w.z<=Z;){if(w.x>=p&&w.x<=b&&w.y>=g&&w.y<=M&&w!==x&&w!==i&&y(u,l,f,a,s,h,w.x,w.y)&&v(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function i(t,e){let r=t;do{const n=r.prev,x=r.next.next;!g(n,x)&&b(n,r,r.next,x)&&Z(n,x)&&Z(x,n)&&(e.push(n.i,r.i,x.i),A(r),A(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function u(t,e,x,o,i,u){let f=t;do{let t=f.next.next;for(;t!==f.prev;){if(f.i!==t.i&&p(f,t)){let s=d(f,t);return f=n(f,f.next),s=n(s,s.next),r(f,e,x,o,i,u,0),void r(s,e,x,o,i,u,0)}t=t.next}f=f.next}while(f!==t)}function f(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let o,i=-1/0;if(g(t,n))return n;do{if(g(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>i&&(i=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const u=o,f=o.x,s=o.y;let c=1/0;n=o;do{if(r>=n.x&&n.x>=f&&r!==n.x&&h(x<s?r:i,x,f,s,x<s?i:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);Z(n,t)&&(e<c||e===c&&(n.x>o.x||n.x===o.x&&l(o,n)))&&(o=n,c=e)}n=n.next}while(n!==u);return o}(t,e);if(!r)return e;const x=d(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function h(t,e,n,r,x,o,i,u){return(x-i)*(e-u)>=(t-i)*(o-u)&&(t-i)*(r-u)>=(n-i)*(e-u)&&(n-i)*(o-u)>=(x-i)*(r-u)}function y(t,e,n,r,x,o,i,u){return!(t===i&&e===u)&&h(t,e,n,r,x,o,i,u)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&b(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Z(t,e)&&Z(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&x<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||g(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function g(t,e){return t.x===e.x&&t.y===e.y}function b(t,e,n,r){const x=m(v(t,e,n)),o=m(v(t,e,r)),i=m(v(n,r,t)),u=m(v(n,r,e));return x!==o&&i!==u||(!(0!==x||!M(t,n,e))||(!(0!==o||!M(t,r,e))||(!(0!==i||!M(n,t,r))||!(0!==u||!M(n,e,r)))))}function M(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function m(t){return t>0?1:t<0?-1:0}function Z(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function d(t,e){const n=E(t.i,t.x,t.y),r=E(e.i,e.x,e.y),x=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function w(t,e,n,r){const x=E(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function A(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function E(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function I(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function z(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;!function(t,e){if(!t)throw new Error(e)}(0!==n,\\\"Transformation matrix cannot be inverted\\\");const x=e[0],o=e[1],i=e[2],u=e[3],f=e[4],s=e[5];return t[0]=u/n,t[1]=-o/n,t[2]=-i/n,t[3]=x/n,t[4]=(i*s-u*f)/n,t[5]=-(x*s-o*f)/n,t}new Array(6);const F=[],P={vertexPosition:0,indexPosition:0};function B(t,e,n,r,x){t[e+0]=n,t[e+1]=r,t[e+2]=x}function N(t,e,n,r,x,o){const i=3+x,u=t[e+0],f=t[e+1],s=F;s.length=x;for(let n=0;n<s.length;n++)s[n]=t[e+2+n];let l=o?o.vertexPosition:0,c=o?o.indexPosition:0;const a=l/i;return B(n,l,u,f,0),s.length&&n.set(s,l+3),l+=i,B(n,l,u,f,1),s.length&&n.set(s,l+3),l+=i,B(n,l,u,f,2),s.length&&n.set(s,l+3),l+=i,B(n,l,u,f,3),s.length&&n.set(s,l+3),l+=i,r[c++]=a,r[c++]=a+1,r[c++]=a+3,r[c++]=a+1,r[c++]=a+2,r[c++]=a+3,P.vertexPosition=l,P.indexPosition=c,P}function R(t,e,n,r,x,o,i,u,f,s,l){const c=10+u.length,a=o.length/c,h=[t[e+0],t[e+1]],y=[t[n],t[n+1]],p=t[e+2],v=t[n+2],g=I(f,[...h]),b=I(f,[...y]);function M(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),x=[(e[0]-t[0])/r,(e[1]-t[1])/r],o=[-x[1],x[0]],i=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),u=[(n[0]-t[0])/i,(n[1]-t[1])/i],f=0===r||0===i?0:Math.acos((s=u[0]*x[0]+u[1]*x[1],l=-1,c=1,Math.min(Math.max(s,l),c)));var s,l,c;return u[0]*o[0]+u[1]*o[1]>0?f:2*Math.PI-f}let m=-1,Z=-1,d=l;const w=null!==x;if(null!==r){m=M(g,b,I(f,[...[t[r],t[r+1]]])),Math.cos(m)<=.985&&(d+=Math.tan((m-Math.PI)/2))}if(w){Z=M(b,g,I(f,[...[t[x],t[x+1]]])),Math.cos(Z)<=.985&&(d+=Math.tan((Math.PI-Z)/2))}function A(t,e){return 0===e?1e4*t:Math.sign(e)*(1e4*t+Math.abs(e))}return o.push(h[0],h[1],p,y[0],y[1],v,m,Z,s,A(0,l)),o.push(...u),o.push(h[0],h[1],p,y[0],y[1],v,m,Z,s,A(1,l)),o.push(...u),o.push(h[0],h[1],p,y[0],y[1],v,m,Z,s,A(2,l)),o.push(...u),o.push(h[0],h[1],p,y[0],y[1],v,m,Z,s,A(3,l)),o.push(...u),i.push(a,a+1,a+2,a+1,a+3,a+2),{length:s+Math.sqrt((b[0]-g[0])*(b[0]-g[0])+(b[1]-g[1])*(b[1]-g[1])),angle:d}}function S(e,n,r,x,o){const i=2+o;let u=n;const f=e.slice(u,u+o);u+=o;const s=e[u++];let l=0;const c=new Array(s-1);for(let t=0;t<s;t++)l+=e[u++],t<s-1&&(c[t]=l);const a=e.slice(u,u+2*l),h=t(a,c,2);for(let t=0;t<h.length;t++)x.push(h[t]+r.length/i);for(let t=0;t<a.length;t+=2)r.push(a[t],a[t+1],...f);return u+2*l}const T=\\\"GENERATE_POLYGON_BUFFERS\\\",_=\\\"GENERATE_POINT_BUFFERS\\\",O=\\\"GENERATE_LINE_STRING_BUFFERS\\\",U=self;U.onmessage=t=>{const e=t.data;switch(e.type){case _:{const t=3,n=2,r=e.customAttributesSize,x=n+r,o=new Float32Array(e.renderInstructions),i=o.length/x,u=4*i*(r+t),f=new Uint32Array(6*i),s=new Float32Array(u);let l;for(let t=0;t<o.length;t+=x)l=N(o,t,s,f,r,l);const c=Object.assign({vertexBuffer:s.buffer,indexBuffer:f.buffer,renderInstructions:o.buffer},e);U.postMessage(c,[s.buffer,f.buffer,o.buffer]);break}case O:{const t=[],n=[],r=e.customAttributesSize,x=3,o=new Float32Array(e.renderInstructions);let i=0;const u=[1,0,0,1,0,0];let f,s;for(z(u,e.renderInstructionsTransform);i<o.length;){s=Array.from(o.slice(i,i+r)),i+=r,f=o[i++];const e=i,l=i+(f-1)*x,c=o[e]===o[l]&&o[e+1]===o[l+1];let a=0,h=0;for(let r=0;r<f-1;r++){let y=null;r>0?y=i+(r-1)*x:c&&(y=l-x);let p=null;r<f-2?p=i+(r+2)*x:c&&(p=e+x);const v=R(o,i+r*x,i+(r+1)*x,y,p,t,n,s,u,a,h);a=v.length,h=v.angle}i+=f*x}const l=Uint32Array.from(n),c=Float32Array.from(t),a=Object.assign({vertexBuffer:c.buffer,indexBuffer:l.buffer,renderInstructions:o.buffer},e);U.postMessage(a,[c.buffer,l.buffer,o.buffer]);break}case T:{const t=[],n=[],r=e.customAttributesSize,x=new Float32Array(e.renderInstructions);let o=0;for(;o<x.length;)o=S(x,o,t,n,r);const i=Uint32Array.from(n),u=Float32Array.from(t),f=Object.assign({vertexBuffer:u.buffer,indexBuffer:i.buffer,renderInstructions:x.buffer},e);U.postMessage(f,[u.buffer,i.buffer,x.buffer]);break}}};\";\n return new Worker(typeof Blob === 'undefined'\n ? 'data:application/javascript;base64,' + Buffer.from(source, 'binary').toString('base64')\n : URL.createObjectURL(new Blob([source], {type: 'application/javascript'})));\n }\n \n","import {getWidth} from '../../extent.js';\n\n/**\n * Compute world params\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {any} layer The layer\n * @return {Array<number>} The world start, end and width.\n */\nexport function getWorldParameters(frameState, layer) {\n const projection = frameState.viewState.projection;\n\n const vectorSource = layer.getSource();\n const multiWorld = vectorSource.getWrapX() && projection.canWrapX();\n const projectionExtent = projection.getExtent();\n\n const extent = frameState.extent;\n const worldWidth = multiWorld ? getWidth(projectionExtent) : null;\n const endWorld = multiWorld\n ? Math.ceil((extent[2] - projectionExtent[2]) / worldWidth) + 1\n : 1;\n\n const startWorld = multiWorld\n ? Math.floor((extent[0] - projectionExtent[0]) / worldWidth)\n : 0;\n\n return [startWorld, endWorld, worldWidth];\n}\n","/**\n * @module ol/renderer/webgl/PointsLayer\n */\nimport ViewHint from '../../ViewHint.js';\nimport {assert} from '../../asserts.js';\nimport {listen, unlistenByKey} from '../../events.js';\nimport {buffer, createEmpty, equals} from '../../extent.js';\nimport BaseVector from '../../layer/BaseVector.js';\nimport {fromUserCoordinate, getUserProjection} from '../../proj.js';\nimport {WebGLWorkerMessageType} from '../../render/webgl/constants.js';\nimport {colorDecodeId, colorEncodeId} from '../../render/webgl/encodeUtil.js';\nimport VectorEventType from '../../source/VectorEventType.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n makeInverse as makeInverseTransform,\n multiply as multiplyTransform,\n translate as translateTransform,\n} from '../../transform.js';\nimport {getUid} from '../../util.js';\nimport WebGLArrayBuffer from '../../webgl/Buffer.js';\nimport {AttributeType, DefaultUniform} from '../../webgl/Helper.js';\nimport WebGLRenderTarget from '../../webgl/RenderTarget.js';\nimport {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';\nimport {create as createWebGLWorker} from '../../worker/webgl.js';\nimport WebGLLayerRenderer from './Layer.js';\nimport {getWorldParameters} from './worldUtil.js';\n\n/** @typedef {import(\"../../geom/Point.js\").default} Point */\n/** @typedef {import(\"../../Feature\").default<Point>} PointFeature */\n\n/**\n * @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different\n * for each feature.\n * @property {string} name Attribute name.\n * @property {function(PointFeature, Object<string, *>):number} callback This callback computes the numerical value of the\n * attribute for a given feature (properties are available as 2nd arg for quicker access).\n */\n\n/**\n * @typedef {Object} FeatureCacheItem Object that holds a reference to a feature, its geometry and properties. Used to optimize\n * rebuildBuffers by accessing these objects quicker.\n * @property {PointFeature} feature Feature\n * @property {Object<string, *>} properties Feature properties\n * @property {import(\"../../coordinate.js\").Coordinate} flatCoordinates Point coordinates\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the canvas element.\n * @property {Array<CustomAttribute>} [attributes] These attributes will be read from the features in the source and then\n * passed to the GPU. The `name` property of each attribute will serve as its identifier:\n * In the vertex shader as an `attribute` by prefixing it with `a_`\n * In the fragment shader as a `varying` by prefixing it with `v_`\n * Please note that these can only be numerical values.\n * @property {string} vertexShader Vertex shader source, mandatory.\n * @property {string} fragmentShader Fragment shader source, mandatory.\n * @property {boolean} [hitDetectionEnabled] Whether shader is hit detection aware.\n * @property {Object<string,import(\"../../webgl/Helper\").UniformValue>} [uniforms] Uniform definitions for the post process steps\n * Please note that `u_texture` is reserved for the main texture slot and `u_opacity` is reserved for the layer opacity.\n * @property {Array<import(\"./Layer\").PostProcessesOptions>} [postProcesses] Post-processes definitions\n */\n\n/**\n * @classdesc\n * WebGL vector renderer optimized for points.\n * All features will be rendered as quads (two triangles forming a square). New data will be flushed to the GPU\n * every time the vector source changes.\n *\n * You need to provide vertex and fragment shaders for rendering. This can be done using\n * {@link module:ol/webgl/ShaderBuilder~ShaderBuilder} utilities. These shaders shall expect a `a_position` attribute\n * containing the screen-space projected center of the quad, as well as a `a_index` attribute\n * whose value (0, 1, 2 or 3) indicates which quad vertex is currently getting processed (see structure below).\n *\n * To include variable attributes in the shaders, you need to declare them using the `attributes` property of\n * the options object like so:\n * ```js\n * new WebGLPointsLayerRenderer(layer, {\n * attributes: [\n * {\n * name: 'size',\n * callback: function(feature) {\n * // compute something with the feature\n * }\n * },\n * {\n * name: 'weight',\n * callback: function(feature) {\n * // compute something with the feature\n * }\n * },\n * ],\n * vertexShader:\n * // shader using attribute a_weight and a_size\n * fragmentShader:\n * // shader using varying v_weight and v_size\n * ```\n *\n * To enable hit detection, you must as well provide dedicated shaders using the `hitVertexShader`\n * and `hitFragmentShader` properties. These shall expect the `a_hitColor` attribute to contain\n * the final color that will have to be output for hit detection to work.\n *\n * The following uniform is used for the main texture: `u_texture`.\n * The following uniform is used for the layer opacity: `u_opacity`.\n *\n * Please note that the main shader output should have premultiplied alpha, otherwise visual anomalies may occur.\n *\n * Points are rendered as quads with the following structure:\n *\n * ```\n * (u0, v1) (u1, v1)\n * [3]----------[2]\n * |` |\n * | ` |\n * | ` |\n * | ` |\n * | ` |\n * | ` |\n * [0]----------[1]\n * (u0, v0) (u1, v0)\n * ```\n *\n * This uses {@link module:ol/webgl/Helper~WebGLHelper} internally.\n *\n * @api\n */\nclass WebGLPointsLayerRenderer extends WebGLLayerRenderer {\n /**\n * @param {import(\"../../layer/Layer.js\").default} layer Layer.\n * @param {Options} options Options.\n */\n constructor(layer, options) {\n const uniforms = options.uniforms || {};\n const projectionMatrixTransform = createTransform();\n uniforms[DefaultUniform.PROJECTION_MATRIX] = projectionMatrixTransform;\n\n super(layer, {\n uniforms: uniforms,\n postProcesses: options.postProcesses,\n });\n\n /**\n * @private\n */\n this.sourceRevision_ = -1;\n\n /**\n * @private\n */\n this.verticesBuffer_ = new WebGLArrayBuffer(ARRAY_BUFFER, DYNAMIC_DRAW);\n /**\n * @private\n */\n this.indicesBuffer_ = new WebGLArrayBuffer(\n ELEMENT_ARRAY_BUFFER,\n DYNAMIC_DRAW,\n );\n\n /**\n * @private\n */\n this.vertexShader_ = options.vertexShader;\n\n /**\n * @private\n */\n this.fragmentShader_ = options.fragmentShader;\n\n /**\n * @type {WebGLProgram}\n * @private\n */\n this.program_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.hitDetectionEnabled_ = options.hitDetectionEnabled ?? true;\n\n const customAttributes = options.attributes\n ? options.attributes.map(function (attribute) {\n return {\n name: 'a_' + attribute.name,\n size: 1,\n type: AttributeType.FLOAT,\n };\n })\n : [];\n\n /**\n * A list of attributes used by the renderer. By default only the position and\n * index of the vertex (0 to 3) are required.\n * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}\n */\n this.attributes = [\n {\n name: 'a_position',\n size: 2,\n type: AttributeType.FLOAT,\n },\n {\n name: 'a_index',\n size: 1,\n type: AttributeType.FLOAT,\n },\n ];\n\n if (this.hitDetectionEnabled_) {\n this.attributes.push({\n name: 'a_hitColor',\n size: 4,\n type: AttributeType.FLOAT,\n });\n this.attributes.push({\n name: 'a_featureUid',\n size: 1,\n type: AttributeType.FLOAT,\n });\n }\n this.attributes.push(...customAttributes);\n\n this.customAttributes = options.attributes ? options.attributes : [];\n\n /**\n * @private\n */\n this.previousExtent_ = createEmpty();\n\n /**\n * This transform is updated on every frame and is the composition of:\n * - invert of the world->screen transform that was used when rebuilding buffers (see `this.renderTransform_`)\n * - current world->screen transform\n * @type {import(\"../../transform.js\").Transform}\n * @private\n */\n this.currentTransform_ = projectionMatrixTransform;\n\n /**\n * This transform is updated when buffers are rebuilt and converts world space coordinates to screen space\n * @type {import(\"../../transform.js\").Transform}\n * @private\n */\n this.renderTransform_ = createTransform();\n\n /**\n * @type {import(\"../../transform.js\").Transform}\n * @private\n */\n this.invertRenderTransform_ = createTransform();\n\n /**\n * @type {Float32Array}\n * @private\n */\n this.renderInstructions_ = new Float32Array(0);\n\n /**\n * @type {WebGLRenderTarget}\n * @private\n */\n this.hitRenderTarget_;\n\n /**\n * Keep track of latest message sent to worker\n * @type {number}\n * @private\n */\n this.lastSentId = 0;\n\n /**\n * @private\n */\n this.worker_ = createWebGLWorker();\n\n this.worker_.addEventListener(\n 'message',\n /**\n * @param {*} event Event.\n */\n (event) => {\n const received = event.data;\n if (received.type === WebGLWorkerMessageType.GENERATE_POINT_BUFFERS) {\n const projectionTransform = received.projectionTransform;\n this.verticesBuffer_.fromArrayBuffer(received.vertexBuffer);\n this.helper.flushBufferData(this.verticesBuffer_);\n this.indicesBuffer_.fromArrayBuffer(received.indexBuffer);\n this.helper.flushBufferData(this.indicesBuffer_);\n\n this.renderTransform_ = projectionTransform;\n makeInverseTransform(\n this.invertRenderTransform_,\n this.renderTransform_,\n );\n this.renderInstructions_ = new Float32Array(\n event.data.renderInstructions,\n );\n if (received.id === this.lastSentId) {\n this.ready = true;\n }\n this.getLayer().changed();\n }\n },\n );\n\n /**\n * This object will be updated when the source changes. Key is uid.\n * @type {Object<string, FeatureCacheItem>}\n * @private\n */\n this.featureCache_ = {};\n\n /**\n * Amount of features in the cache.\n * @type {number}\n * @private\n */\n this.featureCount_ = 0;\n\n const source = /** @type {import(\"../../source/Vector.js\").default} */ (\n this.getLayer().getSource()\n );\n /**\n * @private\n */\n this.sourceListenKeys_ = [\n listen(\n source,\n VectorEventType.ADDFEATURE,\n this.handleSourceFeatureAdded_,\n this,\n ),\n listen(\n source,\n VectorEventType.CHANGEFEATURE,\n this.handleSourceFeatureChanged_,\n this,\n ),\n listen(\n source,\n VectorEventType.REMOVEFEATURE,\n this.handleSourceFeatureDelete_,\n this,\n ),\n listen(\n source,\n VectorEventType.CLEAR,\n this.handleSourceFeatureClear_,\n this,\n ),\n ];\n source.forEachFeature((feature) => {\n const geometry = feature.getGeometry();\n if (geometry && geometry.getType() === 'Point') {\n this.featureCache_[getUid(feature)] = {\n feature: /** @type {PointFeature} */ (feature),\n properties: feature.getProperties(),\n flatCoordinates: /** @type {Point} */ (geometry).getFlatCoordinates(),\n };\n this.featureCount_++;\n }\n });\n }\n\n /**\n * @override\n */\n afterHelperCreated() {\n this.program_ = this.helper.getProgram(\n this.fragmentShader_,\n this.vertexShader_,\n );\n\n if (this.hitDetectionEnabled_) {\n this.hitRenderTarget_ = new WebGLRenderTarget(this.helper);\n }\n\n // upload buffers again if any\n if (this.verticesBuffer_.getArray()) {\n this.helper.flushBufferData(this.verticesBuffer_);\n }\n if (this.indicesBuffer_.getArray()) {\n this.helper.flushBufferData(this.indicesBuffer_);\n }\n }\n\n /**\n * @param {import(\"../../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceFeatureAdded_(event) {\n const feature = event.feature;\n const geometry = feature.getGeometry();\n if (geometry && geometry.getType() === 'Point') {\n this.featureCache_[getUid(feature)] = {\n feature: /** @type {PointFeature} */ (feature),\n properties: feature.getProperties(),\n flatCoordinates: /** @type {Point} */ (geometry).getFlatCoordinates(),\n };\n this.featureCount_++;\n }\n }\n\n /**\n * @param {import(\"../../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceFeatureChanged_(event) {\n const feature = event.feature;\n const featureUid = getUid(feature);\n const item = this.featureCache_[featureUid];\n const geometry = feature.getGeometry();\n if (item) {\n if (geometry && geometry.getType() === 'Point') {\n item.properties = feature.getProperties();\n item.flatCoordinates = /** @type {Point} */ (\n geometry\n ).getFlatCoordinates();\n } else {\n delete this.featureCache_[featureUid];\n this.featureCount_--;\n }\n } else {\n if (geometry && geometry.getType() === 'Point') {\n this.featureCache_[featureUid] = {\n feature: /** @type {PointFeature} */ (feature),\n properties: feature.getProperties(),\n flatCoordinates: /** @type {Point} */ (geometry).getFlatCoordinates(),\n };\n this.featureCount_++;\n }\n }\n }\n\n /**\n * @param {import(\"../../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceFeatureDelete_(event) {\n const feature = event.feature;\n const featureUid = getUid(feature);\n if (featureUid in this.featureCache_) {\n delete this.featureCache_[featureUid];\n this.featureCount_--;\n }\n }\n\n /**\n * @private\n */\n handleSourceFeatureClear_() {\n this.featureCache_ = {};\n this.featureCount_ = 0;\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n renderFrame(frameState) {\n const gl = this.helper.getGL();\n this.preRender(gl, frameState);\n const [startWorld, endWorld, worldWidth] = getWorldParameters(\n frameState,\n this.getLayer(),\n );\n\n // draw the normal canvas\n this.renderWorlds(frameState, false, startWorld, endWorld, worldWidth);\n this.helper.finalizeDraw(\n frameState,\n this.dispatchPreComposeEvent,\n this.dispatchPostComposeEvent,\n );\n\n if (this.hitDetectionEnabled_) {\n // draw the hit buffer\n this.renderWorlds(frameState, true, startWorld, endWorld, worldWidth);\n this.hitRenderTarget_.clearCachedData();\n }\n\n this.postRender(gl, frameState);\n\n const canvas = this.helper.getCanvas();\n return canvas;\n }\n\n /**\n * Determine whether renderFrame should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrameInternal(frameState) {\n const layer = this.getLayer();\n const vectorSource = layer.getSource();\n const viewState = frameState.viewState;\n const viewNotMoving =\n !frameState.viewHints[ViewHint.ANIMATING] &&\n !frameState.viewHints[ViewHint.INTERACTING];\n const extentChanged = !equals(this.previousExtent_, frameState.extent);\n const sourceChanged = this.sourceRevision_ < vectorSource.getRevision();\n\n if (sourceChanged) {\n this.sourceRevision_ = vectorSource.getRevision();\n }\n\n if (viewNotMoving && (extentChanged || sourceChanged)) {\n const projection = viewState.projection;\n const resolution = viewState.resolution;\n\n const renderBuffer =\n layer instanceof BaseVector ? layer.getRenderBuffer() : 0;\n const extent = buffer(frameState.extent, renderBuffer * resolution);\n vectorSource.loadFeatures(extent, resolution, projection);\n\n this.rebuildBuffers_(frameState);\n this.previousExtent_ = frameState.extent.slice();\n }\n\n this.helper.useProgram(this.program_, frameState);\n this.helper.prepareDraw(frameState);\n\n // write new data\n this.helper.bindBuffer(this.verticesBuffer_);\n this.helper.bindBuffer(this.indicesBuffer_);\n this.helper.enableAttributes(this.attributes);\n\n return true;\n }\n\n /**\n * Rebuild internal webgl buffers based on current view extent; costly, should not be called too much\n * @param {import(\"../../Map\").FrameState} frameState Frame state.\n * @private\n */\n rebuildBuffers_(frameState) {\n // saves the projection transform for the current frame state\n const projectionTransform = createTransform();\n this.helper.makeProjectionTransform(frameState, projectionTransform);\n\n const userProjection = getUserProjection();\n\n const baseInstructionLength = this.hitDetectionEnabled_ ? 7 : 2; // see below\n const singleInstructionLength =\n baseInstructionLength + this.customAttributes.length;\n const totalSize = singleInstructionLength * this.featureCount_;\n const renderInstructions =\n this.renderInstructions_ && this.renderInstructions_.length === totalSize\n ? this.renderInstructions_\n : new Float32Array(totalSize);\n this.renderInstructions_ = null;\n\n // loop over features to fill the buffer\n /** @type {import('../../coordinate.js').Coordinate} */\n let tmpCoords = [];\n /** @type {Array<number>} */\n const tmpColor = [];\n let idx = -1;\n const projection = frameState.viewState.projection;\n for (const featureUid in this.featureCache_) {\n const featureCache = this.featureCache_[featureUid];\n if (userProjection) {\n tmpCoords = fromUserCoordinate(\n featureCache.flatCoordinates,\n projection,\n );\n } else {\n tmpCoords[0] = featureCache.flatCoordinates[0];\n tmpCoords[1] = featureCache.flatCoordinates[1];\n }\n applyTransform(projectionTransform, tmpCoords);\n\n renderInstructions[++idx] = tmpCoords[0];\n renderInstructions[++idx] = tmpCoords[1];\n\n // for hit detection, the feature uid is saved in the opacity value\n // and the index of the opacity value is encoded in the color values\n if (this.hitDetectionEnabled_) {\n const hitColor = colorEncodeId(idx + 5, tmpColor);\n renderInstructions[++idx] = hitColor[0];\n renderInstructions[++idx] = hitColor[1];\n renderInstructions[++idx] = hitColor[2];\n renderInstructions[++idx] = hitColor[3];\n renderInstructions[++idx] = Number(featureUid);\n }\n\n // pushing custom attributes\n for (let j = 0; j < this.customAttributes.length; j++) {\n const value = this.customAttributes[j].callback(\n featureCache.feature,\n featureCache.properties,\n );\n renderInstructions[++idx] = value;\n }\n }\n\n /** @type {import('../../render/webgl/constants.js').WebGLWorkerGenerateBuffersMessage} */\n const message = {\n id: ++this.lastSentId,\n type: WebGLWorkerMessageType.GENERATE_POINT_BUFFERS,\n renderInstructions: renderInstructions.buffer,\n customAttributesSize: singleInstructionLength - 2,\n };\n // additional properties will be sent back as-is by the worker\n message['projectionTransform'] = projectionTransform;\n this.ready = false;\n this.worker_.postMessage(message, [renderInstructions.buffer]);\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"../vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {Array<import(\"../Map.js\").HitMatch<T>>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n * @override\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n assert(\n this.hitDetectionEnabled_,\n '`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option.',\n );\n if (!this.renderInstructions_ || !this.hitDetectionEnabled_) {\n return undefined;\n }\n\n const pixel = applyTransform(\n frameState.coordinateToPixelTransform,\n coordinate.slice(),\n );\n\n const data = this.hitRenderTarget_.readPixel(pixel[0] / 2, pixel[1] / 2);\n const color = [data[0] / 255, data[1] / 255, data[2] / 255, data[3] / 255];\n const index = colorDecodeId(color);\n const opacity = this.renderInstructions_[index];\n const uid = Math.floor(opacity).toString();\n\n const source = this.getLayer().getSource();\n const feature = source.getFeatureByUid(uid);\n if (feature) {\n return callback(feature, this.getLayer(), null);\n }\n return undefined;\n }\n\n /**\n * Render the world, either to the main framebuffer or to the hit framebuffer\n * @param {import(\"../../Map.js\").FrameState} frameState current frame state\n * @param {boolean} forHitDetection whether the rendering is for hit detection\n * @param {number} startWorld the world to render in the first iteration\n * @param {number} endWorld the last world to render\n * @param {number} worldWidth the width of the worlds being rendered\n */\n renderWorlds(frameState, forHitDetection, startWorld, endWorld, worldWidth) {\n let world = startWorld;\n\n this.helper.useProgram(this.program_, frameState);\n\n if (forHitDetection) {\n this.hitRenderTarget_.setSize([\n Math.floor(frameState.size[0] / 2),\n Math.floor(frameState.size[1] / 2),\n ]);\n this.helper.prepareDrawToRenderTarget(\n frameState,\n this.hitRenderTarget_,\n true,\n );\n }\n\n this.helper.bindBuffer(this.verticesBuffer_);\n this.helper.bindBuffer(this.indicesBuffer_);\n this.helper.enableAttributes(this.attributes);\n\n do {\n this.helper.makeProjectionTransform(frameState, this.currentTransform_);\n translateTransform(this.currentTransform_, world * worldWidth, 0);\n multiplyTransform(this.currentTransform_, this.invertRenderTransform_);\n this.helper.applyUniforms(frameState);\n this.helper.applyHitDetectionUniform(forHitDetection);\n const renderCount = this.indicesBuffer_.getSize();\n this.helper.drawElements(0, renderCount);\n } while (++world < endWorld);\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.worker_.terminate();\n this.sourceListenKeys_.forEach(function (key) {\n unlistenByKey(key);\n });\n this.sourceListenKeys_ = null;\n super.disposeInternal();\n }\n\n renderDeclutter() {}\n}\n\nexport default WebGLPointsLayerRenderer;\n","/**\n * @module ol/expr/gpu\n */\nimport {asArray} from '../color.js';\nimport {Uniforms} from '../renderer/webgl/TileLayer.js';\nimport {toSize} from '../size.js';\nimport PaletteTexture from '../webgl/PaletteTexture.js';\nimport {\n BooleanType,\n CallExpression,\n ColorType,\n NumberArrayType,\n NumberType,\n Ops,\n SizeType,\n StringType,\n parse,\n typeName,\n} from './expression.js';\n\n/**\n * @param {string} operator Operator\n * @param {CompilationContext} context Compilation context\n * @return {string} A function name based on the operator, unique in the given context\n */\nfunction computeOperatorFunctionName(operator, context) {\n return `operator_${operator}_${Object.keys(context.functions).length}`;\n}\n\n/**\n * Will return the number as a float with a dot separator, which is required by GLSL.\n * @param {number} v Numerical value.\n * @return {string} The value as string.\n */\nexport function numberToGlsl(v) {\n const s = v.toString();\n return s.includes('.') ? s : s + '.0';\n}\n\n/**\n * Will return the number array as a float with a dot separator, concatenated with ', '.\n * @param {Array<number>} array Numerical values array.\n * @return {string} The array as a vector, e. g.: `vec3(1.0, 2.0, 3.0)`.\n */\nexport function arrayToGlsl(array) {\n if (array.length < 2 || array.length > 4) {\n throw new Error(\n '`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.',\n );\n }\n return `vec${array.length}(${array.map(numberToGlsl).join(', ')})`;\n}\n\n/**\n * Will normalize and converts to string a `vec4` color array compatible with GLSL.\n * @param {string|import(\"../color.js\").Color} color Color either in string format or [r, g, b, a] array format,\n * with RGB components in the 0..255 range and the alpha component in the 0..1 range.\n * Note that the final array will always have 4 components.\n * @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.\n */\nexport function colorToGlsl(color) {\n const array = asArray(color);\n const alpha = array.length > 3 ? array[3] : 1;\n return arrayToGlsl([array[0] / 255, array[1] / 255, array[2] / 255, alpha]);\n}\n\n/**\n * Normalizes and converts a number or array toa `vec2` array compatible with GLSL.\n * @param {number|import('../size.js').Size} size Size.\n * @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.\n */\nexport function sizeToGlsl(size) {\n const array = toSize(size);\n return arrayToGlsl(array);\n}\n\n/** @type {Object<string, number>} */\nconst stringToFloatMap = {};\nlet stringToFloatCounter = 0;\n\n/**\n * Returns a stable equivalent number for the string literal.\n * @param {string} string String literal value\n * @return {number} Number equivalent\n */\nexport function getStringNumberEquivalent(string) {\n if (!(string in stringToFloatMap)) {\n stringToFloatMap[string] = stringToFloatCounter++;\n }\n return stringToFloatMap[string];\n}\n\n/**\n * Returns a stable equivalent number for the string literal, for use in shaders. This number is then\n * converted to be a GLSL-compatible string.\n * Note: with a float precision of `mediump`, the amount of unique strings supported is 16,777,216\n * @param {string} string String literal value\n * @return {string} GLSL-compatible string containing a number\n */\nexport function stringToGlsl(string) {\n return numberToGlsl(getStringNumberEquivalent(string));\n}\n\n/**\n * Get the uniform name given a variable name.\n * @param {string} variableName The variable name.\n * @return {string} The uniform name.\n */\nexport function uniformNameForVariable(variableName) {\n return 'u_var_' + variableName;\n}\n\n/**\n * @typedef {import('./expression.js').ParsingContext} ParsingContext\n */\n/**\n *\n * @typedef {import(\"./expression.js\").Expression} Expression\n */\n/**\n *\n * @typedef {import(\"./expression.js\").LiteralExpression} LiteralExpression\n */\n\n/**\n * @typedef {Object} CompilationContextProperty\n * @property {string} name Name\n * @property {number} type Resolved property type\n */\n\n/**\n * @typedef {Object} CompilationContextVariable\n * @property {string} name Name\n * @property {number} type Resolved variable type\n */\n\n/**\n * @typedef {Object} CompilationContext\n * @property {Object<string, CompilationContextProperty>} properties The values for properties used in 'get' expressions.\n * @property {Object<string, CompilationContextVariable>} variables The values for variables used in 'var' expressions.\n * @property {Object<string, string>} functions Lookup of functions used by the style.\n * @property {number} [bandCount] Number of bands per pixel.\n * @property {Array<PaletteTexture>} [paletteTextures] List of palettes used by the style.\n * @property {boolean} featureId Whether the feature ID is used in the expression\n * @property {boolean} geometryType Whether the geometry type is used in the expression\n */\n\n/**\n * @return {CompilationContext} A new compilation context.\n */\nexport function newCompilationContext() {\n return {\n variables: {},\n properties: {},\n functions: {},\n bandCount: 0,\n featureId: false,\n geometryType: false,\n };\n}\n\nconst GET_BAND_VALUE_FUNC = 'getBandValue';\n\nexport const PALETTE_TEXTURE_ARRAY = 'u_paletteTextures';\n\nexport const FEATURE_ID_PROPERTY_NAME = 'featureId';\nexport const GEOMETRY_TYPE_PROPERTY_NAME = 'geometryType';\n\n/**\n * The value `-9999999` will be used to indicate that a property on a feature is not defined, similar to a \"no data\" value.\n */\nexport const UNDEFINED_PROP_VALUE = -9999999;\n\n/**\n * @typedef {string} CompiledExpression\n */\n\n/**\n * @typedef {function(CompilationContext, CallExpression, number): string} Compiler\n * Third argument is the expected value types\n */\n\n/**\n * @param {import('./expression.js').EncodedExpression} encoded The encoded expression.\n * @param {number} type The expected type.\n * @param {import('./expression.js').ParsingContext} parsingContext The parsing context.\n * @param {CompilationContext} compilationContext An existing compilation context\n * @return {CompiledExpression} The compiled expression.\n */\nexport function buildExpression(\n encoded,\n type,\n parsingContext,\n compilationContext,\n) {\n const expression = parse(encoded, type, parsingContext);\n return compile(expression, type, compilationContext);\n}\n\n/**\n * @param {function(Array<CompiledExpression>, CompilationContext): string} output Function that takes in parsed arguments and returns a string\n * @return {function(CompilationContext, import(\"./expression.js\").CallExpression, number): string} Compiler for the call expression\n */\nfunction createCompiler(output) {\n return (context, expression, type) => {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compile(expression.args[i], type, context);\n }\n return output(args, context);\n };\n}\n\n/**\n * @type {Object<string, Compiler>}\n */\nconst compilers = {\n [Ops.Get]: (context, expression) => {\n const firstArg = /** @type {LiteralExpression} */ (expression.args[0]);\n const propName = /** @type {string} */ (firstArg.value);\n const isExisting = propName in context.properties;\n if (!isExisting) {\n context.properties[propName] = {\n name: propName,\n type: expression.type,\n };\n }\n return 'a_prop_' + propName;\n },\n [Ops.Id]: (context) => {\n context.featureId = true;\n return 'a_' + FEATURE_ID_PROPERTY_NAME;\n },\n [Ops.GeometryType]: (context) => {\n context.geometryType = true;\n return 'a_' + GEOMETRY_TYPE_PROPERTY_NAME;\n },\n [Ops.LineMetric]: () => 'currentLineMetric', // this variable is assumed to always be present in shaders, default is 0.\n [Ops.Var]: (context, expression) => {\n const firstArg = /** @type {LiteralExpression} */ (expression.args[0]);\n const varName = /** @type {string} */ (firstArg.value);\n const isExisting = varName in context.variables;\n if (!isExisting) {\n context.variables[varName] = {\n name: varName,\n type: expression.type,\n };\n }\n return uniformNameForVariable(varName);\n },\n [Ops.Has]: (context, expression) => {\n const firstArg = /** @type {LiteralExpression} */ (expression.args[0]);\n const propName = /** @type {string} */ (firstArg.value);\n const isExisting = propName in context.properties;\n if (!isExisting) {\n context.properties[propName] = {\n name: propName,\n type: expression.type,\n };\n }\n return `(a_prop_${propName} != ${numberToGlsl(UNDEFINED_PROP_VALUE)})`;\n },\n [Ops.Resolution]: () => 'u_resolution',\n [Ops.Zoom]: () => 'u_zoom',\n [Ops.Time]: () => 'u_time',\n [Ops.Any]: createCompiler((compiledArgs) => `(${compiledArgs.join(` || `)})`),\n [Ops.All]: createCompiler((compiledArgs) => `(${compiledArgs.join(` && `)})`),\n [Ops.Not]: createCompiler(([value]) => `(!${value})`),\n [Ops.Equal]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} == ${secondValue})`,\n ),\n [Ops.NotEqual]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} != ${secondValue})`,\n ),\n [Ops.GreaterThan]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} > ${secondValue})`,\n ),\n [Ops.GreaterThanOrEqualTo]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} >= ${secondValue})`,\n ),\n [Ops.LessThan]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} < ${secondValue})`,\n ),\n [Ops.LessThanOrEqualTo]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} <= ${secondValue})`,\n ),\n [Ops.Multiply]: createCompiler(\n (compiledArgs) => `(${compiledArgs.join(' * ')})`,\n ),\n [Ops.Divide]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} / ${secondValue})`,\n ),\n [Ops.Add]: createCompiler((compiledArgs) => `(${compiledArgs.join(' + ')})`),\n [Ops.Subtract]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} - ${secondValue})`,\n ),\n [Ops.Clamp]: createCompiler(\n ([value, min, max]) => `clamp(${value}, ${min}, ${max})`,\n ),\n [Ops.Mod]: createCompiler(([value, modulo]) => `mod(${value}, ${modulo})`),\n [Ops.Pow]: createCompiler(([value, power]) => `pow(${value}, ${power})`),\n [Ops.Abs]: createCompiler(([value]) => `abs(${value})`),\n [Ops.Floor]: createCompiler(([value]) => `floor(${value})`),\n [Ops.Ceil]: createCompiler(([value]) => `ceil(${value})`),\n [Ops.Round]: createCompiler(([value]) => `floor(${value} + 0.5)`),\n [Ops.Sin]: createCompiler(([value]) => `sin(${value})`),\n [Ops.Cos]: createCompiler(([value]) => `cos(${value})`),\n [Ops.Atan]: createCompiler(([firstValue, secondValue]) => {\n return secondValue !== undefined\n ? `atan(${firstValue}, ${secondValue})`\n : `atan(${firstValue})`;\n }),\n [Ops.Sqrt]: createCompiler(([value]) => `sqrt(${value})`),\n [Ops.Match]: createCompiler((compiledArgs) => {\n const input = compiledArgs[0];\n const fallback = compiledArgs[compiledArgs.length - 1];\n let result = null;\n for (let i = compiledArgs.length - 3; i >= 1; i -= 2) {\n const match = compiledArgs[i];\n const output = compiledArgs[i + 1];\n result = `(${input} == ${match} ? ${output} : ${result || fallback})`;\n }\n return result;\n }),\n [Ops.Between]: createCompiler(\n ([value, min, max]) => `(${value} >= ${min} && ${value} <= ${max})`,\n ),\n [Ops.Interpolate]: createCompiler(([exponent, input, ...compiledArgs]) => {\n let result = '';\n for (let i = 0; i < compiledArgs.length - 2; i += 2) {\n const stop1 = compiledArgs[i];\n const output1 = result || compiledArgs[i + 1];\n const stop2 = compiledArgs[i + 2];\n const output2 = compiledArgs[i + 3];\n let ratio;\n if (exponent === numberToGlsl(1)) {\n ratio = `(${input} - ${stop1}) / (${stop2} - ${stop1})`;\n } else {\n ratio = `(pow(${exponent}, (${input} - ${stop1})) - 1.0) / (pow(${exponent}, (${stop2} - ${stop1})) - 1.0)`;\n }\n result = `mix(${output1}, ${output2}, clamp(${ratio}, 0.0, 1.0))`;\n }\n return result;\n }),\n [Ops.Case]: createCompiler((compiledArgs) => {\n const fallback = compiledArgs[compiledArgs.length - 1];\n let result = null;\n for (let i = compiledArgs.length - 3; i >= 0; i -= 2) {\n const condition = compiledArgs[i];\n const output = compiledArgs[i + 1];\n result = `(${condition} ? ${output} : ${result || fallback})`;\n }\n return result;\n }),\n [Ops.In]: createCompiler(([needle, ...haystack], context) => {\n const funcName = computeOperatorFunctionName('in', context);\n const tests = [];\n for (let i = 0; i < haystack.length; i += 1) {\n tests.push(` if (inputValue == ${haystack[i]}) { return true; }`);\n }\n context.functions[funcName] = `bool ${funcName}(float inputValue) {\n${tests.join('\\n')}\n return false;\n}`;\n return `${funcName}(${needle})`;\n }),\n [Ops.Array]: createCompiler(\n (args) => `vec${args.length}(${args.join(', ')})`,\n ),\n [Ops.Color]: createCompiler((compiledArgs) => {\n if (compiledArgs.length === 1) {\n //grayscale\n return `vec4(vec3(${compiledArgs[0]} / 255.0), 1.0)`;\n }\n if (compiledArgs.length === 2) {\n //grayscale with alpha\n return `vec4(vec3(${compiledArgs[0]} / 255.0), ${compiledArgs[1]})`;\n }\n const rgb = compiledArgs.slice(0, 3).map((color) => `${color} / 255.0`);\n if (compiledArgs.length === 3) {\n return `vec4(${rgb.join(', ')}, 1.0)`;\n }\n const alpha = compiledArgs[3];\n return `vec4(${rgb.join(', ')}, ${alpha})`;\n }),\n [Ops.Band]: createCompiler(([band, xOffset, yOffset], context) => {\n if (!(GET_BAND_VALUE_FUNC in context.functions)) {\n let ifBlocks = '';\n const bandCount = context.bandCount || 1;\n for (let i = 0; i < bandCount; i++) {\n const colorIndex = Math.floor(i / 4);\n let bandIndex = i % 4;\n if (i === bandCount - 1 && bandIndex === 1) {\n // LUMINANCE_ALPHA - band 1 assigned to rgb and band 2 assigned to alpha\n bandIndex = 3;\n }\n const textureName = `${Uniforms.TILE_TEXTURE_ARRAY}[${colorIndex}]`;\n ifBlocks += ` if (band == ${i + 1}.0) {\n return texture2D(${textureName}, v_textureCoord + vec2(dx, dy))[${bandIndex}];\n }\n`;\n }\n\n context.functions[GET_BAND_VALUE_FUNC] =\n `float getBandValue(float band, float xOffset, float yOffset) {\n float dx = xOffset / ${Uniforms.TEXTURE_PIXEL_WIDTH};\n float dy = yOffset / ${Uniforms.TEXTURE_PIXEL_HEIGHT};\n${ifBlocks}\n}`;\n }\n\n return `${GET_BAND_VALUE_FUNC}(${band}, ${xOffset ?? '0.0'}, ${\n yOffset ?? '0.0'\n })`;\n }),\n [Ops.Palette]: (context, expression) => {\n const [index, ...colors] = expression.args;\n const numColors = colors.length;\n const palette = new Uint8Array(numColors * 4);\n for (let i = 0; i < colors.length; i++) {\n const parsedValue = /** @type {string | Array<number>} */ (\n /** @type {LiteralExpression} */ (colors[i]).value\n );\n const color = asArray(parsedValue);\n const offset = i * 4;\n palette[offset] = color[0];\n palette[offset + 1] = color[1];\n palette[offset + 2] = color[2];\n palette[offset + 3] = color[3] * 255;\n }\n if (!context.paletteTextures) {\n context.paletteTextures = [];\n }\n const paletteName = `${PALETTE_TEXTURE_ARRAY}[${context.paletteTextures.length}]`;\n const paletteTexture = new PaletteTexture(paletteName, palette);\n context.paletteTextures.push(paletteTexture);\n const compiledIndex = compile(index, NumberType, context);\n return `texture2D(${paletteName}, vec2((${compiledIndex} + 0.5) / ${numColors}.0, 0.5))`;\n },\n // TODO: unimplemented\n // Ops.Number\n // Ops.String\n // Ops.Coalesce\n // Ops.Concat\n // Ops.ToString\n};\n\n/**\n * @param {Expression} expression The expression.\n * @param {number} returnType The expected return type.\n * @param {CompilationContext} context The compilation context.\n * @return {CompiledExpression} The compiled expression\n */\nfunction compile(expression, returnType, context) {\n // operator\n if (expression instanceof CallExpression) {\n const compiler = compilers[expression.operator];\n if (compiler === undefined) {\n throw new Error(\n `No compiler defined for this operator: ${JSON.stringify(\n expression.operator,\n )}`,\n );\n }\n return compiler(context, expression, returnType);\n }\n\n if ((expression.type & NumberType) > 0) {\n return numberToGlsl(/** @type {number} */ (expression.value));\n }\n\n if ((expression.type & BooleanType) > 0) {\n return expression.value.toString();\n }\n\n if ((expression.type & StringType) > 0) {\n return stringToGlsl(expression.value.toString());\n }\n\n if ((expression.type & ColorType) > 0) {\n return colorToGlsl(\n /** @type {Array<number> | string} */ (expression.value),\n );\n }\n\n if ((expression.type & NumberArrayType) > 0) {\n return arrayToGlsl(/** @type {Array<number>} */ (expression.value));\n }\n\n if ((expression.type & SizeType) > 0) {\n return sizeToGlsl(\n /** @type {number|import('../size.js').Size} */ (expression.value),\n );\n }\n\n throw new Error(\n `Unexpected expression ${expression.value} (expected type ${typeName(\n returnType,\n )})`,\n );\n}\n","/**\n * @module ol/render/webgl/renderinstructions\n */\nimport {UNDEFINED_PROP_VALUE} from '../../expr/gpu.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {apply as applyTransform} from '../../transform.js';\n\n/**\n * @param {Float32Array} renderInstructions Render instructions\n * @param {import('./VectorStyleRenderer.js').AttributeDefinitions} customAttributes Custom attributes\n * @param {import(\"./MixedGeometryBatch.js\").GeometryBatchItem} batchEntry Batch item\n * @param {number} currentIndex Current index\n * @return {number} The amount of values pushed\n */\nfunction pushCustomAttributesInRenderInstructions(\n renderInstructions,\n customAttributes,\n batchEntry,\n currentIndex,\n) {\n let shift = 0;\n for (const key in customAttributes) {\n const attr = customAttributes[key];\n const value = attr.callback.call(batchEntry, batchEntry.feature);\n let first = value?.[0] ?? value;\n if (first === UNDEFINED_PROP_VALUE) {\n console.warn('The \"has\" operator might return false positives.'); // eslint-disable-line no-console\n }\n if (first === undefined) {\n first = UNDEFINED_PROP_VALUE;\n } else if (first === null) {\n first = 0;\n }\n renderInstructions[currentIndex + shift++] = first;\n if (!attr.size || attr.size === 1) {\n continue;\n }\n renderInstructions[currentIndex + shift++] = value[1];\n if (attr.size < 3) {\n continue;\n }\n renderInstructions[currentIndex + shift++] = value[2];\n if (attr.size < 4) {\n continue;\n }\n renderInstructions[currentIndex + shift++] = value[3];\n }\n return shift;\n}\n\n/**\n * @param {import('./VectorStyleRenderer.js').AttributeDefinitions} customAttributes Custom attributes\n * @return {number} Cumulated size of all attributes\n */\nexport function getCustomAttributesSize(customAttributes) {\n return Object.keys(customAttributes).reduce(\n (prev, curr) => prev + (customAttributes[curr].size || 1),\n 0,\n );\n}\n\n/**\n * Render instructions for lines are structured like so:\n * [ x0, y0, customAttr0, ... , xN, yN, customAttrN ]\n * @param {import(\"./MixedGeometryBatch.js\").PointGeometryBatch} batch Point geometry batch\n * @param {Float32Array} renderInstructions Render instructions\n * @param {import('./VectorStyleRenderer.js').AttributeDefinitions} customAttributes Custom attributes\n * @param {import(\"../../transform.js\").Transform} transform Transform to apply to coordinates\n * @return {Float32Array} Generated render instructions\n */\nexport function generatePointRenderInstructions(\n batch,\n renderInstructions,\n customAttributes,\n transform,\n) {\n // here we anticipate the amount of render instructions for points:\n // 2 instructions per vertex for position (x and y)\n // + 1 instruction per vertex per custom attributes\n const totalInstructionsCount =\n (2 + getCustomAttributesSize(customAttributes)) * batch.geometriesCount;\n if (\n !renderInstructions ||\n renderInstructions.length !== totalInstructionsCount\n ) {\n renderInstructions = new Float32Array(totalInstructionsCount);\n }\n\n // loop on features to fill the render instructions\n const tmpCoords = [];\n let renderIndex = 0;\n for (const featureUid in batch.entries) {\n const batchEntry = batch.entries[featureUid];\n for (let i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {\n tmpCoords[0] = batchEntry.flatCoordss[i][0];\n tmpCoords[1] = batchEntry.flatCoordss[i][1];\n applyTransform(transform, tmpCoords);\n\n renderInstructions[renderIndex++] = tmpCoords[0];\n renderInstructions[renderIndex++] = tmpCoords[1];\n renderIndex += pushCustomAttributesInRenderInstructions(\n renderInstructions,\n customAttributes,\n batchEntry,\n renderIndex,\n );\n }\n }\n return renderInstructions;\n}\n\n/**\n * Render instructions for lines are structured like so:\n * [ customAttr0, ... , customAttrN, numberOfVertices0, x0, y0, ... , xN, yN, numberOfVertices1, ... ]\n * @param {import(\"./MixedGeometryBatch.js\").LineStringGeometryBatch} batch Line String geometry batch\n * @param {Float32Array} renderInstructions Render instructions\n * @param {import('./VectorStyleRenderer.js').AttributeDefinitions} customAttributes Custom attributes\n * @param {import(\"../../transform.js\").Transform} transform Transform to apply to coordinates\n * @return {Float32Array} Generated render instructions\n */\nexport function generateLineStringRenderInstructions(\n batch,\n renderInstructions,\n customAttributes,\n transform,\n) {\n // here we anticipate the amount of render instructions for lines:\n // 3 instructions per vertex for position (x, y and m)\n // + 1 instruction per line per custom attributes\n // + 1 instruction per line (for vertices count)\n const totalInstructionsCount =\n 3 * batch.verticesCount +\n (1 + getCustomAttributesSize(customAttributes)) * batch.geometriesCount;\n if (\n !renderInstructions ||\n renderInstructions.length !== totalInstructionsCount\n ) {\n renderInstructions = new Float32Array(totalInstructionsCount);\n }\n\n // loop on features to fill the render instructions\n const flatCoords = [];\n let renderIndex = 0;\n for (const featureUid in batch.entries) {\n const batchEntry = batch.entries[featureUid];\n for (let i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {\n flatCoords.length = batchEntry.flatCoordss[i].length;\n transform2D(\n batchEntry.flatCoordss[i],\n 0,\n flatCoords.length,\n 3,\n transform,\n flatCoords,\n 3,\n );\n renderIndex += pushCustomAttributesInRenderInstructions(\n renderInstructions,\n customAttributes,\n batchEntry,\n renderIndex,\n );\n\n // vertices count\n renderInstructions[renderIndex++] = flatCoords.length / 3;\n\n // looping on points for positions\n for (let j = 0, jj = flatCoords.length; j < jj; j += 3) {\n renderInstructions[renderIndex++] = flatCoords[j];\n renderInstructions[renderIndex++] = flatCoords[j + 1];\n renderInstructions[renderIndex++] = flatCoords[j + 2];\n }\n }\n }\n return renderInstructions;\n}\n\n/**\n * Render instructions for polygons are structured like so:\n * [ customAttr0, ..., customAttrN, numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, ..., xN, yN, numberOfRings,... ]\n * @param {import(\"./MixedGeometryBatch.js\").PolygonGeometryBatch} batch Polygon geometry batch\n * @param {Float32Array} renderInstructions Render instructions\n * @param {import('./VectorStyleRenderer.js').AttributeDefinitions} customAttributes Custom attributes\n * @param {import(\"../../transform.js\").Transform} transform Transform to apply to coordinates\n * @return {Float32Array} Generated render instructions\n */\nexport function generatePolygonRenderInstructions(\n batch,\n renderInstructions,\n customAttributes,\n transform,\n) {\n // here we anticipate the amount of render instructions for polygons:\n // 2 instructions per vertex for position (x and y)\n // + 1 instruction per polygon per custom attributes\n // + 1 instruction per polygon (for vertices count in polygon)\n // + 1 instruction per ring (for vertices count in ring)\n const totalInstructionsCount =\n 2 * batch.verticesCount +\n (1 + getCustomAttributesSize(customAttributes)) * batch.geometriesCount +\n batch.ringsCount;\n if (\n !renderInstructions ||\n renderInstructions.length !== totalInstructionsCount\n ) {\n renderInstructions = new Float32Array(totalInstructionsCount);\n }\n\n // loop on features to fill the render instructions\n const flatCoords = [];\n let renderIndex = 0;\n for (const featureUid in batch.entries) {\n const batchEntry = batch.entries[featureUid];\n for (let i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {\n flatCoords.length = batchEntry.flatCoordss[i].length;\n transform2D(\n batchEntry.flatCoordss[i],\n 0,\n flatCoords.length,\n 2,\n transform,\n flatCoords,\n );\n renderIndex += pushCustomAttributesInRenderInstructions(\n renderInstructions,\n customAttributes,\n batchEntry,\n renderIndex,\n );\n\n // ring count\n renderInstructions[renderIndex++] =\n batchEntry.ringsVerticesCounts[i].length;\n\n // vertices count in each ring\n for (\n let j = 0, jj = batchEntry.ringsVerticesCounts[i].length;\n j < jj;\n j++\n ) {\n renderInstructions[renderIndex++] =\n batchEntry.ringsVerticesCounts[i][j];\n }\n\n // looping on points for positions\n for (let j = 0, jj = flatCoords.length; j < jj; j += 2) {\n renderInstructions[renderIndex++] = flatCoords[j];\n renderInstructions[renderIndex++] = flatCoords[j + 1];\n }\n }\n }\n return renderInstructions;\n}\n","\nexport default function earcut(data, holeIndices, dim = 2) {\n\n const hasHoles = holeIndices && holeIndices.length;\n const outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n let outerNode = linkedList(data, 0, outerLen, dim, true);\n const triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n let minX, minY, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = Infinity;\n minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n\n for (let i = dim; i < outerLen; i += dim) {\n const x = data[i];\n const y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n let last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);\n } else {\n for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n let p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n let stop = ear;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n const prev = ear.prev;\n const next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n triangles.push(prev.i, ear.i, next.i); // cut off the triangle\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n const a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox\n const x0 = Math.min(ax, bx, cx),\n y0 = Math.min(ay, by, cy),\n x1 = Math.max(ax, bx, cx),\n y1 = Math.max(ay, by, cy);\n\n let p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n const a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox\n const x0 = Math.min(ax, bx, cx),\n y0 = Math.min(ay, by, cy),\n x1 = Math.max(ax, bx, cx),\n y1 = Math.max(ay, by, cy);\n\n // z-order range for the current triangle bbox;\n const minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n\n let p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles) {\n let p = start;\n do {\n const a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i, p.i, b.i);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n let a = start;\n do {\n let b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n let c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n const queue = [];\n\n for (let i = 0, len = holeIndices.length; i < len; i++) {\n const start = holeIndices[i] * dim;\n const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n const list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareXYSlope);\n\n // process holes from left to right\n for (let i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n\n return outerNode;\n}\n\nfunction compareXYSlope(a, b) {\n let result = a.x - b.x;\n // when the left-most point of 2 holes meet at a vertex, sort the holes counterclockwise so that when we find\n // the bridge to the outer shell is always the point that they meet at.\n if (result === 0) {\n result = a.y - b.y;\n if (result === 0) {\n const aSlope = (a.next.y - a.y) / (a.next.x - a.x);\n const bSlope = (b.next.y - b.y) / (b.next.x - b.x);\n result = aSlope - bSlope;\n }\n }\n return result;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n const bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n const bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n let p = outerNode;\n const hx = hole.x;\n const hy = hole.y;\n let qx = -Infinity;\n let m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n // unless they intersect at a vertex, then choose the vertex\n if (equals(hole, p)) return p;\n do {\n if (equals(hole, p.next)) return p.next;\n else if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n const stop = m;\n const mx = m.x;\n const my = m.y;\n let tanMin = Infinity;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n const tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n let p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n let numMerges;\n let inSize = 1;\n\n do {\n let p = list;\n let e;\n list = null;\n let tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n let q = p;\n let pSize = 0;\n for (let i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n let qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n let p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a point lies within a convex triangle but false if its equal to the first point of the triangle\nfunction pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {\n return !(ax === px && ay === py) && pointInTriangle(ax, ay, bx, by, cx, cy, px, py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n const o1 = sign(area(p1, q1, p2));\n const o2 = sign(area(p1, q1, q2));\n const o3 = sign(area(p2, q2, p1));\n const o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n let p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n let p = a;\n let inside = false;\n const px = (a.x + b.x) / 2;\n const py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n const a2 = createNode(a.i, a.x, a.y),\n b2 = createNode(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n const p = createNode(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction createNode(i, x, y) {\n return {\n i, // vertex index in coordinates array\n x, y, // vertex coordinates\n prev: null, // previous and next vertex nodes in a polygon ring\n next: null,\n z: 0, // z-order curve value\n prevZ: null, // previous and next nodes in z-order\n nextZ: null,\n steiner: false // indicates whether this is a steiner point\n };\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nexport function deviation(data, holeIndices, dim, triangles) {\n const hasHoles = holeIndices && holeIndices.length;\n const outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n let polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (let i = 0, len = holeIndices.length; i < len; i++) {\n const start = holeIndices[i] * dim;\n const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n let trianglesArea = 0;\n for (let i = 0; i < triangles.length; i += 3) {\n const a = triangles[i] * dim;\n const b = triangles[i + 1] * dim;\n const c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n}\n\nfunction signedArea(data, start, end, dim) {\n let sum = 0;\n for (let i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nexport function flatten(data) {\n const vertices = [];\n const holes = [];\n const dimensions = data[0][0].length;\n let holeIndex = 0;\n let prevLen = 0;\n\n for (const ring of data) {\n for (const p of ring) {\n for (let d = 0; d < dimensions; d++) vertices.push(p[d]);\n }\n if (prevLen) {\n holeIndex += prevLen;\n holes.push(holeIndex);\n }\n prevLen = ring.length;\n }\n return {vertices, holes, dimensions};\n}\n","/**\n * Utilities for filling WebGL buffers\n * @module ol/render/webgl/bufferUtil\n */\nimport earcut from 'earcut';\nimport {clamp} from '../../math.js';\nimport {apply as applyTransform} from '../../transform.js';\n\nexport const LINESTRING_ANGLE_COSINE_CUTOFF = 0.985;\n\n/** @type {Array<number>} */\nconst tmpArray_ = [];\n\n/**\n * An object holding positions both in an index and a vertex buffer.\n * @typedef {Object} BufferPositions\n * @property {number} vertexPosition Position in the vertex buffer\n * @property {number} indexPosition Position in the index buffer\n */\nconst bufferPositions_ = {vertexPosition: 0, indexPosition: 0};\n\n/**\n * @param {Float32Array} buffer Buffer\n * @param {number} pos Position\n * @param {number} x X\n * @param {number} y Y\n * @param {number} index Index\n */\nfunction writePointVertex(buffer, pos, x, y, index) {\n buffer[pos + 0] = x;\n buffer[pos + 1] = y;\n buffer[pos + 2] = index;\n}\n\n/**\n * Pushes a quad (two triangles) based on a point geometry\n * @param {Float32Array} instructions Array of render instructions for points.\n * @param {number} elementIndex Index from which render instructions will be read.\n * @param {Float32Array} vertexBuffer Buffer in the form of a typed array.\n * @param {Uint32Array} indexBuffer Buffer in the form of a typed array.\n * @param {number} customAttributesSize Amount of custom attributes for each element.\n * @param {BufferPositions} [bufferPositions] Buffer write positions; if not specified, positions will be set at 0.\n * @return {BufferPositions} New buffer positions where to write next\n * @property {number} vertexPosition New position in the vertex buffer where future writes should start.\n * @property {number} indexPosition New position in the index buffer where future writes should start.\n * @private\n */\nexport function writePointFeatureToBuffers(\n instructions,\n elementIndex,\n vertexBuffer,\n indexBuffer,\n customAttributesSize,\n bufferPositions,\n) {\n // This is for x, y and index\n const baseVertexAttrsCount = 3;\n const baseInstructionsCount = 2;\n const stride = baseVertexAttrsCount + customAttributesSize;\n\n const x = instructions[elementIndex + 0];\n const y = instructions[elementIndex + 1];\n\n // read custom numerical attributes on the feature\n const customAttrs = tmpArray_;\n customAttrs.length = customAttributesSize;\n for (let i = 0; i < customAttrs.length; i++) {\n customAttrs[i] = instructions[elementIndex + baseInstructionsCount + i];\n }\n\n let vPos = bufferPositions ? bufferPositions.vertexPosition : 0;\n let iPos = bufferPositions ? bufferPositions.indexPosition : 0;\n const baseIndex = vPos / stride;\n\n // push vertices for each of the four quad corners (first standard then custom attributes)\n writePointVertex(vertexBuffer, vPos, x, y, 0);\n customAttrs.length &&\n vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);\n vPos += stride;\n\n writePointVertex(vertexBuffer, vPos, x, y, 1);\n customAttrs.length &&\n vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);\n vPos += stride;\n\n writePointVertex(vertexBuffer, vPos, x, y, 2);\n customAttrs.length &&\n vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);\n vPos += stride;\n\n writePointVertex(vertexBuffer, vPos, x, y, 3);\n customAttrs.length &&\n vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);\n vPos += stride;\n\n indexBuffer[iPos++] = baseIndex;\n indexBuffer[iPos++] = baseIndex + 1;\n indexBuffer[iPos++] = baseIndex + 3;\n indexBuffer[iPos++] = baseIndex + 1;\n indexBuffer[iPos++] = baseIndex + 2;\n indexBuffer[iPos++] = baseIndex + 3;\n\n bufferPositions_.vertexPosition = vPos;\n bufferPositions_.indexPosition = iPos;\n\n return bufferPositions_;\n}\n\n/**\n * Pushes a single quad to form a line segment; also includes a computation for the join angles with previous and next\n * segment, in order to be able to offset the vertices correctly in the shader.\n * Join angles are between 0 and 2PI.\n * This also computes the length of the current segment and the sum of the join angle tangents in order\n * to store this information on each subsequent segment along the line. This is necessary to correctly render dashes\n * and symbols along the line.\n *\n * pB (before) pA (after)\n * X negative X\n * \\ offset /\n * \\ /\n * \\ join join /\n * \\ angle 0 angle 1 /\n * \\←--- ←---/ positive\n * \\ ←-- ←-- / offset\n * \\ ↑ ↓ /\n * X────┴───────┴─────X\n * p0 p1\n *\n * @param {Float32Array} instructions Array of render instructions for lines.s\n * @param {number} segmentStartIndex Index of the segment start point from which render instructions will be read.\n * @param {number} segmentEndIndex Index of the segment end point from which render instructions will be read.\n * @param {number|null} beforeSegmentIndex Index of the point right before the segment (null if none, e.g this is a line start)\n * @param {number|null} afterSegmentIndex Index of the point right after the segment (null if none, e.g this is a line end)\n * @param {Array<number>} vertexArray Array containing vertices.\n * @param {Array<number>} indexArray Array containing indices.\n * @param {Array<number>} customAttributes Array of custom attributes value\n * @param {import('../../transform.js').Transform} toWorldTransform Transform matrix used to obtain world coordinates from instructions\n * @param {number} currentLength Cumulated length of segments processed so far\n * @param {number} currentAngleTangentSum Cumulated tangents of the join angles processed so far\n * @return {{length: number, angle: number}} Cumulated length with the newly processed segment (in world units), new sum of the join angle tangents\n * @private\n */\nexport function writeLineSegmentToBuffers(\n instructions,\n segmentStartIndex,\n segmentEndIndex,\n beforeSegmentIndex,\n afterSegmentIndex,\n vertexArray,\n indexArray,\n customAttributes,\n toWorldTransform,\n currentLength,\n currentAngleTangentSum,\n) {\n // compute the stride to determine how many vertices were already pushed\n const baseVertexAttrsCount = 10; // base attributes: x0, y0, m0, x1, y1, m1, angle0, angle1, distance, params\n const stride = baseVertexAttrsCount + customAttributes.length;\n const baseIndex = vertexArray.length / stride;\n\n // The segment is composed of two positions called P0[x0, y0] and P1[x1, y1]\n // Depending on whether there are points before and after the segment, its final shape\n // will be different\n const p0 = [\n instructions[segmentStartIndex + 0],\n instructions[segmentStartIndex + 1],\n ];\n const p1 = [instructions[segmentEndIndex], instructions[segmentEndIndex + 1]];\n\n const m0 = instructions[segmentStartIndex + 2];\n const m1 = instructions[segmentEndIndex + 2];\n\n // to compute join angles we need to reproject coordinates back in world units\n const p0world = applyTransform(toWorldTransform, [...p0]);\n const p1world = applyTransform(toWorldTransform, [...p1]);\n\n /**\n * Compute the angle between p0pA and p0pB\n * @param {import(\"../../coordinate.js\").Coordinate} p0 Point 0\n * @param {import(\"../../coordinate.js\").Coordinate} pA Point A\n * @param {import(\"../../coordinate.js\").Coordinate} pB Point B\n * @return {number} a value in [0, 2PI]\n */\n function angleBetween(p0, pA, pB) {\n const lenA = Math.sqrt(\n (pA[0] - p0[0]) * (pA[0] - p0[0]) + (pA[1] - p0[1]) * (pA[1] - p0[1]),\n );\n const tangentA = [(pA[0] - p0[0]) / lenA, (pA[1] - p0[1]) / lenA];\n const orthoA = [-tangentA[1], tangentA[0]];\n const lenB = Math.sqrt(\n (pB[0] - p0[0]) * (pB[0] - p0[0]) + (pB[1] - p0[1]) * (pB[1] - p0[1]),\n );\n const tangentB = [(pB[0] - p0[0]) / lenB, (pB[1] - p0[1]) / lenB];\n\n // this angle can be clockwise or anticlockwise; hence the computation afterwards\n const angle =\n lenA === 0 || lenB === 0\n ? 0\n : Math.acos(\n clamp(tangentB[0] * tangentA[0] + tangentB[1] * tangentA[1], -1, 1),\n );\n const isClockwise = tangentB[0] * orthoA[0] + tangentB[1] * orthoA[1] > 0;\n return !isClockwise ? Math.PI * 2 - angle : angle;\n }\n\n // a negative angle indicates a line cap\n let angle0 = -1;\n let angle1 = -1;\n let newAngleTangentSum = currentAngleTangentSum;\n\n const joinBefore = beforeSegmentIndex !== null;\n const joinAfter = afterSegmentIndex !== null;\n\n // add vertices and adapt offsets for P0 in case of join\n if (joinBefore) {\n // B for before\n const pB = [\n instructions[beforeSegmentIndex],\n instructions[beforeSegmentIndex + 1],\n ];\n const pBworld = applyTransform(toWorldTransform, [...pB]);\n angle0 = angleBetween(p0world, p1world, pBworld);\n\n // only add to the sum if the angle isn't too close to 0 or 2PI\n if (Math.cos(angle0) <= LINESTRING_ANGLE_COSINE_CUTOFF) {\n newAngleTangentSum += Math.tan((angle0 - Math.PI) / 2);\n }\n }\n // adapt offsets for P1 in case of join; add to angle sum\n if (joinAfter) {\n // A for after\n const pA = [\n instructions[afterSegmentIndex],\n instructions[afterSegmentIndex + 1],\n ];\n const pAworld = applyTransform(toWorldTransform, [...pA]);\n angle1 = angleBetween(p1world, p0world, pAworld);\n\n // only add to the sum if the angle isn't too close to 0 or 2PI\n if (Math.cos(angle1) <= LINESTRING_ANGLE_COSINE_CUTOFF) {\n newAngleTangentSum += Math.tan((Math.PI - angle1) / 2);\n }\n }\n\n /**\n * @param {number} vertexIndex From 0 to 3, indicating position in the quad\n * @param {number} angleSum Sum of the join angles encountered so far (used to compute distance offset\n * @return {number} A float value containing both information\n */\n function computeParameters(vertexIndex, angleSum) {\n if (angleSum === 0) {\n return vertexIndex * 10000;\n }\n return Math.sign(angleSum) * (vertexIndex * 10000 + Math.abs(angleSum));\n }\n\n // add main segment triangles\n vertexArray.push(\n p0[0],\n p0[1],\n m0,\n p1[0],\n p1[1],\n m1,\n angle0,\n angle1,\n currentLength,\n computeParameters(0, currentAngleTangentSum),\n );\n vertexArray.push(...customAttributes);\n\n vertexArray.push(\n p0[0],\n p0[1],\n m0,\n p1[0],\n p1[1],\n m1,\n angle0,\n angle1,\n currentLength,\n computeParameters(1, currentAngleTangentSum),\n );\n vertexArray.push(...customAttributes);\n\n vertexArray.push(\n p0[0],\n p0[1],\n m0,\n p1[0],\n p1[1],\n m1,\n angle0,\n angle1,\n currentLength,\n computeParameters(2, currentAngleTangentSum),\n );\n vertexArray.push(...customAttributes);\n\n vertexArray.push(\n p0[0],\n p0[1],\n m0,\n p1[0],\n p1[1],\n m1,\n angle0,\n angle1,\n currentLength,\n computeParameters(3, currentAngleTangentSum),\n );\n vertexArray.push(...customAttributes);\n\n indexArray.push(\n baseIndex,\n baseIndex + 1,\n baseIndex + 2,\n baseIndex + 1,\n baseIndex + 3,\n baseIndex + 2,\n );\n\n return {\n length:\n currentLength +\n Math.sqrt(\n (p1world[0] - p0world[0]) * (p1world[0] - p0world[0]) +\n (p1world[1] - p0world[1]) * (p1world[1] - p0world[1]),\n ),\n angle: newAngleTangentSum,\n };\n}\n\n/**\n * Pushes several triangles to form a polygon, including holes\n * @param {Float32Array} instructions Array of render instructions for lines.\n * @param {number} polygonStartIndex Index of the polygon start point from which render instructions will be read.\n * @param {Array<number>} vertexArray Array containing vertices.\n * @param {Array<number>} indexArray Array containing indices.\n * @param {number} customAttributesSize Amount of custom attributes for each element.\n * @return {number} Next polygon instructions index\n * @private\n */\nexport function writePolygonTrianglesToBuffers(\n instructions,\n polygonStartIndex,\n vertexArray,\n indexArray,\n customAttributesSize,\n) {\n const instructionsPerVertex = 2; // x, y\n const attributesPerVertex = 2 + customAttributesSize;\n let instructionsIndex = polygonStartIndex;\n const customAttributes = instructions.slice(\n instructionsIndex,\n instructionsIndex + customAttributesSize,\n );\n instructionsIndex += customAttributesSize;\n const ringsCount = instructions[instructionsIndex++];\n let verticesCount = 0;\n const holes = new Array(ringsCount - 1);\n for (let i = 0; i < ringsCount; i++) {\n verticesCount += instructions[instructionsIndex++];\n if (i < ringsCount - 1) {\n holes[i] = verticesCount;\n }\n }\n const flatCoords = instructions.slice(\n instructionsIndex,\n instructionsIndex + verticesCount * instructionsPerVertex,\n );\n\n // pushing to vertices and indices!! this is where the magic happens\n const result = earcut(flatCoords, holes, instructionsPerVertex);\n for (let i = 0; i < result.length; i++) {\n indexArray.push(result[i] + vertexArray.length / attributesPerVertex);\n }\n for (let i = 0; i < flatCoords.length; i += 2) {\n vertexArray.push(flatCoords[i], flatCoords[i + 1], ...customAttributes);\n }\n\n return instructionsIndex + verticesCount * instructionsPerVertex;\n}\n","/**\n * Class for generating shaders from literal style objects\n * @module ol/render/webgl/ShaderBuilder\n */\nimport {colorToGlsl, numberToGlsl, stringToGlsl} from '../../expr/gpu.js';\nimport {createDefaultStyle} from '../../style/flat.js';\nimport {LINESTRING_ANGLE_COSINE_CUTOFF} from './bufferUtil.js';\n\nexport const COMMON_HEADER = `#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\nfloat currentLineMetric = 0.; // an actual value will be used in the stroke shaders\n`;\n\nconst DEFAULT_STYLE = createDefaultStyle();\n\n/**\n * @typedef {Object} AttributeDescription\n * @property {string} name Attribute name, as will be declared in the header of the vertex shader (including a_)\n * @property {string} type Attribute GLSL type, either `float`, `vec2`, `vec4`...\n * @property {string} varyingName Varying name, as will be declared in the header of both shaders (including v_)\n * @property {string} varyingType Varying type, either `float`, `vec2`, `vec4`...\n * @property {string} varyingExpression GLSL expression to assign to the varying in the vertex shader (e.g. `unpackColor(a_myAttr)`)\n */\n\n/**\n * @typedef {Object} UniformDescription\n * @property {string} name Uniform name, as will be declared in the header of the vertex shader (including u_)\n * @property {string} type Uniform GLSL type, either `float`, `vec2`, `vec4`...\n */\n\n/**\n * @classdesc\n * This class implements a classic builder pattern for generating many different types of shaders.\n * Methods can be chained, e. g.:\n *\n * ```js\n * const shader = new ShaderBuilder()\n * .addAttribute('a_width', 'float')\n * .addUniform('u_time', 'float)\n * .setColorExpression('...')\n * .setSymbolSizeExpression('...')\n * .getSymbolFragmentShader();\n * ```\n *\n * A note on [alpha premultiplication](https://en.wikipedia.org/wiki/Alpha_compositing#Straight_versus_premultiplied):\n * The ShaderBuilder class expects all colors to **not having been alpha-premultiplied!** This is because alpha\n * premultiplication is done at the end of each fragment shader.\n */\nexport class ShaderBuilder {\n constructor() {\n /**\n * Uniforms; these will be declared in the header (should include the type).\n * @type {Array<UniformDescription>}\n * @private\n */\n this.uniforms_ = [];\n\n /**\n * Attributes; these will be declared in the header (should include the type).\n * @type {Array<AttributeDescription>}\n * @private\n */\n this.attributes_ = [];\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasSymbol_ = false;\n\n /**\n * @type {string}\n * @private\n */\n this.symbolSizeExpression_ = `vec2(${numberToGlsl(\n DEFAULT_STYLE['circle-radius'],\n )} + ${numberToGlsl(DEFAULT_STYLE['circle-stroke-width'] * 0.5)})`;\n\n /**\n * @type {string}\n * @private\n */\n this.symbolRotationExpression_ = '0.0';\n\n /**\n * @type {string}\n * @private\n */\n this.symbolOffsetExpression_ = 'vec2(0.0)';\n\n /**\n * @type {string}\n * @private\n */\n this.symbolColorExpression_ = colorToGlsl(\n /** @type {string} */ (DEFAULT_STYLE['circle-fill-color']),\n );\n\n /**\n * @type {string}\n * @private\n */\n this.texCoordExpression_ = 'vec4(0.0, 0.0, 1.0, 1.0)';\n\n /**\n * @type {string}\n * @private\n */\n this.discardExpression_ = 'false';\n\n /**\n * @type {boolean}\n * @private\n */\n this.symbolRotateWithView_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasStroke_ = false;\n\n /**\n * @type {string}\n * @private\n */\n this.strokeWidthExpression_ = numberToGlsl(DEFAULT_STYLE['stroke-width']);\n\n /**\n * @type {string}\n * @private\n */\n this.strokeColorExpression_ = colorToGlsl(\n /** @type {string} */ (DEFAULT_STYLE['stroke-color']),\n );\n\n /**\n * @private\n */\n this.strokeOffsetExpression_ = '0.';\n\n /**\n * @private\n */\n this.strokeCapExpression_ = stringToGlsl('round');\n\n /**\n * @private\n */\n this.strokeJoinExpression_ = stringToGlsl('round');\n\n /**\n * @private\n */\n this.strokeMiterLimitExpression_ = '10.';\n\n /**\n * @private\n */\n this.strokeDistanceFieldExpression_ = '-1000.';\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasFill_ = false;\n\n /**\n * @type {string}\n * @private\n */\n this.fillColorExpression_ = colorToGlsl(\n /** @type {string} */ (DEFAULT_STYLE['fill-color']),\n );\n\n /**\n * @type {Array<string>}\n * @private\n */\n this.vertexShaderFunctions_ = [];\n\n /**\n * @type {Array<string>}\n * @private\n */\n this.fragmentShaderFunctions_ = [];\n }\n\n /**\n * Adds a uniform accessible in both fragment and vertex shaders.\n * The given name should include a type, such as `sampler2D u_texture`.\n * @param {string} name Uniform name, including the `u_` prefix\n * @param {'float'|'vec2'|'vec3'|'vec4'|'sampler2D'} type GLSL type\n * @return {ShaderBuilder} the builder object\n */\n addUniform(name, type) {\n this.uniforms_.push({\n name,\n type,\n });\n return this;\n }\n\n /**\n * Adds an attribute accessible in the vertex shader, read from the geometry buffer.\n * The given name should include a type, such as `vec2 a_position`.\n * Attributes will also be made available under the same name in fragment shaders.\n * @param {string} name Attribute name, including the `a_` prefix\n * @param {'float'|'vec2'|'vec3'|'vec4'} type GLSL type\n * @param {string} [varyingExpression] Expression which will be assigned to the varying in the vertex shader, and\n * passed on to the fragment shader.\n * @param {'float'|'vec2'|'vec3'|'vec4'} [varyingType] Type of the attribute after transformation;\n * e.g. `vec4` after unpacking color components\n * @return {ShaderBuilder} the builder object\n */\n addAttribute(name, type, varyingExpression, varyingType) {\n this.attributes_.push({\n name,\n type,\n varyingName: name.replace(/^a_/, 'v_'),\n varyingType: varyingType ?? type,\n varyingExpression: varyingExpression ?? name,\n });\n return this;\n }\n\n /**\n * Sets an expression to compute the size of the shape.\n * This expression can use all the uniforms and attributes available\n * in the vertex shader, and should evaluate to a `vec2` value.\n * @param {string} expression Size expression\n * @return {ShaderBuilder} the builder object\n */\n setSymbolSizeExpression(expression) {\n this.hasSymbol_ = true;\n this.symbolSizeExpression_ = expression;\n return this;\n }\n\n /**\n * @return {string} The current symbol size expression\n */\n getSymbolSizeExpression() {\n return this.symbolSizeExpression_;\n }\n\n /**\n * Sets an expression to compute the rotation of the shape.\n * This expression can use all the uniforms and attributes available\n * in the vertex shader, and should evaluate to a `float` value in radians.\n * @param {string} expression Size expression\n * @return {ShaderBuilder} the builder object\n */\n setSymbolRotationExpression(expression) {\n this.symbolRotationExpression_ = expression;\n return this;\n }\n\n /**\n * Sets an expression to compute the offset of the symbol from the point center.\n * This expression can use all the uniforms and attributes available\n * in the vertex shader, and should evaluate to a `vec2` value.\n * @param {string} expression Offset expression\n * @return {ShaderBuilder} the builder object\n */\n setSymbolOffsetExpression(expression) {\n this.symbolOffsetExpression_ = expression;\n return this;\n }\n\n /**\n * @return {string} The current symbol offset expression\n */\n getSymbolOffsetExpression() {\n return this.symbolOffsetExpression_;\n }\n\n /**\n * Sets an expression to compute the color of the shape.\n * This expression can use all the uniforms, varyings and attributes available\n * in the fragment shader, and should evaluate to a `vec4` value.\n * @param {string} expression Color expression\n * @return {ShaderBuilder} the builder object\n */\n setSymbolColorExpression(expression) {\n this.hasSymbol_ = true;\n this.symbolColorExpression_ = expression;\n return this;\n }\n\n /**\n * @return {string} The current symbol color expression\n */\n getSymbolColorExpression() {\n return this.symbolColorExpression_;\n }\n\n /**\n * Sets an expression to compute the texture coordinates of the vertices.\n * This expression can use all the uniforms and attributes available\n * in the vertex shader, and should evaluate to a `vec4` value.\n * @param {string} expression Texture coordinate expression\n * @return {ShaderBuilder} the builder object\n */\n setTextureCoordinateExpression(expression) {\n this.texCoordExpression_ = expression;\n return this;\n }\n\n /**\n * Sets an expression to determine whether a fragment (pixel) should be discarded,\n * i.e. not drawn at all.\n * This expression can use all the uniforms, varyings and attributes available\n * in the fragment shader, and should evaluate to a `bool` value (it will be\n * used in an `if` statement)\n * @param {string} expression Fragment discard expression\n * @return {ShaderBuilder} the builder object\n */\n setFragmentDiscardExpression(expression) {\n this.discardExpression_ = expression;\n return this;\n }\n\n /**\n * @return {string} The current fragment discard expression\n */\n getFragmentDiscardExpression() {\n return this.discardExpression_;\n }\n\n /**\n * Sets whether the symbols should rotate with the view or stay aligned with the map.\n * Note: will only be used for point geometry shaders.\n * @param {boolean} rotateWithView Rotate with view\n * @return {ShaderBuilder} the builder object\n */\n setSymbolRotateWithView(rotateWithView) {\n this.symbolRotateWithView_ = rotateWithView;\n return this;\n }\n\n /**\n * @param {string} expression Stroke width expression, returning value in pixels\n * @return {ShaderBuilder} the builder object\n */\n setStrokeWidthExpression(expression) {\n this.hasStroke_ = true;\n this.strokeWidthExpression_ = expression;\n return this;\n }\n\n /**\n * @param {string} expression Stroke color expression, evaluate to `vec4`: can rely on currentLengthPx and currentRadiusPx\n * @return {ShaderBuilder} the builder object\n */\n setStrokeColorExpression(expression) {\n this.hasStroke_ = true;\n this.strokeColorExpression_ = expression;\n return this;\n }\n\n /**\n * @return {string} The current stroke color expression\n */\n getStrokeColorExpression() {\n return this.strokeColorExpression_;\n }\n\n /**\n * @param {string} expression Stroke color expression, evaluate to `float`\n * @return {ShaderBuilder} the builder object\n */\n setStrokeOffsetExpression(expression) {\n this.strokeOffsetExpression_ = expression;\n return this;\n }\n\n /**\n * @param {string} expression Stroke line cap expression, evaluate to `float`\n * @return {ShaderBuilder} the builder object\n */\n setStrokeCapExpression(expression) {\n this.strokeCapExpression_ = expression;\n return this;\n }\n\n /**\n * @param {string} expression Stroke line join expression, evaluate to `float`\n * @return {ShaderBuilder} the builder object\n */\n setStrokeJoinExpression(expression) {\n this.strokeJoinExpression_ = expression;\n return this;\n }\n\n /**\n * @param {string} expression Stroke miter limit expression, evaluate to `float`\n * @return {ShaderBuilder} the builder object\n */\n setStrokeMiterLimitExpression(expression) {\n this.strokeMiterLimitExpression_ = expression;\n return this;\n }\n\n /**\n * @param {string} expression Stroke distance field expression, evaluate to `float`\n * This can override the default distance field; can rely on currentLengthPx and currentRadiusPx\n * @return {ShaderBuilder} the builder object\n */\n setStrokeDistanceFieldExpression(expression) {\n this.strokeDistanceFieldExpression_ = expression;\n return this;\n }\n\n /**\n * @param {string} expression Fill color expression, evaluate to `vec4`\n * @return {ShaderBuilder} the builder object\n */\n setFillColorExpression(expression) {\n this.hasFill_ = true;\n this.fillColorExpression_ = expression;\n return this;\n }\n\n /**\n * @return {string} The current fill color expression\n */\n getFillColorExpression() {\n return this.fillColorExpression_;\n }\n\n addVertexShaderFunction(code) {\n if (this.vertexShaderFunctions_.includes(code)) {\n return this;\n }\n this.vertexShaderFunctions_.push(code);\n return this;\n }\n addFragmentShaderFunction(code) {\n if (this.fragmentShaderFunctions_.includes(code)) {\n return this;\n }\n this.fragmentShaderFunctions_.push(code);\n return this;\n }\n\n /**\n * Generates a symbol vertex shader from the builder parameters\n * @return {string|null} The full shader as a string; null if no size or color specified\n */\n getSymbolVertexShader() {\n if (!this.hasSymbol_) {\n return null;\n }\n\n return `${COMMON_HEADER}\n${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\\n')}\nattribute vec2 a_position;\nattribute float a_index;\nattribute vec4 a_hitColor;\n\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n\n${this.attributes_\n .map(\n (attribute) => `attribute ${attribute.type} ${attribute.name};\nvarying ${attribute.varyingType} ${attribute.varyingName};`,\n )\n .join('\\n')}\n${this.vertexShaderFunctions_.join('\\n')}\nvec2 pxToScreen(vec2 coordPx) {\n vec2 scaled = coordPx / u_viewportSizePx / 0.5;\n return scaled;\n}\n\nvec2 screenToPx(vec2 coordScreen) {\n return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n v_quadSizePx = ${this.symbolSizeExpression_};\n vec2 halfSizePx = v_quadSizePx * 0.5;\n vec2 centerOffsetPx = ${this.symbolOffsetExpression_};\n vec2 offsetPx = centerOffsetPx;\n if (a_index == 0.0) {\n offsetPx -= halfSizePx;\n } else if (a_index == 1.0) {\n offsetPx += halfSizePx * vec2(1., -1.);\n } else if (a_index == 2.0) {\n offsetPx += halfSizePx;\n } else {\n offsetPx += halfSizePx * vec2(-1., 1.);\n }\n float angle = ${this.symbolRotationExpression_}${this.symbolRotateWithView_ ? ' + u_rotation' : ''};\n float c = cos(-angle);\n float s = sin(-angle);\n offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);\n vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);\n vec4 texCoord = ${this.texCoordExpression_};\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n v_hitColor = a_hitColor;\n v_angle = angle;\n c = cos(-v_angle);\n s = sin(-v_angle);\n centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);\n v_centerPx = screenToPx(center.xy) + centerOffsetPx;\n${this.attributes_\n .map(\n (attribute) =>\n ` ${attribute.varyingName} = ${attribute.varyingExpression};`,\n )\n .join('\\n')}\n}`;\n }\n\n /**\n * Generates a symbol fragment shader from the builder parameters\n * @return {string|null} The full shader as a string; null if no size or color specified\n */\n getSymbolFragmentShader() {\n if (!this.hasSymbol_) {\n return null;\n }\n\n return `${COMMON_HEADER}\n${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\\n')}\nvarying vec2 v_texCoord;\nvarying vec4 v_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.attributes_\n .map(\n (attribute) => `varying ${attribute.varyingType} ${attribute.varyingName};`,\n )\n .join('\\n')}\n${this.fragmentShaderFunctions_.join('\\n')}\n\nvoid main(void) {\n${this.attributes_\n .map(\n (attribute) =>\n ` ${attribute.varyingType} ${attribute.name} = ${attribute.varyingName}; // assign to original attribute name`,\n )\n .join('\\n')}\n if (${this.discardExpression_}) { discard; }\n vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center\n float c = cos(v_angle);\n float s = sin(v_angle);\n coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);\n gl_FragColor = ${this.symbolColorExpression_};\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.05) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`;\n }\n\n /**\n * Generates a stroke vertex shader from the builder parameters\n * @return {string|null} The full shader as a string; null if no size or color specified\n */\n getStrokeVertexShader() {\n if (!this.hasStroke_) {\n return null;\n }\n\n return `${COMMON_HEADER}\n${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\\n')}\nattribute vec2 a_segmentStart;\nattribute vec2 a_segmentEnd;\nattribute float a_measureStart;\nattribute float a_measureEnd;\nattribute float a_parameters;\nattribute float a_distance;\nattribute vec2 a_joinAngles;\nattribute vec4 a_hitColor;\n\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distanceOffsetPx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n\n${this.attributes_\n .map(\n (attribute) => `attribute ${attribute.type} ${attribute.name};\nvarying ${attribute.varyingType} ${attribute.varyingName};`,\n )\n .join('\\n')}\n${this.vertexShaderFunctions_.join('\\n')}\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvec4 pxToScreen(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return vec4(screenPos, u_depth, 1.0);\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nvec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {\n float halfAngle = joinAngle / 2.0;\n float c = cos(halfAngle);\n float s = sin(halfAngle);\n vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);\n float length = 1.0 / s;\n return angleBisectorNormal * length;\n}\n\nvec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {\n // if on a cap or the join angle is too high, offset the line along the segment normal\n if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {\n return point - normal * offsetPx;\n }\n // offset is applied along the inverted normal (positive offset goes \"right\" relative to line direction)\n return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;\n}\n\nvoid main(void) {\n v_angleStart = a_joinAngles.x;\n v_angleEnd = a_joinAngles.y;\n float vertexNumber = floor(abs(a_parameters) / 10000. + 0.5);\n currentLineMetric = vertexNumber < 1.5 ? a_measureStart : a_measureEnd;\n // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)\n float angleTangentSum = fract(abs(a_parameters) / 10000.) * 10000. * sign(a_parameters);\n\n float lineWidth = ${this.strokeWidthExpression_};\n float lineOffsetPx = ${this.strokeOffsetExpression_};\n\n // compute segment start/end in px with offset\n vec2 segmentStartPx = worldToPx(a_segmentStart);\n vec2 segmentEndPx = worldToPx(a_segmentEnd);\n vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),\n segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);\n\n // compute current vertex position\n float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;\n float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;\n float angle = vertexNumber < 1.5 ? v_angleStart : v_angleEnd;\n vec2 joinDirection;\n vec2 positionPx = vertexNumber < 1.5 ? segmentStartPx : segmentEndPx;\n // if angle is too high, do not make a proper join\n if (cos(angle) > ${LINESTRING_ANGLE_COSINE_CUTOFF} || isCap(angle)) {\n joinDirection = normalPx * normalDir - tangentPx * tangentDir;\n } else {\n joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);\n }\n positionPx = positionPx + joinDirection * (lineWidth * 0.5 + 1.); // adding 1 pixel for antialiasing\n gl_Position = pxToScreen(positionPx);\n\n v_segmentStart = segmentStartPx;\n v_segmentEnd = segmentEndPx;\n v_width = lineWidth;\n v_hitColor = a_hitColor;\n v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx * angleTangentSum);\n v_measureStart = a_measureStart;\n v_measureEnd = a_measureEnd;\n${this.attributes_\n .map(\n (attribute) =>\n ` ${attribute.varyingName} = ${attribute.varyingExpression};`,\n )\n .join('\\n')}\n}`;\n }\n\n /**\n * Generates a stroke fragment shader from the builder parameters\n *\n * @return {string|null} The full shader as a string; null if no size or color specified\n */\n getStrokeFragmentShader() {\n if (!this.hasStroke_) {\n return null;\n }\n\n return `${COMMON_HEADER}\n${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\\n')}\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_hitColor;\nvarying float v_distanceOffsetPx;\nvarying float v_measureStart;\nvarying float v_measureEnd;\n${this.attributes_\n .map(\n (attribute) => `varying ${attribute.varyingType} ${attribute.varyingName};`,\n )\n .join('\\n')}\n${this.fragmentShaderFunctions_.join('\\n')}\n\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nfloat segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n vec2 tangent = normalize(end - start);\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 startToPoint = point - start;\n return abs(dot(startToPoint, normal)) - width * 0.5;\n}\n\nfloat buttCapDistanceField(vec2 point, vec2 start, vec2 end) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n return dot(startToPoint, -tangent);\n}\n\nfloat squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return buttCapDistanceField(point, start, end) - width * 0.5;\n}\n\nfloat roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment\n return length(point - start) - width * 0.5 - onSegment;\n}\n\nfloat roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n float c = cos(joinAngle * 0.5);\n float s = sin(joinAngle * 0.5);\n float direction = -sign(sin(joinAngle));\n vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);\n float radius = width * 0.5 * s;\n return dot(startToPoint, bisector * direction) - radius;\n}\n\nfloat miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n if (cos(joinAngle) > ${LINESTRING_ANGLE_COSINE_CUTOFF}) { // avoid risking a division by zero\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n float miterLength = 1. / sin(joinAngle * 0.5);\n float miterLimit = ${this.strokeMiterLimitExpression_};\n if (miterLength > miterLimit) {\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n return -1000.;\n}\n\nfloat capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {\n if (capType == ${stringToGlsl('butt')}) {\n return buttCapDistanceField(point, start, end);\n } else if (capType == ${stringToGlsl('square')}) {\n return squareCapDistanceField(point, start, end, width);\n }\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {\n if (joinType == ${stringToGlsl('bevel')}) {\n return bevelJoinField(point, start, end, width, joinAngle);\n } else if (joinType == ${stringToGlsl('miter')}) {\n return miterJoinDistanceField(point, start, end, width, joinAngle);\n }\n return roundJoinDistanceField(point, start, end, width);\n}\n\nfloat computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {\n if (isCap(joinAngle)) {\n return capDistanceField(point, start, end, width, capType);\n }\n return joinDistanceField(point, start, end, width, joinAngle, joinType);\n}\n\nfloat distanceFromSegment(vec2 point, vec2 start, vec2 end) {\n vec2 tangent = end - start;\n vec2 startToPoint = point - start;\n // inspire by capsule fn in https://iquilezles.org/articles/distfunctions/\n float h = clamp(dot(startToPoint, tangent) / dot(tangent, tangent), 0.0, 1.0);\n return length(startToPoint - tangent * h);\n}\n\nvoid main(void) {\n${this.attributes_\n .map(\n (attribute) =>\n ` ${attribute.varyingType} ${attribute.name} = ${attribute.varyingName}; // assign to original attribute name`,\n )\n .join('\\n')}\n\n vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(currentPoint);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n\n float segmentLength = length(v_segmentEnd - v_segmentStart);\n vec2 segmentTangent = (v_segmentEnd - v_segmentStart) / segmentLength;\n vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);\n vec2 startToPoint = currentPoint - v_segmentStart;\n float lengthToPoint = max(0., min(dot(segmentTangent, startToPoint), segmentLength));\n float currentLengthPx = lengthToPoint + v_distanceOffsetPx;\n float currentRadiusPx = distanceFromSegment(currentPoint, v_segmentStart, v_segmentEnd);\n float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;\n currentLineMetric = mix(\n v_measureStart,\n v_measureEnd,\n lengthToPoint / max(segmentLength, 1.17549429e-38)\n );\n\n if (${this.discardExpression_}) { discard; }\n\n float capType = ${this.strokeCapExpression_};\n float joinType = ${this.strokeJoinExpression_};\n float segmentStartDistance = computeSegmentPointDistance(currentPoint, v_segmentStart, v_segmentEnd, v_width, v_angleStart, capType, joinType);\n float segmentEndDistance = computeSegmentPointDistance(currentPoint, v_segmentEnd, v_segmentStart, v_width, v_angleEnd, capType, joinType);\n float distanceField = max(\n segmentDistanceField(currentPoint, v_segmentStart, v_segmentEnd, v_width),\n max(segmentStartDistance, segmentEndDistance)\n );\n distanceField = max(distanceField, ${this.strokeDistanceFieldExpression_});\n\n vec4 color = ${this.strokeColorExpression_};\n color.a *= smoothstep(0.5, -0.5, distanceField);\n gl_FragColor = color;\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`;\n }\n\n /**\n * Generates a fill vertex shader from the builder parameters\n *\n * @return {string|null} The full shader as a string; null if no color specified\n */\n getFillVertexShader() {\n if (!this.hasFill_) {\n return null;\n }\n\n return `${COMMON_HEADER}\n${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\\n')}\nattribute vec2 a_position;\nattribute vec4 a_hitColor;\n\nvarying vec4 v_hitColor;\n\n${this.attributes_\n .map(\n (attribute) => `attribute ${attribute.type} ${attribute.name};\nvarying ${attribute.varyingType} ${attribute.varyingName};`,\n )\n .join('\\n')}\n${this.vertexShaderFunctions_.join('\\n')}\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);\n v_hitColor = a_hitColor;\n${this.attributes_\n .map(\n (attribute) =>\n ` ${attribute.varyingName} = ${attribute.varyingExpression};`,\n )\n .join('\\n')}\n}`;\n }\n\n /**\n * Generates a fill fragment shader from the builder parameters\n * @return {string|null} The full shader as a string; null if no color specified\n */\n getFillFragmentShader() {\n if (!this.hasFill_) {\n return null;\n }\n\n return `${COMMON_HEADER}\n${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\\n')}\nvarying vec4 v_hitColor;\n${this.attributes_\n .map(\n (attribute) => `varying ${attribute.varyingType} ${attribute.varyingName};`,\n )\n .join('\\n')}\n${this.fragmentShaderFunctions_.join('\\n')}\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n${this.attributes_\n .map(\n (attribute) =>\n ` ${attribute.varyingType} ${attribute.name} = ${attribute.varyingName}; // assign to original attribute name`,\n )\n .join('\\n')}\n vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;\n vec2 pxOrigin = worldToPx(u_patternOrigin);\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(pxPos);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n gl_FragColor = ${this.fillColorExpression_};\n gl_FragColor.a *= u_globalAlpha;\n gl_FragColor.rgb *= gl_FragColor.a;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_hitColor;\n }\n}`;\n }\n}\n","/**\n * Utilities for compiling expressions and turning them into WebGL concepts\n * @module ol/render/webgl/compileUtil\n */\n\nimport {asArray} from '../../color.js';\nimport {\n ColorType,\n NumberArrayType,\n SizeType,\n newParsingContext,\n} from '../../expr/expression.js';\nimport {\n buildExpression,\n getStringNumberEquivalent,\n uniformNameForVariable,\n} from '../../expr/gpu.js';\n\n/**\n * Recursively parses a style expression and outputs a GLSL-compatible string. Takes in a compilation context that\n * will be read and modified during the parsing operation.\n * @param {import(\"../../expr/gpu.js\").CompilationContext} compilationContext Compilation context\n * @param {import(\"../../expr/expression.js\").EncodedExpression} value Value\n * @param {number} [expectedType] Expected final type (can be several types combined)\n * @return {string} GLSL-compatible output\n */\nexport function expressionToGlsl(compilationContext, value, expectedType) {\n const parsingContext = newParsingContext();\n return buildExpression(\n value,\n expectedType,\n parsingContext,\n compilationContext,\n );\n}\n\n/**\n * Packs all components of a color into a two-floats array\n * @param {import(\"../../color.js\").Color|string} color Color as array of numbers or string\n * @return {Array<number>} Vec2 array containing the color in compressed form\n */\nexport function packColor(color) {\n const array = asArray(color);\n const r = array[0] * 256;\n const g = array[1];\n const b = array[2] * 256;\n const a = Math.round(array[3] * 255);\n return [r + g, b + a];\n}\n\nexport const UNPACK_COLOR_FN = `vec4 unpackColor(vec2 packedColor) {\n return vec4(\n fract(floor(packedColor[0] / 256.0) / 256.0),\n fract(packedColor[0] / 256.0),\n fract(floor(packedColor[1] / 256.0) / 256.0),\n fract(packedColor[1] / 256.0)\n );\n}`;\n\n/**\n * @param {number} type Value type\n * @return {1|2|3|4} The amount of components for this value\n */\nexport function getGlslSizeFromType(type) {\n if (type === ColorType || type === SizeType) {\n return 2;\n }\n if (type === NumberArrayType) {\n return 4;\n }\n return 1;\n}\n\n/**\n * @param {number} type Value type\n * @return {'float'|'vec2'|'vec3'|'vec4'} The corresponding GLSL type for this value\n */\nexport function getGlslTypeFromType(type) {\n const size = getGlslSizeFromType(type);\n if (size > 1) {\n return /** @type {'vec2'|'vec3'|'vec4'} */ (`vec${size}`);\n }\n return 'float';\n}\n\n/**\n * Applies the properties and variables collected in a compilation context to a ShaderBuilder instance:\n * properties will show up as attributes in shaders, and variables will show up as uniforms.\n * @param {import(\"./ShaderBuilder.js\").ShaderBuilder} builder Shader builder\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Compilation context\n */\nexport function applyContextToBuilder(builder, context) {\n // define one uniform per variable\n for (const varName in context.variables) {\n const variable = context.variables[varName];\n const uniformName = uniformNameForVariable(variable.name);\n let glslType = getGlslTypeFromType(variable.type);\n if (variable.type === ColorType) {\n // we're not packing colors when they're passed as uniforms\n glslType = 'vec4';\n }\n builder.addUniform(uniformName, glslType);\n }\n\n // for each feature attribute used in the fragment shader, define a varying that will be used to pass data\n // from the vertex to the fragment shader, as well as an attribute in the vertex shader (if not already present)\n for (const propName in context.properties) {\n const property = context.properties[propName];\n const glslType = getGlslTypeFromType(property.type);\n const attributeName = `a_prop_${property.name}`;\n if (property.type === ColorType) {\n builder.addAttribute(\n attributeName,\n glslType,\n `unpackColor(${attributeName})`,\n 'vec4',\n );\n builder.addVertexShaderFunction(UNPACK_COLOR_FN);\n } else {\n builder.addAttribute(attributeName, glslType);\n }\n }\n\n // add functions that were collected in the compilation contexts\n for (const functionName in context.functions) {\n builder.addVertexShaderFunction(context.functions[functionName]);\n builder.addFragmentShaderFunction(context.functions[functionName]);\n }\n}\n\n/**\n * Generates a set of uniforms from variables collected in a compilation context,\n * to be fed to a WebGLHelper instance\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Compilation context\n * @param {import('../../style/flat.js').StyleVariables} [variables] Style variables.\n * @return {Object<string,import(\"../../webgl/Helper\").UniformValue>} Uniforms\n */\nexport function generateUniformsFromContext(context, variables) {\n /** @type {Object<string,import(\"../../webgl/Helper\").UniformValue>} */\n const uniforms = {};\n\n // define one uniform per variable\n for (const varName in context.variables) {\n const variable = context.variables[varName];\n const uniformName = uniformNameForVariable(variable.name);\n\n uniforms[uniformName] = () => {\n const value = variables[variable.name];\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'boolean') {\n return value ? 1 : 0;\n }\n if (variable.type === ColorType) {\n const color = [...asArray(value || '#eee')];\n color[0] /= 255;\n color[1] /= 255;\n color[2] /= 255;\n color[3] ??= 1;\n return color;\n }\n if (typeof value === 'string') {\n return getStringNumberEquivalent(value);\n }\n return value;\n };\n }\n\n return uniforms;\n}\n\n/**\n * Generates a set of attributes from properties collected in a compilation context,\n * to be fed to a WebGLHelper instance\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Compilation context\n * @return {import('./VectorStyleRenderer.js').AttributeDefinitions} Attributes\n */\nexport function generateAttributesFromContext(context) {\n /**\n * @type {import('./VectorStyleRenderer.js').AttributeDefinitions}\n */\n const attributes = {};\n\n // Define attributes with their callback for each property used in the vertex shader\n for (const propName in context.properties) {\n const property = context.properties[propName];\n const callback = (feature) => {\n const value = feature.get(property.name);\n if (property.type === ColorType) {\n return packColor([...asArray(value || '#eee')]);\n }\n if (typeof value === 'string') {\n return getStringNumberEquivalent(value);\n }\n if (typeof value === 'boolean') {\n return value ? 1 : 0;\n }\n return value;\n };\n\n attributes[`prop_${property.name}`] = {\n size: getGlslSizeFromType(property.type),\n callback,\n };\n }\n return attributes;\n}\n","/**\n * Utilities for parsing flat styles for WebGL renderers\n * @module ol/render/webgl/style\n */\nimport {assert} from '../../asserts.js';\nimport {\n BooleanType,\n ColorType,\n NumberArrayType,\n NumberType,\n SizeType,\n StringType,\n computeGeometryType,\n} from '../../expr/expression.js';\nimport {\n FEATURE_ID_PROPERTY_NAME,\n GEOMETRY_TYPE_PROPERTY_NAME,\n getStringNumberEquivalent,\n newCompilationContext,\n stringToGlsl,\n} from '../../expr/gpu.js';\nimport {ShaderBuilder} from './ShaderBuilder.js';\nimport {\n applyContextToBuilder,\n expressionToGlsl,\n generateAttributesFromContext,\n generateUniformsFromContext,\n getGlslSizeFromType,\n getGlslTypeFromType,\n} from './compileUtil.js';\n\n/**\n * see https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript\n * @param {Object|string} input The hash input, either an object or string\n * @return {string} Hash (if the object cannot be serialized, it is based on `getUid`)\n */\nexport function computeHash(input) {\n const hash = JSON.stringify(input)\n .split('')\n .reduce((prev, curr) => (prev << 5) - prev + curr.charCodeAt(0), 0);\n return (hash >>> 0).toString();\n}\n\n/**\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {ShaderBuilder} builder Shader builder\n * @param {import(\"../../expr/gpu.js\").CompilationContext} vertContext Vertex shader compilation context\n * @param {'shape-'|'circle-'|'icon-'} prefix Properties prefix\n */\nfunction parseCommonSymbolProperties(style, builder, vertContext, prefix) {\n if (`${prefix}radius` in style && prefix !== 'icon-') {\n let radius = expressionToGlsl(\n vertContext,\n style[`${prefix}radius`],\n NumberType,\n );\n if (`${prefix}radius2` in style) {\n const radius2 = expressionToGlsl(\n vertContext,\n style[`${prefix}radius2`],\n NumberType,\n );\n radius = `max(${radius}, ${radius2})`;\n }\n if (`${prefix}stroke-width` in style) {\n radius = `(${radius} + ${expressionToGlsl(\n vertContext,\n style[`${prefix}stroke-width`],\n NumberType,\n )} * 0.5)`;\n }\n builder.setSymbolSizeExpression(`vec2(${radius} * 2. + 0.5)`); // adding some padding for antialiasing\n }\n if (`${prefix}scale` in style) {\n const scale = expressionToGlsl(\n vertContext,\n style[`${prefix}scale`],\n SizeType,\n );\n builder.setSymbolSizeExpression(\n `${builder.getSymbolSizeExpression()} * ${scale}`,\n );\n }\n if (`${prefix}displacement` in style) {\n builder.setSymbolOffsetExpression(\n expressionToGlsl(\n vertContext,\n style[`${prefix}displacement`],\n NumberArrayType,\n ),\n );\n }\n if (`${prefix}rotation` in style) {\n builder.setSymbolRotationExpression(\n expressionToGlsl(vertContext, style[`${prefix}rotation`], NumberType),\n );\n }\n if (`${prefix}rotate-with-view` in style) {\n builder.setSymbolRotateWithView(!!style[`${prefix}rotate-with-view`]);\n }\n}\n\n/**\n * @param {string} distanceField The distance field expression\n * @param {string|null} fillColor The fill color expression; null if no fill\n * @param {string|null} strokeColor The stroke color expression; null if no stroke\n * @param {string|null} strokeWidth The stroke width expression; null if no stroke\n * @param {string|null} opacity The opacity expression; null if no stroke\n * @return {string} The final color expression, based on the distance field and given params\n */\nfunction getColorFromDistanceField(\n distanceField,\n fillColor,\n strokeColor,\n strokeWidth,\n opacity,\n) {\n let color = 'vec4(0.)';\n if (fillColor !== null) {\n color = fillColor;\n }\n if (strokeColor !== null && strokeWidth !== null) {\n const strokeFillRatio = `smoothstep(-${strokeWidth} + 0.63, -${strokeWidth} - 0.58, ${distanceField})`;\n color = `mix(${strokeColor}, ${color}, ${strokeFillRatio})`;\n }\n const shapeOpacity = `(1.0 - smoothstep(-0.63, 0.58, ${distanceField}))`;\n let result = `${color} * vec4(1.0, 1.0, 1.0, ${shapeOpacity})`;\n if (opacity !== null) {\n result = `${result} * vec4(1.0, 1.0, 1.0, ${opacity})`;\n }\n return result;\n}\n\n/**\n * This will parse an image property provided by `<prefix>-src`\n * The image size expression in GLSL will be returned\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {ShaderBuilder} builder Shader builder\n * @param {Object<string,import(\"../../webgl/Helper\").UniformValue>} uniforms Uniforms\n * @param {'icon-'|'fill-pattern-'|'stroke-pattern-'} prefix Property prefix\n * @param {string} textureId A identifier that will be used in the generated uniforms: `sample2d u_texture<id>` and `vec2 u_texture<id>_size`\n * @return {string} The image size expression\n */\nfunction parseImageProperties(style, builder, uniforms, prefix, textureId) {\n const image = new Image();\n image.crossOrigin =\n style[`${prefix}cross-origin`] === undefined\n ? 'anonymous'\n : style[`${prefix}cross-origin`];\n assert(\n typeof style[`${prefix}src`] === 'string',\n `WebGL layers do not support expressions for the ${prefix}src style property`,\n );\n image.src = /** @type {string} */ (style[`${prefix}src`]);\n\n // the size is provided asynchronously using a uniform\n uniforms[`u_texture${textureId}_size`] = () => {\n return image.complete ? [image.width, image.height] : [0, 0];\n };\n builder.addUniform(`u_texture${textureId}_size`, 'vec2');\n const size = `u_texture${textureId}_size`;\n\n uniforms[`u_texture${textureId}`] = image;\n builder.addUniform(`u_texture${textureId}`, 'sampler2D');\n return size;\n}\n\n/**\n * This will parse an image's offset properties provided by `<prefix>-offset`, `<prefix>-offset-origin` and `<prefix>-size`\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {'icon-'|'fill-pattern-'|'stroke-pattern-'} prefix Property prefix\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Shader compilation context (vertex or fragment)\n * @param {string} imageSize Pixel size of the full image as a GLSL expression\n * @param {string} sampleSize Pixel size of the sample in the image as a GLSL expression\n * @return {string} The offset expression\n */\nfunction parseImageOffsetProperties(\n style,\n prefix,\n context,\n imageSize,\n sampleSize,\n) {\n let offsetExpression = expressionToGlsl(\n context,\n style[`${prefix}offset`],\n SizeType,\n );\n if (`${prefix}offset-origin` in style) {\n switch (style[`${prefix}offset-origin`]) {\n case 'top-right':\n offsetExpression = `vec2(${imageSize}.x, 0.) + ${sampleSize} * vec2(-1., 0.) + ${offsetExpression} * vec2(-1., 1.)`;\n break;\n case 'bottom-left':\n offsetExpression = `vec2(0., ${imageSize}.y) + ${sampleSize} * vec2(0., -1.) + ${offsetExpression} * vec2(1., -1.)`;\n break;\n case 'bottom-right':\n offsetExpression = `${imageSize} - ${sampleSize} - ${offsetExpression}`;\n break;\n default: // pass\n }\n }\n return offsetExpression;\n}\n\n/**\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {ShaderBuilder} builder Shader builder\n * @param {Object<string,import(\"../../webgl/Helper\").UniformValue>} uniforms Uniforms\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Shader compilation context\n */\nfunction parseCircleProperties(style, builder, uniforms, context) {\n // this function takes in screen coordinates in pixels and returns the signed distance field\n // (0 on the boundary, negative inside the circle, positive outside, values in pixels)\n context.functions['circleDistanceField'] =\n `float circleDistanceField(vec2 point, float radius) {\n return length(point) - radius;\n}`;\n\n parseCommonSymbolProperties(style, builder, context, 'circle-');\n\n // OPACITY\n let opacity = null;\n if ('circle-opacity' in style) {\n opacity = expressionToGlsl(context, style['circle-opacity'], NumberType);\n }\n\n // SCALE\n let currentPoint = 'coordsPx';\n if ('circle-scale' in style) {\n const scale = expressionToGlsl(context, style['circle-scale'], SizeType);\n currentPoint = `coordsPx / ${scale}`;\n }\n\n // FILL COLOR\n let fillColor = null;\n if ('circle-fill-color' in style) {\n fillColor = expressionToGlsl(\n context,\n style['circle-fill-color'],\n ColorType,\n );\n }\n\n // STROKE COLOR\n let strokeColor = null;\n if ('circle-stroke-color' in style) {\n strokeColor = expressionToGlsl(\n context,\n style['circle-stroke-color'],\n ColorType,\n );\n }\n\n // RADIUS\n let radius = expressionToGlsl(context, style['circle-radius'], NumberType);\n\n // STROKE WIDTH\n let strokeWidth = null;\n if ('circle-stroke-width' in style) {\n strokeWidth = expressionToGlsl(\n context,\n style['circle-stroke-width'],\n NumberType,\n );\n radius = `(${radius} + ${strokeWidth} * 0.5)`;\n }\n\n // FINAL COLOR\n const distanceField = `circleDistanceField(${currentPoint}, ${radius})`;\n const colorExpression = getColorFromDistanceField(\n distanceField,\n fillColor,\n strokeColor,\n strokeWidth,\n opacity,\n );\n builder.setSymbolColorExpression(colorExpression);\n}\n\n/**\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {ShaderBuilder} builder Shader builder\n * @param {Object<string,import(\"../../webgl/Helper\").UniformValue>} uniforms Uniforms\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Shader compilation context\n */\nfunction parseShapeProperties(style, builder, uniforms, context) {\n context.functions['round'] = `float round(float v) {\n return sign(v) * floor(abs(v) + 0.5);\n}`;\n\n // these functions take in screen coordinates in pixels and returns the signed distance field\n // (0 on the boundary, negative inside the polygon, positive outside, values in pixels)\n // inspired by https://github.com/zranger1/PixelblazePatterns/blob/master/Toolkit/sdf2d.md#n-sided-regular-polygon\n context.functions['starDistanceField'] =\n `float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round(beta / alpha) * alpha; // angle in sector\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n vec2 tipToPoint = inSector + vec2(-radius, 0.);\n vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);\n return dot(normalize(edgeNormal), tipToPoint);\n}`;\n context.functions['regularDistanceField'] =\n `float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float radiusIn = radius * cos(PI / numPoints);\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n return inSector.x - radiusIn;\n}`;\n\n parseCommonSymbolProperties(style, builder, context, 'shape-');\n\n // OPACITY\n let opacity = null;\n if ('shape-opacity' in style) {\n opacity = expressionToGlsl(context, style['shape-opacity'], NumberType);\n }\n\n // SCALE\n let currentPoint = 'coordsPx';\n if ('shape-scale' in style) {\n const scale = expressionToGlsl(context, style['shape-scale'], SizeType);\n currentPoint = `coordsPx / ${scale}`;\n }\n\n // FILL COLOR\n let fillColor = null;\n if ('shape-fill-color' in style) {\n fillColor = expressionToGlsl(context, style['shape-fill-color'], ColorType);\n }\n\n // STROKE COLOR\n let strokeColor = null;\n if ('shape-stroke-color' in style) {\n strokeColor = expressionToGlsl(\n context,\n style['shape-stroke-color'],\n ColorType,\n );\n }\n\n // STROKE WIDTH\n let strokeWidth = null;\n if ('shape-stroke-width' in style) {\n strokeWidth = expressionToGlsl(\n context,\n style['shape-stroke-width'],\n NumberType,\n );\n }\n\n // SHAPE TYPE\n const numPoints = expressionToGlsl(\n context,\n style['shape-points'],\n NumberType,\n );\n let angle = '0.';\n if ('shape-angle' in style) {\n angle = expressionToGlsl(context, style['shape-angle'], NumberType);\n }\n let shapeField;\n let radius = expressionToGlsl(context, style['shape-radius'], NumberType);\n if (strokeWidth !== null) {\n radius = `${radius} + ${strokeWidth} * 0.5`;\n }\n if ('shape-radius2' in style) {\n let radius2 = expressionToGlsl(context, style['shape-radius2'], NumberType);\n if (strokeWidth !== null) {\n radius2 = `${radius2} + ${strokeWidth} * 0.5`;\n }\n shapeField = `starDistanceField(${currentPoint}, ${numPoints}, ${radius}, ${radius2}, ${angle})`;\n } else {\n shapeField = `regularDistanceField(${currentPoint}, ${numPoints}, ${radius}, ${angle})`;\n }\n\n // FINAL COLOR\n const colorExpression = getColorFromDistanceField(\n shapeField,\n fillColor,\n strokeColor,\n strokeWidth,\n opacity,\n );\n builder.setSymbolColorExpression(colorExpression);\n}\n\n/**\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {ShaderBuilder} builder Shader builder\n * @param {Object<string,import(\"../../webgl/Helper\").UniformValue>} uniforms Uniforms\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Shader compilation context\n */\nfunction parseIconProperties(style, builder, uniforms, context) {\n // COLOR\n let color = 'vec4(1.0)';\n if ('icon-color' in style) {\n color = expressionToGlsl(context, style['icon-color'], ColorType);\n }\n\n // OPACITY\n if ('icon-opacity' in style) {\n color = `${color} * vec4(1.0, 1.0, 1.0, ${expressionToGlsl(\n context,\n style['icon-opacity'],\n NumberType,\n )})`;\n }\n\n // IMAGE & SIZE\n const textureId = computeHash(style['icon-src']);\n const sizeExpression = parseImageProperties(\n style,\n builder,\n uniforms,\n 'icon-',\n textureId,\n );\n builder\n .setSymbolColorExpression(\n `${color} * texture2D(u_texture${textureId}, v_texCoord)`,\n )\n .setSymbolSizeExpression(sizeExpression);\n\n // override size if width/height were specified\n if ('icon-width' in style && 'icon-height' in style) {\n builder.setSymbolSizeExpression(\n `vec2(${expressionToGlsl(\n context,\n style['icon-width'],\n NumberType,\n )}, ${expressionToGlsl(context, style['icon-height'], NumberType)})`,\n );\n }\n\n // tex coord\n if ('icon-offset' in style && 'icon-size' in style) {\n const sampleSize = expressionToGlsl(\n context,\n style['icon-size'],\n NumberArrayType,\n );\n const fullsize = builder.getSymbolSizeExpression();\n builder.setSymbolSizeExpression(sampleSize);\n const offset = parseImageOffsetProperties(\n style,\n 'icon-',\n context,\n 'v_quadSizePx',\n sampleSize,\n );\n builder.setTextureCoordinateExpression(\n `(vec4((${offset}).xyxy) + vec4(0., 0., ${sampleSize})) / (${fullsize}).xyxy`,\n );\n }\n\n parseCommonSymbolProperties(style, builder, context, 'icon-');\n\n if ('icon-anchor' in style) {\n const anchor = expressionToGlsl(\n context,\n style['icon-anchor'],\n NumberArrayType,\n );\n let scale = `1.0`;\n if (`icon-scale` in style) {\n scale = expressionToGlsl(context, style[`icon-scale`], SizeType);\n }\n let shiftPx;\n if (\n style['icon-anchor-x-units'] === 'pixels' &&\n style['icon-anchor-y-units'] === 'pixels'\n ) {\n shiftPx = `${anchor} * ${scale}`;\n } else if (style['icon-anchor-x-units'] === 'pixels') {\n shiftPx = `${anchor} * vec2(vec2(${scale}).x, v_quadSizePx.y)`;\n } else if (style['icon-anchor-y-units'] === 'pixels') {\n shiftPx = `${anchor} * vec2(v_quadSizePx.x, vec2(${scale}).x)`;\n } else {\n shiftPx = `${anchor} * v_quadSizePx`;\n }\n // default origin is top-left\n let offsetPx = `v_quadSizePx * vec2(0.5, -0.5) + ${shiftPx} * vec2(-1., 1.)`;\n if ('icon-anchor-origin' in style) {\n switch (style['icon-anchor-origin']) {\n case 'top-right':\n offsetPx = `v_quadSizePx * -0.5 + ${shiftPx}`;\n break;\n case 'bottom-left':\n offsetPx = `v_quadSizePx * 0.5 - ${shiftPx}`;\n break;\n case 'bottom-right':\n offsetPx = `v_quadSizePx * vec2(-0.5, 0.5) + ${shiftPx} * vec2(1., -1.)`;\n break;\n default: // pass\n }\n }\n builder.setSymbolOffsetExpression(\n `${builder.getSymbolOffsetExpression()} + ${offsetPx}`,\n );\n }\n}\n\n/**\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {ShaderBuilder} builder Shader Builder\n * @param {Object<string,import(\"../../webgl/Helper\").UniformValue>} uniforms Uniforms\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Shader compilation context\n */\nfunction parseStrokeProperties(style, builder, uniforms, context) {\n if ('stroke-color' in style) {\n builder.setStrokeColorExpression(\n expressionToGlsl(context, style['stroke-color'], ColorType),\n );\n }\n if ('stroke-pattern-src' in style) {\n const textureId = computeHash(style['stroke-pattern-src']);\n const sizeExpression = parseImageProperties(\n style,\n builder,\n uniforms,\n 'stroke-pattern-',\n textureId,\n );\n let sampleSizeExpression = sizeExpression;\n let offsetExpression = 'vec2(0.)';\n if ('stroke-pattern-offset' in style && 'stroke-pattern-size' in style) {\n sampleSizeExpression = expressionToGlsl(\n context,\n style[`stroke-pattern-size`],\n NumberArrayType,\n );\n offsetExpression = parseImageOffsetProperties(\n style,\n 'stroke-pattern-',\n context,\n sizeExpression,\n sampleSizeExpression,\n );\n }\n let spacingExpression = '0.';\n if ('stroke-pattern-spacing' in style) {\n spacingExpression = expressionToGlsl(\n context,\n style['stroke-pattern-spacing'],\n NumberType,\n );\n }\n context.functions['sampleStrokePattern'] =\n `vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {\n float currentLengthScaled = currentLengthPx * sampleSize.y / lineWidth;\n float spacingScaled = spacingPx * sampleSize.y / lineWidth;\n float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));\n // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);\n float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;\n vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;\n return texture2D(texture, texCoord);\n}`;\n const textureName = `u_texture${textureId}`;\n let tintExpression = '1.';\n if ('stroke-color' in style) {\n tintExpression = builder.getStrokeColorExpression();\n }\n builder.setStrokeColorExpression(\n `${tintExpression} * sampleStrokePattern(${textureName}, ${sizeExpression}, ${offsetExpression}, ${sampleSizeExpression}, ${spacingExpression}, currentLengthPx, currentRadiusRatio, v_width)`,\n );\n }\n\n if ('stroke-width' in style) {\n builder.setStrokeWidthExpression(\n expressionToGlsl(context, style['stroke-width'], NumberType),\n );\n }\n\n if ('stroke-offset' in style) {\n builder.setStrokeOffsetExpression(\n expressionToGlsl(context, style['stroke-offset'], NumberType),\n );\n }\n\n if ('stroke-line-cap' in style) {\n builder.setStrokeCapExpression(\n expressionToGlsl(context, style['stroke-line-cap'], StringType),\n );\n }\n\n if ('stroke-line-join' in style) {\n builder.setStrokeJoinExpression(\n expressionToGlsl(context, style['stroke-line-join'], StringType),\n );\n }\n\n if ('stroke-miter-limit' in style) {\n builder.setStrokeMiterLimitExpression(\n expressionToGlsl(context, style['stroke-miter-limit'], NumberType),\n );\n }\n\n if ('stroke-line-dash' in style) {\n context.functions['getSingleDashDistance'] =\n `float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType, float lineWidth) {\n float localDistance = mod(distance, dashLengthTotal);\n float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;\n distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);\n if (capType == ${stringToGlsl('square')}) {\n distanceSegment -= lineWidth * 0.5;\n } else if (capType == ${stringToGlsl('round')}) {\n distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - lineWidth * 0.5);\n }\n return distanceSegment;\n}`;\n\n let dashPattern = style['stroke-line-dash'].map((v) =>\n expressionToGlsl(context, v, NumberType),\n );\n // if pattern has odd length, concatenate it with itself to be even\n if (dashPattern.length % 2 === 1) {\n dashPattern = [...dashPattern, ...dashPattern];\n }\n\n let offsetExpression = '0.';\n if ('stroke-line-dash-offset' in style) {\n offsetExpression = expressionToGlsl(\n context,\n style['stroke-line-dash-offset'],\n NumberType,\n );\n }\n\n // define a function for this dash specifically\n const uniqueDashKey = computeHash(style['stroke-line-dash']);\n const dashFunctionName = `dashDistanceField_${uniqueDashKey}`;\n\n const dashLengthsParamsDef = dashPattern\n .map((v, i) => `float dashLength${i}`)\n .join(', ');\n const totalLengthDef = dashPattern\n .map((v, i) => `dashLength${i}`)\n .join(' + ');\n let currentDashOffset = '0.';\n let distanceExpression = `getSingleDashDistance(distance, radius, ${currentDashOffset}, dashLength0, totalDashLength, capType, lineWidth)`;\n for (let i = 2; i < dashPattern.length; i += 2) {\n currentDashOffset = `${currentDashOffset} + dashLength${\n i - 2\n } + dashLength${i - 1}`;\n distanceExpression = `min(${distanceExpression}, getSingleDashDistance(distance, radius, ${currentDashOffset}, dashLength${i}, totalDashLength, capType, lineWidth))`;\n }\n\n context.functions[dashFunctionName] =\n `float ${dashFunctionName}(float distance, float radius, float capType, float lineWidth, ${dashLengthsParamsDef}) {\n float totalDashLength = ${totalLengthDef};\n return ${distanceExpression};\n}`;\n const dashLengthsCalls = dashPattern.map((v, i) => `${v}`).join(', ');\n builder.setStrokeDistanceFieldExpression(\n `${dashFunctionName}(currentLengthPx + ${offsetExpression}, currentRadiusPx, capType, v_width, ${dashLengthsCalls})`,\n );\n }\n}\n\n/**\n * @param {import(\"../../style/flat.js\").FlatStyle} style Style\n * @param {ShaderBuilder} builder Shader Builder\n * @param {Object<string,import(\"../../webgl/Helper\").UniformValue>} uniforms Uniforms\n * @param {import(\"../../expr/gpu.js\").CompilationContext} context Shader compilation context\n */\nfunction parseFillProperties(style, builder, uniforms, context) {\n if ('fill-color' in style) {\n builder.setFillColorExpression(\n expressionToGlsl(context, style['fill-color'], ColorType),\n );\n }\n if ('fill-pattern-src' in style) {\n const textureId = computeHash(style['fill-pattern-src']);\n const sizeExpression = parseImageProperties(\n style,\n builder,\n uniforms,\n 'fill-pattern-',\n textureId,\n );\n let sampleSizeExpression = sizeExpression;\n let offsetExpression = 'vec2(0.)';\n if ('fill-pattern-offset' in style && 'fill-pattern-size' in style) {\n sampleSizeExpression = expressionToGlsl(\n context,\n style[`fill-pattern-size`],\n NumberArrayType,\n );\n offsetExpression = parseImageOffsetProperties(\n style,\n 'fill-pattern-',\n context,\n sizeExpression,\n sampleSizeExpression,\n );\n }\n context.functions['sampleFillPattern'] =\n `vec4 sampleFillPattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, vec2 pxOrigin, vec2 pxPosition) {\n float scaleRatio = pow(2., mod(u_zoom + 0.5, 1.) - 0.5);\n vec2 pxRelativePos = pxPosition - pxOrigin;\n // rotate the relative position from origin by the current view rotation\n pxRelativePos = vec2(pxRelativePos.x * cos(u_rotation) - pxRelativePos.y * sin(u_rotation), pxRelativePos.x * sin(u_rotation) + pxRelativePos.y * cos(u_rotation));\n // sample position is computed according to the sample offset & size\n vec2 samplePos = mod(pxRelativePos / scaleRatio, sampleSize);\n // also make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n samplePos = clamp(samplePos, vec2(0.5), sampleSize - vec2(0.5));\n samplePos.y = sampleSize.y - samplePos.y; // invert y axis so that images appear upright\n return texture2D(texture, (samplePos + textureOffset) / textureSize);\n}`;\n const textureName = `u_texture${textureId}`;\n let tintExpression = '1.';\n if ('fill-color' in style) {\n tintExpression = builder.getFillColorExpression();\n }\n builder.setFillColorExpression(\n `${tintExpression} * sampleFillPattern(${textureName}, ${sizeExpression}, ${offsetExpression}, ${sampleSizeExpression}, pxOrigin, pxPos)`,\n );\n }\n}\n\n/**\n * @typedef {Object} StyleParseResult\n * @property {ShaderBuilder} builder Shader builder pre-configured according to a given style\n * @property {import(\"./VectorStyleRenderer.js\").UniformDefinitions} uniforms Uniform definitions\n * @property {import(\"./VectorStyleRenderer.js\").AttributeDefinitions} attributes Attribute definitions\n */\n\n/**\n * Parses a {@link import(\"../../style/flat.js\").FlatStyle} object and returns a {@link ShaderBuilder}\n * object that has been configured according to the given style, as well as `attributes` and `uniforms`\n * arrays to be fed to the `WebGLPointsRenderer` class.\n *\n * Also returns `uniforms` and `attributes` properties as expected by the\n * {@link module:ol/renderer/webgl/PointsLayer~WebGLPointsLayerRenderer}.\n *\n * @param {import(\"../../style/flat.js\").FlatStyle} style Flat style.\n * @param {import('../../style/flat.js').StyleVariables} [variables] Style variables.\n * @param {import(\"../../expr/expression.js\").EncodedExpression} [filter] Filter (if any)\n * @return {StyleParseResult} Result containing shader params, attributes and uniforms.\n */\nexport function parseLiteralStyle(style, variables, filter) {\n const context = newCompilationContext();\n\n const builder = new ShaderBuilder();\n\n /** @type {Object<string,import(\"../../webgl/Helper\").UniformValue>} */\n const uniforms = {};\n\n if ('icon-src' in style) {\n parseIconProperties(style, builder, uniforms, context);\n } else if ('shape-points' in style) {\n parseShapeProperties(style, builder, uniforms, context);\n } else if ('circle-radius' in style) {\n parseCircleProperties(style, builder, uniforms, context);\n }\n parseStrokeProperties(style, builder, uniforms, context);\n parseFillProperties(style, builder, uniforms, context);\n\n // note that the style filter may have already been applied earlier when building the rendering instructions\n // this is still needed in case a filter cannot be evaluated statically beforehand (e.g. depending on time)\n if (filter) {\n const parsedFilter = expressionToGlsl(context, filter, BooleanType);\n builder.setFragmentDiscardExpression(`!${parsedFilter}`);\n }\n\n /**\n * @type {import('./VectorStyleRenderer.js').AttributeDefinitions}\n */\n const attributes = {};\n\n // Define attributes for special inputs\n function defineSpecialInput(contextPropName, glslPropName, type, callback) {\n if (!context[contextPropName]) {\n return;\n }\n const glslType = getGlslTypeFromType(type);\n const attrSize = getGlslSizeFromType(type);\n builder.addAttribute(`a_${glslPropName}`, glslType);\n\n attributes[glslPropName] = {\n size: attrSize,\n callback,\n };\n }\n defineSpecialInput(\n 'geometryType',\n GEOMETRY_TYPE_PROPERTY_NAME,\n StringType,\n (feature) =>\n getStringNumberEquivalent(computeGeometryType(feature.getGeometry())),\n );\n defineSpecialInput(\n 'featureId',\n FEATURE_ID_PROPERTY_NAME,\n StringType | NumberType,\n (feature) => {\n const id = feature.getId() ?? null;\n return typeof id === 'string' ? getStringNumberEquivalent(id) : id;\n },\n );\n\n applyContextToBuilder(builder, context);\n\n return {\n builder,\n attributes: {...attributes, ...generateAttributesFromContext(context)},\n uniforms: {\n ...uniforms,\n ...generateUniformsFromContext(context, variables),\n },\n };\n}\n\n/**\n * @typedef {import('./VectorStyleRenderer.js').AsShaders} StyleAsShaders\n */\n/**\n * @typedef {import('./VectorStyleRenderer.js').AsRule} StyleAsRule\n */\n\n/**\n * Takes in either a Flat Style or an array of shaders (used as input for the webgl vector layer classes)\n * and breaks it down into separate styles to be used by the VectorStyleRenderer class.\n * @param {import('../../style/flat.js').FlatStyleLike | Array<StyleAsShaders> | StyleAsShaders} style Flat style or shaders\n * @return {Array<StyleAsShaders | StyleAsRule>} Separate styles as shaders or rules with a single flat style and a filter\n */\nexport function breakDownFlatStyle(style) {\n // possible cases:\n // - single shader\n // - multiple shaders\n // - single style\n // - multiple styles\n // - multiple rules\n const asArray = Array.isArray(style) ? style : [style];\n\n // if array of rules: break rules into separate styles, compute \"else\" filters\n if ('style' in asArray[0]) {\n /** @type {Array<StyleAsRule>} */\n const styles = [];\n const rules = /** @type {Array<import('../../style/flat.js').Rule>} */ (\n asArray\n );\n const previousFilters = [];\n for (const rule of rules) {\n const ruleStyles = Array.isArray(rule.style) ? rule.style : [rule.style];\n /** @type {import(\"../../expr/expression.js\").EncodedExpression} */\n let currentFilter = rule.filter;\n if (rule.else && previousFilters.length) {\n currentFilter = [\n 'all',\n ...previousFilters.map((filter) => ['!', filter]),\n ];\n if (rule.filter) {\n currentFilter.push(rule.filter);\n }\n if (currentFilter.length < 3) {\n currentFilter = currentFilter[1];\n }\n }\n if (rule.filter) {\n previousFilters.push(rule.filter);\n }\n /** @type {Array<StyleAsRule>} */\n const stylesWithFilters = ruleStyles.map((style) => ({\n style,\n ...(currentFilter && {filter: currentFilter}),\n }));\n styles.push(...stylesWithFilters);\n }\n return styles;\n }\n\n // if array of shaders: return as is\n if ('builder' in asArray[0]) {\n return /** @type {Array<StyleAsShaders>} */ (asArray);\n }\n\n return asArray.map(\n (style) =>\n /** @type {StyleAsRule} */ ({\n style,\n }),\n );\n}\n","/**\n * @module ol/render/webgl/VectorStyleRenderer\n */\nimport {buildExpression, newEvaluationContext} from '../../expr/cpu.js';\nimport {\n BooleanType,\n computeGeometryType,\n newParsingContext,\n} from '../../expr/expression.js';\nimport {\n create as createTransform,\n makeInverse as makeInverseTransform,\n} from '../../transform.js';\nimport WebGLArrayBuffer from '../../webgl/Buffer.js';\nimport {AttributeType} from '../../webgl/Helper.js';\nimport {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';\nimport {create as createWebGLWorker} from '../../worker/webgl.js';\nimport {WebGLWorkerMessageType} from './constants.js';\nimport {colorEncodeId} from './encodeUtil.js';\nimport {\n generateLineStringRenderInstructions,\n generatePointRenderInstructions,\n generatePolygonRenderInstructions,\n getCustomAttributesSize,\n} from './renderinstructions.js';\nimport {parseLiteralStyle} from './style.js';\n\nconst tmpColor = [];\n/** @type {Worker|undefined} */\nlet WEBGL_WORKER;\nfunction getWebGLWorker() {\n if (!WEBGL_WORKER) {\n WEBGL_WORKER = createWebGLWorker();\n }\n return WEBGL_WORKER;\n}\nlet workerMessageCounter = 0;\n\n/**\n * Names of attributes made available to the vertex shader.\n * Please note: changing these *will* break custom shaders!\n * @enum {string}\n */\nexport const Attributes = {\n POSITION: 'a_position',\n INDEX: 'a_index',\n SEGMENT_START: 'a_segmentStart',\n SEGMENT_END: 'a_segmentEnd',\n MEASURE_START: 'a_measureStart',\n MEASURE_END: 'a_measureEnd',\n PARAMETERS: 'a_parameters',\n JOIN_ANGLES: 'a_joinAngles',\n DISTANCE: 'a_distance',\n};\n\n/**\n * @typedef {Object} AttributeDefinition A description of a custom attribute to be passed on to the GPU, with a value different\n * for each feature.\n * @property {number} [size] Amount of numerical values composing the attribute, either 1, 2, 3 or 4; in case size is > 1, the return value\n * of the callback should be an array; if unspecified, assumed to be a single float value\n * @property {function(this:import(\"./MixedGeometryBatch.js\").GeometryBatchItem, import(\"../../Feature\").FeatureLike):number|Array<number>} callback This callback computes the numerical value of the\n * attribute for a given feature.\n */\n\n/**\n * @typedef {Object<string, AttributeDefinition>} AttributeDefinitions\n * @typedef {Object<string, import(\"../../webgl/Helper\").UniformValue>} UniformDefinitions\n */\n\n/**\n * @typedef {Object} WebGLBuffers\n * @property {Array<WebGLArrayBuffer>} polygonBuffers Array containing indices and vertices buffers for polygons\n * @property {Array<WebGLArrayBuffer>} lineStringBuffers Array containing indices and vertices buffers for line strings\n * @property {Array<WebGLArrayBuffer>} pointBuffers Array containing indices and vertices buffers for points\n * @property {import(\"../../transform.js\").Transform} invertVerticesTransform Inverse of the transform applied when generating buffers\n */\n\n/**\n * @typedef {Object} RenderInstructions\n * @property {Float32Array|null} polygonInstructions Polygon instructions; null if nothing to render\n * @property {Float32Array|null} lineStringInstructions LineString instructions; null if nothing to render\n * @property {Float32Array|null} pointInstructions Point instructions; null if nothing to render\n */\n\n/**\n * @typedef {Object} ShaderProgram An object containing both shaders (vertex and fragment)\n * @property {string} vertex Vertex shader source\n * @property {string} fragment Fragment shader source\n */\n\n/**\n * @typedef {Object} AsShaders\n * @property {import(\"./ShaderBuilder.js\").ShaderBuilder} builder Shader builder with the appropriate presets.\n * @property {AttributeDefinitions} [attributes] Custom attributes made available in the vertex shaders.\n * Default shaders rely on the attributes in {@link Attributes}.\n * @property {UniformDefinitions} [uniforms] Additional uniforms usable in shaders.\n */\n\n/**\n * @typedef {Object} AsRule\n * @property {import('../../style/flat.js').FlatStyle} style Style\n * @property {import(\"../../expr/expression.js\").EncodedExpression} [filter] Filter\n */\n\n/**\n * @typedef {AsRule|AsShaders} VectorStyle\n */\n\n/**\n * @classdesc This class is responsible for:\n * 1. generate WebGL buffers according to a provided style, using a MixedGeometryBatch as input\n * 2. rendering geometries contained in said buffers\n *\n * A layer renderer will typically maintain several of these in order to have several styles rendered separately.\n *\n * A VectorStyleRenderer instance can be created either from a literal style or from shaders using either\n * `VectorStyleRenderer.fromStyle` or `VectorStyleRenderer.fromShaders`. The shaders should not be provided explicitly\n * but instead as a preconfigured ShaderBuilder instance.\n *\n * The `generateBuffers` method returns a promise resolving to WebGL buffers that are intended to be rendered by the\n * same renderer.\n */\nclass VectorStyleRenderer {\n /**\n * @param {VectorStyle} styleOrShaders Literal style or custom shaders\n * @param {import('../../style/flat.js').StyleVariables} variables Style variables\n * @param {import('../../webgl/Helper.js').default} helper Helper\n * @param {boolean} [enableHitDetection] Whether to enable the hit detection (needs compatible shader)\n * @param {import(\"../../expr/expression.js\").ExpressionValue} [filter] Optional filter expression\n */\n constructor(styleOrShaders, variables, helper, enableHitDetection, filter) {\n /**\n * @private\n * @type {import('../../webgl/Helper.js').default}\n */\n this.helper_;\n\n /**\n * @private\n */\n this.hitDetectionEnabled_ = !!enableHitDetection;\n\n let asShaders = /** @type {AsShaders} */ (styleOrShaders);\n const isShaders = 'builder' in styleOrShaders;\n if (!isShaders) {\n const asRule = /** @type {AsRule} */ (styleOrShaders);\n const parseResult = parseLiteralStyle(\n asRule.style,\n variables,\n asRule.filter,\n );\n asShaders = {\n builder: parseResult.builder,\n attributes: parseResult.attributes,\n uniforms: parseResult.uniforms,\n };\n }\n\n /**\n * @private\n * @type {WebGLProgram}\n */\n this.fillProgram_;\n\n /**\n * @private\n * @type {WebGLProgram}\n */\n this.strokeProgram_;\n\n /**\n * @private\n * @type {WebGLProgram}\n */\n this.symbolProgram_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasFill_ = !!asShaders.builder.getFillVertexShader();\n if (this.hasFill_) {\n /**\n * @private\n */\n this.fillVertexShader_ = asShaders.builder.getFillVertexShader();\n /**\n * @private\n */\n this.fillFragmentShader_ = asShaders.builder.getFillFragmentShader();\n }\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasStroke_ = !!asShaders.builder.getStrokeVertexShader();\n if (this.hasStroke_) {\n /**\n * @private\n */\n this.strokeVertexShader_ = asShaders.builder.getStrokeVertexShader();\n /**\n * @private\n */\n this.strokeFragmentShader_ = asShaders.builder.getStrokeFragmentShader();\n }\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasSymbol_ = !!asShaders.builder.getSymbolVertexShader();\n if (this.hasSymbol_) {\n /**\n * @private\n */\n this.symbolVertexShader_ = asShaders.builder.getSymbolVertexShader();\n /**\n * @private\n */\n this.symbolFragmentShader_ = asShaders.builder.getSymbolFragmentShader();\n }\n\n /**\n * @type {function(import('../../Feature.js').FeatureLike): boolean}\n * @private\n */\n this.featureFilter_ = null;\n if (filter) {\n this.featureFilter_ = this.computeFeatureFilter(filter);\n }\n\n const hitDetectionAttributes = this.hitDetectionEnabled_\n ? {\n hitColor: {\n callback() {\n return colorEncodeId(this.ref, tmpColor);\n },\n size: 4,\n },\n }\n : {};\n\n /**\n * @private\n */\n this.customAttributes_ = Object.assign(\n {},\n hitDetectionAttributes,\n asShaders.attributes,\n );\n /**\n * @private\n */\n this.uniforms_ = asShaders.uniforms;\n\n const customAttributesDesc = Object.entries(this.customAttributes_).map(\n ([name, value]) => ({\n name: `a_${name}`,\n size: value.size || 1,\n type: AttributeType.FLOAT,\n }),\n );\n /**\n * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}\n * @private\n */\n this.polygonAttributesDesc_ = [\n {\n name: Attributes.POSITION,\n size: 2,\n type: AttributeType.FLOAT,\n },\n ...customAttributesDesc,\n ];\n /**\n * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}\n * @private\n */\n this.lineStringAttributesDesc_ = [\n {\n name: Attributes.SEGMENT_START,\n size: 2,\n type: AttributeType.FLOAT,\n },\n {\n name: Attributes.MEASURE_START,\n size: 1,\n type: AttributeType.FLOAT,\n },\n {\n name: Attributes.SEGMENT_END,\n size: 2,\n type: AttributeType.FLOAT,\n },\n {\n name: Attributes.MEASURE_END,\n size: 1,\n type: AttributeType.FLOAT,\n },\n {\n name: Attributes.JOIN_ANGLES,\n size: 2,\n type: AttributeType.FLOAT,\n },\n {\n name: Attributes.DISTANCE,\n size: 1,\n type: AttributeType.FLOAT,\n },\n {\n name: Attributes.PARAMETERS,\n size: 1,\n type: AttributeType.FLOAT,\n },\n ...customAttributesDesc,\n ];\n /**\n * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}\n * @private\n */\n this.pointAttributesDesc_ = [\n {\n name: Attributes.POSITION,\n size: 2,\n type: AttributeType.FLOAT,\n },\n {\n name: Attributes.INDEX,\n size: 1,\n type: AttributeType.FLOAT,\n },\n ...customAttributesDesc,\n ];\n\n this.setHelper(helper);\n }\n\n /**\n * Will apply the style filter when generating geometry batches (if it can be evaluated outside a map context)\n * @param {import(\"../../expr/expression.js\").ExpressionValue} filter Style filter\n * @return {function(import('../../Feature.js').FeatureLike): boolean} Feature filter\n * @private\n */\n computeFeatureFilter(filter) {\n const parsingContext = newParsingContext();\n /**\n * @type {import('../../expr/cpu.js').ExpressionEvaluator}\n */\n let compiled;\n try {\n compiled = buildExpression(filter, BooleanType, parsingContext);\n } catch {\n // filter expression failed to compile for CPU: ignore it\n return null;\n }\n\n // do not apply the filter if it depends on map state (e.g. zoom level) or any variable\n if (parsingContext.mapState || parsingContext.variables.size > 0) {\n return null;\n }\n\n const evalContext = newEvaluationContext();\n return (feature) => {\n evalContext.properties = feature.getPropertiesInternal();\n if (parsingContext.featureId) {\n const id = feature.getId();\n if (id !== undefined) {\n evalContext.featureId = id;\n } else {\n evalContext.featureId = null;\n }\n }\n evalContext.geometryType = computeGeometryType(feature.getGeometry());\n return /** @type {boolean} */ (compiled(evalContext));\n };\n }\n\n /**\n * @param {import('./MixedGeometryBatch.js').default} geometryBatch Geometry batch\n * @param {import(\"../../transform.js\").Transform} transform Transform to apply to coordinates\n * @return {Promise<WebGLBuffers|null>} A promise resolving to WebGL buffers; returns null if buffers are empty\n */\n async generateBuffers(geometryBatch, transform) {\n let filteredBatch = geometryBatch;\n if (this.featureFilter_) {\n filteredBatch = filteredBatch.filter(this.featureFilter_);\n if (filteredBatch.isEmpty()) {\n return null;\n }\n }\n const renderInstructions = this.generateRenderInstructions_(\n filteredBatch,\n transform,\n );\n const [polygonBuffers, lineStringBuffers, pointBuffers] = await Promise.all(\n [\n this.generateBuffersForType_(\n renderInstructions.polygonInstructions,\n 'Polygon',\n transform,\n ),\n this.generateBuffersForType_(\n renderInstructions.lineStringInstructions,\n 'LineString',\n transform,\n ),\n this.generateBuffersForType_(\n renderInstructions.pointInstructions,\n 'Point',\n transform,\n ),\n ],\n );\n // also return the inverse of the transform that was applied when generating buffers\n const invertVerticesTransform = makeInverseTransform(\n createTransform(),\n transform,\n );\n return {\n polygonBuffers: polygonBuffers,\n lineStringBuffers: lineStringBuffers,\n pointBuffers: pointBuffers,\n invertVerticesTransform: invertVerticesTransform,\n };\n }\n\n /**\n * @param {import('./MixedGeometryBatch.js').default} geometryBatch Geometry batch\n * @param {import(\"../../transform.js\").Transform} transform Transform to apply to coordinates\n * @return {RenderInstructions} Render instructions\n * @private\n */\n generateRenderInstructions_(geometryBatch, transform) {\n const polygonInstructions = this.hasFill_\n ? generatePolygonRenderInstructions(\n geometryBatch.polygonBatch,\n new Float32Array(0),\n this.customAttributes_,\n transform,\n )\n : null;\n const lineStringInstructions = this.hasStroke_\n ? generateLineStringRenderInstructions(\n geometryBatch.lineStringBatch,\n new Float32Array(0),\n this.customAttributes_,\n transform,\n )\n : null;\n const pointInstructions = this.hasSymbol_\n ? generatePointRenderInstructions(\n geometryBatch.pointBatch,\n new Float32Array(0),\n this.customAttributes_,\n transform,\n )\n : null;\n\n return {\n polygonInstructions,\n lineStringInstructions,\n pointInstructions,\n };\n }\n\n /**\n * @param {Float32Array|null} renderInstructions Render instructions\n * @param {import(\"../../geom/Geometry.js\").Type} geometryType Geometry type\n * @param {import(\"../../transform.js\").Transform} transform Transform to apply to coordinates\n * @return {Promise<Array<WebGLArrayBuffer>>|null} Indices buffer and vertices buffer; null if nothing to render\n * @private\n */\n generateBuffersForType_(renderInstructions, geometryType, transform) {\n if (renderInstructions === null) {\n return null;\n }\n\n const messageId = workerMessageCounter++;\n let messageType;\n switch (geometryType) {\n case 'Polygon':\n messageType = WebGLWorkerMessageType.GENERATE_POLYGON_BUFFERS;\n break;\n case 'LineString':\n messageType = WebGLWorkerMessageType.GENERATE_LINE_STRING_BUFFERS;\n break;\n case 'Point':\n messageType = WebGLWorkerMessageType.GENERATE_POINT_BUFFERS;\n break;\n default:\n // pass\n }\n\n /** @type {import('./constants.js').WebGLWorkerGenerateBuffersMessage} */\n const message = {\n id: messageId,\n type: messageType,\n renderInstructions: renderInstructions.buffer,\n renderInstructionsTransform: transform,\n customAttributesSize: getCustomAttributesSize(this.customAttributes_),\n };\n const WEBGL_WORKER = getWebGLWorker();\n WEBGL_WORKER.postMessage(message, [renderInstructions.buffer]);\n\n // leave ownership of render instructions\n renderInstructions = null;\n\n return new Promise((resolve) => {\n /**\n * @param {*} event Event.\n */\n const handleMessage = (event) => {\n const received = event.data;\n\n // this is not the response to our request: skip\n if (received.id !== messageId) {\n return;\n }\n\n // we've received our response: stop listening\n WEBGL_WORKER.removeEventListener('message', handleMessage);\n\n // the helper has disposed in the meantime; the promise will not be resolved\n if (!this.helper_.getGL()) {\n return;\n }\n\n // copy & flush received buffers to GPU\n const verticesBuffer = new WebGLArrayBuffer(\n ARRAY_BUFFER,\n DYNAMIC_DRAW,\n ).fromArrayBuffer(received.vertexBuffer);\n const indicesBuffer = new WebGLArrayBuffer(\n ELEMENT_ARRAY_BUFFER,\n DYNAMIC_DRAW,\n ).fromArrayBuffer(received.indexBuffer);\n this.helper_.flushBufferData(verticesBuffer);\n this.helper_.flushBufferData(indicesBuffer);\n\n resolve([indicesBuffer, verticesBuffer]);\n };\n\n WEBGL_WORKER.addEventListener('message', handleMessage);\n });\n }\n\n /**\n * Render the geometries in the given buffers.\n * @param {WebGLBuffers} buffers WebGL Buffers to draw\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state\n * @param {function(): void} preRenderCallback This callback will be called right before drawing, and can be used to set uniforms\n */\n render(buffers, frameState, preRenderCallback) {\n this.hasFill_ &&\n this.renderInternal_(\n buffers.polygonBuffers[0],\n buffers.polygonBuffers[1],\n this.fillProgram_,\n this.polygonAttributesDesc_,\n frameState,\n preRenderCallback,\n );\n this.hasStroke_ &&\n this.renderInternal_(\n buffers.lineStringBuffers[0],\n buffers.lineStringBuffers[1],\n this.strokeProgram_,\n this.lineStringAttributesDesc_,\n frameState,\n preRenderCallback,\n );\n this.hasSymbol_ &&\n this.renderInternal_(\n buffers.pointBuffers[0],\n buffers.pointBuffers[1],\n this.symbolProgram_,\n this.pointAttributesDesc_,\n frameState,\n preRenderCallback,\n );\n }\n\n /**\n * @param {WebGLArrayBuffer} indicesBuffer Indices buffer\n * @param {WebGLArrayBuffer} verticesBuffer Vertices buffer\n * @param {WebGLProgram} program Program\n * @param {Array<import('../../webgl/Helper.js').AttributeDescription>} attributes Attribute descriptions\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {function(): void} preRenderCallback This callback will be called right before drawing, and can be used to set uniforms\n * @private\n */\n renderInternal_(\n indicesBuffer,\n verticesBuffer,\n program,\n attributes,\n frameState,\n preRenderCallback,\n ) {\n const renderCount = indicesBuffer.getSize();\n if (renderCount === 0) {\n return;\n }\n this.helper_.useProgram(program, frameState);\n this.helper_.bindBuffer(verticesBuffer);\n this.helper_.bindBuffer(indicesBuffer);\n this.helper_.enableAttributes(attributes);\n preRenderCallback();\n this.helper_.drawElements(0, renderCount);\n }\n\n /**\n * @param {import('../../webgl/Helper.js').default} helper Helper\n * @param {WebGLBuffers} buffers WebGL Buffers to reload if any\n */\n setHelper(helper, buffers = null) {\n this.helper_ = helper;\n\n if (this.hasFill_) {\n this.fillProgram_ = this.helper_.getProgram(\n this.fillFragmentShader_,\n this.fillVertexShader_,\n );\n }\n if (this.hasStroke_) {\n this.strokeProgram_ = this.helper_.getProgram(\n this.strokeFragmentShader_,\n this.strokeVertexShader_,\n );\n }\n if (this.hasSymbol_) {\n this.symbolProgram_ = this.helper_.getProgram(\n this.symbolFragmentShader_,\n this.symbolVertexShader_,\n );\n }\n this.helper_.addUniforms(this.uniforms_);\n\n if (buffers) {\n if (buffers.polygonBuffers) {\n this.helper_.flushBufferData(buffers.polygonBuffers[0]);\n this.helper_.flushBufferData(buffers.polygonBuffers[1]);\n }\n if (buffers.lineStringBuffers) {\n this.helper_.flushBufferData(buffers.lineStringBuffers[0]);\n this.helper_.flushBufferData(buffers.lineStringBuffers[1]);\n }\n if (buffers.pointBuffers) {\n this.helper_.flushBufferData(buffers.pointBuffers[0]);\n this.helper_.flushBufferData(buffers.pointBuffers[1]);\n }\n }\n }\n}\n\nexport default VectorStyleRenderer;\n","/**\n * @module ol/renderer/webgl/VectorLayer\n */\nimport ViewHint from '../../ViewHint.js';\nimport {assert} from '../../asserts.js';\nimport {listen, unlistenByKey} from '../../events.js';\nimport {buffer, createEmpty, equals} from '../../extent.js';\nimport BaseVector from '../../layer/BaseVector.js';\nimport {\n getTransformFromProjections,\n getUserProjection,\n toUserExtent,\n toUserResolution,\n} from '../../proj.js';\nimport MixedGeometryBatch from '../../render/webgl/MixedGeometryBatch.js';\nimport VectorStyleRenderer from '../../render/webgl/VectorStyleRenderer.js';\nimport {colorDecodeId} from '../../render/webgl/encodeUtil.js';\nimport {breakDownFlatStyle} from '../../render/webgl/style.js';\nimport VectorEventType from '../../source/VectorEventType.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n makeInverse as makeInverseTransform,\n multiply as multiplyTransform,\n setFromArray as setFromTransform,\n translate as translateTransform,\n} from '../../transform.js';\nimport {\n create as createMat4,\n fromTransform as mat4FromTransform,\n} from '../../vec/mat4.js';\nimport {DefaultUniform} from '../../webgl/Helper.js';\nimport WebGLRenderTarget from '../../webgl/RenderTarget.js';\nimport WebGLLayerRenderer from './Layer.js';\nimport {getWorldParameters} from './worldUtil.js';\n\nexport const Uniforms = {\n ...DefaultUniform,\n RENDER_EXTENT: 'u_renderExtent', // intersection of layer, source, and view extent\n PATTERN_ORIGIN: 'u_patternOrigin',\n GLOBAL_ALPHA: 'u_globalAlpha',\n};\n\n/**\n * @typedef {import('../../render/webgl/VectorStyleRenderer.js').AsShaders} StyleAsShaders\n */\n/**\n * @typedef {import('../../render/webgl/VectorStyleRenderer.js').AsRule} StyleAsRule\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the canvas element.\n * @property {import('../../style/flat.js').FlatStyleLike | Array<StyleAsShaders> | StyleAsShaders} style Flat vector style; also accepts shaders\n * @property {Object<string, number|Array<number>|string|boolean>} variables Style variables\n * @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will\n * prevent all hit detection on the layer.\n * @property {Array<import(\"./Layer\").PostProcessesOptions>} [postProcesses] Post-processes definitions\n */\n\n/**\n * @classdesc\n * Experimental WebGL vector renderer. Supports polygons, lines and points:\n * Polygons are broken down into triangles\n * Lines are rendered as strips of quads\n * Points are rendered as quads\n *\n * You need to provide vertex and fragment shaders as well as custom attributes for each type of geometry. All shaders\n * can access the uniforms in the {@link module:ol/webgl/Helper~DefaultUniform} enum.\n * The vertex shaders can access the following attributes depending on the geometry type:\n * For polygons: {@link module:ol/render/webgl/PolygonBatchRenderer~Attributes}\n * For line strings: {@link module:ol/render/webgl/LineStringBatchRenderer~Attributes}\n * For points: {@link module:ol/render/webgl/PointBatchRenderer~Attributes}\n *\n * Please note that the fragment shaders output should have premultiplied alpha, otherwise visual anomalies may occur.\n *\n * Note: this uses {@link module:ol/webgl/Helper~WebGLHelper} internally.\n */\nclass WebGLVectorLayerRenderer extends WebGLLayerRenderer {\n /**\n * @param {import(\"../../layer/Layer.js\").default} layer Layer.\n * @param {Options} options Options.\n */\n constructor(layer, options) {\n const uniforms = {\n [Uniforms.RENDER_EXTENT]: [0, 0, 0, 0],\n [Uniforms.PATTERN_ORIGIN]: [0, 0],\n [Uniforms.GLOBAL_ALPHA]: 1,\n };\n\n super(layer, {\n uniforms: uniforms,\n postProcesses: options.postProcesses,\n });\n\n /**\n * @type {boolean}\n * @private\n */\n this.hitDetectionEnabled_ = !options.disableHitDetection;\n\n /**\n * @type {WebGLRenderTarget}\n * @private\n */\n this.hitRenderTarget_;\n\n /**\n * @private\n */\n this.sourceRevision_ = -1;\n\n /**\n * @private\n */\n this.previousExtent_ = createEmpty();\n\n /**\n * This transform is updated on every frame and is the composition of:\n * - invert of the world->screen transform that was used when rebuilding buffers (see `this.renderTransform_`)\n * - current world->screen transform\n * @type {import(\"../../transform.js\").Transform}\n * @private\n */\n this.currentTransform_ = createTransform();\n\n /**\n * @private\n */\n this.tmpCoords_ = [0, 0];\n /**\n * @private\n */\n this.tmpTransform_ = createTransform();\n /**\n * @private\n */\n this.tmpMat4_ = createMat4();\n\n /**\n * @type {import(\"../../transform.js\").Transform}\n * @private\n */\n this.currentFrameStateTransform_ = createTransform();\n\n /**\n * @type {import('../../style/flat.js').StyleVariables}\n * @private\n */\n this.styleVariables_ = {};\n\n /**\n * @type {Array<StyleAsRule | StyleAsShaders>}\n * @private\n */\n this.styles_ = [];\n\n /**\n * @type {Array<VectorStyleRenderer>}\n * @private\n */\n this.styleRenderers_ = [];\n\n /**\n * @type {Array<import('../../render/webgl/VectorStyleRenderer.js').WebGLBuffers>}\n * @private\n */\n this.buffers_ = [];\n\n this.applyOptions_(options);\n\n /**\n * @private\n */\n this.batch_ = new MixedGeometryBatch();\n\n /**\n * @private\n * @type {boolean}\n */\n this.initialFeaturesAdded_ = false;\n\n /**\n * @private\n * @type {Array<import(\"../../events.js\").EventsKey|null>}\n */\n this.sourceListenKeys_ = null;\n }\n\n /**\n * @private\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n addInitialFeatures_(frameState) {\n const source = this.getLayer().getSource();\n const userProjection = getUserProjection();\n let projectionTransform;\n if (userProjection) {\n projectionTransform = getTransformFromProjections(\n userProjection,\n frameState.viewState.projection,\n );\n }\n this.batch_.addFeatures(source.getFeatures(), projectionTransform);\n this.sourceListenKeys_ = [\n listen(\n source,\n VectorEventType.ADDFEATURE,\n this.handleSourceFeatureAdded_.bind(this, projectionTransform),\n ),\n listen(\n source,\n VectorEventType.CHANGEFEATURE,\n this.handleSourceFeatureChanged_.bind(this, projectionTransform),\n this,\n ),\n listen(\n source,\n VectorEventType.REMOVEFEATURE,\n this.handleSourceFeatureDelete_,\n this,\n ),\n listen(\n source,\n VectorEventType.CLEAR,\n this.handleSourceFeatureClear_,\n this,\n ),\n ];\n }\n\n /**\n * @param {Options} options Options.\n * @private\n */\n applyOptions_(options) {\n this.styleVariables_ = options.variables;\n this.styles_ = breakDownFlatStyle(options.style);\n }\n\n /**\n * @private\n */\n createRenderers_() {\n this.buffers_ = [];\n this.styleRenderers_ = this.styles_.map(\n (style) =>\n new VectorStyleRenderer(\n style,\n this.styleVariables_,\n this.helper,\n this.hitDetectionEnabled_,\n 'filter' in style ? style.filter : null,\n ),\n );\n }\n\n /**\n * @override\n */\n reset(options) {\n this.applyOptions_(options);\n if (this.helper) {\n this.createRenderers_();\n }\n super.reset(options);\n }\n\n /**\n * @override\n */\n afterHelperCreated() {\n if (this.styleRenderers_.length) {\n // To reuse buffers\n this.styleRenderers_.forEach((renderer, i) =>\n renderer.setHelper(this.helper, this.buffers_[i]),\n );\n } else {\n this.createRenderers_();\n }\n\n if (this.hitDetectionEnabled_) {\n this.hitRenderTarget_ = new WebGLRenderTarget(this.helper);\n }\n }\n\n /**\n * @param {import(\"../../proj.js\").TransformFunction} projectionTransform Transform function.\n * @param {import(\"../../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceFeatureAdded_(projectionTransform, event) {\n const feature = event.feature;\n this.batch_.addFeature(feature, projectionTransform);\n }\n\n /**\n * @param {import(\"../../proj.js\").TransformFunction} projectionTransform Transform function.\n * @param {import(\"../../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceFeatureChanged_(projectionTransform, event) {\n const feature = event.feature;\n this.batch_.changeFeature(feature, projectionTransform);\n }\n\n /**\n * @param {import(\"../../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceFeatureDelete_(event) {\n const feature = event.feature;\n this.batch_.removeFeature(feature);\n }\n\n /**\n * @private\n */\n handleSourceFeatureClear_() {\n this.batch_.clear();\n }\n\n /**\n * @param {import(\"../../transform.js\").Transform} batchInvertTransform Inverse of the transformation in which geometries are expressed\n * @private\n */\n applyUniforms_(batchInvertTransform) {\n // world to screen matrix\n setFromTransform(this.tmpTransform_, this.currentFrameStateTransform_);\n multiplyTransform(this.tmpTransform_, batchInvertTransform);\n this.helper.setUniformMatrixValue(\n Uniforms.PROJECTION_MATRIX,\n mat4FromTransform(this.tmpMat4_, this.tmpTransform_),\n );\n\n // screen to world matrix\n makeInverseTransform(this.tmpTransform_, this.tmpTransform_);\n this.helper.setUniformMatrixValue(\n Uniforms.SCREEN_TO_WORLD_MATRIX,\n mat4FromTransform(this.tmpMat4_, this.tmpTransform_),\n );\n\n // pattern origin should always be [0, 0] in world coordinates\n this.tmpCoords_[0] = 0;\n this.tmpCoords_[1] = 0;\n makeInverseTransform(this.tmpTransform_, batchInvertTransform);\n applyTransform(this.tmpTransform_, this.tmpCoords_);\n this.helper.setUniformFloatVec2(Uniforms.PATTERN_ORIGIN, this.tmpCoords_);\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n renderFrame(frameState) {\n const gl = this.helper.getGL();\n this.preRender(gl, frameState);\n\n const [startWorld, endWorld, worldWidth] = getWorldParameters(\n frameState,\n this.getLayer(),\n );\n\n // draw the normal canvas\n this.helper.prepareDraw(frameState);\n this.renderWorlds(frameState, false, startWorld, endWorld, worldWidth);\n this.helper.finalizeDraw(\n frameState,\n this.dispatchPreComposeEvent,\n this.dispatchPostComposeEvent,\n );\n\n const canvas = this.helper.getCanvas();\n\n if (this.hitDetectionEnabled_) {\n this.renderWorlds(frameState, true, startWorld, endWorld, worldWidth);\n this.hitRenderTarget_.clearCachedData();\n }\n\n this.postRender(gl, frameState);\n\n return canvas;\n }\n\n /**\n * Determine whether renderFrame should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrameInternal(frameState) {\n if (!this.initialFeaturesAdded_) {\n this.addInitialFeatures_(frameState);\n this.initialFeaturesAdded_ = true;\n }\n\n const layer = this.getLayer();\n const vectorSource = layer.getSource();\n const viewState = frameState.viewState;\n const viewNotMoving =\n !frameState.viewHints[ViewHint.ANIMATING] &&\n !frameState.viewHints[ViewHint.INTERACTING];\n const extentChanged = !equals(this.previousExtent_, frameState.extent);\n const sourceChanged = this.sourceRevision_ < vectorSource.getRevision();\n\n if (sourceChanged) {\n this.sourceRevision_ = vectorSource.getRevision();\n }\n\n if (viewNotMoving && (extentChanged || sourceChanged)) {\n const projection = viewState.projection;\n const resolution = viewState.resolution;\n\n const renderBuffer =\n layer instanceof BaseVector ? layer.getRenderBuffer() : 0;\n const extent = buffer(frameState.extent, renderBuffer * resolution);\n\n const userProjection = getUserProjection();\n if (userProjection) {\n vectorSource.loadFeatures(\n toUserExtent(extent, userProjection),\n toUserResolution(resolution, projection),\n userProjection,\n );\n } else {\n vectorSource.loadFeatures(extent, resolution, projection);\n }\n\n this.ready = false;\n\n const transform = this.helper.makeProjectionTransform(\n frameState,\n createTransform(),\n );\n\n const generatePromises = this.styleRenderers_.map((renderer, i) =>\n renderer.generateBuffers(this.batch_, transform).then((buffers) => {\n if (this.buffers_[i]) {\n this.disposeBuffers(this.buffers_[i]);\n }\n this.buffers_[i] = buffers;\n }),\n );\n Promise.all(generatePromises).then(() => {\n this.ready = true;\n this.getLayer().changed();\n });\n\n this.previousExtent_ = frameState.extent.slice();\n }\n\n return true;\n }\n\n /**\n * Render the world, either to the main framebuffer or to the hit framebuffer\n * @param {import(\"../../Map.js\").FrameState} frameState current frame state\n * @param {boolean} forHitDetection whether the rendering is for hit detection\n * @param {number} startWorld the world to render in the first iteration\n * @param {number} endWorld the last world to render\n * @param {number} worldWidth the width of the worlds being rendered\n */\n renderWorlds(frameState, forHitDetection, startWorld, endWorld, worldWidth) {\n let world = startWorld;\n\n if (forHitDetection) {\n this.hitRenderTarget_.setSize([\n Math.floor(frameState.size[0] / 2),\n Math.floor(frameState.size[1] / 2),\n ]);\n this.helper.prepareDrawToRenderTarget(\n frameState,\n this.hitRenderTarget_,\n true,\n );\n }\n\n do {\n this.helper.makeProjectionTransform(\n frameState,\n this.currentFrameStateTransform_,\n );\n translateTransform(\n this.currentFrameStateTransform_,\n world * worldWidth,\n 0,\n );\n for (let i = 0, ii = this.styleRenderers_.length; i < ii; i++) {\n const renderer = this.styleRenderers_[i];\n const buffers = this.buffers_[i];\n if (!buffers) {\n continue;\n }\n renderer.render(buffers, frameState, () => {\n this.applyUniforms_(buffers.invertVerticesTransform);\n this.helper.applyHitDetectionUniform(forHitDetection);\n });\n }\n } while (++world < endWorld);\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"../vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {Array<import(\"../Map.js\").HitMatch<T>>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n * @override\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n assert(\n this.hitDetectionEnabled_,\n '`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has been disabled using the `disableHitDetection: true` option.',\n );\n if (!this.styleRenderers_.length || !this.hitDetectionEnabled_) {\n return undefined;\n }\n\n const pixel = applyTransform(\n frameState.coordinateToPixelTransform,\n coordinate.slice(),\n );\n\n const data = this.hitRenderTarget_.readPixel(pixel[0] / 2, pixel[1] / 2);\n const color = [data[0] / 255, data[1] / 255, data[2] / 255, data[3] / 255];\n const ref = colorDecodeId(color);\n const feature = this.batch_.getFeatureFromRef(ref);\n if (feature) {\n return callback(feature, this.getLayer(), null);\n }\n return undefined;\n }\n\n /**\n * Will release a set of Webgl buffers\n * @param {import('../../render/webgl/VectorStyleRenderer.js').WebGLBuffers} buffers Buffers\n */\n disposeBuffers(buffers) {\n /**\n * @param {Array<import('../../webgl/Buffer.js').default>} typeBuffers Buffers\n */\n const disposeBuffersOfType = (typeBuffers) => {\n for (const buffer of typeBuffers) {\n if (buffer) {\n this.helper.deleteBuffer(buffer);\n }\n }\n };\n if (buffers.pointBuffers) {\n disposeBuffersOfType(buffers.pointBuffers);\n }\n if (buffers.lineStringBuffers) {\n disposeBuffersOfType(buffers.lineStringBuffers);\n }\n if (buffers.polygonBuffers) {\n disposeBuffersOfType(buffers.polygonBuffers);\n }\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.buffers_.forEach((buffers) => {\n if (buffers) {\n this.disposeBuffers(buffers);\n }\n });\n if (this.sourceListenKeys_) {\n this.sourceListenKeys_.forEach(function (key) {\n unlistenByKey(key);\n });\n this.sourceListenKeys_ = null;\n }\n super.disposeInternal();\n }\n\n renderDeclutter() {}\n}\n\nexport default WebGLVectorLayerRenderer;\n","/**\n * @module ol/renderer/webgl/VectorTileLayer\n */\nimport EventType from '../../events/EventType.js';\nimport {getIntersection} from '../../extent.js';\nimport {ShaderBuilder} from '../../render/webgl/ShaderBuilder.js';\nimport VectorStyleRenderer from '../../render/webgl/VectorStyleRenderer.js';\nimport {\n breakDownFlatStyle,\n parseLiteralStyle,\n} from '../../render/webgl/style.js';\nimport {\n create as createTransform,\n makeInverse as makeInverseTransform,\n multiply as multiplyTransform,\n setFromArray as setFromTransform,\n} from '../../transform.js';\nimport {\n create as createMat4,\n fromTransform as mat4FromTransform,\n} from '../../vec/mat4.js';\nimport WebGLArrayBuffer from '../../webgl/Buffer.js';\nimport {AttributeType} from '../../webgl/Helper.js';\nimport WebGLRenderTarget from '../../webgl/RenderTarget.js';\nimport TileGeometry from '../../webgl/TileGeometry.js';\nimport {ELEMENT_ARRAY_BUFFER, STATIC_DRAW} from '../../webgl.js';\nimport WebGLBaseTileLayerRenderer, {\n Uniforms as BaseUniforms,\n} from './TileLayerBase.js';\n\nexport const Uniforms = {\n ...BaseUniforms,\n TILE_MASK_TEXTURE: 'u_depthMask',\n TILE_ZOOM_LEVEL: 'u_tileZoomLevel',\n};\n\nexport const Attributes = {\n POSITION: 'a_position',\n};\n\n/**\n * @typedef {import('../../render/webgl/VectorStyleRenderer.js').AsShaders} StyleAsShaders\n */\n/**\n * @typedef {import('../../render/webgl/VectorStyleRenderer.js').AsRule} StyleAsRule\n */\n\n/**\n * @typedef {Object} Options\n * @property {import('../../style/flat.js').FlatStyleLike | Array<StyleAsShaders> | StyleAsShaders} style Flat vector style; also accepts shaders\n * @property {import('../../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not\n * an expression). These variables can be used as {@link import(\"../../expr/expression.js\").ExpressionValue expressions} in the styles properties\n * using the `['var', 'varName']` operator.\n * @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will\n * prevent all hit detection on the layer.\n * @property {number} [cacheSize=512] The vector tile cache size.\n */\n\n/**\n * @typedef {import(\"../../layer/BaseTile.js\").default} LayerType\n */\n\n/**\n * @classdesc\n * WebGL renderer for vector tile layers. Experimental.\n * @extends {WebGLBaseTileLayerRenderer<LayerType>}\n */\nclass WebGLVectorTileLayerRenderer extends WebGLBaseTileLayerRenderer {\n /**\n * @param {LayerType} tileLayer Tile layer.\n * @param {Options} options Options.\n */\n constructor(tileLayer, options) {\n super(tileLayer, {\n cacheSize: options.cacheSize,\n uniforms: {\n [Uniforms.PATTERN_ORIGIN]: [0, 0],\n [Uniforms.TILE_MASK_TEXTURE]: () => this.tileMaskTarget_.getTexture(),\n },\n });\n\n /**\n * @type {boolean}\n * @private\n */\n this.hitDetectionEnabled_ = !options.disableHitDetection;\n\n /**\n * @type {Array<StyleAsRule | StyleAsShaders>}\n * @private\n */\n this.styles_ = [];\n\n /**\n * @type {import('../../style/flat.js').StyleVariables}\n * @private\n */\n this.styleVariables_ = options.variables || {};\n\n /**\n * @type {Array<VectorStyleRenderer>}\n * @private\n */\n this.styleRenderers_ = [];\n\n /**\n * This transform is updated on every frame and is the composition of:\n * - invert of the world->screen transform that was used when rebuilding buffers (see `this.renderTransform_`)\n * - current world->screen transform\n * @type {import(\"../../transform.js\").Transform}\n * @private\n */\n this.currentFrameStateTransform_ = createTransform();\n\n /**\n * @private\n */\n this.tmpTransform_ = createTransform();\n /**\n * @private\n */\n this.tmpMat4_ = createMat4();\n\n /**\n * @type {WebGLRenderTarget}\n * @private\n */\n this.tileMaskTarget_ = null;\n\n /**\n * @private\n */\n this.tileMaskIndices_ = new WebGLArrayBuffer(\n ELEMENT_ARRAY_BUFFER,\n STATIC_DRAW,\n );\n this.tileMaskIndices_.fromArray([0, 1, 3, 1, 2, 3]);\n\n /**\n * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}\n * @private\n */\n this.tileMaskAttributes_ = [\n {\n name: Attributes.POSITION,\n size: 2,\n type: AttributeType.FLOAT,\n },\n ];\n\n /**\n * @type {WebGLProgram}\n * @private\n */\n this.tileMaskProgram_;\n\n this.applyOptions_(options);\n }\n\n /**\n * @param {Options} options Options.\n * @override\n */\n reset(options) {\n super.reset(options);\n\n this.applyOptions_(options);\n if (this.helper) {\n this.createRenderers_();\n this.initTileMask_();\n }\n }\n\n /**\n * @param {Options} options Options.\n * @private\n */\n applyOptions_(options) {\n this.styles_ = breakDownFlatStyle(options.style);\n }\n\n /**\n * @private\n */\n createRenderers_() {\n function addBuilderParams(builder) {\n const exisitingDiscard = builder.getFragmentDiscardExpression();\n const discardFromMask = `texture2D(${Uniforms.TILE_MASK_TEXTURE}, gl_FragCoord.xy / u_pixelRatio / u_viewportSizePx).r * 50. > ${Uniforms.TILE_ZOOM_LEVEL} + 0.5`;\n builder.setFragmentDiscardExpression(\n exisitingDiscard !== 'false'\n ? `(${exisitingDiscard}) || (${discardFromMask})`\n : discardFromMask,\n );\n builder.addUniform(Uniforms.TILE_MASK_TEXTURE, 'sampler2D');\n builder.addUniform(Uniforms.TILE_ZOOM_LEVEL, 'float');\n }\n\n this.styleRenderers_ = this.styles_.map((style) => {\n const isShaders = 'builder' in style;\n /** @type {StyleAsShaders} */\n let shaders;\n if (!isShaders) {\n const parseResult = parseLiteralStyle(\n style.style,\n this.styleVariables_,\n style.filter,\n );\n addBuilderParams(parseResult.builder);\n shaders = {\n builder: parseResult.builder,\n attributes: parseResult.attributes,\n uniforms: parseResult.uniforms,\n };\n } else {\n addBuilderParams(style.builder);\n shaders = style;\n }\n return new VectorStyleRenderer(\n shaders,\n this.styleVariables_,\n this.helper,\n this.hitDetectionEnabled_,\n 'filter' in style ? style.filter : null,\n );\n });\n }\n\n /**\n * @private\n */\n initTileMask_() {\n this.tileMaskTarget_ = new WebGLRenderTarget(this.helper);\n const builder = new ShaderBuilder()\n .setFillColorExpression(\n `vec4(${Uniforms.TILE_ZOOM_LEVEL} / 50., 0., 0., 1.)`,\n )\n .addUniform(Uniforms.TILE_ZOOM_LEVEL, 'float');\n this.tileMaskProgram_ = this.helper.getProgram(\n builder.getFillFragmentShader(),\n builder.getFillVertexShader(),\n );\n this.helper.flushBufferData(this.tileMaskIndices_);\n }\n\n /**\n * @override\n */\n afterHelperCreated() {\n this.createRenderers_();\n this.initTileMask_();\n }\n\n /**\n * @override\n */\n createTileRepresentation(options) {\n const tileRep = new TileGeometry(options, this.styleRenderers_);\n // redraw the layer when the tile is ready\n const listener = () => {\n if (tileRep.ready) {\n this.getLayer().changed();\n tileRep.removeEventListener(EventType.CHANGE, listener);\n }\n };\n tileRep.addEventListener(EventType.CHANGE, listener);\n return tileRep;\n }\n\n /**\n * @override\n */\n beforeTilesRender(frameState, tilesWithAlpha) {\n super.beforeTilesRender(frameState, true); // always consider that tiles need alpha blending\n this.helper.makeProjectionTransform(\n frameState,\n this.currentFrameStateTransform_,\n );\n }\n\n /**\n * @override\n */\n beforeTilesMaskRender(frameState) {\n this.helper.makeProjectionTransform(\n frameState,\n this.currentFrameStateTransform_,\n );\n const pixelRatio = frameState.pixelRatio;\n const size = frameState.size;\n this.tileMaskTarget_.setSize([size[0] * pixelRatio, size[1] * pixelRatio]);\n this.helper.prepareDrawToRenderTarget(\n frameState,\n this.tileMaskTarget_,\n true,\n true,\n );\n this.helper.useProgram(this.tileMaskProgram_, frameState);\n setFromTransform(this.tmpTransform_, this.currentFrameStateTransform_);\n this.helper.setUniformMatrixValue(\n Uniforms.PROJECTION_MATRIX,\n mat4FromTransform(this.tmpMat4_, this.tmpTransform_),\n );\n makeInverseTransform(this.tmpTransform_, this.currentFrameStateTransform_);\n this.helper.setUniformMatrixValue(\n Uniforms.SCREEN_TO_WORLD_MATRIX,\n mat4FromTransform(this.tmpMat4_, this.tmpTransform_),\n );\n return true;\n }\n\n /**\n * @override\n */\n renderTileMask(tileRepresentation, tileZ, extent, depth) {\n if (!tileRepresentation.ready) {\n return;\n }\n this.helper.setUniformFloatValue(Uniforms.DEPTH, depth);\n this.helper.setUniformFloatValue(Uniforms.TILE_ZOOM_LEVEL, tileZ);\n this.helper.setUniformFloatVec4(Uniforms.RENDER_EXTENT, extent);\n this.helper.setUniformFloatValue(Uniforms.GLOBAL_ALPHA, 1);\n this.helper.bindBuffer(\n /** @type {TileGeometry} */ (tileRepresentation).maskVertices,\n );\n this.helper.bindBuffer(this.tileMaskIndices_);\n this.helper.enableAttributes(this.tileMaskAttributes_);\n const renderCount = this.tileMaskIndices_.getSize();\n this.helper.drawElements(0, renderCount);\n }\n\n /**\n * @param {number} alpha Alpha value of the tile\n * @param {import(\"../../extent.js\").Extent} renderExtent Which extent to restrict drawing to\n * @param {import(\"../../transform.js\").Transform} batchInvertTransform Inverse of the transformation in which tile geometries are expressed\n * @param {number} tileZ Tile zoom level\n * @param {number} depth Depth of the tile\n * @private\n */\n applyUniforms_(alpha, renderExtent, batchInvertTransform, tileZ, depth) {\n // world to screen matrix\n setFromTransform(this.tmpTransform_, this.currentFrameStateTransform_);\n multiplyTransform(this.tmpTransform_, batchInvertTransform);\n this.helper.setUniformMatrixValue(\n Uniforms.PROJECTION_MATRIX,\n mat4FromTransform(this.tmpMat4_, this.tmpTransform_),\n );\n\n // screen to world matrix\n makeInverseTransform(this.tmpTransform_, this.currentFrameStateTransform_);\n this.helper.setUniformMatrixValue(\n Uniforms.SCREEN_TO_WORLD_MATRIX,\n mat4FromTransform(this.tmpMat4_, this.tmpTransform_),\n );\n\n this.helper.setUniformFloatValue(Uniforms.GLOBAL_ALPHA, alpha);\n this.helper.setUniformFloatValue(Uniforms.DEPTH, depth);\n this.helper.setUniformFloatValue(Uniforms.TILE_ZOOM_LEVEL, tileZ);\n this.helper.setUniformFloatVec4(Uniforms.RENDER_EXTENT, renderExtent);\n }\n\n /**\n * @override\n */\n renderTile(\n tileRepresentation,\n tileTransform,\n frameState,\n renderExtent,\n tileResolution,\n tileSize,\n tileOrigin,\n tileExtent,\n depth,\n gutter,\n alpha,\n ) {\n const gutterExtent = getIntersection(tileExtent, renderExtent, tileExtent);\n const tileZ = tileRepresentation.tile.getTileCoord()[0];\n for (let i = 0, ii = this.styleRenderers_.length; i < ii; i++) {\n const renderer = this.styleRenderers_[i];\n const buffers = tileRepresentation.buffers[i];\n if (!buffers) {\n continue;\n }\n renderer.render(buffers, frameState, () => {\n this.applyUniforms_(\n alpha,\n gutterExtent,\n buffers.invertVerticesTransform,\n tileZ,\n depth,\n );\n });\n }\n }\n\n /**\n * Render declutter items for this layer\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n renderDeclutter(frameState) {}\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n super.disposeInternal();\n }\n}\n\nexport default WebGLVectorTileLayerRenderer;\n","/**\n * @module ol/render/canvas/Instruction\n */\n\n/**\n * @enum {number}\n */\nconst Instruction = {\n BEGIN_GEOMETRY: 0,\n BEGIN_PATH: 1,\n CIRCLE: 2,\n CLOSE_PATH: 3,\n CUSTOM: 4,\n DRAW_CHARS: 5,\n DRAW_IMAGE: 6,\n END_GEOMETRY: 7,\n FILL: 8,\n MOVE_TO_LINE_TO: 9,\n SET_FILL_STYLE: 10,\n SET_STROKE_STYLE: 11,\n STROKE: 12,\n};\n\n/**\n * @type {Array<Instruction>}\n */\nexport const fillInstruction = [Instruction.FILL];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const strokeInstruction = [Instruction.STROKE];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const beginPathInstruction = [Instruction.BEGIN_PATH];\n\n/**\n * @type {Array<Instruction>}\n */\nexport const closePathInstruction = [Instruction.CLOSE_PATH];\n\nexport default Instruction;\n","/**\n * @module ol/render/canvas/Builder\n */\nimport {equals, reverseSubArray} from '../../array.js';\nimport {asColorLike} from '../../colorlike.js';\nimport Relationship from '../../extent/Relationship.js';\nimport {\n buffer,\n clone,\n containsCoordinate,\n coordinateRelationship,\n} from '../../extent.js';\nimport {\n inflateCoordinates,\n inflateCoordinatesArray,\n inflateMultiCoordinatesArray,\n} from '../../geom/flat/inflate.js';\nimport VectorContext from '../VectorContext.js';\nimport {\n defaultFillStyle,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultStrokeStyle,\n} from '../canvas.js';\nimport CanvasInstruction from './Instruction.js';\n\nclass CanvasBuilder extends VectorContext {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super();\n\n /**\n * @protected\n * @type {number}\n */\n this.tolerance = tolerance;\n\n /**\n * @protected\n * @const\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent = maxExtent;\n\n /**\n * @protected\n * @type {number}\n */\n this.pixelRatio = pixelRatio;\n\n /**\n * @protected\n * @type {number}\n */\n this.maxLineWidth = 0;\n\n /**\n * @protected\n * @const\n * @type {number}\n */\n this.resolution = resolution;\n\n /**\n * @private\n * @type {Array<*>}\n */\n this.beginGeometryInstruction1_ = null;\n\n /**\n * @private\n * @type {Array<*>}\n */\n this.beginGeometryInstruction2_ = null;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.bufferedMaxExtent_ = null;\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.instructions = [];\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.coordinates = [];\n\n /**\n * @private\n * @type {import(\"../../coordinate.js\").Coordinate}\n */\n this.tmpCoordinate_ = [];\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.hitDetectionInstructions = [];\n\n /**\n * @protected\n * @type {import(\"../canvas.js\").FillStrokeState}\n */\n this.state = /** @type {import(\"../canvas.js\").FillStrokeState} */ ({});\n }\n\n /**\n * @protected\n * @param {Array<number>} dashArray Dash array.\n * @return {Array<number>} Dash array with pixel ratio applied\n */\n applyPixelRatio(dashArray) {\n const pixelRatio = this.pixelRatio;\n return pixelRatio == 1\n ? dashArray\n : dashArray.map(function (dash) {\n return dash * pixelRatio;\n });\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} stride Stride.\n * @protected\n * @return {number} My end\n */\n appendFlatPointCoordinates(flatCoordinates, stride) {\n const extent = this.getBufferedMaxExtent();\n const tmpCoord = this.tmpCoordinate_;\n const coordinates = this.coordinates;\n let myEnd = coordinates.length;\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) {\n tmpCoord[0] = flatCoordinates[i];\n tmpCoord[1] = flatCoordinates[i + 1];\n if (containsCoordinate(extent, tmpCoord)) {\n coordinates[myEnd++] = tmpCoord[0];\n coordinates[myEnd++] = tmpCoord[1];\n }\n }\n return myEnd;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {boolean} closed Last input coordinate equals first.\n * @param {boolean} skipFirst Skip first coordinate.\n * @protected\n * @return {number} My end.\n */\n appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n closed,\n skipFirst,\n ) {\n const coordinates = this.coordinates;\n let myEnd = coordinates.length;\n const extent = this.getBufferedMaxExtent();\n if (skipFirst) {\n offset += stride;\n }\n let lastXCoord = flatCoordinates[offset];\n let lastYCoord = flatCoordinates[offset + 1];\n const nextCoord = this.tmpCoordinate_;\n let skipped = true;\n\n let i, lastRel, nextRel;\n for (i = offset + stride; i < end; i += stride) {\n nextCoord[0] = flatCoordinates[i];\n nextCoord[1] = flatCoordinates[i + 1];\n nextRel = coordinateRelationship(extent, nextCoord);\n if (nextRel !== lastRel) {\n if (skipped) {\n coordinates[myEnd++] = lastXCoord;\n coordinates[myEnd++] = lastYCoord;\n skipped = false;\n }\n coordinates[myEnd++] = nextCoord[0];\n coordinates[myEnd++] = nextCoord[1];\n } else if (nextRel === Relationship.INTERSECTING) {\n coordinates[myEnd++] = nextCoord[0];\n coordinates[myEnd++] = nextCoord[1];\n skipped = false;\n } else {\n skipped = true;\n }\n lastXCoord = nextCoord[0];\n lastYCoord = nextCoord[1];\n lastRel = nextRel;\n }\n\n // Last coordinate equals first or only one point to append:\n if ((closed && skipped) || i === offset + stride) {\n coordinates[myEnd++] = lastXCoord;\n coordinates[myEnd++] = lastYCoord;\n }\n return myEnd;\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @param {Array<number>} builderEnds Builder ends.\n * @return {number} Offset.\n */\n drawCustomCoordinates_(flatCoordinates, offset, ends, stride, builderEnds) {\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n const builderEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false,\n );\n builderEnds.push(builderEnd);\n offset = end;\n }\n return offset;\n }\n\n /**\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {Function} renderer Renderer.\n * @param {Function} hitDetectionRenderer Renderer.\n * @param {number} [index] Render order index.\n * @override\n */\n drawCustom(geometry, feature, renderer, hitDetectionRenderer, index) {\n this.beginGeometry(geometry, feature, index);\n\n const type = geometry.getType();\n const stride = geometry.getStride();\n const builderBegin = this.coordinates.length;\n\n let flatCoordinates, builderEnd, builderEnds, builderEndss;\n let offset;\n\n switch (type) {\n case 'MultiPolygon':\n flatCoordinates =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getOrientedFlatCoordinates();\n builderEndss = [];\n const endss =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getEndss();\n offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const myEnds = [];\n offset = this.drawCustomCoordinates_(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n myEnds,\n );\n builderEndss.push(myEnds);\n }\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEndss,\n geometry,\n renderer,\n inflateMultiCoordinatesArray,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEndss,\n geometry,\n hitDetectionRenderer || renderer,\n inflateMultiCoordinatesArray,\n index,\n ]);\n break;\n case 'Polygon':\n case 'MultiLineString':\n builderEnds = [];\n flatCoordinates =\n type == 'Polygon'\n ? /** @type {import(\"../../geom/Polygon.js\").default} */ (\n geometry\n ).getOrientedFlatCoordinates()\n : geometry.getFlatCoordinates();\n offset = this.drawCustomCoordinates_(\n flatCoordinates,\n 0,\n /** @type {import(\"../../geom/Polygon.js\").default|import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ).getEnds(),\n stride,\n builderEnds,\n );\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnds,\n geometry,\n renderer,\n inflateCoordinatesArray,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnds,\n geometry,\n hitDetectionRenderer || renderer,\n inflateCoordinatesArray,\n index,\n ]);\n break;\n case 'LineString':\n case 'Circle':\n flatCoordinates = geometry.getFlatCoordinates();\n builderEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n false,\n false,\n );\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n inflateCoordinates,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n hitDetectionRenderer || renderer,\n inflateCoordinates,\n index,\n ]);\n break;\n case 'MultiPoint':\n flatCoordinates = geometry.getFlatCoordinates();\n builderEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);\n\n if (builderEnd > builderBegin) {\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n inflateCoordinates,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n hitDetectionRenderer || renderer,\n inflateCoordinates,\n index,\n ]);\n }\n break;\n case 'Point':\n flatCoordinates = geometry.getFlatCoordinates();\n this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);\n builderEnd = this.coordinates.length;\n\n this.instructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n renderer,\n undefined,\n index,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.CUSTOM,\n builderBegin,\n builderEnd,\n geometry,\n hitDetectionRenderer || renderer,\n undefined,\n index,\n ]);\n break;\n default:\n }\n this.endGeometry(feature);\n }\n\n /**\n * @protected\n * @param {import(\"../../geom/Geometry\").default|import(\"../Feature.js\").default} geometry The geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} index Render order index\n */\n beginGeometry(geometry, feature, index) {\n this.beginGeometryInstruction1_ = [\n CanvasInstruction.BEGIN_GEOMETRY,\n feature,\n 0,\n geometry,\n index,\n ];\n this.instructions.push(this.beginGeometryInstruction1_);\n this.beginGeometryInstruction2_ = [\n CanvasInstruction.BEGIN_GEOMETRY,\n feature,\n 0,\n geometry,\n index,\n ];\n this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n */\n finish() {\n return {\n instructions: this.instructions,\n hitDetectionInstructions: this.hitDetectionInstructions,\n coordinates: this.coordinates,\n };\n }\n\n /**\n * Reverse the hit detection instructions.\n */\n reverseHitDetectionInstructions() {\n const hitDetectionInstructions = this.hitDetectionInstructions;\n // step 1 - reverse array\n hitDetectionInstructions.reverse();\n // step 2 - reverse instructions within geometry blocks\n let i;\n const n = hitDetectionInstructions.length;\n let instruction;\n let type;\n let begin = -1;\n for (i = 0; i < n; ++i) {\n instruction = hitDetectionInstructions[i];\n type = /** @type {import(\"./Instruction.js\").default} */ (instruction[0]);\n if (type == CanvasInstruction.END_GEOMETRY) {\n begin = i;\n } else if (type == CanvasInstruction.BEGIN_GEOMETRY) {\n instruction[2] = i;\n reverseSubArray(this.hitDetectionInstructions, begin, i);\n begin = -1;\n }\n }\n }\n\n /**\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import('../canvas.js').FillStrokeState} [state] State.\n * @return {import('../canvas.js').FillStrokeState} State.\n */\n fillStyleToState(\n fillStyle,\n state = /** @type {import('../canvas.js').FillStrokeState} */ ({}),\n ) {\n if (fillStyle) {\n const fillStyleColor = fillStyle.getColor();\n state.fillPatternScale =\n fillStyleColor &&\n typeof fillStyleColor === 'object' &&\n 'src' in fillStyleColor\n ? this.pixelRatio\n : 1;\n state.fillStyle = asColorLike(\n fillStyleColor ? fillStyleColor : defaultFillStyle,\n );\n } else {\n state.fillStyle = undefined;\n }\n return state;\n }\n\n /**\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {import(\"../canvas.js\").FillStrokeState} State.\n */\n strokeStyleToState(\n strokeStyle,\n state = /** @type {import('../canvas.js').FillStrokeState} */ ({}),\n ) {\n if (strokeStyle) {\n const strokeStyleColor = strokeStyle.getColor();\n state.strokeStyle = asColorLike(\n strokeStyleColor ? strokeStyleColor : defaultStrokeStyle,\n );\n const strokeStyleLineCap = strokeStyle.getLineCap();\n state.lineCap =\n strokeStyleLineCap !== undefined ? strokeStyleLineCap : defaultLineCap;\n const strokeStyleLineDash = strokeStyle.getLineDash();\n state.lineDash = strokeStyleLineDash\n ? strokeStyleLineDash.slice()\n : defaultLineDash;\n const strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();\n state.lineDashOffset = strokeStyleLineDashOffset\n ? strokeStyleLineDashOffset\n : defaultLineDashOffset;\n const strokeStyleLineJoin = strokeStyle.getLineJoin();\n state.lineJoin =\n strokeStyleLineJoin !== undefined\n ? strokeStyleLineJoin\n : defaultLineJoin;\n const strokeStyleWidth = strokeStyle.getWidth();\n state.lineWidth =\n strokeStyleWidth !== undefined ? strokeStyleWidth : defaultLineWidth;\n const strokeStyleMiterLimit = strokeStyle.getMiterLimit();\n state.miterLimit =\n strokeStyleMiterLimit !== undefined\n ? strokeStyleMiterLimit\n : defaultMiterLimit;\n\n if (state.lineWidth > this.maxLineWidth) {\n this.maxLineWidth = state.lineWidth;\n // invalidate the buffered max extent cache\n this.bufferedMaxExtent_ = null;\n }\n } else {\n state.strokeStyle = undefined;\n state.lineCap = undefined;\n state.lineDash = null;\n state.lineDashOffset = undefined;\n state.lineJoin = undefined;\n state.lineWidth = undefined;\n state.miterLimit = undefined;\n }\n return state;\n }\n\n /**\n * @param {import(\"../../style/Fill.js\").default} fillStyle Fill style.\n * @param {import(\"../../style/Stroke.js\").default} strokeStyle Stroke style.\n * @override\n */\n setFillStrokeStyle(fillStyle, strokeStyle) {\n const state = this.state;\n this.fillStyleToState(fillStyle, state);\n this.strokeStyleToState(strokeStyle, state);\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {Array<*>} Fill instruction.\n */\n createFill(state) {\n const fillStyle = state.fillStyle;\n /** @type {Array<*>} */\n const fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle];\n if (typeof fillStyle !== 'string') {\n // Fill is a pattern or gradient - align and scale it!\n fillInstruction.push(state.fillPatternScale);\n }\n return fillInstruction;\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n */\n applyStroke(state) {\n this.instructions.push(this.createStroke(state));\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @return {Array<*>} Stroke instruction.\n */\n createStroke(state) {\n return [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth * this.pixelRatio,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n state.lineDash ? this.applyPixelRatio(state.lineDash) : null,\n state.lineDashOffset * this.pixelRatio,\n ];\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @param {function(this:CanvasBuilder, import(\"../canvas.js\").FillStrokeState):Array<*>} createFill Create fill.\n */\n updateFillStyle(state, createFill) {\n const fillStyle = state.fillStyle;\n if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {\n this.instructions.push(createFill.call(this, state));\n state.currentFillStyle = fillStyle;\n }\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @param {function(this:CanvasBuilder, import(\"../canvas.js\").FillStrokeState): void} applyStroke Apply stroke.\n */\n updateStrokeStyle(state, applyStroke) {\n const strokeStyle = state.strokeStyle;\n const lineCap = state.lineCap;\n const lineDash = state.lineDash;\n const lineDashOffset = state.lineDashOffset;\n const lineJoin = state.lineJoin;\n const lineWidth = state.lineWidth;\n const miterLimit = state.miterLimit;\n if (\n state.currentStrokeStyle != strokeStyle ||\n state.currentLineCap != lineCap ||\n (lineDash != state.currentLineDash &&\n !equals(state.currentLineDash, lineDash)) ||\n state.currentLineDashOffset != lineDashOffset ||\n state.currentLineJoin != lineJoin ||\n state.currentLineWidth != lineWidth ||\n state.currentMiterLimit != miterLimit\n ) {\n applyStroke.call(this, state);\n state.currentStrokeStyle = strokeStyle;\n state.currentLineCap = lineCap;\n state.currentLineDash = lineDash;\n state.currentLineDashOffset = lineDashOffset;\n state.currentLineJoin = lineJoin;\n state.currentLineWidth = lineWidth;\n state.currentMiterLimit = miterLimit;\n }\n }\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n */\n endGeometry(feature) {\n this.beginGeometryInstruction1_[2] = this.instructions.length;\n this.beginGeometryInstruction1_ = null;\n this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;\n this.beginGeometryInstruction2_ = null;\n const endGeometryInstruction = [CanvasInstruction.END_GEOMETRY, feature];\n this.instructions.push(endGeometryInstruction);\n this.hitDetectionInstructions.push(endGeometryInstruction);\n }\n\n /**\n * Get the buffered rendering extent. Rendering will be clipped to the extent\n * provided to the constructor. To account for symbolizers that may intersect\n * this extent, we calculate a buffered extent (e.g. based on stroke width).\n * @return {import(\"../../extent.js\").Extent} The buffered rendering extent.\n * @protected\n */\n getBufferedMaxExtent() {\n if (!this.bufferedMaxExtent_) {\n this.bufferedMaxExtent_ = clone(this.maxExtent);\n if (this.maxLineWidth > 0) {\n const width = (this.resolution * (this.maxLineWidth + 1)) / 2;\n buffer(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_);\n }\n }\n return this.bufferedMaxExtent_;\n }\n}\n\nexport default CanvasBuilder;\n","/**\n * @module ol/render/canvas/ImageBuilder\n */\nimport {containsCoordinate} from '../../extent.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction from './Instruction.js';\n\nclass CanvasImageBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n\n /**\n * @private\n * @type {import('../../DataTile.js').ImageLike}\n */\n this.hitDetectionImage_ = null;\n\n /**\n * @private\n * @type {import('../../DataTile.js').ImageLike}\n */\n this.image_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.imagePixelRatio_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.anchorX_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.anchorY_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.height_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.opacity_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.originX_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.originY_ = undefined;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.rotateWithView_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n /**\n * @private\n * @type {import(\"../../size.js\").Size|undefined}\n */\n this.scale_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.width_ = undefined;\n\n /**\n * @private\n * @type {import('../../style/Style.js').DeclutterMode}\n */\n this.declutterMode_ = undefined;\n\n /**\n * Data shared with a text builder for combined decluttering.\n * @private\n * @type {import(\"../canvas.js\").DeclutterImageWithText}\n */\n this.declutterImageWithText_ = undefined;\n }\n\n /**\n * @param {import(\"../../geom/Point.js\").default|import(\"../Feature.js\").default} pointGeometry Point geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawPoint(pointGeometry, feature, index) {\n if (\n !this.image_ ||\n (this.maxExtent &&\n !containsCoordinate(this.maxExtent, pointGeometry.getFlatCoordinates()))\n ) {\n return;\n }\n this.beginGeometry(pointGeometry, feature, index);\n const flatCoordinates = pointGeometry.getFlatCoordinates();\n const stride = pointGeometry.getStride();\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.image_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_ * this.imagePixelRatio_,\n this.anchorY_ * this.imagePixelRatio_,\n Math.ceil(this.height_ * this.imagePixelRatio_),\n this.opacity_,\n this.originX_ * this.imagePixelRatio_,\n this.originY_ * this.imagePixelRatio_,\n this.rotateWithView_,\n this.rotation_,\n [\n (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,\n (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,\n ],\n Math.ceil(this.width_ * this.imagePixelRatio_),\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.hitDetectionImage_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_,\n this.anchorY_,\n this.height_,\n 1,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n this.scale_,\n this.width_,\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiPoint.js\").default|import(\"../Feature.js\").default} multiPointGeometry MultiPoint geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiPoint(multiPointGeometry, feature, index) {\n if (!this.image_) {\n return;\n }\n this.beginGeometry(multiPointGeometry, feature, index);\n const flatCoordinates = multiPointGeometry.getFlatCoordinates();\n const filteredFlatCoordinates = [];\n for (\n let i = 0, ii = flatCoordinates.length;\n i < ii;\n i += multiPointGeometry.getStride()\n ) {\n if (\n !this.maxExtent ||\n containsCoordinate(this.maxExtent, flatCoordinates.slice(i, i + 2))\n ) {\n filteredFlatCoordinates.push(\n flatCoordinates[i],\n flatCoordinates[i + 1],\n );\n }\n }\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatPointCoordinates(filteredFlatCoordinates, 2);\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.image_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_ * this.imagePixelRatio_,\n this.anchorY_ * this.imagePixelRatio_,\n Math.ceil(this.height_ * this.imagePixelRatio_),\n this.opacity_,\n this.originX_ * this.imagePixelRatio_,\n this.originY_ * this.imagePixelRatio_,\n this.rotateWithView_,\n this.rotation_,\n [\n (this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,\n (this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,\n ],\n Math.ceil(this.width_ * this.imagePixelRatio_),\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n myBegin,\n myEnd,\n this.hitDetectionImage_,\n // Remaining arguments to DRAW_IMAGE are in alphabetical order\n this.anchorX_,\n this.anchorY_,\n this.height_,\n 1,\n this.originX_,\n this.originY_,\n this.rotateWithView_,\n this.rotation_,\n this.scale_,\n this.width_,\n this.declutterMode_,\n this.declutterImageWithText_,\n ]);\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n this.reverseHitDetectionInstructions();\n // FIXME this doesn't really protect us against further calls to draw*Geometry\n this.anchorX_ = undefined;\n this.anchorY_ = undefined;\n this.hitDetectionImage_ = null;\n this.image_ = null;\n this.imagePixelRatio_ = undefined;\n this.height_ = undefined;\n this.scale_ = undefined;\n this.opacity_ = undefined;\n this.originX_ = undefined;\n this.originY_ = undefined;\n this.rotateWithView_ = undefined;\n this.rotation_ = undefined;\n this.width_ = undefined;\n return super.finish();\n }\n\n /**\n * @param {import(\"../../style/Image.js\").default} imageStyle Image style.\n * @param {Object} [sharedData] Shared data.\n * @override\n */\n setImageStyle(imageStyle, sharedData) {\n const anchor = imageStyle.getAnchor();\n const size = imageStyle.getSize();\n const origin = imageStyle.getOrigin();\n this.imagePixelRatio_ = imageStyle.getPixelRatio(this.pixelRatio);\n this.anchorX_ = anchor[0];\n this.anchorY_ = anchor[1];\n this.hitDetectionImage_ = imageStyle.getHitDetectionImage();\n this.image_ = imageStyle.getImage(this.pixelRatio);\n this.height_ = size[1];\n this.opacity_ = imageStyle.getOpacity();\n this.originX_ = origin[0];\n this.originY_ = origin[1];\n this.rotateWithView_ = imageStyle.getRotateWithView();\n this.rotation_ = imageStyle.getRotation();\n this.scale_ = imageStyle.getScaleArray();\n this.width_ = size[0];\n this.declutterMode_ = imageStyle.getDeclutterMode();\n this.declutterImageWithText_ = sharedData;\n }\n}\n\nexport default CanvasImageBuilder;\n","/**\n * @module ol/render/canvas/LineStringBuilder\n */\nimport {defaultLineDash, defaultLineDashOffset} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n strokeInstruction,\n} from './Instruction.js';\n\nclass CanvasLineStringBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @private\n * @return {number} end.\n */\n drawFlatCoordinates_(flatCoordinates, offset, end, stride) {\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n false,\n false,\n );\n const moveToLineToInstruction = [\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n ];\n this.instructions.push(moveToLineToInstruction);\n this.hitDetectionInstructions.push(moveToLineToInstruction);\n return end;\n }\n\n /**\n * @param {import(\"../../geom/LineString.js\").default|import(\"../Feature.js\").default} lineStringGeometry Line string geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawLineString(lineStringGeometry, feature, index) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(lineStringGeometry, feature, index);\n this.hitDetectionInstructions.push(\n [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ],\n beginPathInstruction,\n );\n const flatCoordinates = lineStringGeometry.getFlatCoordinates();\n const stride = lineStringGeometry.getStride();\n this.drawFlatCoordinates_(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n );\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiLineString.js\").default|import(\"../Feature.js\").default} multiLineStringGeometry MultiLineString geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiLineString(multiLineStringGeometry, feature, index) {\n const state = this.state;\n const strokeStyle = state.strokeStyle;\n const lineWidth = state.lineWidth;\n if (strokeStyle === undefined || lineWidth === undefined) {\n return;\n }\n this.updateStrokeStyle(state, this.applyStroke);\n this.beginGeometry(multiLineStringGeometry, feature, index);\n this.hitDetectionInstructions.push(\n [\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ],\n beginPathInstruction,\n );\n const ends = multiLineStringGeometry.getEnds();\n const flatCoordinates = multiLineStringGeometry.getFlatCoordinates();\n const stride = multiLineStringGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n offset = this.drawFlatCoordinates_(\n flatCoordinates,\n offset,\n /** @type {number} */ (ends[i]),\n stride,\n );\n }\n this.hitDetectionInstructions.push(strokeInstruction);\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n const state = this.state;\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n }\n this.reverseHitDetectionInstructions();\n this.state = null;\n return super.finish();\n }\n\n /**\n * @param {import(\"../canvas.js\").FillStrokeState} state State.\n * @override\n */\n applyStroke(state) {\n if (\n state.lastStroke != undefined &&\n state.lastStroke != this.coordinates.length\n ) {\n this.instructions.push(strokeInstruction);\n state.lastStroke = this.coordinates.length;\n }\n state.lastStroke = 0;\n super.applyStroke(state);\n this.instructions.push(beginPathInstruction);\n }\n}\n\nexport default CanvasLineStringBuilder;\n","/**\n * @module ol/render/canvas/PolygonBuilder\n */\nimport {snap} from '../../geom/flat/simplify.js';\nimport {\n defaultFillStyle,\n defaultLineDash,\n defaultLineDashOffset,\n} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction, {\n beginPathInstruction,\n closePathInstruction,\n fillInstruction,\n strokeInstruction,\n} from './Instruction.js';\n\nclass CanvasPolygonBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n }\n\n /**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {Array<number>} ends Ends.\n * @param {number} stride Stride.\n * @private\n * @return {number} End.\n */\n drawFlatCoordinatess_(flatCoordinates, offset, ends, stride) {\n const state = this.state;\n const fill = state.fillStyle !== undefined;\n const stroke = state.strokeStyle !== undefined;\n const numEnds = ends.length;\n this.instructions.push(beginPathInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction);\n for (let i = 0; i < numEnds; ++i) {\n const end = ends[i];\n const myBegin = this.coordinates.length;\n const myEnd = this.appendFlatLineCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n true,\n !stroke,\n );\n const moveToLineToInstruction = [\n CanvasInstruction.MOVE_TO_LINE_TO,\n myBegin,\n myEnd,\n ];\n this.instructions.push(moveToLineToInstruction);\n this.hitDetectionInstructions.push(moveToLineToInstruction);\n if (stroke) {\n // Performance optimization: only call closePath() when we have a stroke.\n // Otherwise the ring is closed already (see appendFlatLineCoordinates above).\n this.instructions.push(closePathInstruction);\n this.hitDetectionInstructions.push(closePathInstruction);\n }\n offset = end;\n }\n if (fill) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (stroke) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n return offset;\n }\n\n /**\n * @param {import(\"../../geom/Circle.js\").default} circleGeometry Circle geometry.\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawCircle(circleGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(circleGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const flatCoordinates = circleGeometry.getFlatCoordinates();\n const stride = circleGeometry.getStride();\n const myBegin = this.coordinates.length;\n this.appendFlatLineCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n false,\n false,\n );\n const circleInstruction = [CanvasInstruction.CIRCLE, myBegin];\n this.instructions.push(beginPathInstruction, circleInstruction);\n this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);\n if (state.fillStyle !== undefined) {\n this.instructions.push(fillInstruction);\n this.hitDetectionInstructions.push(fillInstruction);\n }\n if (state.strokeStyle !== undefined) {\n this.instructions.push(strokeInstruction);\n this.hitDetectionInstructions.push(strokeInstruction);\n }\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/Polygon.js\").default|import(\"../Feature.js\").default} polygonGeometry Polygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawPolygon(polygonGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(polygonGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const ends = polygonGeometry.getEnds();\n const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();\n const stride = polygonGeometry.getStride();\n this.drawFlatCoordinatess_(\n flatCoordinates,\n 0,\n /** @type {Array<number>} */ (ends),\n stride,\n );\n this.endGeometry(feature);\n }\n\n /**\n * @param {import(\"../../geom/MultiPolygon.js\").default} multiPolygonGeometry MultiPolygon geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawMultiPolygon(multiPolygonGeometry, feature, index) {\n const state = this.state;\n const fillStyle = state.fillStyle;\n const strokeStyle = state.strokeStyle;\n if (fillStyle === undefined && strokeStyle === undefined) {\n return;\n }\n this.setFillStrokeStyles_();\n this.beginGeometry(multiPolygonGeometry, feature, index);\n if (state.fillStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_FILL_STYLE,\n defaultFillStyle,\n ]);\n }\n if (state.strokeStyle !== undefined) {\n this.hitDetectionInstructions.push([\n CanvasInstruction.SET_STROKE_STYLE,\n state.strokeStyle,\n state.lineWidth,\n state.lineCap,\n state.lineJoin,\n state.miterLimit,\n defaultLineDash,\n defaultLineDashOffset,\n ]);\n }\n const endss = multiPolygonGeometry.getEndss();\n const flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();\n const stride = multiPolygonGeometry.getStride();\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n offset = this.drawFlatCoordinatess_(\n flatCoordinates,\n offset,\n endss[i],\n stride,\n );\n }\n this.endGeometry(feature);\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n this.reverseHitDetectionInstructions();\n this.state = null;\n // We want to preserve topology when drawing polygons. Polygons are\n // simplified using quantization and point elimination. However, we might\n // have received a mix of quantized and non-quantized geometries, so ensure\n // that all are quantized by quantizing all coordinates in the batch.\n const tolerance = this.tolerance;\n if (tolerance !== 0) {\n const coordinates = this.coordinates;\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n coordinates[i] = snap(coordinates[i], tolerance);\n }\n }\n return super.finish();\n }\n\n /**\n * @private\n */\n setFillStrokeStyles_() {\n const state = this.state;\n this.updateFillStyle(state, this.createFill);\n this.updateStrokeStyle(state, this.applyStroke);\n }\n}\n\nexport default CanvasPolygonBuilder;\n","import {lerp} from '../../math.js';\n\n/**\n * Creates chunks of equal length from a linestring\n * @param {number} chunkLength Length of each chunk.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Start offset of the `flatCoordinates`.\n * @param {number} end End offset of the `flatCoordinates`.\n * @param {number} stride Stride.\n * @return {Array<Array<number>>} Chunks of linestrings with stride 2.\n */\nexport function lineChunk(chunkLength, flatCoordinates, offset, end, stride) {\n const chunks = [];\n let cursor = offset;\n let chunkM = 0;\n let currentChunk = flatCoordinates.slice(offset, 2);\n while (chunkM < chunkLength && cursor + stride < end) {\n const [x1, y1] = currentChunk.slice(-2);\n const x2 = flatCoordinates[cursor + stride];\n const y2 = flatCoordinates[cursor + stride + 1];\n const segmentLength = Math.sqrt(\n (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1),\n );\n chunkM += segmentLength;\n if (chunkM >= chunkLength) {\n const m = (chunkLength - chunkM + segmentLength) / segmentLength;\n const x = lerp(x1, x2, m);\n const y = lerp(y1, y2, m);\n currentChunk.push(x, y);\n chunks.push(currentChunk);\n currentChunk = [x, y];\n if (chunkM == chunkLength) {\n cursor += stride;\n }\n chunkM = 0;\n } else if (chunkM < chunkLength) {\n currentChunk.push(\n flatCoordinates[cursor + stride],\n flatCoordinates[cursor + stride + 1],\n );\n cursor += stride;\n } else {\n const missing = segmentLength - chunkM;\n const x = lerp(x1, x2, missing / segmentLength);\n const y = lerp(y1, y2, missing / segmentLength);\n currentChunk.push(x, y);\n chunks.push(currentChunk);\n currentChunk = [x, y];\n chunkM = 0;\n cursor += stride;\n }\n }\n if (chunkM > 0) {\n chunks.push(currentChunk);\n }\n return chunks;\n}\n","/**\n * @module ol/geom/flat/straightchunk\n */\n\n/**\n * @param {number} maxAngle Maximum acceptable angle delta between segments.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Array<number>} Start and end of the first suitable chunk of the\n * given `flatCoordinates`.\n */\nexport function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) {\n let chunkStart = offset;\n let chunkEnd = offset;\n let chunkM = 0;\n let m = 0;\n let start = offset;\n let acos, i, m12, m23, x1, y1, x12, y12, x23, y23;\n for (i = offset; i < end; i += stride) {\n const x2 = flatCoordinates[i];\n const y2 = flatCoordinates[i + 1];\n if (x1 !== undefined) {\n x23 = x2 - x1;\n y23 = y2 - y1;\n m23 = Math.sqrt(x23 * x23 + y23 * y23);\n if (x12 !== undefined) {\n m += m12;\n acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23));\n if (acos > maxAngle) {\n if (m > chunkM) {\n chunkM = m;\n chunkStart = start;\n chunkEnd = i;\n }\n m = 0;\n start = i - stride;\n }\n }\n m12 = m23;\n x12 = x23;\n y12 = y23;\n }\n x1 = x2;\n y1 = y2;\n }\n m += m23;\n return m > chunkM ? [start, i] : [chunkStart, chunkEnd];\n}\n","/**\n * @module ol/render/canvas/TextBuilder\n */\nimport {asColorLike} from '../../colorlike.js';\nimport {intersects} from '../../extent.js';\nimport {lineChunk} from '../../geom/flat/linechunk.js';\nimport {matchingChunk} from '../../geom/flat/straightchunk.js';\nimport {getUid} from '../../util.js';\nimport {\n defaultFillStyle,\n defaultFont,\n defaultLineCap,\n defaultLineDash,\n defaultLineDashOffset,\n defaultLineJoin,\n defaultLineWidth,\n defaultMiterLimit,\n defaultPadding,\n defaultStrokeStyle,\n defaultTextAlign,\n defaultTextBaseline,\n registerFont,\n} from '../canvas.js';\nimport CanvasBuilder from './Builder.js';\nimport CanvasInstruction from './Instruction.js';\n/**\n * @const\n * @type {{left: 0, center: 0.5, right: 1, top: 0, middle: 0.5, hanging: 0.2, alphabetic: 0.8, ideographic: 0.8, bottom: 1}}\n */\nexport const TEXT_ALIGN = {\n 'left': 0,\n 'center': 0.5,\n 'right': 1,\n 'top': 0,\n 'middle': 0.5,\n 'hanging': 0.2,\n 'alphabetic': 0.8,\n 'ideographic': 0.8,\n 'bottom': 1,\n};\n\nclass CanvasTextBuilder extends CanvasBuilder {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Maximum extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n super(tolerance, maxExtent, resolution, pixelRatio);\n\n /**\n * @private\n * @type {Array<HTMLCanvasElement>}\n */\n this.labels_ = null;\n\n /**\n * @private\n * @type {string|Array<string>}\n */\n this.text_ = '';\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetX_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.textOffsetY_ = 0;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.textRotateWithView_ = undefined;\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.textKeepUpright_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.textRotation_ = 0;\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").FillState}\n */\n this.textFillState_ = null;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").FillState>}\n */\n this.fillStates = {};\n this.fillStates[defaultFillStyle] = {fillStyle: defaultFillStyle};\n\n /**\n * @private\n * @type {?import(\"../canvas.js\").StrokeState}\n */\n this.textStrokeState_ = null;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").StrokeState>}\n */\n this.strokeStates = {};\n\n /**\n * @private\n * @type {import(\"../canvas.js\").TextState}\n */\n this.textState_ = /** @type {import(\"../canvas.js\").TextState} */ ({});\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").TextState>}\n */\n this.textStates = {};\n\n /**\n * @private\n * @type {string}\n */\n this.textKey_ = '';\n\n /**\n * @private\n * @type {string}\n */\n this.fillKey_ = '';\n\n /**\n * @private\n * @type {string}\n */\n this.strokeKey_ = '';\n\n /**\n * @private\n * @type {import('../../style/Style.js').DeclutterMode}\n */\n this.declutterMode_ = undefined;\n\n /**\n * Data shared with an image builder for combined decluttering.\n * @private\n * @type {import(\"../canvas.js\").DeclutterImageWithText}\n */\n this.declutterImageWithText_ = undefined;\n }\n\n /**\n * @return {import(\"../canvas.js\").SerializableInstructions} the serializable instructions.\n * @override\n */\n finish() {\n const instructions = super.finish();\n instructions.textStates = this.textStates;\n instructions.fillStates = this.fillStates;\n instructions.strokeStates = this.strokeStates;\n return instructions;\n }\n\n /**\n * @param {import(\"../../geom/SimpleGeometry.js\").default|import(\"../Feature.js\").default} geometry Geometry.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @override\n */\n drawText(geometry, feature, index) {\n const fillState = this.textFillState_;\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n if (this.text_ === '' || !textState || (!fillState && !strokeState)) {\n return;\n }\n\n const coordinates = this.coordinates;\n let begin = coordinates.length;\n\n const geometryType = geometry.getType();\n let flatCoordinates = null;\n let stride = geometry.getStride();\n\n if (\n textState.placement === 'line' &&\n (geometryType == 'LineString' ||\n geometryType == 'MultiLineString' ||\n geometryType == 'Polygon' ||\n geometryType == 'MultiPolygon')\n ) {\n if (!intersects(this.maxExtent, geometry.getExtent())) {\n return;\n }\n let ends;\n flatCoordinates = geometry.getFlatCoordinates();\n if (geometryType == 'LineString') {\n ends = [flatCoordinates.length];\n } else if (geometryType == 'MultiLineString') {\n ends = /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ).getEnds();\n } else if (geometryType == 'Polygon') {\n ends = /** @type {import(\"../../geom/Polygon.js\").default} */ (geometry)\n .getEnds()\n .slice(0, 1);\n } else if (geometryType == 'MultiPolygon') {\n const endss =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getEndss();\n ends = [];\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n ends.push(endss[i][0]);\n }\n }\n this.beginGeometry(geometry, feature, index);\n const repeat = textState.repeat;\n const textAlign = repeat ? undefined : textState.textAlign;\n // No `justify` support for line placement.\n let flatOffset = 0;\n for (let o = 0, oo = ends.length; o < oo; ++o) {\n let chunks;\n if (repeat) {\n chunks = lineChunk(\n repeat * this.resolution,\n flatCoordinates,\n flatOffset,\n ends[o],\n stride,\n );\n } else {\n chunks = [flatCoordinates.slice(flatOffset, ends[o])];\n }\n for (let c = 0, cc = chunks.length; c < cc; ++c) {\n const chunk = chunks[c];\n let chunkBegin = 0;\n let chunkEnd = chunk.length;\n if (textAlign == undefined) {\n const range = matchingChunk(\n textState.maxAngle,\n chunk,\n 0,\n chunk.length,\n 2,\n );\n chunkBegin = range[0];\n chunkEnd = range[1];\n }\n for (let i = chunkBegin; i < chunkEnd; i += stride) {\n coordinates.push(chunk[i], chunk[i + 1]);\n }\n const end = coordinates.length;\n flatOffset = ends[o];\n this.drawChars_(begin, end);\n begin = end;\n }\n }\n this.endGeometry(feature);\n } else {\n let geometryWidths = textState.overflow ? null : [];\n switch (geometryType) {\n case 'Point':\n case 'MultiPoint':\n flatCoordinates =\n /** @type {import(\"../../geom/MultiPoint.js\").default} */ (\n geometry\n ).getFlatCoordinates();\n break;\n case 'LineString':\n flatCoordinates =\n /** @type {import(\"../../geom/LineString.js\").default} */ (\n geometry\n ).getFlatMidpoint();\n break;\n case 'Circle':\n flatCoordinates =\n /** @type {import(\"../../geom/Circle.js\").default} */ (\n geometry\n ).getCenter();\n break;\n case 'MultiLineString':\n flatCoordinates =\n /** @type {import(\"../../geom/MultiLineString.js\").default} */ (\n geometry\n ).getFlatMidpoints();\n stride = 2;\n break;\n case 'Polygon':\n flatCoordinates =\n /** @type {import(\"../../geom/Polygon.js\").default} */ (\n geometry\n ).getFlatInteriorPoint();\n if (!textState.overflow) {\n geometryWidths.push(flatCoordinates[2] / this.resolution);\n }\n stride = 3;\n break;\n case 'MultiPolygon':\n const interiorPoints =\n /** @type {import(\"../../geom/MultiPolygon.js\").default} */ (\n geometry\n ).getFlatInteriorPoints();\n flatCoordinates = [];\n for (let i = 0, ii = interiorPoints.length; i < ii; i += 3) {\n if (!textState.overflow) {\n geometryWidths.push(interiorPoints[i + 2] / this.resolution);\n }\n flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);\n }\n if (flatCoordinates.length === 0) {\n return;\n }\n stride = 2;\n break;\n default:\n }\n const end = this.appendFlatPointCoordinates(flatCoordinates, stride);\n if (end === begin) {\n return;\n }\n if (\n geometryWidths &&\n (end - begin) / 2 !== flatCoordinates.length / stride\n ) {\n let beg = begin / 2;\n geometryWidths = geometryWidths.filter((w, i) => {\n const keep =\n coordinates[(beg + i) * 2] === flatCoordinates[i * stride] &&\n coordinates[(beg + i) * 2 + 1] === flatCoordinates[i * stride + 1];\n if (!keep) {\n --beg;\n }\n return keep;\n });\n }\n\n this.saveTextStates_();\n\n const backgroundFill = textState.backgroundFill\n ? this.createFill(this.fillStyleToState(textState.backgroundFill))\n : null;\n const backgroundStroke = textState.backgroundStroke\n ? this.createStroke(this.strokeStyleToState(textState.backgroundStroke))\n : null;\n\n this.beginGeometry(geometry, feature, index);\n\n // adjust padding for negative scale\n let padding = textState.padding;\n if (\n padding != defaultPadding &&\n (textState.scale[0] < 0 || textState.scale[1] < 0)\n ) {\n let p0 = textState.padding[0];\n let p1 = textState.padding[1];\n let p2 = textState.padding[2];\n let p3 = textState.padding[3];\n if (textState.scale[0] < 0) {\n p1 = -p1;\n p3 = -p3;\n }\n if (textState.scale[1] < 0) {\n p0 = -p0;\n p2 = -p2;\n }\n padding = [p0, p1, p2, p3];\n }\n\n // The image is unknown at this stage so we pass null; it will be computed at render time.\n // For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at\n // render time.\n const pixelRatio = this.pixelRatio;\n this.instructions.push([\n CanvasInstruction.DRAW_IMAGE,\n begin,\n end,\n null,\n NaN,\n NaN,\n NaN,\n 1,\n 0,\n 0,\n this.textRotateWithView_,\n this.textRotation_,\n [1, 1],\n NaN,\n this.declutterMode_,\n this.declutterImageWithText_,\n padding == defaultPadding\n ? defaultPadding\n : padding.map(function (p) {\n return p * pixelRatio;\n }),\n backgroundFill,\n backgroundStroke,\n this.text_,\n this.textKey_,\n this.strokeKey_,\n this.fillKey_,\n this.textOffsetX_,\n this.textOffsetY_,\n geometryWidths,\n ]);\n const scale = 1 / pixelRatio;\n // Set default fill for hit detection background\n const hitDetectionBackgroundFill = backgroundFill\n ? backgroundFill.slice(0)\n : null;\n if (hitDetectionBackgroundFill) {\n hitDetectionBackgroundFill[1] = defaultFillStyle;\n }\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_IMAGE,\n begin,\n end,\n null,\n NaN,\n NaN,\n NaN,\n 1,\n 0,\n 0,\n this.textRotateWithView_,\n this.textRotation_,\n [scale, scale],\n NaN,\n this.declutterMode_,\n this.declutterImageWithText_,\n padding,\n hitDetectionBackgroundFill,\n backgroundStroke,\n this.text_,\n this.textKey_,\n this.strokeKey_,\n this.fillKey_ ? defaultFillStyle : this.fillKey_,\n this.textOffsetX_,\n this.textOffsetY_,\n geometryWidths,\n ]);\n\n this.endGeometry(feature);\n }\n }\n\n /**\n * @private\n */\n saveTextStates_() {\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n const fillState = this.textFillState_;\n\n const strokeKey = this.strokeKey_;\n if (strokeState) {\n if (!(strokeKey in this.strokeStates)) {\n this.strokeStates[strokeKey] = {\n strokeStyle: strokeState.strokeStyle,\n lineCap: strokeState.lineCap,\n lineDashOffset: strokeState.lineDashOffset,\n lineWidth: strokeState.lineWidth,\n lineJoin: strokeState.lineJoin,\n miterLimit: strokeState.miterLimit,\n lineDash: strokeState.lineDash,\n };\n }\n }\n const textKey = this.textKey_;\n if (!(textKey in this.textStates)) {\n this.textStates[textKey] = {\n font: textState.font,\n textAlign: textState.textAlign || defaultTextAlign,\n justify: textState.justify,\n textBaseline: textState.textBaseline || defaultTextBaseline,\n scale: textState.scale,\n };\n }\n const fillKey = this.fillKey_;\n if (fillState) {\n if (!(fillKey in this.fillStates)) {\n this.fillStates[fillKey] = {\n fillStyle: fillState.fillStyle,\n };\n }\n }\n }\n\n /**\n * @private\n * @param {number} begin Begin.\n * @param {number} end End.\n */\n drawChars_(begin, end) {\n const strokeState = this.textStrokeState_;\n const textState = this.textState_;\n\n const strokeKey = this.strokeKey_;\n const textKey = this.textKey_;\n const fillKey = this.fillKey_;\n this.saveTextStates_();\n\n const pixelRatio = this.pixelRatio;\n const baseline = TEXT_ALIGN[textState.textBaseline];\n\n const offsetY = this.textOffsetY_ * pixelRatio;\n const text = this.text_;\n const strokeWidth = strokeState\n ? (strokeState.lineWidth * Math.abs(textState.scale[0])) / 2\n : 0;\n\n this.instructions.push([\n CanvasInstruction.DRAW_CHARS,\n begin,\n end,\n baseline,\n textState.overflow,\n fillKey,\n textState.maxAngle,\n pixelRatio,\n offsetY,\n strokeKey,\n strokeWidth * pixelRatio,\n text,\n textKey,\n 1,\n this.declutterMode_,\n this.textKeepUpright_,\n ]);\n this.hitDetectionInstructions.push([\n CanvasInstruction.DRAW_CHARS,\n begin,\n end,\n baseline,\n textState.overflow,\n fillKey ? defaultFillStyle : fillKey,\n textState.maxAngle,\n pixelRatio,\n offsetY,\n strokeKey,\n strokeWidth * pixelRatio,\n text,\n textKey,\n 1 / pixelRatio,\n this.declutterMode_,\n this.textKeepUpright_,\n ]);\n }\n\n /**\n * @param {import(\"../../style/Text.js\").default} textStyle Text style.\n * @param {Object} [sharedData] Shared data.\n * @override\n */\n setTextStyle(textStyle, sharedData) {\n let textState, fillState, strokeState;\n if (!textStyle) {\n this.text_ = '';\n } else {\n const textFillStyle = textStyle.getFill();\n if (!textFillStyle) {\n fillState = null;\n this.textFillState_ = fillState;\n } else {\n fillState = this.textFillState_;\n if (!fillState) {\n fillState = /** @type {import(\"../canvas.js\").FillState} */ ({});\n this.textFillState_ = fillState;\n }\n fillState.fillStyle = asColorLike(\n textFillStyle.getColor() || defaultFillStyle,\n );\n }\n\n const textStrokeStyle = textStyle.getStroke();\n if (!textStrokeStyle) {\n strokeState = null;\n this.textStrokeState_ = strokeState;\n } else {\n strokeState = this.textStrokeState_;\n if (!strokeState) {\n strokeState = /** @type {import(\"../canvas.js\").StrokeState} */ ({});\n this.textStrokeState_ = strokeState;\n }\n const lineDash = textStrokeStyle.getLineDash();\n const lineDashOffset = textStrokeStyle.getLineDashOffset();\n const lineWidth = textStrokeStyle.getWidth();\n const miterLimit = textStrokeStyle.getMiterLimit();\n strokeState.lineCap = textStrokeStyle.getLineCap() || defaultLineCap;\n strokeState.lineDash = lineDash ? lineDash.slice() : defaultLineDash;\n strokeState.lineDashOffset =\n lineDashOffset === undefined ? defaultLineDashOffset : lineDashOffset;\n strokeState.lineJoin = textStrokeStyle.getLineJoin() || defaultLineJoin;\n strokeState.lineWidth =\n lineWidth === undefined ? defaultLineWidth : lineWidth;\n strokeState.miterLimit =\n miterLimit === undefined ? defaultMiterLimit : miterLimit;\n strokeState.strokeStyle = asColorLike(\n textStrokeStyle.getColor() || defaultStrokeStyle,\n );\n }\n\n textState = this.textState_;\n const font = textStyle.getFont() || defaultFont;\n registerFont(font);\n const textScale = textStyle.getScaleArray();\n textState.overflow = textStyle.getOverflow();\n textState.font = font;\n textState.maxAngle = textStyle.getMaxAngle();\n textState.placement = textStyle.getPlacement();\n textState.textAlign = textStyle.getTextAlign();\n textState.repeat = textStyle.getRepeat();\n textState.justify = textStyle.getJustify();\n textState.textBaseline =\n textStyle.getTextBaseline() || defaultTextBaseline;\n textState.backgroundFill = textStyle.getBackgroundFill();\n textState.backgroundStroke = textStyle.getBackgroundStroke();\n textState.padding = textStyle.getPadding() || defaultPadding;\n textState.scale = textScale === undefined ? [1, 1] : textScale;\n\n const textOffsetX = textStyle.getOffsetX();\n const textOffsetY = textStyle.getOffsetY();\n const textRotateWithView = textStyle.getRotateWithView();\n const textKeepUpright = textStyle.getKeepUpright();\n const textRotation = textStyle.getRotation();\n this.text_ = textStyle.getText() || '';\n this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX;\n this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY;\n this.textRotateWithView_ =\n textRotateWithView === undefined ? false : textRotateWithView;\n this.textKeepUpright_ =\n textKeepUpright === undefined ? true : textKeepUpright;\n this.textRotation_ = textRotation === undefined ? 0 : textRotation;\n\n this.strokeKey_ = strokeState\n ? (typeof strokeState.strokeStyle == 'string'\n ? strokeState.strokeStyle\n : getUid(strokeState.strokeStyle)) +\n strokeState.lineCap +\n strokeState.lineDashOffset +\n '|' +\n strokeState.lineWidth +\n strokeState.lineJoin +\n strokeState.miterLimit +\n '[' +\n strokeState.lineDash.join() +\n ']'\n : '';\n this.textKey_ =\n textState.font +\n textState.scale +\n (textState.textAlign || '?') +\n (textState.repeat || '?') +\n (textState.justify || '?') +\n (textState.textBaseline || '?');\n this.fillKey_ =\n fillState && fillState.fillStyle\n ? typeof fillState.fillStyle == 'string'\n ? fillState.fillStyle\n : '|' + getUid(fillState.fillStyle)\n : '';\n }\n this.declutterMode_ = textStyle.getDeclutterMode();\n this.declutterImageWithText_ = sharedData;\n }\n}\n\nexport default CanvasTextBuilder;\n","/**\n * @module ol/render/canvas/BuilderGroup\n */\n\nimport Builder from './Builder.js';\nimport ImageBuilder from './ImageBuilder.js';\nimport LineStringBuilder from './LineStringBuilder.js';\nimport PolygonBuilder from './PolygonBuilder.js';\nimport TextBuilder from './TextBuilder.js';\n\n/**\n * @type {Object<import(\"../canvas.js\").BuilderType, typeof Builder>}\n */\nconst BATCH_CONSTRUCTORS = {\n 'Circle': PolygonBuilder,\n 'Default': Builder,\n 'Image': ImageBuilder,\n 'LineString': LineStringBuilder,\n 'Polygon': PolygonBuilder,\n 'Text': TextBuilder,\n};\n\nclass BuilderGroup {\n /**\n * @param {number} tolerance Tolerance.\n * @param {import(\"../../extent.js\").Extent} maxExtent Max extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n */\n constructor(tolerance, maxExtent, resolution, pixelRatio) {\n /**\n * @private\n * @type {number}\n */\n this.tolerance_ = tolerance;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent_ = maxExtent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.resolution_ = resolution;\n\n /**\n * @private\n * @type {!Object<string, !Object<import(\"../canvas.js\").BuilderType, Builder>>}\n */\n this.buildersByZIndex_ = {};\n }\n\n /**\n * @return {!Object<string, !Object<import(\"../canvas.js\").BuilderType, import(\"./Builder.js\").SerializableInstructions>>} The serializable instructions\n */\n finish() {\n const builderInstructions = {};\n for (const zKey in this.buildersByZIndex_) {\n builderInstructions[zKey] = builderInstructions[zKey] || {};\n const builders = this.buildersByZIndex_[zKey];\n for (const builderKey in builders) {\n const builderInstruction = builders[builderKey].finish();\n builderInstructions[zKey][builderKey] = builderInstruction;\n }\n }\n return builderInstructions;\n }\n\n /**\n * @param {number|undefined} zIndex Z index.\n * @param {import(\"../canvas.js\").BuilderType} builderType Replay type.\n * @return {import(\"../VectorContext.js\").default} Replay.\n */\n getBuilder(zIndex, builderType) {\n const zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';\n let replays = this.buildersByZIndex_[zIndexKey];\n if (replays === undefined) {\n replays = {};\n this.buildersByZIndex_[zIndexKey] = replays;\n }\n let replay = replays[builderType];\n if (replay === undefined) {\n const Constructor = BATCH_CONSTRUCTORS[builderType];\n replay = new Constructor(\n this.tolerance_,\n this.maxExtent_,\n this.resolution_,\n this.pixelRatio_,\n );\n replays[builderType] = replay;\n }\n return replay;\n }\n}\n\nexport default BuilderGroup;\n","/**\n * @module ol/geom/flat/textpath\n */\nimport {lerp} from '../../math.js';\nimport {rotate} from './transform.js';\n\n/**\n * @param {Array<number>} flatCoordinates Path to put text on.\n * @param {number} offset Start offset of the `flatCoordinates`.\n * @param {number} end End offset of the `flatCoordinates`.\n * @param {number} stride Stride.\n * @param {string} text Text to place on the path.\n * @param {number} startM m along the path where the text starts.\n * @param {number} maxAngle Max angle between adjacent chars in radians.\n * @param {number} scale The product of the text scale and the device pixel ratio.\n * @param {function(string, string, Object<string, number>):number} measureAndCacheTextWidth Measure and cache text width.\n * @param {string} font The font.\n * @param {Object<string, number>} cache A cache of measured widths.\n * @param {number} rotation Rotation to apply to the flatCoordinates to determine whether text needs to be reversed.\n * @param {boolean} keepUpright Whether the text needs to be kept upright\n * @return {Array<Array<*>>|null} The result array (or null if `maxAngle` was\n * exceeded). Entries of the array are x, y, anchorX, angle, chunk.\n */\nexport function drawTextOnPath(\n flatCoordinates,\n offset,\n end,\n stride,\n text,\n startM,\n maxAngle,\n scale,\n measureAndCacheTextWidth,\n font,\n cache,\n rotation,\n keepUpright = true,\n) {\n let x2 = flatCoordinates[offset];\n let y2 = flatCoordinates[offset + 1];\n let x1 = 0;\n let y1 = 0;\n let segmentLength = 0;\n let segmentM = 0;\n\n function advance() {\n x1 = x2;\n y1 = y2;\n offset += stride;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n segmentM += segmentLength;\n segmentLength = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n }\n do {\n advance();\n } while (offset < end - stride && segmentM + segmentLength < startM);\n\n let interpolate =\n segmentLength === 0 ? 0 : (startM - segmentM) / segmentLength;\n const beginX = lerp(x1, x2, interpolate);\n const beginY = lerp(y1, y2, interpolate);\n\n const startOffset = offset - stride;\n const startLength = segmentM;\n const endM = startM + scale * measureAndCacheTextWidth(font, text, cache);\n while (offset < end - stride && segmentM + segmentLength < endM) {\n advance();\n }\n interpolate = segmentLength === 0 ? 0 : (endM - segmentM) / segmentLength;\n const endX = lerp(x1, x2, interpolate);\n const endY = lerp(y1, y2, interpolate);\n\n // Keep text upright if the option is selected\n let reverse = false;\n if (keepUpright) {\n if (rotation) {\n const flat = [beginX, beginY, endX, endY];\n rotate(flat, 0, 4, 2, rotation, flat, flat);\n reverse = flat[0] > flat[2];\n } else {\n reverse = beginX > endX;\n }\n }\n\n const PI = Math.PI;\n const result = [];\n const singleSegment = startOffset + stride === offset;\n\n offset = startOffset;\n segmentLength = 0;\n segmentM = startLength;\n x2 = flatCoordinates[offset];\n y2 = flatCoordinates[offset + 1];\n\n let previousAngle;\n // All on the same segment\n if (singleSegment) {\n advance();\n\n previousAngle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n previousAngle += previousAngle > 0 ? -PI : PI;\n }\n const x = (endX + beginX) / 2;\n const y = (endY + beginY) / 2;\n result[0] = [x, y, (endM - startM) / 2, previousAngle, text];\n return result;\n }\n\n // rendering across line segments\n text = text.replace(/\\n/g, ' '); // ensure rendering in single-line as all calculations below don't handle multi-lines\n\n for (let i = 0, ii = text.length; i < ii; ) {\n advance();\n let angle = Math.atan2(y2 - y1, x2 - x1);\n if (reverse) {\n angle += angle > 0 ? -PI : PI;\n }\n if (previousAngle !== undefined) {\n let delta = angle - previousAngle;\n delta += delta > PI ? -2 * PI : delta < -PI ? 2 * PI : 0;\n if (Math.abs(delta) > maxAngle) {\n return null;\n }\n }\n previousAngle = angle;\n\n const iStart = i;\n let charLength = 0;\n for (; i < ii; ++i) {\n const index = reverse ? ii - i - 1 : i;\n const len = scale * measureAndCacheTextWidth(font, text[index], cache);\n if (\n offset + stride < end &&\n segmentM + segmentLength < startM + charLength + len / 2\n ) {\n break;\n }\n charLength += len;\n }\n if (i === iStart) {\n continue;\n }\n const chars = reverse\n ? text.substring(ii - iStart, ii - i)\n : text.substring(iStart, i);\n interpolate =\n segmentLength === 0\n ? 0\n : (startM + charLength / 2 - segmentM) / segmentLength;\n const x = lerp(x1, x2, interpolate);\n const y = lerp(y1, y2, interpolate);\n result.push([x, y, charLength / 2, angle, chars]);\n startM += charLength;\n }\n return result;\n}\n","/**\n * @module ol/render/canvas/Executor\n */\nimport {equals} from '../../array.js';\nimport {createEmpty, createOrUpdate, intersects} from '../../extent.js';\nimport {lineStringLength} from '../../geom/flat/length.js';\nimport {drawTextOnPath} from '../../geom/flat/textpath.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {\n apply as applyTransform,\n compose as composeTransform,\n create as createTransform,\n setFromArray as transformSetFromArray,\n} from '../../transform.js';\nimport ZIndexContext from '../canvas/ZIndexContext.js';\nimport {\n defaultPadding,\n defaultTextAlign,\n defaultTextBaseline,\n drawImageOrLabel,\n getTextDimensions,\n measureAndCacheTextWidth,\n} from '../canvas.js';\nimport CanvasInstruction from './Instruction.js';\nimport {TEXT_ALIGN} from './TextBuilder.js';\n\n/**\n * @typedef {import('../../structs/RBush.js').Entry<import('../../Feature.js').FeatureLike>} DeclutterEntry\n */\n\n/**\n * @typedef {Object} ImageOrLabelDimensions\n * @property {number} drawImageX DrawImageX.\n * @property {number} drawImageY DrawImageY.\n * @property {number} drawImageW DrawImageW.\n * @property {number} drawImageH DrawImageH.\n * @property {number} originX OriginX.\n * @property {number} originY OriginY.\n * @property {Array<number>} scale Scale.\n * @property {DeclutterEntry} declutterBox DeclutterBox.\n * @property {import(\"../../transform.js\").Transform} canvasTransform CanvasTransform.\n */\n\n/**\n * @typedef {{0: CanvasRenderingContext2D, 1: import('../../size.js').Size, 2: import(\"../canvas.js\").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement, 3: ImageOrLabelDimensions, 4: number, 5: Array<*>, 6: Array<*>}} ReplayImageOrLabelArgs\n */\n\n/**\n * @template T\n * @typedef {function(import(\"../../Feature.js\").FeatureLike, import(\"../../geom/SimpleGeometry.js\").default, import(\"../../style/Style.js\").DeclutterMode): T} FeatureCallback\n */\n\n/**\n * @type {import(\"../../extent.js\").Extent}\n */\nconst tmpExtent = createEmpty();\n\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p1 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p2 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p3 = [];\n/** @type {import(\"../../coordinate.js\").Coordinate} */\nconst p4 = [];\n\n/**\n * @param {ReplayImageOrLabelArgs} replayImageOrLabelArgs Arguments to replayImageOrLabel\n * @return {DeclutterEntry} Declutter rbush entry.\n */\nfunction getDeclutterBox(replayImageOrLabelArgs) {\n return replayImageOrLabelArgs[3].declutterBox;\n}\n\nconst rtlRegEx = new RegExp(\n /* eslint-disable prettier/prettier */\n '[' +\n String.fromCharCode(0x00591) + '-' + String.fromCharCode(0x008ff) +\n String.fromCharCode(0x0fb1d) + '-' + String.fromCharCode(0x0fdff) +\n String.fromCharCode(0x0fe70) + '-' + String.fromCharCode(0x0fefc) +\n String.fromCharCode(0x10800) + '-' + String.fromCharCode(0x10fff) +\n String.fromCharCode(0x1e800) + '-' + String.fromCharCode(0x1efff) +\n ']'\n /* eslint-enable prettier/prettier */\n);\n\n/**\n * @param {string} text Text.\n * @param {CanvasTextAlign} align Alignment.\n * @return {number} Text alignment.\n */\nfunction horizontalTextAlign(text, align) {\n if (align === 'start') {\n align = rtlRegEx.test(text) ? 'right' : 'left';\n } else if (align === 'end') {\n align = rtlRegEx.test(text) ? 'left' : 'right';\n }\n return TEXT_ALIGN[align];\n}\n\n/**\n * @param {Array<string>} acc Accumulator.\n * @param {string} line Line of text.\n * @param {number} i Index\n * @return {Array<string>} Accumulator.\n */\nfunction createTextChunks(acc, line, i) {\n if (i > 0) {\n acc.push('\\n', '');\n }\n acc.push(line, '');\n return acc;\n}\n\n/**\n * Converts rich text to plain text for text along lines.\n * @param {string} result The resulting plain text.\n * @param {string} part Item of the rich text array.\n * @param {number} index Index of the item in the rich text array.\n * @return {string} The resulting plain text.\n */\nfunction richTextToPlainText(result, part, index) {\n if (index % 2 === 0) {\n result += part;\n }\n return result;\n}\n\nclass Executor {\n /**\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {boolean} overlaps The replay can have overlapping geometries.\n * @param {import(\"../canvas.js\").SerializableInstructions} instructions The serializable instructions.\n * @param {boolean} [deferredRendering] Enable deferred rendering.\n */\n constructor(\n resolution,\n pixelRatio,\n overlaps,\n instructions,\n deferredRendering,\n ) {\n /**\n * @protected\n * @type {boolean}\n */\n this.overlaps = overlaps;\n\n /**\n * @protected\n * @type {number}\n */\n this.pixelRatio = pixelRatio;\n\n /**\n * @protected\n * @const\n * @type {number}\n */\n this.resolution = resolution;\n\n /**\n * @private\n * @type {number}\n */\n this.alignAndScaleFill_;\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.instructions = instructions.instructions;\n\n /**\n * @protected\n * @type {Array<number>}\n */\n this.coordinates = instructions.coordinates;\n\n /**\n * @private\n * @type {!Object<number,import(\"../../coordinate.js\").Coordinate|Array<import(\"../../coordinate.js\").Coordinate>|Array<Array<import(\"../../coordinate.js\").Coordinate>>>}\n */\n this.coordinateCache_ = {};\n\n /**\n * @private\n * @type {!import(\"../../transform.js\").Transform}\n */\n this.renderedTransform_ = createTransform();\n\n /**\n * @protected\n * @type {Array<*>}\n */\n this.hitDetectionInstructions = instructions.hitDetectionInstructions;\n\n /**\n * @private\n * @type {Array<number>}\n */\n this.pixelCoordinates_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.viewRotation_ = 0;\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").FillState>}\n */\n this.fillStates = instructions.fillStates || {};\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").StrokeState>}\n */\n this.strokeStates = instructions.strokeStates || {};\n\n /**\n * @type {!Object<string, import(\"../canvas.js\").TextState>}\n */\n this.textStates = instructions.textStates || {};\n\n /**\n * @private\n * @type {Object<string, Object<string, number>>}\n */\n this.widths_ = {};\n\n /**\n * @private\n * @type {Object<string, import(\"../canvas.js\").Label>}\n */\n this.labels_ = {};\n\n /**\n * @private\n * @type {import(\"../canvas/ZIndexContext.js\").default}\n */\n this.zIndexContext_ = deferredRendering ? new ZIndexContext() : null;\n }\n\n /**\n * @return {ZIndexContext} ZIndex context.\n */\n getZIndexContext() {\n return this.zIndexContext_;\n }\n\n /**\n * @param {string|Array<string>} text Text.\n * @param {string} textKey Text style key.\n * @param {string} fillKey Fill style key.\n * @param {string} strokeKey Stroke style key.\n * @return {import(\"../canvas.js\").Label} Label.\n */\n createLabel(text, textKey, fillKey, strokeKey) {\n const key = text + textKey + fillKey + strokeKey;\n if (this.labels_[key]) {\n return this.labels_[key];\n }\n const strokeState = strokeKey ? this.strokeStates[strokeKey] : null;\n const fillState = fillKey ? this.fillStates[fillKey] : null;\n const textState = this.textStates[textKey];\n const pixelRatio = this.pixelRatio;\n const scale = [\n textState.scale[0] * pixelRatio,\n textState.scale[1] * pixelRatio,\n ];\n const align = textState.justify\n ? TEXT_ALIGN[textState.justify]\n : horizontalTextAlign(\n Array.isArray(text) ? text[0] : text,\n textState.textAlign || defaultTextAlign,\n );\n const strokeWidth =\n strokeKey && strokeState.lineWidth ? strokeState.lineWidth : 0;\n\n const chunks = Array.isArray(text)\n ? text\n : String(text).split('\\n').reduce(createTextChunks, []);\n\n const {width, height, widths, heights, lineWidths} = getTextDimensions(\n textState,\n chunks,\n );\n const renderWidth = width + strokeWidth;\n const contextInstructions = [];\n // make canvas 2 pixels wider to account for italic text width measurement errors\n const w = (renderWidth + 2) * scale[0];\n const h = (height + strokeWidth) * scale[1];\n /** @type {import(\"../canvas.js\").Label} */\n const label = {\n width: w < 0 ? Math.floor(w) : Math.ceil(w),\n height: h < 0 ? Math.floor(h) : Math.ceil(h),\n contextInstructions: contextInstructions,\n };\n if (scale[0] != 1 || scale[1] != 1) {\n contextInstructions.push('scale', scale);\n }\n if (strokeKey) {\n contextInstructions.push('strokeStyle', strokeState.strokeStyle);\n contextInstructions.push('lineWidth', strokeWidth);\n contextInstructions.push('lineCap', strokeState.lineCap);\n contextInstructions.push('lineJoin', strokeState.lineJoin);\n contextInstructions.push('miterLimit', strokeState.miterLimit);\n contextInstructions.push('setLineDash', [strokeState.lineDash]);\n contextInstructions.push('lineDashOffset', strokeState.lineDashOffset);\n }\n if (fillKey) {\n contextInstructions.push('fillStyle', fillState.fillStyle);\n }\n contextInstructions.push('textBaseline', 'middle');\n contextInstructions.push('textAlign', 'center');\n const leftRight = 0.5 - align;\n let x = align * renderWidth + leftRight * strokeWidth;\n const strokeInstructions = [];\n const fillInstructions = [];\n let lineHeight = 0;\n let lineOffset = 0;\n let widthHeightIndex = 0;\n let lineWidthIndex = 0;\n let previousFont;\n for (let i = 0, ii = chunks.length; i < ii; i += 2) {\n const text = chunks[i];\n if (text === '\\n') {\n lineOffset += lineHeight;\n lineHeight = 0;\n x = align * renderWidth + leftRight * strokeWidth;\n ++lineWidthIndex;\n continue;\n }\n const font = chunks[i + 1] || textState.font;\n if (font !== previousFont) {\n if (strokeKey) {\n strokeInstructions.push('font', font);\n }\n if (fillKey) {\n fillInstructions.push('font', font);\n }\n previousFont = font;\n }\n lineHeight = Math.max(lineHeight, heights[widthHeightIndex]);\n const fillStrokeArgs = [\n text,\n x +\n leftRight * widths[widthHeightIndex] +\n align * (widths[widthHeightIndex] - lineWidths[lineWidthIndex]),\n 0.5 * (strokeWidth + lineHeight) + lineOffset,\n ];\n x += widths[widthHeightIndex];\n if (strokeKey) {\n strokeInstructions.push('strokeText', fillStrokeArgs);\n }\n if (fillKey) {\n fillInstructions.push('fillText', fillStrokeArgs);\n }\n ++widthHeightIndex;\n }\n Array.prototype.push.apply(contextInstructions, strokeInstructions);\n Array.prototype.push.apply(contextInstructions, fillInstructions);\n this.labels_[key] = label;\n return label;\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../coordinate.js\").Coordinate} p1 1st point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p2 2nd point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p3 3rd point of the background box.\n * @param {import(\"../../coordinate.js\").Coordinate} p4 4th point of the background box.\n * @param {Array<*>} fillInstruction Fill instruction.\n * @param {Array<*>} strokeInstruction Stroke instruction.\n */\n replayTextBackground_(\n context,\n p1,\n p2,\n p3,\n p4,\n fillInstruction,\n strokeInstruction,\n ) {\n context.beginPath();\n context.moveTo.apply(context, p1);\n context.lineTo.apply(context, p2);\n context.lineTo.apply(context, p3);\n context.lineTo.apply(context, p4);\n context.lineTo.apply(context, p1);\n if (fillInstruction) {\n this.alignAndScaleFill_ = /** @type {number} */ (fillInstruction[2]);\n context.fillStyle = /** @type {string} */ (fillInstruction[1]);\n this.fill_(context);\n }\n if (strokeInstruction) {\n this.setStrokeStyle_(\n context,\n /** @type {Array<*>} */ (strokeInstruction),\n );\n context.stroke();\n }\n }\n\n /**\n * @private\n * @param {number} sheetWidth Width of the sprite sheet.\n * @param {number} sheetHeight Height of the sprite sheet.\n * @param {number} centerX X.\n * @param {number} centerY Y.\n * @param {number} width Width.\n * @param {number} height Height.\n * @param {number} anchorX Anchor X.\n * @param {number} anchorY Anchor Y.\n * @param {number} originX Origin X.\n * @param {number} originY Origin Y.\n * @param {number} rotation Rotation.\n * @param {import(\"../../size.js\").Size} scale Scale.\n * @param {boolean} snapToPixel Snap to pixel.\n * @param {Array<number>} padding Padding.\n * @param {boolean} fillStroke Background fill or stroke.\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @return {ImageOrLabelDimensions} Dimensions for positioning and decluttering the image or label.\n */\n calculateImageOrLabelDimensions_(\n sheetWidth,\n sheetHeight,\n centerX,\n centerY,\n width,\n height,\n anchorX,\n anchorY,\n originX,\n originY,\n rotation,\n scale,\n snapToPixel,\n padding,\n fillStroke,\n feature,\n ) {\n anchorX *= scale[0];\n anchorY *= scale[1];\n let x = centerX - anchorX;\n let y = centerY - anchorY;\n\n const w = width + originX > sheetWidth ? sheetWidth - originX : width;\n const h = height + originY > sheetHeight ? sheetHeight - originY : height;\n const boxW = padding[3] + w * scale[0] + padding[1];\n const boxH = padding[0] + h * scale[1] + padding[2];\n const boxX = x - padding[3];\n const boxY = y - padding[0];\n\n if (fillStroke || rotation !== 0) {\n p1[0] = boxX;\n p4[0] = boxX;\n p1[1] = boxY;\n p2[1] = boxY;\n p2[0] = boxX + boxW;\n p3[0] = p2[0];\n p3[1] = boxY + boxH;\n p4[1] = p3[1];\n }\n\n let transform;\n if (rotation !== 0) {\n transform = composeTransform(\n createTransform(),\n centerX,\n centerY,\n 1,\n 1,\n rotation,\n -centerX,\n -centerY,\n );\n\n applyTransform(transform, p1);\n applyTransform(transform, p2);\n applyTransform(transform, p3);\n applyTransform(transform, p4);\n createOrUpdate(\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1]),\n tmpExtent,\n );\n } else {\n createOrUpdate(\n Math.min(boxX, boxX + boxW),\n Math.min(boxY, boxY + boxH),\n Math.max(boxX, boxX + boxW),\n Math.max(boxY, boxY + boxH),\n tmpExtent,\n );\n }\n if (snapToPixel) {\n x = Math.round(x);\n y = Math.round(y);\n }\n return {\n drawImageX: x,\n drawImageY: y,\n drawImageW: w,\n drawImageH: h,\n originX: originX,\n originY: originY,\n declutterBox: {\n minX: tmpExtent[0],\n minY: tmpExtent[1],\n maxX: tmpExtent[2],\n maxY: tmpExtent[3],\n value: feature,\n },\n canvasTransform: transform,\n scale: scale,\n };\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size.\n * @param {import(\"../canvas.js\").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.\n * @param {ImageOrLabelDimensions} dimensions Dimensions.\n * @param {number} opacity Opacity.\n * @param {Array<*>} fillInstruction Fill instruction.\n * @param {Array<*>} strokeInstruction Stroke instruction.\n * @return {boolean} The image or label was rendered.\n */\n replayImageOrLabel_(\n context,\n scaledCanvasSize,\n imageOrLabel,\n dimensions,\n opacity,\n fillInstruction,\n strokeInstruction,\n ) {\n const fillStroke = !!(fillInstruction || strokeInstruction);\n\n const box = dimensions.declutterBox;\n const strokePadding = strokeInstruction\n ? (strokeInstruction[2] * dimensions.scale[0]) / 2\n : 0;\n const intersects =\n box.minX - strokePadding <= scaledCanvasSize[0] &&\n box.maxX + strokePadding >= 0 &&\n box.minY - strokePadding <= scaledCanvasSize[1] &&\n box.maxY + strokePadding >= 0;\n\n if (intersects) {\n if (fillStroke) {\n this.replayTextBackground_(\n context,\n p1,\n p2,\n p3,\n p4,\n /** @type {Array<*>} */ (fillInstruction),\n /** @type {Array<*>} */ (strokeInstruction),\n );\n }\n drawImageOrLabel(\n context,\n dimensions.canvasTransform,\n opacity,\n imageOrLabel,\n dimensions.originX,\n dimensions.originY,\n dimensions.drawImageW,\n dimensions.drawImageH,\n dimensions.drawImageX,\n dimensions.drawImageY,\n dimensions.scale,\n );\n }\n return true;\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n */\n fill_(context) {\n const alignAndScale = this.alignAndScaleFill_;\n if (alignAndScale) {\n const origin = applyTransform(this.renderedTransform_, [0, 0]);\n const repeatSize = 512 * this.pixelRatio;\n context.save();\n context.translate(origin[0] % repeatSize, origin[1] % repeatSize);\n if (alignAndScale !== 1) {\n context.scale(alignAndScale, alignAndScale);\n }\n context.rotate(this.viewRotation_);\n }\n context.fill();\n if (alignAndScale) {\n context.restore();\n }\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n * @param {Array<*>} instruction Instruction.\n */\n setStrokeStyle_(context, instruction) {\n context.strokeStyle =\n /** @type {import(\"../../colorlike.js\").ColorLike} */ (instruction[1]);\n if (!instruction[1]) {\n return;\n }\n context.lineWidth = /** @type {number} */ (instruction[2]);\n context.lineCap = /** @type {CanvasLineCap} */ (instruction[3]);\n context.lineJoin = /** @type {CanvasLineJoin} */ (instruction[4]);\n context.miterLimit = /** @type {number} */ (instruction[5]);\n context.lineDashOffset = /** @type {number} */ (instruction[7]);\n context.setLineDash(/** @type {Array<number>} */ (instruction[6]));\n }\n\n /**\n * @private\n * @param {string|Array<string>} text The text to draw.\n * @param {string} textKey The key of the text state.\n * @param {string} strokeKey The key for the stroke state.\n * @param {string} fillKey The key for the fill state.\n * @return {{label: import(\"../canvas.js\").Label, anchorX: number, anchorY: number}} The text image and its anchor.\n */\n drawLabelWithPointPlacement_(text, textKey, strokeKey, fillKey) {\n const textState = this.textStates[textKey];\n\n const label = this.createLabel(text, textKey, fillKey, strokeKey);\n\n const strokeState = this.strokeStates[strokeKey];\n const pixelRatio = this.pixelRatio;\n const align = horizontalTextAlign(\n Array.isArray(text) ? text[0] : text,\n textState.textAlign || defaultTextAlign,\n );\n const baseline = TEXT_ALIGN[textState.textBaseline || defaultTextBaseline];\n const strokeWidth =\n strokeState && strokeState.lineWidth ? strokeState.lineWidth : 0;\n\n // Remove the 2 pixels we added in createLabel() for the anchor\n const width = label.width / pixelRatio - 2 * textState.scale[0];\n const anchorX = align * width + 2 * (0.5 - align) * strokeWidth;\n const anchorY =\n (baseline * label.height) / pixelRatio +\n 2 * (0.5 - baseline) * strokeWidth;\n\n return {\n label: label,\n anchorX: anchorX,\n anchorY: anchorY,\n };\n }\n\n /**\n * @private\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {Array<*>} instructions Instructions array.\n * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.\n * @param {FeatureCallback<T>} [featureCallback] Feature callback.\n * @param {import(\"../../extent.js\").Extent} [hitExtent] Only check\n * features that intersect this extent.\n * @param {import(\"rbush\").default<DeclutterEntry>} [declutterTree] Declutter tree.\n * @return {T|undefined} Callback result.\n * @template T\n */\n execute_(\n context,\n scaledCanvasSize,\n transform,\n instructions,\n snapToPixel,\n featureCallback,\n hitExtent,\n declutterTree,\n ) {\n const zIndexContext = this.zIndexContext_;\n /** @type {Array<number>} */\n let pixelCoordinates;\n if (this.pixelCoordinates_ && equals(transform, this.renderedTransform_)) {\n pixelCoordinates = this.pixelCoordinates_;\n } else {\n if (!this.pixelCoordinates_) {\n this.pixelCoordinates_ = [];\n }\n pixelCoordinates = transform2D(\n this.coordinates,\n 0,\n this.coordinates.length,\n 2,\n transform,\n this.pixelCoordinates_,\n );\n transformSetFromArray(this.renderedTransform_, transform);\n }\n let i = 0; // instruction index\n const ii = instructions.length; // end of instructions\n let d = 0; // data index\n let dd; // end of per-instruction data\n let anchorX,\n anchorY,\n /** @type {import('../../style/Style.js').DeclutterMode} */\n declutterMode,\n prevX,\n prevY,\n roundX,\n roundY,\n image,\n text,\n textKey,\n strokeKey,\n fillKey;\n let pendingFill = 0;\n let pendingStroke = 0;\n const coordinateCache = this.coordinateCache_;\n const viewRotation = this.viewRotation_;\n const viewRotationFromTransform =\n Math.round(Math.atan2(-transform[1], transform[0]) * 1e12) / 1e12;\n\n const state = /** @type {import(\"../../render.js\").State} */ ({\n context: context,\n pixelRatio: this.pixelRatio,\n resolution: this.resolution,\n rotation: viewRotation,\n });\n\n // When the batch size gets too big, performance decreases. 200 is a good\n // balance between batch size and number of fill/stroke instructions.\n const batchSize =\n this.instructions != instructions || this.overlaps ? 0 : 200;\n let /** @type {import(\"../../Feature.js\").FeatureLike} */ feature;\n let x, y, currentGeometry;\n while (i < ii) {\n const instruction = instructions[i];\n const type = /** @type {import(\"./Instruction.js\").default} */ (\n instruction[0]\n );\n switch (type) {\n case CanvasInstruction.BEGIN_GEOMETRY:\n feature = /** @type {import(\"../../Feature.js\").FeatureLike} */ (\n instruction[1]\n );\n currentGeometry = instruction[3];\n if (!feature.getGeometry()) {\n i = /** @type {number} */ (instruction[2]);\n } else if (\n hitExtent !== undefined &&\n !intersects(hitExtent, currentGeometry.getExtent())\n ) {\n i = /** @type {number} */ (instruction[2]) + 1;\n } else {\n ++i;\n }\n if (zIndexContext) {\n zIndexContext.zIndex = instruction[4];\n }\n break;\n case CanvasInstruction.BEGIN_PATH:\n if (pendingFill > batchSize) {\n this.fill_(context);\n pendingFill = 0;\n }\n if (pendingStroke > batchSize) {\n context.stroke();\n pendingStroke = 0;\n }\n if (!pendingFill && !pendingStroke) {\n context.beginPath();\n prevX = NaN;\n prevY = NaN;\n }\n ++i;\n break;\n case CanvasInstruction.CIRCLE:\n d = /** @type {number} */ (instruction[1]);\n const x1 = pixelCoordinates[d];\n const y1 = pixelCoordinates[d + 1];\n const x2 = pixelCoordinates[d + 2];\n const y2 = pixelCoordinates[d + 3];\n const dx = x2 - x1;\n const dy = y2 - y1;\n const r = Math.sqrt(dx * dx + dy * dy);\n context.moveTo(x1 + r, y1);\n context.arc(x1, y1, r, 0, 2 * Math.PI, true);\n ++i;\n break;\n case CanvasInstruction.CLOSE_PATH:\n context.closePath();\n ++i;\n break;\n case CanvasInstruction.CUSTOM:\n d = /** @type {number} */ (instruction[1]);\n dd = instruction[2];\n const geometry =\n /** @type {import(\"../../geom/SimpleGeometry.js\").default} */ (\n instruction[3]\n );\n const renderer = instruction[4];\n const fn = instruction[5];\n state.geometry = geometry;\n state.feature = feature;\n if (!(i in coordinateCache)) {\n coordinateCache[i] = [];\n }\n const coords = coordinateCache[i];\n if (fn) {\n fn(pixelCoordinates, d, dd, 2, coords);\n } else {\n coords[0] = pixelCoordinates[d];\n coords[1] = pixelCoordinates[d + 1];\n coords.length = 2;\n }\n if (zIndexContext) {\n zIndexContext.zIndex = instruction[6];\n }\n renderer(coords, state);\n ++i;\n break;\n case CanvasInstruction.DRAW_IMAGE:\n d = /** @type {number} */ (instruction[1]);\n dd = /** @type {number} */ (instruction[2]);\n image =\n /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */ (\n instruction[3]\n );\n\n // Remaining arguments in DRAW_IMAGE are in alphabetical order\n anchorX = /** @type {number} */ (instruction[4]);\n anchorY = /** @type {number} */ (instruction[5]);\n let height = /** @type {number} */ (instruction[6]);\n const opacity = /** @type {number} */ (instruction[7]);\n const originX = /** @type {number} */ (instruction[8]);\n const originY = /** @type {number} */ (instruction[9]);\n const rotateWithView = /** @type {boolean} */ (instruction[10]);\n let rotation = /** @type {number} */ (instruction[11]);\n const scale = /** @type {import(\"../../size.js\").Size} */ (\n instruction[12]\n );\n let width = /** @type {number} */ (instruction[13]);\n declutterMode = instruction[14] || 'declutter';\n const declutterImageWithText =\n /** @type {{args: import(\"../canvas.js\").DeclutterImageWithText, declutterMode: import('../../style/Style.js').DeclutterMode}} */ (\n instruction[15]\n );\n\n if (!image && instruction.length >= 20) {\n // create label images\n text = /** @type {string} */ (instruction[19]);\n textKey = /** @type {string} */ (instruction[20]);\n strokeKey = /** @type {string} */ (instruction[21]);\n fillKey = /** @type {string} */ (instruction[22]);\n const labelWithAnchor = this.drawLabelWithPointPlacement_(\n text,\n textKey,\n strokeKey,\n fillKey,\n );\n image = labelWithAnchor.label;\n instruction[3] = image;\n const textOffsetX = /** @type {number} */ (instruction[23]);\n anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;\n instruction[4] = anchorX;\n const textOffsetY = /** @type {number} */ (instruction[24]);\n anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;\n instruction[5] = anchorY;\n height = image.height;\n instruction[6] = height;\n width = image.width;\n instruction[13] = width;\n }\n\n let geometryWidths;\n if (instruction.length > 25) {\n geometryWidths = /** @type {number} */ (instruction[25]);\n }\n\n let padding, backgroundFillInstruction, backgroundStrokeInstruction;\n if (instruction.length > 17) {\n padding = /** @type {Array<number>} */ (instruction[16]);\n backgroundFillInstruction = /** @type {Array<*>} */ (\n instruction[17]\n );\n backgroundStrokeInstruction = /** @type {Array<*>} */ (\n instruction[18]\n );\n } else {\n padding = defaultPadding;\n backgroundFillInstruction = null;\n backgroundStrokeInstruction = null;\n }\n\n if (rotateWithView && viewRotationFromTransform) {\n // Canvas is expected to be rotated to reverse view rotation.\n rotation += viewRotation;\n } else if (!rotateWithView && !viewRotationFromTransform) {\n // Canvas is not rotated, images need to be rotated back to be north-up.\n rotation -= viewRotation;\n }\n let widthIndex = 0;\n for (; d < dd; d += 2) {\n if (\n geometryWidths &&\n geometryWidths[widthIndex++] < width / this.pixelRatio\n ) {\n continue;\n }\n const dimensions = this.calculateImageOrLabelDimensions_(\n image.width,\n image.height,\n pixelCoordinates[d],\n pixelCoordinates[d + 1],\n width,\n height,\n anchorX,\n anchorY,\n originX,\n originY,\n rotation,\n scale,\n snapToPixel,\n padding,\n !!backgroundFillInstruction || !!backgroundStrokeInstruction,\n feature,\n );\n /** @type {ReplayImageOrLabelArgs} */\n const args = [\n context,\n scaledCanvasSize,\n image,\n dimensions,\n opacity,\n backgroundFillInstruction,\n backgroundStrokeInstruction,\n ];\n if (declutterTree) {\n let imageArgs, imageDeclutterMode, imageDeclutterBox;\n if (declutterImageWithText) {\n const index = dd - d;\n if (!declutterImageWithText[index]) {\n // We now have the image for an image+text combination.\n declutterImageWithText[index] = {args, declutterMode};\n // Don't render anything for now, wait for the text.\n continue;\n }\n const imageDeclutter = declutterImageWithText[index];\n imageArgs = imageDeclutter.args;\n imageDeclutterMode = imageDeclutter.declutterMode;\n delete declutterImageWithText[index];\n imageDeclutterBox = getDeclutterBox(imageArgs);\n }\n // We now have image and text for an image+text combination.\n let renderImage, renderText;\n if (\n imageArgs &&\n (imageDeclutterMode !== 'declutter' ||\n !declutterTree.collides(imageDeclutterBox))\n ) {\n renderImage = true;\n }\n if (\n declutterMode !== 'declutter' ||\n !declutterTree.collides(dimensions.declutterBox)\n ) {\n renderText = true;\n }\n if (\n imageDeclutterMode === 'declutter' &&\n declutterMode === 'declutter'\n ) {\n const render = renderImage && renderText;\n renderImage = render;\n renderText = render;\n }\n if (renderImage) {\n if (imageDeclutterMode !== 'none') {\n declutterTree.insert(imageDeclutterBox);\n }\n this.replayImageOrLabel_.apply(this, imageArgs);\n }\n if (renderText) {\n if (declutterMode !== 'none') {\n declutterTree.insert(dimensions.declutterBox);\n }\n this.replayImageOrLabel_.apply(this, args);\n }\n } else {\n this.replayImageOrLabel_.apply(this, args);\n }\n }\n ++i;\n break;\n case CanvasInstruction.DRAW_CHARS:\n const begin = /** @type {number} */ (instruction[1]);\n const end = /** @type {number} */ (instruction[2]);\n const baseline = /** @type {number} */ (instruction[3]);\n const overflow = /** @type {number} */ (instruction[4]);\n fillKey = /** @type {string} */ (instruction[5]);\n const maxAngle = /** @type {number} */ (instruction[6]);\n const measurePixelRatio = /** @type {number} */ (instruction[7]);\n const offsetY = /** @type {number} */ (instruction[8]);\n strokeKey = /** @type {string} */ (instruction[9]);\n const strokeWidth = /** @type {number} */ (instruction[10]);\n text = /** @type {string|Array<string>} */ (instruction[11]);\n if (Array.isArray(text)) {\n //FIXME Add support for rich text along lines\n text = text.reduce(richTextToPlainText, '');\n }\n textKey = /** @type {string} */ (instruction[12]);\n const pixelRatioScale = [\n /** @type {number} */ (instruction[13]),\n /** @type {number} */ (instruction[13]),\n ];\n declutterMode = instruction[14] || 'declutter';\n\n const textKeepUpright = /** @type {boolean} */ (instruction[15]);\n const textState = this.textStates[textKey];\n const font = textState.font;\n const textScale = [\n textState.scale[0] * measurePixelRatio,\n textState.scale[1] * measurePixelRatio,\n ];\n\n let cachedWidths;\n if (font in this.widths_) {\n cachedWidths = this.widths_[font];\n } else {\n cachedWidths = {};\n this.widths_[font] = cachedWidths;\n }\n\n const pathLength = lineStringLength(pixelCoordinates, begin, end, 2);\n const textLength =\n Math.abs(textScale[0]) *\n measureAndCacheTextWidth(font, text, cachedWidths);\n if (overflow || textLength <= pathLength) {\n const textAlign = this.textStates[textKey].textAlign;\n const startM =\n (pathLength - textLength) * horizontalTextAlign(text, textAlign);\n const parts = drawTextOnPath(\n pixelCoordinates,\n begin,\n end,\n 2,\n text,\n startM,\n maxAngle,\n Math.abs(textScale[0]),\n measureAndCacheTextWidth,\n font,\n cachedWidths,\n viewRotationFromTransform ? 0 : this.viewRotation_,\n textKeepUpright,\n );\n drawChars: if (parts) {\n /** @type {Array<ReplayImageOrLabelArgs>} */\n const replayImageOrLabelArgs = [];\n let c, cc, chars, label, part;\n if (strokeKey) {\n for (c = 0, cc = parts.length; c < cc; ++c) {\n part = parts[c]; // x, y, anchorX, rotation, chunk\n chars = /** @type {string} */ (part[4]);\n label = this.createLabel(chars, textKey, '', strokeKey);\n anchorX =\n /** @type {number} */ (part[2]) +\n (textScale[0] < 0 ? -strokeWidth : strokeWidth);\n anchorY =\n baseline * label.height +\n ((0.5 - baseline) * 2 * strokeWidth * textScale[1]) /\n textScale[0] -\n offsetY;\n const dimensions = this.calculateImageOrLabelDimensions_(\n label.width,\n label.height,\n part[0],\n part[1],\n label.width,\n label.height,\n anchorX,\n anchorY,\n 0,\n 0,\n part[3],\n pixelRatioScale,\n false,\n defaultPadding,\n false,\n feature,\n );\n if (\n declutterTree &&\n declutterMode === 'declutter' &&\n declutterTree.collides(dimensions.declutterBox)\n ) {\n break drawChars;\n }\n replayImageOrLabelArgs.push([\n context,\n scaledCanvasSize,\n label,\n dimensions,\n 1,\n null,\n null,\n ]);\n }\n }\n if (fillKey) {\n for (c = 0, cc = parts.length; c < cc; ++c) {\n part = parts[c]; // x, y, anchorX, rotation, chunk\n chars = /** @type {string} */ (part[4]);\n label = this.createLabel(chars, textKey, fillKey, '');\n anchorX = /** @type {number} */ (part[2]);\n anchorY = baseline * label.height - offsetY;\n const dimensions = this.calculateImageOrLabelDimensions_(\n label.width,\n label.height,\n part[0],\n part[1],\n label.width,\n label.height,\n anchorX,\n anchorY,\n 0,\n 0,\n part[3],\n pixelRatioScale,\n false,\n defaultPadding,\n false,\n feature,\n );\n if (\n declutterTree &&\n declutterMode === 'declutter' &&\n declutterTree.collides(dimensions.declutterBox)\n ) {\n break drawChars;\n }\n replayImageOrLabelArgs.push([\n context,\n scaledCanvasSize,\n label,\n dimensions,\n 1,\n null,\n null,\n ]);\n }\n }\n if (declutterTree && declutterMode !== 'none') {\n declutterTree.load(replayImageOrLabelArgs.map(getDeclutterBox));\n }\n for (let i = 0, ii = replayImageOrLabelArgs.length; i < ii; ++i) {\n this.replayImageOrLabel_.apply(this, replayImageOrLabelArgs[i]);\n }\n }\n }\n ++i;\n break;\n case CanvasInstruction.END_GEOMETRY:\n if (featureCallback !== undefined) {\n feature = /** @type {import(\"../../Feature.js\").FeatureLike} */ (\n instruction[1]\n );\n const result = featureCallback(\n feature,\n currentGeometry,\n declutterMode,\n );\n if (result) {\n return result;\n }\n }\n ++i;\n break;\n case CanvasInstruction.FILL:\n if (batchSize) {\n pendingFill++;\n } else {\n this.fill_(context);\n }\n ++i;\n break;\n case CanvasInstruction.MOVE_TO_LINE_TO:\n d = /** @type {number} */ (instruction[1]);\n dd = /** @type {number} */ (instruction[2]);\n x = pixelCoordinates[d];\n y = pixelCoordinates[d + 1];\n context.moveTo(x, y);\n prevX = (x + 0.5) | 0;\n prevY = (y + 0.5) | 0;\n for (d += 2; d < dd; d += 2) {\n x = pixelCoordinates[d];\n y = pixelCoordinates[d + 1];\n roundX = (x + 0.5) | 0;\n roundY = (y + 0.5) | 0;\n if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {\n context.lineTo(x, y);\n prevX = roundX;\n prevY = roundY;\n }\n }\n ++i;\n break;\n case CanvasInstruction.SET_FILL_STYLE:\n this.alignAndScaleFill_ = instruction[2];\n\n if (pendingFill) {\n this.fill_(context);\n pendingFill = 0;\n if (pendingStroke) {\n context.stroke();\n pendingStroke = 0;\n }\n }\n\n /** @type {import(\"../../colorlike.js\").ColorLike} */\n context.fillStyle = instruction[1];\n ++i;\n break;\n case CanvasInstruction.SET_STROKE_STYLE:\n if (pendingStroke) {\n context.stroke();\n pendingStroke = 0;\n }\n this.setStrokeStyle_(context, /** @type {Array<*>} */ (instruction));\n ++i;\n break;\n case CanvasInstruction.STROKE:\n if (batchSize) {\n pendingStroke++;\n } else {\n context.stroke();\n }\n ++i;\n break;\n default: // consume the instruction anyway, to avoid an infinite loop\n ++i;\n break;\n }\n }\n if (pendingFill) {\n this.fill_(context);\n }\n if (pendingStroke) {\n context.stroke();\n }\n return undefined;\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scaled canvas size.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.\n * @param {import(\"rbush\").default<DeclutterEntry>} [declutterTree] Declutter tree.\n */\n execute(\n context,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n declutterTree,\n ) {\n this.viewRotation_ = viewRotation;\n this.execute_(\n context,\n scaledCanvasSize,\n transform,\n this.instructions,\n snapToPixel,\n undefined,\n undefined,\n declutterTree,\n );\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {FeatureCallback<T>} [featureCallback] Feature callback.\n * @param {import(\"../../extent.js\").Extent} [hitExtent] Only check\n * features that intersect this extent.\n * @return {T|undefined} Callback result.\n * @template T\n */\n executeHitDetection(\n context,\n transform,\n viewRotation,\n featureCallback,\n hitExtent,\n ) {\n this.viewRotation_ = viewRotation;\n return this.execute_(\n context,\n [context.canvas.width, context.canvas.height],\n transform,\n this.hitDetectionInstructions,\n true,\n featureCallback,\n hitExtent,\n );\n }\n}\n\nexport default Executor;\n","/**\n * @module ol/render/canvas/ExecutorGroup\n */\n\nimport {ascending, descending} from '../../array.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {buffer, createEmpty, extendCoordinate} from '../../extent.js';\nimport {transform2D} from '../../geom/flat/transform.js';\nimport {isEmpty} from '../../obj.js';\nimport {\n compose as composeTransform,\n create as createTransform,\n} from '../../transform.js';\nimport Executor from './Executor.js';\n\n/**\n * @const\n * @type {Array<import(\"../canvas.js\").BuilderType>}\n */\nexport const ALL = [\n 'Polygon',\n 'Circle',\n 'LineString',\n 'Image',\n 'Text',\n 'Default',\n];\n\n/**\n * @const\n * @type {Array<import(\"../canvas.js\").BuilderType>}\n */\nexport const DECLUTTER = ['Image', 'Text'];\n\n/**\n * @const\n * @type {Array<import(\"../canvas.js\").BuilderType>}\n */\nexport const NON_DECLUTTER = ALL.filter(\n (builderType) => !DECLUTTER.includes(builderType),\n);\n\nclass ExecutorGroup {\n /**\n * @param {import(\"../../extent.js\").Extent} maxExtent Max extent for clipping. When a\n * `maxExtent` was set on the Builder for this executor group, the same `maxExtent`\n * should be set here, unless the target context does not exceed that extent (which\n * can be the case when rendering to tiles).\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {boolean} overlaps The executor group can have overlapping geometries.\n * @param {!Object<string, !Object<import(\"../canvas.js\").BuilderType, import(\"../canvas.js\").SerializableInstructions>>} allInstructions\n * The serializable instructions.\n * @param {number} [renderBuffer] Optional rendering buffer.\n * @param {boolean} [deferredRendering] Enable deferred rendering with renderDeferred().\n */\n constructor(\n maxExtent,\n resolution,\n pixelRatio,\n overlaps,\n allInstructions,\n renderBuffer,\n deferredRendering,\n ) {\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.maxExtent_ = maxExtent;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overlaps_ = overlaps;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @private\n * @type {number}\n */\n this.resolution_ = resolution;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderBuffer_ = renderBuffer;\n\n /**\n * @private\n * @type {!Object<string, !Object<string, import(\"./Executor\").default>>}\n */\n this.executorsByZIndex_ = {};\n\n /**\n * @private\n * @type {CanvasRenderingContext2D}\n */\n this.hitDetectionContext_ = null;\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.hitDetectionTransform_ = createTransform();\n\n /**\n * @private\n * @type {CanvasRenderingContext2D}\n */\n this.renderedContext_ = null;\n\n /**\n * @private\n * @type {Object<number, Array<import(\"./ZIndexContext.js\").default>>}\n */\n this.deferredZIndexContexts_ = {};\n\n this.createExecutors_(allInstructions, deferredRendering);\n }\n\n /**\n * @param {CanvasRenderingContext2D} context Context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n */\n clip(context, transform) {\n const flatClipCoords = this.getClipCoords(transform);\n context.beginPath();\n context.moveTo(flatClipCoords[0], flatClipCoords[1]);\n context.lineTo(flatClipCoords[2], flatClipCoords[3]);\n context.lineTo(flatClipCoords[4], flatClipCoords[5]);\n context.lineTo(flatClipCoords[6], flatClipCoords[7]);\n context.clip();\n }\n\n /**\n * Create executors and populate them using the provided instructions.\n * @private\n * @param {!Object<string, !Object<string, import(\"../canvas.js\").SerializableInstructions>>} allInstructions The serializable instructions\n * @param {boolean} deferredRendering Enable deferred rendering.\n */\n createExecutors_(allInstructions, deferredRendering) {\n for (const zIndex in allInstructions) {\n let executors = this.executorsByZIndex_[zIndex];\n if (executors === undefined) {\n executors = {};\n this.executorsByZIndex_[zIndex] = executors;\n }\n const instructionByZindex = allInstructions[zIndex];\n for (const builderType in instructionByZindex) {\n const instructions = instructionByZindex[builderType];\n executors[builderType] = new Executor(\n this.resolution_,\n this.pixelRatio_,\n this.overlaps_,\n instructions,\n deferredRendering,\n );\n }\n }\n }\n\n /**\n * @param {Array<import(\"../canvas.js\").BuilderType>} executors Executors.\n * @return {boolean} Has executors of the provided types.\n */\n hasExecutors(executors) {\n for (const zIndex in this.executorsByZIndex_) {\n const candidates = this.executorsByZIndex_[zIndex];\n for (let i = 0, ii = executors.length; i < ii; ++i) {\n if (executors[i] in candidates) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {function(import(\"../../Feature.js\").FeatureLike, import(\"../../geom/SimpleGeometry.js\").default, number): T} callback Feature callback.\n * @param {Array<import(\"../../Feature.js\").FeatureLike>} declutteredFeatures Decluttered features.\n * @return {T|undefined} Callback result.\n * @template T\n */\n forEachFeatureAtCoordinate(\n coordinate,\n resolution,\n rotation,\n hitTolerance,\n callback,\n declutteredFeatures,\n ) {\n hitTolerance = Math.round(hitTolerance);\n const contextSize = hitTolerance * 2 + 1;\n const transform = composeTransform(\n this.hitDetectionTransform_,\n hitTolerance + 0.5,\n hitTolerance + 0.5,\n 1 / resolution,\n -1 / resolution,\n -rotation,\n -coordinate[0],\n -coordinate[1],\n );\n\n const newContext = !this.hitDetectionContext_;\n if (newContext) {\n // Refrain from adding a 'willReadFrequently' hint in the options here.\n // While it will remove the \"Canvas2D: Multiple readback operations using\n // getImageData are faster with the willReadFrequently attribute set\n // to true\" warnings in the console, it makes hitDetection extremely\n // slow in Chrome when there are many features on the map\n this.hitDetectionContext_ = createCanvasContext2D(\n contextSize,\n contextSize,\n );\n }\n const context = this.hitDetectionContext_;\n\n if (\n context.canvas.width !== contextSize ||\n context.canvas.height !== contextSize\n ) {\n context.canvas.width = contextSize;\n context.canvas.height = contextSize;\n } else if (!newContext) {\n context.clearRect(0, 0, contextSize, contextSize);\n }\n\n /** @type {import(\"../../extent.js\").Extent|undefined} */\n let hitExtent;\n if (this.renderBuffer_ !== undefined) {\n hitExtent = createEmpty();\n extendCoordinate(hitExtent, coordinate);\n buffer(\n hitExtent,\n resolution * (this.renderBuffer_ + hitTolerance),\n hitExtent,\n );\n }\n\n const indexes = getPixelIndexArray(hitTolerance);\n\n /** @type {import(\"../canvas.js\").BuilderType} */\n let builderType;\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {import('../../style/Style.js').DeclutterMode} declutterMode Declutter mode.\n * @return {T|undefined} Callback result.\n */\n function featureCallback(feature, geometry, declutterMode) {\n const imageData = context.getImageData(\n 0,\n 0,\n contextSize,\n contextSize,\n ).data;\n for (let i = 0, ii = indexes.length; i < ii; i++) {\n if (imageData[indexes[i]] > 0) {\n if (\n !declutteredFeatures ||\n declutterMode === 'none' ||\n (builderType !== 'Image' && builderType !== 'Text') ||\n declutteredFeatures.includes(feature)\n ) {\n const idx = (indexes[i] - 3) / 4;\n const x = hitTolerance - (idx % contextSize);\n const y = hitTolerance - ((idx / contextSize) | 0);\n const result = callback(feature, geometry, x * x + y * y);\n if (result) {\n return result;\n }\n }\n context.clearRect(0, 0, contextSize, contextSize);\n break;\n }\n }\n return undefined;\n }\n\n /** @type {Array<number>} */\n const zs = Object.keys(this.executorsByZIndex_).map(Number);\n zs.sort(ascending);\n\n let i, j, executors, executor, result;\n for (i = zs.length - 1; i >= 0; --i) {\n const zIndexKey = zs[i].toString();\n executors = this.executorsByZIndex_[zIndexKey];\n for (j = ALL.length - 1; j >= 0; --j) {\n builderType = ALL[j];\n executor = executors[builderType];\n if (executor !== undefined) {\n result = executor.executeHitDetection(\n context,\n transform,\n rotation,\n featureCallback,\n hitExtent,\n );\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n }\n\n /**\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @return {Array<number>|null} Clip coordinates.\n */\n getClipCoords(transform) {\n const maxExtent = this.maxExtent_;\n if (!maxExtent) {\n return null;\n }\n const minX = maxExtent[0];\n const minY = maxExtent[1];\n const maxX = maxExtent[2];\n const maxY = maxExtent[3];\n const flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY];\n transform2D(flatClipCoords, 0, 8, 2, transform, flatClipCoords);\n return flatClipCoords;\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return isEmpty(this.executorsByZIndex_);\n }\n\n /**\n * @param {CanvasRenderingContext2D} targetContext Context.\n * @param {import('../../size.js').Size} scaledCanvasSize Scale of the context.\n * @param {import(\"../../transform.js\").Transform} transform Transform.\n * @param {number} viewRotation View rotation.\n * @param {boolean} snapToPixel Snap point symbols and test to integer pixel.\n * @param {Array<import(\"../canvas.js\").BuilderType>} [builderTypes] Ordered replay types to replay.\n * Default is {@link module:ol/render/replay~ALL}\n * @param {import(\"rbush\").default<import('./Executor.js').DeclutterEntry>|null} [declutterTree] Declutter tree.\n * When set to null, no decluttering is done, even when the executor group has a `ZIndexContext`.\n */\n execute(\n targetContext,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n builderTypes,\n declutterTree,\n ) {\n const zs = Object.keys(this.executorsByZIndex_).map(Number);\n zs.sort(declutterTree ? descending : ascending);\n\n builderTypes = builderTypes ? builderTypes : ALL;\n const maxBuilderTypes = ALL.length;\n for (let i = 0, ii = zs.length; i < ii; ++i) {\n const zIndexKey = zs[i].toString();\n const replays = this.executorsByZIndex_[zIndexKey];\n for (let j = 0, jj = builderTypes.length; j < jj; ++j) {\n const builderType = builderTypes[j];\n const replay = replays[builderType];\n if (replay !== undefined) {\n const zIndexContext =\n declutterTree === null ? undefined : replay.getZIndexContext();\n const context = zIndexContext\n ? zIndexContext.getContext()\n : targetContext;\n const requireClip =\n this.maxExtent_ &&\n builderType !== 'Image' &&\n builderType !== 'Text';\n if (requireClip) {\n context.save();\n // setup clipping so that the parts of over-simplified geometries are not\n // visible outside the current extent when panning\n this.clip(context, transform);\n }\n if (\n !zIndexContext ||\n builderType === 'Text' ||\n builderType === 'Image'\n ) {\n replay.execute(\n context,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n declutterTree,\n );\n } else {\n zIndexContext.pushFunction((context) =>\n replay.execute(\n context,\n scaledCanvasSize,\n transform,\n viewRotation,\n snapToPixel,\n declutterTree,\n ),\n );\n }\n if (requireClip) {\n context.restore();\n }\n if (zIndexContext) {\n zIndexContext.offset();\n const index = zs[i] * maxBuilderTypes + ALL.indexOf(builderType);\n if (!this.deferredZIndexContexts_[index]) {\n this.deferredZIndexContexts_[index] = [];\n }\n this.deferredZIndexContexts_[index].push(zIndexContext);\n }\n }\n }\n }\n\n this.renderedContext_ = targetContext;\n }\n\n getDeferredZIndexContexts() {\n return this.deferredZIndexContexts_;\n }\n\n getRenderedContext() {\n return this.renderedContext_;\n }\n\n renderDeferred() {\n const deferredZIndexContexts = this.deferredZIndexContexts_;\n const zs = Object.keys(deferredZIndexContexts).map(Number).sort(ascending);\n for (let i = 0, ii = zs.length; i < ii; ++i) {\n deferredZIndexContexts[zs[i]].forEach((zIndexContext) => {\n zIndexContext.draw(this.renderedContext_); // FIXME Pass clip to replay for temporarily enabling clip\n zIndexContext.clear();\n });\n deferredZIndexContexts[zs[i]].length = 0;\n }\n }\n}\n\n/**\n * This cache is used to store arrays of indexes for calculated pixel circles\n * to increase performance.\n * It is a static property to allow each Replaygroup to access it.\n * @type {Object<number, Array<number>>}\n */\nconst circlePixelIndexArrayCache = {};\n\n/**\n * This methods creates an array with indexes of all pixels within a circle,\n * ordered by how close they are to the center.\n * A cache is used to increase performance.\n * @param {number} radius Radius.\n * @return {Array<number>} An array with indexes within a circle.\n */\nexport function getPixelIndexArray(radius) {\n if (circlePixelIndexArrayCache[radius] !== undefined) {\n return circlePixelIndexArrayCache[radius];\n }\n\n const size = radius * 2 + 1;\n const maxDistanceSq = radius * radius;\n const distances = new Array(maxDistanceSq + 1);\n for (let i = 0; i <= radius; ++i) {\n for (let j = 0; j <= radius; ++j) {\n const distanceSq = i * i + j * j;\n if (distanceSq > maxDistanceSq) {\n break;\n }\n let distance = distances[distanceSq];\n if (!distance) {\n distance = [];\n distances[distanceSq] = distance;\n }\n distance.push(((radius + i) * size + (radius + j)) * 4 + 3);\n if (i > 0) {\n distance.push(((radius - i) * size + (radius + j)) * 4 + 3);\n }\n if (j > 0) {\n distance.push(((radius + i) * size + (radius - j)) * 4 + 3);\n if (i > 0) {\n distance.push(((radius - i) * size + (radius - j)) * 4 + 3);\n }\n }\n }\n }\n\n const pixelIndex = [];\n for (let i = 0, ii = distances.length; i < ii; ++i) {\n if (distances[i]) {\n pixelIndex.push(...distances[i]);\n }\n }\n\n circlePixelIndexArrayCache[radius] = pixelIndex;\n return pixelIndex;\n}\n\nexport default ExecutorGroup;\n","/**\n * @module ol/render/canvas/hitdetect\n */\n\nimport {ascending} from '../../array.js';\nimport {createCanvasContext2D} from '../../dom.js';\nimport {intersects} from '../../extent.js';\nimport {clamp} from '../../math.js';\nimport {\n getTransformFromProjections,\n getUserProjection,\n toUserExtent,\n} from '../../proj.js';\nimport {Icon} from '../../style.js';\nimport CanvasImmediateRenderer from './Immediate.js';\n\nexport const HIT_DETECT_RESOLUTION = 0.5;\n\n/**\n * @param {import(\"../../size.js\").Size} size Canvas size in css pixels.\n * @param {Array<import(\"../../transform.js\").Transform>} transforms Transforms\n * for rendering features to all worlds of the viewport, from coordinates to css\n * pixels.\n * @param {Array<import(\"../../Feature.js\").FeatureLike>} features\n * Features to consider for hit detection.\n * @param {import(\"../../style/Style.js\").StyleFunction|undefined} styleFunction\n * Layer style function.\n * @param {import(\"../../extent.js\").Extent} extent Extent in render projection.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {number} [squaredTolerance] Squared tolerance.\n * @param {import(\"../../proj/Projection.js\").default} [projection] Render projection.\n * @return {ImageData} Hit detection image data.\n */\nexport function createHitDetectionImageData(\n size,\n transforms,\n features,\n styleFunction,\n extent,\n resolution,\n rotation,\n squaredTolerance,\n projection,\n) {\n const userExtent = projection ? toUserExtent(extent, projection) : extent;\n const width = size[0] * HIT_DETECT_RESOLUTION;\n const height = size[1] * HIT_DETECT_RESOLUTION;\n const context = createCanvasContext2D(width, height);\n context.imageSmoothingEnabled = false;\n const canvas = context.canvas;\n const renderer = new CanvasImmediateRenderer(\n context,\n HIT_DETECT_RESOLUTION,\n extent,\n null,\n rotation,\n squaredTolerance,\n projection\n ? getTransformFromProjections(getUserProjection(), projection)\n : null,\n );\n const featureCount = features.length;\n // Stretch hit detection index to use the whole available color range\n const indexFactor = Math.floor((256 * 256 * 256 - 1) / featureCount);\n const featuresByZIndex = {};\n for (let i = 1; i <= featureCount; ++i) {\n const feature = features[i - 1];\n const featureStyleFunction = feature.getStyleFunction() || styleFunction;\n if (!featureStyleFunction) {\n continue;\n }\n let styles = featureStyleFunction(feature, resolution);\n if (!styles) {\n continue;\n }\n if (!Array.isArray(styles)) {\n styles = [styles];\n }\n const index = i * indexFactor;\n const color = index.toString(16).padStart(7, '#00000');\n for (let j = 0, jj = styles.length; j < jj; ++j) {\n const originalStyle = styles[j];\n const geometry = originalStyle.getGeometryFunction()(feature);\n if (!geometry || !intersects(userExtent, geometry.getExtent())) {\n continue;\n }\n const style = originalStyle.clone();\n const fill = style.getFill();\n if (fill) {\n fill.setColor(color);\n }\n const stroke = style.getStroke();\n if (stroke) {\n stroke.setColor(color);\n stroke.setLineDash(null);\n }\n style.setText(undefined);\n const image = originalStyle.getImage();\n if (image) {\n const imgSize = image.getImageSize();\n if (!imgSize) {\n continue;\n }\n\n const imgContext = createCanvasContext2D(\n imgSize[0],\n imgSize[1],\n undefined,\n {alpha: false},\n );\n const img = imgContext.canvas;\n imgContext.fillStyle = color;\n imgContext.fillRect(0, 0, img.width, img.height);\n style.setImage(\n new Icon({\n img: img,\n anchor: image.getAnchor(),\n anchorXUnits: 'pixels',\n anchorYUnits: 'pixels',\n offset: image.getOrigin(),\n opacity: 1,\n size: image.getSize(),\n scale: image.getScale(),\n rotation: image.getRotation(),\n rotateWithView: image.getRotateWithView(),\n }),\n );\n }\n const zIndex = style.getZIndex() || 0;\n let byGeometryType = featuresByZIndex[zIndex];\n if (!byGeometryType) {\n byGeometryType = {};\n featuresByZIndex[zIndex] = byGeometryType;\n byGeometryType['Polygon'] = [];\n byGeometryType['Circle'] = [];\n byGeometryType['LineString'] = [];\n byGeometryType['Point'] = [];\n }\n const type = geometry.getType();\n if (type === 'GeometryCollection') {\n const geometries =\n /** @type {import(\"../../geom/GeometryCollection.js\").default} */ (\n geometry\n ).getGeometriesArrayRecursive();\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n const geometry = geometries[i];\n byGeometryType[geometry.getType().replace('Multi', '')].push(\n geometry,\n style,\n );\n }\n } else {\n byGeometryType[type.replace('Multi', '')].push(geometry, style);\n }\n }\n }\n\n const zIndexKeys = Object.keys(featuresByZIndex).map(Number).sort(ascending);\n for (let i = 0, ii = zIndexKeys.length; i < ii; ++i) {\n const byGeometryType = featuresByZIndex[zIndexKeys[i]];\n for (const type in byGeometryType) {\n const geomAndStyle = byGeometryType[type];\n for (let j = 0, jj = geomAndStyle.length; j < jj; j += 2) {\n renderer.setStyle(geomAndStyle[j + 1]);\n for (let k = 0, kk = transforms.length; k < kk; ++k) {\n renderer.setTransform(transforms[k]);\n renderer.drawGeometry(geomAndStyle[j]);\n }\n }\n }\n }\n return context.getImageData(0, 0, canvas.width, canvas.height);\n}\n\n/**\n * @param {import(\"../../pixel\").Pixel} pixel Pixel coordinate on the hit\n * detection canvas in css pixels.\n * @param {Array<F>} features Features. Has to\n * match the `features` array that was passed to `createHitDetectionImageData()`.\n * @param {ImageData} imageData Hit detection image data generated by\n * `createHitDetectionImageData()`.\n * @return {Array<F>} Features.\n * @template {import(\"../../Feature.js\").FeatureLike} F\n */\nexport function hitDetect(pixel, features, imageData) {\n /** @type {Array<F>} */\n const resultFeatures = [];\n if (imageData) {\n const x = Math.floor(Math.round(pixel[0]) * HIT_DETECT_RESOLUTION);\n const y = Math.floor(Math.round(pixel[1]) * HIT_DETECT_RESOLUTION);\n // The pixel coordinate is clamped down to the hit-detect canvas' size to account\n // for browsers returning coordinates slightly larger than the actual canvas size\n // due to a non-integer pixel ratio.\n const index =\n (clamp(x, 0, imageData.width - 1) +\n clamp(y, 0, imageData.height - 1) * imageData.width) *\n 4;\n const r = imageData.data[index];\n const g = imageData.data[index + 1];\n const b = imageData.data[index + 2];\n const i = b + 256 * (g + 256 * r);\n const indexFactor = Math.floor((256 * 256 * 256 - 1) / features.length);\n if (i && i % indexFactor === 0) {\n resultFeatures.push(features[i / indexFactor - 1]);\n }\n }\n return resultFeatures;\n}\n","/**\n * @module ol/renderer/canvas/VectorLayer\n */\nimport ViewHint from '../../ViewHint.js';\nimport {equals} from '../../array.js';\nimport {wrapX as wrapCoordinateX} from '../../coordinate.js';\nimport {createCanvasContext2D, releaseCanvas} from '../../dom.js';\nimport {\n buffer,\n containsExtent,\n createEmpty,\n getHeight,\n getWidth,\n intersects as intersectsExtent,\n wrapX as wrapExtentX,\n} from '../../extent.js';\nimport {\n fromUserExtent,\n getTransformFromProjections,\n getUserProjection,\n toUserExtent,\n toUserResolution,\n} from '../../proj.js';\nimport RenderEventType from '../../render/EventType.js';\nimport CanvasBuilderGroup from '../../render/canvas/BuilderGroup.js';\nimport ExecutorGroup, {\n ALL,\n DECLUTTER,\n NON_DECLUTTER,\n} from '../../render/canvas/ExecutorGroup.js';\nimport {\n HIT_DETECT_RESOLUTION,\n createHitDetectionImageData,\n hitDetect,\n} from '../../render/canvas/hitdetect.js';\nimport {getUid} from '../../util.js';\nimport {\n defaultOrder as defaultRenderOrder,\n getSquaredTolerance as getSquaredRenderTolerance,\n getTolerance as getRenderTolerance,\n renderFeature,\n} from '../vector.js';\nimport CanvasLayerRenderer, {canvasPool} from './Layer.js';\n\n/**\n * @classdesc\n * Canvas renderer for vector layers.\n * @api\n */\nclass CanvasVectorLayerRenderer extends CanvasLayerRenderer {\n /**\n * @param {import(\"../../layer/BaseVector.js\").default} vectorLayer Vector layer.\n */\n constructor(vectorLayer) {\n super(vectorLayer);\n\n /** @private */\n this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this);\n\n /**\n * @private\n * @type {boolean}\n */\n this.animatingOrInteracting_;\n\n /**\n * @private\n * @type {ImageData|null}\n */\n this.hitDetectionImageData_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.clipped_ = false;\n\n /**\n * @private\n * @type {Array<import(\"../../Feature.js\").default>}\n */\n this.renderedFeatures_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRevision_ = -1;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedResolution_ = NaN;\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.renderedExtent_ = createEmpty();\n\n /**\n * @private\n * @type {import(\"../../extent.js\").Extent}\n */\n this.wrappedRenderedExtent_ = createEmpty();\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRotation_;\n\n /**\n * @private\n * @type {import(\"../../coordinate\").Coordinate}\n */\n this.renderedCenter_ = null;\n\n /**\n * @private\n * @type {import(\"../../proj/Projection\").default}\n */\n this.renderedProjection_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedPixelRatio_ = 1;\n\n /**\n * @private\n * @type {import(\"../../render.js\").OrderFunction|null}\n */\n this.renderedRenderOrder_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedFrameDeclutter_;\n\n /**\n * @private\n * @type {import(\"../../render/canvas/ExecutorGroup\").default}\n */\n this.replayGroup_ = null;\n\n /**\n * A new replay group had to be created by `prepareFrame()`\n * @type {boolean}\n */\n this.replayGroupChanged = true;\n\n /**\n * Clipping to be performed by `renderFrame()`\n * @type {boolean}\n */\n this.clipping = true;\n\n /**\n * @private\n * @type {CanvasRenderingContext2D}\n */\n this.targetContext_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.opacity_ = 1;\n }\n\n /**\n * @param {ExecutorGroup} executorGroup Executor group.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {boolean} [declutterable] `true` to only render declutterable items,\n * `false` to only render non-declutterable items, `undefined` to render all.\n */\n renderWorlds(executorGroup, frameState, declutterable) {\n const extent = frameState.extent;\n const viewState = frameState.viewState;\n const center = viewState.center;\n const resolution = viewState.resolution;\n const projection = viewState.projection;\n const rotation = viewState.rotation;\n const projectionExtent = projection.getExtent();\n const vectorSource = this.getLayer().getSource();\n const declutter = this.getLayer().getDeclutter();\n const pixelRatio = frameState.pixelRatio;\n const viewHints = frameState.viewHints;\n const snapToPixel = !(\n viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]\n );\n const context = this.context;\n const width = Math.round((getWidth(extent) / resolution) * pixelRatio);\n const height = Math.round((getHeight(extent) / resolution) * pixelRatio);\n\n const multiWorld = vectorSource.getWrapX() && projection.canWrapX();\n const worldWidth = multiWorld ? getWidth(projectionExtent) : null;\n const endWorld = multiWorld\n ? Math.ceil((extent[2] - projectionExtent[2]) / worldWidth) + 1\n : 1;\n let world = multiWorld\n ? Math.floor((extent[0] - projectionExtent[0]) / worldWidth)\n : 0;\n do {\n let transform = this.getRenderTransform(\n center,\n resolution,\n 0,\n pixelRatio,\n width,\n height,\n world * worldWidth,\n );\n if (frameState.declutter) {\n transform = transform.slice(0);\n }\n executorGroup.execute(\n context,\n [context.canvas.width, context.canvas.height],\n transform,\n rotation,\n snapToPixel,\n declutterable === undefined\n ? ALL\n : declutterable\n ? DECLUTTER\n : NON_DECLUTTER,\n declutterable\n ? declutter && frameState.declutter[declutter]\n : undefined,\n );\n } while (++world < endWorld);\n }\n\n /**\n * @private\n */\n setDrawContext_() {\n if (this.opacity_ !== 1) {\n this.targetContext_ = this.context;\n this.context = createCanvasContext2D(\n this.context.canvas.width,\n this.context.canvas.height,\n canvasPool,\n );\n }\n }\n\n /**\n * @private\n */\n resetDrawContext_() {\n if (this.opacity_ !== 1 && this.targetContext_) {\n const alpha = this.targetContext_.globalAlpha;\n this.targetContext_.globalAlpha = this.opacity_;\n this.targetContext_.drawImage(this.context.canvas, 0, 0);\n this.targetContext_.globalAlpha = alpha;\n releaseCanvas(this.context);\n canvasPool.push(this.context.canvas);\n this.context = this.targetContext_;\n this.targetContext_ = null;\n }\n }\n\n /**\n * Render declutter items for this layer\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n */\n renderDeclutter(frameState) {\n if (!this.replayGroup_ || !this.getLayer().getDeclutter()) {\n return;\n }\n this.renderWorlds(this.replayGroup_, frameState, true);\n }\n\n /**\n * Render deferred instructions.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @override\n */\n renderDeferredInternal(frameState) {\n if (!this.replayGroup_) {\n return;\n }\n this.replayGroup_.renderDeferred();\n if (this.clipped_) {\n this.context.restore();\n }\n this.resetDrawContext_();\n }\n\n /**\n * Render the layer.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement|null} target Target that may be used to render content to.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n renderFrame(frameState, target) {\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n this.opacity_ = layerState.opacity;\n const viewState = frameState.viewState;\n\n this.prepareContainer(frameState, target);\n const context = this.context;\n\n const replayGroup = this.replayGroup_;\n let render = replayGroup && !replayGroup.isEmpty();\n if (!render) {\n const hasRenderListeners =\n this.getLayer().hasListener(RenderEventType.PRERENDER) ||\n this.getLayer().hasListener(RenderEventType.POSTRENDER);\n if (!hasRenderListeners) {\n return this.container;\n }\n }\n\n this.setDrawContext_();\n\n this.preRender(context, frameState);\n\n const projection = viewState.projection;\n\n // clipped rendering if layer extent is set\n this.clipped_ = false;\n if (render && layerState.extent && this.clipping) {\n const layerExtent = fromUserExtent(layerState.extent, projection);\n render = intersectsExtent(layerExtent, frameState.extent);\n this.clipped_ = render && !containsExtent(layerExtent, frameState.extent);\n if (this.clipped_) {\n this.clipUnrotated(context, frameState, layerExtent);\n }\n }\n\n if (render) {\n this.renderWorlds(\n replayGroup,\n frameState,\n this.getLayer().getDeclutter() ? false : undefined,\n );\n }\n\n if (!frameState.declutter && this.clipped_) {\n context.restore();\n }\n\n this.postRender(context, frameState);\n\n if (this.renderedRotation_ !== viewState.rotation) {\n this.renderedRotation_ = viewState.rotation;\n this.hitDetectionImageData_ = null;\n }\n if (!frameState.declutter) {\n this.resetDrawContext_();\n }\n return this.container;\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../../Feature\").default>>} Promise\n * that resolves with an array of features.\n * @override\n */\n getFeatures(pixel) {\n return new Promise((resolve) => {\n if (\n this.frameState &&\n !this.hitDetectionImageData_ &&\n !this.animatingOrInteracting_\n ) {\n const size = this.frameState.size.slice();\n const center = this.renderedCenter_;\n const resolution = this.renderedResolution_;\n const rotation = this.renderedRotation_;\n const projection = this.renderedProjection_;\n const extent = this.wrappedRenderedExtent_;\n const layer = this.getLayer();\n const transforms = [];\n const width = size[0] * HIT_DETECT_RESOLUTION;\n const height = size[1] * HIT_DETECT_RESOLUTION;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n HIT_DETECT_RESOLUTION,\n width,\n height,\n 0,\n ).slice(),\n );\n const source = layer.getSource();\n const projectionExtent = projection.getExtent();\n if (\n source.getWrapX() &&\n projection.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n let startX = extent[0];\n const worldWidth = getWidth(projectionExtent);\n let world = 0;\n let offsetX;\n while (startX < projectionExtent[0]) {\n --world;\n offsetX = worldWidth * world;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n HIT_DETECT_RESOLUTION,\n width,\n height,\n offsetX,\n ).slice(),\n );\n startX += worldWidth;\n }\n world = 0;\n startX = extent[2];\n while (startX > projectionExtent[2]) {\n ++world;\n offsetX = worldWidth * world;\n transforms.push(\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n HIT_DETECT_RESOLUTION,\n width,\n height,\n offsetX,\n ).slice(),\n );\n startX -= worldWidth;\n }\n }\n const userProjection = getUserProjection();\n this.hitDetectionImageData_ = createHitDetectionImageData(\n size,\n transforms,\n this.renderedFeatures_,\n layer.getStyleFunction(),\n extent,\n resolution,\n rotation,\n getSquaredRenderTolerance(resolution, this.renderedPixelRatio_),\n userProjection ? projection : null,\n );\n }\n resolve(\n hitDetect(pixel, this.renderedFeatures_, this.hitDetectionImageData_),\n );\n });\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"../vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {Array<import(\"../Map.js\").HitMatch<T>>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n * @override\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n if (!this.replayGroup_) {\n return undefined;\n }\n const resolution = frameState.viewState.resolution;\n const rotation = frameState.viewState.rotation;\n const layer = this.getLayer();\n\n /** @type {!Object<string, import(\"../Map.js\").HitMatch<T>|true>} */\n const features = {};\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {number} distanceSq The squared distance to the click position\n * @return {T|undefined} Callback result.\n */\n const featureCallback = function (feature, geometry, distanceSq) {\n const key = getUid(feature);\n const match = features[key];\n if (!match) {\n if (distanceSq === 0) {\n features[key] = true;\n return callback(feature, layer, geometry);\n }\n matches.push(\n (features[key] = {\n feature: feature,\n layer: layer,\n geometry: geometry,\n distanceSq: distanceSq,\n callback: callback,\n }),\n );\n } else if (match !== true && distanceSq < match.distanceSq) {\n if (distanceSq === 0) {\n features[key] = true;\n matches.splice(matches.lastIndexOf(match), 1);\n return callback(feature, layer, geometry);\n }\n match.geometry = geometry;\n match.distanceSq = distanceSq;\n }\n return undefined;\n };\n\n const declutter = this.getLayer().getDeclutter();\n return this.replayGroup_.forEachFeatureAtCoordinate(\n coordinate,\n resolution,\n rotation,\n hitTolerance,\n featureCallback,\n declutter\n ? frameState.declutter?.[declutter]?.all().map((item) => item.value)\n : null,\n );\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n * @override\n */\n handleFontsChanged() {\n const layer = this.getLayer();\n if (layer.getVisible() && this.replayGroup_) {\n layer.changed();\n }\n }\n\n /**\n * Handle changes in image style state.\n * @param {import(\"../../events/Event.js\").default} event Image style change event.\n * @private\n */\n handleStyleImageChange_(event) {\n this.renderIfReadyAndVisible();\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrame(frameState) {\n const vectorLayer = this.getLayer();\n const vectorSource = vectorLayer.getSource();\n if (!vectorSource) {\n return false;\n }\n\n const animating = frameState.viewHints[ViewHint.ANIMATING];\n const interacting = frameState.viewHints[ViewHint.INTERACTING];\n const updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();\n const updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();\n\n if (\n (this.ready && !updateWhileAnimating && animating) ||\n (!updateWhileInteracting && interacting)\n ) {\n this.animatingOrInteracting_ = true;\n return true;\n }\n this.animatingOrInteracting_ = false;\n\n const frameStateExtent = frameState.extent;\n const viewState = frameState.viewState;\n const projection = viewState.projection;\n const resolution = viewState.resolution;\n const pixelRatio = frameState.pixelRatio;\n const vectorLayerRevision = vectorLayer.getRevision();\n const vectorLayerRenderBuffer = vectorLayer.getRenderBuffer();\n let vectorLayerRenderOrder = vectorLayer.getRenderOrder();\n\n if (vectorLayerRenderOrder === undefined) {\n vectorLayerRenderOrder = defaultRenderOrder;\n }\n\n const center = viewState.center.slice();\n const extent = buffer(\n frameStateExtent,\n vectorLayerRenderBuffer * resolution,\n );\n const renderedExtent = extent.slice();\n const loadExtents = [extent.slice()];\n const projectionExtent = projection.getExtent();\n\n if (\n vectorSource.getWrapX() &&\n projection.canWrapX() &&\n !containsExtent(projectionExtent, frameState.extent)\n ) {\n // For the replay group, we need an extent that intersects the real world\n // (-180° to +180°). To support geometries in a coordinate range from -540°\n // to +540°, we add at least 1 world width on each side of the projection\n // extent. If the viewport is wider than the world, we need to add half of\n // the viewport width to make sure we cover the whole viewport.\n const worldWidth = getWidth(projectionExtent);\n const gutter = Math.max(getWidth(extent) / 2, worldWidth);\n extent[0] = projectionExtent[0] - gutter;\n extent[2] = projectionExtent[2] + gutter;\n wrapCoordinateX(center, projection);\n const loadExtent = wrapExtentX(loadExtents[0], projection);\n // If the extent crosses the date line, we load data for both edges of the worlds\n if (\n loadExtent[0] < projectionExtent[0] &&\n loadExtent[2] < projectionExtent[2]\n ) {\n loadExtents.push([\n loadExtent[0] + worldWidth,\n loadExtent[1],\n loadExtent[2] + worldWidth,\n loadExtent[3],\n ]);\n } else if (\n loadExtent[0] > projectionExtent[0] &&\n loadExtent[2] > projectionExtent[2]\n ) {\n loadExtents.push([\n loadExtent[0] - worldWidth,\n loadExtent[1],\n loadExtent[2] - worldWidth,\n loadExtent[3],\n ]);\n }\n }\n\n if (\n this.ready &&\n this.renderedResolution_ == resolution &&\n this.renderedRevision_ == vectorLayerRevision &&\n this.renderedRenderOrder_ == vectorLayerRenderOrder &&\n this.renderedFrameDeclutter_ === !!frameState.declutter &&\n containsExtent(this.wrappedRenderedExtent_, extent)\n ) {\n if (!equals(this.renderedExtent_, renderedExtent)) {\n this.hitDetectionImageData_ = null;\n this.renderedExtent_ = renderedExtent;\n }\n this.renderedCenter_ = center;\n this.replayGroupChanged = false;\n return true;\n }\n\n this.replayGroup_ = null;\n\n const replayGroup = new CanvasBuilderGroup(\n getRenderTolerance(resolution, pixelRatio),\n extent,\n resolution,\n pixelRatio,\n );\n\n const userProjection = getUserProjection();\n let userTransform;\n if (userProjection) {\n for (let i = 0, ii = loadExtents.length; i < ii; ++i) {\n const extent = loadExtents[i];\n const userExtent = toUserExtent(extent, projection);\n vectorSource.loadFeatures(\n userExtent,\n toUserResolution(resolution, projection),\n userProjection,\n );\n }\n userTransform = getTransformFromProjections(userProjection, projection);\n } else {\n for (let i = 0, ii = loadExtents.length; i < ii; ++i) {\n vectorSource.loadFeatures(loadExtents[i], resolution, projection);\n }\n }\n\n const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);\n let ready = true;\n const render =\n /**\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} index Index.\n */\n (feature, index) => {\n let styles;\n const styleFunction =\n feature.getStyleFunction() || vectorLayer.getStyleFunction();\n if (styleFunction) {\n styles = styleFunction(feature, resolution);\n }\n if (styles) {\n const dirty = this.renderFeature(\n feature,\n squaredTolerance,\n styles,\n replayGroup,\n userTransform,\n this.getLayer().getDeclutter(),\n index,\n );\n ready = ready && !dirty;\n }\n };\n\n const userExtent = toUserExtent(extent, projection);\n /** @type {Array<import(\"../../Feature.js\").default>} */\n const features = vectorSource.getFeaturesInExtent(userExtent);\n if (vectorLayerRenderOrder) {\n features.sort(vectorLayerRenderOrder);\n }\n for (let i = 0, ii = features.length; i < ii; ++i) {\n render(features[i], i);\n }\n this.renderedFeatures_ = features;\n this.ready = ready;\n\n const replayGroupInstructions = replayGroup.finish();\n const executorGroup = new ExecutorGroup(\n extent,\n resolution,\n pixelRatio,\n vectorSource.getOverlaps(),\n replayGroupInstructions,\n vectorLayer.getRenderBuffer(),\n !!frameState.declutter,\n );\n\n this.renderedResolution_ = resolution;\n this.renderedRevision_ = vectorLayerRevision;\n this.renderedRenderOrder_ = vectorLayerRenderOrder;\n this.renderedFrameDeclutter_ = !!frameState.declutter;\n this.renderedExtent_ = renderedExtent;\n this.wrappedRenderedExtent_ = extent;\n this.renderedCenter_ = center;\n this.renderedProjection_ = projection;\n this.renderedPixelRatio_ = pixelRatio;\n this.replayGroup_ = executorGroup;\n this.hitDetectionImageData_ = null;\n\n this.replayGroupChanged = true;\n return true;\n }\n\n /**\n * @param {import(\"../../Feature.js\").default} feature Feature.\n * @param {number} squaredTolerance Squared render tolerance.\n * @param {import(\"../../style/Style.js\").default|Array<import(\"../../style/Style.js\").default>} styles The style or array of styles.\n * @param {import(\"../../render/canvas/BuilderGroup.js\").default} builderGroup Builder group.\n * @param {import(\"../../proj.js\").TransformFunction} [transform] Transform from user to view projection.\n * @param {boolean} [declutter] Enable decluttering.\n * @param {number} [index] Render order index.\n * @return {boolean} `true` if an image is loading.\n */\n renderFeature(\n feature,\n squaredTolerance,\n styles,\n builderGroup,\n transform,\n declutter,\n index,\n ) {\n if (!styles) {\n return false;\n }\n let loading = false;\n if (Array.isArray(styles)) {\n for (let i = 0, ii = styles.length; i < ii; ++i) {\n loading =\n renderFeature(\n builderGroup,\n feature,\n styles[i],\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n transform,\n declutter,\n index,\n ) || loading;\n }\n } else {\n loading = renderFeature(\n builderGroup,\n feature,\n styles,\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n transform,\n declutter,\n index,\n );\n }\n return loading;\n }\n}\n\nexport default CanvasVectorLayerRenderer;\n","/**\n * @module ol/renderer/canvas/VectorImageLayer\n */\nimport RBush from 'rbush';\nimport ImageCanvas from '../../ImageCanvas.js';\nimport ImageState from '../../ImageState.js';\nimport ViewHint from '../../ViewHint.js';\nimport EventType from '../../events/EventType.js';\nimport {getHeight, getWidth, isEmpty, scaleFromCenter} from '../../extent.js';\nimport {fromResolutionLike} from '../../resolution.js';\nimport {apply, compose, create} from '../../transform.js';\nimport CanvasImageLayerRenderer from './ImageLayer.js';\nimport CanvasVectorLayerRenderer from './VectorLayer.js';\n\n/**\n * @classdesc\n * Canvas renderer for image layers.\n * @api\n */\nclass CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {\n /**\n * @param {import(\"../../layer/VectorImage.js\").default} layer Vector image layer.\n */\n constructor(layer) {\n super(layer);\n\n /**\n * @private\n * @type {import(\"./VectorLayer.js\").default}\n */\n this.vectorRenderer_ = new CanvasVectorLayerRenderer(layer);\n\n /**\n * @private\n * @type {number}\n */\n this.layerImageRatio_ = layer.getImageRatio();\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.coordinateToVectorPixelTransform_ = create();\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.renderedPixelToCoordinateTransform_ = null;\n }\n\n /**\n * Clean up.\n * @override\n */\n disposeInternal() {\n this.vectorRenderer_.dispose();\n super.disposeInternal();\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../../Feature\").default>>} Promise that resolves with an array of features.\n * @override\n */\n getFeatures(pixel) {\n if (!this.vectorRenderer_) {\n return Promise.resolve([]);\n }\n const vectorPixel = apply(\n this.coordinateToVectorPixelTransform_,\n apply(this.renderedPixelToCoordinateTransform_, pixel.slice()),\n );\n return this.vectorRenderer_.getFeatures(vectorPixel);\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n * @override\n */\n handleFontsChanged() {\n this.vectorRenderer_.handleFontsChanged();\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrame(frameState) {\n const pixelRatio = frameState.pixelRatio;\n const viewState = frameState.viewState;\n const viewResolution = viewState.resolution;\n\n const hints = frameState.viewHints;\n const vectorRenderer = this.vectorRenderer_;\n let renderedExtent = frameState.extent;\n if (this.layerImageRatio_ !== 1) {\n renderedExtent = renderedExtent.slice(0);\n scaleFromCenter(renderedExtent, this.layerImageRatio_);\n }\n const width = getWidth(renderedExtent) / viewResolution;\n const height = getHeight(renderedExtent) / viewResolution;\n\n if (\n !hints[ViewHint.ANIMATING] &&\n !hints[ViewHint.INTERACTING] &&\n !isEmpty(renderedExtent)\n ) {\n vectorRenderer.useContainer(null, null);\n const context = vectorRenderer.context;\n const layerState = frameState.layerStatesArray[frameState.layerIndex];\n const imageLayerState = Object.assign({}, layerState, {opacity: 1});\n const imageFrameState = /** @type {import(\"../../Map.js\").FrameState} */ (\n Object.assign({}, frameState, {\n extent: renderedExtent,\n size: [width, height],\n viewState: /** @type {import(\"../../View.js\").State} */ (\n Object.assign({}, frameState.viewState, {\n rotation: 0,\n })\n ),\n layerStatesArray: [imageLayerState],\n layerIndex: 0,\n declutter: null,\n })\n );\n const declutter = this.getLayer().getDeclutter();\n if (declutter) {\n imageFrameState.declutter = {\n [declutter]: new RBush(9),\n };\n }\n const image = new ImageCanvas(\n renderedExtent,\n viewResolution,\n pixelRatio,\n context.canvas,\n function (callback) {\n if (\n vectorRenderer.prepareFrame(imageFrameState) &&\n vectorRenderer.replayGroupChanged\n ) {\n vectorRenderer.clipping = false;\n vectorRenderer.renderFrame(imageFrameState, null);\n vectorRenderer.renderDeclutter(imageFrameState);\n vectorRenderer.renderDeferred(imageFrameState);\n callback();\n }\n },\n );\n\n image.addEventListener(EventType.CHANGE, () => {\n if (image.getState() !== ImageState.LOADED) {\n return;\n }\n this.image = image;\n const imagePixelRatio = image.getPixelRatio();\n const renderedResolution =\n (fromResolutionLike(image.getResolution()) * pixelRatio) /\n imagePixelRatio;\n this.renderedResolution = renderedResolution;\n this.coordinateToVectorPixelTransform_ = compose(\n this.coordinateToVectorPixelTransform_,\n width / 2,\n height / 2,\n 1 / renderedResolution,\n -1 / renderedResolution,\n 0,\n -viewState.center[0],\n -viewState.center[1],\n );\n });\n image.load();\n }\n\n if (this.image) {\n this.renderedPixelToCoordinateTransform_ =\n frameState.pixelToCoordinateTransform.slice();\n }\n\n return !this.getLayer().getSource()?.loading && !!this.image;\n }\n\n /**\n * @override\n */\n preRender() {}\n\n /**\n * @override\n */\n postRender() {}\n\n /**\n */\n renderDeclutter() {}\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"../vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {Array<import(\"../Map.js\").HitMatch<T>>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n * @override\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n if (this.vectorRenderer_) {\n return this.vectorRenderer_.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n );\n }\n return super.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n );\n }\n}\n\nexport default CanvasVectorImageLayerRenderer;\n","/**\n * @module ol/renderer/canvas/VectorTileLayer\n */\nimport TileState from '../../TileState.js';\nimport ViewHint from '../../ViewHint.js';\nimport {ascending} from '../../array.js';\nimport {wrapX} from '../../coordinate.js';\nimport {\n boundingExtent,\n buffer,\n containsExtent,\n equals,\n getIntersection,\n getTopLeft,\n intersects,\n} from '../../extent.js';\nimport CanvasBuilderGroup from '../../render/canvas/BuilderGroup.js';\nimport CanvasExecutorGroup, {\n DECLUTTER,\n} from '../../render/canvas/ExecutorGroup.js';\nimport ZIndexContext from '../../render/canvas/ZIndexContext.js';\nimport {\n HIT_DETECT_RESOLUTION,\n createHitDetectionImageData,\n hitDetect,\n} from '../../render/canvas/hitdetect.js';\nimport {toSize} from '../../size.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n multiply,\n reset as resetTransform,\n scale,\n scale as scaleTransform,\n translate as translateTransform,\n} from '../../transform.js';\nimport {getUid} from '../../util.js';\nimport {\n getSquaredTolerance as getSquaredRenderTolerance,\n renderFeature,\n} from '../vector.js';\nimport CanvasTileLayerRenderer from './TileLayer.js';\n\n/**\n * @type {!Object<string, Array<import(\"../../render/canvas.js\").BuilderType>>}\n */\nconst IMAGE_REPLAYS = {\n 'image': ['Polygon', 'Circle', 'LineString', 'Image', 'Text'],\n 'hybrid': ['Polygon', 'LineString'],\n 'vector': [],\n};\n\n/**\n * @type {!Object<string, Array<import(\"../../render/canvas.js\").BuilderType>>}\n */\nconst VECTOR_REPLAYS = {\n 'hybrid': ['Image', 'Text', 'Default'],\n 'vector': ['Polygon', 'Circle', 'LineString', 'Image', 'Text', 'Default'],\n};\n\n/**\n * @classdesc\n * Canvas renderer for vector tile layers.\n * @api\n * @extends {CanvasTileLayerRenderer<import(\"../../layer/VectorTile.js\").default<import('../../source/VectorTile.js').default<import('../../Feature.js').FeatureLike>>>}\n */\nclass CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {\n /**\n * @param {import(\"../../layer/VectorTile.js\").default} layer VectorTile layer.\n * @param {import(\"./TileLayer.js\").Options} options Options.\n */\n constructor(layer, options) {\n super(layer, options);\n\n /** @private */\n this.boundHandleStyleImageChange_ = this.handleStyleImageChange_.bind(this);\n\n /**\n * @private\n * @type {number}\n */\n this.renderedLayerRevision_;\n\n /**\n * @private\n * @type {import(\"../../transform\").Transform}\n */\n this.renderedPixelToCoordinateTransform_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRotation_;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedOpacity_ = 1;\n\n /**\n * @private\n * @type {import(\"../../transform.js\").Transform}\n */\n this.tmpTransform_ = createTransform();\n\n /**\n * @private\n * @type {Array<ZIndexContext>}\n */\n this.tileClipContexts_ = null;\n }\n\n /**\n * @param {import(\"../../VectorRenderTile.js\").default} tile Tile.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} x Left of the tile.\n * @param {number} y Top of the tile.\n * @param {number} w Width of the tile.\n * @param {number} h Height of the tile.\n * @param {number} gutter Tile gutter.\n * @param {boolean} transition Apply an alpha transition.\n * @override\n */\n drawTile(tile, frameState, x, y, w, h, gutter, transition) {\n this.updateExecutorGroup_(\n tile,\n frameState.pixelRatio,\n frameState.viewState.projection,\n );\n if (this.tileImageNeedsRender_(tile)) {\n this.renderTileImage_(tile, frameState);\n }\n super.drawTile(tile, frameState, x, y, w, h, gutter, transition);\n }\n\n /**\n * @param {number} z Tile coordinate z.\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {import(\"../../Tile.js\").default|null} Tile (or null if outside source extent).\n * @override\n */\n getTile(z, x, y, frameState) {\n const tile = /** @type {import(\"../../VectorRenderTile.js\").default} */ (\n this.getOrCreateTile(z, x, y, frameState)\n );\n if (!tile) {\n return null;\n }\n\n const viewState = frameState.viewState;\n const resolution = viewState.resolution;\n const viewHints = frameState.viewHints;\n const hifi = !(\n viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]\n );\n if (hifi || !tile.wantedResolution) {\n tile.wantedResolution = resolution;\n }\n return tile;\n }\n\n /**\n * Determine whether render should be called.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @return {boolean} Layer is ready to be rendered.\n * @override\n */\n prepareFrame(frameState) {\n const layerRevision = this.getLayer().getRevision();\n if (this.renderedLayerRevision_ !== layerRevision) {\n this.renderedLayerRevision_ = layerRevision;\n this.renderedTiles.length = 0;\n }\n return super.prepareFrame(frameState);\n }\n\n /**\n * @param {import(\"../../VectorRenderTile.js\").default} tile Tile.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @private\n */\n updateExecutorGroup_(tile, pixelRatio, projection) {\n const layer = /** @type {import(\"../../layer/VectorTile.js\").default} */ (\n this.getLayer()\n );\n const revision = layer.getRevision();\n const renderOrder = layer.getRenderOrder() || null;\n\n const resolution = tile.wantedResolution;\n const builderState = tile.getReplayState(layer);\n if (\n !builderState.dirty &&\n builderState.renderedResolution === resolution &&\n builderState.renderedRevision == revision &&\n builderState.renderedRenderOrder == renderOrder\n ) {\n return;\n }\n\n const source = layer.getSource();\n const declutter = !!layer.getDeclutter();\n const sourceTileGrid = source.getTileGrid();\n const tileGrid = source.getTileGridForProjection(projection);\n const tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);\n\n const sourceTiles = source.getSourceTiles(pixelRatio, projection, tile);\n const layerUid = getUid(layer);\n delete tile.hitDetectionImageData[layerUid];\n tile.executorGroups[layerUid] = [];\n builderState.dirty = false;\n for (let t = 0, tt = sourceTiles.length; t < tt; ++t) {\n const sourceTile = sourceTiles[t];\n if (sourceTile.getState() != TileState.LOADED) {\n continue;\n }\n const sourceTileCoord = sourceTile.tileCoord;\n const sourceTileExtent =\n sourceTileGrid.getTileCoordExtent(sourceTileCoord);\n const sharedExtent = getIntersection(tileExtent, sourceTileExtent);\n const builderExtent = buffer(\n sharedExtent,\n layer.getRenderBuffer() * resolution,\n this.tempExtent,\n );\n const bufferedExtent = equals(sourceTileExtent, sharedExtent)\n ? null\n : builderExtent;\n const builderGroup = new CanvasBuilderGroup(\n 0,\n sharedExtent,\n resolution,\n pixelRatio,\n );\n const squaredTolerance = getSquaredRenderTolerance(\n resolution,\n pixelRatio,\n );\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} [index] Render order index.\n * @this {CanvasVectorTileLayerRenderer}\n */\n const render = function (feature, index) {\n let styles;\n const styleFunction =\n feature.getStyleFunction() || layer.getStyleFunction();\n if (styleFunction) {\n styles = styleFunction(feature, resolution);\n }\n if (styles) {\n const dirty = this.renderFeature(\n feature,\n squaredTolerance,\n styles,\n builderGroup,\n declutter,\n index,\n );\n builderState.dirty = builderState.dirty || dirty;\n }\n };\n\n const features = sourceTile.getFeatures();\n if (renderOrder && renderOrder !== builderState.renderedRenderOrder) {\n features.sort(renderOrder);\n }\n for (let i = 0, ii = features.length; i < ii; ++i) {\n const feature = features[i];\n if (\n !bufferedExtent ||\n intersects(bufferedExtent, feature.getGeometry().getExtent())\n ) {\n render.call(this, feature, i);\n }\n }\n const executorGroupInstructions = builderGroup.finish();\n // no need to clip when the render tile is covered by a single source tile\n const replayExtent =\n layer.getRenderMode() !== 'vector' &&\n declutter &&\n sourceTiles.length === 1\n ? null\n : sharedExtent;\n const renderingReplayGroup = new CanvasExecutorGroup(\n replayExtent,\n resolution,\n pixelRatio,\n source.getOverlaps(),\n executorGroupInstructions,\n layer.getRenderBuffer(),\n true,\n );\n tile.executorGroups[layerUid].push(renderingReplayGroup);\n }\n builderState.renderedRevision = revision;\n builderState.renderedRenderOrder = renderOrder;\n builderState.renderedResolution = resolution;\n }\n\n /**\n * @param {import(\"../../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {import(\"../vector.js\").FeatureCallback<T>} callback Feature callback.\n * @param {Array<import(\"../Map.js\").HitMatch<T>>} matches The hit detected matches with tolerance.\n * @return {T|undefined} Callback result.\n * @template T\n * @override\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n callback,\n matches,\n ) {\n const resolution = frameState.viewState.resolution;\n const rotation = frameState.viewState.rotation;\n hitTolerance = hitTolerance == undefined ? 0 : hitTolerance;\n const layer = this.getLayer();\n const source = layer.getSource();\n const tileGrid = source.getTileGridForProjection(\n frameState.viewState.projection,\n );\n\n const hitExtent = boundingExtent([coordinate]);\n buffer(hitExtent, resolution * hitTolerance, hitExtent);\n\n /** @type {!Object<string, import(\"../Map.js\").HitMatch<T>|true>} */\n const features = {};\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {number} distanceSq The squared distance to the click position.\n * @return {T|undefined} Callback result.\n */\n const featureCallback = function (feature, geometry, distanceSq) {\n let key = feature.getId();\n if (key === undefined) {\n key = getUid(feature);\n }\n const match = features[key];\n if (!match) {\n if (distanceSq === 0) {\n features[key] = true;\n return callback(feature, layer, geometry);\n }\n matches.push(\n (features[key] = {\n feature: feature,\n layer: layer,\n geometry: geometry,\n distanceSq: distanceSq,\n callback: callback,\n }),\n );\n } else if (match !== true && distanceSq < match.distanceSq) {\n if (distanceSq === 0) {\n features[key] = true;\n matches.splice(matches.lastIndexOf(match), 1);\n return callback(feature, layer, geometry);\n }\n match.geometry = geometry;\n match.distanceSq = distanceSq;\n }\n return undefined;\n };\n\n const renderedTiles =\n /** @type {Array<import(\"../../VectorRenderTile.js\").default>} */ (\n this.renderedTiles\n );\n const layerUid = getUid(layer);\n const declutter = layer.getDeclutter();\n const declutteredFeatures = declutter\n ? frameState.declutter?.[declutter]?.all().map((item) => item.value)\n : null;\n let found;\n foundFeature: for (let i = 0, ii = renderedTiles.length; i < ii; ++i) {\n const tile = renderedTiles[i];\n const tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);\n if (!intersects(tileExtent, hitExtent)) {\n continue;\n }\n\n const executorGroups = tile.executorGroups[layerUid];\n for (let t = 0, tt = executorGroups.length; t < tt; ++t) {\n found = executorGroups[t].forEachFeatureAtCoordinate(\n coordinate,\n resolution,\n rotation,\n hitTolerance,\n featureCallback,\n declutteredFeatures,\n );\n if (found) {\n break foundFeature;\n }\n }\n }\n return found;\n }\n\n /**\n * Asynchronous layer level hit detection.\n * @param {import(\"../../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../../Feature.js\").FeatureLike>>} Promise that resolves with an array of features.\n * @override\n */\n getFeatures(pixel) {\n if (this.renderedTiles.length === 0) {\n return Promise.resolve([]);\n }\n return new Promise((resolve, reject) => {\n const layer = this.getLayer();\n const source = layer.getSource();\n const projection = this.renderedProjection;\n const projectionExtent = projection.getExtent();\n const resolution = this.renderedResolution;\n const tileGrid = source.getTileGridForProjection(projection);\n const coordinate = applyTransform(\n this.renderedPixelToCoordinateTransform_,\n pixel.slice(),\n );\n const tileCoordString = tileGrid\n .getTileCoordForCoordAndResolution(coordinate, resolution)\n .toString();\n const tile =\n /** @type {Array<import(\"../../VectorRenderTile.js\").default>} */ (\n this.renderedTiles\n ).find(\n (tile) =>\n tile.tileCoord.toString() === tileCoordString &&\n tile.getState() === TileState.LOADED,\n );\n if (!tile || tile.loadingSourceTiles > 0) {\n resolve([]);\n return;\n }\n if (\n source.getWrapX() &&\n projection.canWrapX() &&\n !containsExtent(\n projectionExtent,\n tileGrid.getTileCoordExtent(tile.tileCoord),\n )\n ) {\n wrapX(coordinate, projection);\n }\n const layerUid = getUid(layer);\n const extent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);\n const corner = getTopLeft(extent);\n const tilePixel = [\n (coordinate[0] - corner[0]) / resolution,\n (corner[1] - coordinate[1]) / resolution,\n ];\n const features = tile\n .getSourceTiles()\n .reduce(\n (accumulator, sourceTile) =>\n accumulator.concat(sourceTile.getFeatures()),\n /** @type {Array<import(\"../../Feature.js\").FeatureLike>} */ ([]),\n );\n let hitDetectionImageData = tile.hitDetectionImageData[layerUid];\n if (!hitDetectionImageData) {\n const tileSize = toSize(\n tileGrid.getTileSize(\n tileGrid.getZForResolution(resolution, source.zDirection),\n ),\n );\n const rotation = this.renderedRotation_;\n const transforms = [\n this.getRenderTransform(\n tileGrid.getTileCoordCenter(tile.wrappedTileCoord),\n resolution,\n 0,\n HIT_DETECT_RESOLUTION,\n tileSize[0] * HIT_DETECT_RESOLUTION,\n tileSize[1] * HIT_DETECT_RESOLUTION,\n 0,\n ),\n ];\n hitDetectionImageData = createHitDetectionImageData(\n tileSize,\n transforms,\n features,\n layer.getStyleFunction(),\n tileGrid.getTileCoordExtent(tile.wrappedTileCoord),\n tile.getReplayState(layer).renderedResolution,\n rotation,\n );\n tile.hitDetectionImageData[layerUid] = hitDetectionImageData;\n }\n resolve(hitDetect(tilePixel, features, hitDetectionImageData));\n });\n }\n\n /**\n * @param {import(\"../../extent.js\").Extent} extent Extent.\n * @return {Array<import('../../Feature.js').FeatureLike>} Features.\n */\n getFeaturesInExtent(extent) {\n /** @type {Array<import('../../Feature.js').FeatureLike>} */\n const features = [];\n const tileCache = this.getTileCache();\n if (tileCache.getCount() === 0) {\n return features;\n }\n const source = this.getLayer().getSource();\n const tileGrid = source.getTileGridForProjection(\n this.frameState.viewState.projection,\n );\n const z = tileGrid.getZForResolution(this.renderedResolution);\n /** @type {Object<string, true>} */\n const visitedSourceTiles = {};\n tileCache.forEach((tile) => {\n if (tile.tileCoord[0] !== z || tile.getState() !== TileState.LOADED) {\n return;\n }\n const sourceTiles = tile.getSourceTiles();\n for (let i = 0, ii = sourceTiles.length; i < ii; ++i) {\n const sourceTile = sourceTiles[i];\n const key = sourceTile.getKey();\n if (key in visitedSourceTiles) {\n continue;\n }\n visitedSourceTiles[key] = true;\n const tileCoord = sourceTile.tileCoord;\n if (intersects(extent, tileGrid.getTileCoordExtent(tileCoord))) {\n const tileFeatures = sourceTile.getFeatures();\n if (tileFeatures) {\n for (let j = 0, jj = tileFeatures.length; j < jj; ++j) {\n const candidate = tileFeatures[j];\n const geometry = candidate.getGeometry();\n if (intersects(extent, geometry.getExtent())) {\n features.push(candidate);\n }\n }\n }\n }\n }\n });\n return features;\n }\n\n /**\n * Perform action necessary to get the layer rendered after new fonts have loaded\n * @override\n */\n handleFontsChanged() {\n const layer = this.getLayer();\n if (layer.getVisible() && this.renderedLayerRevision_ !== undefined) {\n layer.changed();\n }\n }\n\n /**\n * Handle changes in image style state.\n * @param {import(\"../../events/Event.js\").default} event Image style change event.\n * @private\n */\n handleStyleImageChange_(event) {\n this.renderIfReadyAndVisible();\n }\n\n /**\n * Render declutter items for this layer\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @param {import(\"../../layer/Layer.js\").State} layerState Layer state.\n */\n renderDeclutter(frameState, layerState) {\n const context = this.context;\n const alpha = context.globalAlpha;\n context.globalAlpha = layerState.opacity;\n const viewHints = frameState.viewHints;\n const hifi = !(\n viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]\n );\n const scaledCanvasSize = [\n this.context.canvas.width,\n this.context.canvas.height,\n ];\n const declutter = this.getLayer().getDeclutter();\n const declutterTree = declutter\n ? frameState.declutter?.[declutter]\n : undefined;\n const layerUid = getUid(this.getLayer());\n const tiles =\n /** @type {Array<import(\"../../VectorRenderTile.js\").default>} */ (\n this.renderedTiles\n );\n for (let i = 0, ii = tiles.length; i < ii; ++i) {\n const tile = tiles[i];\n const executorGroups = tile.executorGroups[layerUid];\n if (executorGroups) {\n for (let j = executorGroups.length - 1; j >= 0; --j) {\n executorGroups[j].execute(\n this.context,\n scaledCanvasSize,\n this.getTileRenderTransform(tile, frameState),\n frameState.viewState.rotation,\n hifi,\n DECLUTTER,\n declutterTree,\n );\n }\n }\n }\n context.globalAlpha = alpha;\n }\n\n /**\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @override\n */\n renderDeferredInternal(frameState) {\n const tiles =\n /** @type {Array<import(\"../../VectorRenderTile.js\").default>} */ (\n this.renderedTiles\n );\n const layerUid = getUid(this.getLayer());\n const executorGroups = tiles.reduce((acc, tile, index) => {\n tile.executorGroups[layerUid].forEach((executorGroup) =>\n acc.push({\n executorGroup,\n index,\n }),\n );\n return acc;\n }, /** @type {Array<{executorGroup: CanvasExecutorGroup, index: number}>} */ ([]));\n\n const executorGroupZIndexContexts = executorGroups.map(({executorGroup}) =>\n executorGroup.getDeferredZIndexContexts(),\n );\n /** @type {Object<number, true>} */\n const usedZIndices = {};\n for (let i = 0, ii = executorGroups.length; i < ii; ++i) {\n const executorGroupZindexContext =\n executorGroups[i].executorGroup.getDeferredZIndexContexts();\n for (const key in executorGroupZindexContext) {\n usedZIndices[key] = true;\n }\n }\n const zIndexKeys = Object.keys(usedZIndices).map(Number).sort(ascending);\n zIndexKeys.forEach((zIndex) => {\n executorGroupZIndexContexts.forEach((zIndexContexts, i) => {\n if (!zIndexContexts[zIndex]) {\n return;\n }\n zIndexContexts[zIndex].forEach((zIndexContext) => {\n const {executorGroup, index} = executorGroups[i];\n const context = executorGroup.getRenderedContext();\n const alpha = context.globalAlpha;\n context.globalAlpha = this.renderedOpacity_;\n const tileClipContext = this.tileClipContexts_[index];\n if (tileClipContext) {\n tileClipContext.draw(context);\n }\n zIndexContext.draw(context);\n if (tileClipContext) {\n context.restore();\n }\n context.globalAlpha = alpha;\n zIndexContext.clear();\n });\n zIndexContexts[zIndex].length = 0;\n });\n });\n }\n\n /**\n * @param {import(\"../../VectorRenderTile.js\").default} tile The tile\n * @param {import('../../Map.js').FrameState} frameState Current frame state\n * @return {import('../../transform.js').Transform} Transform to use to render this tile\n */\n getTileRenderTransform(tile, frameState) {\n const pixelRatio = frameState.pixelRatio;\n const viewState = frameState.viewState;\n const center = viewState.center;\n const resolution = viewState.resolution;\n const rotation = viewState.rotation;\n const size = frameState.size;\n const width = Math.round(size[0] * pixelRatio);\n const height = Math.round(size[1] * pixelRatio);\n\n const source = this.getLayer().getSource();\n const tileGrid = source.getTileGridForProjection(\n frameState.viewState.projection,\n );\n const tileCoord = tile.tileCoord;\n const tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);\n const worldOffset =\n tileGrid.getTileCoordExtent(tileCoord, this.tempExtent)[0] -\n tileExtent[0];\n const transform = multiply(\n scale(this.inversePixelTransform.slice(), 1 / pixelRatio, 1 / pixelRatio),\n this.getRenderTransform(\n center,\n resolution,\n rotation,\n pixelRatio,\n width,\n height,\n worldOffset,\n ),\n );\n return transform;\n }\n\n /**\n * Render the vectors for this layer.\n * @param {CanvasRenderingContext2D} context Target context.\n * @param {import(\"../../Map.js\").FrameState} frameState Frame state.\n * @override\n */\n postRender(context, frameState) {\n const viewHints = frameState.viewHints;\n const hifi = !(\n viewHints[ViewHint.ANIMATING] || viewHints[ViewHint.INTERACTING]\n );\n\n this.renderedPixelToCoordinateTransform_ =\n frameState.pixelToCoordinateTransform.slice();\n this.renderedRotation_ = frameState.viewState.rotation;\n this.renderedOpacity_ =\n frameState.layerStatesArray[frameState.layerIndex].opacity;\n\n const layer = /** @type {import(\"../../layer/VectorTile.js\").default} */ (\n this.getLayer()\n );\n const renderMode = layer.getRenderMode();\n const alpha = context.globalAlpha;\n context.globalAlpha = this.renderedOpacity_;\n const declutter = layer.getDeclutter();\n const replayTypes = declutter\n ? VECTOR_REPLAYS[renderMode].filter((type) => !DECLUTTER.includes(type))\n : VECTOR_REPLAYS[renderMode];\n const viewState = frameState.viewState;\n const rotation = viewState.rotation;\n const tileSource = layer.getSource();\n const tileGrid = tileSource.getTileGridForProjection(viewState.projection);\n const z = tileGrid.getZForResolution(\n viewState.resolution,\n tileSource.zDirection,\n );\n\n const tiles =\n /** @type {Array<import(\"../../VectorRenderTile.js\").default>} */ (\n this.renderedTiles\n );\n const clips = [];\n const clipZs = [];\n const tileClipContexts = [];\n const layerUid = getUid(layer);\n let ready = true;\n for (let i = tiles.length - 1; i >= 0; --i) {\n const tile = tiles[i];\n ready = ready && !tile.getReplayState(layer).dirty;\n const executorGroups = tile.executorGroups[layerUid].filter((group) =>\n group.hasExecutors(replayTypes),\n );\n if (executorGroups.length === 0) {\n continue;\n }\n const transform = this.getTileRenderTransform(tile, frameState);\n const currentZ = tile.tileCoord[0];\n let contextSaved = false;\n // Clip mask for regions in this tile that already filled by a higher z tile\n const currentClip = executorGroups[0].getClipCoords(transform);\n let clipContext = context;\n let tileClipContext;\n if (currentClip) {\n tileClipContext = new ZIndexContext();\n clipContext = tileClipContext.getContext();\n for (let j = 0, jj = clips.length; j < jj; ++j) {\n if (z !== currentZ && currentZ < clipZs[j]) {\n const clip = clips[j];\n if (\n intersects(\n [\n currentClip[0],\n currentClip[3],\n currentClip[4],\n currentClip[7],\n ],\n [clip[0], clip[3], clip[4], clip[7]],\n )\n ) {\n if (!contextSaved) {\n clipContext.save();\n contextSaved = true;\n }\n clipContext.beginPath();\n // counter-clockwise (outer ring) for current tile\n clipContext.moveTo(currentClip[0], currentClip[1]);\n clipContext.lineTo(currentClip[2], currentClip[3]);\n clipContext.lineTo(currentClip[4], currentClip[5]);\n clipContext.lineTo(currentClip[6], currentClip[7]);\n // clockwise (inner ring) for higher z tile\n clipContext.moveTo(clip[6], clip[7]);\n clipContext.lineTo(clip[4], clip[5]);\n clipContext.lineTo(clip[2], clip[3]);\n clipContext.lineTo(clip[0], clip[1]);\n clipContext.clip();\n }\n }\n }\n clips.push(currentClip);\n clipZs.push(currentZ);\n }\n for (let t = 0, tt = executorGroups.length; t < tt; ++t) {\n const executorGroup = executorGroups[t];\n executorGroup.execute(\n context,\n [context.canvas.width, context.canvas.height],\n transform,\n rotation,\n hifi,\n replayTypes,\n frameState.declutter?.[declutter],\n );\n }\n if (contextSaved) {\n if (clipContext === context) {\n clipContext.restore();\n } else {\n tileClipContexts[i] = tileClipContext;\n }\n }\n }\n context.globalAlpha = alpha;\n this.ready = ready;\n this.tileClipContexts_ = tileClipContexts;\n if (!frameState.declutter) {\n this.renderDeferredInternal(frameState);\n }\n\n super.postRender(context, frameState);\n }\n\n /**\n * @param {import(\"../../Feature.js\").FeatureLike} feature Feature.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../../style/Style.js\").default|Array<import(\"../../style/Style.js\").default>} styles The style or array of styles.\n * @param {import(\"../../render/canvas/BuilderGroup.js\").default} builderGroup Replay group.\n * @param {boolean} [declutter] Enable decluttering.\n * @param {number} [index] Render order index.\n * @return {boolean} `true` if an image is loading.\n */\n renderFeature(\n feature,\n squaredTolerance,\n styles,\n builderGroup,\n declutter,\n index,\n ) {\n if (!styles) {\n return false;\n }\n let loading = false;\n if (Array.isArray(styles)) {\n for (let i = 0, ii = styles.length; i < ii; ++i) {\n loading =\n renderFeature(\n builderGroup,\n feature,\n styles[i],\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n undefined,\n declutter,\n index,\n ) || loading;\n }\n } else {\n loading = renderFeature(\n builderGroup,\n feature,\n styles,\n squaredTolerance,\n this.boundHandleStyleImageChange_,\n undefined,\n declutter,\n index,\n );\n }\n return loading;\n }\n\n /**\n * @param {import(\"../../VectorRenderTile.js\").default} tile Tile.\n * @return {boolean} A new tile image was rendered.\n * @private\n */\n tileImageNeedsRender_(tile) {\n const layer = /** @type {import(\"../../layer/VectorTile.js\").default} */ (\n this.getLayer()\n );\n if (layer.getRenderMode() === 'vector') {\n return false;\n }\n const replayState = tile.getReplayState(layer);\n const revision = layer.getRevision();\n const resolution = tile.wantedResolution;\n return (\n replayState.renderedTileResolution !== resolution ||\n replayState.renderedTileRevision !== revision\n );\n }\n\n /**\n * @param {import(\"../../VectorRenderTile.js\").default} tile Tile.\n * @param {import(\"../../Map\").FrameState} frameState Frame state.\n * @private\n */\n renderTileImage_(tile, frameState) {\n const layer = /** @type {import(\"../../layer/VectorTile.js\").default} */ (\n this.getLayer()\n );\n const replayState = tile.getReplayState(layer);\n const revision = layer.getRevision();\n const executorGroups = tile.executorGroups[getUid(layer)];\n replayState.renderedTileRevision = revision;\n\n const tileCoord = tile.wrappedTileCoord;\n const z = tileCoord[0];\n const source = layer.getSource();\n let pixelRatio = frameState.pixelRatio;\n const viewState = frameState.viewState;\n const projection = viewState.projection;\n const tileGrid = source.getTileGridForProjection(projection);\n const tileResolution = tileGrid.getResolution(tile.tileCoord[0]);\n const renderPixelRatio =\n (frameState.pixelRatio / tile.wantedResolution) * tileResolution;\n const resolution = tileGrid.getResolution(z);\n const context = tile.getContext();\n\n // Increase tile size when overzooming for low pixel ratio, to avoid blurry tiles\n pixelRatio = Math.round(\n Math.max(pixelRatio, renderPixelRatio / pixelRatio),\n );\n const size = source.getTilePixelSize(z, pixelRatio, projection);\n context.canvas.width = size[0];\n context.canvas.height = size[1];\n const renderScale = pixelRatio / renderPixelRatio;\n if (renderScale !== 1) {\n const canvasTransform = resetTransform(this.tmpTransform_);\n scaleTransform(canvasTransform, renderScale, renderScale);\n context.setTransform.apply(context, canvasTransform);\n }\n const tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tempExtent);\n const pixelScale = renderPixelRatio / resolution;\n const transform = resetTransform(this.tmpTransform_);\n scaleTransform(transform, pixelScale, -pixelScale);\n translateTransform(transform, -tileExtent[0], -tileExtent[3]);\n for (let i = 0, ii = executorGroups.length; i < ii; ++i) {\n const executorGroup = executorGroups[i];\n executorGroup.execute(\n context,\n [\n context.canvas.width * renderScale,\n context.canvas.height * renderScale,\n ],\n transform,\n 0,\n true,\n IMAGE_REPLAYS[layer.getRenderMode()],\n null,\n );\n }\n replayState.renderedTileResolution = tile.wantedResolution;\n }\n}\n\nexport default CanvasVectorTileLayerRenderer;\n","/**\n * @module ol/proj/proj4\n */\nimport {\n addCoordinateTransforms,\n addEquivalentProjections,\n addProjection,\n createSafeCoordinateTransform,\n} from '../proj.js';\nimport Projection from './Projection.js';\nimport {get as getCachedProjection} from './projections.js';\nimport {get as getTransform} from './transforms.js';\n\n/**\n * @type {import(\"proj4\")|null}\n */\nlet registered = null;\n\n/**\n * @return {boolean} Proj4 has been registered.\n */\nexport function isRegistered() {\n return !!registered;\n}\n\n/**\n * Unsets the shared proj4 previously set with register.\n */\nexport function unregister() {\n registered = null;\n}\n\n/**\n * Make projections defined in proj4 (with `proj4.defs()`) available in\n * OpenLayers. Requires proj4 >= 2.8.0.\n *\n * This function should be called whenever changes are made to the proj4\n * registry, e.g. after calling `proj4.defs()`. Existing transforms will not be\n * modified by this function.\n *\n * @param {import(\"proj4\")} proj4 Proj4.\n * @api\n */\nexport function register(proj4) {\n registered = proj4;\n\n const projCodes = Object.keys(proj4.defs);\n const len = projCodes.length;\n let i, j;\n for (i = 0; i < len; ++i) {\n const code = projCodes[i];\n if (!getCachedProjection(code)) {\n const def = proj4.defs(code);\n let units = /** @type {import(\"./Units.js\").Units} */ (def.units);\n if (!units && def.projName === 'longlat') {\n units = 'degrees';\n }\n addProjection(\n new Projection({\n code: code,\n axisOrientation: def.axis,\n metersPerUnit: def.to_meter,\n units,\n }),\n );\n }\n }\n for (i = 0; i < len; ++i) {\n const code1 = projCodes[i];\n const proj1 = getCachedProjection(code1);\n for (j = 0; j < len; ++j) {\n const code2 = projCodes[j];\n const proj2 = getCachedProjection(code2);\n if (!getTransform(code1, code2)) {\n if (proj4.defs[code1] === proj4.defs[code2]) {\n addEquivalentProjections([proj1, proj2]);\n } else {\n const transform = proj4(code1, code2);\n addCoordinateTransforms(\n proj1,\n proj2,\n createSafeCoordinateTransform(proj1, proj2, transform.forward),\n createSafeCoordinateTransform(proj2, proj1, transform.inverse),\n );\n }\n }\n }\n }\n}\n\n/**\n * @param {number} code The EPSG code.\n * @return {Promise<string>} The proj4 definition.\n */\nlet epsgLookup = async function (code) {\n const response = await fetch(`https://epsg.io/${code}.proj4`);\n if (!response.ok) {\n throw new Error(`Unexpected response from epsg.io: ${response.status}`);\n }\n return response.text();\n};\n\n/**\n * Set the lookup function for getting proj4 definitions given an EPSG code.\n * By default, the {@link module:ol/proj/proj4.fromEPSGCode} function uses the\n * epsg.io website for proj4 definitions. This can be changed by providing a\n * different lookup function.\n *\n * @param {function(number):Promise<string>} func The lookup function.\n * @api\n */\nexport function setEPSGLookup(func) {\n epsgLookup = func;\n}\n\n/**\n * Get the current EPSG lookup function.\n *\n * @return {function(number):Promise<string>} The EPSG lookup function.\n */\nexport function getEPSGLookup() {\n return epsgLookup;\n}\n\n/**\n * Get a projection from an EPSG code. This function fetches the projection\n * definition from the epsg.io website, registers this definition for use with\n * proj4, and returns a configured projection. You must call import proj4 and\n * call {@link module:ol/proj/proj4.register} before using this function.\n *\n * If the projection definition is already registered with proj4, it will not\n * be fetched again (so it is ok to call this function multiple times with the\n * same code).\n *\n * @param {number|string} code The EPSG code (e.g. 4326 or 'EPSG:4326').\n * @return {Promise<Projection>} The projection.\n * @api\n */\nexport async function fromEPSGCode(code) {\n if (typeof code === 'string') {\n code = parseInt(code.split(':').pop(), 10);\n }\n\n const proj4 = registered;\n if (!proj4) {\n throw new Error('Proj4 must be registered first with register(proj4)');\n }\n\n const epsgCode = 'EPSG:' + code;\n if (proj4.defs(epsgCode)) {\n return getCachedProjection(epsgCode);\n }\n\n proj4.defs(epsgCode, await epsgLookup(code));\n register(proj4);\n\n return getCachedProjection(epsgCode);\n}\n\n/**\n * Generate an EPSG lookup function which uses the MapTiler Coordinates API to find projection\n * definitions which do not require proj4 to be configured to handle `+nadgrids` parameters.\n * Call {@link module:ol/proj/proj4.setEPSGLookup} use the function for lookups\n * `setEPSGLookup(epsgLookupMapTiler('{YOUR_MAPTILER_API_KEY_HERE}'))`.\n *\n * @param {string} key MapTiler API key. Get your own API key at https://www.maptiler.com/cloud/.\n * @return {function(number):Promise<string>} The EPSG lookup function.\n * @api\n */\nexport function epsgLookupMapTiler(key) {\n return async function (code) {\n const response = await fetch(\n `https://api.maptiler.com/coordinates/search/code:${code}.json?transformations=true&exports=true&key=${key}`,\n );\n if (!response.ok) {\n throw new Error(\n `Unexpected response from maptiler.com: ${response.status}`,\n );\n }\n return response.json().then((json) => {\n const results = json['results'];\n if (results?.length > 0) {\n const result = results.filter(\n (r) =>\n r['id']?.['authority'] === 'EPSG' && r['id']?.['code'] === code,\n )[0];\n if (result) {\n const transforms = result['transformations'];\n if (transforms?.length > 0) {\n // use default transform if it does not require grids\n const defaultTransform = result['default_transformation'];\n if (\n transforms.filter(\n (t) =>\n t['id']?.['authority'] === defaultTransform?.['authority'] &&\n t['id']?.['code'] === defaultTransform?.['code'] &&\n t['grids']?.length === 0,\n ).length > 0\n ) {\n return result['exports']?.['proj4'];\n }\n // otherwise use most accurate alternative without grids\n const transform = transforms\n .filter(\n (t) =>\n t['grids']?.length === 0 &&\n t['target_crs']?.['authority'] === 'EPSG' &&\n t['target_crs']?.['code'] === 4326 &&\n t['deprecated'] === false &&\n t['usable'] === true,\n )\n .sort((t1, t2) => t1['accuracy'] - t2['accuracy'])[0]?.[\n 'exports'\n ]?.['proj4'];\n if (transform) {\n return transform;\n }\n }\n // fallback to default\n return result['exports']?.['proj4'];\n }\n }\n });\n };\n}\n","/**\n * @module ol/layer/Flow\n */\nimport {ColorType} from '../expr/expression.js';\nimport {\n getStringNumberEquivalent,\n newCompilationContext,\n uniformNameForVariable,\n} from '../expr/gpu.js';\nimport {expressionToGlsl} from '../render/webgl/compileUtil.js';\nimport FlowLayerRenderer, {A, U, V} from '../renderer/webgl/FlowLayer.js';\nimport {Attributes as BA, Uniforms as BU} from '../renderer/webgl/TileLayer.js';\nimport BaseTileLayer from './BaseTile.js';\nimport LayerProperty from './Property.js';\n\n/**\n * @typedef {import(\"../source/DataTile.js\").default} SourceType\n */\n\n/**\n * @typedef {Object} Style\n * Translates tile data to rendered pixels.\n *\n * @property {Object<string, (string|number)>} [variables] Style variables. Each variable must hold a number or string. These\n * variables can be used in the `color` {@link import(\"../expr/expression.js\").ExpressionValue expression} using\n * the `['var', 'varName']` operator. To update style variables, use the {@link import(\"./WebGLTile.js\").default#updateStyleVariables} method.\n * @property {import(\"../expr/expression.js\").ExpressionValue} [color] An expression applied to color values.\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} maxSpeed The maximum particle speed.\n * @property {number} [speedFactor=0.001] A larger factor increases the rate at which particles cross the screen.\n * @property {number} [particles=65536] The number of particles to render.\n * @property {Style} [style] Style to apply to the layer.\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`\n * means no preloading.\n * @property {SourceType} [source] Source for this layer.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use {@link module:ol/Map~Map#addLayer}.\n * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.\n * @property {number} [cacheSize=512] The internal texture cache size. This needs to be large enough to render\n * two zoom levels worth of tiles.\n */\n\nconst tileVertexShader = `\n attribute vec2 ${BA.TEXTURE_COORD};\n uniform mat4 ${BU.TILE_TRANSFORM};\n uniform float ${BU.TEXTURE_PIXEL_WIDTH};\n uniform float ${BU.TEXTURE_PIXEL_HEIGHT};\n uniform float ${BU.TEXTURE_RESOLUTION};\n uniform float ${BU.TEXTURE_ORIGIN_X};\n uniform float ${BU.TEXTURE_ORIGIN_Y};\n uniform float ${BU.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${BA.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${BU.TEXTURE_ORIGIN_X} + ${BU.TEXTURE_RESOLUTION} * ${BU.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${BU.TEXTURE_ORIGIN_Y} - ${BU.TEXTURE_RESOLUTION} * ${BU.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${BU.TILE_TRANSFORM} * vec4(${BA.TEXTURE_COORD}, ${BU.DEPTH}, 1.0);\n }\n`;\n\nconst tileFragmentShader = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform vec4 ${BU.RENDER_EXTENT};\n uniform float ${U.MAX_SPEED};\n uniform sampler2D ${BU.TILE_TEXTURE_ARRAY}[1];\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n if (\n v_mapCoord[0] < ${BU.RENDER_EXTENT}[0] ||\n v_mapCoord[1] < ${BU.RENDER_EXTENT}[1] ||\n v_mapCoord[0] > ${BU.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${BU.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 velocity = texture2D(${BU.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n gl_FragColor = vec4((velocity.xy + ${U.MAX_SPEED}) / (2.0 * ${U.MAX_SPEED}), 0, 1);\n }\n`;\n\n/**\n * Sets up a varying position for rendering textures.\n */\nconst quadVertexShader = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute vec2 ${A.POSITION};\n\n varying vec2 ${V.POSITION};\n\n void main() {\n ${V.POSITION} = ${A.POSITION};\n gl_Position = vec4(1.0 - 2.0 * ${A.POSITION}, 0, 1);\n }\n`;\n\n/**\n * Sampes a texture and renders it with a new opacity.\n */\nconst textureFragmentShader = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${U.TEXTURE};\n uniform float ${U.OPACITY};\n\n varying vec2 ${V.POSITION};\n\n void main() {\n vec4 color = texture2D(${U.TEXTURE}, 1.0 - ${V.POSITION});\n gl_FragColor = vec4(floor(255.0 * color * ${U.OPACITY}) / 255.0);\n }\n`;\n\n/**\n * Samples current particle positions, determines new positions based on velocity, and\n * encodes the new position as a color.\n */\nconst particlePositionFragmentShader = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${U.POSITION_TEXTURE};\n uniform sampler2D ${U.VELOCITY_TEXTURE};\n uniform float ${U.RANDOM_SEED};\n uniform float ${U.SPEED_FACTOR};\n uniform float ${U.DROP_RATE};\n uniform float ${U.DROP_RATE_BUMP};\n uniform vec2 ${U.ROTATION};\n uniform vec2 ${U.VIEWPORT_SIZE_PX};\n\n varying vec2 ${V.POSITION};\n\n // pseudo-random generator\n const vec3 randConstants = vec3(12.9898, 78.233, 4375.85453);\n\n float rand(const vec2 co) {\n float t = dot(randConstants.xy, co);\n return fract(sin(t) * (randConstants.z + t));\n }\n\n void main() {\n vec4 positionColor = texture2D(${U.POSITION_TEXTURE}, ${V.POSITION});\n\n // decode particle position from pixel RGBA\n vec2 particlePosition = vec2(\n positionColor.r / 255.0 + positionColor.b,\n positionColor.g / 255.0 + positionColor.a\n );\n\n vec4 velocityColor = texture2D(${U.VELOCITY_TEXTURE}, particlePosition);\n if (velocityColor.a == 0.0) {\n discard;\n }\n\n float vx = 2.0 * velocityColor.r - 1.0;\n float vy = 2.0 * velocityColor.g - 1.0;\n\n // normalized veloicty (magnitude 0 - 1)\n vec2 velocity = vec2(\n vx * ${U.ROTATION}.x - vy * ${U.ROTATION}.y,\n vx * ${U.ROTATION}.y + vy * ${U.ROTATION}.x\n );\n\n // account for aspect ratio (square particle position texture, non-square map)\n float aspectRatio = ${U.VIEWPORT_SIZE_PX}.x / ${U.VIEWPORT_SIZE_PX}.y;\n vec2 offset = vec2(velocity.x / aspectRatio, velocity.y) * ${U.SPEED_FACTOR};\n\n // update particle position, wrapping around the edge\n particlePosition = fract(1.0 + particlePosition + offset);\n\n // a random seed to use for the particle drop\n vec2 seed = (particlePosition + ${V.POSITION}) * ${U.RANDOM_SEED};\n\n // drop rate is a chance a particle will restart at random position, to avoid degeneration\n float dropRate = ${U.DROP_RATE} + length(velocity) * ${U.DROP_RATE_BUMP};\n float drop = step(1.0 - dropRate, rand(seed));\n\n vec2 randomPosition = vec2(rand(seed + 1.3), rand(seed + 2.1));\n particlePosition = mix(particlePosition, randomPosition, drop);\n\n // encode the new particle position back into RGBA\n gl_FragColor = vec4(\n fract(particlePosition * 255.0),\n floor(particlePosition * 255.0) / 255.0\n );\n }\n`;\n\n/**\n * Samples the particle position texture to decode the particle position\n * based on pixel color.\n */\nconst particleColorVertexShader = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n attribute float ${A.INDEX};\n\n uniform sampler2D ${U.POSITION_TEXTURE};\n uniform float ${U.PARTICLE_COUNT_SQRT};\n\n varying vec2 ${V.POSITION};\n\n void main() {\n vec4 color = texture2D(\n ${U.POSITION_TEXTURE},\n vec2(\n fract(${A.INDEX} / ${U.PARTICLE_COUNT_SQRT}),\n floor(${A.INDEX} / ${U.PARTICLE_COUNT_SQRT}) / ${U.PARTICLE_COUNT_SQRT}\n )\n );\n\n ${V.POSITION} = vec2(\n color.r / 255.0 + color.b,\n color.g / 255.0 + color.a\n );\n\n gl_PointSize = 1.0;\n gl_Position = vec4(\n 2.0 * ${V.POSITION}.x - 1.0,\n 2.0 * ${V.POSITION}.y - 1.0,\n 0,\n 1\n );\n }\n`;\n\n/**\n * @typedef {Object} ParsedStyle\n * @property {string} tileVertexShader The flow tile vertex shader.\n * @property {string} tileFragmentShader The flow tile fragment shader.\n * @property {string} textureVertexShader Generic texture fragment shader.\n * @property {string} textureFragmentShader Generic texture fragment shader.\n * @property {string} particlePositionVertexShader The particle position vertex shader.\n * @property {string} particlePositionFragmentShader The particle position fragment shader.\n * @property {string} particleColorVertexShader The particle color vertex shader.\n * @property {string} particleColorFragmentShader The particle color fragment shader.\n */\n\n/**\n * @param {Style} style The layer style.\n * @return {ParsedStyle} Shaders and uniforms generated from the style.\n */\nfunction parseStyle(style) {\n const context = newCompilationContext();\n const pipeline = [];\n\n if (style.color !== undefined) {\n const color = expressionToGlsl(context, style.color, ColorType);\n pipeline.push(`color = ${color};`);\n }\n\n const variableNames = Object.keys(context.variables);\n if (variableNames.length > 1 && !style.variables) {\n throw new Error(\n `Missing variables in style (expected ${context.variables})`,\n );\n }\n\n /** @type {Object<string,import(\"../webgl/Helper\").UniformValue>} */\n const uniforms = {};\n\n for (const variableName of variableNames) {\n if (!(variableName in style.variables)) {\n throw new Error(`Missing '${variableName}' in style variables`);\n }\n\n const uniformName = uniformNameForVariable(variableName);\n uniforms[uniformName] = function () {\n let value = style.variables[variableName];\n if (typeof value === 'string') {\n value = getStringNumberEquivalent(value);\n }\n return value !== undefined ? value : -9999999; // to avoid matching with the first string literal\n };\n }\n\n const uniformDeclarations = Object.keys(uniforms).map(function (name) {\n return `uniform float ${name};`;\n });\n\n const functionDefintions = Object.keys(context.functions).map(\n function (name) {\n return context.functions[name];\n },\n );\n\n const particleColorFragmentShader = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n uniform sampler2D ${U.VELOCITY_TEXTURE};\n uniform float ${U.MAX_SPEED};\n uniform vec2 ${U.ROTATION};\n\n ${uniformDeclarations.join('\\n')}\n\n varying vec2 ${V.POSITION};\n \n ${functionDefintions.join('\\n')}\n\n void main() {\n vec4 velocityColor = texture2D(${U.VELOCITY_TEXTURE}, ${V.POSITION});\n\n float vx = mix(-${U.MAX_SPEED}, ${U.MAX_SPEED}, velocityColor.r);\n float vy = mix(-${U.MAX_SPEED}, ${U.MAX_SPEED}, velocityColor.g);\n\n vec2 velocity = vec2(\n vx * ${U.ROTATION}.x - vy * ${U.ROTATION}.y,\n vx * ${U.ROTATION}.y + vy * ${U.ROTATION}.x\n );\n\n float a_prop_speed = length(velocity);\n\n vec4 color;\n\n ${pipeline.join('\\n')}\n\n if (color.a == 0.0) {\n discard;\n }\n\n gl_FragColor = color;\n }\n `;\n\n return {\n tileVertexShader,\n tileFragmentShader,\n particleColorVertexShader,\n particleColorFragmentShader,\n particlePositionVertexShader: quadVertexShader,\n particlePositionFragmentShader,\n textureVertexShader: quadVertexShader,\n textureFragmentShader,\n };\n}\n\n/**\n * @type {Array<SourceType>}\n */\nconst sources = [];\n\n/**\n * @classdesc\n * Experimental layer that renders particles moving through a vector field.\n *\n * @extends BaseTileLayer<SourceType, FlowLayerRenderer>\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n */\nclass FlowLayer extends BaseTileLayer {\n /**\n * @param {Options} options Flow layer options.\n */\n constructor(options) {\n const baseOptions = Object.assign({}, options);\n delete baseOptions.maxSpeed;\n delete baseOptions.speedFactor;\n delete baseOptions.particles;\n super(baseOptions);\n\n /**\n * @type {Style}\n * @private\n */\n this.style_ = options.style || {};\n\n if (!(options.maxSpeed > 0)) {\n throw new Error('maxSpeed is required');\n }\n /**\n * @type {number}\n * @private\n */\n this.maxSpeed_ = options.maxSpeed;\n\n /**\n * @type {number}\n * @private\n */\n this.speedFactor_ = options.speedFactor;\n\n /**\n * @type {number}\n * @private\n */\n this.particles_ = options.particles;\n\n /**\n * @type {Object<string, (string|number)>}\n * @private\n */\n this.styleVariables_ = this.style_.variables || {};\n\n this.addChangeListener(LayerProperty.SOURCE, this.handleSourceUpdate_);\n }\n\n /**\n * @private\n */\n handleSourceUpdate_() {\n if (this.hasRenderer()) {\n this.getRenderer().clearCache();\n }\n }\n\n /**\n * Update any variables used by the layer style and trigger a re-render.\n * @param {Object<string, number>} variables Variables to update.\n */\n updateStyleVariables(variables) {\n Object.assign(this.styleVariables_, variables);\n this.changed();\n }\n\n /**\n * Gets the sources for this layer, for a given extent and resolution.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<SourceType>} Sources.\n */\n getSources(extent, resolution) {\n const source = this.getSource();\n sources[0] = source;\n return sources;\n }\n\n /**\n * @override\n */\n createRenderer() {\n const parsedStyle = parseStyle(this.style_);\n\n return new FlowLayerRenderer(this, {\n ...parsedStyle,\n cacheSize: this.getCacheSize(),\n maxSpeed: this.maxSpeed_,\n speedFactor: this.speedFactor_,\n particles: this.particles_,\n });\n }\n}\n\n/**\n * Clean up underlying WebGL resources.\n * @function\n */\nFlowLayer.prototype.dispose;\n\nexport default FlowLayer;\n","/**\n * @module ol/geom/flat/geodesic\n */\nimport {squaredSegmentDistance, toDegrees, toRadians} from '../../math.js';\nimport {get as getProjection, getTransform} from '../../proj.js';\n\n/**\n * @param {function(number): import(\"../../coordinate.js\").Coordinate} interpolate Interpolate function.\n * @param {import(\"../../proj.js\").TransformFunction} transform Transform from longitude/latitude to\n * projected coordinates.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nfunction line(interpolate, transform, squaredTolerance) {\n // FIXME reduce garbage generation\n // FIXME optimize stack operations\n\n /** @type {Array<number>} */\n const flatCoordinates = [];\n\n let geoA = interpolate(0);\n let geoB = interpolate(1);\n\n let a = transform(geoA);\n let b = transform(geoB);\n\n /** @type {Array<import(\"../../coordinate.js\").Coordinate>} */\n const geoStack = [geoB, geoA];\n /** @type {Array<import(\"../../coordinate.js\").Coordinate>} */\n const stack = [b, a];\n /** @type {Array<number>} */\n const fractionStack = [1, 0];\n\n /** @type {!Object<string, boolean>} */\n const fractions = {};\n\n let maxIterations = 1e5;\n let geoM, m, fracA, fracB, fracM, key;\n\n while (--maxIterations > 0 && fractionStack.length > 0) {\n // Pop the a coordinate off the stack\n fracA = fractionStack.pop();\n geoA = geoStack.pop();\n a = stack.pop();\n // Add the a coordinate if it has not been added yet\n key = fracA.toString();\n if (!(key in fractions)) {\n flatCoordinates.push(a[0], a[1]);\n fractions[key] = true;\n }\n // Pop the b coordinate off the stack\n fracB = fractionStack.pop();\n geoB = geoStack.pop();\n b = stack.pop();\n // Find the m point between the a and b coordinates\n fracM = (fracA + fracB) / 2;\n geoM = interpolate(fracM);\n m = transform(geoM);\n if (\n squaredSegmentDistance(m[0], m[1], a[0], a[1], b[0], b[1]) <\n squaredTolerance\n ) {\n // If the m point is sufficiently close to the straight line, then we\n // discard it. Just use the b coordinate and move on to the next line\n // segment.\n flatCoordinates.push(b[0], b[1]);\n key = fracB.toString();\n fractions[key] = true;\n } else {\n // Otherwise, we need to subdivide the current line segment. Split it\n // into two and push the two line segments onto the stack.\n fractionStack.push(fracB, fracM, fracM, fracA);\n stack.push(b, m, m, a);\n geoStack.push(geoB, geoM, geoM, geoA);\n }\n }\n\n return flatCoordinates;\n}\n\n/**\n * Generate a great-circle arcs between two lat/lon points.\n * @param {number} lon1 Longitude 1 in degrees.\n * @param {number} lat1 Latitude 1 in degrees.\n * @param {number} lon2 Longitude 2 in degrees.\n * @param {number} lat2 Latitude 2 in degrees.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nexport function greatCircleArc(\n lon1,\n lat1,\n lon2,\n lat2,\n projection,\n squaredTolerance,\n) {\n const geoProjection = getProjection('EPSG:4326');\n\n const cosLat1 = Math.cos(toRadians(lat1));\n const sinLat1 = Math.sin(toRadians(lat1));\n const cosLat2 = Math.cos(toRadians(lat2));\n const sinLat2 = Math.sin(toRadians(lat2));\n const cosDeltaLon = Math.cos(toRadians(lon2 - lon1));\n const sinDeltaLon = Math.sin(toRadians(lon2 - lon1));\n const d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon;\n\n return line(\n /**\n * @param {number} frac Fraction.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\n function (frac) {\n if (1 <= d) {\n return [lon2, lat2];\n }\n const D = frac * Math.acos(d);\n const cosD = Math.cos(D);\n const sinD = Math.sin(D);\n const y = sinDeltaLon * cosLat2;\n const x = cosLat1 * sinLat2 - sinLat1 * cosLat2 * cosDeltaLon;\n const theta = Math.atan2(y, x);\n const lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));\n const lon =\n toRadians(lon1) +\n Math.atan2(\n Math.sin(theta) * sinD * cosLat1,\n cosD - sinLat1 * Math.sin(lat),\n );\n return [toDegrees(lon), toDegrees(lat)];\n },\n getTransform(geoProjection, projection),\n squaredTolerance,\n );\n}\n\n/**\n * Generate a meridian (line at constant longitude).\n * @param {number} lon Longitude.\n * @param {number} lat1 Latitude 1.\n * @param {number} lat2 Latitude 2.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nexport function meridian(lon, lat1, lat2, projection, squaredTolerance) {\n const epsg4326Projection = getProjection('EPSG:4326');\n return line(\n /**\n * @param {number} frac Fraction.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\n function (frac) {\n return [lon, lat1 + (lat2 - lat1) * frac];\n },\n getTransform(epsg4326Projection, projection),\n squaredTolerance,\n );\n}\n\n/**\n * Generate a parallel (line at constant latitude).\n * @param {number} lat Latitude.\n * @param {number} lon1 Longitude 1.\n * @param {number} lon2 Longitude 2.\n * @param {import(\"../../proj/Projection.js\").default} projection Projection.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {Array<number>} Flat coordinates.\n */\nexport function parallel(lat, lon1, lon2, projection, squaredTolerance) {\n const epsg4326Projection = getProjection('EPSG:4326');\n return line(\n /**\n * @param {number} frac Fraction.\n * @return {import(\"../../coordinate.js\").Coordinate} Coordinate.\n */\n function (frac) {\n return [lon1 + (lon2 - lon1) * frac, lat];\n },\n getTransform(epsg4326Projection, projection),\n squaredTolerance,\n );\n}\n","/**\n * @module ol/layer/Vector\n */\nimport CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js';\nimport BaseVectorLayer from './BaseVector.js';\n\n/**\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the\n * renderer when getting features from the vector source for the rendering or hit-detection.\n * Recommended value: the size of the largest symbol, line width or label.\n * @property {VectorSourceType} [source] Source.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * @property {boolean|string|number} [declutter=false] Declutter images and text. Any truthy value will enable\n * decluttering. Within a layer, a feature rendered before another has higher priority. All layers with the\n * same `declutter` value will be decluttered together. The priority is determined by the drawing order of the\n * layers with the same `declutter` value. Higher in the layer stack means higher priority. To declutter distinct\n * layers or groups of layers separately, use different truthy values for `declutter`.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will\n * be recreated during animations. This means that no vectors will be shown clipped, but the\n * setting will have a performance impact for large amounts of vector data. When set to `false`,\n * batches will be recreated when no animation is active.\n * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will\n * be recreated during interactions. See also `updateWhileAnimating`.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Vector data is rendered client-side, as vectors. This layer type provides most accurate rendering\n * even during animations. Points and labels stay upright on rotated views. For very large\n * amounts of vector data, performance may suffer during pan and zoom animations. In this case,\n * try {@link module:ol/layer/VectorImage~VectorImageLayer}.\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @extends {BaseVectorLayer<FeatureType, VectorSourceType, CanvasVectorLayerRenderer>}\n * @api\n */\nclass VectorLayer extends BaseVectorLayer {\n /**\n * @param {Options<VectorSourceType, FeatureType>} [options] Options.\n */\n constructor(options) {\n super(options);\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new CanvasVectorLayerRenderer(this);\n }\n}\n\nexport default VectorLayer;\n","/**\n * @module ol/layer/Graticule\n */\nimport Collection from '../Collection.js';\nimport Feature from '../Feature.js';\nimport {degreesToStringHDMS} from '../coordinate.js';\nimport {\n applyTransform,\n approximatelyEquals,\n containsCoordinate,\n containsExtent,\n equals,\n getCenter,\n getIntersection,\n getWidth,\n intersects,\n isEmpty,\n wrapX as wrapExtentX,\n} from '../extent.js';\nimport LineString from '../geom/LineString.js';\nimport Point from '../geom/Point.js';\nimport {meridian, parallel} from '../geom/flat/geodesic.js';\nimport {clamp} from '../math.js';\nimport {\n equivalent as equivalentProjection,\n get as getProjection,\n getTransform,\n} from '../proj.js';\nimport EventType from '../render/EventType.js';\nimport {getVectorContext} from '../render.js';\nimport VectorSource from '../source/Vector.js';\nimport Fill from '../style/Fill.js';\nimport Stroke from '../style/Stroke.js';\nimport Style from '../style/Style.js';\nimport Text from '../style/Text.js';\nimport VectorLayer from './Vector.js';\n\n/**\n * @type {Stroke}\n * @private\n * @const\n */\nconst DEFAULT_STROKE_STYLE = new Stroke({\n color: 'rgba(0,0,0,0.2)',\n});\n\n/**\n * @type {Array<number>}\n * @private\n */\nconst INTERVALS = [\n 90,\n 45,\n 30,\n 20,\n 10,\n 5,\n 2,\n 1,\n 30 / 60,\n 20 / 60,\n 10 / 60,\n 5 / 60,\n 2 / 60,\n 1 / 60,\n 30 / 3600,\n 20 / 3600,\n 10 / 3600,\n 5 / 3600,\n 2 / 3600,\n 1 / 3600,\n];\n\n/**\n * @typedef {Object} GraticuleLabelDataType\n * @property {Point} geom Geometry.\n * @property {string} text Text.\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [maxLines=100] The maximum number of meridians and\n * parallels from the center of the map. The default value of 100 means that at\n * most 200 meridians and 200 parallels will be displayed. The default value is\n * appropriate for conformal projections like Spherical Mercator. If you\n * increase the value, more lines will be drawn and the drawing performance will\n * decrease.\n * @property {Stroke} [strokeStyle] The\n * stroke style to use for drawing the graticule. If not provided, the following stroke will be used:\n * ```js\n * new Stroke({\n * color: 'rgba(0, 0, 0, 0.2)' // a not fully opaque black\n * });\n * ```\n * @property {number} [targetSize=100] The target size of the graticule cells,\n * in pixels.\n * @property {boolean} [showLabels=false] Render a label with the respective\n * latitude/longitude for each graticule line.\n * @property {function(number):string} [lonLabelFormatter] Label formatter for\n * longitudes. This function is called with the longitude as argument, and\n * should return a formatted string representing the longitude. By default,\n * labels are formatted as degrees, minutes, seconds and hemisphere.\n * @property {function(number):string} [latLabelFormatter] Label formatter for\n * latitudes. This function is called with the latitude as argument, and\n * should return a formatted string representing the latitude. By default,\n * labels are formatted as degrees, minutes, seconds and hemisphere.\n * @property {number} [lonLabelPosition=0] Longitude label position in fractions\n * (0..1) of view extent. 0 means at the bottom of the viewport, 1 means at the\n * top.\n * @property {number} [latLabelPosition=1] Latitude label position in fractions\n * (0..1) of view extent. 0 means at the left of the viewport, 1 means at the\n * right.\n * @property {Text} [lonLabelStyle] Longitude label text\n * style. If not provided, the following style will be used:\n * ```js\n * new Text({\n * font: '12px Calibri,sans-serif',\n * textBaseline: 'bottom',\n * fill: new Fill({\n * color: 'rgba(0,0,0,1)'\n * }),\n * stroke: new Stroke({\n * color: 'rgba(255,255,255,1)',\n * width: 3\n * })\n * });\n * ```\n * Note that the default's `textBaseline` configuration will not work well for\n * `lonLabelPosition` configurations that position labels close to the top of\n * the viewport.\n * @property {Text} [latLabelStyle] Latitude label text style.\n * If not provided, the following style will be used:\n * ```js\n * new Text({\n * font: '12px Calibri,sans-serif',\n * textAlign: 'end',\n * fill: new Fill({\n * color: 'rgba(0,0,0,1)'\n * }),\n * stroke: Stroke({\n * color: 'rgba(255,255,255,1)',\n * width: 3\n * })\n * });\n * ```\n * Note that the default's `textAlign` configuration will not work well for\n * `latLabelPosition` configurations that position labels close to the left of\n * the viewport.\n * @property {Array<number>} [intervals=[90, 45, 30, 20, 10, 5, 2, 1, 30/60, 20/60, 10/60, 5/60, 2/60, 1/60, 30/3600, 20/3600, 10/3600, 5/3600, 2/3600, 1/3600]]\n * Intervals (in degrees) for the graticule. Example to limit graticules to 30 and 10 degrees intervals:\n * ```js\n * [30, 10]\n * ```\n * @property {boolean} [wrapX=true] Whether to repeat the graticule horizontally.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Layer that renders a grid for a coordinate system (currently only EPSG:4326 is supported).\n * Note that the view projection must define both extent and worldExtent.\n *\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n * @extends {VectorLayer<VectorSource<Feature>>}\n * @api\n */\nclass Graticule extends VectorLayer {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign(\n {\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n renderBuffer: 0,\n },\n options,\n );\n\n delete baseOptions.maxLines;\n delete baseOptions.strokeStyle;\n delete baseOptions.targetSize;\n delete baseOptions.showLabels;\n delete baseOptions.lonLabelFormatter;\n delete baseOptions.latLabelFormatter;\n delete baseOptions.lonLabelPosition;\n delete baseOptions.latLabelPosition;\n delete baseOptions.lonLabelStyle;\n delete baseOptions.latLabelStyle;\n delete baseOptions.intervals;\n super(baseOptions);\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n * @private\n */\n this.projection_ = null;\n\n /**\n * @type {number}\n * @private\n */\n this.maxLat_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.maxLon_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minLat_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minLon_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.maxX_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.maxY_ = Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minX_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.minY_ = -Infinity;\n\n /**\n * @type {number}\n * @private\n */\n this.targetSize_ =\n options.targetSize !== undefined ? options.targetSize : 100;\n\n /**\n * @type {number}\n * @private\n */\n this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;\n\n /**\n * @type {Array<LineString>}\n * @private\n */\n this.meridians_ = [];\n\n /**\n * @type {Array<LineString>}\n * @private\n */\n this.parallels_ = [];\n\n /**\n * @type {Stroke}\n * @private\n */\n this.strokeStyle_ =\n options.strokeStyle !== undefined\n ? options.strokeStyle\n : DEFAULT_STROKE_STYLE;\n\n /**\n * @type {import(\"../proj.js\").TransformFunction|undefined}\n * @private\n */\n this.fromLonLatTransform_ = undefined;\n\n /**\n * @type {import(\"../proj.js\").TransformFunction|undefined}\n * @private\n */\n this.toLonLatTransform_ = undefined;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.projectionCenterLonLat_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.bottomLeft_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.bottomRight_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.topLeft_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.topRight_ = null;\n\n /**\n * @type {Array<GraticuleLabelDataType>}\n * @private\n */\n this.meridiansLabels_ = null;\n\n /**\n * @type {Array<GraticuleLabelDataType>}\n * @private\n */\n this.parallelsLabels_ = null;\n\n if (options.showLabels) {\n /**\n * @type {null|function(number):string}\n * @private\n */\n this.lonLabelFormatter_ =\n options.lonLabelFormatter == undefined\n ? degreesToStringHDMS.bind(this, 'EW')\n : options.lonLabelFormatter;\n\n /**\n * @type {function(number):string}\n * @private\n */\n this.latLabelFormatter_ =\n options.latLabelFormatter == undefined\n ? degreesToStringHDMS.bind(this, 'NS')\n : options.latLabelFormatter;\n\n /**\n * Longitude label position in fractions (0..1) of view extent. 0 means\n * bottom, 1 means top.\n * @type {number}\n * @private\n */\n this.lonLabelPosition_ =\n options.lonLabelPosition == undefined ? 0 : options.lonLabelPosition;\n\n /**\n * Latitude Label position in fractions (0..1) of view extent. 0 means left, 1\n * means right.\n * @type {number}\n * @private\n */\n this.latLabelPosition_ =\n options.latLabelPosition == undefined ? 1 : options.latLabelPosition;\n\n /**\n * @type {Style}\n * @private\n */\n this.lonLabelStyleBase_ = new Style({\n text:\n options.lonLabelStyle !== undefined\n ? options.lonLabelStyle.clone()\n : new Text({\n font: '12px Calibri,sans-serif',\n textBaseline: 'bottom',\n fill: new Fill({\n color: 'rgba(0,0,0,1)',\n }),\n stroke: new Stroke({\n color: 'rgba(255,255,255,1)',\n width: 3,\n }),\n }),\n });\n\n /**\n * @private\n * @param {import(\"../Feature\").default} feature Feature\n * @return {Style} style\n */\n this.lonLabelStyle_ = (feature) => {\n const label = feature.get('graticule_label');\n this.lonLabelStyleBase_.getText().setText(label);\n return this.lonLabelStyleBase_;\n };\n\n /**\n * @type {Style}\n * @private\n */\n this.latLabelStyleBase_ = new Style({\n text:\n options.latLabelStyle !== undefined\n ? options.latLabelStyle.clone()\n : new Text({\n font: '12px Calibri,sans-serif',\n textAlign: 'right',\n fill: new Fill({\n color: 'rgba(0,0,0,1)',\n }),\n stroke: new Stroke({\n color: 'rgba(255,255,255,1)',\n width: 3,\n }),\n }),\n });\n\n /**\n * @private\n * @param {import(\"../Feature\").default} feature Feature\n * @return {Style} style\n */\n this.latLabelStyle_ = (feature) => {\n const label = feature.get('graticule_label');\n this.latLabelStyleBase_.getText().setText(label);\n return this.latLabelStyleBase_;\n };\n\n this.meridiansLabels_ = [];\n this.parallelsLabels_ = [];\n\n this.addEventListener(EventType.POSTRENDER, this.drawLabels_.bind(this));\n }\n\n /**\n * @type {Array<number>}\n * @private\n */\n this.intervals_ =\n options.intervals !== undefined ? options.intervals : INTERVALS;\n\n // use a source with a custom loader for lines & text\n this.setSource(\n new VectorSource({\n loader: this.loaderFunction.bind(this),\n strategy: this.strategyFunction.bind(this),\n features: new Collection(),\n overlaps: false,\n useSpatialIndex: false,\n wrapX: options.wrapX,\n }),\n );\n\n /**\n * feature pool to use when updating graticule\n * @type {Array<Feature>}\n * @private\n */\n this.featurePool_ = [];\n\n /**\n * @type {Style}\n * @private\n */\n this.lineStyle_ = new Style({\n stroke: this.strokeStyle_,\n });\n\n /**\n * @type {?import(\"../extent.js\").Extent}\n * @private\n */\n this.loadedExtent_ = null;\n\n /**\n * @type {?import(\"../extent.js\").Extent}\n * @private\n */\n this.renderedExtent_ = null;\n\n /**\n * @type {?number}\n * @private\n */\n this.renderedResolution_ = null;\n\n this.setRenderOrder(null);\n }\n\n /**\n * Strategy function for loading features based on the view's extent and\n * resolution.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<import(\"../extent.js\").Extent>} Extents.\n */\n strategyFunction(extent, resolution) {\n // extents may be passed in different worlds, to avoid endless loop we use only one\n let realWorldExtent = extent.slice();\n if (this.projection_ && this.getSource().getWrapX()) {\n wrapExtentX(realWorldExtent, this.projection_);\n }\n if (this.loadedExtent_) {\n if (\n approximatelyEquals(this.loadedExtent_, realWorldExtent, resolution)\n ) {\n // make sure result is exactly equal to previous extent\n realWorldExtent = this.loadedExtent_.slice();\n } else {\n // we should not keep track of loaded extents\n this.getSource().removeLoadedExtent(this.loadedExtent_);\n }\n }\n return [realWorldExtent];\n }\n\n /**\n * Update geometries in the source based on current view\n * @param {import(\"../extent\").Extent} extent Extent\n * @param {number} resolution Resolution\n * @param {import(\"../proj/Projection.js\").default} projection Projection\n */\n loaderFunction(extent, resolution, projection) {\n this.loadedExtent_ = extent;\n const source = this.getSource();\n\n // only consider the intersection between our own extent & the requested one\n const layerExtent = this.getExtent() || [\n -Infinity,\n -Infinity,\n Infinity,\n Infinity,\n ];\n const renderExtent = getIntersection(layerExtent, extent);\n\n if (\n this.renderedExtent_ &&\n equals(this.renderedExtent_, renderExtent) &&\n this.renderedResolution_ === resolution\n ) {\n return;\n }\n this.renderedExtent_ = renderExtent;\n this.renderedResolution_ = resolution;\n\n // bail out if nothing to render\n if (isEmpty(renderExtent)) {\n return;\n }\n\n // update projection info\n const center = getCenter(renderExtent);\n const squaredTolerance = (resolution * resolution) / 4;\n\n const updateProjectionInfo =\n !this.projection_ || !equivalentProjection(this.projection_, projection);\n\n if (updateProjectionInfo) {\n this.updateProjectionInfo_(projection);\n }\n\n this.createGraticule_(renderExtent, center, resolution, squaredTolerance);\n\n // first make sure we have enough features in the pool\n let featureCount = this.meridians_.length + this.parallels_.length;\n if (this.meridiansLabels_) {\n featureCount += this.meridians_.length;\n }\n if (this.parallelsLabels_) {\n featureCount += this.parallels_.length;\n }\n\n let feature;\n while (featureCount > this.featurePool_.length) {\n feature = new Feature();\n this.featurePool_.push(feature);\n }\n\n const featuresColl = source.getFeaturesCollection();\n featuresColl.clear();\n let poolIndex = 0;\n\n // add features for the lines & labels\n let i, l;\n for (i = 0, l = this.meridians_.length; i < l; ++i) {\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(this.meridians_[i]);\n feature.setStyle(this.lineStyle_);\n featuresColl.push(feature);\n }\n for (i = 0, l = this.parallels_.length; i < l; ++i) {\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(this.parallels_[i]);\n feature.setStyle(this.lineStyle_);\n featuresColl.push(feature);\n }\n }\n\n /**\n * @param {number} lon Longitude.\n * @param {number} minLat Minimal latitude.\n * @param {number} maxLat Maximal latitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {number} Index.\n * @private\n */\n addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, index) {\n const lineString = this.getMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n index,\n );\n if (intersects(lineString.getExtent(), extent)) {\n if (this.meridiansLabels_) {\n const text = this.lonLabelFormatter_(lon);\n if (index in this.meridiansLabels_) {\n this.meridiansLabels_[index].text = text;\n } else {\n this.meridiansLabels_[index] = {\n geom: new Point([]),\n text: text,\n };\n }\n }\n this.meridians_[index++] = lineString;\n }\n return index;\n }\n\n /**\n * @param {number} lat Latitude.\n * @param {number} minLon Minimal longitude.\n * @param {number} maxLon Maximal longitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {number} Index.\n * @private\n */\n addParallel_(lat, minLon, maxLon, squaredTolerance, extent, index) {\n const lineString = this.getParallel_(\n lat,\n minLon,\n maxLon,\n squaredTolerance,\n index,\n );\n if (intersects(lineString.getExtent(), extent)) {\n if (this.parallelsLabels_) {\n const text = this.latLabelFormatter_(lat);\n if (index in this.parallelsLabels_) {\n this.parallelsLabels_[index].text = text;\n } else {\n this.parallelsLabels_[index] = {\n geom: new Point([]),\n text: text,\n };\n }\n }\n this.parallels_[index++] = lineString;\n }\n return index;\n }\n\n /**\n * @param {import(\"../render/Event.js\").default} event Render event.\n * @private\n */\n drawLabels_(event) {\n const rotation = event.frameState.viewState.rotation;\n const resolution = event.frameState.viewState.resolution;\n const size = event.frameState.size;\n const extent = event.frameState.extent;\n const rotationCenter = getCenter(extent);\n let rotationExtent = extent;\n if (rotation) {\n const unrotatedWidth = size[0] * resolution;\n const unrotatedHeight = size[1] * resolution;\n rotationExtent = [\n rotationCenter[0] - unrotatedWidth / 2,\n rotationCenter[1] - unrotatedHeight / 2,\n rotationCenter[0] + unrotatedWidth / 2,\n rotationCenter[1] + unrotatedHeight / 2,\n ];\n }\n\n let startWorld = 0;\n let endWorld = 0;\n let labelsAtStart = this.latLabelPosition_ < 0.5;\n const projectionExtent = this.projection_.getExtent();\n const worldWidth = getWidth(projectionExtent);\n if (\n this.getSource().getWrapX() &&\n this.projection_.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n startWorld = Math.floor((extent[0] - projectionExtent[0]) / worldWidth);\n endWorld = Math.ceil((extent[2] - projectionExtent[2]) / worldWidth);\n const inverted = Math.abs(rotation) > Math.PI / 2;\n labelsAtStart = labelsAtStart !== inverted;\n }\n const vectorContext = getVectorContext(event);\n\n for (let world = startWorld; world <= endWorld; ++world) {\n let poolIndex = this.meridians_.length + this.parallels_.length;\n let feature, index, l, textPoint;\n\n if (this.meridiansLabels_) {\n for (index = 0, l = this.meridiansLabels_.length; index < l; ++index) {\n const lineString = this.meridians_[index];\n if (!rotation && world === 0) {\n textPoint = this.getMeridianPoint_(lineString, extent, index);\n } else {\n const clone = lineString.clone();\n clone.translate(world * worldWidth, 0);\n clone.rotate(-rotation, rotationCenter);\n textPoint = this.getMeridianPoint_(clone, rotationExtent, index);\n textPoint.rotate(rotation, rotationCenter);\n }\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(textPoint);\n feature.set('graticule_label', this.meridiansLabels_[index].text);\n vectorContext.drawFeature(feature, this.lonLabelStyle_(feature));\n }\n }\n if (this.parallelsLabels_) {\n if (\n (world === startWorld && labelsAtStart) ||\n (world === endWorld && !labelsAtStart)\n ) {\n for (index = 0, l = this.parallels_.length; index < l; ++index) {\n const lineString = this.parallels_[index];\n if (!rotation && world === 0) {\n textPoint = this.getParallelPoint_(lineString, extent, index);\n } else {\n const clone = lineString.clone();\n clone.translate(world * worldWidth, 0);\n clone.rotate(-rotation, rotationCenter);\n textPoint = this.getParallelPoint_(clone, rotationExtent, index);\n textPoint.rotate(rotation, rotationCenter);\n }\n feature = this.featurePool_[poolIndex++];\n feature.setGeometry(textPoint);\n feature.set('graticule_label', this.parallelsLabels_[index].text);\n vectorContext.drawFeature(feature, this.latLabelStyle_(feature));\n }\n }\n }\n }\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {import(\"../coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} squaredTolerance Squared tolerance.\n * @private\n */\n createGraticule_(extent, center, resolution, squaredTolerance) {\n const interval = this.getInterval_(resolution);\n if (interval == -1) {\n this.meridians_.length = 0;\n this.parallels_.length = 0;\n if (this.meridiansLabels_) {\n this.meridiansLabels_.length = 0;\n }\n if (this.parallelsLabels_) {\n this.parallelsLabels_.length = 0;\n }\n return;\n }\n\n let wrapX = false;\n const projectionExtent = this.projection_.getExtent();\n const worldWidth = getWidth(projectionExtent);\n if (\n this.getSource().getWrapX() &&\n this.projection_.canWrapX() &&\n !containsExtent(projectionExtent, extent)\n ) {\n if (getWidth(extent) >= worldWidth) {\n extent[0] = projectionExtent[0];\n extent[2] = projectionExtent[2];\n } else {\n wrapX = true;\n }\n }\n\n // Constrain the center to fit into the extent available to the graticule\n\n const validCenterP = [\n clamp(center[0], this.minX_, this.maxX_),\n clamp(center[1], this.minY_, this.maxY_),\n ];\n\n // Transform the center to lon lat\n // Some projections may have a void area at the poles\n // so replace any NaN latitudes with the min or max value closest to a pole\n\n const centerLonLat = this.toLonLatTransform_(validCenterP);\n if (isNaN(centerLonLat[1])) {\n centerLonLat[1] =\n Math.abs(this.maxLat_) >= Math.abs(this.minLat_)\n ? this.maxLat_\n : this.minLat_;\n }\n let centerLon = clamp(centerLonLat[0], this.minLon_, this.maxLon_);\n let centerLat = clamp(centerLonLat[1], this.minLat_, this.maxLat_);\n const maxLines = this.maxLines_;\n let cnt, idx, lat, lon;\n\n // Limit the extent to fit into the extent available to the graticule\n\n let validExtentP = extent;\n if (!wrapX) {\n validExtentP = [\n clamp(extent[0], this.minX_, this.maxX_),\n clamp(extent[1], this.minY_, this.maxY_),\n clamp(extent[2], this.minX_, this.maxX_),\n clamp(extent[3], this.minY_, this.maxY_),\n ];\n }\n\n // Transform the extent to get the lon lat ranges for the edges of the extent\n\n const validExtent = applyTransform(\n validExtentP,\n this.toLonLatTransform_,\n undefined,\n 8,\n );\n\n let maxLat = validExtent[3];\n let maxLon = validExtent[2];\n let minLat = validExtent[1];\n let minLon = validExtent[0];\n\n if (!wrapX) {\n // Check if extremities of the world extent lie inside the extent\n // (for example the pole in a polar projection)\n // and extend the extent as appropriate\n\n if (containsCoordinate(validExtentP, this.bottomLeft_)) {\n minLon = this.minLon_;\n minLat = this.minLat_;\n }\n if (containsCoordinate(validExtentP, this.bottomRight_)) {\n maxLon = this.maxLon_;\n minLat = this.minLat_;\n }\n if (containsCoordinate(validExtentP, this.topLeft_)) {\n minLon = this.minLon_;\n maxLat = this.maxLat_;\n }\n if (containsCoordinate(validExtentP, this.topRight_)) {\n maxLon = this.maxLon_;\n maxLat = this.maxLat_;\n }\n\n // The transformed center may also extend the lon lat ranges used for rendering\n\n maxLat = clamp(maxLat, centerLat, this.maxLat_);\n maxLon = clamp(maxLon, centerLon, this.maxLon_);\n minLat = clamp(minLat, this.minLat_, centerLat);\n minLon = clamp(minLon, this.minLon_, centerLon);\n }\n\n // Create meridians\n\n centerLon = Math.floor(centerLon / interval) * interval;\n lon = clamp(centerLon, this.minLon_, this.maxLon_);\n\n idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, 0);\n\n cnt = 0;\n if (wrapX) {\n while ((lon -= interval) >= minLon && cnt++ < maxLines) {\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx,\n );\n }\n } else {\n while (lon != this.minLon_ && cnt++ < maxLines) {\n lon = Math.max(lon - interval, this.minLon_);\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx,\n );\n }\n }\n\n lon = clamp(centerLon, this.minLon_, this.maxLon_);\n\n cnt = 0;\n if (wrapX) {\n while ((lon += interval) <= maxLon && cnt++ < maxLines) {\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx,\n );\n }\n } else {\n while (lon != this.maxLon_ && cnt++ < maxLines) {\n lon = Math.min(lon + interval, this.maxLon_);\n idx = this.addMeridian_(\n lon,\n minLat,\n maxLat,\n squaredTolerance,\n extent,\n idx,\n );\n }\n }\n\n this.meridians_.length = idx;\n if (this.meridiansLabels_) {\n this.meridiansLabels_.length = idx;\n }\n\n // Create parallels\n\n centerLat = Math.floor(centerLat / interval) * interval;\n lat = clamp(centerLat, this.minLat_, this.maxLat_);\n\n idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, 0);\n\n cnt = 0;\n while (lat != this.minLat_ && cnt++ < maxLines) {\n lat = Math.max(lat - interval, this.minLat_);\n idx = this.addParallel_(\n lat,\n minLon,\n maxLon,\n squaredTolerance,\n extent,\n idx,\n );\n }\n\n lat = clamp(centerLat, this.minLat_, this.maxLat_);\n\n cnt = 0;\n while (lat != this.maxLat_ && cnt++ < maxLines) {\n lat = Math.min(lat + interval, this.maxLat_);\n idx = this.addParallel_(\n lat,\n minLon,\n maxLon,\n squaredTolerance,\n extent,\n idx,\n );\n }\n\n this.parallels_.length = idx;\n if (this.parallelsLabels_) {\n this.parallelsLabels_.length = idx;\n }\n }\n\n /**\n * @param {number} resolution Resolution.\n * @return {number} The interval in degrees.\n * @private\n */\n getInterval_(resolution) {\n const centerLon = this.projectionCenterLonLat_[0];\n const centerLat = this.projectionCenterLonLat_[1];\n let interval = -1;\n const target = Math.pow(this.targetSize_ * resolution, 2);\n /** @type {Array<number>} **/\n const p1 = [];\n /** @type {Array<number>} **/\n const p2 = [];\n for (let i = 0, ii = this.intervals_.length; i < ii; ++i) {\n const delta = clamp(this.intervals_[i] / 2, 0, 90);\n // Don't attempt to transform latitudes beyond the poles!\n const clampedLat = clamp(centerLat, -90 + delta, 90 - delta);\n p1[0] = centerLon - delta;\n p1[1] = clampedLat - delta;\n p2[0] = centerLon + delta;\n p2[1] = clampedLat + delta;\n this.fromLonLatTransform_(p1, p1);\n this.fromLonLatTransform_(p2, p2);\n const dist = Math.pow(p2[0] - p1[0], 2) + Math.pow(p2[1] - p1[1], 2);\n if (dist <= target) {\n break;\n }\n interval = this.intervals_[i];\n }\n return interval;\n }\n\n /**\n * @param {number} lon Longitude.\n * @param {number} minLat Minimal latitude.\n * @param {number} maxLat Maximal latitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} The meridian line string.\n * @param {number} index Index.\n * @private\n */\n getMeridian_(lon, minLat, maxLat, squaredTolerance, index) {\n const flatCoordinates = meridian(\n lon,\n minLat,\n maxLat,\n this.projection_,\n squaredTolerance,\n );\n let lineString = this.meridians_[index];\n if (!lineString) {\n lineString = new LineString(flatCoordinates, 'XY');\n this.meridians_[index] = lineString;\n } else {\n lineString.setFlatCoordinates('XY', flatCoordinates);\n lineString.changed();\n }\n return lineString;\n }\n\n /**\n * @param {LineString} lineString Meridian\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {Point} Meridian point.\n * @private\n */\n getMeridianPoint_(lineString, extent, index) {\n const flatCoordinates = lineString.getFlatCoordinates();\n let bottom = 1;\n let top = flatCoordinates.length - 1;\n if (flatCoordinates[bottom] > flatCoordinates[top]) {\n bottom = top;\n top = 1;\n }\n const clampedBottom = Math.max(extent[1], flatCoordinates[bottom]);\n const clampedTop = Math.min(extent[3], flatCoordinates[top]);\n const lat = clamp(\n extent[1] + Math.abs(extent[1] - extent[3]) * this.lonLabelPosition_,\n clampedBottom,\n clampedTop,\n );\n const coordinate0 =\n flatCoordinates[bottom - 1] +\n ((flatCoordinates[top - 1] - flatCoordinates[bottom - 1]) *\n (lat - flatCoordinates[bottom])) /\n (flatCoordinates[top] - flatCoordinates[bottom]);\n const coordinate = [coordinate0, lat];\n const point = this.meridiansLabels_[index].geom;\n point.setCoordinates(coordinate);\n return point;\n }\n\n /**\n * Get the list of meridians. Meridians are lines of equal longitude.\n * @return {Array<LineString>} The meridians.\n * @api\n */\n getMeridians() {\n return this.meridians_;\n }\n\n /**\n * @param {number} lat Latitude.\n * @param {number} minLon Minimal longitude.\n * @param {number} maxLon Maximal longitude.\n * @param {number} squaredTolerance Squared tolerance.\n * @return {LineString} The parallel line string.\n * @param {number} index Index.\n * @private\n */\n getParallel_(lat, minLon, maxLon, squaredTolerance, index) {\n const flatCoordinates = parallel(\n lat,\n minLon,\n maxLon,\n this.projection_,\n squaredTolerance,\n );\n let lineString = this.parallels_[index];\n if (!lineString) {\n lineString = new LineString(flatCoordinates, 'XY');\n } else {\n lineString.setFlatCoordinates('XY', flatCoordinates);\n lineString.changed();\n }\n return lineString;\n }\n\n /**\n * @param {LineString} lineString Parallels.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} index Index.\n * @return {Point} Parallel point.\n * @private\n */\n getParallelPoint_(lineString, extent, index) {\n const flatCoordinates = lineString.getFlatCoordinates();\n let left = 0;\n let right = flatCoordinates.length - 2;\n if (flatCoordinates[left] > flatCoordinates[right]) {\n left = right;\n right = 0;\n }\n const clampedLeft = Math.max(extent[0], flatCoordinates[left]);\n const clampedRight = Math.min(extent[2], flatCoordinates[right]);\n const lon = clamp(\n extent[0] + Math.abs(extent[0] - extent[2]) * this.latLabelPosition_,\n clampedLeft,\n clampedRight,\n );\n const coordinate1 =\n flatCoordinates[left + 1] +\n ((flatCoordinates[right + 1] - flatCoordinates[left + 1]) *\n (lon - flatCoordinates[left])) /\n (flatCoordinates[right] - flatCoordinates[left]);\n const coordinate = [lon, coordinate1];\n const point = this.parallelsLabels_[index].geom;\n point.setCoordinates(coordinate);\n return point;\n }\n\n /**\n * Get the list of parallels. Parallels are lines of equal latitude.\n * @return {Array<LineString>} The parallels.\n * @api\n */\n getParallels() {\n return this.parallels_;\n }\n\n /**\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @private\n */\n updateProjectionInfo_(projection) {\n const epsg4326Projection = getProjection('EPSG:4326');\n\n const worldExtent = projection.getWorldExtent();\n\n this.maxLat_ = worldExtent[3];\n this.maxLon_ = worldExtent[2];\n this.minLat_ = worldExtent[1];\n this.minLon_ = worldExtent[0];\n\n // If the world extent crosses the dateline define a custom transform to\n // return longitudes which wrap the dateline\n\n const toLonLatTransform = getTransform(projection, epsg4326Projection);\n if (this.minLon_ < this.maxLon_) {\n this.toLonLatTransform_ = toLonLatTransform;\n } else {\n const split = this.minLon_ + this.maxLon_ / 2;\n this.maxLon_ += 360;\n this.toLonLatTransform_ = function (coordinates, output, dimension) {\n dimension = dimension || 2;\n const lonLatCoordinates = toLonLatTransform(\n coordinates,\n output,\n dimension,\n );\n for (let i = 0, l = lonLatCoordinates.length; i < l; i += dimension) {\n if (lonLatCoordinates[i] < split) {\n lonLatCoordinates[i] += 360;\n }\n }\n return lonLatCoordinates;\n };\n }\n\n // Transform the extent to get the limits of the view projection extent\n // which should be available to the graticule\n\n this.fromLonLatTransform_ = getTransform(epsg4326Projection, projection);\n const worldExtentP = applyTransform(\n [this.minLon_, this.minLat_, this.maxLon_, this.maxLat_],\n this.fromLonLatTransform_,\n undefined,\n 8,\n );\n\n this.minX_ = worldExtentP[0];\n this.maxX_ = worldExtentP[2];\n this.minY_ = worldExtentP[1];\n this.maxY_ = worldExtentP[3];\n\n // Determine the view projection coordinates of the extremities of the world extent\n // as these may lie inside a view extent (for example the pole in a polar projection)\n\n this.bottomLeft_ = this.fromLonLatTransform_([this.minLon_, this.minLat_]);\n this.bottomRight_ = this.fromLonLatTransform_([this.maxLon_, this.minLat_]);\n this.topLeft_ = this.fromLonLatTransform_([this.minLon_, this.maxLat_]);\n this.topRight_ = this.fromLonLatTransform_([this.maxLon_, this.maxLat_]);\n\n // Transform the projection center to lon lat\n // Some projections may have a void area at the poles\n // so replace any NaN latitudes with the min or max value closest to a pole\n\n this.projectionCenterLonLat_ = this.toLonLatTransform_(\n getCenter(projection.getExtent()),\n );\n if (isNaN(this.projectionCenterLonLat_[1])) {\n this.projectionCenterLonLat_[1] =\n Math.abs(this.maxLat_) >= Math.abs(this.minLat_)\n ? this.maxLat_\n : this.minLat_;\n }\n\n this.projection_ = projection;\n }\n}\n\nexport default Graticule;\n","/**\n * @module ol/layer/Heatmap\n */\nimport {createCanvasContext2D} from '../dom.js';\nimport {BooleanType, NumberType} from '../expr/expression.js';\nimport {newCompilationContext} from '../expr/gpu.js';\nimport {clamp} from '../math.js';\nimport {ShaderBuilder} from '../render/webgl/ShaderBuilder.js';\nimport {\n applyContextToBuilder,\n expressionToGlsl,\n generateAttributesFromContext,\n generateUniformsFromContext,\n} from '../render/webgl/compileUtil.js';\nimport WebGLVectorLayerRenderer from '../renderer/webgl/VectorLayer.js';\nimport BaseVector from './BaseVector.js';\n\n/**\n * @typedef {import(\"../style/flat.js\").NumberExpression|string|function(import(\"../Feature.js\").default):number} WeightExpression\n */\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<FeatureType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {Array<string>} [gradient=['#00f', '#0ff', '#0f0', '#ff0', '#f00']] The color gradient\n * of the heatmap, specified as an array of CSS color strings.\n * @property {import(\"../style/flat.js\").NumberExpression} [radius=8] Radius size in pixels. Note that for LineStrings,\n * the width of the line will be double the radius.\n * @property {import(\"../style/flat.js\").NumberExpression} [blur=15] Blur size in pixels. This is added to the `radius`\n * parameter above to create the final size of the blur effect.\n * @property {WeightExpression} [weight='weight'] The feature\n * attribute to use for the weight. This also supports expressions returning a number or a function that returns a weight from a feature. Weight values\n * should range from 0 to 1 (and values outside will be clamped to that range).\n * @property {import(\"../style/flat.js\").BooleanExpression} [filter] Optional filter expression.\n * @property {Object<string, number|Array<number>|string|boolean>} [variables] Variables used in expressions (optional)\n * @property {VectorSourceType} [source] Point source.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n BLUR: 'blur',\n GRADIENT: 'gradient',\n RADIUS: 'radius',\n};\n\n/**\n * @const\n * @type {Array<string>}\n */\nconst DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];\n\n/**\n * @classdesc\n * Layer for rendering vector data as a heatmap.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<FeatureType>]\n * @extends {BaseVector<FeatureType, VectorSourceType, WebGLVectorLayerRenderer>}\n * @api\n */\nclass Heatmap extends BaseVector {\n /**\n * @param {Options<FeatureType, VectorSourceType>} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign({}, options);\n\n delete baseOptions.gradient;\n delete baseOptions.radius;\n delete baseOptions.blur;\n delete baseOptions.weight;\n super(baseOptions);\n\n this.filter_ = options.filter ?? true;\n\n /**\n * @type {import('../style/flat.js').StyleVariables}\n * @private\n */\n this.styleVariables_ = options.variables || {};\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.gradient_ = null;\n\n this.addChangeListener(Property.GRADIENT, this.handleGradientChanged_);\n\n this.setGradient(options.gradient ? options.gradient : DEFAULT_GRADIENT);\n\n this.setBlur(options.blur !== undefined ? options.blur : 15);\n\n this.setRadius(options.radius !== undefined ? options.radius : 8);\n\n const weight = options.weight ? options.weight : 'weight';\n\n /**\n * @private\n */\n this.weight_ = weight;\n\n // For performance reasons, don't sort the features before rendering.\n // The render order is not relevant for a heatmap representation.\n this.setRenderOrder(null);\n }\n\n /**\n * Return the blur size in pixels.\n * @return {import(\"../style/flat.js\").NumberExpression} Blur size in pixels.\n * @api\n * @observable\n */\n getBlur() {\n return /** @type {import(\"../style/flat.js\").NumberExpression} */ (\n this.get(Property.BLUR)\n );\n }\n\n /**\n * Return the gradient colors as array of strings.\n * @return {Array<string>} Colors.\n * @api\n * @observable\n */\n getGradient() {\n return /** @type {Array<string>} */ (this.get(Property.GRADIENT));\n }\n\n /**\n * Return the size of the radius in pixels.\n * @return {import(\"../style/flat.js\").NumberExpression} Radius size in pixel.\n * @api\n * @observable\n */\n getRadius() {\n return /** @type {import(\"../style/flat.js\").NumberExpression} */ (\n this.get(Property.RADIUS)\n );\n }\n\n /**\n * @private\n */\n handleGradientChanged_() {\n this.gradient_ = createGradient(this.getGradient());\n }\n\n /**\n * Set the blur size in pixels.\n * @param {import(\"../style/flat.js\").NumberExpression} blur Blur size in pixels (supports expressions).\n * @api\n * @observable\n */\n setBlur(blur) {\n const previousValue = this.get(Property.BLUR);\n this.set(Property.BLUR, blur);\n // if the value stays numerical, simply refresh the layer\n if (typeof blur === 'number' && typeof previousValue === 'number') {\n this.changed();\n return;\n }\n this.clearRenderer();\n }\n\n /**\n * Set the gradient colors as array of strings.\n * @param {Array<string>} colors Gradient.\n * @api\n * @observable\n */\n setGradient(colors) {\n this.set(Property.GRADIENT, colors);\n }\n\n /**\n * Set the size of the radius in pixels.\n * @param {import(\"../style/flat.js\").NumberExpression} radius Radius size in pixel (supports expressions).\n * @api\n * @observable\n */\n setRadius(radius) {\n const previousValue = this.get(Property.RADIUS);\n this.set(Property.RADIUS, radius);\n // if the value stays numerical, simply refresh the layer\n if (typeof radius === 'number' && typeof previousValue === 'number') {\n this.changed();\n return;\n }\n this.clearRenderer();\n }\n\n /**\n * Set the filter expression\n * @param {import(\"../style/flat.js\").BooleanExpression} filter Filter expression\n * @api\n */\n setFilter(filter) {\n this.filter_ = filter;\n this.changed();\n this.clearRenderer();\n }\n\n /**\n * Set the weight expression\n * @param {WeightExpression} weight Weight expression\n * @api\n */\n setWeight(weight) {\n this.weight_ = weight;\n this.changed();\n this.clearRenderer();\n }\n\n /**\n * @override\n */\n createRenderer() {\n const builder = new ShaderBuilder();\n\n const context = newCompilationContext();\n const filterCompiled = expressionToGlsl(context, this.filter_, BooleanType);\n let radiusCompiled = expressionToGlsl(\n context,\n this.getRadius(),\n NumberType,\n );\n let blurCompiled = expressionToGlsl(context, this.getBlur(), NumberType);\n\n /** @type {import('../render/webgl/VectorStyleRenderer.js').UniformDefinitions} */\n const blurRadiusUniforms = {};\n if (typeof this.getBlur() === 'number') {\n blurCompiled = 'a_blur';\n blurRadiusUniforms['a_blur'] = () => this.getBlur();\n builder.addUniform('a_blur', 'float');\n }\n if (typeof this.getRadius() === 'number') {\n radiusCompiled = 'a_radius';\n blurRadiusUniforms['a_radius'] = () => this.getRadius();\n builder.addUniform('a_radius', 'float');\n }\n\n /** @type {import('../render/webgl/VectorStyleRenderer.js').AttributeDefinitions} */\n const weightAttribute = {};\n let weightExpression = null;\n if (\n typeof this.weight_ === 'string' ||\n typeof this.weight_ === 'function'\n ) {\n const weightFunction =\n typeof this.weight_ === 'string'\n ? (feature) => feature.get(this.weight_)\n : this.weight_;\n weightAttribute['prop_weight'] = {\n size: 1,\n callback: (feature) => {\n const weightValue = weightFunction(feature);\n return weightValue !== undefined ? clamp(weightValue, 0, 1) : 1;\n },\n };\n weightExpression = 'a_prop_weight';\n builder.addAttribute('a_prop_weight', 'float');\n } else {\n const clampedWeight = ['clamp', this.weight_, 0, 1];\n weightExpression = expressionToGlsl(context, clampedWeight, NumberType);\n }\n\n builder\n .addFragmentShaderFunction(\n `float getBlurSlope() {\n float blur = max(1., ${blurCompiled});\n float radius = ${radiusCompiled};\n return radius / blur;\n}`,\n )\n .setSymbolSizeExpression(`vec2(${radiusCompiled} + ${blurCompiled}) * 2.`)\n .setSymbolColorExpression(\n `vec4(smoothstep(0., 1., (1. - length(coordsPx * 2. / v_quadSizePx)) * getBlurSlope()) * ${weightExpression})`,\n )\n .setStrokeColorExpression(\n `vec4(smoothstep(0., 1., (1. - length(currentRadiusPx * 2. / v_width)) * getBlurSlope()) * ${weightExpression})`,\n )\n .setStrokeWidthExpression(`(${radiusCompiled} + ${blurCompiled}) * 2.`)\n .setFillColorExpression(`vec4(${weightExpression})`)\n .setFragmentDiscardExpression(`!${filterCompiled}`);\n\n applyContextToBuilder(builder, context);\n const attributes = generateAttributesFromContext(context);\n const uniforms = generateUniformsFromContext(context, this.styleVariables_);\n\n return new WebGLVectorLayerRenderer(this, {\n className: this.getClassName(),\n variables: this.styleVariables_,\n style: {\n builder,\n attributes: {\n ...attributes,\n ...weightAttribute,\n },\n uniforms: {\n ...uniforms,\n ...blurRadiusUniforms,\n },\n },\n disableHitDetection: false,\n postProcesses: [\n {\n fragmentShader: `\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }`,\n uniforms: {\n u_gradientTexture: () => this.gradient_,\n u_opacity: () => this.getOpacity(),\n },\n },\n ],\n });\n }\n\n /**\n * Update any variables used by the layer style and trigger a re-render.\n * @param {import('../style/flat.js').StyleVariables} variables Variables to update.\n */\n updateStyleVariables(variables) {\n Object.assign(this.styleVariables_, variables);\n this.changed();\n }\n\n /**\n * @override\n */\n renderDeclutter() {}\n}\n\n/**\n * @param {Array<string>} colors A list of colored.\n * @return {HTMLCanvasElement} canvas with gradient texture.\n */\nfunction createGradient(colors) {\n const width = 1;\n const height = 256;\n const context = createCanvasContext2D(width, height);\n\n const gradient = context.createLinearGradient(0, 0, width, height);\n const step = 1 / (colors.length - 1);\n for (let i = 0, ii = colors.length; i < ii; ++i) {\n gradient.addColorStop(i * step, colors[i]);\n }\n\n context.fillStyle = gradient;\n context.fillRect(0, 0, width, height);\n\n return context.canvas;\n}\n\nexport default Heatmap;\n","/**\n * @module ol/layer/WebGLTile\n */\nimport {ColorType, NumberType} from '../expr/expression.js';\nimport {\n PALETTE_TEXTURE_ARRAY,\n getStringNumberEquivalent,\n newCompilationContext,\n uniformNameForVariable,\n} from '../expr/gpu.js';\nimport LayerProperty from '../layer/Property.js';\nimport {expressionToGlsl} from '../render/webgl/compileUtil.js';\nimport WebGLTileLayerRenderer, {\n Attributes,\n Uniforms,\n} from '../renderer/webgl/TileLayer.js';\nimport BaseTileLayer from './BaseTile.js';\n\n/**\n * @typedef {import(\"../source/DataTile.js\").default<import(\"../DataTile.js\").default|import(\"../ImageTile.js\").default>} SourceType\n */\n\n/**\n * @typedef {Object} Style\n * Translates tile data to rendered pixels.\n *\n * @property {Object<string, (string|number)>} [variables] Style variables. Each variable must hold a number or string. These\n * variables can be used in the `color`, `brightness`, `contrast`, `exposure`, `saturation` and `gamma`\n * {@link import(\"../expr/expression.js\").ExpressionValue expressions}, using the `['var', 'varName']` operator.\n * To update style variables, use the {@link import(\"./WebGLTile.js\").default#updateStyleVariables} method.\n * @property {import(\"../expr/expression.js\").ExpressionValue} [color] An expression applied to color values.\n * @property {import(\"../expr/expression.js\").ExpressionValue} [brightness=0] Value used to decrease or increase\n * the layer brightness. Values range from -1 to 1.\n * @property {import(\"../expr/expression.js\").ExpressionValue} [contrast=0] Value used to decrease or increase\n * the layer contrast. Values range from -1 to 1.\n * @property {import(\"../expr/expression.js\").ExpressionValue} [exposure=0] Value used to decrease or increase\n * the layer exposure. Values range from -1 to 1.\n * @property {import(\"../expr/expression.js\").ExpressionValue} [saturation=0] Value used to decrease or increase\n * the layer saturation. Values range from -1 to 1.\n * @property {import(\"../expr/expression.js\").ExpressionValue} [gamma=1] Apply a gamma correction to the layer.\n * Values range from 0 to infinity.\n */\n\n/**\n * @typedef {Object} Options\n * @property {Style} [style] Style to apply to the layer.\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`\n * means no preloading.\n * @property {SourceType} [source] Source for this layer.\n * @property {Array<SourceType>|function(import(\"../extent.js\").Extent, number):Array<SourceType>} [sources] Array\n * of sources for this layer. Takes precedence over `source`. Can either be an array of sources, or a function that\n * expects an extent and a resolution (in view projection units per pixel) and returns an array of sources. See\n * {@link module:ol/source.sourcesFromTileGrid} for a helper function to generate sources that are organized in a\n * pyramid following the same pattern as a tile grid. **Note:** All sources must have the same band count and content.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use {@link module:ol/Map~Map#addLayer}.\n * @property {boolean} [useInterimTilesOnError=true] Deprecated. Use interim tiles on error.\n * @property {number} [cacheSize=512] The internal texture cache size. This needs to be large enough to render\n * two zoom levels worth of tiles.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @typedef {Object} ParsedStyle\n * @property {string} vertexShader The vertex shader.\n * @property {string} fragmentShader The fragment shader.\n * @property {Object<string,import(\"../webgl/Helper.js\").UniformValue>} uniforms Uniform definitions.\n * @property {Array<import(\"../webgl/PaletteTexture.js\").default>} paletteTextures Palette textures.\n */\n\n/**\n * @param {Style} style The layer style.\n * @param {number} [bandCount] The number of bands.\n * @return {ParsedStyle} Shaders and uniforms generated from the style.\n */\nfunction parseStyle(style, bandCount) {\n const vertexShader = `\n attribute vec2 ${Attributes.TEXTURE_COORD};\n uniform mat4 ${Uniforms.TILE_TRANSFORM};\n uniform float ${Uniforms.TEXTURE_PIXEL_WIDTH};\n uniform float ${Uniforms.TEXTURE_PIXEL_HEIGHT};\n uniform float ${Uniforms.TEXTURE_RESOLUTION};\n uniform float ${Uniforms.TEXTURE_ORIGIN_X};\n uniform float ${Uniforms.TEXTURE_ORIGIN_Y};\n uniform float ${Uniforms.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${Attributes.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${Uniforms.TEXTURE_ORIGIN_X} + ${Uniforms.TEXTURE_RESOLUTION} * ${Uniforms.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${Uniforms.TEXTURE_ORIGIN_Y} - ${Uniforms.TEXTURE_RESOLUTION} * ${Uniforms.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${Uniforms.TILE_TRANSFORM} * vec4(${Attributes.TEXTURE_COORD}, ${Uniforms.DEPTH}, 1.0);\n }\n `;\n\n /**\n * @type {import(\"../expr/gpu.js\").CompilationContext}\n */\n const context = {\n ...newCompilationContext(),\n bandCount: bandCount,\n };\n\n const pipeline = [];\n\n if (style.color !== undefined) {\n const color = expressionToGlsl(context, style.color, ColorType);\n pipeline.push(`color = ${color};`);\n }\n\n if (style.contrast !== undefined) {\n const contrast = expressionToGlsl(context, style.contrast, NumberType);\n pipeline.push(\n `color.rgb = clamp((${contrast} + 1.0) * color.rgb - (${contrast} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`,\n );\n }\n\n if (style.exposure !== undefined) {\n const exposure = expressionToGlsl(context, style.exposure, NumberType);\n pipeline.push(\n `color.rgb = clamp((${exposure} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`,\n );\n }\n\n if (style.saturation !== undefined) {\n const saturation = expressionToGlsl(context, style.saturation, NumberType);\n pipeline.push(`\n float saturation = ${saturation} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `);\n }\n\n if (style.gamma !== undefined) {\n const gamma = expressionToGlsl(context, style.gamma, NumberType);\n pipeline.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${gamma}));`);\n }\n\n if (style.brightness !== undefined) {\n const brightness = expressionToGlsl(context, style.brightness, NumberType);\n pipeline.push(\n `color.rgb = clamp(color.rgb + ${brightness}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`,\n );\n }\n\n /** @type {Object<string,import(\"../webgl/Helper\").UniformValue>} */\n const uniforms = {};\n\n const numVariables = Object.keys(context.variables).length;\n if (numVariables > 1 && !style.variables) {\n throw new Error(\n `Missing variables in style (expected ${context.variables})`,\n );\n }\n\n for (let i = 0; i < numVariables; ++i) {\n const variable = context.variables[Object.keys(context.variables)[i]];\n if (!(variable.name in style.variables)) {\n throw new Error(`Missing '${variable.name}' in style variables`);\n }\n const uniformName = uniformNameForVariable(variable.name);\n uniforms[uniformName] = function () {\n let value = style.variables[variable.name];\n if (typeof value === 'string') {\n value = getStringNumberEquivalent(value);\n }\n return value !== undefined ? value : -9999999; // to avoid matching with the first string literal\n };\n }\n\n const uniformDeclarations = Object.keys(uniforms).map(function (name) {\n return `uniform float ${name};`;\n });\n\n const textureCount = Math.ceil(bandCount / 4);\n uniformDeclarations.push(\n `uniform sampler2D ${Uniforms.TILE_TEXTURE_ARRAY}[${textureCount}];`,\n );\n\n if (context.paletteTextures) {\n uniformDeclarations.push(\n `uniform sampler2D ${PALETTE_TEXTURE_ARRAY}[${context.paletteTextures.length}];`,\n );\n }\n\n const functionDefintions = Object.keys(context.functions).map(\n function (name) {\n return context.functions[name];\n },\n );\n\n const fragmentShader = `\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n uniform vec4 ${Uniforms.RENDER_EXTENT};\n uniform float ${Uniforms.TRANSITION_ALPHA};\n uniform float ${Uniforms.TEXTURE_PIXEL_WIDTH};\n uniform float ${Uniforms.TEXTURE_PIXEL_HEIGHT};\n uniform float ${Uniforms.RESOLUTION};\n uniform float ${Uniforms.ZOOM};\n\n ${uniformDeclarations.join('\\n')}\n\n ${functionDefintions.join('\\n')}\n\n void main() {\n if (\n v_mapCoord[0] < ${Uniforms.RENDER_EXTENT}[0] ||\n v_mapCoord[1] < ${Uniforms.RENDER_EXTENT}[1] ||\n v_mapCoord[0] > ${Uniforms.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${Uniforms.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${\n Uniforms.TILE_TEXTURE_ARRAY\n }[0], v_textureCoord);\n\n ${pipeline.join('\\n')}\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${Uniforms.TRANSITION_ALPHA};\n }`;\n\n return {\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n uniforms: uniforms,\n paletteTextures: context.paletteTextures,\n };\n}\n\n/**\n * @classdesc\n * For layer sources that provide pre-rendered, tiled images in grids that are\n * organized by zoom levels for specific resolutions.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @extends BaseTileLayer<SourceType, WebGLTileLayerRenderer>\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n * @api\n */\nclass WebGLTileLayer extends BaseTileLayer {\n /**\n * @param {Options} [options] Tile layer options.\n */\n constructor(options) {\n options = options ? Object.assign({}, options) : {};\n\n const style = options.style || {};\n delete options.style;\n\n super(options);\n\n /**\n * @type {Array<SourceType>|function(import(\"../extent.js\").Extent, number):Array<SourceType>}\n * @private\n */\n this.sources_ = options.sources;\n\n /**\n * @type {SourceType|null}\n * @private\n */\n this.renderedSource_ = null;\n\n /**\n * @type {number}\n * @private\n */\n this.renderedResolution_ = NaN;\n\n /**\n * @type {Style}\n * @private\n */\n this.style_ = style;\n\n /**\n * @type {Object<string, (string|number)>}\n * @private\n */\n this.styleVariables_ = this.style_.variables || {};\n\n this.handleSourceUpdate_();\n this.addChangeListener(LayerProperty.SOURCE, this.handleSourceUpdate_);\n }\n\n /**\n * Gets the sources for this layer, for a given extent and resolution.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @return {Array<SourceType>} Sources.\n */\n getSources(extent, resolution) {\n const source = this.getSource();\n return this.sources_\n ? typeof this.sources_ === 'function'\n ? this.sources_(extent, resolution)\n : this.sources_\n : source\n ? [source]\n : [];\n }\n\n /**\n * @return {SourceType} The source being rendered.\n * @override\n */\n getRenderSource() {\n return this.renderedSource_ || this.getSource();\n }\n\n /**\n * @return {import(\"../source/Source.js\").State} Source state.\n * @override\n */\n getSourceState() {\n const source = this.getRenderSource();\n return source ? source.getState() : 'undefined';\n }\n\n /**\n * @private\n */\n handleSourceUpdate_() {\n if (this.hasRenderer()) {\n this.getRenderer().clearCache();\n }\n const source = this.getSource();\n if (source) {\n if (source.getState() === 'loading') {\n const onChange = () => {\n if (source.getState() === 'ready') {\n source.removeEventListener('change', onChange);\n this.setStyle(this.style_);\n }\n };\n source.addEventListener('change', onChange);\n } else {\n this.setStyle(this.style_);\n }\n }\n }\n\n /**\n * @private\n * @return {number} The number of source bands.\n */\n getSourceBandCount_() {\n const max = Number.MAX_SAFE_INTEGER;\n const sources = this.getSources([-max, -max, max, max], max);\n return sources && sources.length && 'bandCount' in sources[0]\n ? sources[0].bandCount\n : 4;\n }\n\n /**\n * @override\n */\n createRenderer() {\n const parsedStyle = parseStyle(this.style_, this.getSourceBandCount_());\n\n return new WebGLTileLayerRenderer(this, {\n vertexShader: parsedStyle.vertexShader,\n fragmentShader: parsedStyle.fragmentShader,\n uniforms: parsedStyle.uniforms,\n cacheSize: this.getCacheSize(),\n paletteTextures: parsedStyle.paletteTextures,\n });\n }\n\n /**\n * @param {import(\"../Map\").FrameState} frameState Frame state.\n * @param {Array<SourceType>} sources Sources.\n * @return {HTMLElement} Canvas.\n */\n renderSources(frameState, sources) {\n const layerRenderer = this.getRenderer();\n let canvas;\n for (let i = 0, ii = sources.length; i < ii; ++i) {\n this.renderedSource_ = sources[i];\n if (layerRenderer.prepareFrame(frameState)) {\n canvas = layerRenderer.renderFrame(frameState);\n }\n }\n return canvas;\n }\n\n /**\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n * @param {HTMLElement} target Target which the renderer may (but need not) use\n * for rendering its content.\n * @return {HTMLElement} The rendered element.\n * @override\n */\n render(frameState, target) {\n this.rendered = true;\n const viewState = frameState.viewState;\n const sources = this.getSources(frameState.extent, viewState.resolution);\n let ready = true;\n for (let i = 0, ii = sources.length; i < ii; ++i) {\n const source = sources[i];\n const sourceState = source.getState();\n if (sourceState == 'loading') {\n const onChange = () => {\n if (source.getState() == 'ready') {\n source.removeEventListener('change', onChange);\n this.changed();\n }\n };\n source.addEventListener('change', onChange);\n }\n ready = ready && sourceState == 'ready';\n }\n const canvas = this.renderSources(frameState, sources);\n if (this.getRenderer().renderComplete && ready) {\n // Fully rendered, done.\n this.renderedResolution_ = viewState.resolution;\n return canvas;\n }\n // Render sources from previously fully rendered frames\n if (this.renderedResolution_ > 0.5 * viewState.resolution) {\n const altSources = this.getSources(\n frameState.extent,\n this.renderedResolution_,\n ).filter((source) => !sources.includes(source));\n if (altSources.length > 0) {\n return this.renderSources(frameState, altSources);\n }\n }\n return canvas;\n }\n\n /**\n * Update the layer style. The `updateStyleVariables` function is a more efficient\n * way to update layer rendering. In cases where the whole style needs to be updated,\n * this method may be called instead. Note that calling this method will also replace\n * any previously set variables, so the new style also needs to include new variables,\n * if needed.\n * @param {Style} style The new style.\n */\n setStyle(style) {\n this.styleVariables_ = style.variables || {};\n this.style_ = style;\n if (this.hasRenderer()) {\n const parsedStyle = parseStyle(this.style_, this.getSourceBandCount_());\n const renderer = this.getRenderer();\n renderer.reset({\n vertexShader: parsedStyle.vertexShader,\n fragmentShader: parsedStyle.fragmentShader,\n uniforms: parsedStyle.uniforms,\n paletteTextures: parsedStyle.paletteTextures,\n });\n this.changed();\n }\n }\n\n /**\n * Update any variables used by the layer style and trigger a re-render.\n * @param {Object<string, number>} variables Variables to update.\n * @api\n */\n updateStyleVariables(variables) {\n Object.assign(this.styleVariables_, variables);\n this.changed();\n }\n}\n\n/**\n * Clean up underlying WebGL resources.\n * @function\n * @api\n */\nWebGLTileLayer.prototype.dispose;\n\nexport default WebGLTileLayer;\n","/**\n * @module ol/interaction/DragAndDrop\n */\n// FIXME should handle all geo-referenced data, not just vector data\n\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {TRUE} from '../functions.js';\nimport {get as getProjection, getUserProjection} from '../proj.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {Array<typeof import(\"../format/Feature.js\").default|import(\"../format/Feature.js\").default>} [formatConstructors] Format constructors\n * (and/or formats pre-constructed with options).\n * @property {import(\"../source/Vector.js\").default} [source] Optional vector source where features will be added. If a source is provided\n * all existing features will be removed and new features will be added when\n * they are dropped on the target. If you want to add features to a vector\n * source without removing the existing features (append only), instead of\n * providing the source option listen for the \"addfeatures\" event.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.\n * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.\n */\n\n/**\n * @enum {string}\n */\nconst DragAndDropEventType = {\n /**\n * Triggered when features are added\n * @event DragAndDropEvent#addfeatures\n * @api\n */\n ADD_FEATURES: 'addfeatures',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances\n * of this type.\n */\nexport class DragAndDropEvent extends Event {\n /**\n * @param {DragAndDropEventType} type Type.\n * @param {File} file File.\n * @param {Array<import(\"../Feature.js\").default>} [features] Features.\n * @param {import(\"../proj/Projection.js\").default} [projection] Projection.\n */\n constructor(type, file, features, projection) {\n super(type);\n\n /**\n * The features parsed from dropped data.\n * @type {Array<import(\"../Feature.js\").FeatureLike>|undefined}\n * @api\n */\n this.features = features;\n\n /**\n * The dropped file.\n * @type {File}\n * @api\n */\n this.file = file;\n\n /**\n * The feature projection.\n * @type {import(\"../proj/Projection.js\").default|undefined}\n * @api\n */\n this.projection = projection;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'addfeatures', DragAndDropEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'addfeatures', Return>} DragAndDropOnSignature\n */\n\n/**\n * @classdesc\n * Handles input of vector data by drag and drop.\n *\n * @api\n *\n * @fires DragAndDropEvent\n */\nclass DragAndDrop extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n handleEvent: TRUE,\n });\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {DragAndDropOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {DragAndDropOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {boolean}\n */\n this.readAsBuffer_ = false;\n\n /**\n * @private\n * @type {Array<import(\"../format/Feature.js\").default>}\n */\n this.formats_ = [];\n const formatConstructors = options.formatConstructors\n ? options.formatConstructors\n : [];\n for (let i = 0, ii = formatConstructors.length; i < ii; ++i) {\n let format = formatConstructors[i];\n if (typeof format === 'function') {\n format = new format();\n }\n this.formats_.push(format);\n this.readAsBuffer_ =\n this.readAsBuffer_ || format.getType() === 'arraybuffer';\n }\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.projection_ = options.projection\n ? getProjection(options.projection)\n : null;\n\n /**\n * @private\n * @type {?Array<import(\"../events.js\").EventsKey>}\n */\n this.dropListenKeys_ = null;\n\n /**\n * @private\n * @type {import(\"../source/Vector.js\").default}\n */\n this.source_ = options.source || null;\n\n /**\n * @private\n * @type {HTMLElement|null}\n */\n this.target = options.target ? options.target : null;\n }\n\n /**\n * @param {File} file File.\n * @param {Event} event Load event.\n * @private\n */\n handleResult_(file, event) {\n const result = event.target.result;\n const map = this.getMap();\n let projection = this.projection_;\n if (!projection) {\n projection = getUserProjection();\n if (!projection) {\n const view = map.getView();\n projection = view.getProjection();\n }\n }\n\n let text;\n const formats = this.formats_;\n for (let i = 0, ii = formats.length; i < ii; ++i) {\n const format = formats[i];\n let input = result;\n if (this.readAsBuffer_ && format.getType() !== 'arraybuffer') {\n if (text === undefined) {\n text = new TextDecoder().decode(result);\n }\n input = text;\n }\n const features = this.tryReadFeatures_(format, input, {\n featureProjection: projection,\n });\n if (features && features.length > 0) {\n if (this.source_) {\n this.source_.clear();\n this.source_.addFeatures(features);\n }\n this.dispatchEvent(\n new DragAndDropEvent(\n DragAndDropEventType.ADD_FEATURES,\n file,\n features,\n projection,\n ),\n );\n break;\n }\n }\n }\n\n /**\n * @private\n */\n registerListeners_() {\n const map = this.getMap();\n if (map) {\n const dropArea = this.target ? this.target : map.getViewport();\n this.dropListenKeys_ = [\n listen(dropArea, EventType.DROP, this.handleDrop, this),\n listen(dropArea, EventType.DRAGENTER, this.handleStop, this),\n listen(dropArea, EventType.DRAGOVER, this.handleStop, this),\n listen(dropArea, EventType.DROP, this.handleStop, this),\n ];\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (!this.getActive() && active) {\n this.registerListeners_();\n }\n if (this.getActive() && !active) {\n this.unregisterListeners_();\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.unregisterListeners_();\n super.setMap(map);\n if (this.getActive()) {\n this.registerListeners_();\n }\n }\n\n /**\n * @param {import(\"../format/Feature.js\").default} format Format.\n * @param {string} text Text.\n * @param {import(\"../format/Feature.js\").ReadOptions} options Read options.\n * @private\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n tryReadFeatures_(format, text, options) {\n try {\n return (\n /** @type {Array<import(\"../Feature.js\").default>} */\n (format.readFeatures(text, options))\n );\n } catch {\n return null;\n }\n }\n\n /**\n * @private\n */\n unregisterListeners_() {\n if (this.dropListenKeys_) {\n this.dropListenKeys_.forEach(unlistenByKey);\n this.dropListenKeys_ = null;\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleDrop(event) {\n const files = event.dataTransfer.files;\n for (let i = 0, ii = files.length; i < ii; ++i) {\n const file = files.item(i);\n const reader = new FileReader();\n reader.addEventListener(\n EventType.LOAD,\n this.handleResult_.bind(this, file),\n );\n if (this.readAsBuffer_) {\n reader.readAsArrayBuffer(file);\n } else {\n reader.readAsText(file);\n }\n }\n }\n\n /**\n * @param {DragEvent} event Event.\n */\n handleStop(event) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n }\n}\n\nexport default DragAndDrop;\n","/**\n * @module ol/interaction/Draw\n */\nimport Feature from '../Feature.js';\nimport MapBrowserEvent from '../MapBrowserEvent.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {\n distance,\n squaredDistance as squaredCoordinateDistance,\n} from '../coordinate.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {\n always,\n never,\n noModifierKeys,\n shiftKeyOnly,\n} from '../events/condition.js';\nimport {\n boundingExtent,\n getBottomLeft,\n getBottomRight,\n getTopLeft,\n getTopRight,\n} from '../extent.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport Circle from '../geom/Circle.js';\nimport GeometryCollection from '../geom/GeometryCollection.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon, {fromCircle, makeRegular} from '../geom/Polygon.js';\nimport {getStrideForLayout} from '../geom/SimpleGeometry.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {clamp, squaredDistance, toFixed} from '../math.js';\nimport {fromUserCoordinate, getUserProjection} from '../proj.js';\nimport VectorSource from '../source/Vector.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport PointerInteraction from './Pointer.js';\nimport InteractionProperty from './Property.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../geom/Geometry.js\").Type} type Geometry type of\n * the geometries being drawn with this instance.\n * @property {number} [clickTolerance=6] The maximum distance in pixels between\n * \"down\" and \"up\" for a \"up\" event to be considered a \"click\" event and\n * actually add a point/vertex to the geometry being drawn. The default of `6`\n * was chosen for the draw interaction to behave correctly on mouse as well as\n * on touch devices.\n * @property {import(\"../Collection.js\").default<Feature>} [features]\n * Destination collection for the drawn features.\n * @property {VectorSource} [source] Destination source for\n * the drawn features.\n * @property {number} [dragVertexDelay=500] Delay in milliseconds after pointerdown\n * before the current vertex can be dragged to its exact position.\n * @property {number} [snapTolerance=12] Pixel distance for snapping to the\n * drawing finish. Must be greater than `0`.\n * @property {boolean} [stopClick=false] Stop click, singleclick, and\n * doubleclick events from firing during drawing.\n * @property {number} [maxPoints] The number of points that can be drawn before\n * a polygon ring or line string is finished. By default there is no\n * restriction.\n * @property {number} [minPoints] The number of points that must be drawn\n * before a polygon ring or line string can be finished. Default is `3` for\n * polygon rings and `2` for line strings.\n * @property {import(\"../events/condition.js\").Condition} [finishCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether the drawing can be finished. Not used when drawing\n * POINT or MULTI_POINT geometries.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike} [style]\n * Style for sketch features. The draw interaction can have up to three sketch features, depending on the mode.\n * It will always contain a feature with a `Point` geometry that corresponds to the current cursor position.\n * If the mode is `LineString` or `Polygon`, and there is at least one drawn point, it will also contain a feature with\n * a `LineString` geometry that corresponds to the line between the already drawn points and the current cursor position.\n * If the mode is `Polygon`, and there is at least one drawn point, it will also contain a feature with a `Polygon`\n * geometry that corresponds to the polygon between the already drawn points and the current cursor position\n * (note that this polygon has only two points if only one point is drawn).\n * If the mode is `Circle`, and there is one point drawn, it will also contain a feature with a `Circle` geometry whose\n * center is the drawn point and the radius is determined by the distance between the drawn point and the cursor.\n * @property {GeometryFunction} [geometryFunction]\n * Function that is called when a geometry's coordinates are updated.\n * @property {string} [geometryName] Geometry name to use for features created\n * by the draw interaction.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * By default {@link module:ol/events/condition.noModifierKeys}, i.e. a click,\n * adds a vertex or deactivates freehand drawing.\n * @property {boolean} [freehand=false] Operate in freehand mode for lines,\n * polygons, and circles. This makes the interaction always operate in freehand\n * mode and takes precedence over any `freehandCondition` option.\n * @property {import(\"../events/condition.js\").Condition} [freehandCondition]\n * Condition that activates freehand drawing for lines and polygons. This\n * function takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and\n * returns a boolean to indicate whether that event should be handled. The\n * default is {@link module:ol/events/condition.shiftKeyOnly}, meaning that the\n * Shift key activates freehand drawing.\n * @property {boolean|import(\"../events/condition.js\").Condition} [trace=false] Trace a portion of another geometry.\n * Ignored when in freehand mode.\n * @property {VectorSource} [traceSource] Source for features to trace. If tracing is active and a `traceSource` is\n * not provided, the interaction's `source` will be used. Tracing requires that the interaction is configured with\n * either a `traceSource` or a `source`.\n * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch\n * overlay.\n * @property {import(\"../geom/Geometry.js\").GeometryLayout} [geometryLayout='XY'] Layout of the\n * feature geometries created by the draw interaction.\n */\n\n/**\n * Coordinate type when drawing points.\n * @typedef {import(\"../coordinate.js\").Coordinate} PointCoordType\n */\n\n/**\n * Coordinate type when drawing lines.\n * @typedef {Array<import(\"../coordinate.js\").Coordinate>} LineCoordType\n */\n\n/**\n * Coordinate type when drawing polygons.\n * @typedef {Array<Array<import(\"../coordinate.js\").Coordinate>>} PolyCoordType\n */\n\n/**\n * Types used for drawing coordinates.\n * @typedef {PointCoordType|LineCoordType|PolyCoordType} SketchCoordType\n */\n\n/**\n * @typedef {Object} TraceState\n * @property {boolean} active Tracing active.\n * @property {import(\"../pixel.js\").Pixel} [startPx] The initially clicked pixel location.\n * @property {Array<TraceTarget>} [targets] Targets available for tracing.\n * @property {number} [targetIndex] The index of the currently traced target. A value of -1 indicates\n * that no trace target is active.\n */\n\n/**\n * @typedef {Object} TraceTarget\n * @property {Array<import(\"../coordinate.js\").Coordinate>} coordinates Target coordinates.\n * @property {boolean} ring The target coordinates are a linear ring.\n * @property {number} startIndex The index of first traced coordinate. A fractional index represents an\n * edge intersection. Index values for rings will wrap (may be negative or larger than coordinates length).\n * @property {number} endIndex The index of last traced coordinate. Details from startIndex also apply here.\n */\n\n/**\n * Function that takes an array of coordinates and an optional existing geometry\n * and a projection as arguments, and returns a geometry. The optional existing\n * geometry is the geometry that is returned when the function is called without\n * a second argument.\n * @typedef {function(!SketchCoordType, import(\"../geom/SimpleGeometry.js\").default,\n * import(\"../proj/Projection.js\").default):\n * import(\"../geom/SimpleGeometry.js\").default} GeometryFunction\n */\n\n/**\n * @typedef {'Point' | 'LineString' | 'Polygon' | 'Circle'} Mode\n * Draw mode. This collapses multi-part geometry types with their single-part\n * cousins.\n */\n\n/**\n * @enum {string}\n */\nconst DrawEventType = {\n /**\n * Triggered upon feature draw start\n * @event DrawEvent#drawstart\n * @api\n */\n DRAWSTART: 'drawstart',\n /**\n * Triggered upon feature draw end\n * @event DrawEvent#drawend\n * @api\n */\n DRAWEND: 'drawend',\n /**\n * Triggered upon feature draw abortion\n * @event DrawEvent#drawabort\n * @api\n */\n DRAWABORT: 'drawabort',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Draw~Draw} instances are\n * instances of this type.\n */\nexport class DrawEvent extends Event {\n /**\n * @param {DrawEventType} type Type.\n * @param {Feature} feature The feature drawn.\n */\n constructor(type, feature) {\n super(type);\n\n /**\n * The feature being drawn.\n * @type {Feature}\n * @api\n */\n this.feature = feature;\n }\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The coordinate.\n * @param {Array<Feature>} features The candidate features.\n * @return {Array<TraceTarget>} The trace targets.\n */\nfunction getTraceTargets(coordinate, features) {\n /**\n * @type {Array<TraceTarget>}\n */\n const targets = [];\n\n for (let i = 0; i < features.length; ++i) {\n const feature = features[i];\n const geometry = feature.getGeometry();\n appendGeometryTraceTargets(coordinate, geometry, targets);\n }\n\n return targets;\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} a One coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} b Another coordinate.\n * @return {number} The squared distance between the two coordinates.\n */\nfunction getSquaredDistance(a, b) {\n return squaredDistance(a[0], a[1], b[0], b[1]);\n}\n\n/**\n * @param {LineCoordType} coordinates The ring coordinates.\n * @param {number} index The index. May be wrapped.\n * @return {import(\"../coordinate.js\").Coordinate} The coordinate.\n */\nfunction getCoordinate(coordinates, index) {\n const count = coordinates.length;\n if (index < 0) {\n return coordinates[index + count];\n }\n if (index >= count) {\n return coordinates[index - count];\n }\n return coordinates[index];\n}\n\n/**\n * Get the cumulative squared distance along a ring path. The end index index may be \"wrapped\" and it may\n * be less than the start index to indicate the direction of travel. The start and end index may have\n * a fractional part to indicate a point between two coordinates.\n * @param {LineCoordType} coordinates Ring coordinates.\n * @param {number} startIndex The start index.\n * @param {number} endIndex The end index.\n * @return {number} The cumulative squared distance along the ring path.\n */\nfunction getCumulativeSquaredDistance(coordinates, startIndex, endIndex) {\n let lowIndex, highIndex;\n if (startIndex < endIndex) {\n lowIndex = startIndex;\n highIndex = endIndex;\n } else {\n lowIndex = endIndex;\n highIndex = startIndex;\n }\n const lowWholeIndex = Math.ceil(lowIndex);\n const highWholeIndex = Math.floor(highIndex);\n\n if (lowWholeIndex > highWholeIndex) {\n // both start and end are on the same segment\n const start = interpolateCoordinate(coordinates, lowIndex);\n const end = interpolateCoordinate(coordinates, highIndex);\n return getSquaredDistance(start, end);\n }\n\n let sd = 0;\n\n if (lowIndex < lowWholeIndex) {\n const start = interpolateCoordinate(coordinates, lowIndex);\n const end = getCoordinate(coordinates, lowWholeIndex);\n sd += getSquaredDistance(start, end);\n }\n\n if (highWholeIndex < highIndex) {\n const start = getCoordinate(coordinates, highWholeIndex);\n const end = interpolateCoordinate(coordinates, highIndex);\n sd += getSquaredDistance(start, end);\n }\n\n for (let i = lowWholeIndex; i < highWholeIndex - 1; ++i) {\n const start = getCoordinate(coordinates, i);\n const end = getCoordinate(coordinates, i + 1);\n sd += getSquaredDistance(start, end);\n }\n\n return sd;\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The coordinate.\n * @param {import(\"../geom/Geometry.js\").default} geometry The candidate geometry.\n * @param {Array<TraceTarget>} targets The trace targets.\n */\nfunction appendGeometryTraceTargets(coordinate, geometry, targets) {\n if (geometry instanceof LineString) {\n appendTraceTarget(coordinate, geometry.getCoordinates(), false, targets);\n return;\n }\n if (geometry instanceof MultiLineString) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n appendTraceTarget(coordinate, coordinates[i], false, targets);\n }\n return;\n }\n if (geometry instanceof Polygon) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n appendTraceTarget(coordinate, coordinates[i], true, targets);\n }\n return;\n }\n if (geometry instanceof MultiPolygon) {\n const polys = geometry.getCoordinates();\n for (let i = 0, ii = polys.length; i < ii; ++i) {\n const coordinates = polys[i];\n for (let j = 0, jj = coordinates.length; j < jj; ++j) {\n appendTraceTarget(coordinate, coordinates[j], true, targets);\n }\n }\n return;\n }\n if (geometry instanceof GeometryCollection) {\n const geometries = geometry.getGeometries();\n for (let i = 0; i < geometries.length; ++i) {\n appendGeometryTraceTargets(coordinate, geometries[i], targets);\n }\n return;\n }\n // other types cannot be traced\n}\n\n/**\n * @typedef {Object} TraceTargetUpdateInfo\n * @property {number} index The new target index.\n * @property {number} endIndex The new segment end index.\n */\n\n/**\n * @type {TraceTargetUpdateInfo}\n */\nconst sharedUpdateInfo = {index: -1, endIndex: NaN};\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The coordinate.\n * @param {TraceState} traceState The trace state.\n * @param {import(\"../Map.js\").default} map The map.\n * @param {number} snapTolerance The snap tolerance.\n * @return {TraceTargetUpdateInfo} Information about the new trace target. The returned\n * object is reused between calls and must not be modified by the caller.\n */\nfunction getTraceTargetUpdate(coordinate, traceState, map, snapTolerance) {\n const x = coordinate[0];\n const y = coordinate[1];\n\n let closestTargetDistance = Infinity;\n\n let newTargetIndex = -1;\n let newEndIndex = NaN;\n\n for (\n let targetIndex = 0;\n targetIndex < traceState.targets.length;\n ++targetIndex\n ) {\n const target = traceState.targets[targetIndex];\n const coordinates = target.coordinates;\n\n let minSegmentDistance = Infinity;\n let endIndex;\n for (\n let coordinateIndex = 0;\n coordinateIndex < coordinates.length - 1;\n ++coordinateIndex\n ) {\n const start = coordinates[coordinateIndex];\n const end = coordinates[coordinateIndex + 1];\n const rel = getPointSegmentRelationship(x, y, start, end);\n if (rel.squaredDistance < minSegmentDistance) {\n minSegmentDistance = rel.squaredDistance;\n endIndex = coordinateIndex + rel.along;\n }\n }\n\n if (minSegmentDistance < closestTargetDistance) {\n closestTargetDistance = minSegmentDistance;\n if (target.ring && traceState.targetIndex === targetIndex) {\n // same target, maintain the same trace direction\n if (target.endIndex > target.startIndex) {\n // forward trace\n if (endIndex < target.startIndex) {\n endIndex += coordinates.length;\n }\n } else if (target.endIndex < target.startIndex) {\n // reverse trace\n if (endIndex > target.startIndex) {\n endIndex -= coordinates.length;\n }\n }\n }\n newEndIndex = endIndex;\n newTargetIndex = targetIndex;\n }\n }\n\n const newTarget = traceState.targets[newTargetIndex];\n let considerBothDirections = newTarget.ring;\n if (traceState.targetIndex === newTargetIndex && considerBothDirections) {\n // only consider switching trace direction if close to the start\n const newCoordinate = interpolateCoordinate(\n newTarget.coordinates,\n newEndIndex,\n );\n const pixel = map.getPixelFromCoordinate(newCoordinate);\n if (distance(pixel, traceState.startPx) > snapTolerance) {\n considerBothDirections = false;\n }\n }\n\n if (considerBothDirections) {\n const coordinates = newTarget.coordinates;\n const count = coordinates.length;\n const startIndex = newTarget.startIndex;\n const endIndex = newEndIndex;\n if (startIndex < endIndex) {\n const forwardDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex,\n );\n const reverseDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex - count,\n );\n if (reverseDistance < forwardDistance) {\n newEndIndex -= count;\n }\n } else {\n const reverseDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex,\n );\n const forwardDistance = getCumulativeSquaredDistance(\n coordinates,\n startIndex,\n endIndex + count,\n );\n if (forwardDistance < reverseDistance) {\n newEndIndex += count;\n }\n }\n }\n\n sharedUpdateInfo.index = newTargetIndex;\n sharedUpdateInfo.endIndex = newEndIndex;\n return sharedUpdateInfo;\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The clicked coordinate.\n * @param {Array<import(\"../coordinate.js\").Coordinate>} coordinates The geometry component coordinates.\n * @param {boolean} ring The coordinates represent a linear ring.\n * @param {Array<TraceTarget>} targets The trace targets.\n */\nfunction appendTraceTarget(coordinate, coordinates, ring, targets) {\n const x = coordinate[0];\n const y = coordinate[1];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const start = coordinates[i];\n const end = coordinates[i + 1];\n const rel = getPointSegmentRelationship(x, y, start, end);\n if (rel.squaredDistance === 0) {\n const index = i + rel.along;\n targets.push({\n coordinates: coordinates,\n ring: ring,\n startIndex: index,\n endIndex: index,\n });\n return;\n }\n }\n}\n\n/**\n * @typedef {Object} PointSegmentRelationship\n * @property {number} along The closest point expressed as a fraction along the segment length.\n * @property {number} squaredDistance The squared distance of the point to the segment.\n */\n\n/**\n * @type {PointSegmentRelationship}\n */\nconst sharedRel = {along: 0, squaredDistance: 0};\n\n/**\n * @param {number} x The point x.\n * @param {number} y The point y.\n * @param {import(\"../coordinate.js\").Coordinate} start The segment start.\n * @param {import(\"../coordinate.js\").Coordinate} end The segment end.\n * @return {PointSegmentRelationship} The point segment relationship. The returned object is\n * shared between calls and must not be modified by the caller.\n */\nfunction getPointSegmentRelationship(x, y, start, end) {\n const x1 = start[0];\n const y1 = start[1];\n const x2 = end[0];\n const y2 = end[1];\n const dx = x2 - x1;\n const dy = y2 - y1;\n let along = 0;\n let px = x1;\n let py = y1;\n if (dx !== 0 || dy !== 0) {\n along = clamp(((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy), 0, 1);\n px += dx * along;\n py += dy * along;\n }\n\n sharedRel.along = along;\n sharedRel.squaredDistance = toFixed(squaredDistance(x, y, px, py), 10);\n return sharedRel;\n}\n\n/**\n * @param {LineCoordType} coordinates The coordinates.\n * @param {number} index The index. May be fractional and may wrap.\n * @return {import(\"../coordinate.js\").Coordinate} The interpolated coordinate.\n */\nfunction interpolateCoordinate(coordinates, index) {\n const count = coordinates.length;\n\n let startIndex = Math.floor(index);\n const along = index - startIndex;\n if (startIndex >= count) {\n startIndex -= count;\n } else if (startIndex < 0) {\n startIndex += count;\n }\n\n let endIndex = startIndex + 1;\n if (endIndex >= count) {\n endIndex -= count;\n }\n\n const start = coordinates[startIndex];\n const x0 = start[0];\n const y0 = start[1];\n const end = coordinates[endIndex];\n const dx = end[0] - x0;\n const dy = end[1] - y0;\n\n return [x0 + dx * along, y0 + dy * along];\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'drawabort'|'drawend'|'drawstart', Return>} DrawOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for drawing feature geometries.\n *\n * @fires DrawEvent\n * @api\n */\nclass Draw extends PointerInteraction {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /***\n * @type {DrawOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {DrawOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {DrawOnSignature<void>}\n */\n this.un;\n\n /**\n * @type {boolean}\n * @private\n */\n this.shouldHandle_ = false;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.downPx_ = null;\n\n /**\n * @type {ReturnType<typeof setTimeout>}\n * @private\n */\n this.downTimeout_;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.lastDragTime_;\n\n /**\n * Pointer type of the last pointermove event\n * @type {string}\n * @private\n */\n this.pointerType_;\n\n /**\n * @type {boolean}\n * @private\n */\n this.freehand_ = false;\n\n /**\n * Target source for drawn features.\n * @type {VectorSource|null}\n * @private\n */\n this.source_ = options.source ? options.source : null;\n\n /**\n * Target collection for drawn features.\n * @type {import(\"../Collection.js\").default<Feature>|null}\n * @private\n */\n this.features_ = options.features ? options.features : null;\n\n /**\n * Pixel distance for snapping.\n * @type {number}\n * @private\n */\n this.snapTolerance_ = options.snapTolerance ? options.snapTolerance : 12;\n\n /**\n * Geometry type.\n * @type {import(\"../geom/Geometry.js\").Type}\n * @private\n */\n this.type_ = /** @type {import(\"../geom/Geometry.js\").Type} */ (\n options.type\n );\n\n /**\n * Drawing mode (derived from geometry type.\n * @type {Mode}\n * @private\n */\n this.mode_ = getMode(this.type_);\n\n /**\n * Stop click, singleclick, and doubleclick events from firing during drawing.\n * Default is `false`.\n * @type {boolean}\n * @private\n */\n this.stopClick_ = !!options.stopClick;\n\n /**\n * The number of points that must be drawn before a polygon ring or line\n * string can be finished. The default is 3 for polygon rings and 2 for\n * line strings.\n * @type {number}\n * @private\n */\n this.minPoints_ = options.minPoints\n ? options.minPoints\n : this.mode_ === 'Polygon'\n ? 3\n : 2;\n\n /**\n * The number of points that can be drawn before a polygon ring or line string\n * is finished. The default is no restriction.\n * @type {number}\n * @private\n */\n this.maxPoints_ =\n this.mode_ === 'Circle'\n ? 2\n : options.maxPoints\n ? options.maxPoints\n : Infinity;\n\n /**\n * A function to decide if a potential finish coordinate is permissible\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.finishCondition_ = options.finishCondition\n ? options.finishCondition\n : TRUE;\n\n /**\n * @private\n * @type {import(\"../geom/Geometry.js\").GeometryLayout}\n */\n this.geometryLayout_ = options.geometryLayout\n ? options.geometryLayout\n : 'XY';\n\n let geometryFunction = options.geometryFunction;\n if (!geometryFunction) {\n const mode = this.mode_;\n if (mode === 'Circle') {\n /**\n * @param {!LineCoordType} coordinates The coordinates.\n * @param {import(\"../geom/SimpleGeometry.js\").default|undefined} geometry Optional geometry.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../geom/SimpleGeometry.js\").default} A geometry.\n */\n geometryFunction = (coordinates, geometry, projection) => {\n const circle = geometry\n ? /** @type {Circle} */ (geometry)\n : new Circle([NaN, NaN]);\n const center = fromUserCoordinate(coordinates[0], projection);\n const squaredLength = squaredCoordinateDistance(\n center,\n fromUserCoordinate(coordinates[coordinates.length - 1], projection),\n );\n circle.setCenterAndRadius(\n center,\n Math.sqrt(squaredLength),\n this.geometryLayout_,\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n circle.transform(projection, userProjection);\n }\n return circle;\n };\n } else {\n let Constructor;\n if (mode === 'Point') {\n Constructor = Point;\n } else if (mode === 'LineString') {\n Constructor = LineString;\n } else if (mode === 'Polygon') {\n Constructor = Polygon;\n }\n /**\n * @param {!LineCoordType} coordinates The coordinates.\n * @param {import(\"../geom/SimpleGeometry.js\").default|undefined} geometry Optional geometry.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../geom/SimpleGeometry.js\").default} A geometry.\n */\n geometryFunction = (coordinates, geometry, projection) => {\n if (geometry) {\n if (mode === 'Polygon') {\n if (coordinates[0].length) {\n // Add a closing coordinate to match the first\n geometry.setCoordinates(\n [coordinates[0].concat([coordinates[0][0]])],\n this.geometryLayout_,\n );\n } else {\n geometry.setCoordinates([], this.geometryLayout_);\n }\n } else {\n geometry.setCoordinates(coordinates, this.geometryLayout_);\n }\n } else {\n geometry = new Constructor(coordinates, this.geometryLayout_);\n }\n return geometry;\n };\n }\n }\n\n /**\n * @type {GeometryFunction}\n * @private\n */\n this.geometryFunction_ = geometryFunction;\n\n /**\n * @type {number}\n * @private\n */\n this.dragVertexDelay_ =\n options.dragVertexDelay !== undefined ? options.dragVertexDelay : 500;\n\n /**\n * Finish coordinate for the feature (first point for polygons, last point for\n * linestrings).\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.finishCoordinate_ = null;\n\n /**\n * Sketch feature.\n * @type {Feature<import('../geom/SimpleGeometry.js').default>}\n * @private\n */\n this.sketchFeature_ = null;\n\n /**\n * Sketch point.\n * @type {Feature<Point>}\n * @private\n */\n this.sketchPoint_ = null;\n\n /**\n * Sketch coordinates. Used when drawing a line or polygon.\n * @type {SketchCoordType}\n * @private\n */\n this.sketchCoords_ = null;\n\n /**\n * Sketch line. Used when drawing polygon.\n * @type {Feature<LineString>}\n * @private\n */\n this.sketchLine_ = null;\n\n /**\n * Sketch line coordinates. Used when drawing a polygon or circle.\n * @type {LineCoordType}\n * @private\n */\n this.sketchLineCoords_ = null;\n\n /**\n * Squared tolerance for handling up events. If the squared distance\n * between a down and up event is greater than this tolerance, up events\n * will not be handled.\n * @type {number}\n * @private\n */\n this.squaredClickTolerance_ = options.clickTolerance\n ? options.clickTolerance * options.clickTolerance\n : 36;\n\n /**\n * Draw overlay where our sketch features are drawn.\n * @type {VectorLayer}\n * @private\n */\n this.overlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: options.wrapX ? options.wrapX : false,\n }),\n style: options.style ? options.style : getDefaultStyleFunction(),\n updateWhileInteracting: true,\n });\n\n /**\n * Name of the geometry attribute for newly created features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : noModifierKeys;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.freehandCondition_;\n if (options.freehand) {\n this.freehandCondition_ = always;\n } else {\n this.freehandCondition_ = options.freehandCondition\n ? options.freehandCondition\n : shiftKeyOnly;\n }\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.traceCondition_;\n this.setTrace(options.trace || false);\n\n /**\n * @type {TraceState}\n * @private\n */\n this.traceState_ = {active: false};\n\n /**\n * @type {VectorSource|null}\n * @private\n */\n this.traceSource_ = options.traceSource || options.source || null;\n\n this.addChangeListener(InteractionProperty.ACTIVE, this.updateState_);\n }\n\n /**\n * Toggle tracing mode or set a tracing condition.\n *\n * @param {boolean|import(\"../events/condition.js\").Condition} trace A boolean to toggle tracing mode or an event\n * condition that will be checked when a feature is clicked to determine if tracing should be active.\n */\n setTrace(trace) {\n let condition;\n if (!trace) {\n condition = never;\n } else if (trace === true) {\n condition = always;\n } else {\n condition = trace;\n }\n this.traceCondition_ = condition;\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n super.setMap(map);\n this.updateState_();\n }\n\n /**\n * Get the overlay layer that this interaction renders sketch features to.\n * @return {VectorLayer} Overlay layer.\n * @api\n */\n getOverlay() {\n return this.overlay_;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may actually draw or finish the drawing.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(event) {\n if (event.originalEvent.type === EventType.CONTEXTMENU) {\n // Avoid context menu for long taps when drawing on mobile\n event.originalEvent.preventDefault();\n }\n this.freehand_ = this.mode_ !== 'Point' && this.freehandCondition_(event);\n let move = event.type === MapBrowserEventType.POINTERMOVE;\n let pass = true;\n if (\n !this.freehand_ &&\n this.lastDragTime_ &&\n event.type === MapBrowserEventType.POINTERDRAG\n ) {\n const now = Date.now();\n if (now - this.lastDragTime_ >= this.dragVertexDelay_) {\n this.downPx_ = event.pixel;\n this.shouldHandle_ = !this.freehand_;\n move = true;\n } else {\n this.lastDragTime_ = undefined;\n }\n if (this.shouldHandle_ && this.downTimeout_ !== undefined) {\n clearTimeout(this.downTimeout_);\n this.downTimeout_ = undefined;\n }\n }\n if (\n this.freehand_ &&\n event.type === MapBrowserEventType.POINTERDRAG &&\n this.sketchFeature_ !== null\n ) {\n this.addToDrawing_(event.coordinate);\n pass = false;\n } else if (\n this.freehand_ &&\n event.type === MapBrowserEventType.POINTERDOWN\n ) {\n pass = false;\n } else if (move && this.getPointerCount() < 2) {\n pass = event.type === MapBrowserEventType.POINTERMOVE;\n if (pass && this.freehand_) {\n this.handlePointerMove_(event);\n if (this.shouldHandle_) {\n // Avoid page scrolling when freehand drawing on mobile\n event.originalEvent.preventDefault();\n }\n } else if (\n event.originalEvent.pointerType === 'mouse' ||\n (event.type === MapBrowserEventType.POINTERDRAG &&\n this.downTimeout_ === undefined)\n ) {\n this.handlePointerMove_(event);\n }\n } else if (event.type === MapBrowserEventType.DBLCLICK) {\n pass = false;\n }\n\n return super.handleEvent(event) && pass;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(event) {\n this.shouldHandle_ = !this.freehand_;\n\n if (this.freehand_) {\n this.downPx_ = event.pixel;\n if (!this.finishCoordinate_) {\n this.startDrawing_(event.coordinate);\n }\n return true;\n }\n\n if (!this.condition_(event)) {\n this.lastDragTime_ = undefined;\n return false;\n }\n\n this.lastDragTime_ = Date.now();\n this.downTimeout_ = setTimeout(() => {\n this.handlePointerMove_(\n new MapBrowserEvent(\n MapBrowserEventType.POINTERMOVE,\n event.map,\n event.originalEvent,\n false,\n event.frameState,\n ),\n );\n }, this.dragVertexDelay_);\n this.downPx_ = event.pixel;\n return true;\n }\n\n /**\n * @private\n */\n deactivateTrace_() {\n this.traceState_ = {active: false};\n }\n\n /**\n * Activate or deactivate trace state based on a browser event.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n toggleTraceState_(event) {\n if (!this.traceSource_ || !this.traceCondition_(event)) {\n return;\n }\n\n if (this.traceState_.active) {\n this.deactivateTrace_();\n return;\n }\n\n const map = this.getMap();\n const lowerLeft = map.getCoordinateFromPixel([\n event.pixel[0] - this.snapTolerance_,\n event.pixel[1] + this.snapTolerance_,\n ]);\n const upperRight = map.getCoordinateFromPixel([\n event.pixel[0] + this.snapTolerance_,\n event.pixel[1] - this.snapTolerance_,\n ]);\n const extent = boundingExtent([lowerLeft, upperRight]);\n const features = this.traceSource_.getFeaturesInExtent(extent);\n if (features.length === 0) {\n return;\n }\n\n const targets = getTraceTargets(event.coordinate, features);\n if (targets.length) {\n this.traceState_ = {\n active: true,\n startPx: event.pixel.slice(),\n targets: targets,\n targetIndex: -1,\n };\n }\n }\n\n /**\n * @param {TraceTarget} target The trace target.\n * @param {number} endIndex The new end index of the trace.\n * @private\n */\n addOrRemoveTracedCoordinates_(target, endIndex) {\n // three cases to handle:\n // 1. traced in the same direction and points need adding\n // 2. traced in the same direction and points need removing\n // 3. traced in a new direction\n const previouslyForward = target.startIndex <= target.endIndex;\n const currentlyForward = target.startIndex <= endIndex;\n if (previouslyForward === currentlyForward) {\n // same direction\n if (\n (previouslyForward && endIndex > target.endIndex) ||\n (!previouslyForward && endIndex < target.endIndex)\n ) {\n // case 1 - add new points\n this.addTracedCoordinates_(target, target.endIndex, endIndex);\n } else if (\n (previouslyForward && endIndex < target.endIndex) ||\n (!previouslyForward && endIndex > target.endIndex)\n ) {\n // case 2 - remove old points\n this.removeTracedCoordinates_(endIndex, target.endIndex);\n }\n } else {\n // case 3 - remove old points, add new points\n this.removeTracedCoordinates_(target.startIndex, target.endIndex);\n this.addTracedCoordinates_(target, target.startIndex, endIndex);\n }\n }\n\n /**\n * @param {number} fromIndex The start index.\n * @param {number} toIndex The end index.\n * @private\n */\n removeTracedCoordinates_(fromIndex, toIndex) {\n if (fromIndex === toIndex) {\n return;\n }\n\n let remove = 0;\n if (fromIndex < toIndex) {\n const start = Math.ceil(fromIndex);\n let end = Math.floor(toIndex);\n if (end === toIndex) {\n end -= 1;\n }\n remove = end - start + 1;\n } else {\n const start = Math.floor(fromIndex);\n let end = Math.ceil(toIndex);\n if (end === toIndex) {\n end += 1;\n }\n remove = start - end + 1;\n }\n\n if (remove > 0) {\n this.removeLastPoints_(remove);\n }\n }\n\n /**\n * @param {TraceTarget} target The trace target.\n * @param {number} fromIndex The start index.\n * @param {number} toIndex The end index.\n * @private\n */\n addTracedCoordinates_(target, fromIndex, toIndex) {\n if (fromIndex === toIndex) {\n return;\n }\n\n const coordinates = [];\n if (fromIndex < toIndex) {\n // forward trace\n const start = Math.ceil(fromIndex);\n let end = Math.floor(toIndex);\n if (end === toIndex) {\n // if end is snapped to a vertex, it will be added later\n end -= 1;\n }\n for (let i = start; i <= end; ++i) {\n coordinates.push(getCoordinate(target.coordinates, i));\n }\n } else {\n // reverse trace\n const start = Math.floor(fromIndex);\n let end = Math.ceil(toIndex);\n if (end === toIndex) {\n end += 1;\n }\n for (let i = start; i >= end; --i) {\n coordinates.push(getCoordinate(target.coordinates, i));\n }\n }\n if (coordinates.length) {\n this.appendCoordinates(coordinates);\n }\n }\n\n /**\n * Update the trace.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n updateTrace_(event) {\n const traceState = this.traceState_;\n if (!traceState.active) {\n return;\n }\n\n if (traceState.targetIndex === -1) {\n // check if we are ready to pick a target\n if (distance(traceState.startPx, event.pixel) < this.snapTolerance_) {\n return;\n }\n }\n\n const updatedTraceTarget = getTraceTargetUpdate(\n event.coordinate,\n traceState,\n this.getMap(),\n this.snapTolerance_,\n );\n\n if (traceState.targetIndex !== updatedTraceTarget.index) {\n // target changed\n if (traceState.targetIndex !== -1) {\n // remove points added during previous trace\n const oldTarget = traceState.targets[traceState.targetIndex];\n this.removeTracedCoordinates_(oldTarget.startIndex, oldTarget.endIndex);\n }\n // add points for the new target\n const newTarget = traceState.targets[updatedTraceTarget.index];\n this.addTracedCoordinates_(\n newTarget,\n newTarget.startIndex,\n updatedTraceTarget.endIndex,\n );\n } else {\n // target stayed the same\n const target = traceState.targets[traceState.targetIndex];\n this.addOrRemoveTracedCoordinates_(target, updatedTraceTarget.endIndex);\n }\n\n // modify the state with updated info\n traceState.targetIndex = updatedTraceTarget.index;\n const target = traceState.targets[traceState.targetIndex];\n target.endIndex = updatedTraceTarget.endIndex;\n\n // update event coordinate and pixel to match end point of final segment\n const coordinate = interpolateCoordinate(\n target.coordinates,\n target.endIndex,\n );\n const pixel = this.getMap().getPixelFromCoordinate(coordinate);\n event.coordinate = coordinate;\n event.pixel = [Math.round(pixel[0]), Math.round(pixel[1])];\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(event) {\n let pass = true;\n\n if (this.getPointerCount() === 0) {\n if (this.downTimeout_) {\n clearTimeout(this.downTimeout_);\n this.downTimeout_ = undefined;\n }\n\n this.handlePointerMove_(event);\n const tracing = this.traceState_.active;\n this.toggleTraceState_(event);\n\n if (this.shouldHandle_) {\n const startingToDraw = !this.finishCoordinate_;\n if (startingToDraw) {\n this.startDrawing_(event.coordinate);\n }\n if (!startingToDraw && this.freehand_) {\n this.finishDrawing();\n } else if (\n !this.freehand_ &&\n (!startingToDraw || this.mode_ === 'Point')\n ) {\n if (this.atFinish_(event.pixel, tracing)) {\n if (this.finishCondition_(event)) {\n this.finishDrawing();\n }\n } else {\n this.addToDrawing_(event.coordinate);\n }\n }\n pass = false;\n } else if (this.freehand_) {\n this.abortDrawing();\n }\n }\n\n if (!pass && this.stopClick_) {\n event.preventDefault();\n }\n return pass;\n }\n\n /**\n * Handle move events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} event A move event.\n * @private\n */\n handlePointerMove_(event) {\n this.pointerType_ = event.originalEvent.pointerType;\n if (\n this.downPx_ &&\n ((!this.freehand_ && this.shouldHandle_) ||\n (this.freehand_ && !this.shouldHandle_))\n ) {\n const downPx = this.downPx_;\n const clickPx = event.pixel;\n const dx = downPx[0] - clickPx[0];\n const dy = downPx[1] - clickPx[1];\n const squaredDistance = dx * dx + dy * dy;\n this.shouldHandle_ = this.freehand_\n ? squaredDistance > this.squaredClickTolerance_\n : squaredDistance <= this.squaredClickTolerance_;\n if (!this.shouldHandle_) {\n return;\n }\n }\n\n if (!this.finishCoordinate_) {\n this.createOrUpdateSketchPoint_(event.coordinate.slice());\n return;\n }\n\n this.updateTrace_(event);\n this.modifyDrawing_(event.coordinate);\n }\n\n /**\n * Determine if an event is within the snapping tolerance of the start coord.\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @param {boolean} [tracing] Drawing in trace mode (only stop if at the starting point).\n * @return {boolean} The event is within the snapping tolerance of the start.\n * @private\n */\n atFinish_(pixel, tracing) {\n let at = false;\n if (this.sketchFeature_) {\n let potentiallyDone = false;\n let potentiallyFinishCoordinates = [this.finishCoordinate_];\n const mode = this.mode_;\n if (mode === 'Point') {\n at = true;\n } else if (mode === 'Circle') {\n at = this.sketchCoords_.length === 2;\n } else if (mode === 'LineString') {\n potentiallyDone =\n !tracing && this.sketchCoords_.length > this.minPoints_;\n } else if (mode === 'Polygon') {\n const sketchCoords = /** @type {PolyCoordType} */ (this.sketchCoords_);\n potentiallyDone = sketchCoords[0].length > this.minPoints_;\n potentiallyFinishCoordinates = [\n sketchCoords[0][0],\n sketchCoords[0][sketchCoords[0].length - 2],\n ];\n if (tracing) {\n potentiallyFinishCoordinates = [sketchCoords[0][0]];\n } else {\n potentiallyFinishCoordinates = [\n sketchCoords[0][0],\n sketchCoords[0][sketchCoords[0].length - 2],\n ];\n }\n }\n if (potentiallyDone) {\n const map = this.getMap();\n for (let i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) {\n const finishCoordinate = potentiallyFinishCoordinates[i];\n const finishPixel = map.getPixelFromCoordinate(finishCoordinate);\n const dx = pixel[0] - finishPixel[0];\n const dy = pixel[1] - finishPixel[1];\n const snapTolerance = this.freehand_ ? 1 : this.snapTolerance_;\n at = Math.sqrt(dx * dx + dy * dy) <= snapTolerance;\n if (at) {\n this.finishCoordinate_ = finishCoordinate;\n break;\n }\n }\n }\n }\n return at;\n }\n\n /**\n * @param {import(\"../coordinate\").Coordinate} coordinates Coordinate.\n * @private\n */\n createOrUpdateSketchPoint_(coordinates) {\n if (!this.sketchPoint_) {\n this.sketchPoint_ = new Feature(new Point(coordinates));\n this.updateSketchFeatures_();\n } else {\n const sketchPointGeom = this.sketchPoint_.getGeometry();\n sketchPointGeom.setCoordinates(coordinates);\n }\n }\n\n /**\n * @param {import(\"../geom/Polygon.js\").default} geometry Polygon geometry.\n * @private\n */\n createOrUpdateCustomSketchLine_(geometry) {\n if (!this.sketchLine_) {\n this.sketchLine_ = new Feature();\n }\n const ring = geometry.getLinearRing(0);\n let sketchLineGeom = this.sketchLine_.getGeometry();\n if (!sketchLineGeom) {\n sketchLineGeom = new LineString(\n ring.getFlatCoordinates(),\n ring.getLayout(),\n );\n this.sketchLine_.setGeometry(sketchLineGeom);\n } else {\n sketchLineGeom.setFlatCoordinates(\n ring.getLayout(),\n ring.getFlatCoordinates(),\n );\n sketchLineGeom.changed();\n }\n }\n\n /**\n * Start the drawing.\n * @param {import(\"../coordinate.js\").Coordinate} start Start coordinate.\n * @private\n */\n startDrawing_(start) {\n const projection = this.getMap().getView().getProjection();\n const stride = getStrideForLayout(this.geometryLayout_);\n while (start.length < stride) {\n start.push(0);\n }\n this.finishCoordinate_ = start;\n if (this.mode_ === 'Point') {\n this.sketchCoords_ = start.slice();\n } else if (this.mode_ === 'Polygon') {\n this.sketchCoords_ = [[start.slice(), start.slice()]];\n this.sketchLineCoords_ = this.sketchCoords_[0];\n } else {\n this.sketchCoords_ = [start.slice(), start.slice()];\n }\n if (this.sketchLineCoords_) {\n this.sketchLine_ = new Feature(new LineString(this.sketchLineCoords_));\n }\n const geometry = this.geometryFunction_(\n this.sketchCoords_,\n undefined,\n projection,\n );\n this.sketchFeature_ = new Feature();\n if (this.geometryName_) {\n this.sketchFeature_.setGeometryName(this.geometryName_);\n }\n this.sketchFeature_.setGeometry(geometry);\n this.updateSketchFeatures_();\n this.dispatchEvent(\n new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_),\n );\n }\n\n /**\n * Modify the drawing.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @private\n */\n modifyDrawing_(coordinate) {\n const map = this.getMap();\n const geometry = this.sketchFeature_.getGeometry();\n const projection = map.getView().getProjection();\n const stride = getStrideForLayout(this.geometryLayout_);\n let coordinates, last;\n while (coordinate.length < stride) {\n coordinate.push(0);\n }\n if (this.mode_ === 'Point') {\n last = this.sketchCoords_;\n } else if (this.mode_ === 'Polygon') {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n last = coordinates[coordinates.length - 1];\n if (this.atFinish_(map.getPixelFromCoordinate(coordinate))) {\n // snap to finish\n coordinate = this.finishCoordinate_.slice();\n }\n } else {\n coordinates = this.sketchCoords_;\n last = coordinates[coordinates.length - 1];\n }\n last[0] = coordinate[0];\n last[1] = coordinate[1];\n this.geometryFunction_(\n /** @type {!LineCoordType} */ (this.sketchCoords_),\n geometry,\n projection,\n );\n if (this.sketchPoint_) {\n const sketchPointGeom = this.sketchPoint_.getGeometry();\n sketchPointGeom.setCoordinates(coordinate);\n }\n if (geometry.getType() === 'Polygon' && this.mode_ !== 'Polygon') {\n this.createOrUpdateCustomSketchLine_(/** @type {Polygon} */ (geometry));\n } else if (this.sketchLineCoords_) {\n const sketchLineGeom = this.sketchLine_.getGeometry();\n sketchLineGeom.setCoordinates(this.sketchLineCoords_);\n }\n this.updateSketchFeatures_();\n }\n\n /**\n * Add a new coordinate to the drawing.\n * @param {!PointCoordType} coordinate Coordinate\n * @return {Feature<import(\"../geom/SimpleGeometry.js\").default>} The sketch feature.\n * @private\n */\n addToDrawing_(coordinate) {\n const geometry = this.sketchFeature_.getGeometry();\n const projection = this.getMap().getView().getProjection();\n let done;\n let coordinates;\n const mode = this.mode_;\n if (mode === 'LineString' || mode === 'Circle') {\n this.finishCoordinate_ = coordinate.slice();\n coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);\n if (coordinates.length >= this.maxPoints_) {\n if (this.freehand_) {\n coordinates.pop();\n } else {\n done = true;\n }\n }\n coordinates.push(coordinate.slice());\n this.geometryFunction_(coordinates, geometry, projection);\n } else if (mode === 'Polygon') {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n if (coordinates.length >= this.maxPoints_) {\n if (this.freehand_) {\n coordinates.pop();\n } else {\n done = true;\n }\n }\n coordinates.push(coordinate.slice());\n if (done) {\n this.finishCoordinate_ = coordinates[0];\n }\n this.geometryFunction_(this.sketchCoords_, geometry, projection);\n }\n this.createOrUpdateSketchPoint_(coordinate.slice());\n this.updateSketchFeatures_();\n if (done) {\n return this.finishDrawing();\n }\n return this.sketchFeature_;\n }\n\n /**\n * @param {number} n The number of points to remove.\n */\n removeLastPoints_(n) {\n if (!this.sketchFeature_) {\n return;\n }\n const geometry = this.sketchFeature_.getGeometry();\n const projection = this.getMap().getView().getProjection();\n const mode = this.mode_;\n for (let i = 0; i < n; ++i) {\n let coordinates;\n if (mode === 'LineString' || mode === 'Circle') {\n coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);\n coordinates.splice(-2, 1);\n if (coordinates.length >= 2) {\n this.finishCoordinate_ = coordinates[coordinates.length - 2].slice();\n const finishCoordinate = this.finishCoordinate_.slice();\n coordinates[coordinates.length - 1] = finishCoordinate;\n this.createOrUpdateSketchPoint_(finishCoordinate);\n }\n this.geometryFunction_(coordinates, geometry, projection);\n if (geometry.getType() === 'Polygon' && this.sketchLine_) {\n this.createOrUpdateCustomSketchLine_(\n /** @type {Polygon} */ (geometry),\n );\n }\n } else if (mode === 'Polygon') {\n coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];\n coordinates.splice(-2, 1);\n const sketchLineGeom = this.sketchLine_.getGeometry();\n if (coordinates.length >= 2) {\n const finishCoordinate = coordinates[coordinates.length - 2].slice();\n coordinates[coordinates.length - 1] = finishCoordinate;\n this.createOrUpdateSketchPoint_(finishCoordinate);\n }\n sketchLineGeom.setCoordinates(coordinates);\n this.geometryFunction_(this.sketchCoords_, geometry, projection);\n }\n\n if (coordinates.length === 1) {\n this.abortDrawing();\n break;\n }\n }\n\n this.updateSketchFeatures_();\n }\n\n /**\n * Remove last point of the feature currently being drawn. Does not do anything when\n * drawing POINT or MULTI_POINT geometries.\n * @api\n */\n removeLastPoint() {\n this.removeLastPoints_(1);\n }\n\n /**\n * Stop drawing and add the sketch feature to the target layer.\n * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is\n * dispatched before inserting the feature.\n * @return {Feature<import(\"../geom/SimpleGeometry.js\").default>|null} The drawn feature.\n * @api\n */\n finishDrawing() {\n const sketchFeature = this.abortDrawing_();\n if (!sketchFeature) {\n return null;\n }\n let coordinates = this.sketchCoords_;\n const geometry = sketchFeature.getGeometry();\n const projection = this.getMap().getView().getProjection();\n if (this.mode_ === 'LineString') {\n // remove the redundant last point\n coordinates.pop();\n this.geometryFunction_(coordinates, geometry, projection);\n } else if (this.mode_ === 'Polygon') {\n // remove the redundant last point in ring\n /** @type {PolyCoordType} */ (coordinates)[0].pop();\n this.geometryFunction_(coordinates, geometry, projection);\n coordinates = geometry.getCoordinates();\n }\n\n // cast multi-part geometries\n if (this.type_ === 'MultiPoint') {\n sketchFeature.setGeometry(\n new MultiPoint([/** @type {PointCoordType} */ (coordinates)]),\n );\n } else if (this.type_ === 'MultiLineString') {\n sketchFeature.setGeometry(\n new MultiLineString([/** @type {LineCoordType} */ (coordinates)]),\n );\n } else if (this.type_ === 'MultiPolygon') {\n sketchFeature.setGeometry(\n new MultiPolygon([/** @type {PolyCoordType} */ (coordinates)]),\n );\n }\n\n // First dispatch event to allow full set up of feature\n this.dispatchEvent(new DrawEvent(DrawEventType.DRAWEND, sketchFeature));\n\n // Then insert feature\n if (this.features_) {\n this.features_.push(sketchFeature);\n }\n if (this.source_) {\n this.source_.addFeature(sketchFeature);\n }\n return sketchFeature;\n }\n\n /**\n * Stop drawing without adding the sketch feature to the target layer.\n * @return {Feature<import(\"../geom/SimpleGeometry.js\").default>|null} The sketch feature (or null if none).\n * @private\n */\n abortDrawing_() {\n this.finishCoordinate_ = null;\n const sketchFeature = this.sketchFeature_;\n this.sketchFeature_ = null;\n this.sketchPoint_ = null;\n this.sketchLine_ = null;\n this.overlay_.getSource().clear(true);\n this.deactivateTrace_();\n return sketchFeature;\n }\n\n /**\n * Stop drawing without adding the sketch feature to the target layer.\n * @api\n */\n abortDrawing() {\n const sketchFeature = this.abortDrawing_();\n if (sketchFeature) {\n this.dispatchEvent(new DrawEvent(DrawEventType.DRAWABORT, sketchFeature));\n }\n }\n\n /**\n * Append coordinates to the end of the geometry that is currently being drawn.\n * This can be used when drawing LineStrings or Polygons. Coordinates will\n * either be appended to the current LineString or the outer ring of the current\n * Polygon. If no geometry is being drawn, a new one will be created.\n * @param {!LineCoordType} coordinates Linear coordinates to be appended to\n * the coordinate array.\n * @api\n */\n appendCoordinates(coordinates) {\n const mode = this.mode_;\n const newDrawing = !this.sketchFeature_;\n if (newDrawing) {\n this.startDrawing_(coordinates[0]);\n }\n /** @type {LineCoordType} */\n let sketchCoords;\n if (mode === 'LineString' || mode === 'Circle') {\n sketchCoords = /** @type {LineCoordType} */ (this.sketchCoords_);\n } else if (mode === 'Polygon') {\n sketchCoords =\n this.sketchCoords_ && this.sketchCoords_.length\n ? /** @type {PolyCoordType} */ (this.sketchCoords_)[0]\n : [];\n } else {\n return;\n }\n\n if (newDrawing) {\n sketchCoords.shift();\n }\n\n // Remove last coordinate from sketch drawing (this coordinate follows cursor position)\n sketchCoords.pop();\n\n // Append coordinate list\n for (let i = 0; i < coordinates.length; i++) {\n this.addToDrawing_(coordinates[i]);\n }\n\n const ending = coordinates[coordinates.length - 1];\n // Duplicate last coordinate for sketch drawing (cursor position)\n this.sketchFeature_ = this.addToDrawing_(ending);\n this.modifyDrawing_(ending);\n }\n\n /**\n * Initiate draw mode by starting from an existing geometry which will\n * receive new additional points. This only works on features with\n * `LineString` geometries, where the interaction will extend lines by adding\n * points to the end of the coordinates array.\n * This will change the original feature, instead of drawing a copy.\n *\n * The function will dispatch a `drawstart` event.\n *\n * @param {!Feature<LineString>} feature Feature to be extended.\n * @api\n */\n extend(feature) {\n const geometry = feature.getGeometry();\n const lineString = geometry;\n this.sketchFeature_ = feature;\n this.sketchCoords_ = lineString.getCoordinates();\n const last = this.sketchCoords_[this.sketchCoords_.length - 1];\n this.finishCoordinate_ = last.slice();\n this.sketchCoords_.push(last.slice());\n this.sketchPoint_ = new Feature(new Point(last));\n this.updateSketchFeatures_();\n this.dispatchEvent(\n new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_),\n );\n }\n\n /**\n * Redraw the sketch features.\n * @private\n */\n updateSketchFeatures_() {\n const sketchFeatures = [];\n if (this.sketchFeature_) {\n sketchFeatures.push(this.sketchFeature_);\n }\n if (this.sketchLine_) {\n sketchFeatures.push(this.sketchLine_);\n }\n if (this.sketchPoint_) {\n sketchFeatures.push(this.sketchPoint_);\n }\n const overlaySource = this.overlay_.getSource();\n overlaySource.clear(true);\n overlaySource.addFeatures(sketchFeatures);\n }\n\n /**\n * @private\n */\n updateState_() {\n const map = this.getMap();\n const active = this.getActive();\n if (!map || !active) {\n this.abortDrawing();\n }\n this.overlay_.setMap(active ? map : null);\n }\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const styles = createEditingStyle();\n return function (feature, resolution) {\n return styles[feature.getGeometry().getType()];\n };\n}\n\n/**\n * Create a `geometryFunction` for `type: 'Circle'` that will create a regular\n * polygon with a user specified number of sides and start angle instead of a\n * {@link import(\"../geom/Circle.js\").Circle} geometry.\n * @param {number} [sides] Number of sides of the regular polygon.\n * Default is 32.\n * @param {number} [angle] Angle of the first point in counter-clockwise\n * radians. 0 means East.\n * Default is the angle defined by the heading from the center of the\n * regular polygon to the current pointer position.\n * @return {GeometryFunction} Function that draws a polygon.\n * @api\n */\nexport function createRegularPolygon(sides, angle) {\n return function (coordinates, geometry, projection) {\n const center = fromUserCoordinate(\n /** @type {LineCoordType} */ (coordinates)[0],\n projection,\n );\n const end = fromUserCoordinate(\n /** @type {LineCoordType} */ (coordinates)[coordinates.length - 1],\n projection,\n );\n const radius = Math.sqrt(squaredCoordinateDistance(center, end));\n geometry = geometry || fromCircle(new Circle(center), sides);\n\n let internalAngle = angle;\n if (!angle && angle !== 0) {\n const x = end[0] - center[0];\n const y = end[1] - center[1];\n internalAngle = Math.atan2(y, x);\n }\n makeRegular(\n /** @type {Polygon} */ (geometry),\n center,\n radius,\n internalAngle,\n );\n\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry.transform(projection, userProjection);\n }\n return geometry;\n };\n}\n\n/**\n * Create a `geometryFunction` that will create a box-shaped polygon (aligned\n * with the coordinate system axes). Use this with the draw interaction and\n * `type: 'Circle'` to return a box instead of a circle geometry.\n * @return {GeometryFunction} Function that draws a box-shaped polygon.\n * @api\n */\nexport function createBox() {\n return function (coordinates, geometry, projection) {\n const extent = boundingExtent(\n /** @type {LineCoordType} */ ([\n coordinates[0],\n coordinates[coordinates.length - 1],\n ]).map(function (coordinate) {\n return fromUserCoordinate(coordinate, projection);\n }),\n );\n const boxCoordinates = [\n [\n getBottomLeft(extent),\n getBottomRight(extent),\n getTopRight(extent),\n getTopLeft(extent),\n getBottomLeft(extent),\n ],\n ];\n if (geometry) {\n geometry.setCoordinates(boxCoordinates);\n } else {\n geometry = new Polygon(boxCoordinates);\n }\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry.transform(projection, userProjection);\n }\n return geometry;\n };\n}\n\n/**\n * Get the drawing mode. The mode for multi-part geometries is the same as for\n * their single-part cousins.\n * @param {import(\"../geom/Geometry.js\").Type} type Geometry type.\n * @return {Mode} Drawing mode.\n */\nfunction getMode(type) {\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n return 'Point';\n case 'LineString':\n case 'MultiLineString':\n return 'LineString';\n case 'Polygon':\n case 'MultiPolygon':\n return 'Polygon';\n case 'Circle':\n return 'Circle';\n default:\n throw new Error('Invalid type: ' + type);\n }\n}\n\nexport default Draw;\n","/**\n * @module ol/interaction/Extent\n */\nimport Feature from '../Feature.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {\n closestOnSegment,\n distance as coordinateDistance,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport Event from '../events/Event.js';\nimport {always} from '../events/condition.js';\nimport {boundingExtent, getArea} from '../extent.js';\nimport Point from '../geom/Point.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {toUserExtent} from '../proj.js';\nimport VectorSource from '../source/Vector.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.always}.\n * @property {import(\"../extent.js\").Extent} [extent] Initial extent. Defaults to no\n * initial extent.\n * @property {import(\"../style/Style.js\").StyleLike} [boxStyle]\n * Style for the drawn extent box. Defaults to the `Polygon` editing style\n * documented in {@link module:ol/style/Style~Style}\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the\n * pointer close enough to a segment or vertex for editing.\n * @property {import(\"../style/Style.js\").StyleLike} [pointerStyle]\n * Style for the cursor used to draw the extent. Defaults to the `Point` editing style\n * documented in {@link module:ol/style/Style~Style}\n * @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps\n * in the X direction? Only affects visuals, not functionality.\n */\n\n/**\n * @enum {string}\n */\nconst ExtentEventType = {\n /**\n * Triggered after the extent is changed\n * @event ExtentEvent#extentchanged\n * @api\n */\n EXTENTCHANGED: 'extentchanged',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Extent~Extent} instances are\n * instances of this type.\n */\nexport class ExtentEvent extends Event {\n /**\n * @param {import(\"../extent.js\").Extent} extent the new extent\n */\n constructor(extent) {\n super(ExtentEventType.EXTENTCHANGED);\n\n /**\n * The current extent.\n * @type {import(\"../extent.js\").Extent}\n * @api\n */\n this.extent = extent;\n }\n}\n\n/**\n * @typedef {function (import(\"../coordinate.js\").Coordinate): import(\"../extent.js\").Extent} PointerHandler\n */\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'extentchanged', ExtentEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'extentchanged', Return>} ExtentOnSignature\n */\n\n/**\n * @classdesc\n * Allows the user to draw a vector box by clicking and dragging on the map.\n * Once drawn, the vector box can be modified by dragging its vertices or edges.\n * This interaction is only supported for mouse devices.\n *\n * @fires ExtentEvent\n * @api\n */\nclass Extent extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options || {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /***\n * @type {ExtentOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ExtentOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ExtentOnSignature<void>}\n */\n this.un;\n\n /**\n * Condition\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.condition_ = options.condition ? options.condition : always;\n\n /**\n * Extent of the drawn box\n * @type {import(\"../extent.js\").Extent}\n * @private\n */\n this.extent_ = null;\n\n /**\n * Handler for pointer move events\n * @type {PointerHandler|null}\n * @private\n */\n this.pointerHandler_ = null;\n\n /**\n * Pixel threshold to snap to extent\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * Is the pointer snapped to an extent vertex\n * @type {boolean}\n * @private\n */\n this.snappedToVertex_ = false;\n\n /**\n * Feature for displaying the visible extent\n * @type {Feature}\n * @private\n */\n this.extentFeature_ = null;\n\n /**\n * Feature for displaying the visible pointer\n * @type {Feature<Point>}\n * @private\n */\n this.vertexFeature_ = null;\n\n if (!options) {\n options = {};\n }\n\n /**\n * Layer for the extentFeature\n * @type {VectorLayer}\n * @private\n */\n this.extentOverlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.boxStyle\n ? options.boxStyle\n : getDefaultExtentStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n /**\n * Layer for the vertexFeature\n * @type {VectorLayer}\n * @private\n */\n this.vertexOverlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.pointerStyle\n ? options.pointerStyle\n : getDefaultPointerStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n if (options.extent) {\n this.setExtent(options.extent);\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel cursor location\n * @param {import(\"../Map.js\").default} map map\n * @return {import(\"../coordinate.js\").Coordinate|null} snapped vertex on extent\n * @private\n */\n snapToVertex_(pixel, map) {\n const pixelCoordinate = map.getCoordinateFromPixelInternal(pixel);\n const sortByDistance = function (a, b) {\n return (\n squaredDistanceToSegment(pixelCoordinate, a) -\n squaredDistanceToSegment(pixelCoordinate, b)\n );\n };\n const extent = this.getExtentInternal();\n if (extent) {\n //convert extents to line segments and find the segment closest to pixelCoordinate\n const segments = getSegments(extent);\n segments.sort(sortByDistance);\n const closestSegment = segments[0];\n\n let vertex = closestOnSegment(pixelCoordinate, closestSegment);\n const vertexPixel = map.getPixelFromCoordinateInternal(vertex);\n\n //if the distance is within tolerance, snap to the segment\n if (coordinateDistance(pixel, vertexPixel) <= this.pixelTolerance_) {\n //test if we should further snap to a vertex\n const pixel1 = map.getPixelFromCoordinateInternal(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinateInternal(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n const dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n this.snappedToVertex_ = dist <= this.pixelTolerance_;\n if (this.snappedToVertex_) {\n vertex =\n squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];\n }\n return vertex;\n }\n }\n return null;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent pointer move event\n * @private\n */\n handlePointerMove_(mapBrowserEvent) {\n const pixel = mapBrowserEvent.pixel;\n const map = mapBrowserEvent.map;\n\n let vertex = this.snapToVertex_(pixel, map);\n if (!vertex) {\n vertex = map.getCoordinateFromPixelInternal(pixel);\n }\n this.createOrUpdatePointerFeature_(vertex);\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent extent\n * @return {Feature} extent as featrue\n * @private\n */\n createOrUpdateExtentFeature_(extent) {\n let extentFeature = this.extentFeature_;\n\n if (!extentFeature) {\n if (!extent) {\n extentFeature = new Feature({});\n } else {\n extentFeature = new Feature(polygonFromExtent(extent));\n }\n this.extentFeature_ = extentFeature;\n this.extentOverlay_.getSource().addFeature(extentFeature);\n } else {\n if (!extent) {\n extentFeature.setGeometry(undefined);\n } else {\n extentFeature.setGeometry(polygonFromExtent(extent));\n }\n }\n return extentFeature;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} vertex location of feature\n * @return {Feature} vertex as feature\n * @private\n */\n createOrUpdatePointerFeature_(vertex) {\n let vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n vertexFeature = new Feature(new Point(vertex));\n this.vertexFeature_ = vertexFeature;\n this.vertexOverlay_.getSource().addFeature(vertexFeature);\n } else {\n const geometry = vertexFeature.getGeometry();\n geometry.setCoordinates(vertex);\n }\n return vertexFeature;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent || !this.condition_(mapBrowserEvent)) {\n return true;\n }\n //display pointer (if not dragging)\n if (\n mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&\n !this.handlingDownUpSequence\n ) {\n this.handlePointerMove_(mapBrowserEvent);\n }\n //call pointer to determine up/down/drag\n super.handleEvent(mapBrowserEvent);\n //return false to stop propagation\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n const pixel = mapBrowserEvent.pixel;\n const map = mapBrowserEvent.map;\n\n const extent = this.getExtentInternal();\n let vertex = this.snapToVertex_(pixel, map);\n\n //find the extent corner opposite the passed corner\n const getOpposingPoint = function (point) {\n let x_ = null;\n let y_ = null;\n if (point[0] == extent[0]) {\n x_ = extent[2];\n } else if (point[0] == extent[2]) {\n x_ = extent[0];\n }\n if (point[1] == extent[1]) {\n y_ = extent[3];\n } else if (point[1] == extent[3]) {\n y_ = extent[1];\n }\n if (x_ !== null && y_ !== null) {\n return [x_, y_];\n }\n return null;\n };\n if (vertex && extent) {\n const x =\n vertex[0] == extent[0] || vertex[0] == extent[2] ? vertex[0] : null;\n const y =\n vertex[1] == extent[1] || vertex[1] == extent[3] ? vertex[1] : null;\n\n //snap to point\n if (x !== null && y !== null) {\n this.pointerHandler_ = getPointHandler(getOpposingPoint(vertex));\n //snap to edge\n } else if (x !== null) {\n this.pointerHandler_ = getEdgeHandler(\n getOpposingPoint([x, extent[1]]),\n getOpposingPoint([x, extent[3]]),\n );\n } else if (y !== null) {\n this.pointerHandler_ = getEdgeHandler(\n getOpposingPoint([extent[0], y]),\n getOpposingPoint([extent[2], y]),\n );\n }\n //no snap - new bbox\n } else {\n vertex = map.getCoordinateFromPixelInternal(pixel);\n this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]);\n this.pointerHandler_ = getPointHandler(vertex);\n }\n return true; //event handled; start downup sequence\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n if (this.pointerHandler_) {\n const pixelCoordinate = mapBrowserEvent.coordinate;\n this.setExtent(this.pointerHandler_(pixelCoordinate));\n this.createOrUpdatePointerFeature_(pixelCoordinate);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n this.pointerHandler_ = null;\n //If bbox is zero area, set to null;\n const extent = this.getExtentInternal();\n if (!extent || getArea(extent) === 0) {\n this.setExtent(null);\n }\n return false; //Stop handling downup sequence\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.extentOverlay_.setMap(map);\n this.vertexOverlay_.setMap(map);\n super.setMap(map);\n }\n\n /**\n * Returns the current drawn extent in the view projection (or user projection if set)\n *\n * @return {import(\"../extent.js\").Extent} Drawn extent in the view projection.\n * @api\n */\n getExtent() {\n return toUserExtent(\n this.getExtentInternal(),\n this.getMap().getView().getProjection(),\n );\n }\n\n /**\n * Returns the current drawn extent in the view projection\n *\n * @return {import(\"../extent.js\").Extent} Drawn extent in the view projection.\n * @api\n */\n getExtentInternal() {\n return this.extent_;\n }\n\n /**\n * Manually sets the drawn extent, using the view projection.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent\n * @api\n */\n setExtent(extent) {\n //Null extent means no bbox\n this.extent_ = extent ? extent : null;\n this.createOrUpdateExtentFeature_(extent);\n this.dispatchEvent(new ExtentEvent(this.extent_));\n }\n}\n\n/**\n * Returns the default style for the drawn bbox\n *\n * @return {import(\"../style/Style.js\").StyleFunction} Default Extent style\n */\nfunction getDefaultExtentStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style['Polygon'];\n };\n}\n\n/**\n * Returns the default style for the pointer\n *\n * @return {import(\"../style/Style.js\").StyleFunction} Default pointer style\n */\nfunction getDefaultPointerStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style['Point'];\n };\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} fixedPoint corner that will be unchanged in the new extent\n * @return {function (import(\"../coordinate.js\").Coordinate): import(\"../extent.js\").Extent} event handler\n */\nfunction getPointHandler(fixedPoint) {\n return function (point) {\n return boundingExtent([fixedPoint, point]);\n };\n}\n\n/**\n * @param {import(\"../coordinate.js\").Coordinate} fixedP1 first corner that will be unchanged in the new extent\n * @param {import(\"../coordinate.js\").Coordinate} fixedP2 second corner that will be unchanged in the new extent\n * @return {PointerHandler|null} event handler\n */\nfunction getEdgeHandler(fixedP1, fixedP2) {\n if (fixedP1[0] == fixedP2[0]) {\n return function (point) {\n return boundingExtent([fixedP1, [point[0], fixedP2[1]]]);\n };\n }\n if (fixedP1[1] == fixedP2[1]) {\n return function (point) {\n return boundingExtent([fixedP1, [fixedP2[0], point[1]]]);\n };\n }\n return null;\n}\n\n/**\n * @param {import(\"../extent.js\").Extent} extent extent\n * @return {Array<Array<import(\"../coordinate.js\").Coordinate>>} extent line segments\n */\nfunction getSegments(extent) {\n return [\n [\n [extent[0], extent[1]],\n [extent[0], extent[3]],\n ],\n [\n [extent[0], extent[3]],\n [extent[2], extent[3]],\n ],\n [\n [extent[2], extent[3]],\n [extent[2], extent[1]],\n ],\n [\n [extent[2], extent[1]],\n [extent[0], extent[1]],\n ],\n ];\n}\n\nexport default Extent;\n","/**\n * @module ol/interaction/Link\n */\nimport MapEventType from '../MapEventType.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {toFixed} from '../math.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @param {number} number A number.\n * @return {number} A number with at most 5 decimal places.\n */\nfunction to5(number) {\n return toFixed(number, 5);\n}\n\n/**\n * @param {string} string A string.\n * @return {number} A number representing the string.\n */\nfunction readNumber(string) {\n return parseFloat(string);\n}\n\n/**\n * @param {number} number A number.\n * @return {string} A string representing the number.\n */\nfunction writeNumber(number) {\n return to5(number).toString();\n}\n\n/**\n * @param {number} a A number.\n * @param {number} b A number.\n * @return {boolean} The numbers are different.\n */\nfunction differentNumber(a, b) {\n if (isNaN(a)) {\n return false;\n }\n return a !== readNumber(writeNumber(b));\n}\n\n/**\n * @param {Array<number>} a An array of two numbers.\n * @param {Array<number>} b An array of two numbers.\n * @return {boolean} The arrays are different.\n */\nfunction differentArray(a, b) {\n return differentNumber(a[0], b[0]) || differentNumber(a[1], b[1]);\n}\n\n/** @typedef {'x'|'y'|'z'|'r'|'l'} Params */\n\n/**\n * @typedef {function(string):void} Callback\n */\n\n/**\n * @typedef {Object} Options\n * @property {boolean|import('../View.js').AnimationOptions} [animate=true] Animate view transitions.\n * @property {Array<Params>} [params=['x', 'y', 'z', 'r', 'l']] Properties to track. Default is to track\n * `x` (center x), `y` (center y), `z` (zoom), `r` (rotation) and `l` (layers).\n * @property {boolean} [replace=false] Replace the current URL without creating the new entry in browser history.\n * By default, changes in the map state result in a new entry being added to the browser history.\n * @property {string} [prefix=''] By default, the URL will be updated with search parameters x, y, z, and r. To\n * avoid collisions with existing search parameters that your application uses, you can supply a custom prefix for\n * the ones used by this interaction (e.g. 'ol:').\n */\n\n/**\n * @classdesc\n * An interaction that synchronizes the map state with the URL.\n *\n * @api\n */\nclass Link extends Interaction {\n /**\n * @param {Options} [options] Link options.\n */\n constructor(options) {\n super();\n\n options = Object.assign(\n {\n animate: true,\n params: ['x', 'y', 'z', 'r', 'l'],\n replace: false,\n prefix: '',\n },\n options || {},\n );\n\n let animationOptions;\n if (options.animate === true) {\n animationOptions = {duration: 250};\n } else if (!options.animate) {\n animationOptions = null;\n } else {\n animationOptions = options.animate;\n }\n\n /**\n * @type {import('../View.js').AnimationOptions|null}\n * @private\n */\n this.animationOptions_ = animationOptions;\n\n /**\n * @type {Object<Params, boolean>}\n * @private\n */\n this.params_ = options.params.reduce((acc, value) => {\n acc[value] = true;\n return acc;\n }, {});\n\n /**\n * @private\n * @type {boolean}\n */\n this.replace_ = options.replace;\n\n /**\n * @private\n * @type {string}\n */\n this.prefix_ = options.prefix;\n\n /**\n * @private\n * @type {!Array<import(\"../events.js\").EventsKey>}\n */\n this.listenerKeys_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.initial_ = true;\n\n /**\n * @private\n */\n this.updateState_ = this.updateState_.bind(this);\n\n /**\n * The tracked parameter callbacks.\n * @private\n * @type {Object<string, Callback>}\n */\n this.trackedCallbacks_ = {};\n\n /**\n * The tracked parameter values.\n * @private\n * @type {Object<string, string|null>}\n */\n this.trackedValues_ = {};\n }\n\n /**\n * @private\n * @param {string} name A parameter name.\n * @return {string} A name with the prefix applied.\n */\n getParamName_(name) {\n if (!this.prefix_) {\n return name;\n }\n return this.prefix_ + name;\n }\n\n /**\n * @private\n * @param {URLSearchParams} params The search params.\n * @param {string} name The unprefixed parameter name.\n * @return {string|null} The parameter value.\n */\n get_(params, name) {\n return params.get(this.getParamName_(name));\n }\n\n /**\n * @private\n * @param {URLSearchParams} params The search params.\n * @param {string} name The unprefixed parameter name.\n * @param {string} value The param value.\n */\n set_(params, name, value) {\n if (!(name in this.params_)) {\n return;\n }\n params.set(this.getParamName_(name), value);\n }\n\n /**\n * @private\n * @param {URLSearchParams} params The search params.\n * @param {string} name The unprefixed parameter name.\n */\n delete_(params, name) {\n if (!(name in this.params_)) {\n return;\n }\n params.delete(this.getParamName_(name));\n }\n\n /**\n * @param {import(\"../Map.js\").default|null} map Map.\n * @override\n */\n setMap(map) {\n const oldMap = this.getMap();\n super.setMap(map);\n if (map === oldMap) {\n return;\n }\n if (oldMap) {\n this.unregisterListeners_(oldMap);\n }\n if (map) {\n this.initial_ = true;\n this.updateState_();\n this.registerListeners_(map);\n }\n }\n\n /**\n * @param {import(\"../Map.js\").default} map Map.\n * @private\n */\n registerListeners_(map) {\n this.listenerKeys_.push(\n listen(map, MapEventType.MOVEEND, this.updateUrl_, this),\n listen(map.getLayerGroup(), EventType.CHANGE, this.updateUrl_, this),\n listen(map, 'change:layergroup', this.handleChangeLayerGroup_, this),\n );\n\n if (!this.replace_) {\n addEventListener('popstate', this.updateState_);\n }\n }\n\n /**\n * @param {import(\"../Map.js\").default} map Map.\n * @private\n */\n unregisterListeners_(map) {\n for (let i = 0, ii = this.listenerKeys_.length; i < ii; ++i) {\n unlistenByKey(this.listenerKeys_[i]);\n }\n this.listenerKeys_.length = 0;\n\n if (!this.replace_) {\n removeEventListener('popstate', this.updateState_);\n }\n\n const url = new URL(window.location.href);\n const params = url.searchParams;\n this.delete_(params, 'x');\n this.delete_(params, 'y');\n this.delete_(params, 'z');\n this.delete_(params, 'r');\n this.delete_(params, 'l');\n window.history.replaceState(null, '', url);\n }\n\n /**\n * @private\n */\n handleChangeLayerGroup_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n this.unregisterListeners_(map);\n this.registerListeners_(map);\n this.initial_ = true;\n this.updateUrl_();\n }\n\n /**\n * @private\n */\n updateState_() {\n const url = new URL(window.location.href);\n const params = url.searchParams;\n for (const key in this.trackedCallbacks_) {\n const value = params.get(key);\n if (key in this.trackedCallbacks_ && value !== this.trackedValues_[key]) {\n this.trackedValues_[key] = value;\n this.trackedCallbacks_[key](value);\n }\n }\n\n const map = this.getMap();\n if (!map) {\n return;\n }\n const view = map.getView();\n if (!view) {\n return;\n }\n\n let updateView = false;\n\n /**\n * @type {import('../View.js').AnimationOptions}\n */\n const viewProperties = {};\n\n const zoom = readNumber(this.get_(params, 'z'));\n if ('z' in this.params_ && differentNumber(zoom, view.getZoom())) {\n updateView = true;\n viewProperties.zoom = zoom;\n }\n\n const rotation = readNumber(this.get_(params, 'r'));\n if ('r' in this.params_ && differentNumber(rotation, view.getRotation())) {\n updateView = true;\n viewProperties.rotation = rotation;\n }\n\n const center = [\n readNumber(this.get_(params, 'x')),\n readNumber(this.get_(params, 'y')),\n ];\n if (\n ('x' in this.params_ || 'y' in this.params_) &&\n differentArray(center, view.getCenter())\n ) {\n updateView = true;\n viewProperties.center = center;\n }\n\n if (updateView) {\n if (!this.initial_ && this.animationOptions_) {\n view.animate(Object.assign(viewProperties, this.animationOptions_));\n } else {\n if (viewProperties.center) {\n view.setCenter(viewProperties.center);\n }\n if ('zoom' in viewProperties) {\n view.setZoom(viewProperties.zoom);\n }\n if ('rotation' in viewProperties) {\n view.setRotation(viewProperties.rotation);\n }\n }\n }\n\n const layers = map.getAllLayers();\n const layersParam = this.get_(params, 'l');\n if (\n 'l' in this.params_ &&\n layersParam &&\n layersParam.length === layers.length\n ) {\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n const value = parseInt(layersParam[i]);\n if (!isNaN(value)) {\n const visible = Boolean(value);\n const layer = layers[i];\n if (layer.getVisible() !== visible) {\n layer.setVisible(visible);\n }\n }\n }\n }\n }\n\n /**\n * Register a listener for a URL search parameter. The callback will be called with a new value\n * when the corresponding search parameter changes due to history events (e.g. browser navigation).\n *\n * @param {string} key The URL search parameter.\n * @param {Callback} callback The function to call when the search parameter changes.\n * @return {string|null} The initial value of the search parameter (or null if absent from the URL).\n * @api\n */\n track(key, callback) {\n this.trackedCallbacks_[key] = callback;\n const url = new URL(window.location.href);\n const params = url.searchParams;\n const value = params.get(key);\n this.trackedValues_[key] = value;\n return value;\n }\n\n /**\n * Update the URL with a new search parameter value. If the value is null, it will be\n * deleted from the search parameters.\n *\n * @param {string} key The URL search parameter.\n * @param {string|null} value The updated value (or null to remove it from the URL).\n * @api\n */\n update(key, value) {\n const url = new URL(window.location.href);\n const params = url.searchParams;\n if (value === null) {\n params.delete(key);\n } else {\n params.set(key, value);\n }\n if (key in this.trackedValues_) {\n this.trackedValues_[key] = value;\n }\n this.updateHistory_(url);\n }\n\n /**\n * @private\n */\n updateUrl_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n const view = map.getView();\n if (!view) {\n return;\n }\n\n const center = view.getCenter();\n const zoom = view.getZoom();\n const rotation = view.getRotation();\n\n const layers = map.getAllLayers();\n const visibilities = new Array(layers.length);\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n visibilities[i] = layers[i].getVisible() ? '1' : '0';\n }\n\n const url = new URL(window.location.href);\n const params = url.searchParams;\n\n this.set_(params, 'x', writeNumber(center[0]));\n this.set_(params, 'y', writeNumber(center[1]));\n this.set_(params, 'z', writeNumber(zoom));\n this.set_(params, 'r', writeNumber(rotation));\n this.set_(params, 'l', visibilities.join(''));\n\n this.updateHistory_(url);\n this.initial_ = false;\n }\n\n /**\n * @private\n * @param {URL} url The URL.\n */\n updateHistory_(url) {\n if (url.href !== window.location.href) {\n if (this.initial_ || this.replace_) {\n window.history.replaceState(history.state, '', url);\n } else {\n window.history.pushState(null, '', url);\n }\n }\n }\n}\n\nexport default Link;\n","/**\n * @module ol/interaction/Modify\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport Feature from '../Feature.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {equals} from '../array.js';\nimport {\n closestOnSegment,\n distance as coordinateDistance,\n equals as coordinatesEqual,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {\n altKeyOnly,\n always,\n primaryAction,\n singleClick,\n} from '../events/condition.js';\nimport {\n boundingExtent,\n buffer as bufferExtent,\n createOrUpdateFromCoordinate as createExtent,\n} from '../extent.js';\nimport Point from '../geom/Point.js';\nimport {fromCircle} from '../geom/Polygon.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from '../proj.js';\nimport VectorSource from '../source/Vector.js';\nimport VectorEventType from '../source/VectorEventType.js';\nimport RBush from '../structs/RBush.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {getUid} from '../util.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * The segment index assigned to a circle's center when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CENTER_INDEX = 0;\n\n/**\n * The segment index assigned to a circle's circumference when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CIRCUMFERENCE_INDEX = 1;\n\nconst tempExtent = [0, 0, 0, 0];\nconst tempSegment = [];\n\n/**\n * @enum {string}\n */\nconst ModifyEventType = {\n /**\n * Triggered upon feature modification start\n * @event ModifyEvent#modifystart\n * @api\n */\n MODIFYSTART: 'modifystart',\n /**\n * Triggered upon feature modification end\n * @event ModifyEvent#modifyend\n * @api\n */\n MODIFYEND: 'modifyend',\n};\n\n/**\n * @typedef {Object} SegmentData\n * @property {Array<number>} [depth] Depth.\n * @property {Feature} feature Feature.\n * @property {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @property {number} [index] Index.\n * @property {Array<Array<number>>} segment Segment.\n * @property {Array<SegmentData>} [featureSegments] FeatureSegments.\n */\n\n/**\n * @typedef {[SegmentData, number]} DragSegment\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event will be considered to add or move a\n * vertex to the sketch. Default is\n * {@link module:ol/events/condition.primaryAction}.\n * @property {import(\"../events/condition.js\").Condition} [deleteCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. By default,\n * {@link module:ol/events/condition.singleClick} with\n * {@link module:ol/events/condition.altKeyOnly} results in a vertex deletion.\n * @property {import(\"../events/condition.js\").Condition} [insertVertexCondition] A\n * function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and\n * returns a boolean to indicate whether a new vertex should be added to the sketch\n * features. Default is {@link module:ol/events/condition.always}.\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the\n * pointer close enough to a segment or vertex for editing.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike} [style]\n * Style used for the modification point or vertex. For linestrings and polygons, this will\n * be the affected vertex, for circles a point along the circle, and for points the actual\n * point. If not configured, the default edit style is used (see {@link module:ol/style/Style~Style}).\n * When using a style function, the point feature passed to the function will have an `existing` property -\n * indicating whether there is an existing vertex underneath or not, a `features`\n * property - an array whose entries are the features that are being modified, and a `geometries`\n * property - an array whose entries are the geometries that are being modified. Both arrays are\n * in the same order. The `geometries` are only useful when modifying geometry collections, where\n * the geometry will be the particular geometry from the collection that is being modified.\n * @property {VectorSource} [source] The vector source with\n * features to modify. If a vector source is not provided, a feature collection\n * must be provided with the `features` option.\n * @property {boolean|import(\"../layer/BaseVector\").default} [hitDetection] When configured, point\n * features will be considered for modification based on their visual appearance, instead of being within\n * the `pixelTolerance` from the pointer location. When a {@link module:ol/layer/BaseVector~BaseVectorLayer} is\n * provided, only the rendered representation of the features on that layer will be considered.\n * @property {Collection<Feature>} [features]\n * The features the interaction works on. If a feature collection is not\n * provided, a vector source must be provided with the `source` option.\n * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch\n * overlay.\n * @property {boolean} [snapToPointer=!hitDetection] The vertex, point or segment being modified snaps to the\n * pointer coordinate when clicked within the `pixelTolerance`.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Modify~Modify} instances are\n * instances of this type.\n */\nexport class ModifyEvent extends Event {\n /**\n * @param {ModifyEventType} type Type.\n * @param {Collection<Feature>} features\n * The features modified.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n */\n constructor(type, features, mapBrowserEvent) {\n super(type);\n\n /**\n * The features being modified.\n * @type {Collection<Feature>}\n * @api\n */\n this.features = features;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'modifyend'|'modifystart', ModifyEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'modifyend'|'modifystart', Return>} ModifyOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for modifying feature geometries. To modify features that have\n * been added to an existing source, construct the modify interaction with the\n * `source` option. If you want to modify features in a collection (for example,\n * the collection used by a select interaction), construct the interaction with\n * the `features` option. The interaction must be constructed with either a\n * `source` or `features` option.\n *\n * Cartesian distance from the pointer is used to determine the features that\n * will be modified. This means that geometries will only be considered for\n * modification when they are within the configured `pixelTolerance`. For point\n * geometries, the `hitDetection` option can be used to match their visual\n * appearance.\n *\n * By default, the interaction will allow deletion of vertices when the `alt`\n * key is pressed. To configure the interaction with a different condition\n * for deletion, use the `deleteCondition` option.\n * @fires ModifyEvent\n * @api\n */\nclass Modify extends PointerInteraction {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /***\n * @type {ModifyOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ModifyOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ModifyOnSignature<void>}\n */\n this.un;\n\n /** @private */\n this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : primaryAction;\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultDeleteCondition_ = function (mapBrowserEvent) {\n return altKeyOnly(mapBrowserEvent) && singleClick(mapBrowserEvent);\n };\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.deleteCondition_ = options.deleteCondition\n ? options.deleteCondition\n : this.defaultDeleteCondition_;\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.insertVertexCondition_ = options.insertVertexCondition\n ? options.insertVertexCondition\n : always;\n\n /**\n * Editing vertex.\n * @type {Feature<Point>}\n * @private\n */\n this.vertexFeature_ = null;\n\n /**\n * Segments intersecting {@link this.vertexFeature_} by segment uid.\n * @type {Object<string, boolean>}\n * @private\n */\n this.vertexSegments_ = null;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.lastPixel_ = [0, 0];\n\n /**\n * Tracks if the next `singleclick` event should be ignored to prevent\n * accidental deletion right after vertex creation.\n * @type {boolean}\n * @private\n */\n this.ignoreNextSingleClick_ = false;\n\n /**\n * @type {Collection<Feature>}\n * @private\n */\n this.featuresBeingModified_ = null;\n\n /**\n * Segment RTree for each layer\n * @type {RBush<SegmentData>}\n * @private\n */\n this.rBush_ = new RBush();\n\n /**\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * @type {boolean}\n * @private\n */\n this.snappedToVertex_ = false;\n\n /**\n * Indicate whether the interaction is currently changing a feature's\n * coordinates.\n * @type {boolean}\n * @private\n */\n this.changingFeature_ = false;\n\n /**\n * @type {Array<DragSegment>}\n * @private\n */\n this.dragSegments_ = [];\n\n /**\n * Draw overlay where sketch features are drawn.\n * @type {VectorLayer}\n * @private\n */\n this.overlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.style ? options.style : getDefaultStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n /**\n * @const\n * @private\n * @type {!Object<string, function(Feature, import(\"../geom/Geometry.js\").default): void>}\n */\n this.SEGMENT_WRITERS_ = {\n 'Point': this.writePointGeometry_.bind(this),\n 'LineString': this.writeLineStringGeometry_.bind(this),\n 'LinearRing': this.writeLineStringGeometry_.bind(this),\n 'Polygon': this.writePolygonGeometry_.bind(this),\n 'MultiPoint': this.writeMultiPointGeometry_.bind(this),\n 'MultiLineString': this.writeMultiLineStringGeometry_.bind(this),\n 'MultiPolygon': this.writeMultiPolygonGeometry_.bind(this),\n 'Circle': this.writeCircleGeometry_.bind(this),\n 'GeometryCollection': this.writeGeometryCollectionGeometry_.bind(this),\n };\n\n /**\n * @type {VectorSource}\n * @private\n */\n this.source_ = null;\n\n /**\n * @type {boolean|import(\"../layer/BaseVector\").default}\n * @private\n */\n this.hitDetection_ = null;\n\n /** @type {Collection<Feature>} */\n let features;\n if (options.features) {\n features = options.features;\n } else if (options.source) {\n this.source_ = options.source;\n features = new Collection(this.source_.getFeatures());\n this.source_.addEventListener(\n VectorEventType.ADDFEATURE,\n this.handleSourceAdd_.bind(this),\n );\n this.source_.addEventListener(\n VectorEventType.REMOVEFEATURE,\n this.handleSourceRemove_.bind(this),\n );\n }\n if (!features) {\n throw new Error(\n 'The modify interaction requires features, a source or a layer',\n );\n }\n if (options.hitDetection) {\n this.hitDetection_ = options.hitDetection;\n }\n\n /**\n * @type {Collection<Feature>}\n * @private\n */\n this.features_ = features;\n\n this.features_.forEach(this.addFeature_.bind(this));\n this.features_.addEventListener(\n CollectionEventType.ADD,\n this.handleFeatureAdd_.bind(this),\n );\n this.features_.addEventListener(\n CollectionEventType.REMOVE,\n this.handleFeatureRemove_.bind(this),\n );\n\n /**\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @private\n */\n this.lastPointerEvent_ = null;\n\n /**\n * Delta (x, y in map units) between matched rtree vertex and pointer vertex.\n * @type {Array<number>}\n * @private\n */\n this.delta_ = [0, 0];\n\n /**\n * @private\n */\n this.snapToPointer_ =\n options.snapToPointer === undefined\n ? !this.hitDetection_\n : options.snapToPointer;\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n addFeature_(feature) {\n const geometry = feature.getGeometry();\n if (geometry) {\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n if (writer) {\n writer(feature, geometry);\n }\n }\n const map = this.getMap();\n if (map && map.isRendered() && this.getActive()) {\n this.handlePointerAtPixel_(map.getCoordinateFromPixel(this.lastPixel_));\n }\n feature.addEventListener(EventType.CHANGE, this.boundHandleFeatureChange_);\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Map browser event.\n * @param {Array<SegmentData>} segments The segments subject to modification.\n * @private\n */\n willModifyFeatures_(evt, segments) {\n if (!this.featuresBeingModified_) {\n this.featuresBeingModified_ = new Collection();\n const features = this.featuresBeingModified_.getArray();\n for (let i = 0, ii = segments.length; i < ii; ++i) {\n const feature = segments[i].feature;\n if (feature && !features.includes(feature)) {\n this.featuresBeingModified_.push(feature);\n }\n }\n if (this.featuresBeingModified_.getLength() === 0) {\n this.featuresBeingModified_ = null;\n } else {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYSTART,\n this.featuresBeingModified_,\n evt,\n ),\n );\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeature_(feature) {\n this.removeFeatureSegmentData_(feature);\n // Remove the vertex feature if the collection of candidate features is empty.\n if (this.vertexFeature_ && this.features_.getLength() === 0) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n feature.removeEventListener(\n EventType.CHANGE,\n this.boundHandleFeatureChange_,\n );\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeatureSegmentData_(feature) {\n const rBush = this.rBush_;\n /** @type {Array<SegmentData>} */\n const nodesToRemove = [];\n rBush.forEach(\n /**\n * @param {SegmentData} node RTree node.\n */\n function (node) {\n if (feature === node.feature) {\n nodesToRemove.push(node);\n }\n },\n );\n for (let i = nodesToRemove.length - 1; i >= 0; --i) {\n const nodeToRemove = nodesToRemove[i];\n for (let j = this.dragSegments_.length - 1; j >= 0; --j) {\n if (this.dragSegments_[j][0] === nodeToRemove) {\n this.dragSegments_.splice(j, 1);\n }\n }\n rBush.remove(nodeToRemove);\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (this.vertexFeature_ && !active) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.overlay_.setMap(map);\n super.setMap(map);\n }\n\n /**\n * Get the overlay layer that this interaction renders the modification point or vertex to.\n * @return {VectorLayer} Overlay layer.\n * @api\n */\n getOverlay() {\n return this.overlay_;\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceAdd_(event) {\n if (event.feature) {\n this.features_.push(event.feature);\n }\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceRemove_(event) {\n if (event.feature) {\n this.features_.remove(event.feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<Feature>} evt Event.\n * @private\n */\n handleFeatureAdd_(evt) {\n this.addFeature_(evt.element);\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} evt Event.\n * @private\n */\n handleFeatureChange_(evt) {\n if (!this.changingFeature_) {\n const feature = /** @type {Feature} */ (evt.target);\n this.removeFeature_(feature);\n this.addFeature_(feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<Feature>} evt Event.\n * @private\n */\n handleFeatureRemove_(evt) {\n this.removeFeature_(evt.element);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {Point} geometry Geometry.\n * @private\n */\n writePointGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPointGeometry_(feature, geometry) {\n const points = geometry.getCoordinates();\n for (let i = 0, ii = points.length; i < ii; ++i) {\n const coordinates = points[i];\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [i],\n index: i,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @private\n */\n writeLineStringGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @private\n */\n writeMultiLineStringGeometry_(feature, geometry) {\n const lines = geometry.getCoordinates();\n for (let j = 0, jj = lines.length; j < jj; ++j) {\n const coordinates = lines[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @private\n */\n writePolygonGeometry_(feature, geometry) {\n const rings = geometry.getCoordinates();\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPolygonGeometry_(feature, geometry) {\n const polygons = geometry.getCoordinates();\n for (let k = 0, kk = polygons.length; k < kk; ++k) {\n const rings = polygons[k];\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j, k],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n }\n\n /**\n * We convert a circle into two segments. The segment at index\n * {@link CIRCLE_CENTER_INDEX} is the\n * circle's center (a point). The segment at index\n * {@link CIRCLE_CIRCUMFERENCE_INDEX} is\n * the circumference, and is not a line segment.\n *\n * @param {Feature} feature Feature.\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @private\n */\n writeCircleGeometry_(feature, geometry) {\n const coordinates = geometry.getCenter();\n\n /** @type {SegmentData} */\n const centerSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CENTER_INDEX,\n segment: [coordinates, coordinates],\n };\n\n /** @type {SegmentData} */\n const circumferenceSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CIRCUMFERENCE_INDEX,\n segment: [coordinates, coordinates],\n };\n\n const featureSegments = [centerSegmentData, circumferenceSegmentData];\n centerSegmentData.featureSegments = featureSegments;\n circumferenceSegmentData.featureSegments = featureSegments;\n this.rBush_.insert(createExtent(coordinates), centerSegmentData);\n let circleGeometry = /** @type {import(\"../geom/Geometry.js\").default} */ (\n geometry\n );\n const userProjection = getUserProjection();\n if (userProjection && this.getMap()) {\n const projection = this.getMap().getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(\n /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry),\n ).transform(projection, userProjection);\n }\n this.rBush_.insert(circleGeometry.getExtent(), circumferenceSegmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @private\n */\n writeGeometryCollectionGeometry_(feature, geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0; i < geometries.length; ++i) {\n const geometry = geometries[i];\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n writer(feature, geometry);\n }\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {Array<Feature>} features The features being modified.\n * @param {Array<import(\"../geom/SimpleGeometry.js\").default>} geometries The geometries being modified.\n * @param {boolean} existing The vertex represents an existing vertex.\n * @return {Feature} Vertex feature.\n * @private\n */\n createOrUpdateVertexFeature_(coordinates, features, geometries, existing) {\n let vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n vertexFeature = new Feature(new Point(coordinates));\n this.vertexFeature_ = vertexFeature;\n this.overlay_.getSource().addFeature(vertexFeature);\n } else {\n const geometry = vertexFeature.getGeometry();\n geometry.setCoordinates(coordinates);\n }\n vertexFeature.set('features', features);\n vertexFeature.set('geometries', geometries);\n vertexFeature.set('existing', existing);\n return vertexFeature;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may modify the geometry.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n this.lastPointerEvent_ = mapBrowserEvent;\n\n let handled;\n if (\n !mapBrowserEvent.map.getView().getInteracting() &&\n mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&\n !this.handlingDownUpSequence\n ) {\n this.handlePointerMove_(mapBrowserEvent);\n }\n if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {\n if (\n mapBrowserEvent.type != MapBrowserEventType.SINGLECLICK ||\n !this.ignoreNextSingleClick_\n ) {\n handled = this.removePoint();\n } else {\n handled = true;\n }\n }\n\n if (mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK) {\n this.ignoreNextSingleClick_ = false;\n }\n\n return super.handleEvent(mapBrowserEvent) && !handled;\n }\n\n findInsertVerticesAndUpdateDragSegments_(pixelCoordinate) {\n this.handlePointerAtPixel_(pixelCoordinate);\n this.dragSegments_.length = 0;\n this.featuresBeingModified_ = null;\n const vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n return;\n }\n\n const projection = this.getMap().getView().getProjection();\n const insertVertices = [];\n const vertex = vertexFeature.getGeometry().getCoordinates();\n const vertexExtent = boundingExtent([vertex]);\n const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);\n const componentSegments = {};\n segmentDataMatches.sort(compareIndexes);\n for (let i = 0, ii = segmentDataMatches.length; i < ii; ++i) {\n const segmentDataMatch = segmentDataMatches[i];\n const segment = segmentDataMatch.segment;\n let uid = getUid(segmentDataMatch.geometry);\n const depth = segmentDataMatch.depth;\n if (depth) {\n uid += '-' + depth.join('-'); // separate feature components\n }\n if (!componentSegments[uid]) {\n componentSegments[uid] = new Array(2);\n }\n\n if (\n segmentDataMatch.geometry.getType() === 'Circle' &&\n segmentDataMatch.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n const closestVertex = closestOnSegmentData(\n pixelCoordinate,\n segmentDataMatch,\n projection,\n );\n if (\n coordinatesEqual(closestVertex, vertex) &&\n !componentSegments[uid][0]\n ) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n }\n continue;\n }\n\n if (coordinatesEqual(segment[0], vertex) && !componentSegments[uid][0]) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n continue;\n }\n\n if (coordinatesEqual(segment[1], vertex) && !componentSegments[uid][1]) {\n if (\n componentSegments[uid][0] &&\n componentSegments[uid][0].index === 0\n ) {\n let coordinates = segmentDataMatch.geometry.getCoordinates();\n switch (segmentDataMatch.geometry.getType()) {\n // prevent dragging closed linestrings by the connecting node\n case 'LineString':\n case 'MultiLineString':\n continue;\n // if dragging the first vertex of a polygon, ensure the other segment\n // belongs to the closing vertex of the linear ring\n case 'MultiPolygon':\n coordinates = coordinates[depth[1]];\n /* falls through */\n case 'Polygon':\n if (segmentDataMatch.index !== coordinates[depth[0]].length - 2) {\n continue;\n }\n break;\n default:\n // pass\n }\n }\n\n this.dragSegments_.push([segmentDataMatch, 1]);\n componentSegments[uid][1] = segmentDataMatch;\n continue;\n }\n\n if (\n getUid(segment) in this.vertexSegments_ &&\n !componentSegments[uid][0] &&\n !componentSegments[uid][1]\n ) {\n insertVertices.push(segmentDataMatch);\n }\n }\n\n return insertVertices;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @override\n */\n handleDragEvent(evt) {\n this.ignoreNextSingleClick_ = false;\n this.willModifyFeatures_(\n evt,\n this.dragSegments_.map(([segment]) => segment),\n );\n\n const vertex = [\n evt.coordinate[0] + this.delta_[0],\n evt.coordinate[1] + this.delta_[1],\n ];\n const features = [];\n const geometries = [];\n for (let i = 0, ii = this.dragSegments_.length; i < ii; ++i) {\n const dragSegment = this.dragSegments_[i];\n const segmentData = dragSegment[0];\n const feature = segmentData.feature;\n if (!features.includes(feature)) {\n features.push(feature);\n }\n const geometry = segmentData.geometry;\n if (!geometries.includes(geometry)) {\n geometries.push(geometry);\n }\n const depth = segmentData.depth;\n let coordinates;\n const segment = segmentData.segment;\n const index = dragSegment[1];\n\n while (vertex.length < geometry.getStride()) {\n vertex.push(segment[index][vertex.length]);\n }\n\n switch (geometry.getType()) {\n case 'Point':\n coordinates = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case 'MultiPoint':\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index] = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case 'LineString':\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'MultiLineString':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'Polygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'MultiPolygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'Circle':\n const circle = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n segment[0] = vertex;\n segment[1] = vertex;\n if (segmentData.index === CIRCLE_CENTER_INDEX) {\n this.changingFeature_ = true;\n circle.setCenter(vertex);\n this.changingFeature_ = false;\n } else {\n // We're dragging the circle's circumference:\n this.changingFeature_ = true;\n const projection = evt.map.getView().getProjection();\n let radius = coordinateDistance(\n fromUserCoordinate(circle.getCenter(), projection),\n fromUserCoordinate(vertex, projection),\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n const circleGeometry = circle\n .clone()\n .transform(userProjection, projection);\n circleGeometry.setRadius(radius);\n radius = circleGeometry\n .transform(projection, userProjection)\n .getRadius();\n }\n circle.setRadius(radius);\n this.changingFeature_ = false;\n }\n break;\n default:\n // pass\n }\n\n if (coordinates) {\n this.setGeometryCoordinates_(geometry, coordinates);\n }\n }\n this.createOrUpdateVertexFeature_(vertex, features, geometries, true);\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(evt) {\n if (!this.condition_(evt)) {\n return false;\n }\n const pixelCoordinate = evt.coordinate;\n const insertVertices =\n this.findInsertVerticesAndUpdateDragSegments_(pixelCoordinate);\n\n if (insertVertices?.length && this.insertVertexCondition_(evt)) {\n this.willModifyFeatures_(evt, insertVertices);\n\n if (this.vertexFeature_) {\n const vertex = this.vertexFeature_.getGeometry().getCoordinates();\n for (let j = insertVertices.length - 1; j >= 0; --j) {\n this.insertVertex_(insertVertices[j], vertex);\n }\n this.ignoreNextSingleClick_ = true;\n }\n }\n\n return !!this.vertexFeature_;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(evt) {\n for (let i = this.dragSegments_.length - 1; i >= 0; --i) {\n const segmentData = this.dragSegments_[i][0];\n const geometry = segmentData.geometry;\n if (geometry.getType() === 'Circle') {\n const circle = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n // Update a circle object in the R* bush:\n const coordinates = circle.getCenter();\n const centerSegmentData = segmentData.featureSegments[0];\n const circumferenceSegmentData = segmentData.featureSegments[1];\n centerSegmentData.segment[0] = coordinates;\n centerSegmentData.segment[1] = coordinates;\n circumferenceSegmentData.segment[0] = coordinates;\n circumferenceSegmentData.segment[1] = coordinates;\n this.rBush_.update(createExtent(coordinates), centerSegmentData);\n /** @type {import(\"../geom/Circle.js\").default | import(\"../geom/Polygon.js\").default} */\n let circleGeometry = circle;\n const userProjection = getUserProjection();\n if (userProjection) {\n const projection = evt.map.getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(circleGeometry).transform(\n projection,\n userProjection,\n );\n }\n this.rBush_.update(\n circleGeometry.getExtent(),\n circumferenceSegmentData,\n );\n } else {\n this.rBush_.update(boundingExtent(segmentData.segment), segmentData);\n }\n }\n if (this.featuresBeingModified_) {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYEND,\n this.featuresBeingModified_,\n evt,\n ),\n );\n this.featuresBeingModified_ = null;\n }\n return false;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @private\n */\n handlePointerMove_(evt) {\n this.lastPixel_ = evt.pixel;\n this.handlePointerAtPixel_(evt.coordinate);\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} pixelCoordinate The pixel Coordinate.\n * @private\n */\n handlePointerAtPixel_(pixelCoordinate) {\n const map = this.getMap();\n const pixel = map.getPixelFromCoordinate(pixelCoordinate);\n const projection = map.getView().getProjection();\n const sortByDistance = function (a, b) {\n return (\n projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) -\n projectedDistanceToSegmentDataSquared(pixelCoordinate, b, projection)\n );\n };\n\n /** @type {Array<SegmentData>|undefined} */\n let nodes;\n /** @type {Point|undefined} */\n let hitPointGeometry;\n if (this.hitDetection_) {\n const layerFilter =\n typeof this.hitDetection_ === 'object'\n ? (layer) => layer === this.hitDetection_\n : undefined;\n map.forEachFeatureAtPixel(\n pixel,\n (feature, layer, geometry) => {\n if (geometry && geometry.getType() === 'Point') {\n geometry = new Point(\n toUserCoordinate(geometry.getCoordinates(), projection),\n );\n }\n const geom = geometry || feature.getGeometry();\n\n if (\n geom &&\n geom.getType() === 'Point' &&\n feature instanceof Feature &&\n this.features_.getArray().includes(feature)\n ) {\n hitPointGeometry = /** @type {Point} */ (geom);\n const coordinate = /** @type {Point} */ (feature.getGeometry())\n .getFlatCoordinates()\n .slice(0, 2);\n nodes = [\n {\n feature,\n geometry: hitPointGeometry,\n segment: [coordinate, coordinate],\n },\n ];\n }\n return true;\n },\n {layerFilter},\n );\n }\n if (!nodes) {\n const viewExtent = fromUserExtent(\n createExtent(pixelCoordinate, tempExtent),\n projection,\n );\n const buffer = map.getView().getResolution() * this.pixelTolerance_;\n const box = toUserExtent(\n bufferExtent(viewExtent, buffer, tempExtent),\n projection,\n );\n nodes = this.rBush_.getInExtent(box);\n }\n\n if (nodes && nodes.length > 0) {\n const node = nodes.sort(sortByDistance)[0];\n const closestSegment = node.segment;\n let vertex = closestOnSegmentData(pixelCoordinate, node, projection);\n const vertexPixel = map.getPixelFromCoordinate(vertex);\n let dist = coordinateDistance(pixel, vertexPixel);\n if (hitPointGeometry || dist <= this.pixelTolerance_) {\n /** @type {Object<string, boolean>} */\n const vertexSegments = {};\n vertexSegments[getUid(closestSegment)] = true;\n\n if (!this.snapToPointer_) {\n this.delta_[0] = vertex[0] - pixelCoordinate[0];\n this.delta_[1] = vertex[1] - pixelCoordinate[1];\n }\n if (\n node.geometry.getType() === 'Circle' &&\n node.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n this.snappedToVertex_ = true;\n this.createOrUpdateVertexFeature_(\n vertex,\n [node.feature],\n [node.geometry],\n this.snappedToVertex_,\n );\n } else {\n const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n this.snappedToVertex_ = dist <= this.pixelTolerance_;\n // Stop and cleanup overlay vertex feature if a segment was hit and new vertex creation is not allowed by the insertVertexCondition\n if (\n !this.snappedToVertex_ &&\n !this.insertVertexCondition_(this.lastPointerEvent_)\n ) {\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n return;\n }\n if (this.snappedToVertex_) {\n vertex =\n squaredDist1 > squaredDist2\n ? closestSegment[1]\n : closestSegment[0];\n }\n this.createOrUpdateVertexFeature_(\n vertex,\n [node.feature],\n [node.geometry],\n this.snappedToVertex_,\n );\n const geometries = {};\n geometries[getUid(node.geometry)] = true;\n for (let i = 1, ii = nodes.length; i < ii; ++i) {\n const segment = nodes[i].segment;\n if (\n (coordinatesEqual(closestSegment[0], segment[0]) &&\n coordinatesEqual(closestSegment[1], segment[1])) ||\n (coordinatesEqual(closestSegment[0], segment[1]) &&\n coordinatesEqual(closestSegment[1], segment[0]))\n ) {\n const geometryUid = getUid(nodes[i].geometry);\n if (!(geometryUid in geometries)) {\n geometries[geometryUid] = true;\n vertexSegments[getUid(segment)] = true;\n }\n } else {\n break;\n }\n }\n }\n\n this.vertexSegments_ = vertexSegments;\n return;\n }\n }\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n }\n\n /**\n * @param {SegmentData} segmentData Segment data.\n * @param {import(\"../coordinate.js\").Coordinate} vertex Vertex.\n * @return {boolean} A vertex was inserted.\n * @private\n */\n insertVertex_(segmentData, vertex) {\n const segment = segmentData.segment;\n const feature = segmentData.feature;\n const geometry = segmentData.geometry;\n const depth = segmentData.depth;\n const index = segmentData.index;\n let coordinates;\n\n while (vertex.length < geometry.getStride()) {\n vertex.push(0);\n }\n\n switch (geometry.getType()) {\n case 'MultiLineString':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'Polygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'MultiPolygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'LineString':\n coordinates = geometry.getCoordinates();\n coordinates.splice(index + 1, 0, vertex);\n break;\n default:\n return false;\n }\n\n this.setGeometryCoordinates_(geometry, coordinates);\n const rTree = this.rBush_;\n rTree.remove(segmentData);\n this.updateSegmentIndices_(geometry, index, depth, 1);\n\n /** @type {SegmentData} */\n const newSegmentData = {\n segment: [segment[0], vertex],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index,\n };\n\n rTree.insert(boundingExtent(newSegmentData.segment), newSegmentData);\n this.dragSegments_.push([newSegmentData, 1]);\n\n /** @type {SegmentData} */\n const newSegmentData2 = {\n segment: [vertex, segment[1]],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index + 1,\n };\n\n rTree.insert(boundingExtent(newSegmentData2.segment), newSegmentData2);\n this.dragSegments_.push([newSegmentData2, 0]);\n return true;\n }\n\n updatePointer_(coordinate) {\n if (coordinate) {\n this.findInsertVerticesAndUpdateDragSegments_(coordinate);\n }\n return this.vertexFeature_?.getGeometry().getCoordinates();\n }\n\n /**\n * Get the current pointer position.\n * @return {import(\"../coordinate.js\").Coordinate | null} The current pointer coordinate.\n */\n getPoint() {\n const coordinate = this.vertexFeature_?.getGeometry().getCoordinates();\n if (!coordinate) {\n return null;\n }\n return toUserCoordinate(\n coordinate,\n this.getMap().getView().getProjection(),\n );\n }\n\n /**\n * Check if a point can be removed from the current linestring or polygon at the current\n * pointer position.\n * @return {boolean} A point can be deleted at the current pointer position.\n * @api\n */\n canRemovePoint() {\n if (!this.vertexFeature_) {\n return false;\n }\n if (\n this.vertexFeature_\n .get('geometries')\n .every(\n (geometry) =>\n geometry.getType() === 'Circle' ||\n geometry.getType().endsWith('Point'),\n )\n ) {\n return false;\n }\n const coordinate = this.vertexFeature_.getGeometry().getCoordinates();\n const segments = this.rBush_.getInExtent(boundingExtent([coordinate]));\n return segments.some(\n ({segment}) =>\n coordinatesEqual(segment[0], coordinate) ||\n coordinatesEqual(segment[1], coordinate),\n );\n }\n\n /**\n * Removes the vertex currently being pointed from the current linestring or polygon.\n * @param {import('../coordinate.js').Coordinate} [coordinate] If provided, the pointer\n * will be set to the provided coordinate. If not, the current pointer coordinate will be used.\n * @return {boolean} True when a vertex was removed.\n * @api\n */\n removePoint(coordinate) {\n if (coordinate) {\n coordinate = fromUserCoordinate(\n coordinate,\n this.getMap().getView().getProjection(),\n );\n this.updatePointer_(coordinate);\n }\n if (\n !this.lastPointerEvent_ ||\n (this.lastPointerEvent_ &&\n this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG)\n ) {\n const evt = this.lastPointerEvent_;\n this.willModifyFeatures_(\n evt,\n this.dragSegments_.map(([segment]) => segment),\n );\n const removed = this.removeVertex_();\n if (this.featuresBeingModified_) {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYEND,\n this.featuresBeingModified_,\n evt,\n ),\n );\n }\n\n this.featuresBeingModified_ = null;\n return removed;\n }\n return false;\n }\n\n /**\n * Removes a vertex from all matching features.\n * @return {boolean} True when a vertex was removed.\n * @private\n */\n removeVertex_() {\n const dragSegments = this.dragSegments_;\n const segmentsByFeature = {};\n let deleted = false;\n let component, coordinates, dragSegment, geometry, i, index, left;\n let newIndex, right, segmentData, uid;\n for (i = dragSegments.length - 1; i >= 0; --i) {\n dragSegment = dragSegments[i];\n segmentData = dragSegment[0];\n uid = getUid(segmentData.feature);\n if (segmentData.depth) {\n // separate feature components\n uid += '-' + segmentData.depth.join('-');\n }\n if (!(uid in segmentsByFeature)) {\n segmentsByFeature[uid] = {};\n }\n if (dragSegment[1] === 0) {\n segmentsByFeature[uid].right = segmentData;\n segmentsByFeature[uid].index = segmentData.index;\n } else if (dragSegment[1] == 1) {\n segmentsByFeature[uid].left = segmentData;\n segmentsByFeature[uid].index = segmentData.index + 1;\n }\n }\n for (uid in segmentsByFeature) {\n right = segmentsByFeature[uid].right;\n left = segmentsByFeature[uid].left;\n index = segmentsByFeature[uid].index;\n newIndex = index - 1;\n if (left !== undefined) {\n segmentData = left;\n } else {\n segmentData = right;\n }\n if (newIndex < 0) {\n newIndex = 0;\n }\n geometry = segmentData.geometry;\n coordinates = geometry.getCoordinates();\n component = coordinates;\n deleted = false;\n switch (geometry.getType()) {\n case 'MultiLineString':\n if (coordinates[segmentData.depth[0]].length > 2) {\n coordinates[segmentData.depth[0]].splice(index, 1);\n deleted = true;\n }\n break;\n case 'LineString':\n if (coordinates.length > 2) {\n coordinates.splice(index, 1);\n deleted = true;\n }\n break;\n case 'MultiPolygon':\n component = component[segmentData.depth[1]];\n /* falls through */\n case 'Polygon':\n component = component[segmentData.depth[0]];\n if (component.length > 4) {\n if (index == component.length - 1) {\n index = 0;\n }\n component.splice(index, 1);\n deleted = true;\n if (index === 0) {\n // close the ring again\n component.pop();\n component.push(component[0]);\n newIndex = component.length - 1;\n }\n }\n break;\n default:\n // pass\n }\n\n if (deleted) {\n this.setGeometryCoordinates_(geometry, coordinates);\n const segments = [];\n if (left !== undefined) {\n this.rBush_.remove(left);\n segments.push(left.segment[0]);\n }\n if (right !== undefined) {\n this.rBush_.remove(right);\n segments.push(right.segment[1]);\n }\n if (left !== undefined && right !== undefined) {\n /** @type {SegmentData} */\n const newSegmentData = {\n depth: segmentData.depth,\n feature: segmentData.feature,\n geometry: segmentData.geometry,\n index: newIndex,\n segment: segments,\n };\n\n this.rBush_.insert(\n boundingExtent(newSegmentData.segment),\n newSegmentData,\n );\n }\n this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n dragSegments.length = 0;\n }\n }\n return deleted;\n }\n\n /**\n * Check if a point can be inserted to the current linestring or polygon at the current\n * pointer position.\n * @return {boolean} A point can be inserted at the current pointer position.\n * @api\n */\n canInsertPoint() {\n if (!this.vertexFeature_) {\n return false;\n }\n if (\n this.vertexFeature_\n .get('geometries')\n .every(\n (geometry) =>\n geometry.getType() === 'Circle' ||\n geometry.getType().endsWith('Point'),\n )\n ) {\n return false;\n }\n const coordinate = this.vertexFeature_.getGeometry().getCoordinates();\n const segments = this.rBush_.getInExtent(boundingExtent([coordinate]));\n return segments.some(\n ({segment}) =>\n !(\n coordinatesEqual(segment[0], coordinate) ||\n coordinatesEqual(segment[1], coordinate)\n ),\n );\n }\n\n /**\n * Inserts the vertex currently being pointed to the current linestring or polygon.\n * @param {import('../coordinate.js').Coordinate} [coordinate] If provided, the pointer\n * will be set to the provided coordinate. If not, the current pointer coordinate will be used.\n * @return {boolean} A vertex was inserted.\n * @api\n */\n insertPoint(coordinate) {\n const pixelCoordinate = coordinate\n ? fromUserCoordinate(coordinate, this.getMap().getView().getProjection())\n : this.vertexFeature_?.getGeometry().getCoordinates();\n if (!pixelCoordinate) {\n return false;\n }\n const insertVertices =\n this.findInsertVerticesAndUpdateDragSegments_(pixelCoordinate);\n return insertVertices.reduce(\n (prev, segmentData) =>\n prev || this.insertVertex_(segmentData, pixelCoordinate),\n false,\n );\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {Array} coordinates Coordinates.\n * @private\n */\n setGeometryCoordinates_(geometry, coordinates) {\n this.changingFeature_ = true;\n geometry.setCoordinates(coordinates);\n this.changingFeature_ = false;\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {number} index Index.\n * @param {Array<number>|undefined} depth Depth.\n * @param {number} delta Delta (1 or -1).\n * @private\n */\n updateSegmentIndices_(geometry, index, depth, delta) {\n this.rBush_.forEachInExtent(\n geometry.getExtent(),\n function (segmentDataMatch) {\n if (\n segmentDataMatch.geometry === geometry &&\n (depth === undefined ||\n segmentDataMatch.depth === undefined ||\n equals(segmentDataMatch.depth, depth)) &&\n segmentDataMatch.index > index\n ) {\n segmentDataMatch.index += delta;\n }\n },\n );\n }\n}\n\n/**\n * @param {SegmentData} a The first segment data.\n * @param {SegmentData} b The second segment data.\n * @return {number} The difference in indexes.\n */\nfunction compareIndexes(a, b) {\n return a.index - b.index;\n}\n\n/**\n * Returns the distance from a point to a line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The coordinates of the point from\n * which to calculate the distance.\n * @param {SegmentData} segmentData The object describing the line\n * segment we are calculating the distance to.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {number} The square of the distance between a point and a line segment.\n */\nfunction projectedDistanceToSegmentDataSquared(\n pointCoordinates,\n segmentData,\n projection,\n) {\n const geometry = segmentData.geometry;\n\n if (geometry.getType() === 'Circle') {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n\n if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n const distanceToCenterSquared = squaredCoordinateDistance(\n circleGeometry.getCenter(),\n fromUserCoordinate(pointCoordinates, projection),\n );\n const distanceToCircumference =\n Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius();\n return distanceToCircumference * distanceToCircumference;\n }\n }\n\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return squaredDistanceToSegment(coordinate, tempSegment);\n}\n\n/**\n * Returns the point closest to a given line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The point to which a closest point\n * should be found.\n * @param {SegmentData} segmentData The object describing the line\n * segment which should contain the closest point.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../coordinate.js\").Coordinate} The point closest to the specified line segment.\n */\nfunction closestOnSegmentData(pointCoordinates, segmentData, projection) {\n const geometry = segmentData.geometry;\n\n if (\n geometry.getType() === 'Circle' &&\n segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n return toUserCoordinate(\n circleGeometry.getClosestPoint(\n fromUserCoordinate(pointCoordinates, projection),\n ),\n projection,\n );\n }\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return toUserCoordinate(\n closestOnSegment(coordinate, tempSegment),\n projection,\n );\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style['Point'];\n };\n}\n\nexport default Modify;\n","/**\n * @module ol/interaction/Select\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport Feature from '../Feature.js';\nimport {extend} from '../array.js';\nimport Event from '../events/Event.js';\nimport {never, shiftKeyOnly, singleClick} from '../events/condition.js';\nimport {TRUE} from '../functions.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {clear} from '../obj.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {getUid} from '../util.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @enum {string}\n */\nconst SelectEventType = {\n /**\n * Triggered when feature(s) has been (de)selected.\n * @event SelectEvent#select\n * @api\n */\n SELECT: 'select',\n};\n\n/**\n * A function that takes a {@link module:ol/Feature~Feature} and returns `true` if the feature may be\n * selected or `false` otherwise.\n * @typedef {function(import(\"../Feature.js\").default, import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>):boolean} FilterFunction\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [addCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * By default, this is {@link module:ol/events/condition.never}. Use this if you\n * want to use different events for add and remove instead of `toggle`.\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. This is the event\n * for the selected features as a whole. By default, this is\n * {@link module:ol/events/condition.singleClick}. Clicking on a feature selects that\n * feature and removes any that were in the selection. Clicking outside any\n * feature removes all from the selection.\n * See `toggle`, `add`, `remove` options for adding/removing extra features to/\n * from the selection.\n * @property {Array<import(\"../layer/Layer.js\").default>|function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean} [layers]\n * A list of layers from which features should be selected. Alternatively, a\n * filter function can be provided. The function will be called for each layer\n * in the map and should return `true` for layers that you want to be\n * selectable. If the option is absent, all visible layers will be considered\n * selectable.\n * @property {import(\"../style/Style.js\").StyleLike|null} [style]\n * Style for the selected features. By default the default edit style is used\n * (see {@link module:ol/style/Style~Style}). Set to `null` if this interaction should not apply\n * any style changes for selected features.\n * If set to a falsey value, the selected feature's style will not change.\n * @property {import(\"../events/condition.js\").Condition} [removeCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * By default, this is {@link module:ol/events/condition.never}. Use this if you\n * want to use different events for add and remove instead of `toggle`.\n * @property {import(\"../events/condition.js\").Condition} [toggleCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. This is in addition\n * to the `condition` event. By default,\n * {@link module:ol/events/condition.shiftKeyOnly}, i.e. pressing `shift` as\n * well as the `condition` event, adds that feature to the current selection if\n * it is not currently selected, and removes it if it is. See `add` and `remove`\n * if you want to use different events instead of a toggle.\n * @property {boolean} [multi=false] A boolean that determines if the default\n * behaviour should select only single features or all (overlapping) features at\n * the clicked map position. The default of `false` means single select.\n * @property {Collection<Feature>} [features]\n * Collection where the interaction will place selected features. Optional. If\n * not set the interaction will create a collection. In any case the collection\n * used by the interaction is returned by\n * {@link module:ol/interaction/Select~Select#getFeatures}.\n * @property {FilterFunction} [filter] A function\n * that takes a {@link module:ol/Feature~Feature} and a\n * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be\n * selected or `false` otherwise.\n * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside\n * the radius around the given position will be checked for features.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Select~Select} instances are instances of\n * this type.\n */\nexport class SelectEvent extends Event {\n /**\n * @param {SelectEventType} type The event type.\n * @param {Array<import(\"../Feature.js\").default>} selected Selected features.\n * @param {Array<import(\"../Feature.js\").default>} deselected Deselected features.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Associated\n * {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n */\n constructor(type, selected, deselected, mapBrowserEvent) {\n super(type);\n\n /**\n * Selected features array.\n * @type {Array<import(\"../Feature.js\").default>}\n * @api\n */\n this.selected = selected;\n\n /**\n * Deselected features array.\n * @type {Array<import(\"../Feature.js\").default>}\n * @api\n */\n this.deselected = deselected;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/**\n * Original feature styles to reset to when features are no longer selected.\n * @type {Object<number, import(\"../style/Style.js\").default|Array<import(\"../style/Style.js\").default>|import(\"../style/Style.js\").StyleFunction>}\n */\nconst originalFeatureStyles = {};\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'select', SelectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'select', Return>} SelectOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for selecting vector features. By default, selected features are\n * styled differently, so this interaction can be used for visual highlighting,\n * as well as selecting features for other actions, such as modification or\n * output. There are three ways of controlling which features are selected:\n * using the browser event as defined by the `condition` and optionally the\n * `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a\n * further feature filter using the `filter` option.\n *\n * @fires SelectEvent\n * @api\n */\nclass Select extends Interaction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {SelectOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {SelectOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {SelectOnSignature<void>}\n */\n this.un;\n\n options = options ? options : {};\n\n /**\n * @private\n */\n this.boundAddFeature_ = this.addFeature_.bind(this);\n\n /**\n * @private\n */\n this.boundRemoveFeature_ = this.removeFeature_.bind(this);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : singleClick;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.addCondition_ = options.addCondition ? options.addCondition : never;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.removeCondition_ = options.removeCondition\n ? options.removeCondition\n : never;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.toggleCondition_ = options.toggleCondition\n ? options.toggleCondition\n : shiftKeyOnly;\n\n /**\n * @private\n * @type {boolean}\n */\n this.multi_ = options.multi ? options.multi : false;\n\n /**\n * @private\n * @type {FilterFunction}\n */\n this.filter_ = options.filter ? options.filter : TRUE;\n\n /**\n * @private\n * @type {number}\n */\n this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;\n\n /**\n * @private\n * @type {import(\"../style/Style.js\").default|Array<import(\"../style/Style.js\").default>|import(\"../style/Style.js\").StyleFunction|null}\n */\n this.style_ =\n options.style !== undefined ? options.style : getDefaultStyleFunction();\n\n /**\n * @private\n * @type {Collection<Feature>}\n */\n this.features_ = options.features || new Collection();\n\n /** @type {function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean} */\n let layerFilter;\n if (options.layers) {\n if (typeof options.layers === 'function') {\n layerFilter = options.layers;\n } else {\n const layers = options.layers;\n layerFilter = function (layer) {\n return layers.includes(layer);\n };\n }\n } else {\n layerFilter = TRUE;\n }\n\n /**\n * @private\n * @type {function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean}\n */\n this.layerFilter_ = layerFilter;\n\n /**\n * An association between selected feature (key)\n * and layer (value)\n * @private\n * @type {Object<string, import(\"../layer/Layer.js\").default>}\n */\n this.featureLayerAssociation_ = {};\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @private\n */\n addFeatureLayerAssociation_(feature, layer) {\n this.featureLayerAssociation_[getUid(feature)] = layer;\n }\n\n /**\n * Get the selected features.\n * @return {Collection<Feature>} Features collection.\n * @api\n */\n getFeatures() {\n return this.features_;\n }\n\n /**\n * Returns the Hit-detection tolerance.\n * @return {number} Hit tolerance in pixels.\n * @api\n */\n getHitTolerance() {\n return this.hitTolerance_;\n }\n\n /**\n * Returns the associated {@link module:ol/layer/Vector~VectorLayer vector layer} of\n * a selected feature.\n * @param {import(\"../Feature.js\").default} feature Feature\n * @return {import('../layer/Vector.js').default} Layer.\n * @api\n */\n getLayer(feature) {\n return /** @type {import('../layer/Vector.js').default} */ (\n this.featureLayerAssociation_[getUid(feature)]\n );\n }\n\n /**\n * Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @api\n */\n setHitTolerance(hitTolerance) {\n this.hitTolerance_ = hitTolerance;\n }\n\n /**\n * Remove the interaction from its current map, if any, and attach it to a new\n * map, if any. Pass `null` to just remove the interaction from the current map.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n * @override\n */\n setMap(map) {\n const currentMap = this.getMap();\n if (currentMap && this.style_) {\n this.features_.forEach(this.restorePreviousStyle_.bind(this));\n }\n super.setMap(map);\n if (map) {\n this.features_.addEventListener(\n CollectionEventType.ADD,\n this.boundAddFeature_,\n );\n this.features_.addEventListener(\n CollectionEventType.REMOVE,\n this.boundRemoveFeature_,\n );\n\n if (this.style_) {\n this.features_.forEach(this.applySelectedStyle_.bind(this));\n }\n } else {\n this.features_.removeEventListener(\n CollectionEventType.ADD,\n this.boundAddFeature_,\n );\n this.features_.removeEventListener(\n CollectionEventType.REMOVE,\n this.boundRemoveFeature_,\n );\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<Feature>} evt Event.\n * @private\n */\n addFeature_(evt) {\n const feature = evt.element;\n if (this.style_) {\n this.applySelectedStyle_(feature);\n }\n if (!this.getLayer(feature)) {\n const layer = /** @type {VectorLayer} */ (\n this.getMap()\n .getAllLayers()\n .find(function (layer) {\n if (\n layer instanceof VectorLayer &&\n layer.getSource() &&\n layer.getSource().hasFeature(feature)\n ) {\n return layer;\n }\n })\n );\n if (layer) {\n this.addFeatureLayerAssociation_(feature, layer);\n }\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<Feature>} evt Event.\n * @private\n */\n removeFeature_(evt) {\n if (this.style_) {\n this.restorePreviousStyle_(evt.element);\n }\n }\n\n /**\n * @return {import(\"../style/Style.js\").StyleLike|null} Select style.\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * @param {Feature} feature Feature\n * @private\n */\n applySelectedStyle_(feature) {\n const key = getUid(feature);\n if (!(key in originalFeatureStyles)) {\n originalFeatureStyles[key] = feature.getStyle();\n }\n feature.setStyle(this.style_);\n }\n\n /**\n * @param {Feature} feature Feature\n * @private\n */\n restorePreviousStyle_(feature) {\n const interactions = this.getMap().getInteractions().getArray();\n for (let i = interactions.length - 1; i >= 0; --i) {\n const interaction = interactions[i];\n if (\n interaction !== this &&\n interaction instanceof Select &&\n interaction.getStyle() &&\n interaction.getFeatures().getArray().lastIndexOf(feature) !== -1\n ) {\n feature.setStyle(interaction.getStyle());\n return;\n }\n }\n\n const key = getUid(feature);\n feature.setStyle(originalFeatureStyles[key]);\n delete originalFeatureStyles[key];\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeatureLayerAssociation_(feature) {\n delete this.featureLayerAssociation_[getUid(feature)];\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may change the\n * selected state of features.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!this.condition_(mapBrowserEvent)) {\n return true;\n }\n const add = this.addCondition_(mapBrowserEvent);\n const remove = this.removeCondition_(mapBrowserEvent);\n const toggle = this.toggleCondition_(mapBrowserEvent);\n const set = !add && !remove && !toggle;\n const map = mapBrowserEvent.map;\n const features = this.getFeatures();\n\n /**\n * @type {Array<Feature>}\n */\n const deselected = [];\n\n /**\n * @type {Array<Feature>}\n */\n const selected = [];\n\n if (set) {\n // Replace the currently selected feature(s) with the feature(s) at the\n // pixel, or clear the selected feature(s) if there is no feature at\n // the pixel.\n clear(this.featureLayerAssociation_);\n map.forEachFeatureAtPixel(\n mapBrowserEvent.pixel,\n /**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @return {boolean|undefined} Continue to iterate over the features.\n */\n (feature, layer) => {\n if (!(feature instanceof Feature) || !this.filter_(feature, layer)) {\n return;\n }\n this.addFeatureLayerAssociation_(feature, layer);\n selected.push(feature);\n return !this.multi_;\n },\n {\n layerFilter: this.layerFilter_,\n hitTolerance: this.hitTolerance_,\n },\n );\n for (let i = features.getLength() - 1; i >= 0; --i) {\n const feature = features.item(i);\n const index = selected.indexOf(feature);\n if (index > -1) {\n // feature is already selected\n selected.splice(index, 1);\n } else {\n features.remove(feature);\n deselected.push(feature);\n }\n }\n if (selected.length !== 0) {\n features.extend(selected);\n }\n } else {\n // Modify the currently selected feature(s).\n map.forEachFeatureAtPixel(\n mapBrowserEvent.pixel,\n /**\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @return {boolean|undefined} Continue to iterate over the features.\n */\n (feature, layer) => {\n if (!(feature instanceof Feature) || !this.filter_(feature, layer)) {\n return;\n }\n if ((add || toggle) && !features.getArray().includes(feature)) {\n this.addFeatureLayerAssociation_(feature, layer);\n selected.push(feature);\n } else if (\n (remove || toggle) &&\n features.getArray().includes(feature)\n ) {\n deselected.push(feature);\n this.removeFeatureLayerAssociation_(feature);\n }\n return !this.multi_;\n },\n {\n layerFilter: this.layerFilter_,\n hitTolerance: this.hitTolerance_,\n },\n );\n for (let j = deselected.length - 1; j >= 0; --j) {\n features.remove(deselected[j]);\n }\n features.extend(selected);\n }\n if (selected.length > 0 || deselected.length > 0) {\n this.dispatchEvent(\n new SelectEvent(\n SelectEventType.SELECT,\n selected,\n deselected,\n mapBrowserEvent,\n ),\n );\n }\n return true;\n }\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const styles = createEditingStyle();\n extend(styles['Polygon'], styles['LineString']);\n extend(styles['GeometryCollection'], styles['LineString']);\n\n return function (feature) {\n if (!feature.getGeometry()) {\n return null;\n }\n return styles[feature.getGeometry().getType()];\n };\n}\n\nexport default Select;\n","/**\n * @module ol/events/SnapEvent\n */\nimport Event from './Event.js';\n\n/**\n * @enum {string}\n */\nexport const SnapEventType = {\n /**\n * Triggered upon snapping to vertex or edge\n * @event SnapEvent#snap\n * @api\n */\n SNAP: 'snap',\n UNSNAP: 'unsnap',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Snap~Snap} instances are instances of this\n */\nexport class SnapEvent extends Event {\n /**\n * @param {SnapEventType} type Type.\n * @param {Object} options Options.\n * @param {import(\"../coordinate.js\").Coordinate} options.vertex The snapped vertex.\n * @param {import(\"../coordinate.js\").Coordinate} options.vertexPixel The pixel of the snapped vertex.\n * @param {import(\"../Feature.js\").default} options.feature The feature being snapped.\n * @param {Array<import(\"../coordinate.js\").Coordinate>|null} options.segment Segment, or `null` if snapped to a vertex.\n */\n constructor(type, options) {\n super(type);\n /**\n * The Map coordinate of the snapped point.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.vertex = options.vertex;\n /**\n * The Map pixel of the snapped point.\n * @type {Array<number>&Array<number>}\n * @api\n */\n this.vertexPixel = options.vertexPixel;\n /**\n * The feature closest to the snapped point.\n * @type {import(\"../Feature.js\").default<import(\"../geom/Geometry.js\").default>}\n * @api\n */\n this.feature = options.feature;\n /**\n * The segment closest to the snapped point, if snapped to a segment.\n * @type {Array<import(\"../coordinate.js\").Coordinate>|null}\n * @api\n */\n this.segment = options.segment;\n }\n}\n","/**\n * @module ol/interaction/Snap\n */\nimport CollectionEventType from '../CollectionEventType.js';\nimport {\n closestOnCircle,\n closestOnSegment,\n squaredDistance,\n} from '../coordinate.js';\nimport EventType from '../events/EventType.js';\nimport {SnapEvent, SnapEventType} from '../events/SnapEvent.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {\n boundingExtent,\n buffer,\n createEmpty,\n intersects as intersectsExtent,\n} from '../extent.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {fromCircle} from '../geom/Polygon.js';\nimport {getIntersectionPoint} from '../geom/flat/segments.js';\nimport {\n fromUserCoordinate,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from '../proj.js';\nimport VectorEventType from '../source/VectorEventType.js';\nimport RBush from '../structs/RBush.js';\nimport {getUid} from '../util.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * @typedef {Array<import(\"../coordinate.js\").Coordinate>} Segment\n * An array of two coordinates representing a line segment, or an array of one\n * coordinate representing a point.\n */\n\n/**\n * @typedef {Object} SegmentData\n * @property {import(\"../Feature.js\").default} feature Feature.\n * @property {Segment} segment Segment.\n * @property {boolean} [isIntersection] Is intersection.\n */\n\n/**\n * @template {import(\"../geom/Geometry.js\").default} [GeometryType=import(\"../geom/Geometry.js\").default]\n * @typedef {(geometry: GeometryType, projection?: import(\"../proj/Projection.js\").default) => Array<Segment>} Segmenter\n * A function taking a {@link module:ol/geom/Geometry~Geometry} as argument and returning an array of {@link Segment}s.\n */\n\n/**\n * Each segmenter specified here will override the default segmenter for the\n * corresponding geometry type. To exclude all geometries of a specific geometry type from being snapped to,\n * set the segmenter to `null`.\n * @typedef {Object} Segmenters\n * @property {Segmenter<import(\"../geom/Point.js\").default>|null} [Point] Point segmenter.\n * @property {Segmenter<import(\"../geom/LineString.js\").default>|null} [LineString] LineString segmenter.\n * @property {Segmenter<import(\"../geom/Polygon.js\").default>|null} [Polygon] Polygon segmenter.\n * @property {Segmenter<import(\"../geom/Circle.js\").default>|null} [Circle] Circle segmenter.\n * @property {Segmenter<import(\"../geom/GeometryCollection.js\").default>|null} [GeometryCollection] GeometryCollection segmenter.\n * @property {Segmenter<import(\"../geom/MultiPoint.js\").default>|null} [MultiPoint] MultiPoint segmenter.\n * @property {Segmenter<import(\"../geom/MultiLineString.js\").default>|null} [MultiLineString] MultiLineString segmenter.\n * @property {Segmenter<import(\"../geom/MultiPolygon.js\").default>|null} [MultiPolygon] MultiPolygon segmenter.\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../Collection.js\").default<import(\"../Feature.js\").default>} [features] Snap to these features. Either this option or source should be provided.\n * @property {import(\"../source/Vector.js\").default} [source] Snap to features from this source. Either this option or features should be provided\n * @property {boolean} [edge=true] Snap to edges.\n * @property {boolean} [vertex=true] Snap to vertices.\n * @property {boolean} [intersection=false] Snap to intersections between segments.\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the pointer close enough to a segment or\n * vertex for snapping.\n * @property {Segmenters} [segmenters] Custom segmenters by {@link module:ol/geom/Geometry~Type}. By default, the\n * following segmenters are used:\n * - `Point`: A one-dimensional segment (e.g. `[[10, 20]]`) representing the point.\n * - `LineString`: One two-dimensional segment (e.g. `[[10, 20], [30, 40]]`) for each segment of the linestring.\n * - `Polygon`: One two-dimensional segment for each segment of the exterior ring and the interior rings.\n * - `Circle`: One two-dimensional segment for each segment of a regular polygon with 32 points representing the circle circumference.\n * - `GeometryCollection`: All segments of the contained geometries.\n * - `MultiPoint`: One one-dimensional segment for each point.\n * - `MultiLineString`: One two-dimensional segment for each segment of the linestrings.\n * - `MultiPolygon`: One two-dimensional segment for each segment of the polygons.\n */\n\n/**\n * Information about the last snapped state.\n * @typedef {Object} SnappedInfo\n * @property {import(\"../coordinate.js\").Coordinate|null} vertex - The snapped vertex.\n * @property {import(\"../pixel.js\").Pixel|null} vertexPixel - The pixel of the snapped vertex.\n * @property {import(\"../Feature.js\").default|null} feature - The feature being snapped.\n * @property {Segment|null} segment - Segment, or `null` if snapped to a vertex.\n */\n\n/***\n * @type {Object<string, Segmenter>}\n */\nconst GEOMETRY_SEGMENTERS = {\n /**\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {Array<Segment>} Segments\n */\n Circle(geometry, projection) {\n let circleGeometry = geometry;\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n const polygon = fromCircle(circleGeometry);\n if (userProjection) {\n polygon.transform(projection, userProjection);\n }\n return GEOMETRY_SEGMENTERS.Polygon(polygon);\n },\n\n /**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {Array<Segment>} Segments\n */\n GeometryCollection(geometry, projection) {\n /** @type {Array<Array<Segment>>} */\n const segments = [];\n const geometries = geometry.getGeometriesArray();\n for (let i = 0; i < geometries.length; ++i) {\n const segmenter = GEOMETRY_SEGMENTERS[geometries[i].getType()];\n if (segmenter) {\n segments.push(segmenter(geometries[i], projection));\n }\n }\n return segments.flat();\n },\n\n /**\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n LineString(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n for (let i = 0, ii = coordinates.length - stride; i < ii; i += stride) {\n segments.push([\n coordinates.slice(i, i + 2),\n coordinates.slice(i + stride, i + stride + 2),\n ]);\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n MultiLineString(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n const ends = geometry.getEnds();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n for (let j = offset, jj = end - stride; j < jj; j += stride) {\n segments.push([\n coordinates.slice(j, j + 2),\n coordinates.slice(j + stride, j + stride + 2),\n ]);\n }\n offset = end;\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n MultiPoint(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n for (let i = 0, ii = coordinates.length; i < ii; i += stride) {\n segments.push([coordinates.slice(i, i + 2)]);\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n MultiPolygon(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n const endss = geometry.getEndss();\n let offset = 0;\n for (let i = 0, ii = endss.length; i < ii; ++i) {\n const ends = endss[i];\n for (let j = 0, jj = ends.length; j < jj; ++j) {\n const end = ends[j];\n for (let k = offset, kk = end - stride; k < kk; k += stride) {\n segments.push([\n coordinates.slice(k, k + 2),\n coordinates.slice(k + stride, k + stride + 2),\n ]);\n }\n offset = end;\n }\n }\n return segments;\n },\n\n /**\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n Point(geometry) {\n return [[geometry.getFlatCoordinates().slice(0, 2)]];\n },\n\n /**\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @return {Array<Segment>} Segments\n */\n Polygon(geometry) {\n /** @type {Array<Segment>} */\n const segments = [];\n const coordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n const ends = geometry.getEnds();\n let offset = 0;\n for (let i = 0, ii = ends.length; i < ii; ++i) {\n const end = ends[i];\n for (let j = offset, jj = end - stride; j < jj; j += stride) {\n segments.push([\n coordinates.slice(j, j + 2),\n coordinates.slice(j + stride, j + stride + 2),\n ]);\n }\n offset = end;\n }\n return segments;\n },\n};\n\n/**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} evt Event.\n * @return {import(\"../Feature.js\").default|null} Feature.\n */\nfunction getFeatureFromEvent(evt) {\n if (\n /** @type {import(\"../source/Vector.js\").VectorSourceEvent} */ (evt).feature\n ) {\n return /** @type {import(\"../source/Vector.js\").VectorSourceEvent} */ (evt)\n .feature;\n }\n if (\n /** @type {import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} */ (\n evt\n ).element\n ) {\n return /** @type {import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} */ (\n evt\n ).element;\n }\n return null;\n}\n\nconst tempSegment = [];\n/** @type {Array<import('../extent.js').Extent>} */\nconst tempExtents = [];\n/** @type {Array<SegmentData>} */\nconst tempSegmentData = [];\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'snap'|'unsnap', SnapEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'snap'|'unsnap', Return>} SnapOnSignature\n */\n\n/**\n * @classdesc\n * Handles snapping of vector features while modifying or drawing them. The\n * features can come from a {@link module:ol/source/Vector~VectorSource} or {@link module:ol/Collection~Collection}\n * Any interaction object that allows the user to interact\n * with the features using the mouse can benefit from the snapping, as long\n * as it is added before.\n *\n * The snap interaction modifies map browser event `coordinate` and `pixel`\n * properties to force the snap to occur to any interaction that uses them.\n *\n * Example:\n *\n * import Snap from 'ol/interaction/Snap.js';\n *\n * const snap = new Snap({\n * source: source\n * });\n *\n * map.addInteraction(snap);\n *\n * @fires SnapEvent\n * @api\n */\nclass Snap extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const pointerOptions = /** @type {import(\"./Pointer.js\").Options} */ (\n options\n );\n\n if (!pointerOptions.handleDownEvent) {\n pointerOptions.handleDownEvent = TRUE;\n }\n\n if (!pointerOptions.stopDown) {\n pointerOptions.stopDown = FALSE;\n }\n\n super(pointerOptions);\n\n /***\n * @type {SnapOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {SnapOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {SnapOnSignature<void>}\n */\n this.un;\n\n /**\n * @type {import(\"../source/Vector.js\").default|null}\n * @private\n */\n this.source_ = options.source ? options.source : null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.vertex_ = options.vertex !== undefined ? options.vertex : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.edge_ = options.edge !== undefined ? options.edge : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.intersection_ =\n options.intersection !== undefined ? options.intersection : false;\n\n /**\n * @type {import(\"../Collection.js\").default<import(\"../Feature.js\").default>|null}\n * @private\n */\n this.features_ = options.features ? options.features : null;\n\n /**\n * @type {Array<import(\"../events.js\").EventsKey>}\n * @private\n */\n this.featuresListenerKeys_ = [];\n\n /**\n * @type {Object<string, import(\"../events.js\").EventsKey>}\n * @private\n */\n this.featureChangeListenerKeys_ = {};\n\n /**\n * Extents are preserved so indexed segment can be quickly removed\n * when its feature geometry changes\n * @type {Object<string, import(\"../extent.js\").Extent>}\n * @private\n */\n this.indexedFeaturesExtents_ = {};\n\n /**\n * If a feature geometry changes while a pointer drag|move event occurs, the\n * feature doesn't get updated right away. It will be at the next 'pointerup'\n * event fired.\n * @type {!Object<string, import(\"../Feature.js\").default>}\n * @private\n */\n this.pendingFeatures_ = {};\n\n /**\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * Segment RTree for each layer\n * @type {import(\"../structs/RBush.js\").default<SegmentData>}\n * @private\n */\n this.rBush_ = new RBush();\n\n /**\n * Holds information about the last snapped state.\n * @type {SnappedInfo|null}\n * @private\n */\n this.snapped_ = null;\n\n /**\n * @type {Object<string, Segmenter>}\n * @private\n */\n this.segmenters_ = Object.assign(\n {},\n GEOMETRY_SEGMENTERS,\n options.segmenters,\n );\n }\n\n /**\n * Add a feature to the collection of features that we may snap to.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {boolean} [register] Whether to listen to the feature change or not\n * Defaults to `true`.\n * @api\n */\n addFeature(feature, register) {\n register = register !== undefined ? register : true;\n const feature_uid = getUid(feature);\n const geometry = feature.getGeometry();\n if (geometry) {\n const segmenter = this.segmenters_[geometry.getType()];\n if (segmenter) {\n this.indexedFeaturesExtents_[feature_uid] =\n geometry.getExtent(createEmpty());\n const segments = segmenter(\n geometry,\n this.getMap().getView().getProjection(),\n );\n let segmentCount = segments.length;\n for (let i = 0; i < segmentCount; ++i) {\n const segment = segments[i];\n tempExtents[i] = boundingExtent(segment);\n tempSegmentData[i] = {\n feature: feature,\n segment: segment,\n };\n }\n tempExtents.length = segmentCount;\n tempSegmentData.length = segmentCount;\n\n if (this.intersection_) {\n for (let j = 0, jj = segments.length; j < jj; ++j) {\n const segment = segments[j];\n if (segment.length === 1) {\n continue;\n }\n const extent = tempExtents[j];\n // Calculate intersections with own segments\n for (let k = 0, kk = segments.length; k < kk; ++k) {\n if (j === k || j - 1 === k || j + 1 === k) {\n // Exclude self and neighbours\n continue;\n }\n const otherSegment = segments[k];\n if (!intersectsExtent(extent, tempExtents[k])) {\n continue;\n }\n const intersection = getIntersectionPoint(segment, otherSegment);\n if (!intersection) {\n continue;\n }\n const intersectionSegment = [intersection];\n tempExtents[segmentCount] = boundingExtent(intersectionSegment);\n tempSegmentData[segmentCount++] = {\n feature,\n segment: intersectionSegment,\n isIntersection: true,\n };\n }\n // Calculate intersections with existing segments\n const otherSegments = this.rBush_.getInExtent(tempExtents[j]);\n for (const {segment: otherSegment} of otherSegments) {\n if (otherSegment.length === 1) {\n continue;\n }\n const intersection = getIntersectionPoint(segment, otherSegment);\n if (!intersection) {\n continue;\n }\n const intersectionSegment = [intersection];\n tempExtents[segmentCount] = boundingExtent(intersectionSegment);\n tempSegmentData[segmentCount++] = {\n feature,\n segment: intersectionSegment,\n isIntersection: true,\n };\n }\n }\n }\n\n if (segmentCount === 1) {\n this.rBush_.insert(tempExtents[0], tempSegmentData[0]);\n } else {\n this.rBush_.load(tempExtents, tempSegmentData);\n }\n }\n }\n\n if (register) {\n this.featureChangeListenerKeys_[feature_uid] = listen(\n feature,\n EventType.CHANGE,\n this.handleFeatureChange_,\n this,\n );\n }\n }\n\n /**\n * @return {import(\"../Collection.js\").default<import(\"../Feature.js\").default>|Array<import(\"../Feature.js\").default>} Features.\n * @private\n */\n getFeatures_() {\n /** @type {import(\"../Collection.js\").default<import(\"../Feature.js\").default>|Array<import(\"../Feature.js\").default>} */\n let features;\n if (this.features_) {\n features = this.features_;\n } else if (this.source_) {\n features = this.source_.getFeatures();\n }\n return features;\n }\n\n /**\n * Checks if two snap data sets are equal.\n * Compares the segment and the feature.\n *\n * @param {SnappedInfo} data1 The first snap data set.\n * @param {SnappedInfo} data2 The second snap data set.\n * @return {boolean} `true` if the data sets are equal, otherwise `false`.\n * @private\n */\n areSnapDataEqual_(data1, data2) {\n return data1.segment === data2.segment && data1.feature === data2.feature;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(evt) {\n const result = this.snapTo(evt.pixel, evt.coordinate, evt.map);\n\n if (result) {\n evt.coordinate = result.vertex.slice(0, 2);\n evt.pixel = result.vertexPixel;\n\n // Dispatch UNSNAP event if already snapped\n if (this.snapped_ && !this.areSnapDataEqual_(this.snapped_, result)) {\n this.dispatchEvent(new SnapEvent(SnapEventType.UNSNAP, this.snapped_));\n }\n\n this.snapped_ = {\n vertex: evt.coordinate,\n vertexPixel: evt.pixel,\n feature: result.feature,\n segment: result.segment,\n };\n this.dispatchEvent(new SnapEvent(SnapEventType.SNAP, this.snapped_));\n } else if (this.snapped_) {\n // Dispatch UNSNAP event if no longer snapped\n this.dispatchEvent(new SnapEvent(SnapEventType.UNSNAP, this.snapped_));\n this.snapped_ = null;\n }\n\n return super.handleEvent(evt);\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} evt Event.\n * @private\n */\n handleFeatureAdd_(evt) {\n const feature = getFeatureFromEvent(evt);\n if (feature) {\n this.addFeature(feature);\n }\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent|import(\"../Collection.js\").CollectionEvent<import(\"../Feature.js\").default>} evt Event.\n * @private\n */\n handleFeatureRemove_(evt) {\n const feature = getFeatureFromEvent(evt);\n if (feature) {\n this.removeFeature(feature);\n }\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} evt Event.\n * @private\n */\n handleFeatureChange_(evt) {\n const feature = /** @type {import(\"../Feature.js\").default} */ (evt.target);\n if (this.handlingDownUpSequence) {\n const uid = getUid(feature);\n if (!(uid in this.pendingFeatures_)) {\n this.pendingFeatures_[uid] = feature;\n }\n } else {\n this.updateFeature_(feature);\n }\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(evt) {\n const featuresToUpdate = Object.values(this.pendingFeatures_);\n if (featuresToUpdate.length) {\n for (const feature of featuresToUpdate) {\n this.updateFeature_(feature);\n }\n }\n return false;\n }\n\n /**\n * Remove a feature from the collection of features that we may snap to.\n * @param {import(\"../Feature.js\").default} feature Feature\n * @param {boolean} [unlisten] Whether to unlisten to the feature change\n * or not. Defaults to `true`.\n * @api\n */\n removeFeature(feature, unlisten) {\n const unregister = unlisten !== undefined ? unlisten : true;\n const feature_uid = getUid(feature);\n const extent = this.indexedFeaturesExtents_[feature_uid];\n if (extent) {\n const rBush = this.rBush_;\n const nodesToRemove = [];\n rBush.forEachInExtent(extent, function (node) {\n if (feature === node.feature) {\n nodesToRemove.push(node);\n }\n });\n for (let i = nodesToRemove.length - 1; i >= 0; --i) {\n rBush.remove(nodesToRemove[i]);\n }\n }\n\n if (unregister) {\n unlistenByKey(this.featureChangeListenerKeys_[feature_uid]);\n delete this.featureChangeListenerKeys_[feature_uid];\n }\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n const currentMap = this.getMap();\n const keys = this.featuresListenerKeys_;\n let features = this.getFeatures_();\n if (!Array.isArray(features)) {\n features = features.getArray();\n }\n\n if (currentMap) {\n keys.forEach(unlistenByKey);\n keys.length = 0;\n this.rBush_.clear();\n Object.values(this.featureChangeListenerKeys_).forEach(unlistenByKey);\n this.featureChangeListenerKeys_ = {};\n }\n super.setMap(map);\n\n if (map) {\n if (this.features_) {\n keys.push(\n listen(\n this.features_,\n CollectionEventType.ADD,\n this.handleFeatureAdd_,\n this,\n ),\n listen(\n this.features_,\n CollectionEventType.REMOVE,\n this.handleFeatureRemove_,\n this,\n ),\n );\n } else if (this.source_) {\n keys.push(\n listen(\n this.source_,\n VectorEventType.ADDFEATURE,\n this.handleFeatureAdd_,\n this,\n ),\n listen(\n this.source_,\n VectorEventType.REMOVEFEATURE,\n this.handleFeatureRemove_,\n this,\n ),\n );\n }\n for (const feature of features) {\n this.addFeature(feature);\n }\n }\n }\n\n /**\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel\n * @param {import(\"../coordinate.js\").Coordinate} pixelCoordinate Coordinate\n * @param {import(\"../Map.js\").default} map Map.\n * @return {SnappedInfo|null} Snap result\n */\n snapTo(pixel, pixelCoordinate, map) {\n const projection = map.getView().getProjection();\n const projectedCoordinate = fromUserCoordinate(pixelCoordinate, projection);\n\n const box = toUserExtent(\n buffer(\n boundingExtent([projectedCoordinate]),\n map.getView().getResolution() * this.pixelTolerance_,\n ),\n projection,\n );\n\n const segments = this.rBush_.getInExtent(box);\n const segmentsLength = segments.length;\n if (segmentsLength === 0) {\n return null;\n }\n\n let closestVertex;\n let minSquaredDistance = Infinity;\n let closestFeature;\n let closestSegment = null;\n let isIntersection;\n\n const squaredPixelTolerance = this.pixelTolerance_ * this.pixelTolerance_;\n const getResult = () => {\n if (closestVertex) {\n const vertexPixel = map.getPixelFromCoordinate(closestVertex);\n const squaredPixelDistance = squaredDistance(pixel, vertexPixel);\n if (\n squaredPixelDistance <= squaredPixelTolerance &&\n ((isIntersection && this.intersection_) ||\n (!isIntersection && (this.vertex_ || this.edge_)))\n ) {\n return {\n vertex: closestVertex,\n vertexPixel: [\n Math.round(vertexPixel[0]),\n Math.round(vertexPixel[1]),\n ],\n feature: closestFeature,\n segment: closestSegment,\n };\n }\n }\n return null;\n };\n\n if (this.vertex_ || this.intersection_) {\n for (let i = 0; i < segmentsLength; ++i) {\n const segmentData = segments[i];\n if (segmentData.feature.getGeometry().getType() !== 'Circle') {\n for (const vertex of segmentData.segment) {\n const tempVertexCoord = fromUserCoordinate(vertex, projection);\n const delta = squaredDistance(projectedCoordinate, tempVertexCoord);\n if (delta < minSquaredDistance) {\n closestVertex = vertex;\n minSquaredDistance = delta;\n closestFeature = segmentData.feature;\n isIntersection = segmentData.isIntersection;\n }\n }\n }\n }\n const result = getResult();\n if (result) {\n return result;\n }\n }\n\n if (this.edge_) {\n for (let i = 0; i < segmentsLength; ++i) {\n let vertex = null;\n const segmentData = segments[i];\n if (segmentData.feature.getGeometry().getType() === 'Circle') {\n let circleGeometry = segmentData.feature.getGeometry();\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n vertex = closestOnCircle(\n projectedCoordinate,\n /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry),\n );\n } else {\n const [segmentStart, segmentEnd] = segmentData.segment;\n // points have only one coordinate\n if (segmentEnd) {\n tempSegment[0] = fromUserCoordinate(segmentStart, projection);\n tempSegment[1] = fromUserCoordinate(segmentEnd, projection);\n vertex = closestOnSegment(projectedCoordinate, tempSegment);\n }\n }\n if (vertex) {\n const delta = squaredDistance(projectedCoordinate, vertex);\n if (delta < minSquaredDistance) {\n closestVertex = toUserCoordinate(vertex, projection);\n closestSegment =\n segmentData.feature.getGeometry().getType() === 'Circle'\n ? null\n : segmentData.segment;\n minSquaredDistance = delta;\n closestFeature = segmentData.feature;\n }\n }\n }\n\n const result = getResult();\n if (result) {\n return result;\n }\n }\n\n return null;\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature\n * @private\n */\n updateFeature_(feature) {\n this.removeFeature(feature, false);\n this.addFeature(feature, false);\n }\n}\n\nexport default Snap;\n","/**\n * @module ol/interaction/Translate\n */\nimport Collection from '../Collection.js';\nimport Feature from '../Feature.js';\nimport Event from '../events/Event.js';\nimport {always} from '../events/condition.js';\nimport {TRUE} from '../functions.js';\nimport {fromUserCoordinate, getUserProjection} from '../proj.js';\nimport PointerInteraction from './Pointer.js';\nimport InteractionProperty from './Property.js';\n\n/**\n * @enum {string}\n */\nconst TranslateEventType = {\n /**\n * Triggered upon feature translation start.\n * @event TranslateEvent#translatestart\n * @api\n */\n TRANSLATESTART: 'translatestart',\n /**\n * Triggered upon feature translation.\n * @event TranslateEvent#translating\n * @api\n */\n TRANSLATING: 'translating',\n /**\n * Triggered upon feature translation end.\n * @event TranslateEvent#translateend\n * @api\n */\n TRANSLATEEND: 'translateend',\n};\n\n/**\n * A function that takes a {@link module:ol/Feature~Feature} or\n * {@link module:ol/render/Feature~RenderFeature} and a\n * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be\n * translated or `false` otherwise.\n * @typedef {function(Feature, import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>):boolean} FilterFunction\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.always}.\n * @property {Collection<Feature>} [features] Features contained in this collection will be able to be translated together.\n * @property {Array<import(\"../layer/Layer.js\").default>|function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean} [layers] A list of layers from which features should be\n * translated. Alternatively, a filter function can be provided. The\n * function will be called for each layer in the map and should return\n * `true` for layers that you want to be translatable. If the option is\n * absent, all visible layers will be considered translatable.\n * Not used if `features` is provided.\n * @property {FilterFunction} [filter] A function\n * that takes a {@link module:ol/Feature~Feature} and an\n * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be\n * translated or `false` otherwise. Not used if `features` is provided.\n * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Translate~Translate} instances\n * are instances of this type.\n */\nexport class TranslateEvent extends Event {\n /**\n * @param {TranslateEventType} type Type.\n * @param {Collection<Feature>} features The features translated.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The event coordinate.\n * @param {import(\"../coordinate.js\").Coordinate} startCoordinate The original coordinates before.translation started\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n */\n constructor(type, features, coordinate, startCoordinate, mapBrowserEvent) {\n super(type);\n\n /**\n * The features being translated.\n * @type {Collection<Feature>}\n * @api\n */\n this.features = features;\n\n /**\n * The coordinate of the drag event.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.coordinate = coordinate;\n\n /**\n * The coordinate of the start position before translation started.\n * @const\n * @type {import(\"../coordinate.js\").Coordinate}\n * @api\n */\n this.startCoordinate = startCoordinate;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'translateend'|'translatestart'|'translating', TranslateEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'translateend'|'translatestart'|'translating', Return>} TranslateOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for translating (moving) features.\n * If you want to translate multiple features in a single action (for example,\n * the collection used by a select interaction), construct the interaction with\n * the `features` option.\n *\n * @fires TranslateEvent\n * @api\n */\nclass Translate extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /***\n * @type {TranslateOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {TranslateOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {TranslateOnSignature<void>}\n */\n this.un;\n\n /**\n * The last position we translated to.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.lastCoordinate_ = null;\n\n /**\n * The start position before translation started.\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.startCoordinate_ = null;\n\n /**\n * @type {Collection<Feature>|null}\n * @private\n */\n this.features_ = options.features !== undefined ? options.features : null;\n\n /** @type {function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean} */\n let layerFilter;\n if (options.layers && !this.features_) {\n if (typeof options.layers === 'function') {\n layerFilter = options.layers;\n } else {\n const layers = options.layers;\n layerFilter = function (layer) {\n return layers.includes(layer);\n };\n }\n } else {\n layerFilter = TRUE;\n }\n\n /**\n * @private\n * @type {function(import(\"../layer/Layer.js\").default<import(\"../source/Source\").default>): boolean}\n */\n this.layerFilter_ = layerFilter;\n\n /**\n * @private\n * @type {FilterFunction}\n */\n this.filter_ = options.filter && !this.features_ ? options.filter : TRUE;\n\n /**\n * @private\n * @type {number}\n */\n this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : always;\n\n /**\n * @type {Feature}\n * @private\n */\n this.lastFeature_ = null;\n\n this.addChangeListener(\n InteractionProperty.ACTIVE,\n this.handleActiveChanged_,\n );\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(event) {\n if (!event.originalEvent || !this.condition_(event)) {\n return false;\n }\n this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);\n if (!this.lastCoordinate_ && this.lastFeature_) {\n this.startCoordinate_ = event.coordinate;\n this.lastCoordinate_ = event.coordinate;\n this.handleMoveEvent(event);\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATESTART,\n features,\n event.coordinate,\n this.startCoordinate_,\n event,\n ),\n );\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(event) {\n if (this.lastCoordinate_) {\n this.lastCoordinate_ = null;\n this.handleMoveEvent(event);\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATEEND,\n features,\n event.coordinate,\n this.startCoordinate_,\n event,\n ),\n );\n // cleanup\n this.startCoordinate_ = null;\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @override\n */\n handleDragEvent(event) {\n if (this.lastCoordinate_) {\n const newCoordinate = event.coordinate;\n const projection = event.map.getView().getProjection();\n\n const newViewCoordinate = fromUserCoordinate(newCoordinate, projection);\n const lastViewCoordinate = fromUserCoordinate(\n this.lastCoordinate_,\n projection,\n );\n const deltaX = newViewCoordinate[0] - lastViewCoordinate[0];\n const deltaY = newViewCoordinate[1] - lastViewCoordinate[1];\n\n const features = this.features_ || new Collection([this.lastFeature_]);\n const userProjection = getUserProjection();\n\n features.forEach(function (feature) {\n const geom = feature.getGeometry();\n if (userProjection) {\n geom.transform(userProjection, projection);\n geom.translate(deltaX, deltaY);\n geom.transform(projection, userProjection);\n } else {\n geom.translate(deltaX, deltaY);\n }\n feature.setGeometry(geom);\n });\n\n this.lastCoordinate_ = newCoordinate;\n\n this.dispatchEvent(\n new TranslateEvent(\n TranslateEventType.TRANSLATING,\n features,\n newCoordinate,\n this.startCoordinate_,\n event,\n ),\n );\n }\n }\n\n /**\n * Handle pointer move events.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @override\n */\n handleMoveEvent(event) {\n const elem = event.map.getViewport();\n\n // Change the cursor to grab/grabbing if hovering any of the features managed\n // by the interaction\n if (this.featuresAtPixel_(event.pixel, event.map)) {\n elem.classList.remove(this.lastCoordinate_ ? 'ol-grab' : 'ol-grabbing');\n elem.classList.add(this.lastCoordinate_ ? 'ol-grabbing' : 'ol-grab');\n } else {\n elem.classList.remove('ol-grab', 'ol-grabbing');\n }\n }\n\n /**\n * Tests to see if the given coordinates intersects any of our selected\n * features.\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel coordinate to test for intersection.\n * @param {import(\"../Map.js\").default} map Map to test the intersection on.\n * @return {Feature} Returns the feature found at the specified pixel\n * coordinates.\n * @private\n */\n featuresAtPixel_(pixel, map) {\n return map.forEachFeatureAtPixel(\n pixel,\n (feature, layer) => {\n if (!(feature instanceof Feature) || !this.filter_(feature, layer)) {\n return undefined;\n }\n if (this.features_ && !this.features_.getArray().includes(feature)) {\n return undefined;\n }\n return feature;\n },\n {\n layerFilter: this.layerFilter_,\n hitTolerance: this.hitTolerance_,\n },\n );\n }\n\n /**\n * Returns the Hit-detection tolerance.\n * @return {number} Hit tolerance in pixels.\n * @api\n */\n getHitTolerance() {\n return this.hitTolerance_;\n }\n\n /**\n * Hit-detection tolerance. Pixels inside the radius around the given position\n * will be checked for features.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @api\n */\n setHitTolerance(hitTolerance) {\n this.hitTolerance_ = hitTolerance;\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n const oldMap = this.getMap();\n super.setMap(map);\n this.updateState_(oldMap);\n }\n\n /**\n * @private\n */\n handleActiveChanged_() {\n this.updateState_(null);\n }\n\n /**\n * @param {import(\"../Map.js\").default} oldMap Old map.\n * @private\n */\n updateState_(oldMap) {\n let map = this.getMap();\n const active = this.getActive();\n if (!map || !active) {\n map = map || oldMap;\n if (map) {\n const elem = map.getViewport();\n elem.classList.remove('ol-grab', 'ol-grabbing');\n }\n }\n }\n}\n\nexport default Translate;\n","/**\n * @module ol/geom/flat/flip\n */\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Array<number>} [dest] Destination.\n * @param {number} [destOffset] Destination offset.\n * @return {Array<number>} Flat coordinates.\n */\nexport function flipXY(flatCoordinates, offset, end, stride, dest, destOffset) {\n if (dest !== undefined) {\n dest = dest;\n destOffset = destOffset !== undefined ? destOffset : 0;\n } else {\n dest = [];\n destOffset = 0;\n }\n let j = offset;\n while (j < end) {\n const x = flatCoordinates[j++];\n dest[destOffset++] = flatCoordinates[j++];\n dest[destOffset++] = x;\n for (let k = 2; k < stride; ++k) {\n dest[destOffset++] = flatCoordinates[j++];\n }\n }\n dest.length = destOffset;\n return dest;\n}\n","/**\n * @module ol/format/Feature\n */\nimport Feature from '../Feature.js';\nimport {\n linearRingsAreOriented,\n linearRingssAreOriented,\n orientLinearRings,\n orientLinearRingsArray,\n} from '../geom/flat/orient.js';\nimport {\n GeometryCollection,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from '../geom.js';\nimport {\n equivalent as equivalentProjection,\n get as getProjection,\n getTransform,\n transformExtent,\n} from '../proj.js';\nimport RenderFeature from '../render/Feature.js';\nimport {abstract} from '../util.js';\n\n/**\n * @typedef {Object} ReadOptions\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection] Projection of the data we are reading.\n * If not provided, the projection will be derived from the data (where possible) or\n * the `dataProjection` of the format is assigned (where set). If the projection\n * can not be derived from the data and if no `dataProjection` is set for a format,\n * the features will not be reprojected.\n * @property {import(\"../extent.js\").Extent} [extent] Tile extent in map units of the tile being read.\n * This is only required when reading data with tile pixels as geometry units. When configured,\n * a `dataProjection` with `TILE_PIXELS` as `units` and the tile's pixel extent as `extent` needs to be\n * provided.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection of the feature geometries\n * created by the format reader. If not provided, features will be returned in the\n * `dataProjection`.\n */\n\n/**\n * @typedef {Object} WriteOptions\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection] Projection of the data we are writing.\n * If not provided, the `dataProjection` of the format is assigned (where set).\n * If no `dataProjection` is set for a format, the features will be returned\n * in the `featureProjection`.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection of the feature geometries\n * that will be serialized by the format writer. If not provided, geometries are assumed\n * to be in the `dataProjection` if that is set; in other words, they are not transformed.\n * @property {boolean} [rightHanded] When writing geometries, follow the right-hand\n * rule for linear ring orientation. This means that polygons will have counter-clockwise\n * exterior rings and clockwise interior rings. By default, coordinates are serialized\n * as they are provided at construction. If `true`, the right-hand rule will\n * be applied. If `false`, the left-hand rule will be applied (clockwise for\n * exterior and counter-clockwise for interior rings). Note that not all\n * formats support this. The GeoJSON format does use this property when writing\n * geometries.\n * @property {number} [decimals] Maximum number of decimal places for coordinates.\n * Coordinates are stored internally as floats, but floating-point arithmetic can create\n * coordinates with a large number of decimal places, not generally wanted on output.\n * Set a number here to round coordinates. Can also be used to ensure that\n * coordinates read in can be written back out with the same number of decimals.\n * Default is no rounding.\n */\n\n/**\n * @typedef {'arraybuffer' | 'json' | 'text' | 'xml'} Type\n */\n\n/**\n * @typedef {Object} SimpleGeometryObject\n * @property {import('../geom/Geometry.js').Type} type Type.\n * @property {Array<number>} flatCoordinates Flat coordinates.\n * @property {Array<number>|Array<Array<number>>} [ends] Ends or endss.\n * @property {import('../geom/Geometry.js').GeometryLayout} [layout] Layout.\n */\n\n/**\n * @typedef {Array<GeometryObject>} GeometryCollectionObject\n */\n\n/**\n * @typedef {SimpleGeometryObject|GeometryCollectionObject} GeometryObject\n */\n\n/**\n * @typedef {Object} FeatureObject\n * @property {string|number} [id] Id.\n * @property {GeometryObject} [geometry] Geometry.\n * @property {Object<string, *>} [properties] Properties.\n */\n\n/***\n * @template {import('../Feature.js').FeatureLike} T\n * @typedef {T extends RenderFeature ? typeof RenderFeature : typeof Feature} FeatureToFeatureClass\n */\n\n/***\n * @template {import(\"../Feature.js\").FeatureClass} T\n * @typedef {T[keyof T] extends RenderFeature ? RenderFeature : Feature} FeatureClassToFeature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for feature formats.\n * {@link module:ol/format/Feature~FeatureFormat} subclasses provide the ability to decode and encode\n * {@link module:ol/Feature~Feature} objects from a variety of commonly used geospatial\n * file formats. See the documentation for each format for more details.\n *\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @abstract\n * @api\n */\nclass FeatureFormat {\n constructor() {\n /**\n * @protected\n * @type {import(\"../proj/Projection.js\").default|undefined}\n */\n this.dataProjection = undefined;\n\n /**\n * @protected\n * @type {import(\"../proj/Projection.js\").default|undefined}\n */\n this.defaultFeatureProjection = undefined;\n\n /**\n * @protected\n * @type {FeatureToFeatureClass<FeatureType>}\n */\n this.featureClass = /** @type {FeatureToFeatureClass<FeatureType>} */ (\n Feature\n );\n\n /**\n * A list media types supported by the format in descending order of preference.\n * @type {Array<string>}\n */\n this.supportedMediaTypes = null;\n }\n\n /**\n * Adds the data projection to the read options.\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Options.\n * @return {ReadOptions|undefined} Options.\n * @protected\n */\n getReadOptions(source, options) {\n if (options) {\n let dataProjection = options.dataProjection\n ? getProjection(options.dataProjection)\n : this.readProjection(source);\n if (\n options.extent &&\n dataProjection &&\n dataProjection.getUnits() === 'tile-pixels'\n ) {\n dataProjection = getProjection(dataProjection);\n dataProjection.setWorldExtent(options.extent);\n }\n options = {\n dataProjection: dataProjection,\n featureProjection: options.featureProjection,\n };\n }\n return this.adaptOptions(options);\n }\n\n /**\n * Sets the `dataProjection` on the options, if no `dataProjection`\n * is set.\n * @param {WriteOptions|ReadOptions|undefined} options\n * Options.\n * @protected\n * @return {WriteOptions|ReadOptions|undefined}\n * Updated options.\n */\n adaptOptions(options) {\n return Object.assign(\n {\n dataProjection: this.dataProjection,\n featureProjection: this.defaultFeatureProjection,\n featureClass: this.featureClass,\n },\n options,\n );\n }\n\n /**\n * @abstract\n * @return {Type} The format type.\n */\n getType() {\n return abstract();\n }\n\n /**\n * Read a single feature from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {FeatureType|Array<FeatureType>} Feature.\n */\n readFeature(source, options) {\n return abstract();\n }\n\n /**\n * Read all features from a source.\n *\n * @abstract\n * @param {Document|Element|ArrayBuffer|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {Array<FeatureType>} Features.\n */\n readFeatures(source, options) {\n return abstract();\n }\n\n /**\n * Read a single geometry from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometry(source, options) {\n return abstract();\n }\n\n /**\n * Read the projection from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default|undefined} Projection.\n */\n readProjection(source) {\n return abstract();\n }\n\n /**\n * Encode a feature in this format.\n *\n * @abstract\n * @param {Feature} feature Feature.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeFeature(feature, options) {\n return abstract();\n }\n\n /**\n * Encode an array of features in this format.\n *\n * @abstract\n * @param {Array<Feature>} features Features.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeFeatures(features, options) {\n return abstract();\n }\n\n /**\n * Write a single geometry in this format.\n *\n * @abstract\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeGeometry(geometry, options) {\n return abstract();\n }\n}\n\nexport default FeatureFormat;\n\n/**\n * @template {import(\"../geom/Geometry.js\").default|RenderFeature} T\n * @param {T} geometry Geometry.\n * @param {boolean} write Set to true for writing, false for reading.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {T} Transformed geometry.\n */\nexport function transformGeometryWithOptions(geometry, write, options) {\n const featureProjection = options\n ? getProjection(options.featureProjection)\n : null;\n const dataProjection = options ? getProjection(options.dataProjection) : null;\n\n let transformed = geometry;\n if (\n featureProjection &&\n dataProjection &&\n !equivalentProjection(featureProjection, dataProjection)\n ) {\n if (write) {\n transformed = /** @type {T} */ (geometry.clone());\n }\n const fromProjection = write ? featureProjection : dataProjection;\n const toProjection = write ? dataProjection : featureProjection;\n if (fromProjection.getUnits() === 'tile-pixels') {\n transformed.transform(fromProjection, toProjection);\n } else {\n transformed.applyTransform(getTransform(fromProjection, toProjection));\n }\n }\n if (\n write &&\n options &&\n /** @type {WriteOptions} */ (options).decimals !== undefined\n ) {\n const power = Math.pow(10, /** @type {WriteOptions} */ (options).decimals);\n // if decimals option on write, round each coordinate appropriately\n /**\n * @param {Array<number>} coordinates Coordinates.\n * @return {Array<number>} Transformed coordinates.\n */\n const transform = function (coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n coordinates[i] = Math.round(coordinates[i] * power) / power;\n }\n return coordinates;\n };\n if (transformed === geometry) {\n transformed = /** @type {T} */ (geometry.clone());\n }\n transformed.applyTransform(transform);\n }\n return transformed;\n}\n\n/**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../extent.js\").Extent} Transformed extent.\n */\nexport function transformExtentWithOptions(extent, options) {\n const featureProjection = options\n ? getProjection(options.featureProjection)\n : null;\n const dataProjection = options ? getProjection(options.dataProjection) : null;\n\n if (\n featureProjection &&\n dataProjection &&\n !equivalentProjection(featureProjection, dataProjection)\n ) {\n return transformExtent(extent, dataProjection, featureProjection);\n }\n return extent;\n}\n\nconst GeometryConstructor = {\n Point: Point,\n LineString: LineString,\n Polygon: Polygon,\n MultiPoint: MultiPoint,\n MultiLineString: MultiLineString,\n MultiPolygon: MultiPolygon,\n};\n\nfunction orientFlatCoordinates(flatCoordinates, ends, stride) {\n if (Array.isArray(ends[0])) {\n // MultiPolagon\n if (!linearRingssAreOriented(flatCoordinates, 0, ends, stride)) {\n flatCoordinates = flatCoordinates.slice();\n orientLinearRingsArray(flatCoordinates, 0, ends, stride);\n }\n return flatCoordinates;\n }\n if (!linearRingsAreOriented(flatCoordinates, 0, ends, stride)) {\n flatCoordinates = flatCoordinates.slice();\n orientLinearRings(flatCoordinates, 0, ends, stride);\n }\n return flatCoordinates;\n}\n\n/**\n * @param {FeatureObject} object Feature object.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {RenderFeature|Array<RenderFeature>} Render feature.\n */\nexport function createRenderFeature(object, options) {\n const geometry = object.geometry;\n if (!geometry) {\n return [];\n }\n if (Array.isArray(geometry)) {\n return geometry\n .map((geometry) => createRenderFeature({...object, geometry}))\n .flat();\n }\n\n const geometryType =\n geometry.type === 'MultiPolygon' ? 'Polygon' : geometry.type;\n if (geometryType === 'GeometryCollection' || geometryType === 'Circle') {\n throw new Error('Unsupported geometry type: ' + geometryType);\n }\n\n const stride = geometry.layout.length;\n return transformGeometryWithOptions(\n new RenderFeature(\n geometryType,\n geometryType === 'Polygon'\n ? orientFlatCoordinates(geometry.flatCoordinates, geometry.ends, stride)\n : geometry.flatCoordinates,\n geometry.ends?.flat(),\n stride,\n object.properties || {},\n object.id,\n ).enableSimplifyTransformed(),\n false,\n options,\n );\n}\n\n/**\n * @param {GeometryObject|null} object Geometry object.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nexport function createGeometry(object, options) {\n if (!object) {\n return null;\n }\n if (Array.isArray(object)) {\n const geometries = object.map((geometry) =>\n createGeometry(geometry, options),\n );\n return new GeometryCollection(geometries);\n }\n const Geometry = GeometryConstructor[object.type];\n return transformGeometryWithOptions(\n new Geometry(object.flatCoordinates, object.layout || 'XY', object.ends),\n false,\n options,\n );\n}\n","/**\n * @module ol/format/JSONFeature\n */\nimport {abstract} from '../util.js';\nimport FeatureFormat from './Feature.js';\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for JSON feature formats.\n *\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @extends {FeatureFormat<FeatureType>}\n * @abstract\n */\nclass JSONFeature extends FeatureFormat {\n constructor() {\n super();\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n * @override\n */\n getType() {\n return 'json';\n }\n\n /**\n * Read a feature. Only works for a single feature. Use `readFeatures` to\n * read a feature collection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {FeatureType|Array<FeatureType>} Feature.\n * @api\n * @override\n */\n readFeature(source, options) {\n return this.readFeatureFromObject(\n getObject(source),\n this.getReadOptions(source, options),\n );\n }\n\n /**\n * Read all features. Works with both a single feature and a feature\n * collection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array<FeatureType>} Features.\n * @api\n * @override\n */\n readFeatures(source, options) {\n return this.readFeaturesFromObject(\n getObject(source),\n this.getReadOptions(source, options),\n );\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {FeatureType|Array<FeatureType>} Feature.\n */\n readFeatureFromObject(object, options) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<FeatureType>} Features.\n */\n readFeaturesFromObject(object, options) {\n return abstract();\n }\n\n /**\n * Read a geometry.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @api\n * @override\n */\n readGeometry(source, options) {\n return this.readGeometryFromObject(\n getObject(source),\n this.getReadOptions(source, options),\n );\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromObject(object, options) {\n return abstract();\n }\n\n /**\n * Read the projection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @api\n * @override\n */\n readProjection(source) {\n return this.readProjectionFromObject(getObject(source));\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromObject(object) {\n return abstract();\n }\n\n /**\n * Encode a feature as string.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded feature.\n * @api\n * @override\n */\n writeFeature(feature, options) {\n return JSON.stringify(this.writeFeatureObject(feature, options));\n }\n\n /**\n * @abstract\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeFeatureObject(feature, options) {\n return abstract();\n }\n\n /**\n * Encode an array of features as string.\n *\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded features.\n * @api\n * @override\n */\n writeFeatures(features, options) {\n return JSON.stringify(this.writeFeaturesObject(features, options));\n }\n\n /**\n * @abstract\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeFeaturesObject(features, options) {\n return abstract();\n }\n\n /**\n * Encode a geometry as string.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded geometry.\n * @api\n * @override\n */\n writeGeometry(geometry, options) {\n return JSON.stringify(this.writeGeometryObject(geometry, options));\n }\n\n /**\n * @abstract\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeGeometryObject(geometry, options) {\n return abstract();\n }\n}\n\n/**\n * @param {Document|Element|Object|string} source Source.\n * @return {Object} Object.\n */\nfunction getObject(source) {\n if (typeof source === 'string') {\n const object = JSON.parse(source);\n return object ? /** @type {Object} */ (object) : null;\n }\n if (source !== null) {\n return source;\n }\n return null;\n}\n\nexport default JSONFeature;\n","/**\n * @module ol/format/EsriJSON\n */\nimport Feature from '../Feature.js';\nimport {containsExtent} from '../extent.js';\nimport LineString from '../geom/LineString.js';\nimport LinearRing from '../geom/LinearRing.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {deflateCoordinates} from '../geom/flat/deflate.js';\nimport {linearRingIsClockwise} from '../geom/flat/orient.js';\nimport {isEmpty} from '../obj.js';\nimport {get as getProjection} from '../proj.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport JSONFeature from './JSONFeature.js';\n\n/**\n * @typedef {import(\"arcgis-rest-api\").Feature} EsriJSONFeature\n * @typedef {import(\"arcgis-rest-api\").FeatureSet} EsriJSONFeatureSet\n * @typedef {import(\"arcgis-rest-api\").Geometry} EsriJSONGeometry\n * @typedef {import(\"arcgis-rest-api\").Point} EsriJSONPoint\n * @typedef {import(\"arcgis-rest-api\").Polyline} EsriJSONPolyline\n * @typedef {import(\"arcgis-rest-api\").Polygon} EsriJSONPolygon\n * @typedef {import(\"arcgis-rest-api\").Multipoint} EsriJSONMultipoint\n * @typedef {import(\"arcgis-rest-api\").HasZM} EsriJSONHasZM\n * @typedef {import(\"arcgis-rest-api\").Position} EsriJSONPosition\n * @typedef {import(\"arcgis-rest-api\").SpatialReferenceWkid} EsriJSONSpatialReferenceWkid\n */\n\n/**\n * @typedef {Object} EsriJSONMultiPolygon\n * @property {Array<Array<Array<Array<number>>>>} rings Rings for the MultiPolygon.\n * @property {boolean} [hasM] If the polygon coordinates have an M value.\n * @property {boolean} [hasZ] If the polygon coordinates have a Z value.\n * @property {EsriJSONSpatialReferenceWkid} [spatialReference] The coordinate reference system.\n */\n\n/**\n * @const\n * @type {Object<import(\"../geom/Geometry.js\").Type, function(EsriJSONGeometry): import(\"../geom/Geometry.js\").default>}\n */\nconst GEOMETRY_READERS = {\n Point: readPointGeometry,\n LineString: readLineStringGeometry,\n Polygon: readPolygonGeometry,\n MultiPoint: readMultiPointGeometry,\n MultiLineString: readMultiLineStringGeometry,\n MultiPolygon: readMultiPolygonGeometry,\n};\n\n/**\n * @const\n * @type {Object<import(\"../geom/Geometry.js\").Type, function(import(\"../geom/Geometry.js\").default, import(\"./Feature.js\").WriteOptions=): (EsriJSONGeometry)>}\n */\nconst GEOMETRY_WRITERS = {\n Point: writePointGeometry,\n LineString: writeLineStringGeometry,\n Polygon: writePolygonGeometry,\n MultiPoint: writeMultiPointGeometry,\n MultiLineString: writeMultiLineStringGeometry,\n MultiPolygon: writeMultiPolygonGeometry,\n};\n\n/**\n * @typedef {Object} Options\n * @property {string} [geometryName] Geometry name to use when creating features.\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the EsriJSON format.\n *\n * @api\n */\nclass EsriJSON extends JSONFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super();\n\n /**\n * Name of the geometry attribute for features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @param {string} [idField] Name of the field where to get the id from.\n * @protected\n * @return {import(\"../Feature.js\").default} Feature.\n * @override\n */\n readFeatureFromObject(object, options, idField) {\n const esriJSONFeature = /** @type {EsriJSONFeature} */ (object);\n const geometry = readGeometry(esriJSONFeature.geometry, options);\n const feature = new Feature();\n if (this.geometryName_) {\n feature.setGeometryName(this.geometryName_);\n }\n feature.setGeometry(geometry);\n if (esriJSONFeature.attributes) {\n feature.setProperties(esriJSONFeature.attributes, true);\n const id = esriJSONFeature.attributes[idField];\n if (id !== undefined) {\n feature.setId(/** @type {number} */ (id));\n }\n }\n return feature;\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<Feature>} Features.\n * @override\n */\n readFeaturesFromObject(object, options) {\n options = options ? options : {};\n if (object['features']) {\n const esriJSONFeatureSet = /** @type {EsriJSONFeatureSet} */ (object);\n /** @type {Array<import(\"../Feature.js\").default>} */\n const features = [];\n const esriJSONFeatures = esriJSONFeatureSet.features;\n for (let i = 0, ii = esriJSONFeatures.length; i < ii; ++i) {\n features.push(\n this.readFeatureFromObject(\n esriJSONFeatures[i],\n options,\n object.objectIdFieldName,\n ),\n );\n }\n return features;\n }\n return [this.readFeatureFromObject(object, options)];\n }\n\n /**\n * @param {EsriJSONGeometry} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @override\n */\n readGeometryFromObject(object, options) {\n return readGeometry(object, options);\n }\n\n /**\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @override\n */\n readProjectionFromObject(object) {\n if (\n object['spatialReference'] &&\n object['spatialReference']['wkid'] !== undefined\n ) {\n const spatialReference = /** @type {EsriJSONSpatialReferenceWkid} */ (\n object['spatialReference']\n );\n const crs = spatialReference.wkid;\n return getProjection('EPSG:' + crs);\n }\n return null;\n }\n\n /**\n * Encode a geometry as a EsriJSON object.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONGeometry} Object.\n * @api\n * @override\n */\n writeGeometryObject(geometry, options) {\n return writeGeometry(geometry, this.adaptOptions(options));\n }\n\n /**\n * Encode a feature as a esriJSON Feature object.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n * @api\n * @override\n */\n writeFeatureObject(feature, options) {\n options = this.adaptOptions(options);\n const object = {};\n if (!feature.hasProperties()) {\n object['attributes'] = {};\n return object;\n }\n const properties = feature.getProperties();\n const geometry = feature.getGeometry();\n if (geometry) {\n object['geometry'] = writeGeometry(geometry, options);\n const projection =\n options && (options.dataProjection || options.featureProjection);\n if (projection) {\n object['geometry']['spatialReference'] =\n /** @type {EsriJSONSpatialReferenceWkid} */ ({\n wkid: Number(getProjection(projection).getCode().split(':').pop()),\n });\n }\n delete properties[feature.getGeometryName()];\n }\n if (!isEmpty(properties)) {\n object['attributes'] = properties;\n } else {\n object['attributes'] = {};\n }\n return object;\n }\n\n /**\n * Encode an array of features as a EsriJSON object.\n *\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONFeatureSet} EsriJSON Object.\n * @api\n * @override\n */\n writeFeaturesObject(features, options) {\n options = this.adaptOptions(options);\n const objects = [];\n for (let i = 0, ii = features.length; i < ii; ++i) {\n objects.push(this.writeFeatureObject(features[i], options));\n }\n return {\n 'features': objects,\n };\n }\n}\n\n/**\n * @param {EsriJSONGeometry} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nfunction readGeometry(object, options) {\n if (!object) {\n return null;\n }\n /** @type {import(\"../geom/Geometry.js\").Type} */\n let type;\n if (typeof object['x'] === 'number' && typeof object['y'] === 'number') {\n type = 'Point';\n } else if (object['points']) {\n type = 'MultiPoint';\n } else if (object['paths']) {\n const esriJSONPolyline = /** @type {EsriJSONPolyline} */ (object);\n if (esriJSONPolyline.paths.length === 1) {\n type = 'LineString';\n } else {\n type = 'MultiLineString';\n }\n } else if (object['rings']) {\n const esriJSONPolygon = /** @type {EsriJSONPolygon} */ (object);\n const layout = getGeometryLayout(esriJSONPolygon);\n const rings = convertRings(esriJSONPolygon.rings, layout);\n if (rings.length === 1) {\n type = 'Polygon';\n object = Object.assign({}, object, {['rings']: rings[0]});\n } else {\n type = 'MultiPolygon';\n object = Object.assign({}, object, {['rings']: rings});\n }\n }\n const geometryReader = GEOMETRY_READERS[type];\n return transformGeometryWithOptions(geometryReader(object), false, options);\n}\n\n/**\n * Determines inner and outer rings.\n * Checks if any polygons in this array contain any other polygons in this\n * array. It is used for checking for holes.\n * Logic inspired by: https://github.com/Esri/terraformer-arcgis-parser\n * @param {Array<!Array<!Array<number>>>} rings Rings.\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout Geometry layout.\n * @return {Array<!Array<!Array<!Array<number>>>>} Transformed rings.\n */\nfunction convertRings(rings, layout) {\n const flatRing = [];\n const outerRings = [];\n const holes = [];\n let i, ii;\n for (i = 0, ii = rings.length; i < ii; ++i) {\n flatRing.length = 0;\n deflateCoordinates(flatRing, 0, rings[i], layout.length);\n // is this ring an outer ring? is it clockwise?\n const clockwise = linearRingIsClockwise(\n flatRing,\n 0,\n flatRing.length,\n layout.length,\n );\n if (clockwise) {\n outerRings.push([rings[i]]);\n } else {\n holes.push(rings[i]);\n }\n }\n while (holes.length) {\n const hole = holes.shift();\n let matched = false;\n // loop over all outer rings and see if they contain our hole.\n for (i = outerRings.length - 1; i >= 0; i--) {\n const outerRing = outerRings[i][0];\n const containsHole = containsExtent(\n new LinearRing(outerRing).getExtent(),\n new LinearRing(hole).getExtent(),\n );\n if (containsHole) {\n // the hole is contained push it into our polygon\n outerRings[i].push(hole);\n matched = true;\n break;\n }\n }\n if (!matched) {\n // no outer rings contain this hole turn it into and outer\n // ring (reverse it)\n outerRings.push([hole.reverse()]);\n }\n }\n return outerRings;\n}\n\n/**\n * @param {EsriJSONPoint} object Object.\n * @return {import(\"../geom/Geometry.js\").default} Point.\n */\nfunction readPointGeometry(object) {\n let point;\n if (object.m !== undefined && object.z !== undefined) {\n point = new Point([object.x, object.y, object.z, object.m], 'XYZM');\n } else if (object.z !== undefined) {\n point = new Point([object.x, object.y, object.z], 'XYZ');\n } else if (object.m !== undefined) {\n point = new Point([object.x, object.y, object.m], 'XYM');\n } else {\n point = new Point([object.x, object.y]);\n }\n return point;\n}\n\n/**\n * @param {EsriJSONPolyline} object Object.\n * @return {import(\"../geom/Geometry.js\").default} LineString.\n */\nfunction readLineStringGeometry(object) {\n const layout = getGeometryLayout(object);\n return new LineString(object.paths[0], layout);\n}\n\n/**\n * @param {EsriJSONPolyline} object Object.\n * @return {import(\"../geom/Geometry.js\").default} MultiLineString.\n */\nfunction readMultiLineStringGeometry(object) {\n const layout = getGeometryLayout(object);\n return new MultiLineString(object.paths, layout);\n}\n\n/**\n * @param {EsriJSONHasZM} object Object.\n * @return {import(\"../geom/Geometry.js\").GeometryLayout} The geometry layout to use.\n */\nfunction getGeometryLayout(object) {\n /** @type {import(\"../geom/Geometry.js\").GeometryLayout} */\n let layout = 'XY';\n if (object.hasZ === true && object.hasM === true) {\n layout = 'XYZM';\n } else if (object.hasZ === true) {\n layout = 'XYZ';\n } else if (object.hasM === true) {\n layout = 'XYM';\n }\n return layout;\n}\n\n/**\n * @param {EsriJSONMultipoint} object Object.\n * @return {import(\"../geom/Geometry.js\").default} MultiPoint.\n */\nfunction readMultiPointGeometry(object) {\n const layout = getGeometryLayout(object);\n return new MultiPoint(object.points, layout);\n}\n\n/**\n * @param {EsriJSONMultiPolygon} object Object.\n * @return {import(\"../geom/Geometry.js\").default} MultiPolygon.\n */\nfunction readMultiPolygonGeometry(object) {\n const layout = getGeometryLayout(object);\n return new MultiPolygon(object.rings, layout);\n}\n\n/**\n * @param {EsriJSONPolygon} object Object.\n * @return {import(\"../geom/Geometry.js\").default} Polygon.\n */\nfunction readPolygonGeometry(object) {\n const layout = getGeometryLayout(object);\n return new Polygon(object.rings, layout);\n}\n\n/**\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPoint} EsriJSON geometry.\n */\nfunction writePointGeometry(geometry, options) {\n const coordinates = geometry.getCoordinates();\n /** @type {EsriJSONPoint} */\n let esriJSON;\n const layout = geometry.getLayout();\n if (layout === 'XYZ') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n z: coordinates[2],\n };\n } else if (layout === 'XYM') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n m: coordinates[2],\n };\n } else if (layout === 'XYZM') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n z: coordinates[2],\n m: coordinates[3],\n };\n } else if (layout === 'XY') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n };\n } else {\n throw new Error('Invalid geometry layout');\n }\n return esriJSON;\n}\n\n/**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @return {Object} Object with boolean hasZ and hasM keys.\n */\nfunction getHasZM(geometry) {\n const layout = geometry.getLayout();\n return {\n hasZ: layout === 'XYZ' || layout === 'XYZM',\n hasM: layout === 'XYM' || layout === 'XYZM',\n };\n}\n\n/**\n * @param {import(\"../geom/LineString.js\").default} lineString Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolyline} EsriJSON geometry.\n */\nfunction writeLineStringGeometry(lineString, options) {\n const hasZM = getHasZM(lineString);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n paths: [\n /** @type {Array<EsriJSONPosition>} */ (lineString.getCoordinates()),\n ],\n };\n}\n\n/**\n * @param {import(\"../geom/Polygon.js\").default} polygon Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolygon} EsriJSON geometry.\n */\nfunction writePolygonGeometry(polygon, options) {\n // Esri geometries use the left-hand rule\n const hasZM = getHasZM(polygon);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n rings: /** @type {Array<Array<EsriJSONPosition>>} */ (\n polygon.getCoordinates(false)\n ),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiLineString.js\").default} multiLineString Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolyline} EsriJSON geometry.\n */\nfunction writeMultiLineStringGeometry(multiLineString, options) {\n const hasZM = getHasZM(multiLineString);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n paths: /** @type {Array<Array<EsriJSONPosition>>} */ (\n multiLineString.getCoordinates()\n ),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPoint.js\").default} multiPoint Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONMultipoint} EsriJSON geometry.\n */\nfunction writeMultiPointGeometry(multiPoint, options) {\n const hasZM = getHasZM(multiPoint);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n points: /** @type {Array<EsriJSONPosition>} */ (\n multiPoint.getCoordinates()\n ),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolygon} EsriJSON geometry.\n */\nfunction writeMultiPolygonGeometry(geometry, options) {\n const hasZM = getHasZM(geometry);\n const coordinates = geometry.getCoordinates(false);\n const output = [];\n for (let i = 0; i < coordinates.length; i++) {\n for (let x = coordinates[i].length - 1; x >= 0; x--) {\n output.push(coordinates[i][x]);\n }\n }\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n rings: /** @type {Array<Array<EsriJSONPosition>>} */ (output),\n };\n}\n\n/**\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONGeometry} EsriJSON geometry.\n */\nfunction writeGeometry(geometry, options) {\n const geometryWriter = GEOMETRY_WRITERS[geometry.getType()];\n return geometryWriter(\n transformGeometryWithOptions(geometry, true, options),\n options,\n );\n}\n\nexport default EsriJSON;\n","/**\n * @module ol/format/XMLFeature\n */\nimport {extend} from '../array.js';\nimport FeatureFormat from '../format/Feature.js';\nimport {abstract} from '../util.js';\nimport {getXMLSerializer, isDocument, parse} from '../xml.js';\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for XML feature formats.\n *\n * @abstract\n */\nclass XMLFeature extends FeatureFormat {\n constructor() {\n super();\n\n /**\n * @type {XMLSerializer}\n * @private\n */\n this.xmlSerializer_ = getXMLSerializer();\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n * @override\n */\n getType() {\n return 'xml';\n }\n\n /**\n * Read a single feature.\n *\n * @param {Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @api\n * @override\n */\n readFeature(source, options) {\n if (!source) {\n return null;\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readFeatureFromDocument(doc, options);\n }\n if (isDocument(source)) {\n return this.readFeatureFromDocument(\n /** @type {Document} */ (source),\n options,\n );\n }\n return this.readFeatureFromNode(/** @type {Element} */ (source), options);\n }\n\n /**\n * @param {Document} doc Document.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {import(\"../Feature.js\").default} Feature.\n */\n readFeatureFromDocument(doc, options) {\n const features = this.readFeaturesFromDocument(doc, options);\n if (features.length > 0) {\n return features[0];\n }\n return null;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {import(\"../Feature.js\").default} Feature.\n */\n readFeatureFromNode(node, options) {\n return null; // not implemented\n }\n\n /**\n * Read all features from a feature collection.\n *\n * @param {Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @api\n * @override\n */\n readFeatures(source, options) {\n if (!source) {\n return [];\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readFeaturesFromDocument(doc, options);\n }\n if (isDocument(source)) {\n return this.readFeaturesFromDocument(\n /** @type {Document} */ (source),\n options,\n );\n }\n return this.readFeaturesFromNode(/** @type {Element} */ (source), options);\n }\n\n /**\n * @param {Document} doc Document.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @protected\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n readFeaturesFromDocument(doc, options) {\n /** @type {Array<import(\"../Feature.js\").default>} */\n const features = [];\n for (let n = doc.firstChild; n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n extend(\n features,\n this.readFeaturesFromNode(/** @type {Element} */ (n), options),\n );\n }\n }\n return features;\n }\n\n /**\n * @abstract\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @protected\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n readFeaturesFromNode(node, options) {\n return abstract();\n }\n\n /**\n * Read a single geometry from a source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @override\n */\n readGeometry(source, options) {\n if (!source) {\n return null;\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readGeometryFromDocument(doc, options);\n }\n if (isDocument(source)) {\n return this.readGeometryFromDocument(\n /** @type {Document} */ (source),\n options,\n );\n }\n return this.readGeometryFromNode(/** @type {Element} */ (source), options);\n }\n\n /**\n * @param {Document} doc Document.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromDocument(doc, options) {\n return null; // not implemented\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromNode(node, options) {\n return null; // not implemented\n }\n\n /**\n * Read the projection from the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @api\n * @override\n */\n readProjection(source) {\n if (!source) {\n return null;\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readProjectionFromDocument(doc);\n }\n if (isDocument(source)) {\n return this.readProjectionFromDocument(/** @type {Document} */ (source));\n }\n return this.readProjectionFromNode(/** @type {Element} */ (source));\n }\n\n /**\n * @param {Document} doc Document.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromDocument(doc) {\n return this.dataProjection;\n }\n\n /**\n * @param {Element} node Node.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromNode(node) {\n return this.dataProjection;\n }\n\n /**\n * Encode a feature as string.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded feature.\n * @override\n */\n writeFeature(feature, options) {\n const node = this.writeFeatureNode(feature, options);\n return this.xmlSerializer_.serializeToString(node);\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @protected\n * @return {Node} Node.\n */\n writeFeatureNode(feature, options) {\n return null; // not implemented\n }\n\n /**\n * Encode an array of features as string.\n *\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Result.\n * @api\n * @override\n */\n writeFeatures(features, options) {\n const node = this.writeFeaturesNode(features, options);\n return this.xmlSerializer_.serializeToString(node);\n }\n\n /**\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Node} Node.\n */\n writeFeaturesNode(features, options) {\n return null; // not implemented\n }\n\n /**\n * Encode a geometry as string.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded geometry.\n * @override\n */\n writeGeometry(geometry, options) {\n const node = this.writeGeometryNode(geometry, options);\n return this.xmlSerializer_.serializeToString(node);\n }\n\n /**\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Node} Node.\n */\n writeGeometryNode(geometry, options) {\n return null; // not implemented\n }\n}\n\nexport default XMLFeature;\n","/**\n * @module ol/format/GMLBase\n */\n// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part\n// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect\n// envelopes/extents, only geometries!\nimport Feature from '../Feature.js';\nimport {extend} from '../array.js';\nimport Geometry from '../geom/Geometry.js';\nimport LineString from '../geom/LineString.js';\nimport LinearRing from '../geom/LinearRing.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n getAllTextContent,\n getAttributeNS,\n makeArrayPusher,\n makeReplacer,\n parseNode,\n pushParseAndPop,\n} from '../xml.js';\nimport {\n transformExtentWithOptions,\n transformGeometryWithOptions,\n} from './Feature.js';\nimport XMLFeature from './XMLFeature.js';\n\n/**\n * @const\n * @type {string}\n */\nexport const GMLNS = 'http://www.opengis.net/gml';\n\n/**\n * A regular expression that matches if a string only contains whitespace\n * characters. It will e.g. match `''`, `' '`, `'\\n'` etc.\n *\n * @const\n * @type {RegExp}\n */\nconst ONLY_WHITESPACE_RE = /^\\s*$/;\n\n/**\n * @typedef {Object} Options\n * @property {Object<string, string>|string} [featureNS] Feature\n * namespace. If not defined will be derived from GML. If multiple\n * feature types have been configured which come from different feature\n * namespaces, this will be an object with the keys being the prefixes used\n * in the entries of featureType array. The values of the object will be the\n * feature namespaces themselves. So for instance there might be a featureType\n * item `topp:states` in the `featureType` array and then there will be a key\n * `topp` in the featureNS object with value `http://www.openplans.org/topp`.\n * @property {Array<string>|string} [featureType] Feature type(s) to parse.\n * If multiple feature types need to be configured\n * which come from different feature namespaces, `featureNS` will be an object\n * with the keys being the prefixes used in the entries of featureType array.\n * The values of the object will be the feature namespaces themselves.\n * So for instance there might be a featureType item `topp:states` and then\n * there will be a key named `topp` in the featureNS object with value\n * `http://www.openplans.org/topp`.\n * @property {string} [srsName] srsName to use when writing geometries.\n * @property {boolean} [surface=false] Write gml:Surface instead of gml:Polygon\n * elements. This also affects the elements in multi-part geometries.\n * @property {boolean} [curve=false] Write gml:Curve instead of gml:LineString\n * elements. This also affects the elements in multi-part geometries.\n * @property {boolean} [multiCurve=true] Write gml:MultiCurve instead of gml:MultiLineString.\n * Since the latter is deprecated in GML 3.\n * @property {boolean} [multiSurface=true] Write gml:multiSurface instead of\n * gml:MultiPolygon. Since the latter is deprecated in GML 3.\n * @property {string} [schemaLocation] Optional schemaLocation to use when\n * writing out the GML, this will override the default provided.\n * @property {boolean} [hasZ=false] If coordinates have a Z value.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Feature base format for reading and writing data in the GML format.\n * This class cannot be instantiated, it contains only base content that\n * is shared with versioned format classes GML2 and GML3.\n *\n * @abstract\n * @api\n */\nclass GMLBase extends XMLFeature {\n /**\n * @param {Options} [options] Optional configuration object.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @protected\n * @type {Array<string>|string|undefined}\n */\n this.featureType = options.featureType;\n\n /**\n * @protected\n * @type {Object<string, string>|string|undefined}\n */\n this.featureNS = options.featureNS;\n\n /**\n * @protected\n * @type {string|undefined}\n */\n this.srsName = options.srsName;\n\n /**\n * @protected\n * @type {string}\n */\n this.schemaLocation = '';\n\n /**\n * @type {Object<string, Object<string, Object>>}\n */\n this.FEATURE_COLLECTION_PARSERS = {};\n this.FEATURE_COLLECTION_PARSERS[this.namespace] = {\n 'featureMember': makeArrayPusher(this.readFeaturesInternal),\n 'featureMembers': makeReplacer(this.readFeaturesInternal),\n };\n\n this.supportedMediaTypes = ['application/gml+xml'];\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<Feature> | undefined} Features.\n */\n readFeaturesInternal(node, objectStack) {\n const localName = node.localName;\n let features = null;\n if (localName == 'FeatureCollection') {\n features = pushParseAndPop(\n [],\n this.FEATURE_COLLECTION_PARSERS,\n node,\n objectStack,\n this,\n );\n } else if (\n localName == 'featureMembers' ||\n localName == 'featureMember' ||\n localName == 'member'\n ) {\n const context = objectStack[0];\n let featureType = context['featureType'];\n let featureNS = context['featureNS'];\n const prefix = 'p';\n const defaultPrefix = 'p0';\n if (!featureType && node.childNodes) {\n (featureType = []), (featureNS = {});\n for (let i = 0, ii = node.childNodes.length; i < ii; ++i) {\n const child = /** @type {Element} */ (node.childNodes[i]);\n if (child.nodeType === 1) {\n const ft = child.nodeName.split(':').pop();\n if (!featureType.includes(ft)) {\n let key = '';\n let count = 0;\n const uri = child.namespaceURI;\n for (const candidate in featureNS) {\n if (featureNS[candidate] === uri) {\n key = candidate;\n break;\n }\n ++count;\n }\n if (!key) {\n key = prefix + count;\n featureNS[key] = uri;\n }\n featureType.push(key + ':' + ft);\n }\n }\n }\n if (localName != 'featureMember') {\n // recheck featureType for each featureMember\n context['featureType'] = featureType;\n context['featureNS'] = featureNS;\n }\n }\n if (typeof featureNS === 'string') {\n const ns = featureNS;\n featureNS = {};\n featureNS[defaultPrefix] = ns;\n }\n /** @type {Object<string, Object<string, import(\"../xml.js\").Parser>>} */\n const parsersNS = {};\n const featureTypes = Array.isArray(featureType)\n ? featureType\n : [featureType];\n for (const p in featureNS) {\n /** @type {Object<string, import(\"../xml.js\").Parser>} */\n const parsers = {};\n for (let i = 0, ii = featureTypes.length; i < ii; ++i) {\n const featurePrefix = featureTypes[i].includes(':')\n ? featureTypes[i].split(':')[0]\n : defaultPrefix;\n if (featurePrefix === p) {\n parsers[featureTypes[i].split(':').pop()] =\n localName == 'featureMembers'\n ? makeArrayPusher(this.readFeatureElement, this)\n : makeReplacer(this.readFeatureElement, this);\n }\n }\n parsersNS[featureNS[p]] = parsers;\n }\n if (localName == 'featureMember' || localName == 'member') {\n features = pushParseAndPop(undefined, parsersNS, node, objectStack);\n } else {\n features = pushParseAndPop([], parsersNS, node, objectStack);\n }\n }\n if (features === null) {\n features = [];\n }\n return features;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../geom/Geometry.js\").default|import(\"../extent.js\").Extent|undefined} Geometry.\n */\n readGeometryOrExtent(node, objectStack) {\n const context = /** @type {Object} */ (objectStack[0]);\n context['srsName'] = node.firstElementChild.getAttribute('srsName');\n context['srsDimension'] =\n node.firstElementChild.getAttribute('srsDimension');\n return pushParseAndPop(\n null,\n this.GEOMETRY_PARSERS,\n node,\n objectStack,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../extent.js\").Extent|undefined} Geometry.\n */\n readExtentElement(node, objectStack) {\n const context = /** @type {Object} */ (objectStack[0]);\n const extent = /** @type {import(\"../extent.js\").Extent} */ (\n this.readGeometryOrExtent(node, objectStack)\n );\n return extent ? transformExtentWithOptions(extent, context) : undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../geom/Geometry.js\").default|undefined} Geometry.\n */\n readGeometryElement(node, objectStack) {\n const context = /** @type {Object} */ (objectStack[0]);\n const geometry = /** @type {import(\"../geom/Geometry.js\").default} */ (\n this.readGeometryOrExtent(node, objectStack)\n );\n return geometry\n ? transformGeometryWithOptions(geometry, false, context)\n : undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @param {boolean} asFeature whether result should be wrapped as a feature.\n * @return {Feature|Object} Feature\n */\n readFeatureElementInternal(node, objectStack, asFeature) {\n let geometryName;\n const values = {};\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n let value;\n const localName = n.localName;\n // first, check if it is simple attribute\n if (\n n.childNodes.length === 0 ||\n (n.childNodes.length === 1 &&\n (n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))\n ) {\n value = getAllTextContent(n, false);\n if (ONLY_WHITESPACE_RE.test(value)) {\n value = undefined;\n }\n } else {\n if (asFeature) {\n //if feature, try it as a geometry or extent\n value =\n localName === 'boundedBy'\n ? this.readExtentElement(n, objectStack)\n : this.readGeometryElement(n, objectStack);\n }\n if (!value) {\n //if not a geometry or not a feature, treat it as a complex attribute\n value = this.readFeatureElementInternal(n, objectStack, false);\n } else if (localName !== 'boundedBy') {\n // boundedBy is an extent and must not be considered as a geometry\n geometryName = localName;\n }\n }\n\n const len = n.attributes.length;\n if (len > 0 && !(value instanceof Geometry)) {\n value = {_content_: value};\n for (let i = 0; i < len; i++) {\n const attName = n.attributes[i].name;\n value[attName] = n.attributes[i].value;\n }\n }\n\n if (values[localName]) {\n if (!(values[localName] instanceof Array)) {\n values[localName] = [values[localName]];\n }\n values[localName].push(value);\n } else {\n values[localName] = value;\n }\n }\n if (!asFeature) {\n return values;\n }\n const feature = new Feature(values);\n if (geometryName) {\n feature.setGeometryName(geometryName);\n }\n const fid =\n node.getAttribute('fid') || getAttributeNS(node, this.namespace, 'id');\n if (fid) {\n feature.setId(fid);\n }\n return feature;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature} Feature.\n */\n readFeatureElement(node, objectStack) {\n return this.readFeatureElementInternal(node, objectStack, true);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Point|undefined} Point.\n */\n readPoint(node, objectStack) {\n const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n return new Point(flatCoordinates, 'XYZ');\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiPoint|undefined} MultiPoint.\n */\n readMultiPoint(node, objectStack) {\n /** @type {Array<Array<number>>} */\n const coordinates = pushParseAndPop(\n [],\n this.MULTIPOINT_PARSERS,\n node,\n objectStack,\n this,\n );\n if (coordinates) {\n return new MultiPoint(coordinates);\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiLineString|undefined} MultiLineString.\n */\n readMultiLineString(node, objectStack) {\n /** @type {Array<LineString>} */\n const lineStrings = pushParseAndPop(\n [],\n this.MULTILINESTRING_PARSERS,\n node,\n objectStack,\n this,\n );\n if (lineStrings) {\n return new MultiLineString(lineStrings);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiPolygon|undefined} MultiPolygon.\n */\n readMultiPolygon(node, objectStack) {\n /** @type {Array<Polygon>} */\n const polygons = pushParseAndPop(\n [],\n this.MULTIPOLYGON_PARSERS,\n node,\n objectStack,\n this,\n );\n if (polygons) {\n return new MultiPolygon(polygons);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n pointMemberParser(node, objectStack) {\n parseNode(this.POINTMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n lineStringMemberParser(node, objectStack) {\n parseNode(this.LINESTRINGMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n polygonMemberParser(node, objectStack) {\n parseNode(this.POLYGONMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {LineString|undefined} LineString.\n */\n readLineString(node, objectStack) {\n const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n const lineString = new LineString(flatCoordinates, 'XYZ');\n return lineString;\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>|undefined} LinearRing flat coordinates.\n */\n readFlatLinearRing(node, objectStack) {\n const ring = pushParseAndPop(\n null,\n this.GEOMETRY_FLAT_COORDINATES_PARSERS,\n node,\n objectStack,\n this,\n );\n if (ring) {\n return ring;\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {LinearRing|undefined} LinearRing.\n */\n readLinearRing(node, objectStack) {\n const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n return new LinearRing(flatCoordinates, 'XYZ');\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Polygon|undefined} Polygon.\n */\n readPolygon(node, objectStack) {\n /** @type {Array<Array<number>>} */\n const flatLinearRings = pushParseAndPop(\n [null],\n this.FLAT_LINEAR_RINGS_PARSERS,\n node,\n objectStack,\n this,\n );\n if (flatLinearRings && flatLinearRings[0]) {\n const flatCoordinates = flatLinearRings[0];\n const ends = [flatCoordinates.length];\n let i, ii;\n for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {\n extend(flatCoordinates, flatLinearRings[i]);\n ends.push(flatCoordinates.length);\n }\n return new Polygon(flatCoordinates, 'XYZ', ends);\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>} Flat coordinates.\n */\n readFlatCoordinatesFromNode(node, objectStack) {\n return pushParseAndPop(\n null,\n this.GEOMETRY_FLAT_COORDINATES_PARSERS,\n node,\n objectStack,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @override\n */\n readGeometryFromNode(node, options) {\n const geometry = this.readGeometryElement(node, [\n this.getReadOptions(node, options ? options : {}),\n ]);\n return geometry ? geometry : null;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @override\n */\n readFeaturesFromNode(node, options) {\n const internalOptions = {\n featureType: this.featureType,\n featureNS: this.featureNS,\n };\n if (internalOptions) {\n Object.assign(internalOptions, this.getReadOptions(node, options));\n }\n const features = this.readFeaturesInternal(node, [internalOptions]);\n return features || [];\n }\n\n /**\n * @param {Element} node Node.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @override\n */\n readProjectionFromNode(node) {\n return getProjection(\n this.srsName\n ? this.srsName\n : node.firstElementChild.getAttribute('srsName'),\n );\n }\n}\n\nGMLBase.prototype.namespace = GMLNS;\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.FLAT_LINEAR_RINGS_PARSERS = {\n 'http://www.opengis.net/gml': {},\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {\n 'http://www.opengis.net/gml': {},\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.GEOMETRY_PARSERS = {\n 'http://www.opengis.net/gml': {},\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.MULTIPOINT_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser),\n 'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.MULTILINESTRING_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'lineStringMember': makeArrayPusher(\n GMLBase.prototype.lineStringMemberParser,\n ),\n 'lineStringMembers': makeArrayPusher(\n GMLBase.prototype.lineStringMemberParser,\n ),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.MULTIPOLYGON_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser),\n 'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.POINTMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.LINESTRINGMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.POLYGONMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.RING_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing),\n },\n};\n\nexport default GMLBase;\n","/**\n * @module ol/format/xsd\n */\nimport {padNumber} from '../string.js';\nimport {getAllTextContent, getDocument} from '../xml.js';\n\n/**\n * @param {Node} node Node.\n * @return {boolean|undefined} Boolean.\n */\nexport function readBoolean(node) {\n const s = getAllTextContent(node, false);\n return readBooleanString(s);\n}\n\n/**\n * @param {string} string String.\n * @return {boolean|undefined} Boolean.\n */\nexport function readBooleanString(string) {\n const m = /^\\s*(true|1)|(false|0)\\s*$/.exec(string);\n if (m) {\n return m[1] !== undefined || false;\n }\n return undefined;\n}\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} DateTime in seconds.\n */\nexport function readDateTime(node) {\n const s = getAllTextContent(node, false);\n const dateTime = Date.parse(s);\n return isNaN(dateTime) ? undefined : dateTime / 1000;\n}\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} Decimal.\n */\nexport function readDecimal(node) {\n const s = getAllTextContent(node, false);\n return readDecimalString(s);\n}\n\n/**\n * @param {string} string String.\n * @return {number|undefined} Decimal.\n */\nexport function readDecimalString(string) {\n // FIXME check spec\n const m = /^\\s*([+\\-]?\\d*\\.?\\d+(?:e[+\\-]?\\d+)?)\\s*$/i.exec(string);\n if (m) {\n return parseFloat(m[1]);\n }\n return undefined;\n}\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} Non negative integer.\n */\nexport function readPositiveInteger(node) {\n const s = getAllTextContent(node, false);\n return readNonNegativeIntegerString(s);\n}\n\n/**\n * @param {string} string String.\n * @return {number|undefined} Non negative integer.\n */\nexport function readNonNegativeIntegerString(string) {\n const m = /^\\s*(\\d+)\\s*$/.exec(string);\n if (m) {\n return parseInt(m[1], 10);\n }\n return undefined;\n}\n\n/**\n * @param {Node} node Node.\n * @return {string|undefined} String.\n */\nexport function readString(node) {\n return getAllTextContent(node, false).trim();\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the boolean to.\n * @param {boolean} bool Boolean.\n */\nexport function writeBooleanTextNode(node, bool) {\n writeStringTextNode(node, bool ? '1' : '0');\n}\n\n/**\n * @param {Node} node Node to append a CDATA Section with the string to.\n * @param {string} string String.\n */\nexport function writeCDATASection(node, string) {\n node.appendChild(getDocument().createCDATASection(string));\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the dateTime to.\n * @param {number} dateTime DateTime in seconds.\n */\nexport function writeDateTimeTextNode(node, dateTime) {\n const date = new Date(dateTime * 1000);\n const string =\n date.getUTCFullYear() +\n '-' +\n padNumber(date.getUTCMonth() + 1, 2) +\n '-' +\n padNumber(date.getUTCDate(), 2) +\n 'T' +\n padNumber(date.getUTCHours(), 2) +\n ':' +\n padNumber(date.getUTCMinutes(), 2) +\n ':' +\n padNumber(date.getUTCSeconds(), 2) +\n 'Z';\n node.appendChild(getDocument().createTextNode(string));\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the decimal to.\n * @param {number} decimal Decimal.\n */\nexport function writeDecimalTextNode(node, decimal) {\n const string = decimal.toPrecision();\n node.appendChild(getDocument().createTextNode(string));\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the decimal to.\n * @param {number} nonNegativeInteger Non negative integer.\n */\nexport function writeNonNegativeIntegerTextNode(node, nonNegativeInteger) {\n const string = nonNegativeInteger.toString();\n node.appendChild(getDocument().createTextNode(string));\n}\n\nconst whiteSpaceStart = /^\\s/;\nconst whiteSpaceEnd = /\\s$/;\nconst cdataCharacters = /(\\n|\\t|\\r|<|&| {2})/;\n\n/**\n * @param {Node} node Node to append a TextNode with the string to.\n * @param {string} string String.\n */\nexport function writeStringTextNode(node, string) {\n if (\n typeof string === 'string' &&\n (whiteSpaceStart.test(string) ||\n whiteSpaceEnd.test(string) ||\n cdataCharacters.test(string))\n ) {\n string.split(']]>').forEach((part, i, a) => {\n if (i < a.length - 1) {\n part += ']]';\n }\n if (i > 0) {\n part = '>' + part;\n }\n writeCDATASection(node, part);\n });\n } else {\n node.appendChild(getDocument().createTextNode(string));\n }\n}\n","/**\n * @module ol/format/GML2\n */\nimport {createOrUpdate} from '../extent.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n OBJECT_PROPERTY_NODE_FACTORY,\n createElementNS,\n getAllTextContent,\n makeArrayPusher,\n makeChildAppender,\n makeReplacer,\n makeSimpleNodeFactory,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport {\n transformExtentWithOptions,\n transformGeometryWithOptions,\n} from './Feature.js';\nimport GMLBase, {GMLNS} from './GMLBase.js';\nimport {writeStringTextNode} from './xsd.js';\n\n/**\n * @const\n * @type {string}\n */\nconst schemaLocation =\n GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xsd';\n\n/**\n * @const\n * @type {Object<string, string>}\n */\nconst MULTIGEOMETRY_TO_MEMBER_NODENAME = {\n 'MultiLineString': 'lineStringMember',\n 'MultiCurve': 'curveMember',\n 'MultiPolygon': 'polygonMember',\n 'MultiSurface': 'surfaceMember',\n};\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GML format,\n * version 2.1.2.\n *\n * @api\n */\nclass GML2 extends GMLBase {\n /**\n * @param {import(\"./GMLBase.js\").Options} [options] Optional configuration object.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(options);\n\n this.FEATURE_COLLECTION_PARSERS[GMLNS]['featureMember'] = makeArrayPusher(\n this.readFeaturesInternal,\n );\n\n /**\n * @type {string}\n */\n this.schemaLocation = options.schemaLocation\n ? options.schemaLocation\n : schemaLocation;\n }\n\n /**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>|undefined} Flat coordinates.\n */\n readFlatCoordinates(node, objectStack) {\n const s = getAllTextContent(node, false).replace(/^\\s*|\\s*$/g, '');\n const context = /** @type {import(\"../xml.js\").NodeStackItem} */ (\n objectStack[0]\n );\n const containerSrs = context['srsName'];\n let axisOrientation = 'enu';\n if (containerSrs) {\n const proj = getProjection(containerSrs);\n if (proj) {\n axisOrientation = proj.getAxisOrientation();\n }\n }\n const coordsGroups = s.trim().split(/\\s+/);\n const flatCoordinates = [];\n for (let i = 0, ii = coordsGroups.length; i < ii; i++) {\n const coords = coordsGroups[i].split(/,+/);\n const x = parseFloat(coords[0]);\n const y = parseFloat(coords[1]);\n const z = coords.length === 3 ? parseFloat(coords[2]) : 0;\n if (axisOrientation.startsWith('en')) {\n flatCoordinates.push(x, y, z);\n } else {\n flatCoordinates.push(y, x, z);\n }\n }\n return flatCoordinates;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../extent.js\").Extent|undefined} Envelope.\n */\n readBox(node, objectStack) {\n /** @type {Array<number>} */\n const flatCoordinates = pushParseAndPop(\n [null],\n this.BOX_PARSERS_,\n node,\n objectStack,\n this,\n );\n return createOrUpdate(\n flatCoordinates[1][0],\n flatCoordinates[1][1],\n flatCoordinates[1][3],\n flatCoordinates[1][4],\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n innerBoundaryIsParser(node, objectStack) {\n /** @type {Array<number>|undefined} */\n const flatLinearRing = pushParseAndPop(\n undefined,\n this.RING_PARSERS,\n node,\n objectStack,\n this,\n );\n if (flatLinearRing) {\n const flatLinearRings =\n /** @type {Array<Array<number>>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings.push(flatLinearRing);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n outerBoundaryIsParser(node, objectStack) {\n /** @type {Array<number>|undefined} */\n const flatLinearRing = pushParseAndPop(\n undefined,\n this.RING_PARSERS,\n node,\n objectStack,\n this,\n );\n if (flatLinearRing) {\n const flatLinearRings =\n /** @type {Array<Array<number>>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings[0] = flatLinearRing;\n }\n }\n\n /**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Element|undefined} Node.\n * @private\n */\n GEOMETRY_NODE_FACTORY_(value, objectStack, nodeName) {\n const context = objectStack[objectStack.length - 1];\n const multiSurface = context['multiSurface'];\n const surface = context['surface'];\n const multiCurve = context['multiCurve'];\n if (!Array.isArray(value)) {\n nodeName = /** @type {import(\"../geom/Geometry.js\").default} */ (\n value\n ).getType();\n if (nodeName === 'MultiPolygon' && multiSurface === true) {\n nodeName = 'MultiSurface';\n } else if (nodeName === 'Polygon' && surface === true) {\n nodeName = 'Surface';\n } else if (nodeName === 'MultiLineString' && multiCurve === true) {\n nodeName = 'MultiCurve';\n }\n } else {\n nodeName = 'Envelope';\n }\n return createElementNS('http://www.opengis.net/gml', nodeName);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {Array<*>} objectStack Node stack.\n */\n writeFeatureElement(node, feature, objectStack) {\n const fid = feature.getId();\n if (fid) {\n node.setAttribute('fid', /** @type {string} */ (fid));\n }\n const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const featureNS = context['featureNS'];\n const geometryName = feature.getGeometryName();\n if (!context.serializers) {\n context.serializers = {};\n context.serializers[featureNS] = {};\n }\n const keys = [];\n const values = [];\n if (feature.hasProperties()) {\n const properties = feature.getProperties();\n for (const key in properties) {\n const value = properties[key];\n if (value !== null && value !== undefined) {\n keys.push(key);\n values.push(value);\n if (\n key == geometryName ||\n typeof (/** @type {?} */ (value).getSimplifiedGeometry) ===\n 'function'\n ) {\n if (!(key in context.serializers[featureNS])) {\n context.serializers[featureNS][key] = makeChildAppender(\n this.writeGeometryElement,\n this,\n );\n }\n } else {\n if (!(key in context.serializers[featureNS])) {\n context.serializers[featureNS][key] =\n makeChildAppender(writeStringTextNode);\n }\n }\n }\n }\n }\n const item = Object.assign({}, context);\n item.node = node;\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n (item),\n context.serializers,\n makeSimpleNodeFactory(undefined, featureNS),\n values,\n objectStack,\n keys,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LineString.js\").default} geometry LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeCurveOrLineString(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (node.nodeName !== 'LineStringSegment' && srsName) {\n node.setAttribute('srsName', srsName);\n }\n if (\n node.nodeName === 'LineString' ||\n node.nodeName === 'LineStringSegment'\n ) {\n const coordinates = this.createCoordinatesNode_(node.namespaceURI);\n node.appendChild(coordinates);\n this.writeCoordinates_(coordinates, geometry, objectStack);\n } else if (node.nodeName === 'Curve') {\n const segments = createElementNS(node.namespaceURI, 'segments');\n node.appendChild(segments);\n this.writeCurveSegments_(segments, geometry, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LineString.js\").default} line LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeLineStringOrCurveMember(node, line, objectStack) {\n const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);\n if (child) {\n node.appendChild(child);\n this.writeCurveOrLineString(child, line, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/MultiLineString.js\").default} geometry MultiLineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiCurveOrLineString(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n const curve = context['curve'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const lines = geometry.getLineStrings();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName, curve: curve},\n this.LINESTRINGORCURVEMEMBER_SERIALIZERS,\n this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,\n lines,\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/Geometry.js\").default|import(\"../extent.js\").Extent} geometry Geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeGeometryElement(node, geometry, objectStack) {\n const context = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[objectStack.length - 1]\n );\n const item = Object.assign({}, context);\n item['node'] = node;\n let value;\n if (Array.isArray(geometry)) {\n value = transformExtentWithOptions(\n /** @type {import(\"../extent.js\").Extent} */ (geometry),\n context,\n );\n } else {\n value = transformGeometryWithOptions(\n /** @type {import(\"../geom/Geometry.js\").default} */ (geometry),\n true,\n context,\n );\n }\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n (item),\n this.GEOMETRY_SERIALIZERS,\n this.GEOMETRY_NODE_FACTORY_,\n [value],\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {string} namespaceURI XML namespace.\n * @return {Element} coordinates node.\n * @private\n */\n createCoordinatesNode_(namespaceURI) {\n const coordinates = createElementNS(namespaceURI, 'coordinates');\n coordinates.setAttribute('decimal', '.');\n coordinates.setAttribute('cs', ',');\n coordinates.setAttribute('ts', ' ');\n\n return coordinates;\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/LineString.js\").default|import(\"../geom/LinearRing.js\").default} value Geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeCoordinates_(node, value, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n // only 2d for simple features profile\n const points = value.getCoordinates();\n const len = points.length;\n const parts = new Array(len);\n for (let i = 0; i < len; ++i) {\n const point = points[i];\n parts[i] = this.getCoords_(point, srsName, hasZ);\n }\n writeStringTextNode(node, parts.join(' '));\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LineString.js\").default} line LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeCurveSegments_(node, line, objectStack) {\n const child = createElementNS(node.namespaceURI, 'LineStringSegment');\n node.appendChild(child);\n this.writeCurveOrLineString(child, line, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Polygon.js\").default} geometry Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeSurfaceOrPolygon(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n if (node.nodeName !== 'PolygonPatch' && srsName) {\n node.setAttribute('srsName', srsName);\n }\n if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {\n const rings = geometry.getLinearRings();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName},\n this.RING_SERIALIZERS,\n this.RING_NODE_FACTORY_,\n rings,\n objectStack,\n undefined,\n this,\n );\n } else if (node.nodeName === 'Surface') {\n const patches = createElementNS(node.namespaceURI, 'patches');\n node.appendChild(patches);\n this.writeSurfacePatches_(patches, geometry, objectStack);\n }\n }\n\n /**\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node} Node.\n * @private\n */\n RING_NODE_FACTORY_(value, objectStack, nodeName) {\n const context = objectStack[objectStack.length - 1];\n const parentNode = context.node;\n const exteriorWritten = context['exteriorWritten'];\n if (exteriorWritten === undefined) {\n context['exteriorWritten'] = true;\n }\n return createElementNS(\n parentNode.namespaceURI,\n exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs',\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Polygon.js\").default} polygon Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeSurfacePatches_(node, polygon, objectStack) {\n const child = createElementNS(node.namespaceURI, 'PolygonPatch');\n node.appendChild(child);\n this.writeSurfaceOrPolygon(child, polygon, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LinearRing.js\").default} ring LinearRing geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeRing(node, ring, objectStack) {\n const linearRing = createElementNS(node.namespaceURI, 'LinearRing');\n node.appendChild(linearRing);\n this.writeLinearRing(linearRing, ring, objectStack);\n }\n\n /**\n * @param {Array<number>} point Point geometry.\n * @param {string} [srsName] Optional srsName\n * @param {boolean} [hasZ] whether the geometry has a Z coordinate (is 3D) or not.\n * @return {string} The coords string.\n * @private\n */\n getCoords_(point, srsName, hasZ) {\n const axisOrientation = srsName\n ? getProjection(srsName).getAxisOrientation()\n : 'enu';\n let coords = axisOrientation.startsWith('en')\n ? point[0] + ',' + point[1]\n : point[1] + ',' + point[0];\n if (hasZ) {\n // For newly created points, Z can be undefined.\n const z = point[2] || 0;\n coords += ',' + z;\n }\n\n return coords;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Point.js\").default} geometry Point geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writePoint(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const coordinates = this.createCoordinatesNode_(node.namespaceURI);\n node.appendChild(coordinates);\n const point = geometry.getCoordinates();\n const coord = this.getCoords_(point, srsName, hasZ);\n writeStringTextNode(coordinates, coord);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/MultiPoint.js\").default} geometry MultiPoint geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiPoint(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const points = geometry.getPoints();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName},\n this.POINTMEMBER_SERIALIZERS,\n makeSimpleNodeFactory('pointMember'),\n points,\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Point.js\").default} point Point geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writePointMember(node, point, objectStack) {\n const child = createElementNS(node.namespaceURI, 'Point');\n node.appendChild(child);\n this.writePoint(child, point, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LinearRing.js\").default} geometry LinearRing geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeLinearRing(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const coordinates = this.createCoordinatesNode_(node.namespaceURI);\n node.appendChild(coordinates);\n this.writeCoordinates_(coordinates, geometry, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry MultiPolygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiSurfaceOrPolygon(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n const surface = context['surface'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const polygons = geometry.getPolygons();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName, surface: surface},\n this.SURFACEORPOLYGONMEMBER_SERIALIZERS,\n this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,\n polygons,\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/Polygon.js\").default} polygon Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeSurfaceOrPolygonMember(node, polygon, objectStack) {\n const child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack);\n if (child) {\n node.appendChild(child);\n this.writeSurfaceOrPolygon(child, polygon, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {Array<*>} objectStack Node stack.\n */\n writeEnvelope(node, extent, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const keys = ['lowerCorner', 'upperCorner'];\n const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n ({node: node}),\n this.ENVELOPE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n keys,\n this,\n );\n }\n\n /**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n * @private\n */\n MULTIGEOMETRY_MEMBER_NODE_FACTORY_(value, objectStack, nodeName) {\n const parentNode = objectStack[objectStack.length - 1].node;\n return createElementNS(\n 'http://www.opengis.net/gml',\n MULTIGEOMETRY_TO_MEMBER_NODENAME[parentNode.nodeName],\n );\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'coordinates': makeReplacer(GML2.prototype.readFlatCoordinates),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML2.prototype.FLAT_LINEAR_RINGS_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser,\n 'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser,\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML2.prototype.BOX_PARSERS_ = {\n 'http://www.opengis.net/gml': {\n 'coordinates': makeArrayPusher(GML2.prototype.readFlatCoordinates),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML2.prototype.GEOMETRY_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Point': makeReplacer(GMLBase.prototype.readPoint),\n 'MultiPoint': makeReplacer(GMLBase.prototype.readMultiPoint),\n 'LineString': makeReplacer(GMLBase.prototype.readLineString),\n 'MultiLineString': makeReplacer(GMLBase.prototype.readMultiLineString),\n 'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing),\n 'Polygon': makeReplacer(GMLBase.prototype.readPolygon),\n 'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),\n 'Box': makeReplacer(GML2.prototype.readBox),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML2.prototype.GEOMETRY_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'Curve': makeChildAppender(GML2.prototype.writeCurveOrLineString),\n 'MultiCurve': makeChildAppender(GML2.prototype.writeMultiCurveOrLineString),\n 'Point': makeChildAppender(GML2.prototype.writePoint),\n 'MultiPoint': makeChildAppender(GML2.prototype.writeMultiPoint),\n 'LineString': makeChildAppender(GML2.prototype.writeCurveOrLineString),\n 'MultiLineString': makeChildAppender(\n GML2.prototype.writeMultiCurveOrLineString,\n ),\n 'LinearRing': makeChildAppender(GML2.prototype.writeLinearRing),\n 'Polygon': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon),\n 'MultiPolygon': makeChildAppender(\n GML2.prototype.writeMultiSurfaceOrPolygon,\n ),\n 'Surface': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon),\n 'MultiSurface': makeChildAppender(\n GML2.prototype.writeMultiSurfaceOrPolygon,\n ),\n 'Envelope': makeChildAppender(GML2.prototype.writeEnvelope),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'lineStringMember': makeChildAppender(\n GML2.prototype.writeLineStringOrCurveMember,\n ),\n 'curveMember': makeChildAppender(\n GML2.prototype.writeLineStringOrCurveMember,\n ),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML2.prototype.RING_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'outerBoundaryIs': makeChildAppender(GML2.prototype.writeRing),\n 'innerBoundaryIs': makeChildAppender(GML2.prototype.writeRing),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML2.prototype.POINTMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'pointMember': makeChildAppender(GML2.prototype.writePointMember),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'surfaceMember': makeChildAppender(\n GML2.prototype.writeSurfaceOrPolygonMember,\n ),\n 'polygonMember': makeChildAppender(\n GML2.prototype.writeSurfaceOrPolygonMember,\n ),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML2.prototype.ENVELOPE_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'lowerCorner': makeChildAppender(writeStringTextNode),\n 'upperCorner': makeChildAppender(writeStringTextNode),\n },\n};\n\nexport default GML2;\n","/**\n * @module ol/format/GML3\n */\nimport {extend} from '../array.js';\nimport {createOrUpdate} from '../extent.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Polygon from '../geom/Polygon.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n OBJECT_PROPERTY_NODE_FACTORY,\n XML_SCHEMA_INSTANCE_URI,\n createElementNS,\n getAllTextContent,\n makeArrayExtender,\n makeArrayPusher,\n makeChildAppender,\n makeReplacer,\n makeSimpleNodeFactory,\n parseNode,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport {\n transformExtentWithOptions,\n transformGeometryWithOptions,\n} from './Feature.js';\nimport GML2 from './GML2.js';\nimport GMLBase, {GMLNS} from './GMLBase.js';\nimport {readNonNegativeIntegerString, writeStringTextNode} from './xsd.js';\n\n/**\n * @const\n * @type {string}\n * @private\n */\nconst schemaLocation =\n GMLNS +\n ' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' +\n '1.0.0/gmlsf.xsd';\n\n/**\n * @const\n * @type {Object<string, string>}\n */\nconst MULTIGEOMETRY_TO_MEMBER_NODENAME = {\n 'MultiLineString': 'lineStringMember',\n 'MultiCurve': 'curveMember',\n 'MultiPolygon': 'polygonMember',\n 'MultiSurface': 'surfaceMember',\n};\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GML format\n * version 3.1.1.\n * Currently only supports GML 3.1.1 Simple Features profile.\n *\n * @api\n */\nclass GML3 extends GMLBase {\n /**\n * @param {import(\"./GMLBase.js\").Options} [options] Optional configuration object.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(options);\n\n /**\n * @private\n * @type {boolean}\n */\n this.surface_ = options.surface !== undefined ? options.surface : false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.curve_ = options.curve !== undefined ? options.curve : false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.multiCurve_ =\n options.multiCurve !== undefined ? options.multiCurve : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.multiSurface_ =\n options.multiSurface !== undefined ? options.multiSurface : true;\n\n /**\n * @type {string}\n */\n this.schemaLocation = options.schemaLocation\n ? options.schemaLocation\n : schemaLocation;\n\n /**\n * @private\n * @type {boolean}\n */\n this.hasZ = options.hasZ !== undefined ? options.hasZ : false;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiLineString|undefined} MultiLineString.\n */\n readMultiCurve(node, objectStack) {\n /** @type {Array<LineString>} */\n const lineStrings = pushParseAndPop(\n [],\n this.MULTICURVE_PARSERS,\n node,\n objectStack,\n this,\n );\n if (lineStrings) {\n const multiLineString = new MultiLineString(lineStrings);\n return multiLineString;\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>|undefined} Polygon.\n */\n readFlatCurveRing(node, objectStack) {\n /** @type {Array<LineString>} */\n const lineStrings = pushParseAndPop(\n [],\n this.MULTICURVE_PARSERS,\n node,\n objectStack,\n this,\n );\n const flatCoordinates = [];\n for (let i = 0, ii = lineStrings.length; i < ii; ++i) {\n extend(flatCoordinates, lineStrings[i].getFlatCoordinates());\n }\n return flatCoordinates;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiPolygon|undefined} MultiPolygon.\n */\n readMultiSurface(node, objectStack) {\n /** @type {Array<Polygon>} */\n const polygons = pushParseAndPop(\n [],\n this.MULTISURFACE_PARSERS,\n node,\n objectStack,\n this,\n );\n if (polygons) {\n return new MultiPolygon(polygons);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n curveMemberParser(node, objectStack) {\n parseNode(this.CURVEMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n surfaceMemberParser(node, objectStack) {\n parseNode(this.SURFACEMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<(Array<number>)>|undefined} flat coordinates.\n */\n readPatch(node, objectStack) {\n return pushParseAndPop(\n [null],\n this.PATCHES_PARSERS,\n node,\n objectStack,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>|undefined} flat coordinates.\n */\n readSegment(node, objectStack) {\n return pushParseAndPop([], this.SEGMENTS_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<(Array<number>)>|undefined} flat coordinates.\n */\n readPolygonPatch(node, objectStack) {\n return pushParseAndPop(\n [null],\n this.FLAT_LINEAR_RINGS_PARSERS,\n node,\n objectStack,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>|undefined} flat coordinates.\n */\n readLineStringSegment(node, objectStack) {\n return pushParseAndPop(\n [null],\n this.GEOMETRY_FLAT_COORDINATES_PARSERS,\n node,\n objectStack,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n interiorParser(node, objectStack) {\n /** @type {Array<number>|undefined} */\n const flatLinearRing = pushParseAndPop(\n undefined,\n this.RING_PARSERS,\n node,\n objectStack,\n this,\n );\n if (flatLinearRing) {\n const flatLinearRings =\n /** @type {Array<Array<number>>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings.push(flatLinearRing);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n exteriorParser(node, objectStack) {\n /** @type {Array<number>|undefined} */\n const flatLinearRing = pushParseAndPop(\n undefined,\n this.RING_PARSERS,\n node,\n objectStack,\n this,\n );\n if (flatLinearRing) {\n const flatLinearRings =\n /** @type {Array<Array<number>>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings[0] = flatLinearRing;\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Polygon|undefined} Polygon.\n */\n readSurface(node, objectStack) {\n /** @type {Array<Array<number>>} */\n const flatLinearRings = pushParseAndPop(\n [null],\n this.SURFACE_PARSERS,\n node,\n objectStack,\n this,\n );\n if (flatLinearRings && flatLinearRings[0]) {\n const flatCoordinates = flatLinearRings[0];\n const ends = [flatCoordinates.length];\n let i, ii;\n for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {\n extend(flatCoordinates, flatLinearRings[i]);\n ends.push(flatCoordinates.length);\n }\n return new Polygon(flatCoordinates, 'XYZ', ends);\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {LineString|undefined} LineString.\n */\n readCurve(node, objectStack) {\n /** @type {Array<number>} */\n const flatCoordinates = pushParseAndPop(\n [null],\n this.CURVE_PARSERS,\n node,\n objectStack,\n this,\n );\n if (flatCoordinates) {\n const lineString = new LineString(flatCoordinates, 'XYZ');\n return lineString;\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../extent.js\").Extent|undefined} Envelope.\n */\n readEnvelope(node, objectStack) {\n /** @type {Array<number>} */\n const flatCoordinates = pushParseAndPop(\n [null],\n this.ENVELOPE_PARSERS,\n node,\n objectStack,\n this,\n );\n return createOrUpdate(\n flatCoordinates[1][0],\n flatCoordinates[1][1],\n flatCoordinates[2][0],\n flatCoordinates[2][1],\n );\n }\n\n /**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>|undefined} Flat coordinates.\n */\n readFlatPos(node, objectStack) {\n let s = getAllTextContent(node, false);\n const re = /^\\s*([+\\-]?\\d*\\.?\\d+(?:[eE][+\\-]?\\d+)?)\\s*/;\n /** @type {Array<number>} */\n const flatCoordinates = [];\n let m;\n while ((m = re.exec(s))) {\n flatCoordinates.push(parseFloat(m[1]));\n s = s.substr(m[0].length);\n }\n if (s !== '') {\n return undefined;\n }\n const context = objectStack[0];\n const containerSrs = context['srsName'];\n const axisOrientation = containerSrs\n ? getProjection(containerSrs).getAxisOrientation()\n : 'enu';\n if (axisOrientation === 'neu') {\n for (let i = 0, ii = flatCoordinates.length; i < ii; i += 3) {\n const y = flatCoordinates[i];\n const x = flatCoordinates[i + 1];\n flatCoordinates[i] = x;\n flatCoordinates[i + 1] = y;\n }\n }\n const len = flatCoordinates.length;\n if (len == 2) {\n flatCoordinates.push(0);\n }\n if (len === 0) {\n return undefined;\n }\n return flatCoordinates;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>|undefined} Flat coordinates.\n */\n readFlatPosList(node, objectStack) {\n const s = getAllTextContent(node, false).replace(/^\\s*|\\s*$/g, '');\n const context = objectStack[0];\n const containerSrs = context['srsName'];\n const contextDimension = context['srsDimension'];\n const axisOrientation = containerSrs\n ? getProjection(containerSrs).getAxisOrientation()\n : 'enu';\n const coords = s.split(/\\s+/);\n // The \"dimension\" attribute is from the GML 3.0.1 spec.\n let dim = 2;\n if (node.getAttribute('srsDimension')) {\n dim = readNonNegativeIntegerString(node.getAttribute('srsDimension'));\n } else if (node.getAttribute('dimension')) {\n dim = readNonNegativeIntegerString(node.getAttribute('dimension'));\n } else if (\n /** @type {Element} */ (node.parentNode).getAttribute('srsDimension')\n ) {\n dim = readNonNegativeIntegerString(\n /** @type {Element} */ (node.parentNode).getAttribute('srsDimension'),\n );\n } else if (contextDimension) {\n dim = readNonNegativeIntegerString(contextDimension);\n }\n const asXYZ = axisOrientation.startsWith('en');\n let x, y, z;\n const flatCoordinates = [];\n for (let i = 0, ii = coords.length; i < ii; i += dim) {\n x = parseFloat(coords[i]);\n y = parseFloat(coords[i + 1]);\n z = dim === 3 ? parseFloat(coords[i + 2]) : 0;\n if (asXYZ) {\n flatCoordinates.push(x, y, z);\n } else {\n flatCoordinates.push(y, x, z);\n }\n }\n return flatCoordinates;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Point.js\").default} value Point geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writePos_(node, value, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsDimension = hasZ ? '3' : '2';\n node.setAttribute('srsDimension', srsDimension);\n const srsName = context['srsName'];\n const axisOrientation = srsName\n ? getProjection(srsName).getAxisOrientation()\n : 'enu';\n const point = value.getCoordinates();\n // only 2d for simple features profile\n let coords = axisOrientation.startsWith('en')\n ? point[0] + ' ' + point[1]\n : point[1] + ' ' + point[0];\n if (hasZ) {\n // For newly created points, Z can be undefined.\n const z = point[2] || 0;\n coords += ' ' + z;\n }\n writeStringTextNode(node, coords);\n }\n\n /**\n * @param {Array<number>} point Point geometry.\n * @param {string} [srsName] Optional srsName\n * @param {boolean} [hasZ] whether the geometry has a Z coordinate (is 3D) or not.\n * @return {string} The coords string.\n * @private\n */\n getCoords_(point, srsName, hasZ) {\n const axisOrientation = srsName\n ? getProjection(srsName).getAxisOrientation()\n : 'enu';\n let coords = axisOrientation.startsWith('en')\n ? point[0] + ' ' + point[1]\n : point[1] + ' ' + point[0];\n if (hasZ) {\n // For newly created points, Z can be undefined.\n const z = point[2] || 0;\n coords += ' ' + z;\n }\n\n return coords;\n }\n\n /**\n * @param {Element} node Node.\n * @param {LineString|import(\"../geom/LinearRing.js\").default} value Geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writePosList_(node, value, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsDimension = hasZ ? '3' : '2';\n node.setAttribute('srsDimension', srsDimension);\n const srsName = context['srsName'];\n // only 2d for simple features profile\n const points = value.getCoordinates();\n const len = points.length;\n const parts = new Array(len);\n let point;\n for (let i = 0; i < len; ++i) {\n point = points[i];\n parts[i] = this.getCoords_(point, srsName, hasZ);\n }\n writeStringTextNode(node, parts.join(' '));\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Point.js\").default} geometry Point geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writePoint(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const pos = createElementNS(node.namespaceURI, 'pos');\n node.appendChild(pos);\n this.writePos_(pos, geometry, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {Array<*>} objectStack Node stack.\n */\n writeEnvelope(node, extent, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const keys = ['lowerCorner', 'upperCorner'];\n const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n ({node: node}),\n this.ENVELOPE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n keys,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LinearRing.js\").default} geometry LinearRing geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeLinearRing(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const posList = createElementNS(node.namespaceURI, 'posList');\n node.appendChild(posList);\n this.writePosList_(posList, geometry, objectStack);\n }\n\n /**\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node} Node.\n * @private\n */\n RING_NODE_FACTORY_(value, objectStack, nodeName) {\n const context = objectStack[objectStack.length - 1];\n const parentNode = context.node;\n const exteriorWritten = context['exteriorWritten'];\n if (exteriorWritten === undefined) {\n context['exteriorWritten'] = true;\n }\n return createElementNS(\n parentNode.namespaceURI,\n exteriorWritten !== undefined ? 'interior' : 'exterior',\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Polygon} geometry Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeSurfaceOrPolygon(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n if (node.nodeName !== 'PolygonPatch' && srsName) {\n node.setAttribute('srsName', srsName);\n }\n if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {\n const rings = geometry.getLinearRings();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName},\n this.RING_SERIALIZERS,\n this.RING_NODE_FACTORY_,\n rings,\n objectStack,\n undefined,\n this,\n );\n } else if (node.nodeName === 'Surface') {\n const patches = createElementNS(node.namespaceURI, 'patches');\n node.appendChild(patches);\n this.writeSurfacePatches_(patches, geometry, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {LineString} geometry LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeCurveOrLineString(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (node.nodeName !== 'LineStringSegment' && srsName) {\n node.setAttribute('srsName', srsName);\n }\n if (\n node.nodeName === 'LineString' ||\n node.nodeName === 'LineStringSegment'\n ) {\n const posList = createElementNS(node.namespaceURI, 'posList');\n node.appendChild(posList);\n this.writePosList_(posList, geometry, objectStack);\n } else if (node.nodeName === 'Curve') {\n const segments = createElementNS(node.namespaceURI, 'segments');\n node.appendChild(segments);\n this.writeCurveSegments_(segments, geometry, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {MultiPolygon} geometry MultiPolygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiSurfaceOrPolygon(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n const surface = context['surface'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const polygons = geometry.getPolygons();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName, surface: surface},\n this.SURFACEORPOLYGONMEMBER_SERIALIZERS,\n this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,\n polygons,\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/MultiPoint.js\").default} geometry MultiPoint geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiPoint(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n const hasZ = context['hasZ'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const points = geometry.getPoints();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName},\n this.POINTMEMBER_SERIALIZERS,\n makeSimpleNodeFactory('pointMember'),\n points,\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {MultiLineString} geometry MultiLineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiCurveOrLineString(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n const curve = context['curve'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const lines = geometry.getLineStrings();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName, curve: curve},\n this.LINESTRINGORCURVEMEMBER_SERIALIZERS,\n this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,\n lines,\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LinearRing.js\").default} ring LinearRing geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeRing(node, ring, objectStack) {\n const linearRing = createElementNS(node.namespaceURI, 'LinearRing');\n node.appendChild(linearRing);\n this.writeLinearRing(linearRing, ring, objectStack);\n }\n\n /**\n * @param {Node} node Node.\n * @param {Polygon} polygon Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeSurfaceOrPolygonMember(node, polygon, objectStack) {\n const child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack);\n if (child) {\n node.appendChild(child);\n this.writeSurfaceOrPolygon(child, polygon, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Point.js\").default} point Point geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writePointMember(node, point, objectStack) {\n const child = createElementNS(node.namespaceURI, 'Point');\n node.appendChild(child);\n this.writePoint(child, point, objectStack);\n }\n\n /**\n * @param {Node} node Node.\n * @param {LineString} line LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeLineStringOrCurveMember(node, line, objectStack) {\n const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);\n if (child) {\n node.appendChild(child);\n this.writeCurveOrLineString(child, line, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Polygon} polygon Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeSurfacePatches_(node, polygon, objectStack) {\n const child = createElementNS(node.namespaceURI, 'PolygonPatch');\n node.appendChild(child);\n this.writeSurfaceOrPolygon(child, polygon, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {LineString} line LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeCurveSegments_(node, line, objectStack) {\n const child = createElementNS(node.namespaceURI, 'LineStringSegment');\n node.appendChild(child);\n this.writeCurveOrLineString(child, line, objectStack);\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/Geometry.js\").default|import(\"../extent.js\").Extent} geometry Geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeGeometryElement(node, geometry, objectStack) {\n const context = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[objectStack.length - 1]\n );\n const item = Object.assign({}, context);\n item['node'] = node;\n let value;\n if (Array.isArray(geometry)) {\n value = transformExtentWithOptions(\n /** @type {import(\"../extent.js\").Extent} */ (geometry),\n context,\n );\n } else {\n value = transformGeometryWithOptions(\n /** @type {import(\"../geom/Geometry.js\").default} */ (geometry),\n true,\n context,\n );\n }\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n (item),\n this.GEOMETRY_SERIALIZERS,\n this.GEOMETRY_NODE_FACTORY_,\n [value],\n objectStack,\n undefined,\n this,\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {Array<*>} objectStack Node stack.\n */\n writeFeatureElement(node, feature, objectStack) {\n const fid = feature.getId();\n if (fid) {\n node.setAttribute('fid', /** @type {string} */ (fid));\n }\n const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const featureNS = context['featureNS'];\n const geometryName = feature.getGeometryName();\n if (!context.serializers) {\n context.serializers = {};\n context.serializers[featureNS] = {};\n }\n const keys = [];\n const values = [];\n if (feature.hasProperties()) {\n const properties = feature.getProperties();\n for (const key in properties) {\n const value = properties[key];\n if (value !== null && value !== undefined) {\n keys.push(key);\n values.push(value);\n if (\n key == geometryName ||\n typeof (/** @type {?} */ (value).getSimplifiedGeometry) ===\n 'function'\n ) {\n if (!(key in context.serializers[featureNS])) {\n context.serializers[featureNS][key] = makeChildAppender(\n this.writeGeometryElement,\n this,\n );\n }\n } else {\n if (!(key in context.serializers[featureNS])) {\n context.serializers[featureNS][key] =\n makeChildAppender(writeStringTextNode);\n }\n }\n }\n }\n }\n const item = Object.assign({}, context);\n item.node = node;\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n (item),\n context.serializers,\n makeSimpleNodeFactory(undefined, featureNS),\n values,\n objectStack,\n keys,\n );\n }\n\n /**\n * @param {Node} node Node.\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeFeatureMembers_(node, features, objectStack) {\n const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const featureType = context['featureType'];\n const featureNS = context['featureNS'];\n /** @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>} */\n const serializers = {};\n serializers[featureNS] = {};\n serializers[featureNS][featureType] = makeChildAppender(\n this.writeFeatureElement,\n this,\n );\n const item = Object.assign({}, context);\n item.node = node;\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n (item),\n serializers,\n makeSimpleNodeFactory(featureType, featureNS),\n features,\n objectStack,\n );\n }\n\n /**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n * @private\n */\n MULTIGEOMETRY_MEMBER_NODE_FACTORY_(value, objectStack, nodeName) {\n const parentNode = objectStack[objectStack.length - 1].node;\n return createElementNS(\n this.namespace,\n MULTIGEOMETRY_TO_MEMBER_NODENAME[parentNode.nodeName],\n );\n }\n\n /**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Element|undefined} Node.\n * @private\n */\n GEOMETRY_NODE_FACTORY_(value, objectStack, nodeName) {\n const context = objectStack[objectStack.length - 1];\n const multiSurface = context['multiSurface'];\n const surface = context['surface'];\n const curve = context['curve'];\n const multiCurve = context['multiCurve'];\n if (!Array.isArray(value)) {\n nodeName = /** @type {import(\"../geom/Geometry.js\").default} */ (\n value\n ).getType();\n if (nodeName === 'MultiPolygon' && multiSurface === true) {\n nodeName = 'MultiSurface';\n } else if (nodeName === 'Polygon' && surface === true) {\n nodeName = 'Surface';\n } else if (nodeName === 'LineString' && curve === true) {\n nodeName = 'Curve';\n } else if (nodeName === 'MultiLineString' && multiCurve === true) {\n nodeName = 'MultiCurve';\n }\n } else {\n nodeName = 'Envelope';\n }\n return createElementNS(this.namespace, nodeName);\n }\n\n /**\n * Encode a geometry in GML 3.1.1 Simple Features.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Node} Node.\n * @api\n * @override\n */\n writeGeometryNode(geometry, options) {\n options = this.adaptOptions(options);\n const geom = createElementNS(this.namespace, 'geom');\n const context = {\n node: geom,\n hasZ: this.hasZ,\n srsName: this.srsName,\n curve: this.curve_,\n surface: this.surface_,\n multiSurface: this.multiSurface_,\n multiCurve: this.multiCurve_,\n };\n if (options) {\n Object.assign(context, options);\n }\n this.writeGeometryElement(geom, geometry, [context]);\n return geom;\n }\n\n /**\n * Encode an array of features in the GML 3.1.1 format as an XML node.\n *\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Element} Node.\n * @api\n * @override\n */\n writeFeaturesNode(features, options) {\n options = this.adaptOptions(options);\n const node = createElementNS(this.namespace, 'featureMembers');\n node.setAttributeNS(\n XML_SCHEMA_INSTANCE_URI,\n 'xsi:schemaLocation',\n this.schemaLocation,\n );\n const context = {\n srsName: this.srsName,\n hasZ: this.hasZ,\n curve: this.curve_,\n surface: this.surface_,\n multiSurface: this.multiSurface_,\n multiCurve: this.multiCurve_,\n featureNS: this.featureNS,\n featureType: this.featureType,\n };\n if (options) {\n Object.assign(context, options);\n }\n this.writeFeatureMembers_(node, features, [context]);\n return node;\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'pos': makeReplacer(GML3.prototype.readFlatPos),\n 'posList': makeReplacer(GML3.prototype.readFlatPosList),\n 'coordinates': makeReplacer(GML2.prototype.readFlatCoordinates),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.FLAT_LINEAR_RINGS_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'interior': GML3.prototype.interiorParser,\n 'exterior': GML3.prototype.exteriorParser,\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.GEOMETRY_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Point': makeReplacer(GMLBase.prototype.readPoint),\n 'MultiPoint': makeReplacer(GMLBase.prototype.readMultiPoint),\n 'LineString': makeReplacer(GMLBase.prototype.readLineString),\n 'MultiLineString': makeReplacer(GMLBase.prototype.readMultiLineString),\n 'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing),\n 'Polygon': makeReplacer(GMLBase.prototype.readPolygon),\n 'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),\n 'Surface': makeReplacer(GML3.prototype.readSurface),\n 'MultiSurface': makeReplacer(GML3.prototype.readMultiSurface),\n 'Curve': makeReplacer(GML3.prototype.readCurve),\n 'MultiCurve': makeReplacer(GML3.prototype.readMultiCurve),\n 'Envelope': makeReplacer(GML3.prototype.readEnvelope),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.MULTICURVE_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'curveMember': makeArrayPusher(GML3.prototype.curveMemberParser),\n 'curveMembers': makeArrayPusher(GML3.prototype.curveMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.MULTISURFACE_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'surfaceMember': makeArrayPusher(GML3.prototype.surfaceMemberParser),\n 'surfaceMembers': makeArrayPusher(GML3.prototype.surfaceMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.CURVEMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),\n 'Curve': makeArrayPusher(GML3.prototype.readCurve),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.SURFACEMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),\n 'Surface': makeArrayPusher(GML3.prototype.readSurface),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.SURFACE_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'patches': makeReplacer(GML3.prototype.readPatch),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.CURVE_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'segments': makeReplacer(GML3.prototype.readSegment),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.ENVELOPE_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'lowerCorner': makeArrayPusher(GML3.prototype.readFlatPosList),\n 'upperCorner': makeArrayPusher(GML3.prototype.readFlatPosList),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.PATCHES_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'PolygonPatch': makeReplacer(GML3.prototype.readPolygonPatch),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML3.prototype.SEGMENTS_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'LineStringSegment': makeArrayExtender(\n GML3.prototype.readLineStringSegment,\n ),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGMLBase.prototype.RING_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing),\n 'Ring': makeReplacer(GML3.prototype.readFlatCurveRing),\n },\n};\n\n/**\n * Encode an array of features in GML 3.1.1 Simple Features.\n *\n * @function\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {string} Result.\n * @api\n */\nGML3.prototype.writeFeatures;\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML3.prototype.RING_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'exterior': makeChildAppender(GML3.prototype.writeRing),\n 'interior': makeChildAppender(GML3.prototype.writeRing),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML3.prototype.ENVELOPE_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'lowerCorner': makeChildAppender(writeStringTextNode),\n 'upperCorner': makeChildAppender(writeStringTextNode),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'surfaceMember': makeChildAppender(\n GML3.prototype.writeSurfaceOrPolygonMember,\n ),\n 'polygonMember': makeChildAppender(\n GML3.prototype.writeSurfaceOrPolygonMember,\n ),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML3.prototype.POINTMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'pointMember': makeChildAppender(GML3.prototype.writePointMember),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'lineStringMember': makeChildAppender(\n GML3.prototype.writeLineStringOrCurveMember,\n ),\n 'curveMember': makeChildAppender(\n GML3.prototype.writeLineStringOrCurveMember,\n ),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML3.prototype.GEOMETRY_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'Curve': makeChildAppender(GML3.prototype.writeCurveOrLineString),\n 'MultiCurve': makeChildAppender(GML3.prototype.writeMultiCurveOrLineString),\n 'Point': makeChildAppender(GML3.prototype.writePoint),\n 'MultiPoint': makeChildAppender(GML3.prototype.writeMultiPoint),\n 'LineString': makeChildAppender(GML3.prototype.writeCurveOrLineString),\n 'MultiLineString': makeChildAppender(\n GML3.prototype.writeMultiCurveOrLineString,\n ),\n 'LinearRing': makeChildAppender(GML3.prototype.writeLinearRing),\n 'Polygon': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),\n 'MultiPolygon': makeChildAppender(\n GML3.prototype.writeMultiSurfaceOrPolygon,\n ),\n 'Surface': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),\n 'MultiSurface': makeChildAppender(\n GML3.prototype.writeMultiSurfaceOrPolygon,\n ),\n 'Envelope': makeChildAppender(GML3.prototype.writeEnvelope),\n },\n};\n\nexport default GML3;\n","/**\n * @module ol/format/GML\n */\nimport GML3 from './GML3.js';\n\n/**\n * Feature format for reading and writing data in the GML format\n * version 3.1.1.\n * Currently only supports GML 3.1.1 Simple Features profile.\n *\n * @class\n * @param {import(\"./GMLBase.js\").Options} [options]\n * Optional configuration object.\n * @api\n */\nconst GML = GML3;\n\n/**\n * Encode an array of features in GML 3.1.1 Simple Features.\n *\n * @function\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {string} Result.\n * @api\n */\nGML.prototype.writeFeatures;\n\n/**\n * Encode an array of features in the GML 3.1.1 format as an XML node.\n *\n * @function\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Node} Node.\n * @api\n */\nGML.prototype.writeFeaturesNode;\n\nexport default GML;\n","/**\n * @module ol/format/GML32\n */\nimport {writeStringTextNode} from '../format/xsd.js';\nimport {\n makeArrayExtender,\n makeArrayPusher,\n makeChildAppender,\n makeReplacer,\n} from '../xml.js';\nimport GML2 from './GML2.js';\nimport GML3 from './GML3.js';\nimport GMLBase from './GMLBase.js';\n\n/**\n * @classdesc Feature format for reading and writing data in the GML format\n * version 3.2.1.\n * @api\n */\nclass GML32 extends GML3 {\n /**\n * @param {import(\"./GMLBase.js\").Options} [options] Optional configuration object.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(options);\n\n /**\n * @type {string}\n */\n this.schemaLocation = options.schemaLocation\n ? options.schemaLocation\n : this.namespace + ' http://schemas.opengis.net/gml/3.2.1/gml.xsd';\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/Geometry.js\").default|import(\"../extent.js\").Extent} geometry Geometry.\n * @param {Array<*>} objectStack Node stack.\n * @override\n */\n writeGeometryElement(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n objectStack[objectStack.length - 1] = Object.assign(\n {multiCurve: true, multiSurface: true},\n context,\n );\n super.writeGeometryElement(node, geometry, objectStack);\n }\n}\n\nGML32.prototype.namespace = 'http://www.opengis.net/gml/3.2';\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'pos': makeReplacer(GML3.prototype.readFlatPos),\n 'posList': makeReplacer(GML3.prototype.readFlatPosList),\n 'coordinates': makeReplacer(GML2.prototype.readFlatCoordinates),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.FLAT_LINEAR_RINGS_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'interior': GML3.prototype.interiorParser,\n 'exterior': GML3.prototype.exteriorParser,\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.GEOMETRY_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'Point': makeReplacer(GMLBase.prototype.readPoint),\n 'MultiPoint': makeReplacer(GMLBase.prototype.readMultiPoint),\n 'LineString': makeReplacer(GMLBase.prototype.readLineString),\n 'MultiLineString': makeReplacer(GMLBase.prototype.readMultiLineString),\n 'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing),\n 'Polygon': makeReplacer(GMLBase.prototype.readPolygon),\n 'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),\n 'Surface': makeReplacer(GML32.prototype.readSurface),\n 'MultiSurface': makeReplacer(GML3.prototype.readMultiSurface),\n 'Curve': makeReplacer(GML32.prototype.readCurve),\n 'MultiCurve': makeReplacer(GML3.prototype.readMultiCurve),\n 'Envelope': makeReplacer(GML32.prototype.readEnvelope),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.MULTICURVE_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'curveMember': makeArrayPusher(GML3.prototype.curveMemberParser),\n 'curveMembers': makeArrayPusher(GML3.prototype.curveMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.MULTISURFACE_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'surfaceMember': makeArrayPusher(GML3.prototype.surfaceMemberParser),\n 'surfaceMembers': makeArrayPusher(GML3.prototype.surfaceMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.CURVEMEMBER_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),\n 'Curve': makeArrayPusher(GML3.prototype.readCurve),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.SURFACEMEMBER_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),\n 'Surface': makeArrayPusher(GML3.prototype.readSurface),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.SURFACE_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'patches': makeReplacer(GML3.prototype.readPatch),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.CURVE_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'segments': makeReplacer(GML3.prototype.readSegment),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.ENVELOPE_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'lowerCorner': makeArrayPusher(GML3.prototype.readFlatPosList),\n 'upperCorner': makeArrayPusher(GML3.prototype.readFlatPosList),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.PATCHES_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'PolygonPatch': makeReplacer(GML3.prototype.readPolygonPatch),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.SEGMENTS_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'LineStringSegment': makeArrayExtender(\n GML3.prototype.readLineStringSegment,\n ),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.MULTIPOINT_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser),\n 'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.MULTILINESTRING_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'lineStringMember': makeArrayPusher(\n GMLBase.prototype.lineStringMemberParser,\n ),\n 'lineStringMembers': makeArrayPusher(\n GMLBase.prototype.lineStringMemberParser,\n ),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.MULTIPOLYGON_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser),\n 'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.POINTMEMBER_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.LINESTRINGMEMBER_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.POLYGONMEMBER_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nGML32.prototype.RING_PARSERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing),\n 'Ring': makeReplacer(GML32.prototype.readFlatCurveRing),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML32.prototype.RING_SERIALIZERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'exterior': makeChildAppender(GML3.prototype.writeRing),\n 'interior': makeChildAppender(GML3.prototype.writeRing),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML32.prototype.ENVELOPE_SERIALIZERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'lowerCorner': makeChildAppender(writeStringTextNode),\n 'upperCorner': makeChildAppender(writeStringTextNode),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML32.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'surfaceMember': makeChildAppender(\n GML3.prototype.writeSurfaceOrPolygonMember,\n ),\n 'polygonMember': makeChildAppender(\n GML3.prototype.writeSurfaceOrPolygonMember,\n ),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML32.prototype.POINTMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'pointMember': makeChildAppender(GML3.prototype.writePointMember),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML32.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'lineStringMember': makeChildAppender(\n GML3.prototype.writeLineStringOrCurveMember,\n ),\n 'curveMember': makeChildAppender(\n GML3.prototype.writeLineStringOrCurveMember,\n ),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nGML32.prototype.GEOMETRY_SERIALIZERS = {\n 'http://www.opengis.net/gml/3.2': {\n 'Curve': makeChildAppender(GML3.prototype.writeCurveOrLineString),\n 'MultiCurve': makeChildAppender(GML3.prototype.writeMultiCurveOrLineString),\n 'Point': makeChildAppender(GML32.prototype.writePoint),\n 'MultiPoint': makeChildAppender(GML3.prototype.writeMultiPoint),\n 'LineString': makeChildAppender(GML3.prototype.writeCurveOrLineString),\n 'MultiLineString': makeChildAppender(\n GML3.prototype.writeMultiCurveOrLineString,\n ),\n 'LinearRing': makeChildAppender(GML3.prototype.writeLinearRing),\n 'Polygon': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),\n 'MultiPolygon': makeChildAppender(\n GML3.prototype.writeMultiSurfaceOrPolygon,\n ),\n 'Surface': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),\n 'MultiSurface': makeChildAppender(\n GML3.prototype.writeMultiSurfaceOrPolygon,\n ),\n 'Envelope': makeChildAppender(GML3.prototype.writeEnvelope),\n },\n};\n\nexport default GML32;\n","/**\n * @module ol/format/GPX\n */\nimport Feature from '../Feature.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport Point from '../geom/Point.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n OBJECT_PROPERTY_NODE_FACTORY,\n XML_SCHEMA_INSTANCE_URI,\n createElementNS,\n isDocument,\n makeArrayPusher,\n makeArraySerializer,\n makeChildAppender,\n makeObjectPropertySetter,\n makeSequence,\n makeSimpleNodeFactory,\n makeStructureNS,\n parse,\n parseNode,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport XMLFeature from './XMLFeature.js';\nimport {\n readDateTime,\n readDecimal,\n readPositiveInteger,\n readString,\n writeDateTimeTextNode,\n writeDecimalTextNode,\n writeNonNegativeIntegerTextNode,\n writeStringTextNode,\n} from './xsd.js';\n\n/**\n * @const\n * @type {Array<null|string>}\n */\nconst NAMESPACE_URIS = [\n null,\n 'http://www.topografix.com/GPX/1/0',\n 'http://www.topografix.com/GPX/1/1',\n];\n\n/**\n * @const\n * @type {string}\n */\nconst SCHEMA_LOCATION =\n 'http://www.topografix.com/GPX/1/1 ' +\n 'http://www.topografix.com/GPX/1/1/gpx.xsd';\n\n/**\n * @const\n * @type {Object<string, function(Node, Array<*>): (Feature|undefined)>}\n */\nconst FEATURE_READER = {\n 'rte': readRte,\n 'trk': readTrk,\n 'wpt': readWpt,\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst GPX_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'rte': makeArrayPusher(readRte),\n 'trk': makeArrayPusher(readTrk),\n 'wpt': makeArrayPusher(readWpt),\n});\n\n/**\n * @typedef {Object} GPXLink\n * @property {string} [text] text\n * @property {string} [type] type\n */\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LINK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'text': makeObjectPropertySetter(readString, 'linkText'),\n 'type': makeObjectPropertySetter(readString, 'linkType'),\n});\n\n/**\n * @typedef {Object} GPXAuthor\n * @property {string} [name] name\n * @property {string} [email] email\n * @property {GPXLink} [link] link\n */\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst AUTHOR_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeObjectPropertySetter(readString),\n 'email': parseEmail,\n 'link': parseLink,\n});\n\n/**\n * @typedef {Object} GPXMetadata\n * @property {string} [name] name\n * @property {string} [desc] desc\n * @property {GPXAuthor} [author] author\n * @property {GPXLink} [link] link\n * @property {number} [time] time\n * @property {string} [keywords] keywords\n * @property {Array<number>} [bounds] bounds\n * @property {Object} [extensions] extensions\n *\n */\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst METADATA_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeObjectPropertySetter(readString),\n 'desc': makeObjectPropertySetter(readString),\n 'author': makeObjectPropertySetter(readAuthor),\n 'copyright': makeObjectPropertySetter(readCopyright),\n 'link': parseLink,\n 'time': makeObjectPropertySetter(readDateTime),\n 'keywords': makeObjectPropertySetter(readString),\n 'bounds': parseBounds,\n 'extensions': parseExtensions,\n});\n\n/**\n * @typedef {Object} GPXCopyright\n * @property {string} [author] author\n * @property {number} [year] year\n * @property {string} [license] license\n */\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst COPYRIGHT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'year': makeObjectPropertySetter(readPositiveInteger),\n 'license': makeObjectPropertySetter(readString),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst GPX_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'rte': makeChildAppender(writeRte),\n 'trk': makeChildAppender(writeTrk),\n 'wpt': makeChildAppender(writeWpt),\n});\n\n/**\n * @typedef {Object} Options\n * @property {function(Feature, Node):void} [readExtensions] Callback function\n * to process `extensions` nodes. To prevent memory leaks, this callback function must\n * not store any references to the node. Note that the `extensions`\n * node is not allowed in GPX 1.0. Moreover, only `extensions`\n * nodes from `wpt`, `rte` and `trk` can be processed, as those are\n * directly mapped to a feature.\n */\n\n/**\n * @typedef {Object} LayoutOptions\n * @property {boolean} [hasZ] HasZ.\n * @property {boolean} [hasM] HasM.\n */\n\n/**\n * @typedef {function(Feature, Node): void} ReadExtensions\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GPX format.\n *\n * Note that {@link module:ol/format/GPX~GPX#readFeature} only reads the first\n * feature of the source.\n *\n * When reading, routes (`<rte>`) are converted into LineString geometries, and\n * tracks (`<trk>`) into MultiLineString. Any properties on route and track\n * waypoints are ignored.\n *\n * When writing, LineString geometries are output as routes (`<rte>`), and\n * MultiLineString as tracks (`<trk>`).\n *\n * @api\n */\nclass GPX extends XMLFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection('EPSG:4326');\n\n /**\n * @type {ReadExtensions|undefined}\n * @private\n */\n this.readExtensions_ = options.readExtensions;\n }\n\n /**\n * @param {Array<Feature>} features List of features.\n * @private\n */\n handleReadExtensions_(features) {\n if (!features) {\n features = [];\n }\n for (let i = 0, ii = features.length; i < ii; ++i) {\n const feature = features[i];\n if (this.readExtensions_) {\n const extensionsNode = feature.get('extensionsNode_') || null;\n this.readExtensions_(feature, extensionsNode);\n }\n feature.set('extensionsNode_', undefined);\n }\n }\n\n /**\n * Reads a GPX file's metadata tag, reading among other things:\n * - the name and description of this GPX\n * - its author\n * - the copyright associated with this GPX file\n *\n * Will return null if no metadata tag is present (or no valid source is given).\n *\n * @param {Document|Element|Object|string} source Source.\n * @return {GPXMetadata | null} Metadata\n * @api\n */\n readMetadata(source) {\n if (!source) {\n return null;\n }\n if (typeof source === 'string') {\n return this.readMetadataFromDocument(parse(source));\n }\n if (isDocument(source)) {\n return this.readMetadataFromDocument(/** @type {Document} */ (source));\n }\n return this.readMetadataFromNode(source);\n }\n\n /**\n * @param {Document} doc Document.\n * @return {GPXMetadata | null} Metadata\n */\n readMetadataFromDocument(doc) {\n for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {\n if (n.nodeType === Node.ELEMENT_NODE) {\n const metadata = this.readMetadataFromNode(/** @type {Element} */ (n));\n if (metadata) {\n return metadata;\n }\n }\n }\n return null;\n }\n\n /**\n * @param {Element} node Node.\n * @return {Object} Metadata\n */\n readMetadataFromNode(node) {\n if (!NAMESPACE_URIS.includes(node.namespaceURI)) {\n return null;\n }\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n if (\n NAMESPACE_URIS.includes(n.namespaceURI) &&\n n.localName === 'metadata'\n ) {\n return pushParseAndPop({}, METADATA_PARSERS, n, []);\n }\n }\n return null;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @override\n */\n readFeatureFromNode(node, options) {\n if (!NAMESPACE_URIS.includes(node.namespaceURI)) {\n return null;\n }\n const featureReader = FEATURE_READER[node.localName];\n if (!featureReader) {\n return null;\n }\n const feature = featureReader(node, [this.getReadOptions(node, options)]);\n if (!feature) {\n return null;\n }\n this.handleReadExtensions_([feature]);\n return feature;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @override\n */\n readFeaturesFromNode(node, options) {\n if (!NAMESPACE_URIS.includes(node.namespaceURI)) {\n return [];\n }\n if (node.localName == 'gpx') {\n /** @type {Array<Feature>} */\n const features = pushParseAndPop([], GPX_PARSERS, node, [\n this.getReadOptions(node, options),\n ]);\n if (features) {\n this.handleReadExtensions_(features);\n return features;\n }\n return [];\n }\n return [];\n }\n\n /**\n * Encode an array of features in the GPX format as an XML node.\n * LineString geometries are output as routes (`<rte>`), and MultiLineString\n * as tracks (`<trk>`).\n *\n * @param {Array<Feature>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Node} Node.\n * @api\n * @override\n */\n writeFeaturesNode(features, options) {\n options = this.adaptOptions(options);\n //FIXME Serialize metadata\n const gpx = createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');\n const xmlnsUri = 'http://www.w3.org/2000/xmlns/';\n gpx.setAttributeNS(xmlnsUri, 'xmlns:xsi', XML_SCHEMA_INSTANCE_URI);\n gpx.setAttributeNS(\n XML_SCHEMA_INSTANCE_URI,\n 'xsi:schemaLocation',\n SCHEMA_LOCATION,\n );\n gpx.setAttribute('version', '1.1');\n gpx.setAttribute('creator', 'OpenLayers');\n\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n ({node: gpx}),\n GPX_SERIALIZERS,\n GPX_NODE_FACTORY,\n features,\n [options],\n );\n return gpx;\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst RTE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeObjectPropertySetter(readString),\n 'cmt': makeObjectPropertySetter(readString),\n 'desc': makeObjectPropertySetter(readString),\n 'src': makeObjectPropertySetter(readString),\n 'link': parseLink,\n 'number': makeObjectPropertySetter(readPositiveInteger),\n 'extensions': parseExtensions,\n 'type': makeObjectPropertySetter(readString),\n 'rtept': parseRtePt,\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst RTEPT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeObjectPropertySetter(readDecimal),\n 'time': makeObjectPropertySetter(readDateTime),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TRK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeObjectPropertySetter(readString),\n 'cmt': makeObjectPropertySetter(readString),\n 'desc': makeObjectPropertySetter(readString),\n 'src': makeObjectPropertySetter(readString),\n 'link': parseLink,\n 'number': makeObjectPropertySetter(readPositiveInteger),\n 'type': makeObjectPropertySetter(readString),\n 'extensions': parseExtensions,\n 'trkseg': parseTrkSeg,\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TRKSEG_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'trkpt': parseTrkPt,\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TRKPT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeObjectPropertySetter(readDecimal),\n 'time': makeObjectPropertySetter(readDateTime),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst WPT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeObjectPropertySetter(readDecimal),\n 'time': makeObjectPropertySetter(readDateTime),\n 'magvar': makeObjectPropertySetter(readDecimal),\n 'geoidheight': makeObjectPropertySetter(readDecimal),\n 'name': makeObjectPropertySetter(readString),\n 'cmt': makeObjectPropertySetter(readString),\n 'desc': makeObjectPropertySetter(readString),\n 'src': makeObjectPropertySetter(readString),\n 'link': parseLink,\n 'sym': makeObjectPropertySetter(readString),\n 'type': makeObjectPropertySetter(readString),\n 'fix': makeObjectPropertySetter(readString),\n 'sat': makeObjectPropertySetter(readPositiveInteger),\n 'hdop': makeObjectPropertySetter(readDecimal),\n 'vdop': makeObjectPropertySetter(readDecimal),\n 'pdop': makeObjectPropertySetter(readDecimal),\n 'ageofdgpsdata': makeObjectPropertySetter(readDecimal),\n 'dgpsid': makeObjectPropertySetter(readPositiveInteger),\n 'extensions': parseExtensions,\n});\n\n/**\n * @const\n * @type {Array<string>}\n */\nconst LINK_SEQUENCE = ['text', 'type'];\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst LINK_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'text': makeChildAppender(writeStringTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n});\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst RTE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'name',\n 'cmt',\n 'desc',\n 'src',\n 'link',\n 'number',\n 'type',\n 'rtept',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst RTE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeChildAppender(writeStringTextNode),\n 'cmt': makeChildAppender(writeStringTextNode),\n 'desc': makeChildAppender(writeStringTextNode),\n 'src': makeChildAppender(writeStringTextNode),\n 'link': makeChildAppender(writeLink),\n 'number': makeChildAppender(writeNonNegativeIntegerTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n 'rtept': makeArraySerializer(makeChildAppender(writeWptType)),\n});\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst RTEPT_TYPE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, ['ele', 'time']);\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst TRK_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'name',\n 'cmt',\n 'desc',\n 'src',\n 'link',\n 'number',\n 'type',\n 'trkseg',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst TRK_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeChildAppender(writeStringTextNode),\n 'cmt': makeChildAppender(writeStringTextNode),\n 'desc': makeChildAppender(writeStringTextNode),\n 'src': makeChildAppender(writeStringTextNode),\n 'link': makeChildAppender(writeLink),\n 'number': makeChildAppender(writeNonNegativeIntegerTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n 'trkseg': makeArraySerializer(makeChildAppender(writeTrkSeg)),\n});\n\n/**\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst TRKSEG_NODE_FACTORY = makeSimpleNodeFactory('trkpt');\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst TRKSEG_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'trkpt': makeChildAppender(writeWptType),\n});\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst WPT_TYPE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'ele',\n 'time',\n 'magvar',\n 'geoidheight',\n 'name',\n 'cmt',\n 'desc',\n 'src',\n 'link',\n 'sym',\n 'type',\n 'fix',\n 'sat',\n 'hdop',\n 'vdop',\n 'pdop',\n 'ageofdgpsdata',\n 'dgpsid',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst WPT_TYPE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeChildAppender(writeDecimalTextNode),\n 'time': makeChildAppender(writeDateTimeTextNode),\n 'magvar': makeChildAppender(writeDecimalTextNode),\n 'geoidheight': makeChildAppender(writeDecimalTextNode),\n 'name': makeChildAppender(writeStringTextNode),\n 'cmt': makeChildAppender(writeStringTextNode),\n 'desc': makeChildAppender(writeStringTextNode),\n 'src': makeChildAppender(writeStringTextNode),\n 'link': makeChildAppender(writeLink),\n 'sym': makeChildAppender(writeStringTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n 'fix': makeChildAppender(writeStringTextNode),\n 'sat': makeChildAppender(writeNonNegativeIntegerTextNode),\n 'hdop': makeChildAppender(writeDecimalTextNode),\n 'vdop': makeChildAppender(writeDecimalTextNode),\n 'pdop': makeChildAppender(writeDecimalTextNode),\n 'ageofdgpsdata': makeChildAppender(writeDecimalTextNode),\n 'dgpsid': makeChildAppender(writeNonNegativeIntegerTextNode),\n});\n\n/**\n * @const\n * @type {Object<string, string>}\n */\nconst GEOMETRY_TYPE_TO_NODENAME = {\n 'Point': 'wpt',\n 'LineString': 'rte',\n 'MultiLineString': 'trk',\n};\n\n/**\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n */\nfunction GPX_NODE_FACTORY(value, objectStack, nodeName) {\n const geometry = /** @type {Feature} */ (value).getGeometry();\n if (geometry) {\n const nodeName = GEOMETRY_TYPE_TO_NODENAME[geometry.getType()];\n if (nodeName) {\n const parentNode = objectStack[objectStack.length - 1].node;\n return createElementNS(parentNode.namespaceURI, nodeName);\n }\n }\n}\n\n/**\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {LayoutOptions} layoutOptions Layout options.\n * @param {Element} node Node.\n * @param {!Object} values Values.\n * @return {Array<number>} Flat coordinates.\n */\nfunction appendCoordinate(flatCoordinates, layoutOptions, node, values) {\n flatCoordinates.push(\n parseFloat(node.getAttribute('lon')),\n parseFloat(node.getAttribute('lat')),\n );\n if ('ele' in values) {\n flatCoordinates.push(/** @type {number} */ (values['ele']));\n delete values['ele'];\n layoutOptions.hasZ = true;\n } else {\n flatCoordinates.push(0);\n }\n if ('time' in values) {\n flatCoordinates.push(/** @type {number} */ (values['time']));\n delete values['time'];\n layoutOptions.hasM = true;\n } else {\n flatCoordinates.push(0);\n }\n return flatCoordinates;\n}\n\n/**\n * Choose GeometryLayout based on flags in layoutOptions and adjust flatCoordinates\n * and ends arrays by shrinking them accordingly (removing unused zero entries).\n *\n * @param {LayoutOptions} layoutOptions Layout options.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {Array<number>} [ends] Ends.\n * @return {import(\"../geom/Geometry.js\").GeometryLayout} Layout.\n */\nfunction applyLayoutOptions(layoutOptions, flatCoordinates, ends) {\n /** @type {import(\"../geom/Geometry.js\").GeometryLayout} */\n let layout = 'XY';\n let stride = 2;\n if (layoutOptions.hasZ && layoutOptions.hasM) {\n layout = 'XYZM';\n stride = 4;\n } else if (layoutOptions.hasZ) {\n layout = 'XYZ';\n stride = 3;\n } else if (layoutOptions.hasM) {\n layout = 'XYM';\n stride = 3;\n }\n if (stride !== 4) {\n for (let i = 0, ii = flatCoordinates.length / 4; i < ii; i++) {\n flatCoordinates[i * stride] = flatCoordinates[i * 4];\n flatCoordinates[i * stride + 1] = flatCoordinates[i * 4 + 1];\n if (layoutOptions.hasZ) {\n flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 2];\n }\n if (layoutOptions.hasM) {\n flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 3];\n }\n }\n flatCoordinates.length = (flatCoordinates.length / 4) * stride;\n if (ends) {\n for (let i = 0, ii = ends.length; i < ii; i++) {\n ends[i] = (ends[i] / 4) * stride;\n }\n }\n }\n return layout;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<any>} objectStack Object stack.\n * @return {GPXAuthor | undefined} Person object.\n */\nfunction readAuthor(node, objectStack) {\n const values = pushParseAndPop({}, AUTHOR_PARSERS, node, objectStack);\n if (values) {\n return values;\n }\n return undefined;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<any>} objectStack Object stack.\n * @return {GPXCopyright | undefined} Person object.\n */\nfunction readCopyright(node, objectStack) {\n const values = pushParseAndPop({}, COPYRIGHT_PARSERS, node, objectStack);\n if (values) {\n const author = node.getAttribute('author');\n if (author !== null) {\n values['author'] = author;\n }\n return values;\n }\n return undefined;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseBounds(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const minlat = node.getAttribute('minlat');\n const minlon = node.getAttribute('minlon');\n const maxlat = node.getAttribute('maxlat');\n const maxlon = node.getAttribute('maxlon');\n if (\n minlon !== null &&\n minlat !== null &&\n maxlon !== null &&\n maxlat !== null\n ) {\n values['bounds'] = [\n [parseFloat(minlon), parseFloat(minlat)],\n [parseFloat(maxlon), parseFloat(maxlat)],\n ];\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseEmail(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const id = node.getAttribute('id');\n const domain = node.getAttribute('domain');\n if (id !== null && domain !== null) {\n values['email'] = `${id}@${domain}`;\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseLink(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const href = node.getAttribute('href');\n if (href !== null) {\n values['link'] = href;\n }\n parseNode(LINK_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseExtensions(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n values['extensionsNode_'] = node;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseRtePt(node, objectStack) {\n const values = pushParseAndPop({}, RTEPT_PARSERS, node, objectStack);\n if (values) {\n const rteValues = /** @type {!Object} */ (\n objectStack[objectStack.length - 1]\n );\n const flatCoordinates = /** @type {Array<number>} */ (\n rteValues['flatCoordinates']\n );\n const layoutOptions = /** @type {LayoutOptions} */ (\n rteValues['layoutOptions']\n );\n appendCoordinate(flatCoordinates, layoutOptions, node, values);\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseTrkPt(node, objectStack) {\n const values = pushParseAndPop({}, TRKPT_PARSERS, node, objectStack);\n if (values) {\n const trkValues = /** @type {!Object} */ (\n objectStack[objectStack.length - 1]\n );\n const flatCoordinates = /** @type {Array<number>} */ (\n trkValues['flatCoordinates']\n );\n const layoutOptions = /** @type {LayoutOptions} */ (\n trkValues['layoutOptions']\n );\n appendCoordinate(flatCoordinates, layoutOptions, node, values);\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseTrkSeg(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n parseNode(TRKSEG_PARSERS, node, objectStack);\n const flatCoordinates =\n /** @type {Array<number>} */\n (values['flatCoordinates']);\n const ends = /** @type {Array<number>} */ (values['ends']);\n ends.push(flatCoordinates.length);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature|undefined} Track.\n */\nfunction readRte(node, objectStack) {\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n const values = pushParseAndPop(\n {\n 'flatCoordinates': [],\n 'layoutOptions': {},\n },\n RTE_PARSERS,\n node,\n objectStack,\n );\n if (!values) {\n return undefined;\n }\n const flatCoordinates =\n /** @type {Array<number>} */\n (values['flatCoordinates']);\n delete values['flatCoordinates'];\n const layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']);\n delete values['layoutOptions'];\n const layout = applyLayoutOptions(layoutOptions, flatCoordinates);\n const geometry = new LineString(flatCoordinates, layout);\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n feature.setProperties(values, true);\n return feature;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature|undefined} Track.\n */\nfunction readTrk(node, objectStack) {\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n const values = pushParseAndPop(\n {\n 'flatCoordinates': [],\n 'ends': [],\n 'layoutOptions': {},\n },\n TRK_PARSERS,\n node,\n objectStack,\n );\n if (!values) {\n return undefined;\n }\n const flatCoordinates =\n /** @type {Array<number>} */\n (values['flatCoordinates']);\n delete values['flatCoordinates'];\n const ends = /** @type {Array<number>} */ (values['ends']);\n delete values['ends'];\n const layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']);\n delete values['layoutOptions'];\n const layout = applyLayoutOptions(layoutOptions, flatCoordinates, ends);\n const geometry = new MultiLineString(flatCoordinates, layout, ends);\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n feature.setProperties(values, true);\n return feature;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature|undefined} Waypoint.\n */\nfunction readWpt(node, objectStack) {\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n const values = pushParseAndPop({}, WPT_PARSERS, node, objectStack);\n if (!values) {\n return undefined;\n }\n const layoutOptions = /** @type {LayoutOptions} */ ({});\n const coordinates = appendCoordinate([], layoutOptions, node, values);\n const layout = applyLayoutOptions(layoutOptions, coordinates);\n const geometry = new Point(coordinates, layout);\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n feature.setProperties(values, true);\n return feature;\n}\n\n/**\n * @param {Element} node Node.\n * @param {string} value Value for the link's `href` attribute.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeLink(node, value, objectStack) {\n node.setAttribute('href', value);\n const context = objectStack[objectStack.length - 1];\n const properties = context['properties'];\n const link = [properties['linkText'], properties['linkType']];\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */ ({node: node}),\n LINK_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n link,\n objectStack,\n LINK_SEQUENCE,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeWptType(node, coordinate, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const parentNode = context.node;\n const namespaceURI = parentNode.namespaceURI;\n const properties = context['properties'];\n //FIXME Projection handling\n node.setAttributeNS(null, 'lat', String(coordinate[1]));\n node.setAttributeNS(null, 'lon', String(coordinate[0]));\n const geometryLayout = context['geometryLayout'];\n switch (geometryLayout) {\n case 'XYZM':\n if (coordinate[3] !== 0) {\n properties['time'] = coordinate[3];\n }\n // fall through\n case 'XYZ':\n if (coordinate[2] !== 0) {\n properties['ele'] = coordinate[2];\n }\n break;\n case 'XYM':\n if (coordinate[2] !== 0) {\n properties['time'] = coordinate[2];\n }\n break;\n default:\n // pass\n }\n const orderedKeys =\n node.nodeName == 'rtept'\n ? RTEPT_TYPE_SEQUENCE[namespaceURI]\n : WPT_TYPE_SEQUENCE[namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n ({node: node, 'properties': properties}),\n WPT_TYPE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @param {Node} node Node.\n * @param {Feature} feature Feature.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeRte(node, feature, objectStack) {\n const options = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[0]\n );\n const properties = feature.getProperties();\n const context = {node: node};\n context['properties'] = properties;\n const geometry = feature.getGeometry();\n if (geometry.getType() == 'LineString') {\n const lineString = /** @type {LineString} */ (\n transformGeometryWithOptions(geometry, true, options)\n );\n context['geometryLayout'] = lineString.getLayout();\n properties['rtept'] = lineString.getCoordinates();\n }\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = RTE_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n RTE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {Feature} feature Feature.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeTrk(node, feature, objectStack) {\n const options = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[0]\n );\n const properties = feature.getProperties();\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const context = {node: node};\n context['properties'] = properties;\n const geometry = feature.getGeometry();\n if (geometry.getType() == 'MultiLineString') {\n const multiLineString = /** @type {MultiLineString} */ (\n transformGeometryWithOptions(geometry, true, options)\n );\n properties['trkseg'] = multiLineString.getLineStrings();\n }\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = TRK_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n TRK_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {LineString} lineString LineString.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeTrkSeg(node, lineString, objectStack) {\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const context = {node: node};\n context['geometryLayout'] = lineString.getLayout();\n context['properties'] = {};\n pushSerializeAndPop(\n context,\n TRKSEG_SERIALIZERS,\n TRKSEG_NODE_FACTORY,\n lineString.getCoordinates(),\n objectStack,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {Feature} feature Feature.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeWpt(node, feature, objectStack) {\n const options = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[0]\n );\n const context = objectStack[objectStack.length - 1];\n context['properties'] = feature.getProperties();\n const geometry = feature.getGeometry();\n if (geometry.getType() == 'Point') {\n const point = /** @type {Point} */ (\n transformGeometryWithOptions(geometry, true, options)\n );\n context['geometryLayout'] = point.getLayout();\n writeWptType(node, point.getCoordinates(), objectStack);\n }\n}\n\nexport default GPX;\n","/**\n * @module ol/format/GeoJSON\n */\n\nimport Feature from '../Feature.js';\nimport {getLayoutForStride} from '../geom/SimpleGeometry.js';\nimport {\n deflateCoordinatesArray,\n deflateMultiCoordinatesArray,\n} from '../geom/flat/deflate.js';\nimport {isEmpty} from '../obj.js';\nimport {get as getProjection} from '../proj.js';\nimport RenderFeature from '../render/Feature.js';\nimport {\n createGeometry,\n createRenderFeature,\n transformGeometryWithOptions,\n} from './Feature.js';\nimport JSONFeature from './JSONFeature.js';\n\n/**\n * @typedef {import(\"geojson\").GeoJSON} GeoJSONObject\n * @typedef {import(\"geojson\").Feature} GeoJSONFeature\n * @typedef {import(\"geojson\").FeatureCollection} GeoJSONFeatureCollection\n * @typedef {import(\"geojson\").Geometry} GeoJSONGeometry\n * @typedef {import(\"geojson\").Point} GeoJSONPoint\n * @typedef {import(\"geojson\").LineString} GeoJSONLineString\n * @typedef {import(\"geojson\").Polygon} GeoJSONPolygon\n * @typedef {import(\"geojson\").MultiPoint} GeoJSONMultiPoint\n * @typedef {import(\"geojson\").MultiLineString} GeoJSONMultiLineString\n * @typedef {import(\"geojson\").MultiPolygon} GeoJSONMultiPolygon\n * @typedef {import(\"geojson\").GeometryCollection} GeoJSONGeometryCollection\n */\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @typedef {Object} Options\n *\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection='EPSG:4326'] Default data projection.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection for features read or\n * written by the format. Options passed to read or write methods will take precedence.\n * @property {string} [geometryName] Geometry name to use when creating features.\n * @property {boolean} [extractGeometryName=false] Certain GeoJSON providers include\n * the geometry_name field in the feature GeoJSON. If set to `true` the GeoJSON reader\n * will look for that field to set the geometry name. If both this field is set to `true`\n * and a `geometryName` is provided, the `geometryName` will take precedence.\n * @property {import('./Feature.js').FeatureToFeatureClass<FeatureType>} [featureClass] Feature class\n * to be used when reading features. The default is {@link module:ol/Feature~Feature}. If performance is\n * the primary concern, and features are not going to be modified or round-tripped through the format,\n * consider using {@link module:ol/render/Feature~RenderFeature}\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GeoJSON format.\n *\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @extends {JSONFeature<FeatureType>}\n * @api\n */\nclass GeoJSON extends JSONFeature {\n /**\n * @param {Options<FeatureType>} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super();\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection(\n options.dataProjection ? options.dataProjection : 'EPSG:4326',\n );\n\n if (options.featureProjection) {\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.defaultFeatureProjection = getProjection(options.featureProjection);\n }\n\n if (options.featureClass) {\n this.featureClass = options.featureClass;\n }\n\n /**\n * Name of the geometry attribute for features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * Look for the `geometry_name` in the feature GeoJSON\n * @type {boolean|undefined}\n * @private\n */\n this.extractGeometryName_ = options.extractGeometryName;\n\n this.supportedMediaTypes = [\n 'application/geo+json',\n 'application/vnd.geo+json',\n ];\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {FeatureType|Array<FeatureType>} Feature.\n * @override\n */\n readFeatureFromObject(object, options) {\n /**\n * @type {GeoJSONFeature}\n */\n let geoJSONFeature = null;\n if (object['type'] === 'Feature') {\n geoJSONFeature = /** @type {GeoJSONFeature} */ (object);\n } else {\n geoJSONFeature = {\n 'type': 'Feature',\n 'geometry': /** @type {GeoJSONGeometry} */ (object),\n 'properties': null,\n };\n }\n\n const geometry = readGeometryInternal(geoJSONFeature['geometry'], options);\n if (this.featureClass === RenderFeature) {\n return /** @type {FeatureType|Array<FeatureType>} */ (\n createRenderFeature(\n {\n geometry,\n id: geoJSONFeature['id'],\n properties: geoJSONFeature['properties'],\n },\n options,\n )\n );\n }\n\n const feature = new Feature();\n if (this.geometryName_) {\n feature.setGeometryName(this.geometryName_);\n } else if (this.extractGeometryName_ && geoJSONFeature['geometry_name']) {\n feature.setGeometryName(geoJSONFeature['geometry_name']);\n }\n feature.setGeometry(createGeometry(geometry, options));\n\n if ('id' in geoJSONFeature) {\n feature.setId(geoJSONFeature['id']);\n }\n\n if (geoJSONFeature['properties']) {\n feature.setProperties(geoJSONFeature['properties'], true);\n }\n return /** @type {FeatureType|Array<FeatureType>} */ (feature);\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<FeatureType>} Features.\n * @override\n */\n readFeaturesFromObject(object, options) {\n const geoJSONObject = /** @type {GeoJSONObject} */ (object);\n let features = null;\n if (geoJSONObject['type'] === 'FeatureCollection') {\n const geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (\n object\n );\n features = [];\n const geoJSONFeatures = geoJSONFeatureCollection['features'];\n for (let i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {\n const featureObject = this.readFeatureFromObject(\n geoJSONFeatures[i],\n options,\n );\n if (!featureObject) {\n continue;\n }\n features.push(featureObject);\n }\n } else {\n features = [this.readFeatureFromObject(object, options)];\n }\n return /** @type {Array<FeatureType>} */ (features.flat());\n }\n\n /**\n * @param {GeoJSONGeometry} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @override\n */\n readGeometryFromObject(object, options) {\n return readGeometry(object, options);\n }\n\n /**\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @override\n */\n readProjectionFromObject(object) {\n const crs = object['crs'];\n let projection;\n if (crs) {\n if (crs['type'] == 'name') {\n projection = getProjection(crs['properties']['name']);\n } else if (crs['type'] === 'EPSG') {\n projection = getProjection('EPSG:' + crs['properties']['code']);\n } else {\n throw new Error('Unknown SRS type');\n }\n } else {\n projection = this.dataProjection;\n }\n return /** @type {import(\"../proj/Projection.js\").default} */ (projection);\n }\n\n /**\n * Encode a feature as a GeoJSON Feature object.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONFeature} Object.\n * @api\n * @override\n */\n writeFeatureObject(feature, options) {\n options = this.adaptOptions(options);\n\n /** @type {GeoJSONFeature} */\n const object = {\n 'type': 'Feature',\n geometry: null,\n properties: null,\n };\n\n const id = feature.getId();\n if (id !== undefined) {\n object.id = id;\n }\n\n if (!feature.hasProperties()) {\n return object;\n }\n\n const properties = feature.getProperties();\n const geometry = feature.getGeometry();\n if (geometry) {\n object.geometry = writeGeometry(geometry, options);\n\n delete properties[feature.getGeometryName()];\n }\n\n if (!isEmpty(properties)) {\n object.properties = properties;\n }\n\n return object;\n }\n\n /**\n * Encode an array of features as a GeoJSON object.\n *\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONFeatureCollection} GeoJSON Object.\n * @api\n * @override\n */\n writeFeaturesObject(features, options) {\n options = this.adaptOptions(options);\n const objects = [];\n for (let i = 0, ii = features.length; i < ii; ++i) {\n objects.push(this.writeFeatureObject(features[i], options));\n }\n return {\n type: 'FeatureCollection',\n features: objects,\n };\n }\n\n /**\n * Encode a geometry as a GeoJSON object.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.\n * @api\n * @override\n */\n writeGeometryObject(geometry, options) {\n return writeGeometry(geometry, this.adaptOptions(options));\n }\n}\n\n/**\n * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"./Feature.js\").GeometryObject} Geometry.\n */\nfunction readGeometryInternal(object, options) {\n if (!object) {\n return null;\n }\n\n /** @type {import(\"./Feature.js\").GeometryObject} */\n let geometry;\n switch (object['type']) {\n case 'Point': {\n geometry = readPointGeometry(/** @type {GeoJSONPoint} */ (object));\n break;\n }\n case 'LineString': {\n geometry = readLineStringGeometry(\n /** @type {GeoJSONLineString} */ (object),\n );\n break;\n }\n case 'Polygon': {\n geometry = readPolygonGeometry(/** @type {GeoJSONPolygon} */ (object));\n break;\n }\n case 'MultiPoint': {\n geometry = readMultiPointGeometry(\n /** @type {GeoJSONMultiPoint} */ (object),\n );\n break;\n }\n case 'MultiLineString': {\n geometry = readMultiLineStringGeometry(\n /** @type {GeoJSONMultiLineString} */ (object),\n );\n break;\n }\n case 'MultiPolygon': {\n geometry = readMultiPolygonGeometry(\n /** @type {GeoJSONMultiPolygon} */ (object),\n );\n break;\n }\n case 'GeometryCollection': {\n geometry = readGeometryCollectionGeometry(\n /** @type {GeoJSONGeometryCollection} */ (object),\n );\n break;\n }\n default: {\n throw new Error('Unsupported GeoJSON type: ' + object['type']);\n }\n }\n return geometry;\n}\n\n/**\n * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nfunction readGeometry(object, options) {\n const geometryObject = readGeometryInternal(object, options);\n return createGeometry(geometryObject, options);\n}\n\n/**\n * @param {GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"./Feature.js\").GeometryCollectionObject} Geometry collection.\n */\nfunction readGeometryCollectionGeometry(object, options) {\n const geometries = object['geometries'].map(\n /**\n * @param {GeoJSONGeometry} geometry Geometry.\n * @return {import(\"./Feature.js\").GeometryObject} geometry Geometry.\n */\n function (geometry) {\n return readGeometryInternal(geometry, options);\n },\n );\n return geometries;\n}\n\n/**\n * @param {GeoJSONPoint} object Input object.\n * @return {import(\"./Feature.js\").GeometryObject} Point geometry.\n */\nfunction readPointGeometry(object) {\n const flatCoordinates = object['coordinates'];\n return {\n type: 'Point',\n flatCoordinates,\n layout: getLayoutForStride(flatCoordinates.length),\n };\n}\n\n/**\n * @param {GeoJSONLineString} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} LineString geometry.\n */\nfunction readLineStringGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = coordinates.flat();\n return {\n type: 'LineString',\n flatCoordinates,\n ends: [flatCoordinates.length],\n layout: getLayoutForStride(coordinates[0]?.length || 2),\n };\n}\n\n/**\n * @param {GeoJSONMultiLineString} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiLineString geometry.\n */\nfunction readMultiLineStringGeometry(object) {\n const coordinates = object['coordinates'];\n const stride = coordinates[0]?.[0]?.length || 2;\n const flatCoordinates = [];\n const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);\n return {\n type: 'MultiLineString',\n flatCoordinates,\n ends,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {GeoJSONMultiPoint} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiPoint geometry.\n */\nfunction readMultiPointGeometry(object) {\n const coordinates = object['coordinates'];\n return {\n type: 'MultiPoint',\n flatCoordinates: coordinates.flat(),\n layout: getLayoutForStride(coordinates[0]?.length || 2),\n };\n}\n\n/**\n * @param {GeoJSONMultiPolygon} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiPolygon geometry.\n */\nfunction readMultiPolygonGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = [];\n const stride = coordinates[0]?.[0]?.[0].length || 2;\n const endss = deflateMultiCoordinatesArray(\n flatCoordinates,\n 0,\n coordinates,\n stride,\n );\n return {\n type: 'MultiPolygon',\n flatCoordinates,\n ends: endss,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {GeoJSONPolygon} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} Polygon.\n */\nfunction readPolygonGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = [];\n const stride = coordinates[0]?.[0]?.length;\n const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);\n return {\n type: 'Polygon',\n flatCoordinates,\n ends,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeGeometry(geometry, options) {\n geometry = transformGeometryWithOptions(geometry, true, options);\n\n const type = geometry.getType();\n\n /** @type {GeoJSONGeometry} */\n let geoJSON;\n switch (type) {\n case 'Point': {\n geoJSON = writePointGeometry(\n /** @type {import(\"../geom/Point.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'LineString': {\n geoJSON = writeLineStringGeometry(\n /** @type {import(\"../geom/LineString.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'Polygon': {\n geoJSON = writePolygonGeometry(\n /** @type {import(\"../geom/Polygon.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'MultiPoint': {\n geoJSON = writeMultiPointGeometry(\n /** @type {import(\"../geom/MultiPoint.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'MultiLineString': {\n geoJSON = writeMultiLineStringGeometry(\n /** @type {import(\"../geom/MultiLineString.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'MultiPolygon': {\n geoJSON = writeMultiPolygonGeometry(\n /** @type {import(\"../geom/MultiPolygon.js\").default} */ (geometry),\n options,\n );\n break;\n }\n case 'GeometryCollection': {\n geoJSON = writeGeometryCollectionGeometry(\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ),\n options,\n );\n break;\n }\n case 'Circle': {\n geoJSON = {\n type: 'GeometryCollection',\n geometries: [],\n };\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return geoJSON;\n}\n\n/**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometryCollection} GeoJSON geometry collection.\n */\nfunction writeGeometryCollectionGeometry(geometry, options) {\n options = Object.assign({}, options);\n delete options.featureProjection;\n const geometries = geometry.getGeometriesArray().map(function (geometry) {\n return writeGeometry(geometry, options);\n });\n return {\n type: 'GeometryCollection',\n geometries: geometries,\n };\n}\n\n/**\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeLineStringGeometry(geometry, options) {\n return {\n type: 'LineString',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiLineStringGeometry(geometry, options) {\n return {\n type: 'MultiLineString',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiPointGeometry(geometry, options) {\n return {\n type: 'MultiPoint',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiPolygonGeometry(geometry, options) {\n let right;\n if (options) {\n right = options.rightHanded;\n }\n return {\n type: 'MultiPolygon',\n coordinates: geometry.getCoordinates(right),\n };\n}\n\n/**\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writePointGeometry(geometry, options) {\n return {\n type: 'Point',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writePolygonGeometry(geometry, options) {\n let right;\n if (options) {\n right = options.rightHanded;\n }\n return {\n type: 'Polygon',\n coordinates: geometry.getCoordinates(right),\n };\n}\n\nexport default GeoJSON;\n","/**\n * @module ol/format/TextFeature\n */\nimport FeatureFormat from '../format/Feature.js';\nimport {abstract} from '../util.js';\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for text feature formats.\n *\n * @abstract\n */\nclass TextFeature extends FeatureFormat {\n constructor() {\n super();\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n * @override\n */\n getType() {\n return 'text';\n }\n\n /**\n * Read the feature from the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @api\n * @override\n */\n readFeature(source, options) {\n return this.readFeatureFromText(\n getText(source),\n this.adaptOptions(options),\n );\n }\n\n /**\n * @abstract\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../Feature.js\").default} Feature.\n */\n readFeatureFromText(text, options) {\n return abstract();\n }\n\n /**\n * Read the features from the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @api\n * @override\n */\n readFeatures(source, options) {\n return this.readFeaturesFromText(\n getText(source),\n this.adaptOptions(options),\n );\n }\n\n /**\n * @abstract\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<import(\"../Feature.js\").default>} Features.\n */\n readFeaturesFromText(text, options) {\n return abstract();\n }\n\n /**\n * Read the geometry from the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @api\n * @override\n */\n readGeometry(source, options) {\n return this.readGeometryFromText(\n getText(source),\n this.adaptOptions(options),\n );\n }\n\n /**\n * @abstract\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromText(text, options) {\n return abstract();\n }\n\n /**\n * Read the projection from the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default|undefined} Projection.\n * @api\n * @override\n */\n readProjection(source) {\n return this.readProjectionFromText(getText(source));\n }\n\n /**\n * @param {string} text Text.\n * @protected\n * @return {import(\"../proj/Projection.js\").default|undefined} Projection.\n */\n readProjectionFromText(text) {\n return this.dataProjection;\n }\n\n /**\n * Encode a feature as a string.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded feature.\n * @api\n * @override\n */\n writeFeature(feature, options) {\n return this.writeFeatureText(feature, this.adaptOptions(options));\n }\n\n /**\n * @abstract\n * @param {import(\"../Feature.js\").default} feature Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n */\n writeFeatureText(feature, options) {\n return abstract();\n }\n\n /**\n * Encode an array of features as string.\n *\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded features.\n * @api\n * @override\n */\n writeFeatures(features, options) {\n return this.writeFeaturesText(features, this.adaptOptions(options));\n }\n\n /**\n * @abstract\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n */\n writeFeaturesText(features, options) {\n return abstract();\n }\n\n /**\n * Write a single geometry.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Geometry.\n * @api\n * @override\n */\n writeGeometry(geometry, options) {\n return this.writeGeometryText(geometry, this.adaptOptions(options));\n }\n\n /**\n * @abstract\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n */\n writeGeometryText(geometry, options) {\n return abstract();\n }\n}\n\n/**\n * @param {Document|Element|Object|string} source Source.\n * @return {string} Text.\n */\nfunction getText(source) {\n if (typeof source === 'string') {\n return source;\n }\n return '';\n}\n\nexport default TextFeature;\n","/**\n * @module ol/format/IGC\n */\nimport Feature from '../Feature.js';\nimport LineString from '../geom/LineString.js';\nimport {get as getProjection} from '../proj.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport TextFeature from './TextFeature.js';\n\n/**\n * @typedef {'barometric' | 'gps' | 'none'} IGCZ\n * IGC altitude/z. One of 'barometric', 'gps', 'none'.\n */\n\n/**\n * @const\n * @type {RegExp}\n */\nconst B_RECORD_RE =\n /^B(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{5})([NS])(\\d{3})(\\d{5})([EW])([AV])(\\d{5})(\\d{5})/;\n\n/**\n * @const\n * @type {RegExp}\n */\nconst H_RECORD_RE = /^H.([A-Z]{3}).*?:(.*)/;\n\n/**\n * @const\n * @type {RegExp}\n */\nconst HFDTE_RECORD_RE = /^HFDTE(\\d{2})(\\d{2})(\\d{2})/;\n\n/**\n * @const\n * @type {RegExp}\n */\nconst HFDTEDATE_RECORD_RE = /^HFDTEDATE:(\\d{2})(\\d{2})(\\d{2}),(\\d{2})/;\n\n/**\n * A regular expression matching the newline characters `\\r\\n`, `\\r` and `\\n`.\n *\n * @const\n * @type {RegExp}\n */\nconst NEWLINE_RE = /\\r\\n|\\r|\\n/;\n\n/**\n * @typedef {Object} Options\n * @property {IGCZ} [altitudeMode='none'] Altitude mode. Possible\n * values are `'barometric'`, `'gps'`, and `'none'`.\n */\n\n/**\n * @classdesc\n * Feature format for `*.igc` flight recording files.\n *\n * As IGC sources contain a single feature,\n * {@link module:ol/format/IGC~IGC#readFeatures} will return the feature in an\n * array\n *\n * @api\n */\nclass IGC extends TextFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection('EPSG:4326');\n\n /**\n * @private\n * @type {IGCZ}\n */\n this.altitudeMode_ = options.altitudeMode ? options.altitudeMode : 'none';\n\n /**\n * @private\n * @type {boolean}\n */\n this.lad_ = false;\n\n /**\n * @private\n * @type {boolean}\n */\n this.lod_ = false;\n\n /**\n * @private\n * @type {number}\n */\n this.ladStart_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.ladStop_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.lodStart_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.lodStop_ = 0;\n }\n\n /**\n * @protected\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @override\n */\n readFeatureFromText(text, options) {\n const altitudeMode = this.altitudeMode_;\n const lines = text.split(NEWLINE_RE);\n /** @type {Object<string, string>} */\n const properties = {};\n const flatCoordinates = [];\n let year = 2000;\n let month = 0;\n let day = 1;\n let lastDateTime = -1;\n let i, ii;\n for (i = 0, ii = lines.length; i < ii; ++i) {\n const line = lines[i];\n let m;\n if (line.charAt(0) == 'B') {\n m = B_RECORD_RE.exec(line);\n if (m) {\n const hour = parseInt(m[1], 10);\n const minute = parseInt(m[2], 10);\n const second = parseInt(m[3], 10);\n let y = parseInt(m[4], 10) + parseInt(m[5], 10) / 60000;\n if (this.lad_) {\n y +=\n parseInt(line.slice(this.ladStart_, this.ladStop_), 10) /\n 60000 /\n 10 ** (this.ladStop_ - this.ladStart_);\n }\n if (m[6] == 'S') {\n y = -y;\n }\n let x = parseInt(m[7], 10) + parseInt(m[8], 10) / 60000;\n if (this.lod_) {\n x +=\n parseInt(line.slice(this.lodStart_, this.lodStop_), 10) /\n 60000 /\n 10 ** (this.lodStop_ - this.lodStart_);\n }\n if (m[9] == 'W') {\n x = -x;\n }\n flatCoordinates.push(x, y);\n if (altitudeMode != 'none') {\n let z;\n if (altitudeMode == 'gps') {\n z = parseInt(m[11], 10);\n } else if (altitudeMode == 'barometric') {\n z = parseInt(m[12], 10);\n } else {\n z = 0;\n }\n flatCoordinates.push(z);\n }\n let dateTime = Date.UTC(year, month, day, hour, minute, second);\n // Detect UTC midnight wrap around.\n if (dateTime < lastDateTime) {\n dateTime = Date.UTC(year, month, day + 1, hour, minute, second);\n }\n flatCoordinates.push(dateTime / 1000);\n lastDateTime = dateTime;\n }\n } else if (line.charAt(0) == 'H') {\n m = HFDTEDATE_RECORD_RE.exec(line);\n if (m) {\n day = parseInt(m[1], 10);\n month = parseInt(m[2], 10) - 1;\n year = 2000 + parseInt(m[3], 10);\n } else {\n m = HFDTE_RECORD_RE.exec(line);\n if (m) {\n day = parseInt(m[1], 10);\n month = parseInt(m[2], 10) - 1;\n year = 2000 + parseInt(m[3], 10);\n } else {\n m = H_RECORD_RE.exec(line);\n if (m) {\n properties[m[1]] = m[2].trim();\n }\n }\n }\n } else if (line.charAt(0) == 'I') {\n const numberAdds = parseInt(line.slice(1, 3), 10);\n for (let i = 0; i < numberAdds; i++) {\n const addCode = line.slice(7 + i * 7, 10 + i * 7);\n if (addCode === 'LAD' || addCode === 'LOD') {\n // in IGC format, columns are numbered from 1\n const addStart = parseInt(line.slice(3 + i * 7, 5 + i * 7), 10) - 1;\n const addStop = parseInt(line.slice(5 + i * 7, 7 + i * 7), 10);\n if (addCode === 'LAD') {\n this.lad_ = true;\n this.ladStart_ = addStart;\n this.ladStop_ = addStop;\n } else if (addCode === 'LOD') {\n this.lod_ = true;\n this.lodStart_ = addStart;\n this.lodStop_ = addStop;\n }\n }\n }\n }\n }\n if (flatCoordinates.length === 0) {\n return null;\n }\n const layout = altitudeMode == 'none' ? 'XYM' : 'XYZM';\n const lineString = new LineString(flatCoordinates, layout);\n const feature = new Feature(\n transformGeometryWithOptions(lineString, false, options),\n );\n feature.setProperties(properties, true);\n return feature;\n }\n\n /**\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<Feature>} Features.\n * @override\n */\n readFeaturesFromText(text, options) {\n const feature = this.readFeatureFromText(text, options);\n if (feature) {\n return [feature];\n }\n return [];\n }\n}\n\nexport default IGC;\n","/**\n * @module ol/format/KML\n */\nimport Feature from '../Feature.js';\nimport ImageState from '../ImageState.js';\nimport {extend} from '../array.js';\nimport {asArray} from '../color.js';\nimport GeometryCollection from '../geom/GeometryCollection.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {toRadians} from '../math.js';\nimport {get as getProjection} from '../proj.js';\nimport Fill from '../style/Fill.js';\nimport Icon from '../style/Icon.js';\nimport Stroke from '../style/Stroke.js';\nimport Style from '../style/Style.js';\nimport Text from '../style/Text.js';\nimport {\n OBJECT_PROPERTY_NODE_FACTORY,\n XML_SCHEMA_INSTANCE_URI,\n createElementNS,\n getAllTextContent,\n isDocument,\n makeArrayExtender,\n makeArrayPusher,\n makeChildAppender,\n makeObjectPropertySetter,\n makeReplacer,\n makeSequence,\n makeSimpleNodeFactory,\n makeStructureNS,\n parse,\n parseNode,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport XMLFeature from './XMLFeature.js';\nimport {\n readBoolean,\n readDecimal,\n readString,\n writeBooleanTextNode,\n writeDecimalTextNode,\n writeStringTextNode,\n} from './xsd.js';\n\n/**\n * @typedef {Object} Vec2\n * @property {number} x X coordinate.\n * @property {import(\"../style/Icon.js\").IconAnchorUnits} xunits Units of x.\n * @property {number} y Y coordinate.\n * @property {import(\"../style/Icon.js\").IconAnchorUnits} yunits Units of Y.\n * @property {import(\"../style/Icon.js\").IconOrigin} [origin] Origin.\n */\n\n/**\n * @typedef {Object} GxTrackObject\n * @property {Array<Array<number>>} coordinates Coordinates.\n * @property {Array<number>} whens Whens.\n */\n\n/**\n * @const\n * @type {Array<string>}\n */\nconst GX_NAMESPACE_URIS = ['http://www.google.com/kml/ext/2.2'];\n\n/**\n * @const\n * @type {Array<null|string>}\n */\nconst NAMESPACE_URIS = [\n null,\n 'http://earth.google.com/kml/2.0',\n 'http://earth.google.com/kml/2.1',\n 'http://earth.google.com/kml/2.2',\n 'http://www.opengis.net/kml/2.2',\n];\n\n/**\n * @const\n * @type {string}\n */\nconst SCHEMA_LOCATION =\n 'http://www.opengis.net/kml/2.2 ' +\n 'https://developers.google.com/kml/schema/kml22gx.xsd';\n\n/**\n * @type {Object<string, import(\"../style/Icon.js\").IconAnchorUnits>}\n */\nconst ICON_ANCHOR_UNITS_MAP = {\n 'fraction': 'fraction',\n 'pixels': 'pixels',\n 'insetPixels': 'pixels',\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst PLACEMARK_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'ExtendedData': extendedDataParser,\n 'Region': regionParser,\n 'MultiGeometry': makeObjectPropertySetter(readMultiGeometry, 'geometry'),\n 'LineString': makeObjectPropertySetter(readLineString, 'geometry'),\n 'LinearRing': makeObjectPropertySetter(readLinearRing, 'geometry'),\n 'Point': makeObjectPropertySetter(readPoint, 'geometry'),\n 'Polygon': makeObjectPropertySetter(readPolygon, 'geometry'),\n 'Style': makeObjectPropertySetter(readStyle),\n 'StyleMap': placemarkStyleMapParser,\n 'address': makeObjectPropertySetter(readString),\n 'description': makeObjectPropertySetter(readString),\n 'name': makeObjectPropertySetter(readString),\n 'open': makeObjectPropertySetter(readBoolean),\n 'phoneNumber': makeObjectPropertySetter(readString),\n 'styleUrl': makeObjectPropertySetter(readStyleURL),\n 'visibility': makeObjectPropertySetter(readBoolean),\n },\n makeStructureNS(GX_NAMESPACE_URIS, {\n 'MultiTrack': makeObjectPropertySetter(readGxMultiTrack, 'geometry'),\n 'Track': makeObjectPropertySetter(readGxTrack, 'geometry'),\n }),\n);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst NETWORK_LINK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ExtendedData': extendedDataParser,\n 'Region': regionParser,\n 'Link': linkParser,\n 'address': makeObjectPropertySetter(readString),\n 'description': makeObjectPropertySetter(readString),\n 'name': makeObjectPropertySetter(readString),\n 'open': makeObjectPropertySetter(readBoolean),\n 'phoneNumber': makeObjectPropertySetter(readString),\n 'visibility': makeObjectPropertySetter(readBoolean),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LINK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'href': makeObjectPropertySetter(readURI),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CAMERA_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n Altitude: makeObjectPropertySetter(readDecimal),\n Longitude: makeObjectPropertySetter(readDecimal),\n Latitude: makeObjectPropertySetter(readDecimal),\n Tilt: makeObjectPropertySetter(readDecimal),\n AltitudeMode: makeObjectPropertySetter(readString),\n Heading: makeObjectPropertySetter(readDecimal),\n Roll: makeObjectPropertySetter(readDecimal),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst REGION_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'LatLonAltBox': latLonAltBoxParser,\n 'Lod': lodParser,\n});\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst KML_SEQUENCE = makeStructureNS(NAMESPACE_URIS, ['Document', 'Placemark']);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst KML_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'Document': makeChildAppender(writeDocument),\n 'Placemark': makeChildAppender(writePlacemark),\n});\n\n/**\n * @type {import(\"../color.js\").Color}\n */\nlet DEFAULT_COLOR;\n\n/**\n * @type {Fill|null}\n */\nlet DEFAULT_FILL_STYLE = null;\n\n/**\n * Get the default fill style (or null if not yet set).\n * @return {Fill|null} The default fill style.\n */\nexport function getDefaultFillStyle() {\n return DEFAULT_FILL_STYLE;\n}\n\n/**\n * @type {import(\"../size.js\").Size}\n */\nlet DEFAULT_IMAGE_STYLE_ANCHOR;\n\n/**\n * @type {import(\"../style/Icon.js\").IconAnchorUnits}\n */\nlet DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;\n\n/**\n * @type {import(\"../style/Icon.js\").IconAnchorUnits}\n */\nlet DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;\n\n/**\n * @type {import(\"../size.js\").Size}\n */\nlet DEFAULT_IMAGE_STYLE_SIZE;\n\n/**\n * @type {string}\n */\nlet DEFAULT_IMAGE_STYLE_SRC;\n\n/**\n * @type {import(\"../style/Image.js\").default|null}\n */\nlet DEFAULT_IMAGE_STYLE = null;\n\n/**\n * Get the default image style (or null if not yet set).\n * @return {import(\"../style/Image.js\").default|null} The default image style.\n */\nexport function getDefaultImageStyle() {\n return DEFAULT_IMAGE_STYLE;\n}\n\n/**\n * @type {string}\n */\nlet DEFAULT_NO_IMAGE_STYLE;\n\n/**\n * @type {Stroke|null}\n */\nlet DEFAULT_STROKE_STYLE = null;\n\n/**\n * Get the default stroke style (or null if not yet set).\n * @return {Stroke|null} The default stroke style.\n */\nexport function getDefaultStrokeStyle() {\n return DEFAULT_STROKE_STYLE;\n}\n\n/**\n * @type {Stroke}\n */\nlet DEFAULT_TEXT_STROKE_STYLE;\n\n/**\n * @type {Text|null}\n */\nlet DEFAULT_TEXT_STYLE = null;\n\n/**\n * Get the default text style (or null if not yet set).\n * @return {Text|null} The default text style.\n */\nexport function getDefaultTextStyle() {\n return DEFAULT_TEXT_STYLE;\n}\n\n/**\n * @type {Style|null}\n */\nlet DEFAULT_STYLE = null;\n\n/**\n * Get the default style (or null if not yet set).\n * @return {Style|null} The default style.\n */\nexport function getDefaultStyle() {\n return DEFAULT_STYLE;\n}\n\n/**\n * @type {Array<Style>|null}\n */\nlet DEFAULT_STYLE_ARRAY = null;\n\n/**\n * Get the default style array (or null if not yet set).\n * @return {Array<Style>|null} The default style.\n */\nexport function getDefaultStyleArray() {\n return DEFAULT_STYLE_ARRAY;\n}\n\n/**\n * Function that returns the scale needed to normalize an icon image to 32 pixels.\n * @param {import(\"../size.js\").Size} size Image size.\n * @return {number} Scale.\n */\nfunction scaleForSize(size) {\n return 32 / Math.min(size[0], size[1]);\n}\n\nfunction createStyleDefaults() {\n DEFAULT_COLOR = [255, 255, 255, 1];\n\n DEFAULT_FILL_STYLE = new Fill({\n color: DEFAULT_COLOR,\n });\n\n DEFAULT_IMAGE_STYLE_ANCHOR = [20, 2];\n\n DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS = 'pixels';\n\n DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS = 'pixels';\n\n DEFAULT_IMAGE_STYLE_SIZE = [64, 64];\n\n DEFAULT_IMAGE_STYLE_SRC =\n 'https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png';\n\n DEFAULT_IMAGE_STYLE = new Icon({\n anchor: DEFAULT_IMAGE_STYLE_ANCHOR,\n anchorOrigin: 'bottom-left',\n anchorXUnits: DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS,\n anchorYUnits: DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS,\n crossOrigin: 'anonymous',\n rotation: 0,\n scale: scaleForSize(DEFAULT_IMAGE_STYLE_SIZE),\n size: DEFAULT_IMAGE_STYLE_SIZE,\n src: DEFAULT_IMAGE_STYLE_SRC,\n });\n\n DEFAULT_NO_IMAGE_STYLE = 'NO_IMAGE';\n\n DEFAULT_STROKE_STYLE = new Stroke({\n color: DEFAULT_COLOR,\n width: 1,\n });\n\n DEFAULT_TEXT_STROKE_STYLE = new Stroke({\n color: [51, 51, 51, 1],\n width: 2,\n });\n\n DEFAULT_TEXT_STYLE = new Text({\n font: 'bold 16px Helvetica',\n fill: DEFAULT_FILL_STYLE,\n stroke: DEFAULT_TEXT_STROKE_STYLE,\n scale: 0.8,\n });\n\n DEFAULT_STYLE = new Style({\n fill: DEFAULT_FILL_STYLE,\n image: DEFAULT_IMAGE_STYLE,\n text: DEFAULT_TEXT_STYLE,\n stroke: DEFAULT_STROKE_STYLE,\n zIndex: 0,\n });\n\n DEFAULT_STYLE_ARRAY = [DEFAULT_STYLE];\n}\n\n/**\n * @type {HTMLTextAreaElement}\n */\nlet TEXTAREA;\n\n/**\n * A function that takes a url `{string}` and returns a url `{string}`.\n * Might be used to change an icon path or to substitute a\n * data url obtained from a KMZ array buffer.\n *\n * @typedef {function(string):string} IconUrlFunction\n * @api\n */\n\n/**\n * Function that returns a url unchanged.\n * @param {string} href Input url.\n * @return {string} Output url.\n */\nfunction defaultIconUrlFunction(href) {\n return href;\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [extractStyles=true] Extract styles from the KML.\n * @property {boolean} [showPointNames=true] Show names as labels for placemarks which contain points.\n * @property {Array<Style>} [defaultStyle] Default style. The\n * default default style is the same as Google Earth.\n * @property {boolean} [writeStyles=true] Write styles into KML.\n * @property {null|string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loaded images. Note that you must provide a\n * `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * @property {IconUrlFunction} [iconUrlFunction] Function that takes a url string and returns a url string.\n * Might be used to change an icon path or to substitute a data url obtained from a KMZ array buffer.\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the KML format.\n *\n * {@link module:ol/format/KML~KML#readFeature} will read the first feature from\n * a KML source.\n *\n * MultiGeometries are converted into GeometryCollections if they are a mix of\n * geometry types, and into MultiPoint/MultiLineString/MultiPolygon if they are\n * all of the same type.\n *\n * @api\n */\nclass KML extends XMLFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n if (!DEFAULT_STYLE_ARRAY) {\n createStyleDefaults();\n }\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection('EPSG:4326');\n\n /**\n * @private\n * @type {Array<Style>}\n */\n this.defaultStyle_ = options.defaultStyle\n ? options.defaultStyle\n : DEFAULT_STYLE_ARRAY;\n\n /**\n * @private\n * @type {boolean}\n */\n this.extractStyles_ =\n options.extractStyles !== undefined ? options.extractStyles : true;\n\n /**\n * @type {boolean}\n */\n this.writeStyles_ =\n options.writeStyles !== undefined ? options.writeStyles : true;\n\n /**\n * @private\n * @type {!Object<string, (Array<Style>|string)>}\n */\n this.sharedStyles_ = {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.showPointNames_ =\n options.showPointNames !== undefined ? options.showPointNames : true;\n\n /**\n * @type {null|string}\n */\n this.crossOrigin_ =\n options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';\n\n /**\n * @type {IconUrlFunction}\n */\n this.iconUrlFunction_ = options.iconUrlFunction\n ? options.iconUrlFunction\n : defaultIconUrlFunction;\n\n this.supportedMediaTypes = ['application/vnd.google-earth.kml+xml'];\n }\n\n /**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @private\n * @return {Array<Feature>|undefined} Features.\n */\n readDocumentOrFolder_(node, objectStack) {\n // FIXME use scope somehow\n const parsersNS = makeStructureNS(NAMESPACE_URIS, {\n 'Document': makeArrayExtender(this.readDocumentOrFolder_, this),\n 'Folder': makeArrayExtender(this.readDocumentOrFolder_, this),\n 'Placemark': makeArrayPusher(this.readPlacemark_, this),\n 'Style': this.readSharedStyle_.bind(this),\n 'StyleMap': this.readSharedStyleMap_.bind(this),\n });\n /** @type {Array<Feature>} */\n // @ts-ignore\n const features = pushParseAndPop([], parsersNS, node, objectStack, this);\n if (features) {\n return features;\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @private\n * @return {Feature|undefined} Feature.\n */\n readPlacemark_(node, objectStack) {\n const object = pushParseAndPop(\n {'geometry': null},\n PLACEMARK_PARSERS,\n node,\n objectStack,\n this,\n );\n if (!object) {\n return undefined;\n }\n const feature = new Feature();\n const id = node.getAttribute('id');\n if (id !== null) {\n feature.setId(id);\n }\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n\n const geometry = object['geometry'];\n if (geometry) {\n transformGeometryWithOptions(geometry, false, options);\n }\n feature.setGeometry(geometry);\n delete object['geometry'];\n\n if (this.extractStyles_) {\n const style = object['Style'];\n const styleUrl = object['styleUrl'];\n const styleFunction = createFeatureStyleFunction(\n style,\n styleUrl,\n this.defaultStyle_,\n this.sharedStyles_,\n this.showPointNames_,\n );\n feature.setStyle(styleFunction);\n }\n delete object['Style'];\n // we do not remove the styleUrl property from the object, so it\n // gets stored on feature when setProperties is called\n\n feature.setProperties(object, true);\n\n return feature;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @private\n */\n readSharedStyle_(node, objectStack) {\n const id = node.getAttribute('id');\n if (id !== null) {\n const style = readStyle.call(this, node, objectStack);\n if (style) {\n let styleUri;\n let baseURI = node.baseURI;\n if (!baseURI || baseURI == 'about:blank') {\n baseURI = window.location.href;\n }\n if (baseURI) {\n const url = new URL('#' + id, baseURI);\n styleUri = url.href;\n } else {\n styleUri = '#' + id;\n }\n this.sharedStyles_[styleUri] = style;\n }\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @private\n */\n readSharedStyleMap_(node, objectStack) {\n const id = node.getAttribute('id');\n if (id === null) {\n return;\n }\n const styleMapValue = readStyleMapValue.call(this, node, objectStack);\n if (!styleMapValue) {\n return;\n }\n let styleUri;\n let baseURI = node.baseURI;\n if (!baseURI || baseURI == 'about:blank') {\n baseURI = window.location.href;\n }\n if (baseURI) {\n const url = new URL('#' + id, baseURI);\n styleUri = url.href;\n } else {\n styleUri = '#' + id;\n }\n this.sharedStyles_[styleUri] = styleMapValue;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @override\n */\n readFeatureFromNode(node, options) {\n if (!NAMESPACE_URIS.includes(node.namespaceURI)) {\n return null;\n }\n const feature = this.readPlacemark_(node, [\n this.getReadOptions(node, options),\n ]);\n if (feature) {\n return feature;\n }\n return null;\n }\n\n /**\n * @protected\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @override\n */\n readFeaturesFromNode(node, options) {\n if (!NAMESPACE_URIS.includes(node.namespaceURI)) {\n return [];\n }\n let features;\n const localName = node.localName;\n if (localName == 'Document' || localName == 'Folder') {\n features = this.readDocumentOrFolder_(node, [\n this.getReadOptions(node, options),\n ]);\n if (features) {\n return features;\n }\n return [];\n }\n if (localName == 'Placemark') {\n const feature = this.readPlacemark_(node, [\n this.getReadOptions(node, options),\n ]);\n if (feature) {\n return [feature];\n }\n return [];\n }\n if (localName == 'kml') {\n features = [];\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n const fs = this.readFeaturesFromNode(n, options);\n if (fs) {\n extend(features, fs);\n }\n }\n return features;\n }\n return [];\n }\n\n /**\n * Read the name of the KML.\n *\n * @param {Document|Element|string} source Source.\n * @return {string|undefined} Name.\n * @api\n */\n readName(source) {\n if (!source) {\n return undefined;\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readNameFromDocument(doc);\n }\n if (isDocument(source)) {\n return this.readNameFromDocument(/** @type {Document} */ (source));\n }\n return this.readNameFromNode(/** @type {Element} */ (source));\n }\n\n /**\n * @param {Document} doc Document.\n * @return {string|undefined} Name.\n */\n readNameFromDocument(doc) {\n for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n const name = this.readNameFromNode(/** @type {Element} */ (n));\n if (name) {\n return name;\n }\n }\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @return {string|undefined} Name.\n */\n readNameFromNode(node) {\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n if (NAMESPACE_URIS.includes(n.namespaceURI) && n.localName == 'name') {\n return readString(n);\n }\n }\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n const localName = n.localName;\n if (\n NAMESPACE_URIS.includes(n.namespaceURI) &&\n (localName == 'Document' ||\n localName == 'Folder' ||\n localName == 'Placemark' ||\n localName == 'kml')\n ) {\n const name = this.readNameFromNode(n);\n if (name) {\n return name;\n }\n }\n }\n return undefined;\n }\n\n /**\n * Read the network links of the KML.\n *\n * @param {Document|Element|string} source Source.\n * @return {Array<Object>} Network links.\n * @api\n */\n readNetworkLinks(source) {\n const networkLinks = [];\n if (typeof source === 'string') {\n const doc = parse(source);\n extend(networkLinks, this.readNetworkLinksFromDocument(doc));\n } else if (isDocument(source)) {\n extend(\n networkLinks,\n this.readNetworkLinksFromDocument(/** @type {Document} */ (source)),\n );\n } else {\n extend(\n networkLinks,\n this.readNetworkLinksFromNode(/** @type {Element} */ (source)),\n );\n }\n return networkLinks;\n }\n\n /**\n * @param {Document} doc Document.\n * @return {Array<Object>} Network links.\n */\n readNetworkLinksFromDocument(doc) {\n const networkLinks = [];\n for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n extend(\n networkLinks,\n this.readNetworkLinksFromNode(/** @type {Element} */ (n)),\n );\n }\n }\n return networkLinks;\n }\n\n /**\n * @param {Element} node Node.\n * @return {Array<Object>} Network links.\n */\n readNetworkLinksFromNode(node) {\n const networkLinks = [];\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n if (\n NAMESPACE_URIS.includes(n.namespaceURI) &&\n n.localName == 'NetworkLink'\n ) {\n const obj = pushParseAndPop({}, NETWORK_LINK_PARSERS, n, []);\n networkLinks.push(obj);\n }\n }\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n const localName = n.localName;\n if (\n NAMESPACE_URIS.includes(n.namespaceURI) &&\n (localName == 'Document' || localName == 'Folder' || localName == 'kml')\n ) {\n extend(networkLinks, this.readNetworkLinksFromNode(n));\n }\n }\n return networkLinks;\n }\n\n /**\n * Read the regions of the KML.\n *\n * @param {Document|Element|string} source Source.\n * @return {Array<Object>} Regions.\n * @api\n */\n readRegion(source) {\n const regions = [];\n if (typeof source === 'string') {\n const doc = parse(source);\n extend(regions, this.readRegionFromDocument(doc));\n } else if (isDocument(source)) {\n extend(\n regions,\n this.readRegionFromDocument(/** @type {Document} */ (source)),\n );\n } else {\n extend(regions, this.readRegionFromNode(/** @type {Element} */ (source)));\n }\n return regions;\n }\n\n /**\n * @param {Document} doc Document.\n * @return {Array<Object>} Region.\n */\n readRegionFromDocument(doc) {\n const regions = [];\n for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n extend(regions, this.readRegionFromNode(/** @type {Element} */ (n)));\n }\n }\n return regions;\n }\n\n /**\n * @param {Element} node Node.\n * @return {Array<Object>} Region.\n * @api\n */\n readRegionFromNode(node) {\n const regions = [];\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n if (NAMESPACE_URIS.includes(n.namespaceURI) && n.localName == 'Region') {\n const obj = pushParseAndPop({}, REGION_PARSERS, n, []);\n regions.push(obj);\n }\n }\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n const localName = n.localName;\n if (\n NAMESPACE_URIS.includes(n.namespaceURI) &&\n (localName == 'Document' || localName == 'Folder' || localName == 'kml')\n ) {\n extend(regions, this.readRegionFromNode(n));\n }\n }\n return regions;\n }\n\n /**\n * @typedef {Object} KMLCamera Specifies the observer's viewpoint and associated view parameters.\n * @property {number} [Latitude] Latitude of the camera.\n * @property {number} [Longitude] Longitude of the camera.\n * @property {number} [Altitude] Altitude of the camera.\n * @property {string} [AltitudeMode] Floor-related altitude mode.\n * @property {number} [Heading] Horizontal camera rotation.\n * @property {number} [Tilt] Lateral camera rotation.\n * @property {number} [Roll] Vertical camera rotation.\n */\n\n /**\n * Read the cameras of the KML.\n *\n * @param {Document|Element|string} source Source.\n * @return {Array<KMLCamera>} Cameras.\n * @api\n */\n readCamera(source) {\n const cameras = [];\n if (typeof source === 'string') {\n const doc = parse(source);\n extend(cameras, this.readCameraFromDocument(doc));\n } else if (isDocument(source)) {\n extend(\n cameras,\n this.readCameraFromDocument(/** @type {Document} */ (source)),\n );\n } else {\n extend(cameras, this.readCameraFromNode(/** @type {Element} */ (source)));\n }\n return cameras;\n }\n\n /**\n * @param {Document} doc Document.\n * @return {Array<KMLCamera>} Cameras.\n */\n readCameraFromDocument(doc) {\n const cameras = [];\n for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {\n if (n.nodeType === Node.ELEMENT_NODE) {\n extend(cameras, this.readCameraFromNode(/** @type {Element} */ (n)));\n }\n }\n return cameras;\n }\n\n /**\n * @param {Element} node Node.\n * @return {Array<KMLCamera>} Cameras.\n * @api\n */\n readCameraFromNode(node) {\n const cameras = [];\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n if (NAMESPACE_URIS.includes(n.namespaceURI) && n.localName === 'Camera') {\n const obj = pushParseAndPop({}, CAMERA_PARSERS, n, []);\n cameras.push(obj);\n }\n }\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n const localName = n.localName;\n if (\n NAMESPACE_URIS.includes(n.namespaceURI) &&\n (localName === 'Document' ||\n localName === 'Folder' ||\n localName === 'Placemark' ||\n localName === 'kml')\n ) {\n extend(cameras, this.readCameraFromNode(n));\n }\n }\n return cameras;\n }\n\n /**\n * Encode an array of features in the KML format as an XML node. GeometryCollections,\n * MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries.\n *\n * @param {Array<Feature>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Node} Node.\n * @api\n * @override\n */\n writeFeaturesNode(features, options) {\n options = this.adaptOptions(options);\n const kml = createElementNS(NAMESPACE_URIS[4], 'kml');\n const xmlnsUri = 'http://www.w3.org/2000/xmlns/';\n kml.setAttributeNS(xmlnsUri, 'xmlns:gx', GX_NAMESPACE_URIS[0]);\n kml.setAttributeNS(xmlnsUri, 'xmlns:xsi', XML_SCHEMA_INSTANCE_URI);\n kml.setAttributeNS(\n XML_SCHEMA_INSTANCE_URI,\n 'xsi:schemaLocation',\n SCHEMA_LOCATION,\n );\n\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {\n node: kml,\n };\n /** @type {!Object<string, (Array<Feature>|Feature|undefined)>} */\n const properties = {};\n if (features.length > 1) {\n properties['Document'] = features;\n } else if (features.length == 1) {\n properties['Placemark'] = features[0];\n }\n const orderedKeys = KML_SEQUENCE[kml.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n KML_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n [options],\n orderedKeys,\n this,\n );\n return kml;\n }\n}\n\n/**\n * @param {Style|undefined} foundStyle Style.\n * @param {string} name Name.\n * @return {Style} style Style.\n */\nfunction createNameStyleFunction(foundStyle, name) {\n const textOffset = [0, 0];\n /** @type {CanvasTextAlign} */\n let textAlign = 'start';\n const imageStyle = foundStyle.getImage();\n if (imageStyle) {\n const imageSize = imageStyle.getSize();\n if (imageSize && imageSize.length == 2) {\n const imageScale = imageStyle.getScaleArray();\n const anchor = imageStyle.getAnchor();\n // Offset the label to be centered to the right of the icon,\n // if there is one.\n textOffset[0] = imageScale[0] * (imageSize[0] - anchor[0]);\n textOffset[1] = imageScale[1] * (imageSize[1] / 2 - anchor[1]);\n textAlign = 'left';\n }\n }\n let textStyle = foundStyle.getText();\n if (textStyle) {\n // clone the text style, customizing it with name, alignments and offset.\n // Note that kml does not support many text options that OpenLayers does (rotation, textBaseline).\n textStyle = textStyle.clone();\n textStyle.setFont(textStyle.getFont() || DEFAULT_TEXT_STYLE.getFont());\n textStyle.setScale(textStyle.getScale() || DEFAULT_TEXT_STYLE.getScale());\n textStyle.setFill(textStyle.getFill() || DEFAULT_TEXT_STYLE.getFill());\n textStyle.setStroke(textStyle.getStroke() || DEFAULT_TEXT_STROKE_STYLE);\n } else {\n textStyle = DEFAULT_TEXT_STYLE.clone();\n }\n textStyle.setText(name);\n textStyle.setOffsetX(textOffset[0]);\n textStyle.setOffsetY(textOffset[1]);\n textStyle.setTextAlign(textAlign);\n\n const nameStyle = new Style({\n image: imageStyle,\n text: textStyle,\n });\n return nameStyle;\n}\n\n/**\n * @param {Array<Style>|undefined} style Style.\n * @param {string} styleUrl Style URL.\n * @param {Array<Style>} defaultStyle Default style.\n * @param {!Object<string, (Array<Style>|string)>} sharedStyles Shared styles.\n * @param {boolean|undefined} showPointNames true to show names for point placemarks.\n * @return {import(\"../style/Style.js\").StyleFunction} Feature style function.\n */\nfunction createFeatureStyleFunction(\n style,\n styleUrl,\n defaultStyle,\n sharedStyles,\n showPointNames,\n) {\n return (\n /**\n * @param {Feature} feature feature.\n * @param {number} resolution Resolution.\n * @return {Array<Style>|Style} Style.\n */\n function (feature, resolution) {\n let drawName = showPointNames;\n let name = '';\n let multiGeometryPoints = [];\n if (drawName) {\n const geometry = feature.getGeometry();\n if (geometry) {\n if (geometry instanceof GeometryCollection) {\n multiGeometryPoints = geometry\n .getGeometriesArrayRecursive()\n .filter(function (geometry) {\n const type = geometry.getType();\n return type === 'Point' || type === 'MultiPoint';\n });\n drawName = multiGeometryPoints.length > 0;\n } else {\n const type = geometry.getType();\n drawName = type === 'Point' || type === 'MultiPoint';\n }\n }\n }\n\n if (drawName) {\n name = /** @type {string} */ (feature.get('name'));\n drawName = drawName && !!name;\n // convert any html character codes\n if (drawName && /&[^&]+;/.test(name)) {\n if (!TEXTAREA) {\n TEXTAREA = document.createElement('textarea');\n }\n TEXTAREA.innerHTML = name;\n name = TEXTAREA.value;\n }\n }\n\n let featureStyle = defaultStyle;\n if (style) {\n featureStyle = style;\n } else if (styleUrl) {\n featureStyle = findStyle(styleUrl, defaultStyle, sharedStyles);\n }\n if (drawName) {\n const nameStyle = createNameStyleFunction(featureStyle[0], name);\n if (multiGeometryPoints.length > 0) {\n // in multigeometries restrict the name style to points and create a\n // style without image or text for geometries requiring fill or stroke\n // including any polygon specific style if there is one\n nameStyle.setGeometry(new GeometryCollection(multiGeometryPoints));\n const baseStyle = new Style({\n geometry: featureStyle[0].getGeometry(),\n image: null,\n fill: featureStyle[0].getFill(),\n stroke: featureStyle[0].getStroke(),\n text: null,\n });\n return [nameStyle, baseStyle].concat(featureStyle.slice(1));\n }\n return nameStyle;\n }\n return featureStyle;\n }\n );\n}\n\n/**\n * @param {Array<Style>|string|undefined} styleValue Style value.\n * @param {Array<Style>} defaultStyle Default style.\n * @param {!Object<string, (Array<Style>|string)>} sharedStyles\n * Shared styles.\n * @return {Array<Style>} Style.\n */\nfunction findStyle(styleValue, defaultStyle, sharedStyles) {\n if (Array.isArray(styleValue)) {\n return styleValue;\n }\n if (typeof styleValue === 'string') {\n return findStyle(sharedStyles[styleValue], defaultStyle, sharedStyles);\n }\n return defaultStyle;\n}\n\n/**\n * @param {Node} node Node.\n * @return {import(\"../color.js\").Color|undefined} Color.\n */\nfunction readColor(node) {\n const s = getAllTextContent(node, false);\n // The KML specification states that colors should not include a leading `#`\n // but we tolerate them.\n const m = /^\\s*#?\\s*([0-9A-Fa-f]{8})\\s*$/.exec(s);\n if (m) {\n const hexColor = m[1];\n return [\n parseInt(hexColor.substr(6, 2), 16),\n parseInt(hexColor.substr(4, 2), 16),\n parseInt(hexColor.substr(2, 2), 16),\n parseInt(hexColor.substr(0, 2), 16) / 255,\n ];\n }\n return undefined;\n}\n\n/**\n * @param {Node} node Node.\n * @return {Array<number>|undefined} Flat coordinates.\n */\nexport function readFlatCoordinates(node) {\n let s = getAllTextContent(node, false);\n const flatCoordinates = [];\n // The KML specification states that coordinate tuples should not include\n // spaces, but we tolerate them.\n s = s.replace(/\\s*,\\s*/g, ',');\n const re =\n /^\\s*([+\\-]?\\d*\\.?\\d+(?:e[+\\-]?\\d+)?),([+\\-]?\\d*\\.?\\d+(?:e[+\\-]?\\d+)?)(?:\\s+|,|$)(?:([+\\-]?\\d*\\.?\\d+(?:e[+\\-]?\\d+)?)(?:\\s+|$))?\\s*/i;\n let m;\n while ((m = re.exec(s))) {\n const x = parseFloat(m[1]);\n const y = parseFloat(m[2]);\n const z = m[3] ? parseFloat(m[3]) : 0;\n flatCoordinates.push(x, y, z);\n s = s.substr(m[0].length);\n }\n if (s !== '') {\n return undefined;\n }\n return flatCoordinates;\n}\n\n/**\n * @param {Node} node Node.\n * @return {string} URI.\n */\nfunction readURI(node) {\n const s = getAllTextContent(node, false).trim();\n let baseURI = node.baseURI;\n if (!baseURI || baseURI == 'about:blank') {\n baseURI = window.location.href;\n }\n if (baseURI) {\n const url = new URL(s, baseURI);\n return url.href;\n }\n return s;\n}\n\n/**\n * @param {Node} node Node.\n * @return {string} URI.\n */\nfunction readStyleURL(node) {\n // KML files in the wild occasionally forget the leading\n // `#` on styleUrlsdefined in the same document.\n const s = getAllTextContent(node, false)\n .trim()\n .replace(/^(?!.*#)/, '#');\n let baseURI = node.baseURI;\n if (!baseURI || baseURI == 'about:blank') {\n baseURI = window.location.href;\n }\n if (baseURI) {\n const url = new URL(s, baseURI);\n return url.href;\n }\n return s;\n}\n\n/**\n * @param {Element} node Node.\n * @return {Vec2} Vec2.\n */\nfunction readVec2(node) {\n const xunits = node.getAttribute('xunits');\n const yunits = node.getAttribute('yunits');\n /** @type {import('../style/Icon.js').IconOrigin} */\n let origin;\n if (xunits !== 'insetPixels') {\n if (yunits !== 'insetPixels') {\n origin = 'bottom-left';\n } else {\n origin = 'top-left';\n }\n } else {\n if (yunits !== 'insetPixels') {\n origin = 'bottom-right';\n } else {\n origin = 'top-right';\n }\n }\n return {\n x: parseFloat(node.getAttribute('x')),\n xunits: ICON_ANCHOR_UNITS_MAP[xunits],\n y: parseFloat(node.getAttribute('y')),\n yunits: ICON_ANCHOR_UNITS_MAP[yunits],\n origin: origin,\n };\n}\n\n/**\n * @param {Node} node Node.\n * @return {number|undefined} Scale.\n */\nfunction readScale(node) {\n return readDecimal(node);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst STYLE_MAP_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Pair': pairDataParser,\n});\n\n/**\n * @this {KML}\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<Style>|string|undefined} StyleMap.\n */\nfunction readStyleMapValue(node, objectStack) {\n return pushParseAndPop(undefined, STYLE_MAP_PARSERS, node, objectStack, this);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst ICON_STYLE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Icon': makeObjectPropertySetter(readIcon),\n 'color': makeObjectPropertySetter(readColor),\n 'heading': makeObjectPropertySetter(readDecimal),\n 'hotSpot': makeObjectPropertySetter(readVec2),\n 'scale': makeObjectPropertySetter(readScale),\n});\n\n/**\n * @this {KML}\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction iconStyleParser(node, objectStack) {\n // FIXME refreshMode\n // FIXME refreshInterval\n // FIXME viewRefreshTime\n // FIXME viewBoundScale\n // FIXME viewFormat\n // FIXME httpQuery\n const object = pushParseAndPop({}, ICON_STYLE_PARSERS, node, objectStack);\n if (!object) {\n return;\n }\n const styleObject = /** @type {Object} */ (\n objectStack[objectStack.length - 1]\n );\n const IconObject = 'Icon' in object ? object['Icon'] : {};\n const drawIcon = !('Icon' in object) || Object.keys(IconObject).length > 0;\n let src;\n const href = /** @type {string|undefined} */ (IconObject['href']);\n if (href) {\n src = href;\n } else if (drawIcon) {\n src = DEFAULT_IMAGE_STYLE_SRC;\n }\n let anchor, anchorXUnits, anchorYUnits;\n /** @type {import('../style/Icon.js').IconOrigin|undefined} */\n let anchorOrigin = 'bottom-left';\n const hotSpot = /** @type {Vec2|undefined} */ (object['hotSpot']);\n if (hotSpot) {\n anchor = [hotSpot.x, hotSpot.y];\n anchorXUnits = hotSpot.xunits;\n anchorYUnits = hotSpot.yunits;\n anchorOrigin = hotSpot.origin;\n } else if (/^https?:\\/\\/maps\\.(?:google|gstatic)\\.com\\//.test(src)) {\n // Google hotspots from https://kml4earth.appspot.com/icons.html#notes\n if (src.includes('pushpin')) {\n anchor = DEFAULT_IMAGE_STYLE_ANCHOR;\n anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;\n anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;\n } else if (src.includes('arrow-reverse')) {\n anchor = [54, 42];\n anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;\n anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;\n } else if (src.includes('paddle')) {\n anchor = [32, 1];\n anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;\n anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;\n }\n }\n\n let offset;\n const x = /** @type {number|undefined} */ (IconObject['x']);\n const y = /** @type {number|undefined} */ (IconObject['y']);\n if (x !== undefined && y !== undefined) {\n offset = [x, y];\n }\n\n let size;\n const w = /** @type {number|undefined} */ (IconObject['w']);\n const h = /** @type {number|undefined} */ (IconObject['h']);\n if (w !== undefined && h !== undefined) {\n size = [w, h];\n }\n\n let rotation;\n const heading = /** @type {number} */ (object['heading']);\n if (heading !== undefined) {\n rotation = toRadians(heading);\n }\n\n const scale = /** @type {number|undefined} */ (object['scale']);\n\n const color = /** @type {Array<number>|undefined} */ (object['color']);\n\n if (drawIcon) {\n if (src == DEFAULT_IMAGE_STYLE_SRC) {\n size = DEFAULT_IMAGE_STYLE_SIZE;\n }\n\n const imageStyle = new Icon({\n anchor: anchor,\n anchorOrigin: anchorOrigin,\n anchorXUnits: anchorXUnits,\n anchorYUnits: anchorYUnits,\n crossOrigin: this.crossOrigin_,\n offset: offset,\n offsetOrigin: 'bottom-left',\n rotation: rotation,\n scale: scale,\n size: size,\n src: this.iconUrlFunction_(src),\n color: color,\n });\n\n const imageScale = imageStyle.getScaleArray()[0];\n const imageSize = imageStyle.getSize();\n if (imageSize === null) {\n const imageState = imageStyle.getImageState();\n if (imageState === ImageState.IDLE || imageState === ImageState.LOADING) {\n const listener = function () {\n const imageState = imageStyle.getImageState();\n if (\n !(\n imageState === ImageState.IDLE ||\n imageState === ImageState.LOADING\n )\n ) {\n const imageSize = imageStyle.getSize();\n if (imageSize && imageSize.length == 2) {\n const resizeScale = scaleForSize(imageSize);\n imageStyle.setScale(imageScale * resizeScale);\n }\n imageStyle.unlistenImageChange(listener);\n }\n };\n imageStyle.listenImageChange(listener);\n if (imageState === ImageState.IDLE) {\n imageStyle.load();\n }\n }\n } else if (imageSize.length == 2) {\n const resizeScale = scaleForSize(imageSize);\n imageStyle.setScale(imageScale * resizeScale);\n }\n styleObject['imageStyle'] = imageStyle;\n } else {\n // handle the case when we explicitly want to draw no icon.\n styleObject['imageStyle'] = DEFAULT_NO_IMAGE_STYLE;\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LABEL_STYLE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'color': makeObjectPropertySetter(readColor),\n 'scale': makeObjectPropertySetter(readScale),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction labelStyleParser(node, objectStack) {\n // FIXME colorMode\n const object = pushParseAndPop({}, LABEL_STYLE_PARSERS, node, objectStack);\n if (!object) {\n return;\n }\n const styleObject = objectStack[objectStack.length - 1];\n const textStyle = new Text({\n fill: new Fill({\n color:\n /** @type {import(\"../color.js\").Color} */\n ('color' in object ? object['color'] : DEFAULT_COLOR),\n }),\n scale: /** @type {number|undefined} */ (object['scale']),\n });\n styleObject['textStyle'] = textStyle;\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LINE_STYLE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'color': makeObjectPropertySetter(readColor),\n 'width': makeObjectPropertySetter(readDecimal),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction lineStyleParser(node, objectStack) {\n // FIXME colorMode\n // FIXME gx:outerColor\n // FIXME gx:outerWidth\n // FIXME gx:physicalWidth\n // FIXME gx:labelVisibility\n const object = pushParseAndPop({}, LINE_STYLE_PARSERS, node, objectStack);\n if (!object) {\n return;\n }\n const styleObject = objectStack[objectStack.length - 1];\n const strokeStyle = new Stroke({\n color:\n /** @type {import(\"../color.js\").Color} */\n ('color' in object ? object['color'] : DEFAULT_COLOR),\n width: /** @type {number} */ ('width' in object ? object['width'] : 1),\n });\n styleObject['strokeStyle'] = strokeStyle;\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst POLY_STYLE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'color': makeObjectPropertySetter(readColor),\n 'fill': makeObjectPropertySetter(readBoolean),\n 'outline': makeObjectPropertySetter(readBoolean),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction polyStyleParser(node, objectStack) {\n // FIXME colorMode\n const object = pushParseAndPop({}, POLY_STYLE_PARSERS, node, objectStack);\n if (!object) {\n return;\n }\n const styleObject = objectStack[objectStack.length - 1];\n const fillStyle = new Fill({\n color:\n /** @type {import(\"../color.js\").Color} */\n ('color' in object ? object['color'] : DEFAULT_COLOR),\n });\n styleObject['fillStyle'] = fillStyle;\n const fill = /** @type {boolean|undefined} */ (object['fill']);\n if (fill !== undefined) {\n styleObject['fill'] = fill;\n }\n const outline = /** @type {boolean|undefined} */ (object['outline']);\n if (outline !== undefined) {\n styleObject['outline'] = outline;\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst FLAT_LINEAR_RING_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'coordinates': makeReplacer(readFlatCoordinates),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>} LinearRing flat coordinates.\n */\nfunction readFlatLinearRing(node, objectStack) {\n return pushParseAndPop(null, FLAT_LINEAR_RING_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction gxCoordParser(node, objectStack) {\n const gxTrackObject =\n /** @type {GxTrackObject} */\n (objectStack[objectStack.length - 1]);\n const coordinates = gxTrackObject.coordinates;\n const s = getAllTextContent(node, false);\n const re =\n /^\\s*([+\\-]?\\d+(?:\\.\\d*)?(?:e[+\\-]?\\d*)?)\\s+([+\\-]?\\d+(?:\\.\\d*)?(?:e[+\\-]?\\d*)?)\\s+([+\\-]?\\d+(?:\\.\\d*)?(?:e[+\\-]?\\d*)?)\\s*$/i;\n const m = re.exec(s);\n if (m) {\n const x = parseFloat(m[1]);\n const y = parseFloat(m[2]);\n const z = parseFloat(m[3]);\n coordinates.push([x, y, z]);\n } else {\n coordinates.push([]);\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst GX_MULTITRACK_GEOMETRY_PARSERS = makeStructureNS(GX_NAMESPACE_URIS, {\n 'Track': makeArrayPusher(readGxTrack),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiLineString|undefined} MultiLineString.\n */\nfunction readGxMultiTrack(node, objectStack) {\n const lineStrings = pushParseAndPop(\n [],\n GX_MULTITRACK_GEOMETRY_PARSERS,\n node,\n objectStack,\n );\n if (!lineStrings) {\n return undefined;\n }\n return new MultiLineString(lineStrings);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst GX_TRACK_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'when': whenParser,\n },\n makeStructureNS(GX_NAMESPACE_URIS, {\n 'coord': gxCoordParser,\n }),\n);\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {LineString|undefined} LineString.\n */\nfunction readGxTrack(node, objectStack) {\n const gxTrackObject = pushParseAndPop(\n /** @type {GxTrackObject} */ ({\n coordinates: [],\n whens: [],\n }),\n GX_TRACK_PARSERS,\n node,\n objectStack,\n );\n if (!gxTrackObject) {\n return undefined;\n }\n const flatCoordinates = [];\n const coordinates = gxTrackObject.coordinates;\n const whens = gxTrackObject.whens;\n for (\n let i = 0, ii = Math.min(coordinates.length, whens.length);\n i < ii;\n ++i\n ) {\n if (coordinates[i].length == 3) {\n flatCoordinates.push(\n coordinates[i][0],\n coordinates[i][1],\n coordinates[i][2],\n whens[i],\n );\n }\n }\n return new LineString(flatCoordinates, 'XYZM');\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst ICON_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'href': makeObjectPropertySetter(readURI),\n },\n makeStructureNS(GX_NAMESPACE_URIS, {\n 'x': makeObjectPropertySetter(readDecimal),\n 'y': makeObjectPropertySetter(readDecimal),\n 'w': makeObjectPropertySetter(readDecimal),\n 'h': makeObjectPropertySetter(readDecimal),\n }),\n);\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object} Icon object.\n */\nfunction readIcon(node, objectStack) {\n const iconObject = pushParseAndPop({}, ICON_PARSERS, node, objectStack);\n if (iconObject) {\n return iconObject;\n }\n return null;\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst GEOMETRY_FLAT_COORDINATES_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'coordinates': makeReplacer(readFlatCoordinates),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<number>} Flat coordinates.\n */\nfunction readFlatCoordinatesFromNode(node, objectStack) {\n return pushParseAndPop(\n null,\n GEOMETRY_FLAT_COORDINATES_PARSERS,\n node,\n objectStack,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst EXTRUDE_AND_ALTITUDE_MODE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'extrude': makeObjectPropertySetter(readBoolean),\n 'tessellate': makeObjectPropertySetter(readBoolean),\n 'altitudeMode': makeObjectPropertySetter(readString),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {LineString|undefined} LineString.\n */\nfunction readLineString(node, objectStack) {\n const properties = pushParseAndPop(\n {},\n EXTRUDE_AND_ALTITUDE_MODE_PARSERS,\n node,\n objectStack,\n );\n const flatCoordinates = readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n const lineString = new LineString(flatCoordinates, 'XYZ');\n lineString.setProperties(properties, true);\n return lineString;\n }\n return undefined;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Polygon|undefined} Polygon.\n */\nfunction readLinearRing(node, objectStack) {\n const properties = pushParseAndPop(\n {},\n EXTRUDE_AND_ALTITUDE_MODE_PARSERS,\n node,\n objectStack,\n );\n const flatCoordinates = readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n const polygon = new Polygon(flatCoordinates, 'XYZ', [\n flatCoordinates.length,\n ]);\n polygon.setProperties(properties, true);\n return polygon;\n }\n return undefined;\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst MULTI_GEOMETRY_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'LineString': makeArrayPusher(readLineString),\n 'LinearRing': makeArrayPusher(readLinearRing),\n 'MultiGeometry': makeArrayPusher(readMultiGeometry),\n 'Point': makeArrayPusher(readPoint),\n 'Polygon': makeArrayPusher(readPolygon),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nfunction readMultiGeometry(node, objectStack) {\n const geometries = pushParseAndPop(\n [],\n MULTI_GEOMETRY_PARSERS,\n node,\n objectStack,\n );\n if (!geometries) {\n return null;\n }\n if (geometries.length === 0) {\n return new GeometryCollection(geometries);\n }\n let multiGeometry;\n let homogeneous = true;\n const type = geometries[0].getType();\n let geometry;\n for (let i = 1, ii = geometries.length; i < ii; ++i) {\n geometry = geometries[i];\n if (geometry.getType() != type) {\n homogeneous = false;\n break;\n }\n }\n if (homogeneous) {\n let layout;\n let flatCoordinates;\n if (type == 'Point') {\n const point = geometries[0];\n layout = point.getLayout();\n flatCoordinates = point.getFlatCoordinates();\n for (let i = 1, ii = geometries.length; i < ii; ++i) {\n geometry = geometries[i];\n extend(flatCoordinates, geometry.getFlatCoordinates());\n }\n multiGeometry = new MultiPoint(flatCoordinates, layout);\n setCommonGeometryProperties(multiGeometry, geometries);\n } else if (type == 'LineString') {\n multiGeometry = new MultiLineString(geometries);\n setCommonGeometryProperties(multiGeometry, geometries);\n } else if (type == 'Polygon') {\n multiGeometry = new MultiPolygon(geometries);\n setCommonGeometryProperties(multiGeometry, geometries);\n } else if (type == 'GeometryCollection' || type.startsWith('Multi')) {\n multiGeometry = new GeometryCollection(geometries);\n } else {\n throw new Error('Unknown geometry type found');\n }\n } else {\n multiGeometry = new GeometryCollection(geometries);\n }\n return /** @type {import(\"../geom/Geometry.js\").default} */ (multiGeometry);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Point|undefined} Point.\n */\nfunction readPoint(node, objectStack) {\n const properties = pushParseAndPop(\n {},\n EXTRUDE_AND_ALTITUDE_MODE_PARSERS,\n node,\n objectStack,\n );\n const flatCoordinates = readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n const point = new Point(flatCoordinates, 'XYZ');\n point.setProperties(properties, true);\n return point;\n }\n return undefined;\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst FLAT_LINEAR_RINGS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'innerBoundaryIs': innerBoundaryIsParser,\n 'outerBoundaryIs': outerBoundaryIsParser,\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Polygon|undefined} Polygon.\n */\nfunction readPolygon(node, objectStack) {\n const properties = pushParseAndPop(\n /** @type {Object<string,*>} */ ({}),\n EXTRUDE_AND_ALTITUDE_MODE_PARSERS,\n node,\n objectStack,\n );\n const flatLinearRings = pushParseAndPop(\n [null],\n FLAT_LINEAR_RINGS_PARSERS,\n node,\n objectStack,\n );\n if (flatLinearRings && flatLinearRings[0]) {\n const flatCoordinates = flatLinearRings[0];\n const ends = [flatCoordinates.length];\n for (let i = 1, ii = flatLinearRings.length; i < ii; ++i) {\n extend(flatCoordinates, flatLinearRings[i]);\n ends.push(flatCoordinates.length);\n }\n const polygon = new Polygon(flatCoordinates, 'XYZ', ends);\n polygon.setProperties(properties, true);\n return polygon;\n }\n return undefined;\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst STYLE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'IconStyle': iconStyleParser,\n 'LabelStyle': labelStyleParser,\n 'LineStyle': lineStyleParser,\n 'PolyStyle': polyStyleParser,\n});\n\n/**\n * @this {KML}\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<Style>} Style.\n */\nfunction readStyle(node, objectStack) {\n const styleObject = pushParseAndPop(\n {},\n STYLE_PARSERS,\n node,\n objectStack,\n this,\n );\n if (!styleObject) {\n return null;\n }\n let fillStyle =\n /** @type {Fill} */\n (\n 'fillStyle' in styleObject ? styleObject['fillStyle'] : DEFAULT_FILL_STYLE\n );\n const fill = /** @type {boolean|undefined} */ (styleObject['fill']);\n if (fill !== undefined && !fill) {\n fillStyle = null;\n }\n let imageStyle;\n if ('imageStyle' in styleObject) {\n if (styleObject['imageStyle'] != DEFAULT_NO_IMAGE_STYLE) {\n imageStyle = /** @type {import(\"../style/Image.js\").default} */ (\n styleObject['imageStyle']\n );\n }\n } else {\n imageStyle = DEFAULT_IMAGE_STYLE;\n }\n const textStyle =\n /** @type {Text} */\n (\n 'textStyle' in styleObject ? styleObject['textStyle'] : DEFAULT_TEXT_STYLE\n );\n const strokeStyle =\n /** @type {Stroke} */\n (\n 'strokeStyle' in styleObject\n ? styleObject['strokeStyle']\n : DEFAULT_STROKE_STYLE\n );\n const outline = /** @type {boolean|undefined} */ (styleObject['outline']);\n if (outline !== undefined && !outline) {\n // if the polystyle specifies no outline two styles are needed,\n // one for non-polygon geometries where linestrings require a stroke\n // and one for polygons where there should be no stroke\n return [\n new Style({\n geometry: function (feature) {\n const geometry = feature.getGeometry();\n const type = geometry.getType();\n if (type === 'GeometryCollection') {\n const collection =\n /** @type {import(\"../geom/GeometryCollection\").default} */ (\n geometry\n );\n return new GeometryCollection(\n collection\n .getGeometriesArrayRecursive()\n .filter(function (geometry) {\n const type = geometry.getType();\n return type !== 'Polygon' && type !== 'MultiPolygon';\n }),\n );\n }\n if (type !== 'Polygon' && type !== 'MultiPolygon') {\n return geometry;\n }\n },\n fill: fillStyle,\n image: imageStyle,\n stroke: strokeStyle,\n text: textStyle,\n zIndex: undefined, // FIXME\n }),\n new Style({\n geometry: function (feature) {\n const geometry = feature.getGeometry();\n const type = geometry.getType();\n if (type === 'GeometryCollection') {\n const collection =\n /** @type {import(\"../geom/GeometryCollection\").default} */ (\n geometry\n );\n return new GeometryCollection(\n collection\n .getGeometriesArrayRecursive()\n .filter(function (geometry) {\n const type = geometry.getType();\n return type === 'Polygon' || type === 'MultiPolygon';\n }),\n );\n }\n if (type === 'Polygon' || type === 'MultiPolygon') {\n return geometry;\n }\n },\n fill: fillStyle,\n stroke: null,\n zIndex: undefined, // FIXME\n }),\n ];\n }\n return [\n new Style({\n fill: fillStyle,\n image: imageStyle,\n stroke: strokeStyle,\n text: textStyle,\n zIndex: undefined, // FIXME\n }),\n ];\n}\n\n/**\n * Reads an array of geometries and creates arrays for common geometry\n * properties. Then sets them to the multi geometry.\n * @param {MultiPoint|MultiLineString|MultiPolygon} multiGeometry A multi-geometry.\n * @param {Array<import(\"../geom/Geometry.js\").default>} geometries List of geometries.\n */\nfunction setCommonGeometryProperties(multiGeometry, geometries) {\n const ii = geometries.length;\n const extrudes = new Array(geometries.length);\n const tessellates = new Array(geometries.length);\n const altitudeModes = new Array(geometries.length);\n let hasExtrude, hasTessellate, hasAltitudeMode;\n hasExtrude = false;\n hasTessellate = false;\n hasAltitudeMode = false;\n for (let i = 0; i < ii; ++i) {\n const geometry = geometries[i];\n extrudes[i] = geometry.get('extrude');\n tessellates[i] = geometry.get('tessellate');\n altitudeModes[i] = geometry.get('altitudeMode');\n hasExtrude = hasExtrude || extrudes[i] !== undefined;\n hasTessellate = hasTessellate || tessellates[i] !== undefined;\n hasAltitudeMode = hasAltitudeMode || altitudeModes[i];\n }\n if (hasExtrude) {\n multiGeometry.set('extrude', extrudes);\n }\n if (hasTessellate) {\n multiGeometry.set('tessellate', tessellates);\n }\n if (hasAltitudeMode) {\n multiGeometry.set('altitudeMode', altitudeModes);\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst DATA_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'displayName': makeObjectPropertySetter(readString),\n 'value': makeObjectPropertySetter(readString),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction dataParser(node, objectStack) {\n const name = node.getAttribute('name');\n parseNode(DATA_PARSERS, node, objectStack);\n const featureObject = /** @type {Object} */ (\n objectStack[objectStack.length - 1]\n );\n if (name && featureObject.displayName) {\n featureObject[name] = {\n value: featureObject.value,\n displayName: featureObject.displayName,\n toString: function () {\n return featureObject.value;\n },\n };\n } else if (name !== null) {\n featureObject[name] = featureObject.value;\n } else if (featureObject.displayName !== null) {\n featureObject[featureObject.displayName] = featureObject.value;\n }\n delete featureObject['value'];\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst EXTENDED_DATA_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Data': dataParser,\n 'SchemaData': schemaDataParser,\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction extendedDataParser(node, objectStack) {\n parseNode(EXTENDED_DATA_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction regionParser(node, objectStack) {\n parseNode(REGION_PARSERS, node, objectStack);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst PAIR_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Style': makeObjectPropertySetter(readStyle),\n 'key': makeObjectPropertySetter(readString),\n 'styleUrl': makeObjectPropertySetter(readStyleURL),\n});\n\n/**\n * @this {KML}\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction pairDataParser(node, objectStack) {\n const pairObject = pushParseAndPop({}, PAIR_PARSERS, node, objectStack, this);\n if (!pairObject) {\n return;\n }\n const key = /** @type {string|undefined} */ (pairObject['key']);\n if (key && key == 'normal') {\n const styleUrl = /** @type {string|undefined} */ (pairObject['styleUrl']);\n if (styleUrl) {\n objectStack[objectStack.length - 1] = styleUrl;\n }\n const style = /** @type {Style} */ (pairObject['Style']);\n if (style) {\n objectStack[objectStack.length - 1] = style;\n }\n }\n}\n\n/**\n * @this {KML}\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction placemarkStyleMapParser(node, objectStack) {\n const styleMapValue = readStyleMapValue.call(this, node, objectStack);\n if (!styleMapValue) {\n return;\n }\n const placemarkObject = objectStack[objectStack.length - 1];\n if (Array.isArray(styleMapValue)) {\n placemarkObject['Style'] = styleMapValue;\n } else if (typeof styleMapValue === 'string') {\n placemarkObject['styleUrl'] = styleMapValue;\n } else {\n throw new Error('`styleMapValue` has an unknown type');\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst SCHEMA_DATA_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'SimpleData': simpleDataParser,\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction schemaDataParser(node, objectStack) {\n parseNode(SCHEMA_DATA_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction simpleDataParser(node, objectStack) {\n const name = node.getAttribute('name');\n if (name !== null) {\n const data = readString(node);\n const featureObject = /** @type {Object} */ (\n objectStack[objectStack.length - 1]\n );\n featureObject[name] = data;\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LAT_LON_ALT_BOX_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'altitudeMode': makeObjectPropertySetter(readString),\n 'minAltitude': makeObjectPropertySetter(readDecimal),\n 'maxAltitude': makeObjectPropertySetter(readDecimal),\n 'north': makeObjectPropertySetter(readDecimal),\n 'south': makeObjectPropertySetter(readDecimal),\n 'east': makeObjectPropertySetter(readDecimal),\n 'west': makeObjectPropertySetter(readDecimal),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction latLonAltBoxParser(node, objectStack) {\n const object = pushParseAndPop(\n {},\n LAT_LON_ALT_BOX_PARSERS,\n node,\n objectStack,\n );\n if (!object) {\n return;\n }\n const regionObject = /** @type {Object} */ (\n objectStack[objectStack.length - 1]\n );\n const extent = [\n parseFloat(object['west']),\n parseFloat(object['south']),\n parseFloat(object['east']),\n parseFloat(object['north']),\n ];\n regionObject['extent'] = extent;\n regionObject['altitudeMode'] = object['altitudeMode'];\n regionObject['minAltitude'] = parseFloat(object['minAltitude']);\n regionObject['maxAltitude'] = parseFloat(object['maxAltitude']);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LOD_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'minLodPixels': makeObjectPropertySetter(readDecimal),\n 'maxLodPixels': makeObjectPropertySetter(readDecimal),\n 'minFadeExtent': makeObjectPropertySetter(readDecimal),\n 'maxFadeExtent': makeObjectPropertySetter(readDecimal),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction lodParser(node, objectStack) {\n const object = pushParseAndPop({}, LOD_PARSERS, node, objectStack);\n if (!object) {\n return;\n }\n const lodObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n lodObject['minLodPixels'] = parseFloat(object['minLodPixels']);\n lodObject['maxLodPixels'] = parseFloat(object['maxLodPixels']);\n lodObject['minFadeExtent'] = parseFloat(object['minFadeExtent']);\n lodObject['maxFadeExtent'] = parseFloat(object['maxFadeExtent']);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst INNER_BOUNDARY_IS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n // KML spec only allows one LinearRing per innerBoundaryIs, but Google Earth\n // allows multiple, so we parse multiple here too.\n 'LinearRing': makeArrayPusher(readFlatLinearRing),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction innerBoundaryIsParser(node, objectStack) {\n const innerBoundaryFlatLinearRings = pushParseAndPop(\n /** @type {Array<Array<number>>} */ ([]),\n INNER_BOUNDARY_IS_PARSERS,\n node,\n objectStack,\n );\n if (innerBoundaryFlatLinearRings.length > 0) {\n const flatLinearRings =\n /** @type {Array<Array<number>>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings.push(...innerBoundaryFlatLinearRings);\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst OUTER_BOUNDARY_IS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'LinearRing': makeReplacer(readFlatLinearRing),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction outerBoundaryIsParser(node, objectStack) {\n /** @type {Array<number>|undefined} */\n const flatLinearRing = pushParseAndPop(\n undefined,\n OUTER_BOUNDARY_IS_PARSERS,\n node,\n objectStack,\n );\n if (flatLinearRing) {\n const flatLinearRings =\n /** @type {Array<Array<number>>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings[0] = flatLinearRing;\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction linkParser(node, objectStack) {\n parseNode(LINK_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction whenParser(node, objectStack) {\n const gxTrackObject =\n /** @type {GxTrackObject} */\n (objectStack[objectStack.length - 1]);\n const whens = gxTrackObject.whens;\n const s = getAllTextContent(node, false);\n const when = Date.parse(s);\n whens.push(isNaN(when) ? 0 : when);\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the color to.\n * @param {import(\"../color.js\").Color|string} color Color.\n */\nfunction writeColorTextNode(node, color) {\n const rgba = asArray(color);\n const opacity = rgba.length == 4 ? rgba[3] : 1;\n /** @type {Array<string|number>} */\n const abgr = [opacity * 255, rgba[2], rgba[1], rgba[0]];\n for (let i = 0; i < 4; ++i) {\n const hex = Math.floor(/** @type {number} */ (abgr[i])).toString(16);\n abgr[i] = hex.length == 1 ? '0' + hex : hex;\n }\n writeStringTextNode(node, abgr.join(''));\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the coordinates to.\n * @param {Array<number>} coordinates Coordinates.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeCoordinatesTextNode(node, coordinates, objectStack) {\n const context = objectStack[objectStack.length - 1];\n\n const layout = context['layout'];\n const stride = context['stride'];\n\n let dimension;\n if (layout == 'XY' || layout == 'XYM') {\n dimension = 2;\n } else if (layout == 'XYZ' || layout == 'XYZM') {\n dimension = 3;\n } else {\n throw new Error('Invalid geometry layout');\n }\n\n const ii = coordinates.length;\n let text = '';\n if (ii > 0) {\n text += coordinates[0];\n for (let d = 1; d < dimension; ++d) {\n text += ',' + coordinates[d];\n }\n for (let i = stride; i < ii; i += stride) {\n text += ' ' + coordinates[i];\n for (let d = 1; d < dimension; ++d) {\n text += ',' + coordinates[i + d];\n }\n }\n }\n writeStringTextNode(node, text);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst EXTENDEDDATA_NODE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'Data': makeChildAppender(writeDataNode),\n 'value': makeChildAppender(writeDataNodeValue),\n 'displayName': makeChildAppender(writeDataNodeName),\n});\n\n/**\n * @param {Element} node Node.\n * @param {{name: *, value: *}} pair Name value pair.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeDataNode(node, pair, objectStack) {\n node.setAttribute('name', pair.name);\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const value = pair.value;\n\n if (typeof value == 'object') {\n if (value !== null && value.displayName) {\n pushSerializeAndPop(\n context,\n EXTENDEDDATA_NODE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n [value.displayName],\n objectStack,\n ['displayName'],\n );\n }\n\n if (value !== null && value.value) {\n pushSerializeAndPop(\n context,\n EXTENDEDDATA_NODE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n [value.value],\n objectStack,\n ['value'],\n );\n }\n } else {\n pushSerializeAndPop(\n context,\n EXTENDEDDATA_NODE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n [value],\n objectStack,\n ['value'],\n );\n }\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the name to.\n * @param {string} name DisplayName.\n */\nfunction writeDataNodeName(node, name) {\n writeStringTextNode(node, name);\n}\n\n/**\n * @param {Node} node Node to append a CDATA Section with the value to.\n * @param {string} value Value.\n */\nfunction writeDataNodeValue(node, value) {\n writeStringTextNode(node, value);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst DOCUMENT_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'Placemark': makeChildAppender(writePlacemark),\n});\n\n/**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n */\nconst DOCUMENT_NODE_FACTORY = function (value, objectStack, nodeName) {\n const parentNode = objectStack[objectStack.length - 1].node;\n return createElementNS(parentNode.namespaceURI, 'Placemark');\n};\n\n/**\n * @param {Element} node Node.\n * @param {Array<Feature>} features Features.\n * @param {Array<*>} objectStack Object stack.\n * @this {KML}\n */\nfunction writeDocument(node, features, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n pushSerializeAndPop(\n context,\n DOCUMENT_SERIALIZERS,\n DOCUMENT_NODE_FACTORY,\n features,\n objectStack,\n undefined,\n this,\n );\n}\n\n/**\n * A factory for creating Data nodes.\n * @const\n * @type {function(*, Array<*>): (Node|undefined)}\n */\nconst DATA_NODE_FACTORY = makeSimpleNodeFactory('Data');\n\n/**\n * @param {Element} node Node.\n * @param {{names: Array<string>, values: (Array<*>)}} namesAndValues Names and values.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeExtendedData(node, namesAndValues, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const names = namesAndValues.names;\n const values = namesAndValues.values;\n const length = names.length;\n\n for (let i = 0; i < length; i++) {\n pushSerializeAndPop(\n context,\n EXTENDEDDATA_NODE_SERIALIZERS,\n DATA_NODE_FACTORY,\n [{name: names[i], value: values[i]}],\n objectStack,\n );\n }\n}\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst ICON_SEQUENCE = makeStructureNS(\n NAMESPACE_URIS,\n ['href'],\n makeStructureNS(GX_NAMESPACE_URIS, ['x', 'y', 'w', 'h']),\n);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst ICON_SERIALIZERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'href': makeChildAppender(writeStringTextNode),\n },\n makeStructureNS(GX_NAMESPACE_URIS, {\n 'x': makeChildAppender(writeDecimalTextNode),\n 'y': makeChildAppender(writeDecimalTextNode),\n 'w': makeChildAppender(writeDecimalTextNode),\n 'h': makeChildAppender(writeDecimalTextNode),\n }),\n);\n\n/**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n */\nconst GX_NODE_FACTORY = function (value, objectStack, nodeName) {\n return createElementNS(GX_NAMESPACE_URIS[0], 'gx:' + nodeName);\n};\n\n/**\n * @param {Element} node Node.\n * @param {Object} icon Icon object.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeIcon(node, icon, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const parentNode = objectStack[objectStack.length - 1].node;\n let orderedKeys = ICON_SEQUENCE[parentNode.namespaceURI];\n let values = makeSequence(icon, orderedKeys);\n pushSerializeAndPop(\n context,\n ICON_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n orderedKeys = ICON_SEQUENCE[GX_NAMESPACE_URIS[0]];\n values = makeSequence(icon, orderedKeys);\n pushSerializeAndPop(\n context,\n ICON_SERIALIZERS,\n GX_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst ICON_STYLE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'scale',\n 'heading',\n 'Icon',\n 'color',\n 'hotSpot',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst ICON_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'Icon': makeChildAppender(writeIcon),\n 'color': makeChildAppender(writeColorTextNode),\n 'heading': makeChildAppender(writeDecimalTextNode),\n 'hotSpot': makeChildAppender(writeVec2),\n 'scale': makeChildAppender(writeScaleTextNode),\n});\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../style/Icon.js\").default} style Icon style.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeIconStyle(node, style, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const /** @type {Object<string, any>} */ properties = {};\n const src = style.getSrc();\n const size = style.getSize();\n const iconImageSize = style.getImageSize();\n const iconProperties = {\n 'href': src,\n };\n\n if (size) {\n iconProperties['w'] = size[0];\n iconProperties['h'] = size[1];\n const anchor = style.getAnchor(); // top-left\n const origin = style.getOrigin(); // top-left\n\n if (origin && iconImageSize && origin[0] !== 0 && origin[1] !== size[1]) {\n iconProperties['x'] = origin[0];\n iconProperties['y'] = iconImageSize[1] - (origin[1] + size[1]);\n }\n\n if (anchor && (anchor[0] !== size[0] / 2 || anchor[1] !== size[1] / 2)) {\n const /** @type {Vec2} */ hotSpot = {\n x: anchor[0],\n xunits: 'pixels',\n y: size[1] - anchor[1],\n yunits: 'pixels',\n };\n properties['hotSpot'] = hotSpot;\n }\n }\n\n properties['Icon'] = iconProperties;\n\n let scale = style.getScaleArray()[0];\n let imageSize = size;\n if (imageSize === null) {\n imageSize = DEFAULT_IMAGE_STYLE_SIZE;\n }\n if (imageSize.length == 2) {\n const resizeScale = scaleForSize(imageSize);\n scale = scale / resizeScale;\n }\n if (scale !== 1) {\n properties['scale'] = scale;\n }\n\n const rotation = style.getRotation();\n if (rotation !== 0) {\n properties['heading'] = rotation; // 0-360\n }\n\n const color = style.getColor();\n if (color) {\n properties['color'] = color;\n }\n\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = ICON_STYLE_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n ICON_STYLE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst LABEL_STYLE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'color',\n 'scale',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst LABEL_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'color': makeChildAppender(writeColorTextNode),\n 'scale': makeChildAppender(writeScaleTextNode),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Text} style style.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeLabelStyle(node, style, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const properties = {};\n const fill = style.getFill();\n if (fill) {\n properties['color'] = fill.getColor();\n }\n const scale = style.getScale();\n if (scale && scale !== 1) {\n properties['scale'] = scale;\n }\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = LABEL_STYLE_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n LABEL_STYLE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst LINE_STYLE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, ['color', 'width']);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst LINE_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'color': makeChildAppender(writeColorTextNode),\n 'width': makeChildAppender(writeDecimalTextNode),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Stroke} style style.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeLineStyle(node, style, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const properties = {\n 'color': style.getColor(),\n 'width': Number(style.getWidth()) || 1,\n };\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = LINE_STYLE_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n LINE_STYLE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @const\n * @type {Object<string, string>}\n */\nconst GEOMETRY_TYPE_TO_NODENAME = {\n 'Point': 'Point',\n 'LineString': 'LineString',\n 'LinearRing': 'LinearRing',\n 'Polygon': 'Polygon',\n 'MultiPoint': 'MultiGeometry',\n 'MultiLineString': 'MultiGeometry',\n 'MultiPolygon': 'MultiGeometry',\n 'GeometryCollection': 'MultiGeometry',\n};\n\n/**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n */\nconst GEOMETRY_NODE_FACTORY = function (value, objectStack, nodeName) {\n if (value) {\n const parentNode = objectStack[objectStack.length - 1].node;\n return createElementNS(\n parentNode.namespaceURI,\n GEOMETRY_TYPE_TO_NODENAME[\n /** @type {import(\"../geom/Geometry.js\").default} */ (value).getType()\n ],\n );\n }\n};\n\n/**\n * A factory for creating Point nodes.\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst POINT_NODE_FACTORY = makeSimpleNodeFactory('Point');\n\n/**\n * A factory for creating LineString nodes.\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst LINE_STRING_NODE_FACTORY = makeSimpleNodeFactory('LineString');\n\n/**\n * A factory for creating LinearRing nodes.\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst LINEAR_RING_NODE_FACTORY = makeSimpleNodeFactory('LinearRing');\n\n/**\n * A factory for creating Polygon nodes.\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst POLYGON_NODE_FACTORY = makeSimpleNodeFactory('Polygon');\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst MULTI_GEOMETRY_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'LineString': makeChildAppender(writePrimitiveGeometry),\n 'Point': makeChildAppender(writePrimitiveGeometry),\n 'Polygon': makeChildAppender(writePolygon),\n 'GeometryCollection': makeChildAppender(writeMultiGeometry),\n});\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeMultiGeometry(node, geometry, objectStack) {\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const context = {node: node};\n const type = geometry.getType();\n /** @type {Array<import(\"../geom/Geometry.js\").default>} */\n let geometries = [];\n /** @type {function(*, Array<*>, string=): (Node|undefined)} */\n let factory;\n if (type === 'GeometryCollection') {\n /** @type {GeometryCollection} */ (geometry)\n .getGeometriesArrayRecursive()\n .forEach(function (geometry) {\n const type = geometry.getType();\n if (type === 'MultiPoint') {\n geometries = geometries.concat(\n /** @type {MultiPoint} */ (geometry).getPoints(),\n );\n } else if (type === 'MultiLineString') {\n geometries = geometries.concat(\n /** @type {MultiLineString} */ (geometry).getLineStrings(),\n );\n } else if (type === 'MultiPolygon') {\n geometries = geometries.concat(\n /** @type {MultiPolygon} */ (geometry).getPolygons(),\n );\n } else if (\n type === 'Point' ||\n type === 'LineString' ||\n type === 'Polygon'\n ) {\n geometries.push(geometry);\n } else {\n throw new Error('Unknown geometry type');\n }\n });\n factory = GEOMETRY_NODE_FACTORY;\n } else if (type === 'MultiPoint') {\n geometries = /** @type {MultiPoint} */ (geometry).getPoints();\n factory = POINT_NODE_FACTORY;\n } else if (type === 'MultiLineString') {\n geometries = /** @type {MultiLineString} */ (geometry).getLineStrings();\n factory = LINE_STRING_NODE_FACTORY;\n } else if (type === 'MultiPolygon') {\n geometries = /** @type {MultiPolygon} */ (geometry).getPolygons();\n factory = POLYGON_NODE_FACTORY;\n } else {\n throw new Error('Unknown geometry type');\n }\n pushSerializeAndPop(\n context,\n MULTI_GEOMETRY_SERIALIZERS,\n factory,\n geometries,\n objectStack,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst BOUNDARY_IS_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'LinearRing': makeChildAppender(writePrimitiveGeometry),\n});\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../geom/LinearRing.js\").default} linearRing Linear ring.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeBoundaryIs(node, linearRing, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n pushSerializeAndPop(\n context,\n BOUNDARY_IS_SERIALIZERS,\n LINEAR_RING_NODE_FACTORY,\n [linearRing],\n objectStack,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst PLACEMARK_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'ExtendedData': makeChildAppender(writeExtendedData),\n 'MultiGeometry': makeChildAppender(writeMultiGeometry),\n 'LineString': makeChildAppender(writePrimitiveGeometry),\n 'LinearRing': makeChildAppender(writePrimitiveGeometry),\n 'Point': makeChildAppender(writePrimitiveGeometry),\n 'Polygon': makeChildAppender(writePolygon),\n 'Style': makeChildAppender(writeStyle),\n 'address': makeChildAppender(writeStringTextNode),\n 'description': makeChildAppender(writeStringTextNode),\n 'name': makeChildAppender(writeStringTextNode),\n 'open': makeChildAppender(writeBooleanTextNode),\n 'phoneNumber': makeChildAppender(writeStringTextNode),\n 'styleUrl': makeChildAppender(writeStringTextNode),\n 'visibility': makeChildAppender(writeBooleanTextNode),\n});\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst PLACEMARK_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'name',\n 'open',\n 'visibility',\n 'address',\n 'phoneNumber',\n 'description',\n 'styleUrl',\n 'Style',\n]);\n\n/**\n * A factory for creating ExtendedData nodes.\n * @const\n * @type {function(*, Array<*>): (Node|undefined)}\n */\nconst EXTENDEDDATA_NODE_FACTORY = makeSimpleNodeFactory('ExtendedData');\n\n/**\n * FIXME currently we do serialize arbitrary/custom feature properties\n * (ExtendedData).\n * @param {Element} node Node.\n * @param {Feature} feature Feature.\n * @param {Array<*>} objectStack Object stack.\n * @this {KML}\n */\nfunction writePlacemark(node, feature, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n\n // set id\n if (feature.getId()) {\n node.setAttribute('id', /** @type {string} */ (feature.getId()));\n }\n\n // serialize properties (properties unknown to KML are not serialized)\n const properties = feature.getProperties();\n\n // don't export these to ExtendedData\n const filter = {\n 'address': 1,\n 'description': 1,\n 'name': 1,\n 'open': 1,\n 'phoneNumber': 1,\n 'styleUrl': 1,\n 'visibility': 1,\n };\n filter[feature.getGeometryName()] = 1;\n const keys = Object.keys(properties || {})\n .sort()\n .filter(function (v) {\n return !filter[v];\n });\n\n const styleFunction = feature.getStyleFunction();\n if (styleFunction) {\n // FIXME the styles returned by the style function are supposed to be\n // resolution-independent here\n const styles = styleFunction(feature, 0);\n if (styles) {\n const styleArray = Array.isArray(styles) ? styles : [styles];\n let pointStyles = styleArray;\n if (feature.getGeometry()) {\n pointStyles = styleArray.filter(function (style) {\n const geometry = style.getGeometryFunction()(feature);\n if (geometry) {\n const type = geometry.getType();\n if (type === 'GeometryCollection') {\n return /** @type {GeometryCollection} */ (geometry)\n .getGeometriesArrayRecursive()\n .filter(function (geometry) {\n const type = geometry.getType();\n return type === 'Point' || type === 'MultiPoint';\n }).length;\n }\n return type === 'Point' || type === 'MultiPoint';\n }\n });\n ('Point');\n }\n if (this.writeStyles_) {\n let lineStyles = styleArray;\n let polyStyles = styleArray;\n if (feature.getGeometry()) {\n lineStyles = styleArray.filter(function (style) {\n const geometry = style.getGeometryFunction()(feature);\n if (geometry) {\n const type = geometry.getType();\n if (type === 'GeometryCollection') {\n return /** @type {GeometryCollection} */ (geometry)\n .getGeometriesArrayRecursive()\n .filter(function (geometry) {\n const type = geometry.getType();\n return type === 'LineString' || type === 'MultiLineString';\n }).length;\n }\n return type === 'LineString' || type === 'MultiLineString';\n }\n });\n polyStyles = styleArray.filter(function (style) {\n const geometry = style.getGeometryFunction()(feature);\n if (geometry) {\n const type = geometry.getType();\n if (type === 'GeometryCollection') {\n return /** @type {GeometryCollection} */ (geometry)\n .getGeometriesArrayRecursive()\n .filter(function (geometry) {\n const type = geometry.getType();\n return type === 'Polygon' || type === 'MultiPolygon';\n }).length;\n }\n return type === 'Polygon' || type === 'MultiPolygon';\n }\n });\n }\n properties['Style'] = {\n pointStyles: pointStyles,\n lineStyles: lineStyles,\n polyStyles: polyStyles,\n };\n }\n if (pointStyles.length && properties['name'] === undefined) {\n const textStyle = pointStyles[0].getText();\n if (textStyle) {\n properties['name'] = textStyle.getText();\n }\n }\n }\n }\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = PLACEMARK_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n PLACEMARK_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n\n if (keys.length > 0) {\n const sequence = makeSequence(properties, keys);\n const namesAndValues = {names: keys, values: sequence};\n pushSerializeAndPop(\n context,\n PLACEMARK_SERIALIZERS,\n EXTENDEDDATA_NODE_FACTORY,\n [namesAndValues],\n objectStack,\n );\n }\n\n // serialize geometry\n const options = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[0]\n );\n let geometry = feature.getGeometry();\n if (geometry) {\n geometry = transformGeometryWithOptions(geometry, true, options);\n }\n pushSerializeAndPop(\n context,\n PLACEMARK_SERIALIZERS,\n GEOMETRY_NODE_FACTORY,\n [geometry],\n objectStack,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst PRIMITIVE_GEOMETRY_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'extrude',\n 'tessellate',\n 'altitudeMode',\n 'coordinates',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst PRIMITIVE_GEOMETRY_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'extrude': makeChildAppender(writeBooleanTextNode),\n 'tessellate': makeChildAppender(writeBooleanTextNode),\n 'altitudeMode': makeChildAppender(writeStringTextNode),\n 'coordinates': makeChildAppender(writeCoordinatesTextNode),\n});\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writePrimitiveGeometry(node, geometry, objectStack) {\n const flatCoordinates = geometry.getFlatCoordinates();\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n context['layout'] = geometry.getLayout();\n context['stride'] = geometry.getStride();\n\n // serialize properties (properties unknown to KML are not serialized)\n const properties = geometry.getProperties();\n properties.coordinates = flatCoordinates;\n\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = PRIMITIVE_GEOMETRY_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n PRIMITIVE_GEOMETRY_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst POLY_STYLE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'color',\n 'fill',\n 'outline',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst POLYGON_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'outerBoundaryIs': makeChildAppender(writeBoundaryIs),\n 'innerBoundaryIs': makeChildAppender(writeBoundaryIs),\n});\n\n/**\n * A factory for creating innerBoundaryIs nodes.\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst INNER_BOUNDARY_NODE_FACTORY = makeSimpleNodeFactory('innerBoundaryIs');\n\n/**\n * A factory for creating outerBoundaryIs nodes.\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst OUTER_BOUNDARY_NODE_FACTORY = makeSimpleNodeFactory('outerBoundaryIs');\n\n/**\n * @param {Element} node Node.\n * @param {Polygon} polygon Polygon.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writePolygon(node, polygon, objectStack) {\n const linearRings = polygon.getLinearRings();\n const outerRing = linearRings.shift();\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n // inner rings\n pushSerializeAndPop(\n context,\n POLYGON_SERIALIZERS,\n INNER_BOUNDARY_NODE_FACTORY,\n linearRings,\n objectStack,\n );\n // outer ring\n pushSerializeAndPop(\n context,\n POLYGON_SERIALIZERS,\n OUTER_BOUNDARY_NODE_FACTORY,\n [outerRing],\n objectStack,\n );\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst POLY_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'color': makeChildAppender(writeColorTextNode),\n 'fill': makeChildAppender(writeBooleanTextNode),\n 'outline': makeChildAppender(writeBooleanTextNode),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Style} style Style.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writePolyStyle(node, style, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const fill = style.getFill();\n const stroke = style.getStroke();\n const properties = {\n 'color': fill ? fill.getColor() : undefined,\n 'fill': fill ? undefined : false,\n 'outline': stroke ? undefined : false,\n };\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = POLY_STYLE_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n POLY_STYLE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @param {Node} node Node to append a TextNode with the scale to.\n * @param {number|undefined} scale Scale.\n */\nfunction writeScaleTextNode(node, scale) {\n // the Math is to remove any excess decimals created by float arithmetic\n writeDecimalTextNode(node, Math.round(scale * 1e6) / 1e6);\n}\n\n/**\n * @const\n * @type {Object<string, Array<string>>}\n */\n// @ts-ignore\nconst STYLE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'IconStyle',\n 'LabelStyle',\n 'LineStyle',\n 'PolyStyle',\n]);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\n// @ts-ignore\nconst STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'IconStyle': makeChildAppender(writeIconStyle),\n 'LabelStyle': makeChildAppender(writeLabelStyle),\n 'LineStyle': makeChildAppender(writeLineStyle),\n 'PolyStyle': makeChildAppender(writePolyStyle),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Object<string, Array<Style>>} styles Styles.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeStyle(node, styles, objectStack) {\n const /** @type {import(\"../xml.js\").NodeStackItem} */ context = {node: node};\n const properties = {};\n if (styles.pointStyles.length) {\n const textStyle = styles.pointStyles[0].getText();\n if (textStyle) {\n properties['LabelStyle'] = textStyle;\n }\n const imageStyle = styles.pointStyles[0].getImage();\n if (\n imageStyle &&\n typeof (/** @type {?} */ (imageStyle).getSrc) === 'function'\n ) {\n properties['IconStyle'] = imageStyle;\n }\n }\n if (styles.lineStyles.length) {\n const strokeStyle = styles.lineStyles[0].getStroke();\n if (strokeStyle) {\n properties['LineStyle'] = strokeStyle;\n }\n }\n if (styles.polyStyles.length) {\n const strokeStyle = styles.polyStyles[0].getStroke();\n if (strokeStyle && !properties['LineStyle']) {\n properties['LineStyle'] = strokeStyle;\n }\n properties['PolyStyle'] = styles.polyStyles[0];\n }\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = STYLE_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n STYLE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys,\n );\n}\n\n/**\n * @param {Element} node Node to append a TextNode with the Vec2 to.\n * @param {Vec2} vec2 Vec2.\n */\nfunction writeVec2(node, vec2) {\n node.setAttribute('x', String(vec2.x));\n node.setAttribute('y', String(vec2.y));\n node.setAttribute('xunits', vec2.xunits);\n node.setAttribute('yunits', vec2.yunits);\n}\n\nexport default KML;\n","\nconst SHIFT_LEFT_32 = (1 << 16) * (1 << 16);\nconst SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\n// Threshold chosen based on both benchmarking and knowledge about browser string\n// data structures (which currently switch structure types at 12 bytes or more)\nconst TEXT_DECODER_MIN_LENGTH = 12;\nconst utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8');\n\nconst PBF_VARINT = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nconst PBF_FIXED64 = 1; // 64-bit: double, fixed64, sfixed64\nconst PBF_BYTES = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nconst PBF_FIXED32 = 5; // 32-bit: float, fixed32, sfixed32\n\nexport default class Pbf {\n /**\n * @param {Uint8Array | ArrayBuffer} [buf]\n */\n constructor(buf = new Uint8Array(16)) {\n this.buf = ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf);\n this.dataView = new DataView(this.buf.buffer);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n }\n\n // === READING =================================================================\n\n /**\n * @template T\n * @param {(tag: number, result: T, pbf: Pbf) => void} readField\n * @param {T} result\n * @param {number} [end]\n */\n readFields(readField, result, end = this.length) {\n while (this.pos < end) {\n const val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n }\n\n /**\n * @template T\n * @param {(tag: number, result: T, pbf: Pbf) => void} readField\n * @param {T} result\n */\n readMessage(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n }\n\n readFixed32() {\n const val = this.dataView.getUint32(this.pos, true);\n this.pos += 4;\n return val;\n }\n\n readSFixed32() {\n const val = this.dataView.getInt32(this.pos, true);\n this.pos += 4;\n return val;\n }\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64() {\n const val = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n }\n\n readSFixed64() {\n const val = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n }\n\n readFloat() {\n const val = this.dataView.getFloat32(this.pos, true);\n this.pos += 4;\n return val;\n }\n\n readDouble() {\n const val = this.dataView.getFloat64(this.pos, true);\n this.pos += 8;\n return val;\n }\n\n /**\n * @param {boolean} [isSigned]\n */\n readVarint(isSigned) {\n const buf = this.buf;\n let val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n }\n\n readVarint64() { // for compatibility with v2.0.1\n return this.readVarint(true);\n }\n\n readSVarint() {\n const num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n }\n\n readBoolean() {\n return Boolean(this.readVarint());\n }\n\n readString() {\n const end = this.readVarint() + this.pos;\n const pos = this.pos;\n this.pos = end;\n\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n // longer strings are fast with the built-in browser TextDecoder API\n return utf8TextDecoder.decode(this.buf.subarray(pos, end));\n }\n // short strings are fast with our custom implementation\n return readUtf8(this.buf, pos, end);\n }\n\n readBytes() {\n const end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n }\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n /**\n * @param {number[]} [arr]\n * @param {boolean} [isSigned]\n */\n readPackedVarint(arr = [], isSigned) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n }\n /** @param {number[]} [arr] */\n readPackedSVarint(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n }\n /** @param {boolean[]} [arr] */\n readPackedBoolean(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n }\n /** @param {number[]} [arr] */\n readPackedFloat(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n }\n /** @param {number[]} [arr] */\n readPackedDouble(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n }\n /** @param {number[]} [arr] */\n readPackedFixed32(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n }\n /** @param {number[]} [arr] */\n readPackedSFixed32(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n }\n /** @param {number[]} [arr] */\n readPackedFixed64(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n }\n /** @param {number[]} [arr] */\n readPackedSFixed64(arr = []) {\n const end = this.readPackedEnd();\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n }\n readPackedEnd() {\n return this.type === PBF_BYTES ? this.readVarint() + this.pos : this.pos + 1;\n }\n\n /** @param {number} val */\n skip(val) {\n const type = val & 0x7;\n if (type === PBF_VARINT) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === PBF_BYTES) this.pos = this.readVarint() + this.pos;\n else if (type === PBF_FIXED32) this.pos += 4;\n else if (type === PBF_FIXED64) this.pos += 8;\n else throw new Error(`Unimplemented type: ${type}`);\n }\n\n // === WRITING =================================================================\n\n /**\n * @param {number} tag\n * @param {number} type\n */\n writeTag(tag, type) {\n this.writeVarint((tag << 3) | type);\n }\n\n /** @param {number} min */\n realloc(min) {\n let length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n const buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.dataView = new DataView(buf.buffer);\n this.length = length;\n }\n }\n\n finish() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n }\n\n /** @param {number} val */\n writeFixed32(val) {\n this.realloc(4);\n this.dataView.setInt32(this.pos, val, true);\n this.pos += 4;\n }\n\n /** @param {number} val */\n writeSFixed32(val) {\n this.realloc(4);\n this.dataView.setInt32(this.pos, val, true);\n this.pos += 4;\n }\n\n /** @param {number} val */\n writeFixed64(val) {\n this.realloc(8);\n this.dataView.setInt32(this.pos, val & -1, true);\n this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);\n this.pos += 8;\n }\n\n /** @param {number} val */\n writeSFixed64(val) {\n this.realloc(8);\n this.dataView.setInt32(this.pos, val & -1, true);\n this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);\n this.pos += 8;\n }\n\n /** @param {number} val */\n writeVarint(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n }\n\n /** @param {number} val */\n writeSVarint(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n }\n\n /** @param {boolean} val */\n writeBoolean(val) {\n this.writeVarint(+val);\n }\n\n /** @param {string} str */\n writeString(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n const startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n const len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n }\n\n /** @param {number} val */\n writeFloat(val) {\n this.realloc(4);\n this.dataView.setFloat32(this.pos, val, true);\n this.pos += 4;\n }\n\n /** @param {number} val */\n writeDouble(val) {\n this.realloc(8);\n this.dataView.setFloat64(this.pos, val, true);\n this.pos += 8;\n }\n\n /** @param {Uint8Array} buffer */\n writeBytes(buffer) {\n const len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (let i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n }\n\n /**\n * @template T\n * @param {(obj: T, pbf: Pbf) => void} fn\n * @param {T} obj\n */\n writeRawMessage(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n const startPos = this.pos;\n fn(obj, this);\n const len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n }\n\n /**\n * @template T\n * @param {number} tag\n * @param {(obj: T, pbf: Pbf) => void} fn\n * @param {T} obj\n */\n writeMessage(tag, fn, obj) {\n this.writeTag(tag, PBF_BYTES);\n this.writeRawMessage(fn, obj);\n }\n\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedVarint(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedVarint, arr);\n }\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedSVarint(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedSVarint, arr);\n }\n /**\n * @param {number} tag\n * @param {boolean[]} arr\n */\n writePackedBoolean(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedBoolean, arr);\n }\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedFloat(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedFloat, arr);\n }\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedDouble(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedDouble, arr);\n }\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedFixed32(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedFixed32, arr);\n }\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedSFixed32(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr);\n }\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedFixed64(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedFixed64, arr);\n }\n /**\n * @param {number} tag\n * @param {number[]} arr\n */\n writePackedSFixed64(tag, arr) {\n if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr);\n }\n\n /**\n * @param {number} tag\n * @param {Uint8Array} buffer\n */\n writeBytesField(tag, buffer) {\n this.writeTag(tag, PBF_BYTES);\n this.writeBytes(buffer);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeFixed32Field(tag, val) {\n this.writeTag(tag, PBF_FIXED32);\n this.writeFixed32(val);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeSFixed32Field(tag, val) {\n this.writeTag(tag, PBF_FIXED32);\n this.writeSFixed32(val);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeFixed64Field(tag, val) {\n this.writeTag(tag, PBF_FIXED64);\n this.writeFixed64(val);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeSFixed64Field(tag, val) {\n this.writeTag(tag, PBF_FIXED64);\n this.writeSFixed64(val);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeVarintField(tag, val) {\n this.writeTag(tag, PBF_VARINT);\n this.writeVarint(val);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeSVarintField(tag, val) {\n this.writeTag(tag, PBF_VARINT);\n this.writeSVarint(val);\n }\n /**\n * @param {number} tag\n * @param {string} str\n */\n writeStringField(tag, str) {\n this.writeTag(tag, PBF_BYTES);\n this.writeString(str);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeFloatField(tag, val) {\n this.writeTag(tag, PBF_FIXED32);\n this.writeFloat(val);\n }\n /**\n * @param {number} tag\n * @param {number} val\n */\n writeDoubleField(tag, val) {\n this.writeTag(tag, PBF_FIXED64);\n this.writeDouble(val);\n }\n /**\n * @param {number} tag\n * @param {boolean} val\n */\n writeBooleanField(tag, val) {\n this.writeVarintField(tag, +val);\n }\n};\n\n/**\n * @param {number} l\n * @param {boolean | undefined} s\n * @param {Pbf} p\n */\nfunction readVarintRemainder(l, s, p) {\n const buf = p.buf;\n let h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\n/**\n * @param {number} low\n * @param {number} high\n * @param {boolean} [isSigned]\n */\nfunction toNum(low, high, isSigned) {\n return isSigned ? high * 0x100000000 + (low >>> 0) : ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\n/**\n * @param {number} val\n * @param {Pbf} pbf\n */\nfunction writeBigVarint(val, pbf) {\n let low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\n/**\n * @param {number} high\n * @param {number} low\n * @param {Pbf} pbf\n */\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\n/**\n * @param {number} high\n * @param {Pbf} pbf\n */\nfunction writeBigVarintHigh(high, pbf) {\n const lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\n/**\n * @param {number} startPos\n * @param {number} len\n * @param {Pbf} pbf\n */\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n const extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (let i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedVarint(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]);\n}\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedSVarint(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]);\n}\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedFloat(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]);\n}\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedDouble(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]);\n}\n/**\n * @param {boolean[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedBoolean(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]);\n}\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedFixed32(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]);\n}\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedSFixed32(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]);\n}\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedFixed64(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]);\n}\n/**\n * @param {number[]} arr\n * @param {Pbf} pbf\n */\nfunction writePackedSFixed64(arr, pbf) {\n for (let i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]);\n}\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\n/**\n * @param {Uint8Array} buf\n * @param {number} pos\n * @param {number} end\n */\nfunction readUtf8(buf, pos, end) {\n let str = '';\n let i = pos;\n\n while (i < end) {\n const b0 = buf[i];\n let c = null; // codepoint\n let bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n let b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\n/**\n * @param {Uint8Array} buf\n * @param {string} str\n * @param {number} pos\n */\nfunction writeUtf8(buf, str, pos) {\n for (let i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n","/**\n * @module ol/format/MVT\n */\n//FIXME Implement projection handling\n\nimport PBF from 'pbf';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {inflateEnds} from '../geom/flat/orient.js';\nimport Projection from '../proj/Projection.js';\nimport {get} from '../proj.js';\nimport RenderFeature from '../render/Feature.js';\nimport FeatureFormat, {transformGeometryWithOptions} from './Feature.js';\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../render/Feature.js\").default]\n * @typedef {Object} Options\n * @property {import('./Feature.js').FeatureToFeatureClass<FeatureType>} [featureClass] Class for features returned by\n * {@link module:ol/format/MVT~MVT#readFeatures}. Set to {@link module:ol/Feature~Feature} to get full editing and geometry\n * support at the cost of decreased rendering performance. The default is\n * {@link module:ol/render/Feature~RenderFeature}, which is optimized for rendering and hit detection.\n * @property {string} [geometryName='geometry'] Geometry name to use when creating features.\n * @property {string} [layerName='layer'] Name of the feature attribute that holds the layer name.\n * @property {Array<string>} [layers] Layers to read features from. If not provided, features will be read from all\n * @property {string} [idProperty] Optional property that will be assigned as the feature id and removed from the properties.\n * layers.\n */\n\n/**\n * @classdesc\n * Feature format for reading data in the Mapbox MVT format.\n *\n * @template {import('../Feature.js').FeatureLike} [FeatureType=RenderFeature]\n * @extends {FeatureFormat<FeatureType>}\n * @api\n */\nclass MVT extends FeatureFormat {\n /**\n * @param {Options<FeatureType>} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {Projection}\n */\n this.dataProjection = new Projection({\n code: '',\n units: 'tile-pixels',\n });\n\n this.featureClass = options.featureClass\n ? options.featureClass\n : /** @type {import('./Feature.js').FeatureToFeatureClass<FeatureType>} */ (\n RenderFeature\n );\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * @private\n * @type {string}\n */\n this.layerName_ = options.layerName ? options.layerName : 'layer';\n\n /**\n * @private\n * @type {Array<string>|null}\n */\n this.layers_ = options.layers ? options.layers : null;\n\n /**\n * @private\n * @type {string}\n */\n this.idProperty_ = options.idProperty;\n\n this.supportedMediaTypes = [\n 'application/vnd.mapbox-vector-tile',\n 'application/x-protobuf',\n ];\n }\n\n /**\n * Read the raw geometry from the pbf offset stored in a raw feature's geometry\n * property.\n * @param {PBF} pbf PBF.\n * @param {Object} feature Raw feature.\n * @param {Array<number>} flatCoordinates Array to store flat coordinates in.\n * @param {Array<number>} ends Array to store ends in.\n * @private\n */\n readRawGeometry_(pbf, feature, flatCoordinates, ends) {\n pbf.pos = feature.geometry;\n\n const end = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let length = 0;\n let x = 0;\n let y = 0;\n let coordsLen = 0;\n let currentEnd = 0;\n\n while (pbf.pos < end) {\n if (!length) {\n const cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n\n if (cmd === 1) {\n // moveTo\n if (coordsLen > currentEnd) {\n ends.push(coordsLen);\n currentEnd = coordsLen;\n }\n }\n\n flatCoordinates.push(x, y);\n coordsLen += 2;\n } else if (cmd === 7) {\n if (coordsLen > currentEnd) {\n // close polygon\n flatCoordinates.push(\n flatCoordinates[currentEnd],\n flatCoordinates[currentEnd + 1],\n );\n coordsLen += 2;\n }\n } else {\n throw new Error('Invalid command found in the PBF');\n }\n }\n\n if (coordsLen > currentEnd) {\n ends.push(coordsLen);\n currentEnd = coordsLen;\n }\n }\n\n /**\n * @private\n * @param {PBF} pbf PBF\n * @param {Object} rawFeature Raw Mapbox feature.\n * @param {import(\"./Feature.js\").ReadOptions} options Read options.\n * @return {FeatureType|null} Feature.\n */\n createFeature_(pbf, rawFeature, options) {\n const type = rawFeature.type;\n if (type === 0) {\n return null;\n }\n\n let feature;\n const values = rawFeature.properties;\n\n let id;\n if (!this.idProperty_) {\n id = rawFeature.id;\n } else {\n id = values[this.idProperty_];\n delete values[this.idProperty_];\n }\n\n values[this.layerName_] = rawFeature.layer.name;\n\n const flatCoordinates = /** @type {Array<number>} */ ([]);\n const ends = /** @type {Array<number>} */ ([]);\n this.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);\n\n const geometryType = getGeometryType(type, ends.length);\n\n if (this.featureClass === RenderFeature) {\n feature =\n new /** @type {import('./Feature.js').FeatureToFeatureClass<RenderFeature>} */ (\n this.featureClass\n )(geometryType, flatCoordinates, ends, 2, values, id);\n feature.transform(options.dataProjection);\n } else {\n let geom;\n if (geometryType == 'Polygon') {\n const endss = inflateEnds(flatCoordinates, ends);\n geom =\n endss.length > 1\n ? new MultiPolygon(flatCoordinates, 'XY', endss)\n : new Polygon(flatCoordinates, 'XY', ends);\n } else {\n geom =\n geometryType === 'Point'\n ? new Point(flatCoordinates, 'XY')\n : geometryType === 'LineString'\n ? new LineString(flatCoordinates, 'XY')\n : geometryType === 'MultiPoint'\n ? new MultiPoint(flatCoordinates, 'XY')\n : geometryType === 'MultiLineString'\n ? new MultiLineString(flatCoordinates, 'XY', ends)\n : null;\n }\n const ctor = /** @type {typeof import(\"../Feature.js\").default} */ (\n this.featureClass\n );\n feature = new ctor();\n if (this.geometryName_) {\n feature.setGeometryName(this.geometryName_);\n }\n const geometry = transformGeometryWithOptions(geom, false, options);\n feature.setGeometry(geometry);\n if (id !== undefined) {\n feature.setId(id);\n }\n feature.setProperties(values, true);\n }\n\n return /** @type {FeatureType} */ (feature);\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n * @override\n */\n getType() {\n return 'arraybuffer';\n }\n\n /**\n * Read all features.\n *\n * @param {ArrayBuffer} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array<FeatureType>} Features.\n * @api\n * @override\n */\n readFeatures(source, options) {\n const layers = this.layers_;\n options = this.adaptOptions(options);\n const dataProjection = get(options.dataProjection);\n dataProjection.setWorldExtent(options.extent);\n options.dataProjection = dataProjection;\n\n const pbf = new PBF(/** @type {ArrayBuffer} */ (source));\n const pbfLayers = pbf.readFields(layersPBFReader, {});\n const features = [];\n for (const name in pbfLayers) {\n if (layers && !layers.includes(name)) {\n continue;\n }\n const pbfLayer = pbfLayers[name];\n\n const extent = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null;\n dataProjection.setExtent(extent);\n\n for (let i = 0, ii = pbfLayer.length; i < ii; ++i) {\n const rawFeature = readRawFeature(pbf, pbfLayer, i);\n const feature = this.createFeature_(pbf, rawFeature, options);\n if (feature !== null) {\n features.push(feature);\n }\n }\n }\n\n return /** @type {Array<FeatureType>} */ (features);\n }\n\n /**\n * Read the projection from the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @api\n * @override\n */\n readProjection(source) {\n return this.dataProjection;\n }\n\n /**\n * Sets the layers that features will be read from.\n * @param {Array<string>} layers Layers.\n * @api\n */\n setLayers(layers) {\n this.layers_ = layers;\n }\n}\n\n/**\n * Reader callback for parsing layers.\n * @param {number} tag The tag.\n * @param {Object} layers The layers object.\n * @param {PBF} pbf The PBF.\n */\nfunction layersPBFReader(tag, layers, pbf) {\n if (tag === 3) {\n const layer = {\n keys: [],\n values: [],\n features: [],\n };\n const end = pbf.readVarint() + pbf.pos;\n pbf.readFields(layerPBFReader, layer, end);\n layer.length = layer.features.length;\n if (layer.length) {\n layers[layer.name] = layer;\n }\n }\n}\n\n/**\n * Reader callback for parsing layer.\n * @param {number} tag The tag.\n * @param {Object} layer The layer object.\n * @param {PBF} pbf The PBF.\n */\nfunction layerPBFReader(tag, layer, pbf) {\n if (tag === 15) {\n layer.version = pbf.readVarint();\n } else if (tag === 1) {\n layer.name = pbf.readString();\n } else if (tag === 5) {\n layer.extent = pbf.readVarint();\n } else if (tag === 2) {\n layer.features.push(pbf.pos);\n } else if (tag === 3) {\n layer.keys.push(pbf.readString());\n } else if (tag === 4) {\n let value = null;\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n tag = pbf.readVarint() >> 3;\n value =\n tag === 1\n ? pbf.readString()\n : tag === 2\n ? pbf.readFloat()\n : tag === 3\n ? pbf.readDouble()\n : tag === 4\n ? pbf.readVarint64()\n : tag === 5\n ? pbf.readVarint()\n : tag === 6\n ? pbf.readSVarint()\n : tag === 7\n ? pbf.readBoolean()\n : null;\n }\n layer.values.push(value);\n }\n}\n\n/**\n * Reader callback for parsing feature.\n * @param {number} tag The tag.\n * @param {Object} feature The feature object.\n * @param {PBF} pbf The PBF.\n */\nfunction featurePBFReader(tag, feature, pbf) {\n if (tag == 1) {\n feature.id = pbf.readVarint();\n } else if (tag == 2) {\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n const key = feature.layer.keys[pbf.readVarint()];\n const value = feature.layer.values[pbf.readVarint()];\n feature.properties[key] = value;\n }\n } else if (tag == 3) {\n feature.type = pbf.readVarint();\n } else if (tag == 4) {\n feature.geometry = pbf.pos;\n }\n}\n\n/**\n * Read a raw feature from the pbf offset stored at index `i` in the raw layer.\n * @param {PBF} pbf PBF.\n * @param {Object} layer Raw layer.\n * @param {number} i Index of the feature in the raw layer's `features` array.\n * @return {Object} Raw feature.\n */\nfunction readRawFeature(pbf, layer, i) {\n pbf.pos = layer.features[i];\n const end = pbf.readVarint() + pbf.pos;\n\n const feature = {\n layer: layer,\n type: 0,\n properties: {},\n };\n pbf.readFields(featurePBFReader, feature, end);\n return feature;\n}\n\n/**\n * @param {number} type The raw feature's geometry type\n * @param {number} numEnds Number of ends of the flat coordinates of the\n * geometry.\n * @return {import(\"../render/Feature.js\").Type} The geometry type.\n */\nfunction getGeometryType(type, numEnds) {\n /** @type {import(\"../render/Feature.js\").Type} */\n let geometryType;\n if (type === 1) {\n geometryType = numEnds === 1 ? 'Point' : 'MultiPoint';\n } else if (type === 2) {\n geometryType = numEnds === 1 ? 'LineString' : 'MultiLineString';\n } else if (type === 3) {\n geometryType = 'Polygon';\n // MultiPolygon not relevant for rendering - winding order determines\n // outer rings of polygons.\n }\n return geometryType;\n}\n\nexport default MVT;\n","/**\n * @module ol/format/OSMXML\n */\n// FIXME add typedef for stack state objects\nimport Feature from '../Feature.js';\nimport {extend} from '../array.js';\nimport LineString from '../geom/LineString.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {isEmpty} from '../obj.js';\nimport {get as getProjection} from '../proj.js';\nimport {makeStructureNS, pushParseAndPop} from '../xml.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport XMLFeature from './XMLFeature.js';\n\n/**\n * @const\n * @type {Array<null>}\n */\nconst NAMESPACE_URIS = [null];\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst WAY_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'nd': readNd,\n 'tag': readTag,\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'node': readNode,\n 'way': readWay,\n});\n\n/**\n * @classdesc\n * Feature format for reading data in the\n * [OSMXML format](https://wiki.openstreetmap.org/wiki/OSM_XML).\n *\n * @api\n */\nclass OSMXML extends XMLFeature {\n constructor() {\n super();\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection('EPSG:4326');\n }\n\n /**\n * @protected\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @override\n */\n readFeaturesFromNode(node, options) {\n options = this.getReadOptions(node, options);\n if (node.localName == 'osm') {\n const state = pushParseAndPop(\n {\n nodes: {},\n ways: [],\n features: [],\n },\n PARSERS,\n node,\n [options],\n );\n // parse nodes in ways\n for (let j = 0; j < state.ways.length; j++) {\n const values = /** @type {Object} */ (state.ways[j]);\n /** @type {Array<number>} */\n const flatCoordinates = values.flatCoordinates;\n if (!flatCoordinates.length) {\n for (let i = 0, ii = values.ndrefs.length; i < ii; i++) {\n const point = state.nodes[values.ndrefs[i]];\n extend(flatCoordinates, point);\n }\n }\n let geometry;\n if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {\n // closed way\n geometry = new Polygon(flatCoordinates, 'XY', [\n flatCoordinates.length,\n ]);\n } else {\n geometry = new LineString(flatCoordinates, 'XY');\n }\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n if (values.id !== undefined) {\n feature.setId(values.id);\n }\n feature.setProperties(values.tags, true);\n state.features.push(feature);\n }\n if (state.features) {\n return state.features;\n }\n }\n return [];\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst NODE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'tag': readTag,\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction readNode(node, objectStack) {\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n const state = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const id = node.getAttribute('id');\n /** @type {import(\"../coordinate.js\").Coordinate} */\n const coordinates = [\n parseFloat(node.getAttribute('lon')),\n parseFloat(node.getAttribute('lat')),\n ];\n state.nodes[id] = coordinates;\n\n const values = pushParseAndPop(\n {\n tags: {},\n },\n NODE_PARSERS,\n node,\n objectStack,\n );\n if (!isEmpty(values.tags)) {\n const geometry = new Point(coordinates);\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n if (id !== undefined) {\n feature.setId(id);\n }\n feature.setProperties(values.tags, true);\n state.features.push(feature);\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction readWay(node, objectStack) {\n const id = node.getAttribute('id');\n const values = pushParseAndPop(\n {\n id: id,\n ndrefs: [],\n flatCoordinates: [],\n tags: {},\n },\n WAY_PARSERS,\n node,\n objectStack,\n );\n const state = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n state.ways.push(values);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction readNd(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n values.ndrefs.push(node.getAttribute('ref'));\n if (node.hasAttribute('lon') && node.hasAttribute('lat')) {\n values.flatCoordinates.push(parseFloat(node.getAttribute('lon')));\n values.flatCoordinates.push(parseFloat(node.getAttribute('lat')));\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction readTag(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n values.tags[node.getAttribute('k')] = node.getAttribute('v');\n}\n\nexport default OSMXML;\n","/**\n * @module ol/format/XML\n */\nimport {abstract} from '../util.js';\nimport {isDocument, parse} from '../xml.js';\n\n/**\n * @classdesc\n * Generic format for reading non-feature XML data\n *\n * @abstract\n */\nclass XML {\n /**\n * Read the source document.\n *\n * @param {Document|Element|string} source The XML source.\n * @return {Object|null} An object representing the source.\n * @api\n */\n read(source) {\n if (!source) {\n return null;\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readFromDocument(doc);\n }\n if (isDocument(source)) {\n return this.readFromDocument(/** @type {Document} */ (source));\n }\n return this.readFromNode(/** @type {Element} */ (source));\n }\n\n /**\n * @param {Document} doc Document.\n * @return {Object|null} Object\n */\n readFromDocument(doc) {\n for (let n = doc.firstChild; n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n return this.readFromNode(/** @type {Element} */ (n));\n }\n }\n return null;\n }\n\n /**\n * @abstract\n * @param {Element} node Node.\n * @return {Object|null} Object\n */\n readFromNode(node) {\n abstract();\n }\n}\n\nexport default XML;\n","/**\n * @module ol/format/xlink\n */\n\n/**\n * @const\n * @type {string}\n */\nconst NAMESPACE_URI = 'http://www.w3.org/1999/xlink';\n\n/**\n * @param {Element} node Node.\n * @return {string|null} href.\n */\nexport function readHref(node) {\n return node.getAttributeNS(NAMESPACE_URI, 'href');\n}\n","/**\n * @module ol/format/OWS\n */\nimport {\n makeObjectPropertyPusher,\n makeObjectPropertySetter,\n makeStructureNS,\n pushParseAndPop,\n} from '../xml.js';\nimport XML from './XML.js';\nimport {readHref} from './xlink.js';\nimport {readString} from './xsd.js';\n\n/**\n * @const\n * @type {Array<null|string>}\n */\nconst NAMESPACE_URIS = [null, 'http://www.opengis.net/ows/1.1'];\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ServiceIdentification': makeObjectPropertySetter(readServiceIdentification),\n 'ServiceProvider': makeObjectPropertySetter(readServiceProvider),\n 'OperationsMetadata': makeObjectPropertySetter(readOperationsMetadata),\n});\n\nclass OWS extends XML {\n constructor() {\n super();\n }\n\n /**\n * @param {Element} node Node.\n * @return {Object|null} Object\n * @override\n */\n readFromNode(node) {\n const owsObject = pushParseAndPop({}, PARSERS, node, []);\n return owsObject ? owsObject : null;\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst ADDRESS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'DeliveryPoint': makeObjectPropertySetter(readString),\n 'City': makeObjectPropertySetter(readString),\n 'AdministrativeArea': makeObjectPropertySetter(readString),\n 'PostalCode': makeObjectPropertySetter(readString),\n 'Country': makeObjectPropertySetter(readString),\n 'ElectronicMailAddress': makeObjectPropertySetter(readString),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst ALLOWED_VALUES_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Value': makeObjectPropertyPusher(readValue),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CONSTRAINT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'AllowedValues': makeObjectPropertySetter(readAllowedValues),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CONTACT_INFO_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Phone': makeObjectPropertySetter(readPhone),\n 'Address': makeObjectPropertySetter(readAddress),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst DCP_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'HTTP': makeObjectPropertySetter(readHttp),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst HTTP_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Get': makeObjectPropertyPusher(readGet),\n 'Post': undefined, // TODO\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst OPERATION_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'DCP': makeObjectPropertySetter(readDcp),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst OPERATIONS_METADATA_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Operation': readOperation,\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst PHONE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Voice': makeObjectPropertySetter(readString),\n 'Facsimile': makeObjectPropertySetter(readString),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst REQUEST_METHOD_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Constraint': makeObjectPropertyPusher(readConstraint),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst SERVICE_CONTACT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'IndividualName': makeObjectPropertySetter(readString),\n 'PositionName': makeObjectPropertySetter(readString),\n 'ContactInfo': makeObjectPropertySetter(readContactInfo),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst SERVICE_IDENTIFICATION_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Abstract': makeObjectPropertySetter(readString),\n 'AccessConstraints': makeObjectPropertySetter(readString),\n 'Fees': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'ServiceTypeVersion': makeObjectPropertySetter(readString),\n 'ServiceType': makeObjectPropertySetter(readString),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst SERVICE_PROVIDER_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ProviderName': makeObjectPropertySetter(readString),\n 'ProviderSite': makeObjectPropertySetter(readHref),\n 'ServiceContact': makeObjectPropertySetter(readServiceContact),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The address.\n */\nfunction readAddress(node, objectStack) {\n return pushParseAndPop({}, ADDRESS_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The values.\n */\nfunction readAllowedValues(node, objectStack) {\n return pushParseAndPop({}, ALLOWED_VALUES_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The constraint.\n */\nfunction readConstraint(node, objectStack) {\n const name = node.getAttribute('name');\n if (!name) {\n return undefined;\n }\n return pushParseAndPop({'name': name}, CONSTRAINT_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The contact info.\n */\nfunction readContactInfo(node, objectStack) {\n return pushParseAndPop({}, CONTACT_INFO_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The DCP.\n */\nfunction readDcp(node, objectStack) {\n return pushParseAndPop({}, DCP_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The GET object.\n */\nfunction readGet(node, objectStack) {\n const href = readHref(node);\n if (!href) {\n return undefined;\n }\n return pushParseAndPop(\n {'href': href},\n REQUEST_METHOD_PARSERS,\n node,\n objectStack,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The HTTP object.\n */\nfunction readHttp(node, objectStack) {\n return pushParseAndPop({}, HTTP_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The operation.\n */\nfunction readOperation(node, objectStack) {\n const name = node.getAttribute('name');\n const value = pushParseAndPop({}, OPERATION_PARSERS, node, objectStack);\n if (!value) {\n return undefined;\n }\n const object = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n object[name] = value;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The operations metadata.\n */\nfunction readOperationsMetadata(node, objectStack) {\n return pushParseAndPop({}, OPERATIONS_METADATA_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The phone.\n */\nfunction readPhone(node, objectStack) {\n return pushParseAndPop({}, PHONE_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The service identification.\n */\nfunction readServiceIdentification(node, objectStack) {\n return pushParseAndPop({}, SERVICE_IDENTIFICATION_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The service contact.\n */\nfunction readServiceContact(node, objectStack) {\n return pushParseAndPop({}, SERVICE_CONTACT_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} The service provider.\n */\nfunction readServiceProvider(node, objectStack) {\n return pushParseAndPop({}, SERVICE_PROVIDER_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {string|undefined} The value.\n */\nfunction readValue(node, objectStack) {\n return readString(node);\n}\n\nexport default OWS;\n","/**\n * @module ol/format/Polyline\n */\nimport Feature from '../Feature.js';\nimport LineString from '../geom/LineString.js';\nimport {getStrideForLayout} from '../geom/SimpleGeometry.js';\nimport {flipXY} from '../geom/flat/flip.js';\nimport {inflateCoordinates} from '../geom/flat/inflate.js';\nimport {get as getProjection} from '../proj.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport TextFeature from './TextFeature.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [factor=1e5] The factor by which the coordinates values will be scaled.\n * @property {import(\"../geom/Geometry.js\").GeometryLayout} [geometryLayout='XY'] Layout of the\n * feature geometries created by the format reader.\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the Encoded\n * Polyline Algorithm Format.\n *\n * When reading features, the coordinates are assumed to be in two dimensions\n * and in [latitude, longitude] order.\n *\n * As Polyline sources contain a single feature,\n * {@link module:ol/format/Polyline~Polyline#readFeatures} will return the\n * feature in an array.\n *\n * @api\n */\nclass Polyline extends TextFeature {\n /**\n * @param {Options} [options] Optional configuration object.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection('EPSG:4326');\n\n /**\n * @private\n * @type {number}\n */\n this.factor_ = options.factor ? options.factor : 1e5;\n\n /**\n * @private\n * @type {import(\"../geom/Geometry.js\").GeometryLayout}\n */\n this.geometryLayout_ = options.geometryLayout\n ? options.geometryLayout\n : 'XY';\n }\n\n /**\n * @protected\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @override\n */\n readFeatureFromText(text, options) {\n const geometry = this.readGeometryFromText(text, options);\n return new Feature(geometry);\n }\n\n /**\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<Feature>} Features.\n * @override\n */\n readFeaturesFromText(text, options) {\n const feature = this.readFeatureFromText(text, options);\n return [feature];\n }\n\n /**\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @override\n */\n readGeometryFromText(text, options) {\n const stride = getStrideForLayout(this.geometryLayout_);\n const flatCoordinates = decodeDeltas(text, stride, this.factor_);\n flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);\n const coordinates = inflateCoordinates(\n flatCoordinates,\n 0,\n flatCoordinates.length,\n stride,\n );\n const lineString = new LineString(coordinates, this.geometryLayout_);\n\n return transformGeometryWithOptions(\n lineString,\n false,\n this.adaptOptions(options),\n );\n }\n\n /**\n * @param {import(\"../Feature.js\").default<LineString>} feature Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n * @override\n */\n writeFeatureText(feature, options) {\n const geometry = feature.getGeometry();\n if (geometry) {\n return this.writeGeometryText(geometry, options);\n }\n throw new Error('Expected `feature` to have a geometry');\n }\n\n /**\n * @param {Array<import(\"../Feature.js\").default<LineString>>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n * @override\n */\n writeFeaturesText(features, options) {\n return this.writeFeatureText(features[0], options);\n }\n\n /**\n * @param {LineString} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n * @override\n */\n writeGeometryText(geometry, options) {\n geometry =\n /** @type {LineString} */\n (\n transformGeometryWithOptions(geometry, true, this.adaptOptions(options))\n );\n const flatCoordinates = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);\n return encodeDeltas(flatCoordinates, stride, this.factor_);\n }\n}\n\n/**\n * Encode a list of n-dimensional points and return an encoded string\n *\n * Attention: This function will modify the passed array!\n *\n * @param {Array<number>} numbers A list of n-dimensional points.\n * @param {number} stride The number of dimension of the points in the list.\n * @param {number} [factor] The factor by which the numbers will be\n * multiplied. The remaining decimal places will get rounded away.\n * Default is `1e5`.\n * @return {string} The encoded string.\n * @api\n */\nexport function encodeDeltas(numbers, stride, factor) {\n factor = factor ? factor : 1e5;\n let d;\n\n const lastNumbers = new Array(stride);\n for (d = 0; d < stride; ++d) {\n lastNumbers[d] = 0;\n }\n\n for (let i = 0, ii = numbers.length; i < ii; ) {\n for (d = 0; d < stride; ++d, ++i) {\n const num = numbers[i];\n const delta = num - lastNumbers[d];\n lastNumbers[d] = num;\n\n numbers[i] = delta;\n }\n }\n\n return encodeFloats(numbers, factor);\n}\n\n/**\n * Decode a list of n-dimensional points from an encoded string\n *\n * @param {string} encoded An encoded string.\n * @param {number} stride The number of dimension of the points in the\n * encoded string.\n * @param {number} [factor] The factor by which the resulting numbers will\n * be divided. Default is `1e5`.\n * @return {Array<number>} A list of n-dimensional points.\n * @api\n */\nexport function decodeDeltas(encoded, stride, factor) {\n factor = factor ? factor : 1e5;\n let d;\n\n /** @type {Array<number>} */\n const lastNumbers = new Array(stride);\n for (d = 0; d < stride; ++d) {\n lastNumbers[d] = 0;\n }\n\n const numbers = decodeFloats(encoded, factor);\n\n for (let i = 0, ii = numbers.length; i < ii; ) {\n for (d = 0; d < stride; ++d, ++i) {\n lastNumbers[d] += numbers[i];\n\n numbers[i] = lastNumbers[d];\n }\n }\n\n return numbers;\n}\n\n/**\n * Encode a list of floating point numbers and return an encoded string\n *\n * Attention: This function will modify the passed array!\n *\n * @param {Array<number>} numbers A list of floating point numbers.\n * @param {number} [factor] The factor by which the numbers will be\n * multiplied. The remaining decimal places will get rounded away.\n * Default is `1e5`.\n * @return {string} The encoded string.\n * @api\n */\nexport function encodeFloats(numbers, factor) {\n factor = factor ? factor : 1e5;\n for (let i = 0, ii = numbers.length; i < ii; ++i) {\n numbers[i] = Math.round(numbers[i] * factor);\n }\n\n return encodeSignedIntegers(numbers);\n}\n\n/**\n * Decode a list of floating point numbers from an encoded string\n *\n * @param {string} encoded An encoded string.\n * @param {number} [factor] The factor by which the result will be divided.\n * Default is `1e5`.\n * @return {Array<number>} A list of floating point numbers.\n * @api\n */\nexport function decodeFloats(encoded, factor) {\n factor = factor ? factor : 1e5;\n const numbers = decodeSignedIntegers(encoded);\n for (let i = 0, ii = numbers.length; i < ii; ++i) {\n numbers[i] /= factor;\n }\n return numbers;\n}\n\n/**\n * Encode a list of signed integers and return an encoded string\n *\n * Attention: This function will modify the passed array!\n *\n * @param {Array<number>} numbers A list of signed integers.\n * @return {string} The encoded string.\n */\nexport function encodeSignedIntegers(numbers) {\n for (let i = 0, ii = numbers.length; i < ii; ++i) {\n const num = numbers[i];\n numbers[i] = num < 0 ? ~(num << 1) : num << 1;\n }\n return encodeUnsignedIntegers(numbers);\n}\n\n/**\n * Decode a list of signed integers from an encoded string\n *\n * @param {string} encoded An encoded string.\n * @return {Array<number>} A list of signed integers.\n */\nexport function decodeSignedIntegers(encoded) {\n const numbers = decodeUnsignedIntegers(encoded);\n for (let i = 0, ii = numbers.length; i < ii; ++i) {\n const num = numbers[i];\n numbers[i] = num & 1 ? ~(num >> 1) : num >> 1;\n }\n return numbers;\n}\n\n/**\n * Encode a list of unsigned integers and return an encoded string\n *\n * @param {Array<number>} numbers A list of unsigned integers.\n * @return {string} The encoded string.\n */\nexport function encodeUnsignedIntegers(numbers) {\n let encoded = '';\n for (let i = 0, ii = numbers.length; i < ii; ++i) {\n encoded += encodeUnsignedInteger(numbers[i]);\n }\n return encoded;\n}\n\n/**\n * Decode a list of unsigned integers from an encoded string\n *\n * @param {string} encoded An encoded string.\n * @return {Array<number>} A list of unsigned integers.\n */\nexport function decodeUnsignedIntegers(encoded) {\n const numbers = [];\n let current = 0;\n let shift = 0;\n for (let i = 0, ii = encoded.length; i < ii; ++i) {\n const b = encoded.charCodeAt(i) - 63;\n current |= (b & 0x1f) << shift;\n if (b < 0x20) {\n numbers.push(current);\n current = 0;\n shift = 0;\n } else {\n shift += 5;\n }\n }\n return numbers;\n}\n\n/**\n * Encode one single unsigned integer and return an encoded string\n *\n * @param {number} num Unsigned integer that should be encoded.\n * @return {string} The encoded string.\n */\nexport function encodeUnsignedInteger(num) {\n let value,\n encoded = '';\n while (num >= 0x20) {\n value = (0x20 | (num & 0x1f)) + 63;\n encoded += String.fromCharCode(value);\n num >>= 5;\n }\n value = num + 63;\n encoded += String.fromCharCode(value);\n return encoded;\n}\n\nexport default Polyline;\n","/**\n * @module ol/format/TopoJSON\n */\nimport Feature from '../Feature.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {get as getProjection} from '../proj.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport JSONFeature from './JSONFeature.js';\n\n/**\n * @typedef {import(\"topojson-specification\").Topology} TopoJSONTopology\n * @typedef {import(\"topojson-specification\").GeometryCollection} TopoJSONGeometryCollection\n * @typedef {import(\"topojson-specification\").GeometryObject} TopoJSONGeometry\n * @typedef {import(\"topojson-specification\").Point} TopoJSONPoint\n * @typedef {import(\"topojson-specification\").MultiPoint} TopoJSONMultiPoint\n * @typedef {import(\"topojson-specification\").LineString} TopoJSONLineString\n * @typedef {import(\"topojson-specification\").MultiLineString} TopoJSONMultiLineString\n * @typedef {import(\"topojson-specification\").Polygon} TopoJSONPolygon\n * @typedef {import(\"topojson-specification\").MultiPolygon} TopoJSONMultiPolygon\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection='EPSG:4326'] Default data projection.\n * @property {string} [layerName] Set the name of the TopoJSON topology\n * `objects`'s children as feature property with the specified name. This means\n * that when set to `'layer'`, a topology like\n * ```\n * {\n * \"type\": \"Topology\",\n * \"objects\": {\n * \"example\": {\n * \"type\": \"GeometryCollection\",\n * \"geometries\": []\n * }\n * }\n * }\n * ```\n * will result in features that have a property `'layer'` set to `'example'`.\n * When not set, no property will be added to features.\n * @property {Array<string>} [layers] Names of the TopoJSON topology's\n * `objects`'s children to read features from. If not provided, features will\n * be read from all children.\n */\n\n/**\n * @classdesc\n * Feature format for reading data in the TopoJSON format.\n *\n * @api\n */\nclass TopoJSON extends JSONFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.layerName_ = options.layerName;\n\n /**\n * @private\n * @type {?Array<string>}\n */\n this.layers_ = options.layers ? options.layers : null;\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection(\n options.dataProjection ? options.dataProjection : 'EPSG:4326',\n );\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<Feature>} Features.\n * @override\n */\n readFeaturesFromObject(object, options) {\n if (object.type == 'Topology') {\n const topoJSONTopology = /** @type {TopoJSONTopology} */ (object);\n let transform,\n scale = null,\n translate = null;\n if (topoJSONTopology['transform']) {\n transform = topoJSONTopology['transform'];\n scale = transform['scale'];\n translate = transform['translate'];\n }\n const arcs = topoJSONTopology['arcs'];\n if (transform) {\n transformArcs(arcs, scale, translate);\n }\n /** @type {Array<Feature>} */\n const features = [];\n const topoJSONFeatures = topoJSONTopology['objects'];\n const property = this.layerName_;\n let feature;\n for (const objectName in topoJSONFeatures) {\n if (this.layers_ && !this.layers_.includes(objectName)) {\n continue;\n }\n if (topoJSONFeatures[objectName].type === 'GeometryCollection') {\n feature = /** @type {TopoJSONGeometryCollection} */ (\n topoJSONFeatures[objectName]\n );\n features.push.apply(\n features,\n readFeaturesFromGeometryCollection(\n feature,\n arcs,\n scale,\n translate,\n property,\n objectName,\n options,\n ),\n );\n } else {\n feature = /** @type {TopoJSONGeometry} */ (\n topoJSONFeatures[objectName]\n );\n features.push(\n readFeatureFromGeometry(\n feature,\n arcs,\n scale,\n translate,\n property,\n objectName,\n options,\n ),\n );\n }\n }\n return features;\n }\n return [];\n }\n\n /**\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @override\n */\n readProjectionFromObject(object) {\n return this.dataProjection;\n }\n}\n\n/**\n * @const\n * @type {Object<string, function(TopoJSONGeometry, Array, ...Array=): import(\"../geom/Geometry.js\").default>}\n */\nconst GEOMETRY_READERS = {\n 'Point': readPointGeometry,\n 'LineString': readLineStringGeometry,\n 'Polygon': readPolygonGeometry,\n 'MultiPoint': readMultiPointGeometry,\n 'MultiLineString': readMultiLineStringGeometry,\n 'MultiPolygon': readMultiPolygonGeometry,\n};\n\n/**\n * Concatenate arcs into a coordinate array.\n * @param {Array<number>} indices Indices of arcs to concatenate. Negative\n * values indicate arcs need to be reversed.\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs (already\n * transformed).\n * @return {Array<import(\"../coordinate.js\").Coordinate>} Coordinates array.\n */\nfunction concatenateArcs(indices, arcs) {\n /** @type {Array<import(\"../coordinate.js\").Coordinate>} */\n const coordinates = [];\n let index;\n for (let i = 0, ii = indices.length; i < ii; ++i) {\n index = indices[i];\n if (i > 0) {\n // splicing together arcs, discard last point\n coordinates.pop();\n }\n if (index >= 0) {\n // forward arc\n const arc = arcs[index];\n for (let j = 0, jj = arc.length; j < jj; ++j) {\n coordinates.push(arc[j].slice(0));\n }\n } else {\n // reverse arc\n const arc = arcs[~index];\n for (let j = arc.length - 1; j >= 0; --j) {\n coordinates.push(arc[j].slice(0));\n }\n }\n }\n return coordinates;\n}\n\n/**\n * Create a point from a TopoJSON geometry object.\n *\n * @param {TopoJSONPoint} object TopoJSON object.\n * @param {Array<number>} scale Scale for each dimension.\n * @param {Array<number>} translate Translation for each dimension.\n * @return {Point} Geometry.\n */\nfunction readPointGeometry(object, scale, translate) {\n const coordinates = object['coordinates'];\n if (scale && translate) {\n transformVertex(coordinates, scale, translate);\n }\n return new Point(coordinates);\n}\n\n/**\n * Create a multi-point from a TopoJSON geometry object.\n *\n * @param {TopoJSONMultiPoint} object TopoJSON object.\n * @param {Array<number>} scale Scale for each dimension.\n * @param {Array<number>} translate Translation for each dimension.\n * @return {MultiPoint} Geometry.\n */\nfunction readMultiPointGeometry(object, scale, translate) {\n const coordinates = object['coordinates'];\n if (scale && translate) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n transformVertex(coordinates[i], scale, translate);\n }\n }\n return new MultiPoint(coordinates);\n}\n\n/**\n * Create a linestring from a TopoJSON geometry object.\n *\n * @param {TopoJSONLineString} object TopoJSON object.\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs.\n * @return {LineString} Geometry.\n */\nfunction readLineStringGeometry(object, arcs) {\n const coordinates = concatenateArcs(object['arcs'], arcs);\n return new LineString(coordinates);\n}\n\n/**\n * Create a multi-linestring from a TopoJSON geometry object.\n *\n * @param {TopoJSONMultiLineString} object TopoJSON object.\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs.\n * @return {MultiLineString} Geometry.\n */\nfunction readMultiLineStringGeometry(object, arcs) {\n const coordinates = [];\n for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {\n coordinates[i] = concatenateArcs(object['arcs'][i], arcs);\n }\n return new MultiLineString(coordinates);\n}\n\n/**\n * Create a polygon from a TopoJSON geometry object.\n *\n * @param {TopoJSONPolygon} object TopoJSON object.\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs.\n * @return {Polygon} Geometry.\n */\nfunction readPolygonGeometry(object, arcs) {\n const coordinates = [];\n for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {\n coordinates[i] = concatenateArcs(object['arcs'][i], arcs);\n }\n return new Polygon(coordinates);\n}\n\n/**\n * Create a multi-polygon from a TopoJSON geometry object.\n *\n * @param {TopoJSONMultiPolygon} object TopoJSON object.\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs.\n * @return {MultiPolygon} Geometry.\n */\nfunction readMultiPolygonGeometry(object, arcs) {\n const coordinates = [];\n for (let i = 0, ii = object['arcs'].length; i < ii; ++i) {\n // for each polygon\n const polyArray = object['arcs'][i];\n const ringCoords = [];\n for (let j = 0, jj = polyArray.length; j < jj; ++j) {\n // for each ring\n ringCoords[j] = concatenateArcs(polyArray[j], arcs);\n }\n coordinates[i] = ringCoords;\n }\n return new MultiPolygon(coordinates);\n}\n\n/**\n * Create features from a TopoJSON GeometryCollection object.\n *\n * @param {TopoJSONGeometryCollection} collection TopoJSON Geometry\n * object.\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs.\n * @param {Array<number>} scale Scale for each dimension.\n * @param {Array<number>} translate Translation for each dimension.\n * @param {string|undefined} property Property to set the `GeometryCollection`'s parent\n * object to.\n * @param {string} name Name of the `Topology`'s child object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array<Feature>} Array of features.\n */\nfunction readFeaturesFromGeometryCollection(\n collection,\n arcs,\n scale,\n translate,\n property,\n name,\n options,\n) {\n const geometries = collection['geometries'];\n const features = [];\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n features[i] = readFeatureFromGeometry(\n geometries[i],\n arcs,\n scale,\n translate,\n property,\n name,\n options,\n );\n }\n return features;\n}\n\n/**\n * Create a feature from a TopoJSON geometry object.\n *\n * @param {TopoJSONGeometry} object TopoJSON geometry object.\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs.\n * @param {Array<number>} scale Scale for each dimension.\n * @param {Array<number>} translate Translation for each dimension.\n * @param {string|undefined} property Property to set the `GeometryCollection`'s parent\n * object to.\n * @param {string} name Name of the `Topology`'s child object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Feature} Feature.\n */\nfunction readFeatureFromGeometry(\n object,\n arcs,\n scale,\n translate,\n property,\n name,\n options,\n) {\n let geometry = null;\n const type = object.type;\n if (type) {\n const geometryReader = GEOMETRY_READERS[type];\n if (type === 'Point' || type === 'MultiPoint') {\n geometry = geometryReader(object, scale, translate);\n } else {\n geometry = geometryReader(object, arcs);\n }\n geometry = transformGeometryWithOptions(geometry, false, options);\n }\n const feature = new Feature({geometry: geometry});\n if (object.id !== undefined) {\n feature.setId(object.id);\n }\n let properties = object.properties;\n if (property) {\n if (!properties) {\n properties = {};\n }\n properties[property] = name;\n }\n if (properties) {\n feature.setProperties(properties, true);\n }\n return feature;\n}\n\n/**\n * Apply a linear transform to array of arcs. The provided array of arcs is\n * modified in place.\n *\n * @param {Array<Array<import(\"../coordinate.js\").Coordinate>>} arcs Array of arcs.\n * @param {Array<number>} scale Scale for each dimension.\n * @param {Array<number>} translate Translation for each dimension.\n */\nfunction transformArcs(arcs, scale, translate) {\n for (let i = 0, ii = arcs.length; i < ii; ++i) {\n transformArc(arcs[i], scale, translate);\n }\n}\n\n/**\n * Apply a linear transform to an arc. The provided arc is modified in place.\n *\n * @param {Array<import(\"../coordinate.js\").Coordinate>} arc Arc.\n * @param {Array<number>} scale Scale for each dimension.\n * @param {Array<number>} translate Translation for each dimension.\n */\nfunction transformArc(arc, scale, translate) {\n let x = 0;\n let y = 0;\n for (let i = 0, ii = arc.length; i < ii; ++i) {\n const vertex = arc[i];\n x += vertex[0];\n y += vertex[1];\n vertex[0] = x;\n vertex[1] = y;\n transformVertex(vertex, scale, translate);\n }\n}\n\n/**\n * Apply a linear transform to a vertex. The provided vertex is modified in\n * place.\n *\n * @param {import(\"../coordinate.js\").Coordinate} vertex Vertex.\n * @param {Array<number>} scale Scale for each dimension.\n * @param {Array<number>} translate Translation for each dimension.\n */\nfunction transformVertex(vertex, scale, translate) {\n vertex[0] = vertex[0] * scale[0] + translate[0];\n vertex[1] = vertex[1] * scale[1] + translate[1];\n}\n\nexport default TopoJSON;\n","/**\n * @module ol/format/filter/Filter\n */\n\n/**\n * @classdesc\n * Abstract class; normally only used for creating subclasses and not instantiated in apps.\n * Base class for WFS GetFeature filters.\n *\n * @abstract\n */\nclass Filter {\n /**\n * @param {!string} tagName The XML tag name for this filter.\n */\n constructor(tagName) {\n /**\n * @private\n * @type {!string}\n */\n this.tagName_ = tagName;\n }\n\n /**\n * The XML tag name for a filter.\n * @return {!string} Name.\n */\n getTagName() {\n return this.tagName_;\n }\n}\n\nexport default Filter;\n","/**\n * @module ol/format/filter/LogicalNary\n */\nimport {assert} from '../../asserts.js';\nimport Filter from './Filter.js';\n\n/**\n * @classdesc\n * Abstract class; normally only used for creating subclasses and not instantiated in apps.\n * Base class for WFS GetFeature n-ary logical filters.\n *\n * @abstract\n */\nclass LogicalNary extends Filter {\n /**\n * @param {!string} tagName The XML tag name for this filter.\n * @param {Array<import(\"./Filter.js\").default>} conditions Conditions.\n */\n constructor(tagName, conditions) {\n super(tagName);\n\n /**\n * @type {Array<import(\"./Filter.js\").default>}\n */\n this.conditions = conditions;\n assert(this.conditions.length >= 2, 'At least 2 conditions are required');\n }\n}\n\nexport default LogicalNary;\n","/**\n * @module ol/format/filter/And\n */\nimport LogicalNary from './LogicalNary.js';\n\n/**\n * @classdesc\n * Represents a logical `<And>` operator between two or more filter conditions.\n *\n * @abstract\n */\nclass And extends LogicalNary {\n /**\n * @param {...import(\"./Filter.js\").default} conditions Conditions.\n */\n constructor(conditions) {\n super('And', Array.prototype.slice.call(arguments));\n }\n}\n\nexport default And;\n","/**\n * @module ol/format/filter/Bbox\n */\nimport Filter from './Filter.js';\n\n/**\n * @classdesc\n * Represents a `<BBOX>` operator to test whether a geometry-valued property\n * intersects a fixed bounding box\n *\n * @api\n */\nclass Bbox extends Filter {\n /**\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../../extent.js\").Extent} extent Extent.\n * @param {string} [srsName] SRS name. No srsName attribute will be set\n * on geometries when this is not provided.\n */\n constructor(geometryName, extent, srsName) {\n super('BBOX');\n\n /**\n * @type {!string}\n */\n this.geometryName = geometryName;\n\n /**\n * @type {import(\"../../extent.js\").Extent}\n */\n this.extent = extent;\n if (extent.length !== 4) {\n throw new Error(\n 'Expected an extent with four values ([minX, minY, maxX, maxY])',\n );\n }\n\n /**\n * @type {string|undefined}\n */\n this.srsName = srsName;\n }\n}\n\nexport default Bbox;\n","/**\n * @module ol/format/filter/Spatial\n */\nimport Filter from './Filter.js';\n\n/**\n * @classdesc\n * Abstract class; normally only used for creating subclasses and not instantiated in apps.\n * Represents a spatial operator to test whether a geometry-valued property\n * relates to a given geometry.\n *\n * @abstract\n */\nclass Spatial extends Filter {\n /**\n * @param {!string} tagName The XML tag name for this filter.\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n */\n constructor(tagName, geometryName, geometry, srsName) {\n super(tagName);\n\n /**\n * @type {!string}\n */\n this.geometryName = geometryName || 'the_geom';\n\n /**\n * @type {import(\"../../geom/Geometry.js\").default}\n */\n this.geometry = geometry;\n\n /**\n * @type {string|undefined}\n */\n this.srsName = srsName;\n }\n}\n\nexport default Spatial;\n","/**\n * @module ol/format/filter/Contains\n */\nimport Spatial from './Spatial.js';\n\n/**\n * @classdesc\n * Represents a `<Contains>` operator to test whether a geometry-valued property\n * contains a given geometry.\n * @api\n */\nclass Contains extends Spatial {\n /**\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n */\n constructor(geometryName, geometry, srsName) {\n super('Contains', geometryName, geometry, srsName);\n }\n}\n\nexport default Contains;\n","/**\n * @module ol/format/filter/DWithin\n */\nimport Spatial from './Spatial.js';\n\n/**\n * @classdesc\n * Represents a `<DWithin>` operator to test whether a geometry-valued property\n * is within a distance to a given geometry.\n * @api\n */\nclass DWithin extends Spatial {\n /**\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../../geom/Geometry.js\").default} geometry Geometry.\n * @param {!number} distance Distance.\n * @param {!string} unit Unit.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n */\n constructor(geometryName, geometry, distance, unit, srsName) {\n super('DWithin', geometryName, geometry, srsName);\n\n /**\n * @public\n * @type {!number}\n */\n this.distance = distance;\n\n /**\n * @public\n * @type {!string}\n */\n this.unit = unit;\n }\n}\n\nexport default DWithin;\n","/**\n * @module ol/format/filter/Disjoint\n */\nimport Spatial from './Spatial.js';\n\n/**\n * @classdesc\n * Represents a `<Disjoint>` operator to test whether a geometry-valued property\n * is disjoint to a given geometry.\n * @api\n */\nclass Disjoint extends Spatial {\n /**\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n */\n constructor(geometryName, geometry, srsName) {\n super('Disjoint', geometryName, geometry, srsName);\n }\n}\n\nexport default Disjoint;\n","/**\n * @module ol/format/filter/Comparison\n */\nimport Filter from './Filter.js';\n\n/**\n * @classdesc\n * Abstract class; normally only used for creating subclasses and not instantiated in apps.\n * Base class for WFS GetFeature property comparison filters.\n *\n * @abstract\n */\nclass Comparison extends Filter {\n /**\n * @param {!string} tagName The XML tag name for this filter.\n * @param {!string} propertyName Name of the context property to compare.\n */\n constructor(tagName, propertyName) {\n super(tagName);\n\n /**\n * @type {!string}\n */\n this.propertyName = propertyName;\n }\n}\n\nexport default Comparison;\n","/**\n * @module ol/format/filter/During\n */\nimport Comparison from './Comparison.js';\n\n/**\n * @classdesc\n * Represents a `<During>` comparison operator.\n * @api\n */\nclass During extends Comparison {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!string} begin The begin date in ISO-8601 format.\n * @param {!string} end The end date in ISO-8601 format.\n */\n constructor(propertyName, begin, end) {\n super('During', propertyName);\n\n /**\n * @type {!string}\n */\n this.begin = begin;\n\n /**\n * @type {!string}\n */\n this.end = end;\n }\n}\n\nexport default During;\n","/**\n * @module ol/format/filter/ComparisonBinary\n */\nimport Comparison from './Comparison.js';\n\n/**\n * @classdesc\n * Abstract class; normally only used for creating subclasses and not instantiated in apps.\n * Base class for WFS GetFeature property binary comparison filters.\n *\n * @abstract\n */\nclass ComparisonBinary extends Comparison {\n /**\n * @param {!string} tagName The XML tag name for this filter.\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!(string|number)} expression The value to compare.\n * @param {boolean} [matchCase] Case-sensitive?\n */\n constructor(tagName, propertyName, expression, matchCase) {\n super(tagName, propertyName);\n\n /**\n * @type {!(string|number)}\n */\n this.expression = expression;\n\n /**\n * @type {boolean|undefined}\n */\n this.matchCase = matchCase;\n }\n}\n\nexport default ComparisonBinary;\n","/**\n * @module ol/format/filter/EqualTo\n */\nimport ComparisonBinary from './ComparisonBinary.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsEqualTo>` comparison operator.\n * @api\n */\nclass EqualTo extends ComparisonBinary {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!(string|number)} expression The value to compare.\n * @param {boolean} [matchCase] Case-sensitive?\n */\n constructor(propertyName, expression, matchCase) {\n super('PropertyIsEqualTo', propertyName, expression, matchCase);\n }\n}\n\nexport default EqualTo;\n","/**\n * @module ol/format/filter/GreaterThan\n */\nimport ComparisonBinary from './ComparisonBinary.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsGreaterThan>` comparison operator.\n * @api\n */\nclass GreaterThan extends ComparisonBinary {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n */\n constructor(propertyName, expression) {\n super('PropertyIsGreaterThan', propertyName, expression);\n }\n}\n\nexport default GreaterThan;\n","/**\n * @module ol/format/filter/GreaterThanOrEqualTo\n */\nimport ComparisonBinary from './ComparisonBinary.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsGreaterThanOrEqualTo>` comparison operator.\n * @api\n */\nclass GreaterThanOrEqualTo extends ComparisonBinary {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n */\n constructor(propertyName, expression) {\n super('PropertyIsGreaterThanOrEqualTo', propertyName, expression);\n }\n}\n\nexport default GreaterThanOrEqualTo;\n","/**\n * @module ol/format/filter/Intersects\n */\nimport Spatial from './Spatial.js';\n\n/**\n * @classdesc\n * Represents a `<Intersects>` operator to test whether a geometry-valued property\n * intersects a given geometry.\n * @api\n */\nclass Intersects extends Spatial {\n /**\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n */\n constructor(geometryName, geometry, srsName) {\n super('Intersects', geometryName, geometry, srsName);\n }\n}\n\nexport default Intersects;\n","/**\n * @module ol/format/filter/IsBetween\n */\nimport Comparison from './Comparison.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsBetween>` comparison operator.\n * @api\n */\nclass IsBetween extends Comparison {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} lowerBoundary The lower bound of the range.\n * @param {!number} upperBoundary The upper bound of the range.\n */\n constructor(propertyName, lowerBoundary, upperBoundary) {\n super('PropertyIsBetween', propertyName);\n\n /**\n * @type {!number}\n */\n this.lowerBoundary = lowerBoundary;\n\n /**\n * @type {!number}\n */\n this.upperBoundary = upperBoundary;\n }\n}\n\nexport default IsBetween;\n","/**\n * @module ol/format/filter/IsLike\n */\nimport Comparison from './Comparison.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsLike>` comparison operator.\n * @api\n */\nclass IsLike extends Comparison {\n /**\n * [constructor description]\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!string} pattern Text pattern.\n * @param {string} [wildCard] Pattern character which matches any sequence of\n * zero or more string characters. Default is '*'.\n * @param {string} [singleChar] pattern character which matches any single\n * string character. Default is '.'.\n * @param {string} [escapeChar] Escape character which can be used to escape\n * the pattern characters. Default is '!'.\n * @param {boolean} [matchCase] Case-sensitive?\n */\n constructor(\n propertyName,\n pattern,\n wildCard,\n singleChar,\n escapeChar,\n matchCase,\n ) {\n super('PropertyIsLike', propertyName);\n\n /**\n * @type {!string}\n */\n this.pattern = pattern;\n\n /**\n * @type {!string}\n */\n this.wildCard = wildCard !== undefined ? wildCard : '*';\n\n /**\n * @type {!string}\n */\n this.singleChar = singleChar !== undefined ? singleChar : '.';\n\n /**\n * @type {!string}\n */\n this.escapeChar = escapeChar !== undefined ? escapeChar : '!';\n\n /**\n * @type {boolean|undefined}\n */\n this.matchCase = matchCase;\n }\n}\n\nexport default IsLike;\n","/**\n * @module ol/format/filter/IsNull\n */\nimport Comparison from './Comparison.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsNull>` comparison operator.\n * @api\n */\nclass IsNull extends Comparison {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n */\n constructor(propertyName) {\n super('PropertyIsNull', propertyName);\n }\n}\n\nexport default IsNull;\n","/**\n * @module ol/format/filter/LessThan\n */\nimport ComparisonBinary from './ComparisonBinary.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsLessThan>` comparison operator.\n * @api\n */\nclass LessThan extends ComparisonBinary {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n */\n constructor(propertyName, expression) {\n super('PropertyIsLessThan', propertyName, expression);\n }\n}\n\nexport default LessThan;\n","/**\n * @module ol/format/filter/LessThanOrEqualTo\n */\nimport ComparisonBinary from './ComparisonBinary.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsLessThanOrEqualTo>` comparison operator.\n * @api\n */\nclass LessThanOrEqualTo extends ComparisonBinary {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n */\n constructor(propertyName, expression) {\n super('PropertyIsLessThanOrEqualTo', propertyName, expression);\n }\n}\n\nexport default LessThanOrEqualTo;\n","/**\n * @module ol/format/filter/Not\n */\nimport Filter from './Filter.js';\n\n/**\n * @classdesc\n * Represents a logical `<Not>` operator for a filter condition.\n * @api\n */\nclass Not extends Filter {\n /**\n * @param {!import(\"./Filter.js\").default} condition Filter condition.\n */\n constructor(condition) {\n super('Not');\n\n /**\n * @type {!import(\"./Filter.js\").default}\n */\n this.condition = condition;\n }\n}\n\nexport default Not;\n","/**\n * @module ol/format/filter/NotEqualTo\n */\nimport ComparisonBinary from './ComparisonBinary.js';\n\n/**\n * @classdesc\n * Represents a `<PropertyIsNotEqualTo>` comparison operator.\n * @api\n */\nclass NotEqualTo extends ComparisonBinary {\n /**\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!(string|number)} expression The value to compare.\n * @param {boolean} [matchCase] Case-sensitive?\n */\n constructor(propertyName, expression, matchCase) {\n super('PropertyIsNotEqualTo', propertyName, expression, matchCase);\n }\n}\n\nexport default NotEqualTo;\n","/**\n * @module ol/format/filter/Or\n */\nimport LogicalNary from './LogicalNary.js';\n\n/**\n * @classdesc\n * Represents a logical `<Or>` operator between two or more filter conditions.\n * @api\n */\nclass Or extends LogicalNary {\n /**\n * @param {...import(\"./Filter.js\").default} conditions Conditions.\n */\n constructor(conditions) {\n super('Or', Array.prototype.slice.call(arguments));\n }\n}\n\nexport default Or;\n","/**\n * @module ol/format/filter/ResourceId\n */\nimport Filter from './Filter.js';\n\n/**\n * @classdesc\n *\n * @abstract\n */\nclass ResourceId extends Filter {\n /**\n * @param {!string} rid Resource ID.\n */\n constructor(rid) {\n super('ResourceId');\n\n /**\n * @type {!string}\n */\n this.rid = rid;\n }\n}\n\nexport default ResourceId;\n","/**\n * @module ol/format/filter/Within\n */\nimport Spatial from './Spatial.js';\n\n/**\n * @classdesc\n * Represents a `<Within>` operator to test whether a geometry-valued property\n * is within a given geometry.\n * @api\n */\nclass Within extends Spatial {\n /**\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n */\n constructor(geometryName, geometry, srsName) {\n super('Within', geometryName, geometry, srsName);\n }\n}\n\nexport default Within;\n","/**\n * @module ol/format/filter\n */\nimport And from './filter/And.js';\nimport Bbox from './filter/Bbox.js';\nimport Contains from './filter/Contains.js';\nimport DWithin from './filter/DWithin.js';\nimport Disjoint from './filter/Disjoint.js';\nimport During from './filter/During.js';\nimport EqualTo from './filter/EqualTo.js';\nimport GreaterThan from './filter/GreaterThan.js';\nimport GreaterThanOrEqualTo from './filter/GreaterThanOrEqualTo.js';\nimport Intersects from './filter/Intersects.js';\nimport IsBetween from './filter/IsBetween.js';\nimport IsLike from './filter/IsLike.js';\nimport IsNull from './filter/IsNull.js';\nimport LessThan from './filter/LessThan.js';\nimport LessThanOrEqualTo from './filter/LessThanOrEqualTo.js';\nimport Not from './filter/Not.js';\nimport NotEqualTo from './filter/NotEqualTo.js';\nimport Or from './filter/Or.js';\nimport ResourceId from './filter/ResourceId.js';\nimport Within from './filter/Within.js';\n\n/**\n * Create a logical `<And>` operator between two or more filter conditions.\n *\n * @param {...import(\"./filter/Filter.js\").default} conditions Filter conditions.\n * @return {!And} `<And>` operator.\n * @api\n */\nexport function and(conditions) {\n const params = [null].concat(Array.prototype.slice.call(arguments));\n return new (Function.prototype.bind.apply(And, params))();\n}\n\n/**\n * Create a logical `<Or>` operator between two or more filter conditions.\n *\n * @param {...import(\"./filter/Filter.js\").default} conditions Filter conditions.\n * @return {!Or} `<Or>` operator.\n * @api\n */\nexport function or(conditions) {\n const params = [null].concat(Array.prototype.slice.call(arguments));\n return new (Function.prototype.bind.apply(Or, params))();\n}\n\n/**\n * Represents a logical `<Not>` operator for a filter condition.\n *\n * @param {!import(\"./filter/Filter.js\").default} condition Filter condition.\n * @return {!Not} `<Not>` operator.\n * @api\n */\nexport function not(condition) {\n return new Not(condition);\n}\n\n/**\n * Create a `<BBOX>` operator to test whether a geometry-valued property\n * intersects a fixed bounding box\n *\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../extent.js\").Extent} extent Extent.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n * @return {!Bbox} `<BBOX>` operator.\n * @api\n */\nexport function bbox(geometryName, extent, srsName) {\n return new Bbox(geometryName, extent, srsName);\n}\n\n/**\n * Create a `<Contains>` operator to test whether a geometry-valued property\n * contains a given geometry.\n *\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n * @return {!Contains} `<Contains>` operator.\n * @api\n */\nexport function contains(geometryName, geometry, srsName) {\n return new Contains(geometryName, geometry, srsName);\n}\n\n/**\n * Create a `<Intersects>` operator to test whether a geometry-valued property\n * intersects a given geometry.\n *\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n * @return {!Intersects} `<Intersects>` operator.\n * @api\n */\nexport function intersects(geometryName, geometry, srsName) {\n return new Intersects(geometryName, geometry, srsName);\n}\n\n/**\n * Create a `<Disjoint>` operator to test whether a geometry-valued property\n * is disjoint to a given geometry.\n *\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n * @return {!Disjoint} `<Disjoint>` operator.\n * @api\n */\nexport function disjoint(geometryName, geometry, srsName) {\n return new Disjoint(geometryName, geometry, srsName);\n}\n\n/**\n * Create a `<Within>` operator to test whether a geometry-valued property\n * is within a given geometry.\n *\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n * @return {!Within} `<Within>` operator.\n * @api\n */\nexport function within(geometryName, geometry, srsName) {\n return new Within(geometryName, geometry, srsName);\n}\n\n/**\n * Create a `<DWithin>` operator to test whether a geometry-valued property\n * is within a distance to a given geometry.\n *\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {!number} distance Distance.\n * @param {!string} unit Unit.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n * @return {!DWithin} `<DWithin>` operator.\n * @api\n */\nexport function dwithin(geometryName, geometry, distance, unit, srsName) {\n return new DWithin(geometryName, geometry, distance, unit, srsName);\n}\n\n/**\n * Creates a `<PropertyIsEqualTo>` comparison operator.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!(string|number)} expression The value to compare.\n * @param {boolean} [matchCase] Case-sensitive?\n * @return {!EqualTo} `<PropertyIsEqualTo>` operator.\n * @api\n */\nexport function equalTo(propertyName, expression, matchCase) {\n return new EqualTo(propertyName, expression, matchCase);\n}\n\n/**\n * Creates a `<PropertyIsNotEqualTo>` comparison operator.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!(string|number)} expression The value to compare.\n * @param {boolean} [matchCase] Case-sensitive?\n * @return {!NotEqualTo} `<PropertyIsNotEqualTo>` operator.\n * @api\n */\nexport function notEqualTo(propertyName, expression, matchCase) {\n return new NotEqualTo(propertyName, expression, matchCase);\n}\n\n/**\n * Creates a `<PropertyIsLessThan>` comparison operator.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n * @return {!LessThan} `<PropertyIsLessThan>` operator.\n * @api\n */\nexport function lessThan(propertyName, expression) {\n return new LessThan(propertyName, expression);\n}\n\n/**\n * Creates a `<PropertyIsLessThanOrEqualTo>` comparison operator.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n * @return {!LessThanOrEqualTo} `<PropertyIsLessThanOrEqualTo>` operator.\n * @api\n */\nexport function lessThanOrEqualTo(propertyName, expression) {\n return new LessThanOrEqualTo(propertyName, expression);\n}\n\n/**\n * Creates a `<PropertyIsGreaterThan>` comparison operator.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n * @return {!GreaterThan} `<PropertyIsGreaterThan>` operator.\n * @api\n */\nexport function greaterThan(propertyName, expression) {\n return new GreaterThan(propertyName, expression);\n}\n\n/**\n * Creates a `<PropertyIsGreaterThanOrEqualTo>` comparison operator.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} expression The value to compare.\n * @return {!GreaterThanOrEqualTo} `<PropertyIsGreaterThanOrEqualTo>` operator.\n * @api\n */\nexport function greaterThanOrEqualTo(propertyName, expression) {\n return new GreaterThanOrEqualTo(propertyName, expression);\n}\n\n/**\n * Creates a `<PropertyIsNull>` comparison operator to test whether a property value\n * is null.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @return {!IsNull} `<PropertyIsNull>` operator.\n * @api\n */\nexport function isNull(propertyName) {\n return new IsNull(propertyName);\n}\n\n/**\n * Creates a `<PropertyIsBetween>` comparison operator to test whether an expression\n * value lies within a range given by a lower and upper bound (inclusive).\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!number} lowerBoundary The lower bound of the range.\n * @param {!number} upperBoundary The upper bound of the range.\n * @return {!IsBetween} `<PropertyIsBetween>` operator.\n * @api\n */\nexport function between(propertyName, lowerBoundary, upperBoundary) {\n return new IsBetween(propertyName, lowerBoundary, upperBoundary);\n}\n\n/**\n * Represents a `<PropertyIsLike>` comparison operator that matches a string property\n * value against a text pattern.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!string} pattern Text pattern.\n * @param {string} [wildCard] Pattern character which matches any sequence of\n * zero or more string characters. Default is '*'.\n * @param {string} [singleChar] pattern character which matches any single\n * string character. Default is '.'.\n * @param {string} [escapeChar] Escape character which can be used to escape\n * the pattern characters. Default is '!'.\n * @param {boolean} [matchCase] Case-sensitive?\n * @return {!IsLike} `<PropertyIsLike>` operator.\n * @api\n */\nexport function like(\n propertyName,\n pattern,\n wildCard,\n singleChar,\n escapeChar,\n matchCase,\n) {\n return new IsLike(\n propertyName,\n pattern,\n wildCard,\n singleChar,\n escapeChar,\n matchCase,\n );\n}\n\n/**\n * Create a `<During>` temporal operator.\n *\n * @param {!string} propertyName Name of the context property to compare.\n * @param {!string} begin The begin date in ISO-8601 format.\n * @param {!string} end The end date in ISO-8601 format.\n * @return {!During} `<During>` operator.\n * @api\n */\nexport function during(propertyName, begin, end) {\n return new During(propertyName, begin, end);\n}\n\nexport function resourceId(rid) {\n return new ResourceId(rid);\n}\n","/**\n * @module ol/format/WFS\n */\nimport {assert} from '../asserts.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n XML_SCHEMA_INSTANCE_URI,\n createElementNS,\n isDocument,\n makeArrayPusher,\n makeChildAppender,\n makeObjectPropertySetter,\n makeSimpleNodeFactory,\n parse,\n parseNode,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport GML2 from './GML2.js';\nimport GML3 from './GML3.js';\nimport GML32 from './GML32.js';\nimport GMLBase, {GMLNS} from './GMLBase.js';\nimport XMLFeature from './XMLFeature.js';\nimport {and as andFilterFn, bbox as bboxFilterFn} from './filter.js';\nimport {\n readNonNegativeIntegerString,\n readPositiveInteger,\n writeStringTextNode,\n} from './xsd.js';\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nconst FEATURE_COLLECTION_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'boundedBy': makeObjectPropertySetter(\n GMLBase.prototype.readExtentElement,\n 'bounds',\n ),\n },\n 'http://www.opengis.net/wfs/2.0': {\n 'member': makeArrayPusher(GMLBase.prototype.readFeaturesInternal),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nconst TRANSACTION_SUMMARY_PARSERS = {\n 'http://www.opengis.net/wfs': {\n 'totalInserted': makeObjectPropertySetter(readPositiveInteger),\n 'totalUpdated': makeObjectPropertySetter(readPositiveInteger),\n 'totalDeleted': makeObjectPropertySetter(readPositiveInteger),\n },\n 'http://www.opengis.net/wfs/2.0': {\n 'totalInserted': makeObjectPropertySetter(readPositiveInteger),\n 'totalUpdated': makeObjectPropertySetter(readPositiveInteger),\n 'totalDeleted': makeObjectPropertySetter(readPositiveInteger),\n },\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nconst TRANSACTION_RESPONSE_PARSERS = {\n 'http://www.opengis.net/wfs': {\n 'TransactionSummary': makeObjectPropertySetter(\n readTransactionSummary,\n 'transactionSummary',\n ),\n 'InsertResults': makeObjectPropertySetter(readInsertResults, 'insertIds'),\n },\n 'http://www.opengis.net/wfs/2.0': {\n 'TransactionSummary': makeObjectPropertySetter(\n readTransactionSummary,\n 'transactionSummary',\n ),\n 'InsertResults': makeObjectPropertySetter(readInsertResults, 'insertIds'),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nconst QUERY_SERIALIZERS = {\n 'http://www.opengis.net/wfs': {\n 'PropertyName': makeChildAppender(writeStringTextNode),\n },\n 'http://www.opengis.net/wfs/2.0': {\n 'PropertyName': makeChildAppender(writeStringTextNode),\n },\n};\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nconst TRANSACTION_SERIALIZERS = {\n 'http://www.opengis.net/wfs': {\n 'Insert': makeChildAppender(writeFeature),\n 'Update': makeChildAppender(writeUpdate),\n 'Delete': makeChildAppender(writeDelete),\n 'Property': makeChildAppender(writeProperty),\n 'Native': makeChildAppender(writeNative),\n },\n 'http://www.opengis.net/wfs/2.0': {\n 'Insert': makeChildAppender(writeFeature),\n 'Update': makeChildAppender(writeUpdate),\n 'Delete': makeChildAppender(writeDelete),\n 'Property': makeChildAppender(writeProperty),\n 'Native': makeChildAppender(writeNative),\n },\n};\n\n/**\n * @typedef {Object} Options\n * @property {Object<string, string>|string} [featureNS] The namespace URI used for features.\n * @property {Array<string>|string} [featureType] The feature type to parse. Only used for read operations.\n * @property {GMLBase} [gmlFormat] The GML format to use to parse the response.\n * Default is `ol/format/GML2` for WFS 1.0.0, `ol/format/GML3` for WFS 1.1.0 and `ol/format/GML32` for WFS 2.0.0.\n * @property {string} [schemaLocation] Optional schemaLocation to use for serialization, this will override the default.\n * @property {string} [version='1.1.0'] WFS version to use. Can be either `1.0.0`, `1.1.0` or `2.0.0`.\n */\n\n/**\n * @typedef {Object} WriteGetFeatureOptions\n * @property {string} featureNS The namespace URI used for features.\n * @property {string} featurePrefix The prefix for the feature namespace.\n * @property {Array<string|FeatureType>} featureTypes The feature type names or FeatureType objects to\n * define a unique bbox filter per feature type name (in this case, options `bbox` and `geometryName` are\n * ignored.).\n * @property {string} [srsName] SRS name. No srsName attribute will be set on\n * geometries when this is not provided.\n * @property {string} [handle] Handle.\n * @property {string} [outputFormat] Output format.\n * @property {number} [maxFeatures] Maximum number of features to fetch.\n * @property {string} [geometryName] Geometry name to use in a BBOX filter.\n * @property {Array<string>} [propertyNames] Optional list of property names to serialize.\n * @property {string} [viewParams] viewParams GeoServer vendor parameter.\n * @property {number} [startIndex] Start index to use for WFS paging. This is a\n * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services.\n * @property {number} [count] Number of features to retrieve when paging. This is a\n * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services. Please note that some\n * Web Feature Services have repurposed `maxfeatures` instead.\n * @property {import(\"../extent.js\").Extent} [bbox] Extent to use for the BBOX filter. The `geometryName`\n * option must be set.\n * @property {import(\"./filter/Filter.js\").default} [filter] Filter condition. See\n * {@link module:ol/format/filter} for more information.\n * @property {string} [resultType] Indicates what response should be returned,\n * e.g. `hits` only includes the `numberOfFeatures` attribute in the response and no features.\n */\n\n/**\n * @typedef {Object} FeatureType\n * @property {!string} name The feature type name.\n * @property {!import(\"../extent.js\").Extent} bbox Extent to use for the BBOX filter.\n * @property {!string} geometryName Geometry name to use in the BBOX filter.\n */\n\n/**\n * @typedef {Object} WriteTransactionOptions\n * @property {string} featureNS The namespace URI used for features.\n * @property {string} featurePrefix The prefix for the feature namespace.\n * @property {string} featureType The feature type name.\n * @property {string} [srsName] SRS name. No srsName attribute will be set on\n * geometries when this is not provided.\n * @property {string} [handle] Handle.\n * @property {boolean} [hasZ] Must be set to true if the transaction is for\n * a 3D layer. This will allow the Z coordinate to be included in the transaction.\n * @property {Array<Object>} nativeElements Native elements. Currently not supported.\n * @property {import(\"./GMLBase.js\").Options} [gmlOptions] GML options for the WFS transaction writer.\n * @property {string} [version='1.1.0'] WFS version to use for the transaction. Can be either `1.0.0`, `1.1.0` or `2.0.0`.\n */\n\n/**\n * Number of features; bounds/extent.\n * @typedef {Object} FeatureCollectionMetadata\n * @property {number} numberOfFeatures NumberOfFeatures.\n * @property {import(\"../extent.js\").Extent} bounds Bounds.\n */\n\n/**\n * @typedef {Object} TransactionSummary\n * @property {number} totalDeleted TotalDeleted.\n * @property {number} totalInserted TotalInserted.\n * @property {number} totalUpdated TotalUpdated.\n */\n\n/**\n * Total deleted; total inserted; total updated; array of insert ids.\n * @typedef {Object} TransactionResponse\n * @property {TransactionSummary} transactionSummary Transaction summary.\n * @property {Array<string>} insertIds InsertIds.\n */\n\n/**\n * @type {string}\n */\nconst FEATURE_PREFIX = 'feature';\n\n/**\n * @type {string}\n */\nconst XMLNS = 'http://www.w3.org/2000/xmlns/';\n\n/**\n * @type {Object<string, string>}\n */\nconst OGCNS = {\n '2.0.0': 'http://www.opengis.net/ogc/1.1',\n '1.1.0': 'http://www.opengis.net/ogc',\n '1.0.0': 'http://www.opengis.net/ogc',\n};\n\n/**\n * @type {Object<string, string>}\n */\nconst WFSNS = {\n '2.0.0': 'http://www.opengis.net/wfs/2.0',\n '1.1.0': 'http://www.opengis.net/wfs',\n '1.0.0': 'http://www.opengis.net/wfs',\n};\n\n/**\n * @type {Object<string, string>}\n */\nconst FESNS = {\n '2.0.0': 'http://www.opengis.net/fes/2.0',\n '1.1.0': 'http://www.opengis.net/fes',\n '1.0.0': 'http://www.opengis.net/fes',\n};\n\n/**\n * @type {Object<string, string>}\n */\nconst SCHEMA_LOCATIONS = {\n '2.0.0':\n 'http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd',\n '1.1.0':\n 'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',\n '1.0.0':\n 'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd',\n};\n\n/**\n * @type {Object<string, object>}\n */\nconst GML_FORMATS = {\n '2.0.0': GML32,\n '1.1.0': GML3,\n '1.0.0': GML2,\n};\n\n/**\n * @const\n * @type {string}\n */\nconst DEFAULT_VERSION = '1.1.0';\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the WFS format.\n * By default, supports WFS version 1.1.0. You can pass a GML format\n * as option to override the default.\n * Also see {@link module:ol/format/GMLBase~GMLBase} which is used by this format.\n *\n * @api\n */\nclass WFS extends XMLFeature {\n /**\n * @param {Options} [options] Optional configuration object.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {string}\n */\n this.version_ = options.version ? options.version : DEFAULT_VERSION;\n\n /**\n * @private\n * @type {Array<string>|string|undefined}\n */\n this.featureType_ = options.featureType;\n\n /**\n * @private\n * @type {Object<string, string>|string|undefined}\n */\n this.featureNS_ = options.featureNS;\n\n /**\n * @private\n * @type {GMLBase}\n */\n this.gmlFormat_ = options.gmlFormat\n ? options.gmlFormat\n : new GML_FORMATS[this.version_]();\n\n /**\n * @private\n * @type {string}\n */\n this.schemaLocation_ = options.schemaLocation\n ? options.schemaLocation\n : SCHEMA_LOCATIONS[this.version_];\n }\n\n /**\n * @return {Array<string>|string|undefined} featureType\n */\n getFeatureType() {\n return this.featureType_;\n }\n\n /**\n * @param {Array<string>|string|undefined} featureType Feature type(s) to parse.\n */\n setFeatureType(featureType) {\n this.featureType_ = featureType;\n }\n\n /**\n * @protected\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @override\n */\n readFeaturesFromNode(node, options) {\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const context = {\n node,\n };\n Object.assign(context, {\n 'featureType': this.featureType_,\n 'featureNS': this.featureNS_,\n });\n\n Object.assign(context, this.getReadOptions(node, options ? options : {}));\n const objectStack = [context];\n let featuresNS;\n if (this.version_ === '2.0.0') {\n featuresNS = FEATURE_COLLECTION_PARSERS;\n } else {\n featuresNS = this.gmlFormat_.FEATURE_COLLECTION_PARSERS;\n }\n let features = pushParseAndPop(\n [],\n featuresNS,\n node,\n objectStack,\n this.gmlFormat_,\n );\n if (!features) {\n features = [];\n }\n return features;\n }\n\n /**\n * Read transaction response of the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @return {TransactionResponse|undefined} Transaction response.\n * @api\n */\n readTransactionResponse(source) {\n if (!source) {\n return undefined;\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readTransactionResponseFromDocument(doc);\n }\n if (isDocument(source)) {\n return this.readTransactionResponseFromDocument(\n /** @type {Document} */ (source),\n );\n }\n return this.readTransactionResponseFromNode(\n /** @type {Element} */ (source),\n );\n }\n\n /**\n * Read feature collection metadata of the source.\n *\n * @param {Document|Element|Object|string} source Source.\n * @return {FeatureCollectionMetadata|undefined}\n * FeatureCollection metadata.\n * @api\n */\n readFeatureCollectionMetadata(source) {\n if (!source) {\n return undefined;\n }\n if (typeof source === 'string') {\n const doc = parse(source);\n return this.readFeatureCollectionMetadataFromDocument(doc);\n }\n if (isDocument(source)) {\n return this.readFeatureCollectionMetadataFromDocument(\n /** @type {Document} */ (source),\n );\n }\n return this.readFeatureCollectionMetadataFromNode(\n /** @type {Element} */ (source),\n );\n }\n\n /**\n * @param {Document} doc Document.\n * @return {FeatureCollectionMetadata|undefined}\n * FeatureCollection metadata.\n */\n readFeatureCollectionMetadataFromDocument(doc) {\n for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n return this.readFeatureCollectionMetadataFromNode(\n /** @type {Element} */ (n),\n );\n }\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @return {FeatureCollectionMetadata|undefined}\n * FeatureCollection metadata.\n */\n readFeatureCollectionMetadataFromNode(node) {\n const result = {};\n const value = readNonNegativeIntegerString(\n node.getAttribute('numberOfFeatures'),\n );\n result['numberOfFeatures'] = value;\n return pushParseAndPop(\n /** @type {FeatureCollectionMetadata} */ (result),\n FEATURE_COLLECTION_PARSERS,\n node,\n [],\n this.gmlFormat_,\n );\n }\n\n /**\n * @param {Document} doc Document.\n * @return {TransactionResponse|undefined} Transaction response.\n */\n readTransactionResponseFromDocument(doc) {\n for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n return this.readTransactionResponseFromNode(/** @type {Element} */ (n));\n }\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @return {TransactionResponse|undefined} Transaction response.\n */\n readTransactionResponseFromNode(node) {\n return pushParseAndPop(\n /** @type {TransactionResponse} */ ({}),\n TRANSACTION_RESPONSE_PARSERS,\n node,\n [],\n );\n }\n\n /**\n * Encode format as WFS `GetFeature` and return the Node.\n *\n * @param {WriteGetFeatureOptions} options Options.\n * @return {Node} Result.\n * @api\n */\n writeGetFeature(options) {\n const node = createElementNS(WFSNS[this.version_], 'GetFeature');\n node.setAttribute('service', 'WFS');\n node.setAttribute('version', this.version_);\n if (options.handle) {\n node.setAttribute('handle', options.handle);\n }\n if (options.outputFormat) {\n node.setAttribute('outputFormat', options.outputFormat);\n }\n if (options.maxFeatures !== undefined) {\n node.setAttribute('maxFeatures', String(options.maxFeatures));\n }\n if (options.resultType) {\n node.setAttribute('resultType', options.resultType);\n }\n if (options.startIndex !== undefined) {\n node.setAttribute('startIndex', String(options.startIndex));\n }\n if (options.count !== undefined) {\n node.setAttribute('count', String(options.count));\n }\n if (options.viewParams !== undefined) {\n node.setAttribute('viewParams', options.viewParams);\n }\n node.setAttributeNS(\n XML_SCHEMA_INSTANCE_URI,\n 'xsi:schemaLocation',\n this.schemaLocation_,\n );\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const context = {\n node,\n };\n Object.assign(context, {\n 'version': this.version_,\n 'srsName': options.srsName,\n 'featureNS': options.featureNS ? options.featureNS : this.featureNS_,\n 'featurePrefix': options.featurePrefix,\n 'propertyNames': options.propertyNames ? options.propertyNames : [],\n });\n assert(\n Array.isArray(options.featureTypes),\n '`options.featureTypes` must be an Array',\n );\n if (typeof options.featureTypes[0] === 'string') {\n let filter = options.filter;\n if (options.bbox) {\n assert(\n options.geometryName,\n '`options.geometryName` must also be provided when `options.bbox` is set',\n );\n filter = this.combineBboxAndFilter(\n options.geometryName,\n options.bbox,\n options.srsName,\n filter,\n );\n }\n Object.assign(context, {\n 'geometryName': options.geometryName,\n 'filter': filter,\n });\n writeGetFeature(\n node,\n /** @type {!Array<string>} */ (options.featureTypes),\n [context],\n );\n } else {\n // Write one query node per element in featuresType.\n options.featureTypes.forEach((/** @type {FeatureType} */ featureType) => {\n const completeFilter = this.combineBboxAndFilter(\n featureType.geometryName,\n featureType.bbox,\n options.srsName,\n options.filter,\n );\n Object.assign(context, {\n 'geometryName': featureType.geometryName,\n 'filter': completeFilter,\n });\n writeGetFeature(node, [featureType.name], [context]);\n });\n }\n return node;\n }\n\n /**\n * Create a bbox filter and combine it with another optional filter.\n *\n * @param {!string} geometryName Geometry name to use.\n * @param {!import(\"../extent.js\").Extent} extent Extent.\n * @param {string} [srsName] SRS name. No srsName attribute will be\n * set on geometries when this is not provided.\n * @param {import(\"./filter/Filter.js\").default} [filter] Filter condition.\n * @return {import(\"./filter/Filter.js\").default} The filter.\n */\n combineBboxAndFilter(geometryName, extent, srsName, filter) {\n const bboxFilter = bboxFilterFn(geometryName, extent, srsName);\n if (filter) {\n // if bbox and filter are both set, combine the two into a single filter\n return andFilterFn(filter, bboxFilter);\n }\n return bboxFilter;\n }\n\n /**\n * Encode format as WFS `Transaction` and return the Node.\n *\n * @param {Array<import(\"../Feature.js\").default>} inserts The features to insert.\n * @param {Array<import(\"../Feature.js\").default>} updates The features to update.\n * @param {Array<import(\"../Feature.js\").default>} deletes The features to delete.\n * @param {WriteTransactionOptions} options Write options.\n * @return {Node} Result.\n * @api\n */\n writeTransaction(inserts, updates, deletes, options) {\n const objectStack = [];\n const version = options.version ? options.version : this.version_;\n const node = createElementNS(WFSNS[version], 'Transaction');\n\n node.setAttribute('service', 'WFS');\n node.setAttribute('version', version);\n let baseObj;\n /** @type {import(\"../xml.js\").NodeStackItem} */\n if (options) {\n baseObj = options.gmlOptions ? options.gmlOptions : {};\n if (options.handle) {\n node.setAttribute('handle', options.handle);\n }\n }\n node.setAttributeNS(\n XML_SCHEMA_INSTANCE_URI,\n 'xsi:schemaLocation',\n SCHEMA_LOCATIONS[version],\n );\n\n const request = createTransactionRequest(node, baseObj, version, options);\n if (inserts) {\n serializeTransactionRequest('Insert', inserts, objectStack, request);\n }\n if (updates) {\n serializeTransactionRequest('Update', updates, objectStack, request);\n }\n if (deletes) {\n serializeTransactionRequest('Delete', deletes, objectStack, request);\n }\n if (options.nativeElements) {\n serializeTransactionRequest(\n 'Native',\n options.nativeElements,\n objectStack,\n request,\n );\n }\n return node;\n }\n\n /**\n * @param {Document} doc Document.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @override\n */\n readProjectionFromDocument(doc) {\n for (let n = doc.firstChild; n; n = n.nextSibling) {\n if (n.nodeType == Node.ELEMENT_NODE) {\n return this.readProjectionFromNode(/** @type {Element} */ (n));\n }\n }\n return null;\n }\n\n /**\n * @param {Element} node Node.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @override\n */\n readProjectionFromNode(node) {\n if (node.firstElementChild && node.firstElementChild.firstElementChild) {\n node = node.firstElementChild.firstElementChild;\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n if (\n !(\n n.childNodes.length === 0 ||\n (n.childNodes.length === 1 && n.firstChild.nodeType === 3)\n )\n ) {\n const objectStack = [{}];\n this.gmlFormat_.readGeometryElement(n, objectStack);\n return getProjection(objectStack.pop().srsName);\n }\n }\n }\n\n return null;\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {*} baseObj Base object.\n * @param {string} version Version.\n * @param {WriteTransactionOptions} options Options.\n * @return {Object} Request object.\n */\nfunction createTransactionRequest(node, baseObj, version, options) {\n const featurePrefix = options.featurePrefix\n ? options.featurePrefix\n : FEATURE_PREFIX;\n let gmlVersion;\n if (version === '1.0.0') {\n gmlVersion = 2;\n } else if (version === '1.1.0') {\n gmlVersion = 3;\n } else if (version === '2.0.0') {\n gmlVersion = 3.2;\n }\n const obj = Object.assign(\n {node},\n {\n version,\n 'featureNS': options.featureNS,\n 'featureType': options.featureType,\n 'featurePrefix': featurePrefix,\n 'gmlVersion': gmlVersion,\n 'hasZ': options.hasZ,\n 'srsName': options.srsName,\n },\n baseObj,\n );\n return obj;\n}\n\n/**\n * @param {string} type Request type.\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {Array<*>} objectStack Object stack.\n * @param {Element} request Transaction Request.\n */\nfunction serializeTransactionRequest(type, features, objectStack, request) {\n pushSerializeAndPop(\n request,\n TRANSACTION_SERIALIZERS,\n makeSimpleNodeFactory(type),\n features,\n objectStack,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Transaction Summary.\n */\nfunction readTransactionSummary(node, objectStack) {\n return pushParseAndPop({}, TRANSACTION_SUMMARY_PARSERS, node, objectStack);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nconst OGC_FID_PARSERS = {\n 'http://www.opengis.net/ogc': {\n 'FeatureId': makeArrayPusher(function (node, objectStack) {\n return node.getAttribute('fid');\n }),\n },\n 'http://www.opengis.net/ogc/1.1': {\n 'FeatureId': makeArrayPusher(function (node, objectStack) {\n return node.getAttribute('fid');\n }),\n },\n};\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction fidParser(node, objectStack) {\n parseNode(OGC_FID_PARSERS, node, objectStack);\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\nconst INSERT_RESULTS_PARSERS = {\n 'http://www.opengis.net/wfs': {\n 'Feature': fidParser,\n },\n 'http://www.opengis.net/wfs/2.0': {\n 'Feature': fidParser,\n },\n};\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<string>|undefined} Insert results.\n */\nfunction readInsertResults(node, objectStack) {\n return pushParseAndPop([], INSERT_RESULTS_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeFeature(node, feature, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const featureType = context['featureType'];\n const featureNS = context['featureNS'];\n const gmlVersion = context['gmlVersion'];\n const child = createElementNS(featureNS, featureType);\n node.appendChild(child);\n if (gmlVersion === 2) {\n GML2.prototype.writeFeatureElement(child, feature, objectStack);\n } else if (gmlVersion === 3) {\n GML3.prototype.writeFeatureElement(child, feature, objectStack);\n } else {\n GML32.prototype.writeFeatureElement(child, feature, objectStack);\n }\n}\n\n/**\n * @param {Node} node Node.\n * @param {number|string} fid Feature identifier.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeOgcFidFilter(node, fid, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const version = context['version'];\n const ns = OGCNS[version];\n const filter = createElementNS(ns, 'Filter');\n const child = createElementNS(ns, 'FeatureId');\n filter.appendChild(child);\n child.setAttribute('fid', /** @type {string} */ (fid));\n node.appendChild(filter);\n}\n\n/**\n * @param {string|undefined} featurePrefix The prefix of the feature.\n * @param {string} featureType The type of the feature.\n * @return {string} The value of the typeName property.\n */\nfunction getTypeName(featurePrefix, featureType) {\n featurePrefix = featurePrefix ? featurePrefix : FEATURE_PREFIX;\n const prefix = featurePrefix + ':';\n // The featureType already contains the prefix.\n if (featureType.startsWith(prefix)) {\n return featureType;\n }\n return prefix + featureType;\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeDelete(node, feature, objectStack) {\n const context = objectStack[objectStack.length - 1];\n assert(feature.getId() !== undefined, 'Features must have an id set');\n const featureType = context['featureType'];\n const featurePrefix = context['featurePrefix'];\n const featureNS = context['featureNS'];\n const typeName = getTypeName(featurePrefix, featureType);\n node.setAttribute('typeName', typeName);\n node.setAttributeNS(XMLNS, 'xmlns:' + featurePrefix, featureNS);\n const fid = feature.getId();\n if (fid !== undefined) {\n writeOgcFidFilter(node, fid, objectStack);\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeUpdate(node, feature, objectStack) {\n const context = objectStack[objectStack.length - 1];\n assert(feature.getId() !== undefined, 'Features must have an id set');\n const version = context['version'];\n const featureType = context['featureType'];\n const featurePrefix = context['featurePrefix'];\n const featureNS = context['featureNS'];\n const typeName = getTypeName(featurePrefix, featureType);\n const geometryName = feature.getGeometryName();\n node.setAttribute('typeName', typeName);\n node.setAttributeNS(XMLNS, 'xmlns:' + featurePrefix, featureNS);\n const fid = feature.getId();\n if (fid !== undefined) {\n const keys = feature.getKeys();\n const values = [];\n for (let i = 0, ii = keys.length; i < ii; i++) {\n const value = feature.get(keys[i]);\n if (value !== undefined) {\n let name = keys[i];\n if (\n value &&\n typeof (/** @type {?} */ (value).getSimplifiedGeometry) === 'function'\n ) {\n name = geometryName;\n }\n values.push({name: name, value: value});\n }\n }\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */ ({\n version,\n 'gmlVersion': context['gmlVersion'],\n node,\n 'hasZ': context['hasZ'],\n 'srsName': context['srsName'],\n }),\n TRANSACTION_SERIALIZERS,\n makeSimpleNodeFactory('Property'),\n values,\n objectStack,\n );\n writeOgcFidFilter(node, fid, objectStack);\n }\n}\n\n/**\n * @param {Node} node Node.\n * @param {Object} pair Property name and value.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeProperty(node, pair, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const version = context['version'];\n const ns = WFSNS[version];\n const tagName = version === '2.0.0' ? 'ValueReference' : 'Name';\n const name = createElementNS(ns, tagName);\n const gmlVersion = context['gmlVersion'];\n node.appendChild(name);\n writeStringTextNode(name, pair.name);\n if (pair.value !== undefined && pair.value !== null) {\n const value = createElementNS(ns, 'Value');\n node.appendChild(value);\n if (\n pair.value &&\n typeof (/** @type {?} */ (pair.value).getSimplifiedGeometry) ===\n 'function'\n ) {\n if (gmlVersion === 2) {\n GML2.prototype.writeGeometryElement(value, pair.value, objectStack);\n } else if (gmlVersion === 3) {\n GML3.prototype.writeGeometryElement(value, pair.value, objectStack);\n } else {\n GML32.prototype.writeGeometryElement(value, pair.value, objectStack);\n }\n } else {\n writeStringTextNode(value, pair.value);\n }\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {{vendorId: string, safeToIgnore: boolean, value: string}} nativeElement The native element.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeNative(node, nativeElement, objectStack) {\n if (nativeElement.vendorId) {\n node.setAttribute('vendorId', nativeElement.vendorId);\n }\n if (nativeElement.safeToIgnore !== undefined) {\n node.setAttribute('safeToIgnore', String(nativeElement.safeToIgnore));\n }\n if (nativeElement.value !== undefined) {\n writeStringTextNode(node, nativeElement.value);\n }\n}\n\n/**\n * @type {Object<string, Object<string, import(\"../xml.js\").Serializer>>}\n */\nconst GETFEATURE_SERIALIZERS = {\n 'http://www.opengis.net/wfs': {\n 'Query': makeChildAppender(writeQuery),\n },\n 'http://www.opengis.net/wfs/2.0': {\n 'Query': makeChildAppender(writeQuery),\n },\n 'http://www.opengis.net/ogc': {\n 'During': makeChildAppender(writeDuringFilter),\n 'And': makeChildAppender(writeLogicalFilter),\n 'Or': makeChildAppender(writeLogicalFilter),\n 'Not': makeChildAppender(writeNotFilter),\n 'BBOX': makeChildAppender(writeBboxFilter),\n 'Contains': makeChildAppender(writeSpatialFilter),\n 'Intersects': makeChildAppender(writeSpatialFilter),\n 'Within': makeChildAppender(writeSpatialFilter),\n 'DWithin': makeChildAppender(writeDWithinFilter),\n 'PropertyIsEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsNotEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsLessThan': makeChildAppender(writeComparisonFilter),\n 'PropertyIsLessThanOrEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsGreaterThan': makeChildAppender(writeComparisonFilter),\n 'PropertyIsGreaterThanOrEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsNull': makeChildAppender(writeIsNullFilter),\n 'PropertyIsBetween': makeChildAppender(writeIsBetweenFilter),\n 'PropertyIsLike': makeChildAppender(writeIsLikeFilter),\n },\n 'http://www.opengis.net/fes/2.0': {\n 'During': makeChildAppender(writeDuringFilter),\n 'And': makeChildAppender(writeLogicalFilter),\n 'Or': makeChildAppender(writeLogicalFilter),\n 'Not': makeChildAppender(writeNotFilter),\n 'BBOX': makeChildAppender(writeBboxFilter),\n 'Contains': makeChildAppender(writeSpatialFilter),\n 'Disjoint': makeChildAppender(writeSpatialFilter),\n 'Intersects': makeChildAppender(writeSpatialFilter),\n 'ResourceId': makeChildAppender(writeResourceIdFilter),\n 'Within': makeChildAppender(writeSpatialFilter),\n 'DWithin': makeChildAppender(writeDWithinFilter),\n 'PropertyIsEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsNotEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsLessThan': makeChildAppender(writeComparisonFilter),\n 'PropertyIsLessThanOrEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsGreaterThan': makeChildAppender(writeComparisonFilter),\n 'PropertyIsGreaterThanOrEqualTo': makeChildAppender(writeComparisonFilter),\n 'PropertyIsNull': makeChildAppender(writeIsNullFilter),\n 'PropertyIsBetween': makeChildAppender(writeIsBetweenFilter),\n 'PropertyIsLike': makeChildAppender(writeIsLikeFilter),\n },\n};\n\n/**\n * @param {Element} node Node.\n * @param {string} featureType Feature type.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeQuery(node, featureType, objectStack) {\n const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const version = context['version'];\n const featurePrefix = context['featurePrefix'];\n const featureNS = context['featureNS'];\n const propertyNames = context['propertyNames'];\n const srsName = context['srsName'];\n let typeName;\n // If feature prefix is not defined, we must not use the default prefix.\n if (featurePrefix) {\n typeName = getTypeName(featurePrefix, featureType);\n } else {\n typeName = featureType;\n }\n let typeNameAttr;\n if (version === '2.0.0') {\n typeNameAttr = 'typeNames';\n } else {\n typeNameAttr = 'typeName';\n }\n node.setAttribute(typeNameAttr, typeName);\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n if (featureNS) {\n node.setAttributeNS(XMLNS, 'xmlns:' + featurePrefix, featureNS);\n }\n const item = /** @type {import(\"../xml.js\").NodeStackItem} */ (\n Object.assign({}, context)\n );\n item.node = node;\n pushSerializeAndPop(\n item,\n QUERY_SERIALIZERS,\n makeSimpleNodeFactory('PropertyName'),\n propertyNames,\n objectStack,\n );\n const filter = context['filter'];\n if (filter) {\n const child = createElementNS(getFilterNS(version), 'Filter');\n node.appendChild(child);\n writeFilterCondition(child, filter, objectStack);\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"./filter/Filter.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeFilterCondition(node, filter, objectStack) {\n const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const item = {node};\n Object.assign(item, {context});\n pushSerializeAndPop(\n item,\n GETFEATURE_SERIALIZERS,\n makeSimpleNodeFactory(filter.getTagName()),\n [filter],\n objectStack,\n );\n}\n\n/**\n * @param {Node} node Node.\n * @param {import(\"./filter/Bbox.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeBboxFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n parent['srsName'] = filter.srsName;\n const format = GML_FORMATS[version];\n\n writePropertyName(version, node, filter.geometryName);\n format.prototype.writeGeometryElement(node, filter.extent, objectStack);\n}\n\n/**\n * @param {Element} node Element.\n * @param {import(\"./filter/ResourceId.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeResourceIdFilter(node, filter, objectStack) {\n node.setAttribute('rid', /** @type {string} */ (filter.rid));\n}\n\n/**\n * @param {Node} node Node.\n * @param {import(\"./filter/Spatial.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeSpatialFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n parent['srsName'] = filter.srsName;\n const format = GML_FORMATS[version];\n\n writePropertyName(version, node, filter.geometryName);\n format.prototype.writeGeometryElement(node, filter.geometry, objectStack);\n}\n\n/**\n * @param {Node} node Node.\n * @param {import(\"./filter/DWithin.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeDWithinFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n writeSpatialFilter(node, filter, objectStack);\n const distance = createElementNS(getFilterNS(version), 'Distance');\n writeStringTextNode(distance, filter.distance.toString());\n if (version === '2.0.0') {\n distance.setAttribute('uom', filter.unit);\n } else {\n distance.setAttribute('units', filter.unit);\n }\n node.appendChild(distance);\n}\n\n/**\n * @param {Node} node Node.\n * @param {import(\"./filter/During.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeDuringFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n\n writeExpression(FESNS[version], 'ValueReference', node, filter.propertyName);\n const timePeriod = createElementNS(GMLNS, 'TimePeriod');\n\n node.appendChild(timePeriod);\n\n const begin = createElementNS(GMLNS, 'begin');\n timePeriod.appendChild(begin);\n writeTimeInstant(begin, filter.begin);\n\n const end = createElementNS(GMLNS, 'end');\n timePeriod.appendChild(end);\n writeTimeInstant(end, filter.end);\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"./filter/LogicalNary.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeLogicalFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const item = {node};\n Object.assign(item, {context});\n const conditions = filter.conditions;\n for (let i = 0, ii = conditions.length; i < ii; ++i) {\n const condition = conditions[i];\n pushSerializeAndPop(\n item,\n GETFEATURE_SERIALIZERS,\n makeSimpleNodeFactory(condition.getTagName()),\n [condition],\n objectStack,\n );\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"./filter/Not.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeNotFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const item = {node};\n Object.assign(item, {context});\n const condition = filter.condition;\n pushSerializeAndPop(\n item,\n GETFEATURE_SERIALIZERS,\n makeSimpleNodeFactory(condition.getTagName()),\n [condition],\n objectStack,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"./filter/ComparisonBinary.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeComparisonFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n if (filter.matchCase !== undefined) {\n node.setAttribute('matchCase', filter.matchCase.toString());\n }\n writePropertyName(version, node, filter.propertyName);\n writeLiteral(version, node, '' + filter.expression);\n}\n\n/**\n * @param {Node} node Node.\n * @param {import(\"./filter/IsNull.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeIsNullFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n writePropertyName(version, node, filter.propertyName);\n}\n\n/**\n * @param {Node} node Node.\n * @param {import(\"./filter/IsBetween.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeIsBetweenFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n const ns = getFilterNS(version);\n\n writePropertyName(version, node, filter.propertyName);\n\n const lowerBoundary = createElementNS(ns, 'LowerBoundary');\n node.appendChild(lowerBoundary);\n writeLiteral(version, lowerBoundary, '' + filter.lowerBoundary);\n\n const upperBoundary = createElementNS(ns, 'UpperBoundary');\n node.appendChild(upperBoundary);\n writeLiteral(version, upperBoundary, '' + filter.upperBoundary);\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"./filter/IsLike.js\").default} filter Filter.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeIsLikeFilter(node, filter, objectStack) {\n const parent = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const context = parent['context'];\n const version = context['version'];\n node.setAttribute('wildCard', filter.wildCard);\n node.setAttribute('singleChar', filter.singleChar);\n node.setAttribute('escapeChar', filter.escapeChar);\n if (filter.matchCase !== undefined) {\n node.setAttribute('matchCase', filter.matchCase.toString());\n }\n writePropertyName(version, node, filter.propertyName);\n writeLiteral(version, node, '' + filter.pattern);\n}\n\n/**\n * @param {string} ns Namespace.\n * @param {string} tagName Tag name.\n * @param {Node} node Node.\n * @param {string} value Value.\n */\nfunction writeExpression(ns, tagName, node, value) {\n const property = createElementNS(ns, tagName);\n writeStringTextNode(property, value);\n node.appendChild(property);\n}\n\n/**\n * @param {string} version Version.\n * @param {Node} node Node.\n * @param {string} value PropertyName value.\n */\nfunction writeLiteral(version, node, value) {\n writeExpression(getFilterNS(version), 'Literal', node, value);\n}\n\n/**\n * @param {string} version Version.\n * @param {Node} node Node.\n * @param {string} value PropertyName value.\n */\nfunction writePropertyName(version, node, value) {\n if (version === '2.0.0') {\n writeExpression(FESNS[version], 'ValueReference', node, value);\n } else {\n writeExpression(OGCNS[version], 'PropertyName', node, value);\n }\n}\n\n/**\n * @param {Node} node Node.\n * @param {string} time PropertyName value.\n */\nfunction writeTimeInstant(node, time) {\n const timeInstant = createElementNS(GMLNS, 'TimeInstant');\n node.appendChild(timeInstant);\n\n const timePosition = createElementNS(GMLNS, 'timePosition');\n timeInstant.appendChild(timePosition);\n writeStringTextNode(timePosition, time);\n}\n\n/**\n * Encode filter as WFS `Filter` and return the Node.\n *\n * @param {import(\"./filter/Filter.js\").default} filter Filter.\n * @param {string} version WFS version. If not provided defaults to '1.1.0'\n * @return {Node} Result.\n * @api\n */\nexport function writeFilter(filter, version) {\n version = version || '1.1.0';\n const child = createElementNS(getFilterNS(version), 'Filter');\n const context = {\n node: child,\n };\n Object.assign(context, {\n 'version': version,\n 'filter': filter,\n });\n writeFilterCondition(child, filter, [context]);\n return child;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<string>} featureTypes Feature types.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeGetFeature(node, featureTypes, objectStack) {\n const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const item = /** @type {import(\"../xml.js\").NodeStackItem} */ (\n Object.assign({}, context)\n );\n item.node = node;\n pushSerializeAndPop(\n item,\n GETFEATURE_SERIALIZERS,\n makeSimpleNodeFactory('Query'),\n featureTypes,\n objectStack,\n );\n}\n\nfunction getFilterNS(version) {\n let ns;\n if (version === '2.0.0') {\n ns = FESNS[version];\n } else {\n ns = OGCNS[version];\n }\n return ns;\n}\n\nexport default WFS;\n","/**\n * @module ol/format/WKB\n */\nimport Feature from '../Feature.js';\nimport GeometryCollection from '../geom/GeometryCollection.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport SimpleGeometry from '../geom/SimpleGeometry.js';\nimport {get as getProjection} from '../proj.js';\n\nimport FeatureFormat, {transformGeometryWithOptions} from './Feature.js';\n\n// WKB spec: https://www.ogc.org/standards/sfa\n// EWKB spec: https://raw.githubusercontent.com/postgis/postgis/2.1.0/doc/ZMSgeoms.txt\n\n/**\n * @const\n * @enum {number}\n */\nconst WKBGeometryType = {\n POINT: 1,\n LINE_STRING: 2,\n POLYGON: 3,\n MULTI_POINT: 4,\n MULTI_LINE_STRING: 5,\n MULTI_POLYGON: 6,\n GEOMETRY_COLLECTION: 7,\n\n /*\n CIRCULAR_STRING: 8,\n COMPOUND_CURVE: 9,\n CURVE_POLYGON: 10,\n\n MULTI_CURVE: 11,\n MULTI_SURFACE: 12,\n CURVE: 13,\n SURFACE: 14,\n */\n\n POLYHEDRAL_SURFACE: 15,\n TIN: 16,\n TRIANGLE: 17,\n};\n\nclass WkbReader {\n /**\n * @param {DataView} view source to read\n */\n constructor(view) {\n /** @private */\n this.view_ = view;\n\n /**\n * @type {number}\n * @private\n */\n this.pos_ = 0;\n\n /**\n * @type {boolean}\n * @private\n */\n this.initialized_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.isLittleEndian_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasZ_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.hasM_ = false;\n\n /**\n * @type {number|null}\n * @private\n */\n this.srid_ = null;\n\n /**\n * @type {import(\"../geom/Geometry.js\").GeometryLayout}\n * @private\n */\n this.layout_ = 'XY';\n }\n\n /**\n * @return {number} value\n */\n readUint8() {\n return this.view_.getUint8(this.pos_++);\n }\n\n /**\n * @param {boolean} [isLittleEndian] Whether read value as little endian\n * @return {number} value\n */\n readUint32(isLittleEndian) {\n return this.view_.getUint32(\n (this.pos_ += 4) - 4,\n isLittleEndian !== undefined ? isLittleEndian : this.isLittleEndian_,\n );\n }\n\n /**\n * @param {boolean} [isLittleEndian] Whether read value as little endian\n * @return {number} value\n */\n readDouble(isLittleEndian) {\n return this.view_.getFloat64(\n (this.pos_ += 8) - 8,\n isLittleEndian !== undefined ? isLittleEndian : this.isLittleEndian_,\n );\n }\n\n /**\n * @return {import('../coordinate.js').Coordinate} coords for Point\n */\n readPoint() {\n /** @type {import('../coordinate.js').Coordinate} */\n const coords = [];\n\n coords.push(this.readDouble());\n coords.push(this.readDouble());\n if (this.hasZ_) {\n coords.push(this.readDouble());\n }\n if (this.hasM_) {\n coords.push(this.readDouble());\n }\n\n return coords;\n }\n\n /**\n * @return {Array<import('../coordinate.js').Coordinate>} coords for LineString / LinearRing\n */\n readLineString() {\n const numPoints = this.readUint32();\n\n /** @type {Array<import('../coordinate.js').Coordinate>} */\n const coords = [];\n for (let i = 0; i < numPoints; i++) {\n coords.push(this.readPoint());\n }\n\n return coords;\n }\n\n /**\n * @return {Array<Array<import('../coordinate.js').Coordinate>>} coords for Polygon like\n */\n readPolygon() {\n const numRings = this.readUint32();\n\n /** @type {Array<Array<import('../coordinate.js').Coordinate>>} */\n const rings = [];\n for (let i = 0; i < numRings; i++) {\n rings.push(this.readLineString()); // as a LinearRing\n }\n\n return rings;\n }\n\n /**\n * @param {number} [expectedTypeId] Expected WKB Type ID\n * @return {number} WKB Type ID\n */\n readWkbHeader(expectedTypeId) {\n const byteOrder = this.readUint8();\n const isLittleEndian = byteOrder > 0;\n\n const wkbType = this.readUint32(isLittleEndian);\n const wkbTypeThousandth = Math.floor((wkbType & 0x0fffffff) / 1000);\n const hasZ =\n Boolean(wkbType & 0x80000000) ||\n wkbTypeThousandth === 1 ||\n wkbTypeThousandth === 3;\n const hasM =\n Boolean(wkbType & 0x40000000) ||\n wkbTypeThousandth === 2 ||\n wkbTypeThousandth === 3;\n const hasSRID = Boolean(wkbType & 0x20000000);\n const typeId = (wkbType & 0x0fffffff) % 1000; // Assume 1000 is an upper limit for type ID\n const layout = /** @type {import(\"../geom/Geometry.js\").GeometryLayout} */ (\n ['XY', hasZ ? 'Z' : '', hasM ? 'M' : ''].join('')\n );\n\n const srid = hasSRID ? this.readUint32(isLittleEndian) : null;\n\n if (expectedTypeId !== undefined && expectedTypeId !== typeId) {\n throw new Error('Unexpected WKB geometry type ' + typeId);\n }\n\n if (this.initialized_) {\n // sanity checks\n if (this.isLittleEndian_ !== isLittleEndian) {\n throw new Error('Inconsistent endian');\n }\n if (this.layout_ !== layout) {\n throw new Error('Inconsistent geometry layout');\n }\n if (srid && this.srid_ !== srid) {\n throw new Error('Inconsistent coordinate system (SRID)');\n }\n } else {\n this.isLittleEndian_ = isLittleEndian;\n this.hasZ_ = hasZ;\n this.hasM_ = hasM;\n this.layout_ = layout;\n this.srid_ = srid;\n this.initialized_ = true;\n }\n\n return typeId;\n }\n\n /**\n * @param {number} typeId WKB Type ID\n * @return {any} values read\n */\n readWkbPayload(typeId) {\n switch (typeId) {\n case WKBGeometryType.POINT:\n return this.readPoint();\n\n case WKBGeometryType.LINE_STRING:\n return this.readLineString();\n\n case WKBGeometryType.POLYGON:\n case WKBGeometryType.TRIANGLE:\n return this.readPolygon();\n\n case WKBGeometryType.MULTI_POINT:\n return this.readMultiPoint();\n\n case WKBGeometryType.MULTI_LINE_STRING:\n return this.readMultiLineString();\n\n case WKBGeometryType.MULTI_POLYGON:\n case WKBGeometryType.POLYHEDRAL_SURFACE:\n case WKBGeometryType.TIN:\n return this.readMultiPolygon();\n\n case WKBGeometryType.GEOMETRY_COLLECTION:\n return this.readGeometryCollection();\n\n default:\n throw new Error(\n 'Unsupported WKB geometry type ' + typeId + ' is found',\n );\n }\n }\n\n /**\n * @param {number} expectedTypeId Expected WKB Type ID\n * @return {any} values read\n */\n readWkbBlock(expectedTypeId) {\n return this.readWkbPayload(this.readWkbHeader(expectedTypeId));\n }\n\n /**\n * @param {Function} reader reader function for each item\n * @param {number} [expectedTypeId] Expected WKB Type ID\n * @return {any} values read\n */\n readWkbCollection(reader, expectedTypeId) {\n const num = this.readUint32();\n\n const items = [];\n for (let i = 0; i < num; i++) {\n const result = reader.call(this, expectedTypeId);\n if (result) {\n items.push(result);\n }\n }\n\n return items;\n }\n\n /**\n * @return {Array<import('../coordinate.js').Coordinate>} coords for MultiPoint\n */\n readMultiPoint() {\n return this.readWkbCollection(this.readWkbBlock, WKBGeometryType.POINT);\n }\n\n /**\n * @return {Array<Array<import('../coordinate.js').Coordinate>>} coords for MultiLineString like\n */\n readMultiLineString() {\n return this.readWkbCollection(\n this.readWkbBlock,\n WKBGeometryType.LINE_STRING,\n );\n }\n\n /**\n * @return {Array<Array<Array<import('../coordinate.js').Coordinate>>>} coords for MultiPolygon like\n */\n readMultiPolygon() {\n return this.readWkbCollection(this.readWkbBlock, WKBGeometryType.POLYGON);\n }\n\n /**\n * @return {Array<import('../geom/Geometry.js').default>} array of geometries\n */\n readGeometryCollection() {\n return this.readWkbCollection(this.readGeometry);\n }\n\n /**\n * @return {import('../geom/Geometry.js').default} geometry\n */\n readGeometry() {\n const typeId = this.readWkbHeader();\n const result = this.readWkbPayload(typeId);\n\n switch (typeId) {\n case WKBGeometryType.POINT:\n return new Point(\n /** @type {import('../coordinate.js').Coordinate} */ (result),\n this.layout_,\n );\n\n case WKBGeometryType.LINE_STRING:\n return new LineString(\n /** @type {Array<import('../coordinate.js').Coordinate>} */ (result),\n this.layout_,\n );\n\n case WKBGeometryType.POLYGON:\n case WKBGeometryType.TRIANGLE:\n return new Polygon(\n /** @type {Array<Array<import('../coordinate.js').Coordinate>>} */ (\n result\n ),\n this.layout_,\n );\n\n case WKBGeometryType.MULTI_POINT:\n return new MultiPoint(\n /** @type {Array<import('../coordinate.js').Coordinate>} */ (result),\n this.layout_,\n );\n\n case WKBGeometryType.MULTI_LINE_STRING:\n return new MultiLineString(\n /** @type {Array<Array<import('../coordinate.js').Coordinate>>} */ (\n result\n ),\n this.layout_,\n );\n\n case WKBGeometryType.MULTI_POLYGON:\n case WKBGeometryType.POLYHEDRAL_SURFACE:\n case WKBGeometryType.TIN:\n return new MultiPolygon(\n /** @type {Array<Array<Array<import('../coordinate.js').Coordinate>>>} */ (\n result\n ),\n this.layout_,\n );\n\n case WKBGeometryType.GEOMETRY_COLLECTION:\n return new GeometryCollection(\n /** @type {Array<import('../geom/Geometry.js').default>} */ (result),\n );\n\n default:\n return null;\n }\n }\n\n /**\n * @return {number|null} SRID in the EWKB. `null` if not defined.\n */\n getSrid() {\n return this.srid_;\n }\n}\n\nclass WkbWriter {\n /**\n * @type {Object}\n * @property {string} [layout] geometryLayout\n * @property {boolean} [littleEndian=true] littleEndian\n * @property {boolean} [ewkb=true] Whether writes in EWKB format\n * @property {Object} [nodata] NoData value for each axes\n * @param {Object} opts options\n */\n constructor(opts) {\n opts = opts || {};\n\n /** @type {string} */\n this.layout_ = opts.layout;\n this.isLittleEndian_ = opts.littleEndian !== false;\n\n this.isEWKB_ = opts.ewkb !== false;\n\n /** @type {Array<Array<number>>} */\n this.writeQueue_ = [];\n\n /**\n * @type {Object}\n * @property {number} X NoData value for X\n * @property {number} Y NoData value for Y\n * @property {number} Z NoData value for Z\n * @property {number} M NoData value for M\n */\n this.nodata_ = Object.assign({X: 0, Y: 0, Z: 0, M: 0}, opts.nodata);\n }\n\n /**\n * @param {number} value value\n */\n writeUint8(value) {\n this.writeQueue_.push([1, value]);\n }\n\n /**\n * @param {number} value value\n */\n writeUint32(value) {\n this.writeQueue_.push([4, value]);\n }\n\n /**\n * @param {number} value value\n */\n writeDouble(value) {\n this.writeQueue_.push([8, value]);\n }\n\n /**\n * @param {import('../coordinate.js').Coordinate} coords coords\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout layout\n */\n writePoint(coords, layout) {\n /**\n * @type {Object}\n * @property {number} X NoData value for X\n * @property {number} Y NoData value for Y\n * @property {number} [Z] NoData value for Z\n * @property {number} [M] NoData value for M\n */\n const coordsObj = Object.assign.apply(\n null,\n layout.split('').map((axis, idx) => ({[axis]: coords[idx]})),\n );\n\n for (const axis of this.layout_) {\n this.writeDouble(\n axis in coordsObj ? coordsObj[axis] : this.nodata_[axis],\n );\n }\n }\n\n /**\n * @param {Array<import('../coordinate.js').Coordinate>} coords coords\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout layout\n */\n writeLineString(coords, layout) {\n this.writeUint32(coords.length); // numPoints\n for (let i = 0; i < coords.length; i++) {\n this.writePoint(coords[i], layout);\n }\n }\n\n /**\n * @param {Array<Array<import('../coordinate.js').Coordinate>>} rings rings\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout layout\n */\n writePolygon(rings, layout) {\n this.writeUint32(rings.length); // numRings\n for (let i = 0; i < rings.length; i++) {\n this.writeLineString(rings[i], layout); // as a LinearRing\n }\n }\n\n /**\n * @param {number} wkbType WKB Type ID\n * @param {number} [srid] SRID\n */\n writeWkbHeader(wkbType, srid) {\n wkbType %= 1000; // Assume 1000 is an upper limit for type ID\n if (this.layout_.includes('Z')) {\n wkbType += this.isEWKB_ ? 0x80000000 : 1000;\n }\n if (this.layout_.includes('M')) {\n wkbType += this.isEWKB_ ? 0x40000000 : 2000;\n }\n if (this.isEWKB_ && Number.isInteger(srid)) {\n wkbType |= 0x20000000;\n }\n\n this.writeUint8(this.isLittleEndian_ ? 1 : 0);\n this.writeUint32(wkbType);\n if (this.isEWKB_ && Number.isInteger(srid)) {\n this.writeUint32(srid);\n }\n }\n\n /**\n * @param {Array<import('../coordinate.js').Coordinate>} coords coords\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout layout\n */\n writeMultiPoint(coords, layout) {\n this.writeUint32(coords.length); // numItems\n for (let i = 0; i < coords.length; i++) {\n this.writeWkbHeader(1);\n this.writePoint(coords[i], layout);\n }\n }\n\n /**\n * @param {Array<Array<import('../coordinate.js').Coordinate>>} coords coords\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout layout\n */\n writeMultiLineString(coords, layout) {\n this.writeUint32(coords.length); // numItems\n for (let i = 0; i < coords.length; i++) {\n this.writeWkbHeader(2);\n this.writeLineString(coords[i], layout);\n }\n }\n\n /**\n * @param {Array<Array<Array<import('../coordinate.js').Coordinate>>>} coords coords\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout layout\n */\n writeMultiPolygon(coords, layout) {\n this.writeUint32(coords.length); // numItems\n for (let i = 0; i < coords.length; i++) {\n this.writeWkbHeader(3);\n this.writePolygon(coords[i], layout);\n }\n }\n\n /**\n * @param {Array<import('../geom/Geometry.js').default>} geometries geometries\n */\n writeGeometryCollection(geometries) {\n this.writeUint32(geometries.length); // numItems\n\n for (let i = 0; i < geometries.length; i++) {\n this.writeGeometry(geometries[i]);\n }\n }\n\n /**\n * @param {import(\"../geom/Geometry.js\").default} geom geometry\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} [layout] layout\n * @return {import(\"../geom/Geometry.js\").GeometryLayout} minimum layout made by common axes\n */\n findMinimumLayout(geom, layout = 'XYZM') {\n /**\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} a A\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} b B\n * @return {import(\"../geom/Geometry.js\").GeometryLayout} minimum layout made by common axes\n */\n const GeometryLayout_min = (a, b) => {\n if (a === b) {\n return a;\n }\n\n if (a === 'XYZM') {\n // anything `b` is minimum\n return b;\n }\n if (b === 'XYZM') {\n // anything `a` is minimum\n return a;\n }\n\n // otherwise, incompatible\n return 'XY';\n };\n\n if (geom instanceof SimpleGeometry) {\n return GeometryLayout_min(geom.getLayout(), layout);\n }\n\n if (geom instanceof GeometryCollection) {\n const geoms = geom.getGeometriesArray();\n for (let i = 0; i < geoms.length && layout !== 'XY'; i++) {\n layout = this.findMinimumLayout(geoms[i], layout);\n }\n }\n\n return layout;\n }\n\n /**\n * @param {import(\"../geom/Geometry.js\").default} geom geometry\n * @param {number} [srid] SRID\n */\n writeGeometry(geom, srid) {\n /**\n * @type {Object<import(\"../geom/Geometry.js\").Type, WKBGeometryType>}\n */\n const wkblut = {\n Point: WKBGeometryType.POINT,\n LineString: WKBGeometryType.LINE_STRING,\n Polygon: WKBGeometryType.POLYGON,\n MultiPoint: WKBGeometryType.MULTI_POINT,\n MultiLineString: WKBGeometryType.MULTI_LINE_STRING,\n MultiPolygon: WKBGeometryType.MULTI_POLYGON,\n GeometryCollection: WKBGeometryType.GEOMETRY_COLLECTION,\n };\n const geomType = geom.getType();\n const typeId = wkblut[geomType];\n\n if (!typeId) {\n throw new Error('GeometryType ' + geomType + ' is not supported');\n }\n\n // first call of writeGeometry() traverse whole geometries to determine its output layout if not specified on constructor.\n if (!this.layout_) {\n this.layout_ = this.findMinimumLayout(geom);\n }\n\n this.writeWkbHeader(typeId, srid);\n\n if (geom instanceof SimpleGeometry) {\n const writerLUT = {\n Point: this.writePoint,\n LineString: this.writeLineString,\n Polygon: this.writePolygon,\n MultiPoint: this.writeMultiPoint,\n MultiLineString: this.writeMultiLineString,\n MultiPolygon: this.writeMultiPolygon,\n };\n writerLUT[geomType].call(this, geom.getCoordinates(), geom.getLayout());\n } else if (geom instanceof GeometryCollection) {\n this.writeGeometryCollection(geom.getGeometriesArray());\n }\n }\n\n getBuffer() {\n const byteLength = this.writeQueue_.reduce((acc, item) => acc + item[0], 0);\n const buffer = new ArrayBuffer(byteLength);\n const view = new DataView(buffer);\n\n let pos = 0;\n this.writeQueue_.forEach((item) => {\n switch (item[0]) {\n case 1:\n view.setUint8(pos, item[1]);\n break;\n case 4:\n view.setUint32(pos, item[1], this.isLittleEndian_);\n break;\n case 8:\n view.setFloat64(pos, item[1], this.isLittleEndian_);\n break;\n default:\n break;\n }\n\n pos += item[0];\n });\n\n return buffer;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [splitCollection=false] Whether to split GeometryCollections into multiple features on reading.\n * @property {boolean} [hex=true] Returns hex string instead of ArrayBuffer for output. This also is used as a hint internally whether it should load contents as text or ArrayBuffer on reading.\n * @property {boolean} [littleEndian=true] Use littleEndian for output.\n * @property {boolean} [ewkb=true] Use EWKB format for output.\n * @property {import(\"../geom/Geometry.js\").GeometryLayout} [geometryLayout=null] Use specific coordinate layout for output features (null: auto detect)\n * @property {number} [nodataZ=0] If the `geometryLayout` doesn't match with geometry to be output, this value is used to fill missing coordinate value of Z.\n * @property {number} [nodataM=0] If the `geometryLayout` doesn't match with geometry to be output, this value is used to fill missing coordinate value of M.\n * @property {number|boolean} [srid=true] SRID for output. Specify integer value to enforce the value as a SRID. Specify `true` to extract from `dataProjection`. `false` to suppress the output. This option only takes effect when `ewkb` is `true`.\n */\n\n/**\n * @classdesc\n * Geometry format for reading and writing data in the `Well-Known Binary` (WKB) format.\n * Also supports `Extended Well-Known Binary` (EWKB) format, used in PostGIS for example.\n *\n * @api\n */\nclass WKB extends FeatureFormat {\n /**\n * @param {Options} [options] Optional configuration object.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n this.splitCollection = Boolean(options.splitCollection);\n\n this.viewCache_ = null;\n\n this.hex_ = options.hex !== false;\n this.littleEndian_ = options.littleEndian !== false;\n this.ewkb_ = options.ewkb !== false;\n\n this.layout_ = options.geometryLayout; // null for auto detect\n this.nodataZ_ = options.nodataZ || 0;\n this.nodataM_ = options.nodataM || 0;\n\n this.srid_ = options.srid;\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n * @override\n */\n getType() {\n return this.hex_ ? 'text' : 'arraybuffer';\n }\n\n /**\n * Read a single feature from a source.\n *\n * @param {string|ArrayBuffer|ArrayBufferView} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @api\n * @override\n */\n readFeature(source, options) {\n return new Feature({\n geometry: this.readGeometry(source, options),\n });\n }\n\n /**\n * Read all features from a source.\n *\n * @param {string|ArrayBuffer|ArrayBufferView} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @api\n * @override\n */\n readFeatures(source, options) {\n let geometries = [];\n const geometry = this.readGeometry(source, options);\n if (this.splitCollection && geometry instanceof GeometryCollection) {\n geometries = geometry.getGeometriesArray();\n } else {\n geometries = [geometry];\n }\n return geometries.map((geometry) => new Feature({geometry}));\n }\n\n /**\n * Read a single geometry from a source.\n *\n * @param {string|ArrayBuffer|ArrayBufferView} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @api\n * @override\n */\n readGeometry(source, options) {\n const view = getDataView(source);\n if (!view) {\n return null;\n }\n\n const reader = new WkbReader(view);\n const geometry = reader.readGeometry();\n\n this.viewCache_ = view; // cache for internal subsequent call of readProjection()\n options = this.getReadOptions(source, options);\n this.viewCache_ = null; // release\n\n return transformGeometryWithOptions(geometry, false, options);\n }\n\n /**\n * Read the projection from a source.\n *\n * @param {string|ArrayBuffer|ArrayBufferView} source Source.\n * @return {import(\"../proj/Projection.js\").default|undefined} Projection.\n * @api\n * @override\n */\n readProjection(source) {\n const view = this.viewCache_ || getDataView(source);\n if (!view) {\n return undefined;\n }\n\n const reader = new WkbReader(view);\n reader.readWkbHeader();\n\n return (\n (reader.getSrid() && getProjection('EPSG:' + reader.getSrid())) ||\n undefined\n );\n }\n\n /**\n * Encode a feature in this format.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n * @api\n * @override\n */\n writeFeature(feature, options) {\n return this.writeGeometry(feature.getGeometry(), options);\n }\n\n /**\n * Encode an array of features in this format.\n *\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n * @api\n * @override\n */\n writeFeatures(features, options) {\n return this.writeGeometry(\n new GeometryCollection(features.map((f) => f.getGeometry())),\n options,\n );\n }\n\n /**\n * Write a single geometry in this format.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n * @api\n * @override\n */\n writeGeometry(geometry, options) {\n options = this.adaptOptions(options);\n\n const writer = new WkbWriter({\n layout: this.layout_,\n littleEndian: this.littleEndian_,\n ewkb: this.ewkb_,\n\n nodata: {\n Z: this.nodataZ_,\n M: this.nodataM_,\n },\n });\n\n // extract SRID from `dataProjection`\n let srid = Number.isInteger(this.srid_) ? Number(this.srid_) : null;\n if (this.srid_ !== false && !Number.isInteger(this.srid_)) {\n const dataProjection =\n options.dataProjection && getProjection(options.dataProjection);\n if (dataProjection) {\n const code = dataProjection.getCode();\n if (code.startsWith('EPSG:')) {\n srid = Number(code.substring(5));\n }\n }\n }\n\n writer.writeGeometry(\n transformGeometryWithOptions(geometry, true, options),\n srid,\n );\n const buffer = writer.getBuffer();\n\n return this.hex_ ? encodeHexString(buffer) : buffer;\n }\n}\n\n/**\n * @param {ArrayBuffer} buffer source buffer\n * @return {string} encoded hex string\n */\nfunction encodeHexString(buffer) {\n const view = new Uint8Array(buffer);\n return Array.from(view.values())\n .map((x) => (x < 16 ? '0' : '') + Number(x).toString(16).toUpperCase())\n .join('');\n}\n\n/**\n * @param {string} text source text\n * @return {DataView} decoded binary buffer\n */\nfunction decodeHexString(text) {\n const buffer = new Uint8Array(text.length / 2);\n for (let i = 0; i < text.length / 2; i++) {\n buffer[i] = parseInt(text.substr(i * 2, 2), 16);\n }\n return new DataView(buffer.buffer);\n}\n\n/**\n * @param {string | ArrayBuffer | ArrayBufferView} source source\n * @return {DataView} data view\n */\nfunction getDataView(source) {\n if (typeof source === 'string') {\n return decodeHexString(source);\n }\n if (ArrayBuffer.isView(source)) {\n if (source instanceof DataView) {\n return source;\n }\n return new DataView(source.buffer, source.byteOffset, source.byteLength);\n }\n if (source instanceof ArrayBuffer) {\n return new DataView(source);\n }\n return null;\n}\n\nexport default WKB;\n","/**\n * @module ol/format/WKT\n */\nimport Feature from '../Feature.js';\nimport GeometryCollection from '../geom/GeometryCollection.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {transformGeometryWithOptions} from './Feature.js';\nimport TextFeature from './TextFeature.js';\n\n/**\n * Geometry constructors\n * @enum {function (new:import(\"../geom/Geometry.js\").default, Array, import(\"../geom/Geometry.js\").GeometryLayout)}\n */\nconst GeometryConstructor = {\n 'POINT': Point,\n 'LINESTRING': LineString,\n 'POLYGON': Polygon,\n 'MULTIPOINT': MultiPoint,\n 'MULTILINESTRING': MultiLineString,\n 'MULTIPOLYGON': MultiPolygon,\n};\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [splitCollection=false] Whether to split GeometryCollections into\n * multiple features on reading.\n */\n\n/**\n * @typedef {Object} Token\n * @property {number} type Type.\n * @property {number|string} [value] Value.\n * @property {number} position Position.\n */\n\n/**\n * @const\n * @type {string}\n */\nconst EMPTY = 'EMPTY';\n\n/**\n * @const\n * @type {string}\n */\nconst Z = 'Z';\n\n/**\n * @const\n * @type {string}\n */\nconst M = 'M';\n\n/**\n * @const\n * @type {string}\n */\nconst ZM = 'ZM';\n\n/**\n * @const\n * @enum {number}\n */\nconst TokenType = {\n START: 0,\n TEXT: 1,\n LEFT_PAREN: 2,\n RIGHT_PAREN: 3,\n NUMBER: 4,\n COMMA: 5,\n EOF: 6,\n};\n\n/**\n * @type {Object<import(\"../geom/Geometry.js\").Type, string>}\n */\nconst wktTypeLookup = {\n Point: 'POINT',\n LineString: 'LINESTRING',\n Polygon: 'POLYGON',\n MultiPoint: 'MULTIPOINT',\n MultiLineString: 'MULTILINESTRING',\n MultiPolygon: 'MULTIPOLYGON',\n GeometryCollection: 'GEOMETRYCOLLECTION',\n Circle: 'CIRCLE',\n};\n\n/**\n * Class to tokenize a WKT string.\n */\nclass Lexer {\n /**\n * @param {string} wkt WKT string.\n */\n constructor(wkt) {\n /**\n * @type {string}\n */\n this.wkt = wkt;\n\n /**\n * @type {number}\n * @private\n */\n this.index_ = -1;\n }\n\n /**\n * @param {string} c Character.\n * @return {boolean} Whether the character is alphabetic.\n * @private\n */\n isAlpha_(c) {\n return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');\n }\n\n /**\n * @param {string} c Character.\n * @param {boolean} [decimal] Whether the string number\n * contains a dot, i.e. is a decimal number.\n * @return {boolean} Whether the character is numeric.\n * @private\n */\n isNumeric_(c, decimal) {\n decimal = decimal !== undefined ? decimal : false;\n return (c >= '0' && c <= '9') || (c == '.' && !decimal);\n }\n\n /**\n * @param {string} c Character.\n * @return {boolean} Whether the character is whitespace.\n * @private\n */\n isWhiteSpace_(c) {\n return c == ' ' || c == '\\t' || c == '\\r' || c == '\\n';\n }\n\n /**\n * @return {string} Next string character.\n * @private\n */\n nextChar_() {\n return this.wkt.charAt(++this.index_);\n }\n\n /**\n * Fetch and return the next token.\n * @return {Token} Next string token.\n */\n nextToken() {\n const c = this.nextChar_();\n const position = this.index_;\n /** @type {number|string} */\n let value = c;\n let type;\n\n if (c == '(') {\n type = TokenType.LEFT_PAREN;\n } else if (c == ',') {\n type = TokenType.COMMA;\n } else if (c == ')') {\n type = TokenType.RIGHT_PAREN;\n } else if (this.isNumeric_(c) || c == '-') {\n type = TokenType.NUMBER;\n value = this.readNumber_();\n } else if (this.isAlpha_(c)) {\n type = TokenType.TEXT;\n value = this.readText_();\n } else if (this.isWhiteSpace_(c)) {\n return this.nextToken();\n } else if (c === '') {\n type = TokenType.EOF;\n } else {\n throw new Error('Unexpected character: ' + c);\n }\n\n return {position: position, value: value, type: type};\n }\n\n /**\n * @return {number} Numeric token value.\n * @private\n */\n readNumber_() {\n let c;\n const index = this.index_;\n let decimal = false;\n let scientificNotation = false;\n do {\n if (c == '.') {\n decimal = true;\n } else if (c == 'e' || c == 'E') {\n scientificNotation = true;\n }\n c = this.nextChar_();\n } while (\n this.isNumeric_(c, decimal) ||\n // if we haven't detected a scientific number before, 'e' or 'E'\n // hint that we should continue to read\n (!scientificNotation && (c == 'e' || c == 'E')) ||\n // once we know that we have a scientific number, both '-' and '+'\n // are allowed\n (scientificNotation && (c == '-' || c == '+'))\n );\n return parseFloat(this.wkt.substring(index, this.index_--));\n }\n\n /**\n * @return {string} String token value.\n * @private\n */\n readText_() {\n let c;\n const index = this.index_;\n do {\n c = this.nextChar_();\n } while (this.isAlpha_(c));\n return this.wkt.substring(index, this.index_--).toUpperCase();\n }\n}\n\n/**\n * Class to parse the tokens from the WKT string.\n */\nclass Parser {\n /**\n * @param {Lexer} lexer The lexer.\n */\n constructor(lexer) {\n /**\n * @type {Lexer}\n * @private\n */\n this.lexer_ = lexer;\n\n /**\n * @type {Token}\n * @private\n */\n this.token_ = {\n position: 0,\n type: TokenType.START,\n };\n\n /**\n * @type {import(\"../geom/Geometry.js\").GeometryLayout}\n * @private\n */\n this.layout_ = 'XY';\n }\n\n /**\n * Fetch the next token form the lexer and replace the active token.\n * @private\n */\n consume_() {\n this.token_ = this.lexer_.nextToken();\n }\n\n /**\n * Tests if the given type matches the type of the current token.\n * @param {TokenType} type Token type.\n * @return {boolean} Whether the token matches the given type.\n */\n isTokenType(type) {\n return this.token_.type == type;\n }\n\n /**\n * If the given type matches the current token, consume it.\n * @param {TokenType} type Token type.\n * @return {boolean} Whether the token matches the given type.\n */\n match(type) {\n const isMatch = this.isTokenType(type);\n if (isMatch) {\n this.consume_();\n }\n return isMatch;\n }\n\n /**\n * Try to parse the tokens provided by the lexer.\n * @return {import(\"../geom/Geometry.js\").default} The geometry.\n */\n parse() {\n this.consume_();\n return this.parseGeometry_();\n }\n\n /**\n * Try to parse the dimensional info.\n * @return {import(\"../geom/Geometry.js\").GeometryLayout} The layout.\n * @private\n */\n parseGeometryLayout_() {\n /** @type {import(\"../geom/Geometry.js\").GeometryLayout} */\n let layout = 'XY';\n const dimToken = this.token_;\n if (this.isTokenType(TokenType.TEXT)) {\n const dimInfo = dimToken.value;\n if (dimInfo === Z) {\n layout = 'XYZ';\n } else if (dimInfo === M) {\n layout = 'XYM';\n } else if (dimInfo === ZM) {\n layout = 'XYZM';\n }\n if (layout !== 'XY') {\n this.consume_();\n }\n }\n return layout;\n }\n\n /**\n * @return {Array<import(\"../geom/Geometry.js\").default>} A collection of geometries.\n * @private\n */\n parseGeometryCollectionText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const geometries = [];\n do {\n geometries.push(this.parseGeometry_());\n } while (this.match(TokenType.COMMA));\n if (this.match(TokenType.RIGHT_PAREN)) {\n return geometries;\n }\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<number>} All values in a point.\n * @private\n */\n parsePointText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePoint_();\n if (this.match(TokenType.RIGHT_PAREN)) {\n return coordinates;\n }\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<Array<number>>} All points in a linestring.\n * @private\n */\n parseLineStringText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePointList_();\n if (this.match(TokenType.RIGHT_PAREN)) {\n return coordinates;\n }\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<Array<Array<number>>>} All points in a polygon.\n * @private\n */\n parsePolygonText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parseLineStringTextList_();\n if (this.match(TokenType.RIGHT_PAREN)) {\n return coordinates;\n }\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<Array<number>>} All points in a multipoint.\n * @private\n */\n parseMultiPointText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n let coordinates;\n if (this.token_.type == TokenType.LEFT_PAREN) {\n coordinates = this.parsePointTextList_();\n } else {\n coordinates = this.parsePointList_();\n }\n if (this.match(TokenType.RIGHT_PAREN)) {\n return coordinates;\n }\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<Array<Array<number>>>} All linestring points\n * in a multilinestring.\n * @private\n */\n parseMultiLineStringText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parseLineStringTextList_();\n if (this.match(TokenType.RIGHT_PAREN)) {\n return coordinates;\n }\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<Array<Array<Array<number>>>>} All polygon points in a multipolygon.\n * @private\n */\n parseMultiPolygonText_() {\n if (this.match(TokenType.LEFT_PAREN)) {\n const coordinates = this.parsePolygonTextList_();\n if (this.match(TokenType.RIGHT_PAREN)) {\n return coordinates;\n }\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<number>} A point.\n * @private\n */\n parsePoint_() {\n const coordinates = [];\n const dimensions = this.layout_.length;\n for (let i = 0; i < dimensions; ++i) {\n const token = this.token_;\n if (this.match(TokenType.NUMBER)) {\n coordinates.push(/** @type {number} */ (token.value));\n } else {\n break;\n }\n }\n if (coordinates.length == dimensions) {\n return coordinates;\n }\n throw new Error(this.formatErrorMessage_());\n }\n\n /**\n * @return {Array<Array<number>>} An array of points.\n * @private\n */\n parsePointList_() {\n const coordinates = [this.parsePoint_()];\n while (this.match(TokenType.COMMA)) {\n coordinates.push(this.parsePoint_());\n }\n return coordinates;\n }\n\n /**\n * @return {Array<Array<number>>} An array of points.\n * @private\n */\n parsePointTextList_() {\n const coordinates = [this.parsePointText_()];\n while (this.match(TokenType.COMMA)) {\n coordinates.push(this.parsePointText_());\n }\n return coordinates;\n }\n\n /**\n * @return {Array<Array<Array<number>>>} An array of points.\n * @private\n */\n parseLineStringTextList_() {\n const coordinates = [this.parseLineStringText_()];\n while (this.match(TokenType.COMMA)) {\n coordinates.push(this.parseLineStringText_());\n }\n return coordinates;\n }\n\n /**\n * @return {Array<Array<Array<Array<number>>>>} An array of points.\n * @private\n */\n parsePolygonTextList_() {\n const coordinates = [this.parsePolygonText_()];\n while (this.match(TokenType.COMMA)) {\n coordinates.push(this.parsePolygonText_());\n }\n return coordinates;\n }\n\n /**\n * @return {boolean} Whether the token implies an empty geometry.\n * @private\n */\n isEmptyGeometry_() {\n const isEmpty =\n this.isTokenType(TokenType.TEXT) && this.token_.value == EMPTY;\n if (isEmpty) {\n this.consume_();\n }\n return isEmpty;\n }\n\n /**\n * Create an error message for an unexpected token error.\n * @return {string} Error message.\n * @private\n */\n formatErrorMessage_() {\n return (\n 'Unexpected `' +\n this.token_.value +\n '` at position ' +\n this.token_.position +\n ' in `' +\n this.lexer_.wkt +\n '`'\n );\n }\n\n /**\n * @return {import(\"../geom/Geometry.js\").default} The geometry.\n * @private\n */\n parseGeometry_() {\n const token = this.token_;\n if (this.match(TokenType.TEXT)) {\n const geomType = /** @type {string} */ (token.value);\n this.layout_ = this.parseGeometryLayout_();\n const isEmpty = this.isEmptyGeometry_();\n if (geomType == 'GEOMETRYCOLLECTION') {\n if (isEmpty) {\n return new GeometryCollection([]);\n }\n const geometries = this.parseGeometryCollectionText_();\n return new GeometryCollection(geometries);\n }\n const ctor = GeometryConstructor[geomType];\n if (!ctor) {\n throw new Error('Invalid geometry type: ' + geomType);\n }\n\n let coordinates;\n\n if (isEmpty) {\n if (geomType == 'POINT') {\n coordinates = [NaN, NaN];\n } else {\n coordinates = [];\n }\n } else {\n switch (geomType) {\n case 'POINT': {\n coordinates = this.parsePointText_();\n break;\n }\n case 'LINESTRING': {\n coordinates = this.parseLineStringText_();\n break;\n }\n case 'POLYGON': {\n coordinates = this.parsePolygonText_();\n break;\n }\n case 'MULTIPOINT': {\n coordinates = this.parseMultiPointText_();\n break;\n }\n case 'MULTILINESTRING': {\n coordinates = this.parseMultiLineStringText_();\n break;\n }\n case 'MULTIPOLYGON': {\n coordinates = this.parseMultiPolygonText_();\n break;\n }\n default:\n break;\n }\n }\n\n return new ctor(coordinates, this.layout_);\n }\n throw new Error(this.formatErrorMessage_());\n }\n}\n\n/**\n * @classdesc\n * Geometry format for reading and writing data in the `WellKnownText` (WKT)\n * format.\n *\n * @api\n */\nclass WKT extends TextFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * Split GeometryCollection into multiple features.\n * @type {boolean}\n * @private\n */\n this.splitCollection_ =\n options.splitCollection !== undefined ? options.splitCollection : false;\n }\n\n /**\n * Parse a WKT string.\n * @param {string} wkt WKT string.\n * @return {import(\"../geom/Geometry.js\").default}\n * The geometry created.\n * @private\n */\n parse_(wkt) {\n const lexer = new Lexer(wkt);\n const parser = new Parser(lexer);\n return parser.parse();\n }\n\n /**\n * @protected\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").default} Feature.\n * @override\n */\n readFeatureFromText(text, options) {\n const geom = this.readGeometryFromText(text, options);\n const feature = new Feature();\n feature.setGeometry(geom);\n return feature;\n }\n\n /**\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array<Feature>} Features.\n * @override\n */\n readFeaturesFromText(text, options) {\n let geometries = [];\n const geometry = this.readGeometryFromText(text, options);\n if (this.splitCollection_ && geometry.getType() == 'GeometryCollection') {\n geometries = /** @type {GeometryCollection} */ (\n geometry\n ).getGeometriesArray();\n } else {\n geometries = [geometry];\n }\n const features = [];\n for (let i = 0, ii = geometries.length; i < ii; ++i) {\n const feature = new Feature();\n feature.setGeometry(geometries[i]);\n features.push(feature);\n }\n return features;\n }\n\n /**\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @override\n */\n readGeometryFromText(text, options) {\n const geometry = this.parse_(text);\n return transformGeometryWithOptions(geometry, false, options);\n }\n\n /**\n * @param {import(\"../Feature.js\").default} feature Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n * @override\n */\n writeFeatureText(feature, options) {\n const geometry = feature.getGeometry();\n if (geometry) {\n return this.writeGeometryText(geometry, options);\n }\n return '';\n }\n\n /**\n * @param {Array<import(\"../Feature.js\").default>} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n * @override\n */\n writeFeaturesText(features, options) {\n if (features.length == 1) {\n return this.writeFeatureText(features[0], options);\n }\n const geometries = [];\n for (let i = 0, ii = features.length; i < ii; ++i) {\n geometries.push(features[i].getGeometry());\n }\n const collection = new GeometryCollection(geometries);\n return this.writeGeometryText(collection, options);\n }\n\n /**\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @protected\n * @return {string} Text.\n * @override\n */\n writeGeometryText(geometry, options) {\n return encode(transformGeometryWithOptions(geometry, true, options));\n }\n}\n\n/**\n * @param {Point} geom Point geometry.\n * @return {string} Coordinates part of Point as WKT.\n */\nfunction encodePointGeometry(geom) {\n const coordinates = geom.getCoordinates();\n if (coordinates.length === 0) {\n return '';\n }\n return coordinates.join(' ');\n}\n\n/**\n * @param {MultiPoint} geom MultiPoint geometry.\n * @return {string} Coordinates part of MultiPoint as WKT.\n */\nfunction encodeMultiPointGeometry(geom) {\n const array = [];\n const components = geom.getPoints();\n for (let i = 0, ii = components.length; i < ii; ++i) {\n array.push('(' + encodePointGeometry(components[i]) + ')');\n }\n return array.join(',');\n}\n\n/**\n * @param {GeometryCollection} geom GeometryCollection geometry.\n * @return {string} Coordinates part of GeometryCollection as WKT.\n */\nfunction encodeGeometryCollectionGeometry(geom) {\n const array = [];\n const geoms = geom.getGeometries();\n for (let i = 0, ii = geoms.length; i < ii; ++i) {\n array.push(encode(geoms[i]));\n }\n return array.join(',');\n}\n\n/**\n * @param {LineString|import(\"../geom/LinearRing.js\").default} geom LineString geometry.\n * @return {string} Coordinates part of LineString as WKT.\n */\nfunction encodeLineStringGeometry(geom) {\n const coordinates = geom.getCoordinates();\n const array = [];\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n array.push(coordinates[i].join(' '));\n }\n return array.join(',');\n}\n\n/**\n * @param {MultiLineString} geom MultiLineString geometry.\n * @return {string} Coordinates part of MultiLineString as WKT.\n */\nfunction encodeMultiLineStringGeometry(geom) {\n const array = [];\n const components = geom.getLineStrings();\n for (let i = 0, ii = components.length; i < ii; ++i) {\n array.push('(' + encodeLineStringGeometry(components[i]) + ')');\n }\n return array.join(',');\n}\n\n/**\n * @param {Polygon} geom Polygon geometry.\n * @return {string} Coordinates part of Polygon as WKT.\n */\nfunction encodePolygonGeometry(geom) {\n const array = [];\n const rings = geom.getLinearRings();\n for (let i = 0, ii = rings.length; i < ii; ++i) {\n array.push('(' + encodeLineStringGeometry(rings[i]) + ')');\n }\n return array.join(',');\n}\n\n/**\n * @param {MultiPolygon} geom MultiPolygon geometry.\n * @return {string} Coordinates part of MultiPolygon as WKT.\n */\nfunction encodeMultiPolygonGeometry(geom) {\n const array = [];\n const components = geom.getPolygons();\n for (let i = 0, ii = components.length; i < ii; ++i) {\n array.push('(' + encodePolygonGeometry(components[i]) + ')');\n }\n return array.join(',');\n}\n\n/**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geom SimpleGeometry geometry.\n * @return {string} Potential dimensional information for WKT type.\n */\nfunction encodeGeometryLayout(geom) {\n const layout = geom.getLayout();\n let dimInfo = '';\n if (layout === 'XYZ' || layout === 'XYZM') {\n dimInfo += Z;\n }\n if (layout === 'XYM' || layout === 'XYZM') {\n dimInfo += M;\n }\n return dimInfo;\n}\n\n/**\n * @const\n * @type {Object<string, function(import(\"../geom/Geometry.js\").default): string>}\n */\nconst GeometryEncoder = {\n 'Point': encodePointGeometry,\n 'LineString': encodeLineStringGeometry,\n 'Polygon': encodePolygonGeometry,\n 'MultiPoint': encodeMultiPointGeometry,\n 'MultiLineString': encodeMultiLineStringGeometry,\n 'MultiPolygon': encodeMultiPolygonGeometry,\n 'GeometryCollection': encodeGeometryCollectionGeometry,\n};\n\n/**\n * Encode a geometry as WKT.\n * @param {import(\"../geom/Geometry.js\").default} geom The geometry to encode.\n * @return {string} WKT string for the geometry.\n */\nfunction encode(geom) {\n const type = geom.getType();\n const geometryEncoder = GeometryEncoder[type];\n const enc = geometryEncoder(geom);\n let wktType = wktTypeLookup[type];\n if (typeof (/** @type {?} */ (geom).getFlatCoordinates) === 'function') {\n const dimInfo = encodeGeometryLayout(\n /** @type {import(\"../geom/SimpleGeometry.js\").default} */ (geom),\n );\n if (dimInfo.length > 0) {\n wktType += ' ' + dimInfo;\n }\n }\n if (enc.length === 0) {\n return wktType + ' ' + EMPTY;\n }\n return wktType + '(' + enc + ')';\n}\n\nexport default WKT;\n","/**\n * @module ol/format/WMSCapabilities\n */\nimport {compareVersions} from '../string.js';\nimport {\n makeArrayPusher,\n makeObjectPropertyPusher,\n makeObjectPropertySetter,\n makeStructureNS,\n pushParseAndPop,\n} from '../xml.js';\nimport XML from './XML.js';\nimport {readHref} from './xlink.js';\nimport {\n readBooleanString,\n readDecimal,\n readDecimalString,\n readNonNegativeIntegerString,\n readPositiveInteger,\n readString,\n} from './xsd.js';\n\n/**\n * @const\n * @type {Array<null|string>}\n */\nconst NAMESPACE_URIS = [\n null,\n 'http://www.opengis.net/wms',\n 'http://www.opengis.net/sld',\n];\n\nfunction isV13(objectStack) {\n return compareVersions(objectStack[0].version, '1.3') >= 0;\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Service': makeObjectPropertySetter(readService),\n 'Capability': makeObjectPropertySetter(readCapability),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CAPABILITY_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Request': makeObjectPropertySetter(readRequest),\n 'Exception': makeObjectPropertySetter(readException),\n 'Layer': makeObjectPropertySetter(readCapabilityLayer),\n 'UserDefinedSymbolization': makeObjectPropertySetter(\n readUserDefinedSymbolization,\n ),\n});\n\n/**\n * @typedef {Object} RootObject\n * @property {string} version Version\n * @property {boolean} v13 Whether version is 1.3 or higher\n */\n\n/**\n * @classdesc\n * Format for reading WMS capabilities data\n *\n * @api\n */\nclass WMSCapabilities extends XML {\n constructor() {\n super();\n\n /**\n * @type {string|undefined}\n */\n this.version = undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @return {Object|null} Object\n * @override\n */\n readFromNode(node) {\n this.version = node.getAttribute('version').trim();\n const wmsCapabilityObject = pushParseAndPop(\n {\n 'version': this.version,\n },\n PARSERS,\n node,\n [],\n );\n return wmsCapabilityObject ? wmsCapabilityObject : null;\n }\n}\n\nconst COMMON_SERVICE_PARSERS = {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'KeywordList': makeObjectPropertySetter(readKeywordList),\n 'OnlineResource': makeObjectPropertySetter(readHref),\n 'ContactInformation': makeObjectPropertySetter(readContactInformation),\n 'Fees': makeObjectPropertySetter(readString),\n 'AccessConstraints': makeObjectPropertySetter(readString),\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst SERVICE_PARSERS = makeStructureNS(NAMESPACE_URIS, COMMON_SERVICE_PARSERS);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst SERVICE_PARSERS_V13 = makeStructureNS(NAMESPACE_URIS, {\n ...COMMON_SERVICE_PARSERS,\n 'LayerLimit': makeObjectPropertySetter(readPositiveInteger),\n 'MaxWidth': makeObjectPropertySetter(readPositiveInteger),\n 'MaxHeight': makeObjectPropertySetter(readPositiveInteger),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CONTACT_INFORMATION_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ContactPersonPrimary': makeObjectPropertySetter(readContactPersonPrimary),\n 'ContactPosition': makeObjectPropertySetter(readString),\n 'ContactAddress': makeObjectPropertySetter(readContactAddress),\n 'ContactVoiceTelephone': makeObjectPropertySetter(readString),\n 'ContactFacsimileTelephone': makeObjectPropertySetter(readString),\n 'ContactElectronicMailAddress': makeObjectPropertySetter(readString),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CONTACT_PERSON_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ContactPerson': makeObjectPropertySetter(readString),\n 'ContactOrganization': makeObjectPropertySetter(readString),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CONTACT_ADDRESS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'AddressType': makeObjectPropertySetter(readString),\n 'Address': makeObjectPropertySetter(readString),\n 'City': makeObjectPropertySetter(readString),\n 'StateOrProvince': makeObjectPropertySetter(readString),\n 'PostCode': makeObjectPropertySetter(readString),\n 'Country': makeObjectPropertySetter(readString),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst EXCEPTION_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Format': makeArrayPusher(readString),\n});\n\nconst COMMON_LAYER_PARSERS = {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'KeywordList': makeObjectPropertySetter(readKeywordList),\n 'BoundingBox': makeObjectPropertyPusher(readBoundingBox),\n 'Dimension': makeObjectPropertyPusher(readDimension),\n 'Attribution': makeObjectPropertySetter(readAttribution),\n 'AuthorityURL': makeObjectPropertyPusher(readAuthorityURL),\n 'Identifier': makeObjectPropertyPusher(readString),\n 'MetadataURL': makeObjectPropertyPusher(readMetadataURL),\n 'DataURL': makeObjectPropertyPusher(readFormatOnlineresource),\n 'FeatureListURL': makeObjectPropertyPusher(readFormatOnlineresource),\n 'Style': makeObjectPropertyPusher(readStyle),\n 'Layer': makeObjectPropertyPusher(readLayer),\n};\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LAYER_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n ...COMMON_LAYER_PARSERS,\n 'SRS': makeObjectPropertyPusher(readString),\n 'Extent': makeObjectPropertySetter(readExtent),\n 'ScaleHint': makeObjectPropertyPusher(readScaleHint),\n 'LatLonBoundingBox': makeObjectPropertySetter((node, objectStack) =>\n readBoundingBox(node, objectStack, false),\n ),\n 'Layer': makeObjectPropertyPusher(readLayer),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LAYER_PARSERS_V13 = makeStructureNS(NAMESPACE_URIS, {\n ...COMMON_LAYER_PARSERS,\n 'CRS': makeObjectPropertyPusher(readString),\n 'EX_GeographicBoundingBox': makeObjectPropertySetter(\n readEXGeographicBoundingBox,\n ),\n 'MinScaleDenominator': makeObjectPropertySetter(readDecimal),\n 'MaxScaleDenominator': makeObjectPropertySetter(readDecimal),\n 'Layer': makeObjectPropertyPusher(readLayer),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst ATTRIBUTION_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Title': makeObjectPropertySetter(readString),\n 'OnlineResource': makeObjectPropertySetter(readHref),\n 'LogoURL': makeObjectPropertySetter(readSizedFormatOnlineresource),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'westBoundLongitude': makeObjectPropertySetter(readDecimal),\n 'eastBoundLongitude': makeObjectPropertySetter(readDecimal),\n 'southBoundLatitude': makeObjectPropertySetter(readDecimal),\n 'northBoundLatitude': makeObjectPropertySetter(readDecimal),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst REQUEST_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'GetCapabilities': makeObjectPropertySetter(readOperationType),\n 'GetMap': makeObjectPropertySetter(readOperationType),\n 'GetFeatureInfo': makeObjectPropertySetter(readOperationType),\n 'DescribeLayer': makeObjectPropertySetter(readOperationType),\n 'GetLegendGraphic': makeObjectPropertySetter(readOperationType),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst OPERATIONTYPE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Format': makeObjectPropertyPusher(readString),\n 'DCPType': makeObjectPropertyPusher(readDCPType),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst DCPTYPE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'HTTP': makeObjectPropertySetter(readHTTP),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst HTTP_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Get': makeObjectPropertySetter(readFormatOnlineresource),\n 'Post': makeObjectPropertySetter(readFormatOnlineresource),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst STYLE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Name': makeObjectPropertySetter(readString),\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'LegendURL': makeObjectPropertyPusher(readSizedFormatOnlineresource),\n 'StyleSheetURL': makeObjectPropertySetter(readFormatOnlineresource),\n 'StyleURL': makeObjectPropertySetter(readFormatOnlineresource),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst FORMAT_ONLINERESOURCE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Format': makeObjectPropertySetter(readString),\n 'OnlineResource': makeObjectPropertySetter(readHref),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst KEYWORDLIST_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Keyword': makeArrayPusher(readString),\n});\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Attribution object.\n */\nfunction readAttribution(node, objectStack) {\n return pushParseAndPop({}, ATTRIBUTION_PARSERS, node, objectStack);\n}\n\nfunction readUserDefinedSymbolization(node, objectStack) {\n return {\n 'SupportSLD': !!readBooleanString(node.getAttribute('SupportSLD')),\n 'UserLayer': !!readBooleanString(node.getAttribute('UserLayer')),\n 'UserStyle': !!readBooleanString(node.getAttribute('UserStyle')),\n 'RemoteWFS': !!readBooleanString(node.getAttribute('RemoteWFS')),\n 'InlineFeatureData': !!readBooleanString(\n node.getAttribute('InlineFeatureData'),\n ),\n 'RemoteWCS': !!readBooleanString(node.getAttribute('RemoteWCS')),\n };\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @param {boolean} withCrs Whether to include the CRS attribute.\n * @return {Object} Bounding box object.\n */\nfunction readBoundingBox(node, objectStack, withCrs = true) {\n const extent = [\n readDecimalString(node.getAttribute('minx')),\n readDecimalString(node.getAttribute('miny')),\n readDecimalString(node.getAttribute('maxx')),\n readDecimalString(node.getAttribute('maxy')),\n ];\n\n const resolutions = [\n readDecimalString(node.getAttribute('resx')),\n readDecimalString(node.getAttribute('resy')),\n ];\n\n const result = {\n extent,\n res: resolutions,\n };\n if (!withCrs) {\n return result;\n }\n\n /** @type {RootObject} */\n if (isV13(objectStack)) {\n result.crs = node.getAttribute('CRS');\n } else {\n result.srs = node.getAttribute('SRS');\n }\n\n return result;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../extent.js\").Extent|undefined} Bounding box object.\n */\nfunction readEXGeographicBoundingBox(node, objectStack) {\n const geographicBoundingBox = pushParseAndPop(\n {},\n EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS,\n node,\n objectStack,\n );\n if (!geographicBoundingBox) {\n return undefined;\n }\n const westBoundLongitude =\n /** @type {number|undefined} */\n (geographicBoundingBox['westBoundLongitude']);\n const southBoundLatitude =\n /** @type {number|undefined} */\n (geographicBoundingBox['southBoundLatitude']);\n const eastBoundLongitude =\n /** @type {number|undefined} */\n (geographicBoundingBox['eastBoundLongitude']);\n const northBoundLatitude =\n /** @type {number|undefined} */\n (geographicBoundingBox['northBoundLatitude']);\n if (\n westBoundLongitude === undefined ||\n southBoundLatitude === undefined ||\n eastBoundLongitude === undefined ||\n northBoundLatitude === undefined\n ) {\n return undefined;\n }\n return [\n westBoundLongitude,\n southBoundLatitude,\n eastBoundLongitude,\n northBoundLatitude,\n ];\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Capability object.\n */\n//ts-ignore\nfunction readCapability(node, objectStack) {\n return pushParseAndPop({}, CAPABILITY_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Service object.\n */\nfunction readService(node, objectStack) {\n return pushParseAndPop(\n {},\n isV13(objectStack) ? SERVICE_PARSERS_V13 : SERVICE_PARSERS,\n node,\n objectStack,\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Contact information object.\n */\nfunction readContactInformation(node, objectStack) {\n return pushParseAndPop({}, CONTACT_INFORMATION_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Contact person object.\n */\nfunction readContactPersonPrimary(node, objectStack) {\n return pushParseAndPop({}, CONTACT_PERSON_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Contact address object.\n */\nfunction readContactAddress(node, objectStack) {\n return pushParseAndPop({}, CONTACT_ADDRESS_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<string>|undefined} Format array.\n */\nfunction readException(node, objectStack) {\n return pushParseAndPop([], EXCEPTION_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Layer object.\n */\nfunction readCapabilityLayer(node, objectStack) {\n const layerObject = pushParseAndPop(\n {},\n isV13(objectStack) ? LAYER_PARSERS_V13 : LAYER_PARSERS,\n node,\n objectStack,\n );\n\n if (layerObject['Layer'] === undefined) {\n return Object.assign(layerObject, readLayer(node, objectStack));\n }\n\n return layerObject;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Layer object.\n */\nfunction readLayer(node, objectStack) {\n const v13 = isV13(objectStack);\n\n const parentLayerObject = /** @type {!Object<string,*>} */ (\n objectStack[objectStack.length - 1]\n );\n\n const layerObject = pushParseAndPop(\n {},\n v13 ? LAYER_PARSERS_V13 : LAYER_PARSERS,\n node,\n objectStack,\n );\n\n if (!layerObject) {\n return undefined;\n }\n let queryable = readBooleanString(node.getAttribute('queryable'));\n if (queryable === undefined) {\n queryable = parentLayerObject['queryable'];\n }\n layerObject['queryable'] = queryable !== undefined ? queryable : false;\n\n let cascaded = readNonNegativeIntegerString(node.getAttribute('cascaded'));\n if (cascaded === undefined) {\n cascaded = parentLayerObject['cascaded'];\n }\n layerObject['cascaded'] = cascaded;\n\n let opaque = readBooleanString(node.getAttribute('opaque'));\n if (opaque === undefined) {\n opaque = parentLayerObject['opaque'];\n }\n layerObject['opaque'] = opaque !== undefined ? opaque : false;\n\n let noSubsets = readBooleanString(node.getAttribute('noSubsets'));\n if (noSubsets === undefined) {\n noSubsets = parentLayerObject['noSubsets'];\n }\n layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false;\n\n let fixedWidth = readDecimalString(node.getAttribute('fixedWidth'));\n if (!fixedWidth) {\n fixedWidth = parentLayerObject['fixedWidth'];\n }\n layerObject['fixedWidth'] = fixedWidth;\n\n let fixedHeight = readDecimalString(node.getAttribute('fixedHeight'));\n if (!fixedHeight) {\n fixedHeight = parentLayerObject['fixedHeight'];\n }\n layerObject['fixedHeight'] = fixedHeight;\n\n // See 7.2.4.8\n const addKeys = ['Style', 'AuthorityURL'];\n if (v13) {\n addKeys.push('CRS');\n } else {\n addKeys.push('SRS', 'Dimension');\n }\n addKeys.forEach(function (key) {\n if (key in parentLayerObject) {\n const childValue = layerObject[key] || [];\n layerObject[key] = childValue.concat(parentLayerObject[key]);\n }\n });\n\n const replaceKeys = ['BoundingBox', 'Attribution'];\n if (v13) {\n replaceKeys.push(\n 'Dimension',\n 'EX_GeographicBoundingBox',\n 'MinScaleDenominator',\n 'MaxScaleDenominator',\n );\n } else {\n replaceKeys.push('LatLonBoundingBox', 'ScaleHint', 'Extent');\n }\n replaceKeys.forEach(function (key) {\n if (!(key in layerObject)) {\n const parentValue = parentLayerObject[key];\n layerObject[key] = parentValue;\n }\n });\n\n return layerObject;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object} Dimension object.\n */\nfunction readDimension(node, objectStack) {\n const dimensionObject = {\n 'name': node.getAttribute('name'),\n 'units': node.getAttribute('units'),\n 'unitSymbol': node.getAttribute('unitSymbol'),\n };\n\n if (isV13(objectStack)) {\n Object.assign(dimensionObject, {\n 'default': node.getAttribute('default'),\n 'multipleValues': readBooleanString(node.getAttribute('multipleValues')),\n 'nearestValue': readBooleanString(node.getAttribute('nearestValue')),\n 'current': readBooleanString(node.getAttribute('current')),\n 'values': readString(node),\n });\n }\n return dimensionObject;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object} Extent object.\n */\nfunction readExtent(node, objectStack) {\n return {\n 'name': node.getAttribute('name'),\n 'default': node.getAttribute('default'),\n 'nearestValue': readBooleanString(node.getAttribute('nearestValue')),\n };\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object} ScaleHint object.\n */\nfunction readScaleHint(node, objectStack) {\n return {\n 'min': readDecimalString(node.getAttribute('min')),\n 'max': readDecimalString(node.getAttribute('max')),\n };\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Online resource object.\n */\nfunction readFormatOnlineresource(node, objectStack) {\n return pushParseAndPop({}, FORMAT_ONLINERESOURCE_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Request object.\n */\nfunction readRequest(node, objectStack) {\n return pushParseAndPop({}, REQUEST_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} DCP type object.\n */\nfunction readDCPType(node, objectStack) {\n return pushParseAndPop({}, DCPTYPE_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} HTTP object.\n */\nfunction readHTTP(node, objectStack) {\n return pushParseAndPop({}, HTTP_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Operation type object.\n */\nfunction readOperationType(node, objectStack) {\n return pushParseAndPop({}, OPERATIONTYPE_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Online resource object.\n */\nfunction readSizedFormatOnlineresource(node, objectStack) {\n const formatOnlineresource = readFormatOnlineresource(node, objectStack);\n if (formatOnlineresource) {\n const size = [\n readNonNegativeIntegerString(node.getAttribute('width')),\n readNonNegativeIntegerString(node.getAttribute('height')),\n ];\n formatOnlineresource['size'] = size;\n return formatOnlineresource;\n }\n return undefined;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Authority URL object.\n */\nfunction readAuthorityURL(node, objectStack) {\n const authorityObject = readFormatOnlineresource(node, objectStack);\n if (authorityObject) {\n authorityObject['name'] = node.getAttribute('name');\n return authorityObject;\n }\n return undefined;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Metadata URL object.\n */\nfunction readMetadataURL(node, objectStack) {\n const metadataObject = readFormatOnlineresource(node, objectStack);\n if (metadataObject) {\n metadataObject['type'] = node.getAttribute('type');\n return metadataObject;\n }\n return undefined;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Style object.\n */\nfunction readStyle(node, objectStack) {\n return pushParseAndPop({}, STYLE_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<string>|undefined} Keyword list.\n */\nfunction readKeywordList(node, objectStack) {\n return pushParseAndPop([], KEYWORDLIST_PARSERS, node, objectStack);\n}\n\nexport default WMSCapabilities;\n","/**\n * @module ol/format/WMTSCapabilities\n */\nimport {boundingExtent} from '../extent.js';\nimport {\n makeArrayPusher,\n makeObjectPropertyPusher,\n makeObjectPropertySetter,\n makeStructureNS,\n pushParseAndPop,\n} from '../xml.js';\nimport OWS from './OWS.js';\nimport XML from './XML.js';\nimport {readHref} from './xlink.js';\nimport {readDecimal, readPositiveInteger, readString} from './xsd.js';\n\n/**\n * @const\n * @type {Array<null|string>}\n */\nconst NAMESPACE_URIS = [null, 'http://www.opengis.net/wmts/1.0'];\n\n/**\n * @const\n * @type {Array<null|string>}\n */\nconst OWS_NAMESPACE_URIS = [null, 'http://www.opengis.net/ows/1.1'];\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Contents': makeObjectPropertySetter(readContents),\n});\n\n/**\n * @classdesc\n * Format for reading WMTS capabilities data.\n *\n * @api\n */\nclass WMTSCapabilities extends XML {\n constructor() {\n super();\n\n /**\n * @type {OWS}\n * @private\n */\n this.owsParser_ = new OWS();\n }\n\n /**\n * @param {Element} node Node.\n * @return {Object|null} Object\n * @override\n */\n readFromNode(node) {\n let version = node.getAttribute('version');\n if (version) {\n version = version.trim();\n }\n let WMTSCapabilityObject = this.owsParser_.readFromNode(node);\n if (!WMTSCapabilityObject) {\n return null;\n }\n WMTSCapabilityObject['version'] = version;\n WMTSCapabilityObject = pushParseAndPop(\n WMTSCapabilityObject,\n PARSERS,\n node,\n [],\n );\n return WMTSCapabilityObject ? WMTSCapabilityObject : null;\n }\n}\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst CONTENTS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'Layer': makeObjectPropertyPusher(readLayer),\n 'TileMatrixSet': makeObjectPropertyPusher(readTileMatrixSet),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst LAYER_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'Style': makeObjectPropertyPusher(readStyle),\n 'Format': makeObjectPropertyPusher(readString),\n 'TileMatrixSetLink': makeObjectPropertyPusher(readTileMatrixSetLink),\n 'Dimension': makeObjectPropertyPusher(readDimensions),\n 'ResourceURL': makeObjectPropertyPusher(readResourceUrl),\n },\n makeStructureNS(OWS_NAMESPACE_URIS, {\n 'Title': makeObjectPropertySetter(readString),\n 'Abstract': makeObjectPropertySetter(readString),\n 'WGS84BoundingBox': makeObjectPropertySetter(readBoundingBox),\n 'BoundingBox': makeObjectPropertyPusher(readBoundingBoxWithCrs),\n 'Identifier': makeObjectPropertySetter(readString),\n }),\n);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst STYLE_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'LegendURL': makeObjectPropertyPusher(readLegendUrl),\n },\n makeStructureNS(OWS_NAMESPACE_URIS, {\n 'Title': makeObjectPropertySetter(readString),\n 'Identifier': makeObjectPropertySetter(readString),\n }),\n);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TMS_LINKS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'TileMatrixSet': makeObjectPropertySetter(readString),\n 'TileMatrixSetLimits': makeObjectPropertySetter(readTileMatrixLimitsList),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TMS_LIMITS_LIST_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'TileMatrixLimits': makeArrayPusher(readTileMatrixLimits),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TMS_LIMITS_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'TileMatrix': makeObjectPropertySetter(readString),\n 'MinTileRow': makeObjectPropertySetter(readPositiveInteger),\n 'MaxTileRow': makeObjectPropertySetter(readPositiveInteger),\n 'MinTileCol': makeObjectPropertySetter(readPositiveInteger),\n 'MaxTileCol': makeObjectPropertySetter(readPositiveInteger),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst DIMENSION_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'Default': makeObjectPropertySetter(readString),\n 'Value': makeObjectPropertyPusher(readString),\n },\n makeStructureNS(OWS_NAMESPACE_URIS, {\n 'Identifier': makeObjectPropertySetter(readString),\n }),\n);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst WGS84_BBOX_READERS = makeStructureNS(OWS_NAMESPACE_URIS, {\n 'LowerCorner': makeArrayPusher(readCoordinates),\n 'UpperCorner': makeArrayPusher(readCoordinates),\n});\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TMS_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'WellKnownScaleSet': makeObjectPropertySetter(readString),\n 'TileMatrix': makeObjectPropertyPusher(readTileMatrix),\n },\n makeStructureNS(OWS_NAMESPACE_URIS, {\n 'SupportedCRS': makeObjectPropertySetter(readString),\n 'Identifier': makeObjectPropertySetter(readString),\n 'BoundingBox': makeObjectPropertySetter(readBoundingBox),\n }),\n);\n\n/**\n * @const\n * @type {Object<string, Object<string, import(\"../xml.js\").Parser>>}\n */\n// @ts-ignore\nconst TM_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'TopLeftCorner': makeObjectPropertySetter(readCoordinates),\n 'ScaleDenominator': makeObjectPropertySetter(readDecimal),\n 'TileWidth': makeObjectPropertySetter(readPositiveInteger),\n 'TileHeight': makeObjectPropertySetter(readPositiveInteger),\n 'MatrixWidth': makeObjectPropertySetter(readPositiveInteger),\n 'MatrixHeight': makeObjectPropertySetter(readPositiveInteger),\n },\n makeStructureNS(OWS_NAMESPACE_URIS, {\n 'Identifier': makeObjectPropertySetter(readString),\n }),\n);\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Attribution object.\n */\nfunction readContents(node, objectStack) {\n return pushParseAndPop({}, CONTENTS_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Layers object.\n */\nfunction readLayer(node, objectStack) {\n return pushParseAndPop({}, LAYER_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Tile Matrix Set object.\n */\nfunction readTileMatrixSet(node, objectStack) {\n return pushParseAndPop({}, TMS_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Style object.\n */\nfunction readStyle(node, objectStack) {\n const style = pushParseAndPop({}, STYLE_PARSERS, node, objectStack);\n if (!style) {\n return undefined;\n }\n const isDefault = node.getAttribute('isDefault') === 'true';\n style['isDefault'] = isDefault;\n return style;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Tile Matrix Set Link object.\n */\nfunction readTileMatrixSetLink(node, objectStack) {\n return pushParseAndPop({}, TMS_LINKS_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Dimension object.\n */\nfunction readDimensions(node, objectStack) {\n return pushParseAndPop({}, DIMENSION_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Resource URL object.\n */\nfunction readResourceUrl(node, objectStack) {\n const format = node.getAttribute('format');\n const template = node.getAttribute('template');\n const resourceType = node.getAttribute('resourceType');\n const resource = {};\n if (format) {\n resource['format'] = format;\n }\n if (template) {\n resource['template'] = template;\n }\n if (resourceType) {\n resource['resourceType'] = resourceType;\n }\n return resource;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} BBox object.\n */\nfunction readBoundingBox(node, objectStack) {\n const coordinates = pushParseAndPop(\n [],\n WGS84_BBOX_READERS,\n node,\n objectStack,\n );\n if (coordinates.length != 2) {\n return undefined;\n }\n return boundingExtent(coordinates);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} BBox object.\n */\nfunction readBoundingBoxWithCrs(node, objectStack) {\n const crs = node.getAttribute('crs');\n const coordinates = pushParseAndPop(\n [],\n WGS84_BBOX_READERS,\n node,\n objectStack,\n );\n if (coordinates.length != 2) {\n return undefined;\n }\n return {extent: boundingExtent(coordinates), crs: crs};\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Legend object.\n */\nfunction readLegendUrl(node, objectStack) {\n const legend = {};\n legend['format'] = node.getAttribute('format');\n legend['href'] = readHref(node);\n return legend;\n}\n\n/**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} Coordinates object.\n */\nfunction readCoordinates(node, objectStack) {\n const coordinates = readString(node).split(/\\s+/);\n if (!coordinates || coordinates.length != 2) {\n return undefined;\n }\n const x = +coordinates[0];\n const y = +coordinates[1];\n if (isNaN(x) || isNaN(y)) {\n return undefined;\n }\n return [x, y];\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} TileMatrix object.\n */\nfunction readTileMatrix(node, objectStack) {\n return pushParseAndPop({}, TM_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} TileMatrixSetLimits Object.\n */\nfunction readTileMatrixLimitsList(node, objectStack) {\n return pushParseAndPop([], TMS_LIMITS_LIST_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Object|undefined} TileMatrixLimits Array.\n */\nfunction readTileMatrixLimits(node, objectStack) {\n return pushParseAndPop({}, TMS_LIMITS_PARSERS, node, objectStack);\n}\n\nexport default WMTSCapabilities;\n","/**\n * @module ol/control/FullScreen\n */\nimport MapProperty from '../MapProperty.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE, CLASS_UNSUPPORTED} from '../css.js';\nimport {replaceNode} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport Control from './Control.js';\n\nconst events = ['fullscreenchange', 'webkitfullscreenchange'];\n\n/**\n * @enum {string}\n */\nconst FullScreenEventType = {\n /**\n * Triggered after the map entered fullscreen.\n * @event FullScreenEventType#enterfullscreen\n * @api\n */\n ENTERFULLSCREEN: 'enterfullscreen',\n\n /**\n * Triggered after the map leave fullscreen.\n * @event FullScreenEventType#leavefullscreen\n * @api\n */\n LEAVEFULLSCREEN: 'leavefullscreen',\n};\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes|\n * 'enterfullscreen'|'leavefullscreen', import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types, import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|\n * 'enterfullscreen'|'leavefullscreen'|import(\"../ObjectEventType\").Types, Return>} FullScreenOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-full-screen'] CSS class name.\n * @property {string|Text|HTMLElement} [label='\\u2922'] Text label to use for the button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|Text|HTMLElement} [labelActive='\\u00d7'] Text label to use for the\n * button when full-screen is active.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [activeClassName=className + '-true'] CSS class name for the button\n * when full-screen is active.\n * @property {string} [inactiveClassName=className + '-false'] CSS class name for the button\n * when full-screen is inactive.\n * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.\n * @property {boolean} [keys=false] Full keyboard access.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {HTMLElement|string} [source] The element to be displayed\n * fullscreen. When not provided, the element containing the map viewport will\n * be displayed fullscreen.\n */\n\n/**\n * @classdesc\n * Provides a button that when clicked fills up the full screen with the map.\n * The full screen source element is by default the element containing the map viewport unless\n * overridden by providing the `source` option. In which case, the dom\n * element introduced using this parameter will be displayed in full screen.\n *\n * When in full screen mode, a close button is shown to exit full screen mode.\n * The [Fullscreen API](https://www.w3.org/TR/fullscreen/) is used to\n * toggle the map in full screen mode.\n *\n * @fires FullScreenEventType#enterfullscreen\n * @fires FullScreenEventType#leavefullscreen\n * @api\n */\nclass FullScreen extends Control {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n /***\n * @type {FullScreenOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {FullScreenOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {FullScreenOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {boolean}\n */\n this.keys_ = options.keys !== undefined ? options.keys : false;\n\n /**\n * @private\n * @type {HTMLElement|string|undefined}\n */\n this.source_ = options.source;\n\n /**\n * @type {boolean}\n * @private\n */\n this.isInFullscreen_ = false;\n\n /**\n * @private\n */\n this.boundHandleMapTargetChange_ = this.handleMapTargetChange_.bind(this);\n\n /**\n * @private\n * @type {string}\n */\n this.cssClassName_ =\n options.className !== undefined ? options.className : 'ol-full-screen';\n\n /**\n * @private\n * @type {Array<import(\"../events.js\").EventsKey>}\n */\n this.documentListeners_ = [];\n\n /**\n * @private\n * @type {Array<string>}\n */\n this.activeClassName_ =\n options.activeClassName !== undefined\n ? options.activeClassName.split(' ')\n : [this.cssClassName_ + '-true'];\n\n /**\n * @private\n * @type {Array<string>}\n */\n this.inactiveClassName_ =\n options.inactiveClassName !== undefined\n ? options.inactiveClassName.split(' ')\n : [this.cssClassName_ + '-false'];\n\n const label = options.label !== undefined ? options.label : '\\u2922';\n\n /**\n * @private\n * @type {Text|HTMLElement}\n */\n this.labelNode_ =\n typeof label === 'string' ? document.createTextNode(label) : label;\n\n const labelActive =\n options.labelActive !== undefined ? options.labelActive : '\\u00d7';\n\n /**\n * @private\n * @type {Text|HTMLElement}\n */\n this.labelActiveNode_ =\n typeof labelActive === 'string'\n ? document.createTextNode(labelActive)\n : labelActive;\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.button_ = document.createElement('button');\n this.button_.title = tipLabel;\n this.button_.setAttribute('type', 'button');\n this.button_.appendChild(this.labelNode_);\n this.button_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n this.setClassName_(this.button_, this.isInFullscreen_);\n\n this.element.className = `${this.cssClassName_} ${CLASS_UNSELECTABLE} ${CLASS_CONTROL}`;\n this.element.appendChild(this.button_);\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleFullScreen_();\n }\n\n /**\n * @private\n */\n handleFullScreen_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n const doc = map.getOwnerDocument();\n if (!isFullScreenSupported(doc)) {\n return;\n }\n if (isFullScreen(doc)) {\n exitFullScreen(doc);\n } else {\n let element;\n if (this.source_) {\n element =\n typeof this.source_ === 'string'\n ? doc.getElementById(this.source_)\n : this.source_;\n } else {\n element = map.getTargetElement();\n }\n if (this.keys_) {\n requestFullScreenWithKeys(element);\n } else {\n requestFullScreen(element);\n }\n }\n }\n\n /**\n * @private\n */\n handleFullScreenChange_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n const wasInFullscreen = this.isInFullscreen_;\n this.isInFullscreen_ = isFullScreen(map.getOwnerDocument());\n if (wasInFullscreen !== this.isInFullscreen_) {\n this.setClassName_(this.button_, this.isInFullscreen_);\n if (this.isInFullscreen_) {\n replaceNode(this.labelActiveNode_, this.labelNode_);\n this.dispatchEvent(FullScreenEventType.ENTERFULLSCREEN);\n } else {\n replaceNode(this.labelNode_, this.labelActiveNode_);\n this.dispatchEvent(FullScreenEventType.LEAVEFULLSCREEN);\n }\n map.updateSize();\n }\n }\n\n /**\n * @param {HTMLElement} element Target element\n * @param {boolean} fullscreen True if fullscreen class name should be active\n * @private\n */\n setClassName_(element, fullscreen) {\n if (fullscreen) {\n element.classList.remove(...this.inactiveClassName_);\n element.classList.add(...this.activeClassName_);\n } else {\n element.classList.remove(...this.activeClassName_);\n element.classList.add(...this.inactiveClassName_);\n }\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n * @override\n */\n setMap(map) {\n const oldMap = this.getMap();\n if (oldMap) {\n oldMap.removeChangeListener(\n MapProperty.TARGET,\n this.boundHandleMapTargetChange_,\n );\n }\n\n super.setMap(map);\n\n this.handleMapTargetChange_();\n if (map) {\n map.addChangeListener(\n MapProperty.TARGET,\n this.boundHandleMapTargetChange_,\n );\n }\n }\n\n /**\n * @private\n */\n handleMapTargetChange_() {\n const listeners = this.documentListeners_;\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n unlistenByKey(listeners[i]);\n }\n listeners.length = 0;\n\n const map = this.getMap();\n if (map) {\n const doc = map.getOwnerDocument();\n if (isFullScreenSupported(doc)) {\n this.element.classList.remove(CLASS_UNSUPPORTED);\n } else {\n this.element.classList.add(CLASS_UNSUPPORTED);\n }\n\n for (let i = 0, ii = events.length; i < ii; ++i) {\n listeners.push(\n listen(doc, events[i], this.handleFullScreenChange_, this),\n );\n }\n this.handleFullScreenChange_();\n }\n }\n}\n\n/**\n * @param {Document} doc The root document to check.\n * @return {boolean} Fullscreen is supported by the current platform.\n */\nfunction isFullScreenSupported(doc) {\n const body = doc.body;\n return !!(\n body['webkitRequestFullscreen'] ||\n (body.requestFullscreen && doc.fullscreenEnabled)\n );\n}\n\n/**\n * @param {Document} doc The root document to check.\n * @return {boolean} Element is currently in fullscreen.\n */\nfunction isFullScreen(doc) {\n return !!(doc['webkitIsFullScreen'] || doc.fullscreenElement);\n}\n\n/**\n * Request to fullscreen an element.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreen(element) {\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n }\n}\n\n/**\n * Request to fullscreen an element with keyboard input.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreenWithKeys(element) {\n if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n } else {\n requestFullScreen(element);\n }\n}\n\n/**\n * Exit fullscreen.\n * @param {Document} doc The document to exit fullscren from\n */\nfunction exitFullScreen(doc) {\n if (doc.exitFullscreen) {\n doc.exitFullscreen();\n } else if (doc['webkitExitFullscreen']) {\n doc['webkitExitFullscreen']();\n }\n}\n\nexport default FullScreen;\n","/**\n * @module ol/control/MousePosition\n */\n\nimport {wrapX} from '../coordinate.js';\nimport {listen} from '../events.js';\nimport EventType from '../pointer/EventType.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n getUserProjection,\n identityTransform,\n} from '../proj.js';\nimport Control from './Control.js';\n\n/**\n * @type {string}\n */\nconst PROJECTION = 'projection';\n\n/**\n * @type {string}\n */\nconst COORDINATE_FORMAT = 'coordinateFormat';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:coordinateFormat'|'change:projection', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:coordinateFormat'|'change:projection', Return>} MousePositionOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-mouse-position'] CSS class name.\n * @property {import(\"../coordinate.js\").CoordinateFormat} [coordinateFormat] Coordinate format.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the\n * control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {string} [placeholder] Markup to show when the mouse position is not\n * available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space is rendered\n * initially and the last position is retained when the mouse leaves the viewport.\n * When a string is provided (e.g. `'no position'` or `''` for an empty string) it is used as a\n * placeholder.\n * @property {boolean} [wrapX=true] Wrap the world horizontally on the projection's antimeridian, if it\n * is a global projection.\n */\n\n/**\n * @classdesc\n * A control to show the 2D coordinates of the mouse cursor. By default, these\n * are in the view projection, but can be in any supported projection.\n * By default the control is shown in the top right corner of the map, but this\n * can be changed by using the css selector `.ol-mouse-position`.\n *\n * On touch devices, which usually do not have a mouse cursor, the coordinates\n * of the currently touched position are shown.\n *\n * @api\n */\nclass MousePosition extends Control {\n /**\n * @param {Options} [options] Mouse position options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const element = document.createElement('div');\n element.className =\n options.className !== undefined ? options.className : 'ol-mouse-position';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n /***\n * @type {MousePositionOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {MousePositionOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {MousePositionOnSignature<void>}\n */\n this.un;\n\n this.addChangeListener(PROJECTION, this.handleProjectionChanged_);\n\n if (options.coordinateFormat) {\n this.setCoordinateFormat(options.coordinateFormat);\n }\n if (options.projection) {\n this.setProjection(options.projection);\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderOnMouseOut_ = options.placeholder !== undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.placeholder_ = this.renderOnMouseOut_ ? options.placeholder : ' ';\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = element.innerHTML;\n\n /**\n * @private\n * @type {?import(\"../proj/Projection.js\").default}\n */\n this.mapProjection_ = null;\n\n /**\n * @private\n * @type {?import(\"../proj.js\").TransformFunction}\n */\n this.transform_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.wrapX_ = options.wrapX === false ? false : true;\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n this.transform_ = null;\n }\n\n /**\n * Return the coordinate format type used to render the current position or\n * undefined.\n * @return {import(\"../coordinate.js\").CoordinateFormat|undefined} The format to render the current\n * position in.\n * @observable\n * @api\n */\n getCoordinateFormat() {\n return /** @type {import(\"../coordinate.js\").CoordinateFormat|undefined} */ (\n this.get(COORDINATE_FORMAT)\n );\n }\n\n /**\n * Return the projection that is used to report the mouse position.\n * @return {import(\"../proj/Projection.js\").default|undefined} The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"../proj/Projection.js\").default|undefined} */ (\n this.get(PROJECTION)\n );\n }\n\n /**\n * @param {MouseEvent} event Browser event.\n * @protected\n */\n handleMouseMove(event) {\n const map = this.getMap();\n this.updateHTML_(map.getEventPixel(event));\n }\n\n /**\n * @param {Event} event Browser event.\n * @protected\n */\n handleMouseOut(event) {\n this.updateHTML_(null);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n * @override\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n const viewport = map.getViewport();\n this.listenerKeys.push(\n listen(viewport, EventType.POINTERMOVE, this.handleMouseMove, this),\n );\n if (this.renderOnMouseOut_) {\n this.listenerKeys.push(\n listen(viewport, EventType.POINTEROUT, this.handleMouseOut, this),\n );\n }\n this.updateHTML_(null);\n }\n }\n\n /**\n * Set the coordinate format type used to render the current position.\n * @param {import(\"../coordinate.js\").CoordinateFormat} format The format to render the current\n * position in.\n * @observable\n * @api\n */\n setCoordinateFormat(format) {\n this.set(COORDINATE_FORMAT, format);\n }\n\n /**\n * Set the projection that is used to report the mouse position.\n * @param {import(\"../proj.js\").ProjectionLike} projection The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(PROJECTION, getProjection(projection));\n }\n\n /**\n * @param {?import(\"../pixel.js\").Pixel} pixel Pixel.\n * @private\n */\n updateHTML_(pixel) {\n let html = this.placeholder_;\n if (pixel && this.mapProjection_) {\n if (!this.transform_) {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n projection,\n );\n } else {\n this.transform_ = identityTransform;\n }\n }\n const map = this.getMap();\n const coordinate = map.getCoordinateFromPixelInternal(pixel);\n if (coordinate) {\n const userProjection = getUserProjection();\n if (userProjection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n userProjection,\n );\n }\n this.transform_(coordinate, coordinate);\n if (this.wrapX_) {\n const projection =\n userProjection || this.getProjection() || this.mapProjection_;\n wrapX(coordinate, projection);\n }\n const coordinateFormat = this.getCoordinateFormat();\n if (coordinateFormat) {\n html = coordinateFormat(coordinate);\n } else {\n html = coordinate.toString();\n }\n }\n }\n if (!this.renderedHTML_ || html !== this.renderedHTML_) {\n this.element.innerHTML = html;\n this.renderedHTML_ = html;\n }\n }\n\n /**\n * Update the projection. Rendering of the coordinates is done in\n * `handleMouseMove` and `handleMouseUp`.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.mapProjection_ = null;\n } else {\n if (this.mapProjection_ != frameState.viewState.projection) {\n this.mapProjection_ = frameState.viewState.projection;\n this.transform_ = null;\n }\n }\n }\n}\n\nexport default MousePosition;\n","/**\n * @module ol/control/OverviewMap\n */\nimport Collection from '../Collection.js';\nimport Map from '../Map.js';\nimport MapEventType from '../MapEventType.js';\nimport MapProperty from '../MapProperty.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport Overlay from '../Overlay.js';\nimport View from '../View.js';\nimport ViewProperty from '../ViewProperty.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {replaceNode} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {listen, listenOnce} from '../events.js';\nimport {\n containsExtent,\n equals as equalsExtent,\n getBottomRight,\n getTopLeft,\n scaleFromCenter,\n} from '../extent.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport Control from './Control.js';\n\n/**\n * Maximum width and/or height extent ratio that determines when the overview\n * map should be zoomed out.\n * @type {number}\n */\nconst MAX_RATIO = 0.75;\n\n/**\n * Minimum width and/or height extent ratio that determines when the overview\n * map should be zoomed in.\n * @type {number}\n */\nconst MIN_RATIO = 0.1;\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-overviewmap'] CSS class name.\n * @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded).\n * @property {string|HTMLElement} [collapseLabel='‹'] Text label to use for the\n * expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {boolean} [collapsible=true] Whether the control can be collapsed or not.\n * @property {string|HTMLElement} [label='›'] Text label to use for the collapsed\n * overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {Array<import(\"../layer/Base.js\").default>|import(\"../Collection.js\").default<import(\"../layer/Base.js\").default>} [layers]\n * Layers for the overview map.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {string} [tipLabel='Overview map'] Text label to use for the button tip.\n * @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided,\n * a default view with the same projection as the main map will be used.\n */\n\n/**\n * Create a new control with a map acting as an overview map for another\n * defined map.\n *\n * @api\n */\nclass OverviewMap extends Control {\n /**\n * @param {Options} [options] OverviewMap options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n */\n this.boundHandleRotationChanged_ = this.handleRotationChanged_.bind(this);\n\n /**\n * @type {boolean}\n * @private\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotateWithView_ =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent|undefined}\n */\n this.viewExtent_ = undefined;\n\n const className =\n options.className !== undefined ? options.className : 'ol-overviewmap';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Overview map';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u2039';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : '\\u203A';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(activeLabel);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.ovmapDiv_ = document.createElement('div');\n this.ovmapDiv_.className = 'ol-overviewmap-map';\n\n /**\n * Explicitly given view to be used instead of a view derived from the main map.\n * @type {View}\n * @private\n */\n this.view_ = options.view;\n\n const ovmap = new Map({\n view: options.view,\n controls: new Collection(),\n interactions: new Collection(),\n });\n\n /**\n * @type {Map}\n * @private\n */\n this.ovmap_ = ovmap;\n\n if (options.layers) {\n options.layers.forEach(function (layer) {\n ovmap.addLayer(layer);\n });\n }\n\n const box = document.createElement('div');\n box.className = 'ol-overviewmap-box';\n box.style.boxSizing = 'border-box';\n\n /**\n * @type {import(\"../Overlay.js\").default}\n * @private\n */\n this.boxOverlay_ = new Overlay({\n position: [0, 0],\n positioning: 'center-center',\n element: box,\n });\n this.ovmap_.addOverlay(this.boxOverlay_);\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.ovmapDiv_);\n element.appendChild(button);\n\n /* Interactive map */\n\n const overlay = this.boxOverlay_;\n const overlayBox = this.boxOverlay_.getElement();\n\n /* Functions definition */\n\n const computeDesiredMousePosition = (mousePosition) => {\n return {\n clientX: mousePosition.clientX,\n clientY: mousePosition.clientY,\n };\n };\n\n const move = function (event) {\n const position = /** @type {?} */ (computeDesiredMousePosition(event));\n const coordinates = ovmap.getEventCoordinate(\n /** @type {MouseEvent} */ (position),\n );\n\n overlay.setPosition(coordinates);\n };\n\n const endMoving = (event) => {\n const coordinates = ovmap.getEventCoordinateInternal(event);\n\n const map = this.getMap();\n\n map.getView().setCenterInternal(coordinates);\n\n const ownerDocument = map.getOwnerDocument();\n ownerDocument.removeEventListener('pointermove', move);\n ownerDocument.removeEventListener('pointerup', endMoving);\n };\n\n /* Binding */\n\n this.ovmapDiv_.addEventListener('pointerdown', (event) => {\n const ownerDocument = this.getMap().getOwnerDocument();\n if (event.target === overlayBox) {\n ownerDocument.addEventListener('pointermove', move);\n }\n ownerDocument.addEventListener('pointerup', endMoving);\n });\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n * @override\n */\n setMap(map) {\n const oldMap = this.getMap();\n if (map === oldMap) {\n return;\n }\n if (oldMap) {\n const oldView = oldMap.getView();\n if (oldView) {\n this.unbindView_(oldView);\n }\n this.ovmap_.setTarget(null);\n }\n super.setMap(map);\n\n if (map) {\n this.ovmap_.setTarget(this.ovmapDiv_);\n this.listenerKeys.push(\n listen(\n map,\n ObjectEventType.PROPERTYCHANGE,\n this.handleMapPropertyChange_,\n this,\n ),\n );\n\n const view = map.getView();\n if (view) {\n this.bindView_(view);\n }\n\n if (!this.ovmap_.isRendered()) {\n this.updateBoxAfterOvmapIsRendered_();\n }\n }\n }\n\n /**\n * Handle map property changes. This only deals with changes to the map's view.\n * @param {import(\"../Object.js\").ObjectEvent} event The propertychange event.\n * @private\n */\n handleMapPropertyChange_(event) {\n if (event.key === MapProperty.VIEW) {\n const oldView = /** @type {import(\"../View.js\").default} */ (\n event.oldValue\n );\n if (oldView) {\n this.unbindView_(oldView);\n }\n const newView = this.getMap().getView();\n this.bindView_(newView);\n } else if (\n !this.ovmap_.isRendered() &&\n (event.key === MapProperty.TARGET || event.key === MapProperty.SIZE)\n ) {\n this.ovmap_.updateSize();\n }\n }\n\n /**\n * Register listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n bindView_(view) {\n if (!this.view_) {\n // Unless an explicit view definition was given, derive default from whatever main map uses.\n const newView = new View({\n projection: view.getProjection(),\n });\n this.ovmap_.setView(newView);\n }\n\n view.addChangeListener(\n ViewProperty.ROTATION,\n this.boundHandleRotationChanged_,\n );\n // Sync once with the new view\n this.handleRotationChanged_();\n\n if (view.isDef()) {\n this.ovmap_.updateSize();\n this.resetExtent_();\n }\n }\n\n /**\n * Unregister listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n unbindView_(view) {\n view.removeChangeListener(\n ViewProperty.ROTATION,\n this.boundHandleRotationChanged_,\n );\n }\n\n /**\n * Handle rotation changes to the main map.\n * @private\n */\n handleRotationChanged_() {\n if (this.rotateWithView_) {\n this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());\n }\n }\n\n /**\n * Reset the overview map extent if the box size (width or\n * height) is less than the size of the overview map size times minRatio\n * or is greater than the size of the overview size times maxRatio.\n *\n * If the map extent was not reset, the box size can fits in the defined\n * ratio sizes. This method then checks if is contained inside the overview\n * map current extent. If not, recenter the overview map to the current\n * main map center location.\n * @private\n */\n validateExtent_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n if (this.viewExtent_ && equalsExtent(extent, this.viewExtent_)) {\n // repeats of the same extent may indicate constraint conflicts leading to an endless cycle\n return;\n }\n this.viewExtent_ = extent;\n\n const ovmapSize = /** @type {import(\"../size.js\").Size} */ (\n ovmap.getSize()\n );\n\n const ovview = ovmap.getView();\n const ovextent = ovview.calculateExtentInternal(ovmapSize);\n\n const topLeftPixel = ovmap.getPixelFromCoordinateInternal(\n getTopLeft(extent),\n );\n const bottomRightPixel = ovmap.getPixelFromCoordinateInternal(\n getBottomRight(extent),\n );\n\n const boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);\n const boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);\n\n const ovmapWidth = ovmapSize[0];\n const ovmapHeight = ovmapSize[1];\n\n if (\n boxWidth < ovmapWidth * MIN_RATIO ||\n boxHeight < ovmapHeight * MIN_RATIO ||\n boxWidth > ovmapWidth * MAX_RATIO ||\n boxHeight > ovmapHeight * MAX_RATIO\n ) {\n this.resetExtent_();\n } else if (!containsExtent(ovextent, extent)) {\n this.recenter_();\n }\n }\n\n /**\n * Reset the overview map extent to half calculated min and max ratio times\n * the extent of the main map.\n * @private\n */\n resetExtent_() {\n if (MAX_RATIO === 0 || MIN_RATIO === 0) {\n return;\n }\n\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n const ovview = ovmap.getView();\n\n // get how many times the current map overview could hold different\n // box sizes using the min and max ratio, pick the step in the middle used\n // to calculate the extent from the main map to set it to the overview map,\n const steps = Math.log(MAX_RATIO / MIN_RATIO) / Math.LN2;\n const ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO);\n scaleFromCenter(extent, ratio);\n ovview.fitInternal(polygonFromExtent(extent));\n }\n\n /**\n * Set the center of the overview map to the map center without changing its\n * resolution.\n * @private\n */\n recenter_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n ovview.setCenterInternal(view.getCenterInternal());\n }\n\n /**\n * Update the box using the main map extent\n * @private\n */\n updateBox_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n const rotation = this.rotateWithView_ ? 0 : -view.getRotation();\n\n const overlay = this.boxOverlay_;\n const box = this.boxOverlay_.getElement();\n const center = view.getCenter();\n const resolution = view.getResolution();\n const ovresolution = ovview.getResolution();\n const width = (mapSize[0] * resolution) / ovresolution;\n const height = (mapSize[1] * resolution) / ovresolution;\n\n // set position using center coordinates\n overlay.setPosition(center);\n\n // set box size calculated from map extent size and overview map resolution\n if (box) {\n box.style.width = width + 'px';\n box.style.height = height + 'px';\n const transform = 'rotate(' + rotation + 'rad)';\n box.style.transform = transform;\n }\n }\n\n /**\n * @private\n */\n updateBoxAfterOvmapIsRendered_() {\n if (this.ovmapPostrenderKey_) {\n return;\n }\n this.ovmapPostrenderKey_ = listenOnce(\n this.ovmap_,\n MapEventType.POSTRENDER,\n (event) => {\n delete this.ovmapPostrenderKey_;\n this.updateBox_();\n },\n );\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n\n // manage overview map if it had not been rendered before and control\n // is expanded\n const ovmap = this.ovmap_;\n if (!this.collapsed_) {\n if (ovmap.isRendered()) {\n this.viewExtent_ = undefined;\n ovmap.render();\n return;\n }\n ovmap.updateSize();\n this.resetExtent_();\n this.updateBoxAfterOvmapIsRendered_();\n }\n }\n\n /**\n * Return `true` if the overview map is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the overview map should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (!collapsible && this.collapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the overview map according to the passed parameter. Will\n * not do anything if the overview map isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Determine if the overview map is collapsed.\n * @return {boolean} The overview map is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Return `true` if the overview map view can rotate, `false` otherwise.\n * @return {boolean} True if the control view can rotate.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Set whether the overview map view should rotate with the main map view.\n * @param {boolean} rotateWithView True if the control view should rotate.\n * @api\n */\n setRotateWithView(rotateWithView) {\n if (this.rotateWithView_ === rotateWithView) {\n return;\n }\n this.rotateWithView_ = rotateWithView;\n if (this.getMap().getView().getRotation() !== 0) {\n if (this.rotateWithView_) {\n this.handleRotationChanged_();\n } else {\n this.ovmap_.getView().setRotation(0);\n }\n this.viewExtent_ = undefined;\n this.validateExtent_();\n this.updateBox_();\n }\n }\n\n /**\n * Return the overview map.\n * @return {import(\"../Map.js\").default} Overview map.\n * @api\n */\n getOverviewMap() {\n return this.ovmap_;\n }\n\n /**\n * Update the overview map element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.validateExtent_();\n this.updateBox_();\n }\n}\n\nexport default OverviewMap;\n","/**\n * @module ol/control/ScaleLine\n */\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {METERS_PER_UNIT, getPointResolution} from '../proj.js';\nimport Control from './Control.js';\n\n/**\n * @type {string}\n */\nconst UNITS_PROP = 'units';\n\n/**\n * @typedef {'degrees' | 'imperial' | 'nautical' | 'metric' | 'us'} Units\n * Units for the scale line.\n */\n\n/**\n * @const\n * @type {Array<number>}\n */\nconst LEADING_DIGITS = [1, 2, 5];\n\n/**\n * @const\n * @type {number}\n */\nconst DEFAULT_DPI = 25.4 / 0.28;\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:units', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types\n * |'change:units', Return>} ScaleLineOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className] CSS class name. The default is `ol-scale-bar` when configured with\n * `bar: true`. Otherwise the default is `ol-scale-line`.\n * @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {number} [maxWidth] Maximum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {Units} [units='metric'] Units.\n * @property {boolean} [bar=false] Render scalebars instead of a line.\n * @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers\n * for best results. Only applies when `bar` is `true`.\n * @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies\n * when `bar` is `true`.\n * @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies\n * when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.\n */\n\n/**\n * @classdesc\n * A control displaying rough y-axis distances, calculated for the center of the\n * viewport. For conformal projections (e.g. EPSG:3857, the default view\n * projection in OpenLayers), the scale is valid for all directions.\n * No scale line will be shown when the y-axis distance of a pixel at the\n * viewport center cannot be calculated in the view projection.\n * By default the scale line will show in the bottom left portion of the map,\n * but this can be changed by using the css selector `.ol-scale-line`.\n * When specifying `bar` as `true`, a scalebar will be rendered instead\n * of a scaleline.\n * For cartesian measurements of the scaleline, you need to set the\n * `getPointResolution` method of your projection to simply return the input\n * value, e.g. `projection.setGetPointResolution(r => r);`\n *\n * @api\n */\nclass ScaleLine extends Control {\n /**\n * @param {Options} [options] Scale line options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const element = document.createElement('div');\n element.style.pointerEvents = 'none';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n /***\n * @type {ScaleLineOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ScaleLineOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ScaleLineOnSignature<void>}\n */\n this.un;\n\n const className =\n options.className !== undefined\n ? options.className\n : options.bar\n ? 'ol-scale-bar'\n : 'ol-scale-line';\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.innerElement_ = document.createElement('div');\n this.innerElement_.className = className + '-inner';\n\n this.element.className = className + ' ' + CLASS_UNSELECTABLE;\n this.element.appendChild(this.innerElement_);\n\n /**\n * @private\n * @type {?import(\"../View.js\").State}\n */\n this.viewState_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.maxWidth_ = options.maxWidth;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderedWidth_ = undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = '';\n\n this.addChangeListener(UNITS_PROP, this.handleUnitsChanged_);\n\n this.setUnits(options.units || 'metric');\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBar_ = options.bar || false;\n\n /**\n * @private\n * @type {number}\n */\n this.scaleBarSteps_ = options.steps || 4;\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBarText_ = options.text || false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.dpi_ = options.dpi || undefined;\n }\n\n /**\n * Return the units to use in the scale line.\n * @return {Units} The units\n * to use in the scale line.\n * @observable\n * @api\n */\n getUnits() {\n return this.get(UNITS_PROP);\n }\n\n /**\n * @private\n */\n handleUnitsChanged_() {\n this.updateElement_();\n }\n\n /**\n * Set the units to use in the scale line.\n * @param {Units} units The units to use in the scale line.\n * @observable\n * @api\n */\n setUnits(units) {\n this.set(UNITS_PROP, units);\n }\n\n /**\n * Specify the dpi of output device such as printer.\n * @param {number|undefined} dpi The dpi of output device.\n * @api\n */\n setDpi(dpi) {\n this.dpi_ = dpi;\n }\n\n /**\n * @private\n */\n updateElement_() {\n const viewState = this.viewState_;\n\n if (!viewState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const center = viewState.center;\n const projection = viewState.projection;\n const units = this.getUnits();\n const pointResolutionUnits = units == 'degrees' ? 'degrees' : 'm';\n let pointResolution = getPointResolution(\n projection,\n viewState.resolution,\n center,\n pointResolutionUnits,\n );\n\n const minWidth =\n (this.minWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI;\n\n const maxWidth =\n this.maxWidth_ !== undefined\n ? (this.maxWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI\n : undefined;\n\n let nominalCount = minWidth * pointResolution;\n let suffix = '';\n if (units == 'degrees') {\n const metersPerDegree = METERS_PER_UNIT.degrees;\n nominalCount *= metersPerDegree;\n if (nominalCount < metersPerDegree / 60) {\n suffix = '\\u2033'; // seconds\n pointResolution *= 3600;\n } else if (nominalCount < metersPerDegree) {\n suffix = '\\u2032'; // minutes\n pointResolution *= 60;\n } else {\n suffix = '\\u00b0'; // degrees\n }\n } else if (units == 'imperial') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution /= 0.0254;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.3048;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.344;\n }\n } else if (units == 'nautical') {\n pointResolution /= 1852;\n suffix = 'NM';\n } else if (units == 'metric') {\n if (nominalCount < 1e-6) {\n suffix = 'nm';\n pointResolution *= 1e9;\n } else if (nominalCount < 0.001) {\n suffix = 'μm';\n pointResolution *= 1000000;\n } else if (nominalCount < 1) {\n suffix = 'mm';\n pointResolution *= 1000;\n } else if (nominalCount < 1000) {\n suffix = 'm';\n } else {\n suffix = 'km';\n pointResolution /= 1000;\n }\n } else if (units == 'us') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution *= 39.37;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.30480061;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.3472;\n }\n } else {\n throw new Error('Invalid units');\n }\n\n let i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10));\n let count, width, decimalCount;\n let previousCount = 0;\n let previousWidth, previousDecimalCount;\n while (true) {\n decimalCount = Math.floor(i / 3);\n const decimal = Math.pow(10, decimalCount);\n count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;\n width = Math.round(count / pointResolution);\n if (isNaN(width)) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n return;\n }\n if (maxWidth !== undefined && width >= maxWidth) {\n count = previousCount;\n width = previousWidth;\n decimalCount = previousDecimalCount;\n break;\n } else if (width >= minWidth) {\n break;\n }\n previousCount = count;\n previousWidth = width;\n previousDecimalCount = decimalCount;\n ++i;\n }\n const html = this.scaleBar_\n ? this.createScaleBar(width, count, suffix)\n : count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;\n\n if (this.renderedHTML_ != html) {\n this.innerElement_.innerHTML = html;\n this.renderedHTML_ = html;\n }\n\n if (this.renderedWidth_ != width) {\n this.innerElement_.style.width = width + 'px';\n this.renderedWidth_ = width;\n }\n\n if (!this.renderedVisible_) {\n this.element.style.display = '';\n this.renderedVisible_ = true;\n }\n }\n\n /**\n * @private\n * @param {number} width The current width of the scalebar.\n * @param {number} scale The current scale.\n * @param {string} suffix The suffix to append to the scale text.\n * @return {string} The stringified HTML of the scalebar.\n */\n createScaleBar(width, scale, suffix) {\n const resolutionScale = this.getScaleForResolution();\n const mapScale =\n resolutionScale < 1\n ? Math.round(1 / resolutionScale).toLocaleString() + ' : 1'\n : '1 : ' + Math.round(resolutionScale).toLocaleString();\n const steps = this.scaleBarSteps_;\n const stepWidth = width / steps;\n const scaleSteps = [this.createMarker('absolute')];\n for (let i = 0; i < steps; ++i) {\n const cls =\n i % 2 === 0 ? 'ol-scale-singlebar-odd' : 'ol-scale-singlebar-even';\n scaleSteps.push(\n '<div>' +\n '<div ' +\n `class=\"ol-scale-singlebar ${cls}\" ` +\n `style=\"width: ${stepWidth}px;\"` +\n '>' +\n '</div>' +\n this.createMarker('relative') +\n // render text every second step, except when only 2 steps\n (i % 2 === 0 || steps === 2\n ? this.createStepText(i, width, false, scale, suffix)\n : '') +\n '</div>',\n );\n }\n // render text at the end\n scaleSteps.push(this.createStepText(steps, width, true, scale, suffix));\n\n const scaleBarText = this.scaleBarText_\n ? `<div class=\"ol-scale-text\" style=\"width: ${width}px;\">` +\n mapScale +\n '</div>'\n : '';\n return scaleBarText + scaleSteps.join('');\n }\n\n /**\n * Creates a marker at given position\n * @param {'absolute'|'relative'} position The position, absolute or relative\n * @return {string} The stringified div containing the marker\n */\n createMarker(position) {\n const top = position === 'absolute' ? 3 : -10;\n return (\n '<div ' +\n 'class=\"ol-scale-step-marker\" ' +\n `style=\"position: ${position}; top: ${top}px;\"` +\n '></div>'\n );\n }\n\n /**\n * Creates the label for a marker marker at given position\n * @param {number} i The iterator\n * @param {number} width The width the scalebar will currently use\n * @param {boolean} isLast Flag indicating if we add the last step text\n * @param {number} scale The current scale for the whole scalebar\n * @param {string} suffix The suffix for the scale\n * @return {string} The stringified div containing the step text\n */\n createStepText(i, width, isLast, scale, suffix) {\n const length =\n i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_) * i * 100) / 100;\n const lengthString = length + (i === 0 ? '' : ' ' + suffix);\n const margin = i === 0 ? -3 : (width / this.scaleBarSteps_) * -1;\n const minWidth = i === 0 ? 0 : (width / this.scaleBarSteps_) * 2;\n return (\n '<div ' +\n 'class=\"ol-scale-step-text\" ' +\n 'style=\"' +\n `margin-left: ${margin}px;` +\n `text-align: ${i === 0 ? 'left' : 'center'};` +\n `min-width: ${minWidth}px;` +\n `left: ${isLast ? width + 'px' : 'unset'};` +\n '\">' +\n lengthString +\n '</div>'\n );\n }\n\n /**\n * Returns the appropriate scale for the given resolution and units.\n * @return {number} The appropriate scale.\n */\n getScaleForResolution() {\n const resolution = getPointResolution(\n this.viewState_.projection,\n this.viewState_.resolution,\n this.viewState_.center,\n 'm',\n );\n const dpi = this.dpi_ || DEFAULT_DPI;\n const inchesPerMeter = 1000 / 25.4;\n return resolution * inchesPerMeter * dpi;\n }\n\n /**\n * Update the scale line element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.viewState_ = null;\n } else {\n this.viewState_ = frameState.viewState;\n }\n this.updateElement_();\n }\n}\n\nexport default ScaleLine;\n","/**\n * @module ol/control/ZoomSlider\n */\n\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\nimport {stopPropagation} from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {clamp} from '../math.js';\nimport PointerEventType from '../pointer/EventType.js';\nimport Control from './Control.js';\n\n/**\n * The enum for available directions.\n *\n * @enum {number}\n */\nconst Direction = {\n VERTICAL: 0,\n HORIZONTAL: 1,\n};\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-zoomslider'] CSS class name.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A slider type of control for zooming.\n *\n * Example:\n *\n * map.addControl(new ZoomSlider());\n *\n * @api\n */\nclass ZoomSlider extends Control {\n /**\n * @param {Options} [options] Zoom slider options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n target: options.target,\n element: document.createElement('div'),\n render: options.render,\n });\n\n /**\n * @type {!Array<import(\"../events.js\").EventsKey>}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * Will hold the current resolution of the view.\n *\n * @type {number|undefined}\n * @private\n */\n this.currentResolution_ = undefined;\n\n /**\n * The direction of the slider. Will be determined from actual display of the\n * container and defaults to Direction.VERTICAL.\n *\n * @type {Direction}\n * @private\n */\n this.direction_ = Direction.VERTICAL;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_;\n\n /**\n * @type {number}\n * @private\n */\n this.heightLimit_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.widthLimit_ = 0;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startX_;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startY_;\n\n /**\n * The calculated thumb size (border box plus margins). Set when initSlider_\n * is called.\n * @type {import(\"../size.js\").Size}\n * @private\n */\n this.thumbSize_ = null;\n\n /**\n * Whether the slider is initialized.\n * @type {boolean}\n * @private\n */\n this.sliderInitialized_ = false;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoomslider';\n const thumbElement = document.createElement('button');\n thumbElement.setAttribute('type', 'button');\n thumbElement.className = className + '-thumb ' + CLASS_UNSELECTABLE;\n const containerElement = this.element;\n containerElement.className =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n containerElement.appendChild(thumbElement);\n\n containerElement.addEventListener(\n PointerEventType.POINTERDOWN,\n this.handleDraggerStart_.bind(this),\n false,\n );\n containerElement.addEventListener(\n PointerEventType.POINTERMOVE,\n this.handleDraggerDrag_.bind(this),\n false,\n );\n containerElement.addEventListener(\n PointerEventType.POINTERUP,\n this.handleDraggerEnd_.bind(this),\n false,\n );\n\n containerElement.addEventListener(\n EventType.CLICK,\n this.handleContainerClick_.bind(this),\n false,\n );\n thumbElement.addEventListener(EventType.CLICK, stopPropagation, false);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n * @override\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n map.render();\n }\n }\n\n /**\n * Initializes the slider element. This will determine and set this controls\n * direction_ and also constrain the dragging of the thumb to always be within\n * the bounds of the container.\n *\n * @return {boolean} Initialization successful\n * @private\n */\n initSlider_() {\n const container = this.element;\n let containerWidth = container.offsetWidth;\n let containerHeight = container.offsetHeight;\n if (containerWidth === 0 && containerHeight === 0) {\n return (this.sliderInitialized_ = false);\n }\n\n const containerStyle = getComputedStyle(container);\n containerWidth -=\n parseFloat(containerStyle['paddingRight']) +\n parseFloat(containerStyle['paddingLeft']);\n containerHeight -=\n parseFloat(containerStyle['paddingTop']) +\n parseFloat(containerStyle['paddingBottom']);\n const thumb = /** @type {HTMLElement} */ (container.firstElementChild);\n const thumbStyle = getComputedStyle(thumb);\n const thumbWidth =\n thumb.offsetWidth +\n parseFloat(thumbStyle['marginRight']) +\n parseFloat(thumbStyle['marginLeft']);\n const thumbHeight =\n thumb.offsetHeight +\n parseFloat(thumbStyle['marginTop']) +\n parseFloat(thumbStyle['marginBottom']);\n this.thumbSize_ = [thumbWidth, thumbHeight];\n\n if (containerWidth > containerHeight) {\n this.direction_ = Direction.HORIZONTAL;\n this.widthLimit_ = containerWidth - thumbWidth;\n } else {\n this.direction_ = Direction.VERTICAL;\n this.heightLimit_ = containerHeight - thumbHeight;\n }\n return (this.sliderInitialized_ = true);\n }\n\n /**\n * @param {PointerEvent} event The browser event to handle.\n * @private\n */\n handleContainerClick_(event) {\n const view = this.getMap().getView();\n\n const relativePosition = this.getRelativePosition_(\n event.offsetX - this.thumbSize_[0] / 2,\n event.offsetY - this.thumbSize_[1] / 2,\n );\n\n const resolution = this.getResolutionForPosition_(relativePosition);\n const zoom = view.getConstrainedZoom(view.getZoomForResolution(resolution));\n\n view.animateInternal({\n zoom: zoom,\n duration: this.duration_,\n easing: easeOut,\n });\n }\n\n /**\n * Handle dragger start events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerStart_(event) {\n if (!this.dragging_ && event.target === this.element.firstElementChild) {\n const element = /** @type {HTMLElement} */ (\n this.element.firstElementChild\n );\n this.getMap().getView().beginInteraction();\n this.startX_ = event.clientX - parseFloat(element.style.left);\n this.startY_ = event.clientY - parseFloat(element.style.top);\n this.dragging_ = true;\n\n if (this.dragListenerKeys_.length === 0) {\n const drag = this.handleDraggerDrag_;\n const end = this.handleDraggerEnd_;\n const doc = this.getMap().getOwnerDocument();\n this.dragListenerKeys_.push(\n listen(doc, PointerEventType.POINTERMOVE, drag, this),\n listen(doc, PointerEventType.POINTERUP, end, this),\n );\n }\n }\n }\n\n /**\n * Handle dragger drag events.\n *\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerDrag_(event) {\n if (this.dragging_) {\n const deltaX = event.clientX - this.startX_;\n const deltaY = event.clientY - this.startY_;\n const relativePosition = this.getRelativePosition_(deltaX, deltaY);\n this.currentResolution_ =\n this.getResolutionForPosition_(relativePosition);\n this.getMap().getView().setResolution(this.currentResolution_);\n }\n }\n\n /**\n * Handle dragger end events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerEnd_(event) {\n if (this.dragging_) {\n const view = this.getMap().getView();\n view.endInteraction();\n\n this.dragging_ = false;\n this.startX_ = undefined;\n this.startY_ = undefined;\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n }\n }\n\n /**\n * Positions the thumb inside its container according to the given resolution.\n *\n * @param {number} res The res.\n * @private\n */\n setThumbPosition_(res) {\n const position = this.getPositionForResolution_(res);\n const thumb = /** @type {HTMLElement} */ (this.element.firstElementChild);\n\n if (this.direction_ == Direction.HORIZONTAL) {\n thumb.style.left = this.widthLimit_ * position + 'px';\n } else {\n thumb.style.top = this.heightLimit_ * position + 'px';\n }\n }\n\n /**\n * Calculates the relative position of the thumb given x and y offsets. The\n * relative position scales from 0 to 1. The x and y offsets are assumed to be\n * in pixel units within the dragger limits.\n *\n * @param {number} x Pixel position relative to the left of the slider.\n * @param {number} y Pixel position relative to the top of the slider.\n * @return {number} The relative position of the thumb.\n * @private\n */\n getRelativePosition_(x, y) {\n let amount;\n if (this.direction_ === Direction.HORIZONTAL) {\n amount = x / this.widthLimit_;\n } else {\n amount = y / this.heightLimit_;\n }\n return clamp(amount, 0, 1);\n }\n\n /**\n * Calculates the corresponding resolution of the thumb given its relative\n * position (where 0 is the minimum and 1 is the maximum).\n *\n * @param {number} position The relative position of the thumb.\n * @return {number} The corresponding resolution.\n * @private\n */\n getResolutionForPosition_(position) {\n const fn = this.getMap().getView().getResolutionForValueFunction();\n return fn(1 - position);\n }\n\n /**\n * Determines the relative position of the slider for the given resolution. A\n * relative position of 0 corresponds to the minimum view resolution. A\n * relative position of 1 corresponds to the maximum view resolution.\n *\n * @param {number} res The resolution.\n * @return {number} The relative position value (between 0 and 1).\n * @private\n */\n getPositionForResolution_(res) {\n const fn = this.getMap().getView().getValueForResolutionFunction();\n return clamp(1 - fn(res), 0, 1);\n }\n\n /**\n * Update the zoomslider element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n if (!mapEvent.frameState) {\n return;\n }\n if (!this.sliderInitialized_ && !this.initSlider_()) {\n return;\n }\n const res = mapEvent.frameState.viewState.resolution;\n this.currentResolution_ = res;\n this.setThumbPosition_(res);\n }\n}\n\nexport default ZoomSlider;\n","import {CollectionEvent as _ol_Collection$CollectionEvent} from '../../ol/Collection.js';\nimport $ol$Collection from '../../ol/Collection.js';\nimport {asImageLike as _ol_DataTile$asImageLike} from '../../ol/DataTile.js';\nimport {asArrayLike as _ol_DataTile$asArrayLike} from '../../ol/DataTile.js';\nimport {disposedError as _ol_DataTile$disposedError} from '../../ol/DataTile.js';\nimport {toArray as _ol_DataTile$toArray} from '../../ol/DataTile.js';\nimport $ol$DataTile from '../../ol/DataTile.js';\nimport $ol$Disposable from '../../ol/Disposable.js';\nimport $ol$Feature from '../../ol/Feature.js';\nimport {createStyleFunction as _ol_Feature$createStyleFunction} from '../../ol/Feature.js';\nimport {GeolocationError as _ol_Geolocation$GeolocationError} from '../../ol/Geolocation.js';\nimport $ol$Geolocation from '../../ol/Geolocation.js';\nimport $ol$Image from '../../ol/Image.js';\nimport {listenImage as _ol_Image$listenImage} from '../../ol/Image.js';\nimport {load as _ol_Image$load} from '../../ol/Image.js';\nimport {decodeFallback as _ol_Image$decodeFallback} from '../../ol/Image.js';\nimport {decode as _ol_Image$decode} from '../../ol/Image.js';\nimport $ol$ImageCanvas from '../../ol/ImageCanvas.js';\nimport $ol$ImageTile from '../../ol/ImageTile.js';\nimport $ol$Kinetic from '../../ol/Kinetic.js';\nimport $ol$Map from '../../ol/Map.js';\nimport $ol$MapBrowserEvent from '../../ol/MapBrowserEvent.js';\nimport $ol$MapBrowserEventHandler from '../../ol/MapBrowserEventHandler.js';\nimport $ol$MapEvent from '../../ol/MapEvent.js';\nimport {ObjectEvent as _ol_Object$ObjectEvent} from '../../ol/Object.js';\nimport $ol$Object from '../../ol/Object.js';\nimport $ol$Observable from '../../ol/Observable.js';\nimport {unByKey as _ol_Observable$unByKey} from '../../ol/Observable.js';\nimport $ol$Overlay from '../../ol/Overlay.js';\nimport $ol$Tile from '../../ol/Tile.js';\nimport $ol$TileQueue from '../../ol/TileQueue.js';\nimport {getTilePriority as _ol_TileQueue$getTilePriority} from '../../ol/TileQueue.js';\nimport $ol$TileRange from '../../ol/TileRange.js';\nimport {createOrUpdate as _ol_TileRange$createOrUpdate} from '../../ol/TileRange.js';\nimport $ol$VectorRenderTile from '../../ol/VectorRenderTile.js';\nimport $ol$VectorTile from '../../ol/VectorTile.js';\nimport $ol$View from '../../ol/View.js';\nimport {createCenterConstraint as _ol_View$createCenterConstraint} from '../../ol/View.js';\nimport {createResolutionConstraint as _ol_View$createResolutionConstraint} from '../../ol/View.js';\nimport {createRotationConstraint as _ol_View$createRotationConstraint} from '../../ol/View.js';\nimport {isNoopAnimation as _ol_View$isNoopAnimation} from '../../ol/View.js';\nimport {binarySearch as _ol_array$binarySearch} from '../../ol/array.js';\nimport {ascending as _ol_array$ascending} from '../../ol/array.js';\nimport {descending as _ol_array$descending} from '../../ol/array.js';\nimport {linearFindNearest as _ol_array$linearFindNearest} from '../../ol/array.js';\nimport {reverseSubArray as _ol_array$reverseSubArray} from '../../ol/array.js';\nimport {extend as _ol_array$extend} from '../../ol/array.js';\nimport {remove as _ol_array$remove} from '../../ol/array.js';\nimport {equals as _ol_array$equals} from '../../ol/array.js';\nimport {stableSort as _ol_array$stableSort} from '../../ol/array.js';\nimport {isSorted as _ol_array$isSorted} from '../../ol/array.js';\nimport {assert as _ol_asserts$assert} from '../../ol/asserts.js';\nimport {createExtent as _ol_centerconstraint$createExtent} from '../../ol/centerconstraint.js';\nimport {none as _ol_centerconstraint$none} from '../../ol/centerconstraint.js';\nimport {NO_COLOR as _ol_color$NO_COLOR} from '../../ol/color.js';\nimport {asString as _ol_color$asString} from '../../ol/color.js';\nimport {withAlpha as _ol_color$withAlpha} from '../../ol/color.js';\nimport {rgbaToLcha as _ol_color$rgbaToLcha} from '../../ol/color.js';\nimport {lchaToRgba as _ol_color$lchaToRgba} from '../../ol/color.js';\nimport {fromString as _ol_color$fromString} from '../../ol/color.js';\nimport {asArray as _ol_color$asArray} from '../../ol/color.js';\nimport {toString as _ol_color$toString} from '../../ol/color.js';\nimport {isStringColor as _ol_color$isStringColor} from '../../ol/color.js';\nimport {asColorLike as _ol_colorlike$asColorLike} from '../../ol/colorlike.js';\nimport {setLevel as _ol_console$setLevel} from '../../ol/console.js';\nimport {log as _ol_console$log} from '../../ol/console.js';\nimport {warn as _ol_console$warn} from '../../ol/console.js';\nimport {error as _ol_console$error} from '../../ol/console.js';\nimport {add as _ol_coordinate$add} from '../../ol/coordinate.js';\nimport {closestOnCircle as _ol_coordinate$closestOnCircle} from '../../ol/coordinate.js';\nimport {closestOnSegment as _ol_coordinate$closestOnSegment} from '../../ol/coordinate.js';\nimport {createStringXY as _ol_coordinate$createStringXY} from '../../ol/coordinate.js';\nimport {degreesToStringHDMS as _ol_coordinate$degreesToStringHDMS} from '../../ol/coordinate.js';\nimport {format as _ol_coordinate$format} from '../../ol/coordinate.js';\nimport {equals as _ol_coordinate$equals} from '../../ol/coordinate.js';\nimport {rotate as _ol_coordinate$rotate} from '../../ol/coordinate.js';\nimport {scale as _ol_coordinate$scale} from '../../ol/coordinate.js';\nimport {squaredDistance as _ol_coordinate$squaredDistance} from '../../ol/coordinate.js';\nimport {distance as _ol_coordinate$distance} from '../../ol/coordinate.js';\nimport {squaredDistanceToSegment as _ol_coordinate$squaredDistanceToSegment} from '../../ol/coordinate.js';\nimport {toStringHDMS as _ol_coordinate$toStringHDMS} from '../../ol/coordinate.js';\nimport {toStringXY as _ol_coordinate$toStringXY} from '../../ol/coordinate.js';\nimport {wrapX as _ol_coordinate$wrapX} from '../../ol/coordinate.js';\nimport {getWorldsAway as _ol_coordinate$getWorldsAway} from '../../ol/coordinate.js';\nimport {CLASS_HIDDEN as _ol_css$CLASS_HIDDEN} from '../../ol/css.js';\nimport {CLASS_SELECTABLE as _ol_css$CLASS_SELECTABLE} from '../../ol/css.js';\nimport {CLASS_UNSELECTABLE as _ol_css$CLASS_UNSELECTABLE} from '../../ol/css.js';\nimport {CLASS_UNSUPPORTED as _ol_css$CLASS_UNSUPPORTED} from '../../ol/css.js';\nimport {CLASS_CONTROL as _ol_css$CLASS_CONTROL} from '../../ol/css.js';\nimport {CLASS_COLLAPSED as _ol_css$CLASS_COLLAPSED} from '../../ol/css.js';\nimport {fontWeights as _ol_css$fontWeights} from '../../ol/css.js';\nimport {getFontParameters as _ol_css$getFontParameters} from '../../ol/css.js';\nimport {createCanvasContext2D as _ol_dom$createCanvasContext2D} from '../../ol/dom.js';\nimport {getSharedCanvasContext2D as _ol_dom$getSharedCanvasContext2D} from '../../ol/dom.js';\nimport {releaseCanvas as _ol_dom$releaseCanvas} from '../../ol/dom.js';\nimport {outerWidth as _ol_dom$outerWidth} from '../../ol/dom.js';\nimport {outerHeight as _ol_dom$outerHeight} from '../../ol/dom.js';\nimport {replaceNode as _ol_dom$replaceNode} from '../../ol/dom.js';\nimport {removeChildren as _ol_dom$removeChildren} from '../../ol/dom.js';\nimport {replaceChildren as _ol_dom$replaceChildren} from '../../ol/dom.js';\nimport {easeIn as _ol_easing$easeIn} from '../../ol/easing.js';\nimport {easeOut as _ol_easing$easeOut} from '../../ol/easing.js';\nimport {inAndOut as _ol_easing$inAndOut} from '../../ol/easing.js';\nimport {linear as _ol_easing$linear} from '../../ol/easing.js';\nimport {upAndDown as _ol_easing$upAndDown} from '../../ol/easing.js';\nimport {listen as _ol_events$listen} from '../../ol/events.js';\nimport {listenOnce as _ol_events$listenOnce} from '../../ol/events.js';\nimport {unlistenByKey as _ol_events$unlistenByKey} from '../../ol/events.js';\nimport {boundingExtent as _ol_extent$boundingExtent} from '../../ol/extent.js';\nimport {buffer as _ol_extent$buffer} from '../../ol/extent.js';\nimport {clone as _ol_extent$clone} from '../../ol/extent.js';\nimport {closestSquaredDistanceXY as _ol_extent$closestSquaredDistanceXY} from '../../ol/extent.js';\nimport {containsCoordinate as _ol_extent$containsCoordinate} from '../../ol/extent.js';\nimport {containsExtent as _ol_extent$containsExtent} from '../../ol/extent.js';\nimport {containsXY as _ol_extent$containsXY} from '../../ol/extent.js';\nimport {coordinateRelationship as _ol_extent$coordinateRelationship} from '../../ol/extent.js';\nimport {createEmpty as _ol_extent$createEmpty} from '../../ol/extent.js';\nimport {createOrUpdate as _ol_extent$createOrUpdate} from '../../ol/extent.js';\nimport {createOrUpdateEmpty as _ol_extent$createOrUpdateEmpty} from '../../ol/extent.js';\nimport {createOrUpdateFromCoordinate as _ol_extent$createOrUpdateFromCoordinate} from '../../ol/extent.js';\nimport {createOrUpdateFromCoordinates as _ol_extent$createOrUpdateFromCoordinates} from '../../ol/extent.js';\nimport {createOrUpdateFromFlatCoordinates as _ol_extent$createOrUpdateFromFlatCoordinates} from '../../ol/extent.js';\nimport {createOrUpdateFromRings as _ol_extent$createOrUpdateFromRings} from '../../ol/extent.js';\nimport {equals as _ol_extent$equals} from '../../ol/extent.js';\nimport {approximatelyEquals as _ol_extent$approximatelyEquals} from '../../ol/extent.js';\nimport {extend as _ol_extent$extend} from '../../ol/extent.js';\nimport {extendCoordinate as _ol_extent$extendCoordinate} from '../../ol/extent.js';\nimport {extendCoordinates as _ol_extent$extendCoordinates} from '../../ol/extent.js';\nimport {extendFlatCoordinates as _ol_extent$extendFlatCoordinates} from '../../ol/extent.js';\nimport {extendRings as _ol_extent$extendRings} from '../../ol/extent.js';\nimport {extendXY as _ol_extent$extendXY} from '../../ol/extent.js';\nimport {forEachCorner as _ol_extent$forEachCorner} from '../../ol/extent.js';\nimport {getArea as _ol_extent$getArea} from '../../ol/extent.js';\nimport {getBottomLeft as _ol_extent$getBottomLeft} from '../../ol/extent.js';\nimport {getBottomRight as _ol_extent$getBottomRight} from '../../ol/extent.js';\nimport {getCenter as _ol_extent$getCenter} from '../../ol/extent.js';\nimport {getCorner as _ol_extent$getCorner} from '../../ol/extent.js';\nimport {getEnlargedArea as _ol_extent$getEnlargedArea} from '../../ol/extent.js';\nimport {getForViewAndSize as _ol_extent$getForViewAndSize} from '../../ol/extent.js';\nimport {getRotatedViewport as _ol_extent$getRotatedViewport} from '../../ol/extent.js';\nimport {getHeight as _ol_extent$getHeight} from '../../ol/extent.js';\nimport {getIntersectionArea as _ol_extent$getIntersectionArea} from '../../ol/extent.js';\nimport {getIntersection as _ol_extent$getIntersection} from '../../ol/extent.js';\nimport {getMargin as _ol_extent$getMargin} from '../../ol/extent.js';\nimport {getSize as _ol_extent$getSize} from '../../ol/extent.js';\nimport {getTopLeft as _ol_extent$getTopLeft} from '../../ol/extent.js';\nimport {getTopRight as _ol_extent$getTopRight} from '../../ol/extent.js';\nimport {getWidth as _ol_extent$getWidth} from '../../ol/extent.js';\nimport {intersects as _ol_extent$intersects} from '../../ol/extent.js';\nimport {isEmpty as _ol_extent$isEmpty} from '../../ol/extent.js';\nimport {returnOrUpdate as _ol_extent$returnOrUpdate} from '../../ol/extent.js';\nimport {scaleFromCenter as _ol_extent$scaleFromCenter} from '../../ol/extent.js';\nimport {intersectsSegment as _ol_extent$intersectsSegment} from '../../ol/extent.js';\nimport {applyTransform as _ol_extent$applyTransform} from '../../ol/extent.js';\nimport {wrapX as _ol_extent$wrapX} from '../../ol/extent.js';\nimport {wrapAndSliceX as _ol_extent$wrapAndSliceX} from '../../ol/extent.js';\nimport {loadFeaturesXhr as _ol_featureloader$loadFeaturesXhr} from '../../ol/featureloader.js';\nimport {xhr as _ol_featureloader$xhr} from '../../ol/featureloader.js';\nimport {setWithCredentials as _ol_featureloader$setWithCredentials} from '../../ol/featureloader.js';\nimport {TRUE as _ol_functions$TRUE} from '../../ol/functions.js';\nimport {FALSE as _ol_functions$FALSE} from '../../ol/functions.js';\nimport {VOID as _ol_functions$VOID} from '../../ol/functions.js';\nimport {memoizeOne as _ol_functions$memoizeOne} from '../../ol/functions.js';\nimport {toPromise as _ol_functions$toPromise} from '../../ol/functions.js';\nimport {SAFARI as _ol_has$SAFARI} from '../../ol/has.js';\nimport {SAFARI_BUG_237906 as _ol_has$SAFARI_BUG_237906} from '../../ol/has.js';\nimport {WEBKIT as _ol_has$WEBKIT} from '../../ol/has.js';\nimport {MAC as _ol_has$MAC} from '../../ol/has.js';\nimport {DEVICE_PIXEL_RATIO as _ol_has$DEVICE_PIXEL_RATIO} from '../../ol/has.js';\nimport {WORKER_OFFSCREEN_CANVAS as _ol_has$WORKER_OFFSCREEN_CANVAS} from '../../ol/has.js';\nimport {IMAGE_DECODE as _ol_has$IMAGE_DECODE} from '../../ol/has.js';\nimport {CREATE_IMAGE_BITMAP as _ol_has$CREATE_IMAGE_BITMAP} from '../../ol/has.js';\nimport {PASSIVE_EVENT_LISTENERS as _ol_has$PASSIVE_EVENT_LISTENERS} from '../../ol/has.js';\nimport {all as _ol_loadingstrategy$all} from '../../ol/loadingstrategy.js';\nimport {bbox as _ol_loadingstrategy$bbox} from '../../ol/loadingstrategy.js';\nimport {tile as _ol_loadingstrategy$tile} from '../../ol/loadingstrategy.js';\nimport {clamp as _ol_math$clamp} from '../../ol/math.js';\nimport {squaredSegmentDistance as _ol_math$squaredSegmentDistance} from '../../ol/math.js';\nimport {squaredDistance as _ol_math$squaredDistance} from '../../ol/math.js';\nimport {solveLinearSystem as _ol_math$solveLinearSystem} from '../../ol/math.js';\nimport {toDegrees as _ol_math$toDegrees} from '../../ol/math.js';\nimport {toRadians as _ol_math$toRadians} from '../../ol/math.js';\nimport {modulo as _ol_math$modulo} from '../../ol/math.js';\nimport {lerp as _ol_math$lerp} from '../../ol/math.js';\nimport {toFixed as _ol_math$toFixed} from '../../ol/math.js';\nimport {round as _ol_math$round} from '../../ol/math.js';\nimport {floor as _ol_math$floor} from '../../ol/math.js';\nimport {ceil as _ol_math$ceil} from '../../ol/math.js';\nimport {wrap as _ol_math$wrap} from '../../ol/math.js';\nimport {jsonp as _ol_net$jsonp} from '../../ol/net.js';\nimport {ResponseError as _ol_net$ResponseError} from '../../ol/net.js';\nimport {ClientError as _ol_net$ClientError} from '../../ol/net.js';\nimport {getJSON as _ol_net$getJSON} from '../../ol/net.js';\nimport {resolveUrl as _ol_net$resolveUrl} from '../../ol/net.js';\nimport {overrideXHR as _ol_net$overrideXHR} from '../../ol/net.js';\nimport {restoreXHR as _ol_net$restoreXHR} from '../../ol/net.js';\nimport {clear as _ol_obj$clear} from '../../ol/obj.js';\nimport {isEmpty as _ol_obj$isEmpty} from '../../ol/obj.js';\nimport {disableCoordinateWarning as _ol_proj$disableCoordinateWarning} from '../../ol/proj.js';\nimport {cloneTransform as _ol_proj$cloneTransform} from '../../ol/proj.js';\nimport {identityTransform as _ol_proj$identityTransform} from '../../ol/proj.js';\nimport {addProjection as _ol_proj$addProjection} from '../../ol/proj.js';\nimport {addProjections as _ol_proj$addProjections} from '../../ol/proj.js';\nimport {get as _ol_proj$get} from '../../ol/proj.js';\nimport {getPointResolution as _ol_proj$getPointResolution} from '../../ol/proj.js';\nimport {addEquivalentProjections as _ol_proj$addEquivalentProjections} from '../../ol/proj.js';\nimport {addEquivalentTransforms as _ol_proj$addEquivalentTransforms} from '../../ol/proj.js';\nimport {clearAllProjections as _ol_proj$clearAllProjections} from '../../ol/proj.js';\nimport {createProjection as _ol_proj$createProjection} from '../../ol/proj.js';\nimport {createTransformFromCoordinateTransform as _ol_proj$createTransformFromCoordinateTransform} from '../../ol/proj.js';\nimport {addCoordinateTransforms as _ol_proj$addCoordinateTransforms} from '../../ol/proj.js';\nimport {fromLonLat as _ol_proj$fromLonLat} from '../../ol/proj.js';\nimport {toLonLat as _ol_proj$toLonLat} from '../../ol/proj.js';\nimport {equivalent as _ol_proj$equivalent} from '../../ol/proj.js';\nimport {getTransformFromProjections as _ol_proj$getTransformFromProjections} from '../../ol/proj.js';\nimport {getTransform as _ol_proj$getTransform} from '../../ol/proj.js';\nimport {transform as _ol_proj$transform} from '../../ol/proj.js';\nimport {transformExtent as _ol_proj$transformExtent} from '../../ol/proj.js';\nimport {transformWithProjections as _ol_proj$transformWithProjections} from '../../ol/proj.js';\nimport {setUserProjection as _ol_proj$setUserProjection} from '../../ol/proj.js';\nimport {clearUserProjection as _ol_proj$clearUserProjection} from '../../ol/proj.js';\nimport {getUserProjection as _ol_proj$getUserProjection} from '../../ol/proj.js';\nimport {useGeographic as _ol_proj$useGeographic} from '../../ol/proj.js';\nimport {toUserCoordinate as _ol_proj$toUserCoordinate} from '../../ol/proj.js';\nimport {fromUserCoordinate as _ol_proj$fromUserCoordinate} from '../../ol/proj.js';\nimport {toUserExtent as _ol_proj$toUserExtent} from '../../ol/proj.js';\nimport {fromUserExtent as _ol_proj$fromUserExtent} from '../../ol/proj.js';\nimport {toUserResolution as _ol_proj$toUserResolution} from '../../ol/proj.js';\nimport {fromUserResolution as _ol_proj$fromUserResolution} from '../../ol/proj.js';\nimport {createSafeCoordinateTransform as _ol_proj$createSafeCoordinateTransform} from '../../ol/proj.js';\nimport {addCommon as _ol_proj$addCommon} from '../../ol/proj.js';\nimport {toContext as _ol_render$toContext} from '../../ol/render.js';\nimport {getVectorContext as _ol_render$getVectorContext} from '../../ol/render.js';\nimport {getRenderPixel as _ol_render$getRenderPixel} from '../../ol/render.js';\nimport {canvasPool as _ol_reproj$canvasPool} from '../../ol/reproj.js';\nimport {calculateSourceResolution as _ol_reproj$calculateSourceResolution} from '../../ol/reproj.js';\nimport {calculateSourceExtentResolution as _ol_reproj$calculateSourceExtentResolution} from '../../ol/reproj.js';\nimport {render as _ol_reproj$render} from '../../ol/reproj.js';\nimport {fromResolutionLike as _ol_resolution$fromResolutionLike} from '../../ol/resolution.js';\nimport {createSnapToResolutions as _ol_resolutionconstraint$createSnapToResolutions} from '../../ol/resolutionconstraint.js';\nimport {createSnapToPower as _ol_resolutionconstraint$createSnapToPower} from '../../ol/resolutionconstraint.js';\nimport {createMinMaxResolution as _ol_resolutionconstraint$createMinMaxResolution} from '../../ol/resolutionconstraint.js';\nimport {disable as _ol_rotationconstraint$disable} from '../../ol/rotationconstraint.js';\nimport {none as _ol_rotationconstraint$none} from '../../ol/rotationconstraint.js';\nimport {createSnapToN as _ol_rotationconstraint$createSnapToN} from '../../ol/rotationconstraint.js';\nimport {createSnapToZero as _ol_rotationconstraint$createSnapToZero} from '../../ol/rotationconstraint.js';\nimport {buffer as _ol_size$buffer} from '../../ol/size.js';\nimport {hasArea as _ol_size$hasArea} from '../../ol/size.js';\nimport {scale as _ol_size$scale} from '../../ol/size.js';\nimport {toSize as _ol_size$toSize} from '../../ol/size.js';\nimport {sourcesFromTileGrid as _ol_source$sourcesFromTileGrid} from '../../ol/source.js';\nimport {DEFAULT_RADIUS as _ol_sphere$DEFAULT_RADIUS} from '../../ol/sphere.js';\nimport {getDistance as _ol_sphere$getDistance} from '../../ol/sphere.js';\nimport {getLength as _ol_sphere$getLength} from '../../ol/sphere.js';\nimport {getArea as _ol_sphere$getArea} from '../../ol/sphere.js';\nimport {offset as _ol_sphere$offset} from '../../ol/sphere.js';\nimport {padNumber as _ol_string$padNumber} from '../../ol/string.js';\nimport {compareVersions as _ol_string$compareVersions} from '../../ol/string.js';\nimport {createOrUpdate as _ol_tilecoord$createOrUpdate} from '../../ol/tilecoord.js';\nimport {getKeyZXY as _ol_tilecoord$getKeyZXY} from '../../ol/tilecoord.js';\nimport {getKey as _ol_tilecoord$getKey} from '../../ol/tilecoord.js';\nimport {getCacheKeyForTileKey as _ol_tilecoord$getCacheKeyForTileKey} from '../../ol/tilecoord.js';\nimport {fromKey as _ol_tilecoord$fromKey} from '../../ol/tilecoord.js';\nimport {hash as _ol_tilecoord$hash} from '../../ol/tilecoord.js';\nimport {hashZXY as _ol_tilecoord$hashZXY} from '../../ol/tilecoord.js';\nimport {withinExtentAndZ as _ol_tilecoord$withinExtentAndZ} from '../../ol/tilecoord.js';\nimport {getForProjection as _ol_tilegrid$getForProjection} from '../../ol/tilegrid.js';\nimport {wrapX as _ol_tilegrid$wrapX} from '../../ol/tilegrid.js';\nimport {createForExtent as _ol_tilegrid$createForExtent} from '../../ol/tilegrid.js';\nimport {createXYZ as _ol_tilegrid$createXYZ} from '../../ol/tilegrid.js';\nimport {createForProjection as _ol_tilegrid$createForProjection} from '../../ol/tilegrid.js';\nimport {extentFromProjection as _ol_tilegrid$extentFromProjection} from '../../ol/tilegrid.js';\nimport {createFromTemplate as _ol_tileurlfunction$createFromTemplate} from '../../ol/tileurlfunction.js';\nimport {createFromTemplates as _ol_tileurlfunction$createFromTemplates} from '../../ol/tileurlfunction.js';\nimport {createFromTileUrlFunctions as _ol_tileurlfunction$createFromTileUrlFunctions} from '../../ol/tileurlfunction.js';\nimport {nullTileUrlFunction as _ol_tileurlfunction$nullTileUrlFunction} from '../../ol/tileurlfunction.js';\nimport {create as _ol_transform$create} from '../../ol/transform.js';\nimport {reset as _ol_transform$reset} from '../../ol/transform.js';\nimport {multiply as _ol_transform$multiply} from '../../ol/transform.js';\nimport {set as _ol_transform$set} from '../../ol/transform.js';\nimport {setFromArray as _ol_transform$setFromArray} from '../../ol/transform.js';\nimport {apply as _ol_transform$apply} from '../../ol/transform.js';\nimport {rotate as _ol_transform$rotate} from '../../ol/transform.js';\nimport {scale as _ol_transform$scale} from '../../ol/transform.js';\nimport {makeScale as _ol_transform$makeScale} from '../../ol/transform.js';\nimport {translate as _ol_transform$translate} from '../../ol/transform.js';\nimport {compose as _ol_transform$compose} from '../../ol/transform.js';\nimport {composeCssTransform as _ol_transform$composeCssTransform} from '../../ol/transform.js';\nimport {invert as _ol_transform$invert} from '../../ol/transform.js';\nimport {makeInverse as _ol_transform$makeInverse} from '../../ol/transform.js';\nimport {determinant as _ol_transform$determinant} from '../../ol/transform.js';\nimport {toString as _ol_transform$toString} from '../../ol/transform.js';\nimport {equivalent as _ol_transform$equivalent} from '../../ol/transform.js';\nimport {appendParams as _ol_uri$appendParams} from '../../ol/uri.js';\nimport {renderXYZTemplate as _ol_uri$renderXYZTemplate} from '../../ol/uri.js';\nimport {pickUrl as _ol_uri$pickUrl} from '../../ol/uri.js';\nimport {expandUrl as _ol_uri$expandUrl} from '../../ol/uri.js';\nimport {abstract as _ol_util$abstract} from '../../ol/util.js';\nimport {getUid as _ol_util$getUid} from '../../ol/util.js';\nimport {VERSION as _ol_util$VERSION} from '../../ol/util.js';\nimport {ARRAY_BUFFER as _ol_webgl$ARRAY_BUFFER} from '../../ol/webgl.js';\nimport {ELEMENT_ARRAY_BUFFER as _ol_webgl$ELEMENT_ARRAY_BUFFER} from '../../ol/webgl.js';\nimport {STREAM_DRAW as _ol_webgl$STREAM_DRAW} from '../../ol/webgl.js';\nimport {STATIC_DRAW as _ol_webgl$STATIC_DRAW} from '../../ol/webgl.js';\nimport {DYNAMIC_DRAW as _ol_webgl$DYNAMIC_DRAW} from '../../ol/webgl.js';\nimport {UNSIGNED_BYTE as _ol_webgl$UNSIGNED_BYTE} from '../../ol/webgl.js';\nimport {UNSIGNED_SHORT as _ol_webgl$UNSIGNED_SHORT} from '../../ol/webgl.js';\nimport {UNSIGNED_INT as _ol_webgl$UNSIGNED_INT} from '../../ol/webgl.js';\nimport {FLOAT as _ol_webgl$FLOAT} from '../../ol/webgl.js';\nimport {getContext as _ol_webgl$getContext} from '../../ol/webgl.js';\nimport {getSupportedExtensions as _ol_webgl$getSupportedExtensions} from '../../ol/webgl.js';\nimport {XML_SCHEMA_INSTANCE_URI as _ol_xml$XML_SCHEMA_INSTANCE_URI} from '../../ol/xml.js';\nimport {createElementNS as _ol_xml$createElementNS} from '../../ol/xml.js';\nimport {getAllTextContent as _ol_xml$getAllTextContent} from '../../ol/xml.js';\nimport {getAllTextContent_ as _ol_xml$getAllTextContent_} from '../../ol/xml.js';\nimport {isDocument as _ol_xml$isDocument} from '../../ol/xml.js';\nimport {getAttributeNS as _ol_xml$getAttributeNS} from '../../ol/xml.js';\nimport {parse as _ol_xml$parse} from '../../ol/xml.js';\nimport {makeArrayExtender as _ol_xml$makeArrayExtender} from '../../ol/xml.js';\nimport {makeArrayPusher as _ol_xml$makeArrayPusher} from '../../ol/xml.js';\nimport {makeReplacer as _ol_xml$makeReplacer} from '../../ol/xml.js';\nimport {makeObjectPropertyPusher as _ol_xml$makeObjectPropertyPusher} from '../../ol/xml.js';\nimport {makeObjectPropertySetter as _ol_xml$makeObjectPropertySetter} from '../../ol/xml.js';\nimport {makeChildAppender as _ol_xml$makeChildAppender} from '../../ol/xml.js';\nimport {makeArraySerializer as _ol_xml$makeArraySerializer} from '../../ol/xml.js';\nimport {makeSimpleNodeFactory as _ol_xml$makeSimpleNodeFactory} from '../../ol/xml.js';\nimport {OBJECT_PROPERTY_NODE_FACTORY as _ol_xml$OBJECT_PROPERTY_NODE_FACTORY} from '../../ol/xml.js';\nimport {makeSequence as _ol_xml$makeSequence} from '../../ol/xml.js';\nimport {makeStructureNS as _ol_xml$makeStructureNS} from '../../ol/xml.js';\nimport {parseNode as _ol_xml$parseNode} from '../../ol/xml.js';\nimport {pushParseAndPop as _ol_xml$pushParseAndPop} from '../../ol/xml.js';\nimport {serialize as _ol_xml$serialize} from '../../ol/xml.js';\nimport {pushSerializeAndPop as _ol_xml$pushSerializeAndPop} from '../../ol/xml.js';\nimport {registerXMLSerializer as _ol_xml$registerXMLSerializer} from '../../ol/xml.js';\nimport {getXMLSerializer as _ol_xml$getXMLSerializer} from '../../ol/xml.js';\nimport {registerDocument as _ol_xml$registerDocument} from '../../ol/xml.js';\nimport {getDocument as _ol_xml$getDocument} from '../../ol/xml.js';\nimport $ol$webgl$BaseTileRepresentation from '../../ol/webgl/BaseTileRepresentation.js';\nimport $ol$webgl$Buffer from '../../ol/webgl/Buffer.js';\nimport {getArrayClassForType as _ol_webgl_Buffer$getArrayClassForType} from '../../ol/webgl/Buffer.js';\nimport {Canvas as _ol_webgl_Canvas$Canvas} from '../../ol/webgl/Canvas.js';\nimport {createProgram as _ol_webgl_Canvas$createProgram} from '../../ol/webgl/Canvas.js';\nimport $ol$webgl$Helper from '../../ol/webgl/Helper.js';\nimport {computeAttributesStride as _ol_webgl_Helper$computeAttributesStride} from '../../ol/webgl/Helper.js';\nimport $ol$webgl$PaletteTexture from '../../ol/webgl/PaletteTexture.js';\nimport $ol$webgl$PostProcessingPass from '../../ol/webgl/PostProcessingPass.js';\nimport $ol$webgl$RenderTarget from '../../ol/webgl/RenderTarget.js';\nimport $ol$webgl$TileGeometry from '../../ol/webgl/TileGeometry.js';\nimport $ol$webgl$TileTexture from '../../ol/webgl/TileTexture.js';\nimport {create as _ol_vec_mat4$create} from '../../ol/vec/mat4.js';\nimport {fromTransform as _ol_vec_mat4$fromTransform} from '../../ol/vec/mat4.js';\nimport {orthographic as _ol_vec_mat4$orthographic} from '../../ol/vec/mat4.js';\nimport {scale as _ol_vec_mat4$scale} from '../../ol/vec/mat4.js';\nimport {translate as _ol_vec_mat4$translate} from '../../ol/vec/mat4.js';\nimport {translation as _ol_vec_mat4$translation} from '../../ol/vec/mat4.js';\nimport $ol$tilegrid$TileGrid from '../../ol/tilegrid/TileGrid.js';\nimport $ol$tilegrid$WMTS from '../../ol/tilegrid/WMTS.js';\nimport {createFromCapabilitiesMatrixSet as _ol_tilegrid_WMTS$createFromCapabilitiesMatrixSet} from '../../ol/tilegrid/WMTS.js';\nimport {DEFAULT_MAX_ZOOM as _ol_tilegrid_common$DEFAULT_MAX_ZOOM} from '../../ol/tilegrid/common.js';\nimport {DEFAULT_TILE_SIZE as _ol_tilegrid_common$DEFAULT_TILE_SIZE} from '../../ol/tilegrid/common.js';\nimport $ol$style$Circle from '../../ol/style/Circle.js';\nimport $ol$style$Fill from '../../ol/style/Fill.js';\nimport $ol$style$Icon from '../../ol/style/Icon.js';\nimport $ol$style$IconImage from '../../ol/style/IconImage.js';\nimport {get as _ol_style_IconImage$get} from '../../ol/style/IconImage.js';\nimport $ol$style$IconImageCache from '../../ol/style/IconImageCache.js';\nimport {getCacheKey as _ol_style_IconImageCache$getCacheKey} from '../../ol/style/IconImageCache.js';\nimport {shared as _ol_style_IconImageCache$shared} from '../../ol/style/IconImageCache.js';\nimport $ol$style$Image from '../../ol/style/Image.js';\nimport $ol$style$RegularShape from '../../ol/style/RegularShape.js';\nimport $ol$style$Stroke from '../../ol/style/Stroke.js';\nimport $ol$style$Style from '../../ol/style/Style.js';\nimport {toFunction as _ol_style_Style$toFunction} from '../../ol/style/Style.js';\nimport {createDefaultStyle as _ol_style_Style$createDefaultStyle} from '../../ol/style/Style.js';\nimport {createEditingStyle as _ol_style_Style$createEditingStyle} from '../../ol/style/Style.js';\nimport $ol$style$Text from '../../ol/style/Text.js';\nimport {createDefaultStyle as _ol_style_flat$createDefaultStyle} from '../../ol/style/flat.js';\nimport $ol$structs$LRUCache from '../../ol/structs/LRUCache.js';\nimport {DROP as _ol_structs_PriorityQueue$DROP} from '../../ol/structs/PriorityQueue.js';\nimport $ol$structs$PriorityQueue from '../../ol/structs/PriorityQueue.js';\nimport $ol$structs$RBush from '../../ol/structs/RBush.js';\nimport {quadKey as _ol_source_BingMaps$quadKey} from '../../ol/source/BingMaps.js';\nimport $ol$source$BingMaps from '../../ol/source/BingMaps.js';\nimport $ol$source$CartoDB from '../../ol/source/CartoDB.js';\nimport $ol$source$Cluster from '../../ol/source/Cluster.js';\nimport $ol$source$DataTile from '../../ol/source/DataTile.js';\nimport $ol$source$GeoTIFF from '../../ol/source/GeoTIFF.js';\nimport $ol$source$Google from '../../ol/source/Google.js';\nimport $ol$source$IIIF from '../../ol/source/IIIF.js';\nimport {ImageSourceEvent as _ol_source_Image$ImageSourceEvent} from '../../ol/source/Image.js';\nimport $ol$source$Image from '../../ol/source/Image.js';\nimport {defaultImageLoadFunction as _ol_source_Image$defaultImageLoadFunction} from '../../ol/source/Image.js';\nimport {getRequestExtent as _ol_source_Image$getRequestExtent} from '../../ol/source/Image.js';\nimport $ol$source$ImageArcGISRest from '../../ol/source/ImageArcGISRest.js';\nimport $ol$source$ImageCanvas from '../../ol/source/ImageCanvas.js';\nimport $ol$source$ImageMapGuide from '../../ol/source/ImageMapGuide.js';\nimport $ol$source$ImageStatic from '../../ol/source/ImageStatic.js';\nimport $ol$source$ImageTile from '../../ol/source/ImageTile.js';\nimport $ol$source$ImageWMS from '../../ol/source/ImageWMS.js';\nimport $ol$source$OGCMapTile from '../../ol/source/OGCMapTile.js';\nimport $ol$source$OGCVectorTile from '../../ol/source/OGCVectorTile.js';\nimport {ATTRIBUTION as _ol_source_OSM$ATTRIBUTION} from '../../ol/source/OSM.js';\nimport $ol$source$OSM from '../../ol/source/OSM.js';\nimport {Processor as _ol_source_Raster$Processor} from '../../ol/source/Raster.js';\nimport {RasterSourceEvent as _ol_source_Raster$RasterSourceEvent} from '../../ol/source/Raster.js';\nimport $ol$source$Raster from '../../ol/source/Raster.js';\nimport {parseTokenClaims as _ol_source_SentinelHub$parseTokenClaims} from '../../ol/source/SentinelHub.js';\nimport {getProjectionIdentifier as _ol_source_SentinelHub$getProjectionIdentifier} from '../../ol/source/SentinelHub.js';\nimport {serializeFunction as _ol_source_SentinelHub$serializeFunction} from '../../ol/source/SentinelHub.js';\nimport $ol$source$SentinelHub from '../../ol/source/SentinelHub.js';\nimport $ol$source$Source from '../../ol/source/Source.js';\nimport $ol$source$StadiaMaps from '../../ol/source/StadiaMaps.js';\nimport $ol$source$Tile from '../../ol/source/Tile.js';\nimport {TileSourceEvent as _ol_source_Tile$TileSourceEvent} from '../../ol/source/Tile.js';\nimport $ol$source$TileArcGISRest from '../../ol/source/TileArcGISRest.js';\nimport $ol$source$TileDebug from '../../ol/source/TileDebug.js';\nimport $ol$source$TileImage from '../../ol/source/TileImage.js';\nimport $ol$source$TileJSON from '../../ol/source/TileJSON.js';\nimport $ol$source$TileWMS from '../../ol/source/TileWMS.js';\nimport {CustomTile as _ol_source_UTFGrid$CustomTile} from '../../ol/source/UTFGrid.js';\nimport $ol$source$UTFGrid from '../../ol/source/UTFGrid.js';\nimport $ol$source$UrlTile from '../../ol/source/UrlTile.js';\nimport {VectorSourceEvent as _ol_source_Vector$VectorSourceEvent} from '../../ol/source/Vector.js';\nimport $ol$source$Vector from '../../ol/source/Vector.js';\nimport $ol$source$VectorTile from '../../ol/source/VectorTile.js';\nimport {defaultLoadFunction as _ol_source_VectorTile$defaultLoadFunction} from '../../ol/source/VectorTile.js';\nimport $ol$source$WMTS from '../../ol/source/WMTS.js';\nimport {optionsFromCapabilities as _ol_source_WMTS$optionsFromCapabilities} from '../../ol/source/WMTS.js';\nimport $ol$source$XYZ from '../../ol/source/XYZ.js';\nimport {CustomTile as _ol_source_Zoomify$CustomTile} from '../../ol/source/Zoomify.js';\nimport $ol$source$Zoomify from '../../ol/source/Zoomify.js';\nimport {getRequestUrl as _ol_source_arcgisRest$getRequestUrl} from '../../ol/source/arcgisRest.js';\nimport {createLoader as _ol_source_arcgisRest$createLoader} from '../../ol/source/arcgisRest.js';\nimport {DEFAULT_WMS_VERSION as _ol_source_common$DEFAULT_WMS_VERSION} from '../../ol/source/common.js';\nimport {DECIMALS as _ol_source_common$DECIMALS} from '../../ol/source/common.js';\nimport {createLoader as _ol_source_mapguide$createLoader} from '../../ol/source/mapguide.js';\nimport {createLoader as _ol_source_mapserver$createLoader} from '../../ol/source/mapserver.js';\nimport {appendCollectionsQueryParam as _ol_source_ogcTileUtil$appendCollectionsQueryParam} from '../../ol/source/ogcTileUtil.js';\nimport {getMapTileUrlTemplate as _ol_source_ogcTileUtil$getMapTileUrlTemplate} from '../../ol/source/ogcTileUtil.js';\nimport {getVectorTileUrlTemplate as _ol_source_ogcTileUtil$getVectorTileUrlTemplate} from '../../ol/source/ogcTileUtil.js';\nimport {getTileSetInfo as _ol_source_ogcTileUtil$getTileSetInfo} from '../../ol/source/ogcTileUtil.js';\nimport {createLoader as _ol_source_static$createLoader} from '../../ol/source/static.js';\nimport {DEFAULT_VERSION as _ol_source_wms$DEFAULT_VERSION} from '../../ol/source/wms.js';\nimport {getRequestUrl as _ol_source_wms$getRequestUrl} from '../../ol/source/wms.js';\nimport {getImageSrc as _ol_source_wms$getImageSrc} from '../../ol/source/wms.js';\nimport {getRequestParams as _ol_source_wms$getRequestParams} from '../../ol/source/wms.js';\nimport {createLoader as _ol_source_wms$createLoader} from '../../ol/source/wms.js';\nimport {getFeatureInfoUrl as _ol_source_wms$getFeatureInfoUrl} from '../../ol/source/wms.js';\nimport {getLegendUrl as _ol_source_wms$getLegendUrl} from '../../ol/source/wms.js';\nimport $ol$reproj$DataTile from '../../ol/reproj/DataTile.js';\nimport $ol$reproj$Image from '../../ol/reproj/Image.js';\nimport $ol$reproj$Tile from '../../ol/reproj/Tile.js';\nimport $ol$reproj$Triangulation from '../../ol/reproj/Triangulation.js';\nimport {ERROR_THRESHOLD as _ol_reproj_common$ERROR_THRESHOLD} from '../../ol/reproj/common.js';\nimport {createCanvasContextWebGL as _ol_reproj_glreproj$createCanvasContextWebGL} from '../../ol/reproj/glreproj.js';\nimport {releaseGLCanvas as _ol_reproj_glreproj$releaseGLCanvas} from '../../ol/reproj/glreproj.js';\nimport {canvasGLPool as _ol_reproj_glreproj$canvasGLPool} from '../../ol/reproj/glreproj.js';\nimport {render as _ol_reproj_glreproj$render} from '../../ol/reproj/glreproj.js';\nimport $ol$renderer$Composite from '../../ol/renderer/Composite.js';\nimport $ol$renderer$Layer from '../../ol/renderer/Layer.js';\nimport $ol$renderer$Map from '../../ol/renderer/Map.js';\nimport {defaultOrder as _ol_renderer_vector$defaultOrder} from '../../ol/renderer/vector.js';\nimport {getSquaredTolerance as _ol_renderer_vector$getSquaredTolerance} from '../../ol/renderer/vector.js';\nimport {getTolerance as _ol_renderer_vector$getTolerance} from '../../ol/renderer/vector.js';\nimport {renderFeature as _ol_renderer_vector$renderFeature} from '../../ol/renderer/vector.js';\nimport $ol$renderer$webgl$FlowLayer from '../../ol/renderer/webgl/FlowLayer.js';\nimport $ol$renderer$webgl$Layer from '../../ol/renderer/webgl/Layer.js';\nimport $ol$renderer$webgl$PointsLayer from '../../ol/renderer/webgl/PointsLayer.js';\nimport {Uniforms as _ol_renderer_webgl_TileLayer$Uniforms} from '../../ol/renderer/webgl/TileLayer.js';\nimport {Attributes as _ol_renderer_webgl_TileLayer$Attributes} from '../../ol/renderer/webgl/TileLayer.js';\nimport $ol$renderer$webgl$TileLayer from '../../ol/renderer/webgl/TileLayer.js';\nimport {Uniforms as _ol_renderer_webgl_TileLayerBase$Uniforms} from '../../ol/renderer/webgl/TileLayerBase.js';\nimport {newTileRepresentationLookup as _ol_renderer_webgl_TileLayerBase$newTileRepresentationLookup} from '../../ol/renderer/webgl/TileLayerBase.js';\nimport {getCacheKey as _ol_renderer_webgl_TileLayerBase$getCacheKey} from '../../ol/renderer/webgl/TileLayerBase.js';\nimport $ol$renderer$webgl$TileLayerBase from '../../ol/renderer/webgl/TileLayerBase.js';\nimport {Uniforms as _ol_renderer_webgl_VectorLayer$Uniforms} from '../../ol/renderer/webgl/VectorLayer.js';\nimport $ol$renderer$webgl$VectorLayer from '../../ol/renderer/webgl/VectorLayer.js';\nimport {Uniforms as _ol_renderer_webgl_VectorTileLayer$Uniforms} from '../../ol/renderer/webgl/VectorTileLayer.js';\nimport {Attributes as _ol_renderer_webgl_VectorTileLayer$Attributes} from '../../ol/renderer/webgl/VectorTileLayer.js';\nimport $ol$renderer$webgl$VectorTileLayer from '../../ol/renderer/webgl/VectorTileLayer.js';\nimport $ol$renderer$canvas$ImageLayer from '../../ol/renderer/canvas/ImageLayer.js';\nimport {canvasPool as _ol_renderer_canvas_Layer$canvasPool} from '../../ol/renderer/canvas/Layer.js';\nimport $ol$renderer$canvas$Layer from '../../ol/renderer/canvas/Layer.js';\nimport $ol$renderer$canvas$TileLayer from '../../ol/renderer/canvas/TileLayer.js';\nimport $ol$renderer$canvas$VectorImageLayer from '../../ol/renderer/canvas/VectorImageLayer.js';\nimport $ol$renderer$canvas$VectorLayer from '../../ol/renderer/canvas/VectorLayer.js';\nimport $ol$renderer$canvas$VectorTileLayer from '../../ol/renderer/canvas/VectorTileLayer.js';\nimport $ol$render$Box from '../../ol/render/Box.js';\nimport $ol$render$Event from '../../ol/render/Event.js';\nimport $ol$render$Feature from '../../ol/render/Feature.js';\nimport {toGeometry as _ol_render_Feature$toGeometry} from '../../ol/render/Feature.js';\nimport {toFeature as _ol_render_Feature$toFeature} from '../../ol/render/Feature.js';\nimport $ol$render$VectorContext from '../../ol/render/VectorContext.js';\nimport {defaultFont as _ol_render_canvas$defaultFont} from '../../ol/render/canvas.js';\nimport {defaultFillStyle as _ol_render_canvas$defaultFillStyle} from '../../ol/render/canvas.js';\nimport {defaultLineCap as _ol_render_canvas$defaultLineCap} from '../../ol/render/canvas.js';\nimport {defaultLineDash as _ol_render_canvas$defaultLineDash} from '../../ol/render/canvas.js';\nimport {defaultLineDashOffset as _ol_render_canvas$defaultLineDashOffset} from '../../ol/render/canvas.js';\nimport {defaultLineJoin as _ol_render_canvas$defaultLineJoin} from '../../ol/render/canvas.js';\nimport {defaultMiterLimit as _ol_render_canvas$defaultMiterLimit} from '../../ol/render/canvas.js';\nimport {defaultStrokeStyle as _ol_render_canvas$defaultStrokeStyle} from '../../ol/render/canvas.js';\nimport {defaultTextAlign as _ol_render_canvas$defaultTextAlign} from '../../ol/render/canvas.js';\nimport {defaultTextBaseline as _ol_render_canvas$defaultTextBaseline} from '../../ol/render/canvas.js';\nimport {defaultPadding as _ol_render_canvas$defaultPadding} from '../../ol/render/canvas.js';\nimport {defaultLineWidth as _ol_render_canvas$defaultLineWidth} from '../../ol/render/canvas.js';\nimport {checkedFonts as _ol_render_canvas$checkedFonts} from '../../ol/render/canvas.js';\nimport {textHeights as _ol_render_canvas$textHeights} from '../../ol/render/canvas.js';\nimport {registerFont as _ol_render_canvas$registerFont} from '../../ol/render/canvas.js';\nimport {measureTextHeight as _ol_render_canvas$measureTextHeight} from '../../ol/render/canvas.js';\nimport {measureTextWidth as _ol_render_canvas$measureTextWidth} from '../../ol/render/canvas.js';\nimport {measureAndCacheTextWidth as _ol_render_canvas$measureAndCacheTextWidth} from '../../ol/render/canvas.js';\nimport {getTextDimensions as _ol_render_canvas$getTextDimensions} from '../../ol/render/canvas.js';\nimport {rotateAtOffset as _ol_render_canvas$rotateAtOffset} from '../../ol/render/canvas.js';\nimport {drawImageOrLabel as _ol_render_canvas$drawImageOrLabel} from '../../ol/render/canvas.js';\nimport $ol$render$webgl$MixedGeometryBatch from '../../ol/render/webgl/MixedGeometryBatch.js';\nimport {COMMON_HEADER as _ol_render_webgl_ShaderBuilder$COMMON_HEADER} from '../../ol/render/webgl/ShaderBuilder.js';\nimport {ShaderBuilder as _ol_render_webgl_ShaderBuilder$ShaderBuilder} from '../../ol/render/webgl/ShaderBuilder.js';\nimport $ol$render$webgl$VectorStyleRenderer from '../../ol/render/webgl/VectorStyleRenderer.js';\nimport {LINESTRING_ANGLE_COSINE_CUTOFF as _ol_render_webgl_bufferUtil$LINESTRING_ANGLE_COSINE_CUTOFF} from '../../ol/render/webgl/bufferUtil.js';\nimport {writePointFeatureToBuffers as _ol_render_webgl_bufferUtil$writePointFeatureToBuffers} from '../../ol/render/webgl/bufferUtil.js';\nimport {writeLineSegmentToBuffers as _ol_render_webgl_bufferUtil$writeLineSegmentToBuffers} from '../../ol/render/webgl/bufferUtil.js';\nimport {writePolygonTrianglesToBuffers as _ol_render_webgl_bufferUtil$writePolygonTrianglesToBuffers} from '../../ol/render/webgl/bufferUtil.js';\nimport {expressionToGlsl as _ol_render_webgl_compileUtil$expressionToGlsl} from '../../ol/render/webgl/compileUtil.js';\nimport {packColor as _ol_render_webgl_compileUtil$packColor} from '../../ol/render/webgl/compileUtil.js';\nimport {UNPACK_COLOR_FN as _ol_render_webgl_compileUtil$UNPACK_COLOR_FN} from '../../ol/render/webgl/compileUtil.js';\nimport {getGlslSizeFromType as _ol_render_webgl_compileUtil$getGlslSizeFromType} from '../../ol/render/webgl/compileUtil.js';\nimport {getGlslTypeFromType as _ol_render_webgl_compileUtil$getGlslTypeFromType} from '../../ol/render/webgl/compileUtil.js';\nimport {applyContextToBuilder as _ol_render_webgl_compileUtil$applyContextToBuilder} from '../../ol/render/webgl/compileUtil.js';\nimport {generateUniformsFromContext as _ol_render_webgl_compileUtil$generateUniformsFromContext} from '../../ol/render/webgl/compileUtil.js';\nimport {generateAttributesFromContext as _ol_render_webgl_compileUtil$generateAttributesFromContext} from '../../ol/render/webgl/compileUtil.js';\nimport {colorEncodeId as _ol_render_webgl_encodeUtil$colorEncodeId} from '../../ol/render/webgl/encodeUtil.js';\nimport {colorDecodeId as _ol_render_webgl_encodeUtil$colorDecodeId} from '../../ol/render/webgl/encodeUtil.js';\nimport {getCustomAttributesSize as _ol_render_webgl_renderinstructions$getCustomAttributesSize} from '../../ol/render/webgl/renderinstructions.js';\nimport {generatePointRenderInstructions as _ol_render_webgl_renderinstructions$generatePointRenderInstructions} from '../../ol/render/webgl/renderinstructions.js';\nimport {generateLineStringRenderInstructions as _ol_render_webgl_renderinstructions$generateLineStringRenderInstructions} from '../../ol/render/webgl/renderinstructions.js';\nimport {generatePolygonRenderInstructions as _ol_render_webgl_renderinstructions$generatePolygonRenderInstructions} from '../../ol/render/webgl/renderinstructions.js';\nimport {computeHash as _ol_render_webgl_style$computeHash} from '../../ol/render/webgl/style.js';\nimport {parseLiteralStyle as _ol_render_webgl_style$parseLiteralStyle} from '../../ol/render/webgl/style.js';\nimport {breakDownFlatStyle as _ol_render_webgl_style$breakDownFlatStyle} from '../../ol/render/webgl/style.js';\nimport $ol$render$canvas$Builder from '../../ol/render/canvas/Builder.js';\nimport $ol$render$canvas$BuilderGroup from '../../ol/render/canvas/BuilderGroup.js';\nimport $ol$render$canvas$Executor from '../../ol/render/canvas/Executor.js';\nimport {ALL as _ol_render_canvas_ExecutorGroup$ALL} from '../../ol/render/canvas/ExecutorGroup.js';\nimport {DECLUTTER as _ol_render_canvas_ExecutorGroup$DECLUTTER} from '../../ol/render/canvas/ExecutorGroup.js';\nimport {NON_DECLUTTER as _ol_render_canvas_ExecutorGroup$NON_DECLUTTER} from '../../ol/render/canvas/ExecutorGroup.js';\nimport $ol$render$canvas$ExecutorGroup from '../../ol/render/canvas/ExecutorGroup.js';\nimport {getPixelIndexArray as _ol_render_canvas_ExecutorGroup$getPixelIndexArray} from '../../ol/render/canvas/ExecutorGroup.js';\nimport $ol$render$canvas$ImageBuilder from '../../ol/render/canvas/ImageBuilder.js';\nimport $ol$render$canvas$Immediate from '../../ol/render/canvas/Immediate.js';\nimport {fillInstruction as _ol_render_canvas_Instruction$fillInstruction} from '../../ol/render/canvas/Instruction.js';\nimport {strokeInstruction as _ol_render_canvas_Instruction$strokeInstruction} from '../../ol/render/canvas/Instruction.js';\nimport {beginPathInstruction as _ol_render_canvas_Instruction$beginPathInstruction} from '../../ol/render/canvas/Instruction.js';\nimport {closePathInstruction as _ol_render_canvas_Instruction$closePathInstruction} from '../../ol/render/canvas/Instruction.js';\nimport $ol$render$canvas$LineStringBuilder from '../../ol/render/canvas/LineStringBuilder.js';\nimport $ol$render$canvas$PolygonBuilder from '../../ol/render/canvas/PolygonBuilder.js';\nimport {TEXT_ALIGN as _ol_render_canvas_TextBuilder$TEXT_ALIGN} from '../../ol/render/canvas/TextBuilder.js';\nimport $ol$render$canvas$TextBuilder from '../../ol/render/canvas/TextBuilder.js';\nimport $ol$render$canvas$ZIndexContext from '../../ol/render/canvas/ZIndexContext.js';\nimport {HIT_DETECT_RESOLUTION as _ol_render_canvas_hitdetect$HIT_DETECT_RESOLUTION} from '../../ol/render/canvas/hitdetect.js';\nimport {createHitDetectionImageData as _ol_render_canvas_hitdetect$createHitDetectionImageData} from '../../ol/render/canvas/hitdetect.js';\nimport {hitDetect as _ol_render_canvas_hitdetect$hitDetect} from '../../ol/render/canvas/hitdetect.js';\nimport {rulesToStyleFunction as _ol_render_canvas_style$rulesToStyleFunction} from '../../ol/render/canvas/style.js';\nimport {flatStylesToStyleFunction as _ol_render_canvas_style$flatStylesToStyleFunction} from '../../ol/render/canvas/style.js';\nimport {buildRuleSet as _ol_render_canvas_style$buildRuleSet} from '../../ol/render/canvas/style.js';\nimport {buildStyle as _ol_render_canvas_style$buildStyle} from '../../ol/render/canvas/style.js';\nimport $ol$proj$Projection from '../../ol/proj/Projection.js';\nimport {fromCode as _ol_proj_Units$fromCode} from '../../ol/proj/Units.js';\nimport {METERS_PER_UNIT as _ol_proj_Units$METERS_PER_UNIT} from '../../ol/proj/Units.js';\nimport {RADIUS as _ol_proj_epsg3857$RADIUS} from '../../ol/proj/epsg3857.js';\nimport {HALF_SIZE as _ol_proj_epsg3857$HALF_SIZE} from '../../ol/proj/epsg3857.js';\nimport {EXTENT as _ol_proj_epsg3857$EXTENT} from '../../ol/proj/epsg3857.js';\nimport {WORLD_EXTENT as _ol_proj_epsg3857$WORLD_EXTENT} from '../../ol/proj/epsg3857.js';\nimport {MAX_SAFE_Y as _ol_proj_epsg3857$MAX_SAFE_Y} from '../../ol/proj/epsg3857.js';\nimport {PROJECTIONS as _ol_proj_epsg3857$PROJECTIONS} from '../../ol/proj/epsg3857.js';\nimport {fromEPSG4326 as _ol_proj_epsg3857$fromEPSG4326} from '../../ol/proj/epsg3857.js';\nimport {toEPSG4326 as _ol_proj_epsg3857$toEPSG4326} from '../../ol/proj/epsg3857.js';\nimport {RADIUS as _ol_proj_epsg4326$RADIUS} from '../../ol/proj/epsg4326.js';\nimport {EXTENT as _ol_proj_epsg4326$EXTENT} from '../../ol/proj/epsg4326.js';\nimport {METERS_PER_UNIT as _ol_proj_epsg4326$METERS_PER_UNIT} from '../../ol/proj/epsg4326.js';\nimport {PROJECTIONS as _ol_proj_epsg4326$PROJECTIONS} from '../../ol/proj/epsg4326.js';\nimport {isRegistered as _ol_proj_proj4$isRegistered} from '../../ol/proj/proj4.js';\nimport {unregister as _ol_proj_proj4$unregister} from '../../ol/proj/proj4.js';\nimport {register as _ol_proj_proj4$register} from '../../ol/proj/proj4.js';\nimport {setEPSGLookup as _ol_proj_proj4$setEPSGLookup} from '../../ol/proj/proj4.js';\nimport {getEPSGLookup as _ol_proj_proj4$getEPSGLookup} from '../../ol/proj/proj4.js';\nimport {fromEPSGCode as _ol_proj_proj4$fromEPSGCode} from '../../ol/proj/proj4.js';\nimport {epsgLookupMapTiler as _ol_proj_proj4$epsgLookupMapTiler} from '../../ol/proj/proj4.js';\nimport {clear as _ol_proj_projections$clear} from '../../ol/proj/projections.js';\nimport {get as _ol_proj_projections$get} from '../../ol/proj/projections.js';\nimport {add as _ol_proj_projections$add} from '../../ol/proj/projections.js';\nimport {clear as _ol_proj_transforms$clear} from '../../ol/proj/transforms.js';\nimport {add as _ol_proj_transforms$add} from '../../ol/proj/transforms.js';\nimport {remove as _ol_proj_transforms$remove} from '../../ol/proj/transforms.js';\nimport {get as _ol_proj_transforms$get} from '../../ol/proj/transforms.js';\nimport {zoneFromCode as _ol_proj_utm$zoneFromCode} from '../../ol/proj/utm.js';\nimport {makeProjection as _ol_proj_utm$makeProjection} from '../../ol/proj/utm.js';\nimport {makeTransforms as _ol_proj_utm$makeTransforms} from '../../ol/proj/utm.js';\nimport $ol$layer$Base from '../../ol/layer/Base.js';\nimport $ol$layer$BaseImage from '../../ol/layer/BaseImage.js';\nimport $ol$layer$BaseTile from '../../ol/layer/BaseTile.js';\nimport $ol$layer$BaseVector from '../../ol/layer/BaseVector.js';\nimport $ol$layer$Flow from '../../ol/layer/Flow.js';\nimport $ol$layer$Graticule from '../../ol/layer/Graticule.js';\nimport {GroupEvent as _ol_layer_Group$GroupEvent} from '../../ol/layer/Group.js';\nimport $ol$layer$Group from '../../ol/layer/Group.js';\nimport $ol$layer$Heatmap from '../../ol/layer/Heatmap.js';\nimport $ol$layer$Image from '../../ol/layer/Image.js';\nimport $ol$layer$Layer from '../../ol/layer/Layer.js';\nimport {inView as _ol_layer_Layer$inView} from '../../ol/layer/Layer.js';\nimport $ol$layer$Tile from '../../ol/layer/Tile.js';\nimport $ol$layer$Vector from '../../ol/layer/Vector.js';\nimport $ol$layer$VectorImage from '../../ol/layer/VectorImage.js';\nimport $ol$layer$VectorTile from '../../ol/layer/VectorTile.js';\nimport $ol$layer$WebGLPoints from '../../ol/layer/WebGLPoints.js';\nimport $ol$layer$WebGLTile from '../../ol/layer/WebGLTile.js';\nimport $ol$layer$WebGLVector from '../../ol/layer/WebGLVector.js';\nimport $ol$layer$WebGLVectorTile from '../../ol/layer/WebGLVectorTile.js';\nimport $ol$interaction$DblClickDragZoom from '../../ol/interaction/DblClickDragZoom.js';\nimport $ol$interaction$DoubleClickZoom from '../../ol/interaction/DoubleClickZoom.js';\nimport {DragAndDropEvent as _ol_interaction_DragAndDrop$DragAndDropEvent} from '../../ol/interaction/DragAndDrop.js';\nimport $ol$interaction$DragAndDrop from '../../ol/interaction/DragAndDrop.js';\nimport {DragBoxEvent as _ol_interaction_DragBox$DragBoxEvent} from '../../ol/interaction/DragBox.js';\nimport $ol$interaction$DragBox from '../../ol/interaction/DragBox.js';\nimport $ol$interaction$DragPan from '../../ol/interaction/DragPan.js';\nimport $ol$interaction$DragRotate from '../../ol/interaction/DragRotate.js';\nimport $ol$interaction$DragRotateAndZoom from '../../ol/interaction/DragRotateAndZoom.js';\nimport $ol$interaction$DragZoom from '../../ol/interaction/DragZoom.js';\nimport {DrawEvent as _ol_interaction_Draw$DrawEvent} from '../../ol/interaction/Draw.js';\nimport $ol$interaction$Draw from '../../ol/interaction/Draw.js';\nimport {createRegularPolygon as _ol_interaction_Draw$createRegularPolygon} from '../../ol/interaction/Draw.js';\nimport {createBox as _ol_interaction_Draw$createBox} from '../../ol/interaction/Draw.js';\nimport {ExtentEvent as _ol_interaction_Extent$ExtentEvent} from '../../ol/interaction/Extent.js';\nimport $ol$interaction$Extent from '../../ol/interaction/Extent.js';\nimport $ol$interaction$Interaction from '../../ol/interaction/Interaction.js';\nimport {pan as _ol_interaction_Interaction$pan} from '../../ol/interaction/Interaction.js';\nimport {zoomByDelta as _ol_interaction_Interaction$zoomByDelta} from '../../ol/interaction/Interaction.js';\nimport $ol$interaction$KeyboardPan from '../../ol/interaction/KeyboardPan.js';\nimport $ol$interaction$KeyboardZoom from '../../ol/interaction/KeyboardZoom.js';\nimport $ol$interaction$Link from '../../ol/interaction/Link.js';\nimport {ModifyEvent as _ol_interaction_Modify$ModifyEvent} from '../../ol/interaction/Modify.js';\nimport $ol$interaction$Modify from '../../ol/interaction/Modify.js';\nimport $ol$interaction$MouseWheelZoom from '../../ol/interaction/MouseWheelZoom.js';\nimport $ol$interaction$PinchRotate from '../../ol/interaction/PinchRotate.js';\nimport $ol$interaction$PinchZoom from '../../ol/interaction/PinchZoom.js';\nimport $ol$interaction$Pointer from '../../ol/interaction/Pointer.js';\nimport {centroid as _ol_interaction_Pointer$centroid} from '../../ol/interaction/Pointer.js';\nimport {SelectEvent as _ol_interaction_Select$SelectEvent} from '../../ol/interaction/Select.js';\nimport $ol$interaction$Select from '../../ol/interaction/Select.js';\nimport $ol$interaction$Snap from '../../ol/interaction/Snap.js';\nimport {TranslateEvent as _ol_interaction_Translate$TranslateEvent} from '../../ol/interaction/Translate.js';\nimport $ol$interaction$Translate from '../../ol/interaction/Translate.js';\nimport {defaults as _ol_interaction_defaults$defaults} from '../../ol/interaction/defaults.js';\nimport $ol$geom$Circle from '../../ol/geom/Circle.js';\nimport $ol$geom$Geometry from '../../ol/geom/Geometry.js';\nimport $ol$geom$GeometryCollection from '../../ol/geom/GeometryCollection.js';\nimport $ol$geom$LineString from '../../ol/geom/LineString.js';\nimport $ol$geom$LinearRing from '../../ol/geom/LinearRing.js';\nimport $ol$geom$MultiLineString from '../../ol/geom/MultiLineString.js';\nimport $ol$geom$MultiPoint from '../../ol/geom/MultiPoint.js';\nimport $ol$geom$MultiPolygon from '../../ol/geom/MultiPolygon.js';\nimport $ol$geom$Point from '../../ol/geom/Point.js';\nimport $ol$geom$Polygon from '../../ol/geom/Polygon.js';\nimport {circular as _ol_geom_Polygon$circular} from '../../ol/geom/Polygon.js';\nimport {fromExtent as _ol_geom_Polygon$fromExtent} from '../../ol/geom/Polygon.js';\nimport {fromCircle as _ol_geom_Polygon$fromCircle} from '../../ol/geom/Polygon.js';\nimport {makeRegular as _ol_geom_Polygon$makeRegular} from '../../ol/geom/Polygon.js';\nimport $ol$geom$SimpleGeometry from '../../ol/geom/SimpleGeometry.js';\nimport {getLayoutForStride as _ol_geom_SimpleGeometry$getLayoutForStride} from '../../ol/geom/SimpleGeometry.js';\nimport {getStrideForLayout as _ol_geom_SimpleGeometry$getStrideForLayout} from '../../ol/geom/SimpleGeometry.js';\nimport {transformGeom2D as _ol_geom_SimpleGeometry$transformGeom2D} from '../../ol/geom/SimpleGeometry.js';\nimport {linearRing as _ol_geom_flat_area$linearRing} from '../../ol/geom/flat/area.js';\nimport {linearRings as _ol_geom_flat_area$linearRings} from '../../ol/geom/flat/area.js';\nimport {linearRingss as _ol_geom_flat_area$linearRingss} from '../../ol/geom/flat/area.js';\nimport {linearRingss as _ol_geom_flat_center$linearRingss} from '../../ol/geom/flat/center.js';\nimport {maxSquaredDelta as _ol_geom_flat_closest$maxSquaredDelta} from '../../ol/geom/flat/closest.js';\nimport {arrayMaxSquaredDelta as _ol_geom_flat_closest$arrayMaxSquaredDelta} from '../../ol/geom/flat/closest.js';\nimport {multiArrayMaxSquaredDelta as _ol_geom_flat_closest$multiArrayMaxSquaredDelta} from '../../ol/geom/flat/closest.js';\nimport {assignClosestPoint as _ol_geom_flat_closest$assignClosestPoint} from '../../ol/geom/flat/closest.js';\nimport {assignClosestArrayPoint as _ol_geom_flat_closest$assignClosestArrayPoint} from '../../ol/geom/flat/closest.js';\nimport {assignClosestMultiArrayPoint as _ol_geom_flat_closest$assignClosestMultiArrayPoint} from '../../ol/geom/flat/closest.js';\nimport {linearRingContainsExtent as _ol_geom_flat_contains$linearRingContainsExtent} from '../../ol/geom/flat/contains.js';\nimport {linearRingContainsXY as _ol_geom_flat_contains$linearRingContainsXY} from '../../ol/geom/flat/contains.js';\nimport {linearRingsContainsXY as _ol_geom_flat_contains$linearRingsContainsXY} from '../../ol/geom/flat/contains.js';\nimport {linearRingssContainsXY as _ol_geom_flat_contains$linearRingssContainsXY} from '../../ol/geom/flat/contains.js';\nimport {deflateCoordinate as _ol_geom_flat_deflate$deflateCoordinate} from '../../ol/geom/flat/deflate.js';\nimport {deflateCoordinates as _ol_geom_flat_deflate$deflateCoordinates} from '../../ol/geom/flat/deflate.js';\nimport {deflateCoordinatesArray as _ol_geom_flat_deflate$deflateCoordinatesArray} from '../../ol/geom/flat/deflate.js';\nimport {deflateMultiCoordinatesArray as _ol_geom_flat_deflate$deflateMultiCoordinatesArray} from '../../ol/geom/flat/deflate.js';\nimport {flipXY as _ol_geom_flat_flip$flipXY} from '../../ol/geom/flat/flip.js';\nimport {greatCircleArc as _ol_geom_flat_geodesic$greatCircleArc} from '../../ol/geom/flat/geodesic.js';\nimport {meridian as _ol_geom_flat_geodesic$meridian} from '../../ol/geom/flat/geodesic.js';\nimport {parallel as _ol_geom_flat_geodesic$parallel} from '../../ol/geom/flat/geodesic.js';\nimport {inflateCoordinates as _ol_geom_flat_inflate$inflateCoordinates} from '../../ol/geom/flat/inflate.js';\nimport {inflateCoordinatesArray as _ol_geom_flat_inflate$inflateCoordinatesArray} from '../../ol/geom/flat/inflate.js';\nimport {inflateMultiCoordinatesArray as _ol_geom_flat_inflate$inflateMultiCoordinatesArray} from '../../ol/geom/flat/inflate.js';\nimport {getInteriorPointOfArray as _ol_geom_flat_interiorpoint$getInteriorPointOfArray} from '../../ol/geom/flat/interiorpoint.js';\nimport {getInteriorPointsOfMultiArray as _ol_geom_flat_interiorpoint$getInteriorPointsOfMultiArray} from '../../ol/geom/flat/interiorpoint.js';\nimport {interpolatePoint as _ol_geom_flat_interpolate$interpolatePoint} from '../../ol/geom/flat/interpolate.js';\nimport {lineStringCoordinateAtM as _ol_geom_flat_interpolate$lineStringCoordinateAtM} from '../../ol/geom/flat/interpolate.js';\nimport {lineStringsCoordinateAtM as _ol_geom_flat_interpolate$lineStringsCoordinateAtM} from '../../ol/geom/flat/interpolate.js';\nimport {intersectsLineString as _ol_geom_flat_intersectsextent$intersectsLineString} from '../../ol/geom/flat/intersectsextent.js';\nimport {intersectsLineStringArray as _ol_geom_flat_intersectsextent$intersectsLineStringArray} from '../../ol/geom/flat/intersectsextent.js';\nimport {intersectsLinearRing as _ol_geom_flat_intersectsextent$intersectsLinearRing} from '../../ol/geom/flat/intersectsextent.js';\nimport {intersectsLinearRingArray as _ol_geom_flat_intersectsextent$intersectsLinearRingArray} from '../../ol/geom/flat/intersectsextent.js';\nimport {intersectsLinearRingMultiArray as _ol_geom_flat_intersectsextent$intersectsLinearRingMultiArray} from '../../ol/geom/flat/intersectsextent.js';\nimport {lineStringLength as _ol_geom_flat_length$lineStringLength} from '../../ol/geom/flat/length.js';\nimport {linearRingLength as _ol_geom_flat_length$linearRingLength} from '../../ol/geom/flat/length.js';\nimport {linearRingIsClockwise as _ol_geom_flat_orient$linearRingIsClockwise} from '../../ol/geom/flat/orient.js';\nimport {linearRingsAreOriented as _ol_geom_flat_orient$linearRingsAreOriented} from '../../ol/geom/flat/orient.js';\nimport {linearRingssAreOriented as _ol_geom_flat_orient$linearRingssAreOriented} from '../../ol/geom/flat/orient.js';\nimport {orientLinearRings as _ol_geom_flat_orient$orientLinearRings} from '../../ol/geom/flat/orient.js';\nimport {orientLinearRingsArray as _ol_geom_flat_orient$orientLinearRingsArray} from '../../ol/geom/flat/orient.js';\nimport {inflateEnds as _ol_geom_flat_orient$inflateEnds} from '../../ol/geom/flat/orient.js';\nimport {coordinates as _ol_geom_flat_reverse$coordinates} from '../../ol/geom/flat/reverse.js';\nimport {forEach as _ol_geom_flat_segments$forEach} from '../../ol/geom/flat/segments.js';\nimport {getIntersectionPoint as _ol_geom_flat_segments$getIntersectionPoint} from '../../ol/geom/flat/segments.js';\nimport {simplifyLineString as _ol_geom_flat_simplify$simplifyLineString} from '../../ol/geom/flat/simplify.js';\nimport {douglasPeucker as _ol_geom_flat_simplify$douglasPeucker} from '../../ol/geom/flat/simplify.js';\nimport {douglasPeuckerArray as _ol_geom_flat_simplify$douglasPeuckerArray} from '../../ol/geom/flat/simplify.js';\nimport {douglasPeuckerMultiArray as _ol_geom_flat_simplify$douglasPeuckerMultiArray} from '../../ol/geom/flat/simplify.js';\nimport {radialDistance as _ol_geom_flat_simplify$radialDistance} from '../../ol/geom/flat/simplify.js';\nimport {snap as _ol_geom_flat_simplify$snap} from '../../ol/geom/flat/simplify.js';\nimport {quantize as _ol_geom_flat_simplify$quantize} from '../../ol/geom/flat/simplify.js';\nimport {quantizeArray as _ol_geom_flat_simplify$quantizeArray} from '../../ol/geom/flat/simplify.js';\nimport {quantizeMultiArray as _ol_geom_flat_simplify$quantizeMultiArray} from '../../ol/geom/flat/simplify.js';\nimport {matchingChunk as _ol_geom_flat_straightchunk$matchingChunk} from '../../ol/geom/flat/straightchunk.js';\nimport {drawTextOnPath as _ol_geom_flat_textpath$drawTextOnPath} from '../../ol/geom/flat/textpath.js';\nimport {lineStringIsClosed as _ol_geom_flat_topology$lineStringIsClosed} from '../../ol/geom/flat/topology.js';\nimport {transform2D as _ol_geom_flat_transform$transform2D} from '../../ol/geom/flat/transform.js';\nimport {rotate as _ol_geom_flat_transform$rotate} from '../../ol/geom/flat/transform.js';\nimport {scale as _ol_geom_flat_transform$scale} from '../../ol/geom/flat/transform.js';\nimport {translate as _ol_geom_flat_transform$translate} from '../../ol/geom/flat/transform.js';\nimport $ol$format$EsriJSON from '../../ol/format/EsriJSON.js';\nimport $ol$format$Feature from '../../ol/format/Feature.js';\nimport {transformGeometryWithOptions as _ol_format_Feature$transformGeometryWithOptions} from '../../ol/format/Feature.js';\nimport {transformExtentWithOptions as _ol_format_Feature$transformExtentWithOptions} from '../../ol/format/Feature.js';\nimport {createRenderFeature as _ol_format_Feature$createRenderFeature} from '../../ol/format/Feature.js';\nimport {createGeometry as _ol_format_Feature$createGeometry} from '../../ol/format/Feature.js';\nimport $ol$format$GML from '../../ol/format/GML.js';\nimport $ol$format$GML2 from '../../ol/format/GML2.js';\nimport $ol$format$GML3 from '../../ol/format/GML3.js';\nimport $ol$format$GML32 from '../../ol/format/GML32.js';\nimport {GMLNS as _ol_format_GMLBase$GMLNS} from '../../ol/format/GMLBase.js';\nimport $ol$format$GMLBase from '../../ol/format/GMLBase.js';\nimport $ol$format$GPX from '../../ol/format/GPX.js';\nimport $ol$format$GeoJSON from '../../ol/format/GeoJSON.js';\nimport $ol$format$IGC from '../../ol/format/IGC.js';\nimport $ol$format$IIIFInfo from '../../ol/format/IIIFInfo.js';\nimport $ol$format$JSONFeature from '../../ol/format/JSONFeature.js';\nimport {getDefaultFillStyle as _ol_format_KML$getDefaultFillStyle} from '../../ol/format/KML.js';\nimport {getDefaultImageStyle as _ol_format_KML$getDefaultImageStyle} from '../../ol/format/KML.js';\nimport {getDefaultStrokeStyle as _ol_format_KML$getDefaultStrokeStyle} from '../../ol/format/KML.js';\nimport {getDefaultTextStyle as _ol_format_KML$getDefaultTextStyle} from '../../ol/format/KML.js';\nimport {getDefaultStyle as _ol_format_KML$getDefaultStyle} from '../../ol/format/KML.js';\nimport {getDefaultStyleArray as _ol_format_KML$getDefaultStyleArray} from '../../ol/format/KML.js';\nimport $ol$format$KML from '../../ol/format/KML.js';\nimport {readFlatCoordinates as _ol_format_KML$readFlatCoordinates} from '../../ol/format/KML.js';\nimport $ol$format$MVT from '../../ol/format/MVT.js';\nimport $ol$format$OSMXML from '../../ol/format/OSMXML.js';\nimport $ol$format$OWS from '../../ol/format/OWS.js';\nimport $ol$format$Polyline from '../../ol/format/Polyline.js';\nimport {encodeDeltas as _ol_format_Polyline$encodeDeltas} from '../../ol/format/Polyline.js';\nimport {decodeDeltas as _ol_format_Polyline$decodeDeltas} from '../../ol/format/Polyline.js';\nimport {encodeFloats as _ol_format_Polyline$encodeFloats} from '../../ol/format/Polyline.js';\nimport {decodeFloats as _ol_format_Polyline$decodeFloats} from '../../ol/format/Polyline.js';\nimport {encodeSignedIntegers as _ol_format_Polyline$encodeSignedIntegers} from '../../ol/format/Polyline.js';\nimport {decodeSignedIntegers as _ol_format_Polyline$decodeSignedIntegers} from '../../ol/format/Polyline.js';\nimport {encodeUnsignedIntegers as _ol_format_Polyline$encodeUnsignedIntegers} from '../../ol/format/Polyline.js';\nimport {decodeUnsignedIntegers as _ol_format_Polyline$decodeUnsignedIntegers} from '../../ol/format/Polyline.js';\nimport {encodeUnsignedInteger as _ol_format_Polyline$encodeUnsignedInteger} from '../../ol/format/Polyline.js';\nimport $ol$format$TextFeature from '../../ol/format/TextFeature.js';\nimport $ol$format$TopoJSON from '../../ol/format/TopoJSON.js';\nimport $ol$format$WFS from '../../ol/format/WFS.js';\nimport {writeFilter as _ol_format_WFS$writeFilter} from '../../ol/format/WFS.js';\nimport $ol$format$WKB from '../../ol/format/WKB.js';\nimport $ol$format$WKT from '../../ol/format/WKT.js';\nimport $ol$format$WMSCapabilities from '../../ol/format/WMSCapabilities.js';\nimport $ol$format$WMSGetFeatureInfo from '../../ol/format/WMSGetFeatureInfo.js';\nimport $ol$format$WMTSCapabilities from '../../ol/format/WMTSCapabilities.js';\nimport $ol$format$XML from '../../ol/format/XML.js';\nimport $ol$format$XMLFeature from '../../ol/format/XMLFeature.js';\nimport {and as _ol_format_filter$and} from '../../ol/format/filter.js';\nimport {or as _ol_format_filter$or} from '../../ol/format/filter.js';\nimport {not as _ol_format_filter$not} from '../../ol/format/filter.js';\nimport {bbox as _ol_format_filter$bbox} from '../../ol/format/filter.js';\nimport {contains as _ol_format_filter$contains} from '../../ol/format/filter.js';\nimport {intersects as _ol_format_filter$intersects} from '../../ol/format/filter.js';\nimport {disjoint as _ol_format_filter$disjoint} from '../../ol/format/filter.js';\nimport {within as _ol_format_filter$within} from '../../ol/format/filter.js';\nimport {dwithin as _ol_format_filter$dwithin} from '../../ol/format/filter.js';\nimport {equalTo as _ol_format_filter$equalTo} from '../../ol/format/filter.js';\nimport {notEqualTo as _ol_format_filter$notEqualTo} from '../../ol/format/filter.js';\nimport {lessThan as _ol_format_filter$lessThan} from '../../ol/format/filter.js';\nimport {lessThanOrEqualTo as _ol_format_filter$lessThanOrEqualTo} from '../../ol/format/filter.js';\nimport {greaterThan as _ol_format_filter$greaterThan} from '../../ol/format/filter.js';\nimport {greaterThanOrEqualTo as _ol_format_filter$greaterThanOrEqualTo} from '../../ol/format/filter.js';\nimport {isNull as _ol_format_filter$isNull} from '../../ol/format/filter.js';\nimport {between as _ol_format_filter$between} from '../../ol/format/filter.js';\nimport {like as _ol_format_filter$like} from '../../ol/format/filter.js';\nimport {during as _ol_format_filter$during} from '../../ol/format/filter.js';\nimport {resourceId as _ol_format_filter$resourceId} from '../../ol/format/filter.js';\nimport {readHref as _ol_format_xlink$readHref} from '../../ol/format/xlink.js';\nimport {readBoolean as _ol_format_xsd$readBoolean} from '../../ol/format/xsd.js';\nimport {readBooleanString as _ol_format_xsd$readBooleanString} from '../../ol/format/xsd.js';\nimport {readDateTime as _ol_format_xsd$readDateTime} from '../../ol/format/xsd.js';\nimport {readDecimal as _ol_format_xsd$readDecimal} from '../../ol/format/xsd.js';\nimport {readDecimalString as _ol_format_xsd$readDecimalString} from '../../ol/format/xsd.js';\nimport {readPositiveInteger as _ol_format_xsd$readPositiveInteger} from '../../ol/format/xsd.js';\nimport {readNonNegativeIntegerString as _ol_format_xsd$readNonNegativeIntegerString} from '../../ol/format/xsd.js';\nimport {readString as _ol_format_xsd$readString} from '../../ol/format/xsd.js';\nimport {writeBooleanTextNode as _ol_format_xsd$writeBooleanTextNode} from '../../ol/format/xsd.js';\nimport {writeCDATASection as _ol_format_xsd$writeCDATASection} from '../../ol/format/xsd.js';\nimport {writeDateTimeTextNode as _ol_format_xsd$writeDateTimeTextNode} from '../../ol/format/xsd.js';\nimport {writeDecimalTextNode as _ol_format_xsd$writeDecimalTextNode} from '../../ol/format/xsd.js';\nimport {writeNonNegativeIntegerTextNode as _ol_format_xsd$writeNonNegativeIntegerTextNode} from '../../ol/format/xsd.js';\nimport {writeStringTextNode as _ol_format_xsd$writeStringTextNode} from '../../ol/format/xsd.js';\nimport $ol$format$filter$And from '../../ol/format/filter/And.js';\nimport $ol$format$filter$Bbox from '../../ol/format/filter/Bbox.js';\nimport $ol$format$filter$Comparison from '../../ol/format/filter/Comparison.js';\nimport $ol$format$filter$ComparisonBinary from '../../ol/format/filter/ComparisonBinary.js';\nimport $ol$format$filter$Contains from '../../ol/format/filter/Contains.js';\nimport $ol$format$filter$DWithin from '../../ol/format/filter/DWithin.js';\nimport $ol$format$filter$Disjoint from '../../ol/format/filter/Disjoint.js';\nimport $ol$format$filter$During from '../../ol/format/filter/During.js';\nimport $ol$format$filter$EqualTo from '../../ol/format/filter/EqualTo.js';\nimport $ol$format$filter$Filter from '../../ol/format/filter/Filter.js';\nimport $ol$format$filter$GreaterThan from '../../ol/format/filter/GreaterThan.js';\nimport $ol$format$filter$GreaterThanOrEqualTo from '../../ol/format/filter/GreaterThanOrEqualTo.js';\nimport $ol$format$filter$Intersects from '../../ol/format/filter/Intersects.js';\nimport $ol$format$filter$IsBetween from '../../ol/format/filter/IsBetween.js';\nimport $ol$format$filter$IsLike from '../../ol/format/filter/IsLike.js';\nimport $ol$format$filter$IsNull from '../../ol/format/filter/IsNull.js';\nimport $ol$format$filter$LessThan from '../../ol/format/filter/LessThan.js';\nimport $ol$format$filter$LessThanOrEqualTo from '../../ol/format/filter/LessThanOrEqualTo.js';\nimport $ol$format$filter$LogicalNary from '../../ol/format/filter/LogicalNary.js';\nimport $ol$format$filter$Not from '../../ol/format/filter/Not.js';\nimport $ol$format$filter$NotEqualTo from '../../ol/format/filter/NotEqualTo.js';\nimport $ol$format$filter$Or from '../../ol/format/filter/Or.js';\nimport $ol$format$filter$ResourceId from '../../ol/format/filter/ResourceId.js';\nimport $ol$format$filter$Spatial from '../../ol/format/filter/Spatial.js';\nimport $ol$format$filter$Within from '../../ol/format/filter/Within.js';\nimport {newEvaluationContext as _ol_expr_cpu$newEvaluationContext} from '../../ol/expr/cpu.js';\nimport {buildExpression as _ol_expr_cpu$buildExpression} from '../../ol/expr/cpu.js';\nimport {NoneType as _ol_expr_expression$NoneType} from '../../ol/expr/expression.js';\nimport {BooleanType as _ol_expr_expression$BooleanType} from '../../ol/expr/expression.js';\nimport {NumberType as _ol_expr_expression$NumberType} from '../../ol/expr/expression.js';\nimport {StringType as _ol_expr_expression$StringType} from '../../ol/expr/expression.js';\nimport {ColorType as _ol_expr_expression$ColorType} from '../../ol/expr/expression.js';\nimport {NumberArrayType as _ol_expr_expression$NumberArrayType} from '../../ol/expr/expression.js';\nimport {SizeType as _ol_expr_expression$SizeType} from '../../ol/expr/expression.js';\nimport {AnyType as _ol_expr_expression$AnyType} from '../../ol/expr/expression.js';\nimport {typeName as _ol_expr_expression$typeName} from '../../ol/expr/expression.js';\nimport {includesType as _ol_expr_expression$includesType} from '../../ol/expr/expression.js';\nimport {overlapsType as _ol_expr_expression$overlapsType} from '../../ol/expr/expression.js';\nimport {isType as _ol_expr_expression$isType} from '../../ol/expr/expression.js';\nimport {LiteralExpression as _ol_expr_expression$LiteralExpression} from '../../ol/expr/expression.js';\nimport {CallExpression as _ol_expr_expression$CallExpression} from '../../ol/expr/expression.js';\nimport {newParsingContext as _ol_expr_expression$newParsingContext} from '../../ol/expr/expression.js';\nimport {parse as _ol_expr_expression$parse} from '../../ol/expr/expression.js';\nimport {Ops as _ol_expr_expression$Ops} from '../../ol/expr/expression.js';\nimport {computeGeometryType as _ol_expr_expression$computeGeometryType} from '../../ol/expr/expression.js';\nimport {numberToGlsl as _ol_expr_gpu$numberToGlsl} from '../../ol/expr/gpu.js';\nimport {arrayToGlsl as _ol_expr_gpu$arrayToGlsl} from '../../ol/expr/gpu.js';\nimport {colorToGlsl as _ol_expr_gpu$colorToGlsl} from '../../ol/expr/gpu.js';\nimport {sizeToGlsl as _ol_expr_gpu$sizeToGlsl} from '../../ol/expr/gpu.js';\nimport {getStringNumberEquivalent as _ol_expr_gpu$getStringNumberEquivalent} from '../../ol/expr/gpu.js';\nimport {stringToGlsl as _ol_expr_gpu$stringToGlsl} from '../../ol/expr/gpu.js';\nimport {uniformNameForVariable as _ol_expr_gpu$uniformNameForVariable} from '../../ol/expr/gpu.js';\nimport {newCompilationContext as _ol_expr_gpu$newCompilationContext} from '../../ol/expr/gpu.js';\nimport {PALETTE_TEXTURE_ARRAY as _ol_expr_gpu$PALETTE_TEXTURE_ARRAY} from '../../ol/expr/gpu.js';\nimport {FEATURE_ID_PROPERTY_NAME as _ol_expr_gpu$FEATURE_ID_PROPERTY_NAME} from '../../ol/expr/gpu.js';\nimport {GEOMETRY_TYPE_PROPERTY_NAME as _ol_expr_gpu$GEOMETRY_TYPE_PROPERTY_NAME} from '../../ol/expr/gpu.js';\nimport {UNDEFINED_PROP_VALUE as _ol_expr_gpu$UNDEFINED_PROP_VALUE} from '../../ol/expr/gpu.js';\nimport {buildExpression as _ol_expr_gpu$buildExpression} from '../../ol/expr/gpu.js';\nimport $ol$events$Event from '../../ol/events/Event.js';\nimport {stopPropagation as _ol_events_Event$stopPropagation} from '../../ol/events/Event.js';\nimport {preventDefault as _ol_events_Event$preventDefault} from '../../ol/events/Event.js';\nimport {SnapEvent as _ol_events_SnapEvent$SnapEvent} from '../../ol/events/SnapEvent.js';\nimport $ol$events$Target from '../../ol/events/Target.js';\nimport {all as _ol_events_condition$all} from '../../ol/events/condition.js';\nimport {altKeyOnly as _ol_events_condition$altKeyOnly} from '../../ol/events/condition.js';\nimport {altShiftKeysOnly as _ol_events_condition$altShiftKeysOnly} from '../../ol/events/condition.js';\nimport {focus as _ol_events_condition$focus} from '../../ol/events/condition.js';\nimport {focusWithTabindex as _ol_events_condition$focusWithTabindex} from '../../ol/events/condition.js';\nimport {always as _ol_events_condition$always} from '../../ol/events/condition.js';\nimport {click as _ol_events_condition$click} from '../../ol/events/condition.js';\nimport {mouseActionButton as _ol_events_condition$mouseActionButton} from '../../ol/events/condition.js';\nimport {never as _ol_events_condition$never} from '../../ol/events/condition.js';\nimport {pointerMove as _ol_events_condition$pointerMove} from '../../ol/events/condition.js';\nimport {singleClick as _ol_events_condition$singleClick} from '../../ol/events/condition.js';\nimport {doubleClick as _ol_events_condition$doubleClick} from '../../ol/events/condition.js';\nimport {noModifierKeys as _ol_events_condition$noModifierKeys} from '../../ol/events/condition.js';\nimport {platformModifierKeyOnly as _ol_events_condition$platformModifierKeyOnly} from '../../ol/events/condition.js';\nimport {platformModifierKey as _ol_events_condition$platformModifierKey} from '../../ol/events/condition.js';\nimport {shiftKeyOnly as _ol_events_condition$shiftKeyOnly} from '../../ol/events/condition.js';\nimport {targetNotEditable as _ol_events_condition$targetNotEditable} from '../../ol/events/condition.js';\nimport {mouseOnly as _ol_events_condition$mouseOnly} from '../../ol/events/condition.js';\nimport {touchOnly as _ol_events_condition$touchOnly} from '../../ol/events/condition.js';\nimport {penOnly as _ol_events_condition$penOnly} from '../../ol/events/condition.js';\nimport {primaryAction as _ol_events_condition$primaryAction} from '../../ol/events/condition.js';\nimport $ol$control$Attribution from '../../ol/control/Attribution.js';\nimport $ol$control$Control from '../../ol/control/Control.js';\nimport $ol$control$FullScreen from '../../ol/control/FullScreen.js';\nimport $ol$control$MousePosition from '../../ol/control/MousePosition.js';\nimport $ol$control$OverviewMap from '../../ol/control/OverviewMap.js';\nimport $ol$control$Rotate from '../../ol/control/Rotate.js';\nimport $ol$control$ScaleLine from '../../ol/control/ScaleLine.js';\nimport $ol$control$Zoom from '../../ol/control/Zoom.js';\nimport $ol$control$ZoomSlider from '../../ol/control/ZoomSlider.js';\nimport $ol$control$ZoomToExtent from '../../ol/control/ZoomToExtent.js';\nimport {defaults as _ol_control_defaults$defaults} from '../../ol/control/defaults.js';\n\nvar ol = {};\nol.Collection = $ol$Collection;\nol.Collection.CollectionEvent = _ol_Collection$CollectionEvent;\nol.DataTile = $ol$DataTile;\nol.DataTile.asArrayLike = _ol_DataTile$asArrayLike;\nol.DataTile.asImageLike = _ol_DataTile$asImageLike;\nol.DataTile.disposedError = _ol_DataTile$disposedError;\nol.DataTile.toArray = _ol_DataTile$toArray;\nol.Disposable = $ol$Disposable;\nol.Feature = $ol$Feature;\nol.Feature.createStyleFunction = _ol_Feature$createStyleFunction;\nol.Geolocation = $ol$Geolocation;\nol.Geolocation.GeolocationError = _ol_Geolocation$GeolocationError;\nol.Image = $ol$Image;\nol.Image.decode = _ol_Image$decode;\nol.Image.decodeFallback = _ol_Image$decodeFallback;\nol.Image.listenImage = _ol_Image$listenImage;\nol.Image.load = _ol_Image$load;\nol.ImageCanvas = $ol$ImageCanvas;\nol.ImageTile = $ol$ImageTile;\nol.Kinetic = $ol$Kinetic;\nol.Map = $ol$Map;\nol.MapBrowserEvent = $ol$MapBrowserEvent;\nol.MapBrowserEventHandler = $ol$MapBrowserEventHandler;\nol.MapEvent = $ol$MapEvent;\nol.Object = $ol$Object;\nol.Object.ObjectEvent = _ol_Object$ObjectEvent;\nol.Observable = $ol$Observable;\nol.Observable.unByKey = _ol_Observable$unByKey;\nol.Overlay = $ol$Overlay;\nol.Tile = $ol$Tile;\nol.TileQueue = $ol$TileQueue;\nol.TileQueue.getTilePriority = _ol_TileQueue$getTilePriority;\nol.TileRange = $ol$TileRange;\nol.TileRange.createOrUpdate = _ol_TileRange$createOrUpdate;\nol.VectorRenderTile = $ol$VectorRenderTile;\nol.VectorTile = $ol$VectorTile;\nol.View = $ol$View;\nol.View.createCenterConstraint = _ol_View$createCenterConstraint;\nol.View.createResolutionConstraint = _ol_View$createResolutionConstraint;\nol.View.createRotationConstraint = _ol_View$createRotationConstraint;\nol.View.isNoopAnimation = _ol_View$isNoopAnimation;\nol.array = {};\nol.array.ascending = _ol_array$ascending;\nol.array.binarySearch = _ol_array$binarySearch;\nol.array.descending = _ol_array$descending;\nol.array.equals = _ol_array$equals;\nol.array.extend = _ol_array$extend;\nol.array.isSorted = _ol_array$isSorted;\nol.array.linearFindNearest = _ol_array$linearFindNearest;\nol.array.remove = _ol_array$remove;\nol.array.reverseSubArray = _ol_array$reverseSubArray;\nol.array.stableSort = _ol_array$stableSort;\nol.asserts = {};\nol.asserts.assert = _ol_asserts$assert;\nol.centerconstraint = {};\nol.centerconstraint.createExtent = _ol_centerconstraint$createExtent;\nol.centerconstraint.none = _ol_centerconstraint$none;\nol.color = {};\nol.color.NO_COLOR = _ol_color$NO_COLOR;\nol.color.asArray = _ol_color$asArray;\nol.color.asString = _ol_color$asString;\nol.color.fromString = _ol_color$fromString;\nol.color.isStringColor = _ol_color$isStringColor;\nol.color.lchaToRgba = _ol_color$lchaToRgba;\nol.color.rgbaToLcha = _ol_color$rgbaToLcha;\nol.color.toString = _ol_color$toString;\nol.color.withAlpha = _ol_color$withAlpha;\nol.colorlike = {};\nol.colorlike.asColorLike = _ol_colorlike$asColorLike;\nol.console = {};\nol.console.error = _ol_console$error;\nol.console.log = _ol_console$log;\nol.console.setLevel = _ol_console$setLevel;\nol.console.warn = _ol_console$warn;\nol.control = {};\nol.control.Attribution = $ol$control$Attribution;\nol.control.Control = $ol$control$Control;\nol.control.FullScreen = $ol$control$FullScreen;\nol.control.MousePosition = $ol$control$MousePosition;\nol.control.OverviewMap = $ol$control$OverviewMap;\nol.control.Rotate = $ol$control$Rotate;\nol.control.ScaleLine = $ol$control$ScaleLine;\nol.control.Zoom = $ol$control$Zoom;\nol.control.ZoomSlider = $ol$control$ZoomSlider;\nol.control.ZoomToExtent = $ol$control$ZoomToExtent;\nol.control.defaults = {};\nol.control.defaults.defaults = _ol_control_defaults$defaults;\nol.coordinate = {};\nol.coordinate.add = _ol_coordinate$add;\nol.coordinate.closestOnCircle = _ol_coordinate$closestOnCircle;\nol.coordinate.closestOnSegment = _ol_coordinate$closestOnSegment;\nol.coordinate.createStringXY = _ol_coordinate$createStringXY;\nol.coordinate.degreesToStringHDMS = _ol_coordinate$degreesToStringHDMS;\nol.coordinate.distance = _ol_coordinate$distance;\nol.coordinate.equals = _ol_coordinate$equals;\nol.coordinate.format = _ol_coordinate$format;\nol.coordinate.getWorldsAway = _ol_coordinate$getWorldsAway;\nol.coordinate.rotate = _ol_coordinate$rotate;\nol.coordinate.scale = _ol_coordinate$scale;\nol.coordinate.squaredDistance = _ol_coordinate$squaredDistance;\nol.coordinate.squaredDistanceToSegment = _ol_coordinate$squaredDistanceToSegment;\nol.coordinate.toStringHDMS = _ol_coordinate$toStringHDMS;\nol.coordinate.toStringXY = _ol_coordinate$toStringXY;\nol.coordinate.wrapX = _ol_coordinate$wrapX;\nol.css = {};\nol.css.CLASS_COLLAPSED = _ol_css$CLASS_COLLAPSED;\nol.css.CLASS_CONTROL = _ol_css$CLASS_CONTROL;\nol.css.CLASS_HIDDEN = _ol_css$CLASS_HIDDEN;\nol.css.CLASS_SELECTABLE = _ol_css$CLASS_SELECTABLE;\nol.css.CLASS_UNSELECTABLE = _ol_css$CLASS_UNSELECTABLE;\nol.css.CLASS_UNSUPPORTED = _ol_css$CLASS_UNSUPPORTED;\nol.css.fontWeights = _ol_css$fontWeights;\nol.css.getFontParameters = _ol_css$getFontParameters;\nol.dom = {};\nol.dom.createCanvasContext2D = _ol_dom$createCanvasContext2D;\nol.dom.getSharedCanvasContext2D = _ol_dom$getSharedCanvasContext2D;\nol.dom.outerHeight = _ol_dom$outerHeight;\nol.dom.outerWidth = _ol_dom$outerWidth;\nol.dom.releaseCanvas = _ol_dom$releaseCanvas;\nol.dom.removeChildren = _ol_dom$removeChildren;\nol.dom.replaceChildren = _ol_dom$replaceChildren;\nol.dom.replaceNode = _ol_dom$replaceNode;\nol.easing = {};\nol.easing.easeIn = _ol_easing$easeIn;\nol.easing.easeOut = _ol_easing$easeOut;\nol.easing.inAndOut = _ol_easing$inAndOut;\nol.easing.linear = _ol_easing$linear;\nol.easing.upAndDown = _ol_easing$upAndDown;\nol.events = {};\nol.events.Event = $ol$events$Event;\nol.events.Event.preventDefault = _ol_events_Event$preventDefault;\nol.events.Event.stopPropagation = _ol_events_Event$stopPropagation;\nol.events.SnapEvent = {};\nol.events.SnapEvent.SnapEvent = _ol_events_SnapEvent$SnapEvent;\nol.events.Target = $ol$events$Target;\nol.events.condition = {};\nol.events.condition.all = _ol_events_condition$all;\nol.events.condition.altKeyOnly = _ol_events_condition$altKeyOnly;\nol.events.condition.altShiftKeysOnly = _ol_events_condition$altShiftKeysOnly;\nol.events.condition.always = _ol_events_condition$always;\nol.events.condition.click = _ol_events_condition$click;\nol.events.condition.doubleClick = _ol_events_condition$doubleClick;\nol.events.condition.focus = _ol_events_condition$focus;\nol.events.condition.focusWithTabindex = _ol_events_condition$focusWithTabindex;\nol.events.condition.mouseActionButton = _ol_events_condition$mouseActionButton;\nol.events.condition.mouseOnly = _ol_events_condition$mouseOnly;\nol.events.condition.never = _ol_events_condition$never;\nol.events.condition.noModifierKeys = _ol_events_condition$noModifierKeys;\nol.events.condition.penOnly = _ol_events_condition$penOnly;\nol.events.condition.platformModifierKey = _ol_events_condition$platformModifierKey;\nol.events.condition.platformModifierKeyOnly = _ol_events_condition$platformModifierKeyOnly;\nol.events.condition.pointerMove = _ol_events_condition$pointerMove;\nol.events.condition.primaryAction = _ol_events_condition$primaryAction;\nol.events.condition.shiftKeyOnly = _ol_events_condition$shiftKeyOnly;\nol.events.condition.singleClick = _ol_events_condition$singleClick;\nol.events.condition.targetNotEditable = _ol_events_condition$targetNotEditable;\nol.events.condition.touchOnly = _ol_events_condition$touchOnly;\nol.events.listen = _ol_events$listen;\nol.events.listenOnce = _ol_events$listenOnce;\nol.events.unlistenByKey = _ol_events$unlistenByKey;\nol.expr = {};\nol.expr.cpu = {};\nol.expr.cpu.buildExpression = _ol_expr_cpu$buildExpression;\nol.expr.cpu.newEvaluationContext = _ol_expr_cpu$newEvaluationContext;\nol.expr.expression = {};\nol.expr.expression.AnyType = _ol_expr_expression$AnyType;\nol.expr.expression.BooleanType = _ol_expr_expression$BooleanType;\nol.expr.expression.CallExpression = _ol_expr_expression$CallExpression;\nol.expr.expression.ColorType = _ol_expr_expression$ColorType;\nol.expr.expression.LiteralExpression = _ol_expr_expression$LiteralExpression;\nol.expr.expression.NoneType = _ol_expr_expression$NoneType;\nol.expr.expression.NumberArrayType = _ol_expr_expression$NumberArrayType;\nol.expr.expression.NumberType = _ol_expr_expression$NumberType;\nol.expr.expression.Ops = _ol_expr_expression$Ops;\nol.expr.expression.SizeType = _ol_expr_expression$SizeType;\nol.expr.expression.StringType = _ol_expr_expression$StringType;\nol.expr.expression.computeGeometryType = _ol_expr_expression$computeGeometryType;\nol.expr.expression.includesType = _ol_expr_expression$includesType;\nol.expr.expression.isType = _ol_expr_expression$isType;\nol.expr.expression.newParsingContext = _ol_expr_expression$newParsingContext;\nol.expr.expression.overlapsType = _ol_expr_expression$overlapsType;\nol.expr.expression.parse = _ol_expr_expression$parse;\nol.expr.expression.typeName = _ol_expr_expression$typeName;\nol.expr.gpu = {};\nol.expr.gpu.FEATURE_ID_PROPERTY_NAME = _ol_expr_gpu$FEATURE_ID_PROPERTY_NAME;\nol.expr.gpu.GEOMETRY_TYPE_PROPERTY_NAME = _ol_expr_gpu$GEOMETRY_TYPE_PROPERTY_NAME;\nol.expr.gpu.PALETTE_TEXTURE_ARRAY = _ol_expr_gpu$PALETTE_TEXTURE_ARRAY;\nol.expr.gpu.UNDEFINED_PROP_VALUE = _ol_expr_gpu$UNDEFINED_PROP_VALUE;\nol.expr.gpu.arrayToGlsl = _ol_expr_gpu$arrayToGlsl;\nol.expr.gpu.buildExpression = _ol_expr_gpu$buildExpression;\nol.expr.gpu.colorToGlsl = _ol_expr_gpu$colorToGlsl;\nol.expr.gpu.getStringNumberEquivalent = _ol_expr_gpu$getStringNumberEquivalent;\nol.expr.gpu.newCompilationContext = _ol_expr_gpu$newCompilationContext;\nol.expr.gpu.numberToGlsl = _ol_expr_gpu$numberToGlsl;\nol.expr.gpu.sizeToGlsl = _ol_expr_gpu$sizeToGlsl;\nol.expr.gpu.stringToGlsl = _ol_expr_gpu$stringToGlsl;\nol.expr.gpu.uniformNameForVariable = _ol_expr_gpu$uniformNameForVariable;\nol.extent = {};\nol.extent.applyTransform = _ol_extent$applyTransform;\nol.extent.approximatelyEquals = _ol_extent$approximatelyEquals;\nol.extent.boundingExtent = _ol_extent$boundingExtent;\nol.extent.buffer = _ol_extent$buffer;\nol.extent.clone = _ol_extent$clone;\nol.extent.closestSquaredDistanceXY = _ol_extent$closestSquaredDistanceXY;\nol.extent.containsCoordinate = _ol_extent$containsCoordinate;\nol.extent.containsExtent = _ol_extent$containsExtent;\nol.extent.containsXY = _ol_extent$containsXY;\nol.extent.coordinateRelationship = _ol_extent$coordinateRelationship;\nol.extent.createEmpty = _ol_extent$createEmpty;\nol.extent.createOrUpdate = _ol_extent$createOrUpdate;\nol.extent.createOrUpdateEmpty = _ol_extent$createOrUpdateEmpty;\nol.extent.createOrUpdateFromCoordinate = _ol_extent$createOrUpdateFromCoordinate;\nol.extent.createOrUpdateFromCoordinates = _ol_extent$createOrUpdateFromCoordinates;\nol.extent.createOrUpdateFromFlatCoordinates = _ol_extent$createOrUpdateFromFlatCoordinates;\nol.extent.createOrUpdateFromRings = _ol_extent$createOrUpdateFromRings;\nol.extent.equals = _ol_extent$equals;\nol.extent.extend = _ol_extent$extend;\nol.extent.extendCoordinate = _ol_extent$extendCoordinate;\nol.extent.extendCoordinates = _ol_extent$extendCoordinates;\nol.extent.extendFlatCoordinates = _ol_extent$extendFlatCoordinates;\nol.extent.extendRings = _ol_extent$extendRings;\nol.extent.extendXY = _ol_extent$extendXY;\nol.extent.forEachCorner = _ol_extent$forEachCorner;\nol.extent.getArea = _ol_extent$getArea;\nol.extent.getBottomLeft = _ol_extent$getBottomLeft;\nol.extent.getBottomRight = _ol_extent$getBottomRight;\nol.extent.getCenter = _ol_extent$getCenter;\nol.extent.getCorner = _ol_extent$getCorner;\nol.extent.getEnlargedArea = _ol_extent$getEnlargedArea;\nol.extent.getForViewAndSize = _ol_extent$getForViewAndSize;\nol.extent.getHeight = _ol_extent$getHeight;\nol.extent.getIntersection = _ol_extent$getIntersection;\nol.extent.getIntersectionArea = _ol_extent$getIntersectionArea;\nol.extent.getMargin = _ol_extent$getMargin;\nol.extent.getRotatedViewport = _ol_extent$getRotatedViewport;\nol.extent.getSize = _ol_extent$getSize;\nol.extent.getTopLeft = _ol_extent$getTopLeft;\nol.extent.getTopRight = _ol_extent$getTopRight;\nol.extent.getWidth = _ol_extent$getWidth;\nol.extent.intersects = _ol_extent$intersects;\nol.extent.intersectsSegment = _ol_extent$intersectsSegment;\nol.extent.isEmpty = _ol_extent$isEmpty;\nol.extent.returnOrUpdate = _ol_extent$returnOrUpdate;\nol.extent.scaleFromCenter = _ol_extent$scaleFromCenter;\nol.extent.wrapAndSliceX = _ol_extent$wrapAndSliceX;\nol.extent.wrapX = _ol_extent$wrapX;\nol.featureloader = {};\nol.featureloader.loadFeaturesXhr = _ol_featureloader$loadFeaturesXhr;\nol.featureloader.setWithCredentials = _ol_featureloader$setWithCredentials;\nol.featureloader.xhr = _ol_featureloader$xhr;\nol.format = {};\nol.format.EsriJSON = $ol$format$EsriJSON;\nol.format.Feature = $ol$format$Feature;\nol.format.Feature.createGeometry = _ol_format_Feature$createGeometry;\nol.format.Feature.createRenderFeature = _ol_format_Feature$createRenderFeature;\nol.format.Feature.transformExtentWithOptions = _ol_format_Feature$transformExtentWithOptions;\nol.format.Feature.transformGeometryWithOptions = _ol_format_Feature$transformGeometryWithOptions;\nol.format.GML = $ol$format$GML;\nol.format.GML2 = $ol$format$GML2;\nol.format.GML3 = $ol$format$GML3;\nol.format.GML32 = $ol$format$GML32;\nol.format.GMLBase = $ol$format$GMLBase;\nol.format.GMLBase.GMLNS = _ol_format_GMLBase$GMLNS;\nol.format.GPX = $ol$format$GPX;\nol.format.GeoJSON = $ol$format$GeoJSON;\nol.format.IGC = $ol$format$IGC;\nol.format.IIIFInfo = $ol$format$IIIFInfo;\nol.format.JSONFeature = $ol$format$JSONFeature;\nol.format.KML = $ol$format$KML;\nol.format.KML.getDefaultFillStyle = _ol_format_KML$getDefaultFillStyle;\nol.format.KML.getDefaultImageStyle = _ol_format_KML$getDefaultImageStyle;\nol.format.KML.getDefaultStrokeStyle = _ol_format_KML$getDefaultStrokeStyle;\nol.format.KML.getDefaultStyle = _ol_format_KML$getDefaultStyle;\nol.format.KML.getDefaultStyleArray = _ol_format_KML$getDefaultStyleArray;\nol.format.KML.getDefaultTextStyle = _ol_format_KML$getDefaultTextStyle;\nol.format.KML.readFlatCoordinates = _ol_format_KML$readFlatCoordinates;\nol.format.MVT = $ol$format$MVT;\nol.format.OSMXML = $ol$format$OSMXML;\nol.format.OWS = $ol$format$OWS;\nol.format.Polyline = $ol$format$Polyline;\nol.format.Polyline.decodeDeltas = _ol_format_Polyline$decodeDeltas;\nol.format.Polyline.decodeFloats = _ol_format_Polyline$decodeFloats;\nol.format.Polyline.decodeSignedIntegers = _ol_format_Polyline$decodeSignedIntegers;\nol.format.Polyline.decodeUnsignedIntegers = _ol_format_Polyline$decodeUnsignedIntegers;\nol.format.Polyline.encodeDeltas = _ol_format_Polyline$encodeDeltas;\nol.format.Polyline.encodeFloats = _ol_format_Polyline$encodeFloats;\nol.format.Polyline.encodeSignedIntegers = _ol_format_Polyline$encodeSignedIntegers;\nol.format.Polyline.encodeUnsignedInteger = _ol_format_Polyline$encodeUnsignedInteger;\nol.format.Polyline.encodeUnsignedIntegers = _ol_format_Polyline$encodeUnsignedIntegers;\nol.format.TextFeature = $ol$format$TextFeature;\nol.format.TopoJSON = $ol$format$TopoJSON;\nol.format.WFS = $ol$format$WFS;\nol.format.WFS.writeFilter = _ol_format_WFS$writeFilter;\nol.format.WKB = $ol$format$WKB;\nol.format.WKT = $ol$format$WKT;\nol.format.WMSCapabilities = $ol$format$WMSCapabilities;\nol.format.WMSGetFeatureInfo = $ol$format$WMSGetFeatureInfo;\nol.format.WMTSCapabilities = $ol$format$WMTSCapabilities;\nol.format.XML = $ol$format$XML;\nol.format.XMLFeature = $ol$format$XMLFeature;\nol.format.filter = {};\nol.format.filter.And = $ol$format$filter$And;\nol.format.filter.Bbox = $ol$format$filter$Bbox;\nol.format.filter.Comparison = $ol$format$filter$Comparison;\nol.format.filter.ComparisonBinary = $ol$format$filter$ComparisonBinary;\nol.format.filter.Contains = $ol$format$filter$Contains;\nol.format.filter.DWithin = $ol$format$filter$DWithin;\nol.format.filter.Disjoint = $ol$format$filter$Disjoint;\nol.format.filter.During = $ol$format$filter$During;\nol.format.filter.EqualTo = $ol$format$filter$EqualTo;\nol.format.filter.Filter = $ol$format$filter$Filter;\nol.format.filter.GreaterThan = $ol$format$filter$GreaterThan;\nol.format.filter.GreaterThanOrEqualTo = $ol$format$filter$GreaterThanOrEqualTo;\nol.format.filter.Intersects = $ol$format$filter$Intersects;\nol.format.filter.IsBetween = $ol$format$filter$IsBetween;\nol.format.filter.IsLike = $ol$format$filter$IsLike;\nol.format.filter.IsNull = $ol$format$filter$IsNull;\nol.format.filter.LessThan = $ol$format$filter$LessThan;\nol.format.filter.LessThanOrEqualTo = $ol$format$filter$LessThanOrEqualTo;\nol.format.filter.LogicalNary = $ol$format$filter$LogicalNary;\nol.format.filter.Not = $ol$format$filter$Not;\nol.format.filter.NotEqualTo = $ol$format$filter$NotEqualTo;\nol.format.filter.Or = $ol$format$filter$Or;\nol.format.filter.ResourceId = $ol$format$filter$ResourceId;\nol.format.filter.Spatial = $ol$format$filter$Spatial;\nol.format.filter.Within = $ol$format$filter$Within;\nol.format.filter.and = _ol_format_filter$and;\nol.format.filter.bbox = _ol_format_filter$bbox;\nol.format.filter.between = _ol_format_filter$between;\nol.format.filter.contains = _ol_format_filter$contains;\nol.format.filter.disjoint = _ol_format_filter$disjoint;\nol.format.filter.during = _ol_format_filter$during;\nol.format.filter.dwithin = _ol_format_filter$dwithin;\nol.format.filter.equalTo = _ol_format_filter$equalTo;\nol.format.filter.greaterThan = _ol_format_filter$greaterThan;\nol.format.filter.greaterThanOrEqualTo = _ol_format_filter$greaterThanOrEqualTo;\nol.format.filter.intersects = _ol_format_filter$intersects;\nol.format.filter.isNull = _ol_format_filter$isNull;\nol.format.filter.lessThan = _ol_format_filter$lessThan;\nol.format.filter.lessThanOrEqualTo = _ol_format_filter$lessThanOrEqualTo;\nol.format.filter.like = _ol_format_filter$like;\nol.format.filter.not = _ol_format_filter$not;\nol.format.filter.notEqualTo = _ol_format_filter$notEqualTo;\nol.format.filter.or = _ol_format_filter$or;\nol.format.filter.resourceId = _ol_format_filter$resourceId;\nol.format.filter.within = _ol_format_filter$within;\nol.format.xlink = {};\nol.format.xlink.readHref = _ol_format_xlink$readHref;\nol.format.xsd = {};\nol.format.xsd.readBoolean = _ol_format_xsd$readBoolean;\nol.format.xsd.readBooleanString = _ol_format_xsd$readBooleanString;\nol.format.xsd.readDateTime = _ol_format_xsd$readDateTime;\nol.format.xsd.readDecimal = _ol_format_xsd$readDecimal;\nol.format.xsd.readDecimalString = _ol_format_xsd$readDecimalString;\nol.format.xsd.readNonNegativeIntegerString = _ol_format_xsd$readNonNegativeIntegerString;\nol.format.xsd.readPositiveInteger = _ol_format_xsd$readPositiveInteger;\nol.format.xsd.readString = _ol_format_xsd$readString;\nol.format.xsd.writeBooleanTextNode = _ol_format_xsd$writeBooleanTextNode;\nol.format.xsd.writeCDATASection = _ol_format_xsd$writeCDATASection;\nol.format.xsd.writeDateTimeTextNode = _ol_format_xsd$writeDateTimeTextNode;\nol.format.xsd.writeDecimalTextNode = _ol_format_xsd$writeDecimalTextNode;\nol.format.xsd.writeNonNegativeIntegerTextNode = _ol_format_xsd$writeNonNegativeIntegerTextNode;\nol.format.xsd.writeStringTextNode = _ol_format_xsd$writeStringTextNode;\nol.functions = {};\nol.functions.FALSE = _ol_functions$FALSE;\nol.functions.TRUE = _ol_functions$TRUE;\nol.functions.VOID = _ol_functions$VOID;\nol.functions.memoizeOne = _ol_functions$memoizeOne;\nol.functions.toPromise = _ol_functions$toPromise;\nol.geom = {};\nol.geom.Circle = $ol$geom$Circle;\nol.geom.Geometry = $ol$geom$Geometry;\nol.geom.GeometryCollection = $ol$geom$GeometryCollection;\nol.geom.LineString = $ol$geom$LineString;\nol.geom.LinearRing = $ol$geom$LinearRing;\nol.geom.MultiLineString = $ol$geom$MultiLineString;\nol.geom.MultiPoint = $ol$geom$MultiPoint;\nol.geom.MultiPolygon = $ol$geom$MultiPolygon;\nol.geom.Point = $ol$geom$Point;\nol.geom.Polygon = $ol$geom$Polygon;\nol.geom.Polygon.circular = _ol_geom_Polygon$circular;\nol.geom.Polygon.fromCircle = _ol_geom_Polygon$fromCircle;\nol.geom.Polygon.fromExtent = _ol_geom_Polygon$fromExtent;\nol.geom.Polygon.makeRegular = _ol_geom_Polygon$makeRegular;\nol.geom.SimpleGeometry = $ol$geom$SimpleGeometry;\nol.geom.SimpleGeometry.getLayoutForStride = _ol_geom_SimpleGeometry$getLayoutForStride;\nol.geom.SimpleGeometry.getStrideForLayout = _ol_geom_SimpleGeometry$getStrideForLayout;\nol.geom.SimpleGeometry.transformGeom2D = _ol_geom_SimpleGeometry$transformGeom2D;\nol.geom.flat = {};\nol.geom.flat.area = {};\nol.geom.flat.area.linearRing = _ol_geom_flat_area$linearRing;\nol.geom.flat.area.linearRings = _ol_geom_flat_area$linearRings;\nol.geom.flat.area.linearRingss = _ol_geom_flat_area$linearRingss;\nol.geom.flat.center = {};\nol.geom.flat.center.linearRingss = _ol_geom_flat_center$linearRingss;\nol.geom.flat.closest = {};\nol.geom.flat.closest.arrayMaxSquaredDelta = _ol_geom_flat_closest$arrayMaxSquaredDelta;\nol.geom.flat.closest.assignClosestArrayPoint = _ol_geom_flat_closest$assignClosestArrayPoint;\nol.geom.flat.closest.assignClosestMultiArrayPoint = _ol_geom_flat_closest$assignClosestMultiArrayPoint;\nol.geom.flat.closest.assignClosestPoint = _ol_geom_flat_closest$assignClosestPoint;\nol.geom.flat.closest.maxSquaredDelta = _ol_geom_flat_closest$maxSquaredDelta;\nol.geom.flat.closest.multiArrayMaxSquaredDelta = _ol_geom_flat_closest$multiArrayMaxSquaredDelta;\nol.geom.flat.contains = {};\nol.geom.flat.contains.linearRingContainsExtent = _ol_geom_flat_contains$linearRingContainsExtent;\nol.geom.flat.contains.linearRingContainsXY = _ol_geom_flat_contains$linearRingContainsXY;\nol.geom.flat.contains.linearRingsContainsXY = _ol_geom_flat_contains$linearRingsContainsXY;\nol.geom.flat.contains.linearRingssContainsXY = _ol_geom_flat_contains$linearRingssContainsXY;\nol.geom.flat.deflate = {};\nol.geom.flat.deflate.deflateCoordinate = _ol_geom_flat_deflate$deflateCoordinate;\nol.geom.flat.deflate.deflateCoordinates = _ol_geom_flat_deflate$deflateCoordinates;\nol.geom.flat.deflate.deflateCoordinatesArray = _ol_geom_flat_deflate$deflateCoordinatesArray;\nol.geom.flat.deflate.deflateMultiCoordinatesArray = _ol_geom_flat_deflate$deflateMultiCoordinatesArray;\nol.geom.flat.flip = {};\nol.geom.flat.flip.flipXY = _ol_geom_flat_flip$flipXY;\nol.geom.flat.geodesic = {};\nol.geom.flat.geodesic.greatCircleArc = _ol_geom_flat_geodesic$greatCircleArc;\nol.geom.flat.geodesic.meridian = _ol_geom_flat_geodesic$meridian;\nol.geom.flat.geodesic.parallel = _ol_geom_flat_geodesic$parallel;\nol.geom.flat.inflate = {};\nol.geom.flat.inflate.inflateCoordinates = _ol_geom_flat_inflate$inflateCoordinates;\nol.geom.flat.inflate.inflateCoordinatesArray = _ol_geom_flat_inflate$inflateCoordinatesArray;\nol.geom.flat.inflate.inflateMultiCoordinatesArray = _ol_geom_flat_inflate$inflateMultiCoordinatesArray;\nol.geom.flat.interiorpoint = {};\nol.geom.flat.interiorpoint.getInteriorPointOfArray = _ol_geom_flat_interiorpoint$getInteriorPointOfArray;\nol.geom.flat.interiorpoint.getInteriorPointsOfMultiArray = _ol_geom_flat_interiorpoint$getInteriorPointsOfMultiArray;\nol.geom.flat.interpolate = {};\nol.geom.flat.interpolate.interpolatePoint = _ol_geom_flat_interpolate$interpolatePoint;\nol.geom.flat.interpolate.lineStringCoordinateAtM = _ol_geom_flat_interpolate$lineStringCoordinateAtM;\nol.geom.flat.interpolate.lineStringsCoordinateAtM = _ol_geom_flat_interpolate$lineStringsCoordinateAtM;\nol.geom.flat.intersectsextent = {};\nol.geom.flat.intersectsextent.intersectsLineString = _ol_geom_flat_intersectsextent$intersectsLineString;\nol.geom.flat.intersectsextent.intersectsLineStringArray = _ol_geom_flat_intersectsextent$intersectsLineStringArray;\nol.geom.flat.intersectsextent.intersectsLinearRing = _ol_geom_flat_intersectsextent$intersectsLinearRing;\nol.geom.flat.intersectsextent.intersectsLinearRingArray = _ol_geom_flat_intersectsextent$intersectsLinearRingArray;\nol.geom.flat.intersectsextent.intersectsLinearRingMultiArray = _ol_geom_flat_intersectsextent$intersectsLinearRingMultiArray;\nol.geom.flat.length = {};\nol.geom.flat.length.lineStringLength = _ol_geom_flat_length$lineStringLength;\nol.geom.flat.length.linearRingLength = _ol_geom_flat_length$linearRingLength;\nol.geom.flat.orient = {};\nol.geom.flat.orient.inflateEnds = _ol_geom_flat_orient$inflateEnds;\nol.geom.flat.orient.linearRingIsClockwise = _ol_geom_flat_orient$linearRingIsClockwise;\nol.geom.flat.orient.linearRingsAreOriented = _ol_geom_flat_orient$linearRingsAreOriented;\nol.geom.flat.orient.linearRingssAreOriented = _ol_geom_flat_orient$linearRingssAreOriented;\nol.geom.flat.orient.orientLinearRings = _ol_geom_flat_orient$orientLinearRings;\nol.geom.flat.orient.orientLinearRingsArray = _ol_geom_flat_orient$orientLinearRingsArray;\nol.geom.flat.reverse = {};\nol.geom.flat.reverse.coordinates = _ol_geom_flat_reverse$coordinates;\nol.geom.flat.segments = {};\nol.geom.flat.segments.forEach = _ol_geom_flat_segments$forEach;\nol.geom.flat.segments.getIntersectionPoint = _ol_geom_flat_segments$getIntersectionPoint;\nol.geom.flat.simplify = {};\nol.geom.flat.simplify.douglasPeucker = _ol_geom_flat_simplify$douglasPeucker;\nol.geom.flat.simplify.douglasPeuckerArray = _ol_geom_flat_simplify$douglasPeuckerArray;\nol.geom.flat.simplify.douglasPeuckerMultiArray = _ol_geom_flat_simplify$douglasPeuckerMultiArray;\nol.geom.flat.simplify.quantize = _ol_geom_flat_simplify$quantize;\nol.geom.flat.simplify.quantizeArray = _ol_geom_flat_simplify$quantizeArray;\nol.geom.flat.simplify.quantizeMultiArray = _ol_geom_flat_simplify$quantizeMultiArray;\nol.geom.flat.simplify.radialDistance = _ol_geom_flat_simplify$radialDistance;\nol.geom.flat.simplify.simplifyLineString = _ol_geom_flat_simplify$simplifyLineString;\nol.geom.flat.simplify.snap = _ol_geom_flat_simplify$snap;\nol.geom.flat.straightchunk = {};\nol.geom.flat.straightchunk.matchingChunk = _ol_geom_flat_straightchunk$matchingChunk;\nol.geom.flat.textpath = {};\nol.geom.flat.textpath.drawTextOnPath = _ol_geom_flat_textpath$drawTextOnPath;\nol.geom.flat.topology = {};\nol.geom.flat.topology.lineStringIsClosed = _ol_geom_flat_topology$lineStringIsClosed;\nol.geom.flat.transform = {};\nol.geom.flat.transform.rotate = _ol_geom_flat_transform$rotate;\nol.geom.flat.transform.scale = _ol_geom_flat_transform$scale;\nol.geom.flat.transform.transform2D = _ol_geom_flat_transform$transform2D;\nol.geom.flat.transform.translate = _ol_geom_flat_transform$translate;\nol.has = {};\nol.has.CREATE_IMAGE_BITMAP = _ol_has$CREATE_IMAGE_BITMAP;\nol.has.DEVICE_PIXEL_RATIO = _ol_has$DEVICE_PIXEL_RATIO;\nol.has.IMAGE_DECODE = _ol_has$IMAGE_DECODE;\nol.has.MAC = _ol_has$MAC;\nol.has.PASSIVE_EVENT_LISTENERS = _ol_has$PASSIVE_EVENT_LISTENERS;\nol.has.SAFARI = _ol_has$SAFARI;\nol.has.SAFARI_BUG_237906 = _ol_has$SAFARI_BUG_237906;\nol.has.WEBKIT = _ol_has$WEBKIT;\nol.has.WORKER_OFFSCREEN_CANVAS = _ol_has$WORKER_OFFSCREEN_CANVAS;\nol.interaction = {};\nol.interaction.DblClickDragZoom = $ol$interaction$DblClickDragZoom;\nol.interaction.DoubleClickZoom = $ol$interaction$DoubleClickZoom;\nol.interaction.DragAndDrop = $ol$interaction$DragAndDrop;\nol.interaction.DragAndDrop.DragAndDropEvent = _ol_interaction_DragAndDrop$DragAndDropEvent;\nol.interaction.DragBox = $ol$interaction$DragBox;\nol.interaction.DragBox.DragBoxEvent = _ol_interaction_DragBox$DragBoxEvent;\nol.interaction.DragPan = $ol$interaction$DragPan;\nol.interaction.DragRotate = $ol$interaction$DragRotate;\nol.interaction.DragRotateAndZoom = $ol$interaction$DragRotateAndZoom;\nol.interaction.DragZoom = $ol$interaction$DragZoom;\nol.interaction.Draw = $ol$interaction$Draw;\nol.interaction.Draw.DrawEvent = _ol_interaction_Draw$DrawEvent;\nol.interaction.Draw.createBox = _ol_interaction_Draw$createBox;\nol.interaction.Draw.createRegularPolygon = _ol_interaction_Draw$createRegularPolygon;\nol.interaction.Extent = $ol$interaction$Extent;\nol.interaction.Extent.ExtentEvent = _ol_interaction_Extent$ExtentEvent;\nol.interaction.Interaction = $ol$interaction$Interaction;\nol.interaction.Interaction.pan = _ol_interaction_Interaction$pan;\nol.interaction.Interaction.zoomByDelta = _ol_interaction_Interaction$zoomByDelta;\nol.interaction.KeyboardPan = $ol$interaction$KeyboardPan;\nol.interaction.KeyboardZoom = $ol$interaction$KeyboardZoom;\nol.interaction.Link = $ol$interaction$Link;\nol.interaction.Modify = $ol$interaction$Modify;\nol.interaction.Modify.ModifyEvent = _ol_interaction_Modify$ModifyEvent;\nol.interaction.MouseWheelZoom = $ol$interaction$MouseWheelZoom;\nol.interaction.PinchRotate = $ol$interaction$PinchRotate;\nol.interaction.PinchZoom = $ol$interaction$PinchZoom;\nol.interaction.Pointer = $ol$interaction$Pointer;\nol.interaction.Pointer.centroid = _ol_interaction_Pointer$centroid;\nol.interaction.Select = $ol$interaction$Select;\nol.interaction.Select.SelectEvent = _ol_interaction_Select$SelectEvent;\nol.interaction.Snap = $ol$interaction$Snap;\nol.interaction.Translate = $ol$interaction$Translate;\nol.interaction.Translate.TranslateEvent = _ol_interaction_Translate$TranslateEvent;\nol.interaction.defaults = {};\nol.interaction.defaults.defaults = _ol_interaction_defaults$defaults;\nol.layer = {};\nol.layer.Base = $ol$layer$Base;\nol.layer.BaseImage = $ol$layer$BaseImage;\nol.layer.BaseTile = $ol$layer$BaseTile;\nol.layer.BaseVector = $ol$layer$BaseVector;\nol.layer.Flow = $ol$layer$Flow;\nol.layer.Graticule = $ol$layer$Graticule;\nol.layer.Group = $ol$layer$Group;\nol.layer.Group.GroupEvent = _ol_layer_Group$GroupEvent;\nol.layer.Heatmap = $ol$layer$Heatmap;\nol.layer.Image = $ol$layer$Image;\nol.layer.Layer = $ol$layer$Layer;\nol.layer.Layer.inView = _ol_layer_Layer$inView;\nol.layer.Tile = $ol$layer$Tile;\nol.layer.Vector = $ol$layer$Vector;\nol.layer.VectorImage = $ol$layer$VectorImage;\nol.layer.VectorTile = $ol$layer$VectorTile;\nol.layer.WebGLPoints = $ol$layer$WebGLPoints;\nol.layer.WebGLTile = $ol$layer$WebGLTile;\nol.layer.WebGLVector = $ol$layer$WebGLVector;\nol.layer.WebGLVectorTile = $ol$layer$WebGLVectorTile;\nol.loadingstrategy = {};\nol.loadingstrategy.all = _ol_loadingstrategy$all;\nol.loadingstrategy.bbox = _ol_loadingstrategy$bbox;\nol.loadingstrategy.tile = _ol_loadingstrategy$tile;\nol.math = {};\nol.math.ceil = _ol_math$ceil;\nol.math.clamp = _ol_math$clamp;\nol.math.floor = _ol_math$floor;\nol.math.lerp = _ol_math$lerp;\nol.math.modulo = _ol_math$modulo;\nol.math.round = _ol_math$round;\nol.math.solveLinearSystem = _ol_math$solveLinearSystem;\nol.math.squaredDistance = _ol_math$squaredDistance;\nol.math.squaredSegmentDistance = _ol_math$squaredSegmentDistance;\nol.math.toDegrees = _ol_math$toDegrees;\nol.math.toFixed = _ol_math$toFixed;\nol.math.toRadians = _ol_math$toRadians;\nol.math.wrap = _ol_math$wrap;\nol.net = {};\nol.net.ClientError = _ol_net$ClientError;\nol.net.ResponseError = _ol_net$ResponseError;\nol.net.getJSON = _ol_net$getJSON;\nol.net.jsonp = _ol_net$jsonp;\nol.net.overrideXHR = _ol_net$overrideXHR;\nol.net.resolveUrl = _ol_net$resolveUrl;\nol.net.restoreXHR = _ol_net$restoreXHR;\nol.obj = {};\nol.obj.clear = _ol_obj$clear;\nol.obj.isEmpty = _ol_obj$isEmpty;\nol.proj = {};\nol.proj.Projection = $ol$proj$Projection;\nol.proj.Units = {};\nol.proj.Units.METERS_PER_UNIT = _ol_proj_Units$METERS_PER_UNIT;\nol.proj.Units.fromCode = _ol_proj_Units$fromCode;\nol.proj.addCommon = _ol_proj$addCommon;\nol.proj.addCoordinateTransforms = _ol_proj$addCoordinateTransforms;\nol.proj.addEquivalentProjections = _ol_proj$addEquivalentProjections;\nol.proj.addEquivalentTransforms = _ol_proj$addEquivalentTransforms;\nol.proj.addProjection = _ol_proj$addProjection;\nol.proj.addProjections = _ol_proj$addProjections;\nol.proj.clearAllProjections = _ol_proj$clearAllProjections;\nol.proj.clearUserProjection = _ol_proj$clearUserProjection;\nol.proj.cloneTransform = _ol_proj$cloneTransform;\nol.proj.createProjection = _ol_proj$createProjection;\nol.proj.createSafeCoordinateTransform = _ol_proj$createSafeCoordinateTransform;\nol.proj.createTransformFromCoordinateTransform = _ol_proj$createTransformFromCoordinateTransform;\nol.proj.disableCoordinateWarning = _ol_proj$disableCoordinateWarning;\nol.proj.epsg3857 = {};\nol.proj.epsg3857.EXTENT = _ol_proj_epsg3857$EXTENT;\nol.proj.epsg3857.HALF_SIZE = _ol_proj_epsg3857$HALF_SIZE;\nol.proj.epsg3857.MAX_SAFE_Y = _ol_proj_epsg3857$MAX_SAFE_Y;\nol.proj.epsg3857.PROJECTIONS = _ol_proj_epsg3857$PROJECTIONS;\nol.proj.epsg3857.RADIUS = _ol_proj_epsg3857$RADIUS;\nol.proj.epsg3857.WORLD_EXTENT = _ol_proj_epsg3857$WORLD_EXTENT;\nol.proj.epsg3857.fromEPSG4326 = _ol_proj_epsg3857$fromEPSG4326;\nol.proj.epsg3857.toEPSG4326 = _ol_proj_epsg3857$toEPSG4326;\nol.proj.epsg4326 = {};\nol.proj.epsg4326.EXTENT = _ol_proj_epsg4326$EXTENT;\nol.proj.epsg4326.METERS_PER_UNIT = _ol_proj_epsg4326$METERS_PER_UNIT;\nol.proj.epsg4326.PROJECTIONS = _ol_proj_epsg4326$PROJECTIONS;\nol.proj.epsg4326.RADIUS = _ol_proj_epsg4326$RADIUS;\nol.proj.equivalent = _ol_proj$equivalent;\nol.proj.fromLonLat = _ol_proj$fromLonLat;\nol.proj.fromUserCoordinate = _ol_proj$fromUserCoordinate;\nol.proj.fromUserExtent = _ol_proj$fromUserExtent;\nol.proj.fromUserResolution = _ol_proj$fromUserResolution;\nol.proj.get = _ol_proj$get;\nol.proj.getPointResolution = _ol_proj$getPointResolution;\nol.proj.getTransform = _ol_proj$getTransform;\nol.proj.getTransformFromProjections = _ol_proj$getTransformFromProjections;\nol.proj.getUserProjection = _ol_proj$getUserProjection;\nol.proj.identityTransform = _ol_proj$identityTransform;\nol.proj.proj4 = {};\nol.proj.proj4.epsgLookupMapTiler = _ol_proj_proj4$epsgLookupMapTiler;\nol.proj.proj4.fromEPSGCode = _ol_proj_proj4$fromEPSGCode;\nol.proj.proj4.getEPSGLookup = _ol_proj_proj4$getEPSGLookup;\nol.proj.proj4.isRegistered = _ol_proj_proj4$isRegistered;\nol.proj.proj4.register = _ol_proj_proj4$register;\nol.proj.proj4.setEPSGLookup = _ol_proj_proj4$setEPSGLookup;\nol.proj.proj4.unregister = _ol_proj_proj4$unregister;\nol.proj.projections = {};\nol.proj.projections.add = _ol_proj_projections$add;\nol.proj.projections.clear = _ol_proj_projections$clear;\nol.proj.projections.get = _ol_proj_projections$get;\nol.proj.setUserProjection = _ol_proj$setUserProjection;\nol.proj.toLonLat = _ol_proj$toLonLat;\nol.proj.toUserCoordinate = _ol_proj$toUserCoordinate;\nol.proj.toUserExtent = _ol_proj$toUserExtent;\nol.proj.toUserResolution = _ol_proj$toUserResolution;\nol.proj.transform = _ol_proj$transform;\nol.proj.transformExtent = _ol_proj$transformExtent;\nol.proj.transformWithProjections = _ol_proj$transformWithProjections;\nol.proj.transforms = {};\nol.proj.transforms.add = _ol_proj_transforms$add;\nol.proj.transforms.clear = _ol_proj_transforms$clear;\nol.proj.transforms.get = _ol_proj_transforms$get;\nol.proj.transforms.remove = _ol_proj_transforms$remove;\nol.proj.useGeographic = _ol_proj$useGeographic;\nol.proj.utm = {};\nol.proj.utm.makeProjection = _ol_proj_utm$makeProjection;\nol.proj.utm.makeTransforms = _ol_proj_utm$makeTransforms;\nol.proj.utm.zoneFromCode = _ol_proj_utm$zoneFromCode;\nol.render = {};\nol.render.Box = $ol$render$Box;\nol.render.Event = $ol$render$Event;\nol.render.Feature = $ol$render$Feature;\nol.render.Feature.toFeature = _ol_render_Feature$toFeature;\nol.render.Feature.toGeometry = _ol_render_Feature$toGeometry;\nol.render.VectorContext = $ol$render$VectorContext;\nol.render.canvas = {};\nol.render.canvas.Builder = $ol$render$canvas$Builder;\nol.render.canvas.BuilderGroup = $ol$render$canvas$BuilderGroup;\nol.render.canvas.Executor = $ol$render$canvas$Executor;\nol.render.canvas.ExecutorGroup = $ol$render$canvas$ExecutorGroup;\nol.render.canvas.ExecutorGroup.ALL = _ol_render_canvas_ExecutorGroup$ALL;\nol.render.canvas.ExecutorGroup.DECLUTTER = _ol_render_canvas_ExecutorGroup$DECLUTTER;\nol.render.canvas.ExecutorGroup.NON_DECLUTTER = _ol_render_canvas_ExecutorGroup$NON_DECLUTTER;\nol.render.canvas.ExecutorGroup.getPixelIndexArray = _ol_render_canvas_ExecutorGroup$getPixelIndexArray;\nol.render.canvas.ImageBuilder = $ol$render$canvas$ImageBuilder;\nol.render.canvas.Immediate = $ol$render$canvas$Immediate;\nol.render.canvas.Instruction = {};\nol.render.canvas.Instruction.beginPathInstruction = _ol_render_canvas_Instruction$beginPathInstruction;\nol.render.canvas.Instruction.closePathInstruction = _ol_render_canvas_Instruction$closePathInstruction;\nol.render.canvas.Instruction.fillInstruction = _ol_render_canvas_Instruction$fillInstruction;\nol.render.canvas.Instruction.strokeInstruction = _ol_render_canvas_Instruction$strokeInstruction;\nol.render.canvas.LineStringBuilder = $ol$render$canvas$LineStringBuilder;\nol.render.canvas.PolygonBuilder = $ol$render$canvas$PolygonBuilder;\nol.render.canvas.TextBuilder = $ol$render$canvas$TextBuilder;\nol.render.canvas.TextBuilder.TEXT_ALIGN = _ol_render_canvas_TextBuilder$TEXT_ALIGN;\nol.render.canvas.ZIndexContext = $ol$render$canvas$ZIndexContext;\nol.render.canvas.checkedFonts = _ol_render_canvas$checkedFonts;\nol.render.canvas.defaultFillStyle = _ol_render_canvas$defaultFillStyle;\nol.render.canvas.defaultFont = _ol_render_canvas$defaultFont;\nol.render.canvas.defaultLineCap = _ol_render_canvas$defaultLineCap;\nol.render.canvas.defaultLineDash = _ol_render_canvas$defaultLineDash;\nol.render.canvas.defaultLineDashOffset = _ol_render_canvas$defaultLineDashOffset;\nol.render.canvas.defaultLineJoin = _ol_render_canvas$defaultLineJoin;\nol.render.canvas.defaultLineWidth = _ol_render_canvas$defaultLineWidth;\nol.render.canvas.defaultMiterLimit = _ol_render_canvas$defaultMiterLimit;\nol.render.canvas.defaultPadding = _ol_render_canvas$defaultPadding;\nol.render.canvas.defaultStrokeStyle = _ol_render_canvas$defaultStrokeStyle;\nol.render.canvas.defaultTextAlign = _ol_render_canvas$defaultTextAlign;\nol.render.canvas.defaultTextBaseline = _ol_render_canvas$defaultTextBaseline;\nol.render.canvas.drawImageOrLabel = _ol_render_canvas$drawImageOrLabel;\nol.render.canvas.getTextDimensions = _ol_render_canvas$getTextDimensions;\nol.render.canvas.hitdetect = {};\nol.render.canvas.hitdetect.HIT_DETECT_RESOLUTION = _ol_render_canvas_hitdetect$HIT_DETECT_RESOLUTION;\nol.render.canvas.hitdetect.createHitDetectionImageData = _ol_render_canvas_hitdetect$createHitDetectionImageData;\nol.render.canvas.hitdetect.hitDetect = _ol_render_canvas_hitdetect$hitDetect;\nol.render.canvas.measureAndCacheTextWidth = _ol_render_canvas$measureAndCacheTextWidth;\nol.render.canvas.measureTextHeight = _ol_render_canvas$measureTextHeight;\nol.render.canvas.measureTextWidth = _ol_render_canvas$measureTextWidth;\nol.render.canvas.registerFont = _ol_render_canvas$registerFont;\nol.render.canvas.rotateAtOffset = _ol_render_canvas$rotateAtOffset;\nol.render.canvas.style = {};\nol.render.canvas.style.buildRuleSet = _ol_render_canvas_style$buildRuleSet;\nol.render.canvas.style.buildStyle = _ol_render_canvas_style$buildStyle;\nol.render.canvas.style.flatStylesToStyleFunction = _ol_render_canvas_style$flatStylesToStyleFunction;\nol.render.canvas.style.rulesToStyleFunction = _ol_render_canvas_style$rulesToStyleFunction;\nol.render.canvas.textHeights = _ol_render_canvas$textHeights;\nol.render.getRenderPixel = _ol_render$getRenderPixel;\nol.render.getVectorContext = _ol_render$getVectorContext;\nol.render.toContext = _ol_render$toContext;\nol.render.webgl = {};\nol.render.webgl.MixedGeometryBatch = $ol$render$webgl$MixedGeometryBatch;\nol.render.webgl.ShaderBuilder = {};\nol.render.webgl.ShaderBuilder.COMMON_HEADER = _ol_render_webgl_ShaderBuilder$COMMON_HEADER;\nol.render.webgl.ShaderBuilder.ShaderBuilder = _ol_render_webgl_ShaderBuilder$ShaderBuilder;\nol.render.webgl.VectorStyleRenderer = $ol$render$webgl$VectorStyleRenderer;\nol.render.webgl.bufferUtil = {};\nol.render.webgl.bufferUtil.LINESTRING_ANGLE_COSINE_CUTOFF = _ol_render_webgl_bufferUtil$LINESTRING_ANGLE_COSINE_CUTOFF;\nol.render.webgl.bufferUtil.writeLineSegmentToBuffers = _ol_render_webgl_bufferUtil$writeLineSegmentToBuffers;\nol.render.webgl.bufferUtil.writePointFeatureToBuffers = _ol_render_webgl_bufferUtil$writePointFeatureToBuffers;\nol.render.webgl.bufferUtil.writePolygonTrianglesToBuffers = _ol_render_webgl_bufferUtil$writePolygonTrianglesToBuffers;\nol.render.webgl.compileUtil = {};\nol.render.webgl.compileUtil.UNPACK_COLOR_FN = _ol_render_webgl_compileUtil$UNPACK_COLOR_FN;\nol.render.webgl.compileUtil.applyContextToBuilder = _ol_render_webgl_compileUtil$applyContextToBuilder;\nol.render.webgl.compileUtil.expressionToGlsl = _ol_render_webgl_compileUtil$expressionToGlsl;\nol.render.webgl.compileUtil.generateAttributesFromContext = _ol_render_webgl_compileUtil$generateAttributesFromContext;\nol.render.webgl.compileUtil.generateUniformsFromContext = _ol_render_webgl_compileUtil$generateUniformsFromContext;\nol.render.webgl.compileUtil.getGlslSizeFromType = _ol_render_webgl_compileUtil$getGlslSizeFromType;\nol.render.webgl.compileUtil.getGlslTypeFromType = _ol_render_webgl_compileUtil$getGlslTypeFromType;\nol.render.webgl.compileUtil.packColor = _ol_render_webgl_compileUtil$packColor;\nol.render.webgl.encodeUtil = {};\nol.render.webgl.encodeUtil.colorDecodeId = _ol_render_webgl_encodeUtil$colorDecodeId;\nol.render.webgl.encodeUtil.colorEncodeId = _ol_render_webgl_encodeUtil$colorEncodeId;\nol.render.webgl.renderinstructions = {};\nol.render.webgl.renderinstructions.generateLineStringRenderInstructions = _ol_render_webgl_renderinstructions$generateLineStringRenderInstructions;\nol.render.webgl.renderinstructions.generatePointRenderInstructions = _ol_render_webgl_renderinstructions$generatePointRenderInstructions;\nol.render.webgl.renderinstructions.generatePolygonRenderInstructions = _ol_render_webgl_renderinstructions$generatePolygonRenderInstructions;\nol.render.webgl.renderinstructions.getCustomAttributesSize = _ol_render_webgl_renderinstructions$getCustomAttributesSize;\nol.render.webgl.style = {};\nol.render.webgl.style.breakDownFlatStyle = _ol_render_webgl_style$breakDownFlatStyle;\nol.render.webgl.style.computeHash = _ol_render_webgl_style$computeHash;\nol.render.webgl.style.parseLiteralStyle = _ol_render_webgl_style$parseLiteralStyle;\nol.renderer = {};\nol.renderer.Composite = $ol$renderer$Composite;\nol.renderer.Layer = $ol$renderer$Layer;\nol.renderer.Map = $ol$renderer$Map;\nol.renderer.canvas = {};\nol.renderer.canvas.ImageLayer = $ol$renderer$canvas$ImageLayer;\nol.renderer.canvas.Layer = $ol$renderer$canvas$Layer;\nol.renderer.canvas.Layer.canvasPool = _ol_renderer_canvas_Layer$canvasPool;\nol.renderer.canvas.TileLayer = $ol$renderer$canvas$TileLayer;\nol.renderer.canvas.VectorImageLayer = $ol$renderer$canvas$VectorImageLayer;\nol.renderer.canvas.VectorLayer = $ol$renderer$canvas$VectorLayer;\nol.renderer.canvas.VectorTileLayer = $ol$renderer$canvas$VectorTileLayer;\nol.renderer.vector = {};\nol.renderer.vector.defaultOrder = _ol_renderer_vector$defaultOrder;\nol.renderer.vector.getSquaredTolerance = _ol_renderer_vector$getSquaredTolerance;\nol.renderer.vector.getTolerance = _ol_renderer_vector$getTolerance;\nol.renderer.vector.renderFeature = _ol_renderer_vector$renderFeature;\nol.renderer.webgl = {};\nol.renderer.webgl.FlowLayer = $ol$renderer$webgl$FlowLayer;\nol.renderer.webgl.Layer = $ol$renderer$webgl$Layer;\nol.renderer.webgl.PointsLayer = $ol$renderer$webgl$PointsLayer;\nol.renderer.webgl.TileLayer = $ol$renderer$webgl$TileLayer;\nol.renderer.webgl.TileLayer.Attributes = _ol_renderer_webgl_TileLayer$Attributes;\nol.renderer.webgl.TileLayer.Uniforms = _ol_renderer_webgl_TileLayer$Uniforms;\nol.renderer.webgl.TileLayerBase = $ol$renderer$webgl$TileLayerBase;\nol.renderer.webgl.TileLayerBase.Uniforms = _ol_renderer_webgl_TileLayerBase$Uniforms;\nol.renderer.webgl.TileLayerBase.getCacheKey = _ol_renderer_webgl_TileLayerBase$getCacheKey;\nol.renderer.webgl.TileLayerBase.newTileRepresentationLookup = _ol_renderer_webgl_TileLayerBase$newTileRepresentationLookup;\nol.renderer.webgl.VectorLayer = $ol$renderer$webgl$VectorLayer;\nol.renderer.webgl.VectorLayer.Uniforms = _ol_renderer_webgl_VectorLayer$Uniforms;\nol.renderer.webgl.VectorTileLayer = $ol$renderer$webgl$VectorTileLayer;\nol.renderer.webgl.VectorTileLayer.Attributes = _ol_renderer_webgl_VectorTileLayer$Attributes;\nol.renderer.webgl.VectorTileLayer.Uniforms = _ol_renderer_webgl_VectorTileLayer$Uniforms;\nol.reproj = {};\nol.reproj.DataTile = $ol$reproj$DataTile;\nol.reproj.Image = $ol$reproj$Image;\nol.reproj.Tile = $ol$reproj$Tile;\nol.reproj.Triangulation = $ol$reproj$Triangulation;\nol.reproj.calculateSourceExtentResolution = _ol_reproj$calculateSourceExtentResolution;\nol.reproj.calculateSourceResolution = _ol_reproj$calculateSourceResolution;\nol.reproj.canvasPool = _ol_reproj$canvasPool;\nol.reproj.common = {};\nol.reproj.common.ERROR_THRESHOLD = _ol_reproj_common$ERROR_THRESHOLD;\nol.reproj.glreproj = {};\nol.reproj.glreproj.canvasGLPool = _ol_reproj_glreproj$canvasGLPool;\nol.reproj.glreproj.createCanvasContextWebGL = _ol_reproj_glreproj$createCanvasContextWebGL;\nol.reproj.glreproj.releaseGLCanvas = _ol_reproj_glreproj$releaseGLCanvas;\nol.reproj.glreproj.render = _ol_reproj_glreproj$render;\nol.reproj.render = _ol_reproj$render;\nol.resolution = {};\nol.resolution.fromResolutionLike = _ol_resolution$fromResolutionLike;\nol.resolutionconstraint = {};\nol.resolutionconstraint.createMinMaxResolution = _ol_resolutionconstraint$createMinMaxResolution;\nol.resolutionconstraint.createSnapToPower = _ol_resolutionconstraint$createSnapToPower;\nol.resolutionconstraint.createSnapToResolutions = _ol_resolutionconstraint$createSnapToResolutions;\nol.rotationconstraint = {};\nol.rotationconstraint.createSnapToN = _ol_rotationconstraint$createSnapToN;\nol.rotationconstraint.createSnapToZero = _ol_rotationconstraint$createSnapToZero;\nol.rotationconstraint.disable = _ol_rotationconstraint$disable;\nol.rotationconstraint.none = _ol_rotationconstraint$none;\nol.size = {};\nol.size.buffer = _ol_size$buffer;\nol.size.hasArea = _ol_size$hasArea;\nol.size.scale = _ol_size$scale;\nol.size.toSize = _ol_size$toSize;\nol.source = {};\nol.source.BingMaps = $ol$source$BingMaps;\nol.source.BingMaps.quadKey = _ol_source_BingMaps$quadKey;\nol.source.CartoDB = $ol$source$CartoDB;\nol.source.Cluster = $ol$source$Cluster;\nol.source.DataTile = $ol$source$DataTile;\nol.source.GeoTIFF = $ol$source$GeoTIFF;\nol.source.Google = $ol$source$Google;\nol.source.IIIF = $ol$source$IIIF;\nol.source.Image = $ol$source$Image;\nol.source.Image.ImageSourceEvent = _ol_source_Image$ImageSourceEvent;\nol.source.Image.defaultImageLoadFunction = _ol_source_Image$defaultImageLoadFunction;\nol.source.Image.getRequestExtent = _ol_source_Image$getRequestExtent;\nol.source.ImageArcGISRest = $ol$source$ImageArcGISRest;\nol.source.ImageCanvas = $ol$source$ImageCanvas;\nol.source.ImageMapGuide = $ol$source$ImageMapGuide;\nol.source.ImageStatic = $ol$source$ImageStatic;\nol.source.ImageTile = $ol$source$ImageTile;\nol.source.ImageWMS = $ol$source$ImageWMS;\nol.source.OGCMapTile = $ol$source$OGCMapTile;\nol.source.OGCVectorTile = $ol$source$OGCVectorTile;\nol.source.OSM = $ol$source$OSM;\nol.source.OSM.ATTRIBUTION = _ol_source_OSM$ATTRIBUTION;\nol.source.Raster = $ol$source$Raster;\nol.source.Raster.Processor = _ol_source_Raster$Processor;\nol.source.Raster.RasterSourceEvent = _ol_source_Raster$RasterSourceEvent;\nol.source.SentinelHub = $ol$source$SentinelHub;\nol.source.SentinelHub.getProjectionIdentifier = _ol_source_SentinelHub$getProjectionIdentifier;\nol.source.SentinelHub.parseTokenClaims = _ol_source_SentinelHub$parseTokenClaims;\nol.source.SentinelHub.serializeFunction = _ol_source_SentinelHub$serializeFunction;\nol.source.Source = $ol$source$Source;\nol.source.StadiaMaps = $ol$source$StadiaMaps;\nol.source.Tile = $ol$source$Tile;\nol.source.Tile.TileSourceEvent = _ol_source_Tile$TileSourceEvent;\nol.source.TileArcGISRest = $ol$source$TileArcGISRest;\nol.source.TileDebug = $ol$source$TileDebug;\nol.source.TileImage = $ol$source$TileImage;\nol.source.TileJSON = $ol$source$TileJSON;\nol.source.TileWMS = $ol$source$TileWMS;\nol.source.UTFGrid = $ol$source$UTFGrid;\nol.source.UTFGrid.CustomTile = _ol_source_UTFGrid$CustomTile;\nol.source.UrlTile = $ol$source$UrlTile;\nol.source.Vector = $ol$source$Vector;\nol.source.Vector.VectorSourceEvent = _ol_source_Vector$VectorSourceEvent;\nol.source.VectorTile = $ol$source$VectorTile;\nol.source.VectorTile.defaultLoadFunction = _ol_source_VectorTile$defaultLoadFunction;\nol.source.WMTS = $ol$source$WMTS;\nol.source.WMTS.optionsFromCapabilities = _ol_source_WMTS$optionsFromCapabilities;\nol.source.XYZ = $ol$source$XYZ;\nol.source.Zoomify = $ol$source$Zoomify;\nol.source.Zoomify.CustomTile = _ol_source_Zoomify$CustomTile;\nol.source.arcgisRest = {};\nol.source.arcgisRest.createLoader = _ol_source_arcgisRest$createLoader;\nol.source.arcgisRest.getRequestUrl = _ol_source_arcgisRest$getRequestUrl;\nol.source.common = {};\nol.source.common.DECIMALS = _ol_source_common$DECIMALS;\nol.source.common.DEFAULT_WMS_VERSION = _ol_source_common$DEFAULT_WMS_VERSION;\nol.source.mapguide = {};\nol.source.mapguide.createLoader = _ol_source_mapguide$createLoader;\nol.source.mapserver = {};\nol.source.mapserver.createLoader = _ol_source_mapserver$createLoader;\nol.source.ogcTileUtil = {};\nol.source.ogcTileUtil.appendCollectionsQueryParam = _ol_source_ogcTileUtil$appendCollectionsQueryParam;\nol.source.ogcTileUtil.getMapTileUrlTemplate = _ol_source_ogcTileUtil$getMapTileUrlTemplate;\nol.source.ogcTileUtil.getTileSetInfo = _ol_source_ogcTileUtil$getTileSetInfo;\nol.source.ogcTileUtil.getVectorTileUrlTemplate = _ol_source_ogcTileUtil$getVectorTileUrlTemplate;\nol.source.sourcesFromTileGrid = _ol_source$sourcesFromTileGrid;\nol.source.static = {};\nol.source.static.createLoader = _ol_source_static$createLoader;\nol.source.wms = {};\nol.source.wms.DEFAULT_VERSION = _ol_source_wms$DEFAULT_VERSION;\nol.source.wms.createLoader = _ol_source_wms$createLoader;\nol.source.wms.getFeatureInfoUrl = _ol_source_wms$getFeatureInfoUrl;\nol.source.wms.getImageSrc = _ol_source_wms$getImageSrc;\nol.source.wms.getLegendUrl = _ol_source_wms$getLegendUrl;\nol.source.wms.getRequestParams = _ol_source_wms$getRequestParams;\nol.source.wms.getRequestUrl = _ol_source_wms$getRequestUrl;\nol.sphere = {};\nol.sphere.DEFAULT_RADIUS = _ol_sphere$DEFAULT_RADIUS;\nol.sphere.getArea = _ol_sphere$getArea;\nol.sphere.getDistance = _ol_sphere$getDistance;\nol.sphere.getLength = _ol_sphere$getLength;\nol.sphere.offset = _ol_sphere$offset;\nol.string = {};\nol.string.compareVersions = _ol_string$compareVersions;\nol.string.padNumber = _ol_string$padNumber;\nol.structs = {};\nol.structs.LRUCache = $ol$structs$LRUCache;\nol.structs.PriorityQueue = $ol$structs$PriorityQueue;\nol.structs.PriorityQueue.DROP = _ol_structs_PriorityQueue$DROP;\nol.structs.RBush = $ol$structs$RBush;\nol.style = {};\nol.style.Circle = $ol$style$Circle;\nol.style.Fill = $ol$style$Fill;\nol.style.Icon = $ol$style$Icon;\nol.style.IconImage = $ol$style$IconImage;\nol.style.IconImage.get = _ol_style_IconImage$get;\nol.style.IconImageCache = $ol$style$IconImageCache;\nol.style.IconImageCache.getCacheKey = _ol_style_IconImageCache$getCacheKey;\nol.style.IconImageCache.shared = _ol_style_IconImageCache$shared;\nol.style.Image = $ol$style$Image;\nol.style.RegularShape = $ol$style$RegularShape;\nol.style.Stroke = $ol$style$Stroke;\nol.style.Style = $ol$style$Style;\nol.style.Style.createDefaultStyle = _ol_style_Style$createDefaultStyle;\nol.style.Style.createEditingStyle = _ol_style_Style$createEditingStyle;\nol.style.Style.toFunction = _ol_style_Style$toFunction;\nol.style.Text = $ol$style$Text;\nol.style.flat = {};\nol.style.flat.createDefaultStyle = _ol_style_flat$createDefaultStyle;\nol.tilecoord = {};\nol.tilecoord.createOrUpdate = _ol_tilecoord$createOrUpdate;\nol.tilecoord.fromKey = _ol_tilecoord$fromKey;\nol.tilecoord.getCacheKeyForTileKey = _ol_tilecoord$getCacheKeyForTileKey;\nol.tilecoord.getKey = _ol_tilecoord$getKey;\nol.tilecoord.getKeyZXY = _ol_tilecoord$getKeyZXY;\nol.tilecoord.hash = _ol_tilecoord$hash;\nol.tilecoord.hashZXY = _ol_tilecoord$hashZXY;\nol.tilecoord.withinExtentAndZ = _ol_tilecoord$withinExtentAndZ;\nol.tilegrid = {};\nol.tilegrid.TileGrid = $ol$tilegrid$TileGrid;\nol.tilegrid.WMTS = $ol$tilegrid$WMTS;\nol.tilegrid.WMTS.createFromCapabilitiesMatrixSet = _ol_tilegrid_WMTS$createFromCapabilitiesMatrixSet;\nol.tilegrid.common = {};\nol.tilegrid.common.DEFAULT_MAX_ZOOM = _ol_tilegrid_common$DEFAULT_MAX_ZOOM;\nol.tilegrid.common.DEFAULT_TILE_SIZE = _ol_tilegrid_common$DEFAULT_TILE_SIZE;\nol.tilegrid.createForExtent = _ol_tilegrid$createForExtent;\nol.tilegrid.createForProjection = _ol_tilegrid$createForProjection;\nol.tilegrid.createXYZ = _ol_tilegrid$createXYZ;\nol.tilegrid.extentFromProjection = _ol_tilegrid$extentFromProjection;\nol.tilegrid.getForProjection = _ol_tilegrid$getForProjection;\nol.tilegrid.wrapX = _ol_tilegrid$wrapX;\nol.tileurlfunction = {};\nol.tileurlfunction.createFromTemplate = _ol_tileurlfunction$createFromTemplate;\nol.tileurlfunction.createFromTemplates = _ol_tileurlfunction$createFromTemplates;\nol.tileurlfunction.createFromTileUrlFunctions = _ol_tileurlfunction$createFromTileUrlFunctions;\nol.tileurlfunction.nullTileUrlFunction = _ol_tileurlfunction$nullTileUrlFunction;\nol.transform = {};\nol.transform.apply = _ol_transform$apply;\nol.transform.compose = _ol_transform$compose;\nol.transform.composeCssTransform = _ol_transform$composeCssTransform;\nol.transform.create = _ol_transform$create;\nol.transform.determinant = _ol_transform$determinant;\nol.transform.equivalent = _ol_transform$equivalent;\nol.transform.invert = _ol_transform$invert;\nol.transform.makeInverse = _ol_transform$makeInverse;\nol.transform.makeScale = _ol_transform$makeScale;\nol.transform.multiply = _ol_transform$multiply;\nol.transform.reset = _ol_transform$reset;\nol.transform.rotate = _ol_transform$rotate;\nol.transform.scale = _ol_transform$scale;\nol.transform.set = _ol_transform$set;\nol.transform.setFromArray = _ol_transform$setFromArray;\nol.transform.toString = _ol_transform$toString;\nol.transform.translate = _ol_transform$translate;\nol.uri = {};\nol.uri.appendParams = _ol_uri$appendParams;\nol.uri.expandUrl = _ol_uri$expandUrl;\nol.uri.pickUrl = _ol_uri$pickUrl;\nol.uri.renderXYZTemplate = _ol_uri$renderXYZTemplate;\nol.util = {};\nol.util.VERSION = _ol_util$VERSION;\nol.util.abstract = _ol_util$abstract;\nol.util.getUid = _ol_util$getUid;\nol.vec = {};\nol.vec.mat4 = {};\nol.vec.mat4.create = _ol_vec_mat4$create;\nol.vec.mat4.fromTransform = _ol_vec_mat4$fromTransform;\nol.vec.mat4.orthographic = _ol_vec_mat4$orthographic;\nol.vec.mat4.scale = _ol_vec_mat4$scale;\nol.vec.mat4.translate = _ol_vec_mat4$translate;\nol.vec.mat4.translation = _ol_vec_mat4$translation;\nol.webgl = {};\nol.webgl.ARRAY_BUFFER = _ol_webgl$ARRAY_BUFFER;\nol.webgl.BaseTileRepresentation = $ol$webgl$BaseTileRepresentation;\nol.webgl.Buffer = $ol$webgl$Buffer;\nol.webgl.Buffer.getArrayClassForType = _ol_webgl_Buffer$getArrayClassForType;\nol.webgl.Canvas = {};\nol.webgl.Canvas.Canvas = _ol_webgl_Canvas$Canvas;\nol.webgl.Canvas.createProgram = _ol_webgl_Canvas$createProgram;\nol.webgl.DYNAMIC_DRAW = _ol_webgl$DYNAMIC_DRAW;\nol.webgl.ELEMENT_ARRAY_BUFFER = _ol_webgl$ELEMENT_ARRAY_BUFFER;\nol.webgl.FLOAT = _ol_webgl$FLOAT;\nol.webgl.Helper = $ol$webgl$Helper;\nol.webgl.Helper.computeAttributesStride = _ol_webgl_Helper$computeAttributesStride;\nol.webgl.PaletteTexture = $ol$webgl$PaletteTexture;\nol.webgl.PostProcessingPass = $ol$webgl$PostProcessingPass;\nol.webgl.RenderTarget = $ol$webgl$RenderTarget;\nol.webgl.STATIC_DRAW = _ol_webgl$STATIC_DRAW;\nol.webgl.STREAM_DRAW = _ol_webgl$STREAM_DRAW;\nol.webgl.TileGeometry = $ol$webgl$TileGeometry;\nol.webgl.TileTexture = $ol$webgl$TileTexture;\nol.webgl.UNSIGNED_BYTE = _ol_webgl$UNSIGNED_BYTE;\nol.webgl.UNSIGNED_INT = _ol_webgl$UNSIGNED_INT;\nol.webgl.UNSIGNED_SHORT = _ol_webgl$UNSIGNED_SHORT;\nol.webgl.getContext = _ol_webgl$getContext;\nol.webgl.getSupportedExtensions = _ol_webgl$getSupportedExtensions;\nol.xml = {};\nol.xml.OBJECT_PROPERTY_NODE_FACTORY = _ol_xml$OBJECT_PROPERTY_NODE_FACTORY;\nol.xml.XML_SCHEMA_INSTANCE_URI = _ol_xml$XML_SCHEMA_INSTANCE_URI;\nol.xml.createElementNS = _ol_xml$createElementNS;\nol.xml.getAllTextContent = _ol_xml$getAllTextContent;\nol.xml.getAllTextContent_ = _ol_xml$getAllTextContent_;\nol.xml.getAttributeNS = _ol_xml$getAttributeNS;\nol.xml.getDocument = _ol_xml$getDocument;\nol.xml.getXMLSerializer = _ol_xml$getXMLSerializer;\nol.xml.isDocument = _ol_xml$isDocument;\nol.xml.makeArrayExtender = _ol_xml$makeArrayExtender;\nol.xml.makeArrayPusher = _ol_xml$makeArrayPusher;\nol.xml.makeArraySerializer = _ol_xml$makeArraySerializer;\nol.xml.makeChildAppender = _ol_xml$makeChildAppender;\nol.xml.makeObjectPropertyPusher = _ol_xml$makeObjectPropertyPusher;\nol.xml.makeObjectPropertySetter = _ol_xml$makeObjectPropertySetter;\nol.xml.makeReplacer = _ol_xml$makeReplacer;\nol.xml.makeSequence = _ol_xml$makeSequence;\nol.xml.makeSimpleNodeFactory = _ol_xml$makeSimpleNodeFactory;\nol.xml.makeStructureNS = _ol_xml$makeStructureNS;\nol.xml.parse = _ol_xml$parse;\nol.xml.parseNode = _ol_xml$parseNode;\nol.xml.pushParseAndPop = _ol_xml$pushParseAndPop;\nol.xml.pushSerializeAndPop = _ol_xml$pushSerializeAndPop;\nol.xml.registerDocument = _ol_xml$registerDocument;\nol.xml.registerXMLSerializer = _ol_xml$registerXMLSerializer;\nol.xml.serialize = _ol_xml$serialize;\n\nol.VERSION = ol.util.VERSION;\n\nol.getUid = ol.util.getUid;\n\nexport default ol;","/**\n * @module ol/control/ZoomToExtent\n */\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport EventType from '../events/EventType.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport {fromUserExtent} from '../proj.js';\nimport Control from './Control.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-zoom-extent'] Class name.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {string|HTMLElement} [label='E'] Text label to use for the button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.\n * @property {import(\"../extent.js\").Extent} [extent] The extent to zoom to. If undefined the validity\n * extent of the view projection is used.\n */\n\n/**\n * @classdesc\n * A button control which, when pressed, changes the map view to a specific\n * extent. To style this control use the css selector `.ol-zoom-extent`.\n *\n * @api\n */\nclass ZoomToExtent extends Control {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n /**\n * @type {?import(\"../extent.js\").Extent|null}\n * @protected\n */\n this.extent = options.extent ? options.extent : null;\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoom-extent';\n\n const label = options.label !== undefined ? options.label : 'E';\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Fit to extent';\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(\n typeof label === 'string' ? document.createTextNode(label) : label,\n );\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(button);\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleZoomToExtent();\n }\n\n /**\n * @protected\n */\n handleZoomToExtent() {\n const map = this.getMap();\n const view = map.getView();\n const extent = !this.extent\n ? view.getProjection().getExtent()\n : fromUserExtent(this.extent, view.getProjection());\n view.fitInternal(polygonFromExtent(extent));\n }\n}\n\nexport default ZoomToExtent;\n","/**\n * @module ol/format/WMSGetFeatureInfo\n */\nimport {extend} from '../array.js';\nimport {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';\nimport GML2 from './GML2.js';\nimport XMLFeature from './XMLFeature.js';\n\n/**\n * @typedef {Object} Options\n * @property {Array<string>} [layers] If set, only features of the given layers will be returned by the format when read.\n */\n\n/**\n * @const\n * @type {string}\n */\nconst featureIdentifier = '_feature';\n\n/**\n * @const\n * @type {string}\n */\nconst layerIdentifier = '_layer';\n\n/**\n * @classdesc\n * Format for reading WMSGetFeatureInfo format. It uses\n * {@link module:ol/format/GML2~GML2} to read features.\n *\n * @api\n */\nclass WMSGetFeatureInfo extends XMLFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @private\n * @type {string}\n */\n this.featureNS_ = 'http://mapserver.gis.umn.edu/mapserver';\n\n /**\n * @private\n * @type {GML2}\n */\n this.gmlFormat_ = new GML2();\n\n /**\n * @private\n * @type {Array<string>|null}\n */\n this.layers_ = options.layers ? options.layers : null;\n }\n\n /**\n * @return {Array<string>|null} layers\n */\n getLayers() {\n return this.layers_;\n }\n\n /**\n * @param {Array<string>|null} layers Layers to parse.\n */\n setLayers(layers) {\n this.layers_ = layers;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @private\n */\n readFeatures_(node, objectStack) {\n node.setAttribute('namespaceURI', this.featureNS_);\n const localName = node.localName;\n /** @type {Array<import(\"../Feature.js\").default>} */\n let features = [];\n if (node.childNodes.length === 0) {\n return features;\n }\n if (localName == 'msGMLOutput') {\n for (let i = 0, ii = node.childNodes.length; i < ii; i++) {\n const layer = node.childNodes[i];\n if (layer.nodeType !== Node.ELEMENT_NODE) {\n continue;\n }\n\n const layerElement = /** @type {Element} */ (layer);\n const context = objectStack[0];\n\n const toRemove = layerIdentifier;\n const layerName = layerElement.localName.replace(toRemove, '');\n\n if (this.layers_ && !this.layers_.includes(layerName)) {\n continue;\n }\n\n const featureType = layerName + featureIdentifier;\n\n context['featureType'] = featureType;\n context['featureNS'] = this.featureNS_;\n\n /** @type {Object<string, import(\"../xml.js\").Parser>} */\n const parsers = {};\n parsers[featureType] = makeArrayPusher(\n this.gmlFormat_.readFeatureElement,\n this.gmlFormat_,\n );\n const parsersNS = makeStructureNS(\n [context['featureNS'], null],\n parsers,\n );\n layerElement.setAttribute('namespaceURI', this.featureNS_);\n const layerFeatures = pushParseAndPop(\n [],\n // @ts-ignore\n parsersNS,\n layerElement,\n objectStack,\n this.gmlFormat_,\n );\n if (layerFeatures) {\n extend(features, layerFeatures);\n }\n }\n }\n if (localName == 'FeatureCollection') {\n const gmlFeatures = pushParseAndPop(\n [],\n this.gmlFormat_.FEATURE_COLLECTION_PARSERS,\n node,\n [{}],\n this.gmlFormat_,\n );\n if (gmlFeatures) {\n features = gmlFeatures;\n }\n }\n return features;\n }\n\n /**\n * @protected\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array<import(\"../Feature.js\").default>} Features.\n * @override\n */\n readFeaturesFromNode(node, options) {\n const internalOptions = {};\n if (options) {\n Object.assign(internalOptions, this.getReadOptions(node, options));\n }\n return this.readFeatures_(node, [internalOptions]);\n }\n}\n\nexport default WMSGetFeatureInfo;\n","/**\n * @module ol/geom/flat/topology\n */\nimport {linearRing as linearRingArea} from './area.js';\n\n/**\n * Check if the linestring is a boundary.\n * @param {Array<number>} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {boolean} The linestring is a boundary.\n */\nexport function lineStringIsClosed(flatCoordinates, offset, end, stride) {\n const lastCoord = end - stride;\n if (\n flatCoordinates[offset] === flatCoordinates[lastCoord] &&\n flatCoordinates[offset + 1] === flatCoordinates[lastCoord + 1] &&\n (end - offset) / stride > 3\n ) {\n return !!linearRingArea(flatCoordinates, offset, end, stride);\n }\n return false;\n}\n","/**\n * @module ol/interaction/DblClickDragZoom\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport Interaction from './Interaction.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=400] Animation duration in milliseconds. *\n * @property {number} [delta=1] The zoom delta applied on move of one pixel. *\n * @property {function(boolean):boolean} [stopDown]\n * Should the down event be propagated to other interactions, or should be\n * stopped?\n */\n\n/**\n * @classdesc\n * Allows the user to zoom the map by double tap/click then drag up/down\n * with one finger/left mouse.\n * @api\n */\nclass DblClickDragZoom extends Interaction {\n /**\n * @param {Options} [opt_options] Options.\n */\n constructor(opt_options) {\n const options = opt_options ? opt_options : {};\n\n super(\n /** @type {import(\"./Interaction.js\").InteractionOptions} */ (options),\n );\n\n if (options.stopDown) {\n this.stopDown = options.stopDown;\n }\n\n /**\n * @private\n * @type {number}\n */\n this.scaleDeltaByPixel_ = options.delta ? options.delta : 0.01;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @type {boolean}\n * @private\n */\n this.handlingDownUpSequence_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.handlingDoubleDownSequence_ = false;\n\n /**\n * @type {ReturnType<typeof setTimeout>}\n * @private\n */\n this.doubleTapTimeoutId_ = undefined;\n\n /**\n * @type {!Object<string, PointerEvent>}\n * @private\n */\n this.trackedPointers_ = {};\n\n /**\n * @type {PointerEvent|null}\n * @private\n */\n this.down_ = null;\n\n /**\n * @type {Array<PointerEvent>}\n * @protected\n */\n this.targetPointers = [];\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into\n * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are\n * detected.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @api\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n\n let stopEvent = false;\n this.updateTrackedPointers_(mapBrowserEvent);\n if (this.handlingDownUpSequence_) {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {\n this.handleDragEvent(mapBrowserEvent);\n // prevent page scrolling during dragging\n mapBrowserEvent.originalEvent.preventDefault();\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n const handledUp = this.handleUpEvent(mapBrowserEvent);\n this.handlingDownUpSequence_ = handledUp;\n }\n } else {\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n if (this.handlingDoubleDownSequence_) {\n this.handlingDoubleDownSequence_ = false;\n const handled = this.handleDownEvent(mapBrowserEvent);\n this.handlingDownUpSequence_ = handled;\n stopEvent = this.stopDown(handled);\n } else {\n stopEvent = this.stopDown(false);\n this.waitForDblTap_();\n }\n }\n }\n return !stopEvent;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Event.\n */\n handleDragEvent(mapBrowserEvent) {\n let scaleDelta = 1.0;\n\n const touch0 = this.targetPointers[0];\n const touch1 = this.down_;\n const distance = touch0.clientY - touch1.clientY;\n\n if (this.lastDistance_ !== undefined) {\n scaleDelta =\n 1 - (this.lastDistance_ - distance) * this.scaleDeltaByPixel_;\n }\n this.lastDistance_ = distance;\n\n if (scaleDelta != 1.0) {\n this.lastScaleDelta_ = scaleDelta;\n }\n\n // scale, bypass the resolution constraint\n const map = mapBrowserEvent.map;\n const view = map.getView();\n map.render();\n view.adjustResolutionInternal(scaleDelta);\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleDownEvent(mapBrowserEvent) {\n if (this.targetPointers.length == 1) {\n const map = mapBrowserEvent.map;\n this.anchor_ = null;\n this.lastDistance_ = undefined;\n this.lastScaleDelta_ = 1;\n this.down_ = mapBrowserEvent.originalEvent;\n if (!this.handlingDownUpSequence_) {\n map.getView().beginInteraction();\n }\n return true;\n }\n return false;\n }\n\n /**\n * Handle pointer up events zooming out.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n */\n handleUpEvent(mapBrowserEvent) {\n if (this.targetPointers.length == 0) {\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n this.handlingDownUpSequence_ = false;\n this.handlingDoubleDownSequence_ = false;\n return false;\n }\n return true;\n }\n\n /**\n * This function is used to determine if \"down\" events should be propagated\n * to other interactions or should be stopped.\n * @param {boolean} handled Was the event handled by the interaction?\n * @return {boolean} Should the `down` event be stopped?\n */\n stopDown(handled) {\n return handled;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default<PointerEvent>} mapBrowserEvent Event.\n * @private\n */\n updateTrackedPointers_(mapBrowserEvent) {\n if (isPointerDraggingEvent(mapBrowserEvent)) {\n const event = mapBrowserEvent.originalEvent;\n\n const id = event.pointerId.toString();\n if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {\n delete this.trackedPointers_[id];\n } else if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {\n this.trackedPointers_[id] = event;\n } else if (id in this.trackedPointers_) {\n // update only when there was a pointerdown event for this pointer\n this.trackedPointers_[id] = event;\n }\n this.targetPointers = Object.values(this.trackedPointers_);\n }\n }\n\n /**\n * Wait the second double finger tap.\n * @private\n */\n waitForDblTap_() {\n if (this.doubleTapTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.doubleTapTimeoutId_);\n this.doubleTapTimeoutId_ = undefined;\n } else {\n this.handlingDoubleDownSequence_ = true;\n this.doubleTapTimeoutId_ = setTimeout(\n this.endInteraction_.bind(this),\n 250,\n );\n }\n }\n\n /**\n * @private\n */\n endInteraction_() {\n this.handlingDoubleDownSequence_ = false;\n this.doubleTapTimeoutId_ = undefined;\n }\n}\n\n/**\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} Whether the event is a pointerdown, pointerdrag\n * or pointerup event.\n */\nfunction isPointerDraggingEvent(mapBrowserEvent) {\n const type = mapBrowserEvent.type;\n return (\n type === MapBrowserEventType.POINTERDOWN ||\n type === MapBrowserEventType.POINTERDRAG ||\n type === MapBrowserEventType.POINTERUP\n );\n}\n\nexport default DblClickDragZoom;\n","/**\n * @module ol/interaction/DragRotateAndZoom\n */\nimport {mouseOnly, shiftKeyOnly} from '../events/condition.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled.\n * Default is {@link module:ol/events/condition.shiftKeyOnly}.\n * @property {number} [duration=400] Animation duration in milliseconds.\n */\n\n/**\n * @classdesc\n * Allows the user to zoom and rotate the map by clicking and dragging\n * on the map. By default, this interaction is limited to when the shift\n * key is held down.\n *\n * This interaction is only supported for mouse devices.\n *\n * And this interaction is not included in the default interactions.\n * @api\n */\nclass DragRotateAndZoom extends PointerInteraction {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : shiftKeyOnly;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastAngle_ = undefined;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.lastMagnitude_ = undefined;\n\n /**\n * @private\n * @type {number}\n */\n this.lastScaleDelta_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.duration_ = options.duration !== undefined ? options.duration : 400;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @override\n */\n handleDragEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return;\n }\n\n const map = mapBrowserEvent.map;\n const size = map.getSize();\n const offset = mapBrowserEvent.pixel;\n const deltaX = offset[0] - size[0] / 2;\n const deltaY = size[1] / 2 - offset[1];\n const theta = Math.atan2(deltaY, deltaX);\n const magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n const view = map.getView();\n if (this.lastAngle_ !== undefined) {\n const angleDelta = this.lastAngle_ - theta;\n view.adjustRotationInternal(angleDelta);\n }\n this.lastAngle_ = theta;\n if (this.lastMagnitude_ !== undefined) {\n view.adjustResolutionInternal(this.lastMagnitude_ / magnitude);\n }\n if (this.lastMagnitude_ !== undefined) {\n this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;\n }\n this.lastMagnitude_ = magnitude;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return true;\n }\n\n const map = mapBrowserEvent.map;\n const view = map.getView();\n const direction = this.lastScaleDelta_ > 1 ? 1 : -1;\n view.endInteraction(this.duration_, direction);\n this.lastScaleDelta_ = 0;\n return false;\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(mapBrowserEvent) {\n if (!mouseOnly(mapBrowserEvent)) {\n return false;\n }\n\n if (this.condition_(mapBrowserEvent)) {\n mapBrowserEvent.map.getView().beginInteraction();\n this.lastAngle_ = undefined;\n this.lastMagnitude_ = undefined;\n return true;\n }\n return false;\n }\n}\n\nexport default DragRotateAndZoom;\n","/**\n * @module ol/layer/VectorImage\n */\nimport CanvasVectorImageLayerRenderer from '../renderer/canvas/VectorImageLayer.js';\nimport BaseVectorLayer from './BaseVector.js';\n\n/**\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the\n * renderer when getting features from the vector source for the rendering or hit-detection.\n * Recommended value: the size of the largest symbol, line width or label.\n * @property {VectorSourceType} [source] Source.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * @property {boolean|string|number} [declutter=false] Declutter images and text on this layer. Any truthy value will enable\n * decluttering. The priority is defined by the `zIndex` of the style and the render order of features. Higher z-index means higher\n * priority. Within the same z-index, a feature rendered before another has higher priority. Items will\n * not be decluttered against or together with items on other layers with the same `declutter` value. If\n * that is needed, use {@link import(\"../layer/Vector.js\").default} instead.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {number} [imageRatio=1] Ratio by which the rendered extent should be larger than the\n * viewport extent. A larger ratio avoids cut images during panning, but will cause a decrease in performance.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Vector data is rendered client-side, to an image. This layer type provides great performance\n * during panning and zooming, but point symbols and texts are always rotated with the view and\n * pixels are scaled during zoom animations. For more accurate rendering of vector data, use\n * {@link module:ol/layer/Vector~VectorLayer} instead.\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @extends {BaseVectorLayer<FeatureType, VectorSourceType, CanvasVectorImageLayerRenderer>}\n * @api\n */\nclass VectorImageLayer extends BaseVectorLayer {\n /**\n * @param {Options<VectorSourceType, FeatureType>} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign({}, options);\n delete baseOptions.imageRatio;\n super(baseOptions);\n\n /**\n * @type {number}\n * @private\n */\n this.imageRatio_ =\n options.imageRatio !== undefined ? options.imageRatio : 1;\n }\n\n /**\n * @return {number} Ratio between rendered extent size and viewport extent size.\n */\n getImageRatio() {\n return this.imageRatio_;\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new CanvasVectorImageLayerRenderer(this);\n }\n}\n\nexport default VectorImageLayer;\n","/**\n * @module ol/layer/VectorTile\n */\nimport {assert} from '../asserts.js';\nimport CanvasVectorTileLayerRenderer from '../renderer/canvas/VectorTileLayer.js';\nimport BaseVectorLayer from './BaseVector.js';\nimport TileProperty from './TileProperty.js';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"./Base\").BaseLayerObjectEventTypes|\n * import(\"./Layer.js\").LayerEventType|'change:preload'|'change:useInterimTilesOnError', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<import(\"../render/EventType\").LayerRenderEventTypes, import(\"../render/Event\").default, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"./Base\").BaseLayerObjectEventTypes|\n * import(\"./Layer.js\").LayerEventType|'change:preload'|'change:useInterimTilesOnError'|import(\"../render/EventType\").LayerRenderEventTypes, Return>} VectorTileLayerOnSignature\n */\n\n/**\n * @typedef {'hybrid' | 'vector'} VectorTileRenderType\n */\n\n/***\n * @template T\n * @typedef {T extends import(\"../source/VectorTile.js\").default<infer U extends import(\"../Feature.js\").FeatureLike> ? U : never} ExtractedFeatureType\n */\n\n/**\n * @template {import(\"../source/VectorTile.js\").default<FeatureType>} [VectorTileSourceType=import(\"../source/VectorTile.js\").default<*>]\n * @template {import(\"../Feature\").FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the tile extent used by the\n * renderer when getting features from the vector tile for the rendering or hit-detection.\n * Recommended value: Vector tiles are usually generated with a buffer, so this value should match\n * the largest possible buffer of the used tiles. It should be at least the size of the largest\n * point symbol or line width.\n * @property {VectorTileRenderType} [renderMode='hybrid'] Render mode for vector tiles:\n * `'hybrid'`: Polygon and line elements are rendered as images, so pixels are scaled during zoom\n * animations. Point symbols and texts are accurately rendered as vectors and can stay upright on\n * rotated views, but get lifted above all polygon and line elements.\n * `'vector'`: Everything is rendered as vectors and the original render order is maintained. Use\n * this mode for improved performance and visual epxerience on vector tile layers with not too many\n * rendered features (e.g. for highlighting a subset of features of another layer with the same\n * source).\n * @property {VectorTileSourceType} [source] Source.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * @property {boolean|string|number} [declutter=false] Declutter images and text. Any truthy value will enable\n * decluttering. Within a layer, a feature rendered before another has higher priority. All layers with the\n * same `declutter` value will be decluttered together. The priority is determined by the drawing order of the\n * layers with the same `declutter` value. Higher in the layer stack means higher priority. To declutter distinct\n * layers or groups of layers separately, use different truthy values for `declutter`.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer\n * style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no\n * background will be rendered.\n * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will be\n * recreated during animations. This means that no vectors will be shown clipped, but the setting\n * will have a performance impact for large amounts of vector data. When set to `false`, batches\n * will be recreated when no animation is active.\n * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will be\n * recreated during interactions. See also `updateWhileAnimating`.\n * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`\n * means no preloading.\n * @property {boolean} [useInterimTilesOnError=true] Deprecated. Use interim tiles on error.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n * @property {number} [cacheSize=0] The internal tile cache size. If too small, this will auto-grow to hold\n * two zoom levels worth of tiles.\n */\n\n/**\n * @classdesc\n * Layer for vector tile data that is rendered client-side.\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/VectorTile.js\").default<FeatureType>} [VectorTileSourceType=import(\"../source/VectorTile.js\").default<*>]\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]\n * @extends {BaseVectorLayer<FeatureType, VectorTileSourceType, CanvasVectorTileLayerRenderer>}\n * @api\n */\nclass VectorTileLayer extends BaseVectorLayer {\n /**\n * @param {Options<VectorTileSourceType, FeatureType>} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const baseOptions = Object.assign({}, options);\n delete baseOptions.preload;\n const cacheSize = options.cacheSize === undefined ? 0 : options.cacheSize;\n delete options.cacheSize;\n delete baseOptions.useInterimTilesOnError;\n\n super(baseOptions);\n\n /***\n * @type {VectorTileLayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {VectorTileLayerOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {VectorTileLayerOnSignature<void>}\n */\n this.un;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.cacheSize_ = cacheSize;\n\n const renderMode = options.renderMode || 'hybrid';\n assert(\n renderMode == 'hybrid' || renderMode == 'vector',\n \"`renderMode` must be `'hybrid'` or `'vector'`\",\n );\n\n /**\n * @private\n * @type {VectorTileRenderType}\n */\n this.renderMode_ = renderMode;\n\n this.setPreload(options.preload ? options.preload : 0);\n this.setUseInterimTilesOnError(\n options.useInterimTilesOnError !== undefined\n ? options.useInterimTilesOnError\n : true,\n );\n\n /**\n * @return {import(\"./Base.js\").BackgroundColor} Background color.\n * @function\n * @api\n */\n this.getBackground;\n\n /**\n * @param {import(\"./Base.js\").BackgroundColor} background Background color.\n * @function\n * @api\n */\n this.setBackground;\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new CanvasVectorTileLayerRenderer(this, {\n cacheSize: this.cacheSize_,\n });\n }\n\n /**\n * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise\n * that resolves with an array of features. The array will either contain the topmost feature\n * when a hit was detected, or it will be empty.\n *\n * The hit detection algorithm used for this method is optimized for performance, but is less\n * accurate than the one used in [map.getFeaturesAtPixel()]{@link import(\"../Map.js\").default#getFeaturesAtPixel}.\n * Text is not considered, and icons are only represented by their bounding box instead of the exact\n * image.\n *\n * @param {import(\"../pixel.js\").Pixel} pixel Pixel.\n * @return {Promise<Array<import(\"../Feature\").FeatureLike>>} Promise that resolves with an array of features.\n * @api\n * @override\n */\n getFeatures(pixel) {\n return super.getFeatures(pixel);\n }\n\n /**\n * Get features whose bounding box intersects the provided extent. Only features for cached\n * tiles for the last rendered zoom level are available in the source. So this method is only\n * suitable for requesting tiles for extents that are currently rendered.\n *\n * Features are returned in random tile order and as they are included in the tiles. This means\n * they can be clipped, duplicated across tiles, and simplified to the render resolution.\n *\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @return {Array<FeatureType>} Features.\n * @api\n */\n getFeaturesInExtent(extent) {\n return /** @type {Array<FeatureType>} */ (\n /** @type {*} */ (this.getRenderer().getFeaturesInExtent(extent))\n );\n }\n\n /**\n * @return {VectorTileRenderType} The render mode.\n */\n getRenderMode() {\n return this.renderMode_;\n }\n\n /**\n * Return the level as number to which we will preload tiles up to.\n * @return {number} The level to preload tiles up to.\n * @observable\n * @api\n */\n getPreload() {\n return /** @type {number} */ (this.get(TileProperty.PRELOAD));\n }\n\n /**\n * Deprecated. Whether we use interim tiles on error.\n * @return {boolean} Use interim tiles on error.\n * @observable\n * @api\n */\n getUseInterimTilesOnError() {\n return /** @type {boolean} */ (\n this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR)\n );\n }\n\n /**\n * Set the level as number to which we will preload tiles up to.\n * @param {number} preload The level to preload tiles up to.\n * @observable\n * @api\n */\n setPreload(preload) {\n this.set(TileProperty.PRELOAD, preload);\n }\n\n /**\n * Deprecated. Set whether we use interim tiles on error.\n * @param {boolean} useInterimTilesOnError Use interim tiles on error.\n * @observable\n * @api\n */\n setUseInterimTilesOnError(useInterimTilesOnError) {\n this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);\n }\n}\n\nexport default VectorTileLayer;\n","/**\n * @module ol/layer/WebGLPoints\n */\nimport {parseLiteralStyle} from '../render/webgl/style.js';\nimport WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';\nimport Layer from './Layer.js';\n\n/**\n * @template {import(\"../source/Vector.js\").default<import('../Feature').FeatureLike>} VectorSourceType\n * @typedef {Object} Options\n * @property {import('../style/flat.js').FlatStyle} style Literal style to apply to the layer features.\n * @property {import(\"../expr/expression.js\").EncodedExpression} [filter] The filter used\n * to determine if a style applies. If no filter is included, the rule always applies.\n * @property {import('../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not\n * an expression). These variables can be used as {@link import(\"../expr/expression.js\").ExpressionValue expressions} in the styles properties\n * using the `['var', 'varName']` operator.\n * To update style variables, use the {@link import(\"./WebGLPoints.js\").default#updateStyleVariables} method.\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {VectorSourceType} [source] Point source.\n * @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will\n * prevent all hit detection on the layer.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Layer optimized for rendering large point datasets. Takes a `style` property which\n * is a serializable JSON object describing how the layer should be rendered.\n *\n * Here are a few samples of literal style objects:\n * ```js\n * const style = {\n * 'circle-radius': 8,\n * 'circle-fill-color': '#33AAFF',\n * 'circle-opacity': 0.9\n * }\n * ```\n *\n * ```js\n * const style = {\n * 'icon-src': '../static/exclamation-mark.png',\n * 'icon-offset': [0, 12],\n * 'icon-width': 4,\n * 'icon-height': 8\n * }\n * ```\n *\n * **Important: a `WebGLPoints` layer must be manually disposed when removed, otherwise the underlying WebGL context\n * will not be garbage collected.**\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default<import('../Feature').FeatureLike>} VectorSourceType\n * @extends {Layer<VectorSourceType, WebGLPointsLayerRenderer>}\n * @fires import(\"../render/Event.js\").RenderEvent#prerender\n * @fires import(\"../render/Event.js\").RenderEvent#postrender\n * @deprecated Use ol/layer/WebGLVector instead\n */\nclass WebGLPointsLayer extends Layer {\n /**\n * @param {Options<VectorSourceType>} options Options.\n */\n constructor(options) {\n const baseOptions = Object.assign({}, options);\n\n super(baseOptions);\n\n /**\n * @type {import('../style/flat.js').StyleVariables}\n * @private\n */\n this.styleVariables_ = options.variables || {};\n\n /**\n * @private\n * @type {import('../render/webgl/style.js').StyleParseResult}\n */\n this.parseResult_ = parseLiteralStyle(\n options.style,\n this.styleVariables_,\n options.filter,\n );\n\n /**\n * @private\n * @type {boolean}\n */\n this.hitDetectionDisabled_ = !!options.disableHitDetection;\n }\n\n /**\n * @override\n */\n createRenderer() {\n const attributes = Object.keys(this.parseResult_.attributes).map(\n (name) => ({\n name,\n ...this.parseResult_.attributes[name],\n }),\n );\n return new WebGLPointsLayerRenderer(this, {\n vertexShader: this.parseResult_.builder.getSymbolVertexShader(),\n fragmentShader: this.parseResult_.builder.getSymbolFragmentShader(),\n hitDetectionEnabled: !this.hitDetectionDisabled_,\n uniforms: this.parseResult_.uniforms,\n attributes:\n /** @type {Array<import('../renderer/webgl/PointsLayer.js').CustomAttribute>} */ (\n attributes\n ),\n });\n }\n\n /**\n * Update any variables used by the layer style and trigger a re-render.\n * @param {Object<string, number>} variables Variables to update.\n */\n updateStyleVariables(variables) {\n Object.assign(this.styleVariables_, variables);\n this.changed();\n }\n}\n\nexport default WebGLPointsLayer;\n","/**\n * @module ol/layer/WebGLVector\n */\nimport WebGLVectorLayerRenderer from '../renderer/webgl/VectorLayer.js';\nimport Layer from './Layer.js';\n\n/***\n * @template T\n * @typedef {T extends import(\"../source/Vector.js\").default<infer U extends import(\"../Feature.js\").FeatureLike> ? U : never} ExtractedFeatureType\n */\n\n/**\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorSourceType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * FIXME: not supported yet\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {VectorSourceType} [source] Source.\n * @property {import('../style/flat.js').FlatStyleLike} style Layer style.\n * @property {import('../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not\n * an expression). These variables can be used as {@link import(\"../expr/expression.js\").ExpressionValue expressions} in the styles properties\n * using the `['var', 'varName']` operator.\n * To update style variables, use the {@link import(\"./WebGLVector.js\").default#updateStyleVariables} method.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * FIXME: not supported yet\n * @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will\n * prevent all hit detection on the layer.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Layer optimized for rendering large vector datasets.\n *\n * **Important: a `WebGLVector` layer must be manually disposed when removed, otherwise the underlying WebGL context\n * will not be garbage collected.**\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorSourceType>]\n * @extends {Layer<VectorSourceType, WebGLVectorLayerRenderer>}\n */\nclass WebGLVectorLayer extends Layer {\n /**\n * @param {Options<VectorSourceType, FeatureType>} [options] Options.\n */\n constructor(options) {\n const baseOptions = Object.assign({}, options);\n\n super(baseOptions);\n\n /**\n * @type {import('../style/flat.js').StyleVariables}\n * @private\n */\n this.styleVariables_ = options.variables || {};\n\n /**\n * @private\n */\n this.style_ = options.style;\n\n /**\n * @private\n */\n this.hitDetectionDisabled_ = !!options.disableHitDetection;\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new WebGLVectorLayerRenderer(this, {\n style: this.style_,\n variables: this.styleVariables_,\n disableHitDetection: this.hitDetectionDisabled_,\n });\n }\n\n /**\n * Update any variables used by the layer style and trigger a re-render.\n * @param {import('../style/flat.js').StyleVariables} variables Variables to update.\n */\n updateStyleVariables(variables) {\n Object.assign(this.styleVariables_, variables);\n this.changed();\n }\n\n /**\n * Set the layer style.\n * @param {import('../style/flat.js').FlatStyleLike} style Layer style.\n */\n setStyle(style) {\n this.style_ = style;\n this.clearRenderer();\n this.changed();\n }\n}\n\nexport default WebGLVectorLayer;\n","/**\n * @module ol/layer/WebGLVectorTile\n */\nimport WebGLVectorTileLayerRenderer from '../renderer/webgl/VectorTileLayer.js';\nimport BaseTileLayer from './BaseTile.js';\n\n/***\n * @template T\n * @typedef {T extends import(\"../source/Vector.js\").default<infer U extends import(\"../Feature.js\").FeatureLike> ? U : never} ExtractedFeatureType\n */\n\n/**\n * @template {import(\"../source/VectorTile.js\").default<FeatureType>} [VectorTileSourceType=import(\"../source/VectorTile.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * FIXME: not supported yet\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {VectorTileSourceType} [source] Source.\n * @property {import('../style/flat.js').FlatStyleLike} style Layer style.\n * @property {import('../style/flat.js').StyleVariables} [variables] Style variables. Each variable must hold a literal value (not\n * an expression). These variables can be used as {@link import(\"../expr/expression.js\").ExpressionValue expressions} in the styles properties\n * using the `['var', 'varName']` operator.\n * To update style variables, use the {@link import(\"./WebGLVector.js\").default#updateStyleVariables} method.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * FIXME: not supported yet\n * @property {boolean} [disableHitDetection=false] Setting this to true will provide a slight performance boost, but will\n * prevent all hit detection on the layer.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Layer optimized for rendering large vector datasets.\n *\n * **Important: a `WebGLVector` layer must be manually disposed when removed, otherwise the underlying WebGL context\n * will not be garbage collected.**\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/VectorTile.js\").default<FeatureType>} [VectorTileSourceType=import(\"../source/VectorTile.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=ExtractedFeatureType<VectorTileSourceType>]\n * @extends {BaseTileLayer<VectorTileSourceType, WebGLVectorTileLayerRenderer>}\n */\nclass WebGLVectorTileLayer extends BaseTileLayer {\n /**\n * @param {Options<VectorTileSourceType, FeatureType>} [options] Options.\n */\n constructor(options) {\n const baseOptions = Object.assign({}, options);\n\n super(baseOptions);\n\n /**\n * @type {import('../style/flat.js').StyleVariables}\n * @private\n */\n this.styleVariables_ = options.variables || {};\n\n /**\n * @private\n */\n this.style_ = options.style;\n\n /**\n * @private\n */\n this.hitDetectionDisabled_ = !!options.disableHitDetection;\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new WebGLVectorTileLayerRenderer(this, {\n style: this.style_,\n variables: this.styleVariables_,\n disableHitDetection: this.hitDetectionDisabled_,\n });\n }\n\n /**\n * Update any variables used by the layer style and trigger a re-render.\n * @param {import('../style/flat.js').StyleVariables} variables Variables to update.\n */\n updateStyleVariables(variables) {\n Object.assign(this.styleVariables_, variables);\n this.changed();\n }\n\n /**\n * Set the layer style.\n * @param {import('../style/flat.js').FlatStyleLike} style Layer style.\n */\n setStyle(style) {\n this.style_ = style;\n this.clearRenderer();\n this.changed();\n }\n}\n\nexport default WebGLVectorTileLayer;\n","/**\n * @module ol/source/CartoDB\n */\n\nimport XYZ from './XYZ.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Projection.\n * @property {number} [maxZoom=18] Max zoom.\n * @property {number} [minZoom] Minimum zoom.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {Object} [config] If using anonymous maps, the CartoDB config to use. See\n * https://carto.com/developers/maps-api/guides/anonymous-maps/\n * for more detail.\n * If using named maps, a key-value lookup with the template parameters.\n * See https://carto.com/developers/maps-api/guides/named-maps/\n * for more detail.\n * @property {string} [map] If using named maps, this will be the name of the template to load.\n * See https://carto.com/developers/maps-api/guides/named-maps/\n * for more detail.\n * @property {string} [account] Username as used to access public Carto dashboard at https://{username}.carto.com/.\n * @property {number} [transition=250] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @typedef {Object} CartoDBLayerInfo\n * @property {string} layergroupid The layer group ID\n * @property {{https: string}} cdn_url The CDN URL\n */\n\n/**\n * @classdesc\n * Layer source for the CartoDB Maps API.\n * @api\n */\nclass CartoDB extends XYZ {\n /**\n * @param {Options} options CartoDB options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18,\n minZoom: options.minZoom,\n projection: options.projection,\n transition: options.transition,\n wrapX: options.wrapX,\n zDirection: options.zDirection,\n });\n\n /**\n * @type {string}\n * @private\n */\n this.account_ = options.account;\n\n /**\n * @type {string}\n * @private\n */\n this.mapId_ = options.map || '';\n\n /**\n * @type {!Object}\n * @private\n */\n this.config_ = options.config || {};\n\n /**\n * @type {!Object<string, CartoDBLayerInfo>}\n * @private\n */\n this.templateCache_ = {};\n\n this.initializeMap_();\n }\n\n /**\n * Returns the current config.\n * @return {!Object} The current configuration.\n * @api\n */\n getConfig() {\n return this.config_;\n }\n\n /**\n * Updates the carto db config.\n * @param {Object} config a key-value lookup. Values will replace current values\n * in the config.\n * @api\n */\n updateConfig(config) {\n Object.assign(this.config_, config);\n this.initializeMap_();\n }\n\n /**\n * Sets the CartoDB config\n * @param {Object} config In the case of anonymous maps, a CartoDB configuration\n * object.\n * If using named maps, a key-value lookup with the template parameters.\n * @api\n */\n setConfig(config) {\n this.config_ = config || {};\n this.initializeMap_();\n }\n\n /**\n * Issue a request to initialize the CartoDB map.\n * @private\n */\n initializeMap_() {\n const paramHash = JSON.stringify(this.config_);\n if (this.templateCache_[paramHash]) {\n this.applyTemplate_(this.templateCache_[paramHash]);\n return;\n }\n let mapUrl = 'https://' + this.account_ + '.carto.com/api/v1/map';\n\n if (this.mapId_) {\n mapUrl += '/named/' + this.mapId_;\n }\n\n const client = new XMLHttpRequest();\n client.addEventListener(\n 'load',\n this.handleInitResponse_.bind(this, paramHash),\n );\n client.addEventListener('error', this.handleInitError_.bind(this));\n client.open('POST', mapUrl);\n client.setRequestHeader('Content-type', 'application/json');\n client.send(JSON.stringify(this.config_));\n }\n\n /**\n * Handle map initialization response.\n * @param {string} paramHash a hash representing the parameter set that was used\n * for the request\n * @param {Event} event Event.\n * @private\n */\n handleInitResponse_(paramHash, event) {\n const client = /** @type {XMLHttpRequest} */ (event.target);\n // status will be 0 for file:// urls\n if (!client.status || (client.status >= 200 && client.status < 300)) {\n let response;\n try {\n response = /** @type {CartoDBLayerInfo} */ (\n JSON.parse(client.responseText)\n );\n } catch {\n this.setState('error');\n return;\n }\n this.applyTemplate_(response);\n this.templateCache_[paramHash] = response;\n this.setState('ready');\n } else {\n this.setState('error');\n }\n }\n\n /**\n * @private\n * @param {Event} event Event.\n */\n handleInitError_(event) {\n this.setState('error');\n }\n\n /**\n * Apply the new tile urls returned by carto db\n * @param {CartoDBLayerInfo} data Result of carto db call.\n * @private\n */\n applyTemplate_(data) {\n const tilesUrl =\n 'https://' +\n data.cdn_url.https +\n '/' +\n this.account_ +\n '/api/v1/map/' +\n data.layergroupid +\n '/{z}/{x}/{y}.png';\n this.setUrl(tilesUrl);\n }\n}\n\nexport default CartoDB;\n","/**\n * @module ol/source/Cluster\n */\n\nimport Feature from '../Feature.js';\nimport {assert} from '../asserts.js';\nimport {add as addCoordinate, scale as scaleCoordinate} from '../coordinate.js';\nimport EventType from '../events/EventType.js';\nimport {\n buffer,\n createEmpty,\n createOrUpdateFromCoordinate,\n getCenter,\n} from '../extent.js';\nimport Point from '../geom/Point.js';\nimport {getUid} from '../util.js';\nimport VectorSource from './Vector.js';\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").FeatureLike]\n * @typedef {(feature: FeatureType) => (Point|null)} GeometryFunction\n */\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../Feature.js\").default]\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [distance=20] Distance in pixels within which features will\n * be clustered together.\n * @property {number} [minDistance=0] Minimum distance in pixels between clusters.\n * Will be capped at the configured distance.\n * By default no minimum distance is guaranteed. This config can be used to avoid\n * overlapping icons. As a tradoff, the cluster feature's position will no longer be\n * the center of all its features.\n * @property {GeometryFunction<FeatureType>} [geometryFunction]\n * Function that takes a {@link module:ol/Feature~Feature} as argument and returns a\n * {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a\n * feature should not be considered for clustering, the function should return\n * `null`. The default, which works when the underlying source contains point\n * features only, is\n * ```js\n * function(feature) {\n * return feature.getGeometry();\n * }\n * ```\n * See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster\n * calculation point for polygons.\n * @property {function(Point, Array<FeatureType>):Feature} [createCluster]\n * Function that takes the cluster's center {@link module:ol/geom/Point~Point} and an array\n * of {@link module:ol/Feature~Feature} included in this cluster. Must return a\n * {@link module:ol/Feature~Feature} that will be used to render. Default implementation is:\n * ```js\n * function(point, features) {\n * return new Feature({\n * geometry: point,\n * features: features\n * });\n * }\n * ```\n * @property {VectorSource<FeatureType>} [source=null] Source.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n */\n\n/**\n * @classdesc\n * Layer source to cluster vector data. Works out of the box with point\n * geometries. For other geometry types, or if not all geometries should be\n * considered for clustering, a custom `geometryFunction` can be defined.\n *\n * If the instance is disposed without also disposing the underlying\n * source `setSource(null)` has to be called to remove the listener reference\n * from the wrapped source.\n * @api\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import('../Feature.js').default]\n * @extends {VectorSource<Feature<import(\"../geom/Geometry.js\").default>>}\n */\nclass Cluster extends VectorSource {\n /**\n * @param {Options<FeatureType>} [options] Cluster options.\n */\n constructor(options) {\n options = options || {};\n super({\n attributions: options.attributions,\n wrapX: options.wrapX,\n });\n\n /**\n * @type {number|undefined}\n * @protected\n */\n this.resolution = undefined;\n\n /**\n * @type {number}\n * @protected\n */\n this.distance = options.distance !== undefined ? options.distance : 20;\n\n /**\n * @type {number}\n * @protected\n */\n this.minDistance = options.minDistance || 0;\n\n /**\n * @type {number}\n * @protected\n */\n this.interpolationRatio = 0;\n\n /**\n * @type {Array<Feature>}\n * @protected\n */\n this.features = [];\n\n /**\n * @type {GeometryFunction<import(\"../Feature.js\").FeatureLike>}\n * @protected\n */\n this.geometryFunction =\n options.geometryFunction ||\n function (feature) {\n const geometry = /** @type {Point} */ (feature.getGeometry());\n assert(\n !geometry || geometry.getType() === 'Point',\n 'The default `geometryFunction` can only handle `Point` or null geometries',\n );\n return geometry;\n };\n\n /**\n * @type {function(Point, Array<FeatureType>):Feature}\n * @private\n */\n this.createCustomCluster_ = options.createCluster;\n\n /**\n * @type {VectorSource<FeatureType>|null}\n * @protected\n */\n this.source = null;\n\n /**\n * @private\n */\n this.boundRefresh_ = this.refresh.bind(this);\n\n this.updateDistance(this.distance, this.minDistance);\n this.setSource(options.source || null);\n }\n\n /**\n * Remove all features from the source.\n * @param {boolean} [fast] Skip dispatching of {@link module:ol/source/VectorEventType~VectorEventType#removefeature} events.\n * @api\n * @override\n */\n clear(fast) {\n this.features.length = 0;\n super.clear(fast);\n }\n\n /**\n * Get the distance in pixels between clusters.\n * @return {number} Distance.\n * @api\n */\n getDistance() {\n return this.distance;\n }\n\n /**\n * Get a reference to the wrapped source.\n * @return {VectorSource<FeatureType>|null} Source.\n * @api\n */\n getSource() {\n return this.source;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @override\n */\n loadFeatures(extent, resolution, projection) {\n this.source?.loadFeatures(extent, resolution, projection);\n if (resolution !== this.resolution) {\n this.resolution = resolution;\n this.refresh();\n }\n }\n\n /**\n * Set the distance within which features will be clusterd together.\n * @param {number} distance The distance in pixels.\n * @api\n */\n setDistance(distance) {\n this.updateDistance(distance, this.minDistance);\n }\n\n /**\n * Set the minimum distance between clusters. Will be capped at the\n * configured distance.\n * @param {number} minDistance The minimum distance in pixels.\n * @api\n */\n setMinDistance(minDistance) {\n this.updateDistance(this.distance, minDistance);\n }\n\n /**\n * The configured minimum distance between clusters.\n * @return {number} The minimum distance in pixels.\n * @api\n */\n getMinDistance() {\n return this.minDistance;\n }\n\n /**\n * Replace the wrapped source.\n * @param {VectorSource<FeatureType>|null} source The new source for this instance.\n * @api\n */\n setSource(source) {\n if (this.source) {\n this.source.removeEventListener(EventType.CHANGE, this.boundRefresh_);\n }\n this.source = source;\n if (source) {\n source.addEventListener(EventType.CHANGE, this.boundRefresh_);\n }\n this.refresh();\n }\n\n /**\n * Handle the source changing.\n * @override\n */\n refresh() {\n this.clear();\n this.cluster();\n this.addFeatures(this.features);\n }\n\n /**\n * Update the distances and refresh the source if necessary.\n * @param {number} distance The new distance.\n * @param {number} minDistance The new minimum distance.\n */\n updateDistance(distance, minDistance) {\n const ratio =\n distance === 0 ? 0 : Math.min(minDistance, distance) / distance;\n const changed =\n distance !== this.distance || this.interpolationRatio !== ratio;\n this.distance = distance;\n this.minDistance = minDistance;\n this.interpolationRatio = ratio;\n if (changed) {\n this.refresh();\n }\n }\n\n /**\n * @protected\n */\n cluster() {\n if (this.resolution === undefined || !this.source) {\n return;\n }\n const extent = createEmpty();\n const mapDistance = this.distance * this.resolution;\n const features = this.source.getFeatures();\n\n /** @type {Object<string, true>} */\n const clustered = {};\n\n for (let i = 0, ii = features.length; i < ii; i++) {\n const feature = features[i];\n if (!(getUid(feature) in clustered)) {\n const geometry = this.geometryFunction(feature);\n if (geometry) {\n const coordinates = geometry.getCoordinates();\n createOrUpdateFromCoordinate(coordinates, extent);\n buffer(extent, mapDistance, extent);\n\n const neighbors = this.source\n .getFeaturesInExtent(extent)\n .filter(function (neighbor) {\n const uid = getUid(neighbor);\n if (uid in clustered) {\n return false;\n }\n clustered[uid] = true;\n return true;\n });\n this.features.push(this.createCluster(neighbors, extent));\n }\n }\n }\n }\n\n /**\n * @param {Array<FeatureType>} features Features\n * @param {import(\"../extent.js\").Extent} extent The searched extent for these features.\n * @return {Feature} The cluster feature.\n * @protected\n */\n createCluster(features, extent) {\n const centroid = [0, 0];\n for (let i = features.length - 1; i >= 0; --i) {\n const geometry = this.geometryFunction(features[i]);\n if (geometry) {\n addCoordinate(centroid, geometry.getCoordinates());\n } else {\n features.splice(i, 1);\n }\n }\n scaleCoordinate(centroid, 1 / features.length);\n const searchCenter = getCenter(extent);\n const ratio = this.interpolationRatio;\n const geometry = new Point([\n centroid[0] * (1 - ratio) + searchCenter[0] * ratio,\n centroid[1] * (1 - ratio) + searchCenter[1] * ratio,\n ]);\n if (this.createCustomCluster_) {\n return this.createCustomCluster_(geometry, features);\n }\n return new Feature({\n geometry,\n features,\n });\n }\n}\n\nexport default Cluster;\n","/**\n * @module ol/source/Google\n */\n\nimport ViewHint from '../ViewHint.js';\nimport {getBottomLeft, getTopRight} from '../extent.js';\nimport {toLonLat} from '../proj.js';\nimport {createXYZ, extentFromProjection} from '../tilegrid.js';\nimport TileImage from './TileImage.js';\n\nconst createSessionUrl = 'https://tile.googleapis.com/v1/createSession';\nconst tileUrl = 'https://tile.googleapis.com/v1/2dtiles';\nconst attributionUrl = 'https://tile.googleapis.com/tile/v1/viewport';\nconst maxZoom = 22;\n\n/**\n * @typedef {Object} Options\n * @property {string} key Google Map Tiles API key. Get yours at https://developers.google.com/maps/documentation/tile/get-api-key.\n * @property {string} [mapType='roadmap'] The type of [base map](https://developers.google.com/maps/documentation/tile/session_tokens#required_fields).\n * @property {string} [language='en-US'] An [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) for information displayed on the tiles.\n * @property {string} [region='US'] A [Common Locale Data Repository](https://cldr.unicode.org/) (CLDR) region identifier that represents the user location.\n * @property {string} [imageFormat] The image format used for the map tiles (e.g. `'jpeg'`, or `'png'`).\n * @property {string} [scale] Scale for map elements (`'scaleFactor1x'`, `'scaleFactor2x'`, or `'scaleFactor4x'`).\n * @property {boolean} [highDpi=false] Use high-resolution tiles.\n * @property {Array<string>} [layerTypes] The layer types added to the map (e.g. `'layerRoadmap'`, `'layerStreetview'`, or `'layerTraffic'`).\n * @property {boolean} [overlay=false] Display only the `layerTypes` and not the underlying `mapType` (only works if `layerTypes` is provided).\n * @property {Array<Object>} [styles] [Custom styles](https://developers.google.com/maps/documentation/tile/style-reference) applied to the map.\n * @property {boolean} [attributionsCollapsible=true] Allow the attributions to be collapsed.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {Array<string>} [apiOptions] An array of values specifying additional options to apply.\n * @property {boolean} [wrapX=true] Wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @typedef {Object} SessionTokenRequest\n * @property {string} mapType The map type.\n * @property {string} language The language.\n * @property {string} region The region.\n * @property {string} [imageFormat] The image format.\n * @property {string} [scale] The scale.\n * @property {boolean} [highDpi] Use high resolution tiles.\n * @property {Array<string>} [layerTypes] The layer types.\n * @property {boolean} [overlay] The overlay.\n * @property {Array<Object>} [styles] The styles.\n * @property {Array<string>} [apiOptions] An array of values specifying additional options to apply.\n */\n\n/**\n * @typedef {Object} SessionTokenResponse\n * @property {string} session The session token.\n * @property {string} expiry The session token expiry (seconds since the epoch as a string).\n * @property {number} tileWidth The tile width.\n * @property {number} tileHeight The tile height.\n * @property {string} imageFormat The image format.\n */\n\n/**\n * @classdesc\n * A tile layer source that renders tiles from the Google [Map Tiles API](https://developers.google.com/maps/documentation/tile/overview).\n * The constructor takes options that are passed to the request to create a session token. Refer to the\n * [documentation](https://developers.google.com/maps/documentation/tile/session_tokens#required_fields)\n * for additional details.\n * @api\n */\nclass Google extends TileImage {\n /**\n * @param {Options} options Google Maps options.\n */\n constructor(options) {\n const highDpi = !!options.highDpi;\n\n super({\n attributionsCollapsible: options.attributionsCollapsible,\n cacheSize: options.cacheSize,\n crossOrigin: 'anonymous',\n interpolate: options.interpolate,\n projection: 'EPSG:3857',\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n state: 'loading',\n tileLoadFunction: options.tileLoadFunction,\n tilePixelRatio: highDpi ? 2 : 1,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n zDirection: options.zDirection,\n });\n\n /**\n * @type {string}\n * @private\n */\n this.apiKey_ = options.key;\n\n /**\n * @type {Error|null}\n * @private\n */\n this.error_ = null;\n\n /**\n * @type {SessionTokenRequest}\n */\n const sessionTokenRequest = {\n mapType: options.mapType || 'roadmap',\n language: options.language || 'en-US',\n region: options.region || 'US',\n };\n if (options.imageFormat) {\n sessionTokenRequest.imageFormat = options.imageFormat;\n }\n if (options.scale) {\n sessionTokenRequest.scale = options.scale;\n }\n if (highDpi) {\n sessionTokenRequest.highDpi = true;\n }\n if (options.layerTypes) {\n sessionTokenRequest.layerTypes = options.layerTypes;\n }\n if (options.styles) {\n sessionTokenRequest.styles = options.styles;\n }\n if (options.overlay === true) {\n sessionTokenRequest.overlay = true;\n }\n if (options.apiOptions) {\n sessionTokenRequest.apiOptions = options.apiOptions;\n }\n\n /**\n * @type {SessionTokenRequest}\n * @private\n */\n this.sessionTokenRequest_ = sessionTokenRequest;\n\n /**\n * @type {string}\n * @private\n */\n this.sessionTokenValue_;\n\n /**\n * @type {ReturnType<typeof setTimeout>}\n * @private\n */\n this.sessionRefreshId_;\n\n /**\n * @type {string}\n * @private\n */\n this.previousViewportAttribution_;\n\n /**\n * @type {string}\n * @private\n */\n this.previousViewportExtent_;\n\n this.createSession_();\n }\n\n /**\n * @return {Error|null} A source loading error. When the source state is `error`, use this function\n * to get more information about the error. To debug a faulty configuration, you may want to use\n * a listener like\n * ```js\n * source.on('change', () => {\n * if (source.getState() === 'error') {\n * console.error(source.getError());\n * }\n * });\n * ```\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Exposed here so it can be overridden in the tests.\n * @param {string} url The URL.\n * @param {RequestInit} config The config.\n * @return {Promise<Response>} A promise that resolves with the response.\n */\n fetchSessionToken(url, config) {\n return fetch(url, config);\n }\n\n /**\n * Get or renew a session token for use with tile requests.\n * @private\n */\n async createSession_() {\n const url = createSessionUrl + '?key=' + this.apiKey_;\n const config = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(this.sessionTokenRequest_),\n };\n\n const response = await this.fetchSessionToken(url, config);\n if (!response.ok) {\n try {\n const body = await response.json();\n this.error_ = new Error(body.error.message);\n } catch {\n this.error_ = new Error('Error fetching session token');\n }\n this.setState('error');\n return;\n }\n\n /**\n * @type {SessionTokenResponse}\n */\n const sessionTokenResponse = await response.json();\n\n const tilePixelRatio = this.getTilePixelRatio(1);\n const tileSize = [\n sessionTokenResponse.tileWidth / tilePixelRatio,\n sessionTokenResponse.tileHeight / tilePixelRatio,\n ];\n\n this.tileGrid = createXYZ({\n extent: extentFromProjection(this.getProjection()),\n maxZoom: maxZoom,\n tileSize: tileSize,\n });\n\n const session = sessionTokenResponse.session;\n this.sessionTokenValue_ = session;\n const key = this.apiKey_;\n this.tileUrlFunction = function (tileCoord, pixelRatio, projection) {\n const z = tileCoord[0];\n const x = tileCoord[1];\n const y = tileCoord[2];\n const url = `${tileUrl}/${z}/${x}/${y}?session=${session}&key=${key}`;\n return url;\n };\n\n const expiry = parseInt(sessionTokenResponse.expiry, 10) * 1000;\n const timeout = Math.max(expiry - Date.now() - 60 * 1000, 1);\n this.sessionRefreshId_ = setTimeout(() => this.createSession_(), timeout);\n\n this.setAttributions(this.fetchAttributions_.bind(this));\n // even if the state is already ready, we want the change event\n this.setState('ready');\n }\n\n /**\n * @param {import('../Map.js').FrameState} frameState The frame state.\n * @return {Promise<string>} The attributions.\n * @private\n */\n async fetchAttributions_(frameState) {\n if (\n frameState.viewHints[ViewHint.ANIMATING] ||\n frameState.viewHints[ViewHint.INTERACTING] ||\n frameState.animate\n ) {\n return this.previousViewportAttribution_;\n }\n const [west, south] = toLonLat(\n getBottomLeft(frameState.extent),\n frameState.viewState.projection,\n );\n const [east, north] = toLonLat(\n getTopRight(frameState.extent),\n frameState.viewState.projection,\n );\n const tileGrid = this.getTileGrid();\n const zoom = tileGrid.getZForResolution(\n frameState.viewState.resolution,\n this.zDirection,\n );\n const viewportExtent = `zoom=${zoom}&north=${north}&south=${south}&east=${east}&west=${west}`;\n // check if the extent or zoom has actually changed to avoid unnecessary requests\n if (this.previousViewportExtent_ == viewportExtent) {\n return this.previousViewportAttribution_;\n }\n this.previousViewportExtent_ = viewportExtent;\n const session = this.sessionTokenValue_;\n const key = this.apiKey_;\n const url = `${attributionUrl}?session=${session}&key=${key}&${viewportExtent}`;\n this.previousViewportAttribution_ = await fetch(url)\n .then((response) => response.json())\n .then((json) => json.copyright);\n\n return this.previousViewportAttribution_;\n }\n\n /**\n * @override\n */\n disposeInternal() {\n clearTimeout(this.sessionRefreshId_);\n super.disposeInternal();\n }\n}\n\nexport default Google;\n","/**\n * @module ol/source/ImageArcGISRest\n */\n\nimport {decode} from '../Image.js';\nimport ImageSource, {defaultImageLoadFunction} from './Image.js';\nimport {createLoader} from './arcgisRest.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting the image from\n * the remote server.\n * @property {import(\"../Image.js\").LoadFunction} [imageLoadFunction] Optional function to load an image given\n * a URL.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {Object<string,*>} [params] ArcGIS Rest parameters. This field is optional. Service\n * defaults will be used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is\n * `IMAGE` by default. `TRANSPARENT` is `true` by default. `BBOX`, `SIZE`, `BBOXSR`, and `IMAGESR`\n * will be set dynamically. Set `LAYERS` to override the default service layer visibility. See\n * https://developers.arcgis.com/rest/services-reference/export-map.htm\n * for further reference.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * The projection code must contain a numeric end portion separated by :\n * or the entire code must form a valid ArcGIS SpatialReference definition.\n * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport,\n * `2` means twice the size of the map viewport, and so on.\n * @property {Array<number>} [resolutions] Resolutions. If specified, requests will be made for\n * these resolutions only.\n * @property {string} [url] ArcGIS Rest service URL for a Map Service or Image Service. The url\n * should include /MapServer or /ImageServer.\n */\n\n/**\n * @classdesc\n * Source for data from ArcGIS Rest services providing single, untiled images.\n * Useful when underlying map service has labels.\n *\n * If underlying map service is not using labels,\n * take advantage of ol image caching and use\n * {@link module:ol/source/TileArcGISRest~TileArcGISRest} data source.\n *\n * @fires module:ol/source/Image.ImageSourceEvent\n * @api\n */\nclass ImageArcGISRest extends ImageSource {\n /**\n * @param {Options} [options] Image ArcGIS Rest Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n attributions: options.attributions,\n interpolate: options.interpolate,\n projection: options.projection,\n resolutions: options.resolutions,\n });\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.url_ = options.url;\n\n /**\n * @private\n * @type {import(\"../Image.js\").LoadFunction}\n */\n this.imageLoadFunction_ =\n options.imageLoadFunction !== undefined\n ? options.imageLoadFunction\n : defaultImageLoadFunction;\n\n /**\n * @private\n * @type {!Object}\n */\n this.params_ = Object.assign({}, options.params);\n\n /**\n * @private\n * @type {import(\"../size.js\").Size}\n */\n this.imageSize_ = [0, 0];\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRevision_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5;\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.loaderProjection_ = null;\n }\n\n /**\n * Get the user-provided params, i.e. those passed to the constructor through\n * the \"params\" option, and possibly updated using the updateParams method.\n * @return {Object} Params.\n * @api\n */\n getParams() {\n return this.params_;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../Image.js\").default} Single image.\n * @override\n */\n getImageInternal(extent, resolution, pixelRatio, projection) {\n if (this.url_ === undefined) {\n return null;\n }\n if (!this.loader || this.loaderProjection_ !== projection) {\n // Lazily create loader to pick up the view projection and to allow `params` updates\n this.loaderProjection_ = projection;\n this.loader = createLoader({\n crossOrigin: this.crossOrigin_,\n params: this.params_,\n projection: projection,\n hidpi: this.hidpi_,\n url: this.url_,\n ratio: this.ratio_,\n load: (image, src) => {\n this.image.setImage(image);\n this.imageLoadFunction_(this.image, src);\n return decode(image);\n },\n });\n }\n\n return super.getImageInternal(extent, resolution, pixelRatio, projection);\n }\n\n /**\n * Return the image load function of the source.\n * @return {import(\"../Image.js\").LoadFunction} The image load function.\n * @api\n */\n getImageLoadFunction() {\n return this.imageLoadFunction_;\n }\n\n /**\n * Return the URL used for this ArcGIS source.\n * @return {string|undefined} URL.\n * @api\n */\n getUrl() {\n return this.url_;\n }\n\n /**\n * Set the image load function of the source.\n * @param {import(\"../Image.js\").LoadFunction} imageLoadFunction Image load function.\n * @api\n */\n setImageLoadFunction(imageLoadFunction) {\n this.imageLoadFunction_ = imageLoadFunction;\n this.changed();\n }\n\n /**\n * Set the URL to use for requests.\n * @param {string|undefined} url URL.\n * @api\n */\n setUrl(url) {\n if (url != this.url_) {\n this.url_ = url;\n this.loader = null;\n this.changed();\n }\n }\n\n /**\n * Set the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n setParams(params) {\n this.params_ = Object.assign({}, params);\n this.changed();\n }\n\n /**\n * Update the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n updateParams(params) {\n Object.assign(this.params_, params);\n this.changed();\n }\n\n /**\n * @override\n */\n changed() {\n this.image = null;\n super.changed();\n }\n}\n\nexport default ImageArcGISRest;\n","/**\n * @module ol/source/ImageCanvas\n */\n\nimport ImageCanvas from '../ImageCanvas.js';\nimport {\n containsExtent,\n getHeight,\n getWidth,\n scaleFromCenter,\n} from '../extent.js';\nimport ImageSource from './Image.js';\n\n/**\n * A function returning the canvas element (`{HTMLCanvasElement}`)\n * used by the source as an image. The arguments passed to the function are:\n * {@link module:ol/extent~Extent} the image extent, `{number}` the image resolution,\n * `{number}` the pixel ratio of the map, {@link module:ol/size~Size} the image size,\n * and {@link module:ol/proj/Projection~Projection} the image projection. The canvas returned by\n * this function is cached by the source. The this keyword inside the function\n * references the {@link module:ol/source/ImageCanvas~ImageCanvasSource}.\n *\n * @typedef {function(this:import(\"../ImageCanvas.js\").default, import(\"../extent.js\").Extent, number,\n * number, import(\"../size.js\").Size, import(\"../proj/Projection.js\").default): HTMLCanvasElement} FunctionType\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {FunctionType} [canvasFunction] Canvas function.\n * The function returning the canvas element used by the source\n * as an image. The arguments passed to the function are: {@link import(\"../extent.js\").Extent} the\n * image extent, `{number}` the image resolution, `{number}` the pixel ratio of the map,\n * {@link import(\"../size.js\").Size} the image size, and {@link import(\"../proj/Projection.js\").default} the image\n * projection. The canvas returned by this function is cached by the source. If\n * the value returned by the function is later changed then\n * `changed` should be called on the source for the source to\n * invalidate the current cached image. See: {@link module:ol/Observable~Observable#changed}\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {number} [ratio=1.5] Ratio. 1 means canvases are the size of the map viewport, 2 means twice the\n * width and height of the map viewport, and so on. Must be `1` or higher.\n * @property {Array<number>} [resolutions] Resolutions.\n * If specified, new canvases will be created for these resolutions\n * @property {import(\"./Source.js\").State} [state] Source state.\n */\n\n/**\n * @classdesc\n * Base class for image sources where a canvas element is the image.\n * @api\n */\nclass ImageCanvasSource extends ImageSource {\n /**\n * @param {Options} [options] ImageCanvas options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n attributions: options.attributions,\n interpolate: options.interpolate,\n projection: options.projection,\n resolutions: options.resolutions,\n state: options.state,\n });\n\n /**\n * @private\n * @type {FunctionType}\n */\n this.canvasFunction_ = options.canvasFunction;\n\n /**\n * @private\n * @type {import(\"../ImageCanvas.js\").default}\n */\n this.canvas_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRevision_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../ImageCanvas.js\").default} Single image.\n * @override\n */\n getImageInternal(extent, resolution, pixelRatio, projection) {\n resolution = this.findNearestResolution(resolution);\n\n let canvas = this.canvas_;\n if (\n canvas &&\n this.renderedRevision_ == this.getRevision() &&\n canvas.getResolution() == resolution &&\n canvas.getPixelRatio() == pixelRatio &&\n containsExtent(canvas.getExtent(), extent)\n ) {\n return canvas;\n }\n\n extent = extent.slice();\n scaleFromCenter(extent, this.ratio_);\n const width = getWidth(extent) / resolution;\n const height = getHeight(extent) / resolution;\n const size = [width * pixelRatio, height * pixelRatio];\n\n const canvasElement = this.canvasFunction_.call(\n this,\n extent,\n resolution,\n pixelRatio,\n size,\n projection,\n );\n if (canvasElement) {\n canvas = new ImageCanvas(extent, resolution, pixelRatio, canvasElement);\n }\n this.canvas_ = canvas;\n this.renderedRevision_ = this.getRevision();\n\n return canvas;\n }\n}\n\nexport default ImageCanvasSource;\n","/**\n * @module ol/source/ImageMapGuide\n */\n\nimport {decode} from '../Image.js';\nimport ImageSource, {defaultImageLoadFunction} from './Image.js';\nimport {createLoader} from './mapguide.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [url] The mapagent url.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {number} [displayDpi=96] The display resolution.\n * @property {number} [metersPerUnit=1] The meters-per-unit value.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting\n * the image from the remote server.\n * @property {boolean} [useOverlay] If `true`, will use `GETDYNAMICMAPOVERLAYIMAGE`.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {number} [ratio=1] Ratio. `1` means image requests are the size of the map viewport, `2` means\n * twice the width and height of the map viewport, and so on. Must be `1` or higher.\n * @property {Array<number>} [resolutions] Resolutions.\n * If specified, requests will be made for these resolutions only.\n * @property {import(\"../Image.js\").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {Object} [params] Additional parameters.\n */\n\n/**\n * @classdesc\n * Source for images from Mapguide servers\n *\n * @fires module:ol/source/Image.ImageSourceEvent\n * @api\n */\nclass ImageMapGuide extends ImageSource {\n /**\n * @param {Options} options ImageMapGuide options.\n */\n constructor(options) {\n super({\n interpolate: options.interpolate,\n projection: options.projection,\n resolutions: options.resolutions,\n });\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n /**\n * @private\n * @type {number}\n */\n this.displayDpi_ =\n options.displayDpi !== undefined ? options.displayDpi : 96;\n\n /**\n * @private\n * @type {!Object}\n */\n this.params_ = Object.assign({}, options.params);\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.url_ = options.url;\n\n /**\n * @private\n * @type {import(\"../Image.js\").LoadFunction}\n */\n this.imageLoadFunction_ =\n options.imageLoadFunction !== undefined\n ? options.imageLoadFunction\n : defaultImageLoadFunction;\n\n /**\n * @private\n * @type {boolean}\n */\n this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;\n\n /**\n * @private\n * @type {number}\n */\n this.metersPerUnit_ =\n options.metersPerUnit !== undefined ? options.metersPerUnit : 1;\n\n /**\n * @private\n * @type {number}\n */\n this.ratio_ = options.ratio !== undefined ? options.ratio : 1;\n\n /**\n * @private\n * @type {boolean}\n */\n this.useOverlay_ =\n options.useOverlay !== undefined ? options.useOverlay : false;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRevision_ = 0;\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.loaderProjection_ = null;\n }\n\n /**\n * Get the user-provided params, i.e. those passed to the constructor through\n * the \"params\" option, and possibly updated using the updateParams method.\n * @return {Object} Params.\n * @api\n */\n getParams() {\n return this.params_;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../Image.js\").default} Single image.\n * @override\n */\n getImageInternal(extent, resolution, pixelRatio, projection) {\n if (this.url_ === undefined) {\n return null;\n }\n if (!this.loader || this.loaderProjection_ !== projection) {\n // Lazily create loader to pick up the view projection and to allow `params` updates\n this.loaderProjection_ = projection;\n this.loader = createLoader({\n crossOrigin: this.crossOrigin_,\n params: this.params_,\n hidpi: this.hidpi_,\n metersPerUnit: this.metersPerUnit_,\n url: this.url_,\n useOverlay: this.useOverlay_,\n ratio: this.ratio_,\n load: (image, src) => {\n this.image.setImage(image);\n this.imageLoadFunction_(this.image, src);\n return decode(image);\n },\n });\n }\n\n return super.getImageInternal(extent, resolution, pixelRatio, projection);\n }\n\n /**\n * Return the image load function of the source.\n * @return {import(\"../Image.js\").LoadFunction} The image load function.\n * @api\n */\n getImageLoadFunction() {\n return this.imageLoadFunction_;\n }\n\n /**\n * Set the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n setParams(params) {\n this.params_ = Object.assign({}, params);\n this.changed();\n }\n\n /**\n * Update the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n updateParams(params) {\n Object.assign(this.params_, params);\n this.changed();\n }\n\n /**\n * Set the image load function of the MapGuide source.\n * @param {import(\"../Image.js\").LoadFunction} imageLoadFunction Image load function.\n * @api\n */\n setImageLoadFunction(imageLoadFunction) {\n this.imageLoadFunction_ = imageLoadFunction;\n this.changed();\n }\n\n /**\n * @override\n */\n changed() {\n this.image = null;\n super.changed();\n }\n}\n\nexport default ImageMapGuide;\n","/**\n * @module ol/source/ImageStatic\n */\n\nimport ImageWrapper, {decode} from '../Image.js';\nimport EventType from '../events/EventType.js';\nimport {intersects} from '../extent.js';\nimport {get as getProjection} from '../proj.js';\nimport ImageSource, {defaultImageLoadFunction} from './Image.js';\nimport {createLoader} from './static.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {import(\"../extent.js\").Extent} imageExtent Extent of the image in map coordinates.\n * This is the [left, bottom, right, top] map coordinates of your image.\n * @property {import(\"../Image.js\").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {string} url Image URL.\n */\n\n/**\n * @classdesc\n * A layer source for displaying a single, static image.\n * @api\n */\nclass Static extends ImageSource {\n /**\n * @param {Options} options ImageStatic options.\n */\n constructor(options) {\n const crossOrigin =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n const /** @type {import(\"../Image.js\").LoadFunction} */ imageLoadFunction =\n options.imageLoadFunction !== undefined\n ? options.imageLoadFunction\n : defaultImageLoadFunction;\n\n super({\n attributions: options.attributions,\n interpolate: options.interpolate,\n projection: getProjection(options.projection),\n });\n\n /**\n * @private\n * @type {string}\n */\n this.url_ = options.url;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.imageExtent_ = options.imageExtent;\n\n /**\n * @private\n * @type {import(\"../Image.js\").default}\n */\n this.image = null;\n\n this.image = new ImageWrapper(\n this.imageExtent_,\n undefined,\n 1,\n createLoader({\n url: options.url,\n imageExtent: options.imageExtent,\n crossOrigin,\n load: (image, src) => {\n this.image.setImage(image);\n imageLoadFunction(this.image, src);\n return decode(image);\n },\n }),\n );\n\n this.image.addEventListener(\n EventType.CHANGE,\n this.handleImageChange.bind(this),\n );\n }\n\n /**\n * Returns the image extent\n * @return {import(\"../extent.js\").Extent} image extent.\n * @api\n */\n getImageExtent() {\n return this.imageExtent_;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../Image.js\").default} Single image.\n * @override\n */\n getImageInternal(extent, resolution, pixelRatio, projection) {\n if (intersects(extent, this.image.getExtent())) {\n return this.image;\n }\n return null;\n }\n\n /**\n * Return the URL used for this image source.\n * @return {string} URL.\n * @api\n */\n getUrl() {\n return this.url_;\n }\n}\n\nexport default Static;\n","/**\n * @module ol/source/ImageWMS\n */\n\nimport {decode} from '../Image.js';\nimport {get as getProjection, transform} from '../proj.js';\nimport {calculateSourceResolution} from '../reproj.js';\nimport ImageSource, {defaultImageLoadFunction} from './Image.js';\nimport {createLoader, getFeatureInfoUrl, getLegendUrl} from './wms.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting\n * the image from the remote server.\n * @property {import(\"./wms.js\").ServerType} [serverType] The type of\n * the remote WMS server: `mapserver`, `geoserver`, `carmentaserver`, or `qgis`.\n * Only needed if `hidpi` is `true`.\n * @property {import(\"../Image.js\").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {Object<string,*>} [params] WMS request parameters.\n * At least a `LAYERS` param is required. `STYLES` is\n * `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`\n * and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means\n * twice the width and height of the map viewport, and so on. Must be `1` or higher.\n * @property {Array<number>} [resolutions] Resolutions.\n * If specified, requests will be made for these resolutions only.\n * @property {string} [url] WMS service URL.\n */\n\n/**\n * @classdesc\n * Source for WMS servers providing single, untiled images.\n *\n * @fires module:ol/source/Image.ImageSourceEvent\n * @api\n */\nclass ImageWMS extends ImageSource {\n /**\n * @param {Options} [options] ImageWMS options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n attributions: options.attributions,\n interpolate: options.interpolate,\n projection: options.projection,\n resolutions: options.resolutions,\n });\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ =\n options.crossOrigin !== undefined ? options.crossOrigin : null;\n\n /**\n * @private\n * @type {string|undefined}\n */\n this.url_ = options.url;\n\n /**\n * @private\n * @type {import(\"../Image.js\").LoadFunction}\n */\n this.imageLoadFunction_ =\n options.imageLoadFunction !== undefined\n ? options.imageLoadFunction\n : defaultImageLoadFunction;\n\n /**\n * @private\n * @type {!Object}\n */\n this.params_ = Object.assign({}, options.params);\n\n /**\n * @private\n * @type {import(\"./wms.js\").ServerType}\n */\n this.serverType_ = options.serverType;\n\n /**\n * @private\n * @type {boolean}\n */\n this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;\n\n /**\n * @private\n * @type {number}\n */\n this.renderedRevision_ = 0;\n\n /**\n * @private\n * @type {number}\n */\n this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5;\n\n /**\n * @private\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.loaderProjection_ = null;\n }\n\n /**\n * Return the GetFeatureInfo URL for the passed coordinate, resolution, and\n * projection. Return `undefined` if the GetFeatureInfo URL cannot be\n * constructed.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {import(\"../proj.js\").ProjectionLike} projection Projection.\n * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should\n * be provided. If `QUERY_LAYERS` is not provided then the layers specified\n * in the `LAYERS` parameter will be used. `VERSION` should not be\n * specified here.\n * @return {string|undefined} GetFeatureInfo URL.\n * @api\n */\n getFeatureInfoUrl(coordinate, resolution, projection, params) {\n const projectionObj = getProjection(projection);\n const sourceProjectionObj = this.getProjection();\n\n if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {\n resolution = calculateSourceResolution(\n sourceProjectionObj,\n projectionObj,\n coordinate,\n resolution,\n );\n coordinate = transform(coordinate, projectionObj, sourceProjectionObj);\n }\n\n const options = {\n url: this.url_,\n params: {\n ...this.params_,\n ...params,\n },\n projection: sourceProjectionObj || projectionObj,\n };\n return getFeatureInfoUrl(options, coordinate, resolution);\n }\n\n /**\n * Return the GetLegendGraphic URL, optionally optimized for the passed\n * resolution and possibly including any passed specific parameters. Returns\n * `undefined` if the GetLegendGraphic URL cannot be constructed.\n *\n * @param {number} [resolution] Resolution. If set to undefined, `SCALE`\n * will not be calculated and included in URL.\n * @param {Object} [params] GetLegendGraphic params. If `LAYER` is set, the\n * request is generated for this wms layer, else it will try to use the\n * configured wms layer. Default `FORMAT` is `image/png`.\n * `VERSION` should not be specified here.\n * @return {string|undefined} GetLegendGraphic URL.\n * @api\n */\n getLegendUrl(resolution, params) {\n return getLegendUrl(\n {\n url: this.url_,\n params: {\n ...this.params_,\n ...params,\n },\n },\n resolution,\n );\n }\n\n /**\n * Get the user-provided params, i.e. those passed to the constructor through\n * the \"params\" option, and possibly updated using the updateParams method.\n * @return {Object} Params.\n * @api\n */\n getParams() {\n return this.params_;\n }\n\n /**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {import(\"../Image.js\").default} Single image.\n * @override\n */\n getImageInternal(extent, resolution, pixelRatio, projection) {\n if (this.url_ === undefined) {\n return null;\n }\n if (!this.loader || this.loaderProjection_ !== projection) {\n // Lazily create loader to pick up the view projection and to allow `params` updates\n this.loaderProjection_ = projection;\n this.loader = createLoader({\n crossOrigin: this.crossOrigin_,\n params: this.params_,\n projection: projection,\n serverType: this.serverType_,\n hidpi: this.hidpi_,\n url: this.url_,\n ratio: this.ratio_,\n load: (image, src) => {\n this.image.setImage(image);\n this.imageLoadFunction_(this.image, src);\n return decode(image);\n },\n });\n }\n\n return super.getImageInternal(extent, resolution, pixelRatio, projection);\n }\n\n /**\n * Return the image load function of the source.\n * @return {import(\"../Image.js\").LoadFunction} The image load function.\n * @api\n */\n getImageLoadFunction() {\n return this.imageLoadFunction_;\n }\n\n /**\n * Return the URL used for this WMS source.\n * @return {string|undefined} URL.\n * @api\n */\n getUrl() {\n return this.url_;\n }\n\n /**\n * Set the image load function of the source.\n * @param {import(\"../Image.js\").LoadFunction} imageLoadFunction Image load function.\n * @api\n */\n setImageLoadFunction(imageLoadFunction) {\n this.imageLoadFunction_ = imageLoadFunction;\n this.changed();\n }\n\n /**\n * Set the URL to use for requests.\n * @param {string|undefined} url URL.\n * @api\n */\n setUrl(url) {\n if (url != this.url_) {\n this.url_ = url;\n this.loader = null;\n this.changed();\n }\n }\n\n /**\n * Set the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n setParams(params) {\n this.params_ = Object.assign({}, params);\n this.changed();\n }\n\n /**\n * Update the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n updateParams(params) {\n Object.assign(this.params_, params);\n this.changed();\n }\n\n /**\n * @override\n */\n changed() {\n this.image = null;\n super.changed();\n }\n}\n\nexport default ImageWMS;\n","/**\n * @module ol/source/OGCMapTile\n */\nimport {error as logError} from '../console.js';\nimport TileImage from './TileImage.js';\nimport {getTileSetInfo} from './ogcTileUtil.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} url URL to the OGC Map Tileset endpoint.\n * @property {Object} [context] A lookup of values to use in the tile URL template. The `{tileMatrix}`\n * (zoom level), `{tileRow}`, and `{tileCol}` variables in the URL will always be provided by the source.\n * @property {string} [mediaType] The content type for the tiles (e.g. \"image/png\"). If not provided,\n * the source will try to find a link with rel=\"item\" that uses a supported image type.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. By default, the projection\n * will be derived from the `crs` of the `tileMatrixSet`. You can override this by supplying\n * a projection to the constructor.\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(tile, src) {\n * tile.getImage().src = src;\n * };\n * ```\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {Array<string>} [collections] A list of geospatial data sub-resources to include. If not provided, the entire dataset will\n * be included. This option is not applicable when requesting the tileset for a single collection.\n */\n\n/**\n * @classdesc\n * Layer source for map tiles from an [OGC API - Tiles](https://ogcapi.ogc.org/tiles/) service that provides \"map\" type tiles.\n * The service must conform to at least the core (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core)\n * and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes. For supporting the `collections`\n * option, the service must conform to the collections selection\n * (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection) conformance class.\n * @api\n */\nclass OGCMapTile extends TileImage {\n /**\n * @param {Options} options OGC map tile options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n interpolate: options.interpolate,\n projection: options.projection,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n state: 'loading',\n tileLoadFunction: options.tileLoadFunction,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n });\n\n const sourceInfo = {\n url: options.url,\n projection: this.getProjection(),\n mediaType: options.mediaType,\n context: options.context || null,\n collections: options.collections,\n };\n\n getTileSetInfo(sourceInfo)\n .then(this.handleTileSetInfo_.bind(this))\n .catch(this.handleError_.bind(this));\n }\n\n /**\n * @param {import(\"./ogcTileUtil.js\").TileSetInfo} tileSetInfo Tile set info.\n * @private\n */\n handleTileSetInfo_(tileSetInfo) {\n this.tileGrid = tileSetInfo.grid;\n this.projection = tileSetInfo.projection;\n this.setTileUrlFunction(tileSetInfo.urlFunction, tileSetInfo.urlTemplate);\n this.setState('ready');\n }\n\n /**\n * @private\n * @param {Error} error The error.\n */\n handleError_(error) {\n logError(error);\n this.setState('error');\n }\n}\n\nexport default OGCMapTile;\n","/**\n * @module ol/source/OGCVectorTile\n */\n\nimport {error as logError} from '../console.js';\nimport VectorTileSource from './VectorTile.js';\nimport {getTileSetInfo} from './ogcTileUtil.js';\n\n/**\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../render/Feature.js\").default]\n * @typedef {Object} Options\n * @property {string} url URL to the OGC Vector Tileset endpoint.\n * @property {Object} [context] A lookup of values to use in the tile URL template. The `{tileMatrix}`\n * (zoom level), `{tileRow}`, and `{tileCol}` variables in the URL will always be provided by the source.\n * @property {import(\"../format/Feature.js\").default<FeatureType>} [format] Feature format for tiles. Used and required by the default.\n * @property {string} [mediaType] The content type for the tiles (e.g. \"application/vnd.mapbox-vector-tile\"). If not provided,\n * the source will try to find a link with rel=\"item\" that uses a vector type supported by the configured format.\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this\n * to `false` (e.g. for sources with polygons that represent administrative\n * boundaries or TopoJSON sources) allows the renderer to optimise fill and\n * stroke operations.\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Projection of the tile grid.\n * @property {typeof import(\"../VectorTile.js\").default} [tileClass] Class used to instantiate image tiles.\n * Default is {@link module:ol/VectorTile~VectorTile}.\n * @property {number} [transition] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * When set to `false`, only one world\n * will be rendered. When set to `true`, tiles will be wrapped horizontally to\n * render multiple worlds.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=1]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n * @property {Array<string>} [collections] A list of geospatial data sub-resources to include. If not provided, the entire dataset will\n * be included. This option is not applicable when requesting the tileset for a single collection.\n */\n\n/**\n * @classdesc\n * Layer source for map tiles from an [OGC API - Tiles](https://ogcapi.ogc.org/tiles/) service that provides \"vector\" type tiles.\n * The service must conform to at least the core (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core)\n * and tileset (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset) conformance classes. For supporting the `collections`\n * option, the service must conform to the collections selection\n * (http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection) conformance class.\n *\n * Vector tile sets may come in a variety of formats (e.g. GeoJSON, MVT). The `format` option is used to determine\n * which of the advertised media types is used. If you need to force the use of a particular media type, you can\n * provide the `mediaType` option.\n * @api\n * @template {import(\"../Feature.js\").FeatureLike} [FeatureType=import(\"../render/Feature.js\").default]\n * @extends {VectorTileSource<FeatureType>}\n */\nclass OGCVectorTile extends VectorTileSource {\n /**\n * @param {Options<FeatureType>} options OGC vector tile options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n cacheSize: options.cacheSize,\n format: options.format,\n overlaps: options.overlaps,\n projection: options.projection,\n tileClass: options.tileClass,\n transition: options.transition,\n wrapX: options.wrapX,\n zDirection: options.zDirection,\n state: 'loading',\n });\n\n const sourceInfo = {\n url: options.url,\n projection: this.getProjection(),\n mediaType: options.mediaType,\n supportedMediaTypes: options.format.supportedMediaTypes,\n context: options.context || null,\n collections: options.collections,\n };\n\n getTileSetInfo(sourceInfo)\n .then(this.handleTileSetInfo_.bind(this))\n .catch(this.handleError_.bind(this));\n }\n\n /**\n * @param {import(\"./ogcTileUtil.js\").TileSetInfo} tileSetInfo Tile set info.\n * @private\n */\n handleTileSetInfo_(tileSetInfo) {\n this.tileGrid = tileSetInfo.grid;\n this.projection = tileSetInfo.projection;\n this.setTileUrlFunction(tileSetInfo.urlFunction, tileSetInfo.urlTemplate);\n this.setState('ready');\n }\n\n /**\n * @private\n * @param {Error} error The error.\n */\n handleError_(error) {\n logError(error);\n this.setState('error');\n }\n}\n\nexport default OGCVectorTile;\n","/**\n * @module ol/source/TileArcGISRest\n */\n\nimport {createEmpty} from '../extent.js';\nimport {modulo} from '../math.js';\nimport {scale as scaleSize, toSize} from '../size.js';\nimport {hash as tileCoordHash} from '../tilecoord.js';\nimport TileImage from './TileImage.js';\nimport {getRequestUrl} from './arcgisRest.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {Object<string,*>} [params] ArcGIS Rest parameters. This field is optional. Service defaults will be\n * used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is `IMAGE` by\n * default. `TRANSPARENT` is `true` by default. `BBOX`, `SIZE`, `BBOXSR`,\n * and `IMAGESR` will be set dynamically. Set `LAYERS` to\n * override the default service layer visibility. See\n * https://developers.arcgis.com/rest/services-reference/export-map.htm\n * for further reference.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting\n * the image from the remote server.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid. Base this on the resolutions,\n * tilesize and extent supported by the server.\n * If this is not defined, a default grid will be used: if there is a projection\n * extent, the grid will be based on that; if not, a grid based on a global\n * extent with origin at 0,0 will be used.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * The projection code must contain a numeric end portion separated by :\n * or the entire code must form a valid ArcGIS SpatialReference definition.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL.\n * The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {string} [url] ArcGIS Rest service URL for a Map Service or Image Service. The\n * url should include /MapServer or /ImageServer.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering. To disable the opacity\n * transition, pass `transition: 0`.\n * @property {Array<string>} [urls] ArcGIS Rest service urls. Use this instead of `url` when the ArcGIS\n * Service supports multiple urls for export requests.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for tile data from ArcGIS Rest services. Map and Image\n * Services are supported.\n *\n * For cached ArcGIS services, better performance is available using the\n * {@link module:ol/source/XYZ~XYZ} data source.\n * @api\n */\nclass TileArcGISRest extends TileImage {\n /**\n * @param {Options} [options] Tile ArcGIS Rest options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n interpolate: options.interpolate,\n projection: options.projection,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileGrid: options.tileGrid,\n tileLoadFunction: options.tileLoadFunction,\n url: options.url,\n urls: options.urls,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {!Object}\n */\n this.params_ = Object.assign({}, options.params);\n\n /**\n * @private\n * @type {boolean}\n */\n this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.tmpExtent_ = createEmpty();\n\n this.setKey(this.getKeyForParams_());\n }\n\n /**\n * @private\n * @return {string} The key for the current params.\n */\n getKeyForParams_() {\n let i = 0;\n const res = [];\n for (const key in this.params_) {\n res[i++] = key + '-' + this.params_[key];\n }\n return res.join('/');\n }\n\n /**\n * Get the user-provided params, i.e. those passed to the constructor through\n * the \"params\" option, and possibly updated using the updateParams method.\n * @return {Object} Params.\n * @api\n */\n getParams() {\n return this.params_;\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../size.js\").Size} tileSize Tile size.\n * @param {import(\"../extent.js\").Extent} tileExtent Tile extent.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {Object} params Params.\n * @return {string|undefined} Request URL.\n * @private\n */\n getRequestUrl_(\n tileCoord,\n tileSize,\n tileExtent,\n pixelRatio,\n projection,\n params,\n ) {\n const urls = this.urls;\n if (!urls) {\n return undefined;\n }\n let url;\n if (urls.length == 1) {\n url = urls[0];\n } else {\n const index = modulo(tileCoordHash(tileCoord), urls.length);\n url = urls[index];\n }\n\n return getRequestUrl(\n url,\n tileExtent,\n (\n this.tileGrid || this.getTileGridForProjection(projection)\n ).getResolution(tileCoord[0]),\n pixelRatio,\n projection,\n params,\n );\n }\n\n /**\n * Get the tile pixel ratio for this source.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Tile pixel ratio.\n * @override\n */\n getTilePixelRatio(pixelRatio) {\n return this.hidpi_ ? pixelRatio : 1;\n }\n\n /**\n * Set the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n setParams(params) {\n this.params_ = Object.assign({}, params);\n this.setKey(this.getKeyForParams_());\n }\n\n /**\n * Update the user-provided params.\n * @param {Object} params Params.\n * @api\n */\n updateParams(params) {\n Object.assign(this.params_, params);\n this.setKey(this.getKeyForParams_());\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord The tile coordinate\n * @param {number} pixelRatio The pixel ratio\n * @param {import(\"../proj/Projection.js\").default} projection The projection\n * @return {string|undefined} The tile URL\n * @override\n */\n tileUrlFunction(tileCoord, pixelRatio, projection) {\n let tileGrid = this.getTileGrid();\n if (!tileGrid) {\n tileGrid = this.getTileGridForProjection(projection);\n }\n\n if (tileGrid.getResolutions().length <= tileCoord[0]) {\n return undefined;\n }\n\n if (pixelRatio != 1 && !this.hidpi_) {\n pixelRatio = 1;\n }\n\n const tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);\n let tileSize = toSize(tileGrid.getTileSize(tileCoord[0]), this.tmpSize);\n\n if (pixelRatio != 1) {\n tileSize = scaleSize(tileSize, pixelRatio, this.tmpSize);\n }\n\n // Apply default params and override with user specified values.\n const baseParams = {\n 'F': 'image',\n 'FORMAT': 'PNG32',\n 'TRANSPARENT': true,\n };\n Object.assign(baseParams, this.params_);\n\n return this.getRequestUrl_(\n tileCoord,\n tileSize,\n tileExtent,\n pixelRatio,\n projection,\n baseParams,\n );\n }\n}\n\nexport default TileArcGISRest;\n","/**\n * @module ol/source/TileDebug\n */\n\nimport {createCanvasContext2D} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {get as getProjection} from '../proj.js';\nimport {toSize} from '../size.js';\nimport {renderXYZTemplate} from '../uri.js';\nimport DataTile from './DataTile.js';\nimport ImageTile from './ImageTile.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../proj.js\").ProjectionLike} [projection='EPSG:3857'] Optional projection.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Set to `1` when debugging `VectorTile` sources with a default configuration.\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n * @property {import(\"./Tile.js\").default} [source] Tile source.\n * This allows `projection`, `tileGrid`, `wrapX` and `zDirection` to be copied from another source.\n * If both `source` and individual options are specified the individual options will have precedence.\n * @property {string} [template='z:{z} x:{x} y:{y}'] Template for labeling the tiles.\n * Should include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.\n * @property {string} [color='grey'] CSS color to fill text and stroke grid lines of each tile.\n */\n\n/**\n * @classdesc\n * A pseudo tile source, which does not fetch tiles from a server, but renders\n * a grid outline for the tile grid/projection along with the coordinates for\n * each tile. See examples/canvas-tiles for an example.\n * @api\n */\nclass TileDebug extends ImageTile {\n /**\n * @param {Options} [options] Debug tile options.\n */\n constructor(options) {\n /**\n * @type {Options}\n */\n options = options || {};\n const template = options.template || 'z:{z} x:{x} y:{y}';\n const source = options.source;\n const color = options.color || 'grey';\n\n super({\n transition: 0,\n wrapX:\n options.wrapX !== undefined\n ? options.wrapX\n : source !== undefined\n ? source.getWrapX()\n : undefined,\n });\n\n const setReady = () => {\n this.projection =\n options.projection !== undefined\n ? getProjection(options.projection)\n : source !== undefined\n ? source.getProjection()\n : this.projection;\n this.tileGrid =\n options.tileGrid !== undefined\n ? options.tileGrid\n : source !== undefined\n ? source.getTileGrid()\n : this.tileGrid;\n this.zDirection =\n options.zDirection !== undefined\n ? options.zDirection\n : source !== undefined\n ? source.zDirection\n : this.zDirection;\n\n if (source instanceof DataTile) {\n this.transformMatrix = source.transformMatrix?.slice() || null;\n }\n\n const tileGrid = this.tileGrid;\n if (tileGrid) {\n this.setTileSizes(\n tileGrid\n .getResolutions()\n .map((r, i) =>\n toSize(tileGrid.getTileSize(i)).map((s) =>\n Math.max(Math.floor(s), 1),\n ),\n ),\n );\n }\n\n this.setLoader((z, x, y, loaderOptions) => {\n const text = renderXYZTemplate(template, z, x, y, loaderOptions.maxY);\n const [width, height] = this.getTileSize(z);\n const context = createCanvasContext2D(width, height);\n\n context.strokeStyle = color;\n context.strokeRect(0.5, 0.5, width + 0.5, height + 0.5);\n\n context.fillStyle = color;\n context.strokeStyle = 'white';\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n context.font = '24px sans-serif';\n context.lineWidth = 4;\n context.strokeText(text, width / 2, height / 2, width);\n context.fillText(text, width / 2, height / 2, width);\n // make the loader aysnc, so it behaves like other sources that fetch data from a remote server\n return Promise.resolve(context.canvas);\n });\n this.setState('ready');\n };\n\n if (source === undefined || source.getState() === 'ready') {\n setReady();\n } else {\n const handler = () => {\n if (source.getState() === 'ready') {\n source.removeEventListener(EventType.CHANGE, handler);\n setReady();\n }\n };\n source.addEventListener(EventType.CHANGE, handler);\n }\n }\n}\n\nexport default TileDebug;\n","/**\n * @module ol/source/TileJSON\n */\n// FIXME check order of async callbacks\n\n/**\n * See https://mapbox.com/developers/api/.\n */\n\nimport {applyTransform, intersects} from '../extent.js';\nimport {jsonp as requestJSONP} from '../net.js';\nimport {get as getProjection, getTransformFromProjections} from '../proj.js';\nimport {createXYZ, extentFromProjection} from '../tilegrid.js';\nimport {createFromTemplates} from '../tileurlfunction.js';\nimport TileImage from './TileImage.js';\n\n/**\n * @typedef {Object} Config\n * @property {string} [name] The name.\n * @property {string} [description] The description.\n * @property {string} [version] The version.\n * @property {string} [attribution] The attribution.\n * @property {string} [template] The template.\n * @property {string} [legend] The legend.\n * @property {string} [scheme] The scheme.\n * @property {Array<string>} tiles The tile URL templates.\n * @property {Array<string>} [grids] Optional grids.\n * @property {number} [minzoom] Minimum zoom level.\n * @property {number} [maxzoom] Maximum zoom level.\n * @property {Array<number>} [bounds] Optional bounds.\n * @property {Array<number>} [center] Optional center.\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON.\n * Useful when the server does not support CORS..\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {Config} [tileJSON] TileJSON configuration for this source.\n * If not provided, `url` must be configured.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {number|import(\"../size.js\").Size} [tileSize=[256, 256]] The tile size used by the tile service.\n * Note: `tileSize` and other non-standard TileJSON properties are currently ignored.\n * @property {string} [url] URL to the TileJSON file. If not provided, `tileJSON` must be configured.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for tile data in TileJSON format.\n * @api\n */\nclass TileJSON extends TileImage {\n /**\n * @param {Options} options TileJSON options.\n */\n constructor(options) {\n super({\n attributions: options.attributions,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n interpolate: options.interpolate,\n projection: getProjection('EPSG:3857'),\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n state: 'loading',\n tileLoadFunction: options.tileLoadFunction,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n zDirection: options.zDirection,\n });\n\n /**\n * @type {Config}\n * @private\n */\n this.tileJSON_ = null;\n\n /**\n * @type {number|import(\"../size.js\").Size}\n * @private\n */\n this.tileSize_ = options.tileSize;\n\n if (options.url) {\n if (options.jsonp) {\n requestJSONP(\n options.url,\n this.handleTileJSONResponse.bind(this),\n this.handleTileJSONError.bind(this),\n );\n } else {\n const client = new XMLHttpRequest();\n client.addEventListener('load', this.onXHRLoad_.bind(this));\n client.addEventListener('error', this.onXHRError_.bind(this));\n client.open('GET', options.url);\n client.send();\n }\n } else if (options.tileJSON) {\n this.handleTileJSONResponse(options.tileJSON);\n } else {\n throw new Error('Either `url` or `tileJSON` options must be provided');\n }\n }\n\n /**\n * @private\n * @param {Event} event The load event.\n */\n onXHRLoad_(event) {\n const client = /** @type {XMLHttpRequest} */ (event.target);\n // status will be 0 for file:// urls\n if (!client.status || (client.status >= 200 && client.status < 300)) {\n let response;\n try {\n response = /** @type {Config} */ (JSON.parse(client.responseText));\n } catch {\n this.handleTileJSONError();\n return;\n }\n this.handleTileJSONResponse(response);\n } else {\n this.handleTileJSONError();\n }\n }\n\n /**\n * @private\n * @param {Event} event The error event.\n */\n onXHRError_(event) {\n this.handleTileJSONError();\n }\n\n /**\n * @return {Config} The tilejson object.\n * @api\n */\n getTileJSON() {\n return this.tileJSON_;\n }\n\n /**\n * @protected\n * @param {Config} tileJSON Tile JSON.\n */\n handleTileJSONResponse(tileJSON) {\n const epsg4326Projection = getProjection('EPSG:4326');\n\n const sourceProjection = this.getProjection();\n let extent;\n if (tileJSON['bounds'] !== undefined) {\n const transform = getTransformFromProjections(\n epsg4326Projection,\n sourceProjection,\n );\n extent = applyTransform(tileJSON['bounds'], transform);\n }\n\n const gridExtent = extentFromProjection(sourceProjection);\n const minZoom = tileJSON['minzoom'] || 0;\n const maxZoom = tileJSON['maxzoom'] || 22;\n const tileGrid = createXYZ({\n extent: gridExtent,\n maxZoom: maxZoom,\n minZoom: minZoom,\n tileSize: this.tileSize_,\n });\n this.tileGrid = tileGrid;\n\n this.tileUrlFunction = createFromTemplates(tileJSON['tiles'], tileGrid);\n\n if (tileJSON['attribution'] && !this.getAttributions()) {\n const attributionExtent = extent !== undefined ? extent : gridExtent;\n this.setAttributions(function (frameState) {\n if (intersects(attributionExtent, frameState.extent)) {\n return [tileJSON['attribution']];\n }\n return null;\n });\n }\n this.tileJSON_ = tileJSON;\n this.setState('ready');\n }\n\n /**\n * @protected\n */\n handleTileJSONError() {\n this.setState('error');\n }\n}\n\nexport default TileJSON;\n","/**\n * @module ol/source/TileWMS\n */\n\nimport {buffer, createEmpty} from '../extent.js';\nimport {modulo} from '../math.js';\nimport {get as getProjection, transform} from '../proj.js';\nimport {calculateSourceResolution} from '../reproj.js';\nimport {compareVersions} from '../string.js';\nimport {hash as tileCoordHash} from '../tilecoord.js';\nimport {appendParams} from '../uri.js';\nimport TileImage from './TileImage.js';\nimport {DEFAULT_VERSION, getImageSrc, getRequestParams} from './wms.js';\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {Object<string,*>} params WMS request parameters.\n * At least a `LAYERS` param is required. `STYLES` is\n * `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`\n * and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.\n * @property {number} [gutter=0]\n * The size in pixels of the gutter around image tiles to ignore. By setting\n * this property to a non-zero value, images will be requested that are wider\n * and taller than the tile size by a value of `2 x gutter`.\n * Using a non-zero value allows artifacts of rendering at tile edges to be\n * ignored. If you control the WMS service it is recommended to address\n * \"artifacts at tile edges\" issues by properly configuring the WMS service. For\n * example, MapServer has a `tile_map_edge_buffer` configuration parameter for\n * this. See https://mapserver.org/output/tile_mode.html.\n * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting\n * the image from the remote server.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {typeof import(\"../ImageTile.js\").default} [tileClass] Class used to instantiate image tiles.\n * Default is {@link module:ol/ImageTile~ImageTile}.\n * @property {import(\"../tilegrid/TileGrid.js\").default} [tileGrid] Tile grid. Base this on the resolutions,\n * tilesize and extent supported by the server.\n * If this is not defined, a default grid will be used: if there is a projection\n * extent, the grid will be based on that; if not, a grid based on a global\n * extent with origin at 0,0 will be used.\n * @property {import(\"./wms.js\").ServerType} [serverType] The type of\n * the remote WMS server: `mapserver`, `geoserver`, `carmentaserver`, or `qgis`.\n * Only needed if `hidpi` is `true`.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {string} [url] WMS service URL.\n * @property {Array<string>} [urls] WMS service urls.\n * Use this instead of `url` when the WMS supports multiple urls for GetMap requests.\n * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.\n * When set to `false`, only one world\n * will be rendered. When `true`, tiles will be requested for one world only,\n * but they will be wrapped horizontally to render multiple worlds.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for tile data from WMS servers.\n * @api\n */\nclass TileWMS extends TileImage {\n /**\n * @param {Options} [options] Tile WMS options.\n */\n constructor(options) {\n options = options ? options : /** @type {Options} */ ({});\n\n const params = Object.assign({}, options.params);\n\n super({\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n interpolate: options.interpolate,\n projection: options.projection,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileClass: options.tileClass,\n tileGrid: options.tileGrid,\n tileLoadFunction: options.tileLoadFunction,\n url: options.url,\n urls: options.urls,\n wrapX: options.wrapX !== undefined ? options.wrapX : true,\n transition: options.transition,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {number}\n */\n this.gutter_ = options.gutter !== undefined ? options.gutter : 0;\n\n /**\n * @private\n * @type {!Object}\n */\n this.params_ = params;\n\n /**\n * @private\n * @type {boolean}\n */\n this.v13_ = true;\n\n /**\n * @private\n * @type {import(\"./wms.js\").ServerType}\n */\n this.serverType_ = options.serverType;\n\n /**\n * @private\n * @type {boolean}\n */\n this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent}\n */\n this.tmpExtent_ = createEmpty();\n\n this.updateV13_();\n this.setKey(this.getKeyForParams_());\n }\n\n /**\n * Return the GetFeatureInfo URL for the passed coordinate, resolution, and\n * projection. Return `undefined` if the GetFeatureInfo URL cannot be\n * constructed.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {number} resolution Resolution.\n * @param {import(\"../proj.js\").ProjectionLike} projection Projection.\n * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should\n * be provided. If `QUERY_LAYERS` is not provided then the layers specified\n * in the `LAYERS` parameter will be used. `VERSION` should not be\n * specified here.\n * @return {string|undefined} GetFeatureInfo URL.\n * @api\n */\n getFeatureInfoUrl(coordinate, resolution, projection, params) {\n const projectionObj = getProjection(projection);\n const sourceProjectionObj = this.getProjection() || projectionObj;\n\n let tileGrid = this.getTileGrid();\n if (!tileGrid) {\n tileGrid = this.getTileGridForProjection(sourceProjectionObj);\n }\n\n const sourceProjCoord = transform(\n coordinate,\n projectionObj,\n sourceProjectionObj,\n );\n const sourceResolution = calculateSourceResolution(\n sourceProjectionObj,\n projectionObj,\n coordinate,\n resolution,\n );\n\n const z = tileGrid.getZForResolution(sourceResolution, this.zDirection);\n const tileResolution = tileGrid.getResolution(z);\n const tileCoord = tileGrid.getTileCoordForCoordAndZ(sourceProjCoord, z);\n\n if (tileGrid.getResolutions().length <= tileCoord[0]) {\n return undefined;\n }\n\n let tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);\n\n const gutter = this.gutter_;\n if (gutter !== 0) {\n tileExtent = buffer(tileExtent, tileResolution * gutter, tileExtent);\n }\n\n const baseParams = {\n 'QUERY_LAYERS': this.params_['LAYERS'],\n };\n Object.assign(\n baseParams,\n getRequestParams(this.params_, 'GetFeatureInfo'),\n params,\n );\n\n const x = Math.floor((sourceProjCoord[0] - tileExtent[0]) / tileResolution);\n const y = Math.floor((tileExtent[3] - sourceProjCoord[1]) / tileResolution);\n\n baseParams[this.v13_ ? 'I' : 'X'] = x;\n baseParams[this.v13_ ? 'J' : 'Y'] = y;\n\n return this.getRequestUrl_(\n tileCoord,\n tileExtent,\n 1,\n sourceProjectionObj || projectionObj,\n baseParams,\n );\n }\n\n /**\n * Return the GetLegendGraphic URL, optionally optimized for the passed\n * resolution and possibly including any passed specific parameters. Returns\n * `undefined` if the GetLegendGraphic URL cannot be constructed.\n *\n * @param {number} [resolution] Resolution. If set to undefined, `SCALE`\n * will not be calculated and included in URL.\n * @param {Object} [params] GetLegendGraphic params. If `LAYER` is set, the\n * request is generated for this wms layer, else it will try to use the\n * configured wms layer. Default `FORMAT` is `image/png`.\n * `VERSION` should not be specified here.\n * @return {string|undefined} GetLegendGraphic URL.\n * @api\n */\n getLegendUrl(resolution, params) {\n if (this.urls[0] === undefined) {\n return undefined;\n }\n\n const baseParams = {\n 'SERVICE': 'WMS',\n 'VERSION': DEFAULT_VERSION,\n 'REQUEST': 'GetLegendGraphic',\n 'FORMAT': 'image/png',\n };\n\n if (params === undefined || params['LAYER'] === undefined) {\n const layers = this.params_.LAYERS;\n const isSingleLayer = !Array.isArray(layers) || layers.length === 1;\n if (!isSingleLayer) {\n return undefined;\n }\n baseParams['LAYER'] = layers;\n }\n\n if (resolution !== undefined) {\n const mpu = this.getProjection()\n ? this.getProjection().getMetersPerUnit()\n : 1;\n const pixelSize = 0.00028;\n baseParams['SCALE'] = (resolution * mpu) / pixelSize;\n }\n\n Object.assign(baseParams, params);\n\n return appendParams(/** @type {string} */ (this.urls[0]), baseParams);\n }\n\n /**\n * @return {number} Gutter.\n * @override\n */\n getGutter() {\n return this.gutter_;\n }\n\n /**\n * Get the user-provided params, i.e. those passed to the constructor through\n * the \"params\" option, and possibly updated using the updateParams method.\n * @return {Object} Params.\n * @api\n */\n getParams() {\n return this.params_;\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"../extent.js\").Extent} tileExtent Tile extent.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @param {Object} params Params.\n * @return {string|undefined} Request URL.\n * @private\n */\n getRequestUrl_(tileCoord, tileExtent, pixelRatio, projection, params) {\n const urls = this.urls;\n if (!urls) {\n return undefined;\n }\n let url;\n if (urls.length == 1) {\n url = urls[0];\n } else {\n const index = modulo(tileCoordHash(tileCoord), urls.length);\n url = urls[index];\n }\n\n return getImageSrc(\n tileExtent,\n (\n this.tileGrid || this.getTileGridForProjection(projection)\n ).getResolution(tileCoord[0]),\n pixelRatio,\n projection,\n url,\n params,\n this.serverType_,\n );\n }\n\n /**\n * Get the tile pixel ratio for this source.\n * @param {number} pixelRatio Pixel ratio.\n * @return {number} Tile pixel ratio.\n * @override\n */\n getTilePixelRatio(pixelRatio) {\n return !this.hidpi_ || this.serverType_ === undefined ? 1 : pixelRatio;\n }\n\n /**\n * @private\n * @return {string} The key for the current params.\n */\n getKeyForParams_() {\n let i = 0;\n const res = [];\n for (const key in this.params_) {\n res[i++] = key + '-' + this.params_[key];\n }\n return res.join('/');\n }\n\n /**\n * @param {Object} params New URL paremeters.\n * @private\n */\n setParams_(params) {\n this.params_ = params;\n this.updateV13_();\n this.setKey(this.getKeyForParams_());\n }\n\n /**\n * Set the URL parameters passed to the WMS source.\n * @param {Object} params New URL paremeters.\n * @api\n */\n setParams(params) {\n this.setParams_(Object.assign({}, params));\n }\n\n /**\n * Update the URL parameters. This method can be used to update a subset of the WMS\n * parameters. Call `setParams` to set all of the parameters.\n * @param {Object} params Updated URL parameters.\n * @api\n */\n updateParams(params) {\n this.setParams_(Object.assign(this.params_, params));\n }\n\n /**\n * @private\n */\n updateV13_() {\n const version = this.params_['VERSION'] || DEFAULT_VERSION;\n this.v13_ = compareVersions(version, '1.3') >= 0;\n }\n\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord The tile coordinate\n * @param {number} pixelRatio The pixel ratio\n * @param {import(\"../proj/Projection.js\").default} projection The projection\n * @return {string|undefined} The tile URL\n * @override\n */\n tileUrlFunction(tileCoord, pixelRatio, projection) {\n let tileGrid = this.getTileGrid();\n if (!tileGrid) {\n tileGrid = this.getTileGridForProjection(projection);\n }\n\n if (tileGrid.getResolutions().length <= tileCoord[0]) {\n return undefined;\n }\n\n if (pixelRatio != 1 && (!this.hidpi_ || this.serverType_ === undefined)) {\n pixelRatio = 1;\n }\n\n const tileResolution = tileGrid.getResolution(tileCoord[0]);\n let tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);\n\n const gutter = this.gutter_;\n if (gutter !== 0) {\n tileExtent = buffer(tileExtent, tileResolution * gutter, tileExtent);\n }\n\n const baseParams = Object.assign(\n {},\n getRequestParams(this.params_, 'GetMap'),\n );\n\n return this.getRequestUrl_(\n tileCoord,\n tileExtent,\n pixelRatio,\n projection,\n baseParams,\n );\n }\n}\n\nexport default TileWMS;\n","/**\n * @module ol/source/WMTS\n */\n\nimport {containsExtent} from '../extent.js';\nimport {equivalent, get as getProjection, transformExtent} from '../proj.js';\nimport {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js';\nimport {createFromTileUrlFunctions} from '../tileurlfunction.js';\nimport {appendParams, expandUrl} from '../uri.js';\nimport TileImage from './TileImage.js';\n\n/**\n * Request encoding. One of 'KVP', 'REST'.\n * @typedef {'KVP' | 'REST'} RequestEncoding\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./Source.js\").AttributionLike} [attributions] Attributions.\n * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.\n * @property {number} [cacheSize] Deprecated. Use the cacheSize option on the layer instead.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,\n * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.\n * @property {import(\"../tilegrid/WMTS.js\").default} tileGrid Tile grid.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).\n * Higher values can increase reprojection performance, but decrease precision.\n * @property {RequestEncoding} [requestEncoding='KVP'] Request encoding.\n * @property {string} layer Layer name as advertised in the WMTS capabilities.\n * @property {string} style Style name as advertised in the WMTS capabilities.\n * @property {typeof import(\"../ImageTile.js\").default} [tileClass] Class used to instantiate image tiles. Default is {@link module:ol/ImageTile~ImageTile}.\n * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.\n * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px\n * by 512px images (for retina/hidpi devices) then `tilePixelRatio`\n * should be set to `2`.\n * @property {string} [format='image/jpeg'] Image format. Only used when `requestEncoding` is `'KVP'`.\n * @property {string} [version='1.0.0'] WMTS version.\n * @property {string} matrixSet Matrix set.\n * @property {!Object} [dimensions] Additional \"dimensions\" for tile requests.\n * This is an object with properties named like the advertised WMTS dimensions.\n * @property {string} [url] A URL for the service.\n * For the RESTful request encoding, this is a URL\n * template. For KVP encoding, it is normal URL. A `{?-?}` template pattern,\n * for example `subdomain{a-f}.domain.com`, may be used instead of defining\n * each one separately in the `urls` option.\n * @property {import(\"../Tile.js\").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is\n * ```js\n * function(imageTile, src) {\n * imageTile.getImage().src = src;\n * };\n * ```\n * @property {Array<string>} [urls] An array of URLs.\n * Requests will be distributed among the URLs in this array.\n * @property {boolean} [wrapX=false] Whether to wrap the world horizontally.\n * @property {number} [transition] Duration of the opacity transition for rendering.\n * To disable the opacity transition, pass `transition: 0`.\n * @property {number|import(\"../array.js\").NearestDirectionFunction} [zDirection=0]\n * Choose whether to use tiles with a higher or lower zoom level when between integer\n * zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.\n */\n\n/**\n * @classdesc\n * Layer source for tile data from WMTS servers.\n * @api\n */\nclass WMTS extends TileImage {\n /**\n * @param {Options} options WMTS options.\n */\n constructor(options) {\n // TODO: add support for TileMatrixLimits\n\n const requestEncoding =\n options.requestEncoding !== undefined ? options.requestEncoding : 'KVP';\n\n // FIXME: should we create a default tileGrid?\n // we could issue a getCapabilities xhr to retrieve missing configuration\n const tileGrid = options.tileGrid;\n\n let urls = options.urls;\n if (urls === undefined && options.url !== undefined) {\n urls = expandUrl(options.url);\n }\n\n super({\n attributions: options.attributions,\n attributionsCollapsible: options.attributionsCollapsible,\n cacheSize: options.cacheSize,\n crossOrigin: options.crossOrigin,\n interpolate: options.interpolate,\n projection: options.projection,\n reprojectionErrorThreshold: options.reprojectionErrorThreshold,\n tileClass: options.tileClass,\n tileGrid: tileGrid,\n tileLoadFunction: options.tileLoadFunction,\n tilePixelRatio: options.tilePixelRatio,\n urls: urls,\n wrapX: options.wrapX !== undefined ? options.wrapX : false,\n transition: options.transition,\n zDirection: options.zDirection,\n });\n\n /**\n * @private\n * @type {string}\n */\n this.version_ = options.version !== undefined ? options.version : '1.0.0';\n\n /**\n * @private\n * @type {string}\n */\n this.format_ = options.format !== undefined ? options.format : 'image/jpeg';\n\n /**\n * @private\n * @type {!Object}\n */\n this.dimensions_ =\n options.dimensions !== undefined ? options.dimensions : {};\n\n /**\n * @private\n * @type {string}\n */\n this.layer_ = options.layer;\n\n /**\n * @private\n * @type {string}\n */\n this.matrixSet_ = options.matrixSet;\n\n /**\n * @private\n * @type {string}\n */\n this.style_ = options.style;\n\n // FIXME: should we guess this requestEncoding from options.url(s)\n // structure? that would mean KVP only if a template is not provided.\n\n /**\n * @private\n * @type {RequestEncoding}\n */\n this.requestEncoding_ = requestEncoding;\n\n this.setKey(this.getKeyForDimensions_());\n\n if (urls && urls.length > 0) {\n this.tileUrlFunction = createFromTileUrlFunctions(\n urls.map(this.createFromWMTSTemplate.bind(this)),\n );\n }\n }\n\n /**\n * Set the URLs to use for requests.\n * URLs may contain OGC conform URL Template Variables: {TileMatrix}, {TileRow}, {TileCol}.\n * @param {Array<string>} urls URLs.\n * @override\n */\n setUrls(urls) {\n this.urls = urls;\n const key = urls.join('\\n');\n this.setTileUrlFunction(\n createFromTileUrlFunctions(\n urls.map(this.createFromWMTSTemplate.bind(this)),\n ),\n key,\n );\n }\n\n /**\n * Get the dimensions, i.e. those passed to the constructor through the\n * \"dimensions\" option, and possibly updated using the updateDimensions\n * method.\n * @return {!Object} Dimensions.\n * @api\n */\n getDimensions() {\n return this.dimensions_;\n }\n\n /**\n * Return the image format of the WMTS source.\n * @return {string} Format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * Return the layer of the WMTS source.\n * @return {string} Layer.\n * @api\n */\n getLayer() {\n return this.layer_;\n }\n\n /**\n * Return the matrix set of the WMTS source.\n * @return {string} MatrixSet.\n * @api\n */\n getMatrixSet() {\n return this.matrixSet_;\n }\n\n /**\n * Return the request encoding, either \"KVP\" or \"REST\".\n * @return {RequestEncoding} Request encoding.\n * @api\n */\n getRequestEncoding() {\n return this.requestEncoding_;\n }\n\n /**\n * Return the style of the WMTS source.\n * @return {string} Style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Return the version of the WMTS source.\n * @return {string} Version.\n * @api\n */\n getVersion() {\n return this.version_;\n }\n\n /**\n * @private\n * @return {string} The key for the current dimensions.\n */\n getKeyForDimensions_() {\n const res = this.urls ? this.urls.slice(0) : [];\n for (const key in this.dimensions_) {\n res.push(key + '-' + this.dimensions_[key]);\n }\n return res.join('/');\n }\n\n /**\n * Update the dimensions.\n * @param {Object} dimensions Dimensions.\n * @api\n */\n updateDimensions(dimensions) {\n Object.assign(this.dimensions_, dimensions);\n this.setKey(this.getKeyForDimensions_());\n }\n\n /**\n * @param {string} template Template.\n * @return {import(\"../Tile.js\").UrlFunction} Tile URL function.\n */\n createFromWMTSTemplate(template) {\n const requestEncoding = this.requestEncoding_;\n\n // context property names are lower case to allow for a case insensitive\n // replacement as some services use different naming conventions\n const context = {\n 'layer': this.layer_,\n 'style': this.style_,\n 'tilematrixset': this.matrixSet_,\n };\n\n if (requestEncoding == 'KVP') {\n Object.assign(context, {\n 'Service': 'WMTS',\n 'Request': 'GetTile',\n 'Version': this.version_,\n 'Format': this.format_,\n });\n }\n\n // TODO: we may want to create our own appendParams function so that params\n // order conforms to wmts spec guidance, and so that we can avoid to escape\n // special template params\n\n template =\n requestEncoding == 'KVP'\n ? appendParams(template, context)\n : template.replace(/\\{(\\w+?)\\}/g, function (m, p) {\n return p.toLowerCase() in context ? context[p.toLowerCase()] : m;\n });\n\n const tileGrid = /** @type {import(\"../tilegrid/WMTS.js\").default} */ (\n this.tileGrid\n );\n const dimensions = this.dimensions_;\n\n return (\n /**\n * @param {import(\"../tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"../proj/Projection.js\").default} projection Projection.\n * @return {string|undefined} Tile URL.\n */\n function (tileCoord, pixelRatio, projection) {\n if (!tileCoord) {\n return undefined;\n }\n const localContext = {\n 'TileMatrix': tileGrid.getMatrixId(tileCoord[0]),\n 'TileCol': tileCoord[1],\n 'TileRow': tileCoord[2],\n };\n Object.assign(localContext, dimensions);\n let url = template;\n if (requestEncoding == 'KVP') {\n url = appendParams(url, localContext);\n } else {\n url = url.replace(/\\{(\\w+?)\\}/g, function (m, p) {\n return encodeURIComponent(localContext[p]);\n });\n }\n return url;\n }\n );\n }\n}\n\nexport default WMTS;\n\n/**\n * Generate source options from a capabilities object.\n * @param {Object} wmtsCap An object representing the capabilities document.\n * @param {!Object} config Configuration properties for the layer. Defaults for\n * the layer will apply if not provided.\n *\n * Required config properties:\n * - layer - {string} The layer identifier.\n *\n * Optional config properties:\n * - matrixSet - {string} The matrix set identifier, required if there is\n * more than one matrix set in the layer capabilities.\n * - projection - {string} The desired CRS when no matrixSet is specified.\n * eg: \"EPSG:3857\". If the desired projection is not available,\n * an error is thrown.\n * - requestEncoding - {string} url encoding format for the layer. Default is\n * the first tile url format found in the GetCapabilities response.\n * - style - {string} The name of the style\n * - format - {string} Image format for the layer. Default is the first\n * format returned in the GetCapabilities response.\n * - crossOrigin - {string|null|undefined} Cross origin. Default is `undefined`.\n * @return {Options|null} WMTS source options object or `null` if the layer was not found.\n * @api\n */\nexport function optionsFromCapabilities(wmtsCap, config) {\n const layers = wmtsCap['Contents']['Layer'];\n const l = layers?.find(function (elt) {\n return elt['Identifier'] == config['layer'];\n });\n if (!l) {\n return null;\n }\n const tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];\n let idx;\n if (l['TileMatrixSetLink'].length > 1) {\n if ('projection' in config) {\n idx = l['TileMatrixSetLink'].findIndex(function (elt) {\n const tileMatrixSet = tileMatrixSets.find(function (el) {\n return el['Identifier'] == elt['TileMatrixSet'];\n });\n const supportedCRS = tileMatrixSet['SupportedCRS'];\n const proj1 = getProjection(supportedCRS);\n const proj2 = getProjection(config['projection']);\n if (proj1 && proj2) {\n return equivalent(proj1, proj2);\n }\n return supportedCRS == config['projection'];\n });\n } else {\n idx = l['TileMatrixSetLink'].findIndex(function (elt) {\n return elt['TileMatrixSet'] == config['matrixSet'];\n });\n }\n } else {\n idx = 0;\n }\n if (idx < 0) {\n idx = 0;\n }\n const matrixSet =\n /** @type {string} */\n (l['TileMatrixSetLink'][idx]['TileMatrixSet']);\n const matrixLimits =\n /** @type {Array<Object>} */\n (l['TileMatrixSetLink'][idx]['TileMatrixSetLimits']);\n\n let format = /** @type {string} */ (l['Format'][0]);\n if ('format' in config) {\n format = config['format'];\n }\n idx = l['Style'].findIndex(function (elt) {\n if ('style' in config) {\n return elt['Title'] == config['style'];\n }\n return elt['isDefault'];\n });\n if (idx < 0) {\n idx = 0;\n }\n const style = /** @type {string} */ (l['Style'][idx]['Identifier']);\n\n const dimensions = {};\n if ('Dimension' in l) {\n l['Dimension'].forEach(function (elt, index, array) {\n const key = elt['Identifier'];\n let value = elt['Default'];\n if (value === undefined) {\n value = elt['Value'][0];\n }\n dimensions[key] = value;\n });\n }\n\n const matrixSets = wmtsCap['Contents']['TileMatrixSet'];\n const matrixSetObj = matrixSets.find(function (elt) {\n return elt['Identifier'] == matrixSet;\n });\n\n let projection;\n const code = matrixSetObj['SupportedCRS'];\n if (code) {\n projection = getProjection(code);\n }\n if ('projection' in config) {\n const projConfig = getProjection(config['projection']);\n if (projConfig) {\n if (!projection || equivalent(projConfig, projection)) {\n projection = projConfig;\n }\n }\n }\n\n let wrapX = false;\n const switchXY = projection.getAxisOrientation().startsWith('ne');\n\n let matrix = matrixSetObj.TileMatrix[0];\n\n // create default matrixLimit\n let selectedMatrixLimit = {\n MinTileCol: 0,\n MinTileRow: 0,\n // subtract one to end up at tile top left\n MaxTileCol: matrix.MatrixWidth - 1,\n MaxTileRow: matrix.MatrixHeight - 1,\n };\n\n //in case of matrix limits, use matrix limits to calculate extent\n if (matrixLimits) {\n selectedMatrixLimit = matrixLimits[matrixLimits.length - 1];\n const m = matrixSetObj.TileMatrix.find(\n (tileMatrixValue) =>\n tileMatrixValue.Identifier === selectedMatrixLimit.TileMatrix ||\n matrixSetObj.Identifier + ':' + tileMatrixValue.Identifier ===\n selectedMatrixLimit.TileMatrix,\n );\n if (m) {\n matrix = m;\n }\n }\n\n const resolution =\n (matrix.ScaleDenominator * 0.00028) / projection.getMetersPerUnit(); // WMTS 1.0.0: standardized rendering pixel size\n const origin = switchXY\n ? [matrix.TopLeftCorner[1], matrix.TopLeftCorner[0]]\n : matrix.TopLeftCorner;\n const tileSpanX = matrix.TileWidth * resolution;\n const tileSpanY = matrix.TileHeight * resolution;\n let matrixSetExtent = matrixSetObj['BoundingBox'];\n if (matrixSetExtent && switchXY) {\n matrixSetExtent = [\n matrixSetExtent[1],\n matrixSetExtent[0],\n matrixSetExtent[3],\n matrixSetExtent[2],\n ];\n }\n let extent = [\n origin[0] + tileSpanX * selectedMatrixLimit.MinTileCol,\n // add one to get proper bottom/right coordinate\n origin[1] - tileSpanY * (1 + selectedMatrixLimit.MaxTileRow),\n origin[0] + tileSpanX * (1 + selectedMatrixLimit.MaxTileCol),\n origin[1] - tileSpanY * selectedMatrixLimit.MinTileRow,\n ];\n\n if (\n matrixSetExtent !== undefined &&\n !containsExtent(matrixSetExtent, extent)\n ) {\n const wgs84BoundingBox = l['WGS84BoundingBox'];\n const wgs84ProjectionExtent = getProjection('EPSG:4326').getExtent();\n extent = matrixSetExtent;\n if (wgs84BoundingBox) {\n wrapX =\n wgs84BoundingBox[0] === wgs84ProjectionExtent[0] &&\n wgs84BoundingBox[2] === wgs84ProjectionExtent[2];\n } else {\n const wgs84MatrixSetExtent = transformExtent(\n matrixSetExtent,\n matrixSetObj['SupportedCRS'],\n 'EPSG:4326',\n );\n // Ignore slight deviation from the correct x limits\n wrapX =\n wgs84MatrixSetExtent[0] - 1e-10 <= wgs84ProjectionExtent[0] &&\n wgs84MatrixSetExtent[2] + 1e-10 >= wgs84ProjectionExtent[2];\n }\n }\n\n const tileGrid = createFromCapabilitiesMatrixSet(\n matrixSetObj,\n extent,\n matrixLimits,\n );\n\n /** @type {!Array<string>} */\n const urls = [];\n let requestEncoding = config['requestEncoding'];\n requestEncoding = requestEncoding !== undefined ? requestEncoding : '';\n\n if (\n 'OperationsMetadata' in wmtsCap &&\n 'GetTile' in wmtsCap['OperationsMetadata']\n ) {\n const gets = wmtsCap['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get'];\n\n for (let i = 0, ii = gets.length; i < ii; ++i) {\n if (gets[i]['Constraint']) {\n const constraint = gets[i]['Constraint'].find(function (element) {\n return element['name'] == 'GetEncoding';\n });\n const encodings = constraint['AllowedValues']['Value'];\n\n if (requestEncoding === '') {\n // requestEncoding not provided, use the first encoding from the list\n requestEncoding = encodings[0];\n }\n if (requestEncoding === 'KVP') {\n if (encodings.includes('KVP')) {\n urls.push(/** @type {string} */ (gets[i]['href']));\n }\n } else {\n break;\n }\n } else if (gets[i]['href']) {\n requestEncoding = 'KVP';\n urls.push(/** @type {string} */ (gets[i]['href']));\n }\n }\n }\n if (urls.length === 0) {\n requestEncoding = 'REST';\n l['ResourceURL'].forEach(function (element) {\n if (element['resourceType'] === 'tile') {\n format = element['format'];\n urls.push(/** @type {string} */ (element['template']));\n }\n });\n }\n\n return {\n urls: urls,\n layer: config['layer'],\n matrixSet: matrixSet,\n format: format,\n projection: projection,\n requestEncoding: requestEncoding,\n tileGrid: tileGrid,\n style: style,\n dimensions: dimensions,\n wrapX: wrapX,\n crossOrigin: config['crossOrigin'],\n };\n}\n","/**\n * @module ol/source/mapserver\n */\n\nimport {decode} from '../Image.js';\nimport {getHeight, getWidth} from '../extent.js';\nimport {appendParams} from '../uri.js';\nimport {getRequestExtent} from './Image.js';\n\n/**\n * @typedef {Object} LoaderOptions\n * @property {string} url The MapServer url.\n * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that\n * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.\n * the image from the remote server.\n * @property {number} [ratio=1] Ratio. `1` means image requests are the size of the map viewport, `2` means\n * twice the width and height of the map viewport, and so on. Must be `1` or higher.\n * @property {Object} [params] Additional query parameters.\n * @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function\n * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and\n * returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.\n */\n\n/**\n * @param {string} baseUrl The MapServer url.\n * @param {Object<string, string|number>} params Request parameters.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {import(\"../size.js\").Size} size Size.\n * @return {string} The MapServer map image request URL.\n */\nfunction getUrl(baseUrl, params, extent, size) {\n const width = Math.round(size[0]);\n const height = Math.round(size[1]);\n const mapSize = `${width} ${height}`;\n const mapExt = `${extent[0]} ${extent[1]} ${extent[2]} ${extent[3]}`;\n\n const baseParams = {\n mode: 'map',\n map_imagetype: 'png',\n mapext: mapExt,\n imgext: mapExt,\n map_size: mapSize,\n imgx: width / 2,\n imgy: height / 2,\n imgxy: mapSize,\n };\n Object.assign(baseParams, params);\n return appendParams(baseUrl, baseParams);\n}\n\n/**\n * Creates a loader for MapServer images generated using the CGI interface,\n * which predates OGC services. It is **strongly** recommended to configure\n * MapServer to use WMS, and use the WMS createLoader.\n * @param {LoaderOptions} options LoaderOptions Options.\n * @return {import('../Image.js').ImageObjectPromiseLoader} MapServer image.\n * @api\n */\nexport function createLoader(options) {\n const load = options.load || decode;\n const ratio = options.ratio ?? 1;\n const crossOrigin = options.crossOrigin ?? null;\n\n /** @type {import('../Image.js').ImageObjectPromiseLoader} */\n return function (extent, resolution, pixelRatio) {\n const image = new Image();\n image.crossOrigin = crossOrigin;\n extent = getRequestExtent(extent, resolution, pixelRatio, ratio);\n const width = getWidth(extent) / resolution;\n const height = getHeight(extent) / resolution;\n const size = [width * pixelRatio, height * pixelRatio];\n const src = getUrl(options.url, options.params, extent, size);\n return load(image, src).then((image) => ({image, extent, pixelRatio}));\n };\n}\n","/**\n * @module ol/source\n */\n\nimport {getIntersection} from './extent.js';\nimport LRUCache from './structs/LRUCache.js';\n\nexport {default as BingMaps} from './source/BingMaps.js';\nexport {default as CartoDB} from './source/CartoDB.js';\nexport {default as Cluster} from './source/Cluster.js';\nexport {default as DataTile} from './source/DataTile.js';\nexport {default as GeoTIFF} from './source/GeoTIFF.js';\nexport {default as Google} from './source/Google.js';\nexport {default as IIIF} from './source/IIIF.js';\nexport {default as Image} from './source/Image.js';\nexport {default as ImageArcGISRest} from './source/ImageArcGISRest.js';\nexport {default as ImageCanvas} from './source/ImageCanvas.js';\nexport {default as ImageMapGuide} from './source/ImageMapGuide.js';\nexport {default as ImageStatic} from './source/ImageStatic.js';\nexport {default as ImageTile} from './source/ImageTile.js';\nexport {default as ImageWMS} from './source/ImageWMS.js';\nexport {default as OGCMapTile} from './source/OGCMapTile.js';\nexport {default as OGCVectorTile} from './source/OGCVectorTile.js';\nexport {default as OSM} from './source/OSM.js';\nexport {default as Raster} from './source/Raster.js';\nexport {default as Source} from './source/Source.js';\nexport {default as StadiaMaps} from './source/StadiaMaps.js';\nexport {default as Tile} from './source/Tile.js';\nexport {default as TileArcGISRest} from './source/TileArcGISRest.js';\nexport {default as TileDebug} from './source/TileDebug.js';\nexport {default as TileImage} from './source/TileImage.js';\nexport {default as TileJSON} from './source/TileJSON.js';\nexport {default as TileWMS} from './source/TileWMS.js';\nexport {default as UrlTile} from './source/UrlTile.js';\nexport {default as UTFGrid} from './source/UTFGrid.js';\nexport {default as Vector} from './source/Vector.js';\nexport {default as VectorTile} from './source/VectorTile.js';\nexport {default as WMTS} from './source/WMTS.js';\nexport {default as XYZ} from './source/XYZ.js';\nexport {default as Zoomify} from './source/Zoomify.js';\nexport {createLoader as createWMSLoader} from './source/wms.js';\nexport {createLoader as createArcGISRestLoader} from './source/arcgisRest.js';\nexport {createLoader as createStaticLoader} from './source/static.js';\nexport {createLoader as createMapGuideLoader} from './source/mapguide.js';\n\n/**\n * Creates a sources function from a tile grid. This function can be used as value for the\n * `sources` property of the {@link module:ol/layer/Layer~Layer} subclasses that support it.\n * @param {import(\"./tilegrid/TileGrid.js\").default} tileGrid Tile grid.\n * @param {function(import(\"./tilecoord.js\").TileCoord): import(\"./source/Source.js\").default} factory Source factory.\n * This function takes a {@link module:ol/tilecoord~TileCoord} as argument and is expected to return a\n * {@link module:ol/source/Source~Source}. **Note**: The returned sources should have a tile grid with\n * a limited set of resolutions, matching the resolution range of a single zoom level of the pyramid\n * `tileGrid` that `sourcesFromTileGrid` was called with.\n * @return {function(import(\"./extent.js\").Extent, number): Array<import(\"./source/Source.js\").default>} Sources function.\n * @api\n */\nexport function sourcesFromTileGrid(tileGrid, factory) {\n const sourceCache = new LRUCache(32);\n const tileGridExtent = tileGrid.getExtent();\n return function (extent, resolution) {\n sourceCache.expireCache();\n if (tileGridExtent) {\n extent = getIntersection(tileGridExtent, extent);\n }\n const z = tileGrid.getZForResolution(resolution);\n const wantedSources = [];\n tileGrid.forEachTileCoord(extent, z, (tileCoord) => {\n const key = tileCoord.toString();\n if (!sourceCache.containsKey(key)) {\n const source = factory(tileCoord);\n sourceCache.set(key, source);\n }\n wantedSources.push(sourceCache.get(key));\n });\n return wantedSources;\n };\n}\n"],"names":["CollectionEventType","ObjectEventType","EventType$1","Disposable","constructor","this","disposed","dispose","disposeInternal","binarySearch","haystack","needle","comparator","mid","cmp","ascending","low","high","length","found","a","b","descending","linearFindNearest","arr","target","direction","n","i","candidate","reverseSubArray","begin","end","tmp","extend","data","extension","Array","isArray","equals","arr1","arr2","len1","isSorted","func","strict","compare","every","currentVal","index","res","TRUE","FALSE","VOID","memoizeOne","fn","lastResult","lastArgs","lastThis","nextArgs","prototype","slice","call","arguments","arrayEquals","apply","toPromise","getter","value","err","Promise","reject","resolve","promiseGetter","clear","object","property","isEmpty","BaseEvent","type","propagationStopped","defaultPrevented","preventDefault","stopPropagation","evt","Target","super","eventTarget_","pendingRemovals_","dispatching_","listeners_","addEventListener","listener","listeners","listenersForType","includes","push","dispatchEvent","event","isString","Event","dispatching","pendingRemovals","propagate","ii","handleEvent","pr","removeEventListener","getListeners","undefined","hasListener","Object","keys","indexOf","splice","listen","thisArg","once","originalListener","bind","eventsKey","listenOnce","unlistenByKey","key","Observable","EventTarget","on","un","revision_","changed","EventType","getRevision","onInternal","len","onceInternal","ol_key","unInternal","unByKey","abstract","Error","uidCounter_","getUid","obj","ol_uid","String","ObjectEvent","oldValue","BaseObject","values","values_","setProperties","get","hasOwnProperty","getKeys","getProperties","assign","getPropertiesInternal","hasProperties","notify","eventType","addChangeListener","removeChangeListener","set","silent","applyProperties","source","unset","Property","CollectionEvent","element","Collection","array","options","unique_","unique","array_","assertUnique_","updateLength_","getLength","pop","forEach","f","getArray","item","insertAt","elem","removeAt","remove","prev","setAt","except","TileState","easeIn","t","Math","pow","easeOut","inAndOut","linear","Tile","tileCoord","state","transition_","transition","transitionStarts_","interpolate","release","setState","getKey","getTileCoord","getState","load","getAlpha","id","time","start","delta","inTransition","endTransition","ua","navigator","userAgent","toLowerCase","SAFARI","SAFARI_BUG_237906","test","WEBKIT","MAC","DEVICE_PIXEL_RATIO","devicePixelRatio","WORKER_OFFSCREEN_CANVAS","WorkerGlobalScope","OffscreenCanvas","self","IMAGE_DECODE","Image","decode","CREATE_IMAGE_BITMAP","createImageBitmap","PASSIVE_EVENT_LISTENERS","passive","defineProperty","window","createCanvasContext2D","width","height","canvasPool","settings","canvas","shift","document","createElement","getContext","sharedCanvasContext","getSharedCanvasContext2D","releaseCanvas","context","clearRect","outerWidth","offsetWidth","style","getComputedStyle","parseInt","marginLeft","marginRight","outerHeight","offsetHeight","marginTop","marginBottom","replaceNode","newNode","oldNode","parent","parentNode","replaceChild","removeChildren","node","lastChild","replaceChildren","children","oldChildren","childNodes","oldChild","newChild","insertBefore","removeChild","appendChild","asImageLike","HTMLCanvasElement","HTMLVideoElement","ImageBitmap","asArrayLike","Uint8Array","Uint8ClampedArray","Float32Array","DataView","disposedError","sharedContext","toArray","image","willReadFrequently","drawImage","getImageData","defaultSize","DataTile","loader_","loader","data_","error_","size_","size","controller_","controller","getSize","imageData","getData","getError","then","catch","error","abort","assert","assertion","errorMessage","Feature","geometryOrProperties","id_","geometryName_","style_","styleFunction_","geometryChangeKey_","handleGeometryChanged_","geometry","setGeometry","properties","clone","setGeometryName","getGeometryName","getGeometry","getStyle","setStyle","getId","getStyleFunction","handleGeometryChange_","createStyleFunction","setId","name","styles","Relationship","boundingExtent","coordinates","extent","createEmpty","extendCoordinate","buffer","dest","closestSquaredDistanceXY","x","y","dx","dy","containsCoordinate","coordinate","containsXY","containsExtent","extent1","extent2","coordinateRelationship","minX","minY","maxX","maxY","relationship","Infinity","createOrUpdate","createOrUpdateEmpty","createOrUpdateFromCoordinate","createOrUpdateFromFlatCoordinates","flatCoordinates","offset","stride","extendFlatCoordinates","approximatelyEquals","tolerance","abs","extendCoordinates","extendXY","extendRings","rings","min","max","forEachCorner","callback","val","getBottomLeft","getBottomRight","getTopRight","getTopLeft","getArea","area","getWidth","getHeight","getCenter","getCorner","corner","getForViewAndSize","center","resolution","rotation","x0","y0","x1","y1","x2","y2","x3","y3","getRotatedViewport","cosRotation","cos","sinRotation","sin","xCos","xSin","yCos","ySin","getIntersection","intersection","intersects","returnOrUpdate","scaleFromCenter","deltaX","deltaY","intersectsSegment","startRel","endRel","startX","startY","endX","endY","slope","applyTransform","transformFn","stops","xs","ys","l","_boundingExtentXYs","wrapX","projection","projectionExtent","getExtent","canWrapX","worldWidth","floor","wrapAndSliceX","multiWorld","isFinite","clamp","squaredSegmentDistance","squaredDistance","solveLinearSystem","mat","maxRow","maxEl","r","absValue","j","coef","k","m","toDegrees","angleInRadians","PI","toRadians","angleInDegrees","modulo","lerp","toFixed","decimals","factor","round","ceil","wrap","range","DEFAULT_RADIUS","getDistance","c1","c2","radius","lat1","lat2","deltaLatBy2","deltaLonBy2","atan2","sqrt","getLengthInternal","getAreaInternal","distance","bearing","lon1","dByR","lat","asin","levels","info","warn","none","level","args","console","padNumber","number","precision","numberString","decimal","join","compareVersions","v1","v2","s1","split","s2","n1","n2","add","closestOnCircle","circle","getRadius","d","closestOnSegment","segment","along","degreesToStringHDMS","hemispheres","degrees","fractionDigits","normalizedDegrees","deg","sec","hdms","charAt","format","template","replace","coordinate1","coordinate2","rotate","angle","cosAngle","sinAngle","scale","coord1","coord2","squaredDistanceToSegment","toStringXY","worldsAway","getWorldsAway","sourceExtentWidth","unitByCode","fromCode","code","METERS_PER_UNIT","radians","ft","Projection","code_","units_","extent_","worldExtent_","worldExtent","axisOrientation_","axisOrientation","global_","global","canWrapX_","getPointResolutionFunc_","getPointResolution","defaultTileGrid_","metersPerUnit_","metersPerUnit","getCode","getUnits","getMetersPerUnit","getWorldExtent","getAxisOrientation","isGlobal","setGlobal","getDefaultTileGrid","setDefaultTileGrid","tileGrid","setExtent","setWorldExtent","setGetPointResolution","getPointResolutionFunc","RADIUS","HALF_SIZE","EXTENT","WORLD_EXTENT","MAX_SAFE_Y","log","tan","EPSG3857Projection","units","point","cosh","PROJECTIONS","fromEPSG4326","input","output","dimension","toEPSG4326","atan","exp","EPSG4326Projection","cache","transforms","destination","sourceCode","destinationCode","K0","E","E2","E3","E_P2","SQRT_E","_E","_E2","_E3","_E4","_E5","M1","M3","M4","P2","P3","P4","P5","R","toLonLat","easting","northing","zone","mu","north","pRad","pSin","pSin2","pCos","pTan","pTan2","pTan4","epSin","epSinSqrt","c","d2","d3","d4","d5","latitude","longitude","zoneToCentralLongitude","fromLonLat","latRad","latSin","latCos","latTan","latTan2","latTan4","lonRad","centralLonRad","a2","a3","a4","a5","a6","epsgRegExes","zoneFromCode","epsgId","re","match","makeTransformFunction","transformer","coord","makeProjection","makeTransforms","forward","inverse","transformFactories","makeUTMTransforms","projectionFactories","makeUTMProjection","showCoordinateWarning","disableCoordinateWarning","disable","cloneTransform","identityTransform","addProjection","addProj","addTransformFunc","addProjections","projections","projectionLike","getProj","pointResolution","projUnits","getTransformFromProjections","vertices","addEquivalentProjections","addEquivalentTransforms","projections1","projections2","forwardTransform","inverseTransform","projection1","projection2","createProjection","defaultCode","createTransformFromCoordinateTransform","coordTransform","pointLength","jj","addCoordinateTransforms","sourceProj","destProj","lonLat","transform","lon","equivalent","equalUnits","transformFunc","getTransformFunc","sourceTransforms","destinationTransforms","intermediateCode","composeTransformFuncs","fromSource","toDestination","t1","t2","dimensions","getTransform","transformExtent","userProjection","setUserProjection","getUserProjection","toUserCoordinate","sourceProjection","fromUserCoordinate","destProjection","toUserExtent","fromUserExtent","toUserResolution","sourceMetersPerUnit","userMetersPerUnit","fromUserResolution","destMetersPerUnit","createSafeCoordinateTransform","transformed","sourceExtent","addCommon","EPSG3857_PROJECTIONS","EPSG4326_PROJECTIONS","tmp_","create","reset","multiply","transform1","transform2","a1","b1","d1","e1","f1","b2","e2","f2","e","setFromArray","translate","compose","dx1","dy1","sx","sy","dx2","dy2","makeInverse","det","determinant","matrixPrecision","toString","fromString","cssTransform","substring","map","parseFloat","cssTransform1","cssTransform2","mat1","mat2","transform2D","destinationStride","anchor","anchorX","anchorY","tmpTransform","tmpPoint","NaN","Geometry","extentRevision_","simplifiedGeometryMaxMinSquaredTolerance","simplifiedGeometryRevision","simplifyTransformedInternal","revision","squaredTolerance","getSimplifiedGeometry","simplifyTransformed","closestPointXY","closestPoint","minSquaredDistance","Number","MIN_VALUE","getClosestPoint","intersectsCoordinate","computeExtent","isNaN","simplify","getType","intersectsExtent","getProjection","inCoordinates","outCoordinates","pixelExtent","projectedExtent","composeTransform","projTransform","SimpleGeometry","layout","getCoordinates","getFirstCoordinate","getFlatCoordinates","getLastCoordinate","getLayout","simplifiedGeometry","getSimplifiedGeometryInternal","getStride","setFlatCoordinates","getStrideForLayout","setCoordinates","setLayout","nesting","getLayoutForStride","startsWith","transformGeom2D","simpleGeometry","linearRing","twiceArea","linearRings","ends","linearRingss","endss","assignClosest","offset1","offset2","maxSquaredDelta","squaredDelta","squaredDx","arrayMaxSquaredDelta","multiArrayMaxSquaredDelta","assignClosestPoint","maxDelta","isRing","assignClosestArrayPoint","assignClosestMultiArrayPoint","deflateCoordinate","deflateCoordinates","deflateCoordinatesArray","coordinatess","deflateMultiCoordinatesArray","coordinatesss","inflateCoordinates","inflateCoordinatesArray","inflateMultiCoordinatesArray","douglasPeucker","simplifiedFlatCoordinates","simplifiedOffset","markers","stack","last","first","maxSquaredDistance","douglasPeuckerArray","simplifiedEnds","radialDistance","snap","quantize","quantizeArray","quantizeMultiArray","simplifiedEndss","LinearRing","maxDelta_","maxDeltaRevision_","linearRingArea","Point","linearRingContainsExtent","linearRingContainsXY","wn","linearRingsContainsXY","linearRingssContainsXY","getInteriorPointOfArray","flatCenters","flatCentersOffset","intersections","rr","pointX","maxSegmentLength","sort","segmentLength","getInteriorPointsOfMultiArray","interiorPoints","ret","getIntersectionPoint","segment1","segment2","u","intersectsLineString","coordinatesExtent","forEachSegment","point1","point2","intersectsLineStringArray","intersectsLinearRing","intersectsLinearRingArray","intersectsLinearRingMultiArray","linearRingIsClockwise","edge","linearRingsAreOriented","right","isClockwise","linearRingssAreOriented","orientLinearRings","reverseCoordinates","orientLinearRingsArray","inflateEnds","startOrientation","prevEndIndex","orientation","Polygon","ends_","flatInteriorPointRevision_","flatInteriorPoint_","orientedRevision_","orientedFlatCoordinates_","appendLinearRing","polygon","getOrientedFlatCoordinates","linearRingsArea","getEnds","getFlatInteriorPoint","flatCenter","getInteriorPoint","getLinearRingCount","getLinearRing","getLinearRings","circular","sphereRadius","sphereOffset","fromExtent","fromCircle","sides","arrayLength","makeRegular","startAngle","GeolocationErrorType","GeolocationError","message","ImageState","ImageWrapper","pixelRatio","stateOrLoader","pixelRatio_","image_","getImage","getPixelRatio","getResolution","requestResolution","HTMLImageElement","finally","setImage","setResolution","listenImage","loadHandler","errorHandler","img","listening","decoding","loaded","listenerKeys","src","handleLoad","unlisten","handleError","decodeFallback","complete","ImageCanvas","canvas_","handleLoad_","ImageTile","crossOrigin","tileLoadFunction","crossOrigin_","src_","unlisten_","tileLoadFunction_","unlistenImage_","handleImageError_","ctx","fillStyle","fillRect","getBlankImage","handleImageLoad_","naturalWidth","naturalHeight","Kinetic","decay","minVelocity","delay","decay_","minVelocity_","delay_","points_","angle_","initialVelocity_","update","Date","now","lastIndex","firstIndex","duration","getAngle","MapEvent","frameState","MapBrowserEvent","originalEvent","dragging","activePointers","pixel_","coordinate_","pixel","getEventPixel","getCoordinateFromPixel","MapBrowserEventType","SINGLECLICK","CLICK","DBLCLICK","POINTERDRAG","POINTERMOVE","POINTERDOWN","POINTERUP","POINTEROVER","POINTEROUT","POINTERENTER","POINTERLEAVE","POINTERCANCEL","PointerEventType","MapBrowserEventHandler","moveTolerance","map_","clickTimeoutId_","emulateClicks_","dragging_","dragListenerKeys_","moveTolerance_","down_","getViewport","activePointers_","trackedTouches_","element_","pointerdownListenerKey_","handlePointerDown_","originalPointerMoveEvent_","relayedListenerKey_","relayMoveEvent_","boundHandleTouchMove_","handleTouchMove_","emulateClick_","pointerEvent","newEvent","clearTimeout","setTimeout","updateActivePointers_","pointerId","handlePointerUp_","isMouseActionButton_","button","PointerEvent","writable","doc","getOwnerDocument","handlePointerMove_","getRootNode","isMoving_","cancelable","clientX","clientY","MapEventType","MapProperty","DROP","PriorityQueue","priorityFunction","keyFunction","priorityFunction_","keyFunction_","elements_","priorities_","queuedElements_","dequeue","elements","priorities","siftUp_","elementKey","enqueue","priority","siftDown_","getCount","getLeftChildIndex_","getRightChildIndex_","getParentIndex_","heapify_","isKeyQueued","isQueued","count","startIndex","lIndex","rIndex","smallerChildIndex","parentIndex","reprioritize","TileQueue","tilePriorityFunction","tileChangeCallback","boundHandleTileChange_","handleTileChange","tileChangeCallback_","tilesLoading_","tilesLoadingKeys_","added","getTilesLoading","tile","tileKey","loadMoreTiles","maxTotalLoading","maxNewLoads","newLoads","getTilePriority","tileSourceKey","tileCenter","tileResolution","wantedTiles","viewState","ViewHint","ViewProperty","CENTER","RESOLUTION","ROTATION","createExtent","onlyCenter","smooth","isMoving","centerShift","viewWidth","viewHeight","shiftX","shiftY","ratio","getViewportClampedResolution","maxExtent","viewportSize","showFullExtent","xResolution","yResolution","getSmoothClampedResolution","maxResolution","minResolution","result","createSnapToResolutions","resolutions","cappedMaxRes","capped","z","createSnapToPower","power","minZoomLevel","cappedZoomLevel","zoomLevel","createMinMaxResolution","createSnapToN","theta","createSnapToZero","DEFAULT_TILE_SIZE","View","hints_","animations_","updateAnimationKey_","projection_","viewportSize_","targetCenter_","targetResolution_","targetRotation_","nextCenter_","nextResolution_","nextRotation_","cancelAnchor_","applyOptions_","resolutionConstraintInfo","createResolutionConstraint","maxResolution_","minResolution_","zoomFactor_","zoomFactor","resolutions_","padding_","padding","minZoom_","minZoom","centerConstraint","createCenterConstraint","resolutionConstraint","constraint","rotationConstraint","createRotationConstraint","constraints_","setRotation","setCenterInternal","zoom","setZoom","oldPadding","getCenterInternal","newPadding","offsetX","offsetY","getUpdatedOptions_","newOptions","getZoom","getRotation","animate","var_args","isDef","getAnimating","resolveConstraints","animateInternal","animationCount","animationCallback","series","animation","easing","sourceCenter","targetCenter","sourceResolution","targetResolution","getResolutionForZoom","sourceRotation","targetRotation","isNoopAnimation","setHint","updateAnimations_","getInteracting","cancelAnimations","cancelAnimationFrame","more","seriesComplete","elapsed","fraction","progress","getViewportSize_","constrainedResolution","calculateCenterZoom","applyTargetState_","constrainedRotation","calculateCenterRotate","filter","Boolean","requestAnimationFrame","currentCenter","rotateCoordinate","addCoordinate","currentResolution","w","h","setViewportSize","getConstraints","getConstrainResolution","getHints","hints","calculateExtent","calculateExtentInternal","getViewportSizeMinusPadding_","getMaxResolution","getMinResolution","getMaxZoom","getZoomForResolution","setMaxZoom","maxZoom","getMinZoom","setMinZoom","setConstrainResolution","enabled","constrainResolution","getResolutions","getResolutionForExtent","getResolutionForExtentInternal","getResolutionForValueFunction","getConstrainedResolution","getValueForResolutionFunction","logPower","reducedSize","calculateCenterOn","nextCenter","nextResolution","nextRotation","getViewStateAndExtent","nearest","baseLevel","fit","geometryOrExtent","polygonFromExtent","fitInternal","rotatedExtentForGeometry","coords","minRotX","minRotY","maxRotX","maxRotY","rotX","rotY","rotatedExtent","centerRot","centerX","centerY","getConstrainedCenter","centerOn","position","centerOnInternal","calculateCenterShift","shiftedCenter","adjustCenter","deltaCoordinates","setCenter","adjustCenterInternal","adjustResolution","adjustResolutionInternal","newResolution","adjustZoom","adjustRotation","adjustRotationInternal","newRotation","hint","doNotCancelAnims","forceMoving","newCenter","resolutionDirection","beginInteraction","endInteraction","endInteractionInternal","getConstrainedZoom","targetZoom","targetRes","returnValue","smoothExtentConstraint","constrainOnlyCenter","centerNone","smoothResolutionConstraint","projExtent","defaultMaxResolution","defaultMinResolution","defaultMaxZoom","enableRotation","constrainRotation","rotationNone","coordinatesEqual","CLASS_HIDDEN","CLASS_SELECTABLE","CLASS_UNSELECTABLE","CLASS_UNSUPPORTED","CLASS_CONTROL","CLASS_COLLAPSED","fontRegEx","RegExp","fontRegExMatchIndex","fontWeights","normal","bold","getFontParameters","fontSpec","lineHeight","weight","variant","trim","families","family","Control","pointerEvents","target_","render","setTarget","getMap","setMap","getOverlayContainerStopEvent","mapEvent","getElementById","Attribution","ulElement_","collapsed_","collapsed","userCollapsed_","overrideCollapsible_","collapsible","collapsible_","attributions_","attributions","className","tipLabel","expandClassName","collapseLabel","collapseClassName","collapseLabel_","textContent","label","label_","activeLabel","toggleButton_","setAttribute","title","handleClick_","cssClasses","renderedAttributions_","renderedVisible_","collectSourceAttributions_","layers","getAllLayers","visibleAttributions","Set","flatMap","layer","getAttributions","some","getSource","getAttributionsCollapsible","setCollapsible","from","updateElement_","display","all","attribution","visible","innerHTML","handleToggle_","classList","toggle","getCollapsible","setCollapsed","getCollapsed","Rotate","compassClassName","callResetNorth_","resetNorth","duration_","autoHide_","autoHide","rotation_","resetNorth_","view","getView","contains","Zoom","zoomInClassName","zoomOutClassName","zoomInLabel","zoomOutLabel","zoomInTipLabel","zoomOutTipLabel","inElement","createTextNode","outElement","zoomByDelta_","currentZoom","newZoom","defaults","controls","zoomOptions","rotateOptions","attributionOptions","InteractionProperty","Interaction","setActive","getActive","mapBrowserEvent","active","pan","zoomByDelta","DoubleClickZoom","delta_","stopEvent","browserEvent","shiftKey","conditions","pass","altKeyOnly","altKey","metaKey","ctrlKey","altShiftKeysOnly","focus","targetElement","getTargetElement","rootNode","activeElement","ShadowRoot","host","focusWithTabindex","hasAttribute","always","mouseActionButton","never","singleClick","noModifierKeys","platformModifierKey","shiftKeyOnly","targetNotEditable","tagName","isContentEditable","mouseOnly","pointerType","primaryAction","isPrimary","PointerInteraction","handleDownEvent","handleDragEvent","handleMoveEvent","handleUpEvent","stopDown","handlingDownUpSequence","targetPointers","getPointerCount","updateTrackedPointers_","handledUp","handled","centroid","DragPan","kinetic_","kinetic","lastCentroid","lastPointersCount_","panning_","condition","condition_","onFocusOnly","noKinetic_","centroidFromPointers","scaleCoordinate","centerpx","getPixelFromCoordinateInternal","getCoordinateFromPixelInternal","DragRotate","lastAngle_","RenderBox","geometry_","startPixel_","endPixel_","render_","startPixel","endPixel","px","left","top","getOverlayContainer","setPixels","createOrUpdateGeometry","DragBoxEventType","DragBoxEvent","DragBox","box_","minArea_","minArea","onBoxEnd","boxEndCondition_","boxEndCondition","defaultBoxEndCondition","completeBox","DragZoom","out_","out","Key","KeyboardPan","defaultCondition_","pixelDelta_","pixelDelta","keyEvent","mapUnitsDelta","KeyboardZoom","MouseWheelZoom","totalDelta_","lastDelta_","timeout_","timeout","useAnchor_","useAnchor","constrainResolution_","lastAnchor_","startTime_","timeoutId_","mode_","trackpadEventGap_","trackpadTimeoutId_","deltaPerZoom_","endInteraction_","wheelEvent","deltaMode","WheelEvent","DOM_DELTA_LINE","DOM_DELTA_PAGE","timeLeft","handleWheelZoom_","setMouseAnchor","PinchRotate","pointerOptions","anchor_","rotating_","rotationDelta_","threshold_","threshold","rotationDelta","touch0","touch1","PinchZoom","lastDistance_","lastScaleDelta_","scaleDelta","interactions","altShiftDragRotate","doubleClickZoom","zoomDelta","zoomDuration","dragPan","pinchRotate","pinchZoom","keyboard","mouseWheelZoom","shiftDragZoom","LayerProperty","BaseLayer","background_","background","opacity","zIndex","className_","state_","getBackground","getClassName","getLayerState","managed","getZIndex","getOpacity","getVisible","getLayersArray","getLayerStatesArray","states","getSourceState","setBackground","setMaxResolution","setMinResolution","setOpacity","setVisible","setZIndex","zindex","GroupEvent","LayerGroup","baseOptions","layersListenerKeys_","listenerKeys_","handleLayersChanged_","setLayers","handleLayerChange_","getLayers","handleLayersAdd_","handleLayersRemove_","layersArray","registerLayerListeners_","handleLayerGroupAdd_","handleLayerGroupRemove_","collectionEvent","collection","currentLayers","pos","ownLayerState","defaultZIndex","layerState","Layer","mapPrecomposeKey_","mapRenderKey_","sourceChangeKey_","renderer_","sourceReady_","rendered","handleSourcePropertyChange_","setSource","getRenderSource","handleSourceChange_","getFeatures","isVisible","getMapInternal","layerStatesArray","getLayerGroup","find","layerExtent","inView","layerRenderer","getRenderer","prepareFrame","renderFrame","unrender","getDeclutter","renderDeclutter","renderDeferred","setMapInternal","RenderEventType","handlePrecompose_","renderEvent","arrayLayerState","createRenderer","hasRenderer","clearRenderer","quickselect","defaultCompare","s","sd","swap","RBush$1","maxEntries","_maxEntries","_minEntries","_all","search","bbox","toBBox","nodesToSearch","child","childBBox","leaf","collides","insert","_build","_splitRoot","tmpNode","_insert","createNode","equalsFn","path","indexes","goingUp","findItem","_condense","compareMinX","compareMinY","toJSON","fromJSON","items","N","M","calcBBox","N2","N1","multiSelect","right2","right3","_chooseSubtree","targetNode","minEnlargement","bboxArea","enlargement","isNode","insertPath","_split","_adjustParentBBoxes","_chooseSplitAxis","splitIndex","_chooseSplitIndex","minOverlap","bbox1","distBBox","bbox2","overlap","intersectionArea","compareNodeMinX","compareNodeMinY","_allDistMargin","leftBBox","rightBBox","margin","bboxMargin","siblings","p","destNode","NO_COLOR","colorParseContext","rgbModernRegEx","rgbLegacyAbsoluteRegEx","rgbLegacyPercentageRegEx","hexRegEx","toColorComponent","divider","endsWith","throwInvalidColor","color","parseRgba","rgb","alpha","rgbDivider","hex","step","colorFromHex","colorComponent","desynchronized","invalidCheckFillStyle","colorString","colorFromImage","asString","cacheSize","withAlpha","v","rgbaToLcha","g","q","lchaToRgba","asArray","hasArea","toSize","numTypes","BooleanType","NumberType","StringType","ColorType","NumberArrayType","SizeType","AnyType","typeNames","namedTypes","typeName","names","namedType","includesType","broad","specific","isType","expected","LiteralExpression","isSpecific","CallExpression","operator","newParsingContext","variables","featureId","geometryType","mapState","parse","encoded","expectedType","colorFromString","returnType","parser","parsers","parseCallExpression","Ops","Get","Var","Concat","GeometryType","LineMetric","Any","All","Not","Resolution","Time","Equal","NotEqual","GreaterThan","GreaterThanOrEqualTo","LessThan","LessThanOrEqualTo","Multiply","Divide","Add","Subtract","Clamp","Mod","Pow","Abs","Floor","Ceil","Round","Sin","Cos","Atan","Sqrt","Match","Between","Interpolate","Coalesce","Case","In","Color","Id","Band","Palette","ToString","Has","createCallExpressionParser","hasArgsCount","withGetArgs","withNoArgs","withArgsOfType","usesMapState","withArgsOfReturnType","hasEvenArgs","argsCount","inputType","fallback","interpolationType","base","JSON","stringify","interpolation","stop","operation","argCount","needleType","arg","colors","parsedColors","minArgs","maxArgs","expression","argType","validators","parsed","computeGeometryType","getGeometries","newEvaluationContext","buildExpression","compileExpression","colorValue","compileAssertionExpression","nameExpression","hasOwn","compileAccessorExpression","concat","op","compileLogicalExpression","compileComparisonExpression","compileNumericExpression","compileCaseExpression","compileMatchExpression","previousInput","previousOutput","isColor","interpolateColor","interpolateNumber","compileInterpolateExpression","compileConvertExpression","input1","output1","input2","output2","rgba1","rgba2","lcha1","lcha2","deltaHue","IconImageCache","cache_","patternCache_","cacheSize_","maxCacheSize_","canExpireCache","expire","iconImage","getCacheKey","getPattern","pattern","getImageState","ready","createPattern","setSize","maxCacheSize","shared","taintedTestContext","IconImage","imageState","hitDetectionImage_","color_","imageState_","tainted_","ready_","initializeImage_","isTainted_","dispatchChangeEvent_","replaceColor_","getHitDetectionImage","getSrc","globalCompositeOperation","onChange","cacheKey","iconImageCache","asColorLike","iconCache","canvasPattern","patternCanvasContext","getIconImage","asCanvasPattern","defaultFont","defaultFillStyle","defaultLineCap","defaultLineDash","defaultLineJoin","defaultMiterLimit","defaultStrokeStyle","defaultTextAlign","defaultTextBaseline","defaultPadding","checkedFonts","measureFont","measureContext","textHeights","genericFontFamilies","getFontKey","registerFont","retries","fontFaceSet","async","isAvailable","fontFaces","font","checkFamily","checkWeight","check","done","checkedFontsProperties","fonts","currentRetries","needCheck","has","measureTextHeight","measureElement","metrics","measureText","actualBoundingBoxAscent","actualBoundingBoxDescent","minHeight","maxHeight","border","body","text","measureTextWidth","measureAndCacheTextWidth","reduce","curr","getTextDimensions","baseStyle","chunks","widths","heights","lineWidths","lineWidth","currentWidth","currentHeight","drawImageOrLabel","labelOrImage","originX","originY","save","globalAlpha","contextInstructions","executeLabelInstructions","restore","ImageStyle","opacity_","rotateWithView_","rotateWithView","scale_","scaleArray_","displacement_","displacement","declutterMode_","declutterMode","getScale","getRotateWithView","getDisplacement","getDeclutterMode","getScaleArray","getAnchor","getImageSize","getOrigin","setDisplacement","setRotateWithView","setScale","listenImageChange","unlistenImageChange","RegularShape","hitDetectionCanvas_","fill_","fill","origin_","points","radius2_","radius2","stroke_","stroke","renderOptions_","loading","getFill","getPoints","getRadius2","getStroke","setFill","createHitDetectionCanvas_","fillKey","renderOptions","draw_","setStroke","calculateLineJoinSize_","lineJoin","strokeWidth","miterLimit","r1","r2","miterRatio","bevelAdd","aa","dd","innerMiterRatio","innerLength","createRenderOptions","strokeStyle","lineCap","lineDash","lineDashOffset","getColor","getLineDash","getLineDashOffset","getLineJoin","getLineCap","getMiterLimit","maxRadius","createPath_","setLineDash","drawHitDetectionCanvas_","arc","angle0","radiusC","lineTo","closePath","CircleStyle","setRadius","Fill","patternImage_","setColor","patternImage","CanvasPattern","CanvasGradient","calculateScale","wantedWidth","wantedHeight","Icon","normalizedAnchor_","anchorOrigin_","anchorOrigin","anchorXUnits_","anchorXUnits","anchorYUnits_","anchorYUnits","iconImage_","offset_","offsetOrigin_","offsetOrigin","initialOptions_","onload","imageSize","setAnchor","iconImageSize","Stroke","lineCap_","lineDash_","lineDashOffset_","lineJoin_","miterLimit_","width_","setLineCap","setLineDashOffset","setLineJoin","setMiterLimit","setWidth","Style","geometryFunction_","defaultGeometryFunction","renderer","hitDetectionRenderer_","hitDetectionRenderer","text_","zIndex_","getText","setRenderer","setHitDetectionRenderer","getHitDetectionRenderer","getGeometryFunction","setText","feature","toFunction","styleFunction","defaultStyles","createDefaultStyle","createEditingStyle","white","blue","Text","font_","keepUpright_","keepUpright","textAlign_","textAlign","justify_","justify","repeat_","repeat","textBaseline_","textBaseline","maxAngle_","maxAngle","placement_","placement","overflow_","overflow","offsetX_","offsetY_","backgroundFill_","backgroundFill","backgroundStroke_","backgroundStroke","getFont","getPlacement","getRepeat","getMaxAngle","getOverflow","getKeepUpright","getTextAlign","getJustify","getTextBaseline","getOffsetX","getOffsetY","getBackgroundFill","getBackgroundStroke","getPadding","setOverflow","setFont","setMaxAngle","setOffsetX","setOffsetY","setPlacement","setRepeat","setKeepUpright","setTextAlign","setJustify","setTextBaseline","setBackgroundFill","setBackgroundStroke","setPadding","rulesToStyleFunction","rules","parsingContext","evaluator","buildRuleSet","evaluationContext","flatStylesToStyleFunction","flatStyles","evaluators","buildStyle","nonNullCount","compiledRules","rule","styleLength","someMatched","filterEvaluator","else","styleEvaluator","flatStyle","evaluateFill","buildFill","evaluateStroke","buildStroke","evaluateText","prefix","evaluateValue","stringEvaluator","evaluateBackgroundFill","evaluateBackgroundStroke","evaluateFont","evaluateMaxAngle","numberEvaluator","evaluateOffsetX","evaluateOffsetY","evaluateOverflow","booleanEvaluator","evaluatePlacement","evaluateRepeat","evaluateScale","sizeLikeEvaluator","evaluateRotateWithView","evaluateRotation","evaluateAlign","evaluateJustify","evaluateBaseline","evaluateKeepUpright","evaluatePadding","numberArrayEvaluator","optionalDeclutterMode","buildText","evaluateImage","srcName","requireString","evaluateAnchor","coordinateEvaluator","evaluateOpacity","evaluateDisplacement","optionalIconOrigin","optionalIconAnchorUnits","requireColorLike","optionalColorLike","optionalString","requireNumberArray","optionalNumberArray","optionalNumber","optionalSize","icon","buildIcon","pointsName","radiusName","requireNumber","shape","buildShape","evaluateRadius","Circle","buildCircle","buildImage","evaluateZIndex","empty","evaluateColor","srcEvaluator","offsetEvaluator","sizeEvaluator","patternSizeEvaluator","colorEvaluator","colorLikeEvaluator","patternEvaluator","evaluateWidth","evaluateLineCap","evaluateLineJoin","evaluateLineDash","evaluateLineDashOffset","evaluateMiterLimit","requireSize","requireSizeLike","BaseVectorLayer","renderBuffer","updateWhileAnimating","updateWhileInteracting","declutter_","declutter","renderBuffer_","updateWhileAnimating_","updateWhileInteracting_","getRenderBuffer","getRenderOrder","getUpdateWhileAnimating","getUpdateWhileInteracting","declutterGroup","RBush","setRenderOrder","renderOrder","styleLike","toStyleLike","toStyleFunction","setDeclutter","RenderEvent","inversePixelTransform","MapRenderer","dispatchRenderEvent","calculateMatrices2D","coordinateToPixelTransform","pixelToCoordinateTransform","forEachFeatureAtCoordinate","hitTolerance","checkWrapped","layerFilter","thisArg2","translatedCoordinate","offsets","layerStates","numLayers","matches","tmpCoord","getWrapX","order","distanceSq","hasFeatureAtCoordinate","scheduleExpireIconCache","postRenderFunctions","expireIconCache","CompositeMapRenderer","fontChangeListenerKey_","redrawText","container","firstChild","children_","renderedLayerStates","previousElement","layerIndex","sourceState","removeLayerMapProperty","setLayerMapProperty","optionsInternal","keyboardEventTarget","layerGroup","overlays","createOptionsInternal","renderComplete_","loaded_","boundHandleBrowserEvent_","handleBrowserEvent","maxTilesLoading_","maxTilesLoading","postRenderTimeoutHandle_","animationDelayKey_","animationDelay_","coordinateToPixelTransform_","pixelToCoordinateTransform_","frameIndex_","frameState_","previousExtent_","viewPropertyListenerKey_","viewChangeListenerKey_","layerGroupPropertyListenerKeys_","viewport_","overlayContainer_","overlayContainerStopEvent_","mapBrowserEventHandler_","keyboardEventTarget_","targetChangeHandlerKeys_","targetElement_","resizeObserver_","ResizeObserver","updateSize","defaultControls","defaultInteractions","overlays_","overlayIdIndex_","postRenderFunctions_","tileQueue_","handleTileChange_","handleLayerGroupChanged_","handleViewChanged_","handleSizeChanged_","handleTargetChanged_","viewOptions","setView","addOverlayInternal_","control","interaction","addControl","getControls","addInteraction","getInteractions","addLayer","handleLayerAdd_","addOverlay","overlay","getOverlays","disconnect","forEachFeatureAtPixel","getFeaturesAtPixel","features","addLayersFrom","hasFeatureAtPixel","getEventCoordinate","getEventCoordinateInternal","viewportPosition","getBoundingClientRect","scaleX","scaleY","eventPosition","changedTouches","getTarget","getOverlayById","group","getLoadingOrNotReady","getPixelFromCoordinate","viewCoordinate","ownerDocument","handleMapBrowserEvent","currentDoc","documentElement","interactionsArray","handlePostRender","tileQueue","viewHints","lowOnFrameBudget","unobserve","targetRoot","observe","handleViewPropertyChanged_","updateViewportSize_","handleLayerRemove_","isRendered","renderFrame_","renderSync","handleFontsChanged","removeControl","removeInteraction","removeLayer","removeOverlay","previousFrameState","usedTiles","mapId","renderTargets","nextExtent","equalsExtent","setLayerGroup","oldLayerGroup","computedStyle","getClientRects","oldSize","Overlay","insertFirst","autoPan","transform_","mapPostrenderListenerKey","handleElementChanged","handleMapChanged","handleOffsetChanged","handlePositionChanged","handlePositioningChanged","setElement","setOffset","setPositioning","positioning","setPosition","getElement","getOffset","getPosition","getPositioning","updatePixelPosition","performAutoPan","panIntoView","panIntoViewOptions","mapRect","getRect","overlayRect","myMargin","offsetLeft","offsetRight","offsetTop","offsetBottom","centerPx","newCenterPx","panOptions","box","pageXOffset","pageYOffset","mapSize","updateRenderedPosition","posX","posY","getOptions","TileRange","containsTileRange","tileRange","VectorRenderTile","urlTileCoord","getSourceTiles","removeSourceTiles","context_","executorGroups","loadingSourceTiles","hitDetectionImageData","replayState_","sourceTiles","errorTileKeys","wantedResolution","removeSourceTiles_","wrappedTileCoord","hasContext","getReplayState","dirty","renderedRenderOrder","renderedResolution","renderedRevision","renderedTileResolution","renderedTileRevision","renderedTileZ","originalXHR","format_","features_","url_","getTileUrl","getFormat","onLoad","dataProjection","setFeatures","onError","setLoader","withCredentials","loadFeaturesXhr","url","success","failure","xhr","XMLHttpRequest","open","responseType","status","responseText","responseXML","readFeatures","featureProjection","readProjection","onerror","send","addFeatures","jsonp","errback","callbackParam","script","cleanup","timer","head","ResponseError","response","ClientError","client","getJSON","setRequestHeader","resolveUrl","URL","href","VectorContext","drawCustom","drawGeometry","drawCircle","circleGeometry","drawFeature","drawGeometryCollection","geometryCollectionGeometry","drawLineString","lineStringGeometry","drawMultiLineString","multiLineStringGeometry","drawMultiPoint","multiPointGeometry","drawMultiPolygon","multiPolygonGeometry","drawPoint","pointGeometry","drawPolygon","polygonGeometry","drawText","setFillStrokeStyle","setImageStyle","imageStyle","declutterImageWithText","setTextStyle","textStyle","CanvasImmediateRenderer","viewRotation","userTransform","transformRotation_","viewRotation_","squaredTolerance_","userTransform_","contextFillState_","contextStrokeState_","contextTextState_","fillState_","strokeState_","imageAnchorX_","imageAnchorY_","imageHeight_","imageOpacity_","imageOriginX_","imageOriginY_","imageRotateWithView_","imageRotation_","imageScale_","imageWidth_","textOffsetX_","textOffsetY_","textRotateWithView_","textRotation_","textScale_","textFillState_","textStrokeState_","textState_","pixelCoordinates_","tmpLocalTransform_","drawImages_","pixelCoordinates","localTransform","drawText_","setContextFillState_","setContextStrokeState_","setContextTextState_","strokeText","fillText","moveToLineTo_","close","moveTo","drawRings_","beginPath","setTransform","geometries","getGeometriesArray","flatMidpoint","getFlatMidpoint","geometryExtent","flatMidpoints","getFlatMidpoints","flatInteriorPoint","getEndss","flatInteriorPoints","getFlatInteriorPoints","fillState","contextFillState","strokeState","contextStrokeState","textState","contextTextState","fillStyleColor","strokeStyleColor","strokeStyleLineCap","strokeStyleLineDash","strokeStyleLineDashOffset","strokeStyleLineJoin","strokeStyleWidth","strokeStyleMiterLimit","imagePixelRatio","imageAnchor","imageOrigin","imageScale","textFillStyle","textFillStyleColor","textStrokeStyle","textStrokeStyleColor","textStrokeStyleLineCap","textStrokeStyleLineDash","textStrokeStyleLineDashOffset","textStrokeStyleLineJoin","textStrokeStyleWidth","textStrokeStyleMiterLimit","textFont","textOffsetX","textOffsetY","textRotateWithView","textRotation","textScale","textText","textTextAlign","textTextBaseline","acc","GEOMETRY_RENDERERS","builderGroup","hasText","imageReplay","getBuilder","textReplay","LineString","lineStringReplay","polygonReplay","MultiPoint","hasImage","MultiLineString","MultiPolygon","GeometryCollection","replayGroup","declutterBuilderGroup","geometryRenderer","circleReplay","defaultOrder","feature1","feature2","getSquaredTolerance","getTolerance","renderFeature","loadingPromises","renderGeometry","renderFeatureInternal","getVectorContext","CanvasRenderingContext2D","canvasPixelRatio","multiplyTransform","brokenDiagonalRendering_","drawTestTriangle","u1","u2","clip","verifyBrokenDiagonalRendering","calculateSourceResolution","targetProj","targetMetersPerUnit","compensationFactor","calculateSourceExtentResolution","targetExtent","triangulation","sources","gutter","renderEdges","drawSingle","clipExtent","imageSmoothingEnabled","pixelRound","sourceDataExtent","stitchContext","stitchScale","inverseScale","xPos","yPos","rect","srcWidth","srcHeight","targetTopLeft","getTriangles","triangle","u0","v0","sourceNumericalShiftX","sourceNumericalShiftY","affineCoefs","isBrokenDiagonalRendering","steps","ud","vd","fromResolutionLike","LRUCache","highWaterMark","count_","entries_","oldest_","newest_","deleteOldest","entry","expireCache","keep","containsKey","value_","key_","newer","older","getValues","peekLast","peekLastKey","peekFirstKey","peek","getKeyZXY","hash","hashZXY","withinExtentAndZ","getFullTileRange","tmpTileCoord","TileGrid","origins","origin","origins_","tileSizes_","tileSizes","tileSize_","tileSize","fullTileRanges_","tmpSize_","tmpExtent_","sizes","restrictedTileRange","getTileRangeForExtentAndZ","calculateTileRanges_","forEachTileCoord","forEachTileCoordParentTileRange","tempTileRange","tempExtent","tileCoordExtent","getTileCoordExtent","createOrUpdateTileRange","getTileCoordChildTileRange","getTileRangeForTileCoordAndZ","tileCoordZ","tileCoordX","tileCoordY","getTileCoordForXYAndZ_","getTileCoordCenter","getTileSize","getTileCoordForCoordAndResolution","opt_tileCoord","getTileCoordForXYAndResolution_","reverseIntersectionPolicy","getZForResolution","createOrUpdateTileCoord","getTileCoordForCoordAndZ","getTileCoordResolution","opt_direction","tileCoordIntersectsViewport","viewport","fullTileRanges","WMTSTileGrid","matrixIds_","matrixIds","getMatrixId","getMatrixIds","createFromCapabilitiesMatrixSet","matrixSet","matrixLimits","matrixIdsPropName","identifierPropName","scaleDenominatorPropName","topLeftCornerPropName","switchOriginXY","elt","matrixAvailable","elt_ml","tileWidth","tileHeight","getForProjection","createForProjection","extentFromProjection","createForExtent","resolutionsFromExtent","createXYZ","xyzOptions","gridOptions","half","appendParams","uri","params","keyParams","encodeURIComponent","qs","zRegEx","xRegEx","yRegEx","dashYRegEx","renderXYZTemplate","pickUrl","urls","expandUrl","exec","startCharCode","charCodeAt","stopCharCode","charCode","fromCharCode","createFromTemplate","createFromTemplates","templates","tileUrlFunctions","createFromTileUrlFunctions","tileCoordHash","nullTileUrlFunction","Triangulation","maxSourceExtent","errorThreshold","destinationResolution","sourceMatrix","sourceProj_","targetProj_","transformInvCache","transformInv","applyMatrix","transformInv_","maxSourceExtent_","errorThresholdSquared_","triangles_","wrapsXInSource_","canWrapXInSource_","sourceWorldWidth_","targetWorldWidth_","destinationTopLeft","destinationTopRight","destinationBottomRight","destinationBottomLeft","sourceTopLeft","sourceTopRight","sourceBottomRight","sourceBottomLeft","maxSubdivision","log2","addQuad_","leftBound","newTriangle","addTriangle_","aSrc","bSrc","cSrc","dSrc","sourceQuadExtent","sourceCoverageX","sourceWorldWidth","wrapsX","needsSubdivision","isNotFinite","centerSrc","bc","bcSrc","da","daSrc","ab","abSrc","cd","cdSrc","calculateSourceExtent","ERROR_THRESHOLD","ReprojTile","sourceTileGrid","targetTileGrid","getTileFunction","renderEdges_","gutter_","sourceTileGrid_","targetTileGrid_","wrappedTileCoord_","sourceTiles_","sourcesListenerKeys_","sourceZ_","clipExtent_","maxTargetExtent","limitedTargetExtent","sourceProjExtent","errorThresholdInPixels","triangulation_","sourceRange","srcX","srcY","reproject_","renderReprojected","leftToLoad","sourceListenKey","unlistenSources_","Source","adaptAttributions","attributionsCollapsible_","attributionsCollapsible","wrapX_","interpolate_","viewResolver","viewRejector","viewPromise_","getInterpolate","refresh","setAttributions","attributionLike","TileSource","tilePixelRatio_","tilePixelRatio","tmpSize","tileOptions","zDirection","getGutterForProjection","setKey","getTileGridForProjection","getTile","getTileGrid","getTilePixelRatio","getTilePixelSize","scaleSize","getTileCoordForTileUrlFunction","gridProjection","TileSourceEvent","TileEventType","UrlTile","generateTileUrlFunction_","tileUrlFunction","setUrls","setUrl","tileLoadingKeys_","getTileLoadFunction","getTileUrlFunction","getPrototypeOf","getUrls","uid","tileState","setTileLoadFunction","setTileUrlFunction","TileImage","defaultTileLoadFunction","tileClass","tileGridForProjection","reprojectionErrorThreshold_","reprojectionErrorThreshold","renderReprojectionEdges_","getGutter","thisProj","projKey","createTile_","tileUrl","getTileInternal","setRenderReprojectionEdges","setTileGridForProjection","tilegrid","proj","imageTile","quadKey","digits","mask","XYZ","interpolatePoint","o","cumulativeLengths","lineStringCoordinateAtM","extrapolate","lo","hi","m0","lineStringsCoordinateAtM","setCenterAndRadius","getRadiusSquared_","geometries_","changeEventsKeys_","listenGeometriesChange_","unlistenGeometriesChange_","geometryCollection","cloneGeometries","getGeometriesArrayRecursive","geometriesArray","simplifiedGeometries","simplified","setGeometries","setGeometriesArray","lineStringLength","flatMidpoint_","flatMidpointRevision_","appendCoordinate","lineString","getCoordinateAtM","getCoordinateAt","lineStrings","appendLineString","multiLineString","getLineString","getLineStrings","midpoints","appendPoint","multiPoint","getPoint","endss_","flatInteriorPointsRevision_","flatInteriorPoints_","polygons","thisEndss","appendPolygon","newEndss","multiPolygon","linearRingssArea","linearRingssCenter","getInteriorPoints","getPolygon","prevEnds","getPolygons","lastEnds","RenderFeature","type_","flatCoordinates_","flatMidpoints_","properties_","stride_","simplifiedGeometry_","midpoint","enableSimplifyTransformed","toGeometry","rbush_","RBush_","items_","extents","getAll","getInExtent","forEach_","forEachInExtent","rbush","VectorEventType","VectorSourceEvent","VectorSource","overlaps_","overlaps","strategy_","strategy","allStrategy","useSpatialIndex","featuresRtree_","loadedExtentsRtree_","loadingExtentsCount_","nullGeometryFeatures_","idIndex_","uidIndex_","featureChangeKeys_","featuresCollection_","addFeaturesInternal","bindFeaturesCollection_","addFeature","addFeatureInternal","featureKey","addToIndex_","setupChangeEvents_","handleFeatureChange_","valid","indexedFeature","newFeatures","geometryFeatures","modifyingCollection","removeFeature","fast","removeFeatureInternal","clearEvent","forEachFeature","forEachFeatureAtCoordinateDirect","forEachFeatureInExtent","forEachFeatureIntersectingExtent","getFeaturesCollection","getFeaturesAtCoordinate","getFeaturesInExtent","anExtent","getClosestFeatureToCoordinate","closestFeature","previousMinSquaredDistance","minDistance","getFeatureById","getFeatureByUid","getOverlaps","getUrl","sid","removeFromIdIndex_","hasFeature","loadFeatures","loadedExtentsRtree","extentsToLoad","extentToLoad","removeLoadedExtent","removeFeatures","removed","featureChangeKeys","idString","setOverlaps","fromTransform","mat4","orthographic","bottom","near","far","lr","bt","nf","a00","a01","a02","a03","a10","a11","a12","a13","a20","a21","a22","a23","translation","Canvas","gl","gl_","program_","createProgram","positionLocation","getAttribLocation","texcoordLocation","matrixLocation","getUniformLocation","textureMatrixLocation","textureLocation","positionBuffer","createBuffer","bindBuffer","ARRAY_BUFFER","positions","bufferData","STATIC_DRAW","texcoordBuffer","texcoords","tex","texWidth","texHeight","dstX","dstY","dstWidth","dstHeight","bindTexture","TEXTURE_2D","useProgram","enableVertexAttribArray","vertexAttribPointer","FLOAT","matrix","mat4.orthographic","mat4.translate","mat4.scale","uniformMatrix4fv","texMatrix","mat4.translation","uniform1i","drawArrays","TRIANGLES","createShader","shader","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","fragmentSource","vertexSource","program","vertexShader","VERTEX_SHADER","fragmentShader","FRAGMENT_SHADER","attachShader","linkProgram","getProgramParameter","LINK_STATUS","getProgramInfoLog","createCanvasContextWebGL","releaseGLCanvas","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","canvasGLPool","height_","dataType","resultFrameBuffer","resultTexture","createTexture","texParameteri","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","TEXTURE_MIN_FILTER","LINEAR","TEXTURE_MAG_FILTER","NEAREST","texImage2D","RGBA","createFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","framebuffer","texture","stitchTexture","stitchWidth","stitchHeight","maxTexSize","getParameter","MAX_TEXTURE_SIZE","largeSide","scaleFactor","stitchWidthFixed","stitchHeightFixed","fb","webGLCanvas","WebGLCanvas","enable","SCISSOR_TEST","scissor","deleteFramebuffer","getUVs","triProgram","su0","sv0","su1","sv1","su2","sv2","edgeProgram","burnval","burnvalLocation","uniform4fv","lines","LINES","ReprojDataTile","reprojData_","reprojError_","reprojSize_","sourceTileGridExtent","transformMatrix","dataSources","imageLike","tileData","arrayData","pixelSize","isFloat","pixelCount","DataType","tileDataR","bytesPerElement","BYTES_PER_ELEMENT","bytesPerPixel","bytesPerRow","byteLength","bandCount","targetWidth","targetHeight","outWidth","outHeight","dataR","premultipliedAlpha","antialias","willInterpolate","textureType","getExtension","UNSIGNED_BYTE","reproj","dataSource","dataS","rows","cols","readPixels","flipY","ImageData","putImageData","DataTileSource","tileGridForProjection_","setTileSizes","getReprojTile_","reprojTilePixelRatio","textureSize","sourceLoader","AbortController","loaderOptions","signal","requestZ","requestX","requestY","readRGB","preference","getSamplesPerPixel","interpretation","fileDirectory","PhotometricInterpretation","interpretations","GeoTIFF","globals","photometricInterpretations","CMYK","YCbCr","CIELab","ICCLab","STATISTICS_MAXIMUM","STATISTICS_MINIMUM","workerPool","getBoundingBox","referenceImage","geoKeys","ProjectedCSTypeGeoKey","getCachedProjection","unitsFromCode","ProjLinearUnitsGeoKey","GeographicTypeGeoKey","GeogAngularUnitsGeoKey","getImagesForTIFF","tiff","getImageCount","requests","getImagesForSource","request","blob","fromBlob","overviews","fromUrls","fromUrl","assertEqual","got","rejector","getMaxForDataType","Int8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","GeoTIFFSource","sourceInfo_","numSources","sourceOptions_","sourceOptions","sourceImagery_","sourceMasks_","resolutionFactors_","samplesPerPixel_","nodataValues_","metadata_","normalize_","normalize","addAlpha_","convertToRGB_","convertToRGB","configure_","logError","determineProjection","firstSource","determineTransformMatrix","modelTransformation","ModelTransformation","commonRenderTileSizes","commonSourceTileSizes","samplesPerPixel","nodataValues","metadata","sourceCount","sourceIndex","images","masks","NewSubfileType","imageCount","sourceOrigin","sourceTileSizes","renderTileSizes","sourceResolutions","imageIndex","nodataValue","getGDALNoData","getGDALMetadata","wantedSamples","bands","imageResolutions","sourceTileSize","getTileWidth","getTileHeight","aspectRatio","resolutionFactor","scaledSourceResolutions","reverse","sourceImagery","unshift","outer","nodata","loadTile_","viewExtent","sourceInfo","pool","Pool","pixelBounds","samples","fillValue","bandNumber","sampleIndex","readOptions","interleave","readRasters","maskIndex","composeTile_","sourceSamples","addAlpha","dataLength","dataIndex","pixelIndex","transparent","gain","bias","stats","sourceValue","bandIndex","nodataIsNaN","Versions","IIIF_PROFILE_VALUES","level0","supports","formats","qualities","level1","level2","COMPLIANCE_VERSION1","COMPLIANCE_VERSION2","COMPLIANCE_VERSION3","versionFunctions","iiifInfo","levelProfile","getComplianceLevelSupportedFeatures","imageInfo","scale_factors","tile_width","tile_height","additionalProfile","profile","profileSupports","profileFormats","profileQualities","tiles","scaleFactors","extraFormats","preferredFormat","preferredFormats","extraFeatures","extraQualities","zoomifyImage_","formatPercentage","percentage","toLocaleString","maximumFractionDigits","ReprojImage","getImageFunction","sourceImage","sourcePixelRatio","targetExtent_","sourceImage_","sourcePixelRatio_","sourceListenerKey_","unlistenSource_","ImageSourceEventType","ImageSourceEvent","ImageSource","reprojectedImage_","reprojectedRevision_","wantedExtent_","wantedResolution_","static_","wantedProjection_","setResolutions","findNearestResolution","getImageInternal","requestExtent","getRequestExtent","handleImageChange","defaultImageLoadFunction","imageResolution","getRequestUrl","baseUrl","srid","createLoader","hidpi","F","FORMAT","TRANSPARENT","useOverlay","displayDpi","dpi","mcsW","mcsH","devW","devH","mpp","baseParams","OPERATION","VERSION","LOCALE","CLIENTAGENT","CLIP","SETDISPLAYDPI","SETDISPLAYWIDTH","SETDISPLAYHEIGHT","SETVIEWSCALE","SETVIEWCENTERX","SETVIEWCENTERY","imageExtent","resolutionX","resolutionY","loadError","loadImage","makeLoaderFromTemplates","makeLoaderFromUrlLike","keyCount","keyFromUrlLike","ImageTileSource","DEFAULT_VERSION","GETFEATUREINFO_IMAGE_SIZE","v13","getImageSrc","serverType","REQUEST","getRequestParams","SERVICE","STYLES","getFeatureInfoUrl","projectionObj","QUERY_LAYERS","INFO_FORMAT","getLegendUrl","mpu","knownMapMediaTypes","knownVectorMediaTypes","appendCollectionsQueryParam","tileUrlTemplate","collections","pathname","encodedCollections","searchParams","append","decodeURIComponent","getMapTileUrlTemplate","links","mediaType","fallbackUrlTemplate","link","rel","getVectorTileUrlTemplate","supportedMediaTypes","hrefLookup","supportedMediaType","parseTileMatrixSet","tileMatrixSet","tileMatrixSetLimits","crs","orderedAxes","backwards","matrices","tileMatrices","matrixLookup","limitLookup","limit","tileMatrix","pointOfOrigin","cellSize","matrixWidth","matrixHeight","tileMapWidth","minTileCol","maxTileCol","tileMapHeight","cornerOfOrigin","minTileRow","maxTileRow","intersectExtents","grid","urlTemplate","urlFunction","upsideDown","localContext","tileCol","tileRow","getTileSetInfo","tileSet","tileMatrixSetLink","tileMatrixSetDefinition","parseTileSetMetadata","VectorTile","defaultLoadFunction","tileKeysBySourceTileUrl_","tileGrids_","bufferExtent","sourceZ","sourceTileCoord","sourceTile","sourceTileState","listenChange","sourceTileKey","sourceTileUrl","tileExtent","newTile","DEFAULT_MAX_ZOOM","ATTRIBUTION","ZIndexContext","instructions_","Proxy","push_","pushMethodArgs_","instructions","pushFunction","draw","instructionsAtIndex","instructionAtIndex","LayerRenderer","boundHandleImageChange_","handleImageChange_","layer_","staleKeys_","maxStaleKeys","getStaleKeys","prependStaleKey","getLayer","renderIfReadyAndVisible","pixelContext","CanvasLayerRenderer","tempTransform","pixelTransform","deferredContext_","containerReused","col","row","useContainer","backgroundColor","layerClassName","firstElementChild","transformOrigin","clipUnrotated","topLeft","topRight","bottomRight","bottomLeft","inverted","prepareContainer","canvasTransform","toTransformString","dispatchRenderEvent_","preRender","postRender","renderDeferredInternal","getRenderContext","getRenderTransform","CanvasImageLayerRenderer","imageLayer","viewResolution","imageSource","renderedExtent","imageMapWidth","imageMapHeight","imageResolutionX","imageResolutionY","viewCenter","clipped","dw","dh","BaseImageLayer","ImageLayer","sourceKey","addTileToLookup","tilesByZ","existing","removeTileFromLookup","delete","getRenderExtent","gridExtent","CanvasTileLayerRenderer","tileLayer","extentChanged","renderComplete","renderedExtent_","renderedPixelRatio","renderedProjection","renderedTiles","renderedSourceKey_","renderedSourceRevision_","tempTileRange_","tempTileCoord_","createTileCoord","tileCache_","getTileCache","getOrCreateTile","tileCache","tileSource","tileOrigin","sourceRevision","enqueueTiles","initialZ","preload","minZ","tileQueueKey","findStaleTile_","staleKeys","findAltTiles_","altZ","covered","frameExtent","canvasExtent","getPreload","targetZ","renderExtent","parentZ","canvasScale","zs","currentClip","clips","clipZs","currentZ","currentTilePixelSize","currentScale","originTileCoord","originTileExtent","tileGutter","xIndex","nextX","yIndex","nextY","contextSaved","drawTile","updateUsedTiles","postRenderFunction","tilesCount","updateCacheSize","tileCount","getTileImage","alphaChanged","TileProperty","BaseTileLayer","useInterimTilesOnError","setPreload","setUseInterimTilesOnError","getCacheSize","getUseInterimTilesOnError","TileLayer","createMinion","buffers","meta","imageOps","numBuffers","numBytes","arrays","pixels","createWorker","config","onMessage","lib","worker","Worker","Blob","Buffer","createObjectURL","Processor","threads","imageOps_","workers","onWorkerMessage_","minion","terminated","postMessage","terminate","createFauxWorker","workers_","queue_","maxQueueLength_","queue","running_","dataLookup_","job_","process","inputs","enqueue_","dispatch_","job","slices","resolveJob_","RasterEventType","RasterSourceEvent","RasterSource","processor_","operationType_","operationType","threads_","layers_","createLayer","createLayers","useResolutions_","processSources_","requestedFrameState_","renderedImageCanvas_","renderedRevision_","iMax","sourceOrLayer","sourceAttributions","setOperation","updateFrameState_","allSourcesReady_","imageDatas","onWorkerComplete_","layerOrSource","LayerConfig","stamen_terrain","stamen_terrain_background","stamen_terrain_labels","stamen_terrain_lines","stamen_toner_background","stamen_toner","stamen_toner_labels","stamen_toner_lines","stamen_toner_lite","stamen_watercolor","alidade_smooth","alidade_smooth_dark","alidade_satellite","outdoors","osm_bright","ProviderConfig","retina","CustomTile","preemptive","preemptive_","grid_","keys_","jsonp_","xRelative","yRelative","forDataAtCoordinate","loadInternal_","handleError_","json","requestJSONP","onXHRLoad_","onXHRError_","ELEMENT_ARRAY_BUFFER","DYNAMIC_DRAW","CONTEXT_IDS","attributes","preserveDrawingBuffer","supportedExtensions","XML_SCHEMA_INSTANCE_URI","createElementNS","namespaceURI","qualifiedName","getDocument","getAllTextContent","normalizeWhitespace","getAllTextContent_","accumulator","nodeType","Node","CDATA_SECTION_NODE","TEXT_NODE","nodeValue","nextSibling","isDocument","getAttributeNS","xml","DOMParser","parseFromString","makeArrayExtender","valueReader","objectStack","makeArrayPusher","makeReplacer","makeObjectPropertyPusher","localName","makeObjectPropertySetter","makeChildAppender","nodeWriter","makeArraySerializer","serializersNS","nodeFactory","serializers","makeSimpleNodeFactory","serialize","fixedNodeName","fixedNamespaceURI","newNodeName","nodeName","OBJECT_PROPERTY_NODE_FACTORY","makeSequence","orderedKeys","sequence","makeStructureNS","namespaceURIs","structure","structureNS","parseNode","parsersNS","nextElementSibling","pushParseAndPop","pushSerializeAndPop","xmlSerializer_","document_","getXMLSerializer","XMLSerializer","implementation","createDocument","BaseTileRepresentation","helper","setTile","uploadTile","setReady","setHelper","BufferUsage","WebGLArrayBuffer","usage","usage_","ofSize","getArrayClassForType","fromArray","fromArrayBuffer","setArray","ArrayType","getUsage","ContextEventType","WebGLPostProcessingPass","webGlContext","scaleRatio_","scaleRatio","renderTargetTexture_","renderTargetTextureSize_","frameBuffer_","depthBuffer_","createRenderbuffer","renderTargetProgram_","renderTargetVerticesBuffer_","renderTargetAttribLocation_","renderTargetUniformLocation_","renderTargetOpacityLocation_","renderTargetTextureLocation_","uniforms_","uniforms","location","getRenderTargetTexture","getGL","init","drawingBufferWidth","drawingBufferHeight","getFrameBuffer","bindRenderbuffer","RENDERBUFFER","getDepthBuffer","internalFormat","renderbufferStorage","DEPTH_COMPONENT16","framebufferRenderbuffer","DEPTH_ATTACHMENT","nextPass","preCompose","postCompose","activeTexture","TEXTURE0","canvasId","getContextAttributes","clearColor","clearDepth","DEPTH_TEST","BLEND","blendFunc","ONE","ONE_MINUS_SRC_ALPHA","uniform2f","uniform1f","applyUniforms","textureSlot","uniform","uniform3f","uniform4f","DefaultUniform","PROJECTION_MATRIX","SCREEN_TO_WORLD_MATRIX","TIME","ZOOM","VIEWPORT_SIZE_PX","PIXEL_RATIO","HIT_DETECTION","AttributeType","canvasCache","getSharedCanvasCacheKey","uniqueCanvasCacheKeyCount","WebGLHelper","boundHandleWebGLContextLost_","handleWebGLContextLost","boundHandleWebGLContextRestored_","handleWebGLContextRestored","canvasCacheKey_","canvasCacheKey","getUniqueCanvasCacheKey","cacheItem","users","getOrCreateContext","bufferCache_","extensionCache_","currentProgram_","needsToBeRecreated_","offsetRotateMatrix_","offsetScaleMatrix_","tmpMat4_","uniformLocationsByProgram_","attribLocationsByProgram_","setUniforms","postProcessPasses_","postProcesses","shaderCompileErrors_","maxAttributeCount_","MAX_VERTEX_ATTRIBS","addUniforms","canvasCacheKeyMatches","bufferKey","bufferCache","webGlBuffer","flushBufferData","deleteBuffer","buf","loseContext","prepareDraw","disableAlphaBlend","enableDepth","getCanvas","depthRange","ZERO","depthFunc","LEQUAL","bindFrameBuffer","frameBuffer","bindInitialFrameBuffer","slot","uniformName","bindAttribute","attributeName","getAttributeLocation","prepareDrawToRenderTarget","renderTarget","getFramebuffer","getDepthbuffer","getTexture","drawElements","elementType","UNSIGNED_INT","numItems","offsetInBytes","finalizeDraw","applyFrameState","setUniformFloatValue","setUniformFloatVec2","applyHitDetectionUniform","loc","WebGLTexture","prevValue","imageReady","setUniformMatrixValue","disableAllAttributes_","getProgram","fragmentShaderSource","vertexShaderSource","deleteShader","programUid","makeProjectionTransform","uniform2fv","setUniformFloatVec4","disableVertexAttribArray","enableAttributeArray_","attribName","enableAttributes","computeAttributesStride","attr","getByteSizeFromType","needsToBeRecreated","PaletteTexture","texture_","deleteTexture","tmpArray4","WebGLRenderTarget","helper_","framebuffer_","depthbuffer_","dataCacheDirty_","updateSize_","clearCachedData","readAll","readPixel","MixedGeometryBatch","globalCounter_","refToFeature_","Map","uidToRef_","freeGlobalRef_","polygonBatch","entries","geometriesCount","verticesCount","ringsCount","pointBatch","lineStringBatch","projectionTransform","addGeometry_","clearFeatureEntryInPointBatch_","featureUid","flatCoordss","clearFeatureEntryInLineStringBatch_","clearFeatureEntryInPolygonBatch_","multiPolygonGeom","addCoordinates_","multiLineGeom","multiPointGeom","polygonGeom","pointGeom","lineGeom","flatCoords","multiPolygonEndss","polygonEnds","prevPolygonEnds","endIndex","multiLineEnds","multiPolygonEnds","addRefToEntry_","ringsVerticesCounts","ringsVerticesCount","ind","getFlatCoordinatesXY","getFlatCoordinatesXYM","currentRef","ref","removeRef_","changeFeature","getFeatureFromRef","featureFilter","filtered","TileGeometry","styleRenderers","batch_","styleRenderers_","maskVertices","generateMaskBuffer_","translateTransform","generatePromises","generateBuffers","disposeBuffers","disposeBuffersOfType","typeBuffers","pointBuffers","lineStringBuffers","polygonBuffers","bindAndConfigure","resampleFilter","uploadDataTexture","canInterpolate","unpackAlignment","LUMINANCE","LUMINANCE_ALPHA","RGB","oldUnpackAlignment","UNPACK_ALIGNMENT","pixelStorei","TileTexture","textures","renderSize_","uploadImageTexture","textureCount","textureDataArrays","textureIndex","rowOffset","colCount","rowIndex","colIndex","dataValue","textureData","getImagePixelData_","renderCol","renderRow","renderWidth","renderHeight","sourceWidthWithoutGutter","sourceHeightWithoutGutter","sourceCol","sourceRow","getArrayPixelData_","sourceSize","sourceWidth","sourceHeight","getPixelData","defaultTileSize","parseTokenClaims","token","base64EncodedClaims","chars","atob","uriEncodedChars","getProjectionIdentifier","ogcId","equivalentProjections","serializeFunction","WebGLLayerRenderer","inversePixelTransform_","postProcesses_","onMapChanged_","clearCache","removeHelper","dispatchPreComposeEvent","dispatchPostComposeEvent","incrementGroup","groupNumber","afterHelperCreated","prepareFrameInternal","Uniforms","TILE_TRANSFORM","TRANSITION_ALPHA","DEPTH","RENDER_EXTENT","PATTERN_ORIGIN","GLOBAL_ALPHA","depthForZ","newTileRepresentationLookup","tileIds","representationsByZ","lookupHasTile","tileRepresentationLookup","addTileRepresentationToLookup","tileRepresentation","getTileCoordKey","WebGLBaseTileLayerRenderer","tileTransform_","tempMat4","tempSize_","tileRepresentationCache","renderedProjection_","createTileRepresentation","beforeTilesRender","tilesWithAlpha","beforeTilesMaskRender","renderTile","tileTransform","depth","renderTileMask","tileZ","drawTile_","alphaLookup","tileCoordKey","tileWidthWithGutter","tileHeightWithGutter","centerI","centerJ","tileScale","tileCenterI","tileCenterJ","resetTransform","scaleTransform","rotateTransform","blend","beforeFinalize","BaseUniforms","TILE_TEXTURE_ARRAY","TEXTURE_PIXEL_WIDTH","TEXTURE_PIXEL_HEIGHT","TEXTURE_RESOLUTION","TEXTURE_ORIGIN_X","TEXTURE_ORIGIN_Y","Attributes","TEXTURE_COORD","attributeDescriptions","WebGLTileLayerRenderer","vertexShader_","fragmentShader_","indices_","paletteTextures_","paletteTextures","paletteTexture","tileTexture","paletteIndex","mat4FromTransform","gutterExtent","getSources","tileTextureCache","deleteProgram","U","TEXTURE","VELOCITY_TEXTURE","POSITION_TEXTURE","PARTICLE_COUNT_SQRT","MAX_SPEED","RANDOM_SEED","SPEED_FACTOR","DROP_RATE","DROP_RATE_BUMP","OPACITY","A","V","FlowLayerRenderer","tileVertexShader","tileFragmentShader","maxSpeed","particleColorFragmentShader_","particleColorFragmentShader","velocityTexture_","particleCountSqrt_","particles","particleIndexBuffer_","quadBuffer_","particlePositionProgram_","particlePositionVertexShader_","particlePositionVertexShader","particlePositionFragmentShader_","particlePositionFragmentShader","previousPositionTexture_","nextPositionTexture_","particleColorProgram_","particleColorVertexShader_","particleColorVertexShader","textureProgram_","textureVertexShader_","textureVertexShader","textureFragmentShader_","textureFragmentShader","previousTrailsTexture_","nextTrailsTexture_","fadeOpacity_","maxSpeed_","speedFactor_","speedFactor","dropRate_","dropRateBump_","tempVec2_","renderedWidth_","renderedHeight_","particleCount","particleIndices","particleIndexBuffer","quadIndices","quadBuffer","particlePositions","random","createSizeDependentTextures_","screenWidth","screenHeight","blank","copyTexImage2D","drawParticleTrails_","updateParticlePositions_","drawTexture_","drawParticleColor_","SRC_ALPHA","current","POINTS","WebGLWorkerMessageType","colorEncodeId","radix","divide","colorDecodeId","mult","getWorldParameters","endWorld","WebGLPointsLayerRenderer","projectionMatrixTransform","sourceRevision_","verticesBuffer_","indicesBuffer_","hitDetectionEnabled_","hitDetectionEnabled","customAttributes","attribute","currentTransform_","renderTransform_","invertRenderTransform_","renderInstructions_","hitRenderTarget_","lastSentId","worker_","createWebGLWorker","received","vertexBuffer","indexBuffer","makeInverseTransform","renderInstructions","featureCache_","featureCount_","sourceListenKeys_","handleSourceFeatureAdded_","handleSourceFeatureChanged_","handleSourceFeatureDelete_","handleSourceFeatureClear_","startWorld","renderWorlds","vectorSource","viewNotMoving","sourceChanged","BaseVector","rebuildBuffers_","singleInstructionLength","totalSize","tmpCoords","tmpColor","idx","featureCache","hitColor","customAttributesSize","forHitDetection","world","renderCount","numberToGlsl","arrayToGlsl","colorToGlsl","sizeToGlsl","stringToFloatMap","stringToFloatCounter","getStringNumberEquivalent","string","stringToGlsl","uniformNameForVariable","variableName","newCompilationContext","functions","GET_BAND_VALUE_FUNC","PALETTE_TEXTURE_ARRAY","FEATURE_ID_PROPERTY_NAME","GEOMETRY_TYPE_PROPERTY_NAME","UNDEFINED_PROP_VALUE","compilationContext","compile","createCompiler","compilers","propName","varName","compiledArgs","firstValue","secondValue","exponent","stop1","stop2","funcName","computeOperatorFunctionName","tests","band","xOffset","yOffset","ifBlocks","colorIndex","numColors","palette","paletteName","compiler","pushCustomAttributesInRenderInstructions","batchEntry","currentIndex","getCustomAttributesSize","generatePointRenderInstructions","batch","totalInstructionsCount","renderIndex","generateLineStringRenderInstructions","generatePolygonRenderInstructions","earcut","holeIndices","dim","hasHoles","outerLen","outerNode","linkedList","triangles","next","invSize","list","steiner","getLeftmost","compareXYSlope","eliminateHole","eliminateHoles","earcutLinked","clockwise","sum","signedArea","insertNode","removeNode","filterPoints","again","ear","zOrder","prevZ","nextZ","numMerges","inSize","tail","pSize","qSize","sortLinked","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","ax","bx","cx","ay","by","cy","pointInTriangleExceptFirst","maxZ","locallyInside","isValidDiagonal","splitPolygon","hole","bridge","hx","hy","qx","mx","my","tanMin","pointInTriangle","sectorContainsSector","findHoleBridge","bridgeReverse","leftmost","py","intersectsPolygon","inside","middleInside","p1","p2","q1","q2","o1","sign","o2","o3","o4","onSegment","num","an","bp","LINESTRING_ANGLE_COSINE_CUTOFF","tmpArray_","bufferPositions_","vertexPosition","indexPosition","writePointVertex","COMMON_HEADER","DEFAULT_STYLE","ShaderBuilder","attributes_","hasSymbol_","symbolSizeExpression_","symbolRotationExpression_","symbolOffsetExpression_","symbolColorExpression_","texCoordExpression_","discardExpression_","symbolRotateWithView_","hasStroke_","strokeWidthExpression_","strokeColorExpression_","strokeOffsetExpression_","strokeCapExpression_","strokeJoinExpression_","strokeMiterLimitExpression_","strokeDistanceFieldExpression_","hasFill_","fillColorExpression_","vertexShaderFunctions_","fragmentShaderFunctions_","addUniform","addAttribute","varyingExpression","varyingType","varyingName","setSymbolSizeExpression","getSymbolSizeExpression","setSymbolRotationExpression","setSymbolOffsetExpression","getSymbolOffsetExpression","setSymbolColorExpression","getSymbolColorExpression","setTextureCoordinateExpression","setFragmentDiscardExpression","getFragmentDiscardExpression","setSymbolRotateWithView","setStrokeWidthExpression","setStrokeColorExpression","getStrokeColorExpression","setStrokeOffsetExpression","setStrokeCapExpression","setStrokeJoinExpression","setStrokeMiterLimitExpression","setStrokeDistanceFieldExpression","setFillColorExpression","getFillColorExpression","addVertexShaderFunction","addFragmentShaderFunction","getSymbolVertexShader","getSymbolFragmentShader","getStrokeVertexShader","getStrokeFragmentShader","getFillVertexShader","getFillFragmentShader","expressionToGlsl","packColor","UNPACK_COLOR_FN","getGlslSizeFromType","getGlslTypeFromType","applyContextToBuilder","builder","variable","glslType","functionName","generateUniformsFromContext","generateAttributesFromContext","computeHash","parseCommonSymbolProperties","vertContext","getColorFromDistanceField","distanceField","fillColor","strokeColor","parseImageProperties","textureId","parseImageOffsetProperties","sampleSize","offsetExpression","parseLiteralStyle","sizeExpression","fullsize","shiftPx","offsetPx","parseIconProperties","currentPoint","numPoints","shapeField","colorExpression","parseShapeProperties","parseCircleProperties","sampleSizeExpression","spacingExpression","textureName","tintExpression","dashPattern","dashFunctionName","dashLengthsParamsDef","totalLengthDef","currentDashOffset","distanceExpression","dashLengthsCalls","parseStrokeProperties","parseFillProperties","parsedFilter","defineSpecialInput","contextPropName","glslPropName","attrSize","breakDownFlatStyle","previousFilters","ruleStyles","currentFilter","stylesWithFilters","WEBGL_WORKER","getWebGLWorker","workerMessageCounter","VectorStyleRenderer","styleOrShaders","enableHitDetection","asShaders","asRule","parseResult","fillProgram_","strokeProgram_","symbolProgram_","fillVertexShader_","fillFragmentShader_","strokeVertexShader_","strokeFragmentShader_","symbolVertexShader_","symbolFragmentShader_","featureFilter_","computeFeatureFilter","hitDetectionAttributes","customAttributes_","customAttributesDesc","polygonAttributesDesc_","lineStringAttributesDesc_","pointAttributesDesc_","compiled","evalContext","geometryBatch","filteredBatch","generateRenderInstructions_","generateBuffersForType_","polygonInstructions","lineStringInstructions","pointInstructions","invertVerticesTransform","messageId","messageType","renderInstructionsTransform","handleMessage","verticesBuffer","indicesBuffer","preRenderCallback","renderInternal_","WebGLVectorLayerRenderer","disableHitDetection","tmpCoords_","tmpTransform_","currentFrameStateTransform_","styleVariables_","styles_","buffers_","initialFeaturesAdded_","addInitialFeatures_","createRenderers_","applyUniforms_","batchInvertTransform","setFromTransform","TILE_MASK_TEXTURE","TILE_ZOOM_LEVEL","POSITION","WebGLVectorTileLayerRenderer","tileMaskTarget_","tileMaskIndices_","tileMaskAttributes_","tileMaskProgram_","initTileMask_","addBuilderParams","exisitingDiscard","discardFromMask","shaders","tileRep","Instruction","fillInstruction","strokeInstruction","beginPathInstruction","closePathInstruction","CanvasBuilder","maxLineWidth","beginGeometryInstruction1_","beginGeometryInstruction2_","bufferedMaxExtent_","tmpCoordinate_","hitDetectionInstructions","applyPixelRatio","dashArray","dash","appendFlatPointCoordinates","getBufferedMaxExtent","myEnd","appendFlatLineCoordinates","closed","skipFirst","lastXCoord","lastYCoord","nextCoord","lastRel","nextRel","skipped","drawCustomCoordinates_","builderEnds","builderEnd","beginGeometry","builderBegin","builderEndss","myEnds","CanvasInstruction","endGeometry","finish","reverseHitDetectionInstructions","instruction","fillStyleToState","fillPatternScale","strokeStyleToState","createFill","applyStroke","createStroke","updateFillStyle","currentFillStyle","updateStrokeStyle","currentStrokeStyle","currentLineCap","currentLineDash","currentLineDashOffset","currentLineJoin","currentLineWidth","currentMiterLimit","endGeometryInstruction","CanvasImageBuilder","imagePixelRatio_","anchorX_","anchorY_","originX_","originY_","declutterImageWithText_","myBegin","filteredFlatCoordinates","sharedData","CanvasLineStringBuilder","drawFlatCoordinates_","moveToLineToInstruction","lastStroke","CanvasPolygonBuilder","drawFlatCoordinatess_","numEnds","setFillStrokeStyles_","circleInstruction","lineChunk","chunkLength","cursor","chunkM","currentChunk","missing","matchingChunk","acos","m12","m23","x12","y12","x23","y23","chunkStart","chunkEnd","TEXT_ALIGN","middle","hanging","alphabetic","ideographic","CanvasTextBuilder","labels_","textKeepUpright_","fillStates","strokeStates","textStates","textKey_","fillKey_","strokeKey_","geometryWidths","beg","saveTextStates_","p0","p3","hitDetectionBackgroundFill","flatOffset","oo","cc","chunk","chunkBegin","drawChars_","strokeKey","textKey","baseline","textKeepUpright","BATCH_CONSTRUCTORS","PolygonBuilder","Default","Builder","ImageBuilder","LineStringBuilder","TextBuilder","BuilderGroup","tolerance_","maxExtent_","resolution_","buildersByZIndex_","builderInstructions","zKey","builders","builderKey","builderInstruction","builderType","zIndexKey","replays","replay","Constructor","drawTextOnPath","startM","segmentM","advance","beginX","beginY","startOffset","startLength","endM","flat","singleSegment","previousAngle","iStart","charLength","tmpExtent","p4","getDeclutterBox","replayImageOrLabelArgs","declutterBox","rtlRegEx","horizontalTextAlign","align","createTextChunks","line","richTextToPlainText","part","Executor","deferredRendering","alignAndScaleFill_","coordinateCache_","renderedTransform_","widths_","zIndexContext_","getZIndexContext","createLabel","leftRight","strokeInstructions","fillInstructions","previousFont","lineOffset","widthHeightIndex","lineWidthIndex","fillStrokeArgs","replayTextBackground_","setStrokeStyle_","calculateImageOrLabelDimensions_","sheetWidth","sheetHeight","snapToPixel","fillStroke","boxW","boxH","boxX","boxY","drawImageX","drawImageY","drawImageW","drawImageH","replayImageOrLabel_","scaledCanvasSize","imageOrLabel","strokePadding","alignAndScale","repeatSize","drawLabelWithPointPlacement_","execute_","featureCallback","hitExtent","declutterTree","zIndexContext","transformSetFromArray","prevX","prevY","roundX","roundY","pendingFill","pendingStroke","coordinateCache","viewRotationFromTransform","batchSize","currentGeometry","labelWithAnchor","backgroundFillInstruction","backgroundStrokeInstruction","widthIndex","imageArgs","imageDeclutterMode","imageDeclutterBox","renderImage","renderText","imageDeclutter","measurePixelRatio","pixelRatioScale","cachedWidths","pathLength","textLength","parts","drawChars","execute","executeHitDetection","ALL","DECLUTTER","NON_DECLUTTER","ExecutorGroup","allInstructions","executorsByZIndex_","hitDetectionContext_","hitDetectionTransform_","renderedContext_","deferredZIndexContexts_","createExecutors_","flatClipCoords","getClipCoords","executors","instructionByZindex","hasExecutors","candidates","declutteredFeatures","contextSize","newContext","getPixelIndexArray","executor","targetContext","builderTypes","maxBuilderTypes","requireClip","getDeferredZIndexContexts","getRenderedContext","deferredZIndexContexts","circlePixelIndexArrayCache","maxDistanceSq","distances","HIT_DETECT_RESOLUTION","createHitDetectionImageData","userExtent","featureCount","indexFactor","featuresByZIndex","featureStyleFunction","padStart","originalStyle","imgSize","imgContext","byGeometryType","zIndexKeys","geomAndStyle","kk","hitDetect","resultFeatures","CanvasVectorLayerRenderer","vectorLayer","boundHandleStyleImageChange_","handleStyleImageChange_","animatingOrInteracting_","hitDetectionImageData_","clipped_","renderedFeatures_","renderedResolution_","wrappedRenderedExtent_","renderedRotation_","renderedCenter_","renderedPixelRatio_","renderedRenderOrder_","renderedFrameDeclutter_","replayGroup_","replayGroupChanged","clipping","targetContext_","executorGroup","declutterable","setDrawContext_","resetDrawContext_","getSquaredRenderTolerance","lastIndexOf","animating","interacting","frameStateExtent","vectorLayerRevision","vectorLayerRenderBuffer","vectorLayerRenderOrder","defaultRenderOrder","loadExtents","wrapCoordinateX","loadExtent","wrapExtentX","CanvasBuilderGroup","getRenderTolerance","replayGroupInstructions","CanvasVectorImageLayerRenderer","vectorRenderer_","layerImageRatio_","getImageRatio","coordinateToVectorPixelTransform_","renderedPixelToCoordinateTransform_","vectorPixel","vectorRenderer","imageLayerState","imageFrameState","IMAGE_REPLAYS","hybrid","vector","VECTOR_REPLAYS","CanvasVectorTileLayerRenderer","renderedLayerRevision_","renderedOpacity_","tileClipContexts_","updateExecutorGroup_","tileImageNeedsRender_","renderTileImage_","layerRevision","builderState","layerUid","tt","sourceTileExtent","sharedExtent","builderExtent","bufferedExtent","executorGroupInstructions","replayExtent","getRenderMode","renderingReplayGroup","CanvasExecutorGroup","foundFeature","tileCoordString","tilePixel","visitedSourceTiles","tileFeatures","hifi","getTileRenderTransform","executorGroupZIndexContexts","usedZIndices","executorGroupZindexContext","zIndexContexts","tileClipContext","worldOffset","renderMode","replayTypes","tileClipContexts","clipContext","replayState","renderPixelRatio","renderScale","pixelScale","registered","register","proj4","projCodes","defs","def","projName","axis","to_meter","code1","proj1","code2","proj2","epsgLookup","fetch","ok","BA","BU","quadVertexShader","FlowLayer","particles_","handleSourceUpdate_","updateStyleVariables","parsedStyle","pipeline","variableNames","uniformDeclarations","functionDefintions","parseStyle","geoA","geoB","geoStack","fractionStack","fractions","geoM","fracA","fracB","fracM","maxIterations","meridian","frac","parallel","lon2","VectorLayer","DEFAULT_STROKE_STYLE","INTERVALS","DEFAULT_GRADIENT","contrast","exposure","saturation","gamma","brightness","numVariables","WebGLTileLayer","sources_","renderedSource_","getSourceBandCount_","MAX_SAFE_INTEGER","renderSources","altSources","DragAndDropEventType","DragAndDropEvent","file","DrawEventType","DrawEvent","getSquaredDistance","getCoordinate","getCumulativeSquaredDistance","lowIndex","highIndex","lowWholeIndex","highWholeIndex","interpolateCoordinate","appendGeometryTraceTargets","targets","appendTraceTarget","polys","sharedUpdateInfo","ring","getPointSegmentRelationship","sharedRel","getDefaultStyleFunction","ExtentEventType","ExtentEvent","getDefaultExtentStyleFunction","getDefaultPointerStyleFunction","getPointHandler","fixedPoint","getEdgeHandler","fixedP1","fixedP2","readNumber","writeNumber","to5","differentNumber","tempSegment","ModifyEventType","ModifyEvent","compareIndexes","projectedDistanceToSegmentDataSquared","pointCoordinates","segmentData","distanceToCenterSquared","squaredCoordinateDistance","distanceToCircumference","closestOnSegmentData","SelectEventType","SelectEvent","selected","deselected","originalFeatureStyles","Select","boundAddFeature_","addFeature_","boundRemoveFeature_","removeFeature_","addCondition_","addCondition","removeCondition_","removeCondition","toggleCondition_","toggleCondition","multi_","multi","filter_","hitTolerance_","layerFilter_","featureLayerAssociation_","addFeatureLayerAssociation_","getHitTolerance","setHitTolerance","restorePreviousStyle_","applySelectedStyle_","removeFeatureLayerAssociation_","SnapEventType","SnapEvent","vertex","vertexPixel","GEOMETRY_SEGMENTERS","segments","segmenter","getFeatureFromEvent","tempExtents","tempSegmentData","TranslateEventType","TranslateEvent","startCoordinate","flipXY","destOffset","FeatureFormat","defaultFeatureProjection","featureClass","getReadOptions","adaptOptions","readFeature","readGeometry","writeFeature","writeFeatures","writeGeometry","transformGeometryWithOptions","write","equivalentProjection","fromProjection","toProjection","transformExtentWithOptions","GeometryConstructor","createRenderFeature","orientFlatCoordinates","createGeometry","JSONFeature","readFeatureFromObject","getObject","readFeaturesFromObject","readGeometryFromObject","readProjectionFromObject","writeFeatureObject","writeFeaturesObject","writeGeometryObject","GEOMETRY_READERS","getGeometryLayout","paths","GEOMETRY_WRITERS","esriJSON","hasZM","getHasZM","hasZ","hasM","esriJSONPolygon","flatRing","outerRings","holes","matched","outerRing","convertRings","geometryReader","geometryWriter","XMLFeature","readFeatureFromDocument","readFeatureFromNode","readFeaturesFromDocument","readFeaturesFromNode","ELEMENT_NODE","readGeometryFromDocument","readGeometryFromNode","readProjectionFromDocument","readProjectionFromNode","writeFeatureNode","serializeToString","writeFeaturesNode","writeGeometryNode","GMLNS","ONLY_WHITESPACE_RE","GMLBase","featureType","featureNS","srsName","schemaLocation","FEATURE_COLLECTION_PARSERS","namespace","featureMember","readFeaturesInternal","featureMembers","defaultPrefix","ns","featureTypes","readFeatureElement","readGeometryOrExtent","getAttribute","GEOMETRY_PARSERS","readExtentElement","readGeometryElement","readFeatureElementInternal","asFeature","geometryName","_content_","fid","readPoint","readFlatCoordinatesFromNode","readMultiPoint","MULTIPOINT_PARSERS","readMultiLineString","MULTILINESTRING_PARSERS","readMultiPolygon","MULTIPOLYGON_PARSERS","pointMemberParser","POINTMEMBER_PARSERS","lineStringMemberParser","LINESTRINGMEMBER_PARSERS","polygonMemberParser","POLYGONMEMBER_PARSERS","readLineString","readFlatLinearRing","GEOMETRY_FLAT_COORDINATES_PARSERS","readLinearRing","readPolygon","flatLinearRings","FLAT_LINEAR_RINGS_PARSERS","internalOptions","readBoolean","readBooleanString","readDateTime","dateTime","readDecimal","readDecimalString","readPositiveInteger","readNonNegativeIntegerString","readString","writeBooleanTextNode","bool","writeStringTextNode","writeCDATASection","createCDATASection","writeDateTimeTextNode","date","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","writeDecimalTextNode","toPrecision","writeNonNegativeIntegerTextNode","nonNegativeInteger","pointMember","pointMembers","lineStringMember","lineStringMembers","polygonMember","polygonMembers","RING_PARSERS","whiteSpaceStart","whiteSpaceEnd","cdataCharacters","MULTIGEOMETRY_TO_MEMBER_NODENAME","MultiCurve","MultiSurface","GML2","readFlatCoordinates","containerSrs","coordsGroups","readBox","BOX_PARSERS_","innerBoundaryIsParser","flatLinearRing","outerBoundaryIsParser","GEOMETRY_NODE_FACTORY_","multiSurface","surface","multiCurve","writeFeatureElement","writeGeometryElement","writeCurveOrLineString","createCoordinatesNode_","writeCoordinates_","writeCurveSegments_","writeLineStringOrCurveMember","writeMultiCurveOrLineString","curve","LINESTRINGORCURVEMEMBER_SERIALIZERS","MULTIGEOMETRY_MEMBER_NODE_FACTORY_","GEOMETRY_SERIALIZERS","getCoords_","writeSurfaceOrPolygon","RING_SERIALIZERS","RING_NODE_FACTORY_","patches","writeSurfacePatches_","exteriorWritten","writeRing","writeLinearRing","writePoint","writeMultiPoint","POINTMEMBER_SERIALIZERS","writePointMember","writeMultiSurfaceOrPolygon","SURFACEORPOLYGONMEMBER_SERIALIZERS","writeSurfaceOrPolygonMember","writeEnvelope","ENVELOPE_SERIALIZERS","innerBoundaryIs","outerBoundaryIs","Box","Curve","Surface","Envelope","curveMember","surfaceMember","lowerCorner","upperCorner","GML3","surface_","curve_","multiCurve_","multiSurface_","readMultiCurve","MULTICURVE_PARSERS","readFlatCurveRing","readMultiSurface","MULTISURFACE_PARSERS","curveMemberParser","CURVEMEMBER_PARSERS","surfaceMemberParser","SURFACEMEMBER_PARSERS","readPatch","PATCHES_PARSERS","readSegment","SEGMENTS_PARSERS","readPolygonPatch","readLineStringSegment","interiorParser","exteriorParser","readSurface","SURFACE_PARSERS","readCurve","CURVE_PARSERS","readEnvelope","ENVELOPE_PARSERS","readFlatPos","substr","readFlatPosList","contextDimension","asXYZ","writePos_","srsDimension","writePosList_","posList","writeFeatureMembers_","geom","setAttributeNS","interior","exterior","curveMembers","surfaceMembers","PolygonPatch","LineStringSegment","Ring","GML","GML32","NAMESPACE_URIS","FEATURE_READER","rte","readRte","trk","readTrk","wpt","readWpt","GPX_PARSERS","LINK_PARSERS","AUTHOR_PARSERS","email","domain","parseLink","METADATA_PARSERS","desc","author","copyright","COPYRIGHT_PARSERS","keywords","bounds","minlat","minlon","maxlat","maxlon","extensions","parseExtensions","year","license","GPX_SERIALIZERS","RTE_SEQUENCE","RTE_SERIALIZERS","TRK_SEQUENCE","TRK_SERIALIZERS","writeWptType","RTE_PARSERS","cmt","rtept","RTEPT_PARSERS","rteValues","ele","TRK_PARSERS","trkseg","TRKSEG_PARSERS","trkpt","TRKPT_PARSERS","trkValues","WPT_PARSERS","magvar","geoidheight","sym","fix","sat","hdop","vdop","pdop","ageofdgpsdata","dgpsid","LINK_SEQUENCE","LINK_SERIALIZERS","writeLink","RTEPT_TYPE_SEQUENCE","TRKSEG_SERIALIZERS","TRKSEG_NODE_FACTORY","WPT_TYPE_SEQUENCE","WPT_TYPE_SERIALIZERS","GEOMETRY_TYPE_TO_NODENAME","GPX_NODE_FACTORY","layoutOptions","applyLayoutOptions","readGeometryInternal","readPointGeometry","readLineStringGeometry","readPolygonGeometry","readMultiPointGeometry","readMultiLineStringGeometry","readMultiPolygonGeometry","readGeometryCollectionGeometry","geoJSON","writePointGeometry","writeLineStringGeometry","rightHanded","writePolygonGeometry","writeMultiPointGeometry","writeMultiLineStringGeometry","writeMultiPolygonGeometry","writeGeometryCollectionGeometry","TextFeature","readFeatureFromText","readFeaturesFromText","readGeometryFromText","readProjectionFromText","writeFeatureText","writeFeaturesText","writeGeometryText","B_RECORD_RE","H_RECORD_RE","HFDTE_RECORD_RE","HFDTEDATE_RECORD_RE","NEWLINE_RE","GX_NAMESPACE_URIS","ICON_ANCHOR_UNITS_MAP","insetPixels","PLACEMARK_PARSERS","ExtendedData","extendedDataParser","Region","regionParser","MultiGeometry","readMultiGeometry","readStyle","StyleMap","styleMapValue","readStyleMapValue","placemarkObject","address","description","phoneNumber","styleUrl","readStyleURL","visibility","MultiTrack","GX_MULTITRACK_GEOMETRY_PARSERS","Track","readGxTrack","NETWORK_LINK_PARSERS","Link","readURI","CAMERA_PARSERS","Altitude","Longitude","Latitude","Tilt","AltitudeMode","Heading","Roll","REGION_PARSERS","LatLonAltBox","LAT_LON_ALT_BOX_PARSERS","regionObject","Lod","LOD_PARSERS","lodObject","KML_SEQUENCE","KML_SERIALIZERS","Document","DOCUMENT_SERIALIZERS","DOCUMENT_NODE_FACTORY","Placemark","writePlacemark","DEFAULT_COLOR","DEFAULT_IMAGE_STYLE_ANCHOR","DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS","DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS","DEFAULT_IMAGE_STYLE_SIZE","DEFAULT_IMAGE_STYLE_SRC","DEFAULT_FILL_STYLE","DEFAULT_NO_IMAGE_STYLE","DEFAULT_IMAGE_STYLE","DEFAULT_TEXT_STROKE_STYLE","DEFAULT_TEXT_STYLE","TEXTAREA","DEFAULT_STYLE_ARRAY","scaleForSize","defaultIconUrlFunction","findStyle","styleValue","defaultStyle","sharedStyles","readColor","hexColor","baseURI","readScale","STYLE_MAP_PARSERS","Pair","pairObject","PAIR_PARSERS","ICON_STYLE_PARSERS","iconObject","ICON_PARSERS","heading","hotSpot","xunits","yunits","LABEL_STYLE_PARSERS","LINE_STYLE_PARSERS","POLY_STYLE_PARSERS","outline","FLAT_LINEAR_RING_PARSERS","GX_TRACK_PARSERS","when","whens","gxTrackObject","EXTRUDE_AND_ALTITUDE_MODE_PARSERS","extrude","tessellate","altitudeMode","MULTI_GEOMETRY_PARSERS","multiGeometry","homogeneous","setCommonGeometryProperties","innerBoundaryFlatLinearRings","INNER_BOUNDARY_IS_PARSERS","OUTER_BOUNDARY_IS_PARSERS","STYLE_PARSERS","IconStyle","styleObject","IconObject","drawIcon","iconUrlFunction_","resizeScale","LabelStyle","LineStyle","PolyStyle","extrudes","tessellates","altitudeModes","hasExtrude","hasTessellate","hasAltitudeMode","DATA_PARSERS","displayName","EXTENDED_DATA_PARSERS","Data","featureObject","SchemaData","SCHEMA_DATA_PARSERS","SimpleData","minAltitude","maxAltitude","south","east","west","minLodPixels","maxLodPixels","minFadeExtent","maxFadeExtent","writeColorTextNode","rgba","abgr","EXTENDEDDATA_NODE_SERIALIZERS","pair","DATA_NODE_FACTORY","ICON_SEQUENCE","ICON_SERIALIZERS","GX_NODE_FACTORY","ICON_STYLE_SEQUENCE","ICON_STYLE_SERIALIZERS","vec2","writeScaleTextNode","LABEL_STYLE_SEQUENCE","LABEL_STYLE_SERIALIZERS","LINE_STYLE_SEQUENCE","LINE_STYLE_SERIALIZERS","GEOMETRY_NODE_FACTORY","POINT_NODE_FACTORY","LINE_STRING_NODE_FACTORY","LINEAR_RING_NODE_FACTORY","POLYGON_NODE_FACTORY","MULTI_GEOMETRY_SERIALIZERS","writePrimitiveGeometry","writePolygon","writeMultiGeometry","factory","BOUNDARY_IS_SERIALIZERS","writeBoundaryIs","PLACEMARK_SERIALIZERS","namesAndValues","pointStyles","lineStyles","polyStyles","STYLE_SEQUENCE","STYLE_SERIALIZERS","PLACEMARK_SEQUENCE","EXTENDEDDATA_NODE_FACTORY","styleArray","writeStyles_","PRIMITIVE_GEOMETRY_SEQUENCE","PRIMITIVE_GEOMETRY_SERIALIZERS","POLY_STYLE_SEQUENCE","POLYGON_SERIALIZERS","INNER_BOUNDARY_NODE_FACTORY","OUTER_BOUNDARY_NODE_FACTORY","POLY_STYLE_SERIALIZERS","iconProperties","SHIFT_LEFT_32","SHIFT_RIGHT_32","utf8TextDecoder","TextDecoder","Pbf","ArrayBuffer","isView","dataView","readFields","readField","readVarint","tag","startPos","skip","readMessage","readFixed32","getUint32","readSFixed32","getInt32","readFixed64","readSFixed64","readFloat","getFloat32","readDouble","getFloat64","isSigned","toNum","readVarintRemainder","readVarint64","readSVarint","subarray","str","b0","b3","bytesPerSequence","readUtf8","readBytes","readPackedVarint","readPackedEnd","readPackedSVarint","readPackedBoolean","readPackedFloat","readPackedDouble","readPackedFixed32","readPackedSFixed32","readPackedFixed64","readPackedSFixed64","writeTag","writeVarint","realloc","writeFixed32","setInt32","writeSFixed32","writeFixed64","writeSFixed64","pbf","writeBigVarintLow","lsb","writeBigVarintHigh","writeBigVarint","writeSVarint","writeBoolean","writeString","lead","writeUtf8","makeRoomForExtraLength","writeFloat","setFloat32","writeDouble","setFloat64","writeBytes","writeRawMessage","writeMessage","writePackedVarint","writePackedSVarint","writePackedBoolean","writePackedFloat","writePackedDouble","writePackedFixed32","writePackedSFixed32","writePackedFixed64","writePackedSFixed64","writeBytesField","writeFixed32Field","writeSFixed32Field","writeFixed64Field","writeSFixed64Field","writeVarintField","writeSVarintField","writeStringField","writeFloatField","writeDoubleField","writeBooleanField","extraLen","LN2","layersPBFReader","layerPBFReader","version","featurePBFReader","readRawFeature","WAY_PARSERS","nd","ndrefs","readTag","PARSERS","nodes","tags","NODE_PARSERS","way","ways","XML","read","readFromDocument","readFromNode","readHref","ServiceIdentification","SERVICE_IDENTIFICATION_PARSERS","ServiceProvider","SERVICE_PROVIDER_PARSERS","OperationsMetadata","OPERATIONS_METADATA_PARSERS","OWS","owsObject","ADDRESS_PARSERS","DeliveryPoint","City","AdministrativeArea","PostalCode","Country","ElectronicMailAddress","ALLOWED_VALUES_PARSERS","Value","CONSTRAINT_PARSERS","AllowedValues","CONTACT_INFO_PARSERS","Phone","PHONE_PARSERS","Address","DCP_PARSERS","HTTP","HTTP_PARSERS","REQUEST_METHOD_PARSERS","Post","OPERATION_PARSERS","DCP","Operation","Voice","Facsimile","Constraint","SERVICE_CONTACT_PARSERS","IndividualName","PositionName","ContactInfo","Abstract","AccessConstraints","Fees","Title","ServiceTypeVersion","ServiceType","ProviderName","ProviderSite","ServiceContact","encodeDeltas","numbers","lastNumbers","encodeFloats","decodeDeltas","decodeFloats","encodeSignedIntegers","decodeSignedIntegers","encodeUnsignedIntegers","decodeUnsignedIntegers","encodeUnsignedInteger","transformVertex","arcs","concatenateArcs","polyArray","ringCoords","indices","readFeaturesFromGeometryCollection","readFeatureFromGeometry","transformArc","Filter","tagName_","getTagName","LogicalNary","And","Bbox","Spatial","Contains","DWithin","unit","Disjoint","Comparison","propertyName","During","ComparisonBinary","matchCase","EqualTo","Intersects","IsBetween","lowerBoundary","upperBoundary","IsLike","wildCard","singleChar","escapeChar","IsNull","NotEqualTo","Or","ResourceId","rid","Within","and","Function","boundedBy","member","TRANSACTION_SUMMARY_PARSERS","totalInserted","totalUpdated","totalDeleted","TRANSACTION_RESPONSE_PARSERS","TransactionSummary","readTransactionSummary","InsertResults","readInsertResults","QUERY_SERIALIZERS","PropertyName","TRANSACTION_SERIALIZERS","Insert","Update","writeUpdate","Delete","writeDelete","writeProperty","Native","writeNative","FEATURE_PREFIX","XMLNS","OGCNS","WFSNS","FESNS","SCHEMA_LOCATIONS","GML_FORMATS","serializeTransactionRequest","OGC_FID_PARSERS","FeatureId","fidParser","INSERT_RESULTS_PARSERS","gmlVersion","writeOgcFidFilter","getTypeName","featurePrefix","nativeElement","vendorId","safeToIgnore","GETFEATURE_SERIALIZERS","Query","writeQuery","writeDuringFilter","writeLogicalFilter","writeNotFilter","BBOX","writeBboxFilter","writeSpatialFilter","writeDWithinFilter","PropertyIsEqualTo","writeComparisonFilter","PropertyIsNotEqualTo","PropertyIsLessThan","PropertyIsLessThanOrEqualTo","PropertyIsGreaterThan","PropertyIsGreaterThanOrEqualTo","PropertyIsNull","writeIsNullFilter","PropertyIsBetween","writeIsBetweenFilter","PropertyIsLike","writeIsLikeFilter","propertyNames","typeNameAttr","getFilterNS","writeFilterCondition","writePropertyName","writeExpression","timePeriod","writeTimeInstant","writeLiteral","timeInstant","timePosition","writeGetFeature","WKBGeometryType","WkbReader","view_","pos_","initialized_","isLittleEndian_","hasZ_","hasM_","srid_","layout_","readUint8","getUint8","readUint32","isLittleEndian","numRings","readWkbHeader","expectedTypeId","wkbType","wkbTypeThousandth","hasSRID","typeId","readWkbPayload","readGeometryCollection","readWkbBlock","readWkbCollection","reader","getSrid","WkbWriter","opts","littleEndian","isEWKB_","ewkb","writeQueue_","nodata_","X","Y","Z","writeUint8","writeUint32","coordsObj","writeLineString","writeWkbHeader","isInteger","writeMultiLineString","writeMultiPolygon","writeGeometryCollection","findMinimumLayout","geoms","wkblut","geomType","getBuffer","setUint8","setUint32","getDataView","decodeHexString","byteOffset","POINT","LINESTRING","POLYGON","MULTIPOINT","MULTILINESTRING","MULTIPOLYGON","EMPTY","TokenType","wktTypeLookup","Lexer","wkt","index_","isAlpha_","isNumeric_","isWhiteSpace_","nextChar_","nextToken","readNumber_","readText_","scientificNotation","toUpperCase","Parser","lexer","lexer_","token_","consume_","isTokenType","isMatch","parseGeometry_","parseGeometryLayout_","dimToken","dimInfo","parseGeometryCollectionText_","formatErrorMessage_","parsePointText_","parsePoint_","parseLineStringText_","parsePointList_","parsePolygonText_","parseLineStringTextList_","parseMultiPointText_","parsePointTextList_","parseMultiLineStringText_","parseMultiPolygonText_","parsePolygonTextList_","isEmptyGeometry_","ctor","encodePointGeometry","encodeLineStringGeometry","encodePolygonGeometry","GeometryEncoder","components","encode","enc","geometryEncoder","wktType","encodeGeometryLayout","isV13","Service","SERVICE_PARSERS_V13","SERVICE_PARSERS","Capability","CAPABILITY_PARSERS","Request","REQUEST_PARSERS","Exception","EXCEPTION_PARSERS","layerObject","LAYER_PARSERS_V13","LAYER_PARSERS","readLayer","UserDefinedSymbolization","SupportSLD","UserLayer","UserStyle","RemoteWFS","InlineFeatureData","RemoteWCS","COMMON_SERVICE_PARSERS","Name","KeywordList","readKeywordList","OnlineResource","ContactInformation","CONTACT_INFORMATION_PARSERS","LayerLimit","MaxWidth","MaxHeight","ContactPersonPrimary","CONTACT_PERSON_PARSERS","ContactPosition","ContactAddress","CONTACT_ADDRESS_PARSERS","ContactVoiceTelephone","ContactFacsimileTelephone","ContactElectronicMailAddress","ContactPerson","ContactOrganization","AddressType","StateOrProvince","PostCode","Format","COMMON_LAYER_PARSERS","BoundingBox","readBoundingBox","Dimension","dimensionObject","unitSymbol","default","multipleValues","nearestValue","ATTRIBUTION_PARSERS","AuthorityURL","authorityObject","readFormatOnlineresource","Identifier","MetadataURL","metadataObject","DataURL","FeatureListURL","SRS","Extent","ScaleHint","LatLonBoundingBox","CRS","EX_GeographicBoundingBox","geographicBoundingBox","EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS","westBoundLongitude","southBoundLatitude","eastBoundLongitude","northBoundLatitude","MinScaleDenominator","MaxScaleDenominator","LogoURL","readSizedFormatOnlineresource","GetCapabilities","readOperationType","GetMap","GetFeatureInfo","DescribeLayer","GetLegendGraphic","OPERATIONTYPE_PARSERS","DCPType","DCPTYPE_PARSERS","LegendURL","StyleSheetURL","StyleURL","FORMAT_ONLINERESOURCE_PARSERS","KEYWORDLIST_PARSERS","Keyword","withCrs","srs","parentLayerObject","queryable","cascaded","opaque","noSubsets","fixedWidth","fixedHeight","addKeys","childValue","replaceKeys","parentValue","formatOnlineresource","OWS_NAMESPACE_URIS","Contents","CONTENTS_PARSERS","TileMatrixSet","TMS_PARSERS","isDefault","TileMatrixSetLink","TMS_LINKS_PARSERS","DIMENSION_PARSERS","ResourceURL","resourceType","resource","WGS84BoundingBox","WGS84_BBOX_READERS","legend","TileMatrixSetLimits","TMS_LIMITS_LIST_PARSERS","TileMatrixLimits","TMS_LIMITS_PARSERS","TileMatrix","MinTileRow","MaxTileRow","MinTileCol","MaxTileCol","LowerCorner","readCoordinates","UpperCorner","WellKnownScaleSet","TM_PARSERS","SupportedCRS","TopLeftCorner","ScaleDenominator","TileWidth","TileHeight","MatrixWidth","MatrixHeight","events","FullScreenEventType","isFullScreenSupported","requestFullscreen","fullscreenEnabled","isFullScreen","fullscreenElement","requestFullScreen","PROJECTION","COORDINATE_FORMAT","MAX_RATIO","MIN_RATIO","UNITS_PROP","LEADING_DIGITS","DEFAULT_DPI","Direction","ol","$ol$Collection","_ol_Collection$CollectionEvent","$ol$DataTile","_ol_DataTile$asArrayLike","_ol_DataTile$asImageLike","_ol_DataTile$disposedError","_ol_DataTile$toArray","$ol$Disposable","$ol$Feature","_ol_Feature$createStyleFunction","Geolocation","position_","watchId_","handleProjectionChanged_","handleTrackingChanged_","setProjection","trackingOptions","setTrackingOptions","setTracking","tracking","getTracking","geolocation","watchPosition","positionChange_","positionError_","getTrackingOptions","clearWatch","accuracy","altitude","altitudeAccuracy","projectedPosition","speed","circularPolygon","getAccuracy","getAccuracyGeometry","getAltitude","getAltitudeAccuracy","getHeading","getSpeed","_ol_Geolocation$GeolocationError","$ol$Image","_ol_Image$decode","_ol_Image$decodeFallback","_ol_Image$listenImage","_ol_Image$load","$ol$ImageCanvas","$ol$ImageTile","$ol$Kinetic","$ol$Map","$ol$MapBrowserEvent","$ol$MapBrowserEventHandler","$ol$MapEvent","$ol$Object","_ol_Object$ObjectEvent","$ol$Observable","_ol_Observable$unByKey","$ol$Overlay","$ol$Tile","$ol$TileQueue","_ol_TileQueue$getTilePriority","$ol$TileRange","_ol_TileRange$createOrUpdate","$ol$VectorRenderTile","$ol$VectorTile","$ol$View","_ol_View$createCenterConstraint","_ol_View$createResolutionConstraint","_ol_View$createRotationConstraint","_ol_View$isNoopAnimation","_ol_array$ascending","_ol_array$binarySearch","_ol_array$descending","_ol_array$equals","_ol_array$extend","_ol_array$isSorted","_ol_array$linearFindNearest","_ol_array$reverseSubArray","stableSort","compareFnc","asserts","_ol_asserts$assert","centerconstraint","_ol_centerconstraint$createExtent","_ol_centerconstraint$none","_ol_color$NO_COLOR","_ol_color$asArray","_ol_color$asString","_ol_color$fromString","isStringColor","_ol_color$lchaToRgba","_ol_color$rgbaToLcha","_ol_color$toString","_ol_color$withAlpha","colorlike","_ol_colorlike$asColorLike","_ol_console$error","setLevel","_ol_console$warn","$ol$control$Attribution","$ol$control$Control","FullScreen","source_","isInFullscreen_","boundHandleMapTargetChange_","handleMapTargetChange_","cssClassName_","documentListeners_","activeClassName_","activeClassName","inactiveClassName_","inactiveClassName","labelNode_","labelActive","labelActiveNode_","button_","setClassName_","handleFullScreen_","exitFullscreen","exitFullScreen","requestFullScreenWithKeys","handleFullScreenChange_","wasInFullscreen","fullscreen","oldMap","MousePosition","coordinateFormat","setCoordinateFormat","renderOnMouseOut_","placeholder","placeholder_","renderedHTML_","mapProjection_","getCoordinateFormat","handleMouseMove","updateHTML_","handleMouseOut","html","OverviewMap","boundHandleRotationChanged_","handleRotationChanged_","viewExtent_","ovmapDiv_","ovmap","ovmap_","boxSizing","boxOverlay_","overlayBox","move","mousePosition","endMoving","oldView","unbindView_","handleMapPropertyChange_","bindView_","updateBoxAfterOvmapIsRendered_","newView","resetExtent_","validateExtent_","ovmapSize","ovextent","topLeftPixel","bottomRightPixel","boxWidth","boxHeight","ovmapWidth","ovmapHeight","recenter_","ovview","updateBox_","ovresolution","ovmapPostrenderKey_","getOverviewMap","$ol$control$Rotate","ScaleLine","bar","innerElement_","viewState_","minWidth_","minWidth","maxWidth_","maxWidth","handleUnitsChanged_","setUnits","scaleBar_","scaleBarSteps_","scaleBarText_","dpi_","setDpi","pointResolutionUnits","nominalCount","suffix","metersPerDegree","decimalCount","previousWidth","previousDecimalCount","previousCount","createScaleBar","resolutionScale","getScaleForResolution","mapScale","stepWidth","scaleSteps","createMarker","cls","createStepText","isLast","lengthString","$ol$control$Zoom","ZoomSlider","currentResolution_","direction_","heightLimit_","widthLimit_","startX_","startY_","thumbSize_","sliderInitialized_","thumbElement","containerElement","handleDraggerStart_","handleDraggerDrag_","handleDraggerEnd_","handleContainerClick_","initSlider_","containerWidth","containerHeight","containerStyle","thumb","thumbStyle","thumbWidth","thumbHeight","relativePosition","getRelativePosition_","getResolutionForPosition_","drag","setThumbPosition_","getPositionForResolution_","amount","ZoomToExtent","handleZoomToExtent","_ol_control_defaults$defaults","_ol_coordinate$add","_ol_coordinate$closestOnCircle","_ol_coordinate$closestOnSegment","createStringXY","_ol_coordinate$degreesToStringHDMS","_ol_coordinate$distance","_ol_coordinate$equals","_ol_coordinate$format","_ol_coordinate$getWorldsAway","_ol_coordinate$rotate","_ol_coordinate$scale","_ol_coordinate$squaredDistance","_ol_coordinate$squaredDistanceToSegment","toStringHDMS","_ol_coordinate$toStringXY","_ol_coordinate$wrapX","css","_ol_css$CLASS_COLLAPSED","_ol_css$CLASS_CONTROL","_ol_css$CLASS_HIDDEN","_ol_css$CLASS_SELECTABLE","_ol_css$CLASS_UNSELECTABLE","_ol_css$CLASS_UNSUPPORTED","_ol_css$fontWeights","_ol_css$getFontParameters","dom","_ol_dom$createCanvasContext2D","_ol_dom$getSharedCanvasContext2D","_ol_dom$outerHeight","_ol_dom$outerWidth","_ol_dom$releaseCanvas","_ol_dom$removeChildren","_ol_dom$replaceChildren","_ol_dom$replaceNode","_ol_easing$easeIn","_ol_easing$easeOut","_ol_easing$inAndOut","_ol_easing$linear","upAndDown","$ol$events$Event","_ol_events_Event$stopPropagation","_ol_events_SnapEvent$SnapEvent","$ol$events$Target","_ol_events_condition$all","_ol_events_condition$altKeyOnly","_ol_events_condition$altShiftKeysOnly","_ol_events_condition$always","click","doubleClick","_ol_events_condition$focus","_ol_events_condition$focusWithTabindex","_ol_events_condition$mouseActionButton","_ol_events_condition$mouseOnly","_ol_events_condition$never","_ol_events_condition$noModifierKeys","penOnly","pointerEvt","_ol_events_condition$platformModifierKey","platformModifierKeyOnly","pointerMove","_ol_events_condition$primaryAction","_ol_events_condition$shiftKeyOnly","_ol_events_condition$singleClick","_ol_events_condition$targetNotEditable","touchOnly","_ol_events$listen","_ol_events$listenOnce","_ol_events$unlistenByKey","expr","cpu","_ol_expr_cpu$buildExpression","_ol_expr_cpu$newEvaluationContext","_ol_expr_expression$AnyType","_ol_expr_expression$BooleanType","_ol_expr_expression$CallExpression","_ol_expr_expression$ColorType","_ol_expr_expression$LiteralExpression","NoneType","_ol_expr_expression$NumberArrayType","_ol_expr_expression$NumberType","_ol_expr_expression$Ops","_ol_expr_expression$SizeType","_ol_expr_expression$StringType","_ol_expr_expression$computeGeometryType","_ol_expr_expression$includesType","_ol_expr_expression$isType","_ol_expr_expression$newParsingContext","overlapsType","oneType","otherType","_ol_expr_expression$parse","_ol_expr_expression$typeName","gpu","_ol_expr_gpu$FEATURE_ID_PROPERTY_NAME","_ol_expr_gpu$GEOMETRY_TYPE_PROPERTY_NAME","_ol_expr_gpu$PALETTE_TEXTURE_ARRAY","_ol_expr_gpu$UNDEFINED_PROP_VALUE","_ol_expr_gpu$arrayToGlsl","_ol_expr_gpu$buildExpression","_ol_expr_gpu$colorToGlsl","_ol_expr_gpu$getStringNumberEquivalent","_ol_expr_gpu$newCompilationContext","_ol_expr_gpu$numberToGlsl","_ol_expr_gpu$sizeToGlsl","_ol_expr_gpu$stringToGlsl","_ol_expr_gpu$uniformNameForVariable","_ol_extent$applyTransform","_ol_extent$approximatelyEquals","_ol_extent$boundingExtent","_ol_extent$buffer","_ol_extent$clone","_ol_extent$closestSquaredDistanceXY","_ol_extent$containsCoordinate","_ol_extent$containsExtent","_ol_extent$containsXY","_ol_extent$coordinateRelationship","_ol_extent$createEmpty","_ol_extent$createOrUpdate","_ol_extent$createOrUpdateEmpty","_ol_extent$createOrUpdateFromCoordinate","createOrUpdateFromCoordinates","_ol_extent$createOrUpdateFromFlatCoordinates","createOrUpdateFromRings","_ol_extent$equals","_ol_extent$extend","_ol_extent$extendCoordinate","_ol_extent$extendCoordinates","_ol_extent$extendFlatCoordinates","_ol_extent$extendRings","_ol_extent$extendXY","_ol_extent$forEachCorner","_ol_extent$getArea","_ol_extent$getBottomLeft","_ol_extent$getBottomRight","_ol_extent$getCenter","_ol_extent$getCorner","getEnlargedArea","_ol_extent$getForViewAndSize","_ol_extent$getHeight","_ol_extent$getIntersection","getIntersectionArea","getMargin","_ol_extent$getRotatedViewport","_ol_extent$getTopLeft","_ol_extent$getTopRight","_ol_extent$getWidth","_ol_extent$intersects","_ol_extent$intersectsSegment","_ol_extent$isEmpty","_ol_extent$returnOrUpdate","_ol_extent$scaleFromCenter","_ol_extent$wrapAndSliceX","_ol_extent$wrapX","featureloader","_ol_featureloader$loadFeaturesXhr","setWithCredentials","xhrWithCredentials","_ol_featureloader$xhr","EsriJSON","idField","esriJSONFeature","esriJSONFeatures","objectIdFieldName","wkid","objects","$ol$format$Feature","_ol_format_Feature$createGeometry","_ol_format_Feature$createRenderFeature","_ol_format_Feature$transformExtentWithOptions","_ol_format_Feature$transformGeometryWithOptions","$ol$format$GML","$ol$format$GML2","$ol$format$GML3","$ol$format$GML32","$ol$format$GMLBase","_ol_format_GMLBase$GMLNS","GPX","readExtensions_","readExtensions","handleReadExtensions_","extensionsNode","readMetadata","readMetadataFromDocument","readMetadataFromNode","featureReader","gpx","GeoJSON","extractGeometryName_","extractGeometryName","geoJSONFeature","geoJSONFeatures","geometryObject","IGC","altitudeMode_","lad_","lod_","ladStart_","ladStop_","lodStart_","lodStop_","month","day","lastDateTime","hour","minute","second","UTC","numberAdds","addCode","addStart","addStop","IIIFInfo","setImageInfo","getImageApiVersion","getComplianceLevelEntryFromProfile","identifier","getComplianceLevelFromProfile","complianceLevel","getTileSourceOptions","preferredOptions","imageOptions","quality","$ol$format$JSONFeature","KML","defaultStyle_","extractStyles_","extractStyles","writeStyles","sharedStyles_","showPointNames_","showPointNames","iconUrlFunction","readDocumentOrFolder_","Folder","readPlacemark_","readSharedStyle_","readSharedStyleMap_","drawName","multiGeometryPoints","featureStyle","nameStyle","foundStyle","textOffset","createNameStyleFunction","createFeatureStyleFunction","styleUri","fs","readName","readNameFromDocument","readNameFromNode","readNetworkLinks","networkLinks","readNetworkLinksFromDocument","readNetworkLinksFromNode","readRegion","regions","readRegionFromDocument","readRegionFromNode","readCamera","cameras","readCameraFromDocument","readCameraFromNode","kml","xmlnsUri","getDefaultFillStyle","getDefaultImageStyle","getDefaultStrokeStyle","getDefaultStyle","getDefaultStyleArray","getDefaultTextStyle","_ol_format_KML$readFlatCoordinates","MVT","layerName_","layerName","idProperty_","idProperty","readRawGeometry_","cmd","coordsLen","currentEnd","cmdLen","createFeature_","rawFeature","getGeometryType","PBF","pbfLayers","pbfLayer","OSMXML","$ol$format$OWS","Polyline","factor_","geometryLayout_","geometryLayout","_ol_format_Polyline$decodeDeltas","_ol_format_Polyline$decodeFloats","_ol_format_Polyline$decodeSignedIntegers","_ol_format_Polyline$decodeUnsignedIntegers","_ol_format_Polyline$encodeDeltas","_ol_format_Polyline$encodeFloats","_ol_format_Polyline$encodeSignedIntegers","_ol_format_Polyline$encodeUnsignedInteger","_ol_format_Polyline$encodeUnsignedIntegers","$ol$format$TextFeature","TopoJSON","topoJSONTopology","transformArcs","topoJSONFeatures","objectName","WFS","version_","featureType_","featureNS_","gmlFormat_","gmlFormat","schemaLocation_","getFeatureType","setFeatureType","featuresNS","readTransactionResponse","readTransactionResponseFromDocument","readTransactionResponseFromNode","readFeatureCollectionMetadata","readFeatureCollectionMetadataFromDocument","readFeatureCollectionMetadataFromNode","handle","outputFormat","maxFeatures","resultType","viewParams","combineBboxAndFilter","completeFilter","bboxFilter","bboxFilterFn","andFilterFn","writeTransaction","inserts","updates","deletes","baseObj","gmlOptions","createTransactionRequest","nativeElements","writeFilter","WKB","splitCollection","viewCache_","hex_","littleEndian_","ewkb_","nodataZ_","nodataZ","nodataM_","nodataM","writer","encodeHexString","WKT","splitCollection_","parse_","WMSCapabilities","wmsCapabilityObject","WMSGetFeatureInfo","readFeatures_","layerElement","toRemove","layerFeatures","gmlFeatures","WMTSCapabilities","owsParser_","WMTSCapabilityObject","$ol$format$XML","$ol$format$XMLFeature","$ol$format$filter$And","$ol$format$filter$Bbox","$ol$format$filter$Comparison","$ol$format$filter$ComparisonBinary","$ol$format$filter$Contains","$ol$format$filter$DWithin","$ol$format$filter$Disjoint","$ol$format$filter$During","$ol$format$filter$EqualTo","$ol$format$filter$Filter","$ol$format$filter$GreaterThan","$ol$format$filter$GreaterThanOrEqualTo","$ol$format$filter$Intersects","$ol$format$filter$IsBetween","$ol$format$filter$IsLike","$ol$format$filter$IsNull","$ol$format$filter$LessThan","$ol$format$filter$LessThanOrEqualTo","$ol$format$filter$LogicalNary","$ol$format$filter$Not","$ol$format$filter$NotEqualTo","$ol$format$filter$Or","$ol$format$filter$ResourceId","$ol$format$filter$Spatial","$ol$format$filter$Within","_ol_format_filter$and","_ol_format_filter$bbox","between","disjoint","during","dwithin","equalTo","greaterThan","greaterThanOrEqualTo","isNull","lessThan","lessThanOrEqualTo","like","not","notEqualTo","or","resourceId","within","xlink","_ol_format_xlink$readHref","xsd","_ol_format_xsd$readBoolean","_ol_format_xsd$readBooleanString","_ol_format_xsd$readDateTime","_ol_format_xsd$readDecimal","_ol_format_xsd$readDecimalString","_ol_format_xsd$readNonNegativeIntegerString","_ol_format_xsd$readPositiveInteger","_ol_format_xsd$readString","_ol_format_xsd$writeBooleanTextNode","_ol_format_xsd$writeCDATASection","_ol_format_xsd$writeDateTimeTextNode","_ol_format_xsd$writeDecimalTextNode","_ol_format_xsd$writeNonNegativeIntegerTextNode","_ol_format_xsd$writeStringTextNode","_ol_functions$FALSE","_ol_functions$TRUE","_ol_functions$VOID","_ol_functions$memoizeOne","_ol_functions$toPromise","$ol$geom$Circle","$ol$geom$Geometry","$ol$geom$GeometryCollection","$ol$geom$LineString","$ol$geom$LinearRing","$ol$geom$MultiLineString","$ol$geom$MultiPoint","$ol$geom$MultiPolygon","$ol$geom$Point","$ol$geom$Polygon","_ol_geom_Polygon$circular","_ol_geom_Polygon$fromCircle","_ol_geom_Polygon$fromExtent","_ol_geom_Polygon$makeRegular","$ol$geom$SimpleGeometry","_ol_geom_SimpleGeometry$getLayoutForStride","_ol_geom_SimpleGeometry$getStrideForLayout","_ol_geom_SimpleGeometry$transformGeom2D","_ol_geom_flat_area$linearRing","_ol_geom_flat_area$linearRings","_ol_geom_flat_area$linearRingss","_ol_geom_flat_center$linearRingss","closest","_ol_geom_flat_closest$arrayMaxSquaredDelta","_ol_geom_flat_closest$assignClosestArrayPoint","_ol_geom_flat_closest$assignClosestMultiArrayPoint","_ol_geom_flat_closest$assignClosestPoint","_ol_geom_flat_closest$maxSquaredDelta","_ol_geom_flat_closest$multiArrayMaxSquaredDelta","_ol_geom_flat_contains$linearRingContainsExtent","_ol_geom_flat_contains$linearRingContainsXY","_ol_geom_flat_contains$linearRingsContainsXY","_ol_geom_flat_contains$linearRingssContainsXY","deflate","_ol_geom_flat_deflate$deflateCoordinate","_ol_geom_flat_deflate$deflateCoordinates","_ol_geom_flat_deflate$deflateCoordinatesArray","_ol_geom_flat_deflate$deflateMultiCoordinatesArray","flip","_ol_geom_flat_flip$flipXY","geodesic","greatCircleArc","geoProjection","cosLat1","sinLat1","cosLat2","sinLat2","cosDeltaLon","sinDeltaLon","D","cosD","sinD","_ol_geom_flat_geodesic$meridian","_ol_geom_flat_geodesic$parallel","inflate","_ol_geom_flat_inflate$inflateCoordinates","_ol_geom_flat_inflate$inflateCoordinatesArray","_ol_geom_flat_inflate$inflateMultiCoordinatesArray","interiorpoint","_ol_geom_flat_interiorpoint$getInteriorPointOfArray","_ol_geom_flat_interiorpoint$getInteriorPointsOfMultiArray","_ol_geom_flat_interpolate$interpolatePoint","_ol_geom_flat_interpolate$lineStringCoordinateAtM","_ol_geom_flat_interpolate$lineStringsCoordinateAtM","intersectsextent","_ol_geom_flat_intersectsextent$intersectsLineString","_ol_geom_flat_intersectsextent$intersectsLineStringArray","_ol_geom_flat_intersectsextent$intersectsLinearRing","_ol_geom_flat_intersectsextent$intersectsLinearRingArray","_ol_geom_flat_intersectsextent$intersectsLinearRingMultiArray","_ol_geom_flat_length$lineStringLength","linearRingLength","perimeter","orient","_ol_geom_flat_orient$inflateEnds","_ol_geom_flat_orient$linearRingIsClockwise","_ol_geom_flat_orient$linearRingsAreOriented","_ol_geom_flat_orient$linearRingssAreOriented","_ol_geom_flat_orient$orientLinearRings","_ol_geom_flat_orient$orientLinearRingsArray","_ol_geom_flat_reverse$coordinates","_ol_geom_flat_segments$forEach","_ol_geom_flat_segments$getIntersectionPoint","_ol_geom_flat_simplify$douglasPeucker","_ol_geom_flat_simplify$douglasPeuckerArray","douglasPeuckerMultiArray","_ol_geom_flat_simplify$quantize","_ol_geom_flat_simplify$quantizeArray","_ol_geom_flat_simplify$quantizeMultiArray","_ol_geom_flat_simplify$radialDistance","simplifyLineString","highQuality","_ol_geom_flat_simplify$snap","straightchunk","_ol_geom_flat_straightchunk$matchingChunk","textpath","_ol_geom_flat_textpath$drawTextOnPath","topology","lineStringIsClosed","lastCoord","_ol_geom_flat_transform$rotate","_ol_geom_flat_transform$scale","_ol_geom_flat_transform$transform2D","_ol_geom_flat_transform$translate","_ol_has$CREATE_IMAGE_BITMAP","_ol_has$DEVICE_PIXEL_RATIO","_ol_has$IMAGE_DECODE","_ol_has$MAC","_ol_has$PASSIVE_EVENT_LISTENERS","_ol_has$SAFARI","_ol_has$SAFARI_BUG_237906","_ol_has$WEBKIT","_ol_has$WORKER_OFFSCREEN_CANVAS","DblClickDragZoom","opt_options","scaleDeltaByPixel_","handlingDownUpSequence_","handlingDoubleDownSequence_","doubleTapTimeoutId_","trackedPointers_","waitForDblTap_","isPointerDraggingEvent","$ol$interaction$DoubleClickZoom","DragAndDrop","readAsBuffer_","formats_","formatConstructors","dropListenKeys_","handleResult_","tryReadFeatures_","registerListeners_","dropArea","handleDrop","handleStop","unregisterListeners_","files","dataTransfer","FileReader","readAsArrayBuffer","readAsText","dropEffect","_ol_interaction_DragAndDrop$DragAndDropEvent","$ol$interaction$DragBox","_ol_interaction_DragBox$DragBoxEvent","$ol$interaction$DragPan","$ol$interaction$DragRotate","DragRotateAndZoom","lastMagnitude_","magnitude","angleDelta","$ol$interaction$DragZoom","Draw","shouldHandle_","downPx_","downTimeout_","lastDragTime_","pointerType_","freehand_","snapTolerance_","snapTolerance","getMode","stopClick_","stopClick","minPoints_","minPoints","maxPoints_","maxPoints","finishCondition_","finishCondition","geometryFunction","mode","squaredLength","dragVertexDelay_","dragVertexDelay","finishCoordinate_","sketchFeature_","sketchPoint_","sketchCoords_","sketchLine_","sketchLineCoords_","squaredClickTolerance_","clickTolerance","overlay_","freehandCondition_","freehand","freehandCondition","traceCondition_","setTrace","trace","traceState_","traceSource_","traceSource","updateState_","getOverlay","addToDrawing_","startDrawing_","deactivateTrace_","toggleTraceState_","getTraceTargets","startPx","targetIndex","addOrRemoveTracedCoordinates_","previouslyForward","addTracedCoordinates_","removeTracedCoordinates_","fromIndex","toIndex","removeLastPoints_","appendCoordinates","updateTrace_","traceState","updatedTraceTarget","closestTargetDistance","newTargetIndex","newEndIndex","minSegmentDistance","coordinateIndex","newTarget","considerBothDirections","newCoordinate","forwardDistance","reverseDistance","getTraceTargetUpdate","oldTarget","tracing","startingToDraw","finishDrawing","atFinish_","abortDrawing","downPx","clickPx","modifyDrawing_","createOrUpdateSketchPoint_","at","potentiallyDone","potentiallyFinishCoordinates","sketchCoords","finishCoordinate","finishPixel","updateSketchFeatures_","createOrUpdateCustomSketchLine_","sketchLineGeom","removeLastPoint","sketchFeature","abortDrawing_","newDrawing","ending","sketchFeatures","overlaySource","_ol_interaction_Draw$DrawEvent","createBox","boxCoordinates","createRegularPolygon","internalAngle","pointerHandler_","pixelTolerance_","pixelTolerance","snappedToVertex_","extentFeature_","vertexFeature_","extentOverlay_","boxStyle","vertexOverlay_","pointerStyle","snapToVertex_","pixelCoordinate","sortByDistance","getExtentInternal","getSegments","closestSegment","coordinateDistance","pixel1","pixel2","squaredDist1","squaredDist2","dist","createOrUpdatePointerFeature_","createOrUpdateExtentFeature_","extentFeature","vertexFeature","getOpposingPoint","x_","y_","_ol_interaction_Extent$ExtentEvent","$ol$interaction$Interaction","_ol_interaction_Interaction$pan","_ol_interaction_Interaction$zoomByDelta","$ol$interaction$KeyboardPan","$ol$interaction$KeyboardZoom","animationOptions","animationOptions_","params_","replace_","prefix_","initial_","trackedCallbacks_","trackedValues_","getParamName_","get_","set_","delete_","updateUrl_","handleChangeLayerGroup_","history","replaceState","updateView","viewProperties","layersParam","track","updateHistory_","visibilities","pushState","Modify","boundHandleFeatureChange_","defaultDeleteCondition_","deleteCondition_","deleteCondition","insertVertexCondition_","insertVertexCondition","vertexSegments_","lastPixel_","ignoreNextSingleClick_","featuresBeingModified_","rBush_","changingFeature_","dragSegments_","SEGMENT_WRITERS_","writePointGeometry_","writeLineStringGeometry_","writePolygonGeometry_","writeMultiPointGeometry_","writeMultiLineStringGeometry_","writeMultiPolygonGeometry_","writeCircleGeometry_","writeGeometryCollectionGeometry_","hitDetection_","handleSourceAdd_","handleSourceRemove_","hitDetection","handleFeatureAdd_","handleFeatureRemove_","lastPointerEvent_","snapToPointer_","snapToPointer","handlePointerAtPixel_","willModifyFeatures_","removeFeatureSegmentData_","rBush","nodesToRemove","nodeToRemove","centerSegmentData","circumferenceSegmentData","featureSegments","createOrUpdateVertexFeature_","removePoint","findInsertVerticesAndUpdateDragSegments_","insertVertices","vertexExtent","segmentDataMatches","componentSegments","segmentDataMatch","dragSegment","setGeometryCoordinates_","insertVertex_","hitPointGeometry","vertexSegments","geometryUid","rTree","updateSegmentIndices_","newSegmentData","newSegmentData2","updatePointer_","canRemovePoint","removeVertex_","dragSegments","segmentsByFeature","component","newIndex","deleted","canInsertPoint","insertPoint","_ol_interaction_Modify$ModifyEvent","$ol$interaction$MouseWheelZoom","$ol$interaction$PinchRotate","$ol$interaction$PinchZoom","Pointer","$ol$interaction$Pointer","_ol_interaction_Pointer$centroid","$ol$interaction$Select","_ol_interaction_Select$SelectEvent","Snap","vertex_","edge_","intersection_","featuresListenerKeys_","featureChangeListenerKeys_","indexedFeaturesExtents_","pendingFeatures_","snapped_","segmenters_","segmenters","feature_uid","segmentCount","otherSegment","intersectionSegment","isIntersection","otherSegments","getFeatures_","areSnapDataEqual_","data1","data2","snapTo","updateFeature_","featuresToUpdate","unregister","currentMap","projectedCoordinate","segmentsLength","closestVertex","squaredPixelTolerance","getResult","segmentStart","segmentEnd","Translate","lastCoordinate_","startCoordinate_","lastFeature_","handleActiveChanged_","featuresAtPixel_","newViewCoordinate","lastViewCoordinate","_ol_interaction_Translate$TranslateEvent","_ol_interaction_defaults$defaults","Base","$ol$layer$Base","BaseImage","$ol$layer$BaseImage","BaseTile","$ol$layer$BaseTile","$ol$layer$BaseVector","Flow","$ol$layer$Flow","Graticule","maxLines","targetSize","showLabels","lonLabelFormatter","latLabelFormatter","lonLabelPosition","latLabelPosition","lonLabelStyle","latLabelStyle","intervals","maxLat_","maxLon_","minLat_","minLon_","maxX_","maxY_","minX_","minY_","targetSize_","maxLines_","meridians_","parallels_","strokeStyle_","fromLonLatTransform_","toLonLatTransform_","projectionCenterLonLat_","bottomLeft_","bottomRight_","topLeft_","topRight_","meridiansLabels_","parallelsLabels_","lonLabelFormatter_","latLabelFormatter_","lonLabelPosition_","latLabelPosition_","lonLabelStyleBase_","lonLabelStyle_","latLabelStyleBase_","latLabelStyle_","drawLabels_","intervals_","loaderFunction","strategyFunction","featurePool_","lineStyle_","loadedExtent_","realWorldExtent","updateProjectionInfo_","createGraticule_","featuresColl","poolIndex","addMeridian_","minLat","maxLat","getMeridian_","addParallel_","minLon","maxLon","getParallel_","rotationCenter","rotationExtent","unrotatedWidth","unrotatedHeight","labelsAtStart","vectorContext","textPoint","getMeridianPoint_","getParallelPoint_","interval","getInterval_","validCenterP","centerLonLat","centerLon","centerLat","cnt","validExtentP","validExtent","clampedLat","clampedBottom","clampedTop","getMeridians","clampedLeft","clampedRight","getParallels","epsg4326Projection","toLonLatTransform","lonLatCoordinates","worldExtentP","Group","$ol$layer$Group","_ol_layer_Group$GroupEvent","Heatmap","gradient","blur","gradient_","handleGradientChanged_","setGradient","setBlur","weight_","getBlur","getGradient","createLinearGradient","addColorStop","createGradient","previousValue","setFilter","setWeight","filterCompiled","radiusCompiled","blurCompiled","blurRadiusUniforms","weightAttribute","weightExpression","weightFunction","weightValue","u_gradientTexture","u_opacity","$ol$layer$Image","$ol$layer$Layer","_ol_layer_Layer$inView","$ol$layer$Tile","Vector","$ol$layer$Vector","VectorImage","imageRatio","imageRatio_","renderMode_","WebGLPoints","parseResult_","hitDetectionDisabled_","WebGLTile","$ol$layer$WebGLTile","WebGLVector","WebGLVectorTile","loadingstrategy","_ol_loadingstrategy$all","math","_ol_math$ceil","_ol_math$clamp","_ol_math$floor","_ol_math$lerp","_ol_math$modulo","_ol_math$round","_ol_math$solveLinearSystem","_ol_math$squaredDistance","_ol_math$squaredSegmentDistance","_ol_math$toDegrees","_ol_math$toFixed","_ol_math$toRadians","_ol_math$wrap","net","_ol_net$ClientError","_ol_net$ResponseError","_ol_net$getJSON","_ol_net$jsonp","overrideXHR","_ol_net$resolveUrl","restoreXHR","_ol_obj$clear","_ol_obj$isEmpty","$ol$proj$Projection","Units","_ol_proj_Units$METERS_PER_UNIT","_ol_proj_Units$fromCode","_ol_proj$addCommon","_ol_proj$addCoordinateTransforms","_ol_proj$addEquivalentProjections","_ol_proj$addEquivalentTransforms","_ol_proj$addProjection","_ol_proj$addProjections","clearAllProjections","clearProj","clearTransformFuncs","clearUserProjection","_ol_proj$cloneTransform","_ol_proj$createProjection","_ol_proj$createSafeCoordinateTransform","_ol_proj$createTransformFromCoordinateTransform","_ol_proj$disableCoordinateWarning","epsg3857","_ol_proj_epsg3857$EXTENT","_ol_proj_epsg3857$HALF_SIZE","_ol_proj_epsg3857$MAX_SAFE_Y","_ol_proj_epsg3857$PROJECTIONS","_ol_proj_epsg3857$RADIUS","_ol_proj_epsg3857$WORLD_EXTENT","_ol_proj_epsg3857$fromEPSG4326","_ol_proj_epsg3857$toEPSG4326","epsg4326","_ol_proj_epsg4326$EXTENT","_ol_proj_epsg4326$METERS_PER_UNIT","_ol_proj_epsg4326$PROJECTIONS","_ol_proj_epsg4326$RADIUS","_ol_proj$equivalent","_ol_proj$fromUserCoordinate","_ol_proj$fromUserExtent","_ol_proj$fromUserResolution","_ol_proj$get","_ol_proj$getPointResolution","_ol_proj$getTransform","_ol_proj$getTransformFromProjections","_ol_proj$getUserProjection","_ol_proj$identityTransform","epsgLookupMapTiler","results","defaultTransform","fromEPSGCode","epsgCode","getEPSGLookup","isRegistered","_ol_proj_proj4$register","setEPSGLookup","_ol_proj_projections$add","_ol_proj_projections$clear","_ol_proj_projections$get","_ol_proj$setUserProjection","_ol_proj$toLonLat","_ol_proj$toUserCoordinate","_ol_proj$toUserExtent","_ol_proj$toUserResolution","_ol_proj$transform","_ol_proj$transformExtent","transformWithProjections","destinationProjection","_ol_proj_transforms$add","_ol_proj_transforms$clear","_ol_proj_transforms$get","useGeographic","utm","_ol_proj_utm$makeProjection","_ol_proj_utm$makeTransforms","_ol_proj_utm$zoneFromCode","$ol$render$Box","$ol$render$Event","$ol$render$Feature","toFeature","_ol_render_Feature$toGeometry","$ol$render$VectorContext","$ol$render$canvas$Builder","$ol$render$canvas$BuilderGroup","$ol$render$canvas$Executor","$ol$render$canvas$ExecutorGroup","_ol_render_canvas_ExecutorGroup$ALL","_ol_render_canvas_ExecutorGroup$DECLUTTER","_ol_render_canvas_ExecutorGroup$NON_DECLUTTER","_ol_render_canvas_ExecutorGroup$getPixelIndexArray","$ol$render$canvas$ImageBuilder","Immediate","$ol$render$canvas$Immediate","_ol_render_canvas_Instruction$beginPathInstruction","_ol_render_canvas_Instruction$closePathInstruction","_ol_render_canvas_Instruction$fillInstruction","_ol_render_canvas_Instruction$strokeInstruction","$ol$render$canvas$LineStringBuilder","$ol$render$canvas$PolygonBuilder","$ol$render$canvas$TextBuilder","_ol_render_canvas_TextBuilder$TEXT_ALIGN","$ol$render$canvas$ZIndexContext","_ol_render_canvas$checkedFonts","_ol_render_canvas$defaultFillStyle","_ol_render_canvas$defaultFont","_ol_render_canvas$defaultLineCap","_ol_render_canvas$defaultLineDash","defaultLineDashOffset","_ol_render_canvas$defaultLineJoin","defaultLineWidth","_ol_render_canvas$defaultMiterLimit","_ol_render_canvas$defaultPadding","_ol_render_canvas$defaultStrokeStyle","_ol_render_canvas$defaultTextAlign","_ol_render_canvas$defaultTextBaseline","_ol_render_canvas$drawImageOrLabel","_ol_render_canvas$getTextDimensions","hitdetect","_ol_render_canvas_hitdetect$HIT_DETECT_RESOLUTION","_ol_render_canvas_hitdetect$createHitDetectionImageData","_ol_render_canvas_hitdetect$hitDetect","_ol_render_canvas$measureAndCacheTextWidth","_ol_render_canvas$measureTextHeight","_ol_render_canvas$measureTextWidth","_ol_render_canvas$registerFont","rotateAtOffset","_ol_render_canvas_style$buildRuleSet","_ol_render_canvas_style$buildStyle","_ol_render_canvas_style$flatStylesToStyleFunction","_ol_render_canvas_style$rulesToStyleFunction","_ol_render_canvas$textHeights","getRenderPixel","_ol_render$getVectorContext","toContext","webgl","$ol$render$webgl$MixedGeometryBatch","_ol_render_webgl_ShaderBuilder$COMMON_HEADER","_ol_render_webgl_ShaderBuilder$ShaderBuilder","$ol$render$webgl$VectorStyleRenderer","bufferUtil","_ol_render_webgl_bufferUtil$LINESTRING_ANGLE_COSINE_CUTOFF","writeLineSegmentToBuffers","segmentStartIndex","segmentEndIndex","beforeSegmentIndex","afterSegmentIndex","vertexArray","indexArray","toWorldTransform","currentLength","currentAngleTangentSum","baseIndex","m1","p0world","p1world","angleBetween","pA","pB","lenA","tangentA","orthoA","lenB","tangentB","angle1","newAngleTangentSum","joinAfter","computeParameters","vertexIndex","angleSum","writePointFeatureToBuffers","elementIndex","bufferPositions","customAttrs","vPos","iPos","writePolygonTrianglesToBuffers","polygonStartIndex","attributesPerVertex","instructionsIndex","compileUtil","_ol_render_webgl_compileUtil$UNPACK_COLOR_FN","_ol_render_webgl_compileUtil$applyContextToBuilder","_ol_render_webgl_compileUtil$expressionToGlsl","_ol_render_webgl_compileUtil$generateAttributesFromContext","_ol_render_webgl_compileUtil$generateUniformsFromContext","_ol_render_webgl_compileUtil$getGlslSizeFromType","_ol_render_webgl_compileUtil$getGlslTypeFromType","_ol_render_webgl_compileUtil$packColor","encodeUtil","_ol_render_webgl_encodeUtil$colorDecodeId","_ol_render_webgl_encodeUtil$colorEncodeId","renderinstructions","_ol_render_webgl_renderinstructions$generateLineStringRenderInstructions","_ol_render_webgl_renderinstructions$generatePointRenderInstructions","_ol_render_webgl_renderinstructions$generatePolygonRenderInstructions","_ol_render_webgl_renderinstructions$getCustomAttributesSize","_ol_render_webgl_style$breakDownFlatStyle","_ol_render_webgl_style$computeHash","_ol_render_webgl_style$parseLiteralStyle","Composite","$ol$renderer$Composite","$ol$renderer$Layer","$ol$renderer$Map","$ol$renderer$canvas$ImageLayer","$ol$renderer$canvas$Layer","_ol_renderer_canvas_Layer$canvasPool","$ol$renderer$canvas$TileLayer","VectorImageLayer","$ol$renderer$canvas$VectorImageLayer","$ol$renderer$canvas$VectorLayer","VectorTileLayer","$ol$renderer$canvas$VectorTileLayer","_ol_renderer_vector$defaultOrder","_ol_renderer_vector$getSquaredTolerance","_ol_renderer_vector$getTolerance","_ol_renderer_vector$renderFeature","$ol$renderer$webgl$FlowLayer","$ol$renderer$webgl$Layer","PointsLayer","$ol$renderer$webgl$PointsLayer","$ol$renderer$webgl$TileLayer","_ol_renderer_webgl_TileLayer$Attributes","_ol_renderer_webgl_TileLayer$Uniforms","TileLayerBase","$ol$renderer$webgl$TileLayerBase","_ol_renderer_webgl_TileLayerBase$Uniforms","_ol_renderer_webgl_TileLayerBase$getCacheKey","_ol_renderer_webgl_TileLayerBase$newTileRepresentationLookup","$ol$renderer$webgl$VectorLayer","_ol_renderer_webgl_VectorLayer$Uniforms","$ol$renderer$webgl$VectorTileLayer","_ol_renderer_webgl_VectorTileLayer$Attributes","_ol_renderer_webgl_VectorTileLayer$Uniforms","$ol$reproj$DataTile","$ol$reproj$Image","$ol$reproj$Tile","$ol$reproj$Triangulation","_ol_reproj$calculateSourceExtentResolution","_ol_reproj$calculateSourceResolution","_ol_reproj$canvasPool","common","_ol_reproj_common$ERROR_THRESHOLD","glreproj","_ol_reproj_glreproj$canvasGLPool","_ol_reproj_glreproj$createCanvasContextWebGL","_ol_reproj_glreproj$releaseGLCanvas","_ol_reproj_glreproj$render","_ol_reproj$render","_ol_resolution$fromResolutionLike","resolutionconstraint","_ol_resolutionconstraint$createMinMaxResolution","_ol_resolutionconstraint$createSnapToPower","_ol_resolutionconstraint$createSnapToResolutions","rotationconstraint","_ol_rotationconstraint$createSnapToN","_ol_rotationconstraint$createSnapToZero","_ol_rotationconstraint$disable","_ol_rotationconstraint$none","_ol_size$hasArea","_ol_size$scale","_ol_size$toSize","BingMaps","hidpi_","culture_","culture","maxZoom_","apiKey_","imagerySet_","imagerySet","placeholderTiles_","placeholderTiles","handleImageryMetadataResponse","getApiKey","getImagerySet","statusCode","statusDescription","authenticationResultCode","resourceSets","resources","zoomMax","imageWidth","imageHeight","zoomMin","imageUrlSubdomains","subdomain","quadKeyTileCoord","imageUrl","imageryProviders","imageryProvider","intersecting","coverageAreas","coverageArea","_ol_source_BingMaps$quadKey","CartoDB","account_","account","mapId_","config_","templateCache_","initializeMap_","getConfig","updateConfig","setConfig","paramHash","applyTemplate_","mapUrl","handleInitResponse_","handleInitError_","tilesUrl","cdn_url","https","layergroupid","Cluster","interpolationRatio","createCustomCluster_","createCluster","boundRefresh_","updateDistance","setDistance","setMinDistance","getMinDistance","cluster","mapDistance","clustered","neighbors","neighbor","searchCenter","$ol$source$DataTile","$ol$source$GeoTIFF","Google","highDpi","sessionTokenRequest","mapType","language","region","imageFormat","layerTypes","apiOptions","sessionTokenRequest_","sessionTokenValue_","sessionRefreshId_","previousViewportAttribution_","previousViewportExtent_","createSession_","fetchSessionToken","createSessionUrl","method","headers","sessionTokenResponse","session","expiry","fetchAttributions_","viewportExtent","IIIF","partialOptions","supportsListedSizes","supportsListedTiles","supportsArbitraryTiling","maxScaleFactor","ignoredSizesIndex","IiifTileClass","regionParam","sizeParam","tileX","tileY","regionX","regionY","regionW","regionH","sizeW","sizeH","regionWidth","regionHeight","$ol$source$Image","_ol_source_Image$ImageSourceEvent","_ol_source_Image$defaultImageLoadFunction","_ol_source_Image$getRequestExtent","ImageArcGISRest","imageLoadFunction_","imageLoadFunction","imageSize_","ratio_","loaderProjection_","getParams","getImageLoadFunction","setImageLoadFunction","setParams","updateParams","canvasFunction_","canvasFunction","canvasElement","ImageMapGuide","displayDpi_","useOverlay_","ImageStatic","imageExtent_","getImageExtent","$ol$source$ImageTile","ImageWMS","serverType_","sourceProjectionObj","OGCMapTile","handleTileSetInfo_","tileSetInfo","OGCVectorTile","VectorTileSource","OSM","_ol_source_OSM$ATTRIBUTION","Raster","$ol$source$Raster","_ol_source_Raster$Processor","_ol_source_Raster$RasterSourceEvent","SentinelHub","evalscript_","inputData_","processUrl_","tokenRenewalId_","auth","setAuth","setData","evalscript","setEvalscript","fireWhenReady_","claims","tokenUrl","URLSearchParams","clientId","clientSecret","access_token","getToken","setup","evaluatePixel","updateOutput","serializeEvalscript","attempt","Authorization","credentials","maxRetries","retryAfter","ms","statusText","blobUrl","revokeObjectURL","imageFromResponse","_ol_source_SentinelHub$getProjectionIdentifier","_ol_source_SentinelHub$parseTokenClaims","_ol_source_SentinelHub$serializeFunction","$ol$source$Source","StadiaMaps","provider","providerConfig","layerConfig","query","apiKey","OSM_ATTRIBUTION","$ol$source$Tile","_ol_source_Tile$TileSourceEvent","TileArcGISRest","getKeyForParams_","getRequestUrl_","TileDebug","strokeRect","handler","$ol$source$TileImage","TileJSON","tileJSON_","handleTileJSONResponse","handleTileJSONError","tileJSON","getTileJSON","attributionExtent","TileWMS","v13_","updateV13_","sourceProjCoord","LAYERS","setParams_","UTFGrid","tileUrlFunction_","template_","getTemplate","forDataAtCoordinateAndResolution","grids","_ol_source_UTFGrid$CustomTile","$ol$source$UrlTile","$ol$source$Vector","_ol_source_Vector$VectorSourceEvent","$ol$source$VectorTile","_ol_source_VectorTile$defaultLoadFunction","WMTS","requestEncoding","dimensions_","matrixSet_","requestEncoding_","getKeyForDimensions_","createFromWMTSTemplate","getDimensions","getMatrixSet","getRequestEncoding","getVersion","updateDimensions","tilematrixset","Version","TileCol","TileRow","optionsFromCapabilities","wmtsCap","tileMatrixSets","findIndex","supportedCRS","el","matrixSetObj","projConfig","switchXY","selectedMatrixLimit","tileMatrixValue","tileSpanX","tileSpanY","matrixSetExtent","wgs84BoundingBox","wgs84ProjectionExtent","wgs84MatrixSetExtent","gets","encodings","$ol$source$XYZ","Zoomify","tierSizeCalculation","tierSizeInTiles","tileSizeForTierSizeCalculation","tileCountUpToTier","tileIndex","TileGroup","ZoomifyTileClass","testTileUrl","_ol_source_Zoomify$CustomTile","arcgisRest","_ol_source_arcgisRest$createLoader","_ol_source_arcgisRest$getRequestUrl","DECIMALS","DEFAULT_WMS_VERSION","mapguide","_ol_source_mapguide$createLoader","mapserver","mapExt","map_imagetype","mapext","imgext","map_size","imgx","imgy","imgxy","ogcTileUtil","_ol_source_ogcTileUtil$appendCollectionsQueryParam","_ol_source_ogcTileUtil$getMapTileUrlTemplate","_ol_source_ogcTileUtil$getTileSetInfo","_ol_source_ogcTileUtil$getVectorTileUrlTemplate","sourcesFromTileGrid","sourceCache","tileGridExtent","wantedSources","static","_ol_source_static$createLoader","wms","_ol_source_wms$DEFAULT_VERSION","_ol_source_wms$createLoader","_ol_source_wms$getFeatureInfoUrl","_ol_source_wms$getImageSrc","_ol_source_wms$getLegendUrl","_ol_source_wms$getRequestParams","_ol_source_wms$getRequestUrl","sphere","_ol_sphere$DEFAULT_RADIUS","_ol_sphere$getDistance","_ol_sphere$offset","_ol_string$compareVersions","_ol_string$padNumber","structs","$ol$structs$LRUCache","$ol$structs$PriorityQueue","_ol_structs_PriorityQueue$DROP","$ol$structs$RBush","$ol$style$Circle","$ol$style$Fill","$ol$style$Icon","$ol$style$IconImage","_ol_style_IconImage$get","$ol$style$IconImageCache","_ol_style_IconImageCache$getCacheKey","_ol_style_IconImageCache$shared","$ol$style$Image","$ol$style$RegularShape","$ol$style$Stroke","$ol$style$Style","_ol_style_Style$createDefaultStyle","_ol_style_Style$createEditingStyle","_ol_style_Style$toFunction","$ol$style$Text","_ol_style_flat$createDefaultStyle","tilecoord","_ol_tilecoord$createOrUpdate","fromKey","getCacheKeyForTileKey","_ol_tilecoord$getKey","_ol_tilecoord$getKeyZXY","_ol_tilecoord$hash","_ol_tilecoord$hashZXY","_ol_tilecoord$withinExtentAndZ","$ol$tilegrid$TileGrid","$ol$tilegrid$WMTS","_ol_tilegrid_WMTS$createFromCapabilitiesMatrixSet","_ol_tilegrid_common$DEFAULT_TILE_SIZE","_ol_tilegrid$createForExtent","_ol_tilegrid$createForProjection","_ol_tilegrid$createXYZ","_ol_tilegrid$extentFromProjection","_ol_tilegrid$getForProjection","_ol_tilegrid$wrapX","tileurlfunction","_ol_tileurlfunction$createFromTemplate","_ol_tileurlfunction$createFromTemplates","_ol_tileurlfunction$createFromTileUrlFunctions","_ol_tileurlfunction$nullTileUrlFunction","_ol_transform$apply","_ol_transform$compose","composeCssTransform","_ol_transform$create","_ol_transform$determinant","_ol_transform$equivalent","invert","_ol_transform$makeInverse","makeScale","_ol_transform$multiply","_ol_transform$reset","_ol_transform$rotate","_ol_transform$scale","_ol_transform$set","_ol_transform$setFromArray","_ol_transform$toString","_ol_transform$translate","_ol_uri$appendParams","_ol_uri$expandUrl","_ol_uri$pickUrl","_ol_uri$renderXYZTemplate","util","_ol_util$abstract","_ol_util$getUid","vec","_ol_vec_mat4$create","_ol_vec_mat4$fromTransform","_ol_vec_mat4$orthographic","_ol_vec_mat4$scale","_ol_vec_mat4$translate","_ol_vec_mat4$translation","_ol_webgl$ARRAY_BUFFER","$ol$webgl$BaseTileRepresentation","$ol$webgl$Buffer","_ol_webgl_Buffer$getArrayClassForType","_ol_webgl_Canvas$Canvas","_ol_webgl_Canvas$createProgram","_ol_webgl$DYNAMIC_DRAW","_ol_webgl$ELEMENT_ARRAY_BUFFER","_ol_webgl$FLOAT","Helper","$ol$webgl$Helper","_ol_webgl_Helper$computeAttributesStride","$ol$webgl$PaletteTexture","PostProcessingPass","$ol$webgl$PostProcessingPass","RenderTarget","$ol$webgl$RenderTarget","_ol_webgl$STATIC_DRAW","STREAM_DRAW","$ol$webgl$TileGeometry","$ol$webgl$TileTexture","UNSIGNED_SHORT","_ol_webgl$getContext","getSupportedExtensions","_ol_xml$OBJECT_PROPERTY_NODE_FACTORY","_ol_xml$XML_SCHEMA_INSTANCE_URI","_ol_xml$createElementNS","_ol_xml$getAllTextContent","_ol_xml$getAllTextContent_","_ol_xml$getAttributeNS","_ol_xml$getDocument","_ol_xml$getXMLSerializer","_ol_xml$isDocument","_ol_xml$makeArrayExtender","_ol_xml$makeArrayPusher","_ol_xml$makeArraySerializer","_ol_xml$makeChildAppender","_ol_xml$makeObjectPropertyPusher","_ol_xml$makeObjectPropertySetter","_ol_xml$makeReplacer","_ol_xml$makeSequence","_ol_xml$makeSimpleNodeFactory","_ol_xml$makeStructureNS","_ol_xml$parse","_ol_xml$parseNode","_ol_xml$pushParseAndPop","_ol_xml$pushSerializeAndPop","registerDocument","registerXMLSerializer","xmlSerializer","_ol_xml$serialize"],"mappings":"+BAOe,IAAAA,EAMR,MANQA,EAYL,SCZKC,EAMG,iBCLHC,EAML,SANKA,EAaN,QAbMA,EAiBA,cAjBAA,EAkBN,QAlBMA,EAmBH,WAnBGA,EAoBF,YApBEA,EAqBH,WArBGA,EAsBP,OAt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