@tomorrowevening/hermes 0.0.11 → 0.0.13

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.
Files changed (64) hide show
  1. package/dist/hermes.js +1541 -1446
  2. package/dist/hermes.umd.cjs +16 -16
  3. package/dist/style.css +1 -1
  4. package/package.json +3 -2
  5. package/src/core/Application.ts +1 -1
  6. package/src/core/RemoteController.ts +4 -151
  7. package/src/core/remote/RemoteComponents.ts +15 -1
  8. package/src/core/remote/RemoteTheatre.ts +114 -3
  9. package/src/core/remote/RemoteThree.ts +57 -2
  10. package/src/core/remote/RemoteTweakpane.ts +28 -2
  11. package/src/core/types.ts +2 -0
  12. package/src/editor/global.ts +3 -0
  13. package/src/editor/multiView/CameraWindow.tsx +20 -7
  14. package/src/editor/multiView/MultiView.scss +2 -0
  15. package/src/editor/multiView/MultiView.tsx +203 -9
  16. package/src/editor/scss/{_sceneHierarchy.scss → _sidePanel.scss} +1 -1
  17. package/src/editor/scss/index.scss +1 -1
  18. package/src/editor/{sceneHierarchy/SceneHierarchy.tsx → sidePanel/SidePanel.tsx} +8 -10
  19. package/src/editor/sidePanel/inspector/Inspector.tsx +111 -0
  20. package/src/editor/sidePanel/inspector/utils/InspectAnimation.tsx +51 -0
  21. package/src/editor/{sceneHierarchy → sidePanel}/types.ts +10 -1
  22. package/src/editor/{sceneHierarchy → sidePanel}/utils.ts +11 -2
  23. package/src/index.ts +6 -6
  24. package/types/core/Application.d.ts +1 -1
  25. package/types/core/RemoteController.d.ts +1 -1
  26. package/types/core/remote/RemoteComponents.d.ts +3 -0
  27. package/types/core/remote/RemoteTheatre.d.ts +3 -0
  28. package/types/core/remote/RemoteThree.d.ts +7 -1
  29. package/types/core/remote/RemoteTweakpane.d.ts +2 -0
  30. package/types/core/types.d.ts +1 -1
  31. package/types/editor/global.d.ts +2 -0
  32. package/types/editor/multiView/CameraWindow.d.ts +2 -0
  33. package/types/editor/multiView/MultiView.d.ts +4 -0
  34. package/types/editor/sidePanel/SidePanel.d.ts +11 -0
  35. package/types/editor/sidePanel/inspector/utils/InspectAnimation.d.ts +3 -0
  36. package/types/editor/{sceneHierarchy → sidePanel}/types.d.ts +7 -1
  37. package/types/index.d.ts +6 -6
  38. package/src/editor/sceneHierarchy/inspector/Inspector.tsx +0 -97
  39. package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +0 -11
  40. /package/src/editor/{sceneHierarchy → sidePanel}/Accordion.tsx +0 -0
  41. /package/src/editor/{sceneHierarchy → sidePanel}/ChildObject.tsx +0 -0
  42. /package/src/editor/{sceneHierarchy → sidePanel}/ContainerObject.tsx +0 -0
  43. /package/src/editor/{sceneHierarchy → sidePanel}/ToggleBtn.tsx +0 -0
  44. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/InspectorField.tsx +0 -0
  45. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/InspectorGroup.tsx +0 -0
  46. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/SceneInspector.tsx +0 -0
  47. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/inspector.scss +0 -0
  48. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectCamera.tsx +0 -0
  49. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectLight.tsx +0 -0
  50. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectMaterial.tsx +0 -0
  51. /package/src/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectTransform.tsx +0 -0
  52. /package/types/editor/{sceneHierarchy → sidePanel}/Accordion.d.ts +0 -0
  53. /package/types/editor/{sceneHierarchy → sidePanel}/ChildObject.d.ts +0 -0
  54. /package/types/editor/{sceneHierarchy → sidePanel}/ContainerObject.d.ts +0 -0
  55. /package/types/editor/{sceneHierarchy → sidePanel}/ToggleBtn.d.ts +0 -0
  56. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/Inspector.d.ts +0 -0
  57. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/InspectorField.d.ts +0 -0
  58. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/InspectorGroup.d.ts +0 -0
  59. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/SceneInspector.d.ts +0 -0
  60. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectCamera.d.ts +0 -0
  61. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectLight.d.ts +0 -0
  62. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectMaterial.d.ts +0 -0
  63. /package/types/editor/{sceneHierarchy → sidePanel}/inspector/utils/InspectTransform.d.ts +0 -0
  64. /package/types/editor/{sceneHierarchy → sidePanel}/utils.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- (function(C,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("three"),require("@theatre/core"),require("tweakpane"),require("@tweakpane/plugin-essentials"),require("react"),require("framer-motion"),require("@theatre/studio")):typeof define=="function"&&define.amd?define(["exports","three","@theatre/core","tweakpane","@tweakpane/plugin-essentials","react","framer-motion","@theatre/studio"],f):(C=typeof globalThis<"u"?globalThis:C||self,f(C.Hermes={},C.Three,C["Theatre Core"],C.tweakpane,C["tweakpane-plugin-essentials"],C.React,C["framer-motion"],C["Theatre Studio"]))})(this,function(C,f,ye,un,dn,j,_t,Fe){"use strict";var da=Object.defineProperty;var fa=(C,f,ye)=>f in C?da(C,f,{enumerable:!0,configurable:!0,writable:!0,value:ye}):C[f]=ye;var Y=(C,f,ye)=>(fa(C,typeof f!="symbol"?f+"":f,ye),ye);function fn(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const e=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,e.get?e:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const hn=fn(dn);function pn(t,n,a){return Math.min(n,Math.max(t,a))}function mn(t,n){const a=t-n;return Math.sqrt(a*a)}function kt(){return Math.round(Math.random()*1e6).toString()}function Dt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function It(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),o=d=>{const m=d.toString(16);return m.length===1?"0"+m:m},u=o(n),c=o(a),s=o(e);return"#"+u+c+s}function et(t,n=1){return Number(t.toFixed(n))}C.totalThreeObjects=0;const At=()=>{C.totalThreeObjects=0},vt=t=>{if(!t)return;let n=t.name.replace(" ","");n.length===0&&(n=`obj_${C.totalThreeObjects}`,C.totalThreeObjects++),t.parent!==null&&(n=`${t.parent.uuid}.${n}`),t.uuid=n,t.children.forEach(a=>{vt(a)})},gn=t=>{t==null||t.dispose()},Nt=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},bt=t=>{var n;if(t){for(;t.children.length>0;){const a=t.children[0];a instanceof f.PositionalAudio?(a.pause(),a.parent&&a.parent.remove(a)):bt(a)}if(t.parent&&t.parent.remove(t),t.isMesh){const a=t;(n=a.geometry)==null||n.dispose(),Nt(a.material)}t.dispose!==void 0&&t.dispose()}};class vn{constructor(n,a,e){Y(this,"channel");Y(this,"components",new Map);Y(this,"_mode","app");this.editor=a&&document.location.hash.search(e)>-1,a&&(this.channel=new BroadcastChannel(n))}addComponent(n,a){this.components.set(n,a)}dispose(){this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){this.channel!==void 0&&this._mode!==n.target&&this.channel.postMessage(n)}listen(n){this.channel!==void 0&&(this.channel.onmessage=a=>{n(a.data)})}get mode(){return this._mode}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor",document.title+=" - Editor")}}const N=new f.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"};class Ve{constructor(n){Y(this,"app");this.app=n}dispose(){}}class bn extends Ve{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}})}}const Lt=()=>{};class yn extends Ve{constructor(a,e,o){super(a);Y(this,"project");Y(this,"sheets");Y(this,"sheetObjects");Y(this,"sheetObjectCBs");Y(this,"sheetObjectUnsubscribe");this.project=ye.getProject(e,o),this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}sheet(a){var o;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let e=this.sheets.get(a);return e!==void 0||(e=(o=this.project)==null?void 0:o.sheet(a),this.sheets.set(a,e)),e}sheetObject(a,e,o,u){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const c=this.sheets.get(a);if(c===void 0)return;const s=`${a}_${e}`;let d=this.sheetObjects.get(s);if(d!==void 0)return d=c.object(e,{...o,...d.value},{reconfigure:!0}),d;d=c.object(e,o),this.sheetObjects.set(s,d),this.sheetObjectCBs.set(s,u!==void 0?u:Lt);const m=d.onValuesChange(p=>{if(this.app.editor){for(const y in p){const S=p[y];typeof S=="object"&&Dt(S)&&(p[y]={r:S.r,g:S.g,b:S.b,a:S.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheetObject:s,values:p}})}else{const y=this.sheetObjectCBs.get(s);y!==void 0&&y(p)}});return this.sheetObjectUnsubscribe.set(s,m),d}unsubscribe(a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const e=`${a.address.sheetId}_${a.address.objectKey}`,o=this.sheetObjectUnsubscribe.get(e);o!==void 0&&o()}}function En(t){if(t.name==="cameras")return"camera";if(t.name==="interactive")return"interactive";if(t.name==="lights")return"light";if(t.name==="ui")return"ui";if(t.name==="utils")return"utils";const n=t.type;return n.search("Helper")>-1?"icon_utils":n.search("Camera")>-1?"camera":n.search("Light")>-1?"light":"obj3D"}function Ut(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(Ut(a))}),n}function wn(t){const n={};for(const a in t){const e=t[a].value;n[a]={value:e},e===null?n[a].value={src:""}:e.isTexture&&(n[a].value={src:e.image.src})}return n}function Cn(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Ft(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||Cn(a))continue;const e=typeof t[a],o=t[a];switch(e){case"boolean":case"number":case"string":n[a]=o;break;case"object":if(o!==null)if(n[a]=o,o.isTexture)if(o instanceof f.Texture){const u=o.source.toJSON();n[a]={src:u.url}}else o instanceof f.CubeTexture&&(console.log("env map"),console.log(o.source.data),console.log(o.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=wn(n[a]));else n[a]={src:""};break}}return n}function Sn(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements,material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0},a=t.type.toLowerCase();if(a.search("mesh")>-1){const e=t;if(Array.isArray(e.material)){const o=[];e.material.forEach(u=>{o.push(Ft(u))}),n.material=o}else n.material=Ft(e.material)}else a.search("camera")>-1?t.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:t.fov,zoom:t.zoom,near:t.near,far:t.far,focus:t.focus,aspect:t.aspect,filmGauge:t.filmGauge,filmOffset:t.filmOffset}:t.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):a.search("light")>-1&&(n.lightInfo={color:t.color,intensity:t.intensity,decay:t.decay,distance:t.distance,angle:t.angle,penumbra:t.penumbra,groundColor:t.groundColor});return n}function J(t,n,a){const e=n.split(".");switch(e.length){case 1:t[e[0]]=a;break;case 2:t[e[0]][e[1]]=a;break;case 3:t[e[0]][e[1]][e[2]]=a;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=a;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=a;break}}function yt(t){return new Promise((n,a)=>{const e=new Image;e.onload=()=>{const o=new f.Texture(e);o.wrapS=f.RepeatWrapping,o.wrapT=f.RepeatWrapping,o.needsUpdate=!0,n(o)},e.onerror=a,e.src=t})}class xn extends Ve{constructor(){super(...arguments);Y(this,"scene")}getObject(a){this.app.send({event:"getObject",target:"app",data:a})}setObject(a){const e=Sn(a);this.app.send({event:"setObject",target:"editor",data:e})}requestMethod(a,e,o){this.app.send({event:"requestMethod",target:"app",data:{uuid:a,key:e,value:o}})}updateObject(a,e,o){this.app.send({event:"updateObject",target:"app",data:{uuid:a,key:e,value:o}})}createTexture(a,e,o){this.app.send({event:"createTexture",target:"app",data:{uuid:a,key:e,value:o}})}setScene(a){if(a===void 0)return;this.scene=a,At(),vt(this.scene);const e=Ut(this.scene);this.app.send({event:"setScene",target:"editor",data:e})}}class On extends Ve{constructor(a){super(a);Y(this,"bindCBs");Y(this,"buttonCBs");Y(this,"pane");Y(this,"appCallbacks",0);Y(this,"editorCallbacks",0);Y(this,"inspectorFolder");this.bindCBs=new Map,this.buttonCBs=new Map,a.editor&&this.createGUI()}createGUI(){this.pane=new un.Pane({title:"GUI"}),this.pane.registerPlugin(hn)}dispose(){var a;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((a=this.pane)==null||a.dispose(),this.pane=void 0)}addFolder(a,e=void 0,o=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(o!==void 0?o:this.pane).addFolder({title:a,...e});this.app.send({event:"addFolder",target:"app",data:{name:a,params:e,parent:o}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(a,e,o,u=void 0){const c=this.bindID,s=o.onChange!==void 0?o.onChange:Lt;this.bindCBs.set(c,s),this.app.editor?(this.pane===void 0&&this.createGUI(),(u!==void 0?u:this.pane).addBinding(a,e,o).on("change",m=>{this.app.send({event:"updateBind",target:"app",data:{id:c,value:m.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:c,name:e,params:o,parent:u}}),this.appCallbacks++)}triggerBind(a,e){const o=this.bindCBs.get(a);o!==void 0?o(e):console.warn(`No callback for: ${a}`,e)}button(a,e,o=void 0){const u=this.bindID;this.buttonCBs.set(u,e),this.app.editor?(this.pane===void 0&&this.createGUI(),(o!==void 0?o:this.pane).addButton({title:a}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:u}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:u,name:a,callback:e,parent:o}}),this.appCallbacks++)}triggerButton(a){const e=this.buttonCBs.get(a);e!==void 0&&e()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const a=this.inspectorFolder.children.length-1;for(let e=a;e>-1;--e)this.inspectorFolder.remove(this.inspectorFolder.children[e])}}var Et={exports:{}},Be={};/**
1
+ (function(w,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("three"),require("@theatre/core"),require("@theatre/studio"),require("tweakpane"),require("@tweakpane/plugin-essentials"),require("react"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","three","@theatre/core","@theatre/studio","tweakpane","@tweakpane/plugin-essentials","react","framer-motion"],u):(w=typeof globalThis<"u"?globalThis:w||self,u(w.Hermes={},w.Three,w["Theatre Core"],w["Theatre Studio"],w.tweakpane,w["tweakpane-plugin-essentials"],w.React,w["framer-motion"]))})(this,function(w,u,Oe,ya,gn,vn,M,It){"use strict";var va=Object.defineProperty;var ba=(w,u,Oe)=>u in w?va(w,u,{enumerable:!0,configurable:!0,writable:!0,value:Oe}):w[u]=Oe;var $=(w,u,Oe)=>(ba(w,typeof u!="symbol"?u+"":u,Oe),Oe);function bn(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const e=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,e.get?e:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const yn=bn(vn);function En(t,n,a){return Math.min(n,Math.max(t,a))}function wn(t,n){const a=t-n;return Math.sqrt(a*a)}function Nt(){return Math.round(Math.random()*1e6).toString()}function Lt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function Ut(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),r=f=>{const g=f.toString(16);return g.length===1?"0"+g:g},s=r(n),p=r(a),l=r(e);return"#"+s+p+l}function at(t,n=1){return Number(t.toFixed(n))}w.totalThreeObjects=0;const Ft=()=>{w.totalThreeObjects=0},wt=t=>{if(!t)return;let n=t.name.replace(" ","");n.length===0&&(n=`obj_${w.totalThreeObjects}`,w.totalThreeObjects++),t.parent!==null&&(n=`${t.parent.uuid}.${n}`),t.uuid=n,t.children.forEach(a=>{wt(a)})},Cn=t=>{t==null||t.dispose()},Vt=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},Ct=t=>{var n;if(t){for(;t.children.length>0;){const a=t.children[0];a instanceof u.PositionalAudio?(a.pause(),a.parent&&a.parent.remove(a)):Ct(a)}if(t.parent&&t.parent.remove(t),t.isMesh){const a=t;(n=a.geometry)==null||n.dispose(),Vt(a.material)}t.dispose!==void 0&&t.dispose()}};class Sn{constructor(n,a,e="editor"){$(this,"channel");$(this,"components",new Map);$(this,"_mode","app");this.editor=a&&document.location.hash.search(e)>-1,a&&(this.channel=new BroadcastChannel(n))}addComponent(n,a){this.components.set(n,a)}dispose(){this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){this.channel!==void 0&&this._mode!==n.target&&this.channel.postMessage(n)}listen(n){this.channel!==void 0&&(this.channel.onmessage=a=>{n(a.data)})}get mode(){return this._mode}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor",document.title+=" - Editor")}}const z=new u.EventDispatcher,Y={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 Ye{constructor(n){$(this,"app");this.app=n}dispose(){}}class xn extends Ye{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}})}}const Bt=()=>{};class On extends Ye{constructor(a,e,r){super(a);$(this,"project");$(this,"sheets");$(this,"sheetObjects");$(this,"sheetObjectCBs");$(this,"sheetObjectUnsubscribe");this.project=Oe.getProject(e,r),this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}sheet(a){var r;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let e=this.sheets.get(a);return e!==void 0||(e=(r=this.project)==null?void 0:r.sheet(a),this.sheets.set(a,e)),e}sheetObject(a,e,r,s){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const p=this.sheets.get(a);if(p===void 0)return;const l=`${a}_${e}`;let f=this.sheetObjects.get(l);if(f!==void 0)return f=p.object(e,{...r,...f.value},{reconfigure:!0}),f;f=p.object(e,r),this.sheetObjects.set(l,f),this.sheetObjectCBs.set(l,s!==void 0?s:Bt);const g=f.onValuesChange(b=>{if(this.app.editor){for(const C in b){const S=b[C];typeof S=="object"&&Lt(S)&&(b[C]={r:S.r,g:S.g,b:S.b,a:S.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheetObject:l,values:b}})}else{const C=this.sheetObjectCBs.get(l);C!==void 0&&C(b)}});return this.sheetObjectUnsubscribe.set(l,g),f}unsubscribe(a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const e=`${a.address.sheetId}_${a.address.objectKey}`,r=this.sheetObjectUnsubscribe.get(e);r!==void 0&&r()}}function Tn(t){if(t.name==="cameras")return"camera";if(t.name==="interactive")return"interactive";if(t.name==="lights")return"light";if(t.name==="ui")return"ui";if(t.name==="utils")return"utils";const n=t.type;return n.search("Helper")>-1?"icon_utils":n.search("Camera")>-1?"camera":n.search("Light")>-1?"light":"obj3D"}function Gt(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(Gt(a))}),n}function Mn(t){const n={};for(const a in t){const e=t[a].value;n[a]={value:e},e===null?n[a].value={src:""}:e.isTexture&&(n[a].value={src:e.image.src})}return n}function Rn(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function zt(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||Rn(a))continue;const e=typeof t[a],r=t[a];switch(e){case"boolean":case"number":case"string":n[a]=r;break;case"object":if(r!==null)if(n[a]=r,r.isTexture)if(r instanceof u.Texture){const s=r.source.toJSON();n[a]={src:s.url}}else r instanceof u.CubeTexture&&(console.log("env map"),console.log(r.source.data),console.log(r.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Mn(n[a]));else n[a]={src:""};break}}return n}function St(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};t.animations.forEach(e=>{n.animations.push({name:e.name,duration:e.duration,blendMode:e.blendMode})});const a=t.type.toLowerCase();if(a.search("mesh")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(zt(s))}),n.material=r}else n.material=zt(e.material)}else a.search("camera")>-1?t.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:t.fov,zoom:t.zoom,near:t.near,far:t.far,focus:t.focus,aspect:t.aspect,filmGauge:t.filmGauge,filmOffset:t.filmOffset}:t.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):a.search("light")>-1&&(n.lightInfo={color:t.color,intensity:t.intensity,decay:t.decay,distance:t.distance,angle:t.angle,penumbra:t.penumbra,groundColor:t.groundColor});return n}function te(t,n,a){const e=n.split(".");switch(e.length){case 1:t[e[0]]=a;break;case 2:t[e[0]][e[1]]=a;break;case 3:t[e[0]][e[1]][e[2]]=a;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=a;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=a;break}}function xt(t){return new Promise((n,a)=>{const e=new Image;e.onload=()=>{const r=new u.Texture(e);r.wrapS=u.RepeatWrapping,r.wrapT=u.RepeatWrapping,r.needsUpdate=!0,n(r)},e.onerror=a,e.src=t})}class Pn extends Ye{constructor(){super(...arguments);$(this,"scene")}getObject(a){this.app.send({event:"getObject",target:"app",data:a})}setObject(a){const e=St(a);this.app.send({event:"setObject",target:"editor",data:e})}requestMethod(a,e,r){this.app.send({event:"requestMethod",target:"app",data:{uuid:a,key:e,value:r}})}updateObject(a,e,r){this.app.send({event:"updateObject",target:"app",data:{uuid:a,key:e,value:r}})}createTexture(a,e,r){this.app.send({event:"createTexture",target:"app",data:{uuid:a,key:e,value:r}})}setScene(a){if(a===void 0)return;this.scene=a,Ft(),wt(this.scene);const e=Gt(this.scene);this.app.send({event:"setScene",target:"editor",data:e})}addCamera(a){const e=St(a);this.app.send({event:"addCamera",target:"editor",data:e})}removeCamera(a){const e=St(a);this.app.send({event:"removeCamera",target:"editor",data:e})}}class jn extends Ye{constructor(a){super(a);$(this,"bindCBs");$(this,"buttonCBs");$(this,"pane");$(this,"appCallbacks",0);$(this,"editorCallbacks",0);$(this,"inspectorFolder");this.bindCBs=new Map,this.buttonCBs=new Map,a.editor&&this.createGUI()}createGUI(){this.pane=new gn.Pane({title:"GUI"}),this.pane.registerPlugin(yn)}dispose(){var a;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((a=this.pane)==null||a.dispose(),this.pane=void 0)}addFolder(a,e=void 0,r=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addFolder({title:a,...e});this.app.send({event:"addFolder",target:"app",data:{name:a,params:e,parent:r}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(a,e,r,s=void 0){const p=this.bindID,l=r.onChange!==void 0?r.onChange:Bt;this.bindCBs.set(p,l),this.app.editor?(this.pane===void 0&&this.createGUI(),(s!==void 0?s:this.pane).addBinding(a,e,r).on("change",g=>{this.app.send({event:"updateBind",target:"app",data:{id:p,value:g.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:p,name:e,params:r,parent:s}}),this.appCallbacks++)}triggerBind(a,e){const r=this.bindCBs.get(a);r!==void 0?r(e):console.warn(`No callback for: ${a}`,e)}button(a,e,r=void 0){const s=this.bindID;this.buttonCBs.set(s,e),this.app.editor?(this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addButton({title:a}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:s}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:s,name:a,callback:e,parent:r}}),this.appCallbacks++)}triggerButton(a){const e=this.buttonCBs.get(a);e!==void 0&&e()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const a=this.inspectorFolder.children.length-1;for(let e=a;e>-1;--e)this.inspectorFolder.remove(this.inspectorFolder.children[e])}}var Ot={exports:{}},We={};/**
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 Vt;function Tn(){if(Vt)return Be;Vt=1;var t=j,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function c(s,d,m){var p,y={},S=null,T=null;m!==void 0&&(S=""+m),d.key!==void 0&&(S=""+d.key),d.ref!==void 0&&(T=d.ref);for(p in d)e.call(d,p)&&!u.hasOwnProperty(p)&&(y[p]=d[p]);if(s&&s.defaultProps)for(p in d=s.defaultProps,d)y[p]===void 0&&(y[p]=d[p]);return{$$typeof:n,type:s,key:S,ref:T,props:y,_owner:o.current}}return Be.Fragment=a,Be.jsx=c,Be.jsxs=c,Be}var Ge={};/**
9
+ */var Yt;function _n(){if(Yt)return We;Yt=1;var t=M,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function p(l,f,g){var b,C={},S=null,_=null;g!==void 0&&(S=""+g),f.key!==void 0&&(S=""+f.key),f.ref!==void 0&&(_=f.ref);for(b in f)e.call(f,b)&&!s.hasOwnProperty(b)&&(C[b]=f[b]);if(l&&l.defaultProps)for(b in f=l.defaultProps,f)C[b]===void 0&&(C[b]=f[b]);return{$$typeof:n,type:l,key:S,ref:_,props:C,_owner:r.current}}return We.Fragment=a,We.jsx=p,We.jsxs=p,We}var He={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,19 +14,19 @@
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 Bt;function Rn(){return Bt||(Bt=1,process.env.NODE_ENV!=="production"&&function(){var t=j,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),s=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),R=Symbol.iterator,g="@@iterator";function b(i){if(i===null||typeof i!="object")return null;var h=R&&i[R]||i[g];return typeof h=="function"?h:null}var E=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(i){{for(var h=arguments.length,v=new Array(h>1?h-1:0),O=1;O<h;O++)v[O-1]=arguments[O];V("error",i,v)}}function V(i,h,v){{var O=E.ReactDebugCurrentFrame,_=O.getStackAddendum();_!==""&&(h+="%s",v=v.concat([_]));var A=v.map(function(P){return String(P)});A.unshift("Warning: "+h),Function.prototype.apply.call(console[i],console,A)}}var H=!1,$=!1,se=!1,W=!1,he=!1,D;D=Symbol.for("react.module.reference");function F(i){return!!(typeof i=="string"||typeof i=="function"||i===e||i===u||he||i===o||i===m||i===p||W||i===T||H||$||se||typeof i=="object"&&i!==null&&(i.$$typeof===S||i.$$typeof===y||i.$$typeof===c||i.$$typeof===s||i.$$typeof===d||i.$$typeof===D||i.getModuleId!==void 0))}function K(i,h,v){var O=i.displayName;if(O)return O;var _=h.displayName||h.name||"";return _!==""?v+"("+_+")":v}function ce(i){return i.displayName||"Context"}function ie(i){if(i==null)return null;if(typeof i.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case e:return"Fragment";case a:return"Portal";case u:return"Profiler";case o:return"StrictMode";case m:return"Suspense";case p:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case s:var h=i;return ce(h)+".Consumer";case c:var v=i;return ce(v._context)+".Provider";case d:return K(i,i.render,"ForwardRef");case y:var O=i.displayName||null;return O!==null?O:ie(i.type)||"Memo";case S:{var _=i,A=_._payload,P=_._init;try{return ie(P(A))}catch{return null}}}return null}var le=Object.assign,re=0,_e,He,ke,De,We,rt,Ke;function ot(){}ot.__reactDisabledLog=!0;function Tt(){{if(re===0){_e=console.log,He=console.info,ke=console.warn,De=console.error,We=console.group,rt=console.groupCollapsed,Ke=console.groupEnd;var i={configurable:!0,enumerable:!0,value:ot,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}re++}}function Rt(){{if(re--,re===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:le({},i,{value:_e}),info:le({},i,{value:He}),warn:le({},i,{value:ke}),error:le({},i,{value:De}),group:le({},i,{value:We}),groupCollapsed:le({},i,{value:rt}),groupEnd:le({},i,{value:Ke})})}re<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Xe=E.ReactCurrentDispatcher,Ze;function Se(i,h,v){{if(Ze===void 0)try{throw Error()}catch(_){var O=_.stack.trim().match(/\n( *(at )?)/);Ze=O&&O[1]||""}return`
18
- `+Ze+i}}var Ie=!1,xe;{var Mt=typeof WeakMap=="function"?WeakMap:Map;xe=new Mt}function st(i,h){if(!i||Ie)return"";{var v=xe.get(i);if(v!==void 0)return v}var O;Ie=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var A;A=Xe.current,Xe.current=null,Tt();try{if(h){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(me){O=me}Reflect.construct(i,[],P)}else{try{P.call()}catch(me){O=me}i.call(P.prototype)}}else{try{throw Error()}catch(me){O=me}i()}}catch(me){if(me&&O&&typeof me.stack=="string"){for(var M=me.stack.split(`
19
- `),q=O.stack.split(`
20
- `),B=M.length-1,G=q.length-1;B>=1&&G>=0&&M[B]!==q[G];)G--;for(;B>=1&&G>=0;B--,G--)if(M[B]!==q[G]){if(B!==1||G!==1)do if(B--,G--,G<0||M[B]!==q[G]){var oe=`
21
- `+M[B].replace(" at new "," at ");return i.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",i.displayName)),typeof i=="function"&&xe.set(i,oe),oe}while(B>=1&&G>=0);break}}}finally{Ie=!1,Xe.current=A,Rt(),Error.prepareStackTrace=_}var Ue=i?i.displayName||i.name:"",ln=Ue?Se(Ue):"";return typeof i=="function"&&xe.set(i,ln),ln}function ct(i,h,v){return st(i,!1)}function lt(i){var h=i.prototype;return!!(h&&h.isReactComponent)}function Oe(i,h,v){if(i==null)return"";if(typeof i=="function")return st(i,lt(i));if(typeof i=="string")return Se(i);switch(i){case m:return Se("Suspense");case p:return Se("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case d:return ct(i.render);case y:return Oe(i.type,h,v);case S:{var O=i,_=O._payload,A=O._init;try{return Oe(A(_),h,v)}catch{}}}return""}var Ae=Object.prototype.hasOwnProperty,ut={},Je=E.ReactDebugCurrentFrame;function ge(i){if(i){var h=i._owner,v=Oe(i.type,i._source,h?h.type:null);Je.setExtraStackFrame(v)}else Je.setExtraStackFrame(null)}function Te(i,h,v,O,_){{var A=Function.call.bind(Ae);for(var P in i)if(A(i,P)){var M=void 0;try{if(typeof i[P]!="function"){var q=Error((O||"React class")+": "+v+" type `"+P+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[P]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw q.name="Invariant Violation",q}M=i[P](h,P,O,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(B){M=B}M&&!(M instanceof Error)&&(ge(_),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",O||"React class",v,P,typeof M),ge(null)),M instanceof Error&&!(M.message in ut)&&(ut[M.message]=!0,ge(_),x("Failed %s type: %s",v,M.message),ge(null))}}}var Pt=Array.isArray;function Qe(i){return Pt(i)}function dt(i){{var h=typeof Symbol=="function"&&Symbol.toStringTag,v=h&&i[Symbol.toStringTag]||i.constructor.name||"Object";return v}}function qe(i){try{return ft(i),!1}catch{return!0}}function ft(i){return""+i}function ht(i){if(qe(i))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",dt(i)),ft(i)}var ve=E.ReactCurrentOwner,jt={key:!0,ref:!0,__self:!0,__source:!0},pt,$e,ue;ue={};function r(i){if(Ae.call(i,"ref")){var h=Object.getOwnPropertyDescriptor(i,"ref").get;if(h&&h.isReactWarning)return!1}return i.ref!==void 0}function w(i){if(Ae.call(i,"key")){var h=Object.getOwnPropertyDescriptor(i,"key").get;if(h&&h.isReactWarning)return!1}return i.key!==void 0}function k(i,h){if(typeof i.ref=="string"&&ve.current&&h&&ve.current.stateNode!==h){var v=ie(ve.current.type);ue[v]||(x('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',ie(ve.current.type),i.ref),ue[v]=!0)}}function I(i,h){{var v=function(){pt||(pt=!0,x("%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)",h))};v.isReactWarning=!0,Object.defineProperty(i,"key",{get:v,configurable:!0})}}function X(i,h){{var v=function(){$e||($e=!0,x("%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)",h))};v.isReactWarning=!0,Object.defineProperty(i,"ref",{get:v,configurable:!0})}}var de=function(i,h,v,O,_,A,P){var M={$$typeof:n,type:i,key:h,ref:v,props:P,_owner:A};return M._store={},Object.defineProperty(M._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(M,"_self",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.defineProperty(M,"_source",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.freeze&&(Object.freeze(M.props),Object.freeze(M)),M};function ee(i,h,v,O,_){{var A,P={},M=null,q=null;v!==void 0&&(ht(v),M=""+v),w(h)&&(ht(h.key),M=""+h.key),r(h)&&(q=h.ref,k(h,_));for(A in h)Ae.call(h,A)&&!jt.hasOwnProperty(A)&&(P[A]=h[A]);if(i&&i.defaultProps){var B=i.defaultProps;for(A in B)P[A]===void 0&&(P[A]=B[A])}if(M||q){var G=typeof i=="function"?i.displayName||i.name||"Unknown":i;M&&I(P,G),q&&X(P,G)}return de(i,M,q,_,O,ve.current,P)}}var mt=E.ReactCurrentOwner,gt=E.ReactDebugCurrentFrame;function pe(i){if(i){var h=i._owner,v=Oe(i.type,i._source,h?h.type:null);gt.setExtraStackFrame(v)}else gt.setExtraStackFrame(null)}var ne;ne=!1;function ae(i){return typeof i=="object"&&i!==null&&i.$$typeof===n}function Ne(){{if(mt.current){var i=ie(mt.current.type);if(i)return`
17
+ */var Wt;function Dn(){return Wt||(Wt=1,process.env.NODE_ENV!=="production"&&function(){var t=M,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),P=Symbol.iterator,K="@@iterator";function se(i){if(i===null||typeof i!="object")return null;var h=P&&i[P]||i[K];return typeof h=="function"?h:null}var Z=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function O(i){{for(var h=arguments.length,v=new Array(h>1?h-1:0),x=1;x<h;x++)v[x-1]=arguments[x];Q("error",i,v)}}function Q(i,h,v){{var x=Z.ReactDebugCurrentFrame,k=x.getStackAddendum();k!==""&&(h+="%s",v=v.concat([k]));var U=v.map(function(D){return String(D)});U.unshift("Warning: "+h),Function.prototype.apply.call(console[i],console,U)}}var de=!1,le=!1,ae=!1,d=!1,m=!1,y;y=Symbol.for("react.module.reference");function T(i){return!!(typeof i=="string"||typeof i=="function"||i===e||i===s||m||i===r||i===g||i===b||d||i===_||de||le||ae||typeof i=="object"&&i!==null&&(i.$$typeof===S||i.$$typeof===C||i.$$typeof===p||i.$$typeof===l||i.$$typeof===f||i.$$typeof===y||i.getModuleId!==void 0))}function B(i,h,v){var x=i.displayName;if(x)return x;var k=h.displayName||h.name||"";return k!==""?v+"("+k+")":v}function G(i){return i.displayName||"Context"}function F(i){if(i==null)return null;if(typeof i.tag=="number"&&O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case e:return"Fragment";case a:return"Portal";case s:return"Profiler";case r:return"StrictMode";case g:return"Suspense";case b:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case l:var h=i;return G(h)+".Consumer";case p:var v=i;return G(v._context)+".Provider";case f:return B(i,i.render,"ForwardRef");case C:var x=i.displayName||null;return x!==null?x:F(i.type)||"Memo";case S:{var k=i,U=k._payload,D=k._init;try{return F(D(U))}catch{return null}}}return null}var I=Object.assign,V=0,ee,j,N,J,pe,De,Qe;function ut(){}ut.__reactDisabledLog=!0;function jt(){{if(V===0){ee=console.log,j=console.info,N=console.warn,J=console.error,pe=console.group,De=console.groupCollapsed,Qe=console.groupEnd;var i={configurable:!0,enumerable:!0,value:ut,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}V++}}function _t(){{if(V--,V===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},i,{value:ee}),info:I({},i,{value:j}),warn:I({},i,{value:N}),error:I({},i,{value:J}),group:I({},i,{value:pe}),groupCollapsed:I({},i,{value:De}),groupEnd:I({},i,{value:Qe})})}V<0&&O("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Je=Z.ReactCurrentDispatcher,qe;function ke(i,h,v){{if(qe===void 0)try{throw Error()}catch(k){var x=k.stack.trim().match(/\n( *(at )?)/);qe=x&&x[1]||""}return`
18
+ `+qe+i}}var Fe=!1,Ae;{var Dt=typeof WeakMap=="function"?WeakMap:Map;Ae=new Dt}function dt(i,h){if(!i||Fe)return"";{var v=Ae.get(i);if(v!==void 0)return v}var x;Fe=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var U;U=Je.current,Je.current=null,jt();try{if(h){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(we){x=we}Reflect.construct(i,[],D)}else{try{D.call()}catch(we){x=we}i.call(D.prototype)}}else{try{throw Error()}catch(we){x=we}i()}}catch(we){if(we&&x&&typeof we.stack=="string"){for(var R=we.stack.split(`
19
+ `),ce=x.stack.split(`
20
+ `),X=R.length-1,q=ce.length-1;X>=1&&q>=0&&R[X]!==ce[q];)q--;for(;X>=1&&q>=0;X--,q--)if(R[X]!==ce[q]){if(X!==1||q!==1)do if(X--,q--,q<0||R[X]!==ce[q]){var me=`
21
+ `+R[X].replace(" at new "," at ");return i.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",i.displayName)),typeof i=="function"&&Ae.set(i,me),me}while(X>=1&&q>=0);break}}}finally{Fe=!1,Je.current=U,_t(),Error.prepareStackTrace=k}var ze=i?i.displayName||i.name:"",mn=ze?ke(ze):"";return typeof i=="function"&&Ae.set(i,mn),mn}function ft(i,h,v){return dt(i,!1)}function ht(i){var h=i.prototype;return!!(h&&h.isReactComponent)}function Ie(i,h,v){if(i==null)return"";if(typeof i=="function")return dt(i,ht(i));if(typeof i=="string")return ke(i);switch(i){case g:return ke("Suspense");case b:return ke("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case f:return ft(i.render);case C:return Ie(i.type,h,v);case S:{var x=i,k=x._payload,U=x._init;try{return Ie(U(k),h,v)}catch{}}}return""}var Ve=Object.prototype.hasOwnProperty,pt={},$e=Z.ReactDebugCurrentFrame;function Ce(i){if(i){var h=i._owner,v=Ie(i.type,i._source,h?h.type:null);$e.setExtraStackFrame(v)}else $e.setExtraStackFrame(null)}function Ne(i,h,v,x,k){{var U=Function.call.bind(Ve);for(var D in i)if(U(i,D)){var R=void 0;try{if(typeof i[D]!="function"){var ce=Error((x||"React class")+": "+v+" type `"+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[D]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ce.name="Invariant Violation",ce}R=i[D](h,D,x,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(X){R=X}R&&!(R instanceof Error)&&(Ce(k),O("%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).",x||"React class",v,D,typeof R),Ce(null)),R instanceof Error&&!(R.message in pt)&&(pt[R.message]=!0,Ce(k),O("Failed %s type: %s",v,R.message),Ce(null))}}}var kt=Array.isArray;function et(i){return kt(i)}function mt(i){{var h=typeof Symbol=="function"&&Symbol.toStringTag,v=h&&i[Symbol.toStringTag]||i.constructor.name||"Object";return v}}function tt(i){try{return gt(i),!1}catch{return!0}}function gt(i){return""+i}function vt(i){if(tt(i))return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",mt(i)),gt(i)}var Se=Z.ReactCurrentOwner,At={key:!0,ref:!0,__self:!0,__source:!0},bt,nt,ge;ge={};function o(i){if(Ve.call(i,"ref")){var h=Object.getOwnPropertyDescriptor(i,"ref").get;if(h&&h.isReactWarning)return!1}return i.ref!==void 0}function E(i){if(Ve.call(i,"key")){var h=Object.getOwnPropertyDescriptor(i,"key").get;if(h&&h.isReactWarning)return!1}return i.key!==void 0}function A(i,h){if(typeof i.ref=="string"&&Se.current&&h&&Se.current.stateNode!==h){var v=F(Se.current.type);ge[v]||(O('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(Se.current.type),i.ref),ge[v]=!0)}}function L(i,h){{var v=function(){bt||(bt=!0,O("%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)",h))};v.isReactWarning=!0,Object.defineProperty(i,"key",{get:v,configurable:!0})}}function ie(i,h){{var v=function(){nt||(nt=!0,O("%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)",h))};v.isReactWarning=!0,Object.defineProperty(i,"ref",{get:v,configurable:!0})}}var ve=function(i,h,v,x,k,U,D){var R={$$typeof:n,type:i,key:h,ref:v,props:D,_owner:U};return R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(R,"_self",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(R,"_source",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R};function ue(i,h,v,x,k){{var U,D={},R=null,ce=null;v!==void 0&&(vt(v),R=""+v),E(h)&&(vt(h.key),R=""+h.key),o(h)&&(ce=h.ref,A(h,k));for(U in h)Ve.call(h,U)&&!At.hasOwnProperty(U)&&(D[U]=h[U]);if(i&&i.defaultProps){var X=i.defaultProps;for(U in X)D[U]===void 0&&(D[U]=X[U])}if(R||ce){var q=typeof i=="function"?i.displayName||i.name||"Unknown":i;R&&L(D,q),ce&&ie(D,q)}return ve(i,R,ce,k,x,Se.current,D)}}var yt=Z.ReactCurrentOwner,Et=Z.ReactDebugCurrentFrame;function Ee(i){if(i){var h=i._owner,v=Ie(i.type,i._source,h?h.type:null);Et.setExtraStackFrame(v)}else Et.setExtraStackFrame(null)}var fe;fe=!1;function he(i){return typeof i=="object"&&i!==null&&i.$$typeof===n}function Be(){{if(yt.current){var i=F(yt.current.type);if(i)return`
22
22
 
23
- Check the render method of \``+i+"`."}return""}}function Re(i){{if(i!==void 0){var h=i.fileName.replace(/^.*[\\\/]/,""),v=i.lineNumber;return`
23
+ Check the render method of \``+i+"`."}return""}}function Le(i){{if(i!==void 0){var h=i.fileName.replace(/^.*[\\\/]/,""),v=i.lineNumber;return`
24
24
 
25
- Check your code at `+h+":"+v+"."}return""}}var be={};function Le(i){{var h=Ne();if(!h){var v=typeof i=="string"?i:i.displayName||i.name;v&&(h=`
25
+ Check your code at `+h+":"+v+"."}return""}}var xe={};function Ge(i){{var h=Be();if(!h){var v=typeof i=="string"?i:i.displayName||i.name;v&&(h=`
26
26
 
27
- Check the top-level render call using <`+v+">.")}return h}}function on(i,h){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var v=Le(h);if(be[v])return;be[v]=!0;var O="";i&&i._owner&&i._owner!==mt.current&&(O=" It was passed a child from "+ie(i._owner.type)+"."),pe(i),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,O),pe(null)}}function sn(i,h){{if(typeof i!="object")return;if(Qe(i))for(var v=0;v<i.length;v++){var O=i[v];ae(O)&&on(O,h)}else if(ae(i))i._store&&(i._store.validated=!0);else if(i){var _=b(i);if(typeof _=="function"&&_!==i.entries)for(var A=_.call(i),P;!(P=A.next()).done;)ae(P.value)&&on(P.value,h)}}}function ra(i){{var h=i.type;if(h==null||typeof h=="string")return;var v;if(typeof h=="function")v=h.propTypes;else if(typeof h=="object"&&(h.$$typeof===d||h.$$typeof===y))v=h.propTypes;else return;if(v){var O=ie(h);Te(v,i.props,"prop",O,i)}else if(h.PropTypes!==void 0&&!ne){ne=!0;var _=ie(h);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_||"Unknown")}typeof h.getDefaultProps=="function"&&!h.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function oa(i){{for(var h=Object.keys(i.props),v=0;v<h.length;v++){var O=h[v];if(O!=="children"&&O!=="key"){pe(i),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",O),pe(null);break}}i.ref!==null&&(pe(i),x("Invalid attribute `ref` supplied to `React.Fragment`."),pe(null))}}function cn(i,h,v,O,_,A){{var P=F(i);if(!P){var M="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(M+=" 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 q=Re(_);q?M+=q:M+=Ne();var B;i===null?B="null":Qe(i)?B="array":i!==void 0&&i.$$typeof===n?(B="<"+(ie(i.type)||"Unknown")+" />",M=" Did you accidentally export a JSX literal instead of a component?"):B=typeof i,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",B,M)}var G=ee(i,h,v,_,A);if(G==null)return G;if(P){var oe=h.children;if(oe!==void 0)if(O)if(Qe(oe)){for(var Ue=0;Ue<oe.length;Ue++)sn(oe[Ue],i);Object.freeze&&Object.freeze(oe)}else x("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 sn(oe,i)}return i===e?oa(G):ra(G),G}}function sa(i,h,v){return cn(i,h,v,!0)}function ca(i,h,v){return cn(i,h,v,!1)}var la=ca,ua=sa;Ge.Fragment=e,Ge.jsx=la,Ge.jsxs=ua}()),Ge}process.env.NODE_ENV==="production"?Et.exports=Tn():Et.exports=Rn();var l=Et.exports;function wt(t){return t.title.search("<")>-1?l.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):l.jsx("button",{children:t.title})}const Mn=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"})]}),Pn=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 <`+v+">.")}return h}}function fn(i,h){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var v=Ge(h);if(xe[v])return;xe[v]=!0;var x="";i&&i._owner&&i._owner!==yt.current&&(x=" It was passed a child from "+F(i._owner.type)+"."),Ee(i),O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,x),Ee(null)}}function hn(i,h){{if(typeof i!="object")return;if(et(i))for(var v=0;v<i.length;v++){var x=i[v];he(x)&&fn(x,h)}else if(he(i))i._store&&(i._store.validated=!0);else if(i){var k=se(i);if(typeof k=="function"&&k!==i.entries)for(var U=k.call(i),D;!(D=U.next()).done;)he(D.value)&&fn(D.value,h)}}}function da(i){{var h=i.type;if(h==null||typeof h=="string")return;var v;if(typeof h=="function")v=h.propTypes;else if(typeof h=="object"&&(h.$$typeof===f||h.$$typeof===C))v=h.propTypes;else return;if(v){var x=F(h);Ne(v,i.props,"prop",x,i)}else if(h.PropTypes!==void 0&&!fe){fe=!0;var k=F(h);O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k||"Unknown")}typeof h.getDefaultProps=="function"&&!h.getDefaultProps.isReactClassApproved&&O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fa(i){{for(var h=Object.keys(i.props),v=0;v<h.length;v++){var x=h[v];if(x!=="children"&&x!=="key"){Ee(i),O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),Ee(null);break}}i.ref!==null&&(Ee(i),O("Invalid attribute `ref` supplied to `React.Fragment`."),Ee(null))}}function pn(i,h,v,x,k,U){{var D=T(i);if(!D){var R="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(R+=" 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 ce=Le(k);ce?R+=ce:R+=Be();var X;i===null?X="null":et(i)?X="array":i!==void 0&&i.$$typeof===n?(X="<"+(F(i.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):X=typeof i,O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",X,R)}var q=ue(i,h,v,k,U);if(q==null)return q;if(D){var me=h.children;if(me!==void 0)if(x)if(et(me)){for(var ze=0;ze<me.length;ze++)hn(me[ze],i);Object.freeze&&Object.freeze(me)}else O("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 hn(me,i)}return i===e?fa(q):da(q),q}}function ha(i,h,v){return pn(i,h,v,!0)}function pa(i,h,v){return pn(i,h,v,!1)}var ma=pa,ga=ha;He.Fragment=e,He.jsx=ma,He.jsxs=ga}()),He}process.env.NODE_ENV==="production"?Ot.exports=_n():Ot.exports=Dn();var c=Ot.exports;function Tt(t){return t.title.search("<")>-1?c.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):c.jsx("button",{children:t.title})}const kn=c.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[c.jsx("circle",{cx:"7",cy:"7",r:"6"}),c.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),c.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),An=c.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:c.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 Gt(t){return l.jsx(_t.Reorder.Item,{value:t.title,children:l.jsxs("div",{children:[Pn,l.jsx("span",{children:t.title}),l.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:Mn})]})},t.title)}function Yt(t){const[n,a]=j.useState(!1),[e,o]=j.useState(t.options),u=m=>{t.onDragComplete(m),o(m)},c=m=>{const p=[...e];p.splice(m,1),u(p)},s=[];e.forEach((m,p)=>{s.push(l.jsx(Gt,{index:p,title:m,onDelete:c},m))});let d="dropdown draggable";return t.subdropdown&&(d+=" subdropdown"),l.jsxs("div",{className:d,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(wt,{title:t.title}),l.jsx(_t.Reorder.Group,{axis:"y",values:e,onReorder:u,style:{visibility:n?"visible":"hidden"},children:s})]})}function zt(t){const[n,a]=j.useState(!1),e=[];t.options.map((u,c)=>{t.onSelect!==void 0&&(u.onSelect=t.onSelect),e.push(l.jsx(Ht,{option:u},c))});let o="dropdown";return t.subdropdown&&(o+=" subdropdown"),l.jsxs("div",{className:o,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(wt,{title:t.title}),l.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function Ht(t){const{option:n}=t,[a,e]=j.useState("");let o;switch(n.type){case"draggable":o=l.jsx(Yt,{title:n.title,options:n.value,onDragComplete:u=>{n.onDragComplete!==void 0&&n.onDragComplete(u)},subdropdown:!0});break;case"dropdown":o=l.jsx(zt,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":o=l.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(a!==n.title?e(n.title):e(""))},children:n.title});break}return l.jsx("li",{className:a===n.title?"selected":"",children:o},kt())}function jn(t){let n;function a(c){var d,m,p,y,S,T,R,g,b;let s;switch(c.event){case"custom":N.dispatchEvent({type:L.CUSTOM,value:c.data});break;case"selectComponent":N.dispatchEvent({type:L.SELECT_DROPDOWN,value:c.data});break;case"draggableListUpdate":N.dispatchEvent({type:L.DRAG_UPDATE,value:c.data});break;case"addFolder":(d=t.components.get("debug"))==null||d.addFolder(c.data.name,c.data.params,c.data.parent);break;case"bindObject":(m=t.components.get("debug"))==null||m.bind(c.data.name,c.data.params,c.data.parent);break;case"updateBind":(p=t.components.get("debug"))==null||p.triggerBind(c.data.id,c.data.value);break;case"addButton":(y=t.components.get("debug"))==null||y.button(c.data.name,c.data.callback,c.data.parent);break;case"clickButton":(S=t.components.get("debug"))==null||S.triggerButton(c.data.id);break;case"setSheet":s=(T=t.components.get("theatre"))==null?void 0:T.sheets.get(c.data.sheet),s!==void 0&&(n=s,Fe.setSelection([s]));break;case"setSheetObject":s=(R=t.components.get("theatre"))==null?void 0:R.sheetObjects.get(`${c.data.sheet}_${c.data.key}`),s!==void 0&&Fe.setSelection([s]);break;case"updateSheetObject":s=(g=t.components.get("theatre"))==null?void 0:g.sheetObjectCBs.get(c.data.sheetObject),s!==void 0&&s(c.data.values);break;case"updateTimeline":n=(b=t.components.get("theatre"))==null?void 0:b.sheets.get(c.data.sheet),n!==void 0&&(n.sequence.position=c.data.position);break;case"getObject":N.dispatchEvent({type:L.GET_OBJECT,value:c.data});break;case"updateObject":N.dispatchEvent({type:L.UPDATE_OBJECT,value:c.data});break;case"createTexture":N.dispatchEvent({type:L.CREATE_TEXTURE,value:c.data});break;case"requestMethod":N.dispatchEvent({type:L.REQUEST_METHOD,value:c.data});break}}function e(c){switch(c.event){case"custom":N.dispatchEvent({type:L.CUSTOM,value:c.data});break;case"setObject":N.dispatchEvent({type:L.SET_OBJECT,value:c.data});break;case"setScene":N.dispatchEvent({type:L.SET_SCENE,value:c.data});break}}function o(){Fe.ui.hide()}function u(){Fe.ui.restore(),Fe.onSelectionChange(m=>{m.length<1||m.forEach(p=>{var R;let y=p.address.sheetId,S="setSheet",T={};switch(p.type){case"Theatre_Sheet_PublicAPI":S="setSheet",T={sheet:p.address.sheetId},n=(R=t.components.get("theatre"))==null?void 0:R.sheets.get(p.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":S="setSheetObject",y+=`_${p.address.objectKey}`,T={id:y,sheet:p.address.sheetId,key:p.address.objectKey};break}t.send({event:S,target:"app",data:T})})});let c=0;const s=()=>{if(n!==void 0&&c!==n.sequence.position){c=n.sequence.position;const m=n;t.send({event:"updateTimeline",target:"app",data:{position:c,sheet:m.address.sheetId}})}},d=()=>{s(),requestAnimationFrame(d)};s(),d()}t.listen(c=>{t.editor?e(c):a(c)}),t.editor?u():o()}const _n=`out vec3 worldPosition;
29
+ C11,8.22,10.74,8,10.43,8z`})});function Ht(t){return c.jsx(It.Reorder.Item,{value:t.title,children:c.jsxs("div",{children:[An,c.jsx("span",{children:t.title}),c.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:kn})]})},t.title)}function Kt(t){const[n,a]=M.useState(!1),[e,r]=M.useState(t.options),s=g=>{t.onDragComplete(g),r(g)},p=g=>{const b=[...e];b.splice(g,1),s(b)},l=[];e.forEach((g,b)=>{l.push(c.jsx(Ht,{index:b,title:g,onDelete:p},g))});let f="dropdown draggable";return t.subdropdown&&(f+=" subdropdown"),c.jsxs("div",{className:f,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[c.jsx(Tt,{title:t.title}),c.jsx(It.Reorder.Group,{axis:"y",values:e,onReorder:s,style:{visibility:n?"visible":"hidden"},children:l})]})}function Xt(t){const[n,a]=M.useState(!1),e=[];t.options.map((s,p)=>{t.onSelect!==void 0&&(s.onSelect=t.onSelect),e.push(c.jsx(Zt,{option:s},p))});let r="dropdown";return t.subdropdown&&(r+=" subdropdown"),c.jsxs("div",{className:r,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[c.jsx(Tt,{title:t.title}),c.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function Zt(t){const{option:n}=t,[a,e]=M.useState("");let r;switch(n.type){case"draggable":r=c.jsx(Kt,{title:n.title,options:n.value,onDragComplete:s=>{n.onDragComplete!==void 0&&n.onDragComplete(s)},subdropdown:!0});break;case"dropdown":r=c.jsx(Xt,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":r=c.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(a!==n.title?e(n.title):e(""))},children:n.title});break}return c.jsx("li",{className:a===n.title?"selected":"",children:r},Nt())}function In(t,n,a){function e(s){switch(n.forEach(p=>p(t,s)),s.event){case"custom":z.dispatchEvent({type:Y.CUSTOM,value:s.data});break}}function r(s){switch(a.forEach(p=>p(t,s)),s.event){case"custom":z.dispatchEvent({type:Y.CUSTOM,value:s.data});break}}t.listen(s=>{t.editor?r(s):e(s)})}const Nn=`out vec3 worldPosition;
30
30
  uniform float uDistance;
31
31
 
32
32
  void main() {
@@ -35,7 +35,7 @@ void main() {
35
35
  worldPosition.xz += cameraPosition.xz;
36
36
 
37
37
  gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPosition, 1.0);
38
- }`,kn=`out vec4 fragColor;
38
+ }`,Ln=`out vec4 fragColor;
39
39
  in vec3 worldPosition;
40
40
 
41
41
  uniform float uDivisions;
@@ -102,7 +102,7 @@ void main() {
102
102
  fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
103
103
 
104
104
  if (fragColor.a <= 0.0) discard;
105
- }`;class Dn extends f.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:f.GLSL3,side:f.DoubleSide,transparent:!0,uniforms:{uScale:{value:(n==null?void 0:n.scale)!==void 0?n==null?void 0:n.scale:.1},uDivisions:{value:(n==null?void 0:n.divisions)!==void 0?n==null?void 0:n.divisions:10},uColor:{value:(n==null?void 0:n.color)!==void 0?n==null?void 0:n.color:new f.Color(16777215)},uDistance:{value:(n==null?void 0:n.distance)!==void 0?n==null?void 0:n.distance:1e4},uSubgridOpacity:{value:(n==null?void 0:n.subgridOpacity)!==void 0?n==null?void 0:n.subgridOpacity:.15},uGridOpacity:{value:(n==null?void 0:n.gridOpacity)!==void 0?n==null?void 0:n.gridOpacity:.25}},vertexShader:_n,fragmentShader:kn,name:"InfiniteGrid",depthWrite:!1})}}class Wt extends f.Mesh{constructor(){const a=new Dn;super(new f.PlaneGeometry(2,2),a);Y(this,"gridMaterial");this.gridMaterial=a,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const In=`#include <common>
105
+ }`;class Un extends u.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:u.GLSL3,side:u.DoubleSide,transparent:!0,uniforms:{uScale:{value:(n==null?void 0:n.scale)!==void 0?n==null?void 0:n.scale:.1},uDivisions:{value:(n==null?void 0:n.divisions)!==void 0?n==null?void 0:n.divisions:10},uColor:{value:(n==null?void 0:n.color)!==void 0?n==null?void 0:n.color:new u.Color(16777215)},uDistance:{value:(n==null?void 0:n.distance)!==void 0?n==null?void 0:n.distance:1e4},uSubgridOpacity:{value:(n==null?void 0:n.subgridOpacity)!==void 0?n==null?void 0:n.subgridOpacity:.15},uGridOpacity:{value:(n==null?void 0:n.gridOpacity)!==void 0?n==null?void 0:n.gridOpacity:.25}},vertexShader:Nn,fragmentShader:Ln,name:"InfiniteGrid",depthWrite:!1})}}class Qt extends u.Mesh{constructor(){const a=new Un;super(new u.PlaneGeometry(2,2),a);$(this,"gridMaterial");this.gridMaterial=a,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const Fn=`#include <common>
106
106
  #include <batching_pars_vertex>
107
107
  #include <uv_pars_vertex>
108
108
  #include <color_pars_vertex>
@@ -132,7 +132,7 @@ void main() {
132
132
  #include <logdepthbuf_vertex>
133
133
  #include <clipping_planes_vertex>
134
134
  #include <worldpos_vertex>
135
- }`,An=`
135
+ }`,Vn=`
136
136
  #include <common>
137
137
  #include <uv_pars_fragment>
138
138
  #include <clipping_planes_pars_fragment>
@@ -140,5 +140,5 @@ void main() {
140
140
  void main() {
141
141
  #include <clipping_planes_fragment>
142
142
  gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
143
- }`;class Kt extends f.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:In,fragmentShader:An})}}const ha="";function tt(t){const[n,a]=j.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return l.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const o=!n;t.onToggle!==void 0&&t.onToggle(o),a(o)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:t.label})]}),t.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:t.children})})]})}function Ct(t){const[n,a]=j.useState(!1),e=t.child.children.length>0,o=[];return t.child.children.length>0&&t.child.children.map(u=>{o.push(l.jsx(Ct,{child:u,three:t.three},Math.random()))}),l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[e?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,l.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),l.jsx("div",{className:`icon ${En(t.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:o})})]},Math.random())}function Xt(t){const n=[];return t.child.children.map(a=>{n.push(l.jsx(Ct,{child:a,three:t.three},Math.random()))}),l.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const pa="",Nn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function Ln(t){return"items"in t}function Me(t){function n(e,o){console.log("onChange:",e,o)}const a=[];return t.items.forEach(e=>{Ln(e)?a.push(l.jsx(Me,{title:e.title,items:e.items},Math.random())):a.push(l.jsx(Ye,{title:e.title,prop:e.prop,value:e.value,type:e.type,min:e.min,max:e.max,step:e.step,disabled:e.disabled,onChange:(o,u)=>{e.onChange!==void 0?e.onChange(o,u):n(o,u)}},Math.random()))}),l.jsx(tt,{label:t.title,open:!1,children:a})}function Un(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linewidth"||t==="normalMapType"||t==="precision"||t==="premultipliedAlpha"||t==="shadowSide"||t==="side"||t==="toneMapped"||t==="uniformsGroups"||t==="uniformsNeedUpdate"||t==="userData"||t==="vertexColors"||t==="version"||t==="wireframeLinecap"||t==="wireframeLinejoin"||t==="wireframeLinewidth"||t.slice(0,5)==="blend"||t.slice(0,4)==="clip"||t.slice(0,7)==="polygon"||t.slice(0,7)==="stencil"||t.slice(0,2)==="is")}function Ee(t){switch(t){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"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"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 t}function Fn(t){return t.toLowerCase().search("intensity")>-1||t==="anisotropyRotation"||t==="bumpScale"||t==="clearcoatRoughness"||t==="displacementBias"||t==="displacementScale"||t==="metalness"||t==="opacity"||t==="reflectivity"||t==="refractionRatio"||t==="roughness"||t==="sheenRoughness"||t==="thickness"}function Vn(){const t=document.createElement("input");return t.type="file",new Promise((n,a)=>{t.addEventListener("change",function(){if(t.files===null)a();else{const e=t.files[0],o=new FileReader;o.onload=function(u){n(u.target.result)},o.readAsDataURL(e)}}),t.click()})}function Zt(t,n,a){const e=[];for(const o in t){if(!Un(o))continue;const u=typeof t[o],c=t[o];if(u==="boolean"||u==="number"||u==="string"){const s={title:Ee(o),prop:o,type:u,value:c,min:void 0,max:void 0,onChange:(d,m)=>{var y;a.updateObject(n.uuid,`material.${d}`,m),u==="boolean"&&a.updateObject(n.uuid,"material.needsUpdate",!0);const p=(y=a.scene)==null?void 0:y.getObjectByProperty("uuid",n.uuid);p!==void 0&&J(p,`material.${d}`,m)}};Fn(o)&&(s.value=Number(c),s.type="range",s.min=0,s.max=1,s.step=.01),e.push(s)}else if(u==="object")if(c.isColor)e.push({title:Ee(o),prop:o,type:"color",value:c,onChange:(s,d)=>{var y;const m=new f.Color(d);a.updateObject(n.uuid,`material.${s}`,m);const p=(y=a.scene)==null?void 0:y.getObjectByProperty("uuid",n.uuid);p!==void 0&&J(p,`material.${s}`,m)}});else if(Array.isArray(c)){const s=[];for(const d in c)s.push({title:`${d}`,type:`${typeof c[d]}`,value:c[d],onChange:(m,p)=>{var S;a.updateObject(n.uuid,`material.${o}`,p);const y=(S=a.scene)==null?void 0:S.getObjectByProperty("uuid",n.uuid);y!==void 0&&J(y,`material.${o}`,p)}});e.push({title:Ee(o),items:s})}else{const s=[];for(const d in c){const m=c[d];switch(typeof m){case"boolean":case"number":case"string":d==="src"?e.push({title:Ee(o),type:"image",value:m,onChange:(y,S)=>{var R;a.createTexture(n.uuid,`material.${o}`,S);const T=(R=a.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);T!==void 0&&yt(S).then(g=>{J(T,`material.${o}`,g),J(T,"material.needsUpdate",!0)})}}):s.push({title:`${Ee(d)}`,prop:`material.${o}.${d}`,type:`${typeof t[o][d]}`,value:c[d],onChange:(y,S)=>{var R;a.updateObject(n.uuid,`material.${o}.${d}`,S);const T=(R=a.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);T!==void 0&&J(T,`material.${o}.${d}`,S)}});break;case"object":m.value!==void 0&&m.value.src!==void 0?s.push({title:Ee(d),type:"image",value:m.value.src,onChange:(y,S)=>{var R;a.createTexture(n.uuid,`material.${o}.${d}.value`,S);const T=(R=a.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);T!==void 0&&yt(S).then(g=>{J(T,`material.${o}.${d}.value`,g)})}}):s.push({title:d,type:`${typeof m.value}`,value:m.value,onChange:(y,S)=>{var R;a.updateObject(n.uuid,`material.${o}.${d}.value`,S);const T=(R=a.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);T!==void 0&&J(T,`material.${o}.${d}.value`,S)}});break}}s.length>0&&e.push({title:Ee(o),items:s})}else c!==void 0&&console.log("other:",o,u,c)}return e.sort((o,u)=>o.title<u.title?-1:o.title>u.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function Bn(t,n){const a=t.material;if(Array.isArray(a)){const e=[],o=a.length;for(let u=0;u<o;u++)e.push(l.jsx(Me,{title:`Material ${u}`,items:Zt(a[u],t,n)},`Material ${u}`));return l.jsx(l.Fragment,{children:e})}else return l.jsx(Me,{title:"Material",items:Zt(a,t,n)})}function Ye(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=It(t.value));const[a,e]=j.useState(n),o=j.useRef(null),u=j.useRef(null),c=j.useRef(null);j.useEffect(()=>{var V;let p=!1,y=-1,S=0,T=Number(a);const R=H=>{p=!0,S=T,y=H.clientX},g=H=>{if(!p)return;const $=t.step!==void 0?t.step:1,se=(H.clientX-y)*$;T=Number((S+se).toFixed(4)),u.current!==null&&(u.current.value=T.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,T)},b=()=>{p=!1},E=()=>{p=!1},x=t.type==="number";return x&&((V=o.current)==null||V.addEventListener("mousedown",R,!1),document.addEventListener("mouseup",b,!1),document.addEventListener("mousemove",g,!1),document.addEventListener("contextmenu",E,!1)),()=>{var H;x&&((H=o.current)==null||H.removeEventListener("mousedown",R),document.removeEventListener("mouseup",b),document.removeEventListener("mousemove",g),document.removeEventListener("contextmenu",E))}},[a]);const s=t.type==="string"&&(a.length>100||a.search(`
144
- `)>-1),d=s||t.type==="image",m=p=>{let y=p.target.value;t.type==="boolean"&&(y=p.target.checked),e(y),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,y)};return l.jsxs("div",{className:`field ${d?"block":""}`,children:[t.type!=="button"&&l.jsx("label",{ref:o,children:t.title},"fieldLabel"),t.type==="string"&&!s&&l.jsx("input",{type:"text",disabled:t.disabled,onChange:m,value:a}),t.type==="string"&&s&&l.jsx("textarea",{cols:50,rows:10,disabled:!0,onChange:m,value:a}),t.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:m,checked:a}),t.type==="number"&&l.jsx("input",{ref:u,type:"number",value:a,min:t.min,max:t.max,step:t.step,onChange:m}),t.type==="range"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:m,className:"min"}),l.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:m})]}),t.type==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:m,className:"color"}),l.jsx("input",{type:"color",value:a,onChange:m})]}),t.type==="button"&&l.jsx("button",{onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&l.jsx("img",{ref:c,onClick:()=>{Vn().then(p=>{c.current.src=p,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,p)})},src:a.length>0?a:Nn})]})}function Jt(t){switch(t){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 t}function Gn(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:Jt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(o,u)=>{var s;n.updateObject(t.uuid,o,u),n.requestMethod(t.uuid,"updateProjectionMatrix");const c=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);c!==void 0&&(J(c,o,u),c.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:Jt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(o,u)=>{var s;n.updateObject(t.uuid,o,u),n.requestMethod(t.uuid,"updateProjectionMatrix");const c=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);c!==void 0&&(J(c,o,u),c.updateProjectionMatrix())}});return l.jsx(Me,{title:"Camera",items:a})}const Yn=Math.PI/180,zn=180/Math.PI;function Hn(t){return t*Yn}function St(t){return t*zn}function Wn(t,n){const a=new f.Matrix4;a.elements=t.matrix;const e=new f.Vector3,o=new f.Euler,u=new f.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),o.setFromRotationMatrix(a),u.setFromMatrixScale(a));const c=(d,m)=>{var y;n.updateObject(t.uuid,d,m);const p=(y=n.scene)==null?void 0:y.getObjectByProperty("uuid",t.uuid);p!==void 0&&J(p,d,m)},s=(d,m)=>{c(d,Hn(m))};return l.jsx(Me,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:c},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:c},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:c},{title:"Rotation X",prop:"rotation.x",type:"number",value:et(St(o.x)),min:-360,max:360,step:.1,onChange:s},{title:"Rotation Y",prop:"rotation.y",type:"number",value:et(St(o.y)),min:-360,max:360,step:.1,onChange:s},{title:"Rotation Z",prop:"rotation.z",type:"number",value:et(St(o.z)),min:-360,max:360,step:.1,onChange:s},{title:"Scale X",prop:"scale.x",type:"number",value:u.x,step:.01,onChange:c},{title:"Scale Y",prop:"scale.y",type:"number",value:u.y,step:.01,onChange:c},{title:"Scale Z",prop:"scale.z",type:"number",value:u.z,step:.01,onChange:c}]})}function Qt(t){switch(t){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"}return t}function Kn(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const o=t.lightInfo[e];o!==void 0&&(o.isColor!==void 0?a.push({title:Qt(e),prop:e,type:"color",value:o,onChange:(u,c)=>{var m;const s=new f.Color(c);n.updateObject(t.uuid,u,s);const d=(m=n.scene)==null?void 0:m.getObjectByProperty("uuid",t.uuid);d!==void 0&&J(d,u,s)}}):a.push({title:Qt(e),prop:e,type:typeof o,value:o,step:typeof o=="number"?.01:void 0,onChange:(u,c)=>{var d;n.updateObject(t.uuid,u,c);const s=(d=n.scene)==null?void 0:d.getObjectByProperty("uuid",t.uuid);s!==void 0&&J(s,u,c)}}))}return l.jsx(Me,{title:"Light",items:a})}function qt(t){const[n,a]=j.useState(-1),[e,o]=j.useState({name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0});j.useEffect(()=>{function c(s){const d=s.value;o(d),a(Date.now())}return N.addEventListener(L.SET_OBJECT,c),()=>{N.removeEventListener(L.SET_OBJECT,c)}},[]);const u=e.type.toLowerCase();return l.jsx("div",{id:"Inspector",className:t.class,children:e.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx(Ye,{type:"string",title:"Name",prop:"name",value:e.name,disabled:!0}),l.jsx(Ye,{type:"string",title:"Type",prop:"type",value:e.type,disabled:!0}),l.jsx(Ye,{type:"string",title:"UUID",prop:"uuid",value:e.uuid,disabled:!0}),l.jsx(Ye,{type:"boolean",title:"Visible",prop:"visible",value:e.visible,onChange:(c,s)=>{var m;t.three.updateObject(e.uuid,c,s);const d=(m=t.three.scene)==null?void 0:m.getObjectByProperty("uuid",e.uuid);d!==void 0&&J(d,c,s)}})]}),l.jsxs(l.Fragment,{children:[Wn(e,t.three),u.search("camera")>-1?Gn(e,t.three):null,u.search("light")>-1?Kn(e,t.three):null,u.search("mesh")>-1?Bn(e,t.three):null]})]})},n)}class Xn extends j.Component{constructor(a){super(a);Y(this,"three");Y(this,"setScene",a=>{this.setState(()=>({scene:a.value}))});this.state={scene:a.scene!==void 0?a.scene:null},this.three=a.three,N.addEventListener(L.SET_SCENE,this.setScene)}componentWillUnmount(){N.removeEventListener(L.SET_SCENE,this.setScene)}render(){var o;const a=this.componentState.scene!==null,e="Hierarchy - "+(a?`${(o=this.componentState.scene)==null?void 0:o.name}`:"No Scene");return l.jsx("div",{id:"SceneHierarchy",children:l.jsxs(l.Fragment,{children:[l.jsx(tt,{label:e,open:!0,children:l.jsx(l.Fragment,{children:a&&l.jsx(Xt,{child:this.componentState.scene,three:this.three})})}),l.jsx(tt,{label:"Inspector",children:l.jsx(qt,{three:this.three},"Inspector")})]})},"SceneHierarchy")}get componentState(){return this.state}}function Zn(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=s=>{var m;if(!n())return;const d=(m=t.three.scene)==null?void 0:m.getObjectByProperty("uuid",s.value);d!==void 0&&t.three.setObject(d)},e=(s,d,m)=>{var y;if(!n())return;const p=(y=t.three.scene)==null?void 0:y.getObjectByProperty("uuid",s);p!==void 0&&J(p,d,m)},o=s=>{if(!n())return;const d=s.value,{key:m,value:p,uuid:y}=d;e(y,m,p)},u=s=>{if(!n())return;const d=s.value;yt(d.value).then(m=>{e(d.uuid,d.key,m),e(d.uuid,"material.needsUpdate",!0)})},c=s=>{var S;if(!n())return;const{key:d,uuid:m,value:p}=s.value,y=(S=t.three.scene)==null?void 0:S.getObjectByProperty("uuid",m);if(y!==void 0)try{y[d](p)}catch(T){console.log("Error requesting method:"),console.log(T),console.log(d),console.log(p)}};return j.useEffect(()=>(N.addEventListener(L.GET_OBJECT,a),N.addEventListener(L.UPDATE_OBJECT,o),N.addEventListener(L.CREATE_TEXTURE,u),N.addEventListener(L.REQUEST_METHOD,c),()=>{N.removeEventListener(L.GET_OBJECT,a),N.removeEventListener(L.UPDATE_OBJECT,o),N.removeEventListener(L.CREATE_TEXTURE,u),N.removeEventListener(L.REQUEST_METHOD,c)}),[]),null}const $t={type:"change"},xt={type:"start"},en={type:"end"},nt=new f.Ray,tn=new f.Plane,Jn=Math.cos(70*f.MathUtils.DEG2RAD);class Qn extends f.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new f.Vector3,this.cursor=new f.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:f.MOUSE.ROTATE,MIDDLE:f.MOUSE.DOLLY,RIGHT:f.MOUSE.PAN},this.touches={ONE:f.TOUCH.ROTATE,TWO:f.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return s.phi},this.getAzimuthalAngle=function(){return s.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(r){r.addEventListener("keydown",qe),this._domElementKeyEvents=r},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",qe),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent($t),e.update(),u=o.NONE},this.update=function(){const r=new f.Vector3,w=new f.Quaternion().setFromUnitVectors(n.up,new f.Vector3(0,1,0)),k=w.clone().invert(),I=new f.Vector3,X=new f.Quaternion,de=new f.Vector3,ee=2*Math.PI;return function(gt=null){const pe=e.object.position;r.copy(pe).sub(e.target),r.applyQuaternion(w),s.setFromVector3(r),e.autoRotate&&u===o.NONE&&K(D(gt)),e.enableDamping?(s.theta+=d.theta*e.dampingFactor,s.phi+=d.phi*e.dampingFactor):(s.theta+=d.theta,s.phi+=d.phi);let ne=e.minAzimuthAngle,ae=e.maxAzimuthAngle;isFinite(ne)&&isFinite(ae)&&(ne<-Math.PI?ne+=ee:ne>Math.PI&&(ne-=ee),ae<-Math.PI?ae+=ee:ae>Math.PI&&(ae-=ee),ne<=ae?s.theta=Math.max(ne,Math.min(ae,s.theta)):s.theta=s.theta>(ne+ae)/2?Math.max(ne,s.theta):Math.min(ae,s.theta)),s.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,s.phi)),s.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(p,e.dampingFactor):e.target.add(p),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&se||e.object.isOrthographicCamera?s.radius=De(s.radius):s.radius=De(s.radius*m),r.setFromSpherical(s),r.applyQuaternion(k),pe.copy(e.target).add(r),e.object.lookAt(e.target),e.enableDamping===!0?(d.theta*=1-e.dampingFactor,d.phi*=1-e.dampingFactor,p.multiplyScalar(1-e.dampingFactor)):(d.set(0,0,0),p.set(0,0,0));let Ne=!1;if(e.zoomToCursor&&se){let Re=null;if(e.object.isPerspectiveCamera){const be=r.length();Re=De(be*m);const Le=be-Re;e.object.position.addScaledVector(H,Le),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const be=new f.Vector3($.x,$.y,0);be.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),Ne=!0;const Le=new f.Vector3($.x,$.y,0);Le.unproject(e.object),e.object.position.sub(Le).add(be),e.object.updateMatrixWorld(),Re=r.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;Re!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(Re).add(e.object.position):(nt.origin.copy(e.object.position),nt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(nt.direction))<Jn?n.lookAt(e.target):(tn.setFromNormalAndCoplanarPoint(e.object.up,e.target),nt.intersectPlane(tn,e.target))))}else e.object.isOrthographicCamera&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),Ne=!0);return m=1,se=!1,Ne||I.distanceToSquared(e.object.position)>c||8*(1-X.dot(e.object.quaternion))>c||de.distanceToSquared(e.target)>0?(e.dispatchEvent($t),I.copy(e.object.position),X.copy(e.object.quaternion),de.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",ve),e.domElement.removeEventListener("pointerdown",Je),e.domElement.removeEventListener("pointercancel",Te),e.domElement.removeEventListener("wheel",dt),e.domElement.removeEventListener("pointermove",ge),e.domElement.removeEventListener("pointerup",Te),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",qe),e._domElementKeyEvents=null)};const e=this,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=o.NONE;const c=1e-6,s=new f.Spherical,d=new f.Spherical;let m=1;const p=new f.Vector3,y=new f.Vector2,S=new f.Vector2,T=new f.Vector2,R=new f.Vector2,g=new f.Vector2,b=new f.Vector2,E=new f.Vector2,x=new f.Vector2,V=new f.Vector2,H=new f.Vector3,$=new f.Vector2;let se=!1;const W=[],he={};function D(r){return r!==null?2*Math.PI/60*e.autoRotateSpeed*r:2*Math.PI/60/60*e.autoRotateSpeed}function F(r){const w=Math.abs(r)/(100*(window.devicePixelRatio|0));return Math.pow(.95,e.zoomSpeed*w)}function K(r){d.theta-=r}function ce(r){d.phi-=r}const ie=function(){const r=new f.Vector3;return function(k,I){r.setFromMatrixColumn(I,0),r.multiplyScalar(-k),p.add(r)}}(),le=function(){const r=new f.Vector3;return function(k,I){e.screenSpacePanning===!0?r.setFromMatrixColumn(I,1):(r.setFromMatrixColumn(I,0),r.crossVectors(e.object.up,r)),r.multiplyScalar(k),p.add(r)}}(),re=function(){const r=new f.Vector3;return function(k,I){const X=e.domElement;if(e.object.isPerspectiveCamera){const de=e.object.position;r.copy(de).sub(e.target);let ee=r.length();ee*=Math.tan(e.object.fov/2*Math.PI/180),ie(2*k*ee/X.clientHeight,e.object.matrix),le(2*I*ee/X.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(ie(k*(e.object.right-e.object.left)/e.object.zoom/X.clientWidth,e.object.matrix),le(I*(e.object.top-e.object.bottom)/e.object.zoom/X.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function _e(r){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m/=r:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function He(r){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m*=r:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function ke(r,w){if(!e.zoomToCursor)return;se=!0;const k=e.domElement.getBoundingClientRect(),I=r-k.left,X=w-k.top,de=k.width,ee=k.height;$.x=I/de*2-1,$.y=-(X/ee)*2+1,H.set($.x,$.y,1).unproject(e.object).sub(e.object.position).normalize()}function De(r){return Math.max(e.minDistance,Math.min(e.maxDistance,r))}function We(r){y.set(r.clientX,r.clientY)}function rt(r){ke(r.clientX,r.clientX),E.set(r.clientX,r.clientY)}function Ke(r){R.set(r.clientX,r.clientY)}function ot(r){S.set(r.clientX,r.clientY),T.subVectors(S,y).multiplyScalar(e.rotateSpeed);const w=e.domElement;K(2*Math.PI*T.x/w.clientHeight),ce(2*Math.PI*T.y/w.clientHeight),y.copy(S),e.update()}function Tt(r){x.set(r.clientX,r.clientY),V.subVectors(x,E),V.y>0?_e(F(V.y)):V.y<0&&He(F(V.y)),E.copy(x),e.update()}function Rt(r){g.set(r.clientX,r.clientY),b.subVectors(g,R).multiplyScalar(e.panSpeed),re(b.x,b.y),R.copy(g),e.update()}function Xe(r){ke(r.clientX,r.clientY),r.deltaY<0?He(F(r.deltaY)):r.deltaY>0&&_e(F(r.deltaY)),e.update()}function Ze(r){let w=!1;switch(r.code){case e.keys.UP:r.ctrlKey||r.metaKey||r.shiftKey?ce(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):re(0,e.keyPanSpeed),w=!0;break;case e.keys.BOTTOM:r.ctrlKey||r.metaKey||r.shiftKey?ce(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):re(0,-e.keyPanSpeed),w=!0;break;case e.keys.LEFT:r.ctrlKey||r.metaKey||r.shiftKey?K(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):re(e.keyPanSpeed,0),w=!0;break;case e.keys.RIGHT:r.ctrlKey||r.metaKey||r.shiftKey?K(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):re(-e.keyPanSpeed,0),w=!0;break}w&&(r.preventDefault(),e.update())}function Se(r){if(W.length===1)y.set(r.pageX,r.pageY);else{const w=ue(r),k=.5*(r.pageX+w.x),I=.5*(r.pageY+w.y);y.set(k,I)}}function Ie(r){if(W.length===1)R.set(r.pageX,r.pageY);else{const w=ue(r),k=.5*(r.pageX+w.x),I=.5*(r.pageY+w.y);R.set(k,I)}}function xe(r){const w=ue(r),k=r.pageX-w.x,I=r.pageY-w.y,X=Math.sqrt(k*k+I*I);E.set(0,X)}function Mt(r){e.enableZoom&&xe(r),e.enablePan&&Ie(r)}function st(r){e.enableZoom&&xe(r),e.enableRotate&&Se(r)}function ct(r){if(W.length==1)S.set(r.pageX,r.pageY);else{const k=ue(r),I=.5*(r.pageX+k.x),X=.5*(r.pageY+k.y);S.set(I,X)}T.subVectors(S,y).multiplyScalar(e.rotateSpeed);const w=e.domElement;K(2*Math.PI*T.x/w.clientHeight),ce(2*Math.PI*T.y/w.clientHeight),y.copy(S)}function lt(r){if(W.length===1)g.set(r.pageX,r.pageY);else{const w=ue(r),k=.5*(r.pageX+w.x),I=.5*(r.pageY+w.y);g.set(k,I)}b.subVectors(g,R).multiplyScalar(e.panSpeed),re(b.x,b.y),R.copy(g)}function Oe(r){const w=ue(r),k=r.pageX-w.x,I=r.pageY-w.y,X=Math.sqrt(k*k+I*I);x.set(0,X),V.set(0,Math.pow(x.y/E.y,e.zoomSpeed)),_e(V.y),E.copy(x);const de=(r.pageX+w.x)*.5,ee=(r.pageY+w.y)*.5;ke(de,ee)}function Ae(r){e.enableZoom&&Oe(r),e.enablePan&&lt(r)}function ut(r){e.enableZoom&&Oe(r),e.enableRotate&&ct(r)}function Je(r){e.enabled!==!1&&(W.length===0&&(e.domElement.setPointerCapture(r.pointerId),e.domElement.addEventListener("pointermove",ge),e.domElement.addEventListener("pointerup",Te)),jt(r),r.pointerType==="touch"?ft(r):Pt(r))}function ge(r){e.enabled!==!1&&(r.pointerType==="touch"?ht(r):Qe(r))}function Te(r){pt(r),W.length===0&&(e.domElement.releasePointerCapture(r.pointerId),e.domElement.removeEventListener("pointermove",ge),e.domElement.removeEventListener("pointerup",Te)),e.dispatchEvent(en),u=o.NONE}function Pt(r){let w;switch(r.button){case 0:w=e.mouseButtons.LEFT;break;case 1:w=e.mouseButtons.MIDDLE;break;case 2:w=e.mouseButtons.RIGHT;break;default:w=-1}switch(w){case f.MOUSE.DOLLY:if(e.enableZoom===!1)return;rt(r),u=o.DOLLY;break;case f.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(e.enablePan===!1)return;Ke(r),u=o.PAN}else{if(e.enableRotate===!1)return;We(r),u=o.ROTATE}break;case f.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(e.enableRotate===!1)return;We(r),u=o.ROTATE}else{if(e.enablePan===!1)return;Ke(r),u=o.PAN}break;default:u=o.NONE}u!==o.NONE&&e.dispatchEvent(xt)}function Qe(r){switch(u){case o.ROTATE:if(e.enableRotate===!1)return;ot(r);break;case o.DOLLY:if(e.enableZoom===!1)return;Tt(r);break;case o.PAN:if(e.enablePan===!1)return;Rt(r);break}}function dt(r){e.enabled===!1||e.enableZoom===!1||u!==o.NONE||(r.preventDefault(),e.dispatchEvent(xt),Xe(r),e.dispatchEvent(en))}function qe(r){e.enabled===!1||e.enablePan===!1||Ze(r)}function ft(r){switch($e(r),W.length){case 1:switch(e.touches.ONE){case f.TOUCH.ROTATE:if(e.enableRotate===!1)return;Se(r),u=o.TOUCH_ROTATE;break;case f.TOUCH.PAN:if(e.enablePan===!1)return;Ie(r),u=o.TOUCH_PAN;break;default:u=o.NONE}break;case 2:switch(e.touches.TWO){case f.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Mt(r),u=o.TOUCH_DOLLY_PAN;break;case f.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;st(r),u=o.TOUCH_DOLLY_ROTATE;break;default:u=o.NONE}break;default:u=o.NONE}u!==o.NONE&&e.dispatchEvent(xt)}function ht(r){switch($e(r),u){case o.TOUCH_ROTATE:if(e.enableRotate===!1)return;ct(r),e.update();break;case o.TOUCH_PAN:if(e.enablePan===!1)return;lt(r),e.update();break;case o.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ae(r),e.update();break;case o.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;ut(r),e.update();break;default:u=o.NONE}}function ve(r){e.enabled!==!1&&r.preventDefault()}function jt(r){W.push(r.pointerId)}function pt(r){delete he[r.pointerId];for(let w=0;w<W.length;w++)if(W[w]==r.pointerId){W.splice(w,1);return}}function $e(r){let w=he[r.pointerId];w===void 0&&(w=new f.Vector2,he[r.pointerId]=w),w.set(r.pageX,r.pageY)}function ue(r){const w=r.pointerId===W[0]?W[1]:W[0];return he[w]}e.domElement.addEventListener("contextmenu",ve),e.domElement.addEventListener("pointerdown",Je),e.domElement.addEventListener("pointercancel",Te),e.domElement.addEventListener("wheel",dt,{passive:!1}),this.update()}}const Ot=t=>{const[n,a]=j.useState(!1),[e,o]=j.useState(t.options[t.index]),u=()=>{a(!n)},c=s=>{s!==e&&(t.onSelect(s),o(s)),a(!1)};return l.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[l.jsx("div",{className:"dropdown-toggle",onClick:u,children:e}),n&&l.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>l.jsx("li",{onClick:()=>c(s),children:s},s))})]})},we=j.forwardRef(function(n,a){const e=n.options.indexOf(n.camera.name);return l.jsxs("div",{className:"CameraWindow",children:[l.jsx("div",{ref:a,className:"clickable"}),l.jsx(Ot,{index:e,options:n.options,onSelect:n.onSelect,up:!0})]})}),nn=["Single","Side by Side","Stacked","Quad"],Q=new Map,Z=new Map,fe=new Map;function Ce(t,n){const a=new f.OrthographicCamera(-100,100,100,-100,50,3e3);return a.name=t,a.position.copy(n),a.lookAt(0,0,0),Q.set(t,a),a}Ce("Top",new f.Vector3(0,1e3,0)),Ce("Bottom",new f.Vector3(0,-1e3,0)),Ce("Left",new f.Vector3(-1e3,0,0)),Ce("Right",new f.Vector3(1e3,0,0)),Ce("Front",new f.Vector3(0,0,1e3)),Ce("Back",new f.Vector3(0,0,-1e3)),Ce("Orthographic",new f.Vector3(1e3,1e3,1e3));const at=new f.PerspectiveCamera(60,1,50,3e3);at.name="Debug",at.position.set(500,500,500),at.lookAt(0,0,0),Q.set("Debug",at);const an=["Renderer","Depth","Normals","UVs","Wireframe"],qn=new f.MeshDepthMaterial,$n=new f.MeshNormalMaterial,ea=new Kt,ta=new f.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),ma="";let it="Renderer";const U=new f.Scene;U.name="Debug Scene";let ze=new f.Scene;U.add(ze);const na=new Wt;U.add(na);const rn=new f.AxesHelper(500);rn.name="axisHelper",U.add(rn);let z=Q.get("Debug"),te=Q.get("Orthographic"),Pe=Q.get("Front"),je=Q.get("Top");function aa(t){const[n,a]=j.useState(t.mode!==void 0?t.mode:"Quad"),[e,o]=j.useState(null),u=j.useRef(null),c=j.useRef(null),s=j.useRef(null),d=j.useRef(null),m=j.useRef(null),p=(g,b)=>{const E=Z.get(g.name);E!==void 0&&E.dispose(),Z.delete(g.name);const x=fe.get(g.name);x!==void 0&&(U.remove(x),x.dispose()),fe.delete(g.name);const V=new Qn(g,b);switch(V.enableDamping=!0,V.dampingFactor=.05,g.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":V.enableRotate=!1;break}if(Z.set(g.name,V),g instanceof f.PerspectiveCamera){const H=new f.CameraHelper(g);fe.set(g.name,H),U.add(H)}},y=g=>{const b=fe.get(g.name);b!==void 0&&(U.remove(b),b.dispose(),fe.delete(g.name));const E=Z.get(g.name);E!==void 0&&(E.dispose(),Z.delete(g.name))},S=()=>{Z.forEach((g,b)=>{g.dispose();const E=fe.get(b);E!==void 0&&(U.remove(E),E.dispose()),fe.delete(b),Z.delete(b)}),Z.clear(),fe.clear()},T=()=>{switch(n){case"Single":p(z,c.current);break;case"Side by Side":case"Stacked":p(z,c.current),p(te,s.current);break;case"Quad":p(z,c.current),p(te,s.current),p(Pe,d.current),p(je,m.current);break}};j.useEffect(()=>{const g=new f.WebGLRenderer({canvas:u.current,stencil:!1});g.autoClear=!1,g.shadowMap.enabled=!0,g.setPixelRatio(devicePixelRatio),g.setClearColor(0),o(g)},[]),j.useEffect(()=>{const g=()=>{bt(ze),U.remove(ze),t.three.scene!==void 0&&(ze=t.three.scene,U.add(ze))};return N.addEventListener(L.SET_SCENE,g),()=>{N.removeEventListener(L.SET_SCENE,g)}},[]),j.useEffect(()=>{if(e===null)return;let g=window.innerWidth,b=window.innerHeight,E=Math.floor(g/2),x=Math.floor(b/2),V=-1;const H=()=>{g=window.innerWidth-300,b=window.innerHeight,E=Math.floor(g/2),x=Math.floor(b/2),e.setSize(g,b);let D=g,F=b;switch(n){case"Side by Side":D=E,F=b;break;case"Stacked":D=g,F=x;break;case"Quad":D=E,F=x;break}Q.forEach(K=>{var ce;K instanceof f.OrthographicCamera?(K.left=D/-2,K.right=D/2,K.top=F/2,K.bottom=F/-2,K.updateProjectionMatrix()):K instanceof f.PerspectiveCamera&&(K.aspect=D/F,K.updateProjectionMatrix(),(ce=fe.get(K.name))==null||ce.update())})},$=()=>{e.setViewport(0,0,g,b),e.setScissor(0,0,g,b),e.render(U,z)},se=()=>{if(n==="Side by Side")e.setViewport(0,0,E,b),e.setScissor(0,0,E,b),e.render(U,z),e.setViewport(E,0,E,b),e.setScissor(E,0,E,b),e.render(U,te);else{const D=b-x;e.setViewport(0,D,g,x),e.setScissor(0,D,g,x),e.render(U,z),e.setViewport(0,0,g,x),e.setScissor(0,0,g,x),e.render(U,te)}},W=()=>{let D=0,F=0;F=b-x,D=0,e.setViewport(D,F,E,x),e.setScissor(D,F,E,x),e.render(U,z),D=E,e.setViewport(D,F,E,x),e.setScissor(D,F,E,x),e.render(U,te),F=0,D=0,e.setViewport(D,F,E,x),e.setScissor(D,F,E,x),e.render(U,Pe),D=E,e.setViewport(D,F,E,x),e.setScissor(D,F,E,x),e.render(U,je)},he=()=>{switch(Z.forEach(D=>{D.update()}),e.clear(),n){case"Single":$();break;case"Side by Side":case"Stacked":se();break;case"Quad":W();break}V=requestAnimationFrame(he)};return T(),window.addEventListener("resize",H),H(),he(),()=>{window.removeEventListener("resize",H),cancelAnimationFrame(V),V=-1}},[n,e]);const R=[];return Q.forEach((g,b)=>{R.push(b)}),l.jsxs("div",{className:"multiview",children:[l.jsx("canvas",{ref:u}),l.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,children:[n==="Single"&&l.jsx(l.Fragment,{children:l.jsx(we,{camera:z,options:R,ref:c,onSelect:g=>{var E;(E=Z.get(z.name))==null||E.dispose();const b=Q.get(g);b!==void 0&&(y(z),z=b,p(b,c.current))}})}),(n==="Side by Side"||n==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(we,{camera:z,options:R,ref:c,onSelect:g=>{var E;(E=Z.get(z.name))==null||E.dispose();const b=Q.get(g);b!==void 0&&(y(z),z=b,p(b,c.current))}}),l.jsx(we,{camera:te,options:R,ref:s,onSelect:g=>{var E;(E=Z.get(te.name))==null||E.dispose();const b=Q.get(g);b!==void 0&&(y(te),te=b,p(b,s.current))}})]}),n==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(we,{camera:z,options:R,ref:c,onSelect:g=>{var E;(E=Z.get(z.name))==null||E.dispose();const b=Q.get(g);b!==void 0&&(y(z),z=b,p(b,c.current))}}),l.jsx(we,{camera:te,options:R,ref:s,onSelect:g=>{var E;(E=Z.get(te.name))==null||E.dispose();const b=Q.get(g);b!==void 0&&(y(te),te=b,p(b,s.current))}}),l.jsx(we,{camera:Pe,options:R,ref:d,onSelect:g=>{var E;(E=Z.get(Pe.name))==null||E.dispose();const b=Q.get(g);b!==void 0&&(y(Pe),Pe=b,p(b,d.current))}}),l.jsx(we,{camera:je,options:R,ref:m,onSelect:g=>{var E;(E=Z.get(je.name))==null||E.dispose();const b=Q.get(g);b!==void 0&&(y(je),je=b,p(b,m.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(Ot,{index:nn.indexOf(n),options:nn,onSelect:g=>{g!==n&&(S(),a(g))}}),l.jsx(Ot,{index:an.indexOf(it),options:an,onSelect:g=>{if(g!==it)switch(it=g,it){case"Depth":U.overrideMaterial=qn;break;case"Normals":U.overrideMaterial=$n;break;default:case"Renderer":U.overrideMaterial=null;break;case"Wireframe":U.overrideMaterial=ta;break;case"UVs":U.overrideMaterial=ea;break}}})]})]})}const ga="";function ia(t){return l.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[l.jsx("header",{children:t.header}),t.children,l.jsx("footer",{children:t.footer})]})}C.Accordion=tt,C.Application=vn,C.BaseRemote=Ve,C.ChildObject=Ct,C.ContainerObject=Xt,C.Draggable=Yt,C.DraggableItem=Gt,C.Dropdown=zt,C.DropdownItem=Ht,C.Editor=ia,C.InfiniteGridHelper=Wt,C.Inspector=qt,C.MultiView=aa,C.NavButton=wt,C.RemoteComponents=bn,C.RemoteController=jn,C.RemoteTheatre=yn,C.RemoteThree=xn,C.RemoteTweakpane=On,C.SceneHierarchy=Xn,C.SceneInspector=Zn,C.ToolEvents=L,C.UVMaterial=Kt,C.clamp=pn,C.colorToHex=It,C.debugDispatcher=N,C.dispose=bt,C.disposeMaterial=Nt,C.disposeTexture=gn,C.distance=mn,C.hierarchyUUID=vt,C.isColor=Dt,C.randomID=kt,C.resetThreeObjects=At,C.round=et,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
143
+ }`;class Jt extends u.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:Fn,fragmentShader:Vn})}}const Ea="";function it(t){const[n,a]=M.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return c.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[c.jsxs("button",{className:"toggle",onClick:()=>{const r=!n;t.onToggle!==void 0&&t.onToggle(r),a(r)},children:[c.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),c.jsx("p",{className:"label",children:t.label})]}),t.button,c.jsx("div",{className:n?"open":"",children:c.jsx("div",{children:t.children})})]})}function Mt(t){const[n,a]=M.useState(!1),e=t.child.children.length>0,r=[];return t.child.children.length>0&&t.child.children.map(s=>{r.push(c.jsx(Mt,{child:s,three:t.three},Math.random()))}),c.jsxs("div",{className:"childObject",children:[c.jsxs("div",{className:"child",children:[e?c.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,c.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),c.jsx("div",{className:`icon ${Tn(t.child)}`})]}),c.jsx("div",{className:n?"open":"",children:c.jsx("div",{className:"container",children:r})})]},Math.random())}function qt(t){const n=[];return t.child.children.map(a=>{n.push(c.jsx(Mt,{child:a,three:t.three},Math.random()))}),c.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const wa="",Bn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function Gn(t){return"items"in t}function Te(t){function n(e,r){console.log("onChange:",e,r)}const a=[];return t.items.forEach(e=>{Gn(e)?a.push(c.jsx(Te,{title:e.title,items:e.items},Math.random())):a.push(c.jsx(Ke,{title:e.title,prop:e.prop,value:e.value,type:e.type,min:e.min,max:e.max,step:e.step,disabled:e.disabled,onChange:(r,s)=>{e.onChange!==void 0?e.onChange(r,s):n(r,s)}},Math.random()))}),c.jsx(it,{label:t.title,open:!1,children:a})}function zn(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linewidth"||t==="normalMapType"||t==="precision"||t==="premultipliedAlpha"||t==="shadowSide"||t==="side"||t==="toneMapped"||t==="uniformsGroups"||t==="uniformsNeedUpdate"||t==="userData"||t==="vertexColors"||t==="version"||t==="wireframeLinecap"||t==="wireframeLinejoin"||t==="wireframeLinewidth"||t.slice(0,5)==="blend"||t.slice(0,4)==="clip"||t.slice(0,7)==="polygon"||t.slice(0,7)==="stencil"||t.slice(0,2)==="is")}function Me(t){switch(t){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"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"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 t}function Yn(t){return t.toLowerCase().search("intensity")>-1||t==="anisotropyRotation"||t==="bumpScale"||t==="clearcoatRoughness"||t==="displacementBias"||t==="displacementScale"||t==="metalness"||t==="opacity"||t==="reflectivity"||t==="refractionRatio"||t==="roughness"||t==="sheenRoughness"||t==="thickness"}function Wn(){const t=document.createElement("input");return t.type="file",new Promise((n,a)=>{t.addEventListener("change",function(){if(t.files===null)a();else{const e=t.files[0],r=new FileReader;r.onload=function(s){n(s.target.result)},r.readAsDataURL(e)}}),t.click()})}function $t(t,n,a){const e=[];for(const r in t){if(!zn(r))continue;const s=typeof t[r],p=t[r];if(s==="boolean"||s==="number"||s==="string"){const l={title:Me(r),prop:r,type:s,value:p,min:void 0,max:void 0,onChange:(f,g)=>{var C;a.updateObject(n.uuid,`material.${f}`,g),s==="boolean"&&a.updateObject(n.uuid,"material.needsUpdate",!0);const b=(C=a.scene)==null?void 0:C.getObjectByProperty("uuid",n.uuid);b!==void 0&&te(b,`material.${f}`,g)}};Yn(r)&&(l.value=Number(p),l.type="range",l.min=0,l.max=1,l.step=.01),e.push(l)}else if(s==="object")if(p.isColor)e.push({title:Me(r),prop:r,type:"color",value:p,onChange:(l,f)=>{var C;const g=new u.Color(f);a.updateObject(n.uuid,`material.${l}`,g);const b=(C=a.scene)==null?void 0:C.getObjectByProperty("uuid",n.uuid);b!==void 0&&te(b,`material.${l}`,g)}});else if(Array.isArray(p)){const l=[];for(const f in p)l.push({title:`${f}`,type:`${typeof p[f]}`,value:p[f],onChange:(g,b)=>{var S;a.updateObject(n.uuid,`material.${r}`,b);const C=(S=a.scene)==null?void 0:S.getObjectByProperty("uuid",n.uuid);C!==void 0&&te(C,`material.${r}`,b)}});e.push({title:Me(r),items:l})}else{const l=[];for(const f in p){const g=p[f];switch(typeof g){case"boolean":case"number":case"string":f==="src"?e.push({title:Me(r),type:"image",value:g,onChange:(C,S)=>{var P;a.createTexture(n.uuid,`material.${r}`,S);const _=(P=a.scene)==null?void 0:P.getObjectByProperty("uuid",n.uuid);_!==void 0&&xt(S).then(K=>{te(_,`material.${r}`,K),te(_,"material.needsUpdate",!0)})}}):l.push({title:`${Me(f)}`,prop:`material.${r}.${f}`,type:`${typeof t[r][f]}`,value:p[f],onChange:(C,S)=>{var P;a.updateObject(n.uuid,`material.${r}.${f}`,S);const _=(P=a.scene)==null?void 0:P.getObjectByProperty("uuid",n.uuid);_!==void 0&&te(_,`material.${r}.${f}`,S)}});break;case"object":g.value!==void 0&&g.value.src!==void 0?l.push({title:Me(f),type:"image",value:g.value.src,onChange:(C,S)=>{var P;a.createTexture(n.uuid,`material.${r}.${f}.value`,S);const _=(P=a.scene)==null?void 0:P.getObjectByProperty("uuid",n.uuid);_!==void 0&&xt(S).then(K=>{te(_,`material.${r}.${f}.value`,K)})}}):l.push({title:f,type:`${typeof g.value}`,value:g.value,onChange:(C,S)=>{var P;a.updateObject(n.uuid,`material.${r}.${f}.value`,S);const _=(P=a.scene)==null?void 0:P.getObjectByProperty("uuid",n.uuid);_!==void 0&&te(_,`material.${r}.${f}.value`,S)}});break}}l.length>0&&e.push({title:Me(r),items:l})}else p!==void 0&&console.log("other:",r,s,p)}return e.sort((r,s)=>r.title<s.title?-1:r.title>s.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function Hn(t,n){const a=t.material;if(Array.isArray(a)){const e=[],r=a.length;for(let s=0;s<r;s++)e.push(c.jsx(Te,{title:`Material ${s}`,items:$t(a[s],t,n)},`Material ${s}`));return c.jsx(c.Fragment,{children:e})}else return c.jsx(Te,{title:"Material",items:$t(a,t,n)})}function Ke(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=Ut(t.value));const[a,e]=M.useState(n),r=M.useRef(null),s=M.useRef(null),p=M.useRef(null);M.useEffect(()=>{var Q;let b=!1,C=-1,S=0,_=Number(a);const P=de=>{b=!0,S=_,C=de.clientX},K=de=>{if(!b)return;const le=t.step!==void 0?t.step:1,ae=(de.clientX-C)*le;_=Number((S+ae).toFixed(4)),s.current!==null&&(s.current.value=_.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,_)},se=()=>{b=!1},Z=()=>{b=!1},O=t.type==="number";return O&&((Q=r.current)==null||Q.addEventListener("mousedown",P,!1),document.addEventListener("mouseup",se,!1),document.addEventListener("mousemove",K,!1),document.addEventListener("contextmenu",Z,!1)),()=>{var de;O&&((de=r.current)==null||de.removeEventListener("mousedown",P),document.removeEventListener("mouseup",se),document.removeEventListener("mousemove",K),document.removeEventListener("contextmenu",Z))}},[a]);const l=t.type==="string"&&(a.length>100||a.search(`
144
+ `)>-1),f=l||t.type==="image",g=b=>{let C=b.target.value;t.type==="boolean"&&(C=b.target.checked),e(C),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,C)};return c.jsxs("div",{className:`field ${f?"block":""}`,children:[t.type!=="button"&&c.jsx("label",{ref:r,children:t.title},"fieldLabel"),t.type==="string"&&!l&&c.jsx("input",{type:"text",disabled:t.disabled,onChange:g,value:a}),t.type==="string"&&l&&c.jsx("textarea",{cols:50,rows:10,disabled:!0,onChange:g,value:a}),t.type==="boolean"&&c.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:g,checked:a}),t.type==="number"&&c.jsx("input",{ref:s,type:"number",value:a,min:t.min,max:t.max,step:t.step,onChange:g}),t.type==="range"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:a.toString(),onChange:g,className:"min"}),c.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:g})]}),t.type==="color"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:a.toString(),onChange:g,className:"color"}),c.jsx("input",{type:"color",value:a,onChange:g})]}),t.type==="button"&&c.jsx("button",{onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&c.jsx("img",{ref:p,onClick:()=>{Wn().then(b=>{p.current.src=b,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,b)})},src:a.length>0?a:Bn})]})}function en(t){switch(t){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 t}function Kn(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:en(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const p=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);p!==void 0&&(te(p,r,s),p.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:en(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const p=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);p!==void 0&&(te(p,r,s),p.updateProjectionMatrix())}});return c.jsx(Te,{title:"Camera",items:a})}const Xn=Math.PI/180,Zn=180/Math.PI;function Ue(t,n,a,e,r){return e+(t-n)*(r-e)/(a-n)}function Qn(t){return t*Xn}function Rt(t){return t*Zn}function Jn(t,n){const a=new u.Matrix4;a.elements=t.matrix;const e=new u.Vector3,r=new u.Euler,s=new u.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),r.setFromRotationMatrix(a),s.setFromMatrixScale(a));const p=(f,g)=>{var C;n.updateObject(t.uuid,f,g);const b=(C=n.scene)==null?void 0:C.getObjectByProperty("uuid",t.uuid);b!==void 0&&te(b,f,g)},l=(f,g)=>{p(f,Qn(g))};return c.jsx(Te,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:p},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:p},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:p},{title:"Rotation X",prop:"rotation.x",type:"number",value:at(Rt(r.x)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Y",prop:"rotation.y",type:"number",value:at(Rt(r.y)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Z",prop:"rotation.z",type:"number",value:at(Rt(r.z)),min:-360,max:360,step:.1,onChange:l},{title:"Scale X",prop:"scale.x",type:"number",value:s.x,step:.01,onChange:p},{title:"Scale Y",prop:"scale.y",type:"number",value:s.y,step:.01,onChange:p},{title:"Scale Z",prop:"scale.z",type:"number",value:s.z,step:.01,onChange:p}]})}function tn(t){switch(t){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"}return t}function qn(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const r=t.lightInfo[e];r!==void 0&&(r.isColor!==void 0?a.push({title:tn(e),prop:e,type:"color",value:r,onChange:(s,p)=>{var g;const l=new u.Color(p);n.updateObject(t.uuid,s,l);const f=(g=n.scene)==null?void 0:g.getObjectByProperty("uuid",t.uuid);f!==void 0&&te(f,s,l)}}):a.push({title:tn(e),prop:e,type:typeof r,value:r,step:typeof r=="number"?.01:void 0,onChange:(s,p)=>{var f;n.updateObject(t.uuid,s,p);const l=(f=n.scene)==null?void 0:f.getObjectByProperty("uuid",t.uuid);l!==void 0&&te(l,s,p)}}))}return c.jsx(Te,{title:"Light",items:a})}function $n(t,n){const a=[];return t.animations.forEach(e=>{a.push({title:"Name",type:"string",prop:"name",value:e.name,disabled:!0,onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s);const p=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);p!==void 0&&te(p,r,s)}}),a.push({title:"Duration",type:"number",prop:"duration",value:e.duration,disabled:!0,onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s);const p=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);p!==void 0&&te(p,r,s)}}),a.push({title:"Blend Mode",type:"number",prop:"blendMode",value:e.blendMode,disabled:!0,onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s);const p=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);p!==void 0&&te(p,r,s)}})}),c.jsx(Te,{title:"Animations",items:a})}const nn={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};function an(t){const[n,a]=M.useState(nn);M.useEffect(()=>{function r(p){const l=p.value;a(l)}function s(){a(nn)}return z.addEventListener(Y.SET_SCENE,s),z.addEventListener(Y.SET_OBJECT,r),()=>{z.removeEventListener(Y.SET_SCENE,s),z.removeEventListener(Y.SET_OBJECT,r)}},[]);const e=n.type.toLowerCase();return c.jsx(it,{label:"Inspector",children:c.jsx("div",{id:"Inspector",className:t.class,children:n.uuid.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs(c.Fragment,{children:[c.jsx(Ke,{type:"string",title:"Name",prop:"name",value:n.name,disabled:!0}),c.jsx(Ke,{type:"string",title:"Type",prop:"type",value:n.type,disabled:!0}),c.jsx(Ke,{type:"string",title:"UUID",prop:"uuid",value:n.uuid,disabled:!0}),c.jsx(Ke,{type:"boolean",title:"Visible",prop:"visible",value:n.visible,onChange:(r,s)=>{var l;t.three.updateObject(n.uuid,r,s);const p=(l=t.three.scene)==null?void 0:l.getObjectByProperty("uuid",n.uuid);p!==void 0&&te(p,r,s)}})]}),c.jsxs(c.Fragment,{children:[Jn(n,t.three),n.animations.length>0?$n(n,t.three):null,e.search("camera")>-1?Kn(n,t.three):null,e.search("light")>-1?qn(n,t.three):null,e.search("mesh")>-1?Hn(n,t.three):null]})]})})},"Inspector")}class ea extends M.Component{constructor(a){super(a);$(this,"three");$(this,"setScene",a=>{this.setState(()=>({scene:a.value}))});this.state={scene:a.scene!==void 0?a.scene:null},this.three=a.three,z.addEventListener(Y.SET_SCENE,this.setScene)}componentWillUnmount(){z.removeEventListener(Y.SET_SCENE,this.setScene)}render(){var r;const a=this.componentState.scene!==null,e="Hierarchy - "+(a?`${(r=this.componentState.scene)==null?void 0:r.name}`:"No Scene");return c.jsx("div",{id:"SidePanel",children:c.jsxs(c.Fragment,{children:[c.jsx(it,{label:e,open:!0,children:c.jsx(c.Fragment,{children:a&&c.jsx(qt,{child:this.componentState.scene,three:this.three})})}),c.jsx(an,{three:this.three})]})},"SidePanel")}get componentState(){return this.state}}function ta(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=l=>{var g;if(!n())return;const f=(g=t.three.scene)==null?void 0:g.getObjectByProperty("uuid",l.value);f!==void 0&&t.three.setObject(f)},e=(l,f,g)=>{var C;if(!n())return;const b=(C=t.three.scene)==null?void 0:C.getObjectByProperty("uuid",l);b!==void 0&&te(b,f,g)},r=l=>{if(!n())return;const f=l.value,{key:g,value:b,uuid:C}=f;e(C,g,b)},s=l=>{if(!n())return;const f=l.value;xt(f.value).then(g=>{e(f.uuid,f.key,g),e(f.uuid,"material.needsUpdate",!0)})},p=l=>{var S;if(!n())return;const{key:f,uuid:g,value:b}=l.value,C=(S=t.three.scene)==null?void 0:S.getObjectByProperty("uuid",g);if(C!==void 0)try{C[f](b)}catch(_){console.log("Error requesting method:"),console.log(_),console.log(f),console.log(b)}};return M.useEffect(()=>(z.addEventListener(Y.GET_OBJECT,a),z.addEventListener(Y.UPDATE_OBJECT,r),z.addEventListener(Y.CREATE_TEXTURE,s),z.addEventListener(Y.REQUEST_METHOD,p),()=>{z.removeEventListener(Y.GET_OBJECT,a),z.removeEventListener(Y.UPDATE_OBJECT,r),z.removeEventListener(Y.CREATE_TEXTURE,s),z.removeEventListener(Y.REQUEST_METHOD,p)}),[]),null}const rn={type:"change"},Pt={type:"start"},on={type:"end"},rt=new u.Ray,sn=new u.Plane,na=Math.cos(70*u.MathUtils.DEG2RAD);class aa extends u.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new u.Vector3,this.cursor=new u.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:u.MOUSE.ROTATE,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.PAN},this.touches={ONE:u.TOUCH.ROTATE,TWO:u.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 l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",tt),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",tt),this._domElementKeyEvents=null},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(rn),e.update(),s=r.NONE},this.update=function(){const o=new u.Vector3,E=new u.Quaternion().setFromUnitVectors(n.up,new u.Vector3(0,1,0)),A=E.clone().invert(),L=new u.Vector3,ie=new u.Quaternion,ve=new u.Vector3,ue=2*Math.PI;return function(Et=null){const Ee=e.object.position;o.copy(Ee).sub(e.target),o.applyQuaternion(E),l.setFromVector3(o),e.autoRotate&&s===r.NONE&&B(y(Et)),e.enableDamping?(l.theta+=f.theta*e.dampingFactor,l.phi+=f.phi*e.dampingFactor):(l.theta+=f.theta,l.phi+=f.phi);let fe=e.minAzimuthAngle,he=e.maxAzimuthAngle;isFinite(fe)&&isFinite(he)&&(fe<-Math.PI?fe+=ue:fe>Math.PI&&(fe-=ue),he<-Math.PI?he+=ue:he>Math.PI&&(he-=ue),fe<=he?l.theta=Math.max(fe,Math.min(he,l.theta)):l.theta=l.theta>(fe+he)/2?Math.max(fe,l.theta):Math.min(he,l.theta)),l.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,l.phi)),l.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(b,e.dampingFactor):e.target.add(b),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&ae||e.object.isOrthographicCamera?l.radius=J(l.radius):l.radius=J(l.radius*g),o.setFromSpherical(l),o.applyQuaternion(A),Ee.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(f.theta*=1-e.dampingFactor,f.phi*=1-e.dampingFactor,b.multiplyScalar(1-e.dampingFactor)):(f.set(0,0,0),b.set(0,0,0));let Be=!1;if(e.zoomToCursor&&ae){let Le=null;if(e.object.isPerspectiveCamera){const xe=o.length();Le=J(xe*g);const Ge=xe-Le;e.object.position.addScaledVector(de,Ge),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const xe=new u.Vector3(le.x,le.y,0);xe.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/g)),e.object.updateProjectionMatrix(),Be=!0;const Ge=new u.Vector3(le.x,le.y,0);Ge.unproject(e.object),e.object.position.sub(Ge).add(xe),e.object.updateMatrixWorld(),Le=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;Le!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(Le).add(e.object.position):(rt.origin.copy(e.object.position),rt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(rt.direction))<na?n.lookAt(e.target):(sn.setFromNormalAndCoplanarPoint(e.object.up,e.target),rt.intersectPlane(sn,e.target))))}else e.object.isOrthographicCamera&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/g)),e.object.updateProjectionMatrix(),Be=!0);return g=1,ae=!1,Be||L.distanceToSquared(e.object.position)>p||8*(1-ie.dot(e.object.quaternion))>p||ve.distanceToSquared(e.target)>0?(e.dispatchEvent(rn),L.copy(e.object.position),ie.copy(e.object.quaternion),ve.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Se),e.domElement.removeEventListener("pointerdown",$e),e.domElement.removeEventListener("pointercancel",Ne),e.domElement.removeEventListener("wheel",mt),e.domElement.removeEventListener("pointermove",Ce),e.domElement.removeEventListener("pointerup",Ne),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",tt),e._domElementKeyEvents=null)};const e=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const p=1e-6,l=new u.Spherical,f=new u.Spherical;let g=1;const b=new u.Vector3,C=new u.Vector2,S=new u.Vector2,_=new u.Vector2,P=new u.Vector2,K=new u.Vector2,se=new u.Vector2,Z=new u.Vector2,O=new u.Vector2,Q=new u.Vector2,de=new u.Vector3,le=new u.Vector2;let ae=!1;const d=[],m={};function y(o){return o!==null?2*Math.PI/60*e.autoRotateSpeed*o:2*Math.PI/60/60*e.autoRotateSpeed}function T(o){const E=Math.abs(o)/(100*(window.devicePixelRatio|0));return Math.pow(.95,e.zoomSpeed*E)}function B(o){f.theta-=o}function G(o){f.phi-=o}const F=function(){const o=new u.Vector3;return function(A,L){o.setFromMatrixColumn(L,0),o.multiplyScalar(-A),b.add(o)}}(),I=function(){const o=new u.Vector3;return function(A,L){e.screenSpacePanning===!0?o.setFromMatrixColumn(L,1):(o.setFromMatrixColumn(L,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(A),b.add(o)}}(),V=function(){const o=new u.Vector3;return function(A,L){const ie=e.domElement;if(e.object.isPerspectiveCamera){const ve=e.object.position;o.copy(ve).sub(e.target);let ue=o.length();ue*=Math.tan(e.object.fov/2*Math.PI/180),F(2*A*ue/ie.clientHeight,e.object.matrix),I(2*L*ue/ie.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(F(A*(e.object.right-e.object.left)/e.object.zoom/ie.clientWidth,e.object.matrix),I(L*(e.object.top-e.object.bottom)/e.object.zoom/ie.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function ee(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?g/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function j(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?g*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function N(o,E){if(!e.zoomToCursor)return;ae=!0;const A=e.domElement.getBoundingClientRect(),L=o-A.left,ie=E-A.top,ve=A.width,ue=A.height;le.x=L/ve*2-1,le.y=-(ie/ue)*2+1,de.set(le.x,le.y,1).unproject(e.object).sub(e.object.position).normalize()}function J(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function pe(o){C.set(o.clientX,o.clientY)}function De(o){N(o.clientX,o.clientX),Z.set(o.clientX,o.clientY)}function Qe(o){P.set(o.clientX,o.clientY)}function ut(o){S.set(o.clientX,o.clientY),_.subVectors(S,C).multiplyScalar(e.rotateSpeed);const E=e.domElement;B(2*Math.PI*_.x/E.clientHeight),G(2*Math.PI*_.y/E.clientHeight),C.copy(S),e.update()}function jt(o){O.set(o.clientX,o.clientY),Q.subVectors(O,Z),Q.y>0?ee(T(Q.y)):Q.y<0&&j(T(Q.y)),Z.copy(O),e.update()}function _t(o){K.set(o.clientX,o.clientY),se.subVectors(K,P).multiplyScalar(e.panSpeed),V(se.x,se.y),P.copy(K),e.update()}function Je(o){N(o.clientX,o.clientY),o.deltaY<0?j(T(o.deltaY)):o.deltaY>0&&ee(T(o.deltaY)),e.update()}function qe(o){let E=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?G(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):V(0,e.keyPanSpeed),E=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?G(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):V(0,-e.keyPanSpeed),E=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?B(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):V(e.keyPanSpeed,0),E=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?B(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):V(-e.keyPanSpeed,0),E=!0;break}E&&(o.preventDefault(),e.update())}function ke(o){if(d.length===1)C.set(o.pageX,o.pageY);else{const E=ge(o),A=.5*(o.pageX+E.x),L=.5*(o.pageY+E.y);C.set(A,L)}}function Fe(o){if(d.length===1)P.set(o.pageX,o.pageY);else{const E=ge(o),A=.5*(o.pageX+E.x),L=.5*(o.pageY+E.y);P.set(A,L)}}function Ae(o){const E=ge(o),A=o.pageX-E.x,L=o.pageY-E.y,ie=Math.sqrt(A*A+L*L);Z.set(0,ie)}function Dt(o){e.enableZoom&&Ae(o),e.enablePan&&Fe(o)}function dt(o){e.enableZoom&&Ae(o),e.enableRotate&&ke(o)}function ft(o){if(d.length==1)S.set(o.pageX,o.pageY);else{const A=ge(o),L=.5*(o.pageX+A.x),ie=.5*(o.pageY+A.y);S.set(L,ie)}_.subVectors(S,C).multiplyScalar(e.rotateSpeed);const E=e.domElement;B(2*Math.PI*_.x/E.clientHeight),G(2*Math.PI*_.y/E.clientHeight),C.copy(S)}function ht(o){if(d.length===1)K.set(o.pageX,o.pageY);else{const E=ge(o),A=.5*(o.pageX+E.x),L=.5*(o.pageY+E.y);K.set(A,L)}se.subVectors(K,P).multiplyScalar(e.panSpeed),V(se.x,se.y),P.copy(K)}function Ie(o){const E=ge(o),A=o.pageX-E.x,L=o.pageY-E.y,ie=Math.sqrt(A*A+L*L);O.set(0,ie),Q.set(0,Math.pow(O.y/Z.y,e.zoomSpeed)),ee(Q.y),Z.copy(O);const ve=(o.pageX+E.x)*.5,ue=(o.pageY+E.y)*.5;N(ve,ue)}function Ve(o){e.enableZoom&&Ie(o),e.enablePan&&ht(o)}function pt(o){e.enableZoom&&Ie(o),e.enableRotate&&ft(o)}function $e(o){e.enabled!==!1&&(d.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",Ce),e.domElement.addEventListener("pointerup",Ne)),At(o),o.pointerType==="touch"?gt(o):kt(o))}function Ce(o){e.enabled!==!1&&(o.pointerType==="touch"?vt(o):et(o))}function Ne(o){bt(o),d.length===0&&(e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",Ce),e.domElement.removeEventListener("pointerup",Ne)),e.dispatchEvent(on),s=r.NONE}function kt(o){let E;switch(o.button){case 0:E=e.mouseButtons.LEFT;break;case 1:E=e.mouseButtons.MIDDLE;break;case 2:E=e.mouseButtons.RIGHT;break;default:E=-1}switch(E){case u.MOUSE.DOLLY:if(e.enableZoom===!1)return;De(o),s=r.DOLLY;break;case u.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;Qe(o),s=r.PAN}else{if(e.enableRotate===!1)return;pe(o),s=r.ROTATE}break;case u.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;pe(o),s=r.ROTATE}else{if(e.enablePan===!1)return;Qe(o),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Pt)}function et(o){switch(s){case r.ROTATE:if(e.enableRotate===!1)return;ut(o);break;case r.DOLLY:if(e.enableZoom===!1)return;jt(o);break;case r.PAN:if(e.enablePan===!1)return;_t(o);break}}function mt(o){e.enabled===!1||e.enableZoom===!1||s!==r.NONE||(o.preventDefault(),e.dispatchEvent(Pt),Je(o),e.dispatchEvent(on))}function tt(o){e.enabled===!1||e.enablePan===!1||qe(o)}function gt(o){switch(nt(o),d.length){case 1:switch(e.touches.ONE){case u.TOUCH.ROTATE:if(e.enableRotate===!1)return;ke(o),s=r.TOUCH_ROTATE;break;case u.TOUCH.PAN:if(e.enablePan===!1)return;Fe(o),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(e.touches.TWO){case u.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Dt(o),s=r.TOUCH_DOLLY_PAN;break;case u.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;dt(o),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Pt)}function vt(o){switch(nt(o),s){case r.TOUCH_ROTATE:if(e.enableRotate===!1)return;ft(o),e.update();break;case r.TOUCH_PAN:if(e.enablePan===!1)return;ht(o),e.update();break;case r.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ve(o),e.update();break;case r.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;pt(o),e.update();break;default:s=r.NONE}}function Se(o){e.enabled!==!1&&o.preventDefault()}function At(o){d.push(o.pointerId)}function bt(o){delete m[o.pointerId];for(let E=0;E<d.length;E++)if(d[E]==o.pointerId){d.splice(E,1);return}}function nt(o){let E=m[o.pointerId];E===void 0&&(E=new u.Vector2,m[o.pointerId]=E),E.set(o.pageX,o.pageY)}function ge(o){const E=o.pointerId===d[0]?d[1]:d[0];return m[E]}e.domElement.addEventListener("contextmenu",Se),e.domElement.addEventListener("pointerdown",$e),e.domElement.addEventListener("pointercancel",Ne),e.domElement.addEventListener("wheel",mt,{passive:!1}),this.update()}}const ot=t=>{const[n,a]=M.useState(t.options[t.index]),e=()=>{t.onToggle(!t.open)},r=s=>{s!==n&&(t.onSelect(s),a(s)),t.onToggle(!1)};return c.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[c.jsx("div",{className:"dropdown-toggle",onClick:e,children:n}),t.open&&c.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>c.jsx("li",{onClick:()=>r(s),children:s},s))})]})},Re=M.forwardRef(function(n,a){const[e,r]=M.useState(!1),s=n.options.indexOf(n.camera.name);return c.jsxs("div",{className:"CameraWindow",children:[c.jsx("div",{ref:a,className:"clickable",onClick:()=>{e&&r(!1)}}),c.jsx(ot,{index:s,open:e,options:n.options,onSelect:n.onSelect,onToggle:p=>{r(p)},up:!0})]})}),cn=["Single","Side by Side","Stacked","Quad"],ne=new Map,re=new Map,be=new Map;function Pe(t,n){const a=new u.OrthographicCamera(-100,100,100,-100,50,3e3);return a.name=t,a.position.copy(n),a.lookAt(0,0,0),ne.set(t,a),a}Pe("Top",new u.Vector3(0,1e3,0)),Pe("Bottom",new u.Vector3(0,-1e3,0)),Pe("Left",new u.Vector3(-1e3,0,0)),Pe("Right",new u.Vector3(1e3,0,0)),Pe("Front",new u.Vector3(0,0,1e3)),Pe("Back",new u.Vector3(0,0,-1e3)),Pe("Orthographic",new u.Vector3(1e3,1e3,1e3));const st=new u.PerspectiveCamera(60,1,50,3e3);st.name="Debug",st.position.set(500,500,500),st.lookAt(0,0,0),ne.set("Debug",st);const ln=["Renderer","Depth","Normals","UVs","Wireframe"],ia=new u.MeshDepthMaterial,ra=new u.MeshNormalMaterial,oa=new Jt,sa=new u.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),Ca="";let ct="Renderer";const W=new u.Scene;W.name="Debug Scene";let ye=new u.Scene;W.add(ye);const Xe=new u.Group;Xe.name="helpers",W.add(Xe);const ca=new Qt;Xe.add(ca);const un=new u.AxesHelper(500);un.name="axisHelper",Xe.add(un);const Ze=new u.AxesHelper(100);Ze.name="interactionHelper",Xe.add(Ze),Ze.visible=!1;let lt=!1,H=ne.get("Debug"),oe=ne.get("Orthographic"),je=ne.get("Front"),_e=ne.get("Top"),dn=!1;function la(t){const[n,a]=M.useState(t.mode!==void 0?t.mode:"Single"),[e,r]=M.useState(null),[s,p]=M.useState(!1),[l,f]=M.useState(!1),[g,b]=M.useState(!1),[,C]=M.useState(Date.now()),S=M.useRef(null),_=M.useRef(null),P=M.useRef(null),K=M.useRef(null),se=M.useRef(null),Z=M.useRef(null),O=(d,m)=>{const y=re.get(d.name);y!==void 0&&y.dispose(),re.delete(d.name);const T=be.get(d.name);T!==void 0&&(W.remove(T),T.dispose()),be.delete(d.name);const B=new aa(d,m);switch(B.enableDamping=!0,B.dampingFactor=.05,d.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":B.enableRotate=!1;break}if(re.set(d.name,B),d instanceof u.PerspectiveCamera){const G=new u.CameraHelper(d);be.set(d.name,G),W.add(G)}},Q=d=>{const m=be.get(d.name);m!==void 0&&(W.remove(m),m.dispose(),be.delete(d.name));const y=re.get(d.name);y!==void 0&&(y.dispose(),re.delete(d.name))},de=()=>{re.forEach((d,m)=>{d.dispose();const y=be.get(m);y!==void 0&&(W.remove(y),y.dispose()),be.delete(m),re.delete(m)}),re.clear(),be.clear()},le=()=>{switch(n){case"Single":O(H,P.current);break;case"Side by Side":case"Stacked":O(H,P.current),O(oe,K.current);break;case"Quad":O(H,P.current),O(oe,K.current),O(je,se.current),O(_e,Z.current);break}};M.useEffect(()=>{const d=new u.WebGLRenderer({canvas:S.current,stencil:!1});d.autoClear=!1,d.shadowMap.enabled=!0,d.setPixelRatio(devicePixelRatio),d.setClearColor(0),r(d)},[]),M.useEffect(()=>{const d=T=>{Ct(ye),W.remove(ye);const B=t.scenes.get(T.value.name);if(B!==void 0){const G=new B;t.onSceneSet!==void 0&&t.onSceneSet(G),ye=G,t.three.scene=ye,W.add(ye),dn=!0}},m=T=>{var F;const B=T.value,G=(F=t.three.scene)==null?void 0:F.getObjectByProperty("uuid",B.uuid);G!==void 0&&ne.set(B.name,G),C(Date.now())},y=T=>{ne.delete(T.value.name),C(Date.now())};return z.addEventListener(Y.SET_SCENE,d),z.addEventListener(Y.ADD_CAMERA,m),z.addEventListener(Y.REMOVE_CAMERA,y),()=>{z.removeEventListener(Y.SET_SCENE,d),z.removeEventListener(Y.ADD_CAMERA,m),z.removeEventListener(Y.REMOVE_CAMERA,y)}},[]),M.useEffect(()=>{if(e===null)return;let d=window.innerWidth,m=window.innerHeight,y=Math.floor(d/2),T=Math.floor(m/2),B=-1;const G=()=>{d=window.innerWidth-300,m=window.innerHeight,y=Math.floor(d/2),T=Math.floor(m/2),e.setSize(d,m);let j=d,N=m;switch(n){case"Side by Side":j=y,N=m;break;case"Stacked":j=d,N=T;break;case"Quad":j=y,N=T;break}ne.forEach(J=>{var pe;J instanceof u.OrthographicCamera?(J.left=j/-2,J.right=j/2,J.top=N/2,J.bottom=N/-2,J.updateProjectionMatrix()):J instanceof u.PerspectiveCamera&&(J.aspect=j/N,J.updateProjectionMatrix(),(pe=be.get(J.name))==null||pe.update())})},F=()=>{e.setViewport(0,0,d,m),e.setScissor(0,0,d,m),e.render(W,H)},I=()=>{if(n==="Side by Side")e.setViewport(0,0,y,m),e.setScissor(0,0,y,m),e.render(W,H),e.setViewport(y,0,y,m),e.setScissor(y,0,y,m),e.render(W,oe);else{const j=m-T;e.setViewport(0,j,d,T),e.setScissor(0,j,d,T),e.render(W,H),e.setViewport(0,0,d,T),e.setScissor(0,0,d,T),e.render(W,oe)}},V=()=>{let j=0,N=0;N=m-T,j=0,e.setViewport(j,N,y,T),e.setScissor(j,N,y,T),e.render(W,H),j=y,e.setViewport(j,N,y,T),e.setScissor(j,N,y,T),e.render(W,oe),N=0,j=0,e.setViewport(j,N,y,T),e.setScissor(j,N,y,T),e.render(W,je),j=y,e.setViewport(j,N,y,T),e.setScissor(j,N,y,T),e.render(W,_e)},ee=()=>{switch(re.forEach(j=>{j.update()}),t.onSceneUpdate!==void 0&&dn&&t.onSceneUpdate(ye),e.clear(),n){case"Single":F();break;case"Side by Side":case"Stacked":I();break;case"Quad":V();break}B=requestAnimationFrame(ee)};return le(),window.addEventListener("resize",G),G(),ee(),()=>{window.removeEventListener("resize",G),cancelAnimationFrame(B),B=-1}},[n,e]),M.useEffect(()=>{if(e!==null){const d=new u.Raycaster,m=new u.Vector2,y=(F,I,V,ee)=>{switch(n){case"Quad":F<V?I<ee?d.setFromCamera(m,H):d.setFromCamera(m,je):I<ee?d.setFromCamera(m,oe):d.setFromCamera(m,_e);break;case"Side by Side":F<V?d.setFromCamera(m,H):d.setFromCamera(m,oe);break;case"Single":d.setFromCamera(m,H);break;case"Stacked":I<ee?d.setFromCamera(m,H):d.setFromCamera(m,oe);break}},T=F=>{if(!lt)return;const I=new u.Vector2;e.getSize(I);const V=Math.min(F.clientX,I.x),ee=Math.min(F.clientY,I.y);m.x=Ue(V,0,I.x,-1,1),m.y=Ue(ee,0,I.y,1,-1);const j=I.x/2,N=I.y/2,J=()=>{V<j?m.x=Ue(V,0,j,-1,1):m.x=Ue(V,j,I.x,-1,1)},pe=()=>{ee<N?m.y=Ue(ee,0,N,1,-1):m.y=Ue(ee,N,I.y,1,-1)};switch(n){case"Quad":J(),pe();break;case"Side by Side":J();break;case"Stacked":pe(),pe();break}y(V,ee,j,N);const De=d.intersectObjects(ye.children);De.length>0&&Ze.position.copy(De[0].point)},B=F=>{if(!lt)return;const I=new u.Vector2;if(e.getSize(I),F.clientX>=I.x)return;T(F);const V=d.intersectObjects(ye.children);V.length>0&&t.three.getObject(V[0].object.uuid)},G=_.current;return G.addEventListener("mousemove",T,!1),G.addEventListener("click",B,!1),()=>{G.removeEventListener("mousemove",T),G.removeEventListener("click",B)}}},[n,e]);const ae=[];return ne.forEach((d,m)=>{ae.push(m)}),c.jsxs("div",{className:"multiview",children:[c.jsx("canvas",{ref:S}),c.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,ref:_,children:[n==="Single"&&c.jsx(c.Fragment,{children:c.jsx(Re,{camera:H,options:ae,ref:P,onSelect:d=>{var y;(y=re.get(H.name))==null||y.dispose();const m=ne.get(d);m!==void 0&&(Q(H),H=m,O(m,P.current))}})}),(n==="Side by Side"||n==="Stacked")&&c.jsxs(c.Fragment,{children:[c.jsx(Re,{camera:H,options:ae,ref:P,onSelect:d=>{var y;(y=re.get(H.name))==null||y.dispose();const m=ne.get(d);m!==void 0&&(Q(H),H=m,O(m,P.current))}}),c.jsx(Re,{camera:oe,options:ae,ref:K,onSelect:d=>{var y;(y=re.get(oe.name))==null||y.dispose();const m=ne.get(d);m!==void 0&&(Q(oe),oe=m,O(m,K.current))}})]}),n==="Quad"&&c.jsxs(c.Fragment,{children:[c.jsx(Re,{camera:H,options:ae,ref:P,onSelect:d=>{var y;(y=re.get(H.name))==null||y.dispose();const m=ne.get(d);m!==void 0&&(Q(H),H=m,O(m,P.current))}}),c.jsx(Re,{camera:oe,options:ae,ref:K,onSelect:d=>{var y;(y=re.get(oe.name))==null||y.dispose();const m=ne.get(d);m!==void 0&&(Q(oe),oe=m,O(m,K.current))}}),c.jsx(Re,{camera:je,options:ae,ref:se,onSelect:d=>{var y;(y=re.get(je.name))==null||y.dispose();const m=ne.get(d);m!==void 0&&(Q(je),je=m,O(m,se.current))}}),c.jsx(Re,{camera:_e,options:ae,ref:Z,onSelect:d=>{var y;(y=re.get(_e.name))==null||y.dispose();const m=ne.get(d);m!==void 0&&(Q(_e),_e=m,O(m,Z.current))}})]})]}),c.jsxs("div",{className:"settings",children:[c.jsx(ot,{index:cn.indexOf(n),options:cn,onSelect:d=>{d!==n&&(de(),a(d))},open:s,onToggle:d=>{p(d),l&&f(!1),g&&b(!1)}}),c.jsx(ot,{index:ln.indexOf(ct),options:ln,onSelect:d=>{if(d!==ct)switch(ct=d,ct){case"Depth":W.overrideMaterial=ia;break;case"Normals":W.overrideMaterial=ra;break;default:case"Renderer":W.overrideMaterial=null;break;case"Wireframe":W.overrideMaterial=sa;break;case"UVs":W.overrideMaterial=oa;break}},open:l,onToggle:d=>{s&&p(!1),f(d),g&&b(!1)}}),c.jsx(ot,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:d=>{lt=d==="Selection Mode",Ze.visible=lt},open:g,onToggle:d=>{s&&p(!1),l&&f(!1),b(d)}})]})]})}const Sa="";function ua(t){return c.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[c.jsx("header",{children:t.header}),t.children,c.jsx("footer",{children:t.footer})]})}w.Accordion=it,w.Application=Sn,w.BaseRemote=Ye,w.ChildObject=Mt,w.ContainerObject=qt,w.Draggable=Kt,w.DraggableItem=Ht,w.Dropdown=Xt,w.DropdownItem=Zt,w.Editor=ua,w.InfiniteGridHelper=Qt,w.Inspector=an,w.MultiView=la,w.NavButton=Tt,w.RemoteComponents=xn,w.RemoteController=In,w.RemoteTheatre=On,w.RemoteThree=Pn,w.RemoteTweakpane=jn,w.SceneInspector=ta,w.SidePanel=ea,w.ToolEvents=Y,w.UVMaterial=Jt,w.clamp=En,w.colorToHex=Ut,w.debugDispatcher=z,w.dispose=Ct,w.disposeMaterial=Vt,w.disposeTexture=Cn,w.distance=wn,w.hierarchyUUID=wt,w.isColor=Lt,w.randomID=Nt,w.resetThreeObjects=Ft,w.round=at,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});