@loaders.gl/pmtiles 4.2.0 → 4.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -12,6 +12,7 @@ var __exports__ = (() => {
12
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
13
13
  var __getProtoOf = Object.getPrototypeOf;
14
14
  var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
16
  var __commonJS = (cb, mod) => function __require() {
16
17
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
18
  };
@@ -37,6 +38,10 @@ var __exports__ = (() => {
37
38
  mod
38
39
  ));
39
40
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
+ var __publicField = (obj, key, value) => {
42
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
43
+ return value;
44
+ };
40
45
 
41
46
  // external-global-plugin:@loaders.gl/core
42
47
  var require_core = __commonJS({
@@ -54,19 +59,19 @@ var __exports__ = (() => {
54
59
  var eMax = (1 << eLen) - 1;
55
60
  var eBias = eMax >> 1;
56
61
  var nBits = -7;
57
- var i3 = isLE ? nBytes - 1 : 0;
62
+ var i2 = isLE ? nBytes - 1 : 0;
58
63
  var d = isLE ? -1 : 1;
59
- var s = buffer[offset + i3];
60
- i3 += d;
64
+ var s = buffer[offset + i2];
65
+ i2 += d;
61
66
  e = s & (1 << -nBits) - 1;
62
67
  s >>= -nBits;
63
68
  nBits += eLen;
64
- for (; nBits > 0; e = e * 256 + buffer[offset + i3], i3 += d, nBits -= 8) {
69
+ for (; nBits > 0; e = e * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
65
70
  }
66
71
  m = e & (1 << -nBits) - 1;
67
72
  e >>= -nBits;
68
73
  nBits += mLen;
69
- for (; nBits > 0; m = m * 256 + buffer[offset + i3], i3 += d, nBits -= 8) {
74
+ for (; nBits > 0; m = m * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
70
75
  }
71
76
  if (e === 0) {
72
77
  e = 1 - eBias;
@@ -84,7 +89,7 @@ var __exports__ = (() => {
84
89
  var eMax = (1 << eLen) - 1;
85
90
  var eBias = eMax >> 1;
86
91
  var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
87
- var i3 = isLE ? 0 : nBytes - 1;
92
+ var i2 = isLE ? 0 : nBytes - 1;
88
93
  var d = isLE ? 1 : -1;
89
94
  var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
90
95
  value = Math.abs(value);
@@ -117,13 +122,13 @@ var __exports__ = (() => {
117
122
  e = 0;
118
123
  }
119
124
  }
120
- for (; mLen >= 8; buffer[offset + i3] = m & 255, i3 += d, m /= 256, mLen -= 8) {
125
+ for (; mLen >= 8; buffer[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {
121
126
  }
122
127
  e = e << mLen | m;
123
128
  eLen += mLen;
124
- for (; eLen > 0; buffer[offset + i3] = e & 255, i3 += d, e /= 256, eLen -= 8) {
129
+ for (; eLen > 0; buffer[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
125
130
  }
126
- buffer[offset + i3 - d] |= s * 128;
131
+ buffer[offset + i2 - d] |= s * 128;
127
132
  };
128
133
  }
129
134
  });
@@ -345,14 +350,14 @@ var __exports__ = (() => {
345
350
  this.writeVarint(tag << 3 | type);
346
351
  },
347
352
  realloc: function(min) {
348
- var length2 = this.length || 16;
349
- while (length2 < this.pos + min)
350
- length2 *= 2;
351
- if (length2 !== this.length) {
352
- var buf = new Uint8Array(length2);
353
+ var length = this.length || 16;
354
+ while (length < this.pos + min)
355
+ length *= 2;
356
+ if (length !== this.length) {
357
+ var buf = new Uint8Array(length);
353
358
  buf.set(this.buf);
354
359
  this.buf = buf;
355
- this.length = length2;
360
+ this.length = length;
356
361
  }
357
362
  },
358
363
  finish: function() {
@@ -433,8 +438,8 @@ var __exports__ = (() => {
433
438
  var len = buffer.length;
434
439
  this.writeVarint(len);
435
440
  this.realloc(len);
436
- for (var i3 = 0; i3 < len; i3++)
437
- this.buf[this.pos++] = buffer[i3];
441
+ for (var i2 = 0; i2 < len; i2++)
442
+ this.buf[this.pos++] = buffer[i2];
438
443
  },
439
444
  writeRawMessage: function(fn, obj) {
440
445
  this.pos++;
@@ -623,44 +628,44 @@ var __exports__ = (() => {
623
628
  function makeRoomForExtraLength(startPos, len, pbf) {
624
629
  var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
625
630
  pbf.realloc(extraLen);
626
- for (var i3 = pbf.pos - 1; i3 >= startPos; i3--)
627
- pbf.buf[i3 + extraLen] = pbf.buf[i3];
631
+ for (var i2 = pbf.pos - 1; i2 >= startPos; i2--)
632
+ pbf.buf[i2 + extraLen] = pbf.buf[i2];
628
633
  }
629
634
  function writePackedVarint(arr, pbf) {
630
- for (var i3 = 0; i3 < arr.length; i3++)
631
- pbf.writeVarint(arr[i3]);
635
+ for (var i2 = 0; i2 < arr.length; i2++)
636
+ pbf.writeVarint(arr[i2]);
632
637
  }
633
638
  function writePackedSVarint(arr, pbf) {
634
- for (var i3 = 0; i3 < arr.length; i3++)
635
- pbf.writeSVarint(arr[i3]);
639
+ for (var i2 = 0; i2 < arr.length; i2++)
640
+ pbf.writeSVarint(arr[i2]);
636
641
  }
637
642
  function writePackedFloat(arr, pbf) {
638
- for (var i3 = 0; i3 < arr.length; i3++)
639
- pbf.writeFloat(arr[i3]);
643
+ for (var i2 = 0; i2 < arr.length; i2++)
644
+ pbf.writeFloat(arr[i2]);
640
645
  }
641
646
  function writePackedDouble(arr, pbf) {
642
- for (var i3 = 0; i3 < arr.length; i3++)
643
- pbf.writeDouble(arr[i3]);
647
+ for (var i2 = 0; i2 < arr.length; i2++)
648
+ pbf.writeDouble(arr[i2]);
644
649
  }
645
650
  function writePackedBoolean(arr, pbf) {
646
- for (var i3 = 0; i3 < arr.length; i3++)
647
- pbf.writeBoolean(arr[i3]);
651
+ for (var i2 = 0; i2 < arr.length; i2++)
652
+ pbf.writeBoolean(arr[i2]);
648
653
  }
649
654
  function writePackedFixed32(arr, pbf) {
650
- for (var i3 = 0; i3 < arr.length; i3++)
651
- pbf.writeFixed32(arr[i3]);
655
+ for (var i2 = 0; i2 < arr.length; i2++)
656
+ pbf.writeFixed32(arr[i2]);
652
657
  }
653
658
  function writePackedSFixed32(arr, pbf) {
654
- for (var i3 = 0; i3 < arr.length; i3++)
655
- pbf.writeSFixed32(arr[i3]);
659
+ for (var i2 = 0; i2 < arr.length; i2++)
660
+ pbf.writeSFixed32(arr[i2]);
656
661
  }
657
662
  function writePackedFixed64(arr, pbf) {
658
- for (var i3 = 0; i3 < arr.length; i3++)
659
- pbf.writeFixed64(arr[i3]);
663
+ for (var i2 = 0; i2 < arr.length; i2++)
664
+ pbf.writeFixed64(arr[i2]);
660
665
  }
661
666
  function writePackedSFixed64(arr, pbf) {
662
- for (var i3 = 0; i3 < arr.length; i3++)
663
- pbf.writeSFixed64(arr[i3]);
667
+ for (var i2 = 0; i2 < arr.length; i2++)
668
+ pbf.writeSFixed64(arr[i2]);
664
669
  }
665
670
  function readUInt32(buf, pos) {
666
671
  return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
@@ -676,12 +681,12 @@ var __exports__ = (() => {
676
681
  }
677
682
  function readUtf8(buf, pos, end) {
678
683
  var str = "";
679
- var i3 = pos;
680
- while (i3 < end) {
681
- var b0 = buf[i3];
684
+ var i2 = pos;
685
+ while (i2 < end) {
686
+ var b0 = buf[i2];
682
687
  var c = null;
683
688
  var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
684
- if (i3 + bytesPerSequence > end)
689
+ if (i2 + bytesPerSequence > end)
685
690
  break;
686
691
  var b1, b2, b3;
687
692
  if (bytesPerSequence === 1) {
@@ -689,7 +694,7 @@ var __exports__ = (() => {
689
694
  c = b0;
690
695
  }
691
696
  } else if (bytesPerSequence === 2) {
692
- b1 = buf[i3 + 1];
697
+ b1 = buf[i2 + 1];
693
698
  if ((b1 & 192) === 128) {
694
699
  c = (b0 & 31) << 6 | b1 & 63;
695
700
  if (c <= 127) {
@@ -697,8 +702,8 @@ var __exports__ = (() => {
697
702
  }
698
703
  }
699
704
  } else if (bytesPerSequence === 3) {
700
- b1 = buf[i3 + 1];
701
- b2 = buf[i3 + 2];
705
+ b1 = buf[i2 + 1];
706
+ b2 = buf[i2 + 2];
702
707
  if ((b1 & 192) === 128 && (b2 & 192) === 128) {
703
708
  c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
704
709
  if (c <= 2047 || c >= 55296 && c <= 57343) {
@@ -706,9 +711,9 @@ var __exports__ = (() => {
706
711
  }
707
712
  }
708
713
  } else if (bytesPerSequence === 4) {
709
- b1 = buf[i3 + 1];
710
- b2 = buf[i3 + 2];
711
- b3 = buf[i3 + 3];
714
+ b1 = buf[i2 + 1];
715
+ b2 = buf[i2 + 2];
716
+ b3 = buf[i2 + 3];
712
717
  if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
713
718
  c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
714
719
  if (c <= 65535 || c >= 1114112) {
@@ -725,7 +730,7 @@ var __exports__ = (() => {
725
730
  c = 56320 | c & 1023;
726
731
  }
727
732
  str += String.fromCharCode(c);
728
- i3 += bytesPerSequence;
733
+ i2 += bytesPerSequence;
729
734
  }
730
735
  return str;
731
736
  }
@@ -733,8 +738,8 @@ var __exports__ = (() => {
733
738
  return utf8TextDecoder.decode(buf.subarray(pos, end));
734
739
  }
735
740
  function writeUtf8(buf, str, pos) {
736
- for (var i3 = 0, c, lead; i3 < str.length; i3++) {
737
- c = str.charCodeAt(i3);
741
+ for (var i2 = 0, c, lead; i2 < str.length; i2++) {
742
+ c = str.charCodeAt(i2);
738
743
  if (c > 55295 && c < 57344) {
739
744
  if (lead) {
740
745
  if (c < 56320) {
@@ -748,7 +753,7 @@ var __exports__ = (() => {
748
753
  lead = null;
749
754
  }
750
755
  } else {
751
- if (c > 56319 || i3 + 1 === str.length) {
756
+ if (c > 56319 || i2 + 1 === str.length) {
752
757
  buf[pos++] = 239;
753
758
  buf[pos++] = 191;
754
759
  buf[pos++] = 189;
@@ -863,6 +868,539 @@ var __exports__ = (() => {
863
868
  return obj;
864
869
  }
865
870
 
871
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
872
+ function isElectron(mockUserAgent) {
873
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
874
+ return true;
875
+ }
876
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
877
+ return true;
878
+ }
879
+ const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
880
+ const userAgent = mockUserAgent || realUserAgent;
881
+ if (userAgent && userAgent.indexOf("Electron") >= 0) {
882
+ return true;
883
+ }
884
+ return false;
885
+ }
886
+
887
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
888
+ function isBrowser2() {
889
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
890
+ return !isNode || isElectron();
891
+ }
892
+
893
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
894
+ var self_2 = globalThis.self || globalThis.window || globalThis.global;
895
+ var window_2 = globalThis.window || globalThis.self || globalThis.global;
896
+ var document_2 = globalThis.document || {};
897
+ var process_ = globalThis.process || {};
898
+ var console_ = globalThis.console;
899
+ var navigator_ = globalThis.navigator || {};
900
+
901
+ // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
902
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
903
+ var isBrowser3 = isBrowser2();
904
+
905
+ // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
906
+ function getStorage(type) {
907
+ try {
908
+ const storage = window[type];
909
+ const x2 = "__storage_test__";
910
+ storage.setItem(x2, x2);
911
+ storage.removeItem(x2);
912
+ return storage;
913
+ } catch (e) {
914
+ return null;
915
+ }
916
+ }
917
+ var LocalStorage = class {
918
+ constructor(id, defaultConfig) {
919
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
920
+ _defineProperty(this, "storage", void 0);
921
+ _defineProperty(this, "id", void 0);
922
+ _defineProperty(this, "config", void 0);
923
+ this.storage = getStorage(type);
924
+ this.id = id;
925
+ this.config = defaultConfig;
926
+ this._loadConfiguration();
927
+ }
928
+ getConfiguration() {
929
+ return this.config;
930
+ }
931
+ setConfiguration(configuration) {
932
+ Object.assign(this.config, configuration);
933
+ if (this.storage) {
934
+ const serialized = JSON.stringify(this.config);
935
+ this.storage.setItem(this.id, serialized);
936
+ }
937
+ }
938
+ _loadConfiguration() {
939
+ let configuration = {};
940
+ if (this.storage) {
941
+ const serializedConfiguration = this.storage.getItem(this.id);
942
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
943
+ }
944
+ Object.assign(this.config, configuration);
945
+ return this;
946
+ }
947
+ };
948
+
949
+ // ../../node_modules/@probe.gl/log/dist/utils/formatters.js
950
+ function formatTime(ms) {
951
+ let formatted;
952
+ if (ms < 10) {
953
+ formatted = "".concat(ms.toFixed(2), "ms");
954
+ } else if (ms < 100) {
955
+ formatted = "".concat(ms.toFixed(1), "ms");
956
+ } else if (ms < 1e3) {
957
+ formatted = "".concat(ms.toFixed(0), "ms");
958
+ } else {
959
+ formatted = "".concat((ms / 1e3).toFixed(2), "s");
960
+ }
961
+ return formatted;
962
+ }
963
+ function leftPad(string) {
964
+ let length = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
965
+ const padLength = Math.max(length - string.length, 0);
966
+ return "".concat(" ".repeat(padLength)).concat(string);
967
+ }
968
+ function formatImage(image, message, scale) {
969
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
970
+ const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
971
+ if (image.width > maxWidth) {
972
+ scale = Math.min(scale, maxWidth / image.width);
973
+ }
974
+ const width = image.width * scale;
975
+ const height = image.height * scale;
976
+ const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
977
+ return ["".concat(message, " %c+"), style];
978
+ }
979
+
980
+ // ../../node_modules/@probe.gl/log/dist/utils/color.js
981
+ var COLOR;
982
+ (function(COLOR2) {
983
+ COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
984
+ COLOR2[COLOR2["RED"] = 31] = "RED";
985
+ COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
986
+ COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
987
+ COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
988
+ COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
989
+ COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
990
+ COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
991
+ COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
992
+ COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
993
+ COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
994
+ COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
995
+ COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
996
+ COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
997
+ COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
998
+ COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
999
+ })(COLOR || (COLOR = {}));
1000
+ var BACKGROUND_INCREMENT = 10;
1001
+ function getColor(color) {
1002
+ if (typeof color !== "string") {
1003
+ return color;
1004
+ }
1005
+ color = color.toUpperCase();
1006
+ return COLOR[color] || COLOR.WHITE;
1007
+ }
1008
+ function addColor(string, color, background) {
1009
+ if (!isBrowser2 && typeof string === "string") {
1010
+ if (color) {
1011
+ const colorCode = getColor(color);
1012
+ string = "\x1B[".concat(colorCode, "m").concat(string, "\x1B[39m");
1013
+ }
1014
+ if (background) {
1015
+ const colorCode = getColor(background);
1016
+ string = "\x1B[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "\x1B[49m");
1017
+ }
1018
+ }
1019
+ return string;
1020
+ }
1021
+
1022
+ // ../../node_modules/@probe.gl/log/dist/utils/autobind.js
1023
+ function autobind(obj) {
1024
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
1025
+ const proto = Object.getPrototypeOf(obj);
1026
+ const propNames = Object.getOwnPropertyNames(proto);
1027
+ const object = obj;
1028
+ for (const key of propNames) {
1029
+ const value = object[key];
1030
+ if (typeof value === "function") {
1031
+ if (!predefined.find((name) => key === name)) {
1032
+ object[key] = value.bind(obj);
1033
+ }
1034
+ }
1035
+ }
1036
+ }
1037
+
1038
+ // ../../node_modules/@probe.gl/log/dist/utils/assert.js
1039
+ function assert2(condition, message) {
1040
+ if (!condition) {
1041
+ throw new Error(message || "Assertion failed");
1042
+ }
1043
+ }
1044
+
1045
+ // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
1046
+ function getHiResTimestamp() {
1047
+ let timestamp;
1048
+ if (isBrowser2() && window_2.performance) {
1049
+ var _window$performance, _window$performance$n;
1050
+ timestamp = window_2 === null || window_2 === void 0 ? void 0 : (_window$performance = window_2.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
1051
+ } else if ("hrtime" in process_) {
1052
+ var _process$hrtime;
1053
+ const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
1054
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
1055
+ } else {
1056
+ timestamp = Date.now();
1057
+ }
1058
+ return timestamp;
1059
+ }
1060
+
1061
+ // ../../node_modules/@probe.gl/log/dist/log.js
1062
+ var originalConsole = {
1063
+ debug: isBrowser2() ? console.debug || console.log : console.log,
1064
+ log: console.log,
1065
+ info: console.info,
1066
+ warn: console.warn,
1067
+ error: console.error
1068
+ };
1069
+ var DEFAULT_LOG_CONFIGURATION = {
1070
+ enabled: true,
1071
+ level: 0
1072
+ };
1073
+ function noop() {
1074
+ }
1075
+ var cache = {};
1076
+ var ONCE = {
1077
+ once: true
1078
+ };
1079
+ var Log = class {
1080
+ constructor() {
1081
+ let {
1082
+ id
1083
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
1084
+ id: ""
1085
+ };
1086
+ _defineProperty(this, "id", void 0);
1087
+ _defineProperty(this, "VERSION", VERSION);
1088
+ _defineProperty(this, "_startTs", getHiResTimestamp());
1089
+ _defineProperty(this, "_deltaTs", getHiResTimestamp());
1090
+ _defineProperty(this, "_storage", void 0);
1091
+ _defineProperty(this, "userData", {});
1092
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
1093
+ this.id = id;
1094
+ this.userData = {};
1095
+ this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
1096
+ this.timeStamp("".concat(this.id, " started"));
1097
+ autobind(this);
1098
+ Object.seal(this);
1099
+ }
1100
+ set level(newLevel) {
1101
+ this.setLevel(newLevel);
1102
+ }
1103
+ get level() {
1104
+ return this.getLevel();
1105
+ }
1106
+ isEnabled() {
1107
+ return this._storage.config.enabled;
1108
+ }
1109
+ getLevel() {
1110
+ return this._storage.config.level;
1111
+ }
1112
+ getTotal() {
1113
+ return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
1114
+ }
1115
+ getDelta() {
1116
+ return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
1117
+ }
1118
+ set priority(newPriority) {
1119
+ this.level = newPriority;
1120
+ }
1121
+ get priority() {
1122
+ return this.level;
1123
+ }
1124
+ getPriority() {
1125
+ return this.level;
1126
+ }
1127
+ enable() {
1128
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
1129
+ this._storage.setConfiguration({
1130
+ enabled
1131
+ });
1132
+ return this;
1133
+ }
1134
+ setLevel(level) {
1135
+ this._storage.setConfiguration({
1136
+ level
1137
+ });
1138
+ return this;
1139
+ }
1140
+ get(setting) {
1141
+ return this._storage.config[setting];
1142
+ }
1143
+ set(setting, value) {
1144
+ this._storage.setConfiguration({
1145
+ [setting]: value
1146
+ });
1147
+ }
1148
+ settings() {
1149
+ if (console.table) {
1150
+ console.table(this._storage.config);
1151
+ } else {
1152
+ console.log(this._storage.config);
1153
+ }
1154
+ }
1155
+ assert(condition, message) {
1156
+ assert2(condition, message);
1157
+ }
1158
+ warn(message) {
1159
+ return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
1160
+ }
1161
+ error(message) {
1162
+ return this._getLogFunction(0, message, originalConsole.error, arguments);
1163
+ }
1164
+ deprecated(oldUsage, newUsage) {
1165
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
1166
+ }
1167
+ removed(oldUsage, newUsage) {
1168
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
1169
+ }
1170
+ probe(logLevel, message) {
1171
+ return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
1172
+ time: true,
1173
+ once: true
1174
+ });
1175
+ }
1176
+ log(logLevel, message) {
1177
+ return this._getLogFunction(logLevel, message, originalConsole.debug, arguments);
1178
+ }
1179
+ info(logLevel, message) {
1180
+ return this._getLogFunction(logLevel, message, console.info, arguments);
1181
+ }
1182
+ once(logLevel, message) {
1183
+ return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
1184
+ }
1185
+ table(logLevel, table, columns) {
1186
+ if (table) {
1187
+ return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
1188
+ tag: getTableHeader(table)
1189
+ });
1190
+ }
1191
+ return noop;
1192
+ }
1193
+ image(_ref) {
1194
+ let {
1195
+ logLevel,
1196
+ priority,
1197
+ image,
1198
+ message = "",
1199
+ scale = 1
1200
+ } = _ref;
1201
+ if (!this._shouldLog(logLevel || priority)) {
1202
+ return noop;
1203
+ }
1204
+ return isBrowser2() ? logImageInBrowser({
1205
+ image,
1206
+ message,
1207
+ scale
1208
+ }) : logImageInNode({
1209
+ image,
1210
+ message,
1211
+ scale
1212
+ });
1213
+ }
1214
+ time(logLevel, message) {
1215
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
1216
+ }
1217
+ timeEnd(logLevel, message) {
1218
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
1219
+ }
1220
+ timeStamp(logLevel, message) {
1221
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop);
1222
+ }
1223
+ group(logLevel, message) {
1224
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
1225
+ collapsed: false
1226
+ };
1227
+ const options = normalizeArguments({
1228
+ logLevel,
1229
+ message,
1230
+ opts
1231
+ });
1232
+ const {
1233
+ collapsed
1234
+ } = opts;
1235
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1236
+ return this._getLogFunction(options);
1237
+ }
1238
+ groupCollapsed(logLevel, message) {
1239
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1240
+ return this.group(logLevel, message, Object.assign({}, opts, {
1241
+ collapsed: true
1242
+ }));
1243
+ }
1244
+ groupEnd(logLevel) {
1245
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop);
1246
+ }
1247
+ withGroup(logLevel, message, func) {
1248
+ this.group(logLevel, message)();
1249
+ try {
1250
+ func();
1251
+ } finally {
1252
+ this.groupEnd(logLevel)();
1253
+ }
1254
+ }
1255
+ trace() {
1256
+ if (console.trace) {
1257
+ console.trace();
1258
+ }
1259
+ }
1260
+ _shouldLog(logLevel) {
1261
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
1262
+ }
1263
+ _getLogFunction(logLevel, message, method, args, opts) {
1264
+ if (this._shouldLog(logLevel)) {
1265
+ opts = normalizeArguments({
1266
+ logLevel,
1267
+ message,
1268
+ args,
1269
+ opts
1270
+ });
1271
+ method = method || opts.method;
1272
+ assert2(method);
1273
+ opts.total = this.getTotal();
1274
+ opts.delta = this.getDelta();
1275
+ this._deltaTs = getHiResTimestamp();
1276
+ const tag = opts.tag || opts.message;
1277
+ if (opts.once && tag) {
1278
+ if (!cache[tag]) {
1279
+ cache[tag] = getHiResTimestamp();
1280
+ } else {
1281
+ return noop;
1282
+ }
1283
+ }
1284
+ message = decorateMessage(this.id, opts.message, opts);
1285
+ return method.bind(console, message, ...opts.args);
1286
+ }
1287
+ return noop;
1288
+ }
1289
+ };
1290
+ _defineProperty(Log, "VERSION", VERSION);
1291
+ function normalizeLogLevel(logLevel) {
1292
+ if (!logLevel) {
1293
+ return 0;
1294
+ }
1295
+ let resolvedLevel;
1296
+ switch (typeof logLevel) {
1297
+ case "number":
1298
+ resolvedLevel = logLevel;
1299
+ break;
1300
+ case "object":
1301
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
1302
+ break;
1303
+ default:
1304
+ return 0;
1305
+ }
1306
+ assert2(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
1307
+ return resolvedLevel;
1308
+ }
1309
+ function normalizeArguments(opts) {
1310
+ const {
1311
+ logLevel,
1312
+ message
1313
+ } = opts;
1314
+ opts.logLevel = normalizeLogLevel(logLevel);
1315
+ const args = opts.args ? Array.from(opts.args) : [];
1316
+ while (args.length && args.shift() !== message) {
1317
+ }
1318
+ switch (typeof logLevel) {
1319
+ case "string":
1320
+ case "function":
1321
+ if (message !== void 0) {
1322
+ args.unshift(message);
1323
+ }
1324
+ opts.message = logLevel;
1325
+ break;
1326
+ case "object":
1327
+ Object.assign(opts, logLevel);
1328
+ break;
1329
+ default:
1330
+ }
1331
+ if (typeof opts.message === "function") {
1332
+ opts.message = opts.message();
1333
+ }
1334
+ const messageType = typeof opts.message;
1335
+ assert2(messageType === "string" || messageType === "object");
1336
+ return Object.assign(opts, {
1337
+ args
1338
+ }, opts.opts);
1339
+ }
1340
+ function decorateMessage(id, message, opts) {
1341
+ if (typeof message === "string") {
1342
+ const time = opts.time ? leftPad(formatTime(opts.total)) : "";
1343
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
1344
+ message = addColor(message, opts.color, opts.background);
1345
+ }
1346
+ return message;
1347
+ }
1348
+ function logImageInNode(_ref2) {
1349
+ let {
1350
+ image,
1351
+ message = "",
1352
+ scale = 1
1353
+ } = _ref2;
1354
+ console.warn("removed");
1355
+ return noop;
1356
+ }
1357
+ function logImageInBrowser(_ref3) {
1358
+ let {
1359
+ image,
1360
+ message = "",
1361
+ scale = 1
1362
+ } = _ref3;
1363
+ if (typeof image === "string") {
1364
+ const img = new Image();
1365
+ img.onload = () => {
1366
+ const args = formatImage(img, message, scale);
1367
+ console.log(...args);
1368
+ };
1369
+ img.src = image;
1370
+ return noop;
1371
+ }
1372
+ const element = image.nodeName || "";
1373
+ if (element.toLowerCase() === "img") {
1374
+ console.log(...formatImage(image, message, scale));
1375
+ return noop;
1376
+ }
1377
+ if (element.toLowerCase() === "canvas") {
1378
+ const img = new Image();
1379
+ img.onload = () => console.log(...formatImage(img, message, scale));
1380
+ img.src = image.toDataURL();
1381
+ return noop;
1382
+ }
1383
+ return noop;
1384
+ }
1385
+ function getTableHeader(table) {
1386
+ for (const key in table) {
1387
+ for (const title in table[key]) {
1388
+ return title || "untitled";
1389
+ }
1390
+ }
1391
+ return "empty";
1392
+ }
1393
+
1394
+ // ../../node_modules/@probe.gl/log/dist/index.js
1395
+ var dist_default = new Log({
1396
+ id: "@probe.gl/log"
1397
+ });
1398
+
1399
+ // ../loader-utils/src/lib/log-utils/log.ts
1400
+ var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
1401
+ var version = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
1402
+ var log = new Log({ id: `loaders.gl ${version}` });
1403
+
866
1404
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
867
1405
  var pathPrefix = "";
868
1406
  var fileAliases = {};
@@ -925,7 +1463,7 @@ var __exports__ = (() => {
925
1463
  }
926
1464
 
927
1465
  // ../images/src/lib/utils/version.ts
928
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
1466
+ var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
929
1467
 
930
1468
  // ../images/src/lib/category-api/image-type.ts
931
1469
  var parseImageNode = globalThis.loaders?.parseImageNode;
@@ -1125,8 +1663,8 @@ var __exports__ = (() => {
1125
1663
  }
1126
1664
  function checkString(buffer, header, offset = 0) {
1127
1665
  const headerBytes = stringToBytes(header);
1128
- for (let i3 = 0; i3 < headerBytes.length; ++i3) {
1129
- if (headerBytes[i3] !== buffer[i3 + offset]) {
1666
+ for (let i2 = 0; i2 < headerBytes.length; ++i2) {
1667
+ if (headerBytes[i2] !== buffer[i2 + offset]) {
1130
1668
  return false;
1131
1669
  }
1132
1670
  }
@@ -1196,30 +1734,30 @@ var __exports__ = (() => {
1196
1734
  return null;
1197
1735
  }
1198
1736
  const { tableMarkers, sofMarkers } = getJpegMarkers();
1199
- let i3 = 2;
1200
- while (i3 + 9 < dataView.byteLength) {
1201
- const marker = dataView.getUint16(i3, BIG_ENDIAN);
1737
+ let i2 = 2;
1738
+ while (i2 + 9 < dataView.byteLength) {
1739
+ const marker = dataView.getUint16(i2, BIG_ENDIAN);
1202
1740
  if (sofMarkers.has(marker)) {
1203
1741
  return {
1204
1742
  mimeType: "image/jpeg",
1205
- height: dataView.getUint16(i3 + 5, BIG_ENDIAN),
1743
+ height: dataView.getUint16(i2 + 5, BIG_ENDIAN),
1206
1744
  // Number of lines
1207
- width: dataView.getUint16(i3 + 7, BIG_ENDIAN)
1745
+ width: dataView.getUint16(i2 + 7, BIG_ENDIAN)
1208
1746
  // Number of pixels per line
1209
1747
  };
1210
1748
  }
1211
1749
  if (!tableMarkers.has(marker)) {
1212
1750
  return null;
1213
1751
  }
1214
- i3 += 2;
1215
- i3 += dataView.getUint16(i3, BIG_ENDIAN);
1752
+ i2 += 2;
1753
+ i2 += dataView.getUint16(i2, BIG_ENDIAN);
1216
1754
  }
1217
1755
  return null;
1218
1756
  }
1219
1757
  function getJpegMarkers() {
1220
1758
  const tableMarkers = /* @__PURE__ */ new Set([65499, 65476, 65484, 65501, 65534]);
1221
- for (let i3 = 65504; i3 < 65520; ++i3) {
1222
- tableMarkers.add(i3);
1759
+ for (let i2 = 65504; i2 < 65520; ++i2) {
1760
+ tableMarkers.add(i2);
1223
1761
  }
1224
1762
  const sofMarkers = /* @__PURE__ */ new Set([
1225
1763
  65472,
@@ -1323,7 +1861,7 @@ var __exports__ = (() => {
1323
1861
  id: "image",
1324
1862
  module: "images",
1325
1863
  name: "Images",
1326
- version: VERSION,
1864
+ version: VERSION3,
1327
1865
  mimeTypes: MIME_TYPES,
1328
1866
  extensions: EXTENSIONS,
1329
1867
  parse: parseImage,
@@ -1348,9 +1886,9 @@ var __exports__ = (() => {
1348
1886
  let area2 = 0;
1349
1887
  const i0 = DimIndex[plane[0]];
1350
1888
  const i1 = DimIndex[plane[1]];
1351
- for (let i3 = start, j = end - dim; i3 < end; i3 += dim) {
1352
- area2 += (points[i3 + i0] - points[j + i0]) * (points[i3 + i1] + points[j + i1]);
1353
- j = i3;
1889
+ for (let i2 = start, j = end - dim; i2 < end; i2 += dim) {
1890
+ area2 += (points[i2 + i0] - points[j + i0]) * (points[i2 + i1] + points[j + i1]);
1891
+ j = i2;
1354
1892
  }
1355
1893
  return area2 / 2;
1356
1894
  }
@@ -1368,24 +1906,24 @@ var __exports__ = (() => {
1368
1906
  let maxY;
1369
1907
  let minX;
1370
1908
  let minY;
1371
- let x3;
1372
- let y2;
1909
+ let x2;
1910
+ let y;
1373
1911
  if (hasHoles)
1374
1912
  outerNode = eliminateHoles(positions, holeIndices, outerNode, dim, areas, plane);
1375
1913
  if (positions.length > 80 * dim) {
1376
1914
  minX = maxX = positions[0];
1377
1915
  minY = maxY = positions[1];
1378
- for (let i3 = dim; i3 < outerLen; i3 += dim) {
1379
- x3 = positions[i3];
1380
- y2 = positions[i3 + 1];
1381
- if (x3 < minX)
1382
- minX = x3;
1383
- if (y2 < minY)
1384
- minY = y2;
1385
- if (x3 > maxX)
1386
- maxX = x3;
1387
- if (y2 > maxY)
1388
- maxY = y2;
1916
+ for (let i2 = dim; i2 < outerLen; i2 += dim) {
1917
+ x2 = positions[i2];
1918
+ y = positions[i2 + 1];
1919
+ if (x2 < minX)
1920
+ minX = x2;
1921
+ if (y < minY)
1922
+ minY = y;
1923
+ if (x2 > maxX)
1924
+ maxX = x2;
1925
+ if (y > maxY)
1926
+ maxY = y;
1389
1927
  }
1390
1928
  invSize = Math.max(maxX - minX, maxY - minY);
1391
1929
  invSize = invSize !== 0 ? 32767 / invSize : 0;
@@ -1394,7 +1932,7 @@ var __exports__ = (() => {
1394
1932
  return triangles;
1395
1933
  }
1396
1934
  function linkedList(data, start, end, dim, clockwise, area2, plane) {
1397
- let i3;
1935
+ let i2;
1398
1936
  let last;
1399
1937
  if (area2 === void 0) {
1400
1938
  area2 = getPolygonSignedArea(data, {
@@ -1407,11 +1945,11 @@ var __exports__ = (() => {
1407
1945
  let i0 = DimIndex[plane[0]];
1408
1946
  let i1 = DimIndex[plane[1]];
1409
1947
  if (clockwise === area2 < 0) {
1410
- for (i3 = start; i3 < end; i3 += dim)
1411
- last = insertNode(i3, data[i3 + i0], data[i3 + i1], last);
1948
+ for (i2 = start; i2 < end; i2 += dim)
1949
+ last = insertNode(i2, data[i2 + i0], data[i2 + i1], last);
1412
1950
  } else {
1413
- for (i3 = end - dim; i3 >= start; i3 -= dim)
1414
- last = insertNode(i3, data[i3 + i0], data[i3 + i1], last);
1951
+ for (i2 = end - dim; i2 >= start; i2 -= dim)
1952
+ last = insertNode(i2, data[i2 + i0], data[i2 + i1], last);
1415
1953
  }
1416
1954
  if (last && equals(last, last.next)) {
1417
1955
  removeNode(last);
@@ -1575,22 +2113,22 @@ var __exports__ = (() => {
1575
2113
  }
1576
2114
  function eliminateHoles(data, holeIndices, outerNode, dim, areas, plane) {
1577
2115
  const queue = [];
1578
- let i3;
2116
+ let i2;
1579
2117
  let len;
1580
2118
  let start;
1581
2119
  let end;
1582
2120
  let list;
1583
- for (i3 = 0, len = holeIndices.length; i3 < len; i3++) {
1584
- start = holeIndices[i3] * dim;
1585
- end = i3 < len - 1 ? holeIndices[i3 + 1] * dim : data.length;
1586
- list = linkedList(data, start, end, dim, false, areas && areas[i3 + 1], plane);
2121
+ for (i2 = 0, len = holeIndices.length; i2 < len; i2++) {
2122
+ start = holeIndices[i2] * dim;
2123
+ end = i2 < len - 1 ? holeIndices[i2 + 1] * dim : data.length;
2124
+ list = linkedList(data, start, end, dim, false, areas && areas[i2 + 1], plane);
1587
2125
  if (list === list.next)
1588
2126
  list.steiner = true;
1589
2127
  queue.push(getLeftmost(list));
1590
2128
  }
1591
2129
  queue.sort(compareX);
1592
- for (i3 = 0; i3 < queue.length; i3++) {
1593
- outerNode = eliminateHole(queue[i3], outerNode);
2130
+ for (i2 = 0; i2 < queue.length; i2++) {
2131
+ outerNode = eliminateHole(queue[i2], outerNode);
1594
2132
  }
1595
2133
  return outerNode;
1596
2134
  }
@@ -1614,11 +2152,11 @@ var __exports__ = (() => {
1614
2152
  let m;
1615
2153
  do {
1616
2154
  if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
1617
- const x3 = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
1618
- if (x3 <= hx && x3 > qx) {
1619
- qx = x3;
2155
+ const x2 = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
2156
+ if (x2 <= hx && x2 > qx) {
2157
+ qx = x2;
1620
2158
  m = p.x < p.next.x ? p : p.next;
1621
- if (x3 === hx)
2159
+ if (x2 === hx)
1622
2160
  return m;
1623
2161
  }
1624
2162
  }
@@ -1662,7 +2200,7 @@ var __exports__ = (() => {
1662
2200
  }
1663
2201
  function sortLinked(list) {
1664
2202
  let e;
1665
- let i3;
2203
+ let i2;
1666
2204
  let inSize = 1;
1667
2205
  let numMerges;
1668
2206
  let p;
@@ -1679,7 +2217,7 @@ var __exports__ = (() => {
1679
2217
  numMerges++;
1680
2218
  q = p;
1681
2219
  pSize = 0;
1682
- for (i3 = 0; i3 < inSize; i3++) {
2220
+ for (i2 = 0; i2 < inSize; i2++) {
1683
2221
  pSize++;
1684
2222
  q = q.nextZ;
1685
2223
  if (!q)
@@ -1710,18 +2248,18 @@ var __exports__ = (() => {
1710
2248
  } while (numMerges > 1);
1711
2249
  return list;
1712
2250
  }
1713
- function zOrder(x3, y2, minX, minY, invSize) {
1714
- x3 = (x3 - minX) * invSize | 0;
1715
- y2 = (y2 - minY) * invSize | 0;
1716
- x3 = (x3 | x3 << 8) & 16711935;
1717
- x3 = (x3 | x3 << 4) & 252645135;
1718
- x3 = (x3 | x3 << 2) & 858993459;
1719
- x3 = (x3 | x3 << 1) & 1431655765;
1720
- y2 = (y2 | y2 << 8) & 16711935;
1721
- y2 = (y2 | y2 << 4) & 252645135;
1722
- y2 = (y2 | y2 << 2) & 858993459;
1723
- y2 = (y2 | y2 << 1) & 1431655765;
1724
- return x3 | y2 << 1;
2251
+ function zOrder(x2, y, minX, minY, invSize) {
2252
+ x2 = (x2 - minX) * invSize | 0;
2253
+ y = (y - minY) * invSize | 0;
2254
+ x2 = (x2 | x2 << 8) & 16711935;
2255
+ x2 = (x2 | x2 << 4) & 252645135;
2256
+ x2 = (x2 | x2 << 2) & 858993459;
2257
+ x2 = (x2 | x2 << 1) & 1431655765;
2258
+ y = (y | y << 8) & 16711935;
2259
+ y = (y | y << 4) & 252645135;
2260
+ y = (y | y << 2) & 858993459;
2261
+ y = (y | y << 1) & 1431655765;
2262
+ return x2 | y << 1;
1725
2263
  }
1726
2264
  function getLeftmost(start) {
1727
2265
  let p = start;
@@ -1807,8 +2345,8 @@ var __exports__ = (() => {
1807
2345
  b2.prev = bp;
1808
2346
  return b2;
1809
2347
  }
1810
- function insertNode(i3, x3, y2, last) {
1811
- const p = new Vertex(i3, x3, y2);
2348
+ function insertNode(i2, x2, y, last) {
2349
+ const p = new Vertex(i2, x2, y);
1812
2350
  if (!last) {
1813
2351
  p.prev = p;
1814
2352
  p.next = p;
@@ -1829,7 +2367,7 @@ var __exports__ = (() => {
1829
2367
  p.nextZ.prevZ = p.prevZ;
1830
2368
  }
1831
2369
  var Vertex = class {
1832
- constructor(i3, x3, y2) {
2370
+ constructor(i2, x2, y) {
1833
2371
  _defineProperty(this, "i", void 0);
1834
2372
  _defineProperty(this, "x", void 0);
1835
2373
  _defineProperty(this, "y", void 0);
@@ -1839,9 +2377,9 @@ var __exports__ = (() => {
1839
2377
  _defineProperty(this, "prevZ", null);
1840
2378
  _defineProperty(this, "nextZ", null);
1841
2379
  _defineProperty(this, "steiner", false);
1842
- this.i = i3;
1843
- this.x = x3;
1844
- this.y = y2;
2380
+ this.i = i2;
2381
+ this.x = x2;
2382
+ this.y = y;
1845
2383
  }
1846
2384
  };
1847
2385
 
@@ -2010,9 +2548,9 @@ var __exports__ = (() => {
2010
2548
  indexMap.linePosition,
2011
2549
  indexMap.linePosition + nPositions
2012
2550
  );
2013
- for (let i3 = 0, il = geometry.indices.length; i3 < il; ++i3) {
2014
- const start = geometry.indices[i3];
2015
- const end = i3 === il - 1 ? geometry.data.length : geometry.indices[i3 + 1];
2551
+ for (let i2 = 0, il = geometry.indices.length; i2 < il; ++i2) {
2552
+ const start = geometry.indices[i2];
2553
+ const end = i2 === il - 1 ? geometry.data.length : geometry.indices[i2 + 1];
2016
2554
  lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;
2017
2555
  indexMap.linePosition += (end - start) / coordLength;
2018
2556
  }
@@ -2037,12 +2575,12 @@ var __exports__ = (() => {
2037
2575
  const areas = geometry.areas[l];
2038
2576
  const indices = geometry.indices[l];
2039
2577
  const nextIndices = geometry.indices[l + 1];
2040
- for (let i3 = 0, il = indices.length; i3 < il; ++i3) {
2041
- const start = indices[i3];
2042
- const end = i3 === il - 1 ? (
2578
+ for (let i2 = 0, il = indices.length; i2 < il; ++i2) {
2579
+ const start = indices[i2];
2580
+ const end = i2 === il - 1 ? (
2043
2581
  // last line, so either read to:
2044
2582
  nextIndices === void 0 ? geometry.data.length : nextIndices[0]
2045
- ) : indices[i3 + 1];
2583
+ ) : indices[i2 + 1];
2046
2584
  polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
2047
2585
  indexMap.polygonPosition += (end - start) / coordLength;
2048
2586
  }
@@ -2109,11 +2647,11 @@ var __exports__ = (() => {
2109
2647
  }
2110
2648
  return binaryFeatures;
2111
2649
  }
2112
- function fillNumericProperties(object, properties, index, length2) {
2650
+ function fillNumericProperties(object, properties, index, length) {
2113
2651
  for (const numericPropName in object.numericProps) {
2114
2652
  if (numericPropName in properties) {
2115
2653
  const value = properties[numericPropName];
2116
- object.numericProps[numericPropName].fill(value, index, index + length2);
2654
+ object.numericProps[numericPropName].fill(value, index, index + length);
2117
2655
  }
2118
2656
  }
2119
2657
  }
@@ -2126,17 +2664,37 @@ var __exports__ = (() => {
2126
2664
  }
2127
2665
  return props;
2128
2666
  }
2129
- function deduceArrayType(x3, constructor) {
2130
- if (constructor === Array || !Number.isFinite(x3)) {
2667
+ function deduceArrayType(x2, constructor) {
2668
+ if (constructor === Array || !Number.isFinite(x2)) {
2131
2669
  return Array;
2132
2670
  }
2133
- return constructor === Float64Array || Math.fround(x3) !== x3 ? Float64Array : Float32Array;
2671
+ return constructor === Float64Array || Math.fround(x2) !== x2 ? Float64Array : Float32Array;
2134
2672
  }
2135
2673
 
2136
2674
  // ../mvt/src/lib/parse-mvt.ts
2137
2675
  var import_pbf = __toESM(require_pbf(), 1);
2138
2676
 
2139
- // ../mvt/src/helpers/mapbox-util-functions.ts
2677
+ // ../mvt/src/lib/utils/geometry-utils.ts
2678
+ function signedArea(ring) {
2679
+ let sum = 0;
2680
+ for (let i2 = 0, j = ring.length - 1, p1, p2; i2 < ring.length; j = i2++) {
2681
+ p1 = ring[i2];
2682
+ p2 = ring[j];
2683
+ sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);
2684
+ }
2685
+ return sum;
2686
+ }
2687
+ function projectToLngLatFlat(data, tileIndex, extent) {
2688
+ const { x: x2, y, z } = tileIndex;
2689
+ const size = extent * Math.pow(2, z);
2690
+ const x0 = extent * x2;
2691
+ const y0 = extent * y;
2692
+ for (let j = 0, jl = data.length; j < jl; j += 2) {
2693
+ data[j] = (data[j] + x0) * 360 / size - 180;
2694
+ const y2 = 180 - (data[j + 1] + y0) * 360 / size;
2695
+ data[j + 1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
2696
+ }
2697
+ }
2140
2698
  function classifyRings(rings) {
2141
2699
  const len = rings.length;
2142
2700
  if (len <= 1)
@@ -2144,8 +2702,8 @@ var __exports__ = (() => {
2144
2702
  const polygons = [];
2145
2703
  let polygon;
2146
2704
  let ccw;
2147
- for (let i3 = 0; i3 < len; i3++) {
2148
- const area2 = signedArea(rings[i3]);
2705
+ for (let i2 = 0; i2 < len; i2++) {
2706
+ const area2 = signedArea(rings[i2]);
2149
2707
  if (area2 === 0)
2150
2708
  continue;
2151
2709
  if (ccw === void 0)
@@ -2153,293 +2711,15 @@ var __exports__ = (() => {
2153
2711
  if (ccw === area2 < 0) {
2154
2712
  if (polygon)
2155
2713
  polygons.push(polygon);
2156
- polygon = [rings[i3]];
2714
+ polygon = [rings[i2]];
2157
2715
  } else if (polygon)
2158
- polygon.push(rings[i3]);
2716
+ polygon.push(rings[i2]);
2159
2717
  }
2160
2718
  if (polygon)
2161
2719
  polygons.push(polygon);
2162
2720
  return polygons;
2163
2721
  }
2164
- function signedArea(ring) {
2165
- let sum = 0;
2166
- for (let i3 = 0, j = ring.length - 1, p1, p2; i3 < ring.length; j = i3++) {
2167
- p1 = ring[i3];
2168
- p2 = ring[j];
2169
- sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);
2170
- }
2171
- return sum;
2172
- }
2173
- function readFeature(tag, feature, pbf) {
2174
- if (feature && pbf) {
2175
- if (tag === 1)
2176
- feature.id = pbf.readVarint();
2177
- else if (tag === 2)
2178
- readTag(pbf, feature);
2179
- else if (tag === 3)
2180
- feature.type = pbf.readVarint();
2181
- else if (tag === 4)
2182
- feature._geometry = pbf.pos;
2183
- }
2184
- }
2185
- function readTag(pbf, feature) {
2186
- const end = pbf.readVarint() + pbf.pos;
2187
- while (pbf.pos < end) {
2188
- const key = feature._keys[pbf.readVarint()];
2189
- const value = feature._values[pbf.readVarint()];
2190
- feature.properties[key] = value;
2191
- }
2192
- }
2193
-
2194
- // ../mvt/src/lib/mapbox-vector-tile/vector-tile-feature.ts
2195
- var VectorTileFeature = class {
2196
- properties;
2197
- extent;
2198
- type;
2199
- id;
2200
- _pbf;
2201
- _geometry;
2202
- _keys;
2203
- _values;
2204
- static get types() {
2205
- return ["Unknown", "Point", "LineString", "Polygon"];
2206
- }
2207
- constructor(pbf, end, extent, keys, values) {
2208
- this.properties = {};
2209
- this.extent = extent;
2210
- this.type = 0;
2211
- this.id = null;
2212
- this._pbf = pbf;
2213
- this._geometry = -1;
2214
- this._keys = keys;
2215
- this._values = values;
2216
- pbf.readFields(readFeature, this, end);
2217
- }
2218
- // eslint-disable-next-line complexity, max-statements
2219
- loadGeometry() {
2220
- const pbf = this._pbf;
2221
- pbf.pos = this._geometry;
2222
- const end = pbf.readVarint() + pbf.pos;
2223
- let cmd2 = 1;
2224
- let length2 = 0;
2225
- let x3 = 0;
2226
- let y2 = 0;
2227
- const lines = [];
2228
- let line;
2229
- while (pbf.pos < end) {
2230
- if (length2 <= 0) {
2231
- const cmdLen2 = pbf.readVarint();
2232
- cmd2 = cmdLen2 & 7;
2233
- length2 = cmdLen2 >> 3;
2234
- }
2235
- length2--;
2236
- if (cmd2 === 1 || cmd2 === 2) {
2237
- x3 += pbf.readSVarint();
2238
- y2 += pbf.readSVarint();
2239
- if (cmd2 === 1) {
2240
- if (line)
2241
- lines.push(line);
2242
- line = [];
2243
- }
2244
- if (line)
2245
- line.push([x3, y2]);
2246
- } else if (cmd2 === 7) {
2247
- if (line) {
2248
- line.push(line[0].slice());
2249
- }
2250
- } else {
2251
- throw new Error(`unknown command ${cmd2}`);
2252
- }
2253
- }
2254
- if (line)
2255
- lines.push(line);
2256
- return lines;
2257
- }
2258
- // eslint-disable-next-line max-statements
2259
- bbox() {
2260
- const pbf = this._pbf;
2261
- pbf.pos = this._geometry;
2262
- const end = pbf.readVarint() + pbf.pos;
2263
- let cmd2 = 1;
2264
- let length2 = 0;
2265
- let x3 = 0;
2266
- let y2 = 0;
2267
- let x1 = Infinity;
2268
- let x22 = -Infinity;
2269
- let y1 = Infinity;
2270
- let y22 = -Infinity;
2271
- while (pbf.pos < end) {
2272
- if (length2 <= 0) {
2273
- const cmdLen2 = pbf.readVarint();
2274
- cmd2 = cmdLen2 & 7;
2275
- length2 = cmdLen2 >> 3;
2276
- }
2277
- length2--;
2278
- if (cmd2 === 1 || cmd2 === 2) {
2279
- x3 += pbf.readSVarint();
2280
- y2 += pbf.readSVarint();
2281
- if (x3 < x1)
2282
- x1 = x3;
2283
- if (x3 > x22)
2284
- x22 = x3;
2285
- if (y2 < y1)
2286
- y1 = y2;
2287
- if (y2 > y22)
2288
- y22 = y2;
2289
- } else if (cmd2 !== 7) {
2290
- throw new Error(`unknown command ${cmd2}`);
2291
- }
2292
- }
2293
- return [x1, y1, x22, y22];
2294
- }
2295
- _toGeoJSON(transform) {
2296
- let coords = this.loadGeometry();
2297
- let type = VectorTileFeature.types[this.type];
2298
- let i3;
2299
- let j;
2300
- switch (this.type) {
2301
- case 1:
2302
- const points = [];
2303
- for (i3 = 0; i3 < coords.length; i3++) {
2304
- points[i3] = coords[i3][0];
2305
- }
2306
- coords = points;
2307
- transform(coords, this);
2308
- break;
2309
- case 2:
2310
- for (i3 = 0; i3 < coords.length; i3++) {
2311
- transform(coords[i3], this);
2312
- }
2313
- break;
2314
- case 3:
2315
- coords = classifyRings(coords);
2316
- for (i3 = 0; i3 < coords.length; i3++) {
2317
- for (j = 0; j < coords[i3].length; j++) {
2318
- transform(coords[i3][j], this);
2319
- }
2320
- }
2321
- break;
2322
- }
2323
- if (coords.length === 1) {
2324
- coords = coords[0];
2325
- } else {
2326
- type = `Multi${type}`;
2327
- }
2328
- const result = {
2329
- type: "Feature",
2330
- geometry: {
2331
- type,
2332
- coordinates: coords
2333
- },
2334
- properties: this.properties
2335
- };
2336
- if (this.id !== null) {
2337
- result.id = this.id;
2338
- }
2339
- return result;
2340
- }
2341
- toGeoJSON(options) {
2342
- if (typeof options === "function") {
2343
- return this._toGeoJSON(options);
2344
- }
2345
- const { x: x3, y: y2, z } = options;
2346
- const size = this.extent * Math.pow(2, z);
2347
- const x0 = this.extent * x3;
2348
- const y0 = this.extent * y2;
2349
- function project2(line) {
2350
- for (let j = 0; j < line.length; j++) {
2351
- const p = line[j];
2352
- p[0] = (p[0] + x0) * 360 / size - 180;
2353
- const y22 = 180 - (p[1] + y0) * 360 / size;
2354
- p[1] = 360 / Math.PI * Math.atan(Math.exp(y22 * Math.PI / 180)) - 90;
2355
- }
2356
- }
2357
- return this._toGeoJSON(project2);
2358
- }
2359
- };
2360
-
2361
- // ../mvt/src/lib/mapbox-vector-tile/vector-tile-layer.ts
2362
- var VectorTileLayer = class {
2363
- version;
2364
- name;
2365
- extent;
2366
- length;
2367
- _pbf;
2368
- _keys;
2369
- _values;
2370
- _features;
2371
- constructor(pbf, end) {
2372
- this.version = 1;
2373
- this.name = "";
2374
- this.extent = 4096;
2375
- this.length = 0;
2376
- this._pbf = pbf;
2377
- this._keys = [];
2378
- this._values = [];
2379
- this._features = [];
2380
- pbf.readFields(readLayer, this, end);
2381
- this.length = this._features.length;
2382
- }
2383
- /**
2384
- * return feature `i` from this layer as a `VectorTileFeature`
2385
- * @param index
2386
- * @returns feature
2387
- */
2388
- feature(i3) {
2389
- if (i3 < 0 || i3 >= this._features.length) {
2390
- throw new Error("feature index out of bounds");
2391
- }
2392
- this._pbf.pos = this._features[i3];
2393
- const end = this._pbf.readVarint() + this._pbf.pos;
2394
- return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
2395
- }
2396
- };
2397
- function readLayer(tag, layer, pbf) {
2398
- if (layer && pbf) {
2399
- if (tag === 15)
2400
- layer.version = pbf.readVarint();
2401
- else if (tag === 1)
2402
- layer.name = pbf.readString();
2403
- else if (tag === 5)
2404
- layer.extent = pbf.readVarint();
2405
- else if (tag === 2)
2406
- layer._features.push(pbf.pos);
2407
- else if (tag === 3)
2408
- layer._keys.push(pbf.readString());
2409
- else if (tag === 4)
2410
- layer._values.push(readValueMessage(pbf));
2411
- }
2412
- }
2413
- function readValueMessage(pbf) {
2414
- let value = null;
2415
- const end = pbf.readVarint() + pbf.pos;
2416
- while (pbf.pos < end) {
2417
- const tag = pbf.readVarint() >> 3;
2418
- value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
2419
- }
2420
- return value;
2421
- }
2422
-
2423
- // ../mvt/src/lib/mapbox-vector-tile/vector-tile.ts
2424
- var VectorTile = class {
2425
- layers;
2426
- constructor(pbf, end) {
2427
- this.layers = pbf.readFields(readTile, {}, end);
2428
- }
2429
- };
2430
- function readTile(tag, layers, pbf) {
2431
- if (tag === 3) {
2432
- if (pbf) {
2433
- const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
2434
- if (layer.length && layers) {
2435
- layers[layer.name] = layer;
2436
- }
2437
- }
2438
- }
2439
- }
2440
-
2441
- // ../mvt/src/helpers/binary-util-functions.ts
2442
- function classifyRings2(geom) {
2722
+ function classifyRingsFlat(geom) {
2443
2723
  const len = geom.indices.length;
2444
2724
  const type = "Polygon";
2445
2725
  if (len <= 1) {
@@ -2456,9 +2736,9 @@ var __exports__ = (() => {
2456
2736
  let polygon = [];
2457
2737
  let ccw;
2458
2738
  let offset = 0;
2459
- for (let endIndex, i3 = 0, startIndex; i3 < len; i3++) {
2460
- startIndex = geom.indices[i3] - offset;
2461
- endIndex = geom.indices[i3 + 1] - offset || geom.data.length;
2739
+ for (let endIndex, i2 = 0, startIndex; i2 < len; i2++) {
2740
+ startIndex = geom.indices[i2] - offset;
2741
+ endIndex = geom.indices[i2 + 1] - offset || geom.data.length;
2462
2742
  const shape = geom.data.slice(startIndex, endIndex);
2463
2743
  const area2 = getPolygonSignedArea(shape);
2464
2744
  if (area2 === 0) {
@@ -2488,43 +2768,9 @@ var __exports__ = (() => {
2488
2768
  polygons.push(polygon);
2489
2769
  return { type, areas, indices: polygons, data: geom.data };
2490
2770
  }
2491
- function project(data, x0, y0, size) {
2492
- for (let j = 0, jl = data.length; j < jl; j += 2) {
2493
- data[j] = (data[j] + x0) * 360 / size - 180;
2494
- const y2 = 180 - (data[j + 1] + y0) * 360 / size;
2495
- data[j + 1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
2496
- }
2497
- }
2498
- function readFeature2(tag, feature, pbf) {
2499
- if (feature && pbf) {
2500
- if (tag === 1)
2501
- feature.id = pbf.readVarint();
2502
- else if (tag === 2)
2503
- readTag2(pbf, feature);
2504
- else if (tag === 3)
2505
- feature.type = pbf.readVarint();
2506
- else if (tag === 4)
2507
- feature._geometry = pbf.pos;
2508
- }
2509
- }
2510
- function readTag2(pbf, feature) {
2511
- const end = pbf.readVarint() + pbf.pos;
2512
- while (pbf.pos < end) {
2513
- const key = feature._keys[pbf.readVarint()];
2514
- const value = feature._values[pbf.readVarint()];
2515
- feature.properties[key] = value;
2516
- }
2517
- }
2518
2771
 
2519
- // ../mvt/src/lib/binary-vector-tile/vector-tile-feature.ts
2520
- var endPos;
2521
- var cmd;
2522
- var cmdLen;
2523
- var length;
2524
- var x;
2525
- var y;
2526
- var i;
2527
- var BinaryVectorTileFeature = class {
2772
+ // ../mvt/src/lib/vector-tile/vector-tile-feature.ts
2773
+ var VectorTileFeature = class {
2528
2774
  properties;
2529
2775
  extent;
2530
2776
  type;
@@ -2545,54 +2791,86 @@ var __exports__ = (() => {
2545
2791
  this._keys = keys;
2546
2792
  this._values = values;
2547
2793
  this._geometryInfo = geometryInfo;
2548
- pbf.readFields(readFeature2, this, end);
2794
+ pbf.readFields(readFeature, this, end);
2549
2795
  }
2550
- // eslint-disable-next-line complexity, max-statements
2551
- loadGeometry() {
2796
+ toGeoJSON(options) {
2797
+ const coords = this.loadGeometry();
2798
+ if (typeof options === "function") {
2799
+ return _toGeoJSON(this, coords, options);
2800
+ }
2801
+ const { x: x2, y, z } = options;
2802
+ const size = this.extent * Math.pow(2, z);
2803
+ const x0 = this.extent * x2;
2804
+ const y0 = this.extent * y;
2805
+ function project(line) {
2806
+ for (let j = 0; j < line.length; j++) {
2807
+ const p = line[j];
2808
+ p[0] = (p[0] + x0) * 360 / size - 180;
2809
+ const y2 = 180 - (p[1] + y0) * 360 / size;
2810
+ p[1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
2811
+ }
2812
+ }
2813
+ return _toGeoJSON(this, coords, project);
2814
+ }
2815
+ /**
2816
+ *
2817
+ * @param options
2818
+ * @returns
2819
+ */
2820
+ toBinaryCoordinates(options) {
2821
+ if (typeof options === "function") {
2822
+ return this._toBinaryCoordinates(options);
2823
+ }
2824
+ const tileIndex = options;
2825
+ return this._toBinaryCoordinates(
2826
+ (data) => projectToLngLatFlat(data, tileIndex, this.extent)
2827
+ );
2828
+ }
2829
+ // eslint-disable-next-line max-statements
2830
+ bbox() {
2552
2831
  const pbf = this._pbf;
2553
2832
  pbf.pos = this._geometry;
2554
- endPos = pbf.readVarint() + pbf.pos;
2555
- cmd = 1;
2556
- length = 0;
2557
- x = 0;
2558
- y = 0;
2559
- i = 0;
2560
- const indices = [];
2561
- const data = [];
2562
- while (pbf.pos < endPos) {
2833
+ const end = pbf.readVarint() + pbf.pos;
2834
+ let cmd = 1;
2835
+ let length = 0;
2836
+ let x2 = 0;
2837
+ let y = 0;
2838
+ let x1 = Infinity;
2839
+ let x22 = -Infinity;
2840
+ let y1 = Infinity;
2841
+ let y2 = -Infinity;
2842
+ while (pbf.pos < end) {
2563
2843
  if (length <= 0) {
2564
- cmdLen = pbf.readVarint();
2844
+ const cmdLen = pbf.readVarint();
2565
2845
  cmd = cmdLen & 7;
2566
2846
  length = cmdLen >> 3;
2567
2847
  }
2568
2848
  length--;
2569
2849
  if (cmd === 1 || cmd === 2) {
2570
- x += pbf.readSVarint();
2850
+ x2 += pbf.readSVarint();
2571
2851
  y += pbf.readSVarint();
2572
- if (cmd === 1) {
2573
- indices.push(i);
2574
- }
2575
- data.push(x, y);
2576
- i += 2;
2577
- } else if (cmd === 7) {
2578
- if (i > 0) {
2579
- const start = indices[indices.length - 1];
2580
- data.push(data[start], data[start + 1]);
2581
- i += 2;
2582
- }
2583
- } else {
2852
+ if (x2 < x1)
2853
+ x1 = x2;
2854
+ if (x2 > x22)
2855
+ x22 = x2;
2856
+ if (y < y1)
2857
+ y1 = y;
2858
+ if (y > y2)
2859
+ y2 = y;
2860
+ } else if (cmd !== 7) {
2584
2861
  throw new Error(`unknown command ${cmd}`);
2585
2862
  }
2586
2863
  }
2587
- return { data, indices };
2864
+ return [x1, y1, x22, y2];
2588
2865
  }
2866
+ // BINARY HELPERS
2589
2867
  /**
2590
2868
  *
2591
2869
  * @param transform
2592
2870
  * @returns result
2593
2871
  */
2594
2872
  _toBinaryCoordinates(transform) {
2595
- const geom = this.loadGeometry();
2873
+ const geom = this.loadFlatGeometry();
2596
2874
  let geometry;
2597
2875
  transform(geom.data, this);
2598
2876
  const coordLength = 2;
@@ -2609,7 +2887,7 @@ var __exports__ = (() => {
2609
2887
  geometry = { type: "LineString", ...geom };
2610
2888
  break;
2611
2889
  case 3:
2612
- geometry = classifyRings2(geom);
2890
+ geometry = classifyRingsFlat(geom);
2613
2891
  this._geometryInfo.polygonFeaturesCount++;
2614
2892
  this._geometryInfo.polygonObjectsCount += geometry.indices.length;
2615
2893
  for (const indices of geometry.indices) {
@@ -2626,20 +2904,165 @@ var __exports__ = (() => {
2626
2904
  }
2627
2905
  return result;
2628
2906
  }
2629
- toBinaryCoordinates(options) {
2630
- if (typeof options === "function") {
2631
- return this._toBinaryCoordinates(options);
2907
+ // GEOJSON HELPER
2908
+ // eslint-disable-next-line complexity, max-statements
2909
+ loadGeometry() {
2910
+ const pbf = this._pbf;
2911
+ pbf.pos = this._geometry;
2912
+ const end = pbf.readVarint() + pbf.pos;
2913
+ let cmd = 1;
2914
+ let length = 0;
2915
+ let x2 = 0;
2916
+ let y = 0;
2917
+ const lines = [];
2918
+ let line;
2919
+ while (pbf.pos < end) {
2920
+ if (length <= 0) {
2921
+ const cmdLen = pbf.readVarint();
2922
+ cmd = cmdLen & 7;
2923
+ length = cmdLen >> 3;
2924
+ }
2925
+ length--;
2926
+ switch (cmd) {
2927
+ case 1:
2928
+ case 2:
2929
+ x2 += pbf.readSVarint();
2930
+ y += pbf.readSVarint();
2931
+ if (cmd === 1) {
2932
+ if (line)
2933
+ lines.push(line);
2934
+ line = [];
2935
+ }
2936
+ if (line)
2937
+ line.push([x2, y]);
2938
+ break;
2939
+ case 7:
2940
+ if (line) {
2941
+ line.push(line[0].slice());
2942
+ }
2943
+ break;
2944
+ default:
2945
+ throw new Error(`unknown command ${cmd}`);
2946
+ }
2632
2947
  }
2633
- const { x: x3, y: y2, z } = options;
2634
- const size = this.extent * Math.pow(2, z);
2635
- const x0 = this.extent * x3;
2636
- const y0 = this.extent * y2;
2637
- return this._toBinaryCoordinates((data) => project(data, x0, y0, size));
2948
+ if (line)
2949
+ lines.push(line);
2950
+ return lines;
2951
+ }
2952
+ // eslint-disable-next-line complexity, max-statements
2953
+ loadFlatGeometry() {
2954
+ const pbf = this._pbf;
2955
+ pbf.pos = this._geometry;
2956
+ const endPos = pbf.readVarint() + pbf.pos;
2957
+ let cmd = 1;
2958
+ let cmdLen;
2959
+ let length = 0;
2960
+ let x2 = 0;
2961
+ let y = 0;
2962
+ let i2 = 0;
2963
+ const indices = [];
2964
+ const data = [];
2965
+ while (pbf.pos < endPos) {
2966
+ if (length <= 0) {
2967
+ cmdLen = pbf.readVarint();
2968
+ cmd = cmdLen & 7;
2969
+ length = cmdLen >> 3;
2970
+ }
2971
+ length--;
2972
+ if (cmd === 1 || cmd === 2) {
2973
+ x2 += pbf.readSVarint();
2974
+ y += pbf.readSVarint();
2975
+ if (cmd === 1) {
2976
+ indices.push(i2);
2977
+ }
2978
+ data.push(x2, y);
2979
+ i2 += 2;
2980
+ } else if (cmd === 7) {
2981
+ if (i2 > 0) {
2982
+ const start = indices[indices.length - 1];
2983
+ data.push(data[start], data[start + 1]);
2984
+ i2 += 2;
2985
+ }
2986
+ } else {
2987
+ throw new Error(`unknown command ${cmd}`);
2988
+ }
2989
+ }
2990
+ return { data, indices };
2638
2991
  }
2639
2992
  };
2993
+ __publicField(VectorTileFeature, "types", ["Unknown", "Point", "LineString", "Polygon"]);
2994
+ function _toGeoJSON(vtFeature, coords, transform) {
2995
+ let type = VectorTileFeature.types[vtFeature.type];
2996
+ let i2;
2997
+ let j;
2998
+ let coordinates;
2999
+ switch (vtFeature.type) {
3000
+ case 1:
3001
+ const points = [];
3002
+ for (i2 = 0; i2 < coords.length; i2++) {
3003
+ points[i2] = coords[i2][0];
3004
+ }
3005
+ coordinates = points;
3006
+ transform(coordinates, vtFeature);
3007
+ break;
3008
+ case 2:
3009
+ coordinates = coords;
3010
+ for (i2 = 0; i2 < coordinates.length; i2++) {
3011
+ transform(coordinates[i2], vtFeature);
3012
+ }
3013
+ break;
3014
+ case 3:
3015
+ coordinates = classifyRings(coords);
3016
+ for (i2 = 0; i2 < coordinates.length; i2++) {
3017
+ for (j = 0; j < coordinates[i2].length; j++) {
3018
+ transform(coordinates[i2][j], vtFeature);
3019
+ }
3020
+ }
3021
+ break;
3022
+ default:
3023
+ throw new Error("illegal vector tile type");
3024
+ }
3025
+ if (coordinates.length === 1) {
3026
+ coordinates = coordinates[0];
3027
+ } else {
3028
+ type = `Multi${type}`;
3029
+ }
3030
+ const result = {
3031
+ type: "Feature",
3032
+ geometry: {
3033
+ type,
3034
+ coordinates
3035
+ },
3036
+ properties: vtFeature.properties
3037
+ };
3038
+ if (vtFeature.id !== null) {
3039
+ result.id = vtFeature.id;
3040
+ }
3041
+ return result;
3042
+ }
3043
+ function readFeature(tag, feature, pbf) {
3044
+ if (feature && pbf) {
3045
+ if (tag === 1)
3046
+ feature.id = pbf.readVarint();
3047
+ else if (tag === 2)
3048
+ readTag(pbf, feature);
3049
+ else if (tag === 3)
3050
+ feature.type = pbf.readVarint();
3051
+ else if (tag === 4)
3052
+ feature._geometry = pbf.pos;
3053
+ }
3054
+ }
3055
+ function readTag(pbf, feature) {
3056
+ const end = pbf.readVarint() + pbf.pos;
3057
+ while (pbf.pos < end) {
3058
+ const key = feature._keys[pbf.readVarint()];
3059
+ const value = feature._values[pbf.readVarint()];
3060
+ feature.properties[key] = value;
3061
+ }
3062
+ }
2640
3063
 
2641
- // ../mvt/src/lib/binary-vector-tile/vector-tile-layer.ts
2642
- var BinaryVectorTileLayer = class {
3064
+ // ../mvt/src/lib/vector-tile/vector-tile-layer.ts
3065
+ var VectorTileLayer = class {
2643
3066
  version;
2644
3067
  name;
2645
3068
  extent;
@@ -2657,23 +3080,36 @@ var __exports__ = (() => {
2657
3080
  this._keys = [];
2658
3081
  this._values = [];
2659
3082
  this._features = [];
2660
- pbf.readFields(readLayer2, this, end);
3083
+ pbf.readFields(readLayer, this, end);
2661
3084
  this.length = this._features.length;
2662
3085
  }
2663
3086
  /**
2664
- * return feature `i` from this layer as a `BinaryVectorTileFeature`
3087
+ * return feature `i` from this layer as a `VectorTileFeature`
3088
+ * @param index
3089
+ * @returns feature
3090
+ */
3091
+ getGeoJSONFeature(i2) {
3092
+ if (i2 < 0 || i2 >= this._features.length) {
3093
+ throw new Error("feature index out of bounds");
3094
+ }
3095
+ this._pbf.pos = this._features[i2];
3096
+ const end = this._pbf.readVarint() + this._pbf.pos;
3097
+ return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
3098
+ }
3099
+ /**
3100
+ * return binary feature `i` from this layer as a `VectorTileFeature`
2665
3101
  *
2666
3102
  * @param index
2667
3103
  * @param geometryInfo
2668
- * @returns {BinaryVectorTileFeature}
3104
+ * @returns binary feature
2669
3105
  */
2670
- feature(i3, geometryInfo) {
2671
- if (i3 < 0 || i3 >= this._features.length) {
3106
+ getBinaryFeature(i2, geometryInfo) {
3107
+ if (i2 < 0 || i2 >= this._features.length) {
2672
3108
  throw new Error("feature index out of bounds");
2673
3109
  }
2674
- this._pbf.pos = this._features[i3];
3110
+ this._pbf.pos = this._features[i2];
2675
3111
  const end = this._pbf.readVarint() + this._pbf.pos;
2676
- return new BinaryVectorTileFeature(
3112
+ return new VectorTileFeature(
2677
3113
  this._pbf,
2678
3114
  end,
2679
3115
  this.extent,
@@ -2683,7 +3119,7 @@ var __exports__ = (() => {
2683
3119
  );
2684
3120
  }
2685
3121
  };
2686
- function readLayer2(tag, layer, pbf) {
3122
+ function readLayer(tag, layer, pbf) {
2687
3123
  if (layer && pbf) {
2688
3124
  if (tag === 15)
2689
3125
  layer.version = pbf.readVarint();
@@ -2696,10 +3132,10 @@ var __exports__ = (() => {
2696
3132
  else if (tag === 3)
2697
3133
  layer._keys.push(pbf.readString());
2698
3134
  else if (tag === 4)
2699
- layer._values.push(readValueMessage2(pbf));
3135
+ layer._values.push(readValueMessage(pbf));
2700
3136
  }
2701
3137
  }
2702
- function readValueMessage2(pbf) {
3138
+ function readValueMessage(pbf) {
2703
3139
  let value = null;
2704
3140
  const end = pbf.readVarint() + pbf.pos;
2705
3141
  while (pbf.pos < end) {
@@ -2709,17 +3145,17 @@ var __exports__ = (() => {
2709
3145
  return value;
2710
3146
  }
2711
3147
 
2712
- // ../mvt/src/lib/binary-vector-tile/vector-tile.ts
2713
- var BinaryVectorTile = class {
3148
+ // ../mvt/src/lib/vector-tile/vector-tile.ts
3149
+ var VectorTile = class {
2714
3150
  layers;
2715
3151
  constructor(pbf, end) {
2716
- this.layers = pbf.readFields(readTile2, {}, end);
3152
+ this.layers = pbf.readFields(readTile, {}, end);
2717
3153
  }
2718
3154
  };
2719
- function readTile2(tag, layers, pbf) {
3155
+ function readTile(tag, layers, pbf) {
2720
3156
  if (tag === 3) {
2721
3157
  if (pbf) {
2722
- const layer = new BinaryVectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
3158
+ const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
2723
3159
  if (layer.length && layers) {
2724
3160
  layers[layer.name] = layer;
2725
3161
  }
@@ -2729,7 +3165,7 @@ var __exports__ = (() => {
2729
3165
 
2730
3166
  // ../mvt/src/lib/parse-mvt.ts
2731
3167
  function parseMVT(arrayBuffer, options) {
2732
- const mvtOptions = normalizeOptions(options);
3168
+ const mvtOptions = checkOptions(options);
2733
3169
  const shape = options?.gis?.format || options?.mvt?.shape || options?.shape;
2734
3170
  switch (shape) {
2735
3171
  case "columnar-table":
@@ -2775,15 +3211,15 @@ var __exports__ = (() => {
2775
3211
  if (arrayBuffer.byteLength <= 0) {
2776
3212
  return [features, geometryInfo];
2777
3213
  }
2778
- const tile = new BinaryVectorTile(new import_pbf.default(arrayBuffer));
3214
+ const tile = new VectorTile(new import_pbf.default(arrayBuffer));
2779
3215
  const selectedLayers = options && Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);
2780
3216
  selectedLayers.forEach((layerName) => {
2781
3217
  const vectorTileLayer = tile.layers[layerName];
2782
3218
  if (!vectorTileLayer) {
2783
3219
  return;
2784
3220
  }
2785
- for (let i3 = 0; i3 < vectorTileLayer.length; i3++) {
2786
- const vectorTileFeature = vectorTileLayer.feature(i3, geometryInfo);
3221
+ for (let i2 = 0; i2 < vectorTileLayer.length; i2++) {
3222
+ const vectorTileFeature = vectorTileLayer.getBinaryFeature(i2, geometryInfo);
2787
3223
  const decodedFeature = getDecodedFeatureBinary(vectorTileFeature, options, layerName);
2788
3224
  features.push(decodedFeature);
2789
3225
  }
@@ -2802,24 +3238,24 @@ var __exports__ = (() => {
2802
3238
  if (!vectorTileLayer) {
2803
3239
  return;
2804
3240
  }
2805
- for (let i3 = 0; i3 < vectorTileLayer.length; i3++) {
2806
- const vectorTileFeature = vectorTileLayer.feature(i3);
3241
+ for (let i2 = 0; i2 < vectorTileLayer.length; i2++) {
3242
+ const vectorTileFeature = vectorTileLayer.getGeoJSONFeature(i2);
2807
3243
  const decodedFeature = getDecodedFeature(vectorTileFeature, options, layerName);
2808
3244
  features.push(decodedFeature);
2809
3245
  }
2810
3246
  });
2811
3247
  return features;
2812
3248
  }
2813
- function normalizeOptions(options) {
3249
+ function checkOptions(options) {
2814
3250
  if (!options?.mvt) {
2815
3251
  throw new Error("mvt options required");
2816
3252
  }
2817
- const wgs84Coordinates = options.mvt?.coordinates === "wgs84";
2818
- const { tileIndex } = options.mvt;
2819
- const hasTileIndex = tileIndex && Number.isFinite(tileIndex.x) && Number.isFinite(tileIndex.y) && Number.isFinite(tileIndex.z);
2820
- if (wgs84Coordinates && !hasTileIndex) {
3253
+ if (options.mvt?.coordinates === "wgs84" && !options.mvt.tileIndex) {
2821
3254
  throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");
2822
3255
  }
3256
+ if (options.gis) {
3257
+ log.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')();
3258
+ }
2823
3259
  return options.mvt;
2824
3260
  }
2825
3261
  function getDecodedFeature(feature, options, layerName) {
@@ -2828,6 +3264,7 @@ var __exports__ = (() => {
2828
3264
  options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinates
2829
3265
  );
2830
3266
  if (options.layerProperty) {
3267
+ decodedFeature.properties ||= {};
2831
3268
  decodedFeature.properties[options.layerProperty] = layerName;
2832
3269
  }
2833
3270
  return decodedFeature;
@@ -2844,28 +3281,28 @@ var __exports__ = (() => {
2844
3281
  }
2845
3282
  function transformToLocalCoordinates(line, feature) {
2846
3283
  const { extent } = feature;
2847
- for (let i3 = 0; i3 < line.length; i3++) {
2848
- const p = line[i3];
3284
+ for (let i2 = 0; i2 < line.length; i2++) {
3285
+ const p = line[i2];
2849
3286
  p[0] /= extent;
2850
3287
  p[1] /= extent;
2851
3288
  }
2852
3289
  }
2853
3290
  function transformToLocalCoordinatesBinary(data, feature) {
2854
3291
  const { extent } = feature;
2855
- for (let i3 = 0, il = data.length; i3 < il; ++i3) {
2856
- data[i3] /= extent;
3292
+ for (let i2 = 0, il = data.length; i2 < il; ++i2) {
3293
+ data[i2] /= extent;
2857
3294
  }
2858
3295
  }
2859
3296
 
2860
3297
  // ../mvt/src/mvt-loader.ts
2861
- var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3298
+ var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2862
3299
  var MVTWorkerLoader = {
2863
3300
  dataType: null,
2864
3301
  batchType: null,
2865
3302
  name: "Mapbox Vector Tile",
2866
3303
  id: "mvt",
2867
3304
  module: "mvt",
2868
- version: VERSION2,
3305
+ version: VERSION4,
2869
3306
  // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'
2870
3307
  extensions: ["mvt", "pbf"],
2871
3308
  mimeTypes: [
@@ -2882,7 +3319,7 @@ var __exports__ = (() => {
2882
3319
  coordinates: "local",
2883
3320
  layerProperty: "layerName",
2884
3321
  layers: void 0,
2885
- tileIndex: null
3322
+ tileIndex: void 0
2886
3323
  }
2887
3324
  }
2888
3325
  };
@@ -2894,7 +3331,7 @@ var __exports__ = (() => {
2894
3331
  };
2895
3332
 
2896
3333
  // ../mvt/src/lib/parse-tilejson.ts
2897
- var isObject = (x3) => x3 !== null && typeof x3 === "object";
3334
+ var isObject = (x2) => x2 !== null && typeof x2 === "object";
2898
3335
  function parseTileJSON(jsonMetadata, options) {
2899
3336
  if (!jsonMetadata || !isObject(jsonMetadata)) {
2900
3337
  return null;
@@ -3098,14 +3535,14 @@ var __exports__ = (() => {
3098
3535
  }
3099
3536
 
3100
3537
  // ../mvt/src/tilejson-loader.ts
3101
- var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3538
+ var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3102
3539
  var TileJSONLoader = {
3103
3540
  dataType: null,
3104
3541
  batchType: null,
3105
3542
  name: "TileJSON",
3106
3543
  id: "tilejson",
3107
3544
  module: "pmtiles",
3108
- version: VERSION3,
3545
+ version: VERSION5,
3109
3546
  worker: true,
3110
3547
  extensions: ["json"],
3111
3548
  mimeTypes: ["application/json"],
@@ -3165,7 +3602,7 @@ var __exports__ = (() => {
3165
3602
  reject(e);
3166
3603
  }
3167
3604
  };
3168
- var step = (x3) => x3.done ? resolve(x3.value) : Promise.resolve(x3.value).then(fulfilled, rejected);
3605
+ var step = (x2) => x2.done ? resolve(x2.value) : Promise.resolve(x2.value).then(fulfilled, rejected);
3169
3606
  step((generator = generator.apply(__this, __arguments)).next());
3170
3607
  });
3171
3608
  };
@@ -3246,13 +3683,13 @@ var __exports__ = (() => {
3246
3683
  var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
3247
3684
  var freb = function(eb, start) {
3248
3685
  var b = new u16(31);
3249
- for (var i3 = 0; i3 < 31; ++i3) {
3250
- b[i3] = start += 1 << eb[i3 - 1];
3686
+ for (var i2 = 0; i2 < 31; ++i2) {
3687
+ b[i2] = start += 1 << eb[i2 - 1];
3251
3688
  }
3252
3689
  var r = new i32(b[30]);
3253
- for (var i3 = 1; i3 < 30; ++i3) {
3254
- for (var j = b[i3]; j < b[i3 + 1]; ++j) {
3255
- r[j] = j - b[i3] << 5 | i3;
3690
+ for (var i2 = 1; i2 < 30; ++i2) {
3691
+ for (var j = b[i2]; j < b[i2 + 1]; ++j) {
3692
+ r[j] = j - b[i2] << 5 | i2;
3256
3693
  }
3257
3694
  }
3258
3695
  return { b, r };
@@ -3265,35 +3702,35 @@ var __exports__ = (() => {
3265
3702
  var fd = _b.b;
3266
3703
  var revfd = _b.r;
3267
3704
  var rev = new u16(32768);
3268
- for (i2 = 0; i2 < 32768; ++i2) {
3269
- x2 = (i2 & 43690) >> 1 | (i2 & 21845) << 1;
3270
- x2 = (x2 & 52428) >> 2 | (x2 & 13107) << 2;
3271
- x2 = (x2 & 61680) >> 4 | (x2 & 3855) << 4;
3272
- rev[i2] = ((x2 & 65280) >> 8 | (x2 & 255) << 8) >> 1;
3273
- }
3274
- var x2;
3275
- var i2;
3705
+ for (i = 0; i < 32768; ++i) {
3706
+ x = (i & 43690) >> 1 | (i & 21845) << 1;
3707
+ x = (x & 52428) >> 2 | (x & 13107) << 2;
3708
+ x = (x & 61680) >> 4 | (x & 3855) << 4;
3709
+ rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
3710
+ }
3711
+ var x;
3712
+ var i;
3276
3713
  var hMap = function(cd, mb, r) {
3277
3714
  var s = cd.length;
3278
- var i3 = 0;
3715
+ var i2 = 0;
3279
3716
  var l = new u16(mb);
3280
- for (; i3 < s; ++i3) {
3281
- if (cd[i3])
3282
- ++l[cd[i3] - 1];
3717
+ for (; i2 < s; ++i2) {
3718
+ if (cd[i2])
3719
+ ++l[cd[i2] - 1];
3283
3720
  }
3284
3721
  var le = new u16(mb);
3285
- for (i3 = 1; i3 < mb; ++i3) {
3286
- le[i3] = le[i3 - 1] + l[i3 - 1] << 1;
3722
+ for (i2 = 1; i2 < mb; ++i2) {
3723
+ le[i2] = le[i2 - 1] + l[i2 - 1] << 1;
3287
3724
  }
3288
3725
  var co;
3289
3726
  if (r) {
3290
3727
  co = new u16(1 << mb);
3291
3728
  var rvb = 15 - mb;
3292
- for (i3 = 0; i3 < s; ++i3) {
3293
- if (cd[i3]) {
3294
- var sv = i3 << 4 | cd[i3];
3295
- var r_1 = mb - cd[i3];
3296
- var v = le[cd[i3] - 1]++ << r_1;
3729
+ for (i2 = 0; i2 < s; ++i2) {
3730
+ if (cd[i2]) {
3731
+ var sv = i2 << 4 | cd[i2];
3732
+ var r_1 = mb - cd[i2];
3733
+ var v = le[cd[i2] - 1]++ << r_1;
3297
3734
  for (var m = v | (1 << r_1) - 1; v <= m; ++v) {
3298
3735
  co[rev[v] >> rvb] = sv;
3299
3736
  }
@@ -3301,38 +3738,38 @@ var __exports__ = (() => {
3301
3738
  }
3302
3739
  } else {
3303
3740
  co = new u16(s);
3304
- for (i3 = 0; i3 < s; ++i3) {
3305
- if (cd[i3]) {
3306
- co[i3] = rev[le[cd[i3] - 1]++] >> 15 - cd[i3];
3741
+ for (i2 = 0; i2 < s; ++i2) {
3742
+ if (cd[i2]) {
3743
+ co[i2] = rev[le[cd[i2] - 1]++] >> 15 - cd[i2];
3307
3744
  }
3308
3745
  }
3309
3746
  }
3310
3747
  return co;
3311
3748
  };
3312
3749
  var flt = new u8(288);
3313
- for (i2 = 0; i2 < 144; ++i2)
3314
- flt[i2] = 8;
3315
- var i2;
3316
- for (i2 = 144; i2 < 256; ++i2)
3317
- flt[i2] = 9;
3318
- var i2;
3319
- for (i2 = 256; i2 < 280; ++i2)
3320
- flt[i2] = 7;
3321
- var i2;
3322
- for (i2 = 280; i2 < 288; ++i2)
3323
- flt[i2] = 8;
3324
- var i2;
3750
+ for (i = 0; i < 144; ++i)
3751
+ flt[i] = 8;
3752
+ var i;
3753
+ for (i = 144; i < 256; ++i)
3754
+ flt[i] = 9;
3755
+ var i;
3756
+ for (i = 256; i < 280; ++i)
3757
+ flt[i] = 7;
3758
+ var i;
3759
+ for (i = 280; i < 288; ++i)
3760
+ flt[i] = 8;
3761
+ var i;
3325
3762
  var fdt = new u8(32);
3326
- for (i2 = 0; i2 < 32; ++i2)
3327
- fdt[i2] = 5;
3328
- var i2;
3763
+ for (i = 0; i < 32; ++i)
3764
+ fdt[i] = 5;
3765
+ var i;
3329
3766
  var flrm = /* @__PURE__ */ hMap(flt, 9, 1);
3330
3767
  var fdrm = /* @__PURE__ */ hMap(fdt, 5, 1);
3331
3768
  var max = function(a) {
3332
3769
  var m = a[0];
3333
- for (var i3 = 1; i3 < a.length; ++i3) {
3334
- if (a[i3] > m)
3335
- m = a[i3];
3770
+ for (var i2 = 1; i2 < a.length; ++i2) {
3771
+ if (a[i2] > m)
3772
+ m = a[i2];
3336
3773
  }
3337
3774
  return m;
3338
3775
  };
@@ -3425,28 +3862,28 @@ var __exports__ = (() => {
3425
3862
  pos += 14;
3426
3863
  var ldt = new u8(tl);
3427
3864
  var clt = new u8(19);
3428
- for (var i3 = 0; i3 < hcLen; ++i3) {
3429
- clt[clim[i3]] = bits(dat, pos + i3 * 3, 7);
3865
+ for (var i2 = 0; i2 < hcLen; ++i2) {
3866
+ clt[clim[i2]] = bits(dat, pos + i2 * 3, 7);
3430
3867
  }
3431
3868
  pos += hcLen * 3;
3432
3869
  var clb = max(clt), clbmsk = (1 << clb) - 1;
3433
3870
  var clm = hMap(clt, clb, 1);
3434
- for (var i3 = 0; i3 < tl; ) {
3871
+ for (var i2 = 0; i2 < tl; ) {
3435
3872
  var r = clm[bits(dat, pos, clbmsk)];
3436
3873
  pos += r & 15;
3437
3874
  var s = r >> 4;
3438
3875
  if (s < 16) {
3439
- ldt[i3++] = s;
3876
+ ldt[i2++] = s;
3440
3877
  } else {
3441
3878
  var c = 0, n = 0;
3442
3879
  if (s == 16)
3443
- n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i3 - 1];
3880
+ n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i2 - 1];
3444
3881
  else if (s == 17)
3445
3882
  n = 3 + bits(dat, pos, 7), pos += 3;
3446
3883
  else if (s == 18)
3447
3884
  n = 11 + bits(dat, pos, 127), pos += 7;
3448
3885
  while (n--)
3449
- ldt[i3++] = c;
3886
+ ldt[i2++] = c;
3450
3887
  }
3451
3888
  }
3452
3889
  var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
@@ -3484,8 +3921,8 @@ var __exports__ = (() => {
3484
3921
  } else {
3485
3922
  var add = sym - 254;
3486
3923
  if (sym > 264) {
3487
- var i3 = sym - 257, b = fleb[i3];
3488
- add = bits(dat, pos, (1 << b) - 1) + fl[i3];
3924
+ var i2 = sym - 257, b = fleb[i2];
3925
+ add = bits(dat, pos, (1 << b) - 1) + fl[i2];
3489
3926
  pos += b;
3490
3927
  }
3491
3928
  var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
@@ -3584,24 +4021,24 @@ var __exports__ = (() => {
3584
4021
  var getUint48 = (view, pos) => {
3585
4022
  return shift(view.getUint32(pos + 2, true), 16) + view.getUint16(pos, true);
3586
4023
  };
3587
- var compare = (tz, tx, ty, view, i3) => {
3588
- if (tz !== view.getUint8(i3))
3589
- return tz - view.getUint8(i3);
3590
- const x3 = getUint24(view, i3 + 1);
3591
- if (tx !== x3)
3592
- return tx - x3;
3593
- const y2 = getUint24(view, i3 + 4);
3594
- if (ty !== y2)
3595
- return ty - y2;
4024
+ var compare = (tz, tx, ty, view, i2) => {
4025
+ if (tz !== view.getUint8(i2))
4026
+ return tz - view.getUint8(i2);
4027
+ const x2 = getUint24(view, i2 + 1);
4028
+ if (tx !== x2)
4029
+ return tx - x2;
4030
+ const y = getUint24(view, i2 + 4);
4031
+ if (ty !== y)
4032
+ return ty - y;
3596
4033
  return 0;
3597
4034
  };
3598
- var queryLeafdir = (view, z, x3, y2) => {
3599
- const offsetLen = queryView(view, z | 128, x3, y2);
4035
+ var queryLeafdir = (view, z, x2, y) => {
4036
+ const offsetLen = queryView(view, z | 128, x2, y);
3600
4037
  if (offsetLen) {
3601
4038
  return {
3602
4039
  z,
3603
- x: x3,
3604
- y: y2,
4040
+ x: x2,
4041
+ y,
3605
4042
  offset: offsetLen[0],
3606
4043
  length: offsetLen[1],
3607
4044
  isDir: true
@@ -3609,13 +4046,13 @@ var __exports__ = (() => {
3609
4046
  }
3610
4047
  return null;
3611
4048
  };
3612
- var queryTile = (view, z, x3, y2) => {
3613
- const offsetLen = queryView(view, z, x3, y2);
4049
+ var queryTile = (view, z, x2, y) => {
4050
+ const offsetLen = queryView(view, z, x2, y);
3614
4051
  if (offsetLen) {
3615
4052
  return {
3616
4053
  z,
3617
- x: x3,
3618
- y: y2,
4054
+ x: x2,
4055
+ y,
3619
4056
  offset: offsetLen[0],
3620
4057
  length: offsetLen[1],
3621
4058
  isDir: false
@@ -3623,12 +4060,12 @@ var __exports__ = (() => {
3623
4060
  }
3624
4061
  return null;
3625
4062
  };
3626
- var queryView = (view, z, x3, y2) => {
4063
+ var queryView = (view, z, x2, y) => {
3627
4064
  let m = 0;
3628
4065
  let n = view.byteLength / 17 - 1;
3629
4066
  while (m <= n) {
3630
4067
  const k = n + m >> 1;
3631
- const cmp = compare(z, x3, y2, view, k * 17);
4068
+ const cmp = compare(z, x2, y, view, k * 17);
3632
4069
  if (cmp > 0) {
3633
4070
  m = k + 1;
3634
4071
  } else if (cmp < 0) {
@@ -3654,23 +4091,23 @@ var __exports__ = (() => {
3654
4091
  }
3655
4092
  return a.y - b.y;
3656
4093
  };
3657
- var parseEntry = (dataview, i3) => {
3658
- const zRaw = dataview.getUint8(i3 * 17);
4094
+ var parseEntry = (dataview, i2) => {
4095
+ const zRaw = dataview.getUint8(i2 * 17);
3659
4096
  const z = zRaw & 127;
3660
4097
  return {
3661
4098
  z,
3662
- x: getUint24(dataview, i3 * 17 + 1),
3663
- y: getUint24(dataview, i3 * 17 + 4),
3664
- offset: getUint48(dataview, i3 * 17 + 7),
3665
- length: dataview.getUint32(i3 * 17 + 13, true),
4099
+ x: getUint24(dataview, i2 * 17 + 1),
4100
+ y: getUint24(dataview, i2 * 17 + 4),
4101
+ offset: getUint48(dataview, i2 * 17 + 7),
4102
+ length: dataview.getUint32(i2 * 17 + 13, true),
3666
4103
  isDir: zRaw >> 7 === 1
3667
4104
  };
3668
4105
  };
3669
4106
  var sortDir = (a) => {
3670
4107
  const entries = [];
3671
4108
  const view = new DataView(a);
3672
- for (let i3 = 0; i3 < view.byteLength / 17; i3++) {
3673
- entries.push(parseEntry(view, i3));
4109
+ for (let i2 = 0; i2 < view.byteLength / 17; i2++) {
4110
+ entries.push(parseEntry(view, i2));
3674
4111
  }
3675
4112
  return createDirectory(entries);
3676
4113
  };
@@ -3678,28 +4115,28 @@ var __exports__ = (() => {
3678
4115
  entries.sort(entrySort);
3679
4116
  const buffer = new ArrayBuffer(17 * entries.length);
3680
4117
  const arr = new Uint8Array(buffer);
3681
- for (let i3 = 0; i3 < entries.length; i3++) {
3682
- const entry = entries[i3];
4118
+ for (let i2 = 0; i2 < entries.length; i2++) {
4119
+ const entry = entries[i2];
3683
4120
  let z = entry.z;
3684
4121
  if (entry.isDir)
3685
4122
  z = z | 128;
3686
- arr[i3 * 17] = z;
3687
- arr[i3 * 17 + 1] = entry.x & 255;
3688
- arr[i3 * 17 + 2] = entry.x >> 8 & 255;
3689
- arr[i3 * 17 + 3] = entry.x >> 16 & 255;
3690
- arr[i3 * 17 + 4] = entry.y & 255;
3691
- arr[i3 * 17 + 5] = entry.y >> 8 & 255;
3692
- arr[i3 * 17 + 6] = entry.y >> 16 & 255;
3693
- arr[i3 * 17 + 7] = entry.offset & 255;
3694
- arr[i3 * 17 + 8] = unshift(entry.offset, 8) & 255;
3695
- arr[i3 * 17 + 9] = unshift(entry.offset, 16) & 255;
3696
- arr[i3 * 17 + 10] = unshift(entry.offset, 24) & 255;
3697
- arr[i3 * 17 + 11] = unshift(entry.offset, 32) & 255;
3698
- arr[i3 * 17 + 12] = unshift(entry.offset, 48) & 255;
3699
- arr[i3 * 17 + 13] = entry.length & 255;
3700
- arr[i3 * 17 + 14] = entry.length >> 8 & 255;
3701
- arr[i3 * 17 + 15] = entry.length >> 16 & 255;
3702
- arr[i3 * 17 + 16] = entry.length >> 24 & 255;
4123
+ arr[i2 * 17] = z;
4124
+ arr[i2 * 17 + 1] = entry.x & 255;
4125
+ arr[i2 * 17 + 2] = entry.x >> 8 & 255;
4126
+ arr[i2 * 17 + 3] = entry.x >> 16 & 255;
4127
+ arr[i2 * 17 + 4] = entry.y & 255;
4128
+ arr[i2 * 17 + 5] = entry.y >> 8 & 255;
4129
+ arr[i2 * 17 + 6] = entry.y >> 16 & 255;
4130
+ arr[i2 * 17 + 7] = entry.offset & 255;
4131
+ arr[i2 * 17 + 8] = unshift(entry.offset, 8) & 255;
4132
+ arr[i2 * 17 + 9] = unshift(entry.offset, 16) & 255;
4133
+ arr[i2 * 17 + 10] = unshift(entry.offset, 24) & 255;
4134
+ arr[i2 * 17 + 11] = unshift(entry.offset, 32) & 255;
4135
+ arr[i2 * 17 + 12] = unshift(entry.offset, 48) & 255;
4136
+ arr[i2 * 17 + 13] = entry.length & 255;
4137
+ arr[i2 * 17 + 14] = entry.length >> 8 & 255;
4138
+ arr[i2 * 17 + 15] = entry.length >> 16 & 255;
4139
+ arr[i2 * 17 + 16] = entry.length >> 24 & 255;
3703
4140
  }
3704
4141
  return buffer;
3705
4142
  };
@@ -3790,9 +4227,9 @@ var __exports__ = (() => {
3790
4227
  return header;
3791
4228
  });
3792
4229
  }
3793
- function getZxy(header, source, cache, z, x3, y2, signal) {
4230
+ function getZxy(header, source, cache2, z, x2, y, signal) {
3794
4231
  return __async(this, null, function* () {
3795
- let rootDir = yield cache.getArrayBuffer(
4232
+ let rootDir = yield cache2.getArrayBuffer(
3796
4233
  source,
3797
4234
  header.rootDirectoryOffset,
3798
4235
  header.rootDirectoryLength,
@@ -3801,7 +4238,7 @@ var __exports__ = (() => {
3801
4238
  if (header.specVersion === 1) {
3802
4239
  rootDir = sortDir(rootDir);
3803
4240
  }
3804
- const entry = queryTile(new DataView(rootDir), z, x3, y2);
4241
+ const entry = queryTile(new DataView(rootDir), z, x2, y);
3805
4242
  if (entry) {
3806
4243
  const resp = yield source.getBytes(entry.offset, entry.length, signal);
3807
4244
  let tileData = resp.data;
@@ -3813,7 +4250,7 @@ var __exports__ = (() => {
3813
4250
  data: tileData
3814
4251
  };
3815
4252
  }
3816
- const leafcoords = deriveLeaf(new DataView(rootDir), { z, x: x3, y: y2 });
4253
+ const leafcoords = deriveLeaf(new DataView(rootDir), { z, x: x2, y });
3817
4254
  if (leafcoords) {
3818
4255
  const leafdirEntry = queryLeafdir(
3819
4256
  new DataView(rootDir),
@@ -3822,7 +4259,7 @@ var __exports__ = (() => {
3822
4259
  leafcoords.y
3823
4260
  );
3824
4261
  if (leafdirEntry) {
3825
- let leafDir = yield cache.getArrayBuffer(
4262
+ let leafDir = yield cache2.getArrayBuffer(
3826
4263
  source,
3827
4264
  leafdirEntry.offset,
3828
4265
  leafdirEntry.length,
@@ -3831,7 +4268,7 @@ var __exports__ = (() => {
3831
4268
  if (header.specVersion === 1) {
3832
4269
  leafDir = sortDir(leafDir);
3833
4270
  }
3834
- const tileEntry = queryTile(new DataView(leafDir), z, x3, y2);
4271
+ const tileEntry = queryTile(new DataView(leafDir), z, x2, y);
3835
4272
  if (tileEntry) {
3836
4273
  const resp = yield source.getBytes(
3837
4274
  tileEntry.offset,
@@ -3974,10 +4411,10 @@ var __exports__ = (() => {
3974
4411
  this.tiles.set(pmtilesUrl, instance);
3975
4412
  }
3976
4413
  const z = result[2];
3977
- const x3 = result[3];
3978
- const y2 = result[4];
4414
+ const x2 = result[3];
4415
+ const y = result[4];
3979
4416
  const header = yield instance.getHeader();
3980
- const resp = yield instance == null ? void 0 : instance.getZxy(+z, +x3, +y2, abortController.signal);
4417
+ const resp = yield instance == null ? void 0 : instance.getZxy(+z, +x2, +y, abortController.signal);
3981
4418
  if (resp) {
3982
4419
  return {
3983
4420
  data: new Uint8Array(resp.data),
@@ -4111,11 +4548,11 @@ var __exports__ = (() => {
4111
4548
  375299968947541,
4112
4549
  1501199875790165
4113
4550
  ];
4114
- function zxyToTileId(z, x3, y2) {
4551
+ function zxyToTileId(z, x2, y) {
4115
4552
  if (z > 26) {
4116
4553
  throw Error("Tile zoom level exceeds max safe number limit (26)");
4117
4554
  }
4118
- if (x3 > __pow(2, z) - 1 || y2 > __pow(2, z) - 1) {
4555
+ if (x2 > __pow(2, z) - 1 || y > __pow(2, z) - 1) {
4119
4556
  throw Error("tile x/y outside zoom level bounds");
4120
4557
  }
4121
4558
  const acc = tzValues[z];
@@ -4123,7 +4560,7 @@ var __exports__ = (() => {
4123
4560
  let rx = 0;
4124
4561
  let ry = 0;
4125
4562
  let d = 0;
4126
- const xy = [x3, y2];
4563
+ const xy = [x2, y];
4127
4564
  let s = n / 2;
4128
4565
  while (s > 0) {
4129
4566
  rx = (xy[0] & s) > 0 ? 1 : 0;
@@ -4134,13 +4571,13 @@ var __exports__ = (() => {
4134
4571
  }
4135
4572
  return acc + d;
4136
4573
  }
4137
- function tileIdToZxy(i3) {
4574
+ function tileIdToZxy(i2) {
4138
4575
  let acc = 0;
4139
4576
  const z = 0;
4140
4577
  for (let z2 = 0; z2 < 27; z2++) {
4141
4578
  const numTiles = (1 << z2) * (1 << z2);
4142
- if (acc + numTiles > i3) {
4143
- return idOnLevel(z2, i3 - acc);
4579
+ if (acc + numTiles > i2) {
4580
+ return idOnLevel(z2, i2 - acc);
4144
4581
  }
4145
4582
  acc += numTiles;
4146
4583
  }
@@ -4217,9 +4654,9 @@ var __exports__ = (() => {
4217
4654
  getKey() {
4218
4655
  return this.file.name;
4219
4656
  }
4220
- getBytes(offset, length2) {
4657
+ getBytes(offset, length) {
4221
4658
  return __async(this, null, function* () {
4222
- const blob = this.file.slice(offset, offset + length2);
4659
+ const blob = this.file.slice(offset, offset + length);
4223
4660
  const a = yield blob.arrayBuffer();
4224
4661
  return { data: a };
4225
4662
  });
@@ -4237,7 +4674,7 @@ var __exports__ = (() => {
4237
4674
  setHeaders(customHeaders) {
4238
4675
  this.customHeaders = customHeaders;
4239
4676
  }
4240
- getBytes(offset, length2, passedSignal, etag) {
4677
+ getBytes(offset, length, passedSignal, etag) {
4241
4678
  return __async(this, null, function* () {
4242
4679
  let controller;
4243
4680
  let signal;
@@ -4248,14 +4685,14 @@ var __exports__ = (() => {
4248
4685
  signal = controller.signal;
4249
4686
  }
4250
4687
  const requestHeaders = new Headers(this.customHeaders);
4251
- requestHeaders.set("range", `bytes=${offset}-${offset + length2 - 1}`);
4252
- let cache;
4688
+ requestHeaders.set("range", `bytes=${offset}-${offset + length - 1}`);
4689
+ let cache2;
4253
4690
  if (this.mustReload) {
4254
- cache = "reload";
4691
+ cache2 = "reload";
4255
4692
  }
4256
4693
  let resp = yield fetch(this.url, {
4257
4694
  signal,
4258
- cache,
4695
+ cache: cache2,
4259
4696
  headers: requestHeaders
4260
4697
  //biome-ignore lint: "cache" is incompatible between cloudflare workers and browser
4261
4698
  });
@@ -4284,7 +4721,7 @@ var __exports__ = (() => {
4284
4721
  throw Error(`Bad response code: ${resp.status}`);
4285
4722
  }
4286
4723
  const contentLength = resp.headers.get("Content-Length");
4287
- if (resp.status === 200 && (!contentLength || +contentLength > length2)) {
4724
+ if (resp.status === 200 && (!contentLength || +contentLength > length)) {
4288
4725
  if (controller)
4289
4726
  controller.abort();
4290
4727
  throw Error(
@@ -4348,23 +4785,23 @@ var __exports__ = (() => {
4348
4785
  const numEntries = readVarint(p);
4349
4786
  const entries = [];
4350
4787
  let lastId = 0;
4351
- for (let i3 = 0; i3 < numEntries; i3++) {
4788
+ for (let i2 = 0; i2 < numEntries; i2++) {
4352
4789
  const v = readVarint(p);
4353
4790
  entries.push({ tileId: lastId + v, offset: 0, length: 0, runLength: 1 });
4354
4791
  lastId += v;
4355
4792
  }
4356
- for (let i3 = 0; i3 < numEntries; i3++) {
4357
- entries[i3].runLength = readVarint(p);
4793
+ for (let i2 = 0; i2 < numEntries; i2++) {
4794
+ entries[i2].runLength = readVarint(p);
4358
4795
  }
4359
- for (let i3 = 0; i3 < numEntries; i3++) {
4360
- entries[i3].length = readVarint(p);
4796
+ for (let i2 = 0; i2 < numEntries; i2++) {
4797
+ entries[i2].length = readVarint(p);
4361
4798
  }
4362
- for (let i3 = 0; i3 < numEntries; i3++) {
4799
+ for (let i2 = 0; i2 < numEntries; i2++) {
4363
4800
  const v = readVarint(p);
4364
- if (v === 0 && i3 > 0) {
4365
- entries[i3].offset = entries[i3 - 1].offset + entries[i3 - 1].length;
4801
+ if (v === 0 && i2 > 0) {
4802
+ entries[i2].offset = entries[i2 - 1].offset + entries[i2 - 1].length;
4366
4803
  } else {
4367
- entries[i3].offset = v - 1;
4804
+ entries[i2].offset = v - 1;
4368
4805
  }
4369
4806
  }
4370
4807
  return entries;
@@ -4410,9 +4847,9 @@ var __exports__ = (() => {
4410
4847
  return [header, [dirKey, rootDir.length, rootDir]];
4411
4848
  });
4412
4849
  }
4413
- function getDirectory(source, decompress, offset, length2, header) {
4850
+ function getDirectory(source, decompress, offset, length, header) {
4414
4851
  return __async(this, null, function* () {
4415
- const resp = yield source.getBytes(offset, length2, void 0, header.etag);
4852
+ const resp = yield source.getBytes(offset, length, void 0, header.etag);
4416
4853
  const data = yield decompress(resp.data, header.internalCompression);
4417
4854
  const directory = deserializeIndex(data);
4418
4855
  if (directory.length === 0) {
@@ -4452,9 +4889,9 @@ var __exports__ = (() => {
4452
4889
  return res[0];
4453
4890
  });
4454
4891
  }
4455
- getDirectory(source, offset, length2, header) {
4892
+ getDirectory(source, offset, length, header) {
4456
4893
  return __async(this, null, function* () {
4457
- const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length2}`;
4894
+ const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length}`;
4458
4895
  const cacheValue = this.cache.get(cacheKey);
4459
4896
  if (cacheValue) {
4460
4897
  cacheValue.lastUsed = this.counter++;
@@ -4465,7 +4902,7 @@ var __exports__ = (() => {
4465
4902
  source,
4466
4903
  this.decompress,
4467
4904
  offset,
4468
- length2,
4905
+ length,
4469
4906
  header
4470
4907
  );
4471
4908
  this.cache.set(cacheKey, {
@@ -4477,16 +4914,16 @@ var __exports__ = (() => {
4477
4914
  });
4478
4915
  }
4479
4916
  // for v2 backwards compatibility
4480
- getArrayBuffer(source, offset, length2, header) {
4917
+ getArrayBuffer(source, offset, length, header) {
4481
4918
  return __async(this, null, function* () {
4482
- const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length2}`;
4919
+ const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length}`;
4483
4920
  const cacheValue = this.cache.get(cacheKey);
4484
4921
  if (cacheValue) {
4485
4922
  cacheValue.lastUsed = this.counter++;
4486
4923
  const data = yield cacheValue.data;
4487
4924
  return data;
4488
4925
  }
4489
- const resp = yield source.getBytes(offset, length2, void 0, header.etag);
4926
+ const resp = yield source.getBytes(offset, length, void 0, header.etag);
4490
4927
  this.cache.set(cacheKey, {
4491
4928
  lastUsed: this.counter++,
4492
4929
  data: resp.data
@@ -4551,9 +4988,9 @@ var __exports__ = (() => {
4551
4988
  return p;
4552
4989
  });
4553
4990
  }
4554
- getDirectory(source, offset, length2, header) {
4991
+ getDirectory(source, offset, length, header) {
4555
4992
  return __async(this, null, function* () {
4556
- const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length2}`;
4993
+ const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length}`;
4557
4994
  const cacheValue = this.cache.get(cacheKey);
4558
4995
  if (cacheValue) {
4559
4996
  cacheValue.lastUsed = this.counter++;
@@ -4561,7 +4998,7 @@ var __exports__ = (() => {
4561
4998
  return data;
4562
4999
  }
4563
5000
  const p = new Promise((resolve, reject) => {
4564
- getDirectory(source, this.decompress, offset, length2, header).then((directory) => {
5001
+ getDirectory(source, this.decompress, offset, length, header).then((directory) => {
4565
5002
  resolve(directory);
4566
5003
  this.prune();
4567
5004
  }).catch((e) => {
@@ -4573,9 +5010,9 @@ var __exports__ = (() => {
4573
5010
  });
4574
5011
  }
4575
5012
  // for v2 backwards compatibility
4576
- getArrayBuffer(source, offset, length2, header) {
5013
+ getArrayBuffer(source, offset, length, header) {
4577
5014
  return __async(this, null, function* () {
4578
- const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length2}`;
5015
+ const cacheKey = `${source.getKey()}|${header.etag || ""}|${offset}|${length}`;
4579
5016
  const cacheValue = this.cache.get(cacheKey);
4580
5017
  if (cacheValue) {
4581
5018
  cacheValue.lastUsed = this.counter++;
@@ -4583,7 +5020,7 @@ var __exports__ = (() => {
4583
5020
  return data;
4584
5021
  }
4585
5022
  const p = new Promise((resolve, reject) => {
4586
- source.getBytes(offset, length2, void 0, header.etag).then((resp) => {
5023
+ source.getBytes(offset, length, void 0, header.etag).then((resp) => {
4587
5024
  resolve(resp.data);
4588
5025
  if (this.cache.has(cacheKey)) {
4589
5026
  }
@@ -4631,7 +5068,7 @@ var __exports__ = (() => {
4631
5068
  }
4632
5069
  };
4633
5070
  var PMTiles = class {
4634
- constructor(source, cache, decompress) {
5071
+ constructor(source, cache2, decompress) {
4635
5072
  if (typeof source === "string") {
4636
5073
  this.source = new FetchSource(source);
4637
5074
  } else {
@@ -4642,8 +5079,8 @@ var __exports__ = (() => {
4642
5079
  } else {
4643
5080
  this.decompress = defaultDecompress;
4644
5081
  }
4645
- if (cache) {
4646
- this.cache = cache;
5082
+ if (cache2) {
5083
+ this.cache = cache2;
4647
5084
  } else {
4648
5085
  this.cache = new SharedPromiseCache();
4649
5086
  }
@@ -4658,12 +5095,12 @@ var __exports__ = (() => {
4658
5095
  });
4659
5096
  }
4660
5097
  /** @hidden */
4661
- getZxyAttempt(z, x3, y2, signal) {
5098
+ getZxyAttempt(z, x2, y, signal) {
4662
5099
  return __async(this, null, function* () {
4663
- const tileId = zxyToTileId(z, x3, y2);
5100
+ const tileId = zxyToTileId(z, x2, y);
4664
5101
  const header = yield this.cache.getHeader(this.source);
4665
5102
  if (header.specVersion < 3) {
4666
- return v2_default.getZxy(header, this.source, this.cache, z, x3, y2, signal);
5103
+ return v2_default.getZxy(header, this.source, this.cache, z, x2, y, signal);
4667
5104
  }
4668
5105
  if (z < header.minZoom || z > header.maxZoom) {
4669
5106
  return void 0;
@@ -4706,14 +5143,14 @@ var __exports__ = (() => {
4706
5143
  *
4707
5144
  * Returns undefined if the tile does not exist in the archive.
4708
5145
  */
4709
- getZxy(z, x3, y2, signal) {
5146
+ getZxy(z, x2, y, signal) {
4710
5147
  return __async(this, null, function* () {
4711
5148
  try {
4712
- return yield this.getZxyAttempt(z, x3, y2, signal);
5149
+ return yield this.getZxyAttempt(z, x2, y, signal);
4713
5150
  } catch (e) {
4714
5151
  if (e instanceof EtagMismatch) {
4715
5152
  this.cache.invalidate(this.source);
4716
- return yield this.getZxyAttempt(z, x3, y2, signal);
5153
+ return yield this.getZxyAttempt(z, x2, y, signal);
4717
5154
  }
4718
5155
  throw e;
4719
5156
  }
@@ -4829,8 +5266,8 @@ var __exports__ = (() => {
4829
5266
  getKey() {
4830
5267
  return this.blob.url || "";
4831
5268
  }
4832
- async getBytes(offset, length2, signal) {
4833
- const slice = this.blob.slice(offset, offset + length2);
5269
+ async getBytes(offset, length, signal) {
5270
+ const slice = this.blob.slice(offset, offset + length);
4834
5271
  const data = await slice.arrayBuffer();
4835
5272
  return {
4836
5273
  data
@@ -4876,8 +5313,8 @@ var __exports__ = (() => {
4876
5313
  return metadata;
4877
5314
  }
4878
5315
  async getTile(tileParams) {
4879
- const { x: x3, y: y2, zoom: z } = tileParams;
4880
- const rangeResponse = await this.pmtiles.getZxy(z, x3, y2);
5316
+ const { x: x2, y, z } = tileParams;
5317
+ const rangeResponse = await this.pmtiles.getZxy(z, x2, y);
4881
5318
  const arrayBuffer = rangeResponse?.data;
4882
5319
  if (!arrayBuffer) {
4883
5320
  return null;
@@ -4887,13 +5324,13 @@ var __exports__ = (() => {
4887
5324
  // Tile Source interface implementation: deck.gl compatible API
4888
5325
  // TODO - currently only handles image tiles, not vector tiles
4889
5326
  async getTileData(tileParams) {
4890
- const { x: x3, y: y2, z } = tileParams.index;
5327
+ const { x: x2, y, z } = tileParams.index;
4891
5328
  const metadata = await this.metadata;
4892
5329
  switch (metadata.tileMIMEType) {
4893
5330
  case "application/vnd.mapbox-vector-tile":
4894
- return await this.getVectorTile({ x: x3, y: y2, zoom: z, layers: [] });
5331
+ return await this.getVectorTile({ x: x2, y, z, layers: [] });
4895
5332
  default:
4896
- return await this.getImageTile({ x: x3, y: y2, zoom: z, layers: [] });
5333
+ return await this.getImageTile({ x: x2, y, z, layers: [] });
4897
5334
  }
4898
5335
  }
4899
5336
  // ImageTileSource interface implementation
@@ -4908,7 +5345,7 @@ var __exports__ = (() => {
4908
5345
  shape: "geojson-table",
4909
5346
  mvt: {
4910
5347
  coordinates: "wgs84",
4911
- tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.zoom },
5348
+ tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },
4912
5349
  ...this.loadOptions?.mvt
4913
5350
  },
4914
5351
  ...this.loadOptions