hytopia 0.8.1 → 0.8.2-dev
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/bun-server.mjs +2 -2
- package/node-server.mjs +2 -2
- package/package.json +1 -1
package/bun-server.mjs
CHANGED
|
@@ -449,7 +449,7 @@ qYGMwU/HBVHkLAn5XvT2a9xM0mzZ558d+ahbw8qAgRxg7BZ+2PW/bf7F2WRBUk1f
|
|
|
449
449
|
xauhAoGBALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
|
|
450
450
|
6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
|
|
451
451
|
0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
|
|
452
|
-
-----END RSA PRIVATE KEY-----`;var CS=process.env.PORT??8080,TS="0.8.
|
|
452
|
+
-----END RSA PRIVATE KEY-----`;var CS=process.env.PORT??8080,TS="0.8.2-dev",kS;(($)=>{$.READY="WEBSERVER.READY";$.STOPPED="WEBSERVER.STOPPED";$.ERROR="WEBSERVER.ERROR";$.UPGRADE="WEBSERVER.UPGRADE"})(kS||={});class PK extends j0{static instance=new PK;_webserver=nL.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,X)=>{J.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:TS,runtime:typeof Bun!=="undefined"?"bun":"node"})}),this._webserver.use(nL.default.static("assets"));try{this._webserver.use(nL.default.static(ic1.dirname(c.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?lc1.createServer(this._webserver):pc1.createServer({key:iL.existsSync("assets/certs/localhost.key")?iL.readFileSync("assets/certs/localhost.key"):cY0,cert:iL.existsSync("assets/certs/localhost.crt")?iL.readFileSync("assets/certs/localhost.crt"):dY0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else d.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(CS,this._onStarted),console.info(`WebServer.start(): Server running on port ${CS}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return d.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let Y=nc1.parse(Z.url??"",!0).query,$=Y.connectionId?.toString(),Q=Y.sessionToken?.toString()??"";if($&&m7.instance.isValidConnectionId($))Z.connectionId=$;else{let W=await I7.instance.getPlayerSession(Q);if(W?.error){let K=`${W.error.code}: ${W.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
|
|
453
453
|
Content-Type: text/plain\r
|
|
454
454
|
Content-Length: ${K.length}\r
|
|
455
455
|
Connection: close\r
|
|
@@ -482,6 +482,6 @@ ${$.stack}`:"unknown"}}}}}var Li1=(Z={})=>{let J=Z.limit??Hi1;return{name:Vi1,pr
|
|
|
482
482
|
`),U=F.shift();if(!U)return Z.destroy(),X(new Error("No header received from proxy CONNECT response"));let B=U.split(" "),w=+(B[1]||0),O=B.slice(2).join(" "),N={};for(let R of F){if(!R)continue;let j=R.indexOf(":");if(j===-1)return Z.destroy(),X(new Error(`Invalid header from proxy CONNECT response: "${R}"`));let P=R.slice(0,j).toLowerCase(),D=R.slice(j+1).trimStart(),C=N[P];if(typeof C==="string")N[P]=[C,D];else if(Array.isArray(C))C.push(D);else N[P]=D}SR("got proxy server response: %o %o",U,N),W(),J({connect:{statusCode:w,statusText:O,headers:N},buffered:V})}Z.on("error",G),Z.on("end",K),Q()})}function $F(...Z){g.log("[https-proxy-agent]",...Z)}class _R extends by{static __initStatic(){this.protocols=["http","https"]}constructor(Z,J){super(J);this.options={},this.proxy=typeof Z==="string"?new URL(Z):Z,this.proxyHeaders=J?.headers??{},$F("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let X=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),Y=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...J?E$1(J,"headers"):null,host:X,port:Y}}async connect(Z,J){let{proxy:X}=this;if(!J.host)throw new TypeError('No "host" provided');let Y;if(X.protocol==="https:"){$F("Creating `tls.Socket`: %o",this.connectOpts);let V=this.connectOpts.servername||this.connectOpts.host;Y=yy.connect({...this.connectOpts,servername:V&&LJ.isIP(V)?void 0:V})}else $F("Creating `net.Socket`: %o",this.connectOpts),Y=LJ.connect(this.connectOpts);let $=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders},Q=LJ.isIPv6(J.host)?`[${J.host}]`:J.host,W=`CONNECT ${Q}:${J.port} HTTP/1.1\r
|
|
483
483
|
`;if(X.username||X.password){let V=`${decodeURIComponent(X.username)}:${decodeURIComponent(X.password)}`;$["Proxy-Authorization"]=`Basic ${Buffer.from(V).toString("base64")}`}if($.Host=`${Q}:${J.port}`,!$["Proxy-Connection"])$["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close";for(let V of Object.keys($))W+=`${V}: ${$[V]}\r
|
|
484
484
|
`;let K=k$1(Y);Y.write(`${W}\r
|
|
485
|
-
`);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",g96),J.secureEndpoint){$F("Upgrading socket connection to TLS");let V=J.servername||J.host;return yy.connect({...E$1(J,"host","path","port"),socket:Y,servername:LJ.isIP(V)?void 0:V})}return Y}Y.destroy();let H=new LJ.Socket({writable:!1});return H.readable=!0,Z.once("socket",(V)=>{$F("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),H}}_R.__initStatic();function g96(Z){Z.resume()}function E$1(Z,...J){let X={},Y;for(Y in Z)if(!J.includes(Y))X[Y]=Z[Y];return X}var l96=32768;function p96(Z){return new d96({read(){this.push(Z),this.push(null)}})}function xR(Z){let J;try{J=new URL(Z.url)}catch(G){return K8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),gK(Z,()=>Promise.resolve({}))}let X=J.protocol==="https:",Y=i96(J,Z.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),$=X?u96:m96,Q=Z.keepAlive===void 0?!1:Z.keepAlive,W=Y?new _R(Y):new $.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),K=n96(Z,Z.httpModule??$,W);return gK(Z,K)}function i96(Z,J){let{no_proxy:X}=process.env;if(X?.split(",").some(($)=>Z.host.endsWith($)||Z.hostname.endsWith($)))return;else return J}function n96(Z,J,X){let{hostname:Y,pathname:$,port:Q,protocol:W,search:K}=new URL(Z.url);return function G(z){return new Promise((H,V)=>{wV(()=>{let q=p96(z.body),F={...Z.headers};if(z.body.length>l96)F["content-encoding"]="gzip",q=q.pipe(c96());let U=J.request({method:"POST",agent:X,headers:F,hostname:Y,path:`${$}${K}`,port:Q,protocol:W,ca:Z.caCerts},(B)=>{B.on("data",()=>{}),B.on("end",()=>{}),B.setEncoding("utf8");let w=B.headers["retry-after"]??null,O=B.headers["x-sentry-rate-limits"]??null;H({statusCode:B.statusCode,headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),q.pipe(U)})})}}var a96=new Set(["false","f","n","no","off","0"]),s96=new Set(["true","t","y","yes","on","1"]);function AR(Z,J){let X=String(Z).toLowerCase();if(a96.has(X))return!1;if(s96.has(X))return!0;return J?.strict?null:Boolean(Z)}import{posix as o96,sep as r96}from"path";function I$1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function hR(Z=process.argv[1]?p_(process.argv[1]):process.cwd(),J=r96==="\\"){let X=J?I$1(Z):Z;return(Y)=>{if(!Y)return;let $=J?I$1(Y):Y,{dir:Q,base:W,ext:K}=o96.parse($);if(K===".js"||K===".mjs"||K===".cjs")W=W.slice(0,K.length*-1);let G=decodeURIComponent(W);if(!Q)Q=".";let z=Q.lastIndexOf("/node_modules");if(z>-1)return`${Q.slice(z+14).replace(/\//g,".")}:${G}`;if(Q.startsWith(X)){let H=Q.slice(X.length+1).replace(/\//g,".");return H?`${H}:${G}`:G}return G}}function fR(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(O0.SENTRY_RELEASE?.id)return O0.SENTRY_RELEASE.id;let J=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,X=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,Y=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return J||X||Y||Z}var bR=$O(Yx(hR()));var S$1=e(X0(),1);import*as v$1 from"os";import{threadId as t96,isMainThread as e96}from"worker_threads";var Z46=60000;class QF extends jO{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||v$1.hostname(),X={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)Q3({instrumentations:Z.openTelemetryInstrumentations});f_(X,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${e96?"main":`worker-${t96}`}.`);super(X);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{BX(this)},J)this.on("beforeCaptureLog",(Y)=>{Y.attributes={...Y.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=L8,X=S$1.trace.getTracer(Z,J);return this._tracer=X,X}async flush(Z){let X=this.traceProvider?.activeSpanProcessor;if(X)await X.forceFlush();if(this.getOptions().sendClientReports)this._flushOutcomes();return super.flush(Z)}close(Z){if(this._clientReportInterval)clearInterval(this._clientReportInterval);if(this._clientReportOnExitFlushListener)process.off("beforeExit",this._clientReportOnExitFlushListener);if(this._logOnExitFlushListener)process.off("beforeExit",this._logOnExitFlushListener);return super.close(Z)}startClientReportTracking(){let Z=this.getOptions();if(Z.sendClientReports)this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{m0&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??Z46).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return J81(this,Z)}}var W7=e(X0(),1);var h3=e(D1(),1);var _$1=e(vj(),1);import J46 from"module";var gy=1e6;function yR(Z,J={}){if(Z.getOptions().debug)A$1();let X=Y46(Z,J);Z.traceProvider=X}function my(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!O0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:X}=_$1.createAddHookMessageChannel();J46.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){g.warn("Failed to register ESM hook",X)}}else K8(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})}function x$1(Z={}){let{debug:J}=Z;if(J)g.enable(),A$1();if(!K4())my();X46(Z.integrations).forEach((X)=>{if(X(),J)g.log(`[Sentry] Preloaded ${X.id} instrumentation`)})}function X46(Z){let J=T$1();if(!Z)return J;return J.filter((X)=>Z.includes(X.id))}function Y46(Z,J={}){let X=new Rf({sampler:new uf(Z),resource:new w3({[h3.ATTR_SERVICE_NAME]:"node",[h3.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[h3.ATTR_SERVICE_VERSION]:L8}),forceFlushTimeoutMillis:500,spanProcessors:[new mf({timeout:$46(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return W7.trace.setGlobalTracerProvider(X),W7.propagation.setGlobalPropagator(new hf),W7.context.setGlobalContextManager(new IR),X}function $46(Z){if(Z==null)return;if(Z>gy)return m0&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${gy}`),gy;else if(Z<=0||Number.isNaN(Z)){m0&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function A$1(){let Z=new Proxy(g,{get(J,X,Y){return Reflect.get(J,X==="verbose"?"debug":X,Y)}});W7.diag.disable(),W7.diag.setLogger(Z,W7.DiagLogLevel.DEBUG)}function Q46(){return K4()?[TM()]:[]}function uy(){return[PV(),DV(),CV(),TV(),kV(),wM(),OM(),kM(),EM(),NM(),CM(),RM(),kR(),C$1(),...Q46()]}function dy(Z){return[...uy(),...G5(Z)?vR():[]]}function gR(Z={}){return f$1(Z,dy)}function h$1(Z={}){return f$1(Z,()=>[])}function f$1(Z={},J){let X=W46(Z,J);if(X.debug===!0)if(m0)g.enable();else K8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!K4()&&X.registerEsmLoaderHooks!==!1)my();if(qM(),l0().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:Q})=>Q===Dy))X.integrations.push(BR({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));let $=new QF(X);if(l0().setClient($),$.init(),g.log(`Running in ${K4()?"CommonJS":"ESM"} mode.`),$.startClientReportTracking(),z46(),!X.skipOpenTelemetrySetup)yR($,{spanProcessors:X.openTelemetrySpanProcessors}),cy();return i11($),X81($),$}function cy(){if(!m0)return;let Z=o11(),J=["SentryContextManager","SentryPropagator"];if(G5())J.push("SentrySpanProcessor");for(let X of J)if(!Z.includes(X))g.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function W46(Z,J){let X=K46(Z.release),Y=Z.spotlight??AR(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,$=G46(Z.tracesSampleRate),Q={...Z,dsn:Z.dsn??process.env.SENTRY_DSN,environment:Z.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:Z.sendClientReports??!0,transport:Z.transport??xR,stackParser:iS(Z.stackParser||bR),release:X,tracesSampleRate:$,spotlight:Y,debug:AR(Z.debug??process.env.SENTRY_DEBUG)},W=Z.integrations,K=Z.defaultIntegrations??J(Q);return{...Q,integrations:C_({defaultIntegrations:K,integrations:W})}}function K46(Z){if(Z!==void 0)return Z;let J=fR();if(J!==void 0)return J;return}function G46(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let X=parseFloat(J);return isFinite(X)?X:void 0}function z46(){if(AR(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,X=A$(Z,J);l0().setPropagationContext(X)}}var H46=[["january","1"],["february","2"],["march","3"],["april","4"],["may","5"],["june","6"],["july","7"],["august","8"],["september","9"],["october","10"],["november","11"],["december","12"],["jan","1"],["feb","2"],["mar","3"],["apr","4"],["may","5"],["jun","6"],["jul","7"],["aug","8"],["sep","9"],["oct","10"],["nov","11"],["dec","12"],["sunday","0"],["monday","1"],["tuesday","2"],["wednesday","3"],["thursday","4"],["friday","5"],["saturday","6"],["sun","0"],["mon","1"],["tue","2"],["wed","3"],["thu","4"],["fri","5"],["sat","6"]];function _Q(Z){return H46.reduce((J,[X,Y])=>J.replace(new RegExp(X,"gi"),Y),Z)}var b$1="Automatic instrumentation of CronJob only supports crontab string";function y$1(Z,J){let X=!1;return new Proxy(Z,{construct(Y,$){let[Q,W,K,G,z,...H]=$;if(typeof Q!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let V=_Q(Q);async function q(F,U){return d7(J,async()=>{try{await W(F,U)}catch(B){throw F1(B),B}},{schedule:{type:"crontab",value:V},timezone:z||void 0})}return new Y(Q,q,K,G,z,...H)},get(Y,$){if($==="from")return(Q)=>{let{cronTime:W,onTick:K,timeZone:G}=Q;if(typeof W!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let z=_Q(W);return Q.onTick=async(H,V)=>{return d7(J,async()=>{try{await K(H,V)}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:z},timezone:G||void 0})},Y.from(Q)};else return Y[$]}})}function g$1(Z){return new Proxy(Z,{get(J,X){if(X==="schedule"&&J.schedule)return new Proxy(J.schedule,{apply(Y,$,Q){let[W,K,G]=Q,z=G?.name,H=G?.timezone;if(!z)throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');let V=async()=>{return d7(z,async()=>{try{return await K()}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:_Q(W)},timezone:H})};return Y.apply($,[W,V,G])}});else return J[X]}})}function m$1(Z){return new Proxy(Z,{get(J,X){if(X==="scheduleJob")return new Proxy(J.scheduleJob,{apply(Y,$,Q){let[W,K,G]=Q;if(typeof W!=="string"||typeof K!=="string"||typeof G!=="function")throw new Error("Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string");let z=W,H=K;async function V(){return d7(z,async()=>{await G?.()},{schedule:{type:"crontab",value:_Q(H)}})}return Y.apply($,[z,H,V])}});return J[X]}})}var u$1={instrumentCron:y$1,instrumentNodeCron:g$1,instrumentNodeSchedule:m$1};var xQ;((w)=>{w.BUILD_PACKETS="build_packets";w.ENTITIES_EMIT_UPDATES="entities_emit_updates";w.ENTITIES_TICK="entities_tick";w.NETWORK_SYNCHRONIZE="network_synchronize";w.NETWORK_SYNCHRONIZE_CLEANUP="network_synchronize_cleanup";w.PHYSICS_CLEANUP="physics_cleanup";w.PHYSICS_STEP="physics_step";w.RELEASE_TICK_ALLOCATION="release_tick_allocation";w.SEND_ALL_PACKETS="send_all_packets";w.SEND_PACKETS="send_packets";w.SERIALIZE_FREE_BUFFERS="serialize_free_buffers";w.SERIALIZE_PACKETS="serialize_packets";w.SERIALIZE_PACKETS_ENCODE="serialize_packets_encode";w.SIMULATION_STEP="simulation_step";w.TICKER_TICK="ticker_tick";w.WORLD_TICK="world_tick"})(xQ||={});class V8{static getProcessStats(Z=!1){let J=process.memoryUsage(),X={jsHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},jsHeapCapacityMb:{value:J.heapTotal/1024/1024,unit:"megabyte"},jsHeapUsagePercent:{value:J.heapUsed/J.heapTotal,unit:"percent"},processHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:J.rss/1024/1024,unit:"megabyte"}};if(Z)return X;return Object.fromEntries(Object.entries(X).map(([Y,$])=>[Y,$.value]))}static initializeSentry(Z,J=50){gR({dsn:Z,release:TS,environment:process.env.NODE_ENV||"development",tracesSampleRate:1,initialScope:{tags:{gameId:process.env.HYTOPIA_GAME_ID??"unknown",gameSlug:process.env.HYTOPIA_GAME_SLUG??"unknown",lobbyId:process.env.HYTOPIA_LOBBY_ID??"unknown",region:process.env.REGION??"unknown"}},beforeSend:(X)=>{return X.extra=V8.getProcessStats(),X},beforeSendTransaction:(X)=>{if(X.contexts?.trace?.op==="ticker_tick"){let $=X?.start_timestamp,Q=X?.timestamp;if(!$||!Q)return null;if((Q-$)*1000>J)return X.measurements=V8.getProcessStats(!0),X}return null}})}static startSpan(Z,J){if(MV())return n9({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}static sentry(){return ly}}var d$1=new V$({useFloat32:tz.ALWAYS}),F46=5000,c$1={RAW:0,GZIP:1};class y4 extends j0{static _cachedPacketsSerializedBuffer=new Map;_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=E60(),this.onPacket(Y0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Y0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),j0.globalInstance.emit("CONNECTION.OPENED",{connection:this,req:J})}static clearCachedPacketsSerializedBuffers(){if(y4._cachedPacketsSerializedBuffer.size>0)y4._cachedPacketsSerializedBuffer.clear()}static serializePackets(Z){for(let X of Z)if(!Y0.isValidPacket(X))return d.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=y4._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return V8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=d$1.pack(Z),$=Y.byteLength>1024,Q=$?V46(Y,{level:1}):Y,W=$?c$1.GZIP:c$1.RAW;return Y=Buffer.allocUnsafe(Q.length+1),Y[0]=W,Q.copy(Y,1),X?.setAttribute("serializedBytes",Y.byteLength),y4._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=!!this._ws;if(J&&this._closeTimeout)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws)this._ws.onmessage=()=>{},this._ws.onclose=()=>{},this._ws.onerror=()=>{},this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{k:!0})]);if(this._ws=Z,this._ws.binaryType="nodebuffer",this._ws.onmessage=(X)=>this._onMessage(X.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(m7.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){d.error(`Connection.disconnect(): Connection disconnect failed. Error: ${Z}`)}}onPacket(Z,J){this.on("CONNECTION.PACKET_RECEIVED",({packet:X})=>{if(X[0]===Z)J(X)})}send(Z,J=!0,X=!1){if(this._closeTimeout)return;if(this._ws.readyState!==q46.OPEN)return;if(!J&&this._ws.bufferedAmount>4096)return;V8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=y4.serializePackets(Z);if(!Y)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&Y.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!X)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send(Y)}catch{this._ws.send(Y)}else this._ws.send(Y);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch(Y){d.error(`Connection.send(): Packet send failed. Error: ${Y}`)}})}_closeWrtcClientServerTransport(){this._wrtcDirectTransport?.close(),this._wrtcDirectTransport=null,this._wrtcClientServerTransport?.close(),this._wrtcClientServerTransport=null,this._wrtcClientServerDataProducers.forEach((Z)=>Z.close()),this._wrtcClientServerDataProducers=[],this._wrtcClientServerDataConsumers.forEach((Z)=>Z.close()),this._wrtcClientServerDataConsumers=[]}_closeWrtcServerClientTransport(){this._wrtcServerClientTransport?.close(),this._wrtcServerClientTransport=null,this._wrtcServerClientDataConsumers.forEach((Z)=>Z.close()),this._wrtcServerClientDataConsumers=[],this._wrtcServerClientReliableDataProducer?.close(),this._wrtcServerClientReliableDataProducer=null,this._wrtcServerClientUnreliableDataProducer?.close(),this._wrtcServerClientUnreliableDataProducer=null}_onConnectionPacket=async(Z)=>{let J=Z[1],X=J.c,Y=J.d;if(X){let{i:$,d:Q}=X,W=!1;if($==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),W=!0;if($==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),W=!0;if(W)this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:$}})])}if(Y)for(let $ of Y){let{s:Q,l:W}=$,K=await this._wrtcClientServerTransport.produceData({label:W,sctpStreamParameters:Q}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:K.id});this._wrtcClientServerDataProducers.push(K),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:W}})])}};_onHeartbeatPacket=()=>{this.send([Y0.createPacket(Y0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){d.error(`Connection._ws.onmessage(): Error: ${J}`)}};_onWrtcIceStateChange=(Z,J)=>{if(["disconnected","closed"].includes(J)){if(Z==this._wrtcClientServerTransport)this._closeWrtcClientServerTransport();else if(Z==this._wrtcServerClientTransport)this._closeWrtcServerClientTransport()}};_onWsClose=()=>{this.closeWrtc(),this.emitWithGlobal("CONNECTION.DISCONNECTED",{connection:this}),this._closeTimeout=setTimeout(()=>{this.emitWithGlobal("CONNECTION.CLOSED",{connection:this}),this.offAll()},F46)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await m7.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:X,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=X,this._wrtcClientServerTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,W)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,W)}),this._wrtcServerClientReliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scr",sctpStreamParameters:{streamId:0,ordered:!0}}),this._wrtcServerClientUnreliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scu",sctpStreamParameters:{streamId:1,ordered:!1,maxPacketLifeTime:35}});let $=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push($,Q),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{d:[{i:$.id,pi:$.dataProducerId,l:"scr",s:$.sctpStreamParameters},{i:Q.id,pi:Q.dataProducerId,l:"scu",s:Q.sctpStreamParameters}],t:[{i:this._wrtcClientServerTransport.id,f:"cs",d:this._wrtcClientServerTransport.dtlsParameters,ic:this._wrtcClientServerTransport.iceCandidates,ip:this._wrtcClientServerTransport.iceParameters,s:this._wrtcClientServerTransport.sctpParameters},{i:this._wrtcServerClientTransport.id,f:"sc",d:this._wrtcServerClientTransport.dtlsParameters,ic:this._wrtcServerClientTransport.iceCandidates,ip:this._wrtcServerClientTransport.iceParameters,s:this._wrtcServerClientTransport.sctpParameters}]})]),!0};_deserialize(Z){let J=d$1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return d.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Y0.isValidPacket(J))return d.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}class WF{_lights=new Map;_nextLightId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedLights(Z){this.getAllEntityAttachedLights(Z).forEach((J)=>{J.despawn()})}getAllLights(Z=!1){return Z?this._world.tickAllocator.getArray(this._lights.values()):Array.from(this._lights.values())}getAllEntityAttachedLights(Z){return this.getAllLights().filter((J)=>J.attachedToEntity===Z)}registerLight(Z){if(Z.id!==void 0)return Z.id;let J=this._nextLightId;return this._lights.set(J,Z),this._nextLightId++,J}unregisterLight(Z){if(Z.id===void 0)return;this._lights.delete(Z.id)}}class F6{_map=new Map;_values=[];_isDirty=!1;get size(){return this._map.size}get valuesArray(){if(this._isDirty)this._syncArray();return this._values}get(Z){return this._map.get(Z)}set(Z,J){let X=this._map.has(Z);if(this._map.set(Z,J),!X)this._values.push(J);else this._isDirty=!0;return this}has(Z){return this._map.has(Z)}delete(Z){let J=this._map.delete(Z);if(J)this._isDirty=!0;return J}clear(){this._map.clear(),this._values.length=0,this._isDirty=!1}forEach(Z,J){this._map.forEach((X,Y)=>{Z.call(J,X,Y,this)})}keys(){return this._map.keys()}values(){return this._map.values()}entries(){return this._map.entries()}[Symbol.iterator](){return this._map[Symbol.iterator]()}_syncArray(){this._values.length=0;for(let Z of this._map.values())this._values.push(Z);this._isDirty=!1}}var l$1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(l$1||={});var py;((q)=>{q.DESPAWN="LIGHT.DESPAWN";q.SET_ANGLE="LIGHT.SET_ANGLE";q.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";q.SET_COLOR="LIGHT.SET_COLOR";q.SET_DISTANCE="LIGHT.SET_DISTANCE";q.SET_INTENSITY="LIGHT.SET_INTENSITY";q.SET_OFFSET="LIGHT.SET_OFFSET";q.SET_PENUMBRA="LIGHT.SET_PENUMBRA";q.SET_POSITION="LIGHT.SET_POSITION";q.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";q.SPAWN="LIGHT.SPAWN"})(py||={});class iy extends j0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");super();d.warning("WARNING: Lights are poorly optimized at this time. Using more than a few lights in your game can cause extremely bad performance (FPS) issues. Use lights sparingly!"),this._angle=Z.angle,this._attachedToEntity=Z.attachedToEntity,this._color=Z.color??{r:255,g:255,b:255},this._distance=Z.distance,this._intensity=Z.intensity??1,this._offset=Z.offset,this._penumbra=Z.penumbra,this._position=Z.position,this._trackedEntity=Z.trackedEntity,this._trackedPosition=Z.trackedPosition,this._type=Z.type??0}get id(){return this._id}get angle(){return this._angle}get attachedToEntity(){return this._attachedToEntity}get color(){return this._color}get distance(){return this._distance}get intensity(){return this._intensity}get isSpawned(){return this._id!==void 0}get offset(){return this._offset}get penumbra(){return this._penumbra}get position(){return this._position}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get type(){return this._type}get world(){return this._world}setAngle(Z){if(this._angle===Z)return;if(this._angle=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ANGLE",{light:this,angle:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return d.error(`Light.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ATTACHED_TO_ENTITY",{light:this,entity:Z})}setColor(Z){if(this._color.r===Z.r&&this._color.g===Z.g&&this._color.b===Z.b)return;if(this._color=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_COLOR",{light:this,color:Z})}setDistance(Z){if(this._distance===Z)return;if(this._distance=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_DISTANCE",{light:this,distance:Z})}setIntensity(Z){if(this._intensity===Z)return;if(this._intensity=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_INTENSITY",{light:this,intensity:Z})}setOffset(Z){if(this._offset&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_OFFSET",{light:this,offset:Z})}setPenumbra(Z){if(this._penumbra===Z)return;if(this._penumbra=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_PENUMBRA",{light:this,penumbra:Z})}setPosition(Z){if(this._position&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.z)return;if(this._position=Z,this._attachedToEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_POSITION",{light:this,position:Z})}setTrackedEntity(Z){if(!Z.isSpawned)return d.error(`Light.setTrackedEntity(): Entity ${Z.id} is not spawned!`);if(this._trackedEntity===Z)return;if(this._trackedEntity=Z,this._trackedPosition=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_ENTITY",{light:this,entity:Z})}setTrackedPosition(Z){if(this._trackedPosition===Z)return;if(this._trackedPosition=Z,this._trackedEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_POSITION",{light:this,position:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.lightManager.unregisterLight(this),this.emitWithWorld(this._world,"LIGHT.DESPAWN",{light:this}),this._id=void 0,this._world=void 0}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return d.error(`Light.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning Light!`);this._id=Z.lightManager.registerLight(this),this._world=Z,this.emitWithWorld(Z,"LIGHT.SPAWN",{light:this})}serialize(){if(!this._world)d.fatalError("Light.serialize(): Light is not in a world and cannot be serialized!");return D0.serializeLight(this,this._world.tickAllocator)}}var ny;((m)=>{m.BURST="PARTICLE_EMITTER.BURST";m.DESPAWN="PARTICLE_EMITTER.DESPAWN";m.SET_ALPHA_TEST="PARTICLE_EMITTER.SET_ALPHA_TEST";m.SET_ATTACHED_TO_ENTITY="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY";m.SET_ATTACHED_TO_ENTITY_NODE_NAME="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME";m.SET_COLOR_END="PARTICLE_EMITTER.SET_COLOR_END";m.SET_COLOR_END_VARIANCE="PARTICLE_EMITTER.SET_COLOR_END_VARIANCE";m.SET_COLOR_START="PARTICLE_EMITTER.SET_COLOR_START";m.SET_COLOR_START_VARIANCE="PARTICLE_EMITTER.SET_COLOR_START_VARIANCE";m.SET_GRAVITY="PARTICLE_EMITTER.SET_GRAVITY";m.SET_LIFETIME="PARTICLE_EMITTER.SET_LIFETIME";m.SET_LIFETIME_VARIANCE="PARTICLE_EMITTER.SET_LIFETIME_VARIANCE";m.SET_MAX_PARTICLES="PARTICLE_EMITTER.SET_MAX_PARTICLES";m.SET_OFFSET="PARTICLE_EMITTER.SET_OFFSET";m.SET_OPACITY_END="PARTICLE_EMITTER.SET_OPACITY_END";m.SET_OPACITY_END_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE";m.SET_OPACITY_START="PARTICLE_EMITTER.SET_OPACITY_START";m.SET_OPACITY_START_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE";m.SET_PAUSED="PARTICLE_EMITTER.SET_PAUSED";m.SET_POSITION="PARTICLE_EMITTER.SET_POSITION";m.SET_POSITION_VARIANCE="PARTICLE_EMITTER.SET_POSITION_VARIANCE";m.SET_RATE="PARTICLE_EMITTER.SET_RATE";m.SET_RATE_VARIANCE="PARTICLE_EMITTER.SET_RATE_VARIANCE";m.SET_SIZE_END="PARTICLE_EMITTER.SET_SIZE_END";m.SET_SIZE_END_VARIANCE="PARTICLE_EMITTER.SET_SIZE_END_VARIANCE";m.SET_SIZE_START="PARTICLE_EMITTER.SET_SIZE_START";m.SET_SIZE_START_VARIANCE="PARTICLE_EMITTER.SET_SIZE_START_VARIANCE";m.SET_TEXTURE_URI="PARTICLE_EMITTER.SET_TEXTURE_URI";m.SET_TRANSPARENT="PARTICLE_EMITTER.SET_TRANSPARENT";m.SET_VELOCITY="PARTICLE_EMITTER.SET_VELOCITY";m.SET_VELOCITY_VARIANCE="PARTICLE_EMITTER.SET_VELOCITY_VARIANCE";m.SPAWN="PARTICLE_EMITTER.SPAWN"})(ny||={});class ay extends j0{_id;_alphaTest;_attachedToEntity;_attachedToEntityNodeName;_colorEnd;_colorEndVariance;_colorStart;_colorStartVariance;_gravity;_lifetime;_lifetimeVariance;_maxParticles;_offset;_opacityEnd;_opacityEndVariance;_opacityStart;_opacityStartVariance;_paused;_position;_positionVariance;_rate;_rateVariance;_sizeEnd;_sizeEndVariance;_sizeStart;_sizeStartVariance;_sizeVariance;_textureUri;_transparent;_velocity;_velocityVariance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");if(!Z.textureUri)d.fatalError("ParticleEmitter.constructor(): textureUri must be provided.");super();this._alphaTest=Z.alphaTest??0.5,this._attachedToEntity=Z.attachedToEntity,this._attachedToEntityNodeName=Z.attachedToEntityNodeName,this._colorEnd=Z.colorEnd,this._colorEndVariance=Z.colorEndVariance,this._colorStart=Z.colorStart,this._colorStartVariance=Z.colorStartVariance,this._gravity=Z.gravity,this._lifetime=Z.lifetime,this._lifetimeVariance=Z.lifetimeVariance,this._maxParticles=Z.maxParticles,this._offset=Z.offset,this._opacityEnd=Z.opacityEnd,this._opacityEndVariance=Z.opacityEndVariance,this._opacityStart=Z.opacityStart,this._opacityStartVariance=Z.opacityStartVariance,this._paused=!1,this._position=Z.position,this._positionVariance=Z.positionVariance,this._rate=Z.rate,this._rateVariance=Z.rateVariance,this._sizeEnd=Z.sizeEnd,this._sizeEndVariance=Z.sizeEndVariance,this._sizeStart=Z.sizeStart,this._sizeStartVariance=Z.sizeStartVariance,this._textureUri=Z.textureUri,this._transparent=Z.transparent,this._velocity=Z.velocity,this._velocityVariance=Z.velocityVariance}get id(){return this._id}get alphaTest(){return this._alphaTest}get attachedToEntity(){return this._attachedToEntity}get attachedToEntityNodeName(){return this._attachedToEntityNodeName}get colorEnd(){return this._colorEnd}get colorEndVariance(){return this._colorEndVariance}get colorStart(){return this._colorStart}get colorStartVariance(){return this._colorStartVariance}get gravity(){return this._gravity}get isSpawned(){return this._id!==void 0}get lifetime(){return this._lifetime}get lifetimeVariance(){return this._lifetimeVariance}get maxParticles(){return this._maxParticles}get offset(){return this._offset}get opacityEnd(){return this._opacityEnd}get opacityEndVariance(){return this._opacityEndVariance}get opacityStart(){return this._opacityStart}get opacityStartVariance(){return this._opacityStartVariance}get paused(){return this._paused}get position(){return this._position}get positionVariance(){return this._positionVariance}get rate(){return this._rate}get rateVariance(){return this._rateVariance}get sizeEnd(){return this._sizeEnd}get sizeEndVariance(){return this._sizeEndVariance}get sizeStart(){return this._sizeStart}get sizeStartVariance(){return this._sizeStartVariance}get sizeVariance(){return this._sizeVariance}get textureUri(){return this._textureUri}get transparent(){return this._transparent}get velocity(){return this._velocity}get velocityVariance(){return this._velocityVariance}get world(){return this._world}setAlphaTest(Z){if(this._alphaTest===Z)return;if(this._alphaTest=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ALPHA_TEST",{particleEmitter:this,alphaTest:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return d.error(`ParticleEmitter.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",{particleEmitter:this,entity:Z})}setAttachedToEntityNodeName(Z){if(this._attachedToEntityNodeName===Z)return;if(this._attachedToEntityNodeName=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",{particleEmitter:this,attachedToEntityNodeName:Z})}setColorEnd(Z){if(this._colorEnd&&this._colorEnd.r===Z.r&&this._colorEnd.g===Z.g&&this._colorEnd.b===Z.b)return;if(this._colorEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END",{particleEmitter:this,colorEnd:Z})}setColorEndVariance(Z){if(this._colorEndVariance&&this._colorEndVariance.r===Z.r&&this._colorEndVariance.g===Z.g&&this._colorEndVariance.b===Z.b)return;if(this._colorEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",{particleEmitter:this,colorEndVariance:Z})}setColorStart(Z){if(this._colorStart&&this._colorStart.r===Z.r&&this._colorStart.g===Z.g&&this._colorStart.b===Z.b)return;if(this._colorStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START",{particleEmitter:this,colorStart:Z})}setColorStartVariance(Z){if(this._colorStartVariance&&this._colorStartVariance.r===Z.r&&this._colorStartVariance.g===Z.g&&this._colorStartVariance.b===Z.b)return;if(this._colorStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",{particleEmitter:this,colorStartVariance:Z})}setGravity(Z){if(this._gravity&&this._gravity.x===Z.x&&this._gravity.y===Z.y&&this._gravity.z===Z.z)return;if(this._gravity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_GRAVITY",{particleEmitter:this,gravity:Z})}setLifetime(Z){if(this._lifetime===Z)return;if(this._lifetime=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME",{particleEmitter:this,lifetime:Z})}setLifetimeVariance(Z){if(this._lifetimeVariance===Z)return;if(this._lifetimeVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",{particleEmitter:this,lifetimeVariance:Z})}setMaxParticles(Z){if(this._maxParticles===Z)return;if(this._maxParticles=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_MAX_PARTICLES",{particleEmitter:this,maxParticles:Z})}setOffset(Z){if(this._offset&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OFFSET",{particleEmitter:this,offset:Z})}setOpacityEnd(Z){if(this._opacityEnd===Z)return;if(this._opacityEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END",{particleEmitter:this,opacityEnd:Z})}setOpacityEndVariance(Z){if(this._opacityEndVariance===Z)return;if(this._opacityEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",{particleEmitter:this,opacityEndVariance:Z})}setOpacityStart(Z){if(this._opacityStart===Z)return;if(this._opacityStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START",{particleEmitter:this,opacityStart:Z})}setOpacityStartVariance(Z){if(this._opacityStartVariance===Z)return;if(this._opacityStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",{particleEmitter:this,opacityStartVariance:Z})}setPosition(Z){if(this._position&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.z)return;if(this._position=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION",{particleEmitter:this,position:Z})}setPositionVariance(Z){if(this._positionVariance&&this._positionVariance.x===Z.x&&this._positionVariance.y===Z.y&&this._positionVariance.z===Z.z)return;if(this._positionVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION_VARIANCE",{particleEmitter:this,positionVariance:Z})}setRate(Z){if(this._rate===Z)return;if(this._rate=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE",{particleEmitter:this,rate:Z})}setRateVariance(Z){if(this._rateVariance===Z)return;if(this._rateVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE_VARIANCE",{particleEmitter:this,rateVariance:Z})}setSizeEnd(Z){if(this._sizeEnd===Z)return;if(this._sizeEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END",{particleEmitter:this,sizeEnd:Z})}setSizeEndVariance(Z){if(this._sizeEndVariance===Z)return;if(this._sizeEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",{particleEmitter:this,sizeEndVariance:Z})}setSizeStart(Z){if(this._sizeStart===Z)return;if(this._sizeStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START",{particleEmitter:this,sizeStart:Z})}setSizeStartVariance(Z){if(this._sizeStartVariance===Z)return;if(this._sizeStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",{particleEmitter:this,sizeStartVariance:Z})}setTextureUri(Z){if(this._textureUri===Z)return;if(this._textureUri=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TEXTURE_URI",{particleEmitter:this,textureUri:Z})}setTransparent(Z){if(this._transparent===Z)return;if(this._transparent=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TRANSPARENT",{particleEmitter:this,transparent:Z})}setVelocity(Z){if(this._velocity&&this._velocity.x===Z.x&&this._velocity.y===Z.y&&this._velocity.z===Z.z)return;if(this._velocity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY",{particleEmitter:this,velocity:Z})}setVelocityVariance(Z){if(this._velocityVariance&&this._velocityVariance.x===Z.x&&this._velocityVariance.y===Z.y&&this._velocityVariance.z===Z.z)return;if(this._velocityVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",{particleEmitter:this,velocityVariance:Z})}burst(Z){if(this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.BURST",{particleEmitter:this,count:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.particleEmitterManager.unregisterParticleEmitter(this),this.emitWithWorld(this._world,"PARTICLE_EMITTER.DESPAWN",{particleEmitter:this}),this._id=void 0,this._world=void 0}restart(){if(!this._paused)return;if(this._paused=!1,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}stop(){if(this._paused)return;if(this._paused=!0,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return d.error(`ParticleEmitter.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning ParticleEmitter!`);this._id=Z.particleEmitterManager.registerParticleEmitter(this),this._world=Z,this.emitWithWorld(Z,"PARTICLE_EMITTER.SPAWN",{particleEmitter:this})}serialize(){if(!this._world)d.fatalError("ParticleEmitter.serialize(): ParticleEmitter is not in a world and cannot be serialized!");return D0.serializeParticleEmitter(this,this._world.tickAllocator)}}var U46={x:0,y:-32,z:0},sy=60,oy;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(oy||={});class KF extends j0{_colliderMap=new pz;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=sy,X=U46){super();this._rapierEventQueue=new Q1.EventQueue(!0),this._rapierSimulation=new Q1.World(X),this._rapierSimulation.timestep=Math.fround(1/J),this._world=Z}get colliderMap(){return this._colliderMap}get isDebugRaycastingEnabled(){return this._debugRaycastingEnabled}get isDebugRenderingEnabled(){return this._debugRenderingEnabled}get gravity(){return this._rapierSimulation.gravity}get timestepS(){return this._rapierSimulation.timestep}get world(){return this._world}createRawCollider(Z,J){return this._rapierSimulation.createCollider(Z,J)}createRawRigidBody(Z){return this._rapierSimulation.createRigidBody(Z)}enableDebugRaycasting(Z){this._debugRaycastingEnabled=Z}enableDebugRendering(Z,J=Q1.QueryFilterFlags.EXCLUDE_FIXED){this._debugRenderingEnabled=Z,this._debugRenderingFilterFlags=J}getContactManifolds(Z,J){let X=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,(Y,$)=>{if(Y.numContacts()===0)return;let Q=Y.normal(),W=[];for(let K=0;K<Y.numSolverContacts();K++)W.push(Y.solverContactPoint(K));X.push({contactPoints:W,localNormalA:!$?Y.localNormal1():Y.localNormal2(),localNormalB:!$?Y.localNormal2():Y.localNormal1(),normal:!$?Q:{x:-Q.x,y:-Q.y,z:-Q.z}})}),X}intersectionsWithRawShape(Z,J,X,Y={}){let $=new Set,Q=[];return this._rapierSimulation.intersectionsWithShape(J,X,Z,(W)=>{let K=this._colliderMap.getColliderHandleBlockType(W.handle);if(K&&!$.has(K))return $.add(K),Q.push({intersectedBlockType:K}),!0;let G=this._colliderMap.getColliderHandleEntity(W.handle);if(G&&!$.has(G))return $.add(G),Q.push({intersectedEntity:G}),!0;return!0},Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate),Q}raycast(Z,J,X,Y={}){let $=new Q1.Ray(Z,J),Q=this._rapierSimulation.castRay($,X,Y.solidMode??!0,Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:X,hit:!!Q});if(!Q)return null;let W=$.pointAt(Q.timeOfImpact),K=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:gQ.fromGlobalCoordinate({x:Math.floor(W.x-($.dir.x<0?0.0001:-0.0001)),y:Math.floor(W.y-($.dir.y<0?0.0001:-0.0001)),z:Math.floor(W.z-($.dir.z<0?0.0001:-0.0001))},z),hitPoint:W,hitDistance:K};let H=this._colliderMap.getColliderHandleEntity(G.handle);if(H)return{hitEntity:H,hitPoint:W,hitDistance:K};return null}removeRawCollider(Z){this._colliderMap.queueColliderHandleForCleanup(Z.handle),this._rapierSimulation.removeCollider(Z,!1)}removeRawRigidBody(Z){this._rapierSimulation.removeRigidBody(Z)}setGravity(Z){this._rapierSimulation.gravity=Z}step=(Z)=>{this.emitWithWorld(this._world,"SIMULATION.STEP_START",{simulation:this,tickDeltaMs:Z});let J=performance.now();if(V8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),V8.startSpan({operation:"physics_cleanup"},()=>{this._rapierEventQueue.drainContactForceEvents(this._onContactForceEvent),this._rapierEventQueue.drainCollisionEvents(this._onCollisionEvent),this._colliderMap.cleanup()}),this.emitWithWorld(this._world,"SIMULATION.STEP_END",{simulation:this,stepDurationMs:performance.now()-J}),this._debugRenderingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RENDER",{simulation:this,...this._rapierSimulation.debugRender(this._debugRenderingFilterFlags)})};_onCollisionEvent=(Z,J,X)=>{let[Y,$]=this._getCollisionObjects(Z,J);if(!Y||!$)return;let Q=(W,K)=>{if(W instanceof Q9&&K instanceof a8&&W.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))W.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:W,entity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof Q9&&W.hasListeners("ENTITY.BLOCK_COLLISION"))W.emit("ENTITY.BLOCK_COLLISION",{entity:W,blockType:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof a8&&W.hasListeners("ENTITY.ENTITY_COLLISION"))W.emit("ENTITY.ENTITY_COLLISION",{entity:W,otherEntity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(typeof W==="function"&&(K instanceof a8||K instanceof Q9))W(K,X,Z,J)};Q(Y,$),Q($,Y)};_onContactForceEvent=(Z)=>{let[J,X]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!X||typeof X==="function")return;let Y={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},$=(Q,W)=>{if(Q instanceof Q9&&W instanceof a8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof Q9&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof a8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:W,contactForceData:Y})};$(J,X),$(X,J)};_getCollisionObjects(Z,J){let X=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),Y=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[X,Y]}}class mR{_synchronizedPlayerReliablePackets=new F6;_queuedBroadcasts=[];_queuedAudioSynchronizations=new F6;_queuedBlockSynchronizations=new F6;_queuedBlockTypeSynchronizations=new F6;_queuedChunkSynchronizations=new F6;_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations=new F6;_queuedLightSynchronizations=new F6;_queuedParticleEmitterSynchronizations=new F6;_queuedPerPlayerSynchronizations=new F6;_queuedPerPlayerCameraSynchronizations=new F6;_queuedPerPlayerUISynchronizations=new F6;_queuedPerPlayerUIDatasSynchronizations=new F6;_queuedPlayerSynchronizations=new F6;_queuedSceneUISynchronizations=new F6;_queuedWorldSynchronization;_loadedSceneUIs=new Set;_spawnedChunks=new Set;_spawnedEntities=new Set;_world;constructor(Z){this._world=Z,this._subscribeToAudioEvents(),this._subscribeToBlockTypeRegistryEvents(),this._subscribeToChatEvents(),this._subscribeToChunkLatticeEvents(),this._subscribeToEntityEvents(),this._subscribeToLightEvents(),this._subscribeToParticleEmitterEvents(),this._subscribeToPlayerEvents(),this._subscribeToPlayerCameraEvents(),this._subscribeToPlayerUIEvents(),this._subscribeToSceneUIEvents(),this._subscribeToSimulationEvents(),this._subscribeToWorldEvents()}synchronize(){let Z=this._world.tickAllocator,J=this._world.tickAllocator.getArray(),X=this._world.tickAllocator.getArray(),Y=this._world.loop.currentTick;if(this._queuedPerPlayerSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerSynchronizations)this._createOrGetSynchronizedPlayerReliablePackets($,J).push(...Q);if(this._queuedEntitySynchronizations.size>0){let $=this._world.tickAllocator.getArray(),Q=this._world.tickAllocator.getArray();for(let W of this._queuedEntitySynchronizations.valuesArray){let K=!1;for(let G in W)if(G!=="i"&&G!=="p"&&G!=="r"){K=!0;break}if(K)$.push(W);else Q.push(W)}if(Q.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,Q,Y,Z.getArray());X.push(W)}if($.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,$,Y,Z.getArray());J.push(W);for(let K of this._synchronizedPlayerReliablePackets.valuesArray)K.push(W)}}if(this._queuedAudioSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,this._queuedAudioSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockTypeSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._queuedBlockTypeSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedChunkSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,this._queuedChunkSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blocksPacketDefinition,this._queuedBlockSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedLightSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,this._queuedLightSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedParticleEmitterSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,this._queuedParticleEmitterSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerUISynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUISynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPerPlayerUIDatasSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUIDatasSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiDatasPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedSceneUISynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,this._queuedSceneUISynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedWorldSynchronization){let $=Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerCameraSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerCameraSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.cameraPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPlayerSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,this._queuedPlayerSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBroadcasts.length>0)for(let $ of this._queuedBroadcasts){J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedDebugRaycastSynchronizations.length>0){let $=Y0.createPacket(Y0.outboundPackets.physicsDebugRaycastsPacketDefinition,this._queuedDebugRaycastSynchronizations,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}V8.startSpan({operation:"send_all_packets"},()=>{for(let $ of V9.instance.getConnectedPlayersByWorld(this._world)){let Q=this._synchronizedPlayerReliablePackets.get($)??J;if(Q.length>0)$.connection.send(Q);if(X.length>0)$.connection.send(X,!1)}}),V8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts.length=0;if(this._queuedAudioSynchronizations.size>0)this._queuedAudioSynchronizations.clear();if(this._queuedBlockSynchronizations.size>0)this._queuedBlockSynchronizations.clear();if(this._queuedBlockTypeSynchronizations.size>0)this._queuedBlockTypeSynchronizations.clear();if(this._queuedChunkSynchronizations.size>0)this._queuedChunkSynchronizations.clear();if(this._queuedDebugRaycastSynchronizations.length>0)this._queuedDebugRaycastSynchronizations.length=0;if(this._queuedEntitySynchronizations.size>0)this._queuedEntitySynchronizations.clear();if(this._queuedLightSynchronizations.size>0)this._queuedLightSynchronizations.clear();if(this._queuedParticleEmitterSynchronizations.size>0)this._queuedParticleEmitterSynchronizations.clear();if(this._queuedPerPlayerSynchronizations.size>0)this._queuedPerPlayerSynchronizations.clear();if(this._queuedPerPlayerCameraSynchronizations.size>0)this._queuedPerPlayerCameraSynchronizations.clear();if(this._queuedPerPlayerUISynchronizations.size>0)this._queuedPerPlayerUISynchronizations.clear();if(this._queuedPerPlayerUIDatasSynchronizations.size>0)this._queuedPerPlayerUIDatasSynchronizations.clear();if(this._queuedPlayerSynchronizations.size>0)this._queuedPlayerSynchronizations.clear();if(this._queuedSceneUISynchronizations.size>0)this._queuedSceneUISynchronizations.clear();if(this._queuedWorldSynchronization)this._queuedWorldSynchronization=void 0;if(this._loadedSceneUIs.size>0)this._loadedSceneUIs.clear();if(this._spawnedChunks.size>0)this._spawnedChunks.clear();if(this._spawnedEntities.size>0)this._spawnedEntities.clear();if(this._synchronizedPlayerReliablePackets.size>0)this._synchronizedPlayerReliablePackets.clear();y4.clearCachedPacketsSerializedBuffers()})}_subscribeToAudioEvents(){this._world.final("AUDIO.PAUSE",this._onAudioPause),this._world.final("AUDIO.PLAY",this._onAudioPlay),this._world.final("AUDIO.PLAY_RESTART",this._onAudioPlayRestart),this._world.final("AUDIO.SET_ATTACHED_TO_ENTITY",this._onAudioSetAttachedToEntity),this._world.final("AUDIO.SET_CUTOFF_DISTANCE",this._onAudioSetCutoffDistance),this._world.final("AUDIO.SET_DETUNE",this._onAudioSetDetune),this._world.final("AUDIO.SET_DISTORTION",this._onAudioSetDistortion),this._world.final("AUDIO.SET_POSITION",this._onAudioSetPosition),this._world.final("AUDIO.SET_PLAYBACK_RATE",this._onAudioSetPlaybackRate),this._world.final("AUDIO.SET_REFERENCE_DISTANCE",this._onAudioSetReferenceDistance),this._world.final("AUDIO.SET_VOLUME",this._onAudioSetVolume)}_subscribeToBlockTypeRegistryEvents(){this._world.final("BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",this._onBlockTypeRegistryRegisterBlockType)}_subscribeToChatEvents(){this._world.final("CHAT.BROADCAST_MESSAGE",this._onChatSendBroadcastMessage),this._world.final("CHAT.PLAYER_MESSAGE",this._onChatSendPlayerMessage)}_subscribeToChunkLatticeEvents(){this._world.final("CHUNK_LATTICE.ADD_CHUNK",this._onChunkLatticeAddChunk),this._world.final("CHUNK_LATTICE.REMOVE_CHUNK",this._onChunkLatticeRemoveChunk),this._world.final("CHUNK_LATTICE.SET_BLOCK",this._onChunkLatticeSetBlock)}_subscribeToEntityEvents(){this._world.final("ENTITY.SPAWN",this._onEntitySpawn),this._world.final("ENTITY.DESPAWN",this._onEntityDespawn),this._world.final("ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",this._onEntitySetModelAnimationsPlaybackRate),this._world.final("ENTITY.SET_MODEL_HIDDEN_NODES",this._onEntitySetModelHiddenNodes),this._world.final("ENTITY.SET_MODEL_SCALE",this._onEntitySetModelScale),this._world.final("ENTITY.SET_MODEL_SHOWN_NODES",this._onEntitySetModelShownNodes),this._world.final("ENTITY.SET_MODEL_TEXTURE_URI",this._onEntitySetModelTextureUri),this._world.final("ENTITY.SET_OPACITY",this._onEntitySetOpacity),this._world.final("ENTITY.SET_PARENT",this._onEntitySetParent),this._world.final("ENTITY.SET_TINT_COLOR",this._onEntitySetTintColor),this._world.final("ENTITY.START_MODEL_LOOPED_ANIMATIONS",this._onEntityStartModelLoopedAnimations),this._world.final("ENTITY.START_MODEL_ONESHOT_ANIMATIONS",this._onEntityStartModelOneshotAnimations),this._world.final("ENTITY.STOP_MODEL_ANIMATIONS",this._onEntityStopModelAnimations),this._world.final("ENTITY.UPDATE_POSITION",this._onEntityUpdatePosition),this._world.final("ENTITY.UPDATE_ROTATION",this._onEntityUpdateRotation)}_subscribeToLightEvents(){this._world.final("LIGHT.DESPAWN",this._onLightDespawn),this._world.final("LIGHT.SET_ANGLE",this._onLightSetAngle),this._world.final("LIGHT.SET_ATTACHED_TO_ENTITY",this._onLightSetAttachedToEntity),this._world.final("LIGHT.SET_COLOR",this._onLightSetColor),this._world.final("LIGHT.SET_DISTANCE",this._onLightSetDistance),this._world.final("LIGHT.SET_INTENSITY",this._onLightSetIntensity),this._world.final("LIGHT.SET_OFFSET",this._onLightSetOffset),this._world.final("LIGHT.SET_PENUMBRA",this._onLightSetPenumbra),this._world.final("LIGHT.SET_POSITION",this._onLightSetPosition),this._world.final("LIGHT.SET_TRACKED_ENTITY",this._onLightSetTrackedEntity),this._world.final("LIGHT.SET_TRACKED_POSITION",this._onLightSetTrackedPosition),this._world.final("LIGHT.SPAWN",this._onLightSpawn)}_subscribeToParticleEmitterEvents(){this._world.final("PARTICLE_EMITTER.DESPAWN",this._onParticleEmitterDespawn),this._world.final("PARTICLE_EMITTER.BURST",this._onParticleEmitterBurst),this._world.final("PARTICLE_EMITTER.SET_ALPHA_TEST",this._onParticleEmitterSetAlphaTest),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",this._onParticleEmitterSetAttachedToEntity),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",this._onParticleEmitterSetAttachedToEntityNodeName),this._world.final("PARTICLE_EMITTER.SET_COLOR_END",this._onParticleEmitterSetColorEnd),this._world.final("PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",this._onParticleEmitterSetColorEndVariance),this._world.final("PARTICLE_EMITTER.SET_COLOR_START",this._onParticleEmitterSetColorStart),this._world.final("PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",this._onParticleEmitterSetColorStartVariance),this._world.final("PARTICLE_EMITTER.SET_GRAVITY",this._onParticleEmitterSetGravity),this._world.final("PARTICLE_EMITTER.SET_LIFETIME",this._onParticleEmitterSetLifetime),this._world.final("PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",this._onParticleEmitterSetLifetimeVariance),this._world.final("PARTICLE_EMITTER.SET_MAX_PARTICLES",this._onParticleEmitterSetMaxParticles),this._world.final("PARTICLE_EMITTER.SET_OFFSET",this._onParticleEmitterSetOffset),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END",this._onParticleEmitterSetOpacityEnd),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",this._onParticleEmitterSetOpacityEndVariance),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START",this._onParticleEmitterSetOpacityStart),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",this._onParticleEmitterSetOpacityStartVariance),this._world.final("PARTICLE_EMITTER.SET_PAUSED",this._onParticleEmitterSetPaused),this._world.final("PARTICLE_EMITTER.SET_POSITION",this._onParticleEmitterSetPosition),this._world.final("PARTICLE_EMITTER.SET_POSITION_VARIANCE",this._onParticleEmitterSetPositionVariance),this._world.final("PARTICLE_EMITTER.SET_RATE",this._onParticleEmitterSetRate),this._world.final("PARTICLE_EMITTER.SET_RATE_VARIANCE",this._onParticleEmitterSetRateVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_END",this._onParticleEmitterSetSizeEnd),this._world.final("PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",this._onParticleEmitterSetSizeEndVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_START",this._onParticleEmitterSetSizeStart),this._world.final("PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",this._onParticleEmitterSetSizeStartVariance),this._world.final("PARTICLE_EMITTER.SET_TEXTURE_URI",this._onParticleEmitterSetTextureUri),this._world.final("PARTICLE_EMITTER.SET_TRANSPARENT",this._onParticleEmitterSetTransparent),this._world.final("PARTICLE_EMITTER.SET_VELOCITY",this._onParticleEmitterSetVelocity),this._world.final("PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",this._onParticleEmitterSetVelocityVariance),this._world.final("PARTICLE_EMITTER.SPAWN",this._onParticleEmitterSpawn)}_subscribeToPlayerEvents(){this._world.final("PLAYER.JOINED_WORLD",this._onPlayerJoinedWorld),this._world.final("PLAYER.LEFT_WORLD",this._onPlayerLeftWorld),this._world.final("PLAYER.RECONNECTED_WORLD",this._onPlayerReconnectedWorld),this._world.final("PLAYER.REQUEST_SYNC",this._onPlayerRequestSync)}_subscribeToPlayerCameraEvents(){this._world.final("PLAYER_CAMERA.LOOK_AT_ENTITY",this._onPlayerCameraLookAtEntity),this._world.final("PLAYER_CAMERA.LOOK_AT_POSITION",this._onPlayerCameraLookAtPosition),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",this._onPlayerCameraSetAttachedToEntity),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",this._onPlayerCameraSetAttachedToPosition),this._world.final("PLAYER_CAMERA.SET_FILM_OFFSET",this._onPlayerCameraSetFilmOffset),this._world.final("PLAYER_CAMERA.SET_FORWARD_OFFSET",this._onPlayerCameraSetForwardOffset),this._world.final("PLAYER_CAMERA.SET_FOV",this._onPlayerCameraSetFov),this._world.final("PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",this._onPlayerCameraSetModelHiddenNodes),this._world.final("PLAYER_CAMERA.SET_MODEL_SHOWN_NODES",this._onPlayerCameraSetModelShownNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_SHOULDER_ANGLE",this._onPlayerCameraSetShoulderAngle),this._world.final("PLAYER_CAMERA.SET_TRACKED_ENTITY",this._onPlayerCameraSetTrackedEntity),this._world.final("PLAYER_CAMERA.SET_TRACKED_POSITION",this._onPlayerCameraSetTrackedPosition),this._world.final("PLAYER_CAMERA.SET_ZOOM",this._onPlayerCameraSetZoom)}_subscribeToPlayerUIEvents(){this._world.final("PLAYER_UI.LOAD",this._onPlayerUILoad),this._world.final("PLAYER_UI.LOCK_POINTER",this._onPlayerUILockPointer),this._world.final("PLAYER_UI.SEND_DATA",this._onPlayerUISendData)}_subscribeToSceneUIEvents(){this._world.final("SCENE_UI.LOAD",this._onSceneUILoad),this._world.final("SCENE_UI.SET_ATTACHED_TO_ENTITY",this._onSceneUISetAttachedToEntity),this._world.final("SCENE_UI.SET_OFFSET",this._onSceneUISetOffset),this._world.final("SCENE_UI.SET_POSITION",this._onSceneUISetPosition),this._world.final("SCENE_UI.SET_STATE",this._onSceneUISetState),this._world.final("SCENE_UI.SET_VIEW_DISTANCE",this._onSceneUISetViewDistance),this._world.final("SCENE_UI.UNLOAD",this._onSceneUIUnload)}_subscribeToSimulationEvents(){this._world.final("SIMULATION.DEBUG_RAYCAST",this._onSimulationDebugRaycast),this._world.final("SIMULATION.DEBUG_RENDER",this._onSimulationDebugRender)}_subscribeToWorldEvents(){this._world.final("WORLD.SET_AMBIENT_LIGHT_COLOR",this._onWorldSetAmbientLightColor),this._world.final("WORLD.SET_AMBIENT_LIGHT_INTENSITY",this._onWorldSetAmbientLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",this._onWorldSetDirectionalLightColor),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",this._onWorldSetDirectionalLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",this._onWorldSetDirectionalLightPosition),this._world.final("WORLD.SET_FOG_COLOR",this._onWorldSetFogColor),this._world.final("WORLD.SET_FOG_FAR",this._onWorldSetFogFar),this._world.final("WORLD.SET_FOG_NEAR",this._onWorldSetFogNear),this._world.final("WORLD.SET_SKYBOX_INTENSITY",this._onWorldSetSkyboxIntensity)}_onAudioPause=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pa=!0,delete J.pl,delete J.r};_onAudioPlay=(Z)=>{let J=Z.audio.serialize();J.pl=!0,delete J.pa,delete J.r,this._queuedAudioSynchronizations.set(J.i,J)};_onAudioPlayRestart=(Z)=>{let J=Z.audio.serialize();J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations.set(J.i,J)};_onAudioSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onAudioSetCutoffDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.cd=Z.cutoffDistance};_onAudioSetDetune=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.de=Z.detune};_onAudioSetDistortion=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.di=Z.distortion};_onAudioSetPosition=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.position?void 0:J.e,J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations.set(Z.blockType.id,J)};_onChatSendBroadcastMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=J.getObject();Q.m=Y,Q.c=$,Q.p=X?.id;let W=J.getArray();W.push(Q),this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,W,this._world.loop.currentTick,J.getArray()))};_onChatSendPlayerMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=this._queuedPerPlayerSynchronizations.get(X)??[],W=J.getObject();W.m=Y,W.c=$;let K=J.getArray();K.push(W),Q.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,K,this._world.loop.currentTick,this._world.tickAllocator.getArray())),this._queuedPerPlayerSynchronizations.set(X,Q)};_onChunkLatticeAddChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=this._world.tickAllocator.getArray(Z.chunk.blocks),J.rm=void 0,this._spawnedChunks.add(J.c.join(","))};_onChunkLatticeRemoveChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk),X=J.c.join(",");if(this._spawnedChunks.has(X))this._queuedChunkSynchronizations.delete(X),this._spawnedChunks.delete(X);else J.rm=!0};_onChunkLatticeSetBlock=(Z)=>{let J=this._createOrGetQueuedBlockSync(Z.globalCoordinate);J.i=Z.blockTypeId};_onEntitySetModelAnimationsPlaybackRate=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.ap=Z.playbackRate};_onEntitySpawn=(Z)=>{let J=Z.entity.serialize();this._queuedEntitySynchronizations.set(J.i,J),this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))this._queuedEntitySynchronizations.delete(J.i),this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onEntitySetModelScale=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.s=Z.modelScale};_onEntitySetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.sn=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onEntitySetModelTextureUri=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.mt=Z.modelTextureUri};_onEntitySetOpacity=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.o=Z.opacity};_onEntitySetParent=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.pe=Z.parent?Z.parent.id:void 0,J.pn=Z.parentNodeName};_onEntitySetTintColor=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.t=Z.tintColor?D0.serializeRgbColor(Z.tintColor,this._world.tickAllocator):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.al,Z.animations);if(X.al=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.ao,Z.animations);if(X.ao=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStopModelAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity);if(X.al){let Y=J.getSet(X.al);for(let $ of Z.animations)Y.delete($);X.al=J.getArray(Y)}if(X.ao){let Y=J.getSet(X.ao);for(let $ of Z.animations)Y.delete($);X.ao=J.getArray(Y)}X.as=J.getArray(J.getSet(X.as,Z.animations))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=D0.serializeQuaternion(Z.rotation,this._world.tickAllocator)};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=D0.serializeVector(Z.position,this._world.tickAllocator)};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations.set(J.i,J)};_onParticleEmitterBurst=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.b=Z.count};_onParticleEmitterDespawn=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rm=!0};_onParticleEmitterSetAlphaTest=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.at=Z.alphaTest};_onParticleEmitterSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onParticleEmitterSetAttachedToEntityNodeName=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.en=Z.attachedToEntityNodeName};_onParticleEmitterSetColorEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ce=Z.colorEnd?D0.serializeRgbColor(Z.colorEnd,this._world.tickAllocator):void 0};_onParticleEmitterSetColorEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cev=Z.colorEndVariance?D0.serializeRgbColor(Z.colorEndVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cs=Z.colorStart?D0.serializeRgbColor(Z.colorStart,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.csv=Z.colorStartVariance?D0.serializeRgbColor(Z.colorStartVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetGravity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.g=Z.gravity?D0.serializeVector(Z.gravity,this._world.tickAllocator):void 0};_onParticleEmitterSetLifetime=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.l=Z.lifetime};_onParticleEmitterSetLifetimeVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.lv=Z.lifetimeVariance};_onParticleEmitterSetMaxParticles=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.mp=Z.maxParticles};_onParticleEmitterSetOffset=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onParticleEmitterSetOpacityEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oe=Z.opacityEnd};_onParticleEmitterSetOpacityEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oev=Z.opacityEndVariance};_onParticleEmitterSetOpacityStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.os=Z.opacityStart};_onParticleEmitterSetOpacityStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.osv=Z.opacityStartVariance};_onParticleEmitterSetPaused=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pa=Z.paused};_onParticleEmitterSetPosition=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e,J.en=Z.position?void 0:J.en};_onParticleEmitterSetPositionVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pv=Z.positionVariance?D0.serializeVector(Z.positionVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetRate=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.r=Z.rate};_onParticleEmitterSetRateVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rv=Z.rateVariance};_onParticleEmitterSetSizeEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.se=Z.sizeEnd};_onParticleEmitterSetSizeEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.sev=Z.sizeEndVariance};_onParticleEmitterSetSizeStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ss=Z.sizeStart};_onParticleEmitterSetSizeStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ssv=Z.sizeStartVariance};_onParticleEmitterSetTextureUri=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.tu=Z.textureUri};_onParticleEmitterSetTransparent=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.t=Z.transparent};_onParticleEmitterSetVelocity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.v=Z.velocity?D0.serializeVector(Z.velocity,this._world.tickAllocator):void 0};_onParticleEmitterSetVelocityVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.vv=Z.velocityVariance?D0.serializeVector(Z.velocityVariance,this._world.tickAllocator):void 0};_onParticleEmitterSpawn=(Z)=>{let J=Z.particleEmitter.serialize();this._queuedParticleEmitterSynchronizations.set(J.i,J)};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=D0.serializeVector(Z.entity.position,this._world.tickAllocator),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onPlayerCameraSetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.s=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onPlayerCameraSetShoulderAngle=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.sa=Z.shoulderAngle};_onPlayerCameraSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.et=Z.entity?Z.entity.id:void 0,delete J.pl,delete J.pt};_onPlayerCameraSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pt=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let J=this._world.tickAllocator,{player:X}=Z,Y=this._queuedPerPlayerSynchronizations.get(X)??J.getArray();Y.push(Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,J.map(this._world.chunkLattice.getAllChunks(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,J.map(this._world.entityManager.getAllEntities(!0),(Q)=>{if(X.camera.attachedToEntity===void 0&&Q instanceof v7&&Q.player===X)X.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,J.map(this._world.audioManager.getAllLoopedAudios(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,J.map(this._world.lightManager.getAllLights(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,J.map(this._world.particleEmitterManager.getAllParticleEmitters(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,J.map(this._world.sceneUIManager.getAllSceneUIs(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,J.map(V9.instance.getConnectedPlayers(),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray()));let $=this._createOrGetQueuedPlayerCameraSync(X.camera);this._queuedPerPlayerCameraSynchronizations.set(X,J.getObject(X.camera.serialize(),$)),this._queuedPerPlayerSynchronizations.set(X,Y),this._queuedPlayerSynchronizations.set(X.id,X.serialize())};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{let J=this._world.tickAllocator,X=J.getObject();X.r=Z.receivedAt,X.s=Date.now(),X.p=performance.now()-Z.receivedAtMs,X.n=this._world.loop.nextTickMs,Z.player.connection.send([Y0.createPacket(Y0.outboundPackets.syncResponsePacketDefinition,X,this._world.loop.currentTick,J.getArray())])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations.set(J.i,J),this._loadedSceneUIs.add(J.i)};_onSceneUISetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onSceneUISetOffset=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))this._queuedSceneUISynchronizations.delete(J.i),this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(D0.serializePhysicsDebugRaycast(Z,this._world.tickAllocator))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick,this._world.tickAllocator.getArray()))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=D0.serializeVector(Z.position,this._world.tickAllocator)};_onWorldSetFogColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetFogFar=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ff=Z.far};_onWorldSetFogNear=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fn=Z.near};_onWorldSetSkyboxIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.si=Z.intensity};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");let J=this._queuedAudioSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedAudioSynchronizations.set(Z.id,J);return J}_createOrGetQueuedBlockSync(Z){let{x:J,y:X,z:Y}=Z,$=`${J},${X},${Y}`,Q=this._queuedBlockSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.i=0,Q.c=[J,X,Y],this._queuedBlockSynchronizations.set($,Q);return Q}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)d.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:X,z:Y}=Z.originCoordinate,$=`${J},${X},${Y}`,Q=this._queuedChunkSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.c=[J,X,Y],this._queuedChunkSynchronizations.set($,Q);return Q}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");let J=this._queuedEntitySynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedEntitySynchronizations.set(Z.id,J);return J}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");let J=this._queuedLightSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedLightSynchronizations.set(Z.id,J);return J}_createOrGetQueuedParticleEmitterSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedParticleEmitterSync(): ParticleEmitter has no id!");let J=this._queuedParticleEmitterSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedParticleEmitterSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");let J=this._queuedPlayerSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedPlayerSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getArray(),this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");let J=this._queuedSceneUISynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedSceneUISynchronizations.set(Z.id,J);return J}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)d.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??=this._world.tickAllocator.getObject(),this._queuedWorldSynchronization.i=Z.id,this._queuedWorldSynchronization}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=this._world.tickAllocator.getArray(J),this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class GF{_particleEmitters=new Map;_nextParticleEmitterId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedParticleEmitters(Z){this.getAllEntityAttachedParticleEmitters(Z).forEach((J)=>{J.despawn()})}getAllParticleEmitters(Z=!1){return Z?this._world.tickAllocator.getArray(this._particleEmitters.values()):Array.from(this._particleEmitters.values())}getAllEntityAttachedParticleEmitters(Z){return this.getAllParticleEmitters().filter((J)=>J.attachedToEntity===Z)}registerParticleEmitter(Z){if(Z.id!==void 0)return Z.id;let J=this._nextParticleEmitterId;return this._particleEmitters.set(J,Z),this._nextParticleEmitterId++,J}unregisterParticleEmitter(Z){if(Z.id===void 0)return;this._particleEmitters.delete(Z.id)}}class zF{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(Z=!1){return Z?this._world.tickAllocator.getArray(this._sceneUIs.values()):Array.from(this._sceneUIs.values())}getAllEntityAttachedSceneUIs(Z){return this.getAllSceneUIs().filter((J)=>J.attachedToEntity===Z)}getSceneUIById(Z){return this._sceneUIs.get(Z)}registerSceneUI(Z){if(Z.id!==void 0)return Z.id;let J=this._nextSceneUIId;return this._sceneUIs.set(J,Z),this._nextSceneUIId++,J}unloadEntityAttachedSceneUIs(Z){this.getAllEntityAttachedSceneUIs(Z).forEach((J)=>{J.unload()})}unregisterSceneUI(Z){if(Z.id===void 0)return;this._sceneUIs.delete(Z.id)}}class HF{_allocatedArrays=[];_allocatedArray3Numbers=[];_allocatedArray4Numbers=[];_allocatedObjects=[];_allocatedSets=[];_arrayPool=[];_array3NumberPool=[];_array4NumberPool=[];_objectPool=[];_setPool=[];filter(Z,J){let X=this.getArray();for(let Y=0;Y<Z.length;Y++)if(J(Z[Y],Y,Z))X.push(Z[Y]);return X}getArray(Z,J){let X=this._arrayPool.pop()??[];X.length=0;let Y=0;if(Z)for(let $ of Z)X[Y++]=$;if(J)for(let $ of J)X[Y++]=$;return this._allocatedArrays.push(X),X}getArray3Number(Z){let J=this._array3NumberPool.pop()??[0,0,0];if(J[0]=J[1]=J[2]=0,Z){let X=0;for(let Y of Z){if(X>=3)break;J[X++]=Y}}return this._allocatedArray3Numbers.push(J),J}getArray4Number(Z){let J=this._array4NumberPool.pop()??[0,0,0,0];if(J[0]=J[1]=J[2]=J[3]=0,Z){let X=0;for(let Y of Z){if(X>=4)break;J[X++]=Y}}return this._allocatedArray4Numbers.push(J),J}getObject(Z,J){let X=this._objectPool.pop()??Object.create(null);for(let Y in X)delete X[Y];if(Z)Object.assign(X,Z);if(J)Object.assign(X,J);return this._allocatedObjects.push(X),X}getSet(Z,J){let X=this._setPool.pop()??new Set;if(X.clear(),Z)for(let Y of Z)X.add(Y);if(J)for(let Y of J)X.add(Y);return this._allocatedSets.push(X),X}map(Z,J){let X=this.getArray();X.length=Z.length;for(let Y=0;Y<Z.length;Y++)X[Y]=J(Z[Y],Y,Z);return X}reset(){for(let Z=0;Z<this._allocatedArrays.length;Z++)if(this._arrayPool.length<4096)this._arrayPool.push(this._allocatedArrays[Z]);for(let Z=0;Z<this._allocatedArray3Numbers.length;Z++)if(this._array3NumberPool.length<4096)this._array3NumberPool.push(this._allocatedArray3Numbers[Z]);for(let Z=0;Z<this._allocatedArray4Numbers.length;Z++)if(this._array4NumberPool.length<4096)this._array4NumberPool.push(this._allocatedArray4Numbers[Z]);for(let Z=0;Z<this._allocatedObjects.length;Z++)if(this._objectPool.length<4096)this._objectPool.push(this._allocatedObjects[Z]);for(let Z=0;Z<this._allocatedSets.length;Z++)if(this._setPool.length<1024)this._setPool.push(this._allocatedSets[Z]);this._allocatedArrays.length=0,this._allocatedArray3Numbers.length=0,this._allocatedArray4Numbers.length=0,this._allocatedObjects.length=0,this._allocatedSets.length=0}}var w46=2,B46=3;class VF{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,X){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*B46,this._tickFunction=J,this._tickErrorCallback=X}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get isStarted(){return!!this._tickHandle}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return;this._lastLoopTimeMs=performance.now();let Z=()=>{let J=performance.now(),X=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=X,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)V8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<w46)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,Y++});this._nextTickMs=Math.max(0,this._fixedTimestepMs-this._accumulatorMs),this._tickHandle=setTimeout(Z,this._nextTickMs)};Z()}stop(){if(!this._tickHandle)return;clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else d.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var p$1;((Q)=>{Q.START="WORLD_LOOP.START";Q.STOP="WORLD_LOOP.STOP";Q.TICK_START="WORLD_LOOP.TICK_START";Q.TICK_END="WORLD_LOOP.TICK_END";Q.TICK_ERROR="WORLD_LOOP.TICK_ERROR"})(p$1||={});class qF extends j0{_currentTick=0;_ticker;_world;constructor(Z,J=sy){super();this._ticker=new VF(J,this._tick,this._onTickError),this._world=Z}get currentTick(){return this._currentTick}get isStarted(){return this._ticker.isStarted}get nextTickMs(){return this._ticker.nextTickMs}get timestepS(){return this._ticker.fixedTimestepS}get world(){return this._world}start(){this._ticker.start(),this.emitWithWorld(this._world,"WORLD_LOOP.START",{worldLoop:this})}stop(){this._ticker.stop(),this.emitWithWorld(this._world,"WORLD_LOOP.STOP",{worldLoop:this})}_tick=(Z)=>{this.emitWithWorld(this._world,"WORLD_LOOP.TICK_START",{worldLoop:this,tickDeltaMs:Z});let J=performance.now();V8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:V9.instance.playerCount,targetTickRate:this._ticker.targetTicksPerSecond,targetTickRateMs:this._ticker.fixedTimestepMs,worldId:this._world.id,worldName:this._world.name,worldChunkCount:this._world.chunkLattice.chunkCount,worldEntityCount:this._world.entityManager.entityCount,worldLoopTick:this._currentTick}},()=>{V8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),V8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),V8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),V8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize()),V8.startSpan({operation:"release_tick_allocation"},()=>this._world.tickAllocator.reset())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{d.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var ry;((V)=>{V.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";V.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";V.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";V.SET_FOG_COLOR="WORLD.SET_FOG_COLOR";V.SET_FOG_FAR="WORLD.SET_FOG_FAR";V.SET_FOG_NEAR="WORLD.SET_FOG_NEAR";V.SET_SKYBOX_INTENSITY="WORLD.SET_SKYBOX_INTENSITY";V.START="WORLD.START";V.STOP="WORLD.STOP"})(ry||={});class FF extends j0{_id;_ambientLightColor;_ambientLightIntensity;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_entityManager;_fogColor;_fogFar;_fogNear;_lightManager;_loop;_name;_networkSynchronizer;_particleEmitterManager;_sceneUIManager;_simulation;_skyboxIntensity;_skyboxUri;_tag;_tickAllocator;constructor(Z){super();if(this._id=Z.id,this._ambientLightColor=Z.ambientLightColor??{r:255,g:255,b:255},this._ambientLightIntensity=Z.ambientLightIntensity??1,this._directionalLightColor=Z.directionalLightColor??{r:255,g:255,b:255},this._directionalLightIntensity=Z.directionalLightIntensity??3,this._directionalLightPosition=Z.directionalLightPosition??{x:100,y:150,z:100},this._fogColor=Z.fogColor,this._fogFar=Z.fogFar??550,this._fogNear=Z.fogNear??500,this._name=Z.name,this._skyboxIntensity=Z.skyboxIntensity??1,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new u3(this),this._blockTypeRegistry=new Fz(this),this._chatManager=new cz(this),this._chunkLattice=new lz(this),this._entityManager=new az(this),this._lightManager=new WF(this),this._loop=new qF(this,Z.tickRate),this._networkSynchronizer=new mR(this),this._particleEmitterManager=new GF(this),this._sceneUIManager=new zF(this),this._simulation=new KF(this,Z.tickRate,Z.gravity),this._tickAllocator=new HF,Z.map)this.loadMap(Z.map)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get entityManager(){return this._entityManager}get fogColor(){return this._fogColor}get fogFar(){return this._fogFar}get fogNear(){return this._fogNear}get lightManager(){return this._lightManager}get loop(){return this._loop}get name(){return this._name}get networkSynchronizer(){return this._networkSynchronizer}get particleEmitterManager(){return this._particleEmitterManager}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}get skyboxIntensity(){return this._skyboxIntensity}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get tickAllocator(){return this._tickAllocator}loadMap(Z){if(this.chunkLattice.clear(),Z.blockTypes)for(let J of Z.blockTypes)this.blockTypeRegistry.registerGenericBlockType({id:J.id,isLiquid:J.isLiquid,name:J.name,textureUri:J.textureUri});if(Z.blocks)for(let[J,X]of Object.entries(Z.blocks)){let[Y,$,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:$,z:Q},X)}if(Z.entities)for(let[J,X]of Object.entries(Z.entities)){let[Y,$,Q]=J.split(",").map(Number);new a8({isEnvironmental:!0,...X}).spawn(this,{x:Y,y:$,z:Q})}}setAmbientLightColor(Z){this._ambientLightColor=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_COLOR",{world:this,color:Z})}setAmbientLightIntensity(Z){this._ambientLightIntensity=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightColor(Z){this._directionalLightColor=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",{world:this,color:Z})}setDirectionalLightIntensity(Z){this._directionalLightIntensity=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightPosition(Z){this._directionalLightPosition=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",{world:this,position:Z})}setFogColor(Z){this._fogColor=Z,this.emit("WORLD.SET_FOG_COLOR",{world:this,color:Z})}setFogFar(Z){this._fogFar=Z,this.emit("WORLD.SET_FOG_FAR",{world:this,far:Z})}setFogNear(Z){this._fogNear=Z,this.emit("WORLD.SET_FOG_NEAR",{world:this,near:Z})}setSkyboxIntensity(Z){this._skyboxIntensity=Z,this.emit("WORLD.SET_SKYBOX_INTENSITY",{world:this,intensity:Z})}start(){if(this._loop.isStarted)return;this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){if(!this._loop.isStarted)return;this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return D0.serializeWorld(this,this._tickAllocator)}}var i$1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(i$1||={});class HY{static instance=new HY;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new FF({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),j0.globalInstance.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._defaultWorld??=this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"}),this._defaultWorld}getWorldsByTag(Z){let J=[];return this._worlds.forEach((X)=>{if(X.tag===Z)J.push(X)}),J}getWorld(Z){return this._worlds.get(Z)}setDefaultWorld(Z){this._defaultWorld=Z}}var n$1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(n$1||={});class V9{static instance=new V9;worldSelectionHandler;_connectionPlayers=new Map;constructor(){j0.globalInstance.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),j0.globalInstance.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),j0.globalInstance.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),j0.globalInstance.on("CONNECTION.CLOSED",({connection:Z})=>{this._onConnectionClosed(Z)})}get playerCount(){return this._connectionPlayers.size}getConnectedPlayers(){return Array.from(this._connectionPlayers.values())}getConnectedPlayersByWorld(Z){return this.getConnectedPlayers().filter((J)=>J.world===Z)}getConnectedPlayerByUsername(Z){return Array.from(this._connectionPlayers.values()).find((J)=>{return J.username.toLowerCase()===Z.toLowerCase()})}async _onConnectionOpened(Z,J){let X=new lW(Z,J);await X.loadInitialPersistedData(),this._connectionPlayers.set(Z,X),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:X});let Y=await this.worldSelectionHandler?.(X);X.joinWorld(Y??HY.instance.getDefaultWorld())}_onConnectionDisconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.resetInputs(),J.camera.reset()}_onConnectionReconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.reconnected(),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else d.warning(`PlayerManager._onConnectionReconnected(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}_onConnectionClosed(Z){let J=this._connectionPlayers.get(Z);if(J)J.disconnect(),this._connectionPlayers.delete(Z),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else d.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}Buffer.poolSize=134217728;var a$1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(a$1||={});function L46(Z){Q1.init().then(()=>{return AQ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(AQ.instance.worldManager.getDefaultWorld());else Z();AQ.instance.start()}).catch((J)=>{d.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class AQ{static _instance;_modelRegistry=k5.instance;_playerManager=V9.instance;_socket=m7.instance;_worldManager=HY.instance;_webServer=PK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new AQ;return this._instance}get modelRegistry(){return this._modelRegistry}get playerManager(){return this._playerManager}get socket(){return this._socket}get webServer(){return this._webServer}get worldManager(){return this._worldManager}start(){j0.globalInstance.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}var v0=0.000001,G1=typeof Float32Array!=="undefined"?Float32Array:Array,WZ=Math.random;var I55=Math.PI/180;if(!Math.hypot)Math.hypot=function(){var Z=0,J=arguments.length;while(J--)Z+=arguments[J]*arguments[J];return Math.sqrt(Z)};var l8={};D9(l8,{transpose:()=>P46,subtract:()=>o$1,sub:()=>u46,str:()=>_46,set:()=>D46,scale:()=>I46,rotate:()=>E46,multiplyScalarAndAdd:()=>g46,multiplyScalar:()=>y46,multiply:()=>s$1,mul:()=>m46,invert:()=>C46,identity:()=>R46,fromValues:()=>N46,fromScaling:()=>S46,fromRotation:()=>v46,frob:()=>x46,exactEquals:()=>f46,equals:()=>b46,determinant:()=>k46,create:()=>O46,copy:()=>M46,clone:()=>j46,adjoint:()=>T46,add:()=>h46,LDU:()=>A46});function O46(){var Z=new G1(4);if(G1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function j46(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function M46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function R46(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function N46(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function D46(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function P46(Z,J){if(Z===J){var X=J[1];Z[1]=J[2],Z[2]=X}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function C46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*Q-$*Y;if(!W)return null;return W=1/W,Z[0]=Q*W,Z[1]=-Y*W,Z[2]=-$*W,Z[3]=X*W,Z}function T46(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function k46(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function s$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*K+Q*G,Z[1]=$*K+W*G,Z[2]=Y*z+Q*H,Z[3]=$*z+W*H,Z}function E46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+Q*K,Z[1]=$*G+W*K,Z[2]=Y*-K+Q*G,Z[3]=$*-K+W*G,Z}function I46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1];return Z[0]=Y*K,Z[1]=$*K,Z[2]=Q*G,Z[3]=W*G,Z}function v46(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=-X,Z[3]=Y,Z}function S46(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function _46(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function x46(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function A46(Z,J,X,Y){return Z[2]=Y[2]/Y[0],X[0]=Y[0],X[1]=Y[1],X[3]=Y[3]-Z[2]*X[1],[Z,J,X]}function h46(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function o$1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z}function f46(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function b46(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}function y46(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function g46(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z}var m46=s$1,u46=o$1;var r1={};D9(r1,{transpose:()=>a46,translate:()=>t46,subtract:()=>t$1,sub:()=>B76,str:()=>G76,set:()=>i46,scale:()=>Z76,rotate:()=>e46,projection:()=>K76,normalFromMat4:()=>W76,multiplyScalarAndAdd:()=>q76,multiplyScalar:()=>V76,multiply:()=>r$1,mul:()=>w76,invert:()=>s46,identity:()=>n46,fromValues:()=>p46,fromTranslation:()=>J76,fromScaling:()=>Y76,fromRotation:()=>X76,fromQuat:()=>Q76,fromMat4:()=>d46,fromMat2d:()=>$76,frob:()=>z76,exactEquals:()=>F76,equals:()=>U76,determinant:()=>r46,create:()=>ty,copy:()=>l46,clone:()=>c46,adjoint:()=>o46,add:()=>H76});function ty(){var Z=new G1(9);if(G1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[5]=0,Z[6]=0,Z[7]=0;return Z[0]=1,Z[4]=1,Z[8]=1,Z}function d46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[4],Z[4]=J[5],Z[5]=J[6],Z[6]=J[8],Z[7]=J[9],Z[8]=J[10],Z}function c46(Z){var J=new G1(9);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J}function l46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function p46(Z,J,X,Y,$,Q,W,K,G){var z=new G1(9);return z[0]=Z,z[1]=J,z[2]=X,z[3]=Y,z[4]=$,z[5]=Q,z[6]=W,z[7]=K,z[8]=G,z}function i46(Z,J,X,Y,$,Q,W,K,G,z){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=W,Z[6]=K,Z[7]=G,Z[8]=z,Z}function n46(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=1,Z[5]=0,Z[6]=0,Z[7]=0,Z[8]=1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]=J[8]+X[8],Z}function t$1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z}function V76(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z}function q76(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z}function F76(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]}function U76(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=J[0],q=J[1],F=J[2],U=J[3],B=J[4],w=J[5],O=J[6],N=J[7],R=J[8];return Math.abs(X-V)<=v0*Math.max(1,Math.abs(X),Math.abs(V))&&Math.abs(Y-q)<=v0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs($-F)<=v0*Math.max(1,Math.abs($),Math.abs(F))&&Math.abs(Q-U)<=v0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(W-B)<=v0*Math.max(1,Math.abs(W),Math.abs(B))&&Math.abs(K-w)<=v0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(G-O)<=v0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-N)<=v0*Math.max(1,Math.abs(z),Math.abs(N))&&Math.abs(H-R)<=v0*Math.max(1,Math.abs(H),Math.abs(R))}var w76=r$1,B76=t$1;var e0={};D9(e0,{transpose:()=>N76,translate:()=>T76,targetTo:()=>r76,subtract:()=>QQ1,sub:()=>WZ6,str:()=>t76,set:()=>R76,scale:()=>k76,rotateZ:()=>S76,rotateY:()=>v76,rotateX:()=>I76,rotate:()=>E76,perspectiveZO:()=>i76,perspectiveNO:()=>YQ1,perspectiveFromFieldOfView:()=>n76,perspective:()=>p76,orthoZO:()=>s76,orthoNO:()=>$Q1,ortho:()=>a76,multiplyScalarAndAdd:()=>XZ6,multiplyScalar:()=>JZ6,multiply:()=>ZQ1,mul:()=>QZ6,lookAt:()=>o76,invert:()=>D76,identity:()=>e$1,getTranslation:()=>g76,getScaling:()=>XQ1,getRotation:()=>m76,frustum:()=>l76,fromZRotation:()=>b76,fromYRotation:()=>f76,fromXRotation:()=>h76,fromValues:()=>M76,fromTranslation:()=>_76,fromScaling:()=>x76,fromRotationTranslationScaleOrigin:()=>d76,fromRotationTranslationScale:()=>u76,fromRotationTranslation:()=>JQ1,fromRotation:()=>A76,fromQuat2:()=>y76,fromQuat:()=>c76,frob:()=>e76,exactEquals:()=>YZ6,equals:()=>$Z6,determinant:()=>C76,create:()=>L76,copy:()=>j76,clone:()=>O76,adjoint:()=>P76,add:()=>ZZ6});function L76(){var Z=new G1(16);if(G1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0;return Z[0]=1,Z[5]=1,Z[10]=1,Z[15]=1,Z}function O76(Z){var J=new G1(16);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J[9]=Z[9],J[10]=Z[10],J[11]=Z[11],J[12]=Z[12],J[13]=Z[13],J[14]=Z[14],J[15]=Z[15],J}function j76(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z[9]=J[9],Z[10]=J[10],Z[11]=J[11],Z[12]=J[12],Z[13]=J[13],Z[14]=J[14],Z[15]=J[15],Z}function M76(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){var w=new G1(16);return w[0]=Z,w[1]=J,w[2]=X,w[3]=Y,w[4]=$,w[5]=Q,w[6]=W,w[7]=K,w[8]=G,w[9]=z,w[10]=H,w[11]=V,w[12]=q,w[13]=F,w[14]=U,w[15]=B,w}function R76(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B,w){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=W,Z[6]=K,Z[7]=G,Z[8]=z,Z[9]=H,Z[10]=V,Z[11]=q,Z[12]=F,Z[13]=U,Z[14]=B,Z[15]=w,Z}function e$1(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[5]=1,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[10]=1,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0,Z[15]=1,Z}function N76(Z,J){if(Z===J){var X=J[1],Y=J[2],$=J[3],Q=J[6],W=J[7],K=J[11];Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=X,Z[6]=J[9],Z[7]=J[13],Z[8]=Y,Z[9]=Q,Z[11]=J[14],Z[12]=$,Z[13]=W,Z[14]=K}else Z[0]=J[0],Z[1]=J[4],Z[2]=J[8],Z[3]=J[12],Z[4]=J[1],Z[5]=J[5],Z[6]=J[9],Z[7]=J[13],Z[8]=J[2],Z[9]=J[6],Z[10]=J[10],Z[11]=J[14],Z[12]=J[3],Z[13]=J[7],Z[14]=J[11],Z[15]=J[15];return Z}function D76(Z,J){var X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K*$-G*Y)*2;return JQ1(Z,J,X),Z}function g76(Z,J){return Z[0]=J[12],Z[1]=J[13],Z[2]=J[14],Z}function XQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[4],W=J[5],K=J[6],G=J[8],z=J[9],H=J[10];return Z[0]=Math.hypot(X,Y,$),Z[1]=Math.hypot(Q,W,K),Z[2]=Math.hypot(G,z,H),Z}function m76(Z,J){var X=new G1(3);XQ1(X,J);var Y=1/X[0],$=1/X[1],Q=1/X[2],W=J[0]*Y,K=J[1]*$,G=J[2]*Q,z=J[4]*Y,H=J[5]*$,V=J[6]*Q,q=J[8]*Y,F=J[9]*$,U=J[10]*Q,B=W+H+U,w=0;if(B>0)w=Math.sqrt(B+1)*2,Z[3]=0.25*w,Z[0]=(V-F)/w,Z[1]=(q-G)/w,Z[2]=(K-z)/w;else if(W>H&&W>U)w=Math.sqrt(1+W-H-U)*2,Z[3]=(V-F)/w,Z[0]=0.25*w,Z[1]=(K+z)/w,Z[2]=(q+G)/w;else if(H>U)w=Math.sqrt(1+H-W-U)*2,Z[3]=(q-G)/w,Z[0]=(K+z)/w,Z[1]=0.25*w,Z[2]=(V+F)/w;else w=Math.sqrt(1+U-W-H)*2,Z[3]=(K-z)/w,Z[0]=(q+G)/w,Z[1]=(V+F)/w,Z[2]=0.25*w;return Z}function u76(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3],G=$+$,z=Q+Q,H=W+W,V=$*G,q=$*z,F=$*H,U=Q*z,B=Q*H,w=W*H,O=K*G,N=K*z,R=K*H,j=Y[0],P=Y[1],D=Y[2];return Z[0]=(1-(U+w))*j,Z[1]=(q+R)*j,Z[2]=(F-N)*j,Z[3]=0,Z[4]=(q-R)*P,Z[5]=(1-(V+w))*P,Z[6]=(B+O)*P,Z[7]=0,Z[8]=(F+N)*D,Z[9]=(B-O)*D,Z[10]=(1-(V+U))*D,Z[11]=0,Z[12]=X[0],Z[13]=X[1],Z[14]=X[2],Z[15]=1,Z}function d76(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", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+", "+Z[9]+", "+Z[10]+", "+Z[11]+", "+Z[12]+", "+Z[13]+", "+Z[14]+", "+Z[15]+")"}function e76(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8],Z[9],Z[10],Z[11],Z[12],Z[13],Z[14],Z[15])}function ZZ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z[4]=J[4]+X[4],Z[5]=J[5]+X[5],Z[6]=J[6]+X[6],Z[7]=J[7]+X[7],Z[8]=J[8]+X[8],Z[9]=J[9]+X[9],Z[10]=J[10]+X[10],Z[11]=J[11]+X[11],Z[12]=J[12]+X[12],Z[13]=J[13]+X[13],Z[14]=J[14]+X[14],Z[15]=J[15]+X[15],Z}function QQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z[9]=J[9]-X[9],Z[10]=J[10]-X[10],Z[11]=J[11]-X[11],Z[12]=J[12]-X[12],Z[13]=J[13]-X[13],Z[14]=J[14]-X[14],Z[15]=J[15]-X[15],Z}function JZ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z[9]=J[9]*X,Z[10]=J[10]*X,Z[11]=J[11]*X,Z[12]=J[12]*X,Z[13]=J[13]*X,Z[14]=J[14]*X,Z[15]=J[15]*X,Z}function XZ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z[9]=J[9]+X[9]*Y,Z[10]=J[10]+X[10]*Y,Z[11]=J[11]+X[11]*Y,Z[12]=J[12]+X[12]*Y,Z[13]=J[13]+X[13]*Y,Z[14]=J[14]+X[14]*Y,Z[15]=J[15]+X[15]*Y,Z}function YZ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]&&Z[9]===J[9]&&Z[10]===J[10]&&Z[11]===J[11]&&Z[12]===J[12]&&Z[13]===J[13]&&Z[14]===J[14]&&Z[15]===J[15]}function $Z6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=Z[9],q=Z[10],F=Z[11],U=Z[12],B=Z[13],w=Z[14],O=Z[15],N=J[0],R=J[1],j=J[2],P=J[3],D=J[4],C=J[5],T=J[6],k=J[7],x=J[8],S=J[9],A=J[10],I=J[11],v=J[12],b=J[13],m=J[14],n=J[15];return Math.abs(X-N)<=v0*Math.max(1,Math.abs(X),Math.abs(N))&&Math.abs(Y-R)<=v0*Math.max(1,Math.abs(Y),Math.abs(R))&&Math.abs($-j)<=v0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Q-P)<=v0*Math.max(1,Math.abs(Q),Math.abs(P))&&Math.abs(W-D)<=v0*Math.max(1,Math.abs(W),Math.abs(D))&&Math.abs(K-C)<=v0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-T)<=v0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-k)<=v0*Math.max(1,Math.abs(z),Math.abs(k))&&Math.abs(H-x)<=v0*Math.max(1,Math.abs(H),Math.abs(x))&&Math.abs(V-S)<=v0*Math.max(1,Math.abs(V),Math.abs(S))&&Math.abs(q-A)<=v0*Math.max(1,Math.abs(q),Math.abs(A))&&Math.abs(F-I)<=v0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=v0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(B-b)<=v0*Math.max(1,Math.abs(B),Math.abs(b))&&Math.abs(w-m)<=v0*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(O-n)<=v0*Math.max(1,Math.abs(O),Math.abs(n))}var QZ6=ZQ1,WZ6=QQ1;var P1={};D9(P1,{str:()=>XJ6,squaredLength:()=>AQ1,sqrLen:()=>VJ6,sqlerp:()=>wJ6,slerp:()=>lR,setAxisAngle:()=>TQ1,setAxes:()=>BJ6,set:()=>WJ6,scale:()=>SQ1,rotationTo:()=>UJ6,rotateZ:()=>sZ6,rotateY:()=>aZ6,rotateX:()=>nZ6,random:()=>tZ6,pow:()=>rZ6,normalize:()=>Xg,multiply:()=>kQ1,mul:()=>GJ6,ln:()=>IQ1,lerp:()=>zJ6,length:()=>xQ1,len:()=>HJ6,invert:()=>eZ6,identity:()=>lZ6,getAxisAngle:()=>pZ6,getAngle:()=>iZ6,fromValues:()=>$J6,fromMat3:()=>vQ1,fromEuler:()=>JJ6,exp:()=>EQ1,exactEquals:()=>qJ6,equals:()=>FJ6,dot:()=>_Q1,create:()=>Jg,copy:()=>QJ6,conjugate:()=>ZJ6,clone:()=>YJ6,calculateW:()=>oZ6,add:()=>KJ6});var J1={};D9(J1,{zero:()=>SZ6,transformQuat:()=>TZ6,transformMat4:()=>PZ6,transformMat3:()=>CZ6,subtract:()=>KQ1,sub:()=>hZ6,str:()=>_Z6,squaredLength:()=>qQ1,squaredDistance:()=>VQ1,sqrLen:()=>mZ6,sqrDist:()=>gZ6,set:()=>zZ6,scaleAndAdd:()=>LZ6,scale:()=>BZ6,round:()=>wZ6,rotateZ:()=>IZ6,rotateY:()=>EZ6,rotateX:()=>kZ6,random:()=>DZ6,normalize:()=>ey,negate:()=>OZ6,multiply:()=>GQ1,mul:()=>fZ6,min:()=>FZ6,max:()=>UZ6,lerp:()=>MZ6,length:()=>WQ1,len:()=>Zg,inverse:()=>jZ6,hermite:()=>RZ6,fromValues:()=>dR,forEach:()=>uZ6,floor:()=>qZ6,exactEquals:()=>xZ6,equals:()=>AZ6,dot:()=>cR,divide:()=>zQ1,div:()=>bZ6,distance:()=>HQ1,dist:()=>yZ6,cross:()=>UF,create:()=>uR,copy:()=>GZ6,clone:()=>KZ6,ceil:()=>VZ6,bezier:()=>NZ6,angle:()=>vZ6,add:()=>HZ6});function uR(){var Z=new G1(3);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function KZ6(Z){var J=new G1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function WQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function dR(Z,J,X){var Y=new G1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function GZ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function zZ6(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function HZ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function KQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function GQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function zQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function VZ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function qZ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function FZ6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z[2]=Math.min(J[2],X[2]),Z}function UZ6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z[2]=Math.max(J[2],X[2]),Z}function wZ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function BZ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function LZ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z}function HQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function VQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function qQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function OZ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function jZ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ey(Z,J){var X=J[0],Y=J[1],$=J[2],Q=X*X+Y*Y+$*$;if(Q>0)Q=1/Math.sqrt(Q);return Z[0]=J[0]*Q,Z[1]=J[1]*Q,Z[2]=J[2]*Q,Z}function cR(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function UF(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[0],K=X[1],G=X[2];return Z[0]=$*G-Q*K,Z[1]=Q*W-Y*G,Z[2]=Y*K-$*W,Z}function MZ6(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z}function RZ6(Z,J,X,Y,$,Q){var W=Q*Q,K=W*(2*Q-3)+1,G=W*(Q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[1]=$[1]*Math.cos(Y)-$[2]*Math.sin(Y),Q[2]=$[1]*Math.sin(Y)+$[2]*Math.cos(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function EZ6(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[2]*Math.sin(Y)+$[0]*Math.cos(Y),Q[1]=$[1],Q[2]=$[2]*Math.cos(Y)-$[0]*Math.sin(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function IZ6(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[0]*Math.cos(Y)-$[1]*Math.sin(Y),Q[1]=$[0]*Math.sin(Y)+$[1]*Math.cos(Y),Q[2]=$[2],Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function vZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2],G=Math.sqrt(X*X+Y*Y+$*$),z=Math.sqrt(Q*Q+W*W+K*K),H=G*z,V=H&&cR(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function SZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function _Z6(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function xZ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function AZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2];return Math.abs(X-Q)<=v0*Math.max(1,Math.abs(X),Math.abs(Q))&&Math.abs(Y-W)<=v0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-K)<=v0*Math.max(1,Math.abs($),Math.abs(K))}var hZ6=KQ1,fZ6=GQ1,bZ6=zQ1,yZ6=HQ1,gZ6=VQ1,Zg=WQ1,mZ6=qQ1,uZ6=function(){var Z=uR();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function dZ6(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function FQ1(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function UQ1(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function wQ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function BQ1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function LQ1(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function OQ1(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function jQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function MQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function RQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q;if(W>0)W=1/Math.sqrt(W);return Z[0]=X*W,Z[1]=Y*W,Z[2]=$*W,Z[3]=Q*W,Z}function NQ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function DQ1(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z[3]=K+Y*(X[3]-K),Z}function PQ1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function CQ1(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}var v55=function(){var Z=dZ6();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}}();function Jg(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function lZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function TQ1(Z,J,X){X=X*0.5;var Y=Math.sin(X);return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Math.cos(X),Z}function pZ6(Z,J){var X=Math.acos(J[3])*2,Y=Math.sin(X/2);if(Y>v0)Z[0]=J[0]/Y,Z[1]=J[1]/Y,Z[2]=J[2]/Y;else Z[0]=1,Z[1]=0,Z[2]=0;return X}function iZ6(Z,J){var X=_Q1(Z,J);return Math.acos(2*X*X-1)}function kQ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*H+W*K+$*z-Q*G,Z[1]=$*H+W*G+Q*K-Y*z,Z[2]=Q*H+W*z+Y*G-$*K,Z[3]=W*H-Y*K-$*G-Q*z,Z}function nZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+W*K,Z[1]=$*G+Q*K,Z[2]=Q*G-$*K,Z[3]=W*G-Y*K,Z}function aZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G-Q*K,Z[1]=$*G+W*K,Z[2]=Q*G+Y*K,Z[3]=W*G-$*K,Z}function sZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+$*K,Z[1]=$*G-Y*K,Z[2]=Q*G+W*K,Z[3]=W*G-Q*K,Z}function oZ6(Z,J){var X=J[0],Y=J[1],$=J[2];return Z[0]=X,Z[1]=Y,Z[2]=$,Z[3]=Math.sqrt(Math.abs(1-X*X-Y*Y-$*$)),Z}function EQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=Math.exp(Q),G=W>0?K*Math.sin(W)/W:0;return Z[0]=X*G,Z[1]=Y*G,Z[2]=$*G,Z[3]=K*Math.cos(W),Z}function IQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=W>0?Math.atan2(W,Q)/W:0;return Z[0]=X*K,Z[1]=Y*K,Z[2]=$*K,Z[3]=0.5*Math.log(X*X+Y*Y+$*$+Q*Q),Z}function rZ6(Z,J,X){return IQ1(Z,J),SQ1(Z,Z,X),EQ1(Z,Z),Z}function lR(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3],G=X[0],z=X[1],H=X[2],V=X[3],q,F,U,B,w;if(F=$*G+Q*z+W*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>v0)q=Math.acos(F),U=Math.sin(q),B=Math.sin((1-Y)*q)/U,w=Math.sin(Y*q)/U;else B=1-Y,w=Y;return Z[0]=B*$+w*G,Z[1]=B*Q+w*z,Z[2]=B*W+w*H,Z[3]=B*K+w*V,Z}function tZ6(Z){var J=WZ(),X=WZ(),Y=WZ(),$=Math.sqrt(1-J),Q=Math.sqrt(J);return Z[0]=$*Math.sin(2*Math.PI*X),Z[1]=$*Math.cos(2*Math.PI*X),Z[2]=Q*Math.sin(2*Math.PI*Y),Z[3]=Q*Math.cos(2*Math.PI*Y),Z}function eZ6(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q,K=W?1/W:0;return Z[0]=-X*K,Z[1]=-Y*K,Z[2]=-$*K,Z[3]=Q*K,Z}function ZJ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function vQ1(Z,J){var X=J[0]+J[4]+J[8],Y;if(X>0)Y=Math.sqrt(X+1),Z[3]=0.5*Y,Y=0.5/Y,Z[0]=(J[5]-J[7])*Y,Z[1]=(J[6]-J[2])*Y,Z[2]=(J[1]-J[3])*Y;else{var $=0;if(J[4]>J[0])$=1;if(J[8]>J[$*3+$])$=2;var Q=($+1)%3,W=($+2)%3;Y=Math.sqrt(J[$*3+$]-J[Q*3+Q]-J[W*3+W]+1),Z[$]=0.5*Y,Y=0.5/Y,Z[3]=(J[Q*3+W]-J[W*3+Q])*Y,Z[Q]=(J[Q*3+$]+J[$*3+Q])*Y,Z[W]=(J[W*3+$]+J[$*3+W])*Y}return Z}function JJ6(Z,J,X,Y){var $=0.5*Math.PI/180;J*=$,X*=$,Y*=$;var Q=Math.sin(J),W=Math.cos(J),K=Math.sin(X),G=Math.cos(X),z=Math.sin(Y),H=Math.cos(Y);return Z[0]=Q*G*H-W*K*z,Z[1]=W*K*H+Q*G*z,Z[2]=W*G*z-Q*K*H,Z[3]=W*G*H+Q*K*z,Z}function XJ6(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var YJ6=FQ1,$J6=UQ1,QJ6=wQ1,WJ6=BQ1,KJ6=LQ1,GJ6=kQ1,SQ1=OQ1,_Q1=NQ1,zJ6=DQ1,xQ1=jQ1,HJ6=xQ1,AQ1=MQ1,VJ6=AQ1,Xg=RQ1,qJ6=PQ1,FJ6=CQ1,UJ6=function(){var Z=uR(),J=dR(1,0,0),X=dR(0,1,0);return function(Y,$,Q){var W=cR($,Q);if(W<-0.999999){if(UF(Z,J,$),Zg(Z)<0.000001)UF(Z,X,$);return ey(Z,Z),TQ1(Y,Z,Math.PI),Y}else if(W>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return UF(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+W,Xg(Y,Y)}}(),wJ6=function(){var Z=Jg(),J=Jg();return function(X,Y,$,Q,W,K){return lR(Z,Y,W,K),lR(J,$,Q,K),lR(X,Z,J,2*K*(1-K)),X}}(),BJ6=function(){var Z=ty();return function(J,X,Y,$){return Z[0]=Y[0],Z[3]=Y[1],Z[6]=Y[2],Z[1]=$[0],Z[4]=$[1],Z[7]=$[2],Z[2]=-X[0],Z[5]=-X[1],Z[8]=-X[2],Xg(J,vQ1(J,Z))}}();var V1={};D9(V1,{zero:()=>dJ6,transformMat4:()=>gJ6,transformMat3:()=>yJ6,transformMat2d:()=>bJ6,transformMat2:()=>fJ6,subtract:()=>fQ1,sub:()=>nJ6,str:()=>cJ6,squaredLength:()=>dQ1,squaredDistance:()=>mQ1,sqrLen:()=>tJ6,sqrDist:()=>rJ6,set:()=>MJ6,scaleAndAdd:()=>EJ6,scale:()=>kJ6,round:()=>TJ6,rotate:()=>mJ6,random:()=>hJ6,normalize:()=>SJ6,negate:()=>IJ6,multiply:()=>bQ1,mul:()=>aJ6,min:()=>PJ6,max:()=>CJ6,lerp:()=>AJ6,length:()=>uQ1,len:()=>iJ6,inverse:()=>vJ6,fromValues:()=>OJ6,forEach:()=>eJ6,floor:()=>DJ6,exactEquals:()=>lJ6,equals:()=>pJ6,dot:()=>_J6,divide:()=>yQ1,div:()=>sJ6,distance:()=>gQ1,dist:()=>oJ6,cross:()=>xJ6,create:()=>hQ1,copy:()=>jJ6,clone:()=>LJ6,ceil:()=>NJ6,angle:()=>uJ6,add:()=>RJ6});function hQ1(){var Z=new G1(2);if(G1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function LJ6(Z){var J=new G1(2);return J[0]=Z[0],J[1]=Z[1],J}function OJ6(Z,J){var X=new G1(2);return X[0]=Z,X[1]=J,X}function jJ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function MJ6(Z,J,X){return Z[0]=J,Z[1]=X,Z}function RJ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function fQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function bQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function yQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function NJ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function DJ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function PJ6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function CJ6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function TJ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function kJ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function EJ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function gQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function mQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function uQ1(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function dQ1(Z){var J=Z[0],X=Z[1];return J*J+X*X}function IJ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function vJ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function SJ6(Z,J){var X=J[0],Y=J[1],$=X*X+Y*Y;if($>0)$=1/Math.sqrt($);return Z[0]=J[0]*$,Z[1]=J[1]*$,Z}function _J6(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function xJ6(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function AJ6(Z,J,X,Y){var $=J[0],Q=J[1];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z}function hJ6(Z,J){J=J||1;var X=WZ()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function fJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$,Z[1]=X[1]*Y+X[3]*$,Z}function bJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$+X[4],Z[1]=X[1]*Y+X[3]*$+X[5],Z}function yJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[3]*$+X[6],Z[1]=X[1]*Y+X[4]*$+X[7],Z}function gJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[4]*$+X[12],Z[1]=X[1]*Y+X[5]*$+X[13],Z}function mJ6(Z,J,X,Y){var $=J[0]-X[0],Q=J[1]-X[1],W=Math.sin(Y),K=Math.cos(Y);return Z[0]=$*K-Q*W+X[0],Z[1]=$*W+Q*K+X[1],Z}function uJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1],W=Math.sqrt(X*X+Y*Y)*Math.sqrt($*$+Q*Q),K=W&&(X*$+Y*Q)/W;return Math.acos(Math.min(Math.max(K,-1),1))}function dJ6(Z){return Z[0]=0,Z[1]=0,Z}function cJ6(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function lJ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function pJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1];return Math.abs(X-$)<=v0*Math.max(1,Math.abs(X),Math.abs($))&&Math.abs(Y-Q)<=v0*Math.max(1,Math.abs(Y),Math.abs(Q))}var iJ6=uQ1,nJ6=fQ1,aJ6=bQ1,sJ6=yQ1,oJ6=gQ1,rJ6=mQ1,tJ6=dQ1,eJ6=function(){var Z=hQ1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=2;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1];return J}}();class fQ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return l8.determinant(this)}get frobeniusNorm(){return l8.frob(this)}static create(){let Z=new fQ(0,0,0,0);return l8.identity(Z),Z}static fromRotation(Z){let J=fQ.create();return l8.fromRotation(J,Z),J}static fromScaling(Z){let J=fQ.create();return l8.fromScaling(J,Z),J}add(Z){return l8.add(this,this,Z),this}adjoint(){return l8.adjoint(this,this),this}clone(){return new fQ(this[0],this[1],this[2],this[3])}copy(Z){return l8.copy(this,Z),this}equals(Z){return l8.equals(this,Z)}exactEquals(Z){return l8.exactEquals(this,Z)}identity(){return l8.identity(this),this}invert(){return l8.invert(this,this),this}multiply(Z){return l8.mul(this,this,Z),this}multiplyScalar(Z){return l8.multiplyScalar(this,this,Z),this}rotate(Z){return l8.rotate(this,this,Z),this}subtract(Z){return l8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return l8.transpose(this,this),this}}class KZ extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G){super([Z,J,X,Y,$,Q,W,K,G])}get determinant(){return r1.determinant(this)}get frobeniusNorm(){return r1.frob(this)}static create(){let Z=new KZ(0,0,0,0,0,0,0,0,0);return r1.identity(Z),Z}static fromMatrix4(Z){let J=KZ.create();return r1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=KZ.create();return r1.fromQuat(J,Z),J}static fromRotation(Z){let J=KZ.create();return r1.fromRotation(J,Z),J}static fromScaling(Z){let J=KZ.create();return r1.fromScaling(J,Z),J}static fromTranslation(Z){let J=KZ.create();return r1.fromTranslation(J,Z),J}add(Z){return r1.add(this,this,Z),this}adjoint(){return r1.adjoint(this,this),this}clone(){return new KZ(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return r1.copy(this,Z),this}equals(Z){return r1.equals(this,Z)}exactEquals(Z){return r1.exactEquals(this,Z)}identity(){return r1.identity(this),this}invert(){return r1.invert(this,this),this}multiply(Z){return r1.mul(this,this,Z),this}multiplyScalar(Z){return r1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return r1.projection(this,Z,J),this}rotate(Z){return r1.rotate(this,this,Z),this}subtract(Z){return r1.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]},${this[2]}][${this[3]},${this[4]},${this[5]}][${this[6]},${this[7]},${this[8]}]`}transpose(){return r1.transpose(this,this),this}}class j5 extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){super([Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B])}get determinant(){return e0.determinant(this)}get frobeniusNorm(){return e0.frob(this)}static create(){let Z=new j5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e0.identity(Z),Z}static fromQuaternion(Z){let J=j5.create();return e0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=j5.create();return e0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=j5.create();return e0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=j5.create();return e0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=j5.create();return e0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=j5.create();return e0.fromScaling(J,Z),J}static fromTranslation(Z){let J=j5.create();return e0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=j5.create();return e0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=j5.create();return e0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=j5.create();return e0.fromZRotation(J,Z),J}add(Z){return e0.add(this,this,Z),this}adjoint(){return e0.adjoint(this,this),this}clone(){return new j5(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8],this[9],this[10],this[11],this[12],this[13],this[14],this[15])}copy(Z){return e0.copy(this,Z),this}equals(Z){return e0.equals(this,Z)}exactEquals(Z){return e0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return e0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return e0.identity(this),this}invert(){return e0.invert(this,this),this}lookAt(Z,J,X){return e0.lookAt(this,Z,J,X),this}multiply(Z){return e0.mul(this,this,Z),this}multiplyScalar(Z){return e0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return e0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return e0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return e0.rotate(this,this,Z,J),this}rotateX(Z){return e0.rotateX(this,this,Z),this}rotateY(Z){return e0.rotateY(this,this,Z),this}rotateZ(Z){return e0.rotateZ(this,this,Z),this}scale(Z){return e0.scale(this,this,Z),this}subtract(Z){return e0.sub(this,this,Z),this}targetTo(Z,J,X){return e0.targetTo(this,Z,J,X),this}toString(){return`[${this[0]},${this[1]},${this[2]},${this[3]}][${this[4]},${this[5]},${this[6]},${this[7]}][${this[8]},${this[9]},${this[10]},${this[11]}][${this[12]},${this[13]},${this[14]},${this[15]}]`}translate(Z){return e0.translate(this,this,Z),this}transpose(){return e0.transpose(this,this),this}}class b3 extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return P1.length(this)}get squaredLength(){return P1.squaredLength(this)}get magnitude(){return P1.length(this)}get squaredMagnitude(){return P1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}get w(){return this[3]}set w(Z){this[3]=Z}static fromEuler(Z,J,X){let Y=P1.fromEuler(new Float32Array(4),Z,J,X);return new b3(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new b3(Z.x,Z.y,Z.z,Z.w)}clone(){return new b3(this.x,this.y,this.z,this.w)}conjugate(){return P1.conjugate(this,this),this}copy(Z){return P1.copy(this,Z),this}dot(Z){return P1.dot(this,Z)}exponential(){return P1.exp(this,this),this}equals(Z){return P1.equals(this,Z)}exactEquals(Z){return P1.exactEquals(this,Z)}getAngle(Z){return P1.getAngle(this,Z)}identity(){return P1.identity(this),this}invert(){return P1.invert(this,this),this}lerp(Z,J){return P1.lerp(this,this,Z,J),this}logarithm(){return P1.ln(this,this),this}multiply(Z){return P1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return P1.normalize(this,this),this}power(Z){return P1.pow(this,this,Z),this}randomize(){return P1.random(this),this}rotateX(Z){return P1.rotateX(this,this,Z),this}rotateY(Z){return P1.rotateY(this,this,Z),this}rotateZ(Z){return P1.rotateZ(this,this,Z),this}scale(Z){return P1.scale(this,this,Z),this}setAxisAngle(Z,J){return P1.setAxisAngle(this,Z,J),this}slerp(Z,J){return P1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class wF extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return V1.length(this)}get squaredLength(){return V1.squaredLength(this)}get magnitude(){return V1.length(this)}get squaredMagnitude(){return V1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}static create(){return new wF(0,0)}add(Z){return V1.add(this,this,Z),this}angle(Z){return V1.angle(this,Z)}ceil(){return V1.ceil(this,this),this}clone(){return new wF(this.x,this.y)}copy(Z){return V1.copy(this,Z),this}distance(Z){return V1.distance(this,Z)}divide(Z){return V1.divide(this,this,Z),this}dot(Z){return V1.dot(this,Z)}equals(Z){return V1.equals(this,Z)}exactEquals(Z){return V1.exactEquals(this,Z)}floor(){return V1.floor(this,this),this}invert(){return V1.inverse(this,this),this}lerp(Z,J){return V1.lerp(this,this,Z,J),this}max(Z){return V1.max(this,this,Z),this}min(Z){return V1.min(this,this,Z),this}multiply(Z){return V1.mul(this,this,Z),this}negate(){return V1.negate(this,this),this}normalize(){return V1.normalize(this,this),this}randomize(Z){return V1.random(this,Z),this}rotate(Z,J){return V1.rotate(this,this,Z,J),this}round(){return V1.round(this,this),this}scale(Z){return V1.scale(this,this,Z),this}scaleAndAdd(Z,J){return V1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return V1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return V1.transformMat2(this,this,Z),this}transformMatrix3(Z){return V1.transformMat3(this,this,Z),this}transformMatrix4(Z){return V1.transformMat4(this,this,Z),this}zero(){return V1.zero(this),this}}class y3 extends Float32Array{constructor(Z,J,X){super([Z,J,X])}get length(){return J1.length(this)}get squaredLength(){return J1.squaredLength(this)}get magnitude(){return J1.length(this)}get squaredMagnitude(){return J1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}static create(){return new y3(0,0,0)}static fromVector3Like(Z){return new y3(Z.x,Z.y,Z.z)}add(Z){return J1.add(this,this,Z),this}ceil(){return J1.ceil(this,this),this}clone(){return new y3(this.x,this.y,this.z)}copy(Z){return J1.copy(this,Z),this}cross(Z){return J1.cross(this,this,Z),this}distance(Z){return J1.distance(this,Z)}divide(Z){return J1.div(this,this,Z),this}dot(Z){return J1.dot(this,Z)}equals(Z){return J1.equals(this,Z)}exactEquals(Z){return J1.exactEquals(this,Z)}floor(){return J1.floor(this,this),this}invert(){return J1.inverse(this,this),this}lerp(Z,J){return J1.lerp(this,this,Z,J),this}max(Z){return J1.max(this,this,Z),this}min(Z){return J1.min(this,this,Z),this}multiply(Z){return J1.mul(this,this,Z),this}negate(){return J1.negate(this,this),this}normalize(){return J1.normalize(this,this),this}randomize(Z){return J1.random(this,Z),this}rotateX(Z,J){return J1.rotateX(this,this,Z,J),this}rotateY(Z,J){return J1.rotateY(this,this,Z,J),this}rotateZ(Z,J){return J1.rotateZ(this,this,Z,J),this}round(){return J1.round(this,this),this}scale(Z){return J1.scale(this,this,Z),this}scaleAndAdd(Z,J){return J1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return J1.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return J1.transformMat3(this,this,Z),this}transformMatrix4(Z){return J1.transformMat4(this,this,Z),this}transformQuaternion(Z){return J1.transformQuat(this,this,Z),this}zero(){return J1.zero(this),this}}var C1=function(Z,J,X,Y){function $(Q){return Q instanceof X?Q:new X(function(W){W(Q)})}return new(X||(X=Promise))(function(Q,W){function K(H){try{z(Y.next(H))}catch(V){W(V)}}function G(H){try{z(Y.throw(H))}catch(V){W(V)}}function z(H){H.done?Q(H.value):$(H.value).then(K,G)}z((Y=Y.apply(Z,J||[])).next())})},R1=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=K(0),W.throw=K(1),W.return=K(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(W&&(W=0,z[0]&&(X=0)),X)try{if(Y=1,$&&(Q=z[0]&2?$.return:z[0]?$.throw||((Q=$.return)&&Q.call($),0):$.next)&&!(Q=Q.call($,z[1])).done)return Q;if($=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,$=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if((Q=X.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){X.label=z[1];break}if(z[0]===6&&X.label<Q[1]){X.label=Q[1],Q=z;break}if(Q&&X.label<Q[2]){X.label=Q[2],X.ops.push(z);break}if(Q[2])X.ops.pop();X.trys.pop();continue}z=J.call(Z,X)}catch(H){z=[6,H],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},s5=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],W;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(K){W={error:K}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(W)throw W.error}}return Q},U4=function(Z,J,X){if(X||arguments.length===2){for(var Y=0,$=J.length,Q;Y<$;Y++)if(Q||!(Y in J)){if(!Q)Q=Array.prototype.slice.call(J,0,Y);Q[Y]=J[Y]}}return Z.concat(Q||Array.prototype.slice.call(J))},cQ1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,X=J&&Z[J],Y=0;if(X)return X.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&Y>=Z.length)Z=void 0;return{value:Z&&Z[Y++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},b55=function(){function Z(J){if(J===void 0)J=Z.minComparator;var X=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function(Y,$){return X.compare(Y,$).then(function(Q){return-1*Q})}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:2;return Math.floor((J-X)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:-1;return J+X},Z.minComparator=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){if(J>X)return[2,1];else if(J<X)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){if(X>J)return[2,1];else if(X<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J===X]})})},Z.print=function(J){function X(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var $=0,Q=[],W=X(J.length-1)+2,K=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(H,V){var q=Math.pow(2,W-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
|
|
485
|
+
`);let{connect:G,buffered:z}=await K;if(Z.emit("proxyConnect",G),this.emit("proxyConnect",G,Z),G.statusCode===200){if(Z.once("socket",g96),J.secureEndpoint){$F("Upgrading socket connection to TLS");let V=J.servername||J.host;return yy.connect({...E$1(J,"host","path","port"),socket:Y,servername:LJ.isIP(V)?void 0:V})}return Y}Y.destroy();let H=new LJ.Socket({writable:!1});return H.readable=!0,Z.once("socket",(V)=>{$F("Replaying proxy buffer for failed request"),V.push(z),V.push(null)}),H}}_R.__initStatic();function g96(Z){Z.resume()}function E$1(Z,...J){let X={},Y;for(Y in Z)if(!J.includes(Y))X[Y]=Z[Y];return X}var l96=32768;function p96(Z){return new d96({read(){this.push(Z),this.push(null)}})}function xR(Z){let J;try{J=new URL(Z.url)}catch(G){return K8(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),gK(Z,()=>Promise.resolve({}))}let X=J.protocol==="https:",Y=i96(J,Z.proxy||(X?process.env.https_proxy:void 0)||process.env.http_proxy),$=X?u96:m96,Q=Z.keepAlive===void 0?!1:Z.keepAlive,W=Y?new _R(Y):new $.Agent({keepAlive:Q,maxSockets:30,timeout:2000}),K=n96(Z,Z.httpModule??$,W);return gK(Z,K)}function i96(Z,J){let{no_proxy:X}=process.env;if(X?.split(",").some(($)=>Z.host.endsWith($)||Z.hostname.endsWith($)))return;else return J}function n96(Z,J,X){let{hostname:Y,pathname:$,port:Q,protocol:W,search:K}=new URL(Z.url);return function G(z){return new Promise((H,V)=>{wV(()=>{let q=p96(z.body),F={...Z.headers};if(z.body.length>l96)F["content-encoding"]="gzip",q=q.pipe(c96());let U=J.request({method:"POST",agent:X,headers:F,hostname:Y,path:`${$}${K}`,port:Q,protocol:W,ca:Z.caCerts},(B)=>{B.on("data",()=>{}),B.on("end",()=>{}),B.setEncoding("utf8");let w=B.headers["retry-after"]??null,O=B.headers["x-sentry-rate-limits"]??null;H({statusCode:B.statusCode,headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(O)?O[0]||null:O}})});U.on("error",V),q.pipe(U)})})}}var a96=new Set(["false","f","n","no","off","0"]),s96=new Set(["true","t","y","yes","on","1"]);function AR(Z,J){let X=String(Z).toLowerCase();if(a96.has(X))return!1;if(s96.has(X))return!0;return J?.strict?null:Boolean(Z)}import{posix as o96,sep as r96}from"path";function I$1(Z){return Z.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function hR(Z=process.argv[1]?p_(process.argv[1]):process.cwd(),J=r96==="\\"){let X=J?I$1(Z):Z;return(Y)=>{if(!Y)return;let $=J?I$1(Y):Y,{dir:Q,base:W,ext:K}=o96.parse($);if(K===".js"||K===".mjs"||K===".cjs")W=W.slice(0,K.length*-1);let G=decodeURIComponent(W);if(!Q)Q=".";let z=Q.lastIndexOf("/node_modules");if(z>-1)return`${Q.slice(z+14).replace(/\//g,".")}:${G}`;if(Q.startsWith(X)){let H=Q.slice(X.length+1).replace(/\//g,".");return H?`${H}:${G}`:G}return G}}function fR(Z){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if(O0.SENTRY_RELEASE?.id)return O0.SENTRY_RELEASE.id;let J=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,X=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,Y=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return J||X||Y||Z}var bR=$O(Yx(hR()));var S$1=e(X0(),1);import*as v$1 from"os";import{threadId as t96,isMainThread as e96}from"worker_threads";var Z46=60000;class QF extends jO{constructor(Z){let J=Z.serverName||global.process.env.SENTRY_NAME||v$1.hostname(),X={...Z,platform:"node",runtime:{name:"node",version:global.process.version},serverName:J};if(Z.openTelemetryInstrumentations)Q3({instrumentations:Z.openTelemetryInstrumentations});f_(X,"node"),g.log(`Initializing Sentry: process: ${process.pid}, thread: ${e96?"main":`worker-${t96}`}.`);super(X);if(this.getOptions()._experiments?.enableLogs){if(this._logOnExitFlushListener=()=>{BX(this)},J)this.on("beforeCaptureLog",(Y)=>{Y.attributes={...Y.attributes,"server.address":J}});process.on("beforeExit",this._logOnExitFlushListener)}}get tracer(){if(this._tracer)return this._tracer;let Z="@sentry/node",J=L8,X=S$1.trace.getTracer(Z,J);return this._tracer=X,X}async flush(Z){let X=this.traceProvider?.activeSpanProcessor;if(X)await X.forceFlush();if(this.getOptions().sendClientReports)this._flushOutcomes();return super.flush(Z)}close(Z){if(this._clientReportInterval)clearInterval(this._clientReportInterval);if(this._clientReportOnExitFlushListener)process.off("beforeExit",this._clientReportOnExitFlushListener);if(this._logOnExitFlushListener)process.off("beforeExit",this._logOnExitFlushListener);return super.close(Z)}startClientReportTracking(){let Z=this.getOptions();if(Z.sendClientReports)this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{m0&&g.log("Flushing client reports based on interval."),this._flushOutcomes()},Z.clientReportFlushInterval??Z46).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener)}_getTraceInfoFromScope(Z){if(!Z)return[void 0,void 0];return J81(this,Z)}}var W7=e(X0(),1);var h3=e(D1(),1);var _$1=e(vj(),1);import J46 from"module";var gy=1e6;function yR(Z,J={}){if(Z.getOptions().debug)A$1();let X=Y46(Z,J);Z.traceProvider=X}function my(){let[Z=0,J=0]=process.versions.node.split(".").map(Number);if(Z>=21||Z===20&&J>=6||Z===18&&J>=19){if(!O0._sentryEsmLoaderHookRegistered)try{let{addHookMessagePort:X}=_$1.createAddHookMessageChannel();J46.register("import-in-the-middle/hook.mjs",import.meta.url,{data:{addHookMessagePort:X,include:[]},transferList:[X]})}catch(X){g.warn("Failed to register ESM hook",X)}}else K8(()=>{console.warn(`[Sentry] You are using Node.js v${process.versions.node} in ESM mode ("import syntax"). The Sentry Node.js SDK is not compatible with ESM in Node.js versions before 18.19.0 or before 20.6.0. Please either build your application with CommonJS ("require() syntax"), or upgrade your Node.js version.`)})}function x$1(Z={}){let{debug:J}=Z;if(J)g.enable(),A$1();if(!K4())my();X46(Z.integrations).forEach((X)=>{if(X(),J)g.log(`[Sentry] Preloaded ${X.id} instrumentation`)})}function X46(Z){let J=T$1();if(!Z)return J;return J.filter((X)=>Z.includes(X.id))}function Y46(Z,J={}){let X=new Rf({sampler:new uf(Z),resource:new w3({[h3.ATTR_SERVICE_NAME]:"node",[h3.SEMRESATTRS_SERVICE_NAMESPACE]:"sentry",[h3.ATTR_SERVICE_VERSION]:L8}),forceFlushTimeoutMillis:500,spanProcessors:[new mf({timeout:$46(Z.getOptions().maxSpanWaitDuration)}),...J.spanProcessors||[]]});return W7.trace.setGlobalTracerProvider(X),W7.propagation.setGlobalPropagator(new hf),W7.context.setGlobalContextManager(new IR),X}function $46(Z){if(Z==null)return;if(Z>gy)return m0&&g.warn(`\`maxSpanWaitDuration\` is too high, using the maximum value of ${gy}`),gy;else if(Z<=0||Number.isNaN(Z)){m0&&g.warn("`maxSpanWaitDuration` must be a positive number, using default value instead.");return}return Z}function A$1(){let Z=new Proxy(g,{get(J,X,Y){return Reflect.get(J,X==="verbose"?"debug":X,Y)}});W7.diag.disable(),W7.diag.setLogger(Z,W7.DiagLogLevel.DEBUG)}function Q46(){return K4()?[TM()]:[]}function uy(){return[PV(),DV(),CV(),TV(),kV(),wM(),OM(),kM(),EM(),NM(),CM(),RM(),kR(),C$1(),...Q46()]}function dy(Z){return[...uy(),...G5(Z)?vR():[]]}function gR(Z={}){return f$1(Z,dy)}function h$1(Z={}){return f$1(Z,()=>[])}function f$1(Z={},J){let X=W46(Z,J);if(X.debug===!0)if(m0)g.enable();else K8(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")});if(!K4()&&X.registerEsmLoaderHooks!==!1)my();if(qM(),l0().update(X.initialScope),X.spotlight&&!X.integrations.some(({name:Q})=>Q===Dy))X.integrations.push(BR({sidecarUrl:typeof X.spotlight==="string"?X.spotlight:void 0}));let $=new QF(X);if(l0().setClient($),$.init(),g.log(`Running in ${K4()?"CommonJS":"ESM"} mode.`),$.startClientReportTracking(),z46(),!X.skipOpenTelemetrySetup)yR($,{spanProcessors:X.openTelemetrySpanProcessors}),cy();return i11($),X81($),$}function cy(){if(!m0)return;let Z=o11(),J=["SentryContextManager","SentryPropagator"];if(G5())J.push("SentrySpanProcessor");for(let X of J)if(!Z.includes(X))g.error(`You have to set up the ${X}. Without this, the OpenTelemetry & Sentry integration will not work properly.`);if(!Z.includes("SentrySampler"))g.warn("You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.")}function W46(Z,J){let X=K46(Z.release),Y=Z.spotlight??AR(process.env.SENTRY_SPOTLIGHT,{strict:!0})??process.env.SENTRY_SPOTLIGHT,$=G46(Z.tracesSampleRate),Q={...Z,dsn:Z.dsn??process.env.SENTRY_DSN,environment:Z.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:Z.sendClientReports??!0,transport:Z.transport??xR,stackParser:iS(Z.stackParser||bR),release:X,tracesSampleRate:$,spotlight:Y,debug:AR(Z.debug??process.env.SENTRY_DEBUG)},W=Z.integrations,K=Z.defaultIntegrations??J(Q);return{...Q,integrations:C_({defaultIntegrations:K,integrations:W})}}function K46(Z){if(Z!==void 0)return Z;let J=fR();if(J!==void 0)return J;return}function G46(Z){if(Z!==void 0)return Z;let J=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!J)return;let X=parseFloat(J);return isFinite(X)?X:void 0}function z46(){if(AR(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let Z=process.env.SENTRY_TRACE,J=process.env.SENTRY_BAGGAGE,X=A$(Z,J);l0().setPropagationContext(X)}}var H46=[["january","1"],["february","2"],["march","3"],["april","4"],["may","5"],["june","6"],["july","7"],["august","8"],["september","9"],["october","10"],["november","11"],["december","12"],["jan","1"],["feb","2"],["mar","3"],["apr","4"],["may","5"],["jun","6"],["jul","7"],["aug","8"],["sep","9"],["oct","10"],["nov","11"],["dec","12"],["sunday","0"],["monday","1"],["tuesday","2"],["wednesday","3"],["thursday","4"],["friday","5"],["saturday","6"],["sun","0"],["mon","1"],["tue","2"],["wed","3"],["thu","4"],["fri","5"],["sat","6"]];function _Q(Z){return H46.reduce((J,[X,Y])=>J.replace(new RegExp(X,"gi"),Y),Z)}var b$1="Automatic instrumentation of CronJob only supports crontab string";function y$1(Z,J){let X=!1;return new Proxy(Z,{construct(Y,$){let[Q,W,K,G,z,...H]=$;if(typeof Q!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let V=_Q(Q);async function q(F,U){return d7(J,async()=>{try{await W(F,U)}catch(B){throw F1(B),B}},{schedule:{type:"crontab",value:V},timezone:z||void 0})}return new Y(Q,q,K,G,z,...H)},get(Y,$){if($==="from")return(Q)=>{let{cronTime:W,onTick:K,timeZone:G}=Q;if(typeof W!=="string")throw new Error(b$1);if(X)throw new Error(`A job named '${J}' has already been scheduled`);X=!0;let z=_Q(W);return Q.onTick=async(H,V)=>{return d7(J,async()=>{try{await K(H,V)}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:z},timezone:G||void 0})},Y.from(Q)};else return Y[$]}})}function g$1(Z){return new Proxy(Z,{get(J,X){if(X==="schedule"&&J.schedule)return new Proxy(J.schedule,{apply(Y,$,Q){let[W,K,G]=Q,z=G?.name,H=G?.timezone;if(!z)throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.');let V=async()=>{return d7(z,async()=>{try{return await K()}catch(q){throw F1(q),q}},{schedule:{type:"crontab",value:_Q(W)},timezone:H})};return Y.apply($,[W,V,G])}});else return J[X]}})}function m$1(Z){return new Proxy(Z,{get(J,X){if(X==="scheduleJob")return new Proxy(J.scheduleJob,{apply(Y,$,Q){let[W,K,G]=Q;if(typeof W!=="string"||typeof K!=="string"||typeof G!=="function")throw new Error("Automatic instrumentation of 'node-schedule' requires the first parameter of 'scheduleJob' to be a job name string and the second parameter to be a crontab string");let z=W,H=K;async function V(){return d7(z,async()=>{await G?.()},{schedule:{type:"crontab",value:_Q(H)}})}return Y.apply($,[z,H,V])}});return J[X]}})}var u$1={instrumentCron:y$1,instrumentNodeCron:g$1,instrumentNodeSchedule:m$1};var xQ;((w)=>{w.BUILD_PACKETS="build_packets";w.ENTITIES_EMIT_UPDATES="entities_emit_updates";w.ENTITIES_TICK="entities_tick";w.NETWORK_SYNCHRONIZE="network_synchronize";w.NETWORK_SYNCHRONIZE_CLEANUP="network_synchronize_cleanup";w.PHYSICS_CLEANUP="physics_cleanup";w.PHYSICS_STEP="physics_step";w.RELEASE_TICK_ALLOCATION="release_tick_allocation";w.SEND_ALL_PACKETS="send_all_packets";w.SEND_PACKETS="send_packets";w.SERIALIZE_FREE_BUFFERS="serialize_free_buffers";w.SERIALIZE_PACKETS="serialize_packets";w.SERIALIZE_PACKETS_ENCODE="serialize_packets_encode";w.SIMULATION_STEP="simulation_step";w.TICKER_TICK="ticker_tick";w.WORLD_TICK="world_tick"})(xQ||={});class V8{static getProcessStats(Z=!1){let J=process.memoryUsage(),X={jsHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},jsHeapCapacityMb:{value:J.heapTotal/1024/1024,unit:"megabyte"},jsHeapUsagePercent:{value:J.heapUsed/J.heapTotal,unit:"percent"},processHeapSizeMb:{value:J.heapUsed/1024/1024,unit:"megabyte"},rssSizeMb:{value:J.rss/1024/1024,unit:"megabyte"}};if(Z)return X;return Object.fromEntries(Object.entries(X).map(([Y,$])=>[Y,$.value]))}static initializeSentry(Z,J=50){gR({dsn:Z,release:TS,environment:process.env.NODE_ENV||"development",tracesSampleRate:1,initialScope:{tags:{gameId:process.env.HYTOPIA_GAME_ID??"unknown",gameSlug:process.env.HYTOPIA_GAME_SLUG??"unknown",lobbyId:process.env.HYTOPIA_LOBBY_ID??"unknown",region:process.env.REGION??"unknown"}},beforeSend:(X)=>{return X.extra=V8.getProcessStats(),X},beforeSendTransaction:(X)=>{if(X.contexts?.trace?.op==="ticker_tick"){let $=X?.start_timestamp,Q=X?.timestamp;if(!$||!Q)return null;if((Q-$)*1000>J)return X.measurements=V8.getProcessStats(!0),X}return null}})}static startSpan(Z,J){if(MV())return n9({attributes:Z.attributes,name:Z.operation,op:Z.operation},J);else return J()}static sentry(){return ly}}var d$1=new V$({useFloat32:tz.ALWAYS}),F46=5000,c$1={RAW:0,GZIP:1};class y4 extends j0{static _cachedPacketsSerializedBuffer=new Map;_closeTimeout=null;_wrtcDirectTransport=null;_wrtcClientServerTransport=null;_wrtcClientServerDataProducers=[];_wrtcClientServerDataConsumers=[];_wrtcServerClientTransport=null;_wrtcServerClientReliableDataProducer=null;_wrtcServerClientUnreliableDataProducer=null;_wrtcServerClientDataConsumers=[];_ws;id;constructor(Z,J){super();this.id=E60(),this.onPacket(Y0.PacketId.CONNECTION,this._onConnectionPacket),this.onPacket(Y0.PacketId.HEARTBEAT,this._onHeartbeatPacket),this.bindWs(Z),j0.globalInstance.emit("CONNECTION.OPENED",{connection:this,req:J})}static clearCachedPacketsSerializedBuffers(){if(y4._cachedPacketsSerializedBuffer.size>0)y4._cachedPacketsSerializedBuffer.clear()}static serializePackets(Z){for(let X of Z)if(!Y0.isValidPacket(X))return d.error(`Connection.serializePackets(): Invalid packet payload: ${JSON.stringify(X)}`);let J=y4._cachedPacketsSerializedBuffer.get(Z);if(J)return J;return V8.startSpan({operation:"serialize_packets",attributes:{packets:Z.length,packetIds:Z.map((X)=>X[0]).join(",")}},(X)=>{let Y=d$1.pack(Z),$=Y.byteLength>1024,Q=$?V46(Y,{level:1}):Y,W=$?c$1.GZIP:c$1.RAW;return Y=Buffer.allocUnsafe(Q.length+1),Y[0]=W,Q.copy(Y,1),X?.setAttribute("serializedBytes",Y.byteLength),y4._cachedPacketsSerializedBuffer.set(Z,Y),Y})}bindWs(Z){let J=!!this._ws;if(J&&this._closeTimeout)clearTimeout(this._closeTimeout),this._closeTimeout=null;if(this._ws)this._ws.onmessage=()=>{},this._ws.onclose=()=>{},this._ws.onerror=()=>{},this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{k:!0})]);if(this._ws=Z,this._ws.binaryType="nodebuffer",this._ws.onmessage=(X)=>this._onMessage(X.data),this._ws.onclose=this._onWsClose,this._ws.onerror=this._onWsError,this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{i:this.id})],!0,!0),J)this.emitWithGlobal("CONNECTION.RECONNECTED",{connection:this});if(m7.instance.isWrtcEnabled)this._upgradeToWRTC()}closeWrtc(){this._closeWrtcClientServerTransport(),this._closeWrtcServerClientTransport()}disconnect(){try{this._ws.close()}catch(Z){d.error(`Connection.disconnect(): Connection disconnect failed. Error: ${Z}`)}}onPacket(Z,J){this.on("CONNECTION.PACKET_RECEIVED",({packet:X})=>{if(X[0]===Z)J(X)})}send(Z,J=!0,X=!1){if(this._closeTimeout)return;if(this._ws.readyState!==q46.OPEN)return;if(!J&&this._ws.bufferedAmount>4096)return;V8.startSpan({operation:"send_packets",attributes:{forceWs:X?"true":"false",wrtcConnected:this._wrtcServerClientTransport?.iceState==="completed"?"true":"false"}},()=>{try{let Y=y4.serializePackets(Z);if(!Y)return;if(this._wrtcServerClientTransport?.iceState==="completed"&&Y.length<(this._wrtcServerClientTransport?.sctpParameters?.maxMessageSize??0)&&!X)try{(J?this._wrtcServerClientReliableDataProducer:this._wrtcServerClientUnreliableDataProducer).send(Y)}catch{this._ws.send(Y)}else this._ws.send(Y);this.emitWithGlobal("CONNECTION.PACKETS_SENT",{connection:this,packets:Z})}catch(Y){d.error(`Connection.send(): Packet send failed. Error: ${Y}`)}})}_closeWrtcClientServerTransport(){this._wrtcDirectTransport?.close(),this._wrtcDirectTransport=null,this._wrtcClientServerTransport?.close(),this._wrtcClientServerTransport=null,this._wrtcClientServerDataProducers.forEach((Z)=>Z.close()),this._wrtcClientServerDataProducers=[],this._wrtcClientServerDataConsumers.forEach((Z)=>Z.close()),this._wrtcClientServerDataConsumers=[]}_closeWrtcServerClientTransport(){this._wrtcServerClientTransport?.close(),this._wrtcServerClientTransport=null,this._wrtcServerClientDataConsumers.forEach((Z)=>Z.close()),this._wrtcServerClientDataConsumers=[],this._wrtcServerClientReliableDataProducer?.close(),this._wrtcServerClientReliableDataProducer=null,this._wrtcServerClientUnreliableDataProducer?.close(),this._wrtcServerClientUnreliableDataProducer=null}_onConnectionPacket=async(Z)=>{let J=Z[1],X=J.c,Y=J.d;if(X){let{i:$,d:Q}=X,W=!1;if($==this._wrtcClientServerTransport?.id)await this._wrtcClientServerTransport.connect({dtlsParameters:Q}),W=!0;if($==this._wrtcServerClientTransport?.id)await this._wrtcServerClientTransport.connect({dtlsParameters:Q}),W=!0;if(W)this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{ca:{i:$}})])}if(Y)for(let $ of Y){let{s:Q,l:W}=$,K=await this._wrtcClientServerTransport.produceData({label:W,sctpStreamParameters:Q}),G=await this._wrtcDirectTransport.consumeData({dataProducerId:K.id});this._wrtcClientServerDataProducers.push(K),this._wrtcClientServerDataConsumers.push(G),G.on("message",(z)=>this._onMessage(z)),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{pa:{i:K.id,l:W}})])}};_onHeartbeatPacket=()=>{this.send([Y0.createPacket(Y0.bidirectionalPackets.heartbeatPacketDefinition,null)],!0,!0)};_onMessage=(Z)=>{try{let J=this._deserialize(Z);if(!J)return;this.emitWithGlobal("CONNECTION.PACKET_RECEIVED",{connection:this,packet:J})}catch(J){d.error(`Connection._ws.onmessage(): Error: ${J}`)}};_onWrtcIceStateChange=(Z,J)=>{if(["disconnected","closed"].includes(J)){if(Z==this._wrtcClientServerTransport)this._closeWrtcClientServerTransport();else if(Z==this._wrtcServerClientTransport)this._closeWrtcServerClientTransport()}};_onWsClose=()=>{this.closeWrtc(),this.emitWithGlobal("CONNECTION.DISCONNECTED",{connection:this}),this._closeTimeout=setTimeout(()=>{this.emitWithGlobal("CONNECTION.CLOSED",{connection:this}),this.offAll()},F46)};_onWsError=(Z)=>{this.emitWithGlobal("CONNECTION.ERROR",{connection:this,error:Z})};_upgradeToWRTC=async()=>{let Z=await m7.instance.createWrtcTransports();if(!Z)return!1;let{directTransport:J,clientServerTransport:X,serverClientTransport:Y}=Z;this._wrtcDirectTransport=J,this._wrtcClientServerTransport=X,this._wrtcClientServerTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcClientServerTransport,W)}),this._wrtcServerClientTransport=Y,this._wrtcServerClientTransport.on("icestatechange",(W)=>{this._onWrtcIceStateChange(this._wrtcServerClientTransport,W)}),this._wrtcServerClientReliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scr",sctpStreamParameters:{streamId:0,ordered:!0}}),this._wrtcServerClientUnreliableDataProducer=await this._wrtcServerClientTransport.produceData({label:"scu",sctpStreamParameters:{streamId:1,ordered:!1,maxPacketLifeTime:35}});let $=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientReliableDataProducer.id}),Q=await this._wrtcServerClientTransport.consumeData({dataProducerId:this._wrtcServerClientUnreliableDataProducer.id});return this._wrtcServerClientDataConsumers.push($,Q),this.send([Y0.createPacket(Y0.bidirectionalPackets.connectionPacketDefinition,{d:[{i:$.id,pi:$.dataProducerId,l:"scr",s:$.sctpStreamParameters},{i:Q.id,pi:Q.dataProducerId,l:"scu",s:Q.sctpStreamParameters}],t:[{i:this._wrtcClientServerTransport.id,f:"cs",d:this._wrtcClientServerTransport.dtlsParameters,ic:this._wrtcClientServerTransport.iceCandidates,ip:this._wrtcClientServerTransport.iceParameters,s:this._wrtcClientServerTransport.sctpParameters},{i:this._wrtcServerClientTransport.id,f:"sc",d:this._wrtcServerClientTransport.dtlsParameters,ic:this._wrtcServerClientTransport.iceCandidates,ip:this._wrtcServerClientTransport.iceParameters,s:this._wrtcServerClientTransport.sctpParameters}]})]),!0};_deserialize(Z){let J=d$1.unpack(Z);if(!J||typeof J!=="object"||typeof J[0]!=="number")return d.error(`Connection._deserialize(): Invalid packet format. Packet: ${JSON.stringify(J)}`);if(!Y0.isValidPacket(J))return d.error(`Connection._deserialize(): Invalid packet payload. Packet: ${JSON.stringify(J)}`);return J}}class WF{_lights=new Map;_nextLightId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedLights(Z){this.getAllEntityAttachedLights(Z).forEach((J)=>{J.despawn()})}getAllLights(Z=!1){return Z?this._world.tickAllocator.getArray(this._lights.values()):Array.from(this._lights.values())}getAllEntityAttachedLights(Z){return this.getAllLights().filter((J)=>J.attachedToEntity===Z)}registerLight(Z){if(Z.id!==void 0)return Z.id;let J=this._nextLightId;return this._lights.set(J,Z),this._nextLightId++,J}unregisterLight(Z){if(Z.id===void 0)return;this._lights.delete(Z.id)}}class F6{_map=new Map;_values=[];_isDirty=!1;get size(){return this._map.size}get valuesArray(){if(this._isDirty)this._syncArray();return this._values}get(Z){return this._map.get(Z)}set(Z,J){let X=this._map.has(Z);if(this._map.set(Z,J),!X)this._values.push(J);else this._isDirty=!0;return this}has(Z){return this._map.has(Z)}delete(Z){let J=this._map.delete(Z);if(J)this._isDirty=!0;return J}clear(){this._map.clear(),this._values.length=0,this._isDirty=!1}forEach(Z,J){this._map.forEach((X,Y)=>{Z.call(J,X,Y,this)})}keys(){return this._map.keys()}values(){return this._map.values()}entries(){return this._map.entries()}[Symbol.iterator](){return this._map[Symbol.iterator]()}_syncArray(){this._values.length=0;for(let Z of this._map.values())this._values.push(Z);this._isDirty=!1}}var l$1;((X)=>{X[X.POINTLIGHT=0]="POINTLIGHT";X[X.SPOTLIGHT=1]="SPOTLIGHT"})(l$1||={});var py;((q)=>{q.DESPAWN="LIGHT.DESPAWN";q.SET_ANGLE="LIGHT.SET_ANGLE";q.SET_ATTACHED_TO_ENTITY="LIGHT.SET_ATTACHED_TO_ENTITY";q.SET_COLOR="LIGHT.SET_COLOR";q.SET_DISTANCE="LIGHT.SET_DISTANCE";q.SET_INTENSITY="LIGHT.SET_INTENSITY";q.SET_OFFSET="LIGHT.SET_OFFSET";q.SET_PENUMBRA="LIGHT.SET_PENUMBRA";q.SET_POSITION="LIGHT.SET_POSITION";q.SET_TRACKED_ENTITY="LIGHT.SET_TRACKED_ENTITY";q.SET_TRACKED_POSITION="LIGHT.SET_TRACKED_POSITION";q.SPAWN="LIGHT.SPAWN"})(py||={});class iy extends j0{_id;_angle;_attachedToEntity;_color;_distance;_intensity;_offset;_penumbra;_position;_trackedEntity;_trackedPosition;_type;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");super();d.warning("WARNING: Lights are poorly optimized at this time. Using more than a few lights in your game can cause extremely bad performance (FPS) issues. Use lights sparingly!"),this._angle=Z.angle,this._attachedToEntity=Z.attachedToEntity,this._color=Z.color??{r:255,g:255,b:255},this._distance=Z.distance,this._intensity=Z.intensity??1,this._offset=Z.offset,this._penumbra=Z.penumbra,this._position=Z.position,this._trackedEntity=Z.trackedEntity,this._trackedPosition=Z.trackedPosition,this._type=Z.type??0}get id(){return this._id}get angle(){return this._angle}get attachedToEntity(){return this._attachedToEntity}get color(){return this._color}get distance(){return this._distance}get intensity(){return this._intensity}get isSpawned(){return this._id!==void 0}get offset(){return this._offset}get penumbra(){return this._penumbra}get position(){return this._position}get trackedEntity(){return this._trackedEntity}get trackedPosition(){return this._trackedPosition}get type(){return this._type}get world(){return this._world}setAngle(Z){if(this._angle===Z)return;if(this._angle=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ANGLE",{light:this,angle:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return d.error(`Light.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_ATTACHED_TO_ENTITY",{light:this,entity:Z})}setColor(Z){if(this._color.r===Z.r&&this._color.g===Z.g&&this._color.b===Z.b)return;if(this._color=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_COLOR",{light:this,color:Z})}setDistance(Z){if(this._distance===Z)return;if(this._distance=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_DISTANCE",{light:this,distance:Z})}setIntensity(Z){if(this._intensity===Z)return;if(this._intensity=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_INTENSITY",{light:this,intensity:Z})}setOffset(Z){if(this._offset&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_OFFSET",{light:this,offset:Z})}setPenumbra(Z){if(this._penumbra===Z)return;if(this._penumbra=Z,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_PENUMBRA",{light:this,penumbra:Z})}setPosition(Z){if(this._position&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.z)return;if(this._position=Z,this._attachedToEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_POSITION",{light:this,position:Z})}setTrackedEntity(Z){if(!Z.isSpawned)return d.error(`Light.setTrackedEntity(): Entity ${Z.id} is not spawned!`);if(this._trackedEntity===Z)return;if(this._trackedEntity=Z,this._trackedPosition=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_ENTITY",{light:this,entity:Z})}setTrackedPosition(Z){if(this._trackedPosition===Z)return;if(this._trackedPosition=Z,this._trackedEntity=void 0,this.isSpawned)this.emitWithWorld(this._world,"LIGHT.SET_TRACKED_POSITION",{light:this,position:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.lightManager.unregisterLight(this),this.emitWithWorld(this._world,"LIGHT.DESPAWN",{light:this}),this._id=void 0,this._world=void 0}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return d.error(`Light.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning Light!`);this._id=Z.lightManager.registerLight(this),this._world=Z,this.emitWithWorld(Z,"LIGHT.SPAWN",{light:this})}serialize(){if(!this._world)d.fatalError("Light.serialize(): Light is not in a world and cannot be serialized!");return D0.serializeLight(this,this._world.tickAllocator)}}var ny;((m)=>{m.BURST="PARTICLE_EMITTER.BURST";m.DESPAWN="PARTICLE_EMITTER.DESPAWN";m.SET_ALPHA_TEST="PARTICLE_EMITTER.SET_ALPHA_TEST";m.SET_ATTACHED_TO_ENTITY="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY";m.SET_ATTACHED_TO_ENTITY_NODE_NAME="PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME";m.SET_COLOR_END="PARTICLE_EMITTER.SET_COLOR_END";m.SET_COLOR_END_VARIANCE="PARTICLE_EMITTER.SET_COLOR_END_VARIANCE";m.SET_COLOR_START="PARTICLE_EMITTER.SET_COLOR_START";m.SET_COLOR_START_VARIANCE="PARTICLE_EMITTER.SET_COLOR_START_VARIANCE";m.SET_GRAVITY="PARTICLE_EMITTER.SET_GRAVITY";m.SET_LIFETIME="PARTICLE_EMITTER.SET_LIFETIME";m.SET_LIFETIME_VARIANCE="PARTICLE_EMITTER.SET_LIFETIME_VARIANCE";m.SET_MAX_PARTICLES="PARTICLE_EMITTER.SET_MAX_PARTICLES";m.SET_OFFSET="PARTICLE_EMITTER.SET_OFFSET";m.SET_OPACITY_END="PARTICLE_EMITTER.SET_OPACITY_END";m.SET_OPACITY_END_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE";m.SET_OPACITY_START="PARTICLE_EMITTER.SET_OPACITY_START";m.SET_OPACITY_START_VARIANCE="PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE";m.SET_PAUSED="PARTICLE_EMITTER.SET_PAUSED";m.SET_POSITION="PARTICLE_EMITTER.SET_POSITION";m.SET_POSITION_VARIANCE="PARTICLE_EMITTER.SET_POSITION_VARIANCE";m.SET_RATE="PARTICLE_EMITTER.SET_RATE";m.SET_RATE_VARIANCE="PARTICLE_EMITTER.SET_RATE_VARIANCE";m.SET_SIZE_END="PARTICLE_EMITTER.SET_SIZE_END";m.SET_SIZE_END_VARIANCE="PARTICLE_EMITTER.SET_SIZE_END_VARIANCE";m.SET_SIZE_START="PARTICLE_EMITTER.SET_SIZE_START";m.SET_SIZE_START_VARIANCE="PARTICLE_EMITTER.SET_SIZE_START_VARIANCE";m.SET_TEXTURE_URI="PARTICLE_EMITTER.SET_TEXTURE_URI";m.SET_TRANSPARENT="PARTICLE_EMITTER.SET_TRANSPARENT";m.SET_VELOCITY="PARTICLE_EMITTER.SET_VELOCITY";m.SET_VELOCITY_VARIANCE="PARTICLE_EMITTER.SET_VELOCITY_VARIANCE";m.SPAWN="PARTICLE_EMITTER.SPAWN"})(ny||={});class ay extends j0{_id;_alphaTest;_attachedToEntity;_attachedToEntityNodeName;_colorEnd;_colorEndVariance;_colorStart;_colorStartVariance;_gravity;_lifetime;_lifetimeVariance;_maxParticles;_offset;_opacityEnd;_opacityEndVariance;_opacityStart;_opacityStartVariance;_paused;_position;_positionVariance;_rate;_rateVariance;_sizeEnd;_sizeEndVariance;_sizeStart;_sizeStartVariance;_sizeVariance;_textureUri;_transparent;_velocity;_velocityVariance;_world;constructor(Z){if(!!Z.attachedToEntity===!!Z.position)d.fatalError("Either attachedToEntity or position must be set, but not both.");if(!Z.textureUri)d.fatalError("ParticleEmitter.constructor(): textureUri must be provided.");super();this._alphaTest=Z.alphaTest??0.05,this._attachedToEntity=Z.attachedToEntity,this._attachedToEntityNodeName=Z.attachedToEntityNodeName,this._colorEnd=Z.colorEnd,this._colorEndVariance=Z.colorEndVariance,this._colorStart=Z.colorStart,this._colorStartVariance=Z.colorStartVariance,this._gravity=Z.gravity,this._lifetime=Z.lifetime,this._lifetimeVariance=Z.lifetimeVariance,this._maxParticles=Z.maxParticles,this._offset=Z.offset,this._opacityEnd=Z.opacityEnd,this._opacityEndVariance=Z.opacityEndVariance,this._opacityStart=Z.opacityStart,this._opacityStartVariance=Z.opacityStartVariance,this._paused=!1,this._position=Z.position,this._positionVariance=Z.positionVariance,this._rate=Z.rate,this._rateVariance=Z.rateVariance,this._sizeEnd=Z.sizeEnd,this._sizeEndVariance=Z.sizeEndVariance,this._sizeStart=Z.sizeStart,this._sizeStartVariance=Z.sizeStartVariance,this._textureUri=Z.textureUri,this._transparent=Z.transparent,this._velocity=Z.velocity,this._velocityVariance=Z.velocityVariance}get id(){return this._id}get alphaTest(){return this._alphaTest}get attachedToEntity(){return this._attachedToEntity}get attachedToEntityNodeName(){return this._attachedToEntityNodeName}get colorEnd(){return this._colorEnd}get colorEndVariance(){return this._colorEndVariance}get colorStart(){return this._colorStart}get colorStartVariance(){return this._colorStartVariance}get gravity(){return this._gravity}get isSpawned(){return this._id!==void 0}get lifetime(){return this._lifetime}get lifetimeVariance(){return this._lifetimeVariance}get maxParticles(){return this._maxParticles}get offset(){return this._offset}get opacityEnd(){return this._opacityEnd}get opacityEndVariance(){return this._opacityEndVariance}get opacityStart(){return this._opacityStart}get opacityStartVariance(){return this._opacityStartVariance}get paused(){return this._paused}get position(){return this._position}get positionVariance(){return this._positionVariance}get rate(){return this._rate}get rateVariance(){return this._rateVariance}get sizeEnd(){return this._sizeEnd}get sizeEndVariance(){return this._sizeEndVariance}get sizeStart(){return this._sizeStart}get sizeStartVariance(){return this._sizeStartVariance}get sizeVariance(){return this._sizeVariance}get textureUri(){return this._textureUri}get transparent(){return this._transparent}get velocity(){return this._velocity}get velocityVariance(){return this._velocityVariance}get world(){return this._world}setAlphaTest(Z){if(this._alphaTest===Z)return;if(this._alphaTest=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ALPHA_TEST",{particleEmitter:this,alphaTest:Z})}setAttachedToEntity(Z){if(!Z.isSpawned)return d.error(`ParticleEmitter.setAttachedToEntity(): Entity ${Z.id} is not spawned!`);if(this._attachedToEntity===Z)return;if(this._attachedToEntity=Z,this._position=void 0,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",{particleEmitter:this,entity:Z})}setAttachedToEntityNodeName(Z){if(this._attachedToEntityNodeName===Z)return;if(this._attachedToEntityNodeName=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",{particleEmitter:this,attachedToEntityNodeName:Z})}setColorEnd(Z){if(this._colorEnd&&this._colorEnd.r===Z.r&&this._colorEnd.g===Z.g&&this._colorEnd.b===Z.b)return;if(this._colorEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END",{particleEmitter:this,colorEnd:Z})}setColorEndVariance(Z){if(this._colorEndVariance&&this._colorEndVariance.r===Z.r&&this._colorEndVariance.g===Z.g&&this._colorEndVariance.b===Z.b)return;if(this._colorEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",{particleEmitter:this,colorEndVariance:Z})}setColorStart(Z){if(this._colorStart&&this._colorStart.r===Z.r&&this._colorStart.g===Z.g&&this._colorStart.b===Z.b)return;if(this._colorStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START",{particleEmitter:this,colorStart:Z})}setColorStartVariance(Z){if(this._colorStartVariance&&this._colorStartVariance.r===Z.r&&this._colorStartVariance.g===Z.g&&this._colorStartVariance.b===Z.b)return;if(this._colorStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",{particleEmitter:this,colorStartVariance:Z})}setGravity(Z){if(this._gravity&&this._gravity.x===Z.x&&this._gravity.y===Z.y&&this._gravity.z===Z.z)return;if(this._gravity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_GRAVITY",{particleEmitter:this,gravity:Z})}setLifetime(Z){if(this._lifetime===Z)return;if(this._lifetime=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME",{particleEmitter:this,lifetime:Z})}setLifetimeVariance(Z){if(this._lifetimeVariance===Z)return;if(this._lifetimeVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",{particleEmitter:this,lifetimeVariance:Z})}setMaxParticles(Z){if(this._maxParticles===Z)return;if(this._maxParticles=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_MAX_PARTICLES",{particleEmitter:this,maxParticles:Z})}setOffset(Z){if(this._offset&&this._offset.x===Z.x&&this._offset.y===Z.y&&this._offset.z===Z.z)return;if(this._offset=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OFFSET",{particleEmitter:this,offset:Z})}setOpacityEnd(Z){if(this._opacityEnd===Z)return;if(this._opacityEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END",{particleEmitter:this,opacityEnd:Z})}setOpacityEndVariance(Z){if(this._opacityEndVariance===Z)return;if(this._opacityEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",{particleEmitter:this,opacityEndVariance:Z})}setOpacityStart(Z){if(this._opacityStart===Z)return;if(this._opacityStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START",{particleEmitter:this,opacityStart:Z})}setOpacityStartVariance(Z){if(this._opacityStartVariance===Z)return;if(this._opacityStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",{particleEmitter:this,opacityStartVariance:Z})}setPosition(Z){if(this._position&&this._position.x===Z.x&&this._position.y===Z.y&&this._position.z===Z.z)return;if(this._position=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION",{particleEmitter:this,position:Z})}setPositionVariance(Z){if(this._positionVariance&&this._positionVariance.x===Z.x&&this._positionVariance.y===Z.y&&this._positionVariance.z===Z.z)return;if(this._positionVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_POSITION_VARIANCE",{particleEmitter:this,positionVariance:Z})}setRate(Z){if(this._rate===Z)return;if(this._rate=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE",{particleEmitter:this,rate:Z})}setRateVariance(Z){if(this._rateVariance===Z)return;if(this._rateVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_RATE_VARIANCE",{particleEmitter:this,rateVariance:Z})}setSizeEnd(Z){if(this._sizeEnd===Z)return;if(this._sizeEnd=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END",{particleEmitter:this,sizeEnd:Z})}setSizeEndVariance(Z){if(this._sizeEndVariance===Z)return;if(this._sizeEndVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",{particleEmitter:this,sizeEndVariance:Z})}setSizeStart(Z){if(this._sizeStart===Z)return;if(this._sizeStart=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START",{particleEmitter:this,sizeStart:Z})}setSizeStartVariance(Z){if(this._sizeStartVariance===Z)return;if(this._sizeStartVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",{particleEmitter:this,sizeStartVariance:Z})}setTextureUri(Z){if(this._textureUri===Z)return;if(this._textureUri=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TEXTURE_URI",{particleEmitter:this,textureUri:Z})}setTransparent(Z){if(this._transparent===Z)return;if(this._transparent=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_TRANSPARENT",{particleEmitter:this,transparent:Z})}setVelocity(Z){if(this._velocity&&this._velocity.x===Z.x&&this._velocity.y===Z.y&&this._velocity.z===Z.z)return;if(this._velocity=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY",{particleEmitter:this,velocity:Z})}setVelocityVariance(Z){if(this._velocityVariance&&this._velocityVariance.x===Z.x&&this._velocityVariance.y===Z.y&&this._velocityVariance.z===Z.z)return;if(this._velocityVariance=Z,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",{particleEmitter:this,velocityVariance:Z})}burst(Z){if(this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.BURST",{particleEmitter:this,count:Z})}despawn(){if(!this.isSpawned||!this._world)return;this._world.particleEmitterManager.unregisterParticleEmitter(this),this.emitWithWorld(this._world,"PARTICLE_EMITTER.DESPAWN",{particleEmitter:this}),this._id=void 0,this._world=void 0}restart(){if(!this._paused)return;if(this._paused=!1,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}stop(){if(this._paused)return;if(this._paused=!0,this.isSpawned)this.emitWithWorld(this._world,"PARTICLE_EMITTER.SET_PAUSED",{particleEmitter:this,paused:this._paused})}spawn(Z){if(this.isSpawned)return;if(this._attachedToEntity&&!this._attachedToEntity.isSpawned)return d.error(`ParticleEmitter.spawn(): Attached entity ${this._attachedToEntity.id} must be spawned before spawning ParticleEmitter!`);this._id=Z.particleEmitterManager.registerParticleEmitter(this),this._world=Z,this.emitWithWorld(Z,"PARTICLE_EMITTER.SPAWN",{particleEmitter:this})}serialize(){if(!this._world)d.fatalError("ParticleEmitter.serialize(): ParticleEmitter is not in a world and cannot be serialized!");return D0.serializeParticleEmitter(this,this._world.tickAllocator)}}var U46={x:0,y:-32,z:0},sy=60,oy;(($)=>{$.STEP_START="SIMULATION.STEP_START";$.STEP_END="SIMULATION.STEP_END";$.DEBUG_RAYCAST="SIMULATION.DEBUG_RAYCAST";$.DEBUG_RENDER="SIMULATION.DEBUG_RENDER"})(oy||={});class KF extends j0{_colliderMap=new pz;_debugRaycastingEnabled=!1;_debugRenderingEnabled=!1;_debugRenderingFilterFlags;_rapierEventQueue;_rapierSimulation;_world;constructor(Z,J=sy,X=U46){super();this._rapierEventQueue=new Q1.EventQueue(!0),this._rapierSimulation=new Q1.World(X),this._rapierSimulation.timestep=Math.fround(1/J),this._world=Z}get colliderMap(){return this._colliderMap}get isDebugRaycastingEnabled(){return this._debugRaycastingEnabled}get isDebugRenderingEnabled(){return this._debugRenderingEnabled}get gravity(){return this._rapierSimulation.gravity}get timestepS(){return this._rapierSimulation.timestep}get world(){return this._world}createRawCollider(Z,J){return this._rapierSimulation.createCollider(Z,J)}createRawRigidBody(Z){return this._rapierSimulation.createRigidBody(Z)}enableDebugRaycasting(Z){this._debugRaycastingEnabled=Z}enableDebugRendering(Z,J=Q1.QueryFilterFlags.EXCLUDE_FIXED){this._debugRenderingEnabled=Z,this._debugRenderingFilterFlags=J}getContactManifolds(Z,J){let X=[];return this._rapierSimulation.narrowPhase.contactPair(Z,J,(Y,$)=>{if(Y.numContacts()===0)return;let Q=Y.normal(),W=[];for(let K=0;K<Y.numSolverContacts();K++)W.push(Y.solverContactPoint(K));X.push({contactPoints:W,localNormalA:!$?Y.localNormal1():Y.localNormal2(),localNormalB:!$?Y.localNormal2():Y.localNormal1(),normal:!$?Q:{x:-Q.x,y:-Q.y,z:-Q.z}})}),X}intersectionsWithRawShape(Z,J,X,Y={}){let $=new Set,Q=[];return this._rapierSimulation.intersectionsWithShape(J,X,Z,(W)=>{let K=this._colliderMap.getColliderHandleBlockType(W.handle);if(K&&!$.has(K))return $.add(K),Q.push({intersectedBlockType:K}),!0;let G=this._colliderMap.getColliderHandleEntity(W.handle);if(G&&!$.has(G))return $.add(G),Q.push({intersectedEntity:G}),!0;return!0},Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate),Q}raycast(Z,J,X,Y={}){let $=new Q1.Ray(Z,J),Q=this._rapierSimulation.castRay($,X,Y.solidMode??!0,Y.filterFlags,Y.filterGroups,Y.filterExcludeCollider,Y.filterExcludeRigidBody,Y.filterPredicate);if(this._debugRaycastingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RAYCAST",{simulation:this,origin:Z,direction:J,length:X,hit:!!Q});if(!Q)return null;let W=$.pointAt(Q.timeOfImpact),K=Q.timeOfImpact,G=Q.collider,z=this._colliderMap.getColliderHandleBlockType(G.handle);if(z)return{hitBlock:gQ.fromGlobalCoordinate({x:Math.floor(W.x-($.dir.x<0?0.0001:-0.0001)),y:Math.floor(W.y-($.dir.y<0?0.0001:-0.0001)),z:Math.floor(W.z-($.dir.z<0?0.0001:-0.0001))},z),hitPoint:W,hitDistance:K};let H=this._colliderMap.getColliderHandleEntity(G.handle);if(H)return{hitEntity:H,hitPoint:W,hitDistance:K};return null}removeRawCollider(Z){this._colliderMap.queueColliderHandleForCleanup(Z.handle),this._rapierSimulation.removeCollider(Z,!1)}removeRawRigidBody(Z){this._rapierSimulation.removeRigidBody(Z)}setGravity(Z){this._rapierSimulation.gravity=Z}step=(Z)=>{this.emitWithWorld(this._world,"SIMULATION.STEP_START",{simulation:this,tickDeltaMs:Z});let J=performance.now();if(V8.startSpan({operation:"physics_step"},()=>{this._rapierSimulation.step(this._rapierEventQueue)}),V8.startSpan({operation:"physics_cleanup"},()=>{this._rapierEventQueue.drainContactForceEvents(this._onContactForceEvent),this._rapierEventQueue.drainCollisionEvents(this._onCollisionEvent),this._colliderMap.cleanup()}),this.emitWithWorld(this._world,"SIMULATION.STEP_END",{simulation:this,stepDurationMs:performance.now()-J}),this._debugRenderingEnabled)this.emitWithWorld(this._world,"SIMULATION.DEBUG_RENDER",{simulation:this,...this._rapierSimulation.debugRender(this._debugRenderingFilterFlags)})};_onCollisionEvent=(Z,J,X)=>{let[Y,$]=this._getCollisionObjects(Z,J);if(!Y||!$)return;let Q=(W,K)=>{if(W instanceof Q9&&K instanceof a8&&W.hasListeners("BLOCK_TYPE.ENTITY_COLLISION"))W.emit("BLOCK_TYPE.ENTITY_COLLISION",{blockType:W,entity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof Q9&&W.hasListeners("ENTITY.BLOCK_COLLISION"))W.emit("ENTITY.BLOCK_COLLISION",{entity:W,blockType:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(W instanceof a8&&K instanceof a8&&W.hasListeners("ENTITY.ENTITY_COLLISION"))W.emit("ENTITY.ENTITY_COLLISION",{entity:W,otherEntity:K,started:X,colliderHandleA:Z,colliderHandleB:J});else if(typeof W==="function"&&(K instanceof a8||K instanceof Q9))W(K,X,Z,J)};Q(Y,$),Q($,Y)};_onContactForceEvent=(Z)=>{let[J,X]=this._getCollisionObjects(Z.collider1(),Z.collider2());if(!J||typeof J==="function"||!X||typeof X==="function")return;let Y={totalForce:Z.totalForce(),totalForceMagnitude:Z.totalForceMagnitude(),maxForceDirection:Z.maxForceDirection(),maxForceMagnitude:Z.maxForceMagnitude()},$=(Q,W)=>{if(Q instanceof Q9&&W instanceof a8&&Q.hasListeners("BLOCK_TYPE.ENTITY_CONTACT_FORCE"))Q.emit("BLOCK_TYPE.ENTITY_CONTACT_FORCE",{blockType:Q,entity:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof Q9&&Q.hasListeners("ENTITY.BLOCK_CONTACT_FORCE"))Q.emit("ENTITY.BLOCK_CONTACT_FORCE",{entity:Q,blockType:W,contactForceData:Y});else if(Q instanceof a8&&W instanceof a8&&Q.hasListeners("ENTITY.ENTITY_CONTACT_FORCE"))Q.emit("ENTITY.ENTITY_CONTACT_FORCE",{entity:Q,otherEntity:W,contactForceData:Y})};$(J,X),$(X,J)};_getCollisionObjects(Z,J){let X=this._colliderMap.getColliderHandleBlockType(Z)??this._colliderMap.getColliderHandleCollisionCallback(Z)??this._colliderMap.getColliderHandleEntity(Z),Y=this._colliderMap.getColliderHandleBlockType(J)??this._colliderMap.getColliderHandleCollisionCallback(J)??this._colliderMap.getColliderHandleEntity(J);return[X,Y]}}class mR{_synchronizedPlayerReliablePackets=new F6;_queuedBroadcasts=[];_queuedAudioSynchronizations=new F6;_queuedBlockSynchronizations=new F6;_queuedBlockTypeSynchronizations=new F6;_queuedChunkSynchronizations=new F6;_queuedDebugRaycastSynchronizations=[];_queuedEntitySynchronizations=new F6;_queuedLightSynchronizations=new F6;_queuedParticleEmitterSynchronizations=new F6;_queuedPerPlayerSynchronizations=new F6;_queuedPerPlayerCameraSynchronizations=new F6;_queuedPerPlayerUISynchronizations=new F6;_queuedPerPlayerUIDatasSynchronizations=new F6;_queuedPlayerSynchronizations=new F6;_queuedSceneUISynchronizations=new F6;_queuedWorldSynchronization;_loadedSceneUIs=new Set;_spawnedChunks=new Set;_spawnedEntities=new Set;_world;constructor(Z){this._world=Z,this._subscribeToAudioEvents(),this._subscribeToBlockTypeRegistryEvents(),this._subscribeToChatEvents(),this._subscribeToChunkLatticeEvents(),this._subscribeToEntityEvents(),this._subscribeToLightEvents(),this._subscribeToParticleEmitterEvents(),this._subscribeToPlayerEvents(),this._subscribeToPlayerCameraEvents(),this._subscribeToPlayerUIEvents(),this._subscribeToSceneUIEvents(),this._subscribeToSimulationEvents(),this._subscribeToWorldEvents()}synchronize(){let Z=this._world.tickAllocator,J=this._world.tickAllocator.getArray(),X=this._world.tickAllocator.getArray(),Y=this._world.loop.currentTick;if(this._queuedPerPlayerSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerSynchronizations)this._createOrGetSynchronizedPlayerReliablePackets($,J).push(...Q);if(this._queuedEntitySynchronizations.size>0){let $=this._world.tickAllocator.getArray(),Q=this._world.tickAllocator.getArray();for(let W of this._queuedEntitySynchronizations.valuesArray){let K=!1;for(let G in W)if(G!=="i"&&G!=="p"&&G!=="r"){K=!0;break}if(K)$.push(W);else Q.push(W)}if(Q.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,Q,Y,Z.getArray());X.push(W)}if($.length>0){let W=Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,$,Y,Z.getArray());J.push(W);for(let K of this._synchronizedPlayerReliablePackets.valuesArray)K.push(W)}}if(this._queuedAudioSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,this._queuedAudioSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockTypeSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._queuedBlockTypeSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedChunkSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,this._queuedChunkSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBlockSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.blocksPacketDefinition,this._queuedBlockSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedLightSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,this._queuedLightSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedParticleEmitterSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,this._queuedParticleEmitterSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerUISynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUISynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPerPlayerUIDatasSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerUIDatasSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.uiDatasPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedSceneUISynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,this._queuedSceneUISynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedWorldSynchronization){let $=Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._queuedWorldSynchronization,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedPerPlayerCameraSynchronizations.size>0)for(let[$,Q]of this._queuedPerPlayerCameraSynchronizations){let W=Y0.createPacket(Y0.outboundPackets.cameraPacketDefinition,Q,Y,Z.getArray());this._createOrGetSynchronizedPlayerReliablePackets($,J).push(W)}if(this._queuedPlayerSynchronizations.size>0){let $=Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,this._queuedPlayerSynchronizations.valuesArray,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedBroadcasts.length>0)for(let $ of this._queuedBroadcasts){J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}if(this._queuedDebugRaycastSynchronizations.length>0){let $=Y0.createPacket(Y0.outboundPackets.physicsDebugRaycastsPacketDefinition,this._queuedDebugRaycastSynchronizations,Y,Z.getArray());J.push($);for(let Q of this._synchronizedPlayerReliablePackets.valuesArray)Q.push($)}V8.startSpan({operation:"send_all_packets"},()=>{for(let $ of V9.instance.getConnectedPlayersByWorld(this._world)){let Q=this._synchronizedPlayerReliablePackets.get($)??J;if(Q.length>0)$.connection.send(Q);if(X.length>0)$.connection.send(X,!1)}}),V8.startSpan({operation:"network_synchronize_cleanup"},()=>{if(this._queuedBroadcasts.length>0)this._queuedBroadcasts.length=0;if(this._queuedAudioSynchronizations.size>0)this._queuedAudioSynchronizations.clear();if(this._queuedBlockSynchronizations.size>0)this._queuedBlockSynchronizations.clear();if(this._queuedBlockTypeSynchronizations.size>0)this._queuedBlockTypeSynchronizations.clear();if(this._queuedChunkSynchronizations.size>0)this._queuedChunkSynchronizations.clear();if(this._queuedDebugRaycastSynchronizations.length>0)this._queuedDebugRaycastSynchronizations.length=0;if(this._queuedEntitySynchronizations.size>0)this._queuedEntitySynchronizations.clear();if(this._queuedLightSynchronizations.size>0)this._queuedLightSynchronizations.clear();if(this._queuedParticleEmitterSynchronizations.size>0)this._queuedParticleEmitterSynchronizations.clear();if(this._queuedPerPlayerSynchronizations.size>0)this._queuedPerPlayerSynchronizations.clear();if(this._queuedPerPlayerCameraSynchronizations.size>0)this._queuedPerPlayerCameraSynchronizations.clear();if(this._queuedPerPlayerUISynchronizations.size>0)this._queuedPerPlayerUISynchronizations.clear();if(this._queuedPerPlayerUIDatasSynchronizations.size>0)this._queuedPerPlayerUIDatasSynchronizations.clear();if(this._queuedPlayerSynchronizations.size>0)this._queuedPlayerSynchronizations.clear();if(this._queuedSceneUISynchronizations.size>0)this._queuedSceneUISynchronizations.clear();if(this._queuedWorldSynchronization)this._queuedWorldSynchronization=void 0;if(this._loadedSceneUIs.size>0)this._loadedSceneUIs.clear();if(this._spawnedChunks.size>0)this._spawnedChunks.clear();if(this._spawnedEntities.size>0)this._spawnedEntities.clear();if(this._synchronizedPlayerReliablePackets.size>0)this._synchronizedPlayerReliablePackets.clear();y4.clearCachedPacketsSerializedBuffers()})}_subscribeToAudioEvents(){this._world.final("AUDIO.PAUSE",this._onAudioPause),this._world.final("AUDIO.PLAY",this._onAudioPlay),this._world.final("AUDIO.PLAY_RESTART",this._onAudioPlayRestart),this._world.final("AUDIO.SET_ATTACHED_TO_ENTITY",this._onAudioSetAttachedToEntity),this._world.final("AUDIO.SET_CUTOFF_DISTANCE",this._onAudioSetCutoffDistance),this._world.final("AUDIO.SET_DETUNE",this._onAudioSetDetune),this._world.final("AUDIO.SET_DISTORTION",this._onAudioSetDistortion),this._world.final("AUDIO.SET_POSITION",this._onAudioSetPosition),this._world.final("AUDIO.SET_PLAYBACK_RATE",this._onAudioSetPlaybackRate),this._world.final("AUDIO.SET_REFERENCE_DISTANCE",this._onAudioSetReferenceDistance),this._world.final("AUDIO.SET_VOLUME",this._onAudioSetVolume)}_subscribeToBlockTypeRegistryEvents(){this._world.final("BLOCK_TYPE_REGISTRY.REGISTER_BLOCK_TYPE",this._onBlockTypeRegistryRegisterBlockType)}_subscribeToChatEvents(){this._world.final("CHAT.BROADCAST_MESSAGE",this._onChatSendBroadcastMessage),this._world.final("CHAT.PLAYER_MESSAGE",this._onChatSendPlayerMessage)}_subscribeToChunkLatticeEvents(){this._world.final("CHUNK_LATTICE.ADD_CHUNK",this._onChunkLatticeAddChunk),this._world.final("CHUNK_LATTICE.REMOVE_CHUNK",this._onChunkLatticeRemoveChunk),this._world.final("CHUNK_LATTICE.SET_BLOCK",this._onChunkLatticeSetBlock)}_subscribeToEntityEvents(){this._world.final("ENTITY.SPAWN",this._onEntitySpawn),this._world.final("ENTITY.DESPAWN",this._onEntityDespawn),this._world.final("ENTITY.SET_MODEL_ANIMATIONS_PLAYBACK_RATE",this._onEntitySetModelAnimationsPlaybackRate),this._world.final("ENTITY.SET_MODEL_HIDDEN_NODES",this._onEntitySetModelHiddenNodes),this._world.final("ENTITY.SET_MODEL_SCALE",this._onEntitySetModelScale),this._world.final("ENTITY.SET_MODEL_SHOWN_NODES",this._onEntitySetModelShownNodes),this._world.final("ENTITY.SET_MODEL_TEXTURE_URI",this._onEntitySetModelTextureUri),this._world.final("ENTITY.SET_OPACITY",this._onEntitySetOpacity),this._world.final("ENTITY.SET_PARENT",this._onEntitySetParent),this._world.final("ENTITY.SET_TINT_COLOR",this._onEntitySetTintColor),this._world.final("ENTITY.START_MODEL_LOOPED_ANIMATIONS",this._onEntityStartModelLoopedAnimations),this._world.final("ENTITY.START_MODEL_ONESHOT_ANIMATIONS",this._onEntityStartModelOneshotAnimations),this._world.final("ENTITY.STOP_MODEL_ANIMATIONS",this._onEntityStopModelAnimations),this._world.final("ENTITY.UPDATE_POSITION",this._onEntityUpdatePosition),this._world.final("ENTITY.UPDATE_ROTATION",this._onEntityUpdateRotation)}_subscribeToLightEvents(){this._world.final("LIGHT.DESPAWN",this._onLightDespawn),this._world.final("LIGHT.SET_ANGLE",this._onLightSetAngle),this._world.final("LIGHT.SET_ATTACHED_TO_ENTITY",this._onLightSetAttachedToEntity),this._world.final("LIGHT.SET_COLOR",this._onLightSetColor),this._world.final("LIGHT.SET_DISTANCE",this._onLightSetDistance),this._world.final("LIGHT.SET_INTENSITY",this._onLightSetIntensity),this._world.final("LIGHT.SET_OFFSET",this._onLightSetOffset),this._world.final("LIGHT.SET_PENUMBRA",this._onLightSetPenumbra),this._world.final("LIGHT.SET_POSITION",this._onLightSetPosition),this._world.final("LIGHT.SET_TRACKED_ENTITY",this._onLightSetTrackedEntity),this._world.final("LIGHT.SET_TRACKED_POSITION",this._onLightSetTrackedPosition),this._world.final("LIGHT.SPAWN",this._onLightSpawn)}_subscribeToParticleEmitterEvents(){this._world.final("PARTICLE_EMITTER.DESPAWN",this._onParticleEmitterDespawn),this._world.final("PARTICLE_EMITTER.BURST",this._onParticleEmitterBurst),this._world.final("PARTICLE_EMITTER.SET_ALPHA_TEST",this._onParticleEmitterSetAlphaTest),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",this._onParticleEmitterSetAttachedToEntity),this._world.final("PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY_NODE_NAME",this._onParticleEmitterSetAttachedToEntityNodeName),this._world.final("PARTICLE_EMITTER.SET_COLOR_END",this._onParticleEmitterSetColorEnd),this._world.final("PARTICLE_EMITTER.SET_COLOR_END_VARIANCE",this._onParticleEmitterSetColorEndVariance),this._world.final("PARTICLE_EMITTER.SET_COLOR_START",this._onParticleEmitterSetColorStart),this._world.final("PARTICLE_EMITTER.SET_COLOR_START_VARIANCE",this._onParticleEmitterSetColorStartVariance),this._world.final("PARTICLE_EMITTER.SET_GRAVITY",this._onParticleEmitterSetGravity),this._world.final("PARTICLE_EMITTER.SET_LIFETIME",this._onParticleEmitterSetLifetime),this._world.final("PARTICLE_EMITTER.SET_LIFETIME_VARIANCE",this._onParticleEmitterSetLifetimeVariance),this._world.final("PARTICLE_EMITTER.SET_MAX_PARTICLES",this._onParticleEmitterSetMaxParticles),this._world.final("PARTICLE_EMITTER.SET_OFFSET",this._onParticleEmitterSetOffset),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END",this._onParticleEmitterSetOpacityEnd),this._world.final("PARTICLE_EMITTER.SET_OPACITY_END_VARIANCE",this._onParticleEmitterSetOpacityEndVariance),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START",this._onParticleEmitterSetOpacityStart),this._world.final("PARTICLE_EMITTER.SET_OPACITY_START_VARIANCE",this._onParticleEmitterSetOpacityStartVariance),this._world.final("PARTICLE_EMITTER.SET_PAUSED",this._onParticleEmitterSetPaused),this._world.final("PARTICLE_EMITTER.SET_POSITION",this._onParticleEmitterSetPosition),this._world.final("PARTICLE_EMITTER.SET_POSITION_VARIANCE",this._onParticleEmitterSetPositionVariance),this._world.final("PARTICLE_EMITTER.SET_RATE",this._onParticleEmitterSetRate),this._world.final("PARTICLE_EMITTER.SET_RATE_VARIANCE",this._onParticleEmitterSetRateVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_END",this._onParticleEmitterSetSizeEnd),this._world.final("PARTICLE_EMITTER.SET_SIZE_END_VARIANCE",this._onParticleEmitterSetSizeEndVariance),this._world.final("PARTICLE_EMITTER.SET_SIZE_START",this._onParticleEmitterSetSizeStart),this._world.final("PARTICLE_EMITTER.SET_SIZE_START_VARIANCE",this._onParticleEmitterSetSizeStartVariance),this._world.final("PARTICLE_EMITTER.SET_TEXTURE_URI",this._onParticleEmitterSetTextureUri),this._world.final("PARTICLE_EMITTER.SET_TRANSPARENT",this._onParticleEmitterSetTransparent),this._world.final("PARTICLE_EMITTER.SET_VELOCITY",this._onParticleEmitterSetVelocity),this._world.final("PARTICLE_EMITTER.SET_VELOCITY_VARIANCE",this._onParticleEmitterSetVelocityVariance),this._world.final("PARTICLE_EMITTER.SPAWN",this._onParticleEmitterSpawn)}_subscribeToPlayerEvents(){this._world.final("PLAYER.JOINED_WORLD",this._onPlayerJoinedWorld),this._world.final("PLAYER.LEFT_WORLD",this._onPlayerLeftWorld),this._world.final("PLAYER.RECONNECTED_WORLD",this._onPlayerReconnectedWorld),this._world.final("PLAYER.REQUEST_SYNC",this._onPlayerRequestSync)}_subscribeToPlayerCameraEvents(){this._world.final("PLAYER_CAMERA.LOOK_AT_ENTITY",this._onPlayerCameraLookAtEntity),this._world.final("PLAYER_CAMERA.LOOK_AT_POSITION",this._onPlayerCameraLookAtPosition),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_ENTITY",this._onPlayerCameraSetAttachedToEntity),this._world.final("PLAYER_CAMERA.SET_ATTACHED_TO_POSITION",this._onPlayerCameraSetAttachedToPosition),this._world.final("PLAYER_CAMERA.SET_FILM_OFFSET",this._onPlayerCameraSetFilmOffset),this._world.final("PLAYER_CAMERA.SET_FORWARD_OFFSET",this._onPlayerCameraSetForwardOffset),this._world.final("PLAYER_CAMERA.SET_FOV",this._onPlayerCameraSetFov),this._world.final("PLAYER_CAMERA.SET_MODEL_HIDDEN_NODES",this._onPlayerCameraSetModelHiddenNodes),this._world.final("PLAYER_CAMERA.SET_MODEL_SHOWN_NODES",this._onPlayerCameraSetModelShownNodes),this._world.final("PLAYER_CAMERA.SET_MODE",this._onPlayerCameraSetMode),this._world.final("PLAYER_CAMERA.SET_OFFSET",this._onPlayerCameraSetOffset),this._world.final("PLAYER_CAMERA.SET_SHOULDER_ANGLE",this._onPlayerCameraSetShoulderAngle),this._world.final("PLAYER_CAMERA.SET_TRACKED_ENTITY",this._onPlayerCameraSetTrackedEntity),this._world.final("PLAYER_CAMERA.SET_TRACKED_POSITION",this._onPlayerCameraSetTrackedPosition),this._world.final("PLAYER_CAMERA.SET_ZOOM",this._onPlayerCameraSetZoom)}_subscribeToPlayerUIEvents(){this._world.final("PLAYER_UI.LOAD",this._onPlayerUILoad),this._world.final("PLAYER_UI.LOCK_POINTER",this._onPlayerUILockPointer),this._world.final("PLAYER_UI.SEND_DATA",this._onPlayerUISendData)}_subscribeToSceneUIEvents(){this._world.final("SCENE_UI.LOAD",this._onSceneUILoad),this._world.final("SCENE_UI.SET_ATTACHED_TO_ENTITY",this._onSceneUISetAttachedToEntity),this._world.final("SCENE_UI.SET_OFFSET",this._onSceneUISetOffset),this._world.final("SCENE_UI.SET_POSITION",this._onSceneUISetPosition),this._world.final("SCENE_UI.SET_STATE",this._onSceneUISetState),this._world.final("SCENE_UI.SET_VIEW_DISTANCE",this._onSceneUISetViewDistance),this._world.final("SCENE_UI.UNLOAD",this._onSceneUIUnload)}_subscribeToSimulationEvents(){this._world.final("SIMULATION.DEBUG_RAYCAST",this._onSimulationDebugRaycast),this._world.final("SIMULATION.DEBUG_RENDER",this._onSimulationDebugRender)}_subscribeToWorldEvents(){this._world.final("WORLD.SET_AMBIENT_LIGHT_COLOR",this._onWorldSetAmbientLightColor),this._world.final("WORLD.SET_AMBIENT_LIGHT_INTENSITY",this._onWorldSetAmbientLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",this._onWorldSetDirectionalLightColor),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",this._onWorldSetDirectionalLightIntensity),this._world.final("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",this._onWorldSetDirectionalLightPosition),this._world.final("WORLD.SET_FOG_COLOR",this._onWorldSetFogColor),this._world.final("WORLD.SET_FOG_FAR",this._onWorldSetFogFar),this._world.final("WORLD.SET_FOG_NEAR",this._onWorldSetFogNear),this._world.final("WORLD.SET_SKYBOX_INTENSITY",this._onWorldSetSkyboxIntensity)}_onAudioPause=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pa=!0,delete J.pl,delete J.r};_onAudioPlay=(Z)=>{let J=Z.audio.serialize();J.pl=!0,delete J.pa,delete J.r,this._queuedAudioSynchronizations.set(J.i,J)};_onAudioPlayRestart=(Z)=>{let J=Z.audio.serialize();J.r=!0,delete J.pa,delete J.pl,this._queuedAudioSynchronizations.set(J.i,J)};_onAudioSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onAudioSetCutoffDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.cd=Z.cutoffDistance};_onAudioSetDetune=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.de=Z.detune};_onAudioSetDistortion=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.di=Z.distortion};_onAudioSetPosition=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.e=Z.position?void 0:J.e,J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0};_onAudioSetPlaybackRate=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.pr=Z.playbackRate};_onAudioSetReferenceDistance=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.rd=Z.referenceDistance};_onAudioSetVolume=(Z)=>{let J=this._createOrGetQueuedAudioSync(Z.audio);J.v=Z.volume};_onBlockTypeRegistryRegisterBlockType=(Z)=>{let J=Z.blockType.serialize();this._queuedBlockTypeSynchronizations.set(Z.blockType.id,J)};_onChatSendBroadcastMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=J.getObject();Q.m=Y,Q.c=$,Q.p=X?.id;let W=J.getArray();W.push(Q),this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,W,this._world.loop.currentTick,J.getArray()))};_onChatSendPlayerMessage=(Z)=>{let J=this._world.tickAllocator,{player:X,message:Y,color:$}=Z,Q=this._queuedPerPlayerSynchronizations.get(X)??[],W=J.getObject();W.m=Y,W.c=$;let K=J.getArray();K.push(W),Q.push(Y0.createPacket(Y0.outboundPackets.chatMessagesPacketDefinition,K,this._world.loop.currentTick,this._world.tickAllocator.getArray())),this._queuedPerPlayerSynchronizations.set(X,Q)};_onChunkLatticeAddChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk);J.b=this._world.tickAllocator.getArray(Z.chunk.blocks),J.rm=void 0,this._spawnedChunks.add(J.c.join(","))};_onChunkLatticeRemoveChunk=(Z)=>{let J=this._createOrGetQueuedChunkSync(Z.chunk),X=J.c.join(",");if(this._spawnedChunks.has(X))this._queuedChunkSynchronizations.delete(X),this._spawnedChunks.delete(X);else J.rm=!0};_onChunkLatticeSetBlock=(Z)=>{let J=this._createOrGetQueuedBlockSync(Z.globalCoordinate);J.i=Z.blockTypeId};_onEntitySetModelAnimationsPlaybackRate=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.ap=Z.playbackRate};_onEntitySpawn=(Z)=>{let J=Z.entity.serialize();this._queuedEntitySynchronizations.set(J.i,J),this._spawnedEntities.add(J.i)};_onEntityDespawn=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);if(this._spawnedEntities.has(J.i))this._queuedEntitySynchronizations.delete(J.i),this._spawnedEntities.delete(J.i);else J.rm=!0};_onEntitySetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.h=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onEntitySetModelScale=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.s=Z.modelScale};_onEntitySetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.sn=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onEntitySetModelTextureUri=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.mt=Z.modelTextureUri};_onEntitySetOpacity=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.o=Z.opacity};_onEntitySetParent=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.pe=Z.parent?Z.parent.id:void 0,J.pn=Z.parentNodeName};_onEntitySetTintColor=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.t=Z.tintColor?D0.serializeRgbColor(Z.tintColor,this._world.tickAllocator):void 0};_onEntityStartModelLoopedAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.al,Z.animations);if(X.al=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStartModelOneshotAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity),Y=J.getSet(X.ao,Z.animations);if(X.ao=J.getArray(Y),X.as){let $=J.getArray();for(let Q of X.as)!Y.has(Q)&&$.push(Q);X.as=$}};_onEntityStopModelAnimations=(Z)=>{let J=this._world.tickAllocator,X=this._createOrGetQueuedEntitySync(Z.entity);if(X.al){let Y=J.getSet(X.al);for(let $ of Z.animations)Y.delete($);X.al=J.getArray(Y)}if(X.ao){let Y=J.getSet(X.ao);for(let $ of Z.animations)Y.delete($);X.ao=J.getArray(Y)}X.as=J.getArray(J.getSet(X.as,Z.animations))};_onEntityUpdateRotation=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.r=D0.serializeQuaternion(Z.rotation,this._world.tickAllocator)};_onEntityUpdatePosition=(Z)=>{let J=this._createOrGetQueuedEntitySync(Z.entity);J.p=D0.serializeVector(Z.position,this._world.tickAllocator)};_onLightDespawn=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.rm=!0};_onLightSetAngle=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.a=Z.angle};_onLightSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onLightSetColor=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.c=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onLightSetDistance=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.d=Z.distance};_onLightSetIntensity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.n=Z.intensity};_onLightSetOffset=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onLightSetPenumbra=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.pe=Z.penumbra};_onLightSetPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e};_onLightSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.te=Z.entity?Z.entity.id:void 0,J.tp=Z.entity?void 0:J.tp};_onLightSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedLightSync(Z.light);J.tp=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.te=Z.position?void 0:J.te};_onLightSpawn=(Z)=>{let J=Z.light.serialize();this._queuedLightSynchronizations.set(J.i,J)};_onParticleEmitterBurst=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.b=Z.count};_onParticleEmitterDespawn=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rm=!0};_onParticleEmitterSetAlphaTest=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.at=Z.alphaTest};_onParticleEmitterSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onParticleEmitterSetAttachedToEntityNodeName=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.en=Z.attachedToEntityNodeName};_onParticleEmitterSetColorEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ce=Z.colorEnd?D0.serializeRgbColor(Z.colorEnd,this._world.tickAllocator):void 0};_onParticleEmitterSetColorEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cev=Z.colorEndVariance?D0.serializeRgbColor(Z.colorEndVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.cs=Z.colorStart?D0.serializeRgbColor(Z.colorStart,this._world.tickAllocator):void 0};_onParticleEmitterSetColorStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.csv=Z.colorStartVariance?D0.serializeRgbColor(Z.colorStartVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetGravity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.g=Z.gravity?D0.serializeVector(Z.gravity,this._world.tickAllocator):void 0};_onParticleEmitterSetLifetime=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.l=Z.lifetime};_onParticleEmitterSetLifetimeVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.lv=Z.lifetimeVariance};_onParticleEmitterSetMaxParticles=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.mp=Z.maxParticles};_onParticleEmitterSetOffset=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onParticleEmitterSetOpacityEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oe=Z.opacityEnd};_onParticleEmitterSetOpacityEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.oev=Z.opacityEndVariance};_onParticleEmitterSetOpacityStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.os=Z.opacityStart};_onParticleEmitterSetOpacityStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.osv=Z.opacityStartVariance};_onParticleEmitterSetPaused=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pa=Z.paused};_onParticleEmitterSetPosition=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e,J.en=Z.position?void 0:J.en};_onParticleEmitterSetPositionVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.pv=Z.positionVariance?D0.serializeVector(Z.positionVariance,this._world.tickAllocator):void 0};_onParticleEmitterSetRate=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.r=Z.rate};_onParticleEmitterSetRateVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.rv=Z.rateVariance};_onParticleEmitterSetSizeEnd=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.se=Z.sizeEnd};_onParticleEmitterSetSizeEndVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.sev=Z.sizeEndVariance};_onParticleEmitterSetSizeStart=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ss=Z.sizeStart};_onParticleEmitterSetSizeStartVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.ssv=Z.sizeStartVariance};_onParticleEmitterSetTextureUri=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.tu=Z.textureUri};_onParticleEmitterSetTransparent=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.t=Z.transparent};_onParticleEmitterSetVelocity=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.v=Z.velocity?D0.serializeVector(Z.velocity,this._world.tickAllocator):void 0};_onParticleEmitterSetVelocityVariance=(Z)=>{let J=this._createOrGetQueuedParticleEmitterSync(Z.particleEmitter);J.vv=Z.velocityVariance?D0.serializeVector(Z.velocityVariance,this._world.tickAllocator):void 0};_onParticleEmitterSpawn=(Z)=>{let J=Z.particleEmitter.serialize();this._queuedParticleEmitterSynchronizations.set(J.i,J)};_onPlayerCameraLookAtEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=D0.serializeVector(Z.entity.position,this._world.tickAllocator),delete J.et,delete J.pt};_onPlayerCameraLookAtPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pl=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.et,delete J.pt};_onPlayerCameraSetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.e=Z.entity.id,delete J.p};_onPlayerCameraSetAttachedToPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.e};_onPlayerCameraSetFilmOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fo=Z.filmOffset};_onPlayerCameraSetForwardOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.ffo=Z.forwardOffset};_onPlayerCameraSetFov=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.fv=Z.fov};_onPlayerCameraSetModelHiddenNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.h=this._world.tickAllocator.getArray(Z.modelHiddenNodes)};_onPlayerCameraSetModelShownNodes=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.s=this._world.tickAllocator.getArray(Z.modelShownNodes)};_onPlayerCameraSetMode=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.m=Z.mode};_onPlayerCameraSetOffset=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onPlayerCameraSetShoulderAngle=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.sa=Z.shoulderAngle};_onPlayerCameraSetTrackedEntity=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.et=Z.entity?Z.entity.id:void 0,delete J.pl,delete J.pt};_onPlayerCameraSetTrackedPosition=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.pt=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,delete J.et,delete J.pl};_onPlayerCameraSetZoom=(Z)=>{let J=this._createOrGetQueuedPlayerCameraSync(Z.playerCamera);J.z=Z.zoom};_onPlayerJoinedWorld=(Z)=>{let J=this._world.tickAllocator,{player:X}=Z,Y=this._queuedPerPlayerSynchronizations.get(X)??J.getArray();Y.push(Y0.createPacket(Y0.outboundPackets.worldPacketDefinition,this._world.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.blockTypesPacketDefinition,this._world.blockTypeRegistry.serialize(),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.chunksPacketDefinition,J.map(this._world.chunkLattice.getAllChunks(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.entitiesPacketDefinition,J.map(this._world.entityManager.getAllEntities(!0),(Q)=>{if(X.camera.attachedToEntity===void 0&&Q instanceof v7&&Q.player===X)X.camera.setAttachedToEntity(Q);return Q.serialize()}),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.audiosPacketDefinition,J.map(this._world.audioManager.getAllLoopedAudios(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.lightsPacketDefinition,J.map(this._world.lightManager.getAllLights(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.particleEmittersPacketDefinition,J.map(this._world.particleEmitterManager.getAllParticleEmitters(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.sceneUIsPacketDefinition,J.map(this._world.sceneUIManager.getAllSceneUIs(!0),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray())),Y.push(Y0.createPacket(Y0.outboundPackets.playersPacketDefinition,J.map(V9.instance.getConnectedPlayers(),(Q)=>Q.serialize()),this._world.loop.currentTick,J.getArray()));let $=this._createOrGetQueuedPlayerCameraSync(X.camera);this._queuedPerPlayerCameraSynchronizations.set(X,J.getObject(X.camera.serialize(),$)),this._queuedPerPlayerSynchronizations.set(X,Y),this._queuedPlayerSynchronizations.set(X.id,X.serialize())};_onPlayerLeftWorld=(Z)=>{let J=this._createOrGetQueuedPlayerSync(Z.player);J.rm=!0};_onPlayerReconnectedWorld=(Z)=>{this._onPlayerJoinedWorld(Z)};_onPlayerRequestSync=(Z)=>{let J=this._world.tickAllocator,X=J.getObject();X.r=Z.receivedAt,X.s=Date.now(),X.p=performance.now()-Z.receivedAtMs,X.n=this._world.loop.nextTickMs,Z.player.connection.send([Y0.createPacket(Y0.outboundPackets.syncResponsePacketDefinition,X,this._world.loop.currentTick,J.getArray())])};_onPlayerUILoad=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.u=Z.htmlUri};_onPlayerUILockPointer=(Z)=>{let J=this._createOrGetQueuedPlayerUISync(Z.playerUI);J.p=Z.lock};_onPlayerUISendData=(Z)=>{this._createOrGetQueuedPlayerUIDatasSync(Z.playerUI).push(Z.data)};_onSceneUILoad=(Z)=>{let J=Z.sceneUI.serialize();this._queuedSceneUISynchronizations.set(J.i,J),this._loadedSceneUIs.add(J.i)};_onSceneUISetAttachedToEntity=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.e=Z.entity?Z.entity.id:void 0,J.p=Z.entity?void 0:J.p};_onSceneUISetOffset=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.o=Z.offset?D0.serializeVector(Z.offset,this._world.tickAllocator):void 0};_onSceneUISetPosition=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.p=Z.position?D0.serializeVector(Z.position,this._world.tickAllocator):void 0,J.e=Z.position?void 0:J.e};_onSceneUISetState=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.s=Z.state};_onSceneUISetViewDistance=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);J.v=Z.viewDistance};_onSceneUIUnload=(Z)=>{let J=this._createOrGetQueuedSceneUISync(Z.sceneUI);if(this._loadedSceneUIs.has(J.i))this._queuedSceneUISynchronizations.delete(J.i),this._loadedSceneUIs.delete(J.i);else J.rm=!0};_onSimulationDebugRaycast=(Z)=>{this._queuedDebugRaycastSynchronizations.push(D0.serializePhysicsDebugRaycast(Z,this._world.tickAllocator))};_onSimulationDebugRender=(Z)=>{this._queuedBroadcasts.push(Y0.createPacket(Y0.outboundPackets.physicsDebugRenderPacketDefinition,{v:Array.from(Z.vertices),c:Array.from(Z.colors)},this._world.loop.currentTick,this._world.tickAllocator.getArray()))};_onWorldSetAmbientLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ac=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetAmbientLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ai=Z.intensity};_onWorldSetDirectionalLightColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetDirectionalLightIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.di=Z.intensity};_onWorldSetDirectionalLightPosition=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.dp=D0.serializeVector(Z.position,this._world.tickAllocator)};_onWorldSetFogColor=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fc=D0.serializeRgbColor(Z.color,this._world.tickAllocator)};_onWorldSetFogFar=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.ff=Z.far};_onWorldSetFogNear=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.fn=Z.near};_onWorldSetSkyboxIntensity=(Z)=>{let J=this._createOrGetQueuedWorldSync(Z.world);J.si=Z.intensity};_createOrGetQueuedAudioSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedAudioSync(): Audio has no id!");let J=this._queuedAudioSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedAudioSynchronizations.set(Z.id,J);return J}_createOrGetQueuedBlockSync(Z){let{x:J,y:X,z:Y}=Z,$=`${J},${X},${Y}`,Q=this._queuedBlockSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.i=0,Q.c=[J,X,Y],this._queuedBlockSynchronizations.set($,Q);return Q}_createOrGetQueuedChunkSync(Z){if(!Z.originCoordinate)d.fatalError("NetworkSynchronizer._createOrGetQueuedChunkSync(): Chunk has no origin coordinate!");let{x:J,y:X,z:Y}=Z.originCoordinate,$=`${J},${X},${Y}`,Q=this._queuedChunkSynchronizations.get($);if(!Q)Q=this._world.tickAllocator.getObject(),Q.c=[J,X,Y],this._queuedChunkSynchronizations.set($,Q);return Q}_createOrGetQueuedEntitySync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedEntitySync(): Entity has no id!");let J=this._queuedEntitySynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedEntitySynchronizations.set(Z.id,J);return J}_createOrGetQueuedLightSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedLightSync(): Light has no id!");let J=this._queuedLightSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedLightSynchronizations.set(Z.id,J);return J}_createOrGetQueuedParticleEmitterSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedParticleEmitterSync(): ParticleEmitter has no id!");let J=this._queuedParticleEmitterSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedParticleEmitterSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerSync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedPlayerSync(): Player has no id!");let J=this._queuedPlayerSynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedPlayerSynchronizations.set(Z.id,J);return J}_createOrGetQueuedPlayerCameraSync(Z){let J=this._queuedPerPlayerCameraSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerCameraSynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUISync(Z){let J=this._queuedPerPlayerUISynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getObject(),this._queuedPerPlayerUISynchronizations.set(Z.player,J);return J}_createOrGetQueuedPlayerUIDatasSync(Z){let J=this._queuedPerPlayerUIDatasSynchronizations.get(Z.player);if(!J)J=this._world.tickAllocator.getArray(),this._queuedPerPlayerUIDatasSynchronizations.set(Z.player,J);return J}_createOrGetQueuedSceneUISync(Z){if(Z.id===void 0)d.fatalError("NetworkSynchronizer._createOrGetQueuedSceneUISync(): SceneUI has no id!");let J=this._queuedSceneUISynchronizations.get(Z.id);if(!J)J=this._world.tickAllocator.getObject(),J.i=Z.id,this._queuedSceneUISynchronizations.set(Z.id,J);return J}_createOrGetQueuedWorldSync(Z){if(Z.id!==this._world.id)d.fatalError("NetworkSynchronizer._createOrGetQueuedWorldSync(): World does not match this network synchronizer world!");return this._queuedWorldSynchronization??=this._world.tickAllocator.getObject(),this._queuedWorldSynchronization.i=Z.id,this._queuedWorldSynchronization}_createOrGetSynchronizedPlayerReliablePackets(Z,J){let X=this._synchronizedPlayerReliablePackets.get(Z);if(!X)X=this._world.tickAllocator.getArray(J),this._synchronizedPlayerReliablePackets.set(Z,X);return X}}class GF{_particleEmitters=new Map;_nextParticleEmitterId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}despawnEntityAttachedParticleEmitters(Z){this.getAllEntityAttachedParticleEmitters(Z).forEach((J)=>{J.despawn()})}getAllParticleEmitters(Z=!1){return Z?this._world.tickAllocator.getArray(this._particleEmitters.values()):Array.from(this._particleEmitters.values())}getAllEntityAttachedParticleEmitters(Z){return this.getAllParticleEmitters().filter((J)=>J.attachedToEntity===Z)}registerParticleEmitter(Z){if(Z.id!==void 0)return Z.id;let J=this._nextParticleEmitterId;return this._particleEmitters.set(J,Z),this._nextParticleEmitterId++,J}unregisterParticleEmitter(Z){if(Z.id===void 0)return;this._particleEmitters.delete(Z.id)}}class zF{_sceneUIs=new Map;_nextSceneUIId=1;_world;constructor(Z){this._world=Z}get world(){return this._world}getAllSceneUIs(Z=!1){return Z?this._world.tickAllocator.getArray(this._sceneUIs.values()):Array.from(this._sceneUIs.values())}getAllEntityAttachedSceneUIs(Z){return this.getAllSceneUIs().filter((J)=>J.attachedToEntity===Z)}getSceneUIById(Z){return this._sceneUIs.get(Z)}registerSceneUI(Z){if(Z.id!==void 0)return Z.id;let J=this._nextSceneUIId;return this._sceneUIs.set(J,Z),this._nextSceneUIId++,J}unloadEntityAttachedSceneUIs(Z){this.getAllEntityAttachedSceneUIs(Z).forEach((J)=>{J.unload()})}unregisterSceneUI(Z){if(Z.id===void 0)return;this._sceneUIs.delete(Z.id)}}class HF{_allocatedArrays=[];_allocatedArray3Numbers=[];_allocatedArray4Numbers=[];_allocatedObjects=[];_allocatedSets=[];_arrayPool=[];_array3NumberPool=[];_array4NumberPool=[];_objectPool=[];_setPool=[];filter(Z,J){let X=this.getArray();for(let Y=0;Y<Z.length;Y++)if(J(Z[Y],Y,Z))X.push(Z[Y]);return X}getArray(Z,J){let X=this._arrayPool.pop()??[];X.length=0;let Y=0;if(Z)for(let $ of Z)X[Y++]=$;if(J)for(let $ of J)X[Y++]=$;return this._allocatedArrays.push(X),X}getArray3Number(Z){let J=this._array3NumberPool.pop()??[0,0,0];if(J[0]=J[1]=J[2]=0,Z){let X=0;for(let Y of Z){if(X>=3)break;J[X++]=Y}}return this._allocatedArray3Numbers.push(J),J}getArray4Number(Z){let J=this._array4NumberPool.pop()??[0,0,0,0];if(J[0]=J[1]=J[2]=J[3]=0,Z){let X=0;for(let Y of Z){if(X>=4)break;J[X++]=Y}}return this._allocatedArray4Numbers.push(J),J}getObject(Z,J){let X=this._objectPool.pop()??Object.create(null);for(let Y in X)delete X[Y];if(Z)Object.assign(X,Z);if(J)Object.assign(X,J);return this._allocatedObjects.push(X),X}getSet(Z,J){let X=this._setPool.pop()??new Set;if(X.clear(),Z)for(let Y of Z)X.add(Y);if(J)for(let Y of J)X.add(Y);return this._allocatedSets.push(X),X}map(Z,J){let X=this.getArray();X.length=Z.length;for(let Y=0;Y<Z.length;Y++)X[Y]=J(Z[Y],Y,Z);return X}reset(){for(let Z=0;Z<this._allocatedArrays.length;Z++)if(this._arrayPool.length<4096)this._arrayPool.push(this._allocatedArrays[Z]);for(let Z=0;Z<this._allocatedArray3Numbers.length;Z++)if(this._array3NumberPool.length<4096)this._array3NumberPool.push(this._allocatedArray3Numbers[Z]);for(let Z=0;Z<this._allocatedArray4Numbers.length;Z++)if(this._array4NumberPool.length<4096)this._array4NumberPool.push(this._allocatedArray4Numbers[Z]);for(let Z=0;Z<this._allocatedObjects.length;Z++)if(this._objectPool.length<4096)this._objectPool.push(this._allocatedObjects[Z]);for(let Z=0;Z<this._allocatedSets.length;Z++)if(this._setPool.length<1024)this._setPool.push(this._allocatedSets[Z]);this._allocatedArrays.length=0,this._allocatedArray3Numbers.length=0,this._allocatedArray4Numbers.length=0,this._allocatedObjects.length=0,this._allocatedSets.length=0}}var w46=2,B46=3;class VF{_accumulatorMs=0;_targetTicksPerSecond;_fixedTimestepMs;_fixedTimestepS;_maxAccumulatorMs;_nextTickMs=0;_lastLoopTimeMs=0;_tickFunction;_tickErrorCallback;_tickHandle=null;constructor(Z,J,X){this._targetTicksPerSecond=Z,this._fixedTimestepS=Math.fround(1/Z),this._fixedTimestepMs=Math.fround(this._fixedTimestepS*1000),this._maxAccumulatorMs=this._fixedTimestepMs*B46,this._tickFunction=J,this._tickErrorCallback=X}get targetTicksPerSecond(){return this._targetTicksPerSecond}get fixedTimestepMs(){return this._fixedTimestepMs}get fixedTimestepS(){return this._fixedTimestepS}get isStarted(){return!!this._tickHandle}get nextTickMs(){return this._nextTickMs}start(){if(this._tickHandle)return;this._lastLoopTimeMs=performance.now();let Z=()=>{let J=performance.now(),X=J-this._lastLoopTimeMs;if(this._lastLoopTimeMs=J,this._accumulatorMs+=X,this._accumulatorMs>this._maxAccumulatorMs)this._accumulatorMs=this._maxAccumulatorMs;if(this._accumulatorMs>=this._fixedTimestepMs)V8.startSpan({operation:"ticker_tick"},()=>{let Y=0;while(this._accumulatorMs>=this._fixedTimestepMs&&Y<w46)this._tick(this._fixedTimestepMs),this._accumulatorMs-=this._fixedTimestepMs,Y++});this._nextTickMs=Math.max(0,this._fixedTimestepMs-this._accumulatorMs),this._tickHandle=setTimeout(Z,this._nextTickMs)};Z()}stop(){if(!this._tickHandle)return;clearTimeout(this._tickHandle),this._tickHandle=null}_tick(Z){try{this._tickFunction(Z)}catch(J){if(J instanceof Error&&this._tickErrorCallback)this._tickErrorCallback(J);else d.warning(`Ticker._tick(): tick callback threw an error, but it was not an instance of Error. Error: ${J}`)}}}var p$1;((Q)=>{Q.START="WORLD_LOOP.START";Q.STOP="WORLD_LOOP.STOP";Q.TICK_START="WORLD_LOOP.TICK_START";Q.TICK_END="WORLD_LOOP.TICK_END";Q.TICK_ERROR="WORLD_LOOP.TICK_ERROR"})(p$1||={});class qF extends j0{_currentTick=0;_ticker;_world;constructor(Z,J=sy){super();this._ticker=new VF(J,this._tick,this._onTickError),this._world=Z}get currentTick(){return this._currentTick}get isStarted(){return this._ticker.isStarted}get nextTickMs(){return this._ticker.nextTickMs}get timestepS(){return this._ticker.fixedTimestepS}get world(){return this._world}start(){this._ticker.start(),this.emitWithWorld(this._world,"WORLD_LOOP.START",{worldLoop:this})}stop(){this._ticker.stop(),this.emitWithWorld(this._world,"WORLD_LOOP.STOP",{worldLoop:this})}_tick=(Z)=>{this.emitWithWorld(this._world,"WORLD_LOOP.TICK_START",{worldLoop:this,tickDeltaMs:Z});let J=performance.now();V8.startSpan({operation:"world_tick",attributes:{serverPlayerCount:V9.instance.playerCount,targetTickRate:this._ticker.targetTicksPerSecond,targetTickRateMs:this._ticker.fixedTimestepMs,worldId:this._world.id,worldName:this._world.name,worldChunkCount:this._world.chunkLattice.chunkCount,worldEntityCount:this._world.entityManager.entityCount,worldLoopTick:this._currentTick}},()=>{V8.startSpan({operation:"entities_tick"},()=>this._world.entityManager.tickEntities(Z)),V8.startSpan({operation:"simulation_step"},()=>this._world.simulation.step(Z)),V8.startSpan({operation:"entities_emit_updates"},()=>this._world.entityManager.checkAndEmitUpdates()),V8.startSpan({operation:"network_synchronize"},()=>this._world.networkSynchronizer.synchronize()),V8.startSpan({operation:"release_tick_allocation"},()=>this._world.tickAllocator.reset())}),this._currentTick++,this.emitWithWorld(this._world,"WORLD_LOOP.TICK_END",{worldLoop:this,tickDurationMs:performance.now()-J})};_onTickError=(Z)=>{d.error(`WorldLoop._onTickError(): Error: ${Z}`),this.emitWithWorld(this._world,"WORLD_LOOP.TICK_ERROR",{worldLoop:this,error:Z})}}var ry;((V)=>{V.SET_AMBIENT_LIGHT_COLOR="WORLD.SET_AMBIENT_LIGHT_COLOR";V.SET_AMBIENT_LIGHT_INTENSITY="WORLD.SET_AMBIENT_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_COLOR="WORLD.SET_DIRECTIONAL_LIGHT_COLOR";V.SET_DIRECTIONAL_LIGHT_INTENSITY="WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY";V.SET_DIRECTIONAL_LIGHT_POSITION="WORLD.SET_DIRECTIONAL_LIGHT_POSITION";V.SET_FOG_COLOR="WORLD.SET_FOG_COLOR";V.SET_FOG_FAR="WORLD.SET_FOG_FAR";V.SET_FOG_NEAR="WORLD.SET_FOG_NEAR";V.SET_SKYBOX_INTENSITY="WORLD.SET_SKYBOX_INTENSITY";V.START="WORLD.START";V.STOP="WORLD.STOP"})(ry||={});class FF extends j0{_id;_ambientLightColor;_ambientLightIntensity;_audioManager;_blockTypeRegistry;_chatManager;_chunkLattice;_directionalLightColor;_directionalLightIntensity;_directionalLightPosition;_entityManager;_fogColor;_fogFar;_fogNear;_lightManager;_loop;_name;_networkSynchronizer;_particleEmitterManager;_sceneUIManager;_simulation;_skyboxIntensity;_skyboxUri;_tag;_tickAllocator;constructor(Z){super();if(this._id=Z.id,this._ambientLightColor=Z.ambientLightColor??{r:255,g:255,b:255},this._ambientLightIntensity=Z.ambientLightIntensity??1,this._directionalLightColor=Z.directionalLightColor??{r:255,g:255,b:255},this._directionalLightIntensity=Z.directionalLightIntensity??3,this._directionalLightPosition=Z.directionalLightPosition??{x:100,y:150,z:100},this._fogColor=Z.fogColor,this._fogFar=Z.fogFar??550,this._fogNear=Z.fogNear??500,this._name=Z.name,this._skyboxIntensity=Z.skyboxIntensity??1,this._skyboxUri=Z.skyboxUri,this._tag=Z.tag,this._audioManager=new u3(this),this._blockTypeRegistry=new Fz(this),this._chatManager=new cz(this),this._chunkLattice=new lz(this),this._entityManager=new az(this),this._lightManager=new WF(this),this._loop=new qF(this,Z.tickRate),this._networkSynchronizer=new mR(this),this._particleEmitterManager=new GF(this),this._sceneUIManager=new zF(this),this._simulation=new KF(this,Z.tickRate,Z.gravity),this._tickAllocator=new HF,Z.map)this.loadMap(Z.map)}get id(){return this._id}get ambientLightColor(){return this._ambientLightColor}get ambientLightIntensity(){return this._ambientLightIntensity}get blockTypeRegistry(){return this._blockTypeRegistry}get chatManager(){return this._chatManager}get chunkLattice(){return this._chunkLattice}get directionalLightColor(){return this._directionalLightColor}get directionalLightIntensity(){return this._directionalLightIntensity}get directionalLightPosition(){return this._directionalLightPosition}get entityManager(){return this._entityManager}get fogColor(){return this._fogColor}get fogFar(){return this._fogFar}get fogNear(){return this._fogNear}get lightManager(){return this._lightManager}get loop(){return this._loop}get name(){return this._name}get networkSynchronizer(){return this._networkSynchronizer}get particleEmitterManager(){return this._particleEmitterManager}get sceneUIManager(){return this._sceneUIManager}get simulation(){return this._simulation}get skyboxIntensity(){return this._skyboxIntensity}get skyboxUri(){return this._skyboxUri}get audioManager(){return this._audioManager}get tag(){return this._tag}get tickAllocator(){return this._tickAllocator}loadMap(Z){if(this.chunkLattice.clear(),Z.blockTypes)for(let J of Z.blockTypes)this.blockTypeRegistry.registerGenericBlockType({id:J.id,isLiquid:J.isLiquid,name:J.name,textureUri:J.textureUri});if(Z.blocks)for(let[J,X]of Object.entries(Z.blocks)){let[Y,$,Q]=J.split(",").map(Number);this.chunkLattice.setBlock({x:Y,y:$,z:Q},X)}if(Z.entities)for(let[J,X]of Object.entries(Z.entities)){let[Y,$,Q]=J.split(",").map(Number);new a8({isEnvironmental:!0,...X}).spawn(this,{x:Y,y:$,z:Q})}}setAmbientLightColor(Z){this._ambientLightColor=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_COLOR",{world:this,color:Z})}setAmbientLightIntensity(Z){this._ambientLightIntensity=Z,this.emit("WORLD.SET_AMBIENT_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightColor(Z){this._directionalLightColor=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_COLOR",{world:this,color:Z})}setDirectionalLightIntensity(Z){this._directionalLightIntensity=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_INTENSITY",{world:this,intensity:Z})}setDirectionalLightPosition(Z){this._directionalLightPosition=Z,this.emit("WORLD.SET_DIRECTIONAL_LIGHT_POSITION",{world:this,position:Z})}setFogColor(Z){this._fogColor=Z,this.emit("WORLD.SET_FOG_COLOR",{world:this,color:Z})}setFogFar(Z){this._fogFar=Z,this.emit("WORLD.SET_FOG_FAR",{world:this,far:Z})}setFogNear(Z){this._fogNear=Z,this.emit("WORLD.SET_FOG_NEAR",{world:this,near:Z})}setSkyboxIntensity(Z){this._skyboxIntensity=Z,this.emit("WORLD.SET_SKYBOX_INTENSITY",{world:this,intensity:Z})}start(){if(this._loop.isStarted)return;this._loop.start(),this.emit("WORLD.START",{world:this,startedAtMs:Date.now()})}stop(){if(!this._loop.isStarted)return;this._loop.stop(),this.emit("WORLD.STOP",{world:this,stoppedAtMs:Date.now()})}serialize(){return D0.serializeWorld(this,this._tickAllocator)}}var i$1;((J)=>J.WORLD_CREATED="WORLD_MANAGER.WORLD_CREATED")(i$1||={});class HY{static instance=new HY;_defaultWorld;_nextWorldId=1;_worlds=new Map;createWorld(Z){let J=new FF({...Z,id:this._nextWorldId++});return J.start(),this._worlds.set(J.id,J),j0.globalInstance.emit("WORLD_MANAGER.WORLD_CREATED",{world:J}),J}getAllWorlds(){return Array.from(this._worlds.values())}getDefaultWorld(){return this._defaultWorld??=this.createWorld({name:"Default World",skyboxUri:"skyboxes/partly-cloudy"}),this._defaultWorld}getWorldsByTag(Z){let J=[];return this._worlds.forEach((X)=>{if(X.tag===Z)J.push(X)}),J}getWorld(Z){return this._worlds.get(Z)}setDefaultWorld(Z){this._defaultWorld=Z}}var n$1;((Y)=>{Y.PLAYER_CONNECTED="PLAYER_MANAGER.PLAYER_CONNECTED";Y.PLAYER_DISCONNECTED="PLAYER_MANAGER.PLAYER_DISCONNECTED";Y.PLAYER_RECONNECTED="PLAYER_MANAGER.PLAYER_RECONNECTED"})(n$1||={});class V9{static instance=new V9;worldSelectionHandler;_connectionPlayers=new Map;constructor(){j0.globalInstance.on("CONNECTION.OPENED",({connection:Z,req:J})=>{this._onConnectionOpened(Z,J.session)}),j0.globalInstance.on("CONNECTION.DISCONNECTED",({connection:Z})=>{this._onConnectionDisconnected(Z)}),j0.globalInstance.on("CONNECTION.RECONNECTED",({connection:Z})=>{this._onConnectionReconnected(Z)}),j0.globalInstance.on("CONNECTION.CLOSED",({connection:Z})=>{this._onConnectionClosed(Z)})}get playerCount(){return this._connectionPlayers.size}getConnectedPlayers(){return Array.from(this._connectionPlayers.values())}getConnectedPlayersByWorld(Z){return this.getConnectedPlayers().filter((J)=>J.world===Z)}getConnectedPlayerByUsername(Z){return Array.from(this._connectionPlayers.values()).find((J)=>{return J.username.toLowerCase()===Z.toLowerCase()})}async _onConnectionOpened(Z,J){let X=new lW(Z,J);await X.loadInitialPersistedData(),this._connectionPlayers.set(Z,X),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_CONNECTED",{player:X});let Y=await this.worldSelectionHandler?.(X);X.joinWorld(Y??HY.instance.getDefaultWorld())}_onConnectionDisconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.resetInputs(),J.camera.reset()}_onConnectionReconnected(Z){let J=this._connectionPlayers.get(Z);if(J)J.reconnected(),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_RECONNECTED",{player:J});else d.warning(`PlayerManager._onConnectionReconnected(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}_onConnectionClosed(Z){let J=this._connectionPlayers.get(Z);if(J)J.disconnect(),this._connectionPlayers.delete(Z),j0.globalInstance.emit("PLAYER_MANAGER.PLAYER_DISCONNECTED",{player:J});else d.warning(`PlayerManager._onConnectionClosed(): Connection ${Z.id} not in the PlayerManager._connectionPlayers map.`)}}Buffer.poolSize=134217728;var a$1;((X)=>{X.START="GAMESERVER.START";X.STOP="GAMESERVER.STOP"})(a$1||={});function L46(Z){Q1.init().then(()=>{return AQ.instance.modelRegistry.preloadModels()}).then(()=>{if(Z.length>0)Z(AQ.instance.worldManager.getDefaultWorld());else Z();AQ.instance.start()}).catch((J)=>{d.fatalError(`Failed to initialize the game engine, exiting. Error: ${J}`)})}class AQ{static _instance;_modelRegistry=k5.instance;_playerManager=V9.instance;_socket=m7.instance;_worldManager=HY.instance;_webServer=PK.instance;constructor(){}static get instance(){if(!this._instance)this._instance=new AQ;return this._instance}get modelRegistry(){return this._modelRegistry}get playerManager(){return this._playerManager}get socket(){return this._socket}get webServer(){return this._webServer}get worldManager(){return this._worldManager}start(){j0.globalInstance.emit("GAMESERVER.START",{startedAtMs:performance.now()}),this._webServer.start()}}var v0=0.000001,G1=typeof Float32Array!=="undefined"?Float32Array:Array,WZ=Math.random;var I55=Math.PI/180;if(!Math.hypot)Math.hypot=function(){var Z=0,J=arguments.length;while(J--)Z+=arguments[J]*arguments[J];return Math.sqrt(Z)};var l8={};D9(l8,{transpose:()=>P46,subtract:()=>o$1,sub:()=>u46,str:()=>_46,set:()=>D46,scale:()=>I46,rotate:()=>E46,multiplyScalarAndAdd:()=>g46,multiplyScalar:()=>y46,multiply:()=>s$1,mul:()=>m46,invert:()=>C46,identity:()=>R46,fromValues:()=>N46,fromScaling:()=>S46,fromRotation:()=>v46,frob:()=>x46,exactEquals:()=>f46,equals:()=>b46,determinant:()=>k46,create:()=>O46,copy:()=>M46,clone:()=>j46,adjoint:()=>T46,add:()=>h46,LDU:()=>A46});function O46(){var Z=new G1(4);if(G1!=Float32Array)Z[1]=0,Z[2]=0;return Z[0]=1,Z[3]=1,Z}function j46(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function M46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function R46(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=1,Z}function N46(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function D46(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function P46(Z,J){if(Z===J){var X=J[1];Z[1]=J[2],Z[2]=X}else Z[0]=J[0],Z[1]=J[2],Z[2]=J[1],Z[3]=J[3];return Z}function C46(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*Q-$*Y;if(!W)return null;return W=1/W,Z[0]=Q*W,Z[1]=-Y*W,Z[2]=-$*W,Z[3]=X*W,Z}function T46(Z,J){var X=J[0];return Z[0]=J[3],Z[1]=-J[1],Z[2]=-J[2],Z[3]=X,Z}function k46(Z){return Z[0]*Z[3]-Z[2]*Z[1]}function s$1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*K+Q*G,Z[1]=$*K+W*G,Z[2]=Y*z+Q*H,Z[3]=$*z+W*H,Z}function E46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+Q*K,Z[1]=$*G+W*K,Z[2]=Y*-K+Q*G,Z[3]=$*-K+W*G,Z}function I46(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1];return Z[0]=Y*K,Z[1]=$*K,Z[2]=Q*G,Z[3]=W*G,Z}function v46(Z,J){var X=Math.sin(J),Y=Math.cos(J);return Z[0]=Y,Z[1]=X,Z[2]=-X,Z[3]=Y,Z}function S46(Z,J){return Z[0]=J[0],Z[1]=0,Z[2]=0,Z[3]=J[1],Z}function _46(Z){return"mat2("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}function x46(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3])}function A46(Z,J,X,Y){return Z[2]=Y[2]/Y[0],X[0]=Y[0],X[1]=Y[1],X[3]=Y[3]-Z[2]*X[1],[Z,J,X]}function h46(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function o$1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z}function f46(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function b46(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}function y46(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function g46(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z}var m46=s$1,u46=o$1;var r1={};D9(r1,{transpose:()=>a46,translate:()=>t46,subtract:()=>t$1,sub:()=>B76,str:()=>G76,set:()=>i46,scale:()=>Z76,rotate:()=>e46,projection:()=>K76,normalFromMat4:()=>W76,multiplyScalarAndAdd:()=>q76,multiplyScalar:()=>V76,multiply:()=>r$1,mul:()=>w76,invert:()=>s46,identity:()=>n46,fromValues:()=>p46,fromTranslation:()=>J76,fromScaling:()=>Y76,fromRotation:()=>X76,fromQuat:()=>Q76,fromMat4:()=>d46,fromMat2d:()=>$76,frob:()=>z76,exactEquals:()=>F76,equals:()=>U76,determinant:()=>r46,create:()=>ty,copy:()=>l46,clone:()=>c46,adjoint:()=>o46,add:()=>H76});function ty(){var Z=new G1(9);if(G1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[5]=0,Z[6]=0,Z[7]=0;return Z[0]=1,Z[4]=1,Z[8]=1,Z}function d46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[4],Z[4]=J[5],Z[5]=J[6],Z[6]=J[8],Z[7]=J[9],Z[8]=J[10],Z}function c46(Z){var J=new G1(9);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J}function l46(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z[4]=J[4],Z[5]=J[5],Z[6]=J[6],Z[7]=J[7],Z[8]=J[8],Z}function p46(Z,J,X,Y,$,Q,W,K,G){var z=new G1(9);return z[0]=Z,z[1]=J,z[2]=X,z[3]=Y,z[4]=$,z[5]=Q,z[6]=W,z[7]=K,z[8]=G,z}function i46(Z,J,X,Y,$,Q,W,K,G,z){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z[4]=Q,Z[5]=W,Z[6]=K,Z[7]=G,Z[8]=z,Z}function n46(Z){return Z[0]=1,Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=1,Z[5]=0,Z[6]=0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7]=J[7]+X[7],Z[8]=J[8]+X[8],Z}function t$1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z}function V76(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z}function q76(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z}function F76(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]}function U76(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=J[0],q=J[1],F=J[2],U=J[3],B=J[4],w=J[5],O=J[6],N=J[7],R=J[8];return Math.abs(X-V)<=v0*Math.max(1,Math.abs(X),Math.abs(V))&&Math.abs(Y-q)<=v0*Math.max(1,Math.abs(Y),Math.abs(q))&&Math.abs($-F)<=v0*Math.max(1,Math.abs($),Math.abs(F))&&Math.abs(Q-U)<=v0*Math.max(1,Math.abs(Q),Math.abs(U))&&Math.abs(W-B)<=v0*Math.max(1,Math.abs(W),Math.abs(B))&&Math.abs(K-w)<=v0*Math.max(1,Math.abs(K),Math.abs(w))&&Math.abs(G-O)<=v0*Math.max(1,Math.abs(G),Math.abs(O))&&Math.abs(z-N)<=v0*Math.max(1,Math.abs(z),Math.abs(N))&&Math.abs(H-R)<=v0*Math.max(1,Math.abs(H),Math.abs(R))}var w76=r$1,B76=t$1;var e0={};D9(e0,{transpose:()=>N76,translate:()=>T76,targetTo:()=>r76,subtract:()=>QQ1,sub:()=>WZ6,str:()=>t76,set:()=>R76,scale:()=>k76,rotateZ:()=>S76,rotateY:()=>v76,rotateX:()=>I76,rotate:()=>E76,perspectiveZO:()=>i76,perspectiveNO:()=>YQ1,perspectiveFromFieldOfView:()=>n76,perspective:()=>p76,orthoZO:()=>s76,orthoNO:()=>$Q1,ortho:()=>a76,multiplyScalarAndAdd:()=>XZ6,multiplyScalar:()=>JZ6,multiply:()=>ZQ1,mul:()=>QZ6,lookAt:()=>o76,invert:()=>D76,identity:()=>e$1,getTranslation:()=>g76,getScaling:()=>XQ1,getRotation:()=>m76,frustum:()=>l76,fromZRotation:()=>b76,fromYRotation:()=>f76,fromXRotation:()=>h76,fromValues:()=>M76,fromTranslation:()=>_76,fromScaling:()=>x76,fromRotationTranslationScaleOrigin:()=>d76,fromRotationTranslationScale:()=>u76,fromRotationTranslation:()=>JQ1,fromRotation:()=>A76,fromQuat2:()=>y76,fromQuat:()=>c76,frob:()=>e76,exactEquals:()=>YZ6,equals:()=>$Z6,determinant:()=>C76,create:()=>L76,copy:()=>j76,clone:()=>O76,adjoint:()=>P76,add:()=>ZZ6});function L76(){var Z=new G1(16);if(G1!=Float32Array)Z[1]=0,Z[2]=0,Z[3]=0,Z[4]=0,Z[6]=0,Z[7]=0,Z[8]=0,Z[9]=0,Z[11]=0,Z[12]=0,Z[13]=0,Z[14]=0;return Z[0]=1,Z[5]=1,Z[10]=1,Z[15]=1,Z}function O76(Z){var J=new G1(16);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J[4]=Z[4],J[5]=Z[5],J[6]=Z[6],J[7]=Z[7],J[8]=Z[8],J[9]=Z[9],J[10]=Z[10],J[11]=Z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+Z[2]+", "+Z[3]+", "+Z[4]+", "+Z[5]+", "+Z[6]+", "+Z[7]+", "+Z[8]+", "+Z[9]+", "+Z[10]+", "+Z[11]+", "+Z[12]+", "+Z[13]+", "+Z[14]+", "+Z[15]+")"}function e76(Z){return Math.hypot(Z[0],Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7],Z[8],Z[9],Z[10],Z[11],Z[12],Z[13],Z[14],Z[15])}function ZZ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z[4]=J[4]+X[4],Z[5]=J[5]+X[5],Z[6]=J[6]+X[6],Z[7]=J[7]+X[7],Z[8]=J[8]+X[8],Z[9]=J[9]+X[9],Z[10]=J[10]+X[10],Z[11]=J[11]+X[11],Z[12]=J[12]+X[12],Z[13]=J[13]+X[13],Z[14]=J[14]+X[14],Z[15]=J[15]+X[15],Z}function QQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z[3]=J[3]-X[3],Z[4]=J[4]-X[4],Z[5]=J[5]-X[5],Z[6]=J[6]-X[6],Z[7]=J[7]-X[7],Z[8]=J[8]-X[8],Z[9]=J[9]-X[9],Z[10]=J[10]-X[10],Z[11]=J[11]-X[11],Z[12]=J[12]-X[12],Z[13]=J[13]-X[13],Z[14]=J[14]-X[14],Z[15]=J[15]-X[15],Z}function JZ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z[4]=J[4]*X,Z[5]=J[5]*X,Z[6]=J[6]*X,Z[7]=J[7]*X,Z[8]=J[8]*X,Z[9]=J[9]*X,Z[10]=J[10]*X,Z[11]=J[11]*X,Z[12]=J[12]*X,Z[13]=J[13]*X,Z[14]=J[14]*X,Z[15]=J[15]*X,Z}function XZ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z[3]=J[3]+X[3]*Y,Z[4]=J[4]+X[4]*Y,Z[5]=J[5]+X[5]*Y,Z[6]=J[6]+X[6]*Y,Z[7]=J[7]+X[7]*Y,Z[8]=J[8]+X[8]*Y,Z[9]=J[9]+X[9]*Y,Z[10]=J[10]+X[10]*Y,Z[11]=J[11]+X[11]*Y,Z[12]=J[12]+X[12]*Y,Z[13]=J[13]+X[13]*Y,Z[14]=J[14]+X[14]*Y,Z[15]=J[15]+X[15]*Y,Z}function YZ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]&&Z[4]===J[4]&&Z[5]===J[5]&&Z[6]===J[6]&&Z[7]===J[7]&&Z[8]===J[8]&&Z[9]===J[9]&&Z[10]===J[10]&&Z[11]===J[11]&&Z[12]===J[12]&&Z[13]===J[13]&&Z[14]===J[14]&&Z[15]===J[15]}function $Z6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=Z[4],K=Z[5],G=Z[6],z=Z[7],H=Z[8],V=Z[9],q=Z[10],F=Z[11],U=Z[12],B=Z[13],w=Z[14],O=Z[15],N=J[0],R=J[1],j=J[2],P=J[3],D=J[4],C=J[5],T=J[6],k=J[7],x=J[8],S=J[9],A=J[10],I=J[11],v=J[12],b=J[13],m=J[14],n=J[15];return Math.abs(X-N)<=v0*Math.max(1,Math.abs(X),Math.abs(N))&&Math.abs(Y-R)<=v0*Math.max(1,Math.abs(Y),Math.abs(R))&&Math.abs($-j)<=v0*Math.max(1,Math.abs($),Math.abs(j))&&Math.abs(Q-P)<=v0*Math.max(1,Math.abs(Q),Math.abs(P))&&Math.abs(W-D)<=v0*Math.max(1,Math.abs(W),Math.abs(D))&&Math.abs(K-C)<=v0*Math.max(1,Math.abs(K),Math.abs(C))&&Math.abs(G-T)<=v0*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(z-k)<=v0*Math.max(1,Math.abs(z),Math.abs(k))&&Math.abs(H-x)<=v0*Math.max(1,Math.abs(H),Math.abs(x))&&Math.abs(V-S)<=v0*Math.max(1,Math.abs(V),Math.abs(S))&&Math.abs(q-A)<=v0*Math.max(1,Math.abs(q),Math.abs(A))&&Math.abs(F-I)<=v0*Math.max(1,Math.abs(F),Math.abs(I))&&Math.abs(U-v)<=v0*Math.max(1,Math.abs(U),Math.abs(v))&&Math.abs(B-b)<=v0*Math.max(1,Math.abs(B),Math.abs(b))&&Math.abs(w-m)<=v0*Math.max(1,Math.abs(w),Math.abs(m))&&Math.abs(O-n)<=v0*Math.max(1,Math.abs(O),Math.abs(n))}var QZ6=ZQ1,WZ6=QQ1;var P1={};D9(P1,{str:()=>XJ6,squaredLength:()=>AQ1,sqrLen:()=>VJ6,sqlerp:()=>wJ6,slerp:()=>lR,setAxisAngle:()=>TQ1,setAxes:()=>BJ6,set:()=>WJ6,scale:()=>SQ1,rotationTo:()=>UJ6,rotateZ:()=>sZ6,rotateY:()=>aZ6,rotateX:()=>nZ6,random:()=>tZ6,pow:()=>rZ6,normalize:()=>Xg,multiply:()=>kQ1,mul:()=>GJ6,ln:()=>IQ1,lerp:()=>zJ6,length:()=>xQ1,len:()=>HJ6,invert:()=>eZ6,identity:()=>lZ6,getAxisAngle:()=>pZ6,getAngle:()=>iZ6,fromValues:()=>$J6,fromMat3:()=>vQ1,fromEuler:()=>JJ6,exp:()=>EQ1,exactEquals:()=>qJ6,equals:()=>FJ6,dot:()=>_Q1,create:()=>Jg,copy:()=>QJ6,conjugate:()=>ZJ6,clone:()=>YJ6,calculateW:()=>oZ6,add:()=>KJ6});var J1={};D9(J1,{zero:()=>SZ6,transformQuat:()=>TZ6,transformMat4:()=>PZ6,transformMat3:()=>CZ6,subtract:()=>KQ1,sub:()=>hZ6,str:()=>_Z6,squaredLength:()=>qQ1,squaredDistance:()=>VQ1,sqrLen:()=>mZ6,sqrDist:()=>gZ6,set:()=>zZ6,scaleAndAdd:()=>LZ6,scale:()=>BZ6,round:()=>wZ6,rotateZ:()=>IZ6,rotateY:()=>EZ6,rotateX:()=>kZ6,random:()=>DZ6,normalize:()=>ey,negate:()=>OZ6,multiply:()=>GQ1,mul:()=>fZ6,min:()=>FZ6,max:()=>UZ6,lerp:()=>MZ6,length:()=>WQ1,len:()=>Zg,inverse:()=>jZ6,hermite:()=>RZ6,fromValues:()=>dR,forEach:()=>uZ6,floor:()=>qZ6,exactEquals:()=>xZ6,equals:()=>AZ6,dot:()=>cR,divide:()=>zQ1,div:()=>bZ6,distance:()=>HQ1,dist:()=>yZ6,cross:()=>UF,create:()=>uR,copy:()=>GZ6,clone:()=>KZ6,ceil:()=>VZ6,bezier:()=>NZ6,angle:()=>vZ6,add:()=>HZ6});function uR(){var Z=new G1(3);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z}function KZ6(Z){var J=new G1(3);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J}function WQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return Math.hypot(J,X,Y)}function dR(Z,J,X){var Y=new G1(3);return Y[0]=Z,Y[1]=J,Y[2]=X,Y}function GZ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z}function zZ6(Z,J,X,Y){return Z[0]=J,Z[1]=X,Z[2]=Y,Z}function HZ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z}function KQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z[2]=J[2]-X[2],Z}function GQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z[2]=J[2]*X[2],Z}function zQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z[2]=J[2]/X[2],Z}function VZ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z[2]=Math.ceil(J[2]),Z}function qZ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z[2]=Math.floor(J[2]),Z}function FZ6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z[2]=Math.min(J[2],X[2]),Z}function UZ6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z[2]=Math.max(J[2],X[2]),Z}function wZ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z[2]=Math.round(J[2]),Z}function BZ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z}function LZ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z[2]=J[2]+X[2]*Y,Z}function HQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return Math.hypot(X,Y,$)}function VQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1],$=J[2]-Z[2];return X*X+Y*Y+$*$}function qQ1(Z){var J=Z[0],X=Z[1],Y=Z[2];return J*J+X*X+Y*Y}function OZ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z}function jZ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z[2]=1/J[2],Z}function ey(Z,J){var X=J[0],Y=J[1],$=J[2],Q=X*X+Y*Y+$*$;if(Q>0)Q=1/Math.sqrt(Q);return Z[0]=J[0]*Q,Z[1]=J[1]*Q,Z[2]=J[2]*Q,Z}function cR(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]}function UF(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=X[0],K=X[1],G=X[2];return Z[0]=$*G-Q*K,Z[1]=Q*W-Y*G,Z[2]=Y*K-$*W,Z}function MZ6(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z}function RZ6(Z,J,X,Y,$,Q){var W=Q*Q,K=W*(2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X[2],Q[0]=$[0],Q[1]=$[1]*Math.cos(Y)-$[2]*Math.sin(Y),Q[2]=$[1]*Math.sin(Y)+$[2]*Math.cos(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function EZ6(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[2]*Math.sin(Y)+$[0]*Math.cos(Y),Q[1]=$[1],Q[2]=$[2]*Math.cos(Y)-$[0]*Math.sin(Y),Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function IZ6(Z,J,X,Y){var $=[],Q=[];return $[0]=J[0]-X[0],$[1]=J[1]-X[1],$[2]=J[2]-X[2],Q[0]=$[0]*Math.cos(Y)-$[1]*Math.sin(Y),Q[1]=$[0]*Math.sin(Y)+$[1]*Math.cos(Y),Q[2]=$[2],Z[0]=Q[0]+X[0],Z[1]=Q[1]+X[1],Z[2]=Q[2]+X[2],Z}function vZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2],G=Math.sqrt(X*X+Y*Y+$*$),z=Math.sqrt(Q*Q+W*W+K*K),H=G*z,V=H&&cR(Z,J)/H;return Math.acos(Math.min(Math.max(V,-1),1))}function SZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z}function _Z6(Z){return"vec3("+Z[0]+", "+Z[1]+", "+Z[2]+")"}function xZ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]}function AZ6(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=J[0],W=J[1],K=J[2];return Math.abs(X-Q)<=v0*Math.max(1,Math.abs(X),Math.abs(Q))&&Math.abs(Y-W)<=v0*Math.max(1,Math.abs(Y),Math.abs(W))&&Math.abs($-K)<=v0*Math.max(1,Math.abs($),Math.abs(K))}var hZ6=KQ1,fZ6=GQ1,bZ6=zQ1,yZ6=HQ1,gZ6=VQ1,Zg=WQ1,mZ6=qQ1,uZ6=function(){var Z=uR();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=3;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2];return J}}();function dZ6(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=0;return Z}function FQ1(Z){var J=new G1(4);return J[0]=Z[0],J[1]=Z[1],J[2]=Z[2],J[3]=Z[3],J}function UQ1(Z,J,X,Y){var $=new G1(4);return $[0]=Z,$[1]=J,$[2]=X,$[3]=Y,$}function wQ1(Z,J){return Z[0]=J[0],Z[1]=J[1],Z[2]=J[2],Z[3]=J[3],Z}function BQ1(Z,J,X,Y,$){return Z[0]=J,Z[1]=X,Z[2]=Y,Z[3]=$,Z}function LQ1(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z[2]=J[2]+X[2],Z[3]=J[3]+X[3],Z}function OQ1(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z[2]=J[2]*X,Z[3]=J[3]*X,Z}function jQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return Math.hypot(J,X,Y,$)}function MQ1(Z){var J=Z[0],X=Z[1],Y=Z[2],$=Z[3];return J*J+X*X+Y*Y+$*$}function RQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q;if(W>0)W=1/Math.sqrt(W);return Z[0]=X*W,Z[1]=Y*W,Z[2]=$*W,Z[3]=Q*W,Z}function NQ1(Z,J){return Z[0]*J[0]+Z[1]*J[1]+Z[2]*J[2]+Z[3]*J[3]}function DQ1(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z[2]=W+Y*(X[2]-W),Z[3]=K+Y*(X[3]-K),Z}function PQ1(Z,J){return Z[0]===J[0]&&Z[1]===J[1]&&Z[2]===J[2]&&Z[3]===J[3]}function CQ1(Z,J){var X=Z[0],Y=Z[1],$=Z[2],Q=Z[3],W=J[0],K=J[1],G=J[2],z=J[3];return Math.abs(X-W)<=v0*Math.max(1,Math.abs(X),Math.abs(W))&&Math.abs(Y-K)<=v0*Math.max(1,Math.abs(Y),Math.abs(K))&&Math.abs($-G)<=v0*Math.max(1,Math.abs($),Math.abs(G))&&Math.abs(Q-z)<=v0*Math.max(1,Math.abs(Q),Math.abs(z))}var v55=function(){var Z=dZ6();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=4;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Z[2]=J[K+2],Z[3]=J[K+3],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1],J[K+2]=Z[2],J[K+3]=Z[3];return J}}();function Jg(){var Z=new G1(4);if(G1!=Float32Array)Z[0]=0,Z[1]=0,Z[2]=0;return Z[3]=1,Z}function lZ6(Z){return Z[0]=0,Z[1]=0,Z[2]=0,Z[3]=1,Z}function TQ1(Z,J,X){X=X*0.5;var Y=Math.sin(X);return Z[0]=Y*J[0],Z[1]=Y*J[1],Z[2]=Y*J[2],Z[3]=Math.cos(X),Z}function pZ6(Z,J){var X=Math.acos(J[3])*2,Y=Math.sin(X/2);if(Y>v0)Z[0]=J[0]/Y,Z[1]=J[1]/Y,Z[2]=J[2]/Y;else Z[0]=1,Z[1]=0,Z[2]=0;return X}function iZ6(Z,J){var X=_Q1(Z,J);return Math.acos(2*X*X-1)}function kQ1(Z,J,X){var Y=J[0],$=J[1],Q=J[2],W=J[3],K=X[0],G=X[1],z=X[2],H=X[3];return Z[0]=Y*H+W*K+$*z-Q*G,Z[1]=$*H+W*G+Q*K-Y*z,Z[2]=Q*H+W*z+Y*G-$*K,Z[3]=W*H-Y*K-$*G-Q*z,Z}function nZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+W*K,Z[1]=$*G+Q*K,Z[2]=Q*G-$*K,Z[3]=W*G-Y*K,Z}function aZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G-Q*K,Z[1]=$*G+W*K,Z[2]=Q*G+Y*K,Z[3]=W*G-$*K,Z}function sZ6(Z,J,X){X*=0.5;var Y=J[0],$=J[1],Q=J[2],W=J[3],K=Math.sin(X),G=Math.cos(X);return Z[0]=Y*G+$*K,Z[1]=$*G-Y*K,Z[2]=Q*G+W*K,Z[3]=W*G-Q*K,Z}function oZ6(Z,J){var X=J[0],Y=J[1],$=J[2];return Z[0]=X,Z[1]=Y,Z[2]=$,Z[3]=Math.sqrt(Math.abs(1-X*X-Y*Y-$*$)),Z}function EQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=Math.exp(Q),G=W>0?K*Math.sin(W)/W:0;return Z[0]=X*G,Z[1]=Y*G,Z[2]=$*G,Z[3]=K*Math.cos(W),Z}function IQ1(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=Math.sqrt(X*X+Y*Y+$*$),K=W>0?Math.atan2(W,Q)/W:0;return Z[0]=X*K,Z[1]=Y*K,Z[2]=$*K,Z[3]=0.5*Math.log(X*X+Y*Y+$*$+Q*Q),Z}function rZ6(Z,J,X){return IQ1(Z,J),SQ1(Z,Z,X),EQ1(Z,Z),Z}function lR(Z,J,X,Y){var $=J[0],Q=J[1],W=J[2],K=J[3],G=X[0],z=X[1],H=X[2],V=X[3],q,F,U,B,w;if(F=$*G+Q*z+W*H+K*V,F<0)F=-F,G=-G,z=-z,H=-H,V=-V;if(1-F>v0)q=Math.acos(F),U=Math.sin(q),B=Math.sin((1-Y)*q)/U,w=Math.sin(Y*q)/U;else B=1-Y,w=Y;return Z[0]=B*$+w*G,Z[1]=B*Q+w*z,Z[2]=B*W+w*H,Z[3]=B*K+w*V,Z}function tZ6(Z){var J=WZ(),X=WZ(),Y=WZ(),$=Math.sqrt(1-J),Q=Math.sqrt(J);return Z[0]=$*Math.sin(2*Math.PI*X),Z[1]=$*Math.cos(2*Math.PI*X),Z[2]=Q*Math.sin(2*Math.PI*Y),Z[3]=Q*Math.cos(2*Math.PI*Y),Z}function eZ6(Z,J){var X=J[0],Y=J[1],$=J[2],Q=J[3],W=X*X+Y*Y+$*$+Q*Q,K=W?1/W:0;return Z[0]=-X*K,Z[1]=-Y*K,Z[2]=-$*K,Z[3]=Q*K,Z}function ZJ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z[2]=-J[2],Z[3]=J[3],Z}function vQ1(Z,J){var X=J[0]+J[4]+J[8],Y;if(X>0)Y=Math.sqrt(X+1),Z[3]=0.5*Y,Y=0.5/Y,Z[0]=(J[5]-J[7])*Y,Z[1]=(J[6]-J[2])*Y,Z[2]=(J[1]-J[3])*Y;else{var $=0;if(J[4]>J[0])$=1;if(J[8]>J[$*3+$])$=2;var Q=($+1)%3,W=($+2)%3;Y=Math.sqrt(J[$*3+$]-J[Q*3+Q]-J[W*3+W]+1),Z[$]=0.5*Y,Y=0.5/Y,Z[3]=(J[Q*3+W]-J[W*3+Q])*Y,Z[Q]=(J[Q*3+$]+J[$*3+Q])*Y,Z[W]=(J[W*3+$]+J[$*3+W])*Y}return Z}function JJ6(Z,J,X,Y){var $=0.5*Math.PI/180;J*=$,X*=$,Y*=$;var Q=Math.sin(J),W=Math.cos(J),K=Math.sin(X),G=Math.cos(X),z=Math.sin(Y),H=Math.cos(Y);return Z[0]=Q*G*H-W*K*z,Z[1]=W*K*H+Q*G*z,Z[2]=W*G*z-Q*K*H,Z[3]=W*G*H+Q*K*z,Z}function XJ6(Z){return"quat("+Z[0]+", "+Z[1]+", "+Z[2]+", "+Z[3]+")"}var YJ6=FQ1,$J6=UQ1,QJ6=wQ1,WJ6=BQ1,KJ6=LQ1,GJ6=kQ1,SQ1=OQ1,_Q1=NQ1,zJ6=DQ1,xQ1=jQ1,HJ6=xQ1,AQ1=MQ1,VJ6=AQ1,Xg=RQ1,qJ6=PQ1,FJ6=CQ1,UJ6=function(){var Z=uR(),J=dR(1,0,0),X=dR(0,1,0);return function(Y,$,Q){var W=cR($,Q);if(W<-0.999999){if(UF(Z,J,$),Zg(Z)<0.000001)UF(Z,X,$);return ey(Z,Z),TQ1(Y,Z,Math.PI),Y}else if(W>0.999999)return Y[0]=0,Y[1]=0,Y[2]=0,Y[3]=1,Y;else return UF(Z,$,Q),Y[0]=Z[0],Y[1]=Z[1],Y[2]=Z[2],Y[3]=1+W,Xg(Y,Y)}}(),wJ6=function(){var Z=Jg(),J=Jg();return function(X,Y,$,Q,W,K){return lR(Z,Y,W,K),lR(J,$,Q,K),lR(X,Z,J,2*K*(1-K)),X}}(),BJ6=function(){var Z=ty();return function(J,X,Y,$){return Z[0]=Y[0],Z[3]=Y[1],Z[6]=Y[2],Z[1]=$[0],Z[4]=$[1],Z[7]=$[2],Z[2]=-X[0],Z[5]=-X[1],Z[8]=-X[2],Xg(J,vQ1(J,Z))}}();var V1={};D9(V1,{zero:()=>dJ6,transformMat4:()=>gJ6,transformMat3:()=>yJ6,transformMat2d:()=>bJ6,transformMat2:()=>fJ6,subtract:()=>fQ1,sub:()=>nJ6,str:()=>cJ6,squaredLength:()=>dQ1,squaredDistance:()=>mQ1,sqrLen:()=>tJ6,sqrDist:()=>rJ6,set:()=>MJ6,scaleAndAdd:()=>EJ6,scale:()=>kJ6,round:()=>TJ6,rotate:()=>mJ6,random:()=>hJ6,normalize:()=>SJ6,negate:()=>IJ6,multiply:()=>bQ1,mul:()=>aJ6,min:()=>PJ6,max:()=>CJ6,lerp:()=>AJ6,length:()=>uQ1,len:()=>iJ6,inverse:()=>vJ6,fromValues:()=>OJ6,forEach:()=>eJ6,floor:()=>DJ6,exactEquals:()=>lJ6,equals:()=>pJ6,dot:()=>_J6,divide:()=>yQ1,div:()=>sJ6,distance:()=>gQ1,dist:()=>oJ6,cross:()=>xJ6,create:()=>hQ1,copy:()=>jJ6,clone:()=>LJ6,ceil:()=>NJ6,angle:()=>uJ6,add:()=>RJ6});function hQ1(){var Z=new G1(2);if(G1!=Float32Array)Z[0]=0,Z[1]=0;return Z}function LJ6(Z){var J=new G1(2);return J[0]=Z[0],J[1]=Z[1],J}function OJ6(Z,J){var X=new G1(2);return X[0]=Z,X[1]=J,X}function jJ6(Z,J){return Z[0]=J[0],Z[1]=J[1],Z}function MJ6(Z,J,X){return Z[0]=J,Z[1]=X,Z}function RJ6(Z,J,X){return Z[0]=J[0]+X[0],Z[1]=J[1]+X[1],Z}function fQ1(Z,J,X){return Z[0]=J[0]-X[0],Z[1]=J[1]-X[1],Z}function bQ1(Z,J,X){return Z[0]=J[0]*X[0],Z[1]=J[1]*X[1],Z}function yQ1(Z,J,X){return Z[0]=J[0]/X[0],Z[1]=J[1]/X[1],Z}function NJ6(Z,J){return Z[0]=Math.ceil(J[0]),Z[1]=Math.ceil(J[1]),Z}function DJ6(Z,J){return Z[0]=Math.floor(J[0]),Z[1]=Math.floor(J[1]),Z}function PJ6(Z,J,X){return Z[0]=Math.min(J[0],X[0]),Z[1]=Math.min(J[1],X[1]),Z}function CJ6(Z,J,X){return Z[0]=Math.max(J[0],X[0]),Z[1]=Math.max(J[1],X[1]),Z}function TJ6(Z,J){return Z[0]=Math.round(J[0]),Z[1]=Math.round(J[1]),Z}function kJ6(Z,J,X){return Z[0]=J[0]*X,Z[1]=J[1]*X,Z}function EJ6(Z,J,X,Y){return Z[0]=J[0]+X[0]*Y,Z[1]=J[1]+X[1]*Y,Z}function gQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return Math.hypot(X,Y)}function mQ1(Z,J){var X=J[0]-Z[0],Y=J[1]-Z[1];return X*X+Y*Y}function uQ1(Z){var J=Z[0],X=Z[1];return Math.hypot(J,X)}function dQ1(Z){var J=Z[0],X=Z[1];return J*J+X*X}function IJ6(Z,J){return Z[0]=-J[0],Z[1]=-J[1],Z}function vJ6(Z,J){return Z[0]=1/J[0],Z[1]=1/J[1],Z}function SJ6(Z,J){var X=J[0],Y=J[1],$=X*X+Y*Y;if($>0)$=1/Math.sqrt($);return Z[0]=J[0]*$,Z[1]=J[1]*$,Z}function _J6(Z,J){return Z[0]*J[0]+Z[1]*J[1]}function xJ6(Z,J,X){var Y=J[0]*X[1]-J[1]*X[0];return Z[0]=Z[1]=0,Z[2]=Y,Z}function AJ6(Z,J,X,Y){var $=J[0],Q=J[1];return Z[0]=$+Y*(X[0]-$),Z[1]=Q+Y*(X[1]-Q),Z}function hJ6(Z,J){J=J||1;var X=WZ()*2*Math.PI;return Z[0]=Math.cos(X)*J,Z[1]=Math.sin(X)*J,Z}function fJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$,Z[1]=X[1]*Y+X[3]*$,Z}function bJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[2]*$+X[4],Z[1]=X[1]*Y+X[3]*$+X[5],Z}function yJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[3]*$+X[6],Z[1]=X[1]*Y+X[4]*$+X[7],Z}function gJ6(Z,J,X){var Y=J[0],$=J[1];return Z[0]=X[0]*Y+X[4]*$+X[12],Z[1]=X[1]*Y+X[5]*$+X[13],Z}function mJ6(Z,J,X,Y){var $=J[0]-X[0],Q=J[1]-X[1],W=Math.sin(Y),K=Math.cos(Y);return Z[0]=$*K-Q*W+X[0],Z[1]=$*W+Q*K+X[1],Z}function uJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1],W=Math.sqrt(X*X+Y*Y)*Math.sqrt($*$+Q*Q),K=W&&(X*$+Y*Q)/W;return Math.acos(Math.min(Math.max(K,-1),1))}function dJ6(Z){return Z[0]=0,Z[1]=0,Z}function cJ6(Z){return"vec2("+Z[0]+", "+Z[1]+")"}function lJ6(Z,J){return Z[0]===J[0]&&Z[1]===J[1]}function pJ6(Z,J){var X=Z[0],Y=Z[1],$=J[0],Q=J[1];return Math.abs(X-$)<=v0*Math.max(1,Math.abs(X),Math.abs($))&&Math.abs(Y-Q)<=v0*Math.max(1,Math.abs(Y),Math.abs(Q))}var iJ6=uQ1,nJ6=fQ1,aJ6=bQ1,sJ6=yQ1,oJ6=gQ1,rJ6=mQ1,tJ6=dQ1,eJ6=function(){var Z=hQ1();return function(J,X,Y,$,Q,W){var K,G;if(!X)X=2;if(!Y)Y=0;if($)G=Math.min($*X+Y,J.length);else G=J.length;for(K=Y;K<G;K+=X)Z[0]=J[K],Z[1]=J[K+1],Q(Z,Z,W),J[K]=Z[0],J[K+1]=Z[1];return J}}();class fQ extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get determinant(){return l8.determinant(this)}get frobeniusNorm(){return l8.frob(this)}static create(){let Z=new fQ(0,0,0,0);return l8.identity(Z),Z}static fromRotation(Z){let J=fQ.create();return l8.fromRotation(J,Z),J}static fromScaling(Z){let J=fQ.create();return l8.fromScaling(J,Z),J}add(Z){return l8.add(this,this,Z),this}adjoint(){return l8.adjoint(this,this),this}clone(){return new fQ(this[0],this[1],this[2],this[3])}copy(Z){return l8.copy(this,Z),this}equals(Z){return l8.equals(this,Z)}exactEquals(Z){return l8.exactEquals(this,Z)}identity(){return l8.identity(this),this}invert(){return l8.invert(this,this),this}multiply(Z){return l8.mul(this,this,Z),this}multiplyScalar(Z){return l8.multiplyScalar(this,this,Z),this}rotate(Z){return l8.rotate(this,this,Z),this}subtract(Z){return l8.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]}][${this[2]},${this[3]}]`}transpose(){return l8.transpose(this,this),this}}class KZ extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G){super([Z,J,X,Y,$,Q,W,K,G])}get determinant(){return r1.determinant(this)}get frobeniusNorm(){return r1.frob(this)}static create(){let Z=new KZ(0,0,0,0,0,0,0,0,0);return r1.identity(Z),Z}static fromMatrix4(Z){let J=KZ.create();return r1.fromMat4(J,Z),J}static fromQuaternion(Z){let J=KZ.create();return r1.fromQuat(J,Z),J}static fromRotation(Z){let J=KZ.create();return r1.fromRotation(J,Z),J}static fromScaling(Z){let J=KZ.create();return r1.fromScaling(J,Z),J}static fromTranslation(Z){let J=KZ.create();return r1.fromTranslation(J,Z),J}add(Z){return r1.add(this,this,Z),this}adjoint(){return r1.adjoint(this,this),this}clone(){return new KZ(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8])}copy(Z){return r1.copy(this,Z),this}equals(Z){return r1.equals(this,Z)}exactEquals(Z){return r1.exactEquals(this,Z)}identity(){return r1.identity(this),this}invert(){return r1.invert(this,this),this}multiply(Z){return r1.mul(this,this,Z),this}multiplyScalar(Z){return r1.multiplyScalar(this,this,Z),this}transformVector(Z){return Z.transformMatrix3(this)}projection(Z,J){return r1.projection(this,Z,J),this}rotate(Z){return r1.rotate(this,this,Z),this}subtract(Z){return r1.sub(this,this,Z),this}toString(){return`[${this[0]},${this[1]},${this[2]}][${this[3]},${this[4]},${this[5]}][${this[6]},${this[7]},${this[8]}]`}transpose(){return r1.transpose(this,this),this}}class j5 extends Float32Array{constructor(Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B){super([Z,J,X,Y,$,Q,W,K,G,z,H,V,q,F,U,B])}get determinant(){return e0.determinant(this)}get frobeniusNorm(){return e0.frob(this)}static create(){let Z=new j5(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e0.identity(Z),Z}static fromQuaternion(Z){let J=j5.create();return e0.fromQuat(J,Z),J}static fromRotation(Z,J){let X=j5.create();return e0.fromRotation(X,Z,J),X}static fromRotationTranslation(Z,J){let X=j5.create();return e0.fromRotationTranslation(X,Z,J),X}static fromRotationTranslationScale(Z,J,X){let Y=j5.create();return e0.fromRotationTranslationScale(Y,Z,J,X),Y}static fromRotationTranslationScaleOrigin(Z,J,X,Y){let $=j5.create();return e0.fromRotationTranslationScaleOrigin($,Z,J,X,Y),$}static fromScaling(Z){let J=j5.create();return e0.fromScaling(J,Z),J}static fromTranslation(Z){let J=j5.create();return e0.fromTranslation(J,Z),J}static fromXRotation(Z){let J=j5.create();return e0.fromXRotation(J,Z),J}static fromYRotation(Z){let J=j5.create();return e0.fromYRotation(J,Z),J}static fromZRotation(Z){let J=j5.create();return e0.fromZRotation(J,Z),J}add(Z){return e0.add(this,this,Z),this}adjoint(){return e0.adjoint(this,this),this}clone(){return new j5(this[0],this[1],this[2],this[3],this[4],this[5],this[6],this[7],this[8],this[9],this[10],this[11],this[12],this[13],this[14],this[15])}copy(Z){return e0.copy(this,Z),this}equals(Z){return e0.equals(this,Z)}exactEquals(Z){return e0.exactEquals(this,Z)}frustrum(Z,J,X,Y,$,Q){return e0.frustum(this,Z,J,X,Y,$,Q),this}identity(){return e0.identity(this),this}invert(){return e0.invert(this,this),this}lookAt(Z,J,X){return e0.lookAt(this,Z,J,X),this}multiply(Z){return e0.mul(this,this,Z),this}multiplyScalar(Z){return e0.multiplyScalar(this,this,Z),this}orthographic(Z,J,X,Y,$,Q){return e0.ortho(this,Z,J,X,Y,$,Q),this}perspective(Z,J,X,Y){return e0.perspective(this,Z,J,X,Y),this}rotate(Z,J){return e0.rotate(this,this,Z,J),this}rotateX(Z){return e0.rotateX(this,this,Z),this}rotateY(Z){return e0.rotateY(this,this,Z),this}rotateZ(Z){return e0.rotateZ(this,this,Z),this}scale(Z){return e0.scale(this,this,Z),this}subtract(Z){return e0.sub(this,this,Z),this}targetTo(Z,J,X){return e0.targetTo(this,Z,J,X),this}toString(){return`[${this[0]},${this[1]},${this[2]},${this[3]}][${this[4]},${this[5]},${this[6]},${this[7]}][${this[8]},${this[9]},${this[10]},${this[11]}][${this[12]},${this[13]},${this[14]},${this[15]}]`}translate(Z){return e0.translate(this,this,Z),this}transpose(){return e0.transpose(this,this),this}}class b3 extends Float32Array{constructor(Z,J,X,Y){super([Z,J,X,Y])}get length(){return P1.length(this)}get squaredLength(){return P1.squaredLength(this)}get magnitude(){return P1.length(this)}get squaredMagnitude(){return P1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}get w(){return this[3]}set w(Z){this[3]=Z}static fromEuler(Z,J,X){let Y=P1.fromEuler(new Float32Array(4),Z,J,X);return new b3(Y[0],Y[1],Y[2],Y[3])}static fromQuaternionLike(Z){return new b3(Z.x,Z.y,Z.z,Z.w)}clone(){return new b3(this.x,this.y,this.z,this.w)}conjugate(){return P1.conjugate(this,this),this}copy(Z){return P1.copy(this,Z),this}dot(Z){return P1.dot(this,Z)}exponential(){return P1.exp(this,this),this}equals(Z){return P1.equals(this,Z)}exactEquals(Z){return P1.exactEquals(this,Z)}getAngle(Z){return P1.getAngle(this,Z)}identity(){return P1.identity(this),this}invert(){return P1.invert(this,this),this}lerp(Z,J){return P1.lerp(this,this,Z,J),this}logarithm(){return P1.ln(this,this),this}multiply(Z){return P1.multiply(this,this,Z),this}transformVector(Z){return Z.transformQuaternion(this)}normalize(){return P1.normalize(this,this),this}power(Z){return P1.pow(this,this,Z),this}randomize(){return P1.random(this),this}rotateX(Z){return P1.rotateX(this,this,Z),this}rotateY(Z){return P1.rotateY(this,this,Z),this}rotateZ(Z){return P1.rotateZ(this,this,Z),this}scale(Z){return P1.scale(this,this,Z),this}setAxisAngle(Z,J){return P1.setAxisAngle(this,Z,J),this}slerp(Z,J){return P1.slerp(this,this,Z,J),this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}}class wF extends Float32Array{constructor(Z,J){super([Z,J])}get length(){return V1.length(this)}get squaredLength(){return V1.squaredLength(this)}get magnitude(){return V1.length(this)}get squaredMagnitude(){return V1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}static create(){return new wF(0,0)}add(Z){return V1.add(this,this,Z),this}angle(Z){return V1.angle(this,Z)}ceil(){return V1.ceil(this,this),this}clone(){return new wF(this.x,this.y)}copy(Z){return V1.copy(this,Z),this}distance(Z){return V1.distance(this,Z)}divide(Z){return V1.divide(this,this,Z),this}dot(Z){return V1.dot(this,Z)}equals(Z){return V1.equals(this,Z)}exactEquals(Z){return V1.exactEquals(this,Z)}floor(){return V1.floor(this,this),this}invert(){return V1.inverse(this,this),this}lerp(Z,J){return V1.lerp(this,this,Z,J),this}max(Z){return V1.max(this,this,Z),this}min(Z){return V1.min(this,this,Z),this}multiply(Z){return V1.mul(this,this,Z),this}negate(){return V1.negate(this,this),this}normalize(){return V1.normalize(this,this),this}randomize(Z){return V1.random(this,Z),this}rotate(Z,J){return V1.rotate(this,this,Z,J),this}round(){return V1.round(this,this),this}scale(Z){return V1.scale(this,this,Z),this}scaleAndAdd(Z,J){return V1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return V1.sub(this,this,Z),this}toString(){return`${this.x},${this.y}`}transformMatrix2(Z){return V1.transformMat2(this,this,Z),this}transformMatrix3(Z){return V1.transformMat3(this,this,Z),this}transformMatrix4(Z){return V1.transformMat4(this,this,Z),this}zero(){return V1.zero(this),this}}class y3 extends Float32Array{constructor(Z,J,X){super([Z,J,X])}get length(){return J1.length(this)}get squaredLength(){return J1.squaredLength(this)}get magnitude(){return J1.length(this)}get squaredMagnitude(){return J1.squaredLength(this)}get x(){return this[0]}set x(Z){this[0]=Z}get y(){return this[1]}set y(Z){this[1]=Z}get z(){return this[2]}set z(Z){this[2]=Z}static create(){return new y3(0,0,0)}static fromVector3Like(Z){return new y3(Z.x,Z.y,Z.z)}add(Z){return J1.add(this,this,Z),this}ceil(){return J1.ceil(this,this),this}clone(){return new y3(this.x,this.y,this.z)}copy(Z){return J1.copy(this,Z),this}cross(Z){return J1.cross(this,this,Z),this}distance(Z){return J1.distance(this,Z)}divide(Z){return J1.div(this,this,Z),this}dot(Z){return J1.dot(this,Z)}equals(Z){return J1.equals(this,Z)}exactEquals(Z){return J1.exactEquals(this,Z)}floor(){return J1.floor(this,this),this}invert(){return J1.inverse(this,this),this}lerp(Z,J){return J1.lerp(this,this,Z,J),this}max(Z){return J1.max(this,this,Z),this}min(Z){return J1.min(this,this,Z),this}multiply(Z){return J1.mul(this,this,Z),this}negate(){return J1.negate(this,this),this}normalize(){return J1.normalize(this,this),this}randomize(Z){return J1.random(this,Z),this}rotateX(Z,J){return J1.rotateX(this,this,Z,J),this}rotateY(Z,J){return J1.rotateY(this,this,Z,J),this}rotateZ(Z,J){return J1.rotateZ(this,this,Z,J),this}round(){return J1.round(this,this),this}scale(Z){return J1.scale(this,this,Z),this}scaleAndAdd(Z,J){return J1.scaleAndAdd(this,this,Z,J),this}subtract(Z){return J1.sub(this,this,Z),this}toString(){return`${this.x},${this.y},${this.z}`}transformMatrix3(Z){return J1.transformMat3(this,this,Z),this}transformMatrix4(Z){return J1.transformMat4(this,this,Z),this}transformQuaternion(Z){return J1.transformQuat(this,this,Z),this}zero(){return J1.zero(this),this}}var C1=function(Z,J,X,Y){function $(Q){return Q instanceof X?Q:new X(function(W){W(Q)})}return new(X||(X=Promise))(function(Q,W){function K(H){try{z(Y.next(H))}catch(V){W(V)}}function G(H){try{z(Y.throw(H))}catch(V){W(V)}}function z(H){H.done?Q(H.value):$(H.value).then(K,G)}z((Y=Y.apply(Z,J||[])).next())})},R1=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=K(0),W.throw=K(1),W.return=K(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(W&&(W=0,z[0]&&(X=0)),X)try{if(Y=1,$&&(Q=z[0]&2?$.return:z[0]?$.throw||((Q=$.return)&&Q.call($),0):$.next)&&!(Q=Q.call($,z[1])).done)return Q;if($=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,$=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if((Q=X.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){X.label=z[1];break}if(z[0]===6&&X.label<Q[1]){X.label=Q[1],Q=z;break}if(Q&&X.label<Q[2]){X.label=Q[2],X.ops.push(z);break}if(Q[2])X.ops.pop();X.trys.pop();continue}z=J.call(Z,X)}catch(H){z=[6,H],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},s5=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],W;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(K){W={error:K}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(W)throw W.error}}return Q},U4=function(Z,J,X){if(X||arguments.length===2){for(var Y=0,$=J.length,Q;Y<$;Y++)if(Q||!(Y in J)){if(!Q)Q=Array.prototype.slice.call(J,0,Y);Q[Y]=J[Y]}}return Z.concat(Q||Array.prototype.slice.call(J))},cQ1=function(Z){var J=typeof Symbol==="function"&&Symbol.iterator,X=J&&Z[J],Y=0;if(X)return X.call(Z);if(Z&&typeof Z.length==="number")return{next:function(){if(Z&&Y>=Z.length)Z=void 0;return{value:Z&&Z[Y++],done:!Z}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},b55=function(){function Z(J){if(J===void 0)J=Z.minComparator;var X=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this._invertedCompare=function(Y,$){return X.compare(Y,$).then(function(Q){return-1*Q})}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:2;return Math.floor((J-X)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:-1;return J+X},Z.minComparator=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){if(J>X)return[2,1];else if(J<X)return[2,-1];else return[2,0]})})},Z.maxComparator=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){if(X>J)return[2,1];else if(X<J)return[2,-1];else return[2,0]})})},Z.minComparatorNumber=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J-X]})})},Z.maxComparatorNumber=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,X-J]})})},Z.defaultIsEqual=function(J,X){return C1(this,void 0,void 0,function(){return R1(this,function(Y){return[2,J===X]})})},Z.print=function(J){function X(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var $=0,Q=[],W=X(J.length-1)+2,K=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(H,V){var q=Math.pow(2,W-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
|
|
486
486
|
`)},Z.heapify=function(J,X){return C1(this,void 0,void 0,function(){var Y;return R1(this,function($){switch($.label){case 0:return Y=new Z(X),Y.heapArray=J,[4,Y.init()];case 1:return $.sent(),[2,Y]}})})},Z.heappop=function(J,X){var Y=new Z(X);return Y.heapArray=J,Y.pop()},Z.heappush=function(J,X,Y){return C1(this,void 0,void 0,function(){var $;return R1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=J,[4,$.push(X)];case 1:return Q.sent(),[2]}})})},Z.heappushpop=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.pushpop(X)},Z.heapreplace=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.replace(X)},Z.heaptop=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.top(X)},Z.heapbottom=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.bottom(X)},Z.nlargest=function(J,X,Y){return C1(this,void 0,void 0,function(){var $;return R1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=U4([],s5(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.top(J)]}})})},Z.nsmallest=function(J,X,Y){return C1(this,void 0,void 0,function(){var $;return R1(this,function(Q){switch(Q.label){case 0:return $=new Z(Y),$.heapArray=U4([],s5(X),!1),[4,$.init()];case 1:return Q.sent(),[2,$.bottom(J)]}})})},Z.prototype.add=function(J){return C1(this,void 0,void 0,function(){return R1(this,function(X){switch(X.label){case 0:return[4,this._sortNodeUp(this.heapArray.push(J)-1)];case 1:return X.sent(),this._applyLimit(),[2,!0]}})})},Z.prototype.addAll=function(J){return C1(this,void 0,void 0,function(){var X,Y,$;return R1(this,function(Q){switch(Q.label){case 0:X=this.length,($=this.heapArray).push.apply($,U4([],s5(J),!1)),Y=this.length,Q.label=1;case 1:if(!(X<Y))return[3,4];return[4,this._sortNodeUp(X)];case 2:Q.sent(),Q.label=3;case 3:return++X,[3,1];case 4:return this._applyLimit(),[2,!0]}})})},Z.prototype.bottom=function(){return C1(this,arguments,void 0,function(J){if(J===void 0)J=1;return R1(this,function(X){if(this.heapArray.length===0||J<=0)return[2,[]];else if(this.heapArray.length===1)return[2,[this.heapArray[0]]];else if(J>=this.heapArray.length)return[2,U4([],s5(this.heapArray),!1)];else return[2,this._bottomN_push(~~J)]})})},Z.prototype.check=function(){return C1(this,void 0,void 0,function(){var J,X,Y,$,Q,W,K,G,z;return R1(this,function(H){switch(H.label){case 0:J=0,H.label=1;case 1:if(!(J<this.heapArray.length))return[3,10];X=this.heapArray[J],Y=this.getChildrenOf(J),H.label=2;case 2:H.trys.push([2,7,8,9]),$=(G=void 0,cQ1(Y)),Q=$.next(),H.label=3;case 3:if(Q.done)return[3,6];return W=Q.value,[4,this.compare(X,W)];case 4:if(H.sent()>0)return[2,X];H.label=5;case 5:return Q=$.next(),[3,3];case 6:return[3,9];case 7:return K=H.sent(),G={error:K},[3,9];case 8:try{if(Q&&!Q.done&&(z=$.return))z.call($)}finally{if(G)throw G.error}return[7];case 9:return++J,[3,1];case 10:return[2]}})})},Z.prototype.clear=function(){this.heapArray=[]},Z.prototype.clone=function(){var J=new Z(this.comparator());return J.heapArray=this.toArray(),J._limit=this._limit,J},Z.prototype.comparator=function(){return this.compare},Z.prototype.contains=function(J){return C1(this,arguments,void 0,function(X,Y){var $,Q,W,K,G,z;if(Y===void 0)Y=Z.defaultIsEqual;return R1(this,function(H){switch(H.label){case 0:H.trys.push([0,5,6,7]),$=cQ1(this.heapArray),Q=$.next(),H.label=1;case 1:if(Q.done)return[3,4];return W=Q.value,[4,Y(W,X)];case 2:if(H.sent())return[2,!0];H.label=3;case 3:return Q=$.next(),[3,1];case 4:return[3,7];case 5:return K=H.sent(),G={error:K},[3,7];case 6:try{if(Q&&!Q.done&&(z=$.return))z.call($)}finally{if(G)throw G.error}return[7];case 7:return[2,!1]}})})},Z.prototype.init=function(J){return C1(this,void 0,void 0,function(){var X;return R1(this,function(Y){switch(Y.label){case 0:if(J)this.heapArray=U4([],s5(J),!1);X=Math.floor(this.heapArray.length),Y.label=1;case 1:if(!(X>=0))return[3,4];return[4,this._sortNodeDown(X)];case 2:Y.sent(),Y.label=3;case 3:return--X,[3,1];case 4:return this._applyLimit(),[2]}})})},Z.prototype.isEmpty=function(){return this.length===0},Z.prototype.leafs=function(){if(this.heapArray.length===0)return[];var J=Z.getParentIndexOf(this.heapArray.length-1);return this.heapArray.slice(J+1)},Object.defineProperty(Z.prototype,"length",{get:function(){return this.heapArray.length},enumerable:!1,configurable:!0}),Object.defineProperty(Z.prototype,"limit",{get:function(){return this._limit},set:function(J){this._limit=~~J,this._applyLimit()},enumerable:!1,configurable:!0}),Z.prototype.peek=function(){return this.heapArray[0]},Z.prototype.pop=function(){return C1(this,void 0,void 0,function(){var J;return R1(this,function(X){if(J=this.heapArray.pop(),this.length>0&&J!==void 0)return[2,this.replace(J)];return[2,J]})})},Z.prototype.push=function(){var J=[];for(var X=0;X<arguments.length;X++)J[X]=arguments[X];return C1(this,void 0,void 0,function(){return R1(this,function(Y){if(J.length<1)return[2,!1];else if(J.length===1)return[2,this.add(J[0])];else return[2,this.addAll(J)]})})},Z.prototype.pushpop=function(J){return C1(this,void 0,void 0,function(){var X;return R1(this,function(Y){switch(Y.label){case 0:return[4,this.compare(this.heapArray[0],J)];case 1:if(!(Y.sent()<0))return[3,3];return X=s5([this.heapArray[0],J],2),J=X[0],this.heapArray[0]=X[1],[4,this._sortNodeDown(0)];case 2:Y.sent(),Y.label=3;case 3:return[2,J]}})})},Z.prototype.remove=function(J){return C1(this,arguments,void 0,function(X,Y){var $,Q,W,K=this;if(Y===void 0)Y=Z.defaultIsEqual;return R1(this,function(G){switch(G.label){case 0:if(!this.heapArray.length)return[2,!1];if(X!==void 0)return[3,2];return[4,this.pop()];case 1:return G.sent(),[2,!0];case 2:$=[0],G.label=3;case 3:if(!$.length)return[3,13];return Q=$.shift(),[4,Y(this.heapArray[Q],X)];case 4:if(!G.sent())return[3,11];if(Q!==0)return[3,6];return[4,this.pop()];case 5:return G.sent(),[3,10];case 6:if(Q!==this.heapArray.length-1)return[3,7];return this.heapArray.pop(),[3,10];case 7:return this.heapArray.splice(Q,1,this.heapArray.pop()),[4,this._sortNodeUp(Q)];case 8:return G.sent(),[4,this._sortNodeDown(Q)];case 9:G.sent(),G.label=10;case 10:return[2,!0];case 11:W=Z.getChildrenIndexOf(Q).filter(function(z){return z<K.heapArray.length}),$.push.apply($,U4([],s5(W),!1)),G.label=12;case 12:return[3,3];case 13:return[2,!1]}})})},Z.prototype.replace=function(J){return C1(this,void 0,void 0,function(){var X;return R1(this,function(Y){switch(Y.label){case 0:return X=this.heapArray[0],this.heapArray[0]=J,[4,this._sortNodeDown(0)];case 1:return Y.sent(),[2,X]}})})},Z.prototype.size=function(){return this.length},Z.prototype.top=function(){return C1(this,arguments,void 0,function(J){if(J===void 0)J=1;return R1(this,function(X){if(this.heapArray.length===0||J<=0)return[2,[]];else if(this.heapArray.length===1||J===1)return[2,[this.heapArray[0]]];else if(J>=this.heapArray.length)return[2,U4([],s5(this.heapArray),!1)];else return[2,this._topN_push(~~J)]})})},Z.prototype.toArray=function(){return U4([],s5(this.heapArray),!1)},Z.prototype.toString=function(){return this.heapArray.toString()},Z.prototype.get=function(J){return this.heapArray[J]},Z.prototype.getChildrenOf=function(J){var X=this;return Z.getChildrenIndexOf(J).map(function(Y){return X.heapArray[Y]}).filter(function(Y){return Y!==void 0})},Z.prototype.getParentOf=function(J){var X=Z.getParentIndexOf(J);return this.heapArray[X]},Z.prototype[Symbol.iterator]=function(){return R1(this,function(J){switch(J.label){case 0:if(!this.length)return[3,2];return[4,this.pop()];case 1:return J.sent(),[3,0];case 2:return[2]}})},Z.prototype.iterator=function(){return this},Z.prototype._applyLimit=function(){if(this._limit&&this._limit<this.heapArray.length){var J=this.heapArray.length-this._limit;while(J)this.heapArray.pop(),--J}},Z.prototype._bottomN_push=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q,K,W,K;return R1(this,function(G){switch(G.label){case 0:return X=new Z(this.compare),X.limit=J,X.heapArray=this.heapArray.slice(-J),[4,X.init()];case 1:G.sent(),Y=this.heapArray.length-1-J,$=Z.getParentIndexOf(Y),Q=[];for(K=Y;K>$;--K)Q.push(K);W=this.heapArray,G.label=2;case 2:if(!Q.length)return[3,6];return K=Q.shift(),[4,this.compare(W[K],X.peek())];case 3:if(!(G.sent()>0))return[3,5];return[4,X.replace(W[K])];case 4:if(G.sent(),K%2)Q.push(Z.getParentIndexOf(K));G.label=5;case 5:return[3,2];case 6:return[2,X.toArray()]}})})},Z.prototype._moveNode=function(J,X){var Y;Y=s5([this.heapArray[X],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[X]=Y[1]},Z.prototype._sortNodeDown=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q,W,K;return R1(this,function(G){switch(G.label){case 0:X=this.heapArray.length,G.label=1;case 1:if(Y=2*J+1,$=Y+1,Q=J,W=Y<X,!W)return[3,3];return[4,this.compare(this.heapArray[Y],this.heapArray[Q])];case 2:W=G.sent()<0,G.label=3;case 3:if(W)Q=Y;if(K=$<X,!K)return[3,5];return[4,this.compare(this.heapArray[$],this.heapArray[Q])];case 4:K=G.sent()<0,G.label=5;case 5:if(K)Q=$;if(Q===J)return[3,7];this._moveNode(J,Q),J=Q,G.label=6;case 6:return[3,1];case 7:return[2]}})})},Z.prototype._sortNodeUp=function(J){return C1(this,void 0,void 0,function(){var X;return R1(this,function(Y){switch(Y.label){case 0:if(!(J>0))return[3,2];return X=Z.getParentIndexOf(J),[4,this.compare(this.heapArray[J],this.heapArray[X])];case 1:if(Y.sent()<0)this._moveNode(J,X),J=X;else return[3,2];return[3,0];case 2:return[2]}})})},Z.prototype._topN_push=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q;return R1(this,function(W){switch(W.label){case 0:X=new Z(this._invertedCompare),X.limit=J,Y=[0],$=this.heapArray,W.label=1;case 1:if(!Y.length)return[3,7];if(Q=Y.shift(),!(Q<$.length))return[3,6];if(!(X.length<J))return[3,3];return[4,X.push($[Q])];case 2:return W.sent(),Y.push.apply(Y,U4([],s5(Z.getChildrenIndexOf(Q)),!1)),[3,6];case 3:return[4,this.compare($[Q],X.peek())];case 4:if(!(W.sent()<0))return[3,6];return[4,X.replace($[Q])];case 5:W.sent(),Y.push.apply(Y,U4([],s5(Z.getChildrenIndexOf(Q)),!1)),W.label=6;case 6:return[3,1];case 7:return[2,X.toArray()]}})})},Z.prototype._topN_fill=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q,W,W;return R1(this,function(K){switch(K.label){case 0:return X=this.heapArray,Y=new Z(this._invertedCompare),Y.limit=J,Y.heapArray=X.slice(0,J),[4,Y.init()];case 1:K.sent(),$=Z.getParentIndexOf(J-1)+1,Q=[];for(W=$;W<J;++W)Q.push.apply(Q,U4([],s5(Z.getChildrenIndexOf(W).filter(function(G){return G<X.length})),!1));if((J-1)%2)Q.push(J);K.label=2;case 2:if(!Q.length)return[3,6];if(W=Q.shift(),!(W<X.length))return[3,5];return[4,this.compare(X[W],Y.peek())];case 3:if(!(K.sent()<0))return[3,5];return[4,Y.replace(X[W])];case 4:K.sent(),Q.push.apply(Q,U4([],s5(Z.getChildrenIndexOf(W)),!1)),K.label=5;case 5:return[3,2];case 6:return[2,Y.toArray()]}})})},Z.prototype._topN_heap=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q,W;return R1(this,function(K){switch(K.label){case 0:X=this.clone(),Y=[],$=0,K.label=1;case 1:if(!($<J))return[3,4];return W=(Q=Y).push,[4,X.pop()];case 2:W.apply(Q,[K.sent()]),K.label=3;case 3:return++$,[3,1];case 4:return[2,Y]}})})},Z.prototype._topIdxOf=function(J){return C1(this,void 0,void 0,function(){var X,Y,$,Q;return R1(this,function(W){switch(W.label){case 0:if(!J.length)return[2,-1];X=0,Y=J[X],$=1,W.label=1;case 1:if(!($<J.length))return[3,4];return[4,this.compare(J[$],Y)];case 2:if(Q=W.sent(),Q<0)X=$,Y=J[$];W.label=3;case 3:return++$,[3,1];case 4:return[2,X]}})})},Z.prototype._topOf=function(){var J=[];for(var X=0;X<arguments.length;X++)J[X]=arguments[X];return C1(this,void 0,void 0,function(){var Y;return R1(this,function($){switch($.label){case 0:return Y=new Z(this.compare),[4,Y.init(J)];case 1:return $.sent(),[2,Y.peek()]}})})},Z}(),ZX6=function(Z,J){var X={label:0,sent:function(){if(Q[0]&1)throw Q[1];return Q[1]},trys:[],ops:[]},Y,$,Q,W=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return W.next=K(0),W.throw=K(1),W.return=K(2),typeof Symbol==="function"&&(W[Symbol.iterator]=function(){return this}),W;function K(z){return function(H){return G([z,H])}}function G(z){if(Y)throw new TypeError("Generator is already executing.");while(W&&(W=0,z[0]&&(X=0)),X)try{if(Y=1,$&&(Q=z[0]&2?$.return:z[0]?$.throw||((Q=$.return)&&Q.call($),0):$.next)&&!(Q=Q.call($,z[1])).done)return Q;if($=0,Q)z=[z[0]&2,Q.value];switch(z[0]){case 0:case 1:Q=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,$=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if((Q=X.trys,!(Q=Q.length>0&&Q[Q.length-1]))&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!Q||z[1]>Q[0]&&z[1]<Q[3])){X.label=z[1];break}if(z[0]===6&&X.label<Q[1]){X.label=Q[1],Q=z;break}if(Q&&X.label<Q[2]){X.label=Q[2],X.ops.push(z);break}if(Q[2])X.ops.pop();X.trys.pop();continue}z=J.call(Z,X)}catch(H){z=[6,H],$=0}finally{Y=Q=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},P6=function(Z,J){var X=typeof Symbol==="function"&&Z[Symbol.iterator];if(!X)return Z;var Y=X.call(Z),$,Q=[],W;try{while((J===void 0||J-- >0)&&!($=Y.next()).done)Q.push($.value)}catch(K){W={error:K}}finally{try{if($&&!$.done&&(X=Y.return))X.call(Y)}finally{if(W)throw W.error}}return Q},M5=function(Z,J,X){if(X||arguments.length===2){for(var Y=0,$=J.length,Q;Y<$;Y++)if(Q||!(Y in J)){if(!Q)Q=Array.prototype.slice.call(J,0,Y);Q[Y]=J[Y]}}return Z.concat(Q||Array.prototype.slice.call(J))};var lQ1=function(){function Z(J){if(J===void 0)J=Z.minComparator;var X=this;this.compare=J,this.heapArray=[],this._limit=0,this.offer=this.add,this.element=this.peek,this.poll=this.pop,this.removeAll=this.clear,this._invertedCompare=function(Y,$){return-1*X.compare(Y,$)}}return Z.getChildrenIndexOf=function(J){return[J*2+1,J*2+2]},Z.getParentIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:2;return Math.floor((J-X)/2)},Z.getSiblingIndexOf=function(J){if(J<=0)return-1;var X=J%2?1:-1;return J+X},Z.minComparator=function(J,X){if(J>X)return 1;else if(J<X)return-1;else return 0},Z.maxComparator=function(J,X){if(X>J)return 1;else if(X<J)return-1;else return 0},Z.minComparatorNumber=function(J,X){return J-X},Z.maxComparatorNumber=function(J,X){return X-J},Z.defaultIsEqual=function(J,X){return J===X},Z.print=function(J){function X(H){var V=Z.getParentIndexOf(H);return Math.floor(Math.log2(V+1))}function Y(H,V){var q="";for(;V>0;--V)q+=H;return q}var $=0,Q=[],W=X(J.length-1)+2,K=0;while($<J.length){var G=X($)+1;if($===0)G=0;var z=String(J.get($));if(z.length>K)K=z.length;Q[G]=Q[G]||[],Q[G].push(z),$+=1}return Q.map(function(H,V){var q=Math.pow(2,W-V)-1;return Y(" ",Math.floor(q/2)*K)+H.map(function(F){var U=(K-F.length)/2;return Y(" ",Math.ceil(U))+F+Y(" ",Math.floor(U))}).join(Y(" ",q*K))}).join(`
|
|
487
487
|
`)},Z.heapify=function(J,X){var Y=new Z(X);return Y.heapArray=J,Y.init(),Y},Z.heappop=function(J,X){var Y=new Z(X);return Y.heapArray=J,Y.pop()},Z.heappush=function(J,X,Y){var $=new Z(Y);$.heapArray=J,$.push(X)},Z.heappushpop=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.pushpop(X)},Z.heapreplace=function(J,X,Y){var $=new Z(Y);return $.heapArray=J,$.replace(X)},Z.heaptop=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.top(X)},Z.heapbottom=function(J,X,Y){if(X===void 0)X=1;var $=new Z(Y);return $.heapArray=J,$.bottom(X)},Z.nlargest=function(J,X,Y){var $=new Z(Y);return $.heapArray=M5([],P6(X),!1),$.init(),$.top(J)},Z.nsmallest=function(J,X,Y){var $=new Z(Y);return $.heapArray=M5([],P6(X),!1),$.init(),$.bottom(J)},Z.prototype.add=function(J){return this._sortNodeUp(this.heapArray.push(J)-1),this._applyLimit(),!0},Z.prototype.addAll=function(J){var X,Y=this.length;(X=this.heapArray).push.apply(X,M5([],P6(J),!1));for(var $=this.length;Y<$;++Y)this._sortNodeUp(Y);return this._applyLimit(),!0},Z.prototype.bottom=function(J){if(J===void 0)J=1;if(this.heapArray.length===0||J<=0)return[];else if(this.heapArray.length===1)return[this.heapArray[0]];else if(J>=this.heapArray.length)return M5([],P6(this.heapArray),!1);else return this._bottomN_push(~~J)},Z.prototype.check=function(){var J=this;return this.heapArray.find(function(X,Y){return!!J.getChildrenOf(Y).find(function($){return J.compare(X,$)>0})})},Z.prototype.clear=function(){this.heapArray=[]},Z.prototype.clone=function(){var J=new Z(this.comparator());return J.heapArray=this.toArray(),J._limit=this._limit,J},Z.prototype.comparator=function(){return this.compare},Z.prototype.contains=function(J,X){if(X===void 0)X=Z.defaultIsEqual;return this.indexOf(J,X)!==-1},Z.prototype.init=function(J){if(J)this.heapArray=M5([],P6(J),!1);for(var X=Math.floor(this.heapArray.length);X>=0;--X)this._sortNodeDown(X);this._applyLimit()},Z.prototype.isEmpty=function(){return this.length===0},Z.prototype.indexOf=function(J,X){if(X===void 0)X=Z.defaultIsEqual;if(this.heapArray.length===0)return-1;var Y=[],$=0;while($<this.heapArray.length){var Q=this.heapArray[$];if(X(Q,J))return $;else if(this.compare(Q,J)<=0)Y.push.apply(Y,M5([],P6(Z.getChildrenIndexOf($)),!1));$=Y.shift()||this.heapArray.length}return-1},Z.prototype.indexOfEvery=function(J,X){if(X===void 0)X=Z.defaultIsEqual;if(this.heapArray.length===0)return[];var Y=[],$=[],Q=0;while(Q<this.heapArray.length){var W=this.heapArray[Q];if(X(W,J))$.push(Q),Y.push.apply(Y,M5([],P6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare(W,J)<=0)Y.push.apply(Y,M5([],P6(Z.getChildrenIndexOf(Q)),!1));Q=Y.shift()||this.heapArray.length}return $},Z.prototype.leafs=function(){if(this.heapArray.length===0)return[];var J=Z.getParentIndexOf(this.heapArray.length-1);return this.heapArray.slice(J+1)},Object.defineProperty(Z.prototype,"length",{get:function(){return this.heapArray.length},enumerable:!1,configurable:!0}),Object.defineProperty(Z.prototype,"limit",{get:function(){return this._limit},set:function(J){if(J<0||isNaN(J))this._limit=0;else this._limit=~~J;this._applyLimit()},enumerable:!1,configurable:!0}),Z.prototype.setLimit=function(J){if(this.limit=J,J<0||isNaN(J))return NaN;else return this._limit},Z.prototype.peek=function(){return this.heapArray[0]},Z.prototype.pop=function(){var J=this.heapArray.pop();if(this.length>0&&J!==void 0)return this.replace(J);return J},Z.prototype.push=function(){var J=[];for(var X=0;X<arguments.length;X++)J[X]=arguments[X];if(J.length<1)return!1;else if(J.length===1)return this.add(J[0]);else return this.addAll(J)},Z.prototype.pushpop=function(J){var X;if(this.compare(this.heapArray[0],J)<0)X=P6([this.heapArray[0],J],2),J=X[0],this.heapArray[0]=X[1],this._sortNodeDown(0);return J},Z.prototype.remove=function(J,X){var Y=this;if(X===void 0)X=Z.defaultIsEqual;if(!this.heapArray.length)return!1;if(J===void 0)return this.pop(),!0;var $=[0];while($.length){var Q=$.shift();if(X(this.heapArray[Q],J)){if(Q===0)this.pop();else if(Q===this.heapArray.length-1)this.heapArray.pop();else this.heapArray.splice(Q,1,this.heapArray.pop()),this._sortNodeUp(Q),this._sortNodeDown(Q);return!0}else if(this.compare(this.heapArray[Q],J)<=0){var W=Z.getChildrenIndexOf(Q).filter(function(K){return K<Y.heapArray.length});$.push.apply($,M5([],P6(W),!1))}}return!1},Z.prototype.replace=function(J){var X=this.heapArray[0];return this.heapArray[0]=J,this._sortNodeDown(0),X},Z.prototype.size=function(){return this.length},Z.prototype.top=function(J){if(J===void 0)J=1;if(this.heapArray.length===0||J<=0)return[];else if(this.heapArray.length===1||J===1)return[this.heapArray[0]];else if(J>=this.heapArray.length)return M5([],P6(this.heapArray),!1);else return this._topN_push(~~J)},Z.prototype.toArray=function(){return M5([],P6(this.heapArray),!1)},Z.prototype.toString=function(){return this.heapArray.toString()},Z.prototype.get=function(J){return this.heapArray[J]},Z.prototype.getChildrenOf=function(J){var X=this;return Z.getChildrenIndexOf(J).map(function(Y){return X.heapArray[Y]}).filter(function(Y){return Y!==void 0})},Z.prototype.getParentOf=function(J){var X=Z.getParentIndexOf(J);return this.heapArray[X]},Z.prototype[Symbol.iterator]=function(){return ZX6(this,function(J){switch(J.label){case 0:if(!this.length)return[3,2];return[4,this.pop()];case 1:return J.sent(),[3,0];case 2:return[2]}})},Z.prototype.iterator=function(){return this.toArray()},Z.prototype._applyLimit=function(){if(this._limit>0&&this._limit<this.heapArray.length){var J=this.heapArray.length-this._limit;while(J)this.heapArray.pop(),--J}},Z.prototype._bottomN_push=function(J){var X=new Z(this.compare);X.limit=J,X.heapArray=this.heapArray.slice(-J),X.init();var Y=this.heapArray.length-1-J,$=Z.getParentIndexOf(Y),Q=[];for(var W=Y;W>$;--W)Q.push(W);var K=this.heapArray;while(Q.length){var W=Q.shift();if(this.compare(K[W],X.peek())>0){if(X.replace(K[W]),W%2)Q.push(Z.getParentIndexOf(W))}}return X.toArray()},Z.prototype._moveNode=function(J,X){var Y;Y=P6([this.heapArray[X],this.heapArray[J]],2),this.heapArray[J]=Y[0],this.heapArray[X]=Y[1]},Z.prototype._sortNodeDown=function(J){var X=this.heapArray.length;while(!0){var Y=2*J+1,$=Y+1,Q=J;if(Y<X&&this.compare(this.heapArray[Y],this.heapArray[Q])<0)Q=Y;if($<X&&this.compare(this.heapArray[$],this.heapArray[Q])<0)Q=$;if(Q===J)break;this._moveNode(J,Q),J=Q}},Z.prototype._sortNodeUp=function(J){while(J>0){var X=Z.getParentIndexOf(J);if(this.compare(this.heapArray[J],this.heapArray[X])<0)this._moveNode(J,X),J=X;else break}},Z.prototype._topN_push=function(J){var X=new Z(this._invertedCompare);X.limit=J;var Y=[0],$=this.heapArray;while(Y.length){var Q=Y.shift();if(Q<$.length){if(X.length<J)X.push($[Q]),Y.push.apply(Y,M5([],P6(Z.getChildrenIndexOf(Q)),!1));else if(this.compare($[Q],X.peek())<0)X.replace($[Q]),Y.push.apply(Y,M5([],P6(Z.getChildrenIndexOf(Q)),!1))}}return X.toArray()},Z.prototype._topN_fill=function(J){var X=this.heapArray,Y=new Z(this._invertedCompare);Y.limit=J,Y.heapArray=X.slice(0,J),Y.init();var $=Z.getParentIndexOf(J-1)+1,Q=[];for(var W=$;W<J;++W)Q.push.apply(Q,M5([],P6(Z.getChildrenIndexOf(W).filter(function(K){return K<X.length})),!1));if((J-1)%2)Q.push(J);while(Q.length){var W=Q.shift();if(W<X.length){if(this.compare(X[W],Y.peek())<0)Y.replace(X[W]),Q.push.apply(Q,M5([],P6(Z.getChildrenIndexOf(W)),!1))}}return Y.toArray()},Z.prototype._topN_heap=function(J){var X=this.clone(),Y=[];for(var $=0;$<J;++$)Y.push(X.pop());return Y},Z.prototype._topIdxOf=function(J){if(!J.length)return-1;var X=0,Y=J[X];for(var $=1;$<J.length;++$){var Q=this.compare(J[$],Y);if(Q<0)X=$,Y=J[$]}return X},Z.prototype._topOf=function(){var J=[];for(var X=0;X<arguments.length;X++)J[X]=arguments[X];var Y=new Z(this.compare);return Y.init(J),Y.peek()},Z}();var pQ1=0.099856;class BF extends qY{faceSpeed=0;idleLoopedAnimations=[];idleLoopedAnimationsSpeed;jumpOneshotAnimations=[];moveLoopedAnimations=[];moveLoopedAnimationsSpeed;moveSpeed=0;_faceTarget;_jumpHeight=0;_moveCompletesWhenStuck=!1;_moveIgnoreAxes={};_moveStartMoveAnimations=!1;_moveStartIdleAnimationsOnCompletion=!0;_moveStoppingDistanceSquared=pQ1;_moveStuckAccumulatorMs=0;_moveStuckLastPosition;_moveTarget;_onFace;_onFaceComplete;_onMove;_onMoveComplete;_stopFaceRequested=!1;_stopMoveRequested=!1;constructor(Z={}){super();this.idleLoopedAnimations=Z.idleLoopedAnimations??this.idleLoopedAnimations,this.idleLoopedAnimationsSpeed=Z.idleLoopedAnimationsSpeed??this.idleLoopedAnimationsSpeed,this.jumpOneshotAnimations=Z.jumpOneshotAnimations??this.jumpOneshotAnimations,this.moveLoopedAnimations=Z.moveLoopedAnimations??this.moveLoopedAnimations,this.moveLoopedAnimationsSpeed=Z.moveLoopedAnimationsSpeed??this.moveLoopedAnimationsSpeed}spawn(Z){super.spawn(Z),this._startIdleAnimations(Z)}face(Z,J,X){this._faceTarget=Z,this.faceSpeed=J,this._onFace=X?.faceCallback,this._onFaceComplete=X?.faceCompleteCallback}jump(Z){this._jumpHeight=Z}move(Z,J,X){this.moveSpeed=J,this._moveCompletesWhenStuck=X?.moveCompletesWhenStuck??!1,this._moveIgnoreAxes=X?.moveIgnoreAxes??{},this._moveStartIdleAnimationsOnCompletion=X?.moveStartIdleAnimationsOnCompletion??!0,this._moveStartMoveAnimations=!0,this._moveStoppingDistanceSquared=X?.moveStoppingDistance?X.moveStoppingDistance**2:pQ1,this._moveTarget=Z,this._onMove=X?.moveCallback,this._onMoveComplete=X?.moveCompleteCallback,this._moveStuckAccumulatorMs=0,this._moveStuckLastPosition=void 0}stopFace(){this._stopFaceRequested=!0}stopMove(){this._stopMoveRequested=!0}tick(Z,J){if(super.tick(Z,J),!this._moveTarget&&!this._faceTarget&&!this._jumpHeight)return;if(this._moveStartMoveAnimations)this._startMoveAnimations(Z),this._moveStartMoveAnimations=!1;let X=J/1000,Y=Z.position;if(Z.isDynamic&&this._jumpHeight>0){let $=Math.abs(Z.world.simulation.gravity.y),Q=Math.sqrt(2*$*this._jumpHeight);Z.applyImpulse({x:0,y:Q*Z.mass,z:0}),this._jumpHeight=0,this._startJumpAnimations(Z)}if(this._moveTarget){let $={x:this._moveIgnoreAxes.x?0:this._moveTarget.x-Y.x,y:this._moveIgnoreAxes.y?0:this._moveTarget.y-Y.y,z:this._moveIgnoreAxes.z?0:this._moveTarget.z-Y.z},Q=$.x*$.x+$.y*$.y+$.z*$.z,W=!1;if(this._moveCompletesWhenStuck){if(this._moveStuckAccumulatorMs+=J,this._moveStuckAccumulatorMs>=500){if(this._moveStuckLastPosition){let K=Y.x-this._moveStuckLastPosition.x,G=Y.y-this._moveStuckLastPosition.y,z=Y.z-this._moveStuckLastPosition.z;W=Math.sqrt(K*K+G*G+z*z)<this.moveSpeed*0.1}this._moveStuckLastPosition=Y,this._moveStuckAccumulatorMs=0}}if(Q>this._moveStoppingDistanceSquared&&!this._stopMoveRequested&&!W){let K=Math.sqrt(Q),G=this.moveSpeed*X,H=Math.min(K,G)/K,V={x:Y.x+$.x*H,y:Y.y+$.y*H,z:Y.z+$.z*H};if(Z.setPosition(V),this._onMove)this._onMove(V,this._moveTarget)}else{if(this._moveStuckAccumulatorMs=0,this._moveStuckLastPosition=void 0,this._moveTarget=void 0,this._stopMoveRequested=!1,this._moveStartIdleAnimationsOnCompletion)this._startIdleAnimations(Z);if(this._onMoveComplete){let K=this._onMoveComplete;this._onMove=void 0,this._onMoveComplete=void 0,K(Y)}}}if(this._faceTarget){let $={x:this._faceTarget.x-Y.x,z:this._faceTarget.z-Y.z},Q=Math.atan2(-$.x,-$.z),W=Z.rotation,K=Math.atan2(2*(W.w*W.y),1-2*(W.y*W.y)),G=Q-K;while(G>Math.PI)G-=2*Math.PI;while(G<-Math.PI)G+=2*Math.PI;if(Math.abs(G)>0.01&&!this._stopFaceRequested){let z=this.faceSpeed*X,H=Math.abs(G)<z?G:Math.sign(G)*z,q=(K+H)/2,F={x:0,y:Math.fround(Math.sin(q)),z:0,w:Math.fround(Math.cos(q))};if(Z.setRotation(F),this._onFace)this._onFace(W,F)}else if(this._faceTarget=void 0,this._stopFaceRequested=!1,this._onFaceComplete){let z=this._onFaceComplete;this._onFace=void 0,this._onFaceComplete=void 0,z(Z.rotation)}}}_startIdleAnimations(Z){if(this.idleLoopedAnimationsSpeed)Z.setModelAnimationsPlaybackRate(this.idleLoopedAnimationsSpeed);Z.stopModelAnimations(this.moveLoopedAnimations),Z.stopModelAnimations(this.jumpOneshotAnimations),Z.startModelLoopedAnimations(this.idleLoopedAnimations)}_startJumpAnimations(Z){Z.stopModelAnimations(this.moveLoopedAnimations),Z.stopModelAnimations(this.idleLoopedAnimations),Z.startModelOneshotAnimations(this.jumpOneshotAnimations)}_startMoveAnimations(Z){if(this.moveLoopedAnimationsSpeed)Z.setModelAnimationsPlaybackRate(this.moveLoopedAnimationsSpeed);Z.stopModelAnimations(this.jumpOneshotAnimations),Z.stopModelAnimations(this.idleLoopedAnimations),Z.startModelLoopedAnimations(this.moveLoopedAnimations)}}class Yg extends BF{_debug=!1;_entity;_maxFall=0;_maxJump=0;_maxOpenSetIterations=200;_onPathfindAbort;_onPathfindComplete;_onWaypointMoveComplete;_onWaypointMoveSkipped;_speed=0;_target;_verticalPenalty=0;_waypoints=[];_waypointNextIndex=0;_waypointStoppingDistance;_waypointTimeoutMs=2000;constructor(Z={}){super(Z)}get debug(){return this._debug}get maxFall(){return this._maxFall}get maxJump(){return this._maxJump}get maxOpenSetIterations(){return this._maxOpenSetIterations}get speed(){return this._speed}get target(){return this._target}get verticalPenalty(){return this._verticalPenalty}get waypoints(){return this._waypoints}get waypointNextIndex(){return this._waypointNextIndex}get waypointTimeoutMs(){return this._waypointTimeoutMs}pathfind(Z,J,X){if(this._target=Z,this._speed=J,this._debug=X?.debug??!1,this._maxFall=X?.maxFall?-Math.abs(X.maxFall):0,this._maxJump=X?.maxJump?Math.abs(X.maxJump):0,this._maxOpenSetIterations=X?.maxOpenSetIterations??200,this._onPathfindAbort=X?.pathfindAbortCallback,this._onPathfindComplete=X?.pathfindCompleteCallback,this._onWaypointMoveComplete=X?.waypointMoveCompleteCallback,this._onWaypointMoveSkipped=X?.waypointMoveSkippedCallback,this._verticalPenalty=X?.verticalPenalty??0,this._waypoints=[],this._waypointNextIndex=0,this._waypointStoppingDistance=X?.waypointStoppingDistance,this._waypointTimeoutMs=X?.waypointTimeoutMs??2000/J,!this._calculatePath())return!1;return this._moveToNextWaypoint(),!0}attach(Z){super.attach(Z),this._entity=Z}detach(Z){super.detach(Z),this._entity=void 0}_calculatePath(){if(!this._target||!this._entity?.world)return d.error("PathfindingEntityController._calculatePath: No target or world"),!1;let Z=this._entity.height,J=this._findGroundedStart();if(!J){if(this._debug)d.warning(`PathfindingEntityController._calculatePath: No valid grounded start found within maxFall distance, path search aborted. Start: ${this._coordinateToKey(this._target)}, Target: ${this._coordinateToKey(this._target)}`);return!1}let X={x:Math.floor(this._target.x),y:Math.floor(this._target.y),z:Math.floor(this._target.z)},Y=Math.abs(X.x-J.x),$=Math.abs(X.y-J.y),Q=Math.abs(X.z-J.z);if(Y<=2&&$<=2&&Q<=2&&!this._isNeighborCoordinateBlocked(J,X,this._entity.height))return this._waypoints=[{x:J.x+0.5,y:J.y+Z/2,z:J.z+0.5},{x:X.x+0.5,y:X.y+Z/2,z:X.z+0.5}],!0;if(J.x===X.x&&J.y===X.y&&J.z===X.z)return this._waypoints=[{x:J.x+0.5,y:J.y+Z/2,z:J.z+0.5}],!0;let K=this._coordinateToKey(J),G=new Map,z=new Map([[K,0]]),H=new Map([[K,this._pathfindingHeuristic(J,X)]]),V=new Set,q=new lQ1((R,j)=>{let P=H.get(R[0])??1/0,D=H.get(j[0])??1/0;return P-D});q.push([K,J]);let F=[{x:0,y:0,z:1},{x:1,y:0,z:0},{x:0,y:0,z:-1},{x:-1,y:0,z:0},{x:1,y:0,z:1},{x:1,y:0,z:-1},{x:-1,y:0,z:1},{x:-1,y:0,z:-1}],U=[];for(let R=this._maxJump;R>=this._maxFall;R--){if(R===0)continue;let j=Math.abs(J.y+R-X.y);U.push({y:R,distanceToTargetY:j})}U.sort((R,j)=>R.distanceToTargetY-j.distanceToTargetY);let B=[...F,...U.flatMap(({y:R})=>F.map((j)=>({...j,y:R})))],w=0,O=Math.abs(X.x-J.x)+Math.abs(X.y-J.y)+Math.abs(X.z-J.z),N=Math.min(this._maxOpenSetIterations,O*20);while(!q.isEmpty()&&w<N){w++;let[R,j]=q.pop();if(j.x===X.x&&j.y===X.y&&j.z===X.z){let C=this._reconstructPath(G,j);if(this._waypoints=C.map((T)=>({x:T.x+0.5,y:T.y+Z/2,z:T.z+0.5})),this._debug)console.log(`PathfindingEntityController._calculatePath: Path found after ${w} open set iterations. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return!0}V.add(R);let P=z.get(R),D=new Map;for(let C of B){let T=`${C.x},${C.z}`,k=C.y<0;if(k&&D.has(T))continue;let x={x:j.x+C.x,y:j.y+C.y,z:j.z+C.z};if(Math.abs(X.x-x.x)+Math.abs(X.y-x.y)+Math.abs(X.z-x.z)>O*1.5)continue;let A=this._coordinateToKey(x);if(V.has(A))continue;let I=this._isNeighborCoordinateBlocked(j,x,this._entity.height);if(k&&I){D.set(T,!0);continue}if(I)continue;let v=Math.abs(C.x),b=Math.abs(C.y),m=Math.abs(C.z),n=b===0?0:this._verticalPenalty,o=(Math.max(v,b,m)===1&&v+b+m>1?1.4:1)+n,Q0=P+o,K0=z.get(A)??1/0;if(Q0>=K0)continue;G.set(A,j),z.set(A,Q0);let _0=Q0+this._pathfindingHeuristic(x,X);H.set(A,_0),q.push([A,x])}}if(w>=N){if(this._onPathfindAbort?.(),this._debug)d.warning(`PathfindingEntityController._calculatePath: Maximum open set iterations reached (${N}), path search aborted. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`)}else if(this._debug)d.warning(`PathfindingEntityController._calculatePath: No valid path found. Start: ${this._coordinateToKey(J)}, Target: ${this._coordinateToKey(this._target)}`);return this._target=void 0,this._waypoints=[],!1}_reconstructPath(Z,J){let X=[J],Y=J;while(Z.has(this._coordinateToKey(Y)))Y=Z.get(this._coordinateToKey(Y)),X.unshift(Y);return X}_coordinateToKey(Z){return`${Z.x},${Z.y},${Z.z}`}_moveToNextWaypoint(){let Z=this._waypointNextIndex>0?this._waypoints[this._waypointNextIndex-1]:void 0,J=this._waypoints[this._waypointNextIndex];if(!J||!this._entity)return;let X=0;if(this._entity.isDynamic&&Z&&J.y>Z.y){let Y=J.y-Z.y,$=Math.min(Y,this._maxJump)+0.75;this.jump($);let Q=Math.abs(this._entity.world.simulation.gravity.y),W=Math.sqrt(2*Q*$),K=Z.x+0.5,G=Z.z+0.5,z=J.x+0.5,H=J.z+0.5,V=z-K,q=H-G,F=Math.sqrt(V*V+q*q),U=W/Q,B=F/this._speed;X=Math.min(U*0.8,B)*1000}setTimeout(()=>{if(!this._entity)return;let Y=Date.now();this.face(J,this._speed),this.move(J,this._speed,{moveCompletesWhenStuck:!0,moveIgnoreAxes:{y:this._entity.isDynamic},moveStartIdleAnimationsOnCompletion:this._waypointNextIndex===this._waypoints.length-1,moveStoppingDistance:this._waypointStoppingDistance,moveCallback:()=>{if(Date.now()-Y>this._waypointTimeoutMs&&this._waypointNextIndex<this._waypoints.length-1)this._onWaypointMoveSkipped?.(J,this._waypointNextIndex),this._waypointNextIndex++,this._moveToNextWaypoint()},moveCompleteCallback:()=>{if(this._waypointNextIndex<this._waypoints.length-1)this._onWaypointMoveComplete?.(J,this._waypointNextIndex),this._waypointNextIndex++,this._moveToNextWaypoint();else this._onPathfindComplete?.()}})},X)}_pathfindingHeuristic(Z,J){return Math.abs(Z.x-J.x)+Math.abs(Z.y-J.y)+Math.abs(Z.z-J.z)}_isNeighborCoordinateBlocked(Z,J,X){if(!this._entity?.world)return!1;let Y=this._entity.world,$=Math.floor(J.x),Q=Math.floor(J.y),W=Math.floor(J.z),K=Math.floor(Z.x),G=Math.floor(Z.z);if(!Y.chunkLattice.hasBlock({x:$,y:Q-1,z:W}))return!0;for(let z=0;z<X;z++)if(Y.chunkLattice.hasBlock({x:$,y:Q+z,z:W}))return!0;if($!==K&&W!==G)for(let z=0;z<X;z++){let H=Y.chunkLattice.hasBlock({x:$,y:Q+z,z:G}),V=Y.chunkLattice.hasBlock({x:K,y:Q+z,z:W});if(H||V)return!0}return!1}_findGroundedStart(){if(!this._entity?.world)return;let{x:Z,y:J,z:X}=this._entity.position,Y={x:Math.floor(Z),y:Math.floor(J),z:Math.floor(X)};for(let $=0;$<=Math.abs(this._maxFall);$++)if(this._entity.world.chunkLattice.hasBlock({...Y,y:Y.y-$-1}))return{...Y,y:Y.y-$};return}}export{L46 as startServer,i$1 as WorldManagerEvent,HY as WorldManager,p$1 as WorldLoopEvent,qF as WorldLoop,ry as WorldEvent,FF as World,kS as WebServerEvent,PK as WebServer,y3 as Vector3,wF as Vector2,VF as Ticker,HF as TickAllocator,xQ as TelemetrySpanOperation,V8 as Telemetry,oy as SimulationEvent,KF as Simulation,BF as SimpleEntityController,zF as SceneUIManager,iE as SceneUIEvent,nz as SceneUI,O80 as SUPPORTED_INPUT_KEYS,Vz as RigidBodyType,tY as RigidBody,b3 as Quaternion,kB as PlayerUIEvent,uz as PlayerUI,n$1 as PlayerManagerEvent,V9 as PlayerManager,dz as PlayerEvent,v7 as PlayerEntity,L80 as PlayerCameraMode,dE as PlayerCameraEvent,mz as PlayerCamera,lW as Player,W$ as PersistenceManager,Yg as PathfindingEntityController,GF as ParticleEmitterManager,ny as ParticleEmitterEvent,ay as ParticleEmitter,CS as PORT,D80 as PLAYER_ROTATION_UPDATE_THRESHOLD,N80 as PLAYER_POSITION_UPDATE_THRESHOLD_SQ,k5 as ModelRegistry,j5 as Matrix4,KZ as Matrix3,fQ as Matrix2,l$1 as LightType,WF as LightManager,py as LightEvent,iy as Light,F6 as IterationMap,a$1 as GameServerEvent,AQ as GameServer,j0 as EventRouter,d as ErrorHandler,az as EntityManager,iz as EntityEvent,a8 as Entity,R80 as ENTITY_ROTATION_UPDATE_THRESHOLD,M80 as ENTITY_POSITION_UPDATE_THRESHOLD_SQ,g1 as DefaultPlayerEntityController,nE as DefaultPlayerEntity,j80 as DEFAULT_ENTITY_RIGID_BODY_OPTIONS,j4 as CollisionGroupsBuilder,BY as CollisionGroup,qz as ColliderShape,pz as ColliderMap,$9 as Collider,Kk as CoefficientCombineRule,pE as ChunkLatticeEvent,lz as ChunkLattice,K9 as Chunk,cz as ChatManager,cE as ChatEvent,zk as BlockTypeRegistryEvent,Fz as BlockTypeRegistry,Gk as BlockTypeEvent,Q9 as BlockType,gQ as Block,Hg as BaseEntityControllerEvent,qY as BaseEntityController,u3 as AudioManager,nR as AudioEvent,m3 as Audio};
|