Files
website/experiments/free-will/app.js
T
2026-08-26 12:44:58 +01:00

2 lines
17 KiB
JavaScript

(()=>{function B(){}function xt(t){return t()}function ut(){return Object.create(null)}function L(t){t.forEach(xt)}function ft(t){return typeof t=="function"}function Ot(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function At(t){return Object.keys(t).length===0}function U(t){return t??""}var bt=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;var pt=class t{_listeners="WeakMap"in bt?new WeakMap:void 0;_observer=void 0;options;constructor(e){this.options=e}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver(e=>{for(let n of e)t.entries.set(n.target,n),this._listeners.get(n.target)?.(n)}))}};pt.entries="WeakMap"in bt?new WeakMap:void 0;var Ct=!1;function Tt(){Ct=!0}function Dt(){Ct=!1}function c(t,e){t.appendChild(e)}function R(t,e,n){t.insertBefore(e,n||null)}function T(t){t.parentNode&&t.parentNode.removeChild(t)}function nt(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function h(t){return document.createElement(t)}function F(t){return document.createTextNode(t)}function E(){return F(" ")}function lt(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function x(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function jt(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function Lt(t){let e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}var rt;function J(t){rt=t}var Y=[];var dt=[],it=[],It=[],ke=Promise.resolve(),$t=!1;function Bt(){$t||($t=!0,ke.then(_t))}function ct(t){it.push(t)}var yt=new Set,ot=0;function _t(){if(ot!==0)return;let t=rt;do{try{for(;ot<Y.length;){let e=Y[ot];ot++,J(e),Fe(e.$$)}}catch(e){throw Y.length=0,ot=0,e}for(J(null),Y.length=0,ot=0;dt.length;)dt.pop()();for(let e=0;e<it.length;e+=1){let n=it[e];yt.has(n)||(yt.add(n),n())}it.length=0}while(Y.length);for(;It.length;)It.pop()();$t=!1,yt.clear(),J(t)}function Fe(t){if(t.fragment!==null){t.update(),L(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(ct)}}function Pt(t){let e=[],n=[];it.forEach(r=>t.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),it=e}var Ee=new Set;function ht(t,e){t&&t.i&&(Ee.delete(t),t.i(e))}function D(t){return t?.length!==void 0?t:Array.from(t)}var Se=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Ne=new Set([...Se]);function Ae(t,e,n){let{fragment:r,after_update:o}=t.$$;r&&r.m(e,n),ct(()=>{let i=t.$$.on_mount.map(xt).filter(ft);t.$$.on_destroy?t.$$.on_destroy.push(...i):L(i),t.$$.on_mount=[]}),o.forEach(ct)}function Ce(t,e){let n=t.$$;n.fragment!==null&&(Pt(n.after_update),L(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Te(t,e){t.$$.dirty[0]===-1&&(Y.push(t),Bt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Wt(t,e,n,r,o,i,s=null,p=[-1]){let a=rt;J(t);let u=t.$$={fragment:null,ctx:[],props:i,update:B,not_equal:o,bound:ut(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:ut(),dirty:p,skip_bound:!1,root:e.target||a.$$.root};s&&s(u.root);let y=!1;if(u.ctx=n?n(t,e.props||{},(d,v,...w)=>{let C=w.length?w[0]:v;return u.ctx&&o(u.ctx[d],u.ctx[d]=C)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](C),y&&Te(t,d)),v}):[],u.update(),y=!0,L(u.before_update),u.fragment=r?r(u.ctx):!1,e.target){if(e.hydrate){Tt();let d=jt(e.target);u.fragment&&u.fragment.l(d),d.forEach(T)}else u.fragment&&u.fragment.c();e.intro&&ht(t.$$.fragment),Ae(t,e.target,e.anchor),Dt(),_t()}J(a)}var De;typeof HTMLElement=="function"&&(De=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,n){super(),this.$$ctor=t,this.$$s=e,n&&this.attachShadow({mode:"open"})}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){let r=this.$$c.$on(t,e);this.$$l_u.set(e,r)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){let r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(o){return()=>{let i;return{c:function(){i=h("slot"),o!=="default"&&x(i,"name",o)},m:function(a,u){R(a,i,u)},d:function(a){a&&T(i)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},n=Lt(this);for(let o of this.$$s)o in n&&(e[o]=[t(o)]);for(let o of this.attributes){let i=this.$$g_p(o.name);i in this.$$d||(this.$$d[i]=wt(i,o.value,this.$$p_d,"toProp"))}for(let o in this.$$p_d)!(o in this.$$d)&&this[o]!==void 0&&(this.$$d[o]=this[o],delete this[o]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});let r=()=>{this.$$r=!0;for(let o in this.$$p_d)if(this.$$d[o]=this.$$c.$$.ctx[this.$$c.$$.props[o]],this.$$p_d[o].reflect){let i=wt(o,this.$$d[o],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[o].attribute||o):this.setAttribute(this.$$p_d[o].attribute||o,i)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let o in this.$$l)for(let i of this.$$l[o]){let s=this.$$c.$on(o,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=wt(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(t){return Object.keys(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function wt(t,e,n,r){let o=n[t]?.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var at=class{$$=void 0;$$set=void 0;$destroy(){Ce(this,1),this.$destroy=B}$on(e,n){if(!ft(n))return B;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{let o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!At(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var qt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(qt);var je=(t,e)=>new Array(t).fill(e),Le=new FinalizationRegistry(t=>{wasm_bindings.dealloc_matrix(t)}),V=(t,e,n)=>{let r={m:t,n:e,data:wasm_bindings.alloc_matrix(t,e,n)};return Le.register(r,r.data),r},P=t=>new Float32Array(wasm_bindings.memory.buffer,wasm_bindings.matrix_buffer(t.data),t.n*t.m),Et=t=>{let e=V(t.length,1,NaN);return P(e).set(t),e},Mt=t=>e=>{let[n,r]=H(e),o=V(n,r,NaN),i=P(o),s=P(e);for(let p=0;p<i.length;p++)i[p]=t(s[p]);return o},H=({m:t,n:e})=>[t,e],vt=(t,e)=>{let[n,r]=H(t),[o,i]=H(e);if(r!==o)throw"actually, mathematics forbids this.";let s=V(n,i,NaN);return wasm_bindings.gemm(t.data,e.data,s.data),s},zt=(t,e)=>{let n=vt(t,e);return n.backward=r=>{e.backward(vt(Gt(t),r)),t.backward(vt(r,Gt(e)))},n},mt=t=>(e,n)=>{let[r,o]=H(e),[i,s]=H(n);if(i!==r||s!==o)throw"no.";let p=V(r,o,0),a=P(p),u=P(e),y=P(n);for(let d=0;d<a.length;d++)a[d]=t(u[d],y[d]);return p},kt=(t,e)=>(t.backward=n=>{let r=P(n),o=P(t);for(let i=0;i<r.length;i++)o[i]-=r[i]*e},t),Re=t=>(t.backward=()=>{},t),Gt=t=>{let[e,n]=H(t),r=V(n,e,NaN);return wasm_bindings.transpose(t.data,r.data),r},Ie=(t,e,n)=>{let[r,o]=H(e),[i,s]=H(n);if(i!==r||s!==o)throw"no.";let p=V(r,o,NaN);return t(e.data,n.data,p.data),p},Be=(t,e)=>Ie(wasm_bindings.hadamard,t,e),Ht=(t,e)=>n=>{let r=Mt(t)(n);return r.backward=o=>n.backward(Be(o,Mt(e)(n))),r},Pe=(t,e)=>{let n=mt((r,o)=>r+o)(t,e);return n.backward=r=>{t.backward(r),e.backward(r)},n},Jt=t=>Math.min(Math.max(Math.log(t),-100),100),We=Ht(Math.tanh,t=>1-Math.tanh(t)**2),Ft=t=>1/(Math.exp(-t)+1),qe=Ht(Ft,t=>Ft(t)*(1-Ft(t))),ze=(t,e)=>{let n=mt((r,o)=>-o*Jt(r)+-(1-o)*Jt(1-r))(t,e);return n.backward=r=>{t.backward(mt((o,i)=>o*i)(r,mt((o,i)=>-i/o+-(i-1)/(1-o))(t,e)))},n},O=32,Ge=.003,Vt=t=>Mt(()=>Math.random()*2*t-t),Ut=(t={})=>{let e=t.learningRate??Ge,n=Math.sqrt(6/(O+O)),r=Math.sqrt(6/(O+1)),o=je(3,null).map(s=>({weight:kt(Vt(n)(V(O,O,NaN)),e),bias:kt(V(O,1,0),e)})),i=kt(Vt(r)(V(1,O,NaN)),e);return{layers:o,outputProjection:i,learningRate:e}},Xt=(t,e)=>{let n=Re(Et(t));for(let r of e.layers)n=Pe(zt(r.weight,n),r.bias),n=We(n);return n=zt(e.outputProjection,n),n=qe(n),n};var Yt=(t,e)=>{let n=Xt(e,t);return P(n)[0]},Zt=(t,e,n)=>{let r=Xt(e,t),o=P(r)[0];return isNaN(o)?!1:(ze(r,Et([n])).backward(Et([1])),!0)},Kt=(t,e,n={})=>{let r=n.replaySteps??4,o=n.replayWindow??64,i=n.random??Math.random,s=!1;for(t.training_step??=0;t.training_step<e.length-O;t.training_step++){let y=e.slice(t.training_step,t.training_step+O),d=e[t.training_step+O];if(!Zt(t,y,d))return!1;s=!0}if(!s)return!0;let p=e.length-1,a=Math.max(O,p-o+1),u=p-a+1;for(let y=0;y<r;y++){let d=a+Math.floor(i()*u),v=e.slice(d-O,d);if(!Zt(t,v,e[d]))return!1}return!0};var Qt=(t,e={})=>{if(!Number.isInteger(t)||t<1)throw new RangeError("order must be a positive integer");return{order:t,priorOnes:e.priorOnes??1,priorTotal:e.priorTotal??2,counts:new Map}},te=(t,e)=>e.slice(-t.order).join(""),ee=(t,e)=>{if(e.length<t.order)return .5;let n=t.counts.get(te(t,e));return n?n[0]/n[1]:t.priorOnes/t.priorTotal},ne=(t,e,n)=>{if(e.length<t.order)return;let r=te(t,e),o=t.counts.get(r)??[t.priorOnes,t.priorTotal];o[0]+=n,o[1]+=1,t.counts.set(r,o)};function re(t,e,n){let r=t.slice();return r[18]=e[n],r[20]=n,r}function oe(t,e,n){let r=t.slice();return r[21]=e[n],r}function ie(t,e,n){let r=t.slice();return r[21]=e[n],r}function se(t,e,n){let r=t.slice();return r[18]=e[n],r[20]=n,r}function le(t,e,n){let r=t.slice();return r[21]=e[n],r}function ce(t){let e,n=t[21]===1?"\u2190":"\u2192",r,o;return{c(){e=h("td"),r=F(n),x(e,"class",o=U(t[21]===1?"val s1":"val s0")+" svelte-e31mm4")},m(i,s){R(i,e,s),c(e,r)},p(i,s){s&19&&n!==(n=i[21]===1?"\u2190":"\u2192")&&X(r,n),s&19&&o!==(o=U(i[21]===1?"val s1":"val s0")+" svelte-e31mm4")&&x(e,"class",o)},d(i){i&&T(e)}}}function ae(t){let e,n,r,o=D(t[1][t[20]].slice(-t[4],t[0].length)),i=[];for(let s=0;s<o.length;s+=1)i[s]=ce(le(t,o,s));return{c(){e=h("tr"),n=h("td"),n.textContent=`Markov-${t[18]}:`,r=E();for(let s=0;s<i.length;s+=1)i[s].c();x(n,"class","label svelte-e31mm4")},m(s,p){R(s,e,p),c(e,n),c(e,r);for(let a=0;a<i.length;a+=1)i[a]&&i[a].m(e,null)},p(s,p){if(p&19){o=D(s[1][s[20]].slice(-s[4],s[0].length));let a;for(a=0;a<o.length;a+=1){let u=le(s,o,a);i[a]?i[a].p(u,p):(i[a]=ce(u),i[a].c(),i[a].m(e,null))}for(;a<i.length;a+=1)i[a].d(1);i.length=o.length}},d(s){s&&T(e),nt(i,s)}}}function ue(t){let e,n=t[21]===1?"\u2190":"\u2192",r,o;return{c(){e=h("td"),r=F(n),x(e,"class",o=U(t[21]===1?"val s1":"val s0")+" svelte-e31mm4")},m(i,s){R(i,e,s),c(e,r)},p(i,s){s&21&&n!==(n=i[21]===1?"\u2190":"\u2192")&&X(r,n),s&21&&o!==(o=U(i[21]===1?"val s1":"val s0")+" svelte-e31mm4")&&x(e,"class",o)},d(i){i&&T(e)}}}function fe(t){let e,n=t[21]===1?"\u2190":"\u2192",r,o;return{c(){e=h("td"),r=F(n),x(e,"class",o=U(t[21]===1?"val s1":"val s0")+" svelte-e31mm4")},m(i,s){R(i,e,s),c(e,r)},p(i,s){s&17&&n!==(n=i[21]===1?"\u2190":"\u2192")&&X(r,n),s&17&&o!==(o=U(i[21]===1?"val s1":"val s0")+" svelte-e31mm4")&&x(e,"class",o)},d(i){i&&T(e)}}}function pe(t){let e,n,r,o,i,s,p,a=Math.min(gt,t[0].length)+"",u,y,d,v,w,C,k,W,I,q=(t[8](t[2])*100).toFixed(0)+"",z,j,$=D(t[5]),_=[];for(let m=0;m<$.length;m+=1)_[m]=de(re(t,$,m));return{c(){e=h("table"),n=h("thead"),r=h("tr"),o=h("th"),o.textContent="Predictor",i=E(),s=h("th"),p=F("Accuracy (last "),u=F(a),y=F(")"),d=E(),v=h("tbody");for(let m=0;m<_.length;m+=1)_[m].c();w=E(),C=h("tr"),k=h("td"),k.textContent="NN",W=E(),I=h("td"),z=F(q),j=F("%"),x(o,"class","svelte-e31mm4"),x(s,"class","svelte-e31mm4"),x(k,"class","svelte-e31mm4"),x(I,"class","svelte-e31mm4"),x(e,"class","accuracy svelte-e31mm4")},m(m,b){R(m,e,b),c(e,n),c(n,r),c(r,o),c(r,i),c(r,s),c(s,p),c(s,u),c(s,y),c(e,d),c(e,v);for(let g=0;g<_.length;g+=1)_[g]&&_[g].m(v,null);c(v,w),c(v,C),c(C,k),c(C,W),c(C,I),c(I,z),c(I,j)},p(m,b){if(b&1&&a!==(a=Math.min(gt,m[0].length)+"")&&X(u,a),b&290){$=D(m[5]);let g;for(g=0;g<$.length;g+=1){let K=re(m,$,g);_[g]?_[g].p(K,b):(_[g]=de(K),_[g].c(),_[g].m(v,w))}for(;g<_.length;g+=1)_[g].d(1);_.length=$.length}b&4&&q!==(q=(m[8](m[2])*100).toFixed(0)+"")&&X(z,q)},d(m){m&&T(e),nt(_,m)}}}function de(t){let e,n,r,o,i=(t[8](t[1][t[20]])*100).toFixed(0)+"",s,p;return{c(){e=h("tr"),n=h("td"),n.textContent=`Markov-${t[18]}`,r=E(),o=h("td"),s=F(i),p=F("%"),x(n,"class","svelte-e31mm4"),x(o,"class","svelte-e31mm4")},m(a,u){R(a,e,u),c(e,n),c(e,r),c(e,o),c(o,s),c(o,p)},p(a,u){u&2&&i!==(i=(a[8](a[1][a[20]])*100).toFixed(0)+"")&&X(s,i)},d(a){a&&T(e)}}}function Je(t){let e,n,r,o,i,s,p,a,u,y,d,v,w,C,k,W,I,q,z,j,$,_,m,b,g,K,Nt,Q=D(t[5]),M=[];for(let f=0;f<Q.length;f+=1)M[f]=ae(se(t,Q,f));let tt=D(t[2].slice(-t[4],t[0].length)),S=[];for(let f=0;f<tt.length;f+=1)S[f]=ue(ie(t,tt,f));let et=D(t[0].slice(-t[4],t[0].length)),N=[];for(let f=0;f<et.length;f+=1)N[f]=fe(oe(t,et,f));let A=t[0].length>0&&pe(t);return{c(){e=h("div"),n=h("div"),r=h("button"),r.textContent="\u2190 Left",o=E(),i=h("button"),i.textContent="\u2192 Right",s=E(),p=h("br"),a=E(),u=h("table");for(let f=0;f<M.length;f+=1)M[f].c();y=E(),d=h("tr"),v=h("td"),v.textContent="NN:",w=E();for(let f=0;f<S.length;f+=1)S[f].c();C=E(),k=h("tr"),W=h("td"),W.textContent="Actual:",I=E();for(let f=0;f<N.length;f+=1)N[f].c();q=E(),A&&A.c(),z=E(),j=h("p"),$=F("This is based on the "),_=h("a"),_.textContent="Aaronson oracle",m=F(" concept. Optimal free will is ~50% on all predictors. Press "),b=F(t[6]),g=F("."),x(r,"class","svelte-e31mm4"),x(i,"class","svelte-e31mm4"),x(n,"class","buttons svelte-e31mm4"),x(v,"class","label svelte-e31mm4"),x(W,"class","label svelte-e31mm4"),x(u,"class","sequence svelte-e31mm4"),x(_,"href","https://roadtolarissa.com/oracle/"),x(e,"id","app"),x(e,"tabindex","0"),x(e,"class","svelte-e31mm4")},m(f,G){R(f,e,G),c(e,n),c(n,r),c(n,o),c(n,i),c(e,s),c(e,p),c(e,a),c(e,u);for(let l=0;l<M.length;l+=1)M[l]&&M[l].m(u,null);c(u,y),c(u,d),c(d,v),c(d,w);for(let l=0;l<S.length;l+=1)S[l]&&S[l].m(d,null);c(u,C),c(u,k),c(k,W),c(k,I);for(let l=0;l<N.length;l+=1)N[l]&&N[l].m(k,null);c(e,q),A&&A.m(e,null),c(e,z),c(e,j),c(j,$),c(j,_),c(j,m),c(j,b),c(j,g),t[12](e),K||(Nt=[lt(r,"click",t[10]),lt(i,"click",t[11]),lt(e,"keydown",t[9])],K=!0)},p(f,[G]){if(G&51){Q=D(f[5]);let l;for(l=0;l<Q.length;l+=1){let Z=se(f,Q,l);M[l]?M[l].p(Z,G):(M[l]=ae(Z),M[l].c(),M[l].m(u,y))}for(;l<M.length;l+=1)M[l].d(1);M.length=Q.length}if(G&21){tt=D(f[2].slice(-f[4],f[0].length));let l;for(l=0;l<tt.length;l+=1){let Z=ie(f,tt,l);S[l]?S[l].p(Z,G):(S[l]=ue(Z),S[l].c(),S[l].m(d,null))}for(;l<S.length;l+=1)S[l].d(1);S.length=tt.length}if(G&17){et=D(f[0].slice(-f[4],f[0].length));let l;for(l=0;l<et.length;l+=1){let Z=oe(f,et,l);N[l]?N[l].p(Z,G):(N[l]=fe(Z),N[l].c(),N[l].m(k,null))}for(;l<N.length;l+=1)N[l].d(1);N.length=et.length}f[0].length>0?A?A.p(f,G):(A=pe(f),A.c(),A.m(e,z)):A&&(A.d(1),A=null)},i:B,o:B,d(f){f&&T(e),nt(M,f),nt(S,f),nt(N,f),A&&A.d(),t[12](null),K=!1,L(Nt)}}}var gt=100,Ve=20;function Ze(t,e,n){let r=[1,2,3,4],o=["d","ArrowLeft","1"],i=["f","ArrowRight","0"],s=o.map(($,_)=>`${$}/${i[_]}`).join(", "),p=[],a=r.map(()=>[]),u=[],y,d=32,v=r.map(Qt),w=[],C=$=>{if(w.length===0)return .5;let _=[];for(let b of w)_.push(Math.min(1-1e-7,Math.max(1e-7,Yt(b,$.slice(-O)))));let m=_.map(b=>Math.log(b/(1-b))).reduce((b,g)=>b+g,0)/_.length;return 1/(1+Math.exp(-m))},k=$=>{for(v.forEach((b,g)=>{a[g].push(+(ee(b,p)>=.5)),ne(b,p,$)}),n(1,a),u.push(+(C(p)>=.5)),n(2,u),p.push($),n(0,p);!(p.length<O+1);){for(;w.length<Ve;)w.push(Ut());let b=w.filter(g=>Kt(g,p));if(b.length===w.length)break;console.warn(`Replaced ${w.length-b.length} NN model(s) after a non-finite update`),w=b}if(window.models=w,!y)return;let _=y.querySelector("table td.val"),m=y.querySelector("table td.label");_&&n(4,d=Math.floor((y.getBoundingClientRect().width-m.getBoundingClientRect().width)/_.getBoundingClientRect().width))},W=$=>{let _=p.slice(-gt),m=$.slice(-gt);return _.filter((b,g)=>b===m[g]).length/_.length},I=$=>{o.includes($.key)?k(1):i.includes($.key)&&k(0)},q=()=>k(1),z=()=>k(0);function j($){dt[$?"unshift":"push"](()=>{y=$,n(3,y)})}return[p,a,u,y,d,r,s,k,W,I,q,z,j]}var St=class extends at{constructor(e){super(),Wt(this,e,Ze,Je,Ot,{})}},_e=St;var st;function He(t,e){let n=new Uint8Array(st.exports.memory.buffer,t,e);console.log("WASM",new TextDecoder().decode(n))}var he={env:{memory:new WebAssembly.Memory({initial:5,maximum:500}),console_log_ex:He}},Ue=async()=>{if(typeof window<"u")return WebAssembly.instantiateStreaming(fetch("gemm.wasm"),he);let t=new Function("specifier","return import(specifier)"),{readFile:e}=await t("node:fs/promises");return WebAssembly.instantiate(await e("static/gemm.wasm"),he)},me=Ue().then(t=>(st=t.instance,st.exports.init_debug(),globalThis.wasm_instance=st,globalThis.wasm_bindings=st.exports,st.exports));me.then(()=>{new _e({target:document.querySelector("#app")})});})();