@datagouv/components-next 1.0.1 → 1.0.2-dev.0

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 (33) hide show
  1. package/dist/{Control-BNCDn-8E.js → Control-DuZJdKV_.js} +1 -1
  2. package/dist/{Datafair.client-B5lBpOl8.js → Datafair.client-DpeBuzZZ.js} +1 -1
  3. package/dist/{Event-BOgJUhNR.js → Event--kp8kMdJ.js} +21 -21
  4. package/dist/{Image-BN-4XkIn.js → Image-34hvypZI.js} +114 -58
  5. package/dist/{JsonPreview.client-Doz1Z0BS.js → JsonPreview.client-B3sQR-rW.js} +1 -1
  6. package/dist/{Map-BdT3i2C4.js → Map-BjUnLyj8.js} +1534 -1466
  7. package/dist/{MapContainer.client-oiieO8H-.js → MapContainer.client-BA6GCqKX.js} +7 -7
  8. package/dist/{OSM-CamriM9b.js → OSM-s40W6sQ2.js} +22 -12
  9. package/dist/{PdfPreview.client-CdAhkDFJ.js → PdfPreview.client-CbeSChb8.js} +1 -1
  10. package/dist/Pmtiles.client-D8pFim1L.js +25190 -0
  11. package/dist/{ScaleLine-BiesrgOv.js → ScaleLine-KW-nXqp3.js} +2 -2
  12. package/dist/Swagger.client-B-2Q16qa.js +4 -0
  13. package/dist/{Tile-DCuqwNOI.js → Tile-DbNFNPfU.js} +189 -172
  14. package/dist/{TileImage-CmZf8EdU.js → TileImage-BsXBxMtq.js} +132 -102
  15. package/dist/{View-DcDc7N2K.js → View-BR92hTWP.js} +8 -8
  16. package/dist/{XmlPreview.client-CrjHf74q.js → XmlPreview.client-DWJt61wG.js} +2 -2
  17. package/dist/{common-C4rDcQpp.js → common-PJfpC179.js} +34 -33
  18. package/dist/components-next.css +4 -4
  19. package/dist/components-next.js +1 -1
  20. package/dist/components.css +1 -1
  21. package/dist/{index-Bbu9rOHt.js → index-DVp7Y0Xu.js} +11105 -6743
  22. package/dist/{main-CiH8ZmBI.js → main-CrSRA2X-.js} +22125 -22173
  23. package/dist/{proj-CKwYjU38.js → proj-DsetBcW7.js} +513 -498
  24. package/dist/{tilecoord-YW3qEH_j.js → tilecoord-Db24Px13.js} +242 -224
  25. package/dist/{vue3-xml-viewer.common-Bi_bsV6C.js → vue3-xml-viewer.common-BjA4LdSC.js} +1 -1
  26. package/package.json +2 -1
  27. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +1 -50
  28. package/src/composables/useResourceCapabilities.ts +1 -15
  29. package/src/functions/api.ts +3 -11
  30. package/src/types/resources.ts +0 -10
  31. package/dist/Pmtiles.client-B0v8tGJQ.js +0 -22812
  32. package/dist/Swagger.client-CsK65JnG.js +0 -4
  33. package/src/functions/resourceCapabilities.ts +0 -55
@@ -1,7 +1,7 @@
1
- import { T as g, l as Et, c as N, b as et } from "./Image-BN-4XkIn.js";
2
- import { y as xt, g as Tt } from "./common-C4rDcQpp.js";
3
- import { aC as pt, E as lt, ak as It, S as ft, g as nt, W as Xt, v as Mt, D as K, m as dt, K as L, an as _t, aS as vt, w as Wt, q as Yt, aT as Lt, aj as yt, aI as Ft, az as wt, aJ as Dt, aU as st, ac as ot, i as Pt, U as z, a0 as J, d as V, l as Ct, u as at, a6 as rt, H as Ot } from "./proj-CKwYjU38.js";
4
- class gt extends pt {
1
+ import { T as _, W as nt, n as xt, c as H, b as et } from "./Image-34hvypZI.js";
2
+ import { z as Tt, g as pt } from "./common-PJfpC179.js";
3
+ import { aC as It, E as ft, al as Xt, U as dt, g as at, X as Wt, w as Mt, F as b, n as _t, L, an as gt, aS as vt, x as Yt, r as Lt, aT as Ft, ak as wt, aI as yt, az as Dt, aJ as Ot, aU as st, ae as ot, i as Ct, W as z, a1 as $, d as V, l as Pt, u as rt, a7 as ht, I as At, a as Rt } from "./proj-DsetBcW7.js";
4
+ class mt extends It {
5
5
  /**
6
6
  * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
7
7
  * @param {import("./TileState.js").default} state State.
@@ -14,13 +14,13 @@ class gt extends pt {
14
14
  * @protected
15
15
  */
16
16
  changed() {
17
- this.dispatchEvent(lt.CHANGE);
17
+ this.dispatchEvent(ft.CHANGE);
18
18
  }
19
19
  /**
20
20
  * Called by the tile cache when the tile is removed from the cache due to expiry
21
21
  */
22
22
  release() {
23
- this.setState(g.EMPTY);
23
+ this.setState(_.EMPTY);
24
24
  }
25
25
  /**
26
26
  * @return {string} Key.
@@ -51,8 +51,8 @@ class gt extends pt {
51
51
  * @api
52
52
  */
53
53
  setState(t) {
54
- if (this.state !== g.EMPTY) {
55
- if (this.state !== g.ERROR && this.state > t)
54
+ if (this.state !== _.EMPTY) {
55
+ if (this.state !== _.ERROR && this.state > t)
56
56
  throw new Error("Tile load sequence violation");
57
57
  this.state = t, this.changed();
58
58
  }
@@ -65,7 +65,7 @@ class gt extends pt {
65
65
  * @api
66
66
  */
67
67
  load() {
68
- It();
68
+ Xt();
69
69
  }
70
70
  /**
71
71
  * Get the alpha value for rendering.
@@ -82,7 +82,7 @@ class gt extends pt {
82
82
  else if (s === -1)
83
83
  return 1;
84
84
  const n = e - s + 1e3 / 60;
85
- return n >= this.transition_ ? 1 : xt(n / this.transition_);
85
+ return n >= this.transition_ ? 1 : Tt(n / this.transition_);
86
86
  }
87
87
  /**
88
88
  * Determine if a tile is in an alpha transition. A tile is considered in
@@ -108,7 +108,7 @@ class gt extends pt {
108
108
  this.release(), super.disposeInternal();
109
109
  }
110
110
  }
111
- class Qt extends gt {
111
+ class zt extends mt {
112
112
  /**
113
113
  * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
114
114
  * @param {import("./TileState.js").default} state State.
@@ -118,11 +118,11 @@ class Qt extends gt {
118
118
  * @param {import("./Tile.js").Options} [options] Tile options.
119
119
  */
120
120
  constructor(t, e, s, n, i, c) {
121
- super(t, e, c), this.crossOrigin_ = n, this.src_ = s, this.key = s, this.image_ = new Image(), n !== null && (this.image_.crossOrigin = n), this.unlisten_ = null, this.tileLoadFunction_ = i;
121
+ super(t, e, c), this.crossOrigin_ = n, this.src_ = s, this.key = s, this.image_, nt ? this.image_ = new OffscreenCanvas(1, 1) : (this.image_ = new Image(), n !== null && (this.image_.crossOrigin = n)), this.unlisten_ = null, this.tileLoadFunction_ = i;
122
122
  }
123
123
  /**
124
- * Get the HTML image element for this tile (may be a Canvas, Image, or Video).
125
- * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
124
+ * Get the HTML image element for this tile (may be a Canvas, OffscreenCanvas, Image, or Video).
125
+ * @return {HTMLCanvasElement|OffscreenCanvas|HTMLImageElement|HTMLVideoElement} Image.
126
126
  * @api
127
127
  */
128
128
  getImage() {
@@ -130,10 +130,17 @@ class Qt extends gt {
130
130
  }
131
131
  /**
132
132
  * Sets an HTML image element for this tile (may be a Canvas or preloaded Image).
133
- * @param {HTMLCanvasElement|HTMLImageElement} element Element.
133
+ * @param {HTMLCanvasElement|OffscreenCanvas|HTMLImageElement} element Element.
134
134
  */
135
135
  setImage(t) {
136
- this.image_ = t, this.state = g.LOADED, this.unlistenImage_(), this.changed();
136
+ this.image_ = t, this.state = _.LOADED, this.unlistenImage_(), this.changed();
137
+ }
138
+ /**
139
+ * Get the cross origin of the ImageTile.
140
+ * @return {string} Cross origin.
141
+ */
142
+ getCrossOrigin() {
143
+ return this.crossOrigin_;
137
144
  }
138
145
  /**
139
146
  * Tracks loading or read errors.
@@ -141,7 +148,7 @@ class Qt extends gt {
141
148
  * @private
142
149
  */
143
150
  handleImageError_() {
144
- this.state = g.ERROR, this.unlistenImage_(), this.image_ = At(), this.changed();
151
+ this.state = _.ERROR, this.unlistenImage_(), this.image_ = kt(), this.changed();
145
152
  }
146
153
  /**
147
154
  * Tracks successful image load.
@@ -149,11 +156,16 @@ class Qt extends gt {
149
156
  * @private
150
157
  */
151
158
  handleImageLoad_() {
152
- const t = (
153
- /** @type {HTMLImageElement} */
154
- this.image_
155
- );
156
- t.naturalWidth && t.naturalHeight ? this.state = g.LOADED : this.state = g.EMPTY, this.unlistenImage_(), this.changed();
159
+ if (nt)
160
+ this.state = _.LOADED;
161
+ else {
162
+ const t = (
163
+ /** @type {HTMLImageElement} */
164
+ this.image_
165
+ );
166
+ t.naturalWidth && t.naturalHeight ? this.state = _.LOADED : this.state = _.EMPTY;
167
+ }
168
+ this.unlistenImage_(), this.changed();
157
169
  }
158
170
  /**
159
171
  * Load the image or retry if loading previously failed.
@@ -193,7 +205,7 @@ class Qt extends gt {
193
205
  * @override
194
206
  */
195
207
  load() {
196
- this.state == g.ERROR && (this.state = g.IDLE, this.image_ = new Image(), this.crossOrigin_ !== null && (this.image_.crossOrigin = this.crossOrigin_)), this.state == g.IDLE && (this.state = g.LOADING, this.changed(), this.tileLoadFunction_(this, this.src_), this.unlisten_ = Et(
208
+ this.state == _.ERROR && (this.state = _.IDLE, this.image_ = new Image(), this.crossOrigin_ !== null && (this.image_.crossOrigin = this.crossOrigin_)), this.state == _.IDLE && (this.state = _.LOADING, this.changed(), this.tileLoadFunction_(this, this.src_), this.unlisten_ = xt(
197
209
  this.image_,
198
210
  this.handleImageLoad_.bind(this),
199
211
  this.handleImageError_.bind(this)
@@ -214,11 +226,11 @@ class Qt extends gt {
214
226
  this.unlistenImage_(), this.image_ = null, super.disposeInternal();
215
227
  }
216
228
  }
217
- function At() {
218
- const o = N(1, 1);
219
- return o.fillStyle = "rgba(0,0,0,0)", o.fillRect(0, 0, 1, 1), o.canvas;
229
+ function kt() {
230
+ const a = H(1, 1);
231
+ return a.fillStyle = "rgba(0,0,0,0)", a.fillRect(0, 0, 1, 1), a.canvas;
220
232
  }
221
- class Rt {
233
+ class Bt {
222
234
  /**
223
235
  * @param {number} minX Minimum X.
224
236
  * @param {number} maxX Maximum X.
@@ -289,173 +301,173 @@ class Rt {
289
301
  return this.minX <= t.maxX && this.maxX >= t.minX && this.minY <= t.maxY && this.maxY >= t.minY;
290
302
  }
291
303
  }
292
- function jt(o, t, e, s, n) {
293
- return n !== void 0 ? (n.minX = o, n.maxX = t, n.minY = e, n.maxY = s, n) : new Rt(o, t, e, s);
304
+ function $t(a, t, e, s, n) {
305
+ return n !== void 0 ? (n.minX = a, n.maxX = t, n.minY = e, n.maxY = s, n) : new Bt(a, t, e, s);
294
306
  }
295
- let $;
307
+ let J;
296
308
  const B = [];
297
- function ht(o, t, e, s, n) {
298
- o.beginPath(), o.moveTo(0, 0), o.lineTo(t, e), o.lineTo(s, n), o.closePath(), o.save(), o.clip(), o.fillRect(0, 0, Math.max(t, s) + 1, Math.max(e, n)), o.restore();
309
+ function ct(a, t, e, s, n) {
310
+ a.beginPath(), a.moveTo(0, 0), a.lineTo(t, e), a.lineTo(s, n), a.closePath(), a.save(), a.clip(), a.fillRect(0, 0, Math.max(t, s) + 1, Math.max(e, n)), a.restore();
299
311
  }
300
- function tt(o, t) {
301
- return Math.abs(o[t * 4] - 210) > 2 || Math.abs(o[t * 4 + 3] - 0.75 * 255) > 2;
312
+ function tt(a, t) {
313
+ return Math.abs(a[t * 4] - 210) > 2 || Math.abs(a[t * 4 + 3] - 0.75 * 255) > 2;
302
314
  }
303
- function kt() {
304
- if ($ === void 0) {
305
- const o = N(6, 6, B);
306
- o.globalCompositeOperation = "lighter", o.fillStyle = "rgba(210, 0, 0, 0.75)", ht(o, 4, 5, 4, 0), ht(o, 4, 5, 0, 5);
307
- const t = o.getImageData(0, 0, 3, 3).data;
308
- $ = tt(t, 0) || tt(t, 4) || tt(t, 8), et(o), B.push(o.canvas);
309
- }
310
- return $;
315
+ function Gt() {
316
+ if (J === void 0) {
317
+ const a = H(6, 6, B);
318
+ a.globalCompositeOperation = "lighter", a.fillStyle = "rgba(210, 0, 0, 0.75)", ct(a, 4, 5, 4, 0), ct(a, 4, 5, 0, 5);
319
+ const t = a.getImageData(0, 0, 3, 3).data;
320
+ J = tt(t, 0) || tt(t, 4) || tt(t, 8), et(a), B.push(a.canvas);
321
+ }
322
+ return J;
311
323
  }
312
- function ct(o, t, e, s) {
313
- const n = ft(e, t, o);
314
- let i = nt(
324
+ function ut(a, t, e, s) {
325
+ const n = dt(e, t, a);
326
+ let i = at(
315
327
  t,
316
328
  s,
317
329
  e
318
330
  );
319
331
  const c = t.getMetersPerUnit();
320
332
  c !== void 0 && (i *= c);
321
- const m = o.getMetersPerUnit();
333
+ const m = a.getMetersPerUnit();
322
334
  m !== void 0 && (i /= m);
323
- const _ = o.getExtent();
324
- if (!_ || Xt(_, n)) {
325
- const T = nt(o, i, n) / i;
335
+ const g = a.getExtent();
336
+ if (!g || Wt(g, n)) {
337
+ const T = at(a, i, n) / i;
326
338
  isFinite(T) && T > 0 && (i /= T);
327
339
  }
328
340
  return i;
329
341
  }
330
- function Bt(o, t, e, s) {
331
- const n = Wt(e);
332
- let i = ct(
333
- o,
342
+ function Nt(a, t, e, s) {
343
+ const n = Yt(e);
344
+ let i = ut(
345
+ a,
334
346
  t,
335
347
  n,
336
348
  s
337
349
  );
338
- return (!isFinite(i) || i <= 0) && Yt(e, function(c) {
339
- return i = ct(
340
- o,
350
+ return (!isFinite(i) || i <= 0) && Lt(e, function(c) {
351
+ return i = ut(
352
+ a,
341
353
  t,
342
354
  c,
343
355
  s
344
356
  ), isFinite(i) && i > 0;
345
357
  }), i;
346
358
  }
347
- function Gt(o, t, e, s, n, i, c, m, _, T, X, x, y, F) {
348
- const r = N(
349
- Math.round(e * o),
359
+ function St(a, t, e, s, n, i, c, m, g, T, X, x, F, w) {
360
+ const r = H(
361
+ Math.round(e * a),
350
362
  Math.round(e * t),
351
363
  B
352
364
  );
353
- if (x || (r.imageSmoothingEnabled = !1), _.length === 0)
365
+ if (x || (r.imageSmoothingEnabled = !1), g.length === 0)
354
366
  return r.canvas;
355
367
  r.scale(e, e);
356
- function h(a) {
357
- return Math.round(a * e) / e;
368
+ function h(o) {
369
+ return Math.round(o * e) / e;
358
370
  }
359
371
  r.globalCompositeOperation = "lighter";
360
- const E = dt();
361
- _.forEach(function(a, w, C) {
362
- Mt(E, a.extent);
372
+ const E = _t();
373
+ g.forEach(function(o, y, C) {
374
+ Mt(E, o.extent);
363
375
  });
364
376
  let l;
365
377
  const f = e / s, d = (x ? 1 : 1 + Math.pow(2, -24)) / f;
366
- (!y || _.length !== 1 || T !== 0) && (l = N(
378
+ (!F || g.length !== 1 || T !== 0) && (l = H(
367
379
  Math.round(L(E) * f),
368
- Math.round(K(E) * f),
380
+ Math.round(b(E) * f),
369
381
  B
370
- ), x || (l.imageSmoothingEnabled = !1), _.forEach(function(a, w, C) {
371
- if (a.image.width > 0 && a.image.height > 0) {
372
- if (a.clipExtent) {
382
+ ), x || (l.imageSmoothingEnabled = !1), g.forEach(function(o, y, C) {
383
+ if (o.image.width > 0 && o.image.height > 0) {
384
+ if (o.clipExtent) {
373
385
  l.save();
374
- const M = (a.clipExtent[0] - E[0]) * f, v = -(a.clipExtent[3] - E[3]) * f, D = L(a.clipExtent) * f, A = K(a.clipExtent) * f;
386
+ const W = (o.clipExtent[0] - E[0]) * f, M = -(o.clipExtent[3] - E[3]) * f, D = L(o.clipExtent) * f, A = b(o.clipExtent) * f;
375
387
  l.rect(
388
+ x ? W : Math.round(W),
376
389
  x ? M : Math.round(M),
377
- x ? v : Math.round(v),
378
- x ? D : Math.round(M + D) - Math.round(M),
379
- x ? A : Math.round(v + A) - Math.round(v)
390
+ x ? D : Math.round(W + D) - Math.round(W),
391
+ x ? A : Math.round(M + A) - Math.round(M)
380
392
  ), l.clip();
381
393
  }
382
- const p = (a.extent[0] - E[0]) * f, I = -(a.extent[3] - E[3]) * f, W = L(a.extent) * f, Y = K(a.extent) * f;
394
+ const p = (o.extent[0] - E[0]) * f, I = -(o.extent[3] - E[3]) * f, v = L(o.extent) * f, Y = b(o.extent) * f;
383
395
  l.drawImage(
384
- a.image,
396
+ o.image,
385
397
  T,
386
398
  T,
387
- a.image.width - 2 * T,
388
- a.image.height - 2 * T,
399
+ o.image.width - 2 * T,
400
+ o.image.height - 2 * T,
389
401
  x ? p : Math.round(p),
390
402
  x ? I : Math.round(I),
391
- x ? W : Math.round(p + W) - Math.round(p),
403
+ x ? v : Math.round(p + v) - Math.round(p),
392
404
  x ? Y : Math.round(I + Y) - Math.round(I)
393
- ), a.clipExtent && l.restore();
405
+ ), o.clipExtent && l.restore();
394
406
  }
395
407
  }));
396
- const u = _t(c);
397
- return m.getTriangles().forEach(function(a, w, C) {
398
- const p = a.source, I = a.target;
399
- let W = p[0][0], Y = p[0][1], M = p[1][0], v = p[1][1], D = p[2][0], A = p[2][1];
400
- const G = h((I[0][0] - u[0]) / i), Z = h(
408
+ const u = gt(c);
409
+ return m.getTriangles().forEach(function(o, y, C) {
410
+ const p = o.source, I = o.target;
411
+ let v = p[0][0], Y = p[0][1], W = p[1][0], M = p[1][1], D = p[2][0], A = p[2][1];
412
+ const G = h((I[0][0] - u[0]) / i), N = h(
401
413
  -(I[0][1] - u[1]) / i
402
414
  ), R = h((I[1][0] - u[0]) / i), k = h(
403
415
  -(I[1][1] - u[1]) / i
404
416
  ), U = h((I[2][0] - u[0]) / i), Q = h(
405
417
  -(I[2][1] - u[1]) / i
406
- ), j = W, q = Y;
407
- W = 0, Y = 0, M -= j, v -= q, D -= j, A -= q;
408
- const mt = [
409
- [M, v, 0, 0, R - G],
418
+ ), j = v, q = Y;
419
+ v = 0, Y = 0, W -= j, M -= q, D -= j, A -= q;
420
+ const Et = [
421
+ [W, M, 0, 0, R - G],
410
422
  [D, A, 0, 0, U - G],
411
- [0, 0, M, v, k - Z],
412
- [0, 0, D, A, Q - Z]
413
- ], H = vt(mt);
414
- if (!H)
423
+ [0, 0, W, M, k - N],
424
+ [0, 0, D, A, Q - N]
425
+ ], S = vt(Et);
426
+ if (!S)
415
427
  return;
416
- if (r.save(), r.beginPath(), kt() || !x) {
428
+ if (r.save(), r.beginPath(), Gt() || !x) {
417
429
  r.moveTo(R, k);
418
- const P = 4, b = G - R, it = Z - k;
419
- for (let O = 0; O < P; O++)
430
+ const O = 4, K = G - R, it = N - k;
431
+ for (let P = 0; P < O; P++)
420
432
  r.lineTo(
421
- R + h((O + 1) * b / P),
422
- k + h(O * it / (P - 1))
423
- ), O != P - 1 && r.lineTo(
424
- R + h((O + 1) * b / P),
425
- k + h((O + 1) * it / (P - 1))
433
+ R + h((P + 1) * K / O),
434
+ k + h(P * it / (O - 1))
435
+ ), P != O - 1 && r.lineTo(
436
+ R + h((P + 1) * K / O),
437
+ k + h((P + 1) * it / (O - 1))
426
438
  );
427
439
  r.lineTo(U, Q);
428
440
  } else
429
- r.moveTo(R, k), r.lineTo(G, Z), r.lineTo(U, Q);
441
+ r.moveTo(R, k), r.lineTo(G, N), r.lineTo(U, Q);
430
442
  r.clip(), r.transform(
431
- H[0],
432
- H[2],
433
- H[1],
434
- H[3],
443
+ S[0],
444
+ S[2],
445
+ S[1],
446
+ S[3],
435
447
  G,
436
- Z
448
+ N
437
449
  ), r.translate(
438
450
  E[0] - j,
439
451
  E[3] - q
440
452
  );
441
- let S;
453
+ let Z;
442
454
  if (l)
443
- S = l.canvas, r.scale(d, -d);
455
+ Z = l.canvas, r.scale(d, -d);
444
456
  else {
445
- const P = _[0], b = P.extent;
446
- S = P.image, r.scale(
447
- L(b) / S.width,
448
- -K(b) / S.height
457
+ const O = g[0], K = O.extent;
458
+ Z = O.image, r.scale(
459
+ L(K) / Z.width,
460
+ -b(K) / Z.height
449
461
  );
450
462
  }
451
- r.drawImage(S, 0, 0), r.restore();
452
- }), l && (et(l), B.push(l.canvas)), X && (r.save(), r.globalCompositeOperation = "source-over", r.strokeStyle = "black", r.lineWidth = 1, m.getTriangles().forEach(function(a, w, C) {
453
- const p = a.target, I = (p[0][0] - u[0]) / i, W = -(p[0][1] - u[1]) / i, Y = (p[1][0] - u[0]) / i, M = -(p[1][1] - u[1]) / i, v = (p[2][0] - u[0]) / i, D = -(p[2][1] - u[1]) / i;
454
- r.beginPath(), r.moveTo(Y, M), r.lineTo(I, W), r.lineTo(v, D), r.closePath(), r.stroke();
463
+ r.drawImage(Z, 0, 0), r.restore();
464
+ }), l && (et(l), B.push(l.canvas)), X && (r.save(), r.globalCompositeOperation = "source-over", r.strokeStyle = "black", r.lineWidth = 1, m.getTriangles().forEach(function(o, y, C) {
465
+ const p = o.target, I = (p[0][0] - u[0]) / i, v = -(p[0][1] - u[1]) / i, Y = (p[1][0] - u[0]) / i, W = -(p[1][1] - u[1]) / i, M = (p[2][0] - u[0]) / i, D = -(p[2][1] - u[1]) / i;
466
+ r.beginPath(), r.moveTo(Y, W), r.lineTo(I, v), r.lineTo(M, D), r.closePath(), r.stroke();
455
467
  }), r.restore()), r.canvas;
456
468
  }
457
- const Zt = 10, ut = 0.25;
458
- class Ht {
469
+ const Zt = 10, lt = 0.25;
470
+ class Kt {
459
471
  /**
460
472
  * @param {import("../proj/Projection.js").default} sourceProj Source projection.
461
473
  * @param {import("../proj/Projection.js").default} targetProj Target projection.
@@ -467,18 +479,18 @@ class Ht {
467
479
  */
468
480
  constructor(t, e, s, n, i, c, m) {
469
481
  this.sourceProj_ = t, this.targetProj_ = e;
470
- let _ = {};
471
- const T = m ? Lt(
472
- (d) => Tt(
482
+ let g = {};
483
+ const T = m ? Ft(
484
+ (d) => pt(
473
485
  m,
474
- ft(d, this.targetProj_, this.sourceProj_)
486
+ dt(d, this.targetProj_, this.sourceProj_)
475
487
  )
476
- ) : yt(this.targetProj_, this.sourceProj_);
488
+ ) : wt(this.targetProj_, this.sourceProj_);
477
489
  this.transformInv_ = function(d) {
478
490
  const u = d[0] + "/" + d[1];
479
- return _[u] || (_[u] = T(d)), _[u];
491
+ return g[u] || (g[u] = T(d)), g[u];
480
492
  }, this.maxSourceExtent_ = n, this.errorThresholdSquared_ = i * i, this.triangles_ = [], this.wrapsXInSource_ = !1, this.canWrapXInSource_ = this.sourceProj_.canWrapX() && !!n && !!this.sourceProj_.getExtent() && L(n) >= L(this.sourceProj_.getExtent()), this.sourceWorldWidth_ = this.sourceProj_.getExtent() ? L(this.sourceProj_.getExtent()) : null, this.targetWorldWidth_ = this.targetProj_.getExtent() ? L(this.targetProj_.getExtent()) : null;
481
- const X = _t(s), x = Ft(s), y = wt(s), F = Dt(s), r = this.transformInv_(X), h = this.transformInv_(x), E = this.transformInv_(y), l = this.transformInv_(F), f = Zt + (c ? Math.max(
493
+ const X = gt(s), x = yt(s), F = Dt(s), w = Ot(s), r = this.transformInv_(X), h = this.transformInv_(x), E = this.transformInv_(F), l = this.transformInv_(w), f = Zt + (c ? Math.max(
482
494
  0,
483
495
  Math.ceil(
484
496
  Math.log2(
@@ -489,8 +501,8 @@ class Ht {
489
501
  if (this.addQuad_(
490
502
  X,
491
503
  x,
492
- y,
493
504
  F,
505
+ w,
494
506
  r,
495
507
  h,
496
508
  E,
@@ -498,7 +510,7 @@ class Ht {
498
510
  f
499
511
  ), this.wrapsXInSource_) {
500
512
  let d = 1 / 0;
501
- this.triangles_.forEach(function(u, a, w) {
513
+ this.triangles_.forEach(function(u, o, y) {
502
514
  d = Math.min(
503
515
  d,
504
516
  u.source[0][0],
@@ -511,26 +523,26 @@ class Ht {
511
523
  u.source[1][0],
512
524
  u.source[2][0]
513
525
  ) - d > this.sourceWorldWidth_ / 2) {
514
- const a = [
526
+ const o = [
515
527
  [u.source[0][0], u.source[0][1]],
516
528
  [u.source[1][0], u.source[1][1]],
517
529
  [u.source[2][0], u.source[2][1]]
518
530
  ];
519
- a[0][0] - d > this.sourceWorldWidth_ / 2 && (a[0][0] -= this.sourceWorldWidth_), a[1][0] - d > this.sourceWorldWidth_ / 2 && (a[1][0] -= this.sourceWorldWidth_), a[2][0] - d > this.sourceWorldWidth_ / 2 && (a[2][0] -= this.sourceWorldWidth_);
520
- const w = Math.min(
521
- a[0][0],
522
- a[1][0],
523
- a[2][0]
531
+ o[0][0] - d > this.sourceWorldWidth_ / 2 && (o[0][0] -= this.sourceWorldWidth_), o[1][0] - d > this.sourceWorldWidth_ / 2 && (o[1][0] -= this.sourceWorldWidth_), o[2][0] - d > this.sourceWorldWidth_ / 2 && (o[2][0] -= this.sourceWorldWidth_);
532
+ const y = Math.min(
533
+ o[0][0],
534
+ o[1][0],
535
+ o[2][0]
524
536
  );
525
537
  Math.max(
526
- a[0][0],
527
- a[1][0],
528
- a[2][0]
529
- ) - w < this.sourceWorldWidth_ / 2 && (u.source = a);
538
+ o[0][0],
539
+ o[1][0],
540
+ o[2][0]
541
+ ) - y < this.sourceWorldWidth_ / 2 && (u.source = o);
530
542
  }
531
543
  });
532
544
  }
533
- _ = {};
545
+ g = {};
534
546
  }
535
547
  /**
536
548
  * Adds triangle to the triangulation.
@@ -564,33 +576,33 @@ class Ht {
564
576
  * @param {number} maxSubdivision Maximal allowed subdivision of the quad.
565
577
  * @private
566
578
  */
567
- addQuad_(t, e, s, n, i, c, m, _, T) {
568
- const X = ot([i, c, m, _]), x = this.sourceWorldWidth_ ? L(X) / this.sourceWorldWidth_ : null, y = (
579
+ addQuad_(t, e, s, n, i, c, m, g, T) {
580
+ const X = ot([i, c, m, g]), x = this.sourceWorldWidth_ ? L(X) / this.sourceWorldWidth_ : null, F = (
569
581
  /** @type {number} */
570
582
  this.sourceWorldWidth_
571
- ), F = this.sourceProj_.canWrapX() && x > 0.5 && x < 1;
583
+ ), w = this.sourceProj_.canWrapX() && x > 0.5 && x < 1;
572
584
  let r = !1;
573
585
  if (T > 0) {
574
586
  if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {
575
587
  const E = ot([t, e, s, n]);
576
- r = L(E) / this.targetWorldWidth_ > ut || r;
588
+ r = L(E) / this.targetWorldWidth_ > lt || r;
577
589
  }
578
- !F && this.sourceProj_.isGlobal() && x && (r = x > ut || r);
590
+ !w && this.sourceProj_.isGlobal() && x && (r = x > lt || r);
579
591
  }
580
- if (!r && this.maxSourceExtent_ && isFinite(X[0]) && isFinite(X[1]) && isFinite(X[2]) && isFinite(X[3]) && !Pt(X, this.maxSourceExtent_))
592
+ if (!r && this.maxSourceExtent_ && isFinite(X[0]) && isFinite(X[1]) && isFinite(X[2]) && isFinite(X[3]) && !Ct(X, this.maxSourceExtent_))
581
593
  return;
582
594
  let h = 0;
583
- if (!r && (!isFinite(i[0]) || !isFinite(i[1]) || !isFinite(c[0]) || !isFinite(c[1]) || !isFinite(m[0]) || !isFinite(m[1]) || !isFinite(_[0]) || !isFinite(_[1]))) {
595
+ if (!r && (!isFinite(i[0]) || !isFinite(i[1]) || !isFinite(c[0]) || !isFinite(c[1]) || !isFinite(m[0]) || !isFinite(m[1]) || !isFinite(g[0]) || !isFinite(g[1]))) {
584
596
  if (T > 0)
585
597
  r = !0;
586
- else if (h = (!isFinite(i[0]) || !isFinite(i[1]) ? 8 : 0) + (!isFinite(c[0]) || !isFinite(c[1]) ? 4 : 0) + (!isFinite(m[0]) || !isFinite(m[1]) ? 2 : 0) + (!isFinite(_[0]) || !isFinite(_[1]) ? 1 : 0), h != 1 && h != 2 && h != 4 && h != 8)
598
+ else if (h = (!isFinite(i[0]) || !isFinite(i[1]) ? 8 : 0) + (!isFinite(c[0]) || !isFinite(c[1]) ? 4 : 0) + (!isFinite(m[0]) || !isFinite(m[1]) ? 2 : 0) + (!isFinite(g[0]) || !isFinite(g[1]) ? 1 : 0), h != 1 && h != 2 && h != 4 && h != 8)
587
599
  return;
588
600
  }
589
601
  if (T > 0) {
590
602
  if (!r) {
591
603
  const E = [(t[0] + s[0]) / 2, (t[1] + s[1]) / 2], l = this.transformInv_(E);
592
604
  let f;
593
- F ? f = (z(i[0], y) + z(m[0], y)) / 2 - z(l[0], y) : f = (i[0] + m[0]) / 2 - l[0];
605
+ w ? f = (z(i[0], F) + z(m[0], F)) / 2 - z(l[0], F) : f = (i[0] + m[0]) / 2 - l[0];
594
606
  const d = (i[1] + m[1]) / 2 - l[1];
595
607
  r = f * f + d * d > this.errorThresholdSquared_;
596
608
  }
@@ -615,7 +627,7 @@ class Ht {
615
627
  d,
616
628
  l,
617
629
  m,
618
- _,
630
+ g,
619
631
  T - 1
620
632
  );
621
633
  } else {
@@ -628,7 +640,7 @@ class Ht {
628
640
  i,
629
641
  l,
630
642
  d,
631
- _,
643
+ g,
632
644
  T - 1
633
645
  ), this.addQuad_(
634
646
  E,
@@ -645,12 +657,12 @@ class Ht {
645
657
  return;
646
658
  }
647
659
  }
648
- if (F) {
660
+ if (w) {
649
661
  if (!this.canWrapXInSource_)
650
662
  return;
651
663
  this.wrapsXInSource_ = !0;
652
664
  }
653
- (h & 11) == 0 && this.addTriangle_(t, s, n, i, m, _), (h & 14) == 0 && this.addTriangle_(t, s, e, i, m, c), h && ((h & 13) == 0 && this.addTriangle_(e, n, t, c, _, i), (h & 7) == 0 && this.addTriangle_(e, n, s, c, _, m));
665
+ (h & 11) == 0 && this.addTriangle_(t, s, n, i, m, g), (h & 14) == 0 && this.addTriangle_(t, s, e, i, m, c), h && ((h & 13) == 0 && this.addTriangle_(e, n, t, c, g, i), (h & 7) == 0 && this.addTriangle_(e, n, s, c, g, m));
654
666
  }
655
667
  /**
656
668
  * Calculates extent of the `source` coordinates from all the triangles.
@@ -658,10 +670,10 @@ class Ht {
658
670
  * @return {import("../extent.js").Extent} Calculated extent.
659
671
  */
660
672
  calculateSourceExtent() {
661
- const t = dt();
673
+ const t = _t();
662
674
  return this.triangles_.forEach(function(e, s, n) {
663
675
  const i = e.source;
664
- J(t, i[0]), J(t, i[1]), J(t, i[2]);
676
+ $(t, i[0]), $(t, i[1]), $(t, i[2]);
665
677
  }), t;
666
678
  }
667
679
  /**
@@ -671,8 +683,8 @@ class Ht {
671
683
  return this.triangles_;
672
684
  }
673
685
  }
674
- const St = 0.5;
675
- class qt extends gt {
686
+ const bt = 0.5;
687
+ class Vt extends mt {
676
688
  /**
677
689
  * @param {import("../proj/Projection.js").default} sourceProj Source projection.
678
690
  * @param {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid.
@@ -688,33 +700,33 @@ class qt extends gt {
688
700
  * @param {boolean} [renderEdges] Render reprojection edges.
689
701
  * @param {import("../Tile.js").Options} [options] Tile options.
690
702
  */
691
- constructor(t, e, s, n, i, c, m, _, T, X, x, y) {
692
- super(i, g.IDLE, y), this.renderEdges_ = x !== void 0 ? x : !1, this.pixelRatio_ = m, this.gutter_ = _, this.canvas_ = null, this.sourceTileGrid_ = e, this.targetTileGrid_ = n, this.wrappedTileCoord_ = c || i, this.sourceTiles_ = [], this.sourcesListenerKeys_ = null, this.sourceZ_ = 0, this.clipExtent_ = t.canWrapX() ? t.getExtent() : void 0;
693
- const F = n.getTileCoordExtent(
703
+ constructor(t, e, s, n, i, c, m, g, T, X, x, F) {
704
+ super(i, _.IDLE, F), this.renderEdges_ = x !== void 0 ? x : !1, this.pixelRatio_ = m, this.gutter_ = g, this.canvas_ = null, this.sourceTileGrid_ = e, this.targetTileGrid_ = n, this.wrappedTileCoord_ = c || i, this.sourceTiles_ = [], this.sourcesListenerKeys_ = null, this.sourceZ_ = 0, this.clipExtent_ = t.canWrapX() ? t.getExtent() : void 0;
705
+ const w = n.getTileCoordExtent(
694
706
  this.wrappedTileCoord_
695
707
  ), r = this.targetTileGrid_.getExtent();
696
708
  let h = this.sourceTileGrid_.getExtent();
697
- const E = r ? V(F, r) : F;
709
+ const E = r ? V(w, r) : w;
698
710
  if (st(E) === 0) {
699
- this.state = g.EMPTY;
711
+ this.state = _.EMPTY;
700
712
  return;
701
713
  }
702
714
  const l = t.getExtent();
703
715
  l && (h ? h = V(h, l) : h = l);
704
716
  const f = n.getResolution(
705
717
  this.wrappedTileCoord_[0]
706
- ), d = Bt(
718
+ ), d = Nt(
707
719
  t,
708
720
  s,
709
721
  E,
710
722
  f
711
723
  );
712
724
  if (!isFinite(d) || d <= 0) {
713
- this.state = g.EMPTY;
725
+ this.state = _.EMPTY;
714
726
  return;
715
727
  }
716
- const u = X !== void 0 ? X : St;
717
- if (this.triangulation_ = new Ht(
728
+ const u = X !== void 0 ? X : bt;
729
+ if (this.triangulation_ = new Kt(
718
730
  t,
719
731
  s,
720
732
  E,
@@ -722,49 +734,49 @@ class qt extends gt {
722
734
  d * u,
723
735
  f
724
736
  ), this.triangulation_.getTriangles().length === 0) {
725
- this.state = g.EMPTY;
737
+ this.state = _.EMPTY;
726
738
  return;
727
739
  }
728
740
  this.sourceZ_ = e.getZForResolution(d);
729
- let a = this.triangulation_.calculateSourceExtent();
730
- if (h && (t.canWrapX() ? (a[1] = rt(
731
- a[1],
741
+ let o = this.triangulation_.calculateSourceExtent();
742
+ if (h && (t.canWrapX() ? (o[1] = ht(
743
+ o[1],
732
744
  h[1],
733
745
  h[3]
734
- ), a[3] = rt(
735
- a[3],
746
+ ), o[3] = ht(
747
+ o[3],
736
748
  h[1],
737
749
  h[3]
738
- )) : a = V(a, h)), !st(a))
739
- this.state = g.EMPTY;
750
+ )) : o = V(o, h)), !st(o))
751
+ this.state = _.EMPTY;
740
752
  else {
741
- let w = 0, C = 0;
742
- t.canWrapX() && (w = L(l), C = Math.floor(
743
- (a[0] - l[0]) / w
744
- )), Ot(
745
- a.slice(),
753
+ let y = 0, C = 0;
754
+ t.canWrapX() && (y = L(l), C = Math.floor(
755
+ (o[0] - l[0]) / y
756
+ )), At(
757
+ o.slice(),
746
758
  t,
747
759
  !0
748
760
  ).forEach((I) => {
749
- const W = e.getTileRangeForExtentAndZ(
761
+ const v = e.getTileRangeForExtentAndZ(
750
762
  I,
751
763
  this.sourceZ_
752
764
  );
753
- for (let Y = W.minX; Y <= W.maxX; Y++)
754
- for (let M = W.minY; M <= W.maxY; M++) {
755
- const v = T(this.sourceZ_, Y, M, m);
756
- if (v) {
757
- const D = C * w;
758
- this.sourceTiles_.push({ tile: v, offset: D });
765
+ for (let Y = v.minX; Y <= v.maxX; Y++)
766
+ for (let W = v.minY; W <= v.maxY; W++) {
767
+ const M = T(this.sourceZ_, Y, W, m);
768
+ if (M) {
769
+ const D = C * y;
770
+ this.sourceTiles_.push({ tile: M, offset: D });
759
771
  }
760
772
  }
761
773
  ++C;
762
- }), this.sourceTiles_.length === 0 && (this.state = g.EMPTY);
774
+ }), this.sourceTiles_.length === 0 && (this.state = _.EMPTY);
763
775
  }
764
776
  }
765
777
  /**
766
778
  * Get the HTML Canvas element for this tile.
767
- * @return {HTMLCanvasElement} Canvas.
779
+ * @return {HTMLCanvasElement|OffscreenCanvas} Canvas.
768
780
  */
769
781
  getImage() {
770
782
  return this.canvas_;
@@ -776,7 +788,7 @@ class qt extends gt {
776
788
  const t = [];
777
789
  if (this.sourceTiles_.forEach((e) => {
778
790
  const s = e.tile;
779
- if (s && s.getState() == g.LOADED) {
791
+ if (s && s.getState() == _.LOADED) {
780
792
  const n = this.sourceTileGrid_.getTileCoordExtent(s.tileCoord);
781
793
  n[0] += e.offset, n[2] += e.offset;
782
794
  const i = this.clipExtent_?.slice();
@@ -787,27 +799,27 @@ class qt extends gt {
787
799
  });
788
800
  }
789
801
  }), this.sourceTiles_.length = 0, t.length === 0)
790
- this.state = g.ERROR;
802
+ this.state = _.ERROR;
791
803
  else {
792
804
  const e = this.wrappedTileCoord_[0], s = this.targetTileGrid_.getTileSize(e), n = typeof s == "number" ? s : s[0], i = typeof s == "number" ? s : s[1], c = this.targetTileGrid_.getResolution(e), m = this.sourceTileGrid_.getResolution(
793
805
  this.sourceZ_
794
- ), _ = this.targetTileGrid_.getTileCoordExtent(
806
+ ), g = this.targetTileGrid_.getTileCoordExtent(
795
807
  this.wrappedTileCoord_
796
808
  );
797
- this.canvas_ = Gt(
809
+ this.canvas_ = St(
798
810
  n,
799
811
  i,
800
812
  this.pixelRatio_,
801
813
  m,
802
814
  this.sourceTileGrid_.getExtent(),
803
815
  c,
804
- _,
816
+ g,
805
817
  this.triangulation_,
806
818
  t,
807
819
  this.gutter_,
808
820
  this.renderEdges_,
809
821
  this.interpolate
810
- ), this.state = g.LOADED;
822
+ ), this.state = _.LOADED;
811
823
  }
812
824
  this.changed();
813
825
  }
@@ -816,21 +828,21 @@ class qt extends gt {
816
828
  * @override
817
829
  */
818
830
  load() {
819
- if (this.state == g.IDLE) {
820
- this.state = g.LOADING, this.changed();
831
+ if (this.state == _.IDLE) {
832
+ this.state = _.LOADING, this.changed();
821
833
  let t = 0;
822
834
  this.sourcesListenerKeys_ = [], this.sourceTiles_.forEach(({ tile: e }) => {
823
835
  const s = e.getState();
824
- if (s == g.IDLE || s == g.LOADING) {
836
+ if (s == _.IDLE || s == _.LOADING) {
825
837
  t++;
826
- const n = Ct(e, lt.CHANGE, (i) => {
838
+ const n = Pt(e, ft.CHANGE, (i) => {
827
839
  const c = e.getState();
828
- (c == g.LOADED || c == g.ERROR || c == g.EMPTY) && (at(n), t--, t === 0 && (this.unlistenSources_(), this.reproject_()));
840
+ (c == _.LOADED || c == _.ERROR || c == _.EMPTY) && (rt(n), t--, t === 0 && (this.unlistenSources_(), this.reproject_()));
829
841
  });
830
842
  this.sourcesListenerKeys_.push(n);
831
843
  }
832
844
  }), t === 0 ? setTimeout(this.reproject_.bind(this), 0) : this.sourceTiles_.forEach(function({ tile: e }, s, n) {
833
- e.getState() == g.IDLE && e.load();
845
+ e.getState() == _.IDLE && e.load();
834
846
  });
835
847
  }
836
848
  }
@@ -838,47 +850,53 @@ class qt extends gt {
838
850
  * @private
839
851
  */
840
852
  unlistenSources_() {
841
- this.sourcesListenerKeys_.forEach(at), this.sourcesListenerKeys_ = null;
853
+ this.sourcesListenerKeys_.forEach(rt), this.sourcesListenerKeys_ = null;
842
854
  }
843
855
  /**
844
856
  * Remove from the cache due to expiry
845
857
  * @override
846
858
  */
847
859
  release() {
848
- this.canvas_ && (et(this.canvas_.getContext("2d")), B.push(this.canvas_), this.canvas_ = null), super.release();
860
+ this.canvas_ && (et(
861
+ /** @type {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} */
862
+ this.canvas_.getContext("2d")
863
+ ), B.push(this.canvas_), this.canvas_ = null), super.release();
849
864
  }
850
865
  }
851
- function zt(o, t, e, s) {
852
- return s !== void 0 ? (s[0] = o, s[1] = t, s[2] = e, s) : [o, t, e];
866
+ function Jt(a, t, e, s) {
867
+ return s !== void 0 ? (s[0] = a, s[1] = t, s[2] = e, s) : [a, t, e];
868
+ }
869
+ function Ht(a, t, e) {
870
+ return a + "/" + t + "/" + e;
853
871
  }
854
- function Jt(o, t, e) {
855
- return o + "/" + t + "/" + e;
872
+ function ts(a, t, e, s, n) {
873
+ return `${Rt(a)},${t},${Ht(e, s, n)}`;
856
874
  }
857
- function Vt(o) {
858
- return bt(o[0], o[1], o[2]);
875
+ function ss(a) {
876
+ return Ut(a[0], a[1], a[2]);
859
877
  }
860
- function bt(o, t, e) {
861
- return (t << o) + e;
878
+ function Ut(a, t, e) {
879
+ return (t << a) + e;
862
880
  }
863
- function $t(o, t) {
864
- const e = o[0], s = o[1], n = o[2];
881
+ function es(a, t) {
882
+ const e = a[0], s = a[1], n = a[2];
865
883
  if (t.getMinZoom() > e || e > t.getMaxZoom())
866
884
  return !1;
867
885
  const i = t.getFullTileRange(e);
868
886
  return i ? i.containsXY(s, n) : !0;
869
887
  }
870
888
  export {
871
- St as E,
872
- Qt as I,
873
- qt as R,
874
- gt as T,
875
- Ht as a,
876
- Rt as b,
877
- ct as c,
878
- zt as d,
879
- jt as e,
880
- Jt as g,
881
- Vt as h,
882
- Gt as r,
883
- $t as w
889
+ bt as E,
890
+ zt as I,
891
+ Vt as R,
892
+ mt as T,
893
+ Kt as a,
894
+ Bt as b,
895
+ ut as c,
896
+ Jt as d,
897
+ $t as e,
898
+ ts as g,
899
+ ss as h,
900
+ St as r,
901
+ es as w
884
902
  };