@loaders.gl/3d-tiles 4.4.0-alpha.9 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -4329,7 +4329,139 @@ var __exports__ = (() => {
4329
4329
  }
4330
4330
 
4331
4331
  // ../../node_modules/@probe.gl/env/dist/index.js
4332
- var VERSION = true ? "4.0.7" : "untranspiled source";
4332
+ var VERSION = true ? "4.1.1" : "untranspiled source";
4333
+
4334
+ // ../../node_modules/@probe.gl/log/dist/utils/assert.js
4335
+ function assert3(condition, message) {
4336
+ if (!condition) {
4337
+ throw new Error(message || "Assertion failed");
4338
+ }
4339
+ }
4340
+
4341
+ // ../../node_modules/@probe.gl/log/dist/loggers/log-utils.js
4342
+ function normalizeLogLevel(logLevel) {
4343
+ if (!logLevel) {
4344
+ return 0;
4345
+ }
4346
+ let resolvedLevel;
4347
+ switch (typeof logLevel) {
4348
+ case "number":
4349
+ resolvedLevel = logLevel;
4350
+ break;
4351
+ case "object":
4352
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
4353
+ break;
4354
+ default:
4355
+ return 0;
4356
+ }
4357
+ assert3(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
4358
+ return resolvedLevel;
4359
+ }
4360
+ function normalizeArguments(opts) {
4361
+ const { logLevel, message } = opts;
4362
+ opts.logLevel = normalizeLogLevel(logLevel);
4363
+ const args = opts.args ? Array.from(opts.args) : [];
4364
+ while (args.length && args.shift() !== message) {
4365
+ }
4366
+ switch (typeof logLevel) {
4367
+ case "string":
4368
+ case "function":
4369
+ if (message !== void 0) {
4370
+ args.unshift(message);
4371
+ }
4372
+ opts.message = logLevel;
4373
+ break;
4374
+ case "object":
4375
+ Object.assign(opts, logLevel);
4376
+ break;
4377
+ default:
4378
+ }
4379
+ if (typeof opts.message === "function") {
4380
+ opts.message = opts.message();
4381
+ }
4382
+ const messageType = typeof opts.message;
4383
+ assert3(messageType === "string" || messageType === "object");
4384
+ return Object.assign(opts, { args }, opts.opts);
4385
+ }
4386
+
4387
+ // ../../node_modules/@probe.gl/log/dist/loggers/base-log.js
4388
+ var noop = () => {
4389
+ };
4390
+ var BaseLog = class {
4391
+ constructor({ level = 0 } = {}) {
4392
+ this.userData = {};
4393
+ this._onceCache = /* @__PURE__ */ new Set();
4394
+ this._level = level;
4395
+ }
4396
+ set level(newLevel) {
4397
+ this.setLevel(newLevel);
4398
+ }
4399
+ get level() {
4400
+ return this.getLevel();
4401
+ }
4402
+ setLevel(level) {
4403
+ this._level = level;
4404
+ return this;
4405
+ }
4406
+ getLevel() {
4407
+ return this._level;
4408
+ }
4409
+ // Unconditional logging
4410
+ warn(message, ...args) {
4411
+ return this._log("warn", 0, message, args, { once: true });
4412
+ }
4413
+ error(message, ...args) {
4414
+ return this._log("error", 0, message, args);
4415
+ }
4416
+ // Conditional logging
4417
+ log(logLevel, message, ...args) {
4418
+ return this._log("log", logLevel, message, args);
4419
+ }
4420
+ info(logLevel, message, ...args) {
4421
+ return this._log("info", logLevel, message, args);
4422
+ }
4423
+ once(logLevel, message, ...args) {
4424
+ return this._log("once", logLevel, message, args, { once: true });
4425
+ }
4426
+ _log(type, logLevel, message, args, options = {}) {
4427
+ const normalized = normalizeArguments({
4428
+ logLevel,
4429
+ message,
4430
+ args: this._buildArgs(logLevel, message, args),
4431
+ opts: options
4432
+ });
4433
+ return this._createLogFunction(type, normalized, options);
4434
+ }
4435
+ _buildArgs(logLevel, message, args) {
4436
+ return [logLevel, message, ...args];
4437
+ }
4438
+ _createLogFunction(type, normalized, options) {
4439
+ if (!this._shouldLog(normalized.logLevel)) {
4440
+ return noop;
4441
+ }
4442
+ const tag = this._getOnceTag(options.tag ?? normalized.tag ?? normalized.message);
4443
+ if ((options.once || normalized.once) && tag !== void 0) {
4444
+ if (this._onceCache.has(tag)) {
4445
+ return noop;
4446
+ }
4447
+ this._onceCache.add(tag);
4448
+ }
4449
+ return this._emit(type, normalized);
4450
+ }
4451
+ _shouldLog(logLevel) {
4452
+ return this.getLevel() >= normalizeLogLevel(logLevel);
4453
+ }
4454
+ _getOnceTag(tag) {
4455
+ if (tag === void 0) {
4456
+ return void 0;
4457
+ }
4458
+ try {
4459
+ return typeof tag === "string" ? tag : String(tag);
4460
+ } catch {
4461
+ return void 0;
4462
+ }
4463
+ }
4464
+ };
4333
4465
 
4334
4466
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
4335
4467
  function getStorage(type) {
@@ -4448,13 +4580,6 @@ var __exports__ = (() => {
4448
4580
  }
4449
4581
  }
4450
4582
 
4451
- // ../../node_modules/@probe.gl/log/dist/utils/assert.js
4452
- function assert3(condition, message) {
4453
- if (!condition) {
4454
- throw new Error(message || "Assertion failed");
4455
- }
4456
- }
4457
-
4458
4583
  // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
4459
4584
  function getHiResTimestamp() {
4460
4585
  let timestamp;
@@ -4469,7 +4594,7 @@ var __exports__ = (() => {
4469
4594
  return timestamp;
4470
4595
  }
4471
4596
 
4472
- // ../../node_modules/@probe.gl/log/dist/log.js
4597
+ // ../../node_modules/@probe.gl/log/dist/loggers/probe-log.js
4473
4598
  var originalConsole = {
4474
4599
  debug: isBrowser2() ? console.debug || console.log : console.log,
4475
4600
  log: console.log,
@@ -4481,12 +4606,9 @@ var __exports__ = (() => {
4481
4606
  enabled: true,
4482
4607
  level: 0
4483
4608
  };
4484
- function noop() {
4485
- }
4486
- var cache = {};
4487
- var ONCE = { once: true };
4488
- var Log = class {
4609
+ var ProbeLog = class extends BaseLog {
4489
4610
  constructor({ id } = { id: "" }) {
4611
+ super({ level: 0 });
4490
4612
  this.VERSION = VERSION;
4491
4613
  this._startTs = getHiResTimestamp();
4492
4614
  this._deltaTs = getHiResTimestamp();
@@ -4494,22 +4616,16 @@ var __exports__ = (() => {
4494
4616
  this.LOG_THROTTLE_TIMEOUT = 0;
4495
4617
  this.id = id;
4496
4618
  this.userData = {};
4497
- this._storage = new LocalStorage(`__probe-${this.id}__`, DEFAULT_LOG_CONFIGURATION);
4619
+ this._storage = new LocalStorage(`__probe-${this.id}__`, { [this.id]: DEFAULT_LOG_CONFIGURATION });
4498
4620
  this.timeStamp(`${this.id} started`);
4499
4621
  autobind(this);
4500
4622
  Object.seal(this);
4501
4623
  }
4502
- set level(newLevel) {
4503
- this.setLevel(newLevel);
4504
- }
4505
- get level() {
4506
- return this.getLevel();
4507
- }
4508
4624
  isEnabled() {
4509
- return this._storage.config.enabled;
4625
+ return this._getConfiguration().enabled;
4510
4626
  }
4511
4627
  getLevel() {
4512
- return this._storage.config.level;
4628
+ return this._getConfiguration().level;
4513
4629
  }
4514
4630
  /** @return milliseconds, with fractions */
4515
4631
  getTotal() {
@@ -4533,20 +4649,20 @@ var __exports__ = (() => {
4533
4649
  }
4534
4650
  // Configure
4535
4651
  enable(enabled = true) {
4536
- this._storage.setConfiguration({ enabled });
4652
+ this._updateConfiguration({ enabled });
4537
4653
  return this;
4538
4654
  }
4539
4655
  setLevel(level) {
4540
- this._storage.setConfiguration({ level });
4656
+ this._updateConfiguration({ level });
4541
4657
  return this;
4542
4658
  }
4543
4659
  /** return the current status of the setting */
4544
4660
  get(setting) {
4545
- return this._storage.config[setting];
4661
+ return this._getConfiguration()[setting];
4546
4662
  }
4547
4663
  // update the status of the setting
4548
4664
  set(setting, value) {
4549
- this._storage.setConfiguration({ [setting]: value });
4665
+ this._updateConfiguration({ [setting]: value });
4550
4666
  }
4551
4667
  /** Logs the current settings as a table */
4552
4668
  settings() {
@@ -4562,11 +4678,16 @@ var __exports__ = (() => {
4562
4678
  throw new Error(message || "Assertion failed");
4563
4679
  }
4564
4680
  }
4565
- warn(message) {
4566
- return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
4681
+ warn(message, ...args) {
4682
+ return this._log("warn", 0, message, args, {
4683
+ method: originalConsole.warn,
4684
+ once: true
4685
+ });
4567
4686
  }
4568
- error(message) {
4569
- return this._getLogFunction(0, message, originalConsole.error, arguments);
4687
+ error(message, ...args) {
4688
+ return this._log("error", 0, message, args, {
4689
+ method: originalConsole.error
4690
+ });
4570
4691
  }
4571
4692
  /** Print a deprecation warning */
4572
4693
  deprecated(oldUsage, newUsage) {
@@ -4576,50 +4697,63 @@ var __exports__ = (() => {
4576
4697
  removed(oldUsage, newUsage) {
4577
4698
  return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
4578
4699
  }
4579
- probe(logLevel, message) {
4580
- return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
4700
+ probe(logLevel, message, ...args) {
4701
+ return this._log("log", logLevel, message, args, {
4702
+ method: originalConsole.log,
4581
4703
  time: true,
4582
4704
  once: true
4583
4705
  });
4584
4706
  }
4585
- log(logLevel, message) {
4586
- return this._getLogFunction(logLevel, message, originalConsole.debug, arguments);
4707
+ log(logLevel, message, ...args) {
4708
+ return this._log("log", logLevel, message, args, {
4709
+ method: originalConsole.debug
4710
+ });
4587
4711
  }
4588
- info(logLevel, message) {
4589
- return this._getLogFunction(logLevel, message, console.info, arguments);
4712
+ info(logLevel, message, ...args) {
4713
+ return this._log("info", logLevel, message, args, { method: console.info });
4590
4714
  }
4591
- once(logLevel, message) {
4592
- return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
4715
+ once(logLevel, message, ...args) {
4716
+ return this._log("once", logLevel, message, args, {
4717
+ method: originalConsole.debug || originalConsole.info,
4718
+ once: true
4719
+ });
4593
4720
  }
4594
4721
  /** Logs an object as a table */
4595
4722
  table(logLevel, table, columns) {
4596
4723
  if (table) {
4597
- return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
4724
+ return this._log("table", logLevel, table, columns && [columns] || [], {
4725
+ method: console.table || noop,
4598
4726
  tag: getTableHeader(table)
4599
4727
  });
4600
4728
  }
4601
4729
  return noop;
4602
4730
  }
4603
4731
  time(logLevel, message) {
4604
- return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
4732
+ return this._log("time", logLevel, message, [], {
4733
+ method: console.time ? console.time : console.info
4734
+ });
4605
4735
  }
4606
4736
  timeEnd(logLevel, message) {
4607
- return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
4737
+ return this._log("time", logLevel, message, [], {
4738
+ method: console.timeEnd ? console.timeEnd : console.info
4739
+ });
4608
4740
  }
4609
4741
  timeStamp(logLevel, message) {
4610
- return this._getLogFunction(logLevel, message, console.timeStamp || noop);
4742
+ return this._log("time", logLevel, message, [], {
4743
+ method: console.timeStamp || noop
4744
+ });
4611
4745
  }
4612
4746
  group(logLevel, message, opts = { collapsed: false }) {
4613
- const options = normalizeArguments({ logLevel, message, opts });
4614
- const { collapsed } = opts;
4615
- options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
4616
- return this._getLogFunction(options);
4747
+ const method = (opts.collapsed ? console.groupCollapsed : console.group) || console.info;
4748
+ return this._log("group", logLevel, message, [], { method });
4617
4749
  }
4618
4750
  groupCollapsed(logLevel, message, opts = {}) {
4619
4751
  return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
4620
4752
  }
4621
4753
  groupEnd(logLevel) {
4622
- return this._getLogFunction(logLevel, "", console.groupEnd || noop);
4754
+ return this._log("groupEnd", logLevel, "", [], {
4755
+ method: console.groupEnd || noop
4756
+ });
4623
4757
  }
4624
4758
  // EXPERIMENTAL
4625
4759
  withGroup(logLevel, message, func) {
@@ -4635,78 +4769,34 @@ var __exports__ = (() => {
4635
4769
  console.trace();
4636
4770
  }
4637
4771
  }
4638
- // PRIVATE METHODS
4639
- /** Deduces log level from a variety of arguments */
4640
4772
  _shouldLog(logLevel) {
4641
- return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
4642
- }
4643
- _getLogFunction(logLevel, message, method, args, opts) {
4644
- if (this._shouldLog(logLevel)) {
4645
- opts = normalizeArguments({ logLevel, message, args, opts });
4646
- method = method || opts.method;
4647
- assert3(method);
4648
- opts.total = this.getTotal();
4649
- opts.delta = this.getDelta();
4650
- this._deltaTs = getHiResTimestamp();
4651
- const tag = opts.tag || opts.message;
4652
- if (opts.once && tag) {
4653
- if (!cache[tag]) {
4654
- cache[tag] = getHiResTimestamp();
4655
- } else {
4656
- return noop;
4657
- }
4658
- }
4659
- message = decorateMessage(this.id, opts.message, opts);
4660
- return method.bind(console, message, ...opts.args);
4661
- }
4662
- return noop;
4773
+ return this.isEnabled() && super._shouldLog(logLevel);
4663
4774
  }
4664
- };
4665
- Log.VERSION = VERSION;
4666
- function normalizeLogLevel(logLevel) {
4667
- if (!logLevel) {
4668
- return 0;
4669
- }
4670
- let resolvedLevel;
4671
- switch (typeof logLevel) {
4672
- case "number":
4673
- resolvedLevel = logLevel;
4674
- break;
4675
- case "object":
4676
- resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
4677
- break;
4678
- default:
4679
- return 0;
4680
- }
4681
- assert3(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
4682
- return resolvedLevel;
4683
- }
4684
- function normalizeArguments(opts) {
4685
- const { logLevel, message } = opts;
4686
- opts.logLevel = normalizeLogLevel(logLevel);
4687
- const args = opts.args ? Array.from(opts.args) : [];
4688
- while (args.length && args.shift() !== message) {
4775
+ _emit(_type, normalized) {
4776
+ const method = normalized.method;
4777
+ assert3(method);
4778
+ normalized.total = this.getTotal();
4779
+ normalized.delta = this.getDelta();
4780
+ this._deltaTs = getHiResTimestamp();
4781
+ const message = decorateMessage(this.id, normalized.message, normalized);
4782
+ return method.bind(console, message, ...normalized.args);
4689
4783
  }
4690
- switch (typeof logLevel) {
4691
- case "string":
4692
- case "function":
4693
- if (message !== void 0) {
4694
- args.unshift(message);
4695
- }
4696
- opts.message = logLevel;
4697
- break;
4698
- case "object":
4699
- Object.assign(opts, logLevel);
4700
- break;
4701
- default:
4784
+ _getConfiguration() {
4785
+ if (!this._storage.config[this.id]) {
4786
+ this._updateConfiguration(DEFAULT_LOG_CONFIGURATION);
4787
+ }
4788
+ return this._storage.config[this.id];
4702
4789
  }
4703
- if (typeof opts.message === "function") {
4704
- opts.message = opts.message();
4790
+ _updateConfiguration(configuration) {
4791
+ const currentConfiguration = this._storage.config[this.id] || {
4792
+ ...DEFAULT_LOG_CONFIGURATION
4793
+ };
4794
+ this._storage.setConfiguration({
4795
+ [this.id]: { ...currentConfiguration, ...configuration }
4796
+ });
4705
4797
  }
4706
- const messageType = typeof opts.message;
4707
- assert3(messageType === "string" || messageType === "object");
4708
- return Object.assign(opts, { args }, opts.opts);
4709
- }
4798
+ };
4799
+ ProbeLog.VERSION = VERSION;
4710
4800
  function decorateMessage(id, message, opts) {
4711
4801
  if (typeof message === "string") {
4712
4802
  const time = opts.time ? leftPad(formatTime(opts.total)) : "";
@@ -4728,7 +4818,7 @@ var __exports__ = (() => {
4728
4818
  globalThis.probe = {};
4729
4819
 
4730
4820
  // ../../node_modules/@probe.gl/log/dist/index.js
4731
- var dist_default = new Log({ id: "@probe.gl/log" });
4821
+ var dist_default = new ProbeLog({ id: "@probe.gl/log" });
4732
4822
 
4733
4823
  // ../loader-utils/src/lib/javascript-utils/is-type.ts
4734
4824
  var isSharedArrayBuffer = (value) => typeof SharedArrayBuffer !== "undefined" && value instanceof SharedArrayBuffer;
@@ -4795,6 +4885,16 @@ var __exports__ = (() => {
4795
4885
 
4796
4886
  // ../worker-utils/src/lib/library-utils/library-utils.ts
4797
4887
  var loadLibraryPromises = {};
4888
+ function extractLoadLibraryOptions(options = {}) {
4889
+ const useLocalLibraries = options.useLocalLibraries ?? options.core?.useLocalLibraries;
4890
+ const CDN = options.CDN ?? options.core?.CDN;
4891
+ const modules = options.modules;
4892
+ return {
4893
+ ...useLocalLibraries !== void 0 ? { useLocalLibraries } : {},
4894
+ ...CDN !== void 0 ? { CDN } : {},
4895
+ ...modules !== void 0 ? { modules } : {}
4896
+ };
4897
+ }
4798
4898
  async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
4799
4899
  if (moduleName) {
4800
4900
  libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
@@ -11567,7 +11667,6 @@ var __exports__ = (() => {
11567
11667
  draco: {
11568
11668
  decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
11569
11669
  // 'js' for IE11
11570
- libraryPath: "libs/",
11571
11670
  extraAttributes: {},
11572
11671
  attributeNameEntry: void 0
11573
11672
  }
@@ -11579,7 +11678,7 @@ var __exports__ = (() => {
11579
11678
  };
11580
11679
  async function parse(arrayBuffer, options) {
11581
11680
  const { draco } = await loadDracoDecoderModule(
11582
- options?.core,
11681
+ extractLoadLibraryOptions(options),
11583
11682
  options?.draco?.decoderType || "wasm"
11584
11683
  );
11585
11684
  const dracoParser = new DracoParser(draco);
@@ -11720,7 +11819,7 @@ var __exports__ = (() => {
11720
11819
  if (length4 === void 0) {
11721
11820
  length4 = (buffer.byteLength - byteOffset) / GLType.getByteSize(glType);
11722
11821
  }
11723
- const arrayBuffer = buffer instanceof ArrayBuffer ? buffer : buffer.buffer;
11822
+ const arrayBuffer = ArrayBuffer.isView(buffer) ? buffer.buffer : buffer;
11724
11823
  const ArrayType = GLType.getArrayType(glType);
11725
11824
  return new ArrayType(arrayBuffer, byteOffset, length4);
11726
11825
  }
@@ -15146,104 +15245,117 @@ var __exports__ = (() => {
15146
15245
  }
15147
15246
 
15148
15247
  // ../textures/src/lib/gl-extensions.ts
15149
- var GL_EXTENSIONS_CONSTANTS = {
15150
- // WEBGL_compressed_texture_s3tc
15151
- COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
15152
- COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
15153
- COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
15154
- COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
15155
- // WEBGL_compressed_texture_es3
15156
- COMPRESSED_R11_EAC: 37488,
15157
- COMPRESSED_SIGNED_R11_EAC: 37489,
15158
- COMPRESSED_RG11_EAC: 37490,
15159
- COMPRESSED_SIGNED_RG11_EAC: 37491,
15160
- COMPRESSED_RGB8_ETC2: 37492,
15161
- COMPRESSED_RGBA8_ETC2_EAC: 37493,
15162
- COMPRESSED_SRGB8_ETC2: 37494,
15163
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
15164
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
15165
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
15166
- // WEBGL_compressed_texture_pvrtc
15167
- COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
15168
- COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
15169
- COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
15170
- COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
15171
- // WEBGL_compressed_texture_etc1
15172
- COMPRESSED_RGB_ETC1_WEBGL: 36196,
15173
- // WEBGL_compressed_texture_atc
15174
- COMPRESSED_RGB_ATC_WEBGL: 35986,
15175
- COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
15176
- COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
15177
- // WEBGL_compressed_texture_astc
15178
- COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
15179
- COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
15180
- COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
15181
- COMPRESSED_RGBA_ASTC_6X5_KHR: 37811,
15182
- COMPRESSED_RGBA_ASTC_6X6_KHR: 37812,
15183
- COMPRESSED_RGBA_ASTC_8X5_KHR: 37813,
15184
- COMPRESSED_RGBA_ASTC_8X6_KHR: 37814,
15185
- COMPRESSED_RGBA_ASTC_8X8_KHR: 37815,
15186
- COMPRESSED_RGBA_ASTC_10X5_KHR: 37816,
15187
- COMPRESSED_RGBA_ASTC_10X6_KHR: 37817,
15188
- COMPRESSED_RGBA_ASTC_10X8_KHR: 37818,
15189
- COMPRESSED_RGBA_ASTC_10X10_KHR: 37819,
15190
- COMPRESSED_RGBA_ASTC_12X10_KHR: 37820,
15191
- COMPRESSED_RGBA_ASTC_12X12_KHR: 37821,
15192
- COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840,
15193
- COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841,
15194
- COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842,
15195
- COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843,
15196
- COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844,
15197
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845,
15198
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846,
15199
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847,
15200
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848,
15201
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849,
15202
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850,
15203
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
15204
- COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
15205
- COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
15206
- // EXT_texture_compression_rgtc
15207
- COMPRESSED_RED_RGTC1_EXT: 36283,
15208
- COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
15209
- COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
15210
- COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
15211
- // WEBGL_compressed_texture_s3tc_srgb
15212
- COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
15213
- COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
15214
- COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
15215
- COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919
15216
- };
15248
+ var GL_RGBA4 = 32854;
15249
+ var GL_RGBA8 = 32856;
15250
+ var GL_RGB565 = 36194;
15251
+ var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
15252
+ var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
15253
+ var GL_COMPRESSED_RGBA8_ETC2_EAC = 37493;
15254
+ var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
15255
+ var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
15256
+ var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
15257
+ var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
15258
+ var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
15259
+ var GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808;
15260
+ var GL_COMPRESSED_RED_RGTC1_EXT = 36283;
15261
+ var GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285;
15262
+ var GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492;
15217
15263
 
15218
- // ../textures/src/lib/utils/texture-formats.ts
15264
+ // ../textures/src/lib/utils/detect-supported-texture-formats.ts
15219
15265
  var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
15220
- var WEBGL_EXTENSIONS = {
15266
+ var WEBGL_TEXTURE_FORMATS = {
15221
15267
  /* eslint-disable camelcase */
15222
- WEBGL_compressed_texture_s3tc: "dxt",
15223
- WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
15224
- WEBGL_compressed_texture_etc1: "etc1",
15225
- WEBGL_compressed_texture_etc: "etc2",
15226
- WEBGL_compressed_texture_pvrtc: "pvrtc",
15227
- WEBGL_compressed_texture_atc: "atc",
15228
- WEBGL_compressed_texture_astc: "astc",
15229
- EXT_texture_compression_rgtc: "rgtc"
15268
+ WEBGL_compressed_texture_s3tc: [
15269
+ "bc1-rgb-unorm-webgl",
15270
+ "bc1-rgba-unorm",
15271
+ "bc2-rgba-unorm",
15272
+ "bc3-rgba-unorm"
15273
+ ],
15274
+ WEBGL_compressed_texture_s3tc_srgb: [
15275
+ "bc1-rgb-unorm-srgb-webgl",
15276
+ "bc1-rgba-unorm-srgb",
15277
+ "bc2-rgba-unorm-srgb",
15278
+ "bc3-rgba-unorm-srgb"
15279
+ ],
15280
+ EXT_texture_compression_rgtc: ["bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm"],
15281
+ EXT_texture_compression_bptc: [
15282
+ "bc6h-rgb-ufloat",
15283
+ "bc6h-rgb-float",
15284
+ "bc7-rgba-unorm",
15285
+ "bc7-rgba-unorm-srgb"
15286
+ ],
15287
+ WEBGL_compressed_texture_etc1: ["etc1-rgb-unorm-webgl"],
15288
+ WEBGL_compressed_texture_etc: [
15289
+ "etc2-rgb8unorm",
15290
+ "etc2-rgb8unorm-srgb",
15291
+ "etc2-rgb8a1unorm",
15292
+ "etc2-rgb8a1unorm-srgb",
15293
+ "etc2-rgba8unorm",
15294
+ "etc2-rgba8unorm-srgb",
15295
+ "eac-r11unorm",
15296
+ "eac-r11snorm",
15297
+ "eac-rg11unorm",
15298
+ "eac-rg11snorm"
15299
+ ],
15300
+ WEBGL_compressed_texture_pvrtc: [
15301
+ "pvrtc-rgb4unorm-webgl",
15302
+ "pvrtc-rgba4unorm-webgl",
15303
+ "pvrtc-rgb2unorm-webgl",
15304
+ "pvrtc-rgba2unorm-webgl"
15305
+ ],
15306
+ WEBGL_compressed_texture_atc: [
15307
+ "atc-rgb-unorm-webgl",
15308
+ "atc-rgba-unorm-webgl",
15309
+ "atc-rgbai-unorm-webgl"
15310
+ ],
15311
+ WEBGL_compressed_texture_astc: [
15312
+ "astc-4x4-unorm",
15313
+ "astc-4x4-unorm-srgb",
15314
+ "astc-5x4-unorm",
15315
+ "astc-5x4-unorm-srgb",
15316
+ "astc-5x5-unorm",
15317
+ "astc-5x5-unorm-srgb",
15318
+ "astc-6x5-unorm",
15319
+ "astc-6x5-unorm-srgb",
15320
+ "astc-6x6-unorm",
15321
+ "astc-6x6-unorm-srgb",
15322
+ "astc-8x5-unorm",
15323
+ "astc-8x5-unorm-srgb",
15324
+ "astc-8x6-unorm",
15325
+ "astc-8x6-unorm-srgb",
15326
+ "astc-8x8-unorm",
15327
+ "astc-8x8-unorm-srgb",
15328
+ "astc-10x5-unorm",
15329
+ "astc-10x5-unorm-srgb",
15330
+ "astc-10x6-unorm",
15331
+ "astc-10x6-unorm-srgb",
15332
+ "astc-10x8-unorm",
15333
+ "astc-10x8-unorm-srgb",
15334
+ "astc-10x10-unorm",
15335
+ "astc-10x10-unorm-srgb",
15336
+ "astc-12x10-unorm",
15337
+ "astc-12x10-unorm-srgb",
15338
+ "astc-12x12-unorm",
15339
+ "astc-12x12-unorm-srgb"
15340
+ ]
15230
15341
  /* eslint-enable camelcase */
15231
15342
  };
15232
- var formats = null;
15233
- function getSupportedGPUTextureFormats(gl) {
15234
- if (!formats) {
15343
+ var textureFormats = null;
15344
+ function detectSupportedTextureFormats(gl) {
15345
+ if (!textureFormats) {
15235
15346
  gl = gl || getWebGLContext() || void 0;
15236
- formats = /* @__PURE__ */ new Set();
15347
+ textureFormats = /* @__PURE__ */ new Set();
15237
15348
  for (const prefix of BROWSER_PREFIXES) {
15238
- for (const extension in WEBGL_EXTENSIONS) {
15349
+ for (const extension in WEBGL_TEXTURE_FORMATS) {
15239
15350
  if (gl && gl.getExtension(`${prefix}${extension}`)) {
15240
- const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
15241
- formats.add(gpuTextureFormat);
15351
+ for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {
15352
+ textureFormats.add(textureFormat);
15353
+ }
15242
15354
  }
15243
15355
  }
15244
15356
  }
15245
15357
  }
15246
- return formats;
15358
+ return textureFormats;
15247
15359
  }
15248
15360
  function getWebGLContext() {
15249
15361
  try {
@@ -15288,73 +15400,154 @@ var __exports__ = (() => {
15288
15400
  }
15289
15401
 
15290
15402
  // ../textures/src/lib/parsers/parse-basis.ts
15291
- var OutputFormat = {
15403
+ var basisTranscodingLock = Promise.resolve();
15404
+ var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
15292
15405
  etc1: {
15293
15406
  basisFormat: 0,
15294
15407
  compressed: true,
15295
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL
15408
+ format: GL_COMPRESSED_RGB_ETC1_WEBGL,
15409
+ textureFormat: "etc1-rgb-unorm-webgl"
15410
+ },
15411
+ etc2: {
15412
+ basisFormat: 1,
15413
+ compressed: true,
15414
+ format: GL_COMPRESSED_RGBA8_ETC2_EAC,
15415
+ textureFormat: "etc2-rgba8unorm"
15296
15416
  },
15297
- etc2: { basisFormat: 1, compressed: true },
15298
15417
  bc1: {
15299
15418
  basisFormat: 2,
15300
15419
  compressed: true,
15301
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT
15420
+ format: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
15421
+ textureFormat: "bc1-rgb-unorm-webgl"
15302
15422
  },
15303
15423
  bc3: {
15304
15424
  basisFormat: 3,
15305
15425
  compressed: true,
15306
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT
15426
+ format: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
15427
+ textureFormat: "bc3-rgba-unorm"
15428
+ },
15429
+ bc4: {
15430
+ basisFormat: 4,
15431
+ compressed: true,
15432
+ format: GL_COMPRESSED_RED_RGTC1_EXT,
15433
+ textureFormat: "bc4-r-unorm"
15434
+ },
15435
+ bc5: {
15436
+ basisFormat: 5,
15437
+ compressed: true,
15438
+ format: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
15439
+ textureFormat: "bc5-rg-unorm"
15440
+ },
15441
+ "bc7-m6-opaque-only": {
15442
+ basisFormat: 6,
15443
+ compressed: true,
15444
+ format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
15445
+ textureFormat: "bc7-rgba-unorm"
15446
+ },
15447
+ "bc7-m5": {
15448
+ basisFormat: 7,
15449
+ compressed: true,
15450
+ format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
15451
+ textureFormat: "bc7-rgba-unorm"
15307
15452
  },
15308
- bc4: { basisFormat: 4, compressed: true },
15309
- bc5: { basisFormat: 5, compressed: true },
15310
- "bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
15311
- "bc7-m5": { basisFormat: 7, compressed: true },
15312
15453
  "pvrtc1-4-rgb": {
15313
15454
  basisFormat: 8,
15314
15455
  compressed: true,
15315
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG
15456
+ format: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
15457
+ textureFormat: "pvrtc-rgb4unorm-webgl"
15316
15458
  },
15317
15459
  "pvrtc1-4-rgba": {
15318
15460
  basisFormat: 9,
15319
15461
  compressed: true,
15320
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
15462
+ format: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
15463
+ textureFormat: "pvrtc-rgba4unorm-webgl"
15321
15464
  },
15322
15465
  "astc-4x4": {
15323
15466
  basisFormat: 10,
15324
15467
  compressed: true,
15325
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR
15468
+ format: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
15469
+ textureFormat: "astc-4x4-unorm"
15326
15470
  },
15327
- "atc-rgb": { basisFormat: 11, compressed: true },
15328
- "atc-rgba-interpolated-alpha": { basisFormat: 12, compressed: true },
15329
- rgba32: { basisFormat: 13, compressed: false },
15330
- rgb565: { basisFormat: 14, compressed: false },
15331
- bgr565: { basisFormat: 15, compressed: false },
15332
- rgba4444: { basisFormat: 16, compressed: false }
15471
+ "atc-rgb": {
15472
+ basisFormat: 11,
15473
+ compressed: true,
15474
+ format: GL_COMPRESSED_RGB_ATC_WEBGL,
15475
+ textureFormat: "atc-rgb-unorm-webgl"
15476
+ },
15477
+ "atc-rgba-interpolated-alpha": {
15478
+ basisFormat: 12,
15479
+ compressed: true,
15480
+ format: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
15481
+ textureFormat: "atc-rgbai-unorm-webgl"
15482
+ },
15483
+ rgba32: {
15484
+ basisFormat: 13,
15485
+ compressed: false,
15486
+ format: GL_RGBA8,
15487
+ textureFormat: "rgba8unorm"
15488
+ },
15489
+ rgb565: {
15490
+ basisFormat: 14,
15491
+ compressed: false,
15492
+ format: GL_RGB565,
15493
+ textureFormat: "rgb565unorm-webgl"
15494
+ },
15495
+ bgr565: {
15496
+ basisFormat: 15,
15497
+ compressed: false,
15498
+ format: GL_RGB565,
15499
+ textureFormat: "rgb565unorm-webgl"
15500
+ },
15501
+ rgba4444: {
15502
+ basisFormat: 16,
15503
+ compressed: false,
15504
+ format: GL_RGBA4,
15505
+ textureFormat: "rgba4unorm-webgl"
15506
+ }
15333
15507
  };
15508
+ var BASIS_FORMATS = Object.freeze(
15509
+ Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS)
15510
+ );
15511
+ async function withBasisTranscodingLock(transcode) {
15512
+ const previousLock = basisTranscodingLock;
15513
+ let releaseLock;
15514
+ basisTranscodingLock = new Promise((resolve2) => {
15515
+ releaseLock = resolve2;
15516
+ });
15517
+ await previousLock;
15518
+ try {
15519
+ return await transcode();
15520
+ } finally {
15521
+ releaseLock();
15522
+ }
15523
+ }
15334
15524
  async function parseBasis(data, options = {}) {
15335
- if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
15336
- if (isKTX(data)) {
15337
- const fileConstructors = await loadBasisEncoderModule(options?.core || {});
15338
- return parseKTX2File(fileConstructors.KTX2File, data, options);
15339
- }
15340
- const { BasisFile } = await loadBasisTranscoderModule(options?.core || {});
15341
- return parseBasisFile(BasisFile, data, options);
15342
- }
15343
- switch (options.basis.module) {
15344
- case "encoder":
15345
- const fileConstructors = await loadBasisEncoderModule(options?.core || {});
15346
- switch (options.basis.containerFormat) {
15347
- case "ktx2":
15348
- return parseKTX2File(fileConstructors.KTX2File, data, options);
15349
- case "basis":
15350
- default:
15351
- return parseBasisFile(fileConstructors.BasisFile, data, options);
15352
- }
15353
- case "transcoder":
15354
- default:
15355
- const { BasisFile } = await loadBasisTranscoderModule(options.core || {});
15525
+ const loadLibraryOptions = extractLoadLibraryOptions(options);
15526
+ return await withBasisTranscodingLock(async () => {
15527
+ if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
15528
+ if (isKTX(data)) {
15529
+ const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
15530
+ return parseKTX2File(fileConstructors.KTX2File, data, options);
15531
+ }
15532
+ const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
15356
15533
  return parseBasisFile(BasisFile, data, options);
15357
- }
15534
+ }
15535
+ switch (options.basis.module) {
15536
+ case "encoder":
15537
+ const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
15538
+ switch (options.basis.containerFormat) {
15539
+ case "ktx2":
15540
+ return parseKTX2File(fileConstructors.KTX2File, data, options);
15541
+ case "basis":
15542
+ default:
15543
+ return parseBasisFile(fileConstructors.BasisFile, data, options);
15544
+ }
15545
+ case "transcoder":
15546
+ default:
15547
+ const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
15548
+ return parseBasisFile(BasisFile, data, options);
15549
+ }
15550
+ });
15358
15551
  }
15359
15552
  function parseBasisFile(BasisFile, data, options) {
15360
15553
  const basisFile = new BasisFile(new Uint8Array(data));
@@ -15384,7 +15577,7 @@ var __exports__ = (() => {
15384
15577
  const hasAlpha = basisFile.getHasAlpha(
15385
15578
  /* imageIndex, levelIndex */
15386
15579
  );
15387
- const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);
15580
+ const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, hasAlpha);
15388
15581
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
15389
15582
  const decodedData = new Uint8Array(decodedSize);
15390
15583
  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
@@ -15392,11 +15585,13 @@ var __exports__ = (() => {
15392
15585
  }
15393
15586
  return {
15394
15587
  // standard loaders.gl image category payload
15588
+ shape: "texture-level",
15395
15589
  width,
15396
15590
  height,
15397
15591
  data: decodedData,
15398
15592
  compressed,
15399
- format,
15593
+ ...format !== void 0 ? { format } : {},
15594
+ ...textureFormat !== void 0 ? { textureFormat } : {},
15400
15595
  // Additional fields
15401
15596
  // Add levelSize field.
15402
15597
  hasAlpha
@@ -15421,7 +15616,7 @@ var __exports__ = (() => {
15421
15616
  }
15422
15617
  function transcodeKTX2Image(ktx2File, levelIndex, options) {
15423
15618
  const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);
15424
- const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);
15619
+ const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, alphaFlag);
15425
15620
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(
15426
15621
  levelIndex,
15427
15622
  0,
@@ -15444,48 +15639,98 @@ var __exports__ = (() => {
15444
15639
  }
15445
15640
  return {
15446
15641
  // standard loaders.gl image category payload
15642
+ shape: "texture-level",
15447
15643
  width,
15448
15644
  height,
15449
15645
  data: decodedData,
15450
15646
  compressed,
15647
+ ...format !== void 0 ? { format } : {},
15648
+ ...textureFormat !== void 0 ? { textureFormat } : {},
15451
15649
  // Additional fields
15452
15650
  levelSize: decodedSize,
15453
- hasAlpha: alphaFlag,
15454
- format
15651
+ hasAlpha: alphaFlag
15455
15652
  };
15456
15653
  }
15457
15654
  function getBasisOptions(options, hasAlpha) {
15458
- let format = options.basis?.format;
15655
+ let format = options.basis?.format || "auto";
15459
15656
  if (format === "auto") {
15460
- format = selectSupportedBasisFormat();
15657
+ format = options.basis?.supportedTextureFormats ? selectSupportedBasisFormat(options.basis.supportedTextureFormats) : selectSupportedBasisFormat();
15461
15658
  }
15462
15659
  if (typeof format === "object") {
15463
15660
  format = hasAlpha ? format.alpha : format.noAlpha;
15464
15661
  }
15465
- format = format.toLowerCase();
15466
- return OutputFormat[format];
15662
+ const normalizedFormat = format.toLowerCase();
15663
+ const basisOutputOptions = BASIS_FORMAT_TO_OUTPUT_OPTIONS[normalizedFormat];
15664
+ if (!basisOutputOptions) {
15665
+ throw new Error(`Unknown Basis format ${format}`);
15666
+ }
15667
+ return basisOutputOptions;
15467
15668
  }
15468
- function selectSupportedBasisFormat() {
15469
- const supportedFormats = getSupportedGPUTextureFormats();
15470
- if (supportedFormats.has("astc")) {
15669
+ function selectSupportedBasisFormat(supportedTextureFormats = detectSupportedTextureFormats()) {
15670
+ const textureFormats2 = new Set(supportedTextureFormats);
15671
+ if (hasSupportedTextureFormat(textureFormats2, ["astc-4x4-unorm", "astc-4x4-unorm-srgb"])) {
15471
15672
  return "astc-4x4";
15472
- } else if (supportedFormats.has("dxt")) {
15673
+ } else if (hasSupportedTextureFormat(textureFormats2, ["bc7-rgba-unorm", "bc7-rgba-unorm-srgb"])) {
15674
+ return {
15675
+ alpha: "bc7-m5",
15676
+ noAlpha: "bc7-m6-opaque-only"
15677
+ };
15678
+ } else if (hasSupportedTextureFormat(textureFormats2, [
15679
+ "bc1-rgb-unorm-webgl",
15680
+ "bc1-rgb-unorm-srgb-webgl",
15681
+ "bc1-rgba-unorm",
15682
+ "bc1-rgba-unorm-srgb",
15683
+ "bc2-rgba-unorm",
15684
+ "bc2-rgba-unorm-srgb",
15685
+ "bc3-rgba-unorm",
15686
+ "bc3-rgba-unorm-srgb"
15687
+ ])) {
15473
15688
  return {
15474
15689
  alpha: "bc3",
15475
15690
  noAlpha: "bc1"
15476
15691
  };
15477
- } else if (supportedFormats.has("pvrtc")) {
15692
+ } else if (hasSupportedTextureFormat(textureFormats2, [
15693
+ "pvrtc-rgb4unorm-webgl",
15694
+ "pvrtc-rgba4unorm-webgl",
15695
+ "pvrtc-rgb2unorm-webgl",
15696
+ "pvrtc-rgba2unorm-webgl"
15697
+ ])) {
15478
15698
  return {
15479
15699
  alpha: "pvrtc1-4-rgba",
15480
15700
  noAlpha: "pvrtc1-4-rgb"
15481
15701
  };
15482
- } else if (supportedFormats.has("etc1")) {
15483
- return "etc1";
15484
- } else if (supportedFormats.has("etc2")) {
15702
+ } else if (hasSupportedTextureFormat(textureFormats2, [
15703
+ "etc2-rgb8unorm",
15704
+ "etc2-rgb8unorm-srgb",
15705
+ "etc2-rgb8a1unorm",
15706
+ "etc2-rgb8a1unorm-srgb",
15707
+ "etc2-rgba8unorm",
15708
+ "etc2-rgba8unorm-srgb",
15709
+ "eac-r11unorm",
15710
+ "eac-r11snorm",
15711
+ "eac-rg11unorm",
15712
+ "eac-rg11snorm"
15713
+ ])) {
15485
15714
  return "etc2";
15715
+ } else if (textureFormats2.has("etc1-rgb-unorm-webgl")) {
15716
+ return "etc1";
15717
+ } else if (hasSupportedTextureFormat(textureFormats2, [
15718
+ "atc-rgb-unorm-webgl",
15719
+ "atc-rgba-unorm-webgl",
15720
+ "atc-rgbai-unorm-webgl"
15721
+ ])) {
15722
+ return {
15723
+ alpha: "atc-rgba-interpolated-alpha",
15724
+ noAlpha: "atc-rgb"
15725
+ };
15486
15726
  }
15487
15727
  return "rgb565";
15488
15728
  }
15729
+ function hasSupportedTextureFormat(supportedTextureFormats, candidateTextureFormats) {
15730
+ return candidateTextureFormats.some(
15731
+ (textureFormat) => supportedTextureFormats.has(textureFormat)
15732
+ );
15733
+ }
15489
15734
 
15490
15735
  // ../textures/src/basis-loader.ts
15491
15736
  var BasisWorkerLoader = {
@@ -15503,7 +15748,6 @@ var __exports__ = (() => {
15503
15748
  options: {
15504
15749
  basis: {
15505
15750
  format: "auto",
15506
- libraryPath: "libs/",
15507
15751
  containerFormat: "auto",
15508
15752
  module: "transcoder"
15509
15753
  }
@@ -15625,16 +15869,26 @@ var __exports__ = (() => {
15625
15869
  }
15626
15870
 
15627
15871
  // ../gltf/src/lib/gltf-utils/resolve-url.ts
15628
- function resolveUrl(url, options) {
15872
+ function resolveUrl(url, options, context) {
15629
15873
  const absolute = url.startsWith("data:") || url.startsWith("http:") || url.startsWith("https:");
15630
15874
  if (absolute) {
15631
15875
  return url;
15632
15876
  }
15633
- const baseUrl = options?.core?.baseUri || options.baseUri || options.uri;
15877
+ const baseUrl = context?.baseUrl || getResolveBaseUrl(options?.core?.baseUrl);
15878
+ if (!baseUrl) {
15879
+ throw new Error(`'baseUrl' must be provided to resolve relative url ${url}`);
15880
+ }
15881
+ return baseUrl.endsWith("/") ? `${baseUrl}${url}` : `${baseUrl}/${url}`;
15882
+ }
15883
+ function getResolveBaseUrl(baseUrl) {
15634
15884
  if (!baseUrl) {
15635
- throw new Error(`'baseUri' must be provided to resolve relative url ${url}`);
15885
+ return void 0;
15886
+ }
15887
+ if (baseUrl.endsWith("/")) {
15888
+ return baseUrl;
15636
15889
  }
15637
- return baseUrl.substr(0, baseUrl.lastIndexOf("/") + 1) + url;
15890
+ const slashIndex = baseUrl.lastIndexOf("/");
15891
+ return slashIndex >= 0 ? baseUrl.slice(0, slashIndex + 1) : "";
15638
15892
  }
15639
15893
 
15640
15894
  // ../gltf/src/lib/extensions/EXT_meshopt_compression.ts
@@ -16720,8 +16974,8 @@ var __exports__ = (() => {
16720
16974
  return gltf;
16721
16975
  }
16722
16976
  function parseGLTFContainerSync(gltf, data, byteOffset, options) {
16723
- if (options.core?.baseUri) {
16724
- gltf.baseUri = options.core?.baseUri;
16977
+ if (options.core?.baseUrl) {
16978
+ gltf.baseUri = options.core?.baseUrl;
16725
16979
  }
16726
16980
  if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options.glb)) {
16727
16981
  const textDecoder = new TextDecoder();
@@ -16758,7 +17012,7 @@ var __exports__ = (() => {
16758
17012
  if (buffer.uri) {
16759
17013
  const { fetch: fetch2 } = context;
16760
17014
  assert7(fetch2);
16761
- const uri = resolveUrl(buffer.uri, options);
17015
+ const uri = resolveUrl(buffer.uri, options, context);
16762
17016
  const response = await context?.fetch?.(uri);
16763
17017
  const arrayBuffer = await response?.arrayBuffer?.();
16764
17018
  gltf.buffers[i] = {
@@ -16798,7 +17052,7 @@ var __exports__ = (() => {
16798
17052
  async function loadImage(gltf, image, index, options, context) {
16799
17053
  let arrayBuffer;
16800
17054
  if (image.uri && !image.hasOwnProperty("bufferView")) {
16801
- const uri = resolveUrl(image.uri, options);
17055
+ const uri = resolveUrl(image.uri, options, context);
16802
17056
  const { fetch: fetch2 } = context;
16803
17057
  const response = await fetch2(uri);
16804
17058
  arrayBuffer = await response.arrayBuffer();
@@ -16814,8 +17068,7 @@ var __exports__ = (() => {
16814
17068
  const strictOptions = options;
16815
17069
  const gltfOptions = {
16816
17070
  ...strictOptions,
16817
- core: { ...strictOptions?.core, mimeType: image.mimeType },
16818
- basis: strictOptions.basis || { format: selectSupportedBasisFormat() }
17071
+ core: { ...strictOptions?.core, mimeType: image.mimeType }
16819
17072
  };
16820
17073
  let parsedImage = await parseFromContext(
16821
17074
  arrayBuffer,
@@ -17704,295 +17957,328 @@ var __exports__ = (() => {
17704
17957
  // ../../node_modules/long/index.js
17705
17958
  var wasm = null;
17706
17959
  try {
17707
- wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
17708
- 0,
17709
- 97,
17710
- 115,
17711
- 109,
17712
- 1,
17713
- 0,
17714
- 0,
17715
- 0,
17716
- 1,
17717
- 13,
17718
- 2,
17719
- 96,
17720
- 0,
17721
- 1,
17722
- 127,
17723
- 96,
17724
- 4,
17725
- 127,
17726
- 127,
17727
- 127,
17728
- 127,
17729
- 1,
17730
- 127,
17731
- 3,
17732
- 7,
17733
- 6,
17734
- 0,
17735
- 1,
17736
- 1,
17737
- 1,
17738
- 1,
17739
- 1,
17740
- 6,
17741
- 6,
17742
- 1,
17743
- 127,
17744
- 1,
17745
- 65,
17746
- 0,
17747
- 11,
17748
- 7,
17749
- 50,
17750
- 6,
17751
- 3,
17752
- 109,
17753
- 117,
17754
- 108,
17755
- 0,
17756
- 1,
17757
- 5,
17758
- 100,
17759
- 105,
17760
- 118,
17761
- 95,
17762
- 115,
17763
- 0,
17764
- 2,
17765
- 5,
17766
- 100,
17767
- 105,
17768
- 118,
17769
- 95,
17770
- 117,
17771
- 0,
17772
- 3,
17773
- 5,
17774
- 114,
17775
- 101,
17776
- 109,
17777
- 95,
17778
- 115,
17779
- 0,
17780
- 4,
17781
- 5,
17782
- 114,
17783
- 101,
17784
- 109,
17785
- 95,
17786
- 117,
17787
- 0,
17788
- 5,
17789
- 8,
17790
- 103,
17791
- 101,
17792
- 116,
17793
- 95,
17794
- 104,
17795
- 105,
17796
- 103,
17797
- 104,
17798
- 0,
17799
- 0,
17800
- 10,
17801
- 191,
17802
- 1,
17803
- 6,
17804
- 4,
17805
- 0,
17806
- 35,
17807
- 0,
17808
- 11,
17809
- 36,
17810
- 1,
17811
- 1,
17812
- 126,
17813
- 32,
17814
- 0,
17815
- 173,
17816
- 32,
17817
- 1,
17818
- 173,
17819
- 66,
17820
- 32,
17821
- 134,
17822
- 132,
17823
- 32,
17824
- 2,
17825
- 173,
17826
- 32,
17827
- 3,
17828
- 173,
17829
- 66,
17830
- 32,
17831
- 134,
17832
- 132,
17833
- 126,
17834
- 34,
17835
- 4,
17836
- 66,
17837
- 32,
17838
- 135,
17839
- 167,
17840
- 36,
17841
- 0,
17842
- 32,
17843
- 4,
17844
- 167,
17845
- 11,
17846
- 36,
17847
- 1,
17848
- 1,
17849
- 126,
17850
- 32,
17851
- 0,
17852
- 173,
17853
- 32,
17854
- 1,
17855
- 173,
17856
- 66,
17857
- 32,
17858
- 134,
17859
- 132,
17860
- 32,
17861
- 2,
17862
- 173,
17863
- 32,
17864
- 3,
17865
- 173,
17866
- 66,
17867
- 32,
17868
- 134,
17869
- 132,
17870
- 127,
17871
- 34,
17872
- 4,
17873
- 66,
17874
- 32,
17875
- 135,
17876
- 167,
17877
- 36,
17878
- 0,
17879
- 32,
17880
- 4,
17881
- 167,
17882
- 11,
17883
- 36,
17884
- 1,
17885
- 1,
17886
- 126,
17887
- 32,
17888
- 0,
17889
- 173,
17890
- 32,
17891
- 1,
17892
- 173,
17893
- 66,
17894
- 32,
17895
- 134,
17896
- 132,
17897
- 32,
17898
- 2,
17899
- 173,
17900
- 32,
17901
- 3,
17902
- 173,
17903
- 66,
17904
- 32,
17905
- 134,
17906
- 132,
17907
- 128,
17908
- 34,
17909
- 4,
17910
- 66,
17911
- 32,
17912
- 135,
17913
- 167,
17914
- 36,
17915
- 0,
17916
- 32,
17917
- 4,
17918
- 167,
17919
- 11,
17920
- 36,
17921
- 1,
17922
- 1,
17923
- 126,
17924
- 32,
17925
- 0,
17926
- 173,
17927
- 32,
17928
- 1,
17929
- 173,
17930
- 66,
17931
- 32,
17932
- 134,
17933
- 132,
17934
- 32,
17935
- 2,
17936
- 173,
17937
- 32,
17938
- 3,
17939
- 173,
17940
- 66,
17941
- 32,
17942
- 134,
17943
- 132,
17944
- 129,
17945
- 34,
17946
- 4,
17947
- 66,
17948
- 32,
17949
- 135,
17950
- 167,
17951
- 36,
17952
- 0,
17953
- 32,
17954
- 4,
17955
- 167,
17956
- 11,
17957
- 36,
17958
- 1,
17959
- 1,
17960
- 126,
17961
- 32,
17962
- 0,
17963
- 173,
17964
- 32,
17965
- 1,
17966
- 173,
17967
- 66,
17968
- 32,
17969
- 134,
17970
- 132,
17971
- 32,
17972
- 2,
17973
- 173,
17974
- 32,
17975
- 3,
17976
- 173,
17977
- 66,
17978
- 32,
17979
- 134,
17980
- 132,
17981
- 130,
17982
- 34,
17983
- 4,
17984
- 66,
17985
- 32,
17986
- 135,
17987
- 167,
17988
- 36,
17989
- 0,
17990
- 32,
17991
- 4,
17992
- 167,
17993
- 11
17994
- ])), {}).exports;
17995
- } catch (e) {
17960
+ wasm = new WebAssembly.Instance(
17961
+ new WebAssembly.Module(
17962
+ new Uint8Array([
17963
+ // \0asm
17964
+ 0,
17965
+ 97,
17966
+ 115,
17967
+ 109,
17968
+ // version 1
17969
+ 1,
17970
+ 0,
17971
+ 0,
17972
+ 0,
17973
+ // section "type"
17974
+ 1,
17975
+ 13,
17976
+ 2,
17977
+ // 0, () => i32
17978
+ 96,
17979
+ 0,
17980
+ 1,
17981
+ 127,
17982
+ // 1, (i32, i32, i32, i32) => i32
17983
+ 96,
17984
+ 4,
17985
+ 127,
17986
+ 127,
17987
+ 127,
17988
+ 127,
17989
+ 1,
17990
+ 127,
17991
+ // section "function"
17992
+ 3,
17993
+ 7,
17994
+ 6,
17995
+ // 0, type 0
17996
+ 0,
17997
+ // 1, type 1
17998
+ 1,
17999
+ // 2, type 1
18000
+ 1,
18001
+ // 3, type 1
18002
+ 1,
18003
+ // 4, type 1
18004
+ 1,
18005
+ // 5, type 1
18006
+ 1,
18007
+ // section "global"
18008
+ 6,
18009
+ 6,
18010
+ 1,
18011
+ // 0, "high", mutable i32
18012
+ 127,
18013
+ 1,
18014
+ 65,
18015
+ 0,
18016
+ 11,
18017
+ // section "export"
18018
+ 7,
18019
+ 50,
18020
+ 6,
18021
+ // 0, "mul"
18022
+ 3,
18023
+ 109,
18024
+ 117,
18025
+ 108,
18026
+ 0,
18027
+ 1,
18028
+ // 1, "div_s"
18029
+ 5,
18030
+ 100,
18031
+ 105,
18032
+ 118,
18033
+ 95,
18034
+ 115,
18035
+ 0,
18036
+ 2,
18037
+ // 2, "div_u"
18038
+ 5,
18039
+ 100,
18040
+ 105,
18041
+ 118,
18042
+ 95,
18043
+ 117,
18044
+ 0,
18045
+ 3,
18046
+ // 3, "rem_s"
18047
+ 5,
18048
+ 114,
18049
+ 101,
18050
+ 109,
18051
+ 95,
18052
+ 115,
18053
+ 0,
18054
+ 4,
18055
+ // 4, "rem_u"
18056
+ 5,
18057
+ 114,
18058
+ 101,
18059
+ 109,
18060
+ 95,
18061
+ 117,
18062
+ 0,
18063
+ 5,
18064
+ // 5, "get_high"
18065
+ 8,
18066
+ 103,
18067
+ 101,
18068
+ 116,
18069
+ 95,
18070
+ 104,
18071
+ 105,
18072
+ 103,
18073
+ 104,
18074
+ 0,
18075
+ 0,
18076
+ // section "code"
18077
+ 10,
18078
+ 191,
18079
+ 1,
18080
+ 6,
18081
+ // 0, "get_high"
18082
+ 4,
18083
+ 0,
18084
+ 35,
18085
+ 0,
18086
+ 11,
18087
+ // 1, "mul"
18088
+ 36,
18089
+ 1,
18090
+ 1,
18091
+ 126,
18092
+ 32,
18093
+ 0,
18094
+ 173,
18095
+ 32,
18096
+ 1,
18097
+ 173,
18098
+ 66,
18099
+ 32,
18100
+ 134,
18101
+ 132,
18102
+ 32,
18103
+ 2,
18104
+ 173,
18105
+ 32,
18106
+ 3,
18107
+ 173,
18108
+ 66,
18109
+ 32,
18110
+ 134,
18111
+ 132,
18112
+ 126,
18113
+ 34,
18114
+ 4,
18115
+ 66,
18116
+ 32,
18117
+ 135,
18118
+ 167,
18119
+ 36,
18120
+ 0,
18121
+ 32,
18122
+ 4,
18123
+ 167,
18124
+ 11,
18125
+ // 2, "div_s"
18126
+ 36,
18127
+ 1,
18128
+ 1,
18129
+ 126,
18130
+ 32,
18131
+ 0,
18132
+ 173,
18133
+ 32,
18134
+ 1,
18135
+ 173,
18136
+ 66,
18137
+ 32,
18138
+ 134,
18139
+ 132,
18140
+ 32,
18141
+ 2,
18142
+ 173,
18143
+ 32,
18144
+ 3,
18145
+ 173,
18146
+ 66,
18147
+ 32,
18148
+ 134,
18149
+ 132,
18150
+ 127,
18151
+ 34,
18152
+ 4,
18153
+ 66,
18154
+ 32,
18155
+ 135,
18156
+ 167,
18157
+ 36,
18158
+ 0,
18159
+ 32,
18160
+ 4,
18161
+ 167,
18162
+ 11,
18163
+ // 3, "div_u"
18164
+ 36,
18165
+ 1,
18166
+ 1,
18167
+ 126,
18168
+ 32,
18169
+ 0,
18170
+ 173,
18171
+ 32,
18172
+ 1,
18173
+ 173,
18174
+ 66,
18175
+ 32,
18176
+ 134,
18177
+ 132,
18178
+ 32,
18179
+ 2,
18180
+ 173,
18181
+ 32,
18182
+ 3,
18183
+ 173,
18184
+ 66,
18185
+ 32,
18186
+ 134,
18187
+ 132,
18188
+ 128,
18189
+ 34,
18190
+ 4,
18191
+ 66,
18192
+ 32,
18193
+ 135,
18194
+ 167,
18195
+ 36,
18196
+ 0,
18197
+ 32,
18198
+ 4,
18199
+ 167,
18200
+ 11,
18201
+ // 4, "rem_s"
18202
+ 36,
18203
+ 1,
18204
+ 1,
18205
+ 126,
18206
+ 32,
18207
+ 0,
18208
+ 173,
18209
+ 32,
18210
+ 1,
18211
+ 173,
18212
+ 66,
18213
+ 32,
18214
+ 134,
18215
+ 132,
18216
+ 32,
18217
+ 2,
18218
+ 173,
18219
+ 32,
18220
+ 3,
18221
+ 173,
18222
+ 66,
18223
+ 32,
18224
+ 134,
18225
+ 132,
18226
+ 129,
18227
+ 34,
18228
+ 4,
18229
+ 66,
18230
+ 32,
18231
+ 135,
18232
+ 167,
18233
+ 36,
18234
+ 0,
18235
+ 32,
18236
+ 4,
18237
+ 167,
18238
+ 11,
18239
+ // 5, "rem_u"
18240
+ 36,
18241
+ 1,
18242
+ 1,
18243
+ 126,
18244
+ 32,
18245
+ 0,
18246
+ 173,
18247
+ 32,
18248
+ 1,
18249
+ 173,
18250
+ 66,
18251
+ 32,
18252
+ 134,
18253
+ 132,
18254
+ 32,
18255
+ 2,
18256
+ 173,
18257
+ 32,
18258
+ 3,
18259
+ 173,
18260
+ 66,
18261
+ 32,
18262
+ 134,
18263
+ 132,
18264
+ 130,
18265
+ 34,
18266
+ 4,
18267
+ 66,
18268
+ 32,
18269
+ 135,
18270
+ 167,
18271
+ 36,
18272
+ 0,
18273
+ 32,
18274
+ 4,
18275
+ 167,
18276
+ 11
18277
+ ])
18278
+ ),
18279
+ {}
18280
+ ).exports;
18281
+ } catch {
17996
18282
  }
17997
18283
  function Long(low, high, unsigned) {
17998
18284
  this.low = low | 0;
@@ -18012,27 +18298,27 @@ var __exports__ = (() => {
18012
18298
  var INT_CACHE = {};
18013
18299
  var UINT_CACHE = {};
18014
18300
  function fromInt(value, unsigned) {
18015
- var obj, cachedObj, cache2;
18301
+ var obj, cachedObj, cache;
18016
18302
  if (unsigned) {
18017
18303
  value >>>= 0;
18018
- if (cache2 = 0 <= value && value < 256) {
18304
+ if (cache = 0 <= value && value < 256) {
18019
18305
  cachedObj = UINT_CACHE[value];
18020
18306
  if (cachedObj)
18021
18307
  return cachedObj;
18022
18308
  }
18023
18309
  obj = fromBits(value, 0, true);
18024
- if (cache2)
18310
+ if (cache)
18025
18311
  UINT_CACHE[value] = obj;
18026
18312
  return obj;
18027
18313
  } else {
18028
18314
  value |= 0;
18029
- if (cache2 = -128 <= value && value < 128) {
18315
+ if (cache = -128 <= value && value < 128) {
18030
18316
  cachedObj = INT_CACHE[value];
18031
18317
  if (cachedObj)
18032
18318
  return cachedObj;
18033
18319
  }
18034
18320
  obj = fromBits(value, value < 0 ? -1 : 0, false);
18035
- if (cache2)
18321
+ if (cache)
18036
18322
  INT_CACHE[value] = obj;
18037
18323
  return obj;
18038
18324
  }
@@ -18054,7 +18340,11 @@ var __exports__ = (() => {
18054
18340
  }
18055
18341
  if (value < 0)
18056
18342
  return fromNumber(-value, unsigned).neg();
18057
- return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
18343
+ return fromBits(
18344
+ value % TWO_PWR_32_DBL | 0,
18345
+ value / TWO_PWR_32_DBL | 0,
18346
+ unsigned
18347
+ );
18058
18348
  }
18059
18349
  Long.fromNumber = fromNumber;
18060
18350
  function fromBits(lowBits, highBits, unsigned) {
@@ -18103,7 +18393,11 @@ var __exports__ = (() => {
18103
18393
  return fromNumber(val, unsigned);
18104
18394
  if (typeof val === "string")
18105
18395
  return fromString(val, unsigned);
18106
- return fromBits(val.low, val.high, typeof unsigned === "boolean" ? unsigned : val.unsigned);
18396
+ return fromBits(
18397
+ val.low,
18398
+ val.high,
18399
+ typeof unsigned === "boolean" ? unsigned : val.unsigned
18400
+ );
18107
18401
  }
18108
18402
  Long.fromValue = fromValue;
18109
18403
  var TWO_PWR_16_DBL = 1 << 16;
@@ -18185,6 +18479,14 @@ var __exports__ = (() => {
18185
18479
  break;
18186
18480
  return this.high != 0 ? bit + 33 : bit + 1;
18187
18481
  };
18482
+ LongPrototype.isSafeInteger = function isSafeInteger() {
18483
+ var top11Bits = this.high >> 21;
18484
+ if (!top11Bits)
18485
+ return true;
18486
+ if (this.unsigned)
18487
+ return false;
18488
+ return top11Bits === -1 && !(this.low === 0 && this.high === -2097152);
18489
+ };
18188
18490
  LongPrototype.isZero = function isZero() {
18189
18491
  return this.high === 0 && this.low === 0;
18190
18492
  };
@@ -18305,12 +18607,7 @@ var __exports__ = (() => {
18305
18607
  if (!isLong(multiplier))
18306
18608
  multiplier = fromValue(multiplier);
18307
18609
  if (wasm) {
18308
- var low = wasm["mul"](
18309
- this.low,
18310
- this.high,
18311
- multiplier.low,
18312
- multiplier.high
18313
- );
18610
+ var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
18314
18611
  return fromBits(low, wasm["get_high"](), this.unsigned);
18315
18612
  }
18316
18613
  if (multiplier.isZero())
@@ -18480,7 +18777,11 @@ var __exports__ = (() => {
18480
18777
  if ((numBits &= 63) === 0)
18481
18778
  return this;
18482
18779
  else if (numBits < 32)
18483
- return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);
18780
+ return fromBits(
18781
+ this.low << numBits,
18782
+ this.high << numBits | this.low >>> 32 - numBits,
18783
+ this.unsigned
18784
+ );
18484
18785
  else
18485
18786
  return fromBits(0, this.low << numBits - 32, this.unsigned);
18486
18787
  };
@@ -18491,9 +18792,17 @@ var __exports__ = (() => {
18491
18792
  if ((numBits &= 63) === 0)
18492
18793
  return this;
18493
18794
  else if (numBits < 32)
18494
- return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);
18795
+ return fromBits(
18796
+ this.low >>> numBits | this.high << 32 - numBits,
18797
+ this.high >> numBits,
18798
+ this.unsigned
18799
+ );
18495
18800
  else
18496
- return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
18801
+ return fromBits(
18802
+ this.high >> numBits - 32,
18803
+ this.high >= 0 ? 0 : -1,
18804
+ this.unsigned
18805
+ );
18497
18806
  };
18498
18807
  LongPrototype.shr = LongPrototype.shiftRight;
18499
18808
  LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
@@ -18502,7 +18811,11 @@ var __exports__ = (() => {
18502
18811
  if ((numBits &= 63) === 0)
18503
18812
  return this;
18504
18813
  if (numBits < 32)
18505
- return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
18814
+ return fromBits(
18815
+ this.low >>> numBits | this.high << 32 - numBits,
18816
+ this.high >>> numBits,
18817
+ this.unsigned
18818
+ );
18506
18819
  if (numBits === 32)
18507
18820
  return fromBits(this.high, 0, this.unsigned);
18508
18821
  return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
@@ -18519,11 +18832,19 @@ var __exports__ = (() => {
18519
18832
  return fromBits(this.high, this.low, this.unsigned);
18520
18833
  if (numBits < 32) {
18521
18834
  b = 32 - numBits;
18522
- return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
18835
+ return fromBits(
18836
+ this.low << numBits | this.high >>> b,
18837
+ this.high << numBits | this.low >>> b,
18838
+ this.unsigned
18839
+ );
18523
18840
  }
18524
18841
  numBits -= 32;
18525
18842
  b = 32 - numBits;
18526
- return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
18843
+ return fromBits(
18844
+ this.high << numBits | this.low >>> b,
18845
+ this.low << numBits | this.high >>> b,
18846
+ this.unsigned
18847
+ );
18527
18848
  };
18528
18849
  LongPrototype.rotl = LongPrototype.rotateLeft;
18529
18850
  LongPrototype.rotateRight = function rotateRight(numBits) {
@@ -18536,11 +18857,19 @@ var __exports__ = (() => {
18536
18857
  return fromBits(this.high, this.low, this.unsigned);
18537
18858
  if (numBits < 32) {
18538
18859
  b = 32 - numBits;
18539
- return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
18860
+ return fromBits(
18861
+ this.high << b | this.low >>> numBits,
18862
+ this.low << b | this.high >>> numBits,
18863
+ this.unsigned
18864
+ );
18540
18865
  }
18541
18866
  numBits -= 32;
18542
18867
  b = 32 - numBits;
18543
- return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
18868
+ return fromBits(
18869
+ this.low << b | this.high >>> numBits,
18870
+ this.high << b | this.low >>> numBits,
18871
+ this.unsigned
18872
+ );
18544
18873
  };
18545
18874
  LongPrototype.rotr = LongPrototype.rotateRight;
18546
18875
  LongPrototype.toSigned = function toSigned() {
@@ -18599,6 +18928,23 @@ var __exports__ = (() => {
18599
18928
  unsigned
18600
18929
  );
18601
18930
  };
18931
+ if (typeof BigInt === "function") {
18932
+ Long.fromBigInt = function fromBigInt(value, unsigned) {
18933
+ var lowBits = Number(BigInt.asIntN(32, value));
18934
+ var highBits = Number(BigInt.asIntN(32, value >> BigInt(32)));
18935
+ return fromBits(lowBits, highBits, unsigned);
18936
+ };
18937
+ Long.fromValue = function fromValueWithBigInt(value, unsigned) {
18938
+ if (typeof value === "bigint")
18939
+ return Long.fromBigInt(value, unsigned);
18940
+ return fromValue(value, unsigned);
18941
+ };
18942
+ LongPrototype.toBigInt = function toBigInt2() {
18943
+ var lowBigInt = BigInt(this.low >>> 0);
18944
+ var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high);
18945
+ return highBigInt << BigInt(32) | lowBigInt;
18946
+ };
18947
+ }
18602
18948
  var long_default = Long;
18603
18949
 
18604
18950
  // src/lib/utils/s2/s2-token-functions.ts