@shopware-ag/dive 3.0.0-beta.0 → 3.0.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 (28) hide show
  1. package/build/chunks/{AssetCache-CnbDDhU8.cjs → AssetCache-BNu4dyzl.cjs} +1 -1
  2. package/build/chunks/{AssetCache-C2DuXcmp.mjs → AssetCache-F9o5MhiH.mjs} +1 -1
  3. package/build/chunks/{AssetLoader-h2uyFEfZ.cjs → AssetLoader-CAyqOjc8.cjs} +1 -1
  4. package/build/chunks/{AssetLoader-DO7xlbC3.mjs → AssetLoader-CTkDc_0G.mjs} +3 -3
  5. package/build/chunks/{FileTypes-BB4_1gBJ.mjs → FileTypes-C0IwoCWe.mjs} +20 -19
  6. package/build/chunks/{FileTypes-Bvt5QTJC.cjs → FileTypes-DhDQJFeS.cjs} +2 -2
  7. package/build/chunks/{isFileTypeSupported-MJWHcUsR.cjs → isFileTypeSupported-DSoLQlXi.cjs} +1 -1
  8. package/build/chunks/{isFileTypeSupported-D1z0zckw.mjs → isFileTypeSupported-kW0SviDr.mjs} +1 -1
  9. package/build/dive.cjs +1 -1
  10. package/build/dive.mjs +2 -2
  11. package/build/engine/Dive.d.ts +1 -0
  12. package/build/plugins/ar/index.cjs +1 -1
  13. package/build/plugins/ar/index.mjs +1 -1
  14. package/build/plugins/assetcache/index.cjs +1 -1
  15. package/build/plugins/assetcache/index.mjs +1 -1
  16. package/build/plugins/assetloader/index.cjs +1 -1
  17. package/build/plugins/assetloader/index.mjs +2 -2
  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
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var n=(s,e,r)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var t=(s,e,r)=>n(s,typeof e!="symbol"?e+"":e,r);require("./FileTypes-Bvt5QTJC.cjs");require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const h=require("./network-error-CdDXil5g.cjs");class c{constructor(e){t(this,"_promise");t(this,"_resolve");t(this,"_arrayBuffer",null);t(this,"_size",0);t(this,"_createdAt");t(this,"_updatedAt");this._uri=e,this._promise=new Promise(r=>{this._resolve=r}),this._createdAt=new Date,this._updatedAt=new Date}get promise(){return this._promise}get size(){return this._size}get createdAt(){return this._createdAt}get updatedAt(){return this._updatedAt}get arrayBuffer(){return this._arrayBuffer}async load(){const e=await fetch(this._uri);if(!e.ok)throw new h.NetworkError(this._uri);try{this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new h.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class o{constructor(){t(this,"_cache",new Map)}get(){return this._cache}create(e){const r=new c(e);return this._cache.set(e,r),r}write(e,r){this._cache.set(e,r)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(r=>{this._cache.delete(r)})}clear(){this._cache.clear()}}const a=Symbol.for("@shopware-ag/dive/assetcache"),i=globalThis;i[a]||(i[a]=new o);const _=i[a];exports.AssetCache=_;exports.Chunk=c;
1
+ "use strict";var u=Object.defineProperty;var n=(s,e,r)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var t=(s,e,r)=>n(s,typeof e!="symbol"?e+"":e,r);require("./FileTypes-DhDQJFeS.cjs");require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const h=require("./network-error-CdDXil5g.cjs");class c{constructor(e){t(this,"_promise");t(this,"_resolve");t(this,"_arrayBuffer",null);t(this,"_size",0);t(this,"_createdAt");t(this,"_updatedAt");this._uri=e,this._promise=new Promise(r=>{this._resolve=r}),this._createdAt=new Date,this._updatedAt=new Date}get promise(){return this._promise}get size(){return this._size}get createdAt(){return this._createdAt}get updatedAt(){return this._updatedAt}get arrayBuffer(){return this._arrayBuffer}async load(){const e=await fetch(this._uri);if(!e.ok)throw new h.NetworkError(this._uri);try{this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new h.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class o{constructor(){t(this,"_cache",new Map)}get(){return this._cache}create(e){const r=new c(e);return this._cache.set(e,r),r}write(e,r){this._cache.set(e,r)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(r=>{this._cache.delete(r)})}clear(){this._cache.clear()}}const a=Symbol.for("@shopware-ag/dive/assetcache"),i=globalThis;i[a]||(i[a]=new o);const _=i[a];exports.AssetCache=_;exports.Chunk=c;
@@ -1,7 +1,7 @@
1
1
  var h = Object.defineProperty;
2
2
  var c = (s, e, t) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var r = (s, e, t) => c(s, typeof e != "symbol" ? e + "" : e, t);
4
- import "./FileTypes-BB4_1gBJ.mjs";
4
+ import "./FileTypes-C0IwoCWe.mjs";
5
5
  import "three/webgpu";
6
6
  import "three/examples/jsm/loaders/HDRLoader.js";
7
7
  import "three/tsl";
@@ -1,3 +1,3 @@
1
- "use strict";var U=Object.create;var b=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var x=(i,t,n)=>t in i?b(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var G=(i,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of F(t))!N.call(i,s)&&s!==n&&b(i,s,{get:()=>t[s],enumerable:!(r=M(t,s))||r.enumerable});return i};var S=(i,t,n)=>(n=i!=null?U(k(i)):{},G(t||!i||!i.__esModule?b(n,"default",{value:i,enumerable:!0}):n,i));var h=(i,t,n)=>x(i,typeof t!="symbol"?t+"":t,n);const v=require("three/examples/jsm/loaders/GLTFLoader.js"),W=require("three/examples/jsm/loaders/USDLoader.js"),j=require("./FileTypes-Bvt5QTJC.cjs"),A=require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const C=require("./isFileTypeSupported-MJWHcUsR.cjs"),L=require("./parse-error-Dy_EE4rL.cjs"),B=require("three/examples/jsm/loaders/DRACOLoader.js"),E=require("./AssetCache-CnbDDhU8.cjs");function I(){let i,t;onmessage=function(e){const o=e.data;switch(o.type){case"init":i=o.decoderConfig,t=new Promise(function(a){i.onModuleLoaded=function(f){a({draco:f})},DracoDecoderModule(i)});break;case"decode":const c=o.buffer,u=o.taskConfig;t.then(a=>{const f=a.draco,d=new f.Decoder;try{const _=n(f,d,new Int8Array(c),u),p=_.attributes.map(g=>g.array.buffer);_.index&&p.push(_.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:_},p)}catch(_){console.error(_),self.postMessage({type:"error",id:o.id,error:_.message})}finally{f.destroy(d)}});break}};function n(e,o,c,u){const a=u.attributeIDs,f=u.attributeTypes;let d,_;const p=o.GetEncodedGeometryType(c);if(p===e.TRIANGULAR_MESH)d=new e.Mesh,_=o.DecodeArrayToMesh(c,c.byteLength,d);else if(p===e.POINT_CLOUD)d=new e.PointCloud,_=o.DecodeArrayToPointCloud(c,c.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!_.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+_.error_msg());const g={index:null,attributes:[]};for(const w in a){const y=self[f[w]];let m,D;if(u.useUniqueIDs)D=a[w],m=o.GetAttributeByUniqueId(d,D);else{if(D=o.GetAttributeId(d,e[a[w]]),D===-1)continue;m=o.GetAttribute(d,D)}const R=s(e,o,d,w,y,m);w==="color"&&(R.vertexColorSpace=u.vertexColorSpace),g.attributes.push(R)}return p===e.TRIANGULAR_MESH&&(g.index=r(e,o,d)),e.destroy(d),g}function r(e,o,c){const a=c.num_faces()*3,f=a*4,d=e._malloc(f);o.GetTrianglesUInt32Array(c,f,d);const _=new Uint32Array(e.HEAPF32.buffer,d,a).slice();return e._free(d),{array:_,itemSize:1}}function s(e,o,c,u,a,f){const d=f.num_components(),p=c.num_points()*d,g=p*a.BYTES_PER_ELEMENT,w=l(e,a),y=e._malloc(g);o.GetAttributeDataArrayForAllPoints(c,f,w,g,y);const m=new a(e.HEAPF32.buffer,y,p).slice();return e._free(y),{name:u,array:m,itemSize:d}}function l(e,o){switch(o){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}}const T={LOAD_DRACO_JS_DECODER:async()=>(await import("three/examples/jsm/libs/draco/draco_decoder.js?raw")).default,LOAD_DRACO_WASM_WRAPPER:async()=>(await import("three/examples/jsm/libs/draco/draco_wasm_wrapper.js?raw")).default,LOAD_DRACO_WASM_DECODER:async()=>{const i=(await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;return await(await fetch(i)).arrayBuffer()}};class P extends B.DRACOLoader{constructor(){super(...arguments);h(this,"decoderPending",null);h(this,"decoderConfig",{type:"js",wasmBinary:null});h(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const n=typeof WebAssembly!="object"||this.decoderConfig.type==="js",r=[];return n?r.push(T.LOAD_DRACO_JS_DECODER()):(r.push(T.LOAD_DRACO_WASM_WRAPPER()),r.push(T.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(r).then(s=>{const l=s[0];n||(this.decoderConfig.wasmBinary=s[1]);const e=I.toString(),o=["/* draco decoder */",l,"","/* worker */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}"))].join(`
1
+ "use strict";var U=Object.create;var b=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var x=(i,t,n)=>t in i?b(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var G=(i,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of F(t))!N.call(i,s)&&s!==n&&b(i,s,{get:()=>t[s],enumerable:!(r=M(t,s))||r.enumerable});return i};var S=(i,t,n)=>(n=i!=null?U(k(i)):{},G(t||!i||!i.__esModule?b(n,"default",{value:i,enumerable:!0}):n,i));var h=(i,t,n)=>x(i,typeof t!="symbol"?t+"":t,n);const v=require("three/examples/jsm/loaders/GLTFLoader.js"),W=require("three/examples/jsm/loaders/USDLoader.js"),j=require("./FileTypes-DhDQJFeS.cjs"),A=require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const C=require("./isFileTypeSupported-DSoLQlXi.cjs"),L=require("./parse-error-Dy_EE4rL.cjs"),B=require("three/examples/jsm/loaders/DRACOLoader.js"),E=require("./AssetCache-BNu4dyzl.cjs");function I(){let i,t;onmessage=function(e){const o=e.data;switch(o.type){case"init":i=o.decoderConfig,t=new Promise(function(a){i.onModuleLoaded=function(f){a({draco:f})},DracoDecoderModule(i)});break;case"decode":const c=o.buffer,u=o.taskConfig;t.then(a=>{const f=a.draco,d=new f.Decoder;try{const _=n(f,d,new Int8Array(c),u),p=_.attributes.map(g=>g.array.buffer);_.index&&p.push(_.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:_},p)}catch(_){console.error(_),self.postMessage({type:"error",id:o.id,error:_.message})}finally{f.destroy(d)}});break}};function n(e,o,c,u){const a=u.attributeIDs,f=u.attributeTypes;let d,_;const p=o.GetEncodedGeometryType(c);if(p===e.TRIANGULAR_MESH)d=new e.Mesh,_=o.DecodeArrayToMesh(c,c.byteLength,d);else if(p===e.POINT_CLOUD)d=new e.PointCloud,_=o.DecodeArrayToPointCloud(c,c.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!_.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+_.error_msg());const g={index:null,attributes:[]};for(const w in a){const y=self[f[w]];let m,D;if(u.useUniqueIDs)D=a[w],m=o.GetAttributeByUniqueId(d,D);else{if(D=o.GetAttributeId(d,e[a[w]]),D===-1)continue;m=o.GetAttribute(d,D)}const R=s(e,o,d,w,y,m);w==="color"&&(R.vertexColorSpace=u.vertexColorSpace),g.attributes.push(R)}return p===e.TRIANGULAR_MESH&&(g.index=r(e,o,d)),e.destroy(d),g}function r(e,o,c){const a=c.num_faces()*3,f=a*4,d=e._malloc(f);o.GetTrianglesUInt32Array(c,f,d);const _=new Uint32Array(e.HEAPF32.buffer,d,a).slice();return e._free(d),{array:_,itemSize:1}}function s(e,o,c,u,a,f){const d=f.num_components(),p=c.num_points()*d,g=p*a.BYTES_PER_ELEMENT,w=l(e,a),y=e._malloc(g);o.GetAttributeDataArrayForAllPoints(c,f,w,g,y);const m=new a(e.HEAPF32.buffer,y,p).slice();return e._free(y),{name:u,array:m,itemSize:d}}function l(e,o){switch(o){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}}const T={LOAD_DRACO_JS_DECODER:async()=>(await import("three/examples/jsm/libs/draco/draco_decoder.js?raw")).default,LOAD_DRACO_WASM_WRAPPER:async()=>(await import("three/examples/jsm/libs/draco/draco_wasm_wrapper.js?raw")).default,LOAD_DRACO_WASM_DECODER:async()=>{const i=(await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;return await(await fetch(i)).arrayBuffer()}};class P extends B.DRACOLoader{constructor(){super(...arguments);h(this,"decoderPending",null);h(this,"decoderConfig",{type:"js",wasmBinary:null});h(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const n=typeof WebAssembly!="object"||this.decoderConfig.type==="js",r=[];return n?r.push(T.LOAD_DRACO_JS_DECODER()):(r.push(T.LOAD_DRACO_WASM_WRAPPER()),r.push(T.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(r).then(s=>{const l=s[0];n||(this.decoderConfig.wasmBinary=s[1]);const e=I.toString(),o=["/* draco decoder */",l,"","/* worker */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}"))].join(`
2
2
  `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}}function q(){let i=null,t=null;const n=[[/'CONFIG_CONTROL_DESIGN'\s*\)/g,"'AP203_CONFIGURATION_CONTROLLED_3D_DESIGN_OF_MECHANICAL_PARTS_AND_ASSEMBLIES_MIM_LF')"],[/'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF\.\s*\{[\s\S]*?\}\s*'/g,"'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'"]];function r(){return i||(i=occtimportjs({locateFile:function(){return t}})),i}function s(e){for(var o=new TextDecoder("utf-8",{fatal:!1}),c=new TextEncoder,u=o.decode(e),a=0;a<n.length;a++){var f=n[a][0],d=n[a][1];u=u.replace(f,d)}return new Uint8Array(c.encode(u))}function l(e,o){var c=s(o);try{var u=e.ReadStepFile(c,null);if(u.success&&u.root)return u}catch{}try{return e.ReadStepFile(o,null)}catch{return{success:!1,root:{meshes:[],children:[]},meshes:[]}}}onmessage=async function(e){var o=e.data;switch(o.type){case"init":t=o.wasmUrl;break;case"parse":try{var c=await r(),u=new Uint8Array(o.buffer),a=o.fileType,f;if(a==="step"||a==="stp"?f=l(c,u):f=c.ReadIgesFile(u,null),!f.success||!f.root){self.postMessage({type:"error",id:o.id,error:"Failed to parse CAD file"});return}self.postMessage({type:"result",id:o.id,result:f})}catch(d){self.postMessage({type:"error",id:o.id,error:d instanceof Error?d.message:String(d)})}break}}}const O={LOAD_OCCT_JS:async()=>(await Promise.resolve().then(()=>require("./occt-import-js-DdbbsFBH.cjs"))).default,LOAD_OCCT_WASM_URL:async()=>(await Promise.resolve().then(()=>require("./occt-import-js-BQ1yZHCj.cjs"))).default};class H{constructor(){h(this,"_workerPending",null);h(this,"_worker",null);h(this,"_nextId",0);h(this,"_pending",new Map)}_getWorker(){return this._workerPending?this._workerPending:(this._workerPending=(async()=>{const[t,n]=await Promise.all([O.LOAD_OCCT_JS(),O.LOAD_OCCT_WASM_URL()]),r=q.toString(),s=["/* occt-import-js */",t,"","/* step worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
3
3
  `),l=URL.createObjectURL(new Blob([s])),e=new Worker(l),o=new URL(n,window.location.href).href;return e.postMessage({type:"init",wasmUrl:o}),e.onmessage=c=>{const{type:u,id:a,result:f,error:d}=c.data,_=this._pending.get(a);if(_)if(this._pending.delete(a),u==="result")try{_.resolve(this._buildScene(f))}catch(p){_.reject(p instanceof Error?p:new Error(String(p)))}else _.reject(new Error(d??"Worker error"))},e.onerror=c=>{for(const[,{reject:u}]of this._pending)u(new Error(c.message??"Worker error"));this._pending.clear()},this._worker=e,e})(),this._workerPending)}async parseAsync(t,n){const r=this._nextId++,s=await this._getWorker();return new Promise((l,e)=>{this._pending.set(r,{resolve:l,reject:e});const o=t.slice(0);s.postMessage({type:"parse",id:r,buffer:o,fileType:n},[o])})}dispose(){if(this._worker){for(const[,{reject:t}]of this._pending)t(new Error("STEPLoader disposed"));this._pending.clear(),this._worker.terminate(),this._worker=null,this._workerPending=null}}_buildScene(t){const n=new A.Group;return n.name=t.root.name??"CAD Model",this._buildNode(t.root,t.meshes,n),n.rotation.x=-Math.PI/2,n.rotation.z=Math.PI/2,n}_buildNode(t,n,r){const s=new A.Group;s.name=t.name??"Part";for(const l of t.meshes){const e=n[l];if(e!=null&&e.attributes){const o=this._createMesh(e);s.add(o)}}for(const l of t.children)this._buildNode(l,n,s);r.add(s)}_createMesh(t){var u,a;const{position:n,normal:r}=t.attributes,s=t.index??t.attributes.index,l=new A.BufferGeometry;l.setAttribute("position",new A.BufferAttribute(new Float32Array(n.array),3)),(u=r==null?void 0:r.array)!=null&&u.length?l.setAttribute("normal",new A.BufferAttribute(new Float32Array(r.array),3)):l.computeVertexNormals(),(a=s==null?void 0:s.array)!=null&&a.length&&l.setIndex(new A.BufferAttribute(new Uint32Array(s.array),1));const e=t.color,o=new A.MeshStandardMaterial({metalness:.3,roughness:.6});e&&e.length>=3?o.color.setRGB(e[0],e[1],e[2]):o.color.setHex(13421772);const c=new A.Mesh(l,o);return c.name=t.name??"Mesh",c.castShadow=!0,c.receiveShadow=!0,c}}class z{constructor(){h(this,"_gltfLoader");h(this,"_usdLoader");h(this,"_stepLoader");const t=new P;t.setDecoderConfig({type:"wasm"}),this._gltfLoader=new v.GLTFLoader,this._gltfLoader.setDRACOLoader(t),this._usdLoader=new W.USDLoader,this._stepLoader=new H}async load(t,n){let r;if(n)r=n;else if(r=C.getFileTypeFromUri(t),r.length===0&&(r=await this._detectFileTypeFromContent(t),r.length===0))throw new L.FileTypeError("No file extension found in URI","");if(!C.isFileTypeSupported(r))throw new L.FileTypeError(`Unsupported file type: ${r}. Supported types: ${j.SUPPORTED_FILE_TYPES.join(", ")}`,r);const s=E.AssetCache.read(t);if(s)return s.arrayBuffer?this._parse(s.arrayBuffer,r):s.promise.then(o=>this._parse(o,r));const e=await E.AssetCache.create(t).load();return this._parse(e,r)}async _detectFileTypeFromContent(t){try{const n=E.AssetCache.read(t);let r;n?n.arrayBuffer?r=n.arrayBuffer:r=await n.promise:r=await E.AssetCache.create(t).load();const s=new Uint8Array(r);return s.length>=12&&String.fromCharCode(s[0],s[1],s[2],s[3])==="glTF"?s[12]===0?"glb":"gltf":s.length>=4&&s[0]===80&&s[1]===75&&(s[2]===3||s[2]===5)&&(s[3]===4||s[3]===6)?"usdz":s.length>=20&&new TextDecoder("ascii").decode(s.subarray(0,20)).startsWith("ISO-10303-21")?"step":s.length>=80&&s[72]===83?"iges":""}catch{return""}}async _parse(t,n){try{switch(n){case"glb":case"gltf":{const r=await this._gltfLoader.parseAsync(t,"");return r.scene.animations=r.animations,r.scene}case"usdz":{const r=this._usdLoader.parse(t);return r.animations=[],r}case"step":case"stp":{const r=await this._stepLoader.parseAsync(t,n);return r.animations=[],r}case"iges":case"igs":{const r=await this._stepLoader.parseAsync(t,n);return r.animations=[],r}}}catch(r){throw r instanceof Error?new L.ParseError(`Failed to parse ${n} file: ${r.message}`,r):new L.ParseError(`Failed to parse ${n} file`)}}}exports.AssetLoader=z;exports.DRACOWorker=I;exports.DracoLoader=P;
@@ -3,14 +3,14 @@ var I = (_, r, s) => r in _ ? C(_, r, { enumerable: !0, configurable: !0, writab
3
3
  var h = (_, r, s) => I(_, typeof r != "symbol" ? r + "" : r, s);
4
4
  import { GLTFLoader as P } from "three/examples/jsm/loaders/GLTFLoader.js";
5
5
  import { USDLoader as U } from "three/examples/jsm/loaders/USDLoader.js";
6
- import { S as M } from "./FileTypes-BB4_1gBJ.mjs";
6
+ import { S as M } from "./FileTypes-C0IwoCWe.mjs";
7
7
  import { Group as b, BufferGeometry as k, BufferAttribute as E, MeshStandardMaterial as F, Mesh as N } from "three/webgpu";
8
8
  import "three/examples/jsm/loaders/HDRLoader.js";
9
9
  import "three/tsl";
10
- import { g as x, i as G } from "./isFileTypeSupported-D1z0zckw.mjs";
10
+ import { g as x, i as G } from "./isFileTypeSupported-kW0SviDr.mjs";
11
11
  import { F as R, P as O } from "./parse-error-DfOPyLWM.mjs";
12
12
  import { DRACOLoader as W } from "three/examples/jsm/loaders/DRACOLoader.js";
13
- import { A as D } from "./AssetCache-C2DuXcmp.mjs";
13
+ import { A as D } from "./AssetCache-F9o5MhiH.mjs";
14
14
  function v() {
15
15
  let _, r;
16
16
  onmessage = function(e) {
@@ -3,7 +3,7 @@ var $ = (n, g, A) => g in n ? U(n, g, { enumerable: !0, configurable: !0, writab
3
3
  var e = (n, g, A) => $(n, typeof g != "symbol" ? g + "" : g, A);
4
4
  import { PMREMGenerator as F, Scene as W, SphereGeometry as v, MeshBasicMaterial as Y, BackSide as AA, Mesh as u, NoToneMapping as iA, LinearSRGBColorSpace as eA, CubeRenderTarget as gA, HalfFloatType as tA, CubeCamera as oA, EquirectangularReflectionMapping as sA, WebGPURenderer as nA, PCFSoftShadowMap as fA, PCFShadowMap as hA, BasicShadowMap as rA, SRGBColorSpace as aA, LinearToneMapping as BA, MathUtils as b, Object3D as w, AmbientLight as cA, PointLight as PA, FrontSide as N, HemisphereLight as zA, DirectionalLight as IA, Vector3 as h, Box3 as I, Box3Helper as CA, Sphere as uA, MeshStandardMaterial as y, Raycaster as wA, CylinderGeometry as GA, BufferGeometry as k, BufferAttribute as X, BoxGeometry as H, ConeGeometry as DA, LineDashedMaterial as mA, Line as pA, PlaneGeometry as x, Color as C, MeshBasicNodeMaterial as KA, DoubleSide as vA, TOUCH as c, MOUSE as B, EventDispatcher as lA, Spherical as j, Vector2 as a, Quaternion as Z } from "three/webgpu";
5
5
  import { HDRLoader as HA } from "three/examples/jsm/loaders/HDRLoader.js";
6
- import { P, U as qA, H as dA, a as YA, D as bA } from "./PerspectiveCamera-B5TvUzTa.mjs";
6
+ import { P, U as dA, H as qA, a as YA, D as bA } from "./PerspectiveCamera-B5TvUzTa.mjs";
7
7
  import { G as yA } from "./GridNode-0R5ZnzR6.mjs";
8
8
  import { uniform as G } from "three/tsl";
9
9
  class OA {
@@ -357,7 +357,7 @@ class EA extends w {
357
357
  opacity: 0.8,
358
358
  side: N
359
359
  });
360
- this.mesh = new u(i, t), this.mesh.layers.mask = qA, this.add(this.mesh);
360
+ this.mesh = new u(i, t), this.mesh.layers.mask = dA, this.add(this.mesh);
361
361
  }
362
362
  setColor(A) {
363
363
  this.light.color = A, this.mesh.material.color = A;
@@ -487,7 +487,7 @@ class O extends w {
487
487
  });
488
488
  }
489
489
  }
490
- class d extends O {
490
+ class q extends O {
491
491
  /**
492
492
  * Creates a new BoundingBox instance for the specified 3D object.
493
493
  *
@@ -650,7 +650,7 @@ class _ extends O {
650
650
  this.updateWorldMatrix(!0, !0);
651
651
  const A = this.getWorldPosition(this._positionWorldBuffer), i = A.clone(), t = new I();
652
652
  this.children.forEach((s) => {
653
- s instanceof d || t.expandByObject(s, !0);
653
+ s instanceof q || t.expandByObject(s, !0);
654
654
  });
655
655
  const o = -t.min.y;
656
656
  Math.abs(o) < 1e-9 || (A.y += o, A.y !== i.y && (this.setPosition(A), import("../plugins/state/index.mjs").then(({ State: s }) => {
@@ -673,7 +673,7 @@ class _ extends O {
673
673
  }
674
674
  const A = this.getWorldPosition(this._positionWorldBuffer), i = A.clone(), t = new I();
675
675
  this.children.forEach((r) => {
676
- r instanceof d || t.expandByObject(r, !0);
676
+ r instanceof q || t.expandByObject(r, !0);
677
677
  });
678
678
  const o = t.getCenter(new h());
679
679
  o.y = t.min.y;
@@ -1157,7 +1157,7 @@ class xA extends w {
1157
1157
  return A.parent !== null ? this._findScene(A.parent) : A;
1158
1158
  }
1159
1159
  }
1160
- const JA = "#dddddd", TA = "#888888", q = 50, SA = 1, _A = 10;
1160
+ const JA = "#dddddd", TA = "#888888", d = 50, SA = 1, _A = 10;
1161
1161
  class E extends w {
1162
1162
  constructor(A) {
1163
1163
  super();
@@ -1166,19 +1166,19 @@ class E extends w {
1166
1166
  e(this, "_uniforms");
1167
1167
  e(this, "_gridSize");
1168
1168
  this.name = "Grid", this._gridSize = (A == null ? void 0 : A.gridSize) ?? SA;
1169
- const i = (A == null ? void 0 : A.majorLineEvery) ?? _A, t = new x(q, q);
1169
+ const i = (A == null ? void 0 : A.majorLineEvery) ?? _A, t = new x(d, d);
1170
1170
  t.rotateX(-Math.PI / 2), this._uniforms = {
1171
1171
  uGridSize: G(this._gridSize),
1172
1172
  uMajorLineEvery: G(i),
1173
1173
  uMinorLineColor: G(new C(JA)),
1174
1174
  uMajorLineColor: G(new C(TA)),
1175
- uFadeDistance: G(q / 2)
1175
+ uFadeDistance: G(d / 2)
1176
1176
  }, this._material = new KA({
1177
1177
  transparent: !0,
1178
1178
  depthWrite: !1,
1179
1179
  side: vA,
1180
1180
  outputNode: new yA(this._uniforms)
1181
- }), this._mesh = new u(t, this._material), this._mesh.layers.mask = dA, this._mesh.frustumCulled = !1, this._mesh.renderOrder = -1, this._mesh.onBeforeRender = (o, s, f) => {
1181
+ }), this._mesh = new u(t, this._material), this._mesh.layers.mask = qA, this._mesh.frustumCulled = !1, this._mesh.renderOrder = -1, this._mesh.onBeforeRender = (o, s, f) => {
1182
1182
  const r = this._gridSize;
1183
1183
  this._mesh.position.x = Math.round(f.position.x / r) * r, this._mesh.position.z = Math.round(f.position.z / r) * r, this._mesh.updateMatrixWorld(!0);
1184
1184
  }, this.add(this._mesh);
@@ -1574,7 +1574,7 @@ const RA = {
1574
1574
  };
1575
1575
  }
1576
1576
  focusObject(A, i = 0) {
1577
- const t = new d(A), o = this.computeEncompassingView(t, i);
1577
+ const t = new q(A), o = this.computeEncompassingView(t, i);
1578
1578
  this.object.position.copy(o.position), this.target.copy(o.target), this.update();
1579
1579
  }
1580
1580
  zoomIn(A) {
@@ -1841,6 +1841,7 @@ class ni {
1841
1841
  // descriptive members
1842
1842
  e(this, "_instanceId", b.generateUUID());
1843
1843
  e(this, "_settings");
1844
+ e(this, "_disposed", !1);
1844
1845
  e(this, "_views");
1845
1846
  e(this, "_mainView");
1846
1847
  e(this, "_scene");
@@ -1861,14 +1862,14 @@ class ni {
1861
1862
  );
1862
1863
  this._clock.addTicker(A), this._views = [A], this._mainView = A, this._settings.displayAxes && import("../plugins/orientationdisplay/index.mjs").then(
1863
1864
  ({ OrientationDisplay: i }) => {
1864
- this._orientationDisplay = new i(
1865
+ this._disposed || (this._orientationDisplay = new i(
1865
1866
  this.mainView.renderer,
1866
1867
  this.scene,
1867
1868
  this.mainView.camera
1868
- ), this._clock.addTicker(this._orientationDisplay);
1869
+ ), this._clock.addTicker(this._orientationDisplay));
1869
1870
  }
1870
1871
  ), this._settings.autoStart && this.start(), console.log(
1871
- "DIVE 3.0.0-beta.0 initialized successfully!"
1872
+ "DIVE 3.0.0 initialized successfully!"
1872
1873
  ), console.log(UA), window.DIVE.instances.push(this);
1873
1874
  }
1874
1875
  get views() {
@@ -1887,7 +1888,7 @@ class ni {
1887
1888
  return this._clock;
1888
1889
  }
1889
1890
  start() {
1890
- this.startAsync().catch((g) => {
1891
+ this._disposed || this.startAsync().catch((g) => {
1891
1892
  console.error(
1892
1893
  "DIVE.start: Failed to initialize the WebGPU renderer.",
1893
1894
  g
@@ -1895,16 +1896,16 @@ class ni {
1895
1896
  });
1896
1897
  }
1897
1898
  async startAsync() {
1898
- this.mainView.renderer.initialized || await this.mainView.renderer.init(), this._clock.start();
1899
+ this._disposed || (this.mainView.renderer.initialized || await this.mainView.renderer.init(), !this._disposed && this._clock.start());
1899
1900
  }
1900
1901
  stop() {
1901
1902
  this._clock.stop();
1902
1903
  }
1903
1904
  async dispose() {
1904
- return new Promise((g) => {
1905
- this._views.forEach((A) => {
1905
+ return this._disposed = !0, new Promise((g) => {
1906
+ this._clock.dispose(), this._views.forEach((A) => {
1906
1907
  A.dispose();
1907
- }), this._views = [], this._orientationDisplay && (this._clock.removeTicker(this._orientationDisplay), this._orientationDisplay.dispose()), this.scene.dispose(), window.DIVE.instances = window.DIVE.instances.filter(
1908
+ }), this._views = [], this._orientationDisplay && (this._orientationDisplay.dispose(), this._orientationDisplay = null), this.scene.dispose(), window.DIVE.instances = window.DIVE.instances.filter(
1908
1909
  (A) => A._instanceId !== this._instanceId
1909
1910
  ), g();
1910
1911
  });
@@ -1943,7 +1944,7 @@ const $A = {
1943
1944
  (n) => n.extension
1944
1945
  );
1945
1946
  export {
1946
- d as B,
1947
+ q as B,
1947
1948
  K as D,
1948
1949
  $A as F,
1949
1950
  TA as G,