aviation-chart 0.1.22 → 0.1.24

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.
package/dist/index.js CHANGED
@@ -142,20 +142,20 @@ Ot(["exports"], function(o) {
142
142
  if (!t)
143
143
  return {};
144
144
  const a = i / (e.width - 1);
145
- let l, s, c, m, f, h;
145
+ let l, s, c, m, h, f;
146
146
  const u = {}, _ = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
147
- function M(P, I, R) {
148
- P[0] === 0 ? R(a * (h - 1), a * (f - g(c, I, l))) : P[0] === 2 ? R(a * h, a * (f - g(m, I, s))) : P[1] === 0 ? R(a * (h - g(s, I, l)), a * (f - 1)) : R(a * (h - g(m, I, c)), a * f);
147
+ function M(P, L, R) {
148
+ P[0] === 0 ? R(a * (f - 1), a * (h - g(c, L, l))) : P[0] === 2 ? R(a * f, a * (h - g(m, L, s))) : P[1] === 0 ? R(a * (f - g(s, L, l)), a * (h - 1)) : R(a * (f - g(m, L, c)), a * h);
149
149
  }
150
- for (f = 1 - n; f < e.height + n; f++) {
151
- s = e.get(0, f - 1), m = e.get(0, f);
152
- let P = Math.min(s, m), I = Math.max(s, m);
153
- for (h = 1 - n; h < e.width + n; h++) {
154
- l = s, c = m, s = e.get(h, f - 1), m = e.get(h, f);
155
- const R = P, V = I;
156
- if (P = Math.min(s, m), I = Math.max(s, m), isNaN(l) || isNaN(s) || isNaN(m) || isNaN(c))
150
+ for (h = 1 - n; h < e.height + n; h++) {
151
+ s = e.get(0, h - 1), m = e.get(0, h);
152
+ let P = Math.min(s, m), L = Math.max(s, m);
153
+ for (f = 1 - n; f < e.width + n; f++) {
154
+ l = s, c = m, s = e.get(f, h - 1), m = e.get(f, h);
155
+ const R = P, V = L;
156
+ if (P = Math.min(s, m), L = Math.max(s, m), isNaN(l) || isNaN(s) || isNaN(m) || isNaN(c))
157
157
  continue;
158
- const dt = Math.min(R, P), pt = Math.max(V, I), X = Math.ceil(dt / t) * t, ot = Math.floor(pt / t) * t;
158
+ const dt = Math.min(R, P), pt = Math.max(V, L), X = Math.ceil(dt / t) * t, ot = Math.floor(pt / t) * t;
159
159
  for (let C = X; C <= ot; C += t) {
160
160
  const kt = l > C, q = s > C, nt = c > C, _t = m > C;
161
161
  for (const bt of d[(kt ? 8 : 0) | (q ? 4 : 0) | (_t ? 2 : 0) | (nt ? 1 : 0)]) {
@@ -163,21 +163,21 @@ Ot(["exports"], function(o) {
163
163
  H || _.set(C, H = /* @__PURE__ */ new Map());
164
164
  let lt = F.get(C);
165
165
  lt || F.set(C, lt = /* @__PURE__ */ new Map());
166
- const At = bt[0], zt = bt[1], yt = y(e.width, h, f, At), st = y(e.width, h, f, zt);
167
- let G, Tt;
168
- if (G = lt.get(yt))
166
+ const At = bt[0], zt = bt[1], yt = y(e.width, f, h, At), st = y(e.width, f, h, zt);
167
+ let I, Tt;
168
+ if (I = lt.get(yt))
169
169
  if (lt.delete(yt), Tt = H.get(st))
170
- if (H.delete(st), G === Tt) {
171
- if (M(zt, C, G.append), !G.isEmpty()) {
170
+ if (H.delete(st), I === Tt) {
171
+ if (M(zt, C, I.append), !I.isEmpty()) {
172
172
  let rt = u[C];
173
- rt || (u[C] = rt = []), rt.push(G.lineString());
173
+ rt || (u[C] = rt = []), rt.push(I.lineString());
174
174
  }
175
175
  } else
176
- G.appendFragment(Tt), lt.set(G.end = Tt.end, G);
176
+ I.appendFragment(Tt), lt.set(I.end = Tt.end, I);
177
177
  else
178
- M(zt, C, G.append), lt.set(G.end = st, G);
179
- else if (G = H.get(st))
180
- H.delete(st), M(At, C, G.prepend), H.set(G.start = yt, G);
178
+ M(zt, C, I.append), lt.set(I.end = st, I);
179
+ else if (I = H.get(st))
180
+ H.delete(st), M(At, C, I.prepend), H.set(I.start = yt, I);
181
181
  else {
182
182
  const rt = new r(yt, st);
183
183
  M(At, C, rt.append), M(zt, C, rt.append), H.set(yt, rt), lt.set(st, rt);
@@ -186,9 +186,9 @@ Ot(["exports"], function(o) {
186
186
  }
187
187
  }
188
188
  }
189
- for (const [P, I] of _.entries()) {
189
+ for (const [P, L] of _.entries()) {
190
190
  let R = null;
191
- for (const V of I.values())
191
+ for (const V of L.values())
192
192
  V.isEmpty() || (R == null && (R = u[P] || (u[P] = [])), R.push(V.lineString()));
193
193
  }
194
194
  return u;
@@ -279,7 +279,7 @@ Ot(["exports"], function(o) {
279
279
  }
280
280
  return tt || !1;
281
281
  }
282
- function L(t, e, i) {
282
+ function G(t, e, i) {
283
283
  let n = () => {
284
284
  };
285
285
  const a = setTimeout(() => {
@@ -311,19 +311,19 @@ Ot(["exports"], function(o) {
311
311
  if (l)
312
312
  l.lastUsed = ++E, l.waiting++;
313
313
  else {
314
- const f = new AbortController(), h = n(i, f);
314
+ const h = new AbortController(), f = n(i, h);
315
315
  l = {
316
- abortController: f,
317
- item: h,
316
+ abortController: h,
317
+ item: f,
318
318
  lastUsed: ++E,
319
319
  waiting: 1
320
320
  }, this.items.set(i, l), this.prune();
321
321
  }
322
- const s = this.items, c = l.item.then((f) => f, (f) => (s.delete(i), Promise.reject(f)));
322
+ const s = this.items, c = l.item.then((h) => h, (h) => (s.delete(i), Promise.reject(h)));
323
323
  let m = !1;
324
324
  return U(a, () => {
325
- var f;
326
- l && l.abortController && !m && (m = !0, --l.waiting <= 0 && ((f = l.abortController) === null || f === void 0 || f.abort(), s.delete(i)));
325
+ var h;
326
+ l && l.abortController && !m && (m = !0, --l.waiting <= 0 && ((h = l.abortController) === null || h === void 0 || h.abort(), s.delete(i)));
327
327
  }), c;
328
328
  }, this.clear = () => this.items.clear(), this.maxSize = e, this.items = /* @__PURE__ */ new Map();
329
329
  }
@@ -344,7 +344,7 @@ Ot(["exports"], function(o) {
344
344
  function W(t, e) {
345
345
  return K || (K = new OffscreenCanvas(t.width, t.height), et = K.getContext("2d", {
346
346
  willReadFrequently: !0
347
- })), Gt(t, e, K, et);
347
+ })), It(t, e, K, et);
348
348
  }
349
349
  async function xt(t, e, i) {
350
350
  var n, a, l;
@@ -355,8 +355,8 @@ Ot(["exports"], function(o) {
355
355
  try {
356
356
  if (!(((n = c == null ? void 0 : c.format) === null || n === void 0 ? void 0 : n.startsWith("BGR")) || ((a = c == null ? void 0 : c.format) === null || a === void 0 ? void 0 : a.startsWith("RGB"))))
357
357
  throw new Error(`Unrecognized format: ${c == null ? void 0 : c.format}`);
358
- const f = (l = c == null ? void 0 : c.format) === null || l === void 0 ? void 0 : l.startsWith("BGR"), h = c.allocationSize(), u = new Uint8ClampedArray(h);
359
- if (await c.copyTo(u), f)
358
+ const h = (l = c == null ? void 0 : c.format) === null || l === void 0 ? void 0 : l.startsWith("BGR"), f = c.allocationSize(), u = new Uint8ClampedArray(f);
359
+ if (await c.copyTo(u), h)
360
360
  for (let _ = 0; _ < u.length; _ += 4) {
361
361
  const F = u[_];
362
362
  u[_] = u[_ + 2], u[_ + 2] = F;
@@ -379,7 +379,7 @@ Ot(["exports"], function(o) {
379
379
  B(i) || l(n), URL.revokeObjectURL(n.src), n.onload = null;
380
380
  }, n.onerror = () => s(new Error("Could not load image.")), n.src = t.size ? URL.createObjectURL(t) : "";
381
381
  });
382
- return Gt(a, e, N, it);
382
+ return It(a, e, N, it);
383
383
  }
384
384
  function te(t, e, i) {
385
385
  return self.actor.send("decodeImage", [], i, void 0, t, e);
@@ -391,8 +391,8 @@ Ot(["exports"], function(o) {
391
391
  self instanceof WorkerGlobalScope
392
392
  );
393
393
  }
394
- const It = Y() ? xt : ct() ? at : ee() ? te : qt;
395
- function Gt(t, e, i, n) {
394
+ const Lt = Y() ? xt : ct() ? at : ee() ? te : qt;
395
+ function It(t, e, i, n) {
396
396
  if (i.width = t.width, i.height = t.height, !n)
397
397
  throw new Error("failed to get context");
398
398
  n.drawImage(t, 0, 0, t.width, t.height);
@@ -414,30 +414,30 @@ Ot(["exports"], function(o) {
414
414
  this.split = (a, l, s) => {
415
415
  if (a === 0)
416
416
  return this;
417
- const c = 1 << a, m = l * this.width / c, f = s * this.height / c;
418
- return new $(this.width / c, this.height / c, (h, u) => this.get(h + m, u + f));
417
+ const c = 1 << a, m = l * this.width / c, h = s * this.height / c;
418
+ return new $(this.width / c, this.height / c, (f, u) => this.get(f + m, u + h));
419
419
  }, this.subsamplePixelCenters = (a) => {
420
- const l = (m, f, h) => isNaN(m) ? f : isNaN(f) ? m : m + (f - m) * h;
420
+ const l = (m, h, f) => isNaN(m) ? h : isNaN(h) ? m : m + (h - m) * f;
421
421
  if (a <= 1)
422
422
  return this;
423
- const s = 0.5 - 1 / (2 * a), c = (m, f) => {
424
- const h = m / a - s, u = f / a - s, _ = Math.floor(h), F = Math.floor(u), M = this.get(_, F), P = this.get(_ + 1, F), I = this.get(_, F + 1), R = this.get(_ + 1, F + 1), V = h - _, dt = u - F, pt = l(M, P, V), X = l(I, R, V);
423
+ const s = 0.5 - 1 / (2 * a), c = (m, h) => {
424
+ const f = m / a - s, u = h / a - s, _ = Math.floor(f), F = Math.floor(u), M = this.get(_, F), P = this.get(_ + 1, F), L = this.get(_, F + 1), R = this.get(_ + 1, F + 1), V = f - _, dt = u - F, pt = l(M, P, V), X = l(L, R, V);
425
425
  return l(pt, X, dt);
426
426
  };
427
427
  return new $(this.width * a, this.height * a, c);
428
428
  }, this.averagePixelCentersToGrid = (a = 1) => new $(this.width + 1, this.height + 1, (l, s) => {
429
- let c = 0, m = 0, f = 0;
430
- for (let h = l - a; h < l + a; h++)
429
+ let c = 0, m = 0, h = 0;
430
+ for (let f = l - a; f < l + a; f++)
431
431
  for (let u = s - a; u < s + a; u++)
432
- isNaN(f = this.get(h, u)) || (m++, c += f);
432
+ isNaN(h = this.get(f, u)) || (m++, c += h);
433
433
  return m === 0 ? NaN : c / m;
434
434
  }), this.scaleElevation = (a) => a === 1 ? this : new $(this.width, this.height, (l, s) => this.get(l, s) * a), this.materialize = (a = 2) => {
435
435
  const l = this.width + 2 * a, s = new Float32Array(l * (this.height + 2 * a));
436
436
  let c = 0;
437
437
  for (let m = -a; m < this.height + a; m++)
438
- for (let f = -a; f < this.width + a; f++)
439
- s[c++] = this.get(f, m);
440
- return new $(this.width, this.height, (m, f) => s[(f + a) * l + m + a]);
438
+ for (let h = -a; h < this.width + a; h++)
439
+ s[c++] = this.get(h, m);
440
+ return new $(this.width, this.height, (m, h) => s[(h + a) * l + m + a]);
441
441
  }, this.get = n, this.width = e, this.height = i;
442
442
  }
443
443
  /** Construct a height tile from raw DEM pixel values */
@@ -474,24 +474,24 @@ Ot(["exports"], function(o) {
474
474
  var Et = {};
475
475
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
476
476
  Et.read = function(t, e, i, n, a) {
477
- var l, s, c = a * 8 - n - 1, m = (1 << c) - 1, f = m >> 1, h = -7, u = i ? a - 1 : 0, _ = i ? -1 : 1, F = t[e + u];
478
- for (u += _, l = F & (1 << -h) - 1, F >>= -h, h += c; h > 0; l = l * 256 + t[e + u], u += _, h -= 8)
477
+ var l, s, c = a * 8 - n - 1, m = (1 << c) - 1, h = m >> 1, f = -7, u = i ? a - 1 : 0, _ = i ? -1 : 1, F = t[e + u];
478
+ for (u += _, l = F & (1 << -f) - 1, F >>= -f, f += c; f > 0; l = l * 256 + t[e + u], u += _, f -= 8)
479
479
  ;
480
- for (s = l & (1 << -h) - 1, l >>= -h, h += n; h > 0; s = s * 256 + t[e + u], u += _, h -= 8)
480
+ for (s = l & (1 << -f) - 1, l >>= -f, f += n; f > 0; s = s * 256 + t[e + u], u += _, f -= 8)
481
481
  ;
482
482
  if (l === 0)
483
- l = 1 - f;
483
+ l = 1 - h;
484
484
  else {
485
485
  if (l === m)
486
486
  return s ? NaN : (F ? -1 : 1) * (1 / 0);
487
- s = s + Math.pow(2, n), l = l - f;
487
+ s = s + Math.pow(2, n), l = l - h;
488
488
  }
489
489
  return (F ? -1 : 1) * s * Math.pow(2, l - n);
490
490
  }, Et.write = function(t, e, i, n, a, l) {
491
- var s, c, m, f = l * 8 - a - 1, h = (1 << f) - 1, u = h >> 1, _ = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = n ? 0 : l - 1, M = n ? 1 : -1, P = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
492
- for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + u >= 1 ? e += _ / m : e += _ * Math.pow(2, 1 - u), e * m >= 2 && (s++, m /= 2), s + u >= h ? (c = 0, s = h) : s + u >= 1 ? (c = (e * m - 1) * Math.pow(2, a), s = s + u) : (c = e * Math.pow(2, u - 1) * Math.pow(2, a), s = 0)); a >= 8; t[i + F] = c & 255, F += M, c /= 256, a -= 8)
491
+ var s, c, m, h = l * 8 - a - 1, f = (1 << h) - 1, u = f >> 1, _ = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = n ? 0 : l - 1, M = n ? 1 : -1, P = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
492
+ for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, s = f) : (s = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -s)) < 1 && (s--, m *= 2), s + u >= 1 ? e += _ / m : e += _ * Math.pow(2, 1 - u), e * m >= 2 && (s++, m /= 2), s + u >= f ? (c = 0, s = f) : s + u >= 1 ? (c = (e * m - 1) * Math.pow(2, a), s = s + u) : (c = e * Math.pow(2, u - 1) * Math.pow(2, a), s = 0)); a >= 8; t[i + F] = c & 255, F += M, c /= 256, a -= 8)
493
493
  ;
494
- for (s = s << a | c, f += a; f > 0; t[i + F] = s & 255, F += M, s /= 256, f -= 8)
494
+ for (s = s << a | c, h += a; h > 0; t[i + F] = s & 255, F += M, s /= 256, h -= 8)
495
495
  ;
496
496
  t[i + F - M] |= P * 128;
497
497
  };
@@ -500,7 +500,7 @@ Ot(["exports"], function(o) {
500
500
  this.buf = ArrayBuffer.isView && ArrayBuffer.isView(t) ? t : new Uint8Array(t || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
501
501
  }
502
502
  v.Varint = 0, v.Fixed64 = 1, v.Bytes = 2, v.Fixed32 = 5;
503
- var Ft = 65536 * 65536, Lt = 1 / Ft, le = 12, Bt = typeof TextDecoder > "u" ? null : new TextDecoder("utf8");
503
+ var Ft = 65536 * 65536, Gt = 1 / Ft, le = 12, Bt = typeof TextDecoder > "u" ? null : new TextDecoder("utf8");
504
504
  v.prototype = {
505
505
  destroy: function() {
506
506
  this.buf = null;
@@ -642,16 +642,16 @@ Ot(["exports"], function(o) {
642
642
  return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
643
643
  },
644
644
  writeFixed32: function(t) {
645
- this.realloc(4), ft(this.buf, t, this.pos), this.pos += 4;
645
+ this.realloc(4), ht(this.buf, t, this.pos), this.pos += 4;
646
646
  },
647
647
  writeSFixed32: function(t) {
648
- this.realloc(4), ft(this.buf, t, this.pos), this.pos += 4;
648
+ this.realloc(4), ht(this.buf, t, this.pos), this.pos += 4;
649
649
  },
650
650
  writeFixed64: function(t) {
651
- this.realloc(8), ft(this.buf, t & -1, this.pos), ft(this.buf, Math.floor(t * Lt), this.pos + 4), this.pos += 8;
651
+ this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Gt), this.pos + 4), this.pos += 8;
652
652
  },
653
653
  writeSFixed64: function(t) {
654
- this.realloc(8), ft(this.buf, t & -1, this.pos), ft(this.buf, Math.floor(t * Lt), this.pos + 4), this.pos += 8;
654
+ this.realloc(8), ht(this.buf, t & -1, this.pos), ht(this.buf, Math.floor(t * Gt), this.pos + 4), this.pos += 8;
655
655
  },
656
656
  writeVarint: function(t) {
657
657
  if (t = +t || 0, t > 268435455 || t < 0) {
@@ -695,7 +695,7 @@ Ot(["exports"], function(o) {
695
695
  this.writeTag(t, v.Bytes), this.writeRawMessage(e, i);
696
696
  },
697
697
  writePackedVarint: function(t, e) {
698
- e.length && this.writeMessage(t, he, e);
698
+ e.length && this.writeMessage(t, fe, e);
699
699
  },
700
700
  writePackedSVarint: function(t, e) {
701
701
  e.length && this.writeMessage(t, de, e);
@@ -770,12 +770,12 @@ Ot(["exports"], function(o) {
770
770
  var i, n;
771
771
  if (t >= 0 ? (i = t % 4294967296 | 0, n = t / 4294967296 | 0) : (i = ~(-t % 4294967296), n = ~(-t / 4294967296), i ^ 4294967295 ? i = i + 1 | 0 : (i = 0, n = n + 1 | 0)), t >= 18446744073709552e3 || t < -18446744073709552e3)
772
772
  throw new Error("Given varint doesn't fit into 10 bytes");
773
- e.realloc(10), me(i, n, e), fe(n, e);
773
+ e.realloc(10), me(i, n, e), he(n, e);
774
774
  }
775
775
  function me(t, e, i) {
776
776
  i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos++] = t & 127 | 128, t >>>= 7, i.buf[i.pos] = t & 127;
777
777
  }
778
- function fe(t, e) {
778
+ function he(t, e) {
779
779
  var i = (t & 7) << 4;
780
780
  e.buf[e.pos++] |= i | ((t >>>= 3) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127 | ((t >>>= 7) ? 128 : 0), t && (e.buf[e.pos++] = t & 127)))));
781
781
  }
@@ -784,7 +784,7 @@ Ot(["exports"], function(o) {
784
784
  i.realloc(n);
785
785
  for (var a = i.pos - 1; a >= t; a--) i.buf[a + n] = i.buf[a];
786
786
  }
787
- function he(t, e) {
787
+ function fe(t, e) {
788
788
  for (var i = 0; i < t.length; i++) e.writeVarint(t[i]);
789
789
  }
790
790
  function de(t, e) {
@@ -814,7 +814,7 @@ Ot(["exports"], function(o) {
814
814
  function wt(t, e) {
815
815
  return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + t[e + 3] * 16777216;
816
816
  }
817
- function ft(t, e, i) {
817
+ function ht(t, e, i) {
818
818
  t[i] = e, t[i + 1] = e >>> 8, t[i + 2] = e >>> 16, t[i + 3] = e >>> 24;
819
819
  }
820
820
  function Nt(t, e) {
@@ -824,8 +824,8 @@ Ot(["exports"], function(o) {
824
824
  for (var n = "", a = e; a < i; ) {
825
825
  var l = t[a], s = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
826
826
  if (a + c > i) break;
827
- var m, f, h;
828
- c === 1 ? l < 128 && (s = l) : c === 2 ? (m = t[a + 1], (m & 192) === 128 && (s = (l & 31) << 6 | m & 63, s <= 127 && (s = null))) : c === 3 ? (m = t[a + 1], f = t[a + 2], (m & 192) === 128 && (f & 192) === 128 && (s = (l & 15) << 12 | (m & 63) << 6 | f & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (m = t[a + 1], f = t[a + 2], h = t[a + 3], (m & 192) === 128 && (f & 192) === 128 && (h & 192) === 128 && (s = (l & 15) << 18 | (m & 63) << 12 | (f & 63) << 6 | h & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, n += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n += String.fromCharCode(s), a += c;
827
+ var m, h, f;
828
+ c === 1 ? l < 128 && (s = l) : c === 2 ? (m = t[a + 1], (m & 192) === 128 && (s = (l & 31) << 6 | m & 63, s <= 127 && (s = null))) : c === 3 ? (m = t[a + 1], h = t[a + 2], (m & 192) === 128 && (h & 192) === 128 && (s = (l & 15) << 12 | (m & 63) << 6 | h & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (m = t[a + 1], h = t[a + 2], f = t[a + 3], (m & 192) === 128 && (h & 192) === 128 && (f & 192) === 128 && (s = (l & 15) << 18 | (m & 63) << 12 | (h & 63) << 6 | f & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, n += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n += String.fromCharCode(s), a += c;
829
829
  }
830
830
  return n;
831
831
  }
@@ -850,10 +850,10 @@ Ot(["exports"], function(o) {
850
850
  }
851
851
  return i;
852
852
  }
853
- var ve = /* @__PURE__ */ ae(ne), ht;
853
+ var ve = /* @__PURE__ */ ae(ne), ft;
854
854
  (function(t) {
855
855
  t[t.UNKNOWN = 0] = "UNKNOWN", t[t.POINT = 1] = "POINT", t[t.LINESTRING = 2] = "LINESTRING", t[t.POLYGON = 3] = "POLYGON";
856
- })(ht || (ht = {}));
856
+ })(ft || (ft = {}));
857
857
  function De(t) {
858
858
  const e = new ve();
859
859
  for (const i in t.layers) {
@@ -891,13 +891,13 @@ Ot(["exports"], function(o) {
891
891
  throw new Error();
892
892
  const n = t.keys, a = t.values, l = t.keycache, s = t.valuecache;
893
893
  for (const c in i.properties) {
894
- let m = i.properties[c], f = l[c];
894
+ let m = i.properties[c], h = l[c];
895
895
  if (m === null)
896
896
  continue;
897
- typeof f > "u" && (n.push(c), f = n.length - 1, l[c] = f), e.writeVarint(f);
898
- const h = typeof m;
899
- h !== "string" && h !== "boolean" && h !== "number" && (m = JSON.stringify(m));
900
- const u = `${h}:${m}`;
897
+ typeof h > "u" && (n.push(c), h = n.length - 1, l[c] = h), e.writeVarint(h);
898
+ const f = typeof m;
899
+ f !== "string" && f !== "boolean" && f !== "number" && (m = JSON.stringify(m));
900
+ const u = `${f}:${m}`;
901
901
  let _ = s[u];
902
902
  typeof _ > "u" && (a.push(m), _ = a.length - 1, s[u] = _), e.writeVarint(_);
903
903
  }
@@ -915,14 +915,14 @@ Ot(["exports"], function(o) {
915
915
  let a = 0, l = 0;
916
916
  for (const s of i) {
917
917
  let c = 1;
918
- n === ht.POINT && (c = s.length / 2), e.writeVarint(St(1, c));
919
- const m = s.length / 2, f = n === ht.POLYGON ? m - 1 : m;
920
- for (let h = 0; h < f; h++) {
921
- h === 1 && n !== 1 && e.writeVarint(St(2, f - 1));
922
- const u = s[h * 2] - a, _ = s[h * 2 + 1] - l;
918
+ n === ft.POINT && (c = s.length / 2), e.writeVarint(St(1, c));
919
+ const m = s.length / 2, h = n === ft.POLYGON ? m - 1 : m;
920
+ for (let f = 0; f < h; f++) {
921
+ f === 1 && n !== 1 && e.writeVarint(St(2, h - 1));
922
+ const u = s[f * 2] - a, _ = s[f * 2 + 1] - l;
923
923
  e.writeVarint(Vt(u)), e.writeVarint(Vt(_)), a += u, l += _;
924
924
  }
925
- n === ht.POLYGON && e.writeVarint(St(7, 1));
925
+ n === ft.POLYGON && e.writeVarint(St(7, 1));
926
926
  }
927
927
  }
928
928
  function Ae(t, e) {
@@ -932,27 +932,27 @@ Ot(["exports"], function(o) {
932
932
  }
933
933
  class Re {
934
934
  constructor(e, i, n, a, l) {
935
- this.loaded = Promise.resolve(), this.decodeImage = It, this.fetchAndParseTile = (s, c, m, f, h) => {
935
+ this.loaded = Promise.resolve(), this.decodeImage = Lt, this.fetchAndParseTile = (s, c, m, h, f) => {
936
936
  const u = this, _ = this.demUrlPattern.replace("{z}", s.toString()).replace("{x}", c.toString()).replace("{y}", m.toString());
937
- return h == null || h.useTile(_), this.parsedCache.get(_, async (F, M) => {
938
- const P = await u.fetchTile(s, c, m, M, h);
937
+ return f == null || f.useTile(_), this.parsedCache.get(_, async (F, M) => {
938
+ const P = await u.fetchTile(s, c, m, M, f);
939
939
  if (B(M))
940
940
  throw new Error("canceled");
941
- const I = u.decodeImage(P.data, u.encoding, M), R = h == null ? void 0 : h.marker("decode"), V = await I;
941
+ const L = u.decodeImage(P.data, u.encoding, M), R = f == null ? void 0 : f.marker("decode"), V = await L;
942
942
  return R == null || R(), V;
943
- }, f);
943
+ }, h);
944
944
  }, this.tileCache = new Z(i), this.parsedCache = new Z(i), this.contourCache = new Z(i), this.timeoutMs = l, this.demUrlPattern = e, this.encoding = n, this.maxzoom = a;
945
945
  }
946
946
  fetchTile(e, i, n, a, l) {
947
947
  const s = this.demUrlPattern.replace("{z}", e.toString()).replace("{x}", i.toString()).replace("{y}", n.toString());
948
948
  return l == null || l.useTile(s), this.tileCache.get(s, (c, m) => {
949
- const f = {
949
+ const h = {
950
950
  signal: m.signal
951
951
  };
952
952
  l == null || l.fetchTile(s);
953
- const h = l == null ? void 0 : l.marker("fetch");
954
- return L(this.timeoutMs, fetch(s, f).then(async (u) => {
955
- if (h == null || h(), !u.ok)
953
+ const f = l == null ? void 0 : l.marker("fetch");
954
+ return G(this.timeoutMs, fetch(s, h).then(async (u) => {
955
+ if (f == null || f(), !u.ok)
956
956
  throw new Error(`Bad response: ${u.status} for ${s}`);
957
957
  return {
958
958
  data: await u.blob(),
@@ -963,15 +963,15 @@ Ot(["exports"], function(o) {
963
963
  }, a);
964
964
  }
965
965
  async fetchDem(e, i, n, a, l, s) {
966
- const c = Math.min(e - (a.overzoom || 0), this.maxzoom), m = e - c, f = 1 << m, h = Math.floor(i / f), u = Math.floor(n / f), _ = await this.fetchAndParseTile(c, h, u, l, s);
967
- return $.fromRawDem(_).split(m, i % f, n % f);
966
+ const c = Math.min(e - (a.overzoom || 0), this.maxzoom), m = e - c, h = 1 << m, f = Math.floor(i / h), u = Math.floor(n / h), _ = await this.fetchAndParseTile(c, f, u, l, s);
967
+ return $.fromRawDem(_).split(m, i % h, n % h);
968
968
  }
969
969
  fetchContourTile(e, i, n, a, l, s) {
970
- const { levels: c, multiplier: m = 1, buffer: f = 1, extent: h = 4096, contourLayer: u = "contours", elevationKey: _ = "ele", levelKey: F = "level", subsampleBelow: M = 100 } = a;
970
+ const { levels: c, multiplier: m = 1, buffer: h = 1, extent: f = 4096, contourLayer: u = "contours", elevationKey: _ = "ele", levelKey: F = "level", subsampleBelow: M = 100 } = a;
971
971
  if (!c || c.length === 0)
972
972
  return Promise.resolve({ arrayBuffer: new ArrayBuffer(0) });
973
973
  const P = [e, i, n, p(a)].join("/");
974
- return this.contourCache.get(P, async (I, R) => {
974
+ return this.contourCache.get(P, async (L, R) => {
975
975
  const V = 1 << e, dt = [];
976
976
  for (let q = n - 1; q <= n + 1; q++)
977
977
  for (let nt = i - 1; nt <= i + 1; nt++)
@@ -987,16 +987,16 @@ Ot(["exports"], function(o) {
987
987
  for (; X.width < M; )
988
988
  X = X.subsamplePixelCenters(2).materialize(2);
989
989
  X = X.averagePixelCentersToGrid().scaleElevation(m).materialize(1);
990
- const C = w(c[0], X, h, f);
990
+ const C = w(c[0], X, f, h);
991
991
  ot == null || ot();
992
992
  const kt = De({
993
- extent: h,
993
+ extent: f,
994
994
  layers: {
995
995
  [u]: {
996
996
  features: Object.entries(C).map(([q, nt]) => {
997
997
  const _t = Number(q);
998
998
  return {
999
- type: ht.LINESTRING,
999
+ type: ft.LINESTRING,
1000
1000
  geometry: nt,
1001
1001
  properties: {
1002
1002
  [_]: _t,
@@ -1030,8 +1030,8 @@ Ot(["exports"], function(o) {
1030
1030
  this.marks = {}, this.urls = [], this.fetched = [], this.resources = [], this.tilesFetched = 0, this.timeOrigin = Ce, this.finish = (i) => {
1031
1031
  this.markFinish();
1032
1032
  const n = (m) => {
1033
- const f = this.marks[m] || [], h = Math.max(...f.map((_) => Math.max(..._))), u = Math.min(...f.map((_) => Math.min(..._)));
1034
- return Number.isFinite(h) ? h - u : void 0;
1033
+ const h = this.marks[m] || [], f = Math.max(...h.map((_) => Math.max(..._))), u = Math.min(...h.map((_) => Math.min(..._)));
1034
+ return Number.isFinite(f) ? f - u : void 0;
1035
1035
  }, a = n("main") || 0, l = n("fetch"), s = n("decode"), c = n("isoline");
1036
1036
  return {
1037
1037
  url: i,
@@ -1063,21 +1063,21 @@ Ot(["exports"], function(o) {
1063
1063
  const a = i.origin - this.timeOrigin;
1064
1064
  for (const l in i.marks) {
1065
1065
  const s = l;
1066
- (this.marks[s] || (this.marks[s] = [])).push(...((n = i.marks[s]) === null || n === void 0 ? void 0 : n.map((m) => m.map((f) => f + a))) || []);
1066
+ (this.marks[s] || (this.marks[s] = [])).push(...((n = i.marks[s]) === null || n === void 0 ? void 0 : n.map((m) => m.map((h) => h + a))) || []);
1067
1067
  }
1068
- this.resources.push(...i.resources.map((l) => Ie(l, a)));
1068
+ this.resources.push(...i.resources.map((l) => Le(l, a)));
1069
1069
  }, this.markFinish = this.marker(e);
1070
1070
  }
1071
1071
  }
1072
1072
  const Oe = /(Start$|End$|^start|^end)/;
1073
- function Ie(t, e) {
1073
+ function Le(t, e) {
1074
1074
  const i = {};
1075
1075
  for (const n in t)
1076
1076
  t[n] !== 0 && Oe.test(n) ? i[n] = Number(t[n]) + e : i[n] = t[n];
1077
1077
  return i;
1078
1078
  }
1079
- let Ge = 0;
1080
- class Le {
1079
+ let Ie = 0;
1080
+ class Ge {
1081
1081
  constructor(e, i, n = 2e4) {
1082
1082
  this.callbacks = {}, this.cancels = {}, this.dest = e, this.timeoutMs = n, this.dest.onmessage = async ({ data: a }) => {
1083
1083
  const l = a;
@@ -1088,27 +1088,27 @@ Ot(["exports"], function(o) {
1088
1088
  const s = this.callbacks[l.id];
1089
1089
  delete this.callbacks[l.id], s && s(l.error ? new Error(l.error) : void 0, l.response, l.timings);
1090
1090
  } else if (l.type === "request") {
1091
- const s = new Wt("worker"), c = i[l.name], m = new AbortController(), f = c.apply(c, [
1091
+ const s = new Wt("worker"), c = i[l.name], m = new AbortController(), h = c.apply(c, [
1092
1092
  ...l.args,
1093
1093
  m,
1094
1094
  s
1095
- ]), h = `${l.name}_${l.id}`;
1096
- if (l.id && f) {
1095
+ ]), f = `${l.name}_${l.id}`;
1096
+ if (l.id && h) {
1097
1097
  this.cancels[l.id] = m;
1098
1098
  try {
1099
- const u = await f, _ = u == null ? void 0 : u.transferrables;
1099
+ const u = await h, _ = u == null ? void 0 : u.transferrables;
1100
1100
  this.postMessage({
1101
1101
  id: l.id,
1102
1102
  type: "response",
1103
1103
  response: u,
1104
- timings: s.finish(h)
1104
+ timings: s.finish(f)
1105
1105
  }, _);
1106
1106
  } catch (u) {
1107
1107
  this.postMessage({
1108
1108
  id: l.id,
1109
1109
  type: "response",
1110
1110
  error: (u == null ? void 0 : u.toString()) || "error",
1111
- timings: s.finish(h)
1111
+ timings: s.finish(f)
1112
1112
  });
1113
1113
  }
1114
1114
  delete this.cancels[l.id];
@@ -1121,17 +1121,17 @@ Ot(["exports"], function(o) {
1121
1121
  }
1122
1122
  /** Invokes a method by name with a set of arguments in the remote context. */
1123
1123
  send(e, i, n, a, ...l) {
1124
- const s = ++Ge, c = new Promise((m, f) => {
1125
- this.postMessage({ id: s, type: "request", name: e, args: l }, i), this.callbacks[s] = (h, u, _) => {
1126
- a == null || a.addAll(_), h ? f(h) : m(u);
1124
+ const s = ++Ie, c = new Promise((m, h) => {
1125
+ this.postMessage({ id: s, type: "request", name: e, args: l }, i), this.callbacks[s] = (f, u, _) => {
1126
+ a == null || a.addAll(_), f ? h(f) : m(u);
1127
1127
  };
1128
1128
  });
1129
1129
  return U(n, () => {
1130
1130
  delete this.callbacks[s], this.postMessage({ id: s, type: "cancel" });
1131
- }), L(this.timeoutMs, c, n);
1131
+ }), G(this.timeoutMs, c, n);
1132
1132
  }
1133
1133
  }
1134
- o.A = Le, o.H = $, o.L = Re, o.T = Wt, o.a = z, o.b = w, o.c = Dt, o.d = It, o.e = A, o.f = k, o.g = x, o.p = D;
1134
+ o.A = Ge, o.H = $, o.L = Re, o.T = Wt, o.a = z, o.b = w, o.c = Dt, o.d = Lt, o.e = A, o.f = k, o.g = x, o.p = D;
1135
1135
  });
1136
1136
  Ot(["./shared"], function(o) {
1137
1137
  const r = (g) => Promise.reject(new Error(`No manager registered for ${g}`));
@@ -1169,7 +1169,7 @@ Ot(["./shared"], function(o) {
1169
1169
  }
1170
1170
  class b {
1171
1171
  constructor(x, T, D, k, j, ct) {
1172
- this.fetchTile = (Y, L, U, B, E) => this.actor.send("fetchTile", [], B, E, this.managerId, Y, L, U), this.fetchAndParseTile = (Y, L, U, B, E) => this.actor.send("fetchAndParseTile", [], B, E, this.managerId, Y, L, U), this.fetchContourTile = (Y, L, U, B, E, Z) => this.actor.send("fetchContourTile", [], E, Z, this.managerId, Y, L, U, B);
1172
+ this.fetchTile = (Y, G, U, B, E) => this.actor.send("fetchTile", [], B, E, this.managerId, Y, G, U), this.fetchAndParseTile = (Y, G, U, B, E) => this.actor.send("fetchAndParseTile", [], B, E, this.managerId, Y, G, U), this.fetchContourTile = (Y, G, U, B, E, Z) => this.actor.send("fetchContourTile", [], E, Z, this.managerId, Y, G, U, B);
1173
1173
  const tt = this.managerId = ++y;
1174
1174
  this.actor = ct || w(), this.loaded = this.actor.send("init", [], new AbortController(), void 0, {
1175
1175
  cacheSize: T,
@@ -1231,10 +1231,10 @@ Ot(["./shared"], function(o) {
1231
1231
  this.timingCallbacks.forEach((N) => N(et));
1232
1232
  }
1233
1233
  }, this.contourProtocol = S(this.contourProtocolV4), this.sharedDemProtocol = S(this.sharedDemProtocolV4), this.contourProtocolUrl = (E) => `${this.contourProtocolUrlBase}?${o.e(E)}`;
1234
- let L = D, U = 1;
1235
- for (; O.has(L); )
1236
- L = D + U++;
1237
- O.add(L), this.sharedDemProtocolId = `${L}-shared`, this.contourProtocolId = `${L}-contour`, this.sharedDemProtocolUrl = `${this.sharedDemProtocolId}://{z}/{x}/{y}`, this.contourProtocolUrlBase = `${this.contourProtocolId}://{z}/{x}/{y}`;
1234
+ let G = D, U = 1;
1235
+ for (; O.has(G); )
1236
+ G = D + U++;
1237
+ O.add(G), this.sharedDemProtocolId = `${G}-shared`, this.contourProtocolId = `${G}-contour`, this.sharedDemProtocolUrl = `${this.sharedDemProtocolId}://{z}/{x}/{y}`, this.contourProtocolUrlBase = `${this.contourProtocolId}://{z}/{x}/{y}`;
1238
1238
  const B = ct ? b : o.L;
1239
1239
  this.manager = new B(x, T, k, j, tt, Y);
1240
1240
  }
@@ -2062,9 +2062,9 @@ function je() {
2062
2062
  }
2063
2063
  const $e = {
2064
2064
  airspaceStroke: "#18C29C",
2065
- restrictedStroke: "#f87171",
2066
- controlledStroke: "#38bdf8",
2067
- controlledFill: "#38bdf8",
2065
+ restrictedStroke: "#CC7722",
2066
+ controlledStroke: "#22C55E",
2067
+ controlledFill: "#22C55E",
2068
2068
  segment: "#40C4FF",
2069
2069
  waypoint: "#74cdde",
2070
2070
  vor: "#72aae5",
@@ -3438,6 +3438,8 @@ class ri {
3438
3438
  }), this._layerVisible.terrain && this._map.setTerrain({ source: "terrain", exaggeration: 4 });
3439
3439
  for (const y of Ht(this._theme))
3440
3440
  this._map.getLayer(y.id) || this._map.addLayer(y);
3441
+ for (const y of ["terrain-color", "terrain-hillshade", "contour-line", "contour-label"])
3442
+ this._map.getLayer(y) && this._map.getLayer("boundary") && this._map.moveLayer(y, "boundary");
3441
3443
  for (const y of Yt("amm", this._theme))
3442
3444
  this._map.getLayer(y.id) || this._map.addLayer(y, "fir-line");
3443
3445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aviation-chart",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "CASC 4D aviation chart SDK — MapLibre-based aviation chart with built-in layers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",