1
0
mirror of https://github.com/osmarks/website synced 2024-12-24 09:00:30 +00:00
website/experiments/tictactoe4d/dist/app.js
2024-01-30 16:46:38 +00:00

4 lines
10 KiB
JavaScript

(()=>{var a,w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);function c(n){return w[n]}var v=w.length;function R(n){n<132||(w[n]=v,v=n)}function T(n){let e=c(n);return R(n),e}function _(n){v===w.length&&w.push(w.length+1);let e=v;return v=w[e],w[e]=n,e}var S=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&S.decode();var k=null;function m(){return(k===null||k.byteLength===0)&&(k=new Uint8Array(a.memory.buffer)),k}function s(n,e){return n=n>>>0,S.decode(m().subarray(n,n+e))}function g(n){return n==null}var A=null;function U(){return(A===null||A.byteLength===0)&&(A=new Float64Array(a.memory.buffer)),A}var x=null;function l(){return(x===null||x.byteLength===0)&&(x=new Int32Array(a.memory.buffer)),x}function M(n){let e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){let o=n.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){let o=n.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(n)){let o=n.length,i="[";o>0&&(i+=M(n[0]));for(let u=1;u<o;u++)i+=", "+M(n[u]);return i+="]",i}let t=/\[object ([^\]]+)\]/.exec(toString.call(n)),r;if(t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
${n.stack}`:r}var d=0,W=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},C=typeof W.encodeInto=="function"?function(n,e){return W.encodeInto(n,e)}:function(n,e){let t=W.encode(n);return e.set(t),{read:n.length,written:t.length}};function p(n,e,t){if(t===void 0){let f=W.encode(n),h=e(f.length,1)>>>0;return m().subarray(h,h+f.length).set(f),d=f.length,h}let r=n.length,o=e(r,1)>>>0,i=m(),u=0;for(;u<r;u++){let f=n.charCodeAt(u);if(f>127)break;i[o+u]=f}if(u!==r){u!==0&&(n=n.slice(u)),o=t(o,r,r=u+n.length*3,1)>>>0;let f=m().subarray(o+u,o+r),h=C(n,f);u+=h.written}return d=u,o}function F(n,e,t,r){let o={a:n,b:e,cnt:1,dtor:t},i=(...u)=>{o.cnt++;let f=o.a;o.a=0;try{return r(f,o.b,...u)}finally{--o.cnt===0?a.__wbindgen_export_2.get(o.dtor)(f,o.b):o.a=f}};return i.original=o,i}function B(n,e){let t=e(n.length*1,1)>>>0;return m().set(n,t/1),d=n.length,t}function D(n,e,t){let r=B(t,a.__wbindgen_malloc),o=d;a.wasm_bindgen__convert__closures__invoke1_mut__h5860e381bcb9706c(n,e,r,o)}function N(n,e,t,r){let o={a:n,b:e,cnt:1,dtor:t},i=(...u)=>{o.cnt++;try{return r(o.a,o.b,...u)}finally{--o.cnt===0&&(a.__wbindgen_export_2.get(o.dtor)(o.a,o.b),o.a=0)}};return i.original=o,i}function $(n,e,t){a.wasm_bindgen__convert__closures__invoke1__h5a4fa13f3ec138ca(n,e,_(t))}function V(n,e){return n=n>>>0,m().subarray(n/1,n/1+e)}function z(n){return()=>{throw new Error(`${n} is not defined`)}}function O(){let n=a.main();return T(n)}var E=null;function q(){return(E===null||E.byteLength===0)&&(E=new Uint32Array(a.memory.buffer)),E}function J(n,e){n=n>>>0;let r=q().subarray(n/4,n/4+e),o=[];for(let i=0;i<r.length;i++)o.push(T(r[i]));return o}function b(n,e){try{return n.apply(this,e)}catch(t){a.__wbindgen_exn_store(_(t))}}async function H(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(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",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function G(){let n={};return n.wbg={},n.wbg.__wbindgen_object_drop_ref=function(e){T(e)},n.wbg.__wbindgen_object_clone_ref=function(e){let t=c(e);return _(t)},n.wbg.__wbg_wincallback_a6a4fc5b782108cf=typeof win_callback=="function"?win_callback:z("win_callback"),n.wbg.__wbg_runaibackground_8f0429c82a23ffaf=function(e,t){var r=V(e,t).slice();a.__wbindgen_free(e,t*1,1),run_ai_background(r)},n.wbg.__wbindgen_string_new=function(e,t){let r=s(e,t);return _(r)},n.wbg.__wbindgen_number_get=function(e,t){let r=c(t),o=typeof r=="number"?r:void 0;U()[e/8+1]=g(o)?0:o,l()[e/4+0]=!g(o)},n.wbg.__wbindgen_number_new=function(e){return _(e)},n.wbg.__wbg_new_abda76e883ba8a5f=function(){let e=new Error;return _(e)},n.wbg.__wbg_stack_658279fe44541cf6=function(e,t){let r=c(t).stack,o=p(r,a.__wbindgen_malloc,a.__wbindgen_realloc),i=d;l()[e/4+1]=i,l()[e/4+0]=o},n.wbg.__wbg_error_f851667af71bcfc6=function(e,t){let r,o;try{r=e,o=t,console.error(s(e,t))}finally{a.__wbindgen_free(r,o,1)}},n.wbg.__wbg_warn_40349716c899750a=function(e,t){var r=J(e,t).slice();a.__wbindgen_free(e,t*4,4),console.warn(...r)},n.wbg.__wbg_instanceof_Window_434ce1849eb4e0fc=function(e){let t;try{t=c(e)instanceof Window}catch{t=!1}return t},n.wbg.__wbg_body_4579ae140279af20=function(e){let t=c(e).body;return g(t)?0:_(t)},n.wbg.__wbg_createElement_d15f046703844f09=function(){return b(function(e,t,r){let o=c(e).createElement(s(t,r));return _(o)},arguments)},n.wbg.__wbg_createElementNS_11acf9c78d336078=function(){return b(function(e,t,r,o,i){let u=c(e).createElementNS(t===0?void 0:s(t,r),s(o,i));return _(u)},arguments)},n.wbg.__wbg_createTextNode_18d067bf6369a475=function(e,t,r){let o=c(e).createTextNode(s(t,r));return _(o)},n.wbg.__wbg_getElementById_af8feeb3fb877150=function(e,t,r){let o=c(e).getElementById(s(t,r));return g(o)?0:_(o)},n.wbg.__wbg_instanceof_Element_c9423704dd5d9b1d=function(e){let t;try{t=c(e)instanceof Element}catch{t=!1}return t},n.wbg.__wbg_namespaceURI_9fd9462aeda0a089=function(e,t){let r=c(t).namespaceURI;var o=g(r)?0:p(r,a.__wbindgen_malloc,a.__wbindgen_realloc),i=d;l()[e/4+1]=i,l()[e/4+0]=o},n.wbg.__wbg_removeAttribute_8f442821de341f11=function(){return b(function(e,t,r){c(e).removeAttribute(s(t,r))},arguments)},n.wbg.__wbg_setAttribute_fecb2c0d020f422f=function(){return b(function(e,t,r,o,i){c(e).setAttribute(s(t,r),s(o,i))},arguments)},n.wbg.__wbg_target_ee132da05a9ef949=function(e){let t=c(e).target;return g(t)?0:_(t)},n.wbg.__wbg_cancelBubble_5739e699df6294b0=function(e){return c(e).cancelBubble},n.wbg.__wbg_addEventListener_1151978b9ef85f25=function(){return b(function(e,t,r,o,i){c(e).addEventListener(s(t,r),c(o),c(i))},arguments)},n.wbg.__wbg_setchecked_b4c153b5e9fbc166=function(e,t){c(e).checked=t!==0},n.wbg.__wbg_value_a2e4cbb5179fb3b8=function(e,t){let r=c(t).value,o=p(r,a.__wbindgen_malloc,a.__wbindgen_realloc),i=d;l()[e/4+1]=i,l()[e/4+0]=o},n.wbg.__wbg_setvalue_f9de54bc4a5880ce=function(e,t,r){c(e).value=s(t,r)},n.wbg.__wbg_value_6b1ddbb6e9155da3=function(e,t){let r=c(t).value,o=p(r,a.__wbindgen_malloc,a.__wbindgen_realloc),i=d;l()[e/4+1]=i,l()[e/4+0]=o},n.wbg.__wbg_setvalue_5ef50a7282dd6d7e=function(e,t,r){c(e).value=s(t,r)},n.wbg.__wbg_parentElement_5a7090f336d94c74=function(e){let t=c(e).parentElement;return g(t)?0:_(t)},n.wbg.__wbg_lastChild_b2bc9e1e4adf0cda=function(e){let t=c(e).lastChild;return g(t)?0:_(t)},n.wbg.__wbg_setnodeValue_7ed608b56bb5f51b=function(e,t,r){c(e).nodeValue=t===0?void 0:s(t,r)},n.wbg.__wbg_appendChild_f60942b2565cb803=function(){return b(function(e,t){let r=c(e).appendChild(c(t));return _(r)},arguments)},n.wbg.__wbg_insertBefore_d8e803d8ba9a41b8=function(){return b(function(e,t,r){let o=c(e).insertBefore(c(t),c(r));return _(o)},arguments)},n.wbg.__wbg_removeChild_38dc2b8a0f4f0a41=function(){return b(function(e,t){let r=c(e).removeChild(c(t));return _(r)},arguments)},n.wbg.__wbg_document_17e852b4666eac5e=function(e){let t=c(e).document;return g(t)?0:_(t)},n.wbg.__wbg_debug_ca7d8917245536d0=function(e,t,r,o){console.debug(c(e),c(t),c(r),c(o))},n.wbg.__wbg_error_1189b5de6dd1b808=function(e){console.error(c(e))},n.wbg.__wbg_error_4a7b91f097a233a5=function(e,t,r,o){console.error(c(e),c(t),c(r),c(o))},n.wbg.__wbg_info_d4ce670cd6ec6fde=function(e,t,r,o){console.info(c(e),c(t),c(r),c(o))},n.wbg.__wbg_log_50738d2ca2ec904a=function(e,t,r,o){console.log(c(e),c(t),c(r),c(o))},n.wbg.__wbg_warn_2eee9ed96860a8b7=function(e,t,r,o){console.warn(c(e),c(t),c(r),c(o))},n.wbg.__wbg_self_c4a869f7521d7b18=function(){return b(function(){let e=self.self;return _(e)},arguments)},n.wbg.__wbg_window_f76bff89ab6e4c74=function(){return b(function(){let e=window.window;return _(e)},arguments)},n.wbg.__wbg_globalThis_71824672ea2add7c=function(){return b(function(){let e=globalThis.globalThis;return _(e)},arguments)},n.wbg.__wbg_global_f78549112bdb0090=function(){return b(function(){let e=global.global;return _(e)},arguments)},n.wbg.__wbindgen_is_undefined=function(e){return c(e)===void 0},n.wbg.__wbg_newnoargs_4cbce0ba8003ced4=function(e,t){let r=new Function(s(e,t));return _(r)},n.wbg.__wbg_call_875d4ea9abbec88f=function(){return b(function(e,t){let r=c(e).call(c(t));return _(r)},arguments)},n.wbg.__wbg_get_02999bb2caeeff61=function(){return b(function(e,t){let r=Reflect.get(c(e),c(t));return _(r)},arguments)},n.wbg.__wbg_new_fc6bfaed5ca1b77a=function(){let e=new Object;return _(e)},n.wbg.__wbg_valueOf_b57a82897edf3264=function(e){return c(e).valueOf()},n.wbg.__wbg_is_e0a4fb92be049653=function(e,t){return Object.is(c(e),c(t))},n.wbg.__wbg_set_3340302df484a06c=function(){return b(function(e,t,r){return Reflect.set(c(e),c(t),c(r))},arguments)},n.wbg.__wbindgen_debug_string=function(e,t){let r=M(c(t)),o=p(r,a.__wbindgen_malloc,a.__wbindgen_realloc),i=d;l()[e/4+1]=i,l()[e/4+0]=o},n.wbg.__wbindgen_throw=function(e,t){throw new Error(s(e,t))},n.wbg.__wbindgen_closure_wrapper103=function(e,t,r){let o=F(e,t,6,D);return _(o)},n.wbg.__wbindgen_closure_wrapper322=function(e,t,r){let o=N(e,t,111,$);return _(o)},n}function K(n,e){return a=n.exports,j.__wbindgen_wasm_module=e,A=null,x=null,E=null,k=null,a}async function j(n){if(a!==void 0)return a;typeof n>"u"&&(n=new URL("tic_tac_toe_4d_bg.wasm",location));let e=G();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));let{instance:t,module:r}=await H(await n,e);return K(t,r)}var I=j;var L=new Worker("webworker_glue.js"),y;win_callback=n=>{console.log(n),y&&(n===1?(y.unlockAchievement("ttt4Win"),y.updateMetric("ttt4Wins",e=>e+1,0)):n===2?y.updateMetric("ttt4Losses",e=>e+1,0):isDraw&&y.updateMetric("ttt4Draws",e=>e+1,0))};"points"in window&&window.points.then(n=>{y=n});I().then(n=>{let e=O();console.log("rust initiated",e),run_ai_background=t=>{L.postMessage(t),console.log("dispatching")},L.onmessage=t=>{e(t.data)}});})();
//# sourceMappingURL=app.js.map