import{_ as e,h as t,n,r}from"./chunk/Field3dRendererImpl.js";import{t as i}from"./chunk/prepareTransfer.js";self.onmessage=a=>{self.onmessage=null;let{id:o,payload:s}=a.data;function c(e,t){self.postMessage({id:o,payload:e},t)}let l=s.robotConfig,u=s.isFTC,d=s.mode,f=new e().fromArray(s.materialSpecular),p=s.materialShininess,m=[],h=new n;Promise.all([new Promise(e=>{h.load(l.path,e)}),...l.components.map((e,t)=>new Promise(e=>{h.load(l.path.slice(0,-4)+`_`+t.toString()+`.glb`,e)}))]).then(async e=>{let n=e.map(e=>e.scene);for(let e=0;e<n.length;e++){let i=n[e];e===0&&(i.rotation.setFromQuaternion(t(l.rotations)),i.position.set(...l.position));let a=await r(i,d,f,p,!l.disableSimplification,u),o=[];a.normal.length>0&&o.push(a.normal[0]),a.transparent.length>0&&o.push(a.transparent[0]),m.push(o.map(e=>e.toJSON()))}c(m,i(m))})};