minecraft-renderer 0.1.86 → 0.1.87
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.
|
@@ -761,7 +761,7 @@ void main() {
|
|
|
761
761
|
src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff");
|
|
762
762
|
}`;function Wl(n){let e=document.createElement("style");e.innerHTML=n;let t=document.querySelector("head link[rel=stylesheet], head style");t?document.head.insertBefore(e,t):document.head.appendChild(e)}var A2=!1,Wn=class n{constructor({parent:e,autoPlace:t=e===void 0,container:r,width:i,title:s="Controls",closeFolders:o=!1,injectStyles:l=!0,touchStyles:a=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",v=>{(v.code==="Enter"||v.code==="Space")&&(v.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(s),this.parent){this.parent.children.push(this),this.parent.folders.push(this),this.parent.$children.appendChild(this.domElement);return}this.domElement.classList.add("root"),a&&this.domElement.classList.add("allow-touch-styles"),!A2&&l&&(Wl(Vl),A2=!0),r?r.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),i&&this.domElement.style.setProperty("--width",i+"px"),this._closeFolders=o}add(e,t,r,i,s){if(Object(r)===r)return new Gn(this,e,t,r);switch(typeof e[t]){case"number":return new Un(this,e,t,r,i,s);case"boolean":return new Dn(this,e,t);case"string":return new Vn(this,e,t);case"function":return new F5(this,e,t)}}addColor(e,t,r=1){return new zn(this,e,t,r)}addFolder(e){let t=new n({parent:this,title:e});return this.root._closeFolders&&t.close(),t}load(e,t=!0){return e.controllers&&this.controllers.forEach(r=>{r instanceof F5||r._name in e.controllers&&r.load(e.controllers[r._name])}),t&&e.folders&&this.folders.forEach(r=>{r._title in e.folders&&r.load(e.folders[r._title])}),this}save(e=!0){let t={controllers:{},folders:{}};return this.controllers.forEach(r=>{if(!(r instanceof F5)){if(r._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${r._name}"`);t.controllers[r._name]=r.save()}}),e&&this.folders.forEach(r=>{if(r._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${r._title}"`);t.folders[r._title]=r.save()}),t}open(e=!0){return this._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(e){this._closed!==e&&(this._closed=e,this._callOnOpenClose(this))}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{let t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");let r=s=>{s.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",r))};this.$children.addEventListener("transitionend",r);let i=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=i+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(r=>r.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onOpenClose(e){return this._onOpenClose=e,this}_callOnOpenClose(e){this.parent&&this.parent._callOnOpenClose(e),this._onOpenClose!==void 0&&this._onOpenClose.call(this,e)}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}},Nn=Wn;var Dt=class{constructor(e,t,r,i){d(this,"gui",null);d(this,"storageKey","");d(this,"target");d(this,"params",[]);d(this,"paramsMeta",{});d(this,"_visible",!1);d(this,"initialValues",{});d(this,"initialized",!1);if(!ve){this.gui=new Nn,this.storageKey=`debug_params_${e}`,this.target=t,this.paramsMeta=i??{},this.params=r??Object.keys(t);for(let s of this.params)this.initialValues[s]=t[s];this.gui.domElement.style.display="none"}}activate(){return ve?this:(!this.initialized&&this.gui&&(this.loadSavedValues(),this.setupControls(),this.initialized=!0),this.show(),this)}get visible(){return ve?!1:this._visible}set visible(e){ve||!this.gui||(this._visible=e,this.gui.domElement.style.display=e?"block":"none",this.saveVisibility())}loadSavedValues(){if(!ve)try{let e=localStorage.getItem(this.storageKey);if(e){let t=JSON.parse(e);for(let r of this.params)if(r in t){let i=t[r];i!==null&&(this.target[r]=i)}}}catch{}}saveValues(e=!1){if(!ve)try{let t={};for(let r of this.params)t[r]=this.target[r];e?localStorage.removeItem(this.storageKey):localStorage.setItem(this.storageKey,JSON.stringify(t))}catch{}}saveVisibility(){if(!ve)try{localStorage.setItem(`${this.storageKey}_visible`,this._visible.toString())}catch{}}setupControls(){if(!(ve||!this.gui)){this.gui.add(this,"visible").name("Show Controls"),this.gui.add({resetAll:()=>{if(this.gui){for(let e of this.params)this.target[e]=this.initialValues[e];this.saveValues(!0),this.gui.destroy(),this.gui=new Nn,this.setupControls()}}},"resetAll").name("Reset All Parameters");for(let e of this.params){let t=this.target[e],r=this.paramsMeta[e]??{};if(typeof t=="number"){let i=r.min??t-Math.abs(t*2),s=r.max??t+Math.abs(t*2),o=r.step??Math.abs(t)/100;this.gui.add(this.target,e,i,s,o).onChange(()=>this.saveValues())}else if(typeof t=="boolean")this.gui.add(this.target,e).onChange(()=>this.saveValues());else if(typeof t=="string"&&["x","y","z"].includes(e)){let i=r.min??-10,s=r.max??10,o=r.step??.1;this.gui.add(this.target,e,i,s,o).onChange(()=>this.saveValues())}else Array.isArray(t)&&this.gui.add(this.target,e,t).onChange(()=>this.saveValues())}}}save(){ve||(this.saveValues(),this.saveVisibility())}destroy(){ve||!this.gui||(this.saveVisibility(),this.gui.destroy())}toggle(){this.visible=!this.visible}show(){this.visible=!0}hide(){this.visible=!1}};E();x();R();k();E();x();R();k();var Fr=class{constructor(){d(this,"currentAnimation",null);d(this,"isAnimating",!1);d(this,"cancelRequested",!1);d(this,"completionCallbacks",[]);d(this,"currentCancelCallback",null)}async startAnimation(e,t){return this.isAnimating&&await this.cancelCurrentAnimation(),new Promise(r=>{this.isAnimating=!0,this.cancelRequested=!1,this.currentCancelCallback=t??null,this.currentAnimation=e(),this.completionCallbacks.push(()=>{this.isAnimating=!1,this.currentAnimation=null,r()})})}async cancelCurrentAnimation(){if(this.isAnimating){if(this.currentCancelCallback){let e=this.currentCancelCallback;this.currentCancelCallback=null,e()}return new Promise(e=>{this.cancelRequested=!0,this.completionCallbacks.push(()=>{e()})})}}animationCycleFinish(){this.cancelRequested&&this.forceFinish()}forceFinish(e=!0){if(!this.isAnimating)return;if(this.currentAnimation){for(let r of this.currentAnimation.getAll())r.stop();this.currentAnimation.removeAll(),this.currentAnimation=null}this.isAnimating=!1,this.cancelRequested=!1;let t=[...this.completionCallbacks];if(this.completionCallbacks=[],e)for(let r of t)r()}update(){this.currentAnimation&&this.currentAnimation.update()}get isActive(){return this.isAnimating}get shouldCancel(){return this.cancelRequested}};var Nl={x:3e3,y:3e3,z:3e3,rotation:Math.PI,scale:1,default:3e3},k0=class{constructor(e,t,r){this.getState=e;this.setState=t;d(this,"animationController",new Fr);d(this,"defaultState");d(this,"speeds");d(this,"currentStateName","");d(this,"transitioningToStateName","");this.speeds={...Nl},r&&Object.assign(this.speeds,r),this.defaultState=this.getState()}calculateDuration(e){let t=0,r=this.getState();for(let[i,s]of Object.entries(e)){let o=r[i],l=Math.abs(s-o),a=this.getPropertySpeed(i),v=l/a*1e3;t=Math.max(t,v)}return Math.min(Math.max(t,200),2e3)}getPropertySpeed(e){return e in this.speeds?this.speeds[e]:e.toLowerCase().includes("rotation")?this.speeds.rotation:e.toLowerCase().includes("scale")?this.speeds.scale:e.toLowerCase()==="x"||e.toLowerCase()==="y"||e.toLowerCase()==="z"?this.speeds[e]:this.speeds.default}startTransition(e,t,r,i=De.Linear.None,s){this.isTransitioning&&this.animationController.forceFinish(!1),this.transitioningToStateName=t??"";let o=this.getState(),l=this.calculateDuration(e);this.animationController.startAnimation(()=>{let a=new N0;return new ze(o,a).to(e,l).easing(i).onUpdate(v=>{for(let c of Object.keys(v))this.setState(c,v[c])}).onComplete(()=>{this.animationController.forceFinish(),this.currentStateName=this.transitioningToStateName,this.transitioningToStateName="",r?.()}).start(),a},s)}reset(){this.startTransition(this.defaultState)}update(){this.animationController.update()}forceFinish(){this.animationController.forceFinish()}transitionTo(e,t,r,i){this.startTransition(e,t,r,De.Linear.None,i)}getCurrentValue(e){return this.getState()[e]}get isTransitioning(){return this.animationController.isActive}};E();x();R();k();import{subscribeKey as jl}from"valtio/utils";function zr(n,e,t,r,i){let s=0,o,l=async()=>{let a=++s,v=await n(e[t]);a===s?(o&&i?.(o),r(v),o=v):i?.(v)};return l(),jl(e,t,l)}E();x();R();k();var E2=Math.PI/180;function Ur(n){let{walkDist:e,prevWalkDist:t,bob:r,prevBob:i,partialTick:s}=n,o=e-t,l=-(e+o*s),a=i+(r-i)*s,v=Math.sin(l*Math.PI),c=Math.cos(l*Math.PI);return{position:{x:v*a*.5,y:-Math.abs(c*a)},rotation:{x:Math.abs(Math.cos(l*Math.PI-.2)*a)*5*E2,z:v*a*3*E2}}}E();x();R();k();var Gr=n=>({"minecraft:display_context":"firstperson","minecraft:use_duration":n.playerStateReactive.itemUsageTicks,"minecraft:using_item":!!n.playerStateReactive.itemUsageTicks}),Ql=()=>({"minecraft:display_context":"firstperson"}),q0=(n,e)=>{if(!e)return"empty";if(e.type==="hand")return"hand";let t=e.name??(e.id!==void 0?`#${e.id}`:"unknown");if(!n.resourcesManager.currentResources)return`${e.type}:${t}`;let r=n.getItemRenderData({...e.fullItem,itemId:e.id},Ql());return`${e.type}:${t}:${r.modelName}`};var Xe=new Pe.Matrix4,x2=n=>(n=(n+Math.PI)%(Math.PI*2),n<0&&(n+=Math.PI*2),n-Math.PI);function Yl(n,e){let t=new Pe.Matrix4,r=1,i=Math.sqrt(n),s=-.3*Math.sin(i*Math.PI),o=.4*Math.sin(i*2*Math.PI),l=-.4*Math.sin(n*Math.PI);return t.multiply(Xe.makeTranslation(r*(s+.64),o-.6+e*-.6,l-.72)),t.multiply(Xe.makeRotationY(r*45*Math.PI/180)),t.multiply(Xe.makeRotationY(r*Math.sin(i*Math.PI)*70*Math.PI/180)),t.multiply(Xe.makeRotationZ(r*Math.sin(n*n*Math.PI)*-20*Math.PI/180)),t.multiply(Xe.makeTranslation(r*-1,3.6,3.5)),t.multiply(Xe.makeRotationZ(r*120*Math.PI/180)),t.multiply(Xe.makeRotationX(200*Math.PI/180)),t.multiply(Xe.makeRotationY(r*-135*Math.PI/180)),t.multiply(Xe.makeTranslation(r*5.6,0,0)),t.multiply(Xe.makeTranslation(r*-5/16,2/16,0)),t}function ql(n,e){let t=new Pe.Matrix4,r=1,i=Math.sqrt(n),s=-.4*Math.sin(i*Math.PI),o=.2*Math.sin(i*2*Math.PI),l=-.2*Math.sin(n*Math.PI);t.multiply(Xe.makeTranslation(r*s,o,l)),t.multiply(Xe.makeTranslation(r*.56,-.52+e*-.6,-.72));let a=Math.sin(n*n*Math.PI),v=Math.sin(i*Math.PI);return t.multiply(Xe.makeRotationY(r*(45+a*-20)*Math.PI/180)),t.multiply(Xe.makeRotationZ(r*v*-20*Math.PI/180)),t.multiply(Xe.makeRotationX(v*-80*Math.PI/180)),t.multiply(Xe.makeRotationY(r*-45*Math.PI/180)),t}var U5=class{constructor(e,t=!1){this.worldRenderer=e;this.offHand=t;d(this,"holdingBlock");d(this,"blockSwapAnimation");d(this,"cameraGroup",new Pe.Mesh);d(this,"armTransformGroup",new Pe.Group);d(this,"camera",new Pe.PerspectiveCamera(70,1,.05,100));d(this,"equipProgress",0);d(this,"stopUpdate",!1);d(this,"lastHeldItem");d(this,"lastHeldItemRenderKey");d(this,"currentDisplayType","hand");d(this,"isSwinging",!1);d(this,"nextIterStopCallbacks");d(this,"idleAnimator");d(this,"ready",!1);d(this,"lastUpdate",0);d(this,"xBob",0);d(this,"yBob",0);d(this,"lastBobUpdateTime",0);d(this,"lastBobWalkDist",0);d(this,"lastBobTickTime",0);d(this,"playerHand");d(this,"offHandDisplay",!1);d(this,"offHandModeLegacy",!1);d(this,"swingAnimator");d(this,"config");d(this,"disposed",!1);d(this,"unsubs",[]);d(this,"lastItemModelName");d(this,"switchRequest",0);this.initCameraGroup(),this.swingAnimator=new jn,this.unsubs.push(this.worldRenderer.onReactivePlayerStateUpdated("heldItemMain",()=>{this.offHand||this.updateItem()},!1),this.worldRenderer.onReactivePlayerStateUpdated("heldItemOff",()=>{this.offHand&&this.updateItem()},!1)),this.config=e.displayOptions.inWorldRenderingConfig,this.offHandDisplay=this.offHand,this.offHand||D5().then(r=>{this.disposed||(this.playerHand=r,this.updateItem())}).then(()=>{if(this.disposed)return;let r=zr(async()=>D5(this.worldRenderer.playerStateReactive.playerSkin,this.worldRenderer.playerStateReactive.onlineMode?this.worldRenderer.playerStateReactive.username:void 0),this.worldRenderer.playerStateReactive,"playerSkin",i=>{i&&(this.playerHand=i,this.updateItem())},i=>{Se(i,!0)});this.unsubs.push(r)})}dispose(){this.disposed=!0,this.unsubs.forEach(e=>e()),this.unsubs=[],this.idleAnimator?.destroy(),this.idleAnimator=void 0,this.swingAnimator?.stopSwing(),this.swingAnimator=void 0,this.blockSwapAnimation?.switcher.forceFinish(),this.blockSwapAnimation=void 0,Se(this.cameraGroup,!0),this.holdingBlock&&this.holdingBlock!==this.playerHand&&Se(this.holdingBlock,!0),this.holdingBlock=void 0,this.playerHand&&(Se(this.playerHand,!0),this.playerHand=void 0),this.ready=!1}updateItem(){if(!this.ready)return;let e=this.offHand?this.worldRenderer.playerStateReactive.heldItemOff:this.worldRenderer.playerStateReactive.heldItemMain;e?this.setNewItem(e):this.offHand?this.setNewItem():this.setNewItem({type:"hand"})}initCameraGroup(){this.cameraGroup=new Pe.Mesh,this.armTransformGroup=new Pe.Group,this.armTransformGroup.matrixAutoUpdate=!1,this.cameraGroup.add(this.armTransformGroup)}startSwing(){this.swingAnimator?.startSwing()}stopSwing(){this.swingAnimator?.stopSwing()}render(e,t,r,i){if(!this.lastHeldItem)return;let s=performance.now();this.lastUpdate&&s-this.lastUpdate>50&&this.replaceItemModel(this.lastHeldItem),(this.swingAnimator?.isCurrentlySwinging()||this.swingAnimator?.debugParams.animationStage)&&this.swingAnimator?.update(),this.blockSwapAnimation?.switcher.update();let o=new Pe.Scene;o.add(this.cameraGroup);let l=t.getSize(new Pe.Vector2),a=l.height>l.width;a?this.camera.aspect!==1&&(this.camera.aspect=1,this.camera.updateProjectionMatrix()):this.camera.aspect!==e.aspect&&(this.camera.aspect=e.aspect,this.camera.updateProjectionMatrix()),this.updateCameraGroup(),o.add(r.clone()),o.add(i.clone());let{offHandDisplay:v}=this;if(v&&(this.cameraGroup.scale.x=-1),t.autoClear=!1,t.clearDepth(),a){let c=Math.min(l.width,l.height);v?t.setViewport(0,0,c,c):t.setViewport(l.width-c,0,c,c)}t.render(o,this.camera),a&&t.setViewport(0,0,l.width,l.height),v&&(this.cameraGroup.scale.x=1)}async playBlockSwapAnimation(e){this.blockSwapAnimation??(this.blockSwapAnimation={switcher:new k0(()=>({progress:this.equipProgress}),(i,s)=>{i==="progress"&&(this.equipProgress=s)},{progress:4})});let t=e==="disappeared"?1:0,r=!1;return new Promise(i=>{this.blockSwapAnimation.switcher.transitionTo({progress:t},e,()=>{r||i(!0)},()=>{r=!0,i(!1)})})}isDifferentItem(e){return this.lastHeldItemRenderKey!==q0(this.worldRenderer,e)}updateCameraGroup(){if(this.stopUpdate)return;let{camera:e}=this,t=performance.now(),r=this.worldRenderer.cameraShake.getBaseRotation(),i=r.pitch,s=r.yaw;if(this.lastBobUpdateTime===0)this.xBob=i,this.yBob=s;else{let f=Math.min((t-this.lastBobUpdateTime)/1e3,.1),m=1-Math.pow(.5,f*28),g=1-Math.pow(.5,f*36);this.xBob+=(i-this.xBob)*m,this.yBob+=x2(s-this.yBob)*g}this.lastBobUpdateTime=t;let o=(i-this.xBob)*-.05,l=x2(s-this.yBob)*-.035;if(this.cameraGroup.position.copy(e.position),this.cameraGroup.rotation.copy(e.rotation),this.worldRenderer.displayOptions.inWorldRenderingConfig.viewBobbing){let f=this.worldRenderer.playerStateReactive;f.walkDist!==this.lastBobWalkDist&&(this.lastBobTickTime=t,this.lastBobWalkDist=f.walkDist);let m=Math.min((t-this.lastBobTickTime)/50,1),g=1.8,b=Ur({walkDist:f.walkDist*g,prevWalkDist:f.prevWalkDist*g,bob:f.bob,prevBob:f.prevBob,partialTick:m});this.cameraGroup.position.x+=b.position.x,this.cameraGroup.position.y+=b.position.y,this.cameraGroup.rotation.z+=b.rotation.z,this.cameraGroup.rotation.x+=b.rotation.x}this.cameraGroup.rotation.x+=o,this.cameraGroup.rotation.y+=l;let v=this.currentDisplayType,c=this.swingAnimator?.getSwingProgress()??0,u;v==="hand"?u=Yl(c,this.equipProgress):u=ql(c,this.equipProgress),this.armTransformGroup.matrix.copy(u),this.armTransformGroup.matrixWorldNeedsUpdate=!0}async createItemModel(e){if(this.lastUpdate=performance.now(),!e||e.type==="hand"&&!this.playerHand)return;let t;if(e.type==="item"||e.type==="block"){let r=this.worldRenderer.entities.getItemMesh({...e.fullItem,itemId:e.id},Gr(this.worldRenderer),!1,this.lastItemModelName);if(r){let{mesh:i,isBlock:s,modelName:o}=r;s?(t=i,e.type="block"):(t=i,e.type="item"),this.lastItemModelName=o}}else t=this.playerHand;if(t){if(e.type==="item"||e.type==="block"){let r=new Pe.Group;r.name="displayTransform",e.type==="item"?(r.position.set(1.13/16,3.2/16,1.13/16),r.rotation.set(0,Pe.MathUtils.degToRad(-90),Pe.MathUtils.degToRad(25),"XYZ"),r.scale.set(.68,.68,.68)):(r.rotation.set(0,Pe.MathUtils.degToRad(45),0,"XYZ"),r.scale.set(.4,.4,.4)),r.add(t),t=r}return t.name="holdingBlock",{model:t,type:e.type}}}async replaceItemModel(e){if(this.blockSwapAnimation?.switcher.isTransitioning)return;if(!e){this.holdingBlock?.removeFromParent(),this.holdingBlock=void 0,this.currentDisplayType="hand";let r=this.swingAnimator;r?.stopSwing(),r&&(r.type="hand"),this.idleAnimator=void 0;return}let t=await this.createItemModel(e);t&&(this.holdingBlock?.removeFromParent(),this.holdingBlock=t.model,this.currentDisplayType=t.type,this.armTransformGroup.add(t.model))}testUnknownBlockSwitch(){this.setNewItem({type:"item",name:"minecraft:some-unknown-block",id:0,fullItem:{}})}async setNewItem(e){let t=q0(this.worldRenderer,e),r=this.lastHeldItemRenderKey!==t;if(this.lastHeldItem=e,!r)return;this.lastHeldItemRenderKey=t,this.lastItemModelName=void 0;let i=++this.switchRequest,s=!1;if(this.holdingBlock){if(s=!0,!await this.playBlockSwapAnimation("disappeared"))return;this.holdingBlock.removeFromParent(),this.holdingBlock!==this.playerHand&&Se(this.holdingBlock,!1),this.holdingBlock=void 0}if(!e){this.currentDisplayType="hand";let a=this.swingAnimator;a?.stopSwing(),a&&(a.type="hand"),this.idleAnimator=void 0,this.blockSwapAnimation=void 0;return}if(i!==this.switchRequest)return;let o=await this.createItemModel(e);if(!o||i!==this.switchRequest)return;this.holdingBlock=o.model,this.currentDisplayType=o.type,this.armTransformGroup.add(this.holdingBlock),s&&await this.playBlockSwapAnimation("appeared");let l=this.swingAnimator;l&&(l.type=o.type),this.idleAnimator=void 0}};var jn=class{constructor(){d(this,"animationTimer",0);d(this,"lastTime",0);d(this,"isAnimating",!1);d(this,"stopRequested",!1);d(this,"swingProgress",0);d(this,"type","hand");d(this,"debugParams",{animationTime:250,animationStage:0});d(this,"debugGui");this.debugGui=new Dt("hand_animator",this.debugParams,void 0,{animationStage:{min:0,max:1,step:.01}})}update(){if(!this.isAnimating&&!this.debugParams.animationStage){this.swingProgress=0;return}let e=performance.now(),t=(e-this.lastTime)/1e3;this.lastTime=e,this.animationTimer+=t*1e3;let r=this.debugParams.animationStage||Math.min(this.animationTimer/this.debugParams.animationTime,1);if(r>=1){if(this.stopRequested){this.isAnimating=!1,this.stopRequested=!1,this.animationTimer=0,this.swingProgress=0;return}this.animationTimer=0,this.swingProgress=0;return}this.swingProgress=r}getSwingProgress(){return this.swingProgress}startSwing(){this.stopRequested=!1,!this.isAnimating&&(this.isAnimating=!0,this.animationTimer=0,this.lastTime=performance.now())}stopSwing(){this.isAnimating&&(this.stopRequested=!0)}isCurrentlySwinging(){return this.isAnimating}},k2=(n,e,t,r,i)=>{let s=r.transformModel(e,{name:t,properties:{}});return On(n,[[s]],void 0,"plains",i)};E();x();R();k();import*as he from"three";import{subscribeKey as y3}from"valtio/utils";E();x();R();k();import*as Ve from"three";E();x();R();k();import p1 from"prismarine-nbt";import*as j from"three";E();x();R();k();E();x();R();k();import{BoxGeometry as Ze,DoubleSide as Xn,FrontSide as S2,Group as bt,Mesh as qe,MeshStandardMaterial as G5,Vector2 as Vr}from"three";function Zn(n,e,t,r,i,s,o,l){let a=(B,L,V,z)=>[new Vr(B/o,1-z/l),new Vr(V/o,1-z/l),new Vr(V/o,1-L/l),new Vr(B/o,1-L/l)],v=a(e+s,t,e+r+s,t+s),c=a(e+r+s,t,e+r*2+s,t+s),u=a(e,t+s,e+s,t+s+i),f=a(e+s,t+s,e+r+s,t+s+i),m=a(e+r+s,t+s,e+r+s*2,t+i+s),g=a(e+r+s*2,t+s,e+r*2+s*2,t+i+s),b=n.attributes.uv,A=[m[3],m[2],m[0],m[1]],y=[u[3],u[2],u[0],u[1]],_=[v[3],v[2],v[0],v[1]],S=[c[0],c[1],c[3],c[2]],C=[f[3],f[2],f[0],f[1]],T=[g[3],g[2],g[0],g[1]],P=[];for(let B of[A,y,_,S,C,T])for(let L of B)P.push(L.x,L.y);b.set(new Float32Array(P)),b.needsUpdate=!0}function gt(n,e,t,r,i,s){Zn(n,e,t,r,i,s,64,64)}function Qn(n,e,t,r,i,s){Zn(n,e,t,r,i,s,64,32)}var Ft=class extends bt{constructor(e,t){super(),Object.defineProperty(this,"innerLayer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"outerLayer",{enumerable:!0,configurable:!0,writable:!0,value:t}),e.name="inner",t.name="outer"}},Yn=class extends bt{constructor(){super(),Object.defineProperty(this,"head",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rightArm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"leftArm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rightLeg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"leftLeg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelListeners",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slim",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"layer1Material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"layer1MaterialBiased",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"layer2Material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"layer2MaterialBiased",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.layer1Material=new G5({side:S2}),this.layer2Material=new G5({side:Xn,transparent:!0,alphaTest:1e-5}),this.layer1MaterialBiased=this.layer1Material.clone(),this.layer1MaterialBiased.polygonOffset=!0,this.layer1MaterialBiased.polygonOffsetFactor=1,this.layer1MaterialBiased.polygonOffsetUnits=1,this.layer2MaterialBiased=this.layer2Material.clone(),this.layer2MaterialBiased.polygonOffset=!0,this.layer2MaterialBiased.polygonOffsetFactor=1,this.layer2MaterialBiased.polygonOffsetUnits=1;let e=new Ze(8,8,8);gt(e,0,0,8,8,8);let t=new qe(e,this.layer1Material),r=new Ze(9,9,9);gt(r,32,0,8,8,8);let i=new qe(r,this.layer2Material);this.head=new Ft(t,i),this.head.name="head",this.head.add(t,i),t.position.y=4,i.position.y=4,this.add(this.head);let s=new Ze(8,12,4);gt(s,16,16,8,12,4);let o=new qe(s,this.layer1Material),l=new Ze(8.5,12.5,4.5);gt(l,16,32,8,12,4);let a=new qe(l,this.layer2Material);this.body=new Ft(o,a),this.body.name="body",this.body.add(o,a),this.body.position.y=-6,this.add(this.body);let v=new Ze,c=new qe(v,this.layer1MaterialBiased);this.modelListeners.push(()=>{c.scale.x=this.slim?3:4,c.scale.y=12,c.scale.z=4,gt(v,40,16,this.slim?3:4,12,4)});let u=new Ze,f=new qe(u,this.layer2MaterialBiased);this.modelListeners.push(()=>{f.scale.x=this.slim?3.5:4.5,f.scale.y=12.5,f.scale.z=4.5,gt(u,40,32,this.slim?3:4,12,4)});let m=new bt;m.add(c,f),this.modelListeners.push(()=>{m.position.x=this.slim?-.5:-1}),m.position.y=-4,this.rightArm=new Ft(c,f),this.rightArm.name="rightArm",this.rightArm.add(m),this.rightArm.position.x=-5,this.rightArm.position.y=-2,this.add(this.rightArm);let g=new Ze,b=new qe(g,this.layer1MaterialBiased);this.modelListeners.push(()=>{b.scale.x=this.slim?3:4,b.scale.y=12,b.scale.z=4,gt(g,32,48,this.slim?3:4,12,4)});let A=new Ze,y=new qe(A,this.layer2MaterialBiased);this.modelListeners.push(()=>{y.scale.x=this.slim?3.5:4.5,y.scale.y=12.5,y.scale.z=4.5,gt(A,48,48,this.slim?3:4,12,4)});let _=new bt;_.add(b,y),this.modelListeners.push(()=>{_.position.x=this.slim?.5:1}),_.position.y=-4,this.leftArm=new Ft(b,y),this.leftArm.name="leftArm",this.leftArm.add(_),this.leftArm.position.x=5,this.leftArm.position.y=-2,this.add(this.leftArm);let S=new Ze(4,12,4);gt(S,0,16,4,12,4);let C=new qe(S,this.layer1MaterialBiased),T=new Ze(4.5,12.5,4.5);gt(T,0,32,4,12,4);let P=new qe(T,this.layer2MaterialBiased),B=new bt;B.add(C,P),B.position.y=-6,this.rightLeg=new Ft(C,P),this.rightLeg.name="rightLeg",this.rightLeg.add(B),this.rightLeg.position.x=-1.9,this.rightLeg.position.y=-12,this.rightLeg.position.z=-.1,this.add(this.rightLeg);let L=new Ze(4,12,4);gt(L,16,48,4,12,4);let V=new qe(L,this.layer1MaterialBiased),z=new Ze(4.5,12.5,4.5);gt(z,0,48,4,12,4);let W=new qe(z,this.layer2MaterialBiased),Q=new bt;Q.add(V,W),Q.position.y=-6,this.leftLeg=new Ft(V,W),this.leftLeg.name="leftLeg",this.leftLeg.add(Q),this.leftLeg.position.x=1.9,this.leftLeg.position.y=-12,this.leftLeg.position.z=-.1,this.add(this.leftLeg),this.modelType="default"}get map(){return this._map}set map(e){this._map=e,this.layer1Material.map=e,this.layer1Material.needsUpdate=!0,this.layer1MaterialBiased.map=e,this.layer1MaterialBiased.needsUpdate=!0,this.layer2Material.map=e,this.layer2Material.needsUpdate=!0,this.layer2MaterialBiased.map=e,this.layer2MaterialBiased.needsUpdate=!0}get modelType(){return this.slim?"slim":"default"}set modelType(e){this.slim=e==="slim",this.modelListeners.forEach(t=>t())}getBodyParts(){return this.children.filter(e=>e instanceof Ft)}setInnerLayerVisible(e){this.getBodyParts().forEach(t=>t.innerLayer.visible=e)}setOuterLayerVisible(e){this.getBodyParts().forEach(t=>t.outerLayer.visible=e)}resetJoints(){this.head.rotation.set(0,0,0),this.leftArm.rotation.set(0,0,0),this.rightArm.rotation.set(0,0,0),this.leftLeg.rotation.set(0,0,0),this.rightLeg.rotation.set(0,0,0),this.body.rotation.set(0,0,0),this.head.position.y=0,this.body.position.y=-6,this.body.position.z=0,this.rightArm.position.x=-5,this.rightArm.position.y=-2,this.rightArm.position.z=0,this.leftArm.position.x=5,this.leftArm.position.y=-2,this.leftArm.position.z=0,this.rightLeg.position.x=-1.9,this.rightLeg.position.y=-12,this.rightLeg.position.z=-.1,this.leftLeg.position.x=1.9,this.leftLeg.position.y=-12,this.leftLeg.position.z=-.1}},qn=class extends bt{constructor(){super(),Object.defineProperty(this,"cape",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.material=new G5({side:Xn,transparent:!0,alphaTest:1e-5});let e=new Ze(10,16,1);Qn(e,0,0,10,16,1),this.cape=new qe(e,this.material),this.cape.position.y=-8,this.cape.position.z=.5,this.add(this.cape)}get map(){return this.material.map}set map(e){this.material.map=e,this.material.needsUpdate=!0}},Kn=class extends bt{constructor(){super(),Object.defineProperty(this,"leftWing",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rightWing",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.material=new G5({side:Xn,transparent:!0,alphaTest:1e-5});let e=new Ze(12,22,4);Qn(e,22,0,10,20,2);let t=new qe(e,this.material);t.position.x=-5,t.position.y=-10,t.position.z=-1,this.leftWing=new bt,this.leftWing.add(t),this.add(this.leftWing);let r=new Ze(12,22,4);Qn(r,22,0,10,20,2);let i=new qe(r,this.material);i.scale.x=-1,i.position.x=5,i.position.y=-10,i.position.z=-1,this.rightWing=new bt,this.rightWing.add(i),this.add(this.rightWing),this.leftWing.position.x=5,this.leftWing.rotation.x=.2617994,this.resetJoints()}resetJoints(){this.leftWing.rotation.y=.01,this.leftWing.rotation.z=.2617994,this.updateRightWing()}updateRightWing(){this.rightWing.position.x=-this.leftWing.position.x,this.rightWing.position.y=this.leftWing.position.y,this.rightWing.rotation.x=this.leftWing.rotation.x,this.rightWing.rotation.y=-this.leftWing.rotation.y,this.rightWing.rotation.z=-this.leftWing.rotation.z}get map(){return this.material.map}set map(e){this.material.map=e,this.material.needsUpdate=!0}},Jn=class extends bt{constructor(){super(),Object.defineProperty(this,"rightEar",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"leftEar",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"material",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.material=new G5({side:S2});let e=new Ze(8,8,4/3);Zn(e,0,0,6,6,1,14,7),this.rightEar=new qe(e,this.material),this.rightEar.name="rightEar",this.rightEar.position.x=-6,this.add(this.rightEar),this.leftEar=new qe(e,this.material),this.leftEar.name="leftEar",this.leftEar.position.x=6,this.add(this.leftEar)}get map(){return this.material.map}set map(e){this.material.map=e,this.material.needsUpdate=!0}},R2=10.8*Math.PI/180,K0=class extends bt{constructor(){super(),Object.defineProperty(this,"skin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cape",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"elytra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ears",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.skin=new Yn,this.skin.name="skin",this.skin.position.y=8,this.add(this.skin),this.cape=new qn,this.cape.name="cape",this.cape.position.y=8,this.cape.position.z=-2,this.cape.rotation.x=R2,this.cape.rotation.y=Math.PI,this.add(this.cape),this.elytra=new Kn,this.elytra.name="elytra",this.elytra.position.y=8,this.elytra.position.z=-2,this.elytra.visible=!1,this.add(this.elytra),this.ears=new Jn,this.ears.name="ears",this.ears.position.y=10,this.ears.position.z=2/3,this.ears.visible=!1,this.skin.head.add(this.ears)}get backEquipment(){return this.cape.visible?"cape":this.elytra.visible?"elytra":null}set backEquipment(e){this.cape.visible=e==="cape",this.elytra.visible=e==="elytra"}resetJoints(){this.skin.resetJoints(),this.cape.rotation.x=R2,this.cape.position.y=8,this.cape.position.z=-2,this.elytra.position.y=8,this.elytra.position.z=-2,this.elytra.rotation.x=0,this.elytra.resetJoints()}};E();x();R();k();import{Color as cy,PointLight as dy,EquirectangularReflectionMapping as uy,Group as fy,NearestFilter as hy,PerspectiveCamera as my,Scene as py,Texture as gy,Vector2 as by,WebGLRenderer as yy,AmbientLight as _y,CanvasTexture as wy,WebGLRenderTarget as Ay,FloatType as Ey,DepthTexture as xy,Clock as ky,Object3D as Ry,ColorManagement as Sy}from"three";import{OrbitControls as Ty}from"three/examples/jsm/controls/OrbitControls.js";import{EffectComposer as By}from"three/examples/jsm/postprocessing/EffectComposer.js";import"three/examples/jsm/postprocessing/Pass.js";import{RenderPass as Hy}from"three/examples/jsm/postprocessing/RenderPass.js";import{ShaderPass as Dy}from"three/examples/jsm/postprocessing/ShaderPass.js";import{FXAAShader as zy}from"three/examples/jsm/shaders/FXAAShader.js";E();x();R();k();var Wr=class{constructor(){Object.defineProperty(this,"speed",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"paused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"progress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"currentId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progress0",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"animationObjects",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}update(e,t){if(this.paused)return;let r=t*this.speed;this.animate(e,r),this.animationObjects.forEach((i,s)=>{let o=this.progress0.get(s);i(e,this.progress-o,s)}),this.progress+=r}addAnimation(e){let t=this.currentId++;return this.progress0.set(t,this.progress),this.animationObjects.set(t,e),t}removeAnimation(e){e!=null&&(this.animationObjects.delete(e),this.progress0.delete(e))}};E();x();R();k();import{CanvasTexture as Kb,NearestFilter as Jb,Sprite as Xb,SpriteMaterial as Zb}from"three";E();x();R();k();var Kl=Object.defineProperty,Jl=(n,e,t)=>e in n?Kl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ae=(n,e,t)=>(Jl(n,typeof e!="symbol"?e+"":e,t),t);function $n(n){let e=[n];if(n.extra&&n.extra.length!==0)for(let t of n.extra)e.push(...$n(t));return e}var $=class{constructor(n,e,t,r,i,s){this.key=n,this.value=e,this.name=t,this.code=r,this.cssForeground=i,this.cssBackground=s}applyToStyle(n){n[this.key]=this.value}matchStyle(n){return n[this.key]===this.value}static fromCode(n){let t="0123456789abcdefklmnor".indexOf(n);if(t)return this.list[t]}toString(){return`${$.CONTROL_STRING}${this.code}`}},Ee=$;Ae(Ee,"CONTROL_STRING","\xA7");Ae(Ee,"BLACK",new $("color","black","BLACK","0",{color:"#000000"},{color:"#000000"}));Ae(Ee,"DARK_BLUE",new $("color","dark_blue","DARK_BLUE","1",{color:"#0000AA"},{color:"#00002A"}));Ae(Ee,"DARK_GREEN",new $("color","dark_green","DARK_GREEN","2",{color:"#00AA00"},{color:"#002A00"}));Ae(Ee,"DARK_AQUA",new $("color","dark_aqua","DARK_AQUA","3",{color:"#00AAAA"},{color:"#002A2A"}));Ae(Ee,"DARK_RED",new $("color","dark_red","DARK_RED","4",{color:"#AA0000"},{color:"#2A0000"}));Ae(Ee,"DARK_PURPLE",new $("color","dark_purple","DARK_PURPLE","5",{color:"#AA00AA"},{color:"#2A002A"}));Ae(Ee,"GOLD",new $("color","gold","GOLD","6",{color:"#FFAA00"},{color:"#2A2A00"}));Ae(Ee,"GRAY",new $("color","gray","GRAY","7",{color:"#AAAAAA"},{color:"#2A2A2A"}));Ae(Ee,"DARK_GRAY",new $("color","dark_gray","DARK_GRAY","8",{color:"#555555"},{color:"#151515"}));Ae(Ee,"BLUE",new $("color","blue","BLUE","9",{color:"#5555FF"},{color:"#15153F"}));Ae(Ee,"GREEN",new $("color","green","GREEN","a",{color:"#55FF55"},{color:"#153F15"}));Ae(Ee,"AQUA",new $("color","aqua","AQUA","b",{color:"#55FFFF"},{color:"#153F3F"}));Ae(Ee,"RED",new $("color","red","RED","c",{color:"#FF5555"},{color:"#3F1515"}));Ae(Ee,"LIGHT_PURPLE",new $("color","light_purple","LIGHT_PURPLE","d",{color:"#FF55FF"},{color:"#3F153F"}));Ae(Ee,"YELLOW",new $("color","yellow","YELLOW","e",{color:"#FFFF55"},{color:"#3F3F15"}));Ae(Ee,"WHITE",new $("color","white","WHITE","f",{color:"#FFFFFF"},{color:"#3F3F3F"}));Ae(Ee,"OBFUSCATED",new $("obfuscated",!0,"OBFUSCATED","k",{}));Ae(Ee,"BOLD",new $("bold",!0,"BOLD","l",{"font-weight":"bold"}));Ae(Ee,"STRIKETHROUGH",new $("strikethrough",!0,"STRIKETHROUGH","m",{"text-decoration":"line-through"}));Ae(Ee,"UNDERLINE",new $("underlined",!0,"UNDERLINE","n",{"text-decoration":"underline"}));Ae(Ee,"ITALIC",new $("italic",!0,"ITALIC","o",{"font-style":"italic"}));Ae(Ee,"RESET",{name:"RESET",code:"r",applyToStyle(n){n.bold=!1,n.strikethrough=!1,n.underlined=!1,n.italic=!1,n.obfuscated=!1,n.color=void 0},matchStyle(n){return!1},cssBackground:{},cssForeground:{},toString(){return`${$.CONTROL_STRING}r`}});Ae(Ee,"list",[$.BLACK,$.DARK_BLUE,$.DARK_GREEN,$.DARK_AQUA,$.DARK_RED,$.DARK_PURPLE,$.GOLD,$.GRAY,$.DARK_GRAY,$.BLUE,$.GREEN,$.AQUA,$.RED,$.LIGHT_PURPLE,$.YELLOW,$.WHITE,$.OBFUSCATED,$.BOLD,$.STRIKETHROUGH,$.UNDERLINE,$.ITALIC,$.RESET]);var K5=b5(e1(),1);n1();var h3=b5(Z2(),1);import m3 from"prismarine-chat";E();x();R();k();var H8=(n,e)=>{try{return JSON.parse(n)}catch{return null}},O8={black:"#000000",dark_blue:"#0000AA",dark_green:"#00AA00",dark_aqua:"#00AAAA",dark_red:"#AA0000",dark_purple:"#AA00AA",gold:"#FFAA00",gray:"#AAAAAA",dark_gray:"#555555",blue:"#5555FF",green:"#55FF55",aqua:"#55FFFF",red:"#FF5555",light_purple:"#FF55FF",yellow:"#FFFF55",white:"#FFFFFF"},$2=(n,e,t,r=s=>{},i=(s,o)=>Je(s,o))=>{let l=[16,9],a=l[0]-l[1],v=a/16,c="front_text"in n?n.front_text.messages:[n.Text1,n.Text2,n.Text3,n.Text4];if(!c.some(g=>g!=="null"))return;let u=i(16*40,a*40),f=u.getContext("2d");r(f);let m=("front_text"in n?n.front_text.color:n.Color)||"black";for(let[g,b]of c.slice(0,4).entries())b!=="null"&&s1(b,t,u,64,m,64*(g+1)+(e?0:-8));return u},s1=(n,e,t,r,i,s=0)=>{let o=!1,l=typeof n=="string"&&(n?.startsWith("{")||n?.startsWith('"'))?H8(n??'""',"sign text"):n;if(!l||typeof l!="object"&&typeof l!="string")return;let a=t.getContext("2d");if(!a)throw new Error("Could not get 2d context");a.imageSmoothingEnabled=!1,a.font=`${r}px mojangles`;let v=new e(l),c=[],u=!1,f="",m=s,g=[],b=(S,C)=>{S.text!==null&&S.text!==void 0&&S.text;let T=S.text===null||S.text===void 0?void 0:String(S.text),P={color:S.color??C?.color,underlined:S.underlined??C?.underlined,strikethrough:S.strikethrough??C?.strikethrough,bold:S.bold??C?.bold,italic:S.italic??C?.italic};if(u=u||P.underlined||P.strikethrough||!1,T?.includes(`
|
|
763
763
|
`))for(let B of T.split(`
|
|
764
|
-
`))A(B,P),m+=r,f="";else T&&A(T,P);if(S.extra)for(let B of S.extra)b(B,P)},A=(S,C)=>{o||(o=S.trim()!==""),f+=S,g[m]=a.measureText(f).width;let T=C.color??i;T.startsWith("#")||(T=O8[T.toLowerCase()]||T),c.push({fontStyle:`${C.bold?"bold":""} ${C.italic?"italic":""}`,fillStyle:T,underlineStyle:C.underlined??!1,strikeStyle:C.strikethrough??!1,offset:m,text:S})};if(b(v),!u&&!v.toString().trim())return;let y=0,_=0;for(let{fillStyle:S,fontStyle:C,underlineStyle:T,strikeStyle:P,offset:B,text:L}of c){_!==B&&(y=0),_=B,a.fillStyle=S,a.textRendering="optimizeLegibility",a.font=`${C} ${r}px mojangles`;let V=g[B]??a.measureText(L).width,z=(t.width-V)/2+y;a.fillText(L,z,B),P&&(a.lineWidth=r/8,a.strokeStyle=S,a.beginPath(),a.moveTo(z,B-a.lineWidth*2.5),a.lineTo(z+a.measureText(L).width,B-a.lineWidth*2.5),a.stroke()),T&&(a.lineWidth=r/8,a.strokeStyle=S,a.beginPath(),a.moveTo(z,B+a.lineWidth),a.lineTo(z+a.measureText(L).width,B+a.lineWidth),a.stroke()),y+=a.measureText(L).width}return o};E();x();R();k();import*as o1 from"three";E();x();R();k();var D8=n=>Math.max(0,Math.min(1,n)),F8=(n,e,t)=>n+(e-n)*t;function z8(n){let e=n?.elytra;if(!e)return;if(typeof e.updateRightWing=="function"){e.updateRightWing();return}if(typeof e.updateRightWingRotation=="function"){e.updateRightWingRotation();return}let t=e.leftWing,r=e.rightWing;!t?.rotation||!r?.rotation||typeof r.rotation.copy=="function"&&(r.rotation.copy(t.rotation),r.rotation.z*=-1)}var Q5=class extends Wr{constructor(){super(...arguments);d(this,"switchAnimationCallback");d(this,"isRunning",!1);d(this,"isMoving",!0);d(this,"isCrouched",!1);d(this,"_dt",0);d(this,"_phase",0);d(this,"_moveBlend",0);d(this,"_swingTime",null);d(this,"_swingDuration",.25);d(this,"_defaults",null)}update(t,r){this._dt=r,super.update(t,r)}swingArm(){(this._swingTime===null||this._swingTime>=this._swingDuration/2)&&(this._swingTime=0)}_captureDefaults(t){this._defaults={bodyPos:t.skin.body.position.clone(),bodyRot:t.skin.body.rotation.clone(),leftArmPos:t.skin.leftArm.position.clone(),leftArmRot:t.skin.leftArm.rotation.clone(),rightArmPos:t.skin.rightArm.position.clone(),rightArmRot:t.skin.rightArm.rotation.clone(),leftLegPos:t.skin.leftLeg.position.clone(),leftLegRot:t.skin.leftLeg.rotation.clone(),rightLegPos:t.skin.rightLeg.position.clone(),rightLegRot:t.skin.rightLeg.rotation.clone(),headPos:t.skin.head.position.clone(),headRot:t.skin.head.rotation.clone(),capePos:t.cape.position.clone(),capeRot:t.cape.rotation.clone(),elytraPos:t.elytra.position.clone(),elytraRot:t.elytra.rotation.clone()}}_applyDefaults(t){let r=this._defaults;r&&(t.skin.body.position.copy(r.bodyPos),t.skin.body.rotation.copy(r.bodyRot),t.skin.leftArm.position.copy(r.leftArmPos),t.skin.leftArm.rotation.copy(r.leftArmRot),t.skin.rightArm.position.copy(r.rightArmPos),t.skin.rightArm.rotation.copy(r.rightArmRot),t.skin.leftLeg.position.copy(r.leftLegPos),t.skin.leftLeg.rotation.copy(r.leftLegRot),t.skin.rightLeg.position.copy(r.rightLegPos),t.skin.rightLeg.rotation.copy(r.rightLegRot),t.skin.head.position.copy(r.headPos),t.skin.head.rotation.copy(r.headRot),t.cape.position.copy(r.capePos),t.cape.rotation.copy(r.capeRot),t.elytra.position.copy(r.elytraPos),t.elytra.rotation.copy(r.elytraRot))}animate(t){let r=this._dt||0;this._defaults||this._captureDefaults(t),this._applyDefaults(t);let i=this.isMoving?1:0,s=Math.min(1,r*20);this._moveBlend+=(i-this._moveBlend)*s;let o=this.isRunning?10:8;this._phase+=r*o*this._moveBlend;let l=this._phase+(this.isRunning?Math.PI*.5:0),a=!1;G8(t,this.isCrouched?1:0);let v=this.isRunning?Math.cos(l):Math.sin(l);if(Math.abs(v)<.02&&this.switchAnimationCallback&&(a=!0),this.isRunning?(t.skin.leftLeg.rotation.x
|
|
764
|
+
`))A(B,P),m+=r,f="";else T&&A(T,P);if(S.extra)for(let B of S.extra)b(B,P)},A=(S,C)=>{o||(o=S.trim()!==""),f+=S,g[m]=a.measureText(f).width;let T=C.color??i;T.startsWith("#")||(T=O8[T.toLowerCase()]||T),c.push({fontStyle:`${C.bold?"bold":""} ${C.italic?"italic":""}`,fillStyle:T,underlineStyle:C.underlined??!1,strikeStyle:C.strikethrough??!1,offset:m,text:S})};if(b(v),!u&&!v.toString().trim())return;let y=0,_=0;for(let{fillStyle:S,fontStyle:C,underlineStyle:T,strikeStyle:P,offset:B,text:L}of c){_!==B&&(y=0),_=B,a.fillStyle=S,a.textRendering="optimizeLegibility",a.font=`${C} ${r}px mojangles`;let V=g[B]??a.measureText(L).width,z=(t.width-V)/2+y;a.fillText(L,z,B),P&&(a.lineWidth=r/8,a.strokeStyle=S,a.beginPath(),a.moveTo(z,B-a.lineWidth*2.5),a.lineTo(z+a.measureText(L).width,B-a.lineWidth*2.5),a.stroke()),T&&(a.lineWidth=r/8,a.strokeStyle=S,a.beginPath(),a.moveTo(z,B+a.lineWidth),a.lineTo(z+a.measureText(L).width,B+a.lineWidth),a.stroke()),y+=a.measureText(L).width}return o};E();x();R();k();import*as o1 from"three";E();x();R();k();var D8=n=>Math.max(0,Math.min(1,n)),F8=(n,e,t)=>n+(e-n)*t;function z8(n){let e=n?.elytra;if(!e)return;if(typeof e.updateRightWing=="function"){e.updateRightWing();return}if(typeof e.updateRightWingRotation=="function"){e.updateRightWingRotation();return}let t=e.leftWing,r=e.rightWing;!t?.rotation||!r?.rotation||typeof r.rotation.copy=="function"&&(r.rotation.copy(t.rotation),r.rotation.z*=-1)}var Q5=class extends Wr{constructor(){super(...arguments);d(this,"switchAnimationCallback");d(this,"isRunning",!1);d(this,"isMoving",!0);d(this,"isCrouched",!1);d(this,"_dt",0);d(this,"_phase",0);d(this,"_moveBlend",0);d(this,"_swingTime",null);d(this,"_swingDuration",.25);d(this,"_defaults",null)}update(t,r){this._dt=r,super.update(t,r)}swingArm(){(this._swingTime===null||this._swingTime>=this._swingDuration/2)&&(this._swingTime=0)}_captureDefaults(t){this._defaults={bodyPos:t.skin.body.position.clone(),bodyRot:t.skin.body.rotation.clone(),leftArmPos:t.skin.leftArm.position.clone(),leftArmRot:t.skin.leftArm.rotation.clone(),rightArmPos:t.skin.rightArm.position.clone(),rightArmRot:t.skin.rightArm.rotation.clone(),leftLegPos:t.skin.leftLeg.position.clone(),leftLegRot:t.skin.leftLeg.rotation.clone(),rightLegPos:t.skin.rightLeg.position.clone(),rightLegRot:t.skin.rightLeg.rotation.clone(),headPos:t.skin.head.position.clone(),headRot:t.skin.head.rotation.clone(),capePos:t.cape.position.clone(),capeRot:t.cape.rotation.clone(),elytraPos:t.elytra.position.clone(),elytraRot:t.elytra.rotation.clone()}}_applyDefaults(t){let r=this._defaults;r&&(t.skin.body.position.copy(r.bodyPos),t.skin.body.rotation.copy(r.bodyRot),t.skin.leftArm.position.copy(r.leftArmPos),t.skin.leftArm.rotation.copy(r.leftArmRot),t.skin.rightArm.position.copy(r.rightArmPos),t.skin.rightArm.rotation.copy(r.rightArmRot),t.skin.leftLeg.position.copy(r.leftLegPos),t.skin.leftLeg.rotation.copy(r.leftLegRot),t.skin.rightLeg.position.copy(r.rightLegPos),t.skin.rightLeg.rotation.copy(r.rightLegRot),t.skin.head.position.copy(r.headPos),t.skin.head.rotation.copy(r.headRot),t.cape.position.copy(r.capePos),t.cape.rotation.copy(r.capeRot),t.elytra.position.copy(r.elytraPos),t.elytra.rotation.copy(r.elytraRot))}animate(t){let r=this._dt||0;this._defaults||this._captureDefaults(t),this._applyDefaults(t);let i=this.isMoving?1:0,s=Math.min(1,r*20);this._moveBlend+=(i-this._moveBlend)*s;let o=this.isRunning?10:8;this._phase+=r*o*this._moveBlend;let l=this._phase+(this.isRunning?Math.PI*.5:0),a=!1;G8(t,this.isCrouched?1:0);let v=this.isRunning?Math.cos(l):Math.sin(l);if(Math.abs(v)<.02&&this.switchAnimationCallback&&(a=!0),this.isRunning?(t.skin.leftLeg.rotation.x+=Math.cos(l+Math.PI)*1.3*this._moveBlend,t.skin.rightLeg.rotation.x+=Math.cos(l)*1.3*this._moveBlend):(t.skin.leftLeg.rotation.x+=Math.sin(l)*.5*this._moveBlend,t.skin.rightLeg.rotation.x+=Math.sin(l+Math.PI)*.5*this._moveBlend),this.isRunning){t.skin.leftArm.rotation.x+=Math.cos(l)*1.5*this._moveBlend,t.skin.rightArm.rotation.x+=Math.cos(l+Math.PI)*1.5*this._moveBlend;let c=Math.PI*.1;t.skin.leftArm.rotation.z+=(Math.cos(l)*.1+c)*this._moveBlend,t.skin.rightArm.rotation.z+=(Math.cos(l+Math.PI)*.1-c)*this._moveBlend}else{t.skin.leftArm.rotation.x+=Math.sin(l+Math.PI)*.5*this._moveBlend,t.skin.rightArm.rotation.x+=Math.sin(l)*.5*this._moveBlend;let c=Math.PI*.02;t.skin.leftArm.rotation.z+=(Math.cos(l)*.03+c)*this._moveBlend,t.skin.rightArm.rotation.z+=(Math.cos(l+Math.PI)*.03-c)*this._moveBlend}if(this._swingTime!==null){this._swingTime+=r;let c=Math.min(this._swingTime/this._swingDuration,1);U8.animate(c,t,this.isMoving),c>=1&&(this._swingTime=null)}if(this.isRunning&&(t.rotation.z=Math.cos(l+Math.PI)*.01*this._moveBlend),this.isRunning){let c=Math.PI*.3;t.cape.rotation.x+=(Math.sin(l*2)*.1+c)*this._moveBlend}else{let c=Math.PI*.06;t.cape.rotation.x+=(Math.sin(l/1.5)*.06+c)*this._moveBlend}if(a){let c=this.switchAnimationCallback;this.switchAnimationCallback=null,c?.()}}},U8={animate(n,e,t){if(!e?.skin?.rightArm?.rotation)return;let r=Math.sin(n*Math.PI);if(e.skin.rightArm.rotation.x=-.4537860552*2-2*r*.3,!t){let i=.01*Math.PI+.06;e.skin.rightArm.rotation.z=-r*.403+i,e.skin.body.rotation.y=-r*.06,e.skin.leftArm.rotation.x=-r*.077,e.skin.leftArm.rotation.z=-r*.015+.13-.05,e.skin.leftArm.position.z=r*.3,e.skin.leftArm.position.x=5-r*.05}}};function G8(n,e){let t=n?.skin,r=n?.cape,i=n?.elytra;if(!t||!r)return;let s=D8(e),o=Math.abs(Math.sin(s*Math.PI/2));if(o<=1e-6)return;t.body.rotation.x+=.4537860552*o,t.body.position.z+=(1.3256181-3.4500310377)*o,t.body.position.y+=-2.103677462*o,r.position.y+=-1.851236166577372*o,r.rotation.x+=.294220265771*o,r.position.z+=(3.786619432-3.4500310377)*o,i?.position&&i.position.copy(r.position),i?.rotation&&i.rotation.copy(r.rotation),i?.rotation&&(i.rotation.x-=10.8*Math.PI/180),i?.leftWing?.rotation&&(i.leftWing.rotation.z=F8(.72,.26179944+.4582006,o)),z8(n),t.head.position.y+=-3.618325234674*o;let l=.1*o,a=(3.618325234674-3.4500310377)*o,v=-2.53943318*o;t.leftArm.position.z+=a,t.rightArm.position.z+=a,t.leftArm.rotation.x+=.410367746202*o,t.rightArm.rotation.x+=.410367746202*o,t.leftArm.rotation.z+=l,t.rightArm.rotation.z+=-l,t.leftArm.position.y+=v,t.rightArm.position.y+=v,t.rightLeg.position.z+=-3.4500310377*o,t.leftLeg.position.z+=-3.4500310377*o}var V8=-2e-4;function W8(n){n.uniforms.uLogDepthBias={value:V8},n.fragmentShader=n.fragmentShader.replace("#include <logdepthbuf_pars_fragment>",`#include <logdepthbuf_pars_fragment>
|
|
765
765
|
uniform float uLogDepthBias;`),n.fragmentShader=n.fragmentShader.replace("#include <logdepthbuf_fragment>",`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
766
766
|
gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5 + uLogDepthBias;
|
|
767
767
|
#endif`)}function ea(n){n.userData.logDepthBiasApplied||(n.userData.logDepthBiasApplied=!0,n.onBeforeCompile=W8,n.needsUpdate=!0)}function a1(n){let e=n.skin,t=[e.layer1Material,e.layer1MaterialBiased,e.layer2Material,e.layer2MaterialBiased];for(let r of t)r.transparent=!1,r.alphaTest=.1,r.depthWrite=!0;ea(e.layer1MaterialBiased),ea(e.layer2MaterialBiased)}E();x();R();k();import*as se from"three";function N8(n,e){if(typeof document<"u"){let t=document.createElement("canvas");return t.width=n,t.height=e,t}return new OffscreenCanvas(n,e)}function j8(n,e){let{depth:t,pixelSize:r}=e;if(n.width<=0||n.height<=0)throw new Error(`Invalid canvas dimensions: ${n.width}x${n.height}`);let s=n.getContext("2d").getImageData(0,0,n.width,n.height),{data:o}=s,l=n.width,a=n.height,v=t/2,c=r??1/Math.max(l,a),u=(B,L)=>{if(B<0||L<0||B>=l||L>=a)return!1;let V=(L*l+B)*4;return o[V+3]>128},f=[],m=[],g=[],b=[],A=0,y=(B,L,V,z,W,Q,K,X)=>(f.push(B,L,V),g.push(z,W),b.push(Q,K,X),A++),_=(B,L,V,z)=>{m.push(B,L,V,B,V,z)},S=(B,L)=>{let V=(B/l-.5)*c*l,z=-(L/a-.5)*c*a;return{x:V,y:z}},C=Array.from({length:a+1},()=>Array.from({length:l+1},()=>null)),T=Array.from({length:a+1},()=>Array.from({length:l+1},()=>null));for(let B=0;B<=a;B++)for(let L=0;L<=l;L++){let{x:V,y:z}=S(L-.5,B-.5),W=L/l,Q=B/a,K=!1,X=[[L-1,B-1],[L,B-1],[L-1,B],[L,B]];for(let[ae,oe]of X)if(u(ae,oe)){K=!0;break}K&&(C[B][L]=y(V,z,v,W,Q,0,0,1),T[B][L]=y(V,z,-v,W,Q,0,0,-1))}for(let B=0;B<a;B++)for(let L=0;L<l;L++){if(!u(L,B))continue;let V=C[B][L],z=C[B][L+1],W=C[B+1][L+1],Q=C[B+1][L],K=T[B][L],X=T[B][L+1],ae=T[B+1][L+1],oe=T[B+1][L];V!==null&&z!==null&&W!==null&&Q!==null&&_(V,z,W,Q),K!==null&&X!==null&&ae!==null&&oe!==null&&_(X,K,oe,ae)}for(let B=0;B<a;B++)for(let L=0;L<l;L++){if(!u(L,B))continue;let V=(L+.5)/l,z=(B+.5)/a;if(!u(L-1,B)){let W=C[B][L],Q=C[B+1][L],K=T[B][L],X=T[B+1][L];if(W!==null&&Q!==null&&K!==null&&X!==null){let ae=y(f[W*3],f[W*3+1],f[W*3+2],V,z,-1,0,0),oe=y(f[Q*3],f[Q*3+1],f[Q*3+2],V,z,-1,0,0),ue=y(f[X*3],f[X*3+1],f[X*3+2],V,z,-1,0,0),fe=y(f[K*3],f[K*3+1],f[K*3+2],V,z,-1,0,0);_(ae,oe,ue,fe)}}if(!u(L+1,B)){let W=C[B+1][L+1],Q=C[B][L+1],K=T[B+1][L+1],X=T[B][L+1];if(W!==null&&Q!==null&&K!==null&&X!==null){let ae=y(f[W*3],f[W*3+1],f[W*3+2],V,z,1,0,0),oe=y(f[Q*3],f[Q*3+1],f[Q*3+2],V,z,1,0,0),ue=y(f[X*3],f[X*3+1],f[X*3+2],V,z,1,0,0),fe=y(f[K*3],f[K*3+1],f[K*3+2],V,z,1,0,0);_(ae,oe,ue,fe)}}if(!u(L,B-1)){let W=C[B][L],Q=C[B][L+1],K=T[B][L],X=T[B][L+1];if(W!==null&&Q!==null&&K!==null&&X!==null){let ae=y(f[W*3],f[W*3+1],f[W*3+2],V,z,0,-1,0),oe=y(f[Q*3],f[Q*3+1],f[Q*3+2],V,z,0,-1,0),ue=y(f[X*3],f[X*3+1],f[X*3+2],V,z,0,-1,0),fe=y(f[K*3],f[K*3+1],f[K*3+2],V,z,0,-1,0);_(ae,oe,ue,fe)}}if(!u(L,B+1)){let W=C[B+1][L+1],Q=C[B+1][L],K=T[B+1][L+1],X=T[B+1][L];if(W!==null&&Q!==null&&K!==null&&X!==null){let ae=y(f[W*3],f[W*3+1],f[W*3+2],V,z,0,1,0),oe=y(f[Q*3],f[Q*3+1],f[Q*3+2],V,z,0,1,0),ue=y(f[X*3],f[X*3+1],f[X*3+2],V,z,0,1,0),fe=y(f[K*3],f[K*3+1],f[K*3+2],V,z,0,1,0);_(ae,oe,ue,fe)}}}let P=new se.BufferGeometry;return P.setAttribute("position",new se.Float32BufferAttribute(f,3)),P.setAttribute("uv",new se.Float32BufferAttribute(g,2)),P.setAttribute("normal",new se.Float32BufferAttribute(b,3)),P.setIndex(m),P.computeVertexNormals(),{geometry:P,totalVertices:A,totalTriangles:m.length/3}}function Q8(n,e){let{u:t,v:r,sizeX:i,sizeY:s}=e,o=Math.max(1,Math.floor(i*n.image.width)),l=Math.max(1,Math.floor(s*n.image.height)),a=N8(o,l),v=a.getContext("2d");if(!v)throw new Error("Failed to get 2d context for item texture canvas");return v.imageSmoothingEnabled=!1,v.drawImage(n.image,t*n.image.width,r*n.image.height,i*n.image.width,s*n.image.height,0,0,a.width,a.height),a}function ta(n,e,t={}){let{faceCamera:r=!1,use3D:i=!0,depth:s=.04}=t,{u:o,v:l,sizeX:a,sizeY:v}=e;if(r){let b=n.clone();b.flipY=!0,b.offset.set(o,1-l-v),b.repeat.set(a,v),b.needsUpdate=!0,b.magFilter=se.NearestFilter,b.minFilter=se.NearestFilter;let A=new se.SpriteMaterial({map:b,transparent:!0,alphaTest:.1});return{mesh:new se.Sprite(A),itemsTexture:b,cleanup(){b.dispose()}}}if(i)try{let b=Q8(n,e),{geometry:A}=j8(b,{depth:s}),y=new se.CanvasTexture(b);y.magFilter=se.NearestFilter,y.minFilter=se.NearestFilter,y.wrapS=y.wrapT=se.ClampToEdgeWrapping,y.flipY=!1,y.needsUpdate=!0;let _=new se.MeshStandardMaterial({map:y,side:se.DoubleSide,transparent:!0,alphaTest:.1});return{mesh:new se.Mesh(A,_),itemsTexture:y,cleanup(){y.dispose(),A.dispose(),_.map&&_.map.dispose(),_.dispose()}}}catch{}let c=n.clone();c.flipY=!0,c.offset.set(o,1-l-v),c.repeat.set(a,v),c.needsUpdate=!0,c.magFilter=se.NearestFilter,c.minFilter=se.NearestFilter;let u=c.clone();u.repeat.x*=-1,u.needsUpdate=!0,u.offset.set(o+a,1-l-v);let f=new se.MeshStandardMaterial({map:c,transparent:!0,alphaTest:.1}),m=new se.MeshStandardMaterial({map:u,transparent:!0,alphaTest:.1});return{mesh:new se.Mesh(new se.BoxGeometry(1,1,0),[new se.MeshBasicMaterial({color:0}),new se.MeshBasicMaterial({color:0}),new se.MeshBasicMaterial({color:0}),new se.MeshBasicMaterial({color:0}),f,m]),itemsTexture:c,itemsTextureFlipped:u,cleanup(){c.dispose(),u.dispose(),f.dispose(),m.dispose()}}}E();x();R();k();import*as te from"three";E();x();R();k();E();x();R();k();import{REVISION as Y8}from"three";var ra=parseInt(Y8.replace(/\D+/g,""));E();x();R();k();import{Loader as q8,FileLoader as K8,Group as J8,BufferGeometry as ia,Float32BufferAttribute as t5,LineBasicMaterial as l1,Material as na,PointsMaterial as Jr,MeshPhongMaterial as X8,LineSegments as sa,Points as v1,Mesh as oa,Vector3 as Y5}from"three";var Z8=/^[og]\s*(.+)?/,$8=/^mtllib /,e4=/^usemtl /,t4=/^usemap /,aa=new Y5,c1=new Y5,la=new Y5,va=new Y5,yt=new Y5;function r4(){let n={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}let r=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(i,s){let o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);let l={index:this.materials.length,name:i||"",mtllib:Array.isArray(s)&&s.length>0?s[s.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(a){let v={index:typeof a=="number"?a:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return v.clone=this.clone.bind(v),v}};return this.materials.push(l),l},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){let s=this.currentMaterial();if(s&&s.groupEnd===-1&&(s.groupEnd=this.geometry.vertices.length/3,s.groupCount=s.groupEnd-s.groupStart,s.inherited=!1),i&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),s}},r&&r.name&&typeof r.clone=="function"){let i=r.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let r=parseInt(e,10);return(r>=0?r-1:r+t/3)*3},parseNormalIndex:function(e,t){let r=parseInt(e,10);return(r>=0?r-1:r+t/3)*3},parseUVIndex:function(e,t){let r=parseInt(e,10);return(r>=0?r-1:r+t/2)*2},addVertex:function(e,t,r){let i=this.vertices,s=this.object.geometry.vertices;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){let i=this.normals,s=this.object.geometry.normals;s.push(i[e+0],i[e+1],i[e+2]),s.push(i[t+0],i[t+1],i[t+2]),s.push(i[r+0],i[r+1],i[r+2])},addFaceNormal:function(e,t,r){let i=this.vertices,s=this.object.geometry.normals;aa.fromArray(i,e),c1.fromArray(i,t),la.fromArray(i,r),yt.subVectors(la,c1),va.subVectors(aa,c1),yt.cross(va),yt.normalize(),s.push(yt.x,yt.y,yt.z),s.push(yt.x,yt.y,yt.z),s.push(yt.x,yt.y,yt.z)},addColor:function(e,t,r){let i=this.colors,s=this.object.geometry.colors;i[e]!==void 0&&s.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&s.push(i[t+0],i[t+1],i[t+2]),i[r]!==void 0&&s.push(i[r+0],i[r+1],i[r+2])},addUV:function(e,t,r){let i=this.uvs,s=this.object.geometry.uvs;s.push(i[e+0],i[e+1]),s.push(i[t+0],i[t+1]),s.push(i[r+0],i[r+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,i,s,o,l,a,v){let c=this.vertices.length,u=this.parseVertexIndex(e,c),f=this.parseVertexIndex(t,c),m=this.parseVertexIndex(r,c);if(this.addVertex(u,f,m),this.addColor(u,f,m),l!==void 0&&l!==""){let g=this.normals.length;u=this.parseNormalIndex(l,g),f=this.parseNormalIndex(a,g),m=this.parseNormalIndex(v,g),this.addNormal(u,f,m)}else this.addFaceNormal(u,f,m);if(i!==void 0&&i!==""){let g=this.uvs.length;u=this.parseUVIndex(i,g),f=this.parseUVIndex(s,g),m=this.parseUVIndex(o,g),this.addUV(u,f,m),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";let t=this.vertices.length;for(let r=0,i=e.length;r<i;r++){let s=this.parseVertexIndex(e[r],t);this.addVertexPoint(s),this.addColor(s)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";let r=this.vertices.length,i=this.uvs.length;for(let s=0,o=e.length;s<o;s++)this.addVertexLine(this.parseVertexIndex(e[s],r));for(let s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],i))}};return n.startObject("",!1),n}var r5=class extends q8{constructor(e){super(e),this.materials=null}load(e,t,r,i){let s=this,o=new K8(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(s.parse(l))}catch(a){i&&i(a),s.manager.itemError(e)}},r,i)}setMaterials(e){return this.materials=e,this}parse(e){let t=new r4;e.indexOf(`\r
|