t2-mapper/docs/_next/static/chunks/41fb9d5ac0e14608.js

1 line
No EOL
23 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29055,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(15080),i=e.i(71753),r=e.i(90072),o=e.i(25645),l=e.i(12979),s=e.i(51434),c=e.i(79123),u=e.i(89887),m=e.i(58647);let d=(0,o.createLogger)("AudioEmitter"),f=new Map,p=new Map;function h(e,t=1){p.set(e,t)}function S(e){p.delete(e)}let g=0;function y(){return g}function T(){for(let[e]of(g++,p)){try{e.stop()}catch{}try{e.disconnect()}catch{}}p.clear()}function I(e,t){let n=t(e),a=n?.filename;if(!a)return null;let i=a.endsWith(".wav")?a:`${a}.wav`,r=n.description,o=null!=r?t(r):void 0,l=o?.is3D??!0,s=o?.isLooping??!1,c=o?.referenceDistance??20;return{filename:i,is3D:l,isLooping:s,refDist:c,maxDist:o?.maxDistance??100,volume:o?.volume??1}}function w(e,t,n,a,i){let o;try{o=(0,l.audioToUrl)(e.filename)}catch{return}let s=m.engineStore.getState().playback.rate,c=g;k(o,n,n=>{if(c===g)try{if(e.is3D&&i){let o=new r.PositionalAudio(t);o.setBuffer(n),o.setDistanceModel("inverse"),o.setRefDistance(e.refDist),o.setMaxDistance(e.maxDist),o.setRolloffFactor(1),o.setVolume(e.volume),o.setPlaybackRate(s),a&&o.position.copy(a),i.add(o),p.set(o,1),o.play(),o.source.onended=()=>{p.delete(o);try{o.disconnect()}catch{}i.remove(o)}}else{let a=new r.Audio(t);a.setBuffer(n),a.setVolume(e.volume),a.setPlaybackRate(s),p.set(a,1),a.play(),a.source.onended=()=>{p.delete(a);try{a.disconnect()}catch{}}}}catch{}})}function k(e,t,n){f.has(e)?n(f.get(e)):t.load(e,t=>{f.set(e,t),n(t)},void 0,t=>{d.error("Audio load error %s: %o",e,t)})}m.engineStore.subscribe(e=>e.playback.rate,e=>{for(let[t,n]of p)try{t.setPlaybackRate(n*e)}catch{}});let A=(0,n.memo)(function({entity:e}){let{debugMode:o}=(0,c.useDebug)(),m=e.audioFileName??"",d=e.audioVolume??1,f=e.audioMinDistance??1,p=e.audioMaxDistance??1,h=e.audioMinLoopGap??0,S=e.audioMaxLoopGap??0,g=e.audioIs3D??!0?1:0,y=e.audioIsLooping??!0,[T,I,w]=e.position??[0,0,0],A=(0,a.useThree)(e=>e.scene),M=(0,a.useThree)(e=>e.camera),{audioLoader:b,audioListener:x}=(0,s.useAudio)(),{audioEnabled:v}=(0,c.useSettings)(),N=(0,n.useRef)(null),R=(0,n.useRef)(null),E=(0,n.useRef)(null),C=(0,n.useRef)(!1),_=(0,n.useRef)(!1),L=(0,n.useRef)(new r.Vector3(T,I,w)),O=(0,n.useRef)(0),D=()=>{null!=R.current&&(clearTimeout(R.current),R.current=null),null!=E.current&&(clearTimeout(E.current),E.current=null)},[P]=(0,n.useState)(()=>Math.random());(0,n.useEffect)(()=>{let e;if(b&&x){if(O.current++,g){let t=new r.PositionalAudio(x);t.position.copy(L.current),t.setDistanceModel("inverse"),t.setRefDistance(f),t.setMaxDistance(p),t.setRolloffFactor(1),t.setVolume(d),e=t,A.add(e)}else(e=new r.Audio(x)).setVolume(d);return N.current=e,()=>{D();try{e.stop()}catch{}try{e.disconnect()}catch{}g&&A.remove(e),N.current=null,C.current=!1,_.current=!1}}},[b,x,g,f,p,d,A]);let j=(e,t)=>{if(y)if(h>0||S>0){let n=Math.max(0,h),a=Math.max(n,S),i=n===a?n:P*(a-n)+n;e.loop=!1;let r=()=>{t===O.current&&(!1===e.isPlaying?R.current=setTimeout(()=>{if(t===O.current)try{e.play(),j(e,t)}catch{}},i):E.current=setTimeout(r,100))};E.current=setTimeout(r,100)}else e.setLoop(!0)},F=(0,n.useEffectEvent)(e=>{if(!b)return;let t=O.current;if(C.current)try{e.isPlaying||(e.play(),j(e,t))}catch{}else{let n;try{n=(0,l.audioToUrl)(m)}catch{return}k(n,b,n=>{if(t===O.current&&!e.buffer){e.setBuffer(n),C.current=!0;try{e.play(),j(e,t)}catch{}}})}});return(0,n.useEffect)(()=>{let e=N.current;e&&!g&&v&&m&&F(e)},[v,g,m,b,x]),(0,i.useFrame)(()=>{let e=N.current;if(!e||!g||!v||!m)return;let t=M.position.distanceTo(L.current),n=_.current,a=t<=p;if(a&&!n)_.current=!0,F(e);else if(!a&&n){_.current=!1,D();try{e.stop()}catch{}}}),(0,n.useEffect)(()=>{let e=N.current;if(e&&!v){D();try{e.stop()}catch{}_.current=!1}},[v]),o?(0,t.jsxs)("mesh",{position:L.current,children:[(0,t.jsx)("sphereGeometry",{args:[f,12,12]}),(0,t.jsx)("meshBasicMaterial",{color:"#00ff00",wireframe:!0,opacity:.05,transparent:!0,toneMapped:!1}),(0,t.jsx)(u.FloatingLabel,{color:"#00ff00",position:[0,f+1,0],children:m})]}):null});e.s(["AudioEmitter",0,A,"audioBufferCache",0,f,"getCachedAudioBuffer",()=>k,"getSoundGeneration",()=>y,"playOneShotSound",()=>w,"resolveAudioProfile",()=>I,"stopAllTrackedSounds",()=>T,"trackSound",()=>h,"untrackSound",()=>S])},9721,e=>{"use strict";var t=e.i(43476),n=e.i(932),a=e.i(71645),i=e.i(71753),r=e.i(90072),o=e.i(82816),l=e.i(85557);class s{states;seqIndexToName;currentStateIndex=0;delayTime=0;lastFireCount=-1;spinTimeScale=0;constructor(e,t){this.states=e,this.seqIndexToName=t,e.length>0&&(this.delayTime=e[0].timeoutValue??0)}get stateIndex(){return this.currentStateIndex}reset(){this.currentStateIndex=0,this.delayTime=this.states.length>0?this.states[0].timeoutValue??0:0,this.lastFireCount=-1}tick(e,t){if(0===this.states.length)return{sequenceName:null,isFiring:!1,spinTimeScale:0,reverse:!1,scaleAnimation:!1,timeoutValue:0,transitioned:!1,soundDataBlockIds:[],stateIndex:-1};let n=this.lastFireCount>=0&&t.fireCount!==this.lastFireCount;this.lastFireCount=t.fireCount;let a=[];if(n){let e=this.states.findIndex(e=>e.fire);if(e>=0&&e!==this.currentStateIndex){this.currentStateIndex=e,this.delayTime=this.states[e].timeoutValue??0;let t=this.states[e].soundDataBlockId;t>=0&&a.push(t)}}this.delayTime-=e;let i=n,r=this.evaluateTickTransitions(t),o=0;for(;r>=0&&o<32;){if(o++,i=!0,r===this.currentStateIndex){this.delayTime=this.states[r].timeoutValue??0;break}let e=this.states[this.currentStateIndex].spin,n=this.delayTime;this.currentStateIndex=r;let l=this.states[r].timeoutValue??0;this.delayTime=l;let s=this.states[r].soundDataBlockId;switch(s>=0&&a.push(s),this.states[r].spin){case 1:this.spinTimeScale=0;break;case 4:this.spinTimeScale=1;break;case 2:3===e&&l>0&&(this.delayTime*=1-n/l);break;case 3:2===e&&l>0&&(this.delayTime*=1-n/l)}r=this.evaluateEntryTransitions(t)}let l=this.states[this.currentStateIndex],s=l.timeoutValue??0;switch(l.spin){case 1:this.spinTimeScale=0;break;case 2:this.spinTimeScale=s>0?Math.max(0,1-this.delayTime/s):1;break;case 4:this.spinTimeScale=1;break;case 3:this.spinTimeScale=s>0?Math.max(0,this.delayTime/s):0}return{sequenceName:this.resolveSequenceName(l),isFiring:l.fire,spinTimeScale:this.spinTimeScale,reverse:!l.direction,scaleAnimation:l.scaleAnimation,timeoutValue:l.timeoutValue??0,transitioned:i,soundDataBlockIds:a,stateIndex:this.currentStateIndex}}evaluateTickTransitions(e){let t=this.states[this.currentStateIndex],n=this.delayTime<=0;if(!(n||!t.waitForTimeout))return -1;let a=this.evaluateConditions(t,e);if(-1!==a)return a;if(n){let e=t.transitionOnTimeout;if(-1!==e)return e}return -1}evaluateEntryTransitions(e){let t=this.states[this.currentStateIndex];return this.evaluateConditions(t,e)}evaluateConditions(e,t){let n=t.loaded?e.transitionOnLoaded:e.transitionOnNotLoaded;if(-1!==n)return n;let a=t.ammo?e.transitionOnAmmo:e.transitionOnNoAmmo;if(-1!==a)return a;let i=t.target?e.transitionOnTarget:e.transitionOnNoTarget;if(-1!==i)return i;let r=t.wet?e.transitionOnWet:e.transitionOnNotWet;if(-1!==r)return r;let o=t.triggerDown?e.transitionOnTriggerDown:e.transitionOnTriggerUp;return -1!==o?o:-1}resolveSequenceName(e){return null==e.sequence||e.sequence<0?null:this.seqIndexToName[e.sequence]??null}}var c=e.i(43595),u=e.i(91907),m=e.i(56893),d=e.i(31999),f=e.i(46325),p=e.i(51434),h=e.i(29055),S=e.i(12979),g=e.i(79123),y=e.i(58647),T=e.i(93784);let I=["root","run","back","side","fall","jet","jump","land"];function w(e,t,n){let a=e.current;if(a){(0,h.untrackSound)(a);try{a.stop()}catch{}try{a.disconnect()}catch{}n?.remove(a),e.current=null,t.current=-1}}function k(e){let s,p,h,S,g,w,k,R,E,C,L,O,D,P,j,F,B,q,V,W,U,$,G,z,Y,K,H=(0,n.c)(70),{entity:Q}=e,J=(0,y.useEngineStoreApi)(),X=Q.shapeName??Q.dataBlock,Z=(0,u.useStaticShape)(X);H[0]!==X?(s=e=>{let t=X?.toLowerCase();return t?e.runtime.sequenceAliases.get(t):void 0},H[0]=X,H[1]=s):s=H[1];let ee=(0,y.useEngineSelector)(s),et=(0,m.useAnisotropy)();H[2]!==et||H[3]!==Z.scene?(k=o.clone(Z.scene),p=(0,l.processShapeScene)(k,void 0,{anisotropy:et}),k.traverse(v),w=new r.AnimationMixer(k),h=null,S=null,g=null,k.traverse(e=>{h||"Mount0"!==e.name||(h=e),S||"Mount1"!==e.name||(S=e),g||"Mount2"!==e.name||(g=e)}),H[2]=et,H[3]=Z.scene,H[4]=p,H[5]=h,H[6]=S,H[7]=g,H[8]=w,H[9]=k):(p=H[4],h=H[5],S=H[6],g=H[7],w=H[8],k=H[9]),H[10]!==p||H[11]!==h||H[12]!==S||H[13]!==g||H[14]!==w||H[15]!==k?(R={clonedScene:k,mixer:w,mount0:h,mount1:S,mount2:g,iflInitializers:p},H[10]=p,H[11]=h,H[12]=S,H[13]=g,H[14]=w,H[15]=k,H[16]=R):R=H[16];let{clonedScene:en,mixer:ea,mount0:ei,mount1:er,mount2:eo,iflInitializers:el}=R;H[17]!==en||H[18]!==ea?(E=()=>()=>{(0,l.disposeClonedScene)(en),ea.uncacheRoot(en)},C=[en,ea],H[17]=en,H[18]=ea,H[19]=E,H[20]=C):(E=H[19],C=H[20]),(0,a.useEffect)(E,C),H[21]===Symbol.for("react.memo_cache_sentinel")?(L=new Map,H[21]=L):L=H[21];let es=(0,a.useRef)(L);H[22]===Symbol.for("react.memo_cache_sentinel")?(O={head:null,headside:null},H[22]=O):O=H[22];let ec=(0,a.useRef)(O);H[23]===Symbol.for("react.memo_cache_sentinel")?(D=new Map,H[23]=D):D=H[23];let eu=(0,a.useRef)(D),em=(0,a.useRef)(null);H[24]===Symbol.for("react.memo_cache_sentinel")?(P={name:"root",timeScale:1},H[24]=P):P=H[24];let ed=(0,a.useRef)(P),ef=(0,a.useRef)(!1),ep=(0,a.useRef)(void 0);if(H[25]!==J||H[26]!==X){e:{let e=J.getState().playback,t=e.recording?.streamingPlayback,n=X?.toLowerCase();if(!t||!n){let e;H[28]===Symbol.for("react.memo_cache_sentinel")?(e=new Map,H[28]=e):e=H[28],j=e;break e}let a=t.getShapeConstructorSequences(n);if(!a){let e;H[29]===Symbol.for("react.memo_cache_sentinel")?(e=new Map,H[29]=e):e=H[29],j=e;break e}j=function(e,t){let n=new Map,a=[];for(let n of e){let e=n.indexOf(" ");if(-1===e)continue;let i=n.slice(0,e).toLowerCase(),r=n.slice(e+1).trim().toLowerCase();if(!r||!i.startsWith(t)||!i.endsWith(".dsq"))continue;let o=i.slice(t.length,-4);o&&a.push({clipName:o,alias:r})}let i=new Set;for(let e=0;e<I.length;e++){let t=I[e];for(let r=0;r<a.length;r++)if(a[r].alias===t){i.add(r),n.set(e,a[r]);break}}let r=8;for(let e=0;e<a.length;e++)!i.has(e)&&(n.set(r,a[e]),r++);return n}(a,n.replace(/\.dts$/i,"")+"_")}H[25]=J,H[26]=X,H[27]=j}else j=H[27];let eh=j;H[30]!==Z.animations||H[31]!==ea||H[32]!==ee?(F=()=>{let e=(0,c.getAliasedActions)(Z.animations,ea,ee);es.current=e;let t=e.get("root");t&&t.play(),ed.current={name:"root",timeScale:1};let n={head:null,headside:null};for(let{key:e,names:t}of[{key:"head",names:["head"]},{key:"headside",names:["headside"]}]){let a=Z.animations.find(e=>t.includes(e.name.toLowerCase()));if(!a)continue;let i=a.clone(),o=Math.round(30*a.duration/2);r.AnimationUtils.makeClipAdditive(i,o,a,30);let l=ea.clipAction(i);l.blendMode=r.AdditiveAnimationBlendMode,l.timeScale=0,l.weight=1,l.play(),n[e]=l}ec.current=n;let a=new Map,i=Z.animations.find(x),o=i?Math.round(30*i.duration/2):0;for(let e of["lookde","lookms","looksn"]){let t=Z.animations.find(t=>t.name.toLowerCase()===e);if(!t)continue;let n=t.clone(),l=i??t;r.AnimationUtils.makeClipAdditive(n,o,l,30);let s=ea.clipAction(n);s.blendMode=r.AdditiveAnimationBlendMode,s.timeScale=0,s.weight=0,s.play(),a.set(e,s)}eu.current=a;let l=a.get("lookde");return l&&(l.weight=1,em.current="lookde"),ea.update(0),()=>{ea.stopAllAction(),es.current=new Map,ec.current={head:null,headside:null},eu.current=new Map,em.current=null}},B=[ea,Z.animations,ee],H[30]=Z.animations,H[31]=ea,H[32]=ee,H[33]=F,H[34]=B):(F=H[33],B=H[34]),(0,a.useEffect)(F,B),H[35]!==el?(q=()=>{let e=[];for(let{mesh:t,initialize:n}of el)n(t,b).then(t=>e.push(t)).catch(M);return()=>e.forEach(A)},V=[el],H[35]=el,H[36]=q,H[37]=V):(q=H[36],V=H[37]),(0,a.useEffect)(q,V);let eS=(0,a.useRef)(Q.weaponShape),[eg,ey]=(0,a.useState)(Q.weaponShape),eT=(0,a.useRef)(Q.packShape),[eI,ew]=(0,a.useState)(Q.packShape),ek=(0,a.useRef)(Q.flagShape),[eA,eM]=(0,a.useState)(Q.flagShape);return H[38]!==eh||H[39]!==J||H[40]!==Q.falling||H[41]!==Q.flagShape||H[42]!==Q.headPitch||H[43]!==Q.headYaw||H[44]!==Q.jetting||H[45]!==Q.keyframes||H[46]!==Q.packShape||H[47]!==Q.weaponShape||H[48]!==ea?(W=(e,t)=>{Q.weaponShape!==eS.current&&(eS.current=Q.weaponShape,ey(Q.weaponShape)),Q.packShape!==eT.current&&(eT.current=Q.packShape,ew(Q.packShape)),Q.flagShape!==ek.current&&(ek.current=Q.flagShape,eM(Q.flagShape));let n=J.getState().playback,a="playing"===n.status,i=T.streamPlaybackStore.getState().time,o=(0,l.getKeyframeAtTime)(Q.keyframes??[],i),s=o?.damageState!=null&&o.damageState>=1,c=es.current;if(s&&!ef.current){ef.current=!0;let e=null!=o.actionAnim?eh.get(o.actionAnim):void 0;if(e){let t=c.get(e.clipName);if(t){let n=c.get(ed.current.name.toLowerCase());n&&n.fadeOut(l.ANIM_TRANSITION_TIME),t.setLoop(r.LoopOnce,1),t.clampWhenFinished=!0,t.reset().fadeIn(l.ANIM_TRANSITION_TIME).play(),ed.current={name:e.clipName,timeScale:1},ep.current=o.actionAnim}}}if(!s&&ef.current){ef.current=!1,ep.current=void 0;let e=c.get(ed.current.name.toLowerCase());e&&(e.stop(),e.setLoop(r.LoopRepeat,1/0),e.clampWhenFinished=!1),ed.current={name:"root",timeScale:1};let t=c.get("root");t&&t.reset().play()}let u=o?.actionAnim,m=ep.current;if(!ef.current&&u!==m){ep.current=u;let e=null!=m&&m>=8;if(null!=u&&u>=8){let e=eh.get(u);if(e){let t=c.get(e.clipName);if(t){let n=c.get(ed.current.name.toLowerCase());n&&n.fadeOut(l.ANIM_TRANSITION_TIME),t.setLoop(r.LoopOnce,1),t.clampWhenFinished=!0,t.reset().fadeIn(l.ANIM_TRANSITION_TIME).play(),ed.current={name:e.clipName,timeScale:1}}}}else if(e){let e=eh.get(m);if(e){let t=c.get(e.clipName);t&&(t.fadeOut(l.ANIM_TRANSITION_TIME),t.setLoop(r.LoopRepeat,1/0),t.clampWhenFinished=!1)}ed.current={name:"root",timeScale:1};let t=c.get("root");t&&t.reset().fadeIn(l.ANIM_TRANSITION_TIME).play()}}if(null!=u&&u>=8&&o?.actionAtEnd){let e=eh.get(u);if(e){let t=c.get(e.clipName);t&&(t.paused=!0)}}let d=null!=ep.current&&ep.current>=8;if(!ef.current&&!d){let e=function(e,t,n,a){if(n)return{animation:"fall",timeScale:1};if(!e)return a?{animation:"jet",timeScale:1}:{animation:"root",timeScale:1};let[i,r,o]=e,l=-2*Math.atan2(t[1],t[3]),s=Math.cos(l),c=Math.sin(l),u=i*s+r*c,m=-i*c+r*s,d=-m,f=-u,p=Math.max(m,d,f,u);return p<.1?a?{animation:"jet",timeScale:1}:{animation:"root",timeScale:1}:p===m?{animation:"run",timeScale:1}:p===d?{animation:"back",timeScale:1}:p===f?{animation:"side",timeScale:1}:{animation:"side",timeScale:-1}}(o?.velocity,o?.rotation??[0,0,0,1],Q.falling,Q.jetting),t=ed.current;if(e.animation!==t.name||e.timeScale!==t.timeScale){let n=c.get(t.name.toLowerCase()),i=c.get(e.animation.toLowerCase());i&&(a&&n&&n!==i?(n.fadeOut(l.ANIM_TRANSITION_TIME),i.reset().fadeIn(l.ANIM_TRANSITION_TIME).play()):(n&&n!==i&&n.stop(),i.reset().play()),i.timeScale=e.timeScale,ed.current={name:e.animation,timeScale:e.timeScale})}}let f=function(e){if(!e)return"lookde";let t=e.toLowerCase();return t.includes("missile")?"lookms":t.includes("sniper")?"looksn":"lookde"}(Q.weaponShape);if(f!==em.current){let e=eu.current,t=em.current?e.get(em.current):null,n=e.get(f);n&&(t&&(t.weight=0),n.weight=+!s,em.current=f)}let{head:p,headside:h}=ec.current,S=em.current?eu.current.get(em.current):null,g=+!s,y=Q.headPitch??0,I=Q.headYaw??0,w=(y+1)/2;S&&(S.time=w*S.getClip().duration,S.weight=g),p&&(p.time=w*p.getClip().duration,p.weight=g),h&&(h.time=(I+1)/2*h.getClip().duration,h.weight=g),a?ea.update(t*n.rate):ea.update(0)},H[38]=eh,H[39]=J,H[40]=Q.falling,H[41]=Q.flagShape,H[42]=Q.headPitch,H[43]=Q.headYaw,H[44]=Q.jetting,H[45]=Q.keyframes,H[46]=Q.packShape,H[47]=Q.weaponShape,H[48]=ea,H[49]=W):W=H[49],(0,i.useFrame)(W),H[50]===Symbol.for("react.memo_cache_sentinel")?(U=[0,Math.PI/2,0],H[50]=U):U=H[50],H[51]!==en?($=(0,t.jsx)("group",{rotation:U,children:(0,t.jsx)("primitive",{object:en})}),H[51]=en,H[52]=$):$=H[52],H[53]!==eg||H[54]!==Q||H[55]!==ei?(G=eg&&ei&&(0,t.jsx)(d.ShapeErrorBoundary,{fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"red",label:eg}),children:(0,t.jsx)(f.DebugSuspense,{name:`Weapon:${Q.id}/${eg}`,fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"cyan",label:eg}),children:(0,t.jsx)(N,{entity:Q,weaponShape:eg,mount0:ei})})},eg),H[53]=eg,H[54]=Q,H[55]=ei,H[56]=G):G=H[56],H[57]!==eI||H[58]!==Q.id||H[59]!==er?(z=eI&&er&&(0,t.jsx)(d.ShapeErrorBoundary,{fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"red",label:eI}),children:(0,t.jsx)(f.DebugSuspense,{name:`Pack:${Q.id}/${eI}`,fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"cyan",label:eI}),children:(0,t.jsx)(_,{packShape:eI,mountBone:er})})},eI),H[57]=eI,H[58]=Q.id,H[59]=er,H[60]=z):z=H[60],H[61]!==eA||H[62]!==Q.id||H[63]!==eo?(Y=eA&&eo&&(0,t.jsx)(d.ShapeErrorBoundary,{fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"red",label:eA}),children:(0,t.jsx)(f.DebugSuspense,{name:`Flag:${Q.id}/${eA}`,fallback:(0,t.jsx)(u.ShapePlaceholder,{color:"cyan",label:eA}),children:(0,t.jsx)(_,{packShape:eA,mountBone:eo})})},eA),H[61]=eA,H[62]=Q.id,H[63]=eo,H[64]=Y):Y=H[64],H[65]!==$||H[66]!==G||H[67]!==z||H[68]!==Y?(K=(0,t.jsxs)(t.Fragment,{children:[$,G,z,Y]}),H[65]=$,H[66]=G,H[67]=z,H[68]=Y,H[69]=K):K=H[69],K}function A(e){return e()}function M(){}function b(){return T.streamPlaybackStore.getState().time}function x(e){return"lookde"===e.name.toLowerCase()}function v(e){if(e.isMesh&&e.material)for(let t of Array.isArray(e.material)?e.material:[e.material])t.side=r.FrontSide}function N(e){let t,c,d,f,T,I,k,A,M,b,x,v,N,_,L,O,D=(0,n.c)(43),{entity:P,weaponShape:j,mount0:F}=e,B=(0,y.useEngineStoreApi)(),q=(0,u.useStaticShape)(j),V=(0,m.useAnisotropy)();if(D[0]!==V||D[1]!==q.animations||D[2]!==q.scene){t=o.clone(q.scene),c=(0,l.processShapeScene)(t,void 0,{anisotropy:V});let e=(0,l.getPosedNodeTransform)(q.scene,q.animations,"Mountpoint");if(e){let n=e.quaternion.clone().invert(),a=e.position.clone().negate().applyQuaternion(n);t.position.copy(a),t.quaternion.copy(n)}f=new Map,t.traverse(e=>{if(!e.isMesh)return;let t=e.userData,n=(t?.vis_sequence??"").toLowerCase();if(!n)return;let a=f.get(n);a||(a=[],f.set(n,a)),a.push(e)}),d=new r.AnimationMixer(t),D[0]=V,D[1]=q.animations,D[2]=q.scene,D[3]=t,D[4]=c,D[5]=d,D[6]=f}else t=D[3],c=D[4],d=D[5],f=D[6];let W=d,U=q.scene;D[7]!==U||D[8]!==q.animations?(T=function(e,t){let n=e.userData?.dts_sequence_names;if("string"==typeof n)try{return JSON.parse(n).map(e=>e.toLowerCase())}catch{}return t.map(e=>e.name.toLowerCase())}(U,q.animations),D[7]=U,D[8]=q.animations,D[9]=T):T=D[9];let $=T;D[10]!==t||D[11]!==c||D[12]!==W||D[13]!==$||D[14]!==f?(I={weaponClone:t,weaponMixer:W,seqIndexToName:$,visNodesBySequence:f,weaponIflInitializers:c},D[10]=t,D[11]=c,D[12]=W,D[13]=$,D[14]=f,D[15]=I):I=D[15];let{weaponClone:G,weaponMixer:z,seqIndexToName:Y,visNodesBySequence:K,weaponIflInitializers:H}=I;D[16]!==G||D[17]!==z?(k=()=>()=>{(0,l.disposeClonedScene)(G),z.uncacheRoot(G)},A=[G,z],D[16]=G,D[17]=z,D[18]=k,D[19]=A):(k=D[18],A=D[19]),(0,a.useEffect)(k,A),D[20]===Symbol.for("react.memo_cache_sentinel")?(M=new Map,D[20]=M):M=D[20];let Q=(0,a.useRef)(M),J=(0,a.useRef)(null);D[21]!==q.animations||D[22]!==z?(b=()=>{let e=new Map;for(let t of q.animations)e.set(t.name.toLowerCase(),z.clipAction(t));Q.current=e;let t=e.get("spin");return t&&(t.setLoop(r.LoopRepeat,1/0),t.timeScale=0,t.play()),J.current=t??null,z.update(0),()=>{z.stopAllAction(),Q.current=new Map,J.current=null,w(er,eo)}},x=[z,q.animations],D[21]=q.animations,D[22]=z,D[23]=b,D[24]=x):(b=D[23],x=D[24]),(0,a.useEffect)(b,x),D[25]!==H?(v=()=>{let e=[];for(let{mesh:t,initialize:n}of H)n(t,C).then(t=>e.push(t)).catch(E);return()=>e.forEach(R)},N=[H],D[25]=H,D[26]=v,D[27]=N):(v=D[26],N=D[27]),(0,a.useEffect)(v,N);let{audioLoader:X,audioListener:Z}=(0,p.useAudio)(),ee=(0,g.useSettings)(),et=ee?.audioEnabled??!1,en=(0,a.useRef)(null),ea=(0,a.useRef)(null),ei=(0,a.useRef)(P.weaponImageStates),er=(0,a.useRef)(null),eo=(0,a.useRef)(-1);return D[28]!==F||D[29]!==G?(_=()=>(F.add(G),()=>{F.remove(G)}),L=[G,F],D[28]=F,D[29]=G,D[30]=_,D[31]=L):(_=D[30],L=D[31]),(0,a.useEffect)(_,L),D[32]!==et||D[33]!==Z||D[34]!==X||D[35]!==B||D[36]!==P.weaponImageState||D[37]!==P.weaponImageStates||D[38]!==Y||D[39]!==K||D[40]!==G||D[41]!==z?(O=(e,t)=>{let n=B.getState().playback,a="playing"===n.status,i=Q.current,o=P.weaponImageState,c=P.weaponImageStates;c!==ei.current&&(ei.current=c,c&&c.length>0?en.current=new s(c,Y):en.current=null,ea.current=null,w(er,eo,G)),!en.current&&c&&c.length>0&&(en.current=new s(c,Y));let u=en.current;if(u&&o&&a){let e=t*n.rate,a=u.tick(e,o);if(function(e,t,n,a){let i=e.sequenceName,o=n.current;if(i===o&&!e.transitioned)return;if(i!==o){if(o){let e=a.get(o);if(e)for(let t of e)t.visible=!1}if(i){let e=a.get(i);if(e)for(let t of e)t.visible=!0}}if(!i){if(o){let e=t.get(o);e&&e.fadeOut(l.ANIM_TRANSITION_TIME),n.current=null}return}let s=t.get(i);if(s&&(e.transitioned||i!==o)){let a=o?t.get(o):null;if(e.isFiring||e.timeoutValue>0?(s.setLoop(r.LoopOnce,1),s.clampWhenFinished=!0):(s.setLoop(r.LoopRepeat,1/0),s.clampWhenFinished=!1),e.scaleAnimation&&e.timeoutValue>0){let t=s.getClip().duration;s.timeScale=t>0?t/e.timeoutValue:1}else s.timeScale=e.reverse?-1:1;a&&a!==s?(a.fadeOut(l.ANIM_TRANSITION_TIME),s.reset().fadeIn(l.ANIM_TRANSITION_TIME).play()):s.reset().play(),n.current=i}}(a,i,ea,K),er.current&&a.stateIndex!==eo.current&&w(er,eo,G),et&&X&&Z&&a.soundDataBlockIds.length>0){let e=n.recording?.streamingPlayback.getDataBlockData.bind(n.recording.streamingPlayback);if(e)for(let t of a.soundDataBlockIds){let a=(0,h.resolveAudioProfile)(t,e);if(a)if(a.isLooping){if(!er.current)try{let e=(0,S.audioToUrl)(a.filename),t=(0,h.getSoundGeneration)();(0,h.getCachedAudioBuffer)(e,X,e=>{if(t!==(0,h.getSoundGeneration)()||er.current)return;let i=u.stateIndex,o=new r.PositionalAudio(Z);o.setBuffer(e),o.setDistanceModel("inverse"),o.setRefDistance(a.refDist),o.setMaxDistance(a.maxDist),o.setRolloffFactor(1),o.setVolume(a.volume),o.setPlaybackRate(n.rate),o.setLoop(!0),G.add(o),(0,h.trackSound)(o),o.play(),er.current=o,eo.current=i})}catch{}}else(0,h.playOneShotSound)(a,Z,X,void 0,G)}}J.current&&(J.current.timeScale=a.spinTimeScale)}a?z.update(t*n.rate):z.update(0)},D[32]=et,D[33]=Z,D[34]=X,D[35]=B,D[36]=P.weaponImageState,D[37]=P.weaponImageStates,D[38]=Y,D[39]=K,D[40]=G,D[41]=z,D[42]=O):O=D[42],(0,i.useFrame)(O),null}function R(e){return e()}function E(){}function C(){return T.streamPlaybackStore.getState().time}function _(e){let t,i,r,s,c,d,f,p=(0,n.c)(15),{packShape:h,mountBone:S}=e,g=(0,u.useStaticShape)(h),y=(0,m.useAnisotropy)();if(p[0]!==y||p[1]!==g.animations||p[2]!==g.scene){t=o.clone(g.scene),i=(0,l.processShapeScene)(t,void 0,{anisotropy:y});let e=(0,l.getPosedNodeTransform)(g.scene,g.animations,"Mountpoint");if(e){let n=e.quaternion.clone().invert(),a=e.position.clone().negate().applyQuaternion(n);t.position.copy(a),t.quaternion.copy(n)}p[0]=y,p[1]=g.animations,p[2]=g.scene,p[3]=t,p[4]=i}else t=p[3],i=p[4];p[5]!==t||p[6]!==i?(r={packClone:t,packIflInitializers:i},p[5]=t,p[6]=i,p[7]=r):r=p[7];let{packClone:T,packIflInitializers:I}=r;return p[8]!==S||p[9]!==T?(s=()=>(S.add(T),()=>{S.remove(T),(0,l.disposeClonedScene)(T)}),c=[T,S],p[8]=S,p[9]=T,p[10]=s,p[11]=c):(s=p[10],c=p[11]),(0,a.useEffect)(s,c),p[12]!==I?(d=()=>{let e=[];for(let{mesh:t,initialize:n}of I)n(t,D).then(t=>e.push(t)).catch(O);return()=>e.forEach(L)},f=[I],p[12]=I,p[13]=d,p[14]=f):(d=p[13],f=p[14]),(0,a.useEffect)(d,f),null}function L(e){return e()}function O(){}function D(){return T.streamPlaybackStore.getState().time}function P(e){let t,i,r=(0,n.c)(7),{shapeName:o,eyeOffsetRef:s}=e,c=(0,u.useStaticShape)(o);return r[0]!==s||r[1]!==c.animations||r[2]!==c.scene?(t=()=>{let e=(0,l.getPosedNodeTransform)(c.scene,c.animations,"Eye");e?s.current.set(e.position.z,e.position.y,-e.position.x):s.current.set(0,l.DEFAULT_EYE_HEIGHT,0)},r[0]=s,r[1]=c.animations,r[2]=c.scene,r[3]=t):t=r[3],r[4]!==s||r[5]!==c?(i=[c,s],r[4]=s,r[5]=c,r[6]=i):i=r[6],(0,a.useEffect)(t,i),null}e.s(["PlayerEyeOffset",()=>P,"PlayerModel",()=>k],9721)}]);