@tomorrowevening/hermes 0.0.30 → 0.0.31

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