@vimp-games/snakes 0.15.18 → 0.15.19

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.
@@ -5,4 +5,4 @@ import{Container as H,Graphics as P,Sprite as _e,Rectangle as le}from"pixi.js";c
5
5
  <p class="${E}-total">Total score: <span>0</span></p>
6
6
  <button type="button">OK</button>
7
7
  </div>
8
- `,this._crystals=e.querySelector(`.${E}-score span`),this._total=e.querySelector(`.${E}-total span`),e.querySelector("button").addEventListener("click",()=>this._respawn()),document.body.appendChild(e),this._root=e}onPanel(e){if(!this._root)return;const t=Fe(e);if(oe in t&&(this._lastScore=t[oe]),!(se in t))return;const n=t[se];n>0?this._show(n-1):this._hide()}reset(){this._hide(),this._lastScore=0}_show(e){this._visible||(this._visible=!0,this._crystals.textContent=String(e),this._total.textContent=String(this._lastScore),this._root.hidden=!1)}_hide(){this._visible&&(this._visible=!1,this._root.hidden=!0)}_respawn(){this._hide();for(const e of["keydown","keyup"])ze(e,Ne)}}const De="modulepreload",Ge=function(r){return"/"+r},ie={},Be=function(e,t,n){let o=Promise.resolve();if(t&&t.length>0){let _=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");o=_(t.map(l=>{if(l=Ge(l),l in ie)return;ie[l]=!0;const d=l.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":De,d||(h.as="script"),h.crossOrigin="",h.href=l,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((u,y)=>{h.addEventListener("load",u),h.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return o.then(i=>{for(const c of i||[])c.status==="rejected"&&a(c.reason);return e().catch(a)})},Ye=r=>(r??"").endsWith(".js"),$e=r=>import(r),Ue=()=>Be(()=>Promise.resolve().then(()=>Qe),[]),Y=new je,tt={id:"snakes",engineApi:ge,requires:["accolades"],async createClientCore(r,{wasmUrl:e}={}){if(Ye(e)){const a=await $e(e);return{core:new a.ClientCore(r),memory:null}}const{default:t,ClientCore:n}=await Ue(),o=await t({module_or_path:e});return{core:new n(r),memory:o.memory}},parts:Te,bakers:We,styles:we,hooks:{onAuth(r,e){r.set_model(e.model),Y.mount(),Y.reset()},onPanel(r,e){r.sync_panel(JSON.stringify(e)),Y.onPanel(e)},onLocalAction(){return null}}};class U{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ce.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_clientcore_free(e,0)}abi_describe(){let e,t;try{const n=s.clientcore_abi_describe(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}apply_aim(e,t,n,o){s.clientcore_apply_aim(this.__wbg_ptr,e,t,n,o)}apply_input(e,t,n){const o=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p,i=g(t,s.__wbindgen_malloc,s.__wbindgen_realloc),c=p;s.clientcore_apply_input(this.__wbg_ptr,o,a,i,c,n)}debug_json(){let e,t;try{const n=s.clientcore_debug_json(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}decode_frame(e){let t,n;try{const o=M(e,s.__wbindgen_malloc),a=p,i=s.clientcore_decode_frame(this.__wbg_ptr,o,a);return t=i[0],n=i[1],b(i[0],i[1])}finally{s.__wbindgen_free(t,n,1)}}dispatch(e,t){const n=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),o=p,a=M(t,s.__wbindgen_malloc),i=p,c=s.clientcore_dispatch(this.__wbg_ptr,n,o,a,i);var _=j(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}hot_ptr(){return s.clientcore_hot_ptr(this.__wbg_ptr)>>>0}hot_values(){const e=s.clientcore_hot_values(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}my_game_id(){return s.clientcore_my_game_id(this.__wbg_ptr)}constructor(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.clientcore_new(t,n);if(o[2])throw x(o[1]);return this.__wbg_ptr=o[0],ce.register(this,this.__wbg_ptr,this),this}offset(){return s.clientcore_offset(this.__wbg_ptr)}push_frame(e,t){const n=M(e,s.__wbindgen_malloc),o=p;return s.clientcore_push_frame(this.__wbg_ptr,n,o,t)!==0}reset(){s.clientcore_reset(this.__wbg_ptr)}resync(){s.clientcore_resync(this.__wbg_ptr)}sample(e){return s.clientcore_sample(this.__wbg_ptr,e)>>>0}set_active(e){s.clientcore_set_active(this.__wbg_ptr,e)}set_map(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.clientcore_set_map(this.__wbg_ptr,t,n);if(o[1])throw x(o[0])}set_model(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p;s.clientcore_set_model(this.__wbg_ptr,t,n)}sync_panel(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p;s.clientcore_sync_panel(this.__wbg_ptr,t,n)}take_divergence(){let e,t;try{const n=s.clientcore_take_divergence(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}take_frames(){let e,t;try{const n=s.clientcore_take_frames(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);class q{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ae.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_gamecore_free(e,0)}abi_describe(){let e,t;try{const n=s.gamecore_abi_describe(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}alive_players(){const e=s.gamecore_alive_players(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}apply_aim(e,t,n,o,a){s.gamecore_apply_aim(this.__wbg_ptr,e,t,n,o,a)}apply_input(e,t,n,o){const a=g(n,s.__wbindgen_malloc,s.__wbindgen_realloc),i=p,c=g(o,s.__wbindgen_malloc,s.__wbindgen_realloc),_=p;s.gamecore_apply_input(this.__wbg_ptr,e,t,a,i,c,_)}body_has_events(){return s.gamecore_body_has_events(this.__wbg_ptr)!==0}clear(){s.gamecore_clear(this.__wbg_ptr)}debug_json(){let e,t;try{const n=s.gamecore_debug_json(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}deserialize_state(e){const t=M(e,s.__wbindgen_malloc),n=p,o=s.gamecore_deserialize_state(this.__wbg_ptr,t,n);if(o[1])throw x(o[0])}dispatch(e,t){const n=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),o=p,a=M(t,s.__wbindgen_malloc),i=p,c=s.gamecore_dispatch(this.__wbg_ptr,n,o,a,i);var _=j(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}frame_bytes(){const e=s.gamecore_frame_bytes(this.__wbg_ptr);var t=j(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}frame_ptr(){return s.gamecore_frame_ptr(this.__wbg_ptr)>>>0}is_alive(e){return s.gamecore_is_alive(this.__wbg_ptr,e)!==0}last_input_seq(e){return s.gamecore_last_input_seq(this.__wbg_ptr,e)>>>0}load_map(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.gamecore_load_map(this.__wbg_ptr,t,n);if(o[1])throw x(o[0])}map_info(){let e,t;try{const n=s.gamecore_map_info(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}constructor(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.gamecore_new(t,n);if(o[2])throw x(o[1]);return this.__wbg_ptr=o[0],ae.register(this,this.__wbg_ptr,this),this}pack_body(){const e=s.gamecore_pack_body(this.__wbg_ptr);if(e[1])throw x(e[0])}pack_frame(e,t,n,o,a,i,c,_){var l=Ke(c)?0:g(c,s.__wbindgen_malloc,s.__wbindgen_realloc),d=p;return s.gamecore_pack_frame(this.__wbg_ptr,e,t,n,o,a,i,l,d,_)>>>0}players_data(){let e,t;try{const n=s.gamecore_players_data(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}position_of(e){const t=s.gamecore_position_of(this.__wbg_ptr,e);var n=K(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*4,4),n}remove_actor(e){s.gamecore_remove_actor(this.__wbg_ptr,e)}remove_players_and_shots(){let e,t;try{const n=s.gamecore_remove_players_and_shots(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}remove_scripted_actor(e){s.gamecore_remove_scripted_actor(this.__wbg_ptr,e)}reset_actor(e,t,n,o,a){s.gamecore_reset_actor(this.__wbg_ptr,e,t,n,o,a)}reset_all_vitals(){s.gamecore_reset_all_vitals(this.__wbg_ptr)}serialize_state(){const e=s.gamecore_serialize_state(this.__wbg_ptr);if(e[3])throw x(e[2]);var t=j(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}set_actor_level(e,t){s.gamecore_set_actor_level(this.__wbg_ptr,e,t)}spawn_actor(e,t,n,o,a,i){const c=g(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=p,l=s.gamecore_spawn_actor(this.__wbg_ptr,e,c,_,n,o,a,i);if(l[1])throw x(l[0])}spawn_scripted_actor(e,t,n,o,a,i){const c=g(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=p,l=s.gamecore_spawn_scripted_actor(this.__wbg_ptr,e,c,_,n,o,a,i);if(l[1])throw x(l[0])}step(e){s.gamecore_step(this.__wbg_ptr,e)}take_events(){let e,t;try{const n=s.gamecore_take_events(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(q.prototype[Symbol.dispose]=q.prototype.free);function fe(){return{__proto__:null,"./vimp_snakes_core_bg.js":{__proto__:null,__wbg_Error_408e67f47ca7b58b:function(e,t){return Error(b(e,t))},__wbg___wbindgen_throw_bb96b2010945f0bc:function(e,t){throw new Error(b(e,t))},__wbindgen_init_externref_table:function(){const e=s.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const ce=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>s.__wbg_clientcore_free(r,1)),ae=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>s.__wbg_gamecore_free(r,1));function K(r,e){return r=r>>>0,qe().subarray(r/4,r/4+e)}function j(r,e){return r=r>>>0,S().subarray(r/1,r/1+e)}let O=null;function qe(){return(O===null||O.byteLength===0)&&(O=new Float32Array(s.memory.buffer)),O}function b(r,e){return Ve(r>>>0,e)}let R=null;function S(){return(R===null||R.byteLength===0)&&(R=new Uint8Array(s.memory.buffer)),R}function Ke(r){return r==null}function M(r,e){const t=e(r.length*1,1)>>>0;return S().set(r,t/1),p=r.length,t}function g(r,e,t){if(t===void 0){const c=T.encode(r),_=e(c.length,1)>>>0;return S().subarray(_,_+c.length).set(c),p=c.length,_}let n=r.length,o=e(n,1)>>>0;const a=S();let i=0;for(;i<n;i++){const c=r.charCodeAt(i);if(c>127)break;a[o+i]=c}if(i!==n){i!==0&&(r=r.slice(i)),o=t(o,n,n=i+r.length*3,1)>>>0;const c=S().subarray(o+i,o+n),_=T.encodeInto(r,c);i+=_.written,o=t(o,n,i,1)>>>0}return p=i,o}function x(r){const e=s.__wbindgen_externrefs.get(r);return s.__externref_table_dealloc(r),e}let D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});D.decode();const He=2146435072;let $=0;function Ve(r,e){return $+=e,$>=He&&(D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),D.decode(),$=e),D.decode(S().subarray(r,r+e))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(r,e){const t=T.encode(r);return e.set(t),{read:r.length,written:t.length}});let p=0,s;function he(r,e){return s=r.exports,O=null,R=null,s.__wbindgen_start(),s}async function Xe(r,e){if(typeof Response=="function"&&r instanceof Response){if(!r.ok)throw new Error(`failed to fetch Wasm: ${r.status} ${r.statusText} fetching '${r.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(o){if(t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function Ze(r){if(s!==void 0)return s;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=fe();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return he(t)}async function Je(r){if(s!==void 0)return s;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),r===void 0&&(r=new URL("/assets/vimp_snakes_core_bg-B3FAa7tV.wasm",import.meta.url));const e=fe();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t,module:n}=await Xe(await r,e);return he(t)}const Qe=Object.freeze(Object.defineProperty({__proto__:null,ClientCore:U,GameCore:q,default:Je,initSync:Ze},Symbol.toStringTag,{value:"Module"}));export{tt as default};
8
+ `,this._crystals=e.querySelector(`.${E}-score span`),this._total=e.querySelector(`.${E}-total span`),e.querySelector("button").addEventListener("click",()=>this._respawn()),document.body.appendChild(e),this._root=e}onPanel(e){if(!this._root)return;const t=Fe(e);if(oe in t&&(this._lastScore=t[oe]),!(se in t))return;const n=t[se];n>0?this._show(n-1):this._hide()}reset(){this._hide(),this._lastScore=0}_show(e){this._visible||(this._visible=!0,this._crystals.textContent=String(e),this._total.textContent=String(this._lastScore),this._root.hidden=!1)}_hide(){this._visible&&(this._visible=!1,this._root.hidden=!0)}_respawn(){this._hide();for(const e of["keydown","keyup"])ze(e,Ne)}}const De="modulepreload",Ge=function(r){return"/"+r},ie={},Be=function(e,t,n){let o=Promise.resolve();if(t&&t.length>0){let _=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");o=_(t.map(l=>{if(l=Ge(l),l in ie)return;ie[l]=!0;const d=l.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":De,d||(h.as="script"),h.crossOrigin="",h.href=l,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((u,y)=>{h.addEventListener("load",u),h.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return o.then(i=>{for(const c of i||[])c.status==="rejected"&&a(c.reason);return e().catch(a)})},Ye=r=>(r??"").endsWith(".js"),$e=r=>import(r),Ue=()=>Be(()=>Promise.resolve().then(()=>Qe),[]),Y=new je,tt={id:"snakes",engineApi:ge,requires:["accolades","chat.engineNamespace"],async createClientCore(r,{wasmUrl:e}={}){if(Ye(e)){const a=await $e(e);return{core:new a.ClientCore(r),memory:null}}const{default:t,ClientCore:n}=await Ue(),o=await t({module_or_path:e});return{core:new n(r),memory:o.memory}},parts:Te,bakers:We,styles:we,hooks:{onAuth(r,e){r.set_model(e.model),Y.mount(),Y.reset()},onPanel(r,e){r.sync_panel(JSON.stringify(e)),Y.onPanel(e)},onLocalAction(){return null}}};class U{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ce.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_clientcore_free(e,0)}abi_describe(){let e,t;try{const n=s.clientcore_abi_describe(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}apply_aim(e,t,n,o){s.clientcore_apply_aim(this.__wbg_ptr,e,t,n,o)}apply_input(e,t,n){const o=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p,i=g(t,s.__wbindgen_malloc,s.__wbindgen_realloc),c=p;s.clientcore_apply_input(this.__wbg_ptr,o,a,i,c,n)}debug_json(){let e,t;try{const n=s.clientcore_debug_json(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}decode_frame(e){let t,n;try{const o=M(e,s.__wbindgen_malloc),a=p,i=s.clientcore_decode_frame(this.__wbg_ptr,o,a);return t=i[0],n=i[1],b(i[0],i[1])}finally{s.__wbindgen_free(t,n,1)}}dispatch(e,t){const n=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),o=p,a=M(t,s.__wbindgen_malloc),i=p,c=s.clientcore_dispatch(this.__wbg_ptr,n,o,a,i);var _=j(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}hot_ptr(){return s.clientcore_hot_ptr(this.__wbg_ptr)>>>0}hot_values(){const e=s.clientcore_hot_values(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}my_game_id(){return s.clientcore_my_game_id(this.__wbg_ptr)}constructor(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.clientcore_new(t,n);if(o[2])throw x(o[1]);return this.__wbg_ptr=o[0],ce.register(this,this.__wbg_ptr,this),this}offset(){return s.clientcore_offset(this.__wbg_ptr)}push_frame(e,t){const n=M(e,s.__wbindgen_malloc),o=p;return s.clientcore_push_frame(this.__wbg_ptr,n,o,t)!==0}reset(){s.clientcore_reset(this.__wbg_ptr)}resync(){s.clientcore_resync(this.__wbg_ptr)}sample(e){return s.clientcore_sample(this.__wbg_ptr,e)>>>0}set_active(e){s.clientcore_set_active(this.__wbg_ptr,e)}set_map(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.clientcore_set_map(this.__wbg_ptr,t,n);if(o[1])throw x(o[0])}set_model(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p;s.clientcore_set_model(this.__wbg_ptr,t,n)}sync_panel(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p;s.clientcore_sync_panel(this.__wbg_ptr,t,n)}take_divergence(){let e,t;try{const n=s.clientcore_take_divergence(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}take_frames(){let e,t;try{const n=s.clientcore_take_frames(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);class q{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ae.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_gamecore_free(e,0)}abi_describe(){let e,t;try{const n=s.gamecore_abi_describe(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}alive_players(){const e=s.gamecore_alive_players(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}apply_aim(e,t,n,o,a){s.gamecore_apply_aim(this.__wbg_ptr,e,t,n,o,a)}apply_input(e,t,n,o){const a=g(n,s.__wbindgen_malloc,s.__wbindgen_realloc),i=p,c=g(o,s.__wbindgen_malloc,s.__wbindgen_realloc),_=p;s.gamecore_apply_input(this.__wbg_ptr,e,t,a,i,c,_)}body_has_events(){return s.gamecore_body_has_events(this.__wbg_ptr)!==0}clear(){s.gamecore_clear(this.__wbg_ptr)}debug_json(){let e,t;try{const n=s.gamecore_debug_json(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}deserialize_state(e){const t=M(e,s.__wbindgen_malloc),n=p,o=s.gamecore_deserialize_state(this.__wbg_ptr,t,n);if(o[1])throw x(o[0])}dispatch(e,t){const n=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),o=p,a=M(t,s.__wbindgen_malloc),i=p,c=s.gamecore_dispatch(this.__wbg_ptr,n,o,a,i);var _=j(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}frame_bytes(){const e=s.gamecore_frame_bytes(this.__wbg_ptr);var t=j(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}frame_ptr(){return s.gamecore_frame_ptr(this.__wbg_ptr)>>>0}is_alive(e){return s.gamecore_is_alive(this.__wbg_ptr,e)!==0}last_input_seq(e){return s.gamecore_last_input_seq(this.__wbg_ptr,e)>>>0}load_map(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.gamecore_load_map(this.__wbg_ptr,t,n);if(o[1])throw x(o[0])}map_info(){let e,t;try{const n=s.gamecore_map_info(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}constructor(e){const t=g(e,s.__wbindgen_malloc,s.__wbindgen_realloc),n=p,o=s.gamecore_new(t,n);if(o[2])throw x(o[1]);return this.__wbg_ptr=o[0],ae.register(this,this.__wbg_ptr,this),this}pack_body(){const e=s.gamecore_pack_body(this.__wbg_ptr);if(e[1])throw x(e[0])}pack_frame(e,t,n,o,a,i,c,_){var l=Ke(c)?0:g(c,s.__wbindgen_malloc,s.__wbindgen_realloc),d=p;return s.gamecore_pack_frame(this.__wbg_ptr,e,t,n,o,a,i,l,d,_)>>>0}players_data(){let e,t;try{const n=s.gamecore_players_data(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}position_of(e){const t=s.gamecore_position_of(this.__wbg_ptr,e);var n=K(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*4,4),n}remove_actor(e){s.gamecore_remove_actor(this.__wbg_ptr,e)}remove_players_and_shots(){let e,t;try{const n=s.gamecore_remove_players_and_shots(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}remove_scripted_actor(e){s.gamecore_remove_scripted_actor(this.__wbg_ptr,e)}reset_actor(e,t,n,o,a){s.gamecore_reset_actor(this.__wbg_ptr,e,t,n,o,a)}reset_all_vitals(){s.gamecore_reset_all_vitals(this.__wbg_ptr)}serialize_state(){const e=s.gamecore_serialize_state(this.__wbg_ptr);if(e[3])throw x(e[2]);var t=j(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}set_actor_level(e,t){s.gamecore_set_actor_level(this.__wbg_ptr,e,t)}spawn_actor(e,t,n,o,a,i){const c=g(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=p,l=s.gamecore_spawn_actor(this.__wbg_ptr,e,c,_,n,o,a,i);if(l[1])throw x(l[0])}spawn_scripted_actor(e,t,n,o,a,i){const c=g(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=p,l=s.gamecore_spawn_scripted_actor(this.__wbg_ptr,e,c,_,n,o,a,i);if(l[1])throw x(l[0])}step(e){s.gamecore_step(this.__wbg_ptr,e)}take_events(){let e,t;try{const n=s.gamecore_take_events(this.__wbg_ptr);return e=n[0],t=n[1],b(n[0],n[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(q.prototype[Symbol.dispose]=q.prototype.free);function fe(){return{__proto__:null,"./vimp_snakes_core_bg.js":{__proto__:null,__wbg_Error_408e67f47ca7b58b:function(e,t){return Error(b(e,t))},__wbg___wbindgen_throw_bb96b2010945f0bc:function(e,t){throw new Error(b(e,t))},__wbindgen_init_externref_table:function(){const e=s.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const ce=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>s.__wbg_clientcore_free(r,1)),ae=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>s.__wbg_gamecore_free(r,1));function K(r,e){return r=r>>>0,qe().subarray(r/4,r/4+e)}function j(r,e){return r=r>>>0,S().subarray(r/1,r/1+e)}let O=null;function qe(){return(O===null||O.byteLength===0)&&(O=new Float32Array(s.memory.buffer)),O}function b(r,e){return Ve(r>>>0,e)}let R=null;function S(){return(R===null||R.byteLength===0)&&(R=new Uint8Array(s.memory.buffer)),R}function Ke(r){return r==null}function M(r,e){const t=e(r.length*1,1)>>>0;return S().set(r,t/1),p=r.length,t}function g(r,e,t){if(t===void 0){const c=T.encode(r),_=e(c.length,1)>>>0;return S().subarray(_,_+c.length).set(c),p=c.length,_}let n=r.length,o=e(n,1)>>>0;const a=S();let i=0;for(;i<n;i++){const c=r.charCodeAt(i);if(c>127)break;a[o+i]=c}if(i!==n){i!==0&&(r=r.slice(i)),o=t(o,n,n=i+r.length*3,1)>>>0;const c=S().subarray(o+i,o+n),_=T.encodeInto(r,c);i+=_.written,o=t(o,n,i,1)>>>0}return p=i,o}function x(r){const e=s.__wbindgen_externrefs.get(r);return s.__externref_table_dealloc(r),e}let D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});D.decode();const He=2146435072;let $=0;function Ve(r,e){return $+=e,$>=He&&(D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),D.decode(),$=e),D.decode(S().subarray(r,r+e))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(r,e){const t=T.encode(r);return e.set(t),{read:r.length,written:t.length}});let p=0,s;function he(r,e){return s=r.exports,O=null,R=null,s.__wbindgen_start(),s}async function Xe(r,e){if(typeof Response=="function"&&r instanceof Response){if(!r.ok)throw new Error(`failed to fetch Wasm: ${r.status} ${r.statusText} fetching '${r.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(o){if(t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function Ze(r){if(s!==void 0)return s;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=fe();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return he(t)}async function Je(r){if(s!==void 0)return s;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),r===void 0&&(r=new URL("/assets/vimp_snakes_core_bg-B3FAa7tV.wasm",import.meta.url));const e=fe();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t,module:n}=await Xe(await r,e);return he(t)}const Qe=Object.freeze(Object.defineProperty({__proto__:null,ClientCore:U,GameCore:q,default:Je,initSync:Ze},Symbol.toStringTag,{value:"Module"}));export{tt as default};
@@ -0,0 +1 @@
1
+ const X=Array.from({length:16},(n,e)=>[{name:`p${e}x`,ty:"f32",interp:"lerp"},{name:`p${e}y`,ty:"f32",interp:"lerp"}]).flat(),Z={s1:{id:1,kind:"indexed8",class:"hot",fields:[...X,{name:"angle",ty:"f32",interp:"lerpAngle"},{name:"radius",ty:"f32",interp:"lerp"},{name:"crystals",ty:"u16"},{name:"color",ty:"u8"},{name:"boost",ty:"u8"}]},cr:{id:2,kind:"indexed32",class:"event",fields:[{name:"x",ty:"f32"},{name:"y",ty:"f32"},{name:"tier",ty:"u8"},{name:"color",ty:"u8"}]},c1:{id:3,kind:"indexedNoNull8",class:"hot",fields:[{name:"x",ty:"f32",interp:"lerp"},{name:"y",ty:"f32",interp:"lerp"},{name:"angle",ty:"f32",interp:"lerpAngle"}]}},I=[16731469,16752412,16765503,10214972,3065014,3848191,5531903,11623679,16735432,16250871,8250065,16753828],Q=n=>`#${I[n%I.length].toString(16).padStart(6,"0")}`,J=[{value:1,radius:8},{value:3,radius:13},{value:8,radius:20}],E={s1:{baseSpeed:260,boostFactor:1.9,turnSpeed:3.4,turnSpeedFalloff:.18,turnSpeedMin:1.4,baseRadius:14,radiusGain:1.6,baseLength:150,lengthPerCrystal:9,pointSpacing:6,boostDrainPerSecond:6,boostMinCrystals:2,world:{maxCrystals:60,spawnInterval:.35,tierWeights:[70,25,5],tiers:J,dropRatio:.8,edgeMargin:60,startCrystals:0,spawnGraceSeconds:2}}},L=128,D=1,ee=20,O=8,N=4,A=64,te=Math.PI*(3-Math.sqrt(5)),re=.72,ne=25;function P(n){const e=Math.ceil(Math.max(n,0)/N)*N,t=Math.max(e,O);return Math.round(ee*Math.sqrt(t/O))}const W=Math.log2(A);if(!Number.isInteger(W))throw new Error(`RESPAWN_COUNT must be a power of two (the order is bit-reversed), got ${A}`);function se(n){let e=0;for(let t=0;t<W;t+=1)e=e<<1|n>>t&1;return e}function ae(n){const e=n*L/2,t=e;return Array.from({length:A},(r,a)=>{const o=se(a),i=e*re*Math.sqrt((o+.5)/A),c=o*te,_=t+Math.cos(c)*i,l=t+Math.sin(c)*i,h=(a*.6180339887%1*2-1)*ne,m=c*180/Math.PI+180+h;return[Math.round(_),Math.round(l),Math.round((m%360+360)%360)]})}function U(n=0){const e=P(n);return{setId:"c1",scale:1,step:L,physicsStatic:[],physicsDynamic:[],layers:{1:[D]},map:Array.from({length:e},()=>Array.from({length:e},()=>D)),respawns:{players:ae(e)}}}const oe=U(0),ie={arena:oe},ce={title:"Snakes",parts:{models:E,weapons:{},friendlyFire:!1},snapshot:Z,soundCues:{roundStart:null,victory:null,defeat:null,frag:null,death:null},maps:ie,currentMap:"arena",mapScale:1,mapSetId:"c1",mapsInVote:1,timers:{timeStep:1e3/120,networkSendRate:4,roundTime:36e5,mapTime:36e5,roomTimeMin:1e4,roomTimeMax:36e5,voteTime:1e4,timeBlockedVote:3e4,teamChangeGracePeriod:1e4,roundRestartDelay:5e3,mapChangeDelay:2e3,rttPingInterval:3e3,idleCheckInterval:3e4},playerState:{defaultState:{best:0,eaten:0}},noSpectators:!0,endlessRound:!0,statMode:"leaderboard",teams:{players:1},scripted:{namePrefix:"Snake",defaultModel:"s1"},playerKeys:{left:{key:1},right:{key:2},boost:{key:4},respawn:{key:8,type:1}},panel:{fields:{crystals:{key:"c",value:0},score:{key:"s",value:0},dead:{key:"d",value:0}},activeKey:"wa"},stat:{name:{key:0,bodyMethod:"=",headSync:!0,headMethod:"#"},status:{key:1,bodyMethod:"=",bodyValue:"",headValue:""},score:{key:2,bodyMethod:"=",bodyValue:0,headMethod:"+",headValue:0},latency:{key:3,bodyMethod:"="}},roomDefaults:{maxPlayers:32},roomForm:[{name:"maxPlayers",control:"text",label:"Max players",numeric:!0},{name:"map",control:"select",label:"Map",source:"maps"}]},_e={elems:{authId:"auth",fieldsId:"auth-fields",errorId:"auth-error",enterId:"auth-enter",titleId:"auth-title",informsId:"auth-informs"},texts:{title:"Snakes",sections:[{heading:"How to play",lines:[{keys:"a, d",text:"turn"},{keys:"w",text:"boost (burns crystals)"},{keys:"r",text:"respawn after a crash"},{separator:!0},{keys:"",text:"eat crystals to grow"},{keys:"",text:"the edge and other snakes kill you"},{keys:"",text:"your own tail does not"},{separator:!0},{keys:"c",text:"chat"},{keys:"<Tab>",text:"stats",last:!0}]}]},params:[{name:"model",value:"s1",options:{control:"select",label:"Snake",options:Object.keys(E),validator:"isValidModel",storage:"model"}}],validators:{isValidModel:n=>n in E}},le={pickup:{file:"shot",priority:80,volume:.35},death:{file:"death",priority:150,volume:.5}},de={codecList:["webm","mp3"],spatial:{mode:"topDown",innerRadius:14},sounds:le},pe={parts:{gameSets:{s1:["Snake"],cr:["Crystal"],c1:["Arena"]},entitiesOnCanvas:{Arena:"vimp",Snake:"vimp",Crystal:"vimp"},bakedAssets:{vimp:[{name:"crystalGem",component:"Crystal",params:{radius:32,facets:6}},{name:"crown",component:"Snake",params:{size:64,points:3}}]},componentDependencies:{soundManager:["Snake"],localPlayer:["Snake"],accolades:["Snake"]},sounds:de},initIdList:["vimp","panel","chat"],modules:{canvasManager:{canvases:{vimp:{width:960,height:600,aspectRatio:"16:10",baseScale:"1:1",dynamicCamera:!0,shakeCamera:!1}}},controls:{modes:{77:""},keySetList:[{78:"nextPlayer",80:"prevPlayer"},{65:"left",68:"right",87:"boost",82:"respawn"}],pointer:{keySets:[1],doubleTapMs:300,doubleTapPx:40,sendIntervalMs:50}},chat:{params:{messages:{_s:["The arena is full. You will join as soon as a place frees up","You are already in the arena","You are in the arena","You are watching the arena","{0} crashed into {1}","{0} joined the game","{0} left the game","Host changed","You are no longer the host (connection lost)","Host changed: the previous host was lagging","Host changed: the previous host went inactive","Host changed: the previous host had a poor connection"],_v:["A vote has been created","Voting has started","Your vote has been accepted","Vote passed","Vote failed","Usage: /changehost","You are the host — the room hands the host role over automatically when needed","No connection to the master server","A host vote was held recently","No other player can host","A host vote is already in progress","A host vote is not possible right now","Vote to change host passed ({0}/{1})","Vote to change host failed ({0}/{1})","Host vote cancelled"],_m:["Current map: {0}","Next map: {0}"],_c:["Command not found","Your place today: {0} of {1} ({2} points)"],g:["Bot snakes in the arena: {0}","Invalid bot count"]}}},panel:{keys:{s:"score",c:"crystals",d:"dead",wa:"mode",t:"time"},fields:[{name:"score",elem:"panel-score",type:"value"},{name:"crystals",elem:"panel-crystals",type:"value"},{name:"dead",elem:"panel-dead",type:"value"},{name:"mode",elem:"panel-mode",type:"weapon"},{name:"time",elem:"panel-time",type:"time"}]},stat:{params:{mode:"leaderboard",period:"day",limit:10,columns:["#","snake","score"]}}},gameInform:{list:["{0} WINS!","SLITHER!","GAME OVER!"]}};class ue{constructor({participants:e,coreAdapter:t,socketManager:r},a){this._participants=e,this._coreAdapter=t,this._socketManager=r,this._scriptedManager=a,this._vimp=null,this._population=null,this._size=null,this._mapData=null,this._delivered=new Map}onCoreEvent(e,t={}){t.vimp&&(this._vimp=t.vimp),!(!e||e.type!=="population")&&this._apply(Number(e.count)||0)}_apply(e){const t=this._sizeFor(e);if(t!==this._size){this._size=t,this._population=e;const r=U(e);this._coreAdapter.createMap(r),this._scriptedManager?.createMap(r),this._vimp?.overrideMapData?.(r),this._mapData=r,this._delivered.clear()}this._broadcast()}_sizeFor(e){if(this._size===null)return P(e);const t=P(e);return t>this._size||e<=this._population-N?t:this._size}_broadcast(){if(!this._mapData)return;const e=this._participants.getHumans(),t=new Set;for(const r of e)t.add(r.socketId),!(!r.isReady||this._delivered.get(r.socketId)===this._size)&&(this._delivered.set(r.socketId,this._size),this._socketManager.sendMap(r.socketId,this._mapData));for(const r of this._delivered.keys())t.has(r)||this._delivered.delete(r)}reapply(){this._mapData&&(this._vimp?.overrideMapData?.(this._mapData),this._coreAdapter.createMap(this._mapData),this._scriptedManager?.createMap(this._mapData),this._broadcast())}get mapData(){return this._mapData??null}}class he{constructor({participants:e}){this._participants=e}onCoreEvent(e){if(!e||e.type!=="spawn")return;const t=Number(e.color);!Number.isFinite(t)||t<0||this._participants?.setChatColor?.(String(e.id),Q(t))}}class fe{constructor({participants:e,coreAdapter:t,panel:r,stat:a,scripted:o}){this._participants=e,this._coreAdapter=t,this._panel=r,this._stat=a,this._model=o.defaultModel,this._respawns=null}createMap(e){this._respawns=e.respawns}getCountsPerTeam(){const e={};for(const t of this._participants.getScripted())e[t.team]=(e[t.team]??0)+1;return e}createScripted(e,t=null){if(!this._respawns)return 0;const r=this._participants.getPlayableTeams();let a=0;for(let o=0;o<e&&!this._participants.isFull;o+=1){const i=t??this._pickTeam(r);if(!i||!this._hasRoom(i))break;const c=this._participants.createScripted({team:i,model:this._model}),_=this._participants.get(c);this._stat.addUser(c,_.teamId,{name:_.name,status:"",latency:"BOT"}),this._panel.addUser(c),a+=1}return a}_hasRoom(e){const t=this._respawns[e];return!!(t&&this._participants.getTeamSize(e)<t.length)}_pickTeam(e){return[...e].sort((t,r)=>this._participants.getTeamSize(t)-this._participants.getTeamSize(r)).find(t=>this._hasRoom(t))??null}removeScripted(e=null){const t=this._participants.getScripted();(e?t.filter(a=>a.team===e):t).forEach(a=>this._remove(a.gameId))}removeOneForHuman(e){for(const t of this._participants.getScripted())if(t.team===e)return this._remove(t.gameId),!0;return!1}_remove(e){const t=this._participants.get(e);!t||!t.isScripted||(this._stat.removeUser(e,t.teamId),this._panel.removeUser(e),this._coreAdapter.removePlayer(e),this._participants.remove(e))}}const me=15;class ge{constructor({participants:e,stat:t}){this._participants=e,this._stat=t,this._totals=new Map}onCoreEvent(e,t={}){if(!e||typeof e!="object")return;const{vimp:r,panel:a}=t,o=String(e.id);switch(e.type){case"crystals":this._onCrystals(o,Number(e.gained)||0,r,a);break;case"burn":this._onBurn(o,Number(e.burned)||0,r,a);break;case"death":this._onDeath(o,e,r,a);break;case"respawn":this._onRespawn(o,r,a);break;case"population":this._publishNewcomers(r,a),r?.flushPlayerData?.();break}}reset(e){this._totals.delete(e)}_onCrystals(e,t,r,a){const o=this._record(e);!o||t<=0||(o.eaten+=t,o.score+=t,this._publish(e,o,r,a))}_onBurn(e,t,r,a){const o=this._record(e);!o||t<=0||(o.score=Math.max(0,o.score-t),this._publish(e,o,r,a))}_onDeath(e,t,r,a){const o=this._record(e);if(!o)return;const i=t.killer===null||t.killer===void 0?null:String(t.killer);if(i!==null&&i!==e){const l=this._record(i);l&&(l.kills+=1,l.score+=me,this._publish(i,l,r,a))}this._publish(e,o,r,a);const _=r?.isPlayerRatingLoaded?.(e,"day")===!0?r.getPlayerRating?.(e,"day")?.value??0:1/0;r?.addPlayerPoints?.(e,o.score),r?.finishPlayerGame?.(e),this._recordBest(e,o,r),r?.flushPlayerData?.({urgent:o.score>_})}_onRespawn(e,t,r){const a=this._record(e);a&&(a.eaten=0,a.kills=0,a.score=0,a.flushedEaten=0,this._publish(e,a,t,r))}_record(e){const t=this._participants.get(e);if(!t)return null;const r=this._totals.get(e);if(r&&r.participant===t)return r;const a={participant:t,eaten:0,kills:0,score:0,flushedEaten:0,published:!1};return this._totals.set(e,a),a}_publishNewcomers(e,t){for(const r of this._participants.getAll()){const a=r.gameId,o=this._totals.get(a),i=o?.participant===r?o:this._record(a);i&&!i.published&&this._publish(a,i,e,t)}}_publish(e,t,r,a){const{score:o}=t;t.published=!0,this._stat.updateUser(e,t.participant.teamId,{score:o}),a&&a.updateUser(e,"score",o,"set")}_recordBest(e,t,r){if(!r?.getPlayerState)return;const a=r.getPlayerState(e);if(!a)return;const o=t.eaten-t.flushedEaten;t.flushedEaten=t.eaten;const i=Math.max(Number(a.best)||0,t.score),c=(Number(a.eaten)||0)+o;r.setPlayerState(e,{...a,best:i,eaten:c})}}let V=null,j=null,G=null;function be(n){const e=new fe(n);return V=new ge(n),j=new ue(n,e),G=new he(n),{scripted:e}}function ye(){return V}function Y(){return j}function we(){return G}const ve={name:"/bot",handler(n,e,t){const r=Number(t[0]);if(t[0]===void 0||!Number.isFinite(r)||r<0){n.chat.pushSystemByUser(e,"BOT_COUNT_INVALID");return}const{maxPlayers:a}=n.participants,o=Math.trunc(r),i=a>0?Math.min(o,a):o;n.scripted.removeScripted();const c=i>0?n.scripted.createScripted(i):0;n.chat.pushSystem("BOTS_SET",[c]),c>0&&(n.roundManager.initiateNewRound(),Y()?.reapply())}},Se={name:"/nr",handler(n,e){n.isDevMode?n.roundManager.initiateNewRound():n.chat.pushSystemByUser(e,"_COMMANDS_NOT_FOUND")}},ke={name:"/rank",async handler(n,e){let t=null;try{t=await n.playerDataSync?.refreshPlacement?.(e,"day")}catch{t=n.playerDataSync?.getRating?.(e,"day")??null}const{value:r=0,placement:a=null,total:o=0}=t??{};n.chat.pushSystemByUser(e,"_RANK",[a??"—",o,r])}},Me={BOTS_SET:"g:0",BOT_COUNT_INVALID:"g:1"},Ae="modulepreload",Ce=function(n){return"/"+n},F={},Ee=function(e,t,r){let a=Promise.resolve();if(t&&t.length>0){let _=function(l){return Promise.all(l.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");a=_(t.map(l=>{if(l=Ce(l),l in F)return;F[l]=!0;const h=l.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":Ae,h||(g.as="script"),g.crossOrigin="",g.href=l,c&&g.setAttribute("nonce",c),document.head.appendChild(g),h)return new Promise((H,K)=>{g.addEventListener("load",H),g.addEventListener("error",()=>K(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&o(c.reason);return e().catch(o)})},Ne=n=>(n??"").endsWith(".js"),Pe=n=>import(n),Re=()=>Ee(()=>Promise.resolve().then(()=>ze),[]),Le={id:"snakes",engineApi:4,requires:["accolades","chat.engineNamespace"],async createCore(n,{wasmUrl:e}={}){if(Ne(e)){const a=await Pe(e);return new a.GameCore(n)}const{default:t,GameCore:r}=await Re();return await t({module_or_path:e}),new r(n)},gameConfig:ce,authSchema:_e,chatCommands:[ve,Se,ke],systemMessages:Me,createModules:be,buildClientGameConfig:()=>pe,onCoreEvent(n,e={}){ye()?.onCoreEvent(n,e),Y()?.onCoreEvent(n,e),we()?.onCoreEvent(n)}};class R{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,B.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_clientcore_free(e,0)}abi_describe(){let e,t;try{const r=s.clientcore_abi_describe(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}apply_aim(e,t,r,a){s.clientcore_apply_aim(this.__wbg_ptr,e,t,r,a)}apply_input(e,t,r){const a=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),o=d,i=p(t,s.__wbindgen_malloc,s.__wbindgen_realloc),c=d;s.clientcore_apply_input(this.__wbg_ptr,a,o,i,c,r)}debug_json(){let e,t;try{const r=s.clientcore_debug_json(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}decode_frame(e){let t,r;try{const a=v(e,s.__wbindgen_malloc),o=d,i=s.clientcore_decode_frame(this.__wbg_ptr,a,o);return t=i[0],r=i[1],u(i[0],i[1])}finally{s.__wbindgen_free(t,r,1)}}dispatch(e,t){const r=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=d,o=v(t,s.__wbindgen_malloc),i=d,c=s.clientcore_dispatch(this.__wbg_ptr,r,a,o,i);var _=k(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}hot_ptr(){return s.clientcore_hot_ptr(this.__wbg_ptr)>>>0}hot_values(){const e=s.clientcore_hot_values(this.__wbg_ptr);var t=x(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}my_game_id(){return s.clientcore_my_game_id(this.__wbg_ptr)}constructor(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.clientcore_new(t,r);if(a[2])throw f(a[1]);return this.__wbg_ptr=a[0],B.register(this,this.__wbg_ptr,this),this}offset(){return s.clientcore_offset(this.__wbg_ptr)}push_frame(e,t){const r=v(e,s.__wbindgen_malloc),a=d;return s.clientcore_push_frame(this.__wbg_ptr,r,a,t)!==0}reset(){s.clientcore_reset(this.__wbg_ptr)}resync(){s.clientcore_resync(this.__wbg_ptr)}sample(e){return s.clientcore_sample(this.__wbg_ptr,e)>>>0}set_active(e){s.clientcore_set_active(this.__wbg_ptr,e)}set_map(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.clientcore_set_map(this.__wbg_ptr,t,r);if(a[1])throw f(a[0])}set_model(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d;s.clientcore_set_model(this.__wbg_ptr,t,r)}sync_panel(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d;s.clientcore_sync_panel(this.__wbg_ptr,t,r)}take_divergence(){let e,t;try{const r=s.clientcore_take_divergence(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}take_frames(){let e,t;try{const r=s.clientcore_take_frames(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(R.prototype[Symbol.dispose]=R.prototype.free);class T{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_gamecore_free(e,0)}abi_describe(){let e,t;try{const r=s.gamecore_abi_describe(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}alive_players(){const e=s.gamecore_alive_players(this.__wbg_ptr);var t=x(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}apply_aim(e,t,r,a,o){s.gamecore_apply_aim(this.__wbg_ptr,e,t,r,a,o)}apply_input(e,t,r,a){const o=p(r,s.__wbindgen_malloc,s.__wbindgen_realloc),i=d,c=p(a,s.__wbindgen_malloc,s.__wbindgen_realloc),_=d;s.gamecore_apply_input(this.__wbg_ptr,e,t,o,i,c,_)}body_has_events(){return s.gamecore_body_has_events(this.__wbg_ptr)!==0}clear(){s.gamecore_clear(this.__wbg_ptr)}debug_json(){let e,t;try{const r=s.gamecore_debug_json(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}deserialize_state(e){const t=v(e,s.__wbindgen_malloc),r=d,a=s.gamecore_deserialize_state(this.__wbg_ptr,t,r);if(a[1])throw f(a[0])}dispatch(e,t){const r=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=d,o=v(t,s.__wbindgen_malloc),i=d,c=s.gamecore_dispatch(this.__wbg_ptr,r,a,o,i);var _=k(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}frame_bytes(){const e=s.gamecore_frame_bytes(this.__wbg_ptr);var t=k(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}frame_ptr(){return s.gamecore_frame_ptr(this.__wbg_ptr)>>>0}is_alive(e){return s.gamecore_is_alive(this.__wbg_ptr,e)!==0}last_input_seq(e){return s.gamecore_last_input_seq(this.__wbg_ptr,e)>>>0}load_map(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.gamecore_load_map(this.__wbg_ptr,t,r);if(a[1])throw f(a[0])}map_info(){let e,t;try{const r=s.gamecore_map_info(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}constructor(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.gamecore_new(t,r);if(a[2])throw f(a[1]);return this.__wbg_ptr=a[0],z.register(this,this.__wbg_ptr,this),this}pack_body(){const e=s.gamecore_pack_body(this.__wbg_ptr);if(e[1])throw f(e[0])}pack_frame(e,t,r,a,o,i,c,_){var l=xe(c)?0:p(c,s.__wbindgen_malloc,s.__wbindgen_realloc),h=d;return s.gamecore_pack_frame(this.__wbg_ptr,e,t,r,a,o,i,l,h,_)>>>0}players_data(){let e,t;try{const r=s.gamecore_players_data(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}position_of(e){const t=s.gamecore_position_of(this.__wbg_ptr,e);var r=x(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*4,4),r}remove_actor(e){s.gamecore_remove_actor(this.__wbg_ptr,e)}remove_players_and_shots(){let e,t;try{const r=s.gamecore_remove_players_and_shots(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}remove_scripted_actor(e){s.gamecore_remove_scripted_actor(this.__wbg_ptr,e)}reset_actor(e,t,r,a,o){s.gamecore_reset_actor(this.__wbg_ptr,e,t,r,a,o)}reset_all_vitals(){s.gamecore_reset_all_vitals(this.__wbg_ptr)}serialize_state(){const e=s.gamecore_serialize_state(this.__wbg_ptr);if(e[3])throw f(e[2]);var t=k(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}set_actor_level(e,t){s.gamecore_set_actor_level(this.__wbg_ptr,e,t)}spawn_actor(e,t,r,a,o,i){const c=p(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=d,l=s.gamecore_spawn_actor(this.__wbg_ptr,e,c,_,r,a,o,i);if(l[1])throw f(l[0])}spawn_scripted_actor(e,t,r,a,o,i){const c=p(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=d,l=s.gamecore_spawn_scripted_actor(this.__wbg_ptr,e,c,_,r,a,o,i);if(l[1])throw f(l[0])}step(e){s.gamecore_step(this.__wbg_ptr,e)}take_events(){let e,t;try{const r=s.gamecore_take_events(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(T.prototype[Symbol.dispose]=T.prototype.free);function q(){return{__proto__:null,"./vimp_snakes_core_bg.js":{__proto__:null,__wbg_Error_408e67f47ca7b58b:function(e,t){return Error(u(e,t))},__wbg___wbindgen_throw_bb96b2010945f0bc:function(e,t){throw new Error(u(e,t))},__wbindgen_init_externref_table:function(){const e=s.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const B=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_clientcore_free(n,1)),z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_gamecore_free(n,1));function x(n,e){return n=n>>>0,Te().subarray(n/4,n/4+e)}function k(n,e){return n=n>>>0,b().subarray(n/1,n/1+e)}let y=null;function Te(){return(y===null||y.byteLength===0)&&(y=new Float32Array(s.memory.buffer)),y}function u(n,e){return De(n>>>0,e)}let w=null;function b(){return(w===null||w.byteLength===0)&&(w=new Uint8Array(s.memory.buffer)),w}function xe(n){return n==null}function v(n,e){const t=e(n.length*1,1)>>>0;return b().set(n,t/1),d=n.length,t}function p(n,e,t){if(t===void 0){const c=S.encode(n),_=e(c.length,1)>>>0;return b().subarray(_,_+c.length).set(c),d=c.length,_}let r=n.length,a=e(r,1)>>>0;const o=b();let i=0;for(;i<r;i++){const c=n.charCodeAt(i);if(c>127)break;o[a+i]=c}if(i!==r){i!==0&&(n=n.slice(i)),a=t(a,r,r=i+n.length*3,1)>>>0;const c=b().subarray(a+i,a+r),_=S.encodeInto(n,c);i+=_.written,a=t(a,r,i,1)>>>0}return d=i,a}function f(n){const e=s.__wbindgen_externrefs.get(n);return s.__externref_table_dealloc(n),e}let M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});M.decode();const Ie=2146435072;let C=0;function De(n,e){return C+=e,C>=Ie&&(M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),M.decode(),C=e),M.decode(b().subarray(n,n+e))}const S=new TextEncoder;"encodeInto"in S||(S.encodeInto=function(n,e){const t=S.encode(n);return e.set(t),{read:n.length,written:t.length}});let d=0,s;function $(n,e){return s=n.exports,y=null,w=null,s.__wbindgen_start(),s}async function Oe(n,e){if(typeof Response=="function"&&n instanceof Response){if(!n.ok)throw new Error(`failed to fetch Wasm: ${n.status} ${n.statusText} fetching '${n.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(a){if(t(n.type)&&n.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",a);else throw a}const r=await n.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{const r=await WebAssembly.instantiate(n,e);return r instanceof WebAssembly.Instance?{instance:r,module:n}:r}function t(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function Fe(n){if(s!==void 0)return s;n!==void 0&&(Object.getPrototypeOf(n)===Object.prototype?{module:n}=n:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=q();n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n));const t=new WebAssembly.Instance(n,e);return $(t)}async function Be(n){if(s!==void 0)return s;n!==void 0&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),n===void 0&&(n=new URL("/assets/vimp_snakes_core_bg-B3FAa7tV.wasm",import.meta.url));const e=q();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:t,module:r}=await Oe(await n,e);return $(t)}const ze=Object.freeze(Object.defineProperty({__proto__:null,ClientCore:R,GameCore:T,default:Be,initSync:Fe},Symbol.toStringTag,{value:"Module"}));export{Le as default};
@@ -2,13 +2,14 @@
2
2
  "id": "snakes",
3
3
  "engineApi": 4,
4
4
  "requires": [
5
- "accolades"
5
+ "accolades",
6
+ "chat.engineNamespace"
6
7
  ],
7
- "version": "0be28ccea7ceffa1",
8
+ "version": "679e296d34cf1d89",
8
9
  "title": "Snakes",
9
10
  "entries": {
10
- "client": "/games/snakes/client-wX2OtEUD.js",
11
- "host": "/games/snakes/host-CnQ0hTJY.js",
11
+ "client": "/games/snakes/client-C695ZxPU.js",
12
+ "host": "/games/snakes/host-BFiIcYMT.js",
12
13
  "wasm": "/games/snakes/assets/vimp_snakes_core_bg-B3FAa7tV.wasm",
13
14
  "wasmNode": "./core-node/vimp_snakes_core.js"
14
15
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vimp-games/snakes",
3
- "version": "0.15.18",
3
+ "version": "0.15.19",
4
4
  "description": "VIMP Snakes — a VIMP game plugin",
5
5
  "author": "lgick",
6
6
  "license": "UNLICENSED",
@@ -47,7 +47,7 @@
47
47
  "globals": "^16.2.0",
48
48
  "happy-dom": "^21.0.4",
49
49
  "pixi.js": "^8.14.0",
50
- "vimp-engine": "^0.46.0",
50
+ "vimp-engine": "^0.47.0",
51
51
  "vite": "^7.1.11",
52
52
  "vitest": "^4.1.12"
53
53
  }
@@ -1 +0,0 @@
1
- const X=Array.from({length:16},(n,e)=>[{name:`p${e}x`,ty:"f32",interp:"lerp"},{name:`p${e}y`,ty:"f32",interp:"lerp"}]).flat(),Z={s1:{id:1,kind:"indexed8",class:"hot",fields:[...X,{name:"angle",ty:"f32",interp:"lerpAngle"},{name:"radius",ty:"f32",interp:"lerp"},{name:"crystals",ty:"u16"},{name:"color",ty:"u8"},{name:"boost",ty:"u8"}]},cr:{id:2,kind:"indexed32",class:"event",fields:[{name:"x",ty:"f32"},{name:"y",ty:"f32"},{name:"tier",ty:"u8"},{name:"color",ty:"u8"}]},c1:{id:3,kind:"indexedNoNull8",class:"hot",fields:[{name:"x",ty:"f32",interp:"lerp"},{name:"y",ty:"f32",interp:"lerp"},{name:"angle",ty:"f32",interp:"lerpAngle"}]}},I=[16731469,16752412,16765503,10214972,3065014,3848191,5531903,11623679,16735432,16250871,8250065,16753828],Q=n=>`#${I[n%I.length].toString(16).padStart(6,"0")}`,J=[{value:1,radius:8},{value:3,radius:13},{value:8,radius:20}],E={s1:{baseSpeed:260,boostFactor:1.9,turnSpeed:3.4,turnSpeedFalloff:.18,turnSpeedMin:1.4,baseRadius:14,radiusGain:1.6,baseLength:150,lengthPerCrystal:9,pointSpacing:6,boostDrainPerSecond:6,boostMinCrystals:2,world:{maxCrystals:60,spawnInterval:.35,tierWeights:[70,25,5],tiers:J,dropRatio:.8,edgeMargin:60,startCrystals:0,spawnGraceSeconds:2}}},L=128,D=1,ee=20,O=8,N=4,A=64,te=Math.PI*(3-Math.sqrt(5)),re=.72,ne=25;function P(n){const e=Math.ceil(Math.max(n,0)/N)*N,t=Math.max(e,O);return Math.round(ee*Math.sqrt(t/O))}const W=Math.log2(A);if(!Number.isInteger(W))throw new Error(`RESPAWN_COUNT must be a power of two (the order is bit-reversed), got ${A}`);function se(n){let e=0;for(let t=0;t<W;t+=1)e=e<<1|n>>t&1;return e}function ae(n){const e=n*L/2,t=e;return Array.from({length:A},(r,a)=>{const o=se(a),i=e*re*Math.sqrt((o+.5)/A),c=o*te,_=t+Math.cos(c)*i,l=t+Math.sin(c)*i,h=(a*.6180339887%1*2-1)*ne,m=c*180/Math.PI+180+h;return[Math.round(_),Math.round(l),Math.round((m%360+360)%360)]})}function U(n=0){const e=P(n);return{setId:"c1",scale:1,step:L,physicsStatic:[],physicsDynamic:[],layers:{1:[D]},map:Array.from({length:e},()=>Array.from({length:e},()=>D)),respawns:{players:ae(e)}}}const oe=U(0),ie={arena:oe},ce={title:"Snakes",parts:{models:E,weapons:{},friendlyFire:!1},snapshot:Z,soundCues:{roundStart:null,victory:null,defeat:null,frag:null,death:null},maps:ie,currentMap:"arena",mapScale:1,mapSetId:"c1",mapsInVote:1,timers:{timeStep:1e3/120,networkSendRate:4,roundTime:36e5,mapTime:36e5,roomTimeMin:1e4,roomTimeMax:36e5,voteTime:1e4,timeBlockedVote:3e4,teamChangeGracePeriod:1e4,roundRestartDelay:5e3,mapChangeDelay:2e3,rttPingInterval:3e3,idleCheckInterval:3e4},playerState:{defaultState:{best:0,eaten:0}},noSpectators:!0,endlessRound:!0,statMode:"leaderboard",teams:{players:1},scripted:{namePrefix:"Snake",defaultModel:"s1"},playerKeys:{left:{key:1},right:{key:2},boost:{key:4},respawn:{key:8,type:1}},panel:{fields:{crystals:{key:"c",value:0},score:{key:"s",value:0},dead:{key:"d",value:0}},activeKey:"wa"},stat:{name:{key:0,bodyMethod:"=",headSync:!0,headMethod:"#"},status:{key:1,bodyMethod:"=",bodyValue:"",headValue:""},score:{key:2,bodyMethod:"=",bodyValue:0,headMethod:"+",headValue:0},latency:{key:3,bodyMethod:"="}},roomDefaults:{maxPlayers:32},roomForm:[{name:"maxPlayers",control:"text",label:"Max players",numeric:!0},{name:"map",control:"select",label:"Map",source:"maps"}]},_e={elems:{authId:"auth",fieldsId:"auth-fields",errorId:"auth-error",enterId:"auth-enter",titleId:"auth-title",informsId:"auth-informs"},texts:{title:"Snakes",sections:[{heading:"How to play",lines:[{keys:"a, d",text:"turn"},{keys:"w",text:"boost (burns crystals)"},{keys:"r",text:"respawn after a crash"},{separator:!0},{keys:"",text:"eat crystals to grow"},{keys:"",text:"the edge and other snakes kill you"},{keys:"",text:"your own tail does not"},{separator:!0},{keys:"c",text:"chat"},{keys:"<Tab>",text:"stats",last:!0}]}]},params:[{name:"model",value:"s1",options:{control:"select",label:"Snake",options:Object.keys(E),validator:"isValidModel",storage:"model"}}],validators:{isValidModel:n=>n in E}},le={pickup:{file:"shot",priority:80,volume:.35},death:{file:"death",priority:150,volume:.5}},de={codecList:["webm","mp3"],spatial:{mode:"topDown",innerRadius:14},sounds:le},pe={parts:{gameSets:{s1:["Snake"],cr:["Crystal"],c1:["Arena"]},entitiesOnCanvas:{Arena:"vimp",Snake:"vimp",Crystal:"vimp"},bakedAssets:{vimp:[{name:"crystalGem",component:"Crystal",params:{radius:32,facets:6}},{name:"crown",component:"Snake",params:{size:64,points:3}}]},componentDependencies:{soundManager:["Snake"],localPlayer:["Snake"],accolades:["Snake"]},sounds:de},initIdList:["vimp","panel","chat"],modules:{canvasManager:{canvases:{vimp:{width:960,height:600,aspectRatio:"16:10",baseScale:"1:1",dynamicCamera:!0,shakeCamera:!1}}},controls:{modes:{77:""},keySetList:[{78:"nextPlayer",80:"prevPlayer"},{65:"left",68:"right",87:"boost",82:"respawn"}],pointer:{keySets:[1],doubleTapMs:300,doubleTapPx:40,sendIntervalMs:50}},chat:{params:{messages:{s:["The arena is full. You will join as soon as a place frees up","You are already in the arena","You are in the arena","You are watching the arena","{0} crashed into {1}","{0} joined the game","{0} left the game","Host changed","You are no longer the host (connection lost)","Host changed: the previous host was lagging","Host changed: the previous host went inactive","Host changed: the previous host had a poor connection"],v:["A vote has been created","Voting has started","Your vote has been accepted","Voting is temporarily unavailable","Vote passed","Vote failed","Usage: /changehost","You are the host — the room hands the host role over automatically when needed","No connection to the master server","A host vote was held recently","No other player can host","A host vote is already in progress","A host vote is not possible right now","Vote to change host passed ({0}/{1})","Vote to change host failed ({0}/{1})","Host vote cancelled"],m:["Current map: {0}","Next map: {0}"],c:["Command not found","Your place today: {0} of {1} ({2} points)"],g:["Bot snakes in the arena: {0}","Invalid bot count"]}}},panel:{keys:{s:"score",c:"crystals",d:"dead",wa:"mode",t:"time"},fields:[{name:"score",elem:"panel-score",type:"value"},{name:"crystals",elem:"panel-crystals",type:"value"},{name:"dead",elem:"panel-dead",type:"value"},{name:"mode",elem:"panel-mode",type:"weapon"},{name:"time",elem:"panel-time",type:"time"}]},stat:{params:{mode:"leaderboard",period:"day",limit:10,columns:["#","snake","score"]}}},gameInform:{list:["{0} WINS!","SLITHER!","GAME OVER!"]}};class ue{constructor({participants:e,coreAdapter:t,socketManager:r},a){this._participants=e,this._coreAdapter=t,this._socketManager=r,this._scriptedManager=a,this._vimp=null,this._population=null,this._size=null,this._mapData=null,this._delivered=new Map}onCoreEvent(e,t={}){t.vimp&&(this._vimp=t.vimp),!(!e||e.type!=="population")&&this._apply(Number(e.count)||0)}_apply(e){const t=this._sizeFor(e);if(t!==this._size){this._size=t,this._population=e;const r=U(e);this._coreAdapter.createMap(r),this._scriptedManager?.createMap(r),this._vimp?.overrideMapData?.(r),this._mapData=r,this._delivered.clear()}this._broadcast()}_sizeFor(e){if(this._size===null)return P(e);const t=P(e);return t>this._size||e<=this._population-N?t:this._size}_broadcast(){if(!this._mapData)return;const e=this._participants.getHumans(),t=new Set;for(const r of e)t.add(r.socketId),!(!r.isReady||this._delivered.get(r.socketId)===this._size)&&(this._delivered.set(r.socketId,this._size),this._socketManager.sendMap(r.socketId,this._mapData));for(const r of this._delivered.keys())t.has(r)||this._delivered.delete(r)}reapply(){this._mapData&&(this._vimp?.overrideMapData?.(this._mapData),this._coreAdapter.createMap(this._mapData),this._scriptedManager?.createMap(this._mapData),this._broadcast())}get mapData(){return this._mapData??null}}class he{constructor({participants:e}){this._participants=e}onCoreEvent(e){if(!e||e.type!=="spawn")return;const t=Number(e.color);!Number.isFinite(t)||t<0||this._participants?.setChatColor?.(String(e.id),Q(t))}}class fe{constructor({participants:e,coreAdapter:t,panel:r,stat:a,scripted:o}){this._participants=e,this._coreAdapter=t,this._panel=r,this._stat=a,this._model=o.defaultModel,this._respawns=null}createMap(e){this._respawns=e.respawns}getCountsPerTeam(){const e={};for(const t of this._participants.getScripted())e[t.team]=(e[t.team]??0)+1;return e}createScripted(e,t=null){if(!this._respawns)return 0;const r=this._participants.getPlayableTeams();let a=0;for(let o=0;o<e&&!this._participants.isFull;o+=1){const i=t??this._pickTeam(r);if(!i||!this._hasRoom(i))break;const c=this._participants.createScripted({team:i,model:this._model}),_=this._participants.get(c);this._stat.addUser(c,_.teamId,{name:_.name,status:"",latency:"BOT"}),this._panel.addUser(c),a+=1}return a}_hasRoom(e){const t=this._respawns[e];return!!(t&&this._participants.getTeamSize(e)<t.length)}_pickTeam(e){return[...e].sort((t,r)=>this._participants.getTeamSize(t)-this._participants.getTeamSize(r)).find(t=>this._hasRoom(t))??null}removeScripted(e=null){const t=this._participants.getScripted();(e?t.filter(a=>a.team===e):t).forEach(a=>this._remove(a.gameId))}removeOneForHuman(e){for(const t of this._participants.getScripted())if(t.team===e)return this._remove(t.gameId),!0;return!1}_remove(e){const t=this._participants.get(e);!t||!t.isScripted||(this._stat.removeUser(e,t.teamId),this._panel.removeUser(e),this._coreAdapter.removePlayer(e),this._participants.remove(e))}}const me=15;class ge{constructor({participants:e,stat:t}){this._participants=e,this._stat=t,this._totals=new Map}onCoreEvent(e,t={}){if(!e||typeof e!="object")return;const{vimp:r,panel:a}=t,o=String(e.id);switch(e.type){case"crystals":this._onCrystals(o,Number(e.gained)||0,r,a);break;case"burn":this._onBurn(o,Number(e.burned)||0,r,a);break;case"death":this._onDeath(o,e,r,a);break;case"respawn":this._onRespawn(o,r,a);break;case"population":this._publishNewcomers(r,a),r?.flushPlayerData?.();break}}reset(e){this._totals.delete(e)}_onCrystals(e,t,r,a){const o=this._record(e);!o||t<=0||(o.eaten+=t,o.score+=t,this._publish(e,o,r,a))}_onBurn(e,t,r,a){const o=this._record(e);!o||t<=0||(o.score=Math.max(0,o.score-t),this._publish(e,o,r,a))}_onDeath(e,t,r,a){const o=this._record(e);if(!o)return;const i=t.killer===null||t.killer===void 0?null:String(t.killer);if(i!==null&&i!==e){const l=this._record(i);l&&(l.kills+=1,l.score+=me,this._publish(i,l,r,a))}this._publish(e,o,r,a);const _=r?.isPlayerRatingLoaded?.(e,"day")===!0?r.getPlayerRating?.(e,"day")?.value??0:1/0;r?.addPlayerPoints?.(e,o.score),r?.finishPlayerGame?.(e),this._recordBest(e,o,r),r?.flushPlayerData?.({urgent:o.score>_})}_onRespawn(e,t,r){const a=this._record(e);a&&(a.eaten=0,a.kills=0,a.score=0,a.flushedEaten=0,this._publish(e,a,t,r))}_record(e){const t=this._participants.get(e);if(!t)return null;const r=this._totals.get(e);if(r&&r.participant===t)return r;const a={participant:t,eaten:0,kills:0,score:0,flushedEaten:0,published:!1};return this._totals.set(e,a),a}_publishNewcomers(e,t){for(const r of this._participants.getAll()){const a=r.gameId,o=this._totals.get(a),i=o?.participant===r?o:this._record(a);i&&!i.published&&this._publish(a,i,e,t)}}_publish(e,t,r,a){const{score:o}=t;t.published=!0,this._stat.updateUser(e,t.participant.teamId,{score:o}),a&&a.updateUser(e,"score",o,"set")}_recordBest(e,t,r){if(!r?.getPlayerState)return;const a=r.getPlayerState(e);if(!a)return;const o=t.eaten-t.flushedEaten;t.flushedEaten=t.eaten;const i=Math.max(Number(a.best)||0,t.score),c=(Number(a.eaten)||0)+o;r.setPlayerState(e,{...a,best:i,eaten:c})}}let V=null,j=null,G=null;function be(n){const e=new fe(n);return V=new ge(n),j=new ue(n,e),G=new he(n),{scripted:e}}function ye(){return V}function Y(){return j}function we(){return G}const ve={name:"/bot",handler(n,e,t){const r=Number(t[0]);if(t[0]===void 0||!Number.isFinite(r)||r<0){n.chat.pushSystemByUser(e,"BOT_COUNT_INVALID");return}const{maxPlayers:a}=n.participants,o=Math.trunc(r),i=a>0?Math.min(o,a):o;n.scripted.removeScripted();const c=i>0?n.scripted.createScripted(i):0;n.chat.pushSystem("BOTS_SET",[c]),c>0&&(n.roundManager.initiateNewRound(),Y()?.reapply())}},Se={name:"/nr",handler(n,e){n.isDevMode?n.roundManager.initiateNewRound():n.chat.pushSystemByUser(e,"COMMANDS_NOT_FOUND")}},ke={name:"/rank",async handler(n,e){let t=null;try{t=await n.playerDataSync?.refreshPlacement?.(e,"day")}catch{t=n.playerDataSync?.getRating?.(e,"day")??null}const{value:r=0,placement:a=null,total:o=0}=t??{};n.chat.pushSystemByUser(e,"RANK",[a??"—",o,r])}},Me={BOTS_SET:"g:0",BOT_COUNT_INVALID:"g:1"},Ae="modulepreload",Ce=function(n){return"/"+n},F={},Ee=function(e,t,r){let a=Promise.resolve();if(t&&t.length>0){let _=function(l){return Promise.all(l.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");a=_(t.map(l=>{if(l=Ce(l),l in F)return;F[l]=!0;const h=l.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":Ae,h||(g.as="script"),g.crossOrigin="",g.href=l,c&&g.setAttribute("nonce",c),document.head.appendChild(g),h)return new Promise((H,K)=>{g.addEventListener("load",H),g.addEventListener("error",()=>K(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&o(c.reason);return e().catch(o)})},Ne=n=>(n??"").endsWith(".js"),Pe=n=>import(n),Re=()=>Ee(()=>Promise.resolve().then(()=>ze),[]),Le={id:"snakes",engineApi:4,requires:["accolades"],async createCore(n,{wasmUrl:e}={}){if(Ne(e)){const a=await Pe(e);return new a.GameCore(n)}const{default:t,GameCore:r}=await Re();return await t({module_or_path:e}),new r(n)},gameConfig:ce,authSchema:_e,chatCommands:[ve,Se,ke],systemMessages:Me,createModules:be,buildClientGameConfig:()=>pe,onCoreEvent(n,e={}){ye()?.onCoreEvent(n,e),Y()?.onCoreEvent(n,e),we()?.onCoreEvent(n)}};class R{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,B.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_clientcore_free(e,0)}abi_describe(){let e,t;try{const r=s.clientcore_abi_describe(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}apply_aim(e,t,r,a){s.clientcore_apply_aim(this.__wbg_ptr,e,t,r,a)}apply_input(e,t,r){const a=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),o=d,i=p(t,s.__wbindgen_malloc,s.__wbindgen_realloc),c=d;s.clientcore_apply_input(this.__wbg_ptr,a,o,i,c,r)}debug_json(){let e,t;try{const r=s.clientcore_debug_json(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}decode_frame(e){let t,r;try{const a=v(e,s.__wbindgen_malloc),o=d,i=s.clientcore_decode_frame(this.__wbg_ptr,a,o);return t=i[0],r=i[1],u(i[0],i[1])}finally{s.__wbindgen_free(t,r,1)}}dispatch(e,t){const r=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=d,o=v(t,s.__wbindgen_malloc),i=d,c=s.clientcore_dispatch(this.__wbg_ptr,r,a,o,i);var _=k(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}hot_ptr(){return s.clientcore_hot_ptr(this.__wbg_ptr)>>>0}hot_values(){const e=s.clientcore_hot_values(this.__wbg_ptr);var t=x(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}my_game_id(){return s.clientcore_my_game_id(this.__wbg_ptr)}constructor(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.clientcore_new(t,r);if(a[2])throw f(a[1]);return this.__wbg_ptr=a[0],B.register(this,this.__wbg_ptr,this),this}offset(){return s.clientcore_offset(this.__wbg_ptr)}push_frame(e,t){const r=v(e,s.__wbindgen_malloc),a=d;return s.clientcore_push_frame(this.__wbg_ptr,r,a,t)!==0}reset(){s.clientcore_reset(this.__wbg_ptr)}resync(){s.clientcore_resync(this.__wbg_ptr)}sample(e){return s.clientcore_sample(this.__wbg_ptr,e)>>>0}set_active(e){s.clientcore_set_active(this.__wbg_ptr,e)}set_map(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.clientcore_set_map(this.__wbg_ptr,t,r);if(a[1])throw f(a[0])}set_model(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d;s.clientcore_set_model(this.__wbg_ptr,t,r)}sync_panel(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d;s.clientcore_sync_panel(this.__wbg_ptr,t,r)}take_divergence(){let e,t;try{const r=s.clientcore_take_divergence(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}take_frames(){let e,t;try{const r=s.clientcore_take_frames(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(R.prototype[Symbol.dispose]=R.prototype.free);class T{__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_gamecore_free(e,0)}abi_describe(){let e,t;try{const r=s.gamecore_abi_describe(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}alive_players(){const e=s.gamecore_alive_players(this.__wbg_ptr);var t=x(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),t}apply_aim(e,t,r,a,o){s.gamecore_apply_aim(this.__wbg_ptr,e,t,r,a,o)}apply_input(e,t,r,a){const o=p(r,s.__wbindgen_malloc,s.__wbindgen_realloc),i=d,c=p(a,s.__wbindgen_malloc,s.__wbindgen_realloc),_=d;s.gamecore_apply_input(this.__wbg_ptr,e,t,o,i,c,_)}body_has_events(){return s.gamecore_body_has_events(this.__wbg_ptr)!==0}clear(){s.gamecore_clear(this.__wbg_ptr)}debug_json(){let e,t;try{const r=s.gamecore_debug_json(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}deserialize_state(e){const t=v(e,s.__wbindgen_malloc),r=d,a=s.gamecore_deserialize_state(this.__wbg_ptr,t,r);if(a[1])throw f(a[0])}dispatch(e,t){const r=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=d,o=v(t,s.__wbindgen_malloc),i=d,c=s.gamecore_dispatch(this.__wbg_ptr,r,a,o,i);var _=k(c[0],c[1]).slice();return s.__wbindgen_free(c[0],c[1]*1,1),_}frame_bytes(){const e=s.gamecore_frame_bytes(this.__wbg_ptr);var t=k(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}frame_ptr(){return s.gamecore_frame_ptr(this.__wbg_ptr)>>>0}is_alive(e){return s.gamecore_is_alive(this.__wbg_ptr,e)!==0}last_input_seq(e){return s.gamecore_last_input_seq(this.__wbg_ptr,e)>>>0}load_map(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.gamecore_load_map(this.__wbg_ptr,t,r);if(a[1])throw f(a[0])}map_info(){let e,t;try{const r=s.gamecore_map_info(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}constructor(e){const t=p(e,s.__wbindgen_malloc,s.__wbindgen_realloc),r=d,a=s.gamecore_new(t,r);if(a[2])throw f(a[1]);return this.__wbg_ptr=a[0],z.register(this,this.__wbg_ptr,this),this}pack_body(){const e=s.gamecore_pack_body(this.__wbg_ptr);if(e[1])throw f(e[0])}pack_frame(e,t,r,a,o,i,c,_){var l=xe(c)?0:p(c,s.__wbindgen_malloc,s.__wbindgen_realloc),h=d;return s.gamecore_pack_frame(this.__wbg_ptr,e,t,r,a,o,i,l,h,_)>>>0}players_data(){let e,t;try{const r=s.gamecore_players_data(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}position_of(e){const t=s.gamecore_position_of(this.__wbg_ptr,e);var r=x(t[0],t[1]).slice();return s.__wbindgen_free(t[0],t[1]*4,4),r}remove_actor(e){s.gamecore_remove_actor(this.__wbg_ptr,e)}remove_players_and_shots(){let e,t;try{const r=s.gamecore_remove_players_and_shots(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}remove_scripted_actor(e){s.gamecore_remove_scripted_actor(this.__wbg_ptr,e)}reset_actor(e,t,r,a,o){s.gamecore_reset_actor(this.__wbg_ptr,e,t,r,a,o)}reset_all_vitals(){s.gamecore_reset_all_vitals(this.__wbg_ptr)}serialize_state(){const e=s.gamecore_serialize_state(this.__wbg_ptr);if(e[3])throw f(e[2]);var t=k(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*1,1),t}set_actor_level(e,t){s.gamecore_set_actor_level(this.__wbg_ptr,e,t)}spawn_actor(e,t,r,a,o,i){const c=p(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=d,l=s.gamecore_spawn_actor(this.__wbg_ptr,e,c,_,r,a,o,i);if(l[1])throw f(l[0])}spawn_scripted_actor(e,t,r,a,o,i){const c=p(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=d,l=s.gamecore_spawn_scripted_actor(this.__wbg_ptr,e,c,_,r,a,o,i);if(l[1])throw f(l[0])}step(e){s.gamecore_step(this.__wbg_ptr,e)}take_events(){let e,t;try{const r=s.gamecore_take_events(this.__wbg_ptr);return e=r[0],t=r[1],u(r[0],r[1])}finally{s.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(T.prototype[Symbol.dispose]=T.prototype.free);function q(){return{__proto__:null,"./vimp_snakes_core_bg.js":{__proto__:null,__wbg_Error_408e67f47ca7b58b:function(e,t){return Error(u(e,t))},__wbg___wbindgen_throw_bb96b2010945f0bc:function(e,t){throw new Error(u(e,t))},__wbindgen_init_externref_table:function(){const e=s.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const B=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_clientcore_free(n,1)),z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>s.__wbg_gamecore_free(n,1));function x(n,e){return n=n>>>0,Te().subarray(n/4,n/4+e)}function k(n,e){return n=n>>>0,b().subarray(n/1,n/1+e)}let y=null;function Te(){return(y===null||y.byteLength===0)&&(y=new Float32Array(s.memory.buffer)),y}function u(n,e){return De(n>>>0,e)}let w=null;function b(){return(w===null||w.byteLength===0)&&(w=new Uint8Array(s.memory.buffer)),w}function xe(n){return n==null}function v(n,e){const t=e(n.length*1,1)>>>0;return b().set(n,t/1),d=n.length,t}function p(n,e,t){if(t===void 0){const c=S.encode(n),_=e(c.length,1)>>>0;return b().subarray(_,_+c.length).set(c),d=c.length,_}let r=n.length,a=e(r,1)>>>0;const o=b();let i=0;for(;i<r;i++){const c=n.charCodeAt(i);if(c>127)break;o[a+i]=c}if(i!==r){i!==0&&(n=n.slice(i)),a=t(a,r,r=i+n.length*3,1)>>>0;const c=b().subarray(a+i,a+r),_=S.encodeInto(n,c);i+=_.written,a=t(a,r,i,1)>>>0}return d=i,a}function f(n){const e=s.__wbindgen_externrefs.get(n);return s.__externref_table_dealloc(n),e}let M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});M.decode();const Ie=2146435072;let C=0;function De(n,e){return C+=e,C>=Ie&&(M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),M.decode(),C=e),M.decode(b().subarray(n,n+e))}const S=new TextEncoder;"encodeInto"in S||(S.encodeInto=function(n,e){const t=S.encode(n);return e.set(t),{read:n.length,written:t.length}});let d=0,s;function $(n,e){return s=n.exports,y=null,w=null,s.__wbindgen_start(),s}async function Oe(n,e){if(typeof Response=="function"&&n instanceof Response){if(!n.ok)throw new Error(`failed to fetch Wasm: ${n.status} ${n.statusText} fetching '${n.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(a){if(t(n.type)&&n.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",a);else throw a}const r=await n.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{const r=await WebAssembly.instantiate(n,e);return r instanceof WebAssembly.Instance?{instance:r,module:n}:r}function t(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}function Fe(n){if(s!==void 0)return s;n!==void 0&&(Object.getPrototypeOf(n)===Object.prototype?{module:n}=n:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=q();n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n));const t=new WebAssembly.Instance(n,e);return $(t)}async function Be(n){if(s!==void 0)return s;n!==void 0&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),n===void 0&&(n=new URL("/assets/vimp_snakes_core_bg-B3FAa7tV.wasm",import.meta.url));const e=q();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));const{instance:t,module:r}=await Oe(await n,e);return $(t)}const ze=Object.freeze(Object.defineProperty({__proto__:null,ClientCore:R,GameCore:T,default:Be,initSync:Fe},Symbol.toStringTag,{value:"Module"}));export{Le as default};