a3js 0.0.57 → 0.0.58
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/a3js.cjs.js +1 -1
- package/dist/a3js.cjs.js.map +1 -1
- package/dist/a3js.es.js +30 -30
- package/dist/a3js.es.js.map +1 -1
- package/package.json +1 -1
package/dist/a3js.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three");c=s(c,1);let l=require("fflate");var u=class e{x=0;y=0;z=0;constructor(e,t,n){typeof e==`number`?(this.x=e,this.y=t,this.z=n):e===void 0?this.x=this.y=this.z=0:(this.x=e.x,this.y=e.y,this.z=e.z)}clone(){return new e(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z}normalize(){let e=this.x*this.x+this.y*this.y+this.z*this.z,t=Math.sqrt(e);return t===0?console.warn(`Vec3.normalize.`):(this.x/=t,this.y/=t,this.z/=t),this}negate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}set(e,t,n){return typeof e==`number`?(this.x=e,this.y=t,this.z=n):(this.x=e.x,this.y=e.y,this.z=e.z),this}add(e,t,n){return typeof e==`number`?(this.x+=e,this.y+=t,this.z+=n):(this.x+=e.x,this.y+=e.y,this.z+=e.z),this}sub(e,t,n){return typeof e==`number`?(this.x-=e,this.y-=t,this.z-=n):(this.x-=e.x,this.y-=e.y,this.z-=e.z),this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this}apply(e,t,n,r){let i,a,o,s;typeof e==`number`?(i=e,a=t,o=n,s=r):(i=e.x,a=e.y,o=e.z,s=e.w);let c=2*(a*this.z-o*this.y),l=2*(o*this.x-i*this.z),u=2*(i*this.y-a*this.x);return this.x+=s*c+a*u-o*l,this.y+=s*l+o*c-i*u,this.z+=s*u+i*l-a*c,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z}},d=class e{x=0;y=0;z=0;w=1;constructor(e,t,n,r){typeof e==`number`?(this.x=e,this.y=t,this.z=n,this.w=r):e===void 0?(this.x=this.y=this.z=0,this.w=1):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w)}clone(){return new e(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w}normalize(){let e=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w,t=Math.sqrt(e);return t===0?console.warn(`Quat.normalize.`):(this.x/=t,this.y/=t,this.z/=t,this.w/=t),this}conjugate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}set(e,t,n,r){return typeof e==`number`?(this.x=e,this.y=t,this.z=n,this.w=r):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w),this}mul(e,t,n,r){let i=this.x,a=this.y,o=this.z,s=this.w,c,l,u,d;return typeof e==`number`?(c=e,l=t,u=n,d=r):(c=e.x,l=e.y,u=e.z,d=e.w),this.x=s*c+i*d+a*u-o*l,this.y=s*l-i*u+a*d+o*c,this.z=s*u+i*l-a*c+o*d,this.w=s*d-i*c-a*l-o*u,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z,this.w=(1-n)*e.w+n*t.w}slerp(e,t,n){if(n<0||n>1){console.warn(`Quat.slerp(): t must be in [0,1]`);return}let r=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(f.set(t),r<0&&(r*=-1,f.set(-f.x,-f.y,-f.z,-f.w)),r>.9995){this.x=(1-n)*e.x+n*f.x,this.y=(1-n)*e.y+n*f.y,this.z=(1-n)*e.z+n*f.z,this.w=(1-n)*e.w+n*f.w;let t=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);t<1e-4?(console.warn(`Quat.slerp(); ???!`),this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x*=1/t,this.y*=1/t,this.z*=1/t,this.w*=1/t)}else{let t=Math.acos(r),i=Math.sin((1-n)*t)/Math.sin(t),a=Math.sin(n*t)/Math.sin(t);this.x=i*e.x+a*f.x,this.y=i*e.y+a*f.y,this.z=i*e.z+a*f.z,this.w=i*e.w+a*f.w}}},f=new d;function p(e,t,n,r){n.normalize();let i=e.clone().sub(t).normalize(),a=new u().cross(i,n).normalize(),o=new u().cross(a,i),s=a.x,c=o.x,l=-i.x,f=a.y,p=o.y,m=-i.y,h=a.z,g=o.z,_=-i.z,v,y,b,x,S=s+p+_;if(S>0){let e=Math.sqrt(S+1)*2;v=(g-m)/e,y=(l-h)/e,b=(f-c)/e,x=.25*e}else if(s>p&&s>_){let e=Math.sqrt(1+s-p-_)*2;v=.25*e,y=(c+f)/e,b=(l+h)/e,x=(g-m)/e}else if(p>_){let e=Math.sqrt(1+p-s-_)*2;v=(c+f)/e,y=.25*e,b=(m+g)/e,x=(l-h)/e}else{let e=Math.sqrt(1+_-s-p)*2;v=(l+h)/e,y=(m+g)/e,b=.25*e,x=(f-c)/e}let C=r??new d;return C.set(v,y,b,x),C}function m(e,t=`ZXY`,n){let r=n===void 0?new d(0,0,0,1):n.set(0,0,0,1);for(let n=0;n<3;n++)switch(t.charAt(n)){case`X`:r.mul(Math.sin(e.x),0,0,Math.cos(e.x));break;case`Y`:r.mul(0,Math.sin(e.y),0,Math.cos(e.y));break;case`Z`:r.mul(0,0,Math.sin(e.z),Math.cos(e.z));break}return r}function h(e){let t=[[],[],[]],n=e.x+e.x,r=e.y+e.y,i=e.z+e.z,a=e.x*n,o=e.x*r,s=e.x*i,c=e.y*r,l=e.y*i,u=e.z*i,d=e.w*n,f=e.w*r,p=e.w*i;return t[0][0]=1-(c+u),t[0][1]=o-p,t[0][2]=s+f,t[1][0]=o+p,t[1][1]=1-(a+u),t[1][2]=l-d,t[2][0]=s-f,t[2][1]=l+d,t[2][2]=1-(a+c),t}var g=e=>Math.max(-1,Math.min(1,e));function _(e,t=`ZXY`,n){let r=h(e),i=n??new u,a=0,o=0,s=0;switch(t){case`XYZ`:o=Math.asin(g(r[0][2])),Math.abs(r[0][2])<.9999999?(a=Math.atan2(-r[1][2],r[2][2]),s=Math.atan2(-r[0][1],r[0][0])):(a=Math.atan2(r[2][1],r[1][1]),s=0);break;case`YXZ`:a=Math.asin(-g(r[1][2])),Math.abs(r[1][2])<.9999999?(o=Math.atan2(r[0][2],r[2][2]),s=Math.atan2(r[1][0],r[1][1])):(o=Math.atan2(-r[2][0],r[0][0]),s=0);break;case`ZXY`:a=Math.asin(g(r[2][1])),Math.abs(r[2][1])<.9999999?(o=Math.atan2(-r[2][0],r[2][2]),s=Math.atan2(-r[0][1],r[1][1])):(o=0,s=Math.atan2(r[1][0],r[0][0]));break;case`ZYX`:o=Math.asin(-g(r[2][0])),Math.abs(r[2][0])<.9999999?(a=Math.atan2(r[2][1],r[2][2]),s=Math.atan2(r[1][0],r[0][0])):(a=0,s=Math.atan2(-r[0][1],r[1][1]));break;case`YZX`:s=Math.asin(g(r[1][0])),Math.abs(r[1][0])<.9999999?(a=Math.atan2(-r[1][2],r[1][1]),o=Math.atan2(-r[2][0],r[0][0])):(a=0,o=Math.atan2(r[0][2],r[2][2]));break;case`XZY`:s=Math.asin(-g(r[0][1])),Math.abs(r[0][1])<.9999999?(a=Math.atan2(r[2][1],r[1][1]),o=Math.atan2(r[0][2],r[0][0])):(a=Math.atan2(-r[1][2],r[2][2]),o=0);break}return i.set(a,o,s),i}var v=class e{loc;quat;scale;constructor(){this.loc=new u,this.quat=new d,this.scale=new u(1,1,1)}set(t){return t instanceof e?(this.loc.set(t.loc),this.quat.set(t.quat),this.scale.set(t.scale)):(t.getPosition(this.loc),t.getQuat(this.quat),t.getScale(this.scale)),this}write(e){e instanceof W?(e.object3D.position.set(this.loc.x,this.loc.y,this.loc.z),e.object3D.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.object3D.scale.set(this.scale.x,this.scale.y,this.scale.z)):(e.position.set(this.loc.x,this.loc.y,this.loc.z),e.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.scale.set(this.scale.x,this.scale.y,this.scale.z))}blend(e,t){return this.loc.lerp(this.loc,e.loc,t),this.quat.slerp(this.quat,e.quat,t),this.scale.lerp(this.scale,e.scale,t),this}clone(){let t=new e;return t.set(this),t}},y=class{transform;constructor(){this.transform=new v}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.transform.loc.set(e)}setPositionNow(e){this.transform.loc.set(e)}setQuat(e){this.transform.quat.set(e)}setQuatNow(e){this.transform.quat.set(e)}setScale(e){this.transform.scale.set(e)}setScaleNow(e){this.transform.scale.set(e)}setLinearVelocity(e){}getLinearVelocity(e){return e||new u}setAngularVelocity(e){}getAngularVelocity(e){return e||new u}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}},b=class{transform;constructor(){this.transform=new v}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||new u}setAngularVelocity(e){}getAngularVelocity(e){return e||new u}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}},x={duration:1},S=class{options;startTransform;transform;endTransform;currentTime;duration;constructor(e={}){this.options={...x,...e},this.startTransform=new v,this.transform=new v,this.endTransform=new v,this.currentTime=0,this.duration=this.options.duration}init(e,t){this.startTransform.set(e),this.transform.set(e),this.endTransform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.startTransform.set(this.transform),this.endTransform.loc.set(e),this.currentTime=0}setPositionNow(e){this.setPosition(e),this.currentTime=1}setQuat(e){this.startTransform.set(this.transform),this.endTransform.quat.set(e),this.currentTime=0}setQuatNow(e){this.setQuat(e),this.currentTime=1}setScale(e){this.startTransform.set(this.transform),this.endTransform.scale.set(e),this.currentTime=0}setScaleNow(e){this.setScale(e),this.currentTime=1}setLinearVelocity(e){}getLinearVelocity(e){e||=new u;let t=this.endTransform.loc.x-this.startTransform.loc.x,n=this.endTransform.loc.y-this.startTransform.loc.y,r=this.endTransform.loc.z-this.startTransform.loc.z;e.set(t,n,r);let i=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*i*i+6*i)/this.duration),e}setAngularVelocity(e){}getAngularVelocity(e){e||=new u,_(this.startTransform.quat,`ZXY`,D),_(this.endTransform.quat,`ZXY`,O),e.set(O.x-D.x,O.y-D.y,O.z-D.z);let t=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*t*t+6*t)/this.duration),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}smoothstep(e){return e*e*(3-2*e)}update(e){this.currentTime+=e,this.currentTime>this.duration&&(this.currentTime=this.duration);let t=this.currentTime/this.duration,n=this.smoothstep(t);this.transform.set(this.startTransform),this.transform.blend(this.endTransform,n)}},C=new u,w=new u,T=new d,E=new v,D=new u,O=new u,k={up:new u(0,1,0)},A=class extends y{up;target;constructor(e){super();let t={...k,...e};this.target=t.target,this.up=t.up}setTarget(e){this.target=e}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=W.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){C.set(this.transform.loc),this.target.getPosition(w),p(C,w,this.up,T),this.transform.quat.set(T)}},j={up:new u(0,1,0),duration:1},M=class extends S{up;target;constructor(e){super();let t={...j,...e};this.target=t.target,this.up=t.up,this.duration=t.duration}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=W.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){super.update(e),C.set(this.transform.loc),this.target.getPosition(w),p(C,w,this.up,T),this.transform.quat.set(T)}},N={lookFrom:{x:0,y:5,z:-10},smoothness:.9},ee=class extends b{target;lookFrom;up;smoothness;constructor(e){super();let t={...N,...e};this.target=t.target,this.lookFrom=t.lookFrom,this.target.upVector?this.up=this.target.upVector:this.up=W.defaultUpVector,this.smoothness=t.smoothness}init(e,t){super.init(e,t)}update(e){super.update(e),C.set(this.transform.loc),this.target.getPosition(w),p(C,w,this.up,T),T.mul(0,1,0,0),E.quat.set(T),C.set(this.lookFrom),C.apply(this.target.getQuat()),C.add(this.target.getPosition()),E.loc.set(C),this.transform.loc.lerp(this.transform.loc,E.loc,1-this.smoothness),this.transform.quat.slerp(this.transform.quat,E.quat,1-this.smoothness)}};function te(e){return typeof e==`string`}function ne(e){return e.isMesh===!0}function re(e){return e.type===`RoundedBoxGeometry`}function ie(e){return e.type===`BoxGeometry`}function ae(e){return e.type===`SphereGeometry`}function oe(e){return e.type===`IcosahedronGeometry`}function P(e){return e.type===`CylinderGeometry`}function se(e){return e.type===`CapsuleGeometry`}function ce(e){return e.isBone===!0}function F(e){return e.isPerspectiveCamera===!0}var I={rigidBody:`dynamic`,collider:`solid`,meshCollider:`convex_hull`,mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1},L,R=new Map,le=class e{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!e.RAPIER){let t=await import(`@dimforge/rapier3d-compat`);await t.init(),e.RAPIER=t,L=t,this.isInitialized=!0}}createWorld(e){let t=1/60;return this.isRapierWorldOptions(e)&&(t=e.timestep),new z(new L.World(e.gravity),t)}isRapierWorldOptions(e){return`timestep`in e}},z=class{world;timestep;collisionEventQueue;kinematicCharacterCollisionEventQueue;constructor(e,t){this.world=e,this.timestep=t,this.collisionEventQueue=new L.EventQueue(!0),this.world.integrationParameters.dt=this.timestep,this.kinematicCharacterCollisionEventQueue=[]}add(e){e.addOneselfToPhysics(this)}remove(e){e.removeOneselfFromPhysics(this)}update(e){let t=Math.ceil(e/this.timestep);for(let e=0;e<t;e++)this.world.step(this.collisionEventQueue)}getCollisions(){let e=[];return this.collisionEventQueue.drainCollisionEvents((t,n,r)=>{let i=R.get(t),a=R.get(n);i&&a&&e.push({objectA:i,partOfA:t,objectB:a,partOfB:n,started:r})}),e.push(...this.kinematicCharacterCollisionEventQueue),this.kinematicCharacterCollisionEventQueue.length=0,e}},B=class{transform;objectA3;bodyDesc;body;colliderDescs;colliders;completeOptions;constructor(e={}){this.completeOptions={...I,...e},this.transform=new v,this.colliderDescs=[],this.colliders=[]}makeBodyDesc(){let e;switch(this.completeOptions.rigidBody){case`dynamic`:e=L.RigidBodyDesc.dynamic();break;case`kinematic`:e=L.RigidBodyDesc.kinematicPositionBased();break;case`fixed`:e=L.RigidBodyDesc.fixed();break}return e.setTranslation(this.transform.loc.x,this.transform.loc.y,this.transform.loc.z),e.setRotation({x:this.transform.quat.x,y:this.transform.quat.y,z:this.transform.quat.z,w:this.transform.quat.w}),e}configColliderDescs(){if(!this.objectA3)return;let e=this.completeOptions,t=[];this.objectA3.object3D.traverse(n=>{if(ne(n)){let r=fe(n.geometry),i=e.membership<<16|e.filter;if(r)r.colliderDesc.setCollisionGroups(i),e.collisionDetection&&r.colliderDesc.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(r.colliderDesc),r.colliderDesc.setRestitution(e.restitution).setFriction(e.friction),t.push(r.volume);else{let r,a;switch(e.meshCollider){case`tri_mesh`:r=ue(n),a=V(n.geometry);break;case`convex_hull`:r=de(n),a=V(n.geometry);break}r&&(r.setCollisionGroups(i),e.collisionDetection&&r.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),r.setRestitution(e.restitution).setFriction(e.friction),this.colliderDescs.push(r),t.push(a))}}});let n=t.reduce((e,t)=>e+t,0);for(let r=0;r<this.colliderDescs.length;r++)this.colliderDescs[r].setRestitution(e.restitution),this.colliderDescs[r].setFriction(e.friction),this.colliderDescs[r].setMass(e.mass*(t[r]/n))}init(e,t){this.transform.set(e),this.objectA3=t,this.colliderDescs=[],this.colliders=[],this.bodyDesc=this.makeBodyDesc(),this.configColliderDescs(),this.bodyDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.bodyDesc.setRotation(e.quat)}addOneselfToPhysics(e){this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{let n=e.world.createCollider(t,this.body);this.colliders.push(n),this.objectA3&&R.set(n.handle,this.objectA3)}),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0))}removeOneselfFromPhysics(e){this.colliders.forEach(t=>{e.world.removeCollider(t,!0),R.delete(t.handle)}),this.colliders.length=0,this.body&&=(e.world.removeRigidBody(this.body),void 0)}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){this.body?this.body.setTranslation(e,!0):this.bodyDesc?.setTranslation(e.x,e.y,e.z),this.transform.loc.set(e)}setQuat(e){}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||=new u,this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||=new u,this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}update(e){if(this.body){let e=this.body.translation();this.transform.loc.set(e.x,e.y,e.z);let t=this.body.rotation();this.transform.quat.set(t.x,t.y,t.z,t.w)}}};function ue(e){let t=null;if(ne(e)){let n=e;n.updateWorldMatrix(!0,!0);let r=n.geometry.clone();r.applyMatrix4(n.matrixWorld);let i=r.attributes.position.array,a=r.index?r.index.array:null;if(a)a instanceof Uint32Array||(a=new Uint32Array(a));else{let e=r.attributes.position.count;a=new Uint32Array(e);for(let t=0;t<e;t++)a[t]=t}i instanceof Float32Array&&(t=L.ColliderDesc.trimesh(i,a))}return t}function de(e){let t=null;if(ne(e)){let n=e;n.updateWorldMatrix(!0,!0);let r=n.geometry.clone();r.applyMatrix4(n.matrixWorld);let i=r.attributes.position.array;i instanceof Float32Array&&(t=L.ColliderDesc.convexHull(i))}return t}function V(e){let t=e.attributes.position;if(!t)throw Error(`position attribute not found`);let n=e.index,r=t.array,i=0,a=new c.Vector3,o=new c.Vector3,s=new c.Vector3;if(n){let e=n.array;for(let t=0;t<e.length;t+=3){let n=e[t]*3,c=e[t+1]*3,l=e[t+2]*3;a.set(r[n],r[n+1],r[n+2]),o.set(r[c],r[c+1],r[c+2]),s.set(r[l],r[l+1],r[l+2]),i+=a.dot(o.clone().cross(s))}}else for(let e=0;e<r.length;e+=9)a.set(r[e],r[e+1],r[e+2]),o.set(r[e+3],r[e+4],r[e+5]),s.set(r[e+6],r[e+7],r[e+8]),i+=a.dot(o.clone().cross(s));return Math.abs(i)/6}function fe(e){if(re(e)){let t=e.parameters,n=typeof t?.width==`number`?t.width/2:.5,r=typeof t?.height==`number`?t.height/2:.5,i=typeof t?.depth==`number`?t.depth/2:.5,a=.1;return{colliderDesc:L.ColliderDesc.roundCuboid(n-a,r-a,i-a,a),volume:2*n*2*r*2*i}}else if(ie(e)){let t=e.parameters,n=typeof t?.width==`number`?t.width/2:.5,r=typeof t?.height==`number`?t.height/2:.5,i=typeof t?.depth==`number`?t.depth/2:.5;return{colliderDesc:L.ColliderDesc.cuboid(n,r,i),volume:2*n*2*r*2*i}}else if(ae(e)){let t=e.parameters,n=typeof t?.radius==`number`?t.radius:1;return{colliderDesc:L.ColliderDesc.ball(n),volume:4/3*Math.PI*n*n*n}}else if(oe(e)){let t=e.parameters,n=typeof t?.radius==`number`?t.radius:1;return{colliderDesc:L.ColliderDesc.ball(n),volume:4/3*Math.PI*n*n*n}}else if(P(e)){let t=e.parameters,n=typeof t?.radiusBottom==`number`?t.radiusBottom:.5,r=typeof t?.height==`number`?t.height:.5;return{colliderDesc:L.ColliderDesc.cylinder(r/2,n),volume:Math.PI*n*n*r}}else if(se(e)){let t=e.parameters,n=typeof t?.radius==`number`?t.radius:.5,r=typeof t?.height==`number`?t.height:.5;return{colliderDesc:L.ColliderDesc.capsule(r/2,n),volume:4/3*Math.PI*n*n*n+Math.PI*n*n*r}}return null}var H=new le;async function pe(){await H.init()}var U={v0:new u,v1:new u,v2:new u,v3:new u,v4:new u,q0:new d,q1:new d,q2:new d,q3:new d,q4:new d,t0:new v,t1:new v,t2:new v,t3:new v,t4:new v};function me(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}async function he(e){let t=await(await fetch(e)).arrayBuffer();return{zipUrl:e,unzipped:await new Promise((e,n)=>{(0,l.unzip)(new Uint8Array(t),(t,r)=>{t?n(t):e(r)})})}}function ge(e,t){if(t=t.replace(/^\.\//,``).replace(/^\//,``),e.unzipped[t])return(0,l.strFromU8)(e.unzipped[t]);throw Error(`readStringFromUnzippedA3(): no file at ${t}`)}function _e(e,t){if(t=t.replace(/^\.\//,``).replace(/^\//,``),e.unzipped[t]){let n=ye(t);return new Blob([new Uint8Array(e.unzipped[t])],{type:n})}else throw Error(`readBlobFromUnzippedA3(): no file at ${t}`)}var ve={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function ye(e){for(let[t,n]of Object.entries(ve))if(n.test(e))return t;return`application/octet-stream`}function be(e,t){if(!t)return e;let n={...e};for(let r in t)typeof e[r]==`object`&&typeof t[r]==`object`?n[r]=be(e[r],t[r]):n[r]=t[r];return n}var xe={offset:.01,auto:!0,height:1.5,radius:.3,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1,pushDynamic:!1},Se=class{transform;objectA3;completeOptions;controller;colliderDesc;collider;capsuleCenter;nextLocation;tmpV1;tmpV2;tmpQ1;world;constructor(e={}){this.completeOptions={...xe,...e},this.transform=new v,this.capsuleCenter=new u,this.nextLocation=new u,this.tmpV1=new u,this.tmpV2=new u,this.tmpQ1=new d}init(e,t){if(this.transform.set(e),this.objectA3=t,this.completeOptions.auto){let e=new c.Vector3,n=new c.Quaternion,r=new c.Object3D;r.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(e),r.position.set(e.x,e.y,e.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(n),r.quaternion.set(n.x,n.y,n.z,n.w),t.getScale(this.tmpV2),this.tmpV2.write(e),r.scale.set(e.x,e.y,e.z);let i=new c.Box3().setFromObject(r);r.remove(t.object3D),i.getSize(e),this.completeOptions.radius=Math.max(e.x,e.z)/2,this.completeOptions.height=e.y-this.completeOptions.radius*2,i.getCenter(e),this.capsuleCenter.set(e)}let n=this.completeOptions;this.colliderDesc=L.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius);let r=n.membership<<16|n.filter;this.colliderDesc.setCollisionGroups(r),n.collisionDetection&&this.colliderDesc.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),this.colliderDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.colliderDesc.setRotation({x:e.quat.x,y:e.quat.y,z:e.quat.z,w:e.quat.w})}addOneselfToPhysics(e){this.world=e,this.controller=e.world.createCharacterController(this.completeOptions.offset),this.controller.setApplyImpulsesToDynamicBodies(this.completeOptions.pushDynamic),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc)),this.collider&&this.objectA3&&R.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.collider&&=(e.world.removeCollider(this.collider,!1),R.delete(this.collider.handle),void 0),this.controller&&e.world.removeCharacterController(this.controller)}setPosition(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.nextLocation.set(this.tmpV1)}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.collider&&this.collider.setTranslation(this.tmpV1),this.transform.loc.set(e),this.nextLocation.set(this.tmpV1)}setQuat(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||=new u,e.set(0,0,0),e}setAngularVelocity(e){}getAngularVelocity(e){return e||=new u,e.set(0,0,0),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){return this.controller?this.controller.computedGrounded():!1}update(e){if(!this.controller||!this.collider)return;this.transform.quat.set(this.collider.rotation()),this.tmpV1.set(this.collider.translation()),this.tmpV2.set(this.nextLocation),this.tmpV2.sub(this.tmpV1),this.controller.computeColliderMovement(this.collider,this.tmpV2);let t=this.controller.computedMovement();if(this.tmpV1.add(t),this.collider.setTranslation(this.tmpV1),this.tmpV1.sub(this.capsuleCenter),this.transform.loc.set(this.tmpV1),this.nextLocation.set(this.tmpV1),!this.collider||!this.world||!this.objectA3)return;let n=(this.collider.activeEvents()&L.ActiveEvents.COLLISION_EVENTS)!==0,r=this.collider.collisionGroups();for(let e=0;e<this.controller.numComputedCollisions();e++){let t=this.controller.computedCollision(e);if(t&&t.collider){let e=(t.collider.activeEvents()&L.ActiveEvents.COLLISION_EVENTS)!==0;if(!n&&!e)continue;let i=R.get(t.collider.handle);if(!i)continue;Ce(r,t.collider.collisionGroups())&&this.world.kinematicCharacterCollisionEventQueue.push({objectA:this.objectA3,partOfA:this.collider.handle,objectB:i,partOfB:t.collider.handle,started:!0})}}}};function Ce(e,t){let n=e>>>16,r=e&65535,i=t>>>16,a=t&65535;return(r&i)!==0&&(a&n)!==0}var we={auto:!0,height:1.5,radius:.3,mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1},Te=class{transform;objectA3;completeOptions;colliderDesc;collider;bodyDesc;body;capsuleCenter;tmpV1;tmpV2;tmpQ1;physicsWorld;constructor(e={}){this.completeOptions={...we,...e},this.transform=new v,this.capsuleCenter=new u,this.tmpV1=new u,this.tmpV2=new u,this.tmpQ1=new d}init(e,t){if(this.transform.set(e),this.objectA3=t,this.completeOptions.auto){let e=new c.Vector3,n=new c.Quaternion,r=new c.Object3D;r.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(e),r.position.set(e.x,e.y,e.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(n),r.quaternion.set(n.x,n.y,n.z,n.w),t.getScale(this.tmpV2),this.tmpV2.write(e),r.scale.set(e.x,e.y,e.z);let i=new c.Box3().setFromObject(r);i.getSize(e),this.completeOptions.radius=Math.max(e.x,e.z)/2,this.completeOptions.height=e.y-this.completeOptions.radius*2,i.getCenter(e),this.capsuleCenter.set(e)}let n=this.completeOptions;this.bodyDesc=L.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.bodyDesc.setRotation(e.quat),this.colliderDesc=L.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius),this.colliderDesc.setMass(n.mass);let r=n.membership<<16|n.filter;this.colliderDesc.setCollisionGroups(r),n.collisionDetection&&this.colliderDesc.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),this.colliderDesc.setRestitution(n.restitution).setFriction(n.friction)}addOneselfToPhysics(e){this.physicsWorld=e,this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.body.setEnabledRotations(!1,!1,!1,!0),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0)),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc,this.body)),this.collider&&this.objectA3&&R.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.collider&&=(e.world.removeCollider(this.collider,!0),R.delete(this.collider.handle),void 0),this.body&&=(e.world.removeRigidBody(this.body),void 0),this.physicsWorld=void 0}setPosition(e){}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.body?this.body.setTranslation(this.tmpV1,!0):this.bodyDesc?.setTranslation(this.tmpV1.x,this.tmpV1.y,this.tmpV1.z),this.transform.loc.set(e)}setQuat(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||=new u,this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||=new u,this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}isGrounded(){if(this.body&&this.physicsWorld){let e=this.body.translation(),t=new L.Ray(e,{x:0,y:-1,z:0}),n=1.1*(this.completeOptions.height+this.completeOptions.radius);return this.physicsWorld.world.castRay(t,n,!0,void 0,void 0,this.collider)!==null}else return this.transform.loc.y<=0}update(e){if(!this.body)return;let t=new u(this.body.translation());t.sub(this.capsuleCenter),this.transform.loc.set(t),this.transform.quat.set(this.body.rotation())}},Ee=new c.SphereGeometry,De=new c.MeshStandardMaterial({color:16711680}),Oe=new c.Mesh(Ee,De),ke={left:-20,right:20,top:20,bottom:-20,angle:Math.PI/6,near:.1,far:100,shadowMapWidth:1024,shadowMapHeight:1024},W=class e{static defaultRotationOrder=`ZXY`;static defaultUpVector=new u(0,1,0);rotationOrder;upVector;object3D;scene;balloon;transformer;parent;children=[];clickListener;autoDirection=!1;constructor(e){this.autoDirection=!1,this.transformer=this.initTransformer(e),this.object3D=new c.Object3D;let t=this.initObject(e);t&&this.object3D.add(t),this.object3D.traverse(e=>{e.userData.a3js={objectA3:this}})}initObject(e){return Oe.clone()}initTransformer(e){return new y}setTransformer(e){U.t0.set(this.transformer.transform),e.init(U.t0,this),this.transformer=e}getTransformer(){return this.transformer}setMode(e,t){e===`Default`?this.setTransformer(new y):e===`Smooth`?this.setTransformer(new S(t)):e===`Follow`?this.setTransformer(new ee(t)):e===`Billboard`?this.setTransformer(new A(t)):e===`SmoothBillboard`?this.setTransformer(new M(t)):e===`SimplePhysics`?this.setTransformer(new B(t)):e===`KinematicCharacter`?this.setTransformer(new Se(t)):e===`DynamicCharacter`&&this.setTransformer(new Te(t))}update(t){let n=this.getLinearVelocity(),r=n.length();if(this.autoDirection&&r>1e-4){n.normalize();let t=this.upVector?this.upVector:e.defaultUpVector;U.v0.cross(n,t),U.v0.length()>1e-4&&(U.v0.set(0,0,0),p(U.v0,n,t,U.q0),this.setQuatNow(U.q0))}this.transformer.update(t),this.transformer.transform.write(this),this.children.forEach(e=>{e.update(t)})}add(e){if(e.scene){console.warn(`ObjectA3.add(obj) is ignored.`);return}if(e.parent){console.warn(`ObjectA3.add(obj) is ignored.`);return}this.children.push(e),e.parent=this,this.object3D.add(e.object3D)}remove(e){if(e.parent!==this){console.warn(`ObjectA3.remove(obj) is ignored.`);return}let t=this.children.indexOf(e);this.children.splice(t,1),e.parent=void 0,this.object3D.remove(e.object3D)}setSpeechBubble(e){this.balloon?this.balloon.message=e:this.balloon=new Ae(e)}setClickListener(e){this.clickListener=e}handleCollision(e,t,n,r){}async clicked(){this.clickListener&&await this.clickListener(this)}setCastShadow(e){this.object3D.traverse(t=>{t instanceof c.Mesh&&(t.castShadow=e)})}setReceiveShadow(e){this.object3D.traverse(t=>{t instanceof c.Mesh&&(t.receiveShadow=e)})}setLightShadow(e,t){let n={...ke,...t};this.object3D.traverse(t=>{t instanceof c.DirectionalLight?(t.castShadow=e,t.shadow.camera.left=n.left,t.shadow.camera.right=n.right,t.shadow.camera.top=n.top,t.shadow.camera.bottom=n.bottom,t.shadow.camera.near=n.near,t.shadow.camera.far=n.far,t.shadow.camera.updateProjectionMatrix(),t.shadow.mapSize.width=n.shadowMapWidth,t.shadow.mapSize.height=n.shadowMapHeight):t instanceof c.SpotLight?(t.castShadow=e,t.angle=n.angle,t.shadow.camera.near=n.near,t.shadow.camera.far=n.far,t.shadow.camera.updateProjectionMatrix(),t.shadow.mapSize.width=n.shadowMapWidth,t.shadow.mapSize.height=n.shadowMapHeight):t instanceof c.PointLight&&(t.castShadow=e,t.shadow.camera.near=n.near,t.shadow.camera.far=n.far,t.shadow.camera.updateProjectionMatrix(),t.shadow.mapSize.width=n.shadowMapWidth,t.shadow.mapSize.height=n.shadowMapHeight)})}getPosition(e){return e?(e.set(this.transformer.transform.loc),e):this.transformer.transform.loc.clone()}setPosition(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setPosition(U.v0)}setPositionNow(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setPositionNow(U.v0)}getQuat(e){return e?(e.set(this.transformer.transform.quat),e):this.transformer.transform.quat.clone()}setQuat(e,t,n,r){typeof e==`number`?U.q0.set(e,t,n,r):U.q0.set(e),this.transformer.setQuat(U.q0)}setQuatNow(e,t,n,r){typeof e==`number`?U.q0.set(e,t,n,r):U.q0.set(e),this.transformer.setQuatNow(U.q0)}getScale(e){return e?(e.set(this.transformer.transform.scale),e):this.transformer.transform.scale.clone()}setScale(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setScale(U.v0)}setScaleNow(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setScaleNow(U.v0)}setRotation(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q1),this.setQuat(U.q1)}setRotationNow(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q0),this.setQuatNow(U.q0)}lookAt(t,n,r){typeof t==`number`?U.v1.set(t,n,r):t instanceof e?U.v1.set(t.transformer.transform.loc):U.v1.set(t);let i=this.upVector?this.upVector:e.defaultUpVector;p(this.transformer.transform.loc,U.v1,i,U.q1),this.setQuat(U.q1)}lookAtNow(t,n,r){typeof t==`number`?U.v1.set(t,n,r):t instanceof e?U.v1.set(t.transformer.transform.loc):U.v1.set(t);let i=this.upVector?this.upVector:e.defaultUpVector;p(this.transformer.transform.loc,U.v1,i,U.q1),this.setQuatNow(U.q1)}getUnitVecX(e){return e?(e.set(1,0,0),e.apply(this.object3D.quaternion)):new u(1,0,0).apply(this.object3D.quaternion)}getUnitVecY(e){return e?(e.set(0,1,0),e.apply(this.object3D.quaternion)):new u(0,1,0).apply(this.object3D.quaternion)}getUnitVecZ(e){return e?(e.set(0,0,1),e.apply(this.object3D.quaternion)):new u(0,0,1).apply(this.object3D.quaternion)}translate(e,t,n){U.v1.set(this.transformer.transform.loc),typeof e==`number`?U.v1.add(e,t,n):U.v1.add(e),this.setPosition(U.v1)}translateNow(e,t,n){U.v1.set(this.transformer.transform.loc),typeof e==`number`?U.v1.add(e,t,n):U.v1.add(e),this.setPositionNow(U.v1)}mulQuat(e,t,n,r){U.q1.set(this.transformer.transform.quat),typeof e==`number`?U.q1.mul(e,t,n,r):U.q1.mul(e),this.setQuat(U.q1)}mulQuatNow(e,t,n,r){U.q1.set(this.transformer.transform.quat),typeof e==`number`?U.q1.mul(e,t,n,r):U.q1.mul(e),this.setQuatNow(U.q1)}mulRotation(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q1),this.getQuat(U.q0),U.q0.mul(U.q1),this.setQuat(U.q0)}mulRotationNow(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q1),this.getQuat(U.q0),U.q0.mul(U.q1),this.setQuatNow(U.q0)}scaleBy(e,t,n){this.getScale(U.v0),typeof e==`number`?U.v0.set(U.v0.x*e,U.v0.y*t,U.v0.z*n):U.v0.set(U.v0.x*e.x,U.v0.y*e.y,U.v0.z*e.z),this.setScale(U.v0)}mulScaleNow(e,t,n){this.getScale(U.v0),typeof e==`number`?U.v0.set(U.v0.x*e,U.v0.y*t,U.v0.z*n):U.v0.set(U.v0.x*e.x,U.v0.y*e.y,U.v0.z*e.z),this.setScaleNow(U.v0)}moveForward(e){this.getUnitVecZ(U.v0),U.v0.scale(e),this.translate(U.v0)}moveForwardNow(e){this.getUnitVecZ(U.v0),U.v0.scale(e),this.translateNow(U.v0)}moveBackward(e){this.getUnitVecZ(U.v0),U.v0.scale(-e),this.translate(U.v0)}moveBackwardNow(e){this.getUnitVecZ(U.v0),U.v0.scale(-e),this.translateNow(U.v0)}moveRight(e){this.getUnitVecX(U.v0),U.v0.scale(-e),this.translate(U.v0)}moveRightNow(e){this.getUnitVecX(U.v0),U.v0.scale(-e),this.translateNow(U.v0)}moveLeft(e){this.getUnitVecX(U.v0),U.v0.scale(e),this.translate(U.v0)}moveLeftNow(e){this.getUnitVecX(U.v0),U.v0.scale(e),this.translateNow(U.v0)}moveUp(e){this.getUnitVecY(U.v0),U.v0.scale(e),this.translate(U.v0)}moveUpNow(e){this.getUnitVecY(U.v0),U.v0.scale(e),this.translateNow(U.v0)}moveDown(e){this.getUnitVecY(U.v0),U.v0.scale(-e),this.translate(U.v0)}moveDownNow(e){this.getUnitVecY(U.v0),U.v0.scale(-e),this.translateNow(U.v0)}turnUp(e){this.mulRotation(-e,0,0)}turnUpNow(e){this.mulRotationNow(-e,0,0)}turnDown(e){this.mulRotation(e,0,0)}turnDownNow(e){this.mulRotationNow(e,0,0)}turnRight(e){this.mulRotation(0,-e,0)}turnRightNow(e){this.mulRotationNow(0,-e,0)}turnLeft(e){this.mulRotation(0,e,0)}turnLeftNow(e){this.mulRotationNow(0,e,0)}rollRight(e){this.mulRotation(0,0,e)}rollRightNow(e){this.mulRotationNow(0,0,e)}rollLeft(e){this.mulRotation(0,0,-e)}rollLeftNow(e){this.mulRotationNow(0,0,-e)}setLinearVelocity(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setLinearVelocity(U.v0)}getLinearVelocity(e){return this.transformer.getLinearVelocity(e)}setAngularVelocity(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setAngularVelocity(U.v0)}getAngularVelocity(e){return this.transformer.getAngularVelocity(e)}resetForce(){this.transformer.resetForce()}addForce(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.addForce(U.v0)}addForceAtPoint(e,t,n,r,i,a){if(typeof e==`number`)if(typeof t==`number`)U.v0.set(e,t,n),U.v1.set(r,i,a);else{console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else if(typeof t==`number`){console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else U.v0.set(e),U.v1.set(t);this.transformer.addForceAtPoint(U.v0,U.v1)}resetTorque(){this.transformer.resetTorque()}addTorque(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.addTorque(U.v0)}applyImpulse(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.applyImpulse(U.v0)}applyImpulseAtPoint(e,t,n,r,i,a){if(typeof e==`number`)if(typeof t==`number`)U.v0.set(e,t,n),U.v1.set(r,i,a);else{console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else if(typeof t==`number`){console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else U.v0.set(e),U.v1.set(t);this.transformer.applyImpulseAtPoint(U.v0,U.v1)}applyTorqueImpulse(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.applyTorqueImpulse(U.v0)}addOneselfToPhysics(e){this.transformer.addOneselfToPhysics(e)}removeOneselfFromPhysics(e){this.transformer.removeOneselfFromPhysics(e)}isGrounded(){return this.transformer.isGrounded()}},Ae=class{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir=`RIGHT`,this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}},je=class{shape;motion;constructor(e,t){this.shape=e,this.motion=t}enable(e,t){this.motion.playCount=0,this.motion.time=0,e.add(this.shape.root)}disable(e,t){e.remove(this.shape.root)}},Me=class extends W{ready;actions;currentAction;stateAction;emoteAction;morphs;overwriteMorphs;autoAction=!1;haltActionName=`default`;walkActionName=`walk`;runActionName=`run`;minWalkSpeed=.1;minRunSpeed=1;constructor(e){super(e),this.actions={},this.morphs={},this.overwriteMorphs=!1,this.ready=this.asyncInit(e),this.autoAction=!1}syncInit(e,t,n={}){this.actions=t,this.stateAction=this.actions[e],this.currentAction=this.stateAction,this.object3D.clear(),this.morphs=n,this.stateAction?.enable(this.object3D,this.scene)}setActions(e){this.actions=e}getAction(e){return this.actions[e]}addAction(e,t){this.actions[e]=t}removeAction(e){let t=this.actions[e];return delete this.actions[e],t}getActionNames(){return Object.keys(this.actions)}setState(e){let t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.stateAction=t)}setEmote(e){let t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.emoteAction=t)}setMorphsOverwrite(e){this.overwriteMorphs=e}setMorph(e,t){if(e in this.morphs){let{array:n,idx:r}=this.morphs[e];n[r]=t}}getMorphNames(){return Object.keys(this.morphs)}pose={};update(e){super.update(e);let t;if(this.emoteAction&&this.emoteAction.motion.playCount<=0?(t=this.emoteAction.motion.update(e),this.emoteAction.motion.playCount>0&&(this.emoteAction.disable(this.object3D,this.scene),this.emoteAction=void 0,this.stateAction&&(this.stateAction.enable(this.object3D,this.scene),this.currentAction=this.stateAction))):this.stateAction&&(t=this.stateAction.motion.update(e)),t&&this.currentAction&&this.currentAction.shape.bones)for(let[e,n]of Object.entries(t)){let t=this.currentAction.shape.bones[e];if(t&&(n.loc&&t.position.set(n.loc.x,n.loc.y,n.loc.z),n.quat&&t.quaternion.set(n.quat.x,n.quat.y,n.quat.z,n.quat.w),n.scale&&t.scale.set(n.scale.x,n.scale.y,n.scale.z)),!this.overwriteMorphs&&n.morphs){for(let e of n.morphs)for(let t of Object.keys(this.morphs))if(t.startsWith(e.name)){let{array:n}=this.morphs[t];for(let t=0;t<n.length;t++)n[t]=e.vals[t];break}}}this.object3D.updateMatrixWorld(!0),this.currentAction&&this.currentAction.shape.skeleton?.update();let n=this.getLinearVelocity().length();this.autoAction&&(n<this.minWalkSpeed?this.actions[this.haltActionName]!==this.stateAction&&this.setState(this.haltActionName):n<this.minRunSpeed?this.actions[this.walkActionName]!==this.stateAction&&this.setState(this.walkActionName):this.actions[this.runActionName]!==this.stateAction&&this.setState(this.runActionName))}setAutoAction(e){this.autoAction=e}setAutoDirection(e){this.autoDirection=e}},Ne=class{name;playCount;time;finishListener;constructor(){this.name=`dummy`,this.playCount=0,this.time=0}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setPause(e){}setTime(e){}setFinishListener(e){this.finishListener=e}update(e){return{}}},G=(e,t)=>()=>(t||(t={exports:{}},e(t.exports,t)),t.exports),Pe=G(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION=`9.0.1`}),K=G((e,t)=>{"use strict";var n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.toFastProperties=e.timer=e.peek=e.isES2015MapSupported=e.PRINT_WARNING=e.PRINT_ERROR=e.packArray=e.IDENTITY=e.NOOP=e.merge=e.groupBy=e.defaults=e.assignNoOverwrite=e.assign=e.zipObject=e.sortBy=e.indexOf=e.some=e.difference=e.every=e.isObject=e.isRegExp=e.isArray=e.partial=e.uniq=e.compact=e.reduce=e.findAll=e.find=e.cloneObj=e.cloneArr=e.contains=e.has=e.pick=e.reject=e.filter=e.dropRight=e.drop=e.isFunction=e.isUndefined=e.isString=e.forEach=e.last=e.first=e.flatten=e.map=e.mapValues=e.values=e.keys=e.isEmpty=void 0;function r(e){return e&&e.length===0}e.isEmpty=r;function i(e){return e==null?[]:Object.keys(e)}e.keys=i;function a(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push(e[n[r]]);return t}e.values=a;function o(e,t){for(var n=[],r=i(e),a=0;a<r.length;a++){var o=r[a];n.push(t.call(null,e[o],o))}return n}e.mapValues=o;function s(e,t){for(var n=[],r=0;r<e.length;r++)n.push(t.call(null,e[r],r));return n}e.map=s;function c(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];Array.isArray(r)?t=t.concat(c(r)):t.push(r)}return t}e.flatten=c;function l(e){return r(e)?void 0:e[0]}e.first=l;function u(e){var t=e&&e.length;return t?e[t-1]:void 0}e.last=u;function d(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)t.call(null,e[n],n);else if(M(e))for(var r=i(e),n=0;n<r.length;n++){var a=r[n],o=e[a];t.call(null,o,a)}else throw Error(`non exhaustive match`)}e.forEach=d;function f(e){return typeof e==`string`}e.isString=f;function p(e){return e===void 0}e.isUndefined=p;function m(e){return e instanceof Function}e.isFunction=m;function h(e,t){return t===void 0&&(t=1),e.slice(t,e.length)}e.drop=h;function g(e,t){return t===void 0&&(t=1),e.slice(0,e.length-t)}e.dropRight=g;function _(e,t){var n=[];if(Array.isArray(e))for(var r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}e.filter=_;function v(e,t){return _(e,function(e){return!t(e)})}e.reject=v;function y(e,t){for(var n=Object.keys(e),r={},i=0;i<n.length;i++){var a=n[i],o=e[a];t(o)&&(r[a]=o)}return r}e.pick=y;function b(e,t){return M(e)?e.hasOwnProperty(t):!1}e.has=b;function x(e,t){return w(e,function(e){return e===t})!==void 0}e.contains=x;function S(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}e.cloneArr=S;function C(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}e.cloneObj=C;function w(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(t.call(null,r))return r}}e.find=w;function T(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}e.findAll=T;function E(e,t,n){for(var r=Array.isArray(e),o=r?e:a(e),s=r?[]:i(e),c=n,l=0;l<o.length;l++)c=t.call(null,c,o[l],r?l:s[l]);return c}e.reduce=E;function D(e){return v(e,function(e){return e==null})}e.compact=D;function O(e,t){t===void 0&&(t=function(e){return e});var n=[];return E(e,function(e,r){var i=t(r);return x(n,i)?e:(n.push(i),e.concat(r))},[])}e.uniq=O;function k(e){var t=[...arguments].slice(1),n=[null].concat(t);return Function.bind.apply(e,n)}e.partial=k;function A(e){return Array.isArray(e)}e.isArray=A;function j(e){return e instanceof RegExp}e.isRegExp=j;function M(e){return e instanceof Object}e.isObject=M;function N(e,t){for(var n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0}e.every=N;function ee(e,t){return v(e,function(e){return x(t,e)})}e.difference=ee;function te(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return!0;return!1}e.some=te;function ne(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}e.indexOf=ne;function re(e,t){var n=S(e);return n.sort(function(e,n){return t(e)-t(n)}),n}e.sortBy=re;function ie(e,t){if(e.length!==t.length)throw Error(`can't zipObject with different number of keys and values!`);for(var n={},r=0;r<e.length;r++)n[e[r]]=t[r];return n}e.zipObject=ie;function ae(e){for(var t=[...arguments].slice(1),n=0;n<t.length;n++)for(var r=t[n],a=i(r),o=0;o<a.length;o++){var s=a[o];e[s]=r[s]}return e}e.assign=ae;function oe(e){for(var t=[...arguments].slice(1),n=0;n<t.length;n++)for(var r=t[n],a=i(r),o=0;o<a.length;o++){var s=a[o];b(e,s)||(e[s]=r[s])}return e}e.assignNoOverwrite=oe;function P(){var e=[...arguments];return oe.apply(void 0,n([{}],e))}e.defaults=P;function se(e,t){var n={};return d(e,function(e){var r=t(e),i=n[r];i?i.push(e):n[r]=[e]}),n}e.groupBy=se;function ce(e,t){for(var n=C(e),r=i(t),a=0;a<r.length;a++){var o=r[a];n[o]=t[o]}return n}e.merge=ce;function F(){}e.NOOP=F;function I(e){return e}e.IDENTITY=I;function L(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r===void 0?void 0:r)}return t}e.packArray=L;function R(e){console&&console.error&&console.error(`Error: `+e)}e.PRINT_ERROR=R;function le(e){console&&console.warn&&console.warn(`Warning: `+e)}e.PRINT_WARNING=le;function z(){return typeof Map==`function`}e.isES2015MapSupported=z;function B(e){return e[e.length-1]}e.peek=B;function ue(e){var t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}e.timer=ue;function de(e){function t(){}t.prototype=e;var n=new t;function r(){return typeof n.bar}return r(),r(),e}e.toFastProperties=de}),Fe=G((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define([],n):typeof t==`object`&&t.exports?t.exports=n():e.regexpToAst=n()})(typeof self<`u`?self:e,function(){function e(){}e.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},e.prototype.restoreState=function(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx},e.prototype.pattern=function(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);var t=this.disjunction();this.consumeChar(`/`);for(var n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case`g`:o(n,`global`);break;case`i`:o(n,`ignoreCase`);break;case`m`:o(n,`multiLine`);break;case`u`:o(n,`unicode`);break;case`y`:o(n,`sticky`);break}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}},e.prototype.disjunction=function(){var e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}},e.prototype.alternative=function(){for(var e=[],t=this.idx;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}},e.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},e.prototype.assertion=function(){var e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:this.consumeChar(`?`);var t;switch(this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break}s(t);var n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}c()},e.prototype.quantifier=function(e){var t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:var r=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:r,atMost:r};break;case`,`:var i;this.isDigit()?(i=this.integerIncludingZero(),t={atLeast:r,atMost:i}):t={atLeast:r,atMost:1/0},this.consumeChar(`}`);break}if(e===!0&&t===void 0)return;s(t);break}if(!(e===!0&&t===void 0))return s(t),this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t},e.prototype.atom=function(){var e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),s(e),e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e},e.prototype.dotAll=function(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[i(`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three");c=s(c,1);let l=require("fflate");var u=class e{x=0;y=0;z=0;constructor(e,t,n){typeof e==`number`?(this.x=e,this.y=t,this.z=n):e===void 0?this.x=this.y=this.z=0:(this.x=e.x,this.y=e.y,this.z=e.z)}clone(){return new e(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z}normalize(){let e=this.x*this.x+this.y*this.y+this.z*this.z,t=Math.sqrt(e);return t===0?console.warn(`Vec3.normalize.`):(this.x/=t,this.y/=t,this.z/=t),this}negate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}set(e,t,n){return typeof e==`number`?(this.x=e,this.y=t,this.z=n):(this.x=e.x,this.y=e.y,this.z=e.z),this}add(e,t,n){return typeof e==`number`?(this.x+=e,this.y+=t,this.z+=n):(this.x+=e.x,this.y+=e.y,this.z+=e.z),this}sub(e,t,n){return typeof e==`number`?(this.x-=e,this.y-=t,this.z-=n):(this.x-=e.x,this.y-=e.y,this.z-=e.z),this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this}apply(e,t,n,r){let i,a,o,s;typeof e==`number`?(i=e,a=t,o=n,s=r):(i=e.x,a=e.y,o=e.z,s=e.w);let c=2*(a*this.z-o*this.y),l=2*(o*this.x-i*this.z),u=2*(i*this.y-a*this.x);return this.x+=s*c+a*u-o*l,this.y+=s*l+o*c-i*u,this.z+=s*u+i*l-a*c,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z}},d=class e{x=0;y=0;z=0;w=1;constructor(e,t,n,r){typeof e==`number`?(this.x=e,this.y=t,this.z=n,this.w=r):e===void 0?(this.x=this.y=this.z=0,this.w=1):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w)}clone(){return new e(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w}normalize(){let e=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w,t=Math.sqrt(e);return t===0?console.warn(`Quat.normalize.`):(this.x/=t,this.y/=t,this.z/=t,this.w/=t),this}conjugate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}set(e,t,n,r){return typeof e==`number`?(this.x=e,this.y=t,this.z=n,this.w=r):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w),this}mul(e,t,n,r){let i=this.x,a=this.y,o=this.z,s=this.w,c,l,u,d;return typeof e==`number`?(c=e,l=t,u=n,d=r):(c=e.x,l=e.y,u=e.z,d=e.w),this.x=s*c+i*d+a*u-o*l,this.y=s*l-i*u+a*d+o*c,this.z=s*u+i*l-a*c+o*d,this.w=s*d-i*c-a*l-o*u,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z,this.w=(1-n)*e.w+n*t.w}slerp(e,t,n){if(n<0||n>1){console.warn(`Quat.slerp(): t must be in [0,1]`);return}let r=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(f.set(t),r<0&&(r*=-1,f.set(-f.x,-f.y,-f.z,-f.w)),r>.9995){this.x=(1-n)*e.x+n*f.x,this.y=(1-n)*e.y+n*f.y,this.z=(1-n)*e.z+n*f.z,this.w=(1-n)*e.w+n*f.w;let t=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);t<1e-4?(console.warn(`Quat.slerp(); ???!`),this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x*=1/t,this.y*=1/t,this.z*=1/t,this.w*=1/t)}else{let t=Math.acos(r),i=Math.sin((1-n)*t)/Math.sin(t),a=Math.sin(n*t)/Math.sin(t);this.x=i*e.x+a*f.x,this.y=i*e.y+a*f.y,this.z=i*e.z+a*f.z,this.w=i*e.w+a*f.w}}},f=new d;function p(e,t,n,r){n.normalize();let i=e.clone().sub(t).normalize(),a=new u().cross(i,n).normalize(),o=new u().cross(a,i),s=a.x,c=o.x,l=-i.x,f=a.y,p=o.y,m=-i.y,h=a.z,g=o.z,_=-i.z,v,y,b,x,S=s+p+_;if(S>0){let e=Math.sqrt(S+1)*2;v=(g-m)/e,y=(l-h)/e,b=(f-c)/e,x=.25*e}else if(s>p&&s>_){let e=Math.sqrt(1+s-p-_)*2;v=.25*e,y=(c+f)/e,b=(l+h)/e,x=(g-m)/e}else if(p>_){let e=Math.sqrt(1+p-s-_)*2;v=(c+f)/e,y=.25*e,b=(m+g)/e,x=(l-h)/e}else{let e=Math.sqrt(1+_-s-p)*2;v=(l+h)/e,y=(m+g)/e,b=.25*e,x=(f-c)/e}let C=r??new d;return C.set(v,y,b,x),C}function m(e,t=`ZXY`,n){let r=n===void 0?new d(0,0,0,1):n.set(0,0,0,1);for(let n=0;n<3;n++)switch(t.charAt(n)){case`X`:r.mul(Math.sin(e.x),0,0,Math.cos(e.x));break;case`Y`:r.mul(0,Math.sin(e.y),0,Math.cos(e.y));break;case`Z`:r.mul(0,0,Math.sin(e.z),Math.cos(e.z));break}return r}function h(e){let t=[[],[],[]],n=e.x+e.x,r=e.y+e.y,i=e.z+e.z,a=e.x*n,o=e.x*r,s=e.x*i,c=e.y*r,l=e.y*i,u=e.z*i,d=e.w*n,f=e.w*r,p=e.w*i;return t[0][0]=1-(c+u),t[0][1]=o-p,t[0][2]=s+f,t[1][0]=o+p,t[1][1]=1-(a+u),t[1][2]=l-d,t[2][0]=s-f,t[2][1]=l+d,t[2][2]=1-(a+c),t}var g=e=>Math.max(-1,Math.min(1,e));function _(e,t=`ZXY`,n){let r=h(e),i=n??new u,a=0,o=0,s=0;switch(t){case`XYZ`:o=Math.asin(g(r[0][2])),Math.abs(r[0][2])<.9999999?(a=Math.atan2(-r[1][2],r[2][2]),s=Math.atan2(-r[0][1],r[0][0])):(a=Math.atan2(r[2][1],r[1][1]),s=0);break;case`YXZ`:a=Math.asin(-g(r[1][2])),Math.abs(r[1][2])<.9999999?(o=Math.atan2(r[0][2],r[2][2]),s=Math.atan2(r[1][0],r[1][1])):(o=Math.atan2(-r[2][0],r[0][0]),s=0);break;case`ZXY`:a=Math.asin(g(r[2][1])),Math.abs(r[2][1])<.9999999?(o=Math.atan2(-r[2][0],r[2][2]),s=Math.atan2(-r[0][1],r[1][1])):(o=0,s=Math.atan2(r[1][0],r[0][0]));break;case`ZYX`:o=Math.asin(-g(r[2][0])),Math.abs(r[2][0])<.9999999?(a=Math.atan2(r[2][1],r[2][2]),s=Math.atan2(r[1][0],r[0][0])):(a=0,s=Math.atan2(-r[0][1],r[1][1]));break;case`YZX`:s=Math.asin(g(r[1][0])),Math.abs(r[1][0])<.9999999?(a=Math.atan2(-r[1][2],r[1][1]),o=Math.atan2(-r[2][0],r[0][0])):(a=0,o=Math.atan2(r[0][2],r[2][2]));break;case`XZY`:s=Math.asin(-g(r[0][1])),Math.abs(r[0][1])<.9999999?(a=Math.atan2(r[2][1],r[1][1]),o=Math.atan2(r[0][2],r[0][0])):(a=Math.atan2(-r[1][2],r[2][2]),o=0);break}return i.set(a,o,s),i}var v=class e{loc;quat;scale;constructor(){this.loc=new u,this.quat=new d,this.scale=new u(1,1,1)}set(t){return t instanceof e?(this.loc.set(t.loc),this.quat.set(t.quat),this.scale.set(t.scale)):(t.getPosition(this.loc),t.getQuat(this.quat),t.getScale(this.scale)),this}write(e){e instanceof W?(e.object3D.position.set(this.loc.x,this.loc.y,this.loc.z),e.object3D.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.object3D.scale.set(this.scale.x,this.scale.y,this.scale.z)):(e.position.set(this.loc.x,this.loc.y,this.loc.z),e.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.scale.set(this.scale.x,this.scale.y,this.scale.z))}blend(e,t){return this.loc.lerp(this.loc,e.loc,t),this.quat.slerp(this.quat,e.quat,t),this.scale.lerp(this.scale,e.scale,t),this}clone(){let t=new e;return t.set(this),t}},y=class{transform;constructor(){this.transform=new v}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.transform.loc.set(e)}setPositionNow(e){this.transform.loc.set(e)}setQuat(e){this.transform.quat.set(e)}setQuatNow(e){this.transform.quat.set(e)}setScale(e){this.transform.scale.set(e)}setScaleNow(e){this.transform.scale.set(e)}setLinearVelocity(e){}getLinearVelocity(e){return e||new u}setAngularVelocity(e){}getAngularVelocity(e){return e||new u}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}},b=class{transform;constructor(){this.transform=new v}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||new u}setAngularVelocity(e){}getAngularVelocity(e){return e||new u}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}},x={duration:1},S=class{options;startTransform;transform;endTransform;currentTime;duration;constructor(e={}){this.options={...x,...e},this.startTransform=new v,this.transform=new v,this.endTransform=new v,this.currentTime=0,this.duration=this.options.duration}init(e,t){this.startTransform.set(e),this.transform.set(e),this.endTransform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.startTransform.set(this.transform),this.endTransform.loc.set(e),this.currentTime=0}setPositionNow(e){this.setPosition(e),this.currentTime=1}setQuat(e){this.startTransform.set(this.transform),this.endTransform.quat.set(e),this.currentTime=0}setQuatNow(e){this.setQuat(e),this.currentTime=1}setScale(e){this.startTransform.set(this.transform),this.endTransform.scale.set(e),this.currentTime=0}setScaleNow(e){this.setScale(e),this.currentTime=1}setLinearVelocity(e){}getLinearVelocity(e){e||=new u;let t=this.endTransform.loc.x-this.startTransform.loc.x,n=this.endTransform.loc.y-this.startTransform.loc.y,r=this.endTransform.loc.z-this.startTransform.loc.z;e.set(t,n,r);let i=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*i*i+6*i)/this.duration),e}setAngularVelocity(e){}getAngularVelocity(e){e||=new u,_(this.startTransform.quat,`ZXY`,D),_(this.endTransform.quat,`ZXY`,O),e.set(O.x-D.x,O.y-D.y,O.z-D.z);let t=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*t*t+6*t)/this.duration),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}smoothstep(e){return e*e*(3-2*e)}update(e){this.currentTime+=e,this.currentTime>this.duration&&(this.currentTime=this.duration);let t=this.currentTime/this.duration,n=this.smoothstep(t);this.transform.set(this.startTransform),this.transform.blend(this.endTransform,n)}},C=new u,w=new u,T=new d,E=new v,D=new u,O=new u,k={up:new u(0,1,0)},A=class extends y{up;target;constructor(e){super();let t={...k,...e};this.target=t.target,this.up=t.up}setTarget(e){this.target=e}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=W.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){C.set(this.transform.loc),this.target.getPosition(w),p(C,w,this.up,T),this.transform.quat.set(T)}},j={up:new u(0,1,0),duration:1},M=class extends S{up;target;constructor(e){super();let t={...j,...e};this.target=t.target,this.up=t.up,this.duration=t.duration}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=W.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){super.update(e),C.set(this.transform.loc),this.target.getPosition(w),p(C,w,this.up,T),this.transform.quat.set(T)}},N={lookFrom:{x:0,y:5,z:-10},smoothness:.9},ee=class extends b{target;lookFrom;up;smoothness;constructor(e){super();let t={...N,...e};this.target=t.target,this.lookFrom=t.lookFrom,this.target.upVector?this.up=this.target.upVector:this.up=W.defaultUpVector,this.smoothness=t.smoothness}init(e,t){super.init(e,t)}update(e){super.update(e),C.set(this.transform.loc),this.target.getPosition(w),p(C,w,this.up,T),T.mul(0,1,0,0),E.quat.set(T),C.set(this.lookFrom),C.apply(this.target.getQuat()),C.add(this.target.getPosition()),E.loc.set(C),this.transform.loc.lerp(this.transform.loc,E.loc,1-this.smoothness),this.transform.quat.slerp(this.transform.quat,E.quat,1-this.smoothness)}};function te(e){return typeof e==`string`}function ne(e){return e.isMesh===!0}function re(e){return e.type===`RoundedBoxGeometry`}function ie(e){return e.type===`BoxGeometry`}function ae(e){return e.type===`SphereGeometry`}function oe(e){return e.type===`IcosahedronGeometry`}function P(e){return e.type===`CylinderGeometry`}function se(e){return e.type===`CapsuleGeometry`}function ce(e){return e.isBone===!0}function F(e){return e.isPerspectiveCamera===!0}var I={rigidBody:`dynamic`,collider:`solid`,meshCollider:`convex_hull`,mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1},L,R=new Map,le=class e{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!e.RAPIER){let t=await import(`@dimforge/rapier3d-compat`);await t.init(),e.RAPIER=t,L=t,this.isInitialized=!0}}createWorld(e){let t=1/60;return this.isRapierWorldOptions(e)&&(t=e.timestep),new z(new L.World(e.gravity),t)}isRapierWorldOptions(e){return`timestep`in e}},z=class{world;timestep;collisionEventQueue;kinematicCharacterCollisionEventQueue;constructor(e,t){this.world=e,this.timestep=t,this.collisionEventQueue=new L.EventQueue(!0),this.world.integrationParameters.dt=this.timestep,this.kinematicCharacterCollisionEventQueue=[]}add(e){e.addOneselfToPhysics(this)}remove(e){e.removeOneselfFromPhysics(this)}update(e){let t=Math.ceil(e/this.timestep);for(let e=0;e<t;e++)this.world.step(this.collisionEventQueue)}getCollisions(){let e=[];return this.collisionEventQueue.drainCollisionEvents((t,n,r)=>{let i=R.get(t),a=R.get(n);i&&a&&e.push({objectA:i,partOfA:t,objectB:a,partOfB:n,started:r})}),e.push(...this.kinematicCharacterCollisionEventQueue),this.kinematicCharacterCollisionEventQueue.length=0,e}},B=class{transform;objectA3;bodyDesc;body;colliderDescs;colliders;completeOptions;constructor(e={}){this.completeOptions={...I,...e},this.transform=new v,this.colliderDescs=[],this.colliders=[]}makeBodyDesc(){let e;switch(this.completeOptions.rigidBody){case`dynamic`:e=L.RigidBodyDesc.dynamic();break;case`kinematic`:e=L.RigidBodyDesc.kinematicPositionBased();break;case`fixed`:e=L.RigidBodyDesc.fixed();break}return e.setTranslation(this.transform.loc.x,this.transform.loc.y,this.transform.loc.z),e.setRotation({x:this.transform.quat.x,y:this.transform.quat.y,z:this.transform.quat.z,w:this.transform.quat.w}),e}configColliderDescs(){if(!this.objectA3)return;let e=this.completeOptions,t=[],n=e.membership<<16|e.filter,r=this.transform.scale;this.objectA3.object3D.traverse(i=>{if(ne(i)){let a=fe(i.geometry,r);if(a)a.colliderDesc.setCollisionGroups(n),e.collisionDetection&&a.colliderDesc.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(a.colliderDesc),a.colliderDesc.setRestitution(e.restitution).setFriction(e.friction),t.push(a.volume);else{let r,a;switch(e.meshCollider){case`tri_mesh`:r=ue(i),a=V(i.geometry);break;case`convex_hull`:r=de(i),a=V(i.geometry);break}r&&(r.setCollisionGroups(n),e.collisionDetection&&r.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),r.setRestitution(e.restitution).setFriction(e.friction),this.colliderDescs.push(r),t.push(a))}}});let i=t.reduce((e,t)=>e+t,0);for(let n=0;n<this.colliderDescs.length;n++)this.colliderDescs[n].setRestitution(e.restitution),this.colliderDescs[n].setFriction(e.friction),this.colliderDescs[n].setMass(e.mass*(t[n]/i))}init(e,t){this.transform.set(e),this.objectA3=t,this.colliderDescs=[],this.colliders=[],this.objectA3.object3D.scale.set(e.scale.x,e.scale.y,e.scale.z),this.bodyDesc=this.makeBodyDesc(),this.configColliderDescs(),this.bodyDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.bodyDesc.setRotation(e.quat)}addOneselfToPhysics(e){this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{let n=e.world.createCollider(t,this.body);this.colliders.push(n),this.objectA3&&R.set(n.handle,this.objectA3)}),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0))}removeOneselfFromPhysics(e){this.colliders.forEach(t=>{e.world.removeCollider(t,!0),R.delete(t.handle)}),this.colliders.length=0,this.body&&=(e.world.removeRigidBody(this.body),void 0)}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){this.body?this.body.setTranslation(e,!0):this.bodyDesc?.setTranslation(e.x,e.y,e.z),this.transform.loc.set(e)}setQuat(e){}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||=new u,this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||=new u,this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}update(e){if(this.body){let e=this.body.translation();this.transform.loc.set(e.x,e.y,e.z);let t=this.body.rotation();this.transform.quat.set(t.x,t.y,t.z,t.w)}}};function ue(e){let t=null;if(ne(e)){let n=e;n.updateWorldMatrix(!0,!0);let r=n.geometry.clone();r.applyMatrix4(n.matrixWorld);let i=r.attributes.position.array,a=r.index?r.index.array:null;if(a)a instanceof Uint32Array||(a=new Uint32Array(a));else{let e=r.attributes.position.count;a=new Uint32Array(e);for(let t=0;t<e;t++)a[t]=t}i instanceof Float32Array&&(t=L.ColliderDesc.trimesh(i,a))}return t}function de(e){let t=null;if(ne(e)){let n=e;n.updateWorldMatrix(!0,!0);let r=n.geometry.clone();r.applyMatrix4(n.matrixWorld);let i=r.attributes.position.array;i instanceof Float32Array&&(t=L.ColliderDesc.convexHull(i))}return t}function V(e){let t=e.attributes.position;if(!t)throw Error(`position attribute not found`);let n=e.index,r=t.array,i=0,a=new c.Vector3,o=new c.Vector3,s=new c.Vector3;if(n){let e=n.array;for(let t=0;t<e.length;t+=3){let n=e[t]*3,c=e[t+1]*3,l=e[t+2]*3;a.set(r[n],r[n+1],r[n+2]),o.set(r[c],r[c+1],r[c+2]),s.set(r[l],r[l+1],r[l+2]),i+=a.dot(o.clone().cross(s))}}else for(let e=0;e<r.length;e+=9)a.set(r[e],r[e+1],r[e+2]),o.set(r[e+3],r[e+4],r[e+5]),s.set(r[e+6],r[e+7],r[e+8]),i+=a.dot(o.clone().cross(s));return Math.abs(i)/6}function fe(e,t=new u(1,1,1)){if(re(e)){let n=e.parameters,r=(typeof n?.width==`number`?n.width/2:.5)*t.x,i=(typeof n?.height==`number`?n.height/2:.5)*t.y,a=(typeof n?.depth==`number`?n.depth/2:.5)*t.z,o=.1*Math.cbrt(t.x*t.y*t.z);return{colliderDesc:L.ColliderDesc.roundCuboid(r-o,i-o,a-o,o),volume:2*r*2*i*2*a}}else if(ie(e)){let n=e.parameters,r=(typeof n?.width==`number`?n.width/2:.5)*t.x,i=(typeof n?.height==`number`?n.height/2:.5)*t.y,a=(typeof n?.depth==`number`?n.depth/2:.5)*t.z;return{colliderDesc:L.ColliderDesc.cuboid(r,i,a),volume:2*r*2*i*2*a}}else if(ae(e)){let n=e.parameters,r=Math.cbrt(t.x*t.y*t.z),i=(typeof n?.radius==`number`?n.radius:1)*r;return{colliderDesc:L.ColliderDesc.ball(i),volume:4/3*Math.PI*i*i*i}}else if(oe(e)){let n=e.parameters,r=Math.cbrt(t.x*t.y*t.z),i=(typeof n?.radius==`number`?n.radius:1)*r;return{colliderDesc:L.ColliderDesc.ball(i),volume:4/3*Math.PI*i*i*i}}else if(P(e)){let n=e.parameters,r=Math.sqrt(t.x*t.z),i=(typeof n?.radiusBottom==`number`?n.radiusBottom:.5)*r,a=(typeof n?.height==`number`?n.height:.5)*t.y;return{colliderDesc:L.ColliderDesc.cylinder(a/2,i),volume:Math.PI*i*i*a}}else if(se(e)){let n=e.parameters,r=Math.sqrt(t.x*t.z),i=(typeof n?.radius==`number`?n.radius:.5)*r,a=(typeof n?.height==`number`?n.height:.5)*t.y;return{colliderDesc:L.ColliderDesc.capsule(a/2,i),volume:4/3*Math.PI*i*i*i+Math.PI*i*i*a}}return null}var H=new le;async function pe(){await H.init()}var U={v0:new u,v1:new u,v2:new u,v3:new u,v4:new u,q0:new d,q1:new d,q2:new d,q3:new d,q4:new d,t0:new v,t1:new v,t2:new v,t3:new v,t4:new v};function me(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}async function he(e){let t=await(await fetch(e)).arrayBuffer();return{zipUrl:e,unzipped:await new Promise((e,n)=>{(0,l.unzip)(new Uint8Array(t),(t,r)=>{t?n(t):e(r)})})}}function ge(e,t){if(t=t.replace(/^\.\//,``).replace(/^\//,``),e.unzipped[t])return(0,l.strFromU8)(e.unzipped[t]);throw Error(`readStringFromUnzippedA3(): no file at ${t}`)}function _e(e,t){if(t=t.replace(/^\.\//,``).replace(/^\//,``),e.unzipped[t]){let n=ye(t);return new Blob([new Uint8Array(e.unzipped[t])],{type:n})}else throw Error(`readBlobFromUnzippedA3(): no file at ${t}`)}var ve={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function ye(e){for(let[t,n]of Object.entries(ve))if(n.test(e))return t;return`application/octet-stream`}function be(e,t){if(!t)return e;let n={...e};for(let r in t)typeof e[r]==`object`&&typeof t[r]==`object`?n[r]=be(e[r],t[r]):n[r]=t[r];return n}var xe={offset:.01,auto:!0,height:1.5,radius:.3,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1,pushDynamic:!1},Se=class{transform;objectA3;completeOptions;controller;colliderDesc;collider;capsuleCenter;nextLocation;tmpV1;tmpV2;tmpQ1;world;constructor(e={}){this.completeOptions={...xe,...e},this.transform=new v,this.capsuleCenter=new u,this.nextLocation=new u,this.tmpV1=new u,this.tmpV2=new u,this.tmpQ1=new d}init(e,t){if(this.transform.set(e),this.objectA3=t,this.completeOptions.auto){let e=new c.Vector3,n=new c.Quaternion,r=new c.Object3D;r.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(e),r.position.set(e.x,e.y,e.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(n),r.quaternion.set(n.x,n.y,n.z,n.w),t.getScale(this.tmpV2),this.tmpV2.write(e),r.scale.set(e.x,e.y,e.z);let i=new c.Box3().setFromObject(r);r.remove(t.object3D),i.getSize(e),this.completeOptions.radius=Math.max(e.x,e.z)/2,this.completeOptions.height=e.y-this.completeOptions.radius*2,i.getCenter(e),this.capsuleCenter.set(e)}let n=this.completeOptions;this.colliderDesc=L.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius);let r=n.membership<<16|n.filter;this.colliderDesc.setCollisionGroups(r),n.collisionDetection&&this.colliderDesc.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),this.colliderDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.colliderDesc.setRotation({x:e.quat.x,y:e.quat.y,z:e.quat.z,w:e.quat.w})}addOneselfToPhysics(e){this.world=e,this.controller=e.world.createCharacterController(this.completeOptions.offset),this.controller.setApplyImpulsesToDynamicBodies(this.completeOptions.pushDynamic),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc)),this.collider&&this.objectA3&&R.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.collider&&=(e.world.removeCollider(this.collider,!1),R.delete(this.collider.handle),void 0),this.controller&&e.world.removeCharacterController(this.controller)}setPosition(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.nextLocation.set(this.tmpV1)}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.collider&&this.collider.setTranslation(this.tmpV1),this.transform.loc.set(e),this.nextLocation.set(this.tmpV1)}setQuat(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||=new u,e.set(0,0,0),e}setAngularVelocity(e){}getAngularVelocity(e){return e||=new u,e.set(0,0,0),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){return this.controller?this.controller.computedGrounded():!1}update(e){if(!this.controller||!this.collider)return;this.transform.quat.set(this.collider.rotation()),this.tmpV1.set(this.collider.translation()),this.tmpV2.set(this.nextLocation),this.tmpV2.sub(this.tmpV1),this.controller.computeColliderMovement(this.collider,this.tmpV2);let t=this.controller.computedMovement();if(this.tmpV1.add(t),this.collider.setTranslation(this.tmpV1),this.tmpV1.sub(this.capsuleCenter),this.transform.loc.set(this.tmpV1),this.nextLocation.set(this.tmpV1),!this.collider||!this.world||!this.objectA3)return;let n=(this.collider.activeEvents()&L.ActiveEvents.COLLISION_EVENTS)!==0,r=this.collider.collisionGroups();for(let e=0;e<this.controller.numComputedCollisions();e++){let t=this.controller.computedCollision(e);if(t&&t.collider){let e=(t.collider.activeEvents()&L.ActiveEvents.COLLISION_EVENTS)!==0;if(!n&&!e)continue;let i=R.get(t.collider.handle);if(!i)continue;Ce(r,t.collider.collisionGroups())&&this.world.kinematicCharacterCollisionEventQueue.push({objectA:this.objectA3,partOfA:this.collider.handle,objectB:i,partOfB:t.collider.handle,started:!0})}}}};function Ce(e,t){let n=e>>>16,r=e&65535,i=t>>>16,a=t&65535;return(r&i)!==0&&(a&n)!==0}var we={auto:!0,height:1.5,radius:.3,mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1},Te=class{transform;objectA3;completeOptions;colliderDesc;collider;bodyDesc;body;capsuleCenter;tmpV1;tmpV2;tmpQ1;physicsWorld;constructor(e={}){this.completeOptions={...we,...e},this.transform=new v,this.capsuleCenter=new u,this.tmpV1=new u,this.tmpV2=new u,this.tmpQ1=new d}init(e,t){if(this.transform.set(e),this.objectA3=t,this.completeOptions.auto){let e=new c.Vector3,n=new c.Quaternion,r=new c.Object3D;r.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(e),r.position.set(e.x,e.y,e.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(n),r.quaternion.set(n.x,n.y,n.z,n.w),t.getScale(this.tmpV2),this.tmpV2.write(e),r.scale.set(e.x,e.y,e.z);let i=new c.Box3().setFromObject(r);i.getSize(e),this.completeOptions.radius=Math.max(e.x,e.z)/2,this.completeOptions.height=e.y-this.completeOptions.radius*2,i.getCenter(e),this.capsuleCenter.set(e)}let n=this.completeOptions;this.bodyDesc=L.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.bodyDesc.setRotation(e.quat),this.colliderDesc=L.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius),this.colliderDesc.setMass(n.mass);let r=n.membership<<16|n.filter;this.colliderDesc.setCollisionGroups(r),n.collisionDetection&&this.colliderDesc.setActiveEvents(L.ActiveEvents.COLLISION_EVENTS),this.colliderDesc.setRestitution(n.restitution).setFriction(n.friction)}addOneselfToPhysics(e){this.physicsWorld=e,this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.body.setEnabledRotations(!1,!1,!1,!0),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0)),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc,this.body)),this.collider&&this.objectA3&&R.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.collider&&=(e.world.removeCollider(this.collider,!0),R.delete(this.collider.handle),void 0),this.body&&=(e.world.removeRigidBody(this.body),void 0),this.physicsWorld=void 0}setPosition(e){}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.body?this.body.setTranslation(this.tmpV1,!0):this.bodyDesc?.setTranslation(this.tmpV1.x,this.tmpV1.y,this.tmpV1.z),this.transform.loc.set(e)}setQuat(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||=new u,this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||=new u,this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}isGrounded(){if(this.body&&this.physicsWorld){let e=this.body.translation(),t=new L.Ray(e,{x:0,y:-1,z:0}),n=1.1*(this.completeOptions.height+this.completeOptions.radius);return this.physicsWorld.world.castRay(t,n,!0,void 0,void 0,this.collider)!==null}else return this.transform.loc.y<=0}update(e){if(!this.body)return;let t=new u(this.body.translation());t.sub(this.capsuleCenter),this.transform.loc.set(t),this.transform.quat.set(this.body.rotation())}},Ee=new c.SphereGeometry,De=new c.MeshStandardMaterial({color:16711680}),Oe=new c.Mesh(Ee,De),ke={left:-20,right:20,top:20,bottom:-20,angle:Math.PI/6,near:.1,far:100,shadowMapWidth:1024,shadowMapHeight:1024},W=class e{static defaultRotationOrder=`ZXY`;static defaultUpVector=new u(0,1,0);rotationOrder;upVector;object3D;scene;balloon;transformer;parent;children=[];clickListener;autoDirection=!1;constructor(e){this.autoDirection=!1,this.transformer=this.initTransformer(e),this.object3D=new c.Object3D;let t=this.initObject(e);t&&this.object3D.add(t),this.object3D.traverse(e=>{e.userData.a3js={objectA3:this}})}initObject(e){return Oe.clone()}initTransformer(e){return new y}setTransformer(e){U.t0.set(this.transformer.transform),e.init(U.t0,this),this.transformer=e}getTransformer(){return this.transformer}setMode(e,t){e===`Default`?this.setTransformer(new y):e===`Smooth`?this.setTransformer(new S(t)):e===`Follow`?this.setTransformer(new ee(t)):e===`Billboard`?this.setTransformer(new A(t)):e===`SmoothBillboard`?this.setTransformer(new M(t)):e===`SimplePhysics`?this.setTransformer(new B(t)):e===`KinematicCharacter`?this.setTransformer(new Se(t)):e===`DynamicCharacter`&&this.setTransformer(new Te(t))}update(t){let n=this.getLinearVelocity(),r=n.length();if(this.autoDirection&&r>1e-4){n.normalize();let t=this.upVector?this.upVector:e.defaultUpVector;U.v0.cross(n,t),U.v0.length()>1e-4&&(U.v0.set(0,0,0),p(U.v0,n,t,U.q0),this.setQuatNow(U.q0))}this.transformer.update(t),this.transformer.transform.write(this),this.children.forEach(e=>{e.update(t)})}add(e){if(e.scene){console.warn(`ObjectA3.add(obj) is ignored.`);return}if(e.parent){console.warn(`ObjectA3.add(obj) is ignored.`);return}this.children.push(e),e.parent=this,this.object3D.add(e.object3D)}remove(e){if(e.parent!==this){console.warn(`ObjectA3.remove(obj) is ignored.`);return}let t=this.children.indexOf(e);this.children.splice(t,1),e.parent=void 0,this.object3D.remove(e.object3D)}setSpeechBubble(e){this.balloon?this.balloon.message=e:this.balloon=new Ae(e)}setClickListener(e){this.clickListener=e}handleCollision(e,t,n,r){}async clicked(){this.clickListener&&await this.clickListener(this)}setCastShadow(e){this.object3D.traverse(t=>{t instanceof c.Mesh&&(t.castShadow=e)})}setReceiveShadow(e){this.object3D.traverse(t=>{t instanceof c.Mesh&&(t.receiveShadow=e)})}setLightShadow(e,t){let n={...ke,...t};this.object3D.traverse(t=>{t instanceof c.DirectionalLight?(t.castShadow=e,t.shadow.camera.left=n.left,t.shadow.camera.right=n.right,t.shadow.camera.top=n.top,t.shadow.camera.bottom=n.bottom,t.shadow.camera.near=n.near,t.shadow.camera.far=n.far,t.shadow.camera.updateProjectionMatrix(),t.shadow.mapSize.width=n.shadowMapWidth,t.shadow.mapSize.height=n.shadowMapHeight):t instanceof c.SpotLight?(t.castShadow=e,t.angle=n.angle,t.shadow.camera.near=n.near,t.shadow.camera.far=n.far,t.shadow.camera.updateProjectionMatrix(),t.shadow.mapSize.width=n.shadowMapWidth,t.shadow.mapSize.height=n.shadowMapHeight):t instanceof c.PointLight&&(t.castShadow=e,t.shadow.camera.near=n.near,t.shadow.camera.far=n.far,t.shadow.camera.updateProjectionMatrix(),t.shadow.mapSize.width=n.shadowMapWidth,t.shadow.mapSize.height=n.shadowMapHeight)})}getPosition(e){return e?(e.set(this.transformer.transform.loc),e):this.transformer.transform.loc.clone()}setPosition(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setPosition(U.v0)}setPositionNow(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setPositionNow(U.v0)}getQuat(e){return e?(e.set(this.transformer.transform.quat),e):this.transformer.transform.quat.clone()}setQuat(e,t,n,r){typeof e==`number`?U.q0.set(e,t,n,r):U.q0.set(e),this.transformer.setQuat(U.q0)}setQuatNow(e,t,n,r){typeof e==`number`?U.q0.set(e,t,n,r):U.q0.set(e),this.transformer.setQuatNow(U.q0)}getScale(e){return e?(e.set(this.transformer.transform.scale),e):this.transformer.transform.scale.clone()}setScale(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setScale(U.v0)}setScaleNow(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setScaleNow(U.v0)}setRotation(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q1),this.setQuat(U.q1)}setRotationNow(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q0),this.setQuatNow(U.q0)}lookAt(t,n,r){typeof t==`number`?U.v1.set(t,n,r):t instanceof e?U.v1.set(t.transformer.transform.loc):U.v1.set(t);let i=this.upVector?this.upVector:e.defaultUpVector;p(this.transformer.transform.loc,U.v1,i,U.q1),this.setQuat(U.q1)}lookAtNow(t,n,r){typeof t==`number`?U.v1.set(t,n,r):t instanceof e?U.v1.set(t.transformer.transform.loc):U.v1.set(t);let i=this.upVector?this.upVector:e.defaultUpVector;p(this.transformer.transform.loc,U.v1,i,U.q1),this.setQuatNow(U.q1)}getUnitVecX(e){return e?(e.set(1,0,0),e.apply(this.object3D.quaternion)):new u(1,0,0).apply(this.object3D.quaternion)}getUnitVecY(e){return e?(e.set(0,1,0),e.apply(this.object3D.quaternion)):new u(0,1,0).apply(this.object3D.quaternion)}getUnitVecZ(e){return e?(e.set(0,0,1),e.apply(this.object3D.quaternion)):new u(0,0,1).apply(this.object3D.quaternion)}translate(e,t,n){U.v1.set(this.transformer.transform.loc),typeof e==`number`?U.v1.add(e,t,n):U.v1.add(e),this.setPosition(U.v1)}translateNow(e,t,n){U.v1.set(this.transformer.transform.loc),typeof e==`number`?U.v1.add(e,t,n):U.v1.add(e),this.setPositionNow(U.v1)}mulQuat(e,t,n,r){U.q1.set(this.transformer.transform.quat),typeof e==`number`?U.q1.mul(e,t,n,r):U.q1.mul(e),this.setQuat(U.q1)}mulQuatNow(e,t,n,r){U.q1.set(this.transformer.transform.quat),typeof e==`number`?U.q1.mul(e,t,n,r):U.q1.mul(e),this.setQuatNow(U.q1)}mulRotation(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q1),this.getQuat(U.q0),U.q0.mul(U.q1),this.setQuat(U.q0)}mulRotationNow(t,n,r){typeof t==`number`?U.v0.set(t,n,r):U.v0.set(t),U.v0.scale(Math.PI/360);let i=this.rotationOrder?this.rotationOrder:e.defaultRotationOrder;m(U.v0,i,U.q1),this.getQuat(U.q0),U.q0.mul(U.q1),this.setQuatNow(U.q0)}scaleBy(e,t,n){this.getScale(U.v0),typeof e==`number`?U.v0.set(U.v0.x*e,U.v0.y*t,U.v0.z*n):U.v0.set(U.v0.x*e.x,U.v0.y*e.y,U.v0.z*e.z),this.setScale(U.v0)}mulScaleNow(e,t,n){this.getScale(U.v0),typeof e==`number`?U.v0.set(U.v0.x*e,U.v0.y*t,U.v0.z*n):U.v0.set(U.v0.x*e.x,U.v0.y*e.y,U.v0.z*e.z),this.setScaleNow(U.v0)}moveForward(e){this.getUnitVecZ(U.v0),U.v0.scale(e),this.translate(U.v0)}moveForwardNow(e){this.getUnitVecZ(U.v0),U.v0.scale(e),this.translateNow(U.v0)}moveBackward(e){this.getUnitVecZ(U.v0),U.v0.scale(-e),this.translate(U.v0)}moveBackwardNow(e){this.getUnitVecZ(U.v0),U.v0.scale(-e),this.translateNow(U.v0)}moveRight(e){this.getUnitVecX(U.v0),U.v0.scale(-e),this.translate(U.v0)}moveRightNow(e){this.getUnitVecX(U.v0),U.v0.scale(-e),this.translateNow(U.v0)}moveLeft(e){this.getUnitVecX(U.v0),U.v0.scale(e),this.translate(U.v0)}moveLeftNow(e){this.getUnitVecX(U.v0),U.v0.scale(e),this.translateNow(U.v0)}moveUp(e){this.getUnitVecY(U.v0),U.v0.scale(e),this.translate(U.v0)}moveUpNow(e){this.getUnitVecY(U.v0),U.v0.scale(e),this.translateNow(U.v0)}moveDown(e){this.getUnitVecY(U.v0),U.v0.scale(-e),this.translate(U.v0)}moveDownNow(e){this.getUnitVecY(U.v0),U.v0.scale(-e),this.translateNow(U.v0)}turnUp(e){this.mulRotation(-e,0,0)}turnUpNow(e){this.mulRotationNow(-e,0,0)}turnDown(e){this.mulRotation(e,0,0)}turnDownNow(e){this.mulRotationNow(e,0,0)}turnRight(e){this.mulRotation(0,-e,0)}turnRightNow(e){this.mulRotationNow(0,-e,0)}turnLeft(e){this.mulRotation(0,e,0)}turnLeftNow(e){this.mulRotationNow(0,e,0)}rollRight(e){this.mulRotation(0,0,e)}rollRightNow(e){this.mulRotationNow(0,0,e)}rollLeft(e){this.mulRotation(0,0,-e)}rollLeftNow(e){this.mulRotationNow(0,0,-e)}setLinearVelocity(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setLinearVelocity(U.v0)}getLinearVelocity(e){return this.transformer.getLinearVelocity(e)}setAngularVelocity(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.setAngularVelocity(U.v0)}getAngularVelocity(e){return this.transformer.getAngularVelocity(e)}resetForce(){this.transformer.resetForce()}addForce(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.addForce(U.v0)}addForceAtPoint(e,t,n,r,i,a){if(typeof e==`number`)if(typeof t==`number`)U.v0.set(e,t,n),U.v1.set(r,i,a);else{console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else if(typeof t==`number`){console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else U.v0.set(e),U.v1.set(t);this.transformer.addForceAtPoint(U.v0,U.v1)}resetTorque(){this.transformer.resetTorque()}addTorque(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.addTorque(U.v0)}applyImpulse(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.applyImpulse(U.v0)}applyImpulseAtPoint(e,t,n,r,i,a){if(typeof e==`number`)if(typeof t==`number`)U.v0.set(e,t,n),U.v1.set(r,i,a);else{console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else if(typeof t==`number`){console.warn(`ObjectA3.addForceAtPoint(): type of arguments mismatch.`);return}else U.v0.set(e),U.v1.set(t);this.transformer.applyImpulseAtPoint(U.v0,U.v1)}applyTorqueImpulse(e,t,n){typeof e==`number`?U.v0.set(e,t,n):U.v0.set(e),this.transformer.applyTorqueImpulse(U.v0)}addOneselfToPhysics(e){this.transformer.addOneselfToPhysics(e)}removeOneselfFromPhysics(e){this.transformer.removeOneselfFromPhysics(e)}isGrounded(){return this.transformer.isGrounded()}},Ae=class{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir=`RIGHT`,this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}},je=class{shape;motion;constructor(e,t){this.shape=e,this.motion=t}enable(e,t){this.motion.playCount=0,this.motion.time=0,e.add(this.shape.root)}disable(e,t){e.remove(this.shape.root)}},Me=class extends W{ready;actions;currentAction;stateAction;emoteAction;morphs;overwriteMorphs;autoAction=!1;haltActionName=`default`;walkActionName=`walk`;runActionName=`run`;minWalkSpeed=.1;minRunSpeed=1;constructor(e){super(e),this.actions={},this.morphs={},this.overwriteMorphs=!1,this.ready=this.asyncInit(e),this.autoAction=!1}syncInit(e,t,n={}){this.actions=t,this.stateAction=this.actions[e],this.currentAction=this.stateAction,this.object3D.clear(),this.morphs=n,this.stateAction?.enable(this.object3D,this.scene)}setActions(e){this.actions=e}getAction(e){return this.actions[e]}addAction(e,t){this.actions[e]=t}removeAction(e){let t=this.actions[e];return delete this.actions[e],t}getActionNames(){return Object.keys(this.actions)}setState(e){let t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.stateAction=t)}setEmote(e){let t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.emoteAction=t)}setMorphsOverwrite(e){this.overwriteMorphs=e}setMorph(e,t){if(e in this.morphs){let{array:n,idx:r}=this.morphs[e];n[r]=t}}getMorphNames(){return Object.keys(this.morphs)}pose={};update(e){super.update(e);let t;if(this.emoteAction&&this.emoteAction.motion.playCount<=0?(t=this.emoteAction.motion.update(e),this.emoteAction.motion.playCount>0&&(this.emoteAction.disable(this.object3D,this.scene),this.emoteAction=void 0,this.stateAction&&(this.stateAction.enable(this.object3D,this.scene),this.currentAction=this.stateAction))):this.stateAction&&(t=this.stateAction.motion.update(e)),t&&this.currentAction&&this.currentAction.shape.bones)for(let[e,n]of Object.entries(t)){let t=this.currentAction.shape.bones[e];if(t&&(n.loc&&t.position.set(n.loc.x,n.loc.y,n.loc.z),n.quat&&t.quaternion.set(n.quat.x,n.quat.y,n.quat.z,n.quat.w),n.scale&&t.scale.set(n.scale.x,n.scale.y,n.scale.z)),!this.overwriteMorphs&&n.morphs){for(let e of n.morphs)for(let t of Object.keys(this.morphs))if(t.startsWith(e.name)){let{array:n}=this.morphs[t];for(let t=0;t<n.length;t++)n[t]=e.vals[t];break}}}this.object3D.updateMatrixWorld(!0),this.currentAction&&this.currentAction.shape.skeleton?.update();let n=this.getLinearVelocity().length();this.autoAction&&(n<this.minWalkSpeed?this.actions[this.haltActionName]!==this.stateAction&&this.setState(this.haltActionName):n<this.minRunSpeed?this.actions[this.walkActionName]!==this.stateAction&&this.setState(this.walkActionName):this.actions[this.runActionName]!==this.stateAction&&this.setState(this.runActionName))}setAutoAction(e){this.autoAction=e}setAutoDirection(e){this.autoDirection=e}},Ne=class{name;playCount;time;finishListener;constructor(){this.name=`dummy`,this.playCount=0,this.time=0}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setPause(e){}setTime(e){}setFinishListener(e){this.finishListener=e}update(e){return{}}},G=(e,t)=>()=>(t||(t={exports:{}},e(t.exports,t)),t.exports),Pe=G(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION=`9.0.1`}),K=G((e,t)=>{"use strict";var n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(e,"__esModule",{value:!0}),e.toFastProperties=e.timer=e.peek=e.isES2015MapSupported=e.PRINT_WARNING=e.PRINT_ERROR=e.packArray=e.IDENTITY=e.NOOP=e.merge=e.groupBy=e.defaults=e.assignNoOverwrite=e.assign=e.zipObject=e.sortBy=e.indexOf=e.some=e.difference=e.every=e.isObject=e.isRegExp=e.isArray=e.partial=e.uniq=e.compact=e.reduce=e.findAll=e.find=e.cloneObj=e.cloneArr=e.contains=e.has=e.pick=e.reject=e.filter=e.dropRight=e.drop=e.isFunction=e.isUndefined=e.isString=e.forEach=e.last=e.first=e.flatten=e.map=e.mapValues=e.values=e.keys=e.isEmpty=void 0;function r(e){return e&&e.length===0}e.isEmpty=r;function i(e){return e==null?[]:Object.keys(e)}e.keys=i;function a(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push(e[n[r]]);return t}e.values=a;function o(e,t){for(var n=[],r=i(e),a=0;a<r.length;a++){var o=r[a];n.push(t.call(null,e[o],o))}return n}e.mapValues=o;function s(e,t){for(var n=[],r=0;r<e.length;r++)n.push(t.call(null,e[r],r));return n}e.map=s;function c(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];Array.isArray(r)?t=t.concat(c(r)):t.push(r)}return t}e.flatten=c;function l(e){return r(e)?void 0:e[0]}e.first=l;function u(e){var t=e&&e.length;return t?e[t-1]:void 0}e.last=u;function d(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)t.call(null,e[n],n);else if(M(e))for(var r=i(e),n=0;n<r.length;n++){var a=r[n],o=e[a];t.call(null,o,a)}else throw Error(`non exhaustive match`)}e.forEach=d;function f(e){return typeof e==`string`}e.isString=f;function p(e){return e===void 0}e.isUndefined=p;function m(e){return e instanceof Function}e.isFunction=m;function h(e,t){return t===void 0&&(t=1),e.slice(t,e.length)}e.drop=h;function g(e,t){return t===void 0&&(t=1),e.slice(0,e.length-t)}e.dropRight=g;function _(e,t){var n=[];if(Array.isArray(e))for(var r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}e.filter=_;function v(e,t){return _(e,function(e){return!t(e)})}e.reject=v;function y(e,t){for(var n=Object.keys(e),r={},i=0;i<n.length;i++){var a=n[i],o=e[a];t(o)&&(r[a]=o)}return r}e.pick=y;function b(e,t){return M(e)?e.hasOwnProperty(t):!1}e.has=b;function x(e,t){return w(e,function(e){return e===t})!==void 0}e.contains=x;function S(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}e.cloneArr=S;function C(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}e.cloneObj=C;function w(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(t.call(null,r))return r}}e.find=w;function T(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r];t.call(null,i)&&n.push(i)}return n}e.findAll=T;function E(e,t,n){for(var r=Array.isArray(e),o=r?e:a(e),s=r?[]:i(e),c=n,l=0;l<o.length;l++)c=t.call(null,c,o[l],r?l:s[l]);return c}e.reduce=E;function D(e){return v(e,function(e){return e==null})}e.compact=D;function O(e,t){t===void 0&&(t=function(e){return e});var n=[];return E(e,function(e,r){var i=t(r);return x(n,i)?e:(n.push(i),e.concat(r))},[])}e.uniq=O;function k(e){var t=[...arguments].slice(1),n=[null].concat(t);return Function.bind.apply(e,n)}e.partial=k;function A(e){return Array.isArray(e)}e.isArray=A;function j(e){return e instanceof RegExp}e.isRegExp=j;function M(e){return e instanceof Object}e.isObject=M;function N(e,t){for(var n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0}e.every=N;function ee(e,t){return v(e,function(e){return x(t,e)})}e.difference=ee;function te(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return!0;return!1}e.some=te;function ne(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}e.indexOf=ne;function re(e,t){var n=S(e);return n.sort(function(e,n){return t(e)-t(n)}),n}e.sortBy=re;function ie(e,t){if(e.length!==t.length)throw Error(`can't zipObject with different number of keys and values!`);for(var n={},r=0;r<e.length;r++)n[e[r]]=t[r];return n}e.zipObject=ie;function ae(e){for(var t=[...arguments].slice(1),n=0;n<t.length;n++)for(var r=t[n],a=i(r),o=0;o<a.length;o++){var s=a[o];e[s]=r[s]}return e}e.assign=ae;function oe(e){for(var t=[...arguments].slice(1),n=0;n<t.length;n++)for(var r=t[n],a=i(r),o=0;o<a.length;o++){var s=a[o];b(e,s)||(e[s]=r[s])}return e}e.assignNoOverwrite=oe;function P(){var e=[...arguments];return oe.apply(void 0,n([{}],e))}e.defaults=P;function se(e,t){var n={};return d(e,function(e){var r=t(e),i=n[r];i?i.push(e):n[r]=[e]}),n}e.groupBy=se;function ce(e,t){for(var n=C(e),r=i(t),a=0;a<r.length;a++){var o=r[a];n[o]=t[o]}return n}e.merge=ce;function F(){}e.NOOP=F;function I(e){return e}e.IDENTITY=I;function L(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r===void 0?void 0:r)}return t}e.packArray=L;function R(e){console&&console.error&&console.error(`Error: `+e)}e.PRINT_ERROR=R;function le(e){console&&console.warn&&console.warn(`Warning: `+e)}e.PRINT_WARNING=le;function z(){return typeof Map==`function`}e.isES2015MapSupported=z;function B(e){return e[e.length-1]}e.peek=B;function ue(e){var t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}e.timer=ue;function de(e){function t(){}t.prototype=e;var n=new t;function r(){return typeof n.bar}return r(),r(),e}e.toFastProperties=de}),Fe=G((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define([],n):typeof t==`object`&&t.exports?t.exports=n():e.regexpToAst=n()})(typeof self<`u`?self:e,function(){function e(){}e.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},e.prototype.restoreState=function(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx},e.prototype.pattern=function(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);var t=this.disjunction();this.consumeChar(`/`);for(var n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case`g`:o(n,`global`);break;case`i`:o(n,`ignoreCase`);break;case`m`:o(n,`multiLine`);break;case`u`:o(n,`unicode`);break;case`y`:o(n,`sticky`);break}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}},e.prototype.disjunction=function(){var e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}},e.prototype.alternative=function(){for(var e=[],t=this.idx;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}},e.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},e.prototype.assertion=function(){var e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:this.consumeChar(`?`);var t;switch(this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break}s(t);var n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}c()},e.prototype.quantifier=function(e){var t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:var r=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:r,atMost:r};break;case`,`:var i;this.isDigit()?(i=this.integerIncludingZero(),t={atLeast:r,atMost:i}):t={atLeast:r,atMost:1/0},this.consumeChar(`}`);break}if(e===!0&&t===void 0)return;s(t);break}if(!(e===!0&&t===void 0))return s(t),this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t},e.prototype.atom=function(){var e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),s(e),e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e},e.prototype.dotAll=function(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[i(`
|
|
2
2
|
`),i(`\r`),i(`\u2028`),i(`\u2029`)]}},e.prototype.atomEscape=function(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.decimalEscapeAtom=function(){return{type:`GroupBackReference`,value:this.positiveInteger()}},e.prototype.characterClassEscape=function(){var e,t=!1;switch(this.popChar()){case`d`:e=u;break;case`D`:e=u,t=!0;break;case`s`:e=f;break;case`S`:e=f,t=!0;break;case`w`:e=d;break;case`W`:e=d,t=!0;break}return s(e),{type:`Set`,value:e,complement:t}},e.prototype.controlEscapeAtom=function(){var e;switch(this.popChar()){case`f`:e=i(`\f`);break;case`n`:e=i(`
|
|
3
3
|
`);break;case`r`:e=i(`\r`);break;case`t`:e=i(` `);break;case`v`:e=i(`\v`);break}return s(e),{type:`Character`,value:e}},e.prototype.controlLetterEscapeAtom=function(){this.consumeChar(`c`);var e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}},e.prototype.nulCharacterAtom=function(){return this.consumeChar(`0`),{type:`Character`,value:i(`\0`)}},e.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar(`x`),this.parseHexDigits(2)},e.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar(`u`),this.parseHexDigits(4)},e.prototype.identityEscapeAtom=function(){return{type:`Character`,value:i(this.popChar())}},e.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
|
|
4
4
|
`:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:i(this.popChar())}}},e.prototype.characterClass=function(){var e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){var n=this.classAtom();if(n.type===`Character`&&this.isRangeDash()){this.consumeChar(`-`);var r=this.classAtom();if(r.type===`Character`){if(r.value<n.value)throw Error(`Range out of order in character class`);e.push({from:n.value,to:r.value})}else a(n.value,e),e.push(i(`-`)),a(r.value,e)}else a(n.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}},e.prototype.classAtom=function(){switch(this.peekChar()){case`]`:case`
|