@tomorrowevening/hermes 0.0.67 → 0.0.68

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.
@@ -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 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={};/**
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=h=>{const u=h.toString(16);return u.length===1?"0"+u:u},o=i(n),d=i(a),r=i(t);return"#"+o+d+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 A=new f.EventDispatcher,j={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":A.dispatchEvent({type:j.SELECT_DROPDOWN,value:t.data});break;case"draggableListUpdate":A.dispatchEvent({type:j.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,o){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const d=this.sheet(n,o);if(d===void 0)return;const h=`${this.getSheetInstance(n,o)}_${a}`;let u=this.sheetObjects.get(h);u!==void 0?u=d.object(a,{...t,...u.value},{reconfigure:!0}):u=d.object(a,t),this.sheetObjects.set(h,u),this.sheetObjectCBs.set(h,i!==void 0?i:wt);const m=u.onValuesChange(p=>{if(this.app.editor){for(const w in p){const I=p[w];typeof I=="object"&&nn(I)&&(p[w]={r:I.r,g:I.g,b:I.b,a:I.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:h,values:p}})}const g=this.sheetObjectCBs.get(h);g!==void 0&&g(p)});return this.sheetObjectUnsubscribe.set(h,m),u}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 o=`${a}_${t}`,d=this.sheetObjectUnsubscribe.get(o);d!==void 0&&(this.sheetObjects.delete(o),this.sheetObjectCBs.delete(o),this.sheetObjectUnsubscribe.delete(o),d())}handleApp(n,a,t){const i=a;let o;switch(t.event){case"setSheet":o=i.sheets.get(t.data.sheet),o!==void 0&&(i.activeSheet=o,this.studio?.setSelection([o]));break;case"setSheetObject":o=i.sheetObjects.get(`${t.data.sheet}_${t.data.key}`),o!==void 0&&this.studio?.setSelection([o]);break;case"updateSheetObject":o=i.sheets.get(t.data.sheet),o!==void 0&&o.sequence.pause(),o=i.sheetObjectCBs.get(t.data.sheetObject),o!==void 0&&o(t.data.values);break;case"updateTimeline":o=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(d=>{d.length<1||d.forEach(r=>{let h=r.address.sheetId,u="setSheet",m={};switch(r.type){case"Theatre_Sheet_PublicAPI":u="setSheet",m={sheet:r.address.sheetId},a.activeSheet=a.sheets.get(r.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":u="setSheetObject",h+=`_${r.address.objectKey}`,m={id:h,sheet:r.address.sheetId,key:r.address.objectKey},a.activeSheet=a.sheets.get(r.address.sheetId);break}n.send({event:u,target:"app",data:m})})});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 d=a.activeSheet;n.send({event:"updateTimeline",target:"app",data:{position:t,sheet:d.address.sheetId}})}},o=()=>{i(),requestAnimationFrame(o)};i(),o()}else this.studio?.ui.hide()}}function On(e,n,a){if(e.editor){a.ui.restore(),a.onSelectionChange(d=>{d.length<1||d.forEach(r=>{let h=r.address.sheetId,u="setSheet",m={};switch(r.type){case"Theatre_Sheet_PublicAPI":u="setSheet",m={sheet:r.address.sheetId},n.activeSheet=n.sheets.get(r.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":u="setSheetObject",h+=`_${r.address.objectKey}`,m={id:h,sheet:r.address.sheetId,key:r.address.objectKey},n.activeSheet=n.sheets.get(r.address.sheetId);break}e.send({event:u,target:"app",data:m})})});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 d=n.activeSheet;e.send({event:"updateTimeline",target:"app",data:{position:t,sheet:d.address.sheetId}})}},o=()=>{i(),requestAnimationFrame(o)};i(),o()}else a.ui.hide()}function Rn(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 Tn(e){const n={};for(const a in e){const t=e[a].value;n[a]={value:t},t===null?n[a].value={src:"",offset:[0,0],repeat:[1,1]}:t.isTexture&&(n[a].value={src:t.image.src,offset:[t.offset.x,t.offset.y],repeat:[t.repeat.x,t.repeat.y]})}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 d=i.source.toJSON().url;n[a]={src:d,offset:[i.offset.x,i.offset.y],repeat:[i.repeat.x,i.repeat.y]}}else i instanceof f.CubeTexture&&(console.log("env map"),console.log(i.source.data),console.log(i.source.toJSON()),n[a]={src:"",offset:[i.offset.x,i.offset.y],repeat:[i.repeat.x,i.repeat.y]});else a==="uniforms"&&(n[a]=Tn(n[a]));else n[a]={src:"",offset:[0,0],repeat:[1,1]};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(o=>{i.push(Je(o))}),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(o=>{i.push(Je(o))}),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(o=>{i.push(Je(o))}),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 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 d;switch(i){case 1:d=e[t[0]];break;case 2:d=e[t[0]][t[1]];break;case 3:d=e[t[0]][t[1]][t[2]];break;case 4:d=e[t[0]][t[1]][t[2]][t[3]];break;case 5:d=e[t[0]][t[1]][t[2]][t[3]][t[4]];break}d!=null&&Dn(d,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":A.dispatchEvent({type:j.GET_OBJECT,value:t.data});break;case"updateObject":A.dispatchEvent({type:j.UPDATE_OBJECT,value:t.data});break;case"createTexture":A.dispatchEvent({type:j.CREATE_TEXTURE,value:t.data});break;case"requestMethod":A.dispatchEvent({type:j.REQUEST_METHOD,value:t.data});break}}handleEditor(n,a,t){switch(t.event){case"setObject":A.dispatchEvent({type:j.SET_OBJECT,value:t.data});break;case"addScene":A.dispatchEvent({type:j.ADD_SCENE,value:t.data});break;case"removeScene":A.dispatchEvent({type:j.REMOVE_SCENE,value:t.data});break;case"setScene":A.dispatchEvent({type:j.SET_SCENE,value:t.data});break;case"addCamera":A.dispatchEvent({type:j.ADD_CAMERA,value:t.data});break;case"removeCamera":A.dispatchEvent({type:j.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 o=this.bindID,d=t.onChange!==void 0?t.onChange:wt;this.bindCBs.set(o,d),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.pane).addBinding(n,a,t).on("change",h=>{this.app.send({event:"updateBind",target:"app",data:{id:o,value:h.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:o,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={},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={};/**
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,o={key:!0,ref:!0,__self:!0,__source:!0};function d(r,h,u){var m,p={},g=null,w=null;u!==void 0&&(g=""+u),h.key!==void 0&&(g=""+h.key),h.ref!==void 0&&(w=h.ref);for(m in h)t.call(h,m)&&!o.hasOwnProperty(m)&&(p[m]=h[m]);if(r&&r.defaultProps)for(m in h=r.defaultProps,h)p[m]===void 0&&(p[m]=h[m]);return{$$typeof:n,type:r,key:g,ref:w,props:p,_owner:i.current}}return it.Fragment=a,it.jsx=d,it.jsxs=d,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"),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(`
17
+ */var Yt;function In(){return Yt||(Yt=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"),o=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),r=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),I=Symbol.iterator,V="@@iterator";function $(s){if(s===null||typeof s!="object")return null;var v=I&&s[I]||s[V];return typeof v=="function"?v:null}var k=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function L(s){{for(var v=arguments.length,S=new Array(v>1?v-1:0),O=1;O<v;O++)S[O-1]=arguments[O];_("error",s,S)}}function _(s,v,S){{var O=k.ReactDebugCurrentFrame,G=O.getStackAddendum();G!==""&&(v+="%s",S=S.concat([G]));var Y=S.map(function(U){return String(U)});Y.unshift("Warning: "+v),Function.prototype.apply.call(console[s],console,Y)}}var Z=!1,ee=!1,he=!1,q=!1,fe=!1,se;se=Symbol.for("react.module.reference");function Me(s){return!!(typeof s=="string"||typeof s=="function"||s===t||s===o||fe||s===i||s===u||s===m||q||s===w||Z||ee||he||typeof s=="object"&&s!==null&&(s.$$typeof===g||s.$$typeof===p||s.$$typeof===d||s.$$typeof===r||s.$$typeof===h||s.$$typeof===se||s.getModuleId!==void 0))}function Oe(s,v,S){var O=s.displayName;if(O)return O;var G=v.displayName||v.name||"";return G!==""?S+"("+G+")":S}function pe(s){return s.displayName||"Context"}function z(s){if(s==null)return null;if(typeof s.tag=="number"&&L("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 o:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case m:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case r:var v=s;return pe(v)+".Consumer";case d:var S=s;return pe(S._context)+".Provider";case h:return Oe(s,s.render,"ForwardRef");case p:var O=s.displayName||null;return O!==null?O:z(s.type)||"Memo";case g:{var G=s,Y=G._payload,U=G._init;try{return z(U(Y))}catch{return null}}}return null}var ge=Object.assign,T=0,Se,Re,ke,Te,_e,De,je;function Ie(){}Ie.__reactDisabledLog=!0;function ie(){{if(T===0){Se=console.log,Re=console.info,ke=console.warn,Te=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})}T++}}function xe(){{if(T--,T===0){var s={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ge({},s,{value:Se}),info:ge({},s,{value:Re}),warn:ge({},s,{value:ke}),error:ge({},s,{value:Te}),group:ge({},s,{value:_e}),groupCollapsed:ge({},s,{value:De}),groupEnd:ge({},s,{value:je})})}T<0&&L("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ze=k.ReactCurrentDispatcher,Ge;function ce(s,v,S){{if(Ge===void 0)try{throw Error()}catch(G){var O=G.stack.trim().match(/\n( *(at )?)/);Ge=O&&O[1]||""}return`
18
+ `+Ge+s}}var b=!1,y;{var R=typeof WeakMap=="function"?WeakMap:Map;y=new R}function F(s,v){if(!s||b)return"";{var S=y.get(s);if(S!==void 0)return S}var O;b=!0;var G=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Y;Y=ze.current,ze.current=null,ie();try{if(v){var U=function(){throw Error()};if(Object.defineProperty(U.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(U,[])}catch(Ae){O=Ae}Reflect.construct(s,[],U)}else{try{U.call()}catch(Ae){O=Ae}s.call(U.prototype)}}else{try{throw Error()}catch(Ae){O=Ae}s()}}catch(Ae){if(Ae&&O&&typeof Ae.stack=="string"){for(var N=Ae.stack.split(`
19
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`
20
+ `),J=N.length-1,ne=ue.length-1;J>=1&&ne>=0&&N[J]!==ue[ne];)ne--;for(;J>=1&&ne>=0;J--,ne--)if(N[J]!==ue[ne]){if(J!==1||ne!==1)do if(J--,ne--,ne<0||N[J]!==ue[ne]){var Ee=`
21
+ `+N[J].replace(" at new "," at ");return s.displayName&&Ee.includes("<anonymous>")&&(Ee=Ee.replace("<anonymous>",s.displayName)),typeof s=="function"&&y.set(s,Ee),Ee}while(J>=1&&ne>=0);break}}}finally{b=!1,ze.current=Y,xe(),Error.prepareStackTrace=G}var Ze=s?s.displayName||s.name:"",Ht=Ze?ce(Ze):"";return typeof s=="function"&&y.set(s,Ht),Ht}function me(s,v,S){return F(s,!1)}function oe(s){var v=s.prototype;return!!(v&&v.isReactComponent)}function M(s,v,S){if(s==null)return"";if(typeof s=="function")return F(s,oe(s));if(typeof s=="string")return ce(s);switch(s){case u:return ce("Suspense");case m:return ce("SuspenseList")}if(typeof s=="object")switch(s.$$typeof){case h:return me(s.render);case p:return M(s.type,v,S);case g:{var O=s,G=O._payload,Y=O._init;try{return M(Y(G),v,S)}catch{}}}return""}var C=Object.prototype.hasOwnProperty,W={},te=k.ReactDebugCurrentFrame;function D(s){if(s){var v=s._owner,S=M(s.type,s._source,v?v.type:null);te.setExtraStackFrame(S)}else te.setExtraStackFrame(null)}function H(s,v,S,O,G){{var Y=Function.call.bind(C);for(var U in s)if(Y(s,U)){var N=void 0;try{if(typeof s[U]!="function"){var ue=Error((O||"React class")+": "+S+" type `"+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[U]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ue.name="Invariant Violation",ue}N=s[U](v,U,O,S,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(J){N=J}N&&!(N instanceof Error)&&(D(G),L("%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,U,typeof N),D(null)),N instanceof Error&&!(N.message in W)&&(W[N.message]=!0,D(G),L("Failed %s type: %s",S,N.message),D(null))}}}var K=Array.isArray;function Pe(s){return K(s)}function qe(s){{var v=typeof Symbol=="function"&&Symbol.toStringTag,S=v&&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 L("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=k.ReactCurrentOwner,nt={key:!0,ref:!0,__self:!0,__source:!0},at,ht,Ke;Ke={};function Tt(s){if(C.call(s,"ref")){var v=Object.getOwnPropertyDescriptor(s,"ref").get;if(v&&v.isReactWarning)return!1}return s.ref!==void 0}function _t(s){if(C.call(s,"key")){var v=Object.getOwnPropertyDescriptor(s,"key").get;if(v&&v.isReactWarning)return!1}return s.key!==void 0}function kt(s,v){if(typeof s.ref=="string"&&Ne.current&&v&&Ne.current.stateNode!==v){var S=z(Ne.current.type);Ke[S]||(L('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',z(Ne.current.type),s.ref),Ke[S]=!0)}}function ft(s,v){{var S=function(){at||(at=!0,L("%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)",v))};S.isReactWarning=!0,Object.defineProperty(s,"key",{get:S,configurable:!0})}}function Le(s,v){{var S=function(){ht||(ht=!0,L("%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)",v))};S.isReactWarning=!0,Object.defineProperty(s,"ref",{get:S,configurable:!0})}}var zt=function(s,v,S,O,G,Y,U){var N={$$typeof:n,type:s,key:v,ref:S,props:U,_owner:Y};return N._store={},Object.defineProperty(N._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(N,"_self",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.defineProperty(N,"_source",{configurable:!1,enumerable:!1,writable:!1,value:G}),Object.freeze&&(Object.freeze(N.props),Object.freeze(N)),N};function c(s,v,S,O,G){{var Y,U={},N=null,ue=null;S!==void 0&&(tt(S),N=""+S),_t(v)&&(tt(v.key),N=""+v.key),Tt(v)&&(ue=v.ref,kt(v,G));for(Y in v)C.call(v,Y)&&!nt.hasOwnProperty(Y)&&(U[Y]=v[Y]);if(s&&s.defaultProps){var J=s.defaultProps;for(Y in J)U[Y]===void 0&&(U[Y]=J[Y])}if(N||ue){var ne=typeof s=="function"?s.displayName||s.name||"Unknown":s;N&&ft(U,ne),ue&&Le(U,ne)}return zt(s,N,ue,G,O,Ne.current,U)}}var x=k.ReactCurrentOwner,P=k.ReactDebugCurrentFrame;function B(s){if(s){var v=s._owner,S=M(s.type,s._source,v?v.type:null);P.setExtraStackFrame(S)}else P.setExtraStackFrame(null)}var ae;ae=!1;function ve(s){return typeof s=="object"&&s!==null&&s.$$typeof===n}function le(){{if(x.current){var s=z(x.current.type);if(s)return`
22
22
 
23
- Check the render method of \``+s+"`."}return""}}function Gt(s){{if(s!==void 0){var g=s.fileName.replace(/^.*[\\\/]/,""),S=s.lineNumber;return`
23
+ Check the render method of \``+s+"`."}return""}}function Gt(s){{if(s!==void 0){var v=s.fileName.replace(/^.*[\\\/]/,""),S=s.lineNumber;return`
24
24
 
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=`
25
+ Check your code at `+v+":"+S+"."}return""}}var mt={};function pt(s){{var v=le();if(!v){var S=typeof s=="string"?s:s.displayName||s.name;S&&(v=`
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 "+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
27
+ Check the top-level render call using <`+S+">.")}return v}}function be(s,v){{if(!s._store||s._store.validated||s.key!=null)return;s._store.validated=!0;var S=pt(v);if(mt[S])return;mt[S]=!0;var O="";s&&s._owner&&s._owner!==x.current&&(O=" It was passed a child from "+z(s._owner.type)+"."),B(s),L('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),B(null)}}function ye(s,v){{if(typeof s!="object")return;if(Pe(s))for(var S=0;S<s.length;S++){var O=s[S];ve(O)&&be(O,v)}else if(ve(s))s._store&&(s._store.validated=!0);else if(s){var G=$(s);if(typeof G=="function"&&G!==s.entries)for(var Y=G.call(s),U;!(U=Y.next()).done;)ve(U.value)&&be(U.value,v)}}}function He(s){{var v=s.type;if(v==null||typeof v=="string")return;var S;if(typeof v=="function")S=v.propTypes;else if(typeof v=="object"&&(v.$$typeof===h||v.$$typeof===p))S=v.propTypes;else return;if(S){var O=z(v);H(S,s.props,"prop",O,s)}else if(v.PropTypes!==void 0&&!ae){ae=!0;var G=z(v);L("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",G||"Unknown")}typeof v.getDefaultProps=="function"&&!v.getDefaultProps.isReactClassApproved&&L("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ce(s){{for(var v=Object.keys(s.props),S=0;S<v.length;S++){var O=v[S];if(O!=="children"&&O!=="key"){B(s),L("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",O),B(null);break}}s.ref!==null&&(B(s),L("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Fe(s,v,S,O,G,Y){{var U=Me(s);if(!U){var N="";(s===void 0||typeof s=="object"&&s!==null&&Object.keys(s).length===0)&&(N+=" 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(G);ue?N+=ue:N+=le();var J;s===null?J="null":Pe(s)?J="array":s!==void 0&&s.$$typeof===n?(J="<"+(z(s.type)||"Unknown")+" />",N=" Did you accidentally export a JSX literal instead of a component?"):J=typeof s,L("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",J,N)}var ne=c(s,v,S,G,Y);if(ne==null)return ne;if(U){var Ee=v.children;if(Ee!==void 0)if(O)if(Pe(Ee)){for(var Ze=0;Ze<Ee.length;Ze++)ye(Ee[Ze],s);Object.freeze&&Object.freeze(Ee)}else L("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 ye(Ee,s)}return s===t?Ce(ne):He(ne),ne}}function Xe(s,v,S){return Fe(s,v,S,!0)}function gt(s,v,S){return Fe(s,v,S,!1)}var pn=gt,gn=Xe;rt.Fragment=t,rt.jsx=pn,rt.jsxs=gn}()),rt}process.env.NODE_ENV==="production"?Ft.exports=jn():Ft.exports=In();var l=Ft.exports;function Bt(e){return e.title.search("<")>-1?l.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:e.title}}):l.jsx("button",{children:e.title})}const Nn=l.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[l.jsx("circle",{cx:"7",cy:"7",r:"6"}),l.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),l.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),Ln=l.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:l.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":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;
29
+ C11,8.22,10.74,8,10.43,8z`})});function on(e){return l.jsx(en.Reorder.Item,{value:e.title,children:l.jsxs("div",{children:[Ln,l.jsx("span",{children:e.title}),l.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),o=u=>{e.onDragComplete(u),i(u)},d=u=>{const m=[...t];m.splice(u,1),o(m)},r=[];t.forEach((u,m)=>{r.push(l.jsx(on,{index:m,title:u,onDelete:d},u))});let h="dropdown draggable";return e.subdropdown&&(h+=" subdropdown"),l.jsxs("div",{className:h,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Bt,{title:e.title}),l.jsx(en.Reorder.Group,{axis:"y",values:t,onReorder:o,style:{visibility:n?"visible":"hidden"},children:r})]})}function ln(e){const[n,a]=E.useState(!1),t=[];e.options.map((o,d)=>{e.onSelect!==void 0&&(o.onSelect=e.onSelect),t.push(l.jsx(un,{option:o},d))});let i="dropdown";return e.subdropdown&&(i+=" subdropdown"),l.jsxs("div",{className:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Bt,{title:e.title}),l.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=l.jsx(cn,{title:n.title,options:n.value,onDragComplete:o=>{n.onDragComplete!==void 0&&n.onDragComplete(o)},subdropdown:!0});break;case"dropdown":i=l.jsx(ln,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":i=l.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 l.jsx("li",{className:a===n.title?"selected":"",children:i},tn())}function Fn(e,n,a){function t(o){switch(n.forEach(d=>{d.callback(e,d.remote,o)}),o.event){case"custom":A.dispatchEvent({type:j.CUSTOM,value:o.data});break}}function i(o){switch(a.forEach(d=>{d.callback(e,d.remote,o)}),o.event){case"custom":A.dispatchEvent({type:j.CUSTOM,value:o.data});break}}e.listen=o=>{o.target==="editor"?i(o):t(o)}}function Ot(e){const[n,a]=E.useState(e.open!==void 0?e.open:!0),t=!n||e.children===void 0;return l.jsxs("div",{className:`accordion ${t?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const i=!n;e.onToggle!==void 0&&e.onToggle(i),a(i)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:ct(e.label)})]}),e.button,l.jsx("div",{className:n?"open":"",children:l.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,o=[];return e.child!==void 0&&e.child.children.length>0&&e.child.children.map((d,r)=>{o.push(l.jsx(Vt,{child:d,three:e.three},r))}),E.useEffect(()=>{const d=e.child.uuid,r=e.three.getScene(d);if(r!==null){const h=r.getObjectByProperty("uuid",d);h!==void 0&&(n.current.style.opacity=h.visible?"1":"0.25")}},[]),l.jsx(l.Fragment,{children:e.child!==void 0&&l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[i?l.jsx("button",{className:"status",style:{backgroundPositionX:a?"-14px":"2px"},onClick:()=>{t(!a)}}):null,l.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}`}),l.jsx("button",{className:"visibility",ref:n,onClick:()=>{if(e.child){const d=e.three.getScene(e.child.uuid);if(d!==null){const r=d.getObjectByProperty("uuid",e.child.uuid);if(r!==void 0){const h="visible",u=!r.visible;n.current.style.opacity=u?"1":"0.25",e.three.updateObject(e.child.uuid,h,u),Q(r,h,u)}}}}}),l.jsx("div",{className:`icon ${Rn(e.child)}`})]}),l.jsx("div",{className:a?"open":"",children:l.jsx("div",{className:"container",children:o})})]},Math.random())})}function dn(e){const n=[];return e.child?.children.map((a,t)=>{n.push(l.jsx(Vt,{child:a,scene:e.scene,three:e.three},t))}),l.jsx("div",{className:`scene ${e.class!==void 0?e.class:""}`,children:n})}function Un(e){const[n,a]=E.useState(e.defaultValue);return E.useEffect(()=>{let t=!1,i=-1,o=0,d=e.defaultValue;const r=g=>{t=!0,o=Number(e.input.current?.value),i=g.clientX,document.addEventListener("mouseup",u,!1),document.addEventListener("mousemove",h,!1),document.addEventListener("contextmenu",u,!1)},h=g=>{if(!t)return;const w=e.step!==void 0?e.step:1,I=(g.clientX-i)*w;d=Number((o+I).toFixed(4)),e.min!==void 0&&(d=Math.max(d,e.min)),e.max!==void 0&&(d=Math.min(d,e.max)),e.onChange!==void 0&&e.onChange(d),a(d)},u=()=>{t=!1,document.removeEventListener("mouseup",u),document.removeEventListener("mousemove",h),document.removeEventListener("contextmenu",u)},m=g=>{const w=Number(g.target.value);a(w)},p=g=>{const w=Number(g.target.value);e.onChange!==void 0&&e.onChange(w),a(w)};return e.input.current?.addEventListener("input",m),e.label.current?.addEventListener("mousedown",r,!1),e.sliderRef!==void 0&&e.sliderRef.current?.addEventListener("input",p),()=>{e.input.current?.removeEventListener("input",m),e.label.current?.removeEventListener("mousedown",r),e.sliderRef!==void 0&&e.sliderRef.current?.removeEventListener("input",p),document.removeEventListener("mouseup",u),document.removeEventListener("mousemove",h),document.removeEventListener("contextmenu",u)}},[]),n}function Ye(e){const n=E.useRef(null),a=E.useRef(null),t=Un({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 l.jsxs(l.Fragment,{children:[e.type==="number"&&l.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 o=Number(i.target.value);e.onChange!==void 0&&e.onChange(e.prop,o)}}),e.type==="range"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:t.toString(),disabled:e.disabled,ref:n,className:"min",onChange:i=>{const o=Number(i.target.value);e.onChange!==void 0&&e.onChange(e.prop,o)}}),l.jsx("input",{disabled:e.disabled,type:"range",value:t,min:e.min,max:e.max,step:e.step,ref:a,onChange:wt})]})]})}function Bn(e){const n=E.useRef(null),a=E.useRef(null),t=E.useRef(null),i=E.useRef(null),o=E.useRef(null),d=E.useRef(null),[r,h]=E.useState(e.value),[u,m]=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))}),[p,g]=E.useState(!1);function w(){p||(window.addEventListener("mousemove",V),window.addEventListener("mouseup",I),window.addEventListener("mouseup",I),g(!0))}function I(){window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",I),g(!1)}function V(_){const Z=o.current.getBoundingClientRect(),ee=Ve(0,99,_.clientX-Z.left)/99,he=Ve(0,99,_.clientY-Z.top)/99,q=Nt(It(u.min,u.max,ee),3),fe=Nt(It(u.min,u.max,he),3);e.onChange({target:{value:{x:q,y:fe}}}),h({x:q,y:fe})}function $(_){let Z=r.x,ee=r.y;_.target===n.current?Z=Number(_.target.value):ee=Number(_.target.value),h({x:Z,y:ee})}function k(){const _=Number(t.current.value);m({min:_,max:u.max}),(r.x<_||r.y<_)&&h({x:Ve(_,u.max,r.x),y:Ve(_,u.max,r.y)})}function L(){const _=Number(i.current.value);m({min:u.min,max:_}),(r.x>_||r.y>_)&&h({x:Ve(u.min,_,r.x),y:Ve(u.min,_,r.y)})}return E.useEffect(()=>{const _=jt(u.min,u.max,r.x),Z=jt(u.min,u.max,r.y);d.current.style.left=`${_*100}%`,d.current.style.top=`${Z*100}%`},[u,r]),l.jsxs("div",{className:"vector2",children:[l.jsxs("div",{className:"fields",children:[l.jsxs("div",{children:[l.jsx("label",{children:"X:"}),l.jsx("input",{ref:n,type:"number",value:r.x,min:u.min,max:u.max,step:.01,onChange:$})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Y:"}),l.jsx("input",{ref:a,type:"number",value:r.y,min:u.min,max:u.max,step:.01,onChange:$})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Min:"}),l.jsx("input",{ref:t,type:"number",value:u.min,step:.01,onChange:k})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Max:"}),l.jsx("input",{ref:i,type:"number",value:u.max,step:.01,onChange:L})]})]}),l.jsxs("div",{className:"input",ref:o,onMouseDown:w,onMouseUp:I,children:[l.jsx("div",{className:"x"}),l.jsx("div",{className:"y"}),l.jsx("div",{className:"pt",ref:d})]})]})}function $t(e){const n=e.value.isVector3!==void 0,a=e.value.isEuler!==void 0,t=e.value.elements!==void 0,i=[];if(n){const o=E.useMemo(()=>e.value,[]),d=(h,u)=>{o[h]=u,e.onChange({target:{value:o}})};["x","y","z"].forEach(h=>{const u=E.useRef(null);i.push(l.jsxs("div",{children:[l.jsx("label",{ref:u,children:h.toUpperCase()}),l.jsx(Ye,{value:o[h],type:"number",prop:h,step:.01,labelRef:u,onChange:d})]},h))})}else if(a){const o=E.useMemo(()=>e.value,[]),d=(h,u)=>{o[h]=u,e.onChange({target:{value:o}})};["_x","_y","_z"].forEach(h=>{const u=E.useRef(null);i.push(l.jsxs("div",{children:[l.jsx("label",{ref:u,children:h.substring(1).toUpperCase()}),l.jsx(Ye,{value:o[h],type:"number",prop:h,step:.01,labelRef:u,onChange:d})]},h))})}else if(t){const o=E.useMemo(()=>e.value,[]),d=(r,h)=>{const u=Number(r);o.elements[u]=h,e.onChange({target:{value:o}})};for(let r=0;r<9;r++){const h=E.useRef(null);i.push(l.jsxs("div",{children:[l.jsx("label",{ref:h,children:r+1}),l.jsx(Ye,{value:o.elements[r],type:"number",prop:r.toString(),step:.01,labelRef:h,onChange:d})]},r.toString()))}}return l.jsx("div",{className:"grid3",children:i},Math.random().toString())}function Vn(e){const n=e.value.x!==void 0,a=[];if(n){const t=E.useMemo(()=>e.value,[]),i=(d,r)=>{t[d]=r,e.onChange({target:{value:t}})};["x","y","z","w"].forEach(d=>{const r=E.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:r,children:d.toUpperCase()}),l.jsx(Ye,{value:t.x,type:"number",prop:d,step:.01,labelRef:r,onChange:i})]},d))})}else{const t=E.useMemo(()=>e.value,[]),i=(o,d)=>{const r=Number(o);t.elements[r]=d,e.onChange({target:{value:t}})};for(let o=0;o<16;o++){const d=E.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:d,children:o+1}),l.jsx(Ye,{value:t.elements[o],type:"number",prop:o.toString(),step:.01,labelRef:d,onChange:i})]},o.toString()))}}return l.jsx("div",{className:"grid4",children:a})}function zn(e){return"items"in e}function $e(e){const n=[];return e.items.forEach(a=>{zn(a)?n.push(l.jsx($e,{title:ct(a.title),items:a.items},Math.random())):n.push(l.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()))}),l.jsx(Ot,{label:e.title,open:e.expanded===!0,children:n})}function Gn(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 Hn(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 Rt(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 Wn(){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(o){n(o.target.result)},i.readAsDataURL(t)}}),e.click()})}const Yn=[{title:"Front",value:f.FrontSide},{title:"Back",value:f.BackSide},{title:"Double",value:f.DoubleSide}],$n=[{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}],qn=[{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}],Kn=[{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}],Xn=[{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 Zn(e,n,a,t){return{type:"boolean",title:Rt(e),prop:e,value:n,needsUpdate:!0,onChange:(i,o)=>{t.updateObject(a.uuid,`material.${e}`,o),t.updateObject(a.uuid,"material.needsUpdate",!0);const d=t.getScene(a.uuid);if(d!==null){const r=d.getObjectByProperty("uuid",a.uuid);r!==void 0&&Q(r,`material.${e}`,o)}}}}function Jn(e,n,a,t){const i={type:"number",title:Rt(e),prop:e,value:n,min:void 0,max:void 0,step:.01,needsUpdate:!0,onChange:(o,d)=>{t.updateObject(a.uuid,`material.${e}`,d),t.updateObject(a.uuid,"material.needsUpdate",!0);const r=t.getScene(a.uuid);if(r!==null){const h=r.getObjectByProperty("uuid",a.uuid);h!==void 0&&Q(h,`material.${e}`,d)}}};switch(e){case"blending":st(i,$n);break;case"blendDst":st(i,Xn);break;case"blendEquation":st(i,qn);break;case"blendSrc":st(i,Kn);break;case"side":st(i,Yn);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 Qn(e,n,a,t){const i={type:"string",title:Rt(e),prop:e,value:n,needsUpdate:!0,onChange:(d,r)=>{t.updateObject(a.uuid,`material.${e}`,r),t.updateObject(a.uuid,"material.needsUpdate",!0);const h=t.getScene(a.uuid);if(h!==null){const u=h.getObjectByProperty("uuid",a.uuid);u!==void 0&&Q(u,`material.${e}`,r)}},onKeyDown:d=>{}};return(e==="vertexShader"||e==="fragmentShader")&&(i.disabled=!1,i.latest=i.value,i.onChange=(d,r)=>{i.latest=r,t.updateObject(a.uuid,`material.${e}`,r);const h=t.getScene(a.uuid);if(h!==null){const u=h.getObjectByProperty("uuid",a.uuid);u!==void 0&&Q(u,`material.${e}`,r)}},i.onKeyDown=d=>{if(d.key==="Enter"&&(d.altKey||d.metaKey)){t.updateObject(a.uuid,"material.needsUpdate",!0);const r=t.getScene(a.uuid);if(r!==null){const h=r.getObjectByProperty("uuid",a.uuid);h!==void 0&&Q(h,"material.needsUpdate",!0)}}}),i}function ea(e){return e.x!==void 0&&e.y!==void 0&&e.z===void 0}function ta(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w===void 0}function na(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="",o=!1){const d=Rt(e).split(".")[0].replaceAll("[","").replaceAll("]",""),r=i.length>0?`${i}.${e}`:e,h=typeof n;if(h==="boolean"||h==="string")return{title:d,prop:r,type:h,value:n,disabled:o,onChange:(u,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const p=t.getScene(a.uuid);if(p!==null){const g=p.getObjectByProperty("uuid",a.uuid);g!==void 0&&Q(g,`material.${r}`,m)}}};if(h==="number"){const u={title:d,prop:r,type:"number",value:n,step:.01,disabled:o,onChange:(m,p)=>{t.updateObject(a.uuid,`material.${r}`,p);const g=t.getScene(a.uuid);if(g!==null){const w=g.getObjectByProperty("uuid",a.uuid);w!==void 0&&Q(w,`material.${r}`,p)}}};return hn(d)&&(u.type="range",u.min=0,u.max=1),u}else{if(n.isColor)return{title:d,prop:r,type:"color",value:n,disabled:o,onChange:(u,m)=>{const p=new f.Color(m);t.updateObject(a.uuid,`material.${r}`,p);const g=t.getScene(a.uuid);if(g!==null){const w=g.getObjectByProperty("uuid",a.uuid);w!==void 0&&Q(w,`material.${r}`,p)}}};if(Array.isArray(n)){const u=[];for(const m in n){const p=n[m],g=`[${m.toString()}]`;if(p.value!==void 0){const w=ot(`${g}.value`,p.value,a,t,r,o);w!==void 0&&u.push(w)}else{const w=ot(g,p,a,t,r,o);w!==void 0&&u.push(w)}}if(u.length>0)return Ut(u),{title:d,items:u}}else{if(ea(n))return{title:d,prop:r,type:"vector2",value:n,disabled:o,onChange:(u,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const p=t.getScene(a.uuid);if(p!==null){const g=p.getObjectByProperty("uuid",a.uuid);g!==void 0&&Q(g,`material.${r}`,m)}}};if(ta(n))return{title:d,prop:r,type:"grid3",value:n,disabled:o,onChange:(u,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const p=t.getScene(a.uuid);if(p!==null){const g=p.getObjectByProperty("uuid",a.uuid);g!==void 0&&Q(g,`material.${r}`,m)}}};if(na(n))return{title:d,prop:r,type:"grid4",value:n,disabled:o,onChange:(u,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const p=t.getScene(a.uuid);if(p!==null){const g=p.getObjectByProperty("uuid",a.uuid);g!==void 0&&Q(g,`material.${r}`,m)}}};if(n.isEuler)return{title:d,prop:r,type:"euler",value:n,disabled:o,onChange:(u,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const p=t.getScene(a.uuid);if(p!==null){const g=p.getObjectByProperty("uuid",a.uuid);g!==void 0&&Q(g,`material.${r}`,m)}}};if(n.src!==void 0)return{title:d,type:"image",value:n,disabled:o,onChange:(u,m)=>{const p=Hn(e),g=i.length>0?`${i}.${p}`:p;t.createTexture(a.uuid,`material.${g}`,m);const w=t.getScene(a.uuid);if(w!==null){const I=w.getObjectByProperty("uuid",a.uuid);I!==void 0&&sn(m.src).then(V=>{V.offset.set(m.offset[0],m.offset[1]),V.repeat.set(m.repeat[0],m.repeat[1]);const $=I.material,k=g.split(".");switch(k.length){case 1:$[k[0]]=V;break;case 2:$[k[0]][k[1]]=V;break;case 3:$[k[0]][k[1]][k[2]]=V;break;case 4:$[k[0]][k[1]][k[2]][k[3]]=V;break;case 5:$[k[0]][k[1]][k[2]][k[3]][k[4]]=V;break}$.needsUpdate=!0})}}};if(n.elements!==void 0)return{title:d,prop:r,type:n.elements.length>9?"grid4":"grid3",value:n,disabled:o,onChange:(u,m)=>{t.updateObject(a.uuid,`material.${r}`,m);const p=t.getScene(a.uuid);if(p!==null){const g=p.getObjectByProperty("uuid",a.uuid);g!==void 0&&Q(g,`material.${r}`,m)}}};{const u=[],m=e==="defines"||e==="extensions";try{for(const p in n){const g=n[p];if(g!==void 0)if(g.value!==void 0){const w=ot(`${p}.value`,g.value,a,t,r,m);w!==void 0&&u.push(w)}else{const w=ot(p,g,a,t,r,m);w!==void 0&&u.push(w)}}}catch{console.log("Issue cycling through material object:",e,n)}if(u.length>0)return Ut(u),{title:d,items:u}}}}}function qt(e,n,a){const t=[];for(const i in e){if(!Gn(i))continue;const o=typeof e[i],d=e[i];if(o==="boolean")t.push(Zn(i,d,n,a));else if(o==="number")t.push(Jn(i,d,n,a));else if(o==="string")t.push(Qn(i,d,n,a));else if(o==="object"){const r=ot(i,d,n,a);r!==void 0&&t.push(r)}else d!==void 0&&console.log("other:",i,o,d)}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 o=i.getObjectByProperty("uuid",n.uuid);o!==void 0&&Q(o,"material.needsUpdate",!0)}}}),t}function aa(e,n){const a=e.material;if(Array.isArray(a)){const t=[],i=a.length;for(let o=0;o<i;o++)t.push(l.jsx($e,{title:`Material ${o}`,items:qt(a[o],e,n)},`Material ${o}`));return l.jsx(l.Fragment,{children:t})}else return l.jsx($e,{title:"Material",items:qt(a,e,n)})}const ia="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 ra(e){const n=E.useRef(null),a=E.useRef(null),t=E.useRef(null),i=E.useRef(null),o=E.useRef(null),[d]=E.useState(e.value),[r,h]=E.useState(e.value.offset[0]),[u,m]=E.useState(e.value.offset[1]),[p,g]=E.useState(e.value.repeat[0]),[w,I]=E.useState(e.value.repeat[1]);function V(k,L,_,Z,ee){if(e.onChange!==void 0){const he=e.prop!==void 0?e.prop:e.title;e.onChange(he,{src:k,offset:[L,_],repeat:[Z,ee]})}}function $(k){const L=n.current.src,_=k.target.value;switch(k.target){case a.current:h(_),V(L,_,u,p,w);break;case t.current:m(_),V(L,r,_,p,w);break;case i.current:g(_),V(L,r,u,_,w);break;case o.current:I(_),V(L,r,u,p,_);break}}return l.jsxs("div",{className:"imageField",children:[l.jsx("img",{alt:e.title,ref:n,onClick:()=>{Wn().then(k=>{n.current.src=k,V(k,r,u,p,w)})},src:d.src.length>0?d.src:ia}),l.jsxs("div",{className:"fields",children:[l.jsxs("div",{children:[l.jsx("label",{children:"Offset:"}),l.jsx("input",{ref:a,type:"number",value:r,step:.01,onChange:$}),l.jsx("input",{ref:t,type:"number",value:u,step:.01,onChange:$})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Repeat:"}),l.jsx("input",{ref:i,type:"number",value:p,step:.01,onChange:$}),l.jsx("input",{ref:o,type:"number",value:w,step:.01,onChange:$})]})]})]})}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),o=u=>{let m=u.target.value;e.type==="boolean"?m=u.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)},d={};e.disabled&&(d.opacity=.8);const r=e.type==="string"&&(a.length>100||a.search(`
30
+ `)>-1),h=r||e.type==="image"||e.type==="vector2";return l.jsxs("div",{className:`field ${h?"block":""}`,style:d,children:[e.type!=="button"&&l.jsx("label",{ref:i,children:ct(e.title)},"fieldLabel"),e.type==="string"&&!r&&l.jsx("input",{type:"text",disabled:e.disabled,onChange:o,value:a}),e.type==="string"&&r&&l.jsx("textarea",{cols:50,rows:10,disabled:e.disabled!==void 0?e.disabled:!0,onChange:o,onKeyDown:u=>{e.onKeyDown!==void 0&&e.onKeyDown(u)},value:a}),e.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:e.disabled,onChange:o,checked:a}),e.type==="number"&&l.jsx(Ye,{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"&&l.jsx(Ye,{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"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:o,disabled:e.disabled,className:"color"}),l.jsx("input",{type:"color",value:a,onChange:o,disabled:e.disabled})]}),e.type==="button"&&l.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"&&l.jsx(ra,{title:e.title,prop:e.prop,value:e.value,onChange:e.onChange}),e.type==="option"&&l.jsx(l.Fragment,{children:l.jsx("select",{onChange:o,disabled:e.disabled,defaultValue:e.value,children:e.options?.map((u,m)=>l.jsx("option",{value:u.value,children:ct(u.title)},m))})}),e.type==="vector2"&&l.jsx(Bn,{value:a,min:0,max:1,onChange:o}),e.type==="grid3"&&l.jsx($t,{value:a,onChange:o}),e.type==="grid4"&&l.jsx(Vn,{value:a,onChange:o}),e.type==="euler"&&l.jsx($t,{value:a,onChange:o})]})}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 sa(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,o)=>{n.updateObject(e.uuid,i,o),n.requestMethod(e.uuid,"updateProjectionMatrix");const d=n.getScene(e.uuid);if(d!==null){const r=d.getObjectByProperty("uuid",e.uuid);r!==void 0&&(Q(r,i,o),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,o)=>{n.updateObject(e.uuid,i,o),n.requestMethod(e.uuid,"updateProjectionMatrix");const d=n.getScene(e.uuid);if(d!==null){const r=d.getObjectByProperty("uuid",e.uuid);r!==void 0&&(Q(r,i,o),r.updateProjectionMatrix())}}});return l.jsx($e,{title:"Camera",items:a})}function oa(e,n){const a=new f.Matrix4;a.elements=e.matrix;const t=new f.Vector3,i=new f.Euler,o=new f.Vector3;e.uuid.length>0&&(t.setFromMatrixPosition(a),i.setFromRotationMatrix(a),o.setFromMatrixScale(a));const d=(r,h)=>{const u=r==="rotation"?{x:h._x,y:h._y,z:h._z}:h;n.updateObject(e.uuid,r,u);const m=n.getScene(e.uuid);if(m!==null){const p=m.getObjectByProperty("uuid",e.uuid);p!==void 0&&Q(p,r,u)}};return l.jsx($e,{title:"Transform",items:[{title:"Position",prop:"position",type:"grid3",value:t,onChange:d},{title:"Rotation",prop:"rotation",type:"grid3",value:i,onChange:d},{title:"Scale",prop:"scale",type:"grid3",value:o,onChange:d}]})}function Xt(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 ca(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:Xt(t),prop:t,type:"color",value:i,onChange:(o,d)=>{const r=new f.Color(d);n.updateObject(e.uuid,o,r);const h=n.getScene(e.uuid);if(h!==null){const u=h.getObjectByProperty("uuid",e.uuid);u!==void 0&&Q(u,o,r)}}}):a.push({title:Xt(t),prop:t,type:typeof i,value:i,step:typeof i=="number"?.01:void 0,onChange:(o,d)=>{n.updateObject(e.uuid,o,d);const r=n.getScene(e.uuid);if(r!==null){const h=r.getObjectByProperty("uuid",e.uuid);h!==void 0&&Q(h,o,d)}}}))}return l.jsx($e,{title:"Light",items:a})}function la(e,n){const a=[],t=[];let i=0;e.animations.forEach(d=>{i=Math.max(i,d.duration),d.duration>0&&t.push({title:d.name,items:[{title:"Duration",type:"number",value:d.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 o=n.getScene(e.uuid);if(o!==null){const d=o.getObjectByProperty("uuid",e.uuid);let r=!1;if(d!==void 0){const h=d.mixer;if(r=h!==void 0,r){const u=[{title:"Time Scale",type:"range",value:h.timeScale,step:.01,min:-1,max:2,onChange:(m,p)=>{h.timeScale=p,n.updateObject(e.uuid,"mixer.timeScale",p)}}];u.push({title:"Stop All",type:"button",onChange:()=>{h.stopAllAction(),n.requestMethod(e.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:u})}}}return l.jsx($e,{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 d(h){de={...h.value},a(Date.now())}function r(){de={...fn},a(Date.now())}return A.addEventListener(j.SET_SCENE,r),A.addEventListener(j.SET_OBJECT,d),()=>{A.removeEventListener(j.SET_SCENE,r),A.removeEventListener(j.SET_OBJECT,d)}},[]);const t=de.type.toLowerCase(),i=de.animations.length>0||de.mixer!==void 0,o=t.search("mesh")>-1||t.search("line")>-1||t.search("points")>-1;return l.jsx(Ot,{label:"Inspector",children:l.jsx("div",{id:"Inspector",className:e.class,children:de.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(St,{type:"string",title:"Name",prop:"name",value:de.name,disabled:!0}),l.jsx(St,{type:"string",title:"Type",prop:"type",value:de.type,disabled:!0}),l.jsx(St,{type:"string",title:"UUID",prop:"uuid",value:de.uuid,disabled:!0})]}),l.jsxs(l.Fragment,{children:[oa(de,e.three),i?la(de,e.three):null,t.search("camera")>-1?sa(de,e.three):null,t.search("light")>-1?ca(de,e.three):null,o?aa(de,e.three):null]})]})},n)},"Inspector")}function ua(e){const[n]=E.useState([]),[a,t]=E.useState(0),i=r=>{n.push(r.value),t(Date.now())},o=r=>{const h=r.value;for(let u=0;u<n.length;u++)if(h.uuid===n[u].uuid){n.splice(u,1),t(Date.now());return}};E.useEffect(()=>(A.addEventListener(j.ADD_SCENE,i),A.addEventListener(j.REMOVE_SCENE,o),()=>{A.removeEventListener(j.ADD_SCENE,i),A.removeEventListener(j.REMOVE_SCENE,o)}),[]);const d=[];return n.forEach((r,h)=>{d.push(l.jsx(Ot,{label:`Scene: ${r.name}`,open:!0,children:l.jsx(dn,{child:r,scene:r,three:e.three})},`scene_${h}`))}),l.jsxs("div",{id:"SidePanel",children:[d,l.jsx(mn,{three:e.three})]},`SidePanel ${a}`)}function da(e){return E.useEffect(()=>{function n(r){let h=null;return e.three.scenes.forEach(u=>{r.search(u.uuid)>-1&&(h=u)}),h}const a=r=>{const h=r.value,m=n(h)?.getObjectByProperty("uuid",h);m!==void 0&&e.three.setObject(m)},t=(r,h,u)=>{const p=n(r)?.getObjectByProperty("uuid",r);p!==void 0&&Q(p,h,u)},i=r=>{const h=r.value,{key:u,value:m,uuid:p}=h;t(p,u,m)},o=r=>{const h=r.value,m=n(h.uuid)?.getObjectByProperty("uuid",h.uuid);m!==void 0&&sn(h.value.src).then(p=>{p.offset.set(h.value.offset[0],h.value.offset[1]),p.repeat.set(h.value.repeat[0],h.value.repeat[1]);const g=h.key.split(".");switch(g.length){case 1:m[g[0]]=p;break;case 2:m[g[0]][g[1]]=p;break;case 3:m[g[0]][g[1]][g[2]]=p;break;case 4:m[g[0]][g[1]][g[2]][g[3]]=p;break;case 5:m[g[0]][g[1]][g[2]][g[3]][g[4]]=p;break}m.material.needsUpdate=!0})},d=r=>{const{key:h,uuid:u,value:m,subitem:p}=r.value,w=n(u)?.getObjectByProperty("uuid",u);if(w!==void 0)try{p!==void 0?kn(w,p)[h](m):w[h](m)}catch(I){console.log("Error requesting method:"),console.log(I),console.log(h),console.log(m)}};return A.addEventListener(j.GET_OBJECT,a),A.addEventListener(j.UPDATE_OBJECT,i),A.addEventListener(j.CREATE_TEXTURE,o),A.addEventListener(j.REQUEST_METHOD,d),()=>{A.removeEventListener(j.GET_OBJECT,a),A.removeEventListener(j.UPDATE_OBJECT,i),A.removeEventListener(j.CREATE_TEXTURE,o),A.removeEventListener(j.REQUEST_METHOD,d)}},[]),null}class ha 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 o=new f.LineBasicMaterial({fog:!1});super(i,o),this.light=n,this.color=a,this.type="RectAreaLightHelper";const d=[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(d,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 Zt={type:"change"},Pt={type:"start"},Jt={type:"end"},vt=new f.Ray,Qt=new f.Plane,fa=Math.cos(70*f.MathUtils.DEG2RAD);class ma 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(c){c.addEventListener("keydown",nt),this._domElementKeyEvents=c},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(Zt),t.update(),o=i.NONE},this.update=function(){const c=new f.Vector3,x=new f.Quaternion().setFromUnitVectors(n.up,new f.Vector3(0,1,0)),P=x.clone().invert(),B=new f.Vector3,ae=new f.Quaternion,ve=new f.Vector3,le=2*Math.PI;return function(mt=null){const pt=t.object.position;c.copy(pt).sub(t.target),c.applyQuaternion(x),r.setFromVector3(c),t.autoRotate&&o===i.NONE&&pe(Me(mt)),t.enableDamping?(r.theta+=h.theta*t.dampingFactor,r.phi+=h.phi*t.dampingFactor):(r.theta+=h.theta,r.phi+=h.phi);let be=t.minAzimuthAngle,ye=t.maxAzimuthAngle;isFinite(be)&&isFinite(ye)&&(be<-Math.PI?be+=le:be>Math.PI&&(be-=le),ye<-Math.PI?ye+=le:ye>Math.PI&&(ye-=le),be<=ye?r.theta=Math.max(be,Math.min(ye,r.theta)):r.theta=r.theta>(be+ye)/2?Math.max(be,r.theta):Math.min(ye,r.theta)),r.phi=Math.max(t.minPolarAngle,Math.min(t.maxPolarAngle,r.phi)),r.makeSafe(),t.enableDamping===!0?t.target.addScaledVector(m,t.dampingFactor):t.target.add(m),t.target.sub(t.cursor),t.target.clampLength(t.minTargetRadius,t.maxTargetRadius),t.target.add(t.cursor);let He=!1;if(t.zoomToCursor&&he||t.object.isOrthographicCamera)r.radius=_e(r.radius);else{const Ce=r.radius;r.radius=_e(r.radius*u),He=Ce!=r.radius}if(c.setFromSpherical(r),c.applyQuaternion(P),pt.copy(t.target).add(c),t.object.lookAt(t.target),t.enableDamping===!0?(h.theta*=1-t.dampingFactor,h.phi*=1-t.dampingFactor,m.multiplyScalar(1-t.dampingFactor)):(h.set(0,0,0),m.set(0,0,0)),t.zoomToCursor&&he){let Ce=null;if(t.object.isPerspectiveCamera){const Fe=c.length();Ce=_e(Fe*u);const Xe=Fe-Ce;t.object.position.addScaledVector(Z,Xe),t.object.updateMatrixWorld(),He=!!Xe}else if(t.object.isOrthographicCamera){const Fe=new f.Vector3(ee.x,ee.y,0);Fe.unproject(t.object);const Xe=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/u)),t.object.updateProjectionMatrix(),He=Xe!==t.object.zoom;const gt=new f.Vector3(ee.x,ee.y,0);gt.unproject(t.object),t.object.position.sub(gt).add(Fe),t.object.updateMatrixWorld(),Ce=c.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))<fa?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/u)),Ce!==t.object.zoom&&(t.object.updateProjectionMatrix(),He=!0)}return u=1,he=!1,He||B.distanceToSquared(t.object.position)>d||8*(1-ae.dot(t.object.quaternion))>d||ve.distanceToSquared(t.target)>d?(t.dispatchEvent(Zt),B.copy(t.object.position),ae.copy(t.object.quaternion),ve.copy(t.target),!0):!1}}(),this.dispose=function(){t.domElement.removeEventListener("contextmenu",Ke),t.domElement.removeEventListener("pointerdown",D),t.domElement.removeEventListener("pointercancel",K),t.domElement.removeEventListener("wheel",ut),t.domElement.removeEventListener("pointermove",H),t.domElement.removeEventListener("pointerup",K),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 o=i.NONE;const d=1e-6,r=new f.Spherical,h=new f.Spherical;let u=1;const m=new f.Vector3,p=new f.Vector2,g=new f.Vector2,w=new f.Vector2,I=new f.Vector2,V=new f.Vector2,$=new f.Vector2,k=new f.Vector2,L=new f.Vector2,_=new f.Vector2,Z=new f.Vector3,ee=new f.Vector2;let he=!1;const q=[],fe={};let se=!1;function Me(c){return c!==null?2*Math.PI/60*t.autoRotateSpeed*c:2*Math.PI/60/60*t.autoRotateSpeed}function Oe(c){const x=Math.abs(c*.01);return Math.pow(.95,t.zoomSpeed*x)}function pe(c){h.theta-=c}function z(c){h.phi-=c}const ge=function(){const c=new f.Vector3;return function(P,B){c.setFromMatrixColumn(B,0),c.multiplyScalar(-P),m.add(c)}}(),T=function(){const c=new f.Vector3;return function(P,B){t.screenSpacePanning===!0?c.setFromMatrixColumn(B,1):(c.setFromMatrixColumn(B,0),c.crossVectors(t.object.up,c)),c.multiplyScalar(P),m.add(c)}}(),Se=function(){const c=new f.Vector3;return function(P,B){const ae=t.domElement;if(t.object.isPerspectiveCamera){const ve=t.object.position;c.copy(ve).sub(t.target);let le=c.length();le*=Math.tan(t.object.fov/2*Math.PI/180),ge(2*P*le/ae.clientHeight,t.object.matrix),T(2*B*le/ae.clientHeight,t.object.matrix)}else t.object.isOrthographicCamera?(ge(P*(t.object.right-t.object.left)/t.object.zoom/ae.clientWidth,t.object.matrix),T(B*(t.object.top-t.object.bottom)/t.object.zoom/ae.clientHeight,t.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),t.enablePan=!1)}}();function Re(c){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?u/=c:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function ke(c){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?u*=c:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function Te(c,x){if(!t.zoomToCursor)return;he=!0;const P=t.domElement.getBoundingClientRect(),B=c-P.left,ae=x-P.top,ve=P.width,le=P.height;ee.x=B/ve*2-1,ee.y=-(ae/le)*2+1,Z.set(ee.x,ee.y,1).unproject(t.object).sub(t.object.position).normalize()}function _e(c){return Math.max(t.minDistance,Math.min(t.maxDistance,c))}function De(c){p.set(c.clientX,c.clientY)}function je(c){Te(c.clientX,c.clientX),k.set(c.clientX,c.clientY)}function Ie(c){I.set(c.clientX,c.clientY)}function ie(c){g.set(c.clientX,c.clientY),w.subVectors(g,p).multiplyScalar(t.rotateSpeed);const x=t.domElement;pe(2*Math.PI*w.x/x.clientHeight),z(2*Math.PI*w.y/x.clientHeight),p.copy(g),t.update()}function xe(c){L.set(c.clientX,c.clientY),_.subVectors(L,k),_.y>0?Re(Oe(_.y)):_.y<0&&ke(Oe(_.y)),k.copy(L),t.update()}function ze(c){V.set(c.clientX,c.clientY),$.subVectors(V,I).multiplyScalar(t.panSpeed),Se($.x,$.y),I.copy(V),t.update()}function Ge(c){Te(c.clientX,c.clientY),c.deltaY<0?ke(Oe(c.deltaY)):c.deltaY>0&&Re(Oe(c.deltaY)),t.update()}function ce(c){let x=!1;switch(c.code){case t.keys.UP:c.ctrlKey||c.metaKey||c.shiftKey?z(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(0,t.keyPanSpeed),x=!0;break;case t.keys.BOTTOM:c.ctrlKey||c.metaKey||c.shiftKey?z(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(0,-t.keyPanSpeed),x=!0;break;case t.keys.LEFT:c.ctrlKey||c.metaKey||c.shiftKey?pe(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(t.keyPanSpeed,0),x=!0;break;case t.keys.RIGHT:c.ctrlKey||c.metaKey||c.shiftKey?pe(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Se(-t.keyPanSpeed,0),x=!0;break}x&&(c.preventDefault(),t.update())}function b(c){if(q.length===1)p.set(c.pageX,c.pageY);else{const x=Le(c),P=.5*(c.pageX+x.x),B=.5*(c.pageY+x.y);p.set(P,B)}}function y(c){if(q.length===1)I.set(c.pageX,c.pageY);else{const x=Le(c),P=.5*(c.pageX+x.x),B=.5*(c.pageY+x.y);I.set(P,B)}}function R(c){const x=Le(c),P=c.pageX-x.x,B=c.pageY-x.y,ae=Math.sqrt(P*P+B*B);k.set(0,ae)}function F(c){t.enableZoom&&R(c),t.enablePan&&y(c)}function me(c){t.enableZoom&&R(c),t.enableRotate&&b(c)}function oe(c){if(q.length==1)g.set(c.pageX,c.pageY);else{const P=Le(c),B=.5*(c.pageX+P.x),ae=.5*(c.pageY+P.y);g.set(B,ae)}w.subVectors(g,p).multiplyScalar(t.rotateSpeed);const x=t.domElement;pe(2*Math.PI*w.x/x.clientHeight),z(2*Math.PI*w.y/x.clientHeight),p.copy(g)}function M(c){if(q.length===1)V.set(c.pageX,c.pageY);else{const x=Le(c),P=.5*(c.pageX+x.x),B=.5*(c.pageY+x.y);V.set(P,B)}$.subVectors(V,I).multiplyScalar(t.panSpeed),Se($.x,$.y),I.copy(V)}function C(c){const x=Le(c),P=c.pageX-x.x,B=c.pageY-x.y,ae=Math.sqrt(P*P+B*B);L.set(0,ae),_.set(0,Math.pow(L.y/k.y,t.zoomSpeed)),Re(_.y),k.copy(L);const ve=(c.pageX+x.x)*.5,le=(c.pageY+x.y)*.5;Te(ve,le)}function W(c){t.enableZoom&&C(c),t.enablePan&&M(c)}function te(c){t.enableZoom&&C(c),t.enableRotate&&oe(c)}function D(c){t.enabled!==!1&&(q.length===0&&(t.domElement.setPointerCapture(c.pointerId),t.domElement.addEventListener("pointermove",H),t.domElement.addEventListener("pointerup",K)),!kt(c)&&(Tt(c),c.pointerType==="touch"?at(c):Pe(c)))}function H(c){t.enabled!==!1&&(c.pointerType==="touch"?ht(c):qe(c))}function K(c){switch(_t(c),q.length){case 0:t.domElement.releasePointerCapture(c.pointerId),t.domElement.removeEventListener("pointermove",H),t.domElement.removeEventListener("pointerup",K),t.dispatchEvent(Jt),o=i.NONE;break;case 1:const x=q[0],P=fe[x];at({pointerId:x,pageX:P.x,pageY:P.y});break}}function Pe(c){let x;switch(c.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(c),o=i.DOLLY;break;case f.MOUSE.ROTATE:if(c.ctrlKey||c.metaKey||c.shiftKey){if(t.enablePan===!1)return;Ie(c),o=i.PAN}else{if(t.enableRotate===!1)return;De(c),o=i.ROTATE}break;case f.MOUSE.PAN:if(c.ctrlKey||c.metaKey||c.shiftKey){if(t.enableRotate===!1)return;De(c),o=i.ROTATE}else{if(t.enablePan===!1)return;Ie(c),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&t.dispatchEvent(Pt)}function qe(c){switch(o){case i.ROTATE:if(t.enableRotate===!1)return;ie(c);break;case i.DOLLY:if(t.enableZoom===!1)return;xe(c);break;case i.PAN:if(t.enablePan===!1)return;ze(c);break}}function ut(c){t.enabled===!1||t.enableZoom===!1||o!==i.NONE||(c.preventDefault(),t.dispatchEvent(Pt),Ge(dt(c)),t.dispatchEvent(Jt))}function dt(c){const x=c.deltaMode,P={clientX:c.clientX,clientY:c.clientY,deltaY:c.deltaY};switch(x){case 1:P.deltaY*=16;break;case 2:P.deltaY*=100;break}return c.ctrlKey&&!se&&(P.deltaY*=10),P}function tt(c){c.key==="Control"&&(se=!0,t.domElement.getRootNode().addEventListener("keyup",Ne,{passive:!0,capture:!0}))}function Ne(c){c.key==="Control"&&(se=!1,t.domElement.getRootNode().removeEventListener("keyup",Ne,{passive:!0,capture:!0}))}function nt(c){t.enabled===!1||t.enablePan===!1||ce(c)}function at(c){switch(ft(c),q.length){case 1:switch(t.touches.ONE){case f.TOUCH.ROTATE:if(t.enableRotate===!1)return;b(c),o=i.TOUCH_ROTATE;break;case f.TOUCH.PAN:if(t.enablePan===!1)return;y(c),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(t.touches.TWO){case f.TOUCH.DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;F(c),o=i.TOUCH_DOLLY_PAN;break;case f.TOUCH.DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;me(c),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&t.dispatchEvent(Pt)}function ht(c){switch(ft(c),o){case i.TOUCH_ROTATE:if(t.enableRotate===!1)return;oe(c),t.update();break;case i.TOUCH_PAN:if(t.enablePan===!1)return;M(c),t.update();break;case i.TOUCH_DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;W(c),t.update();break;case i.TOUCH_DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;te(c),t.update();break;default:o=i.NONE}}function Ke(c){t.enabled!==!1&&c.preventDefault()}function Tt(c){q.push(c.pointerId)}function _t(c){delete fe[c.pointerId];for(let x=0;x<q.length;x++)if(q[x]==c.pointerId){q.splice(x,1);return}}function kt(c){for(let x=0;x<q.length;x++)if(q[x]==c.pointerId)return!0;return!1}function ft(c){let x=fe[c.pointerId];x===void 0&&(x=new f.Vector2,fe[c.pointerId]=x),x.set(c.pageX,c.pageY)}function Le(c){const x=c.pointerId===q[0]?q[1]:q[0];return fe[x]}t.domElement.addEventListener("contextmenu",Ke),t.domElement.addEventListener("pointerdown",D),t.domElement.addEventListener("pointercancel",K),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=o=>{o!==n&&(e.onSelect(o),a(o)),e.onToggle(!1)};return l.jsxs("div",{className:`dropdown ${e.up===!0?"up":""}`,children:[l.jsx("div",{className:"dropdown-toggle",onClick:t,children:n}),e.open&&l.jsx("ul",{className:"dropdown-menu",children:e.options.map(o=>l.jsx("li",{onClick:()=>i(o),children:o},o))})]})},We=E.forwardRef(function(n,a){const[t,i]=E.useState(!1),o=n.options.indexOf(n.camera.name);return l.jsxs("div",{className:"CameraWindow",children:[l.jsx("div",{ref:a,className:"clickable",onClick:()=>{t&&i(!1)}}),l.jsx(xt,{index:o,open:t,options:n.options,onSelect:n.onSelect,onToggle:d=>{i(d)},up:!0})]})});class pa 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() {
@@ -103,7 +103,7 @@ C11,8.22,10.74,8,10.43,8z`})});function on(e){return u.jsx(en.Reorder.Item,{valu
103
103
  fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
104
104
 
105
105
  if (fragColor.a <= 0.0) discard;
106
- }`,name:"InfiniteGrid",depthWrite:!1})}}class pa extends f.Mesh{gridMaterial;constructor(){const n=new ma;super(new f.PlaneGeometry(2,2),n),this.gridMaterial=n,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const ga=`#include <common>
106
+ }`,name:"InfiniteGrid",depthWrite:!1})}}class ga extends f.Mesh{gridMaterial;constructor(){const n=new pa;super(new f.PlaneGeometry(2,2),n),this.gridMaterial=n,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const va=`#include <common>
107
107
  #include <batching_pars_vertex>
108
108
  #include <uv_pars_vertex>
109
109
  #include <color_pars_vertex>
@@ -133,7 +133,7 @@ void main() {
133
133
  #include <logdepthbuf_vertex>
134
134
  #include <clipping_planes_vertex>
135
135
  #include <worldpos_vertex>
136
- }`,va=`
136
+ }`,ba=`
137
137
  #include <common>
138
138
  #include <uv_pars_fragment>
139
139
  #include <clipping_planes_pars_fragment>
@@ -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,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;
144
+ }`;class ya extends f.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:va,fragmentShader:ba})}}let bt="Renderer",we,yt=!1,At=!1,X=null,re=null,Ue=null,Be=null;function Ea(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",o=localStorage.getItem(`${n}_blCam`)!==null?localStorage.getItem(`${n}_blCam`):"Front",d=localStorage.getItem(`${n}_brCam`)!==null?localStorage.getItem(`${n}_brCam`):"Top",r=E.useMemo(()=>new Map,[]),h=E.useMemo(()=>new Map,[]),u=E.useMemo(()=>new Map,[]),m=E.useMemo(()=>new Map,[]),p=E.useMemo(()=>new f.Scene,[]),g=E.useMemo(()=>new f.Group,[]),w=E.useMemo(()=>new ga,[]),I=E.useMemo(()=>new f.AxesHelper(500),[]),V=E.useMemo(()=>new f.AxesHelper(100),[]),$=E.useMemo(()=>new f.MeshDepthMaterial,[]),k=E.useMemo(()=>new f.MeshNormalMaterial,[]),L=E.useMemo(()=>new ya,[]),_=E.useMemo(()=>new f.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),[]);function Z(b,y){const R=new f.OrthographicCamera(-100,100,100,-100,50,5e3);return R.name=b,R.position.copy(y),R.lookAt(0,0,0),r.set(b,R),R}const ee=["Renderer","Depth","Normals","UVs","Wireframe"],he=["Single","Side by Side","Stacked","Quad"],q=E.useRef(null),fe=E.useRef(null),se=E.useRef(null),Me=E.useRef(null),Oe=E.useRef(null),pe=E.useRef(null),[z,ge]=E.useState(a!==null?a:"Single"),[T,Se]=E.useState(null),[Re,ke]=E.useState(!1),[Te,_e]=E.useState(!1),[De,je]=E.useState(!1),[,Ie]=E.useState(Date.now());localStorage.setItem(`${n}_mode`,z),localStorage.setItem(`${n}_tlCam`,t),localStorage.setItem(`${n}_trCam`,i),localStorage.setItem(`${n}_blCam`,o),localStorage.setItem(`${n}_brCam`,d);const ie=(b,y)=>{const R=h.get(b.name);if(R!==void 0&&R.dispose(),h.delete(b.name),b.name==="UI")return;const F=new ma(b,y);switch(F.enableDamping=!0,F.dampingFactor=.05,b.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":F.enableRotate=!1;break}h.set(b.name,F)},xe=b=>{const y=u.get(b.name);y!==void 0&&(p.remove(y),y.dispose(),u.delete(b.name));const R=h.get(b.name);R!==void 0&&(R.dispose(),h.delete(b.name))},ze=()=>{h.forEach((b,y)=>{b.dispose();const R=u.get(y);R!==void 0&&(p.remove(R),R.dispose()),u.delete(y),h.delete(y)}),h.clear(),u.clear()},Ge=()=>{switch(z){case"Single":ie(X,se.current);break;case"Side by Side":case"Stacked":ie(X,se.current),ie(re,Me.current);break;case"Quad":ie(X,se.current),ie(re,Me.current),ie(Ue,Oe.current),ie(Be,pe.current);break}};E.useEffect(()=>{const b=new f.WebGLRenderer({canvas:q.current,stencil:!1});b.autoClear=!1,b.shadowMap.enabled=!0,b.setPixelRatio(devicePixelRatio),b.setClearColor(0),e.three.renderer=b,Se(b)},[]),E.useEffect(()=>{p.name="Debug Scene",p.uuid="",g.name="helpers",p.add(g),g.add(w),I.name="axisHelper",g.add(I),V.name="interactionHelper",g.add(V),V.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),X=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=()=>{m.forEach(M=>{g.remove(M),M.dispose()}),m.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`,m.set(M.name,C),g.add(C);break;case"HemisphereLight":C=new f.HemisphereLightHelper(M,250),C.name=`${M.name}Helper`,m.set(M.name,C),g.add(C);break;case"RectAreaLight":C=new ha(M),C.name=`${M.name}Helper`,m.set(M.name,C),g.add(C);break;case"PointLight":C=new f.PointLightHelper(M,100),C.name=`${M.name}Helper`,m.set(M.name,C),g.add(C);break;case"SpotLight":C=new f.SpotLightHelper(M),C.name=`${M.name}Helper`,m.set(M.name,C),g.add(C);break}}})},R=M=>{g.add(I),b(),et(we),p.remove(we);const C=e.scenes.get(M.value.name);if(C!==void 0){const W=new C;e.onSceneSet!==void 0&&e.onSceneSet(W),we=W,e.three.scene=we,p.add(we),At=!0,y()}},F=M=>{const C=M.value,W=e.three.scene?.getObjectByProperty("uuid",C.uuid);if(W!==void 0&&r.set(C.name,W),W instanceof f.PerspectiveCamera){const te=new f.CameraHelper(W);u.set(W.name,te),p.add(te)}Ie(Date.now())},me=M=>{const C=u.get(M.value.name);C!==void 0&&(p.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(I)};return A.addEventListener(j.SET_SCENE,R),A.addEventListener(j.ADD_CAMERA,F),A.addEventListener(j.REMOVE_CAMERA,me),A.addEventListener(j.SET_OBJECT,oe),()=>{A.removeEventListener(j.SET_SCENE,R),A.removeEventListener(j.ADD_CAMERA,F),A.removeEventListener(j.REMOVE_CAMERA,me),A.removeEventListener(j.SET_OBJECT,oe)}},[]),E.useEffect(()=>{if(T===null)return;let b=window.innerWidth,y=window.innerHeight,R=Math.floor(b/2),F=Math.floor(y/2),me=-1;const oe=()=>{b=window.innerWidth-300,y=window.innerHeight,R=Math.floor(b/2),F=Math.floor(y/2),e.three.resize(b,y),e.onSceneResize!==void 0&&At&&e.onSceneResize(we,b,y);let D=b,H=y;switch(z){case"Side by Side":D=R,H=y;break;case"Stacked":D=b,H=F;break;case"Quad":D=R,H=F;break}r.forEach(K=>{K instanceof f.OrthographicCamera?(K.left=D/-2,K.right=D/2,K.top=H/2,K.bottom=H/-2,K.name==="UI"&&(K.position.x=b/2,K.position.y=y/-2,K.position.z=100),K.updateProjectionMatrix()):K instanceof f.PerspectiveCamera&&(K.aspect=D/H,K.updateProjectionMatrix(),u.get(K.name)?.update())})},M=()=>{T.setViewport(0,0,b,y),T.setScissor(0,0,b,y),T.render(p,X)},C=()=>{if(z==="Side by Side")T.setViewport(0,0,R,y),T.setScissor(0,0,R,y),T.render(p,X),T.setViewport(R,0,R,y),T.setScissor(R,0,R,y),T.render(p,re);else{const D=y-F;T.setViewport(0,D,b,F),T.setScissor(0,D,b,F),T.render(p,X),T.setViewport(0,0,b,F),T.setScissor(0,0,b,F),T.render(p,re)}},W=()=>{let D=0,H=0;H=y-F,D=0,T.setViewport(D,H,R,F),T.setScissor(D,H,R,F),T.render(p,X),D=R,T.setViewport(D,H,R,F),T.setScissor(D,H,R,F),T.render(p,re),H=0,D=0,T.setViewport(D,H,R,F),T.setScissor(D,H,R,F),T.render(p,Ue),D=R,T.setViewport(D,H,R,F),T.setScissor(D,H,R,F),T.render(p,Be)},te=()=>{switch(h.forEach(D=>{D.update()}),u.forEach(D=>{D.update()}),m.forEach(D=>{D.update!==void 0&&D.update()}),e.onSceneUpdate!==void 0&&At&&e.onSceneUpdate(we),T.clear(),z){case"Single":M();break;case"Side by Side":case"Stacked":C();break;case"Quad":W();break}me=requestAnimationFrame(te)};return Ge(),window.addEventListener("resize",oe),oe(),te(),()=>{window.removeEventListener("resize",oe),cancelAnimationFrame(me),me=-1}},[z,T]),E.useEffect(()=>{if(T!==null){const b=new f.Raycaster,y=new f.Vector2,R=(M,C,W,te)=>{switch(z){case"Quad":M<W?C<te?b.setFromCamera(y,X):b.setFromCamera(y,Ue):C<te?b.setFromCamera(y,re):b.setFromCamera(y,Be);break;case"Side by Side":M<W?b.setFromCamera(y,X):b.setFromCamera(y,re);break;case"Single":b.setFromCamera(y,X);break;case"Stacked":C<te?b.setFromCamera(y,X):b.setFromCamera(y,re);break}},F=M=>{if(!yt)return;const C=new f.Vector2;T.getSize(C);const W=Math.min(M.clientX,C.x),te=Math.min(M.clientY,C.y);y.x=Qe(W,0,C.x,-1,1),y.y=Qe(te,0,C.y,1,-1);const D=C.x/2,H=C.y/2,K=()=>{W<D?y.x=Qe(W,0,D,-1,1):y.x=Qe(W,D,C.x,-1,1)},Pe=()=>{te<H?y.y=Qe(te,0,H,1,-1):y.y=Qe(te,H,C.y,1,-1)};switch(z){case"Quad":K(),Pe();break;case"Side by Side":K();break;case"Stacked":Pe(),Pe();break}R(W,te,D,H);const qe=b.intersectObjects(we.children);qe.length>0&&V.position.copy(qe[0].point)},me=M=>{if(!yt)return;const C=new f.Vector2;if(T.getSize(C),M.clientX>=C.x)return;F(M);const W=b.intersectObjects(we.children);W.length>0&&e.three.getObject(W[0].object.uuid)},oe=fe.current;return oe.addEventListener("mousemove",F,!1),oe.addEventListener("click",me,!1),()=>{oe.removeEventListener("mousemove",F),oe.removeEventListener("click",me)}}},[z,T]);const ce=[];return r.forEach((b,y)=>{ce.push(y)}),l.jsxs("div",{className:"multiview",children:[l.jsx("canvas",{ref:q}),T!==null&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`cameras ${z==="Single"||z==="Stacked"?"single":""}`,ref:fe,children:[z==="Single"&&l.jsx(l.Fragment,{children:l.jsx(We,{camera:X,options:ce,ref:se,onSelect:b=>{h.get(X.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(X),X=y,localStorage.setItem(`${n}_tlCam`,y.name),ie(y,se.current))}})}),(z==="Side by Side"||z==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(We,{camera:X,options:ce,ref:se,onSelect:b=>{h.get(X.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(X),X=y,localStorage.setItem(`${n}_tlCam`,y.name),ie(y,se.current))}}),l.jsx(We,{camera:re,options:ce,ref:Me,onSelect:b=>{h.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))}})]}),z==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(We,{camera:X,options:ce,ref:se,onSelect:b=>{h.get(X.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(X),X=y,localStorage.setItem(`${n}_tlCam`,y.name),ie(y,se.current))}}),l.jsx(We,{camera:re,options:ce,ref:Me,onSelect:b=>{h.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))}}),l.jsx(We,{camera:Ue,options:ce,ref:Oe,onSelect:b=>{h.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))}}),l.jsx(We,{camera:Be,options:ce,ref:pe,onSelect:b=>{h.get(Be.name)?.dispose();const y=r.get(b);y!==void 0&&(xe(Be),Be=y,localStorage.setItem(`${n}_brCam`,y.name),ie(y,pe.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(xt,{index:he.indexOf(z),options:he,onSelect:b=>{b!==z&&(ze(),ge(b))},open:Re,onToggle:b=>{ke(b),Te&&_e(!1),De&&je(!1)}}),l.jsx(xt,{index:ee.indexOf(bt),options:ee,onSelect:b=>{if(b!==bt)switch(bt=b,bt){case"Depth":p.overrideMaterial=$;break;case"Normals":p.overrideMaterial=k;break;default:case"Renderer":p.overrideMaterial=null;break;case"Wireframe":p.overrideMaterial=_;break;case"UVs":p.overrideMaterial=L;break}},open:Te,onToggle:b=>{Re&&ke(!1),_e(b),De&&je(!1)}}),l.jsx(xt,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:b=>{yt=b==="Selection Mode",V.visible=yt},open:De,onToggle:b=>{Re&&ke(!1),Te&&_e(!1),je(b)}})]})]})]})}function Sa(e){return l.jsxs("div",{className:"editor",ref:e.ref,style:e.style,children:[l.jsx("div",{className:"header",children:e.header}),e.children,l.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=Sa;exports.Inspector=mn;exports.MultiView=Ea;exports.NavButton=Bt;exports.RemoteComponents=Mn;exports.RemoteController=Fn;exports.RemoteTheatre=Mt;exports.RemoteThree=Pn;exports.RemoteTweakpane=An;exports.SceneInspector=da;exports.SidePanel=ua;exports.ToolEvents=j;exports.capitalize=ct;exports.clamp=Ve;exports.colorToHex=an;exports.debugDispatcher=A;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;