@tomorrowevening/hermes 0.0.26 → 0.0.27
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.
- package/dist/hermes.js +951 -865
- package/dist/hermes.umd.cjs +14 -14
- package/package.json +1 -1
- package/src/editor/sidePanel/inspector/utils/InspectMaterial.tsx +97 -5
package/dist/hermes.umd.cjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(w,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("three"),require("@theatre/core"),require("@theatre/studio"),require("tweakpane"),require("@tweakpane/plugin-essentials"),require("react"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","three","@theatre/core","@theatre/studio","tweakpane","@tweakpane/plugin-essentials","react","framer-motion"],d):(w=typeof globalThis<"u"?globalThis:w||self,d(w.Hermes={},w.Three,w["Theatre Core"],w["Theatre Studio"],w.tweakpane,w["tweakpane-plugin-essentials"],w.React,w["framer-motion"]))})(this,function(w,d,Ce,Ze,On,xn,R,Ht){"use strict";var Ra=Object.defineProperty;var Pa=(w,d,Ce)=>d in w?Ra(w,d,{enumerable:!0,configurable:!0,writable:!0,value:Ce}):w[d]=Ce;var F=(w,d,Ce)=>(Pa(w,typeof d!="symbol"?d+"":d,Ce),Ce);function Tn(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const e=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,e.get?e:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const Mn=Tn(xn);function Rn(t,n,a){return Math.min(n,Math.max(t,a))}function Pn(t,n){const a=t-n;return Math.sqrt(a*a)}function Gt(){return Math.round(Math.random()*1e6).toString()}function zt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function Yt(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),r=u=>{const m=u.toString(16);return m.length===1?"0"+m:m},s=r(n),f=r(a),l=r(e);return"#"+s+f+l}function lt(t,n=1){return Number(t.toFixed(n))}w.totalThreeObjects=0;const Wt=()=>{w.totalThreeObjects=0},Mt=t=>{if(!t)return;let n=t.name.replace(" ","");n.length===0&&(n=`obj_${w.totalThreeObjects}`,w.totalThreeObjects++),t.parent!==null&&(n=`${t.parent.uuid}.${n}`),t.uuid=n,t.children.forEach(a=>{Mt(a)})},jn=t=>{t==null||t.dispose()},Kt=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},Rt=t=>{var n;if(t){for(;t.children.length>0;){const a=t.children[0];a instanceof d.PositionalAudio?(a.pause(),a.parent&&a.parent.remove(a)):Rt(a)}if(t.parent&&t.parent.remove(t),t.isMesh){const a=t;(n=a.geometry)==null||n.dispose(),Kt(a.material)}t.dispose!==void 0&&t.dispose()}};class _n{constructor(n,a,e=!0,r="editor"){F(this,"components",new Map);F(this,"listen");F(this,"_debugEnabled");F(this,"broadcastChannel");F(this,"webSocket");F(this,"_mode","app");F(this,"_connected",!1);F(this,"useBC",!1);F(this,"messageHandler",n=>{this.listen!==void 0&&(this.useBC?this.listen(n.data):this.listen(JSON.parse(n.data)))});F(this,"openHandler",()=>{this._connected=!0});F(this,"closeHandler",()=>{this._connected=!1});this.editor=a&&document.location.hash.search(r)>-1,this._debugEnabled=a,a&&(this.useBC=e,e?(this.broadcastChannel=new BroadcastChannel(n),this.broadcastChannel.addEventListener("message",this.messageHandler)):(this.webSocket=new WebSocket(n),this.webSocket.addEventListener("open",this.openHandler),this.webSocket.addEventListener("close",this.closeHandler),this.webSocket.addEventListener("message",this.messageHandler)))}addComponent(n,a){this.components.set(n,a)}dispose(){this.broadcastChannel!==void 0&&this.broadcastChannel.removeEventListener("message",this.messageHandler),this.webSocket!==void 0&&(this.webSocket.removeEventListener("open",this.openHandler),this.webSocket.removeEventListener("close",this.closeHandler),this.webSocket.removeEventListener("message",this.messageHandler)),this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){var a,e;this._mode!==n.target&&(this.useBC?(a=this.broadcastChannel)==null||a.postMessage(n):this._connected&&((e=this.webSocket)==null||e.send(JSON.stringify(n))))}get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor",document.title+=" - Editor")}}const D=new d.EventDispatcher,A={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",SET_SCENE:"ToolEvents::setScene",GET_OBJECT:"ToolEvents::getObject",SET_OBJECT:"ToolEvents::setObject",UPDATE_OBJECT:"ToolEvents::updateObject",CREATE_TEXTURE:"ToolEvents::createTexture",REQUEST_METHOD:"ToolEvents::requestMethod",ADD_CAMERA:"ToolEvents::addCamera",REMOVE_CAMERA:"ToolEvents::removeCamera"};class Je{constructor(n){F(this,"app");this.app=n}dispose(){}}class Xt extends Je{selectDropdown(n,a){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:a}})}updateDropdown(n,a){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:a}})}}function kn(t,n){switch(n.event){case"selectComponent":D.dispatchEvent({type:A.SELECT_DROPDOWN,value:n.data});break;case"draggableListUpdate":D.dispatchEvent({type:A.DRAG_UPDATE,value:n.data});break}}const Zt=()=>{},Ge=class Ge extends Je{constructor(){super(...arguments);F(this,"project");F(this,"sheets",new Map);F(this,"sheetObjects",new Map);F(this,"sheetObjectCBs",new Map);F(this,"sheetObjectUnsubscribe",new Map)}init(a,e){return this.project=Ce.getProject(a,e),this.project.ready}dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}sheet(a){var r;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let e=this.sheets.get(a);return e!==void 0||(e=(r=this.project)==null?void 0:r.sheet(a),this.sheets.set(a,e)),e}playSheet(a,e){var r;(r=this.sheet(a))==null||r.sequence.play(e),this.app.send({event:"playSheet",target:"editor",data:{sheet:a,value:e}})}pauseSheet(a){var e;(e=this.sheet(a))==null||e.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:a}})}clearSheetObjects(a){this.sheetObjects.forEach((e,r)=>{r.search(`${a}_`)>-1&&this.unsubscribe(e)})}sheetObject(a,e,r,s){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const f=this.sheet(a);if(f===void 0)return;const l=`${a}_${e}`;let u=this.sheetObjects.get(l);u!==void 0?u=f.object(e,{...r,...u.value},{reconfigure:!0}):u=f.object(e,r),this.sheetObjects.set(l,u),this.sheetObjectCBs.set(l,s!==void 0?s:Zt);const m=u.onValuesChange(b=>{if(this.app.editor){for(const O in b){const x=b[O];typeof x=="object"&&zt(x)&&(b[O]={r:x.r,g:x.g,b:x.b,a:x.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:a,sheetObject:l,values:b}})}const S=this.sheetObjectCBs.get(l);S!==void 0&&S(b)});return this.sheetObjectUnsubscribe.set(l,m),u}unsubscribe(a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const e=a.address.sheetId,r=a.address.objectKey,s=this.sheets.get(e);s==null||s.detachObject(r);const f=`${e}_${r}`,l=this.sheetObjectUnsubscribe.get(f);l!==void 0&&(this.sheetObjects.delete(f),this.sheetObjectCBs.delete(f),this.sheetObjectUnsubscribe.delete(f),l())}static getRafDriver(){return Ge.rafDriver||(Ge.rafDriver=Ce.createRafDriver()),Ge.rafDriver}};F(Ge,"rafDriver",null);let Oe=Ge,xe;function Dn(t,n){t.components.forEach(a=>{if(a instanceof Oe){let e;const r=a;switch(n.event){case"setSheet":e=r.sheets.get(n.data.sheet),e!==void 0&&(xe=e,Ze.setSelection([e]));break;case"setSheetObject":e=r.sheetObjects.get(`${n.data.sheet}_${n.data.key}`),e!==void 0&&Ze.setSelection([e]);break;case"updateSheetObject":e=r.sheets.get(n.data.sheet),e!==void 0&&e.sequence.pause(),e=r.sheetObjectCBs.get(n.data.sheetObject),e!==void 0&&e(n.data.values);break;case"updateTimeline":e=r.sheets.get(n.data.sheet),xe!==void 0&&(xe.sequence.position=n.data.position);break}}})}function An(t){if(t.editor){let n;t.components.forEach(s=>{s instanceof Oe&&(n=s)}),Ze.ui.restore(),Ze.onSelectionChange(s=>{s.length<1||s.forEach(f=>{let l=f.address.sheetId,u="setSheet",m={};switch(f.type){case"Theatre_Sheet_PublicAPI":u="setSheet",m={sheet:f.address.sheetId},xe=n.sheets.get(f.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":u="setSheetObject",l+=`_${f.address.objectKey}`,m={id:l,sheet:f.address.sheetId,key:f.address.objectKey};break}t.send({event:u,target:"app",data:m})})});let a=0;const e=()=>{if(Oe.getRafDriver().tick(performance.now()),xe!==void 0&&a!==xe.sequence.position){a=xe.sequence.position;const s=xe;t.send({event:"updateTimeline",target:"app",data:{position:a,sheet:s.address.sheetId}})}},r=()=>{e(),requestAnimationFrame(r)};e(),r()}else Ze.ui.hide()}function In(t,n){t.editor&&t.components.forEach(a=>{var e,r;if(a instanceof Oe){const s=a;switch(n.event){case"playSheet":(e=s.sheet(n.data.sheet))==null||e.sequence.play(n.data.value);break;case"pauseSheet":(r=s.sheet(n.data.sheet))==null||r.sequence.pause();break}return}})}function Ln(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 Jt(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(Jt(a))}),n}function Nn(t){const n={};for(const a in t){const e=t[a].value;n[a]={value:e},e===null?n[a].value={src:""}:e.isTexture&&(n[a].value={src:e.image.src})}return n}function Un(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Be(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||Un(a))continue;const e=typeof t[a],r=t[a];switch(e){case"boolean":case"number":case"string":n[a]=r;break;case"object":if(r!==null)if(n[a]=r,r.isTexture)if(r instanceof d.Texture){const s=r.source.toJSON();n[a]={src:s.url}}else r instanceof d.CubeTexture&&(console.log("env map"),console.log(r.source.data),console.log(r.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Nn(n[a]));else n[a]={src:""};break}}return n}function Pt(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};t.animations.forEach(e=>{n.animations.push({name:e.name,duration:e.duration,blendMode:e.blendMode})});const a=t.type.toLowerCase();if(a.search("mesh")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Be(s))}),n.material=r}else n.material=Be(e.material)}else if(a.search("points")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Be(s))}),n.material=r}else n.material=Be(e.material)}else if(a.search("line")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Be(s))}),n.material=r}else n.material=Be(e.material)}else a.search("camera")>-1?t.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:t.fov,zoom:t.zoom,near:t.near,far:t.far,focus:t.focus,aspect:t.aspect,filmGauge:t.filmGauge,filmOffset:t.filmOffset}:t.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):a.search("light")>-1&&(n.lightInfo={color:t.color,intensity:t.intensity,decay:t.decay,distance:t.distance,angle:t.angle,penumbra:t.penumbra,groundColor:t.groundColor});return n}function te(t,n,a){const e=n.split(".");switch(e.length){case 1:t[e[0]]=a;break;case 2:t[e[0]][e[1]]=a;break;case 3:t[e[0]][e[1]][e[2]]=a;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=a;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=a;break}}function jt(t){return new Promise((n,a)=>{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=a,e.src=t})}class Qt extends Je{constructor(){super(...arguments);F(this,"scene")}getObject(a){this.app.debugEnabled&&(console.log("get:",a),this.app.send({event:"getObject",target:"app",data:a}))}setObject(a){console.log("set:",a);const e=Pt(a);this.app.send({event:"setObject",target:"editor",data:e})}requestMethod(a,e,r){this.app.send({event:"requestMethod",target:"app",data:{uuid:a,key:e,value:r}})}updateObject(a,e,r){this.app.send({event:"updateObject",target:"app",data:{uuid:a,key:e,value:r}})}createTexture(a,e,r){this.app.send({event:"createTexture",target:"app",data:{uuid:a,key:e,value:r}})}setScene(a){if(a===void 0||(this.scene=a,!this.app.debugEnabled))return;Wt(),Mt(this.scene);const e=Jt(this.scene);this.app.send({event:"setScene",target:"editor",data:e})}addCamera(a){if(!this.app.debugEnabled)return;const e=Pt(a);this.app.send({event:"addCamera",target:"editor",data:e})}removeCamera(a){if(!this.app.debugEnabled)return;const e=Pt(a);this.app.send({event:"removeCamera",target:"editor",data:e})}}function Fn(t,n){switch(n.event){case"getObject":D.dispatchEvent({type:A.GET_OBJECT,value:n.data});break;case"updateObject":D.dispatchEvent({type:A.UPDATE_OBJECT,value:n.data});break;case"createTexture":D.dispatchEvent({type:A.CREATE_TEXTURE,value:n.data});break;case"requestMethod":D.dispatchEvent({type:A.REQUEST_METHOD,value:n.data});break}}function Vn(t,n){switch(n.event){case"setObject":D.dispatchEvent({type:A.SET_OBJECT,value:n.data});break;case"setScene":D.dispatchEvent({type:A.SET_SCENE,value:n.data});break;case"addCamera":D.dispatchEvent({type:A.ADD_CAMERA,value:n.data});break;case"removeCamera":D.dispatchEvent({type:A.REMOVE_CAMERA,value:n.data});break}}class _t extends Je{constructor(a){super(a);F(this,"bindCBs");F(this,"buttonCBs");F(this,"pane");F(this,"appCallbacks",0);F(this,"editorCallbacks",0);F(this,"inspectorFolder");this.bindCBs=new Map,this.buttonCBs=new Map,a.editor&&this.createGUI()}createGUI(){this.pane=new On.Pane({title:"GUI"}),this.pane.registerPlugin(Mn)}dispose(){var a;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((a=this.pane)==null||a.dispose(),this.pane=void 0)}addFolder(a,e=void 0,r=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addFolder({title:a,...e});this.app.send({event:"addFolder",target:"app",data:{name:a,params:e,parent:r}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(a,e,r,s=void 0){const f=this.bindID,l=r.onChange!==void 0?r.onChange:Zt;this.bindCBs.set(f,l),this.app.editor?(this.pane===void 0&&this.createGUI(),(s!==void 0?s:this.pane).addBinding(a,e,r).on("change",m=>{this.app.send({event:"updateBind",target:"app",data:{id:f,value:m.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:f,name:e,params:r,parent:s}}),this.appCallbacks++)}triggerBind(a,e){const r=this.bindCBs.get(a);r!==void 0?r(e):console.warn(`No callback for: ${a}`,e)}button(a,e,r=void 0){const s=this.bindID;this.buttonCBs.set(s,e),this.app.editor?(this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addButton({title:a}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:s}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:s,name:a,callback:e,parent:r}}),this.appCallbacks++)}triggerButton(a){const e=this.buttonCBs.get(a);e!==void 0&&e()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const a=this.inspectorFolder.children.length-1;for(let e=a;e>-1;--e)this.inspectorFolder.remove(this.inspectorFolder.children[e])}}function Bn(t,n){t.components.forEach(a=>{if(a instanceof _t){const e=a;switch(n.event){case"addFolder":e.addFolder(n.data.name,n.data.params,n.data.parent);break;case"bindObject":e.bind(n.data.name,n.data.params,n.data.parent);break;case"updateBind":e.triggerBind(n.data.id,n.data.value);break;case"addButton":e.button(n.data.name,n.data.callback,n.data.parent);break;case"clickButton":e.triggerButton(n.data.id);break}return}})}var kt={exports:{}},Qe={};/**
|
1
|
+
(function(S,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("three"),require("@theatre/core"),require("@theatre/studio"),require("tweakpane"),require("@tweakpane/plugin-essentials"),require("react"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","three","@theatre/core","@theatre/studio","tweakpane","@tweakpane/plugin-essentials","react","framer-motion"],d):(S=typeof globalThis<"u"?globalThis:S||self,d(S.Hermes={},S.Three,S["Theatre Core"],S["Theatre Studio"],S.tweakpane,S["tweakpane-plugin-essentials"],S.React,S["framer-motion"]))})(this,function(S,d,Ce,Ze,xn,On,j,Ht){"use strict";var Ra=Object.defineProperty;var Pa=(S,d,Ce)=>d in S?Ra(S,d,{enumerable:!0,configurable:!0,writable:!0,value:Ce}):S[d]=Ce;var V=(S,d,Ce)=>(Pa(S,typeof d!="symbol"?d+"":d,Ce),Ce);function Tn(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const e=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,e.get?e:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const Mn=Tn(On);function Rn(t,n,a){return Math.min(n,Math.max(t,a))}function Pn(t,n){const a=t-n;return Math.sqrt(a*a)}function zt(){return Math.round(Math.random()*1e6).toString()}function Gt(t){return t.r!==void 0&&t.g!==void 0&&t.b!==void 0}function Yt(t){const n=Math.round(t.r*255),a=Math.round(t.g*255),e=Math.round(t.b*255),r=u=>{const m=u.toString(16);return m.length===1?"0"+m:m},s=r(n),f=r(a),c=r(e);return"#"+s+f+c}function lt(t,n=1){return Number(t.toFixed(n))}S.totalThreeObjects=0;const Wt=()=>{S.totalThreeObjects=0},Mt=t=>{if(!t)return;let n=t.name.replace(" ","");n.length===0&&(n=`obj_${S.totalThreeObjects}`,S.totalThreeObjects++),t.parent!==null&&(n=`${t.parent.uuid}.${n}`),t.uuid=n,t.children.forEach(a=>{Mt(a)})},jn=t=>{t==null||t.dispose()},Kt=t=>{t&&(Array.isArray(t)?t.forEach(n=>n.dispose()):t.dispose())},Rt=t=>{var n;if(t){for(;t.children.length>0;){const a=t.children[0];a instanceof d.PositionalAudio?(a.pause(),a.parent&&a.parent.remove(a)):Rt(a)}if(t.parent&&t.parent.remove(t),t.isMesh){const a=t;(n=a.geometry)==null||n.dispose(),Kt(a.material)}t.dispose!==void 0&&t.dispose()}};class _n{constructor(n,a,e=!0,r="editor"){V(this,"components",new Map);V(this,"listen");V(this,"_debugEnabled");V(this,"broadcastChannel");V(this,"webSocket");V(this,"_mode","app");V(this,"_connected",!1);V(this,"useBC",!1);V(this,"messageHandler",n=>{this.listen!==void 0&&(this.useBC?this.listen(n.data):this.listen(JSON.parse(n.data)))});V(this,"openHandler",()=>{this._connected=!0});V(this,"closeHandler",()=>{this._connected=!1});this.editor=a&&document.location.hash.search(r)>-1,this._debugEnabled=a,a&&(this.useBC=e,e?(this.broadcastChannel=new BroadcastChannel(n),this.broadcastChannel.addEventListener("message",this.messageHandler)):(this.webSocket=new WebSocket(n),this.webSocket.addEventListener("open",this.openHandler),this.webSocket.addEventListener("close",this.closeHandler),this.webSocket.addEventListener("message",this.messageHandler)))}addComponent(n,a){this.components.set(n,a)}dispose(){this.broadcastChannel!==void 0&&this.broadcastChannel.removeEventListener("message",this.messageHandler),this.webSocket!==void 0&&(this.webSocket.removeEventListener("open",this.openHandler),this.webSocket.removeEventListener("close",this.closeHandler),this.webSocket.removeEventListener("message",this.messageHandler)),this.components.forEach(n=>{n.dispose()}),this.components.clear()}send(n){var a,e;this._mode!==n.target&&(this.useBC?(a=this.broadcastChannel)==null||a.postMessage(n):this._connected&&((e=this.webSocket)==null||e.send(JSON.stringify(n))))}get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(n){n&&(this._mode="editor",document.title+=" - Editor")}}const A=new d.EventDispatcher,I={CUSTOM:"ToolEvents::custom",SELECT_DROPDOWN:"ToolEvents::selectDropdown",DRAG_UPDATE:"ToolEvents::dragUpdate",SET_SCENE:"ToolEvents::setScene",GET_OBJECT:"ToolEvents::getObject",SET_OBJECT:"ToolEvents::setObject",UPDATE_OBJECT:"ToolEvents::updateObject",CREATE_TEXTURE:"ToolEvents::createTexture",REQUEST_METHOD:"ToolEvents::requestMethod",ADD_CAMERA:"ToolEvents::addCamera",REMOVE_CAMERA:"ToolEvents::removeCamera"};class Je{constructor(n){V(this,"app");this.app=n}dispose(){}}class Xt extends Je{selectDropdown(n,a){this.app.send({event:"selectComponent",target:"app",data:{dropdown:n,value:a}})}updateDropdown(n,a){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:n,value:a}})}}function kn(t,n){switch(n.event){case"selectComponent":A.dispatchEvent({type:I.SELECT_DROPDOWN,value:n.data});break;case"draggableListUpdate":A.dispatchEvent({type:I.DRAG_UPDATE,value:n.data});break}}const Zt=()=>{},ze=class ze extends Je{constructor(){super(...arguments);V(this,"project");V(this,"sheets",new Map);V(this,"sheetObjects",new Map);V(this,"sheetObjectCBs",new Map);V(this,"sheetObjectUnsubscribe",new Map)}init(a,e){return this.project=Ce.getProject(a,e),this.project.ready}dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}sheet(a){var r;if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}let e=this.sheets.get(a);return e!==void 0||(e=(r=this.project)==null?void 0:r.sheet(a),this.sheets.set(a,e)),e}playSheet(a,e){var r;(r=this.sheet(a))==null||r.sequence.play(e),this.app.send({event:"playSheet",target:"editor",data:{sheet:a,value:e}})}pauseSheet(a){var e;(e=this.sheet(a))==null||e.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:a}})}clearSheetObjects(a){this.sheetObjects.forEach((e,r)=>{r.search(`${a}_`)>-1&&this.unsubscribe(e)})}sheetObject(a,e,r,s){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const f=this.sheet(a);if(f===void 0)return;const c=`${a}_${e}`;let u=this.sheetObjects.get(c);u!==void 0?u=f.object(e,{...r,...u.value},{reconfigure:!0}):u=f.object(e,r),this.sheetObjects.set(c,u),this.sheetObjectCBs.set(c,s!==void 0?s:Zt);const m=u.onValuesChange(y=>{if(this.app.editor){for(const C in y){const x=y[C];typeof x=="object"&&Gt(x)&&(y[C]={r:x.r,g:x.g,b:x.b,a:x.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:a,sheetObject:c,values:y}})}const g=this.sheetObjectCBs.get(c);g!==void 0&&g(y)});return this.sheetObjectUnsubscribe.set(c,m),u}unsubscribe(a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const e=a.address.sheetId,r=a.address.objectKey,s=this.sheets.get(e);s==null||s.detachObject(r);const f=`${e}_${r}`,c=this.sheetObjectUnsubscribe.get(f);c!==void 0&&(this.sheetObjects.delete(f),this.sheetObjectCBs.delete(f),this.sheetObjectUnsubscribe.delete(f),c())}static getRafDriver(){return ze.rafDriver||(ze.rafDriver=Ce.createRafDriver()),ze.rafDriver}};V(ze,"rafDriver",null);let xe=ze,Oe;function Dn(t,n){t.components.forEach(a=>{if(a instanceof xe){let e;const r=a;switch(n.event){case"setSheet":e=r.sheets.get(n.data.sheet),e!==void 0&&(Oe=e,Ze.setSelection([e]));break;case"setSheetObject":e=r.sheetObjects.get(`${n.data.sheet}_${n.data.key}`),e!==void 0&&Ze.setSelection([e]);break;case"updateSheetObject":e=r.sheets.get(n.data.sheet),e!==void 0&&e.sequence.pause(),e=r.sheetObjectCBs.get(n.data.sheetObject),e!==void 0&&e(n.data.values);break;case"updateTimeline":e=r.sheets.get(n.data.sheet),Oe!==void 0&&(Oe.sequence.position=n.data.position);break}}})}function An(t){if(t.editor){let n;t.components.forEach(s=>{s instanceof xe&&(n=s)}),Ze.ui.restore(),Ze.onSelectionChange(s=>{s.length<1||s.forEach(f=>{let c=f.address.sheetId,u="setSheet",m={};switch(f.type){case"Theatre_Sheet_PublicAPI":u="setSheet",m={sheet:f.address.sheetId},Oe=n.sheets.get(f.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":u="setSheetObject",c+=`_${f.address.objectKey}`,m={id:c,sheet:f.address.sheetId,key:f.address.objectKey};break}t.send({event:u,target:"app",data:m})})});let a=0;const e=()=>{if(xe.getRafDriver().tick(performance.now()),Oe!==void 0&&a!==Oe.sequence.position){a=Oe.sequence.position;const s=Oe;t.send({event:"updateTimeline",target:"app",data:{position:a,sheet:s.address.sheetId}})}},r=()=>{e(),requestAnimationFrame(r)};e(),r()}else Ze.ui.hide()}function In(t,n){t.editor&&t.components.forEach(a=>{var e,r;if(a instanceof xe){const s=a;switch(n.event){case"playSheet":(e=s.sheet(n.data.sheet))==null||e.sequence.play(n.data.value);break;case"pauseSheet":(r=s.sheet(n.data.sheet))==null||r.sequence.pause();break}return}})}function Ln(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 Jt(t){const n={name:t.name,type:t.type,uuid:t.uuid,children:[]};return t.children.forEach(a=>{n.children.push(Jt(a))}),n}function Nn(t){const n={};for(const a in t){const e=t[a].value;n[a]={value:e},e===null?n[a].value={src:""}:e.isTexture&&(n[a].value={src:e.image.src})}return n}function Un(t){switch(t){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function Ve(t){const n={};for(const a in t){if(a.substring(0,1)==="_"||a.substring(0,2)==="is"||Un(a))continue;const e=typeof t[a],r=t[a];switch(e){case"boolean":case"number":case"string":n[a]=r;break;case"object":if(r!==null)if(n[a]=r,r.isTexture)if(r instanceof d.Texture){const s=r.source.toJSON();n[a]={src:s.url}}else r instanceof d.CubeTexture&&(console.log("env map"),console.log(r.source.data),console.log(r.source.toJSON()),n[a]={src:""});else a==="uniforms"&&(n[a]=Nn(n[a]));else n[a]={src:""};break}}return n}function Pt(t){t.updateMatrix();const n={name:t.name,type:t.type,uuid:t.uuid,visible:t.visible,matrix:t.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};t.animations.forEach(e=>{n.animations.push({name:e.name,duration:e.duration,blendMode:e.blendMode})});const a=t.type.toLowerCase();if(a.search("mesh")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Ve(s))}),n.material=r}else n.material=Ve(e.material)}else if(a.search("points")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Ve(s))}),n.material=r}else n.material=Ve(e.material)}else if(a.search("line")>-1){const e=t;if(Array.isArray(e.material)){const r=[];e.material.forEach(s=>{r.push(Ve(s))}),n.material=r}else n.material=Ve(e.material)}else a.search("camera")>-1?t.type==="PerspectiveCamera"?n.perspectiveCameraInfo={fov:t.fov,zoom:t.zoom,near:t.near,far:t.far,focus:t.focus,aspect:t.aspect,filmGauge:t.filmGauge,filmOffset:t.filmOffset}:t.type==="OrthographicCamera"&&(n.orthographicCameraInfo={zoom:t.zoom,near:t.near,far:t.far,left:t.left,right:t.right,top:t.top,bottom:t.bottom}):a.search("light")>-1&&(n.lightInfo={color:t.color,intensity:t.intensity,decay:t.decay,distance:t.distance,angle:t.angle,penumbra:t.penumbra,groundColor:t.groundColor});return n}function q(t,n,a){const e=n.split(".");switch(e.length){case 1:t[e[0]]=a;break;case 2:t[e[0]][e[1]]=a;break;case 3:t[e[0]][e[1]][e[2]]=a;break;case 4:t[e[0]][e[1]][e[2]][e[3]]=a;break;case 5:t[e[0]][e[1]][e[2]][e[3]][e[4]]=a;break}}function jt(t){return new Promise((n,a)=>{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=a,e.src=t})}class Qt extends Je{constructor(){super(...arguments);V(this,"scene")}getObject(a){this.app.debugEnabled&&this.app.send({event:"getObject",target:"app",data:a})}setObject(a){const e=Pt(a);this.app.send({event:"setObject",target:"editor",data:e})}requestMethod(a,e,r){this.app.send({event:"requestMethod",target:"app",data:{uuid:a,key:e,value:r}})}updateObject(a,e,r){this.app.send({event:"updateObject",target:"app",data:{uuid:a,key:e,value:r}})}createTexture(a,e,r){this.app.send({event:"createTexture",target:"app",data:{uuid:a,key:e,value:r}})}setScene(a){if(a===void 0||(this.scene=a,!this.app.debugEnabled))return;Wt(),Mt(this.scene);const e=Jt(this.scene);this.app.send({event:"setScene",target:"editor",data:e})}addCamera(a){if(!this.app.debugEnabled)return;const e=Pt(a);this.app.send({event:"addCamera",target:"editor",data:e})}removeCamera(a){if(!this.app.debugEnabled)return;const e=Pt(a);this.app.send({event:"removeCamera",target:"editor",data:e})}}function Fn(t,n){switch(n.event){case"getObject":A.dispatchEvent({type:I.GET_OBJECT,value:n.data});break;case"updateObject":A.dispatchEvent({type:I.UPDATE_OBJECT,value:n.data});break;case"createTexture":A.dispatchEvent({type:I.CREATE_TEXTURE,value:n.data});break;case"requestMethod":A.dispatchEvent({type:I.REQUEST_METHOD,value:n.data});break}}function Bn(t,n){switch(n.event){case"setObject":A.dispatchEvent({type:I.SET_OBJECT,value:n.data});break;case"setScene":A.dispatchEvent({type:I.SET_SCENE,value:n.data});break;case"addCamera":A.dispatchEvent({type:I.ADD_CAMERA,value:n.data});break;case"removeCamera":A.dispatchEvent({type:I.REMOVE_CAMERA,value:n.data});break}}class _t extends Je{constructor(a){super(a);V(this,"bindCBs");V(this,"buttonCBs");V(this,"pane");V(this,"appCallbacks",0);V(this,"editorCallbacks",0);V(this,"inspectorFolder");this.bindCBs=new Map,this.buttonCBs=new Map,a.editor&&this.createGUI()}createGUI(){this.pane=new xn.Pane({title:"GUI"}),this.pane.registerPlugin(Mn)}dispose(){var a;this.bindCBs.clear(),this.buttonCBs.clear(),this.appCallbacks=0,this.editorCallbacks=0,this.app.editor&&((a=this.pane)==null||a.dispose(),this.pane=void 0)}addFolder(a,e=void 0,r=void 0){if(this.app.editor)return this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addFolder({title:a,...e});this.app.send({event:"addFolder",target:"app",data:{name:a,params:e,parent:r}})}get bindID(){return`debug_${Math.max(this.appCallbacks,this.editorCallbacks)}`}bind(a,e,r,s=void 0){const f=this.bindID,c=r.onChange!==void 0?r.onChange:Zt;this.bindCBs.set(f,c),this.app.editor?(this.pane===void 0&&this.createGUI(),(s!==void 0?s:this.pane).addBinding(a,e,r).on("change",m=>{this.app.send({event:"updateBind",target:"app",data:{id:f,value:m.value}})}),this.editorCallbacks++):(this.app.send({event:"bindObject",target:"app",data:{id:f,name:e,params:r,parent:s}}),this.appCallbacks++)}triggerBind(a,e){const r=this.bindCBs.get(a);r!==void 0?r(e):console.warn(`No callback for: ${a}`,e)}button(a,e,r=void 0){const s=this.bindID;this.buttonCBs.set(s,e),this.app.editor?(this.pane===void 0&&this.createGUI(),(r!==void 0?r:this.pane).addButton({title:a}).on("click",()=>{this.app.send({event:"clickButton",target:"app",data:{id:s}})}),this.editorCallbacks++):(this.app.send({event:"addButton",target:"app",data:{id:s,name:a,callback:e,parent:r}}),this.appCallbacks++)}triggerButton(a){const e=this.buttonCBs.get(a);e!==void 0&&e()}createInspector(){this.inspectorFolder=this.addFolder("Inspector",this.pane)}clearInspector(){const a=this.inspectorFolder.children.length-1;for(let e=a;e>-1;--e)this.inspectorFolder.remove(this.inspectorFolder.children[e])}}function Vn(t,n){t.components.forEach(a=>{if(a instanceof _t){const e=a;switch(n.event){case"addFolder":e.addFolder(n.data.name,n.data.params,n.data.parent);break;case"bindObject":e.bind(n.data.name,n.data.params,n.data.parent);break;case"updateBind":e.triggerBind(n.data.id,n.data.value);break;case"addButton":e.button(n.data.name,n.data.callback,n.data.parent);break;case"clickButton":e.triggerButton(n.data.id);break}return}})}var kt={exports:{}},Qe={};/**
|
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 qt;function Hn(){if(qt)return Qe;qt=1;var t=
|
9
|
+
*/var qt;function Hn(){if(qt)return Qe;qt=1;var t=j,n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),e=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function f(c,u,m){var y,g={},C=null,x=null;m!==void 0&&(C=""+m),u.key!==void 0&&(C=""+u.key),u.ref!==void 0&&(x=u.ref);for(y in u)e.call(u,y)&&!s.hasOwnProperty(y)&&(g[y]=u[y]);if(c&&c.defaultProps)for(y in u=c.defaultProps,u)g[y]===void 0&&(g[y]=u[y]);return{$$typeof:n,type:c,key:C,ref:x,props:g,_owner:r.current}}return Qe.Fragment=a,Qe.jsx=f,Qe.jsxs=f,Qe}var qe={};/**
|
10
10
|
* @license React
|
11
11
|
* react-jsx-runtime.development.js
|
12
12
|
*
|
@@ -14,19 +14,19 @@
|
|
14
14
|
*
|
15
15
|
* This source code is licensed under the MIT license found in the
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
17
|
-
*/var $t;function
|
18
|
-
`+it+i}}var
|
19
|
-
`),
|
20
|
-
`)
|
21
|
-
`+
|
17
|
+
*/var $t;function zn(){return $t||($t=1,process.env.NODE_ENV!=="production"&&function(){var t=j,n=Symbol.for("react.element"),a=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),M=Symbol.iterator,P="@@iterator";function Q(i){if(i===null||typeof i!="object")return null;var p=M&&i[M]||i[P];return typeof p=="function"?p:null}var U=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function O(i){{for(var p=arguments.length,b=new Array(p>1?p-1:0),T=1;T<p;T++)b[T-1]=arguments[T];J("error",i,b)}}function J(i,p,b){{var T=U.ReactDebugCurrentFrame,L=T.getStackAddendum();L!==""&&(p+="%s",b=b.concat([L]));var z=b.map(function(D){return String(D)});z.unshift("Warning: "+p),Function.prototype.apply.call(console[i],console,z)}}var le=!1,de=!1,ie=!1,h=!1,v=!1,E;E=Symbol.for("react.module.reference");function R(i){return!!(typeof i=="string"||typeof i=="function"||i===e||i===s||v||i===r||i===m||i===y||h||i===x||le||de||ie||typeof i=="object"&&i!==null&&(i.$$typeof===C||i.$$typeof===g||i.$$typeof===f||i.$$typeof===c||i.$$typeof===u||i.$$typeof===E||i.getModuleId!==void 0))}function W(i,p,b){var T=i.displayName;if(T)return T;var L=p.displayName||p.name||"";return L!==""?b+"("+L+")":b}function K(i){return i.displayName||"Context"}function G(i){if(i==null)return null;if(typeof i.tag=="number"&&O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case e:return"Fragment";case a:return"Portal";case s:return"Profiler";case r:return"StrictMode";case m:return"Suspense";case y:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case c:var p=i;return K(p)+".Consumer";case f:var b=i;return K(b._context)+".Provider";case u:return W(i,i.render,"ForwardRef");case g:var T=i.displayName||null;return T!==null?T:G(i.type)||"Memo";case C:{var L=i,z=L._payload,D=L._init;try{return G(D(z))}catch{return null}}}return null}var F=Object.assign,Y=0,ne,k,B,ee,me,Ie,nt;function vt(){}vt.__reactDisabledLog=!0;function Nt(){{if(Y===0){ne=console.log,k=console.info,B=console.warn,ee=console.error,me=console.group,Ie=console.groupCollapsed,nt=console.groupEnd;var i={configurable:!0,enumerable:!0,value:vt,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}Y++}}function Ut(){{if(Y--,Y===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},i,{value:ne}),info:F({},i,{value:k}),warn:F({},i,{value:B}),error:F({},i,{value:ee}),group:F({},i,{value:me}),groupCollapsed:F({},i,{value:Ie}),groupEnd:F({},i,{value:nt})})}Y<0&&O("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var at=U.ReactCurrentDispatcher,it;function Le(i,p,b){{if(it===void 0)try{throw Error()}catch(L){var T=L.stack.trim().match(/\n( *(at )?)/);it=T&&T[1]||""}return`
|
18
|
+
`+it+i}}var Ge=!1,Ne;{var Ft=typeof WeakMap=="function"?WeakMap:Map;Ne=new Ft}function gt(i,p){if(!i||Ge)return"";{var b=Ne.get(i);if(b!==void 0)return b}var T;Ge=!0;var L=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var z;z=at.current,at.current=null,Nt();try{if(p){var D=function(){throw Error()};if(Object.defineProperty(D.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(D,[])}catch(Se){T=Se}Reflect.construct(i,[],D)}else{try{D.call()}catch(Se){T=Se}i.call(D.prototype)}}else{try{throw Error()}catch(Se){T=Se}i()}}catch(Se){if(Se&&T&&typeof Se.stack=="string"){for(var _=Se.stack.split(`
|
19
|
+
`),ue=T.stack.split(`
|
20
|
+
`),$=_.length-1,te=ue.length-1;$>=1&&te>=0&&_[$]!==ue[te];)te--;for(;$>=1&&te>=0;$--,te--)if(_[$]!==ue[te]){if($!==1||te!==1)do if($--,te--,te<0||_[$]!==ue[te]){var ve=`
|
21
|
+
`+_[$].replace(" at new "," at ");return i.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",i.displayName)),typeof i=="function"&&Ne.set(i,ve),ve}while($>=1&&te>=0);break}}}finally{Ge=!1,at.current=z,Ut(),Error.prepareStackTrace=L}var Xe=i?i.displayName||i.name:"",Cn=Xe?Le(Xe):"";return typeof i=="function"&&Ne.set(i,Cn),Cn}function bt(i,p,b){return gt(i,!1)}function yt(i){var p=i.prototype;return!!(p&&p.isReactComponent)}function Ue(i,p,b){if(i==null)return"";if(typeof i=="function")return gt(i,yt(i));if(typeof i=="string")return Le(i);switch(i){case m:return Le("Suspense");case y:return Le("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case u:return bt(i.render);case g:return Ue(i.type,p,b);case C:{var T=i,L=T._payload,z=T._init;try{return Ue(z(L),p,b)}catch{}}}return""}var Ye=Object.prototype.hasOwnProperty,Et={},rt=U.ReactDebugCurrentFrame;function Te(i){if(i){var p=i._owner,b=Ue(i.type,i._source,p?p.type:null);rt.setExtraStackFrame(b)}else rt.setExtraStackFrame(null)}function Fe(i,p,b,T,L){{var z=Function.call.bind(Ye);for(var D in i)if(z(i,D)){var _=void 0;try{if(typeof i[D]!="function"){var ue=Error((T||"React class")+": "+b+" type `"+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[D]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ue.name="Invariant Violation",ue}_=i[D](p,D,T,b,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($){_=$}_&&!(_ instanceof Error)&&(Te(L),O("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",T||"React class",b,D,typeof _),Te(null)),_ instanceof Error&&!(_.message in Et)&&(Et[_.message]=!0,Te(L),O("Failed %s type: %s",b,_.message),Te(null))}}}var Bt=Array.isArray;function ot(i){return Bt(i)}function wt(i){{var p=typeof Symbol=="function"&&Symbol.toStringTag,b=p&&i[Symbol.toStringTag]||i.constructor.name||"Object";return b}}function st(i){try{return St(i),!1}catch{return!0}}function St(i){return""+i}function Ct(i){if(st(i))return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",wt(i)),St(i)}var Me=U.ReactCurrentOwner,Vt={key:!0,ref:!0,__self:!0,__source:!0},xt,ct,ge;ge={};function o(i){if(Ye.call(i,"ref")){var p=Object.getOwnPropertyDescriptor(i,"ref").get;if(p&&p.isReactWarning)return!1}return i.ref!==void 0}function w(i){if(Ye.call(i,"key")){var p=Object.getOwnPropertyDescriptor(i,"key").get;if(p&&p.isReactWarning)return!1}return i.key!==void 0}function N(i,p){if(typeof i.ref=="string"&&Me.current&&p&&Me.current.stateNode!==p){var b=G(Me.current.type);ge[b]||(O('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',G(Me.current.type),i.ref),ge[b]=!0)}}function H(i,p){{var b=function(){xt||(xt=!0,O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};b.isReactWarning=!0,Object.defineProperty(i,"key",{get:b,configurable:!0})}}function re(i,p){{var b=function(){ct||(ct=!0,O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};b.isReactWarning=!0,Object.defineProperty(i,"ref",{get:b,configurable:!0})}}var be=function(i,p,b,T,L,z,D){var _={$$typeof:n,type:i,key:p,ref:b,props:D,_owner:z};return _._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(_,"_self",{configurable:!1,enumerable:!1,writable:!1,value:T}),Object.defineProperty(_,"_source",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_};function fe(i,p,b,T,L){{var z,D={},_=null,ue=null;b!==void 0&&(Ct(b),_=""+b),w(p)&&(Ct(p.key),_=""+p.key),o(p)&&(ue=p.ref,N(p,L));for(z in p)Ye.call(p,z)&&!Vt.hasOwnProperty(z)&&(D[z]=p[z]);if(i&&i.defaultProps){var $=i.defaultProps;for(z in $)D[z]===void 0&&(D[z]=$[z])}if(_||ue){var te=typeof i=="function"?i.displayName||i.name||"Unknown":i;_&&H(D,te),ue&&re(D,te)}return be(i,_,ue,L,T,Me.current,D)}}var Ot=U.ReactCurrentOwner,Tt=U.ReactDebugCurrentFrame;function we(i){if(i){var p=i._owner,b=Ue(i.type,i._source,p?p.type:null);Tt.setExtraStackFrame(b)}else Tt.setExtraStackFrame(null)}var he;he=!1;function pe(i){return typeof i=="object"&&i!==null&&i.$$typeof===n}function We(){{if(Ot.current){var i=G(Ot.current.type);if(i)return`
|
22
22
|
|
23
|
-
Check the render method of \``+i+"`."}return""}}function
|
23
|
+
Check the render method of \``+i+"`."}return""}}function Be(i){{if(i!==void 0){var p=i.fileName.replace(/^.*[\\\/]/,""),b=i.lineNumber;return`
|
24
24
|
|
25
|
-
Check your code at `+p+":"+
|
25
|
+
Check your code at `+p+":"+b+"."}return""}}var Re={};function Ke(i){{var p=We();if(!p){var b=typeof i=="string"?i:i.displayName||i.name;b&&(p=`
|
26
26
|
|
27
|
-
Check the top-level render call using <`+
|
27
|
+
Check the top-level render call using <`+b+">.")}return p}}function En(i,p){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var b=Ke(p);if(Re[b])return;Re[b]=!0;var T="";i&&i._owner&&i._owner!==Ot.current&&(T=" It was passed a child from "+G(i._owner.type)+"."),we(i),O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,T),we(null)}}function wn(i,p){{if(typeof i!="object")return;if(ot(i))for(var b=0;b<i.length;b++){var T=i[b];pe(T)&&En(T,p)}else if(pe(i))i._store&&(i._store.validated=!0);else if(i){var L=Q(i);if(typeof L=="function"&&L!==i.entries)for(var z=L.call(i),D;!(D=z.next()).done;)pe(D.value)&&En(D.value,p)}}}function Sa(i){{var p=i.type;if(p==null||typeof p=="string")return;var b;if(typeof p=="function")b=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===u||p.$$typeof===g))b=p.propTypes;else return;if(b){var T=G(p);Fe(b,i.props,"prop",T,i)}else if(p.PropTypes!==void 0&&!he){he=!0;var L=G(p);O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",L||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ca(i){{for(var p=Object.keys(i.props),b=0;b<p.length;b++){var T=p[b];if(T!=="children"&&T!=="key"){we(i),O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",T),we(null);break}}i.ref!==null&&(we(i),O("Invalid attribute `ref` supplied to `React.Fragment`."),we(null))}}function Sn(i,p,b,T,L,z){{var D=R(i);if(!D){var _="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ue=Be(L);ue?_+=ue:_+=We();var $;i===null?$="null":ot(i)?$="array":i!==void 0&&i.$$typeof===n?($="<"+(G(i.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):$=typeof i,O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",$,_)}var te=fe(i,p,b,L,z);if(te==null)return te;if(D){var ve=p.children;if(ve!==void 0)if(T)if(ot(ve)){for(var Xe=0;Xe<ve.length;Xe++)wn(ve[Xe],i);Object.freeze&&Object.freeze(ve)}else O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else wn(ve,i)}return i===e?Ca(te):Sa(te),te}}function xa(i,p,b){return Sn(i,p,b,!0)}function Oa(i,p,b){return Sn(i,p,b,!1)}var Ta=Oa,Ma=xa;qe.Fragment=e,qe.jsx=Ta,qe.jsxs=Ma}()),qe}process.env.NODE_ENV==="production"?kt.exports=Hn():kt.exports=zn();var l=kt.exports;function Dt(t){return t.title.search("<")>-1?l.jsx("button",{className:"svg",dangerouslySetInnerHTML:{__html:t.title}}):l.jsx("button",{children:t.title})}const Gn=l.jsxs("svg",{className:"closeIcon",width:"14",height:"14",fill:"none",stroke:"#666666",strokeMiterlimit:"10",children:[l.jsx("circle",{cx:"7",cy:"7",r:"6"}),l.jsx("line",{x1:"4",y1:"4",x2:"10",y2:"10"}),l.jsx("line",{x1:"4",y1:"10",x2:"10",y2:"4"})]}),Yn=l.jsx("svg",{className:"dragIcon",width:"14",height:"14",fill:"#666666",stroke:"none",children:l.jsx("path",{d:`M10.43,4H3.57C3.26,4,3,4.22,3,4.5v1C3,5.78,3.26,6,3.57,6h6.86C10.74,6,11,5.78,11,5.5v-1
|
28
28
|
C11,4.22,10.74,4,10.43,4z M10.43,8H3.57C3.26,8,3,8.22,3,8.5v1C3,9.78,3.26,10,3.57,10h6.86C10.74,10,11,9.78,11,9.5v-1
|
29
|
-
C11,8.22,10.74,8,10.43,8z`})});function en(t){return
|
29
|
+
C11,8.22,10.74,8,10.43,8z`})});function en(t){return l.jsx(Ht.Reorder.Item,{value:t.title,children:l.jsxs("div",{children:[Yn,l.jsx("span",{children:t.title}),l.jsx("button",{className:"closeIcon",onClick:()=>{t.onDelete(t.index)},children:Gn})]})},t.title)}function tn(t){const[n,a]=j.useState(!1),[e,r]=j.useState(t.options),s=m=>{t.onDragComplete(m),r(m)},f=m=>{const y=[...e];y.splice(m,1),s(y)},c=[];e.forEach((m,y)=>{c.push(l.jsx(en,{index:y,title:m,onDelete:f},m))});let u="dropdown draggable";return t.subdropdown&&(u+=" subdropdown"),l.jsxs("div",{className:u,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Dt,{title:t.title}),l.jsx(Ht.Reorder.Group,{axis:"y",values:e,onReorder:s,style:{visibility:n?"visible":"hidden"},children:c})]})}function nn(t){const[n,a]=j.useState(!1),e=[];t.options.map((s,f)=>{t.onSelect!==void 0&&(s.onSelect=t.onSelect),e.push(l.jsx(an,{option:s},f))});let r="dropdown";return t.subdropdown&&(r+=" subdropdown"),l.jsxs("div",{className:r,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[l.jsx(Dt,{title:t.title}),l.jsx("ul",{style:{visibility:n?"visible":"hidden"},children:e})]})}function an(t){const{option:n}=t,[a,e]=j.useState("");let r;switch(n.type){case"draggable":r=l.jsx(tn,{title:n.title,options:n.value,onDragComplete:s=>{n.onDragComplete!==void 0&&n.onDragComplete(s)},subdropdown:!0});break;case"dropdown":r=l.jsx(nn,{title:n.title,options:n.value,onSelect:n.onSelect,subdropdown:!0});break;case"option":r=l.jsx("button",{onClick:()=>{n.onSelect!==void 0&&n.onSelect(n.value),n.selectable&&(a!==n.title?e(n.title):e(""))},children:n.title});break}return l.jsx("li",{className:a===n.title?"selected":"",children:r},zt())}function Wn(t){const n=[],a=[];t.components.forEach(s=>{s instanceof Xt?n.push(kn):s instanceof xe?(n.push(Dn),a.push(In),An(t)):s instanceof Qt?(n.push(Fn),a.push(Bn)):s instanceof _t&&n.push(Vn)});function e(s){switch(n.forEach(f=>f(t,s)),s.event){case"custom":A.dispatchEvent({type:I.CUSTOM,value:s.data});break}}function r(s){switch(a.forEach(f=>f(t,s)),s.event){case"custom":A.dispatchEvent({type:I.CUSTOM,value:s.data});break}}t.listen=s=>{s.target==="editor"?r(s):e(s)}}const Kn=`out vec3 worldPosition;
|
30
30
|
uniform float uDistance;
|
31
31
|
|
32
32
|
void main() {
|
@@ -102,7 +102,7 @@ void main() {
|
|
102
102
|
fragColor.a = mix(fragColor.a, baseOpacity * uGridOpacity, nextGrid);
|
103
103
|
|
104
104
|
if (fragColor.a <= 0.0) discard;
|
105
|
-
}`;class Zn 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:Kn,fragmentShader:Xn,name:"InfiniteGrid",depthWrite:!1})}}class rn extends d.Mesh{constructor(){const a=new Zn;super(new d.PlaneGeometry(2,2),a);
|
105
|
+
}`;class Zn 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:Kn,fragmentShader:Xn,name:"InfiniteGrid",depthWrite:!1})}}class rn extends d.Mesh{constructor(){const a=new Zn;super(new d.PlaneGeometry(2,2),a);V(this,"gridMaterial");this.gridMaterial=a,this.frustumCulled=!1,this.name="InfiniteGridHelper",this.position.y=.1}update(){this.gridMaterial.needsUpdate=!0}}const Jn=`#include <common>
|
106
106
|
#include <batching_pars_vertex>
|
107
107
|
#include <uv_pars_vertex>
|
108
108
|
#include <color_pars_vertex>
|
@@ -140,5 +140,5 @@ void main() {
|
|
140
140
|
void main() {
|
141
141
|
#include <clipping_planes_fragment>
|
142
142
|
gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
|
143
|
-
}`;class on extends d.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:Jn,fragmentShader:Qn})}}const ja="";function ut(t){const[n,a]=R.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return c.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[c.jsxs("button",{className:"toggle",onClick:()=>{const r=!n;t.onToggle!==void 0&&t.onToggle(r),a(r)},children:[c.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),c.jsx("p",{className:"label",children:t.label})]}),t.button,c.jsx("div",{className:n?"open":"",children:c.jsx("div",{children:t.children})})]})}function At(t){const[n,a]=R.useState(!1),e=t.child.children.length>0,r=[];return t.child.children.length>0&&t.child.children.map(s=>{r.push(c.jsx(At,{child:s,three:t.three},Math.random()))}),c.jsxs("div",{className:"childObject",children:[c.jsxs("div",{className:"child",children:[e?c.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,c.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),c.jsx("div",{className:`icon ${Ln(t.child)}`})]}),c.jsx("div",{className:n?"open":"",children:c.jsx("div",{className:"container",children:r})})]},Math.random())}function sn(t){const n=[];return t.child.children.map(a=>{n.push(c.jsx(At,{child:a,three:t.three},Math.random()))}),c.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const _a="",qn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function $n(t){return"items"in t}function Pe(t){const n=[];return t.items.forEach(a=>{$n(a)?n.push(c.jsx(Pe,{title:a.title,items:a.items},Math.random())):n.push(c.jsx($e,{title:a.title,prop:a.prop,value:a.value,type:a.type,min:a.min,max:a.max,step:a.step,disabled:a.disabled,onChange:(e,r)=>{a.onChange!==void 0&&a.onChange(e,r)}},Math.random()))}),c.jsx(ut,{label:t.title,open:t.expanded===!0,children:n})}function ea(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linecap"||t==="linejoin"||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 je(t){switch(t){case"alphaMap":return"Alpha Map";case"anisotropyMap":return"Anisotropy Map";case"anisotropyRotation":return"Anisotropy Rotation";case"aoMap":return"AO Map";case"aoMapIntensity":return"AO Map Intensity";case"attenuationColor":return"Attenuation Color";case"bumpMap":return"Bump Map";case"bumpScale":return"Bump Scale";case"clearcoatMap":return"Clearcoat Map";case"clearcoatNormalMap":return"Clearcoat Normal Map";case"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";case"clearcoatRoughnessMap":return"Clearcoat Roughness Map";case"color":return"Color";case"defines":return"Defines";case"depthTest":return"Depth Test";case"depthWrite":return"Depth Write";case"displacementBias":return"Displacement Bias";case"displacementMap":return"Displacement Map";case"displacementScale":return"Displacement Scale";case"dithering":return"Dithering";case"emissive":return"Emissive";case"emissiveMap":return"Emissive Map";case"emissiveIntensity":return"Emissive Intensity";case"envMap":return"Environment Map";case"envMapIntensity":return"Environment Map Intensity";case"extensions":return"Extensions";case"flatShading":return"Flat Shading";case"fragmentShader":return"Fragment Shader";case"fog":return"Fog";case"gradientMap":return"Gradient Map";case"ior":return"IOR";case"iridescenceIOR":return"Iridescence IOR";case"iridescenceMap":return"Iridescence Map";case"iridescenceThicknessMap":return"Iridescence Thickness Map";case"iridescenceThicknessRange":return"Iridescence Thickness Range";case"lights":return"Lights";case"lightMap":return"Light Map";case"lightMapIntensity":return"Light Map Intensity";case"map":return"Map";case"matcap":return"Matcap";case"metalness":return"Metalness";case"metalnessMap":return"Metalness Map";case"name":return"Name";case"normalMap":return"Normal Map";case"normalScale":return"Normal Scale";case"opacity":return"Opacity";case"reflectivity":return"Reflectivity";case"refractionRatio":return"Refraction Ratio";case"roughness":return"Roughness";case"roughnessMap":return"Roughness Map";case"sheenColor":return"Sheen Color";case"sheenColorMap":return"Sheen Color Map";case"sheenRoughness":return"Sheen Roughness";case"sheenRoughnessMap":return"Sheen Roughness Map";case"shininess":return"Shininess";case"size":return"Size";case"sizeAttenuation":return"Size Attenuation";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularColorMap":return"Specular Color Map";case"specularIntensity":return"Specular Intensity";case"specularIntensityMap":return"Specular Map Intensity";case"thickness":return"Thickness";case"thicknessMap":return"Thickness Map";case"transmission":return"Transmission";case"transmissionMap":return"Transmission Map";case"transparent":return"Transparent";case"type":return"Type";case"uuid":return"UUID";case"uniforms":return"Uniforms";case"vertexShader":return"Vertex Shader";case"visible":return"Visible";case"wireframe":return"Wireframe"}return t}function ta(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 na(){const t=document.createElement("input");return t.type="file",new Promise((n,a)=>{t.addEventListener("change",function(){if(t.files===null)a();else{const e=t.files[0],r=new FileReader;r.onload=function(s){n(s.target.result)},r.readAsDataURL(e)}}),t.click()})}function cn(t,n,a){const e=[];for(const r in t){if(!ea(r))continue;const s=typeof t[r],f=t[r];if(s==="boolean"||s==="number"||s==="string"){const l={title:je(r),prop:r,type:s,value:f,min:void 0,max:void 0,onChange:(u,m)=>{var S;a.updateObject(n.uuid,`material.${u}`,m),s==="boolean"&&a.updateObject(n.uuid,"material.needsUpdate",!0);const b=(S=a.scene)==null?void 0:S.getObjectByProperty("uuid",n.uuid);b!==void 0&&te(b,`material.${u}`,m)}};ta(r)&&(l.value=Number(f),l.type="range",l.min=0,l.max=1,l.step=.01),e.push(l)}else if(s==="object")if(f.isColor)e.push({title:je(r),prop:r,type:"color",value:f,onChange:(l,u)=>{var S;const m=new d.Color(u);a.updateObject(n.uuid,`material.${l}`,m);const b=(S=a.scene)==null?void 0:S.getObjectByProperty("uuid",n.uuid);b!==void 0&&te(b,`material.${l}`,m)}});else if(Array.isArray(f)){const l=[];for(const u in f)l.push({title:`${u}`,type:`${typeof f[u]}`,value:f[u],onChange:(m,b)=>{var O;a.updateObject(n.uuid,`material.${r}`,b);const S=(O=a.scene)==null?void 0:O.getObjectByProperty("uuid",n.uuid);S!==void 0&&te(S,`material.${r}`,b)}});e.push({title:je(r),items:l})}else{const l=[];for(const u in f){const m=f[u];switch(typeof m){case"boolean":case"number":case"string":u==="src"?e.push({title:je(r),type:"image",value:m,onChange:(S,O)=>{var j;a.createTexture(n.uuid,`material.${r}`,O);const x=(j=a.scene)==null?void 0:j.getObjectByProperty("uuid",n.uuid);x!==void 0&&jt(O).then(X=>{te(x,`material.${r}`,X),te(x,"material.needsUpdate",!0)})}}):l.push({title:`${je(u)}`,prop:`material.${r}.${u}`,type:`${typeof t[r][u]}`,value:f[u],onChange:(S,O)=>{var j;a.updateObject(n.uuid,`material.${r}.${u}`,O);const x=(j=a.scene)==null?void 0:j.getObjectByProperty("uuid",n.uuid);x!==void 0&&te(x,`material.${r}.${u}`,O)}});break;case"object":m.value!==void 0&&m.value.src!==void 0?l.push({title:je(u),type:"image",value:m.value.src,onChange:(S,O)=>{var j;a.createTexture(n.uuid,`material.${r}.${u}.value`,O);const x=(j=a.scene)==null?void 0:j.getObjectByProperty("uuid",n.uuid);x!==void 0&&jt(O).then(X=>{te(x,`material.${r}.${u}.value`,X)})}}):l.push({title:u,type:`${typeof m.value}`,value:m.value,onChange:(S,O)=>{var j;a.updateObject(n.uuid,`material.${r}.${u}.value`,O);const x=(j=a.scene)==null?void 0:j.getObjectByProperty("uuid",n.uuid);x!==void 0&&te(x,`material.${r}.${u}.value`,O)}});break}}l.length>0&&e.push({title:je(r),items:l})}else f!==void 0&&console.log("other:",r,s,f)}return e.sort((r,s)=>r.title<s.title?-1:r.title>s.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function aa(t,n){const a=t.material;if(Array.isArray(a)){const e=[],r=a.length;for(let s=0;s<r;s++)e.push(c.jsx(Pe,{title:`Material ${s}`,items:cn(a[s],t,n)},`Material ${s}`));return c.jsx(c.Fragment,{children:e})}else return c.jsx(Pe,{title:"Material",items:cn(a,t,n)})}function $e(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=Yt(t.value));const[a,e]=R.useState(n),r=R.useRef(null),s=R.useRef(null),f=R.useRef(null);R.useEffect(()=>{var Q;let b=!1,S=-1,O=0,x=Number(a);const j=fe=>{b=!0,O=x,S=fe.clientX},X=fe=>{if(!b)return;const ue=t.step!==void 0?t.step:1,ae=(fe.clientX-S)*ue;x=Number((O+ae).toFixed(4)),s.current!==null&&(s.current.value=x.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,x)},ce=()=>{b=!1},J=()=>{b=!1},T=t.type==="number";return T&&((Q=r.current)==null||Q.addEventListener("mousedown",j,!1),document.addEventListener("mouseup",ce,!1),document.addEventListener("mousemove",X,!1),document.addEventListener("contextmenu",J,!1)),()=>{var fe;T&&((fe=r.current)==null||fe.removeEventListener("mousedown",j),document.removeEventListener("mouseup",ce),document.removeEventListener("mousemove",X),document.removeEventListener("contextmenu",J))}},[a]);const l=t.type==="string"&&(a.length>100||a.search(`
|
144
|
-
`)>-1),u=l||t.type==="image",m=b=>{let S=b.target.value;t.type==="boolean"&&(S=b.target.checked),e(S),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,S)};return c.jsxs("div",{className:`field ${u?"block":""}`,children:[t.type!=="button"&&c.jsx("label",{ref:r,children:t.title},"fieldLabel"),t.type==="string"&&!l&&c.jsx("input",{type:"text",disabled:t.disabled,onChange:m,value:a}),t.type==="string"&&l&&c.jsx("textarea",{cols:50,rows:10,disabled:!0,onChange:m,value:a}),t.type==="boolean"&&c.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:m,checked:a}),t.type==="number"&&c.jsx("input",{ref:s,type:"number",value:a,min:t.min,max:t.max,step:t.step,onChange:m}),t.type==="range"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:a.toString(),onChange:m,className:"min"}),c.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:m})]}),t.type==="color"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:a.toString(),onChange:m,className:"color"}),c.jsx("input",{type:"color",value:a,onChange:m})]}),t.type==="button"&&c.jsx("button",{onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&c.jsx("img",{ref:f,onClick:()=>{na().then(b=>{f.current.src=b,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,b)})},src:a.length>0?a:qn})]})}function ln(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 ia(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:ln(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const f=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);f!==void 0&&(te(f,r,s),f.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:ln(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const f=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);f!==void 0&&(te(f,r,s),f.updateProjectionMatrix())}});return c.jsx(Pe,{title:"Camera",items:a})}const ra=Math.PI/180,oa=180/Math.PI;function He(t,n,a,e,r){return e+(t-n)*(r-e)/(a-n)}function sa(t){return t*ra}function It(t){return t*oa}function ca(t,n){const a=new d.Matrix4;a.elements=t.matrix;const e=new d.Vector3,r=new d.Euler,s=new d.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),r.setFromRotationMatrix(a),s.setFromMatrixScale(a));const f=(u,m)=>{var S;n.updateObject(t.uuid,u,m);const b=(S=n.scene)==null?void 0:S.getObjectByProperty("uuid",t.uuid);b!==void 0&&te(b,u,m)},l=(u,m)=>{f(u,sa(m))};return c.jsx(Pe,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:f},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:f},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:f},{title:"Rotation X",prop:"rotation.x",type:"number",value:lt(It(r.x)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Y",prop:"rotation.y",type:"number",value:lt(It(r.y)),min:-360,max:360,step:.1,onChange:l},{title:"Rotation Z",prop:"rotation.z",type:"number",value:lt(It(r.z)),min:-360,max:360,step:.1,onChange:l},{title:"Scale X",prop:"scale.x",type:"number",value:s.x,step:.01,onChange:f},{title:"Scale Y",prop:"scale.y",type:"number",value:s.y,step:.01,onChange:f},{title:"Scale Z",prop:"scale.z",type:"number",value:s.z,step:.01,onChange:f}]})}function un(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 la(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const r=t.lightInfo[e];r!==void 0&&(r.isColor!==void 0?a.push({title:un(e),prop:e,type:"color",value:r,onChange:(s,f)=>{var m;const l=new d.Color(f);n.updateObject(t.uuid,s,l);const u=(m=n.scene)==null?void 0:m.getObjectByProperty("uuid",t.uuid);u!==void 0&&te(u,s,l)}}):a.push({title:un(e),prop:e,type:typeof r,value:r,step:typeof r=="number"?.01:void 0,onChange:(s,f)=>{var u;n.updateObject(t.uuid,s,f);const l=(u=n.scene)==null?void 0:u.getObjectByProperty("uuid",t.uuid);l!==void 0&&te(l,s,f)}}))}return c.jsx(Pe,{title:"Light",items:a})}function ua(t,n){const a=[];return t.animations.forEach(e=>{a.push({title:"Name",type:"string",prop:"name",value:e.name,disabled:!0,onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s);const f=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);f!==void 0&&te(f,r,s)}}),a.push({title:"Duration",type:"number",prop:"duration",value:e.duration,disabled:!0,onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s);const f=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);f!==void 0&&te(f,r,s)}}),a.push({title:"Blend Mode",type:"number",prop:"blendMode",value:e.blendMode,disabled:!0,onChange:(r,s)=>{var l;n.updateObject(t.uuid,r,s);const f=(l=n.scene)==null?void 0:l.getObjectByProperty("uuid",t.uuid);f!==void 0&&te(f,r,s)}})}),c.jsx(Pe,{title:"Animations",items:a})}const dn={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};let re={...dn};function fn(t){const[n,a]=R.useState(-1);R.useEffect(()=>{function s(l){re={...l.value},a(Date.now())}function f(){re={...dn},a(Date.now())}return D.addEventListener(A.SET_SCENE,f),D.addEventListener(A.SET_OBJECT,s),()=>{D.removeEventListener(A.SET_SCENE,f),D.removeEventListener(A.SET_OBJECT,s)}},[]);const e=re.type.toLowerCase(),r=e.search("mesh")>-1||e.search("line")>-1||e.search("points")>-1;return c.jsx(ut,{label:"Inspector",children:c.jsx("div",{id:"Inspector",className:t.class,children:re.uuid.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs(c.Fragment,{children:[c.jsx($e,{type:"string",title:"Name",prop:"name",value:re.name,disabled:!0}),c.jsx($e,{type:"string",title:"Type",prop:"type",value:re.type,disabled:!0}),c.jsx($e,{type:"string",title:"UUID",prop:"uuid",value:re.uuid,disabled:!0}),c.jsx($e,{type:"boolean",title:"Visible",prop:"visible",value:re.visible,onChange:(s,f)=>{var u;t.three.updateObject(re.uuid,s,f);const l=(u=t.three.scene)==null?void 0:u.getObjectByProperty("uuid",re.uuid);l!==void 0&&te(l,s,f)}})]}),c.jsxs(c.Fragment,{children:[ca(re,t.three),re.animations.length>0?ua(re,t.three):null,e.search("camera")>-1?ia(re,t.three):null,e.search("light")>-1?la(re,t.three):null,r?aa(re,t.three):null]})]})},n)},"Inspector")}class da extends R.Component{constructor(a){super(a);F(this,"three");F(this,"setScene",a=>{this.setState(()=>({scene:a.value}))});this.state={scene:a.scene!==void 0?a.scene:null},this.three=a.three,D.addEventListener(A.SET_SCENE,this.setScene)}componentWillUnmount(){D.removeEventListener(A.SET_SCENE,this.setScene)}render(){var r;const a=this.componentState.scene!==null,e="Hierarchy - "+(a?`${(r=this.componentState.scene)==null?void 0:r.name}`:"No Scene");return c.jsx("div",{id:"SidePanel",children:c.jsxs(c.Fragment,{children:[c.jsx(ut,{label:e,open:!0,children:c.jsx(c.Fragment,{children:a&&c.jsx(sn,{child:this.componentState.scene,three:this.three})})}),c.jsx(fn,{three:this.three})]})},"SidePanel")}get componentState(){return this.state}}function fa(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=l=>{var m;if(!n())return;const u=(m=t.three.scene)==null?void 0:m.getObjectByProperty("uuid",l.value);u!==void 0&&t.three.setObject(u)},e=(l,u,m)=>{var S;if(!n())return;const b=(S=t.three.scene)==null?void 0:S.getObjectByProperty("uuid",l);b!==void 0&&te(b,u,m)},r=l=>{if(!n())return;const u=l.value,{key:m,value:b,uuid:S}=u;e(S,m,b)},s=l=>{if(!n())return;const u=l.value;jt(u.value).then(m=>{e(u.uuid,u.key,m),e(u.uuid,"material.needsUpdate",!0)})},f=l=>{var O;if(!n())return;const{key:u,uuid:m,value:b}=l.value,S=(O=t.three.scene)==null?void 0:O.getObjectByProperty("uuid",m);if(S!==void 0)try{S[u](b)}catch(x){console.log("Error requesting method:"),console.log(x),console.log(u),console.log(b)}};return R.useEffect(()=>(D.addEventListener(A.GET_OBJECT,a),D.addEventListener(A.UPDATE_OBJECT,r),D.addEventListener(A.CREATE_TEXTURE,s),D.addEventListener(A.REQUEST_METHOD,f),()=>{D.removeEventListener(A.GET_OBJECT,a),D.removeEventListener(A.UPDATE_OBJECT,r),D.removeEventListener(A.CREATE_TEXTURE,s),D.removeEventListener(A.REQUEST_METHOD,f)}),[]),null}const hn={type:"change"},Lt={type:"start"},pn={type:"end"},dt=new d.Ray,mn=new d.Plane,ha=Math.cos(70*d.MathUtils.DEG2RAD);class pa extends d.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new d.Vector3,this.cursor=new d.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:d.MOUSE.ROTATE,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.PAN},this.touches={ONE:d.TOUCH.ROTATE,TWO:d.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",st),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",st),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(hn),e.update(),s=r.NONE},this.update=function(){const o=new d.Vector3,E=new d.Quaternion().setFromUnitVectors(n.up,new d.Vector3(0,1,0)),L=E.clone().invert(),V=new d.Vector3,ie=new d.Quaternion,be=new d.Vector3,de=2*Math.PI;return function(Tt=null){const we=e.object.position;o.copy(we).sub(e.target),o.applyQuaternion(E),l.setFromVector3(o),e.autoRotate&&s===r.NONE&&z(y(Tt)),e.enableDamping?(l.theta+=u.theta*e.dampingFactor,l.phi+=u.phi*e.dampingFactor):(l.theta+=u.theta,l.phi+=u.phi);let he=e.minAzimuthAngle,pe=e.maxAzimuthAngle;isFinite(he)&&isFinite(pe)&&(he<-Math.PI?he+=de:he>Math.PI&&(he-=de),pe<-Math.PI?pe+=de:pe>Math.PI&&(pe-=de),he<=pe?l.theta=Math.max(he,Math.min(pe,l.theta)):l.theta=l.theta>(he+pe)/2?Math.max(he,l.theta):Math.min(pe,l.theta)),l.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,l.phi)),l.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(b,e.dampingFactor):e.target.add(b),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&ae||e.object.isOrthographicCamera?l.radius=q(l.radius):l.radius=q(l.radius*m),o.setFromSpherical(l),o.applyQuaternion(L),we.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(u.theta*=1-e.dampingFactor,u.phi*=1-e.dampingFactor,b.multiplyScalar(1-e.dampingFactor)):(u.set(0,0,0),b.set(0,0,0));let We=!1;if(e.zoomToCursor&&ae){let Ve=null;if(e.object.isPerspectiveCamera){const Re=o.length();Ve=q(Re*m);const Ke=Re-Ve;e.object.position.addScaledVector(fe,Ke),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const Re=new d.Vector3(ue.x,ue.y,0);Re.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),We=!0;const Ke=new d.Vector3(ue.x,ue.y,0);Ke.unproject(e.object),e.object.position.sub(Ke).add(Re),e.object.updateMatrixWorld(),Ve=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;Ve!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(Ve).add(e.object.position):(dt.origin.copy(e.object.position),dt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(dt.direction))<ha?n.lookAt(e.target):(mn.setFromNormalAndCoplanarPoint(e.object.up,e.target),dt.intersectPlane(mn,e.target))))}else e.object.isOrthographicCamera&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),We=!0);return m=1,ae=!1,We||V.distanceToSquared(e.object.position)>f||8*(1-ie.dot(e.object.quaternion))>f||be.distanceToSquared(e.target)>0?(e.dispatchEvent(hn),V.copy(e.object.position),ie.copy(e.object.quaternion),be.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Me),e.domElement.removeEventListener("pointerdown",rt),e.domElement.removeEventListener("pointercancel",Fe),e.domElement.removeEventListener("wheel",wt),e.domElement.removeEventListener("pointermove",Te),e.domElement.removeEventListener("pointerup",Fe),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",st),e._domElementKeyEvents=null)};const e=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const f=1e-6,l=new d.Spherical,u=new d.Spherical;let m=1;const b=new d.Vector3,S=new d.Vector2,O=new d.Vector2,x=new d.Vector2,j=new d.Vector2,X=new d.Vector2,ce=new d.Vector2,J=new d.Vector2,T=new d.Vector2,Q=new d.Vector2,fe=new d.Vector3,ue=new d.Vector2;let ae=!1;const h=[],g={};function y(o){return o!==null?2*Math.PI/60*e.autoRotateSpeed*o:2*Math.PI/60/60*e.autoRotateSpeed}function M(o){const E=Math.abs(o)/(100*(window.devicePixelRatio|0));return Math.pow(.95,e.zoomSpeed*E)}function z(o){u.theta-=o}function Y(o){u.phi-=o}const H=function(){const o=new d.Vector3;return function(L,V){o.setFromMatrixColumn(V,0),o.multiplyScalar(-L),b.add(o)}}(),N=function(){const o=new d.Vector3;return function(L,V){e.screenSpacePanning===!0?o.setFromMatrixColumn(V,1):(o.setFromMatrixColumn(V,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(L),b.add(o)}}(),G=function(){const o=new d.Vector3;return function(L,V){const ie=e.domElement;if(e.object.isPerspectiveCamera){const be=e.object.position;o.copy(be).sub(e.target);let de=o.length();de*=Math.tan(e.object.fov/2*Math.PI/180),H(2*L*de/ie.clientHeight,e.object.matrix),N(2*V*de/ie.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(H(L*(e.object.right-e.object.left)/e.object.zoom/ie.clientWidth,e.object.matrix),N(V*(e.object.top-e.object.bottom)/e.object.zoom/ie.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function ee(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function _(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function U(o,E){if(!e.zoomToCursor)return;ae=!0;const L=e.domElement.getBoundingClientRect(),V=o-L.left,ie=E-L.top,be=L.width,de=L.height;ue.x=V/be*2-1,ue.y=-(ie/de)*2+1,fe.set(ue.x,ue.y,1).unproject(e.object).sub(e.object.position).normalize()}function q(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function me(o){S.set(o.clientX,o.clientY)}function Ie(o){U(o.clientX,o.clientX),J.set(o.clientX,o.clientY)}function nt(o){j.set(o.clientX,o.clientY)}function gt(o){O.set(o.clientX,o.clientY),x.subVectors(O,S).multiplyScalar(e.rotateSpeed);const E=e.domElement;z(2*Math.PI*x.x/E.clientHeight),Y(2*Math.PI*x.y/E.clientHeight),S.copy(O),e.update()}function Nt(o){T.set(o.clientX,o.clientY),Q.subVectors(T,J),Q.y>0?ee(M(Q.y)):Q.y<0&&_(M(Q.y)),J.copy(T),e.update()}function Ut(o){X.set(o.clientX,o.clientY),ce.subVectors(X,j).multiplyScalar(e.panSpeed),G(ce.x,ce.y),j.copy(X),e.update()}function at(o){U(o.clientX,o.clientY),o.deltaY<0?_(M(o.deltaY)):o.deltaY>0&&ee(M(o.deltaY)),e.update()}function it(o){let E=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?Y(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):G(0,e.keyPanSpeed),E=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?Y(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):G(0,-e.keyPanSpeed),E=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?z(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):G(e.keyPanSpeed,0),E=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?z(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):G(-e.keyPanSpeed,0),E=!0;break}E&&(o.preventDefault(),e.update())}function Le(o){if(h.length===1)S.set(o.pageX,o.pageY);else{const E=ve(o),L=.5*(o.pageX+E.x),V=.5*(o.pageY+E.y);S.set(L,V)}}function ze(o){if(h.length===1)j.set(o.pageX,o.pageY);else{const E=ve(o),L=.5*(o.pageX+E.x),V=.5*(o.pageY+E.y);j.set(L,V)}}function Ne(o){const E=ve(o),L=o.pageX-E.x,V=o.pageY-E.y,ie=Math.sqrt(L*L+V*V);J.set(0,ie)}function Ft(o){e.enableZoom&&Ne(o),e.enablePan&&ze(o)}function vt(o){e.enableZoom&&Ne(o),e.enableRotate&&Le(o)}function bt(o){if(h.length==1)O.set(o.pageX,o.pageY);else{const L=ve(o),V=.5*(o.pageX+L.x),ie=.5*(o.pageY+L.y);O.set(V,ie)}x.subVectors(O,S).multiplyScalar(e.rotateSpeed);const E=e.domElement;z(2*Math.PI*x.x/E.clientHeight),Y(2*Math.PI*x.y/E.clientHeight),S.copy(O)}function yt(o){if(h.length===1)X.set(o.pageX,o.pageY);else{const E=ve(o),L=.5*(o.pageX+E.x),V=.5*(o.pageY+E.y);X.set(L,V)}ce.subVectors(X,j).multiplyScalar(e.panSpeed),G(ce.x,ce.y),j.copy(X)}function Ue(o){const E=ve(o),L=o.pageX-E.x,V=o.pageY-E.y,ie=Math.sqrt(L*L+V*V);T.set(0,ie),Q.set(0,Math.pow(T.y/J.y,e.zoomSpeed)),ee(Q.y),J.copy(T);const be=(o.pageX+E.x)*.5,de=(o.pageY+E.y)*.5;U(be,de)}function Ye(o){e.enableZoom&&Ue(o),e.enablePan&&yt(o)}function Et(o){e.enableZoom&&Ue(o),e.enableRotate&&bt(o)}function rt(o){e.enabled!==!1&&(h.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",Te),e.domElement.addEventListener("pointerup",Fe)),Bt(o),o.pointerType==="touch"?St(o):Vt(o))}function Te(o){e.enabled!==!1&&(o.pointerType==="touch"?Ct(o):ot(o))}function Fe(o){Ot(o),h.length===0&&(e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",Te),e.domElement.removeEventListener("pointerup",Fe)),e.dispatchEvent(pn),s=r.NONE}function Vt(o){let E;switch(o.button){case 0:E=e.mouseButtons.LEFT;break;case 1:E=e.mouseButtons.MIDDLE;break;case 2:E=e.mouseButtons.RIGHT;break;default:E=-1}switch(E){case d.MOUSE.DOLLY:if(e.enableZoom===!1)return;Ie(o),s=r.DOLLY;break;case d.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;nt(o),s=r.PAN}else{if(e.enableRotate===!1)return;me(o),s=r.ROTATE}break;case d.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;me(o),s=r.ROTATE}else{if(e.enablePan===!1)return;nt(o),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Lt)}function ot(o){switch(s){case r.ROTATE:if(e.enableRotate===!1)return;gt(o);break;case r.DOLLY:if(e.enableZoom===!1)return;Nt(o);break;case r.PAN:if(e.enablePan===!1)return;Ut(o);break}}function wt(o){e.enabled===!1||e.enableZoom===!1||s!==r.NONE||(o.preventDefault(),e.dispatchEvent(Lt),at(o),e.dispatchEvent(pn))}function st(o){e.enabled===!1||e.enablePan===!1||it(o)}function St(o){switch(ct(o),h.length){case 1:switch(e.touches.ONE){case d.TOUCH.ROTATE:if(e.enableRotate===!1)return;Le(o),s=r.TOUCH_ROTATE;break;case d.TOUCH.PAN:if(e.enablePan===!1)return;ze(o),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(e.touches.TWO){case d.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ft(o),s=r.TOUCH_DOLLY_PAN;break;case d.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;vt(o),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Lt)}function Ct(o){switch(ct(o),s){case r.TOUCH_ROTATE:if(e.enableRotate===!1)return;bt(o),e.update();break;case r.TOUCH_PAN:if(e.enablePan===!1)return;yt(o),e.update();break;case r.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ye(o),e.update();break;case r.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Et(o),e.update();break;default:s=r.NONE}}function Me(o){e.enabled!==!1&&o.preventDefault()}function Bt(o){h.push(o.pointerId)}function Ot(o){delete g[o.pointerId];for(let E=0;E<h.length;E++)if(h[E]==o.pointerId){h.splice(E,1);return}}function ct(o){let E=g[o.pointerId];E===void 0&&(E=new d.Vector2,g[o.pointerId]=E),E.set(o.pageX,o.pageY)}function ve(o){const E=o.pointerId===h[0]?h[1]:h[0];return g[E]}e.domElement.addEventListener("contextmenu",Me),e.domElement.addEventListener("pointerdown",rt),e.domElement.addEventListener("pointercancel",Fe),e.domElement.addEventListener("wheel",wt,{passive:!1}),this.update()}}const ft=t=>{const[n,a]=R.useState(t.options[t.index]),e=()=>{t.onToggle(!t.open)},r=s=>{s!==n&&(t.onSelect(s),a(s)),t.onToggle(!1)};return c.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[c.jsx("div",{className:"dropdown-toggle",onClick:e,children:n}),t.open&&c.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>c.jsx("li",{onClick:()=>r(s),children:s},s))})]})},_e=R.forwardRef(function(n,a){const[e,r]=R.useState(!1),s=n.options.indexOf(n.camera.name);return c.jsxs("div",{className:"CameraWindow",children:[c.jsx("div",{ref:a,className:"clickable",onClick:()=>{e&&r(!1)}}),c.jsx(ft,{index:s,open:e,options:n.options,onSelect:n.onSelect,onToggle:f=>{r(f)},up:!0})]})}),gn=["Single","Side by Side","Stacked","Quad"],ne=new Map,oe=new Map,ye=new Map;function ke(t,n){const a=new d.OrthographicCamera(-100,100,100,-100,50,3e3);return a.name=t,a.position.copy(n),a.lookAt(0,0,0),ne.set(t,a),a}ke("Top",new d.Vector3(0,1e3,0)),ke("Bottom",new d.Vector3(0,-1e3,0)),ke("Left",new d.Vector3(-1e3,0,0)),ke("Right",new d.Vector3(1e3,0,0)),ke("Front",new d.Vector3(0,0,1e3)),ke("Back",new d.Vector3(0,0,-1e3)),ke("Orthographic",new d.Vector3(1e3,1e3,1e3));const ht=new d.PerspectiveCamera(60,1,50,3e3);ht.name="Debug",ht.position.set(500,500,500),ht.lookAt(0,0,0),ne.set("Debug",ht);const vn=["Renderer","Depth","Normals","UVs","Wireframe"],ma=new d.MeshDepthMaterial,ga=new d.MeshNormalMaterial,va=new on,ba=new d.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),ka="";let pt="Renderer";const W=new d.Scene;W.name="Debug Scene";let Ee=new d.Scene;W.add(Ee);const et=new d.Group;et.name="helpers",W.add(et);const ya=new rn;et.add(ya);const bn=new d.AxesHelper(500);bn.name="axisHelper",et.add(bn);const tt=new d.AxesHelper(100);tt.name="interactionHelper",et.add(tt),tt.visible=!1;let mt=!1,K=ne.get("Debug"),se=ne.get("Orthographic"),De=ne.get("Front"),Ae=ne.get("Top"),yn=!1;function Ea(t){const[n,a]=R.useState(t.mode!==void 0?t.mode:"Single"),[e,r]=R.useState(null),[s,f]=R.useState(!1),[l,u]=R.useState(!1),[m,b]=R.useState(!1),[,S]=R.useState(Date.now()),O=R.useRef(null),x=R.useRef(null),j=R.useRef(null),X=R.useRef(null),ce=R.useRef(null),J=R.useRef(null),T=(h,g)=>{const y=oe.get(h.name);y!==void 0&&y.dispose(),oe.delete(h.name);const M=ye.get(h.name);M!==void 0&&(W.remove(M),M.dispose()),ye.delete(h.name);const z=new pa(h,g);switch(z.enableDamping=!0,z.dampingFactor=.05,h.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":z.enableRotate=!1;break}if(oe.set(h.name,z),h instanceof d.PerspectiveCamera){const Y=new d.CameraHelper(h);ye.set(h.name,Y),W.add(Y)}},Q=h=>{const g=ye.get(h.name);g!==void 0&&(W.remove(g),g.dispose(),ye.delete(h.name));const y=oe.get(h.name);y!==void 0&&(y.dispose(),oe.delete(h.name))},fe=()=>{oe.forEach((h,g)=>{h.dispose();const y=ye.get(g);y!==void 0&&(W.remove(y),y.dispose()),ye.delete(g),oe.delete(g)}),oe.clear(),ye.clear()},ue=()=>{switch(n){case"Single":T(K,j.current);break;case"Side by Side":case"Stacked":T(K,j.current),T(se,X.current);break;case"Quad":T(K,j.current),T(se,X.current),T(De,ce.current),T(Ae,J.current);break}};R.useEffect(()=>{const h=new d.WebGLRenderer({canvas:O.current,stencil:!1});h.autoClear=!1,h.shadowMap.enabled=!0,h.setPixelRatio(devicePixelRatio),h.setClearColor(0),r(h)},[]),R.useEffect(()=>{const h=M=>{Rt(Ee),W.remove(Ee);const z=t.scenes.get(M.value.name);if(z!==void 0){const Y=new z;t.onSceneSet!==void 0&&t.onSceneSet(Y),Ee=Y,t.three.scene=Ee,W.add(Ee),yn=!0}},g=M=>{var H;const z=M.value,Y=(H=t.three.scene)==null?void 0:H.getObjectByProperty("uuid",z.uuid);Y!==void 0&&ne.set(z.name,Y),S(Date.now())},y=M=>{ne.delete(M.value.name),S(Date.now())};return D.addEventListener(A.SET_SCENE,h),D.addEventListener(A.ADD_CAMERA,g),D.addEventListener(A.REMOVE_CAMERA,y),()=>{D.removeEventListener(A.SET_SCENE,h),D.removeEventListener(A.ADD_CAMERA,g),D.removeEventListener(A.REMOVE_CAMERA,y)}},[]),R.useEffect(()=>{if(e===null)return;let h=window.innerWidth,g=window.innerHeight,y=Math.floor(h/2),M=Math.floor(g/2),z=-1;const Y=()=>{h=window.innerWidth-300,g=window.innerHeight,y=Math.floor(h/2),M=Math.floor(g/2),e.setSize(h,g);let _=h,U=g;switch(n){case"Side by Side":_=y,U=g;break;case"Stacked":_=h,U=M;break;case"Quad":_=y,U=M;break}ne.forEach(q=>{var me;q instanceof d.OrthographicCamera?(q.left=_/-2,q.right=_/2,q.top=U/2,q.bottom=U/-2,q.updateProjectionMatrix()):q instanceof d.PerspectiveCamera&&(q.aspect=_/U,q.updateProjectionMatrix(),(me=ye.get(q.name))==null||me.update())})},H=()=>{e.setViewport(0,0,h,g),e.setScissor(0,0,h,g),e.render(W,K)},N=()=>{if(n==="Side by Side")e.setViewport(0,0,y,g),e.setScissor(0,0,y,g),e.render(W,K),e.setViewport(y,0,y,g),e.setScissor(y,0,y,g),e.render(W,se);else{const _=g-M;e.setViewport(0,_,h,M),e.setScissor(0,_,h,M),e.render(W,K),e.setViewport(0,0,h,M),e.setScissor(0,0,h,M),e.render(W,se)}},G=()=>{let _=0,U=0;U=g-M,_=0,e.setViewport(_,U,y,M),e.setScissor(_,U,y,M),e.render(W,K),_=y,e.setViewport(_,U,y,M),e.setScissor(_,U,y,M),e.render(W,se),U=0,_=0,e.setViewport(_,U,y,M),e.setScissor(_,U,y,M),e.render(W,De),_=y,e.setViewport(_,U,y,M),e.setScissor(_,U,y,M),e.render(W,Ae)},ee=()=>{switch(oe.forEach(_=>{_.update()}),t.onSceneUpdate!==void 0&&yn&&t.onSceneUpdate(Ee),e.clear(),n){case"Single":H();break;case"Side by Side":case"Stacked":N();break;case"Quad":G();break}z=requestAnimationFrame(ee)};return ue(),window.addEventListener("resize",Y),Y(),ee(),()=>{window.removeEventListener("resize",Y),cancelAnimationFrame(z),z=-1}},[n,e]),R.useEffect(()=>{if(e!==null){const h=new d.Raycaster,g=new d.Vector2,y=(H,N,G,ee)=>{switch(n){case"Quad":H<G?N<ee?h.setFromCamera(g,K):h.setFromCamera(g,De):N<ee?h.setFromCamera(g,se):h.setFromCamera(g,Ae);break;case"Side by Side":H<G?h.setFromCamera(g,K):h.setFromCamera(g,se);break;case"Single":h.setFromCamera(g,K);break;case"Stacked":N<ee?h.setFromCamera(g,K):h.setFromCamera(g,se);break}},M=H=>{if(!mt)return;const N=new d.Vector2;e.getSize(N);const G=Math.min(H.clientX,N.x),ee=Math.min(H.clientY,N.y);g.x=He(G,0,N.x,-1,1),g.y=He(ee,0,N.y,1,-1);const _=N.x/2,U=N.y/2,q=()=>{G<_?g.x=He(G,0,_,-1,1):g.x=He(G,_,N.x,-1,1)},me=()=>{ee<U?g.y=He(ee,0,U,1,-1):g.y=He(ee,U,N.y,1,-1)};switch(n){case"Quad":q(),me();break;case"Side by Side":q();break;case"Stacked":me(),me();break}y(G,ee,_,U);const Ie=h.intersectObjects(Ee.children);Ie.length>0&&tt.position.copy(Ie[0].point)},z=H=>{if(!mt)return;const N=new d.Vector2;if(e.getSize(N),H.clientX>=N.x)return;M(H);const G=h.intersectObjects(Ee.children);G.length>0&&t.three.getObject(G[0].object.uuid)},Y=x.current;return Y.addEventListener("mousemove",M,!1),Y.addEventListener("click",z,!1),()=>{Y.removeEventListener("mousemove",M),Y.removeEventListener("click",z)}}},[n,e]);const ae=[];return ne.forEach((h,g)=>{ae.push(g)}),c.jsxs("div",{className:"multiview",children:[c.jsx("canvas",{ref:O}),c.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,ref:x,children:[n==="Single"&&c.jsx(c.Fragment,{children:c.jsx(_e,{camera:K,options:ae,ref:j,onSelect:h=>{var y;(y=oe.get(K.name))==null||y.dispose();const g=ne.get(h);g!==void 0&&(Q(K),K=g,T(g,j.current))}})}),(n==="Side by Side"||n==="Stacked")&&c.jsxs(c.Fragment,{children:[c.jsx(_e,{camera:K,options:ae,ref:j,onSelect:h=>{var y;(y=oe.get(K.name))==null||y.dispose();const g=ne.get(h);g!==void 0&&(Q(K),K=g,T(g,j.current))}}),c.jsx(_e,{camera:se,options:ae,ref:X,onSelect:h=>{var y;(y=oe.get(se.name))==null||y.dispose();const g=ne.get(h);g!==void 0&&(Q(se),se=g,T(g,X.current))}})]}),n==="Quad"&&c.jsxs(c.Fragment,{children:[c.jsx(_e,{camera:K,options:ae,ref:j,onSelect:h=>{var y;(y=oe.get(K.name))==null||y.dispose();const g=ne.get(h);g!==void 0&&(Q(K),K=g,T(g,j.current))}}),c.jsx(_e,{camera:se,options:ae,ref:X,onSelect:h=>{var y;(y=oe.get(se.name))==null||y.dispose();const g=ne.get(h);g!==void 0&&(Q(se),se=g,T(g,X.current))}}),c.jsx(_e,{camera:De,options:ae,ref:ce,onSelect:h=>{var y;(y=oe.get(De.name))==null||y.dispose();const g=ne.get(h);g!==void 0&&(Q(De),De=g,T(g,ce.current))}}),c.jsx(_e,{camera:Ae,options:ae,ref:J,onSelect:h=>{var y;(y=oe.get(Ae.name))==null||y.dispose();const g=ne.get(h);g!==void 0&&(Q(Ae),Ae=g,T(g,J.current))}})]})]}),c.jsxs("div",{className:"settings",children:[c.jsx(ft,{index:gn.indexOf(n),options:gn,onSelect:h=>{h!==n&&(fe(),a(h))},open:s,onToggle:h=>{f(h),l&&u(!1),m&&b(!1)}}),c.jsx(ft,{index:vn.indexOf(pt),options:vn,onSelect:h=>{if(h!==pt)switch(pt=h,pt){case"Depth":W.overrideMaterial=ma;break;case"Normals":W.overrideMaterial=ga;break;default:case"Renderer":W.overrideMaterial=null;break;case"Wireframe":W.overrideMaterial=ba;break;case"UVs":W.overrideMaterial=va;break}},open:l,onToggle:h=>{s&&f(!1),u(h),m&&b(!1)}}),c.jsx(ft,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:h=>{mt=h==="Selection Mode",tt.visible=mt},open:m,onToggle:h=>{s&&f(!1),l&&u(!1),b(h)}})]})]})}const Da="";function wa(t){return c.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[c.jsx("header",{children:t.header}),t.children,c.jsx("footer",{children:t.footer})]})}w.Accordion=ut,w.Application=_n,w.BaseRemote=Je,w.ChildObject=At,w.ContainerObject=sn,w.Draggable=tn,w.DraggableItem=en,w.Dropdown=nn,w.DropdownItem=an,w.Editor=wa,w.InfiniteGridHelper=rn,w.Inspector=fn,w.MultiView=Ea,w.NavButton=Dt,w.RemoteComponents=Xt,w.RemoteController=Wn,w.RemoteTheatre=Oe,w.RemoteThree=Qt,w.RemoteTweakpane=_t,w.SceneInspector=fa,w.SidePanel=da,w.ToolEvents=A,w.UVMaterial=on,w.clamp=Rn,w.colorToHex=Yt,w.debugDispatcher=D,w.dispose=Rt,w.disposeMaterial=Kt,w.disposeTexture=jn,w.distance=Pn,w.hierarchyUUID=Mt,w.isColor=zt,w.randomID=Gt,w.resetThreeObjects=Wt,w.round=lt,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
143
|
+
}`;class on extends d.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:Jn,fragmentShader:Qn})}}const ja="";function ut(t){const[n,a]=j.useState(t.open!==void 0?t.open:!0),e=!n||t.children===void 0;return l.jsxs("div",{className:`accordion ${e?"hide":""}`,children:[l.jsxs("button",{className:"toggle",onClick:()=>{const r=!n;t.onToggle!==void 0&&t.onToggle(r),a(r)},children:[l.jsx("p",{className:`status ${n?"open":""}`,children:"Toggle"}),l.jsx("p",{className:"label",children:t.label})]}),t.button,l.jsx("div",{className:n?"open":"",children:l.jsx("div",{children:t.children})})]})}function At(t){const[n,a]=j.useState(!1),e=t.child.children.length>0,r=[];return t.child.children.length>0&&t.child.children.map(s=>{r.push(l.jsx(At,{child:s,three:t.three},Math.random()))}),l.jsxs("div",{className:"childObject",children:[l.jsxs("div",{className:"child",children:[e?l.jsx("button",{className:"status",style:{backgroundPositionX:n?"-14px":"2px"},onClick:()=>{a(!n)}}):null,l.jsx("button",{className:"name",style:{left:e?"20px":"5px"},onClick:()=>{t.three.getObject(t.child.uuid)},children:t.child.name.length>0?`${t.child.name} (${t.child.type})`:`${t.child.type}::${t.child.uuid}`}),l.jsx("div",{className:`icon ${Ln(t.child)}`})]}),l.jsx("div",{className:n?"open":"",children:l.jsx("div",{className:"container",children:r})})]},Math.random())}function sn(t){const n=[];return t.child.children.map(a=>{n.push(l.jsx(At,{child:a,three:t.three},Math.random()))}),l.jsx("div",{className:`scene ${t.class!==void 0?t.class:""}`,children:n})}const _a="",qn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA5klEQVRoge2Y0Q6EIAwE6cX//+X6cCFpSMEKVTdk501OpRNKiyelFC0b8Ps6gCwoggZF0KAIGhRBgyJoUAQNiqCxjciR9SLV//eZiAyvK3U8i/QVaQO2YyLSFVvlkdTKDjJCukh2ykR5ZEW+kHmlatl90RaBtDkK/w7CYhuRUEO0ee3l+J3m55Vm+17vtwjTnV1V3QA8qfbeUXCzRWDpiLLS+OyzvRW7IzW9R+okvclsqR09743bo0yUpc1+lSJvNsa002+Euk9GKzV7SmZDRIMiaFAEDYqgQRE0KIIGRdCgCBoUQeMEMERadX7YUz8AAAAASUVORK5CYII=";function $n(t){return"items"in t}function Pe(t){const n=[];return t.items.forEach(a=>{$n(a)?n.push(l.jsx(Pe,{title:a.title,items:a.items},Math.random())):n.push(l.jsx($e,{title:a.title,prop:a.prop,value:a.value,type:a.type,min:a.min,max:a.max,step:a.step,disabled:a.disabled,onChange:(e,r)=>{a.onChange!==void 0&&a.onChange(e,r)}},Math.random()))}),l.jsx(ut,{label:t.title,open:t.expanded===!0,children:n})}function ea(t){return!(t==="alphaHash"||t==="alphaToCoverage"||t==="attenuationDistance"||t==="colorWrite"||t==="combine"||t==="defaultAttributeValues"||t==="depthFunc"||t==="forceSinglePass"||t==="glslVersion"||t==="linecap"||t==="linejoin"||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 je(t){switch(t){case"alphaMap":return"Alpha Map";case"anisotropyMap":return"Anisotropy Map";case"anisotropyRotation":return"Anisotropy Rotation";case"aoMap":return"AO Map";case"aoMapIntensity":return"AO Map Intensity";case"attenuationColor":return"Attenuation Color";case"bumpMap":return"Bump Map";case"bumpScale":return"Bump Scale";case"clearcoatMap":return"Clearcoat Map";case"clearcoatNormalMap":return"Clearcoat Normal Map";case"clearcoatNormalScale":return"Clearcoat Normal Scale";case"clearcoatRoughness":return"Clearcoat Roughness";case"clearcoatRoughnessMap":return"Clearcoat Roughness Map";case"color":return"Color";case"defines":return"Defines";case"depthTest":return"Depth Test";case"depthWrite":return"Depth Write";case"displacementBias":return"Displacement Bias";case"displacementMap":return"Displacement Map";case"displacementScale":return"Displacement Scale";case"dithering":return"Dithering";case"emissive":return"Emissive";case"emissiveMap":return"Emissive Map";case"emissiveIntensity":return"Emissive Intensity";case"envMap":return"Environment Map";case"envMapIntensity":return"Environment Map Intensity";case"extensions":return"Extensions";case"flatShading":return"Flat Shading";case"fragmentShader":return"Fragment Shader";case"fog":return"Fog";case"gradientMap":return"Gradient Map";case"ior":return"IOR";case"iridescenceIOR":return"Iridescence IOR";case"iridescenceMap":return"Iridescence Map";case"iridescenceThicknessMap":return"Iridescence Thickness Map";case"iridescenceThicknessRange":return"Iridescence Thickness Range";case"lights":return"Lights";case"lightMap":return"Light Map";case"lightMapIntensity":return"Light Map Intensity";case"map":return"Map";case"matcap":return"Matcap";case"metalness":return"Metalness";case"metalnessMap":return"Metalness Map";case"name":return"Name";case"normalMap":return"Normal Map";case"normalScale":return"Normal Scale";case"opacity":return"Opacity";case"reflectivity":return"Reflectivity";case"refractionRatio":return"Refraction Ratio";case"roughness":return"Roughness";case"roughnessMap":return"Roughness Map";case"sheenColor":return"Sheen Color";case"sheenColorMap":return"Sheen Color Map";case"sheenRoughness":return"Sheen Roughness";case"sheenRoughnessMap":return"Sheen Roughness Map";case"shininess":return"Shininess";case"size":return"Size";case"sizeAttenuation":return"Size Attenuation";case"specular":return"Specular";case"specularColor":return"Specular Color";case"specularColorMap":return"Specular Color Map";case"specularIntensity":return"Specular Intensity";case"specularIntensityMap":return"Specular Map Intensity";case"thickness":return"Thickness";case"thicknessMap":return"Thickness Map";case"transmission":return"Transmission";case"transmissionMap":return"Transmission Map";case"transparent":return"Transparent";case"type":return"Type";case"uuid":return"UUID";case"uniforms":return"Uniforms";case"vertexShader":return"Vertex Shader";case"visible":return"Visible";case"wireframe":return"Wireframe"}return t}function ta(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 na(){const t=document.createElement("input");return t.type="file",new Promise((n,a)=>{t.addEventListener("change",function(){if(t.files===null)a();else{const e=t.files[0],r=new FileReader;r.onload=function(s){n(s.target.result)},r.readAsDataURL(e)}}),t.click()})}function cn(t,n,a){const e=[];for(const r in t){if(!ea(r))continue;const s=typeof t[r],f=t[r];if(s==="boolean"||s==="number"||s==="string"){const c={title:je(r),prop:r,type:s,value:f,min:void 0,max:void 0,onChange:(u,m)=>{var g;a.updateObject(n.uuid,`material.${u}`,m),s==="boolean"&&a.updateObject(n.uuid,"material.needsUpdate",!0);const y=(g=a.scene)==null?void 0:g.getObjectByProperty("uuid",n.uuid);y!==void 0&&q(y,`material.${u}`,m)}};ta(r)&&(c.value=Number(f),c.type="range",c.min=0,c.max=1,c.step=.01),e.push(c)}else if(s==="object")if(f.isColor)e.push({title:je(r),prop:r,type:"color",value:f,onChange:(c,u)=>{var g;const m=new d.Color(u);a.updateObject(n.uuid,`material.${c}`,m);const y=(g=a.scene)==null?void 0:g.getObjectByProperty("uuid",n.uuid);y!==void 0&&q(y,`material.${c}`,m)}});else if(Array.isArray(f)){const c=[];for(const u in f)c.push({title:`${u}`,type:`${typeof f[u]}`,value:f[u],onChange:(m,y)=>{var C;a.updateObject(n.uuid,`material.${r}`,y);const g=(C=a.scene)==null?void 0:C.getObjectByProperty("uuid",n.uuid);g!==void 0&&q(g,`material.${r}`,y)}});e.push({title:je(r),items:c})}else{const c=[];for(const u in f){const m=f[u];switch(typeof m){case"boolean":case"number":case"string":u==="src"?e.push({title:je(r),type:"image",value:m,onChange:(g,C)=>{var M;a.createTexture(n.uuid,`material.${r}`,C);const x=(M=a.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&jt(C).then(P=>{q(x,`material.${r}`,P),q(x,"material.needsUpdate",!0)})}}):c.push({title:`${je(u)}`,prop:`material.${r}.${u}`,type:`${typeof t[r][u]}`,value:f[u],onChange:(g,C)=>{var M;a.updateObject(n.uuid,`material.${r}.${u}`,C);const x=(M=a.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&q(x,`material.${r}.${u}`,C)}});break;case"object":if(m.value!==void 0&&m.value.src!==void 0)c.push({title:je(u),type:"image",value:m.value.src,onChange:(g,C)=>{var M;a.createTexture(n.uuid,`material.${r}.${u}.value`,f);const x=(M=a.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&jt(C).then(P=>{q(x,`material.${r}.${u}.value`,P)})}});else if(r==="uniforms"){const g=m.value,C=(x,M,P)=>({title:x,type:"number",value:P,onChange:(Q,U)=>{var le;const O=`material.uniforms.${u}.value.${M}`;a.updateObject(n.uuid,O,U);const J=(le=a.scene)==null?void 0:le.getObjectByProperty("uuid",n.uuid);J!==void 0&&q(J,O,U)}});if(typeof m.value=="number")c.push({title:u,type:"number",value:m.value,onChange:(x,M)=>{var U;const P=`material.${r}.${x}.value`;a.updateObject(n.uuid,P,M);const Q=(U=a.scene)==null?void 0:U.getObjectByProperty("uuid",n.uuid);Q!==void 0&&q(Q,P,M)}});else if(g.r!==void 0&&g.g!==void 0&&g.b!==void 0)c.push({title:u,type:"color",value:m.value,onChange:(x,M)=>{var O;const P=new d.Color(M),Q=`material.${r}.${x}.value`;a.updateObject(n.uuid,Q,P);const U=(O=a.scene)==null?void 0:O.getObjectByProperty("uuid",n.uuid);U!==void 0&&q(U,Q,P)}});else if(g.x!==void 0&&g.y!==void 0&&g.z===void 0&&g.w===void 0)c.push({title:u,items:[C("X","x",m.value.x),C("Y","y",m.value.y)]});else if(g.x!==void 0&&g.y!==void 0&&g.z!==void 0&&g.w===void 0)c.push({title:u,items:[C("X","x",m.value.x),C("Y","y",m.value.y),C("Z","z",m.value.z)]});else if(g.x!==void 0&&g.y!==void 0&&g.z!==void 0&&g.w!==void 0)c.push({title:u,items:[C("X","x",m.value.x),C("Y","y",m.value.y),C("Z","z",m.value.z),C("W","w",m.value.w)]});else if(g.elements!==void 0){const x=g.elements,M=[];for(let P=0;P<x.length;P++)M.push(C(P.toString(),P.toString(),x[P]));c.push({title:u,items:M})}else console.log(">>> need to add this format:",u,g)}else c.push({title:u,type:`${typeof m.value}`,value:m.value,onChange:(g,C)=>{var M;a.updateObject(n.uuid,`material.${r}.${u}.value`,C);const x=(M=a.scene)==null?void 0:M.getObjectByProperty("uuid",n.uuid);x!==void 0&&q(x,`material.${r}.${u}.value`,C)}});break}}c.length>0&&e.push({title:je(r),items:c})}else f!==void 0&&console.log("other:",r,s,f)}return e.sort((r,s)=>r.title<s.title?-1:r.title>s.title?1:0),e.push({title:"Update Material",type:"button",onChange:()=>{a.updateObject(n.uuid,"material.needsUpdate",!0)}}),e}function aa(t,n){const a=t.material;if(Array.isArray(a)){const e=[],r=a.length;for(let s=0;s<r;s++)e.push(l.jsx(Pe,{title:`Material ${s}`,items:cn(a[s],t,n)},`Material ${s}`));return l.jsx(l.Fragment,{children:e})}else return l.jsx(Pe,{title:"Material",items:cn(a,t,n)})}function $e(t){let n=t.value;n!==void 0&&n.isColor!==void 0&&(n=Yt(t.value));const[a,e]=j.useState(n),r=j.useRef(null),s=j.useRef(null),f=j.useRef(null);j.useEffect(()=>{var J;let y=!1,g=-1,C=0,x=Number(a);const M=le=>{y=!0,C=x,g=le.clientX},P=le=>{if(!y)return;const de=t.step!==void 0?t.step:1,ie=(le.clientX-g)*de;x=Number((C+ie).toFixed(4)),s.current!==null&&(s.current.value=x.toString()),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,x)},Q=()=>{y=!1},U=()=>{y=!1},O=t.type==="number";return O&&((J=r.current)==null||J.addEventListener("mousedown",M,!1),document.addEventListener("mouseup",Q,!1),document.addEventListener("mousemove",P,!1),document.addEventListener("contextmenu",U,!1)),()=>{var le;O&&((le=r.current)==null||le.removeEventListener("mousedown",M),document.removeEventListener("mouseup",Q),document.removeEventListener("mousemove",P),document.removeEventListener("contextmenu",U))}},[a]);const c=t.type==="string"&&(a.length>100||a.search(`
|
144
|
+
`)>-1),u=c||t.type==="image",m=y=>{let g=y.target.value;t.type==="boolean"&&(g=y.target.checked),e(g),t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,g)};return l.jsxs("div",{className:`field ${u?"block":""}`,children:[t.type!=="button"&&l.jsx("label",{ref:r,children:t.title},"fieldLabel"),t.type==="string"&&!c&&l.jsx("input",{type:"text",disabled:t.disabled,onChange:m,value:a}),t.type==="string"&&c&&l.jsx("textarea",{cols:50,rows:10,disabled:!0,onChange:m,value:a}),t.type==="boolean"&&l.jsx("input",{type:"checkbox",disabled:t.disabled,onChange:m,checked:a}),t.type==="number"&&l.jsx("input",{ref:s,type:"number",value:a,min:t.min,max:t.max,step:t.step,onChange:m}),t.type==="range"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:m,className:"min"}),l.jsx("input",{disabled:t.disabled,type:"range",value:a,min:t.min,max:t.max,step:t.step,onChange:m})]}),t.type==="color"&&l.jsxs(l.Fragment,{children:[l.jsx("input",{type:"text",value:a.toString(),onChange:m,className:"color"}),l.jsx("input",{type:"color",value:a,onChange:m})]}),t.type==="button"&&l.jsx("button",{onClick:()=>{t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,!0)},children:t.title}),t.type==="image"&&l.jsx("img",{ref:f,onClick:()=>{na().then(y=>{f.current.src=y,t.onChange!==void 0&&t.onChange(t.prop!==void 0?t.prop:t.title,y)})},src:a.length>0?a:qn})]})}function ln(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 ia(t,n){const a=[];if(t.perspectiveCameraInfo!==void 0)for(const e in t.perspectiveCameraInfo)a.push({title:ln(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var c;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const f=(c=n.scene)==null?void 0:c.getObjectByProperty("uuid",t.uuid);f!==void 0&&(q(f,r,s),f.updateProjectionMatrix())}});else if(t.orthographicCameraInfo!==void 0)for(const e in t.orthographicCameraInfo)a.push({title:ln(e),prop:e,type:"number",step:.01,value:t.perspectiveCameraInfo[e],onChange:(r,s)=>{var c;n.updateObject(t.uuid,r,s),n.requestMethod(t.uuid,"updateProjectionMatrix");const f=(c=n.scene)==null?void 0:c.getObjectByProperty("uuid",t.uuid);f!==void 0&&(q(f,r,s),f.updateProjectionMatrix())}});return l.jsx(Pe,{title:"Camera",items:a})}const ra=Math.PI/180,oa=180/Math.PI;function He(t,n,a,e,r){return e+(t-n)*(r-e)/(a-n)}function sa(t){return t*ra}function It(t){return t*oa}function ca(t,n){const a=new d.Matrix4;a.elements=t.matrix;const e=new d.Vector3,r=new d.Euler,s=new d.Vector3;t.uuid.length>0&&(e.setFromMatrixPosition(a),r.setFromRotationMatrix(a),s.setFromMatrixScale(a));const f=(u,m)=>{var g;n.updateObject(t.uuid,u,m);const y=(g=n.scene)==null?void 0:g.getObjectByProperty("uuid",t.uuid);y!==void 0&&q(y,u,m)},c=(u,m)=>{f(u,sa(m))};return l.jsx(Pe,{title:"Transform",items:[{title:"Position X",prop:"position.x",type:"number",value:e.x,onChange:f},{title:"Position Y",prop:"position.y",type:"number",value:e.y,onChange:f},{title:"Position Z",prop:"position.z",type:"number",value:e.z,onChange:f},{title:"Rotation X",prop:"rotation.x",type:"number",value:lt(It(r.x)),min:-360,max:360,step:.1,onChange:c},{title:"Rotation Y",prop:"rotation.y",type:"number",value:lt(It(r.y)),min:-360,max:360,step:.1,onChange:c},{title:"Rotation Z",prop:"rotation.z",type:"number",value:lt(It(r.z)),min:-360,max:360,step:.1,onChange:c},{title:"Scale X",prop:"scale.x",type:"number",value:s.x,step:.01,onChange:f},{title:"Scale Y",prop:"scale.y",type:"number",value:s.y,step:.01,onChange:f},{title:"Scale Z",prop:"scale.z",type:"number",value:s.z,step:.01,onChange:f}]})}function un(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 la(t,n){const a=[];if(t.lightInfo!==void 0)for(const e in t.lightInfo){const r=t.lightInfo[e];r!==void 0&&(r.isColor!==void 0?a.push({title:un(e),prop:e,type:"color",value:r,onChange:(s,f)=>{var m;const c=new d.Color(f);n.updateObject(t.uuid,s,c);const u=(m=n.scene)==null?void 0:m.getObjectByProperty("uuid",t.uuid);u!==void 0&&q(u,s,c)}}):a.push({title:un(e),prop:e,type:typeof r,value:r,step:typeof r=="number"?.01:void 0,onChange:(s,f)=>{var u;n.updateObject(t.uuid,s,f);const c=(u=n.scene)==null?void 0:u.getObjectByProperty("uuid",t.uuid);c!==void 0&&q(c,s,f)}}))}return l.jsx(Pe,{title:"Light",items:a})}function ua(t,n){const a=[];return t.animations.forEach(e=>{a.push({title:"Name",type:"string",prop:"name",value:e.name,disabled:!0,onChange:(r,s)=>{var c;n.updateObject(t.uuid,r,s);const f=(c=n.scene)==null?void 0:c.getObjectByProperty("uuid",t.uuid);f!==void 0&&q(f,r,s)}}),a.push({title:"Duration",type:"number",prop:"duration",value:e.duration,disabled:!0,onChange:(r,s)=>{var c;n.updateObject(t.uuid,r,s);const f=(c=n.scene)==null?void 0:c.getObjectByProperty("uuid",t.uuid);f!==void 0&&q(f,r,s)}}),a.push({title:"Blend Mode",type:"number",prop:"blendMode",value:e.blendMode,disabled:!0,onChange:(r,s)=>{var c;n.updateObject(t.uuid,r,s);const f=(c=n.scene)==null?void 0:c.getObjectByProperty("uuid",t.uuid);f!==void 0&&q(f,r,s)}})}),l.jsx(Pe,{title:"Animations",items:a})}const dn={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0};let oe={...dn};function fn(t){const[n,a]=j.useState(-1);j.useEffect(()=>{function s(c){oe={...c.value},a(Date.now())}function f(){oe={...dn},a(Date.now())}return A.addEventListener(I.SET_SCENE,f),A.addEventListener(I.SET_OBJECT,s),()=>{A.removeEventListener(I.SET_SCENE,f),A.removeEventListener(I.SET_OBJECT,s)}},[]);const e=oe.type.toLowerCase(),r=e.search("mesh")>-1||e.search("line")>-1||e.search("points")>-1;return l.jsx(ut,{label:"Inspector",children:l.jsx("div",{id:"Inspector",className:t.class,children:oe.uuid.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(l.Fragment,{children:[l.jsx($e,{type:"string",title:"Name",prop:"name",value:oe.name,disabled:!0}),l.jsx($e,{type:"string",title:"Type",prop:"type",value:oe.type,disabled:!0}),l.jsx($e,{type:"string",title:"UUID",prop:"uuid",value:oe.uuid,disabled:!0}),l.jsx($e,{type:"boolean",title:"Visible",prop:"visible",value:oe.visible,onChange:(s,f)=>{var u;t.three.updateObject(oe.uuid,s,f);const c=(u=t.three.scene)==null?void 0:u.getObjectByProperty("uuid",oe.uuid);c!==void 0&&q(c,s,f)}})]}),l.jsxs(l.Fragment,{children:[ca(oe,t.three),oe.animations.length>0?ua(oe,t.three):null,e.search("camera")>-1?ia(oe,t.three):null,e.search("light")>-1?la(oe,t.three):null,r?aa(oe,t.three):null]})]})},n)},"Inspector")}class da extends j.Component{constructor(a){super(a);V(this,"three");V(this,"setScene",a=>{this.setState(()=>({scene:a.value}))});this.state={scene:a.scene!==void 0?a.scene:null},this.three=a.three,A.addEventListener(I.SET_SCENE,this.setScene)}componentWillUnmount(){A.removeEventListener(I.SET_SCENE,this.setScene)}render(){var r;const a=this.componentState.scene!==null,e="Hierarchy - "+(a?`${(r=this.componentState.scene)==null?void 0:r.name}`:"No Scene");return l.jsx("div",{id:"SidePanel",children:l.jsxs(l.Fragment,{children:[l.jsx(ut,{label:e,open:!0,children:l.jsx(l.Fragment,{children:a&&l.jsx(sn,{child:this.componentState.scene,three:this.three})})}),l.jsx(fn,{three:this.three})]})},"SidePanel")}get componentState(){return this.state}}function fa(t){function n(){return t.three.scene===void 0?(console.log("No scene:",t.three),!1):!0}const a=c=>{var m;if(!n())return;const u=(m=t.three.scene)==null?void 0:m.getObjectByProperty("uuid",c.value);u!==void 0&&t.three.setObject(u)},e=(c,u,m)=>{var g;if(!n())return;const y=(g=t.three.scene)==null?void 0:g.getObjectByProperty("uuid",c);y!==void 0&&q(y,u,m)},r=c=>{if(!n())return;const u=c.value,{key:m,value:y,uuid:g}=u;e(g,m,y)},s=c=>{if(!n())return;const u=c.value;jt(u.value).then(m=>{e(u.uuid,u.key,m),e(u.uuid,"material.needsUpdate",!0)})},f=c=>{var C;if(!n())return;const{key:u,uuid:m,value:y}=c.value,g=(C=t.three.scene)==null?void 0:C.getObjectByProperty("uuid",m);if(g!==void 0)try{g[u](y)}catch(x){console.log("Error requesting method:"),console.log(x),console.log(u),console.log(y)}};return j.useEffect(()=>(A.addEventListener(I.GET_OBJECT,a),A.addEventListener(I.UPDATE_OBJECT,r),A.addEventListener(I.CREATE_TEXTURE,s),A.addEventListener(I.REQUEST_METHOD,f),()=>{A.removeEventListener(I.GET_OBJECT,a),A.removeEventListener(I.UPDATE_OBJECT,r),A.removeEventListener(I.CREATE_TEXTURE,s),A.removeEventListener(I.REQUEST_METHOD,f)}),[]),null}const hn={type:"change"},Lt={type:"start"},pn={type:"end"},dt=new d.Ray,mn=new d.Plane,ha=Math.cos(70*d.MathUtils.DEG2RAD);class pa extends d.EventDispatcher{constructor(n,a){super(),this.object=n,this.domElement=a,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new d.Vector3,this.cursor=new d.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:d.MOUSE.ROTATE,MIDDLE:d.MOUSE.DOLLY,RIGHT:d.MOUSE.PAN},this.touches={ONE:d.TOUCH.ROTATE,TWO:d.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return c.phi},this.getAzimuthalAngle=function(){return c.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(o){o.addEventListener("keydown",st),this._domElementKeyEvents=o},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",st),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(hn),e.update(),s=r.NONE},this.update=function(){const o=new d.Vector3,w=new d.Quaternion().setFromUnitVectors(n.up,new d.Vector3(0,1,0)),N=w.clone().invert(),H=new d.Vector3,re=new d.Quaternion,be=new d.Vector3,fe=2*Math.PI;return function(Tt=null){const we=e.object.position;o.copy(we).sub(e.target),o.applyQuaternion(w),c.setFromVector3(o),e.autoRotate&&s===r.NONE&&W(E(Tt)),e.enableDamping?(c.theta+=u.theta*e.dampingFactor,c.phi+=u.phi*e.dampingFactor):(c.theta+=u.theta,c.phi+=u.phi);let he=e.minAzimuthAngle,pe=e.maxAzimuthAngle;isFinite(he)&&isFinite(pe)&&(he<-Math.PI?he+=fe:he>Math.PI&&(he-=fe),pe<-Math.PI?pe+=fe:pe>Math.PI&&(pe-=fe),he<=pe?c.theta=Math.max(he,Math.min(pe,c.theta)):c.theta=c.theta>(he+pe)/2?Math.max(he,c.theta):Math.min(pe,c.theta)),c.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,c.phi)),c.makeSafe(),e.enableDamping===!0?e.target.addScaledVector(y,e.dampingFactor):e.target.add(y),e.target.sub(e.cursor),e.target.clampLength(e.minTargetRadius,e.maxTargetRadius),e.target.add(e.cursor),e.zoomToCursor&&ie||e.object.isOrthographicCamera?c.radius=ee(c.radius):c.radius=ee(c.radius*m),o.setFromSpherical(c),o.applyQuaternion(N),we.copy(e.target).add(o),e.object.lookAt(e.target),e.enableDamping===!0?(u.theta*=1-e.dampingFactor,u.phi*=1-e.dampingFactor,y.multiplyScalar(1-e.dampingFactor)):(u.set(0,0,0),y.set(0,0,0));let We=!1;if(e.zoomToCursor&&ie){let Be=null;if(e.object.isPerspectiveCamera){const Re=o.length();Be=ee(Re*m);const Ke=Re-Be;e.object.position.addScaledVector(le,Ke),e.object.updateMatrixWorld()}else if(e.object.isOrthographicCamera){const Re=new d.Vector3(de.x,de.y,0);Re.unproject(e.object),e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),We=!0;const Ke=new d.Vector3(de.x,de.y,0);Ke.unproject(e.object),e.object.position.sub(Ke).add(Re),e.object.updateMatrixWorld(),Be=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),e.zoomToCursor=!1;Be!==null&&(this.screenSpacePanning?e.target.set(0,0,-1).transformDirection(e.object.matrix).multiplyScalar(Be).add(e.object.position):(dt.origin.copy(e.object.position),dt.direction.set(0,0,-1).transformDirection(e.object.matrix),Math.abs(e.object.up.dot(dt.direction))<ha?n.lookAt(e.target):(mn.setFromNormalAndCoplanarPoint(e.object.up,e.target),dt.intersectPlane(mn,e.target))))}else e.object.isOrthographicCamera&&(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/m)),e.object.updateProjectionMatrix(),We=!0);return m=1,ie=!1,We||H.distanceToSquared(e.object.position)>f||8*(1-re.dot(e.object.quaternion))>f||be.distanceToSquared(e.target)>0?(e.dispatchEvent(hn),H.copy(e.object.position),re.copy(e.object.quaternion),be.copy(e.target),!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",Me),e.domElement.removeEventListener("pointerdown",rt),e.domElement.removeEventListener("pointercancel",Fe),e.domElement.removeEventListener("wheel",wt),e.domElement.removeEventListener("pointermove",Te),e.domElement.removeEventListener("pointerup",Fe),e._domElementKeyEvents!==null&&(e._domElementKeyEvents.removeEventListener("keydown",st),e._domElementKeyEvents=null)};const e=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const f=1e-6,c=new d.Spherical,u=new d.Spherical;let m=1;const y=new d.Vector3,g=new d.Vector2,C=new d.Vector2,x=new d.Vector2,M=new d.Vector2,P=new d.Vector2,Q=new d.Vector2,U=new d.Vector2,O=new d.Vector2,J=new d.Vector2,le=new d.Vector3,de=new d.Vector2;let ie=!1;const h=[],v={};function E(o){return o!==null?2*Math.PI/60*e.autoRotateSpeed*o:2*Math.PI/60/60*e.autoRotateSpeed}function R(o){const w=Math.abs(o)/(100*(window.devicePixelRatio|0));return Math.pow(.95,e.zoomSpeed*w)}function W(o){u.theta-=o}function K(o){u.phi-=o}const G=function(){const o=new d.Vector3;return function(N,H){o.setFromMatrixColumn(H,0),o.multiplyScalar(-N),y.add(o)}}(),F=function(){const o=new d.Vector3;return function(N,H){e.screenSpacePanning===!0?o.setFromMatrixColumn(H,1):(o.setFromMatrixColumn(H,0),o.crossVectors(e.object.up,o)),o.multiplyScalar(N),y.add(o)}}(),Y=function(){const o=new d.Vector3;return function(N,H){const re=e.domElement;if(e.object.isPerspectiveCamera){const be=e.object.position;o.copy(be).sub(e.target);let fe=o.length();fe*=Math.tan(e.object.fov/2*Math.PI/180),G(2*N*fe/re.clientHeight,e.object.matrix),F(2*H*fe/re.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(G(N*(e.object.right-e.object.left)/e.object.zoom/re.clientWidth,e.object.matrix),F(H*(e.object.top-e.object.bottom)/e.object.zoom/re.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function ne(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function k(o){e.object.isPerspectiveCamera||e.object.isOrthographicCamera?m*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function B(o,w){if(!e.zoomToCursor)return;ie=!0;const N=e.domElement.getBoundingClientRect(),H=o-N.left,re=w-N.top,be=N.width,fe=N.height;de.x=H/be*2-1,de.y=-(re/fe)*2+1,le.set(de.x,de.y,1).unproject(e.object).sub(e.object.position).normalize()}function ee(o){return Math.max(e.minDistance,Math.min(e.maxDistance,o))}function me(o){g.set(o.clientX,o.clientY)}function Ie(o){B(o.clientX,o.clientX),U.set(o.clientX,o.clientY)}function nt(o){M.set(o.clientX,o.clientY)}function vt(o){C.set(o.clientX,o.clientY),x.subVectors(C,g).multiplyScalar(e.rotateSpeed);const w=e.domElement;W(2*Math.PI*x.x/w.clientHeight),K(2*Math.PI*x.y/w.clientHeight),g.copy(C),e.update()}function Nt(o){O.set(o.clientX,o.clientY),J.subVectors(O,U),J.y>0?ne(R(J.y)):J.y<0&&k(R(J.y)),U.copy(O),e.update()}function Ut(o){P.set(o.clientX,o.clientY),Q.subVectors(P,M).multiplyScalar(e.panSpeed),Y(Q.x,Q.y),M.copy(P),e.update()}function at(o){B(o.clientX,o.clientY),o.deltaY<0?k(R(o.deltaY)):o.deltaY>0&&ne(R(o.deltaY)),e.update()}function it(o){let w=!1;switch(o.code){case e.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?K(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Y(0,e.keyPanSpeed),w=!0;break;case e.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?K(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Y(0,-e.keyPanSpeed),w=!0;break;case e.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?W(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Y(e.keyPanSpeed,0),w=!0;break;case e.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?W(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):Y(-e.keyPanSpeed,0),w=!0;break}w&&(o.preventDefault(),e.update())}function Le(o){if(h.length===1)g.set(o.pageX,o.pageY);else{const w=ge(o),N=.5*(o.pageX+w.x),H=.5*(o.pageY+w.y);g.set(N,H)}}function Ge(o){if(h.length===1)M.set(o.pageX,o.pageY);else{const w=ge(o),N=.5*(o.pageX+w.x),H=.5*(o.pageY+w.y);M.set(N,H)}}function Ne(o){const w=ge(o),N=o.pageX-w.x,H=o.pageY-w.y,re=Math.sqrt(N*N+H*H);U.set(0,re)}function Ft(o){e.enableZoom&&Ne(o),e.enablePan&&Ge(o)}function gt(o){e.enableZoom&&Ne(o),e.enableRotate&&Le(o)}function bt(o){if(h.length==1)C.set(o.pageX,o.pageY);else{const N=ge(o),H=.5*(o.pageX+N.x),re=.5*(o.pageY+N.y);C.set(H,re)}x.subVectors(C,g).multiplyScalar(e.rotateSpeed);const w=e.domElement;W(2*Math.PI*x.x/w.clientHeight),K(2*Math.PI*x.y/w.clientHeight),g.copy(C)}function yt(o){if(h.length===1)P.set(o.pageX,o.pageY);else{const w=ge(o),N=.5*(o.pageX+w.x),H=.5*(o.pageY+w.y);P.set(N,H)}Q.subVectors(P,M).multiplyScalar(e.panSpeed),Y(Q.x,Q.y),M.copy(P)}function Ue(o){const w=ge(o),N=o.pageX-w.x,H=o.pageY-w.y,re=Math.sqrt(N*N+H*H);O.set(0,re),J.set(0,Math.pow(O.y/U.y,e.zoomSpeed)),ne(J.y),U.copy(O);const be=(o.pageX+w.x)*.5,fe=(o.pageY+w.y)*.5;B(be,fe)}function Ye(o){e.enableZoom&&Ue(o),e.enablePan&&yt(o)}function Et(o){e.enableZoom&&Ue(o),e.enableRotate&&bt(o)}function rt(o){e.enabled!==!1&&(h.length===0&&(e.domElement.setPointerCapture(o.pointerId),e.domElement.addEventListener("pointermove",Te),e.domElement.addEventListener("pointerup",Fe)),Vt(o),o.pointerType==="touch"?St(o):Bt(o))}function Te(o){e.enabled!==!1&&(o.pointerType==="touch"?Ct(o):ot(o))}function Fe(o){xt(o),h.length===0&&(e.domElement.releasePointerCapture(o.pointerId),e.domElement.removeEventListener("pointermove",Te),e.domElement.removeEventListener("pointerup",Fe)),e.dispatchEvent(pn),s=r.NONE}function Bt(o){let w;switch(o.button){case 0:w=e.mouseButtons.LEFT;break;case 1:w=e.mouseButtons.MIDDLE;break;case 2:w=e.mouseButtons.RIGHT;break;default:w=-1}switch(w){case d.MOUSE.DOLLY:if(e.enableZoom===!1)return;Ie(o),s=r.DOLLY;break;case d.MOUSE.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enablePan===!1)return;nt(o),s=r.PAN}else{if(e.enableRotate===!1)return;me(o),s=r.ROTATE}break;case d.MOUSE.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(e.enableRotate===!1)return;me(o),s=r.ROTATE}else{if(e.enablePan===!1)return;nt(o),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Lt)}function ot(o){switch(s){case r.ROTATE:if(e.enableRotate===!1)return;vt(o);break;case r.DOLLY:if(e.enableZoom===!1)return;Nt(o);break;case r.PAN:if(e.enablePan===!1)return;Ut(o);break}}function wt(o){e.enabled===!1||e.enableZoom===!1||s!==r.NONE||(o.preventDefault(),e.dispatchEvent(Lt),at(o),e.dispatchEvent(pn))}function st(o){e.enabled===!1||e.enablePan===!1||it(o)}function St(o){switch(ct(o),h.length){case 1:switch(e.touches.ONE){case d.TOUCH.ROTATE:if(e.enableRotate===!1)return;Le(o),s=r.TOUCH_ROTATE;break;case d.TOUCH.PAN:if(e.enablePan===!1)return;Ge(o),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(e.touches.TWO){case d.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ft(o),s=r.TOUCH_DOLLY_PAN;break;case d.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;gt(o),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&e.dispatchEvent(Lt)}function Ct(o){switch(ct(o),s){case r.TOUCH_ROTATE:if(e.enableRotate===!1)return;bt(o),e.update();break;case r.TOUCH_PAN:if(e.enablePan===!1)return;yt(o),e.update();break;case r.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ye(o),e.update();break;case r.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Et(o),e.update();break;default:s=r.NONE}}function Me(o){e.enabled!==!1&&o.preventDefault()}function Vt(o){h.push(o.pointerId)}function xt(o){delete v[o.pointerId];for(let w=0;w<h.length;w++)if(h[w]==o.pointerId){h.splice(w,1);return}}function ct(o){let w=v[o.pointerId];w===void 0&&(w=new d.Vector2,v[o.pointerId]=w),w.set(o.pageX,o.pageY)}function ge(o){const w=o.pointerId===h[0]?h[1]:h[0];return v[w]}e.domElement.addEventListener("contextmenu",Me),e.domElement.addEventListener("pointerdown",rt),e.domElement.addEventListener("pointercancel",Fe),e.domElement.addEventListener("wheel",wt,{passive:!1}),this.update()}}const ft=t=>{const[n,a]=j.useState(t.options[t.index]),e=()=>{t.onToggle(!t.open)},r=s=>{s!==n&&(t.onSelect(s),a(s)),t.onToggle(!1)};return l.jsxs("div",{className:`dropdown ${t.up===!0?"up":""}`,children:[l.jsx("div",{className:"dropdown-toggle",onClick:e,children:n}),t.open&&l.jsx("ul",{className:"dropdown-menu",children:t.options.map(s=>l.jsx("li",{onClick:()=>r(s),children:s},s))})]})},_e=j.forwardRef(function(n,a){const[e,r]=j.useState(!1),s=n.options.indexOf(n.camera.name);return l.jsxs("div",{className:"CameraWindow",children:[l.jsx("div",{ref:a,className:"clickable",onClick:()=>{e&&r(!1)}}),l.jsx(ft,{index:s,open:e,options:n.options,onSelect:n.onSelect,onToggle:f=>{r(f)},up:!0})]})}),vn=["Single","Side by Side","Stacked","Quad"],ae=new Map,se=new Map,ye=new Map;function ke(t,n){const a=new d.OrthographicCamera(-100,100,100,-100,50,3e3);return a.name=t,a.position.copy(n),a.lookAt(0,0,0),ae.set(t,a),a}ke("Top",new d.Vector3(0,1e3,0)),ke("Bottom",new d.Vector3(0,-1e3,0)),ke("Left",new d.Vector3(-1e3,0,0)),ke("Right",new d.Vector3(1e3,0,0)),ke("Front",new d.Vector3(0,0,1e3)),ke("Back",new d.Vector3(0,0,-1e3)),ke("Orthographic",new d.Vector3(1e3,1e3,1e3));const ht=new d.PerspectiveCamera(60,1,50,3e3);ht.name="Debug",ht.position.set(500,500,500),ht.lookAt(0,0,0),ae.set("Debug",ht);const gn=["Renderer","Depth","Normals","UVs","Wireframe"],ma=new d.MeshDepthMaterial,va=new d.MeshNormalMaterial,ga=new on,ba=new d.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0}),ka="";let pt="Renderer";const X=new d.Scene;X.name="Debug Scene";let Ee=new d.Scene;X.add(Ee);const et=new d.Group;et.name="helpers",X.add(et);const ya=new rn;et.add(ya);const bn=new d.AxesHelper(500);bn.name="axisHelper",et.add(bn);const tt=new d.AxesHelper(100);tt.name="interactionHelper",et.add(tt),tt.visible=!1;let mt=!1,Z=ae.get("Debug"),ce=ae.get("Orthographic"),De=ae.get("Front"),Ae=ae.get("Top"),yn=!1;function Ea(t){const[n,a]=j.useState(t.mode!==void 0?t.mode:"Single"),[e,r]=j.useState(null),[s,f]=j.useState(!1),[c,u]=j.useState(!1),[m,y]=j.useState(!1),[,g]=j.useState(Date.now()),C=j.useRef(null),x=j.useRef(null),M=j.useRef(null),P=j.useRef(null),Q=j.useRef(null),U=j.useRef(null),O=(h,v)=>{const E=se.get(h.name);E!==void 0&&E.dispose(),se.delete(h.name);const R=ye.get(h.name);R!==void 0&&(X.remove(R),R.dispose()),ye.delete(h.name);const W=new pa(h,v);switch(W.enableDamping=!0,W.dampingFactor=.05,h.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":W.enableRotate=!1;break}if(se.set(h.name,W),h instanceof d.PerspectiveCamera){const K=new d.CameraHelper(h);ye.set(h.name,K),X.add(K)}},J=h=>{const v=ye.get(h.name);v!==void 0&&(X.remove(v),v.dispose(),ye.delete(h.name));const E=se.get(h.name);E!==void 0&&(E.dispose(),se.delete(h.name))},le=()=>{se.forEach((h,v)=>{h.dispose();const E=ye.get(v);E!==void 0&&(X.remove(E),E.dispose()),ye.delete(v),se.delete(v)}),se.clear(),ye.clear()},de=()=>{switch(n){case"Single":O(Z,M.current);break;case"Side by Side":case"Stacked":O(Z,M.current),O(ce,P.current);break;case"Quad":O(Z,M.current),O(ce,P.current),O(De,Q.current),O(Ae,U.current);break}};j.useEffect(()=>{const h=new d.WebGLRenderer({canvas:C.current,stencil:!1});h.autoClear=!1,h.shadowMap.enabled=!0,h.setPixelRatio(devicePixelRatio),h.setClearColor(0),r(h)},[]),j.useEffect(()=>{const h=R=>{Rt(Ee),X.remove(Ee);const W=t.scenes.get(R.value.name);if(W!==void 0){const K=new W;t.onSceneSet!==void 0&&t.onSceneSet(K),Ee=K,t.three.scene=Ee,X.add(Ee),yn=!0}},v=R=>{var G;const W=R.value,K=(G=t.three.scene)==null?void 0:G.getObjectByProperty("uuid",W.uuid);K!==void 0&&ae.set(W.name,K),g(Date.now())},E=R=>{ae.delete(R.value.name),g(Date.now())};return A.addEventListener(I.SET_SCENE,h),A.addEventListener(I.ADD_CAMERA,v),A.addEventListener(I.REMOVE_CAMERA,E),()=>{A.removeEventListener(I.SET_SCENE,h),A.removeEventListener(I.ADD_CAMERA,v),A.removeEventListener(I.REMOVE_CAMERA,E)}},[]),j.useEffect(()=>{if(e===null)return;let h=window.innerWidth,v=window.innerHeight,E=Math.floor(h/2),R=Math.floor(v/2),W=-1;const K=()=>{h=window.innerWidth-300,v=window.innerHeight,E=Math.floor(h/2),R=Math.floor(v/2),e.setSize(h,v);let k=h,B=v;switch(n){case"Side by Side":k=E,B=v;break;case"Stacked":k=h,B=R;break;case"Quad":k=E,B=R;break}ae.forEach(ee=>{var me;ee instanceof d.OrthographicCamera?(ee.left=k/-2,ee.right=k/2,ee.top=B/2,ee.bottom=B/-2,ee.updateProjectionMatrix()):ee instanceof d.PerspectiveCamera&&(ee.aspect=k/B,ee.updateProjectionMatrix(),(me=ye.get(ee.name))==null||me.update())})},G=()=>{e.setViewport(0,0,h,v),e.setScissor(0,0,h,v),e.render(X,Z)},F=()=>{if(n==="Side by Side")e.setViewport(0,0,E,v),e.setScissor(0,0,E,v),e.render(X,Z),e.setViewport(E,0,E,v),e.setScissor(E,0,E,v),e.render(X,ce);else{const k=v-R;e.setViewport(0,k,h,R),e.setScissor(0,k,h,R),e.render(X,Z),e.setViewport(0,0,h,R),e.setScissor(0,0,h,R),e.render(X,ce)}},Y=()=>{let k=0,B=0;B=v-R,k=0,e.setViewport(k,B,E,R),e.setScissor(k,B,E,R),e.render(X,Z),k=E,e.setViewport(k,B,E,R),e.setScissor(k,B,E,R),e.render(X,ce),B=0,k=0,e.setViewport(k,B,E,R),e.setScissor(k,B,E,R),e.render(X,De),k=E,e.setViewport(k,B,E,R),e.setScissor(k,B,E,R),e.render(X,Ae)},ne=()=>{switch(se.forEach(k=>{k.update()}),t.onSceneUpdate!==void 0&&yn&&t.onSceneUpdate(Ee),e.clear(),n){case"Single":G();break;case"Side by Side":case"Stacked":F();break;case"Quad":Y();break}W=requestAnimationFrame(ne)};return de(),window.addEventListener("resize",K),K(),ne(),()=>{window.removeEventListener("resize",K),cancelAnimationFrame(W),W=-1}},[n,e]),j.useEffect(()=>{if(e!==null){const h=new d.Raycaster,v=new d.Vector2,E=(G,F,Y,ne)=>{switch(n){case"Quad":G<Y?F<ne?h.setFromCamera(v,Z):h.setFromCamera(v,De):F<ne?h.setFromCamera(v,ce):h.setFromCamera(v,Ae);break;case"Side by Side":G<Y?h.setFromCamera(v,Z):h.setFromCamera(v,ce);break;case"Single":h.setFromCamera(v,Z);break;case"Stacked":F<ne?h.setFromCamera(v,Z):h.setFromCamera(v,ce);break}},R=G=>{if(!mt)return;const F=new d.Vector2;e.getSize(F);const Y=Math.min(G.clientX,F.x),ne=Math.min(G.clientY,F.y);v.x=He(Y,0,F.x,-1,1),v.y=He(ne,0,F.y,1,-1);const k=F.x/2,B=F.y/2,ee=()=>{Y<k?v.x=He(Y,0,k,-1,1):v.x=He(Y,k,F.x,-1,1)},me=()=>{ne<B?v.y=He(ne,0,B,1,-1):v.y=He(ne,B,F.y,1,-1)};switch(n){case"Quad":ee(),me();break;case"Side by Side":ee();break;case"Stacked":me(),me();break}E(Y,ne,k,B);const Ie=h.intersectObjects(Ee.children);Ie.length>0&&tt.position.copy(Ie[0].point)},W=G=>{if(!mt)return;const F=new d.Vector2;if(e.getSize(F),G.clientX>=F.x)return;R(G);const Y=h.intersectObjects(Ee.children);Y.length>0&&t.three.getObject(Y[0].object.uuid)},K=x.current;return K.addEventListener("mousemove",R,!1),K.addEventListener("click",W,!1),()=>{K.removeEventListener("mousemove",R),K.removeEventListener("click",W)}}},[n,e]);const ie=[];return ae.forEach((h,v)=>{ie.push(v)}),l.jsxs("div",{className:"multiview",children:[l.jsx("canvas",{ref:C}),l.jsxs("div",{className:`cameras ${n==="Single"||n==="Stacked"?"single":""}`,ref:x,children:[n==="Single"&&l.jsx(l.Fragment,{children:l.jsx(_e,{camera:Z,options:ie,ref:M,onSelect:h=>{var E;(E=se.get(Z.name))==null||E.dispose();const v=ae.get(h);v!==void 0&&(J(Z),Z=v,O(v,M.current))}})}),(n==="Side by Side"||n==="Stacked")&&l.jsxs(l.Fragment,{children:[l.jsx(_e,{camera:Z,options:ie,ref:M,onSelect:h=>{var E;(E=se.get(Z.name))==null||E.dispose();const v=ae.get(h);v!==void 0&&(J(Z),Z=v,O(v,M.current))}}),l.jsx(_e,{camera:ce,options:ie,ref:P,onSelect:h=>{var E;(E=se.get(ce.name))==null||E.dispose();const v=ae.get(h);v!==void 0&&(J(ce),ce=v,O(v,P.current))}})]}),n==="Quad"&&l.jsxs(l.Fragment,{children:[l.jsx(_e,{camera:Z,options:ie,ref:M,onSelect:h=>{var E;(E=se.get(Z.name))==null||E.dispose();const v=ae.get(h);v!==void 0&&(J(Z),Z=v,O(v,M.current))}}),l.jsx(_e,{camera:ce,options:ie,ref:P,onSelect:h=>{var E;(E=se.get(ce.name))==null||E.dispose();const v=ae.get(h);v!==void 0&&(J(ce),ce=v,O(v,P.current))}}),l.jsx(_e,{camera:De,options:ie,ref:Q,onSelect:h=>{var E;(E=se.get(De.name))==null||E.dispose();const v=ae.get(h);v!==void 0&&(J(De),De=v,O(v,Q.current))}}),l.jsx(_e,{camera:Ae,options:ie,ref:U,onSelect:h=>{var E;(E=se.get(Ae.name))==null||E.dispose();const v=ae.get(h);v!==void 0&&(J(Ae),Ae=v,O(v,U.current))}})]})]}),l.jsxs("div",{className:"settings",children:[l.jsx(ft,{index:vn.indexOf(n),options:vn,onSelect:h=>{h!==n&&(le(),a(h))},open:s,onToggle:h=>{f(h),c&&u(!1),m&&y(!1)}}),l.jsx(ft,{index:gn.indexOf(pt),options:gn,onSelect:h=>{if(h!==pt)switch(pt=h,pt){case"Depth":X.overrideMaterial=ma;break;case"Normals":X.overrideMaterial=va;break;default:case"Renderer":X.overrideMaterial=null;break;case"Wireframe":X.overrideMaterial=ba;break;case"UVs":X.overrideMaterial=ga;break}},open:c,onToggle:h=>{s&&f(!1),u(h),m&&y(!1)}}),l.jsx(ft,{index:0,options:["Orbit Mode","Selection Mode"],onSelect:h=>{mt=h==="Selection Mode",tt.visible=mt},open:m,onToggle:h=>{s&&f(!1),c&&u(!1),y(h)}})]})]})}const Da="";function wa(t){return l.jsxs("div",{className:"editor",ref:t.ref,style:t.style,children:[l.jsx("header",{children:t.header}),t.children,l.jsx("footer",{children:t.footer})]})}S.Accordion=ut,S.Application=_n,S.BaseRemote=Je,S.ChildObject=At,S.ContainerObject=sn,S.Draggable=tn,S.DraggableItem=en,S.Dropdown=nn,S.DropdownItem=an,S.Editor=wa,S.InfiniteGridHelper=rn,S.Inspector=fn,S.MultiView=Ea,S.NavButton=Dt,S.RemoteComponents=Xt,S.RemoteController=Wn,S.RemoteTheatre=xe,S.RemoteThree=Qt,S.RemoteTweakpane=_t,S.SceneInspector=fa,S.SidePanel=da,S.ToolEvents=I,S.UVMaterial=on,S.clamp=Rn,S.colorToHex=Yt,S.debugDispatcher=A,S.dispose=Rt,S.disposeMaterial=Kt,S.disposeTexture=jn,S.distance=Pn,S.hierarchyUUID=Mt,S.isColor=Gt,S.randomID=zt,S.resetThreeObjects=Wt,S.round=lt,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"module": "./dist/hermes.js",
|
8
8
|
"types": "./types/index.d.ts",
|
9
9
|
"type": "module",
|
10
|
-
"version": "0.0.
|
10
|
+
"version": "0.0.27",
|
11
11
|
"homepage": "https://github.com/tomorrowevening/hermes#readme",
|
12
12
|
"bugs": {
|
13
13
|
"url": "https://github.com/tomorrowevening/hermes/issues"
|