PageSourceSearch

https://chatforce.com/577.ce80ef14471e4f7d.js

js chatforce.com collected 2026-10-04 07:40:02 UTC 53,785 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkbabble_games=self.webpackChunkbabble_games||[]).push([[577],{4577:(Me,I,P)=>{P.r(I),P.d(I,{AnimatorEngine:()=>Pe});var k=P(467),a=P(4701),Z=P(3973),K=P(9112);const L={type:"change"},C={type:"start"},N={type:"end"},A=new a.RlV,B=new a.Zcv,V=Math.cos(70*a.cj9.DEG2RAD),f=new a.Pq0,y=2*Math.PI,F=1e-6;class X extends a.H2z{constructor(t,e=null){super(t,e),this.state=-1,this.enabled=!0,this.target=new a.Pq0,this.cursor=new a.Pq0,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:a.kBv.ROTATE,MIDDLE:a.kBv.DOLLY,RIGHT:a.kBv.PAN},this.touches={ONE:a.wtR.ROTATE,TWO:a.wtR.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new a.Pq0,this._lastQuaternion=new a.PTz,this._lastTargetPosition=new a.Pq0,this._quat=(new a.PTz).setFromUnitVectors(t.up,new a.Pq0(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new a.YHV,this._sphericalDelta=new a.YHV,this._scale=1,this._panOffset=new a.Pq0,this._rotateStart=new a.I9Y,this._rotateEnd=new a.I9Y,this._rotateDelta=new a.I9Y,this._panStart=new a.I9Y,this._panEnd=new a.I9Y,this._panDelta=new a.I9Y,this._dollyStart=new a.I9Y,this._dollyEnd=new a.I9Y,this._dollyDelta=new a.I9Y,this._dollyDirection=new a.Pq0,this._mouse=new a.I9Y,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=$.bind(this),this._onPointerDown=J.bind(this),this._onPointerUp=Q.bind(this),this._onContextMenu=ae.bind(this),this._onMouseWheel=ie.bind(this),this._onKeyDown=ne.bind(this),this._onTouchStart=se.bind(this),this._onTouchMove=oe.bind(this),this._onMouseDown=ee.bind(this),this._onMouseMove=te.bind(this),this._interceptControlDown=re.bind(this),this._interceptControlUp=le.bind(this),null!==this.domElement&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=t}stopListenToKeyEvents(){null!==this._domElementKeyEvents&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(L),this.update(),this.state=-1}update(t=null){const e=this.object.position;f.copy(e).sub(this.target),f.applyQuaternion(this._quat),this._spherical.setFromVector3(f),this.autoRotate&&-1===this.state&&this._rotateLeft(this._getAutoRotationAngle(t)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(i)&&isFinite(n)&&(i<-Math.PI?i+=y:i>Math.PI&&(i-=y),n<-Math.PI?n+=y:n>Math.PI&&(n-=y),this._spherical.theta=i<=n?Math.max(i,Math.min(n,this._spherical.theta)):this._spherical.theta>(i+n)/2?Math.max(i,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radiu
vendor: 10,847 bytes, line 1
1s=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(f.setFromSpherical(this._spherical),f.applyQuaternion(this._quatInverse),e.copy(this.target).add(f),this.object.lookAt(this.target),!0===this.enableDamping?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const r=f.length();o=this._clampDistance(r*this._scale);const l=r-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const r=new a.Pq0(this._mouse.x,this._mouse.y,0);r.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const _=new a.Pq0(this._mouse.x,this._mouse.y,0);_.unproject(this.object),this.object.position.sub(_).add(r),this.object.updateMatrixWorld(),o=f.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;null!==o&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(A.origin.copy(this.object.position),A.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(A.direction))<V?this.object.lookAt(this.target):(B.setFromNormalAndCoplanarPoint(this.object.up,this.target),A.intersectPlane(B,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,!!(s||this._lastPosition.distanceToSquared(this.object.position)>F||8*(1-this._lastQuaternion.dot(this.object.quaternion))>F||this._lastTargetPosition.distanceToSquared(this.target)>F)&&(this.dispatchEvent(L),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0)}_getAutoRotationAngle(t){return null!==t?y/60*this.autoRotateSpeed*t:y/60/60*this.autoRotateSpeed}_getZoomScale(t){const e=Math.abs(.01*t);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,e){f.setFromMatrixColumn(e,0),f.multiplyScalar(-t),this._panOffset.add(f)}_panUp(t,e){!0===this.screenSpacePanning?f.setFromMatrixColumn(e,1):(f.setFromMatrixColumn(e,0),f.crossVectors(this.object.up,f)),f.multiplyScalar(t),this._panOffset.add(f)}_pan(t,e){const i=this.domElement;if(this.object.isPerspectiveCamera){f.copy(this.object.position).sub(this.target);let s=f.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*s/i.clientHeight,this.object.matrix),this._panUp(2*e*s/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),s=e-i.top,r=i.height;this._mouse.x=(t-i.left)/i.width*2-1,this._mouse.y=-s/r*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(y*this._rotateDelta.x/e.clientHeight),this._rotateUp(y*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let e=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(y*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-y*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(y*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-y*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(1===this._pointers.length)this._rotateStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t);this._rotateStart.set(.5*(t.pageX+e.x),.5*(t.pageY+e.y))}}_handleTouchStartPan(t){if(1===this._pointers.length)this._panStart.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t);this._panStart.set(.5*(t.pageX+e.x),.5*(t.pageY+e.y))}}_handleTouchStartDolly(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,n=t.pageY-e.y,s=Math.sqrt(i*i+n*n);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(1==this._pointers.length)this._rotateEnd.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t);this._rotateEnd.set(.5*(t.pageX+i.x),.5*(t.pageY+i.y))}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(y*this._rotateDelta.x/e.clientHeight),this._rotateUp(y*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(1===this._pointers.length)this._panEnd.set(t.pageX,t.pageY);else{const e=this._getSecondPointerPosition(t);this._panEnd.set(.5*(t.pageX+e.x),.5*(t.pageY+e.y))}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const e=this._getSecondPointerPosition(t),i=t.pageX-e.x,n=t.pageY-e.y,s=Math.sqrt(i*i+n*n);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd),this._updateZoomParameters(.5*(t.pageX+e.x),.5*(t.pageY+e.y))}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return void this._pointers.splice(e,1)}_isTrackingPointer(t){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==t.pointerId)return!0;return!1}_trackPointer(t){let e=this._pointerPositions[t.pointerId];void 0===e&&(e=new a.I9Y,this._pointerPositions[t.pointerId]=e),e.set(t.pageX,t.pageY)}_getSecondPointerPosition(t){return this._pointerPositions[t.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0]]}_customWheelEvent(t){const i={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(t.deltaMode){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100}return t.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function J(c){!1!==this.enabled&&(0===this._pointers.length&&(this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(c)&&(this._addPointer(c),"touch"===c.pointerType?this._onTouchStart(c):this._onMouseDown(c)))}function $(c){!1!==this.enabled&&("touch"===c.pointerType?this._onTouchMove(c):this._onMouseMove(c))}function Q(c){switch(this._removePointer(c),this._pointers.length){case 0:this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(N),this.state=-1;break;case 1:const t=this._pointers[0],e=this._pointerPositions[t];this._onTouchStart({pointerId:t,pageX:e.x,pageY:e.y})}}function ee(c){let t;switch(c.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case a.kBv.DOLLY:if(!1===this.enableZoom)return;this._handleMouseDownDolly(c),this.state=1;break;
1case a.kBv.ROTATE:if(c.ctrlKey||c.metaKey||c.shiftKey){if(!1===this.enablePan)return;this._handleMouseDownPan(c),this.state=2}else{if(!1===this.enableRotate)return;this._handleMouseDownRotate(c),this.state=0}break;case a.kBv.PAN:if(c.ctrlKey||c.metaKey||c.shiftKey){if(!1===this.enableRotate)return;this._handleMouseDownRotate(c),this.state=0}else{if(!1===this.enablePan)return;this._handleMouseDownPan(c),this.state=2}break;default:this.state=-1}-1!==this.state&&this.dispatchEvent(C)}function te(c){switch(this.state){case 0:if(!1===this.enableRotate)return;this._handleMouseMoveRotate(c);break;case 1:if(!1===this.enableZoom)return;this._handleMouseMoveDolly(c);break;case 2:if(!1===this.enablePan)return;this._handleMouseMovePan(c)}}function ie(c){!1===this.enabled||!1===this.enableZoom||-1!==this.state||(c.preventDefault(),this.dispatchEvent(C),this._handleMouseWheel(this._customWheelEvent(c)),this.dispatchEvent(N))}function ne(c){!1!==this.enabled&&this._handleKeyDown(c)}function se(c){switch(this._trackPointer(c),this._pointers.length){case 1:switch(this.touches.ONE){case a.wtR.ROTATE:if(!1===this.enableRotate)return;this._handleTouchStartRotate(c),this.state=3;break;case a.wtR.PAN:if(!1===this.enablePan)return;this._handleTouchStartPan(c),this.state=4;break;default:this.state=-1}break;case 2:switch(this.touches.TWO){case a.wtR.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchStartDollyPan(c),this.state=5;break;case a.wtR.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchStartDollyRotate(c),this.state=6;break;default:this.state=-1}break;default:this.state=-1}-1!==this.state&&this.dispatchEvent(C)}function oe(c){switch(this._trackPointer(c),this.state){case 3:if(!1===this.enableRotate)return;this._handleTouchMoveRotate(c),this.update();break;case 4:if(!1===this.enablePan)return;this._handleTouchMovePan(c),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this._handleTouchMoveDollyPan(c),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this._handleTouchMoveDollyRotate(c),this.update();break;default:this.state=-1}}function ae(c){!1!==this.enabled&&c.preventDefault()}function re(c){"Control"===c.key&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function le(c){"Control"===c.key&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var b=P(5460);function g(c,t){return{model_file:`models-variation/${c}-${t.variant}.glb`,display_name:t.displayName,attribution:t.attribution??"",license:t.license??"CC0",preview_image:`models-variation/profiles/${t.variant}.png`}}const M="human",ce=[g(M,{variant:"base",displayName:"Mannequin",attribution:"Quaternius",license:"CC0"}),g(M,{variant:"female",displayName:"Female Mannequin",attribution:"Quaternius",license:"CC0"}),g(M,{variant:"zombie",displayName:"Zombie",attribution:"Kenney.nl",license:"CC0"}),g(M,{variant:"sophia",displayName:"Sophia",attribution:"Tysan Tan",license:"CC-SA 4.0"}),g(M,{variant:"jay",displayName:"Jay",attribution:"Blender Studio",license:"CC-BY"}),g(M,{variant:"sintel",displayName:"Sintel",attribution:"Blender Studio",license:"CC-BY"}),g(M,{variant:"bunny",displayName:"Bunny",attribution:"Blender Studio",license:"CC-BY"})],T="fox",_e=[g(T,{variant:"fox",displayName:"Fox"}),g(T,{variant:"dog",displayName:"Dog"}),g(T,{variant:"horse",displayName:"Horse"}),g(T,{variant:"cat",displayName:"Carrot",attribution:"David Revoy",license:"CC-BY"}),g(T,{variant:"panda",displayName:"Panda"})],O="bird",he=[g(O,{variant:"seagull",displayName:"Seagull"}),g(O,{variant:"eagle",displayName:"Bald Eagle"})],j="kaiju",de=[g(j,{variant:"kaiju",displayName:"Kaiju"}),g(j,{variant:"t-rex",displayName:"T-Rex"})],z="fish",pe=[g(z,{variant:"shark",displayName:"Shark"}),g(z,{variant:"whale",displayName:"Whale"})];class R{static{this.all=[{skeleton_type:b.Y.Human,model_file:"models/model-human.glb",rig_display_name:"Human",animation_files:["../animations/human-base-animations.glb","../animations/human-addon-animations.glb"],animation_preview_folder:"human",position_tracking_bone_name:"pelvis",skeleton_template_image_url:"rigs/reference/human.png",model_variations:ce},{skeleton_type:b.Y.Fox,model_file:"models/model-fox.glb",rig_display_name:"Fox",animation_files:["../animations/fox-animations.glb"],animation_preview_folder:"fox",position_tracking_bone_name:"hi
1ps",skeleton_template_image_url:"rigs/reference/fox.png",model_variations:_e},{skeleton_type:b.Y.Bird,model_file:"models/model-bird.glb",rig_display_name:"Bird",animation_files:["../animations/bird-animations.glb"],animation_preview_folder:"bird",position_tracking_bone_name:"hips",skeleton_template_image_url:"rigs/reference/bird.png",model_variations:he},{skeleton_type:b.Y.Dragon,model_file:"models/model-dragon.glb",rig_display_name:"Dragon",animation_files:["../animations/dragon-animations.glb"],animation_preview_folder:"dragon",position_tracking_bone_name:"hips",skeleton_template_image_url:"rigs/reference/dragon.png"},{skeleton_type:b.Y.Kaiju,model_file:"models/model-kaiju.glb",rig_display_name:"Kaiju",animation_files:["../animations/kaiju-animations.glb"],animation_preview_folder:"kaiju",position_tracking_bone_name:"hips",skeleton_template_image_url:"rigs/reference/kaiju.png",model_variations:de},{skeleton_type:b.Y.Spider,model_file:"models/model-spider.glb",rig_display_name:"Spider",animation_files:["../animations/spider-animations.glb"],animation_preview_folder:"spider",position_tracking_bone_name:"hips",skeleton_template_image_url:"rigs/reference/spider.png"},{skeleton_type:b.Y.Snake,model_file:"models/model-snake.glb",rig_display_name:"Snake",animation_files:["../animations/snake-animations.glb"],animation_preview_folder:"snake",position_tracking_bone_name:"head",skeleton_template_image_url:"rigs/reference/snake.png"},{skeleton_type:b.Y.Fish,model_file:"models/model-shark.glb",rig_display_name:"Fish",animation_files:["../animations/shark-animations.glb"],animation_preview_folder:"shark",position_tracking_bone_name:"pelvis",skeleton_template_image_url:"rigs/reference/shark.png",model_variations:pe}]}static by_key(t){return this.all.find(e=>e.skeleton_type===t)}static by_skeleton_type(t){return this.all.find(e=>e.skeleton_type===t)}static get_animation_file_paths(t){const e=this.by_skeleton_type(t);return void 0===e||0===e.animation_files.length?[]:e.animation_files}}const ue={human:["Angry","Attack_Ground_Pound","Backflip","Bow Pull Back","Bow Pull Hold","Bow Release","Bow","Chest_Open","Chop_Tree","Climb Ladder","Climb Wall","ClimbUp_1m_RM","Confused","Consume Item","Consume","Crawl RM","Crawl","Crouch_Idle","Crouch_Walk","Dance Body Roll","Dance Charleston","Dance Reach Hip","Dance_Simple","Death_A","Death_B","Death_C","Death_D","Defend","Dizzy","Dodge_back_RM","Dodge_back","Dodge_left_RM","Dodge_left","Dodge_right_RM","Dodge_right","Driving","Farm_Harvest","Farm_PlantSeed","Farm_Watering","Fighting Idle","Fighting Left Jab","Fighting Right Jab","Fixing_Kneeling","Flying Forward Super","Flying Forward","Glide","Greeting","Head Nod","Hit_Chest","Hit_Head","Hit_Knockback_RM","Hit_Knockback","Idle Hurt","Idle Listening","Idle_A","Idle_FoldArms","Idle_Lantern","Idle_Rail_Call","Idle_Rail","Idle_ShakeOff","Idle_Shield_Break","Idle_Shield","Idle_Subtle","Idle_Sword","Idle_Talking","Idle_TalkingPhone","Idle_Torch","Interact","Jog","Jump_2_RM","Jump_2","Jump_air","Jump_Land","Jump_Start","Jumping Jacks","Kneeling Tired","Ladder_Idle","Land_Three_Point","LayToIdle","Ledge Hang","Levitate Entrance","Levitate Idle","Meditate","Melee_Hook_Rec","Melee_Hook","NinjaJump_Idle","NinjaJump_Land","NinjaJump_Start","OverhandThrow","PickUp_Table","Pipe Climb","Pistol_Aim_Down","Pistol_Aim_Neutral","Pistol_Aim_Up","Pistol_Idle","Pistol_Reload","Pistol_Shoot","Power Up","Punch_Cross","Punch_Jab","Push","Pushup","Reject","Rest Pose","Roll_RM","Roll","Run Jump","Run_Anime","Run_Female","Run_Stealth","Shield_Dash_RM","Shield_OneShot","Shivering","Sitting_Enter","Sitting_Exit","Sitting_Idle","Sitting_Talking","Sleeping","Slide_Exit","Slide_Start","Slide","Spell_Simple_Enter","Spell_Simple_Exit","Spell_Simple_Idle","Spell_Simple_Shoot","Sprint","Strafe_left","Strafe_right","Swim_Fwd","Swim_Idle","Sword_Attack_Air_Vertical","Sword_Attack_RM","Sword_Attack","Sword_Block","Sword_Dash_RM","Sword_Regular_A_Rec","Sword_Regular_A","Sword_Regular_B_Rec","Sword_Regular_B","Sword_Regular_C_RM","Sword_Regular_C","Sword_Regular_Combo","Throw Object","Tired Hunched","Two-hand Blast","Victory Fist Pump","Victory","Walk_Backwards","Walk_Carry","Walk_Female","Walk_Formal","Walk_Large","Walk_Stealth","Walk","Yes","Zombie Yell","Zombie_Idle_Crouch","Zombie_Idle","Zombie_Rise","Zombie_Scratch","Zombie_Walk_2","Zombie_Walk"],fox:["Bark","Bite","Death","Fall","Fetch","Howl","Idle Alert","Idle","Jump","Rest Pose","Run","Sit","Sneak","Walk"],bird:["Flap","Glide","Idle","Rest Pose","Walk"],dragon:["Fly Flap","Fly Glide","Idle","Rest Pose","Walk"],kaiju:["Attack","Death","Hit","Idle","Rest Pose","Roar","Swim","Tail Attack","Walk RM","Walk"],shark:["Bite","Dead Floating","Hit","Idle","Rest Pose","Swim Horizontal","Swim Vertical"],snake:["Bite","Coiled","Dance","Death","Hit","Idle","Rest Pose","Side winding"],spider:["Attack","Bite","Death 2","Death","Eating","Hit","Idle","Jump","Rest Pose","Walk"]};function Y(c){return(c||"").toLowerCase().replace(/\.(glb|fbx|mp4)$/i,"").replace(/[\s_\-.]+/g,"")}const q=new Map;function G(c,...t){const e=function fe(c){const t=(c||"").toLowerCase(),e=q.get(t);if(void 0!==e)return e;const i=new Map,n=ue[t]??[];for(const s of n)i.set(Y(s),s);return q.set(t,i),i}(c);if(0===e.size)return null;for(const i of t){if(null==i||""===i)continue;const n=e.get(Y(i));if(void 0!==n){const s="dark_"+n+".mp4";return"assets/animate/animpreviews/"+encodeURIComponent(c.toLowerCase())+"/"+encodeURIComponent(s)}}return null}class ge{constructor(t="",e,i,n){this.name=t,this.position=e,this.rotation=i,this.scale=n}}class we{constructor(t,e){this.vertex_positions=[],this.vertex_indices=[],this.vertex_positions=t,this.vertex_indices=e}}let E=(()=>{class c{static{this.viewport_rect_provider=null}static distance_between_objects(e,i){const n=new a.Pq0,s=new a.Pq0;return e.getWorldPosition(n),i.getWorldPosition(s),n.distanceTo(s)}static world_position_from_object(e){const i=new a.Pq0;return e.getWorldPosition(i)}static direction_between_points(e,i){const n=new a.Pq0;return n.subVectors(i,e).normalize(),n}static is_point_in_box(e,i){i.updateMatrixWorld();const n=i.worldToLocal(e.clone());return null===i.geometry.boundingBox?(console.warn("is_point_in_box() - box_mesh does not have a bounding box",i),!1):i.geometry.boundingBox.containsPoint(n)}static remove_object_array(e){e.traverse(i=>{if(i instanceof a.eaF){i.geometry.dispose();for(const n in i.material){const s=i.material[n];s&&"function"==typeof s.dispose&&s.dispose()}e.remove(e)}})}static remove_object_with_children(e){e.children.length>
10&&e.children.forEach(i=>{this.remove_object_with_children(i)}),e instanceof a.eaF&&(null!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&(Array.isArray(e.material)?e.material.forEach(i=>{i.map&&i.map.dispose(),i.dispose()}):(e.material.map&&e.material.map.dispose(),e.material.dispose()))),null!=e.parent&&e.parent.remove(e),e.removeFromParent()}static is_leaf_bone(e){if(e.children.length>0)return!1;const i=e.name.toLowerCase();return i.includes("leaf")||i.includes("tip")}static bone_list_from_hierarchy(e){if(null==e)return console.warn("bone_hierarchy is undefined or null"),[];const i=[];return e.traverse(n=>{n instanceof a.$Kf&&i.push(n)}),i}static intersection_points_between_positions_and_mesh(e,i){const n=[],s=[],o=e.array.length/3;for(let r=0;r<o;r++){const l=(new a.Pq0).fromBufferAttribute(e,r);c.is_point_in_box(l,i)&&(n.push(l),s.push(r))}return new we(n,s)}static normalized_mouse_position(e){const i=new a.I9Y,n=c.viewport_rect_provider?.(),s=n?.left??0,o=n?.top??0,r=n?.width??window.innerWidth,l=n?.height??window.innerHeight;return i.x=(e.clientX-s)/r*2-1,i.y=-(e.clientY-o)/l*2+1,i}static regenerate_debugging_scene(e){const i="Skinning Debug Container",n=e.getObjectByName(i);void 0!==n&&(this.remove_object_array(n),n.clear(),e.remove(n));const s=new a.YJl;return s.name=i,e.add(s),s}static store_bone_transforms(e){const i=[];return e.bones.forEach(n=>{const s=(new a.Pq0).setFromEuler(n.rotation),o=new ge(n.name,n.position.clone(),s,n.scale.clone());i.push(o)}),i}static restore_bone_transforms(e,i){i.forEach(n=>{const s=e.bones.find(o=>o.name===n.name)??null;if(null!==s){s.position.copy(n.position);const o=new a.O9p;o.setFromVector3(n.rotation),s.rotation.copy(o),s.scale.copy(n.scale)}})}static calculate_bone_base_name(e){let i=e.toLowerCase().replace(/(_r|_l|_right|_left)$/,"");return i=i.replace(/^(r_|l_|right_|left_)/,""),i}static raycast_closest_bone_test(e,i,n){(new a.tBo).setFromCamera(c.normalized_mouse_position(i),e);const o=c.normalized_mouse_position(i);let r=null,l=0,_=1/0;return n.bones.forEach((p,m)=>{const w=c.world_position_from_object(p).clone().project(e),v=o.distanceTo(new a.I9Y(w.x,w.y));v<_&&(r=p,_=v,l=m)}),[r,l,_]}static scale_armature_by_scalar(e,i){e.traverse(n=>{"Bone"===n.type&&n.position.multiplyScalar(i)})}static clean_bone_name_for_messaging(e){return e.replace("mixamorig_","")}static find_closest_bone_index_from_vertex_index(e,i,n){const s=(new a.Pq0).fromBufferAttribute(i.attributes.position,e);let o=1e4,r=0;return n.forEach((l,_)=>{let h=c.world_position_from_object(l.bone_object).distanceTo(s);if(l.has_child_bone){const m=c.world_position_from_object(l.bone_object.children[0]),v=c.world_position_from_object(l.bone_object).add(m).divideScalar(2).distanceTo(s);v<o&&(h=v)}h<o&&(o=h,r=_)}),r}static parse_input_number(e){if(null==e||""===(e=e.trim()))return 0;const i=parseFloat(e);return"number"==typeof i&&isFinite(i)?i:0}static enum_from_value(e,i){const n=Object.keys(i).find(s=>i[s]===e);return void 0===n?void 0:i[n]}}return c})();class x{static create_material(t=!0,e=65280){const i=new a.tXL({color:e,wireframe:t});return i.side=a.$EB,i.specular.setScalar(0),i.shininess=0,i}static get_contributors_list(){return'\n    <span style="text-align: left;">\n    <ul>\n      <li>Scott Petrovic: Project Maintainer</li>\n      <li>Quaternius: Base human model, rig, and animations. <a href="http://quaternius.com/" target="_blank" rel="noopener noreferrer">quaternius.com</a></li>\n      <li>Sketchpunklab: Provided algorithm to help retarget human rigs for animations. <a target="_blank" href="https://x.com/SketchpunkLabs">See social media account</a></li>\n      <li>Lino Emmenegger (oni-swr) - Adding custom animation importer.</li>\n      <li>Marino - Added improved move functionality when importing model.</li>\n      <li>Three.js Contributors: For the amazing Three.js library. <a href="https://threejs.org/" target="_blank" rel="noopener noreferrer">threejs.org</a></li>\n    </ul>\n\n      <p style="margin-top: 1rem;">Check out the <a href="https://github.com/Mesh2Motion" target="_blank">
1project\'s guide</a> for instructions on contributing.\n      </p>\n      <p>\n        Ask questions or provide feedback  <a href="https://discord.gg/UChE936q7y" target="_blank" rel="noopener noreferrer"> on the Discord Server</a>\n      </p> \n     \n\n    </span>\n    '}static get_learning_resources_html(){return'\n      <p> \n        <a href="https://www.youtube.com/@Mesh2Motion_App" target="_blank" rel="noopener noreferrer">Visit YouTube Channel</a> - Tutorials and demos of the app.\n      </p> \n\n      <p>\n        <a href="https://discord.gg/UChE936q7y" target="_blank" rel="noopener noreferrer"> Visit Discord Server</a>  - Ask questions or provide feedback  \n      </p> \n    '}static create_grid_helper(t=1118549,e=5131898){const s=new a.bdM(180,180,100,100),o=new a.tXL({color:e,wireframe:!1,transparent:!0,opacity:.7,shininess:0,specular:0});o.side=a.hB5;const r=new a.eaF(s,o);r.name="Floor Mesh",r.rotation.x=-Math.PI/2,r.position.y=-.01,r.receiveShadow=!0,r.renderOrder=-1;const l=new a.IzY(.3);return l.name="Axes Helper",l.position.copy(new a.Pq0(0,.008,0)),[new a.fTw(180,100,t,t),r,l]}static create_bone_hierarchy(){const t=new a.$Kf;t.name="rootBone";const e=new a.$Kf;e.name="childBone";const i=new a.$Kf;i.name="grandchildBone";const n=new a.$Kf;return n.name="greatGrandchildBone",t.add(e),e.add(i),i.add(n),t.position.y=-.8,e.position.y=.5,i.position.y=.5,n.position.y=.5,t}static create_skeleton(t){const e=E.bone_list_from_hierarchy(t);return new a.EAD(e)}static create_x_markers(t,e=.1,i=16711680,n=""){const s=new a.YJl;s.name=`X markers: ${n}`;const o=new a.mrM({color:i,depthTest:!1});return t.forEach(r=>{const l=(new a.LoY).setFromPoints([new a.Pq0(r.x-e,r.y-e,r.z),new a.Pq0(r.x+e,r.y+e,r.z)]),_=new a.N1A(l,o),h=(new a.LoY).setFromPoints([new a.Pq0(r.x-e,r.y+e,r.z),new a.Pq0(r.x+e,r.y-e,r.z)]),p=new a.N1A(h,o);s.add(_),s.add(p)}),s}static create_spheres_for_points(t,e=65535,i=""){const s=new a.YJl;s.name=`Point display: ${i}`;const o=new a.Gu$(.006,10,10),r=new a.V9B({color:e,depthTest:!1});return t.forEach(l=>{const _=new a.eaF(o,r);_.position.copy(l),s.add(_)}),s}static create_test_plane_mesh(t=.08,e=255){const r=new a.bdM(t,t,2,2),l=x.create_material(!1,e),_=new a.eaF(r,l);return _.name="Plane Intersection Mesh",_}static create_default_lights(t){const i=new a.ZyN(7829367,t);i.castShadow=!0,i.shadow.mapSize=new a.I9Y(2048,2048),i.shadow.bias=-1e-4,i.position.set(-2,2,2);const n=new a.$p8(16777215,1.2),s=new a.ZyN(7829367,.5*t);return s.castShadow=!1,s.position.set(2,2,-2),[i,n,s]}static create_camera(){const e=new a.ubm(15,window.innerWidth/window.innerHeight,.1,1e4);return e.position.z=10,e.position.y=5,e.position.x=5,e}static create_equidistant_spheres_around_circle(t=6,e=65280,i=.3){const n=[],s=new a.Gu$(.03,12,12),o=x.create_material(!0,e);for(let r=0;r<t;r++){const l=r/t*(2*Math.PI),_=Math.cos(l)*i,h=Math.sin(l)*i,p=0,m=new a.eaF(s,o);m.position.set(_,h,p),n.push(m)}return n}static create_window_resize_listener(t,e){window.addEventListener("resize",()=>{t.setSize(window.innerWidth-2,window.innerHeight-2),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix()})}static create_bone_plane_mesh(t,e,i){const n=x.create_test_plane_mesh(.02);n.position.copy(E.world_position_from_object(t)),n.lookAt(E.world_position_from_object(e)),n.translateZ(.5*E.distance_between_objects(t,e));const s=new a.Gu$(.002,3,3),o=x.create_material(!0,65535);for(let r=0;r<i;r++){const _=r/i*(2*Math.PI),h=.005*Math.cos(_),p=.005*Math.sin(_),m=0,u=new a.eaF(s,o);u.name="Point mesh PLANE",u.position.set(h,p,m),n.add(u)}return n}static create_wireframe_mesh_from_geometry(t){const e=new a.V9B({color:3373994,wireframe:!0,opacity:.2,transparent:!0}),i=t.clone();return new a.eaF(i,e)}static create_weight_painted_mesh(t,e){const i=e.clone(),n=i.attributes.position.array.length/3,s=x.generate_deterministic_bone_colors(120),o=new Float32Array(3*n);for(let l=0;l<n;l++){const _=t[4*l];let h=s[_];(null==h||void 0===h)&&(console.warn(`No color found for bone index ${_}. Using default color. Code needs to increase the number of bone colors generated}`),h=new a.Pq0(1,1,1)),o[3*l]=h.x,o[3*l+1]=h.y,o[3*l+2]=h.z}i.setAttribute("color",new a.THS(o,3));const r=new a.V9B({vertexColors:!0,wireframe:!1,opacity:1,transparent:!1});return new a.eaF(i,r)}static generate_deterministic_bone_colors(t){let e=.2,i=.5,n=.8;const o=[],r=[-.1,.1,.3];for(let l=0;l<t;l++)e=(e+r[0]+1)%1,i=(i+r[1]+1)%1,n=(n+r[2]+1)%1,o.push(new a.Pq0(.8*e,.8*i,.8*n));return o}}class S{static calculate_bounding_box(t){let e=new a.NRn;return t.traverse(i=>{const n=(new a.NRn).setFromObject(i);(n.max.x-n.min.x>e.max.x-e.min.x||n.max.y-n.min.y>e.max.y-e.min.y||n.max.z-n.min.z>e.max.z-e.min.z)&&(e=n)}),e}static scale_model_on_import_if_extreme(t){let e=1;const i=this.calculate_bounding_box(t),r=Math.max(i.max.y-i.min.y,i.max.x-i.min.x,i.max.z-i.min.z);r>.5&&r<20?console.log("Model a reasonable size, so no scaling applied: ",i," units is bounding box"):(console.log("Model is very large or small, so scaling applied: ",i," units is bounding box"),e=1.5/r,t.traverse(l=>{const _=l;_.geometry&&(console.log("Scaling mesh:",_," by factor of ",e),_.geometry.scale(e,e,e),_.geometry.computeBoundingBox(),_.geometry.computeBoundingSphere())}))}static move_model_to_floor(t){let e=1/0;t.traverse(i=>{if("Mesh"===i.type){const n=i,s=(new a.NRn).setFromObject(n);s.min.y<e&&(e=s.min.y)}}
1),isFinite(e)&&0!==e&&t.traverse(i=>{if("Mesh"===i.type){const n=i;n.geometry.translate(0,-1*e,0),n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere()}})}static translate_model_vertices(t,e,i,n){t.traverse(s=>{if("Mesh"===s.type){const o=s;o.geometry.translate(e,i,n),o.geometry.computeBoundingBox(),o.geometry.computeBoundingSphere()}})}static strip_out_all_unecessary_model_data(t,e,i){const n=new a.Z58;return n.name=e,t.traverse(s=>{let o,r;"SkinnedMesh"===s.type?(o=new a.eaF(s.geometry,s.material),o.name=s.name,n.add(o)):"Mesh"===s.type&&(o=s.clone(),o.name=s.name,n.add(o)),i&&void 0!==o&&(r=new a.tXL,r.side=0,r.color.set(43758),o.material=r)}),n}static strip_out_retargeting_model_data(t){const e=new a.Z58;e.name="Filtered Retargeting Data";const i=[];return t.traverse(n=>{"SkinnedMesh"===n.type&&i.push(n)}),i.forEach(n=>{const s=n.clone();e.add(s)}),e}}class W{static apply_skeleton_scale_to_position_keyframes(t,e){t.forEach(i=>{i.tracks.forEach(n=>{if(n.name.includes(".position")){const s=n.values;for(let o=0;o<s.length;o+=3)s[o]*=e,s[o+1]*=e,s[o+2]*=e}})})}static deep_clone_animation_clip(t){const e=t.tracks.map(i=>i.clone());return new a.tz3(t.name,t.duration,e)}static deep_clone_animation_clips(t){return t.map(e=>this.deep_clone_animation_clip(e))}static clean_track_data(t,e){t.forEach(i=>{let n=[];const s=i.name.toLowerCase().endsWith("rm"),o=R.by_skeleton_type(e)?.position_tracking_bone_name;n=i.tracks.filter(s?r=>r.name.includes("quaternion")||r.name.toLowerCase().includes(o+".position")||r.name.toLowerCase().includes("root.position"):r=>r.name.includes("quaternion")||r.name.toLowerCase().includes(o+".position")),i.tracks=n})}static apply_arm_extension_warp(t,e){t.forEach(i=>{i.display_animation_clip.tracks.forEach(n=>{if(!n.name.includes("quaternion"))return;const s=n,o=s.name.includes("upperarm_l"),r=s.name.includes("upperarm_r");if(o||r){const l=s.values.slice(),_=s.times.length;for(let h=0;h<_;h++){const m=new a.PTz;o&&m.setFromAxisAngle(new a.Pq0(0,0,-1),e/100),r&&m.setFromAxisAngle(new a.Pq0(0,0,1),e/100);const u=new a.PTz(l[4*h+0],l[4*h+1],l[4*h+2],l[4*h+3]);u.multiply(m),l[4*h+0]=u.x,l[4*h+1]=u.y,l[4*h+2]=u.z,l[4*h+3]=u.w}n.values=l}})})}static apply_animation_mirroring(t){t.forEach(e=>{const i=e.display_animation_clip.tracks,n=e.display_animation_clip.name,s=[];for(let o=0;o<i.length;o++){const l=i[o].name;if(l.toLowerCase().endsWith("_l.quaternion")){const _=l.replace(/_l\.quaternion$/,"_r.quaternion"),h=i.findIndex(p=>p.name.toLowerCase()===_);-1!==h&&s.push({leftIndex:o,rightIndex:h,clipDetails:n+":"+l})}}s.forEach(({leftIndex:o,rightIndex:r})=>{const _=i[o],h=i[r],p=_.values.slice(),m=h.values.slice(),u=_.times.slice(),w=h.times.slice(),v=this.mirror_quaternion_track_values(p),D=this.mirror_quaternion_track_values(m);_.values=D,_.times=w,h.values=v,h.times=u})}),this.apply_center_bone_mirroring(t),this.apply_hips_position_mirroring(t)}static mirror_quaternion_track_values(t){const e=t.slice();for(let n=0;n<t.length;n+=4){const s=new a.PTz(t[n],t[n+1],t[n+2],t[n+3]);s.x=-s.x,s.w=-s.w,e[n]=s.x,e[n+1]=s.y,e[n+2]=s.z,e[n+3]=s.w}return e}static apply_center_bone_mirroring(t){t.forEach(e=>{e.display_animation_clip.tracks.forEach(n=>{const s=n.name.toLowerCase();if(n.name.includes("quaternion")){if(!(s.includes("spine")||s.includes("hips")||s.includes("pelvis")||s.includes("neck")||s.includes("head")||s.includes("torso")||s.includes("chest")))return;const r=n.values,l=4;for(let _=0;_<r.length;_+=l){const h=new a.PTz(r[_],r[_+1],r[_+2],r[_+3]);h.y=-h.y,h.z=-h.z,r[_]=h.x,r[_+1]=h.y,r[_+2]=h.z,r[_+3]=h.w}}})})}static apply_hips_position_mirroring(t){t.forEach(e=>{e.display_animation_clip.tracks.forEach(n=>{const s=n.name.toLowerCase();if(n.name.includes("position")&&(s.includes("hips")||s.includes("pelvis"))){const o=n.values,r=3;for(let l=0;l<o.length;l+=r)o[l]=-o[l]}})})}}const H="assets/animate/",be=H+"animations/";class Pe{constructor(t){this.canvas=t,this.scene=new a.Z58,this.clock=new a.zD7,this.gltf_loader=new K.B,this.model_root=new a.YJl,this.view_clip_cache=new Map,this.view_clip_url=null,this.default_cache=new Map,this.active_default_species=b.Y.None,this.default_preview_on=!1,this.stage="empty",this.pending_yaw=0,this.raf_handle=0,this.disposed=!1,this.viewport_rect_provider=null,this.on_stage_change=()=>{},this.on_resize=()=>{},this.canvas_was_degenerate=!0,this.handle_resize=()=>{this.resize_to_canvas()},this.animate=()=>{if(this.disposed)return;this.raf_handle=requestAnimationFrame(this.animate);const l=this.clock.getDelta();this.view_mixer&&this.view_mixer.update(l),this.default_mixer&&this.default_mixer.update(l),this.result_mixer&&this.result_mixer.update(l),this.controls.update(),this.renderer.render(this.scene,this.camera)},this.renderer=new Z.JeP({canvas:t,antialias:!0,alpha:!0}),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2));const{width:e,height:i}=this.canvas_size();this.renderer.setSize(e,i,!1),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=a.Wk7,this.scene.background=null,this.camera=new a.ubm(35,e/i,.05,1e3),this.camera.position.set(1.6,1.35,2.6),this.controls=new X(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.dampingFactor=.08,this.controls.target.set(0,.8,0),x.create_default_lights(2.2).forEach(l=>this.scene.add(l));const[s,o,r]=x.create_grid_helper(2761552,1709872);this.scene.add(s,o,r),this.scene.add(this.model_root),this.viewport_rect_provider=()=>{const l=this.canvas.getBoundingClientRect();return{left:l.left,top:l.top,width:l.width||1,height:l.height||1}},E.viewport_rect_provider=this.viewport_rect_provider,window.addEventListener("resize",this.handle_resize),typeof ResizeObserver<"u"&&(this.resize_observer=new ResizeObserver(()=>this.handle_resize()),this.resize_observer.observe(this.canvas)),this.set_stage("empty"),this.animate()}canvas_size(){const t=this.canvas.getBoundingClientRect();return{width:Math.max(1,Math.round(t.width||this.canvas.clientWidth||window.innerWidth)),height:Math.max(1,Math.round(t.height||this.canvas.clientHeight||window.innerHeight))}}get_stage(){return this.stage}set_stage(t){this.stage=t,this.on_stage_change(t)}
1load_model(t,e){var i=this;return(0,k.A)(function*(n,s,o={}){i.set_stage("loading");const r=yield i.gltf_loader.loadAsync(n);r.scene.updateMatrixWorld(!0),i.clear_group(i.model_root),r.scene.traverse(h=>{const p=h;if(("Mesh"===h.type||"SkinnedMesh"===h.type)&&p.geometry){const m=p.geometry.clone();m.applyMatrix4(h.matrixWorld);const w=new a.eaF(m,p.material);w.name=h.name||"Model Mesh",w.castShadow=!0,w.receiveShadow=!0,i.model_root.add(w)}}),i.model_root.rotation.set(0,0,0),i.model_root.position.set(0,0,0),S.scale_model_on_import_if_extreme(i.model_root),S.move_model_to_floor(i.model_root),i.center_model_on_xz();const l=i.model_height();i.controls.target.set(0,.5*l,0),i.camera.position.set(1.1*l,.9*l,1.7*l),i.controls.update();const _=null!=s;return i.pending_yaw=_?s:0,i.model_root.rotation.y=i.pending_yaw,o.pause_after_load&&(o.animated||o.external_clips)&&(r.animations.length>0||o.external_clips)&&i.setup_animated_view(r.scene,r.animations[0]),i.set_stage("view"),{auto_faced:_}}).apply(this,arguments)}setup_animated_view(t,e){const i=new a.YJl;i.name="Animated View",i.add(t),this.scene.add(i),i.updateMatrixWorld(!0);let n=S.calculate_bounding_box(i);const s=Math.max(.001,n.max.y-n.min.y),o=this.model_height()/s;i.scale.setScalar(o),i.updateMatrixWorld(!0),n=S.calculate_bounding_box(i),i.position.set(-(n.max.x+n.min.x)/2,-n.min.y,-(n.max.z+n.min.z)/2),i.rotation.y=this.pending_yaw,i.updateMatrixWorld(!0),this.view_anim_group=i,this.view_subject=t,this.view_mixer=new a.Iw4(t),void 0!==e&&(this.view_action=this.view_mixer.clipAction(e),this.view_action.reset(),this.view_action.play()),this.model_root.visible=!1}has_view_animation(){return void 0!==this.view_action}can_play_view_clips(){return void 0!==this.view_subject}current_view_clip(){return this.view_clip_url}has_view_clip(t){return this.view_clip_cache.has(t)}play_view_clip(t){var e=this;return(0,k.A)(function*(i,n={}){if(!i||void 0===e.view_mixer||void 0===e.view_subject)return null;let s=e.view_clip_cache.get(i);if(void 0===s){const _=yield e.gltf_loader.loadAsync(i);if(e.disposed)return null;const h=_.animations?.[0];if(void 0===h)return null;s=h,e.view_clip_cache.set(i,s)}if(e.view_clip_url===i&&void 0!==e.view_action)return e.view_action.paused=!1,s.name;const o=e.view_mixer.clipAction(s);o.reset(),o.enabled=!0,o.paused=!1;const r=n.fade??.25,l=e.view_action;return void 0!==l&&l!==o&&r>0?(o.play(),l.crossFadeTo(o,r,!1)):(void 0!==l&&l!==o&&l.stop(),o.play()),e.view_action=o,e.view_clip_url=i,s.name}).apply(this,arguments)}set_view_playing(t){this.view_action&&(this.view_action.paused=!t)}release_viewport_rect_provider(){E.viewport_rect_provider===this.viewport_rect_provider&&(E.viewport_rect_provider=null),this.viewport_rect_provider=null}teardown_animated_view(){this.view_action&&(this.view_action.stop(),this.view_action=void 0),this.view_mixer&&(this.view_mixer.stopAllAction(),void 0!==this.view_subject&&this.view_mixer.uncacheRoot(this.view_subject),this.view_mixer=void 0),this.view_anim_group&&(this.scene.remove(this.view_anim_group),this.view_anim_group.traverse(t=>{t.geometry&&t.geometry.dispose()}),this.view_anim_group=void 0),this.view_subject=void 0,this.view_clip_cache.clear(),this.view_clip_url=null}show_result_glb(t){var e=this;return(0,k.A)(function*(i,n={}){const s=yield e.gltf_loader.loadAsync(i);s.scene.updateMatrixWorld(!0),e.teardown_result();const o=new a.YJl;o.name="Auto-rig Result",o.add(s.scene),e.scene.add(o),o.updateMatrixWorld(!0);let r=(new a.NRn).setFromObject(o);const l=Math.max(.001,r.max.y-r.min.y);if(o.scale.setScalar(e.model_height()/l),o.updateMatrixWorld(!0),r=(new a.NRn).setFromObject(o),o.position.set(-(r.max.x+r.min.x)/2,-r.min.y,-(r.max.z+r.min.z)/2),o.updateMatrixWorld(!0),e.result_group=o,e.model_root.visible=!1,void 0!==e.view_anim_group&&(e.view_anim_group.visible=!1),e.controls.enabled=!0,!1!==n.frame)e.frame_object(o);else{const _=(new a.NRn).setFromObject(o);if(!_.isEmpty()){const h=new a.Pq0;_.getCenter(h),e.controls.target.copy(h),e.controls.update()}}!0===n.autoplay&&s.animations.length>0&&(e.result_mixer=new a.Iw4(s.scene),e.result_action=e.result_mixer.clipAction(s.animations[0]),e.result_action.reset(),e.result_action.play())}).apply(this,arguments)}enter_rigged_stage(){this.controls.enabled=!0,this.set_stage("rigged")}set_result_playing(t){this.result_action&&(this.result_action.paused=!t)}teardown_result(){this.result_action&&(this.result_action.stop(),this.result_action=void 0),this.result_mixer&&(this.result_mixer.stopAllAction(),this.result_mixer=void 0),this.result_group&&(this.scene.remove(this.result_group),this.result_group.traverse(t=>{t.geometry&&t.geometry.dispose()}),this.result_group=void 0)}rig_options(){return R.all.map(t=>({key:t.skeleton_type,label:t.rig_display_name,reference_image:H+t.skeleton_template_image_url}))}resolve_species(t){const e=(t||"").trim().toLowerCase();if(""===e)return b.Y.Human;const i=Object.values(b.Y).find(s=>s===e);return void 0!==i?i:R.all.find(s=>
1s.animation_preview_folder.toLowerCase()===e||s.rig_display_name.toLowerCase()===e)?.skeleton_type??b.Y.Human}is_default_preview_active(){return this.default_preview_on}get_default_preview_species(){return this.active_default_species}build_default_subject(t){var e=this;return(0,k.A)(function*(){const i=e.default_cache.get(t);if(void 0!==i)return i;const n=R.get_animation_file_paths(t);if(0===n.length)throw new Error(`No animation files for species ${t}`);const s=new a.YJl;s.name=`Default Preview (${t})`;const o=[];for(let u=0;u<n.length;u++){const w=yield e.gltf_loader.loadAsync(be+n[u]);0===u&&(w.scene.traverse(v=>{const D=v;("Mesh"===v.type||"SkinnedMesh"===v.type)&&(D.castShadow=!0,D.receiveShadow=!0)}),s.add(w.scene)),Array.isArray(w.animations)&&o.push(...w.animations)}s.updateMatrixWorld(!0);const r=S.calculate_bounding_box(s);s.position.set(-(r.max.x+r.min.x)/2,-r.min.y,-(r.max.z+r.min.z)/2),s.visible=!1,e.scene.add(s);const h=W.deep_clone_animation_clips(o);W.clean_track_data(h,t),h.sort((u,w)=>u.name.localeCompare(w.name));const m={group:s,clips:h.map(u=>({original_animation_clip:u,display_animation_clip:u,metadata:{source_type:"default-library",tags:[]}}))};return e.default_cache.set(t,m),m})()}load_default_library(t){var e=this;return(0,k.A)(function*(){const i=yield e.build_default_subject(t);return e.default_clip_list(t,i.clips)})()}play_default_clip(t,e){var i=this;return(0,k.A)(function*(){const n=yield i.build_default_subject(t);if(void 0===n.clips[e])return;const s=i.active_default_group!==n.group,o=i.default_preview_on;void 0!==i.active_default_group&&i.active_default_group!==n.group&&(i.active_default_group.visible=!1),i.active_default_group=n.group,i.active_default_species=t,i.enter_default_preview_visuals(),(s||!o)&&i.frame_default_subject(),void 0!==i.default_mixer&&i.default_mixer.stopAllAction(),i.default_mixer=new a.Iw4(n.group),i.default_action=i.default_mixer.clipAction(n.clips[e].display_animation_clip),i.default_action.reset(),i.default_action.play()})()}frame_default_subject(){void 0!==this.active_default_group&&this.frame_object(this.active_default_group)}recenter_view(){this.frame_object(this.default_preview_on&&void 0!==this.active_default_group?this.active_default_group:this.model_root)}frame_fit_padding(){const{height:t}=this.canvas_size();return t>=560?3:Math.min(3,Math.max(1.6,t/240))}frame_object(t){t.updateWorldMatrix(!0,!0);const e=(new a.NRn).setFromObject(t);if(e.isEmpty())return;const i=new a.Pq0;e.getSize(i);const n=new a.Pq0;e.getCenter(n);const s=Math.max(i.x,i.y,i.z,.1),o=this.camera.fov*Math.PI/180,r=Math.max(.2,this.camera.aspect),l=2*Math.atan(Math.tan(o/2)*r),_=s/2/Math.tan(o/2),h=s/2/Math.tan(l/2),p=Math.max(_,h)*this.frame_fit_padding();this.controls.target.copy(n),this.camera.position.set(n.x,n.y+.1*i.y,n.z+p),this.camera.near=Math.max(.01,p/100),this.camera.far=100*p,this.camera.updateProjectionMatrix(),this.controls.update()}pause_default(){this.default_action&&(this.default_action.paused=!0)}resume_default(){this.default_action&&(this.default_action.paused=!1)}set_default_speed(t){this.default_mixer&&(this.default_mixer.timeScale=t)}default_clip_list(t,e){const i=R.by_key(t)?.animation_preview_folder??"";return e.map((n,s)=>{const o=n.display_animation_clip.name;return{index:s,name:o,preview:i?G(i,o):null}})}enter_default_preview_visuals(){this.default_preview_on=!0,this.model_root.visible=!1,void 0!==this.view_anim_group&&(this.view_anim_group.visible=!1),void 0!==this.active_default_group&&(this.active_default_group.visible=!0)}exit_default_preview(){this.default_preview_on&&(this.default_preview_on=!1,void 0!==this.default_action&&(this.default_action.stop(),this.default_action=void 0),void 0!==this.default_mixer&&(this.default_mixer.stopAllAction(),this.default_mixer=void 0),void 0!==this.active_default_group&&(this.active_default_group.visible=!1),void 0!==this.view_anim_group&&"view"===this.stage?(this.view_anim_group.visible=!0,this.model_root.visible=!1):this.model_root.visible=!0)}return_to_view(){this.exit_default_preview(),this.controls.enabled=!0,void 0!==this.view_anim_group?(this.view_anim_group.visible=!0,this.model_root.visible=!1,this.set_view_playing(!0)):this.model_root.visible=!0,this.set_stage("view")}
1center_model_on_xz(){this.center_group_on_xz(this.model_root)}center_group_on_xz(t){const e=S.calculate_bounding_box(t),i=(e.max.x+e.min.x)/2,n=(e.max.z+e.min.z)/2;(Math.abs(i)>1e-4||Math.abs(n)>1e-4)&&S.translate_model_vertices(t,-i,0,-n)}model_height(){const t=S.calculate_bounding_box(this.model_root);return Math.max(.1,t.max.y-t.min.y)}clear_group(t){for(;t.children.length>0;){const e=t.children[0];t.remove(e),e.geometry&&e.geometry.dispose()}}resize_to_canvas(){const{width:t,height:e}=this.canvas_size();this.renderer.setSize(t,e,!1),this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),t<=50||e<=50?this.canvas_was_degenerate=!0:this.canvas_was_degenerate&&(this.canvas_was_degenerate=!1,this.recenter_view())}dispose(){this.disposed=!0,this.raf_handle&&cancelAnimationFrame(this.raf_handle),this.resize_observer?.disconnect(),this.resize_observer=void 0,this.release_viewport_rect_provider(),window.removeEventListener("resize",this.handle_resize),this.controls.dispose(),this.teardown_animated_view(),this.teardown_result(),void 0!==this.default_mixer&&(this.default_mixer.stopAllAction(),this.default_mixer=void 0),this.default_cache.forEach(({group:t})=>{this.scene.remove(t),t.traverse(e=>{e.geometry&&e.geometry.dispose()})}),this.default_cache.clear(),this.active_default_group=void 0,this.clear_group(this.model_root),this.renderer.dispose()}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.