@loaders.gl/tiles 3.1.4 → 3.1.8

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.min.js CHANGED
@@ -5265,14 +5265,16 @@
5265
5265
  });
5266
5266
 
5267
5267
  // src/tileset/helpers/zoom.ts
5268
- function getZoomFromBoundingVolume(boundingVolume) {
5269
- const { halfAxes, radius, width, height } = boundingVolume;
5270
- if (halfAxes) {
5268
+ function getZoomFromBoundingVolume(boundingVolume, cartorgraphicCenter) {
5269
+ if (boundingVolume instanceof OrientedBoundingBox) {
5270
+ const { halfAxes } = boundingVolume;
5271
5271
  const obbSize = getObbSize(halfAxes);
5272
- return Math.log2(WGS84_RADIUS_Z2 / obbSize);
5273
- } else if (radius) {
5274
- return Math.log2(WGS84_RADIUS_Z2 / radius);
5275
- } else if (height && width) {
5272
+ return Math.log2(WGS84_RADIUS_Z2 / (obbSize + cartorgraphicCenter[2]));
5273
+ } else if (boundingVolume instanceof BoundingSphere) {
5274
+ const { radius } = boundingVolume;
5275
+ return Math.log2(WGS84_RADIUS_Z2 / (radius + cartorgraphicCenter[2]));
5276
+ } else if (boundingVolume.width && boundingVolume.height) {
5277
+ const { width, height } = boundingVolume;
5276
5278
  const zoomX = Math.log2(WGS84_RADIUS_X2 / width);
5277
5279
  const zoomY = Math.log2(WGS84_RADIUS_Y2 / height);
5278
5280
  return (zoomX + zoomY) / 2;
@@ -5291,6 +5293,7 @@
5291
5293
  var init_zoom = __esm({
5292
5294
  "src/tileset/helpers/zoom.ts"() {
5293
5295
  init_esm();
5296
+ init_esm5();
5294
5297
  WGS84_RADIUS_X2 = 6378137;
5295
5298
  WGS84_RADIUS_Y2 = 6378137;
5296
5299
  WGS84_RADIUS_Z2 = 6356752314245179e-9;
@@ -6372,6 +6375,638 @@
6372
6375
  }
6373
6376
  });
6374
6377
 
6378
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js
6379
+ function isElectron2(mockUserAgent) {
6380
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
6381
+ return true;
6382
+ }
6383
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
6384
+ return true;
6385
+ }
6386
+ const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
6387
+ const userAgent = mockUserAgent || realUserAgent;
6388
+ if (userAgent && userAgent.indexOf("Electron") >= 0) {
6389
+ return true;
6390
+ }
6391
+ return false;
6392
+ }
6393
+ var init_is_electron2 = __esm({
6394
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js"() {
6395
+ }
6396
+ });
6397
+
6398
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js
6399
+ function isBrowser5() {
6400
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
6401
+ return !isNode || isElectron2();
6402
+ }
6403
+ var init_is_browser2 = __esm({
6404
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js"() {
6405
+ init_is_electron2();
6406
+ }
6407
+ });
6408
+
6409
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/globals.js
6410
+ var globals5, self_4, window_4, document_4, process_2;
6411
+ var init_globals5 = __esm({
6412
+ "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js"() {
6413
+ globals5 = {
6414
+ self: typeof self !== "undefined" && self,
6415
+ window: typeof window !== "undefined" && window,
6416
+ global: typeof global !== "undefined" && global,
6417
+ document: typeof document !== "undefined" && document,
6418
+ process: typeof process === "object" && process
6419
+ };
6420
+ self_4 = globals5.self || globals5.window || globals5.global;
6421
+ window_4 = globals5.window || globals5.self || globals5.global;
6422
+ document_4 = globals5.document || {};
6423
+ process_2 = globals5.process || {};
6424
+ }
6425
+ });
6426
+
6427
+ // ../../node_modules/@probe.gl/env/dist/esm/utils/globals.js
6428
+ var VERSION3, isBrowser6;
6429
+ var init_globals6 = __esm({
6430
+ "../../node_modules/@probe.gl/env/dist/esm/utils/globals.js"() {
6431
+ init_is_browser2();
6432
+ VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
6433
+ isBrowser6 = isBrowser5();
6434
+ }
6435
+ });
6436
+
6437
+ // ../../node_modules/@probe.gl/env/dist/esm/index.js
6438
+ var init_esm8 = __esm({
6439
+ "../../node_modules/@probe.gl/env/dist/esm/index.js"() {
6440
+ init_globals6();
6441
+ init_globals5();
6442
+ init_is_browser2();
6443
+ }
6444
+ });
6445
+
6446
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js
6447
+ function getStorage2(type) {
6448
+ try {
6449
+ const storage = window[type];
6450
+ const x = "__storage_test__";
6451
+ storage.setItem(x, x);
6452
+ storage.removeItem(x);
6453
+ return storage;
6454
+ } catch (e) {
6455
+ return null;
6456
+ }
6457
+ }
6458
+ var LocalStorage2;
6459
+ var init_local_storage2 = __esm({
6460
+ "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js"() {
6461
+ init_defineProperty();
6462
+ LocalStorage2 = class {
6463
+ constructor(id) {
6464
+ let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
6465
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
6466
+ _defineProperty(this, "storage", void 0);
6467
+ _defineProperty(this, "id", void 0);
6468
+ _defineProperty(this, "config", {});
6469
+ this.storage = getStorage2(type);
6470
+ this.id = id;
6471
+ this.config = {};
6472
+ Object.assign(this.config, defaultSettings);
6473
+ this._loadConfiguration();
6474
+ }
6475
+ getConfiguration() {
6476
+ return this.config;
6477
+ }
6478
+ setConfiguration(configuration) {
6479
+ this.config = {};
6480
+ return this.updateConfiguration(configuration);
6481
+ }
6482
+ updateConfiguration(configuration) {
6483
+ Object.assign(this.config, configuration);
6484
+ if (this.storage) {
6485
+ const serialized = JSON.stringify(this.config);
6486
+ this.storage.setItem(this.id, serialized);
6487
+ }
6488
+ return this;
6489
+ }
6490
+ _loadConfiguration() {
6491
+ let configuration = {};
6492
+ if (this.storage) {
6493
+ const serializedConfiguration = this.storage.getItem(this.id);
6494
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
6495
+ }
6496
+ Object.assign(this.config, configuration);
6497
+ return this;
6498
+ }
6499
+ };
6500
+ }
6501
+ });
6502
+
6503
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js
6504
+ function formatTime2(ms) {
6505
+ let formatted;
6506
+ if (ms < 10) {
6507
+ formatted = "".concat(ms.toFixed(2), "ms");
6508
+ } else if (ms < 100) {
6509
+ formatted = "".concat(ms.toFixed(1), "ms");
6510
+ } else if (ms < 1e3) {
6511
+ formatted = "".concat(ms.toFixed(0), "ms");
6512
+ } else {
6513
+ formatted = "".concat((ms / 1e3).toFixed(2), "s");
6514
+ }
6515
+ return formatted;
6516
+ }
6517
+ function leftPad2(string) {
6518
+ let length4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
6519
+ const padLength = Math.max(length4 - string.length, 0);
6520
+ return "".concat(" ".repeat(padLength)).concat(string);
6521
+ }
6522
+ function formatImage2(image, message, scale5) {
6523
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
6524
+ const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
6525
+ if (image.width > maxWidth) {
6526
+ scale5 = Math.min(scale5, maxWidth / image.width);
6527
+ }
6528
+ const width = image.width * scale5;
6529
+ const height = image.height * scale5;
6530
+ 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("");
6531
+ return ["".concat(message, " %c+"), style];
6532
+ }
6533
+ var init_formatters2 = __esm({
6534
+ "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js"() {
6535
+ }
6536
+ });
6537
+
6538
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/color.js
6539
+ function getColor2(color) {
6540
+ return typeof color === "string" ? COLOR2[color.toUpperCase()] || COLOR2.WHITE : color;
6541
+ }
6542
+ function addColor2(string, color, background) {
6543
+ if (!isBrowser5 && typeof string === "string") {
6544
+ if (color) {
6545
+ color = getColor2(color);
6546
+ string = "[".concat(color, "m").concat(string, "");
6547
+ }
6548
+ if (background) {
6549
+ color = getColor2(background);
6550
+ string = "[".concat(background + 10, "m").concat(string, "");
6551
+ }
6552
+ }
6553
+ return string;
6554
+ }
6555
+ var COLOR2;
6556
+ var init_color2 = __esm({
6557
+ "../../node_modules/@probe.gl/log/dist/esm/utils/color.js"() {
6558
+ init_esm8();
6559
+ (function(COLOR3) {
6560
+ COLOR3[COLOR3["BLACK"] = 30] = "BLACK";
6561
+ COLOR3[COLOR3["RED"] = 31] = "RED";
6562
+ COLOR3[COLOR3["GREEN"] = 32] = "GREEN";
6563
+ COLOR3[COLOR3["YELLOW"] = 33] = "YELLOW";
6564
+ COLOR3[COLOR3["BLUE"] = 34] = "BLUE";
6565
+ COLOR3[COLOR3["MAGENTA"] = 35] = "MAGENTA";
6566
+ COLOR3[COLOR3["CYAN"] = 36] = "CYAN";
6567
+ COLOR3[COLOR3["WHITE"] = 37] = "WHITE";
6568
+ COLOR3[COLOR3["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
6569
+ COLOR3[COLOR3["BRIGHT_RED"] = 91] = "BRIGHT_RED";
6570
+ COLOR3[COLOR3["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
6571
+ COLOR3[COLOR3["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
6572
+ COLOR3[COLOR3["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
6573
+ COLOR3[COLOR3["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
6574
+ COLOR3[COLOR3["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
6575
+ COLOR3[COLOR3["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
6576
+ })(COLOR2 || (COLOR2 = {}));
6577
+ }
6578
+ });
6579
+
6580
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js
6581
+ function autobind2(obj) {
6582
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
6583
+ const proto = Object.getPrototypeOf(obj);
6584
+ const propNames = Object.getOwnPropertyNames(proto);
6585
+ for (const key of propNames) {
6586
+ if (typeof obj[key] === "function") {
6587
+ if (!predefined.find((name) => key === name)) {
6588
+ obj[key] = obj[key].bind(obj);
6589
+ }
6590
+ }
6591
+ }
6592
+ }
6593
+ var init_autobind2 = __esm({
6594
+ "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js"() {
6595
+ }
6596
+ });
6597
+
6598
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/assert.js
6599
+ function assert5(condition, message) {
6600
+ if (!condition) {
6601
+ throw new Error(message || "Assertion failed");
6602
+ }
6603
+ }
6604
+ var init_assert5 = __esm({
6605
+ "../../node_modules/@probe.gl/log/dist/esm/utils/assert.js"() {
6606
+ }
6607
+ });
6608
+
6609
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js
6610
+ function getHiResTimestamp5() {
6611
+ let timestamp;
6612
+ if (isBrowser5 && "performance" in window_4) {
6613
+ var _window$performance, _window$performance$n;
6614
+ timestamp = window_4 === null || window_4 === void 0 ? void 0 : (_window$performance = window_4.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);
6615
+ } else if ("hrtime" in process_2) {
6616
+ var _process$hrtime;
6617
+ const timeParts = process_2 === null || process_2 === void 0 ? void 0 : (_process$hrtime = process_2.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_2);
6618
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
6619
+ } else {
6620
+ timestamp = Date.now();
6621
+ }
6622
+ return timestamp;
6623
+ }
6624
+ var init_hi_res_timestamp5 = __esm({
6625
+ "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js"() {
6626
+ init_esm8();
6627
+ }
6628
+ });
6629
+
6630
+ // ../../node_modules/@probe.gl/log/dist/esm/log.js
6631
+ function noop3() {
6632
+ }
6633
+ function normalizeLogLevel2(logLevel) {
6634
+ if (!logLevel) {
6635
+ return 0;
6636
+ }
6637
+ let resolvedLevel;
6638
+ switch (typeof logLevel) {
6639
+ case "number":
6640
+ resolvedLevel = logLevel;
6641
+ break;
6642
+ case "object":
6643
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
6644
+ break;
6645
+ default:
6646
+ return 0;
6647
+ }
6648
+ assert5(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
6649
+ return resolvedLevel;
6650
+ }
6651
+ function normalizeArguments2(opts) {
6652
+ const {
6653
+ logLevel,
6654
+ message
6655
+ } = opts;
6656
+ opts.logLevel = normalizeLogLevel2(logLevel);
6657
+ const args = opts.args ? Array.from(opts.args) : [];
6658
+ while (args.length && args.shift() !== message) {
6659
+ }
6660
+ switch (typeof logLevel) {
6661
+ case "string":
6662
+ case "function":
6663
+ if (message !== void 0) {
6664
+ args.unshift(message);
6665
+ }
6666
+ opts.message = logLevel;
6667
+ break;
6668
+ case "object":
6669
+ Object.assign(opts, logLevel);
6670
+ break;
6671
+ default:
6672
+ }
6673
+ if (typeof opts.message === "function") {
6674
+ opts.message = opts.message();
6675
+ }
6676
+ const messageType = typeof opts.message;
6677
+ assert5(messageType === "string" || messageType === "object");
6678
+ return Object.assign(opts, {
6679
+ args
6680
+ }, opts.opts);
6681
+ }
6682
+ function decorateMessage2(id, message, opts) {
6683
+ if (typeof message === "string") {
6684
+ const time = opts.time ? leftPad2(formatTime2(opts.total)) : "";
6685
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
6686
+ message = addColor2(message, opts.color, opts.background);
6687
+ }
6688
+ return message;
6689
+ }
6690
+ function logImageInNode2(_ref2) {
6691
+ let {
6692
+ image,
6693
+ message = "",
6694
+ scale: scale5 = 1
6695
+ } = _ref2;
6696
+ let asciify = null;
6697
+ try {
6698
+ asciify = module.require("asciify-image");
6699
+ } catch (error) {
6700
+ }
6701
+ if (asciify) {
6702
+ return () => asciify(image, {
6703
+ fit: "box",
6704
+ width: "".concat(Math.round(80 * scale5), "%")
6705
+ }).then((data) => console.log(data));
6706
+ }
6707
+ return noop3;
6708
+ }
6709
+ function logImageInBrowser2(_ref3) {
6710
+ let {
6711
+ image,
6712
+ message = "",
6713
+ scale: scale5 = 1
6714
+ } = _ref3;
6715
+ if (typeof image === "string") {
6716
+ const img = new Image();
6717
+ img.onload = () => {
6718
+ const args = formatImage2(img, message, scale5);
6719
+ console.log(...args);
6720
+ };
6721
+ img.src = image;
6722
+ return noop3;
6723
+ }
6724
+ const element = image.nodeName || "";
6725
+ if (element.toLowerCase() === "img") {
6726
+ console.log(...formatImage2(image, message, scale5));
6727
+ return noop3;
6728
+ }
6729
+ if (element.toLowerCase() === "canvas") {
6730
+ const img = new Image();
6731
+ img.onload = () => console.log(...formatImage2(img, message, scale5));
6732
+ img.src = image.toDataURL();
6733
+ return noop3;
6734
+ }
6735
+ return noop3;
6736
+ }
6737
+ function getTableHeader2(table) {
6738
+ for (const key in table) {
6739
+ for (const title in table[key]) {
6740
+ return title || "untitled";
6741
+ }
6742
+ }
6743
+ return "empty";
6744
+ }
6745
+ var originalConsole2, DEFAULT_SETTINGS2, cache2, ONCE2, Log2;
6746
+ var init_log2 = __esm({
6747
+ "../../node_modules/@probe.gl/log/dist/esm/log.js"() {
6748
+ init_defineProperty();
6749
+ init_esm8();
6750
+ init_local_storage2();
6751
+ init_formatters2();
6752
+ init_color2();
6753
+ init_autobind2();
6754
+ init_assert5();
6755
+ init_hi_res_timestamp5();
6756
+ originalConsole2 = {
6757
+ debug: isBrowser5 ? console.debug || console.log : console.log,
6758
+ log: console.log,
6759
+ info: console.info,
6760
+ warn: console.warn,
6761
+ error: console.error
6762
+ };
6763
+ DEFAULT_SETTINGS2 = {
6764
+ enabled: true,
6765
+ level: 0
6766
+ };
6767
+ cache2 = {};
6768
+ ONCE2 = {
6769
+ once: true
6770
+ };
6771
+ Log2 = class {
6772
+ constructor() {
6773
+ let {
6774
+ id
6775
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
6776
+ id: ""
6777
+ };
6778
+ _defineProperty(this, "id", void 0);
6779
+ _defineProperty(this, "VERSION", VERSION3);
6780
+ _defineProperty(this, "_startTs", getHiResTimestamp5());
6781
+ _defineProperty(this, "_deltaTs", getHiResTimestamp5());
6782
+ _defineProperty(this, "_storage", void 0);
6783
+ _defineProperty(this, "userData", {});
6784
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
6785
+ this.id = id;
6786
+ this._storage = new LocalStorage2("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS2);
6787
+ this.userData = {};
6788
+ this.timeStamp("".concat(this.id, " started"));
6789
+ autobind2(this);
6790
+ Object.seal(this);
6791
+ }
6792
+ set level(newLevel) {
6793
+ this.setLevel(newLevel);
6794
+ }
6795
+ get level() {
6796
+ return this.getLevel();
6797
+ }
6798
+ isEnabled() {
6799
+ return this._storage.config.enabled;
6800
+ }
6801
+ getLevel() {
6802
+ return this._storage.config.level;
6803
+ }
6804
+ getTotal() {
6805
+ return Number((getHiResTimestamp5() - this._startTs).toPrecision(10));
6806
+ }
6807
+ getDelta() {
6808
+ return Number((getHiResTimestamp5() - this._deltaTs).toPrecision(10));
6809
+ }
6810
+ set priority(newPriority) {
6811
+ this.level = newPriority;
6812
+ }
6813
+ get priority() {
6814
+ return this.level;
6815
+ }
6816
+ getPriority() {
6817
+ return this.level;
6818
+ }
6819
+ enable() {
6820
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
6821
+ this._storage.updateConfiguration({
6822
+ enabled
6823
+ });
6824
+ return this;
6825
+ }
6826
+ setLevel(level) {
6827
+ this._storage.updateConfiguration({
6828
+ level
6829
+ });
6830
+ return this;
6831
+ }
6832
+ get(setting) {
6833
+ return this._storage.config[setting];
6834
+ }
6835
+ set(setting, value) {
6836
+ this._storage.updateConfiguration({
6837
+ [setting]: value
6838
+ });
6839
+ }
6840
+ settings() {
6841
+ if (console.table) {
6842
+ console.table(this._storage.config);
6843
+ } else {
6844
+ console.log(this._storage.config);
6845
+ }
6846
+ }
6847
+ assert(condition, message) {
6848
+ assert5(condition, message);
6849
+ }
6850
+ warn(message) {
6851
+ return this._getLogFunction(0, message, originalConsole2.warn, arguments, ONCE2);
6852
+ }
6853
+ error(message) {
6854
+ return this._getLogFunction(0, message, originalConsole2.error, arguments);
6855
+ }
6856
+ deprecated(oldUsage, newUsage) {
6857
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
6858
+ }
6859
+ removed(oldUsage, newUsage) {
6860
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
6861
+ }
6862
+ probe(logLevel, message) {
6863
+ return this._getLogFunction(logLevel, message, originalConsole2.log, arguments, {
6864
+ time: true,
6865
+ once: true
6866
+ });
6867
+ }
6868
+ log(logLevel, message) {
6869
+ return this._getLogFunction(logLevel, message, originalConsole2.debug, arguments);
6870
+ }
6871
+ info(logLevel, message) {
6872
+ return this._getLogFunction(logLevel, message, console.info, arguments);
6873
+ }
6874
+ once(logLevel, message) {
6875
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
6876
+ args[_key - 2] = arguments[_key];
6877
+ }
6878
+ return this._getLogFunction(logLevel, message, originalConsole2.debug || originalConsole2.info, arguments, ONCE2);
6879
+ }
6880
+ table(logLevel, table, columns) {
6881
+ if (table) {
6882
+ return this._getLogFunction(logLevel, table, console.table || noop3, columns && [columns], {
6883
+ tag: getTableHeader2(table)
6884
+ });
6885
+ }
6886
+ return noop3;
6887
+ }
6888
+ image(_ref) {
6889
+ let {
6890
+ logLevel,
6891
+ priority,
6892
+ image,
6893
+ message = "",
6894
+ scale: scale5 = 1
6895
+ } = _ref;
6896
+ if (!this._shouldLog(logLevel || priority)) {
6897
+ return noop3;
6898
+ }
6899
+ return isBrowser5 ? logImageInBrowser2({
6900
+ image,
6901
+ message,
6902
+ scale: scale5
6903
+ }) : logImageInNode2({
6904
+ image,
6905
+ message,
6906
+ scale: scale5
6907
+ });
6908
+ }
6909
+ time(logLevel, message) {
6910
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
6911
+ }
6912
+ timeEnd(logLevel, message) {
6913
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
6914
+ }
6915
+ timeStamp(logLevel, message) {
6916
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop3);
6917
+ }
6918
+ group(logLevel, message) {
6919
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
6920
+ collapsed: false
6921
+ };
6922
+ const options = normalizeArguments2({
6923
+ logLevel,
6924
+ message,
6925
+ opts
6926
+ });
6927
+ const {
6928
+ collapsed
6929
+ } = opts;
6930
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
6931
+ return this._getLogFunction(options);
6932
+ }
6933
+ groupCollapsed(logLevel, message) {
6934
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
6935
+ return this.group(logLevel, message, Object.assign({}, opts, {
6936
+ collapsed: true
6937
+ }));
6938
+ }
6939
+ groupEnd(logLevel) {
6940
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop3);
6941
+ }
6942
+ withGroup(logLevel, message, func) {
6943
+ this.group(logLevel, message)();
6944
+ try {
6945
+ func();
6946
+ } finally {
6947
+ this.groupEnd(logLevel)();
6948
+ }
6949
+ }
6950
+ trace() {
6951
+ if (console.trace) {
6952
+ console.trace();
6953
+ }
6954
+ }
6955
+ _shouldLog(logLevel) {
6956
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel2(logLevel);
6957
+ }
6958
+ _getLogFunction(logLevel, message, method, args, opts) {
6959
+ if (this._shouldLog(logLevel)) {
6960
+ opts = normalizeArguments2({
6961
+ logLevel,
6962
+ message,
6963
+ args,
6964
+ opts
6965
+ });
6966
+ method = method || opts.method;
6967
+ assert5(method);
6968
+ opts.total = this.getTotal();
6969
+ opts.delta = this.getDelta();
6970
+ this._deltaTs = getHiResTimestamp5();
6971
+ const tag = opts.tag || opts.message;
6972
+ if (opts.once) {
6973
+ if (!cache2[tag]) {
6974
+ cache2[tag] = getHiResTimestamp5();
6975
+ } else {
6976
+ return noop3;
6977
+ }
6978
+ }
6979
+ message = decorateMessage2(this.id, opts.message, opts);
6980
+ return method.bind(console, message, ...opts.args);
6981
+ }
6982
+ return noop3;
6983
+ }
6984
+ };
6985
+ _defineProperty(Log2, "VERSION", VERSION3);
6986
+ }
6987
+ });
6988
+
6989
+ // ../../node_modules/@probe.gl/log/dist/esm/index.js
6990
+ var esm_default2;
6991
+ var init_esm9 = __esm({
6992
+ "../../node_modules/@probe.gl/log/dist/esm/index.js"() {
6993
+ init_log2();
6994
+ init_log2();
6995
+ esm_default2 = new Log2({
6996
+ id: "@probe.gl/log"
6997
+ });
6998
+ }
6999
+ });
7000
+
7001
+ // ../core/src/lib/utils/log.ts
7002
+ var log;
7003
+ var init_log3 = __esm({
7004
+ "../core/src/lib/utils/log.ts"() {
7005
+ init_esm9();
7006
+ log = new Log2({ id: "loaders.gl" });
7007
+ }
7008
+ });
7009
+
6375
7010
  // ../core/src/lib/api/select-loader.ts
6376
7011
  async function selectLoader(data, loaders = [], options, context) {
6377
7012
  if (!validHTTPResponse(data)) {
@@ -6415,13 +7050,22 @@
6415
7050
  const { url, type } = getResourceUrlAndType(data);
6416
7051
  const testUrl = url || context?.url;
6417
7052
  let loader = null;
7053
+ let reason = "";
6418
7054
  if (options?.mimeType) {
6419
7055
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
7056
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
6420
7057
  }
6421
7058
  loader = loader || findLoaderByUrl(loaders, testUrl);
7059
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
6422
7060
  loader = loader || findLoaderByMIMEType(loaders, type);
7061
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
6423
7062
  loader = loader || findLoaderByInitialBytes(loaders, data);
7063
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
6424
7064
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
7065
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
7066
+ if (reason) {
7067
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
7068
+ }
6425
7069
  return loader;
6426
7070
  }
6427
7071
  function validHTTPResponse(data) {
@@ -6548,6 +7192,7 @@
6548
7192
  "../core/src/lib/api/select-loader.ts"() {
6549
7193
  init_src2();
6550
7194
  init_normalize_loader();
7195
+ init_log3();
6551
7196
  init_resource_utils();
6552
7197
  init_register_loaders();
6553
7198
  init_is_type();
@@ -8205,7 +8850,7 @@
8205
8850
  }
8206
8851
  this.cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(center, new Vector3());
8207
8852
  this.cartesianCenter = center;
8208
- this.zoom = getZoomFromBoundingVolume(root.boundingVolume);
8853
+ this.zoom = getZoomFromBoundingVolume(root.boundingVolume, this.cartographicCenter);
8209
8854
  }
8210
8855
  _initializeStats() {
8211
8856
  this.stats.get(TILES_TOTAL);