@hybridcore/ui 1.6.13 → 1.6.16

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