@hybridcore/ui 1.6.13 → 1.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/AccordionSummary-DUtr16g6.js +781 -0
  2. package/dist/Add-Bk8R160M.js +403 -0
  3. package/dist/Button-Cem3nbwc.js +357 -0
  4. package/dist/ButtonBase-DObmf4Q_.js +886 -0
  5. package/dist/Delete-CVJ6FeDn.js +203 -0
  6. package/dist/FormGroup-BRj1o7-E.js +89 -0
  7. package/dist/InputLabel-CjD30ZHz.js +341 -0
  8. package/dist/MenuItem-BKvRGLvM.js +233 -0
  9. package/dist/Modal-BVYydOr5.js +1156 -0
  10. package/dist/Paper-B1HV8GyO.js +582 -0
  11. package/dist/Select-Bfhvigsx.js +3914 -0
  12. package/dist/Source-BSZST_GH.js +4410 -0
  13. package/dist/SwitchBase-BEK49kdS.js +235 -0
  14. package/dist/Text-ChJRuaD8.js +2197 -0
  15. package/dist/TextField-Ca9ykixI.js +696 -0
  16. package/dist/TransitionGroupContext-Ja2CgIob.js +96 -0
  17. package/dist/Typography-D3X-Y5fh.js +178 -0
  18. package/dist/Vector-BmuhQO4p.js +3606 -0
  19. package/dist/Vector-DfTqQEln.js +1735 -0
  20. package/dist/WKT-2wsDT-nq.js +2310 -0
  21. package/dist/{_commonjsHelpers-BVfed4GL.js → _commonjsHelpers-BkfeUUK-.js} +2 -2
  22. package/dist/assertThisInitialized-C1dAyb4j.js +7 -0
  23. package/dist/assets/index.css +1 -1
  24. package/dist/assets/index2.css +1 -1
  25. package/dist/assets/index3.css +1 -0
  26. package/dist/assets/index4.css +1 -0
  27. package/dist/clsx-OuTLNxxd.js +16 -0
  28. package/dist/components/button/styled.js +1 -1
  29. package/dist/components/charts/_common/format.js +126 -82
  30. package/dist/components/charts/_common/tooltip.js +44 -35
  31. package/dist/components/charts/chart-wrapper/index.js +44 -43
  32. package/dist/components/charts/donut-chart/logic.js +53 -40
  33. package/dist/components/charts/drill-down-voronoi-treemap/logic.js +1 -1
  34. package/dist/components/charts/xy-chart/logic.js +135 -134
  35. package/dist/components/collapsible-card/index.js +30 -21
  36. package/dist/components/collapsible-card/styled.js +14 -16
  37. package/dist/components/color-picker/index.js +3358 -2228
  38. package/dist/components/color-picker/styled.js +7 -87
  39. package/dist/components/confirm/dialog.js +7 -89
  40. package/dist/components/confirm/index.js +1 -1
  41. package/dist/components/data-map/index.js +1 -1
  42. package/dist/components/data-map/logic.js +20 -20
  43. package/dist/components/data-security-selectors/dissemination-list/index.js +3117 -32
  44. package/dist/components/date-range-picker/index.js +454 -466
  45. package/dist/components/document-viewer/components/viewer/index.js +1 -1
  46. package/dist/components/duration-select/index.js +10 -10
  47. package/dist/components/duration-select/styled.js +1 -1
  48. package/dist/components/geometry-picker/coordinate/index.js +14 -14
  49. package/dist/components/geometry-picker/edit/index.js +1 -1
  50. package/dist/components/geometry-picker/geometry/index.js +1 -1
  51. package/dist/components/geometry-picker/kml/index.js +11 -11
  52. package/dist/components/geometry-picker/map/logic.js +3656 -145
  53. package/dist/components/geometry-picker/map/style.js +17 -18
  54. package/dist/components/geometry-picker/parser/coordinate-input/logic.js +1255 -43
  55. package/dist/components/heat-map/index.js +1 -1
  56. package/dist/components/heat-map/logic.js +1924 -77
  57. package/dist/components/instance-form/components/composite-matrix/components/json-editor/index.js +8737 -8722
  58. package/dist/components/instance-hierarchy-table/styled.js +16 -18
  59. package/dist/components/map/helpers/mapbox.js +15 -17
  60. package/dist/components/map/helpers/ol.js +27 -386
  61. package/dist/components/map/index.js +10 -11
  62. package/dist/components/map/logic.js +22 -22
  63. package/dist/components/map/styled.js +27 -31
  64. package/dist/components/phone-input/index.js +9 -10
  65. package/dist/components/property-mapping/index.js +1 -1
  66. package/dist/components/prr-map/index.js +1 -1
  67. package/dist/components/prr-map/logic.js +26 -27
  68. package/dist/components/raster-grid-map/index.js +1 -1
  69. package/dist/components/raster-grid-map/logic.js +57 -60
  70. package/dist/components/sortable-list/index.js +1264 -1091
  71. package/dist/components/template-form/components/property-list/index.js +32 -36
  72. package/dist/components/template-form/components/property-list/property-list-columns.js +17 -19
  73. package/dist/components/template-form/components/property-list/property-list-form.js +600 -137
  74. package/dist/components/template-form/components/recognition-property-list/index.js +36 -40
  75. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-columns.js +9 -11
  76. package/dist/components/template-form/components/recognition-property-list/recognition-property-list-form.js +64 -57
  77. package/dist/components/tree-select/index.js +16 -16
  78. package/dist/createChainedFunction-C0nujS3O.js +9 -0
  79. package/dist/createSvgIcon-BghzB2Y9.js +93 -0
  80. package/dist/createSvgIcon-D7U1nd99.js +185 -0
  81. package/dist/debounce-46wSf_lW.js +15 -0
  82. package/dist/dialog-BtJhjyF5.js +664 -0
  83. package/dist/extends-C3382pL0.js +22 -0
  84. package/dist/formControlState-vgaj2ksH.js +10 -0
  85. package/dist/generateUtilityClasses-Cc-owZ4J.js +2971 -0
  86. package/dist/{index-C__OZmYy.js → index-CblbdqjE.js} +1 -1
  87. package/dist/index-DH6qsPBn.js +153 -0
  88. package/dist/index.esm-DAf19hyR.js +318 -0
  89. package/dist/main.d.ts +9 -1
  90. package/dist/math-Bvt2Ubuz.js +704 -0
  91. package/dist/ol-yOE-NV0X.js +7465 -0
  92. package/dist/ownerWindow-wg6foiOE.js +10 -0
  93. package/dist/setPrototypeOf-NPgp4cYc.js +8 -0
  94. package/dist/styled-DD4BkuVf.js +350 -0
  95. package/dist/useControlled-BYdyS7Pn.js +31 -0
  96. package/dist/useFormControl-CatNKXAi.js +10 -0
  97. package/dist/useId-BW-oWmul.js +19 -0
  98. package/dist/useSlot-u4t0X96G.js +42 -0
  99. package/package.json +1 -1
  100. package/dist/index.esm-UfGMjYOL.js +0 -197
@@ -1,98 +1,1945 @@
1
- import { useThemeProps as F, useTheme as _ } from "@mui/material";
2
- import { uniqueId as j, values as C } from "lodash";
3
- import { WKT as O } from "ol/format";
4
- import U from "ol/layer/Heatmap";
5
- import { transformExtent as V } from "ol/proj";
6
- import A from "ol/source/Vector";
7
- import { useRef as u, useState as K, useEffect as h } from "react";
8
- import { DEFAULT_VIRIDIS_COOL as W } from "../charts/_common/utils.js";
9
- import { createMapboxLayer as J } from "../map/helpers/mapbox.js";
10
- import { parse as N } from "../map/helpers/wkt.js";
11
- const ae = (v) => {
12
- const d = F({ props: v, name: "HCHeatMap" }), {
13
- data: i,
14
- payload: s,
15
- onPayloadUpdate: E,
16
- accessToken: P,
17
- gradient: x = W,
18
- sx: w,
19
- ...R
20
- } = d, p = _(), g = u(j("map-")), r = u(null), c = u(null), m = u(null), a = u(null), l = u(), [b, I] = K(!1), L = () => {
21
- if (!b || !r.current || !i || !m.current) return;
22
- const e = new O(), t = i.map((n) => C(n.variables.geometry)[0]).filter((n) => {
1
+ import { useThemeProps as Ie, useTheme as De } from "@mui/material";
2
+ import { uniqueId as Be, values as Me } from "lodash";
3
+ import { L as Ne, R as Y, a as G, B as ve, V as Oe } from "../../Vector-DfTqQEln.js";
4
+ import { W as C, X as ae, Y as Ge, Z as ze, _ as Ee, $ as Ze, a0 as U, y as He, a1 as We, a2 as Xe, a3 as ue, R as ke, a4 as Ve, a5 as he, a6 as je, a7 as Ye, t as Ke } from "../../Source-BSZST_GH.js";
5
+ import { S as qe, a as me, g as L, D as $e, j as Je, k as Qe, l as z, u as et, m as tt } from "../../math-Bvt2Ubuz.js";
6
+ import { d as rt } from "../../Text-ChJRuaD8.js";
7
+ import { useRef as w, useState as nt, useEffect as ce } from "react";
8
+ import { DEFAULT_VIRIDIS_COOL as it } from "../charts/_common/utils.js";
9
+ import { createMapboxLayer as st } from "../map/helpers/mapbox.js";
10
+ import { parse as ot } from "../map/helpers/wkt.js";
11
+ import { W as at } from "../../WKT-2wsDT-nq.js";
12
+ const te = 34962, re = 34963, ut = 35040, ht = 35044, $ = 35048, ct = 5121, ft = 5123, lt = 5125, Te = 5126, fe = ["experimental-webgl", "webgl", "webkit-3d", "moz-webgl"];
13
+ function dt(n, t) {
14
+ t = Object.assign(
15
+ {
16
+ preserveDrawingBuffer: !0,
17
+ antialias: !qe
18
+ // https://bugs.webkit.org/show_bug.cgi?id=237906
19
+ },
20
+ t
21
+ );
22
+ const e = fe.length;
23
+ for (let r = 0; r < e; ++r)
24
+ try {
25
+ const i = n.getContext(fe[r], t);
26
+ if (i)
27
+ return (
28
+ /** @type {!WebGLRenderingContext} */
29
+ i
30
+ );
31
+ } catch {
32
+ }
33
+ return null;
34
+ }
35
+ const xt = {
36
+ STATIC_DRAW: ht,
37
+ STREAM_DRAW: ut,
38
+ DYNAMIC_DRAW: $
39
+ };
40
+ class le {
41
+ /**
42
+ * @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.
43
+ * @param {number} [usage] Intended usage, either `STATIC_DRAW`, `STREAM_DRAW` or `DYNAMIC_DRAW`.
44
+ * Default is `DYNAMIC_DRAW`.
45
+ */
46
+ constructor(t, e) {
47
+ this.array = null, this.type = t, me(t === te || t === re, 62), this.usage = e !== void 0 ? e : xt.STATIC_DRAW;
48
+ }
49
+ /**
50
+ * Populates the buffer with an array of the given size (all values will be zeroes).
51
+ * @param {number} size Array size
52
+ * @return {WebGLArrayBuffer} This
53
+ */
54
+ ofSize(t) {
55
+ return this.array = new (K(this.type))(t), this;
56
+ }
57
+ /**
58
+ * Populates the buffer with an array of the given size.
59
+ * @param {Array<number>} array Numerical array
60
+ * @return {WebGLArrayBuffer} This
61
+ */
62
+ fromArray(t) {
63
+ return this.array = K(this.type).from(t), this;
64
+ }
65
+ /**
66
+ * Populates the buffer with a raw binary array buffer.
67
+ * @param {ArrayBuffer} buffer Raw binary buffer to populate the array with. Note that this buffer must have been
68
+ * initialized for the same typed array class.
69
+ * @return {WebGLArrayBuffer} This
70
+ */
71
+ fromArrayBuffer(t) {
72
+ return this.array = new (K(this.type))(t), this;
73
+ }
74
+ /**
75
+ * @return {number} Buffer type.
76
+ */
77
+ getType() {
78
+ return this.type;
79
+ }
80
+ /**
81
+ * Will return null if the buffer was not initialized
82
+ * @return {Float32Array|Uint32Array} Array.
83
+ */
84
+ getArray() {
85
+ return this.array;
86
+ }
87
+ /**
88
+ * @return {number} Usage.
89
+ */
90
+ getUsage() {
91
+ return this.usage;
92
+ }
93
+ /**
94
+ * Will return 0 if the buffer is not initialized
95
+ * @return {number} Array size
96
+ */
97
+ getSize() {
98
+ return this.array ? this.array.length : 0;
99
+ }
100
+ }
101
+ function K(n) {
102
+ switch (n) {
103
+ case te:
104
+ return Float32Array;
105
+ case re:
106
+ return Uint32Array;
107
+ default:
108
+ return Float32Array;
109
+ }
110
+ }
111
+ const Z = {
112
+ LOST: "webglcontextlost",
113
+ RESTORED: "webglcontextrestored"
114
+ }, _t = `
115
+ precision mediump float;
116
+
117
+ attribute vec2 a_position;
118
+ varying vec2 v_texCoord;
119
+ varying vec2 v_screenCoord;
120
+
121
+ uniform vec2 u_screenSize;
122
+
123
+ void main() {
124
+ v_texCoord = a_position * 0.5 + 0.5;
125
+ v_screenCoord = v_texCoord * u_screenSize;
126
+ gl_Position = vec4(a_position, 0.0, 1.0);
127
+ }
128
+ `, gt = `
129
+ precision mediump float;
130
+
131
+ uniform sampler2D u_image;
132
+ uniform float u_opacity;
133
+
134
+ varying vec2 v_texCoord;
135
+
136
+ void main() {
137
+ gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;
138
+ }
139
+ `;
140
+ class de {
141
+ /**
142
+ * @param {Options} options Options.
143
+ */
144
+ constructor(t) {
145
+ this.gl_ = t.webGlContext;
146
+ const e = this.gl_;
147
+ this.scaleRatio_ = t.scaleRatio || 1, this.renderTargetTexture_ = e.createTexture(), this.renderTargetTextureSize_ = null, this.frameBuffer_ = e.createFramebuffer(), this.depthBuffer_ = e.createRenderbuffer();
148
+ const r = e.createShader(e.VERTEX_SHADER);
149
+ e.shaderSource(
150
+ r,
151
+ t.vertexShader || _t
152
+ ), e.compileShader(r);
153
+ const i = e.createShader(e.FRAGMENT_SHADER);
154
+ e.shaderSource(
155
+ i,
156
+ t.fragmentShader || gt
157
+ ), e.compileShader(i), this.renderTargetProgram_ = e.createProgram(), e.attachShader(this.renderTargetProgram_, r), e.attachShader(this.renderTargetProgram_, i), e.linkProgram(this.renderTargetProgram_), this.renderTargetVerticesBuffer_ = e.createBuffer();
158
+ const s = [-1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1];
159
+ e.bindBuffer(e.ARRAY_BUFFER, this.renderTargetVerticesBuffer_), e.bufferData(
160
+ e.ARRAY_BUFFER,
161
+ new Float32Array(s),
162
+ e.STATIC_DRAW
163
+ ), this.renderTargetAttribLocation_ = e.getAttribLocation(
164
+ this.renderTargetProgram_,
165
+ "a_position"
166
+ ), this.renderTargetUniformLocation_ = e.getUniformLocation(
167
+ this.renderTargetProgram_,
168
+ "u_screenSize"
169
+ ), this.renderTargetOpacityLocation_ = e.getUniformLocation(
170
+ this.renderTargetProgram_,
171
+ "u_opacity"
172
+ ), this.renderTargetTextureLocation_ = e.getUniformLocation(
173
+ this.renderTargetProgram_,
174
+ "u_image"
175
+ ), this.uniforms_ = [], t.uniforms && Object.keys(t.uniforms).forEach((o) => {
176
+ this.uniforms_.push({
177
+ value: t.uniforms[o],
178
+ location: e.getUniformLocation(this.renderTargetProgram_, o)
179
+ });
180
+ });
181
+ }
182
+ /**
183
+ * Get the WebGL rendering context
184
+ * @return {WebGLRenderingContext} The rendering context.
185
+ * @api
186
+ */
187
+ getGL() {
188
+ return this.gl_;
189
+ }
190
+ /**
191
+ * Initialize the render target texture of the post process, make sure it is at the
192
+ * right size and bind it as a render target for the next draw calls.
193
+ * The last step to be initialized will be the one where the primitives are rendered.
194
+ * @param {import("../Map.js").FrameState} frameState current frame state
195
+ * @api
196
+ */
197
+ init(t) {
198
+ const e = this.getGL(), r = [
199
+ e.drawingBufferWidth * this.scaleRatio_,
200
+ e.drawingBufferHeight * this.scaleRatio_
201
+ ];
202
+ if (e.bindFramebuffer(e.FRAMEBUFFER, this.getFrameBuffer()), e.bindRenderbuffer(e.RENDERBUFFER, this.getDepthBuffer()), e.viewport(0, 0, r[0], r[1]), !this.renderTargetTextureSize_ || this.renderTargetTextureSize_[0] !== r[0] || this.renderTargetTextureSize_[1] !== r[1]) {
203
+ this.renderTargetTextureSize_ = r;
204
+ const i = 0, s = e.RGBA, o = 0, a = e.RGBA, u = e.UNSIGNED_BYTE, h = null;
205
+ e.bindTexture(e.TEXTURE_2D, this.renderTargetTexture_), e.texImage2D(
206
+ e.TEXTURE_2D,
207
+ i,
208
+ s,
209
+ r[0],
210
+ r[1],
211
+ o,
212
+ a,
213
+ u,
214
+ h
215
+ ), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.framebufferTexture2D(
216
+ e.FRAMEBUFFER,
217
+ e.COLOR_ATTACHMENT0,
218
+ e.TEXTURE_2D,
219
+ this.renderTargetTexture_,
220
+ 0
221
+ ), e.renderbufferStorage(
222
+ e.RENDERBUFFER,
223
+ e.DEPTH_COMPONENT16,
224
+ r[0],
225
+ r[1]
226
+ ), e.framebufferRenderbuffer(
227
+ e.FRAMEBUFFER,
228
+ e.DEPTH_ATTACHMENT,
229
+ e.RENDERBUFFER,
230
+ this.depthBuffer_
231
+ );
232
+ }
233
+ }
234
+ /**
235
+ * Render to the next postprocessing pass (or to the canvas if final pass).
236
+ * @param {import("../Map.js").FrameState} frameState current frame state
237
+ * @param {WebGLPostProcessingPass} [nextPass] Next pass, optional
238
+ * @param {function(WebGLRenderingContext, import("../Map.js").FrameState):void} [preCompose] Called before composing.
239
+ * @param {function(WebGLRenderingContext, import("../Map.js").FrameState):void} [postCompose] Called before composing.
240
+ * @api
241
+ */
242
+ apply(t, e, r, i) {
243
+ const s = this.getGL(), o = t.size;
244
+ if (s.bindFramebuffer(
245
+ s.FRAMEBUFFER,
246
+ e ? e.getFrameBuffer() : null
247
+ ), s.activeTexture(s.TEXTURE0), s.bindTexture(s.TEXTURE_2D, this.renderTargetTexture_), !e) {
248
+ const u = L(s.canvas);
249
+ if (!t.renderTargets[u]) {
250
+ const h = s.getContextAttributes();
251
+ h && h.preserveDrawingBuffer && (s.clearColor(0, 0, 0, 0), s.clearDepth(1), s.clear(s.COLOR_BUFFER_BIT | s.DEPTH_BUFFER_BIT)), t.renderTargets[u] = !0;
252
+ }
253
+ }
254
+ s.disable(s.DEPTH_TEST), s.enable(s.BLEND), s.blendFunc(s.ONE, s.ONE_MINUS_SRC_ALPHA), s.viewport(0, 0, s.drawingBufferWidth, s.drawingBufferHeight), s.bindBuffer(s.ARRAY_BUFFER, this.renderTargetVerticesBuffer_), s.useProgram(this.renderTargetProgram_), s.enableVertexAttribArray(this.renderTargetAttribLocation_), s.vertexAttribPointer(
255
+ this.renderTargetAttribLocation_,
256
+ 2,
257
+ s.FLOAT,
258
+ !1,
259
+ 0,
260
+ 0
261
+ ), s.uniform2f(this.renderTargetUniformLocation_, o[0], o[1]), s.uniform1i(this.renderTargetTextureLocation_, 0);
262
+ const a = t.layerStatesArray[t.layerIndex].opacity;
263
+ s.uniform1f(this.renderTargetOpacityLocation_, a), this.applyUniforms(t), r && r(s, t), s.drawArrays(s.TRIANGLES, 0, 6), i && i(s, t);
264
+ }
265
+ /**
266
+ * @return {WebGLFramebuffer} Frame buffer
267
+ * @api
268
+ */
269
+ getFrameBuffer() {
270
+ return this.frameBuffer_;
271
+ }
272
+ /**
273
+ * @return {WebGLRenderbuffer} Depth buffer
274
+ * @api
275
+ */
276
+ getDepthBuffer() {
277
+ return this.depthBuffer_;
278
+ }
279
+ /**
280
+ * Sets the custom uniforms based on what was given in the constructor.
281
+ * @param {import("../Map.js").FrameState} frameState Frame state.
282
+ * @private
283
+ */
284
+ applyUniforms(t) {
285
+ const e = this.getGL();
286
+ let r, i = 1;
287
+ this.uniforms_.forEach(function(s) {
288
+ if (r = typeof s.value == "function" ? s.value(t) : s.value, r instanceof HTMLCanvasElement || r instanceof ImageData)
289
+ s.texture || (s.texture = e.createTexture()), e.activeTexture(e[`TEXTURE${i}`]), e.bindTexture(e.TEXTURE_2D, s.texture), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), r instanceof ImageData ? e.texImage2D(
290
+ e.TEXTURE_2D,
291
+ 0,
292
+ e.RGBA,
293
+ e.RGBA,
294
+ r.width,
295
+ r.height,
296
+ 0,
297
+ e.UNSIGNED_BYTE,
298
+ new Uint8Array(r.data)
299
+ ) : e.texImage2D(
300
+ e.TEXTURE_2D,
301
+ 0,
302
+ e.RGBA,
303
+ e.RGBA,
304
+ e.UNSIGNED_BYTE,
305
+ r
306
+ ), e.uniform1i(s.location, i++);
307
+ else if (Array.isArray(r))
308
+ switch (r.length) {
309
+ case 2:
310
+ e.uniform2f(s.location, r[0], r[1]);
311
+ return;
312
+ case 3:
313
+ e.uniform3f(s.location, r[0], r[1], r[2]);
314
+ return;
315
+ case 4:
316
+ e.uniform4f(
317
+ s.location,
318
+ r[0],
319
+ r[1],
320
+ r[2],
321
+ r[3]
322
+ );
323
+ return;
324
+ default:
325
+ return;
326
+ }
327
+ else typeof r == "number" && e.uniform1f(s.location, r);
328
+ });
329
+ }
330
+ }
331
+ function pt() {
332
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
333
+ }
334
+ function q(n, t) {
335
+ return n[0] = t[0], n[1] = t[1], n[4] = t[2], n[5] = t[3], n[12] = t[4], n[13] = t[5], n;
336
+ }
337
+ const A = {
338
+ PROJECTION_MATRIX: "u_projectionMatrix",
339
+ OFFSET_SCALE_MATRIX: "u_offsetScaleMatrix",
340
+ OFFSET_ROTATION_MATRIX: "u_offsetRotateMatrix",
341
+ TIME: "u_time",
342
+ ZOOM: "u_zoom",
343
+ RESOLUTION: "u_resolution",
344
+ VIEWPORT_SIZE_PX: "u_viewportSizePx",
345
+ PIXEL_RATIO: "u_pixelRatio",
346
+ HIT_DETECTION: "u_hitDetection"
347
+ }, F = {
348
+ UNSIGNED_BYTE: ct,
349
+ UNSIGNED_SHORT: ft,
350
+ UNSIGNED_INT: lt,
351
+ FLOAT: Te
352
+ }, X = {};
353
+ function xe(n) {
354
+ return "shared/" + n;
355
+ }
356
+ let _e = 0;
357
+ function vt() {
358
+ const n = "unique/" + _e;
359
+ return _e += 1, n;
360
+ }
361
+ function Et(n) {
362
+ let t = X[n];
363
+ if (!t) {
364
+ const e = document.createElement("canvas");
365
+ e.width = 1, e.height = 1, e.style.position = "absolute", e.style.left = "0", t = { users: 0, context: dt(e) }, X[n] = t;
366
+ }
367
+ return t.users += 1, t.context;
368
+ }
369
+ function mt(n) {
370
+ const t = X[n];
371
+ if (!t || (t.users -= 1, t.users > 0))
372
+ return;
373
+ const e = t.context, r = e.getExtension("WEBGL_lose_context");
374
+ r && r.loseContext();
375
+ const i = e.canvas;
376
+ i.width = 1, i.height = 1, delete X[n];
377
+ }
378
+ class Tt extends $e {
379
+ /**
380
+ * @param {Options} [options] Options.
381
+ */
382
+ constructor(t) {
383
+ super(), t = t || {}, this.boundHandleWebGLContextLost_ = this.handleWebGLContextLost.bind(this), this.boundHandleWebGLContextRestored_ = this.handleWebGLContextRestored.bind(this), this.canvasCacheKey_ = t.canvasCacheKey ? xe(t.canvasCacheKey) : vt(), this.gl_ = Et(this.canvasCacheKey_), this.bufferCache_ = {}, this.extensionCache_ = {}, this.currentProgram_ = null;
384
+ const e = this.gl_.canvas;
385
+ e.addEventListener(
386
+ Z.LOST,
387
+ this.boundHandleWebGLContextLost_
388
+ ), e.addEventListener(
389
+ Z.RESTORED,
390
+ this.boundHandleWebGLContextRestored_
391
+ ), this.offsetRotateMatrix_ = C(), this.offsetScaleMatrix_ = C(), this.tmpMat4_ = pt(), this.uniformLocationsByProgram_ = {}, this.attribLocationsByProgram_ = {}, this.uniforms_ = [], t.uniforms && this.setUniforms(t.uniforms), this.postProcessPasses_ = t.postProcesses ? t.postProcesses.map(
392
+ (r) => new de({
393
+ webGlContext: this.gl_,
394
+ scaleRatio: r.scaleRatio,
395
+ vertexShader: r.vertexShader,
396
+ fragmentShader: r.fragmentShader,
397
+ uniforms: r.uniforms
398
+ })
399
+ ) : [new de({ webGlContext: this.gl_ })], this.shaderCompileErrors_ = null, this.startTime_ = Date.now();
400
+ }
401
+ /**
402
+ * @param {Object<string, UniformValue>} uniforms Uniform definitions.
403
+ */
404
+ setUniforms(t) {
405
+ this.uniforms_ = [];
406
+ for (const e in t)
407
+ this.uniforms_.push({
408
+ name: e,
409
+ value: t[e]
410
+ });
411
+ }
412
+ /**
413
+ * @param {string} canvasCacheKey The canvas cache key.
414
+ * @return {boolean} The provided key matches the one this helper was constructed with.
415
+ */
416
+ canvasCacheKeyMatches(t) {
417
+ return this.canvasCacheKey_ === xe(t);
418
+ }
419
+ /**
420
+ * Get a WebGL extension. If the extension is not supported, null is returned.
421
+ * Extensions are cached after they are enabled for the first time.
422
+ * @param {string} name The extension name.
423
+ * @return {Object|null} The extension or null if not supported.
424
+ */
425
+ getExtension(t) {
426
+ if (t in this.extensionCache_)
427
+ return this.extensionCache_[t];
428
+ const e = this.gl_.getExtension(t);
429
+ return this.extensionCache_[t] = e, e;
430
+ }
431
+ /**
432
+ * Just bind the buffer if it's in the cache. Otherwise create
433
+ * the WebGL buffer, bind it, populate it, and add an entry to
434
+ * the cache.
435
+ * @param {import("./Buffer").default} buffer Buffer.
436
+ */
437
+ bindBuffer(t) {
438
+ const e = this.gl_, r = L(t);
439
+ let i = this.bufferCache_[r];
440
+ if (!i) {
441
+ const s = e.createBuffer();
442
+ i = {
443
+ buffer: t,
444
+ webGlBuffer: s
445
+ }, this.bufferCache_[r] = i;
446
+ }
447
+ e.bindBuffer(t.getType(), i.webGlBuffer);
448
+ }
449
+ /**
450
+ * Update the data contained in the buffer array; this is required for the
451
+ * new data to be rendered
452
+ * @param {import("./Buffer").default} buffer Buffer.
453
+ */
454
+ flushBufferData(t) {
455
+ const e = this.gl_;
456
+ this.bindBuffer(t), e.bufferData(t.getType(), t.getArray(), t.getUsage());
457
+ }
458
+ /**
459
+ * @param {import("./Buffer.js").default} buf Buffer.
460
+ */
461
+ deleteBuffer(t) {
462
+ const e = this.gl_, r = L(t), i = this.bufferCache_[r];
463
+ i && !e.isContextLost() && e.deleteBuffer(i.webGlBuffer), delete this.bufferCache_[r];
464
+ }
465
+ /**
466
+ * Clean up.
467
+ */
468
+ disposeInternal() {
469
+ const t = this.gl_.canvas;
470
+ t.removeEventListener(
471
+ Z.LOST,
472
+ this.boundHandleWebGLContextLost_
473
+ ), t.removeEventListener(
474
+ Z.RESTORED,
475
+ this.boundHandleWebGLContextRestored_
476
+ ), mt(this.canvasCacheKey_), delete this.gl_;
477
+ }
478
+ /**
479
+ * Clear the buffer & set the viewport to draw.
480
+ * Post process passes will be initialized here, the first one being bound as a render target for
481
+ * subsequent draw calls.
482
+ * @param {import("../Map.js").FrameState} frameState current frame state
483
+ * @param {boolean} [disableAlphaBlend] If true, no alpha blending will happen.
484
+ * @param {boolean} [enableDepth] If true, enables depth testing.
485
+ */
486
+ prepareDraw(t, e, r) {
487
+ const i = this.gl_, s = this.getCanvas(), o = t.size, a = t.pixelRatio;
488
+ (s.width !== o[0] * a || s.height !== o[1] * a) && (s.width = o[0] * a, s.height = o[1] * a, s.style.width = o[0] + "px", s.style.height = o[1] + "px");
489
+ for (let u = this.postProcessPasses_.length - 1; u >= 0; u--)
490
+ this.postProcessPasses_[u].init(t);
491
+ i.bindTexture(i.TEXTURE_2D, null), i.clearColor(0, 0, 0, 0), i.depthRange(0, 1), i.clearDepth(1), i.clear(i.COLOR_BUFFER_BIT | i.DEPTH_BUFFER_BIT), i.enable(i.BLEND), i.blendFunc(i.ONE, e ? i.ZERO : i.ONE_MINUS_SRC_ALPHA), r ? (i.enable(i.DEPTH_TEST), i.depthFunc(i.LEQUAL)) : i.disable(i.DEPTH_TEST);
492
+ }
493
+ /**
494
+ * Prepare a program to use a texture.
495
+ * @param {WebGLTexture} texture The texture.
496
+ * @param {number} slot The texture slot.
497
+ * @param {string} uniformName The corresponding uniform name.
498
+ */
499
+ bindTexture(t, e, r) {
500
+ const i = this.gl_;
501
+ i.activeTexture(i.TEXTURE0 + e), i.bindTexture(i.TEXTURE_2D, t), i.uniform1i(this.getUniformLocation(r), e);
502
+ }
503
+ /**
504
+ * Clear the render target & bind it for future draw operations.
505
+ * This is similar to `prepareDraw`, only post processes will not be applied.
506
+ * Note: the whole viewport will be drawn to the render target, regardless of its size.
507
+ * @param {import("../Map.js").FrameState} frameState current frame state
508
+ * @param {import("./RenderTarget.js").default} renderTarget Render target to draw to
509
+ * @param {boolean} [disableAlphaBlend] If true, no alpha blending will happen.
510
+ * @param {boolean} [enableDepth] If true, enables depth testing.
511
+ */
512
+ prepareDrawToRenderTarget(t, e, r, i) {
513
+ const s = this.gl_, o = e.getSize();
514
+ s.bindFramebuffer(s.FRAMEBUFFER, e.getFramebuffer()), s.bindRenderbuffer(s.RENDERBUFFER, e.getDepthbuffer()), s.viewport(0, 0, o[0], o[1]), s.bindTexture(s.TEXTURE_2D, e.getTexture()), s.clearColor(0, 0, 0, 0), s.depthRange(0, 1), s.clearDepth(1), s.clear(s.COLOR_BUFFER_BIT | s.DEPTH_BUFFER_BIT), s.enable(s.BLEND), s.blendFunc(s.ONE, r ? s.ZERO : s.ONE_MINUS_SRC_ALPHA), i ? (s.enable(s.DEPTH_TEST), s.depthFunc(s.LEQUAL)) : s.disable(s.DEPTH_TEST);
515
+ }
516
+ /**
517
+ * Execute a draw call based on the currently bound program, texture, buffers, attributes.
518
+ * @param {number} start Start index.
519
+ * @param {number} end End index.
520
+ */
521
+ drawElements(t, e) {
522
+ const r = this.gl_;
523
+ this.getExtension("OES_element_index_uint");
524
+ const i = r.UNSIGNED_INT, s = 4, o = e - t, a = t * s;
525
+ r.drawElements(r.TRIANGLES, o, i, a);
526
+ }
527
+ /**
528
+ * Apply the successive post process passes which will eventually render to the actual canvas.
529
+ * @param {import("../Map.js").FrameState} frameState current frame state
530
+ * @param {function(WebGLRenderingContext, import("../Map.js").FrameState):void} [preCompose] Called before composing.
531
+ * @param {function(WebGLRenderingContext, import("../Map.js").FrameState):void} [postCompose] Called before composing.
532
+ */
533
+ finalizeDraw(t, e, r) {
534
+ for (let i = 0, s = this.postProcessPasses_.length; i < s; i++)
535
+ i === s - 1 ? this.postProcessPasses_[i].apply(
536
+ t,
537
+ null,
538
+ e,
539
+ r
540
+ ) : this.postProcessPasses_[i].apply(
541
+ t,
542
+ this.postProcessPasses_[i + 1]
543
+ );
544
+ }
545
+ /**
546
+ * @return {HTMLCanvasElement} Canvas.
547
+ */
548
+ getCanvas() {
549
+ return (
550
+ /** @type {HTMLCanvasElement} */
551
+ this.gl_.canvas
552
+ );
553
+ }
554
+ /**
555
+ * Get the WebGL rendering context
556
+ * @return {WebGLRenderingContext} The rendering context.
557
+ */
558
+ getGL() {
559
+ return this.gl_;
560
+ }
561
+ /**
562
+ * Sets the default matrix uniforms for a given frame state. This is called internally in `prepareDraw`.
563
+ * @param {import("../Map.js").FrameState} frameState Frame state.
564
+ */
565
+ applyFrameState(t) {
566
+ const e = t.size, r = t.viewState.rotation, i = t.pixelRatio, s = ae(this.offsetScaleMatrix_);
567
+ Ge(s, 2 / e[0], 2 / e[1]);
568
+ const o = ae(this.offsetRotateMatrix_);
569
+ r !== 0 && ze(o, -r), this.setUniformMatrixValue(
570
+ A.OFFSET_SCALE_MATRIX,
571
+ q(this.tmpMat4_, s)
572
+ ), this.setUniformMatrixValue(
573
+ A.OFFSET_ROTATION_MATRIX,
574
+ q(this.tmpMat4_, o)
575
+ ), this.setUniformFloatValue(
576
+ A.TIME,
577
+ (Date.now() - this.startTime_) * 1e-3
578
+ ), this.setUniformFloatValue(A.ZOOM, t.viewState.zoom), this.setUniformFloatValue(
579
+ A.RESOLUTION,
580
+ t.viewState.resolution
581
+ ), this.setUniformFloatValue(A.PIXEL_RATIO, i), this.setUniformFloatVec2(A.VIEWPORT_SIZE_PX, [
582
+ e[0],
583
+ e[1]
584
+ ]);
585
+ }
586
+ /**
587
+ * Sets the `u_hitDetection` uniform.
588
+ * @param {boolean} enabled Whether to enable the hit detection code path
589
+ */
590
+ applyHitDetectionUniform(t) {
591
+ const e = this.getUniformLocation(A.HIT_DETECTION);
592
+ this.getGL().uniform1i(e, t ? 1 : 0);
593
+ }
594
+ /**
595
+ * Sets the custom uniforms based on what was given in the constructor. This is called internally in `prepareDraw`.
596
+ * @param {import("../Map.js").FrameState} frameState Frame state.
597
+ */
598
+ applyUniforms(t) {
599
+ const e = this.gl_;
600
+ let r, i = 0;
601
+ this.uniforms_.forEach((s) => {
602
+ if (r = typeof s.value == "function" ? s.value(t) : s.value, r instanceof HTMLCanvasElement || r instanceof HTMLImageElement || r instanceof ImageData)
603
+ s.texture || (s.prevValue = void 0, s.texture = e.createTexture()), e.activeTexture(e[`TEXTURE${i}`]), e.bindTexture(e.TEXTURE_2D, s.texture), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), (!(r instanceof HTMLImageElement) || /** @type {HTMLImageElement} */
604
+ r.complete) && s.prevValue !== r && (s.prevValue = r, e.texImage2D(
605
+ e.TEXTURE_2D,
606
+ 0,
607
+ e.RGBA,
608
+ e.RGBA,
609
+ e.UNSIGNED_BYTE,
610
+ r
611
+ )), e.uniform1i(this.getUniformLocation(s.name), i++);
612
+ else if (Array.isArray(r) && r.length === 6)
613
+ this.setUniformMatrixValue(
614
+ s.name,
615
+ q(this.tmpMat4_, r)
616
+ );
617
+ else if (Array.isArray(r) && r.length <= 4)
618
+ switch (r.length) {
619
+ case 2:
620
+ e.uniform2f(
621
+ this.getUniformLocation(s.name),
622
+ r[0],
623
+ r[1]
624
+ );
625
+ return;
626
+ case 3:
627
+ e.uniform3f(
628
+ this.getUniformLocation(s.name),
629
+ r[0],
630
+ r[1],
631
+ r[2]
632
+ );
633
+ return;
634
+ case 4:
635
+ e.uniform4f(
636
+ this.getUniformLocation(s.name),
637
+ r[0],
638
+ r[1],
639
+ r[2],
640
+ r[3]
641
+ );
642
+ return;
643
+ default:
644
+ return;
645
+ }
646
+ else typeof r == "number" && e.uniform1f(this.getUniformLocation(s.name), r);
647
+ });
648
+ }
649
+ /**
650
+ * Set up a program for use. The program will be set as the current one. Then, the uniforms used
651
+ * in the program will be set based on the current frame state and the helper configuration.
652
+ * @param {WebGLProgram} program Program.
653
+ * @param {import("../Map.js").FrameState} frameState Frame state.
654
+ */
655
+ useProgram(t, e) {
656
+ this.gl_.useProgram(t), this.currentProgram_ = t, this.applyFrameState(e), this.applyUniforms(e);
657
+ }
658
+ /**
659
+ * Will attempt to compile a vertex or fragment shader based on source
660
+ * On error, the shader will be returned but
661
+ * `gl.getShaderParameter(shader, gl.COMPILE_STATUS)` will return `true`
662
+ * Use `gl.getShaderInfoLog(shader)` to have details
663
+ * @param {string} source Shader source
664
+ * @param {ShaderType} type VERTEX_SHADER or FRAGMENT_SHADER
665
+ * @return {WebGLShader} Shader object
666
+ */
667
+ compileShader(t, e) {
668
+ const r = this.gl_, i = r.createShader(e);
669
+ return r.shaderSource(i, t), r.compileShader(i), i;
670
+ }
671
+ /**
672
+ * Create a program for a vertex and fragment shader. Throws if shader compilation fails.
673
+ * @param {string} fragmentShaderSource Fragment shader source.
674
+ * @param {string} vertexShaderSource Vertex shader source.
675
+ * @return {WebGLProgram} Program
676
+ */
677
+ getProgram(t, e) {
678
+ const r = this.gl_, i = this.compileShader(
679
+ t,
680
+ r.FRAGMENT_SHADER
681
+ ), s = this.compileShader(
682
+ e,
683
+ r.VERTEX_SHADER
684
+ ), o = r.createProgram();
685
+ if (r.attachShader(o, i), r.attachShader(o, s), r.linkProgram(o), !r.getShaderParameter(i, r.COMPILE_STATUS)) {
686
+ const a = `Fragment shader compilation failed: ${r.getShaderInfoLog(
687
+ i
688
+ )}`;
689
+ throw new Error(a);
690
+ }
691
+ if (r.deleteShader(i), !r.getShaderParameter(s, r.COMPILE_STATUS)) {
692
+ const a = `Vertex shader compilation failed: ${r.getShaderInfoLog(
693
+ s
694
+ )}`;
695
+ throw new Error(a);
696
+ }
697
+ if (r.deleteShader(s), !r.getProgramParameter(o, r.LINK_STATUS)) {
698
+ const a = `GL program linking failed: ${r.getProgramInfoLog(
699
+ o
700
+ )}`;
701
+ throw new Error(a);
702
+ }
703
+ return o;
704
+ }
705
+ /**
706
+ * Will get the location from the shader or the cache
707
+ * @param {string} name Uniform name
708
+ * @return {WebGLUniformLocation} uniformLocation
709
+ */
710
+ getUniformLocation(t) {
711
+ const e = L(this.currentProgram_);
712
+ return this.uniformLocationsByProgram_[e] === void 0 && (this.uniformLocationsByProgram_[e] = {}), this.uniformLocationsByProgram_[e][t] === void 0 && (this.uniformLocationsByProgram_[e][t] = this.gl_.getUniformLocation(this.currentProgram_, t)), this.uniformLocationsByProgram_[e][t];
713
+ }
714
+ /**
715
+ * Will get the location from the shader or the cache
716
+ * @param {string} name Attribute name
717
+ * @return {number} attribLocation
718
+ */
719
+ getAttributeLocation(t) {
720
+ const e = L(this.currentProgram_);
721
+ return this.attribLocationsByProgram_[e] === void 0 && (this.attribLocationsByProgram_[e] = {}), this.attribLocationsByProgram_[e][t] === void 0 && (this.attribLocationsByProgram_[e][t] = this.gl_.getAttribLocation(this.currentProgram_, t)), this.attribLocationsByProgram_[e][t];
722
+ }
723
+ /**
724
+ * Sets the given transform to apply the rotation/translation/scaling of the given frame state.
725
+ * The resulting transform can be used to convert world space coordinates to view coordinates in the [-1, 1] range.
726
+ * @param {import("../Map.js").FrameState} frameState Frame state.
727
+ * @param {import("../transform").Transform} transform Transform to update.
728
+ * @return {import("../transform").Transform} The updated transform object.
729
+ */
730
+ makeProjectionTransform(t, e) {
731
+ const r = t.size, i = t.viewState.rotation, s = t.viewState.resolution, o = t.viewState.center;
732
+ return Ee(
733
+ e,
734
+ 0,
735
+ 0,
736
+ 2 / (s * r[0]),
737
+ 2 / (s * r[1]),
738
+ -i,
739
+ -o[0],
740
+ -o[1]
741
+ ), e;
742
+ }
743
+ /**
744
+ * Give a value for a standard float uniform
745
+ * @param {string} uniform Uniform name
746
+ * @param {number} value Value
747
+ */
748
+ setUniformFloatValue(t, e) {
749
+ this.gl_.uniform1f(this.getUniformLocation(t), e);
750
+ }
751
+ /**
752
+ * Give a value for a vec2 uniform
753
+ * @param {string} uniform Uniform name
754
+ * @param {Array<number>} value Array of length 4.
755
+ */
756
+ setUniformFloatVec2(t, e) {
757
+ this.gl_.uniform2fv(this.getUniformLocation(t), e);
758
+ }
759
+ /**
760
+ * Give a value for a vec4 uniform
761
+ * @param {string} uniform Uniform name
762
+ * @param {Array<number>} value Array of length 4.
763
+ */
764
+ setUniformFloatVec4(t, e) {
765
+ this.gl_.uniform4fv(this.getUniformLocation(t), e);
766
+ }
767
+ /**
768
+ * Give a value for a standard matrix4 uniform
769
+ * @param {string} uniform Uniform name
770
+ * @param {Array<number>} value Matrix value
771
+ */
772
+ setUniformMatrixValue(t, e) {
773
+ this.gl_.uniformMatrix4fv(this.getUniformLocation(t), !1, e);
774
+ }
775
+ /**
776
+ * Will set the currently bound buffer to an attribute of the shader program. Used by `#enableAttributes`
777
+ * internally.
778
+ * @param {string} attribName Attribute name
779
+ * @param {number} size Number of components per attributes
780
+ * @param {number} type UNSIGNED_INT, UNSIGNED_BYTE, UNSIGNED_SHORT or FLOAT
781
+ * @param {number} stride Stride in bytes (0 means attribs are packed)
782
+ * @param {number} offset Offset in bytes
783
+ * @private
784
+ */
785
+ enableAttributeArray_(t, e, r, i, s) {
786
+ const o = this.getAttributeLocation(t);
787
+ o < 0 || (this.gl_.enableVertexAttribArray(o), this.gl_.vertexAttribPointer(o, e, r, !1, i, s));
788
+ }
789
+ /**
790
+ * Will enable the following attributes to be read from the currently bound buffer,
791
+ * i.e. tell the GPU where to read the different attributes in the buffer. An error in the
792
+ * size/type/order of attributes will most likely break the rendering and throw a WebGL exception.
793
+ * @param {Array<AttributeDescription>} attributes Ordered list of attributes to read from the buffer
794
+ */
795
+ enableAttributes(t) {
796
+ const e = yt(t);
797
+ let r = 0;
798
+ for (let i = 0; i < t.length; i++) {
799
+ const s = t[i];
800
+ this.enableAttributeArray_(
801
+ s.name,
802
+ s.size,
803
+ s.type || Te,
804
+ e,
805
+ r
806
+ ), r += s.size * ye(s.type);
807
+ }
808
+ }
809
+ /**
810
+ * WebGL context was lost
811
+ * @private
812
+ */
813
+ handleWebGLContextLost() {
814
+ Je(this.bufferCache_), this.currentProgram_ = null;
815
+ }
816
+ /**
817
+ * WebGL context was restored
818
+ * @private
819
+ */
820
+ handleWebGLContextRestored() {
821
+ }
822
+ /**
823
+ * Will create or reuse a given webgl texture and apply the given size. If no image data
824
+ * specified, the texture will be empty, otherwise image data will be used and the `size`
825
+ * parameter will be ignored.
826
+ * Note: wrap parameters are set to clamp to edge, min filter is set to linear.
827
+ * @param {Array<number>} size Expected size of the texture
828
+ * @param {ImageData|HTMLImageElement|HTMLCanvasElement} [data] Image data/object to bind to the texture
829
+ * @param {WebGLTexture} [texture] Existing texture to reuse
830
+ * @return {WebGLTexture} The generated texture
831
+ */
832
+ createTexture(t, e, r) {
833
+ const i = this.gl_;
834
+ r = r || i.createTexture();
835
+ const s = 0, o = i.RGBA, a = 0, u = i.RGBA, h = i.UNSIGNED_BYTE;
836
+ return i.bindTexture(i.TEXTURE_2D, r), e ? i.texImage2D(i.TEXTURE_2D, s, o, u, h, e) : i.texImage2D(
837
+ i.TEXTURE_2D,
838
+ s,
839
+ o,
840
+ t[0],
841
+ t[1],
842
+ a,
843
+ u,
844
+ h,
845
+ null
846
+ ), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.LINEAR), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_S, i.CLAMP_TO_EDGE), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_T, i.CLAMP_TO_EDGE), r;
847
+ }
848
+ }
849
+ function yt(n) {
850
+ let t = 0;
851
+ for (let e = 0; e < n.length; e++) {
852
+ const r = n[e];
853
+ t += r.size * ye(r.type);
854
+ }
855
+ return t;
856
+ }
857
+ function ye(n) {
858
+ switch (n) {
859
+ case F.UNSIGNED_BYTE:
860
+ return Uint8Array.BYTES_PER_ELEMENT;
861
+ case F.UNSIGNED_SHORT:
862
+ return Uint16Array.BYTES_PER_ELEMENT;
863
+ case F.UNSIGNED_INT:
864
+ return Uint32Array.BYTES_PER_ELEMENT;
865
+ case F.FLOAT:
866
+ default:
867
+ return Float32Array.BYTES_PER_ELEMENT;
868
+ }
869
+ }
870
+ class ne extends Ne {
871
+ /**
872
+ * @param {LayerType} layer Layer.
873
+ * @param {Options} [options] Options.
874
+ */
875
+ constructor(t, e) {
876
+ super(t), e = e || {}, this.inversePixelTransform_ = C(), this.pixelContext_ = null, this.postProcesses_ = e.postProcesses, this.uniforms_ = e.uniforms, this.helper, t.addChangeListener(Ze.MAP, this.removeHelper.bind(this)), this.dispatchPreComposeEvent = this.dispatchPreComposeEvent.bind(this), this.dispatchPostComposeEvent = this.dispatchPostComposeEvent.bind(this);
877
+ }
878
+ /**
879
+ * @param {WebGLRenderingContext} context The WebGL rendering context.
880
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
881
+ * @protected
882
+ */
883
+ dispatchPreComposeEvent(t, e) {
884
+ const r = this.getLayer();
885
+ if (r.hasListener(U.PRECOMPOSE)) {
886
+ const i = new Y(
887
+ U.PRECOMPOSE,
888
+ void 0,
889
+ e,
890
+ t
891
+ );
892
+ r.dispatchEvent(i);
893
+ }
894
+ }
895
+ /**
896
+ * @param {WebGLRenderingContext} context The WebGL rendering context.
897
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
898
+ * @protected
899
+ */
900
+ dispatchPostComposeEvent(t, e) {
901
+ const r = this.getLayer();
902
+ if (r.hasListener(U.POSTCOMPOSE)) {
903
+ const i = new Y(
904
+ U.POSTCOMPOSE,
905
+ void 0,
906
+ e,
907
+ t
908
+ );
909
+ r.dispatchEvent(i);
910
+ }
911
+ }
912
+ /**
913
+ * Reset options (only handles uniforms).
914
+ * @param {Options} options Options.
915
+ */
916
+ reset(t) {
917
+ this.uniforms_ = t.uniforms, this.helper && this.helper.setUniforms(this.uniforms_);
918
+ }
919
+ /**
920
+ * @protected
921
+ */
922
+ removeHelper() {
923
+ this.helper && (this.helper.dispose(), delete this.helper);
924
+ }
925
+ /**
926
+ * Determine whether renderFrame should be called.
927
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
928
+ * @return {boolean} Layer is ready to be rendered.
929
+ */
930
+ prepareFrame(t) {
931
+ if (this.getLayer().getRenderSource()) {
932
+ let e = !0, r = -1, i;
933
+ for (let o = 0, a = t.layerStatesArray.length; o < a; o++) {
934
+ const u = t.layerStatesArray[o].layer, h = u.getRenderer();
935
+ if (!(h instanceof ne)) {
936
+ e = !0;
937
+ continue;
938
+ }
939
+ const f = u.getClassName();
940
+ if ((e || f !== i) && (r += 1, e = !1), i = f, h === this)
941
+ break;
942
+ }
943
+ const s = "map/" + t.mapId + "/group/" + r;
944
+ (!this.helper || !this.helper.canvasCacheKeyMatches(s)) && (this.removeHelper(), this.helper = new Tt({
945
+ postProcesses: this.postProcesses_,
946
+ uniforms: this.uniforms_,
947
+ canvasCacheKey: s
948
+ }), i && (this.helper.getCanvas().className = i), this.afterHelperCreated());
949
+ }
950
+ return this.prepareFrameInternal(t);
951
+ }
952
+ /**
953
+ * @protected
954
+ */
955
+ afterHelperCreated() {
956
+ }
957
+ /**
958
+ * Determine whether renderFrame should be called.
959
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
960
+ * @return {boolean} Layer is ready to be rendered.
961
+ * @protected
962
+ */
963
+ prepareFrameInternal(t) {
964
+ return !0;
965
+ }
966
+ /**
967
+ * Clean up.
968
+ */
969
+ disposeInternal() {
970
+ this.removeHelper(), super.disposeInternal();
971
+ }
972
+ /**
973
+ * @param {import("../../render/EventType.js").default} type Event type.
974
+ * @param {WebGLRenderingContext} context The rendering context.
975
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
976
+ * @private
977
+ */
978
+ dispatchRenderEvent_(t, e, r) {
979
+ const i = this.getLayer();
980
+ if (i.hasListener(t)) {
981
+ Ee(
982
+ this.inversePixelTransform_,
983
+ 0,
984
+ 0,
985
+ r.pixelRatio,
986
+ -r.pixelRatio,
987
+ 0,
988
+ 0,
989
+ -r.size[1]
990
+ );
991
+ const s = new Y(
992
+ t,
993
+ this.inversePixelTransform_,
994
+ r,
995
+ e
996
+ );
997
+ i.dispatchEvent(s);
998
+ }
999
+ }
1000
+ /**
1001
+ * @param {WebGLRenderingContext} context The rendering context.
1002
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
1003
+ * @protected
1004
+ */
1005
+ preRender(t, e) {
1006
+ this.dispatchRenderEvent_(U.PRERENDER, t, e);
1007
+ }
1008
+ /**
1009
+ * @param {WebGLRenderingContext} context The rendering context.
1010
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
1011
+ * @protected
1012
+ */
1013
+ postRender(t, e) {
1014
+ this.dispatchRenderEvent_(U.POSTRENDER, t, e);
1015
+ }
1016
+ }
1017
+ const R = new Uint8Array(4);
1018
+ class Rt {
1019
+ /**
1020
+ * @param {import("./Helper.js").default} helper WebGL helper; mandatory.
1021
+ * @param {Array<number>} [size] Expected size of the render target texture; note: this can be changed later on.
1022
+ */
1023
+ constructor(t, e) {
1024
+ this.helper_ = t;
1025
+ const r = t.getGL();
1026
+ this.texture_ = r.createTexture(), this.framebuffer_ = r.createFramebuffer(), this.depthbuffer_ = r.createRenderbuffer(), this.size_ = e || [1, 1], this.data_ = new Uint8Array(0), this.dataCacheDirty_ = !0, this.updateSize_();
1027
+ }
1028
+ /**
1029
+ * Changes the size of the render target texture. Note: will do nothing if the size
1030
+ * is already the same.
1031
+ * @param {Array<number>} size Expected size of the render target texture
1032
+ * @api
1033
+ */
1034
+ setSize(t) {
1035
+ Qe(t, this.size_) || (this.size_[0] = t[0], this.size_[1] = t[1], this.updateSize_());
1036
+ }
1037
+ /**
1038
+ * Returns the size of the render target texture
1039
+ * @return {Array<number>} Size of the render target texture
1040
+ * @api
1041
+ */
1042
+ getSize() {
1043
+ return this.size_;
1044
+ }
1045
+ /**
1046
+ * This will cause following calls to `#readAll` or `#readPixel` to download the content of the
1047
+ * render target into memory, which is an expensive operation.
1048
+ * This content will be kept in cache but should be cleared after each new render.
1049
+ * @api
1050
+ */
1051
+ clearCachedData() {
1052
+ this.dataCacheDirty_ = !0;
1053
+ }
1054
+ /**
1055
+ * Returns the full content of the frame buffer as a series of r, g, b, a components
1056
+ * in the 0-255 range (unsigned byte).
1057
+ * @return {Uint8Array} Integer array of color values
1058
+ * @api
1059
+ */
1060
+ readAll() {
1061
+ if (this.dataCacheDirty_) {
1062
+ const t = this.size_, e = this.helper_.getGL();
1063
+ e.bindFramebuffer(e.FRAMEBUFFER, this.framebuffer_), e.readPixels(
1064
+ 0,
1065
+ 0,
1066
+ t[0],
1067
+ t[1],
1068
+ e.RGBA,
1069
+ e.UNSIGNED_BYTE,
1070
+ this.data_
1071
+ ), this.dataCacheDirty_ = !1;
1072
+ }
1073
+ return this.data_;
1074
+ }
1075
+ /**
1076
+ * Reads one pixel of the frame buffer as an array of r, g, b, a components
1077
+ * in the 0-255 range (unsigned byte).
1078
+ * If x and/or y are outside of existing data, an array filled with 0 is returned.
1079
+ * @param {number} x Pixel coordinate
1080
+ * @param {number} y Pixel coordinate
1081
+ * @return {Uint8Array} Integer array with one color value (4 components)
1082
+ * @api
1083
+ */
1084
+ readPixel(t, e) {
1085
+ if (t < 0 || e < 0 || t > this.size_[0] || e >= this.size_[1])
1086
+ return R[0] = 0, R[1] = 0, R[2] = 0, R[3] = 0, R;
1087
+ this.readAll();
1088
+ const r = Math.floor(t) + (this.size_[1] - Math.floor(e) - 1) * this.size_[0];
1089
+ return R[0] = this.data_[r * 4], R[1] = this.data_[r * 4 + 1], R[2] = this.data_[r * 4 + 2], R[3] = this.data_[r * 4 + 3], R;
1090
+ }
1091
+ /**
1092
+ * @return {WebGLTexture} Texture to render to
1093
+ */
1094
+ getTexture() {
1095
+ return this.texture_;
1096
+ }
1097
+ /**
1098
+ * @return {WebGLFramebuffer} Frame buffer of the render target
1099
+ */
1100
+ getFramebuffer() {
1101
+ return this.framebuffer_;
1102
+ }
1103
+ /**
1104
+ * @return {WebGLRenderbuffer} Depth buffer of the render target
1105
+ */
1106
+ getDepthbuffer() {
1107
+ return this.depthbuffer_;
1108
+ }
1109
+ /**
1110
+ * @private
1111
+ */
1112
+ updateSize_() {
1113
+ const t = this.size_, e = this.helper_.getGL();
1114
+ this.texture_ = this.helper_.createTexture(t, null, this.texture_), e.bindFramebuffer(e.FRAMEBUFFER, this.framebuffer_), e.viewport(0, 0, t[0], t[1]), e.framebufferTexture2D(
1115
+ e.FRAMEBUFFER,
1116
+ e.COLOR_ATTACHMENT0,
1117
+ e.TEXTURE_2D,
1118
+ this.texture_,
1119
+ 0
1120
+ ), e.bindRenderbuffer(e.RENDERBUFFER, this.depthbuffer_), e.renderbufferStorage(
1121
+ e.RENDERBUFFER,
1122
+ e.DEPTH_COMPONENT16,
1123
+ t[0],
1124
+ t[1]
1125
+ ), e.framebufferRenderbuffer(
1126
+ e.FRAMEBUFFER,
1127
+ e.DEPTH_ATTACHMENT,
1128
+ e.RENDERBUFFER,
1129
+ this.depthbuffer_
1130
+ ), this.data_ = new Uint8Array(t[0] * t[1] * 4);
1131
+ }
1132
+ }
1133
+ const ge = {
1134
+ GENERATE_POLYGON_BUFFERS: "GENERATE_POLYGON_BUFFERS",
1135
+ GENERATE_POINT_BUFFERS: "GENERATE_POINT_BUFFERS",
1136
+ GENERATE_LINE_STRING_BUFFERS: "GENERATE_LINE_STRING_BUFFERS"
1137
+ };
1138
+ var Re = { exports: {} };
1139
+ Re.exports = k;
1140
+ Re.exports.default = k;
1141
+ function k(n, t, e) {
1142
+ e = e || 2;
1143
+ var r = t && t.length, i = r ? t[0] * e : n.length, s = be(n, 0, i, e, !0), o = [];
1144
+ if (!s || s.next === s.prev) return o;
1145
+ var a, u, h, f, c, l, x;
1146
+ if (r && (s = St(n, t, s, e)), n.length > 80 * e) {
1147
+ a = h = n[0], u = f = n[1];
1148
+ for (var d = e; d < i; d += e)
1149
+ c = n[d], l = n[d + 1], c < a && (a = c), l < u && (u = l), c > h && (h = c), l > f && (f = l);
1150
+ x = Math.max(h - a, f - u), x = x !== 0 ? 32767 / x : 0;
1151
+ }
1152
+ return D(s, o, e, a, u, x, 0), o;
1153
+ }
1154
+ function be(n, t, e, r, i) {
1155
+ var s, o;
1156
+ if (i === ee(n, t, e, r) > 0)
1157
+ for (s = t; s < e; s += r) o = pe(s, n[s], n[s + 1], o);
1158
+ else
1159
+ for (s = e - r; s >= t; s -= r) o = pe(s, n[s], n[s + 1], o);
1160
+ return o && V(o, o.next) && (M(o), o = o.next), o;
1161
+ }
1162
+ function P(n, t) {
1163
+ if (!n) return n;
1164
+ t || (t = n);
1165
+ var e = n, r;
1166
+ do
1167
+ if (r = !1, !e.steiner && (V(e, e.next) || p(e.prev, e, e.next) === 0)) {
1168
+ if (M(e), e = t = e.prev, e === e.next) break;
1169
+ r = !0;
1170
+ } else
1171
+ e = e.next;
1172
+ while (r || e !== t);
1173
+ return t;
1174
+ }
1175
+ function D(n, t, e, r, i, s, o) {
1176
+ if (n) {
1177
+ !o && s && It(n, r, i, s);
1178
+ for (var a = n, u, h; n.prev !== n.next; ) {
1179
+ if (u = n.prev, h = n.next, s ? At(n, r, i, s) : bt(n)) {
1180
+ t.push(u.i / e | 0), t.push(n.i / e | 0), t.push(h.i / e | 0), M(n), n = h.next, a = h.next;
1181
+ continue;
1182
+ }
1183
+ if (n = h, n === a) {
1184
+ o ? o === 1 ? (n = Ft(P(n), t, e), D(n, t, e, r, i, s, 2)) : o === 2 && Lt(n, t, e, r, i, s) : D(P(n), t, e, r, i, s, 1);
1185
+ break;
1186
+ }
1187
+ }
1188
+ }
1189
+ }
1190
+ function bt(n) {
1191
+ var t = n.prev, e = n, r = n.next;
1192
+ if (p(t, e, r) >= 0) return !1;
1193
+ for (var i = t.x, s = e.x, o = r.x, a = t.y, u = e.y, h = r.y, f = i < s ? i < o ? i : o : s < o ? s : o, c = a < u ? a < h ? a : h : u < h ? u : h, l = i > s ? i > o ? i : o : s > o ? s : o, x = a > u ? a > h ? a : h : u > h ? u : h, d = r.next; d !== t; ) {
1194
+ if (d.x >= f && d.x <= l && d.y >= c && d.y <= x && I(i, a, s, u, o, h, d.x, d.y) && p(d.prev, d, d.next) >= 0) return !1;
1195
+ d = d.next;
1196
+ }
1197
+ return !0;
1198
+ }
1199
+ function At(n, t, e, r) {
1200
+ var i = n.prev, s = n, o = n.next;
1201
+ if (p(i, s, o) >= 0) return !1;
1202
+ for (var a = i.x, u = s.x, h = o.x, f = i.y, c = s.y, l = o.y, x = a < u ? a < h ? a : h : u < h ? u : h, d = f < c ? f < l ? f : l : c < l ? c : l, b = a > u ? a > h ? a : h : u > h ? u : h, S = f > c ? f > l ? f : l : c > l ? c : l, N = J(x, d, t, e, r), O = J(b, S, t, e, r), _ = n.prevZ, g = n.nextZ; _ && _.z >= N && g && g.z <= O; ) {
1203
+ if (_.x >= x && _.x <= b && _.y >= d && _.y <= S && _ !== i && _ !== o && I(a, f, u, c, h, l, _.x, _.y) && p(_.prev, _, _.next) >= 0 || (_ = _.prevZ, g.x >= x && g.x <= b && g.y >= d && g.y <= S && g !== i && g !== o && I(a, f, u, c, h, l, g.x, g.y) && p(g.prev, g, g.next) >= 0)) return !1;
1204
+ g = g.nextZ;
1205
+ }
1206
+ for (; _ && _.z >= N; ) {
1207
+ if (_.x >= x && _.x <= b && _.y >= d && _.y <= S && _ !== i && _ !== o && I(a, f, u, c, h, l, _.x, _.y) && p(_.prev, _, _.next) >= 0) return !1;
1208
+ _ = _.prevZ;
1209
+ }
1210
+ for (; g && g.z <= O; ) {
1211
+ if (g.x >= x && g.x <= b && g.y >= d && g.y <= S && g !== i && g !== o && I(a, f, u, c, h, l, g.x, g.y) && p(g.prev, g, g.next) >= 0) return !1;
1212
+ g = g.nextZ;
1213
+ }
1214
+ return !0;
1215
+ }
1216
+ function Ft(n, t, e) {
1217
+ var r = n;
1218
+ do {
1219
+ var i = r.prev, s = r.next.next;
1220
+ !V(i, s) && Ae(i, r, r.next, s) && B(i, s) && B(s, i) && (t.push(i.i / e | 0), t.push(r.i / e | 0), t.push(s.i / e | 0), M(r), M(r.next), r = n = s), r = r.next;
1221
+ } while (r !== n);
1222
+ return P(r);
1223
+ }
1224
+ function Lt(n, t, e, r, i, s) {
1225
+ var o = n;
1226
+ do {
1227
+ for (var a = o.next.next; a !== o.prev; ) {
1228
+ if (o.i !== a.i && Mt(o, a)) {
1229
+ var u = Fe(o, a);
1230
+ o = P(o, o.next), u = P(u, u.next), D(o, t, e, r, i, s, 0), D(u, t, e, r, i, s, 0);
1231
+ return;
1232
+ }
1233
+ a = a.next;
1234
+ }
1235
+ o = o.next;
1236
+ } while (o !== n);
1237
+ }
1238
+ function St(n, t, e, r) {
1239
+ var i = [], s, o, a, u, h;
1240
+ for (s = 0, o = t.length; s < o; s++)
1241
+ a = t[s] * r, u = s < o - 1 ? t[s + 1] * r : n.length, h = be(n, a, u, r, !1), h === h.next && (h.steiner = !0), i.push(Bt(h));
1242
+ for (i.sort(Ct), s = 0; s < i.length; s++)
1243
+ e = Pt(i[s], e);
1244
+ return e;
1245
+ }
1246
+ function Ct(n, t) {
1247
+ return n.x - t.x;
1248
+ }
1249
+ function Pt(n, t) {
1250
+ var e = Ut(n, t);
1251
+ if (!e)
1252
+ return t;
1253
+ var r = Fe(e, n);
1254
+ return P(r, r.next), P(e, e.next);
1255
+ }
1256
+ function Ut(n, t) {
1257
+ var e = t, r = n.x, i = n.y, s = -1 / 0, o;
1258
+ do {
1259
+ if (i <= e.y && i >= e.next.y && e.next.y !== e.y) {
1260
+ var a = e.x + (i - e.y) * (e.next.x - e.x) / (e.next.y - e.y);
1261
+ if (a <= r && a > s && (s = a, o = e.x < e.next.x ? e : e.next, a === r))
1262
+ return o;
1263
+ }
1264
+ e = e.next;
1265
+ } while (e !== t);
1266
+ if (!o) return null;
1267
+ var u = o, h = o.x, f = o.y, c = 1 / 0, l;
1268
+ e = o;
1269
+ do
1270
+ r >= e.x && e.x >= h && r !== e.x && I(i < f ? r : s, i, h, f, i < f ? s : r, i, e.x, e.y) && (l = Math.abs(i - e.y) / (r - e.x), B(e, n) && (l < c || l === c && (e.x > o.x || e.x === o.x && wt(o, e))) && (o = e, c = l)), e = e.next;
1271
+ while (e !== u);
1272
+ return o;
1273
+ }
1274
+ function wt(n, t) {
1275
+ return p(n.prev, n, t.prev) < 0 && p(t.next, n, n.next) < 0;
1276
+ }
1277
+ function It(n, t, e, r) {
1278
+ var i = n;
1279
+ do
1280
+ i.z === 0 && (i.z = J(i.x, i.y, t, e, r)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next;
1281
+ while (i !== n);
1282
+ i.prevZ.nextZ = null, i.prevZ = null, Dt(i);
1283
+ }
1284
+ function Dt(n) {
1285
+ var t, e, r, i, s, o, a, u, h = 1;
1286
+ do {
1287
+ for (e = n, n = null, s = null, o = 0; e; ) {
1288
+ for (o++, r = e, a = 0, t = 0; t < h && (a++, r = r.nextZ, !!r); t++)
1289
+ ;
1290
+ for (u = h; a > 0 || u > 0 && r; )
1291
+ a !== 0 && (u === 0 || !r || e.z <= r.z) ? (i = e, e = e.nextZ, a--) : (i = r, r = r.nextZ, u--), s ? s.nextZ = i : n = i, i.prevZ = s, s = i;
1292
+ e = r;
1293
+ }
1294
+ s.nextZ = null, h *= 2;
1295
+ } while (o > 1);
1296
+ return n;
1297
+ }
1298
+ function J(n, t, e, r, i) {
1299
+ return n = (n - e) * i | 0, t = (t - r) * i | 0, n = (n | n << 8) & 16711935, n = (n | n << 4) & 252645135, n = (n | n << 2) & 858993459, n = (n | n << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, n | t << 1;
1300
+ }
1301
+ function Bt(n) {
1302
+ var t = n, e = n;
1303
+ do
1304
+ (t.x < e.x || t.x === e.x && t.y < e.y) && (e = t), t = t.next;
1305
+ while (t !== n);
1306
+ return e;
1307
+ }
1308
+ function I(n, t, e, r, i, s, o, a) {
1309
+ return (i - o) * (t - a) >= (n - o) * (s - a) && (n - o) * (r - a) >= (e - o) * (t - a) && (e - o) * (s - a) >= (i - o) * (r - a);
1310
+ }
1311
+ function Mt(n, t) {
1312
+ return n.next.i !== t.i && n.prev.i !== t.i && !Nt(n, t) && // dones't intersect other edges
1313
+ (B(n, t) && B(t, n) && Ot(n, t) && // locally visible
1314
+ (p(n.prev, n, t.prev) || p(n, t.prev, t)) || // does not create opposite-facing sectors
1315
+ V(n, t) && p(n.prev, n, n.next) > 0 && p(t.prev, t, t.next) > 0);
1316
+ }
1317
+ function p(n, t, e) {
1318
+ return (t.y - n.y) * (e.x - t.x) - (t.x - n.x) * (e.y - t.y);
1319
+ }
1320
+ function V(n, t) {
1321
+ return n.x === t.x && n.y === t.y;
1322
+ }
1323
+ function Ae(n, t, e, r) {
1324
+ var i = W(p(n, t, e)), s = W(p(n, t, r)), o = W(p(e, r, n)), a = W(p(e, r, t));
1325
+ return !!(i !== s && o !== a || i === 0 && H(n, e, t) || s === 0 && H(n, r, t) || o === 0 && H(e, n, r) || a === 0 && H(e, t, r));
1326
+ }
1327
+ function H(n, t, e) {
1328
+ return t.x <= Math.max(n.x, e.x) && t.x >= Math.min(n.x, e.x) && t.y <= Math.max(n.y, e.y) && t.y >= Math.min(n.y, e.y);
1329
+ }
1330
+ function W(n) {
1331
+ return n > 0 ? 1 : n < 0 ? -1 : 0;
1332
+ }
1333
+ function Nt(n, t) {
1334
+ var e = n;
1335
+ do {
1336
+ if (e.i !== n.i && e.next.i !== n.i && e.i !== t.i && e.next.i !== t.i && Ae(e, e.next, n, t)) return !0;
1337
+ e = e.next;
1338
+ } while (e !== n);
1339
+ return !1;
1340
+ }
1341
+ function B(n, t) {
1342
+ return p(n.prev, n, n.next) < 0 ? p(n, t, n.next) >= 0 && p(n, n.prev, t) >= 0 : p(n, t, n.prev) < 0 || p(n, n.next, t) < 0;
1343
+ }
1344
+ function Ot(n, t) {
1345
+ var e = n, r = !1, i = (n.x + t.x) / 2, s = (n.y + t.y) / 2;
1346
+ do
1347
+ e.y > s != e.next.y > s && e.next.y !== e.y && i < (e.next.x - e.x) * (s - e.y) / (e.next.y - e.y) + e.x && (r = !r), e = e.next;
1348
+ while (e !== n);
1349
+ return r;
1350
+ }
1351
+ function Fe(n, t) {
1352
+ var e = new Q(n.i, n.x, n.y), r = new Q(t.i, t.x, t.y), i = n.next, s = t.prev;
1353
+ return n.next = t, t.prev = n, e.next = i, i.prev = e, r.next = e, e.prev = r, s.next = r, r.prev = s, r;
1354
+ }
1355
+ function pe(n, t, e, r) {
1356
+ var i = new Q(n, t, e);
1357
+ return r ? (i.next = r.next, i.prev = r, r.next.prev = i, r.next = i) : (i.prev = i, i.next = i), i;
1358
+ }
1359
+ function M(n) {
1360
+ n.next.prev = n.prev, n.prev.next = n.next, n.prevZ && (n.prevZ.nextZ = n.nextZ), n.nextZ && (n.nextZ.prevZ = n.prevZ);
1361
+ }
1362
+ function Q(n, t, e) {
1363
+ this.i = n, this.x = t, this.y = e, this.prev = null, this.next = null, this.z = 0, this.prevZ = null, this.nextZ = null, this.steiner = !1;
1364
+ }
1365
+ k.deviation = function(n, t, e, r) {
1366
+ var i = t && t.length, s = i ? t[0] * e : n.length, o = Math.abs(ee(n, 0, s, e));
1367
+ if (i)
1368
+ for (var a = 0, u = t.length; a < u; a++) {
1369
+ var h = t[a] * e, f = a < u - 1 ? t[a + 1] * e : n.length;
1370
+ o -= Math.abs(ee(n, h, f, e));
1371
+ }
1372
+ var c = 0;
1373
+ for (a = 0; a < r.length; a += 3) {
1374
+ var l = r[a] * e, x = r[a + 1] * e, d = r[a + 2] * e;
1375
+ c += Math.abs(
1376
+ (n[l] - n[d]) * (n[x + 1] - n[l + 1]) - (n[l] - n[x]) * (n[d + 1] - n[l + 1])
1377
+ );
1378
+ }
1379
+ return o === 0 && c === 0 ? 0 : Math.abs((c - o) / o);
1380
+ };
1381
+ function ee(n, t, e, r) {
1382
+ for (var i = 0, s = t, o = e - r; s < e; s += r)
1383
+ i += (n[o] - n[s]) * (n[s + 1] + n[o + 1]), o = s;
1384
+ return i;
1385
+ }
1386
+ k.flatten = function(n) {
1387
+ for (var t = n[0][0].length, e = { vertices: [], holes: [], dimensions: t }, r = 0, i = 0; i < n.length; i++) {
1388
+ for (var s = 0; s < n[i].length; s++)
1389
+ for (var o = 0; o < t; o++) e.vertices.push(n[i][s][o]);
1390
+ i > 0 && (r += n[i - 1].length, e.holes.push(r));
1391
+ }
1392
+ return e;
1393
+ };
1394
+ function Gt(n, t) {
1395
+ t = t || [];
1396
+ const e = 256, r = e - 1;
1397
+ return t[0] = Math.floor(n / e / e / e) / r, t[1] = Math.floor(n / e / e) % e / r, t[2] = Math.floor(n / e) % e / r, t[3] = n % e / r, t;
1398
+ }
1399
+ function zt(n) {
1400
+ let t = 0;
1401
+ const e = 256, r = e - 1;
1402
+ return t += Math.round(n[0] * e * e * e * r), t += Math.round(n[1] * e * e * r), t += Math.round(n[2] * e * r), t += Math.round(n[3] * r), t;
1403
+ }
1404
+ function Zt() {
1405
+ const n = 'const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS",r={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:\'`renderMode` must be `"hybrid"` or `"vector"`\',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class o extends Error{constructor(e){const t=r[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}var i=o;function a(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function s(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],a=t[1],s=t[2],u=t[3],f=t[4],x=t[5];return e[0]=u/n,e[1]=-a/n,e[2]=-s/n,e[3]=o/n,e[4]=(s*x-u*f)/n,e[5]=-(o*x-a*f)/n,e}function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}new Array(6);var f={exports:{}};function x(e,t,n){n=n||2;var r,o,i,a,s,u,f,x=t&&t.length,h=x?t[0]*n:e.length,v=l(e,0,h,n,!0),d=[];if(!v||v.next===v.prev)return d;if(x&&(v=function(e,t,n,r){var o,i,a,s=[];for(o=0,i=t.length;o<i;o++)(a=l(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),s.push(A(a));for(s.sort(b),o=0;o<s.length;o++)n=g(s[o],n);return n}(e,t,v,n)),e.length>80*n){r=i=e[0],o=a=e[1];for(var y=n;y<h;y+=n)(s=e[y])<r&&(r=s),(u=e[y+1])<o&&(o=u),s>i&&(i=s),u>a&&(a=u);f=0!==(f=Math.max(i-r,a-o))?32767/f:0}return c(v,d,n,r,o,f,0),d}function l(e,t,n,r,o){var i,a;if(o===P(e,t,n,r)>0)for(i=t;i<n;i+=r)a=k(i,e[i],e[i+1],a);else for(i=n-r;i>=t;i-=r)a=k(i,e[i],e[i+1],a);return a&&F(a,a.next)&&(R(a),a=a.next),a}function h(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!F(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(R(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function c(e,t,n,r,o,i,a){if(e){!a&&i&&function(e,t,n,r){var o=e;do{0===o.z&&(o.z=w(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,a,s,u,f=1;do{for(n=e,e=null,i=null,a=0;n;){for(a++,r=n,s=0,t=0;t<f&&(s++,r=r.nextZ);t++);for(u=f;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,s--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,f*=2}while(a>1)}(o)}(e,r,o,i);for(var s,u,f=e;e.prev!==e.next;)if(s=e.prev,u=e.next,i?d(e,r,o,i):v(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),R(e),e=u.next,f=u.next;else if((e=u)===f){a?1===a?c(e=y(h(e),t,n),t,n,r,o,i,2):2===a&&p(e,t,n,r,o,i):c(h(e),t,n,r,o,i,1);break}}}function v(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=t.x,i=n.x,a=r.x,s=t.y,u=n.y,f=r.y,x=o<i?o<a?o:a:i<a?i:a,l=s<u?s<f?s:f:u<f?u:f,h=o>i?o>a?o:a:i>a?i:a,c=s>u?s>f?s:f:u>f?u:f,v=r.next;v!==t;){if(v.x>=x&&v.x<=h&&v.y>=l&&v.y<=c&&E(o,s,i,u,a,f,v.x,v.y)&&Z(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function d(e,t,n,r){var o=e.prev,i=e,a=e.next;if(Z(o,i,a)>=0)return!1;for(var s=o.x,u=i.x,f=a.x,x=o.y,l=i.y,h=a.y,c=s<u?s<f?s:f:u<f?u:f,v=x<l?x<h?x:h:l<h?l:h,d=s>u?s>f?s:f:u>f?u:f,y=x>l?x>h?x:h:l>h?l:h,p=w(c,v,t,n,r),b=w(d,y,t,n,r),g=e.prevZ,m=e.nextZ;g&&g.z>=p&&m&&m.z<=b;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&E(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&E(s,x,u,l,f,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;g&&g.z>=p;){if(g.x>=c&&g.x<=d&&g.y>=v&&g.y<=y&&g!==o&&g!==a&&E(s,x,u,l,f,h,g.x,g.y)&&Z(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;m&&m.z<=b;){if(m.x>=c&&m.x<=d&&m.y>=v&&m.y<=y&&m!==o&&m!==a&&E(s,x,u,l,f,h,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function y(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!F(o,i)&&T(o,r,r.next,i)&&z(o,i)&&z(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),R(r),R(r.next),r=e=i),r=r.next}while(r!==e);return h(r)}function p(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&M(a,s)){var u=U(a,s);return a=h(a,a.next),u=h(u,u.next),c(a,t,n,r,o,i,0),void c(u,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function b(e,t){return e.x-t.x}function g(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,n=r.x<r.next.x?r:r.next,s===o))return n}r=r.next}while(r!==t);if(!n)return null;var u,f=n,x=n.x,l=n.y,h=1/0;r=n;do{o>=r.x&&r.x>=x&&o!==r.x&&E(i<l?o:a,i,x,l,i<l?a:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),z(r,e)&&(u<h||u===h&&(r.x>n.x||r.x===n.x&&m(n,r)))&&(n=r,h=u)),r=r.next}while(r!==f);return n}(e,t);if(!n)return t;var r=U(n,e);return h(r,r.next),h(n,n.next)}function m(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function w(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function A(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function E(e,t,n,r,o,i,a,s){return(o-a)*(t-s)>=(e-a)*(i-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(i-s)>=(o-a)*(r-s)}function M(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&T(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(z(e,t)&&z(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||F(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function F(e,t){return e.x===t.x&&e.y===t.y}function T(e,t,n,r){var o=S(Z(e,t,n)),i=S(Z(e,t,r)),a=S(Z(n,r,e)),s=S(Z(n,r,t));return o!==i&&a!==s||(!(0!==o||!I(e,n,t))||(!(0!==i||!I(e,r,t))||(!(0!==a||!I(n,e,r))||!(0!==s||!I(n,t,r)))))}function I(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function S(e){return e>0?1:e<0?-1:0}function z(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function U(e,t){var n=new B(e.i,e.x,e.y),r=new B(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function k(e,t,n,r){var o=new B(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function R(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function B(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function P(e,t,n,r){for(var o=0,i=t,a=n-r;i<n;i+=r)o+=(e[a]-e[i])*(e[i+1]+e[a+1]),a=i;return o}f.exports=x,f.exports.default=x,x.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,a=Math.abs(P(e,0,i,n));if(o)for(var s=0,u=t.length;s<u;s++){var f=t[s]*n,x=s<u-1?t[s+1]*n:e.length;a-=Math.abs(P(e,f,x,n))}var l=0;for(s=0;s<r.length;s+=3){var h=r[s]*n,c=r[s+1]*n,v=r[s+2]*n;l+=Math.abs((e[h]-e[v])*(e[c+1]-e[h+1])-(e[h]-e[c])*(e[v+1]-e[h+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},x.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,o=0;o<e.length;o++){for(var i=0;i<e[o].length;i++)for(var a=0;a<t;a++)n.vertices.push(e[o][i][a]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};var N=u(f.exports);const _=[],O={vertexPosition:0,indexPosition:0};function q(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function L(e,t,n,r,o,i){const a=3+o,s=e[t+0],u=e[t+1],f=_;f.length=o;for(let n=0;n<f.length;n++)f[n]=e[t+2+n];let x=i?i.vertexPosition:0,l=i?i.indexPosition:0;const h=x/a;return q(n,x,s,u,0),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,1),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,2),f.length&&n.set(f,x+3),x+=a,q(n,x,s,u,3),f.length&&n.set(f,x+3),x+=a,r[l++]=h,r[l++]=h+1,r[l++]=h+3,r[l++]=h+1,r[l++]=h+2,r[l++]=h+3,O.vertexPosition=x,O.indexPosition=l,O}function C(e,t,n,r,o,i,s,u,f,x){const l=5+u.length,h=i.length/l,c=[e[t+0],e[t+1]],v=[e[n],e[n+1]],d=a(x,[...c]),y=a(x,[...v]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function b(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=[(t[0]-e[0])/r,(t[1]-e[1])/r],i=[-o[1],o[0]],a=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/a,(n[1]-e[1])/a],u=0===r||0===a?0:Math.acos((f=s[0]*o[0]+s[1]*o[1],x=-1,l=1,Math.min(Math.max(f,x),l)));var f,x,l;return s[0]*i[0]+s[1]*i[1]>0?u:2*Math.PI-u}const g=null!==o;let m=0,w=0;if(null!==r){m=b(d,y,a(x,[...[e[r],e[r+1]]]))}if(g){w=b(y,d,a(x,[...[e[o],e[o+1]]]))}i.push(c[0],c[1],v[0],v[1],p(0,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(1,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(2,m,w)),i.push(...u),i.push(c[0],c[1],v[0],v[1],p(3,m,w)),i.push(...u),s.push(h,h+1,h+2,h+1,h+3,h+2)}function G(e,t,n,r,o){const i=2+o;let a=t;const s=e.slice(a,a+o);a+=o;const u=e[a++];let f=0;const x=new Array(u-1);for(let t=0;t<u;t++)f+=e[a++],t<u-1&&(x[t]=f);const l=e.slice(a,a+2*f),h=N(l,x,2);for(let e=0;e<h.length;e++)r.push(h[e]+n.length/i);for(let e=0;e<l.length;e+=2)n.push(l[e],l[e+1],...s);return a+2*f}const j=self;j.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesSize,r=t+n,i=new Float32Array(o.renderInstructions),a=i.length/r,s=4*a*(n+e),u=new Uint32Array(6*a),f=new Float32Array(s);let x;for(let e=0;e<i.length;e+=r)x=L(i,e,f,u,n,x);const l=Object.assign({vertexBuffer:f.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);j.postMessage(l,[f.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesSize,r=2,i=new Float32Array(o.renderInstructions);let a=0;const u=o.renderInstructionsTransform,f=[1,0,0,1,0,0];let x,l;for(s(f,u);a<i.length;){l=Array.from(i.slice(a,a+n)),a+=n,x=i[a++];for(let n=0;n<x-1;n++)C(i,a+n*r,a+(n+1)*r,n>0?a+(n-1)*r:null,n<x-2?a+(n+2)*r:null,e,t,l,0,f);a+=x*r}const h=Uint32Array.from(t),c=Float32Array.from(e),v=Object.assign({vertexBuffer:c.buffer,indexBuffer:h.buffer,renderInstructions:i.buffer},o);j.postMessage(v,[c.buffer,h.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesSize,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=G(r,i,e,t,n);const a=Uint32Array.from(t),s=Float32Array.from(e),u=Object.assign({vertexBuffer:s.buffer,indexBuffer:a.buffer,renderInstructions:r.buffer},o);j.postMessage(u,[s.buffer,a.buffer,r.buffer]);break}}};';
1406
+ return new Worker(typeof Blob > "u" ? "data:application/javascript;base64," + Buffer.from(n, "binary").toString("base64") : URL.createObjectURL(new Blob([n], { type: "application/javascript" })));
1407
+ }
1408
+ class Ht extends ne {
1409
+ /**
1410
+ * @param {import("../../layer/Layer.js").default} layer Layer.
1411
+ * @param {Options} options Options.
1412
+ */
1413
+ constructor(t, e) {
1414
+ const r = e.uniforms || {}, i = C();
1415
+ r[A.PROJECTION_MATRIX] = i, super(t, {
1416
+ uniforms: r,
1417
+ postProcesses: e.postProcesses
1418
+ }), this.sourceRevision_ = -1, this.verticesBuffer_ = new le(te, $), this.indicesBuffer_ = new le(
1419
+ re,
1420
+ $
1421
+ ), this.vertexShader_ = e.vertexShader, this.fragmentShader_ = e.fragmentShader, this.program_, this.hitDetectionEnabled_ = e.hitDetectionEnabled ?? !0;
1422
+ const s = e.attributes ? e.attributes.map(function(a) {
1423
+ return {
1424
+ name: "a_" + a.name,
1425
+ size: 1,
1426
+ type: F.FLOAT
1427
+ };
1428
+ }) : [];
1429
+ this.attributes = [
1430
+ {
1431
+ name: "a_position",
1432
+ size: 2,
1433
+ type: F.FLOAT
1434
+ },
1435
+ {
1436
+ name: "a_index",
1437
+ size: 1,
1438
+ type: F.FLOAT
1439
+ }
1440
+ ], this.hitDetectionEnabled_ && (this.attributes.push({
1441
+ name: "a_hitColor",
1442
+ size: 4,
1443
+ type: F.FLOAT
1444
+ }), this.attributes.push({
1445
+ name: "a_featureUid",
1446
+ size: 1,
1447
+ type: F.FLOAT
1448
+ })), this.attributes.push(...s), this.customAttributes = e.attributes ? e.attributes : [], this.previousExtent_ = He(), this.currentTransform_ = i, this.renderTransform_ = C(), this.invertRenderTransform_ = C(), this.renderInstructions_ = new Float32Array(0), this.hitRenderTarget_, this.lastSentId = 0, this.worker_ = Zt(), this.worker_.addEventListener(
1449
+ "message",
1450
+ /**
1451
+ * @param {*} event Event.
1452
+ */
1453
+ (a) => {
1454
+ const u = a.data;
1455
+ if (u.type === ge.GENERATE_POINT_BUFFERS) {
1456
+ const h = u.projectionTransform;
1457
+ this.verticesBuffer_.fromArrayBuffer(u.vertexBuffer), this.helper.flushBufferData(this.verticesBuffer_), this.indicesBuffer_.fromArrayBuffer(u.indexBuffer), this.helper.flushBufferData(this.indicesBuffer_), this.renderTransform_ = h, We(
1458
+ this.invertRenderTransform_,
1459
+ this.renderTransform_
1460
+ ), this.renderInstructions_ = new Float32Array(
1461
+ a.data.renderInstructions
1462
+ ), u.id === this.lastSentId && (this.ready = !0), this.getLayer().changed();
1463
+ }
1464
+ }
1465
+ ), this.featureCache_ = {}, this.featureCount_ = 0;
1466
+ const o = this.getLayer().getSource();
1467
+ this.sourceListenKeys_ = [
1468
+ z(
1469
+ o,
1470
+ G.ADDFEATURE,
1471
+ this.handleSourceFeatureAdded_,
1472
+ this
1473
+ ),
1474
+ z(
1475
+ o,
1476
+ G.CHANGEFEATURE,
1477
+ this.handleSourceFeatureChanged_,
1478
+ this
1479
+ ),
1480
+ z(
1481
+ o,
1482
+ G.REMOVEFEATURE,
1483
+ this.handleSourceFeatureDelete_,
1484
+ this
1485
+ ),
1486
+ z(
1487
+ o,
1488
+ G.CLEAR,
1489
+ this.handleSourceFeatureClear_,
1490
+ this
1491
+ )
1492
+ ], o.forEachFeature((a) => {
1493
+ this.featureCache_[L(a)] = {
1494
+ feature: a,
1495
+ properties: a.getProperties(),
1496
+ geometry: a.getGeometry()
1497
+ }, this.featureCount_++;
1498
+ });
1499
+ }
1500
+ afterHelperCreated() {
1501
+ this.program_ = this.helper.getProgram(
1502
+ this.fragmentShader_,
1503
+ this.vertexShader_
1504
+ ), this.hitDetectionEnabled_ && (this.hitRenderTarget_ = new Rt(this.helper));
1505
+ }
1506
+ /**
1507
+ * @param {import("../../source/Vector.js").VectorSourceEvent} event Event.
1508
+ * @private
1509
+ */
1510
+ handleSourceFeatureAdded_(t) {
1511
+ const e = t.feature;
1512
+ this.featureCache_[L(e)] = {
1513
+ feature: e,
1514
+ properties: e.getProperties(),
1515
+ geometry: e.getGeometry()
1516
+ }, this.featureCount_++;
1517
+ }
1518
+ /**
1519
+ * @param {import("../../source/Vector.js").VectorSourceEvent} event Event.
1520
+ * @private
1521
+ */
1522
+ handleSourceFeatureChanged_(t) {
1523
+ const e = t.feature;
1524
+ this.featureCache_[L(e)] = {
1525
+ feature: e,
1526
+ properties: e.getProperties(),
1527
+ geometry: e.getGeometry()
1528
+ };
1529
+ }
1530
+ /**
1531
+ * @param {import("../../source/Vector.js").VectorSourceEvent} event Event.
1532
+ * @private
1533
+ */
1534
+ handleSourceFeatureDelete_(t) {
1535
+ const e = t.feature;
1536
+ delete this.featureCache_[L(e)], this.featureCount_--;
1537
+ }
1538
+ /**
1539
+ * @private
1540
+ */
1541
+ handleSourceFeatureClear_() {
1542
+ this.featureCache_ = {}, this.featureCount_ = 0;
1543
+ }
1544
+ /**
1545
+ * Render the layer.
1546
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
1547
+ * @return {HTMLElement} The rendered element.
1548
+ */
1549
+ renderFrame(t) {
1550
+ const e = this.helper.getGL();
1551
+ this.preRender(e, t);
1552
+ const [r, i, s] = this.getWorldParameters_(t);
1553
+ this.renderWorlds(t, !1, r, i, s), this.helper.finalizeDraw(
1554
+ t,
1555
+ this.dispatchPreComposeEvent,
1556
+ this.dispatchPostComposeEvent
1557
+ );
1558
+ const o = this.helper.getCanvas();
1559
+ return this.hitDetectionEnabled_ && (this.renderWorlds(t, !0, r, i, s), this.hitRenderTarget_.clearCachedData()), this.postRender(e, t), o;
1560
+ }
1561
+ /**
1562
+ * Compute world params
1563
+ * @private
1564
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
1565
+ * @return {Array<number>} The world start, end and width.
1566
+ */
1567
+ getWorldParameters_(t) {
1568
+ const e = t.viewState.projection, s = this.getLayer().getSource().getWrapX() && e.canWrapX(), o = e.getExtent(), a = t.extent, u = s ? Xe(o) : null, h = s ? Math.ceil((a[2] - o[2]) / u) + 1 : 1;
1569
+ return [s ? Math.floor((a[0] - o[0]) / u) : 0, h, u];
1570
+ }
1571
+ /**
1572
+ * Determine whether renderFrame should be called.
1573
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
1574
+ * @return {boolean} Layer is ready to be rendered.
1575
+ */
1576
+ prepareFrameInternal(t) {
1577
+ const e = this.getLayer(), r = e.getSource(), i = t.viewState, s = !t.viewHints[ue.ANIMATING] && !t.viewHints[ue.INTERACTING], o = !ke(this.previousExtent_, t.extent), a = this.sourceRevision_ < r.getRevision();
1578
+ if (a && (this.sourceRevision_ = r.getRevision()), s && (o || a)) {
1579
+ const u = i.projection, h = i.resolution, f = e instanceof ve ? e.getRenderBuffer() : 0, c = Ve(t.extent, f * h);
1580
+ r.loadFeatures(c, h, u), this.rebuildBuffers_(t), this.previousExtent_ = t.extent.slice();
1581
+ }
1582
+ return this.helper.useProgram(this.program_, t), this.helper.prepareDraw(t), this.helper.bindBuffer(this.verticesBuffer_), this.helper.bindBuffer(this.indicesBuffer_), this.helper.enableAttributes(this.attributes), !0;
1583
+ }
1584
+ /**
1585
+ * Rebuild internal webgl buffers based on current view extent; costly, should not be called too much
1586
+ * @param {import("../../Map").FrameState} frameState Frame state.
1587
+ * @private
1588
+ */
1589
+ rebuildBuffers_(t) {
1590
+ const e = C();
1591
+ this.helper.makeProjectionTransform(t, e);
1592
+ const i = (this.hitDetectionEnabled_ ? 7 : 2) + this.customAttributes.length, s = i * this.featureCount_;
1593
+ (!this.renderInstructions_ || this.renderInstructions_.length !== s) && (this.renderInstructions_ = new Float32Array(s));
1594
+ let o, a;
1595
+ const u = [], h = [];
1596
+ let f = -1;
1597
+ for (const l in this.featureCache_)
1598
+ if (o = this.featureCache_[l], a = /** @type {import("../../geom").Point} */
1599
+ o.geometry, !(!a || a.getType() !== "Point")) {
1600
+ if (u[0] = a.getFlatCoordinates()[0], u[1] = a.getFlatCoordinates()[1], he(e, u), this.renderInstructions_[++f] = u[0], this.renderInstructions_[++f] = u[1], this.hitDetectionEnabled_) {
1601
+ const x = Gt(f + 5, h);
1602
+ this.renderInstructions_[++f] = x[0], this.renderInstructions_[++f] = x[1], this.renderInstructions_[++f] = x[2], this.renderInstructions_[++f] = x[3], this.renderInstructions_[++f] = Number(l);
1603
+ }
1604
+ for (let x = 0; x < this.customAttributes.length; x++) {
1605
+ const d = this.customAttributes[x].callback(
1606
+ o.feature,
1607
+ o.properties
1608
+ );
1609
+ this.renderInstructions_[++f] = d;
1610
+ }
1611
+ }
1612
+ const c = {
1613
+ id: ++this.lastSentId,
1614
+ type: ge.GENERATE_POINT_BUFFERS,
1615
+ renderInstructions: this.renderInstructions_.buffer,
1616
+ customAttributesSize: i - 2
1617
+ };
1618
+ c.projectionTransform = e, this.ready = !1, this.worker_.postMessage(c, [this.renderInstructions_.buffer]), this.renderInstructions_ = null;
1619
+ }
1620
+ /**
1621
+ * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
1622
+ * @param {import("../../Map.js").FrameState} frameState Frame state.
1623
+ * @param {number} hitTolerance Hit tolerance in pixels.
1624
+ * @param {import("../vector.js").FeatureCallback<T>} callback Feature callback.
1625
+ * @param {Array<import("../Map.js").HitMatch<T>>} matches The hit detected matches with tolerance.
1626
+ * @return {T|undefined} Callback result.
1627
+ * @template T
1628
+ */
1629
+ forEachFeatureAtCoordinate(t, e, r, i, s) {
1630
+ if (me(this.hitDetectionEnabled_, 66), !this.renderInstructions_ || !this.hitDetectionEnabled_)
1631
+ return;
1632
+ const o = he(
1633
+ e.coordinateToPixelTransform,
1634
+ t.slice()
1635
+ ), a = this.hitRenderTarget_.readPixel(o[0] / 2, o[1] / 2), u = [a[0] / 255, a[1] / 255, a[2] / 255, a[3] / 255], h = zt(u), f = this.renderInstructions_[h], c = Math.floor(f).toString(), x = this.getLayer().getSource().getFeatureByUid(c);
1636
+ if (x)
1637
+ return i(x, this.getLayer(), null);
1638
+ }
1639
+ /**
1640
+ * Render the world, either to the main framebuffer or to the hit framebuffer
1641
+ * @param {import("../../Map.js").FrameState} frameState current frame state
1642
+ * @param {boolean} forHitDetection whether the rendering is for hit detection
1643
+ * @param {number} startWorld the world to render in the first iteration
1644
+ * @param {number} endWorld the last world to render
1645
+ * @param {number} worldWidth the width of the worlds being rendered
1646
+ */
1647
+ renderWorlds(t, e, r, i, s) {
1648
+ let o = r;
1649
+ this.helper.useProgram(this.program_, t), e && (this.hitRenderTarget_.setSize([
1650
+ Math.floor(t.size[0] / 2),
1651
+ Math.floor(t.size[1] / 2)
1652
+ ]), this.helper.prepareDrawToRenderTarget(
1653
+ t,
1654
+ this.hitRenderTarget_,
1655
+ !0
1656
+ )), this.helper.bindBuffer(this.verticesBuffer_), this.helper.bindBuffer(this.indicesBuffer_), this.helper.enableAttributes(this.attributes);
1657
+ do {
1658
+ this.helper.makeProjectionTransform(t, this.currentTransform_), je(this.currentTransform_, o * s, 0), Ye(this.currentTransform_, this.invertRenderTransform_), this.helper.applyUniforms(t), this.helper.applyHitDetectionUniform(e);
1659
+ const a = this.indicesBuffer_.getSize();
1660
+ this.helper.drawElements(0, a);
1661
+ } while (++o < i);
1662
+ }
1663
+ /**
1664
+ * Clean up.
1665
+ */
1666
+ disposeInternal() {
1667
+ this.worker_.terminate(), this.layer_ = null, this.sourceListenKeys_.forEach(function(t) {
1668
+ et(t);
1669
+ }), this.sourceListenKeys_ = null, super.disposeInternal();
1670
+ }
1671
+ }
1672
+ const T = {
1673
+ BLUR: "blur",
1674
+ GRADIENT: "gradient",
1675
+ RADIUS: "radius"
1676
+ }, Wt = ["#00f", "#0ff", "#0f0", "#ff0", "#f00"];
1677
+ class Xt extends ve {
1678
+ /**
1679
+ * @param {Options} [options] Options.
1680
+ */
1681
+ constructor(t) {
1682
+ t = t || {};
1683
+ const e = Object.assign({}, t);
1684
+ delete e.gradient, delete e.radius, delete e.blur, delete e.weight, super(e), this.gradient_ = null, this.addChangeListener(T.GRADIENT, this.handleGradientChanged_), this.setGradient(t.gradient ? t.gradient : Wt), this.setBlur(t.blur !== void 0 ? t.blur : 15), this.setRadius(t.radius !== void 0 ? t.radius : 8);
1685
+ const r = t.weight ? t.weight : "weight";
1686
+ typeof r == "string" ? this.weightFunction_ = function(i) {
1687
+ return i.get(r);
1688
+ } : this.weightFunction_ = r, this.setRenderOrder(null);
1689
+ }
1690
+ /**
1691
+ * Return the blur size in pixels.
1692
+ * @return {number} Blur size in pixels.
1693
+ * @api
1694
+ * @observable
1695
+ */
1696
+ getBlur() {
1697
+ return (
1698
+ /** @type {number} */
1699
+ this.get(T.BLUR)
1700
+ );
1701
+ }
1702
+ /**
1703
+ * Return the gradient colors as array of strings.
1704
+ * @return {Array<string>} Colors.
1705
+ * @api
1706
+ * @observable
1707
+ */
1708
+ getGradient() {
1709
+ return (
1710
+ /** @type {Array<string>} */
1711
+ this.get(T.GRADIENT)
1712
+ );
1713
+ }
1714
+ /**
1715
+ * Return the size of the radius in pixels.
1716
+ * @return {number} Radius size in pixel.
1717
+ * @api
1718
+ * @observable
1719
+ */
1720
+ getRadius() {
1721
+ return (
1722
+ /** @type {number} */
1723
+ this.get(T.RADIUS)
1724
+ );
1725
+ }
1726
+ /**
1727
+ * @private
1728
+ */
1729
+ handleGradientChanged_() {
1730
+ this.gradient_ = kt(this.getGradient());
1731
+ }
1732
+ /**
1733
+ * Set the blur size in pixels.
1734
+ * @param {number} blur Blur size in pixels.
1735
+ * @api
1736
+ * @observable
1737
+ */
1738
+ setBlur(t) {
1739
+ this.set(T.BLUR, t);
1740
+ }
1741
+ /**
1742
+ * Set the gradient colors as array of strings.
1743
+ * @param {Array<string>} colors Gradient.
1744
+ * @api
1745
+ * @observable
1746
+ */
1747
+ setGradient(t) {
1748
+ this.set(T.GRADIENT, t);
1749
+ }
1750
+ /**
1751
+ * Set the size of the radius in pixels.
1752
+ * @param {number} radius Radius size in pixel.
1753
+ * @api
1754
+ * @observable
1755
+ */
1756
+ setRadius(t) {
1757
+ this.set(T.RADIUS, t);
1758
+ }
1759
+ createRenderer() {
1760
+ return new Ht(this, {
1761
+ className: this.getClassName(),
1762
+ attributes: [
1763
+ {
1764
+ name: "weight",
1765
+ callback: (t) => {
1766
+ const e = this.weightFunction_(t);
1767
+ return e !== void 0 ? tt(e, 0, 1) : 1;
1768
+ }
1769
+ }
1770
+ ],
1771
+ hitDetectionEnabled: !0,
1772
+ vertexShader: `
1773
+ precision mediump float;
1774
+ uniform mat4 u_projectionMatrix;
1775
+ uniform mat4 u_offsetScaleMatrix;
1776
+ uniform float u_size;
1777
+ attribute vec2 a_position;
1778
+ attribute float a_index;
1779
+ attribute float a_weight;
1780
+ attribute vec4 a_hitColor;
1781
+
1782
+ varying vec2 v_texCoord;
1783
+ varying float v_weight;
1784
+ varying vec4 v_hitColor;
1785
+
1786
+ void main(void) {
1787
+ mat4 offsetMatrix = u_offsetScaleMatrix;
1788
+ float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;
1789
+ float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;
1790
+ vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
1791
+ gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
1792
+ float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
1793
+ float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
1794
+ v_texCoord = vec2(u, v);
1795
+ v_hitColor = a_hitColor;
1796
+ v_weight = a_weight;
1797
+ }`,
1798
+ fragmentShader: `
1799
+ precision mediump float;
1800
+ uniform float u_blurSlope;
1801
+ uniform mediump int u_hitDetection;
1802
+
1803
+ varying vec2 v_texCoord;
1804
+ varying float v_weight;
1805
+ varying vec4 v_hitColor;
1806
+
1807
+ void main(void) {
1808
+ vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);
1809
+ float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;
1810
+ float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;
1811
+ float alpha = smoothstep(0.0, 1.0, value) * v_weight;
1812
+ gl_FragColor = vec4(alpha, alpha, alpha, alpha);
1813
+ if (u_hitDetection > 0) {
1814
+ if (alpha < 0.05) {
1815
+ discard;
1816
+ }
1817
+ gl_FragColor = v_hitColor;
1818
+ }
1819
+ }`,
1820
+ uniforms: {
1821
+ u_size: () => (this.get(T.RADIUS) + this.get(T.BLUR)) * 2,
1822
+ u_blurSlope: () => this.get(T.RADIUS) / Math.max(1, this.get(T.BLUR))
1823
+ },
1824
+ postProcesses: [
1825
+ {
1826
+ fragmentShader: `
1827
+ precision mediump float;
1828
+
1829
+ uniform sampler2D u_image;
1830
+ uniform sampler2D u_gradientTexture;
1831
+ uniform float u_opacity;
1832
+
1833
+ varying vec2 v_texCoord;
1834
+
1835
+ void main() {
1836
+ vec4 color = texture2D(u_image, v_texCoord);
1837
+ gl_FragColor.a = color.a * u_opacity;
1838
+ gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;
1839
+ gl_FragColor.rgb *= gl_FragColor.a;
1840
+ }`,
1841
+ uniforms: {
1842
+ u_gradientTexture: () => this.gradient_,
1843
+ u_opacity: () => this.getOpacity()
1844
+ }
1845
+ }
1846
+ ]
1847
+ });
1848
+ }
1849
+ renderDeclutter() {
1850
+ }
1851
+ }
1852
+ function kt(n) {
1853
+ const r = rt(1, 256), i = r.createLinearGradient(0, 0, 1, 256), s = 1 / (n.length - 1);
1854
+ for (let o = 0, a = n.length; o < a; ++o)
1855
+ i.addColorStop(o * s, n[o]);
1856
+ return r.fillStyle = i, r.fillRect(0, 0, 1, 256), r.canvas;
1857
+ }
1858
+ const nr = (n) => {
1859
+ const t = Ie({ props: n, name: "HCHeatMap" }), {
1860
+ data: e,
1861
+ payload: r,
1862
+ onPayloadUpdate: i,
1863
+ accessToken: s,
1864
+ gradient: o = it,
1865
+ sx: a,
1866
+ ...u
1867
+ } = t, h = De(), f = w(Be("map-")), c = w(null), l = w(null), x = w(null), d = w(null), b = w(), [S, N] = nt(!1), O = () => {
1868
+ if (!S || !c.current || !e || !x.current) return;
1869
+ const v = new at(), E = e.map((y) => Me(y.variables.geometry)[0]).filter((y) => {
23
1870
  try {
24
- return N(n), !0;
1871
+ return ot(y), !0;
25
1872
  } catch {
26
1873
  return !1;
27
1874
  }
28
1875
  }).map(
29
- (n) => e.readFeature(n, {
1876
+ (y) => v.readFeature(y, {
30
1877
  dataProjection: "EPSG:4326",
31
1878
  featureProjection: "EPSG:3857"
32
1879
  })
33
1880
  );
34
- m.current.clear(), m.current.addFeatures(t);
35
- }, y = () => {
36
- var t;
37
- if (!r.current) return;
38
- const e = (t = r.current) == null ? void 0 : t.getBoundingBox(), o = {
39
- ...s,
40
- boundingBox: e
1881
+ x.current.clear(), x.current.addFeatures(E);
1882
+ }, _ = () => {
1883
+ var E;
1884
+ if (!c.current) return;
1885
+ const v = (E = c.current) == null ? void 0 : E.getBoundingBox(), m = {
1886
+ ...r,
1887
+ boundingBox: v
41
1888
  };
42
- E(o);
43
- }, G = () => {
44
- l.current && clearTimeout(l.current), l.current = setTimeout(() => {
45
- var e;
46
- (e = r.current) == null || e.updateSize(), c.current && c.current.map.resize();
1889
+ i(m);
1890
+ }, g = () => {
1891
+ b.current && clearTimeout(b.current), b.current = setTimeout(() => {
1892
+ var v;
1893
+ (v = c.current) == null || v.updateSize(), l.current && l.current.map.resize();
47
1894
  }, 100);
48
- }, k = () => {
49
- var e, o;
50
- (e = r.current) == null || e.on("movestart", () => {
51
- a.current && (clearTimeout(a.current), a.current = null);
52
- }), (o = r.current) == null || o.on("moveend", () => {
53
- a.current && (clearTimeout(a.current), a.current = null), a.current = setTimeout(y, 500);
1895
+ }, Le = () => {
1896
+ var v, m;
1897
+ (v = c.current) == null || v.on("movestart", () => {
1898
+ d.current && (clearTimeout(d.current), d.current = null);
1899
+ }), (m = c.current) == null || m.on("moveend", () => {
1900
+ d.current && (clearTimeout(d.current), d.current = null), d.current = setTimeout(_, 500);
54
1901
  });
55
- }, B = () => {
56
- var f, S;
57
- const e = p.palette.mode === "light" ? "mapbox://styles/mapbox/light-v11" : "mapbox://styles/mapbox/dark-v11", o = J({
58
- id: g.current,
1902
+ }, Se = () => {
1903
+ var j, ie;
1904
+ const v = h.palette.mode === "light" ? "mapbox://styles/mapbox/light-v11" : "mapbox://styles/mapbox/dark-v11", m = st({
1905
+ id: f.current,
59
1906
  center: [0, 0],
60
- style: e,
61
- accessToken: P
1907
+ style: v,
1908
+ accessToken: s
62
1909
  });
63
- (f = r.current) == null || f.addLayer(o.layer), c.current = o;
64
- const t = new A(), n = new U({
65
- source: t,
66
- gradient: [...x].reverse()
1910
+ (j = c.current) == null || j.addLayer(m.layer), l.current = m;
1911
+ const E = new Oe(), y = new Xt({
1912
+ source: E,
1913
+ gradient: [...o].reverse()
67
1914
  });
68
- if ((S = r.current) == null || S.addLayer(n), m.current = t, I(!0), k(), y(), s != null && s.boundingBox && r.current) {
69
- const { bottomLeft: T, topRight: M } = s.boundingBox, H = [
70
- T.longitude,
71
- T.latitude,
72
- M.longitude,
73
- M.latitude
74
- ], q = V(H, "EPSG:4326", "EPSG:3857");
75
- r.current.centerToExtent(q);
76
- }
77
- }, z = () => {
78
- var t, n;
79
- if (!c.current) return;
80
- const e = p.palette.mode === "light" ? "mapbox://styles/mapbox/light-v11" : "mapbox://styles/mapbox/dark-v11", o = ((n = (t = c.current.layer.getSource()) == null ? void 0 : t.getMapboxMap) == null ? void 0 : n.call(t)) || c.current.map;
81
- o && o.setStyle(e);
1915
+ if ((ie = c.current) == null || ie.addLayer(y), x.current = E, N(!0), Le(), _(), r != null && r.boundingBox && c.current) {
1916
+ const { bottomLeft: se, topRight: oe } = r.boundingBox, Ue = [
1917
+ se.longitude,
1918
+ se.latitude,
1919
+ oe.longitude,
1920
+ oe.latitude
1921
+ ], we = Ke(Ue, "EPSG:4326", "EPSG:3857");
1922
+ c.current.centerToExtent(we);
1923
+ }
1924
+ }, Ce = () => {
1925
+ var E, y;
1926
+ if (!l.current) return;
1927
+ const v = h.palette.mode === "light" ? "mapbox://styles/mapbox/light-v11" : "mapbox://styles/mapbox/dark-v11", m = ((y = (E = l.current.layer.getSource()) == null ? void 0 : E.getMapboxMap) == null ? void 0 : y.call(E)) || l.current.map;
1928
+ m && m.setStyle(v);
82
1929
  };
83
- h(() => (L(), () => {
84
- }), [i, b]), h(() => (z(), () => {
85
- }), [p.palette.mode]);
86
- const D = { ...d };
1930
+ ce(() => (O(), () => {
1931
+ }), [e, S]), ce(() => (Ce(), () => {
1932
+ }), [h.palette.mode]);
1933
+ const Pe = { ...t };
87
1934
  return {
88
- refs: { mapRef: r, mapId: g },
89
- actions: { onInit: B, onMapResize: G },
90
- gradient: x,
91
- ownerState: D,
92
- sx: w,
93
- other: R
1935
+ refs: { mapRef: c, mapId: f },
1936
+ actions: { onInit: Se, onMapResize: g },
1937
+ gradient: o,
1938
+ ownerState: Pe,
1939
+ sx: a,
1940
+ other: u
94
1941
  };
95
1942
  };
96
1943
  export {
97
- ae as useHeatMapLogic
1944
+ nr as useHeatMapLogic
98
1945
  };