maplibre-gl-components 0.12.1 → 0.12.2

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 (29) hide show
  1. package/dist/{ControlGrid-3Y_umzvK.cjs → ControlGrid-BHj06tuI.cjs} +5 -5
  2. package/dist/{ControlGrid-CeKq8xm8.js → ControlGrid-CcOIR0lI.js} +18 -18
  3. package/dist/{deflate-CCnKrMSU.js → deflate-BeG874Ez.js} +1 -1
  4. package/dist/{deflate-Dj9xAuf-.cjs → deflate-Buv4KFPQ.cjs} +1 -1
  5. package/dist/{geotiff-CkM7wOor.js → geotiff-CY9Ly-G7.js} +8 -8
  6. package/dist/{geotiff-C-MHEjS3.cjs → geotiff-D9Jxidvv.cjs} +2 -2
  7. package/dist/index-Bhn2Pjz_.js +4 -0
  8. package/dist/{index-rhQrpZSD.cjs → index-ChPRo5p6.cjs} +1 -1
  9. package/dist/{index-Dv6tRl9f.js → index-CkoU3LUr.js} +2 -2
  10. package/dist/{index-C8CBe27l.cjs → index-CsAfY_en.cjs} +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.mjs +2 -2
  13. package/dist/{jpeg-D2rka1FK.js → jpeg-DxFhLjr0.js} +1 -1
  14. package/dist/{jpeg-Cr0iCWxG.cjs → jpeg-K5f1PGmj.cjs} +1 -1
  15. package/dist/{lerc-BuHKAAJ5.js → lerc-BKz5PmNT.js} +2 -2
  16. package/dist/{lerc-Du5hw3rN.cjs → lerc-DBi1jyo4.cjs} +1 -1
  17. package/dist/{lzw-BHeSwe4R.cjs → lzw-1pa4hURZ.cjs} +1 -1
  18. package/dist/{lzw-CIvsR7yQ.js → lzw-_5PJSl3d.js} +1 -1
  19. package/dist/maplibre-gl-components.css +1 -1
  20. package/dist/{packbits-C9seKA6S.cjs → packbits-D8NpPMS2.cjs} +1 -1
  21. package/dist/{packbits-CGqapXxr.js → packbits-DB0-GTif.js} +1 -1
  22. package/dist/{raw-BOD2Kcq8.cjs → raw-Ady0oBU-.cjs} +1 -1
  23. package/dist/{raw-Cxjry7D7.js → raw-DaYOG1dh.js} +1 -1
  24. package/dist/react.cjs +1 -1
  25. package/dist/react.mjs +1 -1
  26. package/dist/{webimage-BDD8ZjeE.js → webimage-B65eRBzD.js} +1 -1
  27. package/dist/{webimage-BaGAucPQ.cjs → webimage-CI-Xhwi8.cjs} +1 -1
  28. package/package.json +1 -1
  29. package/dist/index-GVloud5I.js +0 -4
@@ -4762,7 +4762,7 @@ class PD {
4762
4762
  }
4763
4763
  async _ensureOverlay() {
4764
4764
  if (this._deckOverlay || !this._map) return;
4765
- const { MapboxOverlay: e } = await import("./index-GVloud5I.js");
4765
+ const { MapboxOverlay: e } = await import("./index-Bhn2Pjz_.js");
4766
4766
  this._deckOverlay = new e({
4767
4767
  interleaved: !!this._options.beforeId,
4768
4768
  layers: []
@@ -4796,7 +4796,7 @@ class PD {
4796
4796
  async _rebuildLayers() {
4797
4797
  if (this._deckOverlay)
4798
4798
  try {
4799
- const { COGLayer: e } = await import("./index-Dv6tRl9f.js");
4799
+ const { COGLayer: e } = await import("./index-CkoU3LUr.js");
4800
4800
  this._patchCOGLayerForFloat(e), this._patchCOGLayerForOpacity(e);
4801
4801
  const t = [];
4802
4802
  for (const [n, s] of this._cogLayerPropsMap) {
@@ -4892,7 +4892,7 @@ class PD {
4892
4892
  } catch (n) {
4893
4893
  if (!(n instanceof Error ? n.message : String(n)).includes("non-unsigned integers not yet supported"))
4894
4894
  throw n;
4895
- const { fromUrl: r } = await import("./geotiff-CkM7wOor.js").then((ee) => ee.g), { parseCOGTileMatrixSet: o, texture: a } = await import("./index-Dv6tRl9f.js"), { CreateTexture: l, FilterNoDataVal: h } = await import("./index-C9fk_HKR.js"), u = await import("./index-DQXdX5y1.js"), d = u.default || u, g = this.props.geotiff, m = typeof g == "string" ? await r(g) : g, v = this.props.geoKeysParser, b = await o(m, v), w = await m.getImage(), x = await m.getImageCount(), I = [];
4895
+ const { fromUrl: r } = await import("./geotiff-CY9Ly-G7.js").then((ee) => ee.g), { parseCOGTileMatrixSet: o, texture: a } = await import("./index-CkoU3LUr.js"), { CreateTexture: l, FilterNoDataVal: h } = await import("./index-C9fk_HKR.js"), u = await import("./index-DQXdX5y1.js"), d = u.default || u, g = this.props.geotiff, m = typeof g == "string" ? await r(g) : g, v = this.props.geoKeysParser, b = await o(m, v), w = await m.getImage(), x = await m.getImageCount(), I = [];
4896
4896
  for (let ee = 0; ee < x; ee++)
4897
4897
  I.push(await m.getImage(ee));
4898
4898
  const T = await v(w.getGeoKeys());
@@ -5032,7 +5032,7 @@ class PD {
5032
5032
  this._state.loading = !0, this._state.error = null, this._state.status = null, this._render();
5033
5033
  try {
5034
5034
  await this._ensureOverlay();
5035
- const { COGLayer: e } = await import("./index-Dv6tRl9f.js");
5035
+ const { COGLayer: e } = await import("./index-CkoU3LUr.js");
5036
5036
  this._patchCOGLayerForFloat(e), this._patchCOGLayerForOpacity(e);
5037
5037
  const t = this._map, n = {
5038
5038
  geotiff: this._state.url,
@@ -8546,7 +8546,7 @@ class zD {
8546
8546
  }
8547
8547
  async _ensureOverlay() {
8548
8548
  if (this._deckOverlay || !this._map) return;
8549
- const { MapboxOverlay: e } = await import("./index-GVloud5I.js");
8549
+ const { MapboxOverlay: e } = await import("./index-Bhn2Pjz_.js");
8550
8550
  this._deckOverlay = new e({
8551
8551
  interleaved: !!this._options.beforeId,
8552
8552
  layers: []
@@ -8589,7 +8589,7 @@ class zD {
8589
8589
  this._state.loading = !0, this._state.error = null, this._state.status = null, this._render();
8590
8590
  try {
8591
8591
  await this._ensureOverlay();
8592
- const { COGLayer: l } = await import("./index-Dv6tRl9f.js"), { fromUrl: h } = await import("./geotiff-CkM7wOor.js").then((D) => D.g);
8592
+ const { COGLayer: l } = await import("./index-CkoU3LUr.js"), { fromUrl: h } = await import("./geotiff-CY9Ly-G7.js").then((D) => D.g);
8593
8593
  this._patchCOGLayer(l);
8594
8594
  const u = `stac-${this._state.stacItem?.id || "layer"}-rgb-${this._layerCounter++}`, [d, g, m] = await Promise.all([
8595
8595
  h(r.href),
@@ -8709,7 +8709,7 @@ class zD {
8709
8709
  this._state.loading = !0, this._state.error = null, this._state.status = null, this._render();
8710
8710
  try {
8711
8711
  await this._ensureOverlay();
8712
- const { COGLayer: t } = await import("./index-Dv6tRl9f.js");
8712
+ const { COGLayer: t } = await import("./index-CkoU3LUr.js");
8713
8713
  this._patchCOGLayer(t);
8714
8714
  const n = `stac-${this._state.stacItem?.id || "layer"}-${e.key}-${this._layerCounter++}`, s = {
8715
8715
  id: n,
@@ -8783,7 +8783,7 @@ class zD {
8783
8783
  const s = t.apply(this, n), r = this.props.opacity;
8784
8784
  return r == null ? s : bH(s, Math.max(0, Math.min(1, r)));
8785
8785
  }, e.prototype._parseGeoTIFF = async function() {
8786
- const { fromUrl: n } = await import("./geotiff-CkM7wOor.js").then((ee) => ee.g), { parseCOGTileMatrixSet: s, texture: r } = await import("./index-Dv6tRl9f.js"), { CreateTexture: o, FilterNoDataVal: a, Colormap: l } = await import("./index-C9fk_HKR.js"), h = await import("./index-DQXdX5y1.js"), u = h.default || h, d = this.props.geotiff, g = typeof d == "string" ? await n(d) : d, m = this.props.geoKeysParser;
8786
+ const { fromUrl: n } = await import("./geotiff-CY9Ly-G7.js").then((ee) => ee.g), { parseCOGTileMatrixSet: s, texture: r } = await import("./index-CkoU3LUr.js"), { CreateTexture: o, FilterNoDataVal: a, Colormap: l } = await import("./index-C9fk_HKR.js"), h = await import("./index-DQXdX5y1.js"), u = h.default || h, d = this.props.geotiff, g = typeof d == "string" ? await n(d) : d, m = this.props.geoKeysParser;
8787
8787
  let v;
8788
8788
  try {
8789
8789
  v = await s(g, m);
@@ -9830,7 +9830,7 @@ class gde {
9830
9830
  }
9831
9831
  async _ensureOverlay() {
9832
9832
  if (this._deckOverlay || !this._map) return;
9833
- const { MapboxOverlay: e } = await import("./index-GVloud5I.js");
9833
+ const { MapboxOverlay: e } = await import("./index-Bhn2Pjz_.js");
9834
9834
  this._deckOverlay = new e({
9835
9835
  interleaved: !1,
9836
9836
  layers: []
@@ -9860,7 +9860,7 @@ class gde {
9860
9860
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9861
9861
  async _addCogLayer(e, t, n) {
9862
9862
  await this._ensureOverlay();
9863
- const s = this._convertS3ToHttps(e), { COGLayer: r } = await import("./index-Dv6tRl9f.js"), o = `stac-search-${t.id}-${n}-${this._layerCounter++}`, a = new r({
9863
+ const s = this._convertS3ToHttps(e), { COGLayer: r } = await import("./index-CkoU3LUr.js"), o = `stac-search-${t.id}-${n}-${this._layerCounter++}`, a = new r({
9864
9864
  id: o,
9865
9865
  geotiff: s,
9866
9866
  opacity: 1
@@ -167448,7 +167448,7 @@ const Rit = {
167448
167448
  maxzoom: 24,
167449
167449
  basemapStyleUrl: void 0,
167450
167450
  excludeLayers: void 0
167451
- }, Bit = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>', Pit = '<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29"><path d="m10.5 14 4-8 4 8z" fill="#333"/><path d="m10.5 16 4 8 4-8z" fill="#ccc"/></svg>';
167451
+ }, Bit = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>', Pit = '<svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29"><path d="m10.5 14 4-8 4 8z" fill="#333"/><path d="m10.5 16 4 8 4-8z" fill="#ccc"/></svg>';
167452
167452
  class Lit {
167453
167453
  _map;
167454
167454
  _container;
@@ -167994,7 +167994,7 @@ class Dot {
167994
167994
  boxShadow: "0 0 0 2px rgba(0, 0, 0, 0.1)",
167995
167995
  display: g ? "block" : "none",
167996
167996
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
167997
- color: "var(--mlc-grid-text-color, #1a1a1a)"
167997
+ color: "#1a1a1a"
167998
167998
  }), t || e) {
167999
167999
  const v = document.createElement("div");
168000
168000
  if (v.className = "maplibre-gl-control-grid-header", Object.assign(v.style, {
@@ -168020,20 +168020,20 @@ class Dot {
168020
168020
  const b = document.createElement("div");
168021
168021
  if (b.style.display = "flex", b.style.alignItems = "center", b.style.gap = "6px", e) {
168022
168022
  const w = document.createElement("span");
168023
- w.className = "maplibre-gl-control-grid-title", w.textContent = e, w.style.fontWeight = "600", w.style.color = "var(--mlc-grid-text-color, #333)", b.appendChild(w);
168023
+ w.className = "maplibre-gl-control-grid-title", w.textContent = e, w.style.fontWeight = "600", w.style.color = "#333", b.appendChild(w);
168024
168024
  }
168025
168025
  if (a && !this._state.collapsed) {
168026
168026
  const w = document.createElement("label");
168027
- w.style.display = "inline-flex", w.style.alignItems = "center", w.style.gap = "2px", w.style.fontSize = "11px", w.style.color = "var(--mlc-grid-text-color, #333)", w.innerHTML = "R:";
168027
+ w.style.display = "inline-flex", w.style.alignItems = "center", w.style.gap = "2px", w.style.fontSize = "11px", w.style.color = "#333", w.innerHTML = "R:";
168028
168028
  const x = document.createElement("input");
168029
- x.type = "number", x.min = "1", x.max = "12", x.value = String(this._state.rows), x.style.width = "40px", x.style.padding = "2px 2px", x.style.boxSizing = "border-box", x.style.textAlign = "center", x.style.color = "var(--mlc-grid-text-color, #333)", x.addEventListener(
168029
+ x.type = "number", x.min = "1", x.max = "12", x.value = String(this._state.rows), x.style.width = "40px", x.style.padding = "2px 2px", x.style.boxSizing = "border-box", x.style.textAlign = "center", x.style.color = "#333", x.addEventListener(
168030
168030
  "change",
168031
168031
  () => this.setRows(Number(x.value) || 1)
168032
168032
  ), w.appendChild(x);
168033
168033
  const I = document.createElement("label");
168034
- I.style.display = "inline-flex", I.style.alignItems = "center", I.style.gap = "2px", I.style.fontSize = "11px", I.style.color = "var(--mlc-grid-text-color, #333)", I.innerHTML = "C:";
168034
+ I.style.display = "inline-flex", I.style.alignItems = "center", I.style.gap = "2px", I.style.fontSize = "11px", I.style.color = "#333", I.innerHTML = "C:";
168035
168035
  const T = document.createElement("input");
168036
- T.type = "number", T.min = "1", T.max = "12", T.value = String(this._state.columns), T.style.width = "40px", T.style.padding = "2px 2px", T.style.boxSizing = "border-box", T.style.textAlign = "center", T.style.color = "var(--mlc-grid-text-color, #333)", T.addEventListener(
168036
+ T.type = "number", T.min = "1", T.max = "12", T.value = String(this._state.columns), T.style.width = "40px", T.style.padding = "2px 2px", T.style.boxSizing = "border-box", T.style.textAlign = "center", T.style.color = "#333", T.addEventListener(
168037
168037
  "change",
168038
168038
  () => this.setColumns(Number(T.value) || 1)
168039
168039
  ), I.appendChild(T), b.appendChild(w), b.appendChild(I);
@@ -168043,7 +168043,7 @@ class Dot {
168043
168043
  w.className = "maplibre-gl-control-grid-toggle", w.innerHTML = "&#9660;", Object.assign(w.style, {
168044
168044
  fontSize: "10px",
168045
168045
  userSelect: "none",
168046
- color: "var(--mlc-grid-text-color, #333)"
168046
+ color: "#333"
168047
168047
  }), v.appendChild(w), v.addEventListener("click", (x) => {
168048
168048
  (!a || !b.contains(x.target)) && this.toggle();
168049
168049
  });
@@ -1,5 +1,5 @@
1
1
  import { i as r } from "./pako.esm-Bx5X36Wo.js";
2
- import { B as a } from "./geotiff-CkM7wOor.js";
2
+ import { B as a } from "./geotiff-CY9Ly-G7.js";
3
3
  class s extends a {
4
4
  decodeBlock(e) {
5
5
  return r(new Uint8Array(e)).buffer;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./pako.esm-DZC2QrbJ.cjs"),t=require("./geotiff-C-MHEjS3.cjs");class o extends t.BaseDecoder{decodeBlock(e){return r.inflate_1(new Uint8Array(e)).buffer}}exports.default=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./pako.esm-DZC2QrbJ.cjs"),t=require("./geotiff-D9Jxidvv.cjs");class o extends t.BaseDecoder{decodeBlock(e){return r.inflate_1(new Uint8Array(e)).buffer}}exports.default=o;
@@ -1,4 +1,4 @@
1
- import { g as Ve } from "./ControlGrid-CeKq8xm8.js";
1
+ import { g as Ve } from "./ControlGrid-CcOIR0lI.js";
2
2
  const L = {};
3
3
  function T(r) {
4
4
  return (e, ...t) => Ot(r, e, t);
@@ -570,19 +570,19 @@ async function Fe(r) {
570
570
  const t = await e();
571
571
  return new t(r);
572
572
  }
573
- G([void 0, 1], () => import("./raw-Cxjry7D7.js").then((r) => r.default));
574
- G(5, () => import("./lzw-CIvsR7yQ.js").then((r) => r.default));
573
+ G([void 0, 1], () => import("./raw-DaYOG1dh.js").then((r) => r.default));
574
+ G(5, () => import("./lzw-_5PJSl3d.js").then((r) => r.default));
575
575
  G(6, () => {
576
576
  throw new Error("old style JPEG compression is not supported.");
577
577
  });
578
- G(7, () => import("./jpeg-D2rka1FK.js").then((r) => r.default));
579
- G([8, 32946], () => import("./deflate-CCnKrMSU.js").then((r) => r.default));
580
- G(32773, () => import("./packbits-CGqapXxr.js").then((r) => r.default));
578
+ G(7, () => import("./jpeg-DxFhLjr0.js").then((r) => r.default));
579
+ G([8, 32946], () => import("./deflate-BeG874Ez.js").then((r) => r.default));
580
+ G(32773, () => import("./packbits-DB0-GTif.js").then((r) => r.default));
581
581
  G(
582
582
  34887,
583
- () => import("./lerc-BuHKAAJ5.js").then(async (r) => (await r.zstd.init(), r)).then((r) => r.default)
583
+ () => import("./lerc-BKz5PmNT.js").then(async (r) => (await r.zstd.init(), r)).then((r) => r.default)
584
584
  );
585
- G(50001, () => import("./webimage-BDD8ZjeE.js").then((r) => r.default));
585
+ G(50001, () => import("./webimage-B65eRBzD.js").then((r) => r.default));
586
586
  function ge(r, e, t, s = 1) {
587
587
  return new (Object.getPrototypeOf(r)).constructor(e * t * s);
588
588
  }
@@ -1,6 +1,6 @@
1
- "use strict";const Ve=require("./ControlGrid-3Y_umzvK.cjs"),L={};function T(r){return(e,...t)=>Gt(r,e,t)}function q(r,e){return T(je(r,e).get)}const{apply:Gt,getOwnPropertyDescriptor:je,getPrototypeOf:De,ownKeys:Ut}=Reflect,{iterator:J,toStringTag:_t}=Symbol,vt=Object,{create:Ee,defineProperty:Lt}=vt,Nt=Array,Kt=Nt.prototype,He=Kt[J],qt=T(He),Ye=ArrayBuffer,zt=Ye.prototype;q(zt,"byteLength");const Ge=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;Ge&&q(Ge.prototype,"byteLength");const $e=De(Uint8Array);$e.from;const E=$e.prototype;E[J];T(E.keys);T(E.values);T(E.entries);T(E.set);T(E.reverse);T(E.fill);T(E.copyWithin);T(E.sort);T(E.slice);T(E.subarray);q(E,"buffer");q(E,"byteOffset");q(E,"length");q(E,_t);const Vt=Uint8Array,Xe=Uint16Array,Pe=Uint32Array,jt=Float32Array,Z=De([][J]()),Ze=T(Z.next),Ht=T((function*(){})().next),Yt=De(Z),$t=DataView.prototype,Xt=T($t.getUint16),Oe=WeakMap,Je=Oe.prototype,Qe=T(Je.get),Zt=T(Je.set),We=new Oe,Jt=Ee(null,{next:{value:function(){const e=Qe(We,this);return Ze(e)}},[J]:{value:function(){return this}}});function Qt(r){if(r[J]===He&&Z.next===Ze)return r;const e=Ee(Jt);return Zt(We,e,qt(r)),e}const Wt=new Oe,er=Ee(Yt,{next:{value:function(){const e=Qe(Wt,this);return Ht(e)},writable:!0,configurable:!0}});for(const r of Ut(Z))r!=="next"&&Lt(er,r,je(Z,r));const et=new Ye(4),tr=new jt(et),rr=new Pe(et),R=new Xe(512),B=new Vt(512);for(let r=0;r<256;++r){const e=r-127;e<-24?(R[r]=0,R[r|256]=32768,B[r]=24,B[r|256]=24):e<-14?(R[r]=1024>>-e-14,R[r|256]=1024>>-e-14|32768,B[r]=-e-1,B[r|256]=-e-1):e<=15?(R[r]=e+15<<10,R[r|256]=e+15<<10|32768,B[r]=13,B[r|256]=13):e<128?(R[r]=31744,R[r|256]=64512,B[r]=24,B[r|256]=24):(R[r]=31744,R[r|256]=64512,B[r]=13,B[r|256]=13)}const Ce=new Pe(2048);for(let r=1;r<1024;++r){let e=r<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Ce[r]=e|t}for(let r=1024;r<2048;++r)Ce[r]=939524096+(r-1024<<13);const z=new Pe(64);for(let r=1;r<31;++r)z[r]=r<<23;z[31]=1199570944;z[32]=2147483648;for(let r=33;r<63;++r)z[r]=2147483648+(r-32<<23);z[63]=3347054592;const tt=new Xe(64);for(let r=1;r<64;++r)r!==32&&(tt[r]=1024);function sr(r){const e=r>>10;return rr[0]=Ce[tt[e]+(r&1023)]+z[e],tr[0]}function rt(r,e,...t){return sr(Xt(r,e,...Qt(t)))}var ne={exports:{}},Ue;function ir(){if(Ue)return ne.exports;Ue=1;function r(e,t,s){const i=s&&s.debug||!1;i&&console.log("[xml-utils] getting "+t+" in "+e);const n=typeof e=="object"?e.outer:e,a=n.slice(0,n.indexOf(">")+1),o=['"',"'"];for(let l=0;l<o.length;l++){const c=o[l],f=t+"\\="+c+"([^"+c+"]*)"+c;i&&console.log("[xml-utils] pattern:",f);const u=new RegExp(f).exec(a);if(i&&console.log("[xml-utils] match:",u),u)return u[1]}}return ne.exports=r,ne.exports.default=r,ne.exports}var nr=ir();const Se=Ve.getDefaultExportFromCjs(nr);var oe={exports:{}},ae={exports:{}},le={exports:{}},_e;function or(){if(_e)return le.exports;_e=1;function r(e,t,s){const n=new RegExp(t).exec(e.slice(s));return n?s+n.index:-1}return le.exports=r,le.exports.default=r,le.exports}var ce={exports:{}},ve;function ar(){if(ve)return ce.exports;ve=1;function r(e,t,s){const n=new RegExp(t).exec(e.slice(s));return n?s+n.index+n[0].length-1:-1}return ce.exports=r,ce.exports.default=r,ce.exports}var fe={exports:{}},Le;function lr(){if(Le)return fe.exports;Le=1;function r(e,t){const s=new RegExp(t,"g"),i=e.match(s);return i?i.length:0}return fe.exports=r,fe.exports.default=r,fe.exports}var Ne;function cr(){if(Ne)return ae.exports;Ne=1;const r=or(),e=ar(),t=lr();function s(i,n,a){const o=a&&a.debug||!1,l=!(a&&typeof a.nested===!1),c=a&&a.startIndex||0;o&&console.log("[xml-utils] starting findTagByName with",n," and ",a);const f=r(i,`<${n}[
1
+ "use strict";const Ve=require("./ControlGrid-BHj06tuI.cjs"),L={};function T(r){return(e,...t)=>Gt(r,e,t)}function q(r,e){return T(je(r,e).get)}const{apply:Gt,getOwnPropertyDescriptor:je,getPrototypeOf:De,ownKeys:Ut}=Reflect,{iterator:J,toStringTag:_t}=Symbol,vt=Object,{create:Ee,defineProperty:Lt}=vt,Nt=Array,Kt=Nt.prototype,He=Kt[J],qt=T(He),Ye=ArrayBuffer,zt=Ye.prototype;q(zt,"byteLength");const Ge=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;Ge&&q(Ge.prototype,"byteLength");const $e=De(Uint8Array);$e.from;const E=$e.prototype;E[J];T(E.keys);T(E.values);T(E.entries);T(E.set);T(E.reverse);T(E.fill);T(E.copyWithin);T(E.sort);T(E.slice);T(E.subarray);q(E,"buffer");q(E,"byteOffset");q(E,"length");q(E,_t);const Vt=Uint8Array,Xe=Uint16Array,Pe=Uint32Array,jt=Float32Array,Z=De([][J]()),Ze=T(Z.next),Ht=T((function*(){})().next),Yt=De(Z),$t=DataView.prototype,Xt=T($t.getUint16),Oe=WeakMap,Je=Oe.prototype,Qe=T(Je.get),Zt=T(Je.set),We=new Oe,Jt=Ee(null,{next:{value:function(){const e=Qe(We,this);return Ze(e)}},[J]:{value:function(){return this}}});function Qt(r){if(r[J]===He&&Z.next===Ze)return r;const e=Ee(Jt);return Zt(We,e,qt(r)),e}const Wt=new Oe,er=Ee(Yt,{next:{value:function(){const e=Qe(Wt,this);return Ht(e)},writable:!0,configurable:!0}});for(const r of Ut(Z))r!=="next"&&Lt(er,r,je(Z,r));const et=new Ye(4),tr=new jt(et),rr=new Pe(et),R=new Xe(512),B=new Vt(512);for(let r=0;r<256;++r){const e=r-127;e<-24?(R[r]=0,R[r|256]=32768,B[r]=24,B[r|256]=24):e<-14?(R[r]=1024>>-e-14,R[r|256]=1024>>-e-14|32768,B[r]=-e-1,B[r|256]=-e-1):e<=15?(R[r]=e+15<<10,R[r|256]=e+15<<10|32768,B[r]=13,B[r|256]=13):e<128?(R[r]=31744,R[r|256]=64512,B[r]=24,B[r|256]=24):(R[r]=31744,R[r|256]=64512,B[r]=13,B[r|256]=13)}const Ce=new Pe(2048);for(let r=1;r<1024;++r){let e=r<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Ce[r]=e|t}for(let r=1024;r<2048;++r)Ce[r]=939524096+(r-1024<<13);const z=new Pe(64);for(let r=1;r<31;++r)z[r]=r<<23;z[31]=1199570944;z[32]=2147483648;for(let r=33;r<63;++r)z[r]=2147483648+(r-32<<23);z[63]=3347054592;const tt=new Xe(64);for(let r=1;r<64;++r)r!==32&&(tt[r]=1024);function sr(r){const e=r>>10;return rr[0]=Ce[tt[e]+(r&1023)]+z[e],tr[0]}function rt(r,e,...t){return sr(Xt(r,e,...Qt(t)))}var ne={exports:{}},Ue;function ir(){if(Ue)return ne.exports;Ue=1;function r(e,t,s){const i=s&&s.debug||!1;i&&console.log("[xml-utils] getting "+t+" in "+e);const n=typeof e=="object"?e.outer:e,a=n.slice(0,n.indexOf(">")+1),o=['"',"'"];for(let l=0;l<o.length;l++){const c=o[l],f=t+"\\="+c+"([^"+c+"]*)"+c;i&&console.log("[xml-utils] pattern:",f);const u=new RegExp(f).exec(a);if(i&&console.log("[xml-utils] match:",u),u)return u[1]}}return ne.exports=r,ne.exports.default=r,ne.exports}var nr=ir();const Se=Ve.getDefaultExportFromCjs(nr);var oe={exports:{}},ae={exports:{}},le={exports:{}},_e;function or(){if(_e)return le.exports;_e=1;function r(e,t,s){const n=new RegExp(t).exec(e.slice(s));return n?s+n.index:-1}return le.exports=r,le.exports.default=r,le.exports}var ce={exports:{}},ve;function ar(){if(ve)return ce.exports;ve=1;function r(e,t,s){const n=new RegExp(t).exec(e.slice(s));return n?s+n.index+n[0].length-1:-1}return ce.exports=r,ce.exports.default=r,ce.exports}var fe={exports:{}},Le;function lr(){if(Le)return fe.exports;Le=1;function r(e,t){const s=new RegExp(t,"g"),i=e.match(s);return i?i.length:0}return fe.exports=r,fe.exports.default=r,fe.exports}var Ne;function cr(){if(Ne)return ae.exports;Ne=1;const r=or(),e=ar(),t=lr();function s(i,n,a){const o=a&&a.debug||!1,l=!(a&&typeof a.nested===!1),c=a&&a.startIndex||0;o&&console.log("[xml-utils] starting findTagByName with",n," and ",a);const f=r(i,`<${n}[
2
2
  >/]`,c);if(o&&console.log("[xml-utils] start:",f),f===-1)return;const h=i.slice(f+n.length);let u=e(h,"^[^<]*[ /]>",0);const d=u!==-1&&h[u-1]==="/";if(o&&console.log("[xml-utils] selfClosing:",d),d===!1)if(l){let x=0,w=1,S=0;for(;(u=e(h,"[ /]"+n+">",x))!==-1;){const I=h.substring(x,u+1);if(w+=t(I,"<"+n+`[
3
- >]`),S+=t(I,"</"+n+">"),S>=w)break;x=u}}else u=e(h,"[ /]"+n+">",0);const g=f+n.length+u+1;if(o&&console.log("[xml-utils] end:",g),g===-1)return;const y=i.slice(f,g);let p;return d?p=null:p=y.slice(y.indexOf(">")+1,y.lastIndexOf("<")),{inner:p,outer:y,start:f,end:g}}return ae.exports=s,ae.exports.default=s,ae.exports}var Ke;function fr(){if(Ke)return oe.exports;Ke=1;const r=cr();function e(t,s,i){const n=[],a=i&&i.debug||!1,o=i&&typeof i.nested=="boolean"?i.nested:!0;let l=i&&i.startIndex||0,c;for(;c=r(t,s,{debug:a,startIndex:l});)o?l=c.start+1+s.length:l=c.end,n.push(c);return a&&console.log("findTagsByName found",n.length,"tags"),n}return oe.exports=e,oe.exports.default=e,oe.exports}var hr=fr();const ur=Ve.getDefaultExportFromCjs(hr),U={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},F={};for(const r in U)U.hasOwnProperty(r)&&(F[U[r]]=parseInt(r,10));const ge={256:"SHORT",257:"SHORT",258:"SHORT",259:"SHORT",262:"SHORT",273:"LONG",274:"SHORT",277:"SHORT",278:"LONG",279:"LONG",282:"RATIONAL",283:"RATIONAL",284:"SHORT",286:"SHORT",287:"RATIONAL",296:"SHORT",297:"SHORT",305:"ASCII",306:"ASCII",338:"SHORT",339:"SHORT",513:"LONG",514:"LONG",1024:"SHORT",1025:"SHORT",2048:"SHORT",2049:"ASCII",3072:"SHORT",3073:"ASCII",33550:"DOUBLE",33922:"DOUBLE",34264:"DOUBLE",34665:"LONG",34735:"SHORT",34736:"DOUBLE",34737:"ASCII",42113:"ASCII"},st=[F.BitsPerSample,F.ExtraSamples,F.SampleFormat,F.StripByteCounts,F.StripOffsets,F.StripRowCounts,F.TileByteCounts,F.TileOffsets,F.SubIFDs],X={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},m={};for(const r in X)X.hasOwnProperty(r)&&(m[X[r]]=parseInt(r,10));const O={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},it={Unspecified:0,Assocalpha:1,Unassalpha:2},nt={Version:0,AddCompression:1},ot={None:0,Deflate:1,Zstandard:2},N={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},at={};for(const r in N)N.hasOwnProperty(r)&&(at[N[r]]=parseInt(r,10));const gr=Object.freeze(Object.defineProperty({__proto__:null,ExtraSamplesValues:it,LercAddCompression:ot,LercParameters:nt,arrayFields:st,fieldTagNames:U,fieldTagTypes:ge,fieldTags:F,fieldTypeNames:X,fieldTypes:m,geoKeyNames:N,geoKeys:at,photometricInterpretations:O},Symbol.toStringTag,{value:"Module"}));function lt(r,e){const{width:t,height:s}=r,i=new Uint8Array(t*s*3);let n;for(let a=0,o=0;a<r.length;++a,o+=3)n=256-r[a]/e*256,i[o]=n,i[o+1]=n,i[o+2]=n;return i}function ct(r,e){const{width:t,height:s}=r,i=new Uint8Array(t*s*3);let n;for(let a=0,o=0;a<r.length;++a,o+=3)n=r[a]/e*256,i[o]=n,i[o+1]=n,i[o+2]=n;return i}function ft(r,e){const{width:t,height:s}=r,i=new Uint8Array(t*s*3),n=e.length/3,a=e.length/3*2;for(let o=0,l=0;o<r.length;++o,l+=3){const c=r[o];i[l]=e[c]/65536*256,i[l+1]=e[c+n]/65536*256,i[l+2]=e[c+a]/65536*256}return i}function ht(r){const{width:e,height:t}=r,s=new Uint8Array(e*t*3);for(let i=0,n=0;i<r.length;i+=4,n+=3){const a=r[i],o=r[i+1],l=r[i+2],c=r[i+3];s[n]=255*((255-a)/256)*((255-c)/256),s[n+1]=255*((255-o)/256)*((255-c)/256),s[n+2]=255*((255-l)/256)*((255-c)/256)}return s}function ut(r){const{width:e,height:t}=r,s=new Uint8ClampedArray(e*t*3);for(let i=0,n=0;i<r.length;i+=3,n+=3){const a=r[i],o=r[i+1],l=r[i+2];s[n]=a+1.402*(l-128),s[n+1]=a-.34414*(o-128)-.71414*(l-128),s[n+2]=a+1.772*(o-128)}return s}const dr=.95047,yr=1,pr=1.08883;function gt(r){const{width:e,height:t}=r,s=new Uint8Array(e*t*3);for(let i=0,n=0;i<r.length;i+=3,n+=3){const a=r[i+0],o=r[i+1]<<24>>24,l=r[i+2]<<24>>24;let c=(a+16)/116,f=o/500+c,h=c-l/200,u,d,g;f=dr*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),c=yr*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),h=pr*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),u=f*3.2406+c*-1.5372+h*-.4986,d=f*-.9689+c*1.8758+h*.0415,g=f*.0557+c*-.204+h*1.057,u=u>.0031308?1.055*u**(1/2.4)-.055:12.92*u,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,s[n]=Math.max(0,Math.min(1,u))*255,s[n+1]=Math.max(0,Math.min(1,d))*255,s[n+2]=Math.max(0,Math.min(1,g))*255}return s}const wr=Object.freeze(Object.defineProperty({__proto__:null,fromBlackIsZero:ct,fromCIELab:gt,fromCMYK:ht,fromPalette:ft,fromWhiteIsZero:lt,fromYCbCr:ut},Symbol.toStringTag,{value:"Module"})),dt=new Map;function G(r,e){Array.isArray(r)||(r=[r]),r.forEach(t=>dt.set(t,e))}async function Fe(r){const e=dt.get(r.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${r.Compression}`);const t=await e();return new t(r)}G([void 0,1],()=>Promise.resolve().then(()=>require("./raw-BOD2Kcq8.cjs")).then(r=>r.default));G(5,()=>Promise.resolve().then(()=>require("./lzw-BHeSwe4R.cjs")).then(r=>r.default));G(6,()=>{throw new Error("old style JPEG compression is not supported.")});G(7,()=>Promise.resolve().then(()=>require("./jpeg-Cr0iCWxG.cjs")).then(r=>r.default));G([8,32946],()=>Promise.resolve().then(()=>require("./deflate-Dj9xAuf-.cjs")).then(r=>r.default));G(32773,()=>Promise.resolve().then(()=>require("./packbits-C9seKA6S.cjs")).then(r=>r.default));G(34887,()=>Promise.resolve().then(()=>require("./lerc-Du5hw3rN.cjs")).then(async r=>(await r.zstd.init(),r)).then(r=>r.default));G(50001,()=>Promise.resolve().then(()=>require("./webimage-BaGAucPQ.cjs")).then(r=>r.default));function de(r,e,t,s=1){return new(Object.getPrototypeOf(r)).constructor(e*t*s)}function mr(r,e,t,s,i){const n=e/s,a=t/i;return r.map(o=>{const l=de(o,s,i);for(let c=0;c<i;++c){const f=Math.min(Math.round(a*c),t-1);for(let h=0;h<s;++h){const u=Math.min(Math.round(n*h),e-1),d=o[f*e+u];l[c*s+h]=d}}return l})}function K(r,e,t){return(1-t)*r+t*e}function xr(r,e,t,s,i){const n=e/s,a=t/i;return r.map(o=>{const l=de(o,s,i);for(let c=0;c<i;++c){const f=a*c,h=Math.floor(f),u=Math.min(Math.ceil(f),t-1);for(let d=0;d<s;++d){const g=n*d,y=g%1,p=Math.floor(g),x=Math.min(Math.ceil(g),e-1),w=o[h*e+p],S=o[h*e+x],I=o[u*e+p],b=o[u*e+x],P=K(K(w,S,y),K(I,b,y),f%1);l[c*s+d]=P}}return l})}function Sr(r,e,t,s,i,n="nearest"){switch(n.toLowerCase()){case"nearest":return mr(r,e,t,s,i);case"bilinear":case"linear":return xr(r,e,t,s,i);default:throw new Error(`Unsupported resampling method: '${n}'`)}}function Ir(r,e,t,s,i,n){const a=e/s,o=t/i,l=de(r,s,i,n);for(let c=0;c<i;++c){const f=Math.min(Math.round(o*c),t-1);for(let h=0;h<s;++h){const u=Math.min(Math.round(a*h),e-1);for(let d=0;d<n;++d){const g=r[f*e*n+u*n+d];l[c*s*n+h*n+d]=g}}}return l}function br(r,e,t,s,i,n){const a=e/s,o=t/i,l=de(r,s,i,n);for(let c=0;c<i;++c){const f=o*c,h=Math.floor(f),u=Math.min(Math.ceil(f),t-1);for(let d=0;d<s;++d){const g=a*d,y=g%1,p=Math.floor(g),x=Math.min(Math.ceil(g),e-1);for(let w=0;w<n;++w){const S=r[h*e*n+p*n+w],I=r[h*e*n+x*n+w],b=r[u*e*n+p*n+w],P=r[u*e*n+x*n+w],V=K(K(S,I,y),K(b,P,y),f%1);l[c*s*n+d*n+w]=V}}}return l}function Tr(r,e,t,s,i,n,a="nearest"){switch(a.toLowerCase()){case"nearest":return Ir(r,e,t,s,i,n);case"bilinear":case"linear":return br(r,e,t,s,i,n);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Ar(r,e,t){let s=0;for(let i=e;i<t;++i)s+=r[i];return s}function Ie(r,e,t){switch(r){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function Dr(r,e){return(r===1||r===2)&&e<=32&&e%8===0?!1:!(r===3&&(e===16||e===32||e===64))}function Er(r,e,t,s,i,n,a){const o=new DataView(r),l=t===2?a*n:a*n*s,c=t===2?1:s,f=Ie(e,i,l),h=parseInt("1".repeat(i),2);if(e===1){let u;t===1?u=s*i:u=i;let d=n*u;(d&7)!==0&&(d=d+7&-8);for(let g=0;g<a;++g){const y=g*d;for(let p=0;p<n;++p){const x=y+p*c*i;for(let w=0;w<c;++w){const S=x+w*i,I=(g*n+p)*c+w,b=Math.floor(S/8),P=S%8;if(P+i<=8)f[I]=o.getUint8(b)>>8-i-P&h;else if(P+i<=16)f[I]=o.getUint16(b)>>16-i-P&h;else if(P+i<=24){const V=o.getUint16(b)<<8|o.getUint8(b+2);f[I]=V>>24-i-P&h}else f[I]=o.getUint32(b)>>32-i-P&h}}}}return f.buffer}class ke{constructor(e,t,s,i,n,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=s,this.littleEndian=i,this.tiles=n?{}:null,this.isTiled=!e.StripOffsets;const o=e.PlanarConfiguration;if(this.planarConfiguration=typeof o>"u"?1:o,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=a}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,s=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(s<=8)return DataView.prototype.getUint8;if(s<=16)return DataView.prototype.getUint16;if(s<=32)return DataView.prototype.getUint32;break;case 2:if(s<=8)return DataView.prototype.getInt8;if(s<=16)return DataView.prototype.getInt16;if(s<=32)return DataView.prototype.getInt32;break;case 3:switch(s){case 16:return function(i,n){return rt(this,i,n)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const s=this.getSampleFormat(e),i=this.getBitsPerSample(e);return Ie(s,i,t)}async getTileOrStrip(e,t,s,i,n){const a=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let l;const{tiles:c}=this;this.planarConfiguration===1?l=t*a+e:this.planarConfiguration===2&&(l=s*a*o+t*a+e);let f,h;this.isTiled?(f=this.fileDirectory.TileOffsets[l],h=this.fileDirectory.TileByteCounts[l]):(f=this.fileDirectory.StripOffsets[l],h=this.fileDirectory.StripByteCounts[l]);const u=(await this.source.fetch([{offset:f,length:h}],n))[0];let d;return c===null||!c[l]?(d=(async()=>{let g=await i.decode(this.fileDirectory,u);const y=this.getSampleFormat(),p=this.getBitsPerSample();return Dr(y,p)&&(g=Er(g,y,this.planarConfiguration,this.getSamplesPerPixel(),p,this.getTileWidth(),this.getBlockHeight(t))),g})(),c!==null&&(c[l]=d)):d=c[l],{x:e,y:t,sample:s,data:await d}}async _readRaster(e,t,s,i,n,a,o,l,c){const f=this.getTileWidth(),h=this.getTileHeight(),u=this.getWidth(),d=this.getHeight(),g=Math.max(Math.floor(e[0]/f),0),y=Math.min(Math.ceil(e[2]/f),Math.ceil(u/f)),p=Math.max(Math.floor(e[1]/h),0),x=Math.min(Math.ceil(e[3]/h),Math.ceil(d/h)),w=e[2]-e[0];let S=this.getBytesPerPixel();const I=[],b=[];for(let D=0;D<t.length;++D)this.planarConfiguration===1?I.push(Ar(this.fileDirectory.BitsPerSample,0,t[D])/8):I.push(0),b.push(this.getReaderForSample(t[D]));const P=[],{littleEndian:V}=this;for(let D=p;D<x;++D)for(let ee=g;ee<y;++ee){let me;this.planarConfiguration===1&&(me=this.getTileOrStrip(ee,D,0,n,c));for(let te=0;te<t.length;++te){const re=te,Be=t[te];this.planarConfiguration===2&&(S=this.getSampleByteSize(Be),me=this.getTileOrStrip(ee,D,Be,n,c));const Et=me.then(j=>{const Pt=j.data,Ot=new DataView(Pt),xe=this.getBlockHeight(j.y),H=j.y*h,se=j.x*f,Ct=H+xe,Ft=(j.x+1)*f,kt=b[re],Rt=Math.min(xe,xe-(Ct-e[3]),d-H),Bt=Math.min(f,f-(Ft-e[2]),u-se);for(let Y=Math.max(0,e[1]-H);Y<Rt;++Y)for(let $=Math.max(0,e[0]-se);$<Bt;++$){const Mt=(Y*f+$)*S,Me=kt.call(Ot,Mt+I[re],V);let ie;i?(ie=(Y+H-e[1])*w*t.length+($+se-e[0])*t.length+re,s[ie]=Me):(ie=(Y+H-e[1])*w+$+se-e[0],s[re][ie]=Me)}});P.push(Et)}}if(await Promise.all(P),a&&e[2]-e[0]!==a||o&&e[3]-e[1]!==o){let D;return i?D=Tr(s,e[2]-e[0],e[3]-e[1],a,o,t.length,l):D=Sr(s,e[2]-e[0],e[3]-e[1],a,o,l),D.width=a,D.height=o,D}return s.width=a||e[2]-e[0],s.height=o||e[3]-e[1],s}async readRasters({window:e,samples:t=[],interleave:s,pool:i=null,width:n,height:a,resampleMethod:o,fillValue:l,signal:c}={}){const f=e||[0,0,this.getWidth(),this.getHeight()];if(f[0]>f[2]||f[1]>f[3])throw new Error("Invalid subsets");const h=f[2]-f[0],u=f[3]-f[1],d=h*u,g=this.getSamplesPerPixel();if(!t||!t.length)for(let w=0;w<g;++w)t.push(w);else for(let w=0;w<t.length;++w)if(t[w]>=g)return Promise.reject(new RangeError(`Invalid sample index '${t[w]}'.`));let y;if(s){const w=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,S=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=Ie(w,S,d*t.length),l&&y.fill(l)}else{y=[];for(let w=0;w<t.length;++w){const S=this.getArrayForSample(t[w],d);Array.isArray(l)&&w<l.length?S.fill(l[w]):l&&!Array.isArray(l)&&S.fill(l),y.push(S)}}const p=i||await Fe(this.fileDirectory);return await this._readRaster(f,t,y,s,p,n,a,o,c)}async readRGB({window:e,interleave:t=!0,pool:s=null,width:i,height:n,resampleMethod:a,enableAlpha:o=!1,signal:l}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const f=this.fileDirectory.PhotometricInterpretation;if(f===O.RGB){let x=[0,1,2];if(this.fileDirectory.ExtraSamples!==it.Unspecified&&o){x=[];for(let w=0;w<this.fileDirectory.BitsPerSample.length;w+=1)x.push(w)}return this.readRasters({window:e,interleave:t,samples:x,pool:s,width:i,height:n,resampleMethod:a,signal:l})}let h;switch(f){case O.WhiteIsZero:case O.BlackIsZero:case O.Palette:h=[0];break;case O.CMYK:h=[0,1,2,3];break;case O.YCbCr:case O.CIELab:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const u={window:c,interleave:!0,samples:h,pool:s,width:i,height:n,resampleMethod:a,signal:l},{fileDirectory:d}=this,g=await this.readRasters(u),y=2**this.fileDirectory.BitsPerSample[0];let p;switch(f){case O.WhiteIsZero:p=lt(g,y);break;case O.BlackIsZero:p=ct(g,y);break;case O.Palette:p=ft(g,d.ColorMap);break;case O.CMYK:p=ht(g);break;case O.YCbCr:p=ut(g);break;case O.CIELab:p=gt(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const x=new Uint8Array(p.length/3),w=new Uint8Array(p.length/3),S=new Uint8Array(p.length/3);for(let I=0,b=0;I<p.length;I+=3,++b)x[b]=p[I],w[b]=p[I+1],S[b]=p[I+2];p=[x,w,S]}return p.width=g.width,p.height=g.height,p}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const s=this.fileDirectory.GDAL_METADATA;let i=ur(s,"Item");e===null?i=i.filter(n=>Se(n,"sample")===void 0):i=i.filter(n=>Number(Se(n,"sample"))===e);for(let n=0;n<i.length;++n){const a=i[n];t[Se(a,"name")]=a.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,s=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(s)return s[1]===0&&s[4]===0?[s[0],-s[5],s[10]]:[Math.sqrt(s[0]*s[0]+s[4]*s[4]),-Math.sqrt(s[1]*s[1]+s[5]*s[5]),s[10]];if(e){const[i,n,a]=e.getResolution();return[i*e.getWidth()/this.getWidth(),n*e.getHeight()/this.getHeight(),a*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const t=this.getHeight(),s=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,n,a,o,l,c,f,h]=this.fileDirectory.ModelTransformation,d=[[0,0],[0,t],[s,0],[s,t]].map(([p,x])=>[o+i*p+n*x,h+l*p+c*x]),g=d.map(p=>p[0]),y=d.map(p=>p[1]);return[Math.min(...g),Math.min(...y),Math.max(...g),Math.max(...y)]}else{const i=this.getOrigin(),n=this.getResolution(),a=i[0],o=i[1],l=a+n[0]*s,c=o+n[1]*t;return[Math.min(a,l),Math.min(o,c),Math.max(a,l),Math.max(o,c)]}}}class Pr{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const s=this.getUint32(e,t),i=this.getUint32(e+4,t);let n;if(t){if(n=s+2**32*i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*s+i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}getInt64(e,t){let s=0;const i=(this._dataView.getUint8(e+(t?7:0))&128)>0;let n=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(t?a:7-a));i&&(n?o!==0&&(o=~(o-1)&255,n=!1):o=~o&255),s+=o*256**a}return i&&(s=-s),s}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return rt(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Or{constructor(e,t,s,i){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=s,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),s=this.readUint32(e+4);let i;if(this._littleEndian){if(i=t+2**32*s,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*t+s,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let t=0;const s=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let n=0;n<8;n++){let a=this._dataView.getUint8(e+(this._littleEndian?n:7-n));s&&(i?a!==0&&(a=~(a-1)&255,i=!1):a=~a&255),t+=a*256**n}return s&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}const Cr=typeof navigator<"u"&&navigator.hardwareConcurrency||2;class yt{constructor(e=Cr,t){this.workers=null,this._awaitingDecoder=null,this.size=e,this.messageId=0,e&&(this._awaitingDecoder=t?Promise.resolve(t):new Promise(s=>{Promise.resolve().then(()=>require("./decoder-D9LU4bUo.cjs")).then(i=>{s(i.create)})}),this._awaitingDecoder.then(s=>{this._awaitingDecoder=null,this.workers=[];for(let i=0;i<e;i++)this.workers.push({worker:s(),idle:!0})}))}async decode(e,t){return this._awaitingDecoder&&await this._awaitingDecoder,this.size===0?Fe(e).then(s=>s.decode(e,t)):new Promise(s=>{const i=this.workers.find(o=>o.idle)||this.workers[Math.floor(Math.random()*this.size)];i.idle=!1;const n=this.messageId++,a=o=>{o.data.id===n&&(i.idle=!0,s(o.data.decoded),i.worker.removeEventListener("message",a))};i.worker.addEventListener("message",a),i.worker.postMessage({fileDirectory:e,buffer:t,id:n},[t])})}destroy(){this.workers&&(this.workers.forEach(e=>{e.worker.terminate()}),this.workers=null)}}const qe=`\r
3
+ >]`),S+=t(I,"</"+n+">"),S>=w)break;x=u}}else u=e(h,"[ /]"+n+">",0);const g=f+n.length+u+1;if(o&&console.log("[xml-utils] end:",g),g===-1)return;const y=i.slice(f,g);let p;return d?p=null:p=y.slice(y.indexOf(">")+1,y.lastIndexOf("<")),{inner:p,outer:y,start:f,end:g}}return ae.exports=s,ae.exports.default=s,ae.exports}var Ke;function fr(){if(Ke)return oe.exports;Ke=1;const r=cr();function e(t,s,i){const n=[],a=i&&i.debug||!1,o=i&&typeof i.nested=="boolean"?i.nested:!0;let l=i&&i.startIndex||0,c;for(;c=r(t,s,{debug:a,startIndex:l});)o?l=c.start+1+s.length:l=c.end,n.push(c);return a&&console.log("findTagsByName found",n.length,"tags"),n}return oe.exports=e,oe.exports.default=e,oe.exports}var hr=fr();const ur=Ve.getDefaultExportFromCjs(hr),U={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},F={};for(const r in U)U.hasOwnProperty(r)&&(F[U[r]]=parseInt(r,10));const ge={256:"SHORT",257:"SHORT",258:"SHORT",259:"SHORT",262:"SHORT",273:"LONG",274:"SHORT",277:"SHORT",278:"LONG",279:"LONG",282:"RATIONAL",283:"RATIONAL",284:"SHORT",286:"SHORT",287:"RATIONAL",296:"SHORT",297:"SHORT",305:"ASCII",306:"ASCII",338:"SHORT",339:"SHORT",513:"LONG",514:"LONG",1024:"SHORT",1025:"SHORT",2048:"SHORT",2049:"ASCII",3072:"SHORT",3073:"ASCII",33550:"DOUBLE",33922:"DOUBLE",34264:"DOUBLE",34665:"LONG",34735:"SHORT",34736:"DOUBLE",34737:"ASCII",42113:"ASCII"},st=[F.BitsPerSample,F.ExtraSamples,F.SampleFormat,F.StripByteCounts,F.StripOffsets,F.StripRowCounts,F.TileByteCounts,F.TileOffsets,F.SubIFDs],X={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},m={};for(const r in X)X.hasOwnProperty(r)&&(m[X[r]]=parseInt(r,10));const O={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},it={Unspecified:0,Assocalpha:1,Unassalpha:2},nt={Version:0,AddCompression:1},ot={None:0,Deflate:1,Zstandard:2},N={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},at={};for(const r in N)N.hasOwnProperty(r)&&(at[N[r]]=parseInt(r,10));const gr=Object.freeze(Object.defineProperty({__proto__:null,ExtraSamplesValues:it,LercAddCompression:ot,LercParameters:nt,arrayFields:st,fieldTagNames:U,fieldTagTypes:ge,fieldTags:F,fieldTypeNames:X,fieldTypes:m,geoKeyNames:N,geoKeys:at,photometricInterpretations:O},Symbol.toStringTag,{value:"Module"}));function lt(r,e){const{width:t,height:s}=r,i=new Uint8Array(t*s*3);let n;for(let a=0,o=0;a<r.length;++a,o+=3)n=256-r[a]/e*256,i[o]=n,i[o+1]=n,i[o+2]=n;return i}function ct(r,e){const{width:t,height:s}=r,i=new Uint8Array(t*s*3);let n;for(let a=0,o=0;a<r.length;++a,o+=3)n=r[a]/e*256,i[o]=n,i[o+1]=n,i[o+2]=n;return i}function ft(r,e){const{width:t,height:s}=r,i=new Uint8Array(t*s*3),n=e.length/3,a=e.length/3*2;for(let o=0,l=0;o<r.length;++o,l+=3){const c=r[o];i[l]=e[c]/65536*256,i[l+1]=e[c+n]/65536*256,i[l+2]=e[c+a]/65536*256}return i}function ht(r){const{width:e,height:t}=r,s=new Uint8Array(e*t*3);for(let i=0,n=0;i<r.length;i+=4,n+=3){const a=r[i],o=r[i+1],l=r[i+2],c=r[i+3];s[n]=255*((255-a)/256)*((255-c)/256),s[n+1]=255*((255-o)/256)*((255-c)/256),s[n+2]=255*((255-l)/256)*((255-c)/256)}return s}function ut(r){const{width:e,height:t}=r,s=new Uint8ClampedArray(e*t*3);for(let i=0,n=0;i<r.length;i+=3,n+=3){const a=r[i],o=r[i+1],l=r[i+2];s[n]=a+1.402*(l-128),s[n+1]=a-.34414*(o-128)-.71414*(l-128),s[n+2]=a+1.772*(o-128)}return s}const dr=.95047,yr=1,pr=1.08883;function gt(r){const{width:e,height:t}=r,s=new Uint8Array(e*t*3);for(let i=0,n=0;i<r.length;i+=3,n+=3){const a=r[i+0],o=r[i+1]<<24>>24,l=r[i+2]<<24>>24;let c=(a+16)/116,f=o/500+c,h=c-l/200,u,d,g;f=dr*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),c=yr*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),h=pr*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),u=f*3.2406+c*-1.5372+h*-.4986,d=f*-.9689+c*1.8758+h*.0415,g=f*.0557+c*-.204+h*1.057,u=u>.0031308?1.055*u**(1/2.4)-.055:12.92*u,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,s[n]=Math.max(0,Math.min(1,u))*255,s[n+1]=Math.max(0,Math.min(1,d))*255,s[n+2]=Math.max(0,Math.min(1,g))*255}return s}const wr=Object.freeze(Object.defineProperty({__proto__:null,fromBlackIsZero:ct,fromCIELab:gt,fromCMYK:ht,fromPalette:ft,fromWhiteIsZero:lt,fromYCbCr:ut},Symbol.toStringTag,{value:"Module"})),dt=new Map;function G(r,e){Array.isArray(r)||(r=[r]),r.forEach(t=>dt.set(t,e))}async function Fe(r){const e=dt.get(r.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${r.Compression}`);const t=await e();return new t(r)}G([void 0,1],()=>Promise.resolve().then(()=>require("./raw-Ady0oBU-.cjs")).then(r=>r.default));G(5,()=>Promise.resolve().then(()=>require("./lzw-1pa4hURZ.cjs")).then(r=>r.default));G(6,()=>{throw new Error("old style JPEG compression is not supported.")});G(7,()=>Promise.resolve().then(()=>require("./jpeg-K5f1PGmj.cjs")).then(r=>r.default));G([8,32946],()=>Promise.resolve().then(()=>require("./deflate-Buv4KFPQ.cjs")).then(r=>r.default));G(32773,()=>Promise.resolve().then(()=>require("./packbits-D8NpPMS2.cjs")).then(r=>r.default));G(34887,()=>Promise.resolve().then(()=>require("./lerc-DBi1jyo4.cjs")).then(async r=>(await r.zstd.init(),r)).then(r=>r.default));G(50001,()=>Promise.resolve().then(()=>require("./webimage-CI-Xhwi8.cjs")).then(r=>r.default));function de(r,e,t,s=1){return new(Object.getPrototypeOf(r)).constructor(e*t*s)}function mr(r,e,t,s,i){const n=e/s,a=t/i;return r.map(o=>{const l=de(o,s,i);for(let c=0;c<i;++c){const f=Math.min(Math.round(a*c),t-1);for(let h=0;h<s;++h){const u=Math.min(Math.round(n*h),e-1),d=o[f*e+u];l[c*s+h]=d}}return l})}function K(r,e,t){return(1-t)*r+t*e}function xr(r,e,t,s,i){const n=e/s,a=t/i;return r.map(o=>{const l=de(o,s,i);for(let c=0;c<i;++c){const f=a*c,h=Math.floor(f),u=Math.min(Math.ceil(f),t-1);for(let d=0;d<s;++d){const g=n*d,y=g%1,p=Math.floor(g),x=Math.min(Math.ceil(g),e-1),w=o[h*e+p],S=o[h*e+x],I=o[u*e+p],b=o[u*e+x],P=K(K(w,S,y),K(I,b,y),f%1);l[c*s+d]=P}}return l})}function Sr(r,e,t,s,i,n="nearest"){switch(n.toLowerCase()){case"nearest":return mr(r,e,t,s,i);case"bilinear":case"linear":return xr(r,e,t,s,i);default:throw new Error(`Unsupported resampling method: '${n}'`)}}function Ir(r,e,t,s,i,n){const a=e/s,o=t/i,l=de(r,s,i,n);for(let c=0;c<i;++c){const f=Math.min(Math.round(o*c),t-1);for(let h=0;h<s;++h){const u=Math.min(Math.round(a*h),e-1);for(let d=0;d<n;++d){const g=r[f*e*n+u*n+d];l[c*s*n+h*n+d]=g}}}return l}function br(r,e,t,s,i,n){const a=e/s,o=t/i,l=de(r,s,i,n);for(let c=0;c<i;++c){const f=o*c,h=Math.floor(f),u=Math.min(Math.ceil(f),t-1);for(let d=0;d<s;++d){const g=a*d,y=g%1,p=Math.floor(g),x=Math.min(Math.ceil(g),e-1);for(let w=0;w<n;++w){const S=r[h*e*n+p*n+w],I=r[h*e*n+x*n+w],b=r[u*e*n+p*n+w],P=r[u*e*n+x*n+w],V=K(K(S,I,y),K(b,P,y),f%1);l[c*s*n+d*n+w]=V}}}return l}function Tr(r,e,t,s,i,n,a="nearest"){switch(a.toLowerCase()){case"nearest":return Ir(r,e,t,s,i,n);case"bilinear":case"linear":return br(r,e,t,s,i,n);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Ar(r,e,t){let s=0;for(let i=e;i<t;++i)s+=r[i];return s}function Ie(r,e,t){switch(r){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function Dr(r,e){return(r===1||r===2)&&e<=32&&e%8===0?!1:!(r===3&&(e===16||e===32||e===64))}function Er(r,e,t,s,i,n,a){const o=new DataView(r),l=t===2?a*n:a*n*s,c=t===2?1:s,f=Ie(e,i,l),h=parseInt("1".repeat(i),2);if(e===1){let u;t===1?u=s*i:u=i;let d=n*u;(d&7)!==0&&(d=d+7&-8);for(let g=0;g<a;++g){const y=g*d;for(let p=0;p<n;++p){const x=y+p*c*i;for(let w=0;w<c;++w){const S=x+w*i,I=(g*n+p)*c+w,b=Math.floor(S/8),P=S%8;if(P+i<=8)f[I]=o.getUint8(b)>>8-i-P&h;else if(P+i<=16)f[I]=o.getUint16(b)>>16-i-P&h;else if(P+i<=24){const V=o.getUint16(b)<<8|o.getUint8(b+2);f[I]=V>>24-i-P&h}else f[I]=o.getUint32(b)>>32-i-P&h}}}}return f.buffer}class ke{constructor(e,t,s,i,n,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=s,this.littleEndian=i,this.tiles=n?{}:null,this.isTiled=!e.StripOffsets;const o=e.PlanarConfiguration;if(this.planarConfiguration=typeof o>"u"?1:o,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=a}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,s=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(s<=8)return DataView.prototype.getUint8;if(s<=16)return DataView.prototype.getUint16;if(s<=32)return DataView.prototype.getUint32;break;case 2:if(s<=8)return DataView.prototype.getInt8;if(s<=16)return DataView.prototype.getInt16;if(s<=32)return DataView.prototype.getInt32;break;case 3:switch(s){case 16:return function(i,n){return rt(this,i,n)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const s=this.getSampleFormat(e),i=this.getBitsPerSample(e);return Ie(s,i,t)}async getTileOrStrip(e,t,s,i,n){const a=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let l;const{tiles:c}=this;this.planarConfiguration===1?l=t*a+e:this.planarConfiguration===2&&(l=s*a*o+t*a+e);let f,h;this.isTiled?(f=this.fileDirectory.TileOffsets[l],h=this.fileDirectory.TileByteCounts[l]):(f=this.fileDirectory.StripOffsets[l],h=this.fileDirectory.StripByteCounts[l]);const u=(await this.source.fetch([{offset:f,length:h}],n))[0];let d;return c===null||!c[l]?(d=(async()=>{let g=await i.decode(this.fileDirectory,u);const y=this.getSampleFormat(),p=this.getBitsPerSample();return Dr(y,p)&&(g=Er(g,y,this.planarConfiguration,this.getSamplesPerPixel(),p,this.getTileWidth(),this.getBlockHeight(t))),g})(),c!==null&&(c[l]=d)):d=c[l],{x:e,y:t,sample:s,data:await d}}async _readRaster(e,t,s,i,n,a,o,l,c){const f=this.getTileWidth(),h=this.getTileHeight(),u=this.getWidth(),d=this.getHeight(),g=Math.max(Math.floor(e[0]/f),0),y=Math.min(Math.ceil(e[2]/f),Math.ceil(u/f)),p=Math.max(Math.floor(e[1]/h),0),x=Math.min(Math.ceil(e[3]/h),Math.ceil(d/h)),w=e[2]-e[0];let S=this.getBytesPerPixel();const I=[],b=[];for(let D=0;D<t.length;++D)this.planarConfiguration===1?I.push(Ar(this.fileDirectory.BitsPerSample,0,t[D])/8):I.push(0),b.push(this.getReaderForSample(t[D]));const P=[],{littleEndian:V}=this;for(let D=p;D<x;++D)for(let ee=g;ee<y;++ee){let me;this.planarConfiguration===1&&(me=this.getTileOrStrip(ee,D,0,n,c));for(let te=0;te<t.length;++te){const re=te,Be=t[te];this.planarConfiguration===2&&(S=this.getSampleByteSize(Be),me=this.getTileOrStrip(ee,D,Be,n,c));const Et=me.then(j=>{const Pt=j.data,Ot=new DataView(Pt),xe=this.getBlockHeight(j.y),H=j.y*h,se=j.x*f,Ct=H+xe,Ft=(j.x+1)*f,kt=b[re],Rt=Math.min(xe,xe-(Ct-e[3]),d-H),Bt=Math.min(f,f-(Ft-e[2]),u-se);for(let Y=Math.max(0,e[1]-H);Y<Rt;++Y)for(let $=Math.max(0,e[0]-se);$<Bt;++$){const Mt=(Y*f+$)*S,Me=kt.call(Ot,Mt+I[re],V);let ie;i?(ie=(Y+H-e[1])*w*t.length+($+se-e[0])*t.length+re,s[ie]=Me):(ie=(Y+H-e[1])*w+$+se-e[0],s[re][ie]=Me)}});P.push(Et)}}if(await Promise.all(P),a&&e[2]-e[0]!==a||o&&e[3]-e[1]!==o){let D;return i?D=Tr(s,e[2]-e[0],e[3]-e[1],a,o,t.length,l):D=Sr(s,e[2]-e[0],e[3]-e[1],a,o,l),D.width=a,D.height=o,D}return s.width=a||e[2]-e[0],s.height=o||e[3]-e[1],s}async readRasters({window:e,samples:t=[],interleave:s,pool:i=null,width:n,height:a,resampleMethod:o,fillValue:l,signal:c}={}){const f=e||[0,0,this.getWidth(),this.getHeight()];if(f[0]>f[2]||f[1]>f[3])throw new Error("Invalid subsets");const h=f[2]-f[0],u=f[3]-f[1],d=h*u,g=this.getSamplesPerPixel();if(!t||!t.length)for(let w=0;w<g;++w)t.push(w);else for(let w=0;w<t.length;++w)if(t[w]>=g)return Promise.reject(new RangeError(`Invalid sample index '${t[w]}'.`));let y;if(s){const w=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,S=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=Ie(w,S,d*t.length),l&&y.fill(l)}else{y=[];for(let w=0;w<t.length;++w){const S=this.getArrayForSample(t[w],d);Array.isArray(l)&&w<l.length?S.fill(l[w]):l&&!Array.isArray(l)&&S.fill(l),y.push(S)}}const p=i||await Fe(this.fileDirectory);return await this._readRaster(f,t,y,s,p,n,a,o,c)}async readRGB({window:e,interleave:t=!0,pool:s=null,width:i,height:n,resampleMethod:a,enableAlpha:o=!1,signal:l}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const f=this.fileDirectory.PhotometricInterpretation;if(f===O.RGB){let x=[0,1,2];if(this.fileDirectory.ExtraSamples!==it.Unspecified&&o){x=[];for(let w=0;w<this.fileDirectory.BitsPerSample.length;w+=1)x.push(w)}return this.readRasters({window:e,interleave:t,samples:x,pool:s,width:i,height:n,resampleMethod:a,signal:l})}let h;switch(f){case O.WhiteIsZero:case O.BlackIsZero:case O.Palette:h=[0];break;case O.CMYK:h=[0,1,2,3];break;case O.YCbCr:case O.CIELab:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const u={window:c,interleave:!0,samples:h,pool:s,width:i,height:n,resampleMethod:a,signal:l},{fileDirectory:d}=this,g=await this.readRasters(u),y=2**this.fileDirectory.BitsPerSample[0];let p;switch(f){case O.WhiteIsZero:p=lt(g,y);break;case O.BlackIsZero:p=ct(g,y);break;case O.Palette:p=ft(g,d.ColorMap);break;case O.CMYK:p=ht(g);break;case O.YCbCr:p=ut(g);break;case O.CIELab:p=gt(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const x=new Uint8Array(p.length/3),w=new Uint8Array(p.length/3),S=new Uint8Array(p.length/3);for(let I=0,b=0;I<p.length;I+=3,++b)x[b]=p[I],w[b]=p[I+1],S[b]=p[I+2];p=[x,w,S]}return p.width=g.width,p.height=g.height,p}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const s=this.fileDirectory.GDAL_METADATA;let i=ur(s,"Item");e===null?i=i.filter(n=>Se(n,"sample")===void 0):i=i.filter(n=>Number(Se(n,"sample"))===e);for(let n=0;n<i.length;++n){const a=i[n];t[Se(a,"name")]=a.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,s=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(s)return s[1]===0&&s[4]===0?[s[0],-s[5],s[10]]:[Math.sqrt(s[0]*s[0]+s[4]*s[4]),-Math.sqrt(s[1]*s[1]+s[5]*s[5]),s[10]];if(e){const[i,n,a]=e.getResolution();return[i*e.getWidth()/this.getWidth(),n*e.getHeight()/this.getHeight(),a*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const t=this.getHeight(),s=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,n,a,o,l,c,f,h]=this.fileDirectory.ModelTransformation,d=[[0,0],[0,t],[s,0],[s,t]].map(([p,x])=>[o+i*p+n*x,h+l*p+c*x]),g=d.map(p=>p[0]),y=d.map(p=>p[1]);return[Math.min(...g),Math.min(...y),Math.max(...g),Math.max(...y)]}else{const i=this.getOrigin(),n=this.getResolution(),a=i[0],o=i[1],l=a+n[0]*s,c=o+n[1]*t;return[Math.min(a,l),Math.min(o,c),Math.max(a,l),Math.max(o,c)]}}}class Pr{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const s=this.getUint32(e,t),i=this.getUint32(e+4,t);let n;if(t){if(n=s+2**32*i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*s+i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}getInt64(e,t){let s=0;const i=(this._dataView.getUint8(e+(t?7:0))&128)>0;let n=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(t?a:7-a));i&&(n?o!==0&&(o=~(o-1)&255,n=!1):o=~o&255),s+=o*256**a}return i&&(s=-s),s}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return rt(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Or{constructor(e,t,s,i){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=s,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),s=this.readUint32(e+4);let i;if(this._littleEndian){if(i=t+2**32*s,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*t+s,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let t=0;const s=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let n=0;n<8;n++){let a=this._dataView.getUint8(e+(this._littleEndian?n:7-n));s&&(i?a!==0&&(a=~(a-1)&255,i=!1):a=~a&255),t+=a*256**n}return s&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}const Cr=typeof navigator<"u"&&navigator.hardwareConcurrency||2;class yt{constructor(e=Cr,t){this.workers=null,this._awaitingDecoder=null,this.size=e,this.messageId=0,e&&(this._awaitingDecoder=t?Promise.resolve(t):new Promise(s=>{Promise.resolve().then(()=>require("./decoder-D9LU4bUo.cjs")).then(i=>{s(i.create)})}),this._awaitingDecoder.then(s=>{this._awaitingDecoder=null,this.workers=[];for(let i=0;i<e;i++)this.workers.push({worker:s(),idle:!0})}))}async decode(e,t){return this._awaitingDecoder&&await this._awaitingDecoder,this.size===0?Fe(e).then(s=>s.decode(e,t)):new Promise(s=>{const i=this.workers.find(o=>o.idle)||this.workers[Math.floor(Math.random()*this.size)];i.idle=!1;const n=this.messageId++,a=o=>{o.data.id===n&&(i.idle=!0,s(o.data.decoded),i.worker.removeEventListener("message",a))};i.worker.addEventListener("message",a),i.worker.postMessage({fileDirectory:e,buffer:t,id:n},[t])})}destroy(){this.workers&&(this.workers.forEach(e=>{e.worker.terminate()}),this.workers=null)}}const qe=`\r
4
4
  \r
5
5
  `;function pt(r){if(typeof Object.fromEntries<"u")return Object.fromEntries(r);const e={};for(const[t,s]of r)e[t.toLowerCase()]=s;return e}function Fr(r){const e=r.split(`\r
6
6
  `).map(t=>{const s=t.split(":").map(i=>i.trim());return s[0]=s[0].toLowerCase(),s});return pt(e)}function kr(r){const[e,...t]=r.split(";").map(i=>i.trim()),s=t.map(i=>i.split("="));return{type:e,params:pt(s)}}function be(r){let e,t,s;return r&&([,e,t,s]=r.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),t=parseInt(t,10),s=parseInt(s,10)),{start:e,end:t,total:s}}function Rr(r,e){let t=null;const s=new TextDecoder("ascii"),i=[],n=`--${e}`,a=`${n}--`;for(let o=0;o<10;++o)s.decode(new Uint8Array(r,o,n.length))===n&&(t=o);if(t===null)throw new Error("Could not find initial boundary");for(;t<r.byteLength;){const o=s.decode(new Uint8Array(r,t,Math.min(n.length+1024,r.byteLength-t)));if(o.length===0||o.startsWith(a))break;if(!o.startsWith(n))throw new Error("Part does not start with boundary");const l=o.substr(n.length+2);if(l.length===0)break;const c=l.indexOf(qe),f=Fr(l.substr(0,c)),{start:h,end:u,total:d}=be(f["content-range"]),g=t+n.length+c+qe.length,y=parseInt(u,10)+1-parseInt(h,10);i.push({headers:f,data:r.slice(g,g+y),offset:h,length:y,fileSize:d}),t=g+y+4}return i}class Q{async fetch(e,t=void 0){return Promise.all(e.map(s=>this.fetchSlice(s,t)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class Br extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge=="number"&&e.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction=="function")for(const[t,s]of e)this.onEviction(t,s.value)}_deleteIfExpired(e,t){return typeof t.expiry=="number"&&t.expiry<=Date.now()?(typeof this.onEviction=="function"&&this.onEviction(e,t.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,t){if(this._deleteIfExpired(e,t)===!1)return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const s=t.get(e);return this._getItemValue(e,s)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,s]=e;this.cache.has(t)||this._deleteIfExpired(t,s)===!1&&(yield e)}for(const e of this.cache){const[t,s]=e;this._deleteIfExpired(t,s)===!1&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(this._deleteIfExpired(e,t)===!1)return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:s=this.maxAge}={}){const i=typeof s=="number"&&s!==Number.POSITIVE_INFINITY?Date.now()+s:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:i}):this._set(e,{value:t,expiry:i}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],s=t.length-e;s<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(s>0&&this._emitEvictions(t.slice(0,s)),this.oldCache=new Map(t.slice(s)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,s]=e;this._deleteIfExpired(t,s)===!1&&(yield[t,s.value])}for(const e of this.oldCache){const[t,s]=e;this.cache.has(t)||this._deleteIfExpired(t,s)===!1&&(yield[t,s.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const s=e[t],[i,n]=s;this._deleteIfExpired(i,n)===!1&&(yield[i,n.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const s=e[t],[i,n]=s;this.cache.has(i)||this._deleteIfExpired(i,n)===!1&&(yield[i,n.value])}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[s,i]of this.entriesAscending())e.call(t,i,s,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}function wt(r,e){for(const t in e)e.hasOwnProperty(t)&&(r[t]=e[t])}function mt(r,e){return r.length<e.length?!1:r.substr(r.length-e.length)===e}function Mr(r,e){const{length:t}=r;for(let s=0;s<t;s++)e(r[s],s)}function Re(r){const e={};for(const t in r)if(r.hasOwnProperty(t)){const s=r[t];e[s]=t}return e}function C(r,e){const t=[];for(let s=0;s<r;s++)t.push(e(s));return t}async function Gr(r){return new Promise(e=>setTimeout(e,r))}function Ur(r,e){const t=Array.isArray(r)?r:Array.from(r),s=Array.isArray(e)?e:Array.from(e);return t.map((i,n)=>[i,s[n]])}class _ extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,_),this.name="AbortError"}}class _r extends Error{constructor(e,t){super(t),this.errors=e,this.message=t,this.name="AggregateError"}}const vr=_r;class Lr{constructor(e,t,s=null){this.offset=e,this.length=t,this.data=s}get top(){return this.offset+this.length}}class ze{constructor(e,t,s){this.offset=e,this.length=t,this.blockIds=s}}class Nr extends Q{constructor(e,{blockSize:t=65536,cacheSize:s=100}={}){super(),this.source=e,this.blockSize=t,this.blockCache=new Br({maxSize:s,onEviction:(i,n)=>{this.evictedBlocks.set(i,n)}}),this.evictedBlocks=new Map,this.blockRequests=new Map,this.blockIdsToFetch=new Set,this.abortedBlockIds=new Set}get fileSize(){return this.source.fileSize}async fetch(e,t){const s=[],i=[],n=[];this.evictedBlocks.clear();for(const{offset:u,length:d}of e){let g=u+d;const{fileSize:y}=this;y!==null&&(g=Math.min(g,y));const p=Math.floor(u/this.blockSize)*this.blockSize;for(let x=p;x<g;x+=this.blockSize){const w=Math.floor(x/this.blockSize);!this.blockCache.has(w)&&!this.blockRequests.has(w)&&(this.blockIdsToFetch.add(w),i.push(w)),this.blockRequests.has(w)&&s.push(this.blockRequests.get(w)),n.push(w)}}await Gr(),this.fetchBlocks(t);const a=[];for(const u of i)this.blockRequests.has(u)&&a.push(this.blockRequests.get(u));await Promise.allSettled(s),await Promise.allSettled(a);const o=[],l=n.filter(u=>this.abortedBlockIds.has(u)||!this.blockCache.has(u));if(l.forEach(u=>this.blockIdsToFetch.add(u)),l.length>0&&t&&!t.aborted){this.fetchBlocks(null);for(const u of l){const d=this.blockRequests.get(u);if(!d)throw new Error(`Block ${u} is not in the block requests`);o.push(d)}await Promise.allSettled(o)}if(t&&t.aborted)throw new _("Request was aborted");const c=n.map(u=>this.blockCache.get(u)||this.evictedBlocks.get(u)),f=c.filter(u=>!u);if(f.length)throw new vr(f,"Request failed");const h=new Map(Ur(n,c));return this.readSliceData(e,h)}fetchBlocks(e){if(this.blockIdsToFetch.size>0){const t=this.groupBlocks(this.blockIdsToFetch),s=this.source.fetch(t,e);for(let i=0;i<t.length;++i){const n=t[i];for(const a of n.blockIds)this.blockRequests.set(a,(async()=>{try{const o=(await s)[i],l=a*this.blockSize,c=l-o.offset,f=Math.min(c+this.blockSize,o.data.byteLength),h=o.data.slice(c,f),u=new Lr(l,h.byteLength,h,a);this.blockCache.set(a,u),this.abortedBlockIds.delete(a)}catch(o){if(o.name==="AbortError")o.signal=e,this.blockCache.delete(a),this.abortedBlockIds.add(a);else throw o}finally{this.blockRequests.delete(a)}})())}this.blockIdsToFetch.clear()}}groupBlocks(e){const t=Array.from(e).sort((a,o)=>a-o);if(t.length===0)return[];let s=[],i=null;const n=[];for(const a of t)i===null||i+1===a?(s.push(a),i=a):(n.push(new ze(s[0]*this.blockSize,s.length*this.blockSize,s)),s=[a],i=a);return n.push(new ze(s[0]*this.blockSize,s.length*this.blockSize,s)),n}readSliceData(e,t){return e.map(s=>{let i=s.offset+s.length;this.fileSize!==null&&(i=Math.min(this.fileSize,i));const n=Math.floor(s.offset/this.blockSize),a=Math.floor(i/this.blockSize),o=new ArrayBuffer(s.length),l=new Uint8Array(o);for(let c=n;c<=a;++c){const f=t.get(c),h=f.offset-s.offset,u=f.top-i;let d=0,g=0,y;h<0?d=-h:h>0&&(g=h),u<0?y=f.length-d:y=i-f.offset-d;const p=new Uint8Array(f.data,d,y);l.set(p,g)}return o})}}class ye{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(e){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class W{constructor(e){this.url=e}async request({headers:e,signal:t}={}){throw new Error("request is not implemented")}}class Kr extends ye{constructor(e){super(),this.response=e}get status(){return this.response.status}getHeader(e){return this.response.headers.get(e)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class qr extends W{constructor(e,t){super(e),this.credentials=t}async request({headers:e,signal:t}={}){const s=await fetch(this.url,{headers:e,credentials:this.credentials,signal:t});return new Kr(s)}}class zr extends ye{constructor(e,t){super(),this.xhr=e,this.data=t}get status(){return this.xhr.status}getHeader(e){return this.xhr.getResponseHeader(e)}async getData(){return this.data}}class Vr extends W{constructRequest(e,t){return new Promise((s,i)=>{const n=new XMLHttpRequest;n.open("GET",this.url),n.responseType="arraybuffer";for(const[a,o]of Object.entries(e))n.setRequestHeader(a,o);n.onload=()=>{const a=n.response;s(new zr(n,a))},n.onerror=i,n.onabort=()=>i(new _("Request aborted")),n.send(),t&&(t.aborted&&n.abort(),t.addEventListener("abort",()=>n.abort()))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}class jr extends ye{constructor(e,t){super(),this.response=e,this.dataPromise=t}get status(){return this.response.statusCode}getHeader(e){return this.response.headers[e]}async getData(){return await this.dataPromise}}class Hr extends W{constructor(e){super(e),this.parsedUrl=L.parse(this.url),this.httpApi=(this.parsedUrl.protocol==="http:",L)}constructRequest(e,t){return new Promise((s,i)=>{const n=this.httpApi.get({...this.parsedUrl,headers:e},a=>{const o=new Promise(l=>{const c=[];a.on("data",f=>{c.push(f)}),a.on("end",()=>{const f=Buffer.concat(c).buffer;l(f)}),a.on("error",i)});s(new jr(a,o))});n.on("error",i),t&&(t.aborted&&n.destroy(new _("Request aborted")),t.addEventListener("abort",()=>n.destroy(new _("Request aborted"))))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}class pe extends Q{constructor(e,t,s,i){super(),this.client=e,this.headers=t,this.maxRanges=s,this.allowFullFile=i,this._fileSize=null}async fetch(e,t){return this.maxRanges>=e.length?this.fetchSlices(e,t):(this.maxRanges>0&&e.length>1,Promise.all(e.map(s=>this.fetchSlice(s,t))))}async fetchSlices(e,t){const s=await this.client.request({headers:{...this.headers,Range:`bytes=${e.map(({offset:i,length:n})=>`${i}-${i+n}`).join(",")}`},signal:t});if(s.ok)if(s.status===206){const{type:i,params:n}=kr(s.getHeader("content-type"));if(i==="multipart/byteranges"){const h=Rr(await s.getData(),n.boundary);return this._fileSize=h[0].fileSize||null,h}const a=await s.getData(),{start:o,end:l,total:c}=be(s.getHeader("content-range"));this._fileSize=c||null;const f=[{data:a,offset:o,length:l-o}];if(e.length>1){const h=await Promise.all(e.slice(1).map(u=>this.fetchSlice(u,t)));return f.concat(h)}return f}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const i=await s.getData();return this._fileSize=i.byteLength,[{data:i,offset:0,length:i.byteLength}]}else throw new Error("Error fetching data.")}async fetchSlice(e,t){const{offset:s,length:i}=e,n=await this.client.request({headers:{...this.headers,Range:`bytes=${s}-${s+i}`},signal:t});if(n.ok)if(n.status===206){const a=await n.getData(),{total:o}=be(n.getHeader("content-range"));return this._fileSize=o||null,{data:a,offset:s,length:i}}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const a=await n.getData();return this._fileSize=a.byteLength,{data:a,offset:0,length:a.byteLength}}else throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function we(r,{blockSize:e,cacheSize:t}){return e===null?r:new Nr(r,{blockSize:e,cacheSize:t})}function Yr(r,{headers:e={},credentials:t,maxRanges:s=0,allowFullFile:i=!1,...n}={}){const a=new qr(r,t),o=new pe(a,e,s,i);return we(o,n)}function $r(r,{headers:e={},maxRanges:t=0,allowFullFile:s=!1,...i}={}){const n=new Vr(r),a=new pe(n,e,t,s);return we(a,i)}function Xr(r,{headers:e={},maxRanges:t=0,allowFullFile:s=!1,...i}={}){const n=new Hr(r),a=new pe(n,e,t,s);return we(a,i)}function Zr(r,{headers:e={},maxRanges:t=0,allowFullFile:s=!1,...i}={}){const n=new pe(r,e,t,s);return we(n,i)}function Te(r,{forceXHR:e=!1,...t}={}){return typeof fetch=="function"&&!e?Yr(r,t):typeof XMLHttpRequest<"u"?$r(r,t):Xr(r,t)}class Jr extends Q{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new _("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Qr(r){return new Jr(r)}class Wr extends Q{constructor(e){super(),this.file=e}async fetchSlice(e,t){return new Promise((s,i)=>{const n=this.file.slice(e.offset,e.offset+e.length),a=new FileReader;a.onload=o=>s(o.target.result),a.onerror=i,a.onabort=i,a.readAsArrayBuffer(n),t&&t.addEventListener("abort",()=>a.abort())})}}function es(r){return new Wr(r)}function ts(r){return new Promise((e,t)=>{L.close(r,s=>{s?t(s):e()})})}function rs(r,e,t=void 0){return new Promise((s,i)=>{L.open(r,e,t,(n,a)=>{n?i(n):s(a)})})}function ss(...r){return new Promise((e,t)=>{L.read(...r,(s,i,n)=>{s?t(s):e({bytesRead:i,buffer:n})})})}class is extends Q{constructor(e){super(),this.path=e,this.openRequest=rs(e,"r")}async fetchSlice(e){const t=await this.openRequest,{buffer:s}=await ss(t,Buffer.alloc(e.length),0,e.length,e.offset);return s.buffer}async close(){const e=await this.openRequest;await ts(e)}}function ns(r){return new is(r)}const os=Re(U),as=Re(N),M={};wt(M,os);wt(M,as);const ls=Re(X),ue=1e3,A={nextZero:(r,e)=>{let t=e;for(;r[t]!==0;)t++;return t},readUshort:(r,e)=>r[e]<<8|r[e+1],readShort:(r,e)=>{const t=A.ui8;return t[0]=r[e+1],t[1]=r[e+0],A.i16[0]},readInt:(r,e)=>{const t=A.ui8;return t[0]=r[e+3],t[1]=r[e+2],t[2]=r[e+1],t[3]=r[e+0],A.i32[0]},readUint:(r,e)=>{const t=A.ui8;return t[0]=r[e+3],t[1]=r[e+2],t[2]=r[e+1],t[3]=r[e+0],A.ui32[0]},readASCII:(r,e,t)=>t.map(s=>String.fromCharCode(r[e+s])).join(""),readFloat:(r,e)=>{const t=A.ui8;return C(4,s=>{t[s]=r[e+3-s]}),A.fl32[0]},readDouble:(r,e)=>{const t=A.ui8;return C(8,s=>{t[s]=r[e+7-s]}),A.fl64[0]},writeUshort:(r,e,t)=>{r[e]=t>>8&255,r[e+1]=t&255},writeUint:(r,e,t)=>{r[e]=t>>24&255,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t>>0&255},writeASCII:(r,e,t)=>{C(t.length,s=>{r[e+s]=t.charCodeAt(s)})},ui8:new Uint8Array(8)};A.fl64=new Float64Array(A.ui8.buffer);A.writeDouble=(r,e,t)=>{A.fl64[0]=t,C(8,s=>{r[e+s]=A.ui8[7-s]})};const cs=(r,e,t,s)=>{let i=t;const n=Object.keys(s).filter(o=>o!=null&&o!=="undefined");r.writeUshort(e,i,n.length),i+=2;let a=i+12*n.length+4;for(const o of n){let l=null;typeof o=="number"?l=o:typeof o=="string"&&(l=parseInt(o,10));const c=ge[l],f=ls[c];if(c==null||c===void 0||typeof c>"u")throw new Error(`unknown type of tag: ${l}`);let h=s[o];if(h===void 0)throw new Error(`failed to get value for key ${o}`);c==="ASCII"&&typeof h=="string"&&mt(h,"\0")===!1&&(h+="\0");const u=h.length;r.writeUshort(e,i,l),i+=2,r.writeUshort(e,i,f),i+=2,r.writeUint(e,i,u),i+=4;let d=[-1,1,1,2,4,8,0,0,0,0,0,0,8][f]*u,g=i;d>4&&(r.writeUint(e,i,a),g=a),c==="ASCII"?r.writeASCII(e,g,h):c==="SHORT"?C(u,y=>{r.writeUshort(e,g+2*y,h[y])}):c==="LONG"?C(u,y=>{r.writeUint(e,g+4*y,h[y])}):c==="RATIONAL"?C(u,y=>{r.writeUint(e,g+8*y,Math.round(h[y]*1e4)),r.writeUint(e,g+8*y+4,1e4)}):c==="DOUBLE"&&C(u,y=>{r.writeDouble(e,g+8*y,h[y])}),d>4&&(d+=d&1,a+=d),i+=4}return[i,a]},fs=r=>{const e=new Uint8Array(ue);let t=4;const s=A;e[0]=77,e[1]=77,e[3]=42;let i=8;if(s.writeUint(e,t,i),t+=4,r.forEach((a,o)=>{const l=cs(s,e,i,a);i=l[1],o<r.length-1&&s.writeUint(e,l[0],i)}),e.slice)return e.slice(0,i).buffer;const n=new Uint8Array(i);for(let a=0;a<i;a++)n[a]=e[a];return n.buffer},hs=(r,e,t,s)=>{if(t==null)throw new Error(`you passed into encodeImage a width of type ${t}`);if(e==null)throw new Error(`you passed into encodeImage a width of type ${e}`);const i={256:[e],257:[t],273:[ue],278:[t],305:"geotiff.js"};if(s)for(const c in s)s.hasOwnProperty(c)&&(i[c]=s[c]);const n=new Uint8Array(fs([i])),a=new Uint8Array(r),o=i[277],l=new Uint8Array(ue+e*t*o);return C(n.length,c=>{l[c]=n[c]}),Mr(a,(c,f)=>{l[ue+f]=c}),l.buffer},us=r=>{const e={};for(const t in r)t!=="StripOffsets"&&(M[t]||console.error(t,"not in name2code:",Object.keys(M)),e[M[t]]=r[t]);return e},gs=r=>Array.isArray(r)?r:[r],ds=[["Compression",1],["PlanarConfiguration",1],["ExtraSamples",0]];function ys(r,e){const t=typeof r[0]=="number";let s,i,n,a;t?(s=e.height||e.ImageLength,n=e.width||e.ImageWidth,i=r.length/(s*n),a=r):(i=r.length,s=r[0].length,n=r[0][0].length,a=[],C(s,f=>{C(n,h=>{C(i,u=>{a.push(r[u][f][h])})})})),e.ImageLength=s,delete e.height,e.ImageWidth=n,delete e.width,e.BitsPerSample||(e.BitsPerSample=C(i,()=>8)),ds.forEach(f=>{const h=f[0];if(!e[h]){const u=f[1];e[h]=u}}),e.PhotometricInterpretation||(e.PhotometricInterpretation=e.BitsPerSample.length===3?2:1),e.SamplesPerPixel||(e.SamplesPerPixel=[i]),e.StripByteCounts||(e.StripByteCounts=[i*s*n]),e.ModelPixelScale||(e.ModelPixelScale=[360/n,180/s,0]),e.SampleFormat||(e.SampleFormat=C(i,()=>1)),!e.hasOwnProperty("GeographicTypeGeoKey")&&!e.hasOwnProperty("ProjectedCSTypeGeoKey")&&(e.GeographicTypeGeoKey=4326,e.ModelTiepoint=[0,0,0,-180,90,0],e.GeogCitationGeoKey="WGS 84",e.GTModelTypeGeoKey=2);const o=Object.keys(e).filter(f=>mt(f,"GeoKey")).sort((f,h)=>M[f]-M[h]);if(!e.GeoAsciiParams){let f="";o.forEach(h=>{const u=Number(M[h]);ge[u]==="ASCII"&&(f+=`${e[h].toString()}\0`)}),f.length>0&&(e.GeoAsciiParams=f)}if(!e.GeoKeyDirectory){const h=[1,1,0,o.length];o.forEach(u=>{const d=Number(M[u]);h.push(d);let g,y,p;ge[d]==="SHORT"?(g=1,y=0,p=e[u]):u==="GeogCitationGeoKey"?(g=e.GeoAsciiParams.length,y=Number(M.GeoAsciiParams),p=0):console.log(`[geotiff.js] couldn't get TIFFTagLocation for ${u}`),h.push(y),h.push(g),h.push(p)}),e.GeoKeyDirectory=h}for(const f of o)e.hasOwnProperty(f)&&delete e[f];["Compression","ExtraSamples","GeographicTypeGeoKey","GTModelTypeGeoKey","GTRasterTypeGeoKey","ImageLength","ImageWidth","Orientation","PhotometricInterpretation","ProjectedCSTypeGeoKey","PlanarConfiguration","ResolutionUnit","SamplesPerPixel","XPosition","YPosition","RowsPerStrip"].forEach(f=>{e[f]&&(e[f]=gs(e[f]))});const l=us(e);return hs(a,n,s,l)}class ps{log(){}debug(){}info(){}warn(){}error(){}time(){}timeEnd(){}}function ws(r=new ps){}function ms(r,e){let t=r.length-e,s=0;do{for(let i=e;i>0;i--)r[s+e]+=r[s],s++;t-=e}while(t>0)}function xs(r,e,t){let s=0,i=r.length;const n=i/t;for(;i>e;){for(let o=e;o>0;--o)r[s+e]+=r[s],++s;i-=e}const a=r.slice();for(let o=0;o<n;++o)for(let l=0;l<t;++l)r[t*o+l]=a[(t-l-1)*n+o]}function Ss(r,e,t,s,i,n){if(e===1)return r;for(let l=0;l<i.length;++l){if(i[l]%8!==0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[l]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=i[0]/8,o=n===2?1:i.length;for(let l=0;l<s&&!(l*o*t*a>=r.byteLength);++l){let c;if(e===2){switch(i[0]){case 8:c=new Uint8Array(r,l*o*t*a,o*t*a);break;case 16:c=new Uint16Array(r,l*o*t*a,o*t*a/2);break;case 32:c=new Uint32Array(r,l*o*t*a,o*t*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${i[0]} bits per sample.`)}ms(c,o)}else e===3&&(c=new Uint8Array(r,l*o*t*a,o*t*a),xs(c,o,a))}return r}class xt{async decode(e,t){const s=await this.decodeBlock(t),i=e.Predictor||1;if(i!==1){const n=!e.StripOffsets,a=n?e.TileWidth:e.ImageWidth,o=n?e.TileLength:e.RowsPerStrip||e.ImageLength;return Ss(s,i,a,o,e.BitsPerSample,e.PlanarConfiguration)}return s}}function Ae(r){switch(r){case m.BYTE:case m.ASCII:case m.SBYTE:case m.UNDEFINED:return 1;case m.SHORT:case m.SSHORT:return 2;case m.LONG:case m.SLONG:case m.FLOAT:case m.IFD:return 4;case m.RATIONAL:case m.SRATIONAL:case m.DOUBLE:case m.LONG8:case m.SLONG8:case m.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${r}`)}}function Is(r){const e=r.GeoKeyDirectory;if(!e)return null;const t={};for(let s=4;s<=e[3]*4;s+=4){const i=N[e[s]],n=e[s+1]?U[e[s+1]]:null,a=e[s+2],o=e[s+3];let l=null;if(!n)l=o;else{if(l=r[n],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof l=="string"?l=l.substring(o,o+a-1):l.subarray&&(l=l.subarray(o,o+a),a===1&&(l=l[0]))}t[i]=l}return t}function v(r,e,t,s){let i=null,n=null;const a=Ae(e);switch(e){case m.BYTE:case m.ASCII:case m.UNDEFINED:i=new Uint8Array(t),n=r.readUint8;break;case m.SBYTE:i=new Int8Array(t),n=r.readInt8;break;case m.SHORT:i=new Uint16Array(t),n=r.readUint16;break;case m.SSHORT:i=new Int16Array(t),n=r.readInt16;break;case m.LONG:case m.IFD:i=new Uint32Array(t),n=r.readUint32;break;case m.SLONG:i=new Int32Array(t),n=r.readInt32;break;case m.LONG8:case m.IFD8:i=new Array(t),n=r.readUint64;break;case m.SLONG8:i=new Array(t),n=r.readInt64;break;case m.RATIONAL:i=new Uint32Array(t*2),n=r.readUint32;break;case m.SRATIONAL:i=new Int32Array(t*2),n=r.readInt32;break;case m.FLOAT:i=new Float32Array(t),n=r.readFloat32;break;case m.DOUBLE:i=new Float64Array(t),n=r.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===m.RATIONAL||e===m.SRATIONAL)for(let o=0;o<t;o+=2)i[o]=n.call(r,s+o*a),i[o+1]=n.call(r,s+(o*a+4));else for(let o=0;o<t;++o)i[o]=n.call(r,s+o*a);return e===m.ASCII?new TextDecoder("utf-8").decode(i):i}class bs{constructor(e,t,s){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=s}}class he extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class St{async readRasters(e={}){const{window:t,width:s,height:i}=e;let{resX:n,resY:a,bbox:o}=e;const l=await this.getImage();let c=l;const f=await this.getImageCount(),h=l.getBoundingBox();if(t&&o)throw new Error('Both "bbox" and "window" passed.');if(s||i){if(t){const[g,y]=l.getOrigin(),[p,x]=l.getResolution();o=[g+t[0]*p,y+t[1]*x,g+t[2]*p,y+t[3]*x]}const d=o||h;if(s){if(n)throw new Error("Both width and resX passed");n=(d[2]-d[0])/s}if(i){if(a)throw new Error("Both width and resY passed");a=(d[3]-d[1])/i}}if(n||a){const d=[];for(let g=0;g<f;++g){const y=await this.getImage(g),{SubfileType:p,NewSubfileType:x}=y.fileDirectory;(g===0||p===2||x&1)&&d.push(y)}d.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<d.length;++g){const y=d[g],p=(h[2]-h[0])/y.getWidth(),x=(h[3]-h[1])/y.getHeight();if(c=y,n&&n>p||a&&a>x)break}}let u=t;if(o){const[d,g]=l.getOrigin(),[y,p]=c.getResolution(l);u=[Math.round((o[0]-d)/y),Math.round((o[1]-g)/p),Math.round((o[2]-d)/y),Math.round((o[3]-g)/p)],u=[Math.min(u[0],u[2]),Math.min(u[1],u[3]),Math.max(u[0],u[2]),Math.max(u[1],u[3])]}return c.readRasters({...e,window:u})}}class k extends St{constructor(e,t,s,i,n={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=s,this.firstIFDOffset=i,this.cache=n.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const s=this.bigTiff?4048:1024;return new Or((await this.source.fetch([{offset:e,length:typeof t<"u"?t:s}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,s=this.bigTiff?8:2;let i=await this.getSlice(e);const n=this.bigTiff?i.readUint64(e):i.readUint16(e),a=n*t+(this.bigTiff?16:6);i.covers(e,a)||(i=await this.getSlice(e,a));const o={};let l=e+(this.bigTiff?8:2);for(let h=0;h<n;l+=t,++h){const u=i.readUint16(l),d=i.readUint16(l+2),g=this.bigTiff?i.readUint64(l+4):i.readUint32(l+4);let y,p;const x=Ae(d),w=l+(this.bigTiff?12:8);if(x*g<=(this.bigTiff?8:4))y=v(i,d,g,w);else{const S=i.readOffset(w),I=Ae(d)*g;if(i.covers(S,I))y=v(i,d,g,S);else{const b=await this.getSlice(S,I);y=v(b,d,g,S)}}g===1&&st.indexOf(u)===-1&&!(d===m.RATIONAL||d===m.SRATIONAL)?p=y[0]:p=y,o[U[u]]=p}const c=Is(o),f=i.readOffset(e+s+t*n);return new bs(o,c,f)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){throw t instanceof he?new he(e):t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(t.nextIFDByteOffset===0)throw new he(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new ke(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(s){if(s instanceof he)t=!1;else throw s}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",s=t.length+100;let i=await this.getSlice(e,s);if(t===v(i,m.ASCII,t.length,e)){const a=v(i,m.ASCII,s,e).split(`
@@ -0,0 +1,4 @@
1
+ import { M as r } from "./ControlGrid-CcOIR0lI.js";
2
+ export {
3
+ r as MapboxOverlay
4
+ };