@tomorrowevening/hermes 0.0.143 → 0.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hermes.cjs.js
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
|
16
16
|
gl_FragColor = enc;
|
17
17
|
}
|
18
|
-
`,d=c.createShader(35633),p=c.createShader(35632),f=c.createProgram();if(!(p&&d&&f))return;c.shaderSource(d,h),c.shaderSource(p,u),c.compileShader(d),c.compileShader(p),c.attachShader(f,d),c.attachShader(f,p),c.linkProgram(f),c.detachShader(f,d),c.detachShader(f,p),c.deleteShader(d),c.deleteShader(p),c.useProgram(f);const m=c.createBuffer();c.bindBuffer(34962,m),c.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const y=c.getAttribLocation(f,"aPosition");c.vertexAttribPointer(y,3,5126,!1,0,0),c.enableVertexAttribArray(y),c.clearColor(1,1,1,1),c.clear(16384),c.viewport(0,0,1,1),c.drawArrays(4,0,3);const g=new Uint8Array(4);return c.readPixels(0,0,1,1,6408,5121,g),c.deleteProgram(f),c.deleteBuffer(m),g.join("")}(a),i="801621810",n="8016218135",r="80162181161",o=Ps?.isIpad?[["a7",r,12],["a8",n,15],["a8x",n,15],["a9",n,15],["a9x",n,15],["a10",n,15],["a10x",n,15],["a12",i,15],["a12x",i,15],["a12z",i,15],["a14",i,15],["a15",i,15],["m1",i,15],["m2",i,15]]:[["a7",r,12],["a8",n,12],["a9",n,15],["a10",n,15],["a11",i,15],["a12",i,15],["a13",i,15],["a14",i,15],["a15",i,15],["a16",i,15],["a17",i,15]];let l;return s==="80162181255"?l=o.filter(([,,c])=>c>=14):(l=o.filter(([,c])=>c===s),l.length||(l=o)),l.map(([c])=>`apple ${c} gpu`)}class dd extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const Bl=[],pd=[];function f0(a,e){if(a===e)return 0;const t=a;a.length>e.length&&(a=e,e=t);let s=a.length,i=e.length;for(;s>0&&a.charCodeAt(~-s)===e.charCodeAt(~-i);)s--,i--;let n,r=0;for(;r<s&&a.charCodeAt(r)===e.charCodeAt(r);)r++;if(s-=r,i-=r,s===0)return i;let o,l,c=0,h=0,u=0;for(;h<s;)pd[h]=a.charCodeAt(r+h),Bl[h]=++h;for(;u<i;)for(n=e.charCodeAt(r+u),o=u++,c=u,h=0;h<s;h++)l=n===pd[h]?o:o+1,o=Bl[h],c=Bl[h]=o>c?l>c?c+1:l:l>o?o+1:l;return c}function m0(a){return a!=null}const g0=({mobileTiers:a=[0,15,30,60],desktopTiers:e=[0,15,30,60],override:t={},glContext:s,failIfMajorPerformanceCaveat:i=!1,benchmarksURL:n="https://unpkg.com/detect-gpu@5.0.70/dist/benchmarks"}={})=>Ol(void 0,void 0,void 0,function*(){const r={};if(Qf)return{tier:0,type:"SSR"};const{isIpad:o=!!Ps?.isIpad,isMobile:l=!!Ps?.isMobile,screenSize:c=window.screen,loadBenchmarks:h=S=>Ol(void 0,void 0,void 0,function*(){const E=yield fetch(`${n}/${S}`).then(w=>w.json());if(parseInt(E.shift().split(".")[0],10)<4)throw new dd("Detect GPU benchmark data is out of date. Please update to version 4x");return E})}=t;let{renderer:u}=t;const d=(S,E,w,R,P)=>({device:P,fps:R,gpu:w,isMobile:l,tier:S,type:E});let p,f="";if(u)u=ud(u),p=[u];else{const S=s||function(w,R=!1){const P={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:R,powerPreference:"high-performance",stencil:!1};w&&delete P.powerPreference;const z=window.document.createElement("canvas"),$=z.getContext("webgl",P)||z.getContext("experimental-webgl",P);return $??void 0}(Ps?.isSafari12,i);if(!S)return d(0,"WEBGL_UNSUPPORTED");const E=Ps?.isFirefox?null:S.getExtension("WEBGL_debug_renderer_info");if(u=E?S.getParameter(E.UNMASKED_RENDERER_WEBGL):S.getParameter(S.RENDERER),!u)return d(1,"FALLBACK");f=u,u=ud(u),p=function(w,R,P){return R==="apple gpu"?p0(w,R,P):[R]}(S,u,l)}const m=(yield Promise.all(p.map(function(S){var E;return Ol(this,void 0,void 0,function*(){const w=(_e=>{const at=l?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce","adreno"];for(const Dt of at)if(_e.includes(Dt))return Dt})(S);if(!w)return;const R=`${l?"m":"d"}-${w}${o?"-ipad":""}.json`,P=r[R]=(E=r[R])!==null&&E!==void 0?E:h(R);let z;try{z=yield P}catch(_e){if(_e instanceof dd)throw _e;return}const $=function(_e){var at;const Dt=(_e=_e.replace(/\([^)]+\)/,"")).match(/\d+/)||_e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return(at=Dt?.join("").replace(/\W|amd/g,""))!==null&&at!==void 0?at:""}(S);let q=z.filter(([,_e])=>_e===$);q.length||(q=z.filter(([_e])=>_e.includes(S)));const j=q.length;if(j===0)return;const X=S.split(/[.,()\[\]/\s]/g).sort().filter((_e,at,Dt)=>at===0||_e!==Dt[at-1]).join(" ");let Z,[ve,,,,ue]=j>1?q.map(_e=>[_e,f0(X,_e[2])]).sort(([,_e],[,at])=>_e-at)[0][0]:q[0],ge=Number.MAX_VALUE;const{devicePixelRatio:ie}=window,we=c.width*ie*c.height*ie;for(const _e of ue){const[at,Dt]=_e,yr=at*Dt,mn=Math.abs(we-yr);mn<ge&&(ge=mn,Z=_e)}if(!Z)return;const[,,ke,rt]=Z;return[ge,ke,ve,rt]})}))).filter(m0).sort(([S=Number.MAX_VALUE,E],[w=Number.MAX_VALUE,R])=>S===w?E-R:S-w);if(!m.length){const S=d0.find(E=>u.includes(E));return S?d(0,"BLOCKLISTED",S):d(1,"FALLBACK",`${u} (${f})`)}const[,y,g,_]=m[0];if(y===-1)return d(0,"BLOCKLISTED",g,y,_);const b=l?a:e;let T=0;for(let S=0;S<b.length;S++)y>=b[S]&&(T=S);return d(T,"BENCHMARK",g,y,_)});var Kf=(a=>(a[a.High=0]="High",a[a.Medium=1]="Medium",a[a.Low=2]="Low",a))(Kf||{});function Jf(a){let e=0;const t=performance.now();function s(){e++;const i=performance.now();if(i-t>=100){const n=e/((i-t)/1e3),r=Math.round(n/30)*30;a(r)}else requestAnimationFrame(s)}requestAnimationFrame(s)}function y0(a,e,t){return new Promise(s=>{g0().then(i=>{let n=!1;const r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);if(n="transferControlToOffscreen"in a,r){const l=navigator.userAgent.match(/version\/(\d+)/i);n=(l?parseInt(l[1]):0)>=17}const o={dpr:devicePixelRatio,fps:30,width:innerWidth,height:innerHeight,mobile:i.isMobile!==void 0?i.isMobile:!1,supportOffScreenCanvas:n,quality:2,dev:e,editor:t};i.tier===3?o.quality=0:i.tier===2&&(o.quality=1),Jf(l=>{o.fps=l,s(o)}),s(o)})})}function Ti(a,e,t){return Math.min(e,Math.max(a,t))}function Lo(a,e,t){return(t-a)/(e-a)}function ir(a,e,t){return a*(1-t)+e*t}function x0(a,e,t,s,i){return ir(t,s,Lo(a,e,i))}function _0(a,e){const t=a-e;return Math.sqrt(t*t)}function ss(a,e=1){return Number(a.toFixed(e))}function b0(a,e,t,s){return ir(a,e,1-Math.exp(-t*s))}function T0(a,e=1){return Number(a.toFixed(e))}function S0(a,e,t,s){return a===e&&t===s}function v0(a,e,t,s){return 1/(3*e*a*a+2*t*a+s)}function w0(a,e,t,s,i){return e*(a*a*a)+t*(a*a)+s*a+i}function M0(a,e,t,s,i){const n=a*a;return e*(n*a)+t*n+s*a+i}function E0(a,e,t,s,i){if(a<=0)return 0;if(a>=1)return 1;if(S0(e,t,s,i))return a;const n=0,r=0,o=e,l=t,c=s,h=i,u=1,d=1,p=u-3*c+3*o-n,f=3*c-6*o+3*n,m=3*o-3*n,y=n,g=d-3*h+3*l-r,_=3*h-6*l+3*r,b=3*l-3*r,T=r;let S=a;for(let E=0;E<5;E++){const w=w0(S,p,f,m,y);let R=v0(S,p,f,m);R===1/0&&(R=a),S-=(w-a)*R,S=Math.min(Math.max(S,0),1)}return M0(S,g,_,b,T)}const ah=a=>{a?.dispose()},Wh=a=>{if(a)if(Array.isArray(a))a.forEach(e=>Wh(e));else{for(const e in a){const t=a[e];t!==null&&t instanceof x.Texture&&ah(t)}if(a.isShaderMaterial===!0){const e=a;for(const t in e.uniforms){const s=e.uniforms[t];s.value!==null&&s.value instanceof x.Texture&&ah(s.value)}}a.dispose()}},Is=a=>{if(a){for(;a.children.length>0;){const e=a.children[0];e.type==="Audio"?(e.pause(),e.parent&&e.parent.remove(e)):Is(e)}if(a.parent&&a.parent.remove(a),a.isMesh){const e=a;e.geometry?.dispose(),Wh(e.material)}a.dispose!==void 0&&a.dispose()}};exports.totalThreeObjects=0;const oh=()=>{exports.totalThreeObjects=0},Uo=a=>{if(!a)return;let e=a.name.replaceAll(" ","").replaceAll("/",".");if(e.length===0&&(e=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),a.parent!==null&&a.parent.uuid.length>0&&(e=`${a.parent.uuid}.${e}`),a.uuid=e,a.isMesh!==void 0){const t=a;if(Array.isArray(t.material))t.material.forEach((s,i)=>{s.uuid=`${e}.material.${i}`});else{const s=t.material;s.uuid=`${e}.material`}}a.children.forEach(t=>Uo(t))};class sa{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 i=e.image;if(i!=null&&i.width>0){this.canvas.title=e.sourceFile;const n=this.canvas.width/i.width,r=this.renderToCanvas(e);this.context.drawImage(r,0,0,i.width*n,i.height*n)}}return e.repeat.copy(t),e.offset.copy(s),this.canvas.toDataURL("image/png")}static renderToCanvas(e){if(this.material===null){this.camera=new x.OrthographicCamera(-.5,.5,.5,-.5,0,100),this.scene=new x.Scene,this.material=new x.MeshBasicMaterial;const t=new x.BufferGeometry;t.setAttribute("position",new x.Float32BufferAttribute([-.5,-.5,0,1.5,-.5,0,-.5,1.5,0],3)),t.setAttribute("normal",new x.Float32BufferAttribute([0,0,1,0,0,1],3)),t.setAttribute("uv",new x.Float32BufferAttribute([0,0,2,0,0,2],2));const s=new x.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=x.LinearSRGBColorSpace,e.colorSpace=x.LinearSRGBColorSpace,this.material.map=e,this.renderer.render(this.scene,this.camera),this.renderer.outputColorSpace=t,e.colorSpace=s}return this.renderer.domElement}}function C0(a){return new Promise(e=>{const t=new x.ObjectLoader;t.parseAsync(a.scene).then(s=>{const i=new x.AnimationMixer(s);if(a.animations.length>0){const r=a.animations.map(l=>x.AnimationClip.parse(l));i.clipAction(r[0]).play(),i.getRoot().animations=a.animations,i.getRoot().mixer=i}const n=[];a.cameras&&a.cameras.length>0&&a.cameras.forEach(r=>{const o=t.parse(r);n.push(o)}),e({animations:a.animations,model:s,mixer:i,cameras:n})})})}const xn=$h(["ctrlKey","metaKey","shiftKey","button","pointerId","pointerType","clientX","clientY","pageX","pageY"]),A0=$h(["clientX","clientY","deltaX","deltaY","deltaMode"]),R0=$h(["ctrlKey","metaKey","shiftKey","keyCode"]);function N0(a,e){a.preventDefault(),A0(a,e)}function P0(a){a.preventDefault()}function F0(a,e,t){for(const s of e)t[s]=a[s]}function $h(a){return function(t,s){const i={type:t.type};F0(t,a,i),s(i)}}function Il(a,e){const t=[],s={type:a.type,touches:t};for(let i=0;i<a.touches.length;++i){const n=a.touches[i];t.push({pageX:n.pageX,pageY:n.pageY})}e(s)}const D0={37:!0,38:!0,39:!0,40:!0};function O0(a,e){const{keyCode:t}=a;D0[t]&&(a.preventDefault(),R0(a,e))}const B0={contextmenu:P0,mousedown:xn,mousemove:xn,mouseup:xn,pointerdown:xn,pointermove:xn,pointerup:xn,touchstart:Il,touchmove:Il,touchend:Il,wheel:N0,keydown:O0};let I0=0;class L0{id;worker;constructor(e,t,s){this.id=I0++,this.worker=t;const i=r=>{this.worker.postMessage({type:"event",id:this.id,data:r})};t.postMessage({type:"makeProxy",id:this.id});for(const[r,o]of Object.entries(s))e.addEventListener(r,l=>{o(l,i)});function n(){i({type:"resize",left:0,top:0,width:innerWidth,height:innerHeight})}window.addEventListener("resize",n),n()}}class em extends x.EventDispatcher{style={};left=0;top=0;width=0;height=0;ownerDocument=void 0;constructor(){super(),this.ownerDocument=this}get clientWidth(){return this.width}set clientWidth(e){this.width=e}get clientHeight(){return this.height}set clientHeight(e){this.height=e}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{x:this.left,y:this.top,left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height,toJSON:()=>({})}}handleEvent(e){if(e.type==="size"){this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height;return}e.preventDefault=ua,e.stopPropagation=ua,this.dispatchEvent(e)}focus(){}getRootNode(){return this}}class U0{targets={};constructor(){this.handleEvent=this.handleEvent.bind(this)}makeProxy(e){const{id:t}=e,s=new em;this.targets[t]=s}getProxy(e){return this.targets[e]}handleEvent(e){this.targets[e.id]?.handleEvent(e.data)}}var Q=(a=>(a.CUSTOM="ToolEvents::custom",a.SELECT_DROPDOWN="ToolEvents::selectDropdown",a.DRAG_UPDATE="ToolEvents::dragUpdate",a.ADD_SCENE="ToolEvents::addScene",a.REFRESH_SCENE="ToolEvents::refreshScene",a.REMOVE_SCENE="ToolEvents::removeScene",a.SET_SCENE="ToolEvents::setScene",a.GET_OBJECT="ToolEvents::getObject",a.SET_OBJECT="ToolEvents::setObject",a.UPDATE_OBJECT="ToolEvents::updateObject",a.CREATE_TEXTURE="ToolEvents::createTexture",a.REQUEST_METHOD="ToolEvents::requestMethod",a.ADD_CAMERA="ToolEvents::addCamera",a.REMOVE_CAMERA="ToolEvents::removeCamera",a.ADD_GROUP="ToolEvents::addGroup",a.REMOVE_GROUP="ToolEvents::removeGroup",a.ADD_SPLINE="ToolEvents::addSpline",a.ADD_RENDERER="ToolEvents::addRenderer",a.UPDATE_RENDERER="ToolEvents::updateRenderer",a))(Q||{});class k0 extends x.EventDispatcher{components=new Map;appHandlers=[];editorHandlers=[];_appID="";_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(e,t,s,i=!0){super(),this._appID=e,this._debugEnabled=t,this.editor=s,t&&(this._useBC=i,i?(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=>{let t=e.data;this._useBC||(t=JSON.parse(e.data)),t.target==="editor"?this.handleEditorBroadcast(t):this.handleAppBroadcast(t)};handleAppBroadcast(e){switch(this.appHandlers.forEach(t=>{t.callback(e)}),e.event){case"custom":this.dispatchEvent({type:"ToolEvents::custom",value:e.data});break}}handleEditorBroadcast(e){switch(this.editorHandlers.forEach(t=>{t.callback(e)}),e.event){case"custom":this.dispatchEvent({type:"ToolEvents::custom",value:e.data});break}}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")}}class z0{canvas;inputElement;settings;playing=!1;rafID=-1;constructor(e,t,s){this.canvas=e,this.inputElement=t,this.settings=s}dispose(){this.stop()}play(){this.playing||(this.playing=!0,this.onUpdate())}stop(){this.playing&&(this.playing=!1,cancelAnimationFrame(this.rafID),this.rafID=-1)}update(){}draw(){}resize(e,t){this.settings.supportOffScreenCanvas&&(this.inputElement.clientWidth=e,this.inputElement.clientHeight=t,this.inputElement.width=e,this.inputElement.height=t)}onResize=e=>{this.resize(e.width,e.height)};onUpdate=()=>{this.update(),this.draw(),this.rafID=requestAnimationFrame(this.onUpdate)}}class G0 extends x.Scene{clock;cameras;lights;world;constructor(e){super(),this.name=e,this.clock=new x.Clock,this.lights=new x.Group,this.lights.name="lights",this.add(this.lights),this.cameras=new x.Group,this.cameras.name="cameras",this.add(this.cameras),this.world=new x.Group,this.world.name="world",this.add(this.world)}init(){return new Promise(e=>{this.setupLights().then(()=>this.setupCameras()).then(()=>this.setupWorld()).then(()=>this.setupPost()).then(()=>this.setupAnimation()).then(()=>this.setupDebug()).then(()=>e())})}setupLights(){return new Promise(e=>{e()})}setupCameras(){return new Promise(e=>{e()})}setupWorld(){return new Promise(e=>{e()})}setupPost(){return new Promise(e=>{e()})}setupAnimation(){return new Promise(e=>{e()})}setupDebug(){return new Promise(e=>{e()})}dispose(){}update(){}draw(e){}postDraw(){}resize(e,t,s){}show(){this.clock.start(),this.showComplete()}showComplete(){this.enable()}hide(){this.disable(),this.hideComplete()}hideComplete(){this.clock.stop()}enable(){}disable(){}get deltaTime(){return Math.min(this.clock.getDelta(),1/30)}}class al{app;constructor(e){this.app=e,this.app.appHandlers.push({remote:this,callback:this.handleApp.bind(this)}),this.app.editorHandlers.push({remote:this,callback:this.handleEditor.bind(this)})}dispose(){const e=this.app.appHandlers.findIndex(t=>t.remote===this);e>-1&&(this.app.appHandlers.splice(e,1),this.app.editorHandlers.splice(e,1))}handleApp(e){}handleEditor(e){}}class V0 extends al{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){switch(e.event){case"selectComponent":this.app.dispatchEvent({type:Q.SELECT_DROPDOWN,value:e.data});break;case"draggableListUpdate":this.app.dispatchEvent({type:Q.DRAG_UPDATE,value:e.data});break}}}function H0(a,e,t){if(a.editor){t.ui.restore(),t.onSelectionChange(r=>{r.length<1||r.forEach(o=>{let l=o.address.sheetId,c="setSheet",h={};switch(o.type){case"Theatre_Sheet_PublicAPI":c="setSheet",h={sheet:o.address.sheetId},e.activeSheet=e.sheets.get(o.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":c="setSheetObject",l+=`_${o.address.objectKey}`,h={id:l,sheet:o.address.sheetId,key:o.address.objectKey},e.activeSheet=e.sheets.get(o.address.sheetId);break}a.send({event:c,target:"app",data:h})})});let s=-1;const i=()=>{if(e.activeSheet!==void 0&&s!==e.activeSheet.sequence.position){s=e.activeSheet.sequence.position;const r=e.activeSheet;a.send({event:"updateTimeline",target:"app",data:{position:s,sheet:r.address.sheetId}})}},n=()=>{i(),requestAnimationFrame(n)};i(),n()}else t.ui.hide()}async function W0(){for(;!document.getElementById("theatrejs-studio-root");)await new Promise(i=>setTimeout(i,100));const a=document.getElementById("theatrejs-studio-root");if(a===null||a.shadowRoot===null)return;const e=a.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 i=s.children[1];for(i.style.transform="translateX(10px)";i.children.length>1;)i.removeChild(i.children[0])}catch{}try{const i=t.children[3];i.style.top="0",i.style.right="300px"}catch{}}function $0(a,e,t,s,i){const n=1-a;return n*n*n*e+3*n*n*a*t+3*n*a*a*s+a*a*a*i}function j0(a,e,t){if(a.type!=="bezier"||a.handles.length!==4)throw new Error("Invalid keyframe data for Bézier interpolation.");const[s,i]=a.handles,n=(t-a.position)/(e.position-a.position);return $0(n,a.value,a.value+s,e.value+i,e.value)}class q0 extends al{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;constructor(e){super(e),window.RemoteTheatre=this}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 i=this.sheets.get(s);return i!==void 0||(i=this.project?.sheet(e,t),this.sheets.set(s,i)),i}playSheet(e,t,s){return new Promise(i=>{const n=t!==void 0?{...t}:{};this.sheet(e,s)?.sequence.play(n).then(r=>i(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,i,n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const r=this.sheet(e,n);if(r===void 0)return;const l=`${this.getSheetInstance(e,n)}_${t}`;let c=this.sheetObjects.get(l),h=s;c!==void 0&&(h={...s,...c.value}),c=r.object(t,h),this.sheetObjects.set(l,c),this.sheetObjectCBs.set(l,i!==void 0?i:ua);const u=c.onValuesChange(d=>{if(this.app.editor){for(const f in d){const m=d[f];typeof m=="object"&&Zf(m)&&(d[f]={r:m.r,g:m.g,b:m.b,a:m.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:e,sheetObject:l,values:d}})}const p=this.sheetObjectCBs.get(l);p!==void 0&&p(d)});return this.sheetObjectUnsubscribe.set(l,u),c}getSheetObjectKeyframes(e,t,s){const i=this.sheet(e);if(i===void 0)return[];const n=`${e}_${t}`,r=this.sheetObjects.get(n);return r===void 0?[]:i.sequence.__experimental_getKeyframes(r.props[s])}getSheetObjectVectors(e,t){const s=this.sheet(e);if(s===void 0)return[];const i=`${e}_${t}`,n=this.sheetObjects.get(i);if(n===void 0)return[];const r=[],o=s.sequence.__experimental_getKeyframes(n.props.x),l=s.sequence.__experimental_getKeyframes(n.props.y),c=s.sequence.__experimental_getKeyframes(n.props.z),h=new Set;return o.forEach(d=>h.add(d.position)),l.forEach(d=>h.add(d.position)),c.forEach(d=>h.add(d.position)),Array.from(h).sort((d,p)=>d-p).forEach(d=>{const p=(f,m)=>{const y=f.find((b,T)=>b.position<=m&&(f[T+1]?.position||1/0)>m),g=f.find(b=>b.position>m);if(!y)return g?.value||0;if(!g||y.position===m)return y.value;if(y.type==="bezier")return j0(y,g,m);const _=(m-y.position)/(g.position-y.position);return y.value+_*(g.value-y.value)};r.push({position:d,x:p(o,d),y:p(l,d),z:p(c,d)})}),r}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 n=`${t}_${s}`,r=this.sheetObjectUnsubscribe.get(n);r!==void 0&&(this.sheetObjects.delete(n),this.sheetObjectCBs.delete(n),this.sheetObjectUnsubscribe.delete(n),r())}handleApp(e){let t;switch(e.event){case"setSheet":t=this.sheets.get(e.data.sheet),t!==void 0&&(this.activeSheet=t,this.studio?.setSelection([t]));break;case"setSheetObject":t=this.sheetObjects.get(`${e.data.sheet}_${e.data.key}`),t!==void 0&&this.studio?.setSelection([t]);break;case"updateSheetObject":t=this.sheets.get(e.data.sheet),t!==void 0&&t.sequence.pause(),t=this.sheetObjectCBs.get(e.data.sheetObject),t!==void 0&&t(e.data.values);break;case"updateTimeline":t=this.sheets.get(e.data.sheet),this.activeSheet!==void 0&&(this.activeSheet.sequence.position=e.data.position);break}}handleEditor(e){if(this.app.editor)switch(e.event){case"playSheet":this.sheet(e.data.sheet,e.data.instance)?.sequence.play(e.data.value);break;case"pauseSheet":this.sheet(e.data.sheet,e.data.instance)?.sequence.pause();break}}handleEditorApp(){if(this.app.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(i=>{i.length<1||i.forEach(n=>{let r=n.address.sheetId,o="setSheet",l={};switch(n.type){case"Theatre_Sheet_PublicAPI":o="setSheet",l={sheet:n.address.sheetId},this.activeSheet=this.sheets.get(n.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":o="setSheetObject",r+=`_${n.address.objectKey}`,l={id:r,sheet:n.address.sheetId,key:n.address.objectKey},this.activeSheet=this.sheets.get(n.address.sheetId);break}this.app.send({event:o,target:"app",data:l})})});let e=-1;const t=()=>{if(this.activeSheet!==void 0&&e!==this.activeSheet.sequence.position){e=this.activeSheet.sequence.position;const i=this.activeSheet;this.app.send({event:"updateTimeline",target:"app",data:{position:e,sheet:i.address.sheetId}})}},s=()=>{t(),requestAnimationFrame(s)};t(),s()}else this.studio?.ui.hide()}}function Y0(a){if(a.name==="cameras")return"camera";if(a.name==="interactive")return"interactive";if(a.name==="lights")return"light";if(a.name==="ui")return"ui";if(a.name==="utils")return"utils";const e=a.type;return e.search("Helper")>-1?"icon_utils":e.search("Camera")>-1?"camera":e.search("Light")>-1?"light":"obj3D"}function Gn(a){const e={name:a.name,type:a.type,uuid:a.uuid,children:[]};return a.children.forEach(t=>{e.children.push(Gn(t))}),e}function X0(a){const e={};for(const t in a){const s=a[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 Z0(a){switch(a){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function _n(a){const e={};for(const t in a){if(t.substring(0,1)==="_"||t.substring(0,2)==="is"||Z0(t))continue;const s=typeof a[t],i=a[t];switch(s){case"boolean":case"number":case"string":e[t]=i;break;case"object":i!==null?(e[t]=i,i.isTexture?e[t]={src:sa.renderToBlob(i),offset:[i.offset.x,i.offset.y],repeat:[i.repeat.x,i.repeat.y]}:t==="uniforms"&&(e[t]=X0(e[t]))):t==="glslVersion"?e[t]="":e[t]={src:"",offset:[0,0],repeat:[1,1]};break}}return a.anisotropy!==void 0&&(e.anisotropy=a.anisotropy),a.clearcoat!==void 0&&(e.clearcoat=a.clearcoat),a.iridescence!==void 0&&(e.iridescence=a.iridescence),a.dispersion!==void 0&&(e.dispersion=a.dispersion),a.sheen!==void 0&&(e.sheen=a.sheen),a.transmission!==void 0&&(e.transmission=a.transmission),a.transmission!==void 0&&(e.transmission=a.transmission),e}function Ll(a){a.updateMatrix();const e={name:a.name,type:a.type,uuid:a.uuid,visible:a.visible,matrix:a.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};a.animations.forEach(s=>{e.animations.push({name:s.name,duration:s.duration,blendMode:s.blendMode})});const t=a.type.toLowerCase();if(t.search("mesh")>-1){const s=a;if(Array.isArray(s.material)){const i=[];s.material.forEach(n=>{i.push(_n(n))}),e.material=i}else e.material=_n(s.material)}else if(t.search("points")>-1){const s=a;if(Array.isArray(s.material)){const i=[];s.material.forEach(n=>{i.push(_n(n))}),e.material=i}else e.material=_n(s.material)}else if(t.search("line")>-1){const s=a;if(Array.isArray(s.material)){const i=[];s.material.forEach(n=>{i.push(_n(n))}),e.material=i}else e.material=_n(s.material)}else t.search("camera")>-1?a.type==="PerspectiveCamera"?e.perspectiveCameraInfo={fov:a.fov,zoom:a.zoom,near:a.near,far:a.far,focus:a.focus,aspect:a.aspect,filmGauge:a.filmGauge,filmOffset:a.filmOffset}:a.type==="OrthographicCamera"&&(e.orthographicCameraInfo={zoom:a.zoom,near:a.near,far:a.far,left:a.left,right:a.right,top:a.top,bottom:a.bottom}):t.search("light")>-1&&(e.lightInfo={color:a.color,intensity:a.intensity,decay:a.decay,distance:a.distance,angle:a.angle,penumbra:a.penumbra,groundColor:a.groundColor,width:a.width,height:a.height});return e}function Q0(a,e){const t=e.split(".");switch(t.length){case 1:return a[t[0]];case 2:return a[t[0]][t[1]];case 3:return a[t[0]][t[1]][t[2]];case 4:return a[t[0]][t[1]][t[2]][t[3]];case 5:return a[t[0]][t[1]][t[2]][t[3]][t[4]];case 6:return a[t[0]][t[1]][t[2]][t[3]][t[4]][t[5]]}}function K0(a,e){for(const t in e)a[t]=e[t]}function qe(a,e,t){if(a===void 0)return;const s=e.split("."),i=s.length;if(typeof t!="object")switch(i){case 1:a[s[0]]=t;break;case 2:a[s[0]][s[1]]=t;break;case 3:a[s[0]][s[1]][s[2]]=t;break;case 4:a[s[0]][s[1]][s[2]][s[3]]=t;break;case 5:a[s[0]][s[1]][s[2]][s[3]][s[4]]=t;break}else{let r;switch(i){case 1:r=a[s[0]];break;case 2:r=a[s[0]][s[1]];break;case 3:r=a[s[0]][s[1]][s[2]];break;case 4:r=a[s[0]][s[1]][s[2]][s[3]];break;case 5:r=a[s[0]][s[1]][s[2]][s[3]][s[4]];break}r!=null&&K0(r,t)}}function tm(a){return new Promise((e,t)=>{const s=new Image;s.onload=()=>{const i=new x.Texture(s);i.wrapS=x.RepeatWrapping,i.wrapT=x.RepeatWrapping,i.needsUpdate=!0,e(i)},s.onerror=t,s.src=a})}class J0 extends al{canvas=null;inputElement=null;scene=void 0;scenes=new Map;renderer=void 0;renderTargets=new Map;groups=new Map;constructor(e){super(e),window.RemoteThree=this}dispose(){this.scenes.forEach(e=>{Is(e)}),this.scenes.clear(),this.scene&&Is(this.scene),this.renderTargets.forEach(e=>{e.dispose()}),this.renderTargets.clear(),this.renderer?.dispose()}getObject(e){this.app.debugEnabled&&(this.renderer!==void 0&&(sa.renderer=this.renderer),this.app.send({event:"getObject",target:"app",data:e}))}setObject(e){this.renderer!==void 0&&(sa.renderer=this.renderer);const t=Ll(e);this.app.send({event:"setObject",target:"editor",data:t})}requestMethod(e,t,s,i){this.app.send({event:"requestMethod",target:"app",data:{uuid:e,key:t,value:s,subitem:i}})}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)}setRenderer(e,t=null){if(this.renderer=e,this.canvas=e.domElement,this.inputElement=t!==null?t:this.canvas,!this.app.debugEnabled)return;const s=`#${e.getClearColor(new x.Color).getHexString()}`;this.app.send({event:"addRenderer",target:"editor",data:{autoClear:e.autoClear,autoClearColor:e.autoClearColor,autoClearDepth:e.autoClearDepth,autoClearStencil:e.autoClearStencil,outputColorSpace:e.outputColorSpace,localClippingEnabled:e.localClippingEnabled,clearColor:s,clearAlpha:e.getClearAlpha(),colorManagement:x.ColorManagement.enabled,toneMapping:e.toneMapping,toneMappingExposure:e.toneMappingExposure,type:e.isWebGLRenderer?"WebGLRenderer":"WebGPURenderer"}})}updateRenderer(e){this.app.send({event:"updateRenderer",target:"app",data:e})}addScene(e){if(e===void 0||(this.scenes.set(e.name,e),!this.app.debugEnabled))return;oh(),Uo(e);const t=Gn(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=Gn(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=Gn(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,i)=>{e.search(i)>-1&&(t=s)}),t}setScene(e){if(e===void 0||(this.scene=e,!this.app.debugEnabled))return;this.renderer!==void 0&&(sa.renderer=this.renderer),oh(),Uo(e);const t=Gn(e);this.app.send({event:"setScene",target:"editor",data:t})}addCamera(e){if(!this.app.debugEnabled)return;const t=Ll(e);this.app.send({event:"addCamera",target:"editor",data:t})}removeCamera(e){if(!this.app.debugEnabled)return;const t=Ll(e);this.app.send({event:"removeCamera",target:"editor",data:t})}handleApp(e){switch(e.event){case"getObject":this.app.dispatchEvent({type:Q.GET_OBJECT,value:e.data});break;case"updateObject":this.app.dispatchEvent({type:Q.UPDATE_OBJECT,value:e.data});break;case"createTexture":this.app.dispatchEvent({type:Q.CREATE_TEXTURE,value:e.data});break;case"requestMethod":this.app.dispatchEvent({type:Q.REQUEST_METHOD,value:e.data});break;case"refreshScene":this.app.send({event:"refreshScene",target:"editor",data:Gn(this.scenes.get(e.data.name))});break;case"updateRenderer":this.renderer&&(this.renderer.autoClearColor=e.data.autoClearColor,this.renderer.outputColorSpace=e.data.outputColorSpace,this.renderer.localClippingEnabled=e.data.localClippingEnabled,this.renderer.setClearColor(e.data.clearColor,e.data.clearAlpha),this.renderer.toneMapping=e.data.toneMapping,this.renderer.toneMappingExposure=e.data.toneMappingExposure,x.ColorManagement.enabled=e.data.colorManagement);break}if(e.event==="updateGroup"){const t=JSON.parse(e.data);this.groups.get(t.group)?.onUpdate(t.prop,t.value)}}handleEditor(e){switch(e.event){case"setObject":this.app.dispatchEvent({type:Q.SET_OBJECT,value:e.data});break;case"addScene":this.app.dispatchEvent({type:Q.ADD_SCENE,value:e.data});break;case"refreshScene":this.app.dispatchEvent({type:Q.REFRESH_SCENE,value:e.data});break;case"removeScene":this.app.dispatchEvent({type:Q.REMOVE_SCENE,value:e.data});break;case"setScene":this.app.dispatchEvent({type:Q.SET_SCENE,value:e.data});break;case"addCamera":this.app.dispatchEvent({type:Q.ADD_CAMERA,value:e.data});break;case"removeCamera":this.app.dispatchEvent({type:Q.REMOVE_CAMERA,value:e.data});break;case"addGroup":this.app.dispatchEvent({type:Q.ADD_GROUP,value:e.data});break;case"removeGroup":this.app.dispatchEvent({type:Q.REMOVE_GROUP,value:e.data});break;case"addSpline":this.app.dispatchEvent({type:Q.ADD_SPLINE,value:e.data});break;case"addRenderer":this.app.dispatchEvent({type:Q.ADD_RENDERER,value:e.data})}}addRT(e,t){const s=new x.RenderTarget(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)});const i=!(this.renderer?.domElement instanceof OffscreenCanvas);this.renderer?.setSize(e,t,i)}set dpr(e){this.renderer?.setPixelRatio(Ti(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}}var Pa={exports:{}},_r={};/**
|
18
|
+
`,d=c.createShader(35633),p=c.createShader(35632),f=c.createProgram();if(!(p&&d&&f))return;c.shaderSource(d,h),c.shaderSource(p,u),c.compileShader(d),c.compileShader(p),c.attachShader(f,d),c.attachShader(f,p),c.linkProgram(f),c.detachShader(f,d),c.detachShader(f,p),c.deleteShader(d),c.deleteShader(p),c.useProgram(f);const m=c.createBuffer();c.bindBuffer(34962,m),c.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const y=c.getAttribLocation(f,"aPosition");c.vertexAttribPointer(y,3,5126,!1,0,0),c.enableVertexAttribArray(y),c.clearColor(1,1,1,1),c.clear(16384),c.viewport(0,0,1,1),c.drawArrays(4,0,3);const g=new Uint8Array(4);return c.readPixels(0,0,1,1,6408,5121,g),c.deleteProgram(f),c.deleteBuffer(m),g.join("")}(a),i="801621810",n="8016218135",r="80162181161",o=Ps?.isIpad?[["a7",r,12],["a8",n,15],["a8x",n,15],["a9",n,15],["a9x",n,15],["a10",n,15],["a10x",n,15],["a12",i,15],["a12x",i,15],["a12z",i,15],["a14",i,15],["a15",i,15],["m1",i,15],["m2",i,15]]:[["a7",r,12],["a8",n,12],["a9",n,15],["a10",n,15],["a11",i,15],["a12",i,15],["a13",i,15],["a14",i,15],["a15",i,15],["a16",i,15],["a17",i,15]];let l;return s==="80162181255"?l=o.filter(([,,c])=>c>=14):(l=o.filter(([,c])=>c===s),l.length||(l=o)),l.map(([c])=>`apple ${c} gpu`)}class dd extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const Bl=[],pd=[];function f0(a,e){if(a===e)return 0;const t=a;a.length>e.length&&(a=e,e=t);let s=a.length,i=e.length;for(;s>0&&a.charCodeAt(~-s)===e.charCodeAt(~-i);)s--,i--;let n,r=0;for(;r<s&&a.charCodeAt(r)===e.charCodeAt(r);)r++;if(s-=r,i-=r,s===0)return i;let o,l,c=0,h=0,u=0;for(;h<s;)pd[h]=a.charCodeAt(r+h),Bl[h]=++h;for(;u<i;)for(n=e.charCodeAt(r+u),o=u++,c=u,h=0;h<s;h++)l=n===pd[h]?o:o+1,o=Bl[h],c=Bl[h]=o>c?l>c?c+1:l:l>o?o+1:l;return c}function m0(a){return a!=null}const g0=({mobileTiers:a=[0,15,30,60],desktopTiers:e=[0,15,30,60],override:t={},glContext:s,failIfMajorPerformanceCaveat:i=!1,benchmarksURL:n="https://unpkg.com/detect-gpu@5.0.70/dist/benchmarks"}={})=>Ol(void 0,void 0,void 0,function*(){const r={};if(Qf)return{tier:0,type:"SSR"};const{isIpad:o=!!Ps?.isIpad,isMobile:l=!!Ps?.isMobile,screenSize:c=window.screen,loadBenchmarks:h=S=>Ol(void 0,void 0,void 0,function*(){const E=yield fetch(`${n}/${S}`).then(w=>w.json());if(parseInt(E.shift().split(".")[0],10)<4)throw new dd("Detect GPU benchmark data is out of date. Please update to version 4x");return E})}=t;let{renderer:u}=t;const d=(S,E,w,R,P)=>({device:P,fps:R,gpu:w,isMobile:l,tier:S,type:E});let p,f="";if(u)u=ud(u),p=[u];else{const S=s||function(w,R=!1){const P={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:R,powerPreference:"high-performance",stencil:!1};w&&delete P.powerPreference;const z=window.document.createElement("canvas"),$=z.getContext("webgl",P)||z.getContext("experimental-webgl",P);return $??void 0}(Ps?.isSafari12,i);if(!S)return d(0,"WEBGL_UNSUPPORTED");const E=Ps?.isFirefox?null:S.getExtension("WEBGL_debug_renderer_info");if(u=E?S.getParameter(E.UNMASKED_RENDERER_WEBGL):S.getParameter(S.RENDERER),!u)return d(1,"FALLBACK");f=u,u=ud(u),p=function(w,R,P){return R==="apple gpu"?p0(w,R,P):[R]}(S,u,l)}const m=(yield Promise.all(p.map(function(S){var E;return Ol(this,void 0,void 0,function*(){const w=(_e=>{const at=l?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce","adreno"];for(const Dt of at)if(_e.includes(Dt))return Dt})(S);if(!w)return;const R=`${l?"m":"d"}-${w}${o?"-ipad":""}.json`,P=r[R]=(E=r[R])!==null&&E!==void 0?E:h(R);let z;try{z=yield P}catch(_e){if(_e instanceof dd)throw _e;return}const $=function(_e){var at;const Dt=(_e=_e.replace(/\([^)]+\)/,"")).match(/\d+/)||_e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return(at=Dt?.join("").replace(/\W|amd/g,""))!==null&&at!==void 0?at:""}(S);let q=z.filter(([,_e])=>_e===$);q.length||(q=z.filter(([_e])=>_e.includes(S)));const j=q.length;if(j===0)return;const X=S.split(/[.,()\[\]/\s]/g).sort().filter((_e,at,Dt)=>at===0||_e!==Dt[at-1]).join(" ");let Z,[ve,,,,ue]=j>1?q.map(_e=>[_e,f0(X,_e[2])]).sort(([,_e],[,at])=>_e-at)[0][0]:q[0],ge=Number.MAX_VALUE;const{devicePixelRatio:ie}=window,we=c.width*ie*c.height*ie;for(const _e of ue){const[at,Dt]=_e,yr=at*Dt,mn=Math.abs(we-yr);mn<ge&&(ge=mn,Z=_e)}if(!Z)return;const[,,ke,rt]=Z;return[ge,ke,ve,rt]})}))).filter(m0).sort(([S=Number.MAX_VALUE,E],[w=Number.MAX_VALUE,R])=>S===w?E-R:S-w);if(!m.length){const S=d0.find(E=>u.includes(E));return S?d(0,"BLOCKLISTED",S):d(1,"FALLBACK",`${u} (${f})`)}const[,y,g,_]=m[0];if(y===-1)return d(0,"BLOCKLISTED",g,y,_);const b=l?a:e;let T=0;for(let S=0;S<b.length;S++)y>=b[S]&&(T=S);return d(T,"BENCHMARK",g,y,_)});var Kf=(a=>(a[a.High=0]="High",a[a.Medium=1]="Medium",a[a.Low=2]="Low",a))(Kf||{});function Jf(a){let e=0;const t=performance.now();function s(){e++;const i=performance.now();if(i-t>=100){const n=e/((i-t)/1e3),r=Math.round(n/30)*30;a(r)}else requestAnimationFrame(s)}requestAnimationFrame(s)}function y0(a,e,t){return new Promise(s=>{g0().then(i=>{let n=!1;const r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);if(n="transferControlToOffscreen"in a,r){const l=navigator.userAgent.match(/version\/(\d+)/i);n=(l?parseInt(l[1]):0)>=17}const o={dpr:devicePixelRatio,fps:30,width:innerWidth,height:innerHeight,mobile:i.isMobile!==void 0?i.isMobile:!1,supportOffScreenCanvas:n,quality:2,dev:e,editor:t};i.tier===3?o.quality=0:i.tier===2&&(o.quality=1),Jf(l=>{o.fps=l,s(o)}),s(o)})})}function Ti(a,e,t){return Math.min(e,Math.max(a,t))}function Lo(a,e,t){return(t-a)/(e-a)}function ir(a,e,t){return a*(1-t)+e*t}function x0(a,e,t,s,i){return ir(t,s,Lo(a,e,i))}function _0(a,e){const t=a-e;return Math.sqrt(t*t)}function ss(a,e=1){return Number(a.toFixed(e))}function b0(a,e,t,s){return ir(a,e,1-Math.exp(-t*s))}function T0(a,e=1){return Number(a.toFixed(e))}function S0(a,e,t,s){return a===e&&t===s}function v0(a,e,t,s){return 1/(3*e*a*a+2*t*a+s)}function w0(a,e,t,s,i){return e*(a*a*a)+t*(a*a)+s*a+i}function M0(a,e,t,s,i){const n=a*a;return e*(n*a)+t*n+s*a+i}function E0(a,e,t,s,i){if(a<=0)return 0;if(a>=1)return 1;if(S0(e,t,s,i))return a;const n=0,r=0,o=e,l=t,c=s,h=i,u=1,d=1,p=u-3*c+3*o-n,f=3*c-6*o+3*n,m=3*o-3*n,y=n,g=d-3*h+3*l-r,_=3*h-6*l+3*r,b=3*l-3*r,T=r;let S=a;for(let E=0;E<5;E++){const w=w0(S,p,f,m,y);let R=v0(S,p,f,m);R===1/0&&(R=a),S-=(w-a)*R,S=Math.min(Math.max(S,0),1)}return M0(S,g,_,b,T)}const ah=a=>{a?.dispose()},Wh=a=>{if(a)if(Array.isArray(a))a.forEach(e=>Wh(e));else{for(const e in a){const t=a[e];t!==null&&t instanceof x.Texture&&ah(t)}if(a.isShaderMaterial===!0){const e=a;for(const t in e.uniforms){const s=e.uniforms[t];s.value!==null&&s.value instanceof x.Texture&&ah(s.value)}}a.dispose()}},Is=a=>{if(a){for(;a.children.length>0;){const e=a.children[0];e.type==="Audio"?(e.pause(),e.parent&&e.parent.remove(e)):Is(e)}if(a.parent&&a.parent.remove(a),a.isMesh){const e=a;e.geometry?.dispose(),Wh(e.material)}a.dispose!==void 0&&a.dispose()}};exports.totalThreeObjects=0;const oh=()=>{exports.totalThreeObjects=0},Uo=a=>{if(!a)return;let e=a.name.replaceAll(" ","").replaceAll("/",".");if(e.length===0&&(e=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),a.parent!==null&&a.parent.uuid.length>0&&(e=`${a.parent.uuid}.${e}`),a.uuid=e,a.isMesh!==void 0){const t=a;if(Array.isArray(t.material))t.material.forEach((s,i)=>{s.uuid=`${e}.material.${i}`});else{const s=t.material;s.uuid=`${e}.material`}}a.children.forEach(t=>Uo(t))};class sa{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 i=e.image;if(i!=null&&i.width>0){this.canvas.title=e.sourceFile;const n=this.canvas.width/i.width,r=this.renderToCanvas(e);this.context.drawImage(r,0,0,i.width*n,i.height*n)}}return e.repeat.copy(t),e.offset.copy(s),this.canvas.toDataURL("image/png")}static renderToCanvas(e){if(this.material===null){this.camera=new x.OrthographicCamera(-.5,.5,.5,-.5,0,100),this.scene=new x.Scene,this.material=new x.MeshBasicMaterial;const t=new x.BufferGeometry;t.setAttribute("position",new x.Float32BufferAttribute([-.5,-.5,0,1.5,-.5,0,-.5,1.5,0],3)),t.setAttribute("normal",new x.Float32BufferAttribute([0,0,1,0,0,1],3)),t.setAttribute("uv",new x.Float32BufferAttribute([0,0,2,0,0,2],2));const s=new x.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=x.LinearSRGBColorSpace,e.colorSpace=x.LinearSRGBColorSpace,this.material.map=e,this.renderer.render(this.scene,this.camera),this.renderer.outputColorSpace=t,e.colorSpace=s}return this.renderer.domElement}}function C0(a){return new Promise(e=>{const t=new x.ObjectLoader;t.parseAsync(a.scene).then(s=>{const i=new x.AnimationMixer(s);if(a.animations.length>0){const r=a.animations.map(l=>x.AnimationClip.parse(l));i.clipAction(r[0]).play(),i.getRoot().animations=a.animations,i.getRoot().mixer=i}const n=[];a.cameras&&a.cameras.length>0&&a.cameras.forEach(r=>{const o=t.parse(r);n.push(o)}),e({animations:a.animations,model:s,mixer:i,cameras:n})})})}const xn=$h(["ctrlKey","metaKey","shiftKey","button","pointerId","pointerType","clientX","clientY","pageX","pageY"]),A0=$h(["clientX","clientY","deltaX","deltaY","deltaMode"]),R0=$h(["ctrlKey","metaKey","shiftKey","keyCode"]);function N0(a,e){a.preventDefault(),A0(a,e)}function P0(a){a.preventDefault()}function F0(a,e,t){for(const s of e)t[s]=a[s]}function $h(a){return function(t,s){const i={type:t.type};F0(t,a,i),s(i)}}function Il(a,e){const t=[],s={type:a.type,touches:t};for(let i=0;i<a.touches.length;++i){const n=a.touches[i];t.push({pageX:n.pageX,pageY:n.pageY})}e(s)}const D0={37:!0,38:!0,39:!0,40:!0};function O0(a,e){const{keyCode:t}=a;D0[t]&&(a.preventDefault(),R0(a,e))}const B0={contextmenu:P0,mousedown:xn,mousemove:xn,mouseup:xn,pointerdown:xn,pointermove:xn,pointerup:xn,touchstart:Il,touchmove:Il,touchend:Il,wheel:N0,keydown:O0};let I0=0;class L0{id;worker;constructor(e,t,s){this.id=I0++,this.worker=t;const i=r=>{this.worker.postMessage({type:"event",id:this.id,data:r})};t.postMessage({type:"makeProxy",id:this.id});for(const[r,o]of Object.entries(s))e.addEventListener(r,l=>{o(l,i)});function n(){i({type:"resize",left:0,top:0,width:innerWidth,height:innerHeight})}window.addEventListener("resize",n),n()}}class em extends x.EventDispatcher{style={};left=0;top=0;width=0;height=0;ownerDocument=void 0;constructor(){super(),this.ownerDocument=this}get clientWidth(){return this.width}set clientWidth(e){this.width=e}get clientHeight(){return this.height}set clientHeight(e){this.height=e}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{x:this.left,y:this.top,left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height,toJSON:()=>({})}}handleEvent(e){if(e.type==="size"){this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height;return}e.preventDefault=ua,e.stopPropagation=ua,this.dispatchEvent(e)}focus(){}getRootNode(){return this}}class U0{targets={};constructor(){this.handleEvent=this.handleEvent.bind(this)}makeProxy(e){const{id:t}=e,s=new em;this.targets[t]=s}getProxy(e){return this.targets[e]}handleEvent(e){this.targets[e.id]?.handleEvent(e.data)}}var Q=(a=>(a.CUSTOM="ToolEvents::custom",a.SELECT_DROPDOWN="ToolEvents::selectDropdown",a.DRAG_UPDATE="ToolEvents::dragUpdate",a.ADD_SCENE="ToolEvents::addScene",a.REFRESH_SCENE="ToolEvents::refreshScene",a.REMOVE_SCENE="ToolEvents::removeScene",a.SET_SCENE="ToolEvents::setScene",a.GET_OBJECT="ToolEvents::getObject",a.SET_OBJECT="ToolEvents::setObject",a.UPDATE_OBJECT="ToolEvents::updateObject",a.CREATE_TEXTURE="ToolEvents::createTexture",a.REQUEST_METHOD="ToolEvents::requestMethod",a.ADD_CAMERA="ToolEvents::addCamera",a.REMOVE_CAMERA="ToolEvents::removeCamera",a.ADD_GROUP="ToolEvents::addGroup",a.REMOVE_GROUP="ToolEvents::removeGroup",a.ADD_SPLINE="ToolEvents::addSpline",a.ADD_RENDERER="ToolEvents::addRenderer",a.UPDATE_RENDERER="ToolEvents::updateRenderer",a))(Q||{});class k0 extends x.EventDispatcher{components=new Map;appHandlers=[];editorHandlers=[];_appID="";_debugEnabled;_broadcastChannel=void 0;_webSocket=void 0;_mode="app";_connected=!1;_useBC=!1;constructor(e,t,s,i=!0){super(),this._appID=e,this._debugEnabled=t,this.editor=s,t&&(this._useBC=i,i?(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=>{let t=e.data;this._useBC||(t=JSON.parse(e.data)),t.target==="editor"?this.handleEditorBroadcast(t):this.handleAppBroadcast(t)};handleAppBroadcast(e){switch(this.appHandlers.forEach(t=>{t.callback(e)}),e.event){case"custom":this.dispatchEvent({type:"ToolEvents::custom",value:e.data});break}}handleEditorBroadcast(e){switch(this.editorHandlers.forEach(t=>{t.callback(e)}),e.event){case"custom":this.dispatchEvent({type:"ToolEvents::custom",value:e.data});break}}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")}}class z0{canvas;inputElement;settings;playing=!1;rafID=-1;constructor(e,t,s){this.canvas=e,this.inputElement=t,this.settings=s}dispose(){this.stop()}play(){this.playing||(this.playing=!0,this.onUpdate())}stop(){this.playing&&(this.playing=!1,cancelAnimationFrame(this.rafID),this.rafID=-1)}update(){}draw(){}resize(e,t){this.settings.supportOffScreenCanvas&&(this.inputElement.clientWidth=e,this.inputElement.clientHeight=t,this.inputElement.width=e,this.inputElement.height=t)}onResize=e=>{this.resize(e.width,e.height)};onUpdate=()=>{this.update(),this.draw(),this.rafID=requestAnimationFrame(this.onUpdate)}}class G0 extends x.Scene{clock;cameras;lights;world;constructor(e){super(),this.name=e,this.clock=new x.Clock,this.lights=new x.Group,this.lights.name="lights",this.add(this.lights),this.cameras=new x.Group,this.cameras.name="cameras",this.add(this.cameras),this.world=new x.Group,this.world.name="world",this.add(this.world)}init(){return new Promise(e=>{this.setupLights().then(()=>this.setupCameras()).then(()=>this.setupWorld()).then(()=>this.setupPost()).then(()=>this.setupAnimation()).then(()=>this.setupDebug()).then(()=>e())})}setupLights(){return new Promise(e=>{e()})}setupCameras(){return new Promise(e=>{e()})}setupWorld(){return new Promise(e=>{e()})}setupPost(){return new Promise(e=>{e()})}setupAnimation(){return new Promise(e=>{e()})}setupDebug(){return new Promise(e=>{e()})}dispose(){}update(){}draw(e){}postDraw(){}resize(e,t,s){}show(){this.clock.start(),this.showComplete()}showComplete(){this.enable()}hide(){this.disable(),this.hideComplete()}hideComplete(){this.clock.stop()}enable(){}disable(){}get deltaTime(){return Math.min(this.clock.getDelta(),1/30)}}class al{app;constructor(e){this.app=e,this.app.appHandlers.push({remote:this,callback:this.handleApp.bind(this)}),this.app.editorHandlers.push({remote:this,callback:this.handleEditor.bind(this)})}dispose(){const e=this.app.appHandlers.findIndex(t=>t.remote===this);e>-1&&(this.app.appHandlers.splice(e,1),this.app.editorHandlers.splice(e,1))}handleApp(e){}handleEditor(e){}}class V0 extends al{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){switch(e.event){case"selectComponent":this.app.dispatchEvent({type:Q.SELECT_DROPDOWN,value:e.data});break;case"draggableListUpdate":this.app.dispatchEvent({type:Q.DRAG_UPDATE,value:e.data});break}}}function H0(a,e,t){if(a.editor){t.ui.restore(),t.onSelectionChange(r=>{r.length<1||r.forEach(o=>{let l=o.address.sheetId,c="setSheet",h={};switch(o.type){case"Theatre_Sheet_PublicAPI":c="setSheet",h={sheet:o.address.sheetId},e.activeSheet=e.sheets.get(o.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":c="setSheetObject",l+=`_${o.address.objectKey}`,h={id:l,sheet:o.address.sheetId,key:o.address.objectKey},e.activeSheet=e.sheets.get(o.address.sheetId);break}a.send({event:c,target:"app",data:h})})});let s=-1;const i=()=>{if(e.activeSheet!==void 0&&s!==e.activeSheet.sequence.position){s=e.activeSheet.sequence.position;const r=e.activeSheet;a.send({event:"updateTimeline",target:"app",data:{position:s,sheet:r.address.sheetId}})}},n=()=>{i(),requestAnimationFrame(n)};i(),n()}else t.ui.hide()}async function W0(){for(;!document.getElementById("theatrejs-studio-root");)await new Promise(i=>setTimeout(i,100));const a=document.getElementById("theatrejs-studio-root");if(a===null||a.shadowRoot===null)return;const e=a.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 i=s.children[1];for(i.style.transform="translateX(10px)";i.children.length>1;)i.removeChild(i.children[0])}catch{}try{const i=t.children[3];i.style.top="0",i.style.right="300px"}catch{}}function $0(a,e,t,s,i){const n=1-a;return n*n*n*e+3*n*n*a*t+3*n*a*a*s+a*a*a*i}function j0(a,e,t){if(a.type!=="bezier"||a.handles.length!==4)throw new Error("Invalid keyframe data for Bézier interpolation.");const[s,i]=a.handles,n=(t-a.position)/(e.position-a.position);return $0(n,a.value,a.value+s,e.value+i,e.value)}class q0 extends al{project;sheets=new Map;sheetObjects=new Map;sheetObjectCBs=new Map;sheetObjectUnsubscribe=new Map;activeSheet;studio=void 0;constructor(e){super(e),window.RemoteTheatre=this}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 i=this.sheets.get(s);return i!==void 0||(i=this.project?.sheet(e,t),this.sheets.set(s,i)),i}playSheet(e,t,s){return new Promise(i=>{const n=t!==void 0?{...t}:{};this.sheet(e,s)?.sequence.play(n).then(r=>i(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,i,n){if(this.project===void 0){console.error("Theatre Project hasn't been created yet.");return}const r=this.sheet(e,n);if(r===void 0)return;const l=`${this.getSheetInstance(e,n)}_${t}`;let c=this.sheetObjects.get(l),h=s;c!==void 0&&(h={...s,...c.value}),c=r.object(t,h),this.sheetObjects.set(l,c),this.sheetObjectCBs.set(l,i!==void 0?i:ua);const u=c.onValuesChange(d=>{if(this.app.editor){for(const f in d){const m=d[f];typeof m=="object"&&Zf(m)&&(d[f]={r:m.r,g:m.g,b:m.b,a:m.a})}this.app.send({event:"updateSheetObject",target:"app",data:{sheet:e,sheetObject:l,values:d}})}const p=this.sheetObjectCBs.get(l);p!==void 0&&p(d)});return this.sheetObjectUnsubscribe.set(l,u),c}getSheetObjectKeyframes(e,t,s){const i=this.sheet(e);if(i===void 0)return[];const n=`${e}_${t}`,r=this.sheetObjects.get(n);return r===void 0?[]:i.sequence.__experimental_getKeyframes(r.props[s])}getSheetObjectVectors(e,t){const s=this.sheet(e);if(s===void 0)return[];const i=`${e}_${t}`,n=this.sheetObjects.get(i);if(n===void 0)return[];const r=[],o=s.sequence.__experimental_getKeyframes(n.props.x),l=s.sequence.__experimental_getKeyframes(n.props.y),c=s.sequence.__experimental_getKeyframes(n.props.z),h=new Set;return o.forEach(d=>h.add(d.position)),l.forEach(d=>h.add(d.position)),c.forEach(d=>h.add(d.position)),Array.from(h).sort((d,p)=>d-p).forEach(d=>{const p=(f,m)=>{const y=f.find((b,T)=>b.position<=m&&(f[T+1]?.position||1/0)>m),g=f.find(b=>b.position>m);if(!y)return g?.value||0;if(!g||y.position===m)return y.value;if(y.type==="bezier")return j0(y,g,m);const _=(m-y.position)/(g.position-y.position);return y.value+_*(g.value-y.value)};r.push({position:d,x:p(o,d),y:p(l,d),z:p(c,d)})}),r}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 n=`${t}_${s}`,r=this.sheetObjectUnsubscribe.get(n);r!==void 0&&(this.sheetObjects.delete(n),this.sheetObjectCBs.delete(n),this.sheetObjectUnsubscribe.delete(n),r())}handleApp(e){let t;switch(e.event){case"setSheet":t=this.sheets.get(e.data.sheet),t!==void 0&&(this.activeSheet=t,this.studio?.setSelection([t]));break;case"setSheetObject":t=this.sheetObjects.get(`${e.data.sheet}_${e.data.key}`),t!==void 0&&this.studio?.setSelection([t]);break;case"updateSheetObject":t=this.sheets.get(e.data.sheet),t!==void 0&&t.sequence.pause(),t=this.sheetObjectCBs.get(e.data.sheetObject),t!==void 0&&t(e.data.values);break;case"updateTimeline":t=this.sheets.get(e.data.sheet),this.activeSheet!==void 0&&(this.activeSheet.sequence.position=e.data.position);break}}handleEditor(e){if(this.app.editor)switch(e.event){case"playSheet":this.sheet(e.data.sheet,e.data.instance)?.sequence.play(e.data.value);break;case"pauseSheet":this.sheet(e.data.sheet,e.data.instance)?.sequence.pause();break}}handleEditorApp(){if(this.app.editor){this.studio?.ui.restore(),this.studio?.onSelectionChange(i=>{i.length<1||i.forEach(n=>{let r=n.address.sheetId,o="setSheet",l={};switch(n.type){case"Theatre_Sheet_PublicAPI":o="setSheet",l={sheet:n.address.sheetId},this.activeSheet=this.sheets.get(n.address.sheetId);break;case"Theatre_SheetObject_PublicAPI":o="setSheetObject",r+=`_${n.address.objectKey}`,l={id:r,sheet:n.address.sheetId,key:n.address.objectKey},this.activeSheet=this.sheets.get(n.address.sheetId);break}this.app.send({event:o,target:"app",data:l})})});let e=-1;const t=()=>{if(this.activeSheet!==void 0&&e!==this.activeSheet.sequence.position){e=this.activeSheet.sequence.position;const i=this.activeSheet;this.app.send({event:"updateTimeline",target:"app",data:{position:e,sheet:i.address.sheetId}})}},s=()=>{t(),requestAnimationFrame(s)};t(),s()}else this.studio?.ui.hide()}}function Y0(a){if(a.name==="cameras")return"camera";if(a.name==="interactive")return"interactive";if(a.name==="lights")return"light";if(a.name==="ui")return"ui";if(a.name==="utils")return"utils";const e=a.type;return e.search("Helper")>-1?"icon_utils":e.search("Camera")>-1?"camera":e.search("Light")>-1?"light":"obj3D"}function Gn(a){const e={name:a.name,type:a.type,uuid:a.uuid,children:[]};return a.children.forEach(t=>{e.children.push(Gn(t))}),e}function X0(a){const e={};for(const t in a){const s=a[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 Z0(a){switch(a){case"blendSrcAlpha":case"blendDstAlpha":case"blendEquationAlpha":case"clippingPlanes":case"shadowSide":case"precision":return!0}return!1}function _n(a){const e={};for(const t in a){if(t.substring(0,1)==="_"||t.substring(0,2)==="is"||Z0(t))continue;const s=typeof a[t],i=a[t];switch(s){case"boolean":case"number":case"string":e[t]=i;break;case"object":i!==null?(e[t]=i,i.isTexture?e[t]={src:sa.renderToBlob(i),offset:[i.offset.x,i.offset.y],repeat:[i.repeat.x,i.repeat.y]}:t==="uniforms"&&(e[t]=X0(e[t]))):t==="glslVersion"?e[t]="":e[t]={src:"",offset:[0,0],repeat:[1,1]};break}}return a.anisotropy!==void 0&&(e.anisotropy=a.anisotropy),a.clearcoat!==void 0&&(e.clearcoat=a.clearcoat),a.iridescence!==void 0&&(e.iridescence=a.iridescence),a.dispersion!==void 0&&(e.dispersion=a.dispersion),a.sheen!==void 0&&(e.sheen=a.sheen),a.transmission!==void 0&&(e.transmission=a.transmission),a.transmission!==void 0&&(e.transmission=a.transmission),e}function Ll(a){a.updateMatrix();const e={name:a.name,type:a.type,uuid:a.uuid,visible:a.visible,matrix:a.matrix.elements,animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};a.animations.forEach(s=>{e.animations.push({name:s.name,duration:s.duration,blendMode:s.blendMode})});const t=a.type.toLowerCase();if(t.search("mesh")>-1){const s=a;if(Array.isArray(s.material)){const i=[];s.material.forEach(n=>{i.push(_n(n))}),e.material=i}else e.material=_n(s.material)}else if(t.search("points")>-1){const s=a;if(Array.isArray(s.material)){const i=[];s.material.forEach(n=>{i.push(_n(n))}),e.material=i}else e.material=_n(s.material)}else if(t.search("line")>-1){const s=a;if(Array.isArray(s.material)){const i=[];s.material.forEach(n=>{i.push(_n(n))}),e.material=i}else e.material=_n(s.material)}else t.search("camera")>-1?a.type==="PerspectiveCamera"?e.perspectiveCameraInfo={fov:a.fov,zoom:a.zoom,near:a.near,far:a.far,focus:a.focus,aspect:a.aspect,filmGauge:a.filmGauge,filmOffset:a.filmOffset}:a.type==="OrthographicCamera"&&(e.orthographicCameraInfo={zoom:a.zoom,near:a.near,far:a.far,left:a.left,right:a.right,top:a.top,bottom:a.bottom}):t.search("light")>-1&&(e.lightInfo={color:a.color,intensity:a.intensity,decay:a.decay,distance:a.distance,angle:a.angle,penumbra:a.penumbra,groundColor:a.groundColor,width:a.width,height:a.height});return e}function Q0(a,e){const t=e.split(".");switch(t.length){case 1:return a[t[0]];case 2:return a[t[0]][t[1]];case 3:return a[t[0]][t[1]][t[2]];case 4:return a[t[0]][t[1]][t[2]][t[3]];case 5:return a[t[0]][t[1]][t[2]][t[3]][t[4]];case 6:return a[t[0]][t[1]][t[2]][t[3]][t[4]][t[5]]}}function K0(a,e){for(const t in e)a[t]=e[t]}function qe(a,e,t){if(a===void 0)return;const s=e.split("."),i=s.length;if(typeof t!="object")switch(i){case 1:a[s[0]]=t;break;case 2:a[s[0]][s[1]]=t;break;case 3:a[s[0]][s[1]][s[2]]=t;break;case 4:a[s[0]][s[1]][s[2]][s[3]]=t;break;case 5:a[s[0]][s[1]][s[2]][s[3]][s[4]]=t;break}else{let r;switch(i){case 1:r=a[s[0]];break;case 2:r=a[s[0]][s[1]];break;case 3:r=a[s[0]][s[1]][s[2]];break;case 4:r=a[s[0]][s[1]][s[2]][s[3]];break;case 5:r=a[s[0]][s[1]][s[2]][s[3]][s[4]];break}r!=null&&K0(r,t)}}function tm(a){return new Promise((e,t)=>{const s=new Image;s.onload=()=>{const i=new x.Texture(s);i.wrapS=x.RepeatWrapping,i.wrapT=x.RepeatWrapping,i.needsUpdate=!0,e(i)},s.onerror=t,s.src=a})}class J0 extends al{canvas=null;inputElement=null;scene=void 0;scenes=new Map;renderer=void 0;renderTargets=new Map;groups=new Map;constructor(e){super(e),window.RemoteThree=this}dispose(){this.scenes.forEach(e=>{Is(e)}),this.scenes.clear(),this.scene&&Is(this.scene),this.renderTargets.forEach(e=>{e.dispose()}),this.renderTargets.clear(),this.renderer?.dispose()}getObject(e){this.app.debugEnabled&&(this.renderer!==void 0&&(sa.renderer=this.renderer),this.app.send({event:"getObject",target:"app",data:e}))}setObject(e){this.renderer!==void 0&&(sa.renderer=this.renderer);const t=Ll(e);this.app.send({event:"setObject",target:"editor",data:t})}requestMethod(e,t,s,i){this.app.send({event:"requestMethod",target:"app",data:{uuid:e,key:t,value:s,subitem:i}})}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)}setRenderer(e,t=null){if(this.renderer=e,this.canvas=e.domElement,this.inputElement=t!==null?t:this.canvas,!this.app.debugEnabled)return;const s=`#${e.getClearColor(new x.Color).getHexString()}`;this.app.send({event:"addRenderer",target:"editor",data:{autoClear:e.autoClear,autoClearColor:e.autoClearColor,autoClearDepth:e.autoClearDepth,autoClearStencil:e.autoClearStencil,outputColorSpace:e.outputColorSpace,localClippingEnabled:e.localClippingEnabled,clearColor:s,clearAlpha:e.getClearAlpha(),colorManagement:x.ColorManagement.enabled,toneMapping:e.toneMapping,toneMappingExposure:e.toneMappingExposure,type:e.isWebGLRenderer?"WebGLRenderer":"WebGPURenderer"}})}updateRenderer(e){this.app.send({event:"updateRenderer",target:"app",data:e})}addScene(e){if(e===void 0||(this.scenes.set(e.name,e),!this.app.debugEnabled))return;oh(),Uo(e);const t=Gn(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=Gn(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=Gn(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,i)=>{e.search(i)>-1&&(t=s)}),t}setScene(e){if(e===void 0||(this.scene=e,!this.app.debugEnabled))return;this.renderer!==void 0&&(sa.renderer=this.renderer),oh(),Uo(e);const t=Gn(e);this.app.send({event:"setScene",target:"editor",data:t})}addCamera(e){if(!this.app.debugEnabled)return;const t=Ll(e);this.app.send({event:"addCamera",target:"editor",data:t})}removeCamera(e){if(!this.app.debugEnabled)return;const t=Ll(e);this.app.send({event:"removeCamera",target:"editor",data:t})}handleApp(e){switch(e.event){case"getObject":this.app.dispatchEvent({type:Q.GET_OBJECT,value:e.data});break;case"updateObject":this.app.dispatchEvent({type:Q.UPDATE_OBJECT,value:e.data});break;case"createTexture":this.app.dispatchEvent({type:Q.CREATE_TEXTURE,value:e.data});break;case"requestMethod":this.app.dispatchEvent({type:Q.REQUEST_METHOD,value:e.data});break;case"refreshScene":this.app.send({event:"refreshScene",target:"editor",data:Gn(this.scenes.get(e.data.name))});break;case"updateRenderer":this.renderer&&(this.renderer.autoClearColor=e.data.autoClearColor,this.renderer.outputColorSpace=e.data.outputColorSpace,this.renderer.localClippingEnabled=e.data.localClippingEnabled,this.renderer.setClearColor(e.data.clearColor,e.data.clearAlpha),this.renderer.toneMapping=e.data.toneMapping,this.renderer.toneMappingExposure=e.data.toneMappingExposure,x.ColorManagement.enabled=e.data.colorManagement);break}if(e.event==="updateGroup"){const t=JSON.parse(e.data);this.groups.get(t.group)?.onUpdate(t.prop,t.value)}}handleEditor(e){switch(e.event){case"setObject":this.app.dispatchEvent({type:Q.SET_OBJECT,value:e.data});break;case"addScene":this.app.dispatchEvent({type:Q.ADD_SCENE,value:e.data});break;case"refreshScene":this.app.dispatchEvent({type:Q.REFRESH_SCENE,value:e.data});break;case"removeScene":this.app.dispatchEvent({type:Q.REMOVE_SCENE,value:e.data});break;case"setScene":this.app.dispatchEvent({type:Q.SET_SCENE,value:e.data});break;case"addCamera":this.app.dispatchEvent({type:Q.ADD_CAMERA,value:e.data});break;case"removeCamera":this.app.dispatchEvent({type:Q.REMOVE_CAMERA,value:e.data});break;case"addGroup":this.app.dispatchEvent({type:Q.ADD_GROUP,value:e.data});break;case"removeGroup":this.app.dispatchEvent({type:Q.REMOVE_GROUP,value:e.data});break;case"addSpline":this.app.dispatchEvent({type:Q.ADD_SPLINE,value:e.data});break;case"addRenderer":this.app.dispatchEvent({type:Q.ADD_RENDERER,value:e.data})}}addRT(e,t){const s=new x.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)});const i=!(this.renderer?.domElement instanceof OffscreenCanvas);this.renderer?.setSize(e,t,i)}set dpr(e){this.renderer?.setPixelRatio(Ti(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}}var Pa={exports:{}},_r={};/**
|
19
19
|
* @license React
|
20
20
|
* react-jsx-runtime.production.min.js
|
21
21
|
*
|
package/dist/hermes.es.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Texture as Ah, OrthographicCamera as Rh, Scene as mu, MeshBasicMaterial as _n, BufferGeometry as bn, Float32BufferAttribute as gn, Mesh as Y, LinearSRGBColorSpace as Ra, ObjectLoader as nx, AnimationMixer as rx, AnimationClip as ax, EventDispatcher as gu, Clock as Nm, Group as Wo, RepeatWrapping as Ud, Color as Sn, ColorManagement as tr,
|
1
|
+
import { Texture as Ah, OrthographicCamera as Rh, Scene as mu, MeshBasicMaterial as _n, BufferGeometry as bn, Float32BufferAttribute as gn, Mesh as Y, LinearSRGBColorSpace as Ra, ObjectLoader as nx, AnimationMixer as rx, AnimationClip as ax, EventDispatcher as gu, Clock as Nm, Group as Wo, RepeatWrapping as Ud, Color as Sn, ColorManagement as tr, WebGLRenderTarget as ox, FrontSide as lx, BackSide as Pm, DoubleSide as yu, ZeroFactor as Fm, OneFactor as Dm, SrcColorFactor as Om, OneMinusSrcColorFactor as Im, SrcAlphaFactor as Bm, OneMinusSrcAlphaFactor as Lm, DstAlphaFactor as Um, OneMinusDstAlphaFactor as km, DstColorFactor as zm, OneMinusDstColorFactor as Gm, SrcAlphaSaturateFactor as cx, ConstantColorFactor as Vm, OneMinusConstantColorFactor as Hm, ConstantAlphaFactor as Wm, OneMinusConstantAlphaFactor as $m, AddEquation as hx, SubtractEquation as ux, ReverseSubtractEquation as dx, MinEquation as px, MaxEquation as fx, NoBlending as mx, NormalBlending as gx, AdditiveBlending as yx, SubtractiveBlending as xx, MultiplyBlending as _x, CustomBlending as bx, Line as Ls, LineBasicMaterial as xu, Controls as jm, Vector3 as Z, MOUSE as cr, TOUCH as sr, Quaternion as Jt, Spherical as Nh, Vector2 as yt, Ray as Tx, Plane as Sx, MathUtils as vx, ShaderMaterial as qm, GLSL3 as wx, PlaneGeometry as Ym, Raycaster as Na, Object3D as _r, CylinderGeometry as kt, BoxGeometry as bt, OctahedronGeometry as Za, TorusGeometry as Ir, SphereGeometry as Xm, Euler as Zm, Matrix4 as Al, CatmullRomCurve3 as kd, AxesHelper as Ex, MeshDepthMaterial as Cx, MeshNormalMaterial as Mx, Sphere as Ax, Box3 as Rx, Vector4 as Nx, WebGLRenderer as ha, PerspectiveCamera as zd, CameraHelper as Px, SkinnedMesh as Fx, SpotLightHelper as Dx, PointLightHelper as Ox, HemisphereLightHelper as Ix, DirectionalLightHelper as Bx, SkeletonHelper as Lx, SRGBColorSpace as Gd, NoToneMapping as Vd, NoColorSpace as Ux, LinearToneMapping as kx, ReinhardToneMapping as zx, CineonToneMapping as Gx, ACESFilmicToneMapping as Vx, AgXToneMapping as Hx, NeutralToneMapping as Wx, CustomToneMapping as $x } from "three";
|
2
2
|
import Km, { useState as Re, useRef as We, useEffect as vn, useMemo as ba, Component as za, createRef as Ai, forwardRef as jx } from "react";
|
3
3
|
const nl = () => {
|
4
4
|
}, KN = () => {
|
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.
|
10
|
+
"version": "0.0.144",
|
11
11
|
"homepage": "https://github.com/tomorrowevening/hermes#readme",
|
12
12
|
"bugs": {
|
13
13
|
"url": "https://github.com/tomorrowevening/hermes/issues"
|
@@ -1,43 +1,43 @@
|
|
1
|
-
import { Camera, Curve, RenderTargetOptions, Scene,
|
2
|
-
import { Application } from '../Application';
|
3
|
-
import BaseRemote from './BaseRemote';
|
4
|
-
import { BroadcastData, GroupData } from '../types';
|
5
|
-
export default class RemoteThree extends BaseRemote {
|
6
|
-
canvas: HTMLCanvasElement | null;
|
7
|
-
inputElement: any;
|
8
|
-
scene?: Scene;
|
9
|
-
scenes: Map<string, Scene>;
|
10
|
-
renderer?: any;
|
11
|
-
renderTargets: Map<string,
|
12
|
-
private groups;
|
13
|
-
constructor(app: Application);
|
14
|
-
dispose(): void;
|
15
|
-
getObject(uuid: string): void;
|
16
|
-
setObject(value: any): void;
|
17
|
-
requestMethod(uuid: string, key: string, value?: any, subitem?: string): void;
|
18
|
-
updateObject(uuid: string, key: string, value: any): void;
|
19
|
-
createTexture(uuid: string, key: string, value: any): void;
|
20
|
-
addGroup(data: GroupData): void;
|
21
|
-
removeGroup(name: string): void;
|
22
|
-
updateGroup(group: string, prop: string, value: any): void;
|
23
|
-
removeAllGroups(): void;
|
24
|
-
addSpline(spline: Curve<any>): void;
|
25
|
-
setRenderer(value: any, inputElement?: any): void;
|
26
|
-
updateRenderer(data: any): void;
|
27
|
-
addScene(value: Scene): void;
|
28
|
-
refreshScene(value: string): void;
|
29
|
-
removeScene(value: Scene): void;
|
30
|
-
removeAllScenes(): void;
|
31
|
-
getScene(uuid: string): Scene | null;
|
32
|
-
setScene(value: Scene): void;
|
33
|
-
addCamera(camera: Camera): void;
|
34
|
-
removeCamera(camera: Camera): void;
|
35
|
-
handleApp(msg: BroadcastData): void;
|
36
|
-
handleEditor(msg: BroadcastData): void;
|
37
|
-
addRT(name: string, params?: RenderTargetOptions): void;
|
38
|
-
resize(width: number, height: number): void;
|
39
|
-
set dpr(value: number);
|
40
|
-
get dpr(): number;
|
41
|
-
get width(): number;
|
42
|
-
get height(): number;
|
43
|
-
}
|
1
|
+
import { Camera, Curve, RenderTargetOptions, Scene, WebGLRenderTarget } from 'three';
|
2
|
+
import { Application } from '../Application';
|
3
|
+
import BaseRemote from './BaseRemote';
|
4
|
+
import { BroadcastData, GroupData } from '../types';
|
5
|
+
export default class RemoteThree extends BaseRemote {
|
6
|
+
canvas: HTMLCanvasElement | null;
|
7
|
+
inputElement: any;
|
8
|
+
scene?: Scene;
|
9
|
+
scenes: Map<string, Scene>;
|
10
|
+
renderer?: any;
|
11
|
+
renderTargets: Map<string, WebGLRenderTarget>;
|
12
|
+
private groups;
|
13
|
+
constructor(app: Application);
|
14
|
+
dispose(): void;
|
15
|
+
getObject(uuid: string): void;
|
16
|
+
setObject(value: any): void;
|
17
|
+
requestMethod(uuid: string, key: string, value?: any, subitem?: string): void;
|
18
|
+
updateObject(uuid: string, key: string, value: any): void;
|
19
|
+
createTexture(uuid: string, key: string, value: any): void;
|
20
|
+
addGroup(data: GroupData): void;
|
21
|
+
removeGroup(name: string): void;
|
22
|
+
updateGroup(group: string, prop: string, value: any): void;
|
23
|
+
removeAllGroups(): void;
|
24
|
+
addSpline(spline: Curve<any>): void;
|
25
|
+
setRenderer(value: any, inputElement?: any): void;
|
26
|
+
updateRenderer(data: any): void;
|
27
|
+
addScene(value: Scene): void;
|
28
|
+
refreshScene(value: string): void;
|
29
|
+
removeScene(value: Scene): void;
|
30
|
+
removeAllScenes(): void;
|
31
|
+
getScene(uuid: string): Scene | null;
|
32
|
+
setScene(value: Scene): void;
|
33
|
+
addCamera(camera: Camera): void;
|
34
|
+
removeCamera(camera: Camera): void;
|
35
|
+
handleApp(msg: BroadcastData): void;
|
36
|
+
handleEditor(msg: BroadcastData): void;
|
37
|
+
addRT(name: string, params?: RenderTargetOptions): void;
|
38
|
+
resize(width: number, height: number): void;
|
39
|
+
set dpr(value: number);
|
40
|
+
get dpr(): number;
|
41
|
+
get width(): number;
|
42
|
+
get height(): number;
|
43
|
+
}
|
@@ -1,53 +1,53 @@
|
|
1
|
-
import { Camera, CatmullRomCurve3, Line, Mesh, Object3D, Vector3 } from 'three';
|
2
|
-
import InspectorGroup from '@/editor/sidePanel/inspector/InspectorGroup';
|
3
|
-
export type CurveType = 'catmullrom' | 'centripetal' | 'chordal';
|
4
|
-
export default class Spline extends Object3D {
|
5
|
-
curve: CatmullRomCurve3;
|
6
|
-
line: Line;
|
7
|
-
draggable: Object3D;
|
8
|
-
curvePos: Mesh;
|
9
|
-
tension: number;
|
10
|
-
closed: boolean;
|
11
|
-
subdivide: number;
|
12
|
-
curveType: CurveType;
|
13
|
-
offset: number;
|
14
|
-
private lineMaterial;
|
15
|
-
private _camera;
|
16
|
-
private _curvePercentage;
|
17
|
-
private _draggableScale;
|
18
|
-
private _transform?;
|
19
|
-
private raycaster;
|
20
|
-
private draggedMat;
|
21
|
-
private parentGroup;
|
22
|
-
private group;
|
23
|
-
constructor(name: string, camera: Camera);
|
24
|
-
enable(): void;
|
25
|
-
disable(): void;
|
26
|
-
dispose: () => void;
|
27
|
-
hideTransform: () => void;
|
28
|
-
exportSpline: () => void;
|
29
|
-
showPoints: (visible?: boolean) => void;
|
30
|
-
addPoints: (pts?: Array<Vector3>) => void;
|
31
|
-
addPoint: (position: Vector3, update?: boolean) => Mesh;
|
32
|
-
addNextPt: () => void;
|
33
|
-
removePoint: (child: Object3D) => void;
|
34
|
-
removePointAt: (index: number) => void;
|
35
|
-
removeSelectedPt: () => void;
|
36
|
-
updateLastPoint(value: Vector3): void;
|
37
|
-
updateSpline: () => void;
|
38
|
-
private onMouseClick;
|
39
|
-
getPointAt(percentage: number): Vector3;
|
40
|
-
getTangentAt(percentage: number): Vector3;
|
41
|
-
get points(): Array<Vector3>;
|
42
|
-
get total(): number;
|
43
|
-
get draggableScale(): number;
|
44
|
-
set draggableScale(value: number);
|
45
|
-
get camera(): Camera;
|
46
|
-
set camera(value: Camera);
|
47
|
-
get curvePercentage(): number;
|
48
|
-
set curvePercentage(value: number);
|
49
|
-
private updateCurrentPoint;
|
50
|
-
private onUpdateTransform;
|
51
|
-
initDebug(parentGroup: InspectorGroup): void;
|
52
|
-
private debugPoint;
|
53
|
-
}
|
1
|
+
import { Camera, CatmullRomCurve3, Line, Mesh, Object3D, Vector3 } from 'three';
|
2
|
+
import InspectorGroup from '@/editor/sidePanel/inspector/InspectorGroup';
|
3
|
+
export type CurveType = 'catmullrom' | 'centripetal' | 'chordal';
|
4
|
+
export default class Spline extends Object3D {
|
5
|
+
curve: CatmullRomCurve3;
|
6
|
+
line: Line;
|
7
|
+
draggable: Object3D;
|
8
|
+
curvePos: Mesh;
|
9
|
+
tension: number;
|
10
|
+
closed: boolean;
|
11
|
+
subdivide: number;
|
12
|
+
curveType: CurveType;
|
13
|
+
offset: number;
|
14
|
+
private lineMaterial;
|
15
|
+
private _camera;
|
16
|
+
private _curvePercentage;
|
17
|
+
private _draggableScale;
|
18
|
+
private _transform?;
|
19
|
+
private raycaster;
|
20
|
+
private draggedMat;
|
21
|
+
private parentGroup;
|
22
|
+
private group;
|
23
|
+
constructor(name: string, camera: Camera);
|
24
|
+
enable(): void;
|
25
|
+
disable(): void;
|
26
|
+
dispose: () => void;
|
27
|
+
hideTransform: () => void;
|
28
|
+
exportSpline: () => void;
|
29
|
+
showPoints: (visible?: boolean) => void;
|
30
|
+
addPoints: (pts?: Array<Vector3>) => void;
|
31
|
+
addPoint: (position: Vector3, update?: boolean) => Mesh;
|
32
|
+
addNextPt: () => void;
|
33
|
+
removePoint: (child: Object3D) => void;
|
34
|
+
removePointAt: (index: number) => void;
|
35
|
+
removeSelectedPt: () => void;
|
36
|
+
updateLastPoint(value: Vector3): void;
|
37
|
+
updateSpline: () => void;
|
38
|
+
private onMouseClick;
|
39
|
+
getPointAt(percentage: number): Vector3;
|
40
|
+
getTangentAt(percentage: number): Vector3;
|
41
|
+
get points(): Array<Vector3>;
|
42
|
+
get total(): number;
|
43
|
+
get draggableScale(): number;
|
44
|
+
set draggableScale(value: number);
|
45
|
+
get camera(): Camera;
|
46
|
+
set camera(value: Camera);
|
47
|
+
get curvePercentage(): number;
|
48
|
+
set curvePercentage(value: number);
|
49
|
+
private updateCurrentPoint;
|
50
|
+
private onUpdateTransform;
|
51
|
+
initDebug(parentGroup: InspectorGroup): void;
|
52
|
+
private debugPoint;
|
53
|
+
}
|
@@ -1,38 +1,38 @@
|
|
1
|
-
import { Camera, CatmullRomCurve3, Object3D, Vector3 } from 'three';
|
2
|
-
import Spline from './Spline';
|
3
|
-
import { Application } from '@/core/Application';
|
4
|
-
export type SplineJSON = {
|
5
|
-
name: string;
|
6
|
-
points: Array<number[]>;
|
7
|
-
tension: number;
|
8
|
-
closed: boolean;
|
9
|
-
subdivide: number;
|
10
|
-
type: string;
|
11
|
-
};
|
12
|
-
export default class SplineEditor extends Object3D {
|
13
|
-
defaultScale: number;
|
14
|
-
currentSpline: Spline | null;
|
15
|
-
private _camera;
|
16
|
-
private group;
|
17
|
-
private app;
|
18
|
-
private splineDataText;
|
19
|
-
constructor(camera: Camera, app: Application);
|
20
|
-
initDebug(): void;
|
21
|
-
dispose(): void;
|
22
|
-
addSpline(spline: Spline): void;
|
23
|
-
createSpline: (defaultPoints?: Array<Vector3>) => Spline;
|
24
|
-
createSplineFromArray: (points: Array<number[]>) => Spline;
|
25
|
-
createSplineFromCatmullRom: (curve: CatmullRomCurve3) => Spline;
|
26
|
-
createSplineFromJSON: (data: SplineJSON) => Spline;
|
27
|
-
showPoints: (visible?: boolean) => void;
|
28
|
-
private onAddSpline;
|
29
|
-
private isMouseDown;
|
30
|
-
private enableClickToDraw;
|
31
|
-
private disableClickToDraw;
|
32
|
-
private onClickCanvas;
|
33
|
-
private onMouseMove;
|
34
|
-
private onMouseUp;
|
35
|
-
private mouseToSplinePos;
|
36
|
-
get camera(): Camera;
|
37
|
-
set camera(value: Camera);
|
38
|
-
}
|
1
|
+
import { Camera, CatmullRomCurve3, Object3D, Vector3 } from 'three';
|
2
|
+
import Spline from './Spline';
|
3
|
+
import { Application } from '@/core/Application';
|
4
|
+
export type SplineJSON = {
|
5
|
+
name: string;
|
6
|
+
points: Array<number[]>;
|
7
|
+
tension: number;
|
8
|
+
closed: boolean;
|
9
|
+
subdivide: number;
|
10
|
+
type: string;
|
11
|
+
};
|
12
|
+
export default class SplineEditor extends Object3D {
|
13
|
+
defaultScale: number;
|
14
|
+
currentSpline: Spline | null;
|
15
|
+
private _camera;
|
16
|
+
private group;
|
17
|
+
private app;
|
18
|
+
private splineDataText;
|
19
|
+
constructor(camera: Camera, app: Application);
|
20
|
+
initDebug(): void;
|
21
|
+
dispose(): void;
|
22
|
+
addSpline(spline: Spline): void;
|
23
|
+
createSpline: (defaultPoints?: Array<Vector3>) => Spline;
|
24
|
+
createSplineFromArray: (points: Array<number[]>) => Spline;
|
25
|
+
createSplineFromCatmullRom: (curve: CatmullRomCurve3) => Spline;
|
26
|
+
createSplineFromJSON: (data: SplineJSON) => Spline;
|
27
|
+
showPoints: (visible?: boolean) => void;
|
28
|
+
private onAddSpline;
|
29
|
+
private isMouseDown;
|
30
|
+
private enableClickToDraw;
|
31
|
+
private disableClickToDraw;
|
32
|
+
private onClickCanvas;
|
33
|
+
private onMouseMove;
|
34
|
+
private onMouseUp;
|
35
|
+
private mouseToSplinePos;
|
36
|
+
get camera(): Camera;
|
37
|
+
set camera(value: Camera);
|
38
|
+
}
|