UNPKG

vue3-openstreet-map

Version:

Simple Vue 3 Openlayers Map Picker & Geocoder

1,740 lines 668 kB
import { toRefs as al, ref as ll, onMounted as hl, openBlock as cl, createElementBlock as ul, Fragment as dl, createElementVNode as Oo, normalizeStyle as fl, unref as gl } from "vue"; class be { /** * @param {string} type Type. */ constructor(t) { this.propagationStopped, this.defaultPrevented, this.type = t, this.target = null; } /** * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events * will be fired. * @api */ preventDefault() { this.defaultPrevented = !0; } /** * Stop event propagation. * @api */ stopPropagation() { this.propagationStopped = !0; } } const Li = { /** * Triggered when a property is changed. * @event module:ol/Object.ObjectEvent#propertychange * @api */ PROPERTYCHANGE: "propertychange" }; class qs { constructor() { this.disposed = !1; } /** * Clean up. */ dispose() { this.disposed || (this.disposed = !0, this.disposeInternal()); } /** * Extension point for disposable objects. * @protected */ disposeInternal() { } } function _l(n, t, e) { let i, s; e = e || We; let r = 0, o = n.length, a = !1; for (; r < o; ) i = r + (o - r >> 1), s = +e(n[i], t), s < 0 ? r = i + 1 : (o = i, a = !s); return a ? r : ~r; } function We(n, t) { return n > t ? 1 : n < t ? -1 : 0; } function Hs(n, t, e) { if (n[0] <= t) return 0; const i = n.length; if (t <= n[i - 1]) return i - 1; if (typeof e == "function") { for (let s = 1; s < i; ++s) { const r = n[s]; if (r === t) return s; if (r < t) return e(t, n[s - 1], r) > 0 ? s - 1 : s; } return i - 1; } if (e > 0) { for (let s = 1; s < i; ++s) if (n[s] < t) return s - 1; return i - 1; } if (e < 0) { for (let s = 1; s < i; ++s) if (n[s] <= t) return s; return i - 1; } for (let s = 1; s < i; ++s) { if (n[s] == t) return s; if (n[s] < t) return n[s - 1] - t < t - n[s] ? s - 1 : s; } return i - 1; } function ml(n, t, e) { for (; t < e; ) { const i = n[t]; n[t] = n[e], n[e] = i, ++t, --e; } } function Js(n, t) { const e = Array.isArray(t) ? t : [t], i = e.length; for (let s = 0; s < i; s++) n[n.length] = e[s]; } function je(n, t) { const e = n.length; if (e !== t.length) return !1; for (let i = 0; i < e; i++) if (n[i] !== t[i]) return !1; return !0; } function pl(n, t, e) { const i = t || We; return n.every(function(s, r) { if (r === 0) return !0; const o = i(n[r - 1], s); return !(o > 0 || e && o === 0); }); } function nn() { return !0; } function ts() { return !1; } function Mi() { } function Fo(n) { let t = !1, e, i, s; return function() { const r = Array.prototype.slice.call(arguments); return (!t || this !== s || !je(r, i)) && (t = !0, s = this, i = r, e = n.apply(this, arguments)), e; }; } function _n(n) { for (const t in n) delete n[t]; } function Ai(n) { let t; for (t in n) return !1; return !t; } class es extends qs { /** * @param {*} [target] Default event target for dispatched events. */ constructor(t) { super(), this.eventTarget_ = t, this.pendingRemovals_ = null, this.dispatching_ = null, this.listeners_ = null; } /** * @param {string} type Type. * @param {import("../events.js").Listener} listener Listener. */ addEventListener(t, e) { if (!t || !e) return; const i = this.listeners_ || (this.listeners_ = {}), s = i[t] || (i[t] = []); s.includes(e) || s.push(e); } /** * Dispatches an event and calls all listeners listening for events * of this type. The event parameter can either be a string or an * Object with a `type` property. * * @param {import("./Event.js").default|string} event Event object. * @return {boolean|undefined} `false` if anyone called preventDefault on the * event object or if any of the listeners returned false. * @api */ dispatchEvent(t) { const e = typeof t == "string", i = e ? t : t.type, s = this.listeners_ && this.listeners_[i]; if (!s) return; const r = e ? new be(t) : ( /** @type {Event} */ t ); r.target || (r.target = this.eventTarget_ || this); const o = this.dispatching_ || (this.dispatching_ = {}), a = this.pendingRemovals_ || (this.pendingRemovals_ = {}); i in o || (o[i] = 0, a[i] = 0), ++o[i]; let l; for (let h = 0, c = s.length; h < c; ++h) if ("handleEvent" in s[h] ? l = /** @type {import("../events.js").ListenerObject} */ s[h].handleEvent(r) : l = /** @type {import("../events.js").ListenerFunction} */ s[h].call(this, r), l === !1 || r.propagationStopped) { l = !1; break; } if (--o[i] === 0) { let h = a[i]; for (delete a[i]; h--; ) this.removeEventListener(i, Mi); delete o[i]; } return l; } /** * Clean up. */ disposeInternal() { this.listeners_ && _n(this.listeners_); } /** * Get the listeners for a specified event type. Listeners are returned in the * order that they will be called in. * * @param {string} type Type. * @return {Array<import("../events.js").Listener>|undefined} Listeners. */ getListeners(t) { return this.listeners_ && this.listeners_[t] || void 0; } /** * @param {string} [type] Type. If not provided, * `true` will be returned if this event target has any listeners. * @return {boolean} Has listeners. */ hasListener(t) { return this.listeners_ ? t ? t in this.listeners_ : Object.keys(this.listeners_).length > 0 : !1; } /** * @param {string} type Type. * @param {import("../events.js").Listener} listener Listener. */ removeEventListener(t, e) { if (!this.listeners_) return; const i = this.listeners_[t]; if (!i) return; const s = i.indexOf(e); s !== -1 && (this.pendingRemovals_ && t in this.pendingRemovals_ ? (i[s] = Mi, ++this.pendingRemovals_[t]) : (i.splice(s, 1), i.length === 0 && delete this.listeners_[t])); } } const U = { /** * Generic change event. Triggered when the revision counter is increased. * @event module:ol/events/Event~BaseEvent#change * @api */ CHANGE: "change", /** * Generic error event. Triggered when an error occurs. * @event module:ol/events/Event~BaseEvent#error * @api */ ERROR: "error", BLUR: "blur", CLEAR: "clear", CONTEXTMENU: "contextmenu", CLICK: "click", DBLCLICK: "dblclick", DRAGENTER: "dragenter", DRAGOVER: "dragover", DROP: "drop", FOCUS: "focus", KEYDOWN: "keydown", KEYPRESS: "keypress", LOAD: "load", RESIZE: "resize", TOUCHMOVE: "touchmove", WHEEL: "wheel" }; function H(n, t, e, i, s) { if (i && i !== n && (e = e.bind(i)), s) { const o = e; e = function() { n.removeEventListener(t, e), o.apply(this, arguments); }; } const r = { target: n, type: t, listener: e }; return n.addEventListener(t, e), r; } function Xn(n, t, e, i) { return H(n, t, e, i, !0); } function ht(n) { n && n.target && (n.target.removeEventListener(n.type, n.listener), _n(n)); } class mn extends es { constructor() { super(), this.on = /** @type {ObservableOnSignature<import("./events").EventsKey>} */ this.onInternal, this.once = /** @type {ObservableOnSignature<import("./events").EventsKey>} */ this.onceInternal, this.un = /** @type {ObservableOnSignature<void>} */ this.unInternal, this.revision_ = 0; } /** * Increases the revision counter and dispatches a 'change' event. * @api */ changed() { ++this.revision_, this.dispatchEvent(U.CHANGE); } /** * Get the version number for this object. Each time the object is modified, * its version number will be incremented. * @return {number} Revision. * @api */ getRevision() { return this.revision_; } /** * @param {string|Array<string>} type Type. * @param {function((Event|import("./events/Event").default)): ?} listener Listener. * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key. * @protected */ onInternal(t, e) { if (Array.isArray(t)) { const i = t.length, s = new Array(i); for (let r = 0; r < i; ++r) s[r] = H(this, t[r], e); return s; } return H( this, /** @type {string} */ t, e ); } /** * @param {string|Array<string>} type Type. * @param {function((Event|import("./events/Event").default)): ?} listener Listener. * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Event key. * @protected */ onceInternal(t, e) { let i; if (Array.isArray(t)) { const s = t.length; i = new Array(s); for (let r = 0; r < s; ++r) i[r] = Xn(this, t[r], e); } else i = Xn( this, /** @type {string} */ t, e ); return e.ol_key = i, i; } /** * Unlisten for a certain type of event. * @param {string|Array<string>} type Type. * @param {function((Event|import("./events/Event").default)): ?} listener Listener. * @protected */ unInternal(t, e) { const i = ( /** @type {Object} */ e.ol_key ); if (i) yl(i); else if (Array.isArray(t)) for (let s = 0, r = t.length; s < r; ++s) this.removeEventListener(t[s], e); else this.removeEventListener(t, e); } } mn.prototype.on; mn.prototype.once; mn.prototype.un; function yl(n) { if (Array.isArray(n)) for (let t = 0, e = n.length; t < e; ++t) ht(n[t]); else ht( /** @type {import("./events.js").EventsKey} */ n ); } function Q() { throw new Error("Unimplemented abstract method."); } let El = 0; function it(n) { return n.ol_uid || (n.ol_uid = String(++El)); } class Fr extends be { /** * @param {string} type The event type. * @param {string} key The property name. * @param {*} oldValue The old value for `key`. */ constructor(t, e, i) { super(t), this.key = e, this.oldValue = i; } } class se extends mn { /** * @param {Object<string, *>} [values] An object with key-value pairs. */ constructor(t) { super(), this.on, this.once, this.un, it(this), this.values_ = null, t !== void 0 && this.setProperties(t); } /** * Gets a value. * @param {string} key Key name. * @return {*} Value. * @api */ get(t) { let e; return this.values_ && this.values_.hasOwnProperty(t) && (e = this.values_[t]), e; } /** * Get a list of object property names. * @return {Array<string>} List of property names. * @api */ getKeys() { return this.values_ && Object.keys(this.values_) || []; } /** * Get an object of all property names and values. * @return {Object<string, *>} Object. * @api */ getProperties() { return this.values_ && Object.assign({}, this.values_) || {}; } /** * Get an object of all property names and values. * @return {Object<string, *>?} Object. */ getPropertiesInternal() { return this.values_; } /** * @return {boolean} The object has properties. */ hasProperties() { return !!this.values_; } /** * @param {string} key Key name. * @param {*} oldValue Old value. */ notify(t, e) { let i; i = `change:${t}`, this.hasListener(i) && this.dispatchEvent(new Fr(i, t, e)), i = Li.PROPERTYCHANGE, this.hasListener(i) && this.dispatchEvent(new Fr(i, t, e)); } /** * @param {string} key Key name. * @param {import("./events.js").Listener} listener Listener. */ addChangeListener(t, e) { this.addEventListener(`change:${t}`, e); } /** * @param {string} key Key name. * @param {import("./events.js").Listener} listener Listener. */ removeChangeListener(t, e) { this.removeEventListener(`change:${t}`, e); } /** * Sets a value. * @param {string} key Key name. * @param {*} value Value. * @param {boolean} [silent] Update without triggering an event. * @api */ set(t, e, i) { const s = this.values_ || (this.values_ = {}); if (i) s[t] = e; else { const r = s[t]; s[t] = e, r !== e && this.notify(t, r); } } /** * Sets a collection of key-value pairs. Note that this changes any existing * properties and adds new ones (it does not remove any existing properties). * @param {Object<string, *>} values Values. * @param {boolean} [silent] Update without triggering an event. * @api */ setProperties(t, e) { for (const i in t) this.set(i, t[i], e); } /** * Apply any properties from another object without triggering events. * @param {BaseObject} source The source object. * @protected */ applyProperties(t) { t.values_ && Object.assign(this.values_ || (this.values_ = {}), t.values_); } /** * Unsets a property. * @param {string} key Key name. * @param {boolean} [silent] Unset without triggering an event. * @api */ unset(t, e) { if (this.values_ && t in this.values_) { const i = this.values_[t]; delete this.values_[t], Ai(this.values_) && (this.values_ = null), e || this.notify(t, i); } } } const Dt = { /** * Triggered when an item is added to the collection. * @event module:ol/Collection.CollectionEvent#add * @api */ ADD: "add", /** * Triggered when an item is removed from the collection. * @event module:ol/Collection.CollectionEvent#remove * @api */ REMOVE: "remove" }, Dr = { LENGTH: "length" }; class bn extends be { /** * @param {import("./CollectionEventType.js").default} type Type. * @param {T} element Element. * @param {number} index The index of the added or removed element. */ constructor(t, e, i) { super(t), this.element = e, this.index = i; } } class ce extends se { /** * @param {Array<T>} [array] Array. * @param {Options} [options] Collection options. */ constructor(t, e) { if (super(), this.on, this.once, this.un, e = e || {}, this.unique_ = !!e.unique, this.array_ = t || [], this.unique_) for (let i = 0, s = this.array_.length; i < s; ++i) this.assertUnique_(this.array_[i], i); this.updateLength_(); } /** * Remove all elements from the collection. * @api */ clear() { for (; this.getLength() > 0; ) this.pop(); } /** * Add elements to the collection. This pushes each item in the provided array * to the end of the collection. * @param {!Array<T>} arr Array. * @return {Collection<T>} This collection. * @api */ extend(t) { for (let e = 0, i = t.length; e < i; ++e) this.push(t[e]); return this; } /** * Iterate over each element, calling the provided callback. * @param {function(T, number, Array<T>): *} f The function to call * for every element. This function takes 3 arguments (the element, the * index and the array). The return value is ignored. * @api */ forEach(t) { const e = this.array_; for (let i = 0, s = e.length; i < s; ++i) t(e[i], i, e); } /** * Get a reference to the underlying Array object. Warning: if the array * is mutated, no events will be dispatched by the collection, and the * collection's "length" property won't be in sync with the actual length * of the array. * @return {!Array<T>} Array. * @api */ getArray() { return this.array_; } /** * Get the element at the provided index. * @param {number} index Index. * @return {T} Element. * @api */ item(t) { return this.array_[t]; } /** * Get the length of this collection. * @return {number} The length of the array. * @observable * @api */ getLength() { return this.get(Dr.LENGTH); } /** * Insert an element at the provided index. * @param {number} index Index. * @param {T} elem Element. * @api */ insertAt(t, e) { if (t < 0 || t > this.getLength()) throw new Error("Index out of bounds: " + t); this.unique_ && this.assertUnique_(e), this.array_.splice(t, 0, e), this.updateLength_(), this.dispatchEvent( new bn(Dt.ADD, e, t) ); } /** * Remove the last element of the collection and return it. * Return `undefined` if the collection is empty. * @return {T|undefined} Element. * @api */ pop() { return this.removeAt(this.getLength() - 1); } /** * Insert the provided element at the end of the collection. * @param {T} elem Element. * @return {number} New length of the collection. * @api */ push(t) { this.unique_ && this.assertUnique_(t); const e = this.getLength(); return this.insertAt(e, t), this.getLength(); } /** * Remove the first occurrence of an element from the collection. * @param {T} elem Element. * @return {T|undefined} The removed element or undefined if none found. * @api */ remove(t) { const e = this.array_; for (let i = 0, s = e.length; i < s; ++i) if (e[i] === t) return this.removeAt(i); } /** * Remove the element at the provided index and return it. * Return `undefined` if the collection does not contain this index. * @param {number} index Index. * @return {T|undefined} Value. * @api */ removeAt(t) { if (t < 0 || t >= this.getLength()) return; const e = this.array_[t]; return this.array_.splice(t, 1), this.updateLength_(), this.dispatchEvent( /** @type {CollectionEvent<T>} */ new bn(Dt.REMOVE, e, t) ), e; } /** * Set the element at the provided index. * @param {number} index Index. * @param {T} elem Element. * @api */ setAt(t, e) { const i = this.getLength(); if (t >= i) { this.insertAt(t, e); return; } if (t < 0) throw new Error("Index out of bounds: " + t); this.unique_ && this.assertUnique_(e, t); const s = this.array_[t]; this.array_[t] = e, this.dispatchEvent( /** @type {CollectionEvent<T>} */ new bn(Dt.REMOVE, s, t) ), this.dispatchEvent( /** @type {CollectionEvent<T>} */ new bn(Dt.ADD, e, t) ); } /** * @private */ updateLength_() { this.set(Dr.LENGTH, this.array_.length); } /** * @private * @param {T} elem Element. * @param {number} [except] Optional index to ignore. */ assertUnique_(t, e) { for (let i = 0, s = this.array_.length; i < s; ++i) if (this.array_[i] === t && i !== e) throw new Error("Duplicate item added to a unique collection"); } } const Ye = typeof navigator < "u" && typeof navigator.userAgent < "u" ? navigator.userAgent.toLowerCase() : "", xl = Ye.includes("firefox"), wl = Ye.includes("safari") && !Ye.includes("chrom"); wl && (Ye.includes("version/15.4") || /cpu (os|iphone os) 15_4 like mac os x/.test(Ye)); const Cl = Ye.includes("webkit") && !Ye.includes("edge"), Do = Ye.includes("macintosh"), ko = typeof devicePixelRatio < "u" ? devicePixelRatio : 1, Qs = typeof WorkerGlobalScope < "u" && typeof OffscreenCanvas < "u" && self instanceof WorkerGlobalScope, No = typeof Image < "u" && Image.prototype.decode, Go = function() { let n = !1; try { const t = Object.defineProperty({}, "passive", { get: function() { n = !0; } }); window.addEventListener("_", null, t), window.removeEventListener("_", null, t); } catch { } return n; }(); function J(n, t) { if (!n) throw new Error(t); } new Array(6); function ne() { return [1, 0, 0, 1, 0, 0]; } function vl(n, t, e, i, s, r, o) { return n[0] = t, n[1] = e, n[2] = i, n[3] = s, n[4] = r, n[5] = o, n; } function Tl(n, t) { return n[0] = t[0], n[1] = t[1], n[2] = t[2], n[3] = t[3], n[4] = t[4], n[5] = t[5], n; } function yt(n, t) { const e = t[0], i = t[1]; return t[0] = n[0] * e + n[2] * i + n[4], t[1] = n[1] * e + n[3] * i + n[5], t; } function Rl(n, t, e) { return vl(n, t, 0, 0, e, 0, 0); } function Re(n, t, e, i, s, r, o, a) { const l = Math.sin(r), h = Math.cos(r); return n[0] = i * h, n[1] = s * l, n[2] = -i * l, n[3] = s * h, n[4] = o * i * h - a * i * l + t, n[5] = o * s * l + a * s * h + e, n; } function tr(n, t) { const e = Il(t); J(e !== 0, "Transformation matrix cannot be inverted"); const i = t[0], s = t[1], r = t[2], o = t[3], a = t[4], l = t[5]; return n[0] = o / e, n[1] = -s / e, n[2] = -r / e, n[3] = i / e, n[4] = (r * l - o * a) / e, n[5] = -(i * l - s * a) / e, n; } function Il(n) { return n[0] * n[3] - n[1] * n[2]; } let kr; function zo(n) { const t = "matrix(" + n.join(", ") + ")"; if (Qs) return t; const e = kr || (kr = document.createElement("div")); return e.style.transform = t, e.style.transform; } const pt = { UNKNOWN: 0, INTERSECTING: 1, ABOVE: 2, RIGHT: 4, BELOW: 8, LEFT: 16 }; function Nr(n) { const t = Ht(); for (let e = 0, i = n.length; e < i; ++e) tn(t, n[e]); return t; } function Sl(n, t, e) { const i = Math.min.apply(null, n), s = Math.min.apply(null, t), r = Math.max.apply(null, n), o = Math.max.apply(null, t); return Ie(i, s, r, o, e); } function er(n, t, e) { return e ? (e[0] = n[0] - t, e[1] = n[1] - t, e[2] = n[2] + t, e[3] = n[3] + t, e) : [ n[0] - t, n[1] - t, n[2] + t, n[3] + t ]; } function Xo(n, t) { return t ? (t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t) : n.slice(); } function Wo(n, t, e) { let i, s; return t < n[0] ? i = n[0] - t : n[2] < t ? i = t - n[2] : i = 0, e < n[1] ? s = n[1] - e : n[3] < e ? s = e - n[3] : s = 0, i * i + s * s; } function is(n, t) { return Yo(n, t[0], t[1]); } function ei(n, t) { return n[0] <= t[0] && t[2] <= n[2] && n[1] <= t[1] && t[3] <= n[3]; } function Yo(n, t, e) { return n[0] <= t && t <= n[2] && n[1] <= e && e <= n[3]; } function Ds(n, t) { const e = n[0], i = n[1], s = n[2], r = n[3], o = t[0], a = t[1]; let l = pt.UNKNOWN; return o < e ? l = l | pt.LEFT : o > s && (l = l | pt.RIGHT), a < i ? l = l | pt.BELOW : a > r && (l = l | pt.ABOVE), l === pt.UNKNOWN && (l = pt.INTERSECTING), l; } function Ht() { return [1 / 0, 1 / 0, -1 / 0, -1 / 0]; } function Ie(n, t, e, i, s) { return s ? (s[0] = n, s[1] = t, s[2] = e, s[3] = i, s) : [n, t, e, i]; } function pn(n) { return Ie(1 / 0, 1 / 0, -1 / 0, -1 / 0, n); } function Bo(n, t) { const e = n[0], i = n[1]; return Ie(e, i, e, i, t); } function ir(n, t, e, i, s) { const r = pn(s); return jo(r, n, t, e, i); } function sn(n, t) { return n[0] == t[0] && n[2] == t[2] && n[1] == t[1] && n[3] == t[3]; } function bl(n, t) { return t[0] < n[0] && (n[0] = t[0]), t[2] > n[2] && (n[2] = t[2]), t[1] < n[1] && (n[1] = t[1]), t[3] > n[3] && (n[3] = t[3]), n; } function tn(n, t) { t[0] < n[0] && (n[0] = t[0]), t[0] > n[2] && (n[2] = t[0]), t[1] < n[1] && (n[1] = t[1]), t[1] > n[3] && (n[3] = t[1]); } function jo(n, t, e, i, s) { for (; e < i; e += s) Ll(n, t[e], t[e + 1]); return n; } function Ll(n, t, e) { n[0] = Math.min(n[0], t), n[1] = Math.min(n[1], e), n[2] = Math.max(n[2], t), n[3] = Math.max(n[3], e); } function Uo(n, t) { let e; return e = t(ns(n)), e || (e = t(ss(n)), e) || (e = t(rs(n)), e) || (e = t(ci(n)), e) ? e : !1; } function ks(n) { let t = 0; return yn(n) || (t = at(n) * jt(n)), t; } function ns(n) { return [n[0], n[1]]; } function ss(n) { return [n[2], n[1]]; } function li(n) { return [(n[0] + n[2]) / 2, (n[1] + n[3]) / 2]; } function Ml(n, t) { let e; if (t === "bottom-left") e = ns(n); else if (t === "bottom-right") e = ss(n); else if (t === "top-left") e = ci(n); else if (t === "top-right") e = rs(n); else throw new Error("Invalid corner"); return e; } function Ns(n, t, e, i, s) { const [r, o, a, l, h, c, u, d] = Gs( n, t, e, i ); return Ie( Math.min(r, a, h, u), Math.min(o, l, c, d), Math.max(r, a, h, u), Math.max(o, l, c, d), s ); } function Gs(n, t, e, i) { const s = t * i[0] / 2, r = t * i[1] / 2, o = Math.cos(e), a = Math.sin(e), l = s * o, h = s * a, c = r * o, u = r * a, d = n[0], f = n[1]; return [ d - l + u, f - h - c, d - l - u, f - h + c, d + l - u, f + h + c, d + l + u, f + h - c, d - l + u, f - h - c ]; } function jt(n) { return n[3] - n[1]; } function en(n, t, e) { const i = e || Ht(); return Nt(n, t) ? (n[0] > t[0] ? i[0] = n[0] : i[0] = t[0], n[1] > t[1] ? i[1] = n[1] : i[1] = t[1], n[2] < t[2] ? i[2] = n[2] : i[2] = t[2], n[3] < t[3] ? i[3] = n[3] : i[3] = t[3]) : pn(i), i; } function ci(n) { return [n[0], n[3]]; } function rs(n) { return [n[2], n[3]]; } function at(n) { return n[2] - n[0]; } function Nt(n, t) { return n[0] <= t[2] && n[2] >= t[0] && n[1] <= t[3] && n[3] >= t[1]; } function yn(n) { return n[2] < n[0] || n[3] < n[1]; } function Al(n, t) { return t ? (t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t) : n; } function Pl(n, t, e) { let i = !1; const s = Ds(n, t), r = Ds(n, e); if (s === pt.INTERSECTING || r === pt.INTERSECTING) i = !0; else { const o = n[0], a = n[1], l = n[2], h = n[3], c = t[0], u = t[1], d = e[0], f = e[1], g = (f - u) / (d - c); let _, m; r & pt.ABOVE && !(s & pt.ABOVE) && (_ = d - (f - h) / g, i = _ >= o && _ <= l), !i && r & pt.RIGHT && !(s & pt.RIGHT) && (m = f - (d - l) * g, i = m >= a && m <= h), !i && r & pt.BELOW && !(s & pt.BELOW) && (_ = d - (f - a) / g, i = _ >= o && _ <= l), !i && r & pt.LEFT && !(s & pt.LEFT) && (m = f - (d - o) * g, i = m >= a && m <= h); } return i; } function Ol(n, t, e, i) { if (yn(n)) return pn(e); let s = []; if (i > 1) { const a = n[2] - n[0], l = n[3] - n[1]; for (let h = 0; h < i; ++h) s.push( n[0] + a * h / i, n[1], n[2], n[1] + l * h / i, n[2] - a * h / i, n[3], n[0], n[3] - l * h / i ); } else s = [ n[0], n[1], n[2], n[1], n[2], n[3], n[0], n[3] ]; t(s, s, 2); const r = [], o = []; for (let a = 0, l = s.length; a < l; a += 2) r.push(s[a]), o.push(s[a + 1]); return Sl(r, o, e); } function Vo(n, t) { const e = t.getExtent(), i = li(n); if (t.canWrapX() && (i[0] < e[0] || i[0] >= e[2])) { const s = at(e), o = Math.floor( (i[0] - e[0]) / s ) * s; n[0] -= o, n[2] -= o; } return n; } function Fl(n, t) { if (t.canWrapX()) { const e = t.getExtent(); if (!isFinite(n[0]) || !isFinite(n[2])) return [[e[0], n[1], e[2], n[3]]]; Vo(n, t); const i = at(e); if (at(n) > i) return [[e[0], n[1], e[2], n[3]]]; if (n[0] < e[0]) return [ [n[0] + i, n[1], e[2], n[3]], [e[0], n[1], n[2], n[3]] ]; if (n[2] > e[2]) return [ [n[0], n[1], e[2], n[3]], [e[0], n[1], n[2] - i, n[3]] ]; } return [n]; } const rn = { name: "rgb", min: [0, 0, 0], max: [255, 255, 255], channel: ["red", "green", "blue"], alias: ["RGB"] }; var wt = { name: "xyz", min: [0, 0, 0], channel: ["X", "Y", "Z"], alias: ["XYZ", "ciexyz", "cie1931"] }; wt.whitepoint = { //1931 2° 2: { //incadescent A: [109.85, 100, 35.585], // B:[], C: [98.074, 100, 118.232], D50: [96.422, 100, 82.521], D55: [95.682, 100, 92.149], //daylight D65: [95.045592705167, 100, 108.9057750759878], D75: [94.972, 100, 122.638], //flourescent // F1: [], F2: [99.187, 100, 67.395], // F3: [], // F4: [], // F5: [], // F6:[], F7: [95.044, 100, 108.755], // F8: [], // F9: [], // F10: [], F11: [100.966, 100, 64.37], // F12: [], E: [100, 100, 100] }, //1964 10° 10: { //incadescent A: [111.144, 100, 35.2], C: [97.285, 100, 116.145], D50: [96.72, 100, 81.427], D55: [95.799, 100, 90.926], //daylight D65: [94.811, 100, 107.304], D75: [94.416, 100, 120.641], //flourescent F2: [103.28, 100, 69.026], F7: [95.792, 100, 107.687], F11: [103.866, 100, 65.627], E: [100, 100, 100] } }; wt.max = wt.whitepoint[2].D65; wt.rgb = function(n, t) { t = t || wt.whitepoint[2].E; var e = n[0] / t[0], i = n[1] / t[1], s = n[2] / t[2], r, o, a; return r = e * 3.240969941904521 + i * -1.537383177570093 + s * -0.498610760293, o = e * -0.96924363628087 + i * 1.87596750150772 + s * 0.041555057407175, a = e * 0.055630079696993 + i * -0.20397695888897 + s * 1.056971514242878, r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r = r * 12.92, o = o > 31308e-7 ? 1.055 * Math.pow(o, 1 / 2.4) - 0.055 : o = o * 12.92, a = a > 31308e-7 ? 1.055 * Math.pow(a, 1 / 2.4) - 0.055 : a = a * 12.92, r = Math.min(Math.max(0, r), 1), o = Math.min(Math.max(0, o), 1), a = Math.min(Math.max(0, a), 1), [r * 255, o * 255, a * 255]; }; rn.xyz = function(n, t) { var e = n[0] / 255, i = n[1] / 255, s = n[2] / 255; e = e > 0.04045 ? Math.pow((e + 0.055) / 1.055, 2.4) : e / 12.92, i = i > 0.04045 ? Math.pow((i + 0.055) / 1.055, 2.4) : i / 12.92, s = s > 0.04045 ? Math.pow((s + 0.055) / 1.055, 2.4) : s / 12.92; var r = e * 0.41239079926595 + i * 0.35758433938387 + s * 0.18048078840183, o = e * 0.21263900587151 + i * 0.71516867876775 + s * 0.072192315360733, a = e * 0.019330818715591 + i * 0.11919477979462 + s * 0.95053215224966; return t = t || wt.whitepoint[2].E, [r * t[0], o * t[1], a * t[2]]; }; const nr = { name: "luv", //NOTE: luv has no rigidly defined limits //easyrgb fails to get proper coords //boronine states no rigid limits //colorMine refers this ones: min: [0, -134, -140], max: [100, 224, 122], channel: ["lightness", "u", "v"], alias: ["LUV", "cieluv", "cie1976"], xyz: function(n, t, e) { var i, s, r, o, a, l, h, c, u, d, f, g, _; if (r = n[0], o = n[1], a = n[2], r === 0) return [0, 0, 0]; var m = 0.0011070564598794539; return t = t || "D65", e = e || 2, u = wt.whitepoint[e][t][0], d = wt.whitepoint[e][t][1], f = wt.whitepoint[e][t][2], g = 4 * u / (u + 15 * d + 3 * f), _ = 9 * d / (u + 15 * d + 3 * f), i = o / (13 * r) + g || 0, s = a / (13 * r) + _ || 0, h = r > 8 ? d * Math.pow((r + 16) / 116, 3) : d * r * m, l = h * 9 * i / (4 * s) || 0, c = h * (12 - 3 * i - 20 * s) / (4 * s) || 0, [l, h, c]; } }; wt.luv = function(n, t, e) { var i, s, r, o, a, l, h, c, u, d, f, g, _, m = 0.008856451679035631, p = 903.2962962962961; t = t || "D65", e = e || 2, u = wt.whitepoint[e][t][0], d = wt.whitepoint[e][t][1], f = wt.whitepoint[e][t][2], g = 4 * u / (u + 15 * d + 3 * f), _ = 9 * d / (u + 15 * d + 3 * f), l = n[0], h = n[1], c = n[2], i = 4 * l / (l + 15 * h + 3 * c) || 0, s = 9 * h / (l + 15 * h + 3 * c) || 0; var y = h / d; return r = y <= m ? p * y : 116 * Math.pow(y, 1 / 3) - 16, o = 13 * r * (i - g), a = 13 * r * (s - _), [r, o, a]; }; var Zo = { name: "lchuv", channel: ["lightness", "chroma", "hue"], alias: ["LCHuv", "cielchuv"], min: [0, 0, 0], max: [100, 100, 360], luv: function(n) { var t = n[0], e = n[1], i = n[2], s, r, o; return o = i / 360 * 2 * Math.PI, s = e * Math.cos(o), r = e * Math.sin(o), [t, s, r]; }, xyz: function(n) { return nr.xyz(Zo.luv(n)); } }; nr.lchuv = function(n) { var t = n[0], e = n[1], i = n[2], s = Math.sqrt(e * e + i * i), r = Math.atan2(i, e), o = r * 360 / 2 / Math.PI; return o < 0 && (o += 360), [t, s, o]; }; wt.lchuv = function(n) { return nr.lchuv(wt.luv(n)); }; var Ko = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function sr(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } function Le(n) { if (n.__esModule) return n; var t = n.default; if (typeof t == "function") { var e = function i() { return this instanceof i ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments); }; e.prototype = t.prototype; } else e = {}; return Object.defineProperty(e, "__esModule", { value: !0 }), Object.keys(n).forEach(function(i) { var s = Object.getOwnPropertyDescriptor(n, i); Object.defineProperty(e, i, s.get ? s : { enumerable: !0, get: function() { return n[i]; } }); }), e; } var Dl = { aliceblue: [240, 248, 255], antiquewhite: [250, 235, 215], aqua: [0, 255, 255], aquamarine: [127, 255, 212], azure: [240, 255, 255], beige: [245, 245, 220], bisque: [255, 228, 196], black: [0, 0, 0], blanchedalmond: [255, 235, 205], blue: [0, 0, 255], blueviolet: [138, 43, 226], brown: [165, 42, 42], burlywood: [222, 184, 135], cadetblue: [95, 158, 160], chartreuse: [127, 255, 0], chocolate: [210, 105, 30], coral: [255, 127, 80], cornflowerblue: [100, 149, 237], cornsilk: [255, 248, 220], crimson: [220, 20, 60], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgoldenrod: [184, 134, 11], darkgray: [169, 169, 169], darkgreen: [0, 100, 0], darkgrey: [169, 169, 169], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkseagreen: [143, 188, 143], darkslateblue: [72, 61, 139], darkslategray: [47, 79, 79], darkslategrey: [47, 79, 79], darkturquoise: [0, 206, 209], darkviolet: [148, 0, 211], deeppink: [255, 20, 147], deepskyblue: [0, 191, 255], dimgray: [105, 105, 105], dimgrey: [105, 105, 105], dodgerblue: [30, 144, 255], firebrick: [178, 34, 34], floralwhite: [255, 250, 240], forestgreen: [34, 139, 34], fuchsia: [255, 0, 255], gainsboro: [220, 220, 220], ghostwhite: [248, 248, 255], gold: [255, 215, 0], goldenrod: [218, 165, 32], gray: [128, 128, 128], green: [0, 128, 0], greenyellow: [173, 255, 47], grey: [128, 128, 128], honeydew: [240, 255, 240], hotpink: [255, 105, 180], indianred: [205, 92, 92], indigo: [75, 0, 130], ivory: [255, 255, 240], khaki: [240, 230, 140], lavender: [230, 230, 250], lavenderblush: [255, 240, 245], lawngreen: [124, 252, 0], lemonchiffon: [255, 250, 205], lightblue: [173, 216, 230], lightcoral: [240, 128, 128], lightcyan: [224, 255, 255], lightgoldenrodyellow: [250, 250, 210], lightgray: [211, 211, 211], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightsalmon: [255, 160, 122], lightseagreen: [32, 178, 170], lightskyblue: [135, 206, 250], lightslategray: [119, 136, 153], lightslategrey: [119, 136, 153], lightsteelblue: [176, 196, 222], lightyellow: [255, 255, 224], lime: [0, 255, 0], limegreen: [50, 205, 50], linen: [250, 240, 230], magenta: [255, 0, 255], maroon: [128, 0, 0], mediumaquamarine: [102, 205, 170], mediumblue: [0, 0, 205], mediumorchid: [186, 85, 211], mediumpurple: [147, 112, 219], mediumseagreen: [60, 179, 113], mediumslateblue: [123, 104, 238], mediumspringgreen: [0, 250, 154], mediumturquoise: [72, 209, 204], mediumvioletred: [199, 21, 133], midnightblue: [25, 25, 112], mintcream: [245, 255, 250], mistyrose: [255, 228, 225], moccasin: [255, 228, 181], navajowhite: [255, 222, 173], navy: [0, 0, 128], oldlace: [253, 245, 230], olive: [128, 128, 0], olivedrab: [107, 142, 35], orange: [255, 165, 0], orangered: [255, 69, 0], orchid: [218, 112, 214], palegoldenrod: [238, 232, 170], palegreen: [152, 251, 152], paleturquoise: [175, 238, 238], palevioletred: [219, 112, 147], papayawhip: [255, 239, 213], peachpuff: [255, 218, 185], peru: [205, 133, 63], pink: [255, 192, 203], plum: [221, 160, 221], powderblue: [176, 224, 230], purple: [128, 0, 128], rebeccapurple: [102, 51, 153], red: [255, 0, 0], rosybrown: [188, 143, 143], royalblue: [65, 105, 225], saddlebrown: [139, 69, 19], salmon: [250, 128, 114], sandybrown: [244, 164, 96], seagreen: [46, 139, 87], seashell: [255, 245, 238], sienna: [160, 82, 45], silver: [192, 192, 192], skyblue: [135, 206, 235], slateblue: [106, 90, 205], slategray: [112, 128, 144], slategrey: [112, 128, 144], snow: [255, 250, 250], springgreen: [0, 255, 127], steelblue: [70, 130, 180], tan: [210, 180, 140], teal: [0, 128, 128], thistle: [216, 191, 216], tomato: [255, 99, 71], turquoise: [64, 224, 208], violet: [238, 130, 238], wheat: [245, 222, 179], white: [255, 255, 255], whitesmoke: [245, 245, 245], yellow: [255, 255, 0], yellowgreen: [154, 205, 50] }; const Gr = /* @__PURE__ */ sr(Dl); var zr = { red: 0, orange: 60, yellow: 120, green: 180, blue: 240, purple: 300 }; function kl(n) { var c, u; var t, e = [], i = 1, s; if (typeof n == "number") return { space: "rgb", values: [n >>> 16, (n & 65280) >>> 8, n & 255], alpha: 1 }; if (typeof n == "number") return { space: "rgb", values: [n >>> 16, (n & 65280) >>> 8, n & 255], alpha: 1 }; if (n = String(n).toLowerCase(), Gr[n]) e = Gr[n].slice(), s = "rgb"; else if (n === "transparent") i = 0, s = "rgb", e = [0, 0, 0]; else if (n[0] === "#") { var r = n.slice(1), o = r.length, a = o <= 4; i = 1, a ? (e = [ parseInt(r[0] + r[0], 16), parseInt(r[1] + r[1], 16), parseInt(r[2] + r[2], 16) ], o === 4 && (i = parseInt(r[3] + r[3], 16) / 255)) : (e = [ parseInt(r[0] + r[1], 16), parseInt(r[2] + r[3], 16), parseInt(r[4] + r[5], 16) ], o === 8 && (i = parseInt(r[6] + r[7], 16) / 255)), e[0] || (e[0] = 0), e[1] || (e[1] = 0), e[2] || (e[2] = 0), s = "rgb"; } else if (t = /^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(n)) { var l = t[1]; s = l.replace(/a$/, ""); var h = s === "cmyk" ? 4 : s === "gray" ? 1 : 3; e = t[2].trim().split(/\s*[,\/]\s*|\s+/), s === "color" && (s = e.shift()), e = e.map(function(d, f) { if (d[d.length - 1] === "%") return d = parseFloat(d) / 100, f === 3 ? d : s === "rgb" ? d * 255 : s[0] === "h" || s[0] === "l" && !f ? d * 100 : s === "lab" ? d * 125 : s === "lch" ? f < 2 ? d * 150 : d * 360 : s[0] === "o" && !f ? d : s === "oklab" ? d * 0.4 : s === "oklch" ? f < 2 ? d * 0.4 : d * 360 : d; if (s[f] === "h" || f === 2 && s[s.length - 1] === "h") { if (zr[d] !== void 0) return zr[d]; if (d.endsWith("deg")) return parseFloat(d); if (d.endsWith("turn")) return parseFloat(d) * 360; if (d.endsWith("grad")) return parseFloat(d) * 360 / 400; if (d.endsWith("rad")) return parseFloat(d) * 180 / Math.PI; } return d === "none" ? 0 : parseFloat(d); }), i = e.length > h ? e.pop() : 1; } else /[0-9](?:\s|\/|,)/.test(n) && (e = n.match(/([0-9]+)/g).map(function(d) { return parseFloat(d); }), s = ((u = (c = n.match(/([a-z])/ig)) == null ? void 0 : c.join("")) == null ? void 0 : u.toLowerCase()) || "rgb"); return { space: s, values: e, alpha: i }; } const Es = { name: "hsl", min: [0, 0, 0], max: [360, 100, 100], channel: ["hue", "saturation", "lightness"], alias: ["HSL"], rgb: function(n) { var t = n[0] / 360, e = n[1] / 100, i = n[2] / 100, s, r, o, a, l, h = 0; if (e === 0) return l = i * 255, [l, l, l]; for (r = i < 0.5 ? i * (1 + e) : i + e - i * e, s = 2 * i - r, a = [0, 0, 0]; h < 3; ) o = t + 1 / 3 * -(h - 1), o < 0 ? o++ : o > 1 && o--, l = 6 * o < 1 ? s + (r - s) * 6 * o : 2 * o < 1 ? r : 3 * o < 2 ? s + (r - s) * (2 / 3 - o) * 6 : s, a[h++] = l * 255; return a; } }; rn.hsl = function(n) { var t = n[0] / 255, e = n[1] / 255, i = n[2] / 255, s = Math.min(t, e, i), r = Math.max(t, e, i), o = r - s, a, l, h; return r === s ? a = 0 : t === r ? a = (e - i) / o : e === r ? a = 2 + (i - t) / o : i === r && (a = 4 + (t - e) / o), a = Math.min(a * 60, 360), a < 0 && (a += 360), h = (s + r) / 2, r === s ? l = 0 : h <= 0.5 ? l = o / (r + s) : l = o / (2 - r - s), [a, l * 100, h * 100]; }; function Nl(n) { Array.isArray(n) && n.raw && (n = String.raw(...arguments)), n instanceof Number && (n = +n); var t, e = kl(n); if (!e.space) return []; const i = e.space[0] === "h" ? Es.min : rn.min, s = e.space[0] === "h" ? Es.max : rn.max; return t = Array(3), t[0] = Math.min(Math.max(e.values[0], i[0]), s[0]), t[1] = Math.min(Math.max(e.values[1], i[1]), s[1]), t[2] = Math.min(Math.max(e.values[2], i[2]), s[2]), e.space[0] === "h" && (t = Es.rgb(t)), t.push(Math.min(Math.max(e.alpha, 0), 1)), t; } function ft(n, t, e) { return Math.min(Math.max(n, t), e); } function Gl(n, t, e, i, s, r) { const o = s - e, a = r - i; if (o !== 0 || a !== 0) { const l = ((n - e) * o + (t - i) * a) / (o * o + a * a); l > 1 ? (e = s, i = r) : l > 0 && (e += o * l, i += a * l); } return Si(n, t, e, i); } function Si(n, t, e, i) { const s = e - n, r = i - t; return s * s + r * r; } function zl(n) { const t = n.length; for (let i = 0; i < t; i++) { let s = i, r = Math.abs(n[i][i]); for (let a = i + 1; a < t; a++) { const l = Math.abs(n[a][i]); l > r && (r = l, s = a); } if (r === 0) return null; const o = n[s]; n[s] = n[i], n[i] = o; for (let a = i + 1; a < t; a++) { const l = -n[a][i] / n[i][i]; for (let h = i; h < t + 1; h++) i == h ? n[a][h] = 0 : n[a][h] += l * n[i][h]; } } const e = new Array(t); for (let i = t - 1; i >= 0; i--) { e[i] = n[i][t] / n[i][i]; for (let s = i - 1; s >= 0; s--) n[s][t] -= n[s][i] * e[i]; } return e; } function zn(n) { return n * Math.PI / 180; } function ri(n, t) { const e = n % t; return e * t < 0 ? e + t : e; } function $t(n, t, e) { return n + e * (t - n); } function rr(n, t) { const e = Math.pow(10, t); return Math.round(n * e) / e; } function Ln(n, t) { return Math.floor(rr(n, t)); } function Mn(n, t) { return Math.ceil(rr(n, t)); } function $o(n) { return typeof n == "string" ? n : Ho(n); } const Xl = 1024, Zi = {}; let xs = 0; function Wl(n) { if (n.length === 4) return n; const t = n.slice(); return t[3] = 1, t; } function Xr(n) { const t = wt.lchuv(rn.xyz(n)); return t[3] = n[3], t; } function Yl(n) { const t = wt.rgb(Zo.xyz(n)); return t[3] = n[3], t; } function or(n) { if (Zi.hasOwnProperty(n)) return Zi[n]; if (xs >= Xl) { let e = 0; for (const i in Zi) e++ & 3 || (delete Zi[i], --xs); } const t = Nl(n); if (t.length !== 4) throw new Error('Failed to parse "' + n + '" as color'); for (const e of t) if (isNaN(e)) throw new Error('Failed to parse "' + n + '" as color'); return qo(t), Zi[n] = t, ++xs, t; } function Wn(n) { return Array.isArray(n) ? n : or(n); } function qo(n) { return n[0] = ft(n[0] + 0.5 | 0, 0, 255), n[1] = ft(n[1] + 0.5 | 0, 0, 255), n[2] = ft(n[2] + 0.5 | 0, 0, 255), n[3] = ft(n[3], 0, 1), n; } function Ho(n) { let t = n[0]; t != (t | 0) && (t = t + 0.5 | 0); let e = n[1]; e != (e | 0) && (e = e + 0.5 | 0); let i = n[2]; i != (i | 0) && (i = i + 0.5 | 0); const s = n[3] === void 0 ? 1 : Math.round(n[3] * 100) / 100; return "rgba(" + t + "," + e + "," + i + "," + s + ")"; } function Bl(n) { try { return or(n), !0; } catch { return !1; } } class jl { constructor() { this.cache_ = {}, this.cacheSize_ = 0, this.maxCacheSize_ = 32; } /** * FIXME empty description for jsdoc */ clear() { this.cache_ = {}, this.cacheSize_ = 0; } /** * @return {boolean} Can expire cache. */ canExpireCache() { return this.cacheSize_ > this.maxCacheSize_; } /** * FIXME empty description for jsdoc */ expire() { if (this.canExpireCache()) { let t = 0; for (const e in this.cache_) { const i = this.cache_[e]; !(t++ & 3) && !i.hasListener() && (delete this.cache_[e], --this.cacheSize_); } } } /** * @param {string} src Src. * @param {?string} crossOrigin Cross origin. * @param {import("../color.js").Color} color Color. * @return {import("./IconImage.js").default} Icon image. */ get(t, e, i) { const s = Wr(t, e, i); return s in this.cache_ ? this.cache_[s] : null; } /** * @param {string} src Src. * @param {?string} crossOrigin Cross origin. * @param {import("../color.js").Color} color Color. * @param {import("./IconImage.js").default} iconImage Icon image. */ set(t, e, i, s) { const r = Wr(t, e, i); this.cache_[r] = s, ++this.cacheSize_; } /** * Set the cache size of the icon cache. Default is `32`. Change this value when * your map uses more than 32 different icon images and you are not caching icon * styles on the application level. * @param {number} maxCacheSize Cache max size. * @api */ setSize(t) { this.maxCacheSize_ = t, this.expire(); } } function Wr(n, t, e) { const i = e ? $o(e) : "null"; return t + ":" + n + ":" + i; } const Yn = new jl(), rt = { OPACITY: "opacity", VISIBLE: "visible", EXTENT: "extent", Z_INDEX: "zIndex", MAX_RESOLUTION: "maxResolution", MIN_RESOLUTION: "minResolution", MAX_ZOOM: "maxZoom", MIN_ZOOM: "minZoom", SOURCE: "source", MAP: "map" }; class Jo extends se { /** * @param {Options} options Layer options. */ constructor(t) { super(), this.on, this.once, this.un, this.background_ = t.background; const e = Object.assign({}, t); typeof t.properties == "object" && (delete e.properties, Object.assign(e, t.properties)), e[rt.OPACITY] = t.opacity !== void 0 ? t.opacity : 1, J( typeof e[rt.OPACITY] == "number", "Layer opacity must be a number" ), e[rt.VISIBLE] = t.visible !== void 0 ? t.visible : !0, e[rt.Z_INDEX] = t.zIndex, e[rt.MAX_RESOLUTION] = t.maxResolution !== void 0 ? t.maxResolution : 1 / 0, e[rt.MIN_RESOLUTION] = t.minResolution !== void 0 ? t.minResolution : 0, e[rt.MIN_ZOOM] = t.minZoom !== void 0 ? t.minZoom : -1 / 0, e[rt.MAX_ZOOM] = t.maxZoom !== void 0 ? t.maxZoom : 1 / 0, this.className_ = e.className !== void 0 ? e.className : "ol-layer", delete e.className, this.setProperties(e), this.state_ = null; } /** * Get the background for this layer. * @return {BackgroundColor|false} Layer background. */ getBackground() { return this.background_; } /** * @return {string} CSS class name. */ getClassName() { return this.className_; } /** * This method is not meant to be called by layers or layer renderers because the state * is incorrect if the layer is included in a layer group. * * @param {boolean} [managed] Layer is managed. * @return {import("./Layer.js").State} Layer state. */ getLayerState(t) { const e = this.state_ || /** @type {?} */ { layer: this, managed: t === void 0 ? !0 : t }, i = this.getZIndex(); return e.opacity = ft(Math.round(this.getOpacity() * 100) / 100, 0, 1), e.visible = this.getVisible(), e.extent = this.getExtent(), e.zIndex = i === void 0 && !e.managed ? 1 / 0 : i, e.maxResolution = this.getMaxResolution(), e.minResolution = Math.max(this.getMinResolution(), 0), e.minZoom = this.getMinZoom(), e.maxZoom = this.getMaxZoom(), this.state_ = e, e; } /** * @abstract * @param {Array<import("./Layer.js").default>} [array] Array of layers (to be * modified in place). * @return {Array<import("./Layer.js").default>} Array of layers. */ getLayersArray(t) { return Q(); } /** * @abstract * @param {Array<import("./Layer.js").State>} [states] Optional list of layer * states (to be modified in place). * @return {Array<import("./Layer.js").State>} List of layer states. */ getLayerStatesArray(t) { return Q(); } /** * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it * will be visible regardless of extent. * @return {import("../extent.js").Extent|undefined} The layer extent. * @observable * @api */ getExtent() { return ( /** @type {import("../extent.js").Extent|undefined} */ this.get(rt.EXTENT) ); } /** * Return the maximum resolution of the layer. Returns Infinity if * the layer has no maximum resolution set. * @return {number} The maximum resolution of the layer. * @observable * @api */ getMaxResolution() { return ( /** @type {number} */ this.get(rt.MAX_RESOLUTION) ); } /** * Return the minimum resolution of the layer. Returns 0 if * the layer has no minimum resolution set. * @return {number} The minimum resolution of the layer. * @observable * @api */ getMinResolution() { return ( /** @type {number} */ this.get(rt.MIN_RESOLUTION) ); } /** * Return the minimum zoom level of the layer. Returns -Infinity if * the layer has no minimum zoom set. * @return {number} The minimum zoom level of the layer. * @observable * @api */ getMinZoom() { return ( /** @type {number} */ this.get(rt.MIN_ZOOM) ); } /** * Return the maximum zoom level of the layer. Returns Infinity if * the layer has no maximum zoom set. * @return {number} The maximum zoom level of the layer. * @observable * @api */ getMaxZoom() { return ( /** @type {number} */ this.get(rt.MAX_ZOOM) ); } /** * Return the opacity of the layer (between 0 and 1). * @return {number} The opacity of the layer. * @observable * @api */ getOpacity() { return ( /** @type {number} */ this.get(rt.OPACITY) ); } /** * @abstract * @return {import("../source/Source.js").State} Source state. */ getSourceState() { return Q(); } /** * Return the value of this layer's `visible`