@tomorrowevening/hermes 0.0.69 → 0.0.70

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 ot(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())},ct=e=>{if(e){for(;e.children.length>0;){const n=e.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):ct(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=>{ct(n)}),this.scenes.clear(),this.scene&&ct(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||(this.scenes.delete(n.name),!this.app.debugEnabled))return;const a=Et(n);this.app.send({event:"removeScene",target:"editor",data:a})}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:{}},at={};/**
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 ot(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.replaceAll(" ","").replaceAll("/",".");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())},ct=e=>{if(e){for(;e.children.length>0;){const n=e.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):ct(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 P=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":P.dispatchEvent({type:j.SELECT_DROPDOWN,value:t.data});break;case"draggableListUpdate":P.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 An extends lt{scene=void 0;scenes=new Map;renderer=void 0;renderTargets=new Map;dispose(){this.scenes.forEach(n=>{ct(n)}),this.scenes.clear(),this.scene&&ct(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||(this.scenes.delete(n.name),!this.app.debugEnabled))return;const a=Et(n);this.app.send({event:"removeScene",target:"editor",data:a})}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":P.dispatchEvent({type:j.GET_OBJECT,value:t.data});break;case"updateObject":P.dispatchEvent({type:j.UPDATE_OBJECT,value:t.data});break;case"createTexture":P.dispatchEvent({type:j.CREATE_TEXTURE,value:t.data});break;case"requestMethod":P.dispatchEvent({type:j.REQUEST_METHOD,value:t.data});break}}handleEditor(n,a,t){switch(t.event){case"setObject":P.dispatchEvent({type:j.SET_OBJECT,value:t.data});break;case"addScene":P.dispatchEvent({type:j.ADD_SCENE,value:t.data});break;case"removeScene":P.dispatchEvent({type:j.REMOVE_SCENE,value:t.data});break;case"setScene":P.dispatchEvent({type:j.SET_SCENE,value:t.data});break;case"addCamera":P.dispatchEvent({type:j.ADD_CAMERA,value:t.data});break;case"removeCamera":P.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 Pn 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:{}},at={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -15,19 +15,19 @@
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
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(`
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(Pe){O=Pe}Reflect.construct(s,[],U)}else{try{U.call()}catch(Pe){O=Pe}s.call(U.prototype)}}else{try{throw Error()}catch(Pe){O=Pe}s()}}catch(Pe){if(Pe&&O&&typeof Pe.stack=="string"){for(var N=Pe.stack.split(`
19
19
  `),ue=O.stack.split(`
20
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 et(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,tt={key:!0,ref:!0,__self:!0,__source:!0},nt,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(){nt||(nt=!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&&(et(S),N=""+S),_t(v)&&(et(v.key),N=""+v.key),Tt(v)&&(ue=v.ref,kt(v,G));for(Y in v)C.call(v,Y)&&!tt.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`
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 Ae(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 et(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,tt={key:!0,ref:!0,__self:!0,__source:!0},nt,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(){nt||(nt=!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&&(et(S),N=""+S),_t(v)&&(et(v.key),N=""+v.key),Tt(v)&&(ue=v.ref,kt(v,G));for(Y in v)C.call(v,Y)&&!tt.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,A=k.ReactDebugCurrentFrame;function B(s){if(s){var v=s._owner,S=M(s.type,s._source,v?v.type:null);A.setExtraStackFrame(S)}else A.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
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
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 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;it.Fragment=t,it.jsx=pn,it.jsxs=gn}()),it}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
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(Ae(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":Ae(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(Ae(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;it.Fragment=t,it.jsx=pn,it.jsxs=gn}()),it}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 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:ot(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:ot(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 rt(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":rt(i,$n);break;case"blendDst":rt(i,Xn);break;case"blendEquation":rt(i,qn);break;case"blendSrc":rt(i,Kn);break;case"side":rt(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 st(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=st(`${g}.value`,p.value,a,t,r,o);w!==void 0&&u.push(w)}else{const w=st(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=st(`${p}.value`,g.value,a,t,r,m);w!==void 0&&u.push(w)}else{const w=st(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=st(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:ot(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:ot(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",tt),this._domElementKeyEvents=c},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",tt),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",et,{capture:!0}),t._domElementKeyEvents!==null&&(t._domElementKeyEvents.removeEventListener("keydown",tt),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"?nt(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];nt({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 et(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 tt(c){t.enabled===!1||t.enablePan===!1||ce(c)}function nt(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",et,{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;
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":P.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":P.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:ot(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:ot(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 rt(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":rt(i,$n);break;case"blendDst":rt(i,Xn);break;case"blendEquation":rt(i,qn);break;case"blendSrc":rt(i,Kn);break;case"side":rt(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 st(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=st(`${g}.value`,p.value,a,t,r,o);w!==void 0&&u.push(w)}else{const w=st(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=st(`${p}.value`,g.value,a,t,r,m);w!==void 0&&u.push(w)}else{const w=st(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=st(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:ot(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:ot(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 P.addEventListener(j.SET_SCENE,r),P.addEventListener(j.SET_OBJECT,d),()=>{P.removeEventListener(j.SET_SCENE,r),P.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(()=>(P.addEventListener(j.ADD_SCENE,i),P.addEventListener(j.REMOVE_SCENE,o),()=>{P.removeEventListener(j.ADD_SCENE,i),P.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,u=n(h),m=u?.getObjectByProperty("uuid",h);m!==void 0?e.three.setObject(m):console.log(`Hermes - can't find object: ${h}`,u)},t=(r,h,u)=>{const m=n(r),p=m?.getObjectByProperty("uuid",r);p!==void 0?Q(p,h,u):console.log(`Hermes - can't set object: ${r}`,m)},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 P.addEventListener(j.GET_OBJECT,a),P.addEventListener(j.UPDATE_OBJECT,i),P.addEventListener(j.CREATE_TEXTURE,o),P.addEventListener(j.REQUEST_METHOD,d),()=>{P.removeEventListener(j.GET_OBJECT,a),P.removeEventListener(j.UPDATE_OBJECT,i),P.removeEventListener(j.CREATE_TEXTURE,o),P.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"},At={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",tt),this._domElementKeyEvents=c},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",tt),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)),A=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(A),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",et,{capture:!0}),t._domElementKeyEvents!==null&&(t._domElementKeyEvents.removeEventListener("keydown",tt),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(A,B){c.setFromMatrixColumn(B,0),c.multiplyScalar(-A),m.add(c)}}(),T=function(){const c=new f.Vector3;return function(A,B){t.screenSpacePanning===!0?c.setFromMatrixColumn(B,1):(c.setFromMatrixColumn(B,0),c.crossVectors(t.object.up,c)),c.multiplyScalar(A),m.add(c)}}(),Se=function(){const c=new f.Vector3;return function(A,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*A*le/ae.clientHeight,t.object.matrix),T(2*B*le/ae.clientHeight,t.object.matrix)}else t.object.isOrthographicCamera?(ge(A*(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 A=t.domElement.getBoundingClientRect(),B=c-A.left,ae=x-A.top,ve=A.width,le=A.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),A=.5*(c.pageX+x.x),B=.5*(c.pageY+x.y);p.set(A,B)}}function y(c){if(q.length===1)I.set(c.pageX,c.pageY);else{const x=Le(c),A=.5*(c.pageX+x.x),B=.5*(c.pageY+x.y);I.set(A,B)}}function R(c){const x=Le(c),A=c.pageX-x.x,B=c.pageY-x.y,ae=Math.sqrt(A*A+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 A=Le(c),B=.5*(c.pageX+A.x),ae=.5*(c.pageY+A.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),A=.5*(c.pageX+x.x),B=.5*(c.pageY+x.y);V.set(A,B)}$.subVectors(V,I).multiplyScalar(t.panSpeed),Se($.x,$.y),I.copy(V)}function C(c){const x=Le(c),A=c.pageX-x.x,B=c.pageY-x.y,ae=Math.sqrt(A*A+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"?nt(c):Ae(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],A=fe[x];nt({pointerId:x,pageX:A.x,pageY:A.y});break}}function Ae(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(At)}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(At),Ge(dt(c)),t.dispatchEvent(Jt))}function dt(c){const x=c.deltaMode,A={clientX:c.clientX,clientY:c.clientY,deltaY:c.deltaY};switch(x){case 1:A.deltaY*=16;break;case 2:A.deltaY*=100;break}return c.ctrlKey&&!se&&(A.deltaY*=10),A}function et(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 tt(c){t.enabled===!1||t.enablePan===!1||ce(c)}function nt(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(At)}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",et,{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() {
@@ -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 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(),ct(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=ot;exports.clamp=Ve;exports.colorToHex=an;exports.debugDispatcher=A;exports.defaultTheatreCallback=Sn;exports.dispose=ct;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,Pt=!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(),ct(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),Pt=!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 P.addEventListener(j.SET_SCENE,R),P.addEventListener(j.ADD_CAMERA,F),P.addEventListener(j.REMOVE_CAMERA,me),P.addEventListener(j.SET_OBJECT,oe),()=>{P.removeEventListener(j.SET_SCENE,R),P.removeEventListener(j.ADD_CAMERA,F),P.removeEventListener(j.REMOVE_CAMERA,me),P.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&&Pt&&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&&Pt&&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)},Ae=()=>{te<H?y.y=Qe(te,0,H,1,-1):y.y=Qe(te,H,C.y,1,-1)};switch(z){case"Quad":K(),Ae();break;case"Side by Side":K();break;case"Stacked":Ae(),Ae();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=An;exports.RemoteTweakpane=Pn;exports.SceneInspector=da;exports.SidePanel=ua;exports.ToolEvents=j;exports.capitalize=ot;exports.clamp=Ve;exports.colorToHex=an;exports.debugDispatcher=P;exports.defaultTheatreCallback=Sn;exports.dispose=ct;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;
package/dist/hermes.es.js CHANGED
@@ -1,7 +1,7 @@
1
- import { EventDispatcher as pn, Texture as gn, CubeTexture as Yn, RepeatWrapping as qt, WebGLRenderTarget as Hn, Color as $t, FrontSide as Vn, BackSide as vn, DoubleSide as bn, NoBlending as qn, NormalBlending as Kn, AdditiveBlending as Xn, SubtractiveBlending as Zn, MultiplyBlending as Jn, CustomBlending as Qn, AddEquation as ea, SubtractEquation as ta, ReverseSubtractEquation as na, MinEquation as aa, MaxEquation as ia, ZeroFactor as yn, OneFactor as En, SrcColorFactor as xn, OneMinusSrcColorFactor as Sn, SrcAlphaFactor as Cn, OneMinusSrcAlphaFactor as wn, DstAlphaFactor as Mn, OneMinusDstAlphaFactor as On, DstColorFactor as Tn, OneMinusDstColorFactor as Rn, SrcAlphaSaturateFactor as ra, ConstantColorFactor as _n, OneMinusConstantColorFactor as kn, ConstantAlphaFactor as Dn, OneMinusConstantAlphaFactor as Pn, Matrix4 as sa, Vector3 as J, Euler as oa, Line as ca, BufferGeometry as Kt, Float32BufferAttribute as Xt, LineBasicMaterial as la, Mesh as An, MeshBasicMaterial as jn, Ray as ua, Plane as da, MathUtils as ha, MOUSE as nt, TOUCH as at, Quaternion as Zt, Spherical as Jt, Vector2 as me, ShaderMaterial as In, GLSL3 as fa, PlaneGeometry as ma, Scene as pa, Group as ga, AxesHelper as Qt, MeshDepthMaterial as va, MeshNormalMaterial as ba, WebGLRenderer as ya, PerspectiveCamera as At, Raycaster as Ea, OrthographicCamera as en, CameraHelper as xa, SpotLightHelper as Sa, PointLightHelper as Ca, HemisphereLightHelper as wa, DirectionalLightHelper as Ma } from "three";
1
+ import { EventDispatcher as pn, Texture as gn, CubeTexture as Hn, RepeatWrapping as qt, WebGLRenderTarget as Yn, Color as $t, FrontSide as Vn, BackSide as vn, DoubleSide as bn, NoBlending as qn, NormalBlending as Kn, AdditiveBlending as Xn, SubtractiveBlending as Zn, MultiplyBlending as Jn, CustomBlending as Qn, AddEquation as ea, SubtractEquation as ta, ReverseSubtractEquation as na, MinEquation as aa, MaxEquation as ia, ZeroFactor as yn, OneFactor as En, SrcColorFactor as xn, OneMinusSrcColorFactor as Sn, SrcAlphaFactor as Cn, OneMinusSrcAlphaFactor as wn, DstAlphaFactor as Mn, OneMinusDstAlphaFactor as On, DstColorFactor as Tn, OneMinusDstColorFactor as Rn, SrcAlphaSaturateFactor as ra, ConstantColorFactor as _n, OneMinusConstantColorFactor as kn, ConstantAlphaFactor as Dn, OneMinusConstantAlphaFactor as Pn, Matrix4 as sa, Vector3 as J, Euler as oa, Line as ca, BufferGeometry as Kt, Float32BufferAttribute as Xt, LineBasicMaterial as la, Mesh as An, MeshBasicMaterial as jn, Ray as ua, Plane as da, MathUtils as ha, MOUSE as nt, TOUCH as at, Quaternion as Zt, Spherical as Jt, Vector2 as me, ShaderMaterial as In, GLSL3 as fa, PlaneGeometry as ma, Scene as pa, Group as ga, AxesHelper as Qt, MeshDepthMaterial as va, MeshNormalMaterial as ba, WebGLRenderer as ya, PerspectiveCamera as At, Raycaster as Ea, OrthographicCamera as en, CameraHelper as xa, SpotLightHelper as Sa, PointLightHelper as Ca, HemisphereLightHelper as wa, DirectionalLightHelper as Ma } from "three";
2
2
  import { Pane as Oa } from "tweakpane";
3
3
  import * as Ta from "@tweakpane/plugin-essentials";
4
- import Nn, { useState as Y, useRef as H, useEffect as Re, useMemo as se, forwardRef as Ra } from "react";
4
+ import Nn, { useState as H, useRef as Y, useEffect as Re, useMemo as se, forwardRef as Ra } from "react";
5
5
  import { Reorder as Ln } from "framer-motion";
6
6
  const zt = () => {
7
7
  }, Di = () => {
@@ -44,7 +44,7 @@ const rn = () => {
44
44
  }, Bt = (e) => {
45
45
  if (!e)
46
46
  return;
47
- let n = e.name.replace(" ", "");
47
+ let n = e.name.replaceAll(" ", "").replaceAll("/", ".");
48
48
  n.length === 0 && (n = `obj_${Lt}`, Lt++), e.parent !== null && e.parent.uuid.length > 0 && (n = `${e.parent.uuid}.${n}`), e.uuid = n, e.children.forEach((a) => {
49
49
  Bt(a);
50
50
  });
@@ -476,7 +476,7 @@ function it(e) {
476
476
  repeat: [i.repeat.x, i.repeat.y]
477
477
  };
478
478
  } else
479
- i instanceof Yn && (console.log("env map"), console.log(i.source.data), console.log(i.source.toJSON()), n[a] = {
479
+ i instanceof Hn && (console.log("env map"), console.log(i.source.data), console.log(i.source.toJSON()), n[a] = {
480
480
  src: "",
481
481
  offset: [i.offset.x, i.offset.y],
482
482
  repeat: [i.repeat.x, i.repeat.y]
@@ -811,7 +811,7 @@ class Li extends Rt {
811
811
  rendererWidth = 300;
812
812
  rendererHeight = 150;
813
813
  addRT(n, a) {
814
- const t = new Hn(32, 32, a);
814
+ const t = new Yn(32, 32, a);
815
815
  t.texture.name = n, this.renderTargets.set(n, t);
816
816
  }
817
817
  resize(n, a) {
@@ -1146,18 +1146,18 @@ function Fa() {
1146
1146
  O < 0 && I("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
1147
1147
  }
1148
1148
  }
1149
- var Ye = R.ReactCurrentDispatcher, He;
1149
+ var He = R.ReactCurrentDispatcher, Ye;
1150
1150
  function ue(s, g, y) {
1151
1151
  {
1152
- if (He === void 0)
1152
+ if (Ye === void 0)
1153
1153
  try {
1154
1154
  throw Error();
1155
1155
  } catch ($) {
1156
1156
  var w = $.stack.trim().match(/\n( *(at )?)/);
1157
- He = w && w[1] || "";
1157
+ Ye = w && w[1] || "";
1158
1158
  }
1159
1159
  return `
1160
- ` + He + s;
1160
+ ` + Ye + s;
1161
1161
  }
1162
1162
  }
1163
1163
  var v = !1, b;
@@ -1178,7 +1178,7 @@ function Fa() {
1178
1178
  var $ = Error.prepareStackTrace;
1179
1179
  Error.prepareStackTrace = void 0;
1180
1180
  var W;
1181
- W = Ye.current, Ye.current = null, re();
1181
+ W = He.current, He.current = null, re();
1182
1182
  try {
1183
1183
  if (g) {
1184
1184
  var L = function() {
@@ -1231,7 +1231,7 @@ function Fa() {
1231
1231
  }
1232
1232
  }
1233
1233
  } finally {
1234
- v = !1, Ye.current = W, Me(), Error.prepareStackTrace = $;
1234
+ v = !1, He.current = W, Me(), Error.prepareStackTrace = $;
1235
1235
  }
1236
1236
  var tt = s ? s.displayName || s.name : "", Vt = tt ? ue(tt) : "";
1237
1237
  return typeof s == "function" && b.set(s, Vt), Vt;
@@ -1374,7 +1374,7 @@ function Fa() {
1374
1374
  });
1375
1375
  }
1376
1376
  }
1377
- var Yt = function(s, g, y, w, $, W, L) {
1377
+ var Ht = function(s, g, y, w, $, W, L) {
1378
1378
  var j = {
1379
1379
  // This tag allows us to uniquely identify this as a React Element
1380
1380
  $$typeof: n,
@@ -1418,7 +1418,7 @@ function Fa() {
1418
1418
  var ae = typeof s == "function" ? s.displayName || s.name || "Unknown" : s;
1419
1419
  j && gt(L, ae), he && $e(L, ae);
1420
1420
  }
1421
- return Yt(s, j, he, $, w, Ue.current, L);
1421
+ return Ht(s, j, he, $, w, Ue.current, L);
1422
1422
  }
1423
1423
  }
1424
1424
  var E = R.ReactCurrentOwner, k = R.ReactDebugCurrentFrame;
@@ -1446,7 +1446,7 @@ Check the render method of \`` + s + "`.";
1446
1446
  return "";
1447
1447
  }
1448
1448
  }
1449
- function Ht(s) {
1449
+ function Yt(s) {
1450
1450
  {
1451
1451
  if (s !== void 0) {
1452
1452
  var g = s.fileName.replace(/^.*[\\\/]/, ""), y = s.lineNumber;
@@ -1545,7 +1545,7 @@ Check the top-level render call using <` + y + ">.");
1545
1545
  if (!L) {
1546
1546
  var j = "";
1547
1547
  (s === void 0 || typeof s == "object" && s !== null && Object.keys(s).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
1548
- var he = Ht($);
1548
+ var he = Yt($);
1549
1549
  he ? j += he : j += de();
1550
1550
  var Q;
1551
1551
  s === null ? Q = "null" : Ne(s) ? Q = "array" : s !== void 0 && s.$$typeof === n ? (Q = "<" + (U(s.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : Q = typeof s, I("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Q, j);
@@ -1606,7 +1606,7 @@ function za(e) {
1606
1606
  ] }) }, e.title);
1607
1607
  }
1608
1608
  function Ga(e) {
1609
- const [n, a] = Y(!1), [t, i] = Y(e.options), o = (u) => {
1609
+ const [n, a] = H(!1), [t, i] = H(e.options), o = (u) => {
1610
1610
  e.onDragComplete(u), i(u);
1611
1611
  }, d = (u) => {
1612
1612
  const f = [...t];
@@ -1622,9 +1622,9 @@ function Ga(e) {
1622
1622
  ] });
1623
1623
  }
1624
1624
  function Wa(e) {
1625
- const [n, a] = Y(!1), t = [];
1625
+ const [n, a] = H(!1), t = [];
1626
1626
  e.options.map((o, d) => {
1627
- e.onSelect !== void 0 && (o.onSelect = e.onSelect), t.push(/* @__PURE__ */ l.jsx(Ya, { option: o }, d));
1627
+ e.onSelect !== void 0 && (o.onSelect = e.onSelect), t.push(/* @__PURE__ */ l.jsx(Ha, { option: o }, d));
1628
1628
  });
1629
1629
  let i = "dropdown";
1630
1630
  return e.subdropdown && (i += " subdropdown"), /* @__PURE__ */ l.jsxs(
@@ -1646,8 +1646,8 @@ function Wa(e) {
1646
1646
  }
1647
1647
  );
1648
1648
  }
1649
- function Ya(e) {
1650
- const { option: n } = e, [a, t] = Y("");
1649
+ function Ha(e) {
1650
+ const { option: n } = e, [a, t] = H("");
1651
1651
  let i;
1652
1652
  switch (n.type) {
1653
1653
  case "draggable":
@@ -1712,7 +1712,7 @@ function Fi(e, n, a) {
1712
1712
  };
1713
1713
  }
1714
1714
  function Wt(e) {
1715
- const [n, a] = Y(e.open !== void 0 ? e.open : !0), t = !n || e.children === void 0;
1715
+ const [n, a] = H(e.open !== void 0 ? e.open : !0), t = !n || e.children === void 0;
1716
1716
  return /* @__PURE__ */ l.jsxs("div", { className: `accordion ${t ? "hide" : ""}`, children: [
1717
1717
  /* @__PURE__ */ l.jsxs(
1718
1718
  "button",
@@ -1739,7 +1739,7 @@ function Wt(e) {
1739
1739
  ] });
1740
1740
  }
1741
1741
  function Un(e) {
1742
- const n = H(null), [a, t] = Y(!1), i = e.child !== void 0 && e.child.children.length > 0, o = [];
1742
+ const n = Y(null), [a, t] = H(!1), i = e.child !== void 0 && e.child.children.length > 0, o = [];
1743
1743
  return e.child !== void 0 && e.child.children.length > 0 && e.child.children.map((d, r) => {
1744
1744
  o.push(/* @__PURE__ */ l.jsx(Un, { child: d, three: e.three }, r));
1745
1745
  }), Re(() => {
@@ -1799,14 +1799,14 @@ function Un(e) {
1799
1799
  /* @__PURE__ */ l.jsx("div", { className: a ? "open" : "", children: /* @__PURE__ */ l.jsx("div", { className: "container", children: o }) })
1800
1800
  ] }, Math.random()) });
1801
1801
  }
1802
- function Ha(e) {
1802
+ function Ya(e) {
1803
1803
  const n = [];
1804
1804
  return e.child?.children.map((a, t) => {
1805
1805
  n.push(/* @__PURE__ */ l.jsx(Un, { child: a, scene: e.scene, three: e.three }, t));
1806
1806
  }), /* @__PURE__ */ l.jsx("div", { className: `scene ${e.class !== void 0 ? e.class : ""}`, children: n });
1807
1807
  }
1808
1808
  function Va(e) {
1809
- const [n, a] = Y(e.defaultValue);
1809
+ const [n, a] = H(e.defaultValue);
1810
1810
  return Re(() => {
1811
1811
  let t = !1, i = -1, o = 0, d = e.defaultValue;
1812
1812
  const r = (p) => {
@@ -1831,7 +1831,7 @@ function Va(e) {
1831
1831
  }, []), n;
1832
1832
  }
1833
1833
  function Xe(e) {
1834
- const n = H(null), a = H(null), t = Va({
1834
+ const n = Y(null), a = Y(null), t = Va({
1835
1835
  label: e.labelRef,
1836
1836
  input: n,
1837
1837
  sliderRef: a,
@@ -1894,10 +1894,10 @@ function Xe(e) {
1894
1894
  ] });
1895
1895
  }
1896
1896
  function qa(e) {
1897
- const n = H(null), a = H(null), t = H(null), i = H(null), o = H(null), d = H(null), [r, h] = Y(e.value), [u, f] = Y({
1897
+ const n = Y(null), a = Y(null), t = Y(null), i = Y(null), o = Y(null), d = Y(null), [r, h] = H(e.value), [u, f] = H({
1898
1898
  min: Math.min(e.min, Math.min(e.value.x, e.value.y)),
1899
1899
  max: Math.max(e.max, Math.max(e.value.x, e.value.y))
1900
- }), [m, p] = Y(!1);
1900
+ }), [m, p] = H(!1);
1901
1901
  function S() {
1902
1902
  m || (window.addEventListener("mousemove", F), window.addEventListener("mouseup", A), window.addEventListener("mouseup", A), p(!0));
1903
1903
  }
@@ -1996,7 +1996,7 @@ function cn(e) {
1996
1996
  o[h] = u, e.onChange({ target: { value: o } });
1997
1997
  };
1998
1998
  ["x", "y", "z"].forEach((h) => {
1999
- const u = H(null);
1999
+ const u = Y(null);
2000
2000
  i.push(
2001
2001
  /* @__PURE__ */ l.jsxs("div", { children: [
2002
2002
  /* @__PURE__ */ l.jsx("label", { ref: u, children: h.toUpperCase() }),
@@ -2019,7 +2019,7 @@ function cn(e) {
2019
2019
  o[h] = u, e.onChange({ target: { value: o } });
2020
2020
  };
2021
2021
  ["_x", "_y", "_z"].forEach((h) => {
2022
- const u = H(null);
2022
+ const u = Y(null);
2023
2023
  i.push(
2024
2024
  /* @__PURE__ */ l.jsxs("div", { children: [
2025
2025
  /* @__PURE__ */ l.jsx("label", { ref: u, children: h.substring(1).toUpperCase() }),
@@ -2043,7 +2043,7 @@ function cn(e) {
2043
2043
  o.elements[u] = h, e.onChange({ target: { value: o } });
2044
2044
  };
2045
2045
  for (let r = 0; r < 9; r++) {
2046
- const h = H(null);
2046
+ const h = Y(null);
2047
2047
  i.push(
2048
2048
  /* @__PURE__ */ l.jsxs("div", { children: [
2049
2049
  /* @__PURE__ */ l.jsx("label", { ref: h, children: r + 1 }),
@@ -2071,7 +2071,7 @@ function Ka(e) {
2071
2071
  t[d] = r, e.onChange({ target: { value: t } });
2072
2072
  };
2073
2073
  ["x", "y", "z", "w"].forEach((d) => {
2074
- const r = H(null);
2074
+ const r = Y(null);
2075
2075
  a.push(
2076
2076
  /* @__PURE__ */ l.jsxs("div", { children: [
2077
2077
  /* @__PURE__ */ l.jsx("label", { ref: r, children: d.toUpperCase() }),
@@ -2095,7 +2095,7 @@ function Ka(e) {
2095
2095
  t.elements[r] = d, e.onChange({ target: { value: t } });
2096
2096
  };
2097
2097
  for (let o = 0; o < 16; o++) {
2098
- const d = H(null);
2098
+ const d = Y(null);
2099
2099
  a.push(
2100
2100
  /* @__PURE__ */ l.jsxs("div", { children: [
2101
2101
  /* @__PURE__ */ l.jsx("label", { ref: d, children: o + 1 }),
@@ -2948,7 +2948,7 @@ function di(e, n) {
2948
2948
  }
2949
2949
  const hi = "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==";
2950
2950
  function fi(e) {
2951
- const n = H(null), a = H(null), t = H(null), i = H(null), o = H(null), [d] = Y(e.value), [r, h] = Y(e.value.offset[0]), [u, f] = Y(e.value.offset[1]), [m, p] = Y(e.value.repeat[0]), [S, A] = Y(e.value.repeat[1]);
2951
+ const n = Y(null), a = Y(null), t = Y(null), i = Y(null), o = Y(null), [d] = H(e.value), [r, h] = H(e.value.offset[0]), [u, f] = H(e.value.offset[1]), [m, p] = H(e.value.repeat[0]), [S, A] = H(e.value.repeat[1]);
2952
2952
  function F(R, I, T, Z, te) {
2953
2953
  if (e.onChange !== void 0) {
2954
2954
  const pe = e.prop !== void 0 ? e.prop : e.title;
@@ -3035,7 +3035,7 @@ function fi(e) {
3035
3035
  function wt(e) {
3036
3036
  let n = e.value;
3037
3037
  n !== void 0 && n.isColor !== void 0 && (n = Da(e.value));
3038
- const [a, t] = Y(n), i = H(null), o = (u) => {
3038
+ const [a, t] = H(n), i = Y(null), o = (u) => {
3039
3039
  let f = u.target.value;
3040
3040
  e.type === "boolean" ? f = u.target.checked : e.type === "option" && (f = e.options[f].value), t(f), e.onChange !== void 0 && e.onChange(e.prop !== void 0 ? e.prop : e.title, f);
3041
3041
  }, d = {};
@@ -3392,7 +3392,7 @@ const zn = {
3392
3392
  };
3393
3393
  let fe = { ...zn };
3394
3394
  function bi(e) {
3395
- const [n, a] = Y(-1);
3395
+ const [n, a] = H(-1);
3396
3396
  Re(() => {
3397
3397
  function d(h) {
3398
3398
  fe = { ...h.value }, a(Date.now());
@@ -3448,7 +3448,7 @@ function bi(e) {
3448
3448
  ] }) }, n) }, "Inspector");
3449
3449
  }
3450
3450
  function Ui(e) {
3451
- const [n] = Y([]), [a, t] = Y(0), i = (r) => {
3451
+ const [n] = H([]), [a, t] = H(0), i = (r) => {
3452
3452
  n.push(r.value), t(Date.now());
3453
3453
  }, o = (r) => {
3454
3454
  const h = r.value;
@@ -3464,7 +3464,7 @@ function Ui(e) {
3464
3464
  const d = [];
3465
3465
  return n.forEach((r, h) => {
3466
3466
  d.push(
3467
- /* @__PURE__ */ l.jsx(Wt, { label: `Scene: ${r.name}`, open: !0, children: /* @__PURE__ */ l.jsx(Ha, { child: r, scene: r, three: e.three }) }, `scene_${h}`)
3467
+ /* @__PURE__ */ l.jsx(Wt, { label: `Scene: ${r.name}`, open: !0, children: /* @__PURE__ */ l.jsx(Ya, { child: r, scene: r, three: e.three }) }, `scene_${h}`)
3468
3468
  );
3469
3469
  }), /* @__PURE__ */ l.jsxs("div", { id: "SidePanel", children: [
3470
3470
  d,
@@ -3480,11 +3480,11 @@ function $i(e) {
3480
3480
  }), h;
3481
3481
  }
3482
3482
  const a = (r) => {
3483
- const h = r.value, f = n(h)?.getObjectByProperty("uuid", h);
3484
- f !== void 0 && e.three.setObject(f);
3483
+ const h = r.value, u = n(h), f = u?.getObjectByProperty("uuid", h);
3484
+ f !== void 0 ? e.three.setObject(f) : console.log(`Hermes - can't find object: ${h}`, u);
3485
3485
  }, t = (r, h, u) => {
3486
- const m = n(r)?.getObjectByProperty("uuid", r);
3487
- m !== void 0 && ee(m, h, u);
3486
+ const f = n(r), m = f?.getObjectByProperty("uuid", r);
3487
+ m !== void 0 ? ee(m, h, u) : console.log(`Hermes - can't set object: ${r}`, f);
3488
3488
  }, i = (r) => {
3489
3489
  const h = r.value, { key: u, value: f, uuid: m } = h;
3490
3490
  t(m, u, f);
@@ -3692,10 +3692,10 @@ class xi extends pn {
3692
3692
  function Me(c) {
3693
3693
  I.set(c.clientX, c.clientY), T.subVectors(I, R), T.y > 0 ? De(ke(T.y)) : T.y < 0 && je(ke(T.y)), R.copy(I), t.update();
3694
3694
  }
3695
- function Ye(c) {
3695
+ function He(c) {
3696
3696
  F.set(c.clientX, c.clientY), V.subVectors(F, A).multiplyScalar(t.panSpeed), we(V.x, V.y), A.copy(F), t.update();
3697
3697
  }
3698
- function He(c) {
3698
+ function Ye(c) {
3699
3699
  Pe(c.clientX, c.clientY), c.deltaY < 0 ? je(ke(c.deltaY)) : c.deltaY > 0 && De(ke(c.deltaY)), t.update();
3700
3700
  }
3701
3701
  function ue(c) {
@@ -3854,12 +3854,12 @@ class xi extends pn {
3854
3854
  case i.PAN:
3855
3855
  if (t.enablePan === !1)
3856
3856
  return;
3857
- Ye(c);
3857
+ He(c);
3858
3858
  break;
3859
3859
  }
3860
3860
  }
3861
3861
  function ft(c) {
3862
- t.enabled === !1 || t.enableZoom === !1 || o !== i.NONE || (c.preventDefault(), t.dispatchEvent(It), He(mt(c)), t.dispatchEvent(fn));
3862
+ t.enabled === !1 || t.enableZoom === !1 || o !== i.NONE || (c.preventDefault(), t.dispatchEvent(It), Ye(mt(c)), t.dispatchEvent(fn));
3863
3863
  }
3864
3864
  function mt(c) {
3865
3865
  const E = c.deltaMode, k = {
@@ -3986,7 +3986,7 @@ function rt(e, n, a, t, i) {
3986
3986
  return t + (e - n) * (i - t) / (a - n);
3987
3987
  }
3988
3988
  const Mt = (e) => {
3989
- const [n, a] = Y(e.options[e.index]), t = () => {
3989
+ const [n, a] = H(e.options[e.index]), t = () => {
3990
3990
  e.onToggle(!e.open);
3991
3991
  }, i = (o) => {
3992
3992
  o !== n && (e.onSelect(o), a(o)), e.onToggle(!1);
@@ -3996,7 +3996,7 @@ const Mt = (e) => {
3996
3996
  e.open && /* @__PURE__ */ l.jsx("ul", { className: "dropdown-menu", children: e.options.map((o) => /* @__PURE__ */ l.jsx("li", { onClick: () => i(o), children: o }, o)) })
3997
3997
  ] });
3998
3998
  }, qe = Ra(function(n, a) {
3999
- const [t, i] = Y(!1), o = n.options.indexOf(n.camera.name);
3999
+ const [t, i] = H(!1), o = n.options.indexOf(n.camera.name);
4000
4000
  return /* @__PURE__ */ l.jsxs("div", { className: "CameraWindow", children: [
4001
4001
  /* @__PURE__ */ l.jsx("div", { ref: a, className: "clickable", onClick: () => {
4002
4002
  t && i(!1);
@@ -4211,7 +4211,7 @@ function zi(e) {
4211
4211
  "Side by Side",
4212
4212
  "Stacked",
4213
4213
  "Quad"
4214
- ], q = H(null), ge = H(null), ce = H(null), _e = H(null), ke = H(null), be = H(null), [U, ye] = Y(a !== null ? a : "Single"), [O, we] = Y(null), [De, je] = Y(!1), [Pe, Ae] = Y(!1), [Ie, Be] = Y(!1), [, Fe] = Y(Date.now());
4214
+ ], q = Y(null), ge = Y(null), ce = Y(null), _e = Y(null), ke = Y(null), be = Y(null), [U, ye] = H(a !== null ? a : "Single"), [O, we] = H(null), [De, je] = H(!1), [Pe, Ae] = H(!1), [Ie, Be] = H(!1), [, Fe] = H(Date.now());
4215
4215
  localStorage.setItem(`${n}_mode`, U), localStorage.setItem(`${n}_tlCam`, t), localStorage.setItem(`${n}_trCam`, i), localStorage.setItem(`${n}_blCam`, o), localStorage.setItem(`${n}_brCam`, d);
4216
4216
  const re = (v, b) => {
4217
4217
  const M = h.get(v.name);
@@ -4234,13 +4234,13 @@ function zi(e) {
4234
4234
  b !== void 0 && (m.remove(b), b.dispose(), u.delete(v.name));
4235
4235
  const M = h.get(v.name);
4236
4236
  M !== void 0 && (M.dispose(), h.delete(v.name));
4237
- }, Ye = () => {
4237
+ }, He = () => {
4238
4238
  h.forEach((v, b) => {
4239
4239
  v.dispose();
4240
4240
  const M = u.get(b);
4241
4241
  M !== void 0 && (m.remove(M), M.dispose()), u.delete(b), h.delete(b);
4242
4242
  }), h.clear(), u.clear();
4243
- }, He = () => {
4243
+ }, Ye = () => {
4244
4244
  switch (U) {
4245
4245
  case "Single":
4246
4246
  re(X, ce.current);
@@ -4370,7 +4370,7 @@ function zi(e) {
4370
4370
  }
4371
4371
  ve = requestAnimationFrame(ne);
4372
4372
  };
4373
- return He(), window.addEventListener("resize", le), le(), ne(), () => {
4373
+ return Ye(), window.addEventListener("resize", le), le(), ne(), () => {
4374
4374
  window.removeEventListener("resize", le), cancelAnimationFrame(ve), ve = -1;
4375
4375
  };
4376
4376
  }, [U, O]), Re(() => {
@@ -4485,7 +4485,7 @@ function zi(e) {
4485
4485
  index: pe.indexOf(U),
4486
4486
  options: pe,
4487
4487
  onSelect: (v) => {
4488
- v !== U && (Ye(), ye(v));
4488
+ v !== U && (He(), ye(v));
4489
4489
  },
4490
4490
  open: De,
4491
4491
  onToggle: (v) => {
@@ -4558,11 +4558,11 @@ export {
4558
4558
  ji as Application,
4559
4559
  Rt as BaseRemote,
4560
4560
  Un as ChildObject,
4561
- Ha as ContainerObject,
4561
+ Ya as ContainerObject,
4562
4562
  Ga as Draggable,
4563
4563
  za as DraggableItem,
4564
4564
  Wa as Dropdown,
4565
- Ya as DropdownItem,
4565
+ Ha as DropdownItem,
4566
4566
  Gi as Editor,
4567
4567
  bi as Inspector,
4568
4568
  zi as MultiView,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.esm.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.0.69",
10
+ "version": "0.0.70",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"