@tomorrowevening/hermes 0.0.1 → 0.0.3

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 (130) hide show
  1. package/README.md +7 -0
  2. package/dist/hermes.js +2530 -718
  3. package/dist/hermes.umd.cjs +88 -11
  4. package/dist/images/android-chrome-192x192.png +0 -0
  5. package/dist/images/android-chrome-512x512.png +0 -0
  6. package/dist/images/apple-touch-icon.png +0 -0
  7. package/dist/images/favicon-16x16.png +0 -0
  8. package/dist/images/favicon-32x32.png +0 -0
  9. package/dist/images/favicon.ico +0 -0
  10. package/dist/images/milkyWay/dark-s_nx.jpg +0 -0
  11. package/dist/images/milkyWay/dark-s_ny.jpg +0 -0
  12. package/dist/images/milkyWay/dark-s_nz.jpg +0 -0
  13. package/dist/images/milkyWay/dark-s_px.jpg +0 -0
  14. package/dist/images/milkyWay/dark-s_py.jpg +0 -0
  15. package/dist/images/milkyWay/dark-s_pz.jpg +0 -0
  16. package/dist/images/site.webmanifest +1 -0
  17. package/dist/images/uv_grid_opengl.jpg +0 -0
  18. package/dist/index-0a798fe4.js +6862 -0
  19. package/dist/index-7bad599d.css +1 -0
  20. package/dist/index.html +18 -0
  21. package/dist/models/Flair.fbx +0 -0
  22. package/dist/models/Thriller2.fbx +0 -0
  23. package/dist/models/Thriller4.fbx +0 -0
  24. package/dist/style.css +1 -1
  25. package/package.json +9 -4
  26. package/src/core/Application.ts +28 -36
  27. package/src/core/RemoteController.ts +148 -98
  28. package/src/core/remote/BaseRemote.ts +3 -3
  29. package/src/core/remote/RemoteComponents.ts +5 -8
  30. package/src/core/remote/RemoteTheatre.ts +56 -54
  31. package/src/core/remote/RemoteThree.ts +77 -0
  32. package/src/core/remote/RemoteTweakpane.ts +71 -78
  33. package/src/core/types.ts +14 -4
  34. package/src/editor/Editor.tsx +8 -6
  35. package/src/editor/components/Draggable.tsx +20 -20
  36. package/src/editor/components/DraggableItem.tsx +6 -6
  37. package/src/editor/components/Dropdown.tsx +22 -14
  38. package/src/editor/components/DropdownItem.tsx +19 -19
  39. package/src/editor/components/NavButton.tsx +1 -1
  40. package/src/editor/components/content.ts +2 -0
  41. package/src/editor/components/icons/CloseIcon.tsx +1 -1
  42. package/src/editor/components/icons/DragIcon.tsx +1 -1
  43. package/src/editor/global.ts +9 -4
  44. package/src/editor/sceneHierarchy/Accordion.tsx +40 -0
  45. package/src/editor/sceneHierarchy/ChildObject.tsx +17 -17
  46. package/src/editor/sceneHierarchy/ContainerObject.tsx +7 -8
  47. package/src/editor/sceneHierarchy/SceneHierarchy.tsx +52 -49
  48. package/src/editor/sceneHierarchy/ToggleBtn.tsx +26 -0
  49. package/src/editor/sceneHierarchy/inspector/Inspector.tsx +82 -0
  50. package/src/editor/sceneHierarchy/inspector/InspectorField.tsx +178 -0
  51. package/src/editor/sceneHierarchy/inspector/InspectorGroup.tsx +55 -0
  52. package/src/editor/sceneHierarchy/inspector/MultiView/CameraWindow.tsx +61 -0
  53. package/src/editor/sceneHierarchy/inspector/MultiView/InfiniteGridHelper.ts +24 -0
  54. package/src/editor/sceneHierarchy/inspector/MultiView/InfiniteGridMaterial.ts +127 -0
  55. package/src/editor/sceneHierarchy/inspector/MultiView/MultiView.scss +93 -0
  56. package/src/editor/sceneHierarchy/inspector/MultiView/MultiView.tsx +450 -0
  57. package/src/editor/sceneHierarchy/inspector/SceneInspector.tsx +72 -0
  58. package/src/editor/sceneHierarchy/inspector/inspector.scss +150 -0
  59. package/src/editor/sceneHierarchy/inspector/utils/InspectCamera.tsx +75 -0
  60. package/src/editor/sceneHierarchy/inspector/utils/InspectLight.tsx +62 -0
  61. package/src/editor/sceneHierarchy/inspector/utils/InspectMaterial.tsx +340 -0
  62. package/src/editor/sceneHierarchy/inspector/utils/InspectTransform.tsx +124 -0
  63. package/src/editor/sceneHierarchy/types.ts +116 -5
  64. package/src/editor/sceneHierarchy/utils.ts +207 -11
  65. package/src/editor/scss/_debug.scss +9 -19
  66. package/src/editor/scss/_dropdown.scss +1 -0
  67. package/src/editor/scss/_sceneHierarchy.scss +148 -48
  68. package/src/editor/scss/index.scss +13 -6
  69. package/src/editor/utils.ts +42 -5
  70. package/src/example/CustomEditor.tsx +40 -0
  71. package/src/example/components/App.tsx +164 -0
  72. package/src/example/constants.ts +40 -9
  73. package/src/example/main.tsx +5 -45
  74. package/src/example/three/CustomMaterial.ts +58 -0
  75. package/src/example/three/ExampleScene.ts +176 -0
  76. package/src/example/three/FBXAnimation.ts +39 -0
  77. package/src/index.ts +22 -0
  78. package/types/core/Application.d.ts +7 -13
  79. package/types/core/remote/RemoteComponents.d.ts +0 -2
  80. package/types/core/remote/RemoteThree.d.ts +12 -0
  81. package/types/core/remote/RemoteTweakpane.d.ts +3 -3
  82. package/types/core/types.d.ts +4 -3
  83. package/types/editor/Editor.d.ts +2 -1
  84. package/types/editor/components/content.d.ts +2 -0
  85. package/types/editor/global.d.ts +7 -2
  86. package/types/editor/sceneHierarchy/Accordion.d.ts +10 -0
  87. package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +5 -5
  88. package/types/editor/sceneHierarchy/ToggleBtn.d.ts +7 -0
  89. package/types/editor/sceneHierarchy/inspector/Inspector.d.ts +3 -0
  90. package/types/editor/sceneHierarchy/inspector/InspectorField.d.ts +13 -0
  91. package/types/editor/sceneHierarchy/inspector/InspectorGroup.d.ts +7 -0
  92. package/types/editor/sceneHierarchy/inspector/MultiView/CameraWindow.d.ts +16 -0
  93. package/types/editor/sceneHierarchy/inspector/MultiView/InfiniteGridHelper.d.ts +7 -0
  94. package/types/editor/sceneHierarchy/inspector/MultiView/InfiniteGridMaterial.d.ts +13 -0
  95. package/types/editor/sceneHierarchy/inspector/MultiView/MultiView.d.ts +11 -0
  96. package/types/editor/sceneHierarchy/inspector/SceneInspector.d.ts +7 -0
  97. package/types/editor/sceneHierarchy/inspector/utils/InspectCamera.d.ts +3 -0
  98. package/types/editor/sceneHierarchy/inspector/utils/InspectLight.d.ts +3 -0
  99. package/types/editor/sceneHierarchy/inspector/utils/InspectMaterial.d.ts +8 -0
  100. package/types/editor/sceneHierarchy/inspector/utils/InspectTransform.d.ts +3 -0
  101. package/types/editor/sceneHierarchy/types.d.ts +98 -7
  102. package/types/editor/sceneHierarchy/utils.d.ts +7 -1
  103. package/types/editor/utils.d.ts +3 -0
  104. package/types/example/CustomEditor.d.ts +1 -0
  105. package/types/example/constants.d.ts +15 -3
  106. package/types/example/three/CustomMaterial.d.ts +5 -0
  107. package/types/example/three/ExampleScene.d.ts +18 -0
  108. package/types/example/three/FBXAnimation.d.ts +6 -0
  109. package/types/{library.d.ts → index.d.ts} +5 -0
  110. package/src/example/App.tsx +0 -88
  111. package/src/library.ts +0 -16
  112. package/types/core/remote/RemoteDebug.d.ts +0 -23
  113. package/types/debug/Editor.d.ts +0 -8
  114. package/types/debug/components/Draggable.d.ts +0 -2
  115. package/types/debug/components/DraggableItem.d.ts +0 -2
  116. package/types/debug/components/Dropdown.d.ts +0 -2
  117. package/types/debug/components/DropdownItem.d.ts +0 -2
  118. package/types/debug/components/NavButton.d.ts +0 -5
  119. package/types/debug/components/icons/CloseIcon.d.ts +0 -2
  120. package/types/debug/components/icons/DragIcon.d.ts +0 -2
  121. package/types/debug/components/types.d.ts +0 -31
  122. package/types/debug/global.d.ts +0 -9
  123. package/types/debug/sceneHierarchy/ChildObject.d.ts +0 -2
  124. package/types/debug/sceneHierarchy/ContainerObject.d.ts +0 -2
  125. package/types/debug/sceneHierarchy/SceneHierarchy.d.ts +0 -13
  126. package/types/debug/sceneHierarchy/types.d.ts +0 -8
  127. package/types/debug/sceneHierarchy/utils.d.ts +0 -2
  128. package/types/debug/utils.d.ts +0 -4
  129. /package/src/example/{App.css → components/App.css} +0 -0
  130. /package/types/example/{App.d.ts → components/App.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- (function(v,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("@theatre/core"),require("tweakpane"),require("@tweakpane/plugin-essentials"),require("three"),require("react"),require("framer-motion"),require("@theatre/studio")):typeof define=="function"&&define.amd?define(["exports","@theatre/core","tweakpane","@tweakpane/plugin-essentials","three","react","framer-motion","@theatre/studio"],x):(v=typeof globalThis<"u"?globalThis:v||self,x(v.Hermes={},v["Theatre Core"],v.tweakpane,v["tweakpane-plugin-essentials"],v.Three,v.React,v["framer-motion"],v["Theatre Studio"]))})(this,function(v,x,A,Ve,Ge,N,le,W){"use strict";var $t=Object.defineProperty;var Yt=(v,x,A)=>x in v?$t(v,x,{enumerable:!0,configurable:!0,writable:!0,value:A}):v[x]=A;var C=(v,x,A)=>(Yt(v,typeof x!="symbol"?x+"":x,A),A);function qe(n){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(a,r,o.get?o:{enumerable:!0,get:()=>n[r]})}}return a.default=n,Object.freeze(a)}const ze=qe(Ve);class q{constructor(a){C(this,"app");this.app=a}dispose(){}}class ue extends q{constructor(a){super(a)}selectDropdown(a,r){this.app.send({event:"selectComponent",data:{dropdown:a,value:r}})}updateDropdown(a,r){this.app.send({event:"draggableListUpdate",data:{dropdown:a,value:r}})}}function Je(){return Math.round(Math.random()*1e6).toString()}function Ke(n){return n.r!==void 0&&n.g!==void 0&&n.b!==void 0}const de=()=>{};class fe extends q{constructor(r,o,i){super(r);C(this,"project");C(this,"sheets");C(this,"sheetObjects");C(this,"sheetObjectCBs");C(this,"sheetObjectUnsubscribe");this.project=x.getProject(o,i),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(r){var i;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let o=this.sheets.get(r);return o!==void 0||(o=(i=this.project)==null?void 0:i.sheet(r),this.sheets.set(r,o)),o}sheetObject(r,o,i,l){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const E=this.sheets.get(r);if(E===void 0)return;const m=`${r}_${o}`;let d=this.sheetObjects.get(m);if(d!==void 0)return d=E.object(o,{...i,...d.value},{reconfigure:!0}),d;d=E.object(o,i),this.sheetObjects.set(m,d),this.sheetObjectCBs.set(m,l!==void 0?l:de);const y=d.onValuesChange(p=>{if(this.app.editor){for(const S in p){const _=p[S];typeof _=="object"&&Ke(_)&&(p[S]={r:_.r,g:_.g,b:_.b,a:_.a})}this.app.send({event:"updateSheetObject",data:{sheetObject:m,values:p}})}else{const S=this.sheetObjectCBs.get(m);S!==void 0&&S(p)}});return this.sheetObjectUnsubscribe.set(m,y),d}unsubscribe(r){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const o=`${r.address.sheetId}_${r.address.objectKey}`,i=this.sheetObjectUnsubscribe.get(o);i!==void 0&&i()}}class he extends q{constructor(r){super(r);C(this,"appTab");C(this,"systemTab");C(this,"utilsTab");C(this,"bindCBs");C(this,"buttonCBs");C(this,"pane");C(this,"appCallbacks",0);C(this,"editorCallbacks",0);this.bindCBs=new Map,this.buttonCBs=new Map,r.editor&&this.createGUI()}createGUI(){this.pane=new A.Pane({title:"GUI"}),this.pane.registerPlugin(ze);const r=this.pane.element.parentElement;r.style.left="50%",r.style.top="0",r.style.maxHeight="100%",r.style.overflowX="hidden",r.style.overflowY="auto",r.style.transform="translateX(-50%)",r.style.width="300px",r.style.zIndex="100";const o=this.pane.addTab({pages:[{title:"App"},{title:"System"},{title:"Tools"}]});this.appTab=o.pages[0],this.systemTab=o.pages[1],this.utilsTab=o.pages[2]}dispose(){var r,o,i,l;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((r=this.appTab)==null||r.dispose(),(o=this.systemTab)==null||o.dispose(),(i=this.utilsTab)==null||i.dispose(),(l=this.pane)==null||l.dispose(),this.appTab=void 0,this.systemTab=void 0,this.utilsTab=void 0,this.pane=void 0)}addFolder(r,o=void 0,i=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.appTab).addFolder({title:r,...o});this.app.send({event:"addFolder",data:{name:r,params:o,parent:i}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(r,o,i,l=void 0){const E=this.bindID,m=i.onChange!==void 0?i.onChange:de;this.bindCBs.set(E,m),this.app.editor?(this.pane===void 0&&this.createGUI(),(l!==void 0?l:this.appTab).addBinding(r,o,i).on("change",y=>{this.app.send({event:"updateBind",data:{id:E,value:y.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",data:{id:E,name:o,params:i,parent:l}}),this.appCallbacks++)}triggerBind(r,o){const i=this.bindCBs.get(r);i!==void 0?i(o):console.warn(`No callback for: ${r}`,o)}button(r,o,i=void 0){const l=this.bindID;this.buttonCBs.set(l,o),this.app.editor?(this.pane===void 0&&this.createGUI(),(i!==void 0?i:this.appTab).addButton({title:r}).on("click",()=>{this.app.send({event:"clickButton",data:{id:l}})}),this.editorCallbacks++):(this.app.send({event:"addButton",data:{id:l,name:r,callback:o,parent:i}}),this.appCallbacks++)}triggerButton(r){const o=this.buttonCBs.get(r);o!==void 0&&o()}}class Xe{constructor(a,r){C(this,"components");C(this,"debug");C(this,"theatre");C(this,"mode","listener");C(this,"channel");this.editor=a&&document.location.hash.search(r)>-1,a&&(this.channel=new BroadcastChannel("theatre"))}setupComponents(){this.components=new ue(this)}setupGUI(){this.debug=new he(this)}setupTheatre(a,r){this.theatre=new fe(this,a,r)}dispose(){var a,r,o;(a=this.components)==null||a.dispose(),(r=this.debug)==null||r.dispose(),(o=this.theatre)==null||o.dispose()}send(a){this.mode==="editor"&&this.channel!==void 0&&this.channel.postMessage(a)}listen(a){this.mode==="listener"&&this.channel!==void 0&&(this.channel.onmessage=r=>{a(r.data)})}get editor(){return this.mode==="editor"}set editor(a){a&&(this.mode="editor",document.title+=" - Editor")}}const k=new Ge.EventDispatcher,P={SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",INSPECT_ITEM:"ToolEvents::inspectItem",REFRESH_SCENE:"ToolEvents::refreshScene",SET_SCENE:"ToolEvents::setScene"};var Q={exports:{}},$={};/**
1
+ (function(x,d){typeof exports=="object"&&typeof module<"u"?d(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"],d):(x=typeof globalThis<"u"?globalThis:x||self,d(x.Hermes={},x.Three,x["Theatre Core"],x.tweakpane,x["tweakpane-plugin-essentials"],x.React,x["framer-motion"],x["Theatre Studio"]))})(this,function(x,d,pe,zt,Ht,I,Et,_e){"use strict";var Vn=Object.defineProperty;var Gn=(x,d,pe)=>d in x?Vn(x,d,{enumerable:!0,configurable:!0,writable:!0,value:pe}):x[d]=pe;var z=(x,d,pe)=>(Gn(x,typeof d!="symbol"?d+"":d,pe),pe);function Wt(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const e=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,e.get?e:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const Kt=Wt(Ht);class Xt{constructor(n,i,e){z(this,"channel");z(this,"components",new Map);z(this,"_mode","app");this.editor=i&&document.location.hash.search(e)>-1,i&&(this.channel=new BroadcastChannel(n))}addComponent(n,i){this.components.set(n,i)}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=i=>{n(i.data)})}get mode(){return this._mode}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor",document.title+=" - Editor")}}const L=new d.EventDispatcher,U={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",GET_SCENE:"ToolEvents::getScene",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 Ae{constructor(n){z(this,"app");this.app=n}dispose(){}}class Zt extends Ae{selectDropdown(n,i){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:i}})}updateDropdown(n,i){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:i}})}}function Jt(){return Math.round(Math.random()*1e6).toString()}function Qt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function qt(t){const n=Math.round(t.r*255),i=Math.round(t.g*255),e=Math.round(t.b*255),r=c=>{const h=c.toString(16);return h.length===1?"0"+h:h},l=r(n),m=r(i),s=r(e);return"#"+l+m+s}const wt=()=>{};class $t extends Ae{constructor(i,e,r){super(i);z(this,"project");z(this,"sheets");z(this,"sheetObjects");z(this,"sheetObjectCBs");z(this,"sheetObjectUnsubscribe");this.project=pe.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(i){var r;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let e=this.sheets.get(i);return e!==void 0||(e=(r=this.project)==null?void 0:r.sheet(i),this.sheets.set(i,e)),e}sheetObject(i,e,r,l){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const m=this.sheets.get(i);if(m===void 0)return;const s=`${i}_${e}`;let c=this.sheetObjects.get(s);if(c!==void 0)return c=m.object(e,{...r,...c.value},{reconfigure:!0}),c;c=m.object(e,r),this.sheetObjects.set(s,c),this.sheetObjectCBs.set(s,l!==void 0?l:wt);const h=c.onValuesChange(p=>{if(this.app.editor){for(const g in p){const w=p[g];typeof w=="object"&&Qt(w)&&(p[g]={r:w.r,g:w.g,b:w.b,a:w.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheetObject:s,values:p}})}else{const g=this.sheetObjectCBs.get(s);g!==void 0&&g(p)}});return this.sheetObjectUnsubscribe.set(s,h),c}unsubscribe(i){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const e=`${i.address.sheetId}_${i.address.objectKey}`,r=this.sheetObjectUnsubscribe.get(e);r!==void 0&&r()}}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 Ct(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(i=>{n.children.push(Ct(i))}),n}function tn(t){const n={};for(const i in t){const e=t[i].value;n[i]={value:e},e===null?n[i].value={src:""}:e.isTexture&&(n[i].value={src:e.image.src})}return n}function nn(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function St(t){const n={};for(const i in t){if(i.substring(0,1)==="_"||i.substring(0,2)==="is"||nn(i))continue;const e=typeof t[i],r=t[i];switch(e){case"boolean":case"number":case"string":n[i]=r;break;case"object":if(r!==null)if(n[i]=r,r.isTexture)if(r instanceof d.Texture){const l=r.source.toJSON();n[i]={src:l.url}}else r instanceof d.CubeTexture&&(console.log("env map"),console.log(r.source.data),console.log(r.source.toJSON()),n[i]={src:""});else i==="uniforms"&&(n[i]=tn(n[i]));else n[i]={src:""};break}}return n}function an(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements};if(t instanceof d.Mesh){const i=t;if(Array.isArray(i.material)){const e=[];i.material.forEach(r=>{e.push(St(r))}),n.material=e}else n.material=St(i.material)}else t instanceof d.Camera?t instanceof d.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 instanceof d.OrthographicCamera&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):t instanceof d.Light&&(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 $(t,n,i){const e=n.split(".");switch(e.length){case 1:t[e[0]]=i;break;case 2:t[e[0]][e[1]]=i;break;case 3:t[e[0]][e[1]][e[2]]=i;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=i;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=i;break}}function ct(t){return new Promise((n,i)=>{const e=new Image;e.onload=()=>{const r=new d.Texture(e);r.wrapS=d.RepeatWrapping,r.wrapT=d.RepeatWrapping,r.needsUpdate=!0,n(r)},e.onerror=i,e.src=t})}class rn extends Ae{constructor(){super(...arguments);z(this,"scene")}getObject(i){this.app.send({event:"getObject",target:"app",data:i})}setObject(i){const e=an(i);this.app.send({event:"setObject",target:"editor",data:e})}requestMethod(i,e,r){this.app.send({event:"requestMethod",target:"app",data:{uuid:i,key:e,value:r}})}updateObject(i,e,r){this.app.send({event:"updateObject",target:"app",data:{uuid:i,key:e,value:r}})}createTexture(i,e,r){this.app.send({event:"createTexture",target:"app",data:{uuid:i,key:e,value:r}})}getScene(){this.app.send({event:"getScene",target:"app"})}setScene(i){this.scene=i;const e=Ct(i);this.app.send({event:"setScene",target:"editor",data:e})}}class on extends Ae{constructor(i){super(i);z(this,"bindCBs");z(this,"buttonCBs");z(this,"pane");z(this,"appCallbacks",0);z(this,"editorCallbacks",0);z(this,"inspectorFolder");this.bindCBs=new Map,this.buttonCBs=new Map,i.editor&&this.createGUI()}createGUI(){this.pane=new zt.Pane({title:"GUI"}),this.pane.registerPlugin(Kt)}dispose(){var i;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((i=this.pane)==null||i.dispose(),this.pane=void 0)}addFolder(i,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:i,...e});this.app.send({event:"addFolder",target:"app",data:{name:i,params:e,parent:r}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(i,e,r,l=void 0){const m=this.bindID,s=r.onChange!==void 0?r.onChange:wt;this.bindCBs.set(m,s),this.app.editor?(this.pane===void 0&&this.createGUI(),(l!==void 0?l:this.pane).addBinding(i,e,r).on("change",h=>{this.app.send({event:"updateBind",target:"app",data:{id:m,value:h.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:m,name:e,params:r,parent:l}}),this.appCallbacks++)}triggerBind(i,e){const r=this.bindCBs.get(i);r!==void 0?r(e):console.warn(`No callback for: ${i}`,e)}button(i,e,r=void 0){const l=this.bindID;this.buttonCBs.set(l,e),this.app.editor?(this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addButton({title:i}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:l}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:l,name:i,callback:e,parent:r}}),this.appCallbacks++)}triggerButton(i){const e=this.buttonCBs.get(i);e!==void 0&&e()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const i=this.inspectorFolder.children.length-1;for(let e=i;e>-1;--e)this.inspectorFolder.remove(this.inspectorFolder.children[e])}}var lt={exports:{}},Ie={};/**
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 ve;function Ze(){if(ve)return $;ve=1;var n=N,a=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function E(m,d,y){var p,S={},_=null,F=null;y!==void 0&&(_=""+y),d.key!==void 0&&(_=""+d.key),d.ref!==void 0&&(F=d.ref);for(p in d)o.call(d,p)&&!l.hasOwnProperty(p)&&(S[p]=d[p]);if(m&&m.defaultProps)for(p in d=m.defaultProps,d)S[p]===void 0&&(S[p]=d[p]);return{$$typeof:a,type:m,key:_,ref:F,props:S,_owner:i.current}}return $.Fragment=r,$.jsx=E,$.jsxs=E,$}var Y={};/**
9
+ */var xt;function sn(){if(xt)return Ie;xt=1;var t=I,n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function m(s,c,h){var p,g={},w=null,O=null;h!==void 0&&(w=""+h),c.key!==void 0&&(w=""+c.key),c.ref!==void 0&&(O=c.ref);for(p in c)e.call(c,p)&&!l.hasOwnProperty(p)&&(g[p]=c[p]);if(s&&s.defaultProps)for(p in c=s.defaultProps,c)g[p]===void 0&&(g[p]=c[p]);return{$$typeof:n,type:s,key:w,ref:O,props:g,_owner:r.current}}return Ie.Fragment=i,Ie.jsx=m,Ie.jsxs=m,Ie}var Ne={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,16 +14,93 @@
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 pe;function Qe(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&function(){var n=N,a=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),m=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),F=Symbol.for("react.offscreen"),H=Symbol.iterator,ot="@@iterator";function ct(e){if(e===null||typeof e!="object")return null;var t=H&&e[H]||e[ot];return typeof t=="function"?t:null}var B=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(e){{for(var t=arguments.length,s=new Array(t>1?t-1:0),c=1;c<t;c++)s[c-1]=arguments[c];lt("error",e,s)}}function lt(e,t,s){{var c=B.ReactDebugCurrentFrame,b=c.getStackAddendum();b!==""&&(t+="%s",s=s.concat([b]));var g=s.map(function(h){return String(h)});g.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,g)}}var ut=!1,dt=!1,ft=!1,ht=!1,vt=!1,Ce;Ce=Symbol.for("react.module.reference");function pt(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===l||vt||e===i||e===y||e===p||ht||e===F||ut||dt||ft||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===S||e.$$typeof===E||e.$$typeof===m||e.$$typeof===d||e.$$typeof===Ce||e.getModuleId!==void 0))}function bt(e,t,s){var c=e.displayName;if(c)return c;var b=t.displayName||t.name||"";return b!==""?s+"("+b+")":s}function Se(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case r:return"Portal";case l:return"Profiler";case i:return"StrictMode";case y:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case m:var t=e;return Se(t)+".Consumer";case E:var s=e;return Se(s._context)+".Provider";case d:return bt(e,e.render,"ForwardRef");case S:var c=e.displayName||null;return c!==null?c:D(e.type)||"Memo";case _:{var b=e,g=b._payload,h=b._init;try{return D(h(g))}catch{return null}}}return null}var M=Object.assign,V=0,je,_e,Re,Te,we,xe,Oe;function ke(){}ke.__reactDisabledLog=!0;function mt(){{if(V===0){je=console.log,_e=console.info,Re=console.warn,Te=console.error,we=console.group,xe=console.groupCollapsed,Oe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ke,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function gt(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},e,{value:je}),info:M({},e,{value:_e}),warn:M({},e,{value:Re}),error:M({},e,{value:Te}),group:M({},e,{value:we}),groupCollapsed:M({},e,{value:xe}),groupEnd:M({},e,{value:Oe})})}V<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=B.ReactCurrentDispatcher,re;function z(e,t,s){{if(re===void 0)try{throw Error()}catch(b){var c=b.stack.trim().match(/\n( *(at )?)/);re=c&&c[1]||""}return`
18
- `+re+e}}var ne=!1,J;{var Et=typeof WeakMap=="function"?WeakMap:Map;J=new Et}function Pe(e,t){if(!e||ne)return"";{var s=J.get(e);if(s!==void 0)return s}var c;ne=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var g;g=te.current,te.current=null,mt();try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(I){c=I}Reflect.construct(e,[],h)}else{try{h.call()}catch(I){c=I}e.call(h.prototype)}}else{try{throw Error()}catch(I){c=I}e()}}catch(I){if(I&&c&&typeof I.stack=="string"){for(var f=I.stack.split(`
19
- `),w=c.stack.split(`
20
- `),j=f.length-1,R=w.length-1;j>=1&&R>=0&&f[j]!==w[R];)R--;for(;j>=1&&R>=0;j--,R--)if(f[j]!==w[R]){if(j!==1||R!==1)do if(j--,R--,R<0||f[j]!==w[R]){var O=`
21
- `+f[j].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,O),O}while(j>=1&&R>=0);break}}}finally{ne=!1,te.current=g,gt(),Error.prepareStackTrace=b}var L=e?e.displayName||e.name:"",He=L?z(L):"";return typeof e=="function"&&J.set(e,He),He}function yt(e,t,s){return Pe(e,!1)}function Ct(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function K(e,t,s){if(e==null)return"";if(typeof e=="function")return Pe(e,Ct(e));if(typeof e=="string")return z(e);switch(e){case y:return z("Suspense");case p:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return yt(e.render);case S:return K(e.type,t,s);case _:{var c=e,b=c._payload,g=c._init;try{return K(g(b),t,s)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,De={},Ie=B.ReactDebugCurrentFrame;function Z(e){if(e){var t=e._owner,s=K(e.type,e._source,t?t.type:null);Ie.setExtraStackFrame(s)}else Ie.setExtraStackFrame(null)}function St(e,t,s,c,b){{var g=Function.call.bind(X);for(var h in e)if(g(e,h)){var f=void 0;try{if(typeof e[h]!="function"){var w=Error((c||"React class")+": "+s+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}f=e[h](t,h,c,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(j){f=j}f&&!(f instanceof Error)&&(Z(b),T("%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).",c||"React class",s,h,typeof f),Z(null)),f instanceof Error&&!(f.message in De)&&(De[f.message]=!0,Z(b),T("Failed %s type: %s",s,f.message),Z(null))}}}var jt=Array.isArray;function ae(e){return jt(e)}function _t(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,s=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function Rt(e){try{return Ne(e),!1}catch{return!0}}function Ne(e){return""+e}function Ae(e){if(Rt(e))return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",_t(e)),Ne(e)}var G=B.ReactCurrentOwner,Tt={key:!0,ref:!0,__self:!0,__source:!0},Fe,Me,ie;ie={};function wt(e){if(X.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function xt(e){if(X.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Ot(e,t){if(typeof e.ref=="string"&&G.current&&t&&G.current.stateNode!==t){var s=D(G.current.type);ie[s]||(T('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',D(G.current.type),e.ref),ie[s]=!0)}}function kt(e,t){{var s=function(){Fe||(Fe=!0,T("%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)",t))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function Pt(e,t){{var s=function(){Me||(Me=!0,T("%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)",t))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var Dt=function(e,t,s,c,b,g,h){var f={$$typeof:a,type:e,key:t,ref:s,props:h,_owner:g};return f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function It(e,t,s,c,b){{var g,h={},f=null,w=null;s!==void 0&&(Ae(s),f=""+s),xt(t)&&(Ae(t.key),f=""+t.key),wt(t)&&(w=t.ref,Ot(t,b));for(g in t)X.call(t,g)&&!Tt.hasOwnProperty(g)&&(h[g]=t[g]);if(e&&e.defaultProps){var j=e.defaultProps;for(g in j)h[g]===void 0&&(h[g]=j[g])}if(f||w){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;f&&kt(h,R),w&&Pt(h,R)}return Dt(e,f,w,b,c,G.current,h)}}var se=B.ReactCurrentOwner,Be=B.ReactDebugCurrentFrame;function U(e){if(e){var t=e._owner,s=K(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(s)}else Be.setExtraStackFrame(null)}var oe;oe=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===a}function Ue(){{if(se.current){var e=D(se.current.type);if(e)return`
17
+ */var Ot;function cn(){return Ot||(Ot=1,process.env.NODE_ENV!=="production"&&function(){var t=I,n=Symbol.for("react.element"),i=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),R=Symbol.iterator,_="@@iterator";function E(a){if(a===null||typeof a!="object")return null;var f=R&&a[R]||a[_];return typeof f=="function"?f:null}var b=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(a){{for(var f=arguments.length,v=new Array(f>1?f-1:0),S=1;S<f;S++)v[S-1]=arguments[S];P("error",a,v)}}function P(a,f,v){{var S=b.ReactDebugCurrentFrame,A=S.getStackAddendum();A!==""&&(f+="%s",v=v.concat([A]));var N=v.map(function(M){return String(M)});N.unshift("Warning: "+f),Function.prototype.apply.call(console[a],console,N)}}var k=!1,K=!1,ne=!1,j=!1,le=!1,Re;Re=Symbol.for("react.module.reference");function se(a){return!!(typeof a=="string"||typeof a=="function"||a===e||a===l||le||a===r||a===h||a===p||j||a===O||k||K||ne||typeof a=="object"&&a!==null&&(a.$$typeof===w||a.$$typeof===g||a.$$typeof===m||a.$$typeof===s||a.$$typeof===c||a.$$typeof===Re||a.getModuleId!==void 0))}function D(a,f,v){var S=a.displayName;if(S)return S;var A=f.displayName||f.name||"";return A!==""?v+"("+A+")":v}function F(a){return a.displayName||"Context"}function B(a){if(a==null)return null;if(typeof a.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case e:return"Fragment";case i:return"Portal";case l:return"Profiler";case r:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case s:var f=a;return F(f)+".Consumer";case m:var v=a;return F(v._context)+".Provider";case c:return D(a,a.render,"ForwardRef");case g:var S=a.displayName||null;return S!==null?S:B(a.type)||"Memo";case w:{var A=a,N=A._payload,M=A._init;try{return B(M(N))}catch{return null}}}return null}var ee=Object.assign,ae=0,Pe,Ue,Fe,je,Be,Qe,Ve;function qe(){}qe.__reactDisabledLog=!0;function pt(){{if(ae===0){Pe=console.log,Ue=console.info,Fe=console.warn,je=console.error,Be=console.group,Qe=console.groupCollapsed,Ve=console.groupEnd;var a={configurable:!0,enumerable:!0,value:qe,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}ae++}}function gt(){{if(ae--,ae===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ee({},a,{value:Pe}),info:ee({},a,{value:Ue}),warn:ee({},a,{value:Fe}),error:ee({},a,{value:je}),group:ee({},a,{value:Be}),groupCollapsed:ee({},a,{value:Qe}),groupEnd:ee({},a,{value:Ve})})}ae<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ge=b.ReactCurrentDispatcher,Ye;function ye(a,f,v){{if(Ye===void 0)try{throw Error()}catch(A){var S=A.stack.trim().match(/\n( *(at )?)/);Ye=S&&S[1]||""}return`
18
+ `+Ye+a}}var Me=!1,Ee;{var vt=typeof WeakMap=="function"?WeakMap:Map;Ee=new vt}function $e(a,f){if(!a||Me)return"";{var v=Ee.get(a);if(v!==void 0)return v}var S;Me=!0;var A=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var N;N=Ge.current,Ge.current=null,pt();try{if(f){var M=function(){throw Error()};if(Object.defineProperty(M.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(M,[])}catch(ce){S=ce}Reflect.construct(a,[],M)}else{try{M.call()}catch(ce){S=ce}a.call(M.prototype)}}else{try{throw Error()}catch(ce){S=ce}a()}}catch(ce){if(ce&&S&&typeof ce.stack=="string"){for(var T=ce.stack.split(`
19
+ `),q=S.stack.split(`
20
+ `),Y=T.length-1,W=q.length-1;Y>=1&&W>=0&&T[Y]!==q[W];)W--;for(;Y>=1&&W>=0;Y--,W--)if(T[Y]!==q[W]){if(Y!==1||W!==1)do if(Y--,W--,W<0||T[Y]!==q[W]){var ie=`
21
+ `+T[Y].replace(" at new "," at ");return a.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",a.displayName)),typeof a=="function"&&Ee.set(a,ie),ie}while(Y>=1&&W>=0);break}}}finally{Me=!1,Ge.current=N,gt(),Error.prepareStackTrace=A}var De=a?a.displayName||a.name:"",Yt=De?ye(De):"";return typeof a=="function"&&Ee.set(a,Yt),Yt}function et(a,f,v){return $e(a,!1)}function tt(a){var f=a.prototype;return!!(f&&f.isReactComponent)}function we(a,f,v){if(a==null)return"";if(typeof a=="function")return $e(a,tt(a));if(typeof a=="string")return ye(a);switch(a){case h:return ye("Suspense");case p:return ye("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case c:return et(a.render);case g:return we(a.type,f,v);case w:{var S=a,A=S._payload,N=S._init;try{return we(N(A),f,v)}catch{}}}return""}var ke=Object.prototype.hasOwnProperty,nt={},ze=b.ReactDebugCurrentFrame;function ue(a){if(a){var f=a._owner,v=we(a.type,a._source,f?f.type:null);ze.setExtraStackFrame(v)}else ze.setExtraStackFrame(null)}function Ce(a,f,v,S,A){{var N=Function.call.bind(ke);for(var M in a)if(N(a,M)){var T=void 0;try{if(typeof a[M]!="function"){var q=Error((S||"React class")+": "+v+" type `"+M+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[M]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw q.name="Invariant Violation",q}T=a[M](f,M,S,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Y){T=Y}T&&!(T instanceof Error)&&(ue(A),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",S||"React class",v,M,typeof T),ue(null)),T instanceof Error&&!(T.message in nt)&&(nt[T.message]=!0,ue(A),y("Failed %s type: %s",v,T.message),ue(null))}}}var bt=Array.isArray;function He(a){return bt(a)}function at(a){{var f=typeof Symbol=="function"&&Symbol.toStringTag,v=f&&a[Symbol.toStringTag]||a.constructor.name||"Object";return v}}function We(a){try{return it(a),!1}catch{return!0}}function it(a){return""+a}function rt(a){if(We(a))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",at(a)),it(a)}var de=b.ReactCurrentOwner,yt={key:!0,ref:!0,__self:!0,__source:!0},ot,Ke,Se;Se={};function o(a){if(ke.call(a,"ref")){var f=Object.getOwnPropertyDescriptor(a,"ref").get;if(f&&f.isReactWarning)return!1}return a.ref!==void 0}function C(a){if(ke.call(a,"key")){var f=Object.getOwnPropertyDescriptor(a,"key").get;if(f&&f.isReactWarning)return!1}return a.key!==void 0}function V(a,f){if(typeof a.ref=="string"&&de.current&&f&&de.current.stateNode!==f){var v=B(de.current.type);Se[v]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',B(de.current.type),a.ref),Se[v]=!0)}}function G(a,f){{var v=function(){ot||(ot=!0,y("%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)",f))};v.isReactWarning=!0,Object.defineProperty(a,"key",{get:v,configurable:!0})}}function Q(a,f){{var v=function(){Ke||(Ke=!0,y("%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)",f))};v.isReactWarning=!0,Object.defineProperty(a,"ref",{get:v,configurable:!0})}}var fe=function(a,f,v,S,A,N,M){var T={$$typeof:n,type:a,key:f,ref:v,props:M,_owner:N};return T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(T,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(T,"_source",{configurable:!1,enumerable:!1,writable:!1,value:A}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T};function re(a,f,v,S,A){{var N,M={},T=null,q=null;v!==void 0&&(rt(v),T=""+v),C(f)&&(rt(f.key),T=""+f.key),o(f)&&(q=f.ref,V(f,A));for(N in f)ke.call(f,N)&&!yt.hasOwnProperty(N)&&(M[N]=f[N]);if(a&&a.defaultProps){var Y=a.defaultProps;for(N in Y)M[N]===void 0&&(M[N]=Y[N])}if(T||q){var W=typeof a=="function"?a.displayName||a.name||"Unknown":a;T&&G(M,W),q&&Q(M,W)}return fe(a,T,q,A,S,de.current,M)}}var st=b.ReactCurrentOwner,Xe=b.ReactDebugCurrentFrame;function Z(a){if(a){var f=a._owner,v=we(a.type,a._source,f?f.type:null);Xe.setExtraStackFrame(v)}else Xe.setExtraStackFrame(null)}var te;te=!1;function he(a){return typeof a=="object"&&a!==null&&a.$$typeof===n}function me(){{if(st.current){var a=B(st.current.type);if(a)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function Nt(e){{if(e!==void 0){var t=e.fileName.replace(/^.*[\\\/]/,""),s=e.lineNumber;return`
23
+ Check the render method of \``+a+"`."}return""}}function xe(a){{if(a!==void 0){var f=a.fileName.replace(/^.*[\\\/]/,""),v=a.lineNumber;return`
24
24
 
25
- Check your code at `+t+":"+s+"."}return""}}var Le={};function At(e){{var t=Ue();if(!t){var s=typeof e=="string"?e:e.displayName||e.name;s&&(t=`
25
+ Check your code at `+f+":"+v+"."}return""}}var Oe={};function An(a){{var f=me();if(!f){var v=typeof a=="string"?a:a.displayName||a.name;v&&(f=`
26
26
 
27
- Check the top-level render call using <`+s+">.")}return t}}function We(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=At(t);if(Le[s])return;Le[s]=!0;var c="";e&&e._owner&&e._owner!==se.current&&(c=" It was passed a child from "+D(e._owner.type)+"."),U(e),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,c),U(null)}}function $e(e,t){{if(typeof e!="object")return;if(ae(e))for(var s=0;s<e.length;s++){var c=e[s];ce(c)&&We(c,t)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var b=ct(e);if(typeof b=="function"&&b!==e.entries)for(var g=b.call(e),h;!(h=g.next()).done;)ce(h.value)&&We(h.value,t)}}}function Ft(e){{var t=e.type;if(t==null||typeof t=="string")return;var s;if(typeof t=="function")s=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===d||t.$$typeof===S))s=t.propTypes;else return;if(s){var c=D(t);St(s,e.props,"prop",c,e)}else if(t.PropTypes!==void 0&&!oe){oe=!0;var b=D(t);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mt(e){{for(var t=Object.keys(e.props),s=0;s<t.length;s++){var c=t[s];if(c!=="children"&&c!=="key"){U(e),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),U(null);break}}e.ref!==null&&(U(e),T("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}function Ye(e,t,s,c,b,g){{var h=pt(e);if(!h){var f="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(f+=" 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 w=Nt(b);w?f+=w:f+=Ue();var j;e===null?j="null":ae(e)?j="array":e!==void 0&&e.$$typeof===a?(j="<"+(D(e.type)||"Unknown")+" />",f=" Did you accidentally export a JSX literal instead of a component?"):j=typeof e,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",j,f)}var R=It(e,t,s,b,g);if(R==null)return R;if(h){var O=t.children;if(O!==void 0)if(c)if(ae(O)){for(var L=0;L<O.length;L++)$e(O[L],e);Object.freeze&&Object.freeze(O)}else T("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 $e(O,e)}return e===o?Mt(R):Ft(R),R}}function Bt(e,t,s){return Ye(e,t,s,!0)}function Ut(e,t,s){return Ye(e,t,s,!1)}var Lt=Ut,Wt=Bt;Y.Fragment=o,Y.jsx=Lt,Y.jsxs=Wt}()),Y}process.env.NODE_ENV==="production"?Q.exports=Ze():Q.exports=Qe();var u=Q.exports;function ee(n){return n.title.search("<")>-1?u.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:n.title}}):u.jsx("button",{children:n.title})}const et=u.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[u.jsx("circle",{cx:"7",cy:"7",r:"6"}),u.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),u.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),tt=u.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:u.jsx("path",{d:`M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
27
+ Check the top-level render call using <`+v+">.")}return f}}function Bt(a,f){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var v=An(f);if(Oe[v])return;Oe[v]=!0;var S="";a&&a._owner&&a._owner!==st.current&&(S=" It was passed a child from "+B(a._owner.type)+"."),Z(a),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,S),Z(null)}}function Vt(a,f){{if(typeof a!="object")return;if(He(a))for(var v=0;v<a.length;v++){var S=a[v];he(S)&&Bt(S,f)}else if(he(a))a._store&&(a._store.validated=!0);else if(a){var A=E(a);if(typeof A=="function"&&A!==a.entries)for(var N=A.call(a),M;!(M=N.next()).done;)he(M.value)&&Bt(M.value,f)}}}function In(a){{var f=a.type;if(f==null||typeof f=="string")return;var v;if(typeof f=="function")v=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===c||f.$$typeof===g))v=f.propTypes;else return;if(v){var S=B(f);Ce(v,a.props,"prop",S,a)}else if(f.PropTypes!==void 0&&!te){te=!0;var A=B(f);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",A||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Nn(a){{for(var f=Object.keys(a.props),v=0;v<f.length;v++){var S=f[v];if(S!=="children"&&S!=="key"){Z(a),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),Z(null);break}}a.ref!==null&&(Z(a),y("Invalid attribute `ref` supplied to `React.Fragment`."),Z(null))}}function Gt(a,f,v,S,A,N){{var M=se(a);if(!M){var T="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(T+=" 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=xe(A);q?T+=q:T+=me();var Y;a===null?Y="null":He(a)?Y="array":a!==void 0&&a.$$typeof===n?(Y="<"+(B(a.type)||"Unknown")+" />",T=" Did you accidentally export a JSX literal instead of a component?"):Y=typeof a,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Y,T)}var W=re(a,f,v,A,N);if(W==null)return W;if(M){var ie=f.children;if(ie!==void 0)if(S)if(He(ie)){for(var De=0;De<ie.length;De++)Vt(ie[De],a);Object.freeze&&Object.freeze(ie)}else y("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 Vt(ie,a)}return a===e?Nn(W):In(W),W}}function Ln(a,f,v){return Gt(a,f,v,!0)}function Un(a,f,v){return Gt(a,f,v,!1)}var Fn=Un,Bn=Ln;Ne.Fragment=e,Ne.jsx=Fn,Ne.jsxs=Bn}()),Ne}process.env.NODE_ENV==="production"?lt.exports=sn():lt.exports=cn();var u=lt.exports;function ut(t){return t.title.search("<")>-1?u.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):u.jsx("button",{children:t.title})}const ln=u.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[u.jsx("circle",{cx:"7",cy:"7",r:"6"}),u.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),u.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),un=u.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:u.jsx("path",{d:`M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
28
28
  C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1
29
- C11,8.22,10.74,8,10.43,8z`})});function be(n){return u.jsx(le.Reorder.Item,{value:n.title,children:u.jsxs("div",{children:[tt,u.jsx("span",{children:n.title}),u.jsx("button",{className:"closeIcon",onClick:()=>{n.onDelete(n.index)},children:et})]})},n.title)}function me(n){const[a,r]=N.useState(!1),[o,i]=N.useState(n.options),l=y=>{n.onDragComplete(y),i(y)},E=y=>{const p=[...o];p.splice(y,1),l(p)},m=[];o.forEach((y,p)=>{m.push(u.jsx(be,{index:p,title:y,onDelete:E},y))});let d="dropdown draggable";return n.subdropdown&&(d+=" subdropdown"),u.jsxs("div",{className:d,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[u.jsx(ee,{title:n.title}),u.jsx(le.Reorder.Group,{axis:"y",values:o,onReorder:l,style:{visibility:a?"visible":"hidden"},children:m})]})}function ge(n){const[a,r]=N.useState(!1),o=[];n.options.map((l,E)=>{n.onSelect!==void 0&&(l.onSelect=n.onSelect),o.push(u.jsx(Ee,{option:l},E))});let i="dropdown";return n.subdropdown&&(i+=" subdropdown"),u.jsxs("div",{className:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[u.jsx(ee,{title:n.title}),u.jsx("ul",{style:{visibility:a?"visible":"hidden"},children:o})]})}function Ee(n){const{option:a}=n,[r,o]=N.useState("");let i=null;switch(a.type){case"draggable":i=u.jsx(me,{title:a.title,options:a.value,onDragComplete:l=>{a.onDragComplete!==void 0&&a.onDragComplete(l)},subdropdown:!0});break;case"dropdown":i=u.jsx(ge,{title:a.title,options:a.value,onSelect:a.onSelect,subdropdown:!0});break;case"option":i=u.jsx("button",{onClick:()=>{a.onSelect!==void 0&&a.onSelect(a.value),a.selectable&&(r!==a.title?o(a.title):o(""))},children:a.title});break}return u.jsx("li",{className:r===a.title?"selected":"",children:i},Je())}function rt(n){let a;const r=()=>{W.ui.hide(),n.listen(i=>{var E,m,d,y,p,S,_,F,H;let l;switch(i.event){case"draggableListUpdate":k.dispatchEvent({type:P.DRAG_UPDATE,value:i.data});break;case"selectComponent":k.dispatchEvent({type:P.SELECT_DROPDOWN,value:i.data});break;case"addFolder":(E=n.debug)==null||E.addFolder(i.data.name,i.data.params,i.data.parent);break;case"bindObject":(m=n.debug)==null||m.bind(i.data.name,i.data.params,i.data.parent);break;case"updateBind":(d=n.debug)==null||d.triggerBind(i.data.id,i.data.value);break;case"addButton":(y=n.debug)==null||y.button(i.data.name,i.data.callback,i.data.parent);break;case"clickButton":(p=n.debug)==null||p.triggerButton(i.data.id);break;case"setSheet":l=(S=n.theatre)==null?void 0:S.sheets.get(i.data.sheet),l!==void 0&&(a=l,W.setSelection([l]));break;case"setSheetObject":l=(_=n.theatre)==null?void 0:_.sheetObjects.get(`${i.data.sheet}_${i.data.key}`),l!==void 0&&W.setSelection([l]);break;case"updateSheetObject":l=(F=n.theatre)==null?void 0:F.sheetObjectCBs.get(i.data.sheetObject),l!==void 0&&l(i.data.values);break;case"updateTimeline":a=(H=n.theatre)==null?void 0:H.sheets.get(i.data.sheet),a!==void 0&&(a.sequence.position=i.data.position);break}})},o=()=>{W.ui.restore(),W.onSelectionChange(m=>{m.length<1||m.forEach(d=>{var _;let y=d.address.sheetId,p="setSheet",S={};switch(d.type){case"Theatre_Sheet_PublicAPI":p="setSheet",S={sheet:d.address.sheetId},a=(_=n.theatre)==null?void 0:_.sheets.get(d.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":p="setSheetObject",y+=`_${d.address.objectKey}`,S={id:y,sheet:d.address.sheetId,key:d.address.objectKey};break}n.send({event:p,data:S})})});let i=0;const l=()=>{if(a!==void 0&&i!==a.sequence.position){i=a.sequence.position;const m=a;n.send({event:"updateTimeline",data:{position:i,sheet:m.address.sheetId}})}},E=()=>{l(),requestAnimationFrame(E)};l(),E()};n.editor?o():r()}const Ht="";function nt(n){if(n.name==="cameras")return"camera";if(n.name==="interactive")return"interactive";if(n.name==="lights")return"light";if(n.name==="ui")return"ui";if(n.name==="utils")return"utils";const a=n.type;return a.search("Helper")>-1?"icon_utils":a.search("Camera")>-1?"camera":a.search("Light")>-1?"light":"obj3D"}function ye(n){const[a,r]=N.useState(!1);let o=null,i=!1;if(n.child.children.length>0){i=!0;const l=[];n.child.children.map(E=>{l.push(u.jsx(ye,{child:E},Math.random()))}),o=u.jsx("div",{className:`container ${a?"":"closed"}`,children:l})}return u.jsxs("div",{className:"childObject",children:[u.jsxs("div",{className:"child",children:[i?u.jsx("button",{className:"status",style:{backgroundPositionX:a?"-14px":"2px"},onClick:()=>{r(!a)}}):null,u.jsx("button",{className:"name",style:{left:i?"20px":"5px"},onClick:()=>{k.dispatchEvent({type:P.INSPECT_ITEM,value:n.child})},children:n.child.name.length>0?`${n.child.name} (${n.child.type})`:`${n.child.type}::${n.child.uuid}`}),u.jsx("div",{className:`icon ${nt(n.child)}`})]}),o]},Math.random())}function at(n){const a=[];return n.child.children.map(r=>{a.push(u.jsx(ye,{child:r},Math.random()))}),u.jsx("div",{className:"scene",children:a})}class it extends N.Component{constructor(r){super(r);C(this,"onUpdate",()=>{});C(this,"toggleOpen",()=>{this.setState(()=>({open:!this.componentState.open}))});C(this,"onRefresh",()=>{k.dispatchEvent({type:P.INSPECT_ITEM,value:this.componentState.scene})});C(this,"onSetScene",r=>{console.log("SceneHierarchy::onSetScene",r),this.setState(()=>({scene:r.value}))});this.state={open:!1,scene:null},k.addEventListener(P.REFRESH_SCENE,this.onUpdate),k.addEventListener(P.SET_SCENE,this.onSetScene)}componentWillUnmount(){k.removeEventListener(P.REFRESH_SCENE,this.onUpdate),k.removeEventListener(P.SET_SCENE,this.onSetScene)}render(){const r=this.componentState.scene!==null?`Hierarchy: ${this.componentState.scene.name}`:"Hierarchy";return u.jsxs("div",{id:"SceneHierarchy",children:[u.jsxs("div",{className:"header",children:[u.jsx("button",{className:"status",style:{backgroundPositionX:this.componentState.open?"-14px":"2px"},onClick:this.toggleOpen}),u.jsx("span",{children:r}),u.jsx("button",{className:"refresh hideText",onClick:this.onRefresh,children:"Refresh"})]}),this.componentState.scene!==null&&this.componentState.open?u.jsx(at,{child:this.componentState.scene}):null]})}get componentState(){return this.state}}const Vt="";function st(n){return u.jsxs("div",{className:"editor",ref:n.ref,style:n.style,children:[u.jsx("div",{className:"navBar",children:n.children}),n.components]})}v.Application=Xe,v.BaseRemote=q,v.Draggable=me,v.DraggableItem=be,v.Dropdown=ge,v.DropdownItem=Ee,v.Editor=st,v.NavButton=ee,v.RemoteComponents=ue,v.RemoteController=rt,v.RemoteTheatre=fe,v.RemoteTweakpane=he,v.SceneHierarchy=it,v.ToolEvents=P,v.debugDispatcher=k,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
29
+ C11,8.22,10.74,8,10.43,8z`})});function Tt(t){return u.jsx(Et.Reorder.Item,{value:t.title,children:u.jsxs("div",{children:[un,u.jsx("span",{children:t.title}),u.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:ln})]})},t.title)}function Rt(t){const[n,i]=I.useState(!1),[e,r]=I.useState(t.options),l=h=>{t.onDragComplete(h),r(h)},m=h=>{const p=[...e];p.splice(h,1),l(p)},s=[];e.forEach((h,p)=>{s.push(u.jsx(Tt,{index:p,title:h,onDelete:m},h))});let c="dropdown draggable";return t.subdropdown&&(c+=" subdropdown"),u.jsxs("div",{className:c,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[u.jsx(ut,{title:t.title}),u.jsx(Et.Reorder.Group,{axis:"y",values:e,onReorder:l,style:{visibility:n?"visible":"hidden"},children:s})]})}function Pt(t){const[n,i]=I.useState(!1),e=[];t.options.map((l,m)=>{t.onSelect!==void 0&&(l.onSelect=t.onSelect),e.push(u.jsx(jt,{option:l},m))});let r="dropdown";return t.subdropdown&&(r+=" subdropdown"),u.jsxs("div",{className:r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[u.jsx(ut,{title:t.title}),u.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function jt(t){const{option:n}=t,[i,e]=I.useState("");let r;switch(n.type){case"draggable":r=u.jsx(Rt,{title:n.title,options:n.value,onDragComplete:l=>{n.onDragComplete!==void 0&&n.onDragComplete(l)},subdropdown:!0});break;case"dropdown":r=u.jsx(Pt,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":r=u.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(i!==n.title?e(n.title):e(""))},children:n.title});break}return u.jsx("li",{className:i===n.title?"selected":"",children:r},Jt())}function dn(t){let n;const i=t.editor?"editor":"app";function e(s){var h,p,g,w,O,R,_,E,b;let c;switch(s.event){case"custom":L.dispatchEvent({type:U.CUSTOM,value:s.data});break;case"selectComponent":L.dispatchEvent({type:U.SELECT_DROPDOWN,value:s.data});break;case"draggableListUpdate":L.dispatchEvent({type:U.DRAG_UPDATE,value:s.data});break;case"addFolder":(h=t.components.get("debug"))==null||h.addFolder(s.data.name,s.data.params,s.data.parent);break;case"bindObject":(p=t.components.get("debug"))==null||p.bind(s.data.name,s.data.params,s.data.parent);break;case"updateBind":(g=t.components.get("debug"))==null||g.triggerBind(s.data.id,s.data.value);break;case"addButton":(w=t.components.get("debug"))==null||w.button(s.data.name,s.data.callback,s.data.parent);break;case"clickButton":(O=t.components.get("debug"))==null||O.triggerButton(s.data.id);break;case"setSheet":c=(R=t.components.get("theatre"))==null?void 0:R.sheets.get(s.data.sheet),c!==void 0&&(n=c,_e.setSelection([c]));break;case"setSheetObject":c=(_=t.components.get("theatre"))==null?void 0:_.sheetObjects.get(`${s.data.sheet}_${s.data.key}`),c!==void 0&&_e.setSelection([c]);break;case"updateSheetObject":c=(E=t.components.get("theatre"))==null?void 0:E.sheetObjectCBs.get(s.data.sheetObject),c!==void 0&&c(s.data.values);break;case"updateTimeline":n=(b=t.components.get("theatre"))==null?void 0:b.sheets.get(s.data.sheet),n!==void 0&&(n.sequence.position=s.data.position);break;case"getScene":L.dispatchEvent({type:U.GET_SCENE});break;case"getObject":L.dispatchEvent({type:U.GET_OBJECT,value:s.data});break;case"updateObject":L.dispatchEvent({type:U.UPDATE_OBJECT,value:s.data});break;case"createTexture":L.dispatchEvent({type:U.CREATE_TEXTURE,value:s.data});break;case"requestMethod":L.dispatchEvent({type:U.REQUEST_METHOD,value:s.data});break}}function r(s){switch(s.event){case"custom":L.dispatchEvent({type:U.CUSTOM,value:s.data});break;case"setObject":L.dispatchEvent({type:U.SET_OBJECT,value:s.data});break;case"setScene":L.dispatchEvent({type:U.SET_SCENE,value:s.data});break}}function l(){_e.ui.hide()}function m(){_e.ui.restore(),_e.onSelectionChange(p=>{p.length<1||p.forEach(g=>{var _;let w=g.address.sheetId,O="setSheet",R={};switch(g.type){case"Theatre_Sheet_PublicAPI":O="setSheet",R={sheet:g.address.sheetId},n=(_=t.components.get("theatre"))==null?void 0:_.sheets.get(g.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":O="setSheetObject",w+=`_${g.address.objectKey}`,R={id:w,sheet:g.address.sheetId,key:g.address.objectKey};break}t.send({event:O,target:"app",data:R})})});let s=0;const c=()=>{if(n!==void 0&&s!==n.sequence.position){s=n.sequence.position;const p=n;t.send({event:"updateTimeline",target:"app",data:{position:s,sheet:p.address.sheetId}})}},h=()=>{c(),requestAnimationFrame(h)};c(),h()}t.listen(s=>{i==="app"?e(s):r(s)}),t.editor?m():l()}const Yn="";function dt(t){const[n,i]=I.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return u.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[u.jsxs("button",{className:"toggle",onClick:()=>{const r=!n;t.onToggle!==void 0&&t.onToggle(r),i(r)},children:[u.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),u.jsx("p",{className:"label",children:t.label})]}),t.button,u.jsx("div",{className:n?"open":"",children:u.jsx("div",{children:t.children})})]})}function Mt(t){const[n,i]=I.useState(t.child.children.length>0),e=t.child.children.length>0,r=[];return t.child.children.length>0&&t.child.children.map(l=>{r.push(u.jsx(Mt,{child:l,three:t.three},Math.random()))}),u.jsxs("div",{className:"childObject",children:[u.jsxs("div",{className:"child",children:[e?u.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{i(!n)}}):null,u.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}`}),u.jsx("div",{className:`icon ${en(t.child)}`})]}),u.jsx("div",{className:n?"open":"",children:u.jsx("div",{className:"container",children:r})})]},Math.random())}function fn(t){const n=[];return t.child.children.map(i=>{n.push(u.jsx(Mt,{child:i,three:t.three},Math.random()))}),u.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const zn="",hn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function mn(t){return"items"in t}function Te(t){function n(e,r){console.log("onChange:",e,r)}const i=[];return t.items.forEach(e=>{mn(e)?i.push(u.jsx(Te,{title:e.title,items:e.items},Math.random())):i.push(u.jsx(Le,{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,l)=>{e.onChange!==void 0?e.onChange(r,l):n(r,l)}},Math.random()))}),u.jsx(dt,{label:t.title,open:!1,children:i})}function pn(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 ge(t){switch(t){case"alphaMap":return"Alpha 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"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";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"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"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"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"sheenColor":return"Sheen Color";case"sheenRoughness":return"Sheen Roughness";case"shininess":return"Shininess";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularIntensity":return"Specular Intensity";case"thickness":return"Thickness";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 gn(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,i)=>{t.addEventListener("change",function(){if(t.files===null)i();else{const e=t.files[0],r=new FileReader;r.onload=function(l){n(l.target.result)},r.readAsDataURL(e)}}),t.click()})}function kt(t,n,i){const e=[];for(const r in t){if(!pn(r))continue;const l=typeof t[r],m=t[r];if(l==="boolean"||l==="number"||l==="string"){const s={title:ge(r),prop:r,type:l,value:m,min:void 0,max:void 0,onChange:(c,h)=>{var g;i.updateObject(n.uuid,`material.${c}`,h),l==="boolean"&&i.updateObject(n.uuid,"material.needsUpdate",!0);const p=(g=i.scene)==null?void 0:g.getObjectByProperty("uuid",n.uuid);p!==void 0&&$(p,`material.${c}`,h)}};gn(r)&&(s.value=Number(m),s.type="range",s.min=0,s.max=1,s.step=.01),e.push(s)}else if(l==="object")if(m.isColor)e.push({title:ge(r),prop:r,type:"color",value:m,onChange:(s,c)=>{var g;const h=new d.Color(c);i.updateObject(n.uuid,`material.${s}`,h);const p=(g=i.scene)==null?void 0:g.getObjectByProperty("uuid",n.uuid);p!==void 0&&$(p,`material.${s}`,h)}});else if(Array.isArray(m)){const s=[];for(const c in m)s.push({title:`${c}`,type:`${typeof m[c]}`,value:m[c],onChange:(h,p)=>{var w;i.updateObject(n.uuid,`material.${r}`,p);const g=(w=i.scene)==null?void 0:w.getObjectByProperty("uuid",n.uuid);g!==void 0&&$(g,`material.${r}`,p)}});e.push({title:ge(r),items:s})}else{const s=[];for(const c in m){const h=m[c];switch(typeof h){case"boolean":case"number":case"string":c==="src"?e.push({title:ge(r),type:"image",value:h,onChange:(g,w)=>{var R;i.createTexture(n.uuid,`material.${r}`,w);const O=(R=i.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);O!==void 0&&ct(w).then(_=>{$(O,`material.${r}`,_),$(O,"material.needsUpdate",!0)})}}):s.push({title:`${ge(c)}`,prop:`material.${r}.${c}`,type:`${typeof t[r][c]}`,value:m[c],onChange:(g,w)=>{var R;i.updateObject(n.uuid,`material.${r}.${c}`,w);const O=(R=i.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);O!==void 0&&$(O,`material.${r}.${c}`,w)}});break;case"object":h.value!==void 0&&h.value.src!==void 0?s.push({title:ge(c),type:"image",value:h.value.src,onChange:(g,w)=>{var R;i.createTexture(n.uuid,`material.${r}.${c}.value`,w);const O=(R=i.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);O!==void 0&&ct(w).then(_=>{$(O,`material.${r}.${c}.value`,_)})}}):s.push({title:c,type:`${typeof h.value}`,value:h.value,onChange:(g,w)=>{var R;i.updateObject(n.uuid,`material.${r}.${c}.value`,w);const O=(R=i.scene)==null?void 0:R.getObjectByProperty("uuid",n.uuid);O!==void 0&&$(O,`material.${r}.${c}.value`,w)}});break}}s.length>0&&e.push({title:ge(r),items:s})}else m!==void 0&&console.log("other:",r,l,m)}return e.sort((r,l)=>r.title<l.title?-1:r.title>l.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{i.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function bn(t,n){const i=t.material;if(Array.isArray(i)){const e=[],r=i.length;for(let l=0;l<r;l++)e.push(u.jsx(Te,{title:`Material ${l}`,items:kt(i[l],t,n)}));return u.jsx(u.Fragment,{children:e})}else return u.jsx(Te,{title:"Material",items:kt(i,t,n)})}function Le(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=qt(t.value));const[i,e]=I.useState(n),r=I.useRef(null),l=I.useRef(null),m=I.useRef(null);I.useEffect(()=>{var P;let p=!1,g=-1,w=0,O=Number(i);const R=k=>{p=!0,w=O,g=k.clientX},_=k=>{if(!p)return;const K=t.step!==void 0?t.step:1,ne=(k.clientX-g)*K;O=Number((w+ne).toFixed(4)),l.current!==null&&(l.current.value=O.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,O)},E=()=>{p=!1},b=()=>{p=!1},y=t.type==="number";return y&&((P=r.current)==null||P.addEventListener("mousedown",R,!1),document.addEventListener("mouseup",E,!1),document.addEventListener("mousemove",_,!1),document.addEventListener("contextmenu",b,!1)),()=>{var k;y&&((k=r.current)==null||k.removeEventListener("mousedown",R),document.removeEventListener("mouseup",E),document.removeEventListener("mousemove",_),document.removeEventListener("contextmenu",b))}},[i]);const s=t.type==="string"&&(i.length>100||i.search(`
30
+ `)>-1),c=s||t.type==="image",h=p=>{let g=p.target.value;t.type==="boolean"&&(g=p.target.checked),e(g),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,g)};return u.jsxs("div",{className:`field ${c?"block":""}`,children:[t.type!=="button"&&u.jsx("label",{ref:r,children:t.title},"fieldLabel"),t.type==="string"&&!s&&u.jsx("input",{type:"text",disabled:t.disabled,onChange:h,value:i}),t.type==="string"&&s&&u.jsx("textarea",{cols:50,rows:10,disabled:!0,onChange:h,value:i}),t.type==="boolean"&&u.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:h,checked:i}),t.type==="number"&&u.jsx("input",{ref:l,type:"number",value:i,min:t.min,max:t.max,step:t.step,onChange:h}),t.type==="range"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:i.toString(),onChange:h,className:"min"}),u.jsx("input",{disabled:t.disabled,type:"range",value:i,min:t.min,max:t.max,step:t.step,onChange:h})]}),t.type==="color"&&u.jsxs(u.Fragment,{children:[u.jsx("input",{type:"text",value:i.toString(),onChange:h,className:"color"}),u.jsx("input",{type:"color",value:i,onChange:h})]}),t.type==="button"&&u.jsx("button",{onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&u.jsx("img",{ref:m,onClick:()=>{vn().then(p=>{m.current.src=p,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,p)})},src:i.length>0?i:hn})]})}function Dt(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 yn(t,n){const i=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)i.push({title:Dt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,l)=>{var s;n.updateObject(t.uuid,r,l),n.requestMethod(t.uuid,"updateProjectionMatrix");const m=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);m!==void 0&&($(m,r,l),m.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)i.push({title:Dt(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,l)=>{var s;n.updateObject(t.uuid,r,l),n.requestMethod(t.uuid,"updateProjectionMatrix");const m=(s=n.scene)==null?void 0:s.getObjectByProperty("uuid",t.uuid);m!==void 0&&($(m,r,l),m.updateProjectionMatrix())}});return u.jsx(Te,{title:"Camera",items:i})}function En(t,n){const i=new d.Matrix4;i.elements=t.matrix;const e=new d.Vector3,r=new d.Euler,l=new d.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(i),r.setFromRotationMatrix(i),l.setFromMatrixScale(i));const m=(c,h)=>{var g;n.updateObject(t.uuid,c,h);const p=(g=n.scene)==null?void 0:g.getObjectByProperty("uuid",t.uuid);p!==void 0&&$(p,c,h)},s=[{title:"Position",items:[{title:"X",prop:"position.x",type:"number",value:e.x,onChange:m},{title:"Y",prop:"position.y",type:"number",value:e.y,onChange:m},{title:"Z",prop:"position.z",type:"number",value:e.z,onChange:m}]},{title:"Rotation",items:[{title:"X",prop:"rotation.x",type:"number",value:r.x,min:-Math.PI,max:Math.PI,step:.01,onChange:m},{title:"Y",prop:"rotation.y",type:"number",value:r.y,min:-Math.PI,max:Math.PI,step:.01,onChange:m},{title:"Z",prop:"rotation.z",type:"number",value:r.z,min:-Math.PI,max:Math.PI,step:.01,onChange:m}]},{title:"Scale",items:[{title:"X",prop:"scale.x",type:"number",value:l.x,step:.01,onChange:m},{title:"Y",prop:"scale.y",type:"number",value:l.y,step:.01,onChange:m},{title:"Z",prop:"scale.z",type:"number",value:l.z,step:.01,onChange:m}]}];return u.jsx(Te,{title:"Transform",items:s})}function _t(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 wn(t,n){const i=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const r=t.lightInfo[e];r!==void 0&&(r.isColor!==void 0?i.push({title:_t(e),prop:e,type:"color",value:r,onChange:(l,m)=>{var h;const s=new d.Color(m);n.updateObject(t.uuid,l,s);const c=(h=n.scene)==null?void 0:h.getObjectByProperty("uuid",t.uuid);c!==void 0&&$(c,l,s)}}):i.push({title:_t(e),prop:e,type:typeof r,value:r,step:typeof r=="number"?.01:void 0,onChange:(l,m)=>{var c;n.updateObject(t.uuid,l,m);const s=(c=n.scene)==null?void 0:c.getObjectByProperty("uuid",t.uuid);s!==void 0&&$(s,l,m)}}))}return u.jsx(Te,{title:"Light",items:i})}function At(t){const[n,i]=I.useState(-1),[e,r]=I.useState({name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]});return I.useEffect(()=>{function l(m){const s=m.value;r(s),i(Date.now())}return L.addEventListener(U.SET_OBJECT,l),()=>{L.removeEventListener(U.SET_OBJECT,l)}},[]),u.jsx("div",{id:"Inspector",className:t.class,children:e.uuid.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(Le,{type:"string",title:"Name",prop:"name",value:e.name,disabled:!0}),u.jsx(Le,{type:"string",title:"Type",prop:"type",value:e.type,disabled:!0}),u.jsx(Le,{type:"string",title:"UUID",prop:"uuid",value:e.uuid,disabled:!0}),u.jsx(Le,{type:"boolean",title:"Visible",prop:"visible",value:e.visible,onChange:(l,m)=>{t.three.updateObject(e.uuid,l,m)}}),En(e,t.three),e.type.search("Camera")>-1?yn(e,t.three):null,e.type.search("Light")>-1?wn(e,t.three):null,e.material!==void 0?bn(e,t.three):null]})},n)}class Cn extends I.Component{constructor(i){super(i);z(this,"three");z(this,"onRefresh",()=>{this.three.getScene()});z(this,"setScene",i=>{this.setState(()=>({scene:i.value}))});this.state={scene:i.scene!==void 0?i.scene:null},this.three=i.three,L.addEventListener(U.SET_SCENE,this.setScene)}componentDidMount(){this.onRefresh()}componentWillUnmount(){L.removeEventListener(U.SET_SCENE,this.setScene)}render(){var r;const i=this.componentState.scene!==null,e="Hierarchy"+(i?`: ${(r=this.componentState.scene)==null?void 0:r.name}`:"");return u.jsx("div",{id:"SceneHierarchy",children:u.jsxs(u.Fragment,{children:[i&&u.jsx(dt,{label:e,button:u.jsx("button",{className:"icon refresh hideText",onClick:this.onRefresh,children:"Refresh"}),open:!0,children:u.jsx(fn,{child:this.componentState.scene,three:this.three})}),u.jsx(dt,{label:"Inspector",children:u.jsx(At,{three:this.three},"Inspector")})]})},"SceneHierarchy")}get componentState(){return this.state}}function Sn(t){const n=s=>{const c=t.scene.getObjectByProperty("uuid",s.value);c!==void 0&&t.three.setObject(c)},i=(s,c,h)=>{const p=t.scene.getObjectByProperty("uuid",s);p!==void 0&&$(p,c,h)},e=s=>{const c=s.value,{key:h,value:p,uuid:g}=c;i(g,h,p)},r=s=>{const c=s.value;ct(c.value).then(h=>{i(c.uuid,c.key,h),i(c.uuid,"material.needsUpdate",!0)})},l=()=>{t.three.setScene(t.scene)},m=s=>{const{key:c,uuid:h,value:p}=s.value,g=t.scene.getObjectByProperty("uuid",h);if(g!==void 0)try{g[c](p)}catch(w){console.log("Error requesting method:"),console.log(w),console.log(c),console.log(p)}};return I.useEffect(()=>(L.addEventListener(U.GET_OBJECT,n),L.addEventListener(U.GET_SCENE,l),L.addEventListener(U.UPDATE_OBJECT,e),L.addEventListener(U.CREATE_TEXTURE,r),L.addEventListener(U.REQUEST_METHOD,m),()=>{L.removeEventListener(U.GET_OBJECT,n),L.removeEventListener(U.GET_SCENE,l),L.removeEventListener(U.UPDATE_OBJECT,e),L.removeEventListener(U.CREATE_TEXTURE,r),L.removeEventListener(U.REQUEST_METHOD,m)}),[]),null}const It={type:"change"},ft={type:"start"},Nt={type:"end"},Ze=new d.Ray,Lt=new d.Plane,xn=Math.cos(70*d.MathUtils.DEG2RAD);class On extends d.EventDispatcher{constructor(n,i){super(),this.object=n,this.domElement=i,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new d.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:d.MOUSE.ROTATE,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.PAN},this.touches={ONE:d.TOUCH.ROTATE,TWO:d.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return s.phi},this.getAzimuthalAngle=function(){return s.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",We),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",We),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(It),e.update(),l=r.NONE},this.update=function(){const o=new d.Vector3,C=new d.Quaternion().setFromUnitVectors(n.up,new d.Vector3(0,1,0)),V=C.clone().invert(),G=new d.Vector3,Q=new d.Quaternion,fe=new d.Vector3,re=2*Math.PI;return function(){const Xe=e.object.position;o.copy(Xe).sub(e.target),o.applyQuaternion(C),s.setFromVector3(o),e.autoRotate&&l===r.NONE&&D(Re()),e.enableDamping?(s.theta+=c.theta*e.dampingFactor,s.phi+=c.phi*e.dampingFactor):(s.theta+=c.theta,s.phi+=c.phi);let Z=e.minAzimuthAngle,te=e.maxAzimuthAngle;isFinite(Z)&&isFinite(te)&&(Z<-Math.PI?Z+=re:Z>Math.PI&&(Z-=re),te<-Math.PI?te+=re:te>Math.PI&&(te-=re),Z<=te?s.theta=Math.max(Z,Math.min(te,s.theta)):s.theta=s.theta>(Z+te)/2?Math.max(Z,s.theta):Math.min(te,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.zoomToCursor&&ne||e.object.isOrthographicCamera?s.radius=je(s.radius):s.radius=je(s.radius*h),o.setFromSpherical(s),o.applyQuaternion(V),Xe.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(c.theta*=1-e.dampingFactor,c.phi*=1-e.dampingFactor,p.multiplyScalar(1-e.dampingFactor)):(c.set(0,0,0),p.set(0,0,0));let he=!1;if(e.zoomToCursor&&ne){let me=null;if(e.object.isPerspectiveCamera){const xe=o.length();me=je(xe*h);const Oe=xe-me;e.object.position.addScaledVector(k,Oe),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const xe=new d.Vector3(K.x,K.y,0);xe.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/h)),e.object.updateProjectionMatrix(),he=!0;const Oe=new d.Vector3(K.x,K.y,0);Oe.unproject(e.object),e.object.position.sub(Oe).add(xe),e.object.updateMatrixWorld(),me=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;me!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(me).add(e.object.position):(Ze.origin.copy(e.object.position),Ze.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(Ze.direction))<xn?n.lookAt(e.target):(Lt.setFromNormalAndCoplanarPoint(e.object.up,e.target),Ze.intersectPlane(Lt,e.target))))}else e.object.isOrthographicCamera&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/h)),e.object.updateProjectionMatrix(),he=!0);return h=1,ne=!1,he||G.distanceToSquared(e.object.position)>m||8*(1-Q.dot(e.object.quaternion))>m||fe.distanceToSquared(e.target)>0?(e.dispatchEvent(It),G.copy(e.object.position),Q.copy(e.object.quaternion),fe.copy(e.target),he=!1,!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",de),e.domElement.removeEventListener("pointerdown",ze),e.domElement.removeEventListener("pointercancel",Ce),e.domElement.removeEventListener("wheel",at),e.domElement.removeEventListener("pointermove",ue),e.domElement.removeEventListener("pointerup",Ce),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",We),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 l=r.NONE;const m=1e-6,s=new d.Spherical,c=new d.Spherical;let h=1;const p=new d.Vector3,g=new d.Vector2,w=new d.Vector2,O=new d.Vector2,R=new d.Vector2,_=new d.Vector2,E=new d.Vector2,b=new d.Vector2,y=new d.Vector2,P=new d.Vector2,k=new d.Vector3,K=new d.Vector2;let ne=!1;const j=[],le={};function Re(){return 2*Math.PI/60/60*e.autoRotateSpeed}function se(){return Math.pow(.95,e.zoomSpeed)}function D(o){c.theta-=o}function F(o){c.phi-=o}const B=function(){const o=new d.Vector3;return function(V,G){o.setFromMatrixColumn(G,0),o.multiplyScalar(-V),p.add(o)}}(),ee=function(){const o=new d.Vector3;return function(V,G){e.screenSpacePanning===!0?o.setFromMatrixColumn(G,1):(o.setFromMatrixColumn(G,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(V),p.add(o)}}(),ae=function(){const o=new d.Vector3;return function(V,G){const Q=e.domElement;if(e.object.isPerspectiveCamera){const fe=e.object.position;o.copy(fe).sub(e.target);let re=o.length();re*=Math.tan(e.object.fov/2*Math.PI/180),B(2*V*re/Q.clientHeight,e.object.matrix),ee(2*G*re/Q.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(B(V*(e.object.right-e.object.left)/e.object.zoom/Q.clientWidth,e.object.matrix),ee(G*(e.object.top-e.object.bottom)/e.object.zoom/Q.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function Pe(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?h/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Ue(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?h*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Fe(o){if(!e.zoomToCursor)return;ne=!0;const C=e.domElement.getBoundingClientRect(),V=o.clientX-C.left,G=o.clientY-C.top,Q=C.width,fe=C.height;K.x=V/Q*2-1,K.y=-(G/fe)*2+1,k.set(K.x,K.y,1).unproject(n).sub(n.position).normalize()}function je(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function Be(o){g.set(o.clientX,o.clientY)}function Qe(o){Fe(o),b.set(o.clientX,o.clientY)}function Ve(o){R.set(o.clientX,o.clientY)}function qe(o){w.set(o.clientX,o.clientY),O.subVectors(w,g).multiplyScalar(e.rotateSpeed);const C=e.domElement;D(2*Math.PI*O.x/C.clientHeight),F(2*Math.PI*O.y/C.clientHeight),g.copy(w),e.update()}function pt(o){y.set(o.clientX,o.clientY),P.subVectors(y,b),P.y>0?Pe(se()):P.y<0&&Ue(se()),b.copy(y),e.update()}function gt(o){_.set(o.clientX,o.clientY),E.subVectors(_,R).multiplyScalar(e.panSpeed),ae(E.x,E.y),R.copy(_),e.update()}function Ge(o){Fe(o),o.deltaY<0?Ue(se()):o.deltaY>0&&Pe(se()),e.update()}function Ye(o){let C=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?F(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(0,e.keyPanSpeed),C=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?F(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(0,-e.keyPanSpeed),C=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?D(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(e.keyPanSpeed,0),C=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?D(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):ae(-e.keyPanSpeed,0),C=!0;break}C&&(o.preventDefault(),e.update())}function ye(){if(j.length===1)g.set(j[0].pageX,j[0].pageY);else{const o=.5*(j[0].pageX+j[1].pageX),C=.5*(j[0].pageY+j[1].pageY);g.set(o,C)}}function Me(){if(j.length===1)R.set(j[0].pageX,j[0].pageY);else{const o=.5*(j[0].pageX+j[1].pageX),C=.5*(j[0].pageY+j[1].pageY);R.set(o,C)}}function Ee(){const o=j[0].pageX-j[1].pageX,C=j[0].pageY-j[1].pageY,V=Math.sqrt(o*o+C*C);b.set(0,V)}function vt(){e.enableZoom&&Ee(),e.enablePan&&Me()}function $e(){e.enableZoom&&Ee(),e.enableRotate&&ye()}function et(o){if(j.length==1)w.set(o.pageX,o.pageY);else{const V=Se(o),G=.5*(o.pageX+V.x),Q=.5*(o.pageY+V.y);w.set(G,Q)}O.subVectors(w,g).multiplyScalar(e.rotateSpeed);const C=e.domElement;D(2*Math.PI*O.x/C.clientHeight),F(2*Math.PI*O.y/C.clientHeight),g.copy(w)}function tt(o){if(j.length===1)_.set(o.pageX,o.pageY);else{const C=Se(o),V=.5*(o.pageX+C.x),G=.5*(o.pageY+C.y);_.set(V,G)}E.subVectors(_,R).multiplyScalar(e.panSpeed),ae(E.x,E.y),R.copy(_)}function we(o){const C=Se(o),V=o.pageX-C.x,G=o.pageY-C.y,Q=Math.sqrt(V*V+G*G);y.set(0,Q),P.set(0,Math.pow(y.y/b.y,e.zoomSpeed)),Pe(P.y),b.copy(y)}function ke(o){e.enableZoom&&we(o),e.enablePan&&tt(o)}function nt(o){e.enableZoom&&we(o),e.enableRotate&&et(o)}function ze(o){e.enabled!==!1&&(j.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",ue),e.domElement.addEventListener("pointerup",Ce)),yt(o),o.pointerType==="touch"?it(o):bt(o))}function ue(o){e.enabled!==!1&&(o.pointerType==="touch"?rt(o):He(o))}function Ce(o){ot(o),j.length===0&&(e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",ue),e.domElement.removeEventListener("pointerup",Ce)),e.dispatchEvent(Nt),l=r.NONE}function bt(o){let C;switch(o.button){case 0:C=e.mouseButtons.LEFT;break;case 1:C=e.mouseButtons.MIDDLE;break;case 2:C=e.mouseButtons.RIGHT;break;default:C=-1}switch(C){case d.MOUSE.DOLLY:if(e.enableZoom===!1)return;Qe(o),l=r.DOLLY;break;case d.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;Ve(o),l=r.PAN}else{if(e.enableRotate===!1)return;Be(o),l=r.ROTATE}break;case d.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;Be(o),l=r.ROTATE}else{if(e.enablePan===!1)return;Ve(o),l=r.PAN}break;default:l=r.NONE}l!==r.NONE&&e.dispatchEvent(ft)}function He(o){switch(l){case r.ROTATE:if(e.enableRotate===!1)return;qe(o);break;case r.DOLLY:if(e.enableZoom===!1)return;pt(o);break;case r.PAN:if(e.enablePan===!1)return;gt(o);break}}function at(o){e.enabled===!1||e.enableZoom===!1||l!==r.NONE||(o.preventDefault(),e.dispatchEvent(ft),Ge(o),e.dispatchEvent(Nt))}function We(o){e.enabled===!1||e.enablePan===!1||Ye(o)}function it(o){switch(Ke(o),j.length){case 1:switch(e.touches.ONE){case d.TOUCH.ROTATE:if(e.enableRotate===!1)return;ye(),l=r.TOUCH_ROTATE;break;case d.TOUCH.PAN:if(e.enablePan===!1)return;Me(),l=r.TOUCH_PAN;break;default:l=r.NONE}break;case 2:switch(e.touches.TWO){case d.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;vt(),l=r.TOUCH_DOLLY_PAN;break;case d.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;$e(),l=r.TOUCH_DOLLY_ROTATE;break;default:l=r.NONE}break;default:l=r.NONE}l!==r.NONE&&e.dispatchEvent(ft)}function rt(o){switch(Ke(o),l){case r.TOUCH_ROTATE:if(e.enableRotate===!1)return;et(o),e.update();break;case r.TOUCH_PAN:if(e.enablePan===!1)return;tt(o),e.update();break;case r.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;ke(o),e.update();break;case r.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;nt(o),e.update();break;default:l=r.NONE}}function de(o){e.enabled!==!1&&o.preventDefault()}function yt(o){j.push(o)}function ot(o){delete le[o.pointerId];for(let C=0;C<j.length;C++)if(j[C].pointerId==o.pointerId){j.splice(C,1);return}}function Ke(o){let C=le[o.pointerId];C===void 0&&(C=new d.Vector2,le[o.pointerId]=C),C.set(o.pageX,o.pageY)}function Se(o){const C=o.pointerId===j[0].pointerId?j[1]:j[0];return le[C.pointerId]}e.domElement.addEventListener("contextmenu",de),e.domElement.addEventListener("pointerdown",ze),e.domElement.addEventListener("pointercancel",Ce),e.domElement.addEventListener("wheel",at,{passive:!1}),this.update()}}const ht=t=>{const[n,i]=I.useState(!1),[e,r]=I.useState(t.options[t.index]),l=()=>{i(!n)},m=s=>{s!==e&&(t.onSelect(s),r(s)),i(!1)};return u.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[u.jsx("div",{className:"dropdown-toggle",onClick:l,children:e}),n&&u.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>u.jsx("li",{onClick:()=>m(s),children:s},s))})]})},ve=I.forwardRef(function(n,i){const e=n.options.indexOf(n.camera.name);return u.jsxs("div",{className:"CameraWindow",children:[u.jsx("div",{ref:i,className:"clickable"}),u.jsx(ht,{index:e,options:n.options,onSelect:n.onSelect,up:!0})]})}),Tn=`out vec3 worldPosition;
31
+ uniform float uDistance;
32
+
33
+ void main() {
34
+ // Scale the plane by the drawing distance
35
+ worldPosition = position.xzy * uDistance;
36
+ worldPosition.xz += cameraPosition.xz;
37
+
38
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(worldPosition, 1.0);
39
+ }`,Rn=`out vec4 fragColor;
40
+ in vec3 worldPosition;
41
+
42
+ uniform float uDivisions;
43
+ uniform float uScale;
44
+ uniform vec3 uColor;
45
+ uniform float uDistance;
46
+ uniform float uSubgridOpacity;
47
+ uniform float uGridOpacity;
48
+
49
+ float getGrid(float gapSize) {
50
+ vec2 worldPositionByDivision = worldPosition.xz / gapSize;
51
+
52
+ // Inverted, 0 where line, >1 where there's no line
53
+ // We use the worldPosition (which in this case we use similarly to UVs) differential to control the anti-aliasing
54
+ // We need to do the -0.5)-0.5 trick because the result fades out from 0 to 1, and we want both
55
+ // worldPositionByDivision == 0.3 and worldPositionByDivision == 0.7 to result in the same fade, i.e. 0.3,
56
+ // otherwise only one side of the line will be anti-aliased
57
+ vec2 grid = abs(fract(worldPositionByDivision-0.5)-0.5) / fwidth(worldPositionByDivision) / 2.0;
58
+ float gridLine = min(grid.x, grid.y);
59
+
60
+ // Uninvert and clamp
61
+ return 1.0 - min(gridLine, 1.0);
62
+ }
63
+
64
+ void main() {
65
+ float cameraDistanceToGridPlane = distance(cameraPosition.y, worldPosition.y);
66
+ float cameraDistanceToFragmentOnGridPlane = distance(cameraPosition.xz, worldPosition.xz);
67
+
68
+ // The size of the grid and subgrid are powers of each other and they are determined based on camera distance.
69
+ // The current grid will become the next subgrid when it becomes too small, and its next power becomes the new grid.
70
+ float subGridPower = pow(uDivisions, floor(log(cameraDistanceToGridPlane) / log(uDivisions)));
71
+ float gridPower = subGridPower * uDivisions;
72
+
73
+ // If we want to fade both the grid and its subgrid, we need to displays 3 different opacities, with the next grid being the third
74
+ float nextGridPower = gridPower * uDivisions;
75
+
76
+ // 1 where grid, 0 where no grid
77
+ float subgrid = getGrid(subGridPower * uScale);
78
+ float grid = getGrid(gridPower * uScale);
79
+ float nextGrid = getGrid(nextGridPower * uScale);
80
+
81
+ // Where we are between the introduction of the current grid power and when we switch to the next grid power
82
+ float stepPercentage = (cameraDistanceToGridPlane - subGridPower)/(gridPower - subGridPower);
83
+
84
+ // The last x percentage of the current step over which we want to fade
85
+ float fadeRange = 0.3;
86
+
87
+ // We calculate the fade percentage from the step percentage and the fade range
88
+ float fadePercentage = max(stepPercentage - 1.0 + fadeRange, 0.0) / fadeRange;
89
+
90
+ // Set base opacity based on how close we are to the drawing distance, with a cubic falloff
91
+ float baseOpacity = subgrid * pow(1.0 - min(cameraDistanceToFragmentOnGridPlane / uDistance, 1.0), 3.0);
92
+
93
+ // Shade the subgrid
94
+ fragColor = vec4(uColor.rgb, (baseOpacity - fadePercentage) * uSubgridOpacity);
95
+
96
+ // Somewhat arbitrary additional fade coefficient to counter anti-aliasing popping when switching between grid powers
97
+ float fadeCoefficient = 0.5;
98
+
99
+ // Shade the grid
100
+ fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity - fadePercentage * (uGridOpacity - uSubgridOpacity) * fadeCoefficient, grid);
101
+
102
+ // Shade the next grid
103
+ fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
104
+
105
+ if (fragColor.a <= 0.0) discard;
106
+ }`;class Pn extends d.ShaderMaterial{constructor(n){super({extensions:{derivatives:!0},glslVersion:d.GLSL3,side:d.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 d.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:Tn,fragmentShader:Rn,name:"InfiniteGrid",depthWrite:!1})}}class Ut extends d.Mesh{constructor(){const i=new Pn;super(new d.PlaneGeometry(2,2),i);z(this,"gridMaterial");this.gridMaterial=i,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const Hn="",Ft=["Single","Side by Side","Stacked","Quad"],J=new Map,X=new Map,oe=new Map;function be(t,n){const i=new d.OrthographicCamera(-100,100,100,-100,50,3e3);return i.name=t,i.position.copy(n),i.lookAt(0,0,0),J.set(t,i),i}be("Top",new d.Vector3(0,1e3,0)),be("Bottom",new d.Vector3(0,-1e3,0)),be("Left",new d.Vector3(-1e3,0,0)),be("Right",new d.Vector3(1e3,0,0)),be("Front",new d.Vector3(0,0,1e3)),be("Back",new d.Vector3(0,0,-1e3)),be("Orthographic",new d.Vector3(1e3,1e3,1e3));const Je=new d.PerspectiveCamera(60,1,50,3e3);Je.name="Debug",Je.position.set(500,500,500),Je.lookAt(0,0,0),J.set("Debug",Je);let mt="Default";const jn=["Default","Normals","Wireframe"],Mn=new d.MeshNormalMaterial,kn=new d.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),H=new d.Scene;function Dn(t){const[n,i]=I.useState(t.mode!==void 0?t.mode:"Quad"),e=I.useRef(null),r=I.useRef(null),l=I.useRef(null),m=I.useRef(null);let s=J.get("Debug"),c=J.get("Orthographic"),h=J.get("Front"),p=J.get("Top");const g=(E,b)=>{const y=X.get(E.name);y!==void 0&&y.dispose(),X.delete(E.name);const P=oe.get(E.name);P!==void 0&&(H.remove(P),P.dispose()),oe.delete(E.name);const k=new On(E,b);switch(E.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":k.enableRotate=!1;break}if(X.set(E.name,k),E instanceof d.PerspectiveCamera){const K=new d.CameraHelper(E);oe.set(E.name,K),H.add(K)}},w=E=>{const b=oe.get(E.name);b!==void 0&&(H.remove(b),b.dispose(),oe.delete(E.name));const y=X.get(E.name);y!==void 0&&(y.dispose(),X.delete(E.name))},O=()=>{X.forEach((E,b)=>{E.dispose();const y=oe.get(b);y!==void 0&&(H.remove(y),y.dispose()),oe.delete(b),X.delete(b)}),X.clear(),oe.clear()},R=()=>{switch(n){case"Single":g(s,e.current);break;case"Side by Side":case"Stacked":g(s,e.current),g(c,r.current);break;case"Quad":g(s,e.current),g(c,r.current),g(h,l.current),g(p,m.current);break}};I.useEffect(()=>{H.name="Debug Scene",H.add(t.scene);const E=new Ut;H.add(E);const b=new d.AxesHelper(500);b.name="axisHelper",H.add(b)},[]),I.useEffect(()=>{const E=t.renderer.getSize(new d.Vector2);let b=E.x,y=E.y,P=Math.floor(b/2),k=Math.floor(y/2),K=-1;const ne=()=>{b=window.innerWidth-300,y=window.innerHeight,P=Math.floor(b/2),k=Math.floor(y/2);let D=b,F=y;switch(n){case"Side by Side":D=P,F=y;break;case"Stacked":D=b,F=k;break;case"Quad":D=P,F=k;break}J.forEach(B=>{var ee;B instanceof d.OrthographicCamera?(B.left=D/-2,B.right=D/2,B.top=F/2,B.bottom=F/-2,B.updateProjectionMatrix()):B instanceof d.PerspectiveCamera&&(B.aspect=D/F,B.updateProjectionMatrix(),(ee=oe.get(B.name))==null||ee.update())})},j=()=>{t.renderer.setViewport(0,0,b,y),t.renderer.setScissor(0,0,b,y),t.renderer.render(H,s)},le=()=>{if(n==="Side by Side")t.renderer.setViewport(0,0,P,y),t.renderer.setScissor(0,0,P,y),t.renderer.render(H,s),t.renderer.setViewport(P,0,P,y),t.renderer.setScissor(P,0,P,y),t.renderer.render(H,c);else{const D=y-k;t.renderer.setViewport(0,D,b,k),t.renderer.setScissor(0,D,b,k),t.renderer.render(H,s),t.renderer.setViewport(0,0,b,k),t.renderer.setScissor(0,0,b,k),t.renderer.render(H,c)}},Re=()=>{let D=0,F=0;F=y-k,D=0,t.renderer.setViewport(D,F,P,k),t.renderer.setScissor(D,F,P,k),t.renderer.render(H,s),D=P,t.renderer.setViewport(D,F,P,k),t.renderer.setScissor(D,F,P,k),t.renderer.render(H,c),F=0,D=0,t.renderer.setViewport(D,F,P,k),t.renderer.setScissor(D,F,P,k),t.renderer.render(H,h),D=P,t.renderer.setViewport(D,F,P,k),t.renderer.setScissor(D,F,P,k),t.renderer.render(H,p)},se=()=>{switch(X.forEach(D=>{D.update()}),t.scene.update(),t.renderer.clear(),n){case"Single":j();break;case"Side by Side":case"Stacked":le();break;case"Quad":Re();break}K=requestAnimationFrame(se)};return R(),window.addEventListener("resize",ne),ne(),se(),()=>{window.removeEventListener("resize",ne),cancelAnimationFrame(K),K=-1}},[n]);const _=["Top","Bottom","Left","Right","Front","Back","Orthographic","Debug"];return t.cameras.forEach(E=>{J.set(E.name,E),_.push(E.name)}),u.jsxs("div",{className:"multiview",children:[u.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,children:[n==="Single"&&u.jsx(u.Fragment,{children:u.jsx(ve,{camera:s,options:_,ref:e,onSelect:E=>{var y;(y=X.get(s.name))==null||y.dispose();const b=J.get(E);b!==void 0&&(w(s),s=b,g(b,e.current))}})}),(n==="Side by Side"||n==="Stacked")&&u.jsxs(u.Fragment,{children:[u.jsx(ve,{camera:s,options:_,ref:e,onSelect:E=>{var y;(y=X.get(s.name))==null||y.dispose();const b=J.get(E);b!==void 0&&(w(s),s=b,g(b,e.current))}}),u.jsx(ve,{camera:c,options:_,ref:r,onSelect:E=>{var y;(y=X.get(c.name))==null||y.dispose();const b=J.get(E);b!==void 0&&(w(c),c=b,g(b,r.current))}})]}),n==="Quad"&&u.jsxs(u.Fragment,{children:[u.jsx(ve,{camera:s,options:_,ref:e,onSelect:E=>{var y;(y=X.get(s.name))==null||y.dispose();const b=J.get(E);b!==void 0&&(w(s),s=b,g(b,e.current))}}),u.jsx(ve,{camera:c,options:_,ref:r,onSelect:E=>{var y;(y=X.get(c.name))==null||y.dispose();const b=J.get(E);b!==void 0&&(w(c),c=b,g(b,r.current))}}),u.jsx(ve,{camera:h,options:_,ref:l,onSelect:E=>{var y;(y=X.get(h.name))==null||y.dispose();const b=J.get(E);b!==void 0&&(w(h),h=b,g(b,l.current))}}),u.jsx(ve,{camera:p,options:_,ref:m,onSelect:E=>{var y;(y=X.get(p.name))==null||y.dispose();const b=J.get(E);b!==void 0&&(w(p),p=b,g(b,m.current))}})]})]}),u.jsxs("div",{className:"settings",children:[u.jsx(ht,{index:Ft.indexOf(n),options:Ft,onSelect:E=>{E!==n&&(O(),i(E))}}),u.jsx(ht,{index:0,options:jn,onSelect:E=>{if(E!==mt)switch(mt=E,mt){case"Default":H.overrideMaterial=null;break;case"Normals":H.overrideMaterial=Mn;break;case"Wireframe":H.overrideMaterial=kn;break}}})]})]})}const Wn="";function _n(t){return u.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[u.jsx("header",{children:t.header}),t.children,u.jsx("footer",{children:t.footer})]})}x.Application=Xt,x.BaseRemote=Ae,x.Draggable=Rt,x.DraggableItem=Tt,x.Dropdown=Pt,x.DropdownItem=jt,x.Editor=_n,x.InfiniteGridHelper=Ut,x.Inspector=At,x.MultiView=Dn,x.NavButton=ut,x.RemoteComponents=Zt,x.RemoteController=dn,x.RemoteTheatre=$t,x.RemoteThree=rn,x.RemoteTweakpane=on,x.SceneHierarchy=Cn,x.SceneInspector=Sn,x.ToolEvents=U,x.debugDispatcher=L,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
Binary file