@loaders.gl/tiles-3d 5.0.0-beta.2 → 5.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  2. package/dist/3d-tiles/dist.dev.js +502 -342
  3. package/dist/3d-tiles/dist.min.js +19 -19
  4. package/dist/3d-tiles/index.cjs +307 -183
  5. package/dist/3d-tiles/index.cjs.map +3 -3
  6. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts.map +1 -1
  7. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js +12 -8
  8. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js.map +1 -1
  9. package/dist/3d-tiles/lib/utils/version.js +1 -1
  10. package/dist/3d-tiles-archive-writer.cjs +1 -1
  11. package/dist/cesium-ion-loader-with-parser.cjs +301 -177
  12. package/dist/cesium-ion-loader-with-parser.cjs.map +3 -3
  13. package/dist/copc/copc-source-loader.js +1 -1
  14. package/dist/copc/copc-writer.js +1 -1
  15. package/dist/copc/index.cjs +358 -9
  16. package/dist/copc/index.cjs.map +3 -3
  17. package/dist/dist.min.js +2 -2
  18. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  19. package/dist/i3s/dist.dev.js +3731 -694
  20. package/dist/i3s/dist.min.js +43 -35
  21. package/dist/i3s/i3s-attribute-loader.js +1 -1
  22. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  23. package/dist/i3s/i3s-content-loader.js +1 -1
  24. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  25. package/dist/i3s/i3s-loader.js +1 -1
  26. package/dist/i3s/i3s-node-page-loader.js +1 -1
  27. package/dist/i3s/i3s-slpk-loader.js +1 -1
  28. package/dist/i3s/i3s-slpk-writer.js +1 -1
  29. package/dist/i3s/index.cjs +2542 -373
  30. package/dist/i3s/index.cjs.map +3 -3
  31. package/dist/i3s-content-worker-node.js +11 -11
  32. package/dist/i3s-content-worker-node.js.map +4 -4
  33. package/dist/i3s-content-worker.js +392 -56
  34. package/dist/i3s-lepcc-worker-node.js +369 -37
  35. package/dist/i3s-lepcc-worker-node.js.map +4 -4
  36. package/dist/i3s-lepcc-worker.js +340 -33
  37. package/dist/i3s-mesh-writer.cjs +2464 -295
  38. package/dist/i3s-mesh-writer.cjs.map +3 -3
  39. package/dist/i3s-slpk-writer.cjs +1 -1
  40. package/dist/index.cjs +1 -1
  41. package/dist/point-cloud-tile-source-loader-types.js +1 -1
  42. package/dist/point-cloud-tile-source-loader.cjs +1 -1
  43. package/dist/potree/dist.dev.js +84 -28
  44. package/dist/potree/dist.min.js +26 -26
  45. package/dist/potree/index.cjs +11 -6
  46. package/dist/potree/index.cjs.map +1 -1
  47. package/dist/potree/potree-bin-loader.js +1 -1
  48. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  49. package/dist/potree/potree-loader-types.js +1 -1
  50. package/dist/potree/potree-source-loader.js +1 -1
  51. package/dist/potree/potree-writer.js +1 -1
  52. package/dist/potree-loader.cjs +1 -1
  53. package/package.json +13 -13
  54. package/src/3d-tiles/lib/classes/tile-3d-batch-table.ts +12 -8
@@ -14,8 +14,8 @@ var __esm = (fn, res, err) => function __init() {
14
14
  }
15
15
  };
16
16
  var __export = (target, all) => {
17
- for (var name20 in all)
18
- __defProp(target, name20, { get: all[name20], enumerable: true });
17
+ for (var name22 in all)
18
+ __defProp(target, name22, { get: all[name22], enumerable: true });
19
19
  };
20
20
  var __copyProps = (to, from, except, desc) => {
21
21
  if (from && typeof from === "object" || typeof from === "function") {
@@ -276,8 +276,8 @@ var binary, json, I3SFormat, I3SContentFormat, I3SAttributeFormat, I3SLEPCCForma
276
276
  var init_i3s_format = __esm({
277
277
  "dist/i3s/i3s-format.js"() {
278
278
  "use strict";
279
- binary = (name20, id, format, extensions) => ({
280
- name: name20,
279
+ binary = (name22, id, format, extensions) => ({
280
+ name: name22,
281
281
  id,
282
282
  module: "tiles-3d",
283
283
  encoding: "binary",
@@ -286,8 +286,8 @@ var init_i3s_format = __esm({
286
286
  mimeTypes: ["application/octet-stream"],
287
287
  binary: true
288
288
  });
289
- json = (name20, id, format) => ({
290
- name: name20,
289
+ json = (name22, id, format) => ({
290
+ name: name22,
291
291
  id,
292
292
  module: "tiles-3d",
293
293
  encoding: "json",
@@ -701,9 +701,9 @@ function registerJSModules(modules) {
701
701
  globalThis.loaders.modules ||= {};
702
702
  Object.assign(globalThis.loaders.modules, modules);
703
703
  }
704
- function getJSModuleOrNull(name20) {
704
+ function getJSModuleOrNull(name22) {
705
705
  var _a, _b;
706
- const module2 = (_b = (_a = globalThis.loaders) == null ? void 0 : _a.modules) == null ? void 0 : _b[name20];
706
+ const module2 = (_b = (_a = globalThis.loaders) == null ? void 0 : _a.modules) == null ? void 0 : _b[name22];
707
707
  return module2 || null;
708
708
  }
709
709
  var init_js_module_utils = __esm({
@@ -784,21 +784,347 @@ var init_globals2 = __esm({
784
784
  }
785
785
  });
786
786
 
787
- // ../core/src/worker-utils/lib/worker-farm/worker-farm.ts
787
+ // ../core/src/worker-utils/lib/worker-api/task-runtime.ts
788
+ function normalizeTaskProgress(progress) {
789
+ return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
790
+ }
788
791
  var import_tasks;
789
- var init_worker_farm = __esm({
790
- "../core/src/worker-utils/lib/worker-farm/worker-farm.ts"() {
792
+ var init_task_runtime = __esm({
793
+ "../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
791
794
  "use strict";
792
795
  import_tasks = require("@math.gl/core/tasks");
793
796
  }
794
797
  });
795
798
 
799
+ // ../core/src/worker-utils/lib/worker-api/get-worker-url.ts
800
+ function getCustomWorkerURL(worker, options = {}) {
801
+ var _a, _b;
802
+ const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
803
+ let url = getConfiguredWorkerURL(worker, options);
804
+ const workerType = options._workerType || ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._workerType);
805
+ if (!url && workerType === "test") {
806
+ if (isBrowser2) {
807
+ url = `modules/${worker.module}/dist/${workerFile}`;
808
+ } else {
809
+ const workerSourceDirectory = worker.module === "core" && ((_b = worker.workerNode) == null ? void 0 : _b.startsWith("worker-utils/")) ? "worker-utils/workers" : "workers";
810
+ const workerSourceNode = worker.workerSourceNode || `${workerSourceDirectory}/${worker.id}-worker-node.ts`;
811
+ url = `modules/${worker.module}/src/${workerSourceNode}`;
812
+ }
813
+ }
814
+ return url || null;
815
+ }
816
+ function getConfiguredWorkerURL(worker, options = {}) {
817
+ const workerOptions = options[worker.id] || {};
818
+ return workerOptions.workerUrl || (worker.id === "compression" ? options.workerUrl : null) || null;
819
+ }
820
+ function getWorkerURL(worker, options = {}) {
821
+ const customWorkerUrl = getCustomWorkerURL(worker, options);
822
+ const descriptorWorkerUrl = typeof worker.worker === "string" ? worker.worker : null;
823
+ const url = customWorkerUrl || descriptorWorkerUrl || getDefaultWorkerURL(worker, true);
824
+ assert2(url);
825
+ return url;
826
+ }
827
+ function getDefaultWorkerURL(worker, warn = false) {
828
+ const workerFile = isBrowser2 ? worker.workerFile || `${worker.id}-worker.js` : worker.workerNode || `${worker.id}-worker-node.js`;
829
+ let version2 = worker.version;
830
+ if (version2 === "latest") {
831
+ version2 = NPM_TAG;
832
+ }
833
+ const versionTag = version2 ? `@${version2}` : "";
834
+ const url = `https://unpkg.com/@loaders.gl/${worker.module}${versionTag}/dist/${workerFile}`;
835
+ if (warn) {
836
+ warnIfUsingNpmTagFallback(worker, url);
837
+ }
838
+ return url;
839
+ }
840
+ function warnIfUsingNpmTagFallback(worker, url) {
841
+ if (worker.version !== "latest") {
842
+ return;
843
+ }
844
+ const workerId = `${worker.module}:${worker.id}`;
845
+ if (warnedWorkerVersionFallbacks.has(workerId)) {
846
+ return;
847
+ }
848
+ warnedWorkerVersionFallbacks.add(workerId);
849
+ console.warn(
850
+ `loaders.gl: ${worker.name} loader worker version is "latest" because __VERSION__ was not injected. Fetching ${url} from CDN.`
851
+ );
852
+ }
853
+ var warnedWorkerVersionFallbacks;
854
+ var init_get_worker_url = __esm({
855
+ "../core/src/worker-utils/lib/worker-api/get-worker-url.ts"() {
856
+ "use strict";
857
+ init_assert2();
858
+ init_globals2();
859
+ init_npm_tag();
860
+ warnedWorkerVersionFallbacks = /* @__PURE__ */ new Set();
861
+ }
862
+ });
863
+
864
+ // ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
865
+ function getTransferList(object, recursive = true, transfers) {
866
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
867
+ if (!object) {
868
+ } else if (isTransferable(object)) {
869
+ transfersSet.add(object);
870
+ } else if (isTransferable(object.buffer)) {
871
+ transfersSet.add(object.buffer);
872
+ } else if (ArrayBuffer.isView(object)) {
873
+ } else if (recursive && typeof object === "object") {
874
+ for (const key in object) {
875
+ getTransferList(object[key], recursive, transfersSet);
876
+ }
877
+ }
878
+ return transfers === void 0 ? Array.from(transfersSet) : [];
879
+ }
880
+ function isTransferable(object) {
881
+ if (!object) {
882
+ return false;
883
+ }
884
+ if (object instanceof ArrayBuffer) {
885
+ return true;
886
+ }
887
+ if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
888
+ return true;
889
+ }
890
+ if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
891
+ return true;
892
+ }
893
+ if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
894
+ return true;
895
+ }
896
+ return false;
897
+ }
898
+ function getTransferListForWriter(object) {
899
+ if (object === null) {
900
+ return {};
901
+ }
902
+ const clone = Object.assign({}, object);
903
+ Object.keys(clone).forEach((key) => {
904
+ if (object[key] !== null && typeof object[key] === "object" && !ArrayBuffer.isView(object[key]) && !(object[key] instanceof Array)) {
905
+ clone[key] = getTransferListForWriter(object[key]);
906
+ } else if (typeof clone[key] === "function" || clone[key] instanceof RegExp) {
907
+ clone[key] = {};
908
+ } else {
909
+ clone[key] = object[key];
910
+ }
911
+ });
912
+ return clone;
913
+ }
914
+ var init_get_transfer_list = __esm({
915
+ "../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
916
+ "use strict";
917
+ }
918
+ });
919
+
796
920
  // ../core/src/worker-utils/lib/worker-api/process-on-worker.ts
797
- var import_tasks2;
921
+ function canProcessOnWorker(worker, options = {}) {
922
+ const supported = isBrowser2 ? typeof Worker !== "undefined" : Boolean(options._nodeWorkers);
923
+ return Boolean(
924
+ supported && options.worker && (worker.worker || worker.loadWorker || getConfiguredWorkerURL(worker, options))
925
+ );
926
+ }
927
+ async function* processOnWorkerInBatches(worker, input, options = {}, context = {}, jobContext = {}) {
928
+ var _a;
929
+ const taskInput = wrapInput(input);
930
+ let session;
931
+ try {
932
+ session = await openSession(worker, options, context, jobContext);
933
+ for await (const result of session.handle.runTaskInBatches(taskInput, {
934
+ ...getControls(options),
935
+ options: getParserOptions(options)
936
+ }))
937
+ yield result.value;
938
+ } finally {
939
+ const closingInput = (_a = taskInput.return) == null ? void 0 : _a.call(taskInput);
940
+ void (closingInput == null ? void 0 : closingInput.catch(() => {
941
+ }));
942
+ await (session == null ? void 0 : session.close());
943
+ }
944
+ }
945
+ function getTask(worker, options) {
946
+ var _a;
947
+ if (options.source || ((_a = options.core) == null ? void 0 : _a.source))
948
+ throw new Error(
949
+ "Inline legacy worker source is unsupported; use a TaskRunner worker URL or factory"
950
+ );
951
+ const create = !getCustomWorkerURL(worker, options) && isBrowser2 ? worker.loadWorker : void 0;
952
+ const url = getWorkerURL(worker, options);
953
+ return {
954
+ id: `${worker.module}:${worker.id}`,
955
+ initialize: (state) => state,
956
+ worker: {
957
+ ...create ? { create: () => create() ?? createModuleWorker(url) } : { url },
958
+ capabilities: { atomic: true, streaming: true }
959
+ }
960
+ };
961
+ }
962
+ function getControls(options) {
963
+ return {
964
+ execution: "worker",
965
+ signal: options.signal,
966
+ inputOwnership: options.inputOwnership ?? "transfer",
967
+ outputOwnership: options.outputOwnership ?? "transfer",
968
+ onProgress: options.onProgress ? (progress) => {
969
+ var _a;
970
+ return (_a = options.onProgress) == null ? void 0 : _a.call(options, normalizeTaskProgress(progress));
971
+ } : void 0
972
+ };
973
+ }
974
+ function getParserOptions(options) {
975
+ const { signal, onProgress, ...parserOptions } = options;
976
+ return getTransferListForWriter(parserOptions);
977
+ }
978
+ async function openSession(worker, options, context, jobContext) {
979
+ var _a, _b;
980
+ (_a = options.signal) == null ? void 0 : _a.throwIfAborted();
981
+ const task = getTask(worker, options);
982
+ let state = runners.get(worker);
983
+ if (!state) {
984
+ state = {
985
+ runner: new import_tasks2.TaskRunner({
986
+ maxConcurrency: isMobile ? options.maxMobileConcurrency ?? 1 : options.maxConcurrency ?? 3
987
+ }),
988
+ requests: 0
989
+ };
990
+ runners.set(worker, state);
991
+ }
992
+ const runnerState = state;
993
+ const channel = context.process ? new MessageChannel() : void 0;
994
+ const callbackController = new AbortController();
995
+ let channelClosed = false;
996
+ const abortCallbacks = () => {
997
+ var _a2;
998
+ return callbackController.abort((_a2 = options.signal) == null ? void 0 : _a2.reason);
999
+ };
1000
+ (_b = options.signal) == null ? void 0 : _b.addEventListener("abort", abortCallbacks, { once: true });
1001
+ const closeChannel = () => {
1002
+ var _a2;
1003
+ channelClosed = true;
1004
+ (_a2 = options.signal) == null ? void 0 : _a2.removeEventListener("abort", abortCallbacks);
1005
+ callbackController.abort();
1006
+ channel == null ? void 0 : channel.port1.close();
1007
+ channel == null ? void 0 : channel.port2.close();
1008
+ };
1009
+ if (channel) {
1010
+ channel.port1.onmessage = async ({ data }) => {
1011
+ try {
1012
+ const value = await context.process(
1013
+ data.input,
1014
+ data.options,
1015
+ {
1016
+ signal: callbackController.signal,
1017
+ throwIfAborted: () => callbackController.signal.throwIfAborted()
1018
+ },
1019
+ data.context
1020
+ );
1021
+ if (!channelClosed && !callbackController.signal.aborted)
1022
+ channel.port1.postMessage({ identifier: data.identifier, value }, getTransferList(value));
1023
+ } catch (error) {
1024
+ if (channelClosed || callbackController.signal.aborted) return;
1025
+ channel.port1.postMessage({
1026
+ identifier: data.identifier,
1027
+ error: {
1028
+ name: error instanceof Error ? error.name : "Error",
1029
+ message: error instanceof Error ? error.message : String(error)
1030
+ }
1031
+ });
1032
+ }
1033
+ };
1034
+ channel.port1.start();
1035
+ }
1036
+ runnerState.requests++;
1037
+ activeRunners.add(runnerState);
1038
+ let released = false;
1039
+ const releaseRunner = () => {
1040
+ if (released) return;
1041
+ released = true;
1042
+ runnerState.requests--;
1043
+ if (!runnerState.requests) activeRunners.delete(runnerState);
1044
+ };
1045
+ let handle;
1046
+ try {
1047
+ handle = await runnerState.runner.initializeTask(
1048
+ task,
1049
+ {
1050
+ context: structuredClone(jobContext),
1051
+ ...channel ? { port: channel.port2 } : {}
1052
+ },
1053
+ // The callback port is setup state, independent of the caller's payload ownership.
1054
+ { ...getControls(options), inputOwnership: "transfer" }
1055
+ );
1056
+ } catch (error) {
1057
+ releaseRunner();
1058
+ closeChannel();
1059
+ throw error;
1060
+ }
1061
+ return {
1062
+ handle,
1063
+ /** Releases the worker and callback channel on success, failure, and early stream return. */
1064
+ async close() {
1065
+ try {
1066
+ await handle.close();
1067
+ } finally {
1068
+ closeChannel();
1069
+ releaseRunner();
1070
+ }
1071
+ }
1072
+ };
1073
+ }
1074
+ function wrapInput(input) {
1075
+ const iterator = Symbol.asyncIterator in input ? input[Symbol.asyncIterator]() : input[Symbol.iterator]();
1076
+ let inputClosed = false;
1077
+ return {
1078
+ [Symbol.asyncIterator]() {
1079
+ return this;
1080
+ },
1081
+ async next() {
1082
+ if (inputClosed) return { done: true, value: void 0 };
1083
+ const next = await iterator.next();
1084
+ if (next.done || inputClosed) {
1085
+ inputClosed = true;
1086
+ return { done: true, value: void 0 };
1087
+ }
1088
+ return { done: false, value: { value: next.value } };
1089
+ },
1090
+ async return() {
1091
+ var _a;
1092
+ if (!inputClosed) {
1093
+ inputClosed = true;
1094
+ await ((_a = iterator.return) == null ? void 0 : _a.call(iterator));
1095
+ }
1096
+ return { done: true, value: void 0 };
1097
+ }
1098
+ };
1099
+ }
1100
+ function createModuleWorker(url) {
1101
+ var _a;
1102
+ const resolved = new URL(url, ((_a = globalThis.document) == null ? void 0 : _a.baseURI) ?? globalThis.location.href);
1103
+ let workerUrl = resolved.href;
1104
+ if (/^https?:$/.test(resolved.protocol) && resolved.origin !== globalThis.location.origin) {
1105
+ let shimUrl = moduleWorkerUrls.get(resolved.href);
1106
+ if (!shimUrl) {
1107
+ shimUrl = URL.createObjectURL(
1108
+ new Blob([`import ${JSON.stringify(resolved.href)};`], { type: "application/javascript" })
1109
+ );
1110
+ moduleWorkerUrls.set(resolved.href, shimUrl);
1111
+ }
1112
+ workerUrl = shimUrl;
1113
+ }
1114
+ return new Worker(workerUrl, { type: "module" });
1115
+ }
1116
+ var import_tasks2, runners, activeRunners, moduleWorkerUrls;
798
1117
  var init_process_on_worker = __esm({
799
1118
  "../core/src/worker-utils/lib/worker-api/process-on-worker.ts"() {
800
1119
  "use strict";
801
1120
  import_tasks2 = require("@math.gl/core/tasks");
1121
+ init_get_worker_url();
1122
+ init_task_runtime();
1123
+ init_get_transfer_list();
1124
+ init_globals2();
1125
+ runners = /* @__PURE__ */ new WeakMap();
1126
+ activeRunners = /* @__PURE__ */ new Set();
1127
+ moduleWorkerUrls = /* @__PURE__ */ new Map();
802
1128
  }
803
1129
  });
804
1130
 
@@ -966,11 +1292,12 @@ var init_library_utils = __esm({
966
1292
  });
967
1293
 
968
1294
  // ../core/src/worker-utils/index.ts
1295
+ var import_tasks3;
969
1296
  var init_worker_utils = __esm({
970
1297
  "../core/src/worker-utils/index.ts"() {
971
1298
  "use strict";
972
1299
  init_globals2();
973
- init_worker_farm();
1300
+ import_tasks3 = require("@math.gl/core/tasks");
974
1301
  init_process_on_worker();
975
1302
  init_library_utils();
976
1303
  }
@@ -979,15 +1306,15 @@ var init_worker_utils = __esm({
979
1306
  // ../core/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts
980
1307
  function canEncodeWithWorker(writer, options) {
981
1308
  var _a, _b;
982
- if (!import_tasks.WorkerFarm.isSupported()) {
983
- return false;
984
- }
985
1309
  const nodeWorkers = (options == null ? void 0 : options._nodeWorkers) ?? ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a._nodeWorkers);
986
1310
  const useWorkers = (options == null ? void 0 : options.worker) ?? ((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.worker);
987
1311
  if (!isBrowser && !nodeWorkers) {
988
1312
  return false;
989
1313
  }
990
- return Boolean(writer.worker && useWorkers);
1314
+ return canProcessOnWorker(
1315
+ { ...writer, options: writer.options || {} },
1316
+ { worker: Boolean(useWorkers), _nodeWorkers: Boolean(nodeWorkers) }
1317
+ );
991
1318
  }
992
1319
  var init_encode_with_worker = __esm({
993
1320
  "../core/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts"() {
@@ -5191,7 +5518,7 @@ var init_parse_usda = __esm({
5191
5518
  }
5192
5519
  /** Parses the complete USDA layer. */
5193
5520
  parse() {
5194
- const metadata = this.tokenizer.match("(") ? this.parseMetadata(")") : {};
5521
+ const metadata2 = this.tokenizer.match("(") ? this.parseMetadata(")") : {};
5195
5522
  const rootPrims = [];
5196
5523
  while (!this.tokenizer.isAtEnd()) {
5197
5524
  if (this.isPrimDeclaration()) {
@@ -5203,7 +5530,7 @@ var init_parse_usda = __esm({
5203
5530
  return {
5204
5531
  format: "usda",
5205
5532
  url: this.url,
5206
- metadata,
5533
+ metadata: metadata2,
5207
5534
  rootPrims,
5208
5535
  layers: this.url ? [this.url] : []
5209
5536
  };
@@ -5215,19 +5542,19 @@ var init_parse_usda = __esm({
5215
5542
  const firstToken = this.tokenizer.read();
5216
5543
  const hasExplicitType = this.tokenizer.peek().kind === "string";
5217
5544
  const type = hasExplicitType ? firstToken.value : "";
5218
- const name20 = hasExplicitType ? this.tokenizer.read().value : firstToken.value;
5219
- const path = `${parentPath}/${name20}`;
5220
- const metadata = this.tokenizer.match("(") ? this.parseMetadata(")") : {};
5545
+ const name22 = hasExplicitType ? this.tokenizer.read().value : firstToken.value;
5546
+ const path = `${parentPath}/${name22}`;
5547
+ const metadata2 = this.tokenizer.match("(") ? this.parseMetadata(")") : {};
5221
5548
  this.tokenizer.expect("{");
5222
5549
  const contents = this.parsePrimContents(path);
5223
5550
  return {
5224
- name: name20,
5551
+ name: name22,
5225
5552
  path,
5226
5553
  sourceUrl: this.url,
5227
5554
  type,
5228
5555
  specifier,
5229
5556
  attributes: contents.attributes,
5230
- metadata: { ...metadata, ...contents.metadata },
5557
+ metadata: { ...metadata2, ...contents.metadata },
5231
5558
  variants: contents.variants,
5232
5559
  children: contents.children
5233
5560
  };
@@ -5235,7 +5562,7 @@ var init_parse_usda = __esm({
5235
5562
  /** Parses the attributes, variants, and child prims inside a prim body. */
5236
5563
  parsePrimContents(parentPath) {
5237
5564
  const attributes = {};
5238
- const metadata = {};
5565
+ const metadata2 = {};
5239
5566
  const children = [];
5240
5567
  const variants = {};
5241
5568
  while (!this.tokenizer.isAtEnd() && !this.tokenizer.match("}")) {
@@ -5250,7 +5577,7 @@ var init_parse_usda = __esm({
5250
5577
  }
5251
5578
  }
5252
5579
  }
5253
- return { attributes, metadata, children, variants };
5580
+ return { attributes, metadata: metadata2, children, variants };
5254
5581
  }
5255
5582
  /** Parses one named variant set. */
5256
5583
  parseVariantSet(parentPath, variants) {
@@ -5297,15 +5624,15 @@ var init_parse_usda = __esm({
5297
5624
  if (significantTokens.length === 0) {
5298
5625
  return null;
5299
5626
  }
5300
- const name20 = significantTokens[significantTokens.length - 1].value;
5627
+ const name22 = significantTokens[significantTokens.length - 1].value;
5301
5628
  const type = significantTokens.slice(0, -1).map((token) => token.value).join("");
5302
5629
  const value = this.parseValue();
5303
- const metadata = this.tokenizer.match("(") ? this.parseMetadata(")") : {};
5304
- return { name: name20, type, value, metadata };
5630
+ const metadata2 = this.tokenizer.match("(") ? this.parseMetadata(")") : {};
5631
+ return { name: name22, type, value, metadata: metadata2 };
5305
5632
  }
5306
5633
  /** Parses a metadata dictionary through the requested terminator. */
5307
5634
  parseMetadata(terminator) {
5308
- const metadata = {};
5635
+ const metadata2 = {};
5309
5636
  while (!this.tokenizer.isAtEnd() && !this.tokenizer.match(terminator)) {
5310
5637
  this.tokenizer.match(",");
5311
5638
  if (this.tokenizer.peek().value === terminator) {
@@ -5327,11 +5654,11 @@ var init_parse_usda = __esm({
5327
5654
  if (this.tokenizer.previousValue !== "=" && this.tokenizer.previousValue !== ":") {
5328
5655
  continue;
5329
5656
  }
5330
- const name20 = declarationTokens[declarationTokens.length - 1].value;
5331
- metadata[name20] = this.parseValue();
5657
+ const name22 = declarationTokens[declarationTokens.length - 1].value;
5658
+ metadata2[name22] = this.parseValue();
5332
5659
  this.tokenizer.match(",");
5333
5660
  }
5334
- return metadata;
5661
+ return metadata2;
5335
5662
  }
5336
5663
  /** Parses one scalar, list, tuple, dictionary, asset path, or scene path value. */
5337
5664
  parseValue() {
@@ -5971,8 +6298,8 @@ function deserializeArrowSchema(schema, options) {
5971
6298
  function serializeArrowMetadata(arrowMetadata) {
5972
6299
  return Object.fromEntries(arrowMetadata);
5973
6300
  }
5974
- function deserializeArrowMetadata(metadata) {
5975
- return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
6301
+ function deserializeArrowMetadata(metadata2) {
6302
+ return metadata2 ? new Map(Object.entries(metadata2)) : /* @__PURE__ */ new Map();
5976
6303
  }
5977
6304
  function serializeArrowField(field) {
5978
6305
  return {
@@ -6498,9 +6825,9 @@ function serializeArrowWorkerTable(result) {
6498
6825
  if (!isArrowTableWrapper(result)) {
6499
6826
  throw new Error("Workers require Arrow table output");
6500
6827
  }
6501
- const { data, ...metadata } = result;
6828
+ const { data, ...metadata2 } = result;
6502
6829
  return {
6503
- ...structuredClone(metadata),
6830
+ ...structuredClone(metadata2),
6504
6831
  data: dehydrateArrowTable(data, { copy: "all" })
6505
6832
  };
6506
6833
  }
@@ -6958,22 +7285,22 @@ function getAttributeArrowField(schema, attributeName, column, componentType) {
6958
7285
  if (!(suppliedField == null ? void 0 : suppliedField.metadata)) {
6959
7286
  return canonicalField;
6960
7287
  }
6961
- const metadata = new Map(canonicalField.metadata);
7288
+ const metadata2 = new Map(canonicalField.metadata);
6962
7289
  for (const [key, value] of Object.entries(suppliedField.metadata)) {
6963
- metadata.set(key, value);
7290
+ metadata2.set(key, value);
6964
7291
  }
6965
7292
  return new arrow6.Field(
6966
7293
  canonicalField.name,
6967
7294
  canonicalField.type,
6968
7295
  canonicalField.nullable,
6969
- metadata
7296
+ metadata2
6970
7297
  );
6971
7298
  }
6972
7299
  const field = schema == null ? void 0 : schema.fields.find((schemaField) => schemaField.name === attributeName);
6973
7300
  if (componentType === "float16") {
6974
- const metadata = new Map(Object.entries((field == null ? void 0 : field.metadata) || {}));
6975
- metadata.set("componentType", "float16");
6976
- return new arrow6.Field(attributeName, column.type, false, metadata);
7301
+ const metadata2 = new Map(Object.entries((field == null ? void 0 : field.metadata) || {}));
7302
+ metadata2.set("componentType", "float16");
7303
+ return new arrow6.Field(attributeName, column.type, false, metadata2);
6977
7304
  }
6978
7305
  if (field && field.type.toString() !== column.type.toString()) {
6979
7306
  const deserializedField = deserializeArrowField(field);
@@ -7022,17 +7349,17 @@ function getIndicesVector(indices, vertexCount, type) {
7022
7349
  }
7023
7350
  function getMeshArrowMetadata(options) {
7024
7351
  var _a;
7025
- const metadata = { ...(_a = options.schema) == null ? void 0 : _a.metadata };
7352
+ const metadata2 = { ...(_a = options.schema) == null ? void 0 : _a.metadata };
7026
7353
  if (options.topology) {
7027
- metadata.topology ||= options.topology;
7354
+ metadata2.topology ||= options.topology;
7028
7355
  }
7029
7356
  if (Number.isFinite(options.mode)) {
7030
- metadata.mode ||= String(options.mode);
7357
+ metadata2.mode ||= String(options.mode);
7031
7358
  }
7032
7359
  if (options.boundingBox) {
7033
- metadata.boundingBox ||= JSON.stringify(options.boundingBox);
7360
+ metadata2.boundingBox ||= JSON.stringify(options.boundingBox);
7034
7361
  }
7035
- return deserializeArrowMetadata(metadata);
7362
+ return deserializeArrowMetadata(metadata2);
7036
7363
  }
7037
7364
  var arrow6, MESH_ARROW_ATTRIBUTE_ORDER;
7038
7365
  var init_convert_mesh_to_table = __esm({
@@ -7066,24 +7393,24 @@ function convertArrowTableToMesh(table) {
7066
7393
  const attributes = {};
7067
7394
  const columns = [];
7068
7395
  for (const field of fields) {
7069
- const { name: name20 } = field;
7070
- if (name20 === "indices") {
7396
+ const { name: name22 } = field;
7397
+ if (name22 === "indices") {
7071
7398
  continue;
7072
7399
  }
7073
- const attributeData = arrowTable.getChild(name20);
7400
+ const attributeData = arrowTable.getChild(name22);
7074
7401
  const size = getFixedSizeListSize(attributeData);
7075
7402
  const typedArray = getAttributeTypedArray(attributeData, size);
7076
- const metadata = getMeshAttributeMetadata(field.metadata);
7077
- const value = metadata.componentType === "float16" ? restoreFloat16Array(typedArray) : typedArray;
7403
+ const metadata2 = getMeshAttributeMetadata(field.metadata);
7404
+ const value = metadata2.componentType === "float16" ? restoreFloat16Array(typedArray) : typedArray;
7078
7405
  const shared = columns.find(
7079
7406
  (column) => column.data.length === attributeData.data.length && attributes[column.name].value.constructor === value.constructor && column.data.every((chunk, index) => shareArrowStorage(chunk, attributeData.data[index]))
7080
7407
  );
7081
- attributes[name20] = {
7408
+ attributes[name22] = {
7082
7409
  value: shared ? attributes[shared.name].value : value,
7083
7410
  size,
7084
- ...metadata
7411
+ ...metadata2
7085
7412
  };
7086
- if (!shared) columns.push({ name: name20, data: attributeData.data });
7413
+ if (!shared) columns.push({ name: name22, data: attributeData.data });
7087
7414
  }
7088
7415
  fixMetadata(schema);
7089
7416
  const topology = schema.metadata.topology;
@@ -7119,23 +7446,23 @@ function getMeshBoundingBoxFromSchema(schema) {
7119
7446
  }
7120
7447
  return null;
7121
7448
  }
7122
- function getMeshAttributeMetadata(metadata = {}) {
7449
+ function getMeshAttributeMetadata(metadata2 = {}) {
7123
7450
  const result = {};
7124
- if (metadata.byteOffset !== void 0) {
7125
- result.byteOffset = Number(metadata.byteOffset);
7451
+ if (metadata2.byteOffset !== void 0) {
7452
+ result.byteOffset = Number(metadata2.byteOffset);
7126
7453
  }
7127
- if (metadata.byteStride !== void 0) {
7128
- result.byteStride = Number(metadata.byteStride);
7454
+ if (metadata2.byteStride !== void 0) {
7455
+ result.byteStride = Number(metadata2.byteStride);
7129
7456
  }
7130
- if (metadata.normalized !== void 0) {
7131
- result.normalized = metadata.normalized === "true";
7457
+ if (metadata2.normalized !== void 0) {
7458
+ result.normalized = metadata2.normalized === "true";
7132
7459
  }
7133
- if (metadata.componentType === "float16") {
7460
+ if (metadata2.componentType === "float16") {
7134
7461
  result.componentType = "float16";
7135
7462
  }
7136
- if (metadata["loaders.gl.transform"]) {
7463
+ if (metadata2["loaders.gl.transform"]) {
7137
7464
  try {
7138
- const transform = JSON.parse(metadata["loaders.gl.transform"]);
7465
+ const transform = JSON.parse(metadata2["loaders.gl.transform"]);
7139
7466
  if (isMeshAttributeTransform(transform)) {
7140
7467
  result.transform = transform;
7141
7468
  }
@@ -7224,15 +7551,15 @@ var init_convert_table_to_mesh = __esm({
7224
7551
  });
7225
7552
 
7226
7553
  // ../core/src/schema-utils/lib/mesh/deduce-mesh-schema.ts
7227
- function deduceMeshField(name20, attribute, optionalMetadata) {
7554
+ function deduceMeshField(name22, attribute, optionalMetadata) {
7228
7555
  const type = attribute.componentType || getDataTypeFromTypedArray(attribute.value);
7229
- const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
7556
+ const metadata2 = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
7230
7557
  const dataType = attribute.size === 1 ? type : { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] };
7231
7558
  return {
7232
- name: name20,
7559
+ name: name22,
7233
7560
  type: dataType,
7234
7561
  nullable: false,
7235
- metadata
7562
+ metadata: metadata2
7236
7563
  };
7237
7564
  }
7238
7565
  function makeMeshAttributeMetadata(attribute) {
@@ -7275,11 +7602,11 @@ var init_schema_utils = __esm({
7275
7602
  });
7276
7603
 
7277
7604
  // ../scene/src/obj/lib/get-obj-schema.ts
7278
- function getOBJSchema(attributes, metadata = {}) {
7605
+ function getOBJSchema(attributes, metadata2 = {}) {
7279
7606
  const stringMetadata = {};
7280
- for (const key in metadata) {
7607
+ for (const key in metadata2) {
7281
7608
  if (key !== "value") {
7282
- stringMetadata[key] = JSON.stringify(metadata[key]);
7609
+ stringMetadata[key] = JSON.stringify(metadata2[key]);
7283
7610
  }
7284
7611
  }
7285
7612
  const fields = [];
@@ -7290,11 +7617,11 @@ function getOBJSchema(attributes, metadata = {}) {
7290
7617
  }
7291
7618
  return { fields, metadata: stringMetadata };
7292
7619
  }
7293
- function getFieldFromAttribute(name20, attribute) {
7294
- const metadata = {};
7620
+ function getFieldFromAttribute(name22, attribute) {
7621
+ const metadata2 = {};
7295
7622
  for (const key in attribute) {
7296
7623
  if (key !== "value") {
7297
- metadata[key] = JSON.stringify(attribute[key]);
7624
+ metadata2[key] = JSON.stringify(attribute[key]);
7298
7625
  }
7299
7626
  }
7300
7627
  let { type } = getDataTypeFromArray(attribute.value);
@@ -7302,7 +7629,7 @@ function getFieldFromAttribute(name20, attribute) {
7302
7629
  if (!isSingleValue) {
7303
7630
  type = { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "values", type }] };
7304
7631
  }
7305
- return { name: name20, type, nullable: false, metadata };
7632
+ return { name: name22, type, nullable: false, metadata: metadata2 };
7306
7633
  }
7307
7634
  var init_get_obj_schema = __esm({
7308
7635
  "../scene/src/obj/lib/get-obj-schema.ts"() {
@@ -7388,8 +7715,8 @@ function parseOBJMeshes(text) {
7388
7715
  state.addPointGeometry(pointData);
7389
7716
  } else if (OBJECT_RE.test(line)) {
7390
7717
  result = OBJECT_RE.exec(line) || [];
7391
- const name20 = (" " + result[0].substr(1).trim()).substr(1);
7392
- state.startObject(name20);
7718
+ const name22 = (" " + result[0].substr(1).trim()).substr(1);
7719
+ state.startObject(name22);
7393
7720
  } else if (MATERIAL_USE_RE.test(line)) {
7394
7721
  state.object.startMaterial(line.substring(7).trim(), state.materialLibraries);
7395
7722
  } else if (MATERIAL_RE.test(line)) {
@@ -7464,9 +7791,9 @@ var init_parse_obj_meshes = __esm({
7464
7791
  MATERIAL_RE = /^mtllib /;
7465
7792
  MATERIAL_USE_RE = /^usemtl /;
7466
7793
  MeshMaterial = class _MeshMaterial {
7467
- constructor({ index, name: name20 = "", mtllib, smooth, groupStart }) {
7794
+ constructor({ index, name: name22 = "", mtllib, smooth, groupStart }) {
7468
7795
  this.index = index;
7469
- this.name = name20;
7796
+ this.name = name22;
7470
7797
  this.mtllib = mtllib;
7471
7798
  this.smooth = smooth;
7472
7799
  this.groupStart = groupStart;
@@ -7485,8 +7812,8 @@ var init_parse_obj_meshes = __esm({
7485
7812
  }
7486
7813
  };
7487
7814
  MeshObject = class {
7488
- constructor(name20 = "") {
7489
- this.name = name20;
7815
+ constructor(name22 = "") {
7816
+ this.name = name22;
7490
7817
  this.geometry = {
7491
7818
  vertices: [],
7492
7819
  normals: [],
@@ -7497,14 +7824,14 @@ var init_parse_obj_meshes = __esm({
7497
7824
  this.smooth = true;
7498
7825
  this.fromDeclaration = null;
7499
7826
  }
7500
- startMaterial(name20, libraries) {
7827
+ startMaterial(name22, libraries) {
7501
7828
  const previous = this._finalize(false);
7502
7829
  if (previous && (previous.inherited || previous.groupCount <= 0)) {
7503
7830
  this.materials.splice(previous.index, 1);
7504
7831
  }
7505
7832
  const material = new MeshMaterial({
7506
7833
  index: this.materials.length,
7507
- name: name20,
7834
+ name: name22,
7508
7835
  mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : "",
7509
7836
  smooth: previous !== void 0 ? previous.smooth : this.smooth,
7510
7837
  groupStart: previous !== void 0 ? previous.groupEnd : 0
@@ -7552,9 +7879,9 @@ var init_parse_obj_meshes = __esm({
7552
7879
  this.materialLibraries = [];
7553
7880
  this.startObject("", false);
7554
7881
  }
7555
- startObject(name20, fromDeclaration = true) {
7882
+ startObject(name22, fromDeclaration = true) {
7556
7883
  if (this.object && !this.object.fromDeclaration) {
7557
- this.object.name = name20;
7884
+ this.object.name = name22;
7558
7885
  this.object.fromDeclaration = fromDeclaration;
7559
7886
  return;
7560
7887
  }
@@ -7562,7 +7889,7 @@ var init_parse_obj_meshes = __esm({
7562
7889
  if (this.object && typeof this.object._finalize === "function") {
7563
7890
  this.object._finalize(true);
7564
7891
  }
7565
- this.object = new MeshObject(name20);
7892
+ this.object = new MeshObject(name22);
7566
7893
  this.object.fromDeclaration = fromDeclaration;
7567
7894
  if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === "function") {
7568
7895
  const declared = previousMaterial.clone(0);
@@ -8831,6 +9158,33 @@ var init_resolve_gltf_file = __esm({
8831
9158
  }
8832
9159
  });
8833
9160
 
9161
+ // ../scene/src/gltf/lib/extensions/KHR_accessor_float64.ts
9162
+ var KHR_accessor_float64_exports = {};
9163
+ __export(KHR_accessor_float64_exports, {
9164
+ name: () => name,
9165
+ preprocess: () => preprocess
9166
+ });
9167
+ function preprocess(gltf) {
9168
+ var _a, _b, _c, _d;
9169
+ const { json: json2 } = gltf;
9170
+ if (!((_a = json2.extensionsUsed) == null ? void 0 : _a.includes(name)) && !((_b = json2.extensionsRequired) == null ? void 0 : _b.includes(name))) return;
9171
+ if (!((_c = json2.extensionsUsed) == null ? void 0 : _c.includes(name)) || !((_d = json2.extensionsRequired) == null ? void 0 : _d.includes(name))) {
9172
+ throw new Error(`${name}: must be declared in extensionsUsed and extensionsRequired.`);
9173
+ }
9174
+ for (const [index, accessor] of (json2.accessors || []).entries()) {
9175
+ if (accessor.componentType === 5130 && accessor.normalized) {
9176
+ throw new Error(`${name}: accessor ${index} must not be normalized.`);
9177
+ }
9178
+ }
9179
+ }
9180
+ var name;
9181
+ var init_KHR_accessor_float64 = __esm({
9182
+ "../scene/src/gltf/lib/extensions/KHR_accessor_float64.ts"() {
9183
+ "use strict";
9184
+ name = "KHR_accessor_float64";
9185
+ }
9186
+ });
9187
+
8834
9188
  // ../scene/src/gltf/lib/api/gltf-scenegraph.ts
8835
9189
  function makeDefaultGLTFJson() {
8836
9190
  return {
@@ -8885,17 +9239,17 @@ var init_gltf_scenegraph = __esm({
8885
9239
  return extras[key];
8886
9240
  }
8887
9241
  hasExtension(extensionName) {
8888
- const isUsedExtension = this.getUsedExtensions().find((name20) => name20 === extensionName);
8889
- const isRequiredExtension = this.getRequiredExtensions().find((name20) => name20 === extensionName);
9242
+ const isUsedExtension = this.getUsedExtensions().find((name22) => name22 === extensionName);
9243
+ const isRequiredExtension = this.getRequiredExtensions().find((name22) => name22 === extensionName);
8890
9244
  return typeof isUsedExtension === "string" || typeof isRequiredExtension === "string";
8891
9245
  }
8892
9246
  getExtension(extensionName) {
8893
- const isExtension = this.getUsedExtensions().find((name20) => name20 === extensionName);
9247
+ const isExtension = this.getUsedExtensions().find((name22) => name22 === extensionName);
8894
9248
  const extensions = this.json.extensions || {};
8895
9249
  return isExtension ? extensions[extensionName] : null;
8896
9250
  }
8897
9251
  getRequiredExtension(extensionName) {
8898
- const isRequired = this.getRequiredExtensions().find((name20) => name20 === extensionName);
9252
+ const isRequired = this.getRequiredExtensions().find((name22) => name22 === extensionName);
8899
9253
  return isRequired ? this.getExtension(extensionName) : null;
8900
9254
  }
8901
9255
  getRequiredExtensions() {
@@ -9156,8 +9510,8 @@ var init_gltf_scenegraph = __esm({
9156
9510
  * @param mimeType
9157
9511
  */
9158
9512
  addImage(imageData, mimeTypeOpt) {
9159
- const metadata = getBinaryImageMetadata(imageData);
9160
- const mimeType = mimeTypeOpt || (metadata == null ? void 0 : metadata.mimeType);
9513
+ const metadata2 = getBinaryImageMetadata(imageData);
9514
+ const mimeType = mimeTypeOpt || (metadata2 == null ? void 0 : metadata2.mimeType);
9161
9515
  const bufferViewIndex = this.addBufferView(imageData);
9162
9516
  const glTFImage = {
9163
9517
  bufferView: bufferViewIndex,
@@ -9297,8 +9651,8 @@ var init_gltf_scenegraph = __esm({
9297
9651
  assert3(bufferOffset !== void 0);
9298
9652
  bufferView.byteOffset = bufferOffset + (bufferView.byteOffset || 0);
9299
9653
  bufferView.buffer = 0;
9300
- for (const name20 of ["EXT_meshopt_compression", "KHR_meshopt_compression"]) {
9301
- const extension = (_b = bufferView.extensions) == null ? void 0 : _b[name20];
9654
+ for (const name22 of ["EXT_meshopt_compression", "KHR_meshopt_compression"]) {
9655
+ const extension = (_b = bufferView.extensions) == null ? void 0 : _b[name22];
9302
9656
  if (extension) {
9303
9657
  const extensionOffset = bufferOffsets[extension.buffer];
9304
9658
  assert3(extensionOffset !== void 0);
@@ -9617,7 +9971,7 @@ function iterateObjectData(objects) {
9617
9971
  })();
9618
9972
  }
9619
9973
  function mapObjectData(objects) {
9620
- return new Map(Array.from(objects, ([name20, object]) => [name20, object.data]));
9974
+ return new Map(Array.from(objects, ([name22, object]) => [name22, object.data]));
9621
9975
  }
9622
9976
  function getCollectionName(type) {
9623
9977
  switch (type) {
@@ -10040,8 +10394,8 @@ var init_gltf_iterator = __esm({
10040
10394
  }
10041
10395
  /** Return the loaded buffer companion for a raw buffer definition. */
10042
10396
  getLoadedBuffer(buffer) {
10043
- const metadata = this.getMetadata(buffer);
10044
- return this.gltf.buffers[metadata.index];
10397
+ const metadata2 = this.getMetadata(buffer);
10398
+ return this.gltf.buffers[metadata2.index];
10045
10399
  }
10046
10400
  /** Return the loaded byte range for a raw buffer-view definition. */
10047
10401
  getLoadedBufferView(bufferView) {
@@ -10495,7 +10849,7 @@ function getPrimitiveTextureData(scenegraph, textureInfo, primitive) {
10495
10849
  if (typeof imageIndex !== "undefined") {
10496
10850
  const mimeType = (_d = (_c = json2.images) == null ? void 0 : _c[imageIndex]) == null ? void 0 : _d.mimeType;
10497
10851
  const parsedImage = (_e = scenegraph.gltf.images) == null ? void 0 : _e[imageIndex];
10498
- if (parsedImage && typeof parsedImage.width !== "undefined") {
10852
+ if (parsedImage && typeof parsedImage.width !== "undefined" && !("compressed" in parsedImage && parsedImage.compressed)) {
10499
10853
  const textureData = [];
10500
10854
  for (let index = 0; index < textureCoordinates.length; index += 2) {
10501
10855
  const value = getImageValueByCoordinates(
@@ -10686,7 +11040,7 @@ __export(EXT_mesh_features_exports, {
10686
11040
  createExtMeshFeatures: () => createExtMeshFeatures,
10687
11041
  decode: () => decode,
10688
11042
  encode: () => encode,
10689
- name: () => name
11043
+ name: () => name2
10690
11044
  });
10691
11045
  async function decode(gltfData, options) {
10692
11046
  const iterator = new GLTFIterator(gltfData);
@@ -10823,7 +11177,7 @@ function createAccessorKey(attributes) {
10823
11177
  const accessorKey = `${prefix}${max}`;
10824
11178
  return { accessorKey, index: max };
10825
11179
  }
10826
- var EXT_MESH_FEATURES_NAME, name;
11180
+ var EXT_MESH_FEATURES_NAME, name2;
10827
11181
  var init_EXT_mesh_features = __esm({
10828
11182
  "../scene/src/gltf/lib/extensions/EXT_mesh_features.ts"() {
10829
11183
  "use strict";
@@ -10832,7 +11186,7 @@ var init_EXT_mesh_features = __esm({
10832
11186
  init_d_tiles_utils();
10833
11187
  init_gltf_utils();
10834
11188
  EXT_MESH_FEATURES_NAME = "EXT_mesh_features";
10835
- name = EXT_MESH_FEATURES_NAME;
11189
+ name2 = EXT_MESH_FEATURES_NAME;
10836
11190
  }
10837
11191
  });
10838
11192
 
@@ -10842,7 +11196,7 @@ __export(EXT_structural_metadata_exports, {
10842
11196
  createExtStructuralMetadata: () => createExtStructuralMetadata,
10843
11197
  decode: () => decode2,
10844
11198
  encode: () => encode2,
10845
- name: () => name2
11199
+ name: () => name3
10846
11200
  });
10847
11201
  async function decode2(gltfData, options, context) {
10848
11202
  var _a;
@@ -11481,7 +11835,7 @@ function createPropertyDataString(strings) {
11481
11835
  function createBufferView(typedArray, scenegraph) {
11482
11836
  return scenegraph.addBufferView(typedArray);
11483
11837
  }
11484
- var EXT_STRUCTURAL_METADATA_NAME, name2, SCHEMA_CLASS_ID_DEFAULT, COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR;
11838
+ var EXT_STRUCTURAL_METADATA_NAME, name3, SCHEMA_CLASS_ID_DEFAULT, COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR;
11485
11839
  var init_EXT_structural_metadata = __esm({
11486
11840
  "../scene/src/gltf/lib/extensions/EXT_structural_metadata.ts"() {
11487
11841
  "use strict";
@@ -11490,7 +11844,7 @@ var init_EXT_structural_metadata = __esm({
11490
11844
  init_d_tiles_utils();
11491
11845
  init_resolve_url();
11492
11846
  EXT_STRUCTURAL_METADATA_NAME = "EXT_structural_metadata";
11493
- name2 = EXT_STRUCTURAL_METADATA_NAME;
11847
+ name3 = EXT_STRUCTURAL_METADATA_NAME;
11494
11848
  SCHEMA_CLASS_ID_DEFAULT = "schemaClassId";
11495
11849
  COMPONENT_TYPE_TO_ARRAY_CONSTRUCTOR = {
11496
11850
  INT8: Int8Array,
@@ -11513,15 +11867,19 @@ __export(KHR_gaussian_splatting_exports, {
11513
11867
  SPZ_COMPRESSION_EXTENSION_NAME: () => SPZ_COMPRESSION_EXTENSION_NAME,
11514
11868
  decode: () => decode3,
11515
11869
  getGaussianSplatPrimitives: () => getGaussianSplatPrimitives,
11516
- name: () => name3
11870
+ name: () => name4
11517
11871
  });
11518
- async function decode3(gltfData, options) {
11519
- var _a, _b, _c, _d;
11872
+ async function decode3(gltfData, options, context) {
11873
+ var _a, _b, _c, _d, _e;
11874
+ const loader = (_a = context == null ? void 0 : context.loaders) == null ? void 0 : _a.find((candidate) => {
11875
+ var _a2;
11876
+ return (_a2 = candidate.extensions) == null ? void 0 : _a2.includes("spz");
11877
+ });
11520
11878
  const descriptors = getGaussianSplatPrimitives(gltfData);
11521
11879
  const iterator = new GLTFIterator(gltfData);
11522
11880
  for (const [meshIndex, mesh] of (gltfData.json.meshes || []).entries()) {
11523
11881
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
11524
- const extension = (_a = primitive.extensions) == null ? void 0 : _a[name3];
11882
+ const extension = (_b = primitive.extensions) == null ? void 0 : _b[name4];
11525
11883
  if (!extension) continue;
11526
11884
  validateGaussianSplatPrimitive(
11527
11885
  gltfData.json,
@@ -11531,22 +11889,29 @@ async function decode3(gltfData, options) {
11531
11889
  primitiveIndex,
11532
11890
  iterator
11533
11891
  );
11534
- const compression = (_b = extension.extensions) == null ? void 0 : _b[SPZ_COMPRESSION_EXTENSION_NAME];
11892
+ const compression = (_c = extension.extensions) == null ? void 0 : _c[SPZ_COMPRESSION_EXTENSION_NAME];
11535
11893
  if (compression) {
11536
11894
  const descriptor = descriptors.find(
11537
11895
  (item) => item.meshIndex === meshIndex && item.primitiveIndex === primitiveIndex
11538
11896
  );
11539
11897
  if (descriptor) {
11540
- const decoder = (_c = options == null ? void 0 : options.gltf) == null ? void 0 : _c.splatDecoder;
11541
- const bufferView = (_d = gltfData.json.bufferViews) == null ? void 0 : _d[compression.bufferView];
11898
+ const decoder = (_d = options == null ? void 0 : options.gltf) == null ? void 0 : _d.splatDecoder;
11899
+ const bufferView = (_e = gltfData.json.bufferViews) == null ? void 0 : _e[compression.bufferView];
11542
11900
  if (bufferView && gltfData.buffers[bufferView.buffer]) {
11543
11901
  descriptor.compressedBytes = getBufferViewBytes(gltfData, compression.bufferView);
11544
- } else if (decoder) {
11902
+ } else if (decoder || loader) {
11545
11903
  throw new Error(
11546
11904
  `KHR_gaussian_splatting: bufferView ${compression.bufferView} is not loaded for SPZ2 decoding.`
11547
11905
  );
11548
11906
  }
11549
- if (decoder && descriptor.compressedBytes) {
11907
+ if (loader && context && descriptor.compressedBytes) {
11908
+ descriptor.decoded = await parseFromContext(
11909
+ descriptor.compressedBytes.buffer,
11910
+ loader,
11911
+ { ...options, splats: { ...options.splats, sourceCoordinateSystem: "LUF" } },
11912
+ context
11913
+ );
11914
+ } else if (decoder && descriptor.compressedBytes) {
11550
11915
  descriptor.decoded = await decoder(descriptor.compressedBytes.buffer, {
11551
11916
  sourceCoordinateSystem: "LUF"
11552
11917
  });
@@ -11580,7 +11945,7 @@ function getGaussianSplatPrimitives(gltf) {
11580
11945
  const descriptors = [];
11581
11946
  for (const [meshIndex, mesh] of (json2.meshes || []).entries()) {
11582
11947
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
11583
- const extension = (_a = primitive.extensions) == null ? void 0 : _a[name3];
11948
+ const extension = (_a = primitive.extensions) == null ? void 0 : _a[name4];
11584
11949
  if (!extension) continue;
11585
11950
  const compressedBufferView = (_c = (_b = extension.extensions) == null ? void 0 : _b[SPZ_COMPRESSION_EXTENSION_NAME]) == null ? void 0 : _c.bufferView;
11586
11951
  descriptors.push({
@@ -11683,12 +12048,13 @@ function isAccessorLoaded(gltf, iterator, accessorIndex) {
11683
12048
  const bufferView = (accessor == null ? void 0 : accessor.bufferView) === void 0 ? void 0 : (_b = gltf.bufferViews) == null ? void 0 : _b[accessor.bufferView];
11684
12049
  return Boolean(bufferView && iterator.gltf.buffers[bufferView.buffer]);
11685
12050
  }
11686
- var name3, SPZ_COMPRESSION_EXTENSION_NAME, REQUIRED_ATTRIBUTES;
12051
+ var name4, SPZ_COMPRESSION_EXTENSION_NAME, REQUIRED_ATTRIBUTES;
11687
12052
  var init_KHR_gaussian_splatting = __esm({
11688
12053
  "../scene/src/gltf/lib/extensions/KHR_gaussian_splatting.ts"() {
11689
12054
  "use strict";
12055
+ init_loader_utils();
11690
12056
  init_gltf_iterator();
11691
- name3 = "KHR_gaussian_splatting";
12057
+ name4 = "KHR_gaussian_splatting";
11692
12058
  SPZ_COMPRESSION_EXTENSION_NAME = "KHR_gaussian_splatting_compression_spz_2";
11693
12059
  REQUIRED_ATTRIBUTES = [
11694
12060
  "POSITION",
@@ -11705,13 +12071,13 @@ var EXT_primitive_voxels_exports = {};
11705
12071
  __export(EXT_primitive_voxels_exports, {
11706
12072
  decode: () => decode4,
11707
12073
  getVoxelPrimitives: () => getVoxelPrimitives,
11708
- name: () => name4
12074
+ name: () => name5
11709
12075
  });
11710
12076
  async function decode4(gltfData) {
11711
12077
  var _a;
11712
12078
  for (const [meshIndex, mesh] of (gltfData.json.meshes || []).entries()) {
11713
12079
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
11714
- const extension = (_a = primitive.extensions) == null ? void 0 : _a[name4];
12080
+ const extension = (_a = primitive.extensions) == null ? void 0 : _a[name5];
11715
12081
  if (extension)
11716
12082
  validateVoxelPrimitive(gltfData.json, primitive, extension, meshIndex, primitiveIndex);
11717
12083
  }
@@ -11723,7 +12089,7 @@ function getVoxelPrimitives(gltf) {
11723
12089
  const descriptors = [];
11724
12090
  for (const [meshIndex, mesh] of (json2.meshes || []).entries()) {
11725
12091
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
11726
- const extension = (_a = primitive.extensions) == null ? void 0 : _a[name4];
12092
+ const extension = (_a = primitive.extensions) == null ? void 0 : _a[name5];
11727
12093
  if (extension) {
11728
12094
  descriptors.push({
11729
12095
  meshIndex,
@@ -11761,11 +12127,11 @@ function validateVoxelPrimitive(gltf, primitive, extension, meshIndex, primitive
11761
12127
  }
11762
12128
  }
11763
12129
  }
11764
- var name4;
12130
+ var name5;
11765
12131
  var init_EXT_primitive_voxels = __esm({
11766
12132
  "../scene/src/gltf/lib/extensions/EXT_primitive_voxels.ts"() {
11767
12133
  "use strict";
11768
- name4 = "EXT_primitive_voxels";
12134
+ name5 = "EXT_primitive_voxels";
11769
12135
  }
11770
12136
  });
11771
12137
 
@@ -11774,15 +12140,15 @@ var KHR_mesh_primitive_restart_exports = {};
11774
12140
  __export(KHR_mesh_primitive_restart_exports, {
11775
12141
  decode: () => decode5,
11776
12142
  getPrimitiveRestartRanges: () => getPrimitiveRestartRanges,
11777
- name: () => name5
12143
+ name: () => name6
11778
12144
  });
11779
12145
  async function decode5(gltfData, options) {
11780
12146
  var _a, _b, _c;
11781
- if (!((_a = gltfData.json.extensionsUsed) == null ? void 0 : _a.includes(name5))) {
12147
+ if (!((_a = gltfData.json.extensionsUsed) == null ? void 0 : _a.includes(name6))) {
11782
12148
  return;
11783
12149
  }
11784
- if (!((_b = gltfData.json.extensionsRequired) == null ? void 0 : _b.includes(name5))) {
11785
- throw new Error(`${name5} must be declared in extensionsRequired`);
12150
+ if (!((_b = gltfData.json.extensionsRequired) == null ? void 0 : _b.includes(name6))) {
12151
+ throw new Error(`${name6} must be declared in extensionsRequired`);
11786
12152
  }
11787
12153
  if (!((_c = options.gltf) == null ? void 0 : _c.loadBuffers)) {
11788
12154
  return;
@@ -11802,14 +12168,14 @@ function decodePrimitiveRestart(iterator, primitive) {
11802
12168
  const indicesAccessor = primitive.indices;
11803
12169
  const accessor = typeof indicesAccessor === "number" ? (_a = iterator.data.accessors) == null ? void 0 : _a[indicesAccessor] : indicesAccessor;
11804
12170
  if (!accessor) {
11805
- throw new Error(`${name5}: primitive references missing indices accessor ${primitive.indices}`);
12171
+ throw new Error(`${name6}: primitive references missing indices accessor ${primitive.indices}`);
11806
12172
  }
11807
12173
  const restartIndex = getRestartIndex(accessor);
11808
12174
  const indices = iterator.getTypedArrayForAccessor(primitive.indices);
11809
12175
  const containsRestart = Array.prototype.includes.call(indices, restartIndex);
11810
12176
  if (!SUPPORTED_MODES.has(primitive.mode ?? 4)) {
11811
12177
  if (containsRestart) {
11812
- throw new Error(`${name5}: primitive restart is not valid for mode ${primitive.mode ?? 4}`);
12178
+ throw new Error(`${name6}: primitive restart is not valid for mode ${primitive.mode ?? 4}`);
11813
12179
  }
11814
12180
  return;
11815
12181
  }
@@ -11825,7 +12191,7 @@ function decodePrimitiveRestart(iterator, primitive) {
11825
12191
  }
11826
12192
  function getRestartIndex(accessor) {
11827
12193
  if (accessor.type !== "SCALAR") {
11828
- throw new Error(`${name5}: indices accessor must have SCALAR type`);
12194
+ throw new Error(`${name6}: indices accessor must have SCALAR type`);
11829
12195
  }
11830
12196
  switch (accessor.componentType) {
11831
12197
  case 5121:
@@ -11835,7 +12201,7 @@ function getRestartIndex(accessor) {
11835
12201
  case 5125:
11836
12202
  return 4294967295;
11837
12203
  default:
11838
- throw new Error(`${name5}: indices accessor must use an unsigned integer component type`);
12204
+ throw new Error(`${name6}: indices accessor must use an unsigned integer component type`);
11839
12205
  }
11840
12206
  }
11841
12207
  function getPrimitiveRestartRanges(indices, restartIndex) {
@@ -11851,12 +12217,12 @@ function getPrimitiveRestartRanges(indices, restartIndex) {
11851
12217
  }
11852
12218
  return ranges;
11853
12219
  }
11854
- var name5, SUPPORTED_MODES;
12220
+ var name6, SUPPORTED_MODES;
11855
12221
  var init_KHR_mesh_primitive_restart = __esm({
11856
12222
  "../scene/src/gltf/lib/extensions/KHR_mesh_primitive_restart.ts"() {
11857
12223
  "use strict";
11858
12224
  init_gltf_iterator();
11859
- name5 = "KHR_mesh_primitive_restart";
12225
+ name6 = "KHR_mesh_primitive_restart";
11860
12226
  SUPPORTED_MODES = /* @__PURE__ */ new Set([2, 3, 5, 6]);
11861
12227
  }
11862
12228
  });
@@ -11865,7 +12231,7 @@ var init_KHR_mesh_primitive_restart = __esm({
11865
12231
  var EXT_mesh_polygon_exports = {};
11866
12232
  __export(EXT_mesh_polygon_exports, {
11867
12233
  decode: () => decode6,
11868
- name: () => name6
12234
+ name: () => name7
11869
12235
  });
11870
12236
  async function decode6(gltfData, options) {
11871
12237
  var _a;
@@ -11875,7 +12241,7 @@ async function decode6(gltfData, options) {
11875
12241
  const iterator = new GLTFIterator(gltfData);
11876
12242
  for (const mesh of iterator.meshes) {
11877
12243
  for (const primitive of iterator.getReferences(mesh).primitives) {
11878
- const extension = iterator.getExtension(primitive, name6);
12244
+ const extension = iterator.getExtension(primitive, name7);
11879
12245
  if (extension) {
11880
12246
  Object.defineProperty(extension, "data", {
11881
12247
  configurable: true,
@@ -11890,10 +12256,10 @@ async function decode6(gltfData, options) {
11890
12256
  function decodePolygonData(iterator, primitive, extension) {
11891
12257
  var _a;
11892
12258
  if (!Number.isInteger(extension.count) || extension.count < 1) {
11893
- throw new Error(`${name6}: count must be a positive integer`);
12259
+ throw new Error(`${name7}: count must be a positive integer`);
11894
12260
  }
11895
12261
  if ((primitive.mode ?? 4) !== 4 || primitive.indices === void 0) {
11896
- throw new Error(`${name6}: primitive must use TRIANGLES mode with indices`);
12262
+ throw new Error(`${name7}: primitive must use TRIANGLES mode with indices`);
11897
12263
  }
11898
12264
  const triangleIndices = getUnsignedScalarAccessor(iterator, primitive.indices, "indices");
11899
12265
  const indicesOffsets = getUnsignedScalarAccessor(
@@ -11926,14 +12292,14 @@ function decodePolygonData(iterator, primitive, extension) {
11926
12292
  }));
11927
12293
  if ((triangleEnd - triangleStart) % 3 !== 0) {
11928
12294
  throw new Error(
11929
- `${name6}: polygon ${polygonIndex} triangle range must contain complete triangles`
12295
+ `${name7}: polygon ${polygonIndex} triangle range must contain complete triangles`
11930
12296
  );
11931
12297
  }
11932
12298
  if (loopRanges.length === 0) {
11933
- throw new Error(`${name6}: polygon ${polygonIndex} must contain at least one loop`);
12299
+ throw new Error(`${name7}: polygon ${polygonIndex} must contain at least one loop`);
11934
12300
  }
11935
12301
  if (loopRanges.some((range) => range.count < 3)) {
11936
- throw new Error(`${name6}: polygon ${polygonIndex} loops must contain at least three indices`);
12302
+ throw new Error(`${name7}: polygon ${polygonIndex} loops must contain at least three indices`);
11937
12303
  }
11938
12304
  polygons.push({
11939
12305
  triangleRange: { offset: triangleStart, count: triangleEnd - triangleStart },
@@ -11945,29 +12311,29 @@ function decodePolygonData(iterator, primitive, extension) {
11945
12311
  function getUnsignedScalarAccessor(iterator, accessorReference, label, expectedCount) {
11946
12312
  var _a;
11947
12313
  if (typeof accessorReference === "number" && (!Number.isInteger(accessorReference) || accessorReference < 0)) {
11948
- throw new Error(`${name6}: ${label} must reference an accessor`);
12314
+ throw new Error(`${name7}: ${label} must reference an accessor`);
11949
12315
  }
11950
12316
  const accessor = typeof accessorReference === "number" ? (_a = iterator.data.accessors) == null ? void 0 : _a[accessorReference] : accessorReference;
11951
12317
  if (!accessor) {
11952
- throw new Error(`${name6}: ${label} references missing accessor ${accessorReference}`);
12318
+ throw new Error(`${name7}: ${label} references missing accessor ${accessorReference}`);
11953
12319
  }
11954
12320
  if (accessor.type !== "SCALAR" || ![5121, 5123, 5125].includes(accessor.componentType)) {
11955
- throw new Error(`${name6}: ${label} must be an unsigned integer SCALAR accessor`);
12321
+ throw new Error(`${name7}: ${label} must be an unsigned integer SCALAR accessor`);
11956
12322
  }
11957
12323
  if (expectedCount !== void 0 && accessor.count !== expectedCount) {
11958
- throw new Error(`${name6}: ${label} count must equal polygon count ${expectedCount}`);
12324
+ throw new Error(`${name7}: ${label} count must equal polygon count ${expectedCount}`);
11959
12325
  }
11960
12326
  return iterator.getTypedArrayForAccessor(accessorReference);
11961
12327
  }
11962
12328
  function validateOffsets(offsets, targetLength, label) {
11963
12329
  if (Number(offsets[0]) !== 0) {
11964
- throw new Error(`${name6}: ${label} must begin at zero`);
12330
+ throw new Error(`${name7}: ${label} must begin at zero`);
11965
12331
  }
11966
12332
  let previousOffset = -1;
11967
12333
  for (let index = 0; index < offsets.length; index++) {
11968
12334
  const offset = Number(offsets[index]);
11969
12335
  if (!Number.isInteger(offset) || offset < 0 || offset >= targetLength || offset <= previousOffset) {
11970
- throw new Error(`${name6}: ${label} must contain increasing in-bounds offsets`);
12336
+ throw new Error(`${name7}: ${label} must contain increasing in-bounds offsets`);
11971
12337
  }
11972
12338
  previousOffset = offset;
11973
12339
  }
@@ -11981,16 +12347,16 @@ function getUnsignedMaximum(componentType) {
11981
12347
  case 5125:
11982
12348
  return 4294967295;
11983
12349
  default:
11984
- throw new Error(`${name6}: unsupported loop index component type ${componentType}`);
12350
+ throw new Error(`${name7}: unsupported loop index component type ${componentType}`);
11985
12351
  }
11986
12352
  }
11987
- var name6;
12353
+ var name7;
11988
12354
  var init_EXT_mesh_polygon = __esm({
11989
12355
  "../scene/src/gltf/lib/extensions/EXT_mesh_polygon.ts"() {
11990
12356
  "use strict";
11991
12357
  init_gltf_iterator();
11992
12358
  init_KHR_mesh_primitive_restart();
11993
- name6 = "EXT_mesh_polygon";
12359
+ name7 = "EXT_mesh_polygon";
11994
12360
  }
11995
12361
  });
11996
12362
 
@@ -11999,16 +12365,16 @@ var MPEG_audio_spatial_exports = {};
11999
12365
  __export(MPEG_audio_spatial_exports, {
12000
12366
  decode: () => decode7,
12001
12367
  getSpatialAudio: () => getSpatialAudio,
12002
- name: () => name7
12368
+ name: () => name8
12003
12369
  });
12004
12370
  function getSpatialAudio(gltf) {
12005
12371
  var _a, _b;
12006
12372
  const json2 = "asset" in gltf ? gltf : gltf.json;
12007
12373
  const descriptors = [];
12008
- const extension = (_a = json2.extensions) == null ? void 0 : _a[name7];
12374
+ const extension = (_a = json2.extensions) == null ? void 0 : _a[name8];
12009
12375
  if (extension) descriptors.push({ nodeIndex: null, extension });
12010
12376
  for (const [nodeIndex, node] of (json2.nodes || []).entries()) {
12011
- const nodeExtension = (_b = node.extensions) == null ? void 0 : _b[name7];
12377
+ const nodeExtension = (_b = node.extensions) == null ? void 0 : _b[name8];
12012
12378
  if (nodeExtension) descriptors.push({ nodeIndex, extension: nodeExtension });
12013
12379
  }
12014
12380
  return descriptors;
@@ -12020,29 +12386,29 @@ async function decode7(gltfData) {
12020
12386
  const location = nodeIndex === null ? "root" : `node ${nodeIndex}`;
12021
12387
  for (const source of extension.sources || []) {
12022
12388
  if (!Array.isArray(source.accessors) || source.accessors.length === 0) {
12023
- throw new Error(`${name7}: ${location} source ${source.id} requires audio accessors.`);
12389
+ throw new Error(`${name8}: ${location} source ${source.id} requires audio accessors.`);
12024
12390
  }
12025
12391
  for (const accessorIndex of source.accessors) {
12026
12392
  if (!Number.isInteger(accessorIndex) || accessorIndex < 0 || !((_a = gltfData.json.accessors) == null ? void 0 : _a[accessorIndex])) {
12027
12393
  throw new Error(
12028
- `${name7}: ${location} source ${source.id} has invalid accessor ${accessorIndex}.`
12394
+ `${name8}: ${location} source ${source.id} has invalid accessor ${accessorIndex}.`
12029
12395
  );
12030
12396
  }
12031
12397
  }
12032
12398
  if (source.reverbFeedGain && source.reverbFeedGain.length !== (((_b = source.reverbFeed) == null ? void 0 : _b.length) || 0)) {
12033
12399
  throw new Error(
12034
- `${name7}: ${location} source ${source.id} has mismatched reverb feed gains.`
12400
+ `${name8}: ${location} source ${source.id} has mismatched reverb feed gains.`
12035
12401
  );
12036
12402
  }
12037
12403
  }
12038
12404
  }
12039
12405
  if (descriptors.length) gltfData.spatialAudio = descriptors;
12040
12406
  }
12041
- var name7;
12407
+ var name8;
12042
12408
  var init_MPEG_audio_spatial = __esm({
12043
12409
  "../scene/src/gltf/lib/extensions/MPEG_audio_spatial.ts"() {
12044
12410
  "use strict";
12045
- name7 = "MPEG_audio_spatial";
12411
+ name8 = "MPEG_audio_spatial";
12046
12412
  }
12047
12413
  });
12048
12414
 
@@ -12050,11 +12416,11 @@ var init_MPEG_audio_spatial = __esm({
12050
12416
  var KHR_audio_emitter_exports = {};
12051
12417
  __export(KHR_audio_emitter_exports, {
12052
12418
  decode: () => decode8,
12053
- name: () => name8
12419
+ name: () => name9
12054
12420
  });
12055
12421
  async function decode8(gltfData, options, context) {
12056
12422
  var _a, _b, _c;
12057
- const extension = (_a = gltfData.json.extensions) == null ? void 0 : _a[name8];
12423
+ const extension = (_a = gltfData.json.extensions) == null ? void 0 : _a[name9];
12058
12424
  const clips = ((extension == null ? void 0 : extension.audio) || []).map((audio) => ({ audio }));
12059
12425
  const sources = (extension == null ? void 0 : extension.sources) || [];
12060
12426
  const emitters = (extension == null ? void 0 : extension.emitters) || [];
@@ -12063,25 +12429,25 @@ async function decode8(gltfData, options, context) {
12063
12429
  }
12064
12430
  for (const emitter of emitters) {
12065
12431
  if (emitter.type !== "global" && emitter.type !== "positional") {
12066
- throw new Error(`${name8}: invalid emitter type ${emitter.type}.`);
12432
+ throw new Error(`${name9}: invalid emitter type ${emitter.type}.`);
12067
12433
  }
12068
12434
  if (emitter.type === "global" && emitter.positional !== void 0) {
12069
- throw new Error(`${name8}: global emitters cannot have positional settings.`);
12435
+ throw new Error(`${name9}: global emitters cannot have positional settings.`);
12070
12436
  }
12071
12437
  for (const sourceIndex of emitter.sources || []) getReference(sources, sourceIndex, "source");
12072
12438
  }
12073
12439
  const descriptors = [];
12074
12440
  for (const attachmentType of ["nodes", "scenes"]) {
12075
12441
  for (const [attachmentIndex, object] of (gltfData.json[attachmentType] || []).entries()) {
12076
- const attachment = (_b = object.extensions) == null ? void 0 : _b[name8];
12442
+ const attachment = (_b = object.extensions) == null ? void 0 : _b[name9];
12077
12443
  if (!attachment) continue;
12078
12444
  if (!Array.isArray(attachment.emitters) || !attachment.emitters.length) {
12079
- throw new Error(`${name8}: ${attachmentType} ${attachmentIndex} requires emitters.`);
12445
+ throw new Error(`${name9}: ${attachmentType} ${attachmentIndex} requires emitters.`);
12080
12446
  }
12081
12447
  for (const emitterIndex of attachment.emitters) {
12082
12448
  const emitter = getReference(emitters, emitterIndex, "emitter");
12083
12449
  if (attachmentType === "scenes" && emitter.type !== "global") {
12084
- throw new Error(`${name8}: scenes may only reference global emitters.`);
12450
+ throw new Error(`${name9}: scenes may only reference global emitters.`);
12085
12451
  }
12086
12452
  descriptors.push({
12087
12453
  emitterIndex,
@@ -12110,7 +12476,7 @@ async function decode8(gltfData, options, context) {
12110
12476
  }
12111
12477
  function getReference(values, index, kind) {
12112
12478
  if (!Number.isInteger(index) || index < 0 || !values[index]) {
12113
- throw new Error(`${name8}: invalid ${kind} index ${index}.`);
12479
+ throw new Error(`${name9}: invalid ${kind} index ${index}.`);
12114
12480
  }
12115
12481
  return values[index];
12116
12482
  }
@@ -12118,9 +12484,9 @@ function validateClip(gltfData, clip) {
12118
12484
  const { audio } = clip;
12119
12485
  if (audio.bufferView !== void 0) {
12120
12486
  getReference(gltfData.json.bufferViews || [], audio.bufferView, "bufferView");
12121
- if (!audio.mimeType) throw new Error(`${name8}: buffer-view audio requires mimeType.`);
12487
+ if (!audio.mimeType) throw new Error(`${name9}: buffer-view audio requires mimeType.`);
12122
12488
  } else if (!audio.uri) {
12123
- throw new Error(`${name8}: audio requires a uri or bufferView.`);
12489
+ throw new Error(`${name9}: audio requires a uri or bufferView.`);
12124
12490
  }
12125
12491
  }
12126
12492
  async function loadClip(gltfData, clip, options, context) {
@@ -12131,29 +12497,29 @@ async function loadClip(gltfData, clip, options, context) {
12131
12497
  const buffer = gltfData.buffers[bufferView.buffer];
12132
12498
  if (!buffer) {
12133
12499
  if (((_a = options.gltf) == null ? void 0 : _a.loadBuffers) === false) return;
12134
- throw new Error(`${name8}: audio buffer ${bufferView.buffer} is not loaded.`);
12500
+ throw new Error(`${name9}: audio buffer ${bufferView.buffer} is not loaded.`);
12135
12501
  }
12136
12502
  const byteOffset = bufferView.byteOffset ?? 0;
12137
12503
  const byteLength = bufferView.byteLength;
12138
12504
  if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || !Number.isSafeInteger(byteLength) || byteLength < 0 || byteOffset + byteLength > buffer.byteLength || buffer.byteOffset + byteOffset + byteLength > buffer.arrayBuffer.byteLength) {
12139
- throw new Error(`${name8}: audio bufferView exceeds its buffer.`);
12505
+ throw new Error(`${name9}: audio bufferView exceeds its buffer.`);
12140
12506
  }
12141
12507
  clip.data = new Uint8Array(buffer.arrayBuffer, buffer.byteOffset + byteOffset, byteLength);
12142
12508
  return;
12143
12509
  }
12144
- if (!(context == null ? void 0 : context.fetch)) throw new Error(`${name8}: a loader context is required to load audio.`);
12510
+ if (!(context == null ? void 0 : context.fetch)) throw new Error(`${name9}: a loader context is required to load audio.`);
12145
12511
  const url = resolveUrl(audio.uri, options, context);
12146
12512
  const response = await context.fetch(url);
12147
- if (!response.ok) throw new Error(`${name8}: failed to load audio ${url} (${response.status}).`);
12513
+ if (!response.ok) throw new Error(`${name9}: failed to load audio ${url} (${response.status}).`);
12148
12514
  clip.url = url;
12149
12515
  clip.data = new Uint8Array(await response.arrayBuffer());
12150
12516
  }
12151
- var name8;
12517
+ var name9;
12152
12518
  var init_KHR_audio_emitter = __esm({
12153
12519
  "../scene/src/gltf/lib/extensions/KHR_audio_emitter.ts"() {
12154
12520
  "use strict";
12155
12521
  init_resolve_url();
12156
- name8 = "KHR_audio_emitter";
12522
+ name9 = "KHR_audio_emitter";
12157
12523
  }
12158
12524
  });
12159
12525
 
@@ -12307,7 +12673,7 @@ var init_meshopt_decoder = __esm({
12307
12673
  }
12308
12674
  return result.buffer.slice(0, write);
12309
12675
  }
12310
- function decode17(instance2, fun, target, count, size, source, filter) {
12676
+ function decode18(instance2, fun, target, count, size, source, filter) {
12311
12677
  var sbrk = instance2.exports.sbrk;
12312
12678
  var count4 = count + 3 & ~3;
12313
12679
  var tp = sbrk(count4 * size);
@@ -12353,7 +12719,7 @@ var init_meshopt_decoder = __esm({
12353
12719
  return worker;
12354
12720
  }
12355
12721
  function initWorkers(count) {
12356
- var source = "self.ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(wasm2) + "]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = " + workerProcess.name + ";" + decode17.toString() + workerProcess.toString();
12722
+ var source = "self.ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(wasm2) + "]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = " + workerProcess.name + ";" + decode18.toString() + workerProcess.toString();
12357
12723
  var blob = new Blob([source], { type: "text/javascript" });
12358
12724
  var url = URL.createObjectURL(blob);
12359
12725
  for (var i = workers.length; i < count; ++i) {
@@ -12388,7 +12754,7 @@ var init_meshopt_decoder = __esm({
12388
12754
  }
12389
12755
  try {
12390
12756
  var target = new Uint8Array(data.count * data.size);
12391
- decode17(instance2, instance2.exports[data.mode], target, data.count, data.size, data.source, instance2.exports[data.filter]);
12757
+ decode18(instance2, instance2.exports[data.mode], target, data.count, data.size, data.source, instance2.exports[data.filter]);
12392
12758
  self.postMessage({ id: data.id, count: data.count, action: "resolve", value: target }, [target.buffer]);
12393
12759
  } catch (error) {
12394
12760
  self.postMessage({ id: data.id, count: data.count, action: "reject", value: error });
@@ -12402,16 +12768,16 @@ var init_meshopt_decoder = __esm({
12402
12768
  initWorkers(count);
12403
12769
  },
12404
12770
  decodeVertexBuffer: function(target, count, size, source, filter) {
12405
- decode17(instance, instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);
12771
+ decode18(instance, instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);
12406
12772
  },
12407
12773
  decodeIndexBuffer: function(target, count, size, source) {
12408
- decode17(instance, instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);
12774
+ decode18(instance, instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);
12409
12775
  },
12410
12776
  decodeIndexSequence: function(target, count, size, source) {
12411
- decode17(instance, instance.exports.meshopt_decodeIndexSequence, target, count, size, source);
12777
+ decode18(instance, instance.exports.meshopt_decodeIndexSequence, target, count, size, source);
12412
12778
  },
12413
12779
  decodeGltfBuffer: function(target, count, size, source, mode, filter) {
12414
- decode17(instance, instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);
12780
+ decode18(instance, instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);
12415
12781
  },
12416
12782
  decodeGltfBufferAsync: function(count, size, source, mode, filter) {
12417
12783
  if (workers.length > 0) {
@@ -12419,7 +12785,7 @@ var init_meshopt_decoder = __esm({
12419
12785
  }
12420
12786
  return ready.then(function() {
12421
12787
  var target = new Uint8Array(count * size);
12422
- decode17(instance, instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);
12788
+ decode18(instance, instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]);
12423
12789
  return target;
12424
12790
  });
12425
12791
  }
@@ -12573,17 +12939,17 @@ var init_meshopt_compression = __esm({
12573
12939
  var EXT_meshopt_compression_exports = {};
12574
12940
  __export(EXT_meshopt_compression_exports, {
12575
12941
  decode: () => decode9,
12576
- name: () => name9
12942
+ name: () => name10
12577
12943
  });
12578
12944
  async function decode9(gltfData, options) {
12579
- await decodeMeshoptCompression(gltfData, options, name9);
12945
+ await decodeMeshoptCompression(gltfData, options, name10);
12580
12946
  }
12581
- var name9;
12947
+ var name10;
12582
12948
  var init_EXT_meshopt_compression = __esm({
12583
12949
  "../scene/src/gltf/lib/extensions/EXT_meshopt_compression.ts"() {
12584
12950
  "use strict";
12585
12951
  init_meshopt_compression();
12586
- name9 = "EXT_meshopt_compression";
12952
+ name10 = "EXT_meshopt_compression";
12587
12953
  }
12588
12954
  });
12589
12955
 
@@ -12591,28 +12957,29 @@ var init_EXT_meshopt_compression = __esm({
12591
12957
  var KHR_meshopt_compression_exports = {};
12592
12958
  __export(KHR_meshopt_compression_exports, {
12593
12959
  decode: () => decode10,
12594
- name: () => name10
12960
+ name: () => name11
12595
12961
  });
12596
12962
  async function decode10(gltfData, options) {
12597
- await decodeMeshoptCompression(gltfData, options, name10);
12963
+ await decodeMeshoptCompression(gltfData, options, name11);
12598
12964
  }
12599
- var name10;
12965
+ var name11;
12600
12966
  var init_KHR_meshopt_compression = __esm({
12601
12967
  "../scene/src/gltf/lib/extensions/KHR_meshopt_compression.ts"() {
12602
12968
  "use strict";
12603
12969
  init_meshopt_compression();
12604
- name10 = "KHR_meshopt_compression";
12970
+ name11 = "KHR_meshopt_compression";
12605
12971
  }
12606
12972
  });
12607
12973
 
12608
12974
  // ../scene/src/gltf/lib/extensions/EXT_texture_webp.ts
12609
12975
  var EXT_texture_webp_exports = {};
12610
12976
  __export(EXT_texture_webp_exports, {
12611
- name: () => name11,
12612
- preprocess: () => preprocess
12977
+ name: () => name12,
12978
+ preprocess: () => preprocess2
12613
12979
  });
12614
- function preprocess(gltfData, options) {
12980
+ function preprocess2(gltfData, options) {
12615
12981
  const iterator = new GLTFIterator(gltfData);
12982
+ if (!iterator.hasExtension(EXT_TEXTURE_WEBP)) return;
12616
12983
  if (!isImageFormatSupported("image/webp")) {
12617
12984
  if (iterator.isExtensionRequired(EXT_TEXTURE_WEBP)) {
12618
12985
  throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);
@@ -12628,24 +12995,24 @@ function preprocess(gltfData, options) {
12628
12995
  }
12629
12996
  iterator.removeExtension(EXT_TEXTURE_WEBP);
12630
12997
  }
12631
- var EXT_TEXTURE_WEBP, name11;
12998
+ var EXT_TEXTURE_WEBP, name12;
12632
12999
  var init_EXT_texture_webp = __esm({
12633
13000
  "../scene/src/gltf/lib/extensions/EXT_texture_webp.ts"() {
12634
13001
  "use strict";
12635
13002
  init_src();
12636
13003
  init_gltf_iterator();
12637
13004
  EXT_TEXTURE_WEBP = "EXT_texture_webp";
12638
- name11 = EXT_TEXTURE_WEBP;
13005
+ name12 = EXT_TEXTURE_WEBP;
12639
13006
  }
12640
13007
  });
12641
13008
 
12642
13009
  // ../scene/src/gltf/lib/extensions/EXT_texture_avif.ts
12643
13010
  var EXT_texture_avif_exports = {};
12644
13011
  __export(EXT_texture_avif_exports, {
12645
- name: () => name12,
12646
- preprocess: () => preprocess2
13012
+ name: () => name13,
13013
+ preprocess: () => preprocess3
12647
13014
  });
12648
- async function preprocess2(gltfData, options) {
13015
+ async function preprocess3(gltfData, options) {
12649
13016
  void options;
12650
13017
  const iterator = new GLTFIterator(gltfData);
12651
13018
  if (!iterator.hasExtension(EXT_TEXTURE_AVIF)) return;
@@ -12665,24 +13032,72 @@ async function preprocess2(gltfData, options) {
12665
13032
  }
12666
13033
  iterator.removeExtension(EXT_TEXTURE_AVIF);
12667
13034
  }
12668
- var EXT_TEXTURE_AVIF, name12;
13035
+ var EXT_TEXTURE_AVIF, name13;
12669
13036
  var init_EXT_texture_avif = __esm({
12670
13037
  "../scene/src/gltf/lib/extensions/EXT_texture_avif.ts"() {
12671
13038
  "use strict";
12672
13039
  init_src();
12673
13040
  init_gltf_iterator();
12674
13041
  EXT_TEXTURE_AVIF = "EXT_texture_avif";
12675
- name12 = EXT_TEXTURE_AVIF;
13042
+ name13 = EXT_TEXTURE_AVIF;
13043
+ }
13044
+ });
13045
+
13046
+ // ../scene/src/gltf/lib/extensions/MSFT_texture_dds.ts
13047
+ var MSFT_texture_dds_exports = {};
13048
+ __export(MSFT_texture_dds_exports, {
13049
+ decode: () => decode11,
13050
+ getDDSLoader: () => getDDSLoader,
13051
+ name: () => name14,
13052
+ preprocess: () => preprocess4
13053
+ });
13054
+ function getDDSLoader(context) {
13055
+ var _a;
13056
+ return (_a = context == null ? void 0 : context.loaders) == null ? void 0 : _a.find(
13057
+ (loader) => {
13058
+ var _a2, _b;
13059
+ return ((_a2 = loader.extensions) == null ? void 0 : _a2.includes("dds")) || ((_b = loader.mimeTypes) == null ? void 0 : _b.includes("image/vnd-ms.dds"));
13060
+ }
13061
+ );
13062
+ }
13063
+ function preprocess4(gltf, _options, context) {
13064
+ const iterator = new GLTFIterator(gltf);
13065
+ if (!iterator.hasExtension(name14)) return;
13066
+ if (!getDDSLoader(context)) {
13067
+ if (iterator.isExtensionRequired(name14)) {
13068
+ throw new Error("gltf: Required extension MSFT_texture_dds needs a DDS parser");
13069
+ }
13070
+ return;
13071
+ }
13072
+ for (const texture of iterator.textures) {
13073
+ const extension = iterator.getExtension(texture, name14);
13074
+ if (extension) texture.source = extension.source;
13075
+ }
13076
+ }
13077
+ async function decode11(gltf, options, context) {
13078
+ var _a;
13079
+ if (!getDDSLoader(context) || ((_a = options.gltf) == null ? void 0 : _a.loadImages) === false) return;
13080
+ const iterator = new GLTFIterator(gltf);
13081
+ if (!iterator.hasExtension(name14)) return;
13082
+ for (const texture of iterator.textures) iterator.removeExtension(texture, name14);
13083
+ iterator.removeExtension(name14);
13084
+ }
13085
+ var name14;
13086
+ var init_MSFT_texture_dds = __esm({
13087
+ "../scene/src/gltf/lib/extensions/MSFT_texture_dds.ts"() {
13088
+ "use strict";
13089
+ init_gltf_iterator();
13090
+ name14 = "MSFT_texture_dds";
12676
13091
  }
12677
13092
  });
12678
13093
 
12679
13094
  // ../scene/src/gltf/lib/extensions/KHR_texture_basisu.ts
12680
13095
  var KHR_texture_basisu_exports = {};
12681
13096
  __export(KHR_texture_basisu_exports, {
12682
- name: () => name13,
12683
- preprocess: () => preprocess3
13097
+ name: () => name15,
13098
+ preprocess: () => preprocess5
12684
13099
  });
12685
- function preprocess3(gltfData, options) {
13100
+ function preprocess5(gltfData, options) {
12686
13101
  void options;
12687
13102
  const iterator = new GLTFIterator(gltfData);
12688
13103
  for (const texture of iterator.textures) {
@@ -12694,13 +13109,13 @@ function preprocess3(gltfData, options) {
12694
13109
  }
12695
13110
  iterator.removeExtension(KHR_TEXTURE_BASISU);
12696
13111
  }
12697
- var KHR_TEXTURE_BASISU, name13;
13112
+ var KHR_TEXTURE_BASISU, name15;
12698
13113
  var init_KHR_texture_basisu = __esm({
12699
13114
  "../scene/src/gltf/lib/extensions/KHR_texture_basisu.ts"() {
12700
13115
  "use strict";
12701
13116
  init_gltf_iterator();
12702
13117
  KHR_TEXTURE_BASISU = "KHR_texture_basisu";
12703
- name13 = KHR_TEXTURE_BASISU;
13118
+ name15 = KHR_TEXTURE_BASISU;
12704
13119
  }
12705
13120
  });
12706
13121
 
@@ -13033,7 +13448,7 @@ function validateDracoEncoderModule(module2) {
13033
13448
  return typedModule;
13034
13449
  }
13035
13450
  function getLibraryCacheKey2(type, options) {
13036
- const libraryOverrides = Object.entries(options.modules || {}).filter(([name20]) => name20 !== "draco3d").map(([name20, value]) => `${name20}:${String(value)}`).sort().join("|");
13451
+ const libraryOverrides = Object.entries(options.modules || {}).filter(([name22]) => name22 !== "draco3d").map(([name22, value]) => `${name22}:${String(value)}`).sort().join("|");
13037
13452
  return [
13038
13453
  type,
13039
13454
  options.useLocalLibraries ? "local" : "remote",
@@ -13058,7 +13473,7 @@ var init_draco_module_loader = __esm({
13058
13473
 
13059
13474
  // ../scene/src/draco/lib/utils/get-draco-schema.ts
13060
13475
  function getDracoSchema(attributes, loaderData, indices) {
13061
- const metadata = makeMetadata(loaderData.metadata);
13476
+ const metadata2 = makeMetadata(loaderData.metadata);
13062
13477
  const fields = [];
13063
13478
  const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
13064
13479
  for (const attributeName in attributes) {
@@ -13074,7 +13489,7 @@ function getDracoSchema(attributes, loaderData, indices) {
13074
13489
  const indicesField = getArrowFieldFromAttribute("indices", indices);
13075
13490
  fields.push(indicesField);
13076
13491
  }
13077
- return { fields, metadata };
13492
+ return { fields, metadata: metadata2 };
13078
13493
  }
13079
13494
  function transformAttributesLoaderData(loaderData) {
13080
13495
  const result = {};
@@ -13092,11 +13507,11 @@ function getArrowFieldFromAttribute(attributeName, attribute, loaderData) {
13092
13507
  const field = deduceMeshField(attributeName, attribute, metadataMap);
13093
13508
  return field;
13094
13509
  }
13095
- function makeMetadata(metadata) {
13096
- Object.entries(metadata);
13510
+ function makeMetadata(metadata2) {
13511
+ Object.entries(metadata2);
13097
13512
  const serializedMetadata = {};
13098
- for (const key in metadata) {
13099
- serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);
13513
+ for (const key in metadata2) {
13514
+ serializedMetadata[`${key}.string`] = JSON.stringify(metadata2[key]);
13100
13515
  }
13101
13516
  return serializedMetadata;
13102
13517
  }
@@ -13315,14 +13730,14 @@ var init_draco_parser = __esm({
13315
13730
  * @returns
13316
13731
  */
13317
13732
  _getDracoLoaderData(dracoGeometry, geometry_type, options) {
13318
- const metadata = this._getTopLevelMetadata(dracoGeometry);
13733
+ const metadata2 = this._getTopLevelMetadata(dracoGeometry);
13319
13734
  const attributes = this._getDracoAttributes(dracoGeometry, options);
13320
13735
  return {
13321
13736
  geometry_type,
13322
13737
  num_attributes: dracoGeometry.num_attributes(),
13323
13738
  num_points: dracoGeometry.num_points(),
13324
13739
  num_faces: dracoGeometry instanceof this.draco.Mesh ? dracoGeometry.num_faces() : 0,
13325
- metadata,
13740
+ metadata: metadata2,
13326
13741
  attributes
13327
13742
  };
13328
13743
  }
@@ -13336,7 +13751,7 @@ var init_draco_parser = __esm({
13336
13751
  const dracoAttributes = {};
13337
13752
  for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
13338
13753
  const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);
13339
- const metadata = this._getAttributeMetadata(dracoGeometry, attributeId);
13754
+ const metadata2 = this._getAttributeMetadata(dracoGeometry, attributeId);
13340
13755
  dracoAttributes[dracoAttribute.unique_id()] = {
13341
13756
  unique_id: dracoAttribute.unique_id(),
13342
13757
  attribute_type: dracoAttribute.attribute_type(),
@@ -13346,7 +13761,7 @@ var init_draco_parser = __esm({
13346
13761
  byte_stride: dracoAttribute.byte_stride(),
13347
13762
  normalized: dracoAttribute.normalized(),
13348
13763
  attribute_index: attributeId,
13349
- metadata
13764
+ metadata: metadata2
13350
13765
  };
13351
13766
  const quantization = this._getQuantizationTransform(dracoAttribute, options);
13352
13767
  if (quantization) {
@@ -13900,11 +14315,11 @@ var init_draco_loader_types2 = __esm({
13900
14315
  // ../scene/src/gltf/lib/gltf-utils/gltf-attribute-utils.ts
13901
14316
  function getGLTFAccessors(attributes) {
13902
14317
  const accessors = {};
13903
- for (const name20 in attributes) {
13904
- const attribute = attributes[name20];
13905
- if (name20 !== "indices") {
14318
+ for (const name22 in attributes) {
14319
+ const attribute = attributes[name22];
14320
+ if (name22 !== "indices") {
13906
14321
  const glTFAccessor = getGLTFAccessor(attribute);
13907
- accessors[name20] = glTFAccessor;
14322
+ accessors[name22] = glTFAccessor;
13908
14323
  }
13909
14324
  }
13910
14325
  return accessors;
@@ -13965,11 +14380,11 @@ var init_gltf_attribute_utils = __esm({
13965
14380
  // ../scene/src/gltf/lib/extensions/KHR_draco_mesh_compression.ts
13966
14381
  var KHR_draco_mesh_compression_exports = {};
13967
14382
  __export(KHR_draco_mesh_compression_exports, {
13968
- decode: () => decode11,
13969
- name: () => name14,
13970
- preprocess: () => preprocess4
14383
+ decode: () => decode12,
14384
+ name: () => name16,
14385
+ preprocess: () => preprocess6
13971
14386
  });
13972
- function preprocess4(gltfData, options, context) {
14387
+ function preprocess6(gltfData, options, context) {
13973
14388
  const iterator = new GLTFIterator(gltfData);
13974
14389
  for (const mesh of iterator.meshes) {
13975
14390
  for (const primitive of iterator.getReferences(mesh).primitives) {
@@ -13978,7 +14393,7 @@ function preprocess4(gltfData, options, context) {
13978
14393
  }
13979
14394
  }
13980
14395
  }
13981
- async function decode11(gltfData, options, context) {
14396
+ async function decode12(gltfData, options, context) {
13982
14397
  var _a;
13983
14398
  if (!((_a = options == null ? void 0 : options.gltf) == null ? void 0 : _a.decompressMeshes)) {
13984
14399
  return;
@@ -14061,7 +14476,7 @@ function checkPrimitive(primitive) {
14061
14476
  throw new Error("glTF: Empty primitive detected: Draco decompression failure?");
14062
14477
  }
14063
14478
  }
14064
- var KHR_DRACO_MESH_COMPRESSION, name14;
14479
+ var KHR_DRACO_MESH_COMPRESSION, name16;
14065
14480
  var init_KHR_draco_mesh_compression = __esm({
14066
14481
  "../scene/src/gltf/lib/extensions/KHR_draco_mesh_compression.ts"() {
14067
14482
  "use strict";
@@ -14071,17 +14486,17 @@ var init_KHR_draco_mesh_compression = __esm({
14071
14486
  init_gltf_attribute_utils();
14072
14487
  init_get_typed_array();
14073
14488
  KHR_DRACO_MESH_COMPRESSION = "KHR_draco_mesh_compression";
14074
- name14 = KHR_DRACO_MESH_COMPRESSION;
14489
+ name16 = KHR_DRACO_MESH_COMPRESSION;
14075
14490
  }
14076
14491
  });
14077
14492
 
14078
14493
  // ../scene/src/gltf/lib/extensions/KHR_texture_transform.ts
14079
14494
  var KHR_texture_transform_exports = {};
14080
14495
  __export(KHR_texture_transform_exports, {
14081
- decode: () => decode12,
14082
- name: () => name15
14496
+ decode: () => decode13,
14497
+ name: () => name17
14083
14498
  });
14084
- async function decode12(gltfData, options) {
14499
+ async function decode13(gltfData, options) {
14085
14500
  var _a;
14086
14501
  const iterator = new GLTFIterator(gltfData);
14087
14502
  const hasExtension = iterator.hasExtension(KHR_TEXTURE_TRANSFORM);
@@ -14302,7 +14717,7 @@ function makeTransformationMatrix(extensionData) {
14302
14717
  const scaleMatrix = scratchScaleMatrix.set(scale[0], 0, 0, 0, scale[1], 0, 0, 0, 1);
14303
14718
  return translationMatrix.multiplyRight(rotationMatrix).multiplyRight(scaleMatrix);
14304
14719
  }
14305
- var import_core3, KHR_TEXTURE_TRANSFORM, name15, scratchVector, scratchRotationMatrix, scratchScaleMatrix;
14720
+ var import_core3, KHR_TEXTURE_TRANSFORM, name17, scratchVector, scratchRotationMatrix, scratchScaleMatrix;
14306
14721
  var init_KHR_texture_transform = __esm({
14307
14722
  "../scene/src/gltf/lib/extensions/KHR_texture_transform.ts"() {
14308
14723
  "use strict";
@@ -14312,7 +14727,7 @@ var init_KHR_texture_transform = __esm({
14312
14727
  init_gltf_iterator();
14313
14728
  init_loader_utils();
14314
14729
  KHR_TEXTURE_TRANSFORM = "KHR_texture_transform";
14315
- name15 = KHR_TEXTURE_TRANSFORM;
14730
+ name17 = KHR_TEXTURE_TRANSFORM;
14316
14731
  scratchVector = new import_core3.Vector3();
14317
14732
  scratchRotationMatrix = new import_core3.Matrix3();
14318
14733
  scratchScaleMatrix = new import_core3.Matrix3();
@@ -14322,11 +14737,11 @@ var init_KHR_texture_transform = __esm({
14322
14737
  // ../scene/src/gltf/lib/extensions/deprecated/KHR_lights_punctual.ts
14323
14738
  var KHR_lights_punctual_exports = {};
14324
14739
  __export(KHR_lights_punctual_exports, {
14325
- decode: () => decode13,
14740
+ decode: () => decode14,
14326
14741
  encode: () => encode3,
14327
- name: () => name16
14742
+ name: () => name18
14328
14743
  });
14329
- async function decode13(gltfData) {
14744
+ async function decode14(gltfData) {
14330
14745
  const iterator = new GLTFIterator(gltfData);
14331
14746
  const extension = iterator.getExtension(KHR_LIGHTS_PUNCTUAL);
14332
14747
  if (extension) {
@@ -14358,7 +14773,7 @@ async function encode3(gltfData) {
14358
14773
  delete gltfScenegraph.json.lights;
14359
14774
  }
14360
14775
  }
14361
- var KHR_LIGHTS_PUNCTUAL, name16;
14776
+ var KHR_LIGHTS_PUNCTUAL, name18;
14362
14777
  var init_KHR_lights_punctual = __esm({
14363
14778
  "../scene/src/gltf/lib/extensions/deprecated/KHR_lights_punctual.ts"() {
14364
14779
  "use strict";
@@ -14366,18 +14781,18 @@ var init_KHR_lights_punctual = __esm({
14366
14781
  init_gltf_iterator();
14367
14782
  init_gltf_scenegraph();
14368
14783
  KHR_LIGHTS_PUNCTUAL = "KHR_lights_punctual";
14369
- name16 = KHR_LIGHTS_PUNCTUAL;
14784
+ name18 = KHR_LIGHTS_PUNCTUAL;
14370
14785
  }
14371
14786
  });
14372
14787
 
14373
14788
  // ../scene/src/gltf/lib/extensions/deprecated/KHR_materials_unlit.ts
14374
14789
  var KHR_materials_unlit_exports = {};
14375
14790
  __export(KHR_materials_unlit_exports, {
14376
- decode: () => decode14,
14791
+ decode: () => decode15,
14377
14792
  encode: () => encode4,
14378
- name: () => name17
14793
+ name: () => name19
14379
14794
  });
14380
- async function decode14(gltfData) {
14795
+ async function decode15(gltfData) {
14381
14796
  const iterator = new GLTFIterator(gltfData);
14382
14797
  for (const material of iterator.materials) {
14383
14798
  const extension = iterator.getExtension(material, KHR_MATERIALS_UNLIT);
@@ -14402,25 +14817,25 @@ function encode4(gltfData) {
14402
14817
  for (const field of ["extensionsUsed", "extensionsRequired"])
14403
14818
  if (((_a = gltfData.json[field]) == null ? void 0 : _a.length) === 0) delete gltfData.json[field];
14404
14819
  }
14405
- var KHR_MATERIALS_UNLIT, name17;
14820
+ var KHR_MATERIALS_UNLIT, name19;
14406
14821
  var init_KHR_materials_unlit = __esm({
14407
14822
  "../scene/src/gltf/lib/extensions/deprecated/KHR_materials_unlit.ts"() {
14408
14823
  "use strict";
14409
14824
  init_gltf_iterator();
14410
14825
  init_gltf_scenegraph();
14411
14826
  KHR_MATERIALS_UNLIT = "KHR_materials_unlit";
14412
- name17 = KHR_MATERIALS_UNLIT;
14827
+ name19 = KHR_MATERIALS_UNLIT;
14413
14828
  }
14414
14829
  });
14415
14830
 
14416
14831
  // ../scene/src/gltf/lib/extensions/deprecated/KHR_techniques_webgl.ts
14417
14832
  var KHR_techniques_webgl_exports = {};
14418
14833
  __export(KHR_techniques_webgl_exports, {
14419
- decode: () => decode15,
14834
+ decode: () => decode16,
14420
14835
  encode: () => encode5,
14421
- name: () => name18
14836
+ name: () => name20
14422
14837
  });
14423
- async function decode15(gltfData) {
14838
+ async function decode16(gltfData) {
14424
14839
  const iterator = new GLTFIterator(gltfData);
14425
14840
  const extension = iterator.getExtension(KHR_TECHNIQUES_WEBGL);
14426
14841
  if (extension) {
@@ -14481,24 +14896,24 @@ function resolveValues(technique, iterator) {
14481
14896
  });
14482
14897
  return values;
14483
14898
  }
14484
- var KHR_TECHNIQUES_WEBGL, name18;
14899
+ var KHR_TECHNIQUES_WEBGL, name20;
14485
14900
  var init_KHR_techniques_webgl = __esm({
14486
14901
  "../scene/src/gltf/lib/extensions/deprecated/KHR_techniques_webgl.ts"() {
14487
14902
  "use strict";
14488
14903
  init_gltf_iterator();
14489
14904
  init_get_typed_array();
14490
14905
  KHR_TECHNIQUES_WEBGL = "KHR_techniques_webgl";
14491
- name18 = KHR_TECHNIQUES_WEBGL;
14906
+ name20 = KHR_TECHNIQUES_WEBGL;
14492
14907
  }
14493
14908
  });
14494
14909
 
14495
14910
  // ../scene/src/gltf/lib/extensions/deprecated/EXT_feature_metadata.ts
14496
14911
  var EXT_feature_metadata_exports = {};
14497
14912
  __export(EXT_feature_metadata_exports, {
14498
- decode: () => decode16,
14499
- name: () => name19
14913
+ decode: () => decode17,
14914
+ name: () => name21
14500
14915
  });
14501
- async function decode16(gltfData, options) {
14916
+ async function decode17(gltfData, options) {
14502
14917
  const iterator = new GLTFIterator(gltfData);
14503
14918
  decodeExtFeatureMetadata(iterator, options);
14504
14919
  }
@@ -14741,14 +15156,14 @@ function processPrimitiveTextures(iterator, attributeName, featureTexturePropert
14741
15156
  primitive
14742
15157
  );
14743
15158
  }
14744
- var EXT_FEATURE_METADATA_NAME, name19;
15159
+ var EXT_FEATURE_METADATA_NAME, name21;
14745
15160
  var init_EXT_feature_metadata = __esm({
14746
15161
  "../scene/src/gltf/lib/extensions/deprecated/EXT_feature_metadata.ts"() {
14747
15162
  "use strict";
14748
15163
  init_gltf_iterator();
14749
15164
  init_d_tiles_utils();
14750
15165
  EXT_FEATURE_METADATA_NAME = "EXT_feature_metadata";
14751
- name19 = EXT_FEATURE_METADATA_NAME;
15166
+ name21 = EXT_FEATURE_METADATA_NAME;
14752
15167
  }
14753
15168
  });
14754
15169
 
@@ -14785,6 +15200,7 @@ var EXTENSIONS, EXTENSIONS_ENCODING;
14785
15200
  var init_gltf_extensions = __esm({
14786
15201
  "../scene/src/gltf/lib/api/gltf-extensions.ts"() {
14787
15202
  "use strict";
15203
+ init_KHR_accessor_float64();
14788
15204
  init_EXT_mesh_features();
14789
15205
  init_EXT_structural_metadata();
14790
15206
  init_KHR_gaussian_splatting();
@@ -14796,6 +15212,7 @@ var init_gltf_extensions = __esm({
14796
15212
  init_KHR_meshopt_compression();
14797
15213
  init_EXT_texture_webp();
14798
15214
  init_EXT_texture_avif();
15215
+ init_MSFT_texture_dds();
14799
15216
  init_KHR_texture_basisu();
14800
15217
  init_KHR_draco_mesh_compression();
14801
15218
  init_KHR_texture_transform();
@@ -14805,6 +15222,7 @@ var init_gltf_extensions = __esm({
14805
15222
  init_KHR_techniques_webgl();
14806
15223
  init_EXT_feature_metadata();
14807
15224
  EXTENSIONS = [
15225
+ KHR_accessor_float64_exports,
14808
15226
  // 1.0
14809
15227
  // KHR_binary_gltf is handled separately - must be processed before other parsing starts
14810
15228
  // KHR_binary_gltf,
@@ -14823,9 +15241,11 @@ var init_gltf_extensions = __esm({
14823
15241
  EXT_mesh_polygon_exports,
14824
15242
  MPEG_audio_spatial_exports,
14825
15243
  KHR_audio_emitter_exports,
14826
- EXT_texture_avif_exports,
14827
15244
  EXT_texture_webp_exports,
14828
- // Basisu should come after webp, we want basisu to be preferred if both are provided
15245
+ EXT_texture_avif_exports,
15246
+ // Compressed textures take precedence over browser image formats when available.
15247
+ MSFT_texture_dds_exports,
15248
+ // BasisU remains preferred when both compressed alternatives are provided.
14829
15249
  KHR_texture_basisu_exports,
14830
15250
  KHR_lights_punctual_exports,
14831
15251
  KHR_materials_unlit_exports,
@@ -14842,7 +15262,7 @@ var init_gltf_extensions = __esm({
14842
15262
  });
14843
15263
 
14844
15264
  // ../scene/src/gltf/lib/extensions/KHR_binary_gltf.ts
14845
- function preprocess5(gltfData) {
15265
+ function preprocess7(gltfData) {
14846
15266
  const iterator = new GLTFIterator(gltfData);
14847
15267
  for (const image of iterator.images) {
14848
15268
  const extension = iterator.getExtension(image, KHR_BINARY_GLTF);
@@ -14984,7 +15404,7 @@ function convertGLTFV1Skins(json2, resolveNodeId, reportUnsupported) {
14984
15404
  for (let skinIndex = 0; skinIndex < originalSkinCount; skinIndex++) {
14985
15405
  const skin = skins[skinIndex];
14986
15406
  const jointNames = skin.jointNames;
14987
- if (!Array.isArray(jointNames) || jointNames.length === 0 || jointNames.some((name20) => typeof name20 !== "string" || !name20) || new Set(jointNames).size !== jointNames.length) {
15407
+ if (!Array.isArray(jointNames) || jointNames.length === 0 || jointNames.some((name22) => typeof name22 !== "string" || !name22) || new Set(jointNames).size !== jointNames.length) {
14988
15408
  reportUnsupported(`skin ${skinIndex} has invalid joint names`);
14989
15409
  hasUnconvertedSkin = true;
14990
15410
  continue;
@@ -15568,7 +15988,7 @@ function hasOpaqueGLTFV1Consumers(json2) {
15568
15988
  for (const [field, value] of Object.entries(object)) {
15569
15989
  if (field === "extras") continue;
15570
15990
  if (field === "extensions" && value && typeof value === "object" && Object.keys(value).some(
15571
- (name20) => !["KHR_materials_unlit", "KHR_materials_common"].includes(name20)
15991
+ (name22) => !["KHR_materials_unlit", "KHR_materials_common"].includes(name22)
15572
15992
  ))
15573
15993
  return true;
15574
15994
  pending.push(value);
@@ -15708,18 +16128,18 @@ function preserveLegacyFields(object, fields) {
15708
16128
  function isRecord(value) {
15709
16129
  return value !== null && typeof value === "object" && !Array.isArray(value);
15710
16130
  }
15711
- function convertGLTFV1AttributeName(name20) {
15712
- const indexed = /^(JOINTS?|WEIGHTS?|TEXCOORD|COLOR)(?:_(\d+))?$/.exec(name20);
16131
+ function convertGLTFV1AttributeName(name22) {
16132
+ const indexed = /^(JOINTS?|WEIGHTS?|TEXCOORD|COLOR)(?:_(\d+))?$/.exec(name22);
15713
16133
  if (indexed) {
15714
16134
  const semantic = indexed[1].startsWith("JOINT") ? "JOINTS" : indexed[1].startsWith("WEIGHT") ? "WEIGHTS" : indexed[1];
15715
16135
  const index = Number(indexed[2] || 0);
15716
16136
  if (!Number.isSafeInteger(index) || index > 999999999)
15717
- throw new Error(`glTF v1: invalid attribute set index ${name20}`);
16137
+ throw new Error(`glTF v1: invalid attribute set index ${name22}`);
15718
16138
  return `${semantic}_${index}`;
15719
16139
  }
15720
- if (["POSITION", "NORMAL", "TANGENT"].includes(name20) || name20.startsWith("_") || name20.includes(":"))
15721
- return name20;
15722
- return `_${name20}`;
16140
+ if (["POSITION", "NORMAL", "TANGENT"].includes(name22) || name22.startsWith("_") || name22.includes(":"))
16141
+ return name22;
16142
+ return `_${name22}`;
15723
16143
  }
15724
16144
  var init_clean_gltf_v1_fields = __esm({
15725
16145
  "../scene/src/gltf/lib/api/clean-gltf-v1-fields.ts"() {
@@ -16145,8 +16565,8 @@ function validateSkinInfluences(gltf, readAccessor, reportUnsupported) {
16145
16565
  checkedBindings.add(binding);
16146
16566
  for (const [primitiveIndex, primitive] of mesh.primitives.entries()) {
16147
16567
  const label = `mesh ${node.mesh} primitive ${primitiveIndex} skin ${node.skin}`;
16148
- const jointSets = Object.keys(primitive.attributes).filter((name20) => /^JOINTS_\d+$/.test(name20)).map((name20) => Number(name20.slice(7))).sort((first, second) => first - second);
16149
- const weightSets = Object.keys(primitive.attributes).filter((name20) => /^WEIGHTS_\d+$/.test(name20)).map((name20) => Number(name20.slice(8))).sort((first, second) => first - second);
16568
+ const jointSets = Object.keys(primitive.attributes).filter((name22) => /^JOINTS_\d+$/.test(name22)).map((name22) => Number(name22.slice(7))).sort((first, second) => first - second);
16569
+ const weightSets = Object.keys(primitive.attributes).filter((name22) => /^WEIGHTS_\d+$/.test(name22)).map((name22) => Number(name22.slice(8))).sort((first, second) => first - second);
16150
16570
  if (!jointSets.length && !weightSets.length) {
16151
16571
  reportUnsupported(`${label} requires JOINTS_0 and WEIGHTS_0 skin influences`);
16152
16572
  continue;
@@ -16597,7 +17017,7 @@ function collectExtensionNames(value) {
16597
17017
  if (!object || typeof object !== "object" || visited.has(object)) continue;
16598
17018
  visited.add(object);
16599
17019
  if (isRecord2(object) && isRecord2(object.extensions))
16600
- for (const name20 of Object.keys(object.extensions)) names.add(name20);
17020
+ for (const name22 of Object.keys(object.extensions)) names.add(name22);
16601
17021
  for (const [field, child] of Object.entries(object))
16602
17022
  if (field !== "extras") pending.push(child);
16603
17023
  }
@@ -16755,7 +17175,7 @@ var init_normalize_gltf_v1 = __esm({
16755
17175
  this._addAsset(json2);
16756
17176
  this._orderBinaryBufferPayloads(gltf);
16757
17177
  this._convertTopLevelObjectsToArrays(json2);
16758
- preprocess5(gltf);
17178
+ preprocess7(gltf);
16759
17179
  this._convertObjectIdsToArrayIndices(json2);
16760
17180
  this._updateObjects(json2);
16761
17181
  for (const [bufferIndex, buffer] of (json2.buffers || []).entries())
@@ -17344,6 +17764,7 @@ function getReferencesImageIndices(gltf) {
17344
17764
  return Array.from(imageIndices).sort();
17345
17765
  }
17346
17766
  async function loadImage(gltf, image, index, options, context) {
17767
+ var _a, _b, _c;
17347
17768
  let arrayBuffer;
17348
17769
  if (image.uri && !image.hasOwnProperty("bufferView")) {
17349
17770
  const uri = resolveUrl(image.uri, options, context);
@@ -17360,6 +17781,33 @@ async function loadImage(gltf, image, index, options, context) {
17360
17781
  }
17361
17782
  assert3(arrayBuffer, "glTF image has no data");
17362
17783
  const gltfOptions = getGLTFImageOptions(options, image.mimeType);
17784
+ const ddsLoader = getDDSLoader(context);
17785
+ const ddsSelected = Boolean(
17786
+ ddsLoader && !((_b = (_a = options.gltf) == null ? void 0 : _a.excludeExtensions) == null ? void 0 : _b.includes("MSFT_texture_dds")) && ((_c = gltf.json.textures) == null ? void 0 : _c.some(
17787
+ (texture) => {
17788
+ var _a2, _b2;
17789
+ return texture.source === index && ((_b2 = (_a2 = texture.extensions) == null ? void 0 : _a2.MSFT_texture_dds) == null ? void 0 : _b2.source) === index;
17790
+ }
17791
+ ))
17792
+ );
17793
+ if (ddsSelected) {
17794
+ const levels = await parseFromContext(
17795
+ arrayBuffer,
17796
+ ddsLoader,
17797
+ options,
17798
+ context
17799
+ );
17800
+ assert3(levels.length > 0, "MSFT_texture_dds parser returned no texture levels");
17801
+ gltf.images = gltf.images || [];
17802
+ gltf.images[index] = {
17803
+ compressed: true,
17804
+ mipmaps: true,
17805
+ width: levels[0].width,
17806
+ height: levels[0].height,
17807
+ data: levels
17808
+ };
17809
+ return;
17810
+ }
17363
17811
  let parsedImage = await parseFromContext(
17364
17812
  arrayBuffer,
17365
17813
  [ImageLoader, BasisLoader],
@@ -17392,6 +17840,7 @@ var init_parse_gltf = __esm({
17392
17840
  init_resolve_gltf_file();
17393
17841
  init_get_typed_array();
17394
17842
  init_gltf_extensions();
17843
+ init_MSFT_texture_dds();
17395
17844
  init_normalize_gltf_v1();
17396
17845
  PACKAGE_URL_PREFIX = "gltf-package://";
17397
17846
  }
@@ -17673,9 +18122,9 @@ function validateExplicitQuantization(attributeName, componentCount, quantizatio
17673
18122
  }
17674
18123
  }
17675
18124
  function getDracoAttributeTypeName(draco, attributeType) {
17676
- for (const name20 of ["POSITION", "NORMAL", "COLOR", "TEX_COORD", "GENERIC"]) {
17677
- if (draco[name20] === attributeType) {
17678
- return name20;
18125
+ for (const name22 of ["POSITION", "NORMAL", "COLOR", "TEX_COORD", "GENERIC"]) {
18126
+ if (draco[name22] === attributeType) {
18127
+ return name22;
17679
18128
  }
17680
18129
  }
17681
18130
  return "GENERIC";
@@ -18200,9 +18649,9 @@ var init_draco_builder = __esm({
18200
18649
  * @param dracoGeometry - WASM Draco Object
18201
18650
  * @param metadata
18202
18651
  */
18203
- _addGeometryMetadata(dracoGeometry, metadata) {
18652
+ _addGeometryMetadata(dracoGeometry, metadata2) {
18204
18653
  const dracoMetadata = new this.draco.Metadata();
18205
- this._populateDracoMetadata(dracoMetadata, metadata);
18654
+ this._populateDracoMetadata(dracoMetadata, metadata2);
18206
18655
  this.dracoMeshBuilder.AddMetadata(dracoGeometry, dracoMetadata);
18207
18656
  }
18208
18657
  /**
@@ -18211,9 +18660,9 @@ var init_draco_builder = __esm({
18211
18660
  * @param uniqueAttributeId
18212
18661
  * @param metadata
18213
18662
  */
18214
- _addAttributeMetadata(dracoGeometry, uniqueAttributeId, metadata) {
18663
+ _addAttributeMetadata(dracoGeometry, uniqueAttributeId, metadata2) {
18215
18664
  const dracoAttributeMetadata = new this.draco.Metadata();
18216
- this._populateDracoMetadata(dracoAttributeMetadata, metadata);
18665
+ this._populateDracoMetadata(dracoAttributeMetadata, metadata2);
18217
18666
  this.dracoMeshBuilder.SetMetadataForAttribute(
18218
18667
  dracoGeometry,
18219
18668
  uniqueAttributeId,
@@ -18225,8 +18674,8 @@ var init_draco_builder = __esm({
18225
18674
  * @param dracoMetadata - WASM Draco Object
18226
18675
  * @param metadata
18227
18676
  */
18228
- _populateDracoMetadata(dracoMetadata, metadata) {
18229
- for (const [key, value] of getEntries(metadata)) {
18677
+ _populateDracoMetadata(dracoMetadata, metadata2) {
18678
+ for (const [key, value] of getEntries(metadata2)) {
18230
18679
  switch (typeof value) {
18231
18680
  case "number":
18232
18681
  if (Math.trunc(value) === value) {
@@ -18279,7 +18728,7 @@ function encodeDracoInBatches(data, options = {}) {
18279
18728
  const normalizedData = normalizeDracoInputBatches(data);
18280
18729
  if (canEncodeWithWorker(DracoWriterWorker, options)) {
18281
18730
  const { onProgress: _onProgress, ...workerOptions } = options;
18282
- return (0, import_tasks2.processOnWorkerInBatches)(
18731
+ return processOnWorkerInBatches(
18283
18732
  DracoWriterWorker,
18284
18733
  normalizedData,
18285
18734
  workerOptions
@@ -18722,6 +19171,1724 @@ var init_glb_writer = __esm({
18722
19171
  }
18723
19172
  });
18724
19173
 
19174
+ // ../documents/src/lib/xml-utils/uncapitalize.ts
19175
+ function uncapitalize(str) {
19176
+ return typeof str === "string" ? str.charAt(0).toLowerCase() + str.slice(1) : str;
19177
+ }
19178
+ function uncapitalizeKeys(object) {
19179
+ if (Array.isArray(object)) {
19180
+ return object.map((element) => uncapitalizeKeys(element));
19181
+ }
19182
+ if (object && typeof object === "object") {
19183
+ const newObject = {};
19184
+ for (const [key, value] of Object.entries(object)) {
19185
+ Object.defineProperty(newObject, uncapitalize(key), {
19186
+ value: uncapitalizeKeys(value),
19187
+ enumerable: true,
19188
+ configurable: true,
19189
+ writable: true
19190
+ });
19191
+ }
19192
+ return newObject;
19193
+ }
19194
+ return object;
19195
+ }
19196
+ var init_uncapitalize = __esm({
19197
+ "../documents/src/lib/xml-utils/uncapitalize.ts"() {
19198
+ "use strict";
19199
+ }
19200
+ });
19201
+
19202
+ // ../documents/src/sax-ts/sax.ts
19203
+ var DEFAULT_SAX_EVENTS, DEFAULT_SAX_PARSER_OPTIONS, EVENTS, BUFFERS, nameStart, nameBody, entityStart, entityBody, ENTITIES, SAX, SAXParser;
19204
+ var init_sax = __esm({
19205
+ "../documents/src/sax-ts/sax.ts"() {
19206
+ "use strict";
19207
+ DEFAULT_SAX_EVENTS = {
19208
+ ontext: () => {
19209
+ },
19210
+ onprocessinginstruction: () => {
19211
+ },
19212
+ onsgmldeclaration: () => {
19213
+ },
19214
+ ondoctype: () => {
19215
+ },
19216
+ oncomment: () => {
19217
+ },
19218
+ onopentagstart: () => {
19219
+ },
19220
+ onattribute: () => {
19221
+ },
19222
+ onopentag: () => {
19223
+ },
19224
+ onclosetag: () => {
19225
+ },
19226
+ onopencdata: () => {
19227
+ },
19228
+ oncdata: () => {
19229
+ },
19230
+ onclosecdata: () => {
19231
+ },
19232
+ onerror: () => {
19233
+ },
19234
+ onend: () => {
19235
+ },
19236
+ onready: () => {
19237
+ },
19238
+ onscript: () => {
19239
+ },
19240
+ onopennamespace: () => {
19241
+ },
19242
+ onclosenamespace: () => {
19243
+ }
19244
+ };
19245
+ DEFAULT_SAX_PARSER_OPTIONS = {
19246
+ ...DEFAULT_SAX_EVENTS,
19247
+ strict: false,
19248
+ MAX_BUFFER_LENGTH: 64 * 1024,
19249
+ lowercase: false,
19250
+ lowercasetags: false,
19251
+ noscript: false,
19252
+ strictEntities: false,
19253
+ preserveCase: false,
19254
+ caseInsensitiveTags: false,
19255
+ processEntities: true,
19256
+ xmlns: void 0,
19257
+ position: void 0,
19258
+ trim: void 0,
19259
+ normalize: void 0
19260
+ };
19261
+ EVENTS = [
19262
+ "text",
19263
+ "processinginstruction",
19264
+ "sgmldeclaration",
19265
+ "doctype",
19266
+ "comment",
19267
+ "opentagstart",
19268
+ "attribute",
19269
+ "opentag",
19270
+ "closetag",
19271
+ "opencdata",
19272
+ "cdata",
19273
+ "closecdata",
19274
+ "error",
19275
+ "end",
19276
+ "ready",
19277
+ "script",
19278
+ "opennamespace",
19279
+ "closenamespace"
19280
+ ];
19281
+ BUFFERS = [
19282
+ "comment",
19283
+ "sgmlDecl",
19284
+ "textNode",
19285
+ "tagName",
19286
+ "doctype",
19287
+ "procInstName",
19288
+ "procInstBody",
19289
+ "entity",
19290
+ "attribName",
19291
+ "attribValue",
19292
+ "cdata",
19293
+ "script"
19294
+ ];
19295
+ nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
19296
+ nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
19297
+ entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
19298
+ entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
19299
+ ENTITIES = {
19300
+ amp: "&",
19301
+ gt: ">",
19302
+ lt: "<",
19303
+ quot: '"',
19304
+ apos: "'",
19305
+ AElig: 198,
19306
+ Aacute: 193,
19307
+ Acirc: 194,
19308
+ Agrave: 192,
19309
+ Aring: 197,
19310
+ Atilde: 195,
19311
+ Auml: 196,
19312
+ Ccedil: 199,
19313
+ ETH: 208,
19314
+ Eacute: 201,
19315
+ Ecirc: 202,
19316
+ Egrave: 200,
19317
+ Euml: 203,
19318
+ Iacute: 205,
19319
+ Icirc: 206,
19320
+ Igrave: 204,
19321
+ Iuml: 207,
19322
+ Ntilde: 209,
19323
+ Oacute: 211,
19324
+ Ocirc: 212,
19325
+ Ograve: 210,
19326
+ Oslash: 216,
19327
+ Otilde: 213,
19328
+ Ouml: 214,
19329
+ THORN: 222,
19330
+ Uacute: 218,
19331
+ Ucirc: 219,
19332
+ Ugrave: 217,
19333
+ Uuml: 220,
19334
+ Yacute: 221,
19335
+ aacute: 225,
19336
+ acirc: 226,
19337
+ aelig: 230,
19338
+ agrave: 224,
19339
+ aring: 229,
19340
+ atilde: 227,
19341
+ auml: 228,
19342
+ ccedil: 231,
19343
+ eacute: 233,
19344
+ ecirc: 234,
19345
+ egrave: 232,
19346
+ eth: 240,
19347
+ euml: 235,
19348
+ iacute: 237,
19349
+ icirc: 238,
19350
+ igrave: 236,
19351
+ iuml: 239,
19352
+ ntilde: 241,
19353
+ oacute: 243,
19354
+ ocirc: 244,
19355
+ ograve: 242,
19356
+ oslash: 248,
19357
+ otilde: 245,
19358
+ ouml: 246,
19359
+ szlig: 223,
19360
+ thorn: 254,
19361
+ uacute: 250,
19362
+ ucirc: 251,
19363
+ ugrave: 249,
19364
+ uuml: 252,
19365
+ yacute: 253,
19366
+ yuml: 255,
19367
+ copy: 169,
19368
+ reg: 174,
19369
+ nbsp: 160,
19370
+ iexcl: 161,
19371
+ cent: 162,
19372
+ pound: 163,
19373
+ curren: 164,
19374
+ yen: 165,
19375
+ brvbar: 166,
19376
+ sect: 167,
19377
+ uml: 168,
19378
+ ordf: 170,
19379
+ laquo: 171,
19380
+ not: 172,
19381
+ shy: 173,
19382
+ macr: 175,
19383
+ deg: 176,
19384
+ plusmn: 177,
19385
+ sup1: 185,
19386
+ sup2: 178,
19387
+ sup3: 179,
19388
+ acute: 180,
19389
+ micro: 181,
19390
+ para: 182,
19391
+ middot: 183,
19392
+ cedil: 184,
19393
+ ordm: 186,
19394
+ raquo: 187,
19395
+ frac14: 188,
19396
+ frac12: 189,
19397
+ frac34: 190,
19398
+ iquest: 191,
19399
+ times: 215,
19400
+ divide: 247,
19401
+ OElig: 338,
19402
+ oelig: 339,
19403
+ Scaron: 352,
19404
+ scaron: 353,
19405
+ Yuml: 376,
19406
+ fnof: 402,
19407
+ circ: 710,
19408
+ tilde: 732,
19409
+ Alpha: 913,
19410
+ Beta: 914,
19411
+ Gamma: 915,
19412
+ Delta: 916,
19413
+ Epsilon: 917,
19414
+ Zeta: 918,
19415
+ Eta: 919,
19416
+ Theta: 920,
19417
+ Iota: 921,
19418
+ Kappa: 922,
19419
+ Lambda: 923,
19420
+ Mu: 924,
19421
+ Nu: 925,
19422
+ Xi: 926,
19423
+ Omicron: 927,
19424
+ Pi: 928,
19425
+ Rho: 929,
19426
+ Sigma: 931,
19427
+ Tau: 932,
19428
+ Upsilon: 933,
19429
+ Phi: 934,
19430
+ Chi: 935,
19431
+ Psi: 936,
19432
+ Omega: 937,
19433
+ alpha: 945,
19434
+ beta: 946,
19435
+ gamma: 947,
19436
+ delta: 948,
19437
+ epsilon: 949,
19438
+ zeta: 950,
19439
+ eta: 951,
19440
+ theta: 952,
19441
+ iota: 953,
19442
+ kappa: 954,
19443
+ lambda: 955,
19444
+ mu: 956,
19445
+ nu: 957,
19446
+ xi: 958,
19447
+ omicron: 959,
19448
+ pi: 960,
19449
+ rho: 961,
19450
+ sigmaf: 962,
19451
+ sigma: 963,
19452
+ tau: 964,
19453
+ upsilon: 965,
19454
+ phi: 966,
19455
+ chi: 967,
19456
+ psi: 968,
19457
+ omega: 969,
19458
+ thetasym: 977,
19459
+ upsih: 978,
19460
+ piv: 982,
19461
+ ensp: 8194,
19462
+ emsp: 8195,
19463
+ thinsp: 8201,
19464
+ zwnj: 8204,
19465
+ zwj: 8205,
19466
+ lrm: 8206,
19467
+ rlm: 8207,
19468
+ ndash: 8211,
19469
+ mdash: 8212,
19470
+ lsquo: 8216,
19471
+ rsquo: 8217,
19472
+ sbquo: 8218,
19473
+ ldquo: 8220,
19474
+ rdquo: 8221,
19475
+ bdquo: 8222,
19476
+ dagger: 8224,
19477
+ Dagger: 8225,
19478
+ bull: 8226,
19479
+ hellip: 8230,
19480
+ permil: 8240,
19481
+ prime: 8242,
19482
+ Prime: 8243,
19483
+ lsaquo: 8249,
19484
+ rsaquo: 8250,
19485
+ oline: 8254,
19486
+ frasl: 8260,
19487
+ euro: 8364,
19488
+ image: 8465,
19489
+ weierp: 8472,
19490
+ real: 8476,
19491
+ trade: 8482,
19492
+ alefsym: 8501,
19493
+ larr: 8592,
19494
+ uarr: 8593,
19495
+ rarr: 8594,
19496
+ darr: 8595,
19497
+ harr: 8596,
19498
+ crarr: 8629,
19499
+ lArr: 8656,
19500
+ uArr: 8657,
19501
+ rArr: 8658,
19502
+ dArr: 8659,
19503
+ hArr: 8660,
19504
+ forall: 8704,
19505
+ part: 8706,
19506
+ exist: 8707,
19507
+ empty: 8709,
19508
+ nabla: 8711,
19509
+ isin: 8712,
19510
+ notin: 8713,
19511
+ ni: 8715,
19512
+ prod: 8719,
19513
+ sum: 8721,
19514
+ minus: 8722,
19515
+ lowast: 8727,
19516
+ radic: 8730,
19517
+ prop: 8733,
19518
+ infin: 8734,
19519
+ ang: 8736,
19520
+ and: 8743,
19521
+ or: 8744,
19522
+ cap: 8745,
19523
+ cup: 8746,
19524
+ int: 8747,
19525
+ there4: 8756,
19526
+ sim: 8764,
19527
+ cong: 8773,
19528
+ asymp: 8776,
19529
+ ne: 8800,
19530
+ equiv: 8801,
19531
+ le: 8804,
19532
+ ge: 8805,
19533
+ sub: 8834,
19534
+ sup: 8835,
19535
+ nsub: 8836,
19536
+ sube: 8838,
19537
+ supe: 8839,
19538
+ oplus: 8853,
19539
+ otimes: 8855,
19540
+ perp: 8869,
19541
+ sdot: 8901,
19542
+ lceil: 8968,
19543
+ rceil: 8969,
19544
+ lfloor: 8970,
19545
+ rfloor: 8971,
19546
+ lang: 9001,
19547
+ rang: 9002,
19548
+ loz: 9674,
19549
+ spades: 9824,
19550
+ clubs: 9827,
19551
+ hearts: 9829,
19552
+ diams: 9830
19553
+ };
19554
+ Object.keys(ENTITIES).forEach((key) => {
19555
+ const e = ENTITIES[key];
19556
+ ENTITIES[key] = typeof e === "number" ? String.fromCharCode(e) : e;
19557
+ });
19558
+ SAX = class _SAX {
19559
+ EVENTS = EVENTS;
19560
+ ENTITIES = {
19561
+ // TODO: make it readonly, needed for entity-mega test
19562
+ // amp, gt, lt, quot and apos are resolved to strings instead of numerical
19563
+ // codes, IDK why
19564
+ ...ENTITIES
19565
+ };
19566
+ XML_ENTITIES = {
19567
+ amp: "&",
19568
+ gt: ">",
19569
+ lt: "<",
19570
+ quot: '"',
19571
+ apos: "'"
19572
+ };
19573
+ S = 0;
19574
+ opt;
19575
+ trackPosition = false;
19576
+ column = 0;
19577
+ line = 0;
19578
+ c = "";
19579
+ error;
19580
+ q = "";
19581
+ bufferCheckPosition;
19582
+ closed = false;
19583
+ tags = [];
19584
+ looseCase = "";
19585
+ closedRoot = false;
19586
+ sawRoot = false;
19587
+ strict = false;
19588
+ tag;
19589
+ strictEntities;
19590
+ state;
19591
+ noscript = false;
19592
+ attribList = [];
19593
+ ns;
19594
+ position = 0;
19595
+ STATE = {
19596
+ BEGIN: this.S++,
19597
+ // leading byte order mark or whitespace
19598
+ BEGIN_WHITESPACE: this.S++,
19599
+ // leading whitespace
19600
+ TEXT: this.S++,
19601
+ // general stuff
19602
+ TEXT_ENTITY: this.S++,
19603
+ // &amp and such.
19604
+ OPEN_WAKA: this.S++,
19605
+ // <
19606
+ SGML_DECL: this.S++,
19607
+ // <!BLARG
19608
+ SGML_DECL_QUOTED: this.S++,
19609
+ // <!BLARG foo "bar
19610
+ DOCTYPE: this.S++,
19611
+ // <!DOCTYPE
19612
+ DOCTYPE_QUOTED: this.S++,
19613
+ // <!DOCTYPE "//blah
19614
+ DOCTYPE_DTD: this.S++,
19615
+ // <!DOCTYPE "//blah" [ ...
19616
+ DOCTYPE_DTD_QUOTED: this.S++,
19617
+ // <!DOCTYPE "//blah" [ "foo
19618
+ COMMENT_STARTING: this.S++,
19619
+ // <!-
19620
+ COMMENT: this.S++,
19621
+ // <!--
19622
+ COMMENT_ENDING: this.S++,
19623
+ // <!-- blah -
19624
+ COMMENT_ENDED: this.S++,
19625
+ // <!-- blah --
19626
+ CDATA: this.S++,
19627
+ // <![CDATA[ something
19628
+ CDATA_ENDING: this.S++,
19629
+ // ]
19630
+ CDATA_ENDING_2: this.S++,
19631
+ // ]]
19632
+ PROC_INST: this.S++,
19633
+ // <?hi
19634
+ PROC_INST_BODY: this.S++,
19635
+ // <?hi there
19636
+ PROC_INST_ENDING: this.S++,
19637
+ // <?hi "there" ?
19638
+ OPEN_TAG: this.S++,
19639
+ // <strong
19640
+ OPEN_TAG_SLASH: this.S++,
19641
+ // <strong /
19642
+ ATTRIB: this.S++,
19643
+ // <a
19644
+ ATTRIB_NAME: this.S++,
19645
+ // <a foo
19646
+ ATTRIB_NAME_SAW_WHITE: this.S++,
19647
+ // <a foo _
19648
+ ATTRIB_VALUE: this.S++,
19649
+ // <a foo=
19650
+ ATTRIB_VALUE_QUOTED: this.S++,
19651
+ // <a foo="bar
19652
+ ATTRIB_VALUE_CLOSED: this.S++,
19653
+ // <a foo="bar"
19654
+ ATTRIB_VALUE_UNQUOTED: this.S++,
19655
+ // <a foo=bar
19656
+ ATTRIB_VALUE_ENTITY_Q: this.S++,
19657
+ // <foo bar="&quot;"
19658
+ ATTRIB_VALUE_ENTITY_U: this.S++,
19659
+ // <foo bar=&quot
19660
+ CLOSE_TAG: this.S++,
19661
+ // </a
19662
+ CLOSE_TAG_SAW_WHITE: this.S++,
19663
+ // </a >
19664
+ SCRIPT: this.S++,
19665
+ // <script> ...
19666
+ SCRIPT_ENDING: this.S++
19667
+ // <script> ... <
19668
+ };
19669
+ BUFFERS = BUFFERS;
19670
+ // private parser: (strict: boolean, opt: any) => SAXParser;
19671
+ CDATA = "[CDATA[";
19672
+ DOCTYPE = "DOCTYPE";
19673
+ XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
19674
+ XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
19675
+ rootNS = {
19676
+ xml: this.XML_NAMESPACE,
19677
+ xmlns: this.XMLNS_NAMESPACE
19678
+ };
19679
+ comment;
19680
+ sgmlDecl;
19681
+ textNode = "";
19682
+ tagName;
19683
+ doctype;
19684
+ procInstName;
19685
+ procInstBody;
19686
+ entity = "";
19687
+ attribName;
19688
+ attribValue;
19689
+ cdata = "";
19690
+ script = "";
19691
+ startTagPosition = 0;
19692
+ constructor() {
19693
+ this.S = 0;
19694
+ for (const s in this.STATE) {
19695
+ if (this.STATE.hasOwnProperty(s)) {
19696
+ this.STATE[this.STATE[s]] = s;
19697
+ }
19698
+ }
19699
+ this.S = this.STATE;
19700
+ }
19701
+ static charAt(chunk, i) {
19702
+ let result = "";
19703
+ if (i < chunk.length) {
19704
+ result = chunk.charAt(i);
19705
+ }
19706
+ return result;
19707
+ }
19708
+ static isWhitespace(c) {
19709
+ return c === " " || c === "\n" || c === "\r" || c === " ";
19710
+ }
19711
+ static isQuote(c) {
19712
+ return c === '"' || c === "'";
19713
+ }
19714
+ static isAttribEnd(c) {
19715
+ return c === ">" || _SAX.isWhitespace(c);
19716
+ }
19717
+ static isMatch(regex, c) {
19718
+ return regex.test(c);
19719
+ }
19720
+ static notMatch(regex, c) {
19721
+ return !_SAX.isMatch(regex, c);
19722
+ }
19723
+ static qname(name22, attribute) {
19724
+ const i = name22.indexOf(":");
19725
+ const qualName = i < 0 ? ["", name22] : name22.split(":");
19726
+ let prefix = qualName[0];
19727
+ let local = qualName[1];
19728
+ if (attribute && name22 === "xmlns") {
19729
+ prefix = "xmlns";
19730
+ local = "";
19731
+ }
19732
+ return { prefix, local };
19733
+ }
19734
+ write(chunk) {
19735
+ if (this.error) {
19736
+ throw this.error;
19737
+ }
19738
+ if (this.closed) {
19739
+ return this.errorFunction("Cannot write after close. Assign an onready handler.");
19740
+ }
19741
+ if (chunk === null) {
19742
+ return this.end();
19743
+ }
19744
+ if (typeof chunk === "object") {
19745
+ chunk = chunk.toString();
19746
+ }
19747
+ let i = 0;
19748
+ let c;
19749
+ while (true) {
19750
+ c = _SAX.charAt(chunk, i++);
19751
+ this.c = c;
19752
+ if (!c) {
19753
+ break;
19754
+ }
19755
+ if (this.trackPosition) {
19756
+ this.position++;
19757
+ if (c === "\n") {
19758
+ this.line++;
19759
+ this.column = 0;
19760
+ } else {
19761
+ this.column++;
19762
+ }
19763
+ }
19764
+ switch (this.state) {
19765
+ case this.S.BEGIN:
19766
+ this.state = this.S.BEGIN_WHITESPACE;
19767
+ if (c === "\uFEFF") {
19768
+ continue;
19769
+ }
19770
+ this.beginWhiteSpace(c);
19771
+ continue;
19772
+ case this.S.BEGIN_WHITESPACE:
19773
+ this.beginWhiteSpace(c);
19774
+ continue;
19775
+ case this.S.TEXT:
19776
+ if (this.sawRoot && !this.closedRoot) {
19777
+ const starti = i - 1;
19778
+ while (c && c !== "<" && c !== "&") {
19779
+ c = _SAX.charAt(chunk, i++);
19780
+ if (c && this.trackPosition) {
19781
+ this.position++;
19782
+ if (c === "\n") {
19783
+ this.line++;
19784
+ this.column = 0;
19785
+ } else {
19786
+ this.column++;
19787
+ }
19788
+ }
19789
+ }
19790
+ this.textNode += chunk.substring(starti, i - 1);
19791
+ }
19792
+ if (c === "<" && !(this.sawRoot && this.closedRoot && !this.strict)) {
19793
+ this.state = this.S.OPEN_WAKA;
19794
+ this.startTagPosition = this.position;
19795
+ } else {
19796
+ if (!_SAX.isWhitespace(c) && (!this.sawRoot || this.closedRoot)) {
19797
+ this.strictFail("Text data outside of root node.");
19798
+ }
19799
+ if (c === "&") {
19800
+ this.state = this.S.TEXT_ENTITY;
19801
+ } else {
19802
+ this.textNode += c;
19803
+ }
19804
+ }
19805
+ continue;
19806
+ case this.S.SCRIPT:
19807
+ if (c === "<") {
19808
+ this.state = this.S.SCRIPT_ENDING;
19809
+ } else {
19810
+ this.script += c;
19811
+ }
19812
+ continue;
19813
+ case this.S.SCRIPT_ENDING:
19814
+ if (c === "/") {
19815
+ this.state = this.S.CLOSE_TAG;
19816
+ } else {
19817
+ this.script += `<${c}`;
19818
+ this.state = this.S.SCRIPT;
19819
+ }
19820
+ continue;
19821
+ case this.S.OPEN_WAKA:
19822
+ if (c === "!") {
19823
+ this.state = this.S.SGML_DECL;
19824
+ this.sgmlDecl = "";
19825
+ } else if (_SAX.isWhitespace(c)) {
19826
+ } else if (_SAX.isMatch(nameStart, c)) {
19827
+ this.state = this.S.OPEN_TAG;
19828
+ this.tagName = c;
19829
+ } else if (c === "/") {
19830
+ this.state = this.S.CLOSE_TAG;
19831
+ this.tagName = "";
19832
+ } else if (c === "?") {
19833
+ this.state = this.S.PROC_INST;
19834
+ this.procInstName = this.procInstBody = "";
19835
+ } else {
19836
+ this.strictFail("Unencoded <");
19837
+ if (this.startTagPosition + 1 < this.position) {
19838
+ const pad = this.position - this.startTagPosition;
19839
+ c = new Array(pad).join(" ") + c;
19840
+ }
19841
+ this.textNode += `<${c}`;
19842
+ this.state = this.S.TEXT;
19843
+ }
19844
+ continue;
19845
+ case this.S.SGML_DECL:
19846
+ if ((this.sgmlDecl + c).toUpperCase() === this.CDATA) {
19847
+ this.emitNode("onopencdata");
19848
+ this.state = this.S.CDATA;
19849
+ this.sgmlDecl = "";
19850
+ this.cdata = "";
19851
+ } else if (this.sgmlDecl + c === "--") {
19852
+ this.state = this.S.COMMENT;
19853
+ this.comment = "";
19854
+ this.sgmlDecl = "";
19855
+ } else if ((this.sgmlDecl + c).toUpperCase() === this.DOCTYPE) {
19856
+ this.state = this.S.DOCTYPE;
19857
+ if (this.doctype || this.sawRoot) {
19858
+ this.strictFail("Inappropriately located doctype declaration");
19859
+ }
19860
+ this.doctype = "";
19861
+ this.sgmlDecl = "";
19862
+ } else if (c === ">") {
19863
+ this.emitNode("onsgmldeclaration", this.sgmlDecl);
19864
+ this.sgmlDecl = "";
19865
+ this.state = this.S.TEXT;
19866
+ } else if (_SAX.isQuote(c)) {
19867
+ this.state = this.S.SGML_DECL_QUOTED;
19868
+ this.sgmlDecl += c;
19869
+ } else {
19870
+ this.sgmlDecl += c;
19871
+ }
19872
+ continue;
19873
+ case this.S.SGML_DECL_QUOTED:
19874
+ if (c === this.q) {
19875
+ this.state = this.S.SGML_DECL;
19876
+ this.q = "";
19877
+ }
19878
+ this.sgmlDecl += c;
19879
+ continue;
19880
+ case this.S.DOCTYPE:
19881
+ if (c === ">") {
19882
+ this.state = this.S.TEXT;
19883
+ this.emitNode("ondoctype", this.doctype);
19884
+ this.doctype = true;
19885
+ } else {
19886
+ this.doctype += c;
19887
+ if (c === "[") {
19888
+ this.state = this.S.DOCTYPE_DTD;
19889
+ } else if (_SAX.isQuote(c)) {
19890
+ this.state = this.S.DOCTYPE_QUOTED;
19891
+ this.q = c;
19892
+ }
19893
+ }
19894
+ continue;
19895
+ case this.S.DOCTYPE_QUOTED:
19896
+ this.doctype += c;
19897
+ if (c === this.q) {
19898
+ this.q = "";
19899
+ this.state = this.S.DOCTYPE;
19900
+ }
19901
+ continue;
19902
+ case this.S.DOCTYPE_DTD:
19903
+ this.doctype += c;
19904
+ if (c === "]") {
19905
+ this.state = this.S.DOCTYPE;
19906
+ } else if (_SAX.isQuote(c)) {
19907
+ this.state = this.S.DOCTYPE_DTD_QUOTED;
19908
+ this.q = c;
19909
+ }
19910
+ continue;
19911
+ case this.S.DOCTYPE_DTD_QUOTED:
19912
+ this.doctype += c;
19913
+ if (c === this.q) {
19914
+ this.state = this.S.DOCTYPE_DTD;
19915
+ this.q = "";
19916
+ }
19917
+ continue;
19918
+ case this.S.COMMENT:
19919
+ if (c === "-") {
19920
+ this.state = this.S.COMMENT_ENDING;
19921
+ } else {
19922
+ this.comment += c;
19923
+ }
19924
+ continue;
19925
+ case this.S.COMMENT_ENDING:
19926
+ if (c === "-") {
19927
+ this.state = this.S.COMMENT_ENDED;
19928
+ this.comment = this.textApplyOptions(this.comment);
19929
+ if (this.comment) {
19930
+ this.emitNode("oncomment", this.comment);
19931
+ }
19932
+ this.comment = "";
19933
+ } else {
19934
+ this.comment += `-${c}`;
19935
+ this.state = this.S.COMMENT;
19936
+ }
19937
+ continue;
19938
+ case this.S.COMMENT_ENDED:
19939
+ if (c !== ">") {
19940
+ this.strictFail("Malformed comment");
19941
+ this.comment += `--${c}`;
19942
+ this.state = this.S.COMMENT;
19943
+ } else {
19944
+ this.state = this.S.TEXT;
19945
+ }
19946
+ continue;
19947
+ case this.S.CDATA:
19948
+ if (c === "]") {
19949
+ this.state = this.S.CDATA_ENDING;
19950
+ } else {
19951
+ this.cdata += c;
19952
+ }
19953
+ continue;
19954
+ case this.S.CDATA_ENDING:
19955
+ if (c === "]") {
19956
+ this.state = this.S.CDATA_ENDING_2;
19957
+ } else {
19958
+ this.cdata += `]${c}`;
19959
+ this.state = this.S.CDATA;
19960
+ }
19961
+ continue;
19962
+ case this.S.CDATA_ENDING_2:
19963
+ if (c === ">") {
19964
+ if (this.cdata) {
19965
+ this.emitNode("oncdata", this.cdata);
19966
+ }
19967
+ this.emitNode("onclosecdata");
19968
+ this.cdata = "";
19969
+ this.state = this.S.TEXT;
19970
+ } else if (c === "]") {
19971
+ this.cdata += "]";
19972
+ } else {
19973
+ this.cdata += `]]${c}`;
19974
+ this.state = this.S.CDATA;
19975
+ }
19976
+ continue;
19977
+ case this.S.PROC_INST:
19978
+ if (c === "?") {
19979
+ this.state = this.S.PROC_INST_ENDING;
19980
+ } else if (_SAX.isWhitespace(c)) {
19981
+ this.state = this.S.PROC_INST_BODY;
19982
+ } else {
19983
+ this.procInstName += c;
19984
+ }
19985
+ continue;
19986
+ case this.S.PROC_INST_BODY:
19987
+ if (!this.procInstBody && _SAX.isWhitespace(c)) {
19988
+ continue;
19989
+ } else if (c === "?") {
19990
+ this.state = this.S.PROC_INST_ENDING;
19991
+ } else {
19992
+ this.procInstBody += c;
19993
+ }
19994
+ continue;
19995
+ case this.S.PROC_INST_ENDING:
19996
+ if (c === ">") {
19997
+ this.emitNode("onprocessinginstruction", {
19998
+ name: this.procInstName,
19999
+ body: this.procInstBody
20000
+ });
20001
+ this.procInstName = this.procInstBody = "";
20002
+ this.state = this.S.TEXT;
20003
+ } else {
20004
+ this.procInstBody += `?${c}`;
20005
+ this.state = this.S.PROC_INST_BODY;
20006
+ }
20007
+ continue;
20008
+ case this.S.OPEN_TAG:
20009
+ if (_SAX.isMatch(nameBody, c)) {
20010
+ this.tagName += c;
20011
+ } else {
20012
+ this.newTag();
20013
+ if (c === ">") {
20014
+ this.openTag();
20015
+ } else if (c === "/") {
20016
+ this.state = this.S.OPEN_TAG_SLASH;
20017
+ } else {
20018
+ if (!_SAX.isWhitespace(c)) {
20019
+ this.strictFail("Invalid character in tag name");
20020
+ }
20021
+ this.state = this.S.ATTRIB;
20022
+ }
20023
+ }
20024
+ continue;
20025
+ case this.S.OPEN_TAG_SLASH:
20026
+ if (c === ">") {
20027
+ this.openTag(true);
20028
+ this.closeTag();
20029
+ } else {
20030
+ this.strictFail("Forward-slash in opening tag not followed by >");
20031
+ this.state = this.S.ATTRIB;
20032
+ }
20033
+ continue;
20034
+ case this.S.ATTRIB:
20035
+ if (_SAX.isWhitespace(c)) {
20036
+ continue;
20037
+ } else if (c === ">") {
20038
+ this.openTag();
20039
+ } else if (c === "/") {
20040
+ this.state = this.S.OPEN_TAG_SLASH;
20041
+ } else if (_SAX.isMatch(nameStart, c)) {
20042
+ this.attribName = c;
20043
+ this.attribValue = "";
20044
+ this.state = this.S.ATTRIB_NAME;
20045
+ } else {
20046
+ this.strictFail("Invalid attribute name");
20047
+ }
20048
+ continue;
20049
+ case this.S.ATTRIB_NAME:
20050
+ if (c === "=") {
20051
+ this.state = this.S.ATTRIB_VALUE;
20052
+ } else if (c === ">") {
20053
+ this.strictFail("Attribute without value");
20054
+ this.attribValue = this.attribName;
20055
+ this.attrib();
20056
+ this.openTag();
20057
+ } else if (_SAX.isWhitespace(c)) {
20058
+ this.state = this.S.ATTRIB_NAME_SAW_WHITE;
20059
+ } else if (_SAX.isMatch(nameBody, c)) {
20060
+ this.attribName += c;
20061
+ } else {
20062
+ this.strictFail("Invalid attribute name");
20063
+ }
20064
+ continue;
20065
+ case this.S.ATTRIB_NAME_SAW_WHITE:
20066
+ if (c === "=") {
20067
+ this.state = this.S.ATTRIB_VALUE;
20068
+ } else if (_SAX.isWhitespace(c)) {
20069
+ continue;
20070
+ } else {
20071
+ this.strictFail("Attribute without value");
20072
+ Object.defineProperty(this.tag.attributes, this.attribName, {
20073
+ value: "",
20074
+ enumerable: true,
20075
+ configurable: true,
20076
+ writable: true
20077
+ });
20078
+ this.attribValue = "";
20079
+ this.emitNode("onattribute", {
20080
+ name: this.attribName,
20081
+ value: ""
20082
+ });
20083
+ this.attribName = "";
20084
+ if (c === ">") {
20085
+ this.openTag();
20086
+ } else if (_SAX.isMatch(nameStart, c)) {
20087
+ this.attribName = c;
20088
+ this.state = this.S.ATTRIB_NAME;
20089
+ } else {
20090
+ this.strictFail("Invalid attribute name");
20091
+ this.state = this.S.ATTRIB;
20092
+ }
20093
+ }
20094
+ continue;
20095
+ case this.S.ATTRIB_VALUE:
20096
+ if (_SAX.isWhitespace(c)) {
20097
+ continue;
20098
+ } else if (_SAX.isQuote(c)) {
20099
+ this.q = c;
20100
+ this.state = this.S.ATTRIB_VALUE_QUOTED;
20101
+ } else {
20102
+ this.strictFail("Unquoted attribute value");
20103
+ this.state = this.S.ATTRIB_VALUE_UNQUOTED;
20104
+ this.attribValue = c;
20105
+ }
20106
+ continue;
20107
+ case this.S.ATTRIB_VALUE_QUOTED:
20108
+ if (c !== this.q) {
20109
+ if (c === "&") {
20110
+ this.state = this.S.ATTRIB_VALUE_ENTITY_Q;
20111
+ } else {
20112
+ this.attribValue += c;
20113
+ }
20114
+ continue;
20115
+ }
20116
+ this.attrib();
20117
+ this.q = "";
20118
+ this.state = this.S.ATTRIB_VALUE_CLOSED;
20119
+ continue;
20120
+ case this.S.ATTRIB_VALUE_CLOSED:
20121
+ if (_SAX.isWhitespace(c)) {
20122
+ this.state = this.S.ATTRIB;
20123
+ } else if (c === ">") {
20124
+ this.openTag();
20125
+ } else if (c === "/") {
20126
+ this.state = this.S.OPEN_TAG_SLASH;
20127
+ } else if (_SAX.isMatch(nameStart, c)) {
20128
+ this.strictFail("No whitespace between attributes");
20129
+ this.attribName = c;
20130
+ this.attribValue = "";
20131
+ this.state = this.S.ATTRIB_NAME;
20132
+ } else {
20133
+ this.strictFail("Invalid attribute name");
20134
+ }
20135
+ continue;
20136
+ case this.S.ATTRIB_VALUE_UNQUOTED:
20137
+ if (!_SAX.isAttribEnd(c)) {
20138
+ if (c === "&") {
20139
+ this.state = this.S.ATTRIB_VALUE_ENTITY_U;
20140
+ } else {
20141
+ this.attribValue += c;
20142
+ }
20143
+ continue;
20144
+ }
20145
+ this.attrib();
20146
+ if (c === ">") {
20147
+ this.openTag();
20148
+ } else {
20149
+ this.state = this.S.ATTRIB;
20150
+ }
20151
+ continue;
20152
+ case this.S.CLOSE_TAG:
20153
+ if (!this.tagName) {
20154
+ if (_SAX.isWhitespace(c)) {
20155
+ continue;
20156
+ } else if (_SAX.notMatch(nameStart, c)) {
20157
+ if (this.script) {
20158
+ this.script += `</${c}`;
20159
+ this.state = this.S.SCRIPT;
20160
+ } else {
20161
+ this.strictFail("Invalid tagname in closing tag.");
20162
+ }
20163
+ } else {
20164
+ this.tagName = c;
20165
+ }
20166
+ } else if (c === ">") {
20167
+ this.closeTag();
20168
+ } else if (_SAX.isMatch(nameBody, c)) {
20169
+ this.tagName += c;
20170
+ } else if (this.script) {
20171
+ this.script += `</${this.tagName}`;
20172
+ this.tagName = "";
20173
+ this.state = this.S.SCRIPT;
20174
+ } else {
20175
+ if (!_SAX.isWhitespace(c)) {
20176
+ this.strictFail("Invalid tagname in closing tag");
20177
+ }
20178
+ this.state = this.S.CLOSE_TAG_SAW_WHITE;
20179
+ }
20180
+ continue;
20181
+ case this.S.CLOSE_TAG_SAW_WHITE:
20182
+ if (_SAX.isWhitespace(c)) {
20183
+ continue;
20184
+ }
20185
+ if (c === ">") {
20186
+ this.closeTag();
20187
+ } else {
20188
+ this.strictFail("Invalid characters in closing tag");
20189
+ }
20190
+ continue;
20191
+ case this.S.TEXT_ENTITY:
20192
+ case this.S.ATTRIB_VALUE_ENTITY_Q:
20193
+ case this.S.ATTRIB_VALUE_ENTITY_U:
20194
+ let returnState;
20195
+ let buffer;
20196
+ switch (this.state) {
20197
+ case this.S.TEXT_ENTITY:
20198
+ returnState = this.S.TEXT;
20199
+ buffer = "textNode";
20200
+ break;
20201
+ case this.S.ATTRIB_VALUE_ENTITY_Q:
20202
+ returnState = this.S.ATTRIB_VALUE_QUOTED;
20203
+ buffer = "attribValue";
20204
+ break;
20205
+ case this.S.ATTRIB_VALUE_ENTITY_U:
20206
+ returnState = this.S.ATTRIB_VALUE_UNQUOTED;
20207
+ buffer = "attribValue";
20208
+ break;
20209
+ default:
20210
+ throw new Error(`Unknown state: ${this.state}`);
20211
+ }
20212
+ if (c === ";") {
20213
+ this[buffer] += this.parseEntity();
20214
+ this.entity = "";
20215
+ this.state = returnState;
20216
+ } else if (_SAX.isMatch(this.entity.length ? entityBody : entityStart, c)) {
20217
+ this.entity += c;
20218
+ } else {
20219
+ this.strictFail("Invalid character in entity name");
20220
+ this[buffer] += `&${this.entity}${c}`;
20221
+ this.entity = "";
20222
+ this.state = returnState;
20223
+ }
20224
+ continue;
20225
+ default:
20226
+ throw new Error(`Unknown state: ${this.state}`);
20227
+ }
20228
+ }
20229
+ if (this.position >= this.bufferCheckPosition) {
20230
+ this.checkBufferLength();
20231
+ }
20232
+ return this;
20233
+ }
20234
+ emit(event, data) {
20235
+ if (this.events.hasOwnProperty(event)) {
20236
+ const eventName = event.replace(/^on/, "");
20237
+ this.events[event](data, eventName, this);
20238
+ }
20239
+ }
20240
+ clearBuffers() {
20241
+ for (let i = 0, l = this.BUFFERS.length; i < l; i++) {
20242
+ this[this[i]] = "";
20243
+ }
20244
+ }
20245
+ flushBuffers() {
20246
+ this.closeText();
20247
+ if (this.cdata !== "") {
20248
+ this.emitNode("oncdata", this.cdata);
20249
+ this.cdata = "";
20250
+ }
20251
+ if (this.script !== "") {
20252
+ this.emitNode("onscript", this.script);
20253
+ this.script = "";
20254
+ }
20255
+ }
20256
+ end() {
20257
+ if (this.sawRoot && !this.closedRoot) this.strictFail("Unclosed root tag");
20258
+ if (this.strict && this.state !== this.S.BEGIN && this.state !== this.S.BEGIN_WHITESPACE && this.state !== this.S.TEXT) {
20259
+ this.errorFunction("Unexpected end");
20260
+ }
20261
+ this.closeText();
20262
+ this.c = "";
20263
+ this.closed = true;
20264
+ this.emit("onend");
20265
+ return new SAXParser(this.opt);
20266
+ }
20267
+ errorFunction(er) {
20268
+ this.closeText();
20269
+ if (this.trackPosition) {
20270
+ er += `
20271
+ Line: ${this.line}
20272
+ Column: ${this.column}
20273
+ Char: ${this.c}`;
20274
+ }
20275
+ const error = new Error(er);
20276
+ this.error = error;
20277
+ this.emit("onerror", error);
20278
+ return this;
20279
+ }
20280
+ attrib() {
20281
+ if (!this.strict && !this.opt.preserveCase) {
20282
+ this.attribName = this.attribName[this.looseCase]();
20283
+ }
20284
+ if (this.attribList.indexOf(this.attribName) !== -1 || Object.hasOwn(this.tag.attributes, this.attribName)) {
20285
+ this.strictFail("Duplicate attribute");
20286
+ this.attribName = this.attribValue = "";
20287
+ return;
20288
+ }
20289
+ if (this.opt.xmlns) {
20290
+ const qn = _SAX.qname(this.attribName, true);
20291
+ const prefix = qn.prefix;
20292
+ const local = qn.local;
20293
+ if (prefix === "xmlns") {
20294
+ if (local === "xml" && this.attribValue !== this.XML_NAMESPACE) {
20295
+ this.strictFail(
20296
+ `xml: prefix must be bound to ${this.XML_NAMESPACE}
20297
+ Actual: ${this.attribValue}`
20298
+ );
20299
+ } else if (local === "xmlns" && this.attribValue !== this.XMLNS_NAMESPACE) {
20300
+ this.strictFail(
20301
+ `xmlns: prefix must be bound to ${this.XMLNS_NAMESPACE}
20302
+ Actual: ${this.attribValue}`
20303
+ );
20304
+ } else {
20305
+ const tag = this.tag;
20306
+ const parent = this.tags[this.tags.length - 1] || this;
20307
+ if (tag.ns === parent.ns) {
20308
+ tag.ns = Object.create(parent.ns);
20309
+ }
20310
+ tag.ns[local] = this.attribValue;
20311
+ }
20312
+ }
20313
+ this.attribList.push([this.attribName, this.attribValue]);
20314
+ } else {
20315
+ Object.defineProperty(this.tag.attributes, this.attribName, {
20316
+ value: this.attribValue,
20317
+ enumerable: true,
20318
+ configurable: true,
20319
+ writable: true
20320
+ });
20321
+ this.emitNode("onattribute", {
20322
+ name: this.attribName,
20323
+ value: this.attribValue
20324
+ });
20325
+ }
20326
+ this.attribName = this.attribValue = "";
20327
+ }
20328
+ newTag() {
20329
+ if (!this.strict && !this.opt.preserveCase) this.tagName = this.tagName[this.looseCase]();
20330
+ const parent = this.tags[this.tags.length - 1] || this;
20331
+ const tag = { name: this.tagName, attributes: {} };
20332
+ this.tag = tag;
20333
+ if (this.opt.xmlns) {
20334
+ tag.ns = parent.ns;
20335
+ }
20336
+ this.attribList.length = 0;
20337
+ this.emitNode("onopentagstart", tag);
20338
+ }
20339
+ /** Validates an entity before optionally preserving its authored spelling. */
20340
+ parseEntity() {
20341
+ const decoded = this.decodeEntity();
20342
+ return this.opt.processEntities === false ? `&${this.entity};` : decoded;
20343
+ }
20344
+ /** Decodes predefined, configured, or numeric entities without resolving document types. */
20345
+ decodeEntity() {
20346
+ let entity = this.entity;
20347
+ const entityLC = entity.toLowerCase();
20348
+ let num = NaN;
20349
+ let numStr = "";
20350
+ if (typeof this.ENTITIES[entity] === "string" || typeof this.ENTITIES[entity] === "number") {
20351
+ return this.ENTITIES[entity];
20352
+ }
20353
+ if (typeof this.ENTITIES[entityLC] === "string" || typeof this.ENTITIES[entityLC] === "number") {
20354
+ return this.ENTITIES[entityLC];
20355
+ }
20356
+ entity = entityLC;
20357
+ if (entity.charAt(0) === "#") {
20358
+ if (entity.charAt(1) === "x") {
20359
+ entity = entity.slice(2);
20360
+ num = parseInt(entity, 16);
20361
+ numStr = num.toString(16);
20362
+ } else {
20363
+ entity = entity.slice(1);
20364
+ num = parseInt(entity, 10);
20365
+ numStr = num.toString(10);
20366
+ }
20367
+ }
20368
+ entity = entity.replace(/^0+/, "");
20369
+ if (Number.isNaN(num) || numStr.toLowerCase() !== entity) {
20370
+ this.strictFail("Invalid character entity");
20371
+ return `&${this.entity};`;
20372
+ }
20373
+ if (num < 0 || num > 1114111 || num >= 55296 && num <= 57343 || num < 32 && ![9, 10, 13].includes(num) || num === 65534 || num === 65535) {
20374
+ this.strictFail("Invalid character entity");
20375
+ return `&${this.entity};`;
20376
+ }
20377
+ return String.fromCodePoint(num);
20378
+ }
20379
+ beginWhiteSpace(c) {
20380
+ if (c === "<") {
20381
+ this.state = this.S.OPEN_WAKA;
20382
+ this.startTagPosition = this.position;
20383
+ } else if (!_SAX.isWhitespace(c)) {
20384
+ this.strictFail("Non-whitespace before first tag.");
20385
+ this.textNode = c;
20386
+ this.state = this.S.TEXT;
20387
+ } else {
20388
+ }
20389
+ }
20390
+ strictFail(message) {
20391
+ if (typeof this !== "object" || !(this instanceof SAXParser)) {
20392
+ throw new Error("bad call to strictFail");
20393
+ }
20394
+ if (this.strict) {
20395
+ this.errorFunction(message);
20396
+ }
20397
+ }
20398
+ textApplyOptions(text) {
20399
+ if (this.opt.trim) text = text.trim();
20400
+ if (this.opt.normalize) text = text.replace(/\s+/g, " ");
20401
+ return text;
20402
+ }
20403
+ emitNode(nodeType, data) {
20404
+ if (this.textNode) this.closeText();
20405
+ this.emit(nodeType, data);
20406
+ }
20407
+ closeText() {
20408
+ this.textNode = this.textApplyOptions(this.textNode);
20409
+ if (this.textNode !== void 0 && this.textNode !== "" && this.textNode !== "undefined") {
20410
+ this.emit("ontext", this.textNode);
20411
+ }
20412
+ this.textNode = "";
20413
+ }
20414
+ checkBufferLength() {
20415
+ var _a;
20416
+ const maxAllowed = Math.max(this.opt.MAX_BUFFER_LENGTH, 10);
20417
+ let maxActual = 0;
20418
+ for (let i = 0, l = this.BUFFERS.length; i < l; i++) {
20419
+ const len = ((_a = this[this.BUFFERS[i]]) == null ? void 0 : _a.length) || 0;
20420
+ if (len > maxAllowed) {
20421
+ switch (this.BUFFERS[i]) {
20422
+ case "textNode":
20423
+ this.closeText();
20424
+ break;
20425
+ case "cdata":
20426
+ this.emitNode("oncdata", this.cdata);
20427
+ this.cdata = "";
20428
+ break;
20429
+ case "script":
20430
+ this.emitNode("onscript", this.script);
20431
+ this.script = "";
20432
+ break;
20433
+ default:
20434
+ this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[i]}`);
20435
+ }
20436
+ }
20437
+ maxActual = Math.max(maxActual, len);
20438
+ }
20439
+ const m = this.opt.MAX_BUFFER_LENGTH - maxActual;
20440
+ this.bufferCheckPosition = m + this.position;
20441
+ }
20442
+ openTag(selfClosing) {
20443
+ if (this.opt.xmlns) {
20444
+ const tag = this.tag;
20445
+ const qn = _SAX.qname(this.tagName);
20446
+ tag.prefix = qn.prefix;
20447
+ tag.local = qn.local;
20448
+ tag.uri = tag.ns[qn.prefix] || "";
20449
+ if (tag.prefix && !tag.uri) {
20450
+ this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`);
20451
+ tag.uri = qn.prefix;
20452
+ }
20453
+ const parent = this.tags[this.tags.length - 1] || this;
20454
+ if (tag.ns && parent.ns !== tag.ns) {
20455
+ const that = this;
20456
+ Object.keys(tag.ns).forEach((p) => {
20457
+ that.emitNode("onopennamespace", {
20458
+ prefix: p,
20459
+ uri: tag.ns[p]
20460
+ });
20461
+ });
20462
+ }
20463
+ for (let i = 0, l = this.attribList.length; i < l; i++) {
20464
+ const nv = this.attribList[i];
20465
+ const name22 = nv[0];
20466
+ const value = nv[1];
20467
+ const qualName = _SAX.qname(name22, true);
20468
+ const prefix = qualName.prefix;
20469
+ const local = qualName.local;
20470
+ const uri = prefix === "" ? "" : tag.ns[prefix] || "";
20471
+ const a = {
20472
+ name: name22,
20473
+ value,
20474
+ prefix,
20475
+ local,
20476
+ uri
20477
+ };
20478
+ if (prefix && prefix !== "xmlns" && !uri) {
20479
+ this.strictFail(`Unbound namespace prefix: ${JSON.stringify(prefix)}`);
20480
+ a.uri = prefix;
20481
+ }
20482
+ Object.defineProperty(this.tag.attributes, name22, {
20483
+ value: a,
20484
+ enumerable: true,
20485
+ configurable: true,
20486
+ writable: true
20487
+ });
20488
+ this.emitNode("onattribute", a);
20489
+ }
20490
+ this.attribList.length = 0;
20491
+ }
20492
+ this.tag.isSelfClosing = Boolean(selfClosing);
20493
+ this.sawRoot = true;
20494
+ this.tags.push(this.tag);
20495
+ this.emitNode("onopentag", this.tag);
20496
+ if (!selfClosing) {
20497
+ if (!this.noscript && this.tagName.toLowerCase() === "script") {
20498
+ this.state = this.S.SCRIPT;
20499
+ } else {
20500
+ this.state = this.S.TEXT;
20501
+ }
20502
+ this.tag = null;
20503
+ this.tagName = "";
20504
+ }
20505
+ this.attribName = this.attribValue = "";
20506
+ this.attribList.length = 0;
20507
+ }
20508
+ closeTag() {
20509
+ if (!this.tagName) {
20510
+ this.strictFail("Weird empty close tag.");
20511
+ this.textNode += "</>";
20512
+ this.state = this.S.TEXT;
20513
+ return;
20514
+ }
20515
+ const caseInsensitiveTags = !this.strict && (this.opt.caseInsensitiveTags || !this.opt.preserveCase);
20516
+ if (this.script) {
20517
+ const normalizedScriptCloseTag = caseInsensitiveTags ? this.tagName.toLowerCase() : this.tagName;
20518
+ if (normalizedScriptCloseTag !== "script") {
20519
+ this.script += `</${this.tagName}>`;
20520
+ this.tagName = "";
20521
+ this.state = this.S.SCRIPT;
20522
+ return;
20523
+ }
20524
+ this.emitNode("onscript", this.script);
20525
+ this.script = "";
20526
+ }
20527
+ let t = this.tags.length;
20528
+ let tagName = this.tagName;
20529
+ const normalizedTagName = caseInsensitiveTags ? tagName.toLowerCase() : tagName;
20530
+ while (t--) {
20531
+ const close = this.tags[t];
20532
+ const normalizedOpenTagName = caseInsensitiveTags ? close.name.toLowerCase() : close.name;
20533
+ if (normalizedOpenTagName !== normalizedTagName) {
20534
+ this.strictFail("Unexpected close tag");
20535
+ } else {
20536
+ break;
20537
+ }
20538
+ }
20539
+ if (t < 0) {
20540
+ this.strictFail(`Unmatched closing tag: ${this.tagName}`);
20541
+ this.textNode += `</${this.tagName}>`;
20542
+ this.state = this.S.TEXT;
20543
+ return;
20544
+ }
20545
+ this.tagName = tagName;
20546
+ let s = this.tags.length;
20547
+ while (s-- > t) {
20548
+ const tag = this.tags.pop();
20549
+ this.tag = tag;
20550
+ this.tagName = this.tag.name;
20551
+ this.emitNode("onclosetag", this.tagName);
20552
+ const x = {};
20553
+ for (const i in tag.ns) {
20554
+ if (tag.ns.hasOwnProperty(i)) {
20555
+ x[i] = tag.ns[i];
20556
+ }
20557
+ }
20558
+ const parent = this.tags[this.tags.length - 1] || this;
20559
+ if (this.opt.xmlns && tag.ns !== parent.ns) {
20560
+ const that = this;
20561
+ Object.keys(tag.ns).forEach((p) => {
20562
+ const n = tag.ns[p];
20563
+ that.emitNode("onclosenamespace", { prefix: p, uri: n });
20564
+ });
20565
+ }
20566
+ }
20567
+ if (t === 0) this.closedRoot = true;
20568
+ this.tagName = this.attribValue = this.attribName = "";
20569
+ this.attribList.length = 0;
20570
+ this.state = this.S.TEXT;
20571
+ }
20572
+ };
20573
+ SAXParser = class extends SAX {
20574
+ static ENTITIES = ENTITIES;
20575
+ opt = DEFAULT_SAX_PARSER_OPTIONS;
20576
+ events = DEFAULT_SAX_EVENTS;
20577
+ constructor(opt) {
20578
+ super();
20579
+ this.clearBuffers();
20580
+ this.opt = opt = { ...this.opt, ...opt };
20581
+ this.events = { ...this.events, ...opt };
20582
+ this.q = this.c = "";
20583
+ this.opt.lowercase = this.opt.lowercase || this.opt.lowercasetags;
20584
+ this.bufferCheckPosition = this.opt.MAX_BUFFER_LENGTH;
20585
+ this.looseCase = this.opt.lowercase ? "toLowerCase" : "toUpperCase";
20586
+ this.tags = [];
20587
+ this.closed = this.closedRoot = this.sawRoot = false;
20588
+ this.tag = this.error = null;
20589
+ this.strict = Boolean(this.opt.strict);
20590
+ this.noscript = Boolean(this.opt.strict || this.opt.noscript);
20591
+ this.state = this.S.BEGIN;
20592
+ this.strictEntities = this.opt.strictEntities;
20593
+ this.ENTITIES = this.strictEntities ? Object.create(this.XML_ENTITIES) : Object.create(this.ENTITIES);
20594
+ this.attribList = [];
20595
+ if (this.opt.xmlns) {
20596
+ this.ns = Object.create(this.rootNS);
20597
+ }
20598
+ this.trackPosition = this.opt.position !== false;
20599
+ if (this.trackPosition) {
20600
+ this.position = this.line = this.column = 0;
20601
+ }
20602
+ this.emit("onready");
20603
+ }
20604
+ resume() {
20605
+ this.error = null;
20606
+ return this;
20607
+ }
20608
+ close() {
20609
+ return this.write(null);
20610
+ }
20611
+ flush() {
20612
+ this.flushBuffers();
20613
+ }
20614
+ };
20615
+ }
20616
+ });
20617
+
20618
+ // ../documents/src/lib/parsers/parse-xml-internal.ts
20619
+ function setXMLField(object, name22, value) {
20620
+ Object.defineProperty(object, name22, {
20621
+ value,
20622
+ enumerable: true,
20623
+ configurable: true,
20624
+ writable: true
20625
+ });
20626
+ }
20627
+ function parseXMLInternal(text, options = {}) {
20628
+ if (options.strict !== false && /[^\u0009\u000a\u000d\u0020-\ud7ff\ue000-\ufffd\u{10000}-\u{10ffff}]/u.test(text)) {
20629
+ throw new Error("XML: invalid XML character");
20630
+ }
20631
+ const maximumDepth = options.maxDepth ?? 256;
20632
+ if (!Number.isSafeInteger(maximumDepth) || maximumDepth < 1 || maximumDepth > 4096) {
20633
+ throw new Error("XML: maxDepth must be an integer between 1 and 4096");
20634
+ }
20635
+ const state = new InternalXMLParserState(options, maximumDepth);
20636
+ const parser = new SAXParser({
20637
+ strict: options.strict !== false,
20638
+ strictEntities: !options.htmlEntities,
20639
+ preserveCase: true,
20640
+ caseInsensitiveTags: options.strict === false,
20641
+ processEntities: options.processEntities !== false,
20642
+ onopentag: (tag) => state.openElement(tag.name, tag.attributes || {}),
20643
+ ontext: (value) => state.addText(value),
20644
+ oncdata: (value) => state.addText(value),
20645
+ onscript: (value) => state.addText(value),
20646
+ onclosetag: () => state.closeElement(),
20647
+ onerror: (error) => {
20648
+ throw error;
20649
+ }
20650
+ });
20651
+ parser.write(text).close();
20652
+ if (options.strict === false) {
20653
+ while (state.stack.length) state.closeElement();
20654
+ }
20655
+ if (state.result === void 0) throw new Error("XML: document requires a root element");
20656
+ return state.result;
20657
+ }
20658
+ var InternalXMLParserState;
20659
+ var init_parse_xml_internal = __esm({
20660
+ "../documents/src/lib/parsers/parse-xml-internal.ts"() {
20661
+ "use strict";
20662
+ init_sax();
20663
+ InternalXMLParserState = class {
20664
+ /** Initializes conversion options and the element nesting budget. */
20665
+ constructor(options, maximumDepth) {
20666
+ this.options = options;
20667
+ this.maximumDepth = maximumDepth;
20668
+ }
20669
+ options;
20670
+ maximumDepth;
20671
+ /** Open element stack. */
20672
+ stack = [];
20673
+ /** Parsed root document. */
20674
+ result;
20675
+ /** Starts an element, rejecting multiple roots and excessive nesting. */
20676
+ openElement(name22, attributes) {
20677
+ if (this.stack.length >= this.maximumDepth)
20678
+ throw new Error("XML: maximum nesting depth exceeded");
20679
+ if (!this.stack.length && this.result !== void 0 && this.options.strict !== false) {
20680
+ throw new Error("XML: document requires a single root element");
20681
+ }
20682
+ const elementName = this.normalizeName(name22);
20683
+ const parent = this.stack[this.stack.length - 1];
20684
+ this.stack.push({
20685
+ name: elementName,
20686
+ path: parent ? `${parent.path}.${elementName}` : elementName,
20687
+ attributes: this.normalizeAttributes(attributes),
20688
+ children: {},
20689
+ orderedChildren: [],
20690
+ text: ""
20691
+ });
20692
+ }
20693
+ /** Accumulates text without losing whitespace between text and CDATA chunks. */
20694
+ addText(text) {
20695
+ const current = this.stack[this.stack.length - 1];
20696
+ if (current) current.text += text;
20697
+ }
20698
+ /** Finishes an element and attaches it to its parent or the document root. */
20699
+ closeElement() {
20700
+ const node = this.stack.pop();
20701
+ if (!node) return;
20702
+ const value = this.finalizeElement(node);
20703
+ const parent = this.stack[this.stack.length - 1];
20704
+ if (this.options.preserveOrder) {
20705
+ if (parent) parent.orderedChildren.push(value);
20706
+ else this.result = value;
20707
+ return;
20708
+ }
20709
+ if (parent) this.addChild(parent.children, node.name, node.path, value);
20710
+ else {
20711
+ if (this.result === void 0) this.result = {};
20712
+ this.addChild(this.result, node.name, node.path, value);
20713
+ }
20714
+ }
20715
+ /** Converts a completed element, keeping grouping and coercion independent. */
20716
+ finalizeElement(node) {
20717
+ const text = this.options.trimValues === false ? node.text : node.text.trim();
20718
+ if (this.options.preserveOrder) {
20719
+ return { name: node.name, attributes: node.attributes, children: node.orderedChildren, text };
20720
+ }
20721
+ const hasAttributes = Object.keys(node.attributes).length > 0;
20722
+ if (!hasAttributes && !Object.keys(node.children).length) {
20723
+ return this.parseValue(text, this.options.parseTagValue !== false);
20724
+ }
20725
+ const object = node.children;
20726
+ if (text)
20727
+ setXMLField(
20728
+ object,
20729
+ this.options.textNodeName ?? "value",
20730
+ this.parseValue(text, this.options.parseTagValue !== false)
20731
+ );
20732
+ if (hasAttributes && this.options.attributesGroupName) {
20733
+ setXMLField(object, this.options.attributesGroupName, node.attributes);
20734
+ } else {
20735
+ for (const [name22, value] of Object.entries(node.attributes)) setXMLField(object, name22, value);
20736
+ }
20737
+ return object;
20738
+ }
20739
+ /** Appends an element while preserving repeated and explicitly array-valued fields. */
20740
+ addChild(object, name22, path, value) {
20741
+ var _a;
20742
+ if (!Object.hasOwn(object, name22)) {
20743
+ setXMLField(object, name22, ((_a = this.options.arrayPaths) == null ? void 0 : _a.includes(path)) ? [value] : value);
20744
+ } else {
20745
+ const existing = object[name22];
20746
+ if (Array.isArray(existing)) existing.push(value);
20747
+ else setXMLField(object, name22, [existing, value]);
20748
+ }
20749
+ }
20750
+ /** Applies namespace, prefix, grouping and scalar options to attributes. */
20751
+ normalizeAttributes(attributes) {
20752
+ const normalized = {};
20753
+ if (this.options.ignoreAttributes) return normalized;
20754
+ for (const [name22, value] of Object.entries(attributes)) {
20755
+ if (this.options.removeNSPrefix && (name22 === "xmlns" || name22.startsWith("xmlns:"))) continue;
20756
+ const text = this.options.trimValues === false ? value : value.trim();
20757
+ setXMLField(
20758
+ normalized,
20759
+ (this.options.attributeNamePrefix ?? "") + this.normalizeName(name22),
20760
+ this.parseValue(text, this.options.parseAttributeValue === true)
20761
+ );
20762
+ }
20763
+ return normalized;
20764
+ }
20765
+ /** Removes a namespace prefix only when requested. */
20766
+ normalizeName(name22) {
20767
+ return this.options.removeNSPrefix ? name22.slice(name22.indexOf(":") + 1) : name22;
20768
+ }
20769
+ /** Coerces only finite numeric values and lowercase XML boolean literals. */
20770
+ parseValue(value, convert) {
20771
+ if (!convert) return value;
20772
+ if (value === "true" || value === "false") return value === "true";
20773
+ if (value !== "" && value.trim() !== "" && Number.isFinite(Number(value))) return Number(value);
20774
+ return value;
20775
+ }
20776
+ };
20777
+ }
20778
+ });
20779
+
20780
+ // ../documents/src/lib/parsers/parse-xml.ts
20781
+ function parseXMLSync(text, options = {}) {
20782
+ if (Object.hasOwn(options, "_fastXML") || Object.hasOwn(options, "_sax")) {
20783
+ throw new Error("XML: backend-specific options were removed; use native XML options");
20784
+ }
20785
+ if (options._parser && !["internal", "sax"].includes(options._parser)) {
20786
+ throw new Error("XML: unsupported parser backend; use the native documents parser");
20787
+ }
20788
+ const parsed = parseXMLInternal(text, options);
20789
+ return options.uncapitalizeKeys ? uncapitalizeKeys(parsed) : parsed;
20790
+ }
20791
+ var init_parse_xml = __esm({
20792
+ "../documents/src/lib/parsers/parse-xml.ts"() {
20793
+ "use strict";
20794
+ init_uncapitalize();
20795
+ init_parse_xml_internal();
20796
+ }
20797
+ });
20798
+
20799
+ // ../documents/src/xml-parser.ts
20800
+ var init_xml_parser = __esm({
20801
+ "../documents/src/xml-parser.ts"() {
20802
+ "use strict";
20803
+ init_parse_xml();
20804
+ }
20805
+ });
20806
+
20807
+ // ../scene/src/materialx/parse-materialx.ts
20808
+ function parseMaterialX(text) {
20809
+ if (/<!DOCTYPE|<!ENTITY/i.test(text)) {
20810
+ throw new Error("MaterialX: document types and entity declarations are unsupported.");
20811
+ }
20812
+ let element;
20813
+ try {
20814
+ element = parseXMLSync(text, {
20815
+ preserveOrder: true,
20816
+ parseAttributeValue: false,
20817
+ trimValues: false
20818
+ });
20819
+ } catch (error) {
20820
+ throw new Error("MaterialX: malformed XML.", { cause: error });
20821
+ }
20822
+ if (element.name !== "materialx") {
20823
+ throw new Error("MaterialX: expected a materialx root element.");
20824
+ }
20825
+ const version2 = element.attributes.version;
20826
+ if (!version2 || !/^1\.\d+$/.test(version2)) {
20827
+ throw new Error("MaterialX: expected a MaterialX 1.x version.");
20828
+ }
20829
+ return { version: version2, root: parseElement(element, 0) };
20830
+ }
20831
+ function parseElement(element, depth) {
20832
+ return {
20833
+ category: element.name,
20834
+ attributes: element.attributes,
20835
+ children: element.children.map((child) => parseElement(child, depth + 1))
20836
+ };
20837
+ }
20838
+ var init_parse_materialx = __esm({
20839
+ "../scene/src/materialx/parse-materialx.ts"() {
20840
+ "use strict";
20841
+ init_xml_parser();
20842
+ }
20843
+ });
20844
+
20845
+ // ../scene/src/materialx-loader.ts
20846
+ var materialx_loader_exports = {};
20847
+ __export(materialx_loader_exports, {
20848
+ MaterialXLoaderWithParser: () => MaterialXLoaderWithParser
20849
+ });
20850
+ var _preload, metadata, MaterialXLoaderWithParser;
20851
+ var init_materialx_loader = __esm({
20852
+ "../scene/src/materialx-loader.ts"() {
20853
+ "use strict";
20854
+ init_materialx_loader_types();
20855
+ init_parse_materialx();
20856
+ ({ preload: _preload, ...metadata } = MaterialXLoader);
20857
+ MaterialXLoaderWithParser = {
20858
+ ...metadata,
20859
+ parse: async (data) => parseMaterialX(new TextDecoder().decode(data)),
20860
+ parseSync: (data) => parseMaterialX(new TextDecoder().decode(data)),
20861
+ parseText: async (text) => parseMaterialX(text),
20862
+ parseTextSync: parseMaterialX
20863
+ };
20864
+ }
20865
+ });
20866
+
20867
+ // ../scene/src/materialx-loader-types.ts
20868
+ async function preload10() {
20869
+ const { MaterialXLoaderWithParser: MaterialXLoaderWithParser2 } = await Promise.resolve().then(() => (init_materialx_loader(), materialx_loader_exports));
20870
+ return MaterialXLoaderWithParser2;
20871
+ }
20872
+ var MaterialXLoader;
20873
+ var init_materialx_loader_types = __esm({
20874
+ "../scene/src/materialx-loader-types.ts"() {
20875
+ "use strict";
20876
+ MaterialXLoader = {
20877
+ name: "MaterialX",
20878
+ id: "materialx",
20879
+ module: "scene",
20880
+ version: "latest",
20881
+ extensions: ["mtlx"],
20882
+ mimeTypes: ["application/xml"],
20883
+ text: true,
20884
+ dataType: null,
20885
+ batchType: null,
20886
+ options: {},
20887
+ preload: preload10
20888
+ };
20889
+ }
20890
+ });
20891
+
18725
20892
  // ../scene/src/index.ts
18726
20893
  var src_exports = {};
18727
20894
  __export(src_exports, {
@@ -18739,6 +20906,7 @@ __export(src_exports, {
18739
20906
  MTLFormat: () => MTLFormat,
18740
20907
  MTLLoader: () => MTLLoader,
18741
20908
  MTLWorkerLoader: () => MTLWorkerLoader,
20909
+ MaterialXLoader: () => MaterialXLoader,
18742
20910
  OBJFormat: () => OBJFormat,
18743
20911
  OBJLoader: () => OBJLoader,
18744
20912
  OBJWorkerLoader: () => OBJWorkerLoader,
@@ -18762,6 +20930,7 @@ var init_src2 = __esm({
18762
20930
  init_draco_loader_types();
18763
20931
  init_draco_format();
18764
20932
  init_draco_libraries();
20933
+ init_materialx_loader_types();
18765
20934
  }
18766
20935
  });
18767
20936
 
@@ -21306,8 +23475,8 @@ var init_format_spatial_reference = __esm({
21306
23475
  function getSpatialProjectionEngine() {
21307
23476
  return spatialProjectionEngine;
21308
23477
  }
21309
- function getGeoidModel(name20) {
21310
- return geoidModels.get(name20);
23478
+ function getGeoidModel(name22) {
23479
+ return geoidModels.get(name22);
21311
23480
  }
21312
23481
  var import_earth, import_projection, geoidModels, spatialProjectionEngine;
21313
23482
  var init_spatial_resource_registry = __esm({
@@ -22791,7 +24960,7 @@ var init_i3s_source = __esm({
22791
24960
  const contentUrl = this.getTileUrl(tile.contentUrl);
22792
24961
  const loaderId = this.loader.id;
22793
24962
  const loaderOptions = this.loadOptions[loaderId] || {};
22794
- const metadata = this.getMetadata();
24963
+ const metadata2 = this.getMetadata();
22795
24964
  const options = {
22796
24965
  ...this.loadOptions,
22797
24966
  [loaderId]: {
@@ -22811,9 +24980,9 @@ var init_i3s_source = __esm({
22811
24980
  mbs: tile.header.mbs
22812
24981
  },
22813
24982
  _tilesetOptions: {
22814
- store: metadata.tileset.store,
22815
- attributeStorageInfo: metadata.tileset.attributeStorageInfo,
22816
- fields: metadata.tileset.fields,
24983
+ store: metadata2.tileset.store,
24984
+ attributeStorageInfo: metadata2.tileset.attributeStorageInfo,
24985
+ fields: metadata2.tileset.fields,
22817
24986
  spatialReference: tile.tileset.spatialReference,
22818
24987
  spatialOptions: tile.tileset.options.spatial
22819
24988
  },
@@ -22837,9 +25006,9 @@ var init_i3s_source = __esm({
22837
25006
  * Loads child tile metadata on demand from node pages or `/nodes/{id}` resources.
22838
25007
  */
22839
25008
  async loadChildTileHeader(_parentTile, childId, _frameState) {
22840
- const metadata = this.getMetadata();
22841
- if (metadata.tileset.nodePages || metadata.tileset.pointNodePages) {
22842
- const header2 = await metadata.tileset.nodePagesTile.formTileFromNodePages(childId);
25009
+ const metadata2 = this.getMetadata();
25010
+ if (metadata2.tileset.nodePages || metadata2.tileset.pointNodePages) {
25011
+ const header2 = await metadata2.tileset.nodePagesTile.formTileFromNodePages(childId);
22843
25012
  return await this.transformTileHeader(header2);
22844
25013
  }
22845
25014
  const nodeUrl = this.getTileUrl(`${this.url}/nodes/${childId}`);
@@ -22942,8 +25111,8 @@ var init_i3s_source = __esm({
22942
25111
  zoom: 1
22943
25112
  };
22944
25113
  }
22945
- const metadata = this.getMetadata();
22946
- const fullExtent = metadata.tileset.fullExtent;
25114
+ const metadata2 = this.getMetadata();
25115
+ const fullExtent = metadata2.tileset.fullExtent;
22947
25116
  if (fullExtent) {
22948
25117
  const { xmin, xmax, ymin, ymax, zmin, zmax } = fullExtent;
22949
25118
  const cartographicCenter = new import_core13.Vector3(
@@ -22959,7 +25128,7 @@ var init_i3s_source = __esm({
22959
25128
  zoom: getZoomFromFullExtent(fullExtent, cartographicCenter, cartesianCenter)
22960
25129
  };
22961
25130
  }
22962
- const extent = (_a = metadata.tileset.store) == null ? void 0 : _a.extent;
25131
+ const extent = (_a = metadata2.tileset.store) == null ? void 0 : _a.extent;
22963
25132
  if (extent) {
22964
25133
  const [xmin, ymin, xmax, ymax] = extent;
22965
25134
  const cartographicCenter = new import_core13.Vector3(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, 0);
@@ -22999,8 +25168,8 @@ var init_i3s_source = __esm({
22999
25168
  */
23000
25169
  getTilesTotalCount() {
23001
25170
  var _a, _b;
23002
- const metadata = this.getMetadata();
23003
- return ((_b = (_a = metadata.tileset) == null ? void 0 : _a.nodePagesTile) == null ? void 0 : _b.nodesInNodePages) || null;
25171
+ const metadata2 = this.getMetadata();
25172
+ return ((_b = (_a = metadata2.tileset) == null ? void 0 : _a.nodePagesTile) == null ? void 0 : _b.nodesInNodePages) || null;
23004
25173
  }
23005
25174
  /**
23006
25175
  * Loads data through injected core APIs so this module stays independent from `@loaders.gl/core`.
@@ -23292,9 +25461,9 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
23292
25461
  };
23293
25462
  copyDracoTextureCoordinates(attributes, decompressedGeometry.attributes);
23294
25463
  if (content.geometryMode === "source") {
23295
- for (const [name20, attribute] of Object.entries(decompressedGeometry.attributes)) {
23296
- if (!["POSITION", "NORMAL", "COLOR_0", "feature-index", "uv-region"].includes(name20) && !/^TEXCOORD_\d+$/.test(name20)) {
23297
- attributes[name20] = attribute;
25464
+ for (const [name22, attribute] of Object.entries(decompressedGeometry.attributes)) {
25465
+ if (!["POSITION", "NORMAL", "COLOR_0", "feature-index", "uv-region"].includes(name22) && !/^TEXCOORD_\d+$/.test(name22)) {
25466
+ attributes[name22] = attribute;
23298
25467
  }
23299
25468
  }
23300
25469
  }
@@ -23580,20 +25749,20 @@ function parseUint64Values(buffer, elementsCount, attributeSize) {
23580
25749
  function parsePositions(attribute, options) {
23581
25750
  const mbs = options.mbs;
23582
25751
  const value = attribute.value;
23583
- const metadata = attribute.metadata;
25752
+ const metadata2 = attribute.metadata;
23584
25753
  const enuMatrix = new import_core14.Matrix4();
23585
25754
  const cartographicOrigin = new import_core14.Vector3(mbs[0], mbs[1], mbs[2]);
23586
25755
  const cartesianOrigin = new import_core14.Vector3();
23587
25756
  import_geospatial8.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
23588
25757
  (0, import_geospatial9.eastNorthUpToFixedFrame)(import_geospatial8.Ellipsoid.WGS84, cartesianOrigin, enuMatrix);
23589
- attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
25758
+ attribute.value = offsetsToCartesians(value, metadata2, cartographicOrigin);
23590
25759
  return enuMatrix;
23591
25760
  }
23592
- function offsetsToSourcePositions(vertices, metadata = {}, sourceOrigin) {
25761
+ function offsetsToSourcePositions(vertices, metadata2 = {}, sourceOrigin) {
23593
25762
  var _a, _b;
23594
25763
  const positions = new Float64Array(vertices.length);
23595
- const scaleX = ((_a = metadata["i3s-scale_x"]) == null ? void 0 : _a.double) ?? 1;
23596
- const scaleY = ((_b = metadata["i3s-scale_y"]) == null ? void 0 : _b.double) ?? 1;
25764
+ const scaleX = ((_a = metadata2["i3s-scale_x"]) == null ? void 0 : _a.double) ?? 1;
25765
+ const scaleY = ((_b = metadata2["i3s-scale_y"]) == null ? void 0 : _b.double) ?? 1;
23597
25766
  for (let index = 0; index < positions.length; index += 3) {
23598
25767
  positions[index] = vertices[index] * scaleX + sourceOrigin[0];
23599
25768
  positions[index + 1] = vertices[index + 1] * scaleY + sourceOrigin[1];
@@ -23601,8 +25770,8 @@ function offsetsToSourcePositions(vertices, metadata = {}, sourceOrigin) {
23601
25770
  }
23602
25771
  return positions;
23603
25772
  }
23604
- function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
23605
- const positions = offsetsToSourcePositions(vertices, metadata, cartographicOrigin);
25773
+ function offsetsToCartesians(vertices, metadata2 = {}, cartographicOrigin) {
25774
+ const positions = offsetsToSourcePositions(vertices, metadata2, cartographicOrigin);
23606
25775
  for (let i = 0; i < positions.length; i += 3) {
23607
25776
  import_geospatial8.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector4);
23608
25777
  positions[i] = scratchVector4.x;
@@ -23613,9 +25782,9 @@ function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
23613
25782
  }
23614
25783
  function getModelMatrix(positions) {
23615
25784
  var _a, _b;
23616
- const metadata = positions.metadata;
23617
- const scaleX = ((_a = metadata == null ? void 0 : metadata["i3s-scale_x"]) == null ? void 0 : _a.double) || 1;
23618
- const scaleY = ((_b = metadata == null ? void 0 : metadata["i3s-scale_y"]) == null ? void 0 : _b.double) || 1;
25785
+ const metadata2 = positions.metadata;
25786
+ const scaleX = ((_a = metadata2 == null ? void 0 : metadata2["i3s-scale_x"]) == null ? void 0 : _a.double) || 1;
25787
+ const scaleY = ((_b = metadata2 == null ? void 0 : metadata2["i3s-scale_y"]) == null ? void 0 : _b.double) || 1;
23619
25788
  const modelMatrix = new import_core14.Matrix4();
23620
25789
  modelMatrix[0] = scaleX;
23621
25790
  modelMatrix[5] = scaleY;
@@ -23847,7 +26016,7 @@ var init_i3s_content_loader = __esm({
23847
26016
  "use strict";
23848
26017
  init_i3s_format();
23849
26018
  init_i3s_loader_options();
23850
- VERSION10 = true ? "5.0.0-beta.2" : "latest";
26019
+ VERSION10 = true ? "5.0.0-beta.4" : "latest";
23851
26020
  I3SContentLoader = {
23852
26021
  ...I3SContentFormat,
23853
26022
  dataType: null,
@@ -23876,7 +26045,7 @@ var init_i3s_node_page_loader = __esm({
23876
26045
  "dist/i3s/i3s-node-page-loader.js"() {
23877
26046
  "use strict";
23878
26047
  init_i3s_format();
23879
- VERSION11 = true ? "5.0.0-beta.2" : "latest";
26048
+ VERSION11 = true ? "5.0.0-beta.4" : "latest";
23880
26049
  I3SNodePageLoader = {
23881
26050
  ...I3SNodePageFormat,
23882
26051
  dataType: null,
@@ -24573,7 +26742,7 @@ var init_i3s_loader = __esm({
24573
26742
  init_i3s_format();
24574
26743
  init_i3s_content_loader();
24575
26744
  init_i3s_loader_options();
24576
- VERSION12 = true ? "5.0.0-beta.2" : "latest";
26745
+ VERSION12 = true ? "5.0.0-beta.4" : "latest";
24577
26746
  I3SLoader = {
24578
26747
  ...I3SFormat,
24579
26748
  dataType: null,
@@ -25978,11 +28147,11 @@ var init_compress_utils_compression = __esm({
25978
28147
  /** Shared import and WASM initialization for concurrent callers. */
25979
28148
  modulePromise = null;
25980
28149
  /** Creates a format-specific compress-utils encoder. */
25981
- constructor(metadata, loadModule, options = {}) {
28150
+ constructor(metadata2, loadModule, options = {}) {
25982
28151
  super(options);
25983
- this.name = metadata.name;
25984
- this.extensions = metadata.extensions || [];
25985
- this.contentEncodings = metadata.contentEncodings || [];
28152
+ this.name = metadata2.name;
28153
+ this.extensions = metadata2.extensions || [];
28154
+ this.contentEncodings = metadata2.contentEncodings || [];
25986
28155
  this.loadModule = loadModule;
25987
28156
  this.options = options;
25988
28157
  }
@@ -26041,11 +28210,11 @@ var init_compress_utils_compression = __esm({
26041
28210
  /** Shared import and WASM initialization for concurrent callers. */
26042
28211
  modulePromise = null;
26043
28212
  /** Creates a format-specific compress-utils decoder. */
26044
- constructor(metadata, loadModule, options = {}) {
28213
+ constructor(metadata2, loadModule, options = {}) {
26045
28214
  super(options);
26046
- this.name = metadata.name;
26047
- this.extensions = metadata.extensions || [];
26048
- this.contentEncodings = metadata.contentEncodings || [];
28215
+ this.name = metadata2.name;
28216
+ this.extensions = metadata2.extensions || [];
28217
+ this.contentEncodings = metadata2.contentEncodings || [];
26049
28218
  this.loadModule = loadModule;
26050
28219
  this.options = options;
26051
28220
  }
@@ -26569,12 +28738,12 @@ var init_zip_archive = __esm({
26569
28738
  maxDecodedBytes: options.maxDecodedBytes ?? DEFAULT_OPTIONS.maxDecodedBytes,
26570
28739
  chunkBytes: options.chunkBytes ?? DEFAULT_OPTIONS.chunkBytes
26571
28740
  };
26572
- for (const [name20, value] of Object.entries(this.limits)) {
28741
+ for (const [name22, value] of Object.entries(this.limits)) {
26573
28742
  const bigintLimit = ["maxArchiveBytes", "maxCompressedBytes", "maxDecodedBytes"].includes(
26574
- name20
28743
+ name22
26575
28744
  );
26576
28745
  if (bigintLimit ? typeof value !== "bigint" || value < 0n : typeof value !== "number" || !Number.isSafeInteger(value) || value < 1)
26577
- throw new RangeError(`Invalid ZIP ${name20} limit`);
28746
+ throw new RangeError(`Invalid ZIP ${name22} limit`);
26578
28747
  }
26579
28748
  this.signal = options.signal ? AbortSignal.any([this.controller.signal, options.signal]) : this.controller.signal;
26580
28749
  }
@@ -26693,17 +28862,17 @@ var init_zip_archive = __esm({
26693
28862
  const headers = [...(await this.getDirectory()).values()];
26694
28863
  return await this.getEntry(headers[headers.length - 1].path);
26695
28864
  }
26696
- const metadata = decodeZipHeader(bytes.subarray(positions[0]), true);
26697
- return await this.getValidatedEntry(metadata.localHeaderOffset, metadata);
28865
+ const metadata2 = decodeZipHeader(bytes.subarray(positions[0]), true);
28866
+ return await this.getValidatedEntry(metadata2.localHeaderOffset, metadata2);
26698
28867
  }
26699
28868
  /** Looks up a canonical path; returns undefined when the entry is absent. */
26700
28869
  async getEntry(path) {
26701
28870
  this.signal.throwIfAborted();
26702
- const metadata = (await this.getDirectory()).get(path);
26703
- if (!metadata) return void 0;
28871
+ const metadata2 = (await this.getDirectory()).get(path);
28872
+ if (!metadata2) return void 0;
26704
28873
  let promise = this.entriesByPath.get(path);
26705
28874
  if (!promise) {
26706
- promise = this.getValidatedEntry(metadata.localHeaderOffset, metadata).catch((error) => {
28875
+ promise = this.getValidatedEntry(metadata2.localHeaderOffset, metadata2).catch((error) => {
26707
28876
  this.entriesByPath.delete(path);
26708
28877
  throw error;
26709
28878
  });
@@ -26720,14 +28889,14 @@ var init_zip_archive = __esm({
26720
28889
  this.signal.throwIfAborted();
26721
28890
  const existing = this.entriesByOffset.get(localHeaderOffset);
26722
28891
  if (existing) return await existing;
26723
- const metadata = await this.readLocalHeader(localHeaderOffset);
26724
- if (metadata.header.flags & 8) {
28892
+ const metadata2 = await this.readLocalHeader(localHeaderOffset);
28893
+ if (metadata2.header.flags & 8) {
26725
28894
  for (const header of (await this.getDirectory()).values())
26726
28895
  if (header.localHeaderOffset === localHeaderOffset)
26727
28896
  return await this.getEntry(header.path);
26728
28897
  throw new Error("Invalid ZIP archive: indexed offset missing from directory");
26729
28898
  }
26730
- return await this.getValidatedEntry(localHeaderOffset, void 0, metadata);
28899
+ return await this.getValidatedEntry(localHeaderOffset, void 0, metadata2);
26731
28900
  }
26732
28901
  /** Reads one complete entry and verifies its decoded size and CRC-32. */
26733
28902
  async read(entryOrPath, options = {}) {
@@ -26977,31 +29146,31 @@ var init_zip_archive = __esm({
26977
29146
  /** Validates local/central identity, payload bounds and signed or unsigned descriptors. */
26978
29147
  async validateEntry(offset, central, localMetadata) {
26979
29148
  const { header: local, dataOffset } = localMetadata ?? await this.readLocalHeader(offset);
26980
- const metadata = central || local;
29149
+ const metadata2 = central || local;
26981
29150
  const descriptor = Boolean(local.flags & 8);
26982
29151
  if (central && (central.flags !== local.flags || central.method !== local.method || central.nameBytes.length !== local.nameBytes.length || central.nameBytes.some((value, index) => value !== local.nameBytes[index]) || !descriptor && (central.crc32 !== local.crc32 || central.size !== local.size || central.compressedSize !== local.compressedSize)))
26983
29152
  throw new Error("Invalid ZIP archive: local/central metadata mismatch");
26984
- if (metadata.method === 0 && metadata.size !== metadata.compressedSize)
29153
+ if (metadata2.method === 0 && metadata2.size !== metadata2.compressedSize)
26985
29154
  throw new Error("Invalid ZIP archive: STORE sizes mismatch");
26986
29155
  if (central && descriptor && (local.crc32 !== 0 && local.crc32 !== central.crc32 || local.size !== 0n && local.size !== central.size || local.compressedSize !== 0n && local.compressedSize !== central.compressedSize))
26987
29156
  throw new Error("Invalid ZIP archive: descriptor local/central metadata mismatch");
26988
- const payloadEnd = dataOffset + metadata.compressedSize;
29157
+ const payloadEnd = dataOffset + metadata2.compressedSize;
26989
29158
  const entryEnd = central ? this.nextOffsets.get(offset) ?? this.directory.offset : this.directory.offset;
26990
29159
  if (payloadEnd > entryEnd) throw new Error("Invalid ZIP archive: payload overlaps directory");
26991
29160
  if (descriptor)
26992
29161
  await this.validateDescriptor(
26993
29162
  payloadEnd,
26994
- metadata,
29163
+ metadata2,
26995
29164
  local.zip64 || Boolean(central == null ? void 0 : central.zip64),
26996
29165
  entryEnd
26997
29166
  );
26998
29167
  const entry = Object.freeze({
26999
- path: metadata.path,
27000
- directory: metadata.path.endsWith("/"),
27001
- compression: metadata.method === 0 ? "store" : "deflate",
27002
- size: metadata.size,
27003
- compressedSize: metadata.compressedSize,
27004
- crc32: metadata.crc32,
29168
+ path: metadata2.path,
29169
+ directory: metadata2.path.endsWith("/"),
29170
+ compression: metadata2.method === 0 ? "store" : "deflate",
29171
+ size: metadata2.size,
29172
+ compressedSize: metadata2.compressedSize,
29173
+ crc32: metadata2.crc32,
27005
29174
  localHeaderOffset: offset,
27006
29175
  dataOffset,
27007
29176
  comment: (central == null ? void 0 : central.comment) || ""
@@ -27010,18 +29179,18 @@ var init_zip_archive = __esm({
27010
29179
  return entry;
27011
29180
  }
27012
29181
  /** Resolves the optional descriptor signature using the expected CRC and sizes. */
27013
- async validateDescriptor(offset, metadata, zip64, entryEnd) {
29182
+ async validateDescriptor(offset, metadata2, zip64, entryEnd) {
27014
29183
  const length = Number(minimumBigInt(24n, entryEnd - offset));
27015
29184
  const bytes = new DataView(await this.readExact(offset, length));
27016
29185
  for (const wide of zip64 ? [true, false] : [false, true]) {
27017
- if (!wide && (metadata.size > 0xffffffffn || metadata.compressedSize > 0xffffffffn)) continue;
29186
+ if (!wide && (metadata2.size > 0xffffffffn || metadata2.compressedSize > 0xffffffffn)) continue;
27018
29187
  const descriptorLength = wide ? 20 : 12;
27019
29188
  for (const prefix of [4, 0]) {
27020
29189
  if (length < prefix + descriptorLength || prefix && bytes.getUint32(0, true) !== 134695760)
27021
29190
  continue;
27022
29191
  const compressed = wide ? bytes.getBigUint64(prefix + 4, true) : BigInt(bytes.getUint32(prefix + 4, true));
27023
29192
  const decoded = wide ? bytes.getBigUint64(prefix + 12, true) : BigInt(bytes.getUint32(prefix + 8, true));
27024
- if (bytes.getUint32(prefix, true) === metadata.crc32 && compressed === metadata.compressedSize && decoded === metadata.size)
29193
+ if (bytes.getUint32(prefix, true) === metadata2.crc32 && compressed === metadata2.compressedSize && decoded === metadata2.size)
27025
29194
  return;
27026
29195
  }
27027
29196
  }
@@ -27173,11 +29342,11 @@ var init_native_decompressor = __esm({
27173
29342
  isSupported = true;
27174
29343
  /** Runtime stream format used for every operation. */
27175
29344
  format;
27176
- constructor(metadata, format, options = {}) {
29345
+ constructor(metadata2, format, options = {}) {
27177
29346
  super(options);
27178
- this.name = metadata.name;
27179
- this.extensions = [...metadata.extensions];
27180
- this.contentEncodings = [...metadata.contentEncodings];
29347
+ this.name = metadata2.name;
29348
+ this.extensions = [...metadata2.extensions];
29349
+ this.contentEncodings = [...metadata2.contentEncodings];
27181
29350
  this.format = format;
27182
29351
  }
27183
29352
  /** Decompresses one buffer with the runtime-provided stream. */
@@ -27223,11 +29392,11 @@ var init_lazy_compression = __esm({
27223
29392
  implementation = null;
27224
29393
  /** Shared in-flight selection used by concurrent asynchronous calls. */
27225
29394
  implementationPromise = null;
27226
- constructor(metadata, loadFallback, options = {}, nativeFormat = null, shouldUseNative = () => true) {
29395
+ constructor(metadata2, loadFallback, options = {}, nativeFormat = null, shouldUseNative = () => true) {
27227
29396
  super(options);
27228
- this.name = metadata.name;
27229
- this.extensions = [...metadata.extensions];
27230
- this.contentEncodings = [...metadata.contentEncodings];
29397
+ this.name = metadata2.name;
29398
+ this.extensions = [...metadata2.extensions];
29399
+ this.contentEncodings = [...metadata2.contentEncodings];
27231
29400
  this.options = options;
27232
29401
  this.nativeFormat = nativeFormat;
27233
29402
  this.shouldUseNative = shouldUseNative;
@@ -27540,7 +29709,7 @@ var init_i3s_slpk_loader = __esm({
27540
29709
  "dist/i3s/i3s-slpk-loader.js"() {
27541
29710
  "use strict";
27542
29711
  init_i3s_format();
27543
- VERSION14 = true ? "5.0.0-beta.2" : "latest";
29712
+ VERSION14 = true ? "5.0.0-beta.4" : "latest";
27544
29713
  SLPKLoader = {
27545
29714
  ...SLPKFormat,
27546
29715
  dataType: null,
@@ -27881,7 +30050,7 @@ var init_i3s_attribute_loader = __esm({
27881
30050
  "dist/i3s/i3s-attribute-loader.js"() {
27882
30051
  "use strict";
27883
30052
  init_i3s_format();
27884
- VERSION16 = true ? "5.0.0-beta.2" : "latest";
30053
+ VERSION16 = true ? "5.0.0-beta.4" : "latest";
27885
30054
  I3SAttributeLoader = {
27886
30055
  ...I3SAttributeFormat,
27887
30056
  dataType: null,
@@ -27973,7 +30142,7 @@ var init_i3s_building_scene_layer_loader = __esm({
27973
30142
  "dist/i3s/i3s-building-scene-layer-loader.js"() {
27974
30143
  "use strict";
27975
30144
  init_i3s_format();
27976
- VERSION17 = true ? "5.0.0-beta.2" : "latest";
30145
+ VERSION17 = true ? "5.0.0-beta.4" : "latest";
27977
30146
  I3SBuildingSceneLayerLoader = {
27978
30147
  ...I3SBuildingSceneLayerFormat,
27979
30148
  dataType: null,
@@ -28111,7 +30280,7 @@ var init_arcgis_webscene_loader = __esm({
28111
30280
  "dist/i3s/arcgis-webscene-loader.js"() {
28112
30281
  "use strict";
28113
30282
  init_i3s_format();
28114
- VERSION18 = true ? "5.0.0-beta.2" : "latest";
30283
+ VERSION18 = true ? "5.0.0-beta.4" : "latest";
28115
30284
  ArcGISWebSceneLoader = {
28116
30285
  ...ArcGISWebSceneFormat,
28117
30286
  dataType: null,
@@ -28291,7 +30460,7 @@ init_i3s_loader();
28291
30460
  // dist/i3s/i3s-slpk-writer.js
28292
30461
  init_indexed_zip_writer();
28293
30462
  init_i3s_format();
28294
- var VERSION13 = true ? "5.0.0-beta.2" : "latest";
30463
+ var VERSION13 = true ? "5.0.0-beta.4" : "latest";
28295
30464
  var MAX_ARCHIVE_BYTES = 2147483647;
28296
30465
  var SLPKWriter = {
28297
30466
  ...SLPKFormat,
@@ -28363,7 +30532,7 @@ init_i3s_content_loader();
28363
30532
 
28364
30533
  // dist/i3s/i3s-lepcc-loader-types.js
28365
30534
  init_i3s_format();
28366
- var VERSION15 = true ? "5.0.0-beta.2" : "latest";
30535
+ var VERSION15 = true ? "5.0.0-beta.4" : "latest";
28367
30536
  var I3SLEPCCLoader = {
28368
30537
  ...I3SLEPCCFormat,
28369
30538
  dataType: null,
@@ -28407,7 +30576,7 @@ async function customizeColors(colors, featureIds, attributeUrls, fields, attrib
28407
30576
  setFloat16Value(resultColors.value, index, getFloat16Value(colors.value, index));
28408
30577
  }
28409
30578
  }
28410
- const colorizeAttributeField = fields.find(({ name: name20 }) => name20 === (colorsByAttribute == null ? void 0 : colorsByAttribute.attributeName));
30579
+ const colorizeAttributeField = fields.find(({ name: name22 }) => name22 === (colorsByAttribute == null ? void 0 : colorsByAttribute.attributeName));
28411
30580
  if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
28412
30581
  return colors;
28413
30582
  }
@@ -28475,7 +30644,7 @@ function calculateColorForAttribute(attributeValue, colorsByAttribute) {
28475
30644
  return color;
28476
30645
  }
28477
30646
  async function loadFeatureAttributeData(attributeName, attributeUrls, attributeStorageInfo, token, options = {}) {
28478
- const attributeIndex = attributeStorageInfo.findIndex(({ name: name20 }) => attributeName === name20);
30647
+ const attributeIndex = attributeStorageInfo.findIndex(({ name: name22 }) => attributeName === name22);
28479
30648
  if (attributeIndex === -1) {
28480
30649
  return null;
28481
30650
  }
@@ -29633,17 +31802,17 @@ function createI3SLayerSource(url, layer, options = {}, coreApi) {
29633
31802
  init_src();
29634
31803
  function prepareI3SMeshTexture(attribute, vertexCount, texture) {
29635
31804
  if (texture) {
29636
- if (!(texture.data instanceof Uint8Array) || Object.keys(texture).some((name20) => !["data", "mimeType", "sampler", "transform"].includes(name20)))
31805
+ if (!(texture.data instanceof Uint8Array) || Object.keys(texture).some((name22) => !["data", "mimeType", "sampler", "transform"].includes(name22)))
29637
31806
  throw new Error("Invalid I3S base-color texture");
29638
- let metadata;
31807
+ let metadata2;
29639
31808
  try {
29640
- metadata = getBinaryImageMetadata(new DataView(texture.data.buffer, texture.data.byteOffset, texture.data.byteLength));
31809
+ metadata2 = getBinaryImageMetadata(new DataView(texture.data.buffer, texture.data.byteOffset, texture.data.byteLength));
29641
31810
  } catch {
29642
31811
  }
29643
- if (!metadata || metadata.mimeType !== texture.mimeType || !["image/png", "image/jpeg"].includes(texture.mimeType) || metadata.width <= 0 || metadata.height <= 0)
31812
+ if (!metadata2 || metadata2.mimeType !== texture.mimeType || !["image/png", "image/jpeg"].includes(texture.mimeType) || metadata2.width <= 0 || metadata2.height <= 0)
29644
31813
  throw new Error("I3S texture header must match a PNG/JPEG mimeType and positive dimensions");
29645
31814
  const sampler = texture.sampler;
29646
- if (sampler && (Object.keys(sampler).some((name20) => !["wrapS", "wrapT", "magFilter", "minFilter"].includes(name20)) || sampler.magFilter !== void 0 || sampler.minFilter !== void 0 || [sampler.wrapS, sampler.wrapT].some((value) => value !== void 0 && ![33071, 33648, 10497].includes(value))))
31815
+ if (sampler && (Object.keys(sampler).some((name22) => !["wrapS", "wrapT", "magFilter", "minFilter"].includes(name22)) || sampler.magFilter !== void 0 || sampler.minFilter !== void 0 || [sampler.wrapS, sampler.wrapT].some((value) => value !== void 0 && ![33071, 33648, 10497].includes(value))))
29647
31816
  throw new Error("I3S texture profile supports wrapping, but not explicit filtering");
29648
31817
  }
29649
31818
  if (!attribute) {
@@ -29656,7 +31825,7 @@ function prepareI3SMeshTexture(attribute, vertexCount, texture) {
29656
31825
  if (attribute.size !== 2 || values.length !== vertexCount * 2 || !(values instanceof Float32Array || normalized) || attribute.normalized && !normalized || attribute.byteOffset || attribute.byteStride || attribute.transform || attribute.componentType || values.some((value) => !Number.isFinite(value)))
29657
31826
  throw new Error("I3S TEXCOORD_0 requires finite packed Float32 or normalized unsigned UV pairs");
29658
31827
  const transform = texture == null ? void 0 : texture.transform;
29659
- if (transform && Object.keys(transform).some((name20) => !["offset", "rotation", "scale"].includes(name20)))
31828
+ if (transform && Object.keys(transform).some((name22) => !["offset", "rotation", "scale"].includes(name22)))
29660
31829
  throw new Error("Unsupported I3S texture transform");
29661
31830
  const offset = (transform == null ? void 0 : transform.offset) || [0, 0];
29662
31831
  const scale = (transform == null ? void 0 : transform.scale) || [1, 1];
@@ -29808,10 +31977,10 @@ function encodeNumericValues(values, type, maxBytes) {
29808
31977
  }
29809
31978
  return output;
29810
31979
  }
29811
- function makeStorage(key, name20, valueType) {
31980
+ function makeStorage(key, name22, valueType) {
29812
31981
  return {
29813
31982
  key,
29814
- name: name20,
31983
+ name: name22,
29815
31984
  header: [
29816
31985
  { property: "count", valueType: "UInt32" },
29817
31986
  ...valueType === "String" ? [{ property: "attributeValuesByteCount", valueType: "UInt32" }] : []
@@ -29919,9 +32088,9 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
29919
32088
  if (mesh.topology !== "triangle-list" || mesh.mode !== 4 || !positions || positions.size !== 3 || !(positions.value instanceof Float32Array || positions.value instanceof Float64Array) || positions.value.length === 0 || positions.value.length % 3 || positions.value.some((value) => !Number.isFinite(value))) {
29920
32089
  throw new Error("I3S mesh writing requires finite packed triangle positions");
29921
32090
  }
29922
- for (const [name20, attribute] of Object.entries(mesh.attributes)) {
29923
- if (!["POSITION", "NORMAL", "TEXCOORD_0"].includes(name20) || attribute.byteOffset || attribute.byteStride || attribute.normalized && name20 !== "TEXCOORD_0" || attribute.transform || attribute.componentType) {
29924
- throw new Error(`Unsupported I3S mesh attribute/layout: ${name20}`);
32091
+ for (const [name22, attribute] of Object.entries(mesh.attributes)) {
32092
+ if (!["POSITION", "NORMAL", "TEXCOORD_0"].includes(name22) || attribute.byteOffset || attribute.byteStride || attribute.normalized && name22 !== "TEXCOORD_0" || attribute.transform || attribute.componentType) {
32093
+ throw new Error(`Unsupported I3S mesh attribute/layout: ${name22}`);
29925
32094
  }
29926
32095
  }
29927
32096
  const normals = mesh.attributes.NORMAL;
@@ -30147,7 +32316,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
30147
32316
  ]
30148
32317
  };
30149
32318
  const rawFiles = { "nodes/1/geometries/0.bin.gz": geometry };
30150
- for (const [name20, json2] of Object.entries({
32319
+ for (const [name22, json2] of Object.entries({
30151
32320
  "3dSceneLayer.json.gz": layer,
30152
32321
  "nodes/root/3dNodeIndexDocument.json.gz": root,
30153
32322
  "nodes/1/3dNodeIndexDocument.json.gz": leaf,
@@ -30160,7 +32329,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
30160
32329
  nodeCount: 2
30161
32330
  }
30162
32331
  })) {
30163
- rawFiles[name20] = new TextEncoder().encode(JSON.stringify(json2)).buffer;
32332
+ rawFiles[name22] = new TextEncoder().encode(JSON.stringify(json2)).buffer;
30164
32333
  }
30165
32334
  const objectIds = options.features ? attributes.buffers[0].slice(0) : encodeDefaultObjectId();
30166
32335
  const objectIdView = new DataView(objectIds);
@@ -30182,10 +32351,10 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
30182
32351
  function compressMeshLayer(prepared, maxResourceBytes) {
30183
32352
  const compressor = MESH_GZIP_COMPRESSOR;
30184
32353
  const files = {};
30185
- for (const [name20, bytes] of Object.entries(prepared.files)) {
32354
+ for (const [name22, bytes] of Object.entries(prepared.files)) {
30186
32355
  if (bytes.byteLength > maxResourceBytes)
30187
32356
  throw new Error("I3S resource exceeds maxResourceBytes");
30188
- files[name20] = name20.endsWith(".gz") ? compressor.compressSync(bytes) : bytes;
32357
+ files[name22] = name22.endsWith(".gz") ? compressor.compressSync(bytes) : bytes;
30189
32358
  }
30190
32359
  return { ...prepared, files };
30191
32360
  }
@@ -30198,8 +32367,8 @@ function getMeshTriangles(attributes, indices) {
30198
32367
  ];
30199
32368
  const triangles = [];
30200
32369
  for (let index = 0; index < indices.length; index += 3) {
30201
- const vertices = [0, 1, 2].map((corner) => names.map((name20) => {
30202
- const attribute = attributes[name20];
32370
+ const vertices = [0, 1, 2].map((corner) => names.map((name22) => {
32371
+ const attribute = attributes[name22];
30203
32372
  return Array.from({ length: attribute.size }, (_, component) => attribute.value[indices[index + corner] * attribute.size + component]).join(",");
30204
32373
  }).join("|"));
30205
32374
  triangles.push([0, 1, 2].map((corner) => [...vertices.slice(corner), ...vertices.slice(0, corner)].join(";")).sort()[0]);
@@ -30213,7 +32382,7 @@ function encodeDefaultObjectId() {
30213
32382
  }
30214
32383
  function encodeMaterial(material = {}) {
30215
32384
  var _a, _b;
30216
- if (Object.keys(material).some((name20) => ![
32385
+ if (Object.keys(material).some((name22) => ![
30217
32386
  "baseColorFactor",
30218
32387
  "baseColorTexture",
30219
32388
  "metallicFactor",
@@ -30221,7 +32390,7 @@ function encodeMaterial(material = {}) {
30221
32390
  "alphaMode",
30222
32391
  "alphaCutoff",
30223
32392
  "doubleSided"
30224
- ].includes(name20)))
32393
+ ].includes(name22)))
30225
32394
  throw new Error("Unsupported I3S material property");
30226
32395
  const { baseColorFactor, metallicFactor, roughnessFactor, alphaMode, alphaCutoff, doubleSided } = material;
30227
32396
  if (baseColorFactor !== void 0 && (baseColorFactor.length !== 4 || baseColorFactor.some((value) => !Number.isFinite(value) || value < 0 || value > 1)) || [metallicFactor, roughnessFactor].some((value) => value !== void 0 && (!Number.isFinite(value) || value < 0 || value > 1)) || alphaMode !== void 0 && !["OPAQUE", "MASK", "BLEND"].includes(alphaMode) || alphaCutoff !== void 0 && (alphaMode !== "MASK" || !Number.isFinite(alphaCutoff) || alphaCutoff < 0) || doubleSided !== void 0 && typeof doubleSided !== "boolean")