@datagouv/components-next 0.2.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +1 -1
  2. package/assets/main.css +49 -22
  3. package/dist/Control-BNCDn-8E.js +148 -0
  4. package/dist/{Datafair.client-x39O4yfF.js → Datafair.client-B5lBpOl8.js} +2 -2
  5. package/dist/Event-BOgJUhNR.js +738 -0
  6. package/dist/Image-BN-4XkIn.js +247 -0
  7. package/dist/{JsonPreview.client-BMsC5JcY.js → JsonPreview.client-Doz1Z0BS.js} +23 -23
  8. package/dist/Map-BdT3i2C4.js +7609 -0
  9. package/dist/MapContainer.client-oiieO8H-.js +105 -0
  10. package/dist/OSM-CamriM9b.js +71 -0
  11. package/dist/PdfPreview.client-CdAhkDFJ.js +14513 -0
  12. package/dist/{Pmtiles.client-BaiIo4VZ.js → Pmtiles.client-B0v8tGJQ.js} +3 -3
  13. package/dist/ScaleLine-BiesrgOv.js +165 -0
  14. package/dist/Swagger.client-CsK65JnG.js +4 -0
  15. package/dist/Tile-DCuqwNOI.js +1206 -0
  16. package/dist/TileImage-CmZf8EdU.js +1067 -0
  17. package/dist/View-DcDc7N2K.js +2858 -0
  18. package/dist/{XmlPreview.client-CAdN0w_Y.js → XmlPreview.client-CrjHf74q.js} +17 -17
  19. package/dist/common-C4rDcQpp.js +243 -0
  20. package/dist/components-next.css +1 -1
  21. package/dist/components-next.js +158 -117
  22. package/dist/components.css +1 -1
  23. package/dist/{MapContainer.client-DeSo8EvG.js → index-Bbu9rOHt.js} +4975 -21416
  24. package/dist/leaflet-src-7m1mB8LI.js +6338 -0
  25. package/dist/{main-Dgri3TQL.js → main-CiH8ZmBI.js} +56973 -51462
  26. package/dist/proj-CKwYjU38.js +1569 -0
  27. package/dist/tilecoord-YW3qEH_j.js +884 -0
  28. package/dist/{vue3-xml-viewer.common-D6skc_Ai.js → vue3-xml-viewer.common-Bi_bsV6C.js} +1 -1
  29. package/package.json +6 -2
  30. package/src/components/ActivityList/ActivityList.vue +6 -2
  31. package/src/components/AppLink.vue +4 -1
  32. package/src/components/Avatar.vue +2 -2
  33. package/src/components/AvatarWithName.vue +8 -4
  34. package/src/components/BouncingDots.vue +21 -0
  35. package/src/components/BrandedButton.vue +2 -0
  36. package/src/components/CopyButton.vue +19 -7
  37. package/src/components/DataserviceCard.vue +85 -120
  38. package/src/components/DatasetCard.vue +110 -171
  39. package/src/components/DatasetInformation/DatasetEmbedSection.vue +43 -0
  40. package/src/components/DatasetInformation/DatasetInformationSection.vue +73 -0
  41. package/src/components/DatasetInformation/DatasetSchemaSection.vue +74 -0
  42. package/src/components/DatasetInformation/DatasetSpatialSection.vue +59 -0
  43. package/src/components/DatasetInformation/DatasetTemporalitySection.vue +45 -0
  44. package/src/components/DatasetInformation/index.ts +5 -0
  45. package/src/components/DatasetQuality.vue +23 -16
  46. package/src/components/DatasetQualityInline.vue +13 -17
  47. package/src/components/DatasetQualityScore.vue +12 -15
  48. package/src/components/DatasetQualityTooltipContent.vue +3 -3
  49. package/src/components/DescriptionList.vue +1 -4
  50. package/src/components/DescriptionListDetails.vue +5 -0
  51. package/src/components/DescriptionListTerm.vue +5 -0
  52. package/src/components/DiscussionMessageCard.vue +63 -0
  53. package/src/components/ExtraAccordion.vue +4 -4
  54. package/src/components/Form/BadgeSelect.vue +35 -0
  55. package/src/components/Form/FormatSelect.vue +28 -0
  56. package/src/components/Form/GeozoneSelect.vue +52 -0
  57. package/src/components/Form/GranularitySelect.vue +29 -0
  58. package/src/components/Form/LicenseSelect.vue +30 -0
  59. package/src/components/Form/OrganizationSelect.vue +62 -0
  60. package/src/components/Form/OrganizationTypeSelect.vue +34 -0
  61. package/src/components/Form/ReuseTopicSelect.vue +29 -0
  62. package/src/components/Form/SchemaSelect.vue +30 -0
  63. package/src/components/Form/SearchableSelect.vue +334 -0
  64. package/src/components/Form/SelectGroup.vue +132 -0
  65. package/src/components/Form/TagSelect.vue +38 -0
  66. package/src/components/LeafletMap.vue +31 -0
  67. package/src/components/LicenseBadge.vue +24 -0
  68. package/src/components/LoadingBlock.vue +23 -2
  69. package/src/components/MarkdownViewer.vue +3 -1
  70. package/src/components/ObjectCard.vue +42 -0
  71. package/src/components/ObjectCardBadge.vue +22 -0
  72. package/src/components/ObjectCardHeader.vue +35 -0
  73. package/src/components/ObjectCardOwner.vue +43 -0
  74. package/src/components/ObjectCardShortDescription.vue +28 -0
  75. package/src/components/OrganizationCard.vue +35 -20
  76. package/src/components/OrganizationHorizontalCard.vue +87 -0
  77. package/src/components/OrganizationLogo.vue +1 -1
  78. package/src/components/OrganizationNameWithCertificate.vue +12 -6
  79. package/src/components/OwnerTypeIcon.vue +1 -0
  80. package/src/components/Pagination.vue +1 -1
  81. package/src/components/Placeholder.vue +5 -2
  82. package/src/components/PostCard.vue +62 -0
  83. package/src/components/ProgressBar.vue +31 -0
  84. package/src/components/RadioGroup.vue +32 -0
  85. package/src/components/RadioInput.vue +64 -0
  86. package/src/components/ResourceAccordion/Datafair.client.vue +1 -1
  87. package/src/components/ResourceAccordion/EditButton.vue +2 -3
  88. package/src/components/ResourceAccordion/JsonPreview.client.vue +3 -3
  89. package/src/components/ResourceAccordion/MapContainer.client.vue +21 -17
  90. package/src/components/ResourceAccordion/Metadata.vue +11 -24
  91. package/src/components/ResourceAccordion/PdfPreview.client.vue +70 -74
  92. package/src/components/ResourceAccordion/Pmtiles.client.vue +2 -2
  93. package/src/components/ResourceAccordion/Preview.vue +2 -2
  94. package/src/components/ResourceAccordion/ResourceAccordion.vue +35 -28
  95. package/src/components/ResourceAccordion/ResourceIcon.vue +1 -0
  96. package/src/components/ResourceAccordion/SchemaBadge.vue +2 -2
  97. package/src/components/ResourceAccordion/XmlPreview.client.vue +3 -3
  98. package/src/components/ResourceExplorer/ResourceExplorer.vue +243 -0
  99. package/src/components/ResourceExplorer/ResourceExplorerSidebar.vue +116 -0
  100. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +410 -0
  101. package/src/components/ReuseCard.vue +8 -28
  102. package/src/components/ReuseHorizontalCard.vue +80 -0
  103. package/src/components/Search/BasicAndAdvancedFilters.vue +49 -0
  104. package/src/components/Search/Filter/AccessTypeFilter.vue +37 -0
  105. package/src/components/Search/Filter/DatasetBadgeFilter.vue +40 -0
  106. package/src/components/Search/Filter/FilterButtonGroup.vue +78 -0
  107. package/src/components/Search/Filter/FormatFamilyFilter.vue +39 -0
  108. package/src/components/Search/Filter/LastUpdateRangeFilter.vue +37 -0
  109. package/src/components/Search/Filter/ProducerTypeFilter.vue +49 -0
  110. package/src/components/Search/Filter/ReuseTypeFilter.vue +42 -0
  111. package/src/components/Search/GlobalSearch.vue +707 -0
  112. package/src/components/Search/SearchInput.vue +63 -0
  113. package/src/components/Search/Sidemenu.vue +38 -0
  114. package/src/components/StatBox.vue +5 -5
  115. package/src/components/Tag.vue +30 -0
  116. package/src/components/Toggletip.vue +11 -4
  117. package/src/components/Tooltip.vue +2 -3
  118. package/src/components/TopicCard.vue +134 -0
  119. package/src/components/radioGroupContext.ts +9 -0
  120. package/src/composables/useDebouncedRef.ts +31 -0
  121. package/src/composables/useHasTabularData.ts +15 -0
  122. package/src/composables/useMetrics.ts +4 -3
  123. package/src/composables/useResourceCapabilities.ts +131 -0
  124. package/src/composables/useRouteQueryBoolean.ts +10 -0
  125. package/src/composables/useSelectModelSync.ts +89 -0
  126. package/src/composables/useStableQueryParams.ts +84 -0
  127. package/src/composables/useTranslation.ts +2 -1
  128. package/src/config.ts +4 -0
  129. package/src/functions/api.ts +25 -6
  130. package/src/functions/api.types.ts +5 -3
  131. package/src/functions/datasets.ts +1 -29
  132. package/src/functions/description.ts +33 -0
  133. package/src/functions/helpers.ts +11 -0
  134. package/src/functions/markdown.ts +60 -16
  135. package/src/functions/metrics.ts +33 -0
  136. package/src/functions/organizations.ts +5 -5
  137. package/src/functions/resourceCapabilities.ts +55 -0
  138. package/src/main.ts +96 -7
  139. package/src/types/dataservices.ts +14 -12
  140. package/src/types/datasets.ts +20 -7
  141. package/src/types/discussions.ts +20 -0
  142. package/src/types/licenses.ts +3 -3
  143. package/src/types/organizations.ts +13 -1
  144. package/src/types/owned.ts +4 -2
  145. package/src/types/pages.ts +70 -0
  146. package/src/types/posts.ts +27 -0
  147. package/src/types/resources.ts +16 -0
  148. package/src/types/reuses.ts +14 -5
  149. package/src/types/search.ts +407 -0
  150. package/src/types/users.ts +12 -3
  151. package/dist/PdfPreview.client-COOkEkRA.js +0 -107
  152. package/dist/Swagger.client-CpLgaLg6.js +0 -4
  153. package/dist/pdf-vue3-IkJO65RH.js +0 -273
  154. package/dist/pdf.min-f72cfa08-CdgJTooZ.js +0 -9501
  155. package/src/components/DatasetInformationPanel.vue +0 -211
@@ -0,0 +1,2858 @@
1
+ import { a6 as p, B as it, m as jt, F as Ft, ak as x, s as Tt, aL as Et, C as vt, D as F, aj as q, k as St, w as S, y as j, n as Zt, aM as zt, r as st, A as Pt, z as Xt, a1 as Yt, J as ot, x as bt, L as rt, K as G, al as Gt, aN as L, M as Lt, ae as Y, aa as y, j as E, U as W, aE as Ot, aO as Vt, af as K, t as kt, P as Ut, V as Dt, aP as Ht } from "./proj-CKwYjU38.js";
2
+ import { d as qt, e as Wt, q as at, u as Kt, v as $t, a as N, j as Bt, w as Jt } from "./common-C4rDcQpp.js";
3
+ const I = {
4
+ ANIMATING: 0,
5
+ INTERACTING: 1
6
+ }, M = {
7
+ CENTER: "center",
8
+ RESOLUTION: "resolution",
9
+ ROTATION: "rotation"
10
+ };
11
+ function $(s, t, e) {
12
+ return (
13
+ /**
14
+ * @param {import("./coordinate.js").Coordinate|undefined} center Center.
15
+ * @param {number|undefined} resolution Resolution.
16
+ * @param {import("./size.js").Size} size Viewport size; unused if `onlyCenter` was specified.
17
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
18
+ * @param {Array<number>} [centerShift] Shift between map center and viewport center.
19
+ * @return {import("./coordinate.js").Coordinate|undefined} Center.
20
+ */
21
+ (function(n, i, r, o, l) {
22
+ if (!n)
23
+ return;
24
+ if (!i && !t)
25
+ return n;
26
+ const a = t ? 0 : r[0] * i, c = t ? 0 : r[1] * i, h = l ? l[0] : 0, u = l ? l[1] : 0;
27
+ let g = s[0] + a / 2 + h, d = s[2] - a / 2 + h, f = s[1] + c / 2 + u, R = s[3] - c / 2 + u;
28
+ g > d && (g = (d + g) / 2, d = g), f > R && (f = (R + f) / 2, R = f);
29
+ let _ = p(n[0], g, d), C = p(n[1], f, R);
30
+ if (o && e && i) {
31
+ const m = 30 * i;
32
+ _ += -m * Math.log(1 + Math.max(0, g - n[0]) / m) + m * Math.log(1 + Math.max(0, n[0] - d) / m), C += -m * Math.log(1 + Math.max(0, f - n[1]) / m) + m * Math.log(1 + Math.max(0, n[1] - R) / m);
33
+ }
34
+ return [_, C];
35
+ })
36
+ );
37
+ }
38
+ function Qt(s) {
39
+ return s;
40
+ }
41
+ function lt(s, t, e, n, i, r, o) {
42
+ r = r || [], o = o || 2;
43
+ let l = 0;
44
+ for (let a = t; a < e; a += n) {
45
+ const c = s[a], h = s[a + 1];
46
+ r[l++] = i[0] * c + i[2] * h + i[4], r[l++] = i[1] * c + i[3] * h + i[5];
47
+ for (let u = 2; u < o; u++)
48
+ r[l++] = s[a + u];
49
+ }
50
+ return r && r.length != l && (r.length = l), r;
51
+ }
52
+ function te(s, t, e, n, i, r, o) {
53
+ o = o || [];
54
+ const l = Math.cos(i), a = Math.sin(i), c = r[0], h = r[1];
55
+ let u = 0;
56
+ for (let g = t; g < e; g += n) {
57
+ const d = s[g] - c, f = s[g + 1] - h;
58
+ o[u++] = c + d * l - f * a, o[u++] = h + d * a + f * l;
59
+ for (let R = g + 2; R < g + n; ++R)
60
+ o[u++] = s[R];
61
+ }
62
+ return o && o.length != u && (o.length = u), o;
63
+ }
64
+ function ee(s, t, e, n, i, r, o, l) {
65
+ l = l || [];
66
+ const a = o[0], c = o[1];
67
+ let h = 0;
68
+ for (let u = t; u < e; u += n) {
69
+ const g = s[u] - a, d = s[u + 1] - c;
70
+ l[h++] = a + i * g, l[h++] = c + r * d;
71
+ for (let f = u + 2; f < u + n; ++f)
72
+ l[h++] = s[f];
73
+ }
74
+ return l && l.length != h && (l.length = h), l;
75
+ }
76
+ function ne(s, t, e, n, i, r, o) {
77
+ o = o || [];
78
+ let l = 0;
79
+ for (let a = t; a < e; a += n) {
80
+ o[l++] = s[a] + i, o[l++] = s[a + 1] + r;
81
+ for (let c = a + 2; c < a + n; ++c)
82
+ o[l++] = s[c];
83
+ }
84
+ return o && o.length != l && (o.length = l), o;
85
+ }
86
+ const B = Wt(), ie = [NaN, NaN];
87
+ class se extends it {
88
+ constructor() {
89
+ super(), this.extent_ = jt(), this.extentRevision_ = -1, this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = 0, this.simplifyTransformedInternal = Ft(
90
+ (t, e, n) => {
91
+ if (!n)
92
+ return this.getSimplifiedGeometry(e);
93
+ const i = this.clone();
94
+ return i.applyTransform(n), i.getSimplifiedGeometry(e);
95
+ }
96
+ );
97
+ }
98
+ /**
99
+ * Get a transformed and simplified version of the geometry.
100
+ * @abstract
101
+ * @param {number} squaredTolerance Squared tolerance.
102
+ * @param {import("../proj.js").TransformFunction} [transform] Optional transform function.
103
+ * @return {Geometry} Simplified geometry.
104
+ */
105
+ simplifyTransformed(t, e) {
106
+ return this.simplifyTransformedInternal(
107
+ this.getRevision(),
108
+ t,
109
+ e
110
+ );
111
+ }
112
+ /**
113
+ * Make a complete copy of the geometry.
114
+ * @abstract
115
+ * @return {!Geometry} Clone.
116
+ */
117
+ clone() {
118
+ return x();
119
+ }
120
+ /**
121
+ * @abstract
122
+ * @param {number} x X.
123
+ * @param {number} y Y.
124
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
125
+ * @param {number} minSquaredDistance Minimum squared distance.
126
+ * @return {number} Minimum squared distance.
127
+ */
128
+ closestPointXY(t, e, n, i) {
129
+ return x();
130
+ }
131
+ /**
132
+ * @param {number} x X.
133
+ * @param {number} y Y.
134
+ * @return {boolean} Contains (x, y).
135
+ */
136
+ containsXY(t, e) {
137
+ return this.closestPointXY(t, e, ie, Number.MIN_VALUE) === 0;
138
+ }
139
+ /**
140
+ * Return the closest point of the geometry to the passed point as
141
+ * {@link module:ol/coordinate~Coordinate coordinate}.
142
+ * @param {import("../coordinate.js").Coordinate} point Point.
143
+ * @param {import("../coordinate.js").Coordinate} [closestPoint] Closest point.
144
+ * @return {import("../coordinate.js").Coordinate} Closest point.
145
+ * @api
146
+ */
147
+ getClosestPoint(t, e) {
148
+ return e = e || [NaN, NaN], this.closestPointXY(t[0], t[1], e, 1 / 0), e;
149
+ }
150
+ /**
151
+ * Returns true if this geometry includes the specified coordinate. If the
152
+ * coordinate is on the boundary of the geometry, returns false.
153
+ * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
154
+ * @return {boolean} Contains coordinate.
155
+ * @api
156
+ */
157
+ intersectsCoordinate(t) {
158
+ return this.containsXY(t[0], t[1]);
159
+ }
160
+ /**
161
+ * @abstract
162
+ * @param {import("../extent.js").Extent} extent Extent.
163
+ * @protected
164
+ * @return {import("../extent.js").Extent} extent Extent.
165
+ */
166
+ computeExtent(t) {
167
+ return x();
168
+ }
169
+ /**
170
+ * Get the extent of the geometry.
171
+ * @param {import("../extent.js").Extent} [extent] Extent.
172
+ * @return {import("../extent.js").Extent} extent Extent.
173
+ * @api
174
+ */
175
+ getExtent(t) {
176
+ if (this.extentRevision_ != this.getRevision()) {
177
+ const e = this.computeExtent(this.extent_);
178
+ (isNaN(e[0]) || isNaN(e[1])) && Tt(e), this.extentRevision_ = this.getRevision();
179
+ }
180
+ return Et(this.extent_, t);
181
+ }
182
+ /**
183
+ * Rotate the geometry around a given coordinate. This modifies the geometry
184
+ * coordinates in place.
185
+ * @abstract
186
+ * @param {number} angle Rotation angle in radians.
187
+ * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
188
+ * @api
189
+ */
190
+ rotate(t, e) {
191
+ x();
192
+ }
193
+ /**
194
+ * Scale the geometry (with an optional origin). This modifies the geometry
195
+ * coordinates in place.
196
+ * @abstract
197
+ * @param {number} sx The scaling factor in the x-direction.
198
+ * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
199
+ * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
200
+ * of the geometry extent).
201
+ * @api
202
+ */
203
+ scale(t, e, n) {
204
+ x();
205
+ }
206
+ /**
207
+ * Create a simplified version of this geometry. For linestrings, this uses
208
+ * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)
209
+ * algorithm. For polygons, a quantization-based
210
+ * simplification is used to preserve topology.
211
+ * @param {number} tolerance The tolerance distance for simplification.
212
+ * @return {Geometry} A new, simplified version of the original geometry.
213
+ * @api
214
+ */
215
+ simplify(t) {
216
+ return this.getSimplifiedGeometry(t * t);
217
+ }
218
+ /**
219
+ * Create a simplified version of this geometry using the Douglas Peucker
220
+ * algorithm.
221
+ * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.
222
+ * @abstract
223
+ * @param {number} squaredTolerance Squared tolerance.
224
+ * @return {Geometry} Simplified geometry.
225
+ */
226
+ getSimplifiedGeometry(t) {
227
+ return x();
228
+ }
229
+ /**
230
+ * Get the type of this geometry.
231
+ * @abstract
232
+ * @return {Type} Geometry type.
233
+ */
234
+ getType() {
235
+ return x();
236
+ }
237
+ /**
238
+ * Apply a transform function to the coordinates of the geometry.
239
+ * The geometry is modified in place.
240
+ * If you do not want the geometry modified in place, first `clone()` it and
241
+ * then use this function on the clone.
242
+ * @abstract
243
+ * @param {import("../proj.js").TransformFunction} transformFn Transform function.
244
+ * Called with a flat array of geometry coordinates.
245
+ */
246
+ applyTransform(t) {
247
+ x();
248
+ }
249
+ /**
250
+ * Test if the geometry and the passed extent intersect.
251
+ * @abstract
252
+ * @param {import("../extent.js").Extent} extent Extent.
253
+ * @return {boolean} `true` if the geometry and the extent intersect.
254
+ */
255
+ intersectsExtent(t) {
256
+ return x();
257
+ }
258
+ /**
259
+ * Translate the geometry. This modifies the geometry coordinates in place. If
260
+ * instead you want a new geometry, first `clone()` this geometry.
261
+ * @abstract
262
+ * @param {number} deltaX Delta X.
263
+ * @param {number} deltaY Delta Y.
264
+ * @api
265
+ */
266
+ translate(t, e) {
267
+ x();
268
+ }
269
+ /**
270
+ * Transform each coordinate of the geometry from one coordinate reference
271
+ * system to another. The geometry is modified in place.
272
+ * For example, a line will be transformed to a line and a circle to a circle.
273
+ * If you do not want the geometry modified in place, first `clone()` it and
274
+ * then use this function on the clone.
275
+ *
276
+ * @param {import("../proj.js").ProjectionLike} source The current projection. Can be a
277
+ * string identifier or a {@link module:ol/proj/Projection~Projection} object.
278
+ * @param {import("../proj.js").ProjectionLike} destination The desired projection. Can be a
279
+ * string identifier or a {@link module:ol/proj/Projection~Projection} object.
280
+ * @return {this} This geometry. Note that original geometry is
281
+ * modified in place.
282
+ * @api
283
+ */
284
+ transform(t, e) {
285
+ const n = vt(t), i = n.getUnits() == "tile-pixels" ? function(r, o, l) {
286
+ const a = n.getExtent(), c = n.getWorldExtent(), h = F(c) / F(a);
287
+ qt(
288
+ B,
289
+ c[0],
290
+ c[3],
291
+ h,
292
+ -h,
293
+ 0,
294
+ 0,
295
+ 0
296
+ );
297
+ const u = lt(
298
+ r,
299
+ 0,
300
+ r.length,
301
+ l,
302
+ B,
303
+ o
304
+ ), g = q(n, e);
305
+ return g ? g(u, u, l) : u;
306
+ } : q(n, e);
307
+ return this.applyTransform(i), this;
308
+ }
309
+ }
310
+ class O extends se {
311
+ constructor() {
312
+ super(), this.layout = "XY", this.stride = 2, this.flatCoordinates;
313
+ }
314
+ /**
315
+ * @param {import("../extent.js").Extent} extent Extent.
316
+ * @protected
317
+ * @return {import("../extent.js").Extent} extent Extent.
318
+ * @override
319
+ */
320
+ computeExtent(t) {
321
+ return St(
322
+ this.flatCoordinates,
323
+ 0,
324
+ this.flatCoordinates.length,
325
+ this.stride,
326
+ t
327
+ );
328
+ }
329
+ /**
330
+ * @abstract
331
+ * @return {Array<*> | null} Coordinates.
332
+ */
333
+ getCoordinates() {
334
+ return x();
335
+ }
336
+ /**
337
+ * Return the first coordinate of the geometry.
338
+ * @return {import("../coordinate.js").Coordinate} First coordinate.
339
+ * @api
340
+ */
341
+ getFirstCoordinate() {
342
+ return this.flatCoordinates.slice(0, this.stride);
343
+ }
344
+ /**
345
+ * @return {Array<number>} Flat coordinates.
346
+ */
347
+ getFlatCoordinates() {
348
+ return this.flatCoordinates;
349
+ }
350
+ /**
351
+ * Return the last coordinate of the geometry.
352
+ * @return {import("../coordinate.js").Coordinate} Last point.
353
+ * @api
354
+ */
355
+ getLastCoordinate() {
356
+ return this.flatCoordinates.slice(
357
+ this.flatCoordinates.length - this.stride
358
+ );
359
+ }
360
+ /**
361
+ * Return the {@link import("./Geometry.js").GeometryLayout layout} of the geometry.
362
+ * @return {import("./Geometry.js").GeometryLayout} Layout.
363
+ * @api
364
+ */
365
+ getLayout() {
366
+ return this.layout;
367
+ }
368
+ /**
369
+ * Create a simplified version of this geometry using the Douglas Peucker algorithm.
370
+ * @param {number} squaredTolerance Squared tolerance.
371
+ * @return {SimpleGeometry} Simplified geometry.
372
+ * @override
373
+ */
374
+ getSimplifiedGeometry(t) {
375
+ if (this.simplifiedGeometryRevision !== this.getRevision() && (this.simplifiedGeometryMaxMinSquaredTolerance = 0, this.simplifiedGeometryRevision = this.getRevision()), t < 0 || this.simplifiedGeometryMaxMinSquaredTolerance !== 0 && t <= this.simplifiedGeometryMaxMinSquaredTolerance)
376
+ return this;
377
+ const e = this.getSimplifiedGeometryInternal(t);
378
+ return e.getFlatCoordinates().length < this.flatCoordinates.length ? e : (this.simplifiedGeometryMaxMinSquaredTolerance = t, this);
379
+ }
380
+ /**
381
+ * @param {number} squaredTolerance Squared tolerance.
382
+ * @return {SimpleGeometry} Simplified geometry.
383
+ * @protected
384
+ */
385
+ getSimplifiedGeometryInternal(t) {
386
+ return this;
387
+ }
388
+ /**
389
+ * @return {number} Stride.
390
+ */
391
+ getStride() {
392
+ return this.stride;
393
+ }
394
+ /**
395
+ * @param {import("./Geometry.js").GeometryLayout} layout Layout.
396
+ * @param {Array<number>} flatCoordinates Flat coordinates.
397
+ */
398
+ setFlatCoordinates(t, e) {
399
+ this.stride = J(t), this.layout = t, this.flatCoordinates = e;
400
+ }
401
+ /**
402
+ * @abstract
403
+ * @param {!Array<*>} coordinates Coordinates.
404
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
405
+ */
406
+ setCoordinates(t, e) {
407
+ x();
408
+ }
409
+ /**
410
+ * @param {import("./Geometry.js").GeometryLayout|undefined} layout Layout.
411
+ * @param {Array<*>} coordinates Coordinates.
412
+ * @param {number} nesting Nesting.
413
+ * @protected
414
+ */
415
+ setLayout(t, e, n) {
416
+ let i;
417
+ if (t)
418
+ i = J(t);
419
+ else {
420
+ for (let r = 0; r < n; ++r) {
421
+ if (e.length === 0) {
422
+ this.layout = "XY", this.stride = 2;
423
+ return;
424
+ }
425
+ e = /** @type {Array<unknown>} */
426
+ e[0];
427
+ }
428
+ i = e.length, t = oe(i);
429
+ }
430
+ this.layout = t, this.stride = i;
431
+ }
432
+ /**
433
+ * Apply a transform function to the coordinates of the geometry.
434
+ * The geometry is modified in place.
435
+ * If you do not want the geometry modified in place, first `clone()` it and
436
+ * then use this function on the clone.
437
+ * @param {import("../proj.js").TransformFunction} transformFn Transform function.
438
+ * Called with a flat array of geometry coordinates.
439
+ * @api
440
+ * @override
441
+ */
442
+ applyTransform(t) {
443
+ this.flatCoordinates && (t(
444
+ this.flatCoordinates,
445
+ this.flatCoordinates,
446
+ this.layout.startsWith("XYZ") ? 3 : 2,
447
+ this.stride
448
+ ), this.changed());
449
+ }
450
+ /**
451
+ * Rotate the geometry around a given coordinate. This modifies the geometry
452
+ * coordinates in place.
453
+ * @param {number} angle Rotation angle in counter-clockwise radians.
454
+ * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
455
+ * @api
456
+ * @override
457
+ */
458
+ rotate(t, e) {
459
+ const n = this.getFlatCoordinates();
460
+ if (n) {
461
+ const i = this.getStride();
462
+ te(
463
+ n,
464
+ 0,
465
+ n.length,
466
+ i,
467
+ t,
468
+ e,
469
+ n
470
+ ), this.changed();
471
+ }
472
+ }
473
+ /**
474
+ * Scale the geometry (with an optional origin). This modifies the geometry
475
+ * coordinates in place.
476
+ * @param {number} sx The scaling factor in the x-direction.
477
+ * @param {number} [sy] The scaling factor in the y-direction (defaults to sx).
478
+ * @param {import("../coordinate.js").Coordinate} [anchor] The scale origin (defaults to the center
479
+ * of the geometry extent).
480
+ * @api
481
+ * @override
482
+ */
483
+ scale(t, e, n) {
484
+ e === void 0 && (e = t), n || (n = S(this.getExtent()));
485
+ const i = this.getFlatCoordinates();
486
+ if (i) {
487
+ const r = this.getStride();
488
+ ee(
489
+ i,
490
+ 0,
491
+ i.length,
492
+ r,
493
+ t,
494
+ e,
495
+ n,
496
+ i
497
+ ), this.changed();
498
+ }
499
+ }
500
+ /**
501
+ * Translate the geometry. This modifies the geometry coordinates in place. If
502
+ * instead you want a new geometry, first `clone()` this geometry.
503
+ * @param {number} deltaX Delta X.
504
+ * @param {number} deltaY Delta Y.
505
+ * @api
506
+ * @override
507
+ */
508
+ translate(t, e) {
509
+ const n = this.getFlatCoordinates();
510
+ if (n) {
511
+ const i = this.getStride();
512
+ ne(
513
+ n,
514
+ 0,
515
+ n.length,
516
+ i,
517
+ t,
518
+ e,
519
+ n
520
+ ), this.changed();
521
+ }
522
+ }
523
+ }
524
+ function oe(s) {
525
+ let t;
526
+ return s == 2 ? t = "XY" : s == 3 ? t = "XYZ" : s == 4 && (t = "XYZM"), /** @type {import("./Geometry.js").GeometryLayout} */
527
+ t;
528
+ }
529
+ function J(s) {
530
+ let t;
531
+ return s == "XY" ? t = 2 : s == "XYZ" || s == "XYM" ? t = 3 : s == "XYZM" && (t = 4), /** @type {number} */
532
+ t;
533
+ }
534
+ function me(s, t, e) {
535
+ const n = s.getFlatCoordinates();
536
+ if (!n)
537
+ return null;
538
+ const i = s.getStride();
539
+ return lt(
540
+ n,
541
+ 0,
542
+ n.length,
543
+ i,
544
+ t,
545
+ e
546
+ );
547
+ }
548
+ function ht(s, t, e, n) {
549
+ let i = 0;
550
+ const r = s[e - n], o = s[e - n + 1];
551
+ let l = 0, a = 0;
552
+ for (; t < e; t += n) {
553
+ const c = s[t] - r, h = s[t + 1] - o;
554
+ i += a * c - l * h, l = c, a = h;
555
+ }
556
+ return i / 2;
557
+ }
558
+ function ut(s, t, e, n) {
559
+ let i = 0;
560
+ for (let r = 0, o = e.length; r < o; ++r) {
561
+ const l = e[r];
562
+ i += ht(s, t, l, n), t = l;
563
+ }
564
+ return i;
565
+ }
566
+ function Ce(s, t, e, n) {
567
+ let i = 0;
568
+ for (let r = 0, o = e.length; r < o; ++r) {
569
+ const l = e[r];
570
+ i += ut(s, t, l, n), t = l[l.length - 1];
571
+ }
572
+ return i;
573
+ }
574
+ function Q(s, t, e, n, i, r, o) {
575
+ const l = s[t], a = s[t + 1], c = s[e] - l, h = s[e + 1] - a;
576
+ let u;
577
+ if (c === 0 && h === 0)
578
+ u = t;
579
+ else {
580
+ const g = ((i - l) * c + (r - a) * h) / (c * c + h * h);
581
+ if (g > 1)
582
+ u = e;
583
+ else if (g > 0) {
584
+ for (let d = 0; d < n; ++d)
585
+ o[d] = Zt(
586
+ s[t + d],
587
+ s[e + d],
588
+ g
589
+ );
590
+ o.length = n;
591
+ return;
592
+ } else
593
+ u = t;
594
+ }
595
+ for (let g = 0; g < n; ++g)
596
+ o[g] = s[u + g];
597
+ o.length = n;
598
+ }
599
+ function ct(s, t, e, n, i) {
600
+ let r = s[t], o = s[t + 1];
601
+ for (t += n; t < e; t += n) {
602
+ const l = s[t], a = s[t + 1], c = j(r, o, l, a);
603
+ c > i && (i = c), r = l, o = a;
604
+ }
605
+ return i;
606
+ }
607
+ function gt(s, t, e, n, i) {
608
+ for (let r = 0, o = e.length; r < o; ++r) {
609
+ const l = e[r];
610
+ i = ct(s, t, l, n, i), t = l;
611
+ }
612
+ return i;
613
+ }
614
+ function xe(s, t, e, n, i) {
615
+ for (let r = 0, o = e.length; r < o; ++r) {
616
+ const l = e[r];
617
+ i = gt(s, t, l, n, i), t = l[l.length - 1];
618
+ }
619
+ return i;
620
+ }
621
+ function dt(s, t, e, n, i, r, o, l, a, c, h) {
622
+ if (t == e)
623
+ return c;
624
+ let u, g;
625
+ if (i === 0) {
626
+ if (g = j(
627
+ o,
628
+ l,
629
+ s[t],
630
+ s[t + 1]
631
+ ), g < c) {
632
+ for (u = 0; u < n; ++u)
633
+ a[u] = s[t + u];
634
+ return a.length = n, g;
635
+ }
636
+ return c;
637
+ }
638
+ h = h || [NaN, NaN];
639
+ let d = t + n;
640
+ for (; d < e; )
641
+ if (Q(
642
+ s,
643
+ d - n,
644
+ d,
645
+ n,
646
+ o,
647
+ l,
648
+ h
649
+ ), g = j(o, l, h[0], h[1]), g < c) {
650
+ for (c = g, u = 0; u < n; ++u)
651
+ a[u] = h[u];
652
+ a.length = n, d += n;
653
+ } else
654
+ d += n * Math.max(
655
+ (Math.sqrt(g) - Math.sqrt(c)) / i | 0,
656
+ 1
657
+ );
658
+ if (r && (Q(
659
+ s,
660
+ e - n,
661
+ t,
662
+ n,
663
+ o,
664
+ l,
665
+ h
666
+ ), g = j(o, l, h[0], h[1]), g < c)) {
667
+ for (c = g, u = 0; u < n; ++u)
668
+ a[u] = h[u];
669
+ a.length = n;
670
+ }
671
+ return c;
672
+ }
673
+ function ft(s, t, e, n, i, r, o, l, a, c, h) {
674
+ h = h || [NaN, NaN];
675
+ for (let u = 0, g = e.length; u < g; ++u) {
676
+ const d = e[u];
677
+ c = dt(
678
+ s,
679
+ t,
680
+ d,
681
+ n,
682
+ i,
683
+ r,
684
+ o,
685
+ l,
686
+ a,
687
+ c,
688
+ h
689
+ ), t = d;
690
+ }
691
+ return c;
692
+ }
693
+ function Me(s, t, e, n, i, r, o, l, a, c, h) {
694
+ h = h || [NaN, NaN];
695
+ for (let u = 0, g = e.length; u < g; ++u) {
696
+ const d = e[u];
697
+ c = ft(
698
+ s,
699
+ t,
700
+ d,
701
+ n,
702
+ i,
703
+ r,
704
+ o,
705
+ l,
706
+ a,
707
+ c,
708
+ h
709
+ ), t = d[d.length - 1];
710
+ }
711
+ return c;
712
+ }
713
+ function re(s, t, e, n) {
714
+ for (let i = 0, r = e.length; i < r; ++i)
715
+ s[t++] = e[i];
716
+ return t;
717
+ }
718
+ function Rt(s, t, e, n) {
719
+ for (let i = 0, r = e.length; i < r; ++i) {
720
+ const o = e[i];
721
+ for (let l = 0; l < n; ++l)
722
+ s[t++] = o[l];
723
+ }
724
+ return t;
725
+ }
726
+ function _t(s, t, e, n, i) {
727
+ i = i || [];
728
+ let r = 0;
729
+ for (let o = 0, l = e.length; o < l; ++o) {
730
+ const a = Rt(
731
+ s,
732
+ t,
733
+ e[o],
734
+ n
735
+ );
736
+ i[r++] = a, t = a;
737
+ }
738
+ return i.length = r, i;
739
+ }
740
+ function pe(s, t, e, n, i) {
741
+ i = i || [];
742
+ let r = 0;
743
+ for (let o = 0, l = e.length; o < l; ++o) {
744
+ const a = _t(
745
+ s,
746
+ t,
747
+ e[o],
748
+ n,
749
+ i[r]
750
+ );
751
+ a.length === 0 && (a[0] = t), i[r++] = a, t = a[a.length - 1];
752
+ }
753
+ return i.length = r, i;
754
+ }
755
+ function mt(s, t, e, n, i) {
756
+ i = i !== void 0 ? i : [];
757
+ let r = 0;
758
+ for (let o = t; o < e; o += n)
759
+ i[r++] = s.slice(o, o + n);
760
+ return i.length = r, i;
761
+ }
762
+ function Ct(s, t, e, n, i) {
763
+ i = i !== void 0 ? i : [];
764
+ let r = 0;
765
+ for (let o = 0, l = e.length; o < l; ++o) {
766
+ const a = e[o];
767
+ i[r++] = mt(
768
+ s,
769
+ t,
770
+ a,
771
+ n,
772
+ i[r]
773
+ ), t = a;
774
+ }
775
+ return i.length = r, i;
776
+ }
777
+ function ye(s, t, e, n, i) {
778
+ i = i !== void 0 ? i : [];
779
+ let r = 0;
780
+ for (let o = 0, l = e.length; o < l; ++o) {
781
+ const a = e[o];
782
+ i[r++] = a.length === 1 && a[0] === t ? [] : Ct(
783
+ s,
784
+ t,
785
+ a,
786
+ n,
787
+ i[r]
788
+ ), t = a[a.length - 1];
789
+ }
790
+ return i.length = r, i;
791
+ }
792
+ function xt(s, t, e, n, i, r, o) {
793
+ const l = (e - t) / n;
794
+ if (l < 3) {
795
+ for (; t < e; t += n)
796
+ r[o++] = s[t], r[o++] = s[t + 1];
797
+ return o;
798
+ }
799
+ const a = new Array(l);
800
+ a[0] = 1, a[l - 1] = 1;
801
+ const c = [t, e - n];
802
+ let h = 0;
803
+ for (; c.length > 0; ) {
804
+ const u = c.pop(), g = c.pop();
805
+ let d = 0;
806
+ const f = s[g], R = s[g + 1], _ = s[u], C = s[u + 1];
807
+ for (let m = g + n; m < u; m += n) {
808
+ const z = s[m], w = s[m + 1], H = zt(z, w, f, R, _, C);
809
+ H > d && (h = m, d = H);
810
+ }
811
+ d > i && (a[(h - t) / n] = 1, g + n < h && c.push(g, h), h + n < u && c.push(h, u));
812
+ }
813
+ for (let u = 0; u < l; ++u)
814
+ a[u] && (r[o++] = s[t + u * n], r[o++] = s[t + u * n + 1]);
815
+ return o;
816
+ }
817
+ function Ie(s, t, e, n, i, r, o, l) {
818
+ for (let a = 0, c = e.length; a < c; ++a) {
819
+ const h = e[a];
820
+ o = xt(
821
+ s,
822
+ t,
823
+ h,
824
+ n,
825
+ i,
826
+ r,
827
+ o
828
+ ), l.push(o), t = h;
829
+ }
830
+ return o;
831
+ }
832
+ function A(s, t) {
833
+ return t * Math.round(s / t);
834
+ }
835
+ function ae(s, t, e, n, i, r, o) {
836
+ if (t == e)
837
+ return o;
838
+ let l = A(s[t], i), a = A(s[t + 1], i);
839
+ t += n, r[o++] = l, r[o++] = a;
840
+ let c, h;
841
+ do
842
+ if (c = A(s[t], i), h = A(s[t + 1], i), t += n, t == e)
843
+ return r[o++] = c, r[o++] = h, o;
844
+ while (c == l && h == a);
845
+ for (; t < e; ) {
846
+ const u = A(s[t], i), g = A(s[t + 1], i);
847
+ if (t += n, u == c && g == h)
848
+ continue;
849
+ const d = c - l, f = h - a, R = u - l, _ = g - a;
850
+ if (d * _ == f * R && (d < 0 && R < d || d == R || d > 0 && R > d) && (f < 0 && _ < f || f == _ || f > 0 && _ > f)) {
851
+ c = u, h = g;
852
+ continue;
853
+ }
854
+ r[o++] = c, r[o++] = h, l = c, a = h, c = u, h = g;
855
+ }
856
+ return r[o++] = c, r[o++] = h, o;
857
+ }
858
+ function Mt(s, t, e, n, i, r, o, l) {
859
+ for (let a = 0, c = e.length; a < c; ++a) {
860
+ const h = e[a];
861
+ o = ae(
862
+ s,
863
+ t,
864
+ h,
865
+ n,
866
+ i,
867
+ r,
868
+ o
869
+ ), l.push(o), t = h;
870
+ }
871
+ return o;
872
+ }
873
+ function Ae(s, t, e, n, i, r, o, l) {
874
+ for (let a = 0, c = e.length; a < c; ++a) {
875
+ const h = e[a], u = [];
876
+ o = Mt(
877
+ s,
878
+ t,
879
+ h,
880
+ n,
881
+ i,
882
+ r,
883
+ o,
884
+ u
885
+ ), l.push(u), t = h[h.length - 1];
886
+ }
887
+ return o;
888
+ }
889
+ class T extends O {
890
+ /**
891
+ * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
892
+ * For internal use, flat coordinates in combination with `layout` are also accepted.
893
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
894
+ */
895
+ constructor(t, e) {
896
+ super(), this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, e !== void 0 && !Array.isArray(t[0]) ? this.setFlatCoordinates(
897
+ e,
898
+ /** @type {Array<number>} */
899
+ t
900
+ ) : this.setCoordinates(
901
+ /** @type {Array<import("../coordinate.js").Coordinate>} */
902
+ t,
903
+ e
904
+ );
905
+ }
906
+ /**
907
+ * Make a complete copy of the geometry.
908
+ * @return {!LinearRing} Clone.
909
+ * @api
910
+ * @override
911
+ */
912
+ clone() {
913
+ return new T(this.flatCoordinates.slice(), this.layout);
914
+ }
915
+ /**
916
+ * @param {number} x X.
917
+ * @param {number} y Y.
918
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
919
+ * @param {number} minSquaredDistance Minimum squared distance.
920
+ * @return {number} Minimum squared distance.
921
+ * @override
922
+ */
923
+ closestPointXY(t, e, n, i) {
924
+ return i < st(this.getExtent(), t, e) ? i : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
925
+ ct(
926
+ this.flatCoordinates,
927
+ 0,
928
+ this.flatCoordinates.length,
929
+ this.stride,
930
+ 0
931
+ )
932
+ ), this.maxDeltaRevision_ = this.getRevision()), dt(
933
+ this.flatCoordinates,
934
+ 0,
935
+ this.flatCoordinates.length,
936
+ this.stride,
937
+ this.maxDelta_,
938
+ !0,
939
+ t,
940
+ e,
941
+ n,
942
+ i
943
+ ));
944
+ }
945
+ /**
946
+ * Return the area of the linear ring on projected plane.
947
+ * @return {number} Area (on projected plane).
948
+ * @api
949
+ */
950
+ getArea() {
951
+ return ht(
952
+ this.flatCoordinates,
953
+ 0,
954
+ this.flatCoordinates.length,
955
+ this.stride
956
+ );
957
+ }
958
+ /**
959
+ * Return the coordinates of the linear ring.
960
+ * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
961
+ * @api
962
+ * @override
963
+ */
964
+ getCoordinates() {
965
+ return mt(
966
+ this.flatCoordinates,
967
+ 0,
968
+ this.flatCoordinates.length,
969
+ this.stride
970
+ );
971
+ }
972
+ /**
973
+ * @param {number} squaredTolerance Squared tolerance.
974
+ * @return {LinearRing} Simplified LinearRing.
975
+ * @protected
976
+ * @override
977
+ */
978
+ getSimplifiedGeometryInternal(t) {
979
+ const e = [];
980
+ return e.length = xt(
981
+ this.flatCoordinates,
982
+ 0,
983
+ this.flatCoordinates.length,
984
+ this.stride,
985
+ t,
986
+ e,
987
+ 0
988
+ ), new T(e, "XY");
989
+ }
990
+ /**
991
+ * Get the type of this geometry.
992
+ * @return {import("./Geometry.js").Type} Geometry type.
993
+ * @api
994
+ * @override
995
+ */
996
+ getType() {
997
+ return "LinearRing";
998
+ }
999
+ /**
1000
+ * Test if the geometry and the passed extent intersect.
1001
+ * @param {import("../extent.js").Extent} extent Extent.
1002
+ * @return {boolean} `true` if the geometry and the extent intersect.
1003
+ * @api
1004
+ * @override
1005
+ */
1006
+ intersectsExtent(t) {
1007
+ return !1;
1008
+ }
1009
+ /**
1010
+ * Set the coordinates of the linear ring.
1011
+ * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
1012
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
1013
+ * @api
1014
+ * @override
1015
+ */
1016
+ setCoordinates(t, e) {
1017
+ this.setLayout(e, t, 1), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = Rt(
1018
+ this.flatCoordinates,
1019
+ 0,
1020
+ t,
1021
+ this.stride
1022
+ ), this.changed();
1023
+ }
1024
+ }
1025
+ class V extends O {
1026
+ /**
1027
+ * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
1028
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
1029
+ */
1030
+ constructor(t, e) {
1031
+ super(), this.setCoordinates(t, e);
1032
+ }
1033
+ /**
1034
+ * Make a complete copy of the geometry.
1035
+ * @return {!Point} Clone.
1036
+ * @api
1037
+ * @override
1038
+ */
1039
+ clone() {
1040
+ const t = new V(this.flatCoordinates.slice(), this.layout);
1041
+ return t.applyProperties(this), t;
1042
+ }
1043
+ /**
1044
+ * @param {number} x X.
1045
+ * @param {number} y Y.
1046
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
1047
+ * @param {number} minSquaredDistance Minimum squared distance.
1048
+ * @return {number} Minimum squared distance.
1049
+ * @override
1050
+ */
1051
+ closestPointXY(t, e, n, i) {
1052
+ const r = this.flatCoordinates, o = j(
1053
+ t,
1054
+ e,
1055
+ r[0],
1056
+ r[1]
1057
+ );
1058
+ if (o < i) {
1059
+ const l = this.stride;
1060
+ for (let a = 0; a < l; ++a)
1061
+ n[a] = r[a];
1062
+ return n.length = l, o;
1063
+ }
1064
+ return i;
1065
+ }
1066
+ /**
1067
+ * Return the coordinate of the point.
1068
+ * @return {import("../coordinate.js").Coordinate} Coordinates.
1069
+ * @api
1070
+ * @override
1071
+ */
1072
+ getCoordinates() {
1073
+ return this.flatCoordinates.slice();
1074
+ }
1075
+ /**
1076
+ * @param {import("../extent.js").Extent} extent Extent.
1077
+ * @protected
1078
+ * @return {import("../extent.js").Extent} extent Extent.
1079
+ * @override
1080
+ */
1081
+ computeExtent(t) {
1082
+ return Pt(this.flatCoordinates, t);
1083
+ }
1084
+ /**
1085
+ * Get the type of this geometry.
1086
+ * @return {import("./Geometry.js").Type} Geometry type.
1087
+ * @api
1088
+ * @override
1089
+ */
1090
+ getType() {
1091
+ return "Point";
1092
+ }
1093
+ /**
1094
+ * Test if the geometry and the passed extent intersect.
1095
+ * @param {import("../extent.js").Extent} extent Extent.
1096
+ * @return {boolean} `true` if the geometry and the extent intersect.
1097
+ * @api
1098
+ * @override
1099
+ */
1100
+ intersectsExtent(t) {
1101
+ return Xt(t, this.flatCoordinates[0], this.flatCoordinates[1]);
1102
+ }
1103
+ /**
1104
+ * @param {!Array<*>} coordinates Coordinates.
1105
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
1106
+ * @api
1107
+ * @override
1108
+ */
1109
+ setCoordinates(t, e) {
1110
+ this.setLayout(e, t, 0), this.flatCoordinates || (this.flatCoordinates = []), this.flatCoordinates.length = re(
1111
+ this.flatCoordinates,
1112
+ 0,
1113
+ t,
1114
+ this.stride
1115
+ ), this.changed();
1116
+ }
1117
+ }
1118
+ function pt(s, t, e, n, i, r, o) {
1119
+ let l, a, c, h, u, g, d;
1120
+ const f = i[r + 1], R = [];
1121
+ for (let m = 0, z = e.length; m < z; ++m) {
1122
+ const w = e[m];
1123
+ for (h = s[w - n], g = s[w - n + 1], l = t; l < w; l += n)
1124
+ u = s[l], d = s[l + 1], (f <= g && d <= f || g <= f && f <= d) && (c = (f - g) / (d - g) * (u - h) + h, R.push(c)), h = u, g = d;
1125
+ }
1126
+ let _ = NaN, C = -1 / 0;
1127
+ for (R.sort(Yt), h = R[0], l = 1, a = R.length; l < a; ++l) {
1128
+ u = R[l];
1129
+ const m = Math.abs(u - h);
1130
+ m > C && (c = (h + u) / 2, at(s, t, e, n, c, f) && (_ = c, C = m)), h = u;
1131
+ }
1132
+ return isNaN(_) && (_ = i[r]), o ? (o.push(_, f, C), o) : [_, f, C];
1133
+ }
1134
+ function we(s, t, e, n, i) {
1135
+ let r = [];
1136
+ for (let o = 0, l = e.length; o < l; ++o) {
1137
+ const a = e[o];
1138
+ r = pt(
1139
+ s,
1140
+ t,
1141
+ a,
1142
+ n,
1143
+ i,
1144
+ 2 * o,
1145
+ r
1146
+ ), t = a[a.length - 1];
1147
+ }
1148
+ return r;
1149
+ }
1150
+ function le(s, t, e, n) {
1151
+ for (; t < e - n; ) {
1152
+ for (let i = 0; i < n; ++i) {
1153
+ const r = s[t + i];
1154
+ s[t + i] = s[e - n + i], s[e - n + i] = r;
1155
+ }
1156
+ t += n, e -= n;
1157
+ }
1158
+ }
1159
+ function k(s, t, e, n) {
1160
+ let i = 0, r = s[e - n], o = s[e - n + 1];
1161
+ for (; t < e; t += n) {
1162
+ const l = s[t], a = s[t + 1];
1163
+ i += (l - r) * (a + o), r = l, o = a;
1164
+ }
1165
+ return i === 0 ? void 0 : i > 0;
1166
+ }
1167
+ function yt(s, t, e, n, i) {
1168
+ i = i !== void 0 ? i : !1;
1169
+ for (let r = 0, o = e.length; r < o; ++r) {
1170
+ const l = e[r], a = k(
1171
+ s,
1172
+ t,
1173
+ l,
1174
+ n
1175
+ );
1176
+ if (r === 0) {
1177
+ if (i && a || !i && !a)
1178
+ return !1;
1179
+ } else if (i && !a || !i && a)
1180
+ return !1;
1181
+ t = l;
1182
+ }
1183
+ return !0;
1184
+ }
1185
+ function Ne(s, t, e, n, i) {
1186
+ for (let r = 0, o = e.length; r < o; ++r) {
1187
+ const l = e[r];
1188
+ if (!yt(s, t, l, n, i))
1189
+ return !1;
1190
+ l.length && (t = l[l.length - 1]);
1191
+ }
1192
+ return !0;
1193
+ }
1194
+ function b(s, t, e, n, i) {
1195
+ i = i !== void 0 ? i : !1;
1196
+ for (let r = 0, o = e.length; r < o; ++r) {
1197
+ const l = e[r], a = k(
1198
+ s,
1199
+ t,
1200
+ l,
1201
+ n
1202
+ );
1203
+ (r === 0 ? i && a || !i && !a : i && !a || !i && a) && le(s, t, l, n), t = l;
1204
+ }
1205
+ return t;
1206
+ }
1207
+ function je(s, t, e, n, i) {
1208
+ for (let r = 0, o = e.length; r < o; ++r)
1209
+ t = b(
1210
+ s,
1211
+ t,
1212
+ e[r],
1213
+ n,
1214
+ i
1215
+ );
1216
+ return t;
1217
+ }
1218
+ function Fe(s, t) {
1219
+ const e = [];
1220
+ let n = 0, i = 0, r;
1221
+ for (let o = 0, l = t.length; o < l; ++o) {
1222
+ const a = t[o], c = k(s, n, a, 2);
1223
+ if (r === void 0 && (r = c), c === r)
1224
+ e.push(t.slice(i, o + 1));
1225
+ else {
1226
+ if (e.length === 0)
1227
+ continue;
1228
+ e[e.length - 1].push(t[i]);
1229
+ }
1230
+ i = o + 1, n = a;
1231
+ }
1232
+ return e;
1233
+ }
1234
+ class Z extends O {
1235
+ /**
1236
+ * @param {!Array<Array<import("../coordinate.js").Coordinate>>|!Array<number>} coordinates
1237
+ * Array of linear rings that define the polygon. The first linear ring of the
1238
+ * array defines the outer-boundary or surface of the polygon. Each subsequent
1239
+ * linear ring defines a hole in the surface of the polygon. A linear ring is
1240
+ * an array of vertices' coordinates where the first coordinate and the last are
1241
+ * equivalent. (For internal use, flat coordinates in combination with
1242
+ * `layout` and `ends` are also accepted.)
1243
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
1244
+ * @param {Array<number>} [ends] Ends (for internal use with flat coordinates).
1245
+ */
1246
+ constructor(t, e, n) {
1247
+ super(), this.ends_ = [], this.flatInteriorPointRevision_ = -1, this.flatInteriorPoint_ = null, this.maxDelta_ = -1, this.maxDeltaRevision_ = -1, this.orientedRevision_ = -1, this.orientedFlatCoordinates_ = null, e !== void 0 && n ? (this.setFlatCoordinates(
1248
+ e,
1249
+ /** @type {Array<number>} */
1250
+ t
1251
+ ), this.ends_ = n) : this.setCoordinates(
1252
+ /** @type {Array<Array<import("../coordinate.js").Coordinate>>} */
1253
+ t,
1254
+ e
1255
+ );
1256
+ }
1257
+ /**
1258
+ * Append the passed linear ring to this polygon.
1259
+ * @param {LinearRing} linearRing Linear ring.
1260
+ * @api
1261
+ */
1262
+ appendLinearRing(t) {
1263
+ this.flatCoordinates ? bt(this.flatCoordinates, t.getFlatCoordinates()) : this.flatCoordinates = t.getFlatCoordinates().slice(), this.ends_.push(this.flatCoordinates.length), this.changed();
1264
+ }
1265
+ /**
1266
+ * Make a complete copy of the geometry.
1267
+ * @return {!Polygon} Clone.
1268
+ * @api
1269
+ * @override
1270
+ */
1271
+ clone() {
1272
+ const t = new Z(
1273
+ this.flatCoordinates.slice(),
1274
+ this.layout,
1275
+ this.ends_.slice()
1276
+ );
1277
+ return t.applyProperties(this), t;
1278
+ }
1279
+ /**
1280
+ * @param {number} x X.
1281
+ * @param {number} y Y.
1282
+ * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
1283
+ * @param {number} minSquaredDistance Minimum squared distance.
1284
+ * @return {number} Minimum squared distance.
1285
+ * @override
1286
+ */
1287
+ closestPointXY(t, e, n, i) {
1288
+ return i < st(this.getExtent(), t, e) ? i : (this.maxDeltaRevision_ != this.getRevision() && (this.maxDelta_ = Math.sqrt(
1289
+ gt(
1290
+ this.flatCoordinates,
1291
+ 0,
1292
+ this.ends_,
1293
+ this.stride,
1294
+ 0
1295
+ )
1296
+ ), this.maxDeltaRevision_ = this.getRevision()), ft(
1297
+ this.flatCoordinates,
1298
+ 0,
1299
+ this.ends_,
1300
+ this.stride,
1301
+ this.maxDelta_,
1302
+ !0,
1303
+ t,
1304
+ e,
1305
+ n,
1306
+ i
1307
+ ));
1308
+ }
1309
+ /**
1310
+ * @param {number} x X.
1311
+ * @param {number} y Y.
1312
+ * @return {boolean} Contains (x, y).
1313
+ * @override
1314
+ */
1315
+ containsXY(t, e) {
1316
+ return at(
1317
+ this.getOrientedFlatCoordinates(),
1318
+ 0,
1319
+ this.ends_,
1320
+ this.stride,
1321
+ t,
1322
+ e
1323
+ );
1324
+ }
1325
+ /**
1326
+ * Return the area of the polygon on projected plane.
1327
+ * @return {number} Area (on projected plane).
1328
+ * @api
1329
+ */
1330
+ getArea() {
1331
+ return ut(
1332
+ this.getOrientedFlatCoordinates(),
1333
+ 0,
1334
+ this.ends_,
1335
+ this.stride
1336
+ );
1337
+ }
1338
+ /**
1339
+ * Get the coordinate array for this geometry. This array has the structure
1340
+ * of a GeoJSON coordinate array for polygons.
1341
+ *
1342
+ * @param {boolean} [right] Orient coordinates according to the right-hand
1343
+ * rule (counter-clockwise for exterior and clockwise for interior rings).
1344
+ * If `false`, coordinates will be oriented according to the left-hand rule
1345
+ * (clockwise for exterior and counter-clockwise for interior rings).
1346
+ * By default, coordinate orientation will depend on how the geometry was
1347
+ * constructed.
1348
+ * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
1349
+ * @api
1350
+ * @override
1351
+ */
1352
+ getCoordinates(t) {
1353
+ let e;
1354
+ return t !== void 0 ? (e = this.getOrientedFlatCoordinates().slice(), b(e, 0, this.ends_, this.stride, t)) : e = this.flatCoordinates, Ct(e, 0, this.ends_, this.stride);
1355
+ }
1356
+ /**
1357
+ * @return {Array<number>} Ends.
1358
+ */
1359
+ getEnds() {
1360
+ return this.ends_;
1361
+ }
1362
+ /**
1363
+ * @return {Array<number>} Interior point.
1364
+ */
1365
+ getFlatInteriorPoint() {
1366
+ if (this.flatInteriorPointRevision_ != this.getRevision()) {
1367
+ const t = S(this.getExtent());
1368
+ this.flatInteriorPoint_ = pt(
1369
+ this.getOrientedFlatCoordinates(),
1370
+ 0,
1371
+ this.ends_,
1372
+ this.stride,
1373
+ t,
1374
+ 0
1375
+ ), this.flatInteriorPointRevision_ = this.getRevision();
1376
+ }
1377
+ return (
1378
+ /** @type {import("../coordinate.js").Coordinate} */
1379
+ this.flatInteriorPoint_
1380
+ );
1381
+ }
1382
+ /**
1383
+ * Return an interior point of the polygon.
1384
+ * @return {Point} Interior point as XYM coordinate, where M is the
1385
+ * length of the horizontal intersection that the point belongs to.
1386
+ * @api
1387
+ */
1388
+ getInteriorPoint() {
1389
+ return new V(this.getFlatInteriorPoint(), "XYM");
1390
+ }
1391
+ /**
1392
+ * Return the number of rings of the polygon, this includes the exterior
1393
+ * ring and any interior rings.
1394
+ *
1395
+ * @return {number} Number of rings.
1396
+ * @api
1397
+ */
1398
+ getLinearRingCount() {
1399
+ return this.ends_.length;
1400
+ }
1401
+ /**
1402
+ * Return the Nth linear ring of the polygon geometry. Return `null` if the
1403
+ * given index is out of range.
1404
+ * The exterior linear ring is available at index `0` and the interior rings
1405
+ * at index `1` and beyond.
1406
+ *
1407
+ * @param {number} index Index.
1408
+ * @return {LinearRing|null} Linear ring.
1409
+ * @api
1410
+ */
1411
+ getLinearRing(t) {
1412
+ return t < 0 || this.ends_.length <= t ? null : new T(
1413
+ this.flatCoordinates.slice(
1414
+ t === 0 ? 0 : this.ends_[t - 1],
1415
+ this.ends_[t]
1416
+ ),
1417
+ this.layout
1418
+ );
1419
+ }
1420
+ /**
1421
+ * Return the linear rings of the polygon.
1422
+ * @return {Array<LinearRing>} Linear rings.
1423
+ * @api
1424
+ */
1425
+ getLinearRings() {
1426
+ const t = this.layout, e = this.flatCoordinates, n = this.ends_, i = [];
1427
+ let r = 0;
1428
+ for (let o = 0, l = n.length; o < l; ++o) {
1429
+ const a = n[o], c = new T(
1430
+ e.slice(r, a),
1431
+ t
1432
+ );
1433
+ i.push(c), r = a;
1434
+ }
1435
+ return i;
1436
+ }
1437
+ /**
1438
+ * @return {Array<number>} Oriented flat coordinates.
1439
+ */
1440
+ getOrientedFlatCoordinates() {
1441
+ if (this.orientedRevision_ != this.getRevision()) {
1442
+ const t = this.flatCoordinates;
1443
+ yt(t, 0, this.ends_, this.stride) ? this.orientedFlatCoordinates_ = t : (this.orientedFlatCoordinates_ = t.slice(), this.orientedFlatCoordinates_.length = b(
1444
+ this.orientedFlatCoordinates_,
1445
+ 0,
1446
+ this.ends_,
1447
+ this.stride
1448
+ )), this.orientedRevision_ = this.getRevision();
1449
+ }
1450
+ return (
1451
+ /** @type {Array<number>} */
1452
+ this.orientedFlatCoordinates_
1453
+ );
1454
+ }
1455
+ /**
1456
+ * @param {number} squaredTolerance Squared tolerance.
1457
+ * @return {Polygon} Simplified Polygon.
1458
+ * @protected
1459
+ * @override
1460
+ */
1461
+ getSimplifiedGeometryInternal(t) {
1462
+ const e = [], n = [];
1463
+ return e.length = Mt(
1464
+ this.flatCoordinates,
1465
+ 0,
1466
+ this.ends_,
1467
+ this.stride,
1468
+ Math.sqrt(t),
1469
+ e,
1470
+ 0,
1471
+ n
1472
+ ), new Z(e, "XY", n);
1473
+ }
1474
+ /**
1475
+ * Get the type of this geometry.
1476
+ * @return {import("./Geometry.js").Type} Geometry type.
1477
+ * @api
1478
+ * @override
1479
+ */
1480
+ getType() {
1481
+ return "Polygon";
1482
+ }
1483
+ /**
1484
+ * Test if the geometry and the passed extent intersect.
1485
+ * @param {import("../extent.js").Extent} extent Extent.
1486
+ * @return {boolean} `true` if the geometry and the extent intersect.
1487
+ * @api
1488
+ * @override
1489
+ */
1490
+ intersectsExtent(t) {
1491
+ return Kt(
1492
+ this.getOrientedFlatCoordinates(),
1493
+ 0,
1494
+ this.ends_,
1495
+ this.stride,
1496
+ t
1497
+ );
1498
+ }
1499
+ /**
1500
+ * Set the coordinates of the polygon.
1501
+ * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
1502
+ * @param {import("./Geometry.js").GeometryLayout} [layout] Layout.
1503
+ * @api
1504
+ * @override
1505
+ */
1506
+ setCoordinates(t, e) {
1507
+ this.setLayout(e, t, 2), this.flatCoordinates || (this.flatCoordinates = []);
1508
+ const n = _t(
1509
+ this.flatCoordinates,
1510
+ 0,
1511
+ t,
1512
+ this.stride,
1513
+ this.ends_
1514
+ );
1515
+ this.flatCoordinates.length = n.length === 0 ? 0 : n[n.length - 1], this.changed();
1516
+ }
1517
+ }
1518
+ function tt(s) {
1519
+ if (ot(s))
1520
+ throw new Error("Cannot create polygon from empty extent");
1521
+ const t = s[0], e = s[1], n = s[2], i = s[3], r = [
1522
+ t,
1523
+ e,
1524
+ t,
1525
+ i,
1526
+ n,
1527
+ i,
1528
+ n,
1529
+ e,
1530
+ t,
1531
+ e
1532
+ ];
1533
+ return new Z(r, "XY", [r.length]);
1534
+ }
1535
+ function U(s, t, e, n) {
1536
+ const i = G(t) / e[0], r = F(t) / e[1];
1537
+ return n ? Math.min(s, Math.max(i, r)) : Math.min(s, Math.min(i, r));
1538
+ }
1539
+ function D(s, t, e) {
1540
+ let n = Math.min(s, t);
1541
+ const i = 50;
1542
+ return n *= Math.log(1 + i * Math.max(0, s / t - 1)) / i + 1, e && (n = Math.max(n, e), n /= Math.log(1 + i * Math.max(0, e / s - 1)) / i + 1), p(n, e / 2, t * 2);
1543
+ }
1544
+ function he(s, t, e, n) {
1545
+ return t = t !== void 0 ? t : !0, /**
1546
+ * @param {number|undefined} resolution Resolution.
1547
+ * @param {number} direction Direction.
1548
+ * @param {import("./size.js").Size} size Viewport size.
1549
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1550
+ * @return {number|undefined} Resolution.
1551
+ */
1552
+ (function(i, r, o, l) {
1553
+ if (i !== void 0) {
1554
+ const a = s[0], c = s[s.length - 1], h = e ? U(
1555
+ a,
1556
+ e,
1557
+ o,
1558
+ n
1559
+ ) : a;
1560
+ if (l)
1561
+ return t ? D(
1562
+ i,
1563
+ h,
1564
+ c
1565
+ ) : p(i, c, h);
1566
+ const u = Math.min(h, i), g = Math.floor(rt(s, u, r));
1567
+ return s[g] > h && g < s.length - 1 ? s[g + 1] : s[g];
1568
+ }
1569
+ });
1570
+ }
1571
+ function ue(s, t, e, n, i, r) {
1572
+ return n = n !== void 0 ? n : !0, e = e !== void 0 ? e : 0, /**
1573
+ * @param {number|undefined} resolution Resolution.
1574
+ * @param {number} direction Direction.
1575
+ * @param {import("./size.js").Size} size Viewport size.
1576
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1577
+ * @return {number|undefined} Resolution.
1578
+ */
1579
+ (function(o, l, a, c) {
1580
+ if (o !== void 0) {
1581
+ const h = i ? U(
1582
+ t,
1583
+ i,
1584
+ a,
1585
+ r
1586
+ ) : t;
1587
+ if (c)
1588
+ return n ? D(
1589
+ o,
1590
+ h,
1591
+ e
1592
+ ) : p(o, e, h);
1593
+ const u = 1e-9, g = Math.ceil(
1594
+ Math.log(t / h) / Math.log(s) - u
1595
+ ), d = -l * (0.5 - u) + 0.5, f = Math.min(h, o), R = Math.floor(
1596
+ Math.log(t / f) / Math.log(s) + d
1597
+ ), _ = Math.max(g, R), C = t / Math.pow(s, _);
1598
+ return p(C, e, h);
1599
+ }
1600
+ });
1601
+ }
1602
+ function et(s, t, e, n, i) {
1603
+ return e = e !== void 0 ? e : !0, /**
1604
+ * @param {number|undefined} resolution Resolution.
1605
+ * @param {number} direction Direction.
1606
+ * @param {import("./size.js").Size} size Viewport size.
1607
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1608
+ * @return {number|undefined} Resolution.
1609
+ */
1610
+ (function(r, o, l, a) {
1611
+ if (r !== void 0) {
1612
+ const c = n ? U(
1613
+ s,
1614
+ n,
1615
+ l,
1616
+ i
1617
+ ) : s;
1618
+ return !e || !a ? p(r, t, c) : D(
1619
+ r,
1620
+ c,
1621
+ t
1622
+ );
1623
+ }
1624
+ });
1625
+ }
1626
+ function ce(s) {
1627
+ if (s !== void 0)
1628
+ return 0;
1629
+ }
1630
+ function nt(s) {
1631
+ if (s !== void 0)
1632
+ return s;
1633
+ }
1634
+ function ge(s) {
1635
+ const t = 2 * Math.PI / s;
1636
+ return (
1637
+ /**
1638
+ * @param {number|undefined} rotation Rotation.
1639
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1640
+ * @return {number|undefined} Rotation.
1641
+ */
1642
+ (function(e, n) {
1643
+ if (n)
1644
+ return e;
1645
+ if (e !== void 0)
1646
+ return e = Math.floor(e / t + 0.5) * t, e;
1647
+ })
1648
+ );
1649
+ }
1650
+ function de(s) {
1651
+ const t = Gt(5);
1652
+ return (
1653
+ /**
1654
+ * @param {number|undefined} rotation Rotation.
1655
+ * @param {boolean} [isMoving] True if an interaction or animation is in progress.
1656
+ * @return {number|undefined} Rotation.
1657
+ */
1658
+ (function(e, n) {
1659
+ return n || e === void 0 ? e : Math.abs(e) <= t ? 0 : e;
1660
+ })
1661
+ );
1662
+ }
1663
+ const P = 0;
1664
+ class fe extends it {
1665
+ /**
1666
+ * @param {ViewOptions} [options] View options.
1667
+ */
1668
+ constructor(t) {
1669
+ super(), this.on, this.once, this.un, t = Object.assign({}, t), this.hints_ = [0, 0], this.animations_ = [], this.updateAnimationKey_, this.projection_ = L(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 && Ht(), t.center && (t.center = y(t.center, this.projection_)), t.extent && (t.extent = E(t.extent, this.projection_)), this.applyOptions_(t);
1670
+ }
1671
+ /**
1672
+ * Set up the view with the given options.
1673
+ * @param {ViewOptions} options View options.
1674
+ */
1675
+ applyOptions_(t) {
1676
+ const e = Object.assign({}, t);
1677
+ for (const l in M)
1678
+ delete e[l];
1679
+ this.setProperties(e, !0);
1680
+ const n = At(t);
1681
+ this.maxResolution_ = n.maxResolution, this.minResolution_ = n.minResolution, this.zoomFactor_ = n.zoomFactor, this.resolutions_ = t.resolutions, this.padding_ = t.padding, this.minZoom_ = n.minZoom;
1682
+ const i = It(t), r = n.constraint, o = wt(t);
1683
+ this.constraints_ = {
1684
+ center: i,
1685
+ resolution: r,
1686
+ rotation: o
1687
+ }, this.setRotation(t.rotation !== void 0 ? t.rotation : 0), this.setCenterInternal(
1688
+ t.center !== void 0 ? t.center : null
1689
+ ), t.resolution !== void 0 ? this.setResolution(t.resolution) : t.zoom !== void 0 && this.setZoom(t.zoom);
1690
+ }
1691
+ /**
1692
+ * Padding (in css pixels).
1693
+ * If the map viewport is partially covered with other content (overlays) along
1694
+ * its edges, this setting allows to shift the center of the viewport away from that
1695
+ * content. The order of the values in the array is top, right, bottom, left.
1696
+ * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.
1697
+ * @type {Array<number>|undefined}
1698
+ * @api
1699
+ */
1700
+ get padding() {
1701
+ return this.padding_;
1702
+ }
1703
+ set padding(t) {
1704
+ let e = this.padding_;
1705
+ this.padding_ = t;
1706
+ const n = this.getCenterInternal();
1707
+ if (n) {
1708
+ const i = t || [0, 0, 0, 0];
1709
+ e = e || [0, 0, 0, 0];
1710
+ const r = this.getResolution(), o = r / 2 * (i[3] - e[3] + e[1] - i[1]), l = r / 2 * (i[0] - e[0] + e[2] - i[2]);
1711
+ this.setCenterInternal([n[0] + o, n[1] - l]);
1712
+ }
1713
+ }
1714
+ /**
1715
+ * Get an updated version of the view options used to construct the view. The
1716
+ * current resolution (or zoom), center, and rotation are applied to any stored
1717
+ * options. The provided options can be used to apply new min/max zoom or
1718
+ * resolution limits.
1719
+ * @param {ViewOptions} newOptions New options to be applied.
1720
+ * @return {ViewOptions} New options updated with the current view state.
1721
+ */
1722
+ getUpdatedOptions_(t) {
1723
+ const e = this.getProperties();
1724
+ return e.resolution !== void 0 ? e.resolution = this.getResolution() : e.zoom = this.getZoom(), e.center = this.getCenterInternal(), e.rotation = this.getRotation(), Object.assign({}, e, t);
1725
+ }
1726
+ /**
1727
+ * Animate the view. The view's center, zoom (or resolution), and rotation
1728
+ * can be animated for smooth transitions between view states. For example,
1729
+ * to animate the view to a new zoom level:
1730
+ *
1731
+ * view.animate({zoom: view.getZoom() + 1});
1732
+ *
1733
+ * By default, the animation lasts one second and uses in-and-out easing. You
1734
+ * can customize this behavior by including `duration` (in milliseconds) and
1735
+ * `easing` options (see {@link module:ol/easing}).
1736
+ *
1737
+ * To chain together multiple animations, call the method with multiple
1738
+ * animation objects. For example, to first zoom and then pan:
1739
+ *
1740
+ * view.animate({zoom: 10}, {center: [0, 0]});
1741
+ *
1742
+ * If you provide a function as the last argument to the animate method, it
1743
+ * will get called at the end of an animation series. The callback will be
1744
+ * called with `true` if the animation series completed on its own or `false`
1745
+ * if it was cancelled.
1746
+ *
1747
+ * Animations are cancelled by user interactions (e.g. dragging the map) or by
1748
+ * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`
1749
+ * (or another method that calls one of these).
1750
+ *
1751
+ * @param {...(AnimationOptions|function(boolean): void)} var_args Animation
1752
+ * options. Multiple animations can be run in series by passing multiple
1753
+ * options objects. To run multiple animations in parallel, call the method
1754
+ * multiple times. An optional callback can be provided as a final
1755
+ * argument. The callback will be called with a boolean indicating whether
1756
+ * the animation completed without being cancelled.
1757
+ * @api
1758
+ */
1759
+ animate(t) {
1760
+ this.isDef() && !this.getAnimating() && this.resolveConstraints(0);
1761
+ const e = new Array(arguments.length);
1762
+ for (let n = 0; n < e.length; ++n) {
1763
+ let i = arguments[n];
1764
+ i.center && (i = Object.assign({}, i), i.center = y(
1765
+ i.center,
1766
+ this.getProjection()
1767
+ )), i.anchor && (i = Object.assign({}, i), i.anchor = y(
1768
+ i.anchor,
1769
+ this.getProjection()
1770
+ )), e[n] = i;
1771
+ }
1772
+ this.animateInternal.apply(this, e);
1773
+ }
1774
+ /**
1775
+ * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.
1776
+ */
1777
+ animateInternal(t) {
1778
+ let e = arguments.length, n;
1779
+ e > 1 && typeof arguments[e - 1] == "function" && (n = arguments[e - 1], --e);
1780
+ let i = 0;
1781
+ for (; i < e && !this.isDef(); ++i) {
1782
+ const h = arguments[i];
1783
+ h.center && this.setCenterInternal(h.center), h.zoom !== void 0 ? this.setZoom(h.zoom) : h.resolution && this.setResolution(h.resolution), h.rotation !== void 0 && this.setRotation(h.rotation);
1784
+ }
1785
+ if (i === e) {
1786
+ n && v(n, !0);
1787
+ return;
1788
+ }
1789
+ let r = Date.now(), o = this.targetCenter_.slice(), l = this.targetResolution_, a = this.targetRotation_;
1790
+ const c = [];
1791
+ for (; i < e; ++i) {
1792
+ const h = (
1793
+ /** @type {AnimationOptions} */
1794
+ arguments[i]
1795
+ ), u = {
1796
+ start: r,
1797
+ complete: !1,
1798
+ anchor: h.anchor,
1799
+ duration: h.duration !== void 0 ? h.duration : 1e3,
1800
+ easing: h.easing || $t,
1801
+ callback: n
1802
+ };
1803
+ if (h.center && (u.sourceCenter = o, u.targetCenter = h.center.slice(), o = u.targetCenter), h.zoom !== void 0 ? (u.sourceResolution = l, u.targetResolution = this.getResolutionForZoom(h.zoom), l = u.targetResolution) : h.resolution && (u.sourceResolution = l, u.targetResolution = h.resolution, l = u.targetResolution), h.rotation !== void 0) {
1804
+ u.sourceRotation = a;
1805
+ const g = W(h.rotation - a + Math.PI, 2 * Math.PI) - Math.PI;
1806
+ u.targetRotation = a + g, a = u.targetRotation;
1807
+ }
1808
+ Nt(u) ? u.complete = !0 : r += u.duration, c.push(u);
1809
+ }
1810
+ this.animations_.push(c), this.setHint(I.ANIMATING, 1), this.updateAnimations_();
1811
+ }
1812
+ /**
1813
+ * Determine if the view is being animated.
1814
+ * @return {boolean} The view is being animated.
1815
+ * @api
1816
+ */
1817
+ getAnimating() {
1818
+ return this.hints_[I.ANIMATING] > 0;
1819
+ }
1820
+ /**
1821
+ * Determine if the user is interacting with the view, such as panning or zooming.
1822
+ * @return {boolean} The view is being interacted with.
1823
+ * @api
1824
+ */
1825
+ getInteracting() {
1826
+ return this.hints_[I.INTERACTING] > 0;
1827
+ }
1828
+ /**
1829
+ * Cancel any ongoing animations.
1830
+ * @api
1831
+ */
1832
+ cancelAnimations() {
1833
+ this.setHint(I.ANIMATING, -this.hints_[I.ANIMATING]);
1834
+ let t;
1835
+ for (let e = 0, n = this.animations_.length; e < n; ++e) {
1836
+ const i = this.animations_[e];
1837
+ if (i[0].callback && v(i[0].callback, !1), !t)
1838
+ for (let r = 0, o = i.length; r < o; ++r) {
1839
+ const l = i[r];
1840
+ if (!l.complete) {
1841
+ t = l.anchor;
1842
+ break;
1843
+ }
1844
+ }
1845
+ }
1846
+ this.animations_.length = 0, this.cancelAnchor_ = t, this.nextCenter_ = null, this.nextResolution_ = NaN, this.nextRotation_ = NaN;
1847
+ }
1848
+ /**
1849
+ * Update all animations.
1850
+ */
1851
+ updateAnimations_() {
1852
+ if (this.updateAnimationKey_ !== void 0 && (cancelAnimationFrame(this.updateAnimationKey_), this.updateAnimationKey_ = void 0), !this.getAnimating())
1853
+ return;
1854
+ const t = Date.now();
1855
+ let e = !1;
1856
+ for (let n = this.animations_.length - 1; n >= 0; --n) {
1857
+ const i = this.animations_[n];
1858
+ let r = !0;
1859
+ for (let o = 0, l = i.length; o < l; ++o) {
1860
+ const a = i[o];
1861
+ if (a.complete)
1862
+ continue;
1863
+ const c = t - a.start;
1864
+ let h = a.duration > 0 ? c / a.duration : 1;
1865
+ h >= 1 ? (a.complete = !0, h = 1) : r = !1;
1866
+ const u = a.easing(h);
1867
+ if (a.sourceCenter) {
1868
+ const g = a.sourceCenter[0], d = a.sourceCenter[1], f = a.targetCenter[0], R = a.targetCenter[1];
1869
+ this.nextCenter_ = a.targetCenter;
1870
+ const _ = g + u * (f - g), C = d + u * (R - d);
1871
+ this.targetCenter_ = [_, C];
1872
+ }
1873
+ if (a.sourceResolution && a.targetResolution) {
1874
+ const g = u === 1 ? a.targetResolution : a.sourceResolution + u * (a.targetResolution - a.sourceResolution);
1875
+ if (a.anchor) {
1876
+ const d = this.getViewportSize_(this.getRotation()), f = this.constraints_.resolution(
1877
+ g,
1878
+ 0,
1879
+ d,
1880
+ !0
1881
+ );
1882
+ this.targetCenter_ = this.calculateCenterZoom(
1883
+ f,
1884
+ a.anchor
1885
+ );
1886
+ }
1887
+ this.nextResolution_ = a.targetResolution, this.targetResolution_ = g, this.applyTargetState_(!0);
1888
+ }
1889
+ if (a.sourceRotation !== void 0 && a.targetRotation !== void 0) {
1890
+ const g = u === 1 ? W(a.targetRotation + Math.PI, 2 * Math.PI) - Math.PI : a.sourceRotation + u * (a.targetRotation - a.sourceRotation);
1891
+ if (a.anchor) {
1892
+ const d = this.constraints_.rotation(
1893
+ g,
1894
+ !0
1895
+ );
1896
+ this.targetCenter_ = this.calculateCenterRotate(
1897
+ d,
1898
+ a.anchor
1899
+ );
1900
+ }
1901
+ this.nextRotation_ = a.targetRotation, this.targetRotation_ = g;
1902
+ }
1903
+ if (this.applyTargetState_(!0), e = !0, !a.complete)
1904
+ break;
1905
+ }
1906
+ if (r) {
1907
+ this.animations_[n] = null, this.setHint(I.ANIMATING, -1), this.nextCenter_ = null, this.nextResolution_ = NaN, this.nextRotation_ = NaN;
1908
+ const o = i[0].callback;
1909
+ o && v(o, !0);
1910
+ }
1911
+ }
1912
+ this.animations_ = this.animations_.filter(Boolean), e && this.updateAnimationKey_ === void 0 && (this.updateAnimationKey_ = requestAnimationFrame(
1913
+ this.updateAnimations_.bind(this)
1914
+ ));
1915
+ }
1916
+ /**
1917
+ * @param {number} rotation Target rotation.
1918
+ * @param {import("./coordinate.js").Coordinate} anchor Rotation anchor.
1919
+ * @return {import("./coordinate.js").Coordinate|undefined} Center for rotation and anchor.
1920
+ */
1921
+ calculateCenterRotate(t, e) {
1922
+ let n;
1923
+ const i = this.getCenterInternal();
1924
+ return i !== void 0 && (n = [i[0] - e[0], i[1] - e[1]], Ot(n, t - this.getRotation()), Vt(n, e)), n;
1925
+ }
1926
+ /**
1927
+ * @param {number} resolution Target resolution.
1928
+ * @param {import("./coordinate.js").Coordinate} anchor Zoom anchor.
1929
+ * @return {import("./coordinate.js").Coordinate|undefined} Center for resolution and anchor.
1930
+ */
1931
+ calculateCenterZoom(t, e) {
1932
+ let n;
1933
+ const i = this.getCenterInternal(), r = this.getResolution();
1934
+ if (i !== void 0 && r !== void 0) {
1935
+ const o = e[0] - t * (e[0] - i[0]) / r, l = e[1] - t * (e[1] - i[1]) / r;
1936
+ n = [o, l];
1937
+ }
1938
+ return n;
1939
+ }
1940
+ /**
1941
+ * Returns the current viewport size.
1942
+ * @private
1943
+ * @param {number} [rotation] Take into account the rotation of the viewport when giving the size
1944
+ * @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
1945
+ */
1946
+ getViewportSize_(t) {
1947
+ const e = this.viewportSize_;
1948
+ if (t) {
1949
+ const n = e[0], i = e[1];
1950
+ return [
1951
+ Math.abs(n * Math.cos(t)) + Math.abs(i * Math.sin(t)),
1952
+ Math.abs(n * Math.sin(t)) + Math.abs(i * Math.cos(t))
1953
+ ];
1954
+ }
1955
+ return e;
1956
+ }
1957
+ /**
1958
+ * Stores the viewport size on the view. The viewport size is not read every time from the DOM
1959
+ * to avoid performance hit and layout reflow.
1960
+ * This should be done on map size change.
1961
+ * Note: the constraints are not resolved during an animation to avoid stopping it
1962
+ * @param {import("./size.js").Size} [size] Viewport size; if undefined, [100, 100] is assumed
1963
+ */
1964
+ setViewportSize(t) {
1965
+ this.viewportSize_ = Array.isArray(t) ? t.slice() : [100, 100], this.getAnimating() || this.resolveConstraints(0);
1966
+ }
1967
+ /**
1968
+ * Get the view center.
1969
+ * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
1970
+ * @observable
1971
+ * @api
1972
+ */
1973
+ getCenter() {
1974
+ const t = this.getCenterInternal();
1975
+ return t && K(t, this.getProjection());
1976
+ }
1977
+ /**
1978
+ * Get the view center without transforming to user projection.
1979
+ * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
1980
+ */
1981
+ getCenterInternal() {
1982
+ return (
1983
+ /** @type {import("./coordinate.js").Coordinate|undefined} */
1984
+ this.get(M.CENTER)
1985
+ );
1986
+ }
1987
+ /**
1988
+ * @return {Constraints} Constraints.
1989
+ */
1990
+ getConstraints() {
1991
+ return this.constraints_;
1992
+ }
1993
+ /**
1994
+ * @return {boolean} Resolution constraint is set
1995
+ */
1996
+ getConstrainResolution() {
1997
+ return this.get("constrainResolution");
1998
+ }
1999
+ /**
2000
+ * @param {Array<number>} [hints] Destination array.
2001
+ * @return {Array<number>} Hint.
2002
+ */
2003
+ getHints(t) {
2004
+ return t !== void 0 ? (t[0] = this.hints_[0], t[1] = this.hints_[1], t) : this.hints_.slice();
2005
+ }
2006
+ /**
2007
+ * Calculate the extent for the current view state and the passed box size.
2008
+ * @param {import("./size.js").Size} [size] The pixel dimensions of the box
2009
+ * into which the calculated extent should fit. Defaults to the size of the
2010
+ * map the view is associated with.
2011
+ * If no map or multiple maps are connected to the view, provide the desired
2012
+ * box size (e.g. `map.getSize()`).
2013
+ * @return {import("./extent.js").Extent} Extent.
2014
+ * @api
2015
+ */
2016
+ calculateExtent(t) {
2017
+ const e = this.calculateExtentInternal(t);
2018
+ return kt(e, this.getProjection());
2019
+ }
2020
+ /**
2021
+ * @param {import("./size.js").Size} [size] Box pixel size. If not provided,
2022
+ * the map's last known viewport size will be used.
2023
+ * @return {import("./extent.js").Extent} Extent.
2024
+ */
2025
+ calculateExtentInternal(t) {
2026
+ t = t || this.getViewportSizeMinusPadding_();
2027
+ const e = (
2028
+ /** @type {!import("./coordinate.js").Coordinate} */
2029
+ this.getCenterInternal()
2030
+ );
2031
+ N(e, "The view center is not defined");
2032
+ const n = (
2033
+ /** @type {!number} */
2034
+ this.getResolution()
2035
+ );
2036
+ N(n !== void 0, "The view resolution is not defined");
2037
+ const i = (
2038
+ /** @type {!number} */
2039
+ this.getRotation()
2040
+ );
2041
+ return N(i !== void 0, "The view rotation is not defined"), Ut(e, n, i, t);
2042
+ }
2043
+ /**
2044
+ * Get the maximum resolution of the view.
2045
+ * @return {number} The maximum resolution of the view.
2046
+ * @api
2047
+ */
2048
+ getMaxResolution() {
2049
+ return this.maxResolution_;
2050
+ }
2051
+ /**
2052
+ * Get the minimum resolution of the view.
2053
+ * @return {number} The minimum resolution of the view.
2054
+ * @api
2055
+ */
2056
+ getMinResolution() {
2057
+ return this.minResolution_;
2058
+ }
2059
+ /**
2060
+ * Get the maximum zoom level for the view.
2061
+ * @return {number} The maximum zoom level.
2062
+ * @api
2063
+ */
2064
+ getMaxZoom() {
2065
+ return (
2066
+ /** @type {number} */
2067
+ this.getZoomForResolution(this.minResolution_)
2068
+ );
2069
+ }
2070
+ /**
2071
+ * Set a new maximum zoom level for the view.
2072
+ * @param {number} zoom The maximum zoom level.
2073
+ * @api
2074
+ */
2075
+ setMaxZoom(t) {
2076
+ this.applyOptions_(this.getUpdatedOptions_({ maxZoom: t }));
2077
+ }
2078
+ /**
2079
+ * Get the minimum zoom level for the view.
2080
+ * @return {number} The minimum zoom level.
2081
+ * @api
2082
+ */
2083
+ getMinZoom() {
2084
+ return (
2085
+ /** @type {number} */
2086
+ this.getZoomForResolution(this.maxResolution_)
2087
+ );
2088
+ }
2089
+ /**
2090
+ * Set a new minimum zoom level for the view.
2091
+ * @param {number} zoom The minimum zoom level.
2092
+ * @api
2093
+ */
2094
+ setMinZoom(t) {
2095
+ this.applyOptions_(this.getUpdatedOptions_({ minZoom: t }));
2096
+ }
2097
+ /**
2098
+ * Set whether the view should allow intermediary zoom levels.
2099
+ * @param {boolean} enabled Whether the resolution is constrained.
2100
+ * @api
2101
+ */
2102
+ setConstrainResolution(t) {
2103
+ this.applyOptions_(this.getUpdatedOptions_({ constrainResolution: t }));
2104
+ }
2105
+ /**
2106
+ * Get the view projection.
2107
+ * @return {import("./proj/Projection.js").default} The projection of the view.
2108
+ * @api
2109
+ */
2110
+ getProjection() {
2111
+ return this.projection_;
2112
+ }
2113
+ /**
2114
+ * Get the view resolution.
2115
+ * @return {number|undefined} The resolution of the view.
2116
+ * @observable
2117
+ * @api
2118
+ */
2119
+ getResolution() {
2120
+ return (
2121
+ /** @type {number|undefined} */
2122
+ this.get(M.RESOLUTION)
2123
+ );
2124
+ }
2125
+ /**
2126
+ * Get the resolutions for the view. This returns the array of resolutions
2127
+ * passed to the constructor of the View, or undefined if none were given.
2128
+ * @return {Array<number>|undefined} The resolutions of the view.
2129
+ * @api
2130
+ */
2131
+ getResolutions() {
2132
+ return this.resolutions_;
2133
+ }
2134
+ /**
2135
+ * Get the resolution for a provided extent (in map units) and size (in pixels).
2136
+ * @param {import("./extent.js").Extent} extent Extent.
2137
+ * @param {import("./size.js").Size} [size] Box pixel size.
2138
+ * @return {number} The resolution at which the provided extent will render at
2139
+ * the given size.
2140
+ * @api
2141
+ */
2142
+ getResolutionForExtent(t, e) {
2143
+ return this.getResolutionForExtentInternal(
2144
+ E(t, this.getProjection()),
2145
+ e
2146
+ );
2147
+ }
2148
+ /**
2149
+ * Get the resolution for a provided extent (in map units) and size (in pixels).
2150
+ * @param {import("./extent.js").Extent} extent Extent.
2151
+ * @param {import("./size.js").Size} [size] Box pixel size.
2152
+ * @return {number} The resolution at which the provided extent will render at
2153
+ * the given size.
2154
+ */
2155
+ getResolutionForExtentInternal(t, e) {
2156
+ e = e || this.getViewportSizeMinusPadding_();
2157
+ const n = G(t) / e[0], i = F(t) / e[1];
2158
+ return Math.max(n, i);
2159
+ }
2160
+ /**
2161
+ * Return a function that returns a value between 0 and 1 for a
2162
+ * resolution. Exponential scaling is assumed.
2163
+ * @param {number} [power] Power.
2164
+ * @return {function(number): number} Resolution for value function.
2165
+ */
2166
+ getResolutionForValueFunction(t) {
2167
+ t = t || 2;
2168
+ const e = this.getConstrainedResolution(this.maxResolution_), n = this.minResolution_, i = Math.log(e / n) / Math.log(t);
2169
+ return (
2170
+ /**
2171
+ * @param {number} value Value.
2172
+ * @return {number} Resolution.
2173
+ */
2174
+ (function(r) {
2175
+ return e / Math.pow(t, r * i);
2176
+ })
2177
+ );
2178
+ }
2179
+ /**
2180
+ * Get the view rotation.
2181
+ * @return {number} The rotation of the view in radians.
2182
+ * @observable
2183
+ * @api
2184
+ */
2185
+ getRotation() {
2186
+ return (
2187
+ /** @type {number} */
2188
+ this.get(M.ROTATION)
2189
+ );
2190
+ }
2191
+ /**
2192
+ * Return a function that returns a resolution for a value between
2193
+ * 0 and 1. Exponential scaling is assumed.
2194
+ * @param {number} [power] Power.
2195
+ * @return {function(number): number} Value for resolution function.
2196
+ */
2197
+ getValueForResolutionFunction(t) {
2198
+ const e = Math.log(t || 2), n = this.getConstrainedResolution(this.maxResolution_), i = this.minResolution_, r = Math.log(n / i) / e;
2199
+ return (
2200
+ /**
2201
+ * @param {number} resolution Resolution.
2202
+ * @return {number} Value.
2203
+ */
2204
+ (function(o) {
2205
+ return Math.log(n / o) / e / r;
2206
+ })
2207
+ );
2208
+ }
2209
+ /**
2210
+ * Returns the size of the viewport minus padding.
2211
+ * @private
2212
+ * @param {number} [rotation] Take into account the rotation of the viewport when giving the size
2213
+ * @return {import("./size.js").Size} Viewport size reduced by the padding.
2214
+ */
2215
+ getViewportSizeMinusPadding_(t) {
2216
+ let e = this.getViewportSize_(t);
2217
+ const n = this.padding_;
2218
+ return n && (e = [
2219
+ e[0] - n[1] - n[3],
2220
+ e[1] - n[0] - n[2]
2221
+ ]), e;
2222
+ }
2223
+ /**
2224
+ * @return {State} View state.
2225
+ */
2226
+ getState() {
2227
+ const t = this.getProjection(), e = this.getResolution(), n = this.getRotation();
2228
+ let i = (
2229
+ /** @type {import("./coordinate.js").Coordinate} */
2230
+ this.getCenterInternal()
2231
+ );
2232
+ const r = this.padding_;
2233
+ if (r) {
2234
+ const o = this.getViewportSizeMinusPadding_();
2235
+ i = X(
2236
+ i,
2237
+ this.getViewportSize_(),
2238
+ [o[0] / 2 + r[3], o[1] / 2 + r[0]],
2239
+ e,
2240
+ n
2241
+ );
2242
+ }
2243
+ return {
2244
+ center: i.slice(0),
2245
+ projection: t !== void 0 ? t : null,
2246
+ resolution: e,
2247
+ nextCenter: this.nextCenter_,
2248
+ nextResolution: this.nextResolution_,
2249
+ nextRotation: this.nextRotation_,
2250
+ rotation: n,
2251
+ zoom: this.getZoom()
2252
+ };
2253
+ }
2254
+ /**
2255
+ * @return {ViewStateLayerStateExtent} Like `FrameState`, but just `viewState` and `extent`.
2256
+ */
2257
+ getViewStateAndExtent() {
2258
+ return {
2259
+ viewState: this.getState(),
2260
+ extent: this.calculateExtent()
2261
+ };
2262
+ }
2263
+ /**
2264
+ * Get the current zoom level. This method may return non-integer zoom levels
2265
+ * if the view does not constrain the resolution, or if an interaction or
2266
+ * animation is underway.
2267
+ * @return {number|undefined} Zoom.
2268
+ * @api
2269
+ */
2270
+ getZoom() {
2271
+ let t;
2272
+ const e = this.getResolution();
2273
+ return e !== void 0 && (t = this.getZoomForResolution(e)), t;
2274
+ }
2275
+ /**
2276
+ * Get the zoom level for a resolution.
2277
+ * @param {number} resolution The resolution.
2278
+ * @return {number|undefined} The zoom level for the provided resolution.
2279
+ * @api
2280
+ */
2281
+ getZoomForResolution(t) {
2282
+ let e = this.minZoom_ || 0, n, i;
2283
+ if (this.resolutions_) {
2284
+ const r = rt(this.resolutions_, t, 1);
2285
+ e = r, n = this.resolutions_[r], r == this.resolutions_.length - 1 ? i = 2 : i = n / this.resolutions_[r + 1];
2286
+ } else
2287
+ n = this.maxResolution_, i = this.zoomFactor_;
2288
+ return e + Math.log(n / t) / Math.log(i);
2289
+ }
2290
+ /**
2291
+ * Get the resolution for a zoom level.
2292
+ * @param {number} zoom Zoom level.
2293
+ * @return {number} The view resolution for the provided zoom level.
2294
+ * @api
2295
+ */
2296
+ getResolutionForZoom(t) {
2297
+ if (this.resolutions_?.length) {
2298
+ if (this.resolutions_.length === 1)
2299
+ return this.resolutions_[0];
2300
+ const e = p(
2301
+ Math.floor(t),
2302
+ 0,
2303
+ this.resolutions_.length - 2
2304
+ ), n = this.resolutions_[e] / this.resolutions_[e + 1];
2305
+ return this.resolutions_[e] / Math.pow(n, p(t - e, 0, 1));
2306
+ }
2307
+ return this.maxResolution_ / Math.pow(this.zoomFactor_, t - this.minZoom_);
2308
+ }
2309
+ /**
2310
+ * Fit the given geometry or extent based on the given map size and border.
2311
+ * The size is pixel dimensions of the box to fit the extent into.
2312
+ * In most cases you will want to use the map size, that is `map.getSize()`.
2313
+ * Takes care of the map angle.
2314
+ * @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or
2315
+ * extent to fit the view to.
2316
+ * @param {FitOptions} [options] Options.
2317
+ * @api
2318
+ */
2319
+ fit(t, e) {
2320
+ let n;
2321
+ if (N(
2322
+ Array.isArray(t) || typeof /** @type {?} */
2323
+ t.getSimplifiedGeometry == "function",
2324
+ "Invalid extent or geometry provided as `geometry`"
2325
+ ), Array.isArray(t)) {
2326
+ N(
2327
+ !ot(t),
2328
+ "Cannot fit empty extent provided as `geometry`"
2329
+ );
2330
+ const i = E(t, this.getProjection());
2331
+ n = tt(i);
2332
+ } else if (t.getType() === "Circle") {
2333
+ const i = E(
2334
+ t.getExtent(),
2335
+ this.getProjection()
2336
+ );
2337
+ n = tt(i), n.rotate(this.getRotation(), S(i));
2338
+ } else
2339
+ n = t;
2340
+ this.fitInternal(n, e);
2341
+ }
2342
+ /**
2343
+ * Calculate rotated extent
2344
+ * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
2345
+ * @return {import("./extent").Extent} The rotated extent for the geometry.
2346
+ */
2347
+ rotatedExtentForGeometry(t) {
2348
+ const e = this.getRotation(), n = Math.cos(e), i = Math.sin(-e), r = t.getFlatCoordinates(), o = t.getStride();
2349
+ let l = 1 / 0, a = 1 / 0, c = -1 / 0, h = -1 / 0;
2350
+ for (let u = 0, g = r.length; u < g; u += o) {
2351
+ const d = r[u] * n - r[u + 1] * i, f = r[u] * i + r[u + 1] * n;
2352
+ l = Math.min(l, d), a = Math.min(a, f), c = Math.max(c, d), h = Math.max(h, f);
2353
+ }
2354
+ return [l, a, c, h];
2355
+ }
2356
+ /**
2357
+ * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
2358
+ * @param {FitOptions} [options] Options.
2359
+ */
2360
+ fitInternal(t, e) {
2361
+ e = e || {};
2362
+ let n = e.size;
2363
+ n || (n = this.getViewportSizeMinusPadding_());
2364
+ const i = e.padding !== void 0 ? e.padding : [0, 0, 0, 0], r = e.nearest !== void 0 ? e.nearest : !1;
2365
+ let o;
2366
+ e.minResolution !== void 0 ? o = e.minResolution : e.maxZoom !== void 0 ? o = this.getResolutionForZoom(e.maxZoom) : o = 0;
2367
+ const l = this.rotatedExtentForGeometry(t);
2368
+ let a = this.getResolutionForExtentInternal(l, [
2369
+ n[0] - i[1] - i[3],
2370
+ n[1] - i[0] - i[2]
2371
+ ]);
2372
+ a = isNaN(a) ? o : Math.max(a, o), a = this.getConstrainedResolution(a, r ? 0 : 1);
2373
+ const c = this.getRotation(), h = Math.sin(c), u = Math.cos(c), g = S(l);
2374
+ g[0] += (i[1] - i[3]) / 2 * a, g[1] += (i[0] - i[2]) / 2 * a;
2375
+ const d = g[0] * u - g[1] * h, f = g[1] * u + g[0] * h, R = this.getConstrainedCenter([d, f], a), _ = e.callback ? e.callback : Dt;
2376
+ e.duration !== void 0 ? this.animateInternal(
2377
+ {
2378
+ resolution: a,
2379
+ center: R,
2380
+ duration: e.duration,
2381
+ easing: e.easing
2382
+ },
2383
+ _
2384
+ ) : (this.targetResolution_ = a, this.targetCenter_ = R, this.applyTargetState_(!1, !0), v(_, !0));
2385
+ }
2386
+ /**
2387
+ * Center on coordinate and view position.
2388
+ * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
2389
+ * @param {import("./size.js").Size} size Box pixel size.
2390
+ * @param {import("./pixel.js").Pixel} position Position on the view to center on.
2391
+ * @api
2392
+ */
2393
+ centerOn(t, e, n) {
2394
+ this.centerOnInternal(
2395
+ y(t, this.getProjection()),
2396
+ e,
2397
+ n
2398
+ );
2399
+ }
2400
+ /**
2401
+ * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
2402
+ * @param {import("./size.js").Size} size Box pixel size.
2403
+ * @param {import("./pixel.js").Pixel} position Position on the view to center on.
2404
+ */
2405
+ centerOnInternal(t, e, n) {
2406
+ this.setCenterInternal(
2407
+ X(
2408
+ t,
2409
+ e,
2410
+ n,
2411
+ this.getResolution(),
2412
+ this.getRotation()
2413
+ )
2414
+ );
2415
+ }
2416
+ /**
2417
+ * Calculates the shift between map and viewport center.
2418
+ * @param {import("./coordinate.js").Coordinate} center Center.
2419
+ * @param {number} resolution Resolution.
2420
+ * @param {number} rotation Rotation.
2421
+ * @param {import("./size.js").Size} size Size.
2422
+ * @return {Array<number>|undefined} Center shift.
2423
+ */
2424
+ calculateCenterShift(t, e, n, i) {
2425
+ let r;
2426
+ const o = this.padding_;
2427
+ if (o && t) {
2428
+ const l = this.getViewportSizeMinusPadding_(-n), a = X(
2429
+ t,
2430
+ i,
2431
+ [l[0] / 2 + o[3], l[1] / 2 + o[0]],
2432
+ e,
2433
+ n
2434
+ );
2435
+ r = [
2436
+ t[0] - a[0],
2437
+ t[1] - a[1]
2438
+ ];
2439
+ }
2440
+ return r;
2441
+ }
2442
+ /**
2443
+ * @return {boolean} Is defined.
2444
+ */
2445
+ isDef() {
2446
+ return !!this.getCenterInternal() && this.getResolution() !== void 0;
2447
+ }
2448
+ /**
2449
+ * Adds relative coordinates to the center of the view. Any extent constraint will apply.
2450
+ * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
2451
+ * @api
2452
+ */
2453
+ adjustCenter(t) {
2454
+ const e = K(this.targetCenter_, this.getProjection());
2455
+ this.setCenter([
2456
+ e[0] + t[0],
2457
+ e[1] + t[1]
2458
+ ]);
2459
+ }
2460
+ /**
2461
+ * Adds relative coordinates to the center of the view. Any extent constraint will apply.
2462
+ * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
2463
+ */
2464
+ adjustCenterInternal(t) {
2465
+ const e = this.targetCenter_;
2466
+ this.setCenterInternal([
2467
+ e[0] + t[0],
2468
+ e[1] + t[1]
2469
+ ]);
2470
+ }
2471
+ /**
2472
+ * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
2473
+ * constraint will apply.
2474
+ * @param {number} ratio The ratio to apply on the view resolution.
2475
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
2476
+ * @api
2477
+ */
2478
+ adjustResolution(t, e) {
2479
+ e = e && y(e, this.getProjection()), this.adjustResolutionInternal(t, e);
2480
+ }
2481
+ /**
2482
+ * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
2483
+ * constraint will apply.
2484
+ * @param {number} ratio The ratio to apply on the view resolution.
2485
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
2486
+ */
2487
+ adjustResolutionInternal(t, e) {
2488
+ const n = this.getAnimating() || this.getInteracting(), i = this.getViewportSize_(this.getRotation()), r = this.constraints_.resolution(
2489
+ this.targetResolution_ * t,
2490
+ 0,
2491
+ i,
2492
+ n
2493
+ );
2494
+ e && (this.targetCenter_ = this.calculateCenterZoom(r, e)), this.targetResolution_ *= t, this.applyTargetState_();
2495
+ }
2496
+ /**
2497
+ * Adds a value to the view zoom level, optionally using an anchor. Any resolution
2498
+ * constraint will apply.
2499
+ * @param {number} delta Relative value to add to the zoom level.
2500
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
2501
+ * @api
2502
+ */
2503
+ adjustZoom(t, e) {
2504
+ this.adjustResolution(Math.pow(this.zoomFactor_, -t), e);
2505
+ }
2506
+ /**
2507
+ * Adds a value to the view rotation, optionally using an anchor. Any rotation
2508
+ * constraint will apply.
2509
+ * @param {number} delta Relative value to add to the zoom rotation, in radians.
2510
+ * @param {import("./coordinate.js").Coordinate} [anchor] The rotation center.
2511
+ * @api
2512
+ */
2513
+ adjustRotation(t, e) {
2514
+ e && (e = y(e, this.getProjection())), this.adjustRotationInternal(t, e);
2515
+ }
2516
+ /**
2517
+ * @param {number} delta Relative value to add to the zoom rotation, in radians.
2518
+ * @param {import("./coordinate.js").Coordinate} [anchor] The rotation center.
2519
+ */
2520
+ adjustRotationInternal(t, e) {
2521
+ const n = this.getAnimating() || this.getInteracting(), i = this.constraints_.rotation(
2522
+ this.targetRotation_ + t,
2523
+ n
2524
+ );
2525
+ e && (this.targetCenter_ = this.calculateCenterRotate(i, e)), this.targetRotation_ += t, this.applyTargetState_();
2526
+ }
2527
+ /**
2528
+ * Set the center of the current view. Any extent constraint will apply.
2529
+ * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
2530
+ * @observable
2531
+ * @api
2532
+ */
2533
+ setCenter(t) {
2534
+ this.setCenterInternal(
2535
+ t && y(t, this.getProjection())
2536
+ );
2537
+ }
2538
+ /**
2539
+ * Set the center using the view projection (not the user projection).
2540
+ * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
2541
+ */
2542
+ setCenterInternal(t) {
2543
+ this.targetCenter_ = t, this.applyTargetState_();
2544
+ }
2545
+ /**
2546
+ * @param {import("./ViewHint.js").default} hint Hint.
2547
+ * @param {number} delta Delta.
2548
+ * @return {number} New value.
2549
+ */
2550
+ setHint(t, e) {
2551
+ return this.hints_[t] += e, this.changed(), this.hints_[t];
2552
+ }
2553
+ /**
2554
+ * Set the resolution for this view. Any resolution constraint will apply.
2555
+ * @param {number|undefined} resolution The resolution of the view.
2556
+ * @observable
2557
+ * @api
2558
+ */
2559
+ setResolution(t) {
2560
+ this.targetResolution_ = t, this.applyTargetState_();
2561
+ }
2562
+ /**
2563
+ * Set the rotation for this view. Any rotation constraint will apply.
2564
+ * @param {number} rotation The rotation of the view in radians.
2565
+ * @observable
2566
+ * @api
2567
+ */
2568
+ setRotation(t) {
2569
+ this.targetRotation_ = t, this.applyTargetState_();
2570
+ }
2571
+ /**
2572
+ * Zoom to a specific zoom level. Any resolution constrain will apply.
2573
+ * @param {number} zoom Zoom level.
2574
+ * @api
2575
+ */
2576
+ setZoom(t) {
2577
+ this.setResolution(this.getResolutionForZoom(t));
2578
+ }
2579
+ /**
2580
+ * Recompute rotation/resolution/center based on target values.
2581
+ * Note: we have to compute rotation first, then resolution and center considering that
2582
+ * parameters can influence one another in case a view extent constraint is present.
2583
+ * @param {boolean} [doNotCancelAnims] Do not cancel animations.
2584
+ * @param {boolean} [forceMoving] Apply constraints as if the view is moving.
2585
+ * @private
2586
+ */
2587
+ applyTargetState_(t, e) {
2588
+ const n = this.getAnimating() || this.getInteracting() || e, i = this.constraints_.rotation(
2589
+ this.targetRotation_,
2590
+ n
2591
+ ), r = this.getViewportSize_(i), o = this.constraints_.resolution(
2592
+ this.targetResolution_,
2593
+ 0,
2594
+ r,
2595
+ n
2596
+ ), l = this.constraints_.center(
2597
+ this.targetCenter_,
2598
+ o,
2599
+ r,
2600
+ n,
2601
+ this.calculateCenterShift(
2602
+ this.targetCenter_,
2603
+ o,
2604
+ i,
2605
+ r
2606
+ )
2607
+ );
2608
+ this.get(M.ROTATION) !== i && this.set(M.ROTATION, i), this.get(M.RESOLUTION) !== o && (this.set(M.RESOLUTION, o), this.set("zoom", this.getZoom(), !0)), (!l || !this.get(M.CENTER) || !Y(this.get(M.CENTER), l)) && this.set(M.CENTER, l), this.getAnimating() && !t && this.cancelAnimations(), this.cancelAnchor_ = void 0;
2609
+ }
2610
+ /**
2611
+ * If any constraints need to be applied, an animation will be triggered.
2612
+ * This is typically done on interaction end.
2613
+ * Note: calling this with a duration of 0 will apply the constrained values straight away,
2614
+ * without animation.
2615
+ * @param {number} [duration] The animation duration in ms.
2616
+ * @param {number} [resolutionDirection] Which direction to zoom.
2617
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
2618
+ */
2619
+ resolveConstraints(t, e, n) {
2620
+ t = t !== void 0 ? t : 200;
2621
+ const i = e || 0, r = this.constraints_.rotation(this.targetRotation_), o = this.getViewportSize_(r), l = this.constraints_.resolution(
2622
+ this.targetResolution_,
2623
+ i,
2624
+ o
2625
+ ), a = this.constraints_.center(
2626
+ this.targetCenter_,
2627
+ l,
2628
+ o,
2629
+ !1,
2630
+ this.calculateCenterShift(
2631
+ this.targetCenter_,
2632
+ l,
2633
+ r,
2634
+ o
2635
+ )
2636
+ );
2637
+ if (t === 0 && !this.cancelAnchor_) {
2638
+ this.targetResolution_ = l, this.targetRotation_ = r, this.targetCenter_ = a, this.applyTargetState_();
2639
+ return;
2640
+ }
2641
+ n = n || (t === 0 ? this.cancelAnchor_ : void 0), this.cancelAnchor_ = void 0, (this.getResolution() !== l || this.getRotation() !== r || !this.getCenterInternal() || !Y(this.getCenterInternal(), a)) && (this.getAnimating() && this.cancelAnimations(), this.animateInternal({
2642
+ rotation: r,
2643
+ center: a,
2644
+ resolution: l,
2645
+ duration: t,
2646
+ easing: Bt,
2647
+ anchor: n
2648
+ }));
2649
+ }
2650
+ /**
2651
+ * Notify the View that an interaction has started.
2652
+ * The view state will be resolved to a stable one if needed
2653
+ * (depending on its constraints).
2654
+ * @api
2655
+ */
2656
+ beginInteraction() {
2657
+ this.resolveConstraints(0), this.setHint(I.INTERACTING, 1);
2658
+ }
2659
+ /**
2660
+ * Notify the View that an interaction has ended. The view state will be resolved
2661
+ * to a stable one if needed (depending on its constraints).
2662
+ * @param {number} [duration] Animation duration in ms.
2663
+ * @param {number} [resolutionDirection] Which direction to zoom.
2664
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
2665
+ * @api
2666
+ */
2667
+ endInteraction(t, e, n) {
2668
+ n = n && y(n, this.getProjection()), this.endInteractionInternal(t, e, n);
2669
+ }
2670
+ /**
2671
+ * Notify the View that an interaction has ended. The view state will be resolved
2672
+ * to a stable one if needed (depending on its constraints).
2673
+ * @param {number} [duration] Animation duration in ms.
2674
+ * @param {number} [resolutionDirection] Which direction to zoom.
2675
+ * @param {import("./coordinate.js").Coordinate} [anchor] The origin of the transformation.
2676
+ */
2677
+ endInteractionInternal(t, e, n) {
2678
+ this.getInteracting() && (this.setHint(I.INTERACTING, -1), this.resolveConstraints(t, e, n));
2679
+ }
2680
+ /**
2681
+ * Get a valid position for the view center according to the current constraints.
2682
+ * @param {import("./coordinate.js").Coordinate|undefined} targetCenter Target center position.
2683
+ * @param {number} [targetResolution] Target resolution. If not supplied, the current one will be used.
2684
+ * This is useful to guess a valid center position at a different zoom level.
2685
+ * @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
2686
+ */
2687
+ getConstrainedCenter(t, e) {
2688
+ const n = this.getViewportSize_(this.getRotation());
2689
+ return this.constraints_.center(
2690
+ t,
2691
+ e || this.getResolution(),
2692
+ n
2693
+ );
2694
+ }
2695
+ /**
2696
+ * Get a valid zoom level according to the current view constraints.
2697
+ * @param {number|undefined} targetZoom Target zoom.
2698
+ * @param {number} [direction] Indicate which resolution should be used
2699
+ * by a renderer if the view resolution does not match any resolution of the tile source.
2700
+ * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
2701
+ * will be used. If -1, the nearest higher resolution will be used.
2702
+ * @return {number|undefined} Valid zoom level.
2703
+ */
2704
+ getConstrainedZoom(t, e) {
2705
+ const n = this.getResolutionForZoom(t);
2706
+ return this.getZoomForResolution(
2707
+ this.getConstrainedResolution(n, e)
2708
+ );
2709
+ }
2710
+ /**
2711
+ * Get a valid resolution according to the current view constraints.
2712
+ * @param {number|undefined} targetResolution Target resolution.
2713
+ * @param {number} [direction] Indicate which resolution should be used
2714
+ * by a renderer if the view resolution does not match any resolution of the tile source.
2715
+ * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
2716
+ * will be used. If -1, the nearest higher resolution will be used.
2717
+ * @return {number|undefined} Valid resolution.
2718
+ */
2719
+ getConstrainedResolution(t, e) {
2720
+ e = e || 0;
2721
+ const n = this.getViewportSize_(this.getRotation());
2722
+ return this.constraints_.resolution(t, e, n);
2723
+ }
2724
+ }
2725
+ function v(s, t) {
2726
+ setTimeout(function() {
2727
+ s(t);
2728
+ }, 0);
2729
+ }
2730
+ function It(s) {
2731
+ if (s.extent !== void 0) {
2732
+ const e = s.smoothExtentConstraint !== void 0 ? s.smoothExtentConstraint : !0;
2733
+ return $(s.extent, s.constrainOnlyCenter, e);
2734
+ }
2735
+ const t = L(s.projection, "EPSG:3857");
2736
+ if (s.multiWorld !== !0 && t.isGlobal()) {
2737
+ const e = t.getExtent().slice();
2738
+ return e[0] = -1 / 0, e[2] = 1 / 0, $(e, !1, !1);
2739
+ }
2740
+ return Qt;
2741
+ }
2742
+ function At(s) {
2743
+ let t, e, n, o = s.minZoom !== void 0 ? s.minZoom : P, l = s.maxZoom !== void 0 ? s.maxZoom : 28;
2744
+ const a = s.zoomFactor !== void 0 ? s.zoomFactor : 2, c = s.multiWorld !== void 0 ? s.multiWorld : !1, h = s.smoothResolutionConstraint !== void 0 ? s.smoothResolutionConstraint : !0, u = s.showFullExtent !== void 0 ? s.showFullExtent : !1, g = L(s.projection, "EPSG:3857"), d = g.getExtent();
2745
+ let f = s.constrainOnlyCenter, R = s.extent;
2746
+ if (!c && !R && g.isGlobal() && (f = !1, R = d), s.resolutions !== void 0) {
2747
+ const _ = s.resolutions;
2748
+ e = _[o], n = _[l] !== void 0 ? _[l] : _[_.length - 1], s.constrainResolution ? t = he(
2749
+ _,
2750
+ h,
2751
+ !f && R,
2752
+ u
2753
+ ) : t = et(
2754
+ e,
2755
+ n,
2756
+ h,
2757
+ !f && R,
2758
+ u
2759
+ );
2760
+ } else {
2761
+ const C = (d ? Math.max(G(d), F(d)) : (
2762
+ // use an extent that can fit the whole world if need be
2763
+ 360 * Lt.degrees / g.getMetersPerUnit()
2764
+ )) / Jt / Math.pow(2, P), m = C / Math.pow(2, 28 - P);
2765
+ e = s.maxResolution, e !== void 0 ? o = 0 : e = C / Math.pow(a, o), n = s.minResolution, n === void 0 && (s.maxZoom !== void 0 ? s.maxResolution !== void 0 ? n = e / Math.pow(a, l) : n = C / Math.pow(a, l) : n = m), l = o + Math.floor(
2766
+ Math.log(e / n) / Math.log(a)
2767
+ ), n = e / Math.pow(a, l - o), s.constrainResolution ? t = ue(
2768
+ a,
2769
+ e,
2770
+ n,
2771
+ h,
2772
+ !f && R,
2773
+ u
2774
+ ) : t = et(
2775
+ e,
2776
+ n,
2777
+ h,
2778
+ !f && R,
2779
+ u
2780
+ );
2781
+ }
2782
+ return {
2783
+ constraint: t,
2784
+ maxResolution: e,
2785
+ minResolution: n,
2786
+ minZoom: o,
2787
+ zoomFactor: a
2788
+ };
2789
+ }
2790
+ function wt(s) {
2791
+ if (s.enableRotation !== void 0 ? s.enableRotation : !0) {
2792
+ const e = s.constrainRotation;
2793
+ return e === void 0 || e === !0 ? de() : e === !1 ? nt : typeof e == "number" ? ge(e) : nt;
2794
+ }
2795
+ return ce;
2796
+ }
2797
+ function Nt(s) {
2798
+ return !(s.sourceCenter && s.targetCenter && !Y(s.sourceCenter, s.targetCenter) || s.sourceResolution !== s.targetResolution || s.sourceRotation !== s.targetRotation);
2799
+ }
2800
+ function X(s, t, e, n, i) {
2801
+ const r = Math.cos(-i);
2802
+ let o = Math.sin(-i), l = s[0] * r - s[1] * o, a = s[1] * r + s[0] * o;
2803
+ l += (t[0] / 2 - e[0]) * n, a += (e[1] - t[1] / 2) * n, o = -o;
2804
+ const c = l * r - a * o, h = a * r + l * o;
2805
+ return [c, h];
2806
+ }
2807
+ const Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2808
+ __proto__: null,
2809
+ createCenterConstraint: It,
2810
+ createResolutionConstraint: At,
2811
+ createRotationConstraint: wt,
2812
+ default: fe,
2813
+ isNoopAnimation: Nt
2814
+ }, Symbol.toStringTag, { value: "Module" }));
2815
+ export {
2816
+ A,
2817
+ me as B,
2818
+ J as C,
2819
+ yt as D,
2820
+ b as E,
2821
+ oe as F,
2822
+ se as G,
2823
+ fe as H,
2824
+ M as I,
2825
+ tt as J,
2826
+ ce as K,
2827
+ T as L,
2828
+ Te as M,
2829
+ V as P,
2830
+ O as S,
2831
+ I as V,
2832
+ dt as a,
2833
+ xt as b,
2834
+ Rt as c,
2835
+ re as d,
2836
+ gt as e,
2837
+ ft as f,
2838
+ Ct as g,
2839
+ Ie as h,
2840
+ mt as i,
2841
+ _t as j,
2842
+ xe as k,
2843
+ Me as l,
2844
+ ct as m,
2845
+ Ce as n,
2846
+ je as o,
2847
+ ye as p,
2848
+ we as q,
2849
+ te as r,
2850
+ Ne as s,
2851
+ Ae as t,
2852
+ Z as u,
2853
+ pe as v,
2854
+ pt as w,
2855
+ Fe as x,
2856
+ lt as y,
2857
+ Mt as z
2858
+ };