@hybridcore/ui 1.0.2 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/ButtonBase-BYmh3G5j.js +967 -0
  2. package/dist/CardContent-C8PxkJz4.js +73 -0
  3. package/dist/Checkbox-DostZSwR.js +673 -0
  4. package/dist/DialogContent-2aPOjKE7.js +2025 -0
  5. package/dist/FormControl-BiAFm76F.js +1491 -0
  6. package/dist/IconButton-CQJ8wZE8.js +183 -0
  7. package/dist/Input-Bf5G3tFN.js +324 -0
  8. package/dist/OutlinedInput-BEVE8VZQ.js +452 -0
  9. package/dist/Paper-CaiWdndQ.js +162 -0
  10. package/dist/Select-DxpxZbJp.js +2526 -0
  11. package/dist/Source-CnCcu5UP.js +4374 -0
  12. package/dist/Text-BT5kPHOo.js +2192 -0
  13. package/dist/Typography-XIiVCSto.js +178 -0
  14. package/dist/assertThisInitialized-BUtkG-md.js +13 -0
  15. package/dist/assets/index.css +1 -0
  16. package/dist/assets/index2.css +1 -0
  17. package/dist/chainPropTypes-DtBfUj5o.js +96 -0
  18. package/dist/components/access/helpers.js +32 -0
  19. package/dist/components/access/index.js +15 -0
  20. package/dist/components/card/index.js +159 -469
  21. package/dist/components/card/styled.js +75 -7
  22. package/dist/components/conditional-wrapper/index.js +9 -0
  23. package/dist/components/confirm/dialog.js +151 -0
  24. package/dist/components/confirm/index.js +23 -0
  25. package/dist/components/container/index.js +270 -0
  26. package/dist/components/context-menu/index.js +973 -0
  27. package/dist/components/data-management/instance-form/components/composite-list/index.js +12 -0
  28. package/dist/components/data-management/instance-form/components/composite-list/styled.js +64 -0
  29. package/dist/components/data-management/instance-form/components/policy-list/index.js +86 -0
  30. package/dist/components/data-management/instance-form/components/variable/index.js +15 -0
  31. package/dist/components/data-management/instance-form/components/variables/index.js +39 -0
  32. package/dist/components/data-management/instance-form/index.js +437 -0
  33. package/dist/components/data-security-selectors/dissemination-list/index.js +3201 -0
  34. package/dist/components/data-security-selectors/security-level/index.js +81 -0
  35. package/dist/components/date-time-picker/index.js +103 -0
  36. package/dist/components/geometry-picker/coordinate/index.js +93 -0
  37. package/dist/components/geometry-picker/edit/index.js +71 -0
  38. package/dist/components/geometry-picker/geometry/index.js +160 -0
  39. package/dist/components/geometry-picker/geometry/map-overlay.js +22 -0
  40. package/dist/components/geometry-picker/index.js +140 -0
  41. package/dist/components/geometry-picker/kml/index.js +62 -0
  42. package/dist/components/geometry-picker/kml/select-input-method.js +75 -0
  43. package/dist/components/geometry-picker/logic.js +69 -0
  44. package/dist/components/geometry-picker/map/index.js +42 -0
  45. package/dist/components/geometry-picker/map/logic.js +2360 -0
  46. package/dist/components/geometry-picker/map/style.js +88 -0
  47. package/dist/components/geometry-picker/parser/coordinate-input/index.js +78 -0
  48. package/dist/components/geometry-picker/parser/coordinate-input/logic.js +1305 -0
  49. package/dist/components/geometry-picker/parser/index.js +179 -0
  50. package/dist/components/geometry-picker/parser/logic.js +84 -0
  51. package/dist/components/geometry-picker/parser/styled.js +25 -0
  52. package/dist/components/geometry-picker/styled.js +48 -0
  53. package/dist/components/geometry-picker/wkt/index.js +59 -0
  54. package/dist/components/geometry-picker/wkt/select-input-method.js +75 -0
  55. package/dist/components/icon-button/index.js +18 -0
  56. package/dist/components/icon-button/styled.js +51 -0
  57. package/dist/components/key-protection/index.js +4 -0
  58. package/dist/components/key-protection/menu.js +85 -0
  59. package/dist/components/key-protection/utils.js +10 -0
  60. package/dist/components/loading/index.js +7 -0
  61. package/dist/components/loading/styled.js +16 -0
  62. package/dist/components/map/helpers/kml.js +45 -0
  63. package/dist/components/map/helpers/mapbox.js +48 -0
  64. package/dist/components/map/helpers/ol.js +25 -0
  65. package/dist/components/map/helpers/wkt.js +29 -0
  66. package/dist/components/map/index.js +8 -0
  67. package/dist/components/map/logic.js +140 -0
  68. package/dist/components/map/styled.js +8 -0
  69. package/dist/components/phone-input/index.js +25 -0
  70. package/dist/components/phone-input/styled.js +26 -0
  71. package/dist/components/search-input/index.js +76 -0
  72. package/dist/components/tree-select/index.js +70 -0
  73. package/dist/components/tree-select/styled.js +64 -0
  74. package/dist/components/treeview-filter/index.js +621 -0
  75. package/dist/components/treeview-filter/item/index.js +7 -0
  76. package/dist/components/treeview-filter/item-label/index.js +44 -0
  77. package/dist/createTheme-agWfFD64.js +2392 -0
  78. package/dist/exactProp-CI8dagM-.js +36 -0
  79. package/dist/extends-C3382pL0.js +22 -0
  80. package/dist/has-9_asnBxn.js +688 -0
  81. package/dist/hooks/useMenuLogic.js +21 -0
  82. package/dist/hooks/useToggle.js +23 -0
  83. package/dist/index-Bw_m9ult.js +1105 -0
  84. package/dist/index-IvOfmM1F.js +34 -0
  85. package/dist/index-wW2D1aTG.js +957 -0
  86. package/dist/isHostComponent-kiaBvYVo.js +6 -0
  87. package/dist/isMuiElement-CxT3_ACP.js +13 -0
  88. package/dist/listItemTextClasses-BvXFz-Oc.js +132 -0
  89. package/dist/main.d.ts +1317 -0
  90. package/dist/main.js +41 -2
  91. package/dist/ol-DXmSLlWv.js +15041 -0
  92. package/dist/ownerDocument-CUrv0DIK.js +6 -0
  93. package/dist/ownerWindow-niciwP7I.js +7 -0
  94. package/dist/styled-C43K9x7T.js +229 -0
  95. package/dist/styled-Iq9jsO4F.js +1033 -0
  96. package/dist/useFormControl-CatNKXAi.js +10 -0
  97. package/dist/useId-BHG98T5I.js +26 -0
  98. package/dist/useTheme-C0Dky5rV.js +17 -0
  99. package/dist/useTheme-CeyGVuQP.js +10 -0
  100. package/dist/useThemeProps-CzAjOL6F.js +26 -0
  101. package/dist/utils/ontology.js +37 -0
  102. package/dist/utils-Bq0ye5vf.js +115 -0
  103. package/dist/utils-DLpkeyhZ.js +365 -0
  104. package/package.json +26 -5
  105. package/dist/styled-BG5UIpPU.js +0 -3459
@@ -0,0 +1,4374 @@
1
+ import { k as W, m as K, d as p, W as ce, f as H, b as S, i as E, n as Lt, o as ge, s as j, p as fe, q as de, r as Re, e as _e, V as me, u as nt, l as it, E as Ct } from "./has-9_asnBxn.js";
2
+ const vt = {
3
+ // use the radius of the Normal sphere
4
+ radians: 6370997 / (2 * Math.PI),
5
+ degrees: 2 * Math.PI * 6370997 / 360,
6
+ ft: 0.3048,
7
+ m: 1,
8
+ "us-ft": 1200 / 3937
9
+ };
10
+ class Yt {
11
+ /**
12
+ * @param {Options} options Projection options.
13
+ */
14
+ constructor(t) {
15
+ this.code_ = t.code, this.units_ = /** @type {import("./Units.js").Units} */
16
+ t.units, this.extent_ = t.extent !== void 0 ? t.extent : null, this.worldExtent_ = t.worldExtent !== void 0 ? t.worldExtent : null, this.axisOrientation_ = t.axisOrientation !== void 0 ? t.axisOrientation : "enu", this.global_ = t.global !== void 0 ? t.global : !1, this.canWrapX_ = !!(this.global_ && this.extent_), this.getPointResolutionFunc_ = t.getPointResolution, this.defaultTileGrid_ = null, this.metersPerUnit_ = t.metersPerUnit;
17
+ }
18
+ /**
19
+ * @return {boolean} The projection is suitable for wrapping the x-axis
20
+ */
21
+ canWrapX() {
22
+ return this.canWrapX_;
23
+ }
24
+ /**
25
+ * Get the code for this projection, e.g. 'EPSG:4326'.
26
+ * @return {string} Code.
27
+ * @api
28
+ */
29
+ getCode() {
30
+ return this.code_;
31
+ }
32
+ /**
33
+ * Get the validity extent for this projection.
34
+ * @return {import("../extent.js").Extent} Extent.
35
+ * @api
36
+ */
37
+ getExtent() {
38
+ return this.extent_;
39
+ }
40
+ /**
41
+ * Get the units of this projection.
42
+ * @return {import("./Units.js").Units} Units.
43
+ * @api
44
+ */
45
+ getUnits() {
46
+ return this.units_;
47
+ }
48
+ /**
49
+ * Get the amount of meters per unit of this projection. If the projection is
50
+ * not configured with `metersPerUnit` or a units identifier, the return is
51
+ * `undefined`.
52
+ * @return {number|undefined} Meters.
53
+ * @api
54
+ */
55
+ getMetersPerUnit() {
56
+ return this.metersPerUnit_ || vt[this.units_];
57
+ }
58
+ /**
59
+ * Get the world extent for this projection.
60
+ * @return {import("../extent.js").Extent} Extent.
61
+ * @api
62
+ */
63
+ getWorldExtent() {
64
+ return this.worldExtent_;
65
+ }
66
+ /**
67
+ * Get the axis orientation of this projection.
68
+ * Example values are:
69
+ * enu - the default easting, northing, elevation.
70
+ * neu - northing, easting, up - useful for "lat/long" geographic coordinates,
71
+ * or south orientated transverse mercator.
72
+ * wnu - westing, northing, up - some planetary coordinate systems have
73
+ * "west positive" coordinate systems
74
+ * @return {string} Axis orientation.
75
+ * @api
76
+ */
77
+ getAxisOrientation() {
78
+ return this.axisOrientation_;
79
+ }
80
+ /**
81
+ * Is this projection a global projection which spans the whole world?
82
+ * @return {boolean} Whether the projection is global.
83
+ * @api
84
+ */
85
+ isGlobal() {
86
+ return this.global_;
87
+ }
88
+ /**
89
+ * Set if the projection is a global projection which spans the whole world
90
+ * @param {boolean} global Whether the projection is global.
91
+ * @api
92
+ */
93
+ setGlobal(t) {
94
+ this.global_ = t, this.canWrapX_ = !!(t && this.extent_);
95
+ }
96
+ /**
97
+ * @return {import("../tilegrid/TileGrid.js").default} The default tile grid.
98
+ */
99
+ getDefaultTileGrid() {
100
+ return this.defaultTileGrid_;
101
+ }
102
+ /**
103
+ * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid.
104
+ */
105
+ setDefaultTileGrid(t) {
106
+ this.defaultTileGrid_ = t;
107
+ }
108
+ /**
109
+ * Set the validity extent for this projection.
110
+ * @param {import("../extent.js").Extent} extent Extent.
111
+ * @api
112
+ */
113
+ setExtent(t) {
114
+ this.extent_ = t, this.canWrapX_ = !!(this.global_ && t);
115
+ }
116
+ /**
117
+ * Set the world extent for this projection.
118
+ * @param {import("../extent.js").Extent} worldExtent World extent
119
+ * [minlon, minlat, maxlon, maxlat].
120
+ * @api
121
+ */
122
+ setWorldExtent(t) {
123
+ this.worldExtent_ = t;
124
+ }
125
+ /**
126
+ * Set the getPointResolution function (see {@link module:ol/proj.getPointResolution}
127
+ * for this projection.
128
+ * @param {function(number, import("../coordinate.js").Coordinate):number} func Function
129
+ * @api
130
+ */
131
+ setGetPointResolution(t) {
132
+ this.getPointResolutionFunc_ = t;
133
+ }
134
+ /**
135
+ * Get the custom point resolution function for this projection (if set).
136
+ * @return {function(number, import("../coordinate.js").Coordinate):number|undefined} The custom point
137
+ * resolution function (if set).
138
+ */
139
+ getPointResolutionFunc() {
140
+ return this.getPointResolutionFunc_;
141
+ }
142
+ }
143
+ const z = 6378137, Z = Math.PI * z, ye = [-Z, -Z, Z, Z], Me = [-180, -85, 180, 85], U = z * Math.log(Math.tan(Math.PI / 2));
144
+ class x extends Yt {
145
+ /**
146
+ * @param {string} code Code.
147
+ */
148
+ constructor(t) {
149
+ super({
150
+ code: t,
151
+ units: "m",
152
+ extent: ye,
153
+ global: !0,
154
+ worldExtent: Me,
155
+ getPointResolution: function(e, i) {
156
+ return e / Math.cosh(i[1] / z);
157
+ }
158
+ });
159
+ }
160
+ }
161
+ const Et = [
162
+ new x("EPSG:3857"),
163
+ new x("EPSG:102100"),
164
+ new x("EPSG:102113"),
165
+ new x("EPSG:900913"),
166
+ new x("http://www.opengis.net/def/crs/EPSG/0/3857"),
167
+ new x("http://www.opengis.net/gml/srs/epsg.xml#3857")
168
+ ];
169
+ function Ce(n, t, e) {
170
+ const i = n.length;
171
+ e = e > 1 ? e : 2, t === void 0 && (e > 2 ? t = n.slice() : t = new Array(i));
172
+ for (let r = 0; r < i; r += e) {
173
+ t[r] = Z * n[r] / 180;
174
+ let s = z * Math.log(Math.tan(Math.PI * (+n[r + 1] + 90) / 360));
175
+ s > U ? s = U : s < -U && (s = -U), t[r + 1] = s;
176
+ }
177
+ return t;
178
+ }
179
+ function Ee(n, t, e) {
180
+ const i = n.length;
181
+ e = e > 1 ? e : 2, t === void 0 && (e > 2 ? t = n.slice() : t = new Array(i));
182
+ for (let r = 0; r < i; r += e)
183
+ t[r] = 180 * n[r] / Z, t[r + 1] = 360 * Math.atan(Math.exp(n[r + 1] / z)) / Math.PI - 90;
184
+ return t;
185
+ }
186
+ const Ie = 6378137, It = [-180, -90, 180, 90], Se = Math.PI * Ie / 180;
187
+ class N extends Yt {
188
+ /**
189
+ * @param {string} code Code.
190
+ * @param {string} [axisOrientation] Axis orientation.
191
+ */
192
+ constructor(t, e) {
193
+ super({
194
+ code: t,
195
+ units: "degrees",
196
+ extent: It,
197
+ axisOrientation: e,
198
+ global: !0,
199
+ metersPerUnit: Se,
200
+ worldExtent: It
201
+ });
202
+ }
203
+ }
204
+ const St = [
205
+ new N("CRS:84"),
206
+ new N("EPSG:4326", "neu"),
207
+ new N("urn:ogc:def:crs:OGC:1.3:CRS84"),
208
+ new N("urn:ogc:def:crs:OGC:2:84"),
209
+ new N("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),
210
+ new N("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"),
211
+ new N("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")
212
+ ];
213
+ let ot = {};
214
+ function pe(n) {
215
+ return ot[n] || ot[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, "EPSG:$3")] || null;
216
+ }
217
+ function Ae(n, t) {
218
+ ot[n] = t;
219
+ }
220
+ let b = {};
221
+ function k(n, t, e) {
222
+ const i = n.getCode(), r = t.getCode();
223
+ i in b || (b[i] = {}), b[i][r] = e;
224
+ }
225
+ function we(n, t) {
226
+ let e;
227
+ return n in b && t in b[n] && (e = b[n][t]), e;
228
+ }
229
+ const C = {
230
+ UNKNOWN: 0,
231
+ INTERSECTING: 1,
232
+ ABOVE: 2,
233
+ RIGHT: 4,
234
+ BELOW: 8,
235
+ LEFT: 16
236
+ };
237
+ function Gn(n) {
238
+ const t = $();
239
+ for (let e = 0, i = n.length; e < i; ++e)
240
+ xe(t, n[e]);
241
+ return t;
242
+ }
243
+ function Pe(n, t, e) {
244
+ const i = Math.min.apply(null, n), r = Math.min.apply(null, t), s = Math.max.apply(null, n), o = Math.max.apply(null, t);
245
+ return J(i, r, s, o, e);
246
+ }
247
+ function jn(n, t, e) {
248
+ return e ? (e[0] = n[0] - t, e[1] = n[1] - t, e[2] = n[2] + t, e[3] = n[3] + t, e) : [
249
+ n[0] - t,
250
+ n[1] - t,
251
+ n[2] + t,
252
+ n[3] + t
253
+ ];
254
+ }
255
+ function Ln(n, t) {
256
+ return t ? (t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t) : n.slice();
257
+ }
258
+ function zt(n, t, e) {
259
+ let i, r;
260
+ return t < n[0] ? i = n[0] - t : n[2] < t ? i = t - n[2] : i = 0, e < n[1] ? r = n[1] - e : n[3] < e ? r = e - n[3] : r = 0, i * i + r * r;
261
+ }
262
+ function vn(n, t) {
263
+ return Ut(n, t[0], t[1]);
264
+ }
265
+ function Te(n, t) {
266
+ return n[0] <= t[0] && t[2] <= n[2] && n[1] <= t[1] && t[3] <= n[3];
267
+ }
268
+ function Ut(n, t, e) {
269
+ return n[0] <= t && t <= n[2] && n[1] <= e && e <= n[3];
270
+ }
271
+ function pt(n, t) {
272
+ const e = n[0], i = n[1], r = n[2], s = n[3], o = t[0], u = t[1];
273
+ let a = C.UNKNOWN;
274
+ return o < e ? a = a | C.LEFT : o > r && (a = a | C.RIGHT), u < i ? a = a | C.BELOW : u > s && (a = a | C.ABOVE), a === C.UNKNOWN && (a = C.INTERSECTING), a;
275
+ }
276
+ function $() {
277
+ return [1 / 0, 1 / 0, -1 / 0, -1 / 0];
278
+ }
279
+ function J(n, t, e, i, r) {
280
+ return r ? (r[0] = n, r[1] = t, r[2] = e, r[3] = i, r) : [n, t, e, i];
281
+ }
282
+ function Q(n) {
283
+ return J(1 / 0, 1 / 0, -1 / 0, -1 / 0, n);
284
+ }
285
+ function Ne(n, t) {
286
+ const e = n[0], i = n[1];
287
+ return J(e, i, e, i, t);
288
+ }
289
+ function Oe(n, t, e, i, r) {
290
+ const s = Q(r);
291
+ return Vt(s, n, t, e, i);
292
+ }
293
+ function Yn(n, t) {
294
+ return n[0] == t[0] && n[2] == t[2] && n[1] == t[1] && n[3] == t[3];
295
+ }
296
+ function zn(n, t) {
297
+ 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;
298
+ }
299
+ function xe(n, t) {
300
+ 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]);
301
+ }
302
+ function Vt(n, t, e, i, r) {
303
+ for (; e < i; e += r)
304
+ Fe(n, t[e], t[e + 1]);
305
+ return n;
306
+ }
307
+ function Fe(n, t, e) {
308
+ 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);
309
+ }
310
+ function Ze(n, t) {
311
+ let e;
312
+ return e = t(be(n)), e || (e = t(Xe(n)), e) || (e = t(ve(n)), e) || (e = t(Le(n)), e) ? e : !1;
313
+ }
314
+ function Un(n) {
315
+ let t = 0;
316
+ return tt(n) || (t = A(n) * X(n)), t;
317
+ }
318
+ function be(n) {
319
+ return [n[0], n[1]];
320
+ }
321
+ function Xe(n) {
322
+ return [n[2], n[1]];
323
+ }
324
+ function L(n) {
325
+ return [(n[0] + n[2]) / 2, (n[1] + n[3]) / 2];
326
+ }
327
+ function Ge(n, t, e, i, r) {
328
+ const [s, o, u, a, h, l, c, g] = je(
329
+ n,
330
+ t,
331
+ e,
332
+ i
333
+ );
334
+ return J(
335
+ Math.min(s, u, h, c),
336
+ Math.min(o, a, l, g),
337
+ Math.max(s, u, h, c),
338
+ Math.max(o, a, l, g),
339
+ r
340
+ );
341
+ }
342
+ function je(n, t, e, i) {
343
+ const r = t * i[0] / 2, s = t * i[1] / 2, o = Math.cos(e), u = Math.sin(e), a = r * o, h = r * u, l = s * o, c = s * u, g = n[0], f = n[1];
344
+ return [
345
+ g - a + c,
346
+ f - h - l,
347
+ g - a - c,
348
+ f - h + l,
349
+ g + a - c,
350
+ f + h + l,
351
+ g + a + c,
352
+ f + h - l,
353
+ g - a + c,
354
+ f - h - l
355
+ ];
356
+ }
357
+ function X(n) {
358
+ return n[3] - n[1];
359
+ }
360
+ function Vn(n, t, e) {
361
+ const i = e || $();
362
+ return lt(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]) : Q(i), i;
363
+ }
364
+ function Le(n) {
365
+ return [n[0], n[3]];
366
+ }
367
+ function ve(n) {
368
+ return [n[2], n[3]];
369
+ }
370
+ function A(n) {
371
+ return n[2] - n[0];
372
+ }
373
+ function lt(n, t) {
374
+ return n[0] <= t[2] && n[2] >= t[0] && n[1] <= t[3] && n[3] >= t[1];
375
+ }
376
+ function tt(n) {
377
+ return n[2] < n[0] || n[3] < n[1];
378
+ }
379
+ function Ye(n, t) {
380
+ return t ? (t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t) : n;
381
+ }
382
+ function ze(n, t, e) {
383
+ let i = !1;
384
+ const r = pt(n, t), s = pt(n, e);
385
+ if (r === C.INTERSECTING || s === C.INTERSECTING)
386
+ i = !0;
387
+ else {
388
+ const o = n[0], u = n[1], a = n[2], h = n[3], l = t[0], c = t[1], g = e[0], f = e[1], d = (f - c) / (g - l);
389
+ let R, _;
390
+ s & C.ABOVE && !(r & C.ABOVE) && (R = g - (f - h) / d, i = R >= o && R <= a), !i && s & C.RIGHT && !(r & C.RIGHT) && (_ = f - (g - a) * d, i = _ >= u && _ <= h), !i && s & C.BELOW && !(r & C.BELOW) && (R = g - (f - u) / d, i = R >= o && R <= a), !i && s & C.LEFT && !(r & C.LEFT) && (_ = f - (g - o) * d, i = _ >= u && _ <= h);
391
+ }
392
+ return i;
393
+ }
394
+ function Ue(n, t, e, i) {
395
+ if (tt(n))
396
+ return Q(e);
397
+ let r = [];
398
+ r = [
399
+ n[0],
400
+ n[1],
401
+ n[2],
402
+ n[1],
403
+ n[2],
404
+ n[3],
405
+ n[0],
406
+ n[3]
407
+ ], t(r, r, 2);
408
+ const s = [], o = [];
409
+ for (let u = 0, a = r.length; u < a; u += 2)
410
+ s.push(r[u]), o.push(r[u + 1]);
411
+ return Pe(s, o, e);
412
+ }
413
+ function Ve(n, t) {
414
+ const e = t.getExtent(), i = L(n);
415
+ if (t.canWrapX() && (i[0] < e[0] || i[0] >= e[2])) {
416
+ const r = A(e), o = Math.floor(
417
+ (i[0] - e[0]) / r
418
+ ) * r;
419
+ n[0] -= o, n[2] -= o;
420
+ }
421
+ return n;
422
+ }
423
+ function Dn(n, t) {
424
+ if (t.canWrapX()) {
425
+ const e = t.getExtent();
426
+ if (!isFinite(n[0]) || !isFinite(n[2]))
427
+ return [[e[0], n[1], e[2], n[3]]];
428
+ Ve(n, t);
429
+ const i = A(e);
430
+ if (A(n) > i)
431
+ return [[e[0], n[1], e[2], n[3]]];
432
+ if (n[0] < e[0])
433
+ return [
434
+ [n[0] + i, n[1], e[2], n[3]],
435
+ [e[0], n[1], n[2], n[3]]
436
+ ];
437
+ if (n[2] > e[2])
438
+ return [
439
+ [n[0], n[1], e[2], n[3]],
440
+ [e[0], n[1], n[2] - i, n[3]]
441
+ ];
442
+ }
443
+ return [n];
444
+ }
445
+ function De(n, t) {
446
+ return n[0] += +t[0], n[1] += +t[1], n;
447
+ }
448
+ function Wn(n, t) {
449
+ const e = t.getRadius(), i = t.getCenter(), r = i[0], s = i[1], o = n[0], u = n[1];
450
+ let a = o - r;
451
+ const h = u - s;
452
+ a === 0 && h === 0 && (a = 1);
453
+ const l = Math.sqrt(a * a + h * h), c = r + e * a / l, g = s + e * h / l;
454
+ return [c, g];
455
+ }
456
+ function We(n, t) {
457
+ const e = n[0], i = n[1], r = t[0], s = t[1], o = r[0], u = r[1], a = s[0], h = s[1], l = a - o, c = h - u, g = l === 0 && c === 0 ? 0 : (l * (e - o) + c * (i - u)) / (l * l + c * c || 0);
458
+ let f, d;
459
+ return g <= 0 ? (f = o, d = u) : g >= 1 ? (f = a, d = h) : (f = o + g * l, d = u + g * c), [f, d];
460
+ }
461
+ function B(n, t) {
462
+ let e = !0;
463
+ for (let i = n.length - 1; i >= 0; --i)
464
+ if (n[i] != t[i]) {
465
+ e = !1;
466
+ break;
467
+ }
468
+ return e;
469
+ }
470
+ function Ke(n, t) {
471
+ const e = Math.cos(t), i = Math.sin(t), r = n[0] * e - n[1] * i, s = n[1] * e + n[0] * i;
472
+ return n[0] = r, n[1] = s, n;
473
+ }
474
+ function Kn(n, t) {
475
+ return n[0] *= t, n[1] *= t, n;
476
+ }
477
+ function Dt(n, t) {
478
+ const e = n[0] - t[0], i = n[1] - t[1];
479
+ return e * e + i * i;
480
+ }
481
+ function kn(n, t) {
482
+ return Math.sqrt(Dt(n, t));
483
+ }
484
+ function Bn(n, t) {
485
+ return Dt(n, We(n, t));
486
+ }
487
+ function qn(n, t) {
488
+ if (t.canWrapX()) {
489
+ const e = A(t.getExtent()), i = ke(n, t, e);
490
+ i && (n[0] -= i * e);
491
+ }
492
+ return n;
493
+ }
494
+ function ke(n, t, e) {
495
+ const i = t.getExtent();
496
+ let r = 0;
497
+ return t.canWrapX() && (n[0] < i[0] || n[0] > i[2]) && (e = e || A(i), r = Math.floor(
498
+ (n[0] - i[0]) / e
499
+ )), r;
500
+ }
501
+ const Be = 63710088e-1;
502
+ function At(n, t, e) {
503
+ e = e || Be;
504
+ const i = W(n[1]), r = W(t[1]), s = (r - i) / 2, o = W(t[0] - n[0]) / 2, u = Math.sin(s) * Math.sin(s) + Math.sin(o) * Math.sin(o) * Math.cos(i) * Math.cos(r);
505
+ return 2 * e * Math.atan2(Math.sqrt(u), Math.sqrt(1 - u));
506
+ }
507
+ function qe(...n) {
508
+ console.warn(...n);
509
+ }
510
+ let at = !0;
511
+ function Wt(n) {
512
+ at = !1;
513
+ }
514
+ function ht(n, t) {
515
+ if (t !== void 0) {
516
+ for (let e = 0, i = n.length; e < i; ++e)
517
+ t[e] = n[e];
518
+ t = t;
519
+ } else
520
+ t = n.slice();
521
+ return t;
522
+ }
523
+ function Kt(n, t) {
524
+ if (t !== void 0 && n !== t) {
525
+ for (let e = 0, i = n.length; e < i; ++e)
526
+ t[e] = n[e];
527
+ n = t;
528
+ }
529
+ return n;
530
+ }
531
+ function He(n) {
532
+ Ae(n.getCode(), n), k(n, n, ht);
533
+ }
534
+ function $e(n) {
535
+ n.forEach(He);
536
+ }
537
+ function T(n) {
538
+ return typeof n == "string" ? pe(
539
+ /** @type {string} */
540
+ n
541
+ ) : (
542
+ /** @type {Projection} */
543
+ n || null
544
+ );
545
+ }
546
+ function Hn(n, t, e, i) {
547
+ n = T(n);
548
+ let r;
549
+ const s = n.getPointResolutionFunc();
550
+ if (s)
551
+ r = s(t, e);
552
+ else {
553
+ const o = n.getUnits();
554
+ if (o == "degrees" && !i || i == "degrees")
555
+ r = t;
556
+ else {
557
+ const u = gt(
558
+ n,
559
+ T("EPSG:4326")
560
+ );
561
+ if (u === Kt && o !== "degrees")
562
+ r = t * n.getMetersPerUnit();
563
+ else {
564
+ let h = [
565
+ e[0] - t / 2,
566
+ e[1],
567
+ e[0] + t / 2,
568
+ e[1],
569
+ e[0],
570
+ e[1] - t / 2,
571
+ e[0],
572
+ e[1] + t / 2
573
+ ];
574
+ h = u(h, h, 2);
575
+ const l = At(h.slice(0, 2), h.slice(2, 4)), c = At(h.slice(4, 6), h.slice(6, 8));
576
+ r = (l + c) / 2;
577
+ }
578
+ const a = n.getMetersPerUnit();
579
+ a !== void 0 && (r /= a);
580
+ }
581
+ }
582
+ return r;
583
+ }
584
+ function wt(n) {
585
+ $e(n), n.forEach(function(t) {
586
+ n.forEach(function(e) {
587
+ t !== e && k(t, e, ht);
588
+ });
589
+ });
590
+ }
591
+ function Je(n, t, e, i) {
592
+ n.forEach(function(r) {
593
+ t.forEach(function(s) {
594
+ k(r, s, e), k(s, r, i);
595
+ });
596
+ });
597
+ }
598
+ function ct(n, t) {
599
+ return n ? typeof n == "string" ? T(n) : (
600
+ /** @type {Projection} */
601
+ n
602
+ ) : T(t);
603
+ }
604
+ function $n(n, t) {
605
+ return Wt(), kt(
606
+ n,
607
+ "EPSG:4326",
608
+ "EPSG:3857"
609
+ );
610
+ }
611
+ function Jn(n, t) {
612
+ const e = kt(
613
+ n,
614
+ "EPSG:3857",
615
+ "EPSG:4326"
616
+ ), i = e[0];
617
+ return (i < -180 || i > 180) && (e[0] = K(i + 180, 360) - 180), e;
618
+ }
619
+ function Qn(n, t) {
620
+ if (n === t)
621
+ return !0;
622
+ const e = n.getUnits() === t.getUnits();
623
+ return (n.getCode() === t.getCode() || gt(n, t) === ht) && e;
624
+ }
625
+ function gt(n, t) {
626
+ const e = n.getCode(), i = t.getCode();
627
+ let r = we(e, i);
628
+ return r || (r = Kt), r;
629
+ }
630
+ function q(n, t) {
631
+ const e = T(n), i = T(t);
632
+ return gt(e, i);
633
+ }
634
+ function kt(n, t, e) {
635
+ return q(t, e)(n, void 0, n.length);
636
+ }
637
+ function ti(n, t, e, i) {
638
+ const r = q(t, e);
639
+ return Ue(n, r, void 0);
640
+ }
641
+ function Pt(n, t) {
642
+ return n;
643
+ }
644
+ function w(n, t) {
645
+ return at && !B(n, [0, 0]) && n[0] >= -180 && n[0] <= 180 && n[1] >= -90 && n[1] <= 90 && (at = !1, qe(
646
+ "Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates."
647
+ )), n;
648
+ }
649
+ function Qe(n, t) {
650
+ return n;
651
+ }
652
+ function V(n, t) {
653
+ return n;
654
+ }
655
+ function tn() {
656
+ wt(Et), wt(St), Je(
657
+ St,
658
+ Et,
659
+ Ce,
660
+ Ee
661
+ );
662
+ }
663
+ tn();
664
+ new Array(6);
665
+ function en() {
666
+ return [1, 0, 0, 1, 0, 0];
667
+ }
668
+ function nn(n, t, e, i, r, s, o) {
669
+ return n[0] = t, n[1] = e, n[2] = i, n[3] = r, n[4] = s, n[5] = o, n;
670
+ }
671
+ function ei(n, t) {
672
+ 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;
673
+ }
674
+ function ni(n, t) {
675
+ const e = t[0], i = t[1];
676
+ return t[0] = n[0] * e + n[2] * i + n[4], t[1] = n[1] * e + n[3] * i + n[5], t;
677
+ }
678
+ function ii(n, t, e) {
679
+ return nn(n, t, 0, 0, e, 0, 0);
680
+ }
681
+ function rn(n, t, e, i, r, s, o, u) {
682
+ const a = Math.sin(s), h = Math.cos(s);
683
+ return n[0] = i * h, n[1] = r * a, n[2] = -i * a, n[3] = r * h, n[4] = o * i * h - u * i * a + t, n[5] = o * r * a + u * r * h + e, n;
684
+ }
685
+ function ri(n, t) {
686
+ const e = sn(t);
687
+ p(e !== 0, 32);
688
+ const i = t[0], r = t[1], s = t[2], o = t[3], u = t[4], a = t[5];
689
+ return n[0] = o / e, n[1] = -r / e, n[2] = -s / e, n[3] = i / e, n[4] = (s * a - o * u) / e, n[5] = -(i * a - r * u) / e, n;
690
+ }
691
+ function sn(n) {
692
+ return n[0] * n[3] - n[1] * n[2];
693
+ }
694
+ let Tt;
695
+ function si(n) {
696
+ const t = "matrix(" + n.join(", ") + ")";
697
+ if (ce)
698
+ return t;
699
+ const e = Tt || (Tt = document.createElement("div"));
700
+ return e.style.transform = t, e.style.transform;
701
+ }
702
+ const m = {
703
+ OPACITY: "opacity",
704
+ VISIBLE: "visible",
705
+ EXTENT: "extent",
706
+ Z_INDEX: "zIndex",
707
+ MAX_RESOLUTION: "maxResolution",
708
+ MIN_RESOLUTION: "minResolution",
709
+ MAX_ZOOM: "maxZoom",
710
+ MIN_ZOOM: "minZoom",
711
+ SOURCE: "source",
712
+ MAP: "map"
713
+ };
714
+ class on extends H {
715
+ /**
716
+ * @param {Options} options Layer options.
717
+ */
718
+ constructor(t) {
719
+ super(), this.on, this.once, this.un, this.background_ = t.background;
720
+ const e = Object.assign({}, t);
721
+ typeof t.properties == "object" && (delete e.properties, Object.assign(e, t.properties)), e[m.OPACITY] = t.opacity !== void 0 ? t.opacity : 1, p(typeof e[m.OPACITY] == "number", 64), e[m.VISIBLE] = t.visible !== void 0 ? t.visible : !0, e[m.Z_INDEX] = t.zIndex, e[m.MAX_RESOLUTION] = t.maxResolution !== void 0 ? t.maxResolution : 1 / 0, e[m.MIN_RESOLUTION] = t.minResolution !== void 0 ? t.minResolution : 0, e[m.MIN_ZOOM] = t.minZoom !== void 0 ? t.minZoom : -1 / 0, e[m.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;
722
+ }
723
+ /**
724
+ * Get the background for this layer.
725
+ * @return {BackgroundColor|false} Layer background.
726
+ */
727
+ getBackground() {
728
+ return this.background_;
729
+ }
730
+ /**
731
+ * @return {string} CSS class name.
732
+ */
733
+ getClassName() {
734
+ return this.className_;
735
+ }
736
+ /**
737
+ * This method is not meant to be called by layers or layer renderers because the state
738
+ * is incorrect if the layer is included in a layer group.
739
+ *
740
+ * @param {boolean} [managed] Layer is managed.
741
+ * @return {import("./Layer.js").State} Layer state.
742
+ */
743
+ getLayerState(t) {
744
+ const e = this.state_ || /** @type {?} */
745
+ {
746
+ layer: this,
747
+ managed: t === void 0 ? !0 : t
748
+ }, i = this.getZIndex();
749
+ return e.opacity = S(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;
750
+ }
751
+ /**
752
+ * @abstract
753
+ * @param {Array<import("./Layer.js").default>} [array] Array of layers (to be
754
+ * modified in place).
755
+ * @return {Array<import("./Layer.js").default>} Array of layers.
756
+ */
757
+ getLayersArray(t) {
758
+ return E();
759
+ }
760
+ /**
761
+ * @abstract
762
+ * @param {Array<import("./Layer.js").State>} [states] Optional list of layer
763
+ * states (to be modified in place).
764
+ * @return {Array<import("./Layer.js").State>} List of layer states.
765
+ */
766
+ getLayerStatesArray(t) {
767
+ return E();
768
+ }
769
+ /**
770
+ * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it
771
+ * will be visible regardless of extent.
772
+ * @return {import("../extent.js").Extent|undefined} The layer extent.
773
+ * @observable
774
+ * @api
775
+ */
776
+ getExtent() {
777
+ return (
778
+ /** @type {import("../extent.js").Extent|undefined} */
779
+ this.get(m.EXTENT)
780
+ );
781
+ }
782
+ /**
783
+ * Return the maximum resolution of the layer.
784
+ * @return {number} The maximum resolution of the layer.
785
+ * @observable
786
+ * @api
787
+ */
788
+ getMaxResolution() {
789
+ return (
790
+ /** @type {number} */
791
+ this.get(m.MAX_RESOLUTION)
792
+ );
793
+ }
794
+ /**
795
+ * Return the minimum resolution of the layer.
796
+ * @return {number} The minimum resolution of the layer.
797
+ * @observable
798
+ * @api
799
+ */
800
+ getMinResolution() {
801
+ return (
802
+ /** @type {number} */
803
+ this.get(m.MIN_RESOLUTION)
804
+ );
805
+ }
806
+ /**
807
+ * Return the minimum zoom level of the layer.
808
+ * @return {number} The minimum zoom level of the layer.
809
+ * @observable
810
+ * @api
811
+ */
812
+ getMinZoom() {
813
+ return (
814
+ /** @type {number} */
815
+ this.get(m.MIN_ZOOM)
816
+ );
817
+ }
818
+ /**
819
+ * Return the maximum zoom level of the layer.
820
+ * @return {number} The maximum zoom level of the layer.
821
+ * @observable
822
+ * @api
823
+ */
824
+ getMaxZoom() {
825
+ return (
826
+ /** @type {number} */
827
+ this.get(m.MAX_ZOOM)
828
+ );
829
+ }
830
+ /**
831
+ * Return the opacity of the layer (between 0 and 1).
832
+ * @return {number} The opacity of the layer.
833
+ * @observable
834
+ * @api
835
+ */
836
+ getOpacity() {
837
+ return (
838
+ /** @type {number} */
839
+ this.get(m.OPACITY)
840
+ );
841
+ }
842
+ /**
843
+ * @abstract
844
+ * @return {import("../source/Source.js").State} Source state.
845
+ */
846
+ getSourceState() {
847
+ return E();
848
+ }
849
+ /**
850
+ * Return the value of this layer's `visible` property. To find out whether the layer
851
+ * is visible on a map, use `isVisible()` instead.
852
+ * @return {boolean} The value of the `visible` property of the layer.
853
+ * @observable
854
+ * @api
855
+ */
856
+ getVisible() {
857
+ return (
858
+ /** @type {boolean} */
859
+ this.get(m.VISIBLE)
860
+ );
861
+ }
862
+ /**
863
+ * Return the Z-index of the layer, which is used to order layers before
864
+ * rendering. The default Z-index is 0.
865
+ * @return {number} The Z-index of the layer.
866
+ * @observable
867
+ * @api
868
+ */
869
+ getZIndex() {
870
+ return (
871
+ /** @type {number} */
872
+ this.get(m.Z_INDEX)
873
+ );
874
+ }
875
+ /**
876
+ * Sets the background color.
877
+ * @param {BackgroundColor} [background] Background color.
878
+ */
879
+ setBackground(t) {
880
+ this.background_ = t, this.changed();
881
+ }
882
+ /**
883
+ * Set the extent at which the layer is visible. If `undefined`, the layer
884
+ * will be visible at all extents.
885
+ * @param {import("../extent.js").Extent|undefined} extent The extent of the layer.
886
+ * @observable
887
+ * @api
888
+ */
889
+ setExtent(t) {
890
+ this.set(m.EXTENT, t);
891
+ }
892
+ /**
893
+ * Set the maximum resolution at which the layer is visible.
894
+ * @param {number} maxResolution The maximum resolution of the layer.
895
+ * @observable
896
+ * @api
897
+ */
898
+ setMaxResolution(t) {
899
+ this.set(m.MAX_RESOLUTION, t);
900
+ }
901
+ /**
902
+ * Set the minimum resolution at which the layer is visible.
903
+ * @param {number} minResolution The minimum resolution of the layer.
904
+ * @observable
905
+ * @api
906
+ */
907
+ setMinResolution(t) {
908
+ this.set(m.MIN_RESOLUTION, t);
909
+ }
910
+ /**
911
+ * Set the maximum zoom (exclusive) at which the layer is visible.
912
+ * Note that the zoom levels for layer visibility are based on the
913
+ * view zoom level, which may be different from a tile source zoom level.
914
+ * @param {number} maxZoom The maximum zoom of the layer.
915
+ * @observable
916
+ * @api
917
+ */
918
+ setMaxZoom(t) {
919
+ this.set(m.MAX_ZOOM, t);
920
+ }
921
+ /**
922
+ * Set the minimum zoom (inclusive) at which the layer is visible.
923
+ * Note that the zoom levels for layer visibility are based on the
924
+ * view zoom level, which may be different from a tile source zoom level.
925
+ * @param {number} minZoom The minimum zoom of the layer.
926
+ * @observable
927
+ * @api
928
+ */
929
+ setMinZoom(t) {
930
+ this.set(m.MIN_ZOOM, t);
931
+ }
932
+ /**
933
+ * Set the opacity of the layer, allowed values range from 0 to 1.
934
+ * @param {number} opacity The opacity of the layer.
935
+ * @observable
936
+ * @api
937
+ */
938
+ setOpacity(t) {
939
+ p(typeof t == "number", 64), this.set(m.OPACITY, t);
940
+ }
941
+ /**
942
+ * Set the visibility of the layer (`true` or `false`).
943
+ * @param {boolean} visible The visibility of the layer.
944
+ * @observable
945
+ * @api
946
+ */
947
+ setVisible(t) {
948
+ this.set(m.VISIBLE, t);
949
+ }
950
+ /**
951
+ * Set Z-index of the layer, which is used to order layers before rendering.
952
+ * The default Z-index is 0.
953
+ * @param {number} zindex The z-index of the layer.
954
+ * @observable
955
+ * @api
956
+ */
957
+ setZIndex(t) {
958
+ this.set(m.Z_INDEX, t);
959
+ }
960
+ /**
961
+ * Clean up.
962
+ */
963
+ disposeInternal() {
964
+ this.state_ && (this.state_.layer = null, this.state_ = null), super.disposeInternal();
965
+ }
966
+ }
967
+ const an = {
968
+ /**
969
+ * Triggered before a layer is rendered.
970
+ * @event module:ol/render/Event~RenderEvent#prerender
971
+ * @api
972
+ */
973
+ PRERENDER: "prerender",
974
+ /**
975
+ * Triggered after a layer is rendered.
976
+ * @event module:ol/render/Event~RenderEvent#postrender
977
+ * @api
978
+ */
979
+ POSTRENDER: "postrender",
980
+ /**
981
+ * Triggered before layers are composed. When dispatched by the map, the event object will not have
982
+ * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only
983
+ * WebGL layers currently dispatch this event.
984
+ * @event module:ol/render/Event~RenderEvent#precompose
985
+ * @api
986
+ */
987
+ PRECOMPOSE: "precompose",
988
+ /**
989
+ * Triggered after layers are composed. When dispatched by the map, the event object will not have
990
+ * a `context` set. When dispatched by a layer, the event object will have a `context` set. Only
991
+ * WebGL layers currently dispatch this event.
992
+ * @event module:ol/render/Event~RenderEvent#postcompose
993
+ * @api
994
+ */
995
+ POSTCOMPOSE: "postcompose",
996
+ /**
997
+ * Triggered when rendering is complete, i.e. all sources and tiles have
998
+ * finished loading for the current viewport, and all tiles are faded in.
999
+ * The event object will not have a `context` set.
1000
+ * @event module:ol/render/Event~RenderEvent#rendercomplete
1001
+ * @api
1002
+ */
1003
+ RENDERCOMPLETE: "rendercomplete"
1004
+ }, P = {
1005
+ ANIMATING: 0,
1006
+ INTERACTING: 1
1007
+ }, I = {
1008
+ CENTER: "center",
1009
+ RESOLUTION: "resolution",
1010
+ ROTATION: "rotation"
1011
+ }, un = 256;
1012
+ function Nt(n, t, e) {
1013
+ return (
1014
+ /**
1015
+ * @param {import("./coordinate.js").Coordinate|undefined} center Center.
1016
+ * @param {number|undefined} resolution Resolution.
1017
+ * @param {import("./size.js").Size} size Viewport size; unused if `onlyCenter` was specified.
1018
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1019
+ * @param {Array<number>} [centerShift] Shift between map center and viewport center.
1020
+ * @return {import("./coordinate.js").Coordinate|undefined} Center.
1021
+ */
1022
+ function(i, r, s, o, u) {
1023
+ if (!i)
1024
+ return;
1025
+ if (!r && !t)
1026
+ return i;
1027
+ const a = t ? 0 : s[0] * r, h = t ? 0 : s[1] * r, l = u ? u[0] : 0, c = u ? u[1] : 0;
1028
+ let g = n[0] + a / 2 + l, f = n[2] - a / 2 + l, d = n[1] + h / 2 + c, R = n[3] - h / 2 + c;
1029
+ g > f && (g = (f + g) / 2, f = g), d > R && (d = (R + d) / 2, R = d);
1030
+ let _ = S(i[0], g, f), M = S(i[1], d, R);
1031
+ if (o && e && r) {
1032
+ const y = 30 * r;
1033
+ _ += -y * Math.log(1 + Math.max(0, g - i[0]) / y) + y * Math.log(1 + Math.max(0, i[0] - f) / y), M += -y * Math.log(1 + Math.max(0, d - i[1]) / y) + y * Math.log(1 + Math.max(0, i[1] - R) / y);
1034
+ }
1035
+ return [_, M];
1036
+ }
1037
+ );
1038
+ }
1039
+ function ln(n) {
1040
+ return n;
1041
+ }
1042
+ function ft(n, t, e, i) {
1043
+ const r = A(t) / e[0], s = X(t) / e[1];
1044
+ return i ? Math.min(n, Math.max(r, s)) : Math.min(n, Math.min(r, s));
1045
+ }
1046
+ function dt(n, t, e) {
1047
+ let i = Math.min(n, t);
1048
+ const r = 50;
1049
+ return i *= Math.log(1 + r * Math.max(0, n / t - 1)) / r + 1, e && (i = Math.max(i, e), i /= Math.log(1 + r * Math.max(0, e / n - 1)) / r + 1), S(i, e / 2, t * 2);
1050
+ }
1051
+ function hn(n, t, e, i) {
1052
+ return t = t !== void 0 ? t : !0, /**
1053
+ * @param {number|undefined} resolution Resolution.
1054
+ * @param {number} direction Direction.
1055
+ * @param {import("./size.js").Size} size Viewport size.
1056
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1057
+ * @return {number|undefined} Resolution.
1058
+ */
1059
+ function(r, s, o, u) {
1060
+ if (r !== void 0) {
1061
+ const a = n[0], h = n[n.length - 1], l = e ? ft(
1062
+ a,
1063
+ e,
1064
+ o,
1065
+ i
1066
+ ) : a;
1067
+ if (u)
1068
+ return t ? dt(
1069
+ r,
1070
+ l,
1071
+ h
1072
+ ) : S(r, h, l);
1073
+ const c = Math.min(l, r), g = Math.floor(Lt(n, c, s));
1074
+ return n[g] > l && g < n.length - 1 ? n[g + 1] : n[g];
1075
+ }
1076
+ };
1077
+ }
1078
+ function cn(n, t, e, i, r, s) {
1079
+ return i = i !== void 0 ? i : !0, e = e !== void 0 ? e : 0, /**
1080
+ * @param {number|undefined} resolution Resolution.
1081
+ * @param {number} direction Direction.
1082
+ * @param {import("./size.js").Size} size Viewport size.
1083
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1084
+ * @return {number|undefined} Resolution.
1085
+ */
1086
+ function(o, u, a, h) {
1087
+ if (o !== void 0) {
1088
+ const l = r ? ft(
1089
+ t,
1090
+ r,
1091
+ a,
1092
+ s
1093
+ ) : t;
1094
+ if (h)
1095
+ return i ? dt(
1096
+ o,
1097
+ l,
1098
+ e
1099
+ ) : S(o, e, l);
1100
+ const c = 1e-9, g = Math.ceil(
1101
+ Math.log(t / l) / Math.log(n) - c
1102
+ ), f = -u * (0.5 - c) + 0.5, d = Math.min(l, o), R = Math.floor(
1103
+ Math.log(t / d) / Math.log(n) + f
1104
+ ), _ = Math.max(g, R), M = t / Math.pow(n, _);
1105
+ return S(M, e, l);
1106
+ }
1107
+ };
1108
+ }
1109
+ function Ot(n, t, e, i, r) {
1110
+ return e = e !== void 0 ? e : !0, /**
1111
+ * @param {number|undefined} resolution Resolution.
1112
+ * @param {number} direction Direction.
1113
+ * @param {import("./size.js").Size} size Viewport size.
1114
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1115
+ * @return {number|undefined} Resolution.
1116
+ */
1117
+ function(s, o, u, a) {
1118
+ if (s !== void 0) {
1119
+ const h = i ? ft(
1120
+ n,
1121
+ i,
1122
+ u,
1123
+ r
1124
+ ) : n;
1125
+ return !e || !a ? S(s, t, h) : dt(
1126
+ s,
1127
+ h,
1128
+ t
1129
+ );
1130
+ }
1131
+ };
1132
+ }
1133
+ function gn(n) {
1134
+ if (n !== void 0)
1135
+ return 0;
1136
+ }
1137
+ function xt(n) {
1138
+ if (n !== void 0)
1139
+ return n;
1140
+ }
1141
+ function fn(n) {
1142
+ const t = 2 * Math.PI / n;
1143
+ return (
1144
+ /**
1145
+ * @param {number|undefined} rotation Rotation.
1146
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1147
+ * @return {number|undefined} Rotation.
1148
+ */
1149
+ function(e, i) {
1150
+ if (i)
1151
+ return e;
1152
+ if (e !== void 0)
1153
+ return e = Math.floor(e / t + 0.5) * t, e;
1154
+ }
1155
+ );
1156
+ }
1157
+ function dn(n) {
1158
+ return n = n || W(5), /**
1159
+ * @param {number|undefined} rotation Rotation.
1160
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1161
+ * @return {number|undefined} Rotation.
1162
+ */
1163
+ function(t, e) {
1164
+ if (e)
1165
+ return t;
1166
+ if (t !== void 0)
1167
+ return Math.abs(t) <= n ? 0 : t;
1168
+ };
1169
+ }
1170
+ function Rn(n) {
1171
+ return Math.pow(n, 3);
1172
+ }
1173
+ function _n(n) {
1174
+ return 1 - Rn(1 - n);
1175
+ }
1176
+ function mn(n) {
1177
+ return 3 * n * n - 2 * n * n * n;
1178
+ }
1179
+ function oi(n) {
1180
+ return n;
1181
+ }
1182
+ function Bt(n, t, e, i, r, s) {
1183
+ s = s || [];
1184
+ let o = 0;
1185
+ for (let u = t; u < e; u += i) {
1186
+ const a = n[u], h = n[u + 1];
1187
+ s[o++] = r[0] * a + r[2] * h + r[4], s[o++] = r[1] * a + r[3] * h + r[5];
1188
+ }
1189
+ return s && s.length != o && (s.length = o), s;
1190
+ }
1191
+ function yn(n, t, e, i, r, s, o) {
1192
+ o = o || [];
1193
+ const u = Math.cos(r), a = Math.sin(r), h = s[0], l = s[1];
1194
+ let c = 0;
1195
+ for (let g = t; g < e; g += i) {
1196
+ const f = n[g] - h, d = n[g + 1] - l;
1197
+ o[c++] = h + f * u - d * a, o[c++] = l + f * a + d * u;
1198
+ for (let R = g + 2; R < g + i; ++R)
1199
+ o[c++] = n[R];
1200
+ }
1201
+ return o && o.length != c && (o.length = c), o;
1202
+ }
1203
+ function Mn(n, t, e, i, r, s, o, u) {
1204
+ u = u || [];
1205
+ const a = o[0], h = o[1];
1206
+ let l = 0;
1207
+ for (let c = t; c < e; c += i) {
1208
+ const g = n[c] - a, f = n[c + 1] - h;
1209
+ u[l++] = a + r * g, u[l++] = h + s * f;
1210
+ for (let d = c + 2; d < c + i; ++d)
1211
+ u[l++] = n[d];
1212
+ }
1213
+ return u && u.length != l && (u.length = l), u;
1214
+ }
1215
+ function Cn(n, t, e, i, r, s, o) {
1216
+ o = o || [];
1217
+ let u = 0;
1218
+ for (let a = t; a < e; a += i) {
1219
+ o[u++] = n[a] + r, o[u++] = n[a + 1] + s;
1220
+ for (let h = a + 2; h < a + i; ++h)
1221
+ o[u++] = n[h];
1222
+ }
1223
+ return o && o.length != u && (o.length = u), o;
1224
+ }
1225
+ const Ft = en();
1226
+ class En extends H {
1227
+ constructor() {
1228
+ super(), this.extent_ = $(), this.extentRevision_ = -1, this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = 0, this.simplifyTransformedInternal = ge(function(t, e, i) {
1229
+ if (!i)
1230
+ return this.getSimplifiedGeometry(e);
1231
+ const r = this.clone();
1232
+ return r.applyTransform(i), r.getSimplifiedGeometry(e);
1233
+ });
1234
+ }
1235
+ /**
1236
+ * Get a transformed and simplified version of the geometry.
1237
+ * @abstract
1238
+ * @param {number} squaredTolerance Squared tolerance.
1239
+ * @param {import("../proj.js").TransformFunction} [transform] Optional transform function.
1240
+ * @return {Geometry} Simplified geometry.
1241
+ */
1242
+ simplifyTransformed(t, e) {
1243
+ return this.simplifyTransformedInternal(
1244
+ this.getRevision(),
1245
+ t,
1246
+ e
1247
+ );
1248
+ }
1249
+ /**
1250
+ * Make a complete copy of the geometry.
1251
+ * @abstract
1252
+ * @return {!Geometry} Clone.
1253
+ */
1254
+ clone() {
1255
+ return E();
1256
+ }
1257
+ /**
1258
+ * @abstract
1259
+ * @param {number} x X.
1260
+ * @param {number} y Y.
1261
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
1262
+ * @param {number} minSquaredDistance Minimum squared distance.
1263
+ * @return {number} Minimum squared distance.
1264
+ */
1265
+ closestPointXY(t, e, i, r) {
1266
+ return E();
1267
+ }
1268
+ /**
1269
+ * @param {number} x X.
1270
+ * @param {number} y Y.
1271
+ * @return {boolean} Contains (x, y).
1272
+ */
1273
+ containsXY(t, e) {
1274
+ const i = this.getClosestPoint([t, e]);
1275
+ return i[0] === t && i[1] === e;
1276
+ }
1277
+ /**
1278
+ * Return the closest point of the geometry to the passed point as
1279
+ * {@link module:ol/coordinate~Coordinate coordinate}.
1280
+ * @param {import("../coordinate.js").Coordinate} point Point.
1281
+ * @param {import("../coordinate.js").Coordinate} [closestPoint] Closest point.
1282
+ * @return {import("../coordinate.js").Coordinate} Closest point.
1283
+ * @api
1284
+ */
1285
+ getClosestPoint(t, e) {
1286
+ return e = e || [NaN, NaN], this.closestPointXY(t[0], t[1], e, 1 / 0), e;
1287
+ }
1288
+ /**
1289
+ * Returns true if this geometry includes the specified coordinate. If the
1290
+ * coordinate is on the boundary of the geometry, returns false.
1291
+ * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
1292
+ * @return {boolean} Contains coordinate.
1293
+ * @api
1294
+ */
1295
+ intersectsCoordinate(t) {
1296
+ return this.containsXY(t[0], t[1]);
1297
+ }
1298
+ /**
1299
+ * @abstract
1300
+ * @param {import("../extent.js").Extent} extent Extent.
1301
+ * @protected
1302
+ * @return {import("../extent.js").Extent} extent Extent.
1303
+ */
1304
+ computeExtent(t) {
1305
+ return E();
1306
+ }
1307
+ /**
1308
+ * Get the extent of the geometry.
1309
+ * @param {import("../extent.js").Extent} [extent] Extent.
1310
+ * @return {import("../extent.js").Extent} extent Extent.
1311
+ * @api
1312
+ */
1313
+ getExtent(t) {
1314
+ if (this.extentRevision_ != this.getRevision()) {
1315
+ const e = this.computeExtent(this.extent_);
1316
+ (isNaN(e[0]) || isNaN(e[1])) && Q(e), this.extentRevision_ = this.getRevision();
1317
+ }
1318
+ return Ye(this.extent_, t);
1319
+ }
1320
+ /**
1321
+ * Rotate the geometry around a given coordinate. This modifies the geometry
1322
+ * coordinates in place.
1323
+ * @abstract
1324
+ * @param {number} angle Rotation angle in radians.
1325
+ * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
1326
+ * @api
1327
+ */
1328
+ rotate(t, e) {
1329
+ E();
1330
+ }
1331
+ /**
1332
+ * Scale the geometry (with an optional origin). This modifies the geometry
1333
+ * coordinates in place.
1334
+ * @abstract
1335
+ * @param {number} sx The scaling factor in the x-direction.
1336
+ * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
1337
+ * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
1338
+ * of the geometry extent).
1339
+ * @api
1340
+ */
1341
+ scale(t, e, i) {
1342
+ E();
1343
+ }
1344
+ /**
1345
+ * Create a simplified version of this geometry. For linestrings, this uses
1346
+ * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)
1347
+ * algorithm. For polygons, a quantization-based
1348
+ * simplification is used to preserve topology.
1349
+ * @param {number} tolerance The tolerance distance for simplification.
1350
+ * @return {Geometry} A new, simplified version of the original geometry.
1351
+ * @api
1352
+ */
1353
+ simplify(t) {
1354
+ return this.getSimplifiedGeometry(t * t);
1355
+ }
1356
+ /**
1357
+ * Create a simplified version of this geometry using the Douglas Peucker
1358
+ * algorithm.
1359
+ * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.
1360
+ * @abstract
1361
+ * @param {number} squaredTolerance Squared tolerance.
1362
+ * @return {Geometry} Simplified geometry.
1363
+ */
1364
+ getSimplifiedGeometry(t) {
1365
+ return E();
1366
+ }
1367
+ /**
1368
+ * Get the type of this geometry.
1369
+ * @abstract
1370
+ * @return {Type} Geometry type.
1371
+ */
1372
+ getType() {
1373
+ return E();
1374
+ }
1375
+ /**
1376
+ * Apply a transform function to the coordinates of the geometry.
1377
+ * The geometry is modified in place.
1378
+ * If you do not want the geometry modified in place, first `clone()` it and
1379
+ * then use this function on the clone.
1380
+ * @abstract
1381
+ * @param {import("../proj.js").TransformFunction} transformFn Transform function.
1382
+ * Called with a flat array of geometry coordinates.
1383
+ */
1384
+ applyTransform(t) {
1385
+ E();
1386
+ }
1387
+ /**
1388
+ * Test if the geometry and the passed extent intersect.
1389
+ * @abstract
1390
+ * @param {import("../extent.js").Extent} extent Extent.
1391
+ * @return {boolean} `true` if the geometry and the extent intersect.
1392
+ */
1393
+ intersectsExtent(t) {
1394
+ return E();
1395
+ }
1396
+ /**
1397
+ * Translate the geometry. This modifies the geometry coordinates in place. If
1398
+ * instead you want a new geometry, first `clone()` this geometry.
1399
+ * @abstract
1400
+ * @param {number} deltaX Delta X.
1401
+ * @param {number} deltaY Delta Y.
1402
+ * @api
1403
+ */
1404
+ translate(t, e) {
1405
+ E();
1406
+ }
1407
+ /**
1408
+ * Transform each coordinate of the geometry from one coordinate reference
1409
+ * system to another. The geometry is modified in place.
1410
+ * For example, a line will be transformed to a line and a circle to a circle.
1411
+ * If you do not want the geometry modified in place, first `clone()` it and
1412
+ * then use this function on the clone.
1413
+ *
1414
+ * @param {import("../proj.js").ProjectionLike} source The current projection. Can be a
1415
+ * string identifier or a {@link module:ol/proj/Projection~Projection} object.
1416
+ * @param {import("../proj.js").ProjectionLike} destination The desired projection. Can be a
1417
+ * string identifier or a {@link module:ol/proj/Projection~Projection} object.
1418
+ * @return {Geometry} This geometry. Note that original geometry is
1419
+ * modified in place.
1420
+ * @api
1421
+ */
1422
+ transform(t, e) {
1423
+ const i = T(t), r = i.getUnits() == "tile-pixels" ? function(s, o, u) {
1424
+ const a = i.getExtent(), h = i.getWorldExtent(), l = X(h) / X(a);
1425
+ return rn(
1426
+ Ft,
1427
+ h[0],
1428
+ h[3],
1429
+ l,
1430
+ -l,
1431
+ 0,
1432
+ 0,
1433
+ 0
1434
+ ), Bt(
1435
+ s,
1436
+ 0,
1437
+ s.length,
1438
+ u,
1439
+ Ft,
1440
+ o
1441
+ ), q(i, e)(
1442
+ s,
1443
+ o,
1444
+ u
1445
+ );
1446
+ } : q(i, e);
1447
+ return this.applyTransform(r), this;
1448
+ }
1449
+ }
1450
+ class Rt extends En {
1451
+ constructor() {
1452
+ super(), this.layout = "XY", this.stride = 2, this.flatCoordinates = null;
1453
+ }
1454
+ /**
1455
+ * @param {import("../extent.js").Extent} extent Extent.
1456
+ * @protected
1457
+ * @return {import("../extent.js").Extent} extent Extent.
1458
+ */
1459
+ computeExtent(t) {
1460
+ return Oe(
1461
+ this.flatCoordinates,
1462
+ 0,
1463
+ this.flatCoordinates.length,
1464
+ this.stride,
1465
+ t
1466
+ );
1467
+ }
1468
+ /**
1469
+ * @abstract
1470
+ * @return {Array<*> | null} Coordinates.
1471
+ */
1472
+ getCoordinates() {
1473
+ return E();
1474
+ }
1475
+ /**
1476
+ * Return the first coordinate of the geometry.
1477
+ * @return {import("../coordinate.js").Coordinate} First coordinate.
1478
+ * @api
1479
+ */
1480
+ getFirstCoordinate() {
1481
+ return this.flatCoordinates.slice(0, this.stride);
1482
+ }
1483
+ /**
1484
+ * @return {Array<number>} Flat coordinates.
1485
+ */
1486
+ getFlatCoordinates() {
1487
+ return this.flatCoordinates;
1488
+ }
1489
+ /**
1490
+ * Return the last coordinate of the geometry.
1491
+ * @return {import("../coordinate.js").Coordinate} Last point.
1492
+ * @api
1493
+ */
1494
+ getLastCoordinate() {
1495
+ return this.flatCoordinates.slice(
1496
+ this.flatCoordinates.length - this.stride
1497
+ );
1498
+ }
1499
+ /**
1500
+ * Return the {@link import("./Geometry.js").GeometryLayout layout} of the geometry.
1501
+ * @return {import("./Geometry.js").GeometryLayout} Layout.
1502
+ * @api
1503
+ */
1504
+ getLayout() {
1505
+ return this.layout;
1506
+ }
1507
+ /**
1508
+ * Create a simplified version of this geometry using the Douglas Peucker algorithm.
1509
+ * @param {number} squaredTolerance Squared tolerance.
1510
+ * @return {SimpleGeometry} Simplified geometry.
1511
+ */
1512
+ getSimplifiedGeometry(t) {
1513
+ if (this.simplifiedGeometryRevision !== this.getRevision() && (this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = this.getRevision()), t < 0 || this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && t <= this.simplifiedGeometryMaxMinSquaredTolerance)
1514
+ return this;
1515
+ const e = this.getSimplifiedGeometryInternal(t);
1516
+ return e.getFlatCoordinates().length < this.flatCoordinates.length ? e : (this.simplifiedGeometryMaxMinSquaredTolerance = t, this);
1517
+ }
1518
+ /**
1519
+ * @param {number} squaredTolerance Squared tolerance.
1520
+ * @return {SimpleGeometry} Simplified geometry.
1521
+ * @protected
1522
+ */
1523
+ getSimplifiedGeometryInternal(t) {
1524
+ return this;
1525
+ }
1526
+ /**
1527
+ * @return {number} Stride.
1528
+ */
1529
+ getStride() {
1530
+ return this.stride;
1531
+ }
1532
+ /**
1533
+ * @param {import("./Geometry.js").GeometryLayout} layout Layout.
1534
+ * @param {Array<number>} flatCoordinates Flat coordinates.
1535
+ */
1536
+ setFlatCoordinates(t, e) {
1537
+ this.stride = Zt(t), this.layout = t, this.flatCoordinates = e;
1538
+ }
1539
+ /**
1540
+ * @abstract
1541
+ * @param {!Array<*>} coordinates Coordinates.
1542
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
1543
+ */
1544
+ setCoordinates(t, e) {
1545
+ E();
1546
+ }
1547
+ /**
1548
+ * @param {import("./Geometry.js").GeometryLayout|undefined} layout Layout.
1549
+ * @param {Array<*>} coordinates Coordinates.
1550
+ * @param {number} nesting Nesting.
1551
+ * @protected
1552
+ */
1553
+ setLayout(t, e, i) {
1554
+ let r;
1555
+ if (t)
1556
+ r = Zt(t);
1557
+ else {
1558
+ for (let s = 0; s < i; ++s) {
1559
+ if (e.length === 0) {
1560
+ this.layout = "XY", this.stride = 2;
1561
+ return;
1562
+ }
1563
+ e = /** @type {Array} */
1564
+ e[0];
1565
+ }
1566
+ r = e.length, t = In(r);
1567
+ }
1568
+ this.layout = t, this.stride = r;
1569
+ }
1570
+ /**
1571
+ * Apply a transform function to the coordinates of the geometry.
1572
+ * The geometry is modified in place.
1573
+ * If you do not want the geometry modified in place, first `clone()` it and
1574
+ * then use this function on the clone.
1575
+ * @param {import("../proj.js").TransformFunction} transformFn Transform function.
1576
+ * Called with a flat array of geometry coordinates.
1577
+ * @api
1578
+ */
1579
+ applyTransform(t) {
1580
+ this.flatCoordinates && (t(this.flatCoordinates, this.flatCoordinates, this.stride), this.changed());
1581
+ }
1582
+ /**
1583
+ * Rotate the geometry around a given coordinate. This modifies the geometry
1584
+ * coordinates in place.
1585
+ * @param {number} angle Rotation angle in counter-clockwise radians.
1586
+ * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
1587
+ * @api
1588
+ */
1589
+ rotate(t, e) {
1590
+ const i = this.getFlatCoordinates();
1591
+ if (i) {
1592
+ const r = this.getStride();
1593
+ yn(
1594
+ i,
1595
+ 0,
1596
+ i.length,
1597
+ r,
1598
+ t,
1599
+ e,
1600
+ i
1601
+ ), this.changed();
1602
+ }
1603
+ }
1604
+ /**
1605
+ * Scale the geometry (with an optional origin). This modifies the geometry
1606
+ * coordinates in place.
1607
+ * @param {number} sx The scaling factor in the x-direction.
1608
+ * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
1609
+ * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
1610
+ * of the geometry extent).
1611
+ * @api
1612
+ */
1613
+ scale(t, e, i) {
1614
+ e === void 0 && (e = t), i || (i = L(this.getExtent()));
1615
+ const r = this.getFlatCoordinates();
1616
+ if (r) {
1617
+ const s = this.getStride();
1618
+ Mn(
1619
+ r,
1620
+ 0,
1621
+ r.length,
1622
+ s,
1623
+ t,
1624
+ e,
1625
+ i,
1626
+ r
1627
+ ), this.changed();
1628
+ }
1629
+ }
1630
+ /**
1631
+ * Translate the geometry. This modifies the geometry coordinates in place. If
1632
+ * instead you want a new geometry, first `clone()` this geometry.
1633
+ * @param {number} deltaX Delta X.
1634
+ * @param {number} deltaY Delta Y.
1635
+ * @api
1636
+ */
1637
+ translate(t, e) {
1638
+ const i = this.getFlatCoordinates();
1639
+ if (i) {
1640
+ const r = this.getStride();
1641
+ Cn(
1642
+ i,
1643
+ 0,
1644
+ i.length,
1645
+ r,
1646
+ t,
1647
+ e,
1648
+ i
1649
+ ), this.changed();
1650
+ }
1651
+ }
1652
+ }
1653
+ function In(n) {
1654
+ let t;
1655
+ return n == 2 ? t = "XY" : n == 3 ? t = "XYZ" : n == 4 && (t = "XYZM"), /** @type {import("./Geometry.js").GeometryLayout} */
1656
+ t;
1657
+ }
1658
+ function Zt(n) {
1659
+ let t;
1660
+ return n == "XY" ? t = 2 : n == "XYZ" || n == "XYM" ? t = 3 : n == "XYZM" && (t = 4), /** @type {number} */
1661
+ t;
1662
+ }
1663
+ function ai(n, t, e) {
1664
+ const i = n.getFlatCoordinates();
1665
+ if (!i)
1666
+ return null;
1667
+ const r = n.getStride();
1668
+ return Bt(
1669
+ i,
1670
+ 0,
1671
+ i.length,
1672
+ r,
1673
+ t,
1674
+ e
1675
+ );
1676
+ }
1677
+ function bt(n, t, e, i, r, s, o) {
1678
+ const u = n[t], a = n[t + 1], h = n[e] - u, l = n[e + 1] - a;
1679
+ let c;
1680
+ if (h === 0 && l === 0)
1681
+ c = t;
1682
+ else {
1683
+ const g = ((r - u) * h + (s - a) * l) / (h * h + l * l);
1684
+ if (g > 1)
1685
+ c = e;
1686
+ else if (g > 0) {
1687
+ for (let f = 0; f < i; ++f)
1688
+ o[f] = fe(
1689
+ n[t + f],
1690
+ n[e + f],
1691
+ g
1692
+ );
1693
+ o.length = i;
1694
+ return;
1695
+ } else
1696
+ c = t;
1697
+ }
1698
+ for (let g = 0; g < i; ++g)
1699
+ o[g] = n[c + g];
1700
+ o.length = i;
1701
+ }
1702
+ function qt(n, t, e, i, r) {
1703
+ let s = n[t], o = n[t + 1];
1704
+ for (t += i; t < e; t += i) {
1705
+ const u = n[t], a = n[t + 1], h = j(s, o, u, a);
1706
+ h > r && (r = h), s = u, o = a;
1707
+ }
1708
+ return r;
1709
+ }
1710
+ function Ht(n, t, e, i, r) {
1711
+ for (let s = 0, o = e.length; s < o; ++s) {
1712
+ const u = e[s];
1713
+ r = qt(n, t, u, i, r), t = u;
1714
+ }
1715
+ return r;
1716
+ }
1717
+ function ui(n, t, e, i, r) {
1718
+ for (let s = 0, o = e.length; s < o; ++s) {
1719
+ const u = e[s];
1720
+ r = Ht(n, t, u, i, r), t = u[u.length - 1];
1721
+ }
1722
+ return r;
1723
+ }
1724
+ function $t(n, t, e, i, r, s, o, u, a, h, l) {
1725
+ if (t == e)
1726
+ return h;
1727
+ let c, g;
1728
+ if (r === 0) {
1729
+ if (g = j(
1730
+ o,
1731
+ u,
1732
+ n[t],
1733
+ n[t + 1]
1734
+ ), g < h) {
1735
+ for (c = 0; c < i; ++c)
1736
+ a[c] = n[t + c];
1737
+ return a.length = i, g;
1738
+ }
1739
+ return h;
1740
+ }
1741
+ l = l || [NaN, NaN];
1742
+ let f = t + i;
1743
+ for (; f < e; )
1744
+ if (bt(
1745
+ n,
1746
+ f - i,
1747
+ f,
1748
+ i,
1749
+ o,
1750
+ u,
1751
+ l
1752
+ ), g = j(o, u, l[0], l[1]), g < h) {
1753
+ for (h = g, c = 0; c < i; ++c)
1754
+ a[c] = l[c];
1755
+ a.length = i, f += i;
1756
+ } else
1757
+ f += i * Math.max(
1758
+ (Math.sqrt(g) - Math.sqrt(h)) / r | 0,
1759
+ 1
1760
+ );
1761
+ if (s && (bt(
1762
+ n,
1763
+ e - i,
1764
+ t,
1765
+ i,
1766
+ o,
1767
+ u,
1768
+ l
1769
+ ), g = j(o, u, l[0], l[1]), g < h)) {
1770
+ for (h = g, c = 0; c < i; ++c)
1771
+ a[c] = l[c];
1772
+ a.length = i;
1773
+ }
1774
+ return h;
1775
+ }
1776
+ function Jt(n, t, e, i, r, s, o, u, a, h, l) {
1777
+ l = l || [NaN, NaN];
1778
+ for (let c = 0, g = e.length; c < g; ++c) {
1779
+ const f = e[c];
1780
+ h = $t(
1781
+ n,
1782
+ t,
1783
+ f,
1784
+ i,
1785
+ r,
1786
+ s,
1787
+ o,
1788
+ u,
1789
+ a,
1790
+ h,
1791
+ l
1792
+ ), t = f;
1793
+ }
1794
+ return h;
1795
+ }
1796
+ function li(n, t, e, i, r, s, o, u, a, h, l) {
1797
+ l = l || [NaN, NaN];
1798
+ for (let c = 0, g = e.length; c < g; ++c) {
1799
+ const f = e[c];
1800
+ h = Jt(
1801
+ n,
1802
+ t,
1803
+ f,
1804
+ i,
1805
+ r,
1806
+ s,
1807
+ o,
1808
+ u,
1809
+ a,
1810
+ h,
1811
+ l
1812
+ ), t = f[f.length - 1];
1813
+ }
1814
+ return h;
1815
+ }
1816
+ function Sn(n, t, e, i) {
1817
+ for (let r = 0, s = e.length; r < s; ++r)
1818
+ n[t++] = e[r];
1819
+ return t;
1820
+ }
1821
+ function Qt(n, t, e, i) {
1822
+ for (let r = 0, s = e.length; r < s; ++r) {
1823
+ const o = e[r];
1824
+ for (let u = 0; u < i; ++u)
1825
+ n[t++] = o[u];
1826
+ }
1827
+ return t;
1828
+ }
1829
+ function te(n, t, e, i, r) {
1830
+ r = r || [];
1831
+ let s = 0;
1832
+ for (let o = 0, u = e.length; o < u; ++o) {
1833
+ const a = Qt(
1834
+ n,
1835
+ t,
1836
+ e[o],
1837
+ i
1838
+ );
1839
+ r[s++] = a, t = a;
1840
+ }
1841
+ return r.length = s, r;
1842
+ }
1843
+ function hi(n, t, e, i, r) {
1844
+ r = r || [];
1845
+ let s = 0;
1846
+ for (let o = 0, u = e.length; o < u; ++o) {
1847
+ const a = te(
1848
+ n,
1849
+ t,
1850
+ e[o],
1851
+ i,
1852
+ r[s]
1853
+ );
1854
+ a.length === 0 && (a[0] = t), r[s++] = a, t = a[a.length - 1];
1855
+ }
1856
+ return r.length = s, r;
1857
+ }
1858
+ function ee(n, t, e, i, r, s, o) {
1859
+ const u = (e - t) / i;
1860
+ if (u < 3) {
1861
+ for (; t < e; t += i)
1862
+ s[o++] = n[t], s[o++] = n[t + 1];
1863
+ return o;
1864
+ }
1865
+ const a = new Array(u);
1866
+ a[0] = 1, a[u - 1] = 1;
1867
+ const h = [t, e - i];
1868
+ let l = 0;
1869
+ for (; h.length > 0; ) {
1870
+ const c = h.pop(), g = h.pop();
1871
+ let f = 0;
1872
+ const d = n[g], R = n[g + 1], _ = n[c], M = n[c + 1];
1873
+ for (let y = g + i; y < c; y += i) {
1874
+ const et = n[y], G = n[y + 1], Mt = de(et, G, d, R, _, M);
1875
+ Mt > f && (l = y, f = Mt);
1876
+ }
1877
+ f > r && (a[(l - t) / i] = 1, g + i < l && h.push(g, l), l + i < c && h.push(l, c));
1878
+ }
1879
+ for (let c = 0; c < u; ++c)
1880
+ a[c] && (s[o++] = n[t + c * i], s[o++] = n[t + c * i + 1]);
1881
+ return o;
1882
+ }
1883
+ function ci(n, t, e, i, r, s, o, u) {
1884
+ for (let a = 0, h = e.length; a < h; ++a) {
1885
+ const l = e[a];
1886
+ o = ee(
1887
+ n,
1888
+ t,
1889
+ l,
1890
+ i,
1891
+ r,
1892
+ s,
1893
+ o
1894
+ ), u.push(o), t = l;
1895
+ }
1896
+ return o;
1897
+ }
1898
+ function F(n, t) {
1899
+ return t * Math.round(n / t);
1900
+ }
1901
+ function pn(n, t, e, i, r, s, o) {
1902
+ if (t == e)
1903
+ return o;
1904
+ let u = F(n[t], r), a = F(n[t + 1], r);
1905
+ t += i, s[o++] = u, s[o++] = a;
1906
+ let h, l;
1907
+ do
1908
+ if (h = F(n[t], r), l = F(n[t + 1], r), t += i, t == e)
1909
+ return s[o++] = h, s[o++] = l, o;
1910
+ while (h == u && l == a);
1911
+ for (; t < e; ) {
1912
+ const c = F(n[t], r), g = F(n[t + 1], r);
1913
+ if (t += i, c == h && g == l)
1914
+ continue;
1915
+ const f = h - u, d = l - a, R = c - u, _ = g - a;
1916
+ if (f * _ == d * R && (f < 0 && R < f || f == R || f > 0 && R > f) && (d < 0 && _ < d || d == _ || d > 0 && _ > d)) {
1917
+ h = c, l = g;
1918
+ continue;
1919
+ }
1920
+ s[o++] = h, s[o++] = l, u = h, a = l, h = c, l = g;
1921
+ }
1922
+ return s[o++] = h, s[o++] = l, o;
1923
+ }
1924
+ function ne(n, t, e, i, r, s, o, u) {
1925
+ for (let a = 0, h = e.length; a < h; ++a) {
1926
+ const l = e[a];
1927
+ o = pn(
1928
+ n,
1929
+ t,
1930
+ l,
1931
+ i,
1932
+ r,
1933
+ s,
1934
+ o
1935
+ ), u.push(o), t = l;
1936
+ }
1937
+ return o;
1938
+ }
1939
+ function gi(n, t, e, i, r, s, o, u) {
1940
+ for (let a = 0, h = e.length; a < h; ++a) {
1941
+ const l = e[a], c = [];
1942
+ o = ne(
1943
+ n,
1944
+ t,
1945
+ l,
1946
+ i,
1947
+ r,
1948
+ s,
1949
+ o,
1950
+ c
1951
+ ), u.push(c), t = l[l.length - 1];
1952
+ }
1953
+ return o;
1954
+ }
1955
+ function ie(n, t, e, i, r) {
1956
+ r = r !== void 0 ? r : [];
1957
+ let s = 0;
1958
+ for (let o = t; o < e; o += i)
1959
+ r[s++] = n.slice(o, o + i);
1960
+ return r.length = s, r;
1961
+ }
1962
+ function re(n, t, e, i, r) {
1963
+ r = r !== void 0 ? r : [];
1964
+ let s = 0;
1965
+ for (let o = 0, u = e.length; o < u; ++o) {
1966
+ const a = e[o];
1967
+ r[s++] = ie(
1968
+ n,
1969
+ t,
1970
+ a,
1971
+ i,
1972
+ r[s]
1973
+ ), t = a;
1974
+ }
1975
+ return r.length = s, r;
1976
+ }
1977
+ function fi(n, t, e, i, r) {
1978
+ r = r !== void 0 ? r : [];
1979
+ let s = 0;
1980
+ for (let o = 0, u = e.length; o < u; ++o) {
1981
+ const a = e[o];
1982
+ r[s++] = a.length === 1 && a[0] === t ? [] : re(
1983
+ n,
1984
+ t,
1985
+ a,
1986
+ i,
1987
+ r[s]
1988
+ ), t = a[a.length - 1];
1989
+ }
1990
+ return r.length = s, r;
1991
+ }
1992
+ function se(n, t, e, i) {
1993
+ let r = 0, s = n[e - i], o = n[e - i + 1];
1994
+ for (; t < e; t += i) {
1995
+ const u = n[t], a = n[t + 1];
1996
+ r += o * u - s * a, s = u, o = a;
1997
+ }
1998
+ return r / 2;
1999
+ }
2000
+ function oe(n, t, e, i) {
2001
+ let r = 0;
2002
+ for (let s = 0, o = e.length; s < o; ++s) {
2003
+ const u = e[s];
2004
+ r += se(n, t, u, i), t = u;
2005
+ }
2006
+ return r;
2007
+ }
2008
+ function di(n, t, e, i) {
2009
+ let r = 0;
2010
+ for (let s = 0, o = e.length; s < o; ++s) {
2011
+ const u = e[s];
2012
+ r += oe(n, t, u, i), t = u[u.length - 1];
2013
+ }
2014
+ return r;
2015
+ }
2016
+ class v extends Rt {
2017
+ /**
2018
+ * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
2019
+ * For internal use, flat coordinates in combination with `layout` are also accepted.
2020
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
2021
+ */
2022
+ constructor(t, e) {
2023
+ super(), this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, e !== void 0 && !Array.isArray(t[0]) ? this.setFlatCoordinates(
2024
+ e,
2025
+ /** @type {Array<number>} */
2026
+ t
2027
+ ) : this.setCoordinates(
2028
+ /** @type {Array<import("../coordinate.js").Coordinate>} */
2029
+ t,
2030
+ e
2031
+ );
2032
+ }
2033
+ /**
2034
+ * Make a complete copy of the geometry.
2035
+ * @return {!LinearRing} Clone.
2036
+ * @api
2037
+ */
2038
+ clone() {
2039
+ return new v(this.flatCoordinates.slice(), this.layout);
2040
+ }
2041
+ /**
2042
+ * @param {number} x X.
2043
+ * @param {number} y Y.
2044
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
2045
+ * @param {number} minSquaredDistance Minimum squared distance.
2046
+ * @return {number} Minimum squared distance.
2047
+ */
2048
+ closestPointXY(t, e, i, r) {
2049
+ return r < zt(this.getExtent(), t, e) ? r : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
2050
+ qt(
2051
+ this.flatCoordinates,
2052
+ 0,
2053
+ this.flatCoordinates.length,
2054
+ this.stride,
2055
+ 0
2056
+ )
2057
+ ), this.maxDeltaRevision_ = this.getRevision()), $t(
2058
+ this.flatCoordinates,
2059
+ 0,
2060
+ this.flatCoordinates.length,
2061
+ this.stride,
2062
+ this.maxDelta_,
2063
+ !0,
2064
+ t,
2065
+ e,
2066
+ i,
2067
+ r
2068
+ ));
2069
+ }
2070
+ /**
2071
+ * Return the area of the linear ring on projected plane.
2072
+ * @return {number} Area (on projected plane).
2073
+ * @api
2074
+ */
2075
+ getArea() {
2076
+ return se(
2077
+ this.flatCoordinates,
2078
+ 0,
2079
+ this.flatCoordinates.length,
2080
+ this.stride
2081
+ );
2082
+ }
2083
+ /**
2084
+ * Return the coordinates of the linear ring.
2085
+ * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
2086
+ * @api
2087
+ */
2088
+ getCoordinates() {
2089
+ return ie(
2090
+ this.flatCoordinates,
2091
+ 0,
2092
+ this.flatCoordinates.length,
2093
+ this.stride
2094
+ );
2095
+ }
2096
+ /**
2097
+ * @param {number} squaredTolerance Squared tolerance.
2098
+ * @return {LinearRing} Simplified LinearRing.
2099
+ * @protected
2100
+ */
2101
+ getSimplifiedGeometryInternal(t) {
2102
+ const e = [];
2103
+ return e.length = ee(
2104
+ this.flatCoordinates,
2105
+ 0,
2106
+ this.flatCoordinates.length,
2107
+ this.stride,
2108
+ t,
2109
+ e,
2110
+ 0
2111
+ ), new v(e, "XY");
2112
+ }
2113
+ /**
2114
+ * Get the type of this geometry.
2115
+ * @return {import("./Geometry.js").Type} Geometry type.
2116
+ * @api
2117
+ */
2118
+ getType() {
2119
+ return "LinearRing";
2120
+ }
2121
+ /**
2122
+ * Test if the geometry and the passed extent intersect.
2123
+ * @param {import("../extent.js").Extent} extent Extent.
2124
+ * @return {boolean} `true` if the geometry and the extent intersect.
2125
+ * @api
2126
+ */
2127
+ intersectsExtent(t) {
2128
+ return !1;
2129
+ }
2130
+ /**
2131
+ * Set the coordinates of the linear ring.
2132
+ * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
2133
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
2134
+ * @api
2135
+ */
2136
+ setCoordinates(t, e) {
2137
+ this.setLayout(e, t, 1), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = Qt(
2138
+ this.flatCoordinates,
2139
+ 0,
2140
+ t,
2141
+ this.stride
2142
+ ), this.changed();
2143
+ }
2144
+ }
2145
+ class _t extends Rt {
2146
+ /**
2147
+ * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
2148
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
2149
+ */
2150
+ constructor(t, e) {
2151
+ super(), this.setCoordinates(t, e);
2152
+ }
2153
+ /**
2154
+ * Make a complete copy of the geometry.
2155
+ * @return {!Point} Clone.
2156
+ * @api
2157
+ */
2158
+ clone() {
2159
+ const t = new _t(this.flatCoordinates.slice(), this.layout);
2160
+ return t.applyProperties(this), t;
2161
+ }
2162
+ /**
2163
+ * @param {number} x X.
2164
+ * @param {number} y Y.
2165
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
2166
+ * @param {number} minSquaredDistance Minimum squared distance.
2167
+ * @return {number} Minimum squared distance.
2168
+ */
2169
+ closestPointXY(t, e, i, r) {
2170
+ const s = this.flatCoordinates, o = j(
2171
+ t,
2172
+ e,
2173
+ s[0],
2174
+ s[1]
2175
+ );
2176
+ if (o < r) {
2177
+ const u = this.stride;
2178
+ for (let a = 0; a < u; ++a)
2179
+ i[a] = s[a];
2180
+ return i.length = u, o;
2181
+ }
2182
+ return r;
2183
+ }
2184
+ /**
2185
+ * Return the coordinate of the point.
2186
+ * @return {import("../coordinate.js").Coordinate} Coordinates.
2187
+ * @api
2188
+ */
2189
+ getCoordinates() {
2190
+ return this.flatCoordinates ? this.flatCoordinates.slice() : [];
2191
+ }
2192
+ /**
2193
+ * @param {import("../extent.js").Extent} extent Extent.
2194
+ * @protected
2195
+ * @return {import("../extent.js").Extent} extent Extent.
2196
+ */
2197
+ computeExtent(t) {
2198
+ return Ne(this.flatCoordinates, t);
2199
+ }
2200
+ /**
2201
+ * Get the type of this geometry.
2202
+ * @return {import("./Geometry.js").Type} Geometry type.
2203
+ * @api
2204
+ */
2205
+ getType() {
2206
+ return "Point";
2207
+ }
2208
+ /**
2209
+ * Test if the geometry and the passed extent intersect.
2210
+ * @param {import("../extent.js").Extent} extent Extent.
2211
+ * @return {boolean} `true` if the geometry and the extent intersect.
2212
+ * @api
2213
+ */
2214
+ intersectsExtent(t) {
2215
+ return Ut(t, this.flatCoordinates[0], this.flatCoordinates[1]);
2216
+ }
2217
+ /**
2218
+ * @param {!Array<*>} coordinates Coordinates.
2219
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
2220
+ * @api
2221
+ */
2222
+ setCoordinates(t, e) {
2223
+ this.setLayout(e, t, 0), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = Sn(
2224
+ this.flatCoordinates,
2225
+ 0,
2226
+ t,
2227
+ this.stride
2228
+ ), this.changed();
2229
+ }
2230
+ }
2231
+ function An(n, t, e, i, r) {
2232
+ return !Ze(
2233
+ r,
2234
+ /**
2235
+ * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
2236
+ * @return {boolean} Contains (x, y).
2237
+ */
2238
+ function(o) {
2239
+ return !O(
2240
+ n,
2241
+ t,
2242
+ e,
2243
+ i,
2244
+ o[0],
2245
+ o[1]
2246
+ );
2247
+ }
2248
+ );
2249
+ }
2250
+ function O(n, t, e, i, r, s) {
2251
+ let o = 0, u = n[e - i], a = n[e - i + 1];
2252
+ for (; t < e; t += i) {
2253
+ const h = n[t], l = n[t + 1];
2254
+ a <= s ? l > s && (h - u) * (s - a) - (r - u) * (l - a) > 0 && o++ : l <= s && (h - u) * (s - a) - (r - u) * (l - a) < 0 && o--, u = h, a = l;
2255
+ }
2256
+ return o !== 0;
2257
+ }
2258
+ function mt(n, t, e, i, r, s) {
2259
+ if (e.length === 0 || !O(n, t, e[0], i, r, s))
2260
+ return !1;
2261
+ for (let o = 1, u = e.length; o < u; ++o)
2262
+ if (O(n, e[o - 1], e[o], i, r, s))
2263
+ return !1;
2264
+ return !0;
2265
+ }
2266
+ function Ri(n, t, e, i, r, s) {
2267
+ if (e.length === 0)
2268
+ return !1;
2269
+ for (let o = 0, u = e.length; o < u; ++o) {
2270
+ const a = e[o];
2271
+ if (mt(n, t, a, i, r, s))
2272
+ return !0;
2273
+ t = a[a.length - 1];
2274
+ }
2275
+ return !1;
2276
+ }
2277
+ function ae(n, t, e, i, r, s, o) {
2278
+ let u, a, h, l, c, g, f;
2279
+ const d = r[s + 1], R = [];
2280
+ for (let y = 0, et = e.length; y < et; ++y) {
2281
+ const G = e[y];
2282
+ for (l = n[G - i], g = n[G - i + 1], u = t; u < G; u += i)
2283
+ c = n[u], f = n[u + 1], (d <= g && f <= d || g <= d && d <= f) && (h = (d - g) / (f - g) * (c - l) + l, R.push(h)), l = c, g = f;
2284
+ }
2285
+ let _ = NaN, M = -1 / 0;
2286
+ for (R.sort(Re), l = R[0], u = 1, a = R.length; u < a; ++u) {
2287
+ c = R[u];
2288
+ const y = Math.abs(c - l);
2289
+ y > M && (h = (l + c) / 2, mt(n, t, e, i, h, d) && (_ = h, M = y)), l = c;
2290
+ }
2291
+ return isNaN(_) && (_ = r[s]), o ? (o.push(_, d, M), o) : [_, d, M];
2292
+ }
2293
+ function _i(n, t, e, i, r) {
2294
+ let s = [];
2295
+ for (let o = 0, u = e.length; o < u; ++o) {
2296
+ const a = e[o];
2297
+ s = ae(
2298
+ n,
2299
+ t,
2300
+ a,
2301
+ i,
2302
+ r,
2303
+ 2 * o,
2304
+ s
2305
+ ), t = a[a.length - 1];
2306
+ }
2307
+ return s;
2308
+ }
2309
+ function wn(n, t, e, i, r) {
2310
+ let s;
2311
+ for (t += i; t < e; t += i)
2312
+ if (s = r(
2313
+ n.slice(t - i, t),
2314
+ n.slice(t, t + i)
2315
+ ), s)
2316
+ return s;
2317
+ return !1;
2318
+ }
2319
+ function yt(n, t, e, i, r) {
2320
+ const s = Vt(
2321
+ $(),
2322
+ n,
2323
+ t,
2324
+ e,
2325
+ i
2326
+ );
2327
+ return lt(r, s) ? Te(r, s) || s[0] >= r[0] && s[2] <= r[2] || s[1] >= r[1] && s[3] <= r[3] ? !0 : wn(
2328
+ n,
2329
+ t,
2330
+ e,
2331
+ i,
2332
+ /**
2333
+ * @param {import("../../coordinate.js").Coordinate} point1 Start point.
2334
+ * @param {import("../../coordinate.js").Coordinate} point2 End point.
2335
+ * @return {boolean} `true` if the segment and the extent intersect,
2336
+ * `false` otherwise.
2337
+ */
2338
+ function(o, u) {
2339
+ return ze(r, o, u);
2340
+ }
2341
+ ) : !1;
2342
+ }
2343
+ function mi(n, t, e, i, r) {
2344
+ for (let s = 0, o = e.length; s < o; ++s) {
2345
+ if (yt(n, t, e[s], i, r))
2346
+ return !0;
2347
+ t = e[s];
2348
+ }
2349
+ return !1;
2350
+ }
2351
+ function Pn(n, t, e, i, r) {
2352
+ return !!(yt(n, t, e, i, r) || O(
2353
+ n,
2354
+ t,
2355
+ e,
2356
+ i,
2357
+ r[0],
2358
+ r[1]
2359
+ ) || O(
2360
+ n,
2361
+ t,
2362
+ e,
2363
+ i,
2364
+ r[0],
2365
+ r[3]
2366
+ ) || O(
2367
+ n,
2368
+ t,
2369
+ e,
2370
+ i,
2371
+ r[2],
2372
+ r[1]
2373
+ ) || O(
2374
+ n,
2375
+ t,
2376
+ e,
2377
+ i,
2378
+ r[2],
2379
+ r[3]
2380
+ ));
2381
+ }
2382
+ function ue(n, t, e, i, r) {
2383
+ if (!Pn(n, t, e[0], i, r))
2384
+ return !1;
2385
+ if (e.length === 1)
2386
+ return !0;
2387
+ for (let s = 1, o = e.length; s < o; ++s)
2388
+ if (An(
2389
+ n,
2390
+ e[s - 1],
2391
+ e[s],
2392
+ i,
2393
+ r
2394
+ ) && !yt(
2395
+ n,
2396
+ e[s - 1],
2397
+ e[s],
2398
+ i,
2399
+ r
2400
+ ))
2401
+ return !1;
2402
+ return !0;
2403
+ }
2404
+ function yi(n, t, e, i, r) {
2405
+ for (let s = 0, o = e.length; s < o; ++s) {
2406
+ const u = e[s];
2407
+ if (ue(n, t, u, i, r))
2408
+ return !0;
2409
+ t = u[u.length - 1];
2410
+ }
2411
+ return !1;
2412
+ }
2413
+ function Tn(n, t, e, i) {
2414
+ for (; t < e - i; ) {
2415
+ for (let r = 0; r < i; ++r) {
2416
+ const s = n[t + r];
2417
+ n[t + r] = n[e - i + r], n[e - i + r] = s;
2418
+ }
2419
+ t += i, e -= i;
2420
+ }
2421
+ }
2422
+ function le(n, t, e, i) {
2423
+ let r = 0, s = n[e - i], o = n[e - i + 1];
2424
+ for (; t < e; t += i) {
2425
+ const u = n[t], a = n[t + 1];
2426
+ r += (u - s) * (a + o), s = u, o = a;
2427
+ }
2428
+ return r === 0 ? void 0 : r > 0;
2429
+ }
2430
+ function he(n, t, e, i, r) {
2431
+ r = r !== void 0 ? r : !1;
2432
+ for (let s = 0, o = e.length; s < o; ++s) {
2433
+ const u = e[s], a = le(
2434
+ n,
2435
+ t,
2436
+ u,
2437
+ i
2438
+ );
2439
+ if (s === 0) {
2440
+ if (r && a || !r && !a)
2441
+ return !1;
2442
+ } else if (r && !a || !r && a)
2443
+ return !1;
2444
+ t = u;
2445
+ }
2446
+ return !0;
2447
+ }
2448
+ function Mi(n, t, e, i, r) {
2449
+ for (let s = 0, o = e.length; s < o; ++s) {
2450
+ const u = e[s];
2451
+ if (!he(n, t, u, i, r))
2452
+ return !1;
2453
+ u.length && (t = u[u.length - 1]);
2454
+ }
2455
+ return !0;
2456
+ }
2457
+ function ut(n, t, e, i, r) {
2458
+ r = r !== void 0 ? r : !1;
2459
+ for (let s = 0, o = e.length; s < o; ++s) {
2460
+ const u = e[s], a = le(
2461
+ n,
2462
+ t,
2463
+ u,
2464
+ i
2465
+ );
2466
+ (s === 0 ? r && a || !r && !a : r && !a || !r && a) && Tn(n, t, u, i), t = u;
2467
+ }
2468
+ return t;
2469
+ }
2470
+ function Ci(n, t, e, i, r) {
2471
+ for (let s = 0, o = e.length; s < o; ++s)
2472
+ t = ut(
2473
+ n,
2474
+ t,
2475
+ e[s],
2476
+ i,
2477
+ r
2478
+ );
2479
+ return t;
2480
+ }
2481
+ class Y extends Rt {
2482
+ /**
2483
+ * @param {!Array<Array<import("../coordinate.js").Coordinate>>|!Array<number>} coordinates
2484
+ * Array of linear rings that define the polygon. The first linear ring of the
2485
+ * array defines the outer-boundary or surface of the polygon. Each subsequent
2486
+ * linear ring defines a hole in the surface of the polygon. A linear ring is
2487
+ * an array of vertices' coordinates where the first coordinate and the last are
2488
+ * equivalent. (For internal use, flat coordinates in combination with
2489
+ * `layout` and `ends` are also accepted.)
2490
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
2491
+ * @param {Array<number>} [ends] Ends (for internal use with flat coordinates).
2492
+ */
2493
+ constructor(t, e, i) {
2494
+ super(), this.ends_ = [], this.flatInteriorPointRevision_ = -1, this.flatInteriorPoint_ = null, this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, this.orientedRevision_ = -1, this.orientedFlatCoordinates_ = null, e !== void 0 && i ? (this.setFlatCoordinates(
2495
+ e,
2496
+ /** @type {Array<number>} */
2497
+ t
2498
+ ), this.ends_ = i) : this.setCoordinates(
2499
+ /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */
2500
+ t,
2501
+ e
2502
+ );
2503
+ }
2504
+ /**
2505
+ * Append the passed linear ring to this polygon.
2506
+ * @param {LinearRing} linearRing Linear ring.
2507
+ * @api
2508
+ */
2509
+ appendLinearRing(t) {
2510
+ this.flatCoordinates ? _e(this.flatCoordinates, t.getFlatCoordinates()) : this.flatCoordinates = t.getFlatCoordinates().slice(), this.ends_.push(this.flatCoordinates.length), this.changed();
2511
+ }
2512
+ /**
2513
+ * Make a complete copy of the geometry.
2514
+ * @return {!Polygon} Clone.
2515
+ * @api
2516
+ */
2517
+ clone() {
2518
+ const t = new Y(
2519
+ this.flatCoordinates.slice(),
2520
+ this.layout,
2521
+ this.ends_.slice()
2522
+ );
2523
+ return t.applyProperties(this), t;
2524
+ }
2525
+ /**
2526
+ * @param {number} x X.
2527
+ * @param {number} y Y.
2528
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
2529
+ * @param {number} minSquaredDistance Minimum squared distance.
2530
+ * @return {number} Minimum squared distance.
2531
+ */
2532
+ closestPointXY(t, e, i, r) {
2533
+ return r < zt(this.getExtent(), t, e) ? r : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
2534
+ Ht(
2535
+ this.flatCoordinates,
2536
+ 0,
2537
+ this.ends_,
2538
+ this.stride,
2539
+ 0
2540
+ )
2541
+ ), this.maxDeltaRevision_ = this.getRevision()), Jt(
2542
+ this.flatCoordinates,
2543
+ 0,
2544
+ this.ends_,
2545
+ this.stride,
2546
+ this.maxDelta_,
2547
+ !0,
2548
+ t,
2549
+ e,
2550
+ i,
2551
+ r
2552
+ ));
2553
+ }
2554
+ /**
2555
+ * @param {number} x X.
2556
+ * @param {number} y Y.
2557
+ * @return {boolean} Contains (x, y).
2558
+ */
2559
+ containsXY(t, e) {
2560
+ return mt(
2561
+ this.getOrientedFlatCoordinates(),
2562
+ 0,
2563
+ this.ends_,
2564
+ this.stride,
2565
+ t,
2566
+ e
2567
+ );
2568
+ }
2569
+ /**
2570
+ * Return the area of the polygon on projected plane.
2571
+ * @return {number} Area (on projected plane).
2572
+ * @api
2573
+ */
2574
+ getArea() {
2575
+ return oe(
2576
+ this.getOrientedFlatCoordinates(),
2577
+ 0,
2578
+ this.ends_,
2579
+ this.stride
2580
+ );
2581
+ }
2582
+ /**
2583
+ * Get the coordinate array for this geometry. This array has the structure
2584
+ * of a GeoJSON coordinate array for polygons.
2585
+ *
2586
+ * @param {boolean} [right] Orient coordinates according to the right-hand
2587
+ * rule (counter-clockwise for exterior and clockwise for interior rings).
2588
+ * If `false`, coordinates will be oriented according to the left-hand rule
2589
+ * (clockwise for exterior and counter-clockwise for interior rings).
2590
+ * By default, coordinate orientation will depend on how the geometry was
2591
+ * constructed.
2592
+ * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
2593
+ * @api
2594
+ */
2595
+ getCoordinates(t) {
2596
+ let e;
2597
+ return t !== void 0 ? (e = this.getOrientedFlatCoordinates().slice(), ut(e, 0, this.ends_, this.stride, t)) : e = this.flatCoordinates, re(e, 0, this.ends_, this.stride);
2598
+ }
2599
+ /**
2600
+ * @return {Array<number>} Ends.
2601
+ */
2602
+ getEnds() {
2603
+ return this.ends_;
2604
+ }
2605
+ /**
2606
+ * @return {Array<number>} Interior point.
2607
+ */
2608
+ getFlatInteriorPoint() {
2609
+ if (this.flatInteriorPointRevision_ != this.getRevision()) {
2610
+ const t = L(this.getExtent());
2611
+ this.flatInteriorPoint_ = ae(
2612
+ this.getOrientedFlatCoordinates(),
2613
+ 0,
2614
+ this.ends_,
2615
+ this.stride,
2616
+ t,
2617
+ 0
2618
+ ), this.flatInteriorPointRevision_ = this.getRevision();
2619
+ }
2620
+ return this.flatInteriorPoint_;
2621
+ }
2622
+ /**
2623
+ * Return an interior point of the polygon.
2624
+ * @return {Point} Interior point as XYM coordinate, where M is the
2625
+ * length of the horizontal intersection that the point belongs to.
2626
+ * @api
2627
+ */
2628
+ getInteriorPoint() {
2629
+ return new _t(this.getFlatInteriorPoint(), "XYM");
2630
+ }
2631
+ /**
2632
+ * Return the number of rings of the polygon, this includes the exterior
2633
+ * ring and any interior rings.
2634
+ *
2635
+ * @return {number} Number of rings.
2636
+ * @api
2637
+ */
2638
+ getLinearRingCount() {
2639
+ return this.ends_.length;
2640
+ }
2641
+ /**
2642
+ * Return the Nth linear ring of the polygon geometry. Return `null` if the
2643
+ * given index is out of range.
2644
+ * The exterior linear ring is available at index `0` and the interior rings
2645
+ * at index `1` and beyond.
2646
+ *
2647
+ * @param {number} index Index.
2648
+ * @return {LinearRing|null} Linear ring.
2649
+ * @api
2650
+ */
2651
+ getLinearRing(t) {
2652
+ return t < 0 || this.ends_.length <= t ? null : new v(
2653
+ this.flatCoordinates.slice(
2654
+ t === 0 ? 0 : this.ends_[t - 1],
2655
+ this.ends_[t]
2656
+ ),
2657
+ this.layout
2658
+ );
2659
+ }
2660
+ /**
2661
+ * Return the linear rings of the polygon.
2662
+ * @return {Array<LinearRing>} Linear rings.
2663
+ * @api
2664
+ */
2665
+ getLinearRings() {
2666
+ const t = this.layout, e = this.flatCoordinates, i = this.ends_, r = [];
2667
+ let s = 0;
2668
+ for (let o = 0, u = i.length; o < u; ++o) {
2669
+ const a = i[o], h = new v(
2670
+ e.slice(s, a),
2671
+ t
2672
+ );
2673
+ r.push(h), s = a;
2674
+ }
2675
+ return r;
2676
+ }
2677
+ /**
2678
+ * @return {Array<number>} Oriented flat coordinates.
2679
+ */
2680
+ getOrientedFlatCoordinates() {
2681
+ if (this.orientedRevision_ != this.getRevision()) {
2682
+ const t = this.flatCoordinates;
2683
+ he(t, 0, this.ends_, this.stride) ? this.orientedFlatCoordinates_ = t : (this.orientedFlatCoordinates_ = t.slice(), this.orientedFlatCoordinates_.length = ut(
2684
+ this.orientedFlatCoordinates_,
2685
+ 0,
2686
+ this.ends_,
2687
+ this.stride
2688
+ )), this.orientedRevision_ = this.getRevision();
2689
+ }
2690
+ return this.orientedFlatCoordinates_;
2691
+ }
2692
+ /**
2693
+ * @param {number} squaredTolerance Squared tolerance.
2694
+ * @return {Polygon} Simplified Polygon.
2695
+ * @protected
2696
+ */
2697
+ getSimplifiedGeometryInternal(t) {
2698
+ const e = [], i = [];
2699
+ return e.length = ne(
2700
+ this.flatCoordinates,
2701
+ 0,
2702
+ this.ends_,
2703
+ this.stride,
2704
+ Math.sqrt(t),
2705
+ e,
2706
+ 0,
2707
+ i
2708
+ ), new Y(e, "XY", i);
2709
+ }
2710
+ /**
2711
+ * Get the type of this geometry.
2712
+ * @return {import("./Geometry.js").Type} Geometry type.
2713
+ * @api
2714
+ */
2715
+ getType() {
2716
+ return "Polygon";
2717
+ }
2718
+ /**
2719
+ * Test if the geometry and the passed extent intersect.
2720
+ * @param {import("../extent.js").Extent} extent Extent.
2721
+ * @return {boolean} `true` if the geometry and the extent intersect.
2722
+ * @api
2723
+ */
2724
+ intersectsExtent(t) {
2725
+ return ue(
2726
+ this.getOrientedFlatCoordinates(),
2727
+ 0,
2728
+ this.ends_,
2729
+ this.stride,
2730
+ t
2731
+ );
2732
+ }
2733
+ /**
2734
+ * Set the coordinates of the polygon.
2735
+ * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
2736
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
2737
+ * @api
2738
+ */
2739
+ setCoordinates(t, e) {
2740
+ this.setLayout(e, t, 2), this.flatCoordinates || (this.flatCoordinates = []);
2741
+ const i = te(
2742
+ this.flatCoordinates,
2743
+ 0,
2744
+ t,
2745
+ this.stride,
2746
+ this.ends_
2747
+ );
2748
+ this.flatCoordinates.length = i.length === 0 ? 0 : i[i.length - 1], this.changed();
2749
+ }
2750
+ }
2751
+ function Xt(n) {
2752
+ if (tt(n))
2753
+ throw new Error("Cannot create polygon from empty extent");
2754
+ const t = n[0], e = n[1], i = n[2], r = n[3], s = [
2755
+ t,
2756
+ e,
2757
+ t,
2758
+ r,
2759
+ i,
2760
+ r,
2761
+ i,
2762
+ e,
2763
+ t,
2764
+ e
2765
+ ];
2766
+ return new Y(s, "XY", [s.length]);
2767
+ }
2768
+ function Ei(n, t, e) {
2769
+ t = t || 32;
2770
+ const i = n.getStride(), r = n.getLayout(), s = n.getCenter(), o = i * (t + 1), u = new Array(o);
2771
+ for (let l = 0; l < o; l += i) {
2772
+ u[l] = 0, u[l + 1] = 0;
2773
+ for (let c = 2; c < i; c++)
2774
+ u[l + c] = s[c];
2775
+ }
2776
+ const a = [u.length], h = new Y(u, r, a);
2777
+ return Nn(h, s, n.getRadius()), h;
2778
+ }
2779
+ function Nn(n, t, e, i) {
2780
+ const r = n.getFlatCoordinates(), s = n.getStride(), o = r.length / s - 1, u = 0;
2781
+ for (let a = 0; a <= o; ++a) {
2782
+ const h = a * s, l = u + K(a, o) * 2 * Math.PI / o;
2783
+ r[h] = t[0] + e * Math.cos(l), r[h + 1] = t[1] + e * Math.sin(l);
2784
+ }
2785
+ n.changed();
2786
+ }
2787
+ const rt = 0;
2788
+ class Gt extends H {
2789
+ /**
2790
+ * @param {ViewOptions} [options] View options.
2791
+ */
2792
+ constructor(t) {
2793
+ super(), this.on, this.once, this.un, t = Object.assign({}, t), this.hints_ = [0, 0], this.animations_ = [], this.updateAnimationKey_, this.projection_ = ct(t.projection, "EPSG:3857"), this.viewportSize_ = [100, 100], this.targetCenter_ = null, this.targetResolution_, this.targetRotation_, this.nextCenter_ = null, this.nextResolution_, this.nextRotation_, this.cancelAnchor_ = void 0, t.projection && Wt(), t.center && (t.center = w(t.center, this.projection_)), t.extent && (t.extent = V(t.extent, this.projection_)), this.applyOptions_(t);
2794
+ }
2795
+ /**
2796
+ * Set up the view with the given options.
2797
+ * @param {ViewOptions} options View options.
2798
+ */
2799
+ applyOptions_(t) {
2800
+ const e = Object.assign({}, t);
2801
+ for (const u in I)
2802
+ delete e[u];
2803
+ this.setProperties(e, !0);
2804
+ const i = xn(t);
2805
+ this.maxResolution_ = i.maxResolution, this.minResolution_ = i.minResolution, this.zoomFactor_ = i.zoomFactor, this.resolutions_ = t.resolutions, this.padding_ = t.padding, this.minZoom_ = i.minZoom;
2806
+ const r = On(t), s = i.constraint, o = Fn(t);
2807
+ this.constraints_ = {
2808
+ center: r,
2809
+ resolution: s,
2810
+ rotation: o
2811
+ }, this.setRotation(t.rotation !== void 0 ? t.rotation : 0), this.setCenterInternal(
2812
+ t.center !== void 0 ? t.center : null
2813
+ ), t.resolution !== void 0 ? this.setResolution(t.resolution) : t.zoom !== void 0 && this.setZoom(t.zoom);
2814
+ }
2815
+ /**
2816
+ * Padding (in css pixels).
2817
+ * If the map viewport is partially covered with other content (overlays) along
2818
+ * its edges, this setting allows to shift the center of the viewport away from that
2819
+ * content. The order of the values in the array is top, right, bottom, left.
2820
+ * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.
2821
+ * @type {Array<number>|undefined}
2822
+ * @api
2823
+ */
2824
+ get padding() {
2825
+ return this.padding_;
2826
+ }
2827
+ set padding(t) {
2828
+ let e = this.padding_;
2829
+ this.padding_ = t;
2830
+ const i = this.getCenterInternal();
2831
+ if (i) {
2832
+ const r = t || [0, 0, 0, 0];
2833
+ e = e || [0, 0, 0, 0];
2834
+ const s = this.getResolution(), o = s / 2 * (r[3] - e[3] + e[1] - r[1]), u = s / 2 * (r[0] - e[0] + e[2] - r[2]);
2835
+ this.setCenterInternal([i[0] + o, i[1] - u]);
2836
+ }
2837
+ }
2838
+ /**
2839
+ * Get an updated version of the view options used to construct the view. The
2840
+ * current resolution (or zoom), center, and rotation are applied to any stored
2841
+ * options. The provided options can be used to apply new min/max zoom or
2842
+ * resolution limits.
2843
+ * @param {ViewOptions} newOptions New options to be applied.
2844
+ * @return {ViewOptions} New options updated with the current view state.
2845
+ */
2846
+ getUpdatedOptions_(t) {
2847
+ const e = this.getProperties();
2848
+ return e.resolution !== void 0 ? e.resolution = this.getResolution() : e.zoom = this.getZoom(), e.center = this.getCenterInternal(), e.rotation = this.getRotation(), Object.assign({}, e, t);
2849
+ }
2850
+ /**
2851
+ * Animate the view. The view's center, zoom (or resolution), and rotation
2852
+ * can be animated for smooth transitions between view states. For example,
2853
+ * to animate the view to a new zoom level:
2854
+ *
2855
+ * view.animate({zoom: view.getZoom() + 1});
2856
+ *
2857
+ * By default, the animation lasts one second and uses in-and-out easing. You
2858
+ * can customize this behavior by including `duration` (in milliseconds) and
2859
+ * `easing` options (see {@link module:ol/easing}).
2860
+ *
2861
+ * To chain together multiple animations, call the method with multiple
2862
+ * animation objects. For example, to first zoom and then pan:
2863
+ *
2864
+ * view.animate({zoom: 10}, {center: [0, 0]});
2865
+ *
2866
+ * If you provide a function as the last argument to the animate method, it
2867
+ * will get called at the end of an animation series. The callback will be
2868
+ * called with `true` if the animation series completed on its own or `false`
2869
+ * if it was cancelled.
2870
+ *
2871
+ * Animations are cancelled by user interactions (e.g. dragging the map) or by
2872
+ * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`
2873
+ * (or another method that calls one of these).
2874
+ *
2875
+ * @param {...(AnimationOptions|function(boolean): void)} var_args Animation
2876
+ * options. Multiple animations can be run in series by passing multiple
2877
+ * options objects. To run multiple animations in parallel, call the method
2878
+ * multiple times. An optional callback can be provided as a final
2879
+ * argument. The callback will be called with a boolean indicating whether
2880
+ * the animation completed without being cancelled.
2881
+ * @api
2882
+ */
2883
+ animate(t) {
2884
+ this.isDef() && !this.getAnimating() && this.resolveConstraints(0);
2885
+ const e = new Array(arguments.length);
2886
+ for (let i = 0; i < e.length; ++i) {
2887
+ let r = arguments[i];
2888
+ r.center && (r = Object.assign({}, r), r.center = w(
2889
+ r.center,
2890
+ this.getProjection()
2891
+ )), r.anchor && (r = Object.assign({}, r), r.anchor = w(
2892
+ r.anchor,
2893
+ this.getProjection()
2894
+ )), e[i] = r;
2895
+ }
2896
+ this.animateInternal.apply(this, e);
2897
+ }
2898
+ /**
2899
+ * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.
2900
+ */
2901
+ animateInternal(t) {
2902
+ let e = arguments.length, i;
2903
+ e > 1 && typeof arguments[e - 1] == "function" && (i = arguments[e - 1], --e);
2904
+ let r = 0;
2905
+ for (; r < e && !this.isDef(); ++r) {
2906
+ const l = arguments[r];
2907
+ l.center && this.setCenterInternal(l.center), l.zoom !== void 0 ? this.setZoom(l.zoom) : l.resolution && this.setResolution(l.resolution), l.rotation !== void 0 && this.setRotation(l.rotation);
2908
+ }
2909
+ if (r === e) {
2910
+ i && D(i, !0);
2911
+ return;
2912
+ }
2913
+ let s = Date.now(), o = this.targetCenter_.slice(), u = this.targetResolution_, a = this.targetRotation_;
2914
+ const h = [];
2915
+ for (; r < e; ++r) {
2916
+ const l = (
2917
+ /** @type {AnimationOptions} */
2918
+ arguments[r]
2919
+ ), c = {
2920
+ start: s,
2921
+ complete: !1,
2922
+ anchor: l.anchor,
2923
+ duration: l.duration !== void 0 ? l.duration : 1e3,
2924
+ easing: l.easing || mn,
2925
+ callback: i
2926
+ };
2927
+ if (l.center && (c.sourceCenter = o, c.targetCenter = l.center.slice(), o = c.targetCenter), l.zoom !== void 0 ? (c.sourceResolution = u, c.targetResolution = this.getResolutionForZoom(l.zoom), u = c.targetResolution) : l.resolution && (c.sourceResolution = u, c.targetResolution = l.resolution, u = c.targetResolution), l.rotation !== void 0) {
2928
+ c.sourceRotation = a;
2929
+ const g = K(l.rotation - a + Math.PI, 2 * Math.PI) - Math.PI;
2930
+ c.targetRotation = a + g, a = c.targetRotation;
2931
+ }
2932
+ Zn(c) ? c.complete = !0 : s += c.duration, h.push(c);
2933
+ }
2934
+ this.animations_.push(h), this.setHint(P.ANIMATING, 1), this.updateAnimations_();
2935
+ }
2936
+ /**
2937
+ * Determine if the view is being animated.
2938
+ * @return {boolean} The view is being animated.
2939
+ * @api
2940
+ */
2941
+ getAnimating() {
2942
+ return this.hints_[P.ANIMATING] > 0;
2943
+ }
2944
+ /**
2945
+ * Determine if the user is interacting with the view, such as panning or zooming.
2946
+ * @return {boolean} The view is being interacted with.
2947
+ * @api
2948
+ */
2949
+ getInteracting() {
2950
+ return this.hints_[P.INTERACTING] > 0;
2951
+ }
2952
+ /**
2953
+ * Cancel any ongoing animations.
2954
+ * @api
2955
+ */
2956
+ cancelAnimations() {
2957
+ this.setHint(P.ANIMATING, -this.hints_[P.ANIMATING]);
2958
+ let t;
2959
+ for (let e = 0, i = this.animations_.length; e < i; ++e) {
2960
+ const r = this.animations_[e];
2961
+ if (r[0].callback && D(r[0].callback, !1), !t)
2962
+ for (let s = 0, o = r.length; s < o; ++s) {
2963
+ const u = r[s];
2964
+ if (!u.complete) {
2965
+ t = u.anchor;
2966
+ break;
2967
+ }
2968
+ }
2969
+ }
2970
+ this.animations_.length = 0, this.cancelAnchor_ = t, this.nextCenter_ = null, this.nextResolution_ = NaN, this.nextRotation_ = NaN;
2971
+ }
2972
+ /**
2973
+ * Update all animations.
2974
+ */
2975
+ updateAnimations_() {
2976
+ if (this.updateAnimationKey_ !== void 0 && (cancelAnimationFrame(this.updateAnimationKey_), this.updateAnimationKey_ = void 0), !this.getAnimating())
2977
+ return;
2978
+ const t = Date.now();
2979
+ let e = !1;
2980
+ for (let i = this.animations_.length - 1; i >= 0; --i) {
2981
+ const r = this.animations_[i];
2982
+ let s = !0;
2983
+ for (let o = 0, u = r.length; o < u; ++o) {
2984
+ const a = r[o];
2985
+ if (a.complete)
2986
+ continue;
2987
+ const h = t - a.start;
2988
+ let l = a.duration > 0 ? h / a.duration : 1;
2989
+ l >= 1 ? (a.complete = !0, l = 1) : s = !1;
2990
+ const c = a.easing(l);
2991
+ if (a.sourceCenter) {
2992
+ const g = a.sourceCenter[0], f = a.sourceCenter[1], d = a.targetCenter[0], R = a.targetCenter[1];
2993
+ this.nextCenter_ = a.targetCenter;
2994
+ const _ = g + c * (d - g), M = f + c * (R - f);
2995
+ this.targetCenter_ = [_, M];
2996
+ }
2997
+ if (a.sourceResolution && a.targetResolution) {
2998
+ const g = c === 1 ? a.targetResolution : a.sourceResolution + c * (a.targetResolution - a.sourceResolution);
2999
+ if (a.anchor) {
3000
+ const f = this.getViewportSize_(this.getRotation()), d = this.constraints_.resolution(
3001
+ g,
3002
+ 0,
3003
+ f,
3004
+ !0
3005
+ );
3006
+ this.targetCenter_ = this.calculateCenterZoom(
3007
+ d,
3008
+ a.anchor
3009
+ );
3010
+ }
3011
+ this.nextResolution_ = a.targetResolution, this.targetResolution_ = g, this.applyTargetState_(!0);
3012
+ }
3013
+ if (a.sourceRotation !== void 0 && a.targetRotation !== void 0) {
3014
+ const g = c === 1 ? K(a.targetRotation + Math.PI, 2 * Math.PI) - Math.PI : a.sourceRotation + c * (a.targetRotation - a.sourceRotation);
3015
+ if (a.anchor) {
3016
+ const f = this.constraints_.rotation(
3017
+ g,
3018
+ !0
3019
+ );
3020
+ this.targetCenter_ = this.calculateCenterRotate(
3021
+ f,
3022
+ a.anchor
3023
+ );
3024
+ }
3025
+ this.nextRotation_ = a.targetRotation, this.targetRotation_ = g;
3026
+ }
3027
+ if (this.applyTargetState_(!0), e = !0, !a.complete)
3028
+ break;
3029
+ }
3030
+ if (s) {
3031
+ this.animations_[i] = null, this.setHint(P.ANIMATING, -1), this.nextCenter_ = null, this.nextResolution_ = NaN, this.nextRotation_ = NaN;
3032
+ const o = r[0].callback;
3033
+ o && D(o, !0);
3034
+ }
3035
+ }
3036
+ this.animations_ = this.animations_.filter(Boolean), e && this.updateAnimationKey_ === void 0 && (this.updateAnimationKey_ = requestAnimationFrame(
3037
+ this.updateAnimations_.bind(this)
3038
+ ));
3039
+ }
3040
+ /**
3041
+ * @param {number} rotation Target rotation.
3042
+ * @param {import("./coordinate.js").Coordinate} anchor Rotation anchor.
3043
+ * @return {import("./coordinate.js").Coordinate|undefined} Center for rotation and anchor.
3044
+ */
3045
+ calculateCenterRotate(t, e) {
3046
+ let i;
3047
+ const r = this.getCenterInternal();
3048
+ return r !== void 0 && (i = [r[0] - e[0], r[1] - e[1]], Ke(i, t - this.getRotation()), De(i, e)), i;
3049
+ }
3050
+ /**
3051
+ * @param {number} resolution Target resolution.
3052
+ * @param {import("./coordinate.js").Coordinate} anchor Zoom anchor.
3053
+ * @return {import("./coordinate.js").Coordinate|undefined} Center for resolution and anchor.
3054
+ */
3055
+ calculateCenterZoom(t, e) {
3056
+ let i;
3057
+ const r = this.getCenterInternal(), s = this.getResolution();
3058
+ if (r !== void 0 && s !== void 0) {
3059
+ const o = e[0] - t * (e[0] - r[0]) / s, u = e[1] - t * (e[1] - r[1]) / s;
3060
+ i = [o, u];
3061
+ }
3062
+ return i;
3063
+ }
3064
+ /**
3065
+ * Returns the current viewport size.
3066
+ * @private
3067
+ * @param {number} [rotation] Take into account the rotation of the viewport when giving the size
3068
+ * @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
3069
+ */
3070
+ getViewportSize_(t) {
3071
+ const e = this.viewportSize_;
3072
+ if (t) {
3073
+ const i = e[0], r = e[1];
3074
+ return [
3075
+ Math.abs(i * Math.cos(t)) + Math.abs(r * Math.sin(t)),
3076
+ Math.abs(i * Math.sin(t)) + Math.abs(r * Math.cos(t))
3077
+ ];
3078
+ }
3079
+ return e;
3080
+ }
3081
+ /**
3082
+ * Stores the viewport size on the view. The viewport size is not read every time from the DOM
3083
+ * to avoid performance hit and layout reflow.
3084
+ * This should be done on map size change.
3085
+ * Note: the constraints are not resolved during an animation to avoid stopping it
3086
+ * @param {import("./size.js").Size} [size] Viewport size; if undefined, [100, 100] is assumed
3087
+ */
3088
+ setViewportSize(t) {
3089
+ this.viewportSize_ = Array.isArray(t) ? t.slice() : [100, 100], this.getAnimating() || this.resolveConstraints(0);
3090
+ }
3091
+ /**
3092
+ * Get the view center.
3093
+ * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
3094
+ * @observable
3095
+ * @api
3096
+ */
3097
+ getCenter() {
3098
+ const t = this.getCenterInternal();
3099
+ return t && Pt(t, this.getProjection());
3100
+ }
3101
+ /**
3102
+ * Get the view center without transforming to user projection.
3103
+ * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
3104
+ */
3105
+ getCenterInternal() {
3106
+ return (
3107
+ /** @type {import("./coordinate.js").Coordinate|undefined} */
3108
+ this.get(I.CENTER)
3109
+ );
3110
+ }
3111
+ /**
3112
+ * @return {Constraints} Constraints.
3113
+ */
3114
+ getConstraints() {
3115
+ return this.constraints_;
3116
+ }
3117
+ /**
3118
+ * @return {boolean} Resolution constraint is set
3119
+ */
3120
+ getConstrainResolution() {
3121
+ return this.get("constrainResolution");
3122
+ }
3123
+ /**
3124
+ * @param {Array<number>} [hints] Destination array.
3125
+ * @return {Array<number>} Hint.
3126
+ */
3127
+ getHints(t) {
3128
+ return t !== void 0 ? (t[0] = this.hints_[0], t[1] = this.hints_[1], t) : this.hints_.slice();
3129
+ }
3130
+ /**
3131
+ * Calculate the extent for the current view state and the passed size.
3132
+ * The size is the pixel dimensions of the box into which the calculated extent
3133
+ * should fit. In most cases you want to get the extent of the entire map,
3134
+ * that is `map.getSize()`.
3135
+ * @param {import("./size.js").Size} [size] Box pixel size. If not provided, the size
3136
+ * of the map that uses this view will be used.
3137
+ * @return {import("./extent.js").Extent} Extent.
3138
+ * @api
3139
+ */
3140
+ calculateExtent(t) {
3141
+ const e = this.calculateExtentInternal(t);
3142
+ return Qe(e, this.getProjection());
3143
+ }
3144
+ /**
3145
+ * @param {import("./size.js").Size} [size] Box pixel size. If not provided,
3146
+ * the map's last known viewport size will be used.
3147
+ * @return {import("./extent.js").Extent} Extent.
3148
+ */
3149
+ calculateExtentInternal(t) {
3150
+ t = t || this.getViewportSizeMinusPadding_();
3151
+ const e = (
3152
+ /** @type {!import("./coordinate.js").Coordinate} */
3153
+ this.getCenterInternal()
3154
+ );
3155
+ p(e, 1);
3156
+ const i = (
3157
+ /** @type {!number} */
3158
+ this.getResolution()
3159
+ );
3160
+ p(i !== void 0, 2);
3161
+ const r = (
3162
+ /** @type {!number} */
3163
+ this.getRotation()
3164
+ );
3165
+ return p(r !== void 0, 3), Ge(e, i, r, t);
3166
+ }
3167
+ /**
3168
+ * Get the maximum resolution of the view.
3169
+ * @return {number} The maximum resolution of the view.
3170
+ * @api
3171
+ */
3172
+ getMaxResolution() {
3173
+ return this.maxResolution_;
3174
+ }
3175
+ /**
3176
+ * Get the minimum resolution of the view.
3177
+ * @return {number} The minimum resolution of the view.
3178
+ * @api
3179
+ */
3180
+ getMinResolution() {
3181
+ return this.minResolution_;
3182
+ }
3183
+ /**
3184
+ * Get the maximum zoom level for the view.
3185
+ * @return {number} The maximum zoom level.
3186
+ * @api
3187
+ */
3188
+ getMaxZoom() {
3189
+ return (
3190
+ /** @type {number} */
3191
+ this.getZoomForResolution(this.minResolution_)
3192
+ );
3193
+ }
3194
+ /**
3195
+ * Set a new maximum zoom level for the view.
3196
+ * @param {number} zoom The maximum zoom level.
3197
+ * @api
3198
+ */
3199
+ setMaxZoom(t) {
3200
+ this.applyOptions_(this.getUpdatedOptions_({ maxZoom: t }));
3201
+ }
3202
+ /**
3203
+ * Get the minimum zoom level for the view.
3204
+ * @return {number} The minimum zoom level.
3205
+ * @api
3206
+ */
3207
+ getMinZoom() {
3208
+ return (
3209
+ /** @type {number} */
3210
+ this.getZoomForResolution(this.maxResolution_)
3211
+ );
3212
+ }
3213
+ /**
3214
+ * Set a new minimum zoom level for the view.
3215
+ * @param {number} zoom The minimum zoom level.
3216
+ * @api
3217
+ */
3218
+ setMinZoom(t) {
3219
+ this.applyOptions_(this.getUpdatedOptions_({ minZoom: t }));
3220
+ }
3221
+ /**
3222
+ * Set whether the view should allow intermediary zoom levels.
3223
+ * @param {boolean} enabled Whether the resolution is constrained.
3224
+ * @api
3225
+ */
3226
+ setConstrainResolution(t) {
3227
+ this.applyOptions_(this.getUpdatedOptions_({ constrainResolution: t }));
3228
+ }
3229
+ /**
3230
+ * Get the view projection.
3231
+ * @return {import("./proj/Projection.js").default} The projection of the view.
3232
+ * @api
3233
+ */
3234
+ getProjection() {
3235
+ return this.projection_;
3236
+ }
3237
+ /**
3238
+ * Get the view resolution.
3239
+ * @return {number|undefined} The resolution of the view.
3240
+ * @observable
3241
+ * @api
3242
+ */
3243
+ getResolution() {
3244
+ return (
3245
+ /** @type {number|undefined} */
3246
+ this.get(I.RESOLUTION)
3247
+ );
3248
+ }
3249
+ /**
3250
+ * Get the resolutions for the view. This returns the array of resolutions
3251
+ * passed to the constructor of the View, or undefined if none were given.
3252
+ * @return {Array<number>|undefined} The resolutions of the view.
3253
+ * @api
3254
+ */
3255
+ getResolutions() {
3256
+ return this.resolutions_;
3257
+ }
3258
+ /**
3259
+ * Get the resolution for a provided extent (in map units) and size (in pixels).
3260
+ * @param {import("./extent.js").Extent} extent Extent.
3261
+ * @param {import("./size.js").Size} [size] Box pixel size.
3262
+ * @return {number} The resolution at which the provided extent will render at
3263
+ * the given size.
3264
+ * @api
3265
+ */
3266
+ getResolutionForExtent(t, e) {
3267
+ return this.getResolutionForExtentInternal(
3268
+ V(t, this.getProjection()),
3269
+ e
3270
+ );
3271
+ }
3272
+ /**
3273
+ * Get the resolution for a provided extent (in map units) and size (in pixels).
3274
+ * @param {import("./extent.js").Extent} extent Extent.
3275
+ * @param {import("./size.js").Size} [size] Box pixel size.
3276
+ * @return {number} The resolution at which the provided extent will render at
3277
+ * the given size.
3278
+ */
3279
+ getResolutionForExtentInternal(t, e) {
3280
+ e = e || this.getViewportSizeMinusPadding_();
3281
+ const i = A(t) / e[0], r = X(t) / e[1];
3282
+ return Math.max(i, r);
3283
+ }
3284
+ /**
3285
+ * Return a function that returns a value between 0 and 1 for a
3286
+ * resolution. Exponential scaling is assumed.
3287
+ * @param {number} [power] Power.
3288
+ * @return {function(number): number} Resolution for value function.
3289
+ */
3290
+ getResolutionForValueFunction(t) {
3291
+ t = t || 2;
3292
+ const e = this.getConstrainedResolution(this.maxResolution_), i = this.minResolution_, r = Math.log(e / i) / Math.log(t);
3293
+ return (
3294
+ /**
3295
+ * @param {number} value Value.
3296
+ * @return {number} Resolution.
3297
+ */
3298
+ function(s) {
3299
+ return e / Math.pow(t, s * r);
3300
+ }
3301
+ );
3302
+ }
3303
+ /**
3304
+ * Get the view rotation.
3305
+ * @return {number} The rotation of the view in radians.
3306
+ * @observable
3307
+ * @api
3308
+ */
3309
+ getRotation() {
3310
+ return (
3311
+ /** @type {number} */
3312
+ this.get(I.ROTATION)
3313
+ );
3314
+ }
3315
+ /**
3316
+ * Return a function that returns a resolution for a value between
3317
+ * 0 and 1. Exponential scaling is assumed.
3318
+ * @param {number} [power] Power.
3319
+ * @return {function(number): number} Value for resolution function.
3320
+ */
3321
+ getValueForResolutionFunction(t) {
3322
+ const e = Math.log(t || 2), i = this.getConstrainedResolution(this.maxResolution_), r = this.minResolution_, s = Math.log(i / r) / e;
3323
+ return (
3324
+ /**
3325
+ * @param {number} resolution Resolution.
3326
+ * @return {number} Value.
3327
+ */
3328
+ function(o) {
3329
+ return Math.log(i / o) / e / s;
3330
+ }
3331
+ );
3332
+ }
3333
+ /**
3334
+ * Returns the size of the viewport minus padding.
3335
+ * @private
3336
+ * @param {number} [rotation] Take into account the rotation of the viewport when giving the size
3337
+ * @return {import("./size.js").Size} Viewport size reduced by the padding.
3338
+ */
3339
+ getViewportSizeMinusPadding_(t) {
3340
+ let e = this.getViewportSize_(t);
3341
+ const i = this.padding_;
3342
+ return i && (e = [
3343
+ e[0] - i[1] - i[3],
3344
+ e[1] - i[0] - i[2]
3345
+ ]), e;
3346
+ }
3347
+ /**
3348
+ * @return {State} View state.
3349
+ */
3350
+ getState() {
3351
+ const t = this.getProjection(), e = this.getResolution(), i = this.getRotation();
3352
+ let r = (
3353
+ /** @type {import("./coordinate.js").Coordinate} */
3354
+ this.getCenterInternal()
3355
+ );
3356
+ const s = this.padding_;
3357
+ if (s) {
3358
+ const o = this.getViewportSizeMinusPadding_();
3359
+ r = st(
3360
+ r,
3361
+ this.getViewportSize_(),
3362
+ [o[0] / 2 + s[3], o[1] / 2 + s[0]],
3363
+ e,
3364
+ i
3365
+ );
3366
+ }
3367
+ return {
3368
+ center: r.slice(0),
3369
+ projection: t !== void 0 ? t : null,
3370
+ resolution: e,
3371
+ nextCenter: this.nextCenter_,
3372
+ nextResolution: this.nextResolution_,
3373
+ nextRotation: this.nextRotation_,
3374
+ rotation: i,
3375
+ zoom: this.getZoom()
3376
+ };
3377
+ }
3378
+ /**
3379
+ * @return {ViewStateLayerStateExtent} Like `FrameState`, but just `viewState` and `extent`.
3380
+ */
3381
+ getViewStateAndExtent() {
3382
+ return {
3383
+ viewState: this.getState(),
3384
+ extent: this.calculateExtent()
3385
+ };
3386
+ }
3387
+ /**
3388
+ * Get the current zoom level. This method may return non-integer zoom levels
3389
+ * if the view does not constrain the resolution, or if an interaction or
3390
+ * animation is underway.
3391
+ * @return {number|undefined} Zoom.
3392
+ * @api
3393
+ */
3394
+ getZoom() {
3395
+ let t;
3396
+ const e = this.getResolution();
3397
+ return e !== void 0 && (t = this.getZoomForResolution(e)), t;
3398
+ }
3399
+ /**
3400
+ * Get the zoom level for a resolution.
3401
+ * @param {number} resolution The resolution.
3402
+ * @return {number|undefined} The zoom level for the provided resolution.
3403
+ * @api
3404
+ */
3405
+ getZoomForResolution(t) {
3406
+ let e = this.minZoom_ || 0, i, r;
3407
+ if (this.resolutions_) {
3408
+ const s = Lt(this.resolutions_, t, 1);
3409
+ e = s, i = this.resolutions_[s], s == this.resolutions_.length - 1 ? r = 2 : r = i / this.resolutions_[s + 1];
3410
+ } else
3411
+ i = this.maxResolution_, r = this.zoomFactor_;
3412
+ return e + Math.log(i / t) / Math.log(r);
3413
+ }
3414
+ /**
3415
+ * Get the resolution for a zoom level.
3416
+ * @param {number} zoom Zoom level.
3417
+ * @return {number} The view resolution for the provided zoom level.
3418
+ * @api
3419
+ */
3420
+ getResolutionForZoom(t) {
3421
+ if (this.resolutions_) {
3422
+ if (this.resolutions_.length <= 1)
3423
+ return 0;
3424
+ const e = S(
3425
+ Math.floor(t),
3426
+ 0,
3427
+ this.resolutions_.length - 2
3428
+ ), i = this.resolutions_[e] / this.resolutions_[e + 1];
3429
+ return this.resolutions_[e] / Math.pow(i, S(t - e, 0, 1));
3430
+ }
3431
+ return this.maxResolution_ / Math.pow(this.zoomFactor_, t - this.minZoom_);
3432
+ }
3433
+ /**
3434
+ * Fit the given geometry or extent based on the given map size and border.
3435
+ * The size is pixel dimensions of the box to fit the extent into.
3436
+ * In most cases you will want to use the map size, that is `map.getSize()`.
3437
+ * Takes care of the map angle.
3438
+ * @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or
3439
+ * extent to fit the view to.
3440
+ * @param {FitOptions} [options] Options.
3441
+ * @api
3442
+ */
3443
+ fit(t, e) {
3444
+ let i;
3445
+ if (p(
3446
+ Array.isArray(t) || typeof /** @type {?} */
3447
+ t.getSimplifiedGeometry == "function",
3448
+ 24
3449
+ ), Array.isArray(t)) {
3450
+ p(!tt(t), 25);
3451
+ const r = V(t, this.getProjection());
3452
+ i = Xt(r);
3453
+ } else if (t.getType() === "Circle") {
3454
+ const r = V(
3455
+ t.getExtent(),
3456
+ this.getProjection()
3457
+ );
3458
+ i = Xt(r), i.rotate(this.getRotation(), L(r));
3459
+ } else
3460
+ i = t;
3461
+ this.fitInternal(i, e);
3462
+ }
3463
+ /**
3464
+ * Calculate rotated extent
3465
+ * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
3466
+ * @return {import("./extent").Extent} The rotated extent for the geometry.
3467
+ */
3468
+ rotatedExtentForGeometry(t) {
3469
+ const e = this.getRotation(), i = Math.cos(e), r = Math.sin(-e), s = t.getFlatCoordinates(), o = t.getStride();
3470
+ let u = 1 / 0, a = 1 / 0, h = -1 / 0, l = -1 / 0;
3471
+ for (let c = 0, g = s.length; c < g; c += o) {
3472
+ const f = s[c] * i - s[c + 1] * r, d = s[c] * r + s[c + 1] * i;
3473
+ u = Math.min(u, f), a = Math.min(a, d), h = Math.max(h, f), l = Math.max(l, d);
3474
+ }
3475
+ return [u, a, h, l];
3476
+ }
3477
+ /**
3478
+ * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
3479
+ * @param {FitOptions} [options] Options.
3480
+ */
3481
+ fitInternal(t, e) {
3482
+ e = e || {};
3483
+ let i = e.size;
3484
+ i || (i = this.getViewportSizeMinusPadding_());
3485
+ const r = e.padding !== void 0 ? e.padding : [0, 0, 0, 0], s = e.nearest !== void 0 ? e.nearest : !1;
3486
+ let o;
3487
+ e.minResolution !== void 0 ? o = e.minResolution : e.maxZoom !== void 0 ? o = this.getResolutionForZoom(e.maxZoom) : o = 0;
3488
+ const u = this.rotatedExtentForGeometry(t);
3489
+ let a = this.getResolutionForExtentInternal(u, [
3490
+ i[0] - r[1] - r[3],
3491
+ i[1] - r[0] - r[2]
3492
+ ]);
3493
+ a = isNaN(a) ? o : Math.max(a, o), a = this.getConstrainedResolution(a, s ? 0 : 1);
3494
+ const h = this.getRotation(), l = Math.sin(h), c = Math.cos(h), g = L(u);
3495
+ g[0] += (r[1] - r[3]) / 2 * a, g[1] += (r[0] - r[2]) / 2 * a;
3496
+ const f = g[0] * c - g[1] * l, d = g[1] * c + g[0] * l, R = this.getConstrainedCenter([f, d], a), _ = e.callback ? e.callback : me;
3497
+ e.duration !== void 0 ? this.animateInternal(
3498
+ {
3499
+ resolution: a,
3500
+ center: R,
3501
+ duration: e.duration,
3502
+ easing: e.easing
3503
+ },
3504
+ _
3505
+ ) : (this.targetResolution_ = a, this.targetCenter_ = R, this.applyTargetState_(!1, !0), D(_, !0));
3506
+ }
3507
+ /**
3508
+ * Center on coordinate and view position.
3509
+ * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
3510
+ * @param {import("./size.js").Size} size Box pixel size.
3511
+ * @param {import("./pixel.js").Pixel} position Position on the view to center on.
3512
+ * @api
3513
+ */
3514
+ centerOn(t, e, i) {
3515
+ this.centerOnInternal(
3516
+ w(t, this.getProjection()),
3517
+ e,
3518
+ i
3519
+ );
3520
+ }
3521
+ /**
3522
+ * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
3523
+ * @param {import("./size.js").Size} size Box pixel size.
3524
+ * @param {import("./pixel.js").Pixel} position Position on the view to center on.
3525
+ */
3526
+ centerOnInternal(t, e, i) {
3527
+ this.setCenterInternal(
3528
+ st(
3529
+ t,
3530
+ e,
3531
+ i,
3532
+ this.getResolution(),
3533
+ this.getRotation()
3534
+ )
3535
+ );
3536
+ }
3537
+ /**
3538
+ * Calculates the shift between map and viewport center.
3539
+ * @param {import("./coordinate.js").Coordinate} center Center.
3540
+ * @param {number} resolution Resolution.
3541
+ * @param {number} rotation Rotation.
3542
+ * @param {import("./size.js").Size} size Size.
3543
+ * @return {Array<number>|undefined} Center shift.
3544
+ */
3545
+ calculateCenterShift(t, e, i, r) {
3546
+ let s;
3547
+ const o = this.padding_;
3548
+ if (o && t) {
3549
+ const u = this.getViewportSizeMinusPadding_(-i), a = st(
3550
+ t,
3551
+ r,
3552
+ [u[0] / 2 + o[3], u[1] / 2 + o[0]],
3553
+ e,
3554
+ i
3555
+ );
3556
+ s = [
3557
+ t[0] - a[0],
3558
+ t[1] - a[1]
3559
+ ];
3560
+ }
3561
+ return s;
3562
+ }
3563
+ /**
3564
+ * @return {boolean} Is defined.
3565
+ */
3566
+ isDef() {
3567
+ return !!this.getCenterInternal() && this.getResolution() !== void 0;
3568
+ }
3569
+ /**
3570
+ * Adds relative coordinates to the center of the view. Any extent constraint will apply.
3571
+ * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
3572
+ * @api
3573
+ */
3574
+ adjustCenter(t) {
3575
+ const e = Pt(this.targetCenter_, this.getProjection());
3576
+ this.setCenter([
3577
+ e[0] + t[0],
3578
+ e[1] + t[1]
3579
+ ]);
3580
+ }
3581
+ /**
3582
+ * Adds relative coordinates to the center of the view. Any extent constraint will apply.
3583
+ * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
3584
+ */
3585
+ adjustCenterInternal(t) {
3586
+ const e = this.targetCenter_;
3587
+ this.setCenterInternal([
3588
+ e[0] + t[0],
3589
+ e[1] + t[1]
3590
+ ]);
3591
+ }
3592
+ /**
3593
+ * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
3594
+ * constraint will apply.
3595
+ * @param {number} ratio The ratio to apply on the view resolution.
3596
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
3597
+ * @api
3598
+ */
3599
+ adjustResolution(t, e) {
3600
+ e = e && w(e, this.getProjection()), this.adjustResolutionInternal(t, e);
3601
+ }
3602
+ /**
3603
+ * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
3604
+ * constraint will apply.
3605
+ * @param {number} ratio The ratio to apply on the view resolution.
3606
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
3607
+ */
3608
+ adjustResolutionInternal(t, e) {
3609
+ const i = this.getAnimating() || this.getInteracting(), r = this.getViewportSize_(this.getRotation()), s = this.constraints_.resolution(
3610
+ this.targetResolution_ * t,
3611
+ 0,
3612
+ r,
3613
+ i
3614
+ );
3615
+ e && (this.targetCenter_ = this.calculateCenterZoom(s, e)), this.targetResolution_ *= t, this.applyTargetState_();
3616
+ }
3617
+ /**
3618
+ * Adds a value to the view zoom level, optionally using an anchor. Any resolution
3619
+ * constraint will apply.
3620
+ * @param {number} delta Relative value to add to the zoom level.
3621
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
3622
+ * @api
3623
+ */
3624
+ adjustZoom(t, e) {
3625
+ this.adjustResolution(Math.pow(this.zoomFactor_, -t), e);
3626
+ }
3627
+ /**
3628
+ * Adds a value to the view rotation, optionally using an anchor. Any rotation
3629
+ * constraint will apply.
3630
+ * @param {number} delta Relative value to add to the zoom rotation, in radians.
3631
+ * @param {import("./coordinate.js").Coordinate} [anchor] The rotation center.
3632
+ * @api
3633
+ */
3634
+ adjustRotation(t, e) {
3635
+ e && (e = w(e, this.getProjection())), this.adjustRotationInternal(t, e);
3636
+ }
3637
+ /**
3638
+ * @param {number} delta Relative value to add to the zoom rotation, in radians.
3639
+ * @param {import("./coordinate.js").Coordinate} [anchor] The rotation center.
3640
+ */
3641
+ adjustRotationInternal(t, e) {
3642
+ const i = this.getAnimating() || this.getInteracting(), r = this.constraints_.rotation(
3643
+ this.targetRotation_ + t,
3644
+ i
3645
+ );
3646
+ e && (this.targetCenter_ = this.calculateCenterRotate(r, e)), this.targetRotation_ += t, this.applyTargetState_();
3647
+ }
3648
+ /**
3649
+ * Set the center of the current view. Any extent constraint will apply.
3650
+ * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
3651
+ * @observable
3652
+ * @api
3653
+ */
3654
+ setCenter(t) {
3655
+ this.setCenterInternal(
3656
+ t && w(t, this.getProjection())
3657
+ );
3658
+ }
3659
+ /**
3660
+ * Set the center using the view projection (not the user projection).
3661
+ * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
3662
+ */
3663
+ setCenterInternal(t) {
3664
+ this.targetCenter_ = t, this.applyTargetState_();
3665
+ }
3666
+ /**
3667
+ * @param {import("./ViewHint.js").default} hint Hint.
3668
+ * @param {number} delta Delta.
3669
+ * @return {number} New value.
3670
+ */
3671
+ setHint(t, e) {
3672
+ return this.hints_[t] += e, this.changed(), this.hints_[t];
3673
+ }
3674
+ /**
3675
+ * Set the resolution for this view. Any resolution constraint will apply.
3676
+ * @param {number|undefined} resolution The resolution of the view.
3677
+ * @observable
3678
+ * @api
3679
+ */
3680
+ setResolution(t) {
3681
+ this.targetResolution_ = t, this.applyTargetState_();
3682
+ }
3683
+ /**
3684
+ * Set the rotation for this view. Any rotation constraint will apply.
3685
+ * @param {number} rotation The rotation of the view in radians.
3686
+ * @observable
3687
+ * @api
3688
+ */
3689
+ setRotation(t) {
3690
+ this.targetRotation_ = t, this.applyTargetState_();
3691
+ }
3692
+ /**
3693
+ * Zoom to a specific zoom level. Any resolution constrain will apply.
3694
+ * @param {number} zoom Zoom level.
3695
+ * @api
3696
+ */
3697
+ setZoom(t) {
3698
+ this.setResolution(this.getResolutionForZoom(t));
3699
+ }
3700
+ /**
3701
+ * Recompute rotation/resolution/center based on target values.
3702
+ * Note: we have to compute rotation first, then resolution and center considering that
3703
+ * parameters can influence one another in case a view extent constraint is present.
3704
+ * @param {boolean} [doNotCancelAnims] Do not cancel animations.
3705
+ * @param {boolean} [forceMoving] Apply constraints as if the view is moving.
3706
+ * @private
3707
+ */
3708
+ applyTargetState_(t, e) {
3709
+ const i = this.getAnimating() || this.getInteracting() || e, r = this.constraints_.rotation(
3710
+ this.targetRotation_,
3711
+ i
3712
+ ), s = this.getViewportSize_(r), o = this.constraints_.resolution(
3713
+ this.targetResolution_,
3714
+ 0,
3715
+ s,
3716
+ i
3717
+ ), u = this.constraints_.center(
3718
+ this.targetCenter_,
3719
+ o,
3720
+ s,
3721
+ i,
3722
+ this.calculateCenterShift(
3723
+ this.targetCenter_,
3724
+ o,
3725
+ r,
3726
+ s
3727
+ )
3728
+ );
3729
+ this.get(I.ROTATION) !== r && this.set(I.ROTATION, r), this.get(I.RESOLUTION) !== o && (this.set(I.RESOLUTION, o), this.set("zoom", this.getZoom(), !0)), (!u || !this.get(I.CENTER) || !B(this.get(I.CENTER), u)) && this.set(I.CENTER, u), this.getAnimating() && !t && this.cancelAnimations(), this.cancelAnchor_ = void 0;
3730
+ }
3731
+ /**
3732
+ * If any constraints need to be applied, an animation will be triggered.
3733
+ * This is typically done on interaction end.
3734
+ * Note: calling this with a duration of 0 will apply the constrained values straight away,
3735
+ * without animation.
3736
+ * @param {number} [duration] The animation duration in ms.
3737
+ * @param {number} [resolutionDirection] Which direction to zoom.
3738
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
3739
+ */
3740
+ resolveConstraints(t, e, i) {
3741
+ t = t !== void 0 ? t : 200;
3742
+ const r = e || 0, s = this.constraints_.rotation(this.targetRotation_), o = this.getViewportSize_(s), u = this.constraints_.resolution(
3743
+ this.targetResolution_,
3744
+ r,
3745
+ o
3746
+ ), a = this.constraints_.center(
3747
+ this.targetCenter_,
3748
+ u,
3749
+ o,
3750
+ !1,
3751
+ this.calculateCenterShift(
3752
+ this.targetCenter_,
3753
+ u,
3754
+ s,
3755
+ o
3756
+ )
3757
+ );
3758
+ if (t === 0 && !this.cancelAnchor_) {
3759
+ this.targetResolution_ = u, this.targetRotation_ = s, this.targetCenter_ = a, this.applyTargetState_();
3760
+ return;
3761
+ }
3762
+ i = i || (t === 0 ? this.cancelAnchor_ : void 0), this.cancelAnchor_ = void 0, (this.getResolution() !== u || this.getRotation() !== s || !this.getCenterInternal() || !B(this.getCenterInternal(), a)) && (this.getAnimating() && this.cancelAnimations(), this.animateInternal({
3763
+ rotation: s,
3764
+ center: a,
3765
+ resolution: u,
3766
+ duration: t,
3767
+ easing: _n,
3768
+ anchor: i
3769
+ }));
3770
+ }
3771
+ /**
3772
+ * Notify the View that an interaction has started.
3773
+ * The view state will be resolved to a stable one if needed
3774
+ * (depending on its constraints).
3775
+ * @api
3776
+ */
3777
+ beginInteraction() {
3778
+ this.resolveConstraints(0), this.setHint(P.INTERACTING, 1);
3779
+ }
3780
+ /**
3781
+ * Notify the View that an interaction has ended. The view state will be resolved
3782
+ * to a stable one if needed (depending on its constraints).
3783
+ * @param {number} [duration] Animation duration in ms.
3784
+ * @param {number} [resolutionDirection] Which direction to zoom.
3785
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
3786
+ * @api
3787
+ */
3788
+ endInteraction(t, e, i) {
3789
+ i = i && w(i, this.getProjection()), this.endInteractionInternal(t, e, i);
3790
+ }
3791
+ /**
3792
+ * Notify the View that an interaction has ended. The view state will be resolved
3793
+ * to a stable one if needed (depending on its constraints).
3794
+ * @param {number} [duration] Animation duration in ms.
3795
+ * @param {number} [resolutionDirection] Which direction to zoom.
3796
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
3797
+ */
3798
+ endInteractionInternal(t, e, i) {
3799
+ this.getInteracting() && (this.setHint(P.INTERACTING, -1), this.resolveConstraints(t, e, i));
3800
+ }
3801
+ /**
3802
+ * Get a valid position for the view center according to the current constraints.
3803
+ * @param {import("./coordinate.js").Coordinate|undefined} targetCenter Target center position.
3804
+ * @param {number} [targetResolution] Target resolution. If not supplied, the current one will be used.
3805
+ * This is useful to guess a valid center position at a different zoom level.
3806
+ * @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
3807
+ */
3808
+ getConstrainedCenter(t, e) {
3809
+ const i = this.getViewportSize_(this.getRotation());
3810
+ return this.constraints_.center(
3811
+ t,
3812
+ e || this.getResolution(),
3813
+ i
3814
+ );
3815
+ }
3816
+ /**
3817
+ * Get a valid zoom level according to the current view constraints.
3818
+ * @param {number|undefined} targetZoom Target zoom.
3819
+ * @param {number} [direction=0] Indicate which resolution should be used
3820
+ * by a renderer if the view resolution does not match any resolution of the tile source.
3821
+ * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
3822
+ * will be used. If -1, the nearest higher resolution will be used.
3823
+ * @return {number|undefined} Valid zoom level.
3824
+ */
3825
+ getConstrainedZoom(t, e) {
3826
+ const i = this.getResolutionForZoom(t);
3827
+ return this.getZoomForResolution(
3828
+ this.getConstrainedResolution(i, e)
3829
+ );
3830
+ }
3831
+ /**
3832
+ * Get a valid resolution according to the current view constraints.
3833
+ * @param {number|undefined} targetResolution Target resolution.
3834
+ * @param {number} [direction=0] Indicate which resolution should be used
3835
+ * by a renderer if the view resolution does not match any resolution of the tile source.
3836
+ * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
3837
+ * will be used. If -1, the nearest higher resolution will be used.
3838
+ * @return {number|undefined} Valid resolution.
3839
+ */
3840
+ getConstrainedResolution(t, e) {
3841
+ e = e || 0;
3842
+ const i = this.getViewportSize_(this.getRotation());
3843
+ return this.constraints_.resolution(t, e, i);
3844
+ }
3845
+ }
3846
+ function D(n, t) {
3847
+ setTimeout(function() {
3848
+ n(t);
3849
+ }, 0);
3850
+ }
3851
+ function On(n) {
3852
+ if (n.extent !== void 0) {
3853
+ const e = n.smoothExtentConstraint !== void 0 ? n.smoothExtentConstraint : !0;
3854
+ return Nt(n.extent, n.constrainOnlyCenter, e);
3855
+ }
3856
+ const t = ct(n.projection, "EPSG:3857");
3857
+ if (n.multiWorld !== !0 && t.isGlobal()) {
3858
+ const e = t.getExtent().slice();
3859
+ return e[0] = -1 / 0, e[2] = 1 / 0, Nt(e, !1, !1);
3860
+ }
3861
+ return ln;
3862
+ }
3863
+ function xn(n) {
3864
+ let t, e, i, o = n.minZoom !== void 0 ? n.minZoom : rt, u = n.maxZoom !== void 0 ? n.maxZoom : 28;
3865
+ const a = n.zoomFactor !== void 0 ? n.zoomFactor : 2, h = n.multiWorld !== void 0 ? n.multiWorld : !1, l = n.smoothResolutionConstraint !== void 0 ? n.smoothResolutionConstraint : !0, c = n.showFullExtent !== void 0 ? n.showFullExtent : !1, g = ct(n.projection, "EPSG:3857"), f = g.getExtent();
3866
+ let d = n.constrainOnlyCenter, R = n.extent;
3867
+ if (!h && !R && g.isGlobal() && (d = !1, R = f), n.resolutions !== void 0) {
3868
+ const _ = n.resolutions;
3869
+ e = _[o], i = _[u] !== void 0 ? _[u] : _[_.length - 1], n.constrainResolution ? t = hn(
3870
+ _,
3871
+ l,
3872
+ !d && R,
3873
+ c
3874
+ ) : t = Ot(
3875
+ e,
3876
+ i,
3877
+ l,
3878
+ !d && R,
3879
+ c
3880
+ );
3881
+ } else {
3882
+ const M = (f ? Math.max(A(f), X(f)) : (
3883
+ // use an extent that can fit the whole world if need be
3884
+ 360 * vt.degrees / g.getMetersPerUnit()
3885
+ )) / un / Math.pow(2, rt), y = M / Math.pow(2, 28 - rt);
3886
+ e = n.maxResolution, e !== void 0 ? o = 0 : e = M / Math.pow(a, o), i = n.minResolution, i === void 0 && (n.maxZoom !== void 0 ? n.maxResolution !== void 0 ? i = e / Math.pow(a, u) : i = M / Math.pow(a, u) : i = y), u = o + Math.floor(
3887
+ Math.log(e / i) / Math.log(a)
3888
+ ), i = e / Math.pow(a, u - o), n.constrainResolution ? t = cn(
3889
+ a,
3890
+ e,
3891
+ i,
3892
+ l,
3893
+ !d && R,
3894
+ c
3895
+ ) : t = Ot(
3896
+ e,
3897
+ i,
3898
+ l,
3899
+ !d && R,
3900
+ c
3901
+ );
3902
+ }
3903
+ return {
3904
+ constraint: t,
3905
+ maxResolution: e,
3906
+ minResolution: i,
3907
+ minZoom: o,
3908
+ zoomFactor: a
3909
+ };
3910
+ }
3911
+ function Fn(n) {
3912
+ if (n.enableRotation !== void 0 ? n.enableRotation : !0) {
3913
+ const e = n.constrainRotation;
3914
+ return e === void 0 || e === !0 ? dn() : e === !1 ? xt : typeof e == "number" ? fn(e) : xt;
3915
+ }
3916
+ return gn;
3917
+ }
3918
+ function Zn(n) {
3919
+ return !(n.sourceCenter && n.targetCenter && !B(n.sourceCenter, n.targetCenter) || n.sourceResolution !== n.targetResolution || n.sourceRotation !== n.targetRotation);
3920
+ }
3921
+ function st(n, t, e, i, r) {
3922
+ const s = Math.cos(-r);
3923
+ let o = Math.sin(-r), u = n[0] * s - n[1] * o, a = n[1] * s + n[0] * o;
3924
+ u += (t[0] / 2 - e[0]) * i, a += (e[1] - t[1] / 2) * i, o = -o;
3925
+ const h = u * s - a * o, l = a * s + u * o;
3926
+ return [h, l];
3927
+ }
3928
+ class Ii extends on {
3929
+ /**
3930
+ * @param {Options<SourceType>} options Layer options.
3931
+ */
3932
+ constructor(t) {
3933
+ const e = Object.assign({}, t);
3934
+ delete e.source, super(e), this.on, this.once, this.un, this.mapPrecomposeKey_ = null, this.mapRenderKey_ = null, this.sourceChangeKey_ = null, this.renderer_ = null, this.sourceReady_ = !1, this.rendered = !1, t.render && (this.render = t.render), t.map && this.setMap(t.map), this.addChangeListener(
3935
+ m.SOURCE,
3936
+ this.handleSourcePropertyChange_
3937
+ );
3938
+ const i = t.source ? (
3939
+ /** @type {SourceType} */
3940
+ t.source
3941
+ ) : null;
3942
+ this.setSource(i);
3943
+ }
3944
+ /**
3945
+ * @param {Array<import("./Layer.js").default>} [array] Array of layers (to be modified in place).
3946
+ * @return {Array<import("./Layer.js").default>} Array of layers.
3947
+ */
3948
+ getLayersArray(t) {
3949
+ return t = t || [], t.push(this), t;
3950
+ }
3951
+ /**
3952
+ * @param {Array<import("./Layer.js").State>} [states] Optional list of layer states (to be modified in place).
3953
+ * @return {Array<import("./Layer.js").State>} List of layer states.
3954
+ */
3955
+ getLayerStatesArray(t) {
3956
+ return t = t || [], t.push(this.getLayerState()), t;
3957
+ }
3958
+ /**
3959
+ * Get the layer source.
3960
+ * @return {SourceType|null} The layer source (or `null` if not yet set).
3961
+ * @observable
3962
+ * @api
3963
+ */
3964
+ getSource() {
3965
+ return (
3966
+ /** @type {SourceType} */
3967
+ this.get(m.SOURCE) || null
3968
+ );
3969
+ }
3970
+ /**
3971
+ * @return {SourceType|null} The source being rendered.
3972
+ */
3973
+ getRenderSource() {
3974
+ return this.getSource();
3975
+ }
3976
+ /**
3977
+ * @return {import("../source/Source.js").State} Source state.
3978
+ */
3979
+ getSourceState() {
3980
+ const t = this.getSource();
3981
+ return t ? t.getState() : "undefined";
3982
+ }
3983
+ /**
3984
+ * @private
3985
+ */
3986
+ handleSourceChange_() {
3987
+ this.changed(), !(this.sourceReady_ || this.getSource().getState() !== "ready") && (this.sourceReady_ = !0, this.dispatchEvent("sourceready"));
3988
+ }
3989
+ /**
3990
+ * @private
3991
+ */
3992
+ handleSourcePropertyChange_() {
3993
+ this.sourceChangeKey_ && (nt(this.sourceChangeKey_), this.sourceChangeKey_ = null), this.sourceReady_ = !1;
3994
+ const t = this.getSource();
3995
+ t && (this.sourceChangeKey_ = it(
3996
+ t,
3997
+ Ct.CHANGE,
3998
+ this.handleSourceChange_,
3999
+ this
4000
+ ), t.getState() === "ready" && (this.sourceReady_ = !0, setTimeout(() => {
4001
+ this.dispatchEvent("sourceready");
4002
+ }, 0))), this.changed();
4003
+ }
4004
+ /**
4005
+ * @param {import("../pixel").Pixel} pixel Pixel.
4006
+ * @return {Promise<Array<import("../Feature").FeatureLike>>} Promise that resolves with
4007
+ * an array of features.
4008
+ */
4009
+ getFeatures(t) {
4010
+ return this.renderer_ ? this.renderer_.getFeatures(t) : Promise.resolve([]);
4011
+ }
4012
+ /**
4013
+ * @param {import("../pixel").Pixel} pixel Pixel.
4014
+ * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data.
4015
+ */
4016
+ getData(t) {
4017
+ return !this.renderer_ || !this.rendered ? null : this.renderer_.getData(t);
4018
+ }
4019
+ /**
4020
+ * The layer is visible on the map view, i.e. within its min/max resolution or zoom and
4021
+ * extent, not set to `visible: false`, and not inside a layer group that is set
4022
+ * to `visible: false`.
4023
+ * @param {View|import("../View.js").ViewStateLayerStateExtent} [view] View or {@link import("../Map.js").FrameState}.
4024
+ * Only required when the layer is not added to a map.
4025
+ * @return {boolean} The layer is visible in the map view.
4026
+ * @api
4027
+ */
4028
+ isVisible(t) {
4029
+ let e;
4030
+ const i = this.getMapInternal();
4031
+ !t && i && (t = i.getView()), t instanceof Gt ? e = {
4032
+ viewState: t.getState(),
4033
+ extent: t.calculateExtent()
4034
+ } : e = t, !e.layerStatesArray && i && (e.layerStatesArray = i.getLayerGroup().getLayerStatesArray());
4035
+ let r;
4036
+ e.layerStatesArray ? r = e.layerStatesArray.find(
4037
+ (o) => o.layer === this
4038
+ ) : r = this.getLayerState();
4039
+ const s = this.getExtent();
4040
+ return bn(r, e.viewState) && (!s || lt(s, e.extent));
4041
+ }
4042
+ /**
4043
+ * Get the attributions of the source of this layer for the given view.
4044
+ * @param {View|import("../View.js").ViewStateLayerStateExtent} [view] View or {@link import("../Map.js").FrameState}.
4045
+ * Only required when the layer is not added to a map.
4046
+ * @return {Array<string>} Attributions for this layer at the given view.
4047
+ * @api
4048
+ */
4049
+ getAttributions(t) {
4050
+ if (!this.isVisible(t))
4051
+ return [];
4052
+ let e;
4053
+ const i = this.getSource();
4054
+ if (i && (e = i.getAttributions()), !e)
4055
+ return [];
4056
+ const r = t instanceof Gt ? t.getViewStateAndExtent() : t;
4057
+ let s = e(r);
4058
+ return Array.isArray(s) || (s = [s]), s;
4059
+ }
4060
+ /**
4061
+ * In charge to manage the rendering of the layer. One layer type is
4062
+ * bounded with one layer renderer.
4063
+ * @param {?import("../Map.js").FrameState} frameState Frame state.
4064
+ * @param {HTMLElement} target Target which the renderer may (but need not) use
4065
+ * for rendering its content.
4066
+ * @return {HTMLElement|null} The rendered element.
4067
+ */
4068
+ render(t, e) {
4069
+ const i = this.getRenderer();
4070
+ return i.prepareFrame(t) ? (this.rendered = !0, i.renderFrame(t, e)) : null;
4071
+ }
4072
+ /**
4073
+ * Called when a layer is not visible during a map render.
4074
+ */
4075
+ unrender() {
4076
+ this.rendered = !1;
4077
+ }
4078
+ /**
4079
+ * For use inside the library only.
4080
+ * @param {import("../Map.js").default|null} map Map.
4081
+ */
4082
+ setMapInternal(t) {
4083
+ t || this.unrender(), this.set(m.MAP, t);
4084
+ }
4085
+ /**
4086
+ * For use inside the library only.
4087
+ * @return {import("../Map.js").default|null} Map.
4088
+ */
4089
+ getMapInternal() {
4090
+ return this.get(m.MAP);
4091
+ }
4092
+ /**
4093
+ * Sets the layer to be rendered on top of other layers on a map. The map will
4094
+ * not manage this layer in its layers collection. This
4095
+ * is useful for temporary layers. To remove an unmanaged layer from the map,
4096
+ * use `#setMap(null)`.
4097
+ *
4098
+ * To add the layer to a map and have it managed by the map, use
4099
+ * {@link module:ol/Map~Map#addLayer} instead.
4100
+ * @param {import("../Map.js").default|null} map Map.
4101
+ * @api
4102
+ */
4103
+ setMap(t) {
4104
+ this.mapPrecomposeKey_ && (nt(this.mapPrecomposeKey_), this.mapPrecomposeKey_ = null), t || this.changed(), this.mapRenderKey_ && (nt(this.mapRenderKey_), this.mapRenderKey_ = null), t && (this.mapPrecomposeKey_ = it(
4105
+ t,
4106
+ an.PRECOMPOSE,
4107
+ function(e) {
4108
+ const r = /** @type {import("../render/Event.js").default} */ e.frameState.layerStatesArray, s = this.getLayerState(!1);
4109
+ p(
4110
+ !r.some(function(o) {
4111
+ return o.layer === s.layer;
4112
+ }),
4113
+ 67
4114
+ ), r.push(s);
4115
+ },
4116
+ this
4117
+ ), this.mapRenderKey_ = it(this, Ct.CHANGE, t.render, t), this.changed());
4118
+ }
4119
+ /**
4120
+ * Set the layer source.
4121
+ * @param {SourceType|null} source The layer source.
4122
+ * @observable
4123
+ * @api
4124
+ */
4125
+ setSource(t) {
4126
+ this.set(m.SOURCE, t);
4127
+ }
4128
+ /**
4129
+ * Get the renderer for this layer.
4130
+ * @return {RendererType|null} The layer renderer.
4131
+ */
4132
+ getRenderer() {
4133
+ return this.renderer_ || (this.renderer_ = this.createRenderer()), this.renderer_;
4134
+ }
4135
+ /**
4136
+ * @return {boolean} The layer has a renderer.
4137
+ */
4138
+ hasRenderer() {
4139
+ return !!this.renderer_;
4140
+ }
4141
+ /**
4142
+ * Create a renderer for this layer.
4143
+ * @return {RendererType} A layer renderer.
4144
+ * @protected
4145
+ */
4146
+ createRenderer() {
4147
+ return null;
4148
+ }
4149
+ /**
4150
+ * Clean up.
4151
+ */
4152
+ disposeInternal() {
4153
+ this.renderer_ && (this.renderer_.dispose(), delete this.renderer_), this.setSource(null), super.disposeInternal();
4154
+ }
4155
+ }
4156
+ function bn(n, t) {
4157
+ if (!n.visible)
4158
+ return !1;
4159
+ const e = t.resolution;
4160
+ if (e < n.minResolution || e >= n.maxResolution)
4161
+ return !1;
4162
+ const i = t.zoom;
4163
+ return i > n.minZoom && i <= n.maxZoom;
4164
+ }
4165
+ class Si extends H {
4166
+ /**
4167
+ * @param {Options} options Source options.
4168
+ */
4169
+ constructor(t) {
4170
+ super(), this.projection = T(t.projection), this.attributions_ = jt(t.attributions), this.attributionsCollapsible_ = t.attributionsCollapsible !== void 0 ? t.attributionsCollapsible : !0, this.loading = !1, this.state_ = t.state !== void 0 ? t.state : "ready", this.wrapX_ = t.wrapX !== void 0 ? t.wrapX : !1, this.interpolate_ = !!t.interpolate, this.viewResolver = null, this.viewRejector = null;
4171
+ const e = this;
4172
+ this.viewPromise_ = new Promise(function(i, r) {
4173
+ e.viewResolver = i, e.viewRejector = r;
4174
+ });
4175
+ }
4176
+ /**
4177
+ * Get the attribution function for the source.
4178
+ * @return {?Attribution} Attribution function.
4179
+ * @api
4180
+ */
4181
+ getAttributions() {
4182
+ return this.attributions_;
4183
+ }
4184
+ /**
4185
+ * @return {boolean} Attributions are collapsible.
4186
+ * @api
4187
+ */
4188
+ getAttributionsCollapsible() {
4189
+ return this.attributionsCollapsible_;
4190
+ }
4191
+ /**
4192
+ * Get the projection of the source.
4193
+ * @return {import("../proj/Projection.js").default|null} Projection.
4194
+ * @api
4195
+ */
4196
+ getProjection() {
4197
+ return this.projection;
4198
+ }
4199
+ /**
4200
+ * @param {import("../proj/Projection").default} [projection] Projection.
4201
+ * @return {Array<number>|null} Resolutions.
4202
+ */
4203
+ getResolutions(t) {
4204
+ return null;
4205
+ }
4206
+ /**
4207
+ * @return {Promise<import("../View.js").ViewOptions>} A promise for view-related properties.
4208
+ */
4209
+ getView() {
4210
+ return this.viewPromise_;
4211
+ }
4212
+ /**
4213
+ * Get the state of the source, see {@link import("./Source.js").State} for possible states.
4214
+ * @return {import("./Source.js").State} State.
4215
+ * @api
4216
+ */
4217
+ getState() {
4218
+ return this.state_;
4219
+ }
4220
+ /**
4221
+ * @return {boolean|undefined} Wrap X.
4222
+ */
4223
+ getWrapX() {
4224
+ return this.wrapX_;
4225
+ }
4226
+ /**
4227
+ * @return {boolean} Use linear interpolation when resampling.
4228
+ */
4229
+ getInterpolate() {
4230
+ return this.interpolate_;
4231
+ }
4232
+ /**
4233
+ * Refreshes the source. The source will be cleared, and data from the server will be reloaded.
4234
+ * @api
4235
+ */
4236
+ refresh() {
4237
+ this.changed();
4238
+ }
4239
+ /**
4240
+ * Set the attributions of the source.
4241
+ * @param {AttributionLike|undefined} attributions Attributions.
4242
+ * Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution},
4243
+ * or `undefined`.
4244
+ * @api
4245
+ */
4246
+ setAttributions(t) {
4247
+ this.attributions_ = jt(t), this.changed();
4248
+ }
4249
+ /**
4250
+ * Set the state of the source.
4251
+ * @param {import("./Source.js").State} state State.
4252
+ */
4253
+ setState(t) {
4254
+ this.state_ = t, this.changed();
4255
+ }
4256
+ }
4257
+ function jt(n) {
4258
+ return n ? Array.isArray(n) ? function(t) {
4259
+ return n;
4260
+ } : typeof n == "function" ? n : function(t) {
4261
+ return [n];
4262
+ } : null;
4263
+ }
4264
+ export {
4265
+ lt as $,
4266
+ _n as A,
4267
+ on as B,
4268
+ oi as C,
4269
+ Kn as D,
4270
+ Ke as E,
4271
+ gn as F,
4272
+ en as G,
4273
+ ni as H,
4274
+ P as I,
4275
+ Ge as J,
4276
+ tt as K,
4277
+ Ii as L,
4278
+ Yn as M,
4279
+ Q as N,
4280
+ Ln as O,
4281
+ _t as P,
4282
+ qe as Q,
4283
+ an as R,
4284
+ Si as S,
4285
+ Le as T,
4286
+ ve as U,
4287
+ Gt as V,
4288
+ Xe as W,
4289
+ be as X,
4290
+ Rn as Y,
4291
+ q as Z,
4292
+ Un as _,
4293
+ ti as a,
4294
+ xe as a0,
4295
+ zn as a1,
4296
+ X as a2,
4297
+ L as a3,
4298
+ Ze as a4,
4299
+ Hn as a5,
4300
+ vn as a6,
4301
+ je as a7,
4302
+ si as a8,
4303
+ T as a9,
4304
+ gi as aA,
4305
+ yi as aB,
4306
+ hi as aC,
4307
+ En as aD,
4308
+ J as aE,
4309
+ Sn as aF,
4310
+ yn as aG,
4311
+ Dn as aH,
4312
+ Te as aI,
4313
+ De as aJ,
4314
+ pt as aK,
4315
+ C as aL,
4316
+ F as aM,
4317
+ Bt as aN,
4318
+ ei as aO,
4319
+ ai as aP,
4320
+ ii as aQ,
4321
+ Ve as aR,
4322
+ $n as aS,
4323
+ Qn as aa,
4324
+ Rt as ab,
4325
+ zt as ac,
4326
+ qt as ad,
4327
+ $t as ae,
4328
+ wn as af,
4329
+ ie as ag,
4330
+ ee as ah,
4331
+ yt as ai,
4332
+ Qt as aj,
4333
+ Ht as ak,
4334
+ Jt as al,
4335
+ re as am,
4336
+ ci as an,
4337
+ mi as ao,
4338
+ te as ap,
4339
+ Ut as aq,
4340
+ Oe as ar,
4341
+ ui as as,
4342
+ li as at,
4343
+ Ri as au,
4344
+ di as av,
4345
+ Ci as aw,
4346
+ fi as ax,
4347
+ _i as ay,
4348
+ Mi as az,
4349
+ Jn as b,
4350
+ Gn as c,
4351
+ Ne as d,
4352
+ kn as e,
4353
+ w as f,
4354
+ B as g,
4355
+ Pt as h,
4356
+ V as i,
4357
+ Qe as j,
4358
+ jn as k,
4359
+ We as l,
4360
+ Bn as m,
4361
+ Zt as n,
4362
+ Y as o,
4363
+ $ as p,
4364
+ Wn as q,
4365
+ Ei as r,
4366
+ Dt as s,
4367
+ kt as t,
4368
+ rn as u,
4369
+ ri as v,
4370
+ qn as w,
4371
+ A as x,
4372
+ bn as y,
4373
+ Vn as z
4374
+ };