@tomorrowevening/hermes 0.0.66 → 0.0.67
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/dist/hermes.cjs.js +12 -12
- package/dist/hermes.es.js +572 -536
- package/package.json +1 -1
package/dist/hermes.cjs.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("three"),vn=require("tweakpane"),bn=require("@tweakpane/plugin-essentials"),E=require("react"),en=require("framer-motion");function yn(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,t.get?t:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const En=yn(bn),wt=()=>{},Sn=()=>{};function ct(e){return e.substring(0,1).toUpperCase()+e.substring(1)}function Ve(e,n,a){return Math.min(n,Math.max(e,a))}function jt(e,n,a){return(a-e)/(n-e)}function It(e,n,a){return e*(1-a)+n*a}function xn(e,n){const a=e-n;return Math.sqrt(a*a)}function tn(){return Math.round(Math.random()*1e6).toString()}function nn(e){return e.r!==void 0&&e.g!==void 0&&e.b!==void 0}function an(e){const n=Math.round(e.r*255),a=Math.round(e.g*255),t=Math.round(e.b*255),i=d=>{const h=d.toString(16);return h.length===1?"0"+h:h},c=i(n),l=i(a),r=i(t);return"#"+c+l+r}function Nt(e,n=1){return Number(e.toFixed(n))}exports.totalThreeObjects=0;const Lt=()=>{exports.totalThreeObjects=0},Ct=e=>{if(!e)return;let n=e.name.replace(" ","");n.length===0&&(n=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),e.parent!==null&&e.parent.uuid.length>0&&(n=`${e.parent.uuid}.${n}`),e.uuid=n,e.children.forEach(a=>{Ct(a)})},Cn=e=>{e?.dispose()},rn=e=>{e&&(Array.isArray(e)?e.forEach(n=>n.dispose()):e.dispose())},et=e=>{if(e){for(;e.children.length>0;){const n=e.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):et(n)}if(e.parent&&e.parent.remove(e),e.isMesh){const n=e;n.geometry?.dispose(),rn(n.material)}e.dispose!==void 0&&e.dispose()}};class wn{components=new Map;listen;_appID="";_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(n,a,t=!0){this._appID=n,this._debugEnabled=a,a&&(this._useBC=t,t?(this._broadcastChannel=new BroadcastChannel(n),this._broadcastChannel.addEventListener("message",this.messageHandler)):(this._webSocket=new WebSocket(n),this._webSocket.addEventListener("open",this.openHandler),this._webSocket.addEventListener("close",this.closeHandler),this._webSocket.addEventListener("message",this.messageHandler)))}addComponent(n,a){this.components.set(n,a)}dispose(){this._broadcastChannel!==void 0&&this._broadcastChannel.removeEventListener("message",this.messageHandler),this._webSocket!==void 0&&(this._webSocket.removeEventListener("open",this.openHandler),this._webSocket.removeEventListener("close",this.closeHandler),this._webSocket.removeEventListener("message",this.messageHandler)),this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){this._mode!==n.target&&(this._useBC?this._broadcastChannel?.postMessage(n):this._connected&&this._webSocket?.send(JSON.stringify(n)))}messageHandler=n=>{this.listen!==void 0&&(this._useBC?this.listen(n.data):this.listen(JSON.parse(n.data)))};openHandler=()=>{this._connected=!0};closeHandler=()=>{this._connected=!1};get appID(){return this._appID}get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor")}}const k=new f.EventDispatcher,P={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",ADD_SCENE:"ToolEvents::addScene",REMOVE_SCENE:"ToolEvents::removeScene",SET_SCENE:"ToolEvents::setScene",GET_OBJECT:"ToolEvents::getObject",SET_OBJECT:"ToolEvents::setObject",UPDATE_OBJECT:"ToolEvents::updateObject",CREATE_TEXTURE:"ToolEvents::createTexture",REQUEST_METHOD:"ToolEvents::requestMethod",ADD_CAMERA:"ToolEvents::addCamera",REMOVE_CAMERA:"ToolEvents::removeCamera"};class lt{app;constructor(n){this.app=n}dispose(){}handleApp(n,a,t){}handleEditor(n,a,t){}}class Mn extends lt{selectDropdown(n,a){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:a}})}updateDropdown(n,a){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:a}})}handleApp(n,a,t){switch(t.event){case"selectComponent":k.dispatchEvent({type:P.SELECT_DROPDOWN,value:t.data});break;case"draggableListUpdate":k.dispatchEvent({type:P.DRAG_UPDATE,value:t.data});break}}}class Mt extends lt{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;static rafDriver=void 0;dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}getSheetInstance(n,a){return a!==void 0?`${n}-${a}`:n}sheet(n,a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const t=this.getSheetInstance(n,a);let i=this.sheets.get(t);return i!==void 0||(i=this.project?.sheet(n,a),this.sheets.set(t,i)),i}playSheet(n,a,t){this.sheet(n,t)?.sequence.play(a),this.app.send({event:"playSheet",target:"editor",data:{sheet:n,instance:t,value:a}})}pauseSheet(n,a){this.sheet(n)?.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:n,instance:a}})}clearSheetObjects(n){this.sheetObjects.forEach((a,t)=>{t.search(`${n}_`)>-1&&this.unsubscribe(a)})}sheetObject(n,a,t,i,c){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const l=this.sheet(n,c);if(l===void 0)return;const d=`${this.getSheetInstance(n,c)}_${a}`;let h=this.sheetObjects.get(d);h!==void 0?h=l.object(a,{...t,...h.value},{reconfigure:!0}):h=l.object(a,t),this.sheetObjects.set(d,h),this.sheetObjectCBs.set(d,i!==void 0?i:wt);const p=h.onValuesChange(m=>{if(this.app.editor){for(const w in m){const A=m[w];typeof A=="object"&&nn(A)&&(m[w]={r:A.r,g:A.g,b:A.b,a:A.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:d,values:m}})}const y=this.sheetObjectCBs.get(d);y!==void 0&&y(m)});return this.sheetObjectUnsubscribe.set(d,p),h}unsubscribe(n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const a=n.address.sheetId,t=n.address.objectKey;this.sheets.get(a)?.detachObject(t);const c=`${a}_${t}`,l=this.sheetObjectUnsubscribe.get(c);l!==void 0&&(this.sheetObjects.delete(c),this.sheetObjectCBs.delete(c),this.sheetObjectUnsubscribe.delete(c),l())}handleApp(n,a,t){const i=a;let c;switch(t.event){case"setSheet":c=i.sheets.get(t.data.sheet),c!==void 0&&(i.activeSheet=c,this.studio?.setSelection([c]));break;case"setSheetObject":c=i.sheetObjects.get(`${t.data.sheet}_${t.data.key}`),c!==void 0&&this.studio?.setSelection([c]);break;case"updateSheetObject":c=i.sheets.get(t.data.sheet),c!==void 0&&c.sequence.pause(),c=i.sheetObjectCBs.get(t.data.sheetObject),c!==void 0&&c(t.data.values);break;case"updateTimeline":c=i.sheets.get(t.data.sheet),i.activeSheet!==void 0&&(i.activeSheet.sequence.position=t.data.position);break}}handleEditor(n,a,t){if(n.editor){const i=a;switch(t.event){case"playSheet":i.sheet(t.data.sheet,t.data.instance)?.sequence.play(t.data.value);break;case"pauseSheet":i.sheet(t.data.sheet,t.data.instance)?.sequence.pause();break}}}handleEditorApp(n,a){if(n.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(l=>{l.length<1||l.forEach(r=>{let d=r.address.sheetId,h="setSheet",p={};switch(r.type){case"Theatre_Sheet_PublicAPI":h="setSheet",p={sheet:r.address.sheetId},a.activeSheet=a.sheets.get(r.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",d+=`_${r.address.objectKey}`,p={id:d,sheet:r.address.sheetId,key:r.address.objectKey},a.activeSheet=a.sheets.get(r.address.sheetId);break}n.send({event:h,target:"app",data:p})})});let t=-1;const i=()=>{if(Mt.rafDriver?.tick(performance.now()),a.activeSheet!==void 0&&t!==a.activeSheet.sequence.position){t=a.activeSheet.sequence.position;const l=a.activeSheet;n.send({event:"updateTimeline",target:"app",data:{position:t,sheet:l.address.sheetId}})}},c=()=>{i(),requestAnimationFrame(c)};i(),c()}else this.studio?.ui.hide()}}function On(e,n,a){if(e.editor){a.ui.restore(),a.onSelectionChange(l=>{l.length<1||l.forEach(r=>{let d=r.address.sheetId,h="setSheet",p={};switch(r.type){case"Theatre_Sheet_PublicAPI":h="setSheet",p={sheet:r.address.sheetId},n.activeSheet=n.sheets.get(r.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",d+=`_${r.address.objectKey}`,p={id:d,sheet:r.address.sheetId,key:r.address.objectKey},n.activeSheet=n.sheets.get(r.address.sheetId);break}e.send({event:h,target:"app",data:p})})});let t=-1;const i=()=>{if(Mt.rafDriver?.tick(performance.now()),n.activeSheet!==void 0&&t!==n.activeSheet.sequence.position){t=n.activeSheet.sequence.position;const l=n.activeSheet;e.send({event:"updateTimeline",target:"app",data:{position:t,sheet:l.address.sheetId}})}},c=()=>{i(),requestAnimationFrame(c)};i(),c()}else a.ui.hide()}function Tn(e){if(e.name==="cameras")return"camera";if(e.name==="interactive")return"interactive";if(e.name==="lights")return"light";if(e.name==="ui")return"ui";if(e.name==="utils")return"utils";const n=e.type;return n.search("Helper")>-1?"icon_utils":n.search("Camera")>-1?"camera":n.search("Light")>-1?"light":"obj3D"}function Et(e){const n={name:e.name,type:e.type,uuid:e.uuid,children:[]};return e.children.forEach(a=>{n.children.push(Et(a))}),n}function Rn(e){const n={};for(const a in e){const t=e[a].value;n[a]={value:t},t===null?n[a].value={src:""}:t.isTexture&&(n[a].value={src:t.image.src})}return n}function _n(e){switch(e){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Je(e){const n={};for(const a in e){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||_n(a))continue;const t=typeof e[a],i=e[a];switch(t){case"boolean":case"number":case"string":n[a]=i;break;case"object":if(i!==null)if(n[a]=i,i.isTexture)if(i instanceof f.Texture){const c=i.source.toJSON();n[a]={src:c.url}}else i instanceof f.CubeTexture&&(console.log("env map"),console.log(i.source.data),console.log(i.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Rn(n[a]));else n[a]={src:""};break}}return n}function kt(e){e.updateMatrix();const n={name:e.name,type:e.type,uuid:e.uuid,visible:e.visible,matrix:e.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};e.animations.forEach(t=>{n.animations.push({name:t.name,duration:t.duration,blendMode:t.blendMode})});const a=e.type.toLowerCase();if(a.search("mesh")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(c=>{i.push(Je(c))}),n.material=i}else n.material=Je(t.material)}else if(a.search("points")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(c=>{i.push(Je(c))}),n.material=i}else n.material=Je(t.material)}else if(a.search("line")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(c=>{i.push(Je(c))}),n.material=i}else n.material=Je(t.material)}else a.search("camera")>-1?e.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:e.fov,zoom:e.zoom,near:e.near,far:e.far,focus:e.focus,aspect:e.aspect,filmGauge:e.filmGauge,filmOffset:e.filmOffset}:e.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:e.zoom,near:e.near,far:e.far,left:e.left,right:e.right,top:e.top,bottom:e.bottom}):a.search("light")>-1&&(n.lightInfo={color:e.color,intensity:e.intensity,decay:e.decay,distance:e.distance,angle:e.angle,penumbra:e.penumbra,groundColor:e.groundColor,width:e.width,height:e.height});return n}function Dn(e,n){const a=n.split(".");switch(a.length){case 1:return e[a[0]];case 2:return e[a[0]][a[1]];case 3:return e[a[0]][a[1]][a[2]];case 4:return e[a[0]][a[1]][a[2]][a[3]];case 5:return e[a[0]][a[1]][a[2]][a[3]][a[4]];case 6:return e[a[0]][a[1]][a[2]][a[3]][a[4]][a[5]]}}function kn(e,n){for(const a in n)e[a]=n[a]}function q(e,n,a){const t=n.split("."),i=t.length;if(typeof a!="object")switch(i){case 1:e[t[0]]=a;break;case 2:e[t[0]][t[1]]=a;break;case 3:e[t[0]][t[1]][t[2]]=a;break;case 4:e[t[0]][t[1]][t[2]][t[3]]=a;break;case 5:e[t[0]][t[1]][t[2]][t[3]][t[4]]=a;break}else{let l;switch(i){case 1:l=e[t[0]];break;case 2:l=e[t[0]][t[1]];break;case 3:l=e[t[0]][t[1]][t[2]];break;case 4:l=e[t[0]][t[1]][t[2]][t[3]];break;case 5:l=e[t[0]][t[1]][t[2]][t[3]][t[4]];break}l!=null&&kn(l,a)}}function sn(e){return new Promise((n,a)=>{const t=new Image;t.onload=()=>{const i=new f.Texture(t);i.wrapS=f.RepeatWrapping,i.wrapT=f.RepeatWrapping,i.needsUpdate=!0,n(i)},t.onerror=a,t.src=e})}class Pn extends lt{scene=void 0;scenes=new Map;renderer=void 0;renderTargets=new Map;dispose(){this.scenes.forEach(n=>{et(n)}),this.scenes.clear(),this.scene&&et(this.scene),this.renderTargets.forEach(n=>{n.dispose()}),this.renderTargets.clear(),this.renderer?.dispose()}getObject(n){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:n})}setObject(n){const a=kt(n);this.app.send({event:"setObject",target:"editor",data:a})}requestMethod(n,a,t,i){this.app.send({event:"requestMethod",target:"app",data:{uuid:n,key:a,value:t,subitem:i}})}updateObject(n,a,t){this.app.send({event:"updateObject",target:"app",data:{uuid:n,key:a,value:t}})}createTexture(n,a,t){this.app.send({event:"createTexture",target:"app",data:{uuid:n,key:a,value:t}})}addScene(n){if(n===void 0||(this.scenes.set(n.name,n),!this.app.debugEnabled))return;Lt(),Ct(n);const a=Et(n);this.app.send({event:"addScene",target:"editor",data:a})}removeScene(n){if(n===void 0)return;const a=n.name,t=this.scenes.get(a);if(this.scenes.delete(n.name),et(t),!this.app.debugEnabled)return;const i=Et(n);this.app.send({event:"removeScene",target:"editor",data:i})}removeAllScenes(){this.scenes.forEach(n=>this.removeScene(n))}getScene(n){let a=null;return this.scenes.forEach(t=>{n.search(t.uuid)>-1&&(a=t)}),a}setScene(n){if(n===void 0||(this.scene=n,!this.app.debugEnabled))return;Lt(),Ct(n);const a=Et(n);this.app.send({event:"setScene",target:"editor",data:a})}addCamera(n){if(!this.app.debugEnabled)return;const a=kt(n);this.app.send({event:"addCamera",target:"editor",data:a})}removeCamera(n){if(!this.app.debugEnabled)return;const a=kt(n);this.app.send({event:"removeCamera",target:"editor",data:a})}handleApp(n,a,t){switch(t.event){case"getObject":k.dispatchEvent({type:P.GET_OBJECT,value:t.data});break;case"updateObject":k.dispatchEvent({type:P.UPDATE_OBJECT,value:t.data});break;case"createTexture":k.dispatchEvent({type:P.CREATE_TEXTURE,value:t.data});break;case"requestMethod":k.dispatchEvent({type:P.REQUEST_METHOD,value:t.data});break}}handleEditor(n,a,t){switch(t.event){case"setObject":k.dispatchEvent({type:P.SET_OBJECT,value:t.data});break;case"addScene":k.dispatchEvent({type:P.ADD_SCENE,value:t.data});break;case"removeScene":k.dispatchEvent({type:P.REMOVE_SCENE,value:t.data});break;case"setScene":k.dispatchEvent({type:P.SET_SCENE,value:t.data});break;case"addCamera":k.dispatchEvent({type:P.ADD_CAMERA,value:t.data});break;case"removeCamera":k.dispatchEvent({type:P.REMOVE_CAMERA,value:t.data});break}}rendererWidth=300;rendererHeight=150;addRT(n,a){const t=new f.WebGLRenderTarget(32,32,a);t.texture.name=n,this.renderTargets.set(n,t)}resize(n,a){const t=this.dpr;this.rendererWidth=n,this.rendererHeight=a,this.renderTargets.forEach(i=>{i.setSize(n*t,a*t)}),this.renderer?.setSize(n,a)}set dpr(n){this.renderer?.setPixelRatio(Ve(1,2,n))}get dpr(){return this.renderer!==void 0?this.renderer?.getPixelRatio():1}get width(){return this.rendererWidth}get height(){return this.rendererHeight}get canvas(){return this.renderer!==void 0?this.renderer?.domElement:null}}class An extends lt{bindCBs;buttonCBs;pane=void 0;appCallbacks=0;editorCallbacks=0;inspectorFolder=void 0;constructor(n){super(n),this.bindCBs=new Map,this.buttonCBs=new Map,n.editor&&this.createGUI()}createGUI(){this.pane=new vn.Pane({title:"GUI"}),this.pane.registerPlugin(En)}dispose(){this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&(this.pane?.dispose(),this.pane=void 0)}addFolder(n,a=void 0,t=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(t!==void 0?t:this.pane).addFolder({title:n,...a});this.app.send({event:"addFolder",target:"app",data:{name:n,params:a,parent:t}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(n,a,t,i=void 0){const c=this.bindID,l=t.onChange!==void 0?t.onChange:wt;this.bindCBs.set(c,l),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.pane).addBinding(n,a,t).on("change",d=>{this.app.send({event:"updateBind",target:"app",data:{id:c,value:d.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:c,name:a,params:t,parent:i}}),this.appCallbacks++)}triggerBind(n,a){const t=this.bindCBs.get(n);t!==void 0?t(a):console.warn(`No callback for: ${n}`,a)}button(n,a,t=void 0){const i=this.bindID;this.buttonCBs.set(i,a),this.app.editor?(this.pane===void 0&&this.createGUI(),(t!==void 0?t:this.pane).addButton({title:n}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:i}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:i,name:n,callback:a,parent:t}}),this.appCallbacks++)}triggerButton(n){const a=this.buttonCBs.get(n);a!==void 0&&a()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const n=this.inspectorFolder.children.length-1;for(let a=n;a>-1;--a)this.inspectorFolder.remove(this.inspectorFolder.children[a])}handleApp(n,a,t){const i=a;switch(t.event){case"addFolder":i.addFolder(t.data.name,t.data.params,t.data.parent);break;case"bindObject":i.bind(t.data.name,t.data.params,t.data.parent);break;case"updateBind":i.triggerBind(t.data.id,t.data.value);break;case"addButton":i.button(t.data.name,t.data.callback,t.data.parent);break;case"clickButton":i.triggerButton(t.data.id);break}}}var Ft={exports:{}},it={};/**
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("three"),vn=require("tweakpane"),bn=require("@tweakpane/plugin-essentials"),E=require("react"),en=require("framer-motion");function yn(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,t.get?t:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const En=yn(bn),wt=()=>{},Sn=()=>{};function ct(e){return e.substring(0,1).toUpperCase()+e.substring(1)}function Ve(e,n,a){return Math.min(n,Math.max(e,a))}function jt(e,n,a){return(a-e)/(n-e)}function It(e,n,a){return e*(1-a)+n*a}function xn(e,n){const a=e-n;return Math.sqrt(a*a)}function tn(){return Math.round(Math.random()*1e6).toString()}function nn(e){return e.r!==void 0&&e.g!==void 0&&e.b!==void 0}function an(e){const n=Math.round(e.r*255),a=Math.round(e.g*255),t=Math.round(e.b*255),i=d=>{const h=d.toString(16);return h.length===1?"0"+h:h},c=i(n),l=i(a),r=i(t);return"#"+c+l+r}function Nt(e,n=1){return Number(e.toFixed(n))}exports.totalThreeObjects=0;const Lt=()=>{exports.totalThreeObjects=0},Ct=e=>{if(!e)return;let n=e.name.replace(" ","");n.length===0&&(n=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),e.parent!==null&&e.parent.uuid.length>0&&(n=`${e.parent.uuid}.${n}`),e.uuid=n,e.children.forEach(a=>{Ct(a)})},Cn=e=>{e?.dispose()},rn=e=>{e&&(Array.isArray(e)?e.forEach(n=>n.dispose()):e.dispose())},et=e=>{if(e){for(;e.children.length>0;){const n=e.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):et(n)}if(e.parent&&e.parent.remove(e),e.isMesh){const n=e;n.geometry?.dispose(),rn(n.material)}e.dispose!==void 0&&e.dispose()}};class wn{components=new Map;listen;_appID="";_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(n,a,t=!0){this._appID=n,this._debugEnabled=a,a&&(this._useBC=t,t?(this._broadcastChannel=new BroadcastChannel(n),this._broadcastChannel.addEventListener("message",this.messageHandler)):(this._webSocket=new WebSocket(n),this._webSocket.addEventListener("open",this.openHandler),this._webSocket.addEventListener("close",this.closeHandler),this._webSocket.addEventListener("message",this.messageHandler)))}addComponent(n,a){this.components.set(n,a)}dispose(){this._broadcastChannel!==void 0&&this._broadcastChannel.removeEventListener("message",this.messageHandler),this._webSocket!==void 0&&(this._webSocket.removeEventListener("open",this.openHandler),this._webSocket.removeEventListener("close",this.closeHandler),this._webSocket.removeEventListener("message",this.messageHandler)),this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){this._mode!==n.target&&(this._useBC?this._broadcastChannel?.postMessage(n):this._connected&&this._webSocket?.send(JSON.stringify(n)))}messageHandler=n=>{this.listen!==void 0&&(this._useBC?this.listen(n.data):this.listen(JSON.parse(n.data)))};openHandler=()=>{this._connected=!0};closeHandler=()=>{this._connected=!1};get appID(){return this._appID}get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor")}}const D=new f.EventDispatcher,P={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",ADD_SCENE:"ToolEvents::addScene",REMOVE_SCENE:"ToolEvents::removeScene",SET_SCENE:"ToolEvents::setScene",GET_OBJECT:"ToolEvents::getObject",SET_OBJECT:"ToolEvents::setObject",UPDATE_OBJECT:"ToolEvents::updateObject",CREATE_TEXTURE:"ToolEvents::createTexture",REQUEST_METHOD:"ToolEvents::requestMethod",ADD_CAMERA:"ToolEvents::addCamera",REMOVE_CAMERA:"ToolEvents::removeCamera"};class lt{app;constructor(n){this.app=n}dispose(){}handleApp(n,a,t){}handleEditor(n,a,t){}}class Mn extends lt{selectDropdown(n,a){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:a}})}updateDropdown(n,a){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:a}})}handleApp(n,a,t){switch(t.event){case"selectComponent":D.dispatchEvent({type:P.SELECT_DROPDOWN,value:t.data});break;case"draggableListUpdate":D.dispatchEvent({type:P.DRAG_UPDATE,value:t.data});break}}}class Mt extends lt{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;static rafDriver=void 0;dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}getSheetInstance(n,a){return a!==void 0?`${n}-${a}`:n}sheet(n,a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const t=this.getSheetInstance(n,a);let i=this.sheets.get(t);return i!==void 0||(i=this.project?.sheet(n,a),this.sheets.set(t,i)),i}playSheet(n,a,t){this.sheet(n,t)?.sequence.play(a),this.app.send({event:"playSheet",target:"editor",data:{sheet:n,instance:t,value:a}})}pauseSheet(n,a){this.sheet(n)?.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:n,instance:a}})}clearSheetObjects(n){this.sheetObjects.forEach((a,t)=>{t.search(`${n}_`)>-1&&this.unsubscribe(a)})}sheetObject(n,a,t,i,c){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const l=this.sheet(n,c);if(l===void 0)return;const d=`${this.getSheetInstance(n,c)}_${a}`;let h=this.sheetObjects.get(d);h!==void 0?h=l.object(a,{...t,...h.value},{reconfigure:!0}):h=l.object(a,t),this.sheetObjects.set(d,h),this.sheetObjectCBs.set(d,i!==void 0?i:wt);const p=h.onValuesChange(m=>{if(this.app.editor){for(const w in m){const j=m[w];typeof j=="object"&&nn(j)&&(m[w]={r:j.r,g:j.g,b:j.b,a:j.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:d,values:m}})}const v=this.sheetObjectCBs.get(d);v!==void 0&&v(m)});return this.sheetObjectUnsubscribe.set(d,p),h}unsubscribe(n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const a=n.address.sheetId,t=n.address.objectKey;this.sheets.get(a)?.detachObject(t);const c=`${a}_${t}`,l=this.sheetObjectUnsubscribe.get(c);l!==void 0&&(this.sheetObjects.delete(c),this.sheetObjectCBs.delete(c),this.sheetObjectUnsubscribe.delete(c),l())}handleApp(n,a,t){const i=a;let c;switch(t.event){case"setSheet":c=i.sheets.get(t.data.sheet),c!==void 0&&(i.activeSheet=c,this.studio?.setSelection([c]));break;case"setSheetObject":c=i.sheetObjects.get(`${t.data.sheet}_${t.data.key}`),c!==void 0&&this.studio?.setSelection([c]);break;case"updateSheetObject":c=i.sheets.get(t.data.sheet),c!==void 0&&c.sequence.pause(),c=i.sheetObjectCBs.get(t.data.sheetObject),c!==void 0&&c(t.data.values);break;case"updateTimeline":c=i.sheets.get(t.data.sheet),i.activeSheet!==void 0&&(i.activeSheet.sequence.position=t.data.position);break}}handleEditor(n,a,t){if(n.editor){const i=a;switch(t.event){case"playSheet":i.sheet(t.data.sheet,t.data.instance)?.sequence.play(t.data.value);break;case"pauseSheet":i.sheet(t.data.sheet,t.data.instance)?.sequence.pause();break}}}handleEditorApp(n,a){if(n.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(l=>{l.length<1||l.forEach(r=>{let d=r.address.sheetId,h="setSheet",p={};switch(r.type){case"Theatre_Sheet_PublicAPI":h="setSheet",p={sheet:r.address.sheetId},a.activeSheet=a.sheets.get(r.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",d+=`_${r.address.objectKey}`,p={id:d,sheet:r.address.sheetId,key:r.address.objectKey},a.activeSheet=a.sheets.get(r.address.sheetId);break}n.send({event:h,target:"app",data:p})})});let t=-1;const i=()=>{if(Mt.rafDriver?.tick(performance.now()),a.activeSheet!==void 0&&t!==a.activeSheet.sequence.position){t=a.activeSheet.sequence.position;const l=a.activeSheet;n.send({event:"updateTimeline",target:"app",data:{position:t,sheet:l.address.sheetId}})}},c=()=>{i(),requestAnimationFrame(c)};i(),c()}else this.studio?.ui.hide()}}function On(e,n,a){if(e.editor){a.ui.restore(),a.onSelectionChange(l=>{l.length<1||l.forEach(r=>{let d=r.address.sheetId,h="setSheet",p={};switch(r.type){case"Theatre_Sheet_PublicAPI":h="setSheet",p={sheet:r.address.sheetId},n.activeSheet=n.sheets.get(r.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",d+=`_${r.address.objectKey}`,p={id:d,sheet:r.address.sheetId,key:r.address.objectKey},n.activeSheet=n.sheets.get(r.address.sheetId);break}e.send({event:h,target:"app",data:p})})});let t=-1;const i=()=>{if(Mt.rafDriver?.tick(performance.now()),n.activeSheet!==void 0&&t!==n.activeSheet.sequence.position){t=n.activeSheet.sequence.position;const l=n.activeSheet;e.send({event:"updateTimeline",target:"app",data:{position:t,sheet:l.address.sheetId}})}},c=()=>{i(),requestAnimationFrame(c)};i(),c()}else a.ui.hide()}function Tn(e){if(e.name==="cameras")return"camera";if(e.name==="interactive")return"interactive";if(e.name==="lights")return"light";if(e.name==="ui")return"ui";if(e.name==="utils")return"utils";const n=e.type;return n.search("Helper")>-1?"icon_utils":n.search("Camera")>-1?"camera":n.search("Light")>-1?"light":"obj3D"}function Et(e){const n={name:e.name,type:e.type,uuid:e.uuid,children:[]};return e.children.forEach(a=>{n.children.push(Et(a))}),n}function Rn(e){const n={};for(const a in e){const t=e[a].value;n[a]={value:t},t===null?n[a].value={src:""}:t.isTexture&&(n[a].value={src:t.image.src})}return n}function _n(e){switch(e){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Je(e){const n={};for(const a in e){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||_n(a))continue;const t=typeof e[a],i=e[a];switch(t){case"boolean":case"number":case"string":n[a]=i;break;case"object":if(i!==null)if(n[a]=i,i.isTexture)if(i instanceof f.Texture){const c=i.source.toJSON();n[a]={src:c.url}}else i instanceof f.CubeTexture&&(console.log("env map"),console.log(i.source.data),console.log(i.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Rn(n[a]));else n[a]={src:""};break}}return n}function Dt(e){e.updateMatrix();const n={name:e.name,type:e.type,uuid:e.uuid,visible:e.visible,matrix:e.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};e.animations.forEach(t=>{n.animations.push({name:t.name,duration:t.duration,blendMode:t.blendMode})});const a=e.type.toLowerCase();if(a.search("mesh")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(c=>{i.push(Je(c))}),n.material=i}else n.material=Je(t.material)}else if(a.search("points")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(c=>{i.push(Je(c))}),n.material=i}else n.material=Je(t.material)}else if(a.search("line")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(c=>{i.push(Je(c))}),n.material=i}else n.material=Je(t.material)}else a.search("camera")>-1?e.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:e.fov,zoom:e.zoom,near:e.near,far:e.far,focus:e.focus,aspect:e.aspect,filmGauge:e.filmGauge,filmOffset:e.filmOffset}:e.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:e.zoom,near:e.near,far:e.far,left:e.left,right:e.right,top:e.top,bottom:e.bottom}):a.search("light")>-1&&(n.lightInfo={color:e.color,intensity:e.intensity,decay:e.decay,distance:e.distance,angle:e.angle,penumbra:e.penumbra,groundColor:e.groundColor,width:e.width,height:e.height});return n}function kn(e,n){const a=n.split(".");switch(a.length){case 1:return e[a[0]];case 2:return e[a[0]][a[1]];case 3:return e[a[0]][a[1]][a[2]];case 4:return e[a[0]][a[1]][a[2]][a[3]];case 5:return e[a[0]][a[1]][a[2]][a[3]][a[4]];case 6:return e[a[0]][a[1]][a[2]][a[3]][a[4]][a[5]]}}function Dn(e,n){for(const a in n)e[a]=n[a]}function J(e,n,a){const t=n.split("."),i=t.length;if(typeof a!="object")switch(i){case 1:e[t[0]]=a;break;case 2:e[t[0]][t[1]]=a;break;case 3:e[t[0]][t[1]][t[2]]=a;break;case 4:e[t[0]][t[1]][t[2]][t[3]]=a;break;case 5:e[t[0]][t[1]][t[2]][t[3]][t[4]]=a;break}else{let l;switch(i){case 1:l=e[t[0]];break;case 2:l=e[t[0]][t[1]];break;case 3:l=e[t[0]][t[1]][t[2]];break;case 4:l=e[t[0]][t[1]][t[2]][t[3]];break;case 5:l=e[t[0]][t[1]][t[2]][t[3]][t[4]];break}l!=null&&Dn(l,a)}}function sn(e){return new Promise((n,a)=>{const t=new Image;t.onload=()=>{const i=new f.Texture(t);i.wrapS=f.RepeatWrapping,i.wrapT=f.RepeatWrapping,i.needsUpdate=!0,n(i)},t.onerror=a,t.src=e})}class Pn extends lt{scene=void 0;scenes=new Map;renderer=void 0;renderTargets=new Map;dispose(){this.scenes.forEach(n=>{et(n)}),this.scenes.clear(),this.scene&&et(this.scene),this.renderTargets.forEach(n=>{n.dispose()}),this.renderTargets.clear(),this.renderer?.dispose()}getObject(n){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:n})}setObject(n){const a=Dt(n);this.app.send({event:"setObject",target:"editor",data:a})}requestMethod(n,a,t,i){this.app.send({event:"requestMethod",target:"app",data:{uuid:n,key:a,value:t,subitem:i}})}updateObject(n,a,t){this.app.send({event:"updateObject",target:"app",data:{uuid:n,key:a,value:t}})}createTexture(n,a,t){this.app.send({event:"createTexture",target:"app",data:{uuid:n,key:a,value:t}})}addScene(n){if(n===void 0||(this.scenes.set(n.name,n),!this.app.debugEnabled))return;Lt(),Ct(n);const a=Et(n);this.app.send({event:"addScene",target:"editor",data:a})}removeScene(n){if(n===void 0)return;const a=n.name,t=this.scenes.get(a);if(this.scenes.delete(n.name),et(t),!this.app.debugEnabled)return;const i=Et(n);this.app.send({event:"removeScene",target:"editor",data:i})}removeAllScenes(){this.scenes.forEach(n=>this.removeScene(n))}getScene(n){let a=null;return this.scenes.forEach(t=>{n.search(t.uuid)>-1&&(a=t)}),a}setScene(n){if(n===void 0||(this.scene=n,!this.app.debugEnabled))return;Lt(),Ct(n);const a=Et(n);this.app.send({event:"setScene",target:"editor",data:a})}addCamera(n){if(!this.app.debugEnabled)return;const a=Dt(n);this.app.send({event:"addCamera",target:"editor",data:a})}removeCamera(n){if(!this.app.debugEnabled)return;const a=Dt(n);this.app.send({event:"removeCamera",target:"editor",data:a})}handleApp(n,a,t){switch(t.event){case"getObject":D.dispatchEvent({type:P.GET_OBJECT,value:t.data});break;case"updateObject":D.dispatchEvent({type:P.UPDATE_OBJECT,value:t.data});break;case"createTexture":D.dispatchEvent({type:P.CREATE_TEXTURE,value:t.data});break;case"requestMethod":D.dispatchEvent({type:P.REQUEST_METHOD,value:t.data});break}}handleEditor(n,a,t){switch(t.event){case"setObject":D.dispatchEvent({type:P.SET_OBJECT,value:t.data});break;case"addScene":D.dispatchEvent({type:P.ADD_SCENE,value:t.data});break;case"removeScene":D.dispatchEvent({type:P.REMOVE_SCENE,value:t.data});break;case"setScene":D.dispatchEvent({type:P.SET_SCENE,value:t.data});break;case"addCamera":D.dispatchEvent({type:P.ADD_CAMERA,value:t.data});break;case"removeCamera":D.dispatchEvent({type:P.REMOVE_CAMERA,value:t.data});break}}rendererWidth=300;rendererHeight=150;addRT(n,a){const t=new f.WebGLRenderTarget(32,32,a);t.texture.name=n,this.renderTargets.set(n,t)}resize(n,a){const t=this.dpr;this.rendererWidth=n,this.rendererHeight=a,this.renderTargets.forEach(i=>{i.setSize(n*t,a*t)}),this.renderer?.setSize(n,a)}set dpr(n){this.renderer?.setPixelRatio(Ve(1,2,n))}get dpr(){return this.renderer!==void 0?this.renderer?.getPixelRatio():1}get width(){return this.rendererWidth}get height(){return this.rendererHeight}get canvas(){return this.renderer!==void 0?this.renderer?.domElement:null}}class An extends lt{bindCBs;buttonCBs;pane=void 0;appCallbacks=0;editorCallbacks=0;inspectorFolder=void 0;constructor(n){super(n),this.bindCBs=new Map,this.buttonCBs=new Map,n.editor&&this.createGUI()}createGUI(){this.pane=new vn.Pane({title:"GUI"}),this.pane.registerPlugin(En)}dispose(){this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&(this.pane?.dispose(),this.pane=void 0)}addFolder(n,a=void 0,t=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(t!==void 0?t:this.pane).addFolder({title:n,...a});this.app.send({event:"addFolder",target:"app",data:{name:n,params:a,parent:t}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(n,a,t,i=void 0){const c=this.bindID,l=t.onChange!==void 0?t.onChange:wt;this.bindCBs.set(c,l),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.pane).addBinding(n,a,t).on("change",d=>{this.app.send({event:"updateBind",target:"app",data:{id:c,value:d.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:c,name:a,params:t,parent:i}}),this.appCallbacks++)}triggerBind(n,a){const t=this.bindCBs.get(n);t!==void 0?t(a):console.warn(`No callback for: ${n}`,a)}button(n,a,t=void 0){const i=this.bindID;this.buttonCBs.set(i,a),this.app.editor?(this.pane===void 0&&this.createGUI(),(t!==void 0?t:this.pane).addButton({title:n}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:i}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:i,name:n,callback:a,parent:t}}),this.appCallbacks++)}triggerButton(n){const a=this.buttonCBs.get(n);a!==void 0&&a()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const n=this.inspectorFolder.children.length-1;for(let a=n;a>-1;--a)this.inspectorFolder.remove(this.inspectorFolder.children[a])}handleApp(n,a,t){const i=a;switch(t.event){case"addFolder":i.addFolder(t.data.name,t.data.params,t.data.parent);break;case"bindObject":i.bind(t.data.name,t.data.params,t.data.parent);break;case"updateBind":i.triggerBind(t.data.id,t.data.value);break;case"addButton":i.button(t.data.name,t.data.callback,t.data.parent);break;case"clickButton":i.triggerButton(t.data.id);break}}}var Ft={exports:{}},it={};/**
|
2
2
|
* @license React
|
3
3
|
* react-jsx-runtime.production.min.js
|
4
4
|
*
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*
|
7
7
|
* This source code is licensed under the MIT license found in the
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/var Wt;function jn(){if(Wt)return it;Wt=1;var e=E,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(r,d,h){var p,m={},
|
9
|
+
*/var Wt;function jn(){if(Wt)return it;Wt=1;var e=E,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(r,d,h){var p,m={},v=null,w=null;h!==void 0&&(v=""+h),d.key!==void 0&&(v=""+d.key),d.ref!==void 0&&(w=d.ref);for(p in d)t.call(d,p)&&!c.hasOwnProperty(p)&&(m[p]=d[p]);if(r&&r.defaultProps)for(p in d=r.defaultProps,d)m[p]===void 0&&(m[p]=d[p]);return{$$typeof:n,type:r,key:v,ref:w,props:m,_owner:i.current}}return it.Fragment=a,it.jsx=l,it.jsxs=l,it}var rt={};/**
|
10
10
|
* @license React
|
11
11
|
* react-jsx-runtime.development.js
|
12
12
|
*
|
@@ -14,20 +14,20 @@
|
|
14
14
|
*
|
15
15
|
* This source code is licensed under the MIT license found in the
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
17
|
-
*/var $t;function In(){return $t||($t=1,process.env.NODE_ENV!=="production"&&function(){var e=E,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),r=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),
|
18
|
-
`+Ge+s}}var
|
19
|
-
`),
|
20
|
-
`),
|
21
|
-
`+
|
17
|
+
*/var $t;function In(){return $t||($t=1,process.env.NODE_ENV!=="production"&&function(){var e=E,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),r=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),j=Symbol.iterator,q="@@iterator";function Q(s){if(s===null||typeof s!="object")return null;var g=j&&s[j]||s[q];return typeof g=="function"?g:null}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function G(s){{for(var g=arguments.length,S=new Array(g>1?g-1:0),O=1;O<g;O++)S[O-1]=arguments[O];U("error",s,S)}}function U(s,g,S){{var O=I.ReactDebugCurrentFrame,V=O.getStackAddendum();V!==""&&(g+="%s",S=S.concat([V]));var W=S.map(function(L){return String(L)});W.unshift("Warning: "+g),Function.prototype.apply.call(console[s],console,W)}}var Z=!1,ae=!1,Ee=!1,$=!1,he=!1,se;se=Symbol.for("react.module.reference");function Me(s){return!!(typeof s=="string"||typeof s=="function"||s===t||s===c||he||s===i||s===h||s===p||$||s===w||Z||ae||Ee||typeof s=="object"&&s!==null&&(s.$$typeof===v||s.$$typeof===m||s.$$typeof===l||s.$$typeof===r||s.$$typeof===d||s.$$typeof===se||s.getModuleId!==void 0))}function Oe(s,g,S){var O=s.displayName;if(O)return O;var V=g.displayName||g.name||"";return V!==""?S+"("+V+")":S}function me(s){return s.displayName||"Context"}function B(s){if(s==null)return null;if(typeof s.tag=="number"&&G("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case t:return"Fragment";case a:return"Portal";case c:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case r:var g=s;return me(g)+".Consumer";case l:var S=s;return me(S._context)+".Provider";case d:return Oe(s,s.render,"ForwardRef");case m:var O=s.displayName||null;return O!==null?O:B(s.type)||"Memo";case v:{var V=s,W=V._payload,L=V._init;try{return B(L(W))}catch{return null}}}return null}var pe=Object.assign,R=0,Se,Te,ke,Re,_e,De,je;function Ie(){}Ie.__reactDisabledLog=!0;function ie(){{if(R===0){Se=console.log,Te=console.info,ke=console.warn,Re=console.error,_e=console.group,De=console.groupCollapsed,je=console.groupEnd;var s={configurable:!0,enumerable:!0,value:Ie,writable:!0};Object.defineProperties(console,{info:s,log:s,warn:s,error:s,group:s,groupCollapsed:s,groupEnd:s})}R++}}function xe(){{if(R--,R===0){var s={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:pe({},s,{value:Se}),info:pe({},s,{value:Te}),warn:pe({},s,{value:ke}),error:pe({},s,{value:Re}),group:pe({},s,{value:_e}),groupCollapsed:pe({},s,{value:De}),groupEnd:pe({},s,{value:je})})}R<0&&G("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ze=I.ReactCurrentDispatcher,Ge;function ce(s,g,S){{if(Ge===void 0)try{throw Error()}catch(V){var O=V.stack.trim().match(/\n( *(at )?)/);Ge=O&&O[1]||""}return`
|
18
|
+
`+Ge+s}}var b=!1,y;{var T=typeof WeakMap=="function"?WeakMap:Map;y=new T}function N(s,g){if(!s||b)return"";{var S=y.get(s);if(S!==void 0)return S}var O;b=!0;var V=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=ze.current,ze.current=null,ie();try{if(g){var L=function(){throw Error()};if(Object.defineProperty(L.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(L,[])}catch(Ae){O=Ae}Reflect.construct(s,[],L)}else{try{L.call()}catch(Ae){O=Ae}s.call(L.prototype)}}else{try{throw Error()}catch(Ae){O=Ae}s()}}catch(Ae){if(Ae&&O&&typeof Ae.stack=="string"){for(var A=Ae.stack.split(`
|
19
|
+
`),ue=O.stack.split(`
|
20
|
+
`),X=A.length-1,te=ue.length-1;X>=1&&te>=0&&A[X]!==ue[te];)te--;for(;X>=1&&te>=0;X--,te--)if(A[X]!==ue[te]){if(X!==1||te!==1)do if(X--,te--,te<0||A[X]!==ue[te]){var ye=`
|
21
|
+
`+A[X].replace(" at new "," at ");return s.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",s.displayName)),typeof s=="function"&&y.set(s,ye),ye}while(X>=1&&te>=0);break}}}finally{b=!1,ze.current=W,xe(),Error.prepareStackTrace=V}var Xe=s?s.displayName||s.name:"",Ht=Xe?ce(Xe):"";return typeof s=="function"&&y.set(s,Ht),Ht}function fe(s,g,S){return N(s,!1)}function oe(s){var g=s.prototype;return!!(g&&g.isReactComponent)}function M(s,g,S){if(s==null)return"";if(typeof s=="function")return N(s,oe(s));if(typeof s=="string")return ce(s);switch(s){case h:return ce("Suspense");case p:return ce("SuspenseList")}if(typeof s=="object")switch(s.$$typeof){case d:return fe(s.render);case m:return M(s.type,g,S);case v:{var O=s,V=O._payload,W=O._init;try{return M(W(V),g,S)}catch{}}}return""}var C=Object.prototype.hasOwnProperty,H={},ee=I.ReactDebugCurrentFrame;function _(s){if(s){var g=s._owner,S=M(s.type,s._source,g?g.type:null);ee.setExtraStackFrame(S)}else ee.setExtraStackFrame(null)}function z(s,g,S,O,V){{var W=Function.call.bind(C);for(var L in s)if(W(s,L)){var A=void 0;try{if(typeof s[L]!="function"){var ue=Error((O||"React class")+": "+S+" type `"+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[L]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ue.name="Invariant Violation",ue}A=s[L](g,L,O,S,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(X){A=X}A&&!(A instanceof Error)&&(_(V),G("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",O||"React class",S,L,typeof A),_(null)),A instanceof Error&&!(A.message in H)&&(H[A.message]=!0,_(V),G("Failed %s type: %s",S,A.message),_(null))}}}var Y=Array.isArray;function Pe(s){return Y(s)}function qe(s){{var g=typeof Symbol=="function"&&Symbol.toStringTag,S=g&&s[Symbol.toStringTag]||s.constructor.name||"Object";return S}}function ut(s){try{return dt(s),!1}catch{return!0}}function dt(s){return""+s}function tt(s){if(ut(s))return G("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(s)),dt(s)}var Ne=I.ReactCurrentOwner,nt={key:!0,ref:!0,__self:!0,__source:!0},at,ht,Ke;Ke={};function Rt(s){if(C.call(s,"ref")){var g=Object.getOwnPropertyDescriptor(s,"ref").get;if(g&&g.isReactWarning)return!1}return s.ref!==void 0}function _t(s){if(C.call(s,"key")){var g=Object.getOwnPropertyDescriptor(s,"key").get;if(g&&g.isReactWarning)return!1}return s.key!==void 0}function kt(s,g){if(typeof s.ref=="string"&&Ne.current&&g&&Ne.current.stateNode!==g){var S=B(Ne.current.type);Ke[S]||(G('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',B(Ne.current.type),s.ref),Ke[S]=!0)}}function ft(s,g){{var S=function(){at||(at=!0,G("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",g))};S.isReactWarning=!0,Object.defineProperty(s,"key",{get:S,configurable:!0})}}function Le(s,g){{var S=function(){ht||(ht=!0,G("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",g))};S.isReactWarning=!0,Object.defineProperty(s,"ref",{get:S,configurable:!0})}}var zt=function(s,g,S,O,V,W,L){var A={$$typeof:n,type:s,key:g,ref:S,props:L,_owner:W};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:V}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function o(s,g,S,O,V){{var W,L={},A=null,ue=null;S!==void 0&&(tt(S),A=""+S),_t(g)&&(tt(g.key),A=""+g.key),Rt(g)&&(ue=g.ref,kt(g,V));for(W in g)C.call(g,W)&&!nt.hasOwnProperty(W)&&(L[W]=g[W]);if(s&&s.defaultProps){var X=s.defaultProps;for(W in X)L[W]===void 0&&(L[W]=X[W])}if(A||ue){var te=typeof s=="function"?s.displayName||s.name||"Unknown":s;A&&ft(L,te),ue&&Le(L,te)}return zt(s,A,ue,V,O,Ne.current,L)}}var x=I.ReactCurrentOwner,k=I.ReactDebugCurrentFrame;function F(s){if(s){var g=s._owner,S=M(s.type,s._source,g?g.type:null);k.setExtraStackFrame(S)}else k.setExtraStackFrame(null)}var ne;ne=!1;function ge(s){return typeof s=="object"&&s!==null&&s.$$typeof===n}function le(){{if(x.current){var s=B(x.current.type);if(s)return`
|
22
22
|
|
23
23
|
Check the render method of \``+s+"`."}return""}}function Gt(s){{if(s!==void 0){var g=s.fileName.replace(/^.*[\\\/]/,""),S=s.lineNumber;return`
|
24
24
|
|
25
|
-
Check your code at `+g+":"+S+"."}return""}}var mt={};function pt(s){{var g=
|
25
|
+
Check your code at `+g+":"+S+"."}return""}}var mt={};function pt(s){{var g=le();if(!g){var S=typeof s=="string"?s:s.displayName||s.name;S&&(g=`
|
26
26
|
|
27
|
-
Check the top-level render call using <`+S+">.")}return g}}function ve(s,g){{if(!s._store||s._store.validated||s.key!=null)return;s._store.validated=!0;var S=pt(g);if(mt[S])return;mt[S]=!0;var O="";s&&s._owner&&s._owner!==x.current&&(O=" It was passed a child from "+
|
27
|
+
Check the top-level render call using <`+S+">.")}return g}}function ve(s,g){{if(!s._store||s._store.validated||s.key!=null)return;s._store.validated=!0;var S=pt(g);if(mt[S])return;mt[S]=!0;var O="";s&&s._owner&&s._owner!==x.current&&(O=" It was passed a child from "+B(s._owner.type)+"."),F(s),G('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',S,O),F(null)}}function be(s,g){{if(typeof s!="object")return;if(Pe(s))for(var S=0;S<s.length;S++){var O=s[S];ge(O)&&ve(O,g)}else if(ge(s))s._store&&(s._store.validated=!0);else if(s){var V=Q(s);if(typeof V=="function"&&V!==s.entries)for(var W=V.call(s),L;!(L=W.next()).done;)ge(L.value)&&ve(L.value,g)}}}function He(s){{var g=s.type;if(g==null||typeof g=="string")return;var S;if(typeof g=="function")S=g.propTypes;else if(typeof g=="object"&&(g.$$typeof===d||g.$$typeof===m))S=g.propTypes;else return;if(S){var O=B(g);z(S,s.props,"prop",O,s)}else if(g.PropTypes!==void 0&&!ne){ne=!0;var V=B(g);G("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",V||"Unknown")}typeof g.getDefaultProps=="function"&&!g.getDefaultProps.isReactClassApproved&&G("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ce(s){{for(var g=Object.keys(s.props),S=0;S<g.length;S++){var O=g[S];if(O!=="children"&&O!=="key"){F(s),G("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",O),F(null);break}}s.ref!==null&&(F(s),G("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}function Fe(s,g,S,O,V,W){{var L=Me(s);if(!L){var A="";(s===void 0||typeof s=="object"&&s!==null&&Object.keys(s).length===0)&&(A+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ue=Gt(V);ue?A+=ue:A+=le();var X;s===null?X="null":Pe(s)?X="array":s!==void 0&&s.$$typeof===n?(X="<"+(B(s.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):X=typeof s,G("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",X,A)}var te=o(s,g,S,V,W);if(te==null)return te;if(L){var ye=g.children;if(ye!==void 0)if(O)if(Pe(ye)){for(var Xe=0;Xe<ye.length;Xe++)be(ye[Xe],s);Object.freeze&&Object.freeze(ye)}else G("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else be(ye,s)}return s===t?Ce(te):He(te),te}}function Ze(s,g,S){return Fe(s,g,S,!0)}function gt(s,g,S){return Fe(s,g,S,!1)}var pn=gt,gn=Ze;rt.Fragment=t,rt.jsx=pn,rt.jsxs=gn}()),rt}process.env.NODE_ENV==="production"?Ft.exports=jn():Ft.exports=In();var u=Ft.exports;function Bt(e){return e.title.search("<")>-1?u.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:e.title}}):u.jsx("button",{children:e.title})}const Nn=u.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[u.jsx("circle",{cx:"7",cy:"7",r:"6"}),u.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),u.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),Ln=u.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:u.jsx("path",{d:`M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
|
28
28
|
C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1
|
29
|
-
C11,8.22,10.74,8,10.43,8z`})});function on(e){return u.jsx(en.Reorder.Item,{value:e.title,children:u.jsxs("div",{children:[Ln,u.jsx("span",{children:e.title}),u.jsx("button",{className:"closeIcon",onClick:()=>{e.onDelete(e.index)},children:Nn})]})},e.title)}function cn(e){const[n,a]=E.useState(!1),[t,i]=E.useState(e.options),c=h=>{e.onDragComplete(h),i(h)},l=h=>{const p=[...t];p.splice(h,1),c(p)},r=[];t.forEach((h,p)=>{r.push(u.jsx(on,{index:p,title:h,onDelete:l},h))});let d="dropdown draggable";return e.subdropdown&&(d+=" subdropdown"),u.jsxs("div",{className:d,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[u.jsx(Bt,{title:e.title}),u.jsx(en.Reorder.Group,{axis:"y",values:t,onReorder:c,style:{visibility:n?"visible":"hidden"},children:r})]})}function ln(e){const[n,a]=E.useState(!1),t=[];e.options.map((c,l)=>{e.onSelect!==void 0&&(c.onSelect=e.onSelect),t.push(u.jsx(un,{option:c},l))});let i="dropdown";return e.subdropdown&&(i+=" subdropdown"),u.jsxs("div",{className:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[u.jsx(Bt,{title:e.title}),u.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:t})]})}function un(e){const{option:n}=e,[a,t]=E.useState("");let i;switch(n.type){case"draggable":i=u.jsx(cn,{title:n.title,options:n.value,onDragComplete:c=>{n.onDragComplete!==void 0&&n.onDragComplete(c)},subdropdown:!0});break;case"dropdown":i=u.jsx(ln,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":i=u.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(a!==n.title?t(n.title):t(""))},children:n.title});break}return u.jsx("li",{className:a===n.title?"selected":"",children:i},tn())}function Fn(e,n,a){function t(c){switch(n.forEach(l=>{l.callback(e,l.remote,c)}),c.event){case"custom":k.dispatchEvent({type:P.CUSTOM,value:c.data});break}}function i(c){switch(a.forEach(l=>{l.callback(e,l.remote,c)}),c.event){case"custom":k.dispatchEvent({type:P.CUSTOM,value:c.data});break}}e.listen=c=>{c.target==="editor"?i(c):t(c)}}function Ot(e){const[n,a]=E.useState(e.open!==void 0?e.open:!0),t=!n||e.children===void 0;return u.jsxs("div",{className:`accordion ${t?"hide":""}`,children:[u.jsxs("button",{className:"toggle",onClick:()=>{const i=!n;e.onToggle!==void 0&&e.onToggle(i),a(i)},children:[u.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),u.jsx("p",{className:"label",children:ct(e.label)})]}),e.button,u.jsx("div",{className:n?"open":"",children:u.jsx("div",{children:e.children})})]})}function Vt(e){const n=E.useRef(null),[a,t]=E.useState(!1),i=e.child!==void 0&&e.child.children.length>0,c=[];return e.child!==void 0&&e.child.children.length>0&&e.child.children.map((l,r)=>{c.push(u.jsx(Vt,{child:l,three:e.three},r))}),E.useEffect(()=>{const l=e.child.uuid,r=e.three.getScene(l);if(r!==null){const d=r.getObjectByProperty("uuid",l);d!==void 0&&(n.current.style.opacity=d.visible?"1":"0.25")}},[]),u.jsx(u.Fragment,{children:e.child!==void 0&&u.jsxs("div",{className:"childObject",children:[u.jsxs("div",{className:"child",children:[i?u.jsx("button",{className:"status",style:{backgroundPositionX:a?"-14px":"2px"},onClick:()=>{t(!a)}}):null,u.jsx("button",{className:"name",style:{left:i?"20px":"5px"},onClick:()=>{e.child!==void 0&&(e.three.getObject(e.child.uuid),a||t(!0))},children:e.child.name.length>0?`${e.child.name} (${e.child.type})`:`${e.child.type}::${e.child.uuid}`}),u.jsx("button",{className:"visibility",ref:n,onClick:()=>{if(e.child){const l=e.three.getScene(e.child.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",e.child.uuid);if(r!==void 0){const d="visible",h=!r.visible;n.current.style.opacity=h?"1":"0.25",e.three.updateObject(e.child.uuid,d,h),q(r,d,h)}}}}}),u.jsx("div",{className:`icon ${Tn(e.child)}`})]}),u.jsx("div",{className:a?"open":"",children:u.jsx("div",{className:"container",children:c})})]},Math.random())})}function dn(e){const n=[];return e.child?.children.map((a,t)=>{n.push(u.jsx(Vt,{child:a,scene:e.scene,three:e.three},t))}),u.jsx("div",{className:`scene ${e.class!==void 0?e.class:""}`,children:n})}const Un="data:image/gif;base64,R0lGODlhDgFkAIAAAP///wAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDIgNzkuZGJhM2RhM2I1LCAyMDIzLzEyLzE1LTEwOjQyOjM3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjUuNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoyMDk3M0NEODAxQjQxMUVGODVGNENDMkUyMUExNDk1NSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMDk3M0NEOTAxQjQxMUVGODVGNENDMkUyMUExNDk1NSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkE4ODc3Qzg5MDFCMzExRUY4NUY0Q0MyRTIxQTE0OTU1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkE4ODc3QzhBMDFCMzExRUY4NUY0Q0MyRTIxQTE0OTU1Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAA4BZAAAAv+Mj6nL7Q+jnLTai7PevPsPhuJIluaJpurKtu4Lx/JM1/aN5/rO9/4PDAqHxKLxiEwql8ym8wmNSqfUqvWKzWq33K73Cw6Lx+Sy+YxOq9fstvsNj8vn9Lr9js/r9/y+/w8YKDhIWGh4iJiouMjY6PgIGSk5SVlpeYmZqTkJAGDQ+dnpuekmGgAKejpKuiZqmprKqoZKGyrbOlqrejub6xvLGyw8TFzcprurGuvqybxq7ETbrItsCz0l7Zpc+6p9/cS967w9/S2FTF0u/mzehK4Oqz3eTl9vf4+fr7/P3+//DzCgwIEECxo8iDChwoUMGzp8CDGixIkUK1q8iDGjxo0XHDt6/AgypMiRJEuaPIkypcqVLFt+KwAAOw==";function Bn(e){return"items"in e}function Ye(e){const n=[];return e.items.forEach(a=>{Bn(a)?n.push(u.jsx(Ye,{title:ct(a.title),items:a.items},Math.random())):n.push(u.jsx(St,{title:a.title,prop:a.prop,value:a.value,type:a.type,min:a.min,max:a.max,step:a.step,disabled:a.disabled,options:a.options,onChange:(t,i)=>{a.onChange!==void 0&&a.onChange(t,i)},onKeyDown:t=>{a.onKeyDown!==void 0&&a.onKeyDown(t)}},Math.random()))}),u.jsx(Ot,{label:e.title,open:e.expanded===!0,children:n})}function Vn(e){return!(e==="alphaHash"||e==="alphaToCoverage"||e==="attenuationDistance"||e==="blendAlpha"||e==="blendColor"||e==="blendDstAlpha"||e==="colorWrite"||e==="combine"||e==="defaultAttributeValues"||e==="depthFunc"||e==="forceSinglePass"||e==="glslVersion"||e==="linecap"||e==="linejoin"||e==="linewidth"||e==="normalMapType"||e==="precision"||e==="premultipliedAlpha"||e==="shadowSide"||e==="toneMapped"||e==="uniformsGroups"||e==="uniformsNeedUpdate"||e==="userData"||e==="vertexColors"||e==="version"||e==="wireframeLinecap"||e==="wireframeLinejoin"||e==="wireframeLinewidth"||e.slice(0,4)==="clip"||e.slice(0,7)==="polygon"||e.slice(0,7)==="stencil"||e.slice(0,2)==="is")}function zn(e){switch(e){case"Alpha Map":return"alphaMap";case"Anisotropy Map":return"anisotropyMap";case"AO Map":return"aoMap";case"Bump Map":return"bumpMap";case"Clearcoat Map":return"clearcoatMap";case"Clearcoat Normal Map":return"clearcoatNormalMap";case"Clearcoat Roughness Map":return"clearcoatRoughnessMap";case"Displacement Map":return"displacementMap";case"Emissive Map":return"emissiveMap";case"Iridescence Map":return"iridescenceMap";case"Iridescence Thickness Map":return"iridescenceThicknessMap";case"Map":return"map";case"Matcap":return"matcap";case"Normal Map":return"normalMap";case"Roughness Map":return"roughnessMap";case"Sheen Color Map":return"sheenColorMap";case"Sheen Roughness Map":return"sheenRoughnessMap";case"Specular Color Map":return"specularColorMap";case"Specular Map Intensity":return"specularIntensityMap";case"Thickness Map":return"thicknessMap";case"Transmission Map":return"transmissionMap"}return e}function Tt(e){switch(e){case"alphaMap":return"Alpha Map";case"anisotropyMap":return"Anisotropy Map";case"anisotropyRotation":return"Anisotropy Rotation";case"aoMap":return"AO Map";case"aoMapIntensity":return"AO Map Intensity";case"attenuationColor":return"Attenuation Color";case"blendAlpha":return"Blend Alpha";case"blendColor":return"Blend Color";case"blendDst":return"Blend Dst";case"blendDstAlpha":return"Blend Dst Alha";case"blendEquation":return"Blend Equation";case"blendEquationAlpha":return"Blend Equation Alpha";case"blending":return"Blending";case"blendSrc":return"Blend Src";case"blendSrcAlpha":return"Blend Src Alpha";case"bumpMap":return"Bump Map";case"bumpScale":return"Bump Scale";case"clearcoatMap":return"Clearcoat Map";case"clearcoatNormalMap":return"Clearcoat Normal Map";case"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";case"clearcoatRoughnessMap":return"Clearcoat Roughness Map";case"color":return"Color";case"defines":return"Defines";case"depthTest":return"Depth Test";case"depthWrite":return"Depth Write";case"displacementBias":return"Displacement Bias";case"displacementMap":return"Displacement Map";case"displacementScale":return"Displacement Scale";case"dithering":return"Dithering";case"emissive":return"Emissive";case"emissiveMap":return"Emissive Map";case"emissiveIntensity":return"Emissive Intensity";case"envMap":return"Environment Map";case"envMapIntensity":return"Environment Map Intensity";case"extensions":return"Extensions";case"flatShading":return"Flat Shading";case"fragmentShader":return"Fragment Shader";case"fog":return"Fog";case"gradientMap":return"Gradient Map";case"ior":return"IOR";case"iridescenceIOR":return"Iridescence IOR";case"iridescenceMap":return"Iridescence Map";case"iridescenceThicknessMap":return"Iridescence Thickness Map";case"iridescenceThicknessRange":return"Iridescence Thickness Range";case"lights":return"Lights";case"lightMap":return"Light Map";case"lightMapIntensity":return"Light Map Intensity";case"map":return"Map";case"matcap":return"Matcap";case"metalness":return"Metalness";case"metalnessMap":return"Metalness Map";case"name":return"Name";case"normalMap":return"Normal Map";case"normalScale":return"Normal Scale";case"opacity":return"Opacity";case"reflectivity":return"Reflectivity";case"refractionRatio":return"Refraction Ratio";case"roughness":return"Roughness";case"roughnessMap":return"Roughness Map";case"sheenColor":return"Sheen Color";case"sheenColorMap":return"Sheen Color Map";case"sheenRoughness":return"Sheen Roughness";case"sheenRoughnessMap":return"Sheen Roughness Map";case"shininess":return"Shininess";case"side":return"Side";case"size":return"Size";case"sizeAttenuation":return"Size Attenuation";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularColorMap":return"Specular Color Map";case"specularIntensity":return"Specular Intensity";case"specularIntensityMap":return"Specular Map Intensity";case"thickness":return"Thickness";case"thicknessMap":return"Thickness Map";case"transmission":return"Transmission";case"transmissionMap":return"Transmission Map";case"transparent":return"Transparent";case"type":return"Type";case"uuid":return"UUID";case"uniforms":return"Uniforms";case"vertexShader":return"Vertex Shader";case"visible":return"Visible";case"wireframe":return"Wireframe"}return e}function hn(e){const n=e.toLowerCase();return n.search("intensity")>-1||n==="anisotropyrotation"||n==="blendalpha"||n==="bumpscale"||n==="clearcoatroughness"||n==="displacementbias"||n==="displacementscale"||n==="metalness"||n==="opacity"||n==="reflectivity"||n==="refractionratio"||n==="roughness"||n==="sheenroughness"||n==="thickness"}function Gn(){const e=document.createElement("input");return e.type="file",new Promise((n,a)=>{e.addEventListener("change",function(){if(e.files===null)a();else{const t=e.files[0],i=new FileReader;i.onload=function(c){n(c.target.result)},i.readAsDataURL(t)}}),e.click()})}const Hn=[{title:"Front",value:f.FrontSide},{title:"Back",value:f.BackSide},{title:"Double",value:f.DoubleSide}],Wn=[{title:"No Blending",value:f.NoBlending},{title:"Normal",value:f.NormalBlending},{title:"Additive",value:f.AdditiveBlending},{title:"Subtractive",value:f.SubtractiveBlending},{title:"Multiply",value:f.MultiplyBlending},{title:"Custom",value:f.CustomBlending}],$n=[{title:"Add",value:f.AddEquation},{title:"Subtract",value:f.SubtractEquation},{title:"Reverse Subtract",value:f.ReverseSubtractEquation},{title:"Min",value:f.MinEquation},{title:"Max",value:f.MaxEquation}],Yn=[{title:"Zero",valye:f.ZeroFactor},{title:"One",valye:f.OneFactor},{title:"Src Color",valye:f.SrcColorFactor},{title:"One Minus Src Color",valye:f.OneMinusSrcColorFactor},{title:"Src Alpha",valye:f.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:f.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:f.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:f.OneMinusDstAlphaFactor},{title:"Dst Color",valye:f.DstColorFactor},{title:"One Minus Dst Color",valye:f.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:f.SrcAlphaSaturateFactor},{title:"Constant Color",valye:f.ConstantColorFactor},{title:"One Minus Constant Color",valye:f.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:f.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:f.OneMinusConstantAlphaFactor}],qn=[{title:"Zero",valye:f.ZeroFactor},{title:"One",valye:f.OneFactor},{title:"Src Color",valye:f.SrcColorFactor},{title:"One Minus Src Color",valye:f.OneMinusSrcColorFactor},{title:"Src Alpha",valye:f.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:f.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:f.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:f.OneMinusDstAlphaFactor},{title:"Dst Color",valye:f.DstColorFactor},{title:"One Minus Dst Color",valye:f.OneMinusDstColorFactor},{title:"Constant Color",valye:f.ConstantColorFactor},{title:"One Minus Constant Color",valye:f.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:f.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:f.OneMinusConstantAlphaFactor}];function st(e,n){e.needsUpdate=!0,e.type="option",e.options=n}function Kn(e,n,a,t){return{type:"boolean",title:Tt(e),prop:e,value:n,needsUpdate:!0,onChange:(i,c)=>{t.updateObject(a.uuid,`material.${e}`,c),t.updateObject(a.uuid,"material.needsUpdate",!0);const l=t.getScene(a.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",a.uuid);r!==void 0&&q(r,`material.${e}`,c)}}}}function Zn(e,n,a,t){const i={type:"number",title:Tt(e),prop:e,value:n,min:void 0,max:void 0,step:.01,needsUpdate:!0,onChange:(c,l)=>{t.updateObject(a.uuid,`material.${e}`,l),t.updateObject(a.uuid,"material.needsUpdate",!0);const r=t.getScene(a.uuid);if(r!==null){const d=r.getObjectByProperty("uuid",a.uuid);d!==void 0&&q(d,`material.${e}`,l)}}};switch(e){case"blending":st(i,Wn);break;case"blendDst":st(i,qn);break;case"blendEquation":st(i,$n);break;case"blendSrc":st(i,Yn);break;case"side":st(i,Hn);break}return hn(e)&&(i.value=Number(n),i.type="range",i.min=Math.min(0,i.value),i.max=Math.max(1,i.value),i.step=.01),i}function Xn(e,n,a,t){const i={type:"string",title:Tt(e),prop:e,value:n,needsUpdate:!0,onChange:(l,r)=>{t.updateObject(a.uuid,`material.${e}`,r),t.updateObject(a.uuid,"material.needsUpdate",!0);const d=t.getScene(a.uuid);if(d!==null){const h=d.getObjectByProperty("uuid",a.uuid);h!==void 0&&q(h,`material.${e}`,r)}},onKeyDown:l=>{}};return(e==="vertexShader"||e==="fragmentShader")&&(i.disabled=!1,i.latest=i.value,i.onChange=(l,r)=>{i.latest=r,t.updateObject(a.uuid,`material.${e}`,r);const d=t.getScene(a.uuid);if(d!==null){const h=d.getObjectByProperty("uuid",a.uuid);h!==void 0&&q(h,`material.${e}`,r)}},i.onKeyDown=l=>{if(l.key==="Enter"&&(l.altKey||l.metaKey)){t.updateObject(a.uuid,"material.needsUpdate",!0);const r=t.getScene(a.uuid);if(r!==null){const d=r.getObjectByProperty("uuid",a.uuid);d!==void 0&&q(d,"material.needsUpdate",!0)}}}),i}function Jn(e){return e.x!==void 0&&e.y!==void 0&&e.z===void 0}function Qn(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w===void 0}function ea(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w!==void 0}function Ut(e){e.sort((n,a)=>n.title<a.title?-1:n.title>a.title?1:0)}function ot(e,n,a,t,i="",c=!1){const l=Tt(e).split(".")[0].replaceAll("[","").replaceAll("]",""),r=i.length>0?`${i}.${e}`:e,d=typeof n;if(d==="boolean"||d==="string")return{title:l,prop:r,type:d,value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const y=m.getObjectByProperty("uuid",a.uuid);y!==void 0&&q(y,`material.${r}`,p)}}};if(d==="number"){const h={title:l,prop:r,type:"number",value:n,step:.01,disabled:c,onChange:(p,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const y=t.getScene(a.uuid);if(y!==null){const w=y.getObjectByProperty("uuid",a.uuid);w!==void 0&&q(w,`material.${r}`,m)}}};return hn(l)&&(h.type="range",h.min=0,h.max=1),h}else{if(n.isColor)return{title:l,prop:r,type:"color",value:n,disabled:c,onChange:(h,p)=>{const m=new f.Color(p);t.updateObject(a.uuid,`material.${r}`,m);const y=t.getScene(a.uuid);if(y!==null){const w=y.getObjectByProperty("uuid",a.uuid);w!==void 0&&q(w,`material.${r}`,m)}}};if(Array.isArray(n)){const h=[];for(const p in n){const m=n[p],y=`[${p.toString()}]`;if(m.value!==void 0){const w=ot(`${y}.value`,m.value,a,t,r,c);w!==void 0&&h.push(w)}else{const w=ot(y,m,a,t,r,c);w!==void 0&&h.push(w)}}if(h.length>0)return Ut(h),{title:l,items:h}}else{if(Jn(n))return{title:l,prop:r,type:"vector2",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const y=m.getObjectByProperty("uuid",a.uuid);y!==void 0&&q(y,`material.${r}`,p)}}};if(Qn(n))return{title:l,prop:r,type:"grid3",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const y=m.getObjectByProperty("uuid",a.uuid);y!==void 0&&q(y,`material.${r}`,p)}}};if(ea(n))return{title:l,prop:r,type:"grid4",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const y=m.getObjectByProperty("uuid",a.uuid);y!==void 0&&q(y,`material.${r}`,p)}}};if(n.isEuler)return{title:l,prop:r,type:"euler",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const y=m.getObjectByProperty("uuid",a.uuid);y!==void 0&&q(y,`material.${r}`,p)}}};if(n.src!==void 0)return{title:l,type:"image",value:n,disabled:c,onChange:(h,p)=>{const m=zn(e),y=i.length>0?`${i}.${m}`:m;t.createTexture(a.uuid,`material.${y}`,p);const w=t.getScene(a.uuid);if(w!==null){const A=w.getObjectByProperty("uuid",a.uuid);A!==void 0&&sn(p).then(X=>{q(A,`material.${y}`,X),q(A,"material.needsUpdate",!0)})}}};if(n.elements!==void 0)return{title:l,prop:r,type:n.elements.length>9?"grid4":"grid3",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const y=m.getObjectByProperty("uuid",a.uuid);y!==void 0&&q(y,`material.${r}`,p)}}};{const h=[],p=e==="defines"||e==="extensions";try{for(const m in n){const y=n[m];if(y!==void 0)if(y.value!==void 0){const w=ot(`${m}.value`,y.value,a,t,r,p);w!==void 0&&h.push(w)}else{const w=ot(m,y,a,t,r,p);w!==void 0&&h.push(w)}}}catch{console.log("Issue cycling through material object:",e,n)}if(h.length>0)return Ut(h),{title:l,items:h}}}}}function Yt(e,n,a){const t=[];for(const i in e){if(!Vn(i))continue;const c=typeof e[i],l=e[i];if(c==="boolean")t.push(Kn(i,l,n,a));else if(c==="number")t.push(Zn(i,l,n,a));else if(c==="string")t.push(Xn(i,l,n,a));else if(c==="object"){const r=ot(i,l,n,a);r!==void 0&&t.push(r)}else l!==void 0&&console.log("other:",i,c,l)}return Ut(t),t.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0);const i=a.getScene(n.uuid);if(i!==null){const c=i.getObjectByProperty("uuid",n.uuid);c!==void 0&&q(c,"material.needsUpdate",!0)}}}),t}function ta(e,n){const a=e.material;if(Array.isArray(a)){const t=[],i=a.length;for(let c=0;c<i;c++)t.push(u.jsx(Ye,{title:`Material ${c}`,items:Yt(a[c],e,n)},`Material ${c}`));return u.jsx(u.Fragment,{children:t})}else return u.jsx(Ye,{title:"Material",items:Yt(a,e,n)})}function na(e){const[n,a]=E.useState(e.defaultValue);return E.useEffect(()=>{let t=!1,i=-1,c=0,l=e.defaultValue;const r=y=>{t=!0,c=Number(e.input.current?.value),i=y.clientX,document.addEventListener("mouseup",h,!1),document.addEventListener("mousemove",d,!1),document.addEventListener("contextmenu",h,!1)},d=y=>{if(!t)return;const w=e.step!==void 0?e.step:1,A=(y.clientX-i)*w;l=Number((c+A).toFixed(4)),e.min!==void 0&&(l=Math.max(l,e.min)),e.max!==void 0&&(l=Math.min(l,e.max)),e.onChange!==void 0&&e.onChange(l),a(l)},h=()=>{t=!1,document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",d),document.removeEventListener("contextmenu",h)},p=y=>{const w=Number(y.target.value);a(w)},m=y=>{const w=Number(y.target.value);e.onChange!==void 0&&e.onChange(w),a(w)};return e.input.current?.addEventListener("input",p),e.label.current?.addEventListener("mousedown",r,!1),e.sliderRef!==void 0&&e.sliderRef.current?.addEventListener("input",m),()=>{e.input.current?.removeEventListener("input",p),e.label.current?.removeEventListener("mousedown",r),e.sliderRef!==void 0&&e.sliderRef.current?.removeEventListener("input",m),document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",d),document.removeEventListener("contextmenu",h)}},[]),n}function $e(e){const n=E.useRef(null),a=E.useRef(null),t=na({label:e.labelRef,input:n,sliderRef:a,defaultValue:e.value,min:e.min,max:e.max,step:e.step,onChange:i=>{e.onChange!==void 0&&e.onChange(e.prop,i)}});return u.jsxs(u.Fragment,{children:[e.type==="number"&&u.jsx("input",{alt:e.alt,className:e.className,ref:n,type:"number",value:t,min:e.min,max:e.max,step:e.step,disabled:e.disabled,onChange:i=>{const c=Number(i.target.value);e.onChange!==void 0&&e.onChange(e.prop,c)}}),e.type==="range"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:t.toString(),disabled:e.disabled,ref:n,className:"min",onChange:i=>{const c=Number(i.target.value);e.onChange!==void 0&&e.onChange(e.prop,c)}}),u.jsx("input",{disabled:e.disabled,type:"range",value:t,min:e.min,max:e.max,step:e.step,ref:a,onChange:wt})]})]})}function aa(e){const n=E.useRef(null),a=E.useRef(null),t=E.useRef(null),i=E.useRef(null),c=E.useRef(null),l=E.useRef(null),[r,d]=E.useState(e.value),[h,p]=E.useState({min:Math.min(e.min,Math.min(e.value.x,e.value.y)),max:Math.max(e.max,Math.max(e.value.x,e.value.y))}),[m,y]=E.useState(!1);function w(){m||(window.addEventListener("mousemove",X),window.addEventListener("mouseup",A),window.addEventListener("mouseup",A),y(!0))}function A(){window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",A),y(!1)}function X(F){const K=c.current.getBoundingClientRect(),te=Ve(0,99,F.clientX-K.left)/99,Ee=Ve(0,99,F.clientY-K.top)/99,W=Nt(It(h.min,h.max,te),3),he=Nt(It(h.min,h.max,Ee),3);e.onChange({target:{value:{x:W,y:he}}}),d({x:W,y:he})}function de(F){let K=r.x,te=r.y;F.target===n.current?K=Number(F.target.value):te=Number(F.target.value),d({x:K,y:te})}function ae(){const F=Number(t.current.value);p({min:F,max:h.max}),(r.x<F||r.y<F)&&d({x:Ve(F,h.max,r.x),y:Ve(F,h.max,r.y)})}function H(){const F=Number(i.current.value);p({min:h.min,max:F}),(r.x>F||r.y>F)&&d({x:Ve(h.min,F,r.x),y:Ve(h.min,F,r.y)})}return E.useEffect(()=>{const F=jt(h.min,h.max,r.x),K=jt(h.min,h.max,r.y);l.current.style.left=`${F*100}%`,l.current.style.top=`${K*100}%`},[h,r]),u.jsxs("div",{className:"vector2",children:[u.jsxs("div",{className:"fields",children:[u.jsxs("div",{children:[u.jsx("label",{children:"X:"}),u.jsx("input",{ref:n,type:"number",value:r.x,min:h.min,max:h.max,step:.01,onChange:de})]}),u.jsxs("div",{children:[u.jsx("label",{children:"Y:"}),u.jsx("input",{ref:a,type:"number",value:r.y,min:h.min,max:h.max,step:.01,onChange:de})]}),u.jsxs("div",{children:[u.jsx("label",{children:"Min:"}),u.jsx("input",{ref:t,type:"number",value:h.min,step:.01,onChange:ae})]}),u.jsxs("div",{children:[u.jsx("label",{children:"Max:"}),u.jsx("input",{ref:i,type:"number",value:h.max,step:.01,onChange:H})]})]}),u.jsxs("div",{className:"input",ref:c,onMouseDown:w,onMouseUp:A,children:[u.jsx("div",{className:"x"}),u.jsx("div",{className:"y"}),u.jsx("div",{className:"pt",ref:l})]})]})}function qt(e){const n=e.value.isVector3!==void 0,a=e.value.isEuler!==void 0,t=e.value.elements!==void 0,i=[];if(n){const c=E.useMemo(()=>e.value,[]),l=(d,h)=>{c[d]=h,e.onChange({target:{value:c}})};["x","y","z"].forEach(d=>{const h=E.useRef(null);i.push(u.jsxs("div",{children:[u.jsx("label",{ref:h,children:d.toUpperCase()}),u.jsx($e,{value:c[d],type:"number",prop:d,step:.01,labelRef:h,onChange:l})]},d))})}else if(a){const c=E.useMemo(()=>e.value,[]),l=(d,h)=>{c[d]=h,e.onChange({target:{value:c}})};["_x","_y","_z"].forEach(d=>{const h=E.useRef(null);i.push(u.jsxs("div",{children:[u.jsx("label",{ref:h,children:d.substring(1).toUpperCase()}),u.jsx($e,{value:c[d],type:"number",prop:d,step:.01,labelRef:h,onChange:l})]},d))})}else if(t){const c=E.useMemo(()=>e.value,[]),l=(r,d)=>{const h=Number(r);c.elements[h]=d,e.onChange({target:{value:c}})};for(let r=0;r<9;r++){const d=E.useRef(null);i.push(u.jsxs("div",{children:[u.jsx("label",{ref:d,children:r+1}),u.jsx($e,{value:c.elements[r],type:"number",prop:r.toString(),step:.01,labelRef:d,onChange:l})]},r.toString()))}}return u.jsx("div",{className:"grid3",children:i},Math.random().toString())}function ia(e){const n=e.value.x!==void 0,a=[];if(n){const t=E.useMemo(()=>e.value,[]),i=(l,r)=>{t[l]=r,e.onChange({target:{value:t}})};["x","y","z","w"].forEach(l=>{const r=E.useRef(null);a.push(u.jsxs("div",{children:[u.jsx("label",{ref:r,children:l.toUpperCase()}),u.jsx($e,{value:t.x,type:"number",prop:l,step:.01,labelRef:r,onChange:i})]},l))})}else{const t=E.useMemo(()=>e.value,[]),i=(c,l)=>{const r=Number(c);t.elements[r]=l,e.onChange({target:{value:t}})};for(let c=0;c<16;c++){const l=E.useRef(null);a.push(u.jsxs("div",{children:[u.jsx("label",{ref:l,children:c+1}),u.jsx($e,{value:t.elements[c],type:"number",prop:c.toString(),step:.01,labelRef:l,onChange:i})]},c.toString()))}}return u.jsx("div",{className:"grid4",children:a})}function St(e){let n=e.value;n!==void 0&&n.isColor!==void 0&&(n=an(e.value));const[a,t]=E.useState(n),i=E.useRef(null),c=E.useRef(null),l=p=>{let m=p.target.value;e.type==="boolean"?m=p.target.checked:e.type==="option"&&(m=e.options[m].value),t(m),e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,m)},r={};e.disabled&&(r.opacity=.8);const d=e.type==="string"&&(a.length>100||a.search(`
|
30
|
-
`)>-1),h=d||e.type==="image"||e.type==="vector2";return u.jsxs("div",{className:`field ${h?"block":""}`,style:r,children:[e.type!=="button"&&u.jsx("label",{ref:i,children:ct(e.title)},"fieldLabel"),e.type==="string"&&!d&&u.jsx("input",{type:"text",disabled:e.disabled,onChange:l,value:a}),e.type==="string"&&d&&u.jsx("textarea",{cols:50,rows:10,disabled:e.disabled!==void 0?e.disabled:!0,onChange:l,onKeyDown:p=>{e.onKeyDown!==void 0&&e.onKeyDown(p)},value:a}),e.type==="boolean"&&u.jsx("input",{type:"checkbox",disabled:e.disabled,onChange:l,checked:a}),e.type==="number"&&u.jsx($e,{value:a,type:e.type,prop:e.prop!==void 0?e.prop:e.title,min:e.min,max:e.max,step:e.step,disabled:e.disabled,labelRef:i,onChange:e.onChange}),e.type==="range"&&u.jsx($e,{value:a,type:e.type,prop:e.prop!==void 0?e.prop:e.title,min:e.min,max:e.max,step:e.step,disabled:e.disabled,labelRef:i,onChange:e.onChange}),e.type==="color"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:a.toString(),onChange:l,disabled:e.disabled,className:"color"}),u.jsx("input",{type:"color",value:a,onChange:l,disabled:e.disabled})]}),e.type==="button"&&u.jsx("button",{disabled:e.disabled,onClick:()=>{e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,!0)},children:e.title}),e.type==="image"&&u.jsx("img",{alt:e.title,ref:c,onClick:()=>{Gn().then(p=>{c.current.src=p,e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,p)})},src:a.src.length>0?a.src:Un}),e.type==="option"&&u.jsx(u.Fragment,{children:u.jsx("select",{onChange:l,disabled:e.disabled,defaultValue:e.value,children:e.options?.map((p,m)=>u.jsx("option",{value:p.value,children:ct(p.title)},m))})}),e.type==="vector2"&&u.jsx(aa,{value:a,min:0,max:1,onChange:l}),e.type==="grid3"&&u.jsx(qt,{value:a,onChange:l}),e.type==="grid4"&&u.jsx(ia,{value:a,onChange:l}),e.type==="euler"&&u.jsx(qt,{value:a,onChange:l})]})}function Kt(e){switch(e){case"fov":return"FOV";case"zoom":return"Zoom";case"near":return"Near";case"far":return"Far";case"focus":return"Focus";case"aspect":return"Aspect";case"filmGauge":return"Film Gauge";case"filmOffset":return"Film Offset";case"left":return"Left";case"right":return"Right";case"top":return"Top";case"bottom":return"Bottom"}return e}function ra(e,n){const a=[];if(e.perspectiveCameraInfo!==void 0)for(const t in e.perspectiveCameraInfo)a.push({title:Kt(t),prop:t,type:"number",step:.01,value:e.perspectiveCameraInfo[t],onChange:(i,c)=>{n.updateObject(e.uuid,i,c),n.requestMethod(e.uuid,"updateProjectionMatrix");const l=n.getScene(e.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",e.uuid);r!==void 0&&(q(r,i,c),r.updateProjectionMatrix())}}});else if(e.orthographicCameraInfo!==void 0)for(const t in e.orthographicCameraInfo)a.push({title:Kt(t),prop:t,type:"number",step:.01,value:e.perspectiveCameraInfo[t],onChange:(i,c)=>{n.updateObject(e.uuid,i,c),n.requestMethod(e.uuid,"updateProjectionMatrix");const l=n.getScene(e.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",e.uuid);r!==void 0&&(q(r,i,c),r.updateProjectionMatrix())}}});return u.jsx(Ye,{title:"Camera",items:a})}function sa(e,n){const a=new f.Matrix4;a.elements=e.matrix;const t=new f.Vector3,i=new f.Euler,c=new f.Vector3;e.uuid.length>0&&(t.setFromMatrixPosition(a),i.setFromRotationMatrix(a),c.setFromMatrixScale(a));const l=(r,d)=>{const h=r==="rotation"?{x:d._x,y:d._y,z:d._z}:d;n.updateObject(e.uuid,r,h);const p=n.getScene(e.uuid);if(p!==null){const m=p.getObjectByProperty("uuid",e.uuid);m!==void 0&&q(m,r,h)}};return u.jsx(Ye,{title:"Transform",items:[{title:"Position",prop:"position",type:"grid3",value:t,onChange:l},{title:"Rotation",prop:"rotation",type:"grid3",value:i,onChange:l},{title:"Scale",prop:"scale",type:"grid3",value:c,onChange:l}]})}function Zt(e){switch(e){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color";case"width":return"Width";case"height":return"Height"}return e}function oa(e,n){const a=[];if(e.lightInfo!==void 0)for(const t in e.lightInfo){const i=e.lightInfo[t];i!==void 0&&(i.isColor!==void 0?a.push({title:Zt(t),prop:t,type:"color",value:i,onChange:(c,l)=>{const r=new f.Color(l);n.updateObject(e.uuid,c,r);const d=n.getScene(e.uuid);if(d!==null){const h=d.getObjectByProperty("uuid",e.uuid);h!==void 0&&q(h,c,r)}}}):a.push({title:Zt(t),prop:t,type:typeof i,value:i,step:typeof i=="number"?.01:void 0,onChange:(c,l)=>{n.updateObject(e.uuid,c,l);const r=n.getScene(e.uuid);if(r!==null){const d=r.getObjectByProperty("uuid",e.uuid);d!==void 0&&q(d,c,l)}}}))}return u.jsx(Ye,{title:"Light",items:a})}function ca(e,n){const a=[],t=[];let i=0;e.animations.forEach(l=>{i=Math.max(i,l.duration),l.duration>0&&t.push({title:l.name,items:[{title:"Duration",type:"number",value:l.duration,disabled:!0},{title:"Blend Mode",type:"option",disabled:!0,options:[{title:"Normal",value:2500},{title:"Additive",value:2501}]}]})}),a.push({title:"Animations",items:t});const c=n.getScene(e.uuid);if(c!==null){const l=c.getObjectByProperty("uuid",e.uuid);let r=!1;if(l!==void 0){const d=l.mixer;if(r=d!==void 0,r){const h=[{title:"Time Scale",type:"range",value:d.timeScale,step:.01,min:-1,max:2,onChange:(p,m)=>{d.timeScale=m,n.updateObject(e.uuid,"mixer.timeScale",m)}}];h.push({title:"Stop All",type:"button",onChange:()=>{d.stopAllAction(),n.requestMethod(e.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:h})}}}return u.jsx(Ye,{title:"Animation",items:a})}const fn={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};let ue={...fn};function mn(e){const[n,a]=E.useState(-1);E.useEffect(()=>{function l(d){ue={...d.value},a(Date.now())}function r(){ue={...fn},a(Date.now())}return k.addEventListener(P.SET_SCENE,r),k.addEventListener(P.SET_OBJECT,l),()=>{k.removeEventListener(P.SET_SCENE,r),k.removeEventListener(P.SET_OBJECT,l)}},[]);const t=ue.type.toLowerCase(),i=ue.animations.length>0||ue.mixer!==void 0,c=t.search("mesh")>-1||t.search("line")>-1||t.search("points")>-1;return u.jsx(Ot,{label:"Inspector",children:u.jsx("div",{id:"Inspector",className:e.class,children:ue.uuid.length>0&&u.jsxs(u.Fragment,{children:[u.jsxs(u.Fragment,{children:[u.jsx(St,{type:"string",title:"Name",prop:"name",value:ue.name,disabled:!0}),u.jsx(St,{type:"string",title:"Type",prop:"type",value:ue.type,disabled:!0}),u.jsx(St,{type:"string",title:"UUID",prop:"uuid",value:ue.uuid,disabled:!0})]}),u.jsxs(u.Fragment,{children:[sa(ue,e.three),i?ca(ue,e.three):null,t.search("camera")>-1?ra(ue,e.three):null,t.search("light")>-1?oa(ue,e.three):null,c?ta(ue,e.three):null]})]})},n)},"Inspector")}function la(e){const[n]=E.useState([]),[a,t]=E.useState(0),i=r=>{n.push(r.value),t(Date.now())},c=r=>{const d=r.value;for(let h=0;h<n.length;h++)if(d.uuid===n[h].uuid){n.splice(h,1),t(Date.now());return}};E.useEffect(()=>(k.addEventListener(P.ADD_SCENE,i),k.addEventListener(P.REMOVE_SCENE,c),()=>{k.removeEventListener(P.ADD_SCENE,i),k.removeEventListener(P.REMOVE_SCENE,c)}),[]);const l=[];return n.forEach((r,d)=>{l.push(u.jsx(Ot,{label:`Scene: ${r.name}`,open:!0,children:u.jsx(dn,{child:r,scene:r,three:e.three})},`scene_${d}`))}),u.jsxs("div",{id:"SidePanel",children:[l,u.jsx(mn,{three:e.three})]},`SidePanel ${a}`)}function ua(e){return E.useEffect(()=>{function n(r){let d=null;return e.three.scenes.forEach(h=>{r.search(h.uuid)>-1&&(d=h)}),d}const a=r=>{const d=r.value,p=n(d)?.getObjectByProperty("uuid",d);p!==void 0&&e.three.setObject(p)},t=(r,d,h)=>{const m=n(r)?.getObjectByProperty("uuid",r);m!==void 0&&q(m,d,h)},i=r=>{const d=r.value,{key:h,value:p,uuid:m}=d;t(m,h,p)},c=r=>{const d=r.value;sn(d.value).then(h=>{t(d.uuid,d.key,h),t(d.uuid,"material.needsUpdate",!0)})},l=r=>{const{key:d,uuid:h,value:p,subitem:m}=r.value,w=n(h)?.getObjectByProperty("uuid",h);if(w!==void 0)try{m!==void 0?Dn(w,m)[d](p):w[d](p)}catch(A){console.log("Error requesting method:"),console.log(A),console.log(d),console.log(p)}};return k.addEventListener(P.GET_OBJECT,a),k.addEventListener(P.UPDATE_OBJECT,i),k.addEventListener(P.CREATE_TEXTURE,c),k.addEventListener(P.REQUEST_METHOD,l),()=>{k.removeEventListener(P.GET_OBJECT,a),k.removeEventListener(P.UPDATE_OBJECT,i),k.removeEventListener(P.CREATE_TEXTURE,c),k.removeEventListener(P.REQUEST_METHOD,l)}},[]),null}class da extends f.Line{constructor(n,a){const t=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],i=new f.BufferGeometry;i.setAttribute("position",new f.Float32BufferAttribute(t,3)),i.computeBoundingSphere();const c=new f.LineBasicMaterial({fog:!1});super(i,c),this.light=n,this.color=a,this.type="RectAreaLightHelper";const l=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],r=new f.BufferGeometry;r.setAttribute("position",new f.Float32BufferAttribute(l,3)),r.computeBoundingSphere(),this.add(new f.Mesh(r,new f.MeshBasicMaterial({side:f.BackSide,fog:!1})))}updateMatrixWorld(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),this.color!==void 0)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);const n=this.material.color,a=Math.max(n.r,n.g,n.b);a>1&&n.multiplyScalar(1/a),this.children[0].material.color.copy(this.material.color)}this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Xt={type:"change"},Pt={type:"start"},Jt={type:"end"},vt=new f.Ray,Qt=new f.Plane,ha=Math.cos(70*f.MathUtils.DEG2RAD);class fa extends f.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new f.Vector3,this.cursor=new f.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:f.MOUSE.ROTATE,MIDDLE:f.MOUSE.DOLLY,RIGHT:f.MOUSE.PAN},this.touches={ONE:f.TOUCH.ROTATE,TWO:f.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",nt),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",nt),this._domElementKeyEvents=null},this.saveState=function(){t.target0.copy(t.target),t.position0.copy(t.object.position),t.zoom0=t.object.zoom},this.reset=function(){t.target.copy(t.target0),t.object.position.copy(t.position0),t.object.zoom=t.zoom0,t.object.updateProjectionMatrix(),t.dispatchEvent(Xt),t.update(),c=i.NONE},this.update=function(){const o=new f.Vector3,x=new f.Quaternion().setFromUnitVectors(n.up,new f.Vector3(0,1,0)),D=x.clone().invert(),L=new f.Vector3,ee=new f.Quaternion,ge=new f.Vector3,ce=2*Math.PI;return function(mt=null){const pt=t.object.position;o.copy(pt).sub(t.target),o.applyQuaternion(x),r.setFromVector3(o),t.autoRotate&&c===i.NONE&&me(Me(mt)),t.enableDamping?(r.theta+=d.theta*t.dampingFactor,r.phi+=d.phi*t.dampingFactor):(r.theta+=d.theta,r.phi+=d.phi);let ve=t.minAzimuthAngle,be=t.maxAzimuthAngle;isFinite(ve)&&isFinite(be)&&(ve<-Math.PI?ve+=ce:ve>Math.PI&&(ve-=ce),be<-Math.PI?be+=ce:be>Math.PI&&(be-=ce),ve<=be?r.theta=Math.max(ve,Math.min(be,r.theta)):r.theta=r.theta>(ve+be)/2?Math.max(ve,r.theta):Math.min(be,r.theta)),r.phi=Math.max(t.minPolarAngle,Math.min(t.maxPolarAngle,r.phi)),r.makeSafe(),t.enableDamping===!0?t.target.addScaledVector(p,t.dampingFactor):t.target.add(p),t.target.sub(t.cursor),t.target.clampLength(t.minTargetRadius,t.maxTargetRadius),t.target.add(t.cursor);let He=!1;if(t.zoomToCursor&&Ee||t.object.isOrthographicCamera)r.radius=_e(r.radius);else{const Ce=r.radius;r.radius=_e(r.radius*h),He=Ce!=r.radius}if(o.setFromSpherical(r),o.applyQuaternion(D),pt.copy(t.target).add(o),t.object.lookAt(t.target),t.enableDamping===!0?(d.theta*=1-t.dampingFactor,d.phi*=1-t.dampingFactor,p.multiplyScalar(1-t.dampingFactor)):(d.set(0,0,0),p.set(0,0,0)),t.zoomToCursor&&Ee){let Ce=null;if(t.object.isPerspectiveCamera){const Fe=o.length();Ce=_e(Fe*h);const Ze=Fe-Ce;t.object.position.addScaledVector(K,Ze),t.object.updateMatrixWorld(),He=!!Ze}else if(t.object.isOrthographicCamera){const Fe=new f.Vector3(te.x,te.y,0);Fe.unproject(t.object);const Ze=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/h)),t.object.updateProjectionMatrix(),He=Ze!==t.object.zoom;const gt=new f.Vector3(te.x,te.y,0);gt.unproject(t.object),t.object.position.sub(gt).add(Fe),t.object.updateMatrixWorld(),Ce=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),t.zoomToCursor=!1;Ce!==null&&(this.screenSpacePanning?t.target.set(0,0,-1).transformDirection(t.object.matrix).multiplyScalar(Ce).add(t.object.position):(vt.origin.copy(t.object.position),vt.direction.set(0,0,-1).transformDirection(t.object.matrix),Math.abs(t.object.up.dot(vt.direction))<ha?n.lookAt(t.target):(Qt.setFromNormalAndCoplanarPoint(t.object.up,t.target),vt.intersectPlane(Qt,t.target))))}else if(t.object.isOrthographicCamera){const Ce=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/h)),Ce!==t.object.zoom&&(t.object.updateProjectionMatrix(),He=!0)}return h=1,Ee=!1,He||L.distanceToSquared(t.object.position)>l||8*(1-ee.dot(t.object.quaternion))>l||ge.distanceToSquared(t.target)>l?(t.dispatchEvent(Xt),L.copy(t.object.position),ee.copy(t.object.quaternion),ge.copy(t.target),!0):!1}}(),this.dispose=function(){t.domElement.removeEventListener("contextmenu",Ke),t.domElement.removeEventListener("pointerdown",_),t.domElement.removeEventListener("pointercancel",$),t.domElement.removeEventListener("wheel",ut),t.domElement.removeEventListener("pointermove",V),t.domElement.removeEventListener("pointerup",$),t.domElement.getRootNode().removeEventListener("keydown",tt,{capture:!0}),t._domElementKeyEvents!==null&&(t._domElementKeyEvents.removeEventListener("keydown",nt),t._domElementKeyEvents=null)};const t=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=i.NONE;const l=1e-6,r=new f.Spherical,d=new f.Spherical;let h=1;const p=new f.Vector3,m=new f.Vector2,y=new f.Vector2,w=new f.Vector2,A=new f.Vector2,X=new f.Vector2,de=new f.Vector2,ae=new f.Vector2,H=new f.Vector2,F=new f.Vector2,K=new f.Vector3,te=new f.Vector2;let Ee=!1;const W=[],he={};let re=!1;function Me(o){return o!==null?2*Math.PI/60*t.autoRotateSpeed*o:2*Math.PI/60/60*t.autoRotateSpeed}function Oe(o){const x=Math.abs(o*.01);return Math.pow(.95,t.zoomSpeed*x)}function me(o){d.theta-=o}function U(o){d.phi-=o}const pe=function(){const o=new f.Vector3;return function(D,L){o.setFromMatrixColumn(L,0),o.multiplyScalar(-D),p.add(o)}}(),R=function(){const o=new f.Vector3;return function(D,L){t.screenSpacePanning===!0?o.setFromMatrixColumn(L,1):(o.setFromMatrixColumn(L,0),o.crossVectors(t.object.up,o)),o.multiplyScalar(D),p.add(o)}}(),Se=function(){const o=new f.Vector3;return function(D,L){const ee=t.domElement;if(t.object.isPerspectiveCamera){const ge=t.object.position;o.copy(ge).sub(t.target);let ce=o.length();ce*=Math.tan(t.object.fov/2*Math.PI/180),pe(2*D*ce/ee.clientHeight,t.object.matrix),R(2*L*ce/ee.clientHeight,t.object.matrix)}else t.object.isOrthographicCamera?(pe(D*(t.object.right-t.object.left)/t.object.zoom/ee.clientWidth,t.object.matrix),R(L*(t.object.top-t.object.bottom)/t.object.zoom/ee.clientHeight,t.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),t.enablePan=!1)}}();function Te(o){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function De(o){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function Re(o,x){if(!t.zoomToCursor)return;Ee=!0;const D=t.domElement.getBoundingClientRect(),L=o-D.left,ee=x-D.top,ge=D.width,ce=D.height;te.x=L/ge*2-1,te.y=-(ee/ce)*2+1,K.set(te.x,te.y,1).unproject(t.object).sub(t.object.position).normalize()}function _e(o){return Math.max(t.minDistance,Math.min(t.maxDistance,o))}function ke(o){m.set(o.clientX,o.clientY)}function je(o){Re(o.clientX,o.clientX),ae.set(o.clientX,o.clientY)}function Ie(o){A.set(o.clientX,o.clientY)}function ne(o){y.set(o.clientX,o.clientY),w.subVectors(y,m).multiplyScalar(t.rotateSpeed);const x=t.domElement;me(2*Math.PI*w.x/x.clientHeight),U(2*Math.PI*w.y/x.clientHeight),m.copy(y),t.update()}function xe(o){H.set(o.clientX,o.clientY),F.subVectors(H,ae),F.y>0?Te(Oe(F.y)):F.y<0&&De(Oe(F.y)),ae.copy(H),t.update()}function ze(o){X.set(o.clientX,o.clientY),de.subVectors(X,A).multiplyScalar(t.panSpeed),Se(de.x,de.y),A.copy(X),t.update()}function Ge(o){Re(o.clientX,o.clientY),o.deltaY<0?De(Oe(o.deltaY)):o.deltaY>0&&Te(Oe(o.deltaY)),t.update()}function oe(o){let x=!1;switch(o.code){case t.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?U(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(0,t.keyPanSpeed),x=!0;break;case t.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?U(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(0,-t.keyPanSpeed),x=!0;break;case t.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?me(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(t.keyPanSpeed,0),x=!0;break;case t.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?me(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(-t.keyPanSpeed,0),x=!0;break}x&&(o.preventDefault(),t.update())}function v(o){if(W.length===1)m.set(o.pageX,o.pageY);else{const x=Le(o),D=.5*(o.pageX+x.x),L=.5*(o.pageY+x.y);m.set(D,L)}}function b(o){if(W.length===1)A.set(o.pageX,o.pageY);else{const x=Le(o),D=.5*(o.pageX+x.x),L=.5*(o.pageY+x.y);A.set(D,L)}}function T(o){const x=Le(o),D=o.pageX-x.x,L=o.pageY-x.y,ee=Math.sqrt(D*D+L*L);ae.set(0,ee)}function I(o){t.enableZoom&&T(o),t.enablePan&&b(o)}function fe(o){t.enableZoom&&T(o),t.enableRotate&&v(o)}function se(o){if(W.length==1)y.set(o.pageX,o.pageY);else{const D=Le(o),L=.5*(o.pageX+D.x),ee=.5*(o.pageY+D.y);y.set(L,ee)}w.subVectors(y,m).multiplyScalar(t.rotateSpeed);const x=t.domElement;me(2*Math.PI*w.x/x.clientHeight),U(2*Math.PI*w.y/x.clientHeight),m.copy(y)}function M(o){if(W.length===1)X.set(o.pageX,o.pageY);else{const x=Le(o),D=.5*(o.pageX+x.x),L=.5*(o.pageY+x.y);X.set(D,L)}de.subVectors(X,A).multiplyScalar(t.panSpeed),Se(de.x,de.y),A.copy(X)}function C(o){const x=Le(o),D=o.pageX-x.x,L=o.pageY-x.y,ee=Math.sqrt(D*D+L*L);H.set(0,ee),F.set(0,Math.pow(H.y/ae.y,t.zoomSpeed)),Te(F.y),ae.copy(H);const ge=(o.pageX+x.x)*.5,ce=(o.pageY+x.y)*.5;Re(ge,ce)}function z(o){t.enableZoom&&C(o),t.enablePan&&M(o)}function J(o){t.enableZoom&&C(o),t.enableRotate&&se(o)}function _(o){t.enabled!==!1&&(W.length===0&&(t.domElement.setPointerCapture(o.pointerId),t.domElement.addEventListener("pointermove",V),t.domElement.addEventListener("pointerup",$)),!Dt(o)&&(Rt(o),o.pointerType==="touch"?at(o):Pe(o)))}function V(o){t.enabled!==!1&&(o.pointerType==="touch"?ht(o):qe(o))}function $(o){switch(_t(o),W.length){case 0:t.domElement.releasePointerCapture(o.pointerId),t.domElement.removeEventListener("pointermove",V),t.domElement.removeEventListener("pointerup",$),t.dispatchEvent(Jt),c=i.NONE;break;case 1:const x=W[0],D=he[x];at({pointerId:x,pageX:D.x,pageY:D.y});break}}function Pe(o){let x;switch(o.button){case 0:x=t.mouseButtons.LEFT;break;case 1:x=t.mouseButtons.MIDDLE;break;case 2:x=t.mouseButtons.RIGHT;break;default:x=-1}switch(x){case f.MOUSE.DOLLY:if(t.enableZoom===!1)return;je(o),c=i.DOLLY;break;case f.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(t.enablePan===!1)return;Ie(o),c=i.PAN}else{if(t.enableRotate===!1)return;ke(o),c=i.ROTATE}break;case f.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(t.enableRotate===!1)return;ke(o),c=i.ROTATE}else{if(t.enablePan===!1)return;Ie(o),c=i.PAN}break;default:c=i.NONE}c!==i.NONE&&t.dispatchEvent(Pt)}function qe(o){switch(c){case i.ROTATE:if(t.enableRotate===!1)return;ne(o);break;case i.DOLLY:if(t.enableZoom===!1)return;xe(o);break;case i.PAN:if(t.enablePan===!1)return;ze(o);break}}function ut(o){t.enabled===!1||t.enableZoom===!1||c!==i.NONE||(o.preventDefault(),t.dispatchEvent(Pt),Ge(dt(o)),t.dispatchEvent(Jt))}function dt(o){const x=o.deltaMode,D={clientX:o.clientX,clientY:o.clientY,deltaY:o.deltaY};switch(x){case 1:D.deltaY*=16;break;case 2:D.deltaY*=100;break}return o.ctrlKey&&!re&&(D.deltaY*=10),D}function tt(o){o.key==="Control"&&(re=!0,t.domElement.getRootNode().addEventListener("keyup",Ne,{passive:!0,capture:!0}))}function Ne(o){o.key==="Control"&&(re=!1,t.domElement.getRootNode().removeEventListener("keyup",Ne,{passive:!0,capture:!0}))}function nt(o){t.enabled===!1||t.enablePan===!1||oe(o)}function at(o){switch(ft(o),W.length){case 1:switch(t.touches.ONE){case f.TOUCH.ROTATE:if(t.enableRotate===!1)return;v(o),c=i.TOUCH_ROTATE;break;case f.TOUCH.PAN:if(t.enablePan===!1)return;b(o),c=i.TOUCH_PAN;break;default:c=i.NONE}break;case 2:switch(t.touches.TWO){case f.TOUCH.DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;I(o),c=i.TOUCH_DOLLY_PAN;break;case f.TOUCH.DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;fe(o),c=i.TOUCH_DOLLY_ROTATE;break;default:c=i.NONE}break;default:c=i.NONE}c!==i.NONE&&t.dispatchEvent(Pt)}function ht(o){switch(ft(o),c){case i.TOUCH_ROTATE:if(t.enableRotate===!1)return;se(o),t.update();break;case i.TOUCH_PAN:if(t.enablePan===!1)return;M(o),t.update();break;case i.TOUCH_DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;z(o),t.update();break;case i.TOUCH_DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;J(o),t.update();break;default:c=i.NONE}}function Ke(o){t.enabled!==!1&&o.preventDefault()}function Rt(o){W.push(o.pointerId)}function _t(o){delete he[o.pointerId];for(let x=0;x<W.length;x++)if(W[x]==o.pointerId){W.splice(x,1);return}}function Dt(o){for(let x=0;x<W.length;x++)if(W[x]==o.pointerId)return!0;return!1}function ft(o){let x=he[o.pointerId];x===void 0&&(x=new f.Vector2,he[o.pointerId]=x),x.set(o.pageX,o.pageY)}function Le(o){const x=o.pointerId===W[0]?W[1]:W[0];return he[x]}t.domElement.addEventListener("contextmenu",Ke),t.domElement.addEventListener("pointerdown",_),t.domElement.addEventListener("pointercancel",$),t.domElement.addEventListener("wheel",ut,{passive:!1}),t.domElement.getRootNode().addEventListener("keydown",tt,{passive:!0,capture:!0}),this.update()}}function Qe(e,n,a,t,i){return t+(e-n)*(i-t)/(a-n)}const xt=e=>{const[n,a]=E.useState(e.options[e.index]),t=()=>{e.onToggle(!e.open)},i=c=>{c!==n&&(e.onSelect(c),a(c)),e.onToggle(!1)};return u.jsxs("div",{className:`dropdown ${e.up===!0?"up":""}`,children:[u.jsx("div",{className:"dropdown-toggle",onClick:t,children:n}),e.open&&u.jsx("ul",{className:"dropdown-menu",children:e.options.map(c=>u.jsx("li",{onClick:()=>i(c),children:c},c))})]})},We=E.forwardRef(function(n,a){const[t,i]=E.useState(!1),c=n.options.indexOf(n.camera.name);return u.jsxs("div",{className:"CameraWindow",children:[u.jsx("div",{ref:a,className:"clickable",onClick:()=>{t&&i(!1)}}),u.jsx(xt,{index:c,open:t,options:n.options,onSelect:n.onSelect,onToggle:l=>{i(l)},up:!0})]})});class ma extends f.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:f.GLSL3,side:f.DoubleSide,transparent:!0,uniforms:{uScale:{value:n?.scale!==void 0?n?.scale:.1},uDivisions:{value:n?.divisions!==void 0?n?.divisions:10},uColor:{value:n?.color!==void 0?n?.color:new f.Color(16777215)},uDistance:{value:n?.distance!==void 0?n?.distance:1e4},uSubgridOpacity:{value:n?.subgridOpacity!==void 0?n?.subgridOpacity:.15},uGridOpacity:{value:n?.gridOpacity!==void 0?n?.gridOpacity:.25}},vertexShader:`out vec3 worldPosition;
|
29
|
+
C11,8.22,10.74,8,10.43,8z`})});function on(e){return u.jsx(en.Reorder.Item,{value:e.title,children:u.jsxs("div",{children:[Ln,u.jsx("span",{children:e.title}),u.jsx("button",{className:"closeIcon",onClick:()=>{e.onDelete(e.index)},children:Nn})]})},e.title)}function cn(e){const[n,a]=E.useState(!1),[t,i]=E.useState(e.options),c=h=>{e.onDragComplete(h),i(h)},l=h=>{const p=[...t];p.splice(h,1),c(p)},r=[];t.forEach((h,p)=>{r.push(u.jsx(on,{index:p,title:h,onDelete:l},h))});let d="dropdown draggable";return e.subdropdown&&(d+=" subdropdown"),u.jsxs("div",{className:d,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[u.jsx(Bt,{title:e.title}),u.jsx(en.Reorder.Group,{axis:"y",values:t,onReorder:c,style:{visibility:n?"visible":"hidden"},children:r})]})}function ln(e){const[n,a]=E.useState(!1),t=[];e.options.map((c,l)=>{e.onSelect!==void 0&&(c.onSelect=e.onSelect),t.push(u.jsx(un,{option:c},l))});let i="dropdown";return e.subdropdown&&(i+=" subdropdown"),u.jsxs("div",{className:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[u.jsx(Bt,{title:e.title}),u.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:t})]})}function un(e){const{option:n}=e,[a,t]=E.useState("");let i;switch(n.type){case"draggable":i=u.jsx(cn,{title:n.title,options:n.value,onDragComplete:c=>{n.onDragComplete!==void 0&&n.onDragComplete(c)},subdropdown:!0});break;case"dropdown":i=u.jsx(ln,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":i=u.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(a!==n.title?t(n.title):t(""))},children:n.title});break}return u.jsx("li",{className:a===n.title?"selected":"",children:i},tn())}function Fn(e,n,a){function t(c){switch(n.forEach(l=>{l.callback(e,l.remote,c)}),c.event){case"custom":D.dispatchEvent({type:P.CUSTOM,value:c.data});break}}function i(c){switch(a.forEach(l=>{l.callback(e,l.remote,c)}),c.event){case"custom":D.dispatchEvent({type:P.CUSTOM,value:c.data});break}}e.listen=c=>{c.target==="editor"?i(c):t(c)}}function Ot(e){const[n,a]=E.useState(e.open!==void 0?e.open:!0),t=!n||e.children===void 0;return u.jsxs("div",{className:`accordion ${t?"hide":""}`,children:[u.jsxs("button",{className:"toggle",onClick:()=>{const i=!n;e.onToggle!==void 0&&e.onToggle(i),a(i)},children:[u.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),u.jsx("p",{className:"label",children:ct(e.label)})]}),e.button,u.jsx("div",{className:n?"open":"",children:u.jsx("div",{children:e.children})})]})}function Vt(e){const n=E.useRef(null),[a,t]=E.useState(!1),i=e.child!==void 0&&e.child.children.length>0,c=[];return e.child!==void 0&&e.child.children.length>0&&e.child.children.map((l,r)=>{c.push(u.jsx(Vt,{child:l,three:e.three},r))}),E.useEffect(()=>{const l=e.child.uuid,r=e.three.getScene(l);if(r!==null){const d=r.getObjectByProperty("uuid",l);d!==void 0&&(n.current.style.opacity=d.visible?"1":"0.25")}},[]),u.jsx(u.Fragment,{children:e.child!==void 0&&u.jsxs("div",{className:"childObject",children:[u.jsxs("div",{className:"child",children:[i?u.jsx("button",{className:"status",style:{backgroundPositionX:a?"-14px":"2px"},onClick:()=>{t(!a)}}):null,u.jsx("button",{className:"name",style:{left:i?"20px":"5px"},onClick:()=>{e.child!==void 0&&(e.three.getObject(e.child.uuid),a||t(!0))},children:e.child.name.length>0?`${e.child.name} (${e.child.type})`:`${e.child.type}::${e.child.uuid}`}),u.jsx("button",{className:"visibility",ref:n,onClick:()=>{if(e.child){const l=e.three.getScene(e.child.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",e.child.uuid);if(r!==void 0){const d="visible",h=!r.visible;n.current.style.opacity=h?"1":"0.25",e.three.updateObject(e.child.uuid,d,h),J(r,d,h)}}}}}),u.jsx("div",{className:`icon ${Tn(e.child)}`})]}),u.jsx("div",{className:a?"open":"",children:u.jsx("div",{className:"container",children:c})})]},Math.random())})}function dn(e){const n=[];return e.child?.children.map((a,t)=>{n.push(u.jsx(Vt,{child:a,scene:e.scene,three:e.three},t))}),u.jsx("div",{className:`scene ${e.class!==void 0?e.class:""}`,children:n})}const Un="data:image/gif;base64,R0lGODlhDgFkAIAAAP///wAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDIgNzkuZGJhM2RhM2I1LCAyMDIzLzEyLzE1LTEwOjQyOjM3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjUuNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoyMDk3M0NEODAxQjQxMUVGODVGNENDMkUyMUExNDk1NSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMDk3M0NEOTAxQjQxMUVGODVGNENDMkUyMUExNDk1NSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkE4ODc3Qzg5MDFCMzExRUY4NUY0Q0MyRTIxQTE0OTU1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkE4ODc3QzhBMDFCMzExRUY4NUY0Q0MyRTIxQTE0OTU1Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAA4BZAAAAv+Mj6nL7Q+jnLTai7PevPsPhuJIluaJpurKtu4Lx/JM1/aN5/rO9/4PDAqHxKLxiEwql8ym8wmNSqfUqvWKzWq33K73Cw6Lx+Sy+YxOq9fstvsNj8vn9Lr9js/r9/y+/w8YKDhIWGh4iJiouMjY6PgIGSk5SVlpeYmZqTkJAGDQ+dnpuekmGgAKejpKuiZqmprKqoZKGyrbOlqrejub6xvLGyw8TFzcprurGuvqybxq7ETbrItsCz0l7Zpc+6p9/cS967w9/S2FTF0u/mzehK4Oqz3eTl9vf4+fr7/P3+//DzCgwIEECxo8iDChwoUMGzp8CDGixIkUK1q8iDGjxo0XHDt6/AgypMiRJEuaPIkypcqVLFt+KwAAOw==";function Bn(e){return"items"in e}function Ye(e){const n=[];return e.items.forEach(a=>{Bn(a)?n.push(u.jsx(Ye,{title:ct(a.title),items:a.items},Math.random())):n.push(u.jsx(St,{title:a.title,prop:a.prop,value:a.value,type:a.type,min:a.min,max:a.max,step:a.step,disabled:a.disabled,options:a.options,onChange:(t,i)=>{a.onChange!==void 0&&a.onChange(t,i)},onKeyDown:t=>{a.onKeyDown!==void 0&&a.onKeyDown(t)}},Math.random()))}),u.jsx(Ot,{label:e.title,open:e.expanded===!0,children:n})}function Vn(e){return!(e==="alphaHash"||e==="alphaToCoverage"||e==="attenuationDistance"||e==="blendAlpha"||e==="blendColor"||e==="blendDstAlpha"||e==="colorWrite"||e==="combine"||e==="defaultAttributeValues"||e==="depthFunc"||e==="forceSinglePass"||e==="glslVersion"||e==="linecap"||e==="linejoin"||e==="linewidth"||e==="normalMapType"||e==="precision"||e==="premultipliedAlpha"||e==="shadowSide"||e==="toneMapped"||e==="uniformsGroups"||e==="uniformsNeedUpdate"||e==="userData"||e==="vertexColors"||e==="version"||e==="wireframeLinecap"||e==="wireframeLinejoin"||e==="wireframeLinewidth"||e.slice(0,4)==="clip"||e.slice(0,7)==="polygon"||e.slice(0,7)==="stencil"||e.slice(0,2)==="is")}function zn(e){switch(e){case"Alpha Map":return"alphaMap";case"Anisotropy Map":return"anisotropyMap";case"AO Map":return"aoMap";case"Bump Map":return"bumpMap";case"Clearcoat Map":return"clearcoatMap";case"Clearcoat Normal Map":return"clearcoatNormalMap";case"Clearcoat Roughness Map":return"clearcoatRoughnessMap";case"Displacement Map":return"displacementMap";case"Emissive Map":return"emissiveMap";case"Iridescence Map":return"iridescenceMap";case"Iridescence Thickness Map":return"iridescenceThicknessMap";case"Map":return"map";case"Matcap":return"matcap";case"Normal Map":return"normalMap";case"Roughness Map":return"roughnessMap";case"Sheen Color Map":return"sheenColorMap";case"Sheen Roughness Map":return"sheenRoughnessMap";case"Specular Color Map":return"specularColorMap";case"Specular Map Intensity":return"specularIntensityMap";case"Thickness Map":return"thicknessMap";case"Transmission Map":return"transmissionMap"}return e}function Tt(e){switch(e){case"alphaMap":return"Alpha Map";case"anisotropyMap":return"Anisotropy Map";case"anisotropyRotation":return"Anisotropy Rotation";case"aoMap":return"AO Map";case"aoMapIntensity":return"AO Map Intensity";case"attenuationColor":return"Attenuation Color";case"blendAlpha":return"Blend Alpha";case"blendColor":return"Blend Color";case"blendDst":return"Blend Dst";case"blendDstAlpha":return"Blend Dst Alha";case"blendEquation":return"Blend Equation";case"blendEquationAlpha":return"Blend Equation Alpha";case"blending":return"Blending";case"blendSrc":return"Blend Src";case"blendSrcAlpha":return"Blend Src Alpha";case"bumpMap":return"Bump Map";case"bumpScale":return"Bump Scale";case"clearcoatMap":return"Clearcoat Map";case"clearcoatNormalMap":return"Clearcoat Normal Map";case"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";case"clearcoatRoughnessMap":return"Clearcoat Roughness Map";case"color":return"Color";case"defines":return"Defines";case"depthTest":return"Depth Test";case"depthWrite":return"Depth Write";case"displacementBias":return"Displacement Bias";case"displacementMap":return"Displacement Map";case"displacementScale":return"Displacement Scale";case"dithering":return"Dithering";case"emissive":return"Emissive";case"emissiveMap":return"Emissive Map";case"emissiveIntensity":return"Emissive Intensity";case"envMap":return"Environment Map";case"envMapIntensity":return"Environment Map Intensity";case"extensions":return"Extensions";case"flatShading":return"Flat Shading";case"fragmentShader":return"Fragment Shader";case"fog":return"Fog";case"gradientMap":return"Gradient Map";case"ior":return"IOR";case"iridescenceIOR":return"Iridescence IOR";case"iridescenceMap":return"Iridescence Map";case"iridescenceThicknessMap":return"Iridescence Thickness Map";case"iridescenceThicknessRange":return"Iridescence Thickness Range";case"lights":return"Lights";case"lightMap":return"Light Map";case"lightMapIntensity":return"Light Map Intensity";case"map":return"Map";case"matcap":return"Matcap";case"metalness":return"Metalness";case"metalnessMap":return"Metalness Map";case"name":return"Name";case"normalMap":return"Normal Map";case"normalScale":return"Normal Scale";case"opacity":return"Opacity";case"reflectivity":return"Reflectivity";case"refractionRatio":return"Refraction Ratio";case"roughness":return"Roughness";case"roughnessMap":return"Roughness Map";case"sheenColor":return"Sheen Color";case"sheenColorMap":return"Sheen Color Map";case"sheenRoughness":return"Sheen Roughness";case"sheenRoughnessMap":return"Sheen Roughness Map";case"shininess":return"Shininess";case"side":return"Side";case"size":return"Size";case"sizeAttenuation":return"Size Attenuation";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularColorMap":return"Specular Color Map";case"specularIntensity":return"Specular Intensity";case"specularIntensityMap":return"Specular Map Intensity";case"thickness":return"Thickness";case"thicknessMap":return"Thickness Map";case"transmission":return"Transmission";case"transmissionMap":return"Transmission Map";case"transparent":return"Transparent";case"type":return"Type";case"uuid":return"UUID";case"uniforms":return"Uniforms";case"vertexShader":return"Vertex Shader";case"visible":return"Visible";case"wireframe":return"Wireframe"}return e}function hn(e){const n=e.toLowerCase();return n.search("intensity")>-1||n==="anisotropyrotation"||n==="blendalpha"||n==="bumpscale"||n==="clearcoatroughness"||n==="displacementbias"||n==="displacementscale"||n==="metalness"||n==="opacity"||n==="reflectivity"||n==="refractionratio"||n==="roughness"||n==="sheenroughness"||n==="thickness"}function Gn(){const e=document.createElement("input");return e.type="file",new Promise((n,a)=>{e.addEventListener("change",function(){if(e.files===null)a();else{const t=e.files[0],i=new FileReader;i.onload=function(c){n(c.target.result)},i.readAsDataURL(t)}}),e.click()})}const Hn=[{title:"Front",value:f.FrontSide},{title:"Back",value:f.BackSide},{title:"Double",value:f.DoubleSide}],Wn=[{title:"No Blending",value:f.NoBlending},{title:"Normal",value:f.NormalBlending},{title:"Additive",value:f.AdditiveBlending},{title:"Subtractive",value:f.SubtractiveBlending},{title:"Multiply",value:f.MultiplyBlending},{title:"Custom",value:f.CustomBlending}],$n=[{title:"Add",value:f.AddEquation},{title:"Subtract",value:f.SubtractEquation},{title:"Reverse Subtract",value:f.ReverseSubtractEquation},{title:"Min",value:f.MinEquation},{title:"Max",value:f.MaxEquation}],Yn=[{title:"Zero",valye:f.ZeroFactor},{title:"One",valye:f.OneFactor},{title:"Src Color",valye:f.SrcColorFactor},{title:"One Minus Src Color",valye:f.OneMinusSrcColorFactor},{title:"Src Alpha",valye:f.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:f.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:f.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:f.OneMinusDstAlphaFactor},{title:"Dst Color",valye:f.DstColorFactor},{title:"One Minus Dst Color",valye:f.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:f.SrcAlphaSaturateFactor},{title:"Constant Color",valye:f.ConstantColorFactor},{title:"One Minus Constant Color",valye:f.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:f.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:f.OneMinusConstantAlphaFactor}],qn=[{title:"Zero",valye:f.ZeroFactor},{title:"One",valye:f.OneFactor},{title:"Src Color",valye:f.SrcColorFactor},{title:"One Minus Src Color",valye:f.OneMinusSrcColorFactor},{title:"Src Alpha",valye:f.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:f.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:f.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:f.OneMinusDstAlphaFactor},{title:"Dst Color",valye:f.DstColorFactor},{title:"One Minus Dst Color",valye:f.OneMinusDstColorFactor},{title:"Constant Color",valye:f.ConstantColorFactor},{title:"One Minus Constant Color",valye:f.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:f.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:f.OneMinusConstantAlphaFactor}];function st(e,n){e.needsUpdate=!0,e.type="option",e.options=n}function Kn(e,n,a,t){return{type:"boolean",title:Tt(e),prop:e,value:n,needsUpdate:!0,onChange:(i,c)=>{t.updateObject(a.uuid,`material.${e}`,c),t.updateObject(a.uuid,"material.needsUpdate",!0);const l=t.getScene(a.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",a.uuid);r!==void 0&&J(r,`material.${e}`,c)}}}}function Zn(e,n,a,t){const i={type:"number",title:Tt(e),prop:e,value:n,min:void 0,max:void 0,step:.01,needsUpdate:!0,onChange:(c,l)=>{t.updateObject(a.uuid,`material.${e}`,l),t.updateObject(a.uuid,"material.needsUpdate",!0);const r=t.getScene(a.uuid);if(r!==null){const d=r.getObjectByProperty("uuid",a.uuid);d!==void 0&&J(d,`material.${e}`,l)}}};switch(e){case"blending":st(i,Wn);break;case"blendDst":st(i,qn);break;case"blendEquation":st(i,$n);break;case"blendSrc":st(i,Yn);break;case"side":st(i,Hn);break}return hn(e)&&(i.value=Number(n),i.type="range",i.min=Math.min(0,i.value),i.max=Math.max(1,i.value),i.step=.01),i}function Xn(e,n,a,t){const i={type:"string",title:Tt(e),prop:e,value:n,needsUpdate:!0,onChange:(l,r)=>{t.updateObject(a.uuid,`material.${e}`,r),t.updateObject(a.uuid,"material.needsUpdate",!0);const d=t.getScene(a.uuid);if(d!==null){const h=d.getObjectByProperty("uuid",a.uuid);h!==void 0&&J(h,`material.${e}`,r)}},onKeyDown:l=>{}};return(e==="vertexShader"||e==="fragmentShader")&&(i.disabled=!1,i.latest=i.value,i.onChange=(l,r)=>{i.latest=r,t.updateObject(a.uuid,`material.${e}`,r);const d=t.getScene(a.uuid);if(d!==null){const h=d.getObjectByProperty("uuid",a.uuid);h!==void 0&&J(h,`material.${e}`,r)}},i.onKeyDown=l=>{if(l.key==="Enter"&&(l.altKey||l.metaKey)){t.updateObject(a.uuid,"material.needsUpdate",!0);const r=t.getScene(a.uuid);if(r!==null){const d=r.getObjectByProperty("uuid",a.uuid);d!==void 0&&J(d,"material.needsUpdate",!0)}}}),i}function Jn(e){return e.x!==void 0&&e.y!==void 0&&e.z===void 0}function Qn(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w===void 0}function ea(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w!==void 0}function Ut(e){e.sort((n,a)=>n.title<a.title?-1:n.title>a.title?1:0)}function ot(e,n,a,t,i="",c=!1){const l=Tt(e).split(".")[0].replaceAll("[","").replaceAll("]",""),r=i.length>0?`${i}.${e}`:e,d=typeof n;if(d==="boolean"||d==="string")return{title:l,prop:r,type:d,value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const v=m.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${r}`,p)}}};if(d==="number"){const h={title:l,prop:r,type:"number",value:n,step:.01,disabled:c,onChange:(p,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const v=t.getScene(a.uuid);if(v!==null){const w=v.getObjectByProperty("uuid",a.uuid);w!==void 0&&J(w,`material.${r}`,m)}}};return hn(l)&&(h.type="range",h.min=0,h.max=1),h}else{if(n.isColor)return{title:l,prop:r,type:"color",value:n,disabled:c,onChange:(h,p)=>{const m=new f.Color(p);t.updateObject(a.uuid,`material.${r}`,m);const v=t.getScene(a.uuid);if(v!==null){const w=v.getObjectByProperty("uuid",a.uuid);w!==void 0&&J(w,`material.${r}`,m)}}};if(Array.isArray(n)){const h=[];for(const p in n){const m=n[p],v=`[${p.toString()}]`;if(m.value!==void 0){const w=ot(`${v}.value`,m.value,a,t,r,c);w!==void 0&&h.push(w)}else{const w=ot(v,m,a,t,r,c);w!==void 0&&h.push(w)}}if(h.length>0)return Ut(h),{title:l,items:h}}else{if(Jn(n))return{title:l,prop:r,type:"vector2",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const v=m.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${r}`,p)}}};if(Qn(n))return{title:l,prop:r,type:"grid3",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const v=m.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${r}`,p)}}};if(ea(n))return{title:l,prop:r,type:"grid4",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const v=m.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${r}`,p)}}};if(n.isEuler)return{title:l,prop:r,type:"euler",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const v=m.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${r}`,p)}}};if(n.src!==void 0)return{title:l,type:"image",value:n,disabled:c,onChange:(h,p)=>{const m=zn(e),v=i.length>0?`${i}.${m}`:m;t.createTexture(a.uuid,`material.${v}`,p);const w=t.getScene(a.uuid);if(w!==null){const j=w.getObjectByProperty("uuid",a.uuid);j!==void 0&&sn(p).then(q=>{const Q=j.material,I=v.split(".");switch(I.length){case 1:Q[I[0]]=q;break;case 2:Q[I[0]][I[1]]=q;break;case 3:Q[I[0]][I[1]][I[2]]=q;break;case 4:Q[I[0]][I[1]][I[2]][I[3]]=q;break;case 5:Q[I[0]][I[1]][I[2]][I[3]][I[4]]=q;break}Q.needsUpdate=!0})}}};if(n.elements!==void 0)return{title:l,prop:r,type:n.elements.length>9?"grid4":"grid3",value:n,disabled:c,onChange:(h,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const m=t.getScene(a.uuid);if(m!==null){const v=m.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${r}`,p)}}};{const h=[],p=e==="defines"||e==="extensions";try{for(const m in n){const v=n[m];if(v!==void 0)if(v.value!==void 0){const w=ot(`${m}.value`,v.value,a,t,r,p);w!==void 0&&h.push(w)}else{const w=ot(m,v,a,t,r,p);w!==void 0&&h.push(w)}}}catch{console.log("Issue cycling through material object:",e,n)}if(h.length>0)return Ut(h),{title:l,items:h}}}}}function Yt(e,n,a){const t=[];for(const i in e){if(!Vn(i))continue;const c=typeof e[i],l=e[i];if(c==="boolean")t.push(Kn(i,l,n,a));else if(c==="number")t.push(Zn(i,l,n,a));else if(c==="string")t.push(Xn(i,l,n,a));else if(c==="object"){const r=ot(i,l,n,a);r!==void 0&&t.push(r)}else l!==void 0&&console.log("other:",i,c,l)}return Ut(t),t.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0);const i=a.getScene(n.uuid);if(i!==null){const c=i.getObjectByProperty("uuid",n.uuid);c!==void 0&&J(c,"material.needsUpdate",!0)}}}),t}function ta(e,n){const a=e.material;if(Array.isArray(a)){const t=[],i=a.length;for(let c=0;c<i;c++)t.push(u.jsx(Ye,{title:`Material ${c}`,items:Yt(a[c],e,n)},`Material ${c}`));return u.jsx(u.Fragment,{children:t})}else return u.jsx(Ye,{title:"Material",items:Yt(a,e,n)})}function na(e){const[n,a]=E.useState(e.defaultValue);return E.useEffect(()=>{let t=!1,i=-1,c=0,l=e.defaultValue;const r=v=>{t=!0,c=Number(e.input.current?.value),i=v.clientX,document.addEventListener("mouseup",h,!1),document.addEventListener("mousemove",d,!1),document.addEventListener("contextmenu",h,!1)},d=v=>{if(!t)return;const w=e.step!==void 0?e.step:1,j=(v.clientX-i)*w;l=Number((c+j).toFixed(4)),e.min!==void 0&&(l=Math.max(l,e.min)),e.max!==void 0&&(l=Math.min(l,e.max)),e.onChange!==void 0&&e.onChange(l),a(l)},h=()=>{t=!1,document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",d),document.removeEventListener("contextmenu",h)},p=v=>{const w=Number(v.target.value);a(w)},m=v=>{const w=Number(v.target.value);e.onChange!==void 0&&e.onChange(w),a(w)};return e.input.current?.addEventListener("input",p),e.label.current?.addEventListener("mousedown",r,!1),e.sliderRef!==void 0&&e.sliderRef.current?.addEventListener("input",m),()=>{e.input.current?.removeEventListener("input",p),e.label.current?.removeEventListener("mousedown",r),e.sliderRef!==void 0&&e.sliderRef.current?.removeEventListener("input",m),document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",d),document.removeEventListener("contextmenu",h)}},[]),n}function $e(e){const n=E.useRef(null),a=E.useRef(null),t=na({label:e.labelRef,input:n,sliderRef:a,defaultValue:e.value,min:e.min,max:e.max,step:e.step,onChange:i=>{e.onChange!==void 0&&e.onChange(e.prop,i)}});return u.jsxs(u.Fragment,{children:[e.type==="number"&&u.jsx("input",{alt:e.alt,className:e.className,ref:n,type:"number",value:t,min:e.min,max:e.max,step:e.step,disabled:e.disabled,onChange:i=>{const c=Number(i.target.value);e.onChange!==void 0&&e.onChange(e.prop,c)}}),e.type==="range"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:t.toString(),disabled:e.disabled,ref:n,className:"min",onChange:i=>{const c=Number(i.target.value);e.onChange!==void 0&&e.onChange(e.prop,c)}}),u.jsx("input",{disabled:e.disabled,type:"range",value:t,min:e.min,max:e.max,step:e.step,ref:a,onChange:wt})]})]})}function aa(e){const n=E.useRef(null),a=E.useRef(null),t=E.useRef(null),i=E.useRef(null),c=E.useRef(null),l=E.useRef(null),[r,d]=E.useState(e.value),[h,p]=E.useState({min:Math.min(e.min,Math.min(e.value.x,e.value.y)),max:Math.max(e.max,Math.max(e.value.x,e.value.y))}),[m,v]=E.useState(!1);function w(){m||(window.addEventListener("mousemove",q),window.addEventListener("mouseup",j),window.addEventListener("mouseup",j),v(!0))}function j(){window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",j),v(!1)}function q(U){const Z=c.current.getBoundingClientRect(),ae=Ve(0,99,U.clientX-Z.left)/99,Ee=Ve(0,99,U.clientY-Z.top)/99,$=Nt(It(h.min,h.max,ae),3),he=Nt(It(h.min,h.max,Ee),3);e.onChange({target:{value:{x:$,y:he}}}),d({x:$,y:he})}function Q(U){let Z=r.x,ae=r.y;U.target===n.current?Z=Number(U.target.value):ae=Number(U.target.value),d({x:Z,y:ae})}function I(){const U=Number(t.current.value);p({min:U,max:h.max}),(r.x<U||r.y<U)&&d({x:Ve(U,h.max,r.x),y:Ve(U,h.max,r.y)})}function G(){const U=Number(i.current.value);p({min:h.min,max:U}),(r.x>U||r.y>U)&&d({x:Ve(h.min,U,r.x),y:Ve(h.min,U,r.y)})}return E.useEffect(()=>{const U=jt(h.min,h.max,r.x),Z=jt(h.min,h.max,r.y);l.current.style.left=`${U*100}%`,l.current.style.top=`${Z*100}%`},[h,r]),u.jsxs("div",{className:"vector2",children:[u.jsxs("div",{className:"fields",children:[u.jsxs("div",{children:[u.jsx("label",{children:"X:"}),u.jsx("input",{ref:n,type:"number",value:r.x,min:h.min,max:h.max,step:.01,onChange:Q})]}),u.jsxs("div",{children:[u.jsx("label",{children:"Y:"}),u.jsx("input",{ref:a,type:"number",value:r.y,min:h.min,max:h.max,step:.01,onChange:Q})]}),u.jsxs("div",{children:[u.jsx("label",{children:"Min:"}),u.jsx("input",{ref:t,type:"number",value:h.min,step:.01,onChange:I})]}),u.jsxs("div",{children:[u.jsx("label",{children:"Max:"}),u.jsx("input",{ref:i,type:"number",value:h.max,step:.01,onChange:G})]})]}),u.jsxs("div",{className:"input",ref:c,onMouseDown:w,onMouseUp:j,children:[u.jsx("div",{className:"x"}),u.jsx("div",{className:"y"}),u.jsx("div",{className:"pt",ref:l})]})]})}function qt(e){const n=e.value.isVector3!==void 0,a=e.value.isEuler!==void 0,t=e.value.elements!==void 0,i=[];if(n){const c=E.useMemo(()=>e.value,[]),l=(d,h)=>{c[d]=h,e.onChange({target:{value:c}})};["x","y","z"].forEach(d=>{const h=E.useRef(null);i.push(u.jsxs("div",{children:[u.jsx("label",{ref:h,children:d.toUpperCase()}),u.jsx($e,{value:c[d],type:"number",prop:d,step:.01,labelRef:h,onChange:l})]},d))})}else if(a){const c=E.useMemo(()=>e.value,[]),l=(d,h)=>{c[d]=h,e.onChange({target:{value:c}})};["_x","_y","_z"].forEach(d=>{const h=E.useRef(null);i.push(u.jsxs("div",{children:[u.jsx("label",{ref:h,children:d.substring(1).toUpperCase()}),u.jsx($e,{value:c[d],type:"number",prop:d,step:.01,labelRef:h,onChange:l})]},d))})}else if(t){const c=E.useMemo(()=>e.value,[]),l=(r,d)=>{const h=Number(r);c.elements[h]=d,e.onChange({target:{value:c}})};for(let r=0;r<9;r++){const d=E.useRef(null);i.push(u.jsxs("div",{children:[u.jsx("label",{ref:d,children:r+1}),u.jsx($e,{value:c.elements[r],type:"number",prop:r.toString(),step:.01,labelRef:d,onChange:l})]},r.toString()))}}return u.jsx("div",{className:"grid3",children:i},Math.random().toString())}function ia(e){const n=e.value.x!==void 0,a=[];if(n){const t=E.useMemo(()=>e.value,[]),i=(l,r)=>{t[l]=r,e.onChange({target:{value:t}})};["x","y","z","w"].forEach(l=>{const r=E.useRef(null);a.push(u.jsxs("div",{children:[u.jsx("label",{ref:r,children:l.toUpperCase()}),u.jsx($e,{value:t.x,type:"number",prop:l,step:.01,labelRef:r,onChange:i})]},l))})}else{const t=E.useMemo(()=>e.value,[]),i=(c,l)=>{const r=Number(c);t.elements[r]=l,e.onChange({target:{value:t}})};for(let c=0;c<16;c++){const l=E.useRef(null);a.push(u.jsxs("div",{children:[u.jsx("label",{ref:l,children:c+1}),u.jsx($e,{value:t.elements[c],type:"number",prop:c.toString(),step:.01,labelRef:l,onChange:i})]},c.toString()))}}return u.jsx("div",{className:"grid4",children:a})}function St(e){let n=e.value;n!==void 0&&n.isColor!==void 0&&(n=an(e.value));const[a,t]=E.useState(n),i=E.useRef(null),c=E.useRef(null),l=p=>{let m=p.target.value;e.type==="boolean"?m=p.target.checked:e.type==="option"&&(m=e.options[m].value),t(m),e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,m)},r={};e.disabled&&(r.opacity=.8);const d=e.type==="string"&&(a.length>100||a.search(`
|
30
|
+
`)>-1),h=d||e.type==="image"||e.type==="vector2";return u.jsxs("div",{className:`field ${h?"block":""}`,style:r,children:[e.type!=="button"&&u.jsx("label",{ref:i,children:ct(e.title)},"fieldLabel"),e.type==="string"&&!d&&u.jsx("input",{type:"text",disabled:e.disabled,onChange:l,value:a}),e.type==="string"&&d&&u.jsx("textarea",{cols:50,rows:10,disabled:e.disabled!==void 0?e.disabled:!0,onChange:l,onKeyDown:p=>{e.onKeyDown!==void 0&&e.onKeyDown(p)},value:a}),e.type==="boolean"&&u.jsx("input",{type:"checkbox",disabled:e.disabled,onChange:l,checked:a}),e.type==="number"&&u.jsx($e,{value:a,type:e.type,prop:e.prop!==void 0?e.prop:e.title,min:e.min,max:e.max,step:e.step,disabled:e.disabled,labelRef:i,onChange:e.onChange}),e.type==="range"&&u.jsx($e,{value:a,type:e.type,prop:e.prop!==void 0?e.prop:e.title,min:e.min,max:e.max,step:e.step,disabled:e.disabled,labelRef:i,onChange:e.onChange}),e.type==="color"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:a.toString(),onChange:l,disabled:e.disabled,className:"color"}),u.jsx("input",{type:"color",value:a,onChange:l,disabled:e.disabled})]}),e.type==="button"&&u.jsx("button",{disabled:e.disabled,onClick:()=>{e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,!0)},children:e.title}),e.type==="image"&&u.jsx("img",{alt:e.title,ref:c,onClick:()=>{Gn().then(p=>{c.current.src=p,e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,p)})},src:a.src.length>0?a.src:Un}),e.type==="option"&&u.jsx(u.Fragment,{children:u.jsx("select",{onChange:l,disabled:e.disabled,defaultValue:e.value,children:e.options?.map((p,m)=>u.jsx("option",{value:p.value,children:ct(p.title)},m))})}),e.type==="vector2"&&u.jsx(aa,{value:a,min:0,max:1,onChange:l}),e.type==="grid3"&&u.jsx(qt,{value:a,onChange:l}),e.type==="grid4"&&u.jsx(ia,{value:a,onChange:l}),e.type==="euler"&&u.jsx(qt,{value:a,onChange:l})]})}function Kt(e){switch(e){case"fov":return"FOV";case"zoom":return"Zoom";case"near":return"Near";case"far":return"Far";case"focus":return"Focus";case"aspect":return"Aspect";case"filmGauge":return"Film Gauge";case"filmOffset":return"Film Offset";case"left":return"Left";case"right":return"Right";case"top":return"Top";case"bottom":return"Bottom"}return e}function ra(e,n){const a=[];if(e.perspectiveCameraInfo!==void 0)for(const t in e.perspectiveCameraInfo)a.push({title:Kt(t),prop:t,type:"number",step:.01,value:e.perspectiveCameraInfo[t],onChange:(i,c)=>{n.updateObject(e.uuid,i,c),n.requestMethod(e.uuid,"updateProjectionMatrix");const l=n.getScene(e.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",e.uuid);r!==void 0&&(J(r,i,c),r.updateProjectionMatrix())}}});else if(e.orthographicCameraInfo!==void 0)for(const t in e.orthographicCameraInfo)a.push({title:Kt(t),prop:t,type:"number",step:.01,value:e.perspectiveCameraInfo[t],onChange:(i,c)=>{n.updateObject(e.uuid,i,c),n.requestMethod(e.uuid,"updateProjectionMatrix");const l=n.getScene(e.uuid);if(l!==null){const r=l.getObjectByProperty("uuid",e.uuid);r!==void 0&&(J(r,i,c),r.updateProjectionMatrix())}}});return u.jsx(Ye,{title:"Camera",items:a})}function sa(e,n){const a=new f.Matrix4;a.elements=e.matrix;const t=new f.Vector3,i=new f.Euler,c=new f.Vector3;e.uuid.length>0&&(t.setFromMatrixPosition(a),i.setFromRotationMatrix(a),c.setFromMatrixScale(a));const l=(r,d)=>{const h=r==="rotation"?{x:d._x,y:d._y,z:d._z}:d;n.updateObject(e.uuid,r,h);const p=n.getScene(e.uuid);if(p!==null){const m=p.getObjectByProperty("uuid",e.uuid);m!==void 0&&J(m,r,h)}};return u.jsx(Ye,{title:"Transform",items:[{title:"Position",prop:"position",type:"grid3",value:t,onChange:l},{title:"Rotation",prop:"rotation",type:"grid3",value:i,onChange:l},{title:"Scale",prop:"scale",type:"grid3",value:c,onChange:l}]})}function Zt(e){switch(e){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color";case"width":return"Width";case"height":return"Height"}return e}function oa(e,n){const a=[];if(e.lightInfo!==void 0)for(const t in e.lightInfo){const i=e.lightInfo[t];i!==void 0&&(i.isColor!==void 0?a.push({title:Zt(t),prop:t,type:"color",value:i,onChange:(c,l)=>{const r=new f.Color(l);n.updateObject(e.uuid,c,r);const d=n.getScene(e.uuid);if(d!==null){const h=d.getObjectByProperty("uuid",e.uuid);h!==void 0&&J(h,c,r)}}}):a.push({title:Zt(t),prop:t,type:typeof i,value:i,step:typeof i=="number"?.01:void 0,onChange:(c,l)=>{n.updateObject(e.uuid,c,l);const r=n.getScene(e.uuid);if(r!==null){const d=r.getObjectByProperty("uuid",e.uuid);d!==void 0&&J(d,c,l)}}}))}return u.jsx(Ye,{title:"Light",items:a})}function ca(e,n){const a=[],t=[];let i=0;e.animations.forEach(l=>{i=Math.max(i,l.duration),l.duration>0&&t.push({title:l.name,items:[{title:"Duration",type:"number",value:l.duration,disabled:!0},{title:"Blend Mode",type:"option",disabled:!0,options:[{title:"Normal",value:2500},{title:"Additive",value:2501}]}]})}),a.push({title:"Animations",items:t});const c=n.getScene(e.uuid);if(c!==null){const l=c.getObjectByProperty("uuid",e.uuid);let r=!1;if(l!==void 0){const d=l.mixer;if(r=d!==void 0,r){const h=[{title:"Time Scale",type:"range",value:d.timeScale,step:.01,min:-1,max:2,onChange:(p,m)=>{d.timeScale=m,n.updateObject(e.uuid,"mixer.timeScale",m)}}];h.push({title:"Stop All",type:"button",onChange:()=>{d.stopAllAction(),n.requestMethod(e.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:h})}}}return u.jsx(Ye,{title:"Animation",items:a})}const fn={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};let de={...fn};function mn(e){const[n,a]=E.useState(-1);E.useEffect(()=>{function l(d){de={...d.value},a(Date.now())}function r(){de={...fn},a(Date.now())}return D.addEventListener(P.SET_SCENE,r),D.addEventListener(P.SET_OBJECT,l),()=>{D.removeEventListener(P.SET_SCENE,r),D.removeEventListener(P.SET_OBJECT,l)}},[]);const t=de.type.toLowerCase(),i=de.animations.length>0||de.mixer!==void 0,c=t.search("mesh")>-1||t.search("line")>-1||t.search("points")>-1;return u.jsx(Ot,{label:"Inspector",children:u.jsx("div",{id:"Inspector",className:e.class,children:de.uuid.length>0&&u.jsxs(u.Fragment,{children:[u.jsxs(u.Fragment,{children:[u.jsx(St,{type:"string",title:"Name",prop:"name",value:de.name,disabled:!0}),u.jsx(St,{type:"string",title:"Type",prop:"type",value:de.type,disabled:!0}),u.jsx(St,{type:"string",title:"UUID",prop:"uuid",value:de.uuid,disabled:!0})]}),u.jsxs(u.Fragment,{children:[sa(de,e.three),i?ca(de,e.three):null,t.search("camera")>-1?ra(de,e.three):null,t.search("light")>-1?oa(de,e.three):null,c?ta(de,e.three):null]})]})},n)},"Inspector")}function la(e){const[n]=E.useState([]),[a,t]=E.useState(0),i=r=>{n.push(r.value),t(Date.now())},c=r=>{const d=r.value;for(let h=0;h<n.length;h++)if(d.uuid===n[h].uuid){n.splice(h,1),t(Date.now());return}};E.useEffect(()=>(D.addEventListener(P.ADD_SCENE,i),D.addEventListener(P.REMOVE_SCENE,c),()=>{D.removeEventListener(P.ADD_SCENE,i),D.removeEventListener(P.REMOVE_SCENE,c)}),[]);const l=[];return n.forEach((r,d)=>{l.push(u.jsx(Ot,{label:`Scene: ${r.name}`,open:!0,children:u.jsx(dn,{child:r,scene:r,three:e.three})},`scene_${d}`))}),u.jsxs("div",{id:"SidePanel",children:[l,u.jsx(mn,{three:e.three})]},`SidePanel ${a}`)}function ua(e){return E.useEffect(()=>{function n(r){let d=null;return e.three.scenes.forEach(h=>{r.search(h.uuid)>-1&&(d=h)}),d}const a=r=>{const d=r.value,p=n(d)?.getObjectByProperty("uuid",d);p!==void 0&&e.three.setObject(p)},t=(r,d,h)=>{const m=n(r)?.getObjectByProperty("uuid",r);m!==void 0&&J(m,d,h)},i=r=>{const d=r.value,{key:h,value:p,uuid:m}=d;t(m,h,p)},c=r=>{const d=r.value,p=n(d.uuid)?.getObjectByProperty("uuid",d.uuid);p!==void 0&&sn(d.value).then(m=>{const v=d.key.split(".");switch(v.length){case 1:p[v[0]]=m;break;case 2:p[v[0]][v[1]]=m;break;case 3:p[v[0]][v[1]][v[2]]=m;break;case 4:p[v[0]][v[1]][v[2]][v[3]]=m;break;case 5:p[v[0]][v[1]][v[2]][v[3]][v[4]]=m;break}p.material.needsUpdate=!0})},l=r=>{const{key:d,uuid:h,value:p,subitem:m}=r.value,w=n(h)?.getObjectByProperty("uuid",h);if(w!==void 0)try{m!==void 0?kn(w,m)[d](p):w[d](p)}catch(j){console.log("Error requesting method:"),console.log(j),console.log(d),console.log(p)}};return D.addEventListener(P.GET_OBJECT,a),D.addEventListener(P.UPDATE_OBJECT,i),D.addEventListener(P.CREATE_TEXTURE,c),D.addEventListener(P.REQUEST_METHOD,l),()=>{D.removeEventListener(P.GET_OBJECT,a),D.removeEventListener(P.UPDATE_OBJECT,i),D.removeEventListener(P.CREATE_TEXTURE,c),D.removeEventListener(P.REQUEST_METHOD,l)}},[]),null}class da extends f.Line{constructor(n,a){const t=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],i=new f.BufferGeometry;i.setAttribute("position",new f.Float32BufferAttribute(t,3)),i.computeBoundingSphere();const c=new f.LineBasicMaterial({fog:!1});super(i,c),this.light=n,this.color=a,this.type="RectAreaLightHelper";const l=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],r=new f.BufferGeometry;r.setAttribute("position",new f.Float32BufferAttribute(l,3)),r.computeBoundingSphere(),this.add(new f.Mesh(r,new f.MeshBasicMaterial({side:f.BackSide,fog:!1})))}updateMatrixWorld(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),this.color!==void 0)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);const n=this.material.color,a=Math.max(n.r,n.g,n.b);a>1&&n.multiplyScalar(1/a),this.children[0].material.color.copy(this.material.color)}this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Xt={type:"change"},Pt={type:"start"},Jt={type:"end"},vt=new f.Ray,Qt=new f.Plane,ha=Math.cos(70*f.MathUtils.DEG2RAD);class fa extends f.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new f.Vector3,this.cursor=new f.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:f.MOUSE.ROTATE,MIDDLE:f.MOUSE.DOLLY,RIGHT:f.MOUSE.PAN},this.touches={ONE:f.TOUCH.ROTATE,TWO:f.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",nt),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",nt),this._domElementKeyEvents=null},this.saveState=function(){t.target0.copy(t.target),t.position0.copy(t.object.position),t.zoom0=t.object.zoom},this.reset=function(){t.target.copy(t.target0),t.object.position.copy(t.position0),t.object.zoom=t.zoom0,t.object.updateProjectionMatrix(),t.dispatchEvent(Xt),t.update(),c=i.NONE},this.update=function(){const o=new f.Vector3,x=new f.Quaternion().setFromUnitVectors(n.up,new f.Vector3(0,1,0)),k=x.clone().invert(),F=new f.Vector3,ne=new f.Quaternion,ge=new f.Vector3,le=2*Math.PI;return function(mt=null){const pt=t.object.position;o.copy(pt).sub(t.target),o.applyQuaternion(x),r.setFromVector3(o),t.autoRotate&&c===i.NONE&&me(Me(mt)),t.enableDamping?(r.theta+=d.theta*t.dampingFactor,r.phi+=d.phi*t.dampingFactor):(r.theta+=d.theta,r.phi+=d.phi);let ve=t.minAzimuthAngle,be=t.maxAzimuthAngle;isFinite(ve)&&isFinite(be)&&(ve<-Math.PI?ve+=le:ve>Math.PI&&(ve-=le),be<-Math.PI?be+=le:be>Math.PI&&(be-=le),ve<=be?r.theta=Math.max(ve,Math.min(be,r.theta)):r.theta=r.theta>(ve+be)/2?Math.max(ve,r.theta):Math.min(be,r.theta)),r.phi=Math.max(t.minPolarAngle,Math.min(t.maxPolarAngle,r.phi)),r.makeSafe(),t.enableDamping===!0?t.target.addScaledVector(p,t.dampingFactor):t.target.add(p),t.target.sub(t.cursor),t.target.clampLength(t.minTargetRadius,t.maxTargetRadius),t.target.add(t.cursor);let He=!1;if(t.zoomToCursor&&Ee||t.object.isOrthographicCamera)r.radius=_e(r.radius);else{const Ce=r.radius;r.radius=_e(r.radius*h),He=Ce!=r.radius}if(o.setFromSpherical(r),o.applyQuaternion(k),pt.copy(t.target).add(o),t.object.lookAt(t.target),t.enableDamping===!0?(d.theta*=1-t.dampingFactor,d.phi*=1-t.dampingFactor,p.multiplyScalar(1-t.dampingFactor)):(d.set(0,0,0),p.set(0,0,0)),t.zoomToCursor&&Ee){let Ce=null;if(t.object.isPerspectiveCamera){const Fe=o.length();Ce=_e(Fe*h);const Ze=Fe-Ce;t.object.position.addScaledVector(Z,Ze),t.object.updateMatrixWorld(),He=!!Ze}else if(t.object.isOrthographicCamera){const Fe=new f.Vector3(ae.x,ae.y,0);Fe.unproject(t.object);const Ze=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/h)),t.object.updateProjectionMatrix(),He=Ze!==t.object.zoom;const gt=new f.Vector3(ae.x,ae.y,0);gt.unproject(t.object),t.object.position.sub(gt).add(Fe),t.object.updateMatrixWorld(),Ce=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),t.zoomToCursor=!1;Ce!==null&&(this.screenSpacePanning?t.target.set(0,0,-1).transformDirection(t.object.matrix).multiplyScalar(Ce).add(t.object.position):(vt.origin.copy(t.object.position),vt.direction.set(0,0,-1).transformDirection(t.object.matrix),Math.abs(t.object.up.dot(vt.direction))<ha?n.lookAt(t.target):(Qt.setFromNormalAndCoplanarPoint(t.object.up,t.target),vt.intersectPlane(Qt,t.target))))}else if(t.object.isOrthographicCamera){const Ce=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/h)),Ce!==t.object.zoom&&(t.object.updateProjectionMatrix(),He=!0)}return h=1,Ee=!1,He||F.distanceToSquared(t.object.position)>l||8*(1-ne.dot(t.object.quaternion))>l||ge.distanceToSquared(t.target)>l?(t.dispatchEvent(Xt),F.copy(t.object.position),ne.copy(t.object.quaternion),ge.copy(t.target),!0):!1}}(),this.dispose=function(){t.domElement.removeEventListener("contextmenu",Ke),t.domElement.removeEventListener("pointerdown",_),t.domElement.removeEventListener("pointercancel",Y),t.domElement.removeEventListener("wheel",ut),t.domElement.removeEventListener("pointermove",z),t.domElement.removeEventListener("pointerup",Y),t.domElement.getRootNode().removeEventListener("keydown",tt,{capture:!0}),t._domElementKeyEvents!==null&&(t._domElementKeyEvents.removeEventListener("keydown",nt),t._domElementKeyEvents=null)};const t=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=i.NONE;const l=1e-6,r=new f.Spherical,d=new f.Spherical;let h=1;const p=new f.Vector3,m=new f.Vector2,v=new f.Vector2,w=new f.Vector2,j=new f.Vector2,q=new f.Vector2,Q=new f.Vector2,I=new f.Vector2,G=new f.Vector2,U=new f.Vector2,Z=new f.Vector3,ae=new f.Vector2;let Ee=!1;const $=[],he={};let se=!1;function Me(o){return o!==null?2*Math.PI/60*t.autoRotateSpeed*o:2*Math.PI/60/60*t.autoRotateSpeed}function Oe(o){const x=Math.abs(o*.01);return Math.pow(.95,t.zoomSpeed*x)}function me(o){d.theta-=o}function B(o){d.phi-=o}const pe=function(){const o=new f.Vector3;return function(k,F){o.setFromMatrixColumn(F,0),o.multiplyScalar(-k),p.add(o)}}(),R=function(){const o=new f.Vector3;return function(k,F){t.screenSpacePanning===!0?o.setFromMatrixColumn(F,1):(o.setFromMatrixColumn(F,0),o.crossVectors(t.object.up,o)),o.multiplyScalar(k),p.add(o)}}(),Se=function(){const o=new f.Vector3;return function(k,F){const ne=t.domElement;if(t.object.isPerspectiveCamera){const ge=t.object.position;o.copy(ge).sub(t.target);let le=o.length();le*=Math.tan(t.object.fov/2*Math.PI/180),pe(2*k*le/ne.clientHeight,t.object.matrix),R(2*F*le/ne.clientHeight,t.object.matrix)}else t.object.isOrthographicCamera?(pe(k*(t.object.right-t.object.left)/t.object.zoom/ne.clientWidth,t.object.matrix),R(F*(t.object.top-t.object.bottom)/t.object.zoom/ne.clientHeight,t.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),t.enablePan=!1)}}();function Te(o){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function ke(o){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function Re(o,x){if(!t.zoomToCursor)return;Ee=!0;const k=t.domElement.getBoundingClientRect(),F=o-k.left,ne=x-k.top,ge=k.width,le=k.height;ae.x=F/ge*2-1,ae.y=-(ne/le)*2+1,Z.set(ae.x,ae.y,1).unproject(t.object).sub(t.object.position).normalize()}function _e(o){return Math.max(t.minDistance,Math.min(t.maxDistance,o))}function De(o){m.set(o.clientX,o.clientY)}function je(o){Re(o.clientX,o.clientX),I.set(o.clientX,o.clientY)}function Ie(o){j.set(o.clientX,o.clientY)}function ie(o){v.set(o.clientX,o.clientY),w.subVectors(v,m).multiplyScalar(t.rotateSpeed);const x=t.domElement;me(2*Math.PI*w.x/x.clientHeight),B(2*Math.PI*w.y/x.clientHeight),m.copy(v),t.update()}function xe(o){G.set(o.clientX,o.clientY),U.subVectors(G,I),U.y>0?Te(Oe(U.y)):U.y<0&&ke(Oe(U.y)),I.copy(G),t.update()}function ze(o){q.set(o.clientX,o.clientY),Q.subVectors(q,j).multiplyScalar(t.panSpeed),Se(Q.x,Q.y),j.copy(q),t.update()}function Ge(o){Re(o.clientX,o.clientY),o.deltaY<0?ke(Oe(o.deltaY)):o.deltaY>0&&Te(Oe(o.deltaY)),t.update()}function ce(o){let x=!1;switch(o.code){case t.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?B(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(0,t.keyPanSpeed),x=!0;break;case t.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?B(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(0,-t.keyPanSpeed),x=!0;break;case t.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?me(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(t.keyPanSpeed,0),x=!0;break;case t.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?me(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(-t.keyPanSpeed,0),x=!0;break}x&&(o.preventDefault(),t.update())}function b(o){if($.length===1)m.set(o.pageX,o.pageY);else{const x=Le(o),k=.5*(o.pageX+x.x),F=.5*(o.pageY+x.y);m.set(k,F)}}function y(o){if($.length===1)j.set(o.pageX,o.pageY);else{const x=Le(o),k=.5*(o.pageX+x.x),F=.5*(o.pageY+x.y);j.set(k,F)}}function T(o){const x=Le(o),k=o.pageX-x.x,F=o.pageY-x.y,ne=Math.sqrt(k*k+F*F);I.set(0,ne)}function N(o){t.enableZoom&&T(o),t.enablePan&&y(o)}function fe(o){t.enableZoom&&T(o),t.enableRotate&&b(o)}function oe(o){if($.length==1)v.set(o.pageX,o.pageY);else{const k=Le(o),F=.5*(o.pageX+k.x),ne=.5*(o.pageY+k.y);v.set(F,ne)}w.subVectors(v,m).multiplyScalar(t.rotateSpeed);const x=t.domElement;me(2*Math.PI*w.x/x.clientHeight),B(2*Math.PI*w.y/x.clientHeight),m.copy(v)}function M(o){if($.length===1)q.set(o.pageX,o.pageY);else{const x=Le(o),k=.5*(o.pageX+x.x),F=.5*(o.pageY+x.y);q.set(k,F)}Q.subVectors(q,j).multiplyScalar(t.panSpeed),Se(Q.x,Q.y),j.copy(q)}function C(o){const x=Le(o),k=o.pageX-x.x,F=o.pageY-x.y,ne=Math.sqrt(k*k+F*F);G.set(0,ne),U.set(0,Math.pow(G.y/I.y,t.zoomSpeed)),Te(U.y),I.copy(G);const ge=(o.pageX+x.x)*.5,le=(o.pageY+x.y)*.5;Re(ge,le)}function H(o){t.enableZoom&&C(o),t.enablePan&&M(o)}function ee(o){t.enableZoom&&C(o),t.enableRotate&&oe(o)}function _(o){t.enabled!==!1&&($.length===0&&(t.domElement.setPointerCapture(o.pointerId),t.domElement.addEventListener("pointermove",z),t.domElement.addEventListener("pointerup",Y)),!kt(o)&&(Rt(o),o.pointerType==="touch"?at(o):Pe(o)))}function z(o){t.enabled!==!1&&(o.pointerType==="touch"?ht(o):qe(o))}function Y(o){switch(_t(o),$.length){case 0:t.domElement.releasePointerCapture(o.pointerId),t.domElement.removeEventListener("pointermove",z),t.domElement.removeEventListener("pointerup",Y),t.dispatchEvent(Jt),c=i.NONE;break;case 1:const x=$[0],k=he[x];at({pointerId:x,pageX:k.x,pageY:k.y});break}}function Pe(o){let x;switch(o.button){case 0:x=t.mouseButtons.LEFT;break;case 1:x=t.mouseButtons.MIDDLE;break;case 2:x=t.mouseButtons.RIGHT;break;default:x=-1}switch(x){case f.MOUSE.DOLLY:if(t.enableZoom===!1)return;je(o),c=i.DOLLY;break;case f.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(t.enablePan===!1)return;Ie(o),c=i.PAN}else{if(t.enableRotate===!1)return;De(o),c=i.ROTATE}break;case f.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(t.enableRotate===!1)return;De(o),c=i.ROTATE}else{if(t.enablePan===!1)return;Ie(o),c=i.PAN}break;default:c=i.NONE}c!==i.NONE&&t.dispatchEvent(Pt)}function qe(o){switch(c){case i.ROTATE:if(t.enableRotate===!1)return;ie(o);break;case i.DOLLY:if(t.enableZoom===!1)return;xe(o);break;case i.PAN:if(t.enablePan===!1)return;ze(o);break}}function ut(o){t.enabled===!1||t.enableZoom===!1||c!==i.NONE||(o.preventDefault(),t.dispatchEvent(Pt),Ge(dt(o)),t.dispatchEvent(Jt))}function dt(o){const x=o.deltaMode,k={clientX:o.clientX,clientY:o.clientY,deltaY:o.deltaY};switch(x){case 1:k.deltaY*=16;break;case 2:k.deltaY*=100;break}return o.ctrlKey&&!se&&(k.deltaY*=10),k}function tt(o){o.key==="Control"&&(se=!0,t.domElement.getRootNode().addEventListener("keyup",Ne,{passive:!0,capture:!0}))}function Ne(o){o.key==="Control"&&(se=!1,t.domElement.getRootNode().removeEventListener("keyup",Ne,{passive:!0,capture:!0}))}function nt(o){t.enabled===!1||t.enablePan===!1||ce(o)}function at(o){switch(ft(o),$.length){case 1:switch(t.touches.ONE){case f.TOUCH.ROTATE:if(t.enableRotate===!1)return;b(o),c=i.TOUCH_ROTATE;break;case f.TOUCH.PAN:if(t.enablePan===!1)return;y(o),c=i.TOUCH_PAN;break;default:c=i.NONE}break;case 2:switch(t.touches.TWO){case f.TOUCH.DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;N(o),c=i.TOUCH_DOLLY_PAN;break;case f.TOUCH.DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;fe(o),c=i.TOUCH_DOLLY_ROTATE;break;default:c=i.NONE}break;default:c=i.NONE}c!==i.NONE&&t.dispatchEvent(Pt)}function ht(o){switch(ft(o),c){case i.TOUCH_ROTATE:if(t.enableRotate===!1)return;oe(o),t.update();break;case i.TOUCH_PAN:if(t.enablePan===!1)return;M(o),t.update();break;case i.TOUCH_DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;H(o),t.update();break;case i.TOUCH_DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;ee(o),t.update();break;default:c=i.NONE}}function Ke(o){t.enabled!==!1&&o.preventDefault()}function Rt(o){$.push(o.pointerId)}function _t(o){delete he[o.pointerId];for(let x=0;x<$.length;x++)if($[x]==o.pointerId){$.splice(x,1);return}}function kt(o){for(let x=0;x<$.length;x++)if($[x]==o.pointerId)return!0;return!1}function ft(o){let x=he[o.pointerId];x===void 0&&(x=new f.Vector2,he[o.pointerId]=x),x.set(o.pageX,o.pageY)}function Le(o){const x=o.pointerId===$[0]?$[1]:$[0];return he[x]}t.domElement.addEventListener("contextmenu",Ke),t.domElement.addEventListener("pointerdown",_),t.domElement.addEventListener("pointercancel",Y),t.domElement.addEventListener("wheel",ut,{passive:!1}),t.domElement.getRootNode().addEventListener("keydown",tt,{passive:!0,capture:!0}),this.update()}}function Qe(e,n,a,t,i){return t+(e-n)*(i-t)/(a-n)}const xt=e=>{const[n,a]=E.useState(e.options[e.index]),t=()=>{e.onToggle(!e.open)},i=c=>{c!==n&&(e.onSelect(c),a(c)),e.onToggle(!1)};return u.jsxs("div",{className:`dropdown ${e.up===!0?"up":""}`,children:[u.jsx("div",{className:"dropdown-toggle",onClick:t,children:n}),e.open&&u.jsx("ul",{className:"dropdown-menu",children:e.options.map(c=>u.jsx("li",{onClick:()=>i(c),children:c},c))})]})},We=E.forwardRef(function(n,a){const[t,i]=E.useState(!1),c=n.options.indexOf(n.camera.name);return u.jsxs("div",{className:"CameraWindow",children:[u.jsx("div",{ref:a,className:"clickable",onClick:()=>{t&&i(!1)}}),u.jsx(xt,{index:c,open:t,options:n.options,onSelect:n.onSelect,onToggle:l=>{i(l)},up:!0})]})});class ma extends f.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:f.GLSL3,side:f.DoubleSide,transparent:!0,uniforms:{uScale:{value:n?.scale!==void 0?n?.scale:.1},uDivisions:{value:n?.divisions!==void 0?n?.divisions:10},uColor:{value:n?.color!==void 0?n?.color:new f.Color(16777215)},uDistance:{value:n?.distance!==void 0?n?.distance:1e4},uSubgridOpacity:{value:n?.subgridOpacity!==void 0?n?.subgridOpacity:.15},uGridOpacity:{value:n?.gridOpacity!==void 0?n?.gridOpacity:.25}},vertexShader:`out vec3 worldPosition;
|
31
31
|
uniform float uDistance;
|
32
32
|
|
33
33
|
void main() {
|
@@ -141,4 +141,4 @@ void main() {
|
|
141
141
|
void main() {
|
142
142
|
#include <clipping_planes_fragment>
|
143
143
|
gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
|
144
|
-
}`;class ba extends f.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:ga,fragmentShader:va})}}let bt="Renderer",we,yt=!1,At=!1,Y=null,ie=null,Ue=null,Be=null;function ya(e){const n=e.three.app.appID,a=localStorage.getItem(`${n}_mode`),t=localStorage.getItem(`${n}_tlCam`)!==null?localStorage.getItem(`${n}_tlCam`):"Debug",i=localStorage.getItem(`${n}_trCam`)!==null?localStorage.getItem(`${n}_trCam`):"Orthographic",c=localStorage.getItem(`${n}_blCam`)!==null?localStorage.getItem(`${n}_blCam`):"Front",l=localStorage.getItem(`${n}_brCam`)!==null?localStorage.getItem(`${n}_brCam`):"Top",r=E.useMemo(()=>new Map,[]),d=E.useMemo(()=>new Map,[]),h=E.useMemo(()=>new Map,[]),p=E.useMemo(()=>new Map,[]),m=E.useMemo(()=>new f.Scene,[]),y=E.useMemo(()=>new f.Group,[]),w=E.useMemo(()=>new pa,[]),A=E.useMemo(()=>new f.AxesHelper(500),[]),X=E.useMemo(()=>new f.AxesHelper(100),[]),de=E.useMemo(()=>new f.MeshDepthMaterial,[]),ae=E.useMemo(()=>new f.MeshNormalMaterial,[]),H=E.useMemo(()=>new ba,[]),F=E.useMemo(()=>new f.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),[]);function K(v,b){const T=new f.OrthographicCamera(-100,100,100,-100,50,5e3);return T.name=v,T.position.copy(b),T.lookAt(0,0,0),r.set(v,T),T}const te=["Renderer","Depth","Normals","UVs","Wireframe"],Ee=["Single","Side by Side","Stacked","Quad"],W=E.useRef(null),he=E.useRef(null),re=E.useRef(null),Me=E.useRef(null),Oe=E.useRef(null),me=E.useRef(null),[U,pe]=E.useState(a!==null?a:"Single"),[R,Se]=E.useState(null),[Te,De]=E.useState(!1),[Re,_e]=E.useState(!1),[ke,je]=E.useState(!1),[,Ie]=E.useState(Date.now());localStorage.setItem(`${n}_mode`,U),localStorage.setItem(`${n}_tlCam`,t),localStorage.setItem(`${n}_trCam`,i),localStorage.setItem(`${n}_blCam`,c),localStorage.setItem(`${n}_brCam`,l);const ne=(v,b)=>{const T=d.get(v.name);if(T!==void 0&&T.dispose(),d.delete(v.name),v.name==="UI")return;const I=new fa(v,b);switch(I.enableDamping=!0,I.dampingFactor=.05,v.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":I.enableRotate=!1;break}d.set(v.name,I)},xe=v=>{const b=h.get(v.name);b!==void 0&&(m.remove(b),b.dispose(),h.delete(v.name));const T=d.get(v.name);T!==void 0&&(T.dispose(),d.delete(v.name))},ze=()=>{d.forEach((v,b)=>{v.dispose();const T=h.get(b);T!==void 0&&(m.remove(T),T.dispose()),h.delete(b),d.delete(b)}),d.clear(),h.clear()},Ge=()=>{switch(U){case"Single":ne(Y,re.current);break;case"Side by Side":case"Stacked":ne(Y,re.current),ne(ie,Me.current);break;case"Quad":ne(Y,re.current),ne(ie,Me.current),ne(Ue,Oe.current),ne(Be,me.current);break}};E.useEffect(()=>{const v=new f.WebGLRenderer({canvas:W.current,stencil:!1});v.autoClear=!1,v.shadowMap.enabled=!0,v.setPixelRatio(devicePixelRatio),v.setClearColor(0),e.three.renderer=v,Se(v)},[]),E.useEffect(()=>{m.name="Debug Scene",m.uuid="",y.name="helpers",m.add(y),y.add(w),A.name="axisHelper",y.add(A),X.name="interactionHelper",y.add(X),X.visible=!1,K("Top",new f.Vector3(0,1e3,0)),K("Bottom",new f.Vector3(0,-1e3,0)),K("Left",new f.Vector3(-1e3,0,0)),K("Right",new f.Vector3(1e3,0,0)),K("Front",new f.Vector3(0,0,1e3)),K("Back",new f.Vector3(0,0,-1e3)),K("Orthographic",new f.Vector3(1e3,1e3,1e3)),K("UI",new f.Vector3);const v=new f.PerspectiveCamera(60,1,50,5e3);v.name="Debug",v.position.set(500,500,500),v.lookAt(0,0,0),r.set("Debug",v),Y=r.get(localStorage.getItem(`${n}_tlCam`)),ie=r.get(localStorage.getItem(`${n}_trCam`)),Ue=r.get(localStorage.getItem(`${n}_blCam`)),Be=r.get(localStorage.getItem(`${n}_brCam`))},[]),E.useEffect(()=>{const v=()=>{p.forEach(M=>{y.remove(M),M.dispose()}),p.clear()},b=()=>{we.traverse(M=>{if(M.type.search("Light")>-1){let C;switch(M.type){case"DirectionalLight":C=new f.DirectionalLightHelper(M,100),C.name=`${M.name}Helper`,p.set(M.name,C),y.add(C);break;case"HemisphereLight":C=new f.HemisphereLightHelper(M,250),C.name=`${M.name}Helper`,p.set(M.name,C),y.add(C);break;case"RectAreaLight":C=new da(M),C.name=`${M.name}Helper`,p.set(M.name,C),y.add(C);break;case"PointLight":C=new f.PointLightHelper(M,100),C.name=`${M.name}Helper`,p.set(M.name,C),y.add(C);break;case"SpotLight":C=new f.SpotLightHelper(M),C.name=`${M.name}Helper`,p.set(M.name,C),y.add(C);break}}})},T=M=>{y.add(A),v(),et(we),m.remove(we);const C=e.scenes.get(M.value.name);if(C!==void 0){const z=new C;e.onSceneSet!==void 0&&e.onSceneSet(z),we=z,e.three.scene=we,m.add(we),At=!0,b()}},I=M=>{const C=M.value,z=e.three.scene?.getObjectByProperty("uuid",C.uuid);if(z!==void 0&&r.set(C.name,z),z instanceof f.PerspectiveCamera){const J=new f.CameraHelper(z);h.set(z.name,J),m.add(J)}Ie(Date.now())},fe=M=>{const C=h.get(M.value.name);C!==void 0&&(m.remove(C),C.dispose()),r.delete(M.value.name),Ie(Date.now())},se=M=>{const C=we.getObjectByProperty("uuid",M.value.uuid);C&&C.add(A)};return k.addEventListener(P.SET_SCENE,T),k.addEventListener(P.ADD_CAMERA,I),k.addEventListener(P.REMOVE_CAMERA,fe),k.addEventListener(P.SET_OBJECT,se),()=>{k.removeEventListener(P.SET_SCENE,T),k.removeEventListener(P.ADD_CAMERA,I),k.removeEventListener(P.REMOVE_CAMERA,fe),k.removeEventListener(P.SET_OBJECT,se)}},[]),E.useEffect(()=>{if(R===null)return;let v=window.innerWidth,b=window.innerHeight,T=Math.floor(v/2),I=Math.floor(b/2),fe=-1;const se=()=>{v=window.innerWidth-300,b=window.innerHeight,T=Math.floor(v/2),I=Math.floor(b/2),e.three.resize(v,b),e.onSceneResize!==void 0&&At&&e.onSceneResize(we,v,b);let _=v,V=b;switch(U){case"Side by Side":_=T,V=b;break;case"Stacked":_=v,V=I;break;case"Quad":_=T,V=I;break}r.forEach($=>{$ instanceof f.OrthographicCamera?($.left=_/-2,$.right=_/2,$.top=V/2,$.bottom=V/-2,$.name==="UI"&&($.position.x=v/2,$.position.y=b/-2,$.position.z=100),$.updateProjectionMatrix()):$ instanceof f.PerspectiveCamera&&($.aspect=_/V,$.updateProjectionMatrix(),h.get($.name)?.update())})},M=()=>{R.setViewport(0,0,v,b),R.setScissor(0,0,v,b),R.render(m,Y)},C=()=>{if(U==="Side by Side")R.setViewport(0,0,T,b),R.setScissor(0,0,T,b),R.render(m,Y),R.setViewport(T,0,T,b),R.setScissor(T,0,T,b),R.render(m,ie);else{const _=b-I;R.setViewport(0,_,v,I),R.setScissor(0,_,v,I),R.render(m,Y),R.setViewport(0,0,v,I),R.setScissor(0,0,v,I),R.render(m,ie)}},z=()=>{let _=0,V=0;V=b-I,_=0,R.setViewport(_,V,T,I),R.setScissor(_,V,T,I),R.render(m,Y),_=T,R.setViewport(_,V,T,I),R.setScissor(_,V,T,I),R.render(m,ie),V=0,_=0,R.setViewport(_,V,T,I),R.setScissor(_,V,T,I),R.render(m,Ue),_=T,R.setViewport(_,V,T,I),R.setScissor(_,V,T,I),R.render(m,Be)},J=()=>{switch(d.forEach(_=>{_.update()}),h.forEach(_=>{_.update()}),p.forEach(_=>{_.update!==void 0&&_.update()}),e.onSceneUpdate!==void 0&&At&&e.onSceneUpdate(we),R.clear(),U){case"Single":M();break;case"Side by Side":case"Stacked":C();break;case"Quad":z();break}fe=requestAnimationFrame(J)};return Ge(),window.addEventListener("resize",se),se(),J(),()=>{window.removeEventListener("resize",se),cancelAnimationFrame(fe),fe=-1}},[U,R]),E.useEffect(()=>{if(R!==null){const v=new f.Raycaster,b=new f.Vector2,T=(M,C,z,J)=>{switch(U){case"Quad":M<z?C<J?v.setFromCamera(b,Y):v.setFromCamera(b,Ue):C<J?v.setFromCamera(b,ie):v.setFromCamera(b,Be);break;case"Side by Side":M<z?v.setFromCamera(b,Y):v.setFromCamera(b,ie);break;case"Single":v.setFromCamera(b,Y);break;case"Stacked":C<J?v.setFromCamera(b,Y):v.setFromCamera(b,ie);break}},I=M=>{if(!yt)return;const C=new f.Vector2;R.getSize(C);const z=Math.min(M.clientX,C.x),J=Math.min(M.clientY,C.y);b.x=Qe(z,0,C.x,-1,1),b.y=Qe(J,0,C.y,1,-1);const _=C.x/2,V=C.y/2,$=()=>{z<_?b.x=Qe(z,0,_,-1,1):b.x=Qe(z,_,C.x,-1,1)},Pe=()=>{J<V?b.y=Qe(J,0,V,1,-1):b.y=Qe(J,V,C.y,1,-1)};switch(U){case"Quad":$(),Pe();break;case"Side by Side":$();break;case"Stacked":Pe(),Pe();break}T(z,J,_,V);const qe=v.intersectObjects(we.children);qe.length>0&&X.position.copy(qe[0].point)},fe=M=>{if(!yt)return;const C=new f.Vector2;if(R.getSize(C),M.clientX>=C.x)return;I(M);const z=v.intersectObjects(we.children);z.length>0&&e.three.getObject(z[0].object.uuid)},se=he.current;return se.addEventListener("mousemove",I,!1),se.addEventListener("click",fe,!1),()=>{se.removeEventListener("mousemove",I),se.removeEventListener("click",fe)}}},[U,R]);const oe=[];return r.forEach((v,b)=>{oe.push(b)}),u.jsxs("div",{className:"multiview",children:[u.jsx("canvas",{ref:W}),R!==null&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:`cameras ${U==="Single"||U==="Stacked"?"single":""}`,ref:he,children:[U==="Single"&&u.jsx(u.Fragment,{children:u.jsx(We,{camera:Y,options:oe,ref:re,onSelect:v=>{d.get(Y.name)?.dispose();const b=r.get(v);b!==void 0&&(xe(Y),Y=b,localStorage.setItem(`${n}_tlCam`,b.name),ne(b,re.current))}})}),(U==="Side by Side"||U==="Stacked")&&u.jsxs(u.Fragment,{children:[u.jsx(We,{camera:Y,options:oe,ref:re,onSelect:v=>{d.get(Y.name)?.dispose();const b=r.get(v);b!==void 0&&(xe(Y),Y=b,localStorage.setItem(`${n}_tlCam`,b.name),ne(b,re.current))}}),u.jsx(We,{camera:ie,options:oe,ref:Me,onSelect:v=>{d.get(ie.name)?.dispose();const b=r.get(v);b!==void 0&&(xe(ie),ie=b,localStorage.setItem(`${n}_trCam`,b.name),ne(b,Me.current))}})]}),U==="Quad"&&u.jsxs(u.Fragment,{children:[u.jsx(We,{camera:Y,options:oe,ref:re,onSelect:v=>{d.get(Y.name)?.dispose();const b=r.get(v);b!==void 0&&(xe(Y),Y=b,localStorage.setItem(`${n}_tlCam`,b.name),ne(b,re.current))}}),u.jsx(We,{camera:ie,options:oe,ref:Me,onSelect:v=>{d.get(ie.name)?.dispose();const b=r.get(v);b!==void 0&&(xe(ie),ie=b,localStorage.setItem(`${n}_trCam`,b.name),ne(b,Me.current))}}),u.jsx(We,{camera:Ue,options:oe,ref:Oe,onSelect:v=>{d.get(Ue.name)?.dispose();const b=r.get(v);b!==void 0&&(xe(Ue),Ue=b,localStorage.setItem(`${n}_blCam`,b.name),ne(b,Oe.current))}}),u.jsx(We,{camera:Be,options:oe,ref:me,onSelect:v=>{d.get(Be.name)?.dispose();const b=r.get(v);b!==void 0&&(xe(Be),Be=b,localStorage.setItem(`${n}_brCam`,b.name),ne(b,me.current))}})]})]}),u.jsxs("div",{className:"settings",children:[u.jsx(xt,{index:Ee.indexOf(U),options:Ee,onSelect:v=>{v!==U&&(ze(),pe(v))},open:Te,onToggle:v=>{De(v),Re&&_e(!1),ke&&je(!1)}}),u.jsx(xt,{index:te.indexOf(bt),options:te,onSelect:v=>{if(v!==bt)switch(bt=v,bt){case"Depth":m.overrideMaterial=de;break;case"Normals":m.overrideMaterial=ae;break;default:case"Renderer":m.overrideMaterial=null;break;case"Wireframe":m.overrideMaterial=F;break;case"UVs":m.overrideMaterial=H;break}},open:Re,onToggle:v=>{Te&&De(!1),_e(v),ke&&je(!1)}}),u.jsx(xt,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:v=>{yt=v==="Selection Mode",X.visible=yt},open:ke,onToggle:v=>{Te&&De(!1),Re&&_e(!1),je(v)}})]})]})]})}function Ea(e){return u.jsxs("div",{className:"editor",ref:e.ref,style:e.style,children:[u.jsx("div",{className:"header",children:e.header}),e.children,u.jsx("div",{className:"footer",children:e.footer})]})}exports.Accordion=Ot;exports.Application=wn;exports.BaseRemote=lt;exports.ChildObject=Vt;exports.ContainerObject=dn;exports.Draggable=cn;exports.DraggableItem=on;exports.Dropdown=ln;exports.DropdownItem=un;exports.Editor=Ea;exports.Inspector=mn;exports.MultiView=ya;exports.NavButton=Bt;exports.RemoteComponents=Mn;exports.RemoteController=Fn;exports.RemoteTheatre=Mt;exports.RemoteThree=Pn;exports.RemoteTweakpane=An;exports.SceneInspector=ua;exports.SidePanel=la;exports.ToolEvents=P;exports.capitalize=ct;exports.clamp=Ve;exports.colorToHex=an;exports.debugDispatcher=k;exports.defaultTheatreCallback=Sn;exports.dispose=et;exports.disposeMaterial=rn;exports.disposeTexture=Cn;exports.distance=xn;exports.hierarchyUUID=Ct;exports.isColor=nn;exports.mix=It;exports.noop=wt;exports.normalize=jt;exports.randomID=tn;exports.resetThreeObjects=Lt;exports.round=Nt;exports.theatreEditorApp=On;
|
144
|
+
}`;class ba extends f.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:ga,fragmentShader:va})}}let bt="Renderer",we,yt=!1,At=!1,K=null,re=null,Ue=null,Be=null;function ya(e){const n=e.three.app.appID,a=localStorage.getItem(`${n}_mode`),t=localStorage.getItem(`${n}_tlCam`)!==null?localStorage.getItem(`${n}_tlCam`):"Debug",i=localStorage.getItem(`${n}_trCam`)!==null?localStorage.getItem(`${n}_trCam`):"Orthographic",c=localStorage.getItem(`${n}_blCam`)!==null?localStorage.getItem(`${n}_blCam`):"Front",l=localStorage.getItem(`${n}_brCam`)!==null?localStorage.getItem(`${n}_brCam`):"Top",r=E.useMemo(()=>new Map,[]),d=E.useMemo(()=>new Map,[]),h=E.useMemo(()=>new Map,[]),p=E.useMemo(()=>new Map,[]),m=E.useMemo(()=>new f.Scene,[]),v=E.useMemo(()=>new f.Group,[]),w=E.useMemo(()=>new pa,[]),j=E.useMemo(()=>new f.AxesHelper(500),[]),q=E.useMemo(()=>new f.AxesHelper(100),[]),Q=E.useMemo(()=>new f.MeshDepthMaterial,[]),I=E.useMemo(()=>new f.MeshNormalMaterial,[]),G=E.useMemo(()=>new ba,[]),U=E.useMemo(()=>new f.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),[]);function Z(b,y){const T=new f.OrthographicCamera(-100,100,100,-100,50,5e3);return T.name=b,T.position.copy(y),T.lookAt(0,0,0),r.set(b,T),T}const ae=["Renderer","Depth","Normals","UVs","Wireframe"],Ee=["Single","Side by Side","Stacked","Quad"],$=E.useRef(null),he=E.useRef(null),se=E.useRef(null),Me=E.useRef(null),Oe=E.useRef(null),me=E.useRef(null),[B,pe]=E.useState(a!==null?a:"Single"),[R,Se]=E.useState(null),[Te,ke]=E.useState(!1),[Re,_e]=E.useState(!1),[De,je]=E.useState(!1),[,Ie]=E.useState(Date.now());localStorage.setItem(`${n}_mode`,B),localStorage.setItem(`${n}_tlCam`,t),localStorage.setItem(`${n}_trCam`,i),localStorage.setItem(`${n}_blCam`,c),localStorage.setItem(`${n}_brCam`,l);const ie=(b,y)=>{const T=d.get(b.name);if(T!==void 0&&T.dispose(),d.delete(b.name),b.name==="UI")return;const N=new fa(b,y);switch(N.enableDamping=!0,N.dampingFactor=.05,b.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":N.enableRotate=!1;break}d.set(b.name,N)},xe=b=>{const y=h.get(b.name);y!==void 0&&(m.remove(y),y.dispose(),h.delete(b.name));const T=d.get(b.name);T!==void 0&&(T.dispose(),d.delete(b.name))},ze=()=>{d.forEach((b,y)=>{b.dispose();const T=h.get(y);T!==void 0&&(m.remove(T),T.dispose()),h.delete(y),d.delete(y)}),d.clear(),h.clear()},Ge=()=>{switch(B){case"Single":ie(K,se.current);break;case"Side by Side":case"Stacked":ie(K,se.current),ie(re,Me.current);break;case"Quad":ie(K,se.current),ie(re,Me.current),ie(Ue,Oe.current),ie(Be,me.current);break}};E.useEffect(()=>{const b=new f.WebGLRenderer({canvas:$.current,stencil:!1});b.autoClear=!1,b.shadowMap.enabled=!0,b.setPixelRatio(devicePixelRatio),b.setClearColor(0),e.three.renderer=b,Se(b)},[]),E.useEffect(()=>{m.name="Debug Scene",m.uuid="",v.name="helpers",m.add(v),v.add(w),j.name="axisHelper",v.add(j),q.name="interactionHelper",v.add(q),q.visible=!1,Z("Top",new f.Vector3(0,1e3,0)),Z("Bottom",new f.Vector3(0,-1e3,0)),Z("Left",new f.Vector3(-1e3,0,0)),Z("Right",new f.Vector3(1e3,0,0)),Z("Front",new f.Vector3(0,0,1e3)),Z("Back",new f.Vector3(0,0,-1e3)),Z("Orthographic",new f.Vector3(1e3,1e3,1e3)),Z("UI",new f.Vector3);const b=new f.PerspectiveCamera(60,1,50,5e3);b.name="Debug",b.position.set(500,500,500),b.lookAt(0,0,0),r.set("Debug",b),K=r.get(localStorage.getItem(`${n}_tlCam`)),re=r.get(localStorage.getItem(`${n}_trCam`)),Ue=r.get(localStorage.getItem(`${n}_blCam`)),Be=r.get(localStorage.getItem(`${n}_brCam`))},[]),E.useEffect(()=>{const b=()=>{p.forEach(M=>{v.remove(M),M.dispose()}),p.clear()},y=()=>{we.traverse(M=>{if(M.type.search("Light")>-1){let C;switch(M.type){case"DirectionalLight":C=new f.DirectionalLightHelper(M,100),C.name=`${M.name}Helper`,p.set(M.name,C),v.add(C);break;case"HemisphereLight":C=new f.HemisphereLightHelper(M,250),C.name=`${M.name}Helper`,p.set(M.name,C),v.add(C);break;case"RectAreaLight":C=new da(M),C.name=`${M.name}Helper`,p.set(M.name,C),v.add(C);break;case"PointLight":C=new f.PointLightHelper(M,100),C.name=`${M.name}Helper`,p.set(M.name,C),v.add(C);break;case"SpotLight":C=new f.SpotLightHelper(M),C.name=`${M.name}Helper`,p.set(M.name,C),v.add(C);break}}})},T=M=>{v.add(j),b(),et(we),m.remove(we);const C=e.scenes.get(M.value.name);if(C!==void 0){const H=new C;e.onSceneSet!==void 0&&e.onSceneSet(H),we=H,e.three.scene=we,m.add(we),At=!0,y()}},N=M=>{const C=M.value,H=e.three.scene?.getObjectByProperty("uuid",C.uuid);if(H!==void 0&&r.set(C.name,H),H instanceof f.PerspectiveCamera){const ee=new f.CameraHelper(H);h.set(H.name,ee),m.add(ee)}Ie(Date.now())},fe=M=>{const C=h.get(M.value.name);C!==void 0&&(m.remove(C),C.dispose()),r.delete(M.value.name),Ie(Date.now())},oe=M=>{const C=we.getObjectByProperty("uuid",M.value.uuid);C&&C.add(j)};return D.addEventListener(P.SET_SCENE,T),D.addEventListener(P.ADD_CAMERA,N),D.addEventListener(P.REMOVE_CAMERA,fe),D.addEventListener(P.SET_OBJECT,oe),()=>{D.removeEventListener(P.SET_SCENE,T),D.removeEventListener(P.ADD_CAMERA,N),D.removeEventListener(P.REMOVE_CAMERA,fe),D.removeEventListener(P.SET_OBJECT,oe)}},[]),E.useEffect(()=>{if(R===null)return;let b=window.innerWidth,y=window.innerHeight,T=Math.floor(b/2),N=Math.floor(y/2),fe=-1;const oe=()=>{b=window.innerWidth-300,y=window.innerHeight,T=Math.floor(b/2),N=Math.floor(y/2),e.three.resize(b,y),e.onSceneResize!==void 0&&At&&e.onSceneResize(we,b,y);let _=b,z=y;switch(B){case"Side by Side":_=T,z=y;break;case"Stacked":_=b,z=N;break;case"Quad":_=T,z=N;break}r.forEach(Y=>{Y instanceof f.OrthographicCamera?(Y.left=_/-2,Y.right=_/2,Y.top=z/2,Y.bottom=z/-2,Y.name==="UI"&&(Y.position.x=b/2,Y.position.y=y/-2,Y.position.z=100),Y.updateProjectionMatrix()):Y instanceof f.PerspectiveCamera&&(Y.aspect=_/z,Y.updateProjectionMatrix(),h.get(Y.name)?.update())})},M=()=>{R.setViewport(0,0,b,y),R.setScissor(0,0,b,y),R.render(m,K)},C=()=>{if(B==="Side by Side")R.setViewport(0,0,T,y),R.setScissor(0,0,T,y),R.render(m,K),R.setViewport(T,0,T,y),R.setScissor(T,0,T,y),R.render(m,re);else{const _=y-N;R.setViewport(0,_,b,N),R.setScissor(0,_,b,N),R.render(m,K),R.setViewport(0,0,b,N),R.setScissor(0,0,b,N),R.render(m,re)}},H=()=>{let _=0,z=0;z=y-N,_=0,R.setViewport(_,z,T,N),R.setScissor(_,z,T,N),R.render(m,K),_=T,R.setViewport(_,z,T,N),R.setScissor(_,z,T,N),R.render(m,re),z=0,_=0,R.setViewport(_,z,T,N),R.setScissor(_,z,T,N),R.render(m,Ue),_=T,R.setViewport(_,z,T,N),R.setScissor(_,z,T,N),R.render(m,Be)},ee=()=>{switch(d.forEach(_=>{_.update()}),h.forEach(_=>{_.update()}),p.forEach(_=>{_.update!==void 0&&_.update()}),e.onSceneUpdate!==void 0&&At&&e.onSceneUpdate(we),R.clear(),B){case"Single":M();break;case"Side by Side":case"Stacked":C();break;case"Quad":H();break}fe=requestAnimationFrame(ee)};return Ge(),window.addEventListener("resize",oe),oe(),ee(),()=>{window.removeEventListener("resize",oe),cancelAnimationFrame(fe),fe=-1}},[B,R]),E.useEffect(()=>{if(R!==null){const b=new f.Raycaster,y=new f.Vector2,T=(M,C,H,ee)=>{switch(B){case"Quad":M<H?C<ee?b.setFromCamera(y,K):b.setFromCamera(y,Ue):C<ee?b.setFromCamera(y,re):b.setFromCamera(y,Be);break;case"Side by Side":M<H?b.setFromCamera(y,K):b.setFromCamera(y,re);break;case"Single":b.setFromCamera(y,K);break;case"Stacked":C<ee?b.setFromCamera(y,K):b.setFromCamera(y,re);break}},N=M=>{if(!yt)return;const C=new f.Vector2;R.getSize(C);const H=Math.min(M.clientX,C.x),ee=Math.min(M.clientY,C.y);y.x=Qe(H,0,C.x,-1,1),y.y=Qe(ee,0,C.y,1,-1);const _=C.x/2,z=C.y/2,Y=()=>{H<_?y.x=Qe(H,0,_,-1,1):y.x=Qe(H,_,C.x,-1,1)},Pe=()=>{ee<z?y.y=Qe(ee,0,z,1,-1):y.y=Qe(ee,z,C.y,1,-1)};switch(B){case"Quad":Y(),Pe();break;case"Side by Side":Y();break;case"Stacked":Pe(),Pe();break}T(H,ee,_,z);const qe=b.intersectObjects(we.children);qe.length>0&&q.position.copy(qe[0].point)},fe=M=>{if(!yt)return;const C=new f.Vector2;if(R.getSize(C),M.clientX>=C.x)return;N(M);const H=b.intersectObjects(we.children);H.length>0&&e.three.getObject(H[0].object.uuid)},oe=he.current;return oe.addEventListener("mousemove",N,!1),oe.addEventListener("click",fe,!1),()=>{oe.removeEventListener("mousemove",N),oe.removeEventListener("click",fe)}}},[B,R]);const ce=[];return r.forEach((b,y)=>{ce.push(y)}),u.jsxs("div",{className:"multiview",children:[u.jsx("canvas",{ref:$}),R!==null&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:`cameras ${B==="Single"||B==="Stacked"?"single":""}`,ref:he,children:[B==="Single"&&u.jsx(u.Fragment,{children:u.jsx(We,{camera:K,options:ce,ref:se,onSelect:b=>{d.get(K.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(K),K=y,localStorage.setItem(`${n}_tlCam`,y.name),ie(y,se.current))}})}),(B==="Side by Side"||B==="Stacked")&&u.jsxs(u.Fragment,{children:[u.jsx(We,{camera:K,options:ce,ref:se,onSelect:b=>{d.get(K.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(K),K=y,localStorage.setItem(`${n}_tlCam`,y.name),ie(y,se.current))}}),u.jsx(We,{camera:re,options:ce,ref:Me,onSelect:b=>{d.get(re.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(re),re=y,localStorage.setItem(`${n}_trCam`,y.name),ie(y,Me.current))}})]}),B==="Quad"&&u.jsxs(u.Fragment,{children:[u.jsx(We,{camera:K,options:ce,ref:se,onSelect:b=>{d.get(K.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(K),K=y,localStorage.setItem(`${n}_tlCam`,y.name),ie(y,se.current))}}),u.jsx(We,{camera:re,options:ce,ref:Me,onSelect:b=>{d.get(re.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(re),re=y,localStorage.setItem(`${n}_trCam`,y.name),ie(y,Me.current))}}),u.jsx(We,{camera:Ue,options:ce,ref:Oe,onSelect:b=>{d.get(Ue.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(Ue),Ue=y,localStorage.setItem(`${n}_blCam`,y.name),ie(y,Oe.current))}}),u.jsx(We,{camera:Be,options:ce,ref:me,onSelect:b=>{d.get(Be.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(Be),Be=y,localStorage.setItem(`${n}_brCam`,y.name),ie(y,me.current))}})]})]}),u.jsxs("div",{className:"settings",children:[u.jsx(xt,{index:Ee.indexOf(B),options:Ee,onSelect:b=>{b!==B&&(ze(),pe(b))},open:Te,onToggle:b=>{ke(b),Re&&_e(!1),De&&je(!1)}}),u.jsx(xt,{index:ae.indexOf(bt),options:ae,onSelect:b=>{if(b!==bt)switch(bt=b,bt){case"Depth":m.overrideMaterial=Q;break;case"Normals":m.overrideMaterial=I;break;default:case"Renderer":m.overrideMaterial=null;break;case"Wireframe":m.overrideMaterial=U;break;case"UVs":m.overrideMaterial=G;break}},open:Re,onToggle:b=>{Te&&ke(!1),_e(b),De&&je(!1)}}),u.jsx(xt,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:b=>{yt=b==="Selection Mode",q.visible=yt},open:De,onToggle:b=>{Te&&ke(!1),Re&&_e(!1),je(b)}})]})]})]})}function Ea(e){return u.jsxs("div",{className:"editor",ref:e.ref,style:e.style,children:[u.jsx("div",{className:"header",children:e.header}),e.children,u.jsx("div",{className:"footer",children:e.footer})]})}exports.Accordion=Ot;exports.Application=wn;exports.BaseRemote=lt;exports.ChildObject=Vt;exports.ContainerObject=dn;exports.Draggable=cn;exports.DraggableItem=on;exports.Dropdown=ln;exports.DropdownItem=un;exports.Editor=Ea;exports.Inspector=mn;exports.MultiView=ya;exports.NavButton=Bt;exports.RemoteComponents=Mn;exports.RemoteController=Fn;exports.RemoteTheatre=Mt;exports.RemoteThree=Pn;exports.RemoteTweakpane=An;exports.SceneInspector=ua;exports.SidePanel=la;exports.ToolEvents=P;exports.capitalize=ct;exports.clamp=Ve;exports.colorToHex=an;exports.debugDispatcher=D;exports.defaultTheatreCallback=Sn;exports.dispose=et;exports.disposeMaterial=rn;exports.disposeTexture=Cn;exports.distance=xn;exports.hierarchyUUID=Ct;exports.isColor=nn;exports.mix=It;exports.noop=wt;exports.normalize=jt;exports.randomID=tn;exports.resetThreeObjects=Lt;exports.round=Nt;exports.theatreEditorApp=On;
|