@datagrok/eda 1.2.0 → 1.2.1

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.
@@ -1,2 +1,2 @@
1
- var eda_test;(()=>{var t={5540:(t,e,n)=>{"use strict";t=n.hmd(t);var o,r=(o="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,r=void 0!==t?t:{};r.ready=new Promise((function(t,o){e=t,n=o}));var s,i=Object.assign({},r),a="object"==typeof window,c="function"==typeof importScripts,l=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||c)&&(c?l=self.location.href:"undefined"!=typeof document&&document.currentScript&&(l=document.currentScript.src),o&&(l=o),l=0!==l.indexOf("blob:")?l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):"",c&&(s=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),r.print||console.log.bind(console);var u,h,f=r.printErr||console.warn.bind(console);Object.assign(r,i),i=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(u=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&b("no native wasm support detected");var m,d,y,p=!1;function g(){var t=h.buffer;r.HEAP8=m=new Int8Array(t),r.HEAP16=new Int16Array(t),r.HEAP32=new Int32Array(t),r.HEAPU8=d=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=y=new Uint32Array(t),r.HEAPF32=new Float32Array(t),r.HEAPF64=new Float64Array(t)}var C=[],A=[],w=[],E=0,v=null,x=null;function b(t){r.onAbort&&r.onAbort(t),f(t="Aborted("+t+")"),p=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var S,_;function M(t){return t.startsWith("data:application/octet-stream;base64,")}function N(t){try{if(t==S&&u)return new Uint8Array(u);if(s)return s(t);throw"both async and sync fetching of the wasm failed"}catch(t){b(t)}}function I(t,e,n){return function(t){return u||!a&&!c||"function"!=typeof fetch?Promise.resolve().then((function(){return N(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return N(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){f("failed to asynchronously prepare wasm: "+t),b(t)}))}function T(t){for(;t.length>0;)t.shift()(r)}function O(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){y[this.ptr+4>>2]=t},this.get_type=function(){return y[this.ptr+4>>2]},this.set_destructor=function(t){y[this.ptr+8>>2]=t},this.get_destructor=function(){return y[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,m[this.ptr+12|0]=t},this.get_caught=function(){return 0!=m[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,m[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=m[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){y[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return y[this.ptr+16>>2]},this.get_exception_ptr=function(){if(G(this.get_type()))return y[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function R(t){var e=h.buffer;try{return h.grow(t-e.byteLength+65535>>>16),g(),1}catch(t){}}function L(t){return r["_"+t]}M(S="wasmDbscan.wasm")||(_=S,S=r.locateFile?r.locateFile(_,l):l+_);var D="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function P(t,e,n,o,r){var s={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,n=0;n<t.length;++n){var o=t.charCodeAt(n);o<=127?e++:o<=2047?e+=2:o>=55296&&o<=57343?(e+=4,++n):e+=3}return e}(t)+1,n=H(e);return function(t,e,n){!function(t,e,n,o){if(!(o>0))return 0;for(var r=n+o-1,s=0;s<t.length;++s){var i=t.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&t.charCodeAt(++s)),i<=127){if(n>=r)break;e[n++]=i}else if(i<=2047){if(n+1>=r)break;e[n++]=192|i>>6,e[n++]=128|63&i}else if(i<=65535){if(n+2>=r)break;e[n++]=224|i>>12,e[n++]=128|i>>6&63,e[n++]=128|63&i}else{if(n+3>=r)break;e[n++]=240|i>>18,e[n++]=128|i>>12&63,e[n++]=128|i>>6&63,e[n++]=128|63&i}}e[n]=0}(t,d,e,n)}(t,n,e),n}(t)),e},array:t=>{var e,n,o=H(t.length);return e=t,n=o,m.set(e,n),o}},i=L(t),a=[],c=0;if(o)for(var l=0;l<o.length;l++){var u=s[n[l]];u?(0===c&&(c=B()),a[l]=u(o[l])):a[l]=o[l]}var h=i.apply(null,a);return function(t){return 0!==c&&k(c),function(t){return"string"===e?(n=t)?function(t,e,n){for(var o=e+n,r=e;t[r]&&!(r>=o);)++r;if(r-e>16&&t.buffer&&D)return D.decode(t.subarray(e,r));for(var s="";e<r;){var i=t[e++];if(128&i){var a=63&t[e++];if(192!=(224&i)){var c=63&t[e++];if((i=224==(240&i)?(15&i)<<12|a<<6|c:(7&i)<<18|a<<12|c<<6|63&t[e++])<65536)s+=String.fromCharCode(i);else{var l=i-65536;s+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else s+=String.fromCharCode((31&i)<<6|a)}else s+=String.fromCharCode(i)}return s}(d,n,o):"":"boolean"===e?Boolean(t):t;var n,o}(t)}(h)}var F,U={__cxa_throw:function(t,e,n){throw new O(t).init(e,n),t},abort:function(){b("")},emscripten_memcpy_big:function(t,e,n){d.copyWithin(t,e,e+n)},emscripten_resize_heap:function(t){var e,n=d.length,o=2147483648;if((t>>>=0)>o)return!1;for(var r=1;r<=4;r*=2){var s=n*(1+.2/r);if(s=Math.min(s,t+100663296),R(Math.min(o,(e=Math.max(t,s))+(65536-e%65536)%65536)))return!0}return!1}},B=(function(){var t,e,o,s,i={env:U,wasi_snapshot_preview1:U};function a(t,e){var n,o=t.exports;return r.asm=o,h=r.asm.memory,g(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,A.unshift(n),function(){if(E--,r.monitorRunDependencies&&r.monitorRunDependencies(E),0==E&&(null!==v&&(clearInterval(v),v=null),x)){var t=x;x=null,t()}}(),o}if(E++,r.monitorRunDependencies&&r.monitorRunDependencies(E),r.instantiateWasm)try{return r.instantiateWasm(i,a)}catch(t){f("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=u,e=S,o=i,s=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||M(e)||"function"!=typeof fetch?I(e,o,s):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,o).then(s,(function(t){return f("wasm streaming compile failed: "+t),f("falling back to ArrayBuffer instantiation"),I(e,o,s)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(B=r.asm.stackSave).apply(null,arguments)}),k=function(){return(k=r.asm.stackRestore).apply(null,arguments)},H=function(){return(H=r.asm.stackAlloc).apply(null,arguments)},G=function(){return(G=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function t(){F||(F=!0,r.calledRun=!0,p||(T(A),e(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)t=r.postRun.shift(),w.unshift(t);var t;T(w)}()))}E>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)t=r.preRun.shift(),C.unshift(t);var t;T(C)}(),E>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),t()}),1)):t()))}if(r.ccall=P,r.cwrap=function(t,e,n,o){var r=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&r&&!o?L(t):function(){return P(t,e,n,arguments)}},x=function t(){F||V(),F||(x=t)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return V(),t.ready});"object"==typeof exports?t.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},9982:function(t,e,n){var o;!function(){var e={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,o,r,s){for(var i,a,c,l,u,h,f,m,d,y,p,g,C;s>=64;){for(i=n[0],a=n[1],c=n[2],l=n[3],u=n[4],h=n[5],f=n[6],m=n[7],y=0;y<16;y++)p=r+4*y,t[y]=(255&o[p])<<24|(255&o[p+1])<<16|(255&o[p+2])<<8|255&o[p+3];for(y=16;y<64;y++)g=((d=t[y-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,C=((d=t[y-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,t[y]=(g+t[y-7]|0)+(C+t[y-16]|0);for(y=0;y<64;y++)g=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&f)|0)+(m+(e[y]+t[y]|0)|0)|0,C=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&c^a&c)|0,m=f,f=h,h=u,u=l+g|0,l=c,c=a,a=i,i=g+C|0;n[0]+=i,n[1]+=a,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=h,n[6]+=f,n[7]+=m,r+=64,s-=64}return r}var o=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var o=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[o++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(o=n(this.temp,this.state,t,o,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[o++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,o=this.bufferLength,r=e/536870912|0,s=e<<3,i=e%64<56?64:128;this.buffer[o]=128;for(var a=o+1;a<i-8;a++)this.buffer[a]=0;this.buffer[i-8]=r>>>24&255,this.buffer[i-7]=r>>>16&255,this.buffer[i-6]=r>>>8&255,this.buffer[i-5]=r>>>0&255,this.buffer[i-4]=s>>>24&255,this.buffer[i-3]=s>>>16&255,this.buffer[i-2]=s>>>8&255,this.buffer[i-1]=s>>>0&255,n(this.temp,this.state,this.buffer,0,i),this.finished=!0}for(a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=o;var r=function(){function t(t){this.inner=new o,this.outer=new o,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new o).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function s(t){var e=(new o).update(t),n=e.digest();return e.clean(),n}function i(t,e){var n=new r(t).update(e),o=n.digest();return n.clean(),o}function a(t,e,n,o){var r=o[0];if(0===r)throw new Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(o),e.finish(t),o[0]++}t.HMAC=r,t.hash=s,t.default=s,t.hmac=i;var c=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,o){void 0===e&&(e=c),void 0===o&&(o=32);for(var s=new Uint8Array([1]),l=i(e,t),u=new r(l),h=new Uint8Array(u.digestLength),f=h.length,m=new Uint8Array(o),d=0;d<o;d++)f===h.length&&(a(h,u,n,s),f=0),m[d]=h[f++];return u.clean(),h.fill(0),s.fill(0),m},t.pbkdf2=function(t,e,n,o){for(var s=new r(t),i=s.digestLength,a=new Uint8Array(4),c=new Uint8Array(i),l=new Uint8Array(i),u=new Uint8Array(o),h=0;h*i<o;h++){var f=h+1;a[0]=f>>>24&255,a[1]=f>>>16&255,a[2]=f>>>8&255,a[3]=f>>>0&255,s.reset(),s.update(e),s.update(a),s.finish(l);for(var m=0;m<i;m++)c[m]=l[m];for(m=2;m<=n;m++){s.reset(),s.update(l).finish(l);for(var d=0;d<i;d++)c[d]^=l[d]}for(m=0;m<i&&h*i+m<o;m++)u[h*i+m]=c[m]}for(h=0;h<i;h++)c[h]=l[h]=0;for(h=0;h<4;h++)a[h]=0;return s.clean(),u}}(e);var r=e.default;for(var s in e)r[s]=e[s];"object"==typeof t.exports?t.exports=r:void 0===(o=function(){return r}.call(e,n,e,t))||(t.exports=o)}()},944:(t,e)=>{"use strict";e.Vb=void 0,e.Vb=function(t,e,n){var o=function(t,e,n){if(0===t.length||0===e.length)return 0;if(n&&!n.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var o=0,r=t.length,s=e.length,i=Math.floor(Math.max(r,s)/2)-1,a=new Array(r),c=new Array(s),l=0;l<r;l++)for(var u=Math.max(0,l-i);u<=Math.min(s,l+i+1);u++)if(!a[l]&&!c[u]&&t[l]===e[u]){++o,a[l]=c[u]=!0;break}if(0===o)return 0;var h=0,f=0;for(l=0;l<r;l++)if(a[l]){for(;!c[f];)f++;t.charAt(l)!==e.charAt(f++)&&h++}return(o/r+o/s+(o-(h/=2))/o)/3}(t,e,n),r=0;if(o>.7){for(var s=Math.min(t.length,e.length),i=0;t[i]===e[i]&&i<4&&i<s;)++r,i++;o+=.1*r*(1-o)}return o}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var s=e[o]={id:o,loaded:!1,exports:{}};return t[o].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}n.m=t,n.amdO={},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var o=e.getElementsByTagName("script");if(o.length)for(var r=o.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=o[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),n.b=document.baseURI||self.location.href;var o={};(()=>{"use strict";n.r(o),n.d(o,{_package:()=>ln,test:()=>un,tests:()=>f});const t=DG,e=grok;n(9982);const r=t.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');r.columns.add(t.Column.fromList(t.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var s=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const i=3e4,a=108e5,c=console.log.bind(console),l=console.info.bind(console),u=console.warn.bind(console),h=console.error.bind(console),f={},m="Auto Tests",d="Demo",y="Detectors",p="Core",g={};let C;var A,w,E,v,x,b,S,_,M,N;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(A||(A={}));class I{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class T{constructor(t,e,n,o){var r;this.category=t,this.name=e,null!=o||(o={}),null!==(r=o.timeout)&&void 0!==r||(o.timeout=i),this.options=o,this.test=()=>s(this,void 0,void 0,(function*(){return new Promise(((t,e)=>s(this,void 0,void 0,(function*(){let o="";try{o=yield n()}catch(t){e(t)}t(o)}))))}))}}function O(t,e,n){null==f[C]&&(f[C]={}),null==f[C].tests&&(f[C].tests=[]),f[C].tests.push(new T(C,t,e,n))}function R(t,e=!0,n){if(n=n?`${n}, `:"",t!==e)throw new Error(`${n}Expected "${e}", got "${t}"`)}function L(t,e,n){var o;C=t,e(),f[C]&&(f[C].clear=null===(o=null==n?void 0:n.clear)||void 0===o||o,f[C].timeout=null==n?void 0:n.timeout,f[C].benchmarks=null==n?void 0:n.benchmarks,f[C].stressTests=null==n?void 0:n.stressTests)}function D(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function P(n){var o,a,C,A;return s(this,void 0,void 0,(function*(){const w=null===(a=null===(o=e.functions.getCurrentCall())||void 0===o?void 0:o.func)||void 0===a?void 0:a.package;yield function(n){var o,a,c,l;return s(this,void 0,void 0,(function*(){const u=n.id;if(g[u])return;const h=f;if(void 0!==h[m]||void 0!==h[d]||Object.keys(h).find((t=>t.startsWith(m)||t.startsWith(p))))return void(g[u]=!0);if("DevTools"===n.name)for(const t of window.dartTests){const e=t.name.split(/\s*\|\s*!/g);let n=null!==(o=e.pop())&&void 0!==o?o:t.name,r=e.length?p+": "+e.join(": "):p,s=n.split(" | ");n=s[s.length-1],s.unshift(r),s.pop(),r=s.join(": "),void 0===h[r]&&(h[r]={tests:[],clear:!0}),h[r].tests.push(new T(r,n,t.test,{isAggregated:!1,timeout:null!==(c=null===(a=t.options)||void 0===a?void 0:a.timeout)&&void 0!==c?c:i,skipReason:null===(l=t.options)||void 0===l?void 0:l.skipReason}))}const C=[],A=[],w=[],E=yield e.dapi.functions.filter(`package.id = "${u}"`).list(),v=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const n of E){const o=n.options.test,i=n.options.demoPath;if(o&&Array.isArray(o)&&o.length)for(let r=0;r<o.length;r++){const i=o[r].matchAll(v),a={};Array.from(i).forEach((t=>{t[0].startsWith("skip")?a.skip=t[1]:t[0].startsWith("wait")?a.wait=parseInt(t[2]):t[0].startsWith("cat")?a.cat=t[3]:t[0].startsWith("timeout")&&(a.timeout=parseInt(t[4]))}));const c=new T(m,1===o.length?n.name:`${n.name} ${r+1}`,(()=>s(this,void 0,void 0,(function*(){const t=yield e.functions.eval(D(o[r],n));if(a.wait&&(yield B(a.wait)),"boolean"==typeof t&&!t)throw`Failed: ${o[r]}, expected true, got ${t}`}))),{skipReason:a.skip,timeout:t.Test.isInBenchmark?a.benchmarkTimeout:a.timeout});if(a.cat){const t=m+": "+a.cat;c.category=t,void 0===h[t]&&(h[t]={tests:[],clear:!0}),h[t].tests.push(c)}else C.push(c)}if(i){const o=n.options.demoWait?parseInt(n.options.demoWait):void 0,r=new T(d,n.friendlyName,(()=>s(this,void 0,void 0,(function*(){e.shell.isInDemo=!0,void 0===e.shell.view(t.View.BROWSE)&&(e.shell.v=t.View.createByType(t.View.BROWSE)),yield B(300),e.shell.clearLastError(),yield n.apply(),yield B(o||2e3);const r=yield e.shell.lastError;if(r)throw new Error(r);e.shell.isInDemo=!1}))),{skipReason:n.options.demoSkip});A.push(r)}if(n.hasTag("semTypeDetector")){const t=new T(y,n.friendlyName,(()=>s(this,void 0,void 0,(function*(){const t=[];for(const e of r.clone().columns){const o=yield n.apply([e]);t.push(o||e.semType)}R(t.filter((t=>t)).length,1)}))),{skipReason:n.options.skipTest});w.push(t)}}g[u]=!0,C.length&&(h[m]={tests:C,clear:!0}),A.length&&(h[d]={tests:A,clear:!0}),w.length&&(h[y]={tests:w,clear:!1})}))}(w);const E=[];console.log("Running tests"),null!=n||(n={}),null!==(C=(A=n).testContext)&&void 0!==C||(A.testContext=new I),e.shell.clearLastError();const v=function(){const t=[];return console.log=(...e)=>{t.push(...e),c(...e)},console.info=(...e)=>{t.push(...e),l(...e)},console.warn=(...e)=>{t.push(...e),u(...e)},console.error=(...e)=>{t.push(...e),h(...e)},t}();(null==n?void 0:n.stressTest)?yield function(e){var n,o,r,i,a,c;return s(this,void 0,void 0,(function*(){let s=[];for(const[t,e]of Object.entries(f)){let t=null===(n=e.tests)||void 0===n?void 0:n.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest}));e.stressTests&&(t=null===(o=e.tests)||void 0===o?void 0:o.filter((t=>{var e,n;return void 0===(null===(e=t.options)||void 0===e?void 0:e.stressTest)||!0===(null===(n=t.options)||void 0===n?void 0:n.stressTest)})));const a=null===(r=e.tests)||void 0===r?void 0:r.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));if(!a)for(let n of null!=t?t:[])null==(null===(i=n.options)||void 0===i?void 0:i.skipReason)&&s.push({test:n,value:e})}s=function(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}(s);const l=[];for(let n of s){yield x(n.value.before,null!==(a=e.category)&&void 0!==a?a:"");let o=yield U(n.test,null==e?void 0:e.test,v,t.Test.isInBenchmark?n.value.benchmarkTimeout:n.value.timeout,w.name,e.verbose);o&&l.push(o),console.log(`Test: ${null==O?void 0:O.name}; result: ${o}`),yield x(n.value.after,null!==(c=e.category)&&void 0!==c?c:"")}E.push(...l)}))}(n):yield function(n,o){var r,i,a,f,m,d,y;return s(this,void 0,void 0,(function*(){try{for(const[s,l]of Object.entries(n)){if((null==o?void 0:o.category)&&!s.toLowerCase().startsWith(null==o?void 0:o.category.toLowerCase())||(null===(r=o.exclude)||void 0===r?void 0:r.some((t=>s.startsWith(t)))))continue;c(`Started ${s} category`);const n=null===(i=l.tests)||void 0===i?void 0:i.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));n||(l.beforeStatus=yield x(l.before,null!==(a=o.category)&&void 0!==a?a:""));const u=null!==(f=l.tests)&&void 0!==f?f:[],h=[];if(l.clear)for(let n=0;n<u.length;n++){u[n].options&&void 0===(null===(m=u[n].options)||void 0===m?void 0:m.benchmark)&&(u[n].options||(u[n].options={}),u[n].options.benchmark=null!==(d=l.benchmarks)&&void 0!==d&&d);let r=yield U(u[n],null==o?void 0:o.test,v,t.Test.isInBenchmark?l.benchmarkTimeout:l.timeout,w.name,o.verbose);r&&h.push(r),e.shell.closeAll(),t.Balloon.closeAll()}else for(let e=0;e<u.length;e++){let n=yield U(u[e],null==o?void 0:o.test,v,t.Test.isInBenchmark?l.benchmarkTimeout:l.timeout,w.name,o.verbose);n&&h.push(n)}const p=h.filter((t=>"skipped"!=t.result));n||(l.afterStatus=yield x(l.after,null!==(y=o.category)&&void 0!==y?y:"")),l.afterStatus&&p.push({date:(new Date).toISOString(),logs:"",category:s,name:"after",result:l.afterStatus,success:!1,ms:0,skipped:!1}),l.beforeStatus&&p.push({date:(new Date).toISOString(),logs:"",category:s,name:"before",result:l.beforeStatus,success:!1,ms:0,skipped:!1}),E.push(...p)}}finally{console.log=c,console.info=l,console.warn=u,console.error=h}if(o.testContext.catchUnhandled&&!t.Test.isInBenchmark){yield B(1e3);const t=yield e.shell.lastError,n={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=t?t:"",success:!t,ms:0,skipped:!1};E.push(n),n.package=w.name,null!=e.shell.reportTest?yield e.shell.reportTest("package",n):yield fetch(`${e.dapi.root}/log/tests/package`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(n)})}}))}(f,n);for(let t of E)t.result=t.result.toString().replace(/"/g,"'"),null!=t.logs&&(t.logs=t.logs.toString().replace(/"/g,"'"));return E;function x(t,e){return s(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==t&&(yield k((()=>s(this,void 0,void 0,(function*(){yield t()}))),1e5,`before ${e}: timeout error`))}catch(t){n=yield F(t)}return n}))}}))}function F(e){return s(this,void 0,void 0,(function*(){return`${e.toString()}\n${e.stack?yield t.Logger.translateStackTrace(e.stack):""}`}))}function U(n,o,r,l,u,f){var m,d,y,p,g,C,A,w;return s(this,void 0,void 0,(function*(){let s;r.length=0;let E="package";const v=null!=o&&n.name.toLowerCase()!==o.toLowerCase();let x=(null===(m=n.options)||void 0===m?void 0:m.skipReason)||v,b=v?"skipped":null===(d=n.options)||void 0===d?void 0:d.skipReason;if(t.Test.isInBenchmark&&!(null===(y=n.options)||void 0===y?void 0:y.benchmark))return void c(`SKIPPED: ${n.category} ${n.name} doesnt available in benchmark mode`);x||c(`Started ${n.category} ${n.name}`);const S=Date.now();try{if(x)s={date:(new Date).toISOString(),success:!0,result:b,ms:0,skipped:!0};else{let e=(null===(p=n.options)||void 0===p?void 0:p.timeout)===i&&l?l:null===(g=n.options)||void 0===g?void 0:g.timeout;e=e===i&&t.Test.isInBenchmark?a:e,s={date:(new Date).toISOString(),success:!0,result:null!==(C=yield k(n.test,e))&&void 0!==C?C:"OK",ms:0,skipped:!1}}}catch(t){h(t),s={date:(new Date).toISOString(),success:!1,result:yield F(t),ms:0,skipped:!1}}if((null===(A=n.options)||void 0===A?void 0:A.isAggregated)&&s.result.constructor===t.DataFrame){const t=s.result.col("success");if(t&&(s.success=t.stats.sum===t.length),!f){const t=s.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),s.result=t}s.result=s.result.toCsv()}if(s.logs=r.join("\n"),s.ms=Date.now()-S,x||c(`Finished ${n.category} ${n.name} for ${s.ms} ms`),s.category=n.category,s.name=n.name,!v){let o={success:s.success,result:s.result,ms:s.ms,skipped:s.skipped,package:u,category:n.category,name:n.name,logs:s.logs};if(s.result.constructor==Object){const t=Object.keys(s.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:s.result[e]})),{});o=Object.assign(Object.assign({},o),t)}o.result instanceof t.DataFrame&&(o.result=JSON.stringify(null===(w=o.result)||void 0===w?void 0:w.toJson())||""),null!=e.shell.reportTest?yield e.shell.reportTest(E,o):yield fetch(`${e.dapi.root}/log/tests/${E}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(o)})}return s}))}function B(t){return s(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function k(t,e,n="EXECUTION TIMEOUT"){return s(this,void 0,void 0,(function*(){let o=null;const r=new Promise(((t,r)=>{o=setTimeout((()=>{r(n)}),e)}));try{return yield Promise.race([t(),r])}finally{o&&clearTimeout(o)}}))}t.DataFrame.fromColumns([t.Column.fromStrings("col",["val1","val2","val3"])]),function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(w||(w={})),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(E||(E={})),function(t){t.Euclidean="Euclidean"}(v||(v={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean"}(x||(x={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(b||(b={})),(N=S||(S={})).Vector="Vector",N.String="String",N.BitArray="BitArray",N.MacroMolecule="MacroMolecule",N.Number="Number",N.IntArray="IntArray",N.NumberArray="NumberArray",function(t){t.Difference="Difference"}(_||(_={})),function(t){t.CommonItems="Common Items"}(M||(M={}));const H=new Uint32Array(65536),G=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,o=e.length,r=1<<n-1;let s=-1,i=0,a=n,c=n;for(;c--;)H[t.charCodeAt(c)]|=1<<c;for(c=0;c<o;c++){let t=H[e.charCodeAt(c)];const n=t|i;t|=(t&s)+s^s,i|=~(t|s),s&=t,i&r&&a++,s&r&&a--,i=i<<1|1,s=s<<1|~(n|i),i&=n}for(c=n;c--;)H[t.charCodeAt(c)]=0;return a})(t,e):((t,e)=>{const n=e.length,o=t.length,r=[],s=[],i=Math.ceil(n/32),a=Math.ceil(o/32);for(let t=0;t<i;t++)s[t]=-1,r[t]=0;let c=0;for(;c<a-1;c++){let i=0,a=-1;const l=32*c,u=Math.min(32,o)+l;for(let e=l;e<u;e++)H[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=H[e.charCodeAt(t)],o=s[t/32|0]>>>t&1,c=r[t/32|0]>>>t&1,l=n|i,u=((n|c)&a)+a^a|n|c;let h=i|~(u|a),f=a&u;h>>>31^o&&(s[t/32|0]^=1<<t),f>>>31^c&&(r[t/32|0]^=1<<t),h=h<<1|o,f=f<<1|c,a=f|~(l|h),i=h&l}for(let e=l;e<u;e++)H[t.charCodeAt(e)]=0}let l=0,u=-1;const h=32*c,f=Math.min(32,o-h)+h;for(let e=h;e<f;e++)H[t.charCodeAt(e)]|=1<<e;let m=o;for(let t=0;t<n;t++){const n=H[e.charCodeAt(t)],i=s[t/32|0]>>>t&1,a=r[t/32|0]>>>t&1,c=n|l,h=((n|a)&u)+u^u|n|a;let f=l|~(h|u),d=u&h;m+=f>>>o-1&1,m-=d>>>o-1&1,f>>>31^i&&(s[t/32|0]^=1<<t),d>>>31^a&&(r[t/32|0]^=1<<t),f=f<<1|i,d=d<<1|a,u=d|~(c|f),l=f&c}for(let e=h;e<f;e++)H[t.charCodeAt(e)]=0;return m})(t,e)};var V=n(944);class W{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,o=W._createBuffer(n);if(e)for(let t=0;t<o.length;t++)o[t]=-1;this._data=o,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,o){if(t<e||t>n)throw new Error(`Argument ${o} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let o=0;o<n;o++)e[o]=t[o]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new W(t._length);n._length=t._length,n._data=W._createBuffer(n._length),n._version=0;const o=t.lengthInInts;for(let r=0;r<o;r++)n._data[r]=t._data[r]&e._data[r];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new W(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new W(t);for(let o=0;o<t;++o)n.setBit(o,e(o));return n._version=0,n}static fromString(t){return W.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new W(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new W(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let o=0,r=0;for(;e-r>=4;)n._data[o++]=255&t[r]|(255&t[r+1])<<8|(255&t[r+2])<<16|(255&t[r+3])<<24,r+=4;return e-r==3&&(n._data[o]=(255&t[r+2])<<16),e-r==2&&(n._data[o]|=(255&t[r+1])<<8),e-r==1&&(n._data[o]|=255&t[r]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new W(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,o=this.lengthInInts;for(let t=0;t<o;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,o=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(o)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,o=!0,r=!0){if(n&&r&&this.setAll(!e,!1),r)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(o)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let o=t;o<e;++o)n.push(this.getBit(o));return W.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let o=t;o<e;++o)n.push(this.getBit(o));return n}setRange(t,e,n,o=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const r=Math.min(t,e),s=Math.max(t,e);if(n)for(let t=r;t<=s;t++)this.setTrue(t);else for(let t=r;t<=s;t++)this.setFalse(t);return this.incrementVersion(o),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const o=this._length;this.setLength(this._length+e);for(let n=o-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let o=t;o<t+e;o++)this.setBit(o,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let o=-1;-1!=(o=t.findNext(o,!e));)this.setFast(n++,this.getBit(o));this._length=n,this._version++}return this}getBit(t){return!!(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=W._onBitCount[255&t];let n=this._data[e];const o=31&this._length;for(0!=o&&(n&=~(4294967295<<o));0!=n;n>>>=8)this._selectedCount+=W._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const o=this.lengthInInts;let r=0;for(;r<o-1;r++)for(let e=this._data[r]&t._data[r];0!=e;e>>>=8)n+=W._onBitCount[255&e];let s=this._data[r]&t._data[r];const i=31&this._length;for(0!=i&&(s&=~(4294967295<<i));0!=s;s>>>=8)n+=W._onBitCount[255&s];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const o=this.lengthInInts;for(let r=Math.floor(t/32);r<o;r++){let o=e?this._data[r]:~this._data[r];if(0!=n)o&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==o)continue;for(let e=0;0!=o;e+=8,o>>>=8){const n=W._firstOnBit[255&o];if(n>=0)return(t=n+32*r+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let o=Math.floor(t/32);o>=0;o--){let t=e?this._data[o]:~this._data[o];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=W._lastOnBit[t>>>24];if(n>=0)return n+32*o+e}}return-1}}function $(t={}){const e=function(){if(!t||!t.scoringMatrix||!t.alphabetIndexes)return(t,e)=>t===e?0:1;if(t.scoringMatrix.length!==Object.keys(t.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const e=t.alphabetIndexes,n=t.scoringMatrix,o=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,r=new Float32Array((n.length+o)*(n.length+o));return Object.entries(e).forEach((([t,o])=>{const s=n[o];Object.entries(e).forEach((([e,o])=>{r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=s[o]}))})),(t,e)=>1-r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,o)=>{let r=0;const s=t.length,i=o.length,a=Math.ceil(Math.max(s,i)*(1-n));s!==i&&(r=Math.abs(s-i));let c=0;for(let n=0;n<Math.min(s,i);n++)if(t[n]!==o[n]&&(c+=e(t[n],o[n]),c>a))return 1;return c+=r,c/=Math.max(s,i),c}}W._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),W._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),W._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]);const Y={gapOpen:1,gapExtend:.6,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};var X;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(X||(X={}));const K={[X.HAMMING]:$,[X.LEVENSHTEIN]:function(){return(t,e)=>G(t,e)/Math.max(t.length,e.length)},[X.NEEDLEMANN_WUNSCH]:function(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:o,scoringMatrix:r,alphabetIndexes:s}={...Y,...t};Object.entries(s).forEach((([t,n])=>e[t.charCodeAt(0)]=n));const i=[new Float32Array(1e4),new Float32Array(1e4)];return(t,s)=>{const a=new Array(t.length+1).fill(!1),c=new Array(t.length+1).fill(!1);let l=0,u=1;for(let e=1;e<t.length+1;e++)i[0][e]=-o-(e-1)*o,i[1][e]=0;i[0][0]=0;for(let h=1;h<s.length+1;h++){i[u][0]=-o-(h-1)*o;for(let f=1;f<t.length+1;f++){const m=i[l][f-1]+r[e[t.charCodeAt(f-1)]][e[s.charCodeAt(h-1)]],d=i[l][f]-(a[f]||1===h||h===s.length?o:n),y=i[u][f-1]-(c[f-1]||1===f||f===t.length?o:n);i[u][f]=Math.max(m,y,d),i[u][f]===m?(a[f]=!1,c[f]=!1):i[u][f]===y?(a[f]=!1,c[f]=!0):(a[f]=!0,c[f]=!1)}l=u,u=(u+1)%2}const h=Math.min(t.length,s.length);return(h-i[l][t.length])/h}},[X.MONOMER_CHEMICAL_DISTANCE]:$};function j(t,e){const n=t.trueCount()+e.trueCount();if(0==n)return 1;const o=t.andWithCountBits(e,!0);return o/(n-o)}function z(t){return 0===t?3402823e32:1/t-1}x.Tanimoto,x.Dice,x.Asymmetric,x.BraunBlanquet,x.Cosine,x.Kulczynski,x.McConnaughey,x.RogotGoldberg,x.Russel,x.Sokal,x.Hamming,x.Euclidean,x.Tanimoto,x.Dice,x.Asymmetric,x.BraunBlanquet,x.Cosine,x.Kulczynski,x.McConnaughey,x.RogotGoldberg,x.Russel,x.Sokal,x.Hamming,x.Euclidean,x.Tanimoto,x.Dice,x.Cosine,x.Tanimoto,x.Asymmetric,x.Cosine,x.Sokal,X.HAMMING,X.LEVENSHTEIN,X.MONOMER_CHEMICAL_DISTANCE,X.NEEDLEMANN_WUNSCH;const q={[v.Euclidean]:function(t,e){let n=0;const o=t.length;if(o!==e.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<o;++r)n+=Math.pow(t[r]-e[r],2);return Math.sqrt(n)}},Q={[E.Levenshtein]:G,[E.JaroWinkler]:V.Vb,[E.Manhattan]:function(t,e){if(t.length!==e.length)return 1;{let n=0;for(let o=1;o<t.length;o++)n+=t[o]==e[o]?0:1;return n/t.length}},[E.Onehot]:function(t,e){return t===e?0:1}},J={[x.Tanimoto]:function(t,e){return 1-j(t,e)},[x.Dice]:function(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount();return 0==n?0:2*t.andWithCountBits(e,!0)/n}(t,e)},[x.Asymmetric]:function(t,e){return 1-function(t,e){const n=Math.min(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e)},[x.BraunBlanquet]:function(t,e){return z(function(t,e){const n=Math.max(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))},[x.Cosine]:function(t,e){return 1-function(t,e){const n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)/Math.sqrt(n)}(t,e)},[x.Kulczynski]:function(t,e){return z(function(t,e){const n=t.trueCount()+e.trueCount(),o=t.trueCount()*e.trueCount();return 0==o?0:t.andWithCountBits(e,!0)*n/(2*o)}(t,e))},[x.McConnaughey]:function(t,e){return z(function(t,e){const n=t.trueCount()+e.trueCount(),o=t.trueCount()*e.trueCount();return 0==o?0:(t.andWithCountBits(e,!0)*n-o)/o}(t,e))},[x.RogotGoldberg]:function(t,e){return z(function(t,e){const n=t.andWithCountBits(e,!0),o=t.countBits(!0)+e.countBits(!0),r=t.length,s=r-o+n;return n==r||s==r?1:n/o+s/(2*r-o)}(t,e))},[x.Russel]:function(t,e){return z(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))},[x.Sokal]:function(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount(),o=t.andWithCountBits(e,!0);return o/(2*n-3*o)}(t,e)},[x.Hamming]:function(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)},[x.Euclidean]:function(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}},Z={[b.TanimotoIntArray]:function(t,e){return z(j(new W(t,32*t.length),new W(e,32*e.length)))}},tt={[_.Difference]:function(t){if(t&&null!=t.range&&t.range>0){const e=t.range;return(t,n)=>Math.abs(t-n)/e}return(t,e)=>Math.abs(t-e)}},et={[M.CommonItems]:function(t){const e=function(t){const e=t?.mostCommon??new Set;return(t,n)=>{const o=t.length,r=n.length;let s=0,i=0,a=0;for(;i<o&&a<r;)t[i]===n[a]?(e?.has(t[i])||++s,++i,++a):t[i]<n[a]?++i:++a;return s}}(t);return(t,n)=>0===n.length||0===t.length?1e4:Math.min(t.length,n.length)/(e(t,n)+1e-4)}},nt={[S.Vector]:{[v.Euclidean]:q[v.Euclidean]},[S.String]:{[E.Levenshtein]:Q[E.Levenshtein],[E.JaroWinkler]:Q[E.JaroWinkler],[E.Manhattan]:Q[E.Manhattan],[E.Onehot]:Q[E.Onehot]},[S.BitArray]:{[x.Tanimoto]:J[x.Tanimoto],[x.Dice]:J[x.Dice],[x.Asymmetric]:J[x.Asymmetric],[x.BraunBlanquet]:J[x.BraunBlanquet],[x.Cosine]:J[x.Cosine],[x.Kulczynski]:J[x.Kulczynski],[x.McConnaughey]:J[x.McConnaughey],[x.RogotGoldberg]:J[x.RogotGoldberg],[x.Russel]:J[x.Russel],[x.Sokal]:J[x.Sokal]},[S.MacroMolecule]:{[X.HAMMING]:K[X.HAMMING],[X.LEVENSHTEIN]:K[X.LEVENSHTEIN],[X.NEEDLEMANN_WUNSCH]:K[X.NEEDLEMANN_WUNSCH],[X.MONOMER_CHEMICAL_DISTANCE]:K[X.MONOMER_CHEMICAL_DISTANCE]},[S.Number]:{[_.Difference]:tt[_.Difference]},[S.IntArray]:{[b.TanimotoIntArray]:Z[b.TanimotoIntArray]},[S.NumberArray]:{[M.CommonItems]:et[M.CommonItems]}};Object.keys(nt).reduce(((t,e)=>{for(const n of Object.keys(nt[e]))t[n]=e;return t}),{});const ot=ui,rt="bypassLargeDataWarning",st="show-scatterplot-progress";var it,at,ct,lt,ut,ht,ft,mt=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};n(5540),(at=it||(it={})).EUCLIDEAN="EUCLIDEAN",at.MANHATTAN="MANHATTAN",it.EUCLIDEAN,it.MANHATTAN,(lt=ct||(ct={})).HAMMING="Hamming",lt.EUCLIDEAN="Euclidean",lt.MANHATTAN="Manhattan",lt.TANIMOTO="Tanimoto",lt.LEVENSTEIN="Levenshtein",lt.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",lt.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",lt.SOKAL="Sokal",lt.COSINE="Cosine",lt.ASYMMETRIC="Asymmetric",lt.Difference="Difference",lt.OneHot="One-Hot",ct.HAMMING,ct.EUCLIDEAN,ct.MANHATTAN,ct.TANIMOTO,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.MONOMER_CHEMICAL_DISTANCE,ct.SOKAL,ct.COSINE,ct.ASYMMETRIC,ct.Difference,ct.OneHot,ct.HAMMING,ct.EUCLIDEAN,ct.MANHATTAN,ct.TANIMOTO,ct.SOKAL,ct.COSINE,ct.ASYMMETRIC,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.MONOMER_CHEMICAL_DISTANCE,ct.Difference,ct.OneHot,new Set([ct.HAMMING,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.MONOMER_CHEMICAL_DISTANCE,ct.OneHot]),new Set([ct.HAMMING,ct.EUCLIDEAN,ct.MANHATTAN,ct.MONOMER_CHEMICAL_DISTANCE,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.TANIMOTO,ct.COSINE,ct.SOKAL,ct.ASYMMETRIC,ct.OneHot,ct.Difference]),new Set([ct.EUCLIDEAN,ct.MANHATTAN,ct.OneHot,ct.Difference]),new Set([ct.EUCLIDEAN,ct.MANHATTAN,ct.Difference]),new Set([ct.EUCLIDEAN,ct.MANHATTAN,ct.Difference]),new Set([ct.TANIMOTO,ct.COSINE,ct.SOKAL,ct.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(ut||(ut={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(ht||(ht={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(ft||(ft={})),Object.prototype.toString;const dt="dimensionality-reducer-terminate-event";var yt,pt;(pt=yt||(yt={})).EUCLIDEAN="EUCLIDEAN",pt.MANHATTAN="MANHATTAN";const gt=t=>null==t;function Ct(t,e){return`${e} (${t.length>4?`${t.length} columns`:t.map((t=>t.name)).join(", ")})`}async function At(o,r,s,i,a,c,l,u=!0,h=!1,f={preprocessingFuncArgs:[]},m={},d=null,y={}){const p={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(r.length!==i.length||r.length!==c.length||r.length!==a.length||r.length!==f.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const g=u?m.tableView??e.shell.tableView(o.name)??e.shell.addTableView(o):null,C=async()=>{const C=t.TaskBarProgressIndicator.create(`Initializing ${m.scatterPlotName??"dimensionality reduction"} ...`);let A;try{const w=function(t){const e=["Embed_X","Embed_Y"],n=t.columns.names().filter((t=>t.includes(e[0]))).length+1;return e.map((t=>`${t}_${n}`))}(o);function E(e,n,i){let a=null,c=null;o.columns.names().includes(w[0])?(a=o.columns.byName(w[0]),c=o.columns.byName(w[1])):(a=o.columns.add(t.Column.float(w[0],o.rowCount)),c=o.columns.add(t.Column.float(w[1],o.rowCount)),u&&!A&&(A=g.scatterPlot({...p,x:w[0],y:w[1],title:m.scatterPlotName??Ct(r,s)}))),m[st]&&(A?.root&&ot.setUpdateIndicator(A.root,!1),a.init((t=>i[0]?i[0][t]:void 0)),c.init((t=>i[1]?i[1][t]:void 0)));const l=e/n*100;C.update(l,`Running ${m.scatterPlotName??"dimensionality reduction"}... ${l.toFixed(0)}%`)}async function v(){o.columns.add(t.Column.float(w[0],o.rowCount)),o.columns.add(t.Column.float(w[1],o.rowCount));let h=null;u&&(A=g.scatterPlot({...p,x:w[0],y:w[1],title:m.scatterPlotName??Ct(r,s)}),ot.setUpdateIndicator(A.root,!0));const d=e.events.onViewerClosed.subscribe((t=>{const n=t.args.viewer;n?.getOptions()?.look?.title&&A?.getOptions()?.look?.title&&n?.getOptions()?.look?.title===A?.getOptions()?.look?.title&&(e.events.fireCustomEvent(dt,{}),d.unsubscribe(),h?.(),C.close())})),y=new Promise((async(t,o)=>{try{h=t;const o=[];for(let t=0;t<c.length;++t){const e=c[t];if(f.distanceFnArgs||(f.distanceFnArgs=[]),e){const n=e.inputs[0].name,s=e.inputs[1].name,{entries:a,options:c}=await e.apply({[n]:r[t],[s]:i[t],...f.preprocessingFuncArgs[t]??{}});o.push({entries:a,options:c}),f.distanceFnArgs.push(c)}else{const e=r[t].toList(),n={};o.push({entries:e,options:n}),f.distanceFnArgs.push(n)}}t(await async function(t,o,r,s,i,a,c){let l=await async function(t,o,r,s,i,a,c){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(t.length!==o.length||t.length!==a.distanceFnArgs.length||t.length!==s.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(l,u){const h=new Worker(new URL(n.p+n.u(234),n.b));h.postMessage({columnsData:t,distanceMetrics:o,method:r,options:a,weights:s,aggregationMethod:i});const f=e.events.onCustomEvent(dt).subscribe((()=>{try{h?.terminate()}finally{f.unsubscribe()}}));h.onmessage=({data:{error:t,embedding:e,epochNum:n,epochsLength:o}})=>{gt(n)||gt(o)?(f.unsubscribe(),t?u(t):l(e),setTimeout((()=>h.terminate()),100)):c&&c(n,o,e)}}))}(t,r,o,s,i,a,c);return l=l.map((t=>function(t){const e=t.length;let n=0,o=0;for(let r=0;r<e;++r)n+=t[r],o+=Math.pow(t[r],2);const r=n/e,s=1/Math.sqrt(o/e-Math.pow(r,2));for(let n=0;n<e;++n)t[n]=(t[n]-r)*s;return t}(t))),l}(o.map((t=>t.entries)),s,i,a,l,f,m[rt]?void 0:E))}catch(t){o(t)}})),v=await y;return C.close(),d.unsubscribe(),v}const x=await v();if(h&&x){const b=t.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const S=await function(t,e,o,r){return mt(this,void 0,void 0,(function*(){return new Promise((function(s,i){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:r,epsilon:o}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?i(t):s(e)}}))}))}(x[0],x[1],f.dbScanEpsilon??.01,f.dbScanMinPts??4),_=o.columns.getUnusedName("Cluster (DBSCAN)");o.columns.addNewString(_).init((t=>S[t].toString())),A&&(A.props.colorColumnName=_)}catch(M){e.shell.error("Clustering embeddings failed"),console.error(M)}finally{b.close()}}if(x){const N=o.columns.byName(w[0]),I=o.columns.byName(w[1]);if(N.init((t=>x[0][t])),I.init((t=>x[1][t])),d)try{const T=d.inputs[0].name,O=d.inputs[1].name;await d.prepare({[T]:N,[O]:I,...y}).call(!0)}catch(R){e.shell.error("Post-processing failed"),console.error(R)}if(A)return ot.setUpdateIndicator(A.root,!1),A.helpUrl="/help/compute/sequence-space",A}}catch(L){e.shell.error("Dimensionality reduction failed"),console.error(L),C.close(),A&&ot.setUpdateIndicator(A.root,!1)}};return new Promise((async(t,e)=>{try{if(m.fastRowCount&&o.rowCount>m.fastRowCount&&!m[rt])ot.dialog().add(ot.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await C();t(e)}catch(t){e(t)}})).onCancel((()=>t(void 0))).show();else{const e=await C();t(e)}}catch(t){e(t)}}))}var wt=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const Et={SUBJ:"subj",STUDY:"study",SITE:"site",AGE:"age",SEX:"sex",RACE:"race",DISEASE:"disease",WEIGHT:"weight",HEIGHT:"height"};function vt(t,n,o){return wt(this,void 0,void 0,(function*(){const r=e.data.demo.demog(100);e.shell.addTableView(r),R(!!(yield At(r,t.map((t=>r.col(t))),n,o,t.map((()=>1)),t.map((()=>{})),"EUCLIDEAN",!0,!0,{preprocessingFuncArgs:t.map((()=>({})))})),!0,"No scatterplot returned");const s=r.columns.names().filter((t=>t.toLowerCase().startsWith("embed")));R(s.length,2,"Wrong number of embeddings added"),R(!!r.columns.names().find((t=>t.toLowerCase().startsWith("cluster"))),!0,"No cluster column added");for(const t of s){const e=r.col(t);R(new Array(e.length).fill(null).every(((t,n)=>!e.isNone(n)&&!isNaN(e.get(n)))),!0,"Embedding column has null-ish values")}yield new Promise((t=>setTimeout(t,500)))}))}L("Dimensionality reduction: UMAP",(()=>{O("Numeric column",(()=>wt(void 0,void 0,void 0,(function*(){yield vt([Et.AGE],w.UMAP,[_.Difference])}))),{timeout:3e4}),O("String column",(()=>wt(void 0,void 0,void 0,(function*(){yield vt([Et.SEX],w.UMAP,[E.Onehot])}))),{timeout:3e4}),O("Numeric and string columns",(()=>wt(void 0,void 0,void 0,(function*(){yield vt([Et.SEX,Et.AGE],w.UMAP,[E.Onehot,_.Difference])})))),O("All demog columns",(()=>wt(void 0,void 0,void 0,(function*(){const n=e.data.demo.demog(10).columns.toList().filter((t=>Object.values(Et).includes(t.name))),o=n.map((e=>e.type===t.COLUMN_TYPE.STRING?E.Onehot:_.Difference)),r=n.map((t=>t.name));yield vt(r,w.UMAP,o)}))))})),L("Dimensionality reduction: T-SNE",(()=>{O("Numeric column",(()=>wt(void 0,void 0,void 0,(function*(){yield vt([Et.AGE],w.T_SNE,[_.Difference])}))),{timeout:3e4}),O("String column",(()=>wt(void 0,void 0,void 0,(function*(){yield vt([Et.SEX],w.T_SNE,[E.Onehot])}))),{timeout:3e4}),O("Numeric and string columns",(()=>wt(void 0,void 0,void 0,(function*(){yield vt([Et.SEX,Et.AGE],w.T_SNE,[E.Onehot,_.Difference])})))),O("All demog columns",(()=>wt(void 0,void 0,void 0,(function*(){const n=e.data.demo.demog(10).columns.toList().filter((t=>Object.values(Et).includes(t.name))),o=n.map((e=>e.type===t.COLUMN_TYPE.STRING?E.Onehot:_.Difference)),r=n.map((t=>t.name));yield vt(r,w.T_SNE,o)}))))}));const xt={i32:"HEAP32",f32:"HEAPF32"},bt={i32:Int32Array,f32:Float32Array},St={i32:2,f32:2},_t={i32:DG.Column.fromInt32Array,f32:DG.Column.fromFloat32Array};class Mt{constructor(t){this.data=t}complementArrOfParams(t){t.push(this.data)}complementArrOfTypes(t){t.push("number")}allocateMemoryForBuffer(t){}isMemoryForBufferAllocated(){return!0}putDataToBuffer(t){}getDataFromBuffer(t){}freeBuffer(t){}}class Nt extends Mt{constructor(t,e,n=!1){super(t),this.type=e,this.toUpdate=n,this.buf=0,this.numOfRows=t.length}complementArrOfParams(t){t.push(this.buf),t.push(this.numOfRows)}complementArrOfTypes(t){t.push("number"),t.push("number")}allocateMemoryForBuffer(t){this.buf=t._malloc(this.numOfRows*bt[this.type].BYTES_PER_ELEMENT)}isMemoryForBufferAllocated(){return 0!=this.buf}putDataToBuffer(t){if(this.isMemoryForBufferAllocated()){const e=this.type,n=St[e],o=t[xt[e]];let r=null;const s=this.data;r="int"==s.type&&"i32"==e||"double"==s.type&&"f32"==e?s.getRawData():new bt[e](s.getRawData()),r&&o.set(r,this.buf>>n)}}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[xt[e]],o=this.buf,r=bt[e].BYTES_PER_ELEMENT,s=this.data.getRawData();for(let t=0;t<this.numOfRows;t++)s[t]=n[o/r+t]}}freeBuffer(t){this.isMemoryForBufferAllocated()&&(t._free(this.buf),this.buf=0)}}class It extends Nt{constructor(t,e){super([],t,!0),this.numOfRows=e}putDataToBuffer(t){}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[xt[e]],o=this.buf,r=_t[e],s=new bt[e](this.numOfRows);for(let t=0;t<s.length;t++)s[t]=n[o/s.BYTES_PER_ELEMENT+t];this.data=r("name",s)}}}class Tt extends Mt{constructor(t,e,n=!1){super(t),this.type=e,this.toUpdate=n,this.buf=0,this.numOfColumns=t.length,this.numOfRows=t[0].length}complementArrOfParams(t){t.push(this.buf),t.push(this.numOfRows),t.push(this.numOfColumns)}complementArrOfTypes(t){t.push("number"),t.push("number"),t.push("number")}allocateMemoryForBuffer(t){this.buf=t._malloc(this.numOfRows*this.numOfColumns*bt[this.type].BYTES_PER_ELEMENT)}isMemoryForBufferAllocated(){return 0!=this.buf}putDataToBuffer(t){if(this.isMemoryForBufferAllocated()){const e=this.type,n=St[e],o=t[xt[e]],r=bt[e].BYTES_PER_ELEMENT;for(let t=0;t<this.numOfColumns;t++){let s=null;const i=this.data[t];s="int"==i.type&&"i32"==e||"double"==i.type&&"f32"==e?i.getRawData():new bt[e](i.getRawData()),null!=s&&o.set(s,this.buf+t*this.numOfRows*r>>n)}}}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[xt[e]],o=this.numOfRows,r=this.numOfColumns,s=new bt[e](n.buffer,this.buf,o*r);for(let t=0;t<r;t++){const e=this.data[t].getRawData();for(let n=0;n<o;n++)e[n]=s[n+t*o]}}}freeBuffer(t){this.isMemoryForBufferAllocated()&&(t._free(this.buf),this.buf=0)}}class Ot extends Tt{constructor(t,e,n){super([[]],t,!0),this.data=[],this.numOfColumns=n,this.numOfRows=e}putDataToBuffer(t){}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[xt[e]],o=this.numOfRows,r=this.numOfColumns,s=bt[e].BYTES_PER_ELEMENT,i=_t[e],a=this.buf;for(let t=0;t<r;t++){const r=new bt[e](o);for(let e=0;e<o;e++)r[e]=n[a/s+e+t*o];this.data.push(i((t+1).toString(),r))}}}}const Rt={intColumn:t=>new Nt(t,"i32"),newIntColumn:t=>new It("i32",t),intColumns:t=>new Tt(t.toList(),"i32"),newIntColumns:(t,e)=>new Ot("i32",t,e),floatColumn:t=>new Nt(t,"f32"),newFloatColumn:t=>new It("f32",t),floatColumns:t=>new Tt(t.toList(),"f32"),newFloatColumns:(t,e)=>new Ot("f32",t,e),int:t=>new Mt(t),num:t=>new Mt(t)},Lt={tableFromColumns:t=>DG.DataFrame.fromColumns(t.data),num:t=>t,int:t=>t,double:t=>t,column:t=>t.data};function Dt(t,e,n){const o=t[e],r=o.arguments,s=[];let i=0;for(const t in r){const e=r[t];if("_callResult"!=t){switch(e.type){case"floatColumns":case"int":case"num":case"floatColumn":case"intColumn":case"intColumns":e.data=Rt[e.type](n[i]),i++;break;case"newFloatColumns":case"newIntColumns":const t=r[e.numOfRows.ref].data[e.numOfRows.value],o=r[e.numOfColumns.ref].data[e.numOfColumns.value];e.data=Rt[e.type](t,o);break;case"newFloatColumn":case"newIntColumn":const s=r[e.numOfRows.ref].data[e.numOfRows.value];e.data=Rt[e.type](s)}s.push(r[t].data)}}const a=function(t,e,n,o){let r;for(const e of o)e.allocateMemoryForBuffer(t);let s=!0;for(const t of o)s&=t.isMemoryForBufferAllocated();if(s){const n=[],s=[];for(const e of o)e.complementArrOfParams(n),e.complementArrOfTypes(s),e.putDataToBuffer(t);const i="number";r=t.ccall(e,i,s,n);for(const e of o)e.getDataFromBuffer(t)}for(const e of o)e.freeBuffer(t);if(null!=r)return r}(t,e,0,s);r._callResult=Rt.num(a);const c=o.output;if("objects"!=c.type)return Lt[c.type](r[c.source].data);const l=[];for(const t of c.source)l.push(r[t].data.data);return l}const Pt="num",Ft="floatColumn",Ut="intColumn",Bt="floatColumns",kt="newFloatColumns",Ht="intColumns",Gt="newIntColumns",Vt="newFloatColumn",Wt="newIntColumn",$t="column",Yt="_callResult",Xt="numOfRows",Kt="numOfColumns",jt="ref",zt="value",qt="tableFromColumns",Qt="objects",Jt="int",Zt="double",te={intColumn:Int32Array,floatColumn:Float32Array,floatColumns:Float32Array,newFloatColumns:Float32Array,intColumns:Int32Array,newIntColumns:Int32Array,newFloatColumn:Float32Array,newIntColumn:Int32Array};function ee(t,e){let n,o=[],r=0;for(const s in t){const i=t[s],a=i.type;if(s!==Yt){switch(a){case Pt:case Jt:case Zt:i.data=e[r],r++;break;case Ut:case Ft:let o;const s=e[r],c=s.length;o=s.type===Jt&&a===Ut||s.type===Zt&&a===Ft?s.getRawData().slice(0,c):new te[a](s.getRawData().slice(0,c)),i.data={array:o,numOfRows:c},r++;break;case Wt:case Vt:let l=0;n=i[Xt][jt],l=t[n].type===Pt?t[n].data:t[n].data[i[Xt][zt]],i.data={numOfRows:l},r++;break;case Ht:case Bt:let u=[];const h=e[r].byIndex(0).length;for(const t of e[r].toList())t.type===Jt&&a===Ut||t.type===Zt&&a===Ft?u.push(t.getRawData().slice(0,h)):u.push(new te[a](t.getRawData().slice(0,h)));i.data={arrays:u,numOfRows:h,numOfColumns:u.length},r++;break;case Gt:case kt:let f=0,m=0;n=i[Xt][jt],f=t[n].type===Pt?t[n].data:t[n].data[i[Xt][zt]],n=i[Kt][jt],m=t[n].type===Pt?t[n].data:t[n].data[i[Kt][zt]],i.data={numOfRows:f,numOfColumns:m},r++;break;default:return}o.push(i)}}return o}function ne(t,e){t.arguments._callResult=e.callResult,function(t,e){const n={newFloatColumns:DG.Column.fromFloat32Array,newIntColumns:DG.Column.fromInt32Array,newFloatColumn:DG.Column.fromFloat32Array,newIntColumn:DG.Column.fromInt32Array};let o=0;for(const r in t){const s=t[r];switch(s.type){case Pt:case Jt:case Zt:case Ut:case Ft:case Bt:case Ht:break;case Vt:case Wt:let t;null==s.name?t=(0).toString():a=s.name,s.column=n[s.type](t,e[o].array);break;case Gt:case kt:let r=[],i=e[o].arrays.length,a=[];if(null==s.names)for(let t=1;t<=i;t++)a.push(t.toString());else a=s.names;for(let t=0;t<i;t++)r.push(n[s.type](a[t],e[o].arrays[t]));s.columns=r}o++}}(t.arguments,e.args);let n=function(t){let e=t.output;const n={newFloatColumns:"columns",newIntColumns:"columns",newFloatColumn:"column",newIntColumn:"column"};switch(e.type){case Pt:case Jt:case Zt:return t.arguments[e.source];case $t:return t.arguments[e.source].column;case qt:return DG.DataFrame.fromColumns(t.arguments[e.source].columns);case Qt:let o=[];for(let r of e.source){let e=t.arguments[r];o.push(e[n[e.type]])}return o}}(t);return function(t){for(const e in t){const n=t[e];switch(n.type){case Pt:case Jt:case Zt:case Ut:case Ft:case Ht:case Bt:break;case Wt:case Vt:n.column=null;break;case Gt:case kt:n.columns=null}}}(t.arguments),n}const oe=1,re=1e8,se="components must be positive.",ie="components must not be greater than features count.",ae="dataframe is too big.",ce="unsupported column type: ";function le(e){if(e.type!=t.COLUMN_TYPE.FLOAT&&e.type!=t.COLUMN_TYPE.INT)throw new Error(ce+e.type)}function ue(t){if(t.stats.missingValueCount>0)throw new Error(`The column '${t.name}' has missing values.`)}function he(t,e){if(function(t,e){if(e<oe)throw new Error(se);if(e>t.length)throw new Error(ie);for(const e of t)le(e),ue(e)}(t,e),t.length*t.byIndex(0).length>re)throw new Error(ae)}var fe,me,de,ye,pe,ge,Ce,Ae,we,Ee,ve,xe,be,Se,_e;function Me(t,e,o,r,s){return i=this,a=void 0,l=function*(){he(e,o);const t=r?1:0,i=s?1:0;return yield async function(t,e,o,r,s){return new Promise(((t,i)=>{const a=new Worker(new URL(n.p+n.u(91),n.b));a.postMessage(ee(EDA.principalComponentAnalysis.arguments,[e,o,r,s])),a.onmessage=function(e){a.terminate(),t(ne(EDA.principalComponentAnalysis,e.data))}}))}(0,e,o,t,i)},new((c=void 0)||(c=Promise))((function(t,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof c?r:new c((function(t){t(r)}))).then(n,o)}r((l=l.apply(i,a||[])).next())}));var i,a,c,l}(_e=fe||(fe={}))[_e.COMPUTE_COMPONENTS=0]="COMPUTE_COMPONENTS",_e[_e.PERFORM_MVA=1]="PERFORM_MVA",_e[_e.DEMO=2]="DEMO",(Se=me||(me={})).NO_DF="No dataframe is opened",Se.NO_COLS="No numeric columns without missing values",Se.ONE_COL="No columns to be used as features (just one numeric columns without missing values)",Se.EMPTY_DF="Dataframe is empty",(be=de||(de={})).PREDICT="Predict",be.USING="Using",be.COMPONENTS="Components",be.PLS="PLS",be.MVA="Multivariate Analysis (PLS)",be.RUN="RUN",be.NAMES="Names",be.MODEL="Observed vs. Predicted",be.FEATURE="Feature",be.REGR_COEFS="Regression Coefficients",be.XLOADING="x.loading.p",be.LOADINGS="Loadings",be.XSCORE="x.score.t",be.YSCORE="y.score.u",be.SCORES="Scores",be.EXPL_VAR="Explained Variance",be.EXPLORE="Explore",be.FEATURES="Feature names",be.BROWSE="Browse",(xe=ye||(ye={})).PREDICT="Column with the response variable",xe.FEATURES="Predictors (features)",xe.COMPONENTS="Number of PLS components",xe.PLS="Compute PLS components",xe.MVA="Perform multivariate analysis",xe.NAMES="Names of data samples",(ve=pe||(pe={})).PLS="https://datagrok.ai/help/explore/multivariate-analysis/pls#pls-components",ve.MVA="https://datagrok.ai/help/explore/multivariate-analysis/pls",ve.MODEL="https://datagrok.ai/help/explore/multivariate-analysis/plots/predicted-vs-reference",ve.COEFFS="https://datagrok.ai/help/explore/multivariate-analysis/plots/regression-coefficients",ve.LOADINGS="https://datagrok.ai/help/explore/multivariate-analysis/plots/loadings",ve.EXPL_VARS="https://datagrok.ai/help/explore/multivariate-analysis/plots/explained-variance",ve.SCORES="https://datagrok.ai/help/explore/multivariate-analysis/plots/scores",(Ee=ge||(ge={}))[Ee.DEFAULT=3]="DEFAULT",Ee[Ee.MIN=1]="MIN",(we=Ce||(Ce={})).PREFIX="PLS",we.SUFFIX="(predicted)",we.COMP="component",we.COMPS="components",function(t){t[t.PREDICTION=0]="PREDICTION",t[t.REGR_COEFFS=1]="REGR_COEFFS",t[t.T_SCORES=2]="T_SCORES",t[t.U_SCORES=3]="U_SCORES",t[t.X_LOADINGS=4]="X_LOADINGS",t[t.Y_LOADINGS=5]="Y_LOADINGS"}(Ae||(Ae={}));const Ne=[.49,.79,.99];var Ie;!function(t){t.AXIS="#838383",t.CIRCLE="#0000FF"}(Ie||(Ie={})),[{caption:de.MODEL,text:"Closer to the line means better price prediction."},{caption:de.SCORES,text:"The latent factor values for each sample reflect the similarities and dissimilarities among observations."},{caption:de.LOADINGS,text:"The impact of each feature on the latent factors: higher loading means stronger influence."},{caption:de.REGR_COEFS,text:"Parameters of the obtained linear model: features make different contribution to the prediction."},{caption:de.EXPL_VAR,text:"How well the latent components fit source data: closer to one means better fit."}].map((t=>`# ${t.caption}\n\n${t.text}`)).join("\n\n"),pe.MVA;var Te=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};function Oe(t){return Te(this,void 0,void 0,(function*(){he(t.features,t.components),le(t.predict),ue(t.predict);const e=yield async function(t,e,o,r){return new Promise(((t,s)=>{const i=new Worker(new URL(n.p+n.u(412),n.b));i.postMessage(ee(EDA.partialLeastSquareRegression.arguments,[e,o,r])),i.onmessage=function(e){i.terminate(),t(ne(EDA.partialLeastSquareRegression,e.data))}}))}(t.table,t.features,t.predict,t.components);return{prediction:e[Ae.PREDICTION],regressionCoefficients:e[Ae.REGR_COEFFS],tScores:e[Ae.T_SCORES],uScores:e[Ae.U_SCORES],xLoadings:e[Ae.X_LOADINGS],yLoadings:e[Ae.Y_LOADINGS]}}))}Math.min,Math.max;var Re=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};function Le(e,n){return Re(this,void 0,void 0,(function*(){const o=e.length,r=n.length,s=n.stats.avg,i=n.stats.stdev,a=new Float32Array(o+1).fill(0);if(a[o]=s,0===i||1===r)return a;try{const r=[],c=[],l=new Float32Array(o),u=new Float32Array(o);let h=0,f=0;for(const t of e){const e=t.stats;e.stdev>0&&(r.push(h),c.push(t),l[f]=e.avg,u[f]=e.stdev,++f),++h}if(0===f)return a;const m=function(t,e,n,o,r,s,i){return Dt(EDA,"fitLinearRegressionParamsWithDataNormalizing",[t,e,n,o,r,s,i])}(t.DataFrame.fromColumns(c).columns,t.Column.fromFloat32Array("xAvgs",l,f),t.Column.fromFloat32Array("xStdevs",u,f),n,s,i,f+1).getRawData();for(let t=0;t<f;++t)a[r[t]]=m[t];a[o]=m[f]}catch(r){const s=yield function(e,n,o){return Re(this,void 0,void 0,(function*(){return(yield Oe({table:t.DataFrame.fromColumns([n]),features:e,predict:n,components:o,names:void 0})).regressionCoefficients.getRawData()}))}(e,n,Pe(e.length,n.length));let i=0;for(let t=0;t<o;++t)a[t]=s[t],i+=s[t]*e.byIndex(t).stats.avg;a[o]-=i}return a}))}function De(e,n){const o=e.length;if(o!==n.length-1)throw new Error("Incorrect parameters count");const r=e.byIndex(0),s=r.length,i=new Float32Array(s);let a=r.getRawData();const c=n[o];let l=n[0];for(let t=0;t<s;++t)i[t]=c+l*a[t];for(let t=1;t<o;++t){a=e.byIndex(t).getRawData(),l=n[t];for(let t=0;t<s;++t)i[t]+=l*a[t]}return t.Column.fromFloat32Array(e.getUnusedName("prediction"),i,s)}const Pe=(t,e)=>e<=t?Math.min(10,e):Math.min(10,t);var Fe;!function(t){t[t.MAX_SAMLPES=1e5]="MAX_SAMLPES",t[t.MAX_FEATURES=1e3]="MAX_FEATURES"}(Fe||(Fe={}));class Ue{static isApplicable(t,e){for(const e of t)if(!e.matches("numerical"))return!1;return!!e.matches("numerical")}static isInteractive(t,e){return t.length<=Fe.MAX_FEATURES&&e.length<=Fe.MAX_SAMLPES}constructor(e){if(this.specn=null,e)try{const n=new Uint32Array(e.buffer,0,2),o=n[0],r=n[1],s=new Uint8Array(e.buffer,8,o),i=t.DataFrame.fromByteArray(s),a=i.rowCount,c=i.columns,l=c.length,u=new Uint8Array(e.buffer,8+o,r),h=t.DataFrame.fromByteArray(u);if(l<3)throw new Error("incorrect columns count");const f=c.byName(de.FEATURES).toList(),m=new Float32Array(a);m.set(c.byName(de.REGR_COEFS).getRawData());const d=l-2,y=new Array(d);for(let t=0;t<d;++t)y[t]=new Float32Array(a),y[t].set(c.byIndex(t+2).getRawData());this.specn={params:m,loadings:y,names:f,dim:a-1,components:l-2,scores:h}}catch(t){throw new Error(`Failed to load model: ${t instanceof Error?t.message:"the platform issue"}`)}}fit(e,n,o){return r=this,s=void 0,a=function*(){const r=yield Oe({table:t.DataFrame.fromColumns([n]),features:e,predict:n,components:o,names:void 0}),s=e.names();s.push("_");const i=this.getRegrCoeffs(e,n,r.regressionCoefficients),a=this.getLoadings(o,r.xLoadings);this.specn={names:s,params:i,loadings:a,components:o,dim:e.length,scores:this.getScoresDf(r)},this.computeExplVars(n.length,o,r.yLoadings)},new((i=void 0)||(i=Promise))((function(t,e){function n(t){try{c(a.next(t))}catch(t){e(t)}}function o(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(n,o)}c((a=a.apply(r,s||[])).next())}));var r,s,i,a}getLoadings(t,e){const n=Array(t),o=e[0].length+1;for(let r=0;r<t;++r)n[r]=new Float32Array(o),n[r].set(e[r].getRawData());return n}getRegrCoeffs(t,e,n){const o=t.length,r=new Float32Array(o+1),s=n.getRawData();let i=0;for(let e=0;e<o;++e)r[e]=s[e],i+=s[e]*t.byIndex(e).stats.avg;return r[o]=e.stats.avg-i,r}computeExplVars(t,e,n){if(null===this.specn)throw new Error("Failed to compute explained variances");const o=n.getRawData(),r=this.specn.loadings[0].length-1;let s=Math.pow(o[0],2)/t;this.specn.loadings[0][r]=s;for(let n=1;n<e;++n)s+=Math.pow(o[n],2)/t,this.specn.loadings[n][r]=s}toBytes(){if(null===this.specn)throw new Error("Failed to pack untrained model");const e=t.DataFrame.fromColumns([t.Column.fromStrings(de.FEATURES,this.specn.names),t.Column.fromFloat32Array(de.REGR_COEFS,this.specn.params)]);this.specn.loadings.forEach(((n,o)=>e.columns.add(t.Column.fromFloat32Array(`${de.XLOADING}${o+1}`,n))));const n=e.toByteArray(),o=n.length,r=this.specn.scores.toByteArray(),s=r.length,i=o+s+8,a=new Uint8Array(64*(Math.ceil(i/64)+1)),c=new Uint32Array(a.buffer,0,2);return c[0]=o,c[1]=s,a.set(n,8),a.set(r,8+o),a}predict(t){if(null===this.specn)throw new Error("Predicting failed: model is not trained");return De(t,this.specn.params)}loadingsParamsViewers(){if(null===this.specn)throw new Error("Failed to create loadings and parameters viewers: untrained model");const e=[],n=this.specn.dim,o=t.DataFrame.fromColumns([t.Column.fromStrings(de.FEATURES,this.specn.names.slice(0,-1)),t.Column.fromFloat32Array(de.REGR_COEFS,this.specn.params,n)]),r=o.columns,s=r.length,i=this.specn.components;return this.specn.loadings.forEach(((e,r)=>o.columns.add(t.Column.fromFloat32Array(`${de.XLOADING}${r+1}`,e,n)))),e.push(t.Viewer.scatterPlot(o,{title:de.LOADINGS,xColumnName:r.byIndex(s).name,yColumnName:r.byIndex(s+(i>1?1:0)).name,markerType:t.MARKER_TYPE.CIRCLE,labels:de.FEATURES,help:pe.LOADINGS})),e.push(t.Viewer.barChart(o,{title:de.REGR_COEFS,splitColumnName:de.FEATURES,valueColumnName:de.REGR_COEFS,valueAggrType:t.AGG.AVG,help:pe.COEFFS,showValueSelector:!1,showStackSelector:!1})),e}explVarsViewer(){if(null===this.specn)throw new Error("Failed to create exaplained variances viewer: untrained model");const e=this.specn.components,n=this.specn.dim,o=new Array(e),r=new Float32Array(e);o[0]=`${Ce.COMP} 1`,r[0]=this.specn.loadings[0][n];for(let t=1;t<e;++t)o[t]=`${Ce.COMPS} ${t+1}`,r[t]=this.specn.loadings[t][n];return t.Viewer.barChart(t.DataFrame.fromColumns([t.Column.fromStrings(Ce.COMPS,o),t.Column.fromFloat32Array(de.EXPL_VAR,r)]),{title:de.EXPL_VAR,splitColumnName:Ce.COMPS,valueColumnName:de.EXPL_VAR,valueAggrType:t.AGG.AVG,help:pe.EXPL_VARS,showCategorySelector:!1,showStackSelector:!1,showValueSelector:!1})}viewers(){if(null===this.specn)throw new Error("Failed to create viewers: untrained model");const t=this.loadingsParamsViewers();return t.push(this.explVarsViewer(),this.getScoresScatter()),t}getScoresDf(e){const n=e.tScores,o=e.uScores;return n.forEach(((t,e)=>t.name=`${de.XSCORE}${e+1}`)),o.forEach(((t,e)=>t.name=`${de.YSCORE}${e+1}`)),t.DataFrame.fromColumns(n.concat(o))}getScoresScatter(){if(null===this.specn)throw new Error("Failed to create scores scatter: untrained model");const e=this.specn.scores.columns.names(),n=t.Viewer.scatterPlot(this.specn.scores,{title:de.SCORES,xColumnName:e[0],yColumnName:e[1],markerType:t.MARKER_TYPE.CIRCLE,help:pe.SCORES,showViewerFormulaLines:!0});return n.meta.formulaLines.addAll(function(t){const e=[],n=(t,n)=>{e.push({type:"line",formula:t,width:1,visible:!0,title:" ",min:-n,max:n,color:Ie.CIRCLE})};return t.forEach((o=>{const r="${"+o+"}";e.push({type:"line",formula:`${r} = 0`,width:1,visible:!0,title:" ",color:Ie.AXIS}),t.forEach((t=>{const e="${"+t+"}";Ne.forEach((t=>{n(e+` = sqrt(${t*t} - ${r} * ${r})`,t),n(e+` = -sqrt(${t*t} - ${r} * ${r})`,t)}))}))})),e}(e)),n}}function Be(t,e){if(t.length!==e.length)throw new Error(`Non-equal elements count: ${t.length} vs. ${e.length}`)}function ke(n,o,r){const s=e.data.demo.randomWalk(n,o),i=s.columns,a=new Float32Array(o),c=new Array(o);for(let t=0;t<o;++t)c[t]=i.byIndex(t).getRawData();for(let e=0;e<r;++e){const r=new Float32Array(n);for(let t=0;t<o;++t)a[t]=Math.random();for(let t=0;t<n;++t)for(let e=0;e<o;++e)r[t]+=a[e]*c[e][t];i.add(t.Column.fromFloat32Array(`y${e}`,r))}return s}function He(t,e){Be(t,e);let n=0;const o=t.length,r=t.getRawData(),s=e.getRawData();for(let t=0;t<o;++t)n=Math.max(n,Math.abs(r[t]-s[t]));return n}function Ge(e,n,o){const r=new Array(e),s=new Array(n);for(let t=0;t<n;++t){const n=new Float32Array(e);for(let t=0;t<e;++t)n[t]=Math.random();s[t]=n}const i=t.DataFrame.fromColumns(s.map(((e,n)=>t.Column.fromFloat32Array(`#${n}`,e))));for(let t=0;t<e;++t)r[t]=s.slice(0,2).map((e=>e[t]>.5?"A":"B")).join("");if(i.columns.add(t.Column.fromStrings("Labels",r)),o)for(let t=0;t<n;++t)for(let n=0;n<e;++n)s[t][n]+=1*(s[t][n]>0?1:-1);return i}function Ve(t,e){Be(t,e);let n=0;const o=t.length;if(o<1)return 1;for(let r=0;r<o;++r)t.get(r)===e.get(r)&&++n;return n/o}var We=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const $e=100,Ye=4e3,Xe=.1;L("Principal component analysis",(()=>{O("Performance: 100K rows, 100 cols, 3 components",(()=>We(void 0,void 0,void 0,(function*(){const t=e.data.demo.randomWalk(1e5,$e);yield Me(0,t.columns,3,!1,!1)}))),{timeout:Ye,benchmark:!0}),O("Correctness",(()=>We(void 0,void 0,void 0,(function*(){const t=ke(100,3,5);R(function(t){let e=0;const n=t.length,o=t.getRawData();for(let t=0;t<n;++t)e=Math.max(e,Math.abs(o[t]));return e}((yield Me(0,t.columns,4,!1,!1)).columns.byIndex(3))<Xe,!0,"Incorrect PCA computations")}))),{timeout:Ye})})),L("Partial least squares regression",(()=>{O("Performance: 100K rows, 100 cols, 3 components",(()=>We(void 0,void 0,void 0,(function*(){const t=e.data.demo.randomWalk(1e5,$e),n=t.columns;yield Oe({table:t,features:n,predict:n.byIndex(99),components:3,names:void 0})}))),{timeout:Ye,benchmark:!0}),O("Correctness",(()=>We(void 0,void 0,void 0,(function*(){const t=ke(100,3,5),e=t.columns,n=e.byIndex(7),o=He(n,(yield Oe({table:t,features:e,predict:n,components:3,names:void 0})).prediction);R(o<Xe,!0,`Incorrect PLS computations, error is too big: ${o}; expected: < 0.1`)}))),{timeout:Ye}),O("Predictive modeling: 100K samples, 100 features, 3 components",(()=>We(void 0,void 0,void 0,(function*(){const t=ke(1e5,3,98).columns,e=t.byIndex($e);t.remove(e.name);const n=new Ue;yield n.fit(t,e,3);const o=n.toBytes(),r=He(e,new Ue(o).predict(t));R(r<Xe,!0,`Incorrect PLS (ML) computations, error is too big: ${r}; expected: < 0.1`)}))),{timeout:Ye,benchmark:!0})})),L("Linear regression",(()=>{O("Performance: 100K samples, 100 features",(()=>We(void 0,void 0,void 0,(function*(){const t=ke(1e5,$e,1).columns,e=t.byIndex($e),n=yield Le(t,e),o=new Uint8Array(n.buffer);De(t,new Float32Array(o.buffer))}))),{timeout:Ye,benchmark:!0}),O("Correctness",(()=>We(void 0,void 0,void 0,(function*(){const t=ke(100,2,1).columns,e=t.byIndex(2),n=yield Le(t,e),o=new Uint8Array(n.buffer),r=De(t,new Float32Array(o.buffer)),s=He(r,r);R(s<Xe,!0,`Incorrect linear regression computations, error is too big: ${s}; expected: < 0.1`)}))),{timeout:Ye})}));var Ke=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const je="Avg-s",ze="Stddev-s";var qe;!function(t){t[t.MAX_SAMLPES=5e4]="MAX_SAMLPES",t[t.MAX_FEATURES=100]="MAX_FEATURES"}(qe||(qe={}));class Qe{static isApplicable(e,n){for(const t of e)if(!t.matches("numerical"))return!1;return n.type===t.COLUMN_TYPE.STRING}static isInteractive(t,e){return t.length<=qe.MAX_FEATURES&&e.length<=qe.MAX_SAMLPES}constructor(e,n){if(this.params=void 0,this.classesCount=1,this.featuresCount=1,void 0!==e){const t=e.featuresCount,n=e.classesCount;if(t<1)throw new Error("Incorrect features count");if(n<1)throw new Error("Incorrect classes count");const o=t+1;this.avgs=new Float32Array(o),this.stdevs=new Float32Array(o),this.categories=new Array(o),this.featuresCount=t,this.classesCount=n}else{if(void 0===n)throw new Error("Softmax classifier not initialized");try{const e=new Uint32Array(n.buffer,0,1)[0],o=new Uint8Array(n.buffer,4,e),r=t.DataFrame.fromByteArray(o),s=r.columns,i=s.length;if(i<3)throw new Error("incorrect columns count");this.classesCount=i-2,this.featuresCount=r.rowCount-1;const a=this.classesCount;this.params=new Array(a),this.categories=new Array(r.rowCount);for(let e=0;e<a;++e){const n=s.byIndex(e);if(this.categories[e]=n.name,n.type!==t.COLUMN_TYPE.FLOAT)throw new Error(`Incorrect input column type. Expected: float, passed: ${n.type}`);this.params[e]=n.getRawData()}const c=s.byName(je);if(c.type!==t.COLUMN_TYPE.FLOAT)throw new Error("incorrect average values column type");this.avgs=c.getRawData();const l=s.byName(ze);if(l.type!==t.COLUMN_TYPE.FLOAT)throw new Error("incorrect standard deviations column type");this.stdevs=l.getRawData()}catch(t){throw new Error(`Failed to load model: ${t instanceof Error?t.message:"the platform issue"}`)}}}toBytes(){if(void 0===this.params)throw new Error("Non-trained model");const e=this.classesCount,n=new Array(e+2);for(let o=0;o<e;++o)n[o]=t.Column.fromFloat32Array(this.categories[o],this.params[o]);n[e]=t.Column.fromFloat32Array(je,this.avgs),n[e+1]=t.Column.fromFloat32Array(ze,this.stdevs);const o=t.DataFrame.fromColumns(n).toByteArray(),r=o.length,s=new Uint8Array(r+4);return new Uint32Array(s.buffer,0,1)[0]=r,s.set(o,4),s}fit(e,n){return Ke(this,arguments,void 0,(function*(e,n,o=1,r=100,s=.1,i=.001){if(e.length!==this.featuresCount)throw new Error("Training failes - incorrect features count");if(o<=0||r<1||s<=0||i<=0)throw new Error("Training failes - incorrect fitting hyperparameters");this.extractStats(e);const a=n.length,c=n.categories.length,l=n.categories;for(let t=0;t<c;++t)this.categories[t]=l[t];try{const l=function(t,e,n,o,r,s,i,a,c,l,u){return Dt(EDA,"fitSoftmax",[t,e,n,o,r,s,i,a,c,l,u])}(e,t.Column.fromFloat32Array("avgs",this.avgs,this.featuresCount),t.Column.fromFloat32Array("stdevs",this.stdevs,this.featuresCount),t.Column.fromInt32Array("targets",n.getRawData(),a),c,r,o,s,i,this.featuresCount+1,c).columns;this.params=new Array(c);for(let t=0;t<c;++t)this.params[t]=l.byIndex(t).getRawData()}catch(t){try{this.params=yield this.fitSoftmaxParams(e,n,r,o,s,i)}catch(t){throw new Error("Training failes")}}if(void 0===this.params)throw new Error("Training failes")}))}extractStats(e){let n=0;for(const o of e){if(o.type!==t.COLUMN_TYPE.INT&&o.type!==t.COLUMN_TYPE.FLOAT)throw new Error("Training failes - incorrect features type");this.avgs[n]=o.stats.avg,this.stdevs[n]=o.stats.stdev,++n}}normalized(e){const n=e.byIndex(0).length,o=new Array(n);for(let t=0;t<n;++t)o[t]=new Float32Array(this.featuresCount);let r=0;for(const s of e){if(s.type!==t.COLUMN_TYPE.INT&&s.type!==t.COLUMN_TYPE.FLOAT)throw new Error("Training failes - incorrect features type");const e=s.getRawData(),i=this.avgs[r],a=this.stdevs[r];if(a>0)for(let t=0;t<n;++t)o[t][r]=(e[t]-i)/a;else for(let t=0;t<n;++t)o[t][r]=0;++r}return o}transposed(e){const n=e.byIndex(0).length,o=this.featuresCount,r=new Array(o);for(let t=0;t<o;++t)r[t]=new Float32Array(n);let s=0;for(const o of e){if(o.type!==t.COLUMN_TYPE.INT&&o.type!==t.COLUMN_TYPE.FLOAT)throw new Error("Training failes - incorrect features type");const e=o.getRawData(),i=this.avgs[s],a=this.stdevs[s];if(a>0)for(let t=0;t<n;++t)r[s][t]=(e[t]-i)/a;else for(let t=0;t<n;++t)r[s][t]=0;++s}return r}preprocessedTargets(e){if(e.type!==t.COLUMN_TYPE.STRING)throw new Error("Training failes - incorrect target type");const n=this.classesCount,o=e.length,r=e.getRawData(),s=new Array(o),i=new Uint32Array(n).fill(0);for(let t=0;t<o;++t)s[t]=new Uint8Array(n).fill(0);for(let t=0;t<o;++t)s[t][r[t]]=1,++i[r[t]];return{oneHot:s,weights:i}}predict(e){if(void 0===this.params)throw new Error("Non-trained model");if(e.length!==this.featuresCount)throw new Error("Predcition fails: incorrect features count");const n=this.normalized(e),o=n.length,r=this.featuresCount,s=this.classesCount;let i,a;const c=new Float32Array(s);let l,u,h;const f=new Array(o);for(let t=0;t<o;++t){i=n[t],l=0;for(let t=0;t<s;++t){a=this.params[t],l=a[r];for(let t=0;t<r;++t)l+=a[t]*i[t];c[t]=Math.exp(l)}u=c[0],h=0;for(let t=1;t<s;++t)u<c[t]&&(u=c[t],h=t);f[t]=this.categories[h]}return t.Column.fromStrings("predicted",f)}fitSoftmaxParams(t,e,o,r,s,i){return Ke(this,void 0,void 0,(function*(){const a=this.preprocessedTargets(e);return new Promise(((c,l)=>{const u=new Worker(new URL(n.p+n.u(501),n.b));u.postMessage({features:this.normalized(t),transposed:this.transposed(t),oneHot:a.oneHot,classesWeights:a.weights,targetRaw:e.getRawData(),iterations:o,rate:r,penalty:s,tolerance:i}),u.onmessage=function(t){u.terminate(),c(t.data.params),console.log(`Loss: ${t.data.loss}`)}}))}))}}var Je,Ze,tn;!function(t){t[t.ITERATIONS=20]="ITERATIONS",t[t.ETA=.3]="ETA",t[t.MAX_DEPTH=6]="MAX_DEPTH",t[t.LAMBDA=1]="LAMBDA",t[t.ALPHA=0]="ALPHA"}(Je||(Je={})),function(t){t[t.SAMLPES_HIGH=1e5]="SAMLPES_HIGH",t[t.SAMLPES_MID=5e4]="SAMLPES_MID",t[t.SAMPLES_LOW=1e4]="SAMPLES_LOW",t[t.FEATURES_HIGH=10]="FEATURES_HIGH",t[t.FEATURES_MID=20]="FEATURES_MID",t[t.FEATURES_LOW=100]="FEATURES_LOW"}(Ze||(Ze={})),function(t){t[t.MODEL=1e7]="MODEL",t[t.UTILS=1]="UTILS",t[t.PACK=128]="PACK",t[t.SIZE=4]="SIZE"}(tn||(tn={}));const en=t.FLOAT_NULL;var nn;!function(t){t.PREDICT="Prediction",t.TYPE="Type",t.PARAMS="Params count",t.CATS="Categories",t.CATS_SIZE="Categories size"}(nn||(nn={}));class on{static isApplicable(t,e){for(const e of t)if(!e.matches("numerical"))return!1;return!(!e.matches("numerical")&&!e.matches("string"))}static isInteractive(t,e){const n=t.length,o=e.length;return o<=Ze.SAMPLES_LOW?n<=Ze.FEATURES_LOW:o<=Ze.SAMLPES_MID?n<=Ze.FEATURES_MID:o<=Ze.SAMLPES_HIGH&&n<=Ze.FEATURES_HIGH}constructor(e){var n;if(this.modelParams=void 0,this.targetType=void 0,this.targetCategories=void 0,e)try{let o=0;const r=new Uint32Array(e.buffer,o,1)[0];o+=tn.SIZE;const s=t.DataFrame.fromByteArray(new Uint8Array(e.buffer,o,r));o+=r,this.targetType=s.get(nn.TYPE,0);const i=s.get(nn.PARAMS,0),a=s.get(nn.CATS_SIZE,0);if(a>0){const r=t.DataFrame.fromByteArray(new Uint8Array(e.buffer,o,a));this.targetCategories=null===(n=r.col(nn.CATS))||void 0===n?void 0:n.toList()}o+=a,o=4*Math.ceil(o/4),this.modelParams=new Int32Array(e.buffer,o,i)}catch(t){throw new Error(`Failed to load model: ${t instanceof Error?t.message:"the platform issue"}`)}}fit(e,o){return r=this,s=arguments,a=function*(e,o,r=Je.ITERATIONS,s=Je.ETA,i=Je.MAX_DEPTH,a=Je.LAMBDA,c=Je.ALPHA){this.targetType=o.type,this.targetType===t.COLUMN_TYPE.STRING&&(this.targetCategories=o.categories),this.modelParams=yield async function(t,e,o,r,s,i,a,c,l,u){return new Promise(((h,f)=>{const m=e.length,d=t.length,y=new Float32Array(m*d);let p,g;for(let e=0;e<d;++e){g=t.byIndex(e).getRawData(),p=e*m;for(let t=0;t<m;++t)y[t+p]=g[t]}const C=new Worker(new URL(n.p+n.u(990),n.b));C.postMessage({features:y,target:e.getRawData(),samplesCount:m,featuresCount:d,modelReserve:l,utilsLength:u,iterations:r,eta:s,maxDepth:i,lambda:a,alpha:c,missingValue:o}),C.onmessage=function(t){C.terminate(),h(t.data.params)}}))}(e,o,en,r,s,i,a,c,tn.MODEL,tn.UTILS)},new((i=void 0)||(i=Promise))((function(t,e){function n(t){try{c(a.next(t))}catch(t){e(t)}}function o(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(n,o)}c((a=a.apply(r,s||[])).next())}));var r,s,i,a}predict(e){if(void 0===this.modelParams)throw new Error("Failed to apply non-trained model");const n=function(t,e,n){const o=t.byIndex(0).length,r=t.length,s=n.length;let i=XGBoostModule.HEAPF32;const a=XGBoostModule.HEAP32,c=XGBoostModule._malloc(o*r*4),l=XGBoostModule._malloc(4*o),u=XGBoostModule._malloc(4*s);for(let e=0;e<r;++e){const n=t.byIndex(e).getRawData();for(let t=0;t<o;++t)i[c/4+t+e*o]=n[t]}for(let t=0;t<s;++t)a[u/4+t]=n[t];XGBoostModule._predict(c,o,r,e,u,s,l,o),i=XGBoostModule.HEAPF32;const h=new Float32Array(o);for(let t=0;t<o;++t)h[t]=i[l/4+t];return XGBoostModule._free(c),XGBoostModule._free(l),XGBoostModule._free(u),h}(e,en,this.modelParams);switch(this.targetType){case t.COLUMN_TYPE.STRING:return this.stringColPrediction(n);case t.COLUMN_TYPE.INT:return this.intColPrediction(n);case t.COLUMN_TYPE.BIG_INT:return this.bigIntColPrediction(n);default:return t.Column.fromFloat32Array(nn.PREDICT,n)}}toBytes(){if(void 0===this.modelParams||void 0===this.targetType)throw new Error("Failed to pack non-trained model");const e=void 0!==this.targetCategories?t.DataFrame.fromColumns([t.Column.fromList(t.COLUMN_TYPE.STRING,nn.CATS,this.targetCategories)]).toByteArray():void 0,n=void 0!==e?e.length:0,o=this.modelParams.length*this.modelParams.BYTES_PER_ELEMENT,r=t.DataFrame.fromColumns([t.Column.fromStrings(nn.TYPE,[this.targetType]),t.Column.fromInt32Array(nn.PARAMS,new Int32Array([this.modelParams.length])),t.Column.fromInt32Array(nn.CATS_SIZE,new Int32Array([n]))]).toByteArray(),s=r.length,i=64*Math.ceil((tn.SIZE+s+n+o+tn.PACK)/64),a=new Uint8Array(i);let c=0;return new Uint32Array(a.buffer,c,1)[0]=s,c+=tn.SIZE,a.set(r,c),c+=s,n>0&&a.set(e,c),c+=n,c=4*Math.ceil(c/4),a.set(new Uint8Array(this.modelParams.buffer),c),a}stringColPrediction(e){const n=e.length;if(void 0===this.targetCategories)throw new Error("Predicting fails: undefined categories");const o=new Array(n),r=this.targetCategories.length-1;for(let t=0;t<n;++t)o[t]=this.targetCategories[(s=Math.round(e[t]),Math.max(0,Math.min(s,r)))];var s;return t.Column.fromList(t.COLUMN_TYPE.STRING,nn.PREDICT,o)}intColPrediction(e){const n=e.length,o=new Int32Array(n);for(let t=0;t<n;++t)o[t]=Math.round(e[t]);return t.Column.fromInt32Array(nn.PREDICT,o,n)}bigIntColPrediction(e){const n=e.length,o=new BigInt64Array(n);for(let t=0;t<n;++t)o[t]=BigInt(Math.round(e[t]));return t.Column.fromBigInt64Array(nn.PREDICT,o)}}var rn=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const sn=100,an=8e3;L("Softmax",(()=>{O("Performance: 50K samples, 100 features",(()=>rn(void 0,void 0,void 0,(function*(){const t=Ge(5e4,sn,!1).columns,e=t.byIndex(sn);t.remove(e.name);const n=new Qe({classesCount:e.categories.length,featuresCount:t.length});yield n.fit(t,e);const o=n.toBytes();new Qe(void 0,o).predict(t)}))),{timeout:an,benchmark:!0}),O("Correctness",(()=>rn(void 0,void 0,void 0,(function*(){const t=Ge(50,2,!0).columns,e=t.byIndex(2);t.remove(e.name);const n=new Qe({classesCount:e.categories.length,featuresCount:t.length});yield n.fit(t,e);const o=n.toBytes(),r=Ve(e,new Qe(void 0,o).predict(t));R(r>.9,!0,`Softmax failed, too small accuracy: ${r}; expected: <= 0.9`)}))),{timeout:an})})),L("XGBoost",(()=>{O("Performance: 50K samples, 100 features",(()=>rn(void 0,void 0,void 0,(function*(){const t=Ge(5e4,sn,!1).columns,e=t.byIndex(sn);t.remove(e.name);const n=new on;yield n.fit(t,e);const o=n.toBytes();new on(o).predict(t)}))),{timeout:an,benchmark:!0}),O("Correctness",(()=>rn(void 0,void 0,void 0,(function*(){const t=Ge(50,2,!0).columns,e=t.byIndex(2);t.remove(e.name);const n=new on;yield n.fit(t,e);const o=n.toBytes(),r=Ve(e,new on(o).predict(t));R(r>.9,!0,`XGBoost failed, too small accuracy: ${r}; expected: <= 0.9`)}))),{timeout:an})}));var cn=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const ln=new t.Package;function un(e,n,o){return cn(this,void 0,void 0,(function*(){const r=yield P({category:e,test:n,testContext:o});return t.DataFrame.fromObjects(r)}))}})(),eda_test=o})();
1
+ var eda_test;(()=>{var t={5540:(t,e,n)=>{"use strict";t=n.hmd(t);var o,r=(o="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,r=void 0!==t?t:{};r.ready=new Promise((function(t,o){e=t,n=o}));var s,i=Object.assign({},r),a="object"==typeof window,c="function"==typeof importScripts,l=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||c)&&(c?l=self.location.href:"undefined"!=typeof document&&document.currentScript&&(l=document.currentScript.src),o&&(l=o),l=0!==l.indexOf("blob:")?l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):"",c&&(s=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),r.print||console.log.bind(console);var u,h,f=r.printErr||console.warn.bind(console);Object.assign(r,i),i=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(u=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&_("no native wasm support detected");var m,d,y,p=!1;function g(){var t=h.buffer;r.HEAP8=m=new Int8Array(t),r.HEAP16=new Int16Array(t),r.HEAP32=new Int32Array(t),r.HEAPU8=d=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=y=new Uint32Array(t),r.HEAPF32=new Float32Array(t),r.HEAPF64=new Float64Array(t)}var E=[],C=[],A=[],w=0,v=null,N=null;function _(t){r.onAbort&&r.onAbort(t),f(t="Aborted("+t+")"),p=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var x,S;function T(t){return t.startsWith("data:application/octet-stream;base64,")}function M(t){try{if(t==x&&u)return new Uint8Array(u);if(s)return s(t);throw"both async and sync fetching of the wasm failed"}catch(t){_(t)}}function I(t,e,n){return function(t){return u||!a&&!c||"function"!=typeof fetch?Promise.resolve().then((function(){return M(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return M(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){f("failed to asynchronously prepare wasm: "+t),_(t)}))}function b(t){for(;t.length>0;)t.shift()(r)}function O(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){y[this.ptr+4>>2]=t},this.get_type=function(){return y[this.ptr+4>>2]},this.set_destructor=function(t){y[this.ptr+8>>2]=t},this.get_destructor=function(){return y[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,m[this.ptr+12|0]=t},this.get_caught=function(){return 0!=m[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,m[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=m[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){y[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return y[this.ptr+16>>2]},this.get_exception_ptr=function(){if(G(this.get_type()))return y[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function R(t){var e=h.buffer;try{return h.grow(t-e.byteLength+65535>>>16),g(),1}catch(t){}}function L(t){return r["_"+t]}T(x="wasmDbscan.wasm")||(S=x,x=r.locateFile?r.locateFile(S,l):l+S);var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function D(t,e,n,o,r){var s={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,n=0;n<t.length;++n){var o=t.charCodeAt(n);o<=127?e++:o<=2047?e+=2:o>=55296&&o<=57343?(e+=4,++n):e+=3}return e}(t)+1,n=H(e);return function(t,e,n){!function(t,e,n,o){if(!(o>0))return 0;for(var r=n+o-1,s=0;s<t.length;++s){var i=t.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&t.charCodeAt(++s)),i<=127){if(n>=r)break;e[n++]=i}else if(i<=2047){if(n+1>=r)break;e[n++]=192|i>>6,e[n++]=128|63&i}else if(i<=65535){if(n+2>=r)break;e[n++]=224|i>>12,e[n++]=128|i>>6&63,e[n++]=128|63&i}else{if(n+3>=r)break;e[n++]=240|i>>18,e[n++]=128|i>>12&63,e[n++]=128|i>>6&63,e[n++]=128|63&i}}e[n]=0}(t,d,e,n)}(t,n,e),n}(t)),e},array:t=>{var e,n,o=H(t.length);return e=t,n=o,m.set(e,n),o}},i=L(t),a=[],c=0;if(o)for(var l=0;l<o.length;l++){var u=s[n[l]];u?(0===c&&(c=B()),a[l]=u(o[l])):a[l]=o[l]}var h=i.apply(null,a);return function(t){return 0!==c&&k(c),function(t){return"string"===e?(n=t)?function(t,e,n){for(var o=e+n,r=e;t[r]&&!(r>=o);)++r;if(r-e>16&&t.buffer&&P)return P.decode(t.subarray(e,r));for(var s="";e<r;){var i=t[e++];if(128&i){var a=63&t[e++];if(192!=(224&i)){var c=63&t[e++];if((i=224==(240&i)?(15&i)<<12|a<<6|c:(7&i)<<18|a<<12|c<<6|63&t[e++])<65536)s+=String.fromCharCode(i);else{var l=i-65536;s+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else s+=String.fromCharCode((31&i)<<6|a)}else s+=String.fromCharCode(i)}return s}(d,n,o):"":"boolean"===e?Boolean(t):t;var n,o}(t)}(h)}var F,U={__cxa_throw:function(t,e,n){throw new O(t).init(e,n),t},abort:function(){_("")},emscripten_memcpy_big:function(t,e,n){d.copyWithin(t,e,e+n)},emscripten_resize_heap:function(t){var e,n=d.length,o=2147483648;if((t>>>=0)>o)return!1;for(var r=1;r<=4;r*=2){var s=n*(1+.2/r);if(s=Math.min(s,t+100663296),R(Math.min(o,(e=Math.max(t,s))+(65536-e%65536)%65536)))return!0}return!1}},B=(function(){var t,e,o,s,i={env:U,wasi_snapshot_preview1:U};function a(t,e){var n,o=t.exports;return r.asm=o,h=r.asm.memory,g(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,C.unshift(n),function(){if(w--,r.monitorRunDependencies&&r.monitorRunDependencies(w),0==w&&(null!==v&&(clearInterval(v),v=null),N)){var t=N;N=null,t()}}(),o}if(w++,r.monitorRunDependencies&&r.monitorRunDependencies(w),r.instantiateWasm)try{return r.instantiateWasm(i,a)}catch(t){f("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=u,e=x,o=i,s=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||T(e)||"function"!=typeof fetch?I(e,o,s):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,o).then(s,(function(t){return f("wasm streaming compile failed: "+t),f("falling back to ArrayBuffer instantiation"),I(e,o,s)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(B=r.asm.stackSave).apply(null,arguments)}),k=function(){return(k=r.asm.stackRestore).apply(null,arguments)},H=function(){return(H=r.asm.stackAlloc).apply(null,arguments)},G=function(){return(G=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function t(){F||(F=!0,r.calledRun=!0,p||(b(C),e(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)t=r.postRun.shift(),A.unshift(t);var t;b(A)}()))}w>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)t=r.preRun.shift(),E.unshift(t);var t;b(E)}(),w>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),t()}),1)):t()))}if(r.ccall=D,r.cwrap=function(t,e,n,o){var r=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&r&&!o?L(t):function(){return D(t,e,n,arguments)}},N=function t(){F||V(),F||(N=t)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return V(),t.ready});"object"==typeof exports?t.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},9982:function(t,e,n){var o;!function(){var e={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,o,r,s){for(var i,a,c,l,u,h,f,m,d,y,p,g,E;s>=64;){for(i=n[0],a=n[1],c=n[2],l=n[3],u=n[4],h=n[5],f=n[6],m=n[7],y=0;y<16;y++)p=r+4*y,t[y]=(255&o[p])<<24|(255&o[p+1])<<16|(255&o[p+2])<<8|255&o[p+3];for(y=16;y<64;y++)g=((d=t[y-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,E=((d=t[y-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,t[y]=(g+t[y-7]|0)+(E+t[y-16]|0);for(y=0;y<64;y++)g=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&f)|0)+(m+(e[y]+t[y]|0)|0)|0,E=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&c^a&c)|0,m=f,f=h,h=u,u=l+g|0,l=c,c=a,a=i,i=g+E|0;n[0]+=i,n[1]+=a,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=h,n[6]+=f,n[7]+=m,r+=64,s-=64}return r}var o=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var o=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[o++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(o=n(this.temp,this.state,t,o,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[o++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,o=this.bufferLength,r=e/536870912|0,s=e<<3,i=e%64<56?64:128;this.buffer[o]=128;for(var a=o+1;a<i-8;a++)this.buffer[a]=0;this.buffer[i-8]=r>>>24&255,this.buffer[i-7]=r>>>16&255,this.buffer[i-6]=r>>>8&255,this.buffer[i-5]=r>>>0&255,this.buffer[i-4]=s>>>24&255,this.buffer[i-3]=s>>>16&255,this.buffer[i-2]=s>>>8&255,this.buffer[i-1]=s>>>0&255,n(this.temp,this.state,this.buffer,0,i),this.finished=!0}for(a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=o;var r=function(){function t(t){this.inner=new o,this.outer=new o,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new o).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function s(t){var e=(new o).update(t),n=e.digest();return e.clean(),n}function i(t,e){var n=new r(t).update(e),o=n.digest();return n.clean(),o}function a(t,e,n,o){var r=o[0];if(0===r)throw new Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(o),e.finish(t),o[0]++}t.HMAC=r,t.hash=s,t.default=s,t.hmac=i;var c=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,o){void 0===e&&(e=c),void 0===o&&(o=32);for(var s=new Uint8Array([1]),l=i(e,t),u=new r(l),h=new Uint8Array(u.digestLength),f=h.length,m=new Uint8Array(o),d=0;d<o;d++)f===h.length&&(a(h,u,n,s),f=0),m[d]=h[f++];return u.clean(),h.fill(0),s.fill(0),m},t.pbkdf2=function(t,e,n,o){for(var s=new r(t),i=s.digestLength,a=new Uint8Array(4),c=new Uint8Array(i),l=new Uint8Array(i),u=new Uint8Array(o),h=0;h*i<o;h++){var f=h+1;a[0]=f>>>24&255,a[1]=f>>>16&255,a[2]=f>>>8&255,a[3]=f>>>0&255,s.reset(),s.update(e),s.update(a),s.finish(l);for(var m=0;m<i;m++)c[m]=l[m];for(m=2;m<=n;m++){s.reset(),s.update(l).finish(l);for(var d=0;d<i;d++)c[d]^=l[d]}for(m=0;m<i&&h*i+m<o;m++)u[h*i+m]=c[m]}for(h=0;h<i;h++)c[h]=l[h]=0;for(h=0;h<4;h++)a[h]=0;return s.clean(),u}}(e);var r=e.default;for(var s in e)r[s]=e[s];"object"==typeof t.exports?t.exports=r:void 0===(o=function(){return r}.call(e,n,e,t))||(t.exports=o)}()},944:(t,e)=>{"use strict";e.Vb=void 0,e.Vb=function(t,e,n){var o=function(t,e,n){if(0===t.length||0===e.length)return 0;if(n&&!n.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var o=0,r=t.length,s=e.length,i=Math.floor(Math.max(r,s)/2)-1,a=new Array(r),c=new Array(s),l=0;l<r;l++)for(var u=Math.max(0,l-i);u<=Math.min(s,l+i+1);u++)if(!a[l]&&!c[u]&&t[l]===e[u]){++o,a[l]=c[u]=!0;break}if(0===o)return 0;var h=0,f=0;for(l=0;l<r;l++)if(a[l]){for(;!c[f];)f++;t.charAt(l)!==e.charAt(f++)&&h++}return(o/r+o/s+(o-(h/=2))/o)/3}(t,e,n),r=0;if(o>.7){for(var s=Math.min(t.length,e.length),i=0;t[i]===e[i]&&i<4&&i<s;)++r,i++;o+=.1*r*(1-o)}return o}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var s=e[o]={id:o,loaded:!1,exports:{}};return t[o].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}n.m=t,n.amdO={},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var o=e.getElementsByTagName("script");if(o.length)for(var r=o.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=o[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),n.b=document.baseURI||self.location.href;var o={};(()=>{"use strict";n.r(o),n.d(o,{_package:()=>Nn,test:()=>_n,tests:()=>f});const t=DG,e=grok;n(9982);const r=t.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');r.columns.add(t.Column.fromList(t.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var s=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const i=3e4,a=108e5,c=console.log.bind(console),l=console.info.bind(console),u=console.warn.bind(console),h=console.error.bind(console),f={},m="Auto Tests",d="Demo",y="Detectors",p="Core",g={};let E;var C,A,w,v,N,_,x,S,T,M;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(C||(C={}));class I{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class b{constructor(t,e,n,o){var r;this.category=t,this.name=e,null!=o||(o={}),null!==(r=o.timeout)&&void 0!==r||(o.timeout=i),this.options=o,this.test=()=>s(this,void 0,void 0,(function*(){return new Promise(((t,e)=>s(this,void 0,void 0,(function*(){let o="";try{o=yield n()}catch(t){e(t)}t(o)}))))}))}}function O(t,e,n){null==f[E]&&(f[E]={}),null==f[E].tests&&(f[E].tests=[]),f[E].tests.push(new b(E,t,e,n))}function R(t,e=!0,n){if(n=n?`${n}, `:"",t!==e)throw new Error(`${n}Expected "${e}", got "${t}"`)}function L(t,e,n){var o;E=t,e(),f[E]&&(f[E].clear=null===(o=null==n?void 0:n.clear)||void 0===o||o,f[E].timeout=null==n?void 0:n.timeout,f[E].benchmarks=null==n?void 0:n.benchmarks,f[E].stressTests=null==n?void 0:n.stressTests)}function P(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function D(n){var o,a,E,C;return s(this,void 0,void 0,(function*(){const A=null===(a=null===(o=e.functions.getCurrentCall())||void 0===o?void 0:o.func)||void 0===a?void 0:a.package;yield function(n){var o,a,c,l;return s(this,void 0,void 0,(function*(){const u=n.id;if(g[u])return;const h=f;if(void 0!==h[m]||void 0!==h[d]||Object.keys(h).find((t=>t.startsWith(m)||t.startsWith(p))))return void(g[u]=!0);if("DevTools"===n.name)for(const t of window.dartTests){const e=t.name.split(/\s*\|\s*!/g);let n=null!==(o=e.pop())&&void 0!==o?o:t.name,r=e.length?p+": "+e.join(": "):p,s=n.split(" | ");n=s[s.length-1],s.unshift(r),s.pop(),r=s.join(": "),void 0===h[r]&&(h[r]={tests:[],clear:!0}),h[r].tests.push(new b(r,n,t.test,{isAggregated:!1,timeout:null!==(c=null===(a=t.options)||void 0===a?void 0:a.timeout)&&void 0!==c?c:i,skipReason:null===(l=t.options)||void 0===l?void 0:l.skipReason}))}const E=[],C=[],A=[],w=yield e.dapi.functions.filter(`package.id = "${u}"`).list(),v=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const n of w){const o=n.options.test,i=n.options.demoPath;if(o&&Array.isArray(o)&&o.length)for(let r=0;r<o.length;r++){const i=o[r].matchAll(v),a={};Array.from(i).forEach((t=>{t[0].startsWith("skip")?a.skip=t[1]:t[0].startsWith("wait")?a.wait=parseInt(t[2]):t[0].startsWith("cat")?a.cat=t[3]:t[0].startsWith("timeout")&&(a.timeout=parseInt(t[4]))}));const c=new b(m,1===o.length?n.name:`${n.name} ${r+1}`,(()=>s(this,void 0,void 0,(function*(){const t=yield e.functions.eval(P(o[r],n));if(a.wait&&(yield B(a.wait)),"boolean"==typeof t&&!t)throw`Failed: ${o[r]}, expected true, got ${t}`}))),{skipReason:a.skip,timeout:t.Test.isInBenchmark?a.benchmarkTimeout:a.timeout});if(a.cat){const t=m+": "+a.cat;c.category=t,void 0===h[t]&&(h[t]={tests:[],clear:!0}),h[t].tests.push(c)}else E.push(c)}if(i){const o=n.options.demoWait?parseInt(n.options.demoWait):void 0,r=new b(d,n.friendlyName,(()=>s(this,void 0,void 0,(function*(){e.shell.isInDemo=!0,void 0===e.shell.view(t.View.BROWSE)&&(e.shell.v=t.View.createByType(t.View.BROWSE)),yield B(300),e.shell.clearLastError(),yield n.apply(),yield B(o||2e3);const r=yield e.shell.lastError;if(r)throw new Error(r);e.shell.isInDemo=!1}))),{skipReason:n.options.demoSkip});C.push(r)}if(n.hasTag("semTypeDetector")){const t=new b(y,n.friendlyName,(()=>s(this,void 0,void 0,(function*(){const t=[];for(const e of r.clone().columns){const o=yield n.apply([e]);t.push(o||e.semType)}R(t.filter((t=>t)).length,1)}))),{skipReason:n.options.skipTest});A.push(t)}}g[u]=!0,E.length&&(h[m]={tests:E,clear:!0}),C.length&&(h[d]={tests:C,clear:!0}),A.length&&(h[y]={tests:A,clear:!1})}))}(A);const w=[];console.log("Running tests"),null!=n||(n={}),null!==(E=(C=n).testContext)&&void 0!==E||(C.testContext=new I),e.shell.clearLastError();const v=function(){const t=[];return console.log=(...e)=>{t.push(...e),c(...e)},console.info=(...e)=>{t.push(...e),l(...e)},console.warn=(...e)=>{t.push(...e),u(...e)},console.error=(...e)=>{t.push(...e),h(...e)},t}();(null==n?void 0:n.stressTest)?yield function(e){var n,o,r,i,a,c;return s(this,void 0,void 0,(function*(){let s=[];for(const[t,e]of Object.entries(f)){let t=null===(n=e.tests)||void 0===n?void 0:n.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest}));e.stressTests&&(t=null===(o=e.tests)||void 0===o?void 0:o.filter((t=>{var e,n;return void 0===(null===(e=t.options)||void 0===e?void 0:e.stressTest)||!0===(null===(n=t.options)||void 0===n?void 0:n.stressTest)})));const a=null===(r=e.tests)||void 0===r?void 0:r.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));if(!a)for(let n of null!=t?t:[])null==(null===(i=n.options)||void 0===i?void 0:i.skipReason)&&s.push({test:n,value:e})}s=function(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}(s);const l=[];for(let n of s){yield N(n.value.before,null!==(a=e.category)&&void 0!==a?a:"");let o=yield U(n.test,null==e?void 0:e.test,v,t.Test.isInBenchmark?n.value.benchmarkTimeout:n.value.timeout,A.name,e.verbose);o&&l.push(o),console.log(`Test: ${null==O?void 0:O.name}; result: ${o}`),yield N(n.value.after,null!==(c=e.category)&&void 0!==c?c:"")}w.push(...l)}))}(n):yield function(n,o){var r,i,a,f,m,d,y;return s(this,void 0,void 0,(function*(){try{for(const[s,l]of Object.entries(n)){if((null==o?void 0:o.category)&&!s.toLowerCase().startsWith(null==o?void 0:o.category.toLowerCase())||(null===(r=o.exclude)||void 0===r?void 0:r.some((t=>s.startsWith(t)))))continue;c(`Started ${s} category`);const n=null===(i=l.tests)||void 0===i?void 0:i.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));n||(l.beforeStatus=yield N(l.before,null!==(a=o.category)&&void 0!==a?a:""));const u=null!==(f=l.tests)&&void 0!==f?f:[],h=[];if(l.clear)for(let n=0;n<u.length;n++){u[n].options&&void 0===(null===(m=u[n].options)||void 0===m?void 0:m.benchmark)&&(u[n].options||(u[n].options={}),u[n].options.benchmark=null!==(d=l.benchmarks)&&void 0!==d&&d);let r=yield U(u[n],null==o?void 0:o.test,v,t.Test.isInBenchmark?l.benchmarkTimeout:l.timeout,A.name,o.verbose);r&&h.push(r),e.shell.closeAll(),t.Balloon.closeAll()}else for(let e=0;e<u.length;e++){let n=yield U(u[e],null==o?void 0:o.test,v,t.Test.isInBenchmark?l.benchmarkTimeout:l.timeout,A.name,o.verbose);n&&h.push(n)}const p=h.filter((t=>"skipped"!=t.result));n||(l.afterStatus=yield N(l.after,null!==(y=o.category)&&void 0!==y?y:"")),l.afterStatus&&p.push({date:(new Date).toISOString(),logs:"",category:s,name:"after",result:l.afterStatus,success:!1,ms:0,skipped:!1}),l.beforeStatus&&p.push({date:(new Date).toISOString(),logs:"",category:s,name:"before",result:l.beforeStatus,success:!1,ms:0,skipped:!1}),w.push(...p)}}finally{console.log=c,console.info=l,console.warn=u,console.error=h}if(o.testContext.catchUnhandled&&!t.Test.isInBenchmark){yield B(1e3);const t=yield e.shell.lastError,n={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=t?t:"",success:!t,ms:0,skipped:!1};w.push(n),n.package=A.name,null!=e.shell.reportTest?yield e.shell.reportTest("package",n):yield fetch(`${e.dapi.root}/log/tests/package`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(n)})}}))}(f,n);for(let t of w)t.result=t.result.toString().replace(/"/g,"'"),null!=t.logs&&(t.logs=t.logs.toString().replace(/"/g,"'"));return w;function N(t,e){return s(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==t&&(yield k((()=>s(this,void 0,void 0,(function*(){yield t()}))),1e5,`before ${e}: timeout error`))}catch(t){n=yield F(t)}return n}))}}))}function F(e){return s(this,void 0,void 0,(function*(){return`${e.toString()}\n${e.stack?yield t.Logger.translateStackTrace(e.stack):""}`}))}function U(n,o,r,l,u,f){var m,d,y,p,g,E,C,A;return s(this,void 0,void 0,(function*(){let s;r.length=0;let w="package";const v=null!=o&&n.name.toLowerCase()!==o.toLowerCase();let N=(null===(m=n.options)||void 0===m?void 0:m.skipReason)||v,_=v?"skipped":null===(d=n.options)||void 0===d?void 0:d.skipReason;if(t.Test.isInBenchmark&&!(null===(y=n.options)||void 0===y?void 0:y.benchmark))return void c(`SKIPPED: ${n.category} ${n.name} doesnt available in benchmark mode`);N||c(`Started ${n.category} ${n.name}`);const x=Date.now();try{if(N)s={date:(new Date).toISOString(),success:!0,result:_,ms:0,skipped:!0};else{let e=(null===(p=n.options)||void 0===p?void 0:p.timeout)===i&&l?l:null===(g=n.options)||void 0===g?void 0:g.timeout;e=e===i&&t.Test.isInBenchmark?a:e,s={date:(new Date).toISOString(),success:!0,result:null!==(E=yield k(n.test,e))&&void 0!==E?E:"OK",ms:0,skipped:!1}}}catch(t){h(t),s={date:(new Date).toISOString(),success:!1,result:yield F(t),ms:0,skipped:!1}}if((null===(C=n.options)||void 0===C?void 0:C.isAggregated)&&s.result.constructor===t.DataFrame){const t=s.result.col("success");if(t&&(s.success=t.stats.sum===t.length),!f){const t=s.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),s.result=t}s.result=s.result.toCsv()}if(s.logs=r.join("\n"),s.ms=Date.now()-x,N||c(`Finished ${n.category} ${n.name} for ${s.ms} ms`),s.category=n.category,s.name=n.name,!v){let o={success:s.success,result:s.result,ms:s.ms,skipped:s.skipped,package:u,category:n.category,name:n.name,logs:s.logs};if(s.result.constructor==Object){const t=Object.keys(s.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:s.result[e]})),{});o=Object.assign(Object.assign({},o),t)}o.result instanceof t.DataFrame&&(o.result=JSON.stringify(null===(A=o.result)||void 0===A?void 0:A.toJson())||""),null!=e.shell.reportTest?yield e.shell.reportTest(w,o):yield fetch(`${e.dapi.root}/log/tests/${w}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(o)})}return s}))}function B(t){return s(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function k(t,e,n="EXECUTION TIMEOUT"){return s(this,void 0,void 0,(function*(){let o=null;const r=new Promise(((t,r)=>{o=setTimeout((()=>{r(n)}),e)}));try{return yield Promise.race([t(),r])}finally{o&&clearTimeout(o)}}))}t.DataFrame.fromColumns([t.Column.fromStrings("col",["val1","val2","val3"])]),function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(A||(A={})),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(w||(w={})),function(t){t.Euclidean="Euclidean"}(v||(v={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean"}(N||(N={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(_||(_={})),(M=x||(x={})).Vector="Vector",M.String="String",M.BitArray="BitArray",M.MacroMolecule="MacroMolecule",M.Number="Number",M.IntArray="IntArray",M.NumberArray="NumberArray",function(t){t.Difference="Difference"}(S||(S={})),function(t){t.CommonItems="Common Items"}(T||(T={}));const H=new Uint32Array(65536),G=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,o=e.length,r=1<<n-1;let s=-1,i=0,a=n,c=n;for(;c--;)H[t.charCodeAt(c)]|=1<<c;for(c=0;c<o;c++){let t=H[e.charCodeAt(c)];const n=t|i;t|=(t&s)+s^s,i|=~(t|s),s&=t,i&r&&a++,s&r&&a--,i=i<<1|1,s=s<<1|~(n|i),i&=n}for(c=n;c--;)H[t.charCodeAt(c)]=0;return a})(t,e):((t,e)=>{const n=e.length,o=t.length,r=[],s=[],i=Math.ceil(n/32),a=Math.ceil(o/32);for(let t=0;t<i;t++)s[t]=-1,r[t]=0;let c=0;for(;c<a-1;c++){let i=0,a=-1;const l=32*c,u=Math.min(32,o)+l;for(let e=l;e<u;e++)H[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=H[e.charCodeAt(t)],o=s[t/32|0]>>>t&1,c=r[t/32|0]>>>t&1,l=n|i,u=((n|c)&a)+a^a|n|c;let h=i|~(u|a),f=a&u;h>>>31^o&&(s[t/32|0]^=1<<t),f>>>31^c&&(r[t/32|0]^=1<<t),h=h<<1|o,f=f<<1|c,a=f|~(l|h),i=h&l}for(let e=l;e<u;e++)H[t.charCodeAt(e)]=0}let l=0,u=-1;const h=32*c,f=Math.min(32,o-h)+h;for(let e=h;e<f;e++)H[t.charCodeAt(e)]|=1<<e;let m=o;for(let t=0;t<n;t++){const n=H[e.charCodeAt(t)],i=s[t/32|0]>>>t&1,a=r[t/32|0]>>>t&1,c=n|l,h=((n|a)&u)+u^u|n|a;let f=l|~(h|u),d=u&h;m+=f>>>o-1&1,m-=d>>>o-1&1,f>>>31^i&&(s[t/32|0]^=1<<t),d>>>31^a&&(r[t/32|0]^=1<<t),f=f<<1|i,d=d<<1|a,u=d|~(c|f),l=f&c}for(let e=h;e<f;e++)H[t.charCodeAt(e)]=0;return m})(t,e)};var V=n(944);class W{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,o=W._createBuffer(n);if(e)for(let t=0;t<o.length;t++)o[t]=-1;this._data=o,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,o){if(t<e||t>n)throw new Error(`Argument ${o} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let o=0;o<n;o++)e[o]=t[o]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new W(t._length);n._length=t._length,n._data=W._createBuffer(n._length),n._version=0;const o=t.lengthInInts;for(let r=0;r<o;r++)n._data[r]=t._data[r]&e._data[r];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new W(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new W(t);for(let o=0;o<t;++o)n.setBit(o,e(o));return n._version=0,n}static fromString(t){return W.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new W(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new W(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let o=0,r=0;for(;e-r>=4;)n._data[o++]=255&t[r]|(255&t[r+1])<<8|(255&t[r+2])<<16|(255&t[r+3])<<24,r+=4;return e-r==3&&(n._data[o]=(255&t[r+2])<<16),e-r==2&&(n._data[o]|=(255&t[r+1])<<8),e-r==1&&(n._data[o]|=255&t[r]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new W(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,o=this.lengthInInts;for(let t=0;t<o;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,o=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(o)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,o=!0,r=!0){if(n&&r&&this.setAll(!e,!1),r)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(o)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let o=t;o<e;++o)n.push(this.getBit(o));return W.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let o=t;o<e;++o)n.push(this.getBit(o));return n}setRange(t,e,n,o=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const r=Math.min(t,e),s=Math.max(t,e);if(n)for(let t=r;t<=s;t++)this.setTrue(t);else for(let t=r;t<=s;t++)this.setFalse(t);return this.incrementVersion(o),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const o=this._length;this.setLength(this._length+e);for(let n=o-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let o=t;o<t+e;o++)this.setBit(o,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let o=-1;-1!=(o=t.findNext(o,!e));)this.setFast(n++,this.getBit(o));this._length=n,this._version++}return this}getBit(t){return!!(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=W._onBitCount[255&t];let n=this._data[e];const o=31&this._length;for(0!=o&&(n&=~(4294967295<<o));0!=n;n>>>=8)this._selectedCount+=W._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const o=this.lengthInInts;let r=0;for(;r<o-1;r++)for(let e=this._data[r]&t._data[r];0!=e;e>>>=8)n+=W._onBitCount[255&e];let s=this._data[r]&t._data[r];const i=31&this._length;for(0!=i&&(s&=~(4294967295<<i));0!=s;s>>>=8)n+=W._onBitCount[255&s];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const o=this.lengthInInts;for(let r=Math.floor(t/32);r<o;r++){let o=e?this._data[r]:~this._data[r];if(0!=n)o&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==o)continue;for(let e=0;0!=o;e+=8,o>>>=8){const n=W._firstOnBit[255&o];if(n>=0)return(t=n+32*r+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let o=Math.floor(t/32);o>=0;o--){let t=e?this._data[o]:~this._data[o];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=W._lastOnBit[t>>>24];if(n>=0)return n+32*o+e}}return-1}}function $(t={}){const e=function(){if(!t||!t.scoringMatrix||!t.alphabetIndexes)return(t,e)=>t===e?0:1;if(t.scoringMatrix.length!==Object.keys(t.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const e=t.alphabetIndexes,n=t.scoringMatrix,o=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,r=new Float32Array((n.length+o)*(n.length+o));return Object.entries(e).forEach((([t,o])=>{const s=n[o];Object.entries(e).forEach((([e,o])=>{r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=s[o]}))})),(t,e)=>1-r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,o)=>{let r=0;const s=t.length,i=o.length,a=Math.ceil(Math.max(s,i)*(1-n));s!==i&&(r=Math.abs(s-i));let c=0;for(let n=0;n<Math.min(s,i);n++)if(t[n]!==o[n]&&(c+=e(t[n],o[n]),c>a))return 1;return c+=r,c/=Math.max(s,i),c}}W._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),W._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),W._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7]);const Y={gapOpen:1,gapExtend:.6,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};var K;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(K||(K={}));const X={[K.HAMMING]:$,[K.LEVENSHTEIN]:function(){return(t,e)=>G(t,e)/Math.max(t.length,e.length)},[K.NEEDLEMANN_WUNSCH]:function(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:o,scoringMatrix:r,alphabetIndexes:s}={...Y,...t};Object.entries(s).forEach((([t,n])=>e[t.charCodeAt(0)]=n));const i=[new Float32Array(1e4),new Float32Array(1e4)];return(t,s)=>{const a=new Array(t.length+1).fill(!1),c=new Array(t.length+1).fill(!1);let l=0,u=1;for(let e=1;e<t.length+1;e++)i[0][e]=-o-(e-1)*o,i[1][e]=0;i[0][0]=0;for(let h=1;h<s.length+1;h++){i[u][0]=-o-(h-1)*o;for(let f=1;f<t.length+1;f++){const m=i[l][f-1]+r[e[t.charCodeAt(f-1)]][e[s.charCodeAt(h-1)]],d=i[l][f]-(a[f]||1===h||h===s.length?o:n),y=i[u][f-1]-(c[f-1]||1===f||f===t.length?o:n);i[u][f]=Math.max(m,y,d),i[u][f]===m?(a[f]=!1,c[f]=!1):i[u][f]===y?(a[f]=!1,c[f]=!0):(a[f]=!0,c[f]=!1)}l=u,u=(u+1)%2}const h=Math.min(t.length,s.length);return(h-i[l][t.length])/h}},[K.MONOMER_CHEMICAL_DISTANCE]:$};function j(t,e){const n=t.trueCount()+e.trueCount();if(0==n)return 1;const o=t.andWithCountBits(e,!0);return o/(n-o)}function z(t){return 0===t?3402823e32:1/t-1}N.Tanimoto,N.Dice,N.Asymmetric,N.BraunBlanquet,N.Cosine,N.Kulczynski,N.McConnaughey,N.RogotGoldberg,N.Russel,N.Sokal,N.Hamming,N.Euclidean,N.Tanimoto,N.Dice,N.Asymmetric,N.BraunBlanquet,N.Cosine,N.Kulczynski,N.McConnaughey,N.RogotGoldberg,N.Russel,N.Sokal,N.Hamming,N.Euclidean,N.Tanimoto,N.Dice,N.Cosine,N.Tanimoto,N.Asymmetric,N.Cosine,N.Sokal,K.HAMMING,K.LEVENSHTEIN,K.MONOMER_CHEMICAL_DISTANCE,K.NEEDLEMANN_WUNSCH;const q={[v.Euclidean]:function(t,e){let n=0;const o=t.length;if(o!==e.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<o;++r)n+=Math.pow(t[r]-e[r],2);return Math.sqrt(n)}},Q={[w.Levenshtein]:G,[w.JaroWinkler]:V.Vb,[w.Manhattan]:function(t,e){if(t.length!==e.length)return 1;{let n=0;for(let o=1;o<t.length;o++)n+=t[o]==e[o]?0:1;return n/t.length}},[w.Onehot]:function(t,e){return t===e?0:1}},J={[N.Tanimoto]:function(t,e){return 1-j(t,e)},[N.Dice]:function(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount();return 0==n?0:2*t.andWithCountBits(e,!0)/n}(t,e)},[N.Asymmetric]:function(t,e){return 1-function(t,e){const n=Math.min(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e)},[N.BraunBlanquet]:function(t,e){return z(function(t,e){const n=Math.max(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))},[N.Cosine]:function(t,e){return 1-function(t,e){const n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)/Math.sqrt(n)}(t,e)},[N.Kulczynski]:function(t,e){return z(function(t,e){const n=t.trueCount()+e.trueCount(),o=t.trueCount()*e.trueCount();return 0==o?0:t.andWithCountBits(e,!0)*n/(2*o)}(t,e))},[N.McConnaughey]:function(t,e){return z(function(t,e){const n=t.trueCount()+e.trueCount(),o=t.trueCount()*e.trueCount();return 0==o?0:(t.andWithCountBits(e,!0)*n-o)/o}(t,e))},[N.RogotGoldberg]:function(t,e){return z(function(t,e){const n=t.andWithCountBits(e,!0),o=t.countBits(!0)+e.countBits(!0),r=t.length,s=r-o+n;return n==r||s==r?1:n/o+s/(2*r-o)}(t,e))},[N.Russel]:function(t,e){return z(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))},[N.Sokal]:function(t,e){return 1-function(t,e){const n=t.trueCount()+e.trueCount(),o=t.andWithCountBits(e,!0);return o/(2*n-3*o)}(t,e)},[N.Hamming]:function(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)},[N.Euclidean]:function(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}},Z={[_.TanimotoIntArray]:function(t,e){return z(j(new W(t,32*t.length),new W(e,32*e.length)))}},tt={[S.Difference]:function(t){if(t&&null!=t.range&&t.range>0){const e=t.range;return(t,n)=>Math.abs(t-n)/e}return(t,e)=>Math.abs(t-e)}},et={[T.CommonItems]:function(t){const e=function(t){const e=t?.mostCommon??new Set;return(t,n)=>{const o=t.length,r=n.length;let s=0,i=0,a=0;for(;i<o&&a<r;)t[i]===n[a]?(e?.has(t[i])||++s,++i,++a):t[i]<n[a]?++i:++a;return s}}(t);return(t,n)=>0===n.length||0===t.length?1e4:Math.min(t.length,n.length)/(e(t,n)+1e-4)}},nt={[x.Vector]:{[v.Euclidean]:q[v.Euclidean]},[x.String]:{[w.Levenshtein]:Q[w.Levenshtein],[w.JaroWinkler]:Q[w.JaroWinkler],[w.Manhattan]:Q[w.Manhattan],[w.Onehot]:Q[w.Onehot]},[x.BitArray]:{[N.Tanimoto]:J[N.Tanimoto],[N.Dice]:J[N.Dice],[N.Asymmetric]:J[N.Asymmetric],[N.BraunBlanquet]:J[N.BraunBlanquet],[N.Cosine]:J[N.Cosine],[N.Kulczynski]:J[N.Kulczynski],[N.McConnaughey]:J[N.McConnaughey],[N.RogotGoldberg]:J[N.RogotGoldberg],[N.Russel]:J[N.Russel],[N.Sokal]:J[N.Sokal]},[x.MacroMolecule]:{[K.HAMMING]:X[K.HAMMING],[K.LEVENSHTEIN]:X[K.LEVENSHTEIN],[K.NEEDLEMANN_WUNSCH]:X[K.NEEDLEMANN_WUNSCH],[K.MONOMER_CHEMICAL_DISTANCE]:X[K.MONOMER_CHEMICAL_DISTANCE]},[x.Number]:{[S.Difference]:tt[S.Difference]},[x.IntArray]:{[_.TanimotoIntArray]:Z[_.TanimotoIntArray]},[x.NumberArray]:{[T.CommonItems]:et[T.CommonItems]}};Object.keys(nt).reduce(((t,e)=>{for(const n of Object.keys(nt[e]))t[n]=e;return t}),{});const ot=ui,rt="bypassLargeDataWarning",st="show-scatterplot-progress";var it,at,ct,lt,ut,ht,ft,mt=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};n(5540),(at=it||(it={})).EUCLIDEAN="EUCLIDEAN",at.MANHATTAN="MANHATTAN",it.EUCLIDEAN,it.MANHATTAN,(lt=ct||(ct={})).HAMMING="Hamming",lt.EUCLIDEAN="Euclidean",lt.MANHATTAN="Manhattan",lt.TANIMOTO="Tanimoto",lt.LEVENSTEIN="Levenshtein",lt.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",lt.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",lt.SOKAL="Sokal",lt.COSINE="Cosine",lt.ASYMMETRIC="Asymmetric",lt.Difference="Difference",lt.OneHot="One-Hot",ct.HAMMING,ct.EUCLIDEAN,ct.MANHATTAN,ct.TANIMOTO,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.MONOMER_CHEMICAL_DISTANCE,ct.SOKAL,ct.COSINE,ct.ASYMMETRIC,ct.Difference,ct.OneHot,ct.HAMMING,ct.EUCLIDEAN,ct.MANHATTAN,ct.TANIMOTO,ct.SOKAL,ct.COSINE,ct.ASYMMETRIC,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.MONOMER_CHEMICAL_DISTANCE,ct.Difference,ct.OneHot,new Set([ct.HAMMING,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.MONOMER_CHEMICAL_DISTANCE,ct.OneHot]),new Set([ct.HAMMING,ct.EUCLIDEAN,ct.MANHATTAN,ct.MONOMER_CHEMICAL_DISTANCE,ct.LEVENSTEIN,ct.NEEDLEMAN_WUNSCH,ct.TANIMOTO,ct.COSINE,ct.SOKAL,ct.ASYMMETRIC,ct.OneHot,ct.Difference]),new Set([ct.EUCLIDEAN,ct.MANHATTAN,ct.OneHot,ct.Difference]),new Set([ct.EUCLIDEAN,ct.MANHATTAN,ct.Difference]),new Set([ct.EUCLIDEAN,ct.MANHATTAN,ct.Difference]),new Set([ct.TANIMOTO,ct.COSINE,ct.SOKAL,ct.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(ut||(ut={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(ht||(ht={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(ft||(ft={})),Object.prototype.toString;const dt="dimensionality-reducer-terminate-event";var yt,pt;(pt=yt||(yt={})).EUCLIDEAN="EUCLIDEAN",pt.MANHATTAN="MANHATTAN";const gt=t=>null==t;function Et(t,e){return`${e} (${t.length>4?`${t.length} columns`:t.map((t=>t.name)).join(", ")})`}async function Ct(o,r,s,i,a,c,l,u=!0,h=!1,f={preprocessingFuncArgs:[]},m={},d=null,y={}){const p={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(r.length!==i.length||r.length!==c.length||r.length!==a.length||r.length!==f.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const g=u?m.tableView??e.shell.tableView(o.name)??e.shell.addTableView(o):null,E=async()=>{const E=t.TaskBarProgressIndicator.create(`Initializing ${m.scatterPlotName??"dimensionality reduction"} ...`);let C;try{const A=function(t){const e=["Embed_X","Embed_Y"],n=t.columns.names().filter((t=>t.includes(e[0]))).length+1;return e.map((t=>`${t}_${n}`))}(o);function w(e,n,i){let a=null,c=null;o.columns.names().includes(A[0])?(a=o.columns.byName(A[0]),c=o.columns.byName(A[1])):(a=o.columns.add(t.Column.float(A[0],o.rowCount)),c=o.columns.add(t.Column.float(A[1],o.rowCount)),u&&!C&&(C=g.scatterPlot({...p,x:A[0],y:A[1],title:m.scatterPlotName??Et(r,s)}))),m[st]&&(C?.root&&ot.setUpdateIndicator(C.root,!1),a.init((t=>i[0]?i[0][t]:void 0)),c.init((t=>i[1]?i[1][t]:void 0)));const l=e/n*100;E.update(l,`Running ${m.scatterPlotName??"dimensionality reduction"}... ${l.toFixed(0)}%`)}async function v(){o.columns.add(t.Column.float(A[0],o.rowCount)),o.columns.add(t.Column.float(A[1],o.rowCount));let h=null;u&&(C=g.scatterPlot({...p,x:A[0],y:A[1],title:m.scatterPlotName??Et(r,s)}),ot.setUpdateIndicator(C.root,!0));const d=e.events.onViewerClosed.subscribe((t=>{const n=t.args.viewer;n?.getOptions()?.look?.title&&C?.getOptions()?.look?.title&&n?.getOptions()?.look?.title===C?.getOptions()?.look?.title&&(e.events.fireCustomEvent(dt,{}),d.unsubscribe(),h?.(),E.close())})),y=new Promise((async(t,o)=>{try{h=t;const o=[];for(let t=0;t<c.length;++t){const e=c[t];if(f.distanceFnArgs||(f.distanceFnArgs=[]),e){const n=e.inputs[0].name,s=e.inputs[1].name,{entries:a,options:c}=await e.apply({[n]:r[t],[s]:i[t],...f.preprocessingFuncArgs[t]??{}});o.push({entries:a,options:c}),f.distanceFnArgs.push(c)}else{const e=r[t].toList(),n={};o.push({entries:e,options:n}),f.distanceFnArgs.push(n)}}t(await async function(t,o,r,s,i,a,c){let l=await async function(t,o,r,s,i,a,c){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(t.length!==o.length||t.length!==a.distanceFnArgs.length||t.length!==s.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(l,u){const h=new Worker(new URL(n.p+n.u(234),n.b));h.postMessage({columnsData:t,distanceMetrics:o,method:r,options:a,weights:s,aggregationMethod:i});const f=e.events.onCustomEvent(dt).subscribe((()=>{try{h?.terminate()}finally{f.unsubscribe()}}));h.onmessage=({data:{error:t,embedding:e,epochNum:n,epochsLength:o}})=>{gt(n)||gt(o)?(f.unsubscribe(),t?u(t):l(e),setTimeout((()=>h.terminate()),100)):c&&c(n,o,e)}}))}(t,r,o,s,i,a,c);return l=l.map((t=>function(t){const e=t.length;let n=0,o=0;for(let r=0;r<e;++r)n+=t[r],o+=Math.pow(t[r],2);const r=n/e,s=1/Math.sqrt(o/e-Math.pow(r,2));for(let n=0;n<e;++n)t[n]=(t[n]-r)*s;return t}(t))),l}(o.map((t=>t.entries)),s,i,a,l,f,m[rt]?void 0:w))}catch(t){o(t)}})),v=await y;return E.close(),d.unsubscribe(),v}const N=await v();if(h&&N){const _=t.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const x=await function(t,e,o,r){return mt(this,void 0,void 0,(function*(){return new Promise((function(s,i){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:r,epsilon:o}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?i(t):s(e)}}))}))}(N[0],N[1],f.dbScanEpsilon??.01,f.dbScanMinPts??4),S=o.columns.getUnusedName("Cluster (DBSCAN)");o.columns.addNewString(S).init((t=>x[t].toString())),C&&(C.props.colorColumnName=S)}catch(T){e.shell.error("Clustering embeddings failed"),console.error(T)}finally{_.close()}}if(N){const M=o.columns.byName(A[0]),I=o.columns.byName(A[1]);if(M.init((t=>N[0][t])),I.init((t=>N[1][t])),d)try{const b=d.inputs[0].name,O=d.inputs[1].name;await d.prepare({[b]:M,[O]:I,...y}).call(!0)}catch(R){e.shell.error("Post-processing failed"),console.error(R)}if(C)return ot.setUpdateIndicator(C.root,!1),C.helpUrl="/help/compute/sequence-space",C}}catch(L){e.shell.error("Dimensionality reduction failed"),console.error(L),E.close(),C&&ot.setUpdateIndicator(C.root,!1)}};return new Promise((async(t,e)=>{try{if(m.fastRowCount&&o.rowCount>m.fastRowCount&&!m[rt])ot.dialog().add(ot.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await E();t(e)}catch(t){e(t)}})).onCancel((()=>t(void 0))).show();else{const e=await E();t(e)}}catch(t){e(t)}}))}var At=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const wt={SUBJ:"subj",STUDY:"study",SITE:"site",AGE:"age",SEX:"sex",RACE:"race",DISEASE:"disease",WEIGHT:"weight",HEIGHT:"height"};function vt(t,n,o){return At(this,void 0,void 0,(function*(){const r=e.data.demo.demog(100);e.shell.addTableView(r),R(!!(yield Ct(r,t.map((t=>r.col(t))),n,o,t.map((()=>1)),t.map((()=>{})),"EUCLIDEAN",!0,!0,{preprocessingFuncArgs:t.map((()=>({})))})),!0,"No scatterplot returned");const s=r.columns.names().filter((t=>t.toLowerCase().startsWith("embed")));R(s.length,2,"Wrong number of embeddings added"),R(!!r.columns.names().find((t=>t.toLowerCase().startsWith("cluster"))),!0,"No cluster column added");for(const t of s){const e=r.col(t);R(new Array(e.length).fill(null).every(((t,n)=>!e.isNone(n)&&!isNaN(e.get(n)))),!0,"Embedding column has null-ish values")}yield new Promise((t=>setTimeout(t,500)))}))}L("Dimensionality reduction: UMAP",(()=>{O("Numeric column",(()=>At(void 0,void 0,void 0,(function*(){yield vt([wt.AGE],A.UMAP,[S.Difference])}))),{timeout:3e4}),O("String column",(()=>At(void 0,void 0,void 0,(function*(){yield vt([wt.SEX],A.UMAP,[w.Onehot])}))),{timeout:3e4}),O("Numeric and string columns",(()=>At(void 0,void 0,void 0,(function*(){yield vt([wt.SEX,wt.AGE],A.UMAP,[w.Onehot,S.Difference])})))),O("All demog columns",(()=>At(void 0,void 0,void 0,(function*(){const n=e.data.demo.demog(10).columns.toList().filter((t=>Object.values(wt).includes(t.name))),o=n.map((e=>e.type===t.COLUMN_TYPE.STRING?w.Onehot:S.Difference)),r=n.map((t=>t.name));yield vt(r,A.UMAP,o)}))))})),L("Dimensionality reduction: T-SNE",(()=>{O("Numeric column",(()=>At(void 0,void 0,void 0,(function*(){yield vt([wt.AGE],A.T_SNE,[S.Difference])}))),{timeout:3e4}),O("String column",(()=>At(void 0,void 0,void 0,(function*(){yield vt([wt.SEX],A.T_SNE,[w.Onehot])}))),{timeout:3e4}),O("Numeric and string columns",(()=>At(void 0,void 0,void 0,(function*(){yield vt([wt.SEX,wt.AGE],A.T_SNE,[w.Onehot,S.Difference])})))),O("All demog columns",(()=>At(void 0,void 0,void 0,(function*(){const n=e.data.demo.demog(10).columns.toList().filter((t=>Object.values(wt).includes(t.name))),o=n.map((e=>e.type===t.COLUMN_TYPE.STRING?w.Onehot:S.Difference)),r=n.map((t=>t.name));yield vt(r,A.T_SNE,o)}))))}));const Nt={i32:"HEAP32",f32:"HEAPF32"},_t={i32:Int32Array,f32:Float32Array},xt={i32:2,f32:2},St={i32:DG.Column.fromInt32Array,f32:DG.Column.fromFloat32Array};class Tt{constructor(t){this.data=t}complementArrOfParams(t){t.push(this.data)}complementArrOfTypes(t){t.push("number")}allocateMemoryForBuffer(t){}isMemoryForBufferAllocated(){return!0}putDataToBuffer(t){}getDataFromBuffer(t){}freeBuffer(t){}}class Mt extends Tt{constructor(t,e,n=!1){super(t),this.type=e,this.toUpdate=n,this.buf=0,this.numOfRows=t.length}complementArrOfParams(t){t.push(this.buf),t.push(this.numOfRows)}complementArrOfTypes(t){t.push("number"),t.push("number")}allocateMemoryForBuffer(t){this.buf=t._malloc(this.numOfRows*_t[this.type].BYTES_PER_ELEMENT)}isMemoryForBufferAllocated(){return 0!=this.buf}putDataToBuffer(t){if(this.isMemoryForBufferAllocated()){const e=this.type,n=xt[e],o=t[Nt[e]];let r=null;const s=this.data;r="int"==s.type&&"i32"==e||"double"==s.type&&"f32"==e?s.getRawData():new _t[e](s.getRawData()),r&&o.set(r,this.buf>>n)}}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[Nt[e]],o=this.buf,r=_t[e].BYTES_PER_ELEMENT,s=this.data.getRawData();for(let t=0;t<this.numOfRows;t++)s[t]=n[o/r+t]}}freeBuffer(t){this.isMemoryForBufferAllocated()&&(t._free(this.buf),this.buf=0)}}class It extends Mt{constructor(t,e){super([],t,!0),this.numOfRows=e}putDataToBuffer(t){}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[Nt[e]],o=this.buf,r=St[e],s=new _t[e](this.numOfRows);for(let t=0;t<s.length;t++)s[t]=n[o/s.BYTES_PER_ELEMENT+t];this.data=r("name",s)}}}class bt extends Tt{constructor(t,e,n=!1){super(t),this.type=e,this.toUpdate=n,this.buf=0,this.numOfColumns=t.length,this.numOfRows=t[0].length}complementArrOfParams(t){t.push(this.buf),t.push(this.numOfRows),t.push(this.numOfColumns)}complementArrOfTypes(t){t.push("number"),t.push("number"),t.push("number")}allocateMemoryForBuffer(t){this.buf=t._malloc(this.numOfRows*this.numOfColumns*_t[this.type].BYTES_PER_ELEMENT)}isMemoryForBufferAllocated(){return 0!=this.buf}putDataToBuffer(t){if(this.isMemoryForBufferAllocated()){const e=this.type,n=xt[e],o=t[Nt[e]],r=_t[e].BYTES_PER_ELEMENT;for(let t=0;t<this.numOfColumns;t++){let s=null;const i=this.data[t];s="int"==i.type&&"i32"==e||"double"==i.type&&"f32"==e?i.getRawData():new _t[e](i.getRawData()),null!=s&&o.set(s,this.buf+t*this.numOfRows*r>>n)}}}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[Nt[e]],o=this.numOfRows,r=this.numOfColumns,s=new _t[e](n.buffer,this.buf,o*r);for(let t=0;t<r;t++){const e=this.data[t].getRawData();for(let n=0;n<o;n++)e[n]=s[n+t*o]}}}freeBuffer(t){this.isMemoryForBufferAllocated()&&(t._free(this.buf),this.buf=0)}}class Ot extends bt{constructor(t,e,n){super([[]],t,!0),this.data=[],this.numOfColumns=n,this.numOfRows=e}putDataToBuffer(t){}getDataFromBuffer(t){if(this.toUpdate&&this.isMemoryForBufferAllocated()){const e=this.type,n=t[Nt[e]],o=this.numOfRows,r=this.numOfColumns,s=_t[e].BYTES_PER_ELEMENT,i=St[e],a=this.buf;for(let t=0;t<r;t++){const r=new _t[e](o);for(let e=0;e<o;e++)r[e]=n[a/s+e+t*o];this.data.push(i((t+1).toString(),r))}}}}const Rt={intColumn:t=>new Mt(t,"i32"),newIntColumn:t=>new It("i32",t),intColumns:t=>new bt(t.toList(),"i32"),newIntColumns:(t,e)=>new Ot("i32",t,e),floatColumn:t=>new Mt(t,"f32"),newFloatColumn:t=>new It("f32",t),floatColumns:t=>new bt(t.toList(),"f32"),newFloatColumns:(t,e)=>new Ot("f32",t,e),int:t=>new Tt(t),num:t=>new Tt(t)},Lt={tableFromColumns:t=>DG.DataFrame.fromColumns(t.data),num:t=>t,int:t=>t,double:t=>t,column:t=>t.data};function Pt(t,e,n){const o=t[e],r=o.arguments,s=[];let i=0;for(const t in r){const e=r[t];if("_callResult"!=t){switch(e.type){case"floatColumns":case"int":case"num":case"floatColumn":case"intColumn":case"intColumns":e.data=Rt[e.type](n[i]),i++;break;case"newFloatColumns":case"newIntColumns":const t=r[e.numOfRows.ref].data[e.numOfRows.value],o=r[e.numOfColumns.ref].data[e.numOfColumns.value];e.data=Rt[e.type](t,o);break;case"newFloatColumn":case"newIntColumn":const s=r[e.numOfRows.ref].data[e.numOfRows.value];e.data=Rt[e.type](s)}s.push(r[t].data)}}const a=function(t,e,n,o){let r;for(const e of o)e.allocateMemoryForBuffer(t);let s=!0;for(const t of o)s&=t.isMemoryForBufferAllocated();if(s){const n=[],s=[];for(const e of o)e.complementArrOfParams(n),e.complementArrOfTypes(s),e.putDataToBuffer(t);const i="number";r=t.ccall(e,i,s,n);for(const e of o)e.getDataFromBuffer(t)}for(const e of o)e.freeBuffer(t);if(null!=r)return r}(t,e,0,s);r._callResult=Rt.num(a);const c=o.output;if("objects"!=c.type)return Lt[c.type](r[c.source].data);const l=[];for(const t of c.source)l.push(r[t].data.data);return l}const Dt="num",Ft="floatColumn",Ut="intColumn",Bt="floatColumns",kt="newFloatColumns",Ht="intColumns",Gt="newIntColumns",Vt="newFloatColumn",Wt="newIntColumn",$t="column",Yt="_callResult",Kt="numOfRows",Xt="numOfColumns",jt="ref",zt="value",qt="tableFromColumns",Qt="objects",Jt="int",Zt="double",te={intColumn:Int32Array,floatColumn:Float32Array,floatColumns:Float32Array,newFloatColumns:Float32Array,intColumns:Int32Array,newIntColumns:Int32Array,newFloatColumn:Float32Array,newIntColumn:Int32Array};function ee(t,e){let n,o=[],r=0;for(const s in t){const i=t[s],a=i.type;if(s!==Yt){switch(a){case Dt:case Jt:case Zt:i.data=e[r],r++;break;case Ut:case Ft:let o;const s=e[r],c=s.length;o=s.type===Jt&&a===Ut||s.type===Zt&&a===Ft?s.getRawData().slice(0,c):new te[a](s.getRawData().slice(0,c)),i.data={array:o,numOfRows:c},r++;break;case Wt:case Vt:let l=0;n=i[Kt][jt],l=t[n].type===Dt?t[n].data:t[n].data[i[Kt][zt]],i.data={numOfRows:l},r++;break;case Ht:case Bt:let u=[];const h=e[r].byIndex(0).length;for(const t of e[r].toList())t.type===Jt&&a===Ut||t.type===Zt&&a===Ft?u.push(t.getRawData().slice(0,h)):u.push(new te[a](t.getRawData().slice(0,h)));i.data={arrays:u,numOfRows:h,numOfColumns:u.length},r++;break;case Gt:case kt:let f=0,m=0;n=i[Kt][jt],f=t[n].type===Dt?t[n].data:t[n].data[i[Kt][zt]],n=i[Xt][jt],m=t[n].type===Dt?t[n].data:t[n].data[i[Xt][zt]],i.data={numOfRows:f,numOfColumns:m},r++;break;default:return}o.push(i)}}return o}function ne(t,e){t.arguments._callResult=e.callResult,function(t,e){const n={newFloatColumns:DG.Column.fromFloat32Array,newIntColumns:DG.Column.fromInt32Array,newFloatColumn:DG.Column.fromFloat32Array,newIntColumn:DG.Column.fromInt32Array};let o=0;for(const r in t){const s=t[r];switch(s.type){case Dt:case Jt:case Zt:case Ut:case Ft:case Bt:case Ht:break;case Vt:case Wt:let t;null==s.name?t=(0).toString():a=s.name,s.column=n[s.type](t,e[o].array);break;case Gt:case kt:let r=[],i=e[o].arrays.length,a=[];if(null==s.names)for(let t=1;t<=i;t++)a.push(t.toString());else a=s.names;for(let t=0;t<i;t++)r.push(n[s.type](a[t],e[o].arrays[t]));s.columns=r}o++}}(t.arguments,e.args);let n=function(t){let e=t.output;const n={newFloatColumns:"columns",newIntColumns:"columns",newFloatColumn:"column",newIntColumn:"column"};switch(e.type){case Dt:case Jt:case Zt:return t.arguments[e.source];case $t:return t.arguments[e.source].column;case qt:return DG.DataFrame.fromColumns(t.arguments[e.source].columns);case Qt:let o=[];for(let r of e.source){let e=t.arguments[r];o.push(e[n[e.type]])}return o}}(t);return function(t){for(const e in t){const n=t[e];switch(n.type){case Dt:case Jt:case Zt:case Ut:case Ft:case Ht:case Bt:break;case Wt:case Vt:n.column=null;break;case Gt:case kt:n.columns=null}}}(t.arguments),n}const oe=1,re=1e8,se="components must be positive.",ie="components must not be greater than features count.",ae="dataframe is too big.",ce="unsupported column type: ";function le(e){if(e.type!=t.COLUMN_TYPE.FLOAT&&e.type!=t.COLUMN_TYPE.INT)throw new Error(ce+e.type)}function ue(t){if(t.stats.missingValueCount>0)throw new Error(`The column '${t.name}' has missing values.`)}function he(t,e){if(function(t,e){if(e<oe)throw new Error(se);if(e>t.length)throw new Error(ie);for(const e of t)le(e),ue(e)}(t,e),t.length*t.byIndex(0).length>re)throw new Error(ae)}var fe,me,de,ye,pe,ge,Ee,Ce,Ae,we,ve,Ne,_e,xe,Se;function Te(t,e,o,r,s){return i=this,a=void 0,l=function*(){he(e,o);const t=r?1:0,i=s?1:0;return yield async function(t,e,o,r,s){return new Promise(((t,i)=>{const a=new Worker(new URL(n.p+n.u(91),n.b));a.postMessage(ee(EDA.principalComponentAnalysis.arguments,[e,o,r,s])),a.onmessage=function(e){a.terminate(),t(ne(EDA.principalComponentAnalysis,e.data))}}))}(0,e,o,t,i)},new((c=void 0)||(c=Promise))((function(t,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof c?r:new c((function(t){t(r)}))).then(n,o)}r((l=l.apply(i,a||[])).next())}));var i,a,c,l}(Se=fe||(fe={}))[Se.COMPUTE_COMPONENTS=0]="COMPUTE_COMPONENTS",Se[Se.PERFORM_MVA=1]="PERFORM_MVA",Se[Se.DEMO=2]="DEMO",(xe=me||(me={})).NO_DF="No dataframe is opened",xe.NO_COLS="No numeric columns without missing values",xe.ONE_COL="No columns to be used as features (just one numeric columns without missing values)",xe.EMPTY_DF="Dataframe is empty",(_e=de||(de={})).PREDICT="Predict",_e.USING="Using",_e.COMPONENTS="Components",_e.PLS="PLS",_e.MVA="Multivariate Analysis (PLS)",_e.RUN="RUN",_e.NAMES="Names",_e.MODEL="Observed vs. Predicted",_e.FEATURE="Feature",_e.REGR_COEFS="Regression Coefficients",_e.XLOADING="x.loading.p",_e.LOADINGS="Loadings",_e.XSCORE="x.score.t",_e.YSCORE="y.score.u",_e.SCORES="Scores",_e.EXPL_VAR="Explained Variance",_e.EXPLORE="Explore",_e.FEATURES="Feature names",_e.BROWSE="Browse",(Ne=ye||(ye={})).PREDICT="Column with the response variable",Ne.FEATURES="Predictors (features)",Ne.COMPONENTS="Number of PLS components",Ne.PLS="Compute PLS components",Ne.MVA="Perform multivariate analysis",Ne.NAMES="Names of data samples",(ve=pe||(pe={})).PLS="https://datagrok.ai/help/explore/multivariate-analysis/pls#pls-components",ve.MVA="https://datagrok.ai/help/explore/multivariate-analysis/pls",ve.MODEL="https://datagrok.ai/help/explore/multivariate-analysis/plots/predicted-vs-reference",ve.COEFFS="https://datagrok.ai/help/explore/multivariate-analysis/plots/regression-coefficients",ve.LOADINGS="https://datagrok.ai/help/explore/multivariate-analysis/plots/loadings",ve.EXPL_VARS="https://datagrok.ai/help/explore/multivariate-analysis/plots/explained-variance",ve.SCORES="https://datagrok.ai/help/explore/multivariate-analysis/plots/scores",(we=ge||(ge={}))[we.DEFAULT=3]="DEFAULT",we[we.MIN=1]="MIN",(Ae=Ee||(Ee={})).PREFIX="PLS",Ae.SUFFIX="(predicted)",Ae.COMP="component",Ae.COMPS="components",function(t){t[t.PREDICTION=0]="PREDICTION",t[t.REGR_COEFFS=1]="REGR_COEFFS",t[t.T_SCORES=2]="T_SCORES",t[t.U_SCORES=3]="U_SCORES",t[t.X_LOADINGS=4]="X_LOADINGS",t[t.Y_LOADINGS=5]="Y_LOADINGS"}(Ce||(Ce={}));const Me=[.49,.79,.99];var Ie;!function(t){t.AXIS="#838383",t.CIRCLE="#0000FF"}(Ie||(Ie={})),[{caption:de.MODEL,text:"Closer to the line means better price prediction."},{caption:de.SCORES,text:"The latent factor values for each sample reflect the similarities and dissimilarities among observations."},{caption:de.LOADINGS,text:"The impact of each feature on the latent factors: higher loading means stronger influence."},{caption:de.REGR_COEFS,text:"Parameters of the obtained linear model: features make different contribution to the prediction."},{caption:de.EXPL_VAR,text:"How well the latent components fit source data: closer to one means better fit."}].map((t=>`# ${t.caption}\n\n${t.text}`)).join("\n\n"),pe.MVA;var be=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};function Oe(t){return be(this,void 0,void 0,(function*(){he(t.features,t.components),le(t.predict),ue(t.predict);const e=yield async function(t,e,o,r){return new Promise(((t,s)=>{const i=new Worker(new URL(n.p+n.u(412),n.b));i.postMessage(ee(EDA.partialLeastSquareRegression.arguments,[e,o,r])),i.onmessage=function(e){i.terminate(),t(ne(EDA.partialLeastSquareRegression,e.data))}}))}(t.table,t.features,t.predict,t.components);return{prediction:e[Ce.PREDICTION],regressionCoefficients:e[Ce.REGR_COEFFS],tScores:e[Ce.T_SCORES],uScores:e[Ce.U_SCORES],xLoadings:e[Ce.X_LOADINGS],yLoadings:e[Ce.Y_LOADINGS]}}))}Math.min,Math.max;var Re=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};function Le(e,n){return Re(this,void 0,void 0,(function*(){const o=e.length,r=n.length,s=n.stats.avg,i=n.stats.stdev,a=new Float32Array(o+1).fill(0);if(a[o]=s,0===i||1===r)return a;try{const r=[],c=[],l=new Float32Array(o),u=new Float32Array(o);let h=0,f=0;for(const t of e){const e=t.stats;e.stdev>0&&(r.push(h),c.push(t),l[f]=e.avg,u[f]=e.stdev,++f),++h}if(0===f)return a;const m=function(t,e,n,o,r,s,i){return Pt(EDA,"fitLinearRegressionParamsWithDataNormalizing",[t,e,n,o,r,s,i])}(t.DataFrame.fromColumns(c).columns,t.Column.fromFloat32Array("xAvgs",l,f),t.Column.fromFloat32Array("xStdevs",u,f),n,s,i,f+1).getRawData();for(let t=0;t<f;++t)a[r[t]]=m[t];a[o]=m[f]}catch(r){const s=yield function(e,n,o){return Re(this,void 0,void 0,(function*(){return(yield Oe({table:t.DataFrame.fromColumns([n]),features:e,predict:n,components:o,names:void 0})).regressionCoefficients.getRawData()}))}(e,n,De(e.length,n.length));let i=0;for(let t=0;t<o;++t)a[t]=s[t],i+=s[t]*e.byIndex(t).stats.avg;a[o]-=i}return a}))}function Pe(e,n){const o=e.length;if(o!==n.length-1)throw new Error("Incorrect parameters count");const r=e.byIndex(0),s=r.length,i=new Float32Array(s);let a=r.getRawData();const c=n[o];let l=n[0];for(let t=0;t<s;++t)i[t]=c+l*a[t];for(let t=1;t<o;++t){a=e.byIndex(t).getRawData(),l=n[t];for(let t=0;t<s;++t)i[t]+=l*a[t]}return t.Column.fromFloat32Array(e.getUnusedName("prediction"),i,s)}const De=(t,e)=>e<=t?Math.min(10,e):Math.min(10,t);var Fe;!function(t){t[t.MAX_SAMLPES=1e5]="MAX_SAMLPES",t[t.MAX_FEATURES=1e3]="MAX_FEATURES"}(Fe||(Fe={}));class Ue{static isApplicable(t,e){for(const e of t)if(!e.matches("numerical"))return!1;return!!e.matches("numerical")}static isInteractive(t,e){return t.length<=Fe.MAX_FEATURES&&e.length<=Fe.MAX_SAMLPES}constructor(e){if(this.specn=null,e)try{const n=new Uint32Array(e.buffer,0,2),o=n[0],r=n[1],s=new Uint8Array(e.buffer,8,o),i=t.DataFrame.fromByteArray(s),a=i.rowCount,c=i.columns,l=c.length,u=new Uint8Array(e.buffer,8+o,r),h=t.DataFrame.fromByteArray(u);if(l<3)throw new Error("incorrect columns count");const f=c.byName(de.FEATURES).toList(),m=new Float32Array(a);m.set(c.byName(de.REGR_COEFS).getRawData());const d=l-2,y=new Array(d);for(let t=0;t<d;++t)y[t]=new Float32Array(a),y[t].set(c.byIndex(t+2).getRawData());this.specn={params:m,loadings:y,names:f,dim:a-1,components:l-2,scores:h}}catch(t){throw new Error(`Failed to load model: ${t instanceof Error?t.message:"the platform issue"}`)}}fit(e,n,o){return r=this,s=void 0,a=function*(){const r=yield Oe({table:t.DataFrame.fromColumns([n]),features:e,predict:n,components:o,names:void 0}),s=e.names();s.push("_");const i=this.getRegrCoeffs(e,n,r.regressionCoefficients),a=this.getLoadings(o,r.xLoadings);this.specn={names:s,params:i,loadings:a,components:o,dim:e.length,scores:this.getScoresDf(r)},this.computeExplVars(n.length,o,r.yLoadings)},new((i=void 0)||(i=Promise))((function(t,e){function n(t){try{c(a.next(t))}catch(t){e(t)}}function o(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(n,o)}c((a=a.apply(r,s||[])).next())}));var r,s,i,a}getLoadings(t,e){const n=Array(t),o=e[0].length+1;for(let r=0;r<t;++r)n[r]=new Float32Array(o),n[r].set(e[r].getRawData());return n}getRegrCoeffs(t,e,n){const o=t.length,r=new Float32Array(o+1),s=n.getRawData();let i=0;for(let e=0;e<o;++e)r[e]=s[e],i+=s[e]*t.byIndex(e).stats.avg;return r[o]=e.stats.avg-i,r}computeExplVars(t,e,n){if(null===this.specn)throw new Error("Failed to compute explained variances");const o=n.getRawData(),r=this.specn.loadings[0].length-1;let s=Math.pow(o[0],2)/t;this.specn.loadings[0][r]=s;for(let n=1;n<e;++n)s+=Math.pow(o[n],2)/t,this.specn.loadings[n][r]=s}toBytes(){if(null===this.specn)throw new Error("Failed to pack untrained model");const e=t.DataFrame.fromColumns([t.Column.fromStrings(de.FEATURES,this.specn.names),t.Column.fromFloat32Array(de.REGR_COEFS,this.specn.params)]);this.specn.loadings.forEach(((n,o)=>e.columns.add(t.Column.fromFloat32Array(`${de.XLOADING}${o+1}`,n))));const n=e.toByteArray(),o=n.length,r=this.specn.scores.toByteArray(),s=r.length,i=o+s+8,a=new Uint8Array(64*(Math.ceil(i/64)+1)),c=new Uint32Array(a.buffer,0,2);return c[0]=o,c[1]=s,a.set(n,8),a.set(r,8+o),a}predict(t){if(null===this.specn)throw new Error("Predicting failed: model is not trained");return Pe(t,this.specn.params)}loadingsParamsViewers(){if(null===this.specn)throw new Error("Failed to create loadings and parameters viewers: untrained model");const e=[],n=this.specn.dim,o=t.DataFrame.fromColumns([t.Column.fromStrings(de.FEATURES,this.specn.names.slice(0,-1)),t.Column.fromFloat32Array(de.REGR_COEFS,this.specn.params,n)]),r=o.columns,s=r.length,i=this.specn.components;return this.specn.loadings.forEach(((e,r)=>o.columns.add(t.Column.fromFloat32Array(`${de.XLOADING}${r+1}`,e,n)))),e.push(t.Viewer.scatterPlot(o,{title:de.LOADINGS,xColumnName:r.byIndex(s).name,yColumnName:r.byIndex(s+(i>1?1:0)).name,markerType:t.MARKER_TYPE.CIRCLE,labels:de.FEATURES,help:pe.LOADINGS})),e.push(t.Viewer.barChart(o,{title:de.REGR_COEFS,splitColumnName:de.FEATURES,valueColumnName:de.REGR_COEFS,valueAggrType:t.AGG.AVG,help:pe.COEFFS,showValueSelector:!1,showStackSelector:!1})),e}explVarsViewer(){if(null===this.specn)throw new Error("Failed to create exaplained variances viewer: untrained model");const e=this.specn.components,n=this.specn.dim,o=new Array(e),r=new Float32Array(e);o[0]=`${Ee.COMP} 1`,r[0]=this.specn.loadings[0][n];for(let t=1;t<e;++t)o[t]=`${Ee.COMPS} ${t+1}`,r[t]=this.specn.loadings[t][n];return t.Viewer.barChart(t.DataFrame.fromColumns([t.Column.fromStrings(Ee.COMPS,o),t.Column.fromFloat32Array(de.EXPL_VAR,r)]),{title:de.EXPL_VAR,splitColumnName:Ee.COMPS,valueColumnName:de.EXPL_VAR,valueAggrType:t.AGG.AVG,help:pe.EXPL_VARS,showCategorySelector:!1,showStackSelector:!1,showValueSelector:!1})}viewers(){if(null===this.specn)throw new Error("Failed to create viewers: untrained model");const t=this.loadingsParamsViewers();return t.push(this.explVarsViewer(),this.getScoresScatter()),t}getScoresDf(e){const n=e.tScores,o=e.uScores;return n.forEach(((t,e)=>t.name=`${de.XSCORE}${e+1}`)),o.forEach(((t,e)=>t.name=`${de.YSCORE}${e+1}`)),t.DataFrame.fromColumns(n.concat(o))}getScoresScatter(){if(null===this.specn)throw new Error("Failed to create scores scatter: untrained model");const e=this.specn.scores.columns.names(),n=t.Viewer.scatterPlot(this.specn.scores,{title:de.SCORES,xColumnName:e[0],yColumnName:e[1],markerType:t.MARKER_TYPE.CIRCLE,help:pe.SCORES,showViewerFormulaLines:!0});return n.meta.formulaLines.addAll(function(t){const e=[],n=(t,n)=>{e.push({type:"line",formula:t,width:1,visible:!0,title:" ",min:-n,max:n,color:Ie.CIRCLE})};return t.forEach((o=>{const r="${"+o+"}";e.push({type:"line",formula:`${r} = 0`,width:1,visible:!0,title:" ",color:Ie.AXIS}),t.forEach((t=>{const e="${"+t+"}";Me.forEach((t=>{n(e+` = sqrt(${t*t} - ${r} * ${r})`,t),n(e+` = -sqrt(${t*t} - ${r} * ${r})`,t)}))}))})),e}(e)),n}}const Be=["Alpha","Beta","Gamma","Delta"];function ke(t,e){if(t.length!==e.length)throw new Error(`Non-equal elements count: ${t.length} vs. ${e.length}`)}function He(n,o,r){const s=e.data.demo.randomWalk(n,o),i=s.columns,a=new Float32Array(o),c=new Array(o);for(let t=0;t<o;++t)c[t]=i.byIndex(t).getRawData();for(let e=0;e<r;++e){const r=new Float32Array(n);for(let t=0;t<o;++t)a[t]=Math.random();for(let t=0;t<n;++t)for(let e=0;e<o;++e)r[t]+=a[e]*c[e][t];i.add(t.Column.fromFloat32Array(`y${e}`,r))}return s}function Ge(t,e){ke(t,e);let n=0;const o=t.length,r=t.getRawData(),s=e.getRawData();for(let t=0;t<o;++t)n=Math.max(n,Math.abs(r[t]-s[t]));return n}function Ve(e,n,o){const r=new Array(e),s=new Array(n);for(let t=0;t<n;++t){const n=new Float32Array(e);for(let t=0;t<e;++t)n[t]=Math.random();s[t]=n}const i=t.DataFrame.fromColumns(s.map(((e,n)=>t.Column.fromFloat32Array(`#${n}`,e))));for(let t=0;t<e;++t)r[t]=s.slice(0,2).map((e=>e[t]>.5?"A":"B")).join("");if(i.columns.add(t.Column.fromStrings("Labels",r)),o)for(let t=0;t<n;++t)for(let n=0;n<e;++n)s[t][n]+=1*(s[t][n]>0?1:-1);return i}function We(t,e){ke(t,e);let n=0;const o=t.length;if(o<1)return 1;for(let r=0;r<o;++r)t.get(r)===e.get(r)&&++n;return n/o}var $e=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const Ye=100,Ke=4e3,Xe=.1;L("Principal component analysis",(()=>{O("Performance: 100K rows, 100 cols, 3 components",(()=>$e(void 0,void 0,void 0,(function*(){const t=e.data.demo.randomWalk(1e5,Ye);yield Te(0,t.columns,3,!1,!1)}))),{timeout:Ke,benchmark:!0}),O("Correctness",(()=>$e(void 0,void 0,void 0,(function*(){const t=He(100,3,5);R(function(t){let e=0;const n=t.length,o=t.getRawData();for(let t=0;t<n;++t)e=Math.max(e,Math.abs(o[t]));return e}((yield Te(0,t.columns,4,!1,!1)).columns.byIndex(3))<Xe,!0,"Incorrect PCA computations")}))),{timeout:Ke})})),L("Partial least squares regression",(()=>{O("Performance: 100K rows, 100 cols, 3 components",(()=>$e(void 0,void 0,void 0,(function*(){const t=e.data.demo.randomWalk(1e5,Ye),n=t.columns;yield Oe({table:t,features:n,predict:n.byIndex(99),components:3,names:void 0})}))),{timeout:Ke,benchmark:!0}),O("Correctness",(()=>$e(void 0,void 0,void 0,(function*(){const t=He(100,3,5),e=t.columns,n=e.byIndex(7),o=Ge(n,(yield Oe({table:t,features:e,predict:n,components:3,names:void 0})).prediction);R(o<Xe,!0,`Incorrect PLS computations, error is too big: ${o}; expected: < 0.1`)}))),{timeout:Ke}),O("Predictive modeling: 100K samples, 100 features, 3 components",(()=>$e(void 0,void 0,void 0,(function*(){const t=He(1e5,3,98).columns,e=t.byIndex(Ye);t.remove(e.name);const n=new Ue;yield n.fit(t,e,3);const o=n.toBytes(),r=Ge(e,new Ue(o).predict(t));R(r<Xe,!0,`Incorrect PLS (ML) computations, error is too big: ${r}; expected: < 0.1`)}))),{timeout:Ke,benchmark:!0})})),L("Linear regression",(()=>{O("Performance: 100K samples, 100 features",(()=>$e(void 0,void 0,void 0,(function*(){const t=He(1e5,Ye,1).columns,e=t.byIndex(Ye),n=yield Le(t,e),o=new Uint8Array(n.buffer);Pe(t,new Float32Array(o.buffer))}))),{timeout:Ke,benchmark:!0}),O("Correctness",(()=>$e(void 0,void 0,void 0,(function*(){const t=He(100,2,1).columns,e=t.byIndex(2),n=yield Le(t,e),o=new Uint8Array(n.buffer),r=Pe(t,new Float32Array(o.buffer)),s=Ge(r,r);R(s<Xe,!0,`Incorrect linear regression computations, error is too big: ${s}; expected: < 0.1`)}))),{timeout:Ke})}));var je=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const ze="Avg-s",qe="Stddev-s";var Qe;!function(t){t[t.MAX_SAMLPES=5e4]="MAX_SAMLPES",t[t.MAX_FEATURES=100]="MAX_FEATURES"}(Qe||(Qe={}));class Je{static isApplicable(e,n){for(const t of e)if(!t.matches("numerical"))return!1;return n.type===t.COLUMN_TYPE.STRING}static isInteractive(t,e){return t.length<=Qe.MAX_FEATURES&&e.length<=Qe.MAX_SAMLPES}constructor(e,n){if(this.params=void 0,this.classesCount=1,this.featuresCount=1,void 0!==e){const t=e.featuresCount,n=e.classesCount;if(t<1)throw new Error("Incorrect features count");if(n<1)throw new Error("Incorrect classes count");const o=t+1;this.avgs=new Float32Array(o),this.stdevs=new Float32Array(o),this.categories=new Array(o),this.featuresCount=t,this.classesCount=n}else{if(void 0===n)throw new Error("Softmax classifier not initialized");try{const e=new Uint32Array(n.buffer,0,1)[0],o=new Uint8Array(n.buffer,4,e),r=t.DataFrame.fromByteArray(o),s=r.columns,i=s.length;if(i<3)throw new Error("incorrect columns count");this.classesCount=i-2,this.featuresCount=r.rowCount-1;const a=this.classesCount;this.params=new Array(a),this.categories=new Array(r.rowCount);for(let e=0;e<a;++e){const n=s.byIndex(e);if(this.categories[e]=n.name,n.type!==t.COLUMN_TYPE.FLOAT)throw new Error(`Incorrect input column type. Expected: float, passed: ${n.type}`);this.params[e]=n.getRawData()}const c=s.byName(ze);if(c.type!==t.COLUMN_TYPE.FLOAT)throw new Error("incorrect average values column type");this.avgs=c.getRawData();const l=s.byName(qe);if(l.type!==t.COLUMN_TYPE.FLOAT)throw new Error("incorrect standard deviations column type");this.stdevs=l.getRawData()}catch(t){throw new Error(`Failed to load model: ${t instanceof Error?t.message:"the platform issue"}`)}}}toBytes(){if(void 0===this.params)throw new Error("Non-trained model");const e=this.classesCount,n=new Array(e+2);for(let o=0;o<e;++o)n[o]=t.Column.fromFloat32Array(this.categories[o],this.params[o]);n[e]=t.Column.fromFloat32Array(ze,this.avgs),n[e+1]=t.Column.fromFloat32Array(qe,this.stdevs);const o=t.DataFrame.fromColumns(n).toByteArray(),r=o.length,s=new Uint8Array(r+4);return new Uint32Array(s.buffer,0,1)[0]=r,s.set(o,4),s}fit(e,n){return je(this,arguments,void 0,(function*(e,n,o=1,r=100,s=.1,i=.001){if(e.length!==this.featuresCount)throw new Error("Training failes - incorrect features count");if(o<=0||r<1||s<=0||i<=0)throw new Error("Training failes - incorrect fitting hyperparameters");this.extractStats(e);const a=n.length,c=n.categories.length,l=n.categories;for(let t=0;t<c;++t)this.categories[t]=l[t];try{const l=function(t,e,n,o,r,s,i,a,c,l,u){return Pt(EDA,"fitSoftmax",[t,e,n,o,r,s,i,a,c,l,u])}(e,t.Column.fromFloat32Array("avgs",this.avgs,this.featuresCount),t.Column.fromFloat32Array("stdevs",this.stdevs,this.featuresCount),t.Column.fromInt32Array("targets",n.getRawData(),a),c,r,o,s,i,this.featuresCount+1,c).columns;this.params=new Array(c);for(let t=0;t<c;++t)this.params[t]=l.byIndex(t).getRawData()}catch(t){try{this.params=yield this.fitSoftmaxParams(e,n,r,o,s,i)}catch(t){throw new Error("Training failes")}}if(void 0===this.params)throw new Error("Training failes")}))}extractStats(e){let n=0;for(const o of e){if(o.type!==t.COLUMN_TYPE.INT&&o.type!==t.COLUMN_TYPE.FLOAT)throw new Error("Training failes - incorrect features type");this.avgs[n]=o.stats.avg,this.stdevs[n]=o.stats.stdev,++n}}normalized(e){const n=e.byIndex(0).length,o=new Array(n);for(let t=0;t<n;++t)o[t]=new Float32Array(this.featuresCount);let r=0;for(const s of e){if(s.type!==t.COLUMN_TYPE.INT&&s.type!==t.COLUMN_TYPE.FLOAT)throw new Error("Training failes - incorrect features type");const e=s.getRawData(),i=this.avgs[r],a=this.stdevs[r];if(a>0)for(let t=0;t<n;++t)o[t][r]=(e[t]-i)/a;else for(let t=0;t<n;++t)o[t][r]=0;++r}return o}transposed(e){const n=e.byIndex(0).length,o=this.featuresCount,r=new Array(o);for(let t=0;t<o;++t)r[t]=new Float32Array(n);let s=0;for(const o of e){if(o.type!==t.COLUMN_TYPE.INT&&o.type!==t.COLUMN_TYPE.FLOAT)throw new Error("Training failes - incorrect features type");const e=o.getRawData(),i=this.avgs[s],a=this.stdevs[s];if(a>0)for(let t=0;t<n;++t)r[s][t]=(e[t]-i)/a;else for(let t=0;t<n;++t)r[s][t]=0;++s}return r}preprocessedTargets(e){if(e.type!==t.COLUMN_TYPE.STRING)throw new Error("Training failes - incorrect target type");const n=this.classesCount,o=e.length,r=e.getRawData(),s=new Array(o),i=new Uint32Array(n).fill(0);for(let t=0;t<o;++t)s[t]=new Uint8Array(n).fill(0);for(let t=0;t<o;++t)s[t][r[t]]=1,++i[r[t]];return{oneHot:s,weights:i}}predict(e){if(void 0===this.params)throw new Error("Non-trained model");if(e.length!==this.featuresCount)throw new Error("Predcition fails: incorrect features count");const n=this.normalized(e),o=n.length,r=this.featuresCount,s=this.classesCount;let i,a;const c=new Float32Array(s);let l,u,h;const f=new Array(o);for(let t=0;t<o;++t){i=n[t],l=0;for(let t=0;t<s;++t){a=this.params[t],l=a[r];for(let t=0;t<r;++t)l+=a[t]*i[t];c[t]=Math.exp(l)}u=c[0],h=0;for(let t=1;t<s;++t)u<c[t]&&(u=c[t],h=t);f[t]=this.categories[h]}return t.Column.fromStrings("predicted",f)}fitSoftmaxParams(t,e,o,r,s,i){return je(this,void 0,void 0,(function*(){const a=this.preprocessedTargets(e);return new Promise(((c,l)=>{const u=new Worker(new URL(n.p+n.u(501),n.b));u.postMessage({features:this.normalized(t),transposed:this.transposed(t),oneHot:a.oneHot,classesWeights:a.weights,targetRaw:e.getRawData(),iterations:o,rate:r,penalty:s,tolerance:i}),u.onmessage=function(t){u.terminate(),c(t.data.params),console.log(`Loss: ${t.data.loss}`)}}))}))}}var Ze,tn,en,nn;(nn=Ze||(Ze={}))[nn.ITERATIONS=20]="ITERATIONS",nn[nn.ETA=.3]="ETA",nn[nn.MAX_DEPTH=6]="MAX_DEPTH",nn[nn.LAMBDA=1]="LAMBDA",nn[nn.ALPHA=0]="ALPHA",function(t){t[t.SAMLPES_HIGH=1e5]="SAMLPES_HIGH",t[t.SAMLPES_MID=5e4]="SAMLPES_MID",t[t.SAMPLES_LOW=1e4]="SAMPLES_LOW",t[t.FEATURES_HIGH=10]="FEATURES_HIGH",t[t.FEATURES_MID=20]="FEATURES_MID",t[t.FEATURES_LOW=100]="FEATURES_LOW"}(tn||(tn={})),function(t){t[t.MODEL=1e7]="MODEL",t[t.UTILS=1]="UTILS",t[t.PACK=128]="PACK",t[t.SIZE=4]="SIZE"}(en||(en={}));const on=t.FLOAT_NULL;var rn;!function(t){t.PREDICT="Prediction",t.TYPE="Type",t.PARAMS="Params count",t.CATS="Categories",t.CATS_SIZE="Categories size"}(rn||(rn={}));class sn{static isApplicable(t,e){for(const e of t)if(!e.matches("numerical"))return!1;return!(!e.matches("numerical")&&!e.matches("string"))}static isInteractive(t,e){const n=t.length,o=e.length;return o<=tn.SAMPLES_LOW?n<=tn.FEATURES_LOW:o<=tn.SAMLPES_MID?n<=tn.FEATURES_MID:o<=tn.SAMLPES_HIGH&&n<=tn.FEATURES_HIGH}constructor(e){var n;if(this.modelParams=void 0,this.targetType=void 0,this.targetCategories=void 0,e)try{let o=0;const r=new Uint32Array(e.buffer,o,1)[0];o+=en.SIZE;const s=t.DataFrame.fromByteArray(new Uint8Array(e.buffer,o,r));o+=r,this.targetType=s.get(rn.TYPE,0);const i=s.get(rn.PARAMS,0),a=s.get(rn.CATS_SIZE,0);if(a>0){const r=t.DataFrame.fromByteArray(new Uint8Array(e.buffer,o,a));this.targetCategories=null===(n=r.col(rn.CATS))||void 0===n?void 0:n.toList()}o+=a,o=4*Math.ceil(o/4),this.modelParams=new Int32Array(e.buffer,o,i)}catch(t){throw new Error(`Failed to load model: ${t instanceof Error?t.message:"the platform issue"}`)}}fit(e,o){return r=this,s=arguments,a=function*(e,o,r=Ze.ITERATIONS,s=Ze.ETA,i=Ze.MAX_DEPTH,a=Ze.LAMBDA,c=Ze.ALPHA){this.targetType=o.type,this.targetType===t.COLUMN_TYPE.STRING&&(this.targetCategories=o.categories),this.modelParams=yield async function(t,e,o,r,s,i,a,c,l,u){return new Promise(((h,f)=>{const m=e.length,d=t.length,y=new Float32Array(m*d);let p,g;for(let e=0;e<d;++e){g=t.byIndex(e).getRawData(),p=e*m;for(let t=0;t<m;++t)y[t+p]=g[t]}const E=new Worker(new URL(n.p+n.u(990),n.b));E.postMessage({features:y,target:e.getRawData(),samplesCount:m,featuresCount:d,modelReserve:l,utilsLength:u,iterations:r,eta:s,maxDepth:i,lambda:a,alpha:c,missingValue:o}),E.onmessage=function(t){E.terminate(),h(t.data.params)}}))}(e,o,on,r,s,i,a,c,en.MODEL,en.UTILS)},new((i=void 0)||(i=Promise))((function(t,e){function n(t){try{c(a.next(t))}catch(t){e(t)}}function o(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(n,o)}c((a=a.apply(r,s||[])).next())}));var r,s,i,a}predict(e){if(void 0===this.modelParams)throw new Error("Failed to apply non-trained model");const n=function(t,e,n){const o=t.byIndex(0).length,r=t.length,s=n.length;let i=XGBoostModule.HEAPF32;const a=XGBoostModule.HEAP32,c=XGBoostModule._malloc(o*r*4),l=XGBoostModule._malloc(4*o),u=XGBoostModule._malloc(4*s);for(let e=0;e<r;++e){const n=t.byIndex(e).getRawData();for(let t=0;t<o;++t)i[c/4+t+e*o]=n[t]}for(let t=0;t<s;++t)a[u/4+t]=n[t];XGBoostModule._predict(c,o,r,e,u,s,l,o),i=XGBoostModule.HEAPF32;const h=new Float32Array(o);for(let t=0;t<o;++t)h[t]=i[l/4+t];return XGBoostModule._free(c),XGBoostModule._free(l),XGBoostModule._free(u),h}(e,on,this.modelParams);switch(this.targetType){case t.COLUMN_TYPE.STRING:return this.stringColPrediction(n);case t.COLUMN_TYPE.INT:return this.intColPrediction(n);case t.COLUMN_TYPE.BIG_INT:return this.bigIntColPrediction(n);default:return t.Column.fromFloat32Array(rn.PREDICT,n)}}toBytes(){if(void 0===this.modelParams||void 0===this.targetType)throw new Error("Failed to pack non-trained model");const e=void 0!==this.targetCategories?t.DataFrame.fromColumns([t.Column.fromList(t.COLUMN_TYPE.STRING,rn.CATS,this.targetCategories)]).toByteArray():void 0,n=void 0!==e?e.length:0,o=this.modelParams.length*this.modelParams.BYTES_PER_ELEMENT,r=t.DataFrame.fromColumns([t.Column.fromStrings(rn.TYPE,[this.targetType]),t.Column.fromInt32Array(rn.PARAMS,new Int32Array([this.modelParams.length])),t.Column.fromInt32Array(rn.CATS_SIZE,new Int32Array([n]))]).toByteArray(),s=r.length,i=64*Math.ceil((en.SIZE+s+n+o+en.PACK)/64),a=new Uint8Array(i);let c=0;return new Uint32Array(a.buffer,c,1)[0]=s,c+=en.SIZE,a.set(r,c),c+=s,n>0&&a.set(e,c),c+=n,c=4*Math.ceil(c/4),a.set(new Uint8Array(this.modelParams.buffer),c),a}stringColPrediction(e){const n=e.length;if(void 0===this.targetCategories)throw new Error("Predicting fails: undefined categories");const o=new Array(n),r=this.targetCategories.length-1;for(let t=0;t<n;++t)o[t]=this.targetCategories[(s=Math.round(e[t]),Math.max(0,Math.min(s,r)))];var s;return t.Column.fromList(t.COLUMN_TYPE.STRING,rn.PREDICT,o)}intColPrediction(e){const n=e.length,o=new Int32Array(n);for(let t=0;t<n;++t)o[t]=Math.round(e[t]);return t.Column.fromInt32Array(rn.PREDICT,o,n)}bigIntColPrediction(e){const n=e.length,o=new BigInt64Array(n);for(let t=0;t<n;++t)o[t]=BigInt(Math.round(e[t]));return t.Column.fromBigInt64Array(rn.PREDICT,o)}}var an=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const cn=100,ln=8e3;var un;L("Softmax",(()=>{O("Performance: 50K samples, 100 features",(()=>an(void 0,void 0,void 0,(function*(){const t=Ve(5e4,cn,!1).columns,e=t.byIndex(cn);t.remove(e.name);const n=new Je({classesCount:e.categories.length,featuresCount:t.length});yield n.fit(t,e);const o=n.toBytes();new Je(void 0,o).predict(t)}))),{timeout:ln,benchmark:!0}),O("Correctness",(()=>an(void 0,void 0,void 0,(function*(){const t=Ve(50,2,!0).columns,e=t.byIndex(2);t.remove(e.name);const n=new Je({classesCount:e.categories.length,featuresCount:t.length});yield n.fit(t,e);const o=n.toBytes(),r=We(e,new Je(void 0,o).predict(t));R(r>.9,!0,`Softmax failed, too small accuracy: ${r}; expected: <= 0.9`)}))),{timeout:ln})})),L("XGBoost",(()=>{O("Performance: 50K samples, 100 features",(()=>an(void 0,void 0,void 0,(function*(){const t=Ve(5e4,cn,!1).columns,e=t.byIndex(cn);t.remove(e.name);const n=new sn;yield n.fit(t,e);const o=n.toBytes();new sn(o).predict(t)}))),{timeout:ln,benchmark:!0}),O("Correctness",(()=>an(void 0,void 0,void 0,(function*(){const t=Ve(50,2,!0).columns,e=t.byIndex(2);t.remove(e.name);const n=new sn;yield n.fit(t,e);const o=n.toBytes(),r=We(e,new sn(o).predict(t));R(r>.9,!0,`XGBoost failed, too small accuracy: ${r}; expected: <= 0.9`)}))),{timeout:ln})})),function(t){t.NO_DATAFRAME="No dataframe is opened",t.NO_MISSING_VALUES="No missing values",t.ONE_AVAILABLE_FEATURE="Not enough of feature columns to apply imputation using the KNN method",t.ONE_FEATURE_SELECTED="Imputation cannot be applied to",t.UNSUPPORTED_COLUMN_TYPE="Unsupported column type",t.UNSUPPORTED_IMPUTATION_STRATEGY="Unsupported imputation strategy",t.KNN_CANNOT_BE_APPLIED="KNN imputer cannot be applied: no columns to be used as features",t.KNN_NO_TARGET_COLUMNS="KNN imputer cannot be applied: no columns with missing values",t.KNN_NO_FEATURE_COLUMNS="KNN imputer cannot be applied: no feature columns",t.KNN_NOT_ENOUGH_OF_ROWS="KNN imputer cannot be applied: not enough of rows",t.KNN_IMPOSSIBLE_IMPUTATION="Imputation is impossible, no features can be used",t.INCORRECT_NEIGHBORS="Incorrect number of neighbors",t.KNN_FAILS="KNN IMPUTATION FAILS",t.CORE_ISSUE="Core issue",t.FAILED_TO_IMPUTE="Failed to impute",t.UNSUPPORTED_FILL_VALUE_TYPE="Unsupported fill value type",t.EMPTY_COLUMN="Column contains just null values",t.FAILS_TO_PREDICT_IMPUTATION_FAILS="Failed to predict imputation fails",t.WRONG_PREDICTIONS="wrong evaluation of KNN imputation fails"}(un||(un={}));const hn="copy";var fn,mn;!function(t){t.KNN_IMPUTER="Impute",t.TABLE="Table",t.IN_PLACE="In-place",t.COLUMNS="Impute",t.FEATURES="Using",t.CANCEL="CANCEL",t.RUN="RUN",t.OK="OK",t.NEIGHBORS="Neighbors",t.DISTANCE="Distance",t.FILL="Fill",t.MARK="Mark",t.SIMPLE_IMPUTER="Simple impute",t.SETTINGS="Settings",t.KEEP_EMPTY="Keep empty"}(fn||(fn={})),function(t){t.TARGET="Columns with missing values that must be filled",t.FEATURES="Columns with features to be used for determining the 'nearest' elements in the KNN method",t.IN_PLACE="Defines whether to use in-place imputation or add a new column without missing values",t.METRIC="Type of metric between the feature values",t.WEIGHT="Weight",t.NEIGHBORS="Neighbors count used in the KNN method",t.DISTANCE="Type of distance between elements with the specified features",t.METRIC_SETTINGS="Show additional options",t.FILL_FAILED_ITEMS="Impute missing values using a simple approach: mean, median or most frequent",t.MARK_FAILED_ITEMS="Mark missing values cells with a color",t.FILL_VALUE="Fill value",t.IMPUTATION_SETTINGS="Simple imputation settings",t.KEEP_EMPTY="Defines whether to keep empty missing values failed to be imputed OR fill them using simple imputation"}(mn||(mn={}));const dn=[t.COLUMN_TYPE.INT,t.COLUMN_TYPE.FLOAT,t.COLUMN_TYPE.STRING,t.COLUMN_TYPE.DATE_TIME,t.COLUMN_TYPE.QNUM];function yn(e){switch(e.type){case t.COLUMN_TYPE.INT:return t.INT_NULL;case t.COLUMN_TYPE.FLOAT:case t.COLUMN_TYPE.QNUM:case t.COLUMN_TYPE.DATE_TIME:return t.FLOAT_NULL;case t.COLUMN_TYPE.STRING:return e.max;default:throw new Error(un.UNSUPPORTED_COLUMN_TYPE)}}var pn,gn,En,Cn;function An(e){switch(e){case t.COLUMN_TYPE.STRING:case t.COLUMN_TYPE.DATE_TIME:return{defaultWeight:En.WEIGHT,defaultMetric:pn.ONE_HOT,availableMetrics:[pn.ONE_HOT]};case t.COLUMN_TYPE.INT:case t.COLUMN_TYPE.FLOAT:case t.COLUMN_TYPE.QNUM:return{defaultWeight:En.WEIGHT,defaultMetric:pn.DIFFERENCE,availableMetrics:[pn.DIFFERENCE,pn.ONE_HOT]};default:throw new Error(un.UNSUPPORTED_COLUMN_TYPE)}}!function(t){t.ONE_HOT="One-hot",t.DIFFERENCE="Difference"}(pn||(pn={})),(Cn=gn||(gn={})).EUCLIDEAN="Euclidean",Cn.MANHATTAN="Manhattan",function(t){t[t.WEIGHT=1]="WEIGHT",t[t.NEIGHBORS=4]="NEIGHBORS",t[t.IN_PLACE=1]="IN_PLACE",t[t.SELECTED=1]="SELECTED",t[t.KEEP_EMPTY=0]="KEEP_EMPTY"}(En||(En={}));const wn=n=>{O(`${n} dist, 100K rows, 15 cols, 75 missing vals`,(()=>{return o=void 0,r=void 0,i=function*(){const o=function(e){const n=Be.length,o=[];let r=0;const s=new Map;for(let n=0;n<5;++n){const i=new Int32Array(e),a=`int #${n+1}`,c=[];for(let t=0;t<e;++t)i[t]=Math.floor(10*Math.random());for(let n=0;n<5;++n)r=Math.floor(e*Math.random()),i[r]=t.INT_NULL,c.push(r);o.push(t.Column.fromInt32Array(a,i)),s.set(a,c)}for(let n=0;n<5;++n){const i=new Float32Array(e),a=`float #${n+1}`,c=[];for(let t=0;t<e;++t)i[t]=10*Math.random();for(let n=0;n<5;++n)r=Math.floor(e*Math.random()),i[r]=t.FLOAT_NULL,c.push(r);o.push(t.Column.fromFloat32Array(a,i)),s.set(a,c)}for(let i=0;i<5;++i){const a=new Array(e),c=`str #${i+1}`,l=[];for(let t=0;t<e;++t)a[t]=Be[Math.floor(Math.random()*n)];const u=t.Column.fromStrings(c,a);for(let t=0;t<5;++t)r=Math.floor(e*Math.random()),u.set(r,null),l.push(r);o.push(u),s.set(c,l)}return{df:t.DataFrame.fromColumns(o),misValsIds:s}}(1e5),r=o.df,s=r.columns.names(),i=new Map,a=o.misValsIds;for(const t of r.columns){const e=An(t.type);i.set(t.name,{weight:e.defaultWeight,type:e.defaultMetric})}const c=function(n,o,r,s,i,a,c){if(a<1)throw new Error(un.INCORRECT_NEIGHBORS);if(n.rowCount<2)throw new Error(un.KNN_NOT_ENOUGH_OF_ROWS);if(0===o.length)throw new Error(un.KNN_NO_TARGET_COLUMNS);if(0===r.size)throw new Error(un.KNN_NO_FEATURE_COLUMNS);1===r.size&&o.forEach((t=>{if(r.has(t))throw new Error(`${un.KNN_NO_FEATURE_COLUMNS} can be used for the column '${t}'`)})),o.forEach((t=>{if(!s.has(t))throw new Error(`${un.KNN_FAILS}: ${un.WRONG_PREDICTIONS}`)}));const l=n.columns;o.forEach((t=>{if(!dn.includes(l.byName(t).type))throw new Error(un.UNSUPPORTED_COLUMN_TYPE)})),r.forEach(((t,e)=>{if(!dn.includes(n.getCol(e).type))throw new Error(un.UNSUPPORTED_COLUMN_TYPE)}));const u=new Map;return o.forEach((o=>{const h=l.byName(o),f=yn(h),m=h.length,d=h.getRawData(),y=new Uint16Array(h.categories.length),p=[],g=[],E=[],C=[];r.forEach(((t,e)=>{if(e!==h.name){const n=l.byName(e);switch(p.push(n.getRawData()),g.push(yn(n)),t.type){case pn.DIFFERENCE:E.push(((e,n)=>t.weight*Math.abs(e-n)));break;case pn.ONE_HOT:E.push(((e,n)=>t.weight*(e===n?0:1)))}}}));const A=p.length,w=new Uint32Array(p.length),v=new Float32Array(p.length);let N=0;const _=new Array(a);let x=0,S=0,T=0,M=0,I=0;const b=(t,e)=>{w.forEach(((n,o)=>{v[o]=E[n](p[n][t],p[n][e])}))},O=i===gn.EUCLIDEAN?()=>{let t=0;for(let e=0;e<N;++e)t+=v[e]*v[e];return Math.sqrt(t)}:()=>{let t=0;for(let e=0;e<N;++e)t+=Math.abs(v[e]);return Math.sqrt(t)},R=t=>{if(d[t]===f)return!1;for(let e=0;e<N;++e)if(p[w[e]][t]===g[w[e]])return!1;return!0},L=e=>{if((t=>{N=0;for(let e=0;e<A;++e)p[e][t]!==g[e]&&(w[N]=e,++N)})(e),0===N)throw new Error(`${un.KNN_IMPOSSIBLE_IMPUTATION}: the column "${h.name}", row ${e+1}`);x=0;for(let t=0;t<m;++t)if(R(t)&&t!==e){b(e,t);const n=O();if(x<a)_[x]={index:t,dist:n},++x;else{S=0,T=_[0].dist;for(let t=1;t<x;++t)T<_[t].dist&&(T=_[t].dist,S=t);n<T&&(_[S]={index:t,dist:n})}}if(0===x)throw new Error(`${un.KNN_IMPOSSIBLE_IMPUTATION}: the column "${h.name}", row ${e+1}`);if(h.type===t.COLUMN_TYPE.STRING)return(()=>{y.forEach(((t,e,n)=>n[e]=0));let t=0;for(t=0;t<x;++t)++y[d[_[t].index]];let e=y[0],n=0;return y.forEach(((t,o)=>{t>e&&(e=t,n=o)})),n})();M=0;for(let t=0;t<x;++t)M+=d[_[t].index];return I=M/x,h.type===t.COLUMN_TYPE.INT?Math.round(I):I};if(c){for(const t of s.get(o))try{d[t]=L(t)}catch(n){C.push(t),n instanceof Error||e.shell.error(un.CORE_ISSUE)}C.length>0&&u.set(o,C),h.set(0,h.get(0))}else{const t=h.clone();let r=1,i=`${o}(${hn})`;for(;n.columns.contains(i);)i=`${o}(${hn} ${r})`,++r;t.name=i;const a=t.getRawData();for(const t of s.get(o))try{a[t]=L(t)}catch(n){C.push(t),n instanceof Error||e.shell.error(un.CORE_ISSUE)}C.length>0&&u.set(i,C),t.set(0,t.get(0)),n.columns.add(t)}})),u}(r,s,i,a,n,5,!0);let l=0;c.forEach(((t,e)=>l+=t.length)),R(l,0,`Failed to impute ${l} missing values`)},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{c(i.next(t))}catch(t){e(t)}}function a(t){try{c(i.throw(t))}catch(t){e(t)}}function c(e){var o;e.done?t(e.value):(o=e.value,o instanceof s?o:new s((function(t){t(o)}))).then(n,a)}c((i=i.apply(o,r||[])).next())}));var o,r,s,i}),{timeout:1e4,benchmark:!0})};L("Missing values imputation",(()=>{wn(gn.EUCLIDEAN),wn(gn.MANHATTAN)}));var vn=function(t,e,n,o){return new(n||(n=Promise))((function(r,s){function i(t){try{c(o.next(t))}catch(t){s(t)}}function a(t){try{c(o.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((o=o.apply(t,e||[])).next())}))};const Nn=new t.Package;function _n(e,n,o){return vn(this,void 0,void 0,(function*(){const r=yield D({category:e,test:n,testContext:o});return t.DataFrame.fromObjects(r)}))}})(),eda_test=o})();
2
2
  //# sourceMappingURL=package-test.js.map