@shopware-ag/dive 4.0.2 → 4.1.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 (66) hide show
  1. package/build/chunks/{AssetCache-DadU3pjv.mjs → AssetCache-BukUxOQj.mjs} +1 -1
  2. package/build/chunks/{AssetCache-GSqD2GKD.cjs → AssetCache-qEEswhJh.cjs} +1 -1
  3. package/build/chunks/{AssetExporter-CoL-QXkB.cjs → AssetExporter-42qgIOkb.cjs} +1 -1
  4. package/build/chunks/{AssetExporter-CD2iuQce.mjs → AssetExporter-B92XZQEe.mjs} +1 -1
  5. package/build/chunks/AssetLoader-Bn4R6_rn.cjs +3 -0
  6. package/build/chunks/{AssetLoader-Dwnjh3GI.mjs → AssetLoader-DvbdFdyg.mjs} +61 -62
  7. package/build/chunks/{FileTypes-CUga4xrG.mjs → FileTypes-C8BdyVai.mjs} +795 -492
  8. package/build/chunks/FileTypes-DTCnNV95.cjs +29 -0
  9. package/build/chunks/GridNode-BJ35_54X.cjs +1 -0
  10. package/build/chunks/GridNode-CRviKlfb.mjs +58 -0
  11. package/build/chunks/{ModelComponent-DuBAn1uS.cjs → ModelComponent-CHIXv2a6.cjs} +1 -1
  12. package/build/chunks/{ModelComponent-Cpy9q21L.mjs → ModelComponent-DEUhl62p.mjs} +2 -2
  13. package/build/chunks/{OrbitController-CK4OclLu.cjs → OrbitController-Cq5Q1m82.cjs} +1 -1
  14. package/build/chunks/{OrbitController-DFf6ANcN.mjs → OrbitController-DgAc7NaY.mjs} +1 -1
  15. package/build/chunks/{SpriteTextComponent-Bho3ynCj.cjs → SpriteTextComponent-IYbrESut.cjs} +1 -1
  16. package/build/chunks/{SpriteTextComponent-DrBnD0_-.mjs → SpriteTextComponent-JwWMzAKh.mjs} +1 -1
  17. package/build/chunks/{contributesToBounds-DYmHYES4.mjs → contributesToBounds-DK3AK1Lq.mjs} +4 -3
  18. package/build/chunks/{contributesToBounds-C1mva__U.cjs → contributesToBounds-Dmh3K2n5.cjs} +1 -1
  19. package/build/chunks/{detachTransformControls-DFTq45Xl.cjs → detachTransformControls-C6Zej6b_.cjs} +1 -1
  20. package/build/chunks/{detachTransformControls-D6VK3L3-.mjs → detachTransformControls-DRCqBDEX.mjs} +2 -2
  21. package/build/chunks/draco_decoder-C69s_Ovp.cjs +34 -0
  22. package/build/chunks/draco_decoder-C9dq_cZY.mjs +37 -0
  23. package/build/chunks/draco_decoder-CPiEz08P.cjs +1 -0
  24. package/build/chunks/draco_decoder-kYeZ1HbP.mjs +4 -0
  25. package/build/chunks/draco_wasm_wrapper-DXbP0W2R.cjs +117 -0
  26. package/build/chunks/draco_wasm_wrapper-FC39lTlO.mjs +120 -0
  27. package/build/chunks/{isFileExtensionSupported-CCEhBoz9.cjs → isFileExtensionSupported-CY90yqQo.cjs} +1 -1
  28. package/build/chunks/{isFileExtensionSupported-vz_2VJPi.mjs → isFileExtensionSupported-DRnGwWT2.mjs} +1 -1
  29. package/build/components/camera/CameraComponent.d.ts +2 -1
  30. package/build/components/index.d.ts +1 -0
  31. package/build/components/softshadow/SoftShadowComponent.d.ts +197 -0
  32. package/build/components/softshadow/index.d.ts +1 -0
  33. package/build/constants/VisibilityLayerMask.d.ts +12 -0
  34. package/build/dive.cjs +1 -1
  35. package/build/dive.mjs +63 -61
  36. package/build/engine/node/Node.d.ts +2 -0
  37. package/build/plugins/ar/index.cjs +1 -1
  38. package/build/plugins/ar/index.mjs +2 -2
  39. package/build/plugins/assetcache/index.cjs +1 -1
  40. package/build/plugins/assetcache/index.mjs +1 -1
  41. package/build/plugins/assetexporter/index.cjs +1 -1
  42. package/build/plugins/assetexporter/index.mjs +1 -1
  43. package/build/plugins/assetloader/index.cjs +1 -1
  44. package/build/plugins/assetloader/index.mjs +2 -2
  45. package/build/plugins/assetloader/src/draco/DracoLoader.d.ts +0 -1
  46. package/build/plugins/mediacreator/index.cjs +1 -1
  47. package/build/plugins/mediacreator/index.mjs +1 -1
  48. package/build/plugins/orbitcontroller/index.cjs +1 -1
  49. package/build/plugins/orbitcontroller/index.mjs +1 -1
  50. package/build/plugins/orientationdisplay/index.cjs +1 -1
  51. package/build/plugins/orientationdisplay/index.mjs +3 -3
  52. package/build/plugins/quickview/index.cjs +1 -1
  53. package/build/plugins/quickview/index.mjs +3 -3
  54. package/build/plugins/shader/index.cjs +1 -1
  55. package/build/plugins/shader/index.mjs +3 -2
  56. package/build/plugins/shader/src/index.d.ts +1 -0
  57. package/build/plugins/shader/src/shaders/BlurNode.d.ts +43 -0
  58. package/build/plugins/state/index.cjs +1 -1
  59. package/build/plugins/state/index.mjs +3 -3
  60. package/build/plugins/toolbox/index.cjs +1 -1
  61. package/build/plugins/toolbox/index.mjs +2 -2
  62. package/package.json +2 -2
  63. package/build/chunks/AssetLoader-BOBXNUHe.cjs +0 -3
  64. package/build/chunks/FileTypes-Cm1k0dUE.cjs +0 -29
  65. package/build/chunks/GridNode-CK4PiwHT.cjs +0 -1
  66. package/build/chunks/GridNode-KgFpPNWa.mjs +0 -30
@@ -1,7 +1,7 @@
1
1
  var _ = Object.defineProperty;
2
2
  var f = (i, e, t) => e in i ? _(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var s = (i, e, t) => f(i, typeof e != "symbol" ? e + "" : e, t);
4
- import "./FileTypes-CUga4xrG.mjs";
4
+ import "./FileTypes-C8BdyVai.mjs";
5
5
  import "three/webgpu";
6
6
  import "three/examples/jsm/loaders/HDRLoader.js";
7
7
  import { N as d, F as l } from "./network-error-BONfHWQq.mjs";
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var l=(i,e,t)=>e in i?d(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>l(i,typeof e!="symbol"?e+"":e,t);require("./FileTypes-Cm1k0dUE.cjs");require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");const _=require("./network-error-CdDXil5g.cjs");class f{constructor(e){s(this,"_promise");s(this,"_resolve");s(this,"_arrayBuffer",null);s(this,"_size",0);s(this,"_createdAt");s(this,"_updatedAt");this._uri=e,this._promise=new Promise(t=>{this._resolve=t}),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}_getHeader(e,t){var r,a;return((a=(r=e.headers)==null?void 0:r.get)==null?void 0:a.call(r,t))??null}_concatChunks(e,t){const r=new Uint8Array(t);let a=0;for(const n of e)r.set(n,a),a+=n.byteLength;return r.buffer}async _readBodyWithReader(e){const t=e.body.getReader(),r=[];let a=0;try{for(;;){const o=await t.read();if(o.done)break;const u=o.value??new Uint8Array(0);r.push(u),a+=u.byteLength}}finally{t.releaseLock()}return this._concatChunks(r,a)}async load(){var t;const e=await fetch(this._uri);if(!e.ok)throw new _.NetworkError(this._uri);try{(t=e.body)!=null&&t.getReader?this._arrayBuffer=await this._readBodyWithReader(e):this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new _.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class y{constructor(){s(this,"_cache",new Map)}get(){return this._cache}create(e){const t=new f(e);return this._cache.set(e,t),t}write(e,t){this._cache.set(e,t)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(t=>{this._cache.delete(t)})}clear(){this._cache.clear()}}const h=Symbol.for("@shopware-ag/dive/assetcache"),c=globalThis;c[h]||(c[h]=new y);const w=c[h];exports.AssetCache=w;exports.Chunk=f;
1
+ "use strict";var d=Object.defineProperty;var l=(i,e,t)=>e in i?d(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>l(i,typeof e!="symbol"?e+"":e,t);require("./FileTypes-DTCnNV95.cjs");require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");const _=require("./network-error-CdDXil5g.cjs");class f{constructor(e){s(this,"_promise");s(this,"_resolve");s(this,"_arrayBuffer",null);s(this,"_size",0);s(this,"_createdAt");s(this,"_updatedAt");this._uri=e,this._promise=new Promise(t=>{this._resolve=t}),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}_getHeader(e,t){var r,a;return((a=(r=e.headers)==null?void 0:r.get)==null?void 0:a.call(r,t))??null}_concatChunks(e,t){const r=new Uint8Array(t);let a=0;for(const n of e)r.set(n,a),a+=n.byteLength;return r.buffer}async _readBodyWithReader(e){const t=e.body.getReader(),r=[];let a=0;try{for(;;){const o=await t.read();if(o.done)break;const u=o.value??new Uint8Array(0);r.push(u),a+=u.byteLength}}finally{t.releaseLock()}return this._concatChunks(r,a)}async load(){var t;const e=await fetch(this._uri);if(!e.ok)throw new _.NetworkError(this._uri);try{(t=e.body)!=null&&t.getReader?this._arrayBuffer=await this._readBodyWithReader(e):this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new _.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class y{constructor(){s(this,"_cache",new Map)}get(){return this._cache}create(e){const t=new f(e);return this._cache.set(e,t),t}write(e,t){this._cache.set(e,t)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(t=>{this._cache.delete(t)})}clear(){this._cache.clear()}}const h=Symbol.for("@shopware-ag/dive/assetcache"),c=globalThis;c[h]||(c[h]=new y);const w=c[h];exports.AssetCache=w;exports.Chunk=f;
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var p=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>p(s,typeof e!="symbol"?e+"":e,t);const f=require("three/webgpu"),l=require("three/examples/jsm/exporters/GLTFExporter.js"),y=require("three/examples/jsm/exporters/USDZExporter.js"),o=require("./parse-error-Dy_EE4rL.cjs"),x=require("./contributesToBounds-C1mva__U.cjs"),a=require("./collectAnimations-C3HfZHte.cjs"),c={onlyVisible:!0};class E{constructor(){i(this,"_gltfExporter");i(this,"_usdzExporter");this._gltfExporter=new l.GLTFExporter,this._usdzExporter=new y.USDZExporter}async export(e,t,r){this._computeNormals(e);const n=this._hideNonProductGeometry(e);try{return await this._exportByType(e,t,r)}finally{n()}}async _exportByType(e,t,r){switch(t){case"glb":return this._exportGlb(e,r);case"gltf":return this._exportGltf(e,r);case"usdz":return this._exportUsdz(e,r);default:throw new o.FileTypeError(`Unsupported file type: ${t}`,t)}}async _exportGlb(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!0});if(r instanceof ArrayBuffer)return r;throw new o.ParseError("Failed to export GLB: expected ArrayBuffer")}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLB",r)}}async _exportGltf(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!1}),n=JSON.stringify(r);return new TextEncoder().encode(n).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLTF",r)}}async _exportUsdz(e,t){try{return(await this._usdzExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c})).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export USDZ",r)}}_hideNonProductGeometry(e){const t=[];return e.traverse(r=>{"geometry"in r&&(x.contributesToBounds(r)||r.visible&&(r.visible=!1,t.push(r)))}),()=>{t.forEach(r=>{r.visible=!0})}}_computeNormals(e){e.traverse(t=>{t instanceof f.Mesh&&t.geometry&&(t.geometry.getAttribute("normal")||t.geometry.computeVertexNormals())})}}exports.AssetExporter=E;
1
+ "use strict";var u=Object.defineProperty;var p=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>p(s,typeof e!="symbol"?e+"":e,t);const f=require("three/webgpu"),l=require("three/examples/jsm/exporters/GLTFExporter.js"),y=require("three/examples/jsm/exporters/USDZExporter.js"),o=require("./parse-error-Dy_EE4rL.cjs"),x=require("./contributesToBounds-Dmh3K2n5.cjs"),a=require("./collectAnimations-C3HfZHte.cjs"),c={onlyVisible:!0};class E{constructor(){i(this,"_gltfExporter");i(this,"_usdzExporter");this._gltfExporter=new l.GLTFExporter,this._usdzExporter=new y.USDZExporter}async export(e,t,r){this._computeNormals(e);const n=this._hideNonProductGeometry(e);try{return await this._exportByType(e,t,r)}finally{n()}}async _exportByType(e,t,r){switch(t){case"glb":return this._exportGlb(e,r);case"gltf":return this._exportGltf(e,r);case"usdz":return this._exportUsdz(e,r);default:throw new o.FileTypeError(`Unsupported file type: ${t}`,t)}}async _exportGlb(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!0});if(r instanceof ArrayBuffer)return r;throw new o.ParseError("Failed to export GLB: expected ArrayBuffer")}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLB",r)}}async _exportGltf(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!1}),n=JSON.stringify(r);return new TextEncoder().encode(n).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLTF",r)}}async _exportUsdz(e,t){try{return(await this._usdzExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c})).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export USDZ",r)}}_hideNonProductGeometry(e){const t=[];return e.traverse(r=>{"geometry"in r&&(x.contributesToBounds(r)||r.visible&&(r.visible=!1,t.push(r)))}),()=>{t.forEach(r=>{r.visible=!0})}}_computeNormals(e){e.traverse(t=>{t instanceof f.Mesh&&t.geometry&&(t.geometry.getAttribute("normal")||t.geometry.computeVertexNormals())})}}exports.AssetExporter=E;
@@ -5,7 +5,7 @@ import { Mesh as u } from "three/webgpu";
5
5
  import { GLTFExporter as y } from "three/examples/jsm/exporters/GLTFExporter.js";
6
6
  import { USDZExporter as l } from "three/examples/jsm/exporters/USDZExporter.js";
7
7
  import { F as m, P as o } from "./parse-error-DfOPyLWM.mjs";
8
- import { c as x } from "./contributesToBounds-DYmHYES4.mjs";
8
+ import { c as x } from "./contributesToBounds-DK3AK1Lq.mjs";
9
9
  import { c as i } from "./collectAnimations-BgYCN1le.mjs";
10
10
  const f = { onlyVisible: !0 };
11
11
  class b {
@@ -0,0 +1,3 @@
1
+ "use strict";var k=Object.defineProperty;var x=(_,r,s)=>r in _?k(_,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):_[r]=s;var p=(_,r,s)=>x(_,typeof r!="symbol"?r+"":r,s);const G=require("three/examples/jsm/loaders/GLTFLoader.js"),v=require("three/examples/jsm/loaders/USDLoader.js"),B=require("./FileTypes-DTCnNV95.cjs"),w=require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");const I=require("./isFileExtensionSupported-CY90yqQo.cjs"),R=require("./parse-error-Dy_EE4rL.cjs"),W=require("three/examples/jsm/loaders/DRACOLoader.js"),T=require("./AssetCache-qEEswhJh.cjs");function U(){let _,r;onmessage=function(e){const n=e.data;switch(n.type){case"init":_=n.decoderConfig,r=new Promise(function(i){_.onModuleLoaded=function(f){i({draco:f})},DracoDecoderModule(_)});break;case"decode":const c=n.buffer,d=n.taskConfig;r.then(i=>{const f=i.draco,a=new f.Decoder;try{const l=s(f,a,new Int8Array(c),d),h=l.attributes.map(A=>A.array.buffer);l.index&&h.push(l.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:l},h)}catch(l){console.error(l),self.postMessage({type:"error",id:n.id,error:l.message})}finally{f.destroy(a)}});break}};function s(e,n,c,d){const i=d.attributeIDs,f=d.attributeTypes;let a,l;const h=n.GetEncodedGeometryType(c);if(h===e.TRIANGULAR_MESH)a=new e.Mesh,l=n.DecodeArrayToMesh(c,c.byteLength,a);else if(h===e.POINT_CLOUD)a=new e.PointCloud,l=n.DecodeArrayToPointCloud(c,c.byteLength,a);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!l.ok()||a.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const A={index:null,attributes:[]};for(const g in i){const D=self[f[g]];let y,m;if(d.useUniqueIDs)m=i[g],y=n.GetAttributeByUniqueId(a,m);else{if(m=n.GetAttributeId(a,e[i[g]]),m===-1)continue;y=n.GetAttribute(a,m)}const E=o(e,n,a,g,D,y);g==="color"&&(E.vertexColorSpace=d.vertexColorSpace),A.attributes.push(E)}return h===e.TRIANGULAR_MESH&&(A.index=t(e,n,a)),e.destroy(a),A}function t(e,n,c){const i=c.num_faces()*3,f=i*4,a=e._malloc(f);n.GetTrianglesUInt32Array(c,f,a);const l=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:l,itemSize:1}}function o(e,n,c,d,i,f){const a=c.num_points(),l=f.num_components(),h=u(e,i),A=l*i.BYTES_PER_ELEMENT,g=Math.ceil(A/4)*4,D=g/i.BYTES_PER_ELEMENT,y=a*A,m=a*g,E=e._malloc(y);n.GetAttributeDataArrayForAllPoints(c,f,h,y,E);const O=new i(e.HEAPF32.buffer,E,y/i.BYTES_PER_ELEMENT);let L;if(A===g)L=O.slice();else{L=new i(m/i.BYTES_PER_ELEMENT);let P=0;for(let b=0,N=O.length;b<N;b+=l){for(let S=0;S<l;S++)L[P+S]=O[b+S];P+=D}}return e._free(E),{name:d,count:a,itemSize:l,array:L,stride:D}}function u(e,n){switch(n){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 C={LOAD_DRACO_JS_DECODER:async()=>(await Promise.resolve().then(()=>require("./draco_decoder-C69s_Ovp.cjs"))).default,LOAD_DRACO_WASM_WRAPPER:async()=>(await Promise.resolve().then(()=>require("./draco_wasm_wrapper-DXbP0W2R.cjs"))).default,LOAD_DRACO_WASM_DECODER:async()=>{const _=(await Promise.resolve().then(()=>require("./draco_decoder-CPiEz08P.cjs"))).default;return await(await fetch(_)).arrayBuffer()}};class F extends W.DRACOLoader{constructor(){super(...arguments);p(this,"decoderPending",null);p(this,"decoderConfig",{wasmBinary:null});p(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const s=typeof WebAssembly!="object",t=[];return s?t.push(C.LOAD_DRACO_JS_DECODER()):(t.push(C.LOAD_DRACO_WASM_WRAPPER()),t.push(C.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(t).then(o=>{const u=o[0];s||(this.decoderConfig.wasmBinary=o[1]);const e=U.toString(),n=["/* draco decoder */",u,"","/* worker */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}"))].join(`
2
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}}function j(){let _=null,r=null;const s=[[/'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 t(){return _||(_=occtimportjs({locateFile:function(){return r}})),_}function o(e){for(var n=new TextDecoder("utf-8",{fatal:!1}),c=new TextEncoder,d=n.decode(e),i=0;i<s.length;i++){var f=s[i][0],a=s[i][1];d=d.replace(f,a)}return new Uint8Array(c.encode(d))}function u(e,n){var c=o(n);try{var d=e.ReadStepFile(c,null);if(d.success&&d.root)return d}catch{}try{return e.ReadStepFile(n,null)}catch{return{success:!1,root:{meshes:[],children:[]},meshes:[]}}}onmessage=async function(e){var n=e.data;switch(n.type){case"init":r=n.wasmUrl;break;case"parse":try{var c=await t(),d=new Uint8Array(n.buffer),i=n.fileType,f;if(i==="step"||i==="stp"?f=u(c,d):f=c.ReadIgesFile(d,null),!f.success||!f.root){self.postMessage({type:"error",id:n.id,error:"Failed to parse CAD file"});return}self.postMessage({type:"result",id:n.id,result:f})}catch(a){self.postMessage({type:"error",id:n.id,error:a instanceof Error?a.message:String(a)})}break}}}const M={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 q{constructor(){p(this,"_workerPending",null);p(this,"_worker",null);p(this,"_nextId",0);p(this,"_pending",new Map)}_getWorker(){return this._workerPending?this._workerPending:(this._workerPending=(async()=>{const[r,s]=await Promise.all([M.LOAD_OCCT_JS(),M.LOAD_OCCT_WASM_URL()]),t=j.toString(),o=["/* occt-import-js */",r,"","/* step worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join(`
3
+ `),u=URL.createObjectURL(new Blob([o])),e=new Worker(u),n=new URL(s,window.location.href).href;return e.postMessage({type:"init",wasmUrl:n}),e.onmessage=c=>{const{type:d,id:i,result:f,error:a}=c.data,l=this._pending.get(i);if(l)if(this._pending.delete(i),d==="result")try{l.resolve(this._buildScene(f))}catch(h){l.reject(h instanceof Error?h:new Error(String(h)))}else l.reject(new Error(a??"Worker error"))},e.onerror=c=>{for(const[,{reject:d}]of this._pending)d(new Error(c.message??"Worker error"));this._pending.clear()},this._worker=e,e})(),this._workerPending)}async parseAsync(r,s){const t=this._nextId++,o=await this._getWorker();return new Promise((u,e)=>{this._pending.set(t,{resolve:u,reject:e});const n=r.slice(0);o.postMessage({type:"parse",id:t,buffer:n,fileType:s},[n])})}dispose(){if(this._worker){for(const[,{reject:r}]of this._pending)r(new Error("STEPLoader disposed"));this._pending.clear(),this._worker.terminate(),this._worker=null,this._workerPending=null}}_buildScene(r){const s=new w.Group;return s.name=r.root.name??"CAD Model",this._buildNode(r.root,r.meshes,s),s.rotation.x=-Math.PI/2,s.rotation.z=Math.PI/2,s}_buildNode(r,s,t){const o=new w.Group;o.name=r.name??"Part";for(const u of r.meshes){const e=s[u];if(e!=null&&e.attributes){const n=this._createMesh(e);o.add(n)}}for(const u of r.children)this._buildNode(u,s,o);t.add(o)}_createMesh(r){var d,i;const{position:s,normal:t}=r.attributes,o=r.index??r.attributes.index,u=new w.BufferGeometry;u.setAttribute("position",new w.BufferAttribute(new Float32Array(s.array),3)),(d=t==null?void 0:t.array)!=null&&d.length?u.setAttribute("normal",new w.BufferAttribute(new Float32Array(t.array),3)):u.computeVertexNormals(),(i=o==null?void 0:o.array)!=null&&i.length&&u.setIndex(new w.BufferAttribute(new Uint32Array(o.array),1));const e=r.color,n=new w.MeshStandardMaterial({metalness:.3,roughness:.6});e&&e.length>=3?n.color.setRGB(e[0],e[1],e[2]):n.color.setHex(13421772);const c=new w.Mesh(u,n);return c.name=r.name??"Mesh",c.castShadow=!0,c.receiveShadow=!0,c}}class H{constructor(){p(this,"_gltfLoader");p(this,"_usdLoader");p(this,"_stepLoader");const r=new F;this._gltfLoader=new G.GLTFLoader,this._gltfLoader.setDRACOLoader(r),this._usdLoader=new v.USDLoader,this._stepLoader=new q}async load(r,s){let t;if(s)t=s;else if(t=I.getFileTypeFromUri(r),t.length===0&&(t=await this._detectFileTypeFromContent(r),t.length===0))throw new R.FileTypeError("No file extension found in URI","");if(!I.isFileExtensionSupported(t))throw new R.FileTypeError(`Unsupported file type: ${t}. Supported types: ${B.SUPPORTED_FILE_TYPES.join(", ")}`,t);const o=T.AssetCache.read(r);if(o)return o.arrayBuffer?this._parse(o.arrayBuffer,t):o.promise.then(n=>this._parse(n,t));const e=await T.AssetCache.create(r).load();return this._parse(e,t)}async _detectFileTypeFromContent(r){try{const s=T.AssetCache.read(r);let t;s?s.arrayBuffer?t=s.arrayBuffer:t=await s.promise:t=await T.AssetCache.create(r).load();const o=new Uint8Array(t);return o.length>=12&&String.fromCharCode(o[0],o[1],o[2],o[3])==="glTF"?o[12]===0?"glb":"gltf":o.length>=4&&o[0]===80&&o[1]===75&&(o[2]===3||o[2]===5)&&(o[3]===4||o[3]===6)?"usdz":o.length>=20&&new TextDecoder("ascii").decode(o.subarray(0,20)).startsWith("ISO-10303-21")?"step":o.length>=80&&o[72]===83?"iges":""}catch{return""}}async _parse(r,s){try{switch(s){case"glb":case"gltf":{const t=await this._gltfLoader.parseAsync(r,"");return t.scene.animations=t.animations,t.scene}case"usdz":{const t=this._usdLoader.parse(r);return t.animations=[],t}case"step":case"stp":{const t=await this._stepLoader.parseAsync(r,s);return t.animations=[],t}case"iges":case"igs":{const t=await this._stepLoader.parseAsync(r,s);return t.animations=[],t}}}catch(t){throw t instanceof Error?new R.ParseError(`Failed to parse ${s} file: ${t.message}`,t):new R.ParseError(`Failed to parse ${s} file`)}}}exports.AssetLoader=H;exports.DRACOWorker=U;exports.DracoLoader=F;
@@ -3,37 +3,37 @@ var F = (_, r, s) => r in _ ? k(_, r, { enumerable: !0, configurable: !0, writab
3
3
  var h = (_, r, s) => F(_, typeof r != "symbol" ? r + "" : r, s);
4
4
  import { GLTFLoader as x } from "three/examples/jsm/loaders/GLTFLoader.js";
5
5
  import { USDLoader as G } from "three/examples/jsm/loaders/USDLoader.js";
6
- import { S as B } from "./FileTypes-CUga4xrG.mjs";
6
+ import { S as B } from "./FileTypes-C8BdyVai.mjs";
7
7
  import { Group as C, BufferGeometry as W, BufferAttribute as T, MeshStandardMaterial as v, Mesh as j } from "three/webgpu";
8
8
  import "three/examples/jsm/loaders/HDRLoader.js";
9
- import { g as H, i as z } from "./isFileExtensionSupported-vz_2VJPi.mjs";
9
+ import { g as H, i as z } from "./isFileExtensionSupported-DRnGwWT2.mjs";
10
10
  import { F as P, P as M } from "./parse-error-DfOPyLWM.mjs";
11
11
  import { DRACOLoader as Y } from "three/examples/jsm/loaders/DRACOLoader.js";
12
- import { A as S } from "./AssetCache-DadU3pjv.mjs";
12
+ import { A as S } from "./AssetCache-BukUxOQj.mjs";
13
13
  function J() {
14
14
  let _, r;
15
15
  onmessage = function(e) {
16
16
  const n = e.data;
17
17
  switch (n.type) {
18
18
  case "init":
19
- _ = n.decoderConfig, r = new Promise(function(i) {
19
+ _ = n.decoderConfig, r = new Promise(function(a) {
20
20
  _.onModuleLoaded = function(f) {
21
- i({ draco: f });
21
+ a({ draco: f });
22
22
  }, DracoDecoderModule(_);
23
23
  });
24
24
  break;
25
25
  case "decode":
26
26
  const c = n.buffer, d = n.taskConfig;
27
- r.then((i) => {
28
- const f = i.draco, a = new f.Decoder();
27
+ r.then((a) => {
28
+ const f = a.draco, i = new f.Decoder();
29
29
  try {
30
30
  const l = s(
31
31
  f,
32
- a,
32
+ i,
33
33
  new Int8Array(c),
34
34
  d
35
35
  ), p = l.attributes.map(
36
- (g) => g.array.buffer
36
+ (m) => m.array.buffer
37
37
  );
38
38
  l.index && p.push(l.index.array.buffer), self.postMessage(
39
39
  { type: "decode", id: n.id, geometry: l },
@@ -46,74 +46,74 @@ function J() {
46
46
  error: l.message
47
47
  });
48
48
  } finally {
49
- f.destroy(a);
49
+ f.destroy(i);
50
50
  }
51
51
  });
52
52
  break;
53
53
  }
54
54
  };
55
55
  function s(e, n, c, d) {
56
- const i = d.attributeIDs, f = d.attributeTypes;
57
- let a, l;
56
+ const a = d.attributeIDs, f = d.attributeTypes;
57
+ let i, l;
58
58
  const p = n.GetEncodedGeometryType(c);
59
59
  if (p === e.TRIANGULAR_MESH)
60
- a = new e.Mesh(), l = n.DecodeArrayToMesh(
60
+ i = new e.Mesh(), l = n.DecodeArrayToMesh(
61
61
  c,
62
62
  c.byteLength,
63
- a
63
+ i
64
64
  );
65
65
  else if (p === e.POINT_CLOUD)
66
- a = new e.PointCloud(), l = n.DecodeArrayToPointCloud(
66
+ i = new e.PointCloud(), l = n.DecodeArrayToPointCloud(
67
67
  c,
68
68
  c.byteLength,
69
- a
69
+ i
70
70
  );
71
71
  else
72
72
  throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
73
- if (!l.ok() || a.ptr === 0)
73
+ if (!l.ok() || i.ptr === 0)
74
74
  throw new Error(
75
75
  "THREE.DRACOLoader: Decoding failed: " + l.error_msg()
76
76
  );
77
- const g = { index: null, attributes: [] };
78
- for (const m in i) {
79
- const E = self[f[m]];
77
+ const m = { index: null, attributes: [] };
78
+ for (const g in a) {
79
+ const E = self[f[g]];
80
80
  let w, A;
81
81
  if (d.useUniqueIDs)
82
- A = i[m], w = n.GetAttributeByUniqueId(
83
- a,
82
+ A = a[g], w = n.GetAttributeByUniqueId(
83
+ i,
84
84
  A
85
85
  );
86
86
  else {
87
87
  if (A = n.GetAttributeId(
88
- a,
89
- e[i[m]]
88
+ i,
89
+ e[a[g]]
90
90
  ), A === -1) continue;
91
- w = n.GetAttribute(a, A);
91
+ w = n.GetAttribute(i, A);
92
92
  }
93
93
  const y = o(
94
94
  e,
95
95
  n,
96
- a,
97
- m,
96
+ i,
97
+ g,
98
98
  E,
99
99
  w
100
100
  );
101
- m === "color" && (y.vertexColorSpace = d.vertexColorSpace), g.attributes.push(y);
101
+ g === "color" && (y.vertexColorSpace = d.vertexColorSpace), m.attributes.push(y);
102
102
  }
103
- return p === e.TRIANGULAR_MESH && (g.index = t(e, n, a)), e.destroy(a), g;
103
+ return p === e.TRIANGULAR_MESH && (m.index = t(e, n, i)), e.destroy(i), m;
104
104
  }
105
105
  function t(e, n, c) {
106
- const i = c.num_faces() * 3, f = i * 4, a = e._malloc(f);
107
- n.GetTrianglesUInt32Array(c, f, a);
106
+ const a = c.num_faces() * 3, f = a * 4, i = e._malloc(f);
107
+ n.GetTrianglesUInt32Array(c, f, i);
108
108
  const l = new Uint32Array(
109
109
  e.HEAPF32.buffer,
110
- a,
111
- i
110
+ i,
111
+ a
112
112
  ).slice();
113
- return e._free(a), { array: l, itemSize: 1 };
113
+ return e._free(i), { array: l, itemSize: 1 };
114
114
  }
115
- function o(e, n, c, d, i, f) {
116
- const a = c.num_points(), l = f.num_components(), p = u(e, i), g = l * i.BYTES_PER_ELEMENT, m = Math.ceil(g / 4) * 4, E = m / i.BYTES_PER_ELEMENT, w = a * g, A = a * m, y = e._malloc(w);
115
+ function o(e, n, c, d, a, f) {
116
+ const i = c.num_points(), l = f.num_components(), p = u(e, a), m = l * a.BYTES_PER_ELEMENT, g = Math.ceil(m / 4) * 4, E = g / a.BYTES_PER_ELEMENT, w = i * m, A = i * g, y = e._malloc(w);
117
117
  n.GetAttributeDataArrayForAllPoints(
118
118
  c,
119
119
  f,
@@ -121,17 +121,17 @@ function J() {
121
121
  w,
122
122
  y
123
123
  );
124
- const R = new i(
124
+ const R = new a(
125
125
  e.HEAPF32.buffer,
126
126
  y,
127
- w / i.BYTES_PER_ELEMENT
127
+ w / a.BYTES_PER_ELEMENT
128
128
  );
129
129
  let D;
130
- if (g === m)
130
+ if (m === g)
131
131
  D = R.slice();
132
132
  else {
133
- D = new i(
134
- A / i.BYTES_PER_ELEMENT
133
+ D = new a(
134
+ A / a.BYTES_PER_ELEMENT
135
135
  );
136
136
  let I = 0;
137
137
  for (let O = 0, N = R.length; O < N; O += l) {
@@ -142,7 +142,7 @@ function J() {
142
142
  }
143
143
  return e._free(y), {
144
144
  name: d,
145
- count: a,
145
+ count: i,
146
146
  itemSize: l,
147
147
  array: D,
148
148
  stride: E
@@ -168,10 +168,10 @@ function J() {
168
168
  }
169
169
  }
170
170
  const b = {
171
- LOAD_DRACO_JS_DECODER: async () => (await import("three/examples/jsm/libs/draco/draco_decoder.js?raw")).default,
172
- LOAD_DRACO_WASM_WRAPPER: async () => (await import("three/examples/jsm/libs/draco/draco_wasm_wrapper.js?raw")).default,
171
+ LOAD_DRACO_JS_DECODER: async () => (await import("./draco_decoder-C9dq_cZY.mjs")).default,
172
+ LOAD_DRACO_WASM_WRAPPER: async () => (await import("./draco_wasm_wrapper-FC39lTlO.mjs")).default,
173
173
  LOAD_DRACO_WASM_DECODER: async () => {
174
- const _ = (await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;
174
+ const _ = (await import("./draco_decoder-kYeZ1HbP.mjs")).default;
175
175
  return await (await fetch(_)).arrayBuffer();
176
176
  }
177
177
  };
@@ -180,14 +180,13 @@ class $ extends Y {
180
180
  super(...arguments);
181
181
  h(this, "decoderPending", null);
182
182
  h(this, "decoderConfig", {
183
- type: "js",
184
183
  wasmBinary: null
185
184
  });
186
185
  h(this, "workerSourceURL", "");
187
186
  }
188
187
  async _initDecoder() {
189
188
  if (this.decoderPending) return this.decoderPending;
190
- const s = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
189
+ const s = typeof WebAssembly != "object", t = [];
191
190
  return s ? t.push(
192
191
  b.LOAD_DRACO_JS_DECODER()
193
192
  ) : (t.push(
@@ -232,9 +231,9 @@ function q() {
232
231
  })), _;
233
232
  }
234
233
  function o(e) {
235
- for (var n = new TextDecoder("utf-8", { fatal: !1 }), c = new TextEncoder(), d = n.decode(e), i = 0; i < s.length; i++) {
236
- var f = s[i][0], a = s[i][1];
237
- d = d.replace(f, a);
234
+ for (var n = new TextDecoder("utf-8", { fatal: !1 }), c = new TextEncoder(), d = n.decode(e), a = 0; a < s.length; a++) {
235
+ var f = s[a][0], i = s[a][1];
236
+ d = d.replace(f, i);
238
237
  }
239
238
  return new Uint8Array(c.encode(d));
240
239
  }
@@ -263,8 +262,8 @@ function q() {
263
262
  break;
264
263
  case "parse":
265
264
  try {
266
- var c = await t(), d = new Uint8Array(n.buffer), i = n.fileType, f;
267
- if (i === "step" || i === "stp" ? f = u(c, d) : f = c.ReadIgesFile(d, null), !f.success || !f.root) {
265
+ var c = await t(), d = new Uint8Array(n.buffer), a = n.fileType, f;
266
+ if (a === "step" || a === "stp" ? f = u(c, d) : f = c.ReadIgesFile(d, null), !f.success || !f.root) {
268
267
  self.postMessage({
269
268
  type: "error",
270
269
  id: n.id,
@@ -277,11 +276,11 @@ function q() {
277
276
  id: n.id,
278
277
  result: f
279
278
  });
280
- } catch (a) {
279
+ } catch (i) {
281
280
  self.postMessage({
282
281
  type: "error",
283
282
  id: n.id,
284
- error: a instanceof Error ? a.message : String(a)
283
+ error: i instanceof Error ? i.message : String(i)
285
284
  });
286
285
  }
287
286
  break;
@@ -318,9 +317,9 @@ class V {
318
317
  ].join(`
319
318
  `), u = URL.createObjectURL(new Blob([o])), e = new Worker(u), n = new URL(s, window.location.href).href;
320
319
  return e.postMessage({ type: "init", wasmUrl: n }), e.onmessage = (c) => {
321
- const { type: d, id: i, result: f, error: a } = c.data, l = this._pending.get(i);
320
+ const { type: d, id: a, result: f, error: i } = c.data, l = this._pending.get(a);
322
321
  if (l)
323
- if (this._pending.delete(i), d === "result")
322
+ if (this._pending.delete(a), d === "result")
324
323
  try {
325
324
  l.resolve(this._buildScene(f));
326
325
  } catch (p) {
@@ -329,7 +328,7 @@ class V {
329
328
  );
330
329
  }
331
330
  else
332
- l.reject(new Error(a ?? "Worker error"));
331
+ l.reject(new Error(i ?? "Worker error"));
333
332
  }, e.onerror = (c) => {
334
333
  for (const [, { reject: d }] of this._pending)
335
334
  d(new Error(c.message ?? "Worker error"));
@@ -379,7 +378,7 @@ class V {
379
378
  t.add(o);
380
379
  }
381
380
  _createMesh(r) {
382
- var d, i;
381
+ var d, a;
383
382
  const { position: s, normal: t } = r.attributes, o = r.index ?? r.attributes.index, u = new W();
384
383
  u.setAttribute(
385
384
  "position",
@@ -387,7 +386,7 @@ class V {
387
386
  ), (d = t == null ? void 0 : t.array) != null && d.length ? u.setAttribute(
388
387
  "normal",
389
388
  new T(new Float32Array(t.array), 3)
390
- ) : u.computeVertexNormals(), (i = o == null ? void 0 : o.array) != null && i.length && u.setIndex(
389
+ ) : u.computeVertexNormals(), (a = o == null ? void 0 : o.array) != null && a.length && u.setIndex(
391
390
  new T(new Uint32Array(o.array), 1)
392
391
  );
393
392
  const e = r.color, n = new v({
@@ -399,13 +398,13 @@ class V {
399
398
  return c.name = r.name ?? "Mesh", c.castShadow = !0, c.receiveShadow = !0, c;
400
399
  }
401
400
  }
402
- class ie {
401
+ class ae {
403
402
  constructor() {
404
403
  h(this, "_gltfLoader");
405
404
  h(this, "_usdLoader");
406
405
  h(this, "_stepLoader");
407
406
  const r = new $();
408
- r.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new x(), this._gltfLoader.setDRACOLoader(r), this._usdLoader = new G(), this._stepLoader = new V();
407
+ this._gltfLoader = new x(), this._gltfLoader.setDRACOLoader(r), this._usdLoader = new G(), this._stepLoader = new V();
409
408
  }
410
409
  async load(r, s) {
411
410
  let t;
@@ -499,7 +498,7 @@ class ie {
499
498
  }
500
499
  }
501
500
  export {
502
- ie as A,
501
+ ae as A,
503
502
  J as D,
504
503
  $ as a
505
504
  };