@shopware-ag/dive 1.19.1-beta.4 → 1.19.1-beta.5

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.
package/build/index.cjs CHANGED
@@ -24,7 +24,7 @@ __p += '`),N&&(M+=`' +
24
24
  function print() { __p += __j.call(arguments, '') }
25
25
  `:`;
26
26
  `)+M+`return __p
27
- }`;var k=Sl(function(){return Y(c,L+"return "+M).apply(n,h)});if(k.source=M,Rs(k))throw k;return k}function Eg(e){return X(e).toLowerCase()}function xg(e){return X(e).toUpperCase()}function Sg(e,t,i){if(e=X(e),e&&(i||t===n))return Co(e);if(!e||!(t=$e(t)))return e;var s=pt(e),o=pt(t),c=Io(s,o),h=Go(s,o)+1;return Jt(s,c,h).join("")}function Mg(e,t,i){if(e=X(e),e&&(i||t===n))return e.slice(0,Uo(e)+1);if(!e||!(t=$e(t)))return e;var s=pt(e),o=Go(s,pt(t))+1;return Jt(s,0,o).join("")}function Ag(e,t,i){if(e=X(e),e&&(i||t===n))return e.replace(Yt,"");if(!e||!(t=$e(t)))return e;var s=pt(e),o=Io(s,pt(t));return Jt(s,o).join("")}function Pg(e,t){var i=Yn,s=kt;if(ae(t)){var o="separator"in t?t.separator:o;i="length"in t?U(t.length):i,s="omission"in t?$e(t.omission):s}e=X(e);var c=e.length;if(On(e)){var h=pt(e);c=h.length}if(i>=c)return e;var d=i-Dn(s);if(d<1)return s;var m=h?Jt(h,0,d).join(""):e.slice(0,d);if(o===n)return m+s;if(h&&(d+=m.length-d),Ts(o)){if(e.slice(d).search(o)){var E,x=m;for(o.global||(o=Yr(o.source,X(eo.exec(o))+"g")),o.lastIndex=0;E=o.exec(x);)var M=E.index;m=m.slice(0,M===n?d:M)}}else if(e.indexOf($e(o),d)!=d){var A=m.lastIndexOf(o);A>-1&&(m=m.slice(0,A))}return m+s}function Rg(e){return e=X(e),e&&wt.test(e)?e.replace(Q,nu):e}var Tg=zn(function(e,t,i){return e+(i?" ":"")+t.toUpperCase()}),Ds=Ma("toUpperCase");function xl(e,t,i){return e=X(e),t=i?n:t,t===n?qc(e)?su(e):Vc(e):e.match(t)||[]}var Sl=z(function(e,t){try{return Ke(e,n,t)}catch(i){return Rs(i)?i:new G(i)}}),Lg=Ct(function(e,t){return rt(t,function(i){i=xt(i),Ot(e,i,As(e[i],e))}),e});function Og(e){var t=e==null?0:e.length,i=O();return e=t?se(e,function(s){if(typeof s[1]!="function")throw new st(g);return[i(s[0]),s[1]]}):[],z(function(s){for(var o=-1;++o<t;){var c=e[o];if(Ke(c[0],this,s))return Ke(c[1],this,s)}})}function Dg(e){return nh(at(e,ce))}function Cs(e){return function(){return e}}function Cg(e,t){return e==null||e!==e?t:e}var Ig=Pa(),Gg=Pa(!0);function He(e){return e}function Is(e){return ia(typeof e=="function"?e:at(e,ce))}function Bg(e){return sa(at(e,ce))}function Ug(e,t){return oa(e,at(t,ce))}var kg=z(function(e,t){return function(i){return si(i,e,t)}}),zg=z(function(e,t){return function(i){return si(e,i,t)}});function Gs(e,t,i){var s=Ee(t),o=Ki(t,s);i==null&&!(ae(t)&&(o.length||!s.length))&&(i=t,t=e,e=this,o=Ki(t,Ee(t)));var c=!(ae(i)&&"chain"in i)||!!i.chain,h=Gt(e);return rt(o,function(d){var m=t[d];e[d]=m,h&&(e.prototype[d]=function(){var E=this.__chain__;if(c||E){var x=e(this.__wrapped__),M=x.__actions__=We(this.__actions__);return M.push({func:m,args:arguments,thisArg:e}),x.__chain__=E,x}return m.apply(e,jt([this.value()],arguments))})}),e}function Fg(){return Me._===this&&(Me._=hu),this}function Bs(){}function Wg(e){return e=U(e),z(function(t){return aa(t,e)})}var Vg=ds(se),Ng=ds(Ro),Hg=ds(kr);function Ml(e){return ws(e)?zr(xt(e)):vh(e)}function Yg(e){return function(t){return e==null?n:pn(e,t)}}var Xg=Ta(),jg=Ta(!0);function Us(){return[]}function ks(){return!1}function Zg(){return{}}function Qg(){return""}function Kg(){return!0}function qg(e,t){if(e=U(e),e<1||e>Te)return[];var i=we,s=Le(e,we);t=O(t),e-=we;for(var o=Vr(s,t);++i<e;)t(i);return o}function $g(e){return B(e)?se(e,xt):Je(e)?[e]:We(Ya(X(e)))}function Jg(e){var t=++cu;return X(e)+t}var e0=nr(function(e,t){return e+t},0),t0=ps("ceil"),n0=nr(function(e,t){return e/t},1),i0=ps("floor");function r0(e){return e&&e.length?Qi(e,He,Jr):n}function s0(e,t){return e&&e.length?Qi(e,O(t,2),Jr):n}function o0(e){return Oo(e,He)}function a0(e,t){return Oo(e,O(t,2))}function l0(e){return e&&e.length?Qi(e,He,is):n}function c0(e,t){return e&&e.length?Qi(e,O(t,2),is):n}var u0=nr(function(e,t){return e*t},1),h0=ps("round"),f0=nr(function(e,t){return e-t},0);function d0(e){return e&&e.length?Wr(e,He):0}function p0(e,t){return e&&e.length?Wr(e,O(t,2)):0}return l.after=Bd,l.ary=nl,l.assign=xp,l.assignIn=_l,l.assignInWith=gr,l.assignWith=Sp,l.at=Mp,l.before=il,l.bind=As,l.bindAll=Lg,l.bindKey=rl,l.castArray=Zd,l.chain=Ja,l.chunk=nf,l.compact=rf,l.concat=sf,l.cond=Og,l.conforms=Dg,l.constant=Cs,l.countBy=dd,l.create=Ap,l.curry=sl,l.curryRight=ol,l.debounce=al,l.defaults=Pp,l.defaultsDeep=Rp,l.defer=Ud,l.delay=kd,l.difference=of,l.differenceBy=af,l.differenceWith=lf,l.drop=cf,l.dropRight=uf,l.dropRightWhile=hf,l.dropWhile=ff,l.fill=df,l.filter=gd,l.flatMap=bd,l.flatMapDeep=vd,l.flatMapDepth=wd,l.flatten=Qa,l.flattenDeep=pf,l.flattenDepth=gf,l.flip=zd,l.flow=Ig,l.flowRight=Gg,l.fromPairs=_f,l.functions=Gp,l.functionsIn=Bp,l.groupBy=yd,l.initial=bf,l.intersection=vf,l.intersectionBy=wf,l.intersectionWith=yf,l.invert=kp,l.invertBy=zp,l.invokeMap=xd,l.iteratee=Is,l.keyBy=Sd,l.keys=Ee,l.keysIn=Ne,l.map=cr,l.mapKeys=Wp,l.mapValues=Vp,l.matches=Bg,l.matchesProperty=Ug,l.memoize=hr,l.merge=Np,l.mergeWith=ml,l.method=kg,l.methodOf=zg,l.mixin=Gs,l.negate=fr,l.nthArg=Wg,l.omit=Hp,l.omitBy=Yp,l.once=Fd,l.orderBy=Md,l.over=Vg,l.overArgs=Wd,l.overEvery=Ng,l.overSome=Hg,l.partial=Ps,l.partialRight=ll,l.partition=Ad,l.pick=Xp,l.pickBy=bl,l.property=Ml,l.propertyOf=Yg,l.pull=Mf,l.pullAll=qa,l.pullAllBy=Af,l.pullAllWith=Pf,l.pullAt=Rf,l.range=Xg,l.rangeRight=jg,l.rearg=Vd,l.reject=Td,l.remove=Tf,l.rest=Nd,l.reverse=Ss,l.sampleSize=Od,l.set=Zp,l.setWith=Qp,l.shuffle=Dd,l.slice=Lf,l.sortBy=Gd,l.sortedUniq=Uf,l.sortedUniqBy=kf,l.split=bg,l.spread=Hd,l.tail=zf,l.take=Ff,l.takeRight=Wf,l.takeRightWhile=Vf,l.takeWhile=Nf,l.tap=rd,l.throttle=Yd,l.thru=lr,l.toArray=dl,l.toPairs=vl,l.toPairsIn=wl,l.toPath=$g,l.toPlainObject=gl,l.transform=Kp,l.unary=Xd,l.union=Hf,l.unionBy=Yf,l.unionWith=Xf,l.uniq=jf,l.uniqBy=Zf,l.uniqWith=Qf,l.unset=qp,l.unzip=Ms,l.unzipWith=$a,l.update=$p,l.updateWith=Jp,l.values=Vn,l.valuesIn=eg,l.without=Kf,l.words=xl,l.wrap=jd,l.xor=qf,l.xorBy=$f,l.xorWith=Jf,l.zip=ed,l.zipObject=td,l.zipObjectDeep=nd,l.zipWith=id,l.entries=vl,l.entriesIn=wl,l.extend=_l,l.extendWith=gr,Gs(l,l),l.add=e0,l.attempt=Sl,l.camelCase=rg,l.capitalize=yl,l.ceil=t0,l.clamp=tg,l.clone=Qd,l.cloneDeep=qd,l.cloneDeepWith=$d,l.cloneWith=Kd,l.conformsTo=Jd,l.deburr=El,l.defaultTo=Cg,l.divide=n0,l.endsWith=sg,l.eq=_t,l.escape=og,l.escapeRegExp=ag,l.every=pd,l.find=_d,l.findIndex=ja,l.findKey=Tp,l.findLast=md,l.findLastIndex=Za,l.findLastKey=Lp,l.floor=i0,l.forEach=el,l.forEachRight=tl,l.forIn=Op,l.forInRight=Dp,l.forOwn=Cp,l.forOwnRight=Ip,l.get=Ls,l.gt=ep,l.gte=tp,l.has=Up,l.hasIn=Os,l.head=Ka,l.identity=He,l.includes=Ed,l.indexOf=mf,l.inRange=ng,l.invoke=Fp,l.isArguments=mn,l.isArray=B,l.isArrayBuffer=np,l.isArrayLike=Ve,l.isArrayLikeObject=fe,l.isBoolean=ip,l.isBuffer=en,l.isDate=rp,l.isElement=sp,l.isEmpty=op,l.isEqual=ap,l.isEqualWith=lp,l.isError=Rs,l.isFinite=cp,l.isFunction=Gt,l.isInteger=cl,l.isLength=dr,l.isMap=ul,l.isMatch=up,l.isMatchWith=hp,l.isNaN=fp,l.isNative=dp,l.isNil=gp,l.isNull=pp,l.isNumber=hl,l.isObject=ae,l.isObjectLike=he,l.isPlainObject=hi,l.isRegExp=Ts,l.isSafeInteger=_p,l.isSet=fl,l.isString=pr,l.isSymbol=Je,l.isTypedArray=Wn,l.isUndefined=mp,l.isWeakMap=bp,l.isWeakSet=vp,l.join=Ef,l.kebabCase=lg,l.last=ct,l.lastIndexOf=xf,l.lowerCase=cg,l.lowerFirst=ug,l.lt=wp,l.lte=yp,l.max=r0,l.maxBy=s0,l.mean=o0,l.meanBy=a0,l.min=l0,l.minBy=c0,l.stubArray=Us,l.stubFalse=ks,l.stubObject=Zg,l.stubString=Qg,l.stubTrue=Kg,l.multiply=u0,l.nth=Sf,l.noConflict=Fg,l.noop=Bs,l.now=ur,l.pad=hg,l.padEnd=fg,l.padStart=dg,l.parseInt=pg,l.random=ig,l.reduce=Pd,l.reduceRight=Rd,l.repeat=gg,l.replace=_g,l.result=jp,l.round=h0,l.runInContext=_,l.sample=Ld,l.size=Cd,l.snakeCase=mg,l.some=Id,l.sortedIndex=Of,l.sortedIndexBy=Df,l.sortedIndexOf=Cf,l.sortedLastIndex=If,l.sortedLastIndexBy=Gf,l.sortedLastIndexOf=Bf,l.startCase=vg,l.startsWith=wg,l.subtract=f0,l.sum=d0,l.sumBy=p0,l.template=yg,l.times=qg,l.toFinite=Bt,l.toInteger=U,l.toLength=pl,l.toLower=Eg,l.toNumber=ut,l.toSafeInteger=Ep,l.toString=X,l.toUpper=xg,l.trim=Sg,l.trimEnd=Mg,l.trimStart=Ag,l.truncate=Pg,l.unescape=Rg,l.uniqueId=Jg,l.upperCase=Tg,l.upperFirst=Ds,l.each=el,l.eachRight=tl,l.first=Ka,Gs(l,function(){var e={};return yt(l,function(t,i){K.call(l.prototype,i)||(e[i]=t)}),e}(),{chain:!1}),l.VERSION=r,rt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),rt(["drop","take"],function(e,t){V.prototype[e]=function(i){i=i===n?1:ve(U(i),0);var s=this.__filtered__&&!t?new V(this):this.clone();return s.__filtered__?s.__takeCount__=Le(i,s.__takeCount__):s.__views__.push({size:Le(i,we),type:e+(s.__dir__<0?"Right":"")}),s},V.prototype[e+"Right"]=function(i){return this.reverse()[e](i).reverse()}}),rt(["filter","map","takeWhile"],function(e,t){var i=t+1,s=i==Ge||i==je;V.prototype[e]=function(o){var c=this.clone();return c.__iteratees__.push({iteratee:O(o,3),type:i}),c.__filtered__=c.__filtered__||s,c}}),rt(["head","last"],function(e,t){var i="take"+(t?"Right":"");V.prototype[e]=function(){return this[i](1).value()[0]}}),rt(["initial","tail"],function(e,t){var i="drop"+(t?"":"Right");V.prototype[e]=function(){return this.__filtered__?new V(this):this[i](1)}}),V.prototype.compact=function(){return this.filter(He)},V.prototype.find=function(e){return this.filter(e).head()},V.prototype.findLast=function(e){return this.reverse().find(e)},V.prototype.invokeMap=z(function(e,t){return typeof e=="function"?new V(this):this.map(function(i){return si(i,e,t)})}),V.prototype.reject=function(e){return this.filter(fr(O(e)))},V.prototype.slice=function(e,t){e=U(e);var i=this;return i.__filtered__&&(e>0||t<0)?new V(i):(e<0?i=i.takeRight(-e):e&&(i=i.drop(e)),t!==n&&(t=U(t),i=t<0?i.dropRight(-t):i.take(t-e)),i)},V.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},V.prototype.toArray=function(){return this.take(we)},yt(V.prototype,function(e,t){var i=/^(?:filter|find|map|reject)|While$/.test(t),s=/^(?:head|last)$/.test(t),o=l[s?"take"+(t=="last"?"Right":""):t],c=s||/^find/.test(t);o&&(l.prototype[t]=function(){var h=this.__wrapped__,d=s?[1]:arguments,m=h instanceof V,E=d[0],x=m||B(h),M=function(W){var N=o.apply(l,jt([W],d));return s&&A?N[0]:N};x&&i&&typeof E=="function"&&E.length!=1&&(m=x=!1);var A=this.__chain__,L=!!this.__actions__.length,C=c&&!A,k=m&&!L;if(!c&&x){h=k?h:new V(this);var I=e.apply(h,d);return I.__actions__.push({func:lr,args:[M],thisArg:n}),new ot(I,A)}return C&&k?e.apply(this,d):(I=this.thru(M),C?s?I.value()[0]:I.value():I)})}),rt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Ii[e],i=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",s=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var o=arguments;if(s&&!this.__chain__){var c=this.value();return t.apply(B(c)?c:[],o)}return this[i](function(h){return t.apply(B(h)?h:[],o)})}}),yt(V.prototype,function(e,t){var i=l[t];if(i){var s=i.name+"";K.call(Bn,s)||(Bn[s]=[]),Bn[s].push({name:t,func:i})}}),Bn[tr(n,re).name]=[{name:"wrapper",func:n}],V.prototype.clone=Pu,V.prototype.reverse=Ru,V.prototype.value=Tu,l.prototype.at=sd,l.prototype.chain=od,l.prototype.commit=ad,l.prototype.next=ld,l.prototype.plant=ud,l.prototype.reverse=hd,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=fd,l.prototype.first=l.prototype.head,$n&&(l.prototype[$n]=cd),l},Cn=ou();cn?((cn.exports=Cn)._=Cn,Ir._=Cn):Me._=Cn}).call(O0)}(_i,_i.exports)),_i.exports}var C0=D0(),I0={AssetLoader:"./src/modules/asset/loader/AssetLoader.mjs",AssetConverter:"./src/modules/asset/converter/AssetConverter.mjs",AssetExporter:"./src/modules/asset/exporter/AssetExporter.mjs",ARSystem:"./src/modules/ar/ARSystem.mjs",MediaCreator:"./src/modules/mediacreator/MediaCreator.mjs",SystemInfo:"./src/modules/systeminfo/SystemInfo.mjs"};class G0{constructor(a){y(this,"_promise",null);y(this,"_instance",null);y(this,"_importFn");this._name=a,this._importFn=async()=>{const n=I0[this._name];if(!n)throw new Error(`Build path for module ${this._name} not found in __MODULE_BUILD_PATHS__. Build configuration issue?`);try{const r=await import(n);if(!r[this._name])throw new Error(`Module class ${this._name} not found in dynamically imported module: ${n}`);return r[this._name]}catch(r){throw new Error(`Failed to dynamically import module ${this._name} from path ${n}: ${r instanceof Error?r.message:String(r)}`)}}}async getInstance(){if(this._instance!==null)return this._instance;this._promise||(this._promise=this._importFn());try{const a=await this._promise;return this._instance=new a,this._instance}catch(a){throw new Error(`Failed to instantiate module ${this._name}: ${a instanceof Error?a.message:String(a)}`)}}}const Mr=class Mr{constructor(){y(this,"_modules",new Map)}static get instance(){return this._instance}register(a){this._modules.has(a)&&console.warn(`Module '${a}' is already registered. Overwriting.`),this._modules.set(a,new G0(a))}async get(a){const n=this._modules.get(a);if(!n)throw new Error(`Module '${a}' not registered`);return n.getInstance()}};y(Mr,"_instance",new Mr);let js=Mr;const mi=js.instance,B0={AssetLoader:"./asset/loader/AssetLoader.ts",AssetConverter:"./asset/converter/AssetConverter.ts",AssetExporter:"./asset/exporter/AssetExporter.ts",ARSystem:"./ar/ARSystem.ts",MediaCreator:"./mediacreator/MediaCreator.ts",SystemInfo:"./systeminfo/SystemInfo.ts"};Object.keys(B0).forEach(S=>{mi.register(S)});const Hn=class Hn{constructor(a,n,r,f){y(this,"_id");y(this,"renderer");y(this,"scene");y(this,"controller");y(this,"toolbox");y(this,"registered",new Map);y(this,"listeners",new Map);this._id=L0(),this.renderer=a,this.scene=n,this.controller=r,this.toolbox=f,Hn.__instances.push(this)}static get(a){const n=this.__instances.find(r=>r.id===a);return n||this.__instances.find(r=>Array.from(r.registered.values()).find(f=>f.id===a))}get id(){return this._id}DestroyInstance(){const a=Hn.__instances.findIndex(n=>n.id===this.id);return a===-1?!1:(Hn.__instances.splice(a,1),!0)}PerformAction(a,n){let r=!1;switch(a){case"START_RENDER":{this.renderer.StartRenderer(this.scene,this.controller.object),r=!0;break}case"GET_ALL_SCENE_DATA":{r=this.getAllSceneData(n);break}case"GET_ALL_OBJECTS":{r=this.getAllObjects(n);break}case"GET_OBJECTS":{r=this.getObjects(n);break}case"ADD_OBJECT":{r=this.addObject(n);break}case"UPDATE_OBJECT":{r=this.updateObject(n);break}case"DELETE_OBJECT":{r=this.deleteObject(n);break}case"SELECT_OBJECT":{r=this.selectObject(n);break}case"DESELECT_OBJECT":{r=this.deselectObject(n);break}case"SET_BACKGROUND":{r=this.setBackground(n);break}case"DROP_IT":{r=this.dropIt(n);break}case"PLACE_ON_FLOOR":{r=this.placeOnFloor(n);break}case"SET_CAMERA_TRANSFORM":{r=this.setCameraTransform(n);break}case"GET_CAMERA_TRANSFORM":{r=this.getCameraTransform(n);break}case"MOVE_CAMERA":{r=this.moveCamera(n);break}case"RESET_CAMERA":{r=this.resetCamera(n);break}case"COMPUTE_ENCOMPASSING_VIEW":{r=this.computeEncompassingView(n);break}case"SET_CAMERA_LAYER":{r=this.setCameraLayer(n);break}case"ZOOM_CAMERA":{r=this.zoomCamera(n);break}case"SET_GIZMO_MODE":{r=this.setGizmoMode(n);break}case"SET_GIZMO_VISIBILITY":{r=this.setGizmoVisibility(n);break}case"SET_GIZMO_SCALE_LINKED":{r=this.setGizmoScaleLinked(n);break}case"USE_TOOL":{r=this.useTool(n);break}case"MODEL_LOADED":{r=this.modelLoaded(n);break}case"UPDATE_SCENE":{r=this.updateScene(n);break}case"GENERATE_MEDIA":{r=this.generateMedia(n);break}case"SET_PARENT":{r=this.setParent(n);break}case"EXPORT_SCENE":{r=this.exportScene(n);break}case"LAUNCH_AR":{const{uri:f,options:w}=n;r=new Promise((g,P)=>{mi.get("ARSystem").then(D=>{g(D.launch(f,w))}).catch(P)});break}default:console.warn(`DIVECommunication.PerformAction: has been executed with unknown Action type ${a}`)}return this.dispatch(a,n),r}Subscribe(a,n){return this.listeners.get(a)||this.listeners.set(a,[]),this.listeners.get(a).push(n),()=>{const r=this.listeners.get(a);if(!r)return!1;const f=r.findIndex(w=>w===n);return f===-1?!1:(r.splice(f,1),!0)}}dispatch(a,n){const r=this.listeners.get(a);r&&r.forEach(f=>f(n))}getAllSceneData(a){const n={name:this.scene.name,mediaItem:null,backgroundColor:"#"+this.scene.background.getHexString(),floorEnabled:this.scene.Floor.visible,floorColor:"#"+this.scene.Floor.material.color.getHexString(),userCamera:{position:this.controller.object.position.clone(),target:this.controller.target.clone()},spotmarks:[],lights:Array.from(this.registered.values()).filter(r=>r.entityType==="light"),objects:Array.from(this.registered.values()).filter(r=>r.entityType==="model"),cameras:Array.from(this.registered.values()).filter(r=>r.entityType==="pov"),primitives:Array.from(this.registered.values()).filter(r=>r.entityType==="primitive"),groups:Array.from(this.registered.values()).filter(r=>r.entityType==="group")};return Object.assign(a,n),n}getAllObjects(a){return Object.assign(a,this.registered),this.registered}getObjects(a){if(a.ids.length===0)return[];const n=[];return this.registered.forEach(r=>{a.ids.includes(r.id)&&n.push(r)}),n}addObject(a){return this.registered.get(a.id)?!1:(a.parentId===void 0&&(a.parentId=null),this.registered.set(a.id,a),this.scene.AddSceneObject(a),!0)}updateObject(a){const n=this.registered.get(a.id);if(!n)return!1;this.registered.set(a.id,C0.merge(n,a));const r=this.registered.get(a.id);return this.scene.UpdateSceneObject({...a,id:r.id,entityType:r.entityType}),Object.assign(a,r),!0}deleteObject(a){const n=this.registered.get(a.id);return n?(n.parentId&&this.setParent({object:{id:n.id},parent:null}),n.entityType==="group"&&this.registered.forEach(r=>{r.parentId===n.id&&this.updateObject({id:r.id,parentId:null})}),Object.assign(a,n),this.registered.delete(a.id),Array.from(this.registered.values()).forEach(r=>{r.parentId&&r.parentId===a.id&&(r.parentId=null)}),this.scene.DeleteSceneObject(n),!0):!1}selectObject(a){const n=this.registered.get(a.id);if(!n)return!1;const r=this.scene.GetSceneObject(n);if(!r||!("isSelectable"in r))return!1;const f=this.toolbox.GetActiveTool();return f&&Ul(f)&&f.AttachGizmo(r),Object.assign(a,n),!0}deselectObject(a){const n=this.registered.get(a.id);if(!n)return!1;const r=this.scene.GetSceneObject(n);if(!r||!("isSelectable"in r))return!1;const f=this.toolbox.GetActiveTool();return f&&Ul(f)&&f.DetachGizmo(),Object.assign(a,n),!0}setBackground(a){return this.scene.SetBackground(a.color),!0}dropIt(a){const n=this.registered.get(a.id);return n?(this.scene.GetSceneObject(n).DropIt(),!0):!1}placeOnFloor(a){const n=this.registered.get(a.id);return n?(this.scene.PlaceOnFloor(n),!0):!1}setCameraTransform(a){return this.controller.object.position.copy(a.position),this.controller.target.copy(a.target),this.controller.update(),!0}getCameraTransform(a){const n={position:this.controller.object.position.clone(),target:this.controller.target.clone()};return Object.assign(a,n),n}moveCamera(a){let n={x:0,y:0,z:0},r={x:0,y:0,z:0};return"id"in a?(n=this.registered.get(a.id).position,r=this.registered.get(a.id).target):(n=a.position,r=a.target),this.controller.MoveTo(n,r,a.duration,a.locked),!0}setCameraLayer(a){return this.controller.object.SetCameraLayer(a.layer),!0}resetCamera(a){return this.controller.RevertLast(a.duration),!0}computeEncompassingView(a){const n=this.scene.ComputeSceneBB(),r=this.controller.ComputeEncompassingView(n);return Object.assign(a,r),r}zoomCamera(a){return a.direction==="IN"&&this.controller.ZoomIn(a.by),a.direction==="OUT"&&this.controller.ZoomOut(a.by),!0}setGizmoMode(a){return this.toolbox.SetGizmoMode(a.mode),!0}setGizmoVisibility(a){return this.toolbox.SetGizmoVisibility(a),a}setGizmoScaleLinked(a){return this.toolbox.SetGizmoScaleLinked(a),a}useTool(a){return this.toolbox.UseTool(a.tool),!0}modelLoaded(a){return this.registered.get(a.id).loaded=!0,!0}updateScene(a){return a.name!==void 0&&(this.scene.name=a.name),a.backgroundColor!==void 0&&this.scene.SetBackground(a.backgroundColor),a.gridEnabled!==void 0&&this.scene.Grid.SetVisibility(a.gridEnabled),a.floorEnabled!==void 0&&this.scene.Floor.SetVisibility(a.floorEnabled),a.floorColor!==void 0&&this.scene.Floor.SetColor(a.floorColor),a.name=this.scene.name,a.backgroundColor="#"+this.scene.background.getHexString(),a.gridEnabled=this.scene.Grid.visible,a.floorEnabled=this.scene.Floor.visible,a.floorColor="#"+this.scene.Floor.material.color.getHexString(),!0}generateMedia(a){let n={x:0,y:0,z:0},r={x:0,y:0,z:0};return"id"in a?(n=this.registered.get(a.id).position,r=this.registered.get(a.id).target):(n=a.position,r=a.target),mi.get("MediaCreator").then(f=>f.GenerateMedia(n,r,a.width,a.height))}setParent(a){const n=this.registered.get(a.object.id);if(!n)return!1;const r=this.scene.GetSceneObject(n);if(!r)return!1;if(a.parent===null)return this.scene.Root.attach(r),this.updateObject({id:n.id,parentId:null}),!0;if(a.object.id===a.parent.id)return!1;const f=this.registered.get(a.parent.id);if(!f)return this.scene.Root.attach(r),this.updateObject({id:n.id,parentId:null}),!0;const w=this.scene.GetSceneObject(f);return w?(w.attach(r),this.updateObject({id:n.id,parentId:f.id}),!0):(this.scene.Root.attach(r),this.updateObject({id:n.id,parentId:null}),!0)}exportScene(a){return mi.get("AssetExporter").then(n=>n.export(this.scene.Root,a.type,{}))}};y(Hn,"__instances",[]);let Ye=Hn;class U0{constructor(a){y(this,"_renderer");y(this,"_rendererCallbackId");this._renderer=a,this._rendererCallbackId=this._renderer.AddPreRenderCallback(()=>{this.Update()})}Dispose(){this._renderer.RemovePreRenderCallback(this._rendererCallbackId)}Update(){Nn.update()}Animate(a){return new Nn.Tween(a)}}class k0 extends u.OrthographicCamera{constructor(n,r,f){super(-1,1,1,-1,.1,100);y(this,"axesHelper");y(this,"_renderer");y(this,"_scene");y(this,"_renderCallbackId");this.layers.mask=pe.COORDINATE_LAYER_MASK,this.axesHelper=new u.AxesHelper(.5),this.axesHelper.layers.mask=pe.COORDINATE_LAYER_MASK,this.axesHelper.material.depthTest=!1,this.axesHelper.position.set(0,0,-1),this.axesHelper.setColors(new u.Color(Hs),new u.Color(Ys),new u.Color(Xs));const w=new zs("X",.2,Fl),g=new zs("Y",.2,Wl),P=new zs("Z",.2,Vl);w.layers.mask=pe.COORDINATE_LAYER_MASK,g.layers.mask=pe.COORDINATE_LAYER_MASK,P.layers.mask=pe.COORDINATE_LAYER_MASK,w.position.set(.7,0,0),g.position.set(0,.7,0),P.position.set(0,0,.7),this.axesHelper.add(w),this.axesHelper.add(g),this.axesHelper.add(P),this.add(this.axesHelper),this._renderer=n,this._scene=r,this._scene.add(this);const D=new u.Vector4;this._renderCallbackId=n.AddPostRenderCallback(()=>{const H=r.background;r.background=null,n.getViewport(D),n.setViewport(0,0,150,150),n.autoClear=!1,this.SetFromCameraMatrix(f.object.matrix),n.render(r,this),n.setViewport(D),n.autoClear=!0,r.background=H})}Dispose(){this._renderer.RemovePostRenderCallback(this._renderCallbackId),this._scene.remove(this)}SetFromCameraMatrix(n){this.axesHelper.rotation.setFromRotationMatrix(new u.Matrix4().extractRotation(n).invert())}}const z0="1.19.1-beta.4",F0={version:z0},wn={antialias:!0,alpha:!0,stencil:!1,shadowMapEnabled:!0,shadowMapType:u.PCFSoftShadowMap,toneMapping:u.NoToneMapping,canvas:void 0};class W0 extends u.WebGLRenderer{constructor(n=wn){super({antialias:n.antialias||wn.antialias,alpha:n.alpha||wn.alpha,preserveDrawingBuffer:!0,canvas:n.canvas});y(this,"paused",!1);y(this,"running",!1);y(this,"force",!1);y(this,"preRenderCallbacks",new Map);y(this,"postRenderCallbacks",new Map);this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=n.shadowMapEnabled||wn.shadowMapEnabled,this.shadowMap.type=n.shadowMapType||wn.shadowMapType,this.toneMapping=n.toneMapping||wn.toneMapping,this.debug.checkShaderErrors=!1}Dispose(){this.StopRenderer(),this.dispose()}StartRenderer(n,r){this.setAnimationLoop((f,w)=>{this.internal_render(n,r,f,w)}),this.running=!0}PauseRenderer(){this.paused=!0}ResumeRenderer(){this.paused=!1}StopRenderer(){this.setAnimationLoop(null),this.running=!1}OnResize(n,r){this.setSize(n,r)}AddPreRenderCallback(n){const r=u.MathUtils.generateUUID();return this.preRenderCallbacks.set(r,n),r}RemovePreRenderCallback(n){return this.preRenderCallbacks.has(n)?(this.preRenderCallbacks.delete(n),!0):!1}AddPostRenderCallback(n){const r=u.MathUtils.generateUUID();return this.postRenderCallbacks.set(r,n),r}RemovePostRenderCallback(n){return this.postRenderCallbacks.has(n)?(this.postRenderCallbacks.delete(n),!0):!1}ForceRendering(){this.force=!0}internal_render(n,r,f,w){(this.paused||!this.running)&&!this.force||(this.preRenderCallbacks.forEach(g=>{g(f,w)}),this.render(n,r),this.postRenderCallbacks.forEach(g=>{g(f,w)}),this.force=!1)}}class V0 extends u.Object3D{constructor(){super();y(this,"isDIVELight",!0);y(this,"isDIVEAmbientLight",!0);y(this,"_light");this.name="DIVEAmbientLight",this._light=new u.AmbientLight(16777215,1),this._light.layers.mask=pe.PRODUCT_LAYER_MASK,this.add(this._light)}SetColor(n){this._light.color=n}SetIntensity(n){this._light.intensity=n}SetEnabled(n){this._light.visible=n}}class N0 extends u.Object3D{constructor(){super();y(this,"isDIVELight",!0);y(this,"isDIVEPointLight",!0);y(this,"isMovable",!0);y(this,"isSelectable",!0);y(this,"gizmo",null);y(this,"light");y(this,"mesh");this.name="DIVEPointLight",this.light=new u.PointLight(16777215,1),this.light.layers.mask=pe.PRODUCT_LAYER_MASK,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const n=.1,r=new u.SphereGeometry(n,n*320,n*320),f=new u.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:u.FrontSide});this.mesh=new u.Mesh(r,f),this.mesh.layers.mask=pe.UI_LAYER_MASK,this.add(this.mesh)}SetColor(n){this.light.color=n,this.mesh.material.color=n}SetIntensity(n){this.light.intensity=n,this.mesh.material.opacity=n>.8?.8:n*.8}SetEnabled(n){this.light.visible=n}onMove(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})}onSelect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class H0 extends u.Object3D{constructor(){super();y(this,"isDIVELight",!0);y(this,"isDIVESceneLight",!0);y(this,"_hemiLight");y(this,"_dirLight");this.name="DIVESceneLight",this._hemiLight=new u.HemisphereLight(16777215,16777215,2),this._hemiLight.layers.mask=pe.PRODUCT_LAYER_MASK,this._hemiLight.position.set(0,50,0),this.add(this._hemiLight),this._dirLight=new u.DirectionalLight(16777215,3),this._dirLight.layers.mask=pe.PRODUCT_LAYER_MASK,this._dirLight.position.set(1,1.75,1),this._dirLight.position.multiplyScalar(30),this._dirLight.castShadow=!0,this._dirLight.shadow.mapSize.width=2048,this._dirLight.shadow.mapSize.height=2048;const n=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=n,this._dirLight.shadow.camera.top=n,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}SetColor(n){this._hemiLight.color=n,this._dirLight.color=n}SetIntensity(n){this._hemiLight.intensity=n*2,this._dirLight.intensity=n*3}SetEnabled(n){this._hemiLight.visible=n,this._dirLight.visible=n}}const Ks=S=>S.parent?Ks(S.parent):S;class Y0{constructor(){y(this,"isMovable",!0)}}class X0{constructor(){y(this,"isSelectable",!0)}}function j0(S,a){return a.forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(r=>{Object.defineProperty(S.prototype,r,Object.getOwnPropertyDescriptor(n.prototype,r))})}),S}class qs extends j0(u.Object3D,[X0,Y0]){constructor(){super();y(this,"isDIVENode",!0);y(this,"gizmo",null);y(this,"_positionWorldBuffer");y(this,"_boundingBox");this.layers.mask=pe.PRODUCT_LAYER_MASK,this._positionWorldBuffer=new u.Vector3,this._boundingBox=new u.Box3}SetPosition(n){if(!this.parent){this.position.set(n.x,n.y,n.z);return}const r=new u.Vector3(n.x,n.y,n.z);this.position.copy(this.parent.worldToLocal(r)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(n){this.rotation.set(n.x,n.y,n.z)}SetScale(n){this.scale.set(n.x,n.y,n.z)}SetVisibility(n){this.visible=n}SetToWorldOrigin(){var n;this.position.set(0,0,0),(n=Ye.get(this.userData.id))==null||n.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onMove(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onSelect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class Z0 extends qs{constructor(){super(...arguments);y(this,"isDIVEModel",!0);y(this,"_mesh",null);y(this,"_material",null)}SetModel(n){this.clear(),this._boundingBox.makeEmpty(),n.traverse(r=>{r.castShadow=!0,r.receiveShadow=!0,r.layers.mask=this.layers.mask,this._boundingBox.expandByObject(r),!this._mesh&&"isMesh"in r&&(this._mesh=r,this._material?this._mesh.material=this._material:this._material=r.material)}),this.add(n)}SetMaterial(n){this._material||(this._material=new u.MeshStandardMaterial),n.vertexColors!==void 0&&(this._material.vertexColors=n.vertexColors),n.color!==void 0&&this._material.color.set(n.color),n.map!==void 0&&(this._material.map=n.map),n.normalMap!==void 0&&(this._material.normalMap=n.normalMap),n.roughness!==void 0&&(this._material.roughness=n.roughness),n.roughnessMap!==void 0&&(this._material.roughnessMap=n.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),n.metalness!==void 0&&(this._material.metalness=n.metalness),n.metalnessMap!==void 0&&(this._material.metalnessMap=n.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}PlaceOnFloor(){var w,g,P,D,H;const n=this.getWorldPosition(this._positionWorldBuffer),r=n.clone();(g=(w=this._mesh)==null?void 0:w.geometry)==null||g.computeBoundingBox();const f=(D=(P=this._mesh)==null?void 0:P.geometry)==null?void 0:D.boundingBox;!f||!this._mesh||(n.y=n.y-this._mesh.localToWorld(f.min.clone()).y,n.y!==r.y&&((H=Ye.get(this.userData.id))==null||H.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:n,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEModel: DropIt() called on a model that is not in the scene.",this);return}const n=this._boundingBox.min.y*this.scale.y,r=this.localToWorld(this._boundingBox.getCenter(new u.Vector3).multiply(this.scale));r.y=n+this.position.y;const f=new u.Raycaster(r,new u.Vector3(0,-1,0));f.layers.mask=pe.PRODUCT_LAYER_MASK;const w=f.intersectObjects(Ks(this).Root.children,!0);if(w.length>0){const g=w[0].object;g.geometry.computeBoundingBox();const P=g.geometry.boundingBox,D=g.localToWorld(P.max.clone()),H=this.position.clone(),le=this.position.clone().setY(D.y).sub(new u.Vector3(0,n,0));if(this.position.copy(le),this.position.y===H.y)return;this.onMove()}}}class Q0 extends qs{constructor(){super();y(this,"isDIVEPrimitive",!0);y(this,"_mesh");this._mesh=new u.Mesh,this._mesh.layers.mask=pe.PRODUCT_LAYER_MASK,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new u.MeshStandardMaterial,this.add(this._mesh)}SetGeometry(n){const r=this.assembleGeometry(n);r&&(this._mesh.geometry=r,this._boundingBox.setFromObject(this._mesh))}SetMaterial(n){const r=this._mesh.material;n.vertexColors!==void 0&&(r.vertexColors=n.vertexColors),n.color!==void 0&&(r.color=new u.Color(n.color)),n.map!==void 0&&(r.map=n.map),n.normalMap!==void 0&&(r.normalMap=n.normalMap),n.roughness!==void 0&&(r.roughness=n.roughness),n.roughnessMap!==void 0&&(r.roughnessMap=n.roughnessMap,r.roughnessMap&&(r.roughness=1)),n.metalness!==void 0&&(r.metalness=n.metalness),n.metalnessMap!==void 0&&(r.metalnessMap=n.metalnessMap,r.metalnessMap&&(r.metalness=0)),this._mesh&&(this._mesh.material=r)}PlaceOnFloor(){var w,g,P,D,H;const n=this.getWorldPosition(this._positionWorldBuffer),r=n.clone();(g=(w=this._mesh)==null?void 0:w.geometry)==null||g.computeBoundingBox();const f=(D=(P=this._mesh)==null?void 0:P.geometry)==null?void 0:D.boundingBox;!f||!this._mesh||(n.y=n.y-this._mesh.localToWorld(f.min.clone()).y,n.y!==r.y&&((H=Ye.get(this.userData.id))==null||H.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:n,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEPrimitive: DropIt() called on a model that is not in the scene.",this);return}const n=this._boundingBox.min.y*this.scale.y,r=this.localToWorld(this._boundingBox.getCenter(new u.Vector3).multiply(this.scale));r.y=n+this.position.y;const f=new u.Raycaster(r,new u.Vector3(0,-1,0));f.layers.mask=pe.PRODUCT_LAYER_MASK;const w=f.intersectObjects(Ks(this).Root.children,!0);if(w.length>0){const g=w[0].object;g.geometry.computeBoundingBox();const P=g.geometry.boundingBox,D=g.localToWorld(P.max.clone()),H=this.position.clone(),le=this.position.clone().setY(D.y).sub(new u.Vector3(0,n,0));if(this.position.copy(le),this.position.y===H.y)return;this.onMove()}}assembleGeometry(n){switch(this._mesh.material.flatShading=!1,n.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(n);case"sphere":return this.createSphereGeometry(n);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(n);case"cube":case"box":return this.createBoxGeometry(n);case"cone":return this.createConeGeometry(n);case"wall":return this.createWallGeometry(n);case"plane":return this.createPlaneGeometry(n);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",n.name.toLowerCase()),null}}createCylinderGeometry(n){const r=new u.CylinderGeometry(n.width/2,n.width/2,n.height,64);return r.translate(0,n.height/2,0),r}createSphereGeometry(n){return new u.SphereGeometry(n.width/2,256,256)}createPyramidGeometry(n){const r=new Float32Array([-n.width/2,0,-n.depth/2,n.width/2,0,-n.depth/2,n.width/2,0,n.depth/2,-n.width/2,0,n.depth/2,0,n.height,0]),f=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),w=new u.BufferGeometry;return w.setAttribute("position",new u.BufferAttribute(r,3)),w.setIndex(new u.BufferAttribute(f,1)),w.computeVertexNormals(),w.computeBoundingBox(),w.computeBoundingSphere(),w}createBoxGeometry(n){const r=new u.BoxGeometry(n.width,n.height,n.depth);return r.translate(0,n.height/2,0),r}createConeGeometry(n){const r=new u.ConeGeometry(n.width/2,n.height,256);return r.translate(0,n.height/2,0),r}createWallGeometry(n){const r=new u.BoxGeometry(n.width,n.height,n.depth||.05,16);return r.translate(0,n.height/2,0),r}createPlaneGeometry(n){const r=new u.BoxGeometry(n.width,n.height,n.depth);return r.translate(0,n.height/2,0),r}}class K0 extends qs{constructor(){super();y(this,"isDIVEGroup",!0);y(this,"_members");y(this,"_lines");this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}SetPosition(n){super.SetPosition(n),this._members.forEach(r=>{"isDIVENode"in r&&r.onMove()})}SetLinesVisibility(n,r){if(!r){this._lines.forEach(w=>{w.visible=n});return}const f=this._members.indexOf(r);f!==-1&&(this._lines[f].visible=n)}attach(n){if(this._members.includes(n))return this;const r=this.createLine();return this.add(r),this._lines.push(r),super.attach(n),this._members.push(n),this.updateLineTo(r,n),this.SetLinesVisibility(!0,n),this}remove(n){const r=this._members.indexOf(n);if(r===-1)return this;const f=this._lines[r];return super.remove(f),this._lines.splice(r,1),super.remove(n),this._members.splice(r,1),this}UpdateLineTo(n){const r=this._members.indexOf(n);r!==-1&&this.updateLineTo(this._lines[r],n)}createLine(){const n=new u.BufferGeometry,r=new u.LineDashedMaterial({color:6710886,dashSize:.05,gapSize:.025}),f=new u.Line(n,r);return f.visible=!1,f}updateLineTo(n,r){n.geometry.setFromPoints([new u.Vector3(0,0,0),r.position.clone()]),n.computeLineDistances()}}class $s extends u.Object3D{constructor(){super();y(this,"isDIVERoot",!0);this.name="Root"}ComputeSceneBB(){const n=new u.Box3;return this.traverse(r=>{"isObject3D"in r&&n.expandByObject(r)}),n}GetSceneObject(n){let r;return this.traverse(f=>{r||f.userData.id===n.id&&(r=f)}),r}AddSceneObject(n){switch(n.entityType){case"pov":break;case"light":{this.updateLight(n);break}case"model":{this.updateModel(n);break}case"primitive":{this.updatePrimitive(n);break}case"group":{this.updateGroup(n);break}default:console.warn(`DIVERoot.AddSceneObject: Unknown entity type: ${n.entityType}`)}}UpdateSceneObject(n){switch(n.entityType){case"pov":break;case"light":{this.updateLight(n);break}case"model":{this.updateModel(n);break}case"primitive":{this.updatePrimitive(n);break}case"group":{this.updateGroup(n);break}default:console.warn(`DIVERoot.UpdateSceneObject: Unknown entity type: ${n.entityType}`)}}DeleteSceneObject(n){switch(n.entityType){case"pov":break;case"light":{this.deleteLight(n);break}case"model":{this.deleteModel(n);break}case"primitive":{this.deletePrimitive(n);break}case"group":{this.deleteGroup(n);break}default:console.warn(`DIVERoot.DeleteSceneObject: Unknown entity type: ${n.entityType}`)}}PlaceOnFloor(n){switch(n.entityType){case"pov":case"light":break;case"model":case"primitive":{this.placeOnFloor(n);break}default:console.warn(`DIVERoot.PlaceOnFloor: Unknown entity type: ${n.entityType}`)}}updateLight(n){let r=this.GetSceneObject(n);if(!r){switch(n.type){case"scene":{r=new H0;break}case"ambient":{r=new V0;break}case"point":{r=new N0;break}default:{console.warn(`DIVERoot.updateLight: Unknown light type: ${n.type}`);return}}r.userData.id=n.id,this.add(r)}n.name!==void 0&&n.name!==null&&(r.name=n.name),n.position!==void 0&&n.position!==null&&r.position.set(n.position.x,n.position.y,n.position.z),n.intensity!==void 0&&n.intensity!==null&&r.SetIntensity(n.intensity),n.enabled!==void 0&&n.enabled!==null&&r.SetEnabled(n.enabled),n.color!==void 0&&n.color!==null&&r.SetColor(new u.Color(n.color)),n.visible!==void 0&&n.visible!==null&&(r.visible=n.visible),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}updateModel(n){let r=this.GetSceneObject(n);r||(r=new Z0,r.userData.id=n.id,r.userData.uri=n.uri,this.add(r)),n.uri!==void 0&&mi.get("AssetLoader").then(f=>{f.load(n.uri).then(w=>{var g;r.SetModel(w),(g=Ye.get(n.id))==null||g.PerformAction("MODEL_LOADED",{id:n.id})})}),n.name!==void 0&&(r.name=n.name),n.position!==void 0&&r.SetPosition(n.position),n.rotation!==void 0&&r.SetRotation(n.rotation),n.scale!==void 0&&r.SetScale(n.scale),n.visible!==void 0&&r.SetVisibility(n.visible),n.material!==void 0&&r.SetMaterial(n.material),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}updatePrimitive(n){let r=this.GetSceneObject(n);r||(r=new Q0,r.userData.id=n.id,this.add(r)),n.name!==void 0&&(r.name=n.name),n.geometry!==void 0&&r.SetGeometry(n.geometry),n.position!==void 0&&r.SetPosition(n.position),n.rotation!==void 0&&r.SetRotation(n.rotation),n.scale!==void 0&&r.SetScale(n.scale),n.visible!==void 0&&r.SetVisibility(n.visible),n.material!==void 0&&r.SetMaterial(n.material),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}updateGroup(n){let r=this.GetSceneObject(n);r||(r=new K0,r.userData.id=n.id,this.add(r)),n.name!==void 0&&(r.name=n.name),n.position!==void 0&&r.SetPosition(n.position),n.rotation!==void 0&&r.SetRotation(n.rotation),n.scale!==void 0&&r.SetScale(n.scale),n.visible!==void 0&&r.SetVisibility(n.visible),n.bbVisible!==void 0&&r.SetLinesVisibility(n.bbVisible),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}deleteLight(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deleteLight: Light with id ${n.id} not found`);return}this.detachTransformControls(r),r.parent.remove(r)}deleteModel(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deleteModel: Model with id ${n.id} not found`);return}this.detachTransformControls(r),r.parent.remove(r)}deletePrimitive(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deletePrimitive: Primitive with id ${n.id} not found`);return}this.detachTransformControls(r),r.parent.remove(r)}deleteGroup(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deleteGroup: Group with id ${n.id} not found`);return}this.detachTransformControls(r);for(let f=r.members.length-1;f>=0;f--)this.attach(r.members[f]);r.parent.remove(r)}placeOnFloor(n){const r=this.GetSceneObject(n);r&&r.PlaceOnFloor()}setParent(n){const r=this.GetSceneObject(n);if(r)if(n.parentId!==null){const f=this.GetSceneObject({id:n.parentId});if(!f)return;f.attach(r)}else this.attach(r)}detachTransformControls(n){this.findScene(n).children.find(r=>{"isTransformControls"in r&&r.detach()})}findScene(n){return n.parent!==null?this.findScene(n.parent):n}}const q0="#888888",$0="#dddddd";class J0 extends u.Object3D{constructor(){super(),this.name="Grid";const a=new u.GridHelper(100,100,q0,$0);a.material.depthTest=!1,a.layers.mask=pe.HELPER_LAYER_MASK,this.add(a)}SetVisibility(a){this.visible=a}}class e_ extends u.Mesh{constructor(){super(new u.PlaneGeometry(1e4,1e4),new u.MeshStandardMaterial({color:new u.Color(150/255,150/255,150/255)}));y(this,"isFloor",!0);this.name="Floor",this.layers.mask=pe.PRODUCT_LAYER_MASK,this.receiveShadow=!0,this.rotateX(-Math.PI/2)}SetVisibility(n){this.visible=n}SetColor(n){this.material.color=new u.Color(n)}}class t_{constructor(a,n,r,f,w){this.xrLight=a,this.renderer=n,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=w,this.frameCallback=this.onXRFrame.bind(this);const g=n.xr.getSession();if(f&&"XRWebGLBinding"in window){const P=new u.WebGLCubeRenderTarget(16);a.environment=P.texture;const D=n.getContext();switch(g.preferredReflectionFormat){case"srgba8":D.getExtension("EXT_sRGB");break;case"rgba16f":D.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(g,D),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}g.requestAnimationFrame(this.frameCallback)}updateReflection(){const a=this.renderer.properties.get(this.xrLight.environment);if(a){const n=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);n&&(a.__webglTexture=n,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(a,n){if(!this.xrLight)return;n.session.requestAnimationFrame(this.frameCallback);const f=n.getLightEstimate(this.lightProbe);if(f){this.xrLight.lightProbe.sh.fromArray(f.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const w=Math.max(1,Math.max(f.primaryLightIntensity.x,Math.max(f.primaryLightIntensity.y,f.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(f.primaryLightIntensity.x/w,f.primaryLightIntensity.y/w,f.primaryLightIntensity.z/w),this.xrLight.directionalLight.intensity=w,this.xrLight.directionalLight.position.copy(f.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class n_ extends u.Group{constructor(a,n=!0){super(),this.lightProbe=new u.LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new u.DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,f=!1;a.xr.addEventListener("sessionstart",()=>{const w=a.xr.getSession();"requestLightProbe"in w&&w.requestLightProbe({reflectionFormat:w.preferredReflectionFormat}).then(g=>{r=new t_(this,a,g,n,()=>{f=!0,this.dispatchEvent({type:"estimationstart"})})})}),a.xr.addEventListener("sessionend",()=>{r&&(r.dispose(),r=null),f&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class i_ extends u.Object3D{constructor(n){super();y(this,"_scene");y(this,"_xrLight");y(this,"_lightRoot");this.name="XRLightRoot",this._scene=n,this._xrLight=null,this._lightRoot=new $s,this._lightRoot.UpdateSceneObject({id:"XRSceneLight",entityType:"light",name:"XRSceneLight",type:"scene",color:16777215,intensity:1,enabled:!0,visible:!0}),this.add(this._lightRoot)}InitLightEstimation(n){this._xrLight||(this._xrLight=new n_(n,!0),this._xrLight.layers.mask=pe.PRODUCT_LAYER_MASK,this.add(this._xrLight)),this._xrLight.addEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.addEventListener("estimationend",()=>{this.onEstimationEnd()})}DisposeLightEstimation(){this._xrLight&&(this._xrLight.removeEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.removeEventListener("estimationend",()=>{this.onEstimationEnd()}))}onEstimationStart(){this._lightRoot.visible=!1,this._xrLight&&this._xrLight.environment&&(this._scene.environment=this._xrLight.environment)}onEstimationEnd(){this._lightRoot.visible=!0,this._scene.environment=null,this._xrLight}}class r_ extends u.Object3D{constructor(n){super();y(this,"_xrLightRoot");y(this,"_xrModelRoot");y(this,"_xrHandNode");y(this,"_xrShadowPlane");this.name="XRRoot",this._xrModelRoot=new $s,this._xrModelRoot.name="XRModelRoot",this.add(this._xrModelRoot),this._xrShadowPlane=new u.Mesh(new u.PlaneGeometry(100,100),new u.ShadowMaterial({opacity:1,transparent:!0})),this._xrModelRoot.add(this._xrShadowPlane),this._xrLightRoot=new i_(n),this._xrLightRoot.name="XRLightRoot",this.add(this._xrLightRoot),this._xrHandNode=new u.Object3D,this._xrHandNode.name="XRHandNode",this.add(this._xrHandNode)}get XRModelRoot(){return this._xrModelRoot}get XRLightRoot(){return this._xrLightRoot}get XRHandNode(){return this._xrHandNode}InitLightEstimation(n){this._xrLightRoot.InitLightEstimation(n)}DisposeLightEstimation(){this._xrLightRoot.DisposeLightEstimation()}}class s_ extends u.Scene{constructor(){super();y(this,"_root");y(this,"_floor");y(this,"_grid");y(this,"_xrRoot");this.background=new u.Color(16777215),this._root=new $s,this.add(this._root),this._floor=new e_,this.add(this._floor),this._grid=new J0,this.add(this._grid),this._xrRoot=new r_(this),this._xrRoot.visible=!1,this.add(this._xrRoot)}get Root(){return this._root}get XRRoot(){return this._xrRoot}get Floor(){return this._floor}get Grid(){return this._grid}InitXR(n){this._root.visible=!1,this._xrRoot.visible=!0,this._xrRoot.InitLightEstimation(n)}DisposeXR(){this._root.visible=!0,this._xrRoot.visible=!1,this._xrRoot.DisposeLightEstimation()}SetBackground(n){this.background=new u.Color(n)}ComputeSceneBB(){return this.Root.ComputeSceneBB()}GetSceneObject(n){return this.Root.GetSceneObject(n)}AddSceneObject(n){this.Root.AddSceneObject(n)}UpdateSceneObject(n){this.Root.UpdateSceneObject(n)}DeleteSceneObject(n){this.Root.DeleteSceneObject(n)}PlaceOnFloor(n){this.Root.PlaceOnFloor(n)}}const Hl={autoResize:!0,autoStart:!0,displayAxes:!1,renderer:wn,perspectiveCamera:pe.DIVEPerspectiveCameraDefaultSettings};class o_{constructor(a){y(this,"_renderer");y(this,"_scene");y(this,"_perspectiveCamera");y(this,"_settings");y(this,"_resizeObserverId","");y(this,"_width",0);y(this,"_height",0);this._settings={...Hl,...a??{}},this._renderer=new W0(this._settings.renderer),this._scene=new s_,this._perspectiveCamera=new pe.DIVEPerspectiveCamera(this._settings.perspectiveCamera),this._settings.autoResize&&this._addResizeObserver(),this._settings.autoStart&&this.renderer.StartRenderer(this.scene,this.perspectiveCamera)}get renderer(){return this._renderer}get scene(){return this._scene}get perspectiveCamera(){return this._perspectiveCamera}dispose(){this._removeResizeObserver(),this._renderer.dispose()}onResize(a,n){this.renderer.OnResize(a,n),this.perspectiveCamera.OnResize(a,n)}_addResizeObserver(){this._resizeObserverId=this.renderer.AddPreRenderCallback(()=>{const a=this.renderer.domElement.parentElement;if(!a)return;const{clientWidth:n,clientHeight:r}=a;n===this._width&&r===this._height||(this.onResize(n,r),this._width=n,this._height=r)})}_removeResizeObserver(){this.renderer.RemovePreRenderCallback(this._resizeObserverId)}}function Mt(S,a){const n=(S+"e").split("e");return+(n[0]+"e"+(+n[1]+(a||0)))}function a_(S,a=0){const n=Mt(S,+a);return Mt(Math.ceil(n),-a)}function l_(S,a=0){const n=Mt(S,+a);return Mt(Math.floor(n),-a)}function Yl(S,a=0){if(S<0)return-Yl(-S,a);const n=Mt(S,+a);return Mt(Math.round(n),-a)}function c_(S,a,n){return Math.atan2(S.clone().cross(a).dot(n),a.clone().dot(S))}function u_(S,a=0){const n=Mt(S,+a);return Mt(Math.round(n),-a).toFixed(a)}function h_(S,a=0){const n=Mt(S,+a);return Mt(Math.trunc(n),-a)}function f_(S){return(u.MathUtils.radToDeg(S)+360)%360}function d_(S){return u.MathUtils.degToRad(S)}const p_={ceilExp:a_,floorExp:l_,roundExp:Yl,toFixedExp:u_,truncateExp:h_,signedAngleTo:c_,radToDeg:f_,degToRad:d_},Xl={...Hl,orbitControls:yr};class Ar{constructor(a){y(this,"_settings");y(this,"_engine");y(this,"orbitControls");y(this,"toolbox");y(this,"_communication");y(this,"animationSystem");y(this,"axisCamera");this._settings={...Xl,...a??{}},this._engine=new o_(a),this.animationSystem=new U0(this._engine.renderer),this.orbitControls=new Ns(this._engine.perspectiveCamera,this._engine.renderer,this.animationSystem,this._settings.orbitControls),this.toolbox=new Nl(this._engine.scene,this.orbitControls),this._communication=new Ye(this._engine.renderer,this._engine.scene,this.orbitControls,this.toolbox),this._settings.displayAxes?this.axisCamera=new k0(this._engine.renderer,this._engine.scene,this.orbitControls):this.axisCamera=null,window.DIVE={PrintScene:()=>this._engine.scene},console.log(`DIVE ${F0.version} initialized successfully!`),console.log(`
27
+ }`;var k=Sl(function(){return Y(c,L+"return "+M).apply(n,h)});if(k.source=M,Rs(k))throw k;return k}function Eg(e){return X(e).toLowerCase()}function xg(e){return X(e).toUpperCase()}function Sg(e,t,i){if(e=X(e),e&&(i||t===n))return Co(e);if(!e||!(t=$e(t)))return e;var s=pt(e),o=pt(t),c=Io(s,o),h=Go(s,o)+1;return Jt(s,c,h).join("")}function Mg(e,t,i){if(e=X(e),e&&(i||t===n))return e.slice(0,Uo(e)+1);if(!e||!(t=$e(t)))return e;var s=pt(e),o=Go(s,pt(t))+1;return Jt(s,0,o).join("")}function Ag(e,t,i){if(e=X(e),e&&(i||t===n))return e.replace(Yt,"");if(!e||!(t=$e(t)))return e;var s=pt(e),o=Io(s,pt(t));return Jt(s,o).join("")}function Pg(e,t){var i=Yn,s=kt;if(ae(t)){var o="separator"in t?t.separator:o;i="length"in t?U(t.length):i,s="omission"in t?$e(t.omission):s}e=X(e);var c=e.length;if(On(e)){var h=pt(e);c=h.length}if(i>=c)return e;var d=i-Dn(s);if(d<1)return s;var m=h?Jt(h,0,d).join(""):e.slice(0,d);if(o===n)return m+s;if(h&&(d+=m.length-d),Ts(o)){if(e.slice(d).search(o)){var E,x=m;for(o.global||(o=Yr(o.source,X(eo.exec(o))+"g")),o.lastIndex=0;E=o.exec(x);)var M=E.index;m=m.slice(0,M===n?d:M)}}else if(e.indexOf($e(o),d)!=d){var A=m.lastIndexOf(o);A>-1&&(m=m.slice(0,A))}return m+s}function Rg(e){return e=X(e),e&&wt.test(e)?e.replace(Q,nu):e}var Tg=zn(function(e,t,i){return e+(i?" ":"")+t.toUpperCase()}),Ds=Ma("toUpperCase");function xl(e,t,i){return e=X(e),t=i?n:t,t===n?qc(e)?su(e):Vc(e):e.match(t)||[]}var Sl=z(function(e,t){try{return Ke(e,n,t)}catch(i){return Rs(i)?i:new G(i)}}),Lg=Ct(function(e,t){return rt(t,function(i){i=xt(i),Ot(e,i,As(e[i],e))}),e});function Og(e){var t=e==null?0:e.length,i=O();return e=t?se(e,function(s){if(typeof s[1]!="function")throw new st(g);return[i(s[0]),s[1]]}):[],z(function(s){for(var o=-1;++o<t;){var c=e[o];if(Ke(c[0],this,s))return Ke(c[1],this,s)}})}function Dg(e){return nh(at(e,ce))}function Cs(e){return function(){return e}}function Cg(e,t){return e==null||e!==e?t:e}var Ig=Pa(),Gg=Pa(!0);function He(e){return e}function Is(e){return ia(typeof e=="function"?e:at(e,ce))}function Bg(e){return sa(at(e,ce))}function Ug(e,t){return oa(e,at(t,ce))}var kg=z(function(e,t){return function(i){return si(i,e,t)}}),zg=z(function(e,t){return function(i){return si(e,i,t)}});function Gs(e,t,i){var s=Ee(t),o=Ki(t,s);i==null&&!(ae(t)&&(o.length||!s.length))&&(i=t,t=e,e=this,o=Ki(t,Ee(t)));var c=!(ae(i)&&"chain"in i)||!!i.chain,h=Gt(e);return rt(o,function(d){var m=t[d];e[d]=m,h&&(e.prototype[d]=function(){var E=this.__chain__;if(c||E){var x=e(this.__wrapped__),M=x.__actions__=We(this.__actions__);return M.push({func:m,args:arguments,thisArg:e}),x.__chain__=E,x}return m.apply(e,jt([this.value()],arguments))})}),e}function Fg(){return Me._===this&&(Me._=hu),this}function Bs(){}function Wg(e){return e=U(e),z(function(t){return aa(t,e)})}var Vg=ds(se),Ng=ds(Ro),Hg=ds(kr);function Ml(e){return ws(e)?zr(xt(e)):vh(e)}function Yg(e){return function(t){return e==null?n:pn(e,t)}}var Xg=Ta(),jg=Ta(!0);function Us(){return[]}function ks(){return!1}function Zg(){return{}}function Qg(){return""}function Kg(){return!0}function qg(e,t){if(e=U(e),e<1||e>Te)return[];var i=we,s=Le(e,we);t=O(t),e-=we;for(var o=Vr(s,t);++i<e;)t(i);return o}function $g(e){return B(e)?se(e,xt):Je(e)?[e]:We(Ya(X(e)))}function Jg(e){var t=++cu;return X(e)+t}var e0=nr(function(e,t){return e+t},0),t0=ps("ceil"),n0=nr(function(e,t){return e/t},1),i0=ps("floor");function r0(e){return e&&e.length?Qi(e,He,Jr):n}function s0(e,t){return e&&e.length?Qi(e,O(t,2),Jr):n}function o0(e){return Oo(e,He)}function a0(e,t){return Oo(e,O(t,2))}function l0(e){return e&&e.length?Qi(e,He,is):n}function c0(e,t){return e&&e.length?Qi(e,O(t,2),is):n}var u0=nr(function(e,t){return e*t},1),h0=ps("round"),f0=nr(function(e,t){return e-t},0);function d0(e){return e&&e.length?Wr(e,He):0}function p0(e,t){return e&&e.length?Wr(e,O(t,2)):0}return l.after=Bd,l.ary=nl,l.assign=xp,l.assignIn=_l,l.assignInWith=gr,l.assignWith=Sp,l.at=Mp,l.before=il,l.bind=As,l.bindAll=Lg,l.bindKey=rl,l.castArray=Zd,l.chain=Ja,l.chunk=nf,l.compact=rf,l.concat=sf,l.cond=Og,l.conforms=Dg,l.constant=Cs,l.countBy=dd,l.create=Ap,l.curry=sl,l.curryRight=ol,l.debounce=al,l.defaults=Pp,l.defaultsDeep=Rp,l.defer=Ud,l.delay=kd,l.difference=of,l.differenceBy=af,l.differenceWith=lf,l.drop=cf,l.dropRight=uf,l.dropRightWhile=hf,l.dropWhile=ff,l.fill=df,l.filter=gd,l.flatMap=bd,l.flatMapDeep=vd,l.flatMapDepth=wd,l.flatten=Qa,l.flattenDeep=pf,l.flattenDepth=gf,l.flip=zd,l.flow=Ig,l.flowRight=Gg,l.fromPairs=_f,l.functions=Gp,l.functionsIn=Bp,l.groupBy=yd,l.initial=bf,l.intersection=vf,l.intersectionBy=wf,l.intersectionWith=yf,l.invert=kp,l.invertBy=zp,l.invokeMap=xd,l.iteratee=Is,l.keyBy=Sd,l.keys=Ee,l.keysIn=Ne,l.map=cr,l.mapKeys=Wp,l.mapValues=Vp,l.matches=Bg,l.matchesProperty=Ug,l.memoize=hr,l.merge=Np,l.mergeWith=ml,l.method=kg,l.methodOf=zg,l.mixin=Gs,l.negate=fr,l.nthArg=Wg,l.omit=Hp,l.omitBy=Yp,l.once=Fd,l.orderBy=Md,l.over=Vg,l.overArgs=Wd,l.overEvery=Ng,l.overSome=Hg,l.partial=Ps,l.partialRight=ll,l.partition=Ad,l.pick=Xp,l.pickBy=bl,l.property=Ml,l.propertyOf=Yg,l.pull=Mf,l.pullAll=qa,l.pullAllBy=Af,l.pullAllWith=Pf,l.pullAt=Rf,l.range=Xg,l.rangeRight=jg,l.rearg=Vd,l.reject=Td,l.remove=Tf,l.rest=Nd,l.reverse=Ss,l.sampleSize=Od,l.set=Zp,l.setWith=Qp,l.shuffle=Dd,l.slice=Lf,l.sortBy=Gd,l.sortedUniq=Uf,l.sortedUniqBy=kf,l.split=bg,l.spread=Hd,l.tail=zf,l.take=Ff,l.takeRight=Wf,l.takeRightWhile=Vf,l.takeWhile=Nf,l.tap=rd,l.throttle=Yd,l.thru=lr,l.toArray=dl,l.toPairs=vl,l.toPairsIn=wl,l.toPath=$g,l.toPlainObject=gl,l.transform=Kp,l.unary=Xd,l.union=Hf,l.unionBy=Yf,l.unionWith=Xf,l.uniq=jf,l.uniqBy=Zf,l.uniqWith=Qf,l.unset=qp,l.unzip=Ms,l.unzipWith=$a,l.update=$p,l.updateWith=Jp,l.values=Vn,l.valuesIn=eg,l.without=Kf,l.words=xl,l.wrap=jd,l.xor=qf,l.xorBy=$f,l.xorWith=Jf,l.zip=ed,l.zipObject=td,l.zipObjectDeep=nd,l.zipWith=id,l.entries=vl,l.entriesIn=wl,l.extend=_l,l.extendWith=gr,Gs(l,l),l.add=e0,l.attempt=Sl,l.camelCase=rg,l.capitalize=yl,l.ceil=t0,l.clamp=tg,l.clone=Qd,l.cloneDeep=qd,l.cloneDeepWith=$d,l.cloneWith=Kd,l.conformsTo=Jd,l.deburr=El,l.defaultTo=Cg,l.divide=n0,l.endsWith=sg,l.eq=_t,l.escape=og,l.escapeRegExp=ag,l.every=pd,l.find=_d,l.findIndex=ja,l.findKey=Tp,l.findLast=md,l.findLastIndex=Za,l.findLastKey=Lp,l.floor=i0,l.forEach=el,l.forEachRight=tl,l.forIn=Op,l.forInRight=Dp,l.forOwn=Cp,l.forOwnRight=Ip,l.get=Ls,l.gt=ep,l.gte=tp,l.has=Up,l.hasIn=Os,l.head=Ka,l.identity=He,l.includes=Ed,l.indexOf=mf,l.inRange=ng,l.invoke=Fp,l.isArguments=mn,l.isArray=B,l.isArrayBuffer=np,l.isArrayLike=Ve,l.isArrayLikeObject=fe,l.isBoolean=ip,l.isBuffer=en,l.isDate=rp,l.isElement=sp,l.isEmpty=op,l.isEqual=ap,l.isEqualWith=lp,l.isError=Rs,l.isFinite=cp,l.isFunction=Gt,l.isInteger=cl,l.isLength=dr,l.isMap=ul,l.isMatch=up,l.isMatchWith=hp,l.isNaN=fp,l.isNative=dp,l.isNil=gp,l.isNull=pp,l.isNumber=hl,l.isObject=ae,l.isObjectLike=he,l.isPlainObject=hi,l.isRegExp=Ts,l.isSafeInteger=_p,l.isSet=fl,l.isString=pr,l.isSymbol=Je,l.isTypedArray=Wn,l.isUndefined=mp,l.isWeakMap=bp,l.isWeakSet=vp,l.join=Ef,l.kebabCase=lg,l.last=ct,l.lastIndexOf=xf,l.lowerCase=cg,l.lowerFirst=ug,l.lt=wp,l.lte=yp,l.max=r0,l.maxBy=s0,l.mean=o0,l.meanBy=a0,l.min=l0,l.minBy=c0,l.stubArray=Us,l.stubFalse=ks,l.stubObject=Zg,l.stubString=Qg,l.stubTrue=Kg,l.multiply=u0,l.nth=Sf,l.noConflict=Fg,l.noop=Bs,l.now=ur,l.pad=hg,l.padEnd=fg,l.padStart=dg,l.parseInt=pg,l.random=ig,l.reduce=Pd,l.reduceRight=Rd,l.repeat=gg,l.replace=_g,l.result=jp,l.round=h0,l.runInContext=_,l.sample=Ld,l.size=Cd,l.snakeCase=mg,l.some=Id,l.sortedIndex=Of,l.sortedIndexBy=Df,l.sortedIndexOf=Cf,l.sortedLastIndex=If,l.sortedLastIndexBy=Gf,l.sortedLastIndexOf=Bf,l.startCase=vg,l.startsWith=wg,l.subtract=f0,l.sum=d0,l.sumBy=p0,l.template=yg,l.times=qg,l.toFinite=Bt,l.toInteger=U,l.toLength=pl,l.toLower=Eg,l.toNumber=ut,l.toSafeInteger=Ep,l.toString=X,l.toUpper=xg,l.trim=Sg,l.trimEnd=Mg,l.trimStart=Ag,l.truncate=Pg,l.unescape=Rg,l.uniqueId=Jg,l.upperCase=Tg,l.upperFirst=Ds,l.each=el,l.eachRight=tl,l.first=Ka,Gs(l,function(){var e={};return yt(l,function(t,i){K.call(l.prototype,i)||(e[i]=t)}),e}(),{chain:!1}),l.VERSION=r,rt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),rt(["drop","take"],function(e,t){V.prototype[e]=function(i){i=i===n?1:ve(U(i),0);var s=this.__filtered__&&!t?new V(this):this.clone();return s.__filtered__?s.__takeCount__=Le(i,s.__takeCount__):s.__views__.push({size:Le(i,we),type:e+(s.__dir__<0?"Right":"")}),s},V.prototype[e+"Right"]=function(i){return this.reverse()[e](i).reverse()}}),rt(["filter","map","takeWhile"],function(e,t){var i=t+1,s=i==Ge||i==je;V.prototype[e]=function(o){var c=this.clone();return c.__iteratees__.push({iteratee:O(o,3),type:i}),c.__filtered__=c.__filtered__||s,c}}),rt(["head","last"],function(e,t){var i="take"+(t?"Right":"");V.prototype[e]=function(){return this[i](1).value()[0]}}),rt(["initial","tail"],function(e,t){var i="drop"+(t?"":"Right");V.prototype[e]=function(){return this.__filtered__?new V(this):this[i](1)}}),V.prototype.compact=function(){return this.filter(He)},V.prototype.find=function(e){return this.filter(e).head()},V.prototype.findLast=function(e){return this.reverse().find(e)},V.prototype.invokeMap=z(function(e,t){return typeof e=="function"?new V(this):this.map(function(i){return si(i,e,t)})}),V.prototype.reject=function(e){return this.filter(fr(O(e)))},V.prototype.slice=function(e,t){e=U(e);var i=this;return i.__filtered__&&(e>0||t<0)?new V(i):(e<0?i=i.takeRight(-e):e&&(i=i.drop(e)),t!==n&&(t=U(t),i=t<0?i.dropRight(-t):i.take(t-e)),i)},V.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},V.prototype.toArray=function(){return this.take(we)},yt(V.prototype,function(e,t){var i=/^(?:filter|find|map|reject)|While$/.test(t),s=/^(?:head|last)$/.test(t),o=l[s?"take"+(t=="last"?"Right":""):t],c=s||/^find/.test(t);o&&(l.prototype[t]=function(){var h=this.__wrapped__,d=s?[1]:arguments,m=h instanceof V,E=d[0],x=m||B(h),M=function(W){var N=o.apply(l,jt([W],d));return s&&A?N[0]:N};x&&i&&typeof E=="function"&&E.length!=1&&(m=x=!1);var A=this.__chain__,L=!!this.__actions__.length,C=c&&!A,k=m&&!L;if(!c&&x){h=k?h:new V(this);var I=e.apply(h,d);return I.__actions__.push({func:lr,args:[M],thisArg:n}),new ot(I,A)}return C&&k?e.apply(this,d):(I=this.thru(M),C?s?I.value()[0]:I.value():I)})}),rt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Ii[e],i=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",s=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var o=arguments;if(s&&!this.__chain__){var c=this.value();return t.apply(B(c)?c:[],o)}return this[i](function(h){return t.apply(B(h)?h:[],o)})}}),yt(V.prototype,function(e,t){var i=l[t];if(i){var s=i.name+"";K.call(Bn,s)||(Bn[s]=[]),Bn[s].push({name:t,func:i})}}),Bn[tr(n,re).name]=[{name:"wrapper",func:n}],V.prototype.clone=Pu,V.prototype.reverse=Ru,V.prototype.value=Tu,l.prototype.at=sd,l.prototype.chain=od,l.prototype.commit=ad,l.prototype.next=ld,l.prototype.plant=ud,l.prototype.reverse=hd,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=fd,l.prototype.first=l.prototype.head,$n&&(l.prototype[$n]=cd),l},Cn=ou();cn?((cn.exports=Cn)._=Cn,Ir._=Cn):Me._=Cn}).call(O0)}(_i,_i.exports)),_i.exports}var C0=D0(),I0={AssetLoader:"./src/modules/asset/loader/AssetLoader.mjs",AssetConverter:"./src/modules/asset/converter/AssetConverter.mjs",AssetExporter:"./src/modules/asset/exporter/AssetExporter.mjs",ARSystem:"./src/modules/ar/ARSystem.mjs",MediaCreator:"./src/modules/mediacreator/MediaCreator.mjs",SystemInfo:"./src/modules/systeminfo/SystemInfo.mjs"};class G0{constructor(a){y(this,"_promise",null);y(this,"_instance",null);y(this,"_importFn");this._name=a,this._importFn=async()=>{const n=I0[this._name];if(!n)throw new Error(`Build path for module ${this._name} not found in __MODULE_BUILD_PATHS__. Build configuration issue?`);try{const r=await import(n);if(!r[this._name])throw new Error(`Module class ${this._name} not found in dynamically imported module: ${n}`);return r[this._name]}catch(r){throw new Error(`Failed to dynamically import module ${this._name} from path ${n}: ${r instanceof Error?r.message:String(r)}`)}}}async getInstance(){if(this._instance!==null)return this._instance;this._promise||(this._promise=this._importFn());try{const a=await this._promise;return this._instance=new a,this._instance}catch(a){throw new Error(`Failed to instantiate module ${this._name}: ${a instanceof Error?a.message:String(a)}`)}}}const Mr=class Mr{constructor(){y(this,"_modules",new Map)}static get instance(){return this._instance}register(a){this._modules.has(a)&&console.warn(`Module '${a}' is already registered. Overwriting.`),this._modules.set(a,new G0(a))}async get(a){const n=this._modules.get(a);if(!n)throw new Error(`Module '${a}' not registered`);return n.getInstance()}};y(Mr,"_instance",new Mr);let js=Mr;const mi=js.instance,B0={AssetLoader:"./asset/loader/AssetLoader.ts",AssetConverter:"./asset/converter/AssetConverter.ts",AssetExporter:"./asset/exporter/AssetExporter.ts",ARSystem:"./ar/ARSystem.ts",MediaCreator:"./mediacreator/MediaCreator.ts",SystemInfo:"./systeminfo/SystemInfo.ts"};Object.keys(B0).forEach(S=>{mi.register(S)});const Hn=class Hn{constructor(a,n,r,f){y(this,"_id");y(this,"renderer");y(this,"scene");y(this,"controller");y(this,"toolbox");y(this,"registered",new Map);y(this,"listeners",new Map);this._id=L0(),this.renderer=a,this.scene=n,this.controller=r,this.toolbox=f,Hn.__instances.push(this)}static get(a){const n=this.__instances.find(r=>r.id===a);return n||this.__instances.find(r=>Array.from(r.registered.values()).find(f=>f.id===a))}get id(){return this._id}DestroyInstance(){const a=Hn.__instances.findIndex(n=>n.id===this.id);return a===-1?!1:(Hn.__instances.splice(a,1),!0)}PerformAction(a,n){let r=!1;switch(a){case"START_RENDER":{this.renderer.StartRenderer(this.scene,this.controller.object),r=!0;break}case"GET_ALL_SCENE_DATA":{r=this.getAllSceneData(n);break}case"GET_ALL_OBJECTS":{r=this.getAllObjects(n);break}case"GET_OBJECTS":{r=this.getObjects(n);break}case"ADD_OBJECT":{r=this.addObject(n);break}case"UPDATE_OBJECT":{r=this.updateObject(n);break}case"DELETE_OBJECT":{r=this.deleteObject(n);break}case"SELECT_OBJECT":{r=this.selectObject(n);break}case"DESELECT_OBJECT":{r=this.deselectObject(n);break}case"SET_BACKGROUND":{r=this.setBackground(n);break}case"DROP_IT":{r=this.dropIt(n);break}case"PLACE_ON_FLOOR":{r=this.placeOnFloor(n);break}case"SET_CAMERA_TRANSFORM":{r=this.setCameraTransform(n);break}case"GET_CAMERA_TRANSFORM":{r=this.getCameraTransform(n);break}case"MOVE_CAMERA":{r=this.moveCamera(n);break}case"RESET_CAMERA":{r=this.resetCamera(n);break}case"COMPUTE_ENCOMPASSING_VIEW":{r=this.computeEncompassingView(n);break}case"SET_CAMERA_LAYER":{r=this.setCameraLayer(n);break}case"ZOOM_CAMERA":{r=this.zoomCamera(n);break}case"SET_GIZMO_MODE":{r=this.setGizmoMode(n);break}case"SET_GIZMO_VISIBILITY":{r=this.setGizmoVisibility(n);break}case"SET_GIZMO_SCALE_LINKED":{r=this.setGizmoScaleLinked(n);break}case"USE_TOOL":{r=this.useTool(n);break}case"MODEL_LOADED":{r=this.modelLoaded(n);break}case"UPDATE_SCENE":{r=this.updateScene(n);break}case"GENERATE_MEDIA":{r=this.generateMedia(n);break}case"SET_PARENT":{r=this.setParent(n);break}case"EXPORT_SCENE":{r=this.exportScene(n);break}case"LAUNCH_AR":{const{uri:f,options:w}=n;r=new Promise((g,P)=>{mi.get("ARSystem").then(D=>{g(D.launch(f,w))}).catch(P)});break}default:console.warn(`DIVECommunication.PerformAction: has been executed with unknown Action type ${a}`)}return this.dispatch(a,n),r}Subscribe(a,n){return this.listeners.get(a)||this.listeners.set(a,[]),this.listeners.get(a).push(n),()=>{const r=this.listeners.get(a);if(!r)return!1;const f=r.findIndex(w=>w===n);return f===-1?!1:(r.splice(f,1),!0)}}dispatch(a,n){const r=this.listeners.get(a);r&&r.forEach(f=>f(n))}getAllSceneData(a){const n={name:this.scene.name,mediaItem:null,backgroundColor:"#"+this.scene.background.getHexString(),floorEnabled:this.scene.Floor.visible,floorColor:"#"+this.scene.Floor.material.color.getHexString(),userCamera:{position:this.controller.object.position.clone(),target:this.controller.target.clone()},spotmarks:[],lights:Array.from(this.registered.values()).filter(r=>r.entityType==="light"),objects:Array.from(this.registered.values()).filter(r=>r.entityType==="model"),cameras:Array.from(this.registered.values()).filter(r=>r.entityType==="pov"),primitives:Array.from(this.registered.values()).filter(r=>r.entityType==="primitive"),groups:Array.from(this.registered.values()).filter(r=>r.entityType==="group")};return Object.assign(a,n),n}getAllObjects(a){return Object.assign(a,this.registered),this.registered}getObjects(a){if(a.ids.length===0)return[];const n=[];return this.registered.forEach(r=>{a.ids.includes(r.id)&&n.push(r)}),n}addObject(a){return this.registered.get(a.id)?!1:(a.parentId===void 0&&(a.parentId=null),this.registered.set(a.id,a),this.scene.AddSceneObject(a),!0)}updateObject(a){const n=this.registered.get(a.id);if(!n)return!1;this.registered.set(a.id,C0.merge(n,a));const r=this.registered.get(a.id);return this.scene.UpdateSceneObject({...a,id:r.id,entityType:r.entityType}),Object.assign(a,r),!0}deleteObject(a){const n=this.registered.get(a.id);return n?(n.parentId&&this.setParent({object:{id:n.id},parent:null}),n.entityType==="group"&&this.registered.forEach(r=>{r.parentId===n.id&&this.updateObject({id:r.id,parentId:null})}),Object.assign(a,n),this.registered.delete(a.id),Array.from(this.registered.values()).forEach(r=>{r.parentId&&r.parentId===a.id&&(r.parentId=null)}),this.scene.DeleteSceneObject(n),!0):!1}selectObject(a){const n=this.registered.get(a.id);if(!n)return!1;const r=this.scene.GetSceneObject(n);if(!r||!("isSelectable"in r))return!1;const f=this.toolbox.GetActiveTool();return f&&Ul(f)&&f.AttachGizmo(r),Object.assign(a,n),!0}deselectObject(a){const n=this.registered.get(a.id);if(!n)return!1;const r=this.scene.GetSceneObject(n);if(!r||!("isSelectable"in r))return!1;const f=this.toolbox.GetActiveTool();return f&&Ul(f)&&f.DetachGizmo(),Object.assign(a,n),!0}setBackground(a){return this.scene.SetBackground(a.color),!0}dropIt(a){const n=this.registered.get(a.id);return n?(this.scene.GetSceneObject(n).DropIt(),!0):!1}placeOnFloor(a){const n=this.registered.get(a.id);return n?(this.scene.PlaceOnFloor(n),!0):!1}setCameraTransform(a){return this.controller.object.position.copy(a.position),this.controller.target.copy(a.target),this.controller.update(),!0}getCameraTransform(a){const n={position:this.controller.object.position.clone(),target:this.controller.target.clone()};return Object.assign(a,n),n}moveCamera(a){let n={x:0,y:0,z:0},r={x:0,y:0,z:0};return"id"in a?(n=this.registered.get(a.id).position,r=this.registered.get(a.id).target):(n=a.position,r=a.target),this.controller.MoveTo(n,r,a.duration,a.locked),!0}setCameraLayer(a){return this.controller.object.SetCameraLayer(a.layer),!0}resetCamera(a){return this.controller.RevertLast(a.duration),!0}computeEncompassingView(a){const n=this.scene.ComputeSceneBB(),r=this.controller.ComputeEncompassingView(n);return Object.assign(a,r),r}zoomCamera(a){return a.direction==="IN"&&this.controller.ZoomIn(a.by),a.direction==="OUT"&&this.controller.ZoomOut(a.by),!0}setGizmoMode(a){return this.toolbox.SetGizmoMode(a.mode),!0}setGizmoVisibility(a){return this.toolbox.SetGizmoVisibility(a),a}setGizmoScaleLinked(a){return this.toolbox.SetGizmoScaleLinked(a),a}useTool(a){return this.toolbox.UseTool(a.tool),!0}modelLoaded(a){return this.registered.get(a.id).loaded=!0,!0}updateScene(a){return a.name!==void 0&&(this.scene.name=a.name),a.backgroundColor!==void 0&&this.scene.SetBackground(a.backgroundColor),a.gridEnabled!==void 0&&this.scene.Grid.SetVisibility(a.gridEnabled),a.floorEnabled!==void 0&&this.scene.Floor.SetVisibility(a.floorEnabled),a.floorColor!==void 0&&this.scene.Floor.SetColor(a.floorColor),a.name=this.scene.name,a.backgroundColor="#"+this.scene.background.getHexString(),a.gridEnabled=this.scene.Grid.visible,a.floorEnabled=this.scene.Floor.visible,a.floorColor="#"+this.scene.Floor.material.color.getHexString(),!0}generateMedia(a){let n={x:0,y:0,z:0},r={x:0,y:0,z:0};return"id"in a?(n=this.registered.get(a.id).position,r=this.registered.get(a.id).target):(n=a.position,r=a.target),mi.get("MediaCreator").then(f=>f.GenerateMedia(n,r,a.width,a.height))}setParent(a){const n=this.registered.get(a.object.id);if(!n)return!1;const r=this.scene.GetSceneObject(n);if(!r)return!1;if(a.parent===null)return this.scene.Root.attach(r),this.updateObject({id:n.id,parentId:null}),!0;if(a.object.id===a.parent.id)return!1;const f=this.registered.get(a.parent.id);if(!f)return this.scene.Root.attach(r),this.updateObject({id:n.id,parentId:null}),!0;const w=this.scene.GetSceneObject(f);return w?(w.attach(r),this.updateObject({id:n.id,parentId:f.id}),!0):(this.scene.Root.attach(r),this.updateObject({id:n.id,parentId:null}),!0)}exportScene(a){return mi.get("AssetExporter").then(n=>n.export(this.scene.Root,a.type,{}))}};y(Hn,"__instances",[]);let Ye=Hn;class U0{constructor(a){y(this,"_renderer");y(this,"_rendererCallbackId");this._renderer=a,this._rendererCallbackId=this._renderer.AddPreRenderCallback(()=>{this.Update()})}Dispose(){this._renderer.RemovePreRenderCallback(this._rendererCallbackId)}Update(){Nn.update()}Animate(a){return new Nn.Tween(a)}}class k0 extends u.OrthographicCamera{constructor(n,r,f){super(-1,1,1,-1,.1,100);y(this,"axesHelper");y(this,"_renderer");y(this,"_scene");y(this,"_renderCallbackId");this.layers.mask=pe.COORDINATE_LAYER_MASK,this.axesHelper=new u.AxesHelper(.5),this.axesHelper.layers.mask=pe.COORDINATE_LAYER_MASK,this.axesHelper.material.depthTest=!1,this.axesHelper.position.set(0,0,-1),this.axesHelper.setColors(new u.Color(Hs),new u.Color(Ys),new u.Color(Xs));const w=new zs("X",.2,Fl),g=new zs("Y",.2,Wl),P=new zs("Z",.2,Vl);w.layers.mask=pe.COORDINATE_LAYER_MASK,g.layers.mask=pe.COORDINATE_LAYER_MASK,P.layers.mask=pe.COORDINATE_LAYER_MASK,w.position.set(.7,0,0),g.position.set(0,.7,0),P.position.set(0,0,.7),this.axesHelper.add(w),this.axesHelper.add(g),this.axesHelper.add(P),this.add(this.axesHelper),this._renderer=n,this._scene=r,this._scene.add(this);const D=new u.Vector4;this._renderCallbackId=n.AddPostRenderCallback(()=>{const H=r.background;r.background=null,n.getViewport(D),n.setViewport(0,0,150,150),n.autoClear=!1,this.SetFromCameraMatrix(f.object.matrix),n.render(r,this),n.setViewport(D),n.autoClear=!0,r.background=H})}Dispose(){this._renderer.RemovePostRenderCallback(this._renderCallbackId),this._scene.remove(this)}SetFromCameraMatrix(n){this.axesHelper.rotation.setFromRotationMatrix(new u.Matrix4().extractRotation(n).invert())}}const z0="1.19.1-beta.5",F0={version:z0},wn={antialias:!0,alpha:!0,stencil:!1,shadowMapEnabled:!0,shadowMapType:u.PCFSoftShadowMap,toneMapping:u.NoToneMapping,canvas:void 0};class W0 extends u.WebGLRenderer{constructor(n=wn){super({antialias:n.antialias||wn.antialias,alpha:n.alpha||wn.alpha,preserveDrawingBuffer:!0,canvas:n.canvas});y(this,"paused",!1);y(this,"running",!1);y(this,"force",!1);y(this,"preRenderCallbacks",new Map);y(this,"postRenderCallbacks",new Map);this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=n.shadowMapEnabled||wn.shadowMapEnabled,this.shadowMap.type=n.shadowMapType||wn.shadowMapType,this.toneMapping=n.toneMapping||wn.toneMapping,this.debug.checkShaderErrors=!1}Dispose(){this.StopRenderer(),this.dispose()}StartRenderer(n,r){this.setAnimationLoop((f,w)=>{this.internal_render(n,r,f,w)}),this.running=!0}PauseRenderer(){this.paused=!0}ResumeRenderer(){this.paused=!1}StopRenderer(){this.setAnimationLoop(null),this.running=!1}OnResize(n,r){this.setSize(n,r)}AddPreRenderCallback(n){const r=u.MathUtils.generateUUID();return this.preRenderCallbacks.set(r,n),r}RemovePreRenderCallback(n){return this.preRenderCallbacks.has(n)?(this.preRenderCallbacks.delete(n),!0):!1}AddPostRenderCallback(n){const r=u.MathUtils.generateUUID();return this.postRenderCallbacks.set(r,n),r}RemovePostRenderCallback(n){return this.postRenderCallbacks.has(n)?(this.postRenderCallbacks.delete(n),!0):!1}ForceRendering(){this.force=!0}internal_render(n,r,f,w){(this.paused||!this.running)&&!this.force||(this.preRenderCallbacks.forEach(g=>{g(f,w)}),this.render(n,r),this.postRenderCallbacks.forEach(g=>{g(f,w)}),this.force=!1)}}class V0 extends u.Object3D{constructor(){super();y(this,"isDIVELight",!0);y(this,"isDIVEAmbientLight",!0);y(this,"_light");this.name="DIVEAmbientLight",this._light=new u.AmbientLight(16777215,1),this._light.layers.mask=pe.PRODUCT_LAYER_MASK,this.add(this._light)}SetColor(n){this._light.color=n}SetIntensity(n){this._light.intensity=n}SetEnabled(n){this._light.visible=n}}class N0 extends u.Object3D{constructor(){super();y(this,"isDIVELight",!0);y(this,"isDIVEPointLight",!0);y(this,"isMovable",!0);y(this,"isSelectable",!0);y(this,"gizmo",null);y(this,"light");y(this,"mesh");this.name="DIVEPointLight",this.light=new u.PointLight(16777215,1),this.light.layers.mask=pe.PRODUCT_LAYER_MASK,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const n=.1,r=new u.SphereGeometry(n,n*320,n*320),f=new u.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:u.FrontSide});this.mesh=new u.Mesh(r,f),this.mesh.layers.mask=pe.UI_LAYER_MASK,this.add(this.mesh)}SetColor(n){this.light.color=n,this.mesh.material.color=n}SetIntensity(n){this.light.intensity=n,this.mesh.material.opacity=n>.8?.8:n*.8}SetEnabled(n){this.light.visible=n}onMove(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})}onSelect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class H0 extends u.Object3D{constructor(){super();y(this,"isDIVELight",!0);y(this,"isDIVESceneLight",!0);y(this,"_hemiLight");y(this,"_dirLight");this.name="DIVESceneLight",this._hemiLight=new u.HemisphereLight(16777215,16777215,2),this._hemiLight.layers.mask=pe.PRODUCT_LAYER_MASK,this._hemiLight.position.set(0,50,0),this.add(this._hemiLight),this._dirLight=new u.DirectionalLight(16777215,3),this._dirLight.layers.mask=pe.PRODUCT_LAYER_MASK,this._dirLight.position.set(1,1.75,1),this._dirLight.position.multiplyScalar(30),this._dirLight.castShadow=!0,this._dirLight.shadow.mapSize.width=2048,this._dirLight.shadow.mapSize.height=2048;const n=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=n,this._dirLight.shadow.camera.top=n,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}SetColor(n){this._hemiLight.color=n,this._dirLight.color=n}SetIntensity(n){this._hemiLight.intensity=n*2,this._dirLight.intensity=n*3}SetEnabled(n){this._hemiLight.visible=n,this._dirLight.visible=n}}const Ks=S=>S.parent?Ks(S.parent):S;class Y0{constructor(){y(this,"isMovable",!0)}}class X0{constructor(){y(this,"isSelectable",!0)}}function j0(S,a){return a.forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(r=>{Object.defineProperty(S.prototype,r,Object.getOwnPropertyDescriptor(n.prototype,r))})}),S}class qs extends j0(u.Object3D,[X0,Y0]){constructor(){super();y(this,"isDIVENode",!0);y(this,"gizmo",null);y(this,"_positionWorldBuffer");y(this,"_boundingBox");this.layers.mask=pe.PRODUCT_LAYER_MASK,this._positionWorldBuffer=new u.Vector3,this._boundingBox=new u.Box3}SetPosition(n){if(!this.parent){this.position.set(n.x,n.y,n.z);return}const r=new u.Vector3(n.x,n.y,n.z);this.position.copy(this.parent.worldToLocal(r)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(n){this.rotation.set(n.x,n.y,n.z)}SetScale(n){this.scale.set(n.x,n.y,n.z)}SetVisibility(n){this.visible=n}SetToWorldOrigin(){var n;this.position.set(0,0,0),(n=Ye.get(this.userData.id))==null||n.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onMove(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onSelect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var n;(n=Ye.get(this.userData.id))==null||n.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class Z0 extends qs{constructor(){super(...arguments);y(this,"isDIVEModel",!0);y(this,"_mesh",null);y(this,"_material",null)}SetModel(n){this.clear(),this._boundingBox.makeEmpty(),n.traverse(r=>{r.castShadow=!0,r.receiveShadow=!0,r.layers.mask=this.layers.mask,this._boundingBox.expandByObject(r),!this._mesh&&"isMesh"in r&&(this._mesh=r,this._material?this._mesh.material=this._material:this._material=r.material)}),this.add(n)}SetMaterial(n){this._material||(this._material=new u.MeshStandardMaterial),n.vertexColors!==void 0&&(this._material.vertexColors=n.vertexColors),n.color!==void 0&&this._material.color.set(n.color),n.map!==void 0&&(this._material.map=n.map),n.normalMap!==void 0&&(this._material.normalMap=n.normalMap),n.roughness!==void 0&&(this._material.roughness=n.roughness),n.roughnessMap!==void 0&&(this._material.roughnessMap=n.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),n.metalness!==void 0&&(this._material.metalness=n.metalness),n.metalnessMap!==void 0&&(this._material.metalnessMap=n.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}PlaceOnFloor(){var w,g,P,D,H;const n=this.getWorldPosition(this._positionWorldBuffer),r=n.clone();(g=(w=this._mesh)==null?void 0:w.geometry)==null||g.computeBoundingBox();const f=(D=(P=this._mesh)==null?void 0:P.geometry)==null?void 0:D.boundingBox;!f||!this._mesh||(n.y=n.y-this._mesh.localToWorld(f.min.clone()).y,n.y!==r.y&&((H=Ye.get(this.userData.id))==null||H.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:n,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEModel: DropIt() called on a model that is not in the scene.",this);return}const n=this._boundingBox.min.y*this.scale.y,r=this.localToWorld(this._boundingBox.getCenter(new u.Vector3).multiply(this.scale));r.y=n+this.position.y;const f=new u.Raycaster(r,new u.Vector3(0,-1,0));f.layers.mask=pe.PRODUCT_LAYER_MASK;const w=f.intersectObjects(Ks(this).Root.children,!0);if(w.length>0){const g=w[0].object;g.geometry.computeBoundingBox();const P=g.geometry.boundingBox,D=g.localToWorld(P.max.clone()),H=this.position.clone(),le=this.position.clone().setY(D.y).sub(new u.Vector3(0,n,0));if(this.position.copy(le),this.position.y===H.y)return;this.onMove()}}}class Q0 extends qs{constructor(){super();y(this,"isDIVEPrimitive",!0);y(this,"_mesh");this._mesh=new u.Mesh,this._mesh.layers.mask=pe.PRODUCT_LAYER_MASK,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new u.MeshStandardMaterial,this.add(this._mesh)}SetGeometry(n){const r=this.assembleGeometry(n);r&&(this._mesh.geometry=r,this._boundingBox.setFromObject(this._mesh))}SetMaterial(n){const r=this._mesh.material;n.vertexColors!==void 0&&(r.vertexColors=n.vertexColors),n.color!==void 0&&(r.color=new u.Color(n.color)),n.map!==void 0&&(r.map=n.map),n.normalMap!==void 0&&(r.normalMap=n.normalMap),n.roughness!==void 0&&(r.roughness=n.roughness),n.roughnessMap!==void 0&&(r.roughnessMap=n.roughnessMap,r.roughnessMap&&(r.roughness=1)),n.metalness!==void 0&&(r.metalness=n.metalness),n.metalnessMap!==void 0&&(r.metalnessMap=n.metalnessMap,r.metalnessMap&&(r.metalness=0)),this._mesh&&(this._mesh.material=r)}PlaceOnFloor(){var w,g,P,D,H;const n=this.getWorldPosition(this._positionWorldBuffer),r=n.clone();(g=(w=this._mesh)==null?void 0:w.geometry)==null||g.computeBoundingBox();const f=(D=(P=this._mesh)==null?void 0:P.geometry)==null?void 0:D.boundingBox;!f||!this._mesh||(n.y=n.y-this._mesh.localToWorld(f.min.clone()).y,n.y!==r.y&&((H=Ye.get(this.userData.id))==null||H.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:n,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEPrimitive: DropIt() called on a model that is not in the scene.",this);return}const n=this._boundingBox.min.y*this.scale.y,r=this.localToWorld(this._boundingBox.getCenter(new u.Vector3).multiply(this.scale));r.y=n+this.position.y;const f=new u.Raycaster(r,new u.Vector3(0,-1,0));f.layers.mask=pe.PRODUCT_LAYER_MASK;const w=f.intersectObjects(Ks(this).Root.children,!0);if(w.length>0){const g=w[0].object;g.geometry.computeBoundingBox();const P=g.geometry.boundingBox,D=g.localToWorld(P.max.clone()),H=this.position.clone(),le=this.position.clone().setY(D.y).sub(new u.Vector3(0,n,0));if(this.position.copy(le),this.position.y===H.y)return;this.onMove()}}assembleGeometry(n){switch(this._mesh.material.flatShading=!1,n.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(n);case"sphere":return this.createSphereGeometry(n);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(n);case"cube":case"box":return this.createBoxGeometry(n);case"cone":return this.createConeGeometry(n);case"wall":return this.createWallGeometry(n);case"plane":return this.createPlaneGeometry(n);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",n.name.toLowerCase()),null}}createCylinderGeometry(n){const r=new u.CylinderGeometry(n.width/2,n.width/2,n.height,64);return r.translate(0,n.height/2,0),r}createSphereGeometry(n){return new u.SphereGeometry(n.width/2,256,256)}createPyramidGeometry(n){const r=new Float32Array([-n.width/2,0,-n.depth/2,n.width/2,0,-n.depth/2,n.width/2,0,n.depth/2,-n.width/2,0,n.depth/2,0,n.height,0]),f=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),w=new u.BufferGeometry;return w.setAttribute("position",new u.BufferAttribute(r,3)),w.setIndex(new u.BufferAttribute(f,1)),w.computeVertexNormals(),w.computeBoundingBox(),w.computeBoundingSphere(),w}createBoxGeometry(n){const r=new u.BoxGeometry(n.width,n.height,n.depth);return r.translate(0,n.height/2,0),r}createConeGeometry(n){const r=new u.ConeGeometry(n.width/2,n.height,256);return r.translate(0,n.height/2,0),r}createWallGeometry(n){const r=new u.BoxGeometry(n.width,n.height,n.depth||.05,16);return r.translate(0,n.height/2,0),r}createPlaneGeometry(n){const r=new u.BoxGeometry(n.width,n.height,n.depth);return r.translate(0,n.height/2,0),r}}class K0 extends qs{constructor(){super();y(this,"isDIVEGroup",!0);y(this,"_members");y(this,"_lines");this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}SetPosition(n){super.SetPosition(n),this._members.forEach(r=>{"isDIVENode"in r&&r.onMove()})}SetLinesVisibility(n,r){if(!r){this._lines.forEach(w=>{w.visible=n});return}const f=this._members.indexOf(r);f!==-1&&(this._lines[f].visible=n)}attach(n){if(this._members.includes(n))return this;const r=this.createLine();return this.add(r),this._lines.push(r),super.attach(n),this._members.push(n),this.updateLineTo(r,n),this.SetLinesVisibility(!0,n),this}remove(n){const r=this._members.indexOf(n);if(r===-1)return this;const f=this._lines[r];return super.remove(f),this._lines.splice(r,1),super.remove(n),this._members.splice(r,1),this}UpdateLineTo(n){const r=this._members.indexOf(n);r!==-1&&this.updateLineTo(this._lines[r],n)}createLine(){const n=new u.BufferGeometry,r=new u.LineDashedMaterial({color:6710886,dashSize:.05,gapSize:.025}),f=new u.Line(n,r);return f.visible=!1,f}updateLineTo(n,r){n.geometry.setFromPoints([new u.Vector3(0,0,0),r.position.clone()]),n.computeLineDistances()}}class $s extends u.Object3D{constructor(){super();y(this,"isDIVERoot",!0);this.name="Root"}ComputeSceneBB(){const n=new u.Box3;return this.traverse(r=>{"isObject3D"in r&&n.expandByObject(r)}),n}GetSceneObject(n){let r;return this.traverse(f=>{r||f.userData.id===n.id&&(r=f)}),r}AddSceneObject(n){switch(n.entityType){case"pov":break;case"light":{this.updateLight(n);break}case"model":{this.updateModel(n);break}case"primitive":{this.updatePrimitive(n);break}case"group":{this.updateGroup(n);break}default:console.warn(`DIVERoot.AddSceneObject: Unknown entity type: ${n.entityType}`)}}UpdateSceneObject(n){switch(n.entityType){case"pov":break;case"light":{this.updateLight(n);break}case"model":{this.updateModel(n);break}case"primitive":{this.updatePrimitive(n);break}case"group":{this.updateGroup(n);break}default:console.warn(`DIVERoot.UpdateSceneObject: Unknown entity type: ${n.entityType}`)}}DeleteSceneObject(n){switch(n.entityType){case"pov":break;case"light":{this.deleteLight(n);break}case"model":{this.deleteModel(n);break}case"primitive":{this.deletePrimitive(n);break}case"group":{this.deleteGroup(n);break}default:console.warn(`DIVERoot.DeleteSceneObject: Unknown entity type: ${n.entityType}`)}}PlaceOnFloor(n){switch(n.entityType){case"pov":case"light":break;case"model":case"primitive":{this.placeOnFloor(n);break}default:console.warn(`DIVERoot.PlaceOnFloor: Unknown entity type: ${n.entityType}`)}}updateLight(n){let r=this.GetSceneObject(n);if(!r){switch(n.type){case"scene":{r=new H0;break}case"ambient":{r=new V0;break}case"point":{r=new N0;break}default:{console.warn(`DIVERoot.updateLight: Unknown light type: ${n.type}`);return}}r.userData.id=n.id,this.add(r)}n.name!==void 0&&n.name!==null&&(r.name=n.name),n.position!==void 0&&n.position!==null&&r.position.set(n.position.x,n.position.y,n.position.z),n.intensity!==void 0&&n.intensity!==null&&r.SetIntensity(n.intensity),n.enabled!==void 0&&n.enabled!==null&&r.SetEnabled(n.enabled),n.color!==void 0&&n.color!==null&&r.SetColor(new u.Color(n.color)),n.visible!==void 0&&n.visible!==null&&(r.visible=n.visible),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}updateModel(n){let r=this.GetSceneObject(n);r||(r=new Z0,r.userData.id=n.id,r.userData.uri=n.uri,this.add(r)),n.uri!==void 0&&mi.get("AssetLoader").then(f=>{f.load(n.uri).then(w=>{var g;r.SetModel(w),(g=Ye.get(n.id))==null||g.PerformAction("MODEL_LOADED",{id:n.id})})}),n.name!==void 0&&(r.name=n.name),n.position!==void 0&&r.SetPosition(n.position),n.rotation!==void 0&&r.SetRotation(n.rotation),n.scale!==void 0&&r.SetScale(n.scale),n.visible!==void 0&&r.SetVisibility(n.visible),n.material!==void 0&&r.SetMaterial(n.material),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}updatePrimitive(n){let r=this.GetSceneObject(n);r||(r=new Q0,r.userData.id=n.id,this.add(r)),n.name!==void 0&&(r.name=n.name),n.geometry!==void 0&&r.SetGeometry(n.geometry),n.position!==void 0&&r.SetPosition(n.position),n.rotation!==void 0&&r.SetRotation(n.rotation),n.scale!==void 0&&r.SetScale(n.scale),n.visible!==void 0&&r.SetVisibility(n.visible),n.material!==void 0&&r.SetMaterial(n.material),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}updateGroup(n){let r=this.GetSceneObject(n);r||(r=new K0,r.userData.id=n.id,this.add(r)),n.name!==void 0&&(r.name=n.name),n.position!==void 0&&r.SetPosition(n.position),n.rotation!==void 0&&r.SetRotation(n.rotation),n.scale!==void 0&&r.SetScale(n.scale),n.visible!==void 0&&r.SetVisibility(n.visible),n.bbVisible!==void 0&&r.SetLinesVisibility(n.bbVisible),n.parentId!==void 0&&this.setParent({...n,parentId:n.parentId})}deleteLight(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deleteLight: Light with id ${n.id} not found`);return}this.detachTransformControls(r),r.parent.remove(r)}deleteModel(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deleteModel: Model with id ${n.id} not found`);return}this.detachTransformControls(r),r.parent.remove(r)}deletePrimitive(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deletePrimitive: Primitive with id ${n.id} not found`);return}this.detachTransformControls(r),r.parent.remove(r)}deleteGroup(n){const r=this.GetSceneObject(n);if(!r){console.warn(`DIVERoot.deleteGroup: Group with id ${n.id} not found`);return}this.detachTransformControls(r);for(let f=r.members.length-1;f>=0;f--)this.attach(r.members[f]);r.parent.remove(r)}placeOnFloor(n){const r=this.GetSceneObject(n);r&&r.PlaceOnFloor()}setParent(n){const r=this.GetSceneObject(n);if(r)if(n.parentId!==null){const f=this.GetSceneObject({id:n.parentId});if(!f)return;f.attach(r)}else this.attach(r)}detachTransformControls(n){this.findScene(n).children.find(r=>{"isTransformControls"in r&&r.detach()})}findScene(n){return n.parent!==null?this.findScene(n.parent):n}}const q0="#888888",$0="#dddddd";class J0 extends u.Object3D{constructor(){super(),this.name="Grid";const a=new u.GridHelper(100,100,q0,$0);a.material.depthTest=!1,a.layers.mask=pe.HELPER_LAYER_MASK,this.add(a)}SetVisibility(a){this.visible=a}}class e_ extends u.Mesh{constructor(){super(new u.PlaneGeometry(1e4,1e4),new u.MeshStandardMaterial({color:new u.Color(150/255,150/255,150/255)}));y(this,"isFloor",!0);this.name="Floor",this.layers.mask=pe.PRODUCT_LAYER_MASK,this.receiveShadow=!0,this.rotateX(-Math.PI/2)}SetVisibility(n){this.visible=n}SetColor(n){this.material.color=new u.Color(n)}}class t_{constructor(a,n,r,f,w){this.xrLight=a,this.renderer=n,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=w,this.frameCallback=this.onXRFrame.bind(this);const g=n.xr.getSession();if(f&&"XRWebGLBinding"in window){const P=new u.WebGLCubeRenderTarget(16);a.environment=P.texture;const D=n.getContext();switch(g.preferredReflectionFormat){case"srgba8":D.getExtension("EXT_sRGB");break;case"rgba16f":D.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(g,D),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}g.requestAnimationFrame(this.frameCallback)}updateReflection(){const a=this.renderer.properties.get(this.xrLight.environment);if(a){const n=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);n&&(a.__webglTexture=n,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(a,n){if(!this.xrLight)return;n.session.requestAnimationFrame(this.frameCallback);const f=n.getLightEstimate(this.lightProbe);if(f){this.xrLight.lightProbe.sh.fromArray(f.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const w=Math.max(1,Math.max(f.primaryLightIntensity.x,Math.max(f.primaryLightIntensity.y,f.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(f.primaryLightIntensity.x/w,f.primaryLightIntensity.y/w,f.primaryLightIntensity.z/w),this.xrLight.directionalLight.intensity=w,this.xrLight.directionalLight.position.copy(f.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class n_ extends u.Group{constructor(a,n=!0){super(),this.lightProbe=new u.LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new u.DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,f=!1;a.xr.addEventListener("sessionstart",()=>{const w=a.xr.getSession();"requestLightProbe"in w&&w.requestLightProbe({reflectionFormat:w.preferredReflectionFormat}).then(g=>{r=new t_(this,a,g,n,()=>{f=!0,this.dispatchEvent({type:"estimationstart"})})})}),a.xr.addEventListener("sessionend",()=>{r&&(r.dispose(),r=null),f&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class i_ extends u.Object3D{constructor(n){super();y(this,"_scene");y(this,"_xrLight");y(this,"_lightRoot");this.name="XRLightRoot",this._scene=n,this._xrLight=null,this._lightRoot=new $s,this._lightRoot.UpdateSceneObject({id:"XRSceneLight",entityType:"light",name:"XRSceneLight",type:"scene",color:16777215,intensity:1,enabled:!0,visible:!0}),this.add(this._lightRoot)}InitLightEstimation(n){this._xrLight||(this._xrLight=new n_(n,!0),this._xrLight.layers.mask=pe.PRODUCT_LAYER_MASK,this.add(this._xrLight)),this._xrLight.addEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.addEventListener("estimationend",()=>{this.onEstimationEnd()})}DisposeLightEstimation(){this._xrLight&&(this._xrLight.removeEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.removeEventListener("estimationend",()=>{this.onEstimationEnd()}))}onEstimationStart(){this._lightRoot.visible=!1,this._xrLight&&this._xrLight.environment&&(this._scene.environment=this._xrLight.environment)}onEstimationEnd(){this._lightRoot.visible=!0,this._scene.environment=null,this._xrLight}}class r_ extends u.Object3D{constructor(n){super();y(this,"_xrLightRoot");y(this,"_xrModelRoot");y(this,"_xrHandNode");y(this,"_xrShadowPlane");this.name="XRRoot",this._xrModelRoot=new $s,this._xrModelRoot.name="XRModelRoot",this.add(this._xrModelRoot),this._xrShadowPlane=new u.Mesh(new u.PlaneGeometry(100,100),new u.ShadowMaterial({opacity:1,transparent:!0})),this._xrModelRoot.add(this._xrShadowPlane),this._xrLightRoot=new i_(n),this._xrLightRoot.name="XRLightRoot",this.add(this._xrLightRoot),this._xrHandNode=new u.Object3D,this._xrHandNode.name="XRHandNode",this.add(this._xrHandNode)}get XRModelRoot(){return this._xrModelRoot}get XRLightRoot(){return this._xrLightRoot}get XRHandNode(){return this._xrHandNode}InitLightEstimation(n){this._xrLightRoot.InitLightEstimation(n)}DisposeLightEstimation(){this._xrLightRoot.DisposeLightEstimation()}}class s_ extends u.Scene{constructor(){super();y(this,"_root");y(this,"_floor");y(this,"_grid");y(this,"_xrRoot");this.background=new u.Color(16777215),this._root=new $s,this.add(this._root),this._floor=new e_,this.add(this._floor),this._grid=new J0,this.add(this._grid),this._xrRoot=new r_(this),this._xrRoot.visible=!1,this.add(this._xrRoot)}get Root(){return this._root}get XRRoot(){return this._xrRoot}get Floor(){return this._floor}get Grid(){return this._grid}InitXR(n){this._root.visible=!1,this._xrRoot.visible=!0,this._xrRoot.InitLightEstimation(n)}DisposeXR(){this._root.visible=!0,this._xrRoot.visible=!1,this._xrRoot.DisposeLightEstimation()}SetBackground(n){this.background=new u.Color(n)}ComputeSceneBB(){return this.Root.ComputeSceneBB()}GetSceneObject(n){return this.Root.GetSceneObject(n)}AddSceneObject(n){this.Root.AddSceneObject(n)}UpdateSceneObject(n){this.Root.UpdateSceneObject(n)}DeleteSceneObject(n){this.Root.DeleteSceneObject(n)}PlaceOnFloor(n){this.Root.PlaceOnFloor(n)}}const Hl={autoResize:!0,autoStart:!0,displayAxes:!1,renderer:wn,perspectiveCamera:pe.DIVEPerspectiveCameraDefaultSettings};class o_{constructor(a){y(this,"_renderer");y(this,"_scene");y(this,"_perspectiveCamera");y(this,"_settings");y(this,"_resizeObserverId","");y(this,"_width",0);y(this,"_height",0);this._settings={...Hl,...a??{}},this._renderer=new W0(this._settings.renderer),this._scene=new s_,this._perspectiveCamera=new pe.DIVEPerspectiveCamera(this._settings.perspectiveCamera),this._settings.autoResize&&this._addResizeObserver(),this._settings.autoStart&&this.renderer.StartRenderer(this.scene,this.perspectiveCamera)}get renderer(){return this._renderer}get scene(){return this._scene}get perspectiveCamera(){return this._perspectiveCamera}dispose(){this._removeResizeObserver(),this._renderer.dispose()}onResize(a,n){this.renderer.OnResize(a,n),this.perspectiveCamera.OnResize(a,n)}_addResizeObserver(){this._resizeObserverId=this.renderer.AddPreRenderCallback(()=>{const a=this.renderer.domElement.parentElement;if(!a)return;const{clientWidth:n,clientHeight:r}=a;n===this._width&&r===this._height||(this.onResize(n,r),this._width=n,this._height=r)})}_removeResizeObserver(){this.renderer.RemovePreRenderCallback(this._resizeObserverId)}}function Mt(S,a){const n=(S+"e").split("e");return+(n[0]+"e"+(+n[1]+(a||0)))}function a_(S,a=0){const n=Mt(S,+a);return Mt(Math.ceil(n),-a)}function l_(S,a=0){const n=Mt(S,+a);return Mt(Math.floor(n),-a)}function Yl(S,a=0){if(S<0)return-Yl(-S,a);const n=Mt(S,+a);return Mt(Math.round(n),-a)}function c_(S,a,n){return Math.atan2(S.clone().cross(a).dot(n),a.clone().dot(S))}function u_(S,a=0){const n=Mt(S,+a);return Mt(Math.round(n),-a).toFixed(a)}function h_(S,a=0){const n=Mt(S,+a);return Mt(Math.trunc(n),-a)}function f_(S){return(u.MathUtils.radToDeg(S)+360)%360}function d_(S){return u.MathUtils.degToRad(S)}const p_={ceilExp:a_,floorExp:l_,roundExp:Yl,toFixedExp:u_,truncateExp:h_,signedAngleTo:c_,radToDeg:f_,degToRad:d_},Xl={...Hl,orbitControls:yr};class Ar{constructor(a){y(this,"_settings");y(this,"_engine");y(this,"orbitControls");y(this,"toolbox");y(this,"_communication");y(this,"animationSystem");y(this,"axisCamera");this._settings={...Xl,...a??{}},this._engine=new o_(a),this.animationSystem=new U0(this._engine.renderer),this.orbitControls=new Ns(this._engine.perspectiveCamera,this._engine.renderer,this.animationSystem,this._settings.orbitControls),this.toolbox=new Nl(this._engine.scene,this.orbitControls),this._communication=new Ye(this._engine.renderer,this._engine.scene,this.orbitControls,this.toolbox),this._settings.displayAxes?this.axisCamera=new k0(this._engine.renderer,this._engine.scene,this.orbitControls):this.axisCamera=null,window.DIVE={PrintScene:()=>this._engine.scene},console.log(`DIVE ${F0.version} initialized successfully!`),console.log(`
28
28
  @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
29
29
  @@@@+-:::::::---------------------==------------------------------=#@@@@
30
30
  @@%=::::.......::---------------------------------------------------------+@@