@tomorrowevening/hermes 0.0.109 → 0.0.110

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("three"),w=require("react"),is=require("framer-motion"),ui=()=>{},Bs=()=>{};function dt(i){return i.substring(0,1).toUpperCase()+i.substring(1)}function ss(i){const e=JSON.stringify(i);return navigator.clipboard.writeText(e),e}function Te(i,e,t){return Math.min(e,Math.max(i,t))}function si(i,e,t){return(t-i)/(e-i)}function Rt(i,e,t){return i*(1-t)+e*t}function Ys(i,e){const t=i-e;return Math.sqrt(t*t)}function ns(){return Math.round(Math.random()*1e6).toString()}function rs(i){return i.r!==void 0&&i.g!==void 0&&i.b!==void 0}function ni(i){const e=Math.round(i.r*255),t=Math.round(i.g*255),s=Math.round(i.b*255),n=h=>{const c=h.toString(16);return c.length===1?"0"+c:c},a=n(e),r=n(t),l=n(s);return"#"+a+r+l}function pe(i,e=1){return Number(i.toFixed(e))}exports.totalThreeObjects=0;const ri=()=>{exports.totalThreeObjects=0},Dt=i=>{if(!i)return;let e=i.name.replaceAll(" ","").replaceAll("/",".");if(e.length===0&&(e=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),i.parent!==null&&i.parent.uuid.length>0&&(e=`${i.parent.uuid}.${e}`),i.uuid=e,i.isMesh!==void 0){const t=i;if(Array.isArray(t.material))t.material.forEach((s,n)=>{s.uuid=`${e}.material.${n}`});else{const s=t.material;s.uuid=`${e}.material`}}i.children.forEach(t=>Dt(t))},Gs=i=>{i?.dispose()},as=i=>{i&&(Array.isArray(i)?i.forEach(e=>e.dispose()):i.dispose())},Se=i=>{if(i){for(;i.children.length>0;){const e=i.children[0];e.type==="Audio"?(e.pause(),e.parent&&e.parent.remove(e)):Se(e)}if(i.parent&&i.parent.remove(i),i.isMesh){const e=i;e.geometry?.dispose(),as(e.material)}i.dispose!==void 0&&i.dispose()}};class ht{static renderer;static canvas;static context=null;static scene=null;static camera=null;static material=null;static inited=!1;static width=100;static height=100;static init(){this.inited||(this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.context=this.canvas.getContext("2d"),this.inited=!0)}static renderToBlob(e){this.init();const t=e.repeat.clone(),s=e.offset.clone();if(e.repeat.set(1,1),e.offset.set(0,0),this.context!==null){this.context.clearRect(0,0,this.width,this.height);const n=e.image;if(n!=null&&n.width>0){this.canvas.title=e.sourceFile;const a=this.canvas.width/n.width,r=this.renderToCanvas(e);this.context.drawImage(r,0,0,n.width*a,n.height*a)}}return e.repeat.copy(t),e.offset.copy(s),this.canvas.toDataURL("image/png")}static renderToCanvas(e){if(this.material===null){this.camera=new o.OrthographicCamera(-.5,.5,.5,-.5,0,100),this.scene=new o.Scene,this.material=new o.MeshBasicMaterial;const t=new o.BufferGeometry;t.setAttribute("position",new o.Float32BufferAttribute([-.5,-.5,0,1.5,-.5,0,-.5,1.5,0],3)),t.setAttribute("normal",new o.Float32BufferAttribute([0,0,1,0,0,1],3)),t.setAttribute("uv",new o.Float32BufferAttribute([0,0,2,0,0,2],2));const s=new o.Mesh(t,this.material);this.scene.add(s)}if(e.isRenderTargetTexture)this.material.map=e,this.renderer.render(this.scene,this.camera);else{const t=this.renderer.outputColorSpace,s=e.colorSpace;this.renderer.outputColorSpace=o.LinearSRGBColorSpace,e.colorSpace=o.LinearSRGBColorSpace,this.material.map=e,this.renderer.render(this.scene,this.camera),this.renderer.outputColorSpace=t,e.colorSpace=s}return this.renderer.domElement}}class Zs{components=new Map;listen;_appID="";_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(e,t,s=!0){this._appID=e,this._debugEnabled=t,t&&(this._useBC=s,s?(this._broadcastChannel=new BroadcastChannel(e),this._broadcastChannel.addEventListener("message",this.messageHandler)):(this._webSocket=new WebSocket(e),this._webSocket.addEventListener("open",this.openHandler),this._webSocket.addEventListener("close",this.closeHandler),this._webSocket.addEventListener("message",this.messageHandler)))}addComponent(e,t){this.components.set(e,t)}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(e=>{e.dispose()}),this.components.clear()}send(e){this._mode!==e.target&&(this._useBC?this._broadcastChannel?.postMessage(e):this._connected&&this._webSocket?.send(JSON.stringify(e)))}messageHandler=e=>{this.listen!==void 0&&(this._useBC?this.listen(e.data):this.listen(JSON.parse(e.data)))};openHandler=()=>{this._connected=!0};closeHandler=()=>{this._connected=!1};get appID(){return this._appID}get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(e){e&&(this._mode="editor")}}var P=(i=>(i.CUSTOM="ToolEvents::custom",i.SELECT_DROPDOWN="ToolEvents::selectDropdown",i.DRAG_UPDATE="ToolEvents::dragUpdate",i.ADD_SCENE="ToolEvents::addScene",i.REFRESH_SCENE="ToolEvents::refreshScene",i.REMOVE_SCENE="ToolEvents::removeScene",i.SET_SCENE="ToolEvents::setScene",i.GET_OBJECT="ToolEvents::getObject",i.SET_OBJECT="ToolEvents::setObject",i.UPDATE_OBJECT="ToolEvents::updateObject",i.CREATE_TEXTURE="ToolEvents::createTexture",i.REQUEST_METHOD="ToolEvents::requestMethod",i.ADD_CAMERA="ToolEvents::addCamera",i.REMOVE_CAMERA="ToolEvents::removeCamera",i.ADD_GROUP="ToolEvents::addGroup",i.REMOVE_GROUP="ToolEvents::removeGroup",i.ADD_SPLINE="ToolEvents::addSpline",i))(P||{});const R=new o.EventDispatcher;class Lt{app;constructor(e){this.app=e}dispose(){}handleApp(e,t,s){}handleEditor(e,t,s){}}class Ws extends Lt{selectDropdown(e,t){this.app.send({event:"selectComponent",target:"app",data:{dropdown:e,value:t}})}updateDropdown(e,t){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:e,value:t}})}handleApp(e,t,s){switch(s.event){case"selectComponent":R.dispatchEvent({type:P.SELECT_DROPDOWN,value:s.data});break;case"draggableListUpdate":R.dispatchEvent({type:P.DRAG_UPDATE,value:s.data});break}}}function Xs(i,e,t){if(i.editor){t.ui.restore(),t.onSelectionChange(r=>{r.length<1||r.forEach(l=>{let h=l.address.sheetId,c="setSheet",p={};switch(l.type){case"Theatre_Sheet_PublicAPI":c="setSheet",p={sheet:l.address.sheetId},e.activeSheet=e.sheets.get(l.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":c="setSheetObject",h+=`_${l.address.objectKey}`,p={id:h,sheet:l.address.sheetId,key:l.address.objectKey},e.activeSheet=e.sheets.get(l.address.sheetId);break}i.send({event:c,target:"app",data:p})})});let s=-1;const n=()=>{if(e.activeSheet!==void 0&&s!==e.activeSheet.sequence.position){s=e.activeSheet.sequence.position;const r=e.activeSheet;i.send({event:"updateTimeline",target:"app",data:{position:s,sheet:r.address.sheetId}})}},a=()=>{n(),requestAnimationFrame(a)};n(),a()}else t.ui.hide()}function Qs(){const i=document.getElementById("theatrejs-studio-root")?.shadowRoot?.getElementById("pointer-root")?.children[0],e=i?.children[1];e.style.justifyContent="left";const t=e.children[1];for(t.style.transform="translateX(10px)";t.children.length>1;)t.removeChild(t.children[0]);const s=i?.children[3];s.style.top="0",s.style.right="300px"}class qs extends Lt{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}getSheetInstance(e,t){return t!==void 0?`${e}-${t}`:e}sheet(e,t){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const s=this.getSheetInstance(e,t);let n=this.sheets.get(s);return n!==void 0||(n=this.project?.sheet(e,t),this.sheets.set(s,n)),n}playSheet(e,t,s){return new Promise(n=>{const a=t!==void 0?{...t}:{};this.sheet(e,s)?.sequence.play(a).then(r=>n(r)),this.app.send({event:"playSheet",target:"editor",data:{sheet:e,instance:s,value:t}})})}pauseSheet(e,t){this.sheet(e,t)?.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:e,instance:t}})}clearSheetObjects(e){this.sheetObjects.forEach((t,s)=>{s.search(`${e}_`)>-1&&this.unsubscribe(t)})}sheetObject(e,t,s,n,a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const r=this.sheet(e,a);if(r===void 0)return;const h=`${this.getSheetInstance(e,a)}_${t}`;let c=this.sheetObjects.get(h);c!==void 0?c=r.object(t,{...s,...c.value},{reconfigure:!0}):c=r.object(t,s),this.sheetObjects.set(h,c),this.sheetObjectCBs.set(h,n!==void 0?n:ui);const p=c.onValuesChange(m=>{if(this.app.editor){for(const y in m){const x=m[y];typeof x=="object"&&rs(x)&&(m[y]={r:x.r,g:x.g,b:x.b,a:x.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:e,sheetObject:h,values:m}})}const f=this.sheetObjectCBs.get(h);f!==void 0&&f(m)});return this.sheetObjectUnsubscribe.set(h,p),c}unsubscribe(e){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const t=e.address.sheetId,s=e.address.objectKey;this.sheets.get(t)?.detachObject(s);const a=`${t}_${s}`,r=this.sheetObjectUnsubscribe.get(a);r!==void 0&&(this.sheetObjects.delete(a),this.sheetObjectCBs.delete(a),this.sheetObjectUnsubscribe.delete(a),r())}handleApp(e,t,s){const n=t;let a;switch(s.event){case"setSheet":a=n.sheets.get(s.data.sheet),a!==void 0&&(n.activeSheet=a,this.studio?.setSelection([a]));break;case"setSheetObject":a=n.sheetObjects.get(`${s.data.sheet}_${s.data.key}`),a!==void 0&&this.studio?.setSelection([a]);break;case"updateSheetObject":a=n.sheets.get(s.data.sheet),a!==void 0&&a.sequence.pause(),a=n.sheetObjectCBs.get(s.data.sheetObject),a!==void 0&&a(s.data.values);break;case"updateTimeline":a=n.sheets.get(s.data.sheet),n.activeSheet!==void 0&&(n.activeSheet.sequence.position=s.data.position);break}}handleEditor(e,t,s){if(e.editor){const n=t;switch(s.event){case"playSheet":n.sheet(s.data.sheet,s.data.instance)?.sequence.play(s.data.value);break;case"pauseSheet":n.sheet(s.data.sheet,s.data.instance)?.sequence.pause();break}}}handleEditorApp(e,t){if(e.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(r=>{r.length<1||r.forEach(l=>{let h=l.address.sheetId,c="setSheet",p={};switch(l.type){case"Theatre_Sheet_PublicAPI":c="setSheet",p={sheet:l.address.sheetId},t.activeSheet=t.sheets.get(l.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":c="setSheetObject",h+=`_${l.address.objectKey}`,p={id:h,sheet:l.address.sheetId,key:l.address.objectKey},t.activeSheet=t.sheets.get(l.address.sheetId);break}e.send({event:c,target:"app",data:p})})});let s=-1;const n=()=>{if(t.activeSheet!==void 0&&s!==t.activeSheet.sequence.position){s=t.activeSheet.sequence.position;const r=t.activeSheet;e.send({event:"updateTimeline",target:"app",data:{position:s,sheet:r.address.sheetId}})}},a=()=>{n(),requestAnimationFrame(a)};n(),a()}else this.studio?.ui.hide()}}function Ks(i){if(i.name==="cameras")return"camera";if(i.name==="interactive")return"interactive";if(i.name==="lights")return"light";if(i.name==="ui")return"ui";if(i.name==="utils")return"utils";const e=i.type;return e.search("Helper")>-1?"icon_utils":e.search("Camera")>-1?"camera":e.search("Light")>-1?"light":"obj3D"}function Xe(i){const e={name:i.name,type:i.type,uuid:i.uuid,children:[]};return i.children.forEach(t=>{e.children.push(Xe(t))}),e}function $s(i){const e={};for(const t in i){const s=i[t].value;e[t]={value:s},s===null?e[t].value={src:"",offset:[0,0],repeat:[1,1]}:s!==void 0&&s.isTexture&&(e[t].value={src:s.image.src,offset:[s.offset.x,s.offset.y],repeat:[s.repeat.x,s.repeat.y]})}return e}function Js(i){switch(i){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function He(i){const e={};for(const t in i){if(t.substring(0,1)==="_"||t.substring(0,2)==="is"||Js(t))continue;const s=typeof i[t],n=i[t];switch(s){case"boolean":case"number":case"string":e[t]=n;break;case"object":n!==null?(e[t]=n,n.isTexture?e[t]={src:ht.renderToBlob(n),offset:[n.offset.x,n.offset.y],repeat:[n.repeat.x,n.repeat.y]}:t==="uniforms"&&(e[t]=$s(e[t]))):t==="glslVersion"?e[t]="":e[t]={src:"",offset:[0,0],repeat:[1,1]};break}}return i.anisotropy!==void 0&&(e.anisotropy=i.anisotropy),i.clearcoat!==void 0&&(e.clearcoat=i.clearcoat),i.iridescence!==void 0&&(e.iridescence=i.iridescence),i.dispersion!==void 0&&(e.dispersion=i.dispersion),i.sheen!==void 0&&(e.sheen=i.sheen),i.transmission!==void 0&&(e.transmission=i.transmission),i.transmission!==void 0&&(e.transmission=i.transmission),e}function Gt(i){i.updateMatrix();const e={name:i.name,type:i.type,uuid:i.uuid,visible:i.visible,matrix:i.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};i.animations.forEach(s=>{e.animations.push({name:s.name,duration:s.duration,blendMode:s.blendMode})});const t=i.type.toLowerCase();if(t.search("mesh")>-1){const s=i;if(Array.isArray(s.material)){const n=[];s.material.forEach(a=>{n.push(He(a))}),e.material=n}else e.material=He(s.material)}else if(t.search("points")>-1){const s=i;if(Array.isArray(s.material)){const n=[];s.material.forEach(a=>{n.push(He(a))}),e.material=n}else e.material=He(s.material)}else if(t.search("line")>-1){const s=i;if(Array.isArray(s.material)){const n=[];s.material.forEach(a=>{n.push(He(a))}),e.material=n}else e.material=He(s.material)}else t.search("camera")>-1?i.type==="PerspectiveCamera"?e.perspectiveCameraInfo={fov:i.fov,zoom:i.zoom,near:i.near,far:i.far,focus:i.focus,aspect:i.aspect,filmGauge:i.filmGauge,filmOffset:i.filmOffset}:i.type==="OrthographicCamera"&&(e.orthographicCameraInfo={zoom:i.zoom,near:i.near,far:i.far,left:i.left,right:i.right,top:i.top,bottom:i.bottom}):t.search("light")>-1&&(e.lightInfo={color:i.color,intensity:i.intensity,decay:i.decay,distance:i.distance,angle:i.angle,penumbra:i.penumbra,groundColor:i.groundColor,width:i.width,height:i.height});return e}function en(i,e){const t=e.split(".");switch(t.length){case 1:return i[t[0]];case 2:return i[t[0]][t[1]];case 3:return i[t[0]][t[1]][t[2]];case 4:return i[t[0]][t[1]][t[2]][t[3]];case 5:return i[t[0]][t[1]][t[2]][t[3]][t[4]];case 6:return i[t[0]][t[1]][t[2]][t[3]][t[4]][t[5]]}}function tn(i,e){for(const t in e)i[t]=e[t]}function K(i,e,t){if(i===void 0)return;const s=e.split("."),n=s.length;if(typeof t!="object")switch(n){case 1:i[s[0]]=t;break;case 2:i[s[0]][s[1]]=t;break;case 3:i[s[0]][s[1]][s[2]]=t;break;case 4:i[s[0]][s[1]][s[2]][s[3]]=t;break;case 5:i[s[0]][s[1]][s[2]][s[3]][s[4]]=t;break}else{let r;switch(n){case 1:r=i[s[0]];break;case 2:r=i[s[0]][s[1]];break;case 3:r=i[s[0]][s[1]][s[2]];break;case 4:r=i[s[0]][s[1]][s[2]][s[3]];break;case 5:r=i[s[0]][s[1]][s[2]][s[3]][s[4]];break}r!=null&&tn(r,t)}}function os(i){return new Promise((e,t)=>{const s=new Image;s.onload=()=>{const n=new o.Texture(s);n.wrapS=o.RepeatWrapping,n.wrapT=o.RepeatWrapping,n.needsUpdate=!0,e(n)},s.onerror=t,s.src=i})}class sn extends Lt{scene=void 0;scenes=new Map;renderer=void 0;renderTargets=new Map;groups=new Map;dispose(){this.scenes.forEach(e=>{Se(e)}),this.scenes.clear(),this.scene&&Se(this.scene),this.renderTargets.forEach(e=>{e.dispose()}),this.renderTargets.clear(),this.renderer?.dispose()}getObject(e){this.app.debugEnabled&&(this.renderer!==void 0&&(ht.renderer=this.renderer),this.app.send({event:"getObject",target:"app",data:e}))}setObject(e){this.renderer!==void 0&&(ht.renderer=this.renderer);const t=Gt(e);this.app.send({event:"setObject",target:"editor",data:t})}requestMethod(e,t,s,n){this.app.send({event:"requestMethod",target:"app",data:{uuid:e,key:t,value:s,subitem:n}})}updateObject(e,t,s){this.app.send({event:"updateObject",target:"app",data:{uuid:e,key:t,value:s}})}createTexture(e,t,s){this.app.send({event:"createTexture",target:"app",data:{uuid:e,key:t,value:s}})}addGroup(e){this.groups.get(e.title)===void 0&&(this.groups.set(e.title,{title:e.title,onUpdate:e.onUpdate}),this.app.send({event:"addGroup",target:"editor",data:JSON.stringify(e)}))}removeGroup(e){this.groups.get(e)!==void 0&&(this.groups.delete(e),this.app.send({event:"removeGroup",target:"editor",data:e}))}updateGroup(e,t,s){this.app.send({event:"updateGroup",target:"app",data:JSON.stringify({group:e,prop:t,value:s})})}removeAllGroups(){this.groups.forEach(e=>{const t=e.title;this.groups.delete(t),this.app.send({event:"removeGroup",target:"editor",data:t})}),this.groups.clear()}addSpline(e){setTimeout(()=>{this.app.send({event:"addSpline",target:"editor",data:JSON.stringify(e.toJSON())})},1)}addScene(e){if(e===void 0||(this.scenes.set(e.name,e),!this.app.debugEnabled))return;ri(),Dt(e);const t=Xe(e);this.app.send({event:"addScene",target:"editor",data:t})}refreshScene(e){if(!this.app.debugEnabled)return;const t=this.scenes.get(e);if(t!==void 0){const s=Xe(t);this.app.send({event:"refreshScene",target:"app",data:s})}}removeScene(e){if(e===void 0||(this.scenes.delete(e.name),!this.app.debugEnabled))return;const t=Xe(e);this.app.send({event:"removeScene",target:"editor",data:t})}removeAllScenes(){this.scenes.forEach(e=>this.removeScene(e))}getScene(e){let t=null;return this.scenes.forEach((s,n)=>{e.search(n)>-1&&(t=s)}),t}setScene(e){if(e===void 0||(this.scene=e,!this.app.debugEnabled))return;this.renderer!==void 0&&(ht.renderer=this.renderer),ri(),Dt(e);const t=Xe(e);this.app.send({event:"setScene",target:"editor",data:t})}addCamera(e){if(!this.app.debugEnabled)return;const t=Gt(e);this.app.send({event:"addCamera",target:"editor",data:t})}removeCamera(e){if(!this.app.debugEnabled)return;const t=Gt(e);this.app.send({event:"removeCamera",target:"editor",data:t})}handleApp(e,t,s){const n=t;switch(s.event){case"getObject":R.dispatchEvent({type:P.GET_OBJECT,value:s.data});break;case"updateObject":R.dispatchEvent({type:P.UPDATE_OBJECT,value:s.data});break;case"createTexture":R.dispatchEvent({type:P.CREATE_TEXTURE,value:s.data});break;case"requestMethod":R.dispatchEvent({type:P.REQUEST_METHOD,value:s.data});break;case"refreshScene":e.send({event:"refreshScene",target:"editor",data:Xe(n.scenes.get(s.data.name))});break}if(s.event==="updateGroup"){const a=JSON.parse(s.data);n.groups.get(a.group)?.onUpdate(a.prop,a.value)}}handleEditor(e,t,s){switch(s.event){case"setObject":R.dispatchEvent({type:P.SET_OBJECT,value:s.data});break;case"addScene":R.dispatchEvent({type:P.ADD_SCENE,value:s.data});break;case"refreshScene":R.dispatchEvent({type:P.REFRESH_SCENE,value:s.data});break;case"removeScene":R.dispatchEvent({type:P.REMOVE_SCENE,value:s.data});break;case"setScene":R.dispatchEvent({type:P.SET_SCENE,value:s.data});break;case"addCamera":R.dispatchEvent({type:P.ADD_CAMERA,value:s.data});break;case"removeCamera":R.dispatchEvent({type:P.REMOVE_CAMERA,value:s.data});break;case"addGroup":R.dispatchEvent({type:P.ADD_GROUP,value:s.data});break;case"removeGroup":R.dispatchEvent({type:P.REMOVE_GROUP,value:s.data});break;case"addSpline":R.dispatchEvent({type:P.ADD_SPLINE,value:s.data});break}}addRT(e,t){const s=new o.WebGLRenderTarget(32,32,t);s.texture.name=e,this.renderTargets.set(e,s)}resize(e,t){const s=this.dpr;this.renderTargets.forEach(n=>{n.setSize(e*s,t*s)}),this.renderer?.setSize(e,t)}set dpr(e){this.renderer?.setPixelRatio(Te(1,2,e))}get dpr(){return this.renderer!==void 0?this.renderer?.getPixelRatio():1}get width(){return this.renderer!==void 0?this.renderer.domElement.width/this.dpr:0}get height(){return this.renderer!==void 0?this.renderer.domElement.height/this.dpr:0}get canvas(){return this.renderer!==void 0?this.renderer?.domElement:null}}var ai={exports:{}},Ke={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("three"),w=require("react"),is=require("framer-motion"),ui=()=>{},Bs=()=>{};function dt(i){return i.substring(0,1).toUpperCase()+i.substring(1)}function ss(i){const e=JSON.stringify(i);return navigator.clipboard.writeText(e),e}function Te(i,e,t){return Math.min(e,Math.max(i,t))}function si(i,e,t){return(t-i)/(e-i)}function Rt(i,e,t){return i*(1-t)+e*t}function Ys(i,e){const t=i-e;return Math.sqrt(t*t)}function ns(){return Math.round(Math.random()*1e6).toString()}function rs(i){return i.r!==void 0&&i.g!==void 0&&i.b!==void 0}function ni(i){const e=Math.round(i.r*255),t=Math.round(i.g*255),s=Math.round(i.b*255),n=h=>{const c=h.toString(16);return c.length===1?"0"+c:c},a=n(e),r=n(t),l=n(s);return"#"+a+r+l}function pe(i,e=1){return Number(i.toFixed(e))}exports.totalThreeObjects=0;const ri=()=>{exports.totalThreeObjects=0},Dt=i=>{if(!i)return;let e=i.name.replaceAll(" ","").replaceAll("/",".");if(e.length===0&&(e=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),i.parent!==null&&i.parent.uuid.length>0&&(e=`${i.parent.uuid}.${e}`),i.uuid=e,i.isMesh!==void 0){const t=i;if(Array.isArray(t.material))t.material.forEach((s,n)=>{s.uuid=`${e}.material.${n}`});else{const s=t.material;s.uuid=`${e}.material`}}i.children.forEach(t=>Dt(t))},Gs=i=>{i?.dispose()},as=i=>{i&&(Array.isArray(i)?i.forEach(e=>e.dispose()):i.dispose())},Se=i=>{if(i){for(;i.children.length>0;){const e=i.children[0];e.type==="Audio"?(e.pause(),e.parent&&e.parent.remove(e)):Se(e)}if(i.parent&&i.parent.remove(i),i.isMesh){const e=i;e.geometry?.dispose(),as(e.material)}i.dispose!==void 0&&i.dispose()}};class ht{static renderer;static canvas;static context=null;static scene=null;static camera=null;static material=null;static inited=!1;static width=100;static height=100;static init(){this.inited||(this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.context=this.canvas.getContext("2d"),this.inited=!0)}static renderToBlob(e){this.init();const t=e.repeat.clone(),s=e.offset.clone();if(e.repeat.set(1,1),e.offset.set(0,0),this.context!==null){this.context.clearRect(0,0,this.width,this.height);const n=e.image;if(n!=null&&n.width>0){this.canvas.title=e.sourceFile;const a=this.canvas.width/n.width,r=this.renderToCanvas(e);this.context.drawImage(r,0,0,n.width*a,n.height*a)}}return e.repeat.copy(t),e.offset.copy(s),this.canvas.toDataURL("image/png")}static renderToCanvas(e){if(this.material===null){this.camera=new o.OrthographicCamera(-.5,.5,.5,-.5,0,100),this.scene=new o.Scene,this.material=new o.MeshBasicMaterial;const t=new o.BufferGeometry;t.setAttribute("position",new o.Float32BufferAttribute([-.5,-.5,0,1.5,-.5,0,-.5,1.5,0],3)),t.setAttribute("normal",new o.Float32BufferAttribute([0,0,1,0,0,1],3)),t.setAttribute("uv",new o.Float32BufferAttribute([0,0,2,0,0,2],2));const s=new o.Mesh(t,this.material);this.scene.add(s)}if(e.isRenderTargetTexture)this.material.map=e,this.renderer.render(this.scene,this.camera);else{const t=this.renderer.outputColorSpace,s=e.colorSpace;this.renderer.outputColorSpace=o.LinearSRGBColorSpace,e.colorSpace=o.LinearSRGBColorSpace,this.material.map=e,this.renderer.render(this.scene,this.camera),this.renderer.outputColorSpace=t,e.colorSpace=s}return this.renderer.domElement}}class Zs{components=new Map;listen;_appID="";_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(e,t,s=!0){this._appID=e,this._debugEnabled=t,t&&(this._useBC=s,s?(this._broadcastChannel=new BroadcastChannel(e),this._broadcastChannel.addEventListener("message",this.messageHandler)):(this._webSocket=new WebSocket(e),this._webSocket.addEventListener("open",this.openHandler),this._webSocket.addEventListener("close",this.closeHandler),this._webSocket.addEventListener("message",this.messageHandler)))}addComponent(e,t){this.components.set(e,t)}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(e=>{e.dispose()}),this.components.clear()}send(e){this._mode!==e.target&&(this._useBC?this._broadcastChannel?.postMessage(e):this._connected&&this._webSocket?.send(JSON.stringify(e)))}messageHandler=e=>{this.listen!==void 0&&(this._useBC?this.listen(e.data):this.listen(JSON.parse(e.data)))};openHandler=()=>{this._connected=!0};closeHandler=()=>{this._connected=!1};get appID(){return this._appID}get connected(){return this._connected}get debugEnabled(){return this._debugEnabled}get mode(){return this._mode}get isApp(){return this._mode==="app"}get editor(){return this._mode==="editor"}set editor(e){e&&(this._mode="editor")}}var P=(i=>(i.CUSTOM="ToolEvents::custom",i.SELECT_DROPDOWN="ToolEvents::selectDropdown",i.DRAG_UPDATE="ToolEvents::dragUpdate",i.ADD_SCENE="ToolEvents::addScene",i.REFRESH_SCENE="ToolEvents::refreshScene",i.REMOVE_SCENE="ToolEvents::removeScene",i.SET_SCENE="ToolEvents::setScene",i.GET_OBJECT="ToolEvents::getObject",i.SET_OBJECT="ToolEvents::setObject",i.UPDATE_OBJECT="ToolEvents::updateObject",i.CREATE_TEXTURE="ToolEvents::createTexture",i.REQUEST_METHOD="ToolEvents::requestMethod",i.ADD_CAMERA="ToolEvents::addCamera",i.REMOVE_CAMERA="ToolEvents::removeCamera",i.ADD_GROUP="ToolEvents::addGroup",i.REMOVE_GROUP="ToolEvents::removeGroup",i.ADD_SPLINE="ToolEvents::addSpline",i))(P||{});const R=new o.EventDispatcher;class Lt{app;constructor(e){this.app=e}dispose(){}handleApp(e,t,s){}handleEditor(e,t,s){}}class Ws extends Lt{selectDropdown(e,t){this.app.send({event:"selectComponent",target:"app",data:{dropdown:e,value:t}})}updateDropdown(e,t){this.app.send({event:"draggableListUpdate",target:"app",data:{dropdown:e,value:t}})}handleApp(e,t,s){switch(s.event){case"selectComponent":R.dispatchEvent({type:P.SELECT_DROPDOWN,value:s.data});break;case"draggableListUpdate":R.dispatchEvent({type:P.DRAG_UPDATE,value:s.data});break}}}function Xs(i,e,t){if(i.editor){t.ui.restore(),t.onSelectionChange(r=>{r.length<1||r.forEach(l=>{let h=l.address.sheetId,c="setSheet",p={};switch(l.type){case"Theatre_Sheet_PublicAPI":c="setSheet",p={sheet:l.address.sheetId},e.activeSheet=e.sheets.get(l.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":c="setSheetObject",h+=`_${l.address.objectKey}`,p={id:h,sheet:l.address.sheetId,key:l.address.objectKey},e.activeSheet=e.sheets.get(l.address.sheetId);break}i.send({event:c,target:"app",data:p})})});let s=-1;const n=()=>{if(e.activeSheet!==void 0&&s!==e.activeSheet.sequence.position){s=e.activeSheet.sequence.position;const r=e.activeSheet;i.send({event:"updateTimeline",target:"app",data:{position:s,sheet:r.address.sheetId}})}},a=()=>{n(),requestAnimationFrame(a)};n(),a()}else t.ui.hide()}function Qs(){setTimeout(()=>{const i=document.getElementById("theatrejs-studio-root");if(i===null||i.shadowRoot===null)return;const e=i.shadowRoot.getElementById("pointer-root");if(e===null)return;const t=e.children[0];if(t===null)return;const s=t.children[1];s.style.justifyContent="left";try{const n=s.children[1];for(n.style.transform="translateX(10px)";n.children.length>1;)n.removeChild(n.children[0])}catch{}try{const n=t.children[3];n.style.top="0",n.style.right="300px"}catch{}},1e3)}class qs extends Lt{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;dispose(){this.project=void 0,this.sheets=new Map,this.sheetObjects=new Map,this.sheetObjectCBs=new Map,this.sheetObjectUnsubscribe=new Map}getSheetInstance(e,t){return t!==void 0?`${e}-${t}`:e}sheet(e,t){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const s=this.getSheetInstance(e,t);let n=this.sheets.get(s);return n!==void 0||(n=this.project?.sheet(e,t),this.sheets.set(s,n)),n}playSheet(e,t,s){return new Promise(n=>{const a=t!==void 0?{...t}:{};this.sheet(e,s)?.sequence.play(a).then(r=>n(r)),this.app.send({event:"playSheet",target:"editor",data:{sheet:e,instance:s,value:t}})})}pauseSheet(e,t){this.sheet(e,t)?.sequence.pause(),this.app.send({event:"pauseSheet",target:"editor",data:{sheet:e,instance:t}})}clearSheetObjects(e){this.sheetObjects.forEach((t,s)=>{s.search(`${e}_`)>-1&&this.unsubscribe(t)})}sheetObject(e,t,s,n,a){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const r=this.sheet(e,a);if(r===void 0)return;const h=`${this.getSheetInstance(e,a)}_${t}`;let c=this.sheetObjects.get(h);c!==void 0?c=r.object(t,{...s,...c.value},{reconfigure:!0}):c=r.object(t,s),this.sheetObjects.set(h,c),this.sheetObjectCBs.set(h,n!==void 0?n:ui);const p=c.onValuesChange(m=>{if(this.app.editor){for(const y in m){const x=m[y];typeof x=="object"&&rs(x)&&(m[y]={r:x.r,g:x.g,b:x.b,a:x.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:e,sheetObject:h,values:m}})}const f=this.sheetObjectCBs.get(h);f!==void 0&&f(m)});return this.sheetObjectUnsubscribe.set(h,p),c}unsubscribe(e){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const t=e.address.sheetId,s=e.address.objectKey;this.sheets.get(t)?.detachObject(s);const a=`${t}_${s}`,r=this.sheetObjectUnsubscribe.get(a);r!==void 0&&(this.sheetObjects.delete(a),this.sheetObjectCBs.delete(a),this.sheetObjectUnsubscribe.delete(a),r())}handleApp(e,t,s){const n=t;let a;switch(s.event){case"setSheet":a=n.sheets.get(s.data.sheet),a!==void 0&&(n.activeSheet=a,this.studio?.setSelection([a]));break;case"setSheetObject":a=n.sheetObjects.get(`${s.data.sheet}_${s.data.key}`),a!==void 0&&this.studio?.setSelection([a]);break;case"updateSheetObject":a=n.sheets.get(s.data.sheet),a!==void 0&&a.sequence.pause(),a=n.sheetObjectCBs.get(s.data.sheetObject),a!==void 0&&a(s.data.values);break;case"updateTimeline":a=n.sheets.get(s.data.sheet),n.activeSheet!==void 0&&(n.activeSheet.sequence.position=s.data.position);break}}handleEditor(e,t,s){if(e.editor){const n=t;switch(s.event){case"playSheet":n.sheet(s.data.sheet,s.data.instance)?.sequence.play(s.data.value);break;case"pauseSheet":n.sheet(s.data.sheet,s.data.instance)?.sequence.pause();break}}}handleEditorApp(e,t){if(e.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(r=>{r.length<1||r.forEach(l=>{let h=l.address.sheetId,c="setSheet",p={};switch(l.type){case"Theatre_Sheet_PublicAPI":c="setSheet",p={sheet:l.address.sheetId},t.activeSheet=t.sheets.get(l.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":c="setSheetObject",h+=`_${l.address.objectKey}`,p={id:h,sheet:l.address.sheetId,key:l.address.objectKey},t.activeSheet=t.sheets.get(l.address.sheetId);break}e.send({event:c,target:"app",data:p})})});let s=-1;const n=()=>{if(t.activeSheet!==void 0&&s!==t.activeSheet.sequence.position){s=t.activeSheet.sequence.position;const r=t.activeSheet;e.send({event:"updateTimeline",target:"app",data:{position:s,sheet:r.address.sheetId}})}},a=()=>{n(),requestAnimationFrame(a)};n(),a()}else this.studio?.ui.hide()}}function Ks(i){if(i.name==="cameras")return"camera";if(i.name==="interactive")return"interactive";if(i.name==="lights")return"light";if(i.name==="ui")return"ui";if(i.name==="utils")return"utils";const e=i.type;return e.search("Helper")>-1?"icon_utils":e.search("Camera")>-1?"camera":e.search("Light")>-1?"light":"obj3D"}function Xe(i){const e={name:i.name,type:i.type,uuid:i.uuid,children:[]};return i.children.forEach(t=>{e.children.push(Xe(t))}),e}function $s(i){const e={};for(const t in i){const s=i[t].value;e[t]={value:s},s===null?e[t].value={src:"",offset:[0,0],repeat:[1,1]}:s!==void 0&&s.isTexture&&(e[t].value={src:s.image.src,offset:[s.offset.x,s.offset.y],repeat:[s.repeat.x,s.repeat.y]})}return e}function Js(i){switch(i){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function He(i){const e={};for(const t in i){if(t.substring(0,1)==="_"||t.substring(0,2)==="is"||Js(t))continue;const s=typeof i[t],n=i[t];switch(s){case"boolean":case"number":case"string":e[t]=n;break;case"object":n!==null?(e[t]=n,n.isTexture?e[t]={src:ht.renderToBlob(n),offset:[n.offset.x,n.offset.y],repeat:[n.repeat.x,n.repeat.y]}:t==="uniforms"&&(e[t]=$s(e[t]))):t==="glslVersion"?e[t]="":e[t]={src:"",offset:[0,0],repeat:[1,1]};break}}return i.anisotropy!==void 0&&(e.anisotropy=i.anisotropy),i.clearcoat!==void 0&&(e.clearcoat=i.clearcoat),i.iridescence!==void 0&&(e.iridescence=i.iridescence),i.dispersion!==void 0&&(e.dispersion=i.dispersion),i.sheen!==void 0&&(e.sheen=i.sheen),i.transmission!==void 0&&(e.transmission=i.transmission),i.transmission!==void 0&&(e.transmission=i.transmission),e}function Gt(i){i.updateMatrix();const e={name:i.name,type:i.type,uuid:i.uuid,visible:i.visible,matrix:i.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};i.animations.forEach(s=>{e.animations.push({name:s.name,duration:s.duration,blendMode:s.blendMode})});const t=i.type.toLowerCase();if(t.search("mesh")>-1){const s=i;if(Array.isArray(s.material)){const n=[];s.material.forEach(a=>{n.push(He(a))}),e.material=n}else e.material=He(s.material)}else if(t.search("points")>-1){const s=i;if(Array.isArray(s.material)){const n=[];s.material.forEach(a=>{n.push(He(a))}),e.material=n}else e.material=He(s.material)}else if(t.search("line")>-1){const s=i;if(Array.isArray(s.material)){const n=[];s.material.forEach(a=>{n.push(He(a))}),e.material=n}else e.material=He(s.material)}else t.search("camera")>-1?i.type==="PerspectiveCamera"?e.perspectiveCameraInfo={fov:i.fov,zoom:i.zoom,near:i.near,far:i.far,focus:i.focus,aspect:i.aspect,filmGauge:i.filmGauge,filmOffset:i.filmOffset}:i.type==="OrthographicCamera"&&(e.orthographicCameraInfo={zoom:i.zoom,near:i.near,far:i.far,left:i.left,right:i.right,top:i.top,bottom:i.bottom}):t.search("light")>-1&&(e.lightInfo={color:i.color,intensity:i.intensity,decay:i.decay,distance:i.distance,angle:i.angle,penumbra:i.penumbra,groundColor:i.groundColor,width:i.width,height:i.height});return e}function en(i,e){const t=e.split(".");switch(t.length){case 1:return i[t[0]];case 2:return i[t[0]][t[1]];case 3:return i[t[0]][t[1]][t[2]];case 4:return i[t[0]][t[1]][t[2]][t[3]];case 5:return i[t[0]][t[1]][t[2]][t[3]][t[4]];case 6:return i[t[0]][t[1]][t[2]][t[3]][t[4]][t[5]]}}function tn(i,e){for(const t in e)i[t]=e[t]}function K(i,e,t){if(i===void 0)return;const s=e.split("."),n=s.length;if(typeof t!="object")switch(n){case 1:i[s[0]]=t;break;case 2:i[s[0]][s[1]]=t;break;case 3:i[s[0]][s[1]][s[2]]=t;break;case 4:i[s[0]][s[1]][s[2]][s[3]]=t;break;case 5:i[s[0]][s[1]][s[2]][s[3]][s[4]]=t;break}else{let r;switch(n){case 1:r=i[s[0]];break;case 2:r=i[s[0]][s[1]];break;case 3:r=i[s[0]][s[1]][s[2]];break;case 4:r=i[s[0]][s[1]][s[2]][s[3]];break;case 5:r=i[s[0]][s[1]][s[2]][s[3]][s[4]];break}r!=null&&tn(r,t)}}function os(i){return new Promise((e,t)=>{const s=new Image;s.onload=()=>{const n=new o.Texture(s);n.wrapS=o.RepeatWrapping,n.wrapT=o.RepeatWrapping,n.needsUpdate=!0,e(n)},s.onerror=t,s.src=i})}class sn extends Lt{scene=void 0;scenes=new Map;renderer=void 0;renderTargets=new Map;groups=new Map;dispose(){this.scenes.forEach(e=>{Se(e)}),this.scenes.clear(),this.scene&&Se(this.scene),this.renderTargets.forEach(e=>{e.dispose()}),this.renderTargets.clear(),this.renderer?.dispose()}getObject(e){this.app.debugEnabled&&(this.renderer!==void 0&&(ht.renderer=this.renderer),this.app.send({event:"getObject",target:"app",data:e}))}setObject(e){this.renderer!==void 0&&(ht.renderer=this.renderer);const t=Gt(e);this.app.send({event:"setObject",target:"editor",data:t})}requestMethod(e,t,s,n){this.app.send({event:"requestMethod",target:"app",data:{uuid:e,key:t,value:s,subitem:n}})}updateObject(e,t,s){this.app.send({event:"updateObject",target:"app",data:{uuid:e,key:t,value:s}})}createTexture(e,t,s){this.app.send({event:"createTexture",target:"app",data:{uuid:e,key:t,value:s}})}addGroup(e){this.groups.get(e.title)===void 0&&(this.groups.set(e.title,{title:e.title,onUpdate:e.onUpdate}),this.app.send({event:"addGroup",target:"editor",data:JSON.stringify(e)}))}removeGroup(e){this.groups.get(e)!==void 0&&(this.groups.delete(e),this.app.send({event:"removeGroup",target:"editor",data:e}))}updateGroup(e,t,s){this.app.send({event:"updateGroup",target:"app",data:JSON.stringify({group:e,prop:t,value:s})})}removeAllGroups(){this.groups.forEach(e=>{const t=e.title;this.groups.delete(t),this.app.send({event:"removeGroup",target:"editor",data:t})}),this.groups.clear()}addSpline(e){setTimeout(()=>{this.app.send({event:"addSpline",target:"editor",data:JSON.stringify(e.toJSON())})},1)}addScene(e){if(e===void 0||(this.scenes.set(e.name,e),!this.app.debugEnabled))return;ri(),Dt(e);const t=Xe(e);this.app.send({event:"addScene",target:"editor",data:t})}refreshScene(e){if(!this.app.debugEnabled)return;const t=this.scenes.get(e);if(t!==void 0){const s=Xe(t);this.app.send({event:"refreshScene",target:"app",data:s})}}removeScene(e){if(e===void 0||(this.scenes.delete(e.name),!this.app.debugEnabled))return;const t=Xe(e);this.app.send({event:"removeScene",target:"editor",data:t})}removeAllScenes(){this.scenes.forEach(e=>this.removeScene(e))}getScene(e){let t=null;return this.scenes.forEach((s,n)=>{e.search(n)>-1&&(t=s)}),t}setScene(e){if(e===void 0||(this.scene=e,!this.app.debugEnabled))return;this.renderer!==void 0&&(ht.renderer=this.renderer),ri(),Dt(e);const t=Xe(e);this.app.send({event:"setScene",target:"editor",data:t})}addCamera(e){if(!this.app.debugEnabled)return;const t=Gt(e);this.app.send({event:"addCamera",target:"editor",data:t})}removeCamera(e){if(!this.app.debugEnabled)return;const t=Gt(e);this.app.send({event:"removeCamera",target:"editor",data:t})}handleApp(e,t,s){const n=t;switch(s.event){case"getObject":R.dispatchEvent({type:P.GET_OBJECT,value:s.data});break;case"updateObject":R.dispatchEvent({type:P.UPDATE_OBJECT,value:s.data});break;case"createTexture":R.dispatchEvent({type:P.CREATE_TEXTURE,value:s.data});break;case"requestMethod":R.dispatchEvent({type:P.REQUEST_METHOD,value:s.data});break;case"refreshScene":e.send({event:"refreshScene",target:"editor",data:Xe(n.scenes.get(s.data.name))});break}if(s.event==="updateGroup"){const a=JSON.parse(s.data);n.groups.get(a.group)?.onUpdate(a.prop,a.value)}}handleEditor(e,t,s){switch(s.event){case"setObject":R.dispatchEvent({type:P.SET_OBJECT,value:s.data});break;case"addScene":R.dispatchEvent({type:P.ADD_SCENE,value:s.data});break;case"refreshScene":R.dispatchEvent({type:P.REFRESH_SCENE,value:s.data});break;case"removeScene":R.dispatchEvent({type:P.REMOVE_SCENE,value:s.data});break;case"setScene":R.dispatchEvent({type:P.SET_SCENE,value:s.data});break;case"addCamera":R.dispatchEvent({type:P.ADD_CAMERA,value:s.data});break;case"removeCamera":R.dispatchEvent({type:P.REMOVE_CAMERA,value:s.data});break;case"addGroup":R.dispatchEvent({type:P.ADD_GROUP,value:s.data});break;case"removeGroup":R.dispatchEvent({type:P.REMOVE_GROUP,value:s.data});break;case"addSpline":R.dispatchEvent({type:P.ADD_SPLINE,value:s.data});break}}addRT(e,t){const s=new o.WebGLRenderTarget(32,32,t);s.texture.name=e,this.renderTargets.set(e,s)}resize(e,t){const s=this.dpr;this.renderTargets.forEach(n=>{n.setSize(e*s,t*s)}),this.renderer?.setSize(e,t)}set dpr(e){this.renderer?.setPixelRatio(Te(1,2,e))}get dpr(){return this.renderer!==void 0?this.renderer?.getPixelRatio():1}get width(){return this.renderer!==void 0?this.renderer.domElement.width/this.dpr:0}get height(){return this.renderer!==void 0?this.renderer.domElement.height/this.dpr:0}get canvas(){return this.renderer!==void 0?this.renderer?.domElement:null}}var ai={exports:{}},Ke={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
package/dist/hermes.es.js CHANGED
@@ -268,13 +268,30 @@ function Qr(i, e, t) {
268
268
  t.ui.hide();
269
269
  }
270
270
  function $r() {
271
- const i = document.getElementById("theatrejs-studio-root")?.shadowRoot?.getElementById("pointer-root")?.children[0], e = i?.children[1];
272
- e.style.justifyContent = "left";
273
- const t = e.children[1];
274
- for (t.style.transform = "translateX(10px)"; t.children.length > 1; )
275
- t.removeChild(t.children[0]);
276
- const s = i?.children[3];
277
- s.style.top = "0", s.style.right = "300px";
271
+ setTimeout(() => {
272
+ const i = document.getElementById("theatrejs-studio-root");
273
+ if (i === null || i.shadowRoot === null)
274
+ return;
275
+ const e = i.shadowRoot.getElementById("pointer-root");
276
+ if (e === null)
277
+ return;
278
+ const t = e.children[0];
279
+ if (t === null)
280
+ return;
281
+ const s = t.children[1];
282
+ s.style.justifyContent = "left";
283
+ try {
284
+ const n = s.children[1];
285
+ for (n.style.transform = "translateX(10px)"; n.children.length > 1; )
286
+ n.removeChild(n.children[0]);
287
+ } catch {
288
+ }
289
+ try {
290
+ const n = t.children[3];
291
+ n.style.top = "0", n.style.right = "300px";
292
+ } catch {
293
+ }
294
+ }, 1e3);
278
295
  }
279
296
  class qr extends Li {
280
297
  project;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.esm.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.0.109",
10
+ "version": "0.0.110",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"