@shopware-ag/dive 3.0.3 → 3.0.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/build/chunks/{AssetCache-BUet32OG.mjs → AssetCache-BFmlE2RL.mjs} +1 -1
  2. package/build/chunks/{AssetCache-Dhi6x0l3.cjs → AssetCache-DJljWMMu.cjs} +1 -1
  3. package/build/chunks/AssetLoader-BBYvjZmA.cjs +3 -0
  4. package/build/chunks/AssetLoader-BxeffaLI.mjs +663 -0
  5. package/build/chunks/{FileTypes-smInt9po.mjs → FileTypes-BWLS6Iwg.mjs} +1 -1
  6. package/build/chunks/{FileTypes-DiwbBQ8N.cjs → FileTypes-Cus1xgpl.cjs} +1 -1
  7. package/build/chunks/{isFileTypeSupported-4wdgLa3R.mjs → isFileTypeSupported-BoTjyPbV.mjs} +1 -1
  8. package/build/chunks/{isFileTypeSupported-DJrJlL4K.cjs → isFileTypeSupported-DChhxeep.cjs} +1 -1
  9. package/build/dive.cjs +1 -1
  10. package/build/dive.mjs +2 -2
  11. package/build/plugins/ar/index.cjs +1 -1
  12. package/build/plugins/ar/index.mjs +1 -1
  13. package/build/plugins/assetcache/index.cjs +1 -1
  14. package/build/plugins/assetcache/index.mjs +1 -1
  15. package/build/plugins/assetloader/index.cjs +1 -1
  16. package/build/plugins/assetloader/index.mjs +2 -2
  17. package/build/plugins/assetloader/src/loader/AssetLoader.d.ts +2 -0
  18. package/build/plugins/orbitcontroller/index.cjs +1 -1
  19. package/build/plugins/orbitcontroller/index.mjs +1 -1
  20. package/build/plugins/orientationdisplay/index.cjs +1 -1
  21. package/build/plugins/orientationdisplay/index.mjs +1 -1
  22. package/build/plugins/quickview/index.cjs +1 -1
  23. package/build/plugins/quickview/index.mjs +1 -1
  24. package/build/plugins/state/index.cjs +1 -1
  25. package/build/plugins/state/index.mjs +1 -1
  26. package/build/plugins/toolbox/index.cjs +1 -1
  27. package/build/plugins/toolbox/index.mjs +1 -1
  28. package/package.json +1 -1
  29. package/build/chunks/AssetLoader-ClY_NYr-.cjs +0 -3
  30. package/build/chunks/AssetLoader-EA8JPhJt.mjs +0 -499
@@ -0,0 +1,663 @@
1
+ var T = Object.defineProperty;
2
+ var I = (u, t, o) => t in u ? T(u, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : u[t] = o;
3
+ var _ = (u, t, o) => I(u, typeof t != "symbol" ? t + "" : t, o);
4
+ import { GLTFLoader as P } from "three/examples/jsm/loaders/GLTFLoader.js";
5
+ import { USDLoader as U } from "three/examples/jsm/loaders/USDLoader.js";
6
+ import { S as k } from "./FileTypes-BWLS6Iwg.mjs";
7
+ import { Group as S, BufferGeometry as F, BufferAttribute as D, MeshStandardMaterial as N, Mesh as G } from "three/webgpu";
8
+ import "three/examples/jsm/loaders/HDRLoader.js";
9
+ import "three/tsl";
10
+ import { g as v, i as W } from "./isFileTypeSupported-BoTjyPbV.mjs";
11
+ import { F as C, P as R } from "./parse-error-DfOPyLWM.mjs";
12
+ import { DRACOLoader as B } from "three/examples/jsm/loaders/DRACOLoader.js";
13
+ import { A as L } from "./AssetCache-BFmlE2RL.mjs";
14
+ function H() {
15
+ let u, t;
16
+ onmessage = function(s) {
17
+ const n = s.data;
18
+ switch (n.type) {
19
+ case "init":
20
+ u = n.decoderConfig, t = new Promise(function(c) {
21
+ u.onModuleLoaded = function(h) {
22
+ c({ draco: h });
23
+ }, DracoDecoderModule(u);
24
+ });
25
+ break;
26
+ case "decode":
27
+ const a = n.buffer, l = n.taskConfig;
28
+ t.then((c) => {
29
+ const h = c.draco, d = new h.Decoder();
30
+ try {
31
+ const f = o(
32
+ h,
33
+ d,
34
+ new Int8Array(a),
35
+ l
36
+ ), p = f.attributes.map(
37
+ (g) => g.array.buffer
38
+ );
39
+ f.index && p.push(f.index.array.buffer), self.postMessage(
40
+ { type: "decode", id: n.id, geometry: f },
41
+ p
42
+ );
43
+ } catch (f) {
44
+ console.error(f), self.postMessage({
45
+ type: "error",
46
+ id: n.id,
47
+ error: f.message
48
+ });
49
+ } finally {
50
+ h.destroy(d);
51
+ }
52
+ });
53
+ break;
54
+ }
55
+ };
56
+ function o(s, n, a, l) {
57
+ const c = l.attributeIDs, h = l.attributeTypes;
58
+ let d, f;
59
+ const p = n.GetEncodedGeometryType(a);
60
+ if (p === s.TRIANGULAR_MESH)
61
+ d = new s.Mesh(), f = n.DecodeArrayToMesh(
62
+ a,
63
+ a.byteLength,
64
+ d
65
+ );
66
+ else if (p === s.POINT_CLOUD)
67
+ d = new s.PointCloud(), f = n.DecodeArrayToPointCloud(
68
+ a,
69
+ a.byteLength,
70
+ d
71
+ );
72
+ else
73
+ throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
74
+ if (!f.ok() || d.ptr === 0)
75
+ throw new Error(
76
+ "THREE.DRACOLoader: Decoding failed: " + f.error_msg()
77
+ );
78
+ const g = { index: null, attributes: [] };
79
+ for (const m in c) {
80
+ const w = self[h[m]];
81
+ let A, y;
82
+ if (l.useUniqueIDs)
83
+ y = c[m], A = n.GetAttributeByUniqueId(
84
+ d,
85
+ y
86
+ );
87
+ else {
88
+ if (y = n.GetAttributeId(
89
+ d,
90
+ s[c[m]]
91
+ ), y === -1) continue;
92
+ A = n.GetAttribute(d, y);
93
+ }
94
+ const b = e(
95
+ s,
96
+ n,
97
+ d,
98
+ m,
99
+ w,
100
+ A
101
+ );
102
+ m === "color" && (b.vertexColorSpace = l.vertexColorSpace), g.attributes.push(b);
103
+ }
104
+ return p === s.TRIANGULAR_MESH && (g.index = r(s, n, d)), s.destroy(d), g;
105
+ }
106
+ function r(s, n, a) {
107
+ const c = a.num_faces() * 3, h = c * 4, d = s._malloc(h);
108
+ n.GetTrianglesUInt32Array(a, h, d);
109
+ const f = new Uint32Array(
110
+ s.HEAPF32.buffer,
111
+ d,
112
+ c
113
+ ).slice();
114
+ return s._free(d), { array: f, itemSize: 1 };
115
+ }
116
+ function e(s, n, a, l, c, h) {
117
+ const d = h.num_components(), p = a.num_points() * d, g = p * c.BYTES_PER_ELEMENT, m = i(s, c), w = s._malloc(g);
118
+ n.GetAttributeDataArrayForAllPoints(
119
+ a,
120
+ h,
121
+ m,
122
+ g,
123
+ w
124
+ );
125
+ const A = new c(
126
+ s.HEAPF32.buffer,
127
+ w,
128
+ p
129
+ ).slice();
130
+ return s._free(w), {
131
+ name: l,
132
+ array: A,
133
+ itemSize: d
134
+ };
135
+ }
136
+ function i(s, n) {
137
+ switch (n) {
138
+ case Float32Array:
139
+ return s.DT_FLOAT32;
140
+ case Int8Array:
141
+ return s.DT_INT8;
142
+ case Int16Array:
143
+ return s.DT_INT16;
144
+ case Int32Array:
145
+ return s.DT_INT32;
146
+ case Uint8Array:
147
+ return s.DT_UINT8;
148
+ case Uint16Array:
149
+ return s.DT_UINT16;
150
+ case Uint32Array:
151
+ return s.DT_UINT32;
152
+ }
153
+ }
154
+ }
155
+ const E = {
156
+ LOAD_DRACO_JS_DECODER: async () => (await import("three/examples/jsm/libs/draco/draco_decoder.js?raw")).default,
157
+ LOAD_DRACO_WASM_WRAPPER: async () => (await import("three/examples/jsm/libs/draco/draco_wasm_wrapper.js?raw")).default,
158
+ LOAD_DRACO_WASM_DECODER: async () => {
159
+ const u = (await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;
160
+ return await (await fetch(u)).arrayBuffer();
161
+ }
162
+ };
163
+ class j extends B {
164
+ constructor() {
165
+ super(...arguments);
166
+ _(this, "decoderPending", null);
167
+ _(this, "decoderConfig", {
168
+ type: "js",
169
+ wasmBinary: null
170
+ });
171
+ _(this, "workerSourceURL", "");
172
+ }
173
+ async _initDecoder() {
174
+ if (this.decoderPending) return this.decoderPending;
175
+ const o = typeof WebAssembly != "object" || this.decoderConfig.type === "js", r = [];
176
+ return o ? r.push(
177
+ E.LOAD_DRACO_JS_DECODER()
178
+ ) : (r.push(
179
+ E.LOAD_DRACO_WASM_WRAPPER()
180
+ ), r.push(
181
+ E.LOAD_DRACO_WASM_DECODER()
182
+ )), this.decoderPending = Promise.all(r).then(
183
+ (e) => {
184
+ const i = e[0];
185
+ o || (this.decoderConfig.wasmBinary = e[1]);
186
+ const s = H.toString(), n = [
187
+ "/* draco decoder */",
188
+ i,
189
+ "",
190
+ "/* worker */",
191
+ s.substring(s.indexOf("{") + 1, s.lastIndexOf("}"))
192
+ ].join(`
193
+ `);
194
+ this.workerSourceURL = URL.createObjectURL(new Blob([n]));
195
+ }
196
+ ), this.decoderPending;
197
+ }
198
+ }
199
+ function z() {
200
+ let u = null, t = null;
201
+ const o = [
202
+ [
203
+ /'CONFIG_CONTROL_DESIGN'\s*\)/g,
204
+ "'AP203_CONFIGURATION_CONTROLLED_3D_DESIGN_OF_MECHANICAL_PARTS_AND_ASSEMBLIES_MIM_LF')"
205
+ ],
206
+ [
207
+ /'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF\.\s*\{[\s\S]*?\}\s*'/g,
208
+ "'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'"
209
+ ]
210
+ ];
211
+ function r() {
212
+ return u || (u = occtimportjs({
213
+ // eslint-disable-line no-undef
214
+ locateFile: function() {
215
+ return t;
216
+ }
217
+ })), u;
218
+ }
219
+ function e(s) {
220
+ for (var n = new TextDecoder("utf-8", { fatal: !1 }), a = new TextEncoder(), l = n.decode(s), c = 0; c < o.length; c++) {
221
+ var h = o[c][0], d = o[c][1];
222
+ l = l.replace(h, d);
223
+ }
224
+ return new Uint8Array(a.encode(l));
225
+ }
226
+ function i(s, n) {
227
+ var a = e(n);
228
+ try {
229
+ var l = s.ReadStepFile(a, null);
230
+ if (l.success && l.root) return l;
231
+ } catch {
232
+ }
233
+ try {
234
+ return s.ReadStepFile(n, null);
235
+ } catch {
236
+ return {
237
+ success: !1,
238
+ root: { meshes: [], children: [] },
239
+ meshes: []
240
+ };
241
+ }
242
+ }
243
+ onmessage = async function(s) {
244
+ var n = s.data;
245
+ switch (n.type) {
246
+ case "init":
247
+ t = n.wasmUrl;
248
+ break;
249
+ case "parse":
250
+ try {
251
+ var a = await r(), l = new Uint8Array(n.buffer), c = n.fileType, h;
252
+ if (c === "step" || c === "stp" ? h = i(a, l) : h = a.ReadIgesFile(l, null), !h.success || !h.root) {
253
+ self.postMessage({
254
+ type: "error",
255
+ id: n.id,
256
+ error: "Failed to parse CAD file"
257
+ });
258
+ return;
259
+ }
260
+ self.postMessage({
261
+ type: "result",
262
+ id: n.id,
263
+ result: h
264
+ });
265
+ } catch (d) {
266
+ self.postMessage({
267
+ type: "error",
268
+ id: n.id,
269
+ error: d instanceof Error ? d.message : String(d)
270
+ });
271
+ }
272
+ break;
273
+ }
274
+ };
275
+ }
276
+ const O = {
277
+ LOAD_OCCT_JS: async () => (await import("./occt-import-js-D-bjjBtk.mjs")).default,
278
+ LOAD_OCCT_WASM_URL: async () => (await import("./occt-import-js-ekuHaP1Z.mjs")).default
279
+ };
280
+ class J {
281
+ constructor() {
282
+ _(this, "_workerPending", null);
283
+ _(this, "_worker", null);
284
+ _(this, "_nextId", 0);
285
+ _(this, "_pending", /* @__PURE__ */ new Map());
286
+ }
287
+ /**
288
+ * Create (or return existing) blob-URL worker.
289
+ * Loads occt-import-js JS as raw text, concatenates with STEPWorker
290
+ * function body, and creates a classic (non-module) worker.
291
+ */
292
+ _getWorker() {
293
+ return this._workerPending ? this._workerPending : (this._workerPending = (async () => {
294
+ const [
295
+ t,
296
+ o
297
+ ] = await Promise.all([
298
+ O.LOAD_OCCT_JS(),
299
+ O.LOAD_OCCT_WASM_URL()
300
+ ]), r = z.toString(), e = [
301
+ "/* occt-import-js */",
302
+ t,
303
+ "",
304
+ "/* step worker */",
305
+ r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
306
+ ].join(`
307
+ `), i = URL.createObjectURL(new Blob([e])), s = new Worker(i), n = new URL(o, window.location.href).href;
308
+ return s.postMessage({ type: "init", wasmUrl: n }), s.onmessage = (a) => {
309
+ const { type: l, id: c, result: h, error: d } = a.data, f = this._pending.get(c);
310
+ if (f)
311
+ if (this._pending.delete(c), l === "result")
312
+ try {
313
+ f.resolve(this._buildScene(h));
314
+ } catch (p) {
315
+ f.reject(
316
+ p instanceof Error ? p : new Error(String(p))
317
+ );
318
+ }
319
+ else
320
+ f.reject(new Error(d ?? "Worker error"));
321
+ }, s.onerror = (a) => {
322
+ for (const [
323
+ ,
324
+ { reject: l }
325
+ ] of this._pending)
326
+ l(new Error(a.message ?? "Worker error"));
327
+ this._pending.clear();
328
+ }, this._worker = s, s;
329
+ })(), this._workerPending);
330
+ }
331
+ /**
332
+ * Parse STEP or IGES file content and return a Three.js Object3D
333
+ */
334
+ async parseAsync(t, o) {
335
+ const r = this._nextId++, e = await this._getWorker();
336
+ return new Promise((i, s) => {
337
+ this._pending.set(r, { resolve: i, reject: s });
338
+ const n = t.slice(0);
339
+ e.postMessage({ type: "parse", id: r, buffer: n, fileType: o }, [
340
+ n
341
+ ]);
342
+ });
343
+ }
344
+ /**
345
+ * Dispose the worker. Call when the loader is no longer needed.
346
+ */
347
+ dispose() {
348
+ if (this._worker) {
349
+ for (const [
350
+ ,
351
+ { reject: t }
352
+ ] of this._pending)
353
+ t(new Error("STEPLoader disposed"));
354
+ this._pending.clear(), this._worker.terminate(), this._worker = null, this._workerPending = null;
355
+ }
356
+ }
357
+ _buildScene(t) {
358
+ const o = new S();
359
+ return o.name = t.root.name ?? "CAD Model", this._buildNode(t.root, t.meshes, o), o.rotation.x = -Math.PI / 2, o.rotation.z = Math.PI / 2, o;
360
+ }
361
+ _buildNode(t, o, r) {
362
+ const e = new S();
363
+ e.name = t.name ?? "Part";
364
+ for (const i of t.meshes) {
365
+ const s = o[i];
366
+ if (s != null && s.attributes) {
367
+ const n = this._createMesh(s);
368
+ e.add(n);
369
+ }
370
+ }
371
+ for (const i of t.children)
372
+ this._buildNode(i, o, e);
373
+ r.add(e);
374
+ }
375
+ _createMesh(t) {
376
+ var l, c;
377
+ const { position: o, normal: r } = t.attributes, e = t.index ?? t.attributes.index, i = new F();
378
+ i.setAttribute(
379
+ "position",
380
+ new D(new Float32Array(o.array), 3)
381
+ ), (l = r == null ? void 0 : r.array) != null && l.length ? i.setAttribute(
382
+ "normal",
383
+ new D(new Float32Array(r.array), 3)
384
+ ) : i.computeVertexNormals(), (c = e == null ? void 0 : e.array) != null && c.length && i.setIndex(
385
+ new D(new Uint32Array(e.array), 1)
386
+ );
387
+ const s = t.color, n = new N({
388
+ metalness: 0.3,
389
+ roughness: 0.6
390
+ });
391
+ s && s.length >= 3 ? n.color.setRGB(s[0], s[1], s[2]) : n.color.setHex(13421772);
392
+ const a = new G(i, n);
393
+ return a.name = t.name ?? "Mesh", a.castShadow = !0, a.receiveShadow = !0, a;
394
+ }
395
+ }
396
+ const M = (u) => Array.isArray(u == null ? void 0 : u.children) ? u.children.length : 0;
397
+ class te {
398
+ constructor() {
399
+ _(this, "_gltfLoader");
400
+ _(this, "_usdLoader");
401
+ _(this, "_stepLoader");
402
+ const t = new j();
403
+ t.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new P(), this._gltfLoader.setDRACOLoader(t), this._usdLoader = new U(), this._stepLoader = new J();
404
+ }
405
+ _logLoad(t, o = {}) {
406
+ console.info("[AssetLoader.load]", t, o);
407
+ }
408
+ _logLoadError(t, o, r = {}) {
409
+ console.error("[AssetLoader.load]", t, {
410
+ ...r,
411
+ error: o instanceof Error ? o.message : String(o)
412
+ });
413
+ }
414
+ async load(t, o) {
415
+ const r = performance.now();
416
+ let e;
417
+ if (this._logLoad("start", {
418
+ uri: t,
419
+ fileType: o ?? null
420
+ }), o)
421
+ e = o, this._logLoad("using-explicit-file-type", {
422
+ uri: t,
423
+ extension: e,
424
+ elapsedMs: Math.round(performance.now() - r)
425
+ });
426
+ else if (e = v(t), this._logLoad("derived-file-type-from-uri", {
427
+ uri: t,
428
+ extension: e,
429
+ elapsedMs: Math.round(performance.now() - r)
430
+ }), e.length === 0 && (this._logLoad("detect-file-type-from-content-start", {
431
+ uri: t,
432
+ elapsedMs: Math.round(performance.now() - r)
433
+ }), e = await this._detectFileTypeFromContent(t), this._logLoad("detect-file-type-from-content-complete", {
434
+ uri: t,
435
+ extension: e,
436
+ elapsedMs: Math.round(performance.now() - r)
437
+ }), e.length === 0))
438
+ throw new C(
439
+ "No file extension found in URI",
440
+ ""
441
+ );
442
+ if (!W(e))
443
+ throw new C(
444
+ `Unsupported file type: ${e}. Supported types: ${k.join(", ")}`,
445
+ e
446
+ );
447
+ const i = L.read(t);
448
+ if (this._logLoad(i ? "cache-hit" : "cache-miss", {
449
+ uri: t,
450
+ extension: e,
451
+ hasArrayBuffer: !!(i != null && i.arrayBuffer),
452
+ elapsedMs: Math.round(performance.now() - r)
453
+ }), i)
454
+ return i.arrayBuffer ? (this._logLoad("parse-start", {
455
+ uri: t,
456
+ extension: e,
457
+ source: "cache-array-buffer",
458
+ byteLength: i.arrayBuffer.byteLength,
459
+ elapsedMs: Math.round(performance.now() - r)
460
+ }), this._parse(i.arrayBuffer, e, {
461
+ uri: t,
462
+ source: "cache-array-buffer",
463
+ startedAt: r
464
+ })) : (this._logLoad("await-existing-cache-promise-start", {
465
+ uri: t,
466
+ extension: e,
467
+ elapsedMs: Math.round(performance.now() - r)
468
+ }), i.promise.then((a) => (this._logLoad("await-existing-cache-promise-resolved", {
469
+ uri: t,
470
+ extension: e,
471
+ byteLength: a.byteLength,
472
+ elapsedMs: Math.round(performance.now() - r)
473
+ }), this._logLoad("parse-start", {
474
+ uri: t,
475
+ extension: e,
476
+ source: "cache-promise",
477
+ byteLength: a.byteLength,
478
+ elapsedMs: Math.round(performance.now() - r)
479
+ }), this._parse(a, e, {
480
+ uri: t,
481
+ source: "cache-promise",
482
+ startedAt: r
483
+ }))));
484
+ const s = L.create(t);
485
+ this._logLoad("chunk-created", {
486
+ uri: t,
487
+ extension: e,
488
+ elapsedMs: Math.round(performance.now() - r)
489
+ }), this._logLoad("chunk-load-start", {
490
+ uri: t,
491
+ extension: e,
492
+ elapsedMs: Math.round(performance.now() - r)
493
+ });
494
+ const n = await s.load();
495
+ return this._logLoad("chunk-load-resolved", {
496
+ uri: t,
497
+ extension: e,
498
+ byteLength: n.byteLength,
499
+ elapsedMs: Math.round(performance.now() - r)
500
+ }), this._logLoad("parse-start", {
501
+ uri: t,
502
+ extension: e,
503
+ source: "fresh-chunk",
504
+ byteLength: n.byteLength,
505
+ elapsedMs: Math.round(performance.now() - r)
506
+ }), this._parse(n, e, {
507
+ uri: t,
508
+ source: "fresh-chunk",
509
+ startedAt: r
510
+ });
511
+ }
512
+ /**
513
+ * Detects file type from content (magic bytes)
514
+ * @param uri - The URI to load and detect
515
+ * @returns The detected file extension or empty string if detection fails
516
+ */
517
+ async _detectFileTypeFromContent(t) {
518
+ try {
519
+ const o = L.read(t);
520
+ let r;
521
+ o ? o.arrayBuffer ? r = o.arrayBuffer : r = await o.promise : r = await L.create(t).load();
522
+ const e = new Uint8Array(r);
523
+ return e.length >= 12 && String.fromCharCode(
524
+ e[0],
525
+ e[1],
526
+ e[2],
527
+ e[3]
528
+ ) === "glTF" ? e[12] === 0 ? "glb" : "gltf" : e.length >= 4 && e[0] === 80 && // 'P'
529
+ e[1] === 75 && // 'K'
530
+ (e[2] === 3 || e[2] === 5) && (e[3] === 4 || e[3] === 6) ? "usdz" : e.length >= 20 && new TextDecoder("ascii").decode(
531
+ e.subarray(0, 20)
532
+ ).startsWith("ISO-10303-21") ? "step" : e.length >= 80 && e[72] === 83 ? "iges" : "";
533
+ } catch {
534
+ return "";
535
+ }
536
+ }
537
+ /**
538
+ * parse function for the chunk
539
+ * @param arrayBuffer - the array buffer to parse, will be provided within the chunk
540
+ * @param type - the file type of the array buffer
541
+ * @returns the parsed object, will be stored within the chunk
542
+ */
543
+ async _parse(t, o, r) {
544
+ try {
545
+ switch (this._logLoad("parse-dispatch", {
546
+ uri: r.uri,
547
+ type: o,
548
+ source: r.source,
549
+ byteLength: t.byteLength,
550
+ elapsedMs: Math.round(performance.now() - r.startedAt)
551
+ }), o) {
552
+ case "glb":
553
+ case "gltf": {
554
+ this._logLoad("gltf-parse-start", {
555
+ uri: r.uri,
556
+ type: o,
557
+ source: r.source,
558
+ elapsedMs: Math.round(
559
+ performance.now() - r.startedAt
560
+ )
561
+ });
562
+ const e = await this._gltfLoader.parseAsync(
563
+ t,
564
+ ""
565
+ );
566
+ return e.scene.animations = e.animations, this._logLoad("gltf-parse-complete", {
567
+ uri: r.uri,
568
+ type: o,
569
+ source: r.source,
570
+ childCount: M(e.scene),
571
+ animationCount: Array.isArray(e.animations) ? e.animations.length : 0,
572
+ elapsedMs: Math.round(
573
+ performance.now() - r.startedAt
574
+ )
575
+ }), e.scene;
576
+ }
577
+ case "usdz": {
578
+ this._logLoad("usdz-parse-start", {
579
+ uri: r.uri,
580
+ type: o,
581
+ source: r.source,
582
+ elapsedMs: Math.round(
583
+ performance.now() - r.startedAt
584
+ )
585
+ });
586
+ const e = this._usdLoader.parse(t);
587
+ return e.animations = [], this._logLoad("usdz-parse-complete", {
588
+ uri: r.uri,
589
+ type: o,
590
+ source: r.source,
591
+ childCount: M(e),
592
+ elapsedMs: Math.round(
593
+ performance.now() - r.startedAt
594
+ )
595
+ }), e;
596
+ }
597
+ case "step":
598
+ case "stp": {
599
+ this._logLoad("step-parse-start", {
600
+ uri: r.uri,
601
+ type: o,
602
+ source: r.source,
603
+ elapsedMs: Math.round(
604
+ performance.now() - r.startedAt
605
+ )
606
+ });
607
+ const e = await this._stepLoader.parseAsync(
608
+ t,
609
+ o
610
+ );
611
+ return e.animations = [], this._logLoad("step-parse-complete", {
612
+ uri: r.uri,
613
+ type: o,
614
+ source: r.source,
615
+ childCount: M(e),
616
+ elapsedMs: Math.round(
617
+ performance.now() - r.startedAt
618
+ )
619
+ }), e;
620
+ }
621
+ case "iges":
622
+ case "igs": {
623
+ this._logLoad("iges-parse-start", {
624
+ uri: r.uri,
625
+ type: o,
626
+ source: r.source,
627
+ elapsedMs: Math.round(
628
+ performance.now() - r.startedAt
629
+ )
630
+ });
631
+ const e = await this._stepLoader.parseAsync(
632
+ t,
633
+ o
634
+ );
635
+ return e.animations = [], this._logLoad("iges-parse-complete", {
636
+ uri: r.uri,
637
+ type: o,
638
+ source: r.source,
639
+ childCount: M(e),
640
+ elapsedMs: Math.round(
641
+ performance.now() - r.startedAt
642
+ )
643
+ }), e;
644
+ }
645
+ }
646
+ } catch (e) {
647
+ throw this._logLoadError("parse-failed", e, {
648
+ uri: r.uri,
649
+ type: o,
650
+ source: r.source,
651
+ elapsedMs: Math.round(performance.now() - r.startedAt)
652
+ }), e instanceof Error ? new R(
653
+ `Failed to parse ${o} file: ${e.message}`,
654
+ e
655
+ ) : new R(`Failed to parse ${o} file`);
656
+ }
657
+ }
658
+ }
659
+ export {
660
+ te as A,
661
+ H as D,
662
+ j as a
663
+ };
@@ -1979,7 +1979,7 @@ class ni {
1979
1979
  ), this._clock.addTicker(this._orientationDisplay));
1980
1980
  }
1981
1981
  ), this._settings.autoStart && this.start(), console.log(
1982
- "DIVE 3.0.3 initialized successfully!"
1982
+ "DIVE 3.0.4-beta.0 initialized successfully!"
1983
1983
  ), console.log(UA), window.DIVE.instances.push(this);
1984
1984
  }
1985
1985
  get views() {
@@ -26,4 +26,4 @@
26
26
  @@%-::::::::::::-%@ @%-------------=%@@
27
27
  @@@@+:::::::#@@ @@*-------*@@@@
28
28
  @@@@@@@ @@@@@@
29
- `;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const P={autoStart:!0,displayAxes:!1,...d,...a.DIVEPerspectiveCameraDefaultSettings,...p,...J};class tA{constructor(t){e(this,"_instanceId",g.MathUtils.generateUUID());e(this,"_settings");e(this,"_disposed",!1);e(this,"_views");e(this,"_mainView");e(this,"_scene");e(this,"_clock");e(this,"_orientationDisplay",null);this._settings={...P,...t??{}},this._clock=new Y,this._scene=new x({backgroundColor:(t==null?void 0:t.backgroundColor)??P.backgroundColor,displayGrid:(t==null?void 0:t.displayGrid)??P.displayGrid,displayFloor:(t==null?void 0:t.displayFloor)??P.displayFloor});const A=new F(this._scene,new a.DIVEPerspectiveCamera,this._settings);this._clock.addTicker(A),this._views=[A],this._mainView=A,this._settings.displayAxes&&Promise.resolve().then(()=>require("../plugins/orientationdisplay/index.cjs")).then(({OrientationDisplay:i})=>{this._disposed||(this._orientationDisplay=new i(this.mainView.renderer,this.scene,this.mainView.camera),this._clock.addTicker(this._orientationDisplay))}),this._settings.autoStart&&this.start(),console.log("DIVE 3.0.3 initialized successfully!"),console.log(eA),window.DIVE.instances.push(this)}get views(){return this._views}get mainView(){return this._mainView}get canvas(){return this.mainView.canvas}get scene(){return this._scene}get clock(){return this._clock}start(){this._disposed||this.startAsync().catch(t=>{console.error("DIVE.start: Failed to initialize the WebGPU renderer.",t)})}async startAsync(){if(!this._disposed){if(this.mainView.renderer.initialized)this._clock.start();else{const t=this.mainView.init();queueMicrotask(()=>{this._disposed||this._clock.start()});try{await t}catch(A){this.dispose(),console.error("DIVE.startAsync: Failed to initialize. Error:",A)}}this._disposed}}stop(){this._clock.stop()}async dispose(){return this._disposed=!0,new Promise(t=>{this._clock.dispose(),this._views.forEach(A=>{A.dispose()}),this._views=[],this._orientationDisplay&&(this._orientationDisplay.dispose(),this._orientationDisplay=null),this.scene.dispose(),window.DIVE.instances=window.DIVE.instances.filter(A=>A._instanceId!==this._instanceId),t()})}}const T={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"},step:{key:"step",extension:"step"},stp:{key:"stp",extension:"stp"},iges:{key:"iges",extension:"iges"},igs:{key:"igs",extension:"igs"}},gA=Object.values(T).map(f=>f.extension);exports.BoundingBox=u;exports.DIVE=tA;exports.DIVEAmbientLight=X;exports.DIVECanvasLifecycleManager=L;exports.DIVEClock=Y;exports.DIVEDefaultSettings=P;exports.DIVEEnvironment=O;exports.DIVEEnvironmentDefaultSettings=b;exports.DIVEFloor=W;exports.DIVEGrid=l;exports.DIVEGroup=Q;exports.DIVEModel=v;exports.DIVENode=w;exports.DIVEPointLight=j;exports.DIVEPrimitive=Z;exports.DIVERenderer=M;exports.DIVERendererDefaultSettings=p;exports.DIVERoot=N;exports.DIVEScene=x;exports.DIVESceneDefaultSettings=d;exports.DIVESceneLight=E;exports.DIVEView=F;exports.FILE_TYPES=T;exports.GRID_MAJOR_LINE_COLOR=S;exports.GRID_MINOR_LINE_COLOR=k;exports.OrbitController=m;exports.OrbitControllerDefaultSettings=J;exports.SUPPORTED_FILE_TYPES=gA;exports.findSceneRecursive=K;
29
+ `;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const P={autoStart:!0,displayAxes:!1,...d,...a.DIVEPerspectiveCameraDefaultSettings,...p,...J};class tA{constructor(t){e(this,"_instanceId",g.MathUtils.generateUUID());e(this,"_settings");e(this,"_disposed",!1);e(this,"_views");e(this,"_mainView");e(this,"_scene");e(this,"_clock");e(this,"_orientationDisplay",null);this._settings={...P,...t??{}},this._clock=new Y,this._scene=new x({backgroundColor:(t==null?void 0:t.backgroundColor)??P.backgroundColor,displayGrid:(t==null?void 0:t.displayGrid)??P.displayGrid,displayFloor:(t==null?void 0:t.displayFloor)??P.displayFloor});const A=new F(this._scene,new a.DIVEPerspectiveCamera,this._settings);this._clock.addTicker(A),this._views=[A],this._mainView=A,this._settings.displayAxes&&Promise.resolve().then(()=>require("../plugins/orientationdisplay/index.cjs")).then(({OrientationDisplay:i})=>{this._disposed||(this._orientationDisplay=new i(this.mainView.renderer,this.scene,this.mainView.camera),this._clock.addTicker(this._orientationDisplay))}),this._settings.autoStart&&this.start(),console.log("DIVE 3.0.4-beta.0 initialized successfully!"),console.log(eA),window.DIVE.instances.push(this)}get views(){return this._views}get mainView(){return this._mainView}get canvas(){return this.mainView.canvas}get scene(){return this._scene}get clock(){return this._clock}start(){this._disposed||this.startAsync().catch(t=>{console.error("DIVE.start: Failed to initialize the WebGPU renderer.",t)})}async startAsync(){if(!this._disposed){if(this.mainView.renderer.initialized)this._clock.start();else{const t=this.mainView.init();queueMicrotask(()=>{this._disposed||this._clock.start()});try{await t}catch(A){this.dispose(),console.error("DIVE.startAsync: Failed to initialize. Error:",A)}}this._disposed}}stop(){this._clock.stop()}async dispose(){return this._disposed=!0,new Promise(t=>{this._clock.dispose(),this._views.forEach(A=>{A.dispose()}),this._views=[],this._orientationDisplay&&(this._orientationDisplay.dispose(),this._orientationDisplay=null),this.scene.dispose(),window.DIVE.instances=window.DIVE.instances.filter(A=>A._instanceId!==this._instanceId),t()})}}const T={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"},step:{key:"step",extension:"step"},stp:{key:"stp",extension:"stp"},iges:{key:"iges",extension:"iges"},igs:{key:"igs",extension:"igs"}},gA=Object.values(T).map(f=>f.extension);exports.BoundingBox=u;exports.DIVE=tA;exports.DIVEAmbientLight=X;exports.DIVECanvasLifecycleManager=L;exports.DIVEClock=Y;exports.DIVEDefaultSettings=P;exports.DIVEEnvironment=O;exports.DIVEEnvironmentDefaultSettings=b;exports.DIVEFloor=W;exports.DIVEGrid=l;exports.DIVEGroup=Q;exports.DIVEModel=v;exports.DIVENode=w;exports.DIVEPointLight=j;exports.DIVEPrimitive=Z;exports.DIVERenderer=M;exports.DIVERendererDefaultSettings=p;exports.DIVERoot=N;exports.DIVEScene=x;exports.DIVESceneDefaultSettings=d;exports.DIVESceneLight=E;exports.DIVEView=F;exports.FILE_TYPES=T;exports.GRID_MAJOR_LINE_COLOR=S;exports.GRID_MINOR_LINE_COLOR=k;exports.OrbitController=m;exports.OrbitControllerDefaultSettings=J;exports.SUPPORTED_FILE_TYPES=gA;exports.findSceneRecursive=K;
@@ -1,4 +1,4 @@
1
- import { F as n } from "./FileTypes-smInt9po.mjs";
1
+ import { F as n } from "./FileTypes-BWLS6Iwg.mjs";
2
2
  function r(e) {
3
3
  var i;
4
4
  const t = e.split("/").pop() || "";
@@ -1 +1 @@
1
- "use strict";const n=require("./FileTypes-DiwbBQ8N.cjs");function o(e){var t;const i=e.split("/").pop()||"";return!i.includes(".")||i.endsWith(".")?"":((t=i.split(".").pop())==null?void 0:t.toLowerCase().split("?")[0])||""}function r(e){return e.toLowerCase()in n.FILE_TYPES}exports.getFileTypeFromUri=o;exports.isFileTypeSupported=r;
1
+ "use strict";const n=require("./FileTypes-Cus1xgpl.cjs");function o(e){var t;const i=e.split("/").pop()||"";return!i.includes(".")||i.endsWith(".")?"":((t=i.split(".").pop())==null?void 0:t.toLowerCase().split("?")[0])||""}function r(e){return e.toLowerCase()in n.FILE_TYPES}exports.getFileTypeFromUri=o;exports.isFileTypeSupported=r;