@datagouv/components-next 1.5.1-dev.1397.g7333a397 → 1.5.1-dev.1398.g03d927e4

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 (34) hide show
  1. package/dist/{Control-DPuXeUqi.js → Control-BbyEe8x_.js} +7 -7
  2. package/dist/{Datafair.client-LlEgG7WU.js → Datafair.client-Dy9xu8CW.js} +1 -1
  3. package/dist/{Image-DVWRoLLI.js → Image-umPJvSA8.js} +16 -13
  4. package/dist/{ImagePreview.client-Db5dmxMP.js → ImagePreview.client-CwAd1LgO.js} +1 -1
  5. package/dist/{JsonPreview.client-DKy2AexC.js → JsonPreview.client-B_3llbkW.js} +2 -2
  6. package/dist/{Layer-D_5tYbVm.js → Layer-CagLskq_.js} +67 -61
  7. package/dist/{Map-CTBJEae_.js → Map-Cek3vwVi.js} +1094 -932
  8. package/dist/{MapContainer.client-DoN1jSzM.js → MapContainer.client-AMALm4aj.js} +7 -7
  9. package/dist/{OSM-B5Zc3qAf.js → OSM-Bm69tJpi.js} +1 -1
  10. package/dist/{PdfPreview.client-D3wHTDb9.js → PdfPreview.client-BzcjEgi5.js} +3 -3
  11. package/dist/{PdfSkeleton-nas5Pmia.js → PdfSkeleton-CEK7DOge.js} +1 -1
  12. package/dist/{Pmtiles.client-DncYrZSp.js → Pmtiles.client-C8SVSeQV.js} +9992 -9271
  13. package/dist/{PreviewError-EeaGx3SL.js → PreviewError-DOcS8Jau.js} +83 -46
  14. package/dist/{PreviewWrapper-BhldDdXK.js → PreviewWrapper-CdSsdB9s.js} +1 -1
  15. package/dist/{ScaleLine-C_tuJ6VG.js → ScaleLine-C8xmHdEk.js} +15 -8
  16. package/dist/Tile-DfivRbb3.js +479 -0
  17. package/dist/{Tile-8nHSuqcv.js → Tile-DvVc2IeI.js} +220 -151
  18. package/dist/{TileImage-CgO5alXc.js → TileImage-CxC7EP7_.js} +53 -45
  19. package/dist/{View-Dad8DfSD.js → View-44C9US2-.js} +210 -208
  20. package/dist/{XmlPreview.client-CmGbc3c3.js → XmlPreview.client-BnIm8NMm.js} +2 -2
  21. package/dist/assets/maplibre-gl-worker-Dlv-oLtU.js +10 -0
  22. package/dist/components-next.css +1 -1
  23. package/dist/components-next.js +11524 -10316
  24. package/dist/components.css +2 -2
  25. package/dist/{france-BtSQqcqV.js → france-DjD07ZB4.js} +1 -1
  26. package/dist/{proj-COhZ08DR.js → proj-0ED4AWuV.js} +260 -246
  27. package/dist/purify.es-D-UgLNEK.js +848 -0
  28. package/dist/{src-DJJgtynU.js → src-DdUvT8zT.js} +1972 -1306
  29. package/dist/{transform-CNeEnSK9.js → transform-bRfffInI.js} +3 -3
  30. package/package.json +18 -18
  31. package/src/components/Form/SelectGroup.vue +0 -2
  32. package/dist/Tile-Bu5lF4M5.js +0 -463
  33. package/dist/assets/maplibre-gl-worker-CEzvAyZY.js +0 -10
  34. package/dist/purify.es-eElsWhh7.js +0 -876
@@ -1,11 +1,11 @@
1
1
  import { r as e } from "./rolldown-runtime-DsPmjQRF.js";
2
- import { c as t, d as n, i as r, p as i, s as a, t as o } from "./Tile-Bu5lF4M5.js";
3
- import { a as s, c, d as l, f as u, l as d, p as f, u as p, w as m } from "./Image-DVWRoLLI.js";
4
- import { $t as h, Bt as g, Ct as _, Dt as v, Et as y, Ot as b, Pt as ee, Tt as x, Vt as S, Xt as C, _t as w, an as T, dt as te, in as E, kt as ne, nt as D, ot as O, s as k, u as A, vt as j, wt as M, zt as N } from "./proj-COhZ08DR.js";
5
- import { S as P, a as F, f as I, i as L, n as R, r as z, s as re } from "./transform-CNeEnSK9.js";
6
- import { i as ie, o as B, p as V, t as ae } from "./Layer-D_5tYbVm.js";
2
+ import { c as t, d as n, i as r, p as i, s as a, t as o } from "./Tile-DfivRbb3.js";
3
+ import { a as s, c, d as l, f as u, l as d, p as f, u as p, w as m } from "./Image-umPJvSA8.js";
4
+ import { At as h, Bt as g, Dt as _, Et as v, Ft as y, Ot as b, Qt as x, Tt as S, Xt as C, Yt as w, ft as T, kt as E, on as D, rt as O, s as k, sn as A, st as j, tn as M, u as N, vt as P, wt as F, yt as I } from "./proj-0ED4AWuV.js";
5
+ import { S as L, a as R, f as z, i as B, n as V, r as H, s as ee } from "./transform-bRfffInI.js";
6
+ import { i as te, o as U, p as W, t as ne } from "./Layer-CagLskq_.js";
7
7
  // ../node_modules/ol/render/canvas/ZIndexContext.js
8
- var H = class {
8
+ var G = class {
9
9
  constructor() {
10
10
  this.instructions_ = [], this.zIndex = 0, this.offset_ = 0, this.pendingMethod_, this.context_ = new Proxy(u(), {
11
11
  get: (e, t) => {
@@ -46,9 +46,9 @@ var H = class {
46
46
  offset() {
47
47
  this.offset_ = this.instructions_.length, this.zIndex = 0;
48
48
  }
49
- }, oe = 5, se = class extends S {
49
+ }, re = 5, ie = class extends g {
50
50
  constructor(e) {
51
- super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = [], this.maxStaleKeys = oe, this.renderedSourceKey_;
51
+ super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = [], this.maxStaleKeys = re, this.renderedSourceKey_;
52
52
  }
53
53
  getStaleKeys() {
54
54
  return this.staleKeys_;
@@ -60,16 +60,16 @@ var H = class {
60
60
  this.renderedSourceKey_ ? this.renderedSourceKey_ !== e && (this.prependStaleKey(this.renderedSourceKey_), this.renderedSourceKey_ = e) : this.renderedSourceKey_ = e;
61
61
  }
62
62
  getFeatures(e) {
63
- return N();
63
+ return w();
64
64
  }
65
65
  getData(e) {
66
66
  return null;
67
67
  }
68
68
  prepareFrame(e) {
69
- return N();
69
+ return w();
70
70
  }
71
71
  renderFrame(e, t) {
72
- return N();
72
+ return w();
73
73
  }
74
74
  forEachFeatureAtCoordinate(e, t, n, r, i) {}
75
75
  getLayer() {
@@ -82,7 +82,7 @@ var H = class {
82
82
  }
83
83
  loadImage(e) {
84
84
  let t = e.getState();
85
- return t != s.LOADED && t != s.ERROR && e.addEventListener(T.CHANGE, this.boundHandleImageChange_), t == s.IDLE && (e.load(), t = e.getState()), t == s.LOADED;
85
+ return t != s.LOADED && t != s.ERROR && e.addEventListener(A.CHANGE, this.boundHandleImageChange_), t == s.IDLE && (e.load(), t = e.getState()), t == s.LOADED;
86
86
  }
87
87
  renderIfReadyAndVisible() {
88
88
  let e = this.getLayer();
@@ -90,25 +90,28 @@ var H = class {
90
90
  }
91
91
  renderDeferred(e) {}
92
92
  disposeInternal() {
93
- delete this.layer_, super.disposeInternal();
93
+ this.layer_ = void 0, super.disposeInternal();
94
94
  }
95
- }, ce = [], U = null;
96
- function le() {
97
- U = p(1, 1, void 0, { willReadFrequently: !0 });
95
+ }, ae = [], K = null;
96
+ function oe() {
97
+ K = p(1, 1, void 0, { willReadFrequently: !0 });
98
98
  }
99
- var W = class extends se {
99
+ var q = class extends ie {
100
100
  constructor(e) {
101
- super(e), this.container = null, this.renderedResolution, this.tempTransform = L(), this.pixelTransform = L(), this.inversePixelTransform = L(), this.context = null, this.deferredContext_ = null, this.containerReused = !1, this.frameState = null;
101
+ super(e), this.wantRotation = !1, this.container = null, this.renderedResolution, this.tempTransform = B(), this.pixelTransform = B(), this.inversePixelTransform = B(), this.context = null, this.deferredContext_ = null, this.containerReused = !1, this.frameState = null;
102
102
  }
103
103
  getImageData(e, t, n) {
104
- U || le(), U.clearRect(0, 0, 1, 1);
105
- let r;
104
+ K || oe();
105
+ let r = K;
106
+ if (!r) return null;
107
+ r.clearRect(0, 0, 1, 1);
108
+ let i;
106
109
  try {
107
- U.drawImage(e, t, n, 1, 1, 0, 0, 1, 1), r = U.getImageData(0, 0, 1, 1).data;
110
+ r.drawImage(e, t, n, 1, 1, 0, 0, 1, 1), i = r.getImageData(0, 0, 1, 1).data;
108
111
  } catch {
109
- return U = null, null;
112
+ return K = null, null;
110
113
  }
111
- return r;
114
+ return i;
112
115
  }
113
116
  getBackground(e) {
114
117
  let t = this.getLayer().getBackground();
@@ -123,11 +126,11 @@ var W = class extends se {
123
126
  }
124
127
  }
125
128
  let a = this.getLayer().getClassName(), o, s;
126
- if (e && e.className === a && (!n || e && e.style.backgroundColor && h(B(e.style.backgroundColor), B(n)))) {
129
+ if (e && e.className === a && (!n || e && e.style.backgroundColor && M(U(e.style.backgroundColor), U(n)))) {
127
130
  let t = e.firstElementChild;
128
131
  f(t) && (s = t.getContext("2d"));
129
132
  }
130
- if (s && F(s.canvas.style.transform, t) ? (this.container = e, this.context = s, this.containerReused = !0) : this.containerReused ? (this.container = null, this.context = null, this.containerReused = !1) : this.container && (this.container.style.backgroundColor = null), !this.container) {
133
+ if (s && R(s.canvas.style.transform, t) ? (this.container = e, this.context = s, this.containerReused = !0) : this.containerReused ? (this.container = null, this.context = null, this.containerReused = !1) : this.container && (this.container.style.backgroundColor = null), !this.container) {
131
134
  o = m ? l() : document.createElement("div"), o.className = a;
132
135
  let e = o.style;
133
136
  e.position = "absolute", e.width = "100%", e.height = "100%", s = p();
@@ -137,53 +140,69 @@ var W = class extends se {
137
140
  !this.containerReused && n && !this.container.style.backgroundColor && (this.container.style.backgroundColor = n);
138
141
  }
139
142
  clipUnrotated(e, t, n) {
140
- let r = y(n), i = v(n), a = j(n), o = w(n);
141
- R(t.coordinateToPixelTransform, r), R(t.coordinateToPixelTransform, i), R(t.coordinateToPixelTransform, a), R(t.coordinateToPixelTransform, o);
143
+ let r = _(n), i = b(n), a = I(n), o = P(n);
144
+ V(t.coordinateToPixelTransform, r), V(t.coordinateToPixelTransform, i), V(t.coordinateToPixelTransform, a), V(t.coordinateToPixelTransform, o);
142
145
  let s = this.inversePixelTransform;
143
- R(s, r), R(s, i), R(s, a), R(s, o), e.save(), e.beginPath(), e.moveTo(Math.round(r[0]), Math.round(r[1])), e.lineTo(Math.round(i[0]), Math.round(i[1])), e.lineTo(Math.round(a[0]), Math.round(a[1])), e.lineTo(Math.round(o[0]), Math.round(o[1])), e.clip();
146
+ V(s, r), V(s, i), V(s, a), V(s, o), e.save(), e.beginPath(), e.moveTo(Math.round(r[0]), Math.round(r[1])), e.lineTo(Math.round(i[0]), Math.round(i[1])), e.lineTo(Math.round(a[0]), Math.round(a[1])), e.lineTo(Math.round(o[0]), Math.round(o[1])), e.clip();
144
147
  }
145
148
  prepareContainer(e, t) {
146
- let n = e.extent, r = e.viewState.resolution, i = e.viewState.rotation, a = e.pixelRatio, o = Math.round(b(n) / r * a), s = Math.round(_(n) / r * a);
147
- z(this.pixelTransform, e.size[0] / 2, e.size[1] / 2, 1 / a, 1 / a, i, -o / 2, -s / 2), re(this.inversePixelTransform, this.pixelTransform);
148
- let c = I(this.pixelTransform), l = this.getBackground(e);
149
- if (this.useContainer(t, c, l, o, s), !this.containerReused) {
149
+ let n = e.extent, r = e.viewState.resolution, i = this.sourceRotates(), a = i ? 0 : e.viewState.rotation, o = e.pixelRatio, s = Math.round(i ? e.size[0] * o : E(n) / r * o), c = Math.round(i ? e.size[1] * o : F(n) / r * o);
150
+ H(this.pixelTransform, e.size[0] / 2, e.size[1] / 2, 1 / o, 1 / o, a, -s / 2, -c / 2), ee(this.inversePixelTransform, this.pixelTransform);
151
+ let l = z(this.pixelTransform), u = this.getBackground(e);
152
+ if (this.useContainer(t, l, u, s, c), !this.containerReused) {
150
153
  let e = this.context.canvas;
151
- e.width != o || e.height != s ? (e.width = o, e.height = s) : this.context.clearRect(0, 0, o, s), c !== e.style.transform && (e.style.transform = c);
154
+ e.width != s || e.height != c ? (e.width = s, e.height = c) : this.context.clearRect(0, 0, s, c), l !== e.style.transform && (e.style.transform = l);
152
155
  }
153
156
  }
154
157
  dispatchRenderEvent_(e, t, n) {
155
158
  let r = this.getLayer();
156
159
  if (r.hasListener(e)) {
157
- let i = new ie(e, this.inversePixelTransform, n, t);
160
+ let i = new te(e, this.inversePixelTransform, n, t);
158
161
  r.dispatchEvent(i);
159
162
  }
160
163
  }
161
164
  preRender(e, t) {
162
- this.frameState = t, t.declutter || this.dispatchRenderEvent_(V.PRERENDER, e, t);
165
+ this.frameState = t, t.declutter || this.dispatchRenderEvent_(W.PRERENDER, e, t);
163
166
  }
164
167
  postRender(e, t) {
165
- t.declutter || this.dispatchRenderEvent_(V.POSTRENDER, e, t);
168
+ t.declutter || this.dispatchRenderEvent_(W.POSTRENDER, e, t);
166
169
  }
167
170
  renderDeferredInternal(e) {}
168
171
  getRenderContext(e) {
169
- return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new H()), e.declutter ? this.deferredContext_.getContext() : this.context;
172
+ return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new G()), e.declutter ? this.deferredContext_.getContext() : this.context;
173
+ }
174
+ getCanvasContext() {
175
+ let e = this.context;
176
+ if (!e) throw Error("Canvas context not initialized");
177
+ return e;
178
+ }
179
+ getContainerElement() {
180
+ let e = this.container;
181
+ if (!e) throw Error("Canvas container not initialized");
182
+ return e;
170
183
  }
171
184
  renderDeferred(e) {
172
- e.declutter && (this.dispatchRenderEvent_(V.PRERENDER, this.context, e), e.declutter && this.deferredContext_ && (this.deferredContext_.draw(this.context), this.deferredContext_.clear()), this.renderDeferredInternal(e), this.dispatchRenderEvent_(V.POSTRENDER, this.context, e));
185
+ e.declutter && (this.dispatchRenderEvent_(W.PRERENDER, this.context, e), e.declutter && this.deferredContext_ && (this.deferredContext_.draw(this.context), this.deferredContext_.clear()), this.renderDeferredInternal(e), this.dispatchRenderEvent_(W.POSTRENDER, this.context, e));
173
186
  }
174
187
  getRenderTransform(e, t, n, r, i, a, o) {
175
188
  let s = i / 2, c = a / 2, l = r / t, u = -l, d = -e[0] + o, f = -e[1];
176
- return z(this.tempTransform, s, c, l, u, -n, d, f);
189
+ return H(this.tempTransform, s, c, l, u, -n, d, f);
190
+ }
191
+ sourceRotates() {
192
+ return this.wantRotation && !!this.getLayer().getSource()?.canRotate;
177
193
  }
178
194
  disposeInternal() {
179
195
  delete this.frameState, super.disposeInternal();
180
196
  }
181
197
  };
182
198
  // ../node_modules/ol/DataTile.js
183
- function G(e) {
199
+ function J(e) {
184
200
  return e instanceof Image || e instanceof HTMLCanvasElement || e instanceof HTMLVideoElement || e instanceof ImageBitmap ? e : null;
185
201
  }
186
- var ue = /* @__PURE__ */ Error("disposed"), K = [256, 256], q = class extends i {
202
+ function Y(e) {
203
+ return e instanceof Uint8Array || e instanceof Uint8ClampedArray || e instanceof Float32Array || e instanceof DataView ? e : null;
204
+ }
205
+ var se = /* @__PURE__ */ Error("disposed"), ce = [256, 256], X = class extends i {
187
206
  constructor(e) {
188
207
  let t = d.IDLE;
189
208
  super(e.tileCoord, t, {
@@ -193,8 +212,8 @@ var ue = /* @__PURE__ */ Error("disposed"), K = [256, 256], q = class extends i
193
212
  }
194
213
  getSize() {
195
214
  if (this.size_) return this.size_;
196
- let e = G(this.data_);
197
- return e ? [e.width, e.height] : K;
215
+ let e = J(this.data_);
216
+ return e ? [e.width, e.height] : ce;
198
217
  }
199
218
  getData() {
200
219
  return this.data_;
@@ -213,15 +232,15 @@ var ue = /* @__PURE__ */ Error("disposed"), K = [256, 256], q = class extends i
213
232
  });
214
233
  }
215
234
  disposeInternal() {
216
- this.controller_ &&= (this.controller_.abort(ue), null), super.disposeInternal();
235
+ this.controller_ &&= (this.controller_.abort(se), null), super.disposeInternal();
217
236
  }
218
- }, J = class {
237
+ }, Z = class {
219
238
  constructor(e) {
220
239
  this.highWaterMark = e === void 0 ? 2048 : e, this.count_ = 0, this.entries_ = {}, this.oldest_ = null, this.newest_ = null;
221
240
  }
222
241
  deleteOldest() {
223
242
  let e = this.pop();
224
- e instanceof E && e.dispose();
243
+ e instanceof D && e.dispose();
225
244
  }
226
245
  canExpireCache() {
227
246
  return this.highWaterMark > 0 && this.getCount() > this.highWaterMark;
@@ -241,11 +260,11 @@ var ue = /* @__PURE__ */ Error("disposed"), K = [256, 256], q = class extends i
241
260
  }
242
261
  get(e, t) {
243
262
  let n = this.entries_[e];
244
- return P(n !== void 0, "Tried to get a value for a key that does not exist in the cache"), n === this.newest_ || (n === this.oldest_ ? (this.oldest_ = this.oldest_.newer, this.oldest_.older = null) : (n.newer.older = n.older, n.older.newer = n.newer), n.newer = null, n.older = this.newest_, this.newest_.newer = n, this.newest_ = n), n.value_;
263
+ return L(n !== void 0, "Tried to get a value for a key that does not exist in the cache"), n === this.newest_ || (n === this.oldest_ ? (this.oldest_ = this.oldest_.newer, this.oldest_.older = null) : (n.newer.older = n.older, n.older.newer = n.newer), n.newer = null, n.older = this.newest_, this.newest_.newer = n, this.newest_ = n), n.value_;
245
264
  }
246
265
  remove(e) {
247
266
  let t = this.entries_[e];
248
- return P(t !== void 0, "Tried to get a value for a key that does not exist in the cache"), t === this.newest_ ? (this.newest_ = t.older, this.newest_ && (this.newest_.newer = null)) : t === this.oldest_ ? (this.oldest_ = t.newer, this.oldest_ && (this.oldest_.older = null)) : (t.newer.older = t.older, t.older.newer = t.newer), delete this.entries_[e], --this.count_, t.value_;
267
+ return L(t !== void 0, "Tried to get a value for a key that does not exist in the cache"), t === this.newest_ ? (this.newest_ = t.older, this.newest_ && (this.newest_.newer = null)) : t === this.oldest_ ? (this.oldest_ = t.newer, this.oldest_ && (this.oldest_.older = null)) : (t.newer.older = t.older, t.older.newer = t.newer), delete this.entries_[e], --this.count_, t.value_;
249
268
  }
250
269
  getCount() {
251
270
  return this.count_;
@@ -280,7 +299,7 @@ var ue = /* @__PURE__ */ Error("disposed"), K = [256, 256], q = class extends i
280
299
  this.get(e), this.entries_[e].value_ = t;
281
300
  }
282
301
  set(e, t) {
283
- P(!(e in this.entries_), "Tried to set a value for a key that is used already");
302
+ L(!(e in this.entries_), "Tried to set a value for a key that is used already");
284
303
  let n = {
285
304
  key_: e,
286
305
  newer: null,
@@ -294,41 +313,44 @@ var ue = /* @__PURE__ */ Error("disposed"), K = [256, 256], q = class extends i
294
313
  }
295
314
  };
296
315
  // ../node_modules/ol/renderer/canvas/TileLayer.js
297
- function Y(e, t, n) {
316
+ function Q(e, t, n) {
298
317
  if (!(n in e)) return e[n] = /* @__PURE__ */ new Set([t]), !0;
299
318
  let r = e[n], i = r.has(t);
300
319
  return i || r.add(t), !i;
301
320
  }
302
- function de(e, t, n) {
321
+ function le(e, t, n) {
303
322
  let r = e[n];
304
323
  return r ? r.delete(t) : !1;
305
324
  }
306
- function X(e, t) {
325
+ function ue(e, t) {
307
326
  let n = e.layerStatesArray[e.layerIndex];
308
- n.extent && (t = M(t, A(n.extent, e.viewState.projection)));
327
+ if (n.extent && (t = S(t, N(n.extent, e.viewState.projection))), !n.layer) return t;
309
328
  let r = n.layer.getRenderSource();
310
329
  if (!r.getWrapX()) {
311
330
  let n = r.getTileGridForProjection(e.viewState.projection).getExtent();
312
- n && (t = M(t, n));
331
+ n && (t = S(t, n));
313
332
  }
314
333
  return t;
315
334
  }
316
- var Z = class extends W {
335
+ var de = class extends q {
317
336
  constructor(e, t) {
318
- super(e), t ||= {}, this.extentChanged = !0, this.renderComplete = !1, this.renderedExtent_ = null, this.renderedPixelRatio, this.renderedProjection = null, this.renderedTiles = [], this.renderedSourceRevision_, this.tempExtent = O(), this.tempTileRange_ = new n(0, 0, 0, 0), this.tempTileCoord_ = a(0, 0, 0);
337
+ super(e), t ||= {}, this.extentChanged = !0, this.renderComplete = !1, this.renderedExtent_ = null, this.renderedPixelRatio, this.renderedProjection = null, this.renderedTiles = [], this.renderedSourceRevision_, this.tempExtent = j(), this.tempTileRange_ = new n(0, 0, 0, 0), this.tempTileCoord_ = a(0, 0, 0);
319
338
  let r = t.cacheSize === void 0 ? 512 : t.cacheSize;
320
- this.tileCache_ = new J(r), this.sourceTileCache_ = null, this.layerExtent = null, this.maxStaleKeys = r * .5;
339
+ this.tileCache_ = new Z(r), this.sourceTileCache_ = null, this.layerExtent = null, this.maxStaleKeys = r * .5;
321
340
  }
322
341
  getTileCache() {
323
342
  return this.tileCache_;
324
343
  }
325
344
  getSourceTileCache() {
326
- return this.sourceTileCache_ ||= new J(512), this.sourceTileCache_;
345
+ return this.sourceTileCache_ ||= new Z(512), this.sourceTileCache_;
327
346
  }
328
347
  getOrCreateTile(e, n, r, i) {
329
- let a = this.tileCache_, o = this.getLayer().getSource(), s = t(o, o.getKey(), e, n, r), c;
330
- if (a.containsKey(s)) c = a.get(s);
331
- else {
348
+ let a = this.tileCache_, o = this.getLayer().getSource();
349
+ if (!o) return null;
350
+ let s = t(o, o.getKey(), e, n, r), c;
351
+ if (a.containsKey(s)) {
352
+ if (c = a.get(s), !c) return null;
353
+ } else {
332
354
  let t = i.viewState.projection, l = o.getProjection();
333
355
  if (c = o.getTile(e, n, r, i.pixelRatio, t, !l || k(l, t) ? void 0 : this.getSourceTileCache()), !c) return null;
334
356
  a.set(s, c);
@@ -341,22 +363,60 @@ var Z = class extends W {
341
363
  getData(e) {
342
364
  let t = this.frameState;
343
365
  if (!t) return null;
344
- let n = this.getLayer(), i = R(t.pixelToCoordinateTransform, e.slice()), a = n.getExtent();
345
- if (a && !D(a, i)) return null;
346
- let s = t.viewState, l = n.getRenderSource(), u = l.getTileGridForProjection(s.projection), f = l.getTilePixelRatio(t.pixelRatio);
366
+ let n = this.getLayer(), i = V(t.pixelToCoordinateTransform, e.slice()), a = n.getExtent();
367
+ if (a && !O(a, i)) return null;
368
+ let s = t.viewState, l = n.getRenderSource();
369
+ if (!l) return null;
370
+ let u = l.getTileGridForProjection(s.projection), f = l.getTilePixelRatio(t.pixelRatio);
347
371
  for (let e = u.getZForResolution(s.resolution); e >= u.getMinZoom(); --e) {
348
372
  let n = u.getTileCoordForCoordAndZ(i, e), a = this.getTile(e, n[1], n[2], t);
349
373
  if (!a || a.getState() !== d.LOADED) continue;
350
- let p = u.getOrigin(e), m = c(u.getTileSize(e)), h = u.getResolution(e), g;
374
+ let p = u.getOrigin(e), m = c(u.getTileSize(e)), h = u.getResolution(e), g = null;
351
375
  if (a instanceof r || a instanceof o) g = a.getImage();
352
- else if (a instanceof q) {
353
- if (g = G(a.getData()), !g) continue;
354
- } else continue;
376
+ else if (a instanceof X) {
377
+ let e = a.getData();
378
+ e && (g = J(e));
379
+ }
380
+ if (!g) continue;
355
381
  let _ = Math.floor(f * ((i[0] - p[0]) / h - n[1] * m[0])), v = Math.floor(f * ((p[1] - i[1]) / h - n[2] * m[1])), y = Math.round(f * l.getGutterForProjection(s.projection));
356
382
  return this.getImageData(g, _ + y, v + y);
357
383
  }
358
384
  return null;
359
385
  }
386
+ readData(e) {
387
+ let t = this.getLayer().getRenderSource();
388
+ if (!t) return null;
389
+ let n = e.viewState, r = n.projection;
390
+ if (t.getGutterForProjection(r)) throw Error("readData() does not support sources with a gutter");
391
+ let i = t.getTileGridForProjection(r), a = n.resolution, o = e.extent, s = i.getZForResolution(a), c = {};
392
+ this.enqueueTiles(e, o, s, c, 0);
393
+ let l = c[s];
394
+ if (!l) return null;
395
+ let u = [], f = !0;
396
+ if (l.forEach((e) => {
397
+ let t = e, n = t.getState();
398
+ n === d.LOADED ? u.push(t) : n !== d.ERROR && n !== d.EMPTY && (f = !1);
399
+ }), !f || u.length === 0) return null;
400
+ let p = e.size[0], m = e.size[1], h = u[0], g = Y(h.getData());
401
+ if (!g || g instanceof DataView) throw Error("ol/renderer/canvas/TileLayer#readData only supports typed array tile data");
402
+ let _ = h.getSize(), v = Math.round(g.length / (_[0] * _[1])), y = g.constructor, b = new y(p * m * v);
403
+ for (let e of u) {
404
+ let t = i.getTileCoordExtent(e.tileCoord, this.tempExtent), n = e.getSize(), r = Y(e.getData()), s = (t[0] - o[0]) / a - .5, c = (o[3] - t[3]) / a - .5, l = E(t) / a, u = F(t) / a, d = n[0] / l, f = n[1] / u, h = Math.max(0, Math.ceil(s)), g = Math.min(p, Math.ceil(s + l)), _ = Math.max(0, Math.ceil(c)), y = Math.min(m, Math.ceil(c + u));
405
+ for (let e = _; e < y; ++e) {
406
+ let t = Math.min(Math.floor((e - c) * f), n[1] - 1);
407
+ for (let i = h; i < g; ++i) {
408
+ let a = Math.min(Math.floor((i - s) * d), n[0] - 1), o = (t * n[0] + a) * v, c = (e * p + i) * v;
409
+ for (let e = 0; e < v; ++e) b[c + e] = r[o + e];
410
+ }
411
+ }
412
+ }
413
+ return this.updateCacheSize(l.size), this.tileCache_.expireCache(), this.sourceTileCache_?.expireCache(), {
414
+ data: b,
415
+ width: p,
416
+ height: m,
417
+ bandCount: v
418
+ };
419
+ }
360
420
  prepareFrame(e) {
361
421
  this.renderedProjection ? e.viewState.projection !== this.renderedProjection && (this.tileCache_.clear(), this.renderedProjection = e.viewState.projection) : this.renderedProjection = e.viewState.projection;
362
422
  let t = this.getLayer().getSource();
@@ -368,19 +428,21 @@ var Z = class extends W {
368
428
  return !0;
369
429
  }
370
430
  enqueueTiles(e, t, n, r, i) {
371
- let o = e.viewState, s = this.getLayer(), c = s.getRenderSource(), l = c.getTileGridForProjection(o.projection), u = g(c);
431
+ let o = e.viewState, s = this.getLayer(), c = s.getRenderSource();
432
+ if (!c) return;
433
+ let l = c.getTileGridForProjection(o.projection), u = C(c);
372
434
  u in e.wantedTiles || (e.wantedTiles[u] = {});
373
- let f = e.wantedTiles[u], p = s.getMapInternal(), m = Math.max(n - i, l.getMinZoom(), l.getZForResolution(Math.min(s.getMaxResolution(), p ? p.getView().getResolutionForZoom(Math.max(s.getMinZoom(), 0)) : l.getResolution(0)), c.zDirection)), h = o.rotation, _ = h ? x(o.center, o.resolution, h, e.size) : void 0;
435
+ let f = e.wantedTiles[u], p = s.getMapInternal(), m = Math.max(n - i, l.getMinZoom(), l.getZForResolution(Math.min(s.getMaxResolution(), p ? p.getView().getResolutionForZoom(Math.max(s.getMinZoom(), 0)) : l.getResolution(0)), c.zDirection)), h = o.rotation, g = h ? v(o.center, o.resolution, h, e.size) : void 0;
374
436
  for (let i = n; i >= m; --i) {
375
437
  let n = l.getTileRangeForExtentAndZ(t, i, this.tempTileRange_), o = l.getResolution(i);
376
438
  for (let t = n.minX; t <= n.maxX; ++t) for (let s = n.minY; s <= n.maxY; ++s) {
377
- if (h && !l.tileCoordIntersectsViewport([
439
+ if (h && g && !l.tileCoordIntersectsViewport([
378
440
  i,
379
441
  t,
380
442
  s
381
- ], _)) continue;
443
+ ], g)) continue;
382
444
  let n = this.getTile(i, t, s, e);
383
- if (!n || !Y(r, n, i)) continue;
445
+ if (!n || !Q(r, n, i)) continue;
384
446
  let c = n.getKey();
385
447
  if (f[c] = !0, n.getState() === d.IDLE && !e.tileQueue.isKeyQueued(c)) {
386
448
  let r = a(i, t, s, this.tempTileCoord_);
@@ -395,12 +457,13 @@ var Z = class extends W {
395
457
  }
396
458
  }
397
459
  findStaleTile_(e, n) {
398
- let r = this.tileCache_, i = e[0], a = e[1], o = e[2], s = this.getStaleKeys();
460
+ let r = this.tileCache_, i = e[0], a = e[1], o = e[2], s = this.getStaleKeys(), c = this.getLayer().getSource();
461
+ if (!c) return !1;
399
462
  for (let e = 0; e < s.length; ++e) {
400
- let c = t(this.getLayer().getSource(), s[e], i, a, o);
401
- if (r.containsKey(c)) {
402
- let e = r.peek(c);
403
- if (e.getState() === d.LOADED) return e.endTransition(g(this)), Y(n, e, i), !0;
463
+ let l = t(c, s[e], i, a, o);
464
+ if (r.containsKey(l)) {
465
+ let e = r.peek(l);
466
+ if (e && e.getState() === d.LOADED) return e.endTransition(C(this)), Q(n, e, i), !0;
404
467
  }
405
468
  }
406
469
  return !1;
@@ -408,12 +471,14 @@ var Z = class extends W {
408
471
  findAltTiles_(e, n, r, i) {
409
472
  let a = e.getTileRangeForTileCoordAndZ(n, r, this.tempTileRange_);
410
473
  if (!a) return !1;
411
- let o = !0, s = this.tileCache_, c = this.getLayer().getRenderSource(), l = c.getKey();
474
+ let o = !0, s = this.tileCache_, c = this.getLayer().getRenderSource();
475
+ if (!c) return !1;
476
+ let l = c.getKey();
412
477
  for (let e = a.minX; e <= a.maxX; ++e) for (let n = a.minY; n <= a.maxY; ++n) {
413
478
  let a = t(c, l, r, e, n), u = !1;
414
479
  if (s.containsKey(a)) {
415
480
  let e = s.peek(a);
416
- e.getState() === d.LOADED && (Y(i, e, r), u = !0);
481
+ e && e.getState() === d.LOADED && (Q(i, e, r), u = !0);
417
482
  }
418
483
  u || (o = !1);
419
484
  }
@@ -421,122 +486,126 @@ var Z = class extends W {
421
486
  }
422
487
  renderFrame(e, t) {
423
488
  this.renderComplete = !0;
424
- let n = e.layerStatesArray[e.layerIndex], r = e.viewState, i = r.projection, a = r.resolution, o = r.center, s = e.pixelRatio, c = this.getLayer(), l = c.getSource(), u = l.getTileGridForProjection(i), f = u.getZForResolution(a, l.zDirection), p = u.getResolution(f);
489
+ let n = e.layerStatesArray[e.layerIndex], r = e.viewState, i = r.projection, a = r.resolution, o = r.center, s = e.pixelRatio, c = this.getLayer(), l = c.getSource();
490
+ if (!l) return this.getContainerElement();
491
+ let u = l.getTileGridForProjection(i), f = u.getZForResolution(a, l.zDirection), p = u.getResolution(f);
425
492
  this.updateStaleKeys(l.getKey());
426
- let m = e.extent, h = l.getTilePixelRatio(s);
493
+ let m = e.extent, g = l.getTilePixelRatio(s);
427
494
  this.prepareContainer(e, t);
428
- let _ = this.context.canvas.width, v = this.context.canvas.height;
429
- this.layerExtent = n.extent ? A(n.extent, i) : null, this.layerExtent && (m = M(m, this.layerExtent));
430
- let b = p * _ / 2 / h, x = p * v / 2 / h, S = [
431
- o[0] - b,
432
- o[1] - x,
433
- o[0] + b,
434
- o[1] + x
435
- ], w = {};
495
+ let v = this.getCanvasContext().canvas.width, b = this.getCanvasContext().canvas.height;
496
+ this.layerExtent = n.extent ? N(n.extent, i) : null, this.layerExtent && (m = S(m, this.layerExtent));
497
+ let w = p * v / 2 / g, E = p * b / 2 / g, D = [
498
+ o[0] - w,
499
+ o[1] - E,
500
+ o[0] + w,
501
+ o[1] + E
502
+ ], O = {};
436
503
  this.renderedTiles.length = 0;
437
- let T = c.getPreload();
504
+ let k = c.getPreload();
438
505
  if (e.nextExtent && this.enqueueTilesForNextExtent()) {
439
- let t = u.getZForResolution(r.nextResolution, l.zDirection), n = X(e, e.nextExtent);
440
- this.enqueueTiles(e, n, t, w, T);
506
+ let t = u.getZForResolution(r.nextResolution ?? a, l.zDirection), n = ue(e, e.nextExtent);
507
+ this.enqueueTiles(e, n, t, O, k);
441
508
  }
442
- let E = X(e, m);
443
- if (this.enqueueTiles(e, E, f, w, 0), T > 0 && setTimeout(() => {
444
- this.enqueueTiles(e, E, f - 1, w, T - 1);
445
- }, 0), !(f in w)) return this.container;
446
- let D = g(this), O = e.time;
447
- for (let t of w[f]) {
509
+ let A = ue(e, m);
510
+ if (this.enqueueTiles(e, A, f, O, 0), k > 0 && setTimeout(() => {
511
+ this.enqueueTiles(e, A, f - 1, O, k - 1);
512
+ }, 0), !(f in O)) return this.getContainerElement();
513
+ let j = C(this), M = e.time;
514
+ for (let t of O[f]) {
448
515
  let n = t.getState();
449
516
  if (n === d.EMPTY) continue;
450
517
  let r = t.tileCoord;
451
- if (n === d.LOADED && t.getAlpha(D, O) === 1) {
452
- t.endTransition(D);
518
+ if (n === d.LOADED && t.getAlpha(j, M) === 1) {
519
+ t.endTransition(j);
453
520
  continue;
454
521
  }
455
- if (n !== d.ERROR && (this.renderComplete = !1), this.findStaleTile_(r, w)) {
456
- de(w, t, f), e.animate = !0;
522
+ if (n !== d.ERROR && (this.renderComplete = !1), this.findStaleTile_(r, O)) {
523
+ le(O, t, f), e.animate = !0;
457
524
  continue;
458
525
  }
459
- if (this.findAltTiles_(u, r, f + 1, w)) continue;
526
+ if (this.findAltTiles_(u, r, f + 1, O)) continue;
460
527
  let i = u.getMinZoom();
461
- for (let e = f - 1; e >= i && !this.findAltTiles_(u, r, e, w); --e);
528
+ for (let e = f - 1; e >= i && !this.findAltTiles_(u, r, e, O); --e);
462
529
  }
463
- let k = p / a * s / h, j = this.getRenderContext(e);
464
- z(this.tempTransform, _ / 2, v / 2, k, k, 0, -_ / 2, -v / 2), this.layerExtent && this.clipUnrotated(j, e, this.layerExtent), l.getInterpolate() || (j.imageSmoothingEnabled = !1), this.preRender(j, e);
465
- let N = Object.keys(w).map(Number);
466
- N.sort(C);
467
- let P = [], F = [], I = [];
468
- for (let t = N.length - 1; t >= 0; --t) {
469
- let n = N[t], r = l.getTilePixelSize(n, s, i), a = u.getResolution(n) / p, o = r[0] * a * k, c = r[1] * a * k, m = u.getTileCoordForCoordAndZ(y(S), n), g = u.getTileCoordExtent(m), _ = R(this.tempTransform, [h * (g[0] - S[0]) / p, h * (S[3] - g[3]) / p]), v = h * l.getGutterForProjection(i);
470
- for (let t of w[n]) {
530
+ let P = p / a * s / g, F = this.getRenderContext(e);
531
+ H(this.tempTransform, v / 2, b / 2, P, P, 0, -v / 2, -b / 2), this.layerExtent && this.clipUnrotated(F, e, this.layerExtent), l.getInterpolate() || (F.imageSmoothingEnabled = !1), this.preRender(F, e);
532
+ let I = Object.keys(O).map(Number);
533
+ I.sort(x);
534
+ let L = [], R = [], z = [];
535
+ for (let t = I.length - 1; t >= 0; --t) {
536
+ let n = I[t], r = l.getTilePixelSize(n, s, i), a = u.getResolution(n) / p, o = r[0] * a * P, c = r[1] * a * P, m = u.getTileCoordForCoordAndZ(_(D), n), v = u.getTileCoordExtent(m), b = V(this.tempTransform, [g * (v[0] - D[0]) / p, g * (D[3] - v[3]) / p]), x = g * l.getGutterForProjection(i);
537
+ for (let t of O[n]) {
471
538
  if (t.getState() !== d.LOADED) continue;
472
- let r = t.tileCoord, i = m[1] - r[1], a = Math.round(_[0] - (i - 1) * o), s = m[2] - r[2], u = Math.round(_[1] - (s - 1) * c), p = Math.round(_[0] - i * o), h = Math.round(_[1] - s * c), g = a - p, y = u - h, b = n === f;
473
- if (b && t.inTransition(D)) {
474
- I.push({
539
+ let r = t.tileCoord, i = m[1] - r[1], a = Math.round(b[0] - (i - 1) * o), s = m[2] - r[2], u = Math.round(b[1] - (s - 1) * c), p = Math.round(b[0] - i * o), g = Math.round(b[1] - s * c), _ = a - p, v = u - g, S = n === f;
540
+ if (S && t.inTransition(j)) {
541
+ z.push({
475
542
  tile: t,
476
543
  x: p,
477
- y: h,
478
- w: g,
479
- h: y,
480
- gutter: v
544
+ y: g,
545
+ w: _,
546
+ h: v,
547
+ gutter: x
481
548
  }), this.renderedTiles.unshift(t), this.updateUsedTiles(e.usedTiles, l, t);
482
549
  continue;
483
550
  }
484
- let x = [
551
+ let C = [
485
552
  p,
486
- h,
487
- p + g,
488
- h + y
489
- ], S = [];
490
- for (let e = 0, t = P.length; e < t; ++e) n < F[e] && ne(x, P[e]) && S.push(P[e]);
491
- let C;
492
- S.length > 0 && (C = ee(x, S)), P.push(x), F.push(n), this.drawTile(t, e, p, h, g, y, v, b, C), this.renderedTiles.unshift(t), this.updateUsedTiles(e.usedTiles, l, t);
553
+ g,
554
+ p + _,
555
+ g + v
556
+ ], w = [];
557
+ for (let e = 0, t = L.length; e < t; ++e) n < R[e] && h(C, L[e]) && w.push(L[e]);
558
+ let T;
559
+ w.length > 0 && (T = y(C, w)), L.push(C), R.push(n), this.drawTile(t, e, p, g, _, v, x, S, T), this.renderedTiles.unshift(t), this.updateUsedTiles(e.usedTiles, l, t);
493
560
  }
494
561
  }
495
- for (let t = 0, n = I.length; t < n; ++t) {
496
- let { tile: n, x: r, y: i, w: a, h: o, gutter: s } = I[t];
562
+ for (let t = 0, n = z.length; t < n; ++t) {
563
+ let { tile: n, x: r, y: i, w: a, h: o, gutter: s } = z[t];
497
564
  this.drawTile(n, e, r, i, a, o, s, !0, void 0);
498
565
  }
499
- return this.renderedResolution = p, this.extentChanged = !this.renderedExtent_ || !te(this.renderedExtent_, S), this.renderedExtent_ = S, this.renderedPixelRatio = s, this.postRender(this.context, e), this.layerExtent && j.restore(), j.imageSmoothingEnabled = !0, this.renderComplete && e.postRenderFunctions.push((e, t) => {
500
- let n = g(l), r = t.wantedTiles[n], i = r ? Object.keys(r).length : 0;
566
+ return this.renderedResolution = p, this.extentChanged = !this.renderedExtent_ || !T(this.renderedExtent_, D), this.renderedExtent_ = D, this.renderedPixelRatio = s, this.postRender(this.getCanvasContext(), e), this.layerExtent && F.restore(), F.imageSmoothingEnabled = !0, this.renderComplete && e.postRenderFunctions.push((e, t) => {
567
+ let n = C(l), r = t.wantedTiles[n], i = r ? Object.keys(r).length : 0;
501
568
  this.updateCacheSize(i), this.tileCache_.expireCache(), this.sourceTileCache_?.expireCache();
502
- }), this.container;
569
+ }), this.getContainerElement();
503
570
  }
504
571
  updateCacheSize(e) {
505
572
  this.tileCache_.highWaterMark = Math.max(this.tileCache_.highWaterMark, e * 2);
506
573
  }
507
574
  drawTile(e, t, n, r, i, a, o, s, c) {
508
575
  let l;
509
- if (e instanceof q) {
510
- if (l = G(e.getData()), !l) throw Error("Rendering array data is not yet supported");
576
+ if (e instanceof X) {
577
+ let t = e.getData();
578
+ if (!t) return;
579
+ if (l = J(t), !l) throw Error("Rendering array data is not yet supported");
511
580
  } else l = this.getTileImage(e);
512
581
  if (!l) return;
513
- let u = this.getRenderContext(t), d = g(this), f = t.layerStatesArray[t.layerIndex], p = f.opacity * (s ? e.getAlpha(d, t.time) : 1), m = p !== u.globalAlpha;
582
+ let u = this.getRenderContext(t), d = C(this), f = t.layerStatesArray[t.layerIndex], p = f.opacity * (s ? e.getAlpha(d, t.time) : 1), m = p !== u.globalAlpha;
514
583
  m && (u.save(), u.globalAlpha = p);
515
- let h = l.width - 2 * o, _ = l.height - 2 * o;
584
+ let h = l.width - 2 * o, g = l.height - 2 * o;
516
585
  if (c) {
517
- let e = h / i, t = _ / a;
586
+ let e = h / i, t = g / a;
518
587
  for (let i = 0, a = c.length; i < a; ++i) {
519
588
  let a = c[i], s = a[0], d = a[1], f = a[2] - a[0], p = a[3] - a[1];
520
589
  u.drawImage(l, o + (s - n) * e, o + (d - r) * t, f * e, p * t, s, d, f, p);
521
590
  }
522
- } else u.drawImage(l, o, o, h, _, n, r, i, a);
591
+ } else u.drawImage(l, o, o, h, g, n, r, i, a);
523
592
  m && u.restore(), p === f.opacity ? s && e.endTransition(d) : t.animate = !0;
524
593
  }
525
594
  getImage() {
526
- let e = this.context;
595
+ let e = this.getCanvasContext();
527
596
  return e ? e.canvas : null;
528
597
  }
529
598
  getTileImage(e) {
530
- return e.getImage();
599
+ return e.getImage() ?? null;
531
600
  }
532
601
  updateUsedTiles(e, t, n) {
533
- let r = g(t);
602
+ let r = C(t);
534
603
  r in e || (e[r] = {}), e[r][n.getKey()] = !0;
535
604
  }
536
- }, Q = {
605
+ }, $ = {
537
606
  PRELOAD: "preload",
538
607
  USE_INTERIM_TILES_ON_ERROR: "useInterimTilesOnError"
539
- }, fe = class extends ae {
608
+ }, fe = class extends ne {
540
609
  constructor(e) {
541
610
  e ||= {};
542
611
  let t = Object.assign({}, e), n = e.cacheSize;
@@ -546,26 +615,26 @@ var Z = class extends W {
546
615
  return this.cacheSize_;
547
616
  }
548
617
  getPreload() {
549
- return this.get(Q.PRELOAD);
618
+ return this.get($.PRELOAD);
550
619
  }
551
620
  setPreload(e) {
552
- this.set(Q.PRELOAD, e);
621
+ this.set($.PRELOAD, e);
553
622
  }
554
623
  getUseInterimTilesOnError() {
555
- return this.get(Q.USE_INTERIM_TILES_ON_ERROR);
624
+ return this.get($.USE_INTERIM_TILES_ON_ERROR);
556
625
  }
557
626
  setUseInterimTilesOnError(e) {
558
- this.set(Q.USE_INTERIM_TILES_ON_ERROR, e);
627
+ this.set($.USE_INTERIM_TILES_ON_ERROR, e);
559
628
  }
560
629
  getData(e) {
561
630
  return super.getData(e);
562
631
  }
563
- }, pe = /* @__PURE__ */ e({ default: () => $ }), $ = class extends fe {
632
+ }, pe = /* @__PURE__ */ e({ default: () => me }), me = class extends fe {
564
633
  constructor(e) {
565
634
  super(e);
566
635
  }
567
636
  createRenderer() {
568
- return new Z(this, { cacheSize: this.getCacheSize() });
637
+ return new de(this, { cacheSize: this.getCacheSize() });
569
638
  }
570
639
  };
571
- export { W as a, Z as i, pe as n, ce as o, Q as r, H as s, $ as t };
640
+ export { q as a, de as i, pe as n, ae as o, $ as r, G as s, me as t };