@tomorrowevening/hermes 0.0.57 → 0.0.58

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 d=require("three"),vn=require("tweakpane"),bn=require("@tweakpane/plugin-essentials"),E=require("react"),Jt=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 xn=yn(bn),Ct=()=>{},En=()=>{};function lt(e){return e.substring(0,1).toUpperCase()+e.substring(1)}function Ve(e,n,a){return Math.min(n,Math.max(e,a))}function kt(e,n,a){return(a-e)/(n-e)}function jt(e,n,a){return e*(1-a)+n*a}function Cn(e,n){const a=e-n;return Math.sqrt(a*a)}function Qt(){return Math.round(Math.random()*1e6).toString()}function en(e){return e.r!==void 0&&e.g!==void 0&&e.b!==void 0}function tn(e){const n=Math.round(e.r*255),a=Math.round(e.g*255),t=Math.round(e.b*255),i=f=>{const h=f.toString(16);return h.length===1?"0"+h:h},o=i(n),u=i(a),c=i(t);return"#"+o+u+c}function Qe(e,n=1){return Number(e.toFixed(n))}exports.totalThreeObjects=0;const nn=()=>{exports.totalThreeObjects=0},It=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=>{It(a)})},Sn=e=>{e?.dispose()},an=e=>{e&&(Array.isArray(e)?e.forEach(n=>n.dispose()):e.dispose())},Nt=e=>{if(e){for(;e.children.length>0;){const n=e.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):Nt(n)}if(e.parent&&e.parent.remove(e),e.isMesh){const n=e;n.geometry?.dispose(),an(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 I=new d.EventDispatcher,N={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",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 ut{app;constructor(n){this.app=n}dispose(){}handleApp(n,a,t){}handleEditor(n,a,t){}}class Mn extends ut{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":I.dispatchEvent({type:N.SELECT_DROPDOWN,value:t.data});break;case"draggableListUpdate":I.dispatchEvent({type:N.DRAG_UPDATE,value:t.data});break}}}class St extends ut{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}sheet(n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let a=this.sheets.get(n);return a!==void 0||(a=this.project?.sheet(n),this.sheets.set(n,a)),a}playSheet(n,a){this.sheet(n)?.sequence.play(a),this.app.send({event:"playSheet",target:"editor",data:{sheet:n,value:a}})}pauseSheet(n){this.sheet(n)?.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:n}})}clearSheetObjects(n){this.sheetObjects.forEach((a,t)=>{t.search(`${n}_`)>-1&&this.unsubscribe(a)})}sheetObject(n,a,t,i){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const o=this.sheet(n);if(o===void 0)return;const u=`${n}_${a}`;let c=this.sheetObjects.get(u);c!==void 0?c=o.object(a,{...t,...c.value},{reconfigure:!0}):c=o.object(a,t),this.sheetObjects.set(u,c),this.sheetObjectCBs.set(u,i!==void 0?i:Ct);const f=c.onValuesChange(h=>{if(this.app.editor){for(const v in h){const C=h[v];typeof C=="object"&&en(C)&&(h[v]={r:C.r,g:C.g,b:C.b,a:C.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:u,values:h}})}const m=this.sheetObjectCBs.get(u);m!==void 0&&m(h)});return this.sheetObjectUnsubscribe.set(u,f),c}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}`,u=this.sheetObjectUnsubscribe.get(o);u!==void 0&&(this.sheetObjects.delete(o),this.sheetObjectCBs.delete(o),this.sheetObjectUnsubscribe.delete(o),u())}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)?.sequence.play(t.data.value);break;case"pauseSheet":i.sheet(t.data.sheet)?.sequence.pause();break}}}handleEditorApp(n,a){if(n.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(u=>{u.length<1||u.forEach(c=>{let f=c.address.sheetId,h="setSheet",m={};switch(c.type){case"Theatre_Sheet_PublicAPI":h="setSheet",m={sheet:c.address.sheetId},a.activeSheet=a.sheets.get(c.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",f+=`_${c.address.objectKey}`,m={id:f,sheet:c.address.sheetId,key:c.address.objectKey},a.activeSheet=a.sheets.get(c.address.sheetId);break}n.send({event:h,target:"app",data:m})})});let t=-1;const i=()=>{if(St.rafDriver?.tick(performance.now()),a.activeSheet!==void 0&&t!==a.activeSheet.sequence.position){t=a.activeSheet.sequence.position;const u=a.activeSheet;n.send({event:"updateTimeline",target:"app",data:{position:t,sheet:u.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(u=>{u.length<1||u.forEach(c=>{let f=c.address.sheetId,h="setSheet",m={};switch(c.type){case"Theatre_Sheet_PublicAPI":h="setSheet",m={sheet:c.address.sheetId},n.activeSheet=n.sheets.get(c.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",f+=`_${c.address.objectKey}`,m={id:f,sheet:c.address.sheetId,key:c.address.objectKey},n.activeSheet=n.sheets.get(c.address.sheetId);break}e.send({event:h,target:"app",data:m})})});let t=-1;const i=()=>{if(St.rafDriver?.tick(performance.now()),n.activeSheet!==void 0&&t!==n.activeSheet.sequence.position){t=n.activeSheet.sequence.position;const u=n.activeSheet;e.send({event:"updateTimeline",target:"app",data:{position:t,sheet:u.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 rn(e){const n={name:e.name,type:e.type,uuid:e.uuid,children:[]};return e.children.forEach(a=>{n.children.push(rn(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:""}:t.isTexture&&(n[a].value={src:t.image.src})}return n}function _n(e){switch(e){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Ze(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 d.Texture){const o=i.source.toJSON();n[a]={src:o.url}}else i instanceof d.CubeTexture&&(console.log("env map"),console.log(i.source.data),console.log(i.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Tn(n[a]));else n[a]={src:""};break}}return n}function _t(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};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(Ze(o))}),n.material=i}else n.material=Ze(t.material)}else if(a.search("points")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(o=>{i.push(Ze(o))}),n.material=i}else n.material=Ze(t.material)}else if(a.search("line")>-1){const t=e;if(Array.isArray(t.material)){const i=[];t.material.forEach(o=>{i.push(Ze(o))}),n.material=i}else n.material=Ze(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 An(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 J(e,n,a){const t=n.split(".");switch(t.length){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}}function sn(e){return new Promise((n,a)=>{const t=new Image;t.onload=()=>{const i=new d.Texture(t);i.wrapS=d.RepeatWrapping,i.wrapT=d.RepeatWrapping,i.needsUpdate=!0,n(i)},t.onerror=a,t.src=e})}class Pn extends ut{scene=void 0;renderer=void 0;getObject(n){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:n})}setObject(n){const a=_t(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}})}setScene(n){if(n===void 0||(this.scene=n,!this.app.debugEnabled))return;nn(),It(this.scene);const a=rn(this.scene);this.app.send({event:"setScene",target:"editor",data:a})}addCamera(n){if(!this.app.debugEnabled)return;const a=_t(n);this.app.send({event:"addCamera",target:"editor",data:a})}removeCamera(n){if(!this.app.debugEnabled)return;const a=_t(n);this.app.send({event:"removeCamera",target:"editor",data:a})}handleApp(n,a,t){switch(t.event){case"getObject":I.dispatchEvent({type:N.GET_OBJECT,value:t.data});break;case"updateObject":I.dispatchEvent({type:N.UPDATE_OBJECT,value:t.data});break;case"createTexture":I.dispatchEvent({type:N.CREATE_TEXTURE,value:t.data});break;case"requestMethod":I.dispatchEvent({type:N.REQUEST_METHOD,value:t.data});break}}handleEditor(n,a,t){switch(t.event){case"setObject":I.dispatchEvent({type:N.SET_OBJECT,value:t.data});break;case"setScene":I.dispatchEvent({type:N.SET_SCENE,value:t.data});break;case"addCamera":I.dispatchEvent({type:N.ADD_CAMERA,value:t.data});break;case"removeCamera":I.dispatchEvent({type:N.REMOVE_CAMERA,value:t.data});break}}resize(n,a){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.renderer!==void 0?this.renderer?.domElement.width/this.dpr:0}get height(){return this.renderer!==void 0?this.renderer?.domElement.height/this.dpr:0}get canvas(){return this.renderer!==void 0?this.renderer?.domElement:null}}class kn extends ut{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(xn)}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,u=t.onChange!==void 0?t.onChange:Ct;this.bindCBs.set(o,u),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.pane).addBinding(n,a,t).on("change",f=>{this.app.send({event:"updateBind",target:"app",data:{id:o,value:f.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 Dt={exports:{}},it={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),vn=require("tweakpane"),bn=require("@tweakpane/plugin-essentials"),x=require("react"),Jt=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 xn=yn(bn),Et=()=>{},En=()=>{};function ct(e){return e.substring(0,1).toUpperCase()+e.substring(1)}function Ve(e,n,a){return Math.min(n,Math.max(e,a))}function At(e,n,a){return(a-e)/(n-e)}function kt(e,n,a){return e*(1-a)+n*a}function Cn(e,n){const a=e-n;return Math.sqrt(a*a)}function Qt(){return Math.round(Math.random()*1e6).toString()}function en(e){return e.r!==void 0&&e.g!==void 0&&e.b!==void 0}function tn(e){const n=Math.round(e.r*255),a=Math.round(e.g*255),t=Math.round(e.b*255),i=f=>{const h=f.toString(16);return h.length===1?"0"+h:h},o=i(n),u=i(a),c=i(t);return"#"+o+u+c}function Pt(e,n=1){return Number(e.toFixed(n))}exports.totalThreeObjects=0;const nn=()=>{exports.totalThreeObjects=0},It=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=>{It(a)})},Sn=e=>{e?.dispose()},an=e=>{e&&(Array.isArray(e)?e.forEach(n=>n.dispose()):e.dispose())},Nt=e=>{if(e){for(;e.children.length>0;){const n=e.children[0];n.type==="Audio"?(n.pause(),n.parent&&n.parent.remove(n)):Nt(n)}if(e.parent&&e.parent.remove(e),e.isMesh){const n=e;n.geometry?.dispose(),an(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 N=new d.EventDispatcher,L={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",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":N.dispatchEvent({type:L.SELECT_DROPDOWN,value:t.data});break;case"draggableListUpdate":N.dispatchEvent({type:L.DRAG_UPDATE,value:t.data});break}}}class Ct 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}sheet(n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let a=this.sheets.get(n);return a!==void 0||(a=this.project?.sheet(n),this.sheets.set(n,a)),a}playSheet(n,a){this.sheet(n)?.sequence.play(a),this.app.send({event:"playSheet",target:"editor",data:{sheet:n,value:a}})}pauseSheet(n){this.sheet(n)?.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:n}})}clearSheetObjects(n){this.sheetObjects.forEach((a,t)=>{t.search(`${n}_`)>-1&&this.unsubscribe(a)})}sheetObject(n,a,t,i){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const o=this.sheet(n);if(o===void 0)return;const u=`${n}_${a}`;let c=this.sheetObjects.get(u);c!==void 0?c=o.object(a,{...t,...c.value},{reconfigure:!0}):c=o.object(a,t),this.sheetObjects.set(u,c),this.sheetObjectCBs.set(u,i!==void 0?i:Et);const f=c.onValuesChange(h=>{if(this.app.editor){for(const p in h){const C=h[p];typeof C=="object"&&en(C)&&(h[p]={r:C.r,g:C.g,b:C.b,a:C.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:n,sheetObject:u,values:h}})}const m=this.sheetObjectCBs.get(u);m!==void 0&&m(h)});return this.sheetObjectUnsubscribe.set(u,f),c}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}`,u=this.sheetObjectUnsubscribe.get(o);u!==void 0&&(this.sheetObjects.delete(o),this.sheetObjectCBs.delete(o),this.sheetObjectUnsubscribe.delete(o),u())}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)?.sequence.play(t.data.value);break;case"pauseSheet":i.sheet(t.data.sheet)?.sequence.pause();break}}}handleEditorApp(n,a){if(n.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(u=>{u.length<1||u.forEach(c=>{let f=c.address.sheetId,h="setSheet",m={};switch(c.type){case"Theatre_Sheet_PublicAPI":h="setSheet",m={sheet:c.address.sheetId},a.activeSheet=a.sheets.get(c.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",f+=`_${c.address.objectKey}`,m={id:f,sheet:c.address.sheetId,key:c.address.objectKey},a.activeSheet=a.sheets.get(c.address.sheetId);break}n.send({event:h,target:"app",data:m})})});let t=-1;const i=()=>{if(Ct.rafDriver?.tick(performance.now()),a.activeSheet!==void 0&&t!==a.activeSheet.sequence.position){t=a.activeSheet.sequence.position;const u=a.activeSheet;n.send({event:"updateTimeline",target:"app",data:{position:t,sheet:u.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(u=>{u.length<1||u.forEach(c=>{let f=c.address.sheetId,h="setSheet",m={};switch(c.type){case"Theatre_Sheet_PublicAPI":h="setSheet",m={sheet:c.address.sheetId},n.activeSheet=n.sheets.get(c.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":h="setSheetObject",f+=`_${c.address.objectKey}`,m={id:f,sheet:c.address.sheetId,key:c.address.objectKey},n.activeSheet=n.sheets.get(c.address.sheetId);break}e.send({event:h,target:"app",data:m})})});let t=-1;const i=()=>{if(Ct.rafDriver?.tick(performance.now()),n.activeSheet!==void 0&&t!==n.activeSheet.sequence.position){t=n.activeSheet.sequence.position;const u=n.activeSheet;e.send({event:"updateTimeline",target:"app",data:{position:t,sheet:u.address.sheetId}})}},o=()=>{i(),requestAnimationFrame(o)};i(),o()}else a.ui.hide()}function Tn(e){if(e.name==="cameras")return"camera";if(e.name==="interactive")return"interactive";if(e.name==="lights")return"light";if(e.name==="ui")return"ui";if(e.name==="utils")return"utils";const n=e.type;return n.search("Helper")>-1?"icon_utils":n.search("Camera")>-1?"camera":n.search("Light")>-1?"light":"obj3D"}function rn(e){const n={name:e.name,type:e.type,uuid:e.uuid,children:[]};return e.children.forEach(a=>{n.children.push(rn(a))}),n}function Rn(e){const n={};for(const a in e){const t=e[a].value;n[a]={value:t},t===null?n[a].value={src:""}:t.isTexture&&(n[a].value={src:t.image.src})}return n}function _n(e){switch(e){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Je(e){const n={};for(const a in e){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||_n(a))continue;const t=typeof e[a],i=e[a];switch(t){case"boolean":case"number":case"string":n[a]=i;break;case"object":if(i!==null)if(n[a]=i,i.isTexture)if(i instanceof d.Texture){const o=i.source.toJSON();n[a]={src:o.url}}else i instanceof d.CubeTexture&&(console.log("env map"),console.log(i.source.data),console.log(i.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Rn(n[a]));else n[a]={src:""};break}}return n}function Rt(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};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 An(e,n){const a=n.split(".");switch(a.length){case 1:return e[a[0]];case 2:return e[a[0]][a[1]];case 3:return e[a[0]][a[1]][a[2]];case 4:return e[a[0]][a[1]][a[2]][a[3]];case 5:return e[a[0]][a[1]][a[2]][a[3]][a[4]];case 6:return e[a[0]][a[1]][a[2]][a[3]][a[4]][a[5]]}}function kn(e,n){for(const a in n)e[a]=n[a]}function J(e,n,a){const t=n.split("."),i=t.length;if(typeof a!="object")switch(i){case 1:e[t[0]]=a;break;case 2:e[t[0]][t[1]]=a;break;case 3:e[t[0]][t[1]][t[2]]=a;break;case 4:e[t[0]][t[1]][t[2]][t[3]]=a;break;case 5:e[t[0]][t[1]][t[2]][t[3]][t[4]]=a;break}else{let u;switch(i){case 1:u=e[t[0]];break;case 2:u=e[t[0]][t[1]];break;case 3:u=e[t[0]][t[1]][t[2]];break;case 4:u=e[t[0]][t[1]][t[2]][t[3]];break;case 5:u=e[t[0]][t[1]][t[2]][t[3]][t[4]];break}u!==void 0&&kn(u,a)}}function sn(e){return new Promise((n,a)=>{const t=new Image;t.onload=()=>{const i=new d.Texture(t);i.wrapS=d.RepeatWrapping,i.wrapT=d.RepeatWrapping,i.needsUpdate=!0,n(i)},t.onerror=a,t.src=e})}class Pn extends lt{scene=void 0;renderer=void 0;getObject(n){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:n})}setObject(n){const a=Rt(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}})}setScene(n){if(n===void 0||(this.scene=n,!this.app.debugEnabled))return;nn(),It(this.scene);const a=rn(this.scene);this.app.send({event:"setScene",target:"editor",data:a})}addCamera(n){if(!this.app.debugEnabled)return;const a=Rt(n);this.app.send({event:"addCamera",target:"editor",data:a})}removeCamera(n){if(!this.app.debugEnabled)return;const a=Rt(n);this.app.send({event:"removeCamera",target:"editor",data:a})}handleApp(n,a,t){switch(t.event){case"getObject":N.dispatchEvent({type:L.GET_OBJECT,value:t.data});break;case"updateObject":N.dispatchEvent({type:L.UPDATE_OBJECT,value:t.data});break;case"createTexture":N.dispatchEvent({type:L.CREATE_TEXTURE,value:t.data});break;case"requestMethod":N.dispatchEvent({type:L.REQUEST_METHOD,value:t.data});break}}handleEditor(n,a,t){switch(t.event){case"setObject":N.dispatchEvent({type:L.SET_OBJECT,value:t.data});break;case"setScene":N.dispatchEvent({type:L.SET_SCENE,value:t.data});break;case"addCamera":N.dispatchEvent({type:L.ADD_CAMERA,value:t.data});break;case"removeCamera":N.dispatchEvent({type:L.REMOVE_CAMERA,value:t.data});break}}resize(n,a){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.renderer!==void 0?this.renderer?.domElement.width/this.dpr:0}get height(){return this.renderer!==void 0?this.renderer?.domElement.height/this.dpr:0}get canvas(){return this.renderer!==void 0?this.renderer?.domElement:null}}class jn 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(xn)}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,u=t.onChange!==void 0?t.onChange:Et;this.bindCBs.set(o,u),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.pane).addBinding(n,a,t).on("change",f=>{this.app.send({event:"updateBind",target:"app",data:{id:o,value:f.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 jt={exports:{}},at={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var $t;function jn(){if($t)return it;$t=1;var e=E,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function u(c,f,h){var m,v={},C=null,_=null;h!==void 0&&(C=""+h),f.key!==void 0&&(C=""+f.key),f.ref!==void 0&&(_=f.ref);for(m in f)t.call(f,m)&&!o.hasOwnProperty(m)&&(v[m]=f[m]);if(c&&c.defaultProps)for(m in f=c.defaultProps,f)v[m]===void 0&&(v[m]=f[m]);return{$$typeof:n,type:c,key:C,ref:_,props:v,_owner:i.current}}return it.Fragment=a,it.jsx=u,it.jsxs=u,it}var rt={};/**
9
+ */var $t;function Dn(){if($t)return at;$t=1;var e=x,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function u(c,f,h){var m,p={},C=null,R=null;h!==void 0&&(C=""+h),f.key!==void 0&&(C=""+f.key),f.ref!==void 0&&(R=f.ref);for(m in f)t.call(f,m)&&!o.hasOwnProperty(m)&&(p[m]=f[m]);if(c&&c.defaultProps)for(m in f=c.defaultProps,f)p[m]===void 0&&(p[m]=f[m]);return{$$typeof:n,type:c,key:C,ref:R,props:p,_owner:i.current}}return at.Fragment=a,at.jsx=u,at.jsxs=u,at}var it={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,20 +14,20 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ht;function Dn(){return Ht||(Ht=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"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),G=Symbol.iterator,Q="@@iterator";function he(r){if(r===null||typeof r!="object")return null;var p=G&&r[G]||r[Q];return typeof p=="function"?p:null}var ie=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function H(r){{for(var p=arguments.length,y=new Array(p>1?p-1:0),S=1;S<p;S++)y[S-1]=arguments[S];L("error",r,y)}}function L(r,p,y){{var S=ie.ReactDebugCurrentFrame,U=S.getStackAddendum();U!==""&&(p+="%s",y=y.concat([U]));var $=y.map(function(k){return String(k)});$.unshift("Warning: "+p),Function.prototype.apply.call(console[r],console,$)}}var K=!1,ee=!1,xe=!1,z=!1,fe=!1,ce;ce=Symbol.for("react.module.reference");function we(r){return!!(typeof r=="string"||typeof r=="function"||r===t||r===o||fe||r===i||r===h||r===m||z||r===_||K||ee||xe||typeof r=="object"&&r!==null&&(r.$$typeof===C||r.$$typeof===v||r.$$typeof===u||r.$$typeof===c||r.$$typeof===f||r.$$typeof===ce||r.getModuleId!==void 0))}function Me(r,p,y){var S=r.displayName;if(S)return S;var U=p.displayName||p.name||"";return U!==""?y+"("+U+")":y}function me(r){return r.displayName||"Context"}function F(r){if(r==null)return null;if(typeof r.tag=="number"&&H("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case t:return"Fragment";case a:return"Portal";case o:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case m:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case c:var p=r;return me(p)+".Consumer";case u:var y=r;return me(y._context)+".Provider";case f:return Me(r,r.render,"ForwardRef");case v:var S=r.displayName||null;return S!==null?S:F(r.type)||"Memo";case C:{var U=r,$=U._payload,k=U._init;try{return F(k($))}catch{return null}}}return null}var pe=Object.assign,w=0,Ee,Oe,_e,Re,Te,Ae,De;function Ie(){}Ie.__reactDisabledLog=!0;function te(){{if(w===0){Ee=console.log,Oe=console.info,_e=console.warn,Re=console.error,Te=console.group,Ae=console.groupCollapsed,De=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Ie,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}w++}}function Ce(){{if(w--,w===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:pe({},r,{value:Ee}),info:pe({},r,{value:Oe}),warn:pe({},r,{value:_e}),error:pe({},r,{value:Re}),group:pe({},r,{value:Te}),groupCollapsed:pe({},r,{value:Ae}),groupEnd:pe({},r,{value:De})})}w<0&&H("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $e=ie.ReactCurrentDispatcher,He;function le(r,p,y){{if(He===void 0)try{throw Error()}catch(U){var S=U.stack.trim().match(/\n( *(at )?)/);He=S&&S[1]||""}return`
18
- `+He+r}}var g=!1,b;{var M=typeof WeakMap=="function"?WeakMap:Map;b=new M}function j(r,p){if(!r||g)return"";{var y=b.get(r);if(y!==void 0)return y}var S;g=!0;var U=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $;$=$e.current,$e.current=null,te();try{if(p){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(ke){S=ke}Reflect.construct(r,[],k)}else{try{k.call()}catch(ke){S=ke}r.call(k.prototype)}}else{try{throw Error()}catch(ke){S=ke}r()}}catch(ke){if(ke&&S&&typeof ke.stack=="string"){for(var P=ke.stack.split(`
19
- `),de=S.stack.split(`
20
- `),q=P.length-1,X=de.length-1;q>=1&&X>=0&&P[q]!==de[X];)X--;for(;q>=1&&X>=0;q--,X--)if(P[q]!==de[X]){if(q!==1||X!==1)do if(q--,X--,X<0||P[q]!==de[X]){var ye=`
21
- `+P[q].replace(" at new "," at ");return r.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",r.displayName)),typeof r=="function"&&b.set(r,ye),ye}while(q>=1&&X>=0);break}}}finally{g=!1,$e.current=$,Ce(),Error.prepareStackTrace=U}var Xe=r?r.displayName||r.name:"",Vt=Xe?le(Xe):"";return typeof r=="function"&&b.set(r,Vt),Vt}function ne(r,p,y){return j(r,!1)}function R(r){var p=r.prototype;return!!(p&&p.isReactComponent)}function O(r,p,y){if(r==null)return"";if(typeof r=="function")return j(r,R(r));if(typeof r=="string")return le(r);switch(r){case h:return le("Suspense");case m:return le("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case f:return ne(r.render);case v:return O(r.type,p,y);case C:{var S=r,U=S._payload,$=S._init;try{return O($(U),p,y)}catch{}}}return""}var B=Object.prototype.hasOwnProperty,ae={},re=ie.ReactDebugCurrentFrame;function T(r){if(r){var p=r._owner,y=O(r.type,r._source,p?p.type:null);re.setExtraStackFrame(y)}else re.setExtraStackFrame(null)}function V(r,p,y,S,U){{var $=Function.call.bind(B);for(var k in r)if($(r,k)){var P=void 0;try{if(typeof r[k]!="function"){var de=Error((S||"React class")+": "+y+" type `"+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[k]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw de.name="Invariant Violation",de}P=r[k](p,k,S,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(q){P=q}P&&!(P instanceof Error)&&(T(U),H("%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).",S||"React class",y,k,typeof P),T(null)),P instanceof Error&&!(P.message in ae)&&(ae[P.message]=!0,T(U),H("Failed %s type: %s",y,P.message),T(null))}}}var W=Array.isArray;function Pe(r){return W(r)}function We(r){{var p=typeof Symbol=="function"&&Symbol.toStringTag,y=p&&r[Symbol.toStringTag]||r.constructor.name||"Object";return y}}function dt(r){try{return ht(r),!1}catch{return!0}}function ht(r){return""+r}function tt(r){if(dt(r))return H("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",We(r)),ht(r)}var Ne=ie.ReactCurrentOwner,nt={key:!0,ref:!0,__self:!0,__source:!0},at,ft,qe;qe={};function Ot(r){if(B.call(r,"ref")){var p=Object.getOwnPropertyDescriptor(r,"ref").get;if(p&&p.isReactWarning)return!1}return r.ref!==void 0}function Rt(r){if(B.call(r,"key")){var p=Object.getOwnPropertyDescriptor(r,"key").get;if(p&&p.isReactWarning)return!1}return r.key!==void 0}function Tt(r,p){if(typeof r.ref=="string"&&Ne.current&&p&&Ne.current.stateNode!==p){var y=F(Ne.current.type);qe[y]||(H('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',F(Ne.current.type),r.ref),qe[y]=!0)}}function mt(r,p){{var y=function(){at||(at=!0,H("%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)",p))};y.isReactWarning=!0,Object.defineProperty(r,"key",{get:y,configurable:!0})}}function Le(r,p){{var y=function(){ft||(ft=!0,H("%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)",p))};y.isReactWarning=!0,Object.defineProperty(r,"ref",{get:y,configurable:!0})}}var Bt=function(r,p,y,S,U,$,k){var P={$$typeof:n,type:r,key:p,ref:y,props:k,_owner:$};return P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(P,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(P,"_source",{configurable:!1,enumerable:!1,writable:!1,value:U}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P};function s(r,p,y,S,U){{var $,k={},P=null,de=null;y!==void 0&&(tt(y),P=""+y),Rt(p)&&(tt(p.key),P=""+p.key),Ot(p)&&(de=p.ref,Tt(p,U));for($ in p)B.call(p,$)&&!nt.hasOwnProperty($)&&(k[$]=p[$]);if(r&&r.defaultProps){var q=r.defaultProps;for($ in q)k[$]===void 0&&(k[$]=q[$])}if(P||de){var X=typeof r=="function"?r.displayName||r.name||"Unknown":r;P&&mt(k,X),de&&Le(k,X)}return Bt(r,P,de,U,S,Ne.current,k)}}var x=ie.ReactCurrentOwner,A=ie.ReactDebugCurrentFrame;function D(r){if(r){var p=r._owner,y=O(r.type,r._source,p?p.type:null);A.setExtraStackFrame(y)}else A.setExtraStackFrame(null)}var Z;Z=!1;function ge(r){return typeof r=="object"&&r!==null&&r.$$typeof===n}function ue(){{if(x.current){var r=F(x.current.type);if(r)return`
17
+ */var Ht;function In(){return Ht||(Ht=1,process.env.NODE_ENV!=="production"&&function(){var e=x,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"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),Y=Symbol.iterator,ee="@@iterator";function de(r){if(r===null||typeof r!="object")return null;var g=Y&&r[Y]||r[ee];return typeof g=="function"?g:null}var ae=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function H(r){{for(var g=arguments.length,y=new Array(g>1?g-1:0),w=1;w<g;w++)y[w-1]=arguments[w];F("error",r,y)}}function F(r,g,y){{var w=ae.ReactDebugCurrentFrame,U=w.getStackAddendum();U!==""&&(g+="%s",y=y.concat([U]));var $=y.map(function(D){return String(D)});$.unshift("Warning: "+g),Function.prototype.apply.call(console[r],console,$)}}var X=!1,te=!1,xe=!1,z=!1,he=!1,oe;oe=Symbol.for("react.module.reference");function we(r){return!!(typeof r=="string"||typeof r=="function"||r===t||r===o||he||r===i||r===h||r===m||z||r===R||X||te||xe||typeof r=="object"&&r!==null&&(r.$$typeof===C||r.$$typeof===p||r.$$typeof===u||r.$$typeof===c||r.$$typeof===f||r.$$typeof===oe||r.getModuleId!==void 0))}function Me(r,g,y){var w=r.displayName;if(w)return w;var U=g.displayName||g.name||"";return U!==""?y+"("+U+")":y}function me(r){return r.displayName||"Context"}function B(r){if(r==null)return null;if(typeof r.tag=="number"&&H("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case t:return"Fragment";case a:return"Portal";case o:return"Profiler";case i:return"StrictMode";case h:return"Suspense";case m:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case c:var g=r;return me(g)+".Consumer";case u:var y=r;return me(y._context)+".Provider";case f:return Me(r,r.render,"ForwardRef");case p:var w=r.displayName||null;return w!==null?w:B(r.type)||"Memo";case C:{var U=r,$=U._payload,D=U._init;try{return B(D($))}catch{return null}}}return null}var pe=Object.assign,M=0,Ee,Oe,_e,Te,Re,Ae,De;function Ie(){}Ie.__reactDisabledLog=!0;function ne(){{if(M===0){Ee=console.log,Oe=console.info,_e=console.warn,Te=console.error,Re=console.group,Ae=console.groupCollapsed,De=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Ie,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}M++}}function Ce(){{if(M--,M===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:pe({},r,{value:Ee}),info:pe({},r,{value:Oe}),warn:pe({},r,{value:_e}),error:pe({},r,{value:Te}),group:pe({},r,{value:Re}),groupCollapsed:pe({},r,{value:Ae}),groupEnd:pe({},r,{value:De})})}M<0&&H("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $e=ae.ReactCurrentDispatcher,He;function ce(r,g,y){{if(He===void 0)try{throw Error()}catch(U){var w=U.stack.trim().match(/\n( *(at )?)/);He=w&&w[1]||""}return`
18
+ `+He+r}}var v=!1,b;{var O=typeof WeakMap=="function"?WeakMap:Map;b=new O}function j(r,g){if(!r||v)return"";{var y=b.get(r);if(y!==void 0)return y}var w;v=!0;var U=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $;$=$e.current,$e.current=null,ne();try{if(g){var D=function(){throw Error()};if(Object.defineProperty(D.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(D,[])}catch(Pe){w=Pe}Reflect.construct(r,[],D)}else{try{D.call()}catch(Pe){w=Pe}r.call(D.prototype)}}else{try{throw Error()}catch(Pe){w=Pe}r()}}catch(Pe){if(Pe&&w&&typeof Pe.stack=="string"){for(var k=Pe.stack.split(`
19
+ `),ue=w.stack.split(`
20
+ `),K=k.length-1,Z=ue.length-1;K>=1&&Z>=0&&k[K]!==ue[Z];)Z--;for(;K>=1&&Z>=0;K--,Z--)if(k[K]!==ue[Z]){if(K!==1||Z!==1)do if(K--,Z--,Z<0||k[K]!==ue[Z]){var ye=`
21
+ `+k[K].replace(" at new "," at ");return r.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",r.displayName)),typeof r=="function"&&b.set(r,ye),ye}while(K>=1&&Z>=0);break}}}finally{v=!1,$e.current=$,Ce(),Error.prepareStackTrace=U}var Ze=r?r.displayName||r.name:"",Vt=Ze?ce(Ze):"";return typeof r=="function"&&b.set(r,Vt),Vt}function fe(r,g,y){return j(r,!1)}function _(r){var g=r.prototype;return!!(g&&g.isReactComponent)}function S(r,g,y){if(r==null)return"";if(typeof r=="function")return j(r,_(r));if(typeof r=="string")return ce(r);switch(r){case h:return ce("Suspense");case m:return ce("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case f:return fe(r.render);case p:return S(r.type,g,y);case C:{var w=r,U=w._payload,$=w._init;try{return S($(U),g,y)}catch{}}}return""}var P=Object.prototype.hasOwnProperty,W={},ie=ae.ReactDebugCurrentFrame;function T(r){if(r){var g=r._owner,y=S(r.type,r._source,g?g.type:null);ie.setExtraStackFrame(y)}else ie.setExtraStackFrame(null)}function V(r,g,y,w,U){{var $=Function.call.bind(P);for(var D in r)if($(r,D)){var k=void 0;try{if(typeof r[D]!="function"){var ue=Error((w||"React class")+": "+y+" type `"+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[D]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ue.name="Invariant Violation",ue}k=r[D](g,D,w,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(K){k=K}k&&!(k instanceof Error)&&(T(U),H("%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).",w||"React class",y,D,typeof k),T(null)),k instanceof Error&&!(k.message in W)&&(W[k.message]=!0,T(U),H("Failed %s type: %s",y,k.message),T(null))}}}var q=Array.isArray;function ke(r){return q(r)}function qe(r){{var g=typeof Symbol=="function"&&Symbol.toStringTag,y=g&&r[Symbol.toStringTag]||r.constructor.name||"Object";return y}}function ut(r){try{return dt(r),!1}catch{return!0}}function dt(r){return""+r}function et(r){if(ut(r))return H("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(r)),dt(r)}var Ne=ae.ReactCurrentOwner,tt={key:!0,ref:!0,__self:!0,__source:!0},nt,ht,Ke;Ke={};function Mt(r){if(P.call(r,"ref")){var g=Object.getOwnPropertyDescriptor(r,"ref").get;if(g&&g.isReactWarning)return!1}return r.ref!==void 0}function Ot(r){if(P.call(r,"key")){var g=Object.getOwnPropertyDescriptor(r,"key").get;if(g&&g.isReactWarning)return!1}return r.key!==void 0}function Tt(r,g){if(typeof r.ref=="string"&&Ne.current&&g&&Ne.current.stateNode!==g){var y=B(Ne.current.type);Ke[y]||(H('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',B(Ne.current.type),r.ref),Ke[y]=!0)}}function ft(r,g){{var y=function(){nt||(nt=!0,H("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",g))};y.isReactWarning=!0,Object.defineProperty(r,"key",{get:y,configurable:!0})}}function Le(r,g){{var y=function(){ht||(ht=!0,H("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",g))};y.isReactWarning=!0,Object.defineProperty(r,"ref",{get:y,configurable:!0})}}var Bt=function(r,g,y,w,U,$,D){var k={$$typeof:n,type:r,key:g,ref:y,props:D,_owner:$};return k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(k,"_self",{configurable:!1,enumerable:!1,writable:!1,value:w}),Object.defineProperty(k,"_source",{configurable:!1,enumerable:!1,writable:!1,value:U}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k};function s(r,g,y,w,U){{var $,D={},k=null,ue=null;y!==void 0&&(et(y),k=""+y),Ot(g)&&(et(g.key),k=""+g.key),Mt(g)&&(ue=g.ref,Tt(g,U));for($ in g)P.call(g,$)&&!tt.hasOwnProperty($)&&(D[$]=g[$]);if(r&&r.defaultProps){var K=r.defaultProps;for($ in K)D[$]===void 0&&(D[$]=K[$])}if(k||ue){var Z=typeof r=="function"?r.displayName||r.name||"Unknown":r;k&&ft(D,Z),ue&&Le(D,Z)}return Bt(r,k,ue,U,w,Ne.current,D)}}var E=ae.ReactCurrentOwner,A=ae.ReactDebugCurrentFrame;function I(r){if(r){var g=r._owner,y=S(r.type,r._source,g?g.type:null);A.setExtraStackFrame(y)}else A.setExtraStackFrame(null)}var Q;Q=!1;function ge(r){return typeof r=="object"&&r!==null&&r.$$typeof===n}function le(){{if(E.current){var r=B(E.current.type);if(r)return`
22
22
 
23
- Check the render method of \``+r+"`."}return""}}function Ut(r){{if(r!==void 0){var p=r.fileName.replace(/^.*[\\\/]/,""),y=r.lineNumber;return`
23
+ Check the render method of \``+r+"`."}return""}}function Ut(r){{if(r!==void 0){var g=r.fileName.replace(/^.*[\\\/]/,""),y=r.lineNumber;return`
24
24
 
25
- Check your code at `+p+":"+y+"."}return""}}var pt={};function gt(r){{var p=ue();if(!p){var y=typeof r=="string"?r:r.displayName||r.name;y&&(p=`
25
+ Check your code at `+g+":"+y+"."}return""}}var mt={};function pt(r){{var g=le();if(!g){var y=typeof r=="string"?r:r.displayName||r.name;y&&(g=`
26
26
 
27
- Check the top-level render call using <`+y+">.")}return p}}function ve(r,p){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var y=gt(p);if(pt[y])return;pt[y]=!0;var S="";r&&r._owner&&r._owner!==x.current&&(S=" It was passed a child from "+F(r._owner.type)+"."),D(r),H('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,S),D(null)}}function be(r,p){{if(typeof r!="object")return;if(Pe(r))for(var y=0;y<r.length;y++){var S=r[y];ge(S)&&ve(S,p)}else if(ge(r))r._store&&(r._store.validated=!0);else if(r){var U=he(r);if(typeof U=="function"&&U!==r.entries)for(var $=U.call(r),k;!(k=$.next()).done;)ge(k.value)&&ve(k.value,p)}}}function ze(r){{var p=r.type;if(p==null||typeof p=="string")return;var y;if(typeof p=="function")y=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===f||p.$$typeof===v))y=p.propTypes;else return;if(y){var S=F(p);V(y,r.props,"prop",S,r)}else if(p.PropTypes!==void 0&&!Z){Z=!0;var U=F(p);H("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",U||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&H("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Se(r){{for(var p=Object.keys(r.props),y=0;y<p.length;y++){var S=p[y];if(S!=="children"&&S!=="key"){D(r),H("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),D(null);break}}r.ref!==null&&(D(r),H("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}function Fe(r,p,y,S,U,$){{var k=we(r);if(!k){var P="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(P+=" 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 de=Ut(U);de?P+=de:P+=ue();var q;r===null?q="null":Pe(r)?q="array":r!==void 0&&r.$$typeof===n?(q="<"+(F(r.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):q=typeof r,H("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,P)}var X=s(r,p,y,U,$);if(X==null)return X;if(k){var ye=p.children;if(ye!==void 0)if(S)if(Pe(ye)){for(var Xe=0;Xe<ye.length;Xe++)be(ye[Xe],r);Object.freeze&&Object.freeze(ye)}else H("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else be(ye,r)}return r===t?Se(X):ze(X),X}}function Ke(r,p,y){return Fe(r,p,y,!0)}function vt(r,p,y){return Fe(r,p,y,!1)}var pn=vt,gn=Ke;rt.Fragment=t,rt.jsx=pn,rt.jsxs=gn}()),rt}process.env.NODE_ENV==="production"?Dt.exports=jn():Dt.exports=Dn();var l=Dt.exports;function Lt(e){return e.title.search("<")>-1?l.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:e.title}}):l.jsx("button",{children:e.title})}const In=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"})]}),Nn=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 <`+y+">.")}return g}}function ve(r,g){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var y=pt(g);if(mt[y])return;mt[y]=!0;var w="";r&&r._owner&&r._owner!==E.current&&(w=" It was passed a child from "+B(r._owner.type)+"."),I(r),H('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,w),I(null)}}function be(r,g){{if(typeof r!="object")return;if(ke(r))for(var y=0;y<r.length;y++){var w=r[y];ge(w)&&ve(w,g)}else if(ge(r))r._store&&(r._store.validated=!0);else if(r){var U=de(r);if(typeof U=="function"&&U!==r.entries)for(var $=U.call(r),D;!(D=$.next()).done;)ge(D.value)&&ve(D.value,g)}}}function ze(r){{var g=r.type;if(g==null||typeof g=="string")return;var y;if(typeof g=="function")y=g.propTypes;else if(typeof g=="object"&&(g.$$typeof===f||g.$$typeof===p))y=g.propTypes;else return;if(y){var w=B(g);V(y,r.props,"prop",w,r)}else if(g.PropTypes!==void 0&&!Q){Q=!0;var U=B(g);H("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",U||"Unknown")}typeof g.getDefaultProps=="function"&&!g.getDefaultProps.isReactClassApproved&&H("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Se(r){{for(var g=Object.keys(r.props),y=0;y<g.length;y++){var w=g[y];if(w!=="children"&&w!=="key"){I(r),H("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",w),I(null);break}}r.ref!==null&&(I(r),H("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function Fe(r,g,y,w,U,$){{var D=we(r);if(!D){var k="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(k+=" 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=Ut(U);ue?k+=ue:k+=le();var K;r===null?K="null":ke(r)?K="array":r!==void 0&&r.$$typeof===n?(K="<"+(B(r.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):K=typeof r,H("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",K,k)}var Z=s(r,g,y,U,$);if(Z==null)return Z;if(D){var ye=g.children;if(ye!==void 0)if(w)if(ke(ye)){for(var Ze=0;Ze<ye.length;Ze++)be(ye[Ze],r);Object.freeze&&Object.freeze(ye)}else H("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else be(ye,r)}return r===t?Se(Z):ze(Z),Z}}function Xe(r,g,y){return Fe(r,g,y,!0)}function gt(r,g,y){return Fe(r,g,y,!1)}var pn=gt,gn=Xe;it.Fragment=t,it.jsx=pn,it.jsxs=gn}()),it}process.env.NODE_ENV==="production"?jt.exports=Dn():jt.exports=In();var l=jt.exports;function Lt(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(Jt.Reorder.Item,{value:e.title,children:l.jsxs("div",{children:[Nn,l.jsx("span",{children:e.title}),l.jsx("button",{className:"closeIcon",onClick:()=>{e.onDelete(e.index)},children:In})]})},e.title)}function cn(e){const[n,a]=E.useState(!1),[t,i]=E.useState(e.options),o=h=>{e.onDragComplete(h),i(h)},u=h=>{const m=[...t];m.splice(h,1),o(m)},c=[];t.forEach((h,m)=>{c.push(l.jsx(on,{index:m,title:h,onDelete:u},h))});let f="dropdown draggable";return e.subdropdown&&(f+=" subdropdown"),l.jsxs("div",{className:f,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Lt,{title:e.title}),l.jsx(Jt.Reorder.Group,{axis:"y",values:t,onReorder:o,style:{visibility:n?"visible":"hidden"},children:c})]})}function ln(e){const[n,a]=E.useState(!1),t=[];e.options.map((o,u)=>{e.onSelect!==void 0&&(o.onSelect=e.onSelect),t.push(l.jsx(un,{option:o},u))});let i="dropdown";return e.subdropdown&&(i+=" subdropdown"),l.jsxs("div",{className:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Lt,{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},Qt())}function Ln(e,n,a){function t(o){switch(n.forEach(u=>{u.callback(e,u.remote,o)}),o.event){case"custom":I.dispatchEvent({type:N.CUSTOM,value:o.data});break}}function i(o){switch(a.forEach(u=>{u.callback(e,u.remote,o)}),o.event){case"custom":I.dispatchEvent({type:N.CUSTOM,value:o.data});break}}e.listen=o=>{o.target==="editor"?i(o):t(o)}}function wt(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:lt(e.label)})]}),e.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:e.children})})]})}function Ft(e){const[n,a]=E.useState(!1),t=e.child!==void 0&&e.child.children.length>0,i=[];return e.child!==void 0&&e.child.children.length>0&&e.child.children.map(o=>{i.push(l.jsx(Ft,{child:o,three:e.three},Math.random()))}),l.jsx(l.Fragment,{children:e.child!==void 0&&l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[t?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,l.jsx("button",{className:"name",style:{left:t?"20px":"5px"},onClick:()=>{e.child!==void 0&&(e.three.getObject(e.child.uuid),n||a(!0))},children:e.child.name.length>0?`${e.child.name} (${e.child.type})`:`${e.child.type}::${e.child.uuid}`}),l.jsx("div",{className:`icon ${Rn(e.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:i})})]},Math.random())})}function dn(e){const n=[];return e.child?.children.map(a=>{n.push(l.jsx(Ft,{child:a,three:e.three},Math.random()))}),l.jsx("div",{className:`scene ${e.class!==void 0?e.class:""}`,children:n})}const Fn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function Bn(e){return"items"in e}function Ge(e){const n=[];return e.items.forEach(a=>{Bn(a)?n.push(l.jsx(Ge,{title:lt(a.title),items:a.items},Math.random())):n.push(l.jsx(ct,{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)}},Math.random()))}),l.jsx(wt,{label:e.title,open:e.expanded===!0,children:n})}function Un(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 Vn(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 Mt(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 $n(){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 Hn=[{title:"Front",value:d.FrontSide},{title:"Back",value:d.BackSide},{title:"Double",value:d.DoubleSide}],zn=[{title:"No Blending",value:d.NoBlending},{title:"Normal",value:d.NormalBlending},{title:"Additive",value:d.AdditiveBlending},{title:"Subtractive",value:d.SubtractiveBlending},{title:"Multiply",value:d.MultiplyBlending},{title:"Custom",value:d.CustomBlending}],Yn=[{title:"Add",value:d.AddEquation},{title:"Subtract",value:d.SubtractEquation},{title:"Reverse Subtract",value:d.ReverseSubtractEquation},{title:"Min",value:d.MinEquation},{title:"Max",value:d.MaxEquation}],Gn=[{title:"Zero",valye:d.ZeroFactor},{title:"One",valye:d.OneFactor},{title:"Src Color",valye:d.SrcColorFactor},{title:"One Minus Src Color",valye:d.OneMinusSrcColorFactor},{title:"Src Alpha",valye:d.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:d.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:d.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:d.OneMinusDstAlphaFactor},{title:"Dst Color",valye:d.DstColorFactor},{title:"One Minus Dst Color",valye:d.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:d.SrcAlphaSaturateFactor},{title:"Constant Color",valye:d.ConstantColorFactor},{title:"One Minus Constant Color",valye:d.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:d.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:d.OneMinusConstantAlphaFactor}],Wn=[{title:"Zero",valye:d.ZeroFactor},{title:"One",valye:d.OneFactor},{title:"Src Color",valye:d.SrcColorFactor},{title:"One Minus Src Color",valye:d.OneMinusSrcColorFactor},{title:"Src Alpha",valye:d.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:d.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:d.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:d.OneMinusDstAlphaFactor},{title:"Dst Color",valye:d.DstColorFactor},{title:"One Minus Dst Color",valye:d.OneMinusDstColorFactor},{title:"Constant Color",valye:d.ConstantColorFactor},{title:"One Minus Constant Color",valye:d.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:d.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:d.OneMinusConstantAlphaFactor}];function st(e,n){e.needsUpdate=!0,e.type="option",e.options=n}function qn(e,n,a,t){return{type:"boolean",title:Mt(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 u=t.scene?.getObjectByProperty("uuid",a.uuid);u!==void 0&&J(u,`material.${e}`,o)}}}function Kn(e,n,a,t){const i={type:"number",title:Mt(e),prop:e,value:n,min:void 0,max:void 0,step:.01,needsUpdate:!0,onChange:(o,u)=>{t.updateObject(a.uuid,`material.${e}`,u),t.updateObject(a.uuid,"material.needsUpdate",!0);const c=t.scene?.getObjectByProperty("uuid",a.uuid);c!==void 0&&J(c,`material.${e}`,u)}};switch(e){case"blending":st(i,zn);break;case"blendDst":st(i,Wn);break;case"blendEquation":st(i,Yn);break;case"blendSrc":st(i,Gn);break;case"side":st(i,Hn);break}return hn(e)&&(i.value=Number(n),i.type="range",i.min=Math.min(0,i.value),i.max=Math.max(1,i.value),i.step=.01),i}function Xn(e,n,a,t){const i={type:"string",title:Mt(e),prop:e,value:n,needsUpdate:!0,onChange:(u,c)=>{t.updateObject(a.uuid,`material.${e}`,c),t.updateObject(a.uuid,"material.needsUpdate",!0);const f=t.scene?.getObjectByProperty("uuid",a.uuid);f!==void 0&&J(f,`material.${e}`,c)}};return(e==="vertexShader"||e==="fragmentShader")&&(i.disabled=!1,i.latest=i.value,i.onChange=(u,c)=>{i.latest=c}),i}function Zn(e){return e.x!==void 0&&e.y!==void 0&&e.z===void 0}function Jn(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w===void 0}function Qn(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w!==void 0}function zt(e){e.sort((n,a)=>n.title<a.title?-1:n.title>a.title?1:0)}function ot(e,n,a,t,i="",o=!1){const u=Mt(e).split(".")[0].replaceAll("[","").replaceAll("]",""),c=i.length>0?`${i}.${e}`:e,f=typeof n;if(f==="boolean"||f==="string")return{title:u,prop:c,type:f,value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const v=t.scene?.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${c}`,m)}};if(f==="number"){const h={title:u,prop:c,type:"number",value:n,step:.01,disabled:o,onChange:(m,v)=>{t.updateObject(a.uuid,`material.${c}`,v);const C=t.scene?.getObjectByProperty("uuid",a.uuid);C!==void 0&&J(C,`material.${c}`,v)}};return hn(u)&&(h.type="range",h.min=0,h.max=1),h}else{if(n.isColor)return{title:u,prop:c,type:"color",value:n,disabled:o,onChange:(h,m)=>{const v=new d.Color(m);t.updateObject(a.uuid,`material.${c}`,v);const C=t.scene?.getObjectByProperty("uuid",a.uuid);C!==void 0&&J(C,`material.${c}`,v)}};if(Array.isArray(n)){const h=[];for(const m in n){const v=n[m],C=`[${m.toString()}]`;if(v.value!==void 0){const _=ot(`${C}.value`,v.value,a,t,c,o);_!==void 0&&h.push(_)}else{const _=ot(C,v,a,t,c,o);_!==void 0&&h.push(_)}}if(h.length>0)return zt(h),{title:u,items:h}}else{if(Zn(n))return{title:u,prop:c,type:"vector2",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const v=t.scene?.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${c}`,m)}};if(Jn(n))return{title:u,prop:c,type:"grid3",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const v=t.scene?.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${c}`,m)}};if(Qn(n))return{title:u,prop:c,type:"grid4",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const v=t.scene?.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${c}`,m)}};if(n.src!==void 0)return{title:u,type:"image",value:n,disabled:o,onChange:(h,m)=>{const v=Vn(e),C=i.length>0?`${i}.${v}`:v;t.createTexture(a.uuid,`material.${C}`,m);const _=t.scene?.getObjectByProperty("uuid",a.uuid);_!==void 0&&sn(m).then(G=>{J(_,`material.${C}`,G),J(_,"material.needsUpdate",!0)})}};if(n.elements!==void 0)return{title:u,prop:c,type:n.elements.length>9?"grid4":"grid3",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const v=t.scene?.getObjectByProperty("uuid",a.uuid);v!==void 0&&J(v,`material.${c}`,m)}};{const h=[],m=e==="defines"||e==="extensions";for(const v in n){const C=n[v];if(C.value!==void 0){const _=ot(`${v}.value`,C.value,a,t,c,m);_!==void 0&&h.push(_)}else{const _=ot(v,C,a,t,c,m);_!==void 0&&h.push(_)}}if(h.length>0)return zt(h),{title:u,items:h}}}}}function Yt(e,n,a){const t=[];for(const i in e){if(!Un(i))continue;const o=typeof e[i],u=e[i];if(o==="boolean")t.push(qn(i,u,n,a));else if(o==="number")t.push(Kn(i,u,n,a));else if(o==="string")t.push(Xn(i,u,n,a));else if(o==="object"){const c=ot(i,u,n,a);c!==void 0&&t.push(c)}else u!==void 0&&console.log("other:",i,o,u)}return t.sort((i,o)=>i.title<o.title?-1:i.title>o.title?1:0),t.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),t}function ea(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(Ge,{title:`Material ${o}`,items:Yt(a[o],e,n)},`Material ${o}`));return l.jsx(l.Fragment,{children:t})}else return l.jsx(Ge,{title:"Material",items:Yt(a,e,n)})}function ta(e){const[n,a]=E.useState(e.defaultValue);return E.useEffect(()=>{let t=!1,i=-1,o=0,u=e.defaultValue;const c=C=>{t=!0,o=Number(e.input.current?.value),i=C.clientX,document.addEventListener("mouseup",h,!1),document.addEventListener("mousemove",f,!1),document.addEventListener("contextmenu",h,!1)},f=C=>{if(!t)return;const _=e.step!==void 0?e.step:1,G=(C.clientX-i)*_;u=Number((o+G).toFixed(4)),e.min!==void 0&&(u=Math.max(u,e.min)),e.max!==void 0&&(u=Math.min(u,e.max)),e.onChange!==void 0&&e.onChange(u),a(u)},h=()=>{t=!1,document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",f),document.removeEventListener("contextmenu",h)},m=C=>{const _=Number(C.target.value);a(_)},v=C=>{const _=Number(C.target.value);e.onChange!==void 0&&e.onChange(_),a(_)};return e.input.current?.addEventListener("input",m),e.label.current?.addEventListener("mousedown",c,!1),e.sliderRef!==void 0&&e.sliderRef.current?.addEventListener("input",v),()=>{e.input.current?.removeEventListener("input",m),e.label.current?.removeEventListener("mousedown",c),e.sliderRef!==void 0&&e.sliderRef.current?.removeEventListener("input",v),document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",f),document.removeEventListener("contextmenu",h)}},[]),n}function et(e){const n=E.useRef(null),a=E.useRef(null),t=ta({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:Ct})]})]})}function na(e){const n=E.useRef(null),a=E.useRef(null),t=E.useRef(null),i=E.useRef(null),o=E.useRef(null),u=E.useRef(null),[c,f]=E.useState(e.value),[h,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))}),[v,C]=E.useState(!1);function _(){v||(window.addEventListener("mousemove",Q),window.addEventListener("mouseup",G),window.addEventListener("mouseup",G),C(!0))}function G(){window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",G),C(!1)}function Q(L){const K=o.current.getBoundingClientRect(),ee=Ve(0,99,L.clientX-K.left)/99,xe=Ve(0,99,L.clientY-K.top)/99,z=Qe(jt(h.min,h.max,ee),3),fe=Qe(jt(h.min,h.max,xe),3);e.onChange({target:{value:{x:z,y:fe}}}),f({x:z,y:fe})}function he(L){let K=c.x,ee=c.y;L.target===n.current?K=Number(L.target.value):ee=Number(L.target.value),f({x:K,y:ee})}function ie(){const L=Number(t.current.value);m({min:L,max:h.max}),(c.x<L||c.y<L)&&f({x:Ve(L,h.max,c.x),y:Ve(L,h.max,c.y)})}function H(){const L=Number(i.current.value);m({min:h.min,max:L}),(c.x>L||c.y>L)&&f({x:Ve(h.min,L,c.x),y:Ve(h.min,L,c.y)})}return E.useEffect(()=>{const L=kt(h.min,h.max,c.x),K=kt(h.min,h.max,c.y);u.current.style.left=`${L*100}%`,u.current.style.top=`${K*100}%`},[h,c]),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:c.x,min:h.min,max:h.max,step:.01,onChange:he})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Y:"}),l.jsx("input",{ref:a,type:"number",value:c.y,min:h.min,max:h.max,step:.01,onChange:he})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Min:"}),l.jsx("input",{ref:t,type:"number",value:h.min,step:.01,onChange:ie})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Max:"}),l.jsx("input",{ref:i,type:"number",value:h.max,step:.01,onChange:H})]})]}),l.jsxs("div",{className:"input",ref:o,onMouseDown:_,onMouseUp:G,children:[l.jsx("div",{className:"x"}),l.jsx("div",{className:"y"}),l.jsx("div",{className:"pt",ref:u})]})]})}function aa(e){const n=e.value.x!==void 0,a=[];if(n){const t=E.useMemo(()=>e.value,[]),i=(u,c)=>{t[u]=c,e.onChange({target:{value:t}})};["x","y","z"].forEach(u=>{const c=E.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:c,children:u.toUpperCase()}),l.jsx(et,{value:t.x,type:"number",prop:u,step:.01,labelRef:c,onChange:i})]},u))})}else{const t=E.useMemo(()=>e.value,[]),i=(o,u)=>{const c=Number(o);t.elements[c]=u,e.onChange({target:{value:t}})};for(let o=0;o<9;o++){const u=E.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:u,children:o+1}),l.jsx(et,{value:t.elements[o],type:"number",prop:o.toString(),step:.01,labelRef:u,onChange:i})]},o.toString()))}}return l.jsx("div",{className:"grid3",children:a})}function ia(e){const n=e.value.x!==void 0,a=[];if(n){const t=E.useMemo(()=>e.value,[]),i=(u,c)=>{t[u]=c,e.onChange({target:{value:t}})};["x","y","z","w"].forEach(u=>{const c=E.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:c,children:u.toUpperCase()}),l.jsx(et,{value:t.x,type:"number",prop:u,step:.01,labelRef:c,onChange:i})]},u))})}else{const t=E.useMemo(()=>e.value,[]),i=(o,u)=>{const c=Number(o);t.elements[c]=u,e.onChange({target:{value:t}})};for(let o=0;o<16;o++){const u=E.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:u,children:o+1}),l.jsx(et,{value:t.elements[o],type:"number",prop:o.toString(),step:.01,labelRef:u,onChange:i})]},o.toString()))}}return l.jsx("div",{className:"grid4",children:a})}function ct(e){let n=e.value;n!==void 0&&n.isColor!==void 0&&(n=tn(e.value));const[a,t]=E.useState(n),i=E.useRef(null),o=E.useRef(null),u=m=>{let v=m.target.value;e.type==="boolean"?v=m.target.checked:e.type==="option"&&(v=e.options[v].value),t(v),e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,v)},c={};e.disabled&&(c.opacity=.8);const f=e.type==="string"&&(a.length>100||a.search(`
30
- `)>-1),h=f||e.type==="image"||e.type==="vector2";return l.jsxs("div",{className:`field ${h?"block":""}`,style:c,children:[e.type!=="button"&&l.jsx("label",{ref:i,children:lt(e.title)},"fieldLabel"),e.type==="string"&&!f&&l.jsx("input",{type:"text",disabled:e.disabled,onChange:u,value:a}),e.type==="string"&&f&&l.jsx("textarea",{cols:50,rows:10,disabled:e.disabled!==void 0?e.disabled:!0,onChange:u,value:a}),e.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:e.disabled,onChange:u,checked:a}),e.type==="number"&&l.jsx(et,{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(et,{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:u,disabled:e.disabled,className:"color"}),l.jsx("input",{type:"color",value:a,onChange:u,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("img",{ref:o,onClick:()=>{$n().then(m=>{o.current.src=m,e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,m)})},src:a.length>0?a:Fn}),e.type==="option"&&l.jsx(l.Fragment,{children:l.jsx("select",{onChange:u,disabled:e.disabled,defaultValue:e.value,children:e.options?.map((m,v)=>l.jsx("option",{value:m.value,children:lt(m.title)},v))})}),e.type==="vector2"&&l.jsx(na,{value:a,min:0,max:1,onChange:u}),e.type==="grid3"&&l.jsx(aa,{value:a,onChange:u}),e.type==="grid4"&&l.jsx(ia,{value:a,onChange:u})]})}function Gt(e){switch(e){case"fov":return"FOV";case"zoom":return"Zoom";case"near":return"Near";case"far":return"Far";case"focus":return"Focus";case"aspect":return"Aspect";case"filmGauge":return"Film Gauge";case"filmOffset":return"Film Offset";case"left":return"Left";case"right":return"Right";case"top":return"Top";case"bottom":return"Bottom"}return e}function ra(e,n){const a=[];if(e.perspectiveCameraInfo!==void 0)for(const t in e.perspectiveCameraInfo)a.push({title:Gt(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 u=n.scene?.getObjectByProperty("uuid",e.uuid);u!==void 0&&(J(u,i,o),u.updateProjectionMatrix())}});else if(e.orthographicCameraInfo!==void 0)for(const t in e.orthographicCameraInfo)a.push({title:Gt(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 u=n.scene?.getObjectByProperty("uuid",e.uuid);u!==void 0&&(J(u,i,o),u.updateProjectionMatrix())}});return l.jsx(Ge,{title:"Camera",items:a})}const sa=Math.PI/180,oa=180/Math.PI;function Je(e,n,a,t,i){return t+(e-n)*(i-t)/(a-n)}function ca(e){return e*sa}function At(e){return e*oa}function la(e,n){const a=new d.Matrix4;a.elements=e.matrix;const t=new d.Vector3,i=new d.Euler,o=new d.Vector3;e.uuid.length>0&&(t.setFromMatrixPosition(a),i.setFromRotationMatrix(a),o.setFromMatrixScale(a));const u=(f,h)=>{n.updateObject(e.uuid,f,h);const m=n.scene?.getObjectByProperty("uuid",e.uuid);m!==void 0&&J(m,f,h)},c=(f,h)=>{u(f,ca(h))};return l.jsx(Ge,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:t.x,onChange:u},{title:"Position Y",prop:"position.y",type:"number",value:t.y,onChange:u},{title:"Position Z",prop:"position.z",type:"number",value:t.z,onChange:u},{title:"Rotation X",prop:"rotation.x",type:"number",value:Qe(At(i.x)),min:-360,max:360,step:.1,onChange:c},{title:"Rotation Y",prop:"rotation.y",type:"number",value:Qe(At(i.y)),min:-360,max:360,step:.1,onChange:c},{title:"Rotation Z",prop:"rotation.z",type:"number",value:Qe(At(i.z)),min:-360,max:360,step:.1,onChange:c},{title:"Scale X",prop:"scale.x",type:"number",value:o.x,step:.01,onChange:u},{title:"Scale Y",prop:"scale.y",type:"number",value:o.y,step:.01,onChange:u},{title:"Scale Z",prop:"scale.z",type:"number",value:o.z,step:.01,onChange:u}]})}function Wt(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 ua(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:Wt(t),prop:t,type:"color",value:i,onChange:(o,u)=>{const c=new d.Color(u);n.updateObject(e.uuid,o,c);const f=n.scene?.getObjectByProperty("uuid",e.uuid);f!==void 0&&J(f,o,c)}}):a.push({title:Wt(t),prop:t,type:typeof i,value:i,step:typeof i=="number"?.01:void 0,onChange:(o,u)=>{n.updateObject(e.uuid,o,u);const c=n.scene?.getObjectByProperty("uuid",e.uuid);c!==void 0&&J(c,o,u)}}))}return l.jsx(Ge,{title:"Light",items:a})}function da(e,n){const a=[],t=[];let i=0;e.animations.forEach(c=>{i=Math.max(i,c.duration),c.duration>0&&t.push({title:c.name,items:[{title:"Duration",type:"number",value:c.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.scene?.getObjectByProperty("uuid",e.uuid);let u=!1;if(o!==void 0){const c=o.mixer;if(u=c!==void 0,u){const f=[{title:"Time Scale",type:"range",value:c.timeScale,step:.01,min:-1,max:2,onChange:(h,m)=>{c.timeScale=m,n.updateObject(e.uuid,"mixer.timeScale",m)}}];f.push({title:"Stop All",type:"button",onChange:()=>{c.stopAllAction(),n.requestMethod(e.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:f})}}return l.jsx(Ge,{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};let se={...fn};function mn(e){const[n,a]=E.useState(-1);E.useEffect(()=>{function u(f){se={...f.value},a(Date.now())}function c(){se={...fn},a(Date.now())}return I.addEventListener(N.SET_SCENE,c),I.addEventListener(N.SET_OBJECT,u),()=>{I.removeEventListener(N.SET_SCENE,c),I.removeEventListener(N.SET_OBJECT,u)}},[]);const t=se.type.toLowerCase(),i=se.animations.length>0||se.mixer!==void 0,o=t.search("mesh")>-1||t.search("line")>-1||t.search("points")>-1;return l.jsx(wt,{label:"Inspector",children:l.jsx("div",{id:"Inspector",className:e.class,children:se.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(ct,{type:"string",title:"Name",prop:"name",value:se.name,disabled:!0}),l.jsx(ct,{type:"string",title:"Type",prop:"type",value:se.type,disabled:!0}),l.jsx(ct,{type:"string",title:"UUID",prop:"uuid",value:se.uuid,disabled:!0}),l.jsx(ct,{type:"boolean",title:"Visible",prop:"visible",value:se.visible,onChange:(u,c)=>{e.three.updateObject(se.uuid,u,c);const f=e.three.scene?.getObjectByProperty("uuid",se.uuid);f!==void 0&&J(f,u,c)}})]}),l.jsxs(l.Fragment,{children:[la(se,e.three),i?da(se,e.three):null,t.search("camera")>-1?ra(se,e.three):null,t.search("light")>-1?ua(se,e.three):null,o?ea(se,e.three):null]})]})},n)},"Inspector")}function ha(e){const[n,a]=E.useState(e.scene);E.useEffect(()=>{const o=u=>{a(u.value)};return I.addEventListener(N.SET_SCENE,o),()=>{I.removeEventListener(N.SET_SCENE,o)}},[]);const t=n!==null,i="Hierarchy - "+(t?`${n?.name}`:"No Scene");return l.jsxs("div",{id:"SidePanel",children:[l.jsx(wt,{label:i,open:!0,children:l.jsx(l.Fragment,{children:t&&l.jsx(dn,{child:n,three:e.three})})}),l.jsx(mn,{three:e.three})]},"SidePanel")}function fa(e){function n(){return e.three.scene===void 0?(console.log("No scene:",e.three),!1):!0}const a=c=>{if(!n())return;const f=e.three.scene?.getObjectByProperty("uuid",c.value);f!==void 0&&e.three.setObject(f)},t=(c,f,h)=>{if(!n())return;const m=e.three.scene?.getObjectByProperty("uuid",c);m!==void 0&&J(m,f,h)},i=c=>{if(!n())return;const f=c.value,{key:h,value:m,uuid:v}=f;t(v,h,m)},o=c=>{if(!n())return;const f=c.value;sn(f.value).then(h=>{t(f.uuid,f.key,h),t(f.uuid,"material.needsUpdate",!0)})},u=c=>{if(!n())return;const{key:f,uuid:h,value:m,subitem:v}=c.value,C=e.three.scene?.getObjectByProperty("uuid",h);if(C!==void 0)try{v!==void 0?An(C,v)[f](m):C[f](m)}catch(_){console.log("Error requesting method:"),console.log(_),console.log(f),console.log(m)}};return E.useEffect(()=>(I.addEventListener(N.GET_OBJECT,a),I.addEventListener(N.UPDATE_OBJECT,i),I.addEventListener(N.CREATE_TEXTURE,o),I.addEventListener(N.REQUEST_METHOD,u),()=>{I.removeEventListener(N.GET_OBJECT,a),I.removeEventListener(N.UPDATE_OBJECT,i),I.removeEventListener(N.CREATE_TEXTURE,o),I.removeEventListener(N.REQUEST_METHOD,u)}),[]),null}class ma extends d.Line{constructor(n,a){const t=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],i=new d.BufferGeometry;i.setAttribute("position",new d.Float32BufferAttribute(t,3)),i.computeBoundingSphere();const o=new d.LineBasicMaterial({fog:!1});super(i,o),this.light=n,this.color=a,this.type="RectAreaLightHelper";const u=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new d.BufferGeometry;c.setAttribute("position",new d.Float32BufferAttribute(u,3)),c.computeBoundingSphere(),this.add(new d.Mesh(c,new d.MeshBasicMaterial({side:d.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 qt={type:"change"},Pt={type:"start"},Kt={type:"end"},bt=new d.Ray,Xt=new d.Plane,pa=Math.cos(70*d.MathUtils.DEG2RAD);class ga extends d.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new d.Vector3,this.cursor=new d.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:d.MOUSE.ROTATE,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.PAN},this.touches={ONE:d.TOUCH.ROTATE,TWO:d.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 c.phi},this.getAzimuthalAngle=function(){return c.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(s){s.addEventListener("keydown",nt),this._domElementKeyEvents=s},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",nt),this._domElementKeyEvents=null},this.saveState=function(){t.target0.copy(t.target),t.position0.copy(t.object.position),t.zoom0=t.object.zoom},this.reset=function(){t.target.copy(t.target0),t.object.position.copy(t.position0),t.object.zoom=t.zoom0,t.object.updateProjectionMatrix(),t.dispatchEvent(qt),t.update(),o=i.NONE},this.update=function(){const s=new d.Vector3,x=new d.Quaternion().setFromUnitVectors(n.up,new d.Vector3(0,1,0)),A=x.clone().invert(),D=new d.Vector3,Z=new d.Quaternion,ge=new d.Vector3,ue=2*Math.PI;return function(pt=null){const gt=t.object.position;s.copy(gt).sub(t.target),s.applyQuaternion(x),c.setFromVector3(s),t.autoRotate&&o===i.NONE&&me(we(pt)),t.enableDamping?(c.theta+=f.theta*t.dampingFactor,c.phi+=f.phi*t.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let ve=t.minAzimuthAngle,be=t.maxAzimuthAngle;isFinite(ve)&&isFinite(be)&&(ve<-Math.PI?ve+=ue:ve>Math.PI&&(ve-=ue),be<-Math.PI?be+=ue:be>Math.PI&&(be-=ue),ve<=be?c.theta=Math.max(ve,Math.min(be,c.theta)):c.theta=c.theta>(ve+be)/2?Math.max(ve,c.theta):Math.min(be,c.theta)),c.phi=Math.max(t.minPolarAngle,Math.min(t.maxPolarAngle,c.phi)),c.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 ze=!1;if(t.zoomToCursor&&xe||t.object.isOrthographicCamera)c.radius=Te(c.radius);else{const Se=c.radius;c.radius=Te(c.radius*h),ze=Se!=c.radius}if(s.setFromSpherical(c),s.applyQuaternion(A),gt.copy(t.target).add(s),t.object.lookAt(t.target),t.enableDamping===!0?(f.theta*=1-t.dampingFactor,f.phi*=1-t.dampingFactor,m.multiplyScalar(1-t.dampingFactor)):(f.set(0,0,0),m.set(0,0,0)),t.zoomToCursor&&xe){let Se=null;if(t.object.isPerspectiveCamera){const Fe=s.length();Se=Te(Fe*h);const Ke=Fe-Se;t.object.position.addScaledVector(K,Ke),t.object.updateMatrixWorld(),ze=!!Ke}else if(t.object.isOrthographicCamera){const Fe=new d.Vector3(ee.x,ee.y,0);Fe.unproject(t.object);const Ke=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/h)),t.object.updateProjectionMatrix(),ze=Ke!==t.object.zoom;const vt=new d.Vector3(ee.x,ee.y,0);vt.unproject(t.object),t.object.position.sub(vt).add(Fe),t.object.updateMatrixWorld(),Se=s.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),t.zoomToCursor=!1;Se!==null&&(this.screenSpacePanning?t.target.set(0,0,-1).transformDirection(t.object.matrix).multiplyScalar(Se).add(t.object.position):(bt.origin.copy(t.object.position),bt.direction.set(0,0,-1).transformDirection(t.object.matrix),Math.abs(t.object.up.dot(bt.direction))<pa?n.lookAt(t.target):(Xt.setFromNormalAndCoplanarPoint(t.object.up,t.target),bt.intersectPlane(Xt,t.target))))}else if(t.object.isOrthographicCamera){const Se=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/h)),Se!==t.object.zoom&&(t.object.updateProjectionMatrix(),ze=!0)}return h=1,xe=!1,ze||D.distanceToSquared(t.object.position)>u||8*(1-Z.dot(t.object.quaternion))>u||ge.distanceToSquared(t.target)>u?(t.dispatchEvent(qt),D.copy(t.object.position),Z.copy(t.object.quaternion),ge.copy(t.target),!0):!1}}(),this.dispose=function(){t.domElement.removeEventListener("contextmenu",qe),t.domElement.removeEventListener("pointerdown",T),t.domElement.removeEventListener("pointercancel",W),t.domElement.removeEventListener("wheel",dt),t.domElement.removeEventListener("pointermove",V),t.domElement.removeEventListener("pointerup",W),t.domElement.getRootNode().removeEventListener("keydown",tt,{capture:!0}),t._domElementKeyEvents!==null&&(t._domElementKeyEvents.removeEventListener("keydown",nt),t._domElementKeyEvents=null)};const t=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=i.NONE;const u=1e-6,c=new d.Spherical,f=new d.Spherical;let h=1;const m=new d.Vector3,v=new d.Vector2,C=new d.Vector2,_=new d.Vector2,G=new d.Vector2,Q=new d.Vector2,he=new d.Vector2,ie=new d.Vector2,H=new d.Vector2,L=new d.Vector2,K=new d.Vector3,ee=new d.Vector2;let xe=!1;const z=[],fe={};let ce=!1;function we(s){return s!==null?2*Math.PI/60*t.autoRotateSpeed*s:2*Math.PI/60/60*t.autoRotateSpeed}function Me(s){const x=Math.abs(s*.01);return Math.pow(.95,t.zoomSpeed*x)}function me(s){f.theta-=s}function F(s){f.phi-=s}const pe=function(){const s=new d.Vector3;return function(A,D){s.setFromMatrixColumn(D,0),s.multiplyScalar(-A),m.add(s)}}(),w=function(){const s=new d.Vector3;return function(A,D){t.screenSpacePanning===!0?s.setFromMatrixColumn(D,1):(s.setFromMatrixColumn(D,0),s.crossVectors(t.object.up,s)),s.multiplyScalar(A),m.add(s)}}(),Ee=function(){const s=new d.Vector3;return function(A,D){const Z=t.domElement;if(t.object.isPerspectiveCamera){const ge=t.object.position;s.copy(ge).sub(t.target);let ue=s.length();ue*=Math.tan(t.object.fov/2*Math.PI/180),pe(2*A*ue/Z.clientHeight,t.object.matrix),w(2*D*ue/Z.clientHeight,t.object.matrix)}else t.object.isOrthographicCamera?(pe(A*(t.object.right-t.object.left)/t.object.zoom/Z.clientWidth,t.object.matrix),w(D*(t.object.top-t.object.bottom)/t.object.zoom/Z.clientHeight,t.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),t.enablePan=!1)}}();function Oe(s){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h/=s:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function _e(s){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h*=s:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function Re(s,x){if(!t.zoomToCursor)return;xe=!0;const A=t.domElement.getBoundingClientRect(),D=s-A.left,Z=x-A.top,ge=A.width,ue=A.height;ee.x=D/ge*2-1,ee.y=-(Z/ue)*2+1,K.set(ee.x,ee.y,1).unproject(t.object).sub(t.object.position).normalize()}function Te(s){return Math.max(t.minDistance,Math.min(t.maxDistance,s))}function Ae(s){v.set(s.clientX,s.clientY)}function De(s){Re(s.clientX,s.clientX),ie.set(s.clientX,s.clientY)}function Ie(s){G.set(s.clientX,s.clientY)}function te(s){C.set(s.clientX,s.clientY),_.subVectors(C,v).multiplyScalar(t.rotateSpeed);const x=t.domElement;me(2*Math.PI*_.x/x.clientHeight),F(2*Math.PI*_.y/x.clientHeight),v.copy(C),t.update()}function Ce(s){H.set(s.clientX,s.clientY),L.subVectors(H,ie),L.y>0?Oe(Me(L.y)):L.y<0&&_e(Me(L.y)),ie.copy(H),t.update()}function $e(s){Q.set(s.clientX,s.clientY),he.subVectors(Q,G).multiplyScalar(t.panSpeed),Ee(he.x,he.y),G.copy(Q),t.update()}function He(s){Re(s.clientX,s.clientY),s.deltaY<0?_e(Me(s.deltaY)):s.deltaY>0&&Oe(Me(s.deltaY)),t.update()}function le(s){let x=!1;switch(s.code){case t.keys.UP:s.ctrlKey||s.metaKey||s.shiftKey?F(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(0,t.keyPanSpeed),x=!0;break;case t.keys.BOTTOM:s.ctrlKey||s.metaKey||s.shiftKey?F(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(0,-t.keyPanSpeed),x=!0;break;case t.keys.LEFT:s.ctrlKey||s.metaKey||s.shiftKey?me(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(t.keyPanSpeed,0),x=!0;break;case t.keys.RIGHT:s.ctrlKey||s.metaKey||s.shiftKey?me(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(-t.keyPanSpeed,0),x=!0;break}x&&(s.preventDefault(),t.update())}function g(s){if(z.length===1)v.set(s.pageX,s.pageY);else{const x=Le(s),A=.5*(s.pageX+x.x),D=.5*(s.pageY+x.y);v.set(A,D)}}function b(s){if(z.length===1)G.set(s.pageX,s.pageY);else{const x=Le(s),A=.5*(s.pageX+x.x),D=.5*(s.pageY+x.y);G.set(A,D)}}function M(s){const x=Le(s),A=s.pageX-x.x,D=s.pageY-x.y,Z=Math.sqrt(A*A+D*D);ie.set(0,Z)}function j(s){t.enableZoom&&M(s),t.enablePan&&b(s)}function ne(s){t.enableZoom&&M(s),t.enableRotate&&g(s)}function R(s){if(z.length==1)C.set(s.pageX,s.pageY);else{const A=Le(s),D=.5*(s.pageX+A.x),Z=.5*(s.pageY+A.y);C.set(D,Z)}_.subVectors(C,v).multiplyScalar(t.rotateSpeed);const x=t.domElement;me(2*Math.PI*_.x/x.clientHeight),F(2*Math.PI*_.y/x.clientHeight),v.copy(C)}function O(s){if(z.length===1)Q.set(s.pageX,s.pageY);else{const x=Le(s),A=.5*(s.pageX+x.x),D=.5*(s.pageY+x.y);Q.set(A,D)}he.subVectors(Q,G).multiplyScalar(t.panSpeed),Ee(he.x,he.y),G.copy(Q)}function B(s){const x=Le(s),A=s.pageX-x.x,D=s.pageY-x.y,Z=Math.sqrt(A*A+D*D);H.set(0,Z),L.set(0,Math.pow(H.y/ie.y,t.zoomSpeed)),Oe(L.y),ie.copy(H);const ge=(s.pageX+x.x)*.5,ue=(s.pageY+x.y)*.5;Re(ge,ue)}function ae(s){t.enableZoom&&B(s),t.enablePan&&O(s)}function re(s){t.enableZoom&&B(s),t.enableRotate&&R(s)}function T(s){t.enabled!==!1&&(z.length===0&&(t.domElement.setPointerCapture(s.pointerId),t.domElement.addEventListener("pointermove",V),t.domElement.addEventListener("pointerup",W)),!Tt(s)&&(Ot(s),s.pointerType==="touch"?at(s):Pe(s)))}function V(s){t.enabled!==!1&&(s.pointerType==="touch"?ft(s):We(s))}function W(s){switch(Rt(s),z.length){case 0:t.domElement.releasePointerCapture(s.pointerId),t.domElement.removeEventListener("pointermove",V),t.domElement.removeEventListener("pointerup",W),t.dispatchEvent(Kt),o=i.NONE;break;case 1:const x=z[0],A=fe[x];at({pointerId:x,pageX:A.x,pageY:A.y});break}}function Pe(s){let x;switch(s.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 d.MOUSE.DOLLY:if(t.enableZoom===!1)return;De(s),o=i.DOLLY;break;case d.MOUSE.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(t.enablePan===!1)return;Ie(s),o=i.PAN}else{if(t.enableRotate===!1)return;Ae(s),o=i.ROTATE}break;case d.MOUSE.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(t.enableRotate===!1)return;Ae(s),o=i.ROTATE}else{if(t.enablePan===!1)return;Ie(s),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&t.dispatchEvent(Pt)}function We(s){switch(o){case i.ROTATE:if(t.enableRotate===!1)return;te(s);break;case i.DOLLY:if(t.enableZoom===!1)return;Ce(s);break;case i.PAN:if(t.enablePan===!1)return;$e(s);break}}function dt(s){t.enabled===!1||t.enableZoom===!1||o!==i.NONE||(s.preventDefault(),t.dispatchEvent(Pt),He(ht(s)),t.dispatchEvent(Kt))}function ht(s){const x=s.deltaMode,A={clientX:s.clientX,clientY:s.clientY,deltaY:s.deltaY};switch(x){case 1:A.deltaY*=16;break;case 2:A.deltaY*=100;break}return s.ctrlKey&&!ce&&(A.deltaY*=10),A}function tt(s){s.key==="Control"&&(ce=!0,t.domElement.getRootNode().addEventListener("keyup",Ne,{passive:!0,capture:!0}))}function Ne(s){s.key==="Control"&&(ce=!1,t.domElement.getRootNode().removeEventListener("keyup",Ne,{passive:!0,capture:!0}))}function nt(s){t.enabled===!1||t.enablePan===!1||le(s)}function at(s){switch(mt(s),z.length){case 1:switch(t.touches.ONE){case d.TOUCH.ROTATE:if(t.enableRotate===!1)return;g(s),o=i.TOUCH_ROTATE;break;case d.TOUCH.PAN:if(t.enablePan===!1)return;b(s),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(t.touches.TWO){case d.TOUCH.DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;j(s),o=i.TOUCH_DOLLY_PAN;break;case d.TOUCH.DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;ne(s),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&t.dispatchEvent(Pt)}function ft(s){switch(mt(s),o){case i.TOUCH_ROTATE:if(t.enableRotate===!1)return;R(s),t.update();break;case i.TOUCH_PAN:if(t.enablePan===!1)return;O(s),t.update();break;case i.TOUCH_DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;ae(s),t.update();break;case i.TOUCH_DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;re(s),t.update();break;default:o=i.NONE}}function qe(s){t.enabled!==!1&&s.preventDefault()}function Ot(s){z.push(s.pointerId)}function Rt(s){delete fe[s.pointerId];for(let x=0;x<z.length;x++)if(z[x]==s.pointerId){z.splice(x,1);return}}function Tt(s){for(let x=0;x<z.length;x++)if(z[x]==s.pointerId)return!0;return!1}function mt(s){let x=fe[s.pointerId];x===void 0&&(x=new d.Vector2,fe[s.pointerId]=x),x.set(s.pageX,s.pageY)}function Le(s){const x=s.pointerId===z[0]?z[1]:z[0];return fe[x]}t.domElement.addEventListener("contextmenu",qe),t.domElement.addEventListener("pointerdown",T),t.domElement.addEventListener("pointercancel",W),t.domElement.addEventListener("wheel",dt,{passive:!1}),t.domElement.getRootNode().addEventListener("keydown",tt,{passive:!0,capture:!0}),this.update()}}const Et=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))})]})},Ye=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(Et,{index:o,open:t,options:n.options,onSelect:n.onSelect,onToggle:u=>{i(u)},up:!0})]})});class va extends d.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:d.GLSL3,side:d.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 d.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(Jt.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]=x.useState(!1),[t,i]=x.useState(e.options),o=h=>{e.onDragComplete(h),i(h)},u=h=>{const m=[...t];m.splice(h,1),o(m)},c=[];t.forEach((h,m)=>{c.push(l.jsx(on,{index:m,title:h,onDelete:u},h))});let f="dropdown draggable";return e.subdropdown&&(f+=" subdropdown"),l.jsxs("div",{className:f,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Lt,{title:e.title}),l.jsx(Jt.Reorder.Group,{axis:"y",values:t,onReorder:o,style:{visibility:n?"visible":"hidden"},children:c})]})}function ln(e){const[n,a]=x.useState(!1),t=[];e.options.map((o,u)=>{e.onSelect!==void 0&&(o.onSelect=e.onSelect),t.push(l.jsx(un,{option:o},u))});let i="dropdown";return e.subdropdown&&(i+=" subdropdown"),l.jsxs("div",{className:i,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Lt,{title:e.title}),l.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:t})]})}function un(e){const{option:n}=e,[a,t]=x.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},Qt())}function Fn(e,n,a){function t(o){switch(n.forEach(u=>{u.callback(e,u.remote,o)}),o.event){case"custom":N.dispatchEvent({type:L.CUSTOM,value:o.data});break}}function i(o){switch(a.forEach(u=>{u.callback(e,u.remote,o)}),o.event){case"custom":N.dispatchEvent({type:L.CUSTOM,value:o.data});break}}e.listen=o=>{o.target==="editor"?i(o):t(o)}}function St(e){const[n,a]=x.useState(e.open!==void 0?e.open:!0),t=!n||e.children===void 0;return l.jsxs("div",{className:`accordion ${t?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const i=!n;e.onToggle!==void 0&&e.onToggle(i),a(i)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:ct(e.label)})]}),e.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:e.children})})]})}function Ft(e){const[n,a]=x.useState(!1),t=e.child!==void 0&&e.child.children.length>0,i=[];return e.child!==void 0&&e.child.children.length>0&&e.child.children.map(o=>{i.push(l.jsx(Ft,{child:o,three:e.three},Math.random()))}),l.jsx(l.Fragment,{children:e.child!==void 0&&l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[t?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,l.jsx("button",{className:"name",style:{left:t?"20px":"5px"},onClick:()=>{e.child!==void 0&&(e.three.getObject(e.child.uuid),n||a(!0))},children:e.child.name.length>0?`${e.child.name} (${e.child.type})`:`${e.child.type}::${e.child.uuid}`}),l.jsx("div",{className:`icon ${Tn(e.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:i})})]},Math.random())})}function dn(e){const n=[];return e.child?.children.map(a=>{n.push(l.jsx(Ft,{child:a,three:e.three},Math.random()))}),l.jsx("div",{className:`scene ${e.class!==void 0?e.class:""}`,children:n})}const Bn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function Un(e){return"items"in e}function We(e){const n=[];return e.items.forEach(a=>{Un(a)?n.push(l.jsx(We,{title:ct(a.title),items:a.items},Math.random())):n.push(l.jsx(ot,{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)}},Math.random()))}),l.jsx(St,{label:e.title,open:e.expanded===!0,children:n})}function Vn(e){return!(e==="alphaHash"||e==="alphaToCoverage"||e==="attenuationDistance"||e==="blendAlpha"||e==="blendColor"||e==="blendDstAlpha"||e==="colorWrite"||e==="combine"||e==="defaultAttributeValues"||e==="depthFunc"||e==="forceSinglePass"||e==="glslVersion"||e==="linecap"||e==="linejoin"||e==="linewidth"||e==="normalMapType"||e==="precision"||e==="premultipliedAlpha"||e==="shadowSide"||e==="toneMapped"||e==="uniformsGroups"||e==="uniformsNeedUpdate"||e==="userData"||e==="vertexColors"||e==="version"||e==="wireframeLinecap"||e==="wireframeLinejoin"||e==="wireframeLinewidth"||e.slice(0,4)==="clip"||e.slice(0,7)==="polygon"||e.slice(0,7)==="stencil"||e.slice(0,2)==="is")}function $n(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 wt(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 Hn(){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 zn=[{title:"Front",value:d.FrontSide},{title:"Back",value:d.BackSide},{title:"Double",value:d.DoubleSide}],Gn=[{title:"No Blending",value:d.NoBlending},{title:"Normal",value:d.NormalBlending},{title:"Additive",value:d.AdditiveBlending},{title:"Subtractive",value:d.SubtractiveBlending},{title:"Multiply",value:d.MultiplyBlending},{title:"Custom",value:d.CustomBlending}],Yn=[{title:"Add",value:d.AddEquation},{title:"Subtract",value:d.SubtractEquation},{title:"Reverse Subtract",value:d.ReverseSubtractEquation},{title:"Min",value:d.MinEquation},{title:"Max",value:d.MaxEquation}],Wn=[{title:"Zero",valye:d.ZeroFactor},{title:"One",valye:d.OneFactor},{title:"Src Color",valye:d.SrcColorFactor},{title:"One Minus Src Color",valye:d.OneMinusSrcColorFactor},{title:"Src Alpha",valye:d.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:d.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:d.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:d.OneMinusDstAlphaFactor},{title:"Dst Color",valye:d.DstColorFactor},{title:"One Minus Dst Color",valye:d.OneMinusDstColorFactor},{title:"Src Alpha Saturate",valye:d.SrcAlphaSaturateFactor},{title:"Constant Color",valye:d.ConstantColorFactor},{title:"One Minus Constant Color",valye:d.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:d.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:d.OneMinusConstantAlphaFactor}],qn=[{title:"Zero",valye:d.ZeroFactor},{title:"One",valye:d.OneFactor},{title:"Src Color",valye:d.SrcColorFactor},{title:"One Minus Src Color",valye:d.OneMinusSrcColorFactor},{title:"Src Alpha",valye:d.SrcAlphaFactor},{title:"One Minus Src Alpha",valye:d.OneMinusSrcAlphaFactor},{title:"Dst Alpha",valye:d.DstAlphaFactor},{title:"One Minus Dst Alpha",valye:d.OneMinusDstAlphaFactor},{title:"Dst Color",valye:d.DstColorFactor},{title:"One Minus Dst Color",valye:d.OneMinusDstColorFactor},{title:"Constant Color",valye:d.ConstantColorFactor},{title:"One Minus Constant Color",valye:d.OneMinusConstantColorFactor},{title:"Constant Alpha",valye:d.ConstantAlphaFactor},{title:"One Minus Constant Alpha",valye:d.OneMinusConstantAlphaFactor}];function rt(e,n){e.needsUpdate=!0,e.type="option",e.options=n}function Kn(e,n,a,t){return{type:"boolean",title:wt(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 u=t.scene?.getObjectByProperty("uuid",a.uuid);u!==void 0&&J(u,`material.${e}`,o)}}}function Xn(e,n,a,t){const i={type:"number",title:wt(e),prop:e,value:n,min:void 0,max:void 0,step:.01,needsUpdate:!0,onChange:(o,u)=>{t.updateObject(a.uuid,`material.${e}`,u),t.updateObject(a.uuid,"material.needsUpdate",!0);const c=t.scene?.getObjectByProperty("uuid",a.uuid);c!==void 0&&J(c,`material.${e}`,u)}};switch(e){case"blending":rt(i,Gn);break;case"blendDst":rt(i,qn);break;case"blendEquation":rt(i,Yn);break;case"blendSrc":rt(i,Wn);break;case"side":rt(i,zn);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 Zn(e,n,a,t){const i={type:"string",title:wt(e),prop:e,value:n,needsUpdate:!0,onChange:(u,c)=>{t.updateObject(a.uuid,`material.${e}`,c),t.updateObject(a.uuid,"material.needsUpdate",!0);const f=t.scene?.getObjectByProperty("uuid",a.uuid);f!==void 0&&J(f,`material.${e}`,c)}};return(e==="vertexShader"||e==="fragmentShader")&&(i.disabled=!1,i.latest=i.value,i.onChange=(u,c)=>{i.latest=c}),i}function Jn(e){return e.x!==void 0&&e.y!==void 0&&e.z===void 0}function Qn(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w===void 0}function ea(e){return e.x!==void 0&&e.y!==void 0&&e.z!==void 0&&e.w!==void 0}function Dt(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 u=wt(e).split(".")[0].replaceAll("[","").replaceAll("]",""),c=i.length>0?`${i}.${e}`:e,f=typeof n;if(f==="boolean"||f==="string")return{title:u,prop:c,type:f,value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const p=t.scene?.getObjectByProperty("uuid",a.uuid);p!==void 0&&J(p,`material.${c}`,m)}};if(f==="number"){const h={title:u,prop:c,type:"number",value:n,step:.01,disabled:o,onChange:(m,p)=>{t.updateObject(a.uuid,`material.${c}`,p);const C=t.scene?.getObjectByProperty("uuid",a.uuid);C!==void 0&&J(C,`material.${c}`,p)}};return hn(u)&&(h.type="range",h.min=0,h.max=1),h}else{if(n.isColor)return{title:u,prop:c,type:"color",value:n,disabled:o,onChange:(h,m)=>{const p=new d.Color(m);t.updateObject(a.uuid,`material.${c}`,p);const C=t.scene?.getObjectByProperty("uuid",a.uuid);C!==void 0&&J(C,`material.${c}`,p)}};if(Array.isArray(n)){const h=[];for(const m in n){const p=n[m],C=`[${m.toString()}]`;if(p.value!==void 0){const R=st(`${C}.value`,p.value,a,t,c,o);R!==void 0&&h.push(R)}else{const R=st(C,p,a,t,c,o);R!==void 0&&h.push(R)}}if(h.length>0)return Dt(h),{title:u,items:h}}else{if(Jn(n))return{title:u,prop:c,type:"vector2",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const p=t.scene?.getObjectByProperty("uuid",a.uuid);p!==void 0&&J(p,`material.${c}`,m)}};if(Qn(n))return{title:u,prop:c,type:"grid3",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const p=t.scene?.getObjectByProperty("uuid",a.uuid);p!==void 0&&J(p,`material.${c}`,m)}};if(ea(n))return{title:u,prop:c,type:"grid4",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const p=t.scene?.getObjectByProperty("uuid",a.uuid);p!==void 0&&J(p,`material.${c}`,m)}};if(n.isEuler)return{title:u,prop:c,type:"euler",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const p=t.scene?.getObjectByProperty("uuid",a.uuid);p!==void 0&&J(p,`material.${c}`,m)}};if(n.src!==void 0)return{title:u,type:"image",value:n,disabled:o,onChange:(h,m)=>{const p=$n(e),C=i.length>0?`${i}.${p}`:p;t.createTexture(a.uuid,`material.${C}`,m);const R=t.scene?.getObjectByProperty("uuid",a.uuid);R!==void 0&&sn(m).then(Y=>{J(R,`material.${C}`,Y),J(R,"material.needsUpdate",!0)})}};if(n.elements!==void 0)return{title:u,prop:c,type:n.elements.length>9?"grid4":"grid3",value:n,disabled:o,onChange:(h,m)=>{t.updateObject(a.uuid,`material.${c}`,m);const p=t.scene?.getObjectByProperty("uuid",a.uuid);p!==void 0&&J(p,`material.${c}`,m)}};{const h=[],m=e==="defines"||e==="extensions";try{for(const p in n){const C=n[p];if(C!==void 0)if(C.value!==void 0){const R=st(`${p}.value`,C.value,a,t,c,m);R!==void 0&&h.push(R)}else{const R=st(p,C,a,t,c,m);R!==void 0&&h.push(R)}}}catch{console.log("Issue cycling through material object:",e,n)}if(h.length>0)return Dt(h),{title:u,items:h}}}}}function zt(e,n,a){const t=[];for(const i in e){if(!Vn(i))continue;const o=typeof e[i],u=e[i];if(o==="boolean")t.push(Kn(i,u,n,a));else if(o==="number")t.push(Xn(i,u,n,a));else if(o==="string")t.push(Zn(i,u,n,a));else if(o==="object"){const c=st(i,u,n,a);c!==void 0&&t.push(c)}else u!==void 0&&console.log("other:",i,o,u)}return Dt(t),t.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),t}function ta(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(We,{title:`Material ${o}`,items:zt(a[o],e,n)},`Material ${o}`));return l.jsx(l.Fragment,{children:t})}else return l.jsx(We,{title:"Material",items:zt(a,e,n)})}function na(e){const[n,a]=x.useState(e.defaultValue);return x.useEffect(()=>{let t=!1,i=-1,o=0,u=e.defaultValue;const c=C=>{t=!0,o=Number(e.input.current?.value),i=C.clientX,document.addEventListener("mouseup",h,!1),document.addEventListener("mousemove",f,!1),document.addEventListener("contextmenu",h,!1)},f=C=>{if(!t)return;const R=e.step!==void 0?e.step:1,Y=(C.clientX-i)*R;u=Number((o+Y).toFixed(4)),e.min!==void 0&&(u=Math.max(u,e.min)),e.max!==void 0&&(u=Math.min(u,e.max)),e.onChange!==void 0&&e.onChange(u),a(u)},h=()=>{t=!1,document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",f),document.removeEventListener("contextmenu",h)},m=C=>{const R=Number(C.target.value);a(R)},p=C=>{const R=Number(C.target.value);e.onChange!==void 0&&e.onChange(R),a(R)};return e.input.current?.addEventListener("input",m),e.label.current?.addEventListener("mousedown",c,!1),e.sliderRef!==void 0&&e.sliderRef.current?.addEventListener("input",p),()=>{e.input.current?.removeEventListener("input",m),e.label.current?.removeEventListener("mousedown",c),e.sliderRef!==void 0&&e.sliderRef.current?.removeEventListener("input",p),document.removeEventListener("mouseup",h),document.removeEventListener("mousemove",f),document.removeEventListener("contextmenu",h)}},[]),n}function Ye(e){const n=x.useRef(null),a=x.useRef(null),t=na({label:e.labelRef,input:n,sliderRef:a,defaultValue:e.value,min:e.min,max:e.max,step:e.step,onChange:i=>{e.onChange!==void 0&&e.onChange(e.prop,i)}});return 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:Et})]})]})}function aa(e){const n=x.useRef(null),a=x.useRef(null),t=x.useRef(null),i=x.useRef(null),o=x.useRef(null),u=x.useRef(null),[c,f]=x.useState(e.value),[h,m]=x.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,C]=x.useState(!1);function R(){p||(window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Y),window.addEventListener("mouseup",Y),C(!0))}function Y(){window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Y),C(!1)}function ee(F){const X=o.current.getBoundingClientRect(),te=Ve(0,99,F.clientX-X.left)/99,xe=Ve(0,99,F.clientY-X.top)/99,z=Pt(kt(h.min,h.max,te),3),he=Pt(kt(h.min,h.max,xe),3);e.onChange({target:{value:{x:z,y:he}}}),f({x:z,y:he})}function de(F){let X=c.x,te=c.y;F.target===n.current?X=Number(F.target.value):te=Number(F.target.value),f({x:X,y:te})}function ae(){const F=Number(t.current.value);m({min:F,max:h.max}),(c.x<F||c.y<F)&&f({x:Ve(F,h.max,c.x),y:Ve(F,h.max,c.y)})}function H(){const F=Number(i.current.value);m({min:h.min,max:F}),(c.x>F||c.y>F)&&f({x:Ve(h.min,F,c.x),y:Ve(h.min,F,c.y)})}return x.useEffect(()=>{const F=At(h.min,h.max,c.x),X=At(h.min,h.max,c.y);u.current.style.left=`${F*100}%`,u.current.style.top=`${X*100}%`},[h,c]),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:c.x,min:h.min,max:h.max,step:.01,onChange:de})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Y:"}),l.jsx("input",{ref:a,type:"number",value:c.y,min:h.min,max:h.max,step:.01,onChange:de})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Min:"}),l.jsx("input",{ref:t,type:"number",value:h.min,step:.01,onChange:ae})]}),l.jsxs("div",{children:[l.jsx("label",{children:"Max:"}),l.jsx("input",{ref:i,type:"number",value:h.max,step:.01,onChange:H})]})]}),l.jsxs("div",{className:"input",ref:o,onMouseDown:R,onMouseUp:Y,children:[l.jsx("div",{className:"x"}),l.jsx("div",{className:"y"}),l.jsx("div",{className:"pt",ref:u})]})]})}function Gt(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=x.useMemo(()=>e.value,[]),u=(f,h)=>{o[f]=h,e.onChange({target:{value:o}})};["x","y","z"].forEach(f=>{const h=x.useRef(null);i.push(l.jsxs("div",{children:[l.jsx("label",{ref:h,children:f.toUpperCase()}),l.jsx(Ye,{value:o[f],type:"number",prop:f,step:.01,labelRef:h,onChange:u})]},f))})}else if(a){const o=x.useMemo(()=>e.value,[]),u=(f,h)=>{o[f]=h,e.onChange({target:{value:o}})};["_x","_y","_z"].forEach(f=>{const h=x.useRef(null);i.push(l.jsxs("div",{children:[l.jsx("label",{ref:h,children:f.substring(1).toUpperCase()}),l.jsx(Ye,{value:o[f],type:"number",prop:f,step:.01,labelRef:h,onChange:u})]},f))})}else if(t){const o=x.useMemo(()=>e.value,[]),u=(c,f)=>{const h=Number(c);o.elements[h]=f,e.onChange({target:{value:o}})};for(let c=0;c<9;c++){const f=x.useRef(null);i.push(l.jsxs("div",{children:[l.jsx("label",{ref:f,children:c+1}),l.jsx(Ye,{value:o.elements[c],type:"number",prop:c.toString(),step:.01,labelRef:f,onChange:u})]},c.toString()))}}return l.jsx("div",{className:"grid3",children:i},Math.random().toString())}function ia(e){const n=e.value.x!==void 0,a=[];if(n){const t=x.useMemo(()=>e.value,[]),i=(u,c)=>{t[u]=c,e.onChange({target:{value:t}})};["x","y","z","w"].forEach(u=>{const c=x.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:c,children:u.toUpperCase()}),l.jsx(Ye,{value:t.x,type:"number",prop:u,step:.01,labelRef:c,onChange:i})]},u))})}else{const t=x.useMemo(()=>e.value,[]),i=(o,u)=>{const c=Number(o);t.elements[c]=u,e.onChange({target:{value:t}})};for(let o=0;o<16;o++){const u=x.useRef(null);a.push(l.jsxs("div",{children:[l.jsx("label",{ref:u,children:o+1}),l.jsx(Ye,{value:t.elements[o],type:"number",prop:o.toString(),step:.01,labelRef:u,onChange:i})]},o.toString()))}}return l.jsx("div",{className:"grid4",children:a})}function ot(e){let n=e.value;n!==void 0&&n.isColor!==void 0&&(n=tn(e.value));const[a,t]=x.useState(n),i=x.useRef(null),o=x.useRef(null),u=m=>{let p=m.target.value;e.type==="boolean"?p=m.target.checked:e.type==="option"&&(p=e.options[p].value),t(p),e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,p)},c={};e.disabled&&(c.opacity=.8);const f=e.type==="string"&&(a.length>100||a.search(`
30
+ `)>-1),h=f||e.type==="image"||e.type==="vector2";return l.jsxs("div",{className:`field ${h?"block":""}`,style:c,children:[e.type!=="button"&&l.jsx("label",{ref:i,children:ct(e.title)},"fieldLabel"),e.type==="string"&&!f&&l.jsx("input",{type:"text",disabled:e.disabled,onChange:u,value:a}),e.type==="string"&&f&&l.jsx("textarea",{cols:50,rows:10,disabled:e.disabled!==void 0?e.disabled:!0,onChange:u,value:a}),e.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:e.disabled,onChange:u,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:u,disabled:e.disabled,className:"color"}),l.jsx("input",{type:"color",value:a,onChange:u,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("img",{ref:o,onClick:()=>{Hn().then(m=>{o.current.src=m,e.onChange!==void 0&&e.onChange(e.prop!==void 0?e.prop:e.title,m)})},src:a.length>0?a:Bn}),e.type==="option"&&l.jsx(l.Fragment,{children:l.jsx("select",{onChange:u,disabled:e.disabled,defaultValue:e.value,children:e.options?.map((m,p)=>l.jsx("option",{value:m.value,children:ct(m.title)},p))})}),e.type==="vector2"&&l.jsx(aa,{value:a,min:0,max:1,onChange:u}),e.type==="grid3"&&l.jsx(Gt,{value:a,onChange:u}),e.type==="grid4"&&l.jsx(ia,{value:a,onChange:u}),e.type==="euler"&&l.jsx(Gt,{value:a,onChange:u})]})}function Yt(e){switch(e){case"fov":return"FOV";case"zoom":return"Zoom";case"near":return"Near";case"far":return"Far";case"focus":return"Focus";case"aspect":return"Aspect";case"filmGauge":return"Film Gauge";case"filmOffset":return"Film Offset";case"left":return"Left";case"right":return"Right";case"top":return"Top";case"bottom":return"Bottom"}return e}function ra(e,n){const a=[];if(e.perspectiveCameraInfo!==void 0)for(const t in e.perspectiveCameraInfo)a.push({title:Yt(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 u=n.scene?.getObjectByProperty("uuid",e.uuid);u!==void 0&&(J(u,i,o),u.updateProjectionMatrix())}});else if(e.orthographicCameraInfo!==void 0)for(const t in e.orthographicCameraInfo)a.push({title:Yt(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 u=n.scene?.getObjectByProperty("uuid",e.uuid);u!==void 0&&(J(u,i,o),u.updateProjectionMatrix())}});return l.jsx(We,{title:"Camera",items:a})}function sa(e,n){const a=new d.Matrix4;a.elements=e.matrix;const t=new d.Vector3,i=new d.Euler,o=new d.Vector3;e.uuid.length>0&&(t.setFromMatrixPosition(a),i.setFromRotationMatrix(a),o.setFromMatrixScale(a));const u=(c,f)=>{const h=c==="rotation"?{x:f._x,y:f._y,z:f._z}:f;n.updateObject(e.uuid,c,h);const m=n.scene?.getObjectByProperty("uuid",e.uuid);m!==void 0&&J(m,c,h)};return l.jsx(We,{title:"Transform",items:[{title:"Position",prop:"position",type:"grid3",value:t,onChange:u},{title:"Rotation",prop:"rotation",type:"grid3",value:i,onChange:u},{title:"Scale",prop:"scale",type:"grid3",value:o,onChange:u}]})}function Wt(e){switch(e){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color";case"width":return"Width";case"height":return"Height"}return e}function oa(e,n){const a=[];if(e.lightInfo!==void 0)for(const t in e.lightInfo){const i=e.lightInfo[t];i!==void 0&&(i.isColor!==void 0?a.push({title:Wt(t),prop:t,type:"color",value:i,onChange:(o,u)=>{const c=new d.Color(u);n.updateObject(e.uuid,o,c);const f=n.scene?.getObjectByProperty("uuid",e.uuid);f!==void 0&&J(f,o,c)}}):a.push({title:Wt(t),prop:t,type:typeof i,value:i,step:typeof i=="number"?.01:void 0,onChange:(o,u)=>{n.updateObject(e.uuid,o,u);const c=n.scene?.getObjectByProperty("uuid",e.uuid);c!==void 0&&J(c,o,u)}}))}return l.jsx(We,{title:"Light",items:a})}function ca(e,n){const a=[],t=[];let i=0;e.animations.forEach(c=>{i=Math.max(i,c.duration),c.duration>0&&t.push({title:c.name,items:[{title:"Duration",type:"number",value:c.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.scene?.getObjectByProperty("uuid",e.uuid);let u=!1;if(o!==void 0){const c=o.mixer;if(u=c!==void 0,u){const f=[{title:"Time Scale",type:"range",value:c.timeScale,step:.01,min:-1,max:2,onChange:(h,m)=>{c.timeScale=m,n.updateObject(e.uuid,"mixer.timeScale",m)}}];f.push({title:"Stop All",type:"button",onChange:()=>{c.stopAllAction(),n.requestMethod(e.uuid,"stopAllAction",void 0,"mixer")}}),a.push({title:"Mixer",items:f})}}return l.jsx(We,{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};let re={...fn};function mn(e){const[n,a]=x.useState(-1);x.useEffect(()=>{function u(f){re={...f.value},a(Date.now())}function c(){re={...fn},a(Date.now())}return N.addEventListener(L.SET_SCENE,c),N.addEventListener(L.SET_OBJECT,u),()=>{N.removeEventListener(L.SET_SCENE,c),N.removeEventListener(L.SET_OBJECT,u)}},[]);const t=re.type.toLowerCase(),i=re.animations.length>0||re.mixer!==void 0,o=t.search("mesh")>-1||t.search("line")>-1||t.search("points")>-1;return l.jsx(St,{label:"Inspector",children:l.jsx("div",{id:"Inspector",className:e.class,children:re.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(ot,{type:"string",title:"Name",prop:"name",value:re.name,disabled:!0}),l.jsx(ot,{type:"string",title:"Type",prop:"type",value:re.type,disabled:!0}),l.jsx(ot,{type:"string",title:"UUID",prop:"uuid",value:re.uuid,disabled:!0}),l.jsx(ot,{type:"boolean",title:"Visible",prop:"visible",value:re.visible,onChange:(u,c)=>{e.three.updateObject(re.uuid,u,c);const f=e.three.scene?.getObjectByProperty("uuid",re.uuid);f!==void 0&&J(f,u,c)}})]}),l.jsxs(l.Fragment,{children:[sa(re,e.three),i?ca(re,e.three):null,t.search("camera")>-1?ra(re,e.three):null,t.search("light")>-1?oa(re,e.three):null,o?ta(re,e.three):null]})]})},n)},"Inspector")}function la(e){const[n,a]=x.useState(e.scene);x.useEffect(()=>{const o=u=>{a(u.value)};return N.addEventListener(L.SET_SCENE,o),()=>{N.removeEventListener(L.SET_SCENE,o)}},[]);const t=n!==null,i="Hierarchy - "+(t?`${n?.name}`:"No Scene");return l.jsxs("div",{id:"SidePanel",children:[l.jsx(St,{label:i,open:!0,children:l.jsx(l.Fragment,{children:t&&l.jsx(dn,{child:n,three:e.three})})}),l.jsx(mn,{three:e.three})]},"SidePanel")}function ua(e){function n(){return e.three.scene===void 0?(console.log("No scene:",e.three),!1):!0}const a=c=>{if(!n())return;const f=e.three.scene?.getObjectByProperty("uuid",c.value);f!==void 0&&e.three.setObject(f)},t=(c,f,h)=>{if(!n())return;const m=e.three.scene?.getObjectByProperty("uuid",c);m!==void 0&&J(m,f,h)},i=c=>{if(!n())return;const f=c.value,{key:h,value:m,uuid:p}=f;t(p,h,m)},o=c=>{if(!n())return;const f=c.value;sn(f.value).then(h=>{t(f.uuid,f.key,h),t(f.uuid,"material.needsUpdate",!0)})},u=c=>{if(!n())return;const{key:f,uuid:h,value:m,subitem:p}=c.value,C=e.three.scene?.getObjectByProperty("uuid",h);if(C!==void 0)try{p!==void 0?An(C,p)[f](m):C[f](m)}catch(R){console.log("Error requesting method:"),console.log(R),console.log(f),console.log(m)}};return x.useEffect(()=>(N.addEventListener(L.GET_OBJECT,a),N.addEventListener(L.UPDATE_OBJECT,i),N.addEventListener(L.CREATE_TEXTURE,o),N.addEventListener(L.REQUEST_METHOD,u),()=>{N.removeEventListener(L.GET_OBJECT,a),N.removeEventListener(L.UPDATE_OBJECT,i),N.removeEventListener(L.CREATE_TEXTURE,o),N.removeEventListener(L.REQUEST_METHOD,u)}),[]),null}class da extends d.Line{constructor(n,a){const t=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],i=new d.BufferGeometry;i.setAttribute("position",new d.Float32BufferAttribute(t,3)),i.computeBoundingSphere();const o=new d.LineBasicMaterial({fog:!1});super(i,o),this.light=n,this.color=a,this.type="RectAreaLightHelper";const u=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new d.BufferGeometry;c.setAttribute("position",new d.Float32BufferAttribute(u,3)),c.computeBoundingSphere(),this.add(new d.Mesh(c,new d.MeshBasicMaterial({side:d.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 qt={type:"change"},_t={type:"start"},Kt={type:"end"},vt=new d.Ray,Xt=new d.Plane,ha=Math.cos(70*d.MathUtils.DEG2RAD);class fa extends d.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new d.Vector3,this.cursor=new d.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:d.MOUSE.ROTATE,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.PAN},this.touches={ONE:d.TOUCH.ROTATE,TWO:d.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 c.phi},this.getAzimuthalAngle=function(){return c.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(s){s.addEventListener("keydown",tt),this._domElementKeyEvents=s},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(qt),t.update(),o=i.NONE},this.update=function(){const s=new d.Vector3,E=new d.Quaternion().setFromUnitVectors(n.up,new d.Vector3(0,1,0)),A=E.clone().invert(),I=new d.Vector3,Q=new d.Quaternion,ge=new d.Vector3,le=2*Math.PI;return function(mt=null){const pt=t.object.position;s.copy(pt).sub(t.target),s.applyQuaternion(E),c.setFromVector3(s),t.autoRotate&&o===i.NONE&&me(we(mt)),t.enableDamping?(c.theta+=f.theta*t.dampingFactor,c.phi+=f.phi*t.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let ve=t.minAzimuthAngle,be=t.maxAzimuthAngle;isFinite(ve)&&isFinite(be)&&(ve<-Math.PI?ve+=le:ve>Math.PI&&(ve-=le),be<-Math.PI?be+=le:be>Math.PI&&(be-=le),ve<=be?c.theta=Math.max(ve,Math.min(be,c.theta)):c.theta=c.theta>(ve+be)/2?Math.max(ve,c.theta):Math.min(be,c.theta)),c.phi=Math.max(t.minPolarAngle,Math.min(t.maxPolarAngle,c.phi)),c.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 ze=!1;if(t.zoomToCursor&&xe||t.object.isOrthographicCamera)c.radius=Re(c.radius);else{const Se=c.radius;c.radius=Re(c.radius*h),ze=Se!=c.radius}if(s.setFromSpherical(c),s.applyQuaternion(A),pt.copy(t.target).add(s),t.object.lookAt(t.target),t.enableDamping===!0?(f.theta*=1-t.dampingFactor,f.phi*=1-t.dampingFactor,m.multiplyScalar(1-t.dampingFactor)):(f.set(0,0,0),m.set(0,0,0)),t.zoomToCursor&&xe){let Se=null;if(t.object.isPerspectiveCamera){const Fe=s.length();Se=Re(Fe*h);const Xe=Fe-Se;t.object.position.addScaledVector(X,Xe),t.object.updateMatrixWorld(),ze=!!Xe}else if(t.object.isOrthographicCamera){const Fe=new d.Vector3(te.x,te.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/h)),t.object.updateProjectionMatrix(),ze=Xe!==t.object.zoom;const gt=new d.Vector3(te.x,te.y,0);gt.unproject(t.object),t.object.position.sub(gt).add(Fe),t.object.updateMatrixWorld(),Se=s.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),t.zoomToCursor=!1;Se!==null&&(this.screenSpacePanning?t.target.set(0,0,-1).transformDirection(t.object.matrix).multiplyScalar(Se).add(t.object.position):(vt.origin.copy(t.object.position),vt.direction.set(0,0,-1).transformDirection(t.object.matrix),Math.abs(t.object.up.dot(vt.direction))<ha?n.lookAt(t.target):(Xt.setFromNormalAndCoplanarPoint(t.object.up,t.target),vt.intersectPlane(Xt,t.target))))}else if(t.object.isOrthographicCamera){const Se=t.object.zoom;t.object.zoom=Math.max(t.minZoom,Math.min(t.maxZoom,t.object.zoom/h)),Se!==t.object.zoom&&(t.object.updateProjectionMatrix(),ze=!0)}return h=1,xe=!1,ze||I.distanceToSquared(t.object.position)>u||8*(1-Q.dot(t.object.quaternion))>u||ge.distanceToSquared(t.target)>u?(t.dispatchEvent(qt),I.copy(t.object.position),Q.copy(t.object.quaternion),ge.copy(t.target),!0):!1}}(),this.dispose=function(){t.domElement.removeEventListener("contextmenu",Ke),t.domElement.removeEventListener("pointerdown",T),t.domElement.removeEventListener("pointercancel",q),t.domElement.removeEventListener("wheel",ut),t.domElement.removeEventListener("pointermove",V),t.domElement.removeEventListener("pointerup",q),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 u=1e-6,c=new d.Spherical,f=new d.Spherical;let h=1;const m=new d.Vector3,p=new d.Vector2,C=new d.Vector2,R=new d.Vector2,Y=new d.Vector2,ee=new d.Vector2,de=new d.Vector2,ae=new d.Vector2,H=new d.Vector2,F=new d.Vector2,X=new d.Vector3,te=new d.Vector2;let xe=!1;const z=[],he={};let oe=!1;function we(s){return s!==null?2*Math.PI/60*t.autoRotateSpeed*s:2*Math.PI/60/60*t.autoRotateSpeed}function Me(s){const E=Math.abs(s*.01);return Math.pow(.95,t.zoomSpeed*E)}function me(s){f.theta-=s}function B(s){f.phi-=s}const pe=function(){const s=new d.Vector3;return function(A,I){s.setFromMatrixColumn(I,0),s.multiplyScalar(-A),m.add(s)}}(),M=function(){const s=new d.Vector3;return function(A,I){t.screenSpacePanning===!0?s.setFromMatrixColumn(I,1):(s.setFromMatrixColumn(I,0),s.crossVectors(t.object.up,s)),s.multiplyScalar(A),m.add(s)}}(),Ee=function(){const s=new d.Vector3;return function(A,I){const Q=t.domElement;if(t.object.isPerspectiveCamera){const ge=t.object.position;s.copy(ge).sub(t.target);let le=s.length();le*=Math.tan(t.object.fov/2*Math.PI/180),pe(2*A*le/Q.clientHeight,t.object.matrix),M(2*I*le/Q.clientHeight,t.object.matrix)}else t.object.isOrthographicCamera?(pe(A*(t.object.right-t.object.left)/t.object.zoom/Q.clientWidth,t.object.matrix),M(I*(t.object.top-t.object.bottom)/t.object.zoom/Q.clientHeight,t.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),t.enablePan=!1)}}();function Oe(s){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h/=s:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function _e(s){t.object.isPerspectiveCamera||t.object.isOrthographicCamera?h*=s:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),t.enableZoom=!1)}function Te(s,E){if(!t.zoomToCursor)return;xe=!0;const A=t.domElement.getBoundingClientRect(),I=s-A.left,Q=E-A.top,ge=A.width,le=A.height;te.x=I/ge*2-1,te.y=-(Q/le)*2+1,X.set(te.x,te.y,1).unproject(t.object).sub(t.object.position).normalize()}function Re(s){return Math.max(t.minDistance,Math.min(t.maxDistance,s))}function Ae(s){p.set(s.clientX,s.clientY)}function De(s){Te(s.clientX,s.clientX),ae.set(s.clientX,s.clientY)}function Ie(s){Y.set(s.clientX,s.clientY)}function ne(s){C.set(s.clientX,s.clientY),R.subVectors(C,p).multiplyScalar(t.rotateSpeed);const E=t.domElement;me(2*Math.PI*R.x/E.clientHeight),B(2*Math.PI*R.y/E.clientHeight),p.copy(C),t.update()}function Ce(s){H.set(s.clientX,s.clientY),F.subVectors(H,ae),F.y>0?Oe(Me(F.y)):F.y<0&&_e(Me(F.y)),ae.copy(H),t.update()}function $e(s){ee.set(s.clientX,s.clientY),de.subVectors(ee,Y).multiplyScalar(t.panSpeed),Ee(de.x,de.y),Y.copy(ee),t.update()}function He(s){Te(s.clientX,s.clientY),s.deltaY<0?_e(Me(s.deltaY)):s.deltaY>0&&Oe(Me(s.deltaY)),t.update()}function ce(s){let E=!1;switch(s.code){case t.keys.UP:s.ctrlKey||s.metaKey||s.shiftKey?B(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(0,t.keyPanSpeed),E=!0;break;case t.keys.BOTTOM:s.ctrlKey||s.metaKey||s.shiftKey?B(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(0,-t.keyPanSpeed),E=!0;break;case t.keys.LEFT:s.ctrlKey||s.metaKey||s.shiftKey?me(2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(t.keyPanSpeed,0),E=!0;break;case t.keys.RIGHT:s.ctrlKey||s.metaKey||s.shiftKey?me(-2*Math.PI*t.rotateSpeed/t.domElement.clientHeight):Ee(-t.keyPanSpeed,0),E=!0;break}E&&(s.preventDefault(),t.update())}function v(s){if(z.length===1)p.set(s.pageX,s.pageY);else{const E=Le(s),A=.5*(s.pageX+E.x),I=.5*(s.pageY+E.y);p.set(A,I)}}function b(s){if(z.length===1)Y.set(s.pageX,s.pageY);else{const E=Le(s),A=.5*(s.pageX+E.x),I=.5*(s.pageY+E.y);Y.set(A,I)}}function O(s){const E=Le(s),A=s.pageX-E.x,I=s.pageY-E.y,Q=Math.sqrt(A*A+I*I);ae.set(0,Q)}function j(s){t.enableZoom&&O(s),t.enablePan&&b(s)}function fe(s){t.enableZoom&&O(s),t.enableRotate&&v(s)}function _(s){if(z.length==1)C.set(s.pageX,s.pageY);else{const A=Le(s),I=.5*(s.pageX+A.x),Q=.5*(s.pageY+A.y);C.set(I,Q)}R.subVectors(C,p).multiplyScalar(t.rotateSpeed);const E=t.domElement;me(2*Math.PI*R.x/E.clientHeight),B(2*Math.PI*R.y/E.clientHeight),p.copy(C)}function S(s){if(z.length===1)ee.set(s.pageX,s.pageY);else{const E=Le(s),A=.5*(s.pageX+E.x),I=.5*(s.pageY+E.y);ee.set(A,I)}de.subVectors(ee,Y).multiplyScalar(t.panSpeed),Ee(de.x,de.y),Y.copy(ee)}function P(s){const E=Le(s),A=s.pageX-E.x,I=s.pageY-E.y,Q=Math.sqrt(A*A+I*I);H.set(0,Q),F.set(0,Math.pow(H.y/ae.y,t.zoomSpeed)),Oe(F.y),ae.copy(H);const ge=(s.pageX+E.x)*.5,le=(s.pageY+E.y)*.5;Te(ge,le)}function W(s){t.enableZoom&&P(s),t.enablePan&&S(s)}function ie(s){t.enableZoom&&P(s),t.enableRotate&&_(s)}function T(s){t.enabled!==!1&&(z.length===0&&(t.domElement.setPointerCapture(s.pointerId),t.domElement.addEventListener("pointermove",V),t.domElement.addEventListener("pointerup",q)),!Tt(s)&&(Mt(s),s.pointerType==="touch"?nt(s):ke(s)))}function V(s){t.enabled!==!1&&(s.pointerType==="touch"?ht(s):qe(s))}function q(s){switch(Ot(s),z.length){case 0:t.domElement.releasePointerCapture(s.pointerId),t.domElement.removeEventListener("pointermove",V),t.domElement.removeEventListener("pointerup",q),t.dispatchEvent(Kt),o=i.NONE;break;case 1:const E=z[0],A=he[E];nt({pointerId:E,pageX:A.x,pageY:A.y});break}}function ke(s){let E;switch(s.button){case 0:E=t.mouseButtons.LEFT;break;case 1:E=t.mouseButtons.MIDDLE;break;case 2:E=t.mouseButtons.RIGHT;break;default:E=-1}switch(E){case d.MOUSE.DOLLY:if(t.enableZoom===!1)return;De(s),o=i.DOLLY;break;case d.MOUSE.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(t.enablePan===!1)return;Ie(s),o=i.PAN}else{if(t.enableRotate===!1)return;Ae(s),o=i.ROTATE}break;case d.MOUSE.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(t.enableRotate===!1)return;Ae(s),o=i.ROTATE}else{if(t.enablePan===!1)return;Ie(s),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&t.dispatchEvent(_t)}function qe(s){switch(o){case i.ROTATE:if(t.enableRotate===!1)return;ne(s);break;case i.DOLLY:if(t.enableZoom===!1)return;Ce(s);break;case i.PAN:if(t.enablePan===!1)return;$e(s);break}}function ut(s){t.enabled===!1||t.enableZoom===!1||o!==i.NONE||(s.preventDefault(),t.dispatchEvent(_t),He(dt(s)),t.dispatchEvent(Kt))}function dt(s){const E=s.deltaMode,A={clientX:s.clientX,clientY:s.clientY,deltaY:s.deltaY};switch(E){case 1:A.deltaY*=16;break;case 2:A.deltaY*=100;break}return s.ctrlKey&&!oe&&(A.deltaY*=10),A}function et(s){s.key==="Control"&&(oe=!0,t.domElement.getRootNode().addEventListener("keyup",Ne,{passive:!0,capture:!0}))}function Ne(s){s.key==="Control"&&(oe=!1,t.domElement.getRootNode().removeEventListener("keyup",Ne,{passive:!0,capture:!0}))}function tt(s){t.enabled===!1||t.enablePan===!1||ce(s)}function nt(s){switch(ft(s),z.length){case 1:switch(t.touches.ONE){case d.TOUCH.ROTATE:if(t.enableRotate===!1)return;v(s),o=i.TOUCH_ROTATE;break;case d.TOUCH.PAN:if(t.enablePan===!1)return;b(s),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(t.touches.TWO){case d.TOUCH.DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;j(s),o=i.TOUCH_DOLLY_PAN;break;case d.TOUCH.DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;fe(s),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&t.dispatchEvent(_t)}function ht(s){switch(ft(s),o){case i.TOUCH_ROTATE:if(t.enableRotate===!1)return;_(s),t.update();break;case i.TOUCH_PAN:if(t.enablePan===!1)return;S(s),t.update();break;case i.TOUCH_DOLLY_PAN:if(t.enableZoom===!1&&t.enablePan===!1)return;W(s),t.update();break;case i.TOUCH_DOLLY_ROTATE:if(t.enableZoom===!1&&t.enableRotate===!1)return;ie(s),t.update();break;default:o=i.NONE}}function Ke(s){t.enabled!==!1&&s.preventDefault()}function Mt(s){z.push(s.pointerId)}function Ot(s){delete he[s.pointerId];for(let E=0;E<z.length;E++)if(z[E]==s.pointerId){z.splice(E,1);return}}function Tt(s){for(let E=0;E<z.length;E++)if(z[E]==s.pointerId)return!0;return!1}function ft(s){let E=he[s.pointerId];E===void 0&&(E=new d.Vector2,he[s.pointerId]=E),E.set(s.pageX,s.pageY)}function Le(s){const E=s.pointerId===z[0]?z[1]:z[0];return he[E]}t.domElement.addEventListener("contextmenu",Ke),t.domElement.addEventListener("pointerdown",T),t.domElement.addEventListener("pointercancel",q),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]=x.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))})]})},Ge=x.forwardRef(function(n,a){const[t,i]=x.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:u=>{i(u)},up:!0})]})});class ma extends d.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:d.GLSL3,side:d.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 d.Color(16777215)},uDistance:{value:n?.distance!==void 0?n?.distance:1e4},uSubgridOpacity:{value:n?.subgridOpacity!==void 0?n?.subgridOpacity:.15},uGridOpacity:{value:n?.gridOpacity!==void 0?n?.gridOpacity:.25}},vertexShader:`out vec3 worldPosition;
31
31
  uniform float uDistance;
32
32
 
33
33
  void main() {
@@ -103,7 +103,7 @@ C11,8.22,10.74,8,10.43,8z`})});function on(e){return l.jsx(Jt.Reorder.Item,{valu
103
103
  fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
104
104
 
105
105
  if (fragColor.a <= 0.0) discard;
106
- }`,name:"InfiniteGrid",depthWrite:!1})}}class ba extends d.Mesh{gridMaterial;constructor(){const n=new va;super(new d.PlaneGeometry(2,2),n),this.gridMaterial=n,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const ya=`#include <common>
106
+ }`,name:"InfiniteGrid",depthWrite:!1})}}class pa extends d.Mesh{gridMaterial;constructor(){const n=new ma;super(new d.PlaneGeometry(2,2),n),this.gridMaterial=n,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const ga=`#include <common>
107
107
  #include <batching_pars_vertex>
108
108
  #include <uv_pars_vertex>
109
109
  #include <color_pars_vertex>
@@ -133,7 +133,7 @@ void main() {
133
133
  #include <logdepthbuf_vertex>
134
134
  #include <clipping_planes_vertex>
135
135
  #include <worldpos_vertex>
136
- }`,xa=`
136
+ }`,va=`
137
137
  #include <common>
138
138
  #include <uv_pars_fragment>
139
139
  #include <clipping_planes_pars_fragment>
@@ -141,4 +141,4 @@ void main() {
141
141
  void main() {
142
142
  #include <clipping_planes_fragment>
143
143
  gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
144
- }`;class Ea extends d.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:ya,fragmentShader:xa})}}let yt="Renderer",je,xt=!1,Zt=!1,Y=null,oe=null,Be=null,Ue=null;function Ca(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",u=localStorage.getItem(`${n}_brCam`)!==null?localStorage.getItem(`${n}_brCam`):"Top",c=E.useMemo(()=>new Map,[]),f=E.useMemo(()=>new Map,[]),h=E.useMemo(()=>new Map,[]),m=E.useMemo(()=>new Map,[]),v=E.useMemo(()=>new d.Scene,[]),C=E.useMemo(()=>new d.Group,[]),_=E.useMemo(()=>new ba,[]),G=E.useMemo(()=>new d.AxesHelper(500),[]),Q=E.useMemo(()=>new d.AxesHelper(100),[]),he=E.useMemo(()=>new d.MeshDepthMaterial,[]),ie=E.useMemo(()=>new d.MeshNormalMaterial,[]),H=E.useMemo(()=>new Ea,[]),L=E.useMemo(()=>new d.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),[]);function K(g,b){const M=new d.OrthographicCamera(-100,100,100,-100,50,3e3);return M.name=g,M.position.copy(b),M.lookAt(0,0,0),c.set(g,M),M}const ee=["Renderer","Depth","Normals","UVs","Wireframe"],xe=["Single","Side by Side","Stacked","Quad"],z=E.useRef(null),fe=E.useRef(null),ce=E.useRef(null),we=E.useRef(null),Me=E.useRef(null),me=E.useRef(null),[F,pe]=E.useState(a!==null?a:"Single"),[w,Ee]=E.useState(null),[Oe,_e]=E.useState(!1),[Re,Te]=E.useState(!1),[Ae,De]=E.useState(!1),[,Ie]=E.useState(Date.now());localStorage.setItem(`${n}_mode`,F),localStorage.setItem(`${n}_tlCam`,t),localStorage.setItem(`${n}_trCam`,i),localStorage.setItem(`${n}_blCam`,o),localStorage.setItem(`${n}_brCam`,u);const te=(g,b)=>{const M=f.get(g.name);M!==void 0&&M.dispose(),f.delete(g.name);const j=h.get(g.name);j!==void 0&&(v.remove(j),j.dispose()),h.delete(g.name);const ne=new ga(g,b);switch(ne.enableDamping=!0,ne.dampingFactor=.05,g.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":ne.enableRotate=!1;break}if(f.set(g.name,ne),g instanceof d.PerspectiveCamera){const R=new d.CameraHelper(g);h.set(g.name,R),v.add(R)}},Ce=g=>{const b=h.get(g.name);b!==void 0&&(v.remove(b),b.dispose(),h.delete(g.name));const M=f.get(g.name);M!==void 0&&(M.dispose(),f.delete(g.name))},$e=()=>{f.forEach((g,b)=>{g.dispose();const M=h.get(b);M!==void 0&&(v.remove(M),M.dispose()),h.delete(b),f.delete(b)}),f.clear(),h.clear()},He=()=>{switch(F){case"Single":te(Y,ce.current);break;case"Side by Side":case"Stacked":te(Y,ce.current),te(oe,we.current);break;case"Quad":te(Y,ce.current),te(oe,we.current),te(Be,Me.current),te(Ue,me.current);break}};E.useEffect(()=>{const g=new d.WebGLRenderer({canvas:z.current,stencil:!1});g.autoClear=!1,g.shadowMap.enabled=!0,g.setPixelRatio(devicePixelRatio),g.setClearColor(0),e.three.renderer=g,Ee(g)},[]),E.useEffect(()=>{v.name="Debug Scene",v.uuid="",C.name="helpers",v.add(C),C.add(_),G.name="axisHelper",C.add(G),Q.name="interactionHelper",C.add(Q),Q.visible=!1,K("Top",new d.Vector3(0,1e3,0)),K("Bottom",new d.Vector3(0,-1e3,0)),K("Left",new d.Vector3(-1e3,0,0)),K("Right",new d.Vector3(1e3,0,0)),K("Front",new d.Vector3(0,0,1e3)),K("Back",new d.Vector3(0,0,-1e3)),K("Orthographic",new d.Vector3(1e3,1e3,1e3));const g=new d.PerspectiveCamera(60,1,50,3e3);g.name="Debug",g.position.set(500,500,500),g.lookAt(0,0,0),c.set("Debug",g),Y=c.get(localStorage.getItem(`${n}_tlCam`)),oe=c.get(localStorage.getItem(`${n}_trCam`)),Be=c.get(localStorage.getItem(`${n}_blCam`)),Ue=c.get(localStorage.getItem(`${n}_brCam`))},[]),E.useEffect(()=>{const g=()=>{m.forEach(R=>{C.remove(R),R.dispose()}),m.clear()},b=()=>{je.traverse(R=>{if(R.type.search("Light")>-1){let O;switch(R.type){case"DirectionalLight":O=new d.DirectionalLightHelper(R),O.name=`${R.name}Helper`,m.set(R.name,O),C.add(O);break;case"HemisphereLight":O=new d.HemisphereLightHelper(R,250),O.name=`${R.name}Helper`,m.set(R.name,O),C.add(O);break;case"RectAreaLight":O=new ma(R),O.name=`${R.name}Helper`,m.set(R.name,O),C.add(O);break;case"PointLight":O=new d.PointLightHelper(R),O.name=`${R.name}Helper`,m.set(R.name,O),C.add(O);break;case"SpotLight":O=new d.SpotLightHelper(R),O.name=`${R.name}Helper`,m.set(R.name,O),C.add(O);break}}})},M=R=>{g(),Nt(je),v.remove(je);const O=e.scenes.get(R.value.name);if(O!==void 0){const B=new O;e.onSceneSet!==void 0&&e.onSceneSet(B),je=B,e.three.scene=je,v.add(je),Zt=!0,b()}},j=R=>{const O=R.value,B=e.three.scene?.getObjectByProperty("uuid",O.uuid);B!==void 0&&c.set(O.name,B),Ie(Date.now())},ne=R=>{c.delete(R.value.name),Ie(Date.now())};return I.addEventListener(N.SET_SCENE,M),I.addEventListener(N.ADD_CAMERA,j),I.addEventListener(N.REMOVE_CAMERA,ne),()=>{I.removeEventListener(N.SET_SCENE,M),I.removeEventListener(N.ADD_CAMERA,j),I.removeEventListener(N.REMOVE_CAMERA,ne)}},[]),E.useEffect(()=>{if(w===null)return;let g=window.innerWidth,b=window.innerHeight,M=Math.floor(g/2),j=Math.floor(b/2),ne=-1;const R=()=>{g=window.innerWidth-300,b=window.innerHeight,M=Math.floor(g/2),j=Math.floor(b/2),w.setSize(g,b);let T=g,V=b;switch(F){case"Side by Side":T=M,V=b;break;case"Stacked":T=g,V=j;break;case"Quad":T=M,V=j;break}c.forEach(W=>{W instanceof d.OrthographicCamera?(W.left=T/-2,W.right=T/2,W.top=V/2,W.bottom=V/-2,W.updateProjectionMatrix()):W instanceof d.PerspectiveCamera&&(W.aspect=T/V,W.updateProjectionMatrix(),h.get(W.name)?.update())})},O=()=>{w.setViewport(0,0,g,b),w.setScissor(0,0,g,b),w.render(v,Y)},B=()=>{if(F==="Side by Side")w.setViewport(0,0,M,b),w.setScissor(0,0,M,b),w.render(v,Y),w.setViewport(M,0,M,b),w.setScissor(M,0,M,b),w.render(v,oe);else{const T=b-j;w.setViewport(0,T,g,j),w.setScissor(0,T,g,j),w.render(v,Y),w.setViewport(0,0,g,j),w.setScissor(0,0,g,j),w.render(v,oe)}},ae=()=>{let T=0,V=0;V=b-j,T=0,w.setViewport(T,V,M,j),w.setScissor(T,V,M,j),w.render(v,Y),T=M,w.setViewport(T,V,M,j),w.setScissor(T,V,M,j),w.render(v,oe),V=0,T=0,w.setViewport(T,V,M,j),w.setScissor(T,V,M,j),w.render(v,Be),T=M,w.setViewport(T,V,M,j),w.setScissor(T,V,M,j),w.render(v,Ue)},re=()=>{switch(f.forEach(T=>{T.update()}),h.forEach(T=>{T.update()}),m.forEach(T=>{T.update!==void 0&&T.update()}),e.onSceneUpdate!==void 0&&Zt&&e.onSceneUpdate(je),w.clear(),F){case"Single":O();break;case"Side by Side":case"Stacked":B();break;case"Quad":ae();break}ne=requestAnimationFrame(re)};return He(),window.addEventListener("resize",R),R(),re(),()=>{window.removeEventListener("resize",R),cancelAnimationFrame(ne),ne=-1}},[F,w]),E.useEffect(()=>{if(w!==null){const g=new d.Raycaster,b=new d.Vector2,M=(O,B,ae,re)=>{switch(F){case"Quad":O<ae?B<re?g.setFromCamera(b,Y):g.setFromCamera(b,Be):B<re?g.setFromCamera(b,oe):g.setFromCamera(b,Ue);break;case"Side by Side":O<ae?g.setFromCamera(b,Y):g.setFromCamera(b,oe);break;case"Single":g.setFromCamera(b,Y);break;case"Stacked":B<re?g.setFromCamera(b,Y):g.setFromCamera(b,oe);break}},j=O=>{if(!xt)return;const B=new d.Vector2;w.getSize(B);const ae=Math.min(O.clientX,B.x),re=Math.min(O.clientY,B.y);b.x=Je(ae,0,B.x,-1,1),b.y=Je(re,0,B.y,1,-1);const T=B.x/2,V=B.y/2,W=()=>{ae<T?b.x=Je(ae,0,T,-1,1):b.x=Je(ae,T,B.x,-1,1)},Pe=()=>{re<V?b.y=Je(re,0,V,1,-1):b.y=Je(re,V,B.y,1,-1)};switch(F){case"Quad":W(),Pe();break;case"Side by Side":W();break;case"Stacked":Pe(),Pe();break}M(ae,re,T,V);const We=g.intersectObjects(je.children);We.length>0&&Q.position.copy(We[0].point)},ne=O=>{if(!xt)return;const B=new d.Vector2;if(w.getSize(B),O.clientX>=B.x)return;j(O);const ae=g.intersectObjects(je.children);ae.length>0&&e.three.getObject(ae[0].object.uuid)},R=fe.current;return R.addEventListener("mousemove",j,!1),R.addEventListener("click",ne,!1),()=>{R.removeEventListener("mousemove",j),R.removeEventListener("click",ne)}}},[F,w]);const le=[];return c.forEach((g,b)=>{le.push(b)}),l.jsxs("div",{className:"multiview",children:[l.jsx("canvas",{ref:z}),w!==null&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`cameras ${F==="Single"||F==="Stacked"?"single":""}`,ref:fe,children:[F==="Single"&&l.jsx(l.Fragment,{children:l.jsx(Ye,{camera:Y,options:le,ref:ce,onSelect:g=>{f.get(Y.name)?.dispose();const b=c.get(g);b!==void 0&&(Ce(Y),Y=b,localStorage.setItem(`${n}_tlCam`,b.name),te(b,ce.current))}})}),(F==="Side by Side"||F==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(Ye,{camera:Y,options:le,ref:ce,onSelect:g=>{f.get(Y.name)?.dispose();const b=c.get(g);b!==void 0&&(Ce(Y),Y=b,localStorage.setItem(`${n}_tlCam`,b.name),te(b,ce.current))}}),l.jsx(Ye,{camera:oe,options:le,ref:we,onSelect:g=>{f.get(oe.name)?.dispose();const b=c.get(g);b!==void 0&&(Ce(oe),oe=b,localStorage.setItem(`${n}_trCam`,b.name),te(b,we.current))}})]}),F==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(Ye,{camera:Y,options:le,ref:ce,onSelect:g=>{f.get(Y.name)?.dispose();const b=c.get(g);b!==void 0&&(Ce(Y),Y=b,localStorage.setItem(`${n}_tlCam`,b.name),te(b,ce.current))}}),l.jsx(Ye,{camera:oe,options:le,ref:we,onSelect:g=>{f.get(oe.name)?.dispose();const b=c.get(g);b!==void 0&&(Ce(oe),oe=b,localStorage.setItem(`${n}_trCam`,b.name),te(b,we.current))}}),l.jsx(Ye,{camera:Be,options:le,ref:Me,onSelect:g=>{f.get(Be.name)?.dispose();const b=c.get(g);b!==void 0&&(Ce(Be),Be=b,localStorage.setItem(`${n}_blCam`,b.name),te(b,Me.current))}}),l.jsx(Ye,{camera:Ue,options:le,ref:me,onSelect:g=>{f.get(Ue.name)?.dispose();const b=c.get(g);b!==void 0&&(Ce(Ue),Ue=b,localStorage.setItem(`${n}_brCam`,b.name),te(b,me.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(Et,{index:xe.indexOf(F),options:xe,onSelect:g=>{g!==F&&($e(),pe(g))},open:Oe,onToggle:g=>{_e(g),Re&&Te(!1),Ae&&De(!1)}}),l.jsx(Et,{index:ee.indexOf(yt),options:ee,onSelect:g=>{if(g!==yt)switch(yt=g,yt){case"Depth":v.overrideMaterial=he;break;case"Normals":v.overrideMaterial=ie;break;default:case"Renderer":v.overrideMaterial=null;break;case"Wireframe":v.overrideMaterial=L;break;case"UVs":v.overrideMaterial=H;break}},open:Re,onToggle:g=>{Oe&&_e(!1),Te(g),Ae&&De(!1)}}),l.jsx(Et,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:g=>{xt=g==="Selection Mode",Q.visible=xt},open:Ae,onToggle:g=>{Oe&&_e(!1),Re&&Te(!1),De(g)}})]})]})]})}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=wt;exports.Application=wn;exports.BaseRemote=ut;exports.ChildObject=Ft;exports.ContainerObject=dn;exports.Draggable=cn;exports.DraggableItem=on;exports.Dropdown=ln;exports.DropdownItem=un;exports.Editor=Sa;exports.Inspector=mn;exports.MultiView=Ca;exports.NavButton=Lt;exports.RemoteComponents=Mn;exports.RemoteController=Ln;exports.RemoteTheatre=St;exports.RemoteThree=Pn;exports.RemoteTweakpane=kn;exports.SceneInspector=fa;exports.SidePanel=ha;exports.ToolEvents=N;exports.capitalize=lt;exports.clamp=Ve;exports.colorToHex=tn;exports.debugDispatcher=I;exports.defaultTheatreCallback=En;exports.dispose=Nt;exports.disposeMaterial=an;exports.disposeTexture=Sn;exports.distance=Cn;exports.hierarchyUUID=It;exports.isColor=en;exports.mix=jt;exports.noop=Ct;exports.normalize=kt;exports.randomID=Qt;exports.resetThreeObjects=nn;exports.round=Qe;exports.theatreEditorApp=On;
144
+ }`;class ba extends d.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:ga,fragmentShader:va})}}let bt="Renderer",je,yt=!1,Zt=!1,G=null,se=null,Be=null,Ue=null;function ya(e){const n=e.three.app.appID,a=localStorage.getItem(`${n}_mode`),t=localStorage.getItem(`${n}_tlCam`)!==null?localStorage.getItem(`${n}_tlCam`):"Debug",i=localStorage.getItem(`${n}_trCam`)!==null?localStorage.getItem(`${n}_trCam`):"Orthographic",o=localStorage.getItem(`${n}_blCam`)!==null?localStorage.getItem(`${n}_blCam`):"Front",u=localStorage.getItem(`${n}_brCam`)!==null?localStorage.getItem(`${n}_brCam`):"Top",c=x.useMemo(()=>new Map,[]),f=x.useMemo(()=>new Map,[]),h=x.useMemo(()=>new Map,[]),m=x.useMemo(()=>new Map,[]),p=x.useMemo(()=>new d.Scene,[]),C=x.useMemo(()=>new d.Group,[]),R=x.useMemo(()=>new pa,[]),Y=x.useMemo(()=>new d.AxesHelper(500),[]),ee=x.useMemo(()=>new d.AxesHelper(100),[]),de=x.useMemo(()=>new d.MeshDepthMaterial,[]),ae=x.useMemo(()=>new d.MeshNormalMaterial,[]),H=x.useMemo(()=>new ba,[]),F=x.useMemo(()=>new d.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),[]);function X(v,b){const O=new d.OrthographicCamera(-100,100,100,-100,50,3e3);return O.name=v,O.position.copy(b),O.lookAt(0,0,0),c.set(v,O),O}const te=["Renderer","Depth","Normals","UVs","Wireframe"],xe=["Single","Side by Side","Stacked","Quad"],z=x.useRef(null),he=x.useRef(null),oe=x.useRef(null),we=x.useRef(null),Me=x.useRef(null),me=x.useRef(null),[B,pe]=x.useState(a!==null?a:"Single"),[M,Ee]=x.useState(null),[Oe,_e]=x.useState(!1),[Te,Re]=x.useState(!1),[Ae,De]=x.useState(!1),[,Ie]=x.useState(Date.now());localStorage.setItem(`${n}_mode`,B),localStorage.setItem(`${n}_tlCam`,t),localStorage.setItem(`${n}_trCam`,i),localStorage.setItem(`${n}_blCam`,o),localStorage.setItem(`${n}_brCam`,u);const ne=(v,b)=>{const O=f.get(v.name);O!==void 0&&O.dispose(),f.delete(v.name);const j=new fa(v,b);switch(j.enableDamping=!0,j.dampingFactor=.05,v.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":j.enableRotate=!1;break}f.set(v.name,j)},Ce=v=>{const b=h.get(v.name);b!==void 0&&(p.remove(b),b.dispose(),h.delete(v.name));const O=f.get(v.name);O!==void 0&&(O.dispose(),f.delete(v.name))},$e=()=>{f.forEach((v,b)=>{v.dispose();const O=h.get(b);O!==void 0&&(p.remove(O),O.dispose()),h.delete(b),f.delete(b)}),f.clear(),h.clear()},He=()=>{switch(B){case"Single":ne(G,oe.current);break;case"Side by Side":case"Stacked":ne(G,oe.current),ne(se,we.current);break;case"Quad":ne(G,oe.current),ne(se,we.current),ne(Be,Me.current),ne(Ue,me.current);break}};x.useEffect(()=>{const v=new d.WebGLRenderer({canvas:z.current,stencil:!1});v.autoClear=!1,v.shadowMap.enabled=!0,v.setPixelRatio(devicePixelRatio),v.setClearColor(0),e.three.renderer=v,Ee(v)},[]),x.useEffect(()=>{p.name="Debug Scene",p.uuid="",C.name="helpers",p.add(C),C.add(R),Y.name="axisHelper",C.add(Y),ee.name="interactionHelper",C.add(ee),ee.visible=!1,X("Top",new d.Vector3(0,1e3,0)),X("Bottom",new d.Vector3(0,-1e3,0)),X("Left",new d.Vector3(-1e3,0,0)),X("Right",new d.Vector3(1e3,0,0)),X("Front",new d.Vector3(0,0,1e3)),X("Back",new d.Vector3(0,0,-1e3)),X("Orthographic",new d.Vector3(1e3,1e3,1e3));const v=new d.PerspectiveCamera(60,1,50,3e3);v.name="Debug",v.position.set(500,500,500),v.lookAt(0,0,0),c.set("Debug",v),G=c.get(localStorage.getItem(`${n}_tlCam`)),se=c.get(localStorage.getItem(`${n}_trCam`)),Be=c.get(localStorage.getItem(`${n}_blCam`)),Ue=c.get(localStorage.getItem(`${n}_brCam`))},[]),x.useEffect(()=>{const v=()=>{m.forEach(_=>{C.remove(_),_.dispose()}),m.clear()},b=()=>{je.traverse(_=>{if(_.type.search("Light")>-1){let S;switch(_.type){case"DirectionalLight":S=new d.DirectionalLightHelper(_,100),S.name=`${_.name}Helper`,m.set(_.name,S),C.add(S);break;case"HemisphereLight":S=new d.HemisphereLightHelper(_,250),S.name=`${_.name}Helper`,m.set(_.name,S),C.add(S);break;case"RectAreaLight":S=new da(_),S.name=`${_.name}Helper`,m.set(_.name,S),C.add(S);break;case"PointLight":S=new d.PointLightHelper(_,100),S.name=`${_.name}Helper`,m.set(_.name,S),C.add(S);break;case"SpotLight":S=new d.SpotLightHelper(_),S.name=`${_.name}Helper`,m.set(_.name,S),C.add(S);break}}})},O=_=>{v(),Nt(je),p.remove(je);const S=e.scenes.get(_.value.name);if(S!==void 0){const P=new S;e.onSceneSet!==void 0&&e.onSceneSet(P),je=P,e.three.scene=je,p.add(je),Zt=!0,b()}},j=_=>{const S=_.value,P=e.three.scene?.getObjectByProperty("uuid",S.uuid);if(P!==void 0&&c.set(S.name,P),P instanceof d.PerspectiveCamera){const W=new d.CameraHelper(P);h.set(P.name,W),p.add(W)}Ie(Date.now())},fe=_=>{const S=h.get(_.value.name);S!==void 0&&(p.remove(S),S.dispose()),c.delete(_.value.name),Ie(Date.now())};return N.addEventListener(L.SET_SCENE,O),N.addEventListener(L.ADD_CAMERA,j),N.addEventListener(L.REMOVE_CAMERA,fe),()=>{N.removeEventListener(L.SET_SCENE,O),N.removeEventListener(L.ADD_CAMERA,j),N.removeEventListener(L.REMOVE_CAMERA,fe)}},[]),x.useEffect(()=>{if(M===null)return;let v=window.innerWidth,b=window.innerHeight,O=Math.floor(v/2),j=Math.floor(b/2),fe=-1;const _=()=>{v=window.innerWidth-300,b=window.innerHeight,O=Math.floor(v/2),j=Math.floor(b/2),M.setSize(v,b);let T=v,V=b;switch(B){case"Side by Side":T=O,V=b;break;case"Stacked":T=v,V=j;break;case"Quad":T=O,V=j;break}c.forEach(q=>{q instanceof d.OrthographicCamera?(q.left=T/-2,q.right=T/2,q.top=V/2,q.bottom=V/-2,q.updateProjectionMatrix()):q instanceof d.PerspectiveCamera&&(q.aspect=T/V,q.updateProjectionMatrix(),h.get(q.name)?.update())})},S=()=>{M.setViewport(0,0,v,b),M.setScissor(0,0,v,b),M.render(p,G)},P=()=>{if(B==="Side by Side")M.setViewport(0,0,O,b),M.setScissor(0,0,O,b),M.render(p,G),M.setViewport(O,0,O,b),M.setScissor(O,0,O,b),M.render(p,se);else{const T=b-j;M.setViewport(0,T,v,j),M.setScissor(0,T,v,j),M.render(p,G),M.setViewport(0,0,v,j),M.setScissor(0,0,v,j),M.render(p,se)}},W=()=>{let T=0,V=0;V=b-j,T=0,M.setViewport(T,V,O,j),M.setScissor(T,V,O,j),M.render(p,G),T=O,M.setViewport(T,V,O,j),M.setScissor(T,V,O,j),M.render(p,se),V=0,T=0,M.setViewport(T,V,O,j),M.setScissor(T,V,O,j),M.render(p,Be),T=O,M.setViewport(T,V,O,j),M.setScissor(T,V,O,j),M.render(p,Ue)},ie=()=>{switch(f.forEach(T=>{T.update()}),h.forEach(T=>{T.update()}),m.forEach(T=>{T.update!==void 0&&T.update()}),e.onSceneUpdate!==void 0&&Zt&&e.onSceneUpdate(je),M.clear(),B){case"Single":S();break;case"Side by Side":case"Stacked":P();break;case"Quad":W();break}fe=requestAnimationFrame(ie)};return He(),window.addEventListener("resize",_),_(),ie(),()=>{window.removeEventListener("resize",_),cancelAnimationFrame(fe),fe=-1}},[B,M]),x.useEffect(()=>{if(M!==null){const v=new d.Raycaster,b=new d.Vector2,O=(S,P,W,ie)=>{switch(B){case"Quad":S<W?P<ie?v.setFromCamera(b,G):v.setFromCamera(b,Be):P<ie?v.setFromCamera(b,se):v.setFromCamera(b,Ue);break;case"Side by Side":S<W?v.setFromCamera(b,G):v.setFromCamera(b,se);break;case"Single":v.setFromCamera(b,G);break;case"Stacked":P<ie?v.setFromCamera(b,G):v.setFromCamera(b,se);break}},j=S=>{if(!yt)return;const P=new d.Vector2;M.getSize(P);const W=Math.min(S.clientX,P.x),ie=Math.min(S.clientY,P.y);b.x=Qe(W,0,P.x,-1,1),b.y=Qe(ie,0,P.y,1,-1);const T=P.x/2,V=P.y/2,q=()=>{W<T?b.x=Qe(W,0,T,-1,1):b.x=Qe(W,T,P.x,-1,1)},ke=()=>{ie<V?b.y=Qe(ie,0,V,1,-1):b.y=Qe(ie,V,P.y,1,-1)};switch(B){case"Quad":q(),ke();break;case"Side by Side":q();break;case"Stacked":ke(),ke();break}O(W,ie,T,V);const qe=v.intersectObjects(je.children);qe.length>0&&ee.position.copy(qe[0].point)},fe=S=>{if(!yt)return;const P=new d.Vector2;if(M.getSize(P),S.clientX>=P.x)return;j(S);const W=v.intersectObjects(je.children);W.length>0&&e.three.getObject(W[0].object.uuid)},_=he.current;return _.addEventListener("mousemove",j,!1),_.addEventListener("click",fe,!1),()=>{_.removeEventListener("mousemove",j),_.removeEventListener("click",fe)}}},[B,M]);const ce=[];return c.forEach((v,b)=>{ce.push(b)}),l.jsxs("div",{className:"multiview",children:[l.jsx("canvas",{ref:z}),M!==null&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`cameras ${B==="Single"||B==="Stacked"?"single":""}`,ref:he,children:[B==="Single"&&l.jsx(l.Fragment,{children:l.jsx(Ge,{camera:G,options:ce,ref:oe,onSelect:v=>{f.get(G.name)?.dispose();const b=c.get(v);b!==void 0&&(Ce(G),G=b,localStorage.setItem(`${n}_tlCam`,b.name),ne(b,oe.current))}})}),(B==="Side by Side"||B==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(Ge,{camera:G,options:ce,ref:oe,onSelect:v=>{f.get(G.name)?.dispose();const b=c.get(v);b!==void 0&&(Ce(G),G=b,localStorage.setItem(`${n}_tlCam`,b.name),ne(b,oe.current))}}),l.jsx(Ge,{camera:se,options:ce,ref:we,onSelect:v=>{f.get(se.name)?.dispose();const b=c.get(v);b!==void 0&&(Ce(se),se=b,localStorage.setItem(`${n}_trCam`,b.name),ne(b,we.current))}})]}),B==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(Ge,{camera:G,options:ce,ref:oe,onSelect:v=>{f.get(G.name)?.dispose();const b=c.get(v);b!==void 0&&(Ce(G),G=b,localStorage.setItem(`${n}_tlCam`,b.name),ne(b,oe.current))}}),l.jsx(Ge,{camera:se,options:ce,ref:we,onSelect:v=>{f.get(se.name)?.dispose();const b=c.get(v);b!==void 0&&(Ce(se),se=b,localStorage.setItem(`${n}_trCam`,b.name),ne(b,we.current))}}),l.jsx(Ge,{camera:Be,options:ce,ref:Me,onSelect:v=>{f.get(Be.name)?.dispose();const b=c.get(v);b!==void 0&&(Ce(Be),Be=b,localStorage.setItem(`${n}_blCam`,b.name),ne(b,Me.current))}}),l.jsx(Ge,{camera:Ue,options:ce,ref:me,onSelect:v=>{f.get(Ue.name)?.dispose();const b=c.get(v);b!==void 0&&(Ce(Ue),Ue=b,localStorage.setItem(`${n}_brCam`,b.name),ne(b,me.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(xt,{index:xe.indexOf(B),options:xe,onSelect:v=>{v!==B&&($e(),pe(v))},open:Oe,onToggle:v=>{_e(v),Te&&Re(!1),Ae&&De(!1)}}),l.jsx(xt,{index:te.indexOf(bt),options:te,onSelect:v=>{if(v!==bt)switch(bt=v,bt){case"Depth":p.overrideMaterial=de;break;case"Normals":p.overrideMaterial=ae;break;default:case"Renderer":p.overrideMaterial=null;break;case"Wireframe":p.overrideMaterial=F;break;case"UVs":p.overrideMaterial=H;break}},open:Te,onToggle:v=>{Oe&&_e(!1),Re(v),Ae&&De(!1)}}),l.jsx(xt,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:v=>{yt=v==="Selection Mode",ee.visible=yt},open:Ae,onToggle:v=>{Oe&&_e(!1),Te&&Re(!1),De(v)}})]})]})]})}function xa(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=St;exports.Application=wn;exports.BaseRemote=lt;exports.ChildObject=Ft;exports.ContainerObject=dn;exports.Draggable=cn;exports.DraggableItem=on;exports.Dropdown=ln;exports.DropdownItem=un;exports.Editor=xa;exports.Inspector=mn;exports.MultiView=ya;exports.NavButton=Lt;exports.RemoteComponents=Mn;exports.RemoteController=Fn;exports.RemoteTheatre=Ct;exports.RemoteThree=Pn;exports.RemoteTweakpane=jn;exports.SceneInspector=ua;exports.SidePanel=la;exports.ToolEvents=L;exports.capitalize=ct;exports.clamp=Ve;exports.colorToHex=tn;exports.debugDispatcher=N;exports.defaultTheatreCallback=En;exports.dispose=Nt;exports.disposeMaterial=an;exports.disposeTexture=Sn;exports.distance=Cn;exports.hierarchyUUID=It;exports.isColor=en;exports.mix=kt;exports.noop=Et;exports.normalize=At;exports.randomID=Qt;exports.resetThreeObjects=nn;exports.round=Pt;exports.theatreEditorApp=On;