@datagrok/bio 2.11.27 → 2.11.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package-test.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var bio_test;(()=>{var t={2012:(t,e,s)=>{"use strict";s.d(e,{f:()=>i});var n=s(9976);class i extends n.B{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,i)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,i)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new i({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in i.aaSynonyms?i.aaSynonyms[t]:t;return super.get(e)}}i.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class o{static getPalette(t="grok"){switch(t){case"grok":return i.GrokGroups;case"lesk":return i.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,s="",n="";for(const i of t)"("==i?e++:")"==i?e--:e?s+=i:n+=i;return isNaN(parseInt(s))?[n,s]:[n,""]}static getColorAAPivot(t="",e="grok"){const s=this.getPalette(e);let[n,i]=this.getInnerOuter(t);if(n=n.length>6?`${n.slice(0,3)}...`:n,i=i.length>6?`${i.slice(0,3)}...`:i,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in s?[s.get(e),e,i,1]:[this.undefinedColor,n,i,1]}if("d"==t[0]&&t[1]in s&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in s?[s.get(e),e,i,2]:[this.undefinedColor,n,i,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in s?[s.get(e),e,i,3]:[this.undefinedColor,n,i,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in s?[s.get(e),e,i,4]:[this.undefinedColor,n,i,4]}return[this.undefinedColor,n,i,0]}}o.SemType="Aminoacids",o.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",o.undefinedColor="rgb(100,100,100)",o.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},o.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},o.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},o.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"}},6584:(t,e,s)=>{"use strict";s.d(e,{BX:()=>o,nW:()=>l,tW:()=>c,tb:()=>h});var n=s(4469);const i="Libraries",o="System:AppData/Bio/libraries/",r={explicit:["HELMCoreLibrary.json"],exclude:[]};let a=Promise.resolve();async function l(){let t;return a=a.then((async()=>{const e=await n.dapi.userDataStorage.getValue(i,"Settings",!0);t=e?JSON.parse(e):{exclude:[],explicit:[]},t.exclude=t.exclude instanceof Array?t.exclude:[],t.explicit=t.explicit instanceof Array?t.explicit:[],console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(t,void 0,2)}`)})),await a,t}async function c(t){a=a.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(t,void 0,2)}`),await n.dapi.userDataStorage.postValue(i,"Settings",JSON.stringify(t),!0)})),await a}async function h(){await c(r)}},7228:(t,e,s)=>{"use strict";s.d(e,{JN:()=>l,Qx:()=>c,Xk:()=>a});var n=s(976),i=s(4469),o=s(1047),r=(s(499),s(8457));function a(t){const e=[];for(let s=0;s<t.rowCount;s++){const n={};Object.keys(o.K4).forEach((e=>{if("symbol"===e){const i=t.get(o.K4[e],s);n[e]="."===i?t.get(o.At,s):i}else if("rgroups"===e){const i=t.get(o.K4[e],s).split("\n"),r=[];i.forEach((t=>{const e={},s=t.substring(t.lastIndexOf("]")+1),n=t.match(/\[R(\d+)\]/)[1];e.capGroupSmiles="H"===s?`[*:${n}][H]`:`O[*:${n}]`,e.alternateId="H"===s?`R${n}-H`:`R${n}-OH`,e.capGroupName="H"===s?"H":"OH",e.label=`R${n}`,r.push(e)})),n[e]=r}else o.K4[e]&&(n[e]=t.get(o.K4[e],s))})),e.push(n)}return e}async function l(){const t=n.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await t[0].prepare().call()).getOutputParamValue()}async function c(t,e){t instanceof n.Column&&(t=(0,r.O)(t).columns.toList());const s=(await l()).getBioLib(),o=new Array(t.length),a=t[0].length,c=new Float32Array(a);for(let r=0;r<t.length;++r){const l=e[r],h=s.getMonomer("PEPTIDE",l)?.smiles??"",u=t[r],d=u.getRawData(),m=u.categories,p=m.indexOf("");if(o[r]={categories:m,data:d,emptyIndex:p},void 0===l)continue;const g=n.Column.fromStrings("smiles",m.map((t=>s.getMonomer("PEPTIDE",t)?.smiles??""))),f=(n.DataFrame.fromColumns([g]),(await i.chem.getSimilarities(g,h)).getRawData());for(let t=0;t<a;++t){const e=d[t];c[t]+=""!==l&&e!==p?f[e]:""===l&&e===p?1:0}}for(let s=0;s<c.length;++s){let i=c[s]/e.length;for(let r=0;r<t.length;++r){const t=o[r];if(r>=e.length&&t.data[s]!==t.emptyIndex||t.data[s]===t.emptyIndex&&r<e.length){i=n.FLOAT_NULL;break}}c[s]=i}return n.Column.fromFloat32Array("Similarity",c)}s(5697)},8601:(t,e,s)=>{"use strict";s.d(e,{i0:()=>d});var n=s(4469),i=s(976),o=s(6414),r=s.n(o),a=s(1821),l=s(499);const c={V2K_RGP_SHIFT:8,V2K_RGP_LINE:"M RGP",V2K_A_LINE:"A ",V3K_COUNTS_SHIFT:14,V3K_IDX_SHIFT:7,V3K_HEADER_FIRST_LINE:"\nDatagrok macromolecule handler\n\n",V3K_HEADER_SECOND_LINE:" 0 0 0 0 0 0 999 V3000\n",V3K_BEGIN_CTAB_BLOCK:"M V30 BEGIN CTAB\n",V3K_END_CTAB_BLOCK:"M V30 END CTAB\n",V3K_BEGIN_COUNTS_LINE:"M V30 COUNTS ",V3K_COUNTS_LINE_ENDING:" 0 0 0\n",V3K_BEGIN_ATOM_BLOCK:"M V30 BEGIN ATOM\n",V3K_END_ATOM_BLOCK:"M V30 END ATOM\n",V3K_BEGIN_BOND_BLOCK:"M V30 BEGIN BOND\n",V3K_END_BOND_BLOCK:"M V30 END BOND\n",V3K_BOND_CONFIG:" CFG=",V3K_BEGIN_DATA_LINE:"M V30 ",V3K_END:"M END",PRECISION_FACTOR:1e4,DEOXYRIBOSE:"d",RIBOSE:"r",PHOSPHATE:"p",OXYGEN:"O",HYDROGEN:"H"};var h=s(1047);function u(t){return Math.round(c.PRECISION_FACTOR*t)/c.PRECISION_FACTOR}async function d(t,e,o){if(0===i.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(e.semType!==i.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${i.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${e.semType}'`]};let u=e;const d=l.Cn.getOrCreate(e);d.isHelm()&&(u=d.convert(a.r2.SEPARATOR,"."),u.name=e.name);const p=l.Cn.getOrCreate(u).alphabet;let g;if("PT"===p||"UN"===p)g="PEPTIDE";else{if("RNA"!==p&&"DNA"!==p)return{col:null,warnings:[`Unexpected column's '${u.name}' alphabet '${p}'.`]};g="RNA"}const f=function(t){const e=t.length,s=new Array(e),n=l.Cn.getOrCreate(t).getSplitter();for(let i=0;i<e;++i){const e=t.get(i);s[i]=e?r()(n(e)).filter((t=>""!==t)).toArray():[]}return s}(u),y=await async function(t,e,s,i){const o=function(t,e,s){const n=new Map;for(const i of t.getMonomerSymbolsByType(e)){const o=t.getMonomer(e,i);if("RNA"===e&&("Branch"===o.monomerType||"DNA"===s&&o.symbol===c.DEOXYRIBOSE||"RNA"===s&&o.symbol===c.RIBOSE||o.symbol===c.PHOSPHATE)||"PEPTIDE"===e&&"Branch"!==o.monomerType){const t={};h.rx.forEach((e=>{t[e]=o[e]})),n.set(o.symbol,t)}}return n}(e,s,i),r=new Map,a=await n.functions.call("Chem:getRdKitModule"),l={value:null};if("RNA"===s){const t="RNA"===i?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const e of t)m(r,e,o,a,s,l)}for(let e=0;e<t.length;++e){const n=t[e];for(const t of n)if(""!==t)try{m(r,t,o,a,s,l)}catch(e){const s=e instanceof Error?e.message:e.toString(),n=e instanceof Error?e.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${t}', error:\n${s}\n${n}`),new Error(`Can't get monomer '${t}' from library: ${s}`)}}return r}(f,o,g,p),C=u.length,{molfileList:T,molfileWarningList:A}=await async function(t,e,n,i,o){const r=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(r).fill(null).map((()=>new Worker(new URL(s.p+s.u(79),s.b)))),l=o/r;let c=[],h=[];const u=new Array(r);for(let s=0;s<r;s++){const c=Math.floor(s*l),h=s===r-1?o:Math.floor((s+1)*l);a[s].postMessage({monomerSequencesArray:t,monomersDict:e,alphabet:n,polymerType:i,start:c,end:h}),u[s]=new Promise((t=>{a[s].onmessage=({data:{molfileList:e,molfileWarningList:s}})=>{t({molfileList:e,molfileWarningList:s})}}))}return(await Promise.all(u)).forEach((t=>{c=c.concat(...t.molfileList),h=h.concat(...t.molfileWarningList)})),setTimeout((()=>{a.forEach((t=>{t.terminate()}))}),0),{molfileList:c,molfileWarningList:h}}(f,y,p,g,C);if(A.length>.05*C)throw new Error("Too many errors getting molfiles.");const b=`molfile(${u.name})`,w=t.columns.getUnusedName(b),S=i.Column.fromStrings(w,T);return S.semType=i.SEMTYPE.MOLECULE,S.setTag(i.TAGS.UNITS,i.UNITS.Molecule.MOLBLOCK),{col:S,warnings:A}}function m(t,e,s,n,i,o){if(!t.has(e)){const r=function(t,e,s,n,i){if(e.has(t)){const o=e.get(t),r=function(t){const e=[];for(const s of t){let t=s.capGroupSmiles;t||(t=s.capGroupSMILES),t=t.replace(/(\[|\]|\*|:|\d)/g,""),e.push(t)}return e}(o.rgroups),a=function(t){const e=new Map;let s=t.indexOf(c.V2K_A_LINE,0),n=s;for(;-1!==s;){n=t.indexOf("\n",s);const i=parseInt(t.substring(s,n).replace(/^A\s+/,""));s=t.indexOf("R",n),n=t.indexOf("\n",s);const o=parseInt(t.substring(s,n).replace(/^R/,""));e.set(i,o),s=t.indexOf(c.V2K_A_LINE,n)}for(s=t.indexOf(c.V2K_RGP_LINE,0),n=t.indexOf("\n",s);-1!==s;){s+=c.V2K_RGP_SHIFT,n=t.indexOf("\n",s);const i=t.substring(s,n).replaceAll(/\s+/g," ").split(" ").map((t=>parseInt(t))).slice(1);for(let t=0;t<i.length;t+=2){if(e.has(i[t])&&e.get(i[t])!==i[t+1])throw new Error(`r-group index ${i[t]} has already been added with a different value`);e.set(i[t],i[t+1])}s=t.indexOf(c.V2K_RGP_LINE,n)}return e}(o.molfile),l=function(t,e){const s=e.get_mol(t),n=s.get_v3Kmolblock();return s.delete(),n}(function(t){let e=t.indexOf(c.V2K_A_LINE,0);-1===e&&(e=t.indexOf(c.V2K_RGP_LINE));const s=t.indexOf(c.V3K_END,e);return t.substring(0,e)+t.substring(s)}(o.molfile),s),h=function(t){let e=(t=t.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,s=t.indexOf(" ",e+1);const n=parseInt(t.substring(e,s));return e=s+1,s=t.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(t.substring(e,s))}}(l),d=function(t,e){const s=new Array(e),n=new Float32Array(e),i=new Float32Array(e),o=new Array(e);let r=t.indexOf(c.V3K_BEGIN_ATOM_BLOCK);r=t.indexOf("\n",r);let a=r;for(let l=0;l<e;l++){r=t.indexOf(c.V3K_BEGIN_DATA_LINE,r)+c.V3K_IDX_SHIFT,a=t.indexOf(" ",r),r=a+1,a=t.indexOf(" ",r),s[l]=t.substring(r,a);const e=new Array(2);for(let s=0;s<2;++s)r=a+1,a=t.indexOf(" ",r),e[s]=parseFloat(t.substring(r,a));n[l]=e[0],i[l]=e[1],r=a,a=t.indexOf("\n",r)+1,o[l]=t.slice(r,a),r=a}return{atomTypes:s,x:n,y:i,kwargs:o}}(l,h.atomCount),m=function(t,e){const s=new Uint32Array(e),n=new Array(e),i=new Map,o=new Map;let r=t.indexOf(c.V3K_BEGIN_BOND_BLOCK);r=t.indexOf("\n",r);let a=r;for(let l=0;l<e;++l){const e=new Array(3);r=t.indexOf(c.V3K_BEGIN_DATA_LINE,a)+c.V3K_IDX_SHIFT,a=t.indexOf(" ",r);for(let s=0;s<3;++s)r=a+1,a=Math.min(t.indexOf("\n",r),t.indexOf(" ",r)),e[s]=parseInt(t.slice(r,a));s[l]=e[0],n[l]=e.slice(1);const h=t.indexOf("\n",r);let u=t.slice(a,h),d=u.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=u.indexOf("=",d)+1;let t=u.indexOf(" ",d);-1===t&&(t=u.length);const e=parseInt(u.slice(d,t));i.set(l,e);const s=c.V3K_BOND_CONFIG+e.toString();u=u.replace(s,"")}u||o.set(l,u)}return{bondTypes:s,atomPairs:n,bondConfiguration:i,kwargs:o}}(l,h.bondCount),y={atoms:d,bonds:m,meta:p(d,m,r,a)};return"PEPTIDE"===n?function(t){const e=t.meta.terminalNodes[0]-1,s=t.meta.rNodes[0]-1,n=t.atoms.x,i=t.atoms.y;S(t,-n[e],-i[e]);const o=A(n[s],i[s]);b(t.atoms,-o),n[t.meta.rNodes[1]-1]<0&&function(t){w(t,!1)}(t);const r=function(t){const e=function(t){const e=new Map;for(const s of t.bonds.atomPairs)for(let t=0;t<2;t++){const n=s[t],i=s[(t+1)%2];e.has(n)?e.get(n)?.push(i):e.set(n,new Array(1).fill(i))}return e}(t);let s=0;const n=t.atoms.atomTypes.length;let i=0;for(;0===s;){const o=e.get(t.meta.terminalNodes[1])[i];if(t.atoms.atomTypes[o-1]===c.OXYGEN&&o!==t.meta.rNodes[1]&&(s=o),i++,i>n)throw new Error(`Search for double-bonded Oxygen in ${t} has exceeded the limit of ${n}`)}return s}(t);!function(t,e){t.atoms.y[t.meta.rNodes[1]-1]<0&&t.atoms.y[e-1]<0&&(function(t){w(t,!0)}(t),b(t.atoms,-function(t,e){return A(t,e)+Math.PI/2}(t.atoms.x[t.meta.terminalNodes[1]-1],t.atoms.y[t.meta.terminalNodes[1]-1])))}(t,r),function(t,e){const s=t.atoms.x;s[t.meta.rNodes[1]-1]>s[e-1]&&function(t,e,s){const n=e-1,i=s-1,o=t.atoms.x,r=t.atoms.y,a=o[n],l=r[n];o[n]=o[i],r[n]=r[i],o[i]=a,r[i]=l}(t,e,t.meta.rNodes[1])}(t,r)}(y):t===c.RIBOSE||t===c.DEOXYRIBOSE?function(t,e){const s=t.atoms.x,n=t.atoms.y;let i=t.meta.terminalNodes[0]-1;const o=t.meta.rNodes[1]-1;S(t,-s[i],-n[i]);const r=A(s[o],n[o]);b(t.atoms,3*Math.PI/2-r),e.value=function(t){const e=t.atoms.x,s=t.atoms.y,n=t.meta.rNodes[2]-1,i=t.meta.terminalNodes[2]-1,o=e[n]-e[i],r=s[n]-s[i];return Math.atan(r/o)+Math.PI/2}(t),i=t.meta.terminalNodes[0]-1,S(t,-s[i],-n[i])}(y,i):t===c.PHOSPHATE?function(t){const e=t.meta.terminalNodes[0]-1,s=t.meta.rNodes[0]-1,n=t.atoms.x,i=t.atoms.y;S(t,-n[e],-i[e]);const o=A(n[s],i[s]);b(t.atoms,Math.PI/2-o)}(y):function(t,e){const s=t.atoms.x,n=t.atoms.y,i=t.meta.terminalNodes[0]-1,o=t.meta.rNodes[0]-1;S(t,-s[i],-n[i]);const r=A(s[o],n[o]),a=e.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");b(t.atoms,Math.PI-r+a);const l=function(t,e){return u(Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2))}({x:s[t.meta.rNodes[0]-1],y:n[t.meta.rNodes[0]-1]},{x:s[t.meta.terminalNodes[0]-1],y:n[t.meta.terminalNodes[0]-1]});if(1!=l)for(let t=0;t<s.length;++t)s[t]=u(s[t]/l),n[t]=u(n[t]/l)}(y,i),function(t,e,s){"PEPTIDE"===t?(f(e,t),C(e,e.meta.rNodes[1])):s===c.RIBOSE||s===c.DEOXYRIBOSE?(C(e,e.meta.rNodes[1]),e.meta.rNodes[1]=e.meta.terminalNodes[1],g(e.bonds,e.meta),f(e,t),C(e,e.meta.rNodes[1]),C(e,e.meta.rNodes[0]),C(e,e.meta.rNodes[2])):s===c.PHOSPHATE&&(e.meta.terminalNodes[0]=e.meta.rNodes[0],S(e,-e.atoms.x[e.meta.terminalNodes[0]-1],-e.atoms.y[e.meta.terminalNodes[0]-1]),f(e,t),C(e,e.meta.rNodes[1]))}(n,y,t),function(t){let e=0;for(;e<t.atoms.atomTypes.length;)t.atoms.atomTypes[e]===c.HYDROGEN&&(C(t,e+1),--e),++e}(y),y}return null}(e,s,n,i,o);if(!r)throw new Error(`Monomer with symbol '${e}' is absent the monomer library`);t.set(e,r)}}function p(t,e,s,n){const i={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(t,e,s){for(const[n,i]of s)t.atomTypes[n-1]=e[i-1]}(t,s,n),function(t,e){e.rNodes=Array.from(t.keys());for(let s=0;s<e.rNodes.length;s++)for(const n of[1,2])if(t.get(e.rNodes[s])===n){const t=e.rNodes[n-1];e.rNodes[n-1]=e.rNodes[s],e.rNodes[s]=t}}(n,i),g(e,i),i}function g(t,e){const s=e.rNodes;e.terminalNodes=new Array(s.length).fill(0);const n=e.terminalNodes,i=t.atomPairs;let o=0,r=0;for(;o<i.length&&r<n.length;){for(let t=0;t<n.length;++t)for(let e=0;e<2;++e)i[o][e]===s[t]&&(n[t]=i[o][(e+1)%2],s.length,++r);++o}}function f(t,e){t.meta.rNodes.length>1&&(t.meta.backboneShift=y(t,t.meta.rNodes[1]-1,t.meta.terminalNodes[0]-1)),"RNA"===e&&t.meta.rNodes.length>2&&(t.meta.branchShift=y(t,t.meta.rNodes[2]-1,t.meta.terminalNodes[0]-1))}function y(t,e,s){return[u(t.atoms.x[e]-t.atoms.x[s]),u(t.atoms.y[e]-t.atoms.y[s])]}function C(t,e){if(void 0!==e){const s=e-1,n=t.atoms,i=t.bonds,o=t.meta;n.atomTypes.splice(s,1),n.x=T(Float32Array,n.x,s,1),n.y=T(Float32Array,n.y,s,1),n.kwargs.splice(s,1);for(let t=0;t<o.terminalNodes.length;++t)o.terminalNodes[t]>e?--o.terminalNodes[t]:o.terminalNodes[t]===e&&(o.terminalNodes[t]=-1);for(let t=0;t<o.rNodes.length;++t)o.rNodes[t]>e?--o.rNodes[t]:o.rNodes[t]===e&&(o.rNodes[t]=-1);let r=0;for(;r<i.atomPairs.length;){const t=i.atomPairs[r][0],s=i.atomPairs[r][1];t===e||s===e?(i.atomPairs.splice(r,1),i.bondTypes=T(Uint32Array,i.bondTypes,r,1),i.bondConfiguration.has(r)&&i.bondConfiguration.delete(r),i.kwargs.has(r)&&i.kwargs.delete(r),--r):(i.atomPairs[r][0]=t>e?t-1:t,i.atomPairs[r][1]=s>e?s-1:s),++r}let a=Array.from(i.bondConfiguration.keys());a.forEach((t=>{if(i.bondConfiguration.has(t)&&t>s){const e=i.bondConfiguration.get(t);i.bondConfiguration.delete(t),i.bondConfiguration.set(t-1,e)}})),a=Array.from(i.kwargs.keys()),a.forEach((t=>{if(i.kwargs.has(t)&&t>s){const e=i.kwargs.get(t);i.kwargs.delete(t),i.kwargs.set(t-1,e)}}))}}function T(t,e,s,n){const i=new t(e.length-n);let o=0,r=0;for(;o<e.length;)o===s&&(o+=n),i[r]=e[o],++r,++o;return i}function A(t,e){let s;if(0===t)s=e>0?0:Math.PI;else if(0===e)s=t>0?-Math.PI/2:Math.PI/2;else{const n=e/t,i=Math.atan(n);s=t<0?Math.PI/2+i:-Math.PI/2+i}return s}function b(t,e){if(0!==e){const s=t.x,n=t.y,i=Math.cos(e),o=Math.sin(e);for(let t=0;t<s.length;++t){const e=s[t];s[t]=u(e*i-n[t]*o),n[t]=u(e*o+n[t]*i)}}}function w(t,e){if(e){const e=t.atoms.y;for(let t=0;t<e.length;t++)e[t]=-e[t]}else{const e=t.atoms.x;for(let t=0;t<e.length;t++)e[t]=-e[t]}const s=t.bonds.bondConfiguration;for(const[t,e]of s){const n=1===e?3:1;s.set(t,n)}}function S(t,e,s){const n=t.atoms.x,i=t.atoms.y;for(let t=0;t<n.length;++t)n[t]=u(n[t]+e),void 0!==s&&(i[t]=u(i[t]+s))}},6137:(t,e,s)=>{"use strict";s.d(e,{J:()=>i,V:()=>o});var n=s(9976);class i extends n.B{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new i({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class o{}o.SemType="Nucleotides",o.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",o.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},9976:(t,e,s)=>{"use strict";s.d(e,{B:()=>n});class n{static makePalette(t,e=!1,s=n){const i={};return t.forEach((t=>{const s=t[0],n=t[1];s.forEach(((t,s)=>{i[t]=this.colourPalette[n][e?0:s]}))})),new s(i)}constructor(t){this._palette=t}get(t){return this._palette[t]}}n.undefinedColor="rgb(100,100,100)",n.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]}},7331:(t,e,s)=>{"use strict";s.d(e,{UE:()=>c,kQ:()=>r});var n=s(976),i=s(9976);class o{static hashCode(t){let e=0;if(0===t.length)return e;for(let s=0;s<t.length;s++)e=(e<<5)-e+t.charCodeAt(s),e|=0;return e}}class r{}class a extends r{get(t){return"#666666"}}class l extends r{static buildPalette(){return[].concat(...Object.values(i.B.colourPalette))}get(t){const e=o.hashCode(t)%l.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=n.Color.fromHtml(t),s=n.Color.g(e),i=n.Color.r(e),o=n.Color.b(e),r=Math.sqrt(Math.pow(0-i,2)+Math.pow(0-s,2)+Math.pow(0-o,2));return r>210?`rgb(${i/r*210},${s/r*210},${o/r*210})`:n.Color.toRgb(e)}(l.palette[e])}}l.palette=l.buildPalette();class c extends i.B{static get Gray(){return void 0===this.gray&&(this.gray=new a),this.gray}static get Color(){return void 0===this.color&&(this.color=new l),this.color}}},9611:(t,e,s)=>{"use strict";s.d(e,{A:()=>c});var n=s(4469),i=s(976),o=s(6414),r=s.n(o),a=s(8447);const l={DNA:"RNA",RNA:"RNA",PT:"PEPTIDE",UN:"PEPTIDE"};class c{get updated(){return this._updated}constructor(t,e,s){this.grid=t,this.col=e,this.propsProvider=s,this._monomerLengthList=null,this.separatorWidth=5,this._updated=!1,this._monomerLengthMap={},this._monomerStructureMap={},this.subs=[],this._splitter=(0,a.Mj)(this.col),this.props=this.propsProvider(),this._rowsProcessed=i.BitSet.create(this.col.length),this.grid&&(this.subs.push(e.dataFrame.onDataChanged.subscribe((()=>{this.props=this.propsProvider(),this._monomerLengthList=null,this._rowsProcessed=i.BitSet.create(this.col.length)}))),this.subs.push(n.events.onViewRemoved.subscribe((t=>{this.grid?.view?.id===t.id&&this.destroy()}))))}destroy(){for(const t of this.subs)t.unsubscribe()}getCellMonomerLengths(t){const e=this.props.unitsHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(t),s=new Array(e.length+1);s[0]=5;for(let t=1;t<s.length;t++)s[t]=s[t-1]+e[t-1];return[e,s]}getCellMonomerLengthsForSeq(t){null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.col.length).fill(null),this._updated=!0);let e=this._monomerLengthList[t];if(null===e){const s=this.getSeqMonList(t);e=this._monomerLengthList[t]=new Array(s.length);for(const[t,n]of r().enumerate(s)){const s=this.props.monomerToShort(t,this.props.monomerLengthLimit),i=(this.props.unitsHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+s.length*this.props.monomerCharWidth;e[n]=i}this._updated=!0}return e}getCellMonomerLengthsForSeqMsa(){var t;null===this._monomerLengthList&&(this._monomerLengthList=new Array(1).fill(null),this._updated=!0),(t=this._monomerLengthList)[0]??(t[0]=new Array(0));const e=this._monomerLengthList[0],s=Math.max(Math.floor((this.grid?.vertScroll.min??0)-10),0),n=Math.min(Math.ceil((this.grid?.vertScroll.max??0)+10),this.col.length);for(let t=s;t<n;t++){if(this._rowsProcessed.get(t))continue;const s=this.getSeqMonList(t);s.length>e.length&&e.push(...new Array(s.length-e.length).fill(0));for(const[t,n]of r().enumerate(s)){const s=this.props.monomerToShort(t,this.props.monomerLengthLimit),i=this.props.separatorWidth+s.length*this.props.monomerCharWidth;e[n]=Math.max(e[n]??0,i)}this._updated=!0}return e}getPosition(t,e){const[s,n]=this.getCellMonomerLengths(t),i=this.col.get(t),o=r()(this._splitter(i)).toArray();if(0===o.length)return null;let a=100,l=null,c=o.length,h=!1,u=0;if(n[0]<=e&&e<n.slice(-1)[0])for(;!h;)if(u=Math.floor((c+(l??0))/2),e>=n[u]&&e<=n[u+1]?(l=u,h=!0):e<n[u]?c=u-1:e>n[u+1]&&(l=u+1),l==c&&(h=!0),--a<=0)throw new Error(`Get position for pointer x = ${e} searching has not converged on ${JSON.stringify(n)}. `);return l}getSeqMonList(t){const e=this.col.get(t);return e?r()(this._splitter(e)).toArray():[]}getMonomer(t){const e=this.props.unitsHandler.alphabet??"UN",s=l[e];return this.props.monomerLib?.getMonomer(s,t)??null}setMonomerLengthLimit(t){this.props.monomerLengthLimit=t,this._updated=!0}setSeparatorWidth(t){this.props.separatorWidth=t,this._updated=!0}isMsa(){return this.props.unitsHandler.isMsa()}}},1047:(t,e,s)=>{"use strict";s.d(e,{$3:()=>c,At:()=>i,K4:()=>a,Wc:()=>o,Z2:()=>l,nJ:()=>r,pU:()=>h,rx:()=>n});const n=["symbol","molfile","rgroups","name"],i="MonomerName",o={symbol:"Short Name",name:"Medium Name",smiles:"SMILES"},r=[{capGroupSmiles:"[*:1][H]",alternateId:"R1-H",capGroupName:"H",label:"R1"},{capGroupSmiles:"O[*:2]",alternateId:"R2-OH",capGroupName:"OH",label:"R2"},{capGroupSmiles:"[*:3][H]",alternateId:"R3-H",capGroupName:"H",label:"R3"}],a={monomerType:null,smiles:null,name:"MonomerName",author:null,molfile:"molecule",naturalAnalog:"MonomerNaturalAnalogCode",rgroups:"MonomerCaps",createDate:null,id:null,polymerType:"MonomerType",symbol:"MonomerCode"},l={monomerType:"Backbone",smiles:"",name:"",author:"Datagrok",molfile:"",naturalAnalog:"",rgroups:[],createDate:null,id:0,polymerType:"PEPTIDE",symbol:""},c="p",h=new RegExp(`[rd]\\((\\w)\\)${c}?`,"g")},7945:(t,e,s)=>{"use strict";function n(t){return"string"==typeof t||t instanceof String?t:"StateError"===t.constructor.name?t.message:"StateError"===t.constructor.name&&"$thrownJsError"in t?n(t.$thrownJsError):t instanceof Error?t.message:t.toString()}function i(t){return t instanceof Error?t.stack:"StateError"===t.constructor.name&&"$thrownJsError"in t?i(t.$thrownJsError):void 0}function o(t){return[n(t),i(t)]}s.d(e,{yf:()=>o})},5226:(t,e,s)=>{"use strict";s.d(e,{i:()=>r});var n=s(976),i=s(499),o=s(1821);class r{get descriptionsArray(){return this._descriptionsArray}get sequencesArray(){return this._sequencesArray}parseMacromolecule(t,e){return this._fileContent.slice(t,e).split(/\s/).join("")}parseColumns(){const t=/^>(.*)$/gm;let e,s=0;for(;e=t.exec(this._fileContent);){const n=this._fileContent.substring(e.index+1,t.lastIndex);this._descriptionsArray.push(n),0!==s&&this._sequencesArray.push(this.parseMacromolecule(s,e.index)),s=t.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(s,-1))}importFasta(){const t=n.Column.fromStrings("description",this.descriptionsArray),e=n.Column.fromStrings("sequence",this.sequencesArray);return e.semType=n.SEMTYPE.MACROMOLECULE,e.setTag(n.TAGS.UNITS,o.r2.FASTA),i.Cn.getOrCreate(e),[n.DataFrame.fromColumns([t,e])]}constructor(t){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=t,this.parseColumns()}}},1821:(t,e,s)=>{"use strict";s.d(e,{BM:()=>r,CI:()=>o,XS:()=>l,r2:()=>n,se:()=>a});var n,i=s(6286);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm"}(n||(n={}));const o=", ",r=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,a=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},l=[new i.L("PT",a.fasta.peptide,.5),new i.L("DNA",a.fasta.dna,.55),new i.L("RNA",a.fasta.rna,.55)]},8447:(t,e,s)=>{"use strict";s.d(e,{CI:()=>n.CI,GU:()=>i.GU,KX:()=>i.KX,Mj:()=>i.Mj,XS:()=>n.XS,dQ:()=>i.dQ,gM:()=>i.gM,gP:()=>i.gP,kB:()=>i.kB,py:()=>i.py,r2:()=>n.r2,up:()=>i.up});var n=s(1821),i=s(8260)},6286:(t,e,s)=>{"use strict";s.d(e,{L:()=>n,d:()=>i});class n{constructor(t,e,s){this.name=t,this.alphabet=e,this.cutoff=s}}class i extends n{constructor(t,e,s){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=s}}},8260:(t,e,s)=>{"use strict";s.d(e,{w4:()=>L,gM:()=>v,KX:()=>x,py:()=>N,vU:()=>b,Mj:()=>w,Ar:()=>y,jY:()=>p,GU:()=>E,dQ:()=>M,up:()=>_,kB:()=>g,FJ:()=>f,gP:()=>A});var n=s(976),i=s(6414),o=s.n(i),r=s(6286),a=s(1821),l=s(499);class c extends Float32Array{}var h=s(850),u=s(2012),d=s(6137),m=s(7331);function p(t,e,s){return t.categories,function(t,e){const s={};let n=!0,i=null;for(const o of t)if(null==i?i=o.length:o.length!==i&&(n=!1),o.length>=e)for(const t of o)t in s||(s[t]=0),s[t]+=1;return{freq:s,sameLength:n}}(o()(t.getRawData()).map((e=>s(t.categories[e]))),e)}function g(t){return o()(t.toString().matchAll(a.BM)).map((t=>t[2]??t[1])).toArray()}function f(t){return t||[]}function y(t,e=undefined){return s=>s?s.replaceAll('"-"',"").replaceAll("'-'","").split(t,e):[]}const C=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,T=/\[([^\[\]]+)]/g;function A(t){C.lastIndex=0;const e=C.exec(t.toString()),s=e?e[2]:null;return(s?s.split("."):[]).map((t=>{T.lastIndex=0;const e=T.exec(t);return e&&e.length>=2?e[1]:t}))}function b(t,e,s=undefined){if(t.toLowerCase().startsWith(a.r2.FASTA))return g;if(t.toLowerCase().startsWith(a.r2.SEPARATOR))return y(e,s);if(t.toLowerCase().startsWith(a.r2.HELM))return A;throw new Error(`Unexpected units ${t} .`)}function w(t){return l.Cn.getOrCreate(t).getSplitter()}const S=/([^\W_]+)/g;function E(t,e){if(t.length<=e)return t;const s=t.match(S),n=t.length>e||(s?.length??0)>1,i=s?.[0]??" ";return n?i.substring(0,e-1)+"…":i}function v(t){switch(t){case"DNA":return a.se.fasta.dna;case"RNA":return a.se.fasta.rna;case"PT":return a.se.fasta.peptide;default:throw new Error(`Unsupported alphabet '${t}'.`)}}function x(t,e,s="-"){const n=new Set([...new Set(Object.keys(t)),...e]);n.delete(s);const i=[],o=[];for(const s of n)i.push(s in t?t[s]:0),o.push(e.has(s)?1:0);const r=new c(i),a=new c(o);return(0,h.MA)(r,a)/((0,h.$G)(r)*(0,h.$G)(a))}function L(t,e,s="-"){const n=e.map((e=>{const n=x(t,e.alphabet,s);return new r.d(e,t,n)}));let i;const o=Math.max(...n.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return i=o>0?n.find((t=>t.similarity===o)).name:"UN",i}function M(t,e=5){let s;return s=t.semType==n.SEMTYPE.MACROMOLECULE?l.Cn.getOrCreate(t).alphabet:L(p(t,e,g).freq,a.XS),N(s)}function N(t){switch(t){case"PT":return u.f.GrokGroups;case"DNA":case"RNA":return d.J.Chromatogram;default:return m.UE.Color}}function _(t){const e=t.columns.bySemTypeAll(n.SEMTYPE.MACROMOLECULE);let s=e.find((t=>{const e=t.getTag(n.TAGS.UNITS);return!!e&&-1!==e.indexOf("MSA")}))??null;return!s&&e.length>0&&(s=e[0]),s}},8457:(t,e,s)=>{"use strict";s.d(e,{O:()=>a});var n=s(976),i=s(6414),o=s.n(i),r=s(8260);function a(t){const e=(0,r.Mj)(t),s=t=>{const e=l.columns.addNewString((t+1).toString());return i.push(e),e},i=[],a=t.length,l=n.DataFrame.create(a);for(let n=0;n<a;++n){const r=t.get(n);if(null==r)continue;const a=e(r);for(const[t,e]of o().enumerate(a))((i[e]??null)||s(e)).set(n,t||"-",!1)}return l}},172:(t,e,s)=>{"use strict";s.d(e,{c:()=>o});var n,i=s(7945);!function(t){t[t.error=0]="error",t[t.warning=1]="warning",t[t.info=2]="info",t[t.debug=3]="debug"}(n||(n={}));class o{constructor(t){this.logger=t,this.promise=Promise.resolve(),this.syncCounter=0}sync(t,e){const s=++this.syncCounter;this.logger.debug(`${t}, SYNC syncId = ${s}, IN `),this.promise=this.promise.then((async()=>{this.logger.debug(`${t}, SYNC syncId = ${s}, START `),await e(),this.logger.debug(`${t}, SYNC syncId = ${s}, END `)})).catch((e=>{const[n,o]=(0,i.yf)(e);this.logger.error(`${t}, SYNC syncId = ${s}, ERROR:\n${n}`,void 0,o)}))}}},499:(t,e,s)=>{"use strict";s.d(e,{Cn:()=>m,_9:()=>d});var n=s(976),i=s(6414),o=s.n(i),r=s(8447),a=s(8260),l=s(708),c=s(7228),h=s(1047);const u=new class{constructor(){this.uh=`units-handler.${n.SEMTYPE.MACROMOLECULE}`}},d={[r.r2.FASTA]:"-",[r.r2.SEPARATOR]:"",[r.r2.HELM]:"*"};class m{static setUnitsToFastaColumn(t){if(t.column.semType!==n.SEMTYPE.MACROMOLECULE||t.column.getTag(n.TAGS.UNITS)!==r.r2.FASTA)throw new Error(`The column of notation '${r.r2.FASTA}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);t.column.setTag(n.TAGS.UNITS,r.r2.FASTA),m.setTags(t)}static setUnitsToSeparatorColumn(t,e){if(t.column.semType!==n.SEMTYPE.MACROMOLECULE||t.column.getTag(n.TAGS.UNITS)!==r.r2.SEPARATOR)throw new Error(`The column of notation '${r.r2.SEPARATOR}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error(`The column of notation '${r.r2.SEPARATOR}' must have the separator tag.`);t.column.setTag(n.TAGS.UNITS,r.r2.SEPARATOR),t.column.setTag("separator",e),m.setTags(t)}static setUnitsToHelmColumn(t){if(t.column.semType!==n.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${r.r2.HELM}' must be '${n.SEMTYPE.MACROMOLECULE}'`);t.column.setTag(n.TAGS.UNITS,r.r2.HELM),m.setTags(t)}static setTags(t){const e=t.column.getTag(n.TAGS.UNITS),s=t.stats;if(Object.keys(s.freq).some((t=>t.length>1)),[r.r2.FASTA,r.r2.SEPARATOR].includes(e)){if(!t.column.getTag("alphabet")&&0===Object.keys(s.freq).length)throw new Error("Alphabet is empty and not annotated.");let e=t.column.getTag("aligned");null===e&&(e=s.sameLength?"SEQ.MSA":"SEQ",t.column.setTag("aligned",e));let n=t.column.getTag("alphabet");if(null===n&&(n=(0,a.w4)(s.freq,r.XS),t.column.setTag("alphabet",n)),"UN"===n){const e=Object.keys(s.freq).length,n=Object.keys(s.freq).some((t=>t.length>1));t.column.setTag(".alphabetSize",e.toString()),t.column.setTag(".alphabetIsMultichar",n?"true":"false")}}}get column(){return this._column}get units(){return this._units}get notation(){return this._notation}get defaultGapSymbol(){return this._defaultGapSymbol}get separator(){const t=this.column.getTag("separator")??void 0;if(this.notation===r.r2.SEPARATOR&&void 0===t)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return t}get aligned(){const t=this.column.getTag("aligned");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return t}get alphabet(){const t=this.column.getTag("alphabet");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return t}get helmCompatible(){return this.column.getTag(".isHelmCompatible")}getAlphabetSize(){if(this.notation==r.r2.HELM||"UN"==this.alphabet){const t=this.column.getTag(".alphabetSize");let e;if(t)e=parseInt(t);else{const t=this.stats;e=Object.keys(t.freq).length}return e}switch(this.alphabet){case"PT":return 20;case"DNA":case"RNA":return 4;case"NT":return console.warn("Unexpected alphabet 'NT'."),4;default:throw new Error(`Unexpected alphabet '${this.alphabet}'.`)}}getAlphabetIsMultichar(){return this.notation===r.r2.HELM||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}get splitted(){if(null===this._splitted){const t=this.getSplitter(),e=this._column.length;this._splitted=new Array(e);const s=this._column.getRawData(),n=this._column.categories;for(let i=0;i<e;i++){const e=n[s[i]];this._splitted[i]=t(e)}}return this._splitted}get stats(){if(null===this._stats){const t={};let e=!0,s=null;for(const n of this.splitted){null==s?s=n.length:n.length!==s&&(e=!1);for(const e of n)e in t||(t[e]=0),t[e]+=1}this._stats={freq:t,sameLength:e}}return this._stats}get maxLength(){return null===this._maxLength&&(this._maxLength=0===this.splitted.length?0:Math.max(...this.splitted.map((t=>t.length)))),this._maxLength}get posList(){if(null===this._posList){const t=this.column.getTag(".positionNames");this._posList=t?t.split(r.CI).map((t=>t.trim())):o().count(1).take(this.maxLength).map((t=>t.toString())).toArray()}return this._posList}isFasta(){return this.notation===r.r2.FASTA}isSeparator(){return this.notation===r.r2.SEPARATOR}isHelm(){return this.notation===r.r2.HELM}isRna(){return"RNA"===this.alphabet}isDna(){return"DNA"===this.alphabet}isPeptide(){return"PT"===this.alphabet}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}isGap(t){return!t||this.units===r.r2.FASTA&&t===d[r.r2.FASTA]||this.units===r.r2.HELM&&t===d[r.r2.HELM]}getNotation(){if(this.units.toLowerCase().startsWith(r.r2.FASTA))return r.r2.FASTA;if(this.units.toLowerCase().startsWith(r.r2.SEPARATOR))return r.r2.SEPARATOR;if(this.units.toLowerCase().startsWith(r.r2.HELM))return r.r2.HELM;throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getHelmWrappers(){return[this.isDna()||this.isRna()||this.isHelmCompatible()?"RNA1{":"PEPTIDE1{",this.isDna()?"d(":this.isRna()?"r(":"",this.isDna()||this.isRna()?")p":"","}$$$$"]}getNewColumn(t,e,s,i){const o=this.column,a=t.toLowerCase()+"("+o.name+")",l=s??o.dataFrame.columns.getUnusedName(a),c=n.Column.fromList("string",l,i??new Array(this.column.length).fill(""));if(c.semType=n.SEMTYPE.MACROMOLECULE,c.setTag(n.TAGS.UNITS,t),t===r.r2.SEPARATOR){if(!e)throw new Error(`Notation '${r.r2.SEPARATOR}' requires separator value.`);c.setTag("separator",e)}c.setTag(n.TAGS.CELL_RENDERER,"Macromolecule");const h=o.getTag("aligned");h&&c.setTag("aligned",h);const u=o.getTag("alphabet");null!=u&&c.setTag("alphabet",u);let d=o.getTag(".alphabetSize");null!=u&&d&&c.setTag(".alphabetSize",d);const m=o.getTag(".alphabetIsMultichar");return null!=u&&void 0!==m&&c.setTag(".alphabetIsMultichar",m),t==r.r2.HELM&&(d=this.getAlphabetSize().toString(),c.setTag(".alphabetSize",d)),c}getNewColumnFromList(t,e){return this.getNewColumn(this.notation,this.separator,t,e)}static getNewColumn(t){const e=m.getOrCreate(t),s=e.notation;return e.getNewColumn(s)}static unitsStringIsValid(t){return t=t.toLowerCase(),[r.r2.FASTA,r.r2.SEPARATOR,r.r2.HELM].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,s){if(!m.unitsStringIsValid(s))throw new Error("Invalid format of 'units' parameter");const i=n.Column.fromList("string",e,new Array(t).fill(""));return i.semType=n.SEMTYPE.MACROMOLECULE,i.setTag(n.TAGS.UNITS,s),i}getSplitter(t){if(this.units.toLowerCase().startsWith(r.r2.FASTA))return null===this.column.getTag("alphabet")||this.getAlphabetIsMultichar()?a.kB:a.FJ;if(this.units.toLowerCase().startsWith(r.r2.SEPARATOR))return(0,a.Ar)(this.separator,t);if(this.units.toLowerCase().startsWith(r.r2.HELM))return a.gP;throw new Error(`Unexpected units ${this.units} .`)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");return this.isMsa()?l.U.HAMMING:(this.alphabet,l.U.LEVENSHTEIN)}getDistanceFunction(){return l.o[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const t=(await(0,c.JN)()).getBioLib().getMonomerSymbolsByType("PEPTIDE".toString()),e=new Set(t),s=(0,a.Ar)(this.separator);for(const t of this.column.categories){const n=s(t);for(const t of n)if(!e.has(t))return this.column.setTag(".isHelmCompatible","false"),!1}return this.column.setTag(".isHelmCompatible","true"),!0}get splitter(){return null===this._splitter&&(this._splitter=(0,a.Mj)(this.column)),this._splitter}toFasta(t){return t===r.r2.FASTA}toSeparator(t){return t===r.r2.SEPARATOR}toHelm(t){return t===r.r2.HELM}convertHelmToFastaSeparator(t,e,s,n){n||(n=this.toFasta(e)?d[r.r2.FASTA]:d[r.r2.SEPARATOR]),s||(s=this.toFasta(e)?"":this.separator);const i=t.startsWith("RNA"),o=this.splitter(t),a=[];for(let t=0;t<o.length;t++){let s=o[t];if(i&&(s=s.replace(h.pU,"")),s===d[r.r2.HELM])a.push(n);else if(this.toFasta(e)&&s.length>1){const t="["+s+"]";a.push(t)}else a.push(s)}return a.join(s)}convert(t,e){const s=this.getConverter(t,e),n=this.getNewColumn(t,e);return n.init((t=>s(this.column.get(t)))),n}getRegion(t,e,s){const n=this.getNewColumn(this.notation,this.separator);n.name=s,Math.max(...this.splitted.map((t=>t.length)));const i=t??0,o=e??this.maxLength-1,a=this.getJoiner(),l=o-i+1;n.init((t=>{const e=this.splitted[t],s=new Array(l);for(let t=0;t<l;++t){const n=i+t;s[t]=n<e.length?e[n]:d[this.notation]}return a(s)}));const c=t=>{const e=t.split(",").map((t=>t.trim())),s=new Array(l);for(let t=0;t<l;++t){const n=i+t;s[t]=n<e.length?e[n]:"?"}return s.join(r.CI)},h=this.column.getTag(".positionNames");h&&n.setTag(".positionNames",c(h));const u=this.column.getTag(".positionLabels");return u&&n.setTag(".positionLabels",c(u)),n}getJoiner(){if(void 0===this._joiner){const t=this;if(this.notation===r.r2.FASTA)this._joiner=function(e){return p(t,e)};else if(this.notation===r.r2.SEPARATOR)this._joiner=function(e){return g(t,e,t.separator)};else{if(this.notation!==r.r2.HELM)throw new Error;{const e="DNA"===t.alphabet||"RNA"===t.alphabet;this._joiner=function(s){return f(t,s,e)}}}}return this._joiner}getConverter(t,e=undefined){if(t===r.r2.SEPARATOR&&!e)throw new Error(`Target separator is not specified for target units '${r.r2.SEPARATOR}'.`);const s=this;if(t===r.r2.FASTA)return function(t){return function(t,e){const s=t.isHelm()?y(t,e):t.getSplitter()(e);return p(t,s)}(s,t)};if(t===r.r2.HELM)return function(t){return function(t,e){const s=e.startsWith("DNA")||e.startsWith("RNA"),n=t.getSplitter()(e);return f(t,n,s)}(s,t)};if(t===r.r2.SEPARATOR)return function(t){return function(t,e,s){const n=t.isHelm()?y(t,e):t.getSplitter()(e);return g(t,n,s)}(s,t,e)};throw new Error}constructor(t){if(this._splitter=null,this._splitted=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,t.type!==n.TYPE.STRING)throw new Error(`Unexpected column type '${t.type}', must be '${n.TYPE.STRING}'.`);this._column=t;const e=this._column.getTag(n.TAGS.UNITS);if(null==e)throw new Error("Units are not specified in column");if(this._units=e,this._notation=this.getNotation(),this._defaultGapSymbol=this.isFasta()?d[r.r2.FASTA]:this.isHelm()?d[r.r2.HELM]:d[r.r2.SEPARATOR],!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())m.setUnitsToFastaColumn(this);else if(this.isSeparator()){const e=t.getTag("separator");m.setUnitsToSeparatorColumn(this,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(n.TAGS.UNITS)}'.`);m.setUnitsToHelmColumn(this)}if(!this.column.tags.has(".alphabetIsMultichar"))if(this.isHelm())this.column.setTag(".alphabetIsMultichar","true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '.alphabetIsMultichar' is mandatory.`)}static getOrCreate(t){let e=t.temp[u.uh];return e||(e=t.temp[u.uh]=new m(t)),e}}function p(t,e){const s=new Array(e.length);for(const[n,i]of o().enumerate(e)){let o=n;t.isHelm()&&(o=n.replace(h.pU,"$1")),t.isGap(o)?o=d[r.r2.FASTA]:o.length>1&&(o="["+e[i]+"]"),s[i]=o}return s.join("")}function g(t,e,s){const n=new Array(e.length);for(const[s,i]of o().enumerate(e)){let e=s;t.isGap(e)&&(e=d[r.r2.SEPARATOR]),n[i]=e}return n.map((t=>t??"")).join(s)}function f(t,e,s){const[n,i,a,l]=t.getHelmWrappers();return`${n}${o()(e).map((e=>{let n=e;return n=t.isGap(n)?d[r.r2.HELM]:s?n.replace(h.pU,"$1"):1==e.length?`${i}${e}${a}`:`${i}[${e}]${a}`,n})).toArray().join(".")}${l}`}function y(t,e){const s=t.getSplitter()(e),n=new Array(s.length),i=e.startsWith("DNA"),r=e.startsWith("RNA");for(const[t,e]of o().enumerate(s)){let s=t;(i||r)&&(s=s.replace(h.pU,"$1"),s=s===h.$3?null:s),n[e]=s}return n.filter((t=>null!==t))}},9298:(t,e,s)=>{"use strict";s.d(e,{Ct:()=>l,DX:()=>n,ES:()=>i,dE:()=>a,iD:()=>r,vS:()=>h,vw:()=>o});var n,i,o,r,a,l,c=s(976);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(n||(n={})),function(t){t.Entropy="Entropy",t.full="100%"}(i||(i={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(o||(o={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(r||(r={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(a||(a={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(l||(l={}));const h=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=c.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=i.Entropy,this.positionWidth=16,this.verticalAlignment=o.MIDDLE,this.horizontalAlignment=r.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},922:(t,e,s)=>{"use strict";s.d(e,{_:()=>l});class n{constructor(t){this.init(t)}init(t){this.fileContent=t.replace(/\r/g,""),this._atomCount=void 0,this._atomTypes=void 0,this._bondCount=void 0,this._bondTypes=void 0,this.xyzAtomCoordinates=void 0,this._pairsOfBondedAtoms=void 0}get atomCount(){return void 0===this._atomCount&&this.setAtomAndBondCounts(),this._atomCount}get bondCount(){return void 0===this._bondCount&&this.setAtomAndBondCounts(),this._bondCount}get x(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var t;return null!==(t=this._atomTypes)&&void 0!==t||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var t;return null!==(t=this._pairsOfBondedAtoms)&&void 0!==t||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var t;return null!==(t=this._bondTypes)&&void 0!==t||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:t,bondCount:e}=this.parseAtomAndBondCounts();this._atomCount=t,this._bondCount=e}getNextColumnIdx(t){for(;!this.isWhitespace(t);)++t;for(;this.isWhitespace(t);)++t;return t}shiftIdxToSpecifiedColumn(t,e){let s=t;const n=this.isWhitespace(s)?e:e-1;for(let t=0;t<n;t++)s=this.getNextColumnIdx(s);return s}parseAtomTypes(){const t=this.atomCount,e=new Array(t);let s=this.getAtomBlockIdx();for(let n=0;n<t;n++)s=this.shiftIdxToAtomType(s),e[n]=this.parseAtomType(s),s=this.getNextLineIdx(s);return e}parseAtomCoordinates(){const t=new Float32Array(this.atomCount),e=new Float32Array(this.atomCount),s=new Float32Array(this.atomCount);let n=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){n=this.shiftIdxToXColumn(n);for(const o of[t,e,s])o[i]=this.parseFloatValue(n),n=this.getNextColumnIdx(n);n=this.getNextLineIdx(n)}return{x:t,y:e,z:s}}parseBondedAtomPairs(){const t=new Array(this.bondCount);let e=this.getBondBlockIdx();for(let s=0;s<this.bondCount;s++){e=this.shiftIdxToBondedAtomsPair(e);const n=new Uint16Array(2);n[0]=this.parseIntValue(e),e=this.getNextColumnIdx(e),n[1]=this.parseIntValue(e),t[s]=n,e=this.getNextLineIdx(e)}return t}parseBondTypes(){const t=this.bondCount,e=new Uint16Array(t);let s=this.getBondBlockIdx();for(let n=0;n<t;n++)s=this.shiftIdxToBondType(s),e[n]=this.parseIntValue(s),s=this.getNextLineIdx(s);return e}isWhitespace(t){const e=this.fileContent[t];return" "===e||"\t"===e}getNextLineIdx(t){return"\n"!==this.fileContent[t]?this.fileContent.indexOf("\n",t)+1:t+1}parseFloatValue(t){return this.parseNumericValue(parseFloat,t)}parseIntValue(t){return this.parseNumericValue(parseInt,t)}parseNumericValue(t,e){let s=e+1;for(;!this.isWhitespace(s);)++s;return t(this.fileContent.substring(e,s))}}class i extends n{constructor(t){super(t),this.init(t)}init(t){super.init(t)}parseAtomType(t){let e=t,s=e;return this.isQuote(e)?(s=this.getNextIdenticalChar(e),e++):s=this.fileContent.indexOf(" ",s),this.fileContent.substring(e,s)}isQuote(t){const e=this.fileContent[t].charCodeAt(0);return 39===e||34===e}getNextIdenticalChar(t){const e=this.fileContent[t];return e?this.fileContent.indexOf(e,t+1):-1}isQuery(){return this.isQueryOrFragment(((t,e)=>{return 39===t||34===t||76===t&&!((s=this.fileContent.charCodeAt(e+1))>64&&s<91||s>96&&s<123);var s}))}isFragment(){return this.isQueryOrFragment((t=>82===t||42===t))}isQueryOrFragment(t){const e=this.atomCount;let s=this.getAtomBlockIdx();for(let n=0;n<e;n++){if(s=this.shiftIdxToAtomType(s),t(this.fileContent.charCodeAt(s),s))return!0;s=this.getNextLineIdx(s)}return!1}}var o;!function(t){t.HEADER="V2000",t[t.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",t[t.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",t[t.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",t[t.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",t[t.BOND_TYPE_COL=3]="BOND_TYPE_COL",t[t.RGP_SHIFT=8]="RGP_SHIFT",t.RGP_LINE="M RGP",t.A_LINE="A ",t.END="M END"}(o||(o={}));class r extends i{constructor(t){super(t)}static validate(t){return-1!==t.indexOf(o.HEADER)&&-1!==t.indexOf(o.END)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,o.ATOM_TYPE_COL)}getCountsLineIdx(){let t=0;for(let e=0;e<o.NUM_OF_HEADER_LINES;++e)t=this.getNextLineIdx(t);return t}getAtomBlockIdx(){let t=this.getCountsLineIdx();return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){return this.getNextColumnIdx(t)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,o.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,o.BOND_TYPE_COL)}getBondBlockIdx(){let t=this.getAtomBlockIdx();for(let e=0;e<this.atomCount;e++)t=this.getNextLineIdx(t);return t}parseAtomAndBondCounts(){let t=this.getCountsLineIdx(),e=t+o.NUM_OF_COUNTS_DIGITS;const s=parseInt(this.fileContent.substring(t,e));return t=e,e+=o.NUM_OF_COUNTS_DIGITS,{atomCount:s,bondCount:parseInt(this.fileContent.substring(t,e))}}}class a extends i{constructor(t){super(t),this.init(t)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let t=this.fileContent.indexOf("M V30 BEGIN ATOM");return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){let e=this.shiftIdxToAtomType(t);return this.isQuote(e)?(e=this.getNextIdenticalChar(e),e=this.getNextColumnIdx(e),e):this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static validate(t){return-1!==t.indexOf("V3000")&&-1!==t.indexOf("M END")}parseAtomAndBondCounts(){let t=this.fileContent.indexOf("M V30 COUNTS ")+14,e=this.fileContent.indexOf(" ",t+1);const s=parseInt(this.fileContent.substring(t,e));return t=e+1,e=this.fileContent.indexOf(" ",t+1),{atomCount:s,bondCount:parseInt(this.fileContent.substring(t,e))}}}class l{constructor(){}static getInstance(t){if(r.validate(t))return new r(t);if(a.validate(t))return new a(t);throw new Error("Malformed molfile")}}},7905:(t,e,s)=>{"use strict";t=s.hmd(t);var n,i=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,s,i=void 0!==t?t:{};i.ready=new Promise((function(t,n){e=t,s=n}));var o,r=Object.assign({},i),a="object"==typeof window,l="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),n&&(c=n),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(o=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),i.print||console.log.bind(console);var h,u,d=i.printErr||console.warn.bind(console);Object.assign(i,r),r=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(h=i.wasmBinary),i.noExitRuntime,"object"!=typeof WebAssembly&&E("no native wasm support detected");var m,p,g,f=!1;function y(){var t=u.buffer;i.HEAP8=m=new Int8Array(t),i.HEAP16=new Int16Array(t),i.HEAP32=new Int32Array(t),i.HEAPU8=p=new Uint8Array(t),i.HEAPU16=new Uint16Array(t),i.HEAPU32=g=new Uint32Array(t),i.HEAPF32=new Float32Array(t),i.HEAPF64=new Float64Array(t)}var C=[],T=[],A=[],b=0,w=null,S=null;function E(t){i.onAbort&&i.onAbort(t),d(t="Aborted("+t+")"),f=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw s(e),e}var v,x,L="data:application/octet-stream;base64,";function M(t){return t.startsWith(L)}function N(t){try{if(t==v&&h)return new Uint8Array(h);if(o)return o(t);throw"both async and sync fetching of the wasm failed"}catch(t){E(t)}}function _(t,e,s){return function(t){return h||!a&&!l||"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(s,(function(t){d("failed to asynchronously prepare wasm: "+t),E(t)}))}function P(t){for(;t.length>0;)t.shift()(i)}function I(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){g[this.ptr+4>>2]=t},this.get_type=function(){return g[this.ptr+4>>2]},this.set_destructor=function(t){g[this.ptr+8>>2]=t},this.get_destructor=function(){return g[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){g[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return g[this.ptr+16>>2]},this.get_exception_ptr=function(){if(U(this.get_type()))return g[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function R(t){var e=u.buffer;try{return u.grow(t-e.byteLength+65535>>>16),y(),1}catch(t){}}function O(t){return i["_"+t]}M(v="wasmDbscan.wasm")||(x=v,v=i.locateFile?i.locateFile(x,c):c+x);var G="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function F(t,e,s,n,i){var o={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,s=0;s<t.length;++s){var n=t.charCodeAt(s);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++s):e+=3}return e}(t)+1,s=k(e);return function(t,e,s){!function(t,e,s,n){if(!(n>0))return 0;for(var i=s+n-1,o=0;o<t.length;++o){var r=t.charCodeAt(o);if(r>=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&t.charCodeAt(++o)),r<=127){if(s>=i)break;e[s++]=r}else if(r<=2047){if(s+1>=i)break;e[s++]=192|r>>6,e[s++]=128|63&r}else if(r<=65535){if(s+2>=i)break;e[s++]=224|r>>12,e[s++]=128|r>>6&63,e[s++]=128|63&r}else{if(s+3>=i)break;e[s++]=240|r>>18,e[s++]=128|r>>12&63,e[s++]=128|r>>6&63,e[s++]=128|63&r}}e[s]=0}(t,p,e,s)}(t,s,e),s}(t)),e},array:t=>{var e,s,n=k(t.length);return e=t,s=n,m.set(e,s),n}},r=O(t),a=[],l=0;if(n)for(var c=0;c<n.length;c++){var h=o[s[c]];h?(0===l&&(l=D()),a[c]=h(n[c])):a[c]=n[c]}var u=r.apply(null,a);return function(t){return 0!==l&&B(l),function(t){return"string"===e?(s=t)?function(t,e,s){for(var n=e+s,i=e;t[i]&&!(i>=n);)++i;if(i-e>16&&t.buffer&&G)return G.decode(t.subarray(e,i));for(var o="";e<i;){var r=t[e++];if(128&r){var a=63&t[e++];if(192!=(224&r)){var l=63&t[e++];if((r=224==(240&r)?(15&r)<<12|a<<6|l:(7&r)<<18|a<<12|l<<6|63&t[e++])<65536)o+=String.fromCharCode(r);else{var c=r-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&r)<<6|a)}else o+=String.fromCharCode(r)}return o}(p,s,n):"":"boolean"===e?Boolean(t):t;var s,n}(t)}(u)}var H,W={__cxa_throw:function(t,e,s){throw new I(t).init(e,s),t},abort:function(){E("")},emscripten_memcpy_big:function(t,e,s){p.copyWithin(t,e,e+s)},emscripten_resize_heap:function(t){var e,s=p.length,n=2147483648;if((t>>>=0)>n)return!1;for(var i=1;i<=4;i*=2){var o=s*(1+.2/i);if(o=Math.min(o,t+100663296),R(Math.min(n,(e=Math.max(t,o))+(65536-e%65536)%65536)))return!0}return!1}},D=(function(){var t,e,n,o,r={env:W,wasi_snapshot_preview1:W};function a(t,e){var s,n=t.exports;return i.asm=n,u=i.asm.memory,y(),i.asm.__indirect_function_table,s=i.asm.__wasm_call_ctors,T.unshift(s),function(t){if(b--,i.monitorRunDependencies&&i.monitorRunDependencies(b),0==b&&(null!==w&&(clearInterval(w),w=null),S)){var e=S;S=null,e()}}(),n}if(b++,i.monitorRunDependencies&&i.monitorRunDependencies(b),i.instantiateWasm)try{return i.instantiateWasm(r,a)}catch(t){d("Module.instantiateWasm callback failed with error: "+t),s(t)}(t=h,e=v,n=r,o=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||M(e)||"function"!=typeof fetch?_(e,n,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(o,(function(t){return d("wasm streaming compile failed: "+t),d("falling back to ArrayBuffer instantiation"),_(e,n,o)}))}))).catch(s)}(),i._dbscan=function(){return(i._dbscan=i.asm.dbscan).apply(null,arguments)},i._malloc=function(){return(i._malloc=i.asm.malloc).apply(null,arguments)},i._free=function(){return(i._free=i.asm.free).apply(null,arguments)},function(){return(D=i.asm.stackSave).apply(null,arguments)}),B=function(){return(B=i.asm.stackRestore).apply(null,arguments)},k=function(){return(k=i.asm.stackAlloc).apply(null,arguments)},U=function(){return(U=i.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function t(){H||(H=!0,i.calledRun=!0,f||(P(T),e(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)t=i.postRun.shift(),A.unshift(t);var t;P(A)}()))}b>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)t=i.preRun.shift(),C.unshift(t);var t;P(C)}(),b>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t()))}if(i.ccall=F,i.cwrap=function(t,e,s,n){var i=!s||s.every((t=>"number"===t||"boolean"===t));return"string"!==e&&i&&!n?O(t):function(){return F(t,e,s,arguments)}},S=function t(){H||V(),H||(S=t)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return V(),t.ready});"object"==typeof exports?t.exports=i:"function"==typeof define&&s.amdO?define([],(function(){return i})):"object"==typeof exports&&(exports.exportCppDbscanLib=i)},5697:(t,e,s)=>{"use strict";s.d(e,{Dz:()=>C,FV:()=>c,KR:()=>l,MI:()=>A,NB:()=>p,Om:()=>b,UX:()=>m,WI:()=>d,Zd:()=>u,_h:()=>h,aW:()=>f,bX:()=>S,eo:()=>w,fX:()=>T,kg:()=>r,s:()=>g,yU:()=>y});var n=s(9657),i=s(1040),o=s(708);i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean;const r=[i.gk.Tanimoto,i.gk.Dice,i.gk.Cosine];function a(t,e){const s=t.trueCount()+e.trueCount();if(0==s)return 1;const n=t.andWithCountBits(e,!0);return n/(s-n)}function l(t,e){return w(a(t,e))}function c(t,e){return w(a(new n.Z(t,32*t.length),new n.Z(e,32*e.length)))}function h(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount();return 0==s?0:2*t.andWithCountBits(e,!0)/s}(t,e))}function u(t,e){return w(function(t,e){const s=t.trueCount()*e.trueCount();return 0==s?0:t.andWithCountBits(e,!0)/Math.sqrt(s)}(t,e))}function d(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}function m(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)}function p(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount(),n=t.andWithCountBits(e,!0);return n/(2*s-3*n)}(t,e))}function g(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount(),n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)*s/(2*n)}(t,e))}function f(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount(),n=t.trueCount()*e.trueCount();return 0==n?0:(t.andWithCountBits(e,!0)*s-n)/n}(t,e))}function y(t,e){return w(function(t,e){const s=Math.min(t.trueCount(),e.trueCount());return 0==s?0:t.andWithCountBits(e,!0)/s}(t,e))}function C(t,e){return w(function(t,e){const s=Math.max(t.trueCount(),e.trueCount());return 0==s?0:t.andWithCountBits(e,!0)/s}(t,e))}function T(t,e){return w(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))}function A(t,e){return w(function(t,e){const s=t.andWithCountBits(e,!0),n=t.countBits(!0)+e.countBits(!0),i=t.length,o=i-n+s;return s==i||o==i?1:s/n+o/(2*i-n)}(t,e))}function b(t){return 1/(1+t)}function w(t){return 0===t?3402823e32:1/t-1}function S(t,e){return Math.abs(t-e)}i.gk.Tanimoto,i.gk.Asymmetric,i.gk.Cosine,i.gk.Sokal,o.U.HAMMING,o.U.LEVENSHTEIN,o.U.MONOMER_CHEMICAL_DISTANCE,o.U.NEEDLEMANN_WUNSCH},3277:(t,e,s)=>{"use strict";s.d(e,{Ec:()=>i,sS:()=>n});const n="bypassLargeDataWarning",i="show-scatterplot-progress"},708:(t,e,s)=>{"use strict";function n(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,s=t.scoringMatrix,n=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,i=new Float32Array((s.length+n)*(s.length+n));return Object.entries(e).forEach((([t,n])=>{const o=s[n];Object.entries(e).forEach((([e,n])=>{i[t.charCodeAt(0)*s.length+e.charCodeAt(0)]=o[n]}))})),(t,e)=>i[t.charCodeAt(0)*s.length+e.charCodeAt(0)]}(),s=t?.threshold??0;return(t,n)=>{let i=0;const o=t.length,r=n.length,a=Math.max(o,r)*(1-s);o!==r&&(i=Math.abs(o-r));let l=0;for(let s=0;s<Math.min(o,r);s++)if(t[s]!==n[s]&&(l+=e(t[s],n[s]),l>a))return 1;return l+=i,l/=Math.max(o,r),l}}s.d(e,{U:()=>r,o:()=>a});var i=s(1811);const o={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 r;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(r||(r={}));const a={[r.HAMMING]:n,[r.LEVENSHTEIN]:function(){return(t,e)=>(0,i.T)(t,e)/Math.max(t.length,e.length)},[r.NEEDLEMANN_WUNSCH]:function(t){const e=new Uint16Array(65536),{gapOpen:s,gapExtend:n,scoringMatrix:i,alphabetIndexes:r}={...o,...t};Object.entries(r).forEach((([t,s])=>e[t.charCodeAt(0)]=s));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(t,o)=>{const r=new Array(t.length+1).fill(!1),l=new Array(t.length+1).fill(!1);let c=0,h=1;for(let e=1;e<t.length+1;e++)a[0][e]=-s-(e-1)*n,a[1][e]=0;for(let u=1;u<o.length+1;u++){a[h][0]=-s-(u-1)*n;for(let d=1;d<t.length+1;d++){const m=a[c][d-1]+i[e[t.charCodeAt(d-1)]][e[o.charCodeAt(u-1)]],p=a[c][d]-(r[d]?n:s),g=a[h][d-1]-(l[d-1]?n:s);a[h][d]=Math.max(m,g,p),a[h][d]===m?(r[d]=!1,l[d]=!1):a[h][d]===g?(r[d]=!1,l[d]=!0):(r[d]=!0,l[d]=!1)}c=h,h=(h+1)%2}const u=Math.max(t.length,o.length);return(u-a[c][t.length])/u}},[r.MONOMER_CHEMICAL_DISTANCE]:n}},4628:(t,e,s)=>{"use strict";var n;s.d(e,{A:()=>n}),function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(n||(n={}))},1040:(t,e,s)=>{"use strict";var n,i,o,r,a,l;s.d(e,{CF:()=>i,Qe:()=>a,W:()=>n,Yc:()=>l,gd:()=>r,gk:()=>o}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(n||(n={})),function(t){t.Euclidean="Euclidean"}(i||(i={})),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"}(o||(o={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(r||(r={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray"}(a||(a={})),function(t){t.Difference="Difference"}(l||(l={}))},6361:(t,e,s)=>{"use strict";s.d(e,{gk:()=>n.gk});var n=s(1040);s(7861)},7861:(t,e,s)=>{"use strict";s.d(e,{sQ:()=>f});var n=s(1811),i=s(3979),o=s(5697),r=s(850),a=s(708),l=s(1040);const c={[l.CF.Euclidean]:r.dP},h={[l.W.Levenshtein]:n.T,[l.W.JaroWinkler]:i.H$,[l.W.Manhattan]:function(t,e){if(t.length!==e.length)return 1;{let s=0;for(let n=1;n<t.length;n++)s+=t[n]==e[n]?0:1;return s/t.length}},[l.W.Onehot]:function(t,e){return t===e?0:1}},u={[l.gk.Tanimoto]:o.KR,[l.gk.Dice]:o._h,[l.gk.Asymmetric]:o.yU,[l.gk.BraunBlanquet]:o.Dz,[l.gk.Cosine]:o.Zd,[l.gk.Kulczynski]:o.s,[l.gk.McConnaughey]:o.aW,[l.gk.RogotGoldberg]:o.MI,[l.gk.Russel]:o.fX,[l.gk.Sokal]:o.NB,[l.gk.Hamming]:o.UX,[l.gk.Euclidean]:o.WI},d={[l.gd.TanimotoIntArray]:o.FV},m={[l.Yc.Difference]:o.bX},p={[l.Qe.Vector]:{[l.CF.Euclidean]:c[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:h[l.W.Levenshtein],[l.W.JaroWinkler]:h[l.W.JaroWinkler],[l.W.Manhattan]:h[l.W.Manhattan],[l.W.Onehot]:h[l.W.Onehot]},[l.Qe.BitArray]:{[l.gk.Tanimoto]:u[l.gk.Tanimoto],[l.gk.Dice]:u[l.gk.Dice],[l.gk.Asymmetric]:u[l.gk.Asymmetric],[l.gk.BraunBlanquet]:u[l.gk.BraunBlanquet],[l.gk.Cosine]:u[l.gk.Cosine],[l.gk.Kulczynski]:u[l.gk.Kulczynski],[l.gk.McConnaughey]:u[l.gk.McConnaughey],[l.gk.RogotGoldberg]:u[l.gk.RogotGoldberg],[l.gk.Russel]:u[l.gk.Russel],[l.gk.Sokal]:u[l.gk.Sokal]},[l.Qe.MacroMolecule]:{[a.U.HAMMING]:a.o[a.U.HAMMING],[a.U.LEVENSHTEIN]:a.o[a.U.LEVENSHTEIN],[a.U.NEEDLEMANN_WUNSCH]:a.o[a.U.NEEDLEMANN_WUNSCH],[a.U.MONOMER_CHEMICAL_DISTANCE]:a.o[a.U.MONOMER_CHEMICAL_DISTANCE]},[l.Qe.Number]:{[l.Yc.Difference]:m[l.Yc.Difference]},[l.Qe.IntArray]:{[l.gd.TanimotoIntArray]:d[l.gd.TanimotoIntArray]}},g=Object.keys(p).reduce(((t,e)=>{for(const s of Object.keys(p[e]))t[s]=e;return t}),{});function f(t){return"BitArray"==g[t]}},9657:(t,e,s)=>{"use strict";s.d(e,{Z:()=>n});class n{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 s=t,i=n._createBuffer(s);if(e)for(let t=0;t<i.length;t++)i[t]=-1;this._data=i,this._length=s}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,s,n){if(t<e||t>s)throw new Error(`Argument ${n} (${t}) out of range (${e}, ${s})`)}copy(t,e,s){for(let n=0;n<s;n++)e[n]=t[n]}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 s=new n(t._length);s._length=t._length,s._data=n._createBuffer(s._length),s._version=0;const i=t.lengthInInts;for(let n=0;n<i;n++)s._data[n]=t._data[n]&e._data[n];return s}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new n(t.length);e._version=0;for(let s=0;s<e._length;s++)t[s]&&(e._data[Math.floor(s/32)]|=1<<(s%32&31));return e}static fromSeq(t,e){const s=new n(t);for(let n=0;n<t;++n)s.setBit(n,e(n));return s._version=0,s}static fromString(t){return n.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const s=new n(t);return s._data=e,s}static fromBytes(t){const e=t.length,s=new n(8*e);s._data=new Uint32Array(Math.floor((e+3)/4)),s._length=8*e;let i=0,o=0;for(;e-o>=4;)s._data[i++]=255&t[o]|(255&t[o+1])<<8|(255&t[o+2])<<16|(255&t[o+3])<<24,o+=4;return e-o==3&&(s._data[i]=(255&t[o+2])<<16),e-o==2&&(s._data[i]|=(255&t[o+1])<<8),e-o==1&&(s._data[i]|=255&t[o]),s._version=0,s}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 n(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 s=t?-1:0,n=this.lengthInInts;for(let t=0;t<n;t++)this._data[t]=s;this.incrementVersion(e)}setIndexes(t,e=!0,s=!0,n=!0){s&&this.setAll(!e,!1);for(const s of t)this.setFast(s,e);this.incrementVersion(n)}everyIndex(t,e=!0){for(const s of t)if(this.getBit(s)!=e)return!1;return!0}anyIndex(t,e=!0){for(const s of t)if(this.getBit(s)==e)return!0;return!1}setWhere(t,e=!0,s=!0,n=!0,i=!0){if(s&&i&&this.setAll(!e,!1),i)for(let s=0;s<this._length;s++)t(s)&&this.setFast(s,e);else for(let s=0;s<this._length;s++)this.setFast(s,t(s)?e:!e);this.incrementVersion(n)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const s=[];for(let n=t;n<e;++n)s.push(this.getBit(n));return n.fromValues(s)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const s=[];for(let n=t;n<e;++n)s.push(this.getBit(n));return s}setRange(t,e,s,n=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const i=Math.min(t,e),o=Math.max(t,e);if(s)for(let t=i;t<=o;t++)this.setTrue(t);else for(let t=i;t<=o;t++)this.setFalse(t);return this.incrementVersion(n),this}setRandom(t,e,s=!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 s=0;s<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),s++)}this.incrementVersion(s)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,s=this.lengthInInts;e<s;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 s=this.lengthInInts;for(let e=0;e<s;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,s=this.lengthInInts;e<s;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,s=this.lengthInInts;e<s;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,s=this.lengthInInts;e<s;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,s=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const n=this._length;this.setLength(this._length+e);for(let s=n-1;s>=t;s--)this.setBit(s+e,this.getBit(s));for(let n=t;n<t+e;n++)this.setBit(n,s)}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 s=t;s<this._length-e;s++)this.setBit(s,this.getBit(s+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 s=0;for(let n=-1;-1!=(n=t.findNext(n,!e));)this.setFast(s++,this.getBit(n));this._length=s,this._version++}return this}getBit(t){return 0!=(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,s=!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+=n._onBitCount[255&t];let s=this._data[e];const i=31&this._length;for(0!=i&&(s&=~(4294967295<<i));0!=s;s>>>=8)this._selectedCount+=n._onBitCount[255&s];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let s=0;s<this._length;s++)e+=t(s)?1:0;else for(let s=-1;-1!=(s=this.findNext(s,!0));)e+=t(s)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let s=0;const i=this.lengthInInts;let o=0;for(;o<i-1;o++)for(let e=this._data[o]&t._data[o];0!=e;e>>>=8)s+=n._onBitCount[255&e];let r=this._data[o]&t._data[o];const a=31&this._length;for(0!=a&&(r&=~(4294967295<<a));0!=r;r>>>=8)s+=n._onBitCount[255&r];return e?s:this._length-s}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 s=31&(t=t<0?0:t+1);const i=this.lengthInInts;for(let o=Math.floor(t/32);o<i;o++){let i=e?this._data[o]:~this._data[o];if(0!=s)i&=4294967295<<s&4294967295,s=0;else if(!e&&-4294967296==i)continue;for(let e=0;0!=i;e+=8,i>>>=8){const s=n._firstOnBit[255&i];if(s>=0)return(t=s+32*o+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let s=1+(t=t<0?this._length-1:t-1)&31;for(let i=Math.floor(t/32);i>=0;i--){let t=e?this._data[i]:~this._data[i];0!=s&&(t&=~(4294967295<<s),s=0);for(let e=24;0!=t;e-=8,t<<=8){const s=n._lastOnBit[t>>>24];if(s>=0)return s+32*i+e}}return-1}}n._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]),n._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]),n._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])},8467:(t,e,s)=>{"use strict";s.d(e,{X5:()=>x,ow:()=>I,bb:()=>v,W3:()=>E,gw:()=>P,l_:()=>A,f6:()=>S,jh:()=>b,Wh:()=>w,ci:()=>M,Bu:()=>T,zg:()=>C,AB:()=>G,QK:()=>c});var n=s(4469),i=s(976);s(9133);const o=i.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,,,,,,,,,,,,,,,,,,,,,');o.columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var r=function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))};const a=3e4,l=108e5,c={},h="Auto Tests",u="Demo",d="Detectors",m={};let p;var g;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(g||(g={}));class f{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class y{constructor(t,e,s,n){var i;this.category=t,this.name=e,null!=n||(n={}),null!==(i=n.timeout)&&void 0!==i||(n.timeout=a),this.options=n,this.test=()=>r(this,void 0,void 0,(function*(){return new Promise(((t,e)=>r(this,void 0,void 0,(function*(){let n="";try{n=yield s()}catch(t){e(t)}t(n)}))))}))}}function C(t,e,s,n=0){return r(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{const r=t.subscribe((t=>{try{e(t),i("OK")}catch(t){o(t)}r.unsubscribe(),clearTimeout(a)})),a=setTimeout((()=>{r.unsubscribe(),o("timeout")}),n);s()}))}))}function T(t,e,s){null==c[p]&&(c[p]={}),null==c[p].tests&&(c[p].tests=[]),c[p].tests.push(new y(p,t,e,s))}function A(t,e=!0,s){if(s=s?`${s}, `:"",t!==e)throw new Error(`${s}Expected "${e}", got "${t}"`)}function b(t,e,s=.001,n){if(t===Number.POSITIVE_INFINITY&&e===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY&&e===Number.NEGATIVE_INFINITY||t===Number.NaN&&e===Number.NaN||isNaN(t)&&isNaN(e))return;const i=Math.abs(t-e)<s;if(A(i,!0,`${null!=n?n:""} (tolerance = ${s})`),!i)throw new Error(`Expected ${e}, got ${t} (tolerance = ${s})`)}function w(t,e){for(const[s,n]of Object.entries(e)){if(!t.hasOwnProperty(s))throw new Error(`Expected property "${s}" not found`);const e=t[s];if(e instanceof Array&&n instanceof Array)S(e,n);else if(e instanceof Object&&n instanceof Object)w(e,n);else if(Number.isFinite(e)&&Number.isFinite(n))b(e,n);else if(e!=n)throw new Error(`Expected (${n}) for key '${s}', got (${e})`)}}function S(t,e){const s=t.length,n=e.length;if(s!=n)throw new Error(`Arrays are of different length: actual array length is ${s} and expected array length is ${n}`);for(let n=0;n<s;n++)if(t[n]instanceof Array&&e[n]instanceof Array)S(t[n],e[n]);else if(t[n]instanceof Object&&e[n]instanceof Object)w(t[n],e[n]);else if(t[n]!=e[n])throw new Error(`Expected ${e[n]} at position ${n}, got ${t[n]}`)}function E(t,e,s){var n;p=t,e(),c[p]&&(c[p].clear=null===(n=null==s?void 0:s.clear)||void 0===n||n,c[p].timeout=null==s?void 0:s.timeout)}function v(t){null==c[p]&&(c[p]={}),c[p].before=t}function x(t){null==c[p]&&(c[p]={}),c[p].after=t}function L(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function M(t,e){var s,a,l,p,g,C;return r(this,void 0,void 0,(function*(){const T=null===(a=null===(s=n.functions.getCurrentCall())||void 0===s?void 0:s.func)||void 0===a?void 0:a.package;yield function(t,e){return r(this,void 0,void 0,(function*(){if(m[t])return;const e=c;if(void 0!==e[h]||void 0!==e[u]||Object.keys(e).find((t=>t.startsWith(h))))return void(m[t]=!0);const s=[],i=[],a=[],l=yield n.dapi.functions.filter(`package.id = "${t}"`).list(),p=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)/g);for(const t of l){const l=t.options.test,c=t.options.demoPath;if(l&&Array.isArray(l)&&l.length)for(let i=0;i<l.length;i++){const o=l[i].matchAll(p),a={};Array.from(o).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])}));const c=new y(h,1===l.length?t.name:`${t.name} ${i+1}`,(()=>r(this,void 0,void 0,(function*(){const e=yield n.functions.eval(L(l[i],t));if(a.wait&&(yield P(a.wait)),"boolean"==typeof e&&!e)throw`Failed: ${l[i]}, expected true, got ${e}`}))),{skipReason:a.skip});if(a.cat){const t=h+": "+a.cat;c.category=t,void 0===e[t]&&(e[t]={tests:[],clear:!0}),e[t].tests.push(c)}else s.push(c)}if(c){const e=t.options.demoWait?parseInt(t.options.demoWait):void 0,s=new y(u,t.friendlyName,(()=>r(this,void 0,void 0,(function*(){if(n.shell.lastError="",yield t.apply(),yield P(e||2e3),n.shell.lastError)throw new Error(n.shell.lastError)}))),{skipReason:t.options.demoSkip});i.push(s)}if(t.hasTag("semTypeDetector")){const e=new y(d,t.friendlyName,(()=>r(this,void 0,void 0,(function*(){const e=[];for(const s of o.clone().columns){const n=yield t.apply([s]);e.push(n||s.semType)}A(e.filter((t=>t)).length,1)}))),{skipReason:t.options.skipTest});a.push(e)}}m[t]=!0,s.length&&(e[h]={tests:s,clear:!0}),i.length&&(e[u]={tests:i,clear:!0}),a.length&&(e[d]={tests:a,clear:!1})}))}(T.id);const b=[];console.log("Running tests"),null!=t||(t={}),null!==(l=(C=t).testContext)&&void 0!==l||(C.testContext=new f),n.shell.lastError="";const w=[];for(const[s,o]of Object.entries(c)){if((null==t?void 0:t.category)&&!s.toLowerCase().startsWith(null==t?void 0:t.category.toLowerCase())||(null==e?void 0:e.some((t=>s.startsWith(t)))))continue;console.log(`Started ${s} category`),w.push(s);const r=null===(p=o.tests)||void 0===p?void 0:p.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));try{o.before&&!r&&(yield o.before())}catch(t){o.beforeStatus=N(t)}const a=null!==(g=o.tests)&&void 0!==g?g:[],l=[];if(o.clear)for(let e=0;e<a.length;e++)l.push(yield _(a[e],null==t?void 0:t.test,o.timeout,T.name)),n.shell.closeAll(),i.Balloon.closeAll();else for(let e=0;e<a.length;e++)l.push(yield _(a[e],null==t?void 0:t.test,o.timeout,T.name));const c=(yield Promise.all(l)).filter((t=>"skipped"!=t.result));try{o.after&&!r&&(yield o.after())}catch(t){o.afterStatus=N(t)}o.afterStatus&&c.push({category:s,name:"init",result:o.afterStatus,success:!1,ms:0,skipped:!1}),o.beforeStatus&&c.push({category:s,name:"init",result:o.beforeStatus,success:!1,ms:0,skipped:!1}),b.push(...c)}if(t.testContext.catchUnhandled&&(yield P(1e3),n.shell.lastError.length>0&&b.push({category:"Unhandled exceptions",name:"exceptions",result:n.shell.lastError,success:!1,ms:0,skipped:!1})),!t.test&&b.length){const e=b.filter((t=>t.success)).length,s=b.filter((t=>t.skipped)).length,o=b.filter((t=>!t.success)),r=T.name;for(const t of w){const e=b.filter((e=>e.category===t)),s=e.filter((t=>!t.success)).length,i={success:0===s,passed:e.filter((t=>t.success)).length,skipped:e.filter((t=>t.skipped)).length,failed:s,type:"package",packageName:r,category:t};n.log.usage(`${r}: ${t}`,i,`category-package ${r}: ${t}`)}if(!t.category){const t={success:0===o.length,passed:e,skipped:s,failed:o.length,type:"package",packageName:r};n.log.usage(r,t,`package-package ${r}`)}if(t.testContext.report){const t=new i.Logger,n="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",r={successful:e,skipped:s,failed:o.length,package:T};for(const t of o)Object.assign(r,{[`${t.category} | ${t.name}`]:t.result});t.log(n,r,"package-tested")}}return b}))}function N(t){return`${t.toString()}\n${t.stack?i.Logger.translateStackTrace(t.stack):""}`}function _(t,e,s,o){var c,h,u,d,m;return r(this,void 0,void 0,(function*(){let r;const p=null!=e&&t.name.toLowerCase()!==e.toLowerCase(),g=(null===(c=t.options)||void 0===c?void 0:c.skipReason)||p,f=p?"skipped":null===(h=t.options)||void 0===h?void 0:h.skipReason;g||console.log(`Started ${t.category} ${t.name}`);const y=Date.now();try{if(g)r={success:!0,result:f,ms:0,skipped:!0};else{let e=(null===(u=t.options)||void 0===u?void 0:u.timeout)===a&&s?s:null===(d=t.options)||void 0===d?void 0:d.timeout;e=i.Test.isInBenchmark&&e===a?l:e,r={success:!0,result:null!==(m=yield R(t.test,e))&&void 0!==m?m:"OK",ms:0,skipped:!1}}}catch(t){r={success:!1,result:N(t),ms:0,skipped:!1}}if(r.ms=Date.now()-y,g||console.log(`Finished ${t.category} ${t.name} for ${r.ms} ms`),r.category=t.category,r.name=t.name,!p){let e={success:r.success,result:r.result,ms:r.ms,skipped:r.skipped,type:"package",packageName:o,category:t.category,test:t.name};if(r.result.constructor==Object){const t=Object.keys(r.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:r.result[e]})),{});e=Object.assign(Object.assign({},e),t)}n.log.usage(`${o}: ${t.category}: ${t.name}`,e,`test-package ${o}: ${t.category}: ${t.name}`)}return r}))}function P(t){return r(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function I(t,e="Timeout exceeded",s=500,n=50){return r(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{setTimeout((()=>{clearInterval(r),o(new Error(e))}),s);const r=setInterval((()=>{t()&&(clearInterval(r),i())}),n)}))}))}function R(t,e){return r(this,void 0,void 0,(function*(){let s=null;const n=new Promise(((t,n)=>{s=setTimeout((()=>{n("EXECUTION TIMEOUT")}),e)}));try{return yield Promise.race([t(),n])}finally{s&&clearTimeout(s)}}))}const O=i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])]);function G(t,e,s){var o;return r(this,void 0,void 0,(function*(){(null==s?void 0:s.detectSemanticTypes)&&(yield n.data.detectSemanticTypes(e));let r=n.shell.addTableView(e);const a=`[name=viewer-${t.replace(/\s+/g,"-")} i]`,l=`${a} canvas,${a} svg,${a} img,\n ${a} input,${a} h1,${a} a,${a} .d4-viewer-error`,c=[];try{let h=r.addViewer(t);yield I((()=>null!==document.querySelector(l)),"cannot load viewer",3e3);const u=null===(o=document.querySelector(l))||void 0===o?void 0:o.tagName;if(c.push(Array.from(r.viewers).length),!(null==s?void 0:s.readOnly)){Array.from(e.row(0).cells).forEach((t=>t.value=null));const t=e.rowCount<20?Math.floor(e.rowCount/2):10;e.rows.select((e=>e.idx>=0&&e.idx<t)),yield P(50);for(let s=t;s<2*t;s++)e.filter.set(s,!1);yield P(50),e.currentRowIdx=1;const s=e.clone();e.columns.names().slice(0,Math.ceil(e.columns.length/2)).forEach((t=>e.columns.remove(t))),yield P(100),r.dataFrame=s}let d,m;try{d=h.getOptions(!0).look}catch(t){throw new Error("Viewer's .getOptions() error.",{cause:t})}try{m=h.getProperties()}catch(t){throw new Error("Viewer's .getProperties() error.",{cause:t})}const p={};Object.keys(d).filter((t=>"boolean"==typeof d[t])).forEach((t=>p[t]=!d[t])),m.filter((t=>null!==t.choices)).forEach((t=>p[t.name]=t.choices.find((e=>e!==d[t.name])))),h.setOptions(p),yield P(300);const g=r.saveLayout(),f=h.getOptions().look;r.resetLayout(),c.push(Array.from(r.viewers).length),r.loadLayout(g);const y=`${a} ${u}`;if(yield I((()=>null!==document.querySelector(y)),"cannot load viewer from layout",3e3),c.push(Array.from(r.viewers).length),h=Array.from(r.viewers).find((t=>"Grid"!==t.type)),S(c,[2,1,2]),A(JSON.stringify(h.getOptions().look),JSON.stringify(f)),!1!==(null==s?void 0:s.arbitraryDfTest)){n.shell.closeAll(),yield P(100),r=n.shell.addTableView(O);try{h=r.addViewer(t)}catch(t){return n.shell.closeAll(),void i.Balloon.closeAll()}yield I((()=>null!==document.querySelector(l)),"cannot load viewer on arbitrary dataset",3e3)}}finally{}}))}},850:(t,e,s)=>{"use strict";function n(t=!1,e="Assertion error."){if(!t)throw new Error(e)}function i(t){let e=0;for(let s=0;s<t.length;s++)e+=t[s]*t[s];return Math.sqrt(e)}function o(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let s=0;for(let n=0;n<t.length;n++)s+=t[n]*e[n];return s}function r(t,e){let s=0;const n=t.length;if(n!==e.length)throw new Error("The dimensionality of the vectors must match");for(let i=0;i<n;++i)s+=Math.pow(t[i]-e[i],2);return Math.sqrt(s)}function a(t){const e=t.length;let s=0,n=0;for(let i=0;i<e;++i)s+=t[i],n+=Math.pow(t[i],2);const i=s/e,o=1/Math.sqrt(n/e-Math.pow(i,2));for(let s=0;s<e;++s)t[s]=(t[s]-i)*o;return t}s.d(e,{$G:()=>i,Fv:()=>a,MA:()=>o,dP:()=>r,hu:()=>n})},5362:(t,e,s)=>{"use strict";s.d(e,{Z:()=>a});var n=s(7537),i=s.n(n),o=s(3645),r=s.n(o)()(i());r.push([t.id,".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}","",{version:3,sources:["webpack://./css/composition-analysis.css"],names:[],mappings:"AAAA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB",sourcesContent:[".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}"],sourceRoot:""}]);const a=r},9564:(t,e,s)=>{"use strict";s.d(e,{Z:()=>a});var n=s(7537),i=s.n(n),o=s(3645),r=s.n(o)()(i());r.push([t.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB;AACA;IACI,oBAAoB;AACxB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}"],sourceRoot:""}]);const a=r},9414:(t,e,s)=>{"use strict";s.d(e,{Z:()=>a});var n=s(7537),i=s.n(n),o=s(3645),r=s.n(o)()(i());r.push([t.id,".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/ml/css/styles.css"],names:[],mappings:"AAAA;IACI,4BAA4B;IAC5B,WAAW;AACf;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,eAAe;IACf,kBAAkB;IAClB,YAAY;AAChB",sourcesContent:[".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n"],sourceRoot:""}]);const a=r},3645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var s="",n=void 0!==e[5];return e[4]&&(s+="@supports (".concat(e[4],") {")),e[2]&&(s+="@media ".concat(e[2]," {")),n&&(s+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),s+=t(e),n&&(s+="}"),e[2]&&(s+="}"),e[4]&&(s+="}"),s})).join("")},e.i=function(t,s,n,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(r[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);n&&r[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),s&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=s):h[2]=s),i&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=i):h[4]="".concat(i)),e.push(h))}},e}},7537:t=>{"use strict";t.exports=function(t){var e=t[1],s=t[3];if(!s)return e;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),o="/*# ".concat(i," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},9133:function(t,e,s){var n;!function(e,i){var o={};!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 s(t,s,n,i,o){for(var r,a,l,c,h,u,d,m,p,g,f,y,C;o>=64;){for(r=s[0],a=s[1],l=s[2],c=s[3],h=s[4],u=s[5],d=s[6],m=s[7],g=0;g<16;g++)f=i+4*g,t[g]=(255&n[f])<<24|(255&n[f+1])<<16|(255&n[f+2])<<8|255&n[f+3];for(g=16;g<64;g++)y=((p=t[g-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,C=((p=t[g-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,t[g]=(y+t[g-7]|0)+(C+t[g-16]|0);for(g=0;g<64;g++)y=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&u^~h&d)|0)+(m+(e[g]+t[g]|0)|0)|0,C=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&a^r&l^a&l)|0,m=d,d=u,u=h,h=c+y|0,c=l,l=a,a=r,r=y+C|0;s[0]+=r,s[1]+=a,s[2]+=l,s[3]+=c,s[4]+=h,s[5]+=u,s[6]+=d,s[7]+=m,i+=64,o-=64}return i}var n=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 n=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[n++],e--;64===this.bufferLength&&(s(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(n=s(this.temp,this.state,t,n,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[n++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,n=this.bufferLength,i=e/536870912|0,o=e<<3,r=e%64<56?64:128;this.buffer[n]=128;for(var a=n+1;a<r-8;a++)this.buffer[a]=0;this.buffer[r-8]=i>>>24&255,this.buffer[r-7]=i>>>16&255,this.buffer[r-6]=i>>>8&255,this.buffer[r-5]=i>>>0&255,this.buffer[r-4]=o>>>24&255,this.buffer[r-3]=o>>>16&255,this.buffer[r-2]=o>>>8&255,this.buffer[r-1]=o>>>0&255,s(this.temp,this.state,this.buffer,0,r),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 s=0;s<this.state.length;s++)this.state[s]=t[s];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=n;var i=function(){function t(t){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new n).update(t).finish(e).clean();else for(var s=0;s<t.length;s++)e[s]=t[s];for(s=0;s<e.length;s++)e[s]^=54;for(this.inner.update(e),s=0;s<e.length;s++)e[s]^=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),s=0;s<e.length;s++)e[s]=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 o(t){var e=(new n).update(t),s=e.digest();return e.clean(),s}function r(t,e){var s=new i(t).update(e),n=s.digest();return s.clean(),n}function a(t,e,s,n){var i=n[0];if(0===i)throw new Error("hkdf: cannot expand more");e.reset(),i>1&&e.update(t),s&&e.update(s),e.update(n),e.finish(t),n[0]++}t.HMAC=i,t.hash=o,t.default=o,t.hmac=r;var l=new Uint8Array(t.digestLength);t.hkdf=function(t,e,s,n){void 0===e&&(e=l),void 0===n&&(n=32);for(var o=new Uint8Array([1]),c=r(e,t),h=new i(c),u=new Uint8Array(h.digestLength),d=u.length,m=new Uint8Array(n),p=0;p<n;p++)d===u.length&&(a(u,h,s,o),d=0),m[p]=u[d++];return h.clean(),u.fill(0),o.fill(0),m},t.pbkdf2=function(t,e,s,n){for(var o=new i(t),r=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(r),c=new Uint8Array(r),h=new Uint8Array(n),u=0;u*r<n;u++){var d=u+1;a[0]=d>>>24&255,a[1]=d>>>16&255,a[2]=d>>>8&255,a[3]=d>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(c);for(var m=0;m<r;m++)l[m]=c[m];for(m=2;m<=s;m++){o.reset(),o.update(c).finish(c);for(var p=0;p<r;p++)l[p]^=c[p]}for(m=0;m<r&&u*r+m<n;m++)h[u*r+m]=l[m]}for(u=0;u<r;u++)l[u]=c[u]=0;for(u=0;u<4;u++)a[u]=0;return o.clean(),h}}(o);var r=o.default;for(var a in o)r[a]=o[a];"object"==typeof t.exports?t.exports=r:void 0===(n=function(){return r}.call(o,s,o,t))||(t.exports=n)}()},1811:(t,e,s)=>{"use strict";s.d(e,{T:()=>i});const n=new Uint32Array(65536),i=(t,e)=>{if(t.length<e.length){const s=e;e=t,t=s}return 0===e.length?t.length:t.length<=32?((t,e)=>{const s=t.length,i=e.length,o=1<<s-1;let r=-1,a=0,l=s,c=s;for(;c--;)n[t.charCodeAt(c)]|=1<<c;for(c=0;c<i;c++){let t=n[e.charCodeAt(c)];const s=t|a;t|=(t&r)+r^r,a|=~(t|r),r&=t,a&o&&l++,r&o&&l--,a=a<<1|1,r=r<<1|~(s|a),a&=s}for(c=s;c--;)n[t.charCodeAt(c)]=0;return l})(t,e):((t,e)=>{const s=e.length,i=t.length,o=[],r=[],a=Math.ceil(s/32),l=Math.ceil(i/32);for(let t=0;t<a;t++)r[t]=-1,o[t]=0;let c=0;for(;c<l-1;c++){let a=0,l=-1;const h=32*c,u=Math.min(32,i)+h;for(let e=h;e<u;e++)n[t.charCodeAt(e)]|=1<<e;for(let t=0;t<s;t++){const s=n[e.charCodeAt(t)],i=r[t/32|0]>>>t&1,c=o[t/32|0]>>>t&1,h=s|a,u=((s|c)&l)+l^l|s|c;let d=a|~(u|l),m=l&u;d>>>31^i&&(r[t/32|0]^=1<<t),m>>>31^c&&(o[t/32|0]^=1<<t),d=d<<1|i,m=m<<1|c,l=m|~(h|d),a=d&h}for(let e=h;e<u;e++)n[t.charCodeAt(e)]=0}let h=0,u=-1;const d=32*c,m=Math.min(32,i-d)+d;for(let e=d;e<m;e++)n[t.charCodeAt(e)]|=1<<e;let p=i;for(let t=0;t<s;t++){const s=n[e.charCodeAt(t)],a=r[t/32|0]>>>t&1,l=o[t/32|0]>>>t&1,c=s|h,d=((s|l)&u)+u^u|s|l;let m=h|~(d|u),g=u&d;p+=m>>>i-1&1,p-=g>>>i-1&1,m>>>31^a&&(r[t/32|0]^=1<<t),g>>>31^l&&(o[t/32|0]^=1<<t),m=m<<1|a,g=g<<1|l,u=g|~(c|m),h=m&c}for(let e=d;e<m;e++)n[t.charCodeAt(e)]=0;return p})(t,e)}},3979:(t,e)=>{"use strict";e.H$=void 0,e.H$=function(t,e,s){var n=function(t,e,s){if(0===t.length||0===e.length)return 0;if(s&&!s.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var n=0,i=t.length,o=e.length,r=Math.floor(Math.max(i,o)/2)-1,a=new Array(i),l=new Array(o),c=0;c<i;c++)for(var h=Math.max(0,c-r);h<=Math.min(o,c+r+1);h++)if(!a[c]&&!l[h]&&t[c]===e[h]){++n,a[c]=l[h]=!0;break}if(0===n)return 0;var u=0,d=0;for(c=0;c<i;c++)if(a[c]){for(;!l[d];)d++;t.charAt(c)!==e.charAt(d++)&&u++}return(n/i+n/o+(n-(u/=2))/n)/3}(t,e,s),i=0;if(n>.7){for(var o=Math.min(t.length,e.length),r=0;t[r]===e[r]&&r<4&&r<o;)++i,r++;n+=.1*i*(1-n)}return n}},3379:t=>{"use strict";var e=[];function s(t){for(var s=-1,n=0;n<e.length;n++)if(e[n].identifier===t){s=n;break}return s}function n(t,n){for(var o={},r=[],a=0;a<t.length;a++){var l=t[a],c=n.base?l[0]+n.base:l[0],h=o[c]||0,u="".concat(c," ").concat(h);o[c]=h+1;var d=s(u),m={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(m);else{var p=i(m,n);n.byIndex=a,e.splice(a,0,{identifier:u,updater:p,references:1})}r.push(u)}return r}function i(t,e){var s=e.domAPI(e);return s.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;s.update(t=e)}else s.remove()}}t.exports=function(t,i){var o=n(t=t||[],i=i||{});return function(t){t=t||[];for(var r=0;r<o.length;r++){var a=s(o[r]);e[a].references--}for(var l=n(t,i),c=0;c<o.length;c++){var h=s(o[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}o=l}}},569:t=>{"use strict";var e={};t.exports=function(t,s){var n=function(t){if(void 0===e[t]){var s=document.querySelector(t);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(t){s=null}e[t]=s}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(s)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},3565:(t,e,s)=>{"use strict";t.exports=function(t){var e=s.nc;e&&t.setAttribute("nonce",e)}},7795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(s){!function(t,e,s){var n="";s.supports&&(n+="@supports (".concat(s.supports,") {")),s.media&&(n+="@media ".concat(s.media," {"));var i=void 0!==s.layer;i&&(n+="@layer".concat(s.layer.length>0?" ".concat(s.layer):""," {")),n+=s.css,i&&(n+="}"),s.media&&(n+="}"),s.supports&&(n+="}");var o=s.sourceMap;o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,s)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},4589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},7241:(t,e,s)=>{"use strict";s.d(e,{D:()=>h});var n=s(4469),i=s(976),o=s(6414),r=s.n(o),a=s(4955),l=s(499);const c=31;async function h(t,e=!1,s){const o=l.Cn.getOrCreate(t);let h;s??(s=new Map);const d=o.isHelm()?(0,a.getHelmMonomers)(t):Object.keys(o.stats.freq).filter((t=>""!==t));for(let t=0;t<d.length;t++)s.has(d[t])||s.set(d[t],`${s.size+1}`);if(o.isHelm())h=await n.functions.call("HELM:getMolFiles",{col:t}),h=function(t,e,s=!1){const n=new Array(t.length);for(let i=0;i<t.length;i++){let o=0,r=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=t.get(i);o=l.indexOf("\n",o)+1,o=l.indexOf("\n",o)+1,o=l.indexOf("\n",o)+1;const h=parseInt(l.substring(o,o+3)),u=parseInt(l.substring(o+3,o+6));a+=`M V30 COUNTS ${h} ${u} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let t=0;t<h;t++){o=l.indexOf("\n",o)+1+c,r=l.indexOf(" ",o);const n=l.substring(o,r);a+=s?`M V30 ${t+1} R${e.get(n)} 0.000 0.000 0 0\n`:`M V30 ${t+1} At 0.000 0.000 0 0 MASS=${e.get(n)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let t=0;t<u;t++){o=l.indexOf("\n",o)+1;const e=parseInt(l.substring(o,o+3).trim()),s=parseInt(l.substring(o+3,o+6).trim());a+=`M V30 ${t+1} ${parseInt(l.substring(o+6,o+9).trim())} ${e} ${s}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",n[i]=a}return n}(h,s,e);else{h=new Array(t.length);for(let n=0;n<t.length;n++){const t=u(r()(o.splitted[n]).filter((t=>""!==t)).toArray(),s,e);h[n]=t}}return i.Column.fromStrings("monomericMols",h)}function u(t,e,s=!1){let n="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";n+=`M V30 COUNTS ${t.length} ${t.length?t.length-1:0} 0 0 0\n`,n+="M V30 BEGIN ATOM\n";for(let i=0;i<t.length;i++)n+=s?`M V30 ${i+1} R${e.get(t[i])} 0.000 0.000 0 0\n`:`M V30 ${i+1} At 0.000 0.000 0 0 MASS=${e.get(t[i])}\n`;n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n";for(let e=0;e<t.length-1;e++)n+=`M V30 ${e+1} 1 ${e+1} ${e+2}\n`;return n+="M V30 END BOND\n",n+="M V30 END CTAB\n",n+="M END",n}},4955:(t,e,s)=>{"use strict";s.d(e,{_package:()=>ie,activityCliffs:()=>ae,getBioLib:()=>re,getHelmMonomers:()=>ue,getMonomerLibHelper:()=>oe,importFasta:()=>he,sequenceIdentityScoring:()=>de,sequenceSimilarityScoring:()=>me,sequenceSpaceTopMenu:()=>le,toAtomicLevel:()=>ce});var n,i,o=s(4469),r=s(3870),a=s(976),l=s(4628);(i=n||(n={})).EUCLIDEAN="EUCLIDEAN",i.MANHATTAN="MANHATTAN",a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;var c=s(442),h=s(5697),u=s(701),d=s(3379),m=s.n(d),p=s(7795),g=s.n(p),f=s(569),y=s.n(f),C=s(3565),T=s.n(C),A=s(9216),b=s.n(A),w=s(4589),S=s.n(w),E=s(9414),v={};v.styleTagTransform=S(),v.setAttributes=T(),v.insert=y().bind(null,"head"),v.domAPI=g(),v.insertStyleElement=b(),m()(E.Z,v),E.Z&&E.Z.locals&&E.Z.locals;var x=s(7861);const L=t=>null==t;function M(t,e,s,n){if(s>t[t.length-1])return;const i=t.findIndex((t=>s<t));t.pop(),t.splice(i,0,s),e.pop(),e.splice(i,0,n)}var N=s(6361);class _{_workerCount;constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calc(t,e,n,i={}){const o=t.length*(t.length-1)/2,r=Math.floor(o/this._workerCount),a=t.length>2e4?await this.getMinimalThreshold(t,e,i):0;n<a&&(console.log(`using threshold ${a}`),n=a),i.threshold=n;const l=new Array(this._workerCount),c=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(471),s.b))));for(let s=0;s<this._workerCount;s++)l[s]=new Promise(((a,l)=>{const h=s*r,u=s===this._workerCount-1?o:(s+1)*r;u<=h&&a({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:s}),c[s].postMessage({values:t,startIdx:h,endIdx:u,threshold:n,fnName:e,opts:i}),c[s].onmessage=({data:{error:t,i:e,j:n,distance:i}})=>{t?(c[s].terminate(),l(t)):(c[s].terminate(),a({i:e,j:n,distance:i,idx:s}))}}));const h=await Promise.all(l),u=h.reduce(((t,e)=>t+e.i.length),0),d=new Int32Array(u),m=new Int32Array(u),p=new Float32Array(u);let g=0;for(const t of h)d.set(t.i,g),m.set(t.j,g),p.set(t.distance,g),g+=t.i.length;return{i:d,j:m,distance:p}}async getKNN(t,e,s=15,n={}){return await this.multiColumnKNN([t],[e],s,[n],[1])}async multiColumnKNN(t,e,i=15,o,r,a=n.EUCLIDEAN){if(t.length!==e.length||t.length!==o.length||t.length!==r.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(t.some((e=>e.length!==t[0].length)))throw new Error("all values arrays should have the same length");const l=t[0].length*(t[0].length-1)/2,c=Math.floor(l/this._workerCount),h=new Array(this._workerCount),u=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(664),s.b))));for(let s=0;s<this._workerCount;s++)h[s]=new Promise(((n,h)=>{const d=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=d&&n({knnDistances:new Array(0),knnIndexes:new Array(0)}),u[s].postMessage({values:t,startIdx:d,endIdx:m,fnNames:e,opts:o,nNeighbours:i,weights:r,aggregationMethod:a}),u[s].onmessage=({data:{error:t,knnDistances:e,knnIndexes:i}})=>{t?(u[s].terminate(),h(t)):(u[s].terminate(),n({knnDistances:e,knnIndexes:i}))}}));const d=await Promise.all(h),m={knnDistances:new Array(t[0].length).fill(null).map((()=>new Array(i).fill(99999))),knnIndexes:new Array(t[0].length).fill(null).map((()=>new Array(i).fill(-1)))};for(const e of d)for(let s=0;s<t[0].length;++s)for(let t=0;t<e.knnDistances[s]?.length;++t)M(m.knnDistances[s],m.knnIndexes[s],e.knnDistances[s][t],e.knnIndexes[s][t]);return m}async getSampleDistances(t,e,n={}){const i=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(118),s.b)))),o=t.slice();for(let t=o.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[o[t],o[e]]=[o[e],o[t]]}try{const s=t.length*(t.length-1)/2,r=Math.floor(s/this._workerCount),a=1e6,l=Math.max(Math.min(s/1e3,a),Math.min(s,a)),c=Math.floor(l/this._workerCount),h=new Array(this._workerCount);for(let t=0;t<this._workerCount;t++)h[t]=new Promise(((a,l)=>{const h=t*r,u=t===this._workerCount-1?s:(t+1)*r;i[t].postMessage({values:o,startIdx:h,endIdx:u,sampleLength:c,fnName:e,opts:n}),i[t].onmessage=({data:{error:e,distance:s}})=>{i[t].terminate(),e?l(e):a({distance:s})}}));const u=await Promise.all(h),d=u.reduce(((t,e)=>t+e.distance.length),0),m=new Float32Array(d);let p=0;for(const t of u)m.set(t.distance,p),p+=t.distance.length;return m.sort(),m}catch(t){return i?.forEach((t=>t?.terminate())),console.error(t),new Float32Array(1).fill(.5)}}async getMinimalThreshold(t,e,s={}){try{const n=t.length*(t.length-1)/2,i=await this.getSampleDistances(t,e,s);return 1-i[Math.floor(7e7/n*i.length)]}catch(t){return console.error(t),.5}}static calcSync(t,e,s,n){const i=[],o=[],r=[];let a=0,l=0,c=0;const u=t.length*(t.length-1)/2;for(;a<u;){const u=L(t[l])||L(t[c])?1:s(t[l],t[c]);(Object.values(N.gk).some((t=>t===e))?(0,h.Om)(u):1-u)>=n&&(i.push(l),o.push(c),r.push(u)),a++,c++,c===t.length&&(l++,c=l+1)}return{i:new Int32Array(i),j:new Int32Array(o),distance:new Float32Array(r)}}}var P,I=s(9657);!function(t){t.none="none",t.bold="bold",t.dashed="dashed"}(P||(P={}));class R{get currentLineId(){return this._currentLineIdx}set currentLineId(t){t!==this._currentLineIdx&&(this._currentLineIdx=t,this.sp.render(this.ctx))}set linesToRender(t){this.updateLines(t),this.sp.render(this.ctx)}set linesVisibility(t){this.visibility=t,this.sp.render(this.ctx)}constructor(t,e,s,n,i=P.none){var o;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=t,this.xAxisCol=this.sp.dataFrame.columns.byName(e),this.yAxisCol=this.sp.dataFrame.columns.byName(s),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=i,this.updateLines(n),this.visibility=null!==(o=n.visibility)&&void 0!==o?o:new I.Z(this.lines.from.length),n.visibility||this.visibility.setAll(!0,!1),n.arrowSize&&(this.arrowWidth=n.arrowSize),this.canvas.onmousedown=t=>{-1!==this.mouseOverLineId&&this.lineClicked.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},this.canvas.onmousemove=t=>{this.mouseOverLineId=this.checkCoordsOnLine(t.offsetX,t.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},t.onEvent("d4-before-draw-scene").subscribe((t=>{this.renderLines()}))}updateLines(t){this.lines=t,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),this.createMultiLinesIndices()}renderLines(){var t,e,s,n,i,o,r,a,l,c,h,u,d;const m=this.sp.getOptions().look,p=this.lines.colors||this.lines.width||this.lines.opacities||this.lines.drawArrowsArr;p||(this.ctx.lineWidth=null!==(t=this.lines.width)&&void 0!==t?t:1,this.ctx.strokeStyle=`rgba(${null!==(e=this.lines.color)&&void 0!==e?e:"0,128,0"},${null!==(s=this.lines.opacity)&&void 0!==s?s:1})`);const g=m.sizeColumnName?this.sp.dataFrame.col(m.sizeColumnName):null,f=this.sp.dataFrame.filter;for(let t=0;t<this.lines.from.length;t++)if(f.get(this.lines.from[t])&&f.get(this.lines.to[t])&&this.visibility.getBit(t)){let e=0;const{sizeFrom:s,sizeTo:f}=this.getMarkersSizes(m,g,t),y=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[t]),this.yAxisCol.get(this.lines.from[t]));let C=null==y?void 0:y.x,T=null==y?void 0:y.y;const A=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[t]),this.yAxisCol.get(this.lines.to[t]));let b=null==A?void 0:A.x,w=null==A?void 0:A.y;if(this.ctx.beginPath(),C&&T&&b&&w){if(p){const e=(null===(n=this.lines.colors)||void 0===n?void 0:n[t])?null===(i=this.lines.colors)||void 0===i?void 0:i[t]:"0,128,0",s=(null===(o=this.lines.opacities)||void 0===o?void 0:o[t])?null===(r=this.lines.opacities)||void 0===r?void 0:r[t]:1;this.ctx.strokeStyle=`rgba(${e},${s})`,this.ctx.lineWidth=(null===(a=this.lines.widths)||void 0===a?void 0:a[t])?null===(l=this.lines.widths)||void 0===l?void 0:l[t]:1}t===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const m=this.multipleLinesCounts[t];let g=null;if(m){e=this.getLineLength(C,T,b,w);const n=this.getPointOnDistance(C,T,b,w,f,e),i=this.getPointOnDistance(b,w,C,T,s,e);C=n.x,T=n.y,b=i.x,w=i.y,g=this.lines.from[t]>this.lines.to[t]?this.findControlPoint(m,C,T,b,w,t):this.findControlPoint(m,b,w,C,T,t),this.ctx.moveTo(C,T),this.ctx.quadraticCurveTo(g.x,g.y,b,w)}else this.ctx.moveTo(C,T),this.ctx.lineTo(b,w);if((null!==(c=this.lines.drawArrows)&&void 0!==c?c:null===(h=this.lines.drawArrowsArr)||void 0===h?void 0:h.getBit(t))&&(e||(e=this.getLineLength(C,T,b,w)),e>this.arrowWidth)){const t=m?null:this.getPointOnDistance(C,T,b,w,f,e),s=m?g.x:C,n=m?g.y:T;this.canvasArrow(this.ctx,null!==(u=null==t?void 0:t.x)&&void 0!==u?u:C,null!==(d=null==t?void 0:t.y)&&void 0!==d?d:T,s,n)}this.ctx.stroke(),this.ctx.closePath(),t===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(t){switch(this.currentLineStyle){case P.bold:t?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case P.dashed:t?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(t,e,s){let n=3,i=3;return e?(n=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.from[s]))/2,i=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.to[s]))/2):t.markerDefaultSize&&(n=t.markerDefaultSize/2,i=t.markerDefaultSize/2),{sizeFrom:n,sizeTo:i}}fillLeftBottomRect(){const t=new Path2D;t.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(t),this.ctx.closePath()}createMultiLinesIndices(){const t=new I.Z(this.lines.from.length);t.setAll(!0);for(let e=-1;-1!==(e=t.findNext(e));){let s=e,n=this.lines.from[s],i=this.lines.to[s],o=1;for(let s=e;-1!==(s=t.findNext(s));){const e=this.lines.from[s],r=this.lines.to[s];(e===n&&r===i||r===n&&e===i)&&(this.multipleLinesCounts[s]=++o,t.setBit(s,!1,!1))}o>1&&(this.multipleLinesCounts[s]=1),t.setBit(e,!1,!1)}}checkCoordsOnLine(t,e){let s=-1,n=null,i=null;const o=this.sp.getOptions().look,r=o.sizeColumnName?this.sp.dataFrame.col(o.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:c}=this.getMarkersSizes(o,r,l),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const s=this.getLineLength(h.x,h.y,u.x,u.y),n=this.getPointOnDistance(h.x,h.y,u.x,u.y,c,s),o=this.getPointOnDistance(u.x,u.y,null==h?void 0:h.x,null==h?void 0:h.y,a,s),r=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],n.x,n.y,o.x,o.y,l):this.findControlPoint(this.multipleLinesCounts[l],o.x,o.y,n.x,n.y,l);i=this.calculateDistToCurveLine(l,t,e,n,o,r)}else i=this.calculateDistToStraightLine(t,e,h,u);(!n&&null!==i&&i<5||n&&null!==i&&i<n)&&(n=i,s=l)}return s}calculateDistToStraightLine(t,e,s,n){let i=Math.min(s.x,n.x),o=Math.max(s.x,n.x),r=Math.min(s.y,n.y),a=Math.max(s.y,n.y);return t>=i-2&&t<=o+2&&e>=r-2&&e<=a+2?this.distToStraightLineSegment(t,e,s,n):null}distToStraightLineSegment(t,e,s,n){const i=(t,e,s,n)=>Math.pow(t-s,2)+Math.pow(e-n,2),o=i(s.x,s.y,n.x,n.y);if(0==o)return i(t,e,s.x,s.y);let r=((t-s.x)*(n.x-s.x)+(e-s.y)*(n.y-s.y))/o;return r=Math.max(0,Math.min(1,r)),i(t,e,s.x+r*(n.x-s.x),s.y+r*(n.y-s.y))}calculateDistToCurveLine(t,e,s,n,i,o){let r=Math.min(n.x,i.x,o.x),a=Math.max(n.x,i.x,o.x),l=Math.min(n.y,i.y,o.y),c=Math.max(n.y,i.y,o.y);if(e>=r-2&&e<=a+2&&s>=l-2&&s<=c+2){const t=a-r,h=c-l;return this.calculateDistToCurveInRect(e,s,n,o,i,t,h)}return null}calculateDistToCurveInRect(t,e,s,n,i,o,r){const a=Math.floor((o+r)/3),l=1/a,c=new Uint32Array(a),h=new Uint32Array(a);let u=new Uint32Array(a),d=null;const m=new I.Z(a);for(let o=0;o<c.length;o++){const r=o*l,a=Math.pow(1-r,2)*s.x+2*r*(1-r)*n.x+Math.pow(r,2)*i.x,m=Math.pow(1-r,2)*s.y+2*r*(1-r)*n.y+Math.pow(r,2)*i.y,p=Math.abs(t-a),g=Math.abs(e-m),f=p+g;(!d||d>f)&&(d=f),u[o]=Math.max(p,g),c[o]=a,h[o]=m}for(let t=0;t<c.length;t++)u[t]<d&&m.setBit(t,!0,!1);let p=null;for(let s=-1;-1!==(s=m.findNext(s));){const n=Math.hypot(c[s]-t,h[s]-e);(!p||p>n)&&(p=n)}return p}getLineLength(t,e,s,n){return Math.sqrt(Math.pow(s-t,2)+Math.pow(n-e,2))}getPointOnDistance(t,e,s,n,i,o){const r=s-i*((s-t)/o),l=n-i*((n-e)/o);return new a.Point(r,l)}findControlPoint(t,e,s,n,i,o){const r=e+(n-e)/2,l=s+(i-s)/2;let c=r-e,h=l-s;const u=Math.sqrt(c*c+h*h);c/=u,h/=u;const d=50*Math.ceil(t/2);return t%2==0?new a.Point(r+d/2*h,l-d/2*c):new a.Point(r-d/2*h,l+d/2*c)}canvasArrow(t,e,s,n,i){const o=Math.atan2(n-e,i-s)+Math.PI;t.moveTo(e-this.arrowWidth*Math.sin(o-Math.PI/10),s-this.arrowWidth*Math.cos(o-Math.PI/10)),t.lineTo(e,s),t.lineTo(e-this.arrowWidth*Math.sin(o+Math.PI/10),s-this.arrowWidth*Math.cos(o+Math.PI/10))}}const O="dimensionality-reducer-terminate-event";var G=s(850);async function F(t,e,n,i,r,a,l){let c=await async function(t,e,n,i,r,a,l){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(t.length!==e.length||t.length!==a.distanceFnArgs.length||t.length!==i.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(c,h){const u=new Worker(new URL(s.p+s.u(42),s.b));u.postMessage({columnsData:t,distanceMetrics:e,method:n,options:a,weights:i,aggregationMethod:r});const d=o.events.onCustomEvent(O).subscribe((()=>{try{u?.terminate()}finally{d.unsubscribe()}}));u.onmessage=({data:{error:t,embedding:e,epochNum:s,epochsLength:n}})=>{s&&n?l&&l(s,n,e):(d.unsubscribe(),t?h(t):c(e),setTimeout((()=>u.terminate()),0))}}))}(t,n,e,i,r,a,l);return c=c.map((t=>(0,G.Fv)(t))),c}let H=0;const W="cliffsDf",D=new u.Subject,B="act_diff",k="sali",U="sim",V="line_index",$=["1_seq","2_seq"],Y="filterCliffs";var K,Z=s(499),q=s(5226),X=s(7228),z=s(8457),j=s(8260);async function Q(t,e,s,n){const i=(0,z.O)(e),o=(0,j.vU)(e.getTag(a.TAGS.UNITS),e.getTag("separator"))(s),r=n===K.IDENTITY?function(t,e){const s=e.columns.length,n=new Array(s),i=new Array(s),o=new Array(s);for(let r=0;r<s;++r){const s=e.columns.byIndex(r);n[r]=s.getRawData(),i[r]=s.categories.indexOf(""),o[r]=s.categories.indexOf(t[r]??"")}const r=a.Column.float("Identity",e.rowCount),l=r.getRawData();for(let s=0;s<e.rowCount;++s){l[s]=0;for(let e=0;e<t.length;++e)n[e][s]===o[e]&&++l[s];l[s]/=t.length}return r}(o,i):n===K.SIMILARITY?await async function(t,e){const s=e.columns.toList();return await(0,X.Qx)(s,t)}(o,i):null;if(null===r)throw new Error(`In bio library: Unkown sequence scoring method: ${n}`);return r.name=t.columns.getUnusedName(r.name),t.columns.add(r),r}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(K||(K={}));var J=s(7945),tt=(s(4293),s(6414)),et=s.n(tt);const st="rgb(100,100,100)",nt="#808080",it="rgb(0,0,0)",ot=j.GU;var rt,at;function lt(t,e,s,n,i,o,r=st,a=0,l=!1,c=1,h="",u=!1,d=at.classic,m=[],p=0,g=null,f=[],y=null,C={}){i.textAlign="start";let T=o.substring(0),A=u?"":h;d===at.MSA&&(A="");let b=!0,w=!0,S="difference";null!=g&&null!=g.cell.column&&(b=g.cell.column.temp["color-code"]??!0,w=g.cell.column.temp["compare-with-current"]??!0,S=g.cell.column.temp["highlight-difference"]??"difference");const E=f[p];w&&f.length>0&&"difference"===S&&(c=T==E?.3:c),w&&f.length>0&&"equal"===S&&(c=T!=E?.3:c),null!=y&&(T=ot(T,y));const v=T+A;C[v]??(C[v]=i.measureText(v));let x=C[v];C[T]??(C[T]=i.measureText(T));let L=C[T].width;C[A]??(C[A]=i.measureText(A));const M=C[A].width,N=n/2-(x.fontBoundingBoxAscent+x.fontBoundingBoxDescent)/2+1;function _(s,n){const o=b?r:it;i.fillStyle=o,i.globalAlpha=c,d===at.classic&&(i.fillText(T,t+s,e+N),i.fillStyle=nt,i.fillText(A,t+n,e+N)),d===at.MSA&&i.fillText(T,t+s,e+N)}x=x.width,d===at.MSA&&(L=m[p],x=m[p]);const P=(m[p]??0)-(m[0]??0);if(l||x>s)return _(P,P+L),t+P+L+M;{const e=(s-x)/2;return _(e,e+L),t+P+e+L}}!function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(rt||(rt={})),function(t){t.MSA="MSA",t.classic="classic"}(at||(at={})),s(9611);var ct,ht,ut=s(8447),dt=s(7331);function mt(t){const e=!et().enumerate(t).some((([e,s])=>e.length>1&&0!=s&&s!=t.length-1)),s=[],n=e?"":" ";for(const[e,i]of et().enumerate(t)){let o=e;i<t.length&&(o+=`${e?"":"-"}${n}`),s.push(o)}return[s,e]}(ht=ct||(ct={})).long="long",ht.short="short",s(3553),ut.GU;class pt extends a.GridCellRenderer{constructor(){super(...arguments),this.padding=5}get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(t,e){t.cell.column.temp["current-word"]=t.cell.value,t.grid.invalidate()}onMouseMove(t,e){const s=t.cell.column.temp["bio-seqCol"];if(!s)return;const n=t.bounds,i=e.offsetX-t.gridColumn.left+(t.gridColumn.left-n.x),a=s.getPosition(t.tableRowIndex,i),l=s.getSeqMonList(t.tableRowIndex);if(null!==a&&a<l.length){const t=l[a],n=[r.div(t)];if(s._monomerStructureMap[t])n.push(s._monomerStructureMap[t]);else{const e=s.getMonomer(t);if(e){const i={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0},r=o.chem.svgMol(e.smiles,void 0,void 0,i);n.push(r),s._monomerStructureMap[t]=r}}r.tooltip.show(r.divV(n),e.x+16,e.y+16)}else r.tooltip.hide()}render(t,e,s,n,i,o,r){try{o.grid}catch(t){const[e,s]=(0,J.yf)(t);ie.logger.error(e,void 0,s)}o.cell.column}}class gt extends a.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return constants.Of.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(t,e,s,n,i,o,r){const l=window.devicePixelRatio,c=o.grid,h=o.cell,u=o.tableColumn,d=h.value??"",m=u.tags.separator,p=u.tags[a.TAGS.UNITS];getUpdatedWidth(c,t,e,n,l);const[g,f]=d.split("#"),y=(0,j.vU)(p,m);ft(t,e,s,n,i,y(g),y(f),p)}}function ft(t,e,s,n,i,o,r,a,l,c){if(o.length!==r.length){const t=function(t,e){let s=0,n=0;const i=t.length>e.length?t:e,o=t.length>e.length?e:t;for(let t=0;t<o.length;t++)i[t]===o[t]&&s++;const r=i.length-o.length;for(let t=i.length-1;t>r;t--)i[t]===o[t-r]&&n++;const a=new Array(Math.abs(t.length-e.length)).fill("");function l(t){return s>n?t.concat(a):a.concat(t)}return t.length>e.length?e=l(e):t=l(t),{subParts1:t,subParts2:e}}(et()(o).toArray(),et()(r).toArray());o=t.subParts1,r=t.subParts2}const h=t.measureText(mt(o).join("")),u=t.measureText(mt(r).join("")),d=Math.max(h.width,u.width);l&&(n=d+4*o.length,t.canvas.width=d+4*o.length);let m=Math.max(e,e+(n-(d+4*o.length))/2)+5;const p=Math.max(s,s+(i-28)/2);t.save(),t.beginPath(),t.rect(e,s,l?d+4*o.length:n,i),t.clip(),t.font="12px monospace",t.textBaseline="top";let g=dt.UE.Color;"HELM"!=a&&(g=(0,ut.py)(a.substring(a.length-2)));for(let e=0;e<o.length;e++){const s=o[e],a=r[e],l=g.get(s);if(s!=a){const o=g.get(a),r=lt(m,p-7,n,i,t,s,l,0,!0),h=lt(m,p+7,n,i,t,a,o,0,!0);m=Math.max(h,r),c&&(c[e]=yt(s,a,l,o,p,7,i))}else m=lt(m,p,n,i,t,s,l,0,!0,.5);m+=4}t.restore()}function yt(t,e,s,n,i,o,r){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(mt([t]).join("")).width,h=l.measureText(mt([e]).join("")).width,u=Math.max(c,h);return a.height=r,a.width=u+4,l.font="12px monospace",l.textBaseline="top",lt(0,i-o,u,r,l,t,s,0,!0),lt(0,i+o,u,r,l,e,n,0,!0),a}var Ct,Tt=s(8467),At=s(9298);!function(t){t.Unknown="unknown",t.FR="framework",t.CDR="cdr"}(Ct||(Ct={}));const bt=new class{constructor(){this.regionTypes=[Ct.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=At.ES.Entropy,this.filterSource=At.vS.filterSource}};var wt=s(172),St=s(8415);const Et=Ct;var vt,xt;!function(t){t.STYLE="Style",t.BEHAVIOR="Behavior",t.LAYOUT="Layout",t.DATA="Data"}(vt||(vt={})),function(t){t.skipEmptyPositions="skipEmptyPositions",t.regionTypes="regionTypes",t.chains="chains",t.fitWidth="fitWidth",t.positionWidth="positionWidth",t.positionHeight="positionHeight",t.filterSource="filterSource"}(xt||(xt={}));const Lt=bt;class Mt extends a.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewerId=++Mt.viewerCounter,this.setDataInProgress=!1,this.host=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.calcSizeRequested=!1,this._onRendered=new u.Subject,this.skipEmptyPositions=this.bool(xt.skipEmptyPositions,Lt.skipEmptyPositions,{category:vt.DATA}),this.regionTypes=this.stringList(xt.regionTypes,Lt.regionTypes,{category:vt.DATA,choices:Object.values(Et).filter((t=>t!=Et.Unknown))}),this.chains=this.stringList(xt.chains,Lt.chains,{category:vt.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(xt.fitWidth,Lt.fitWidth,{category:vt.LAYOUT}),this.positionWidth=this.float(xt.positionWidth,Lt.positionWidth,{category:vt.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(xt.positionHeight,Lt.positionHeight,{category:vt.LAYOUT,choices:Object.keys(At.ES)}),this.filterSource=this.string(xt.filterSource,Lt.filterSource,{category:vt.BEHAVIOR,choices:Object.values(At.Ct)}),this.viewSyncer=new wt.c(ie.logger)}viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,u.fromEvent)(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}detach(){const t=`${this.viewerToLog()}.detach()`,e=super.detach.bind(this);this.viewSyncer.sync(`${t}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView("detach"),this.viewed=!1),e())}))}onTableAttached(){super.onTableAttached(),this.setData(this.regions)}onPropertyChanged(t){if(super.onPropertyChanged(t),t){switch(t.name){case xt.regionTypes:case xt.chains:this.setData(this.regions)}switch(t.name){case xt.skipEmptyPositions:for(let t=0;t<this.logos.length;++t)for(const e of this.chains)this.logos[t][e].setOptions({[St.bo.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case xt.fitWidth:case xt.positionWidth:this.calcSize();break;case xt.positionHeight:for(let t=0;t<this.logos.length;++t)for(const e of this.chains)this.logos[t][e].setOptions({[St.bo.positionHeight]:this.positionHeight});this.calcSize();break;case xt.filterSource:this.filterSourceInput.value=this.filterSource;break;default:this.setData(this.regions)}}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(t){const e=`${this.viewerToLog()}.setData()`;ie.logger.debug(`${e}, in, regions.length = ${t.length}`),this.viewSyncer.sync(`${e}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(await this.destroyView("setData"),this.viewed=!1),this.regions=t,this.viewed||(await this.buildView("setData"),this.viewed=!0)}finally{this.setDataInProgress=!1}}}))}async destroyView(t){ie.logger.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${t}', this.regions.length = ${this.regions.length}`),this.filterSourceInput&&r.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const t of this.viewSubs)t.unsubscribe()}async buildView(t){ie.logger.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${t}', this.regions.length = ${this.regions.length}`);const e=this.regions.filter((t=>this.regionTypes.includes(t.type))),s=Array.from(new Set(e.map((t=>t.order)))).sort(),n=[];for(let t=0;t<s.length;t++)for(const i of this.chains){const o=e.find((e=>e.order==s[t]&&e.chain==i));n.push((async()=>{const e=await this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:o.sequenceColumnName,startPositionName:o.positionStartName,endPositionName:o.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight,filterSource:this.filterSource});return e.onSizeChanged.subscribe((()=>{this.calcSize()})),[t,i,e]})())}const i=await Promise.all(n);this.logos=new Array(s.length);for(let t=0;t<s.length;++t)this.logos[t]={};for(const[t,e,s]of i)this.logos[t][e]=s,this.viewSubs.push(s.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=r.table(this.chains,(t=>[...s.length>0?[r.div(t,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(s.length).keys()].map((e=>{const s=this.logos[e][t];return s.root.style.height="100%",r.div([s.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(s.length).keys()].map((t=>e.find((e=>e.order==s[t]&&e.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=r.choiceInput("Data source",this.filterSource,Object.values(At.Ct),this.filterSourceInputOnValueChanged.bind(this)),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.right="9px",this.filterSourceInput.root.style.top="-4px",Math.ceil(255*Math.random()).toString(16),this.host=r.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),this.viewSubs.push(r.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),ie.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSize(){ie.logger.debug("Bio: VdRegionsViewer.calcSize(), start");const t=()=>{if(!this.host)return;const t=(this.root.clientHeight-54)/this.chains.length;let e=0;for(let s=0;s<this.logos.length;s++){for(const e of this.chains)this.logos[s][e].root.style.height=`${t}px`;e+=Math.max(...this.chains.map((t=>this.logos[s][t].Length)))}if(this.fitWidth){if(this.logos.length>0&&e>0){const t=22,s=13,n=9,i=(this.root.clientWidth-t-(this.logos.length-1)*n-s)/e;for(let t=0;t<this.logos.length;t++)for(const e of this.chains){const s=this.logos[t][e];s.setOptions({[St.bo.positionWidth]:i-s.positionMarginValue}),s.root.style.width=i*s.Length+"px"}}this.host.style.setProperty("overflow","hidden","important")}else{for(let t=0;t<this.logos.length;t++)for(const e of this.chains)this.logos[t][e].setOptions({[St.bo.positionWidth]:this.positionWidth});this.host.style.removeProperty("overflow")}0===this.positionWidth?this.host.style.setProperty("overflow-x","hidden","important"):this.host.style.removeProperty("overflow-x")};this.calcSizeRequested||(this.calcSizeRequested=!0,window.setTimeout((()=>{t(),this.calcSizeRequested=!1}),0))}rootOnSizeChanged(t){this.calcSize()}rootOnMouseMove(t){}filterSourceInputOnValueChanged(){const t=`${this.viewerToLog()}.filterSourceInputOnValueChanged()`,e=this.filterSourceInput.value;this.viewSyncer.sync(`${t}`,(async()=>{if(this.filterSource!==e){this.props.getProperty(xt.filterSource).set(this,e);for(let t=0;t<this.logos.length;t++)for(let e=0;e<this.chains.length;e++){const s=this.chains[e];this.logos[t][s].setOptions({[St.bo.filterSource]:this.filterSource})}}}))}get onRendered(){return this._onRendered}invalidate(){const t=`${this.viewerToLog()}.invalidate()`;this.viewSyncer.sync(`${t}`,(async()=>{this._onRendered.next()}))}async awaitRendered(t=5e3){await(0,Tt.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),t)}}function Nt(t){const e=r.divH([],{style:{gap:"10px"}}),s=r.divV([r.divText(t.seqCol.name),r.divText(t.activityCol.name)]);return s.style.fontWeight="bold",s.style.display="flex",s.style.justifyContent="space-between",e.append(s),t.points.forEach((s=>{const n=r.divText(t.activityCol.get(s).toFixed(2));n.style.display="flex",n.style.justifyContent="left",n.style.paddingLeft="30px",e.append(r.divV([r.divText(t.seqCol.get(s)),n]))})),e}function _t(t){const e=r.div();e.append(r.divText(t.seqCol.name,{style:{fontWeight:"bold"}}));const s=new Array(2),n=new Array(2);t.points.forEach(((e,i)=>{s[i]=t.seqCol.get(e),n[i]=t.activityCol.get(e)}));const i={},o=Z.Cn.getOrCreate(t.seqCol),a=o.getSplitter(),l=function(t,e,s,n){const i=document.createElement("canvas"),o=i.getContext("2d");return i.height=30,ft(o,0,0,0,30,t,e,s,!0,n),i}(a(s[0]),a(s[1]),o.units,i);return e.append(r.div(l,{style:{width:"300px",overflow:"scroll"}})),e.append(function(t){const e=r.div();if(Object.keys(t).length>0){const s=r.divV([]);s.append(r.divH([r.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),r.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const e of Object.keys(t))t[e].style.borderBottom="1px solid lightgray",s.append(r.divH([r.divText((parseInt(e)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),t[e]]));e.append(s)}return e}(i)),e.append(Pt("Activity delta",Math.abs(n[0]-n[1]))),e.append(Pt("Cliff",t.sali)),e}function Pt(t,e){return r.divH([r.divText(`${t}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),r.divText(e.toFixed(2))],{style:{paddingTop:"10px"}})}function It(t,e){const s=a.Column.string("seq_diff",t.rowCount).init((s=>`${t.get(e[0],s)}#${t.get(e[1],s)}`));s.semType="MacromoleculeDifference",s.setTag(a.TAGS.UNITS,t.col(e[0]).getTag(a.TAGS.UNITS)),s.setTag("separator",t.col(e[0]).getTag("separator")),t.columns.add(s);const n=t.plot.grid();return n.col(e[0]).visible=!1,n.col(e[1]).visible=!1,n}Mt.viewerCounter=-1,s(708),s(7983);class Rt extends a.JsViewer{constructor(t){super(),this.name="",this.metricsProperties=["distanceMetric","fingerprint"],this.fingerprintChoices=["Morgan","Pattern"],this.initialized=!1,this.tags=[a.TAGS.UNITS,"aligned","separator","alphabet"],this.preComputeDistanceMatrix=!1,this.renderPromise=Promise.resolve(),this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",h.kg[0],{choices:h.kg}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=t}init(){this.initialized=!0}detach(){this.subs.forEach((t=>t.unsubscribe()))}async onTableAttached(){if(this.init(),this.dataFrame){this.preComputeDistanceMatrix=this.dataFrame.rowCount<=22e3,this.subs.push(a.debounce(this.dataFrame.onRowsRemoved,50).subscribe((t=>this.render(!0))));const t="diversity"!==this.name;this.subs.push(a.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((e=>this.render(t)))),this.subs.push(a.debounce(this.dataFrame.selection.onChanged,50).subscribe((t=>this.render(!1)))),this.subs.push(a.debounce(r.onSizeChanged(this.root),50).subscribe((t=>this.render(!1)))),this.moleculeColumn=this.dataFrame.columns.bySemType(a.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=this.moleculeColumn?.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}this.render()}onPropertyChanged(t){if(super.onPropertyChanged(t),this.initialized){if("moleculeColumnName"===t.name){const e=this.dataFrame.col(t.get(this));e.semType===a.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=e)}this.render()}}render(t=!0){this.renderPromise=this.renderPromise.then((async()=>{this.computeRequested=this.computeRequested||t,await this.renderInt(t)}))}async renderInt(t){}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==a.SEMTYPE.MACROMOLECULE&&(o.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}s(7241),s(4004),s(9943),s(6099);var Ot,Gt=s(2918),Ft=function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))};class Ht{constructor(t,e,s=!1,n){var i;this.name="",this.description="",this._isAutomatic=!1,this._autoStartFirstStep=!1,this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._isStepProcessed=!1,this._root=r.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=r.panel([],"tutorials-main-header"),this._header=r.h2(""),this._headerDiv=r.divH([],"tutorials-root-header"),this._stopStartBtn=r.button(r.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=r.button(r.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=r.button(r.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=r.panel([],"tutorials-root-description"),this._progressDiv=r.divV([],"tutorials-root-progress"),this._progress=r.element("progress"),this._progressSteps=r.divText(""),this._closeBtn=r.button(r.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=t,this.description=e,this._isAutomatic=s,this._autoStartFirstStep=null!==(i=null==n?void 0:n.autoStartFirstStep)&&void 0!==i&&i,this._progress.max=0,this._progress.value=1,Ht.currentObject=this}get steps(){return this._steps}get stepNumber(){return this._steps.length}_addHeader(){this._createHeaderDiv(),this._createProgressDiv(),this._mainHeader.append(this._headerDiv,this._progressDiv)}_createHeaderDiv(){this._header.innerText=this.name,this._headerDiv.append(this._closeBtn),this._headerDiv.append(this._header),this._nextStepBtn.firstChild.className="grok-icon fas fa-play",this._headerDiv.append(this._isAutomatic?this._stopStartBtn:this._nextStepBtn)}_createProgressDiv(){this._progress.max=this.stepNumber,this._progressDiv.append(this._progress),this._progressSteps=r.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var t;this._activity.append(r.div(this.description,"tutorials-root-description"));for(let e=0;e<this.stepNumber;e++){let s=r.iconFA("clock");this._isAutomatic||0===e&&(s=r.iconFA("play",(()=>this._nextStep()),"Next step"),s.className="grok-icon fas fa-play");const n=r.div(this._steps[e].name,"grok-tutorial-entry-instruction"),i=r.div(null===(t=this._steps[e].options)||void 0===t?void 0:t.description,"grok-tutorial-step-description hidden"),o=r.divH([s,n],"grok-tutorial-entry");this._activity.append(o,i)}}_initRoot(){var t,e,s;o.shell.windows.showContextPanel=!0,o.shell.windows.showHelp=!1;const n=Array.from(o.shell.dockManager.rootNode.children)[0];this._node=o.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,n,""),(null===(e=null===(t=n.parent.container.containerElement.firstElementChild)||void 0===t?void 0:t.lastElementChild)||void 0===e?void 0:e.classList.contains("tab-handle-list-container"))&&(null===(s=n.parent.container.containerElement.firstElementChild)||void 0===s||s.lastElementChild.remove()),this._node.container.containerElement.classList.add("tutorials-demo-script-container"),this._addHeader(),this._root.append(this._mainHeader),this._addDescription(),this._root.append(this._activity)}_nextStep(){var t,e;return Ft(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const s=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],n=this._activity.getElementsByClassName("grok-icon")[this._currentStep],i=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];n.className="grok-icon far fa-spinner-third fa-spin",i.classList.remove("hidden"),i.classList.add("visible");const o=s,a=(null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay)?null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay:2e3;yield this._steps[this._currentStep].func(),this._scrollTo(this._root,o.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(s,n,a),yield(0,Tt.gw)(a));const l=r.iconFA("check");if(n.replaceWith(l),l.className="grok-icon far fa-check",this._progress.value++,this._progressSteps.innerText=`Step: ${this._progress.value} of ${this.stepNumber}`,this._currentStep++,this._isStepProcessed=!1,this._currentStep!==this.stepNumber){if(!this._isAutomatic){const t=this._activity.getElementsByClassName("grok-icon")[this._currentStep],e=r.iconFA("play",(()=>this._nextStep()),"Next step");e.className="grok-icon fas fa-play",t.replaceWith(e),this._nextStepBtn.classList.remove("disabled"),this._nextStepBtn.firstChild.classList.remove("fa-disabled")}}else this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn)}))}_startScript(){return Ft(this,void 0,void 0,(function*(){for(let t=this._currentStep;t<this.stepNumber&&!this._isStopped&&!this._isCancelled;t++)yield this._nextStep()}))}_scrollTo(t,e){t.focus(),t.scrollTop=e}_countdown(t,e,s){return Ft(this,void 0,void 0,(function*(){const n=r.div([],"demo-script-countdown");e.classList.add("hidden");let i=s/1e3;const o=this._createSVGIndicator(i);n.append(o),t.prepend(n);const a=setInterval((()=>{i--,0===i&&(clearInterval(a),n.remove(),e.classList.remove("hidden"),e.classList.add("visible"))}),1e3)}))}_createSVGIndicator(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","circle");return s.setAttributeNS(null,"cx","7"),s.setAttributeNS(null,"cy","7"),s.setAttributeNS(null,"r","6"),s.setAttributeNS(null,"style",`animation: countdown ${t}s linear infinite forwards`),e.append(s),e}_changeStopState(){const t=this._stopStartBtn.getElementsByClassName("grok-icon");t[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(t[0].className="grok-icon fal fa-pause",this._isStepProcessed||this._startScript())}_restartScript(){o.shell.dockManager.close(this._node),o.shell.closeAll(),this._clearRoot(),this._setInitParams(),this.start()}_clearRoot(){this._root=r.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=r.panel([],"tutorials-main-header"),this._header=r.h2(""),this._headerDiv=r.divH([],"tutorials-root-header"),this._activity=r.panel([],"tutorials-root-description"),this._progressDiv=r.divV([],"tutorials-root-progress"),this._progress=r.element("progress"),this._progressSteps=r.divText(""),this._progress.max=0,this._progress.value=1}_setInitParams(){this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._stopStartBtn.getElementsByClassName("grok-icon")[0].className="grok-icon fal fa-pause",this._nextStepBtn.classList.remove("disabled")}_closeDock(){o.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,Ht.currentObject=null}step(t,e,s){return this._steps[this.steps.length]={name:t,func:e,options:s},this}start(){return Ft(this,void 0,void 0,(function*(){this._initRoot(),o.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}Ht.currentObject=null,function(t){t.X="Embed_X",t.Y="Embed_Y"}(Ot||(Ot={}));var Wt=function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))};s(7905),s(3336),s(8341);var Dt=s(2568);s(525),s(9416),new class{constructor(){this.tooltipHandlerTemp="tooltip-handler.Monomer"}};class Bt extends a.GridCellRenderer{get name(){return constants.Of.MONOMER}get cellType(){return constants.Of.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 40}render(t,e,s,n,i,o,r){if(o.gridRow<0)return;MonomerTooltipHandler.getOrCreate(o.gridColumn),t.font="12px monospace",t.textBaseline="middle",t.textAlign="center";const a=(0,ut.py)(o.cell.column.getTag("alphabet")),l=o.cell.value;if(!l)return;const c=a.get(l);t.fillStyle=c,t.fillText((0,ut.GU)(l,6),e+n/2,s+i/2,n)}}class kt extends a.Package{constructor(){super(...arguments),this._initialized=!1}get properties(){return this._properties}set properties(t){this._properties=t}get initialized(){return this._initialized}completeInit(){this._initialized=!0}handleErrorUI(t){const[e,s]=(0,J.yf)(t);o.shell.error(e),this.logger.error(e,void 0,s)}}s(8770);class Ut extends a.Widget{constructor(t){super(r.divV([])),this.viewed=!1,this.seqCol=t}async init(){const t=Z.Cn.getOrCreate(this.seqCol),e=ie.properties.TooltipWebLogo,s=this.seqCol.getTag(At.DX.tooltipWebLogo);!1===e||["false","off","disable","disabled"].includes(s)||(this.wlViewer=await this.seqCol.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.seqCol.name,backgroundColor:0,positionHeight:"Entropy",positionWidth:t.getAlphabetIsMultichar()?24:16,fixWidth:!0,fitArea:!1}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer.detach(),super.detach()}}var Vt=s(922);class $t{constructor(t,e){this.helmColumn=t,this.df=e,this.helmColumn=t}async convertToSmiles(){const t=await this.getSmilesList(),e=this.df.columns.getUnusedName(`smiles(${this.helmColumn.name})`);return a.Column.fromStrings(e,t.map((t=>null===t?"":t)))}async getSmilesList(){return(await this.convertToMolfileV2KColumn()).toList().map((t=>a.chem.convert(t,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async convertToRdKitBeautifiedMolfileColumn(){const t=await this.getSmilesList(),e=await o.functions.call("Chem:getRdKitModule"),s=t.map((t=>{if(""===t)return null;const s=e.get_mol(t);return s?(s.normalize_depiction(1),s.straighten_depiction(!0),s):null})),n=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return a.Column.fromStrings(n,s.map((t=>null===t?"":t.get_molblock())))}async convertToMolfileV2KColumn(){const t=(await this.getPolymerGraphColumn()).toList().map(((t,e)=>{const s=this.helmColumn.get(e);if(!s)return"";let n="";try{n=this.getPolymerMolfile(s,t)}catch(t){const[e,s]=(0,J.yf)(t);ie.logger.error(e,void 0,s)}finally{return n}})),e=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",e,t)}async getPolymerGraphColumn(){return await o.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(t,e){const s=new Yt(e),n=new te(t);return s.monomerSymbols.forEach(((t,e)=>{const i=s.getMonomerShifts(e);n.addMonomer(t,e,i)})),n.compileToMolfile()}}class Yt{constructor(t){this.molfileHandler=Vt._.getInstance(t)}get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(t){return{x:this.molfileHandler.x[t],y:this.molfileHandler.y[t]}}}class Kt{constructor(t,e){this.capGroupElements=[];const s=Gt.NT.instance.getBioLib().getMonomer(e,t);if(!s)throw new Error(`Monomer ${t} is not found in the library`);this.molfileWrapper=new zt(s.molfile,t),this.capGroupElements=s.rgroups.map((t=>(t.capGroupSmiles||t.capGroupSMILES).replace(/(\[|\]|\*|:|\d)/g,"")))}shiftCoordinates(t){this.molfileWrapper.shiftCoordinates(t)}getAtomLines(){return this.molfileWrapper.getAtomLines()}getBondLines(){return this.molfileWrapper.getBondLines()}removeBondedRGroups(t){this.molfileWrapper.removeRGroups(t)}capTrailingRGroups(){this.molfileWrapper.capRGroups(this.capGroupElements)}replaceRGroupWithAttachmentAtom(t,e){this.molfileWrapper.replaceRGroupWithAttachmentAtom(t,e)}getAttachmentAtomByRGroupId(t){return this.molfileWrapper.getAttachmentAtomByRGroupId(t)}deleteBondLineWithSpecifiedRGroup(t){this.molfileWrapper.deleteBondLineWithSpecifiedRGroup(t)}shiftBonds(t){this.molfileWrapper.shiftBonds(t)}}class Zt{constructor(t,e,s){this.atoms=e,this.bonds=s,this.rGroupBondPositionMap=new Map,this.rGroupIdToAtomicIndexMap=this.getRGroupIdToAtomicIdxMap(t)}getAtomicIdx(t){const e=this.rGroupIdToAtomicIndexMap.get(t);return void 0===e?null:e}removeRGroupsFromAtomBlock(t){t.forEach((t=>{if(void 0===this.rGroupIdToAtomicIndexMap.get(t))throw new Error(`Cannot find atomic index for R group ${t}`)}));const e=Array.from(this.rGroupIdToAtomicIndexMap.entries()).filter((([e,s])=>t.includes(e))).map((([t,e])=>e));this.atoms.deleteAtoms(e)}removeRGroups(t){this.removeRGroupsFromAtomBlock(t),t.forEach((t=>{const e=this.replaceRGroupInBondsByDummy(t);this.rGroupBondPositionMap.set(t,e)}))}replaceRGroupInBondsByDummy(t){const e=this.rGroupIdToAtomicIndexMap.get(t);if(this.rGroupBondPositionMap.has(t))throw new Error(`R group ${t} is already handled`);const s=this.bonds.getPositionsInBonds(e+1);if(0===s.length)throw new Error(`Cannot find position for R group ${t}`);if(s.length>1)throw new Error(`More than one position for R group ${t}`);const n=s[0];return this.bonds.replacePositionsInBondsByDummy([n]),this.bonds.removeAtomIdFromBonds(e+1),this.removeRGroupFromAtomicIdxMap(t,e),n}removeRGroupFromAtomicIdxMap(t,e){this.rGroupIdToAtomicIndexMap.delete(t);for(const[t,s]of this.rGroupIdToAtomicIndexMap)s>e&&this.rGroupIdToAtomicIndexMap.set(t,s-1)}getRGroupIdToAtomicIdxMap(t){const e=new Map;t.filter((t=>t.startsWith("M RGP"))).forEach((t=>{const s=function(t){const e=t.split(/\s+/).filter((t=>t)).slice(3).map((t=>parseInt(t))),s=new Array(e.length/2);for(let t=0;t<e.length;t+=2)s[t/2]=[e[t+1],e[t]-1];return s}(t);for(const[t,n]of s){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,n)}}));const s=t.map(((t,e)=>{if(t.startsWith("A "))return e})).filter((t=>void 0!==t)),n=s.map((e=>t[e])),i=s.map((e=>t[e+1]));n.forEach(((t,s)=>{const n=parseInt(t.split(/\s+/)[1])-1,o=parseInt(i[s].substring(1));if(e.has(o))throw new Error(`R group ${o} is already in the map`);e.set(o,n)}));const o=this.atoms.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==o.length)throw new Error(`Unaccounted R group indices: ${o}`);return e}deleteBondLineWithSpecifiedRGroup(t){const e=this.rGroupBondPositionMap.get(t);if(!e)throw new Error(`Cannot find position for R group ${t}`);const{bondLineIdx:s}=e;this.bonds.deleteBondLines([s]),this.rGroupBondPositionMap.delete(t),this.rGroupIdToAtomicIndexMap.delete(t),this.rGroupBondPositionMap.forEach((t=>{t.bondLineIdx>s&&(t.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(t,e){const s=this.rGroupBondPositionMap.get(t);if(!s)throw new Error(`Cannot find position for R group ${t}`);const{bondLineIdx:n,nodeIdx:i}=s;this.bonds.bondedAtoms[n][i]=e}getAttachmentAtomIdByRGroupId(t){const e=this.rGroupBondPositionMap.get(t);if(!e)throw new Error(`Cannot find position for R group ${t}`);const{bondLineIdx:s,nodeIdx:n}=e;return this.bonds.bondedAtoms[s][(n+1)%2]}capRGroups(t){this.rGroupIdToAtomicIndexMap.forEach(((e,s)=>{const n=t[s-1];"H"===n?(this.removeRGroups([s]),this.deleteBondLineWithSpecifiedRGroup(s)):this.atoms.replaceElementSymbol(e,n)}))}}class qt{constructor(t){this.bondedPairs=[],this.rawBondLines=[],this.rawBondLines=t,this.bondedPairs=this.rawBondLines.map((t=>[parseInt(t.substring(0,3)),parseInt(t.substring(3,6))]))}getBondLines(){return this.bondedPairs.map(((t,e)=>{if(t.some((t=>-1===t)))throw new Error(`Bonded pair ${t} contains -1`);return`${t[0].toString().padStart(3," ")}${t[1].toString().padStart(3," ")}${this.rawBondLines[e].substring(6)}`}))}get bondedAtoms(){return this.bondedPairs}deleteBondLines(t){this.rawBondLines=this.rawBondLines.filter(((e,s)=>!t.includes(s))),this.bondedPairs=this.bondedPairs.filter(((e,s)=>!t.includes(s)))}getPositionsInBonds(t){const e=[];return this.bondedPairs.forEach(((s,n)=>{s.forEach(((s,i)=>{s===t&&e.push({bondLineIdx:n,nodeIdx:i})}))})),e}replacePositionsInBondsByDummy(t,e){void 0===e&&(e=-1),t.forEach((t=>{const{bondLineIdx:s,nodeIdx:n}=t;this.bondedPairs[s][n]=e}))}removeAtomIdFromBonds(t){this.bondedPairs=this.bondedPairs.map((e=>e.map((e=>e>t?e-1:e))))}shift(t){this.bondedPairs=this.bondedPairs.map((e=>e.map((e=>e+t))))}}class Xt{constructor(t){this.coordinates=[],this.rawAtomLines=[],this.rawAtomLines=t,this.coordinates=this.rawAtomLines.map((t=>({x:parseFloat(t.substring(0,10)),y:parseFloat(t.substring(10,20))})))}get atomCoordinates(){return this.coordinates}get atomLines(){return this.rawAtomLines.map(((t,e)=>{const s=this.coordinates[e];return`${s.x.toFixed(4).padStart(10," ")}${s.y.toFixed(4).padStart(10," ")}${t.substring(20)}`}))}replaceElementSymbol(t,e){this.rawAtomLines[t]=this.rawAtomLines[t].replace("R#",e)}deleteAtoms(t){this.coordinates=this.coordinates.filter(((e,s)=>!t.includes(s))),this.rawAtomLines=this.rawAtomLines.filter(((e,s)=>!t.includes(s)))}shift(t){this.coordinates=this.coordinates.map((e=>{const s=e.x+t.x,n=e.y+t.y;if(isNaN(s)||isNaN(n))throw new Error(`Cannot shift coordinates by ${t.x}, ${t.y}`);return{x:s,y:n}}))}rotate(t){this.coordinates=this.coordinates.map((e=>{const s=e.x,n=e.y,i=s*Math.cos(t)-n*Math.sin(t),o=s*Math.sin(t)+n*Math.cos(t);if(isNaN(i)||isNaN(o))throw new Error(`Cannot rotate coordinates by ${t}`);return{x:i,y:o}}))}getRGroupAtomicIndices(){return this.rawAtomLines.map(((t,e)=>{if(t.includes("R#"))return e})).filter((t=>void 0!==t))}}class zt{constructor(t,e){this.monomerSymbol=e;const s=t.split("\n"),n=parseInt(s[3].substring(0,3)),i=parseInt(s[3].substring(3,6)),o=s.slice(4,4+n);this.atoms=new Xt(o);const r=s.slice(4+n,4+n+i);this.bonds=new qt(r),this.rGroups=new Zt(s,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}deleteBondLineWithSpecifiedRGroup(t){this.rGroups.deleteBondLineWithSpecifiedRGroup(t)}shiftCoordinates(t){this.atoms.shift(t)}rotateCoordinates(t){this.atoms.rotate(t)}getBondLines(){return this.bonds.getBondLines()}getAtomLines(){return this.atoms.atomLines}removeRGroups(t){this.rGroups.removeRGroups(t)}replaceRGroupWithAttachmentAtom(t,e){this.rGroups.replaceRGroupWithAttachmentAtom(t,e)}getAttachmentAtomByRGroupId(t){return this.rGroups.getAttachmentAtomIdByRGroupId(t)}shiftR1GroupToOrigin(){const t=this.rGroups.getAtomicIdx(1);if(null===t)throw new Error(`Cannot find R1 group for monomer ${this.monomerSymbol}`);const{x:e,y:s}=this.atoms.atomCoordinates[t];this.atoms.shift({x:-e,y:-s})}alignR2AlongX(){const t=this.rGroups.getAtomicIdx(2);if(null===t)throw new Error(`Cannot find R2 group for monomer ${this.monomerSymbol}`);const e=this.atoms.atomCoordinates[t],s=e.y/e.x,n=Math.atan(s);if(isNaN(n))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-n)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}shiftBonds(t){this.bonds.shift(t)}capRGroups(t){this.rGroups.capRGroups(t)}}class jt{constructor(t){this.simplePolymer=t,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:e,monomerTypes:s}=this.getMonomerSymbolsAndTypes();this.monomers=e,this.monomerTypes=s}get id(){return this.polymerType+this.idx.toString()}getPolymerType(){const t=new RegExp("(PEPTIDE|RNA)[0-9]+{"),e=this.simplePolymer.match(t);if(!e)throw new Error(`Unsupported polymer type in ${this.simplePolymer}`);return e[1]}getIdx(){const t=new RegExp(`${this.polymerType}([0-9]+){`),e=this.simplePolymer.match(t);if(!e)throw new Error(`Cannot parse simple polymer id from ${this.simplePolymer}`);return parseInt(e[1])}getMonomerSymbolsAndTypes(){const t=new RegExp(`${this.polymerType}${this.idx}{|}`,"g"),e=this.simplePolymer.replace(t,"").split("."),s=[],n=[];return e.forEach((t=>{const e=t.split(/\(|\)/).map((t=>t.replace(/[\[\]]/g,"")));s.push(...e);const i=e.map(((t,e)=>e%2==0?0:1));n.push(...i)})),{monomers:s,monomerTypes:n}}getBondData(){const t=[],e=this.monomerTypes.map(((t,e)=>{if(0===t)return e})).filter((t=>void 0!==t)),s=this.monomerTypes.map(((t,e)=>{if(1===t)return e})).filter((t=>void 0!==t));for(let s=0;s<e.length-1;s++){const n=e[s],i=e[s+1];t.push([{monomerIdx:n,rGroupId:2},{monomerIdx:i,rGroupId:1}])}for(let e=0;e<s.length;e++){const n=s[e],i=n-1;t.push([{monomerIdx:i,rGroupId:3},{monomerIdx:n,rGroupId:1}])}return t}}class Qt{constructor(t){const e=t.split("|");e.forEach((t=>this.validateConnectionItem(t))),this.connectionItems=e}validateConnectionItem(t){const e="(PEPTIDE|RNA)",s=new RegExp(`${e}[0-9]+,${e}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!t.match(s))throw new Error(`Cannot parse connection item from ${t}`)}getConnectionData(){const t=[];return this.connectionItems.forEach((e=>{const s=[],n=e.split(",");n[2].split("-").forEach(((t,e)=>{const i=n[e],o=t.split(":"),r={monomerIdx:parseInt(o[0])-1,rGroupId:parseInt(o[1].slice(1))};s.push({polymerId:i,bond:r})})),t.push(s)})),t}}class Jt{constructor(t){this.helm=t;const e=this.helm.split("$"),s=e[0].split("|");this.simplePolymers=s.map((t=>new jt(t))),""!==e[1]&&(this.connectionList=new Qt(e[1])),this.bondData=this.getBondData()}toString(){return this.helm}getPolymerTypeByMonomerIdx(t){return this.getSimplePolymerByMonomerIdx(t).polymerType}getSimplePolymerByMonomerIdx(t){const e=this.getMonomerIdxShifts(),s=Object.values(e).sort(((t,e)=>t-e)).find((e=>t>=e));if(void 0===s)throw new Error(`Cannot find simple polymer for monomer ${t}`);const n=Object.keys(e).find((t=>e[t]===s));return this.simplePolymers.find((t=>t.id===n))}shiftBondMonomerIds(t,e){e.forEach((e=>{e.forEach((e=>{e.monomerIdx+=t}))}))}getMonomerIdxShifts(){const t={};let e=0;return this.simplePolymers.forEach((s=>{t[s.id]=e,e+=s.monomers.length})),t}getBondData(){const t=this.getMonomerIdxShifts(),e=[];return this.simplePolymers.forEach((s=>{const n=s.getBondData(),i=t[s.id];this.shiftBondMonomerIds(i,n),e.push(...n)})),this.connectionList&&this.connectionList.getConnectionData().forEach((s=>{const n=[];s.forEach((e=>{const s=t[e.polymerId],i=e.bond;i.monomerIdx+=s,n.push(i)})),e.push(n)})),e}}class te{constructor(t){this.monomerWrappers=[],this.helm=new Jt(t),this.bondedRGroupsMap=new Map,this.helm.bondData.forEach((t=>{t.forEach((t=>{const e=t.monomerIdx,s=t.rGroupId;this.bondedRGroupsMap.get(e)||this.bondedRGroupsMap.set(e,[]),this.bondedRGroupsMap.get(e).push(s)}))}))}addMonomer(t,e,s){const n=this.helm.getPolymerTypeByMonomerIdx(e),i=new Kt(t,n);i.shiftCoordinates(s),this.monomerWrappers.push(i)}removeRGroups(){this.monomerWrappers.forEach(((t,e)=>{this.bondedRGroupsMap.has(e)&&t.removeBondedRGroups(this.bondedRGroupsMap.get(e)),t.capTrailingRGroups()}))}getAtomNumberShifts(){const t=[];let e=0;return this.monomerWrappers.forEach((s=>{t.push(e),e+=s.getAtomLines().length})),t}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((t=>{const e=t.map((t=>t.monomerIdx)),s=t.map((t=>t.rGroupId)),n=e.map((t=>this.monomerWrappers[t])),i=n[1].getAttachmentAtomByRGroupId(s[1]);n[0].replaceRGroupWithAttachmentAtom(s[0],i),n[1].deleteBondLineWithSpecifiedRGroup(s[1])}))}compileToMolfile(){const t=[],e=[];this.removeRGroups();const s=this.getAtomNumberShifts();this.monomerWrappers.forEach(((t,e)=>{t.shiftBonds(s[e])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((s=>{t.push(...s.getAtomLines()),e.push(...s.getBondLines())}));const n=t.length;if(n>999)throw new Error(`Atom count in polymer ${this.helm.toString()} is ${n} and exceeds 999`);const i=e.length;return["\nDatagrok\n",`${n.toString().padStart(3," ")}${i.toString().padStart(3," ")} 0 0 1 0 0 V2000`,t.join("\n"),e.join("\n"),"M END\n"].join("\n")}}a.DataFrame.fromCsv("seq,value\nATCCGTCGT,0.5\nTGTTCGTCA,0.4\nATGGTCGTA,0.7\nATCCGTGCA,0.1"),["1","1A","1C","2","4","4A","4B","5","6"].join(ut.CI);var ee=s(8601),se=s(3277);function ne(t){const e=["Embed_X","Embed_Y"],s=t.columns.names().filter((t=>t.includes(e[0]))).length+1;return e.map((t=>`${t}_${s}`))}const ie=new kt;function oe(){return Gt.NT.instance}function re(){return Gt.NT.instance.getBioLib()}async function ae(t,e,s,n,i,u,d,m){if(!(0,Dt.n)(e,"Activity Cliffs"))return;const p=ne(t),g={units:e.getTag(a.TAGS.UNITS),aligned:e.getTag("aligned"),separator:e.getTag("separator"),alphabet:e.getTag("alphabet")},f=u,y=e,C=async()=>await async function(t,e,s,n,i,l,u,d,m,p,g,f,y,C,T,A){H++;const b=l/100;let w,S=!1;const E=f.inputs,v=await f.apply({[E[0].name]:e,[E[1].name]:u,...m.preprocessingFuncArgs??{}}),L=await F([v.entries],d,[u],[1],"MANHATTAN",{...m,distanceFnArgs:[v.options??{}]});if(L.length!==s.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let e=0;e<L.length;++e)t.columns.addNewFloat(s[e]).init((t=>L[e][t]));const M=(0,x.sQ)(u)?1-(0,h.eo)(b):b,N=await(new _).calc(v.entries,u,M,v.options),I=await async function(t,e){const s=t.distance.map(((s,n)=>{const i=Math.abs(e.get(t.i[n])-e.get(t.j[n]));return 0!=s?i/s:1/0})),n=t.distance.map((t=>1-t)),i=t.i,o=t.j,r=new Set;return t.distance.forEach(((e,s)=>{r.add(t.i[s]),r.add(t.j[s])})),{simVals:n,saliVals:s,n1:i,n2:o,cliffsMolIds:r}}(N,i),O=function(t,e,s,n,i,o){const r=new Array(t).fill(0);for(let t=0;t!=s.length;++t)e[t]!=1/0&&(o.get(s[t])>o.get(n[t])?r[s[t]]+=e[t]:r[n[t]]+=e[t]);return a.Column.fromList("double",`sali_${i[0].substring(i[0].lastIndexOf("_"))}`,r)}(e.length,I.saliVals,I.n1,I.n2,s,i);t.columns.add(O);const G=function(t,e){const s=a.BitSet.create(t.rowCount);for(let n=0;n<t.rowCount;n++)s.set(n,e.has(n));return s}(t,I.cliffsMolIds),K=function(t){const e=t.filter((t=>t!==1/0)),s=e.reduce(((t,e)=>Math.min(t,e)),Number.MAX_VALUE),n=e.reduce(((t,e)=>Math.max(t,e)),s);return{max:n,min:s}}(I.saliVals),Z=.8/(K.max-K.min),q=o.shell.getTableView(t.name),X=q.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:s[0],yColumnName:s[1],size:O.name,color:i.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:n}),z=function(t,e,s,n,i,o,r,l){const c={from:new Uint32Array(e.n1.length),to:new Uint32Array(e.n1.length),opacities:new Float32Array(e.n1.length),colors:new Array(e.n1.length),widths:new Float32Array(e.n1.length)};for(let s=0;s<e.n1.length;s++)c.from[s]=e.n1[s],c.to[s]=e.n2[s],c.opacities[s]=e.saliVals[s]===1/0?1:.2+(e.saliVals[s]-r.min)*l,c.colors[s]=t.selection.get(c.from[s])&&t.selection.get(c.to[s])?"255,255,0":"0,128,0",c.widths[s]=1;const h=a.DataFrame.create(c.from.length);return $.forEach(((t,e)=>{h.columns.addNewString(t).init((t=>s.get(0===e?c.from[t]:c.to[t]))),function(t,e){Object.keys(e).forEach((s=>{t.tags[s]=e[s]}))}(h.col(t),o),h.col(t).semType=i})),h.columns.addNewFloat(B).init((t=>Math.abs(n.get(c.from[t])-n.get(c.to[t])))),h.columns.addNewInt(V).init((t=>t)),h.columns.addNewFloat(k).init((t=>e.saliVals[t])),h.columns.addNewFloat(U).init((t=>e.simVals[t])),h.name=`${W}${H}`,{lines:c,linesDf:h}}(t,I,e,i,p,g,K,Z),j=new R(X,s[0],s[1],z.lines,P.none),Q=T?T(z.linesDf,$).sort([k],[!1]):z.linesDf.plot.grid().sort([k],[!1]);t.temp[".cliffsDfGrid"]=Q;const J=r.button(`${z.linesDf.rowCount} cliffs`,(()=>{q.dockManager.dock(Q,"down",null,"Activity cliffs",A??.2)}));J.classList.add("scatter_plot_link","cliffs_grid"),X.root.append(J);const tt=r.switchInput("Show only cliffs",!1,(()=>{tt.value?(X.dataFrame.setTag(Y,s[0]),t.filter.and(G),D.next(s[0])):(X.dataFrame.setTag(Y,""),t.filter.setAll(!0),D.next(""))}));tt.root.classList.add("scatter_plot_link","show_only_cliffs"),X.root.append(tt.root),D.subscribe((t=>{tt.enabled=""===t||t===s[0]}));let et=!1;X.onEvent("d4-before-draw-scene").subscribe((e=>{et?et=!1:tt.value&&(setTimeout((()=>{t.filter.and(G)}),100),et=!0)}));const st=o.events.onViewerClosed.subscribe((t=>{t.args.viewer===X&&(q.dockManager.close(Q.root),st.unsubscribe(),q.subs=q.subs.filter((t=>t!==st)))}));return q.subs.push(st),z.linesDf.onCurrentCellChanged.subscribe((()=>{for(let t=0;t<z.linesDf.rowCount;t++)z.lines.widths[t]=t===z.linesDf.currentRowIdx?3:1;j.linesToRender=z.lines;const n=z.linesDf.currentCol&&z.linesDf.currentCol.name===$[1]?z.lines.to:z.lines.from,a=-1!==z.linesDf.currentRowIdx?z.linesDf.currentRowIdx:null;if(X.dataFrame.currentRowIdx=a?n[a]:-1,null!==a){const n=z.linesDf.currentRowIdx;j.currentLineId=n;const{zoomLeft:l,zoomRight:c,zoomTop:h,zoomBottom:u}=function(t,e,s,n,i,o){const r=Math.abs(s-i),a=Math.abs(n-o),l=t/r,c=e/a,h=Math.min(l,c),u=t/h*5,d=e/h*5,m=(s<i?s:i)+r/2-u/2,p=(n>o?n:o)-a/2+d/2;return{zoomLeft:m,zoomRight:m+u,zoomTop:p,zoomBottom:p-d}}(X.viewport.width,X.viewport.height,X.dataFrame.get(s[0],z.lines.from[n]),X.dataFrame.get(s[1],z.lines.from[n]),X.dataFrame.get(s[0],z.lines.to[n]),X.dataFrame.get(s[1],z.lines.to[n]));X.zoom(l,h,c,u),tt.value?t.filter.and(G):!0===tt.enabled&&t.filter.setAll(!0),setTimeout((()=>{!function(t,e,s,n,i,a,l,c,h){const u=e.getPane("Cliff Details");r.empty(u.root);const d=h({points:[s,n],lineId:i,df:t,seqCol:a,activityCol:l,sali:c});u.root.append(d),setTimeout((()=>{o.shell.o=e.root}),500)}(t,w,z.lines.from[a],z.lines.to[a],a,e,i,z.linesDf.get(k,a),C);const s=X.dataFrame.getSortedOrder(q.grid.sortByColumns,q.grid.sortTypes);q.grid.scrollToCell(e.name,s.indexOf(X.dataFrame.currentRowIdx))}),1e3)}})),z.linesDf.onSelectionChanged.subscribe((e=>{setTimeout((()=>(()=>{const e=a.BitSet.create(t.rowCount);for(let t=0;t<z.linesDf.rowCount;t++){const s=z.linesDf.selection.get(t);s&&(e.set(z.lines.from[t],!0),e.set(z.lines.to[t],!0)),z.lines.colors[t]=s?"255,255,0":"0,128,0"}t.selection.copyFrom(e),j.linesToRender=z.lines})()),100)})),t.onSelectionChanged.subscribe((e=>{!1===t.selection.anyTrue&&"number"==typeof e&&(S?S=!1:(t=>{t.selection.setAll(!1);for(let t=0;t<z.lines.colors.length;t++)z.lines.colors[t]="0,128,0";j.linesToRender=z.lines})(Q.dataFrame))})),j.lineClicked.subscribe((e=>{if(S=!0,j.currentLineId=e.id,-1!==e.id){const s=z.linesDf.selection.clone();setTimeout((()=>{e.event.ctrlKey?(s.set(e.id,!s.get(e.id)),z.linesDf.selection.copyFrom(s)):(z.linesDf.currentRowIdx!==e.id&&(z.linesDf.currentRowIdx=e.id,t.currentRowIdx=z.lines.from[e.id]),z.linesDf.selection.copyFrom(s));const n=z.linesDf.getSortedOrder(Q.sortByColumns,Q.sortTypes);Q.scrollToCell($[0],n.indexOf(e.id))}),500)}})),j.lineHover.pipe((0,c.debounceTime)(500)).subscribe((s=>{-1!==s.id&&-1===t.mouseOverRowIdx&&r.tooltip.show(y({lineId:s.id,points:[z.lines.from[s.id],z.lines.to[s.id]],df:t,seqCol:e,activityCol:i}),s.x,s.y)})),X.addProperty("similarityLimit","double",b),w=function(){const t=r.accordion(),e=r.element("i");return e.className="grok-icon svg-icon svg-view-layout",t.addTitle(r.span([e,r.label("Activity cliffs")])),t.addPane("Cliff Details",(()=>r.divText("Cliff has not been selected")),!0),o.shell.o=t.root,t}(),X}(t,y,p,"Activity cliffs",s,n,f,i,{...m??{}},a.SEMTYPE.MACROMOLECULE,g,d,Nt,_t,It),T=i===l.A.UMAP?2e5:2e4,A=i===l.A.UMAP?5e3:2e3;if(t.rowCount>T)return void o.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${T}`);const b=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((e,s)=>{t.rowCount>A&&!m?.[se.sS]?r.dialog().add(r.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{C().then((t=>e(t))).catch((t=>s(t)))})).onCancel((()=>{e(void 0)})).show():C().then((t=>e(t))).catch((t=>s(t)))})).catch((t=>{const[e,s]=(0,J.yf)(t);throw ie.logger.error(e,void 0,s),t})).finally((()=>{b.close()}))}async function le(t,e,n,i,l,c,h,u){if((0,Dt.n)(e,"Sequence Space"))return c||(c=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),h??(h={}),await async function(t,e,n,i,l,c,h,u=!0,d=!1,m={preprocessingFuncArgs:[]},p={}){const g={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(e.length!==i.length||e.length!==c.length||e.length!==l.length||e.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const f=async()=>{const f=a.TaskBarProgressIndicator.create(`Initializing ${p.scatterPlotName??"dimensionality reduction"} ...`);let y;try{const C=ne(t);function T(e,s,n){let i=null,l=null;t.columns.names().includes(C[0])?(i=t.columns.byName(C[0]),l=t.columns.byName(C[1])):(i=t.columns.add(a.Column.float(C[0],t.rowCount)),l=t.columns.add(a.Column.float(C[1],t.rowCount)),u&&!y&&(y=o.shell.tableView(t.name).scatterPlot({...g,x:C[0],y:C[1],title:p.scatterPlotName??"Embedding space"}))),p[se.Ec]&&(y?.root&&r.setUpdateIndicator(y.root,!1),i.init((t=>n[0]?n[0][t]:void 0)),l.init((t=>n[1]?n[1][t]:void 0)));const c=e/s*100;f.update(c,`Running ${p.scatterPlotName??"dimensionality reduction"}... ${c.toFixed(0)}%`)}async function A(){t.columns.add(a.Column.float(C[0],t.rowCount)),t.columns.add(a.Column.float(C[1],t.rowCount));let s=null;u&&(y=o.shell.tableView(t.name).scatterPlot({...g,x:C[0],y:C[1],title:p.scatterPlotName??"Embedding space"}),r.setUpdateIndicator(y.root,!0));const d=o.events.onViewerClosed.subscribe((t=>{const e=t.args.viewer;e?.getOptions()?.look?.title&&y?.getOptions()?.look?.title&&e?.getOptions()?.look?.title===y?.getOptions()?.look?.title&&(o.events.fireCustomEvent(O,{}),d.unsubscribe(),s?.(),f.close())})),A=new Promise((async(t,o)=>{try{s=t;const o=[];for(let t=0;t<c.length;++t){const s=c[t];if(m.distanceFnArgs||(m.distanceFnArgs=[]),s){const n=s.inputs[0].name,r=s.inputs[1].name,{entries:a,options:l}=await s.apply({[n]:e[t],[r]:i[t],...m.preprocessingFuncArgs[t]??{}});o.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const s=e[t].toList(),n={};o.push({entries:s,options:n}),m.distanceFnArgs.push(n)}}t(await F(o.map((t=>t.entries)),n,i,l,h,m,p[se.sS]?void 0:T))}catch(t){o(t)}})),b=await A;return f.close(),d.unsubscribe(),b}const b=await A();if(d&&b){const w=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const S=await function(t,e,n,i){return Wt(this,void 0,void 0,(function*(){return new Promise((function(o,r){const a=new Worker(new URL(s.p+s.u(796),s.b));a.postMessage({embedX:t,embedY:e,minPts:i,epsilon:n}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?r(t):o(e)}}))}))}(b[0],b[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),E=t.columns.getUnusedName("Cluster");t.columns.addNewString(E).init((t=>S[t].toString())),y&&(y.props.colorColumnName=E)}catch(v){o.shell.error("Clustering embeddings failed"),console.error(v)}finally{w.close()}}if(b&&u&&y){r.setUpdateIndicator(y.root,!1);const x=t.columns.byName(C[0]),L=t.columns.byName(C[1]);return x.init((t=>b[0][t])),L.init((t=>b[1][t])),y}}catch(M){o.shell.error("Dimensionality reduction failed"),console.error(M),f.close(),y&&r.setUpdateIndicator(y.root,!1)}};return new Promise((async(e,s)=>{try{if(p.fastRowCount&&t.rowCount>p.fastRowCount&&!p[se.sS])r.dialog().add(r.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const t=await f();e(t)}catch(t){s(t)}})).onCancel((()=>e(void 0))).show();else{const t=await f();e(t)}}catch(t){s(t)}}))}(t,[e],n,[i],[1],[c],"MANHATTAN",l,u??!1,{...h,preprocessingFuncArgs:[h.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:h?.[se.sS]})}async function ce(t,e,s){const n=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{await async function(t,e,s){if(0===a.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void o.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(s){const s=Z.Cn.getOrCreate(e);return s.isHelm()||(e=s.convert(ut.r2.HELM)),void async function(t,e){const s=await async function(t,e){const s=new $t(e,t),n=await s.convertToRdKitBeautifiedMolfileColumn();return n.semType=a.SEMTYPE.MOLECULE,n}(t,e);t.columns.add(s,!0),await o.data.detectSemanticTypes(t)}(t,e)}if(!(0,Dt.n)(e,"To Atomic Level"))return;const n=oe().getBioLib(),i=await(0,ee.i0)(t,e,n);null!==i.col&&(t.columns.add(i.col,!0),await o.data.detectSemanticTypes(t)),i.warnings&&i.warnings.length>0&&o.shell.warning(r.list(i.warnings))}(t,e,s)}finally{n.close()}}function he(t){return new q.i(t).importFasta()}function ue(t){const e=Z.Cn.getOrCreate(t).stats;return Object.keys(e.freq)}async function de(t,e,s){return Q(t,e,s,K.IDENTITY)}async function me(t,e,s){return Q(t,e,s,K.SIMILARITY)}},7983:(t,e,s)=>{"use strict";s.d(e,{QF:()=>c,pf:()=>l});var n=s(4469),i=(s(3870),s(976)),o=s(7241),r=(s(4293),s(8467)),a=s(8447);function l(t,e,s){const n=s?function(t,e){const s=`${e}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n=t.charAt(0)===e,i=t.charAt(t.length-1)===e,o=t.replace(new RegExp(`^${s}|${s}$`,"g"),"");return n?i?`${s}${o}${s}`:`${s}${o}${s}|${s}${o}$`:i?`^${o}${s}|${s}${o}${s}`:`^${o}${s}|${s}${o}${s}|${s}${o}$`}(t,s):t,o=i.BitSet.create(e.length);for(let s=0;s<e.length;s++){const i=e.get(s);(i.match(n)||i===t)&&o.set(s,!0,!1)}return o}async function c(t,e){e.version!==e.temp["last-invalidated-version"]&&await async function(t,e){const s=i.TaskBarProgressIndicator.create(`Invalidating molfiles for ${t.name}`);try{await(0,r.gw)(10);const e=new Map,s=await(0,o.D)(t,!0,e);t.temp["monomeric-mols"]=s,t.temp["monomers-dict"]=e,t.temp["last-invalidated-version"]=t.version}finally{s.close()}}(e);const s=i.Column.string("helm",1).init((e=>t));s.semType=i.SEMTYPE.MACROMOLECULE,s.setTag(i.TAGS.UNITS,a.r2.HELM);const l=await(0,o.D)(s,!0,e.temp["monomers-dict"]);return(await n.functions.call("Chem:searchSubstructure",{molStringsColumn:e.temp["monomeric-mols"],molString:l.get(0),molBlockFailover:""})).get(0)}},2568:(t,e,s)=>{"use strict";s.d(e,{l:()=>a,n:()=>r});var n=s(4469),i=s(976),o=s(499);function r(t,e,s=[],i=[],o=!0){const[r,l]=a(t,e,s,i);return o&&!r&&n.shell.warning(l),r}function a(t,e,s=[],r=[]){let a=!0,l="";const c=o.Cn.getOrCreate(t);if(t.semType!==i.SEMTYPE.MACROMOLECULE)n.shell.warning(e+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const t=c.notation;if(s.length>0&&!s.some((e=>t.toUpperCase()==e.toUpperCase())))l=`${e} + ' analysis is allowed for Macromolecules with notation ${0==s.length?"any notation":`notation${s.length>1?"s":""} ${s.map((t=>`"${t}"`)).join(", ")} `}.`,a=!1;else if(!c.isHelm()){const t=c.alphabet;r.length>0&&!r.some((e=>t.toUpperCase()==e.toUpperCase()))&&(l=`${e} + ' analysis is allowed for Macromolecules with alphabet ${0==r.length?"any alphabet":`alphabet${r.length>1?"s":""} ${r.map((t=>`"${t}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}},3553:(t,e,s)=>{"use strict";s.d(e,{Of:()=>o,WY:()=>h,jB:()=>u,mU:()=>a,rs:()=>c});var n,i,o,r=s(8341);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="~activity",t.ACTIVITY_SCALED="activity_scaled",t.ALIGNED_SEQUENCE="~aligned_sequence",t.AMINO_ACID_RESIDUE="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference"}(n||(n={})),function(t){t.AAR="AAR",t.POSITION="Pos",t.SELECTION="selection"}(i||(i={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",t.ACTIVITY="activity",t.ACTIVITY_SCALED="activityScaled"}(o||(o={}));const a="MSA";var l,c;!function(t){t.CELL_CHANGING="isCellChanging"}(l||(l={})),function(t){t.SEPARATOR="."}(c||(c={}));const h="3.3.1",u={pepsea:{gapOpen:1.53,gapExtend:0,method:r.Jy[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},4004:(t,e,s)=>{"use strict";s.d(e,{o:()=>o}),s(976),s(3870);var n=s(4469),i=(s(3336),s(8447),s(499));async function o(t,e,s){const o=i.Cn.getOrCreate(t).convert(e,s);t.dataFrame.columns.add(o);const r=await n.functions.call("Bio:detectMacromolecule",{col:o});return r&&(o.semType=r),await n.data.detectSemanticTypes(t.dataFrame),o}},2918:(t,e,s)=>{"use strict";s.d(e,{NT:()=>y,P4:()=>g});var n=s(4469),i=(s(3870),s(976)),o=s(701),r=s(6584),a=s(922),l=s(1047);class c{constructor(t){this.rawLib=t}isValid(){return this.rawLib.every((t=>"object"==typeof t&&Object.values(l.Wc).every((e=>e in t&&"string"==typeof t[e]))))}getJsonMonomerLib(){const t=[];return this.rawLib.forEach((e=>{const s=this.prepareMonomer(e);t.push(s)})),t}prepareMonomer(t){const e={...l.Z2};Object.entries(l.Wc).forEach((([s,n])=>{const i=t[n];e[s]=i}));let s="smiles";const n=t[l.Wc[s]],i=new h(n),o=i.getCappedSmiles();return e[s]=o,s="rgroups",e[s]=u.getRGroups(i.getNumberOfRGroups()),s="molfile",e[s]=new d(i.getSmilesWithRGroups()).getMolfile(),e}}class h{constructor(t){let e=0;this.smilesWithRGroups=t.replace(/\[R(\d+)\]/g,((t,s)=>(++e,`[${s}*]`))),this.numberOfRGroups=e}getSmilesWithRGroups(){return this.smilesWithRGroups}getCappedSmiles(){return this.capRGroups()}getNumberOfRGroups(){return this.numberOfRGroups}capRGroups(){let t=this.smilesWithRGroups.replace("[1*]","[H:1]");return t=t.replace("[2*]","[OH:2]"),t.replace("[3*]","[H:3]")}}class u{constructor(){}static getRGroups(t){return l.nJ.slice(0,t)}}class d{constructor(t){this.smilesWithRGroups=t}getMolfile(){let t=i.chem.convert(this.smilesWithRGroups,i.chem.Notation.Smiles,i.chem.Notation.MolBlock);return t=this.restoreRGPLine(t),t=this.fixRGroupSymbols(t),t}restoreRGPLine(t){return t.replace("M ISO","M RGP")}fixRGroupSymbols(t){return t.replace(/\bR\b/g,"R#")}}var m=s(7228),p=s(4955);async function g(){return await Promise.all((await n.dapi.files.list(r.BX,!0,"")).map((async t=>t.fullPath.substring(r.BX.length))))}class f{constructor(t,e){this._monomers={},this._onChanged=new o.Subject,this._monomers=t,this.error=e}getMonomer(t,e){return t in this._monomers&&e in this._monomers[t]?this._monomers[t][e]:null}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(t){const e={};return Object.keys(this._monomers[t]??{}).forEach((s=>{e[s]=this._monomers[t][s].molfile})),e}getMonomerSymbolsByType(t){return Object.keys(this._monomers[t])}getMonomerSymbolsByRGroup(t,e,s){let n=this.getMonomerSymbolsByType(e).map((t=>this.getMonomer(e,t)));return n=n.filter((t=>null!==t)),0===n.length?[]:(n=n.filter((e=>{if(!e?.rgroups)return!1;let s=e?.rgroups.length>=t;return a._.getInstance(e.molfile).atomTypes.map(((t,e)=>"R#"===t?e:-1)).filter((t=>-1!==t)),s&&(s=!0),s})),n.map((t=>t?.symbol)))}get onChanged(){return this._onChanged}_updateInt(t){const e=t.getPolymerTypes(),s=this.getPolymerTypes();e.forEach((e=>{s.includes(e)||(this._monomers[e]={}),t.getMonomerSymbolsByType(e).forEach((s=>{this._monomers[e][s]=t.getMonomer(e,s)}))}))}update(t){this._updateInt(t),this._onChanged.next()}updateLibs(t,e=!1){e&&(this._monomers={});for(const e of t)e.error||this._updateInt(e);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}}class y{constructor(){this._monomerLib=new f({}),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}async loadLibraries(t=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{try{const[e,s]=await Promise.all([g(),(0,r.nW)()]),n=e.filter((t=>!s.exclude.includes(t))).filter((t=>!(s.explicit.length>0)||s.explicit.includes(t))),i=await Promise.all(n.map((t=>this.readLibrary(r.BX,t).catch((e=>{const s=`Loading monomers from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new f({},s)})))));this._monomerLib.updateLibs(i,t)}catch(t){const e=`Loading monomer libraries error: ${t instanceof Error?t.message:t.toString()}`;n.shell.warning(e);const s=t instanceof Error?t.stack:void 0;p._package.logger.error(e,void 0,s)}}))}async readLibrary(t,e){let s,o,r=[];const a=new i.FileSource(t);if(e.endsWith(".sdf"))1===i.Func.find({package:"Chem",name:"importSdf"}).length?(s=await a.readAsBytes(e),o=await n.functions.call("Chem:importSdf",{bytes:s}),r=(0,m.Xk)(o[0])):n.shell.warning("Chem package is not installed");else if(e.endsWith(".json")){const t=await a.readAsText(e);r=JSON.parse(t)}else{if(!e.endsWith(".csv"))throw new Error("Monomer library of unknown file format, supported formats: SDF, JSON, CSV");{const t=(l=await a.readCsv(e),Array.from({length:l.rowCount},((t,e)=>l.columns.names().reduce(((t,s)=>(t[s]=l.get(s,e),t)),{})))),s=new c(t);if(!s.isValid())throw new Error("Invalid format of CSV monomer lib");r=s.getJsonMonomerLib()}}var l;const h={},u=[];return r.forEach((t=>{u.includes(t.polymerType)||(h[t.polymerType]={},u.push(t.polymerType)),h[t.polymerType][t.symbol]=t})),new f(h)}async selectSpecifiedLibraries(t){const e=await this.getInvalidFileNames(t);if(e.length>0)throw new Error(`Cannot select libraries ${e}: no such library in the list`);const s=await(0,r.nW)();s.exclude=(await g()).filter((e=>!t.includes(e))),await(0,r.tW)(s)}async getInvalidFileNames(t){const e=await g();return t.filter((t=>!e.includes(t)))}static get instance(){return window.$monomerLibHelper||(window.$monomerLibHelper=new y),window.$monomerLibHelper}}},525:(t,e,s)=>{"use strict";s.d(e,{K:()=>M});var n=s(4469),i=s(976),o=s(3870),r=s(8447),a=s(499),l=s(6098),c=s(8341),h=s(2568),u=s(3553),d=s(4955),m=s(3379),p=s.n(m),g=s(7795),f=s.n(g),y=s(569),C=s.n(y),T=s(3565),A=s.n(T),b=s(9216),w=s.n(b),S=s(4589),E=s.n(S),v=s(9564),x={};x.styleTagTransform=E(),x.setAttributes=A(),x.insert=C().bind(null,"head"),x.domAPI=f(),x.insertStyleElement=w(),p()(v.Z,x),v.Z&&v.Z.locals&&v.Z.locals;class L extends Error{constructor(t,e){super(t,e)}}async function M(t={}){return new Promise((async(e,s)=>{var r,a,l;t.clustersCol??(t.clustersCol=null),t.pepsea??(t.pepsea={}),(r=t.pepsea).method??(r.method=u.jB.pepsea.method),(a=t.pepsea).gapOpen??(a.gapOpen=u.jB.pepsea.gapOpen),(l=t.pepsea).gapExtend??(l.gapExtend=u.jB.pepsea.gapExtend);const h=t.col?.dataFrame??n.shell.t,d=t.col??h.columns.bySemType(i.SEMTYPE.MACROMOLECULE);if(null==d){const t="MSAError: dataset doesn't conain any Macromolecule column";n.shell.warning(t),s(new L(t))}const m=o.choiceInput("Method",t.pepsea.method,c.Jy);m.setTooltip("Alignment method");const p=o.floatInput("Terminal gap",t?.kalign?.terminalGap??null);p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const g=o.p(`Kalign version: ${u.WY}`,"kalign-version"),f=o.floatInput("Gap open",t.pepsea.gapOpen);f.setTooltip("Gap opening penalty at group-to-group alignment");const y=o.floatInput("Gap extend",t.pepsea.gapExtend);y.setTooltip("Gap extension penalty to skip the alignment");const C=o.inputs([f,y,p]),T=o.button("Alignment parameters",(()=>{C.hidden=!C.hidden}),"Adjust alignment parameters such as penalties for opening and extending gaps");T.classList.add("msa-params-button"),C.hidden=!0,T.prepend(o.icons.settings((()=>null)));const A=[m.root.style],b=[p.root.style,g.style];let w;const S=o.columnInput("Sequence",h,d,(async()=>{w=await _(S.value,h,A,b,m,E,f,y,p)}),{filter:t=>t.semType===i.SEMTYPE.MACROMOLECULE});S.setTooltip("Sequences column to use for alignment");const E=o.columnInput("Clusters",h,t.clustersCol);if(E.nullable=!0,S.fireChanged(),t.col)return w=await _(t.col,h,A,b,m,E,f,y,p),void await N(S,h,w,e,s);o.dialog("MSA").add(S).add(E).add(m).add(C).add(T).add(g).onOK((async()=>{await N(S,h,w,e,s)})).show()}))}async function N(t,e,s,o,r){let a=null;const l=i.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(t.fireChanged(),t.value.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===s)throw new Error("Invalid column format");if(a=await s(),null==a)return r("PepSeA container has not started");e.columns.add(a),await n.data.detectSemanticTypes(e),o(a)}catch(t){const e=t instanceof Error?t.message:t.toString();n.shell.error(e),r(t)}finally{l.close()}}async function _(t,e,s,o,m,p,g,f,y){try{if(t.semType!==i.SEMTYPE.MACROMOLECULE)return;const n=e.columns.getUnusedName(`msa(${t.name})`);if((0,h.n)(t,t.name,[r.r2.FASTA,r.r2.SEPARATOR],["DNA","RNA","PT"],!1)){P(s,o,"kalign"),g.value=null,f.value=null,y.value=null;const e=a.Cn.getOrCreate(t),i=e.isFasta()?t:e.convert(r.r2.FASTA);return async()=>await(0,l.U)(i,!1,n,p.value)}if((0,h.n)(t,t.name,[r.r2.HELM],[],!1))return P(s,o,"pepsea"),g.value??(g.value=u.jB.pepsea.gapOpen),f.value??(f.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(t,n,m.value,g.value,f.value,p.value);if((0,h.n)(t,t.name,[r.r2.SEPARATOR],["UN"],!1)){const e=a.Cn.getOrCreate(t).convert(r.r2.HELM);return P(s,o,"pepsea"),g.value??(g.value=u.jB.pepsea.gapOpen),f.value??(f.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(e,n,m.value,g.value,f.value,p.value)}return g.value=null,f.value=null,y.value=null,void P(s,o,"kalign")}catch(t){const e=t instanceof Error?t.message:t.toString();n.shell.error(e),d._package.logger.error(e)}}function P(t,e,s){if("kalign"===s){for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}else{for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}}},6098:(t,e,s)=>{"use strict";s.d(e,{U:()=>O});var n=s(976),i=s(5226);const o=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.thrown"),c=t=>"object"==typeof t&&null!==t||"function"==typeof t,h=new Map([["proxy",{canHandle:t=>c(t)&&t[o],serialize(t){const{port1:e,port2:s}=new MessageChannel;return u(t,e),[s,[s]]},deserialize:t=>(t.start(),m(t))}],["throw",{canHandle:t=>c(t)&&l in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}}]]);function u(t,e=self){e.addEventListener("message",(function s(n){if(!n||!n.data)return;const{id:i,type:r,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(A);let h;try{const e=a.slice(0,-1).reduce(((t,e)=>t[e]),t),s=a.reduce(((t,e)=>t[e]),t);switch(r){case"GET":h=s;break;case"SET":e[a.slice(-1)[0]]=A(n.data.value),h=!0;break;case"APPLY":h=s.apply(e,c);break;case"CONSTRUCT":h=function(t){return Object.assign(t,{[o]:!0})}(new s(...c));break;case"ENDPOINT":{const{port1:e,port2:s}=new MessageChannel;u(t,s),h=function(t,e){return C.set(t,e),t}(e,[e])}break;case"RELEASE":h=void 0;break;default:return}}catch(t){h={value:t,[l]:0}}Promise.resolve(h).catch((t=>({value:t,[l]:0}))).then((t=>{const[n,o]=T(t);e.postMessage(Object.assign(Object.assign({},n),{id:i}),o),"RELEASE"===r&&(e.removeEventListener("message",s),d(e))}))})),e.start&&e.start()}function d(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function m(t,e){return g(t,[],e)}function p(t){if(t)throw new Error("Proxy has been released and is not useable")}function g(t,e=[],s=function(){}){let n=!1;const i=new Proxy(s,{get(s,o){if(p(n),o===a)return()=>b(t,{type:"RELEASE",path:e.map((t=>t.toString()))}).then((()=>{d(t),n=!0}));if("then"===o){if(0===e.length)return{then:()=>i};const s=b(t,{type:"GET",path:e.map((t=>t.toString()))}).then(A);return s.then.bind(s)}return g(t,[...e,o])},set(s,i,o){p(n);const[r,a]=T(o);return b(t,{type:"SET",path:[...e,i].map((t=>t.toString())),value:r},a).then(A)},apply(s,i,o){p(n);const a=e[e.length-1];if(a===r)return b(t,{type:"ENDPOINT"}).then(A);if("bind"===a)return g(t,e.slice(0,-1));const[l,c]=y(o);return b(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:l},c).then(A)},construct(s,i){p(n);const[o,r]=y(i);return b(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:o},r).then(A)}});return i}function f(t){return Array.prototype.concat.apply([],t)}function y(t){const e=t.map(T);return[e.map((t=>t[0])),f(e.map((t=>t[1])))]}const C=new WeakMap;function T(t){for(const[e,s]of h)if(s.canHandle(t)){const[n,i]=s.serialize(t);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:t},C.get(t)||[]]}function A(t){switch(t.type){case"HANDLER":return h.get(t.name).deserialize(t.value);case"RAW":return t.value}}function b(t,e,s){return new Promise((n=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(s){!s.data||!s.data.id||s.data.id!==i||(t.removeEventListener("message",e),n(s.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),s)}))}const w="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksdT0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgYz1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxoKT0+ZFtoXSxlKSxmPW4ucmVkdWNlKChkLGgpPT5kW2hdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjpjW24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkoYyx1KTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4udSk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOmh9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUsaCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaChjKXtsPXt2YWx1ZTpjLFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2goYz0+KHt2YWx1ZTpjLFt5XTowfSkpLnRoZW4oYz0+e2NvbnN0W2YsZF09UyhjKTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLEYocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBGKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBwKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYocChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKHU9PnUudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57RihlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCB1PWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiB1LnRoZW4uYmluZCh1KX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbix1KXtwKHMpO2NvbnN0W2wsY109Uyh1KTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sYykudGhlbihtKX0sYXBwbHkoYSxuLHUpe3Aocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W2MsZl09TSh1KTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDpjfSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtwKHMpO2NvbnN0W3UsbF09TShuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAoYz0+Yy50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6dX0sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIE0oZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLHg9ImVhZ2VyIixrPSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgdT1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHt1fWApLHQuZnMuc3ltbGluayh1LGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIHU7bGV0IG49aTtyZXR1cm4oKHU9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOnUuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09ayYmKHMubG9hZGluZz14LGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtpZih0LmNvbmZpZy5wcmludEludGVybGVhdmVkJiYobz1zLnN0ZG91dCkscy5yZWluaXQ9PT0hMCl7Y29uc3QgYT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocyxzLmNvbmZpZykscy5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxzLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoYSl9cmV0dXJuIG99LGNhdChlKXtyZXR1cm4gdC5fZmlsZW9wKCJjYXQiLGUpfSxscyhlKXtyZXR1cm4gdC5fZmlsZW9wKCJscyIsZSl9LGRvd25sb2FkKGUpe3JldHVybiB0Ll9maWxlb3AoImRvd25sb2FkIixlKX0scHdkKCl7cmV0dXJuIHQuZnMuY3dkKCl9LGNkKGUpe2ZvcihsZXQgciBvZiB0LnRvb2xzKSFyLm1vZHVsZXx8ci5tb2R1bGUuRlMuY2hkaXIoZSl9LG1rZGlyKGUpe3JldHVybiB0LmZzLm1rZGlyKGUpLCEwfSxyZWFkKHtwYXRoOmUsbGVuZ3RoOnIsZmxhZzppPSJyIixvZmZzZXQ6cz0wLHBvc2l0aW9uOm89MH0pe2NvbnN0IGE9dC5mcy5vcGVuKGUsaSksbj1uZXcgVWludDhBcnJheShyKTtyZXR1cm4gdC5mcy5yZWFkKGEsbixzLHIsbyksdC5mcy5jbG9zZShhKSxufSx3cml0ZSh7cGF0aDplLGJ1ZmZlcjpyLGZsYWc6aT0idysiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKTt0LmZzLndyaXRlKGEscixzLHIubGVuZ3RoLG8pLHQuZnMuY2xvc2UoYSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz14KSxlLmxvYWRpbmc9PT1rKXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+ZS5zdGRvdXQrPWAke2l9CmAscHJpbnRFcnI6dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD9pPT5lLnN0ZG91dCs9YCR7aX0KYDppPT5lLnN0ZGVycis9YCR7aX0KYH0pO2NvbnN0IHI9ZS5tb2R1bGUuRlM7ZS5pc0Jhc2VNb2R1bGU/KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBiYXNlIG1vZHVsZSBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWAsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJNb3VudGVkfWAsNTExKSxyLmNoZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWApLHQuZnM9cik6KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQpLHIubW91bnQoZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDp0LmNvbmZpZy5kaXJTaGFyZWQsZnM6dC5mc30sdC5jb25maWcuZGlyU2hhcmVkKSxyLmNoZGlyKHQuZnMuY3dkKCkpKSxlLnN0ZG91dD0iIixlLnN0ZGVycj0iIixlLnJlYWR5PSEwfSxhc3luYyBfc2V0dXBGUygpe2NvbnN0IGU9dC5mcztmb3IobGV0IHIgb2YgdC50b29scyl7aWYoIXIucmVhZHkpY29udGludWU7Y29uc3QgaT1yLm1vZHVsZS5GUyxzPWAvJHtyLnRvb2x9YCxvPWAke3QuY29uZmlnLmRpclNoYXJlZH0ke3N9YDshaS5hbmFseXplUGF0aChzKS5leGlzdHN8fGUuYW5hbHl6ZVBhdGgobykuZXhpc3RzfHwodC5fbG9nKGBNb3VudGluZyAke3N9IG9udG8gJHt0LmJhc2UudG9vbH0gZmlsZXN5c3RlbSBhdCAke299YCksZS5ta2RpcihvKSxlLm1vdW50KHQuYmFzZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDpzLGZzOml9LG8pKX19LF9maWxlb3AoZSxyKXt0Ll9sb2coYFJ1bm5pbmcgJHtlfSAke3J9YCk7Y29uc3QgaT10LmZzLmFuYWx5emVQYXRoKHIpO2lmKCFpLmV4aXN0cylyZXR1cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",S=typeof window<"u"&&window.Blob&&new Blob([atob(w)],{type:"text/javascript;charset=utf-8"});function E(){const t=S&&(window.URL||window.webkitURL).createObjectURL(S);try{return t?new Worker(t):new Worker("data:application/javascript;base64,"+w)}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}const v={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,callback:null,debug:!1,env:"prd"};class x{constructor(t,e={}){if(null==t)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(t)||(t=[t]),e=Object.assign({},v,e),t=t.map(this._parseTool),"stg"===e.env&&(e.urlCDN=e.urlCDNStg),this.tools=t,this.config=e,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const t=new E;this.callback&&(t.onmessage=t=>{"biowasm"===t.data.type&&this.callback(t.data.value)});const e=m(t);return e.tools=this.tools,e.config=this.config,await e.init(),e}_parseTool(t){if("string"!=typeof t)return t;const e=t.split("/");if(2!=e.length&&3!=e.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:e[0],program:3==e.length?e[1]:e[0],version:e[e.length-1]}}}var L=s(850);class M{static getAvailableScales(){return Object.entries(this.scales).map((([t,e])=>t))}static getScale(t){return(0,L.hu)(!(void 0===this.scales[t]),`Scale '${t}' was not found.`),this.scales[t]}}M.scales={WimleyWhite:{"-":0,A:.17,C:-.24,D:-.07,E:-.01,F:-1.13,G:.01,H:.17,I:-.31,K:.99,L:-.56,M:-.23,N:.42,P:.45,Q:.58,R:.81,S:.13,T:.14,V:.07,W:-1.85,Y:-.94},categorial:{"-":0,A:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,K:9,L:10,M:11,N:12,P:13,Q:14,R:15,S:16,T:17,V:18,W:19,Y:20}};class N{constructor(t="categorial"){this.aa2num=M.getScale(t),this.num2aa={},Object.entries(this.aa2num).forEach((([t,e])=>this.num2aa[e]=t))}static _truncateSequence(t){let e=0,s=t.length;const n=["NH2","COOH"];if(t.startsWith(n[0])){const s=n[0].length;(0,L.hu)("-"==t[s],`Wrong sequence format: ${n[0]} without following '-' in '${t}'.`),e=s}if(t.endsWith(n[1])){const e=n[1].length+1;(0,L.hu)("-"==t[s-e],`Wrong sequence format: ${n[1]} without '-' precending in '${t}'.`),s-=e}return t.substring(e,s)}static _dropDefises(t){return t.replace(/(-)([^-]+)/g,"$2")}static clean(t){return N._dropDefises(N._truncateSequence(t))}encode(t){const e=t.length,s=new Array(e).fill(0);for(let n=0;n<e;++n){const e=t[n];(0,L.hu)(e in this.aa2num,`Unknown char '${e}' found in sequence '${t}'`),s[n]=this.encodeLettter(e)}return s}encodeLettter(t){return this.aa2num[t]}decode(t){let e="";for(let s=0;s<t.length;++s){const n=t[s];(0,L.hu)(n in this.num2aa,`Unknown code '${n}' found in vector '${t}'`),e+=this.num2aa[n]}return e}}var _=s(3553);const P="input.fa",I="result.fasta";function R(t){return t.reduce(((t,e,s)=>t+`>sample${s+1}\n${e}\n`),"")}async function O(t,e=!1,s="",o=null,r,a,l){let c=t.toList();e&&(c=c.map((t=>N.clean(t).replace(/\-/g,""))));const h=t.length;o??(o=n.Column.string("Clusters",h).init("0")),o.type!=n.COLUMN_TYPE.STRING&&(o=o.convertTo(n.TYPE.STRING)),o.compact();const u=o.categories,d=o.getRawData(),m=new Array(u.length),p=new Array(u.length);for(let t=0;t<h;++t){const e=d[t];(m[e]??(m[e]=[])).push(c[t]),(p[e]??(p[e]=[])).push(t)}const g=await new x(["base/1.0.0",{tool:"kalign",version:_.WY,reinit:!0}]),f=n.Column.string(s,h);for(let t=0;t<u.length;++t){const e=R(m[t]);await g.fs.writeFile(P,e);const s=`${void 0!==r?` --gpo ${r}`:""}${void 0!==a?` --gpe ${a}`:""}${void 0!==l?` --tgpe ${l}`:""}`,n=await g.exec(`kalign ${P} -f fasta -o ${I}${s}`);console.warn(n);const o=await g.cat(I);if(!o)throw new Error("kalign output no result");const c=new i.i(o).sequencesArray,h=p[t];for(let t=0;t<c.length;++t)f.set(h[t],c[t])}const y=t.getTag(n.TAGS.UNITS),C=t.getTag("alphabet");return f.setTag(n.TAGS.UNITS,y),f.setTag("aligned","SEQ.MSA"),f.setTag("alphabet",C),f.semType=n.SEMTYPE.MACROMOLECULE,f}},8341:(t,e,s)=>{"use strict";s.d(e,{Jy:()=>l,f3:()=>h});var n=s(4469),i=s(976),o=s(8447),r=s(3553);const a=new class{constructor(){this.dcName="bio"}async getDockerContainer(){return await n.dapi.docker.dockerContainers.filter(this.dcName).first()}},l=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],c=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(t,e,s="ginsi",l=1.53,h=0,d=null){const m=await a.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)return n.log.warning("PepSeA container has not started yet"),null;const p=t.length;d??(d=i.Column.int("Clusters",p).init(0)),d.type!=i.COLUMN_TYPE.STRING&&(d=d.convertTo(i.TYPE.STRING));const g=d.categories,f=new Array(g.length);for(let e=0;e<p;++e){const s=d.get(e);if(""===s)continue;const n=g.indexOf(s),i=t.get(e);i&&(f[n]??(f[n]=[])).push({ID:e.toString(),HELM:i})}const y=new Array(p);for(const t of f){const e=(await u(m.id,t,s,l,h)).Alignment;for(const t of e)y[parseInt(t.ID)]=Object.entries(t).filter((t=>!c.includes(t[0]))).map((t=>"-"!==t[1]?t[1]:"")).join(r.rs.SEPARATOR)}const C=i.Column.fromStrings(e,y);return C.setTag(i.TAGS.UNITS,o.r2.SEPARATOR),C.setTag("separator",r.rs.SEPARATOR),C.setTag("aligned","SEQ.MSA"),C.setTag("alphabet","UN"),C.setTag(".alphabetIsMultichar","true"),C.semType=i.SEMTYPE.MACROMOLECULE,C}async function u(t,e,s,i,o){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)},a=`/align?method=${s}&gap_open=${i}&gap_extend=${o}`,l=await n.dapi.docker.dockerContainers.request(t,a,r);return JSON.parse(l??"{}")}},9943:(t,e,s)=>{"use strict";s.d(e,{i$:()=>a,sK:()=>l}),s(976),s(3870),s(4469);var n=s(6414),i=s.n(n),o=s(8447);s(499);const r=60;function a(t,e,s=r,n="\n"){const i=o.kB,a=[];for(let o=0;o<e.length;o++){const r=t.map((t=>t.get(o).toString())).join("|"),c=l(e.get(o),i,s);a.push(`>${r}${n}`);for(const t of c)a.push(`${t}${n}`)}return"".concat(...a)}function l(t,e,s=r){const n=e(t);let o=0;const a=n.length,l=[];for(;o<a;){const t=i()(n).slice(o,o+s).toArray(),e=t.map((t=>t.length>1?`[${t}]`:t)).join("");l.push(e),o+=t.length}return l}},9416:(t,e,s)=>{"use strict";s.d(e,{n:()=>c});var n=s(4469),i=s(976),o=s(8467),r=s(2568),a=s(8457),l=s(3553);async function c(t,e){if(await(0,o.gw)(10),!(0,r.n)(e,"Sequence space"))return t;const s=(0,a.O)(e);s.name="splitToMonomers";const c=e.dataFrame;for(const t of s.columns)t.semType=l.Of.MONOMER,t.setTag("alphabet",e.getTag("alphabet"));const h=/(\d+)(?: \((\d+)\))?/,u=t=>{h.lastIndex=0;const e=t.match(h);return e?`${e[1]} (${parseInt(e[2]??0)+1})`:t};for(let t=0;t<s.columns.length;t++){const n=s.columns.byIndex(t);n.semType=l.Of.MONOMER,n.setTag("alphabet",e.getTag("alphabet"));const i=100;let o=0;for(;c.columns.byName(n.name)&&o<i;)n.name=u(n.name),o++;c.columns.add(n)}await n.data.detectSemanticTypes(c);for(let t=0;t<s.columns.length;t++){const e=s.columns.byIndex(t);e.setTag(i.TAGS.CELL_RENDERER,"Monomer"),e.setTag(".use-as-filter","false")}return c}},4293:(t,e,s)=>{"use strict";function n(t,e){t.innerHTML="",t.append(e)}s.d(e,{Y:()=>n}),s(4469),s(976)},8415:(t,e,s)=>{"use strict";s.d(e,{bo:()=>T,CK:()=>S,yW:()=>w,eZ:()=>M});var n=s(4469),i=s(3870),o=s(976),r=s(3336),a=s.n(r),l=s(6414),c=s.n(l),h=s(701),u=s(499),d=s(8447),m=s(9298);function p(t){var e;return"string"==typeof t||t instanceof String?t:("object"==typeof t||t instanceof Object)&&"$thrownJsError"in t?p(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}var g=s(7945),f=s(8467),y=s(172);var C,T,A=s(8770),b=s(4955);HTMLCanvasElement.prototype.getCursorPosition=function(t,e){const s=this.getBoundingClientRect();return new o.Point((t.clientX-s.left)*e,(t.clientY-s.top)*e)},o.Rect.prototype.contains=function(t,e){return this.left<=t&&t<=this.right&&this.top<=e&&e<=this.bottom};class w{constructor(t=0,e){this.valueList=null,this.valueIdx=0,this.value=this.rowCount=t,this.bounds=e}push(t){this.valueList||(this.valueList=new Array(this.rowCount),this.valueIdx=0),this.valueList[this.valueIdx]=t,++this.valueIdx}aggregate(t){this.value=t(this.valueList)??0,this.valueList=null}}class S{get label(){return this._label?this._label:this.name}constructor(t,e,s,n){this.sumRowCount=0,this.pos=t,this.name=e,this._freqs=s??{},n?.sumRowCount&&(this.sumRowCount=n.sumRowCount),n?.sumValueForHeight&&(this.sumPlotValue=n.sumValueForHeight),n?.label&&(this._label=n.label)}getMonomers(){return Object.keys(this._freqs)}hasMonomer(t){return t in this._freqs}getFreq(t){let e=this._freqs[t];return e||(e=this._freqs[t]=new w),e}aggregate(t){const e=function(t){return e=>{const s=function(t){let e;const s="agg";return e=t instanceof Float32Array?o.Column.fromFloat32Array(s,t):t instanceof Int32Array?o.Column.fromInt32Array(s,t):o.Column.fromList(o.COLUMN_TYPE.FLOAT,s,t),e}(e);return s.aggregate(t)}}(t);for(const[t,s]of Object.entries(this._freqs))s.aggregate(e)}getMinValue(){return Math.min(...Object.values(this._freqs).map((t=>t.value)))}calcPlotValue(t){for(const e of Object.values(this._freqs))e.plotValue=e.value-t}calcHeights(t){this.sumPlotValue=0;for(const t of Object.values(this._freqs))this.sumPlotValue+=t.plotValue;if(this.sumPlotValueForHeight=0,t===m.ES.Entropy){const t=Object.keys(this._freqs).length,e=.01*this.sumPlotValue,s=e/t;for(const t of Object.values(this._freqs)){const n=(t.plotValue+s)/(this.sumPlotValue+e);this.sumPlotValueForHeight+=-n*Math.log2(n)}}else if(t===m.ES.full)for(const[t,e]of Object.entries(this._freqs)){const t=e.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=t}}calcScreen(t,e,s,n,i,r,a,l,c,h){const u=i===m.ES.Entropy?n*(r-this.sumPlotValueForHeight)/r:n;let d=h*c+(n-u-1);const p=Object.entries(this._freqs).sort(((e,s)=>t(e[0])||t(s[0])?t(e[0])&&t(s[0])?0:t(e[0])?-1:1:s[1].value-e[1].value));for(const[t,n]of p){const t=u*n.plotValue/this.sumPlotValue;n.bounds=new o.Rect((e-s)*c*a,d,l*c,t),d+=t}}render(t,e,s,n,i,o){for(const[r,a]of Object.entries(this._freqs))if(!e(r)){const e=(0,d.GU)(r,5),l=a.bounds,c=l.left;t.resetTransform(),t.strokeStyle="lightgray",t.lineWidth=1,t.rect(c,l.top,l.width,l.height),t.fillStyle=o.get(r)??o.get("other"),t.textAlign="left",t.font=s;const h=t.measureText(e);t.setTransform(l.width/h.width,0,0,l.height/i,c,l.top),t.fillText(e,0,-n)}}getMonomerAt(t,e){const s=Object.entries(this._freqs).find((([s,n])=>n.bounds.contains(t,e)));return s?s[0]:void 0}buildCompositionTable(t){return(0,A._)(t,Object.assign({},...Object.entries(this._freqs).map((([t,e])=>({[t]:e.rowCount})))))}}!function(t){t.STYLE="Style",t.BEHAVIOR="Behavior",t.LAYOUT="Layout",t.DATA="Data"}(C||(C={})),function(t){t.sequenceColumnName="sequenceColumnName",t.valueAggrType="valueAggrType",t.valueColumnName="valueColumnName",t.startPositionName="startPositionName",t.endPositionName="endPositionName",t.skipEmptySequences="skipEmptySequences",t.skipEmptyPositions="skipEmptyPositions",t.shrinkEmptyTail="shrinkEmptyTail",t.backgroundColor="backgroundColor",t.positionHeight="positionHeight",t.positionWidth="positionWidth",t.verticalAlignment="verticalAlignment",t.horizontalAlignment="horizontalAlignment",t.fixWidth="fixWidth",t.fitArea="fitArea",t.minHeight="minHeight",t.maxHeight="maxHeight",t.showPositionLabels="showPositionLabels",t.positionMarginState="positionMarginState",t.positionMargin="positionMargin",t.filterSource="filterSource"}(T||(T={}));const E=m.vS;var v;!function(t){t[t.None=0]="None",t[t.Render=1]="Render",t[t.Layout=1]="Layout",t[t.Freqs=2]="Freqs"}(v||(v={}));const x=new class{constructor(){this.render=20}};class L extends o.JsViewer{get positionWidthWithMargin(){return this._positionWidthWithMargin}get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionMarginValue(){return this.positionMarginState===m.dE.AUTO&&!0===this.unitsHandler.getAlphabetIsMultichar()||this.positionMarginState===m.dE.ON?this.positionMargin:0}constructor(){super(),this.viewed=!1,this.initialized=!1,this.palette=null,this.seqCol=null,this.positions=[],this.visibleSlider=!1,this.allowResize=!0,this.turnOfResizeForOneSetValue=!1,this.backgroundColor=4294967295,this.positionMargin=0,this.positionNames=[],this.positionLabels=void 0,this.startPosition=-1,this.endPosition=-1,this.error=null,this.viewerId=++L.viewerCounter,this.setDataInProgress=!1,this.viewSubs=[],this._onSizeChanged=new h.Subject,this._onFreqsCalculated=new h.Subject,this._onLayoutCalculated=new h.Subject,this.requestedRenderLevel=v.Freqs,this.renderRequest=new h.Subject,this._onRendered=new h.Subject,this.textBaseline="top",this.unitsHandler=null,this.sequenceColumnName=this.string(T.sequenceColumnName,E.sequenceColumnName,{category:C.DATA});const t=[o.AGG.KEY,o.AGG.PIVOT,o.AGG.MISSING_VALUE_COUNT,o.AGG.SKEW,o.AGG.KURT,o.AGG.SELECTED_ROWS_COUNT],e=Object.values(o.AGG).filter((e=>!t.includes(e)));this.valueAggrType=this.string(T.valueAggrType,E.valueAggrType,{category:C.DATA,choices:e}),this.valueColumnName=this.string(T.valueColumnName,E.valueColumnName,{category:C.DATA}),this.startPositionName=this.string(T.startPositionName,E.startPositionName,{category:C.DATA}),this.endPositionName=this.string(T.endPositionName,E.endPositionName,{category:C.DATA}),this.skipEmptySequences=this.bool(T.skipEmptySequences,E.skipEmptySequences,{category:C.DATA}),this.skipEmptyPositions=this.bool(T.skipEmptyPositions,E.skipEmptyPositions,{category:C.DATA}),this.shrinkEmptyTail=this.bool(T.shrinkEmptyTail,E.shrinkEmptyTail,{category:C.DATA}),this.backgroundColor=this.int(T.backgroundColor,E.backgroundColor,{category:C.STYLE}),this.positionHeight=this.string(T.positionHeight,E.positionHeight,{category:C.STYLE,choices:Object.values(m.ES)}),this._positionWidth=this.positionWidth=this.float(T.positionWidth,E.positionWidth,{category:C.STYLE}),this.verticalAlignment=this.string(T.verticalAlignment,E.verticalAlignment,{category:C.LAYOUT,choices:Object.values(m.vw)}),this.horizontalAlignment=this.string(T.horizontalAlignment,E.horizontalAlignment,{category:C.LAYOUT,choices:Object.values(m.iD)}),this.fixWidth=this.bool(T.fixWidth,E.fixWidth,{category:C.LAYOUT,userEditable:!1}),this.fitArea=this.bool(T.fitArea,E.fitArea,{category:C.LAYOUT}),this.minHeight=this.float(T.minHeight,E.minHeight,{category:C.LAYOUT}),this.maxHeight=this.float(T.maxHeight,E.maxHeight,{category:C.LAYOUT}),this.showPositionLabels=this.bool(T.showPositionLabels,E.showPositionLabels,{category:C.LAYOUT}),this.positionMarginState=this.string(T.positionMarginState,E.positionMarginState,{category:C.LAYOUT,choices:Object.values(m.dE)});let s=0;"auto"===this.positionMarginState&&(s=4),this.positionMargin=this.int(T.positionMargin,s,{category:C.LAYOUT,min:0,max:16}),this.filterSource=this.string(T.filterSource,E.filterSource,{category:C.BEHAVIOR,choices:Object.values(m.Ct)}),this.slider=i.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=i.canvas(),this.canvas.classList.value="bio-wl-canvas",this.canvas.style.width="100%",this.viewSyncer=new y.c(b._package.logger)}viewerToLog(){return`MolstarViewer<${this.viewerId}>`}setData(){const t=`${this.viewerToLog()}.setData()`;b._package.logger.debug(`${t}, in`),this.viewSyncer.sync(`${t}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(this.renderRequestSub.unsubscribe(),await this.destroyView(),this.viewed=!1),this.updateSeqCol(),this.updateEditors(),this.viewed||(await this.buildView(),this.viewed=!0)}finally{this.setDataInProgress=!1}}})),b._package.logger.debug(`${t}, out`)}async destroyView(){for(const t of this.viewSubs)t.unsubscribe();this.viewSubs=[];const t=this.dataFrame?"data":"null";b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView( dataFrame = ${t} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView() end`)}async buildView(){const t=this.dataFrame?"data":"null";b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView( dataFrame = ${t} ) start`),window.devicePixelRatio,this.viewSubs.push(o.debounce(this.renderRequest,x.render).subscribe(this.renderRequestOnDebounce.bind(this))),this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=i.div("No message",{classes:"bio-wl-msg"}),this.msgHost.style.display="none",this.canvas=i.canvas(),this.canvas.style.width="100%",this.slider.root.style.position="absolute",this.slider.root.style.zIndex="999",this.slider.root.style.display="none",this.slider.root.style.height="0.7em",this.visibleSlider=!1,this.host=i.div([this.msgHost,this.canvas],{classes:"bio-wl-host",style:{display:"flex",flexDirection:"row",flexWrap:"wrap"}}),this.root.append(this.host),this.root.append(this.slider.root),this.error&&(this.msgHost.innerText=this.error.message,i.tooltip.bind(this.msgHost,this.error.stack),this.msgHost.style.setProperty("display",null)),this.dataFrame&&(this.viewSubs.push(this.dataFrame.filter.onChanged.subscribe(this.dataFrameFilterOnChanged.bind(this))),this.viewSubs.push(this.dataFrame.selection.onChanged.subscribe(this.dataFrameSelectionOnChanged.bind(this)))),this.viewSubs.push(i.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.viewSubs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(v.Freqs,"buildView"),b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView() end`)}rootOnSizeChanged(){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.rootOnSizeChanged(), start `),this.render(v.Layout,"rootOnSizeChanged")}updateEditors(){this.props.getProperty(T.valueColumnName).choices=c()(this.dataFrame.columns.numerical).map((t=>t.name)).toArray()}updateSeqCol(){if(this.dataFrame&&(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,d.up)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol)){try{this.unitsHandler=u.Cn.getOrCreate(this.seqCol),this.palette=(0,d.dQ)(this.seqCol),this.render(v.Freqs,"updateSeqCol()"),this.error=null}catch(t){throw this.seqCol=null,this.error=t instanceof Error?t:new Error(t.toString()),t}this.seqCol||(this.unitsHandler=null,this.positionNames=[],this.positionLabels=[],this.startPosition=-1,this.endPosition=-1,this.palette=null)}}getFilter(){let t;switch(this.filterSource){case m.Ct.Filtered:t=this.dataFrame.filter;break;case m.Ct.Selected:t=0===this.dataFrame.selection.trueCount?this.dataFrame.filter:this.dataFrame.selection}return t}setSliderVisibility(t){t?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}calcLayout(t){this.host&&this.canvas&&this.slider&&(this.host.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this.canvas.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this._positionWidth=this.positionWidth,this._positionMargin=this.positionMargin,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue,this.fixWidth?this.calcLayoutFixWidth(t):this.fitArea?this.calcLayoutFitArea(t):this.calcLayoutNoFitArea(t),this.slider.root.style.width=`${this.host.clientWidth}px`)}calcLayoutFixWidth(t){if(!this.host||!this.canvas||!this.slider)return;this.host.classList.add("bio-wl-fixWidth"),this.canvas.classList.add("bio-wl-fitArea");const e=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight);this.host.style.justifyContent=m.iD.LEFT,this.host.style.removeProperty("margin-left"),this.host.style.removeProperty("margin-top"),this.host.style.width=this.canvas.style.width=`${e}px`,this.host.style.height=this.canvas.style.height=`${s}px`,this.host.style.left=this.canvas.style.left="0",this.host.style.top=this.canvas.style.top="0",this.host.style.setProperty("overflow","hidden","important"),this.slider.root.style.display="none",this.slider.setValues(0,Math.max(0,this.Length-1),0,Math.max(0,this.Length-1)),this.canvas.width=e*t,this.canvas.height=s*t}calcLayoutNoFitArea(t){if(!this.host||!this.canvas||!this.slider)return;const e=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=Math.min(this.root.clientWidth,e);this.canvas.style.width=`${n}px`,this.canvas.style.height=`${s}px`,this.host.style.width=`${n}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${n+6}px`),this.host.style.width=`${this.host}px`;const i=e>n;if(this.setSliderVisibility(i),i){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let t=Math.min(Math.max(0,this.slider.min),this.Length-.001),e=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;e=Math.min(Math.max(t,0)+s,this.Length-.001),t=Math.max(0,Math.min(e,this.Length-.001)-s),this.slider.setValues(0,Math.max(this.Length-.001),t,e)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=n*t,this.canvas.height=s*t}calcLayoutFitArea(t){if(!this.host||!this.canvas||!this.slider)return;const e=this._positionWidth*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=e>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/e:0,i=this.root.clientHeight/s,o=Math.max(1,Math.min(n,i));this._positionWidth=this.positionWidth*o,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const r=(this._positionWidth+this.positionMarginValue)*this.Length,a=o*s,l=Math.min(this.root.clientWidth,r);this.canvas.style.width=`${l}px`,this.canvas.style.height=`${a}px`,this.host.style.width=`${l}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${l+6}px`),this.host.style.width=`${this.host}px`;const c=r>l;if(this.setSliderVisibility(c),c){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let t=Math.min(Math.max(0,this.slider.min),this.Length-.001),e=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;e=Math.min(Math.max(t,0)+s,this.Length-.001),t=Math.max(0,Math.min(e,this.Length-.001)-s),this.slider.setValues(0,Math.max(0,this.Length-.001),t,e)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=l*t,this.canvas.height=a*t}onPropertyChanged(t){switch(super.onPropertyChanged(t),t.name){case T.sequenceColumnName:this.updateSeqCol();break;case T.sequenceColumnName:case T.startPositionName:case T.endPositionName:case T.filterSource:case T.shrinkEmptyTail:case T.skipEmptyPositions:case T.positionHeight:case T.valueColumnName:case T.valueAggrType:this.render(v.Freqs,`onPropertyChanged( ${t.name} )`);break;case T.minHeight:case T.maxHeight:case T.positionWidth:case T.showPositionLabels:case T.fixWidth:case T.fitArea:case T.horizontalAlignment:case T.verticalAlignment:case T.positionMargin:case T.positionMarginState:this.render(v.Layout,`onPropertyChanged(${t.name})`);break;case T.backgroundColor:this.render(v.Render,`onPropertyChanged(${t.name})`)}}onTableAttached(){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const t=`${this.viewerToLog()}.detach()`;b._package.logger.debug(`${t}, in`);const e=super.detach.bind(this);this.viewSyncer.sync(`${t}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView(),this.viewed=!1),e())})),b._package.logger.debug(`${t}, out`)}get onSizeChanged(){return this._onSizeChanged}get onFreqsCalculated(){return this._onFreqsCalculated}get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(t,e){const s=t.x,n=Math.floor(t.x/(this._positionWidthWithMargin*e)+Math.floor(this.slider.min)),i=this.positions[n];if(!i)return[null,null,null];const o=i.getMonomerAt(s,t.y);return void 0===o?[i,null,null]:[i,o,i.getFreq(o)]}_nullSequence(t="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(t).join("")}_removeEmptyPositions(){this.skipEmptyPositions&&(this.positions=c()(this.positions).filter((t=>{const e=this.unitsHandler.defaultGapSymbol;return!t.hasMonomer(e)||t.getFreq(e).rowCount!==t.sumRowCount})).toArray())}render(t,e){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render( recalcLevelVal=${t}, reason='${e}' )`),this.requestedRenderLevel=Math.max(this.requestedRenderLevel,t),this.renderRequest.next(this.requestedRenderLevel)}async renderInt(t){if(b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( renderLevel=${t} ), start `),this.msgHost&&(this.seqCol&&!this.palette?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.palette||null==this.host||null==this.slider)return;const e=window.devicePixelRatio,s=this.showPositionLabels?12:0;if(t>=v.Freqs&&(()=>{if(b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const t=this.getFilter(),e=0===t.trueCount?this.unitsHandler.maxLength:c().enumerate(this.unitsHandler.splitted).map((([e,s])=>t.get(s)&&e?e.length:0)).reduce(((t,e)=>Math.max(t,e)),0),s=this.seqCol.getTag(".positionNames"),n=this.seqCol.getTag(".positionLabels");this.positionNames=s?s.split(d.CI).map((t=>t.trim())):[...Array(e).keys()].map((t=>`${t+1}`)),this.positionLabels=n?n.split(d.CI).map((t=>t.trim())):void 0,this.startPosition=this.startPositionName&&this.positionNames&&this.positionNames.includes(this.startPositionName)?this.positionNames.indexOf(this.startPositionName):0,this.endPosition=this.endPositionName&&this.positionNames&&this.positionNames.includes(this.endPositionName)?this.positionNames.indexOf(this.endPositionName):e-1;const i=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.unitsHandler=u.Cn.getOrCreate(this.seqCol);const r=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(r);for(let t=0;t<i;t++){const e=this.positionNames[this.startPosition+t],s=this.positionLabels?this.positionLabels[this.startPosition+t]:void 0;this.positions[t]=new S(this.startPosition+t,e,{},{label:s})}const a=this.dataFrame.rowCount,l=this.unitsHandler.splitted;for(let e=0;e<i;++e){for(let s=0;s<a;++s)if(t.get(s)){const t=l[s][this.startPosition+e]||this.unitsHandler.defaultGapSymbol,n=this.positions[e],i=n.getFreq(t);++n.sumRowCount,i.value=++i.rowCount}if(this.valueAggrType===o.AGG.TOTAL_COUNT)continue;let s=null;try{s=this.dataFrame.getCol(this.valueColumnName),s.matches("numerical")||(s=null)}catch{s=null}if(s){for(let n=0;n<a;++n)if(t.get(n)){const t=l[n][this.startPosition+e]||this.unitsHandler.defaultGapSymbol,i=s.get(n);this.positions[e].getFreq(t).push(i)}this.positions[e].aggregate(this.valueAggrType)}}const h=this.valueAggrType===o.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((t=>t.getMinValue()))));for(let t=0;t<i;++t)this.positions[t].calcPlotValue(h),this.positions[t].calcHeights(this.positionHeight);this._removeEmptyPositions(),this._onFreqsCalculated.next()})(),this.calcLayout(e),-1===this.startPosition)return;const i=Math.max(Math.floor(this.slider.min),0),r=Math.min(this.positions.length-1,Math.floor(this.slider.max));t>=v.Layout&&((t,e,s,i)=>{b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), start `);const r=this.canvas.height-i*s;let a;if(this.valueAggrType===o.AGG.TOTAL_COUNT){const t=this.getAlphabetSize();this.positionHeight==m.ES.Entropy&&null==t&&n.shell.error("WebLogo: alphabet is undefined."),a=Math.log2(t)}else a=Math.max(...c().count(t).takeWhile((t=>t<=e)).map((t=>this.positions[t].sumPlotValueForHeight)));for(let n=t;n<=e;++n)n in this.positions?this.positions[n].calcScreen((t=>this.unitsHandler.isGap(t)),n,this.slider.min,r,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,s,i):b._package.logger.warning(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${n}`);b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(i,r,window.devicePixelRatio,s);const a=this.canvas.getContext("2d");if(a){a.save();try{this.Length,a.resetTransform(),a.fillStyle=function(t){const e=o.Color.a(t);return`#${(16777215&t).toString(16).padStart(6,"0")}`+e.toString(16).padStart(2,"0")}(this.backgroundColor),a.fillRect(0,0,this.canvas.width,this.canvas.height),a.textBaseline=this.textBaseline;const t=10*e;a.resetTransform(),a.fillStyle="black",a.textAlign="center",a.font=`${t.toFixed(1)}px Roboto, Roboto Local, sans-serif`,s>0&&this.positions.length>0&&function(t,e,s,n,i,o,r,a){t.save();try{t.textAlign="center";let l=null,c=null;for(let e=Math.floor(r);e<=Math.floor(a);e++){const s=o[e],n=t.measureText(s.name),i=n.actualBoundingBoxDescent-n.actualBoundingBoxAscent;l=null===l?n.width:Math.max(l,n.width),c=null===c?i:Math.max(c,i)}const h=l<n*e-2?1:(n*e-2)/l;for(let l=Math.floor(r);l<=Math.floor(a);l++){const a=o[l],u=(l-r)*s*e+n*e/2,d=(i*e-c)/2;t.setTransform(h,0,0,1,u,d),t.measureText(a.label),t.fillText(a.label,0,0)}}finally{t.restore()}}(a,e,this._positionWidthWithMargin,this._positionWidth,s,this.positions,this.slider.min,this.slider.max);const n="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let t=i;t<=r;t++)this.positions[t].render(a,(t=>this.unitsHandler.isGap(t)),n,l,c,this.palette)}finally{a.restore()}b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( recalcLevel=${t} ), end`)}}renderRequestOnDebounce(t){const e=`${this.viewerToLog()}.renderRequestOnDebounce()`;"HTML"!==a()(this.root).offsetParent().get()[0]?.tagName?(this.requestedRenderLevel=v.None,this.renderInt(t).catch((t=>{const[e,s]=(0,g.yf)(t);b._package.logger.error(e,void 0,s)}))):b._package.logger.warning(`${e}, $(this.root).offsetParent() is the 'HTML' tag.`)}getAlphabetSize(){return this.unitsHandler?.getAlphabetSize()??0}sliderOnValuesChanged(t){try{const t={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged( ${JSON.stringify(t)} ), start`),this.render(v.Layout,"sliderOnValuesChanged")}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged() error:\n`+e)}}dataFrameFilterOnChanged(t){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterChanged()`);try{this.filterSource===m.Ct.Filtered&&this.render(v.Freqs,"dataFrameFilterOnChanged")}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterOnChanged() error:\n`+e)}}dataFrameSelectionOnChanged(t){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged()`);try{this.filterSource===m.Ct.Selected&&this.render(v.Freqs,"dataFrameSelectionOnChanged")}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged() error:\n`+e)}}canvasOnMouseMove(t){const e=window.devicePixelRatio;try{const s=t,n=this.canvas.getCursorPosition(s,e),[r,a]=this.getMonomer(n,e),l=this.showPositionLabels?12*e:0;if(null!==r&&null===a&&0<=n.y&&n.y<=l){const t=[i.divText(`Position ${r.label}`)];this.valueAggrType===o.AGG.TOTAL_COUNT&&t.push(r.buildCompositionTable(this.palette));const e=i.divV(t);i.tooltip.show(e,s.x+16,s.y+16)}else if(null!==r&&a&&this.dataFrame&&this.seqCol&&this.unitsHandler){const t=r.getFreq(a),e=[i.div(`${a}`),i.div(`${t.rowCount} rows`)];this.valueAggrType!==o.AGG.TOTAL_COUNT&&e.push(i.div(`${this.valueAggrType}: ${t.value.toFixed(3)}`));const n=i.divV(e);i.tooltip.show(n,s.x+16,s.y+16)}else i.tooltip.hide()}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseMove() error:\n`+e)}}canvasOnMouseDown(t){try{const e=t,s=window.devicePixelRatio,[n,i]=this.getMonomer(this.canvas.getCursorPosition(e,s),s);if(null!==n&&null!==i&&this.dataFrame&&this.seqCol&&this.unitsHandler){const t=o.BitSet.create(this.dataFrame.selection.length,(t=>function(t,e,s,n,i,o){const r=e.splitted[n],a=o.pos<r.length?r[o.pos]:null;return a===i||""===a&&i===e.defaultGapSymbol}(this.dataFrame,this.unitsHandler,this.getFilter(),t,i,n)));this.dataFrame.selection.init((e=>t.get(e)))}}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseDown() error:\n`+e)}}canvasOnWheel(t){const e=window.devicePixelRatio;try{if(!this.visibleSlider)return;const s=this.canvas.width/(this._positionWidthWithMargin*e),n=t.deltaY/100*Math.max(Math.floor(s/5),1);this.slider.scrollBy(this.slider.min+n)}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnWheel() error:\n`+e)}}get onRendered(){return this._onRendered}invalidate(){const t=`${this.viewerToLog()}.invalidate()`;this.viewSyncer.sync(`${t}`,(async()=>{this.invalidate(),this._onRendered.next()}))}async awaitRendered(t=5e3){await(0,f.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),t)}}function M(t,e,s,n,i){let o=0,r=-1;for(;-1!=(r=s.findNext(r,!0));){const t=e.splitted[r],s=i.pos;(s<t.length?t[s]:null)===n&&o++}return o}L.residuesSet="nucleotides",L.viewerCounter=-1},6099:(t,e,s)=>{"use strict";s.d(e,{ST:()=>f});var n=s(3870),i=s(976),o=s(4469),r=s(6414),a=s.n(r),l=s(701),c=s(442),h=s(8447),u=s(7945),d=s(8467),m=s(7983),p=s(4293),g=s(4955);class f extends i.Filter{get calculating(){return"initial"==this.loader.style.display}set calculating(t){this.loader.style.display=t?"initial":"none"}get filterSummary(){return this.bioFilter.substructure}get isFiltering(){return super.isFiltering&&""!==this.bioFilter.substructure}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get _debounceTime(){if(null==this.column)return 1e3;const t=this.column.length;return t<500?0:t>1e4?1e3:Math.floor((t-500)/9500*1e3)}constructor(){super(),this.bioFilter=null,this.bitset=null,this.loader=n.loader(),this.notation=void 0,this.root=n.divV([]),this.calculating=!1}attach(t){super.attach(t),this.column=t.columns.bySemType(i.SEMTYPE.MACROMOLECULE),this.columnName??(this.columnName=this.column?.name),this.notation??(this.notation=this.column?.getTag(i.TAGS.UNITS)),this.bioFilter=this.notation===h.r2.FASTA?new C:this.notation===h.r2.SEPARATOR?new T(this.column.getTag("separator")):new A,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),this.onBioFilterChangedSubs?.unsubscribe();let e=this.bioFilter.onChanged;e=e.pipe((0,c.debounceTime)(this._debounceTime)),this.onBioFilterChangedSubs=e.subscribe((async t=>await this._onInputChanged())),this.subs.push(o.events.onResetFilterRequest.subscribe((t=>{this.bioFilter?.resetFilter()})))}detach(){this.bioFilter&&this.bioFilter.detach(),super.detach()}applyFilter(){this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const t=super.saveState();return t.bioSubstructure=this.bioFilter?.substructure,t}applyState(t){super.applyState(t),t.bioSubstructure&&(this.bioFilter.substructure=t.bioSubstructure);const e=this;t.bioSubstructure&&setTimeout((function(){e._onInputChanged()}),1e3)}async _onInputChanged(){if(g._package.logger.debug("Bio: BioSubstructureFilter._onInputChanged(), start"),this.isFiltering){if(a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`))return;this.calculating=!0;try{this.bitset=await(this.bioFilter?.substructureSearch(this.column)),this.calculating=!1,this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1}}else this.bitset=null,this.dataFrame?.rows.requestFilter()}}class y{constructor(){this.onChanged=new l.Subject}get filterPanel(){return new HTMLElement}async substructureSearch(t){return null}}class C extends y{constructor(){super(),this.substructureInput=n.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Substructure"})}get filterPanel(){return this.substructureInput.root}get substructure(){return this.substructureInput.value}set substructure(t){this.substructureInput.value=t}async substructureSearch(t){return(0,m.pf)(this.substructure,t)}resetFilter(){this.substructureInput.value=""}detach(){}}class T extends C{constructor(t){super(),this.colSeparator="",this.separatorInput=n.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Separator"}),this.colSeparator=t,this.separatorInput.value=t}get filterPanel(){return n.divV([this.substructureInput.root,this.separatorInput.root])}get substructure(){return this.separatorInput.value&&this.separatorInput.value!==this.colSeparator?this.substructureInput.value.replaceAll(this.separatorInput.value,this.colSeparator):this.substructureInput.value}set substructure(t){this.substructureInput.value=t}async substructureSearch(t){return(0,m.pf)(this.substructure,t,this.colSeparator)}detach(){}}class A extends y{constructor(){super(),this._filterPanel=n.div("",{style:{cursor:"pointer"}}),this.helmSubstructure="",this.viewSubs=[],this.init()}async init(){let t,e;this.helmEditor=await o.functions.call("Helm:helmWebEditor"),await n.tools.waitForElementInDom(this._filterPanel),this.updateFilterPanel(),this.viewSubs.push((0,l.fromEvent)(this._filterPanel,"click").subscribe((()=>{({editorDiv:t,webEditor:e}=this.helmEditor.createWebEditor(this.helmSubstructure));const s=n.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{const t=e.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.helmSubstructure=t,this.updateFilterPanel(this.substructure),setTimeout((()=>{this.onChanged.next()}),10)})).show({modal:!0,fullScreen:!0}).onClose.subscribe((()=>{s.unsubscribe(),t=void 0,e=void 0}))}))),this.viewSubs.push(n.onSizeChanged(this._filterPanel).subscribe((t=>{try{if(e){const t=e.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(t)}}catch(t){const[e,s]=(0,u.yf)(t);g._package.logger.error(e,void 0,s)}})))}get filterPanel(){return this._filterPanel}get substructure(){return this.helmSubstructure}set substructure(t){this.helmEditor.editor.setHelm(t)}updateFilterPanel(t){const e=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,s=e/2;if(t)(0,p.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(t),this.helmEditor.resizeEditor(e,s);else{const t=n.divText("Click to edit","helm-substructure-filter");(0,p.Y)(this._filterPanel,t)}}async substructureSearch(t){n.setUpdateIndicator(this._filterPanel,!0),await(0,d.gw)(10);const e=await(0,m.QF)(this.substructure,t);return n.setUpdateIndicator(this._filterPanel,!1),e}resetFilter(){console.debug("Bio: HelmFilter.resetFilter()"),this.helmSubstructure="",this.updateFilterPanel(this.substructure)}detach(){for(const t of this.viewSubs)t.unsubscribe()}}},8770:(t,e,s)=>{"use strict";s.d(e,{_:()=>C});var n=s(3870),i=(s(976),s(6414),s(8447),s(7331),s(3379)),o=s.n(i),r=s(7795),a=s.n(r),l=s(569),c=s.n(l),h=s(3565),u=s.n(h),d=s(9216),m=s.n(d),p=s(4589),g=s.n(p),f=s(5362),y={};function C(t,e){let s=0,i=null;for(const t of Object.values(e))s+=t,i=null===i?t:Math.max(i,t);const o=i/s,r=Object.assign({},...Array.from(Object.entries(e)).sort(((t,e)=>e[1]-t[1])).map((([e,i])=>{const r=i/s,a=t.get(e),l=n.div("",{classes:"macromolecule-cell-comp-analysis-bar"});l.style.width=50*r/o+"px",l.style.backgroundColor=a;const c=n.div(`${(100*r).toFixed(2)}%`);return{[e]:n.div([l,c],{classes:"macromolecule-cell-comp-analysis-value"})}}))),a=n.tableFromMap(r);return Array.from(a.rows).forEach((t=>{const e=t.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;t.cells[0].style.color=e})),a}y.styleTagTransform=g(),y.setAttributes=u(),y.insert=c().bind(null,"head"),y.domAPI=a(),y.insertStyleElement=m(),o()(f.Z,y),f.Z&&f.Z.locals&&f.Z.locals,s(499)},3336:t=>{"use strict";t.exports=$},976:t=>{"use strict";t.exports=DG},4469:t=>{"use strict";t.exports=grok},701:t=>{"use strict";t.exports=rxjs},442:t=>{"use strict";t.exports=rxjs.operators},3870:t=>{"use strict";t.exports=ui},6414:t=>{"use strict";t.exports=wu}},e={};function s(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,s),o.loaded=!0,o.exports}s.m=t,s.amdO={},s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.u=t=>t+".js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.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),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;s.g.importScripts&&(t=s.g.location+"");var e=s.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var i=n.length-1;i>-1&&!t;)t=n[i--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t})(),s.b=document.baseURI||self.location.href,s.nc=void 0;var n={};(()=>{"use strict";s.r(n),s.d(n,{_package:()=>mt,test:()=>pt,tests:()=>e.QK});var t=s(976),e=s(8467);(0,e.W3)("_first",(()=>{(0,e.Bu)("_first",(async()=>{}))}));var i=s(2012),o=s(9976),r=s(6137);(0,e.W3)("Palettes",(()=>{(0,e.Bu)("testPaletteN",(async()=>{await async function(){const t=r.J.Chromatogram;(0,e.l_)(t instanceof o.B,!0),(0,e.l_)(t instanceof r.J,!0)}()})),(0,e.Bu)("testPaletteAA",(async()=>{await async function(){const t=i.f.Lesk,s=i.f.RasMol,n=i.f.GrokGroups;(0,e.l_)(t instanceof o.B,!0),(0,e.l_)(s instanceof o.B,!0),(0,e.l_)(n instanceof o.B,!0),(0,e.l_)(t instanceof i.f,!0),(0,e.l_)(s instanceof i.f,!0),(0,e.l_)(n instanceof i.f,!0)}()})),(0,e.Bu)("testPalettePtMe",(async()=>{const t=i.f.GrokGroups.get("MeNle"),s=i.f.GrokGroups.get("MeA"),n=i.f.GrokGroups.get("MeG"),o=i.f.GrokGroups.get("MeF"),r=i.f.GrokGroups.get("L"),a=i.f.GrokGroups.get("A"),l=i.f.GrokGroups.get("G"),c=i.f.GrokGroups.get("F");(0,e.l_)(t,r),(0,e.l_)(s,a),(0,e.l_)(n,l),(0,e.l_)(o,c)}))}));var a=s(4469),l=s(4955),c=s(8447),h=s(499);async function u(e){const s=t.Column.fromList(t.TYPE.STRING,"col1",e);if(await a.functions.call("Bio:detectMacromolecule",{col:s}),s.semType===t.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${s.semType}', units='${s.getTag(t.TAGS.UNITS)}'.`;throw new Error(e)}}async function d(e,s){const n=(await e()).getCol(s),i=await a.functions.call("Bio:detectMacromolecule",{col:n});if(i&&(n.semType=i),n.semType===t.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${n.semType}', units='${n.getTag(t.TAGS.UNITS)}'.`;throw new Error(e)}}async function m(s,n,i,o,r,l,c=null){const u=t.Column.fromList(t.TYPE.STRING,"seq",s),d=await a.functions.call("Bio:detectMacromolecule",{col:u});d&&(u.semType=d),(0,e.l_)(u.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(u.getTag(t.TAGS.UNITS),n),(0,e.l_)(u.getTag("aligned"),i),(0,e.l_)(u.getTag("alphabet"),o),c&&(0,e.l_)(u.getTag("separator"),c);const m=h.Cn.getOrCreate(u);(0,e.l_)(m.getAlphabetSize(),r),(0,e.l_)(m.getAlphabetIsMultichar(),l),m.isHelm()||((0,e.l_)(m.aligned,i),(0,e.l_)(m.alphabet,o))}async function p(s,n,i,o,r,l,c,u=null){const d=(await s()).col(n),m=await a.functions.call("Bio:detectMacromolecule",{col:d});m&&(d.semType=m),(0,e.l_)(d.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(d.getTag(t.TAGS.UNITS),i),(0,e.l_)(d.getTag("aligned"),o),(0,e.l_)(d.getTag("alphabet"),r),u&&(0,e.l_)(d.getTag("separator"),u);const p=h.Cn.getOrCreate(d);(0,e.l_)(p.getAlphabetSize(),l),(0,e.l_)(p.getAlphabetIsMultichar(),c),p.isHelm()||((0,e.l_)(p.aligned,o),(0,e.l_)(p.alphabet,r))}(0,e.W3)("detectors",(()=>{var s,n,i,o,r,l,h,y,C,T,A,b,w,S,E,v,x,L,M,N;const _=new(N=class{constructor(){this[s]="id,col1\n1,\n2,\n3,\n4,\n5,",this[n]="col1\n1\n2\n3",this[i]="col1\n4\n5\n6\n7",this[o]="col1\n8\n9\n10\n11\n12",this[r]="col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",this[l]="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",this[h]="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",this[y]="seq\nFWPHEY\nYNRQWYV\nMKPSEYV",this[C]="seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]DN\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]",this[T]="seq\nA*C*G*T*C*A*C*G*T*C\nC*A*G*T*G*T*C*A*G*T*G*T\nT*T*C*A*A*C*T*T*C*A*A*C",this[A]="seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",this[b]="seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",this[w]="seq\nabc-dfgg-abc1-cfr3-rty-wert-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-cfr3-wert-rut12",this[S]="seq\nabc/dfgg/abc1/cfr3/rty/wert/abc/dfgg/abc1/cfr3/rty/wert\nrut12/her2/rty/wert//abc/abc1/dfgg/rut12/her2/rty/wert//abc/abc1/dfgg\nrut12/rty/her2/abc/cfr3//wert/rut12/rut12/rty/her2/abc/cfr3//wert/rut12",this[E]="seq\nA-C--G-T--C-T-A-C--G-T--C-T\nC-A-C--T--G-T-C-A-C--T--G-T\nA-C-C-G-T-A-C-T-A-C-C-G-T-A-C-T",this[v]="seq\nm1-M-m3-mon4-mon5-N-T-MON8-N9-m1-M-m3-mon4-mon5-N-T-MON8-N9\nm1-mon2-m3-mon4-mon5-Num--MON8-N9-m1-mon2-m3-mon4-mon5-Num--MON8-N9\n\nmon1-M-mon3-mon4-mon5---MON8-N9-mon1-M-mon3-mon4-mon5---MON8-N9",this[x]="seq\nAc(1)-F-K(AEEA-AEEA-R-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-ARRA-W-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-AEEA-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2",this[L]="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",this[M]="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"}},s="negEmpty",n="neg1",i="neg2",o="neg3",r="negSmiles",l="csvFastaDna1",h="fastaRna1",y="fastaPt1",C="fastaUn",T="sepDna",A="sepRna",b="sepPt",w="sepUn1",S="sepUn2",E="sepMsaDna1",v="sepMsaUnWEmpty",x="sepComplex",L="fastaMsaDna1",M="fastaMsaPt1",N),P={fastaFasta:"System:AppData/Bio/data/sample_FASTA.fasta",fastaPtCsv:"System:AppData/Bio/data/sample_FASTA_PT.csv",msaComplex:"System:AppData/Bio/samples/MSA.csv",fastaCsv:"System:AppData/Bio/samples/FASTA.csv",helmCsv:"System:AppData/Bio/samples/HELM.csv",peptidesComplex:"System:AppData/Bio/tests/peptides_complex_msa.csv",peptidesSimple:"System:AppData/Bio/tests/peptides_simple_msa.csv",testDemogCsv:"System:AppData/Bio/tests/testDemog.csv",testHelmCsv:"System:AppData/Bio/tests/testHelm.csv",testIdCsv:"System:AppData/Bio/tests/testId.csv",testSmilesCsv:"System:AppData/Bio/tests/testSmiles.csv",testSmiles2Csv:"System:AppData/Bio/tests/testSmiles2.csv",testSmilesShort:"System:AppData/Bio/tests/testSmilesShort.csv",testActivityCliffsCsv:"System:AppData/Bio/tests/testActivityCliffs.csv",testCerealCsv:"System:AppData/Bio/tests/testCereal.csv",testUnichemSources:"System:AppData/Bio/tests/testUnichemSources.csv",testDmvOffices:"System:AppData/Bio/tests/testDmvOffices.csv",testAlertCollection:"System:AppData/Bio/tests/testAlertCollection.csv",testSpgi100:"System:AppData/Bio/tests/testSpgi100.csv",testSpgi:"System:AppData/Bio/tests/SPGI-derived.csv",testUrl:"System:AppData/Bio/tests/testUrl.csv"},I={};function R(t,e=O){return async()=>(t in I||(I[t]=(async()=>await e(P[t]))().catch((e=>{throw delete I[t],e}))),I[t])}async function O(e){const s=await a.dapi.files.readAsText(e);return t.DataFrame.fromCsv(s)}const G=e=>async()=>{const s=_[e],n=t.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(n),n};(0,e.Bu)("NegativeEmpty",(async()=>{await d(G("negEmpty"),"col1")})),(0,e.Bu)("Negative1",(async()=>{await d(G("neg1"),"col1")})),(0,e.Bu)("Negative2",(async()=>{await d(G("neg2"),"col1")})),(0,e.Bu)("Negative3",(async()=>{await d(G("neg3"),"col1")})),(0,e.Bu)("NegativeSmiles",(async()=>{await d(G("negSmiles"),"col1")})),(0,e.Bu)("NegativeStartEnd",(async()=>{await u(["START","END"])})),(0,e.Bu)("NegativeStartEndIntermediate",(async()=>{await u(["START","END","INTERMEDIATE"])})),(0,e.Bu)("FastaDna1",(async()=>{await p(G("csvFastaDna1"),"seq",c.r2.FASTA,"SEQ","DNA",4,!1)})),(0,e.Bu)("FastaRna1",(async()=>{await p(G("fastaRna1"),"seq",c.r2.FASTA,"SEQ","RNA",4,!1)})),(0,e.Bu)("FastaPt1",(async()=>{await p(G("fastaPt1"),"seq",c.r2.FASTA,"SEQ","PT",20,!1)})),(0,e.Bu)("FastaPtGaps",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.r2.FASTA,"SEQ","PT",20,!1))),(0,e.Bu)("FastaPtGapsMsa",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.r2.FASTA,"SEQ.MSA","PT",20,!1))),(0,e.Bu)("FastaUn",(async()=>{await p(G("fastaUn"),"seq",c.r2.FASTA,"SEQ.MSA","UN",12,!0)})),(0,e.Bu)("FastaMsaDna1",(async()=>{await p(G("fastaMsaDna1"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,e.Bu)("FastaMsaPt1",(async()=>{await p(G("fastaMsaPt1"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,e.Bu)("SepDna",(async()=>{await p(G("sepDna"),"seq",c.r2.SEPARATOR,"SEQ","DNA",4,!1,"*")})),(0,e.Bu)("SepRna",(async()=>{await p(G("sepRna"),"seq",c.r2.SEPARATOR,"SEQ","RNA",4,!1,"*")})),(0,e.Bu)("SepPt",(async()=>{await p(G("sepPt"),"seq",c.r2.SEPARATOR,"SEQ","PT",20,!1,"-")})),(0,e.Bu)("SepUn1",(async()=>{await p(G("sepUn1"),"seq",c.r2.SEPARATOR,"SEQ","UN",8,!0,"-")})),(0,e.Bu)("SepUn2",(async()=>{await p(G("sepUn2"),"seq",c.r2.SEPARATOR,"SEQ","UN",9,!0,"/")})),(0,e.Bu)("SepMsaN1",(async()=>{await p(G("sepMsaDna1"),"seq",c.r2.SEPARATOR,"SEQ.MSA","DNA",4,!1,"-")})),(0,e.Bu)("SepMsaUnWEmpty",(async()=>{await p(G("sepMsaUnWEmpty"),"seq",c.r2.SEPARATOR,"SEQ.MSA","UN",14,!0)})),(0,e.Bu)("SepComplex",(async()=>{await p(G("sepComplex"),"seq",c.r2.SEPARATOR,"SEQ","UN",18,!0)})),(0,e.Bu)("samplesFastaCsv",(async()=>{await f(R("fastaCsv"),{Sequence:new g(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,e.Bu)("samplesFastaFasta",(async()=>{await f(R("fastaFasta"),{sequence:new g(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,e.Bu)("samplesPeptidesComplex",(async()=>{await f(R("peptidesComplex"),{})})),(0,e.Bu)("samplesMsaComplex",(async()=>{await f(R("msaComplex"),{MSA:new g(c.r2.SEPARATOR,"SEQ.MSA","UN",161,!0,"/")})})),(0,e.Bu)("samplesIdCsv",(async()=>{await f(R("testIdCsv"),{})})),(0,e.Bu)("samplesSarSmallCsv",(async()=>{await f(R("testSmilesCsv"),{})})),(0,e.Bu)("samplesHelmCsv",(async()=>{await f(R("helmCsv"),{HELM:new g(c.r2.HELM,null,null,160,!0)})})),(0,e.Bu)("samplesTestHelmCsv",(async()=>{await f(R("testHelmCsv"),{"HELM string":new g(c.r2.HELM,null,null,9,!0)})})),(0,e.Bu)("samplesTestDemogCsv",(async()=>{await f(R("testDemogCsv"),{})})),(0,e.Bu)("samplesTestSmiles2Csv",(async()=>{await f(R("testSmiles2Csv"),{})})),(0,e.Bu)("samplesTestSmilesShort",(async()=>{await f(R("testSmilesShort"),{})})),(0,e.Bu)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await f(R("testActivityCliffsCsv"),{})})),(0,e.Bu)("samplesFastaPtCsv",(async()=>{await f(R("fastaPtCsv"),{sequence:new g(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,e.Bu)("samplesTestCerealCsv",(async()=>{await f(R("testCerealCsv"),{})})),(0,e.Bu)("samplesTestUnichemSources",(async()=>{await f(R("testUnichemSources"),{})})),(0,e.Bu)("samplesTestDmvOffices",(async()=>{await f(R("testDmvOffices"),{})})),(0,e.Bu)("samplesTestAlertCollection",(async()=>{await f(R("testAlertCollection"),{})})),(0,e.Bu)("samplesTestSpgi",(async()=>{await f(R("testSpgi"),{})})),(0,e.Bu)("samplesTestSpgi100",(async()=>{await f(R("testSpgi100"),{})})),(0,e.Bu)("samplesTestUrl",(async()=>{await f(R("testUrl"),{})}))}));class g{constructor(t,e,s,n,i,o){this.units=t,this.aligned=e,this.alphabet=s,this.alphabetSize=n,this.alphabetIsMultichar=i,this.separator=o}}async function f(t,e){const s=await t(),n=[];for(const i of s.columns.names())if(i in e){const s=e[i];try{await p(t,i,s.units,s.aligned,s.alphabet,s.alphabetSize,s.alphabetIsMultichar,s.separator)}catch(t){const e=t.toString();n.push(`Positive col '${i}' failed: ${e}`)}}else try{await d(t,i)}catch(t){const e=t.toString();n.push(`Negative col '${i}' failed: ${e}`)}if(n.length>0)throw new Error(n.join("\n"))}(0,e.W3)("detectors:weak-and-likely",(()=>{const s={fastaDnaWeak1:"id,colName\n1,TTTTTTTTTT\n2,TTTTTTTTTT\n3,TTTTTTTTTT\n4,TTTTTTTTTT",fastaDnaWeak1LikelyName:"id,seq\n1,TTTTTTT\n2,TTTTTTT\n3,TTTTTTT\n4,TTTTTTT",fastaRnaWeak1:"id,colName\n1,UUUUUUUUUU\n2,UUUUUUUUUU\n3,UUUUUUUUUU\n4,UUUUUUUUUU",fastaRnaWeak1LikelyName:"id,seq\n1,UUUUUUU\n2,UUUUUUU\n3,UUUUUUU\n4,UUUUUUU",fastaPtWeak1:"id,colName\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaPtWeak1LikelyName:"id,seq\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaUn1:"id,colName\n1,word\n2,other\n3,some\n4,another",fastaUn1LikelyName:"id,seq\n1,word\n2,other\n3,some\n4,another",fastaUn2LikelyName:'protein\nBoombastic\nMegafantastic\n"just-a-random-thought,oy!"',fastaUnMsa1LikelyName:"id,seq\n1,word\n2,male\n3,bare\n4,core"},n=e=>async()=>{const n=s[e],i=t.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i};(0,e.Bu)("fastaDnaWeak1",(async()=>{await d(n("fastaDnaWeak1"),"colName")})),(0,e.Bu)("fastaDnaWeak1LikelyName",(async()=>{await p(n("fastaDnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,e.Bu)("fastaRnaWeak1",(async()=>{await d(n("fastaRnaWeak1"),"colName")})),(0,e.Bu)("fastaRnaWeak1LikelyName",(async()=>{await p(n("fastaRnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","RNA",4,!1)})),(0,e.Bu)("fastaPtWeak1",(async()=>{await d(n("fastaPtWeak1"),"colName")})),(0,e.Bu)("fastaPtWeak1LikelyName",(async()=>{await p(n("fastaPtWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,e.Bu)("fastaUn1",(async()=>{await d(n("fastaUn1"),"colName")})),(0,e.Bu)("fastaUn1LikelyName",(async()=>{await d(n("fastaUn1LikelyName"),"seq")})),(0,e.Bu)("fastaUn2LikelyName",(async()=>{await d(n("fastaUn2LikelyName"),"protein")})),(0,e.Bu)("fastaUnMsa1LikelyName",(async()=>{await d(n("fastaUnMsa1LikelyName"),"seq")}))})),(0,e.W3)("detectorsBenchmark",(()=>{let s;async function n(n,o,r,a,l,u){return await async function(n,d,m,p){const g=(()=>{const e=function(e,s,n,i,o){let r;switch(e){case c.r2.FASTA:r=t=>{let e="";for(let s=0;s<t.length;s++){const n=t[s];e+=1==n.length?n:`[${n}]`}return e};break;case c.r2.SEPARATOR:r=(t,e)=>t.join(e);break;default:throw new Error(`Not supported notation '${e}'.`)}const a=(t,e)=>{const s=new Array(e);for(let n=0;n<e;n++)s[n]=t[Math.floor(Math.random()*t.length)];return r(s,o)},l=Array(i);for(let t=0;t<i;t++)l[t]=a(s,n);return t.Column.fromStrings("seq",l)}(o,[...(0,c.gM)(r)],a,l,u),n=s.prepare({col:e});return i(n),n})(),f=Date.now(),y=await(async t=>i(t))(g),C=Date.now();(function(t,s){const n=h.Cn.getOrCreate(t);(0,e.l_)(t.semType===s.semType,!0),(0,e.l_)(n.notation===s.notation,!0),(0,e.l_)(n.alphabet===s.alphabet,!0),(0,e.l_)(n.separator===s.separator,!0)})(y,{semType:t.SEMTYPE.MACROMOLECULE,notation:o,alphabet:r,separator:u});const T=C-f;if(T>n){const t=`ET ${T} ms is more than max allowed ${n} ms.`;throw console.error(t),new Error(t)}return console.log(`ET ${T} ms is OK.`),T}(n)}function i(t){t.callSync();const e=t.getOutputParamValue(),s=t.inputs.col;return e&&(s.semType=e),s}(0,e.bb)((async()=>{const e=t.Func.find({package:"Bio",name:"detectMacromolecule"});s=e[0];const n=t.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await s.prepare({col:n}).call()})),(0,e.Bu)("fastaDnaShorts50Few50",(async()=>{await n(10,c.r2.FASTA,"DNA",50,50)})),(0,e.Bu)("fastaDnaShorts50Many1E6",(async()=>{await n(20,c.r2.FASTA,"DNA",50,1e6)})),(0,e.Bu)("fastaDnaLong1e6Few50",(async()=>{await n(20,c.r2.FASTA,"DNA",1e6,50)})),(0,e.Bu)("separatorDnaShorts50Few50",(async()=>{await n(10,c.r2.SEPARATOR,"DNA",50,50,"/")})),(0,e.Bu)("separatorDnaShorts50Many1E6",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",50,1e6,"/")})),(0,e.Bu)("separatorDnaLong1e6Few50",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",1e6,50,"/")}))}));var y=s(6098),C=s(525);async function T(e){const s=await async function(t){return await mt.files.readAsText(t)}(e),n=t.DataFrame.fromCsv(s);return n.name=e.replace(".csv",""),n}async function A(t=1e4){const s=await a.dapi.docker.dockerContainers.filter("bio").first();"started"!==s.status&&"checking"!==s.status&&await(0,e.gw)(t)}async function b(s,n){const i=t.DataFrame.fromCsv(s),o=t.DataFrame.fromCsv(n),r=i.getCol("seq"),l=await a.functions.call("Bio:detectMacromolecule",{col:r});l&&(r.semType=l);const c=o.getCol("seq"),h=await(0,y.U)(r,!0);(0,e.f6)(h.toList(),c.toList())}async function w(s,n,i,o,r,l){const c=t.DataFrame.fromCsv(s),h=t.DataFrame.fromCsv(n),u=c.getCol("seq"),d=h.getCol("seq"),m=c.getCol("seq"),p=await a.functions.call("Bio:detectMacromolecule",{col:m});p&&(m.semType=p),await a.data.detectSemanticTypes(c),(0,e.l_)(u.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(u.getTag(t.TAGS.UNITS),i),r&&(0,e.l_)(u.getTag("alphabet"),r);const g=await(0,C.K)({col:u,pepsea:{method:l}});(0,e.l_)(g.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(g.getTag(t.TAGS.UNITS),o),(0,e.l_)(g.getTag("aligned"),"SEQ.MSA"),r&&(0,e.l_)(g.getTag("alphabet"),r),(0,e.f6)(g.toList(),d.toList())}(0,e.W3)("MSA",(async()=>{(0,e.Bu)("isCorrect",(async()=>{await b("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,e.Bu)("isCorrectLong",(async()=>{await b("seq\nFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP","seq\nFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHP\nYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP")})),(0,e.Bu)("isCorrectHelm",(async()=>{await A(),await w("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{meI.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{hHis.Aca.N.T.dE.Thr_PO3H2}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2\n .meI.Aca.N.T.dE.Thr_PO3H2\n .hHis.Aca.N.T.dE.Thr_PO3H2",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")})),(0,e.Bu)("isCorrectHelmLong",(async()=>{await A(),await w("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2}$$$$\n PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\n PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2\n meI.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me.\n Lys_Boc.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me.",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")})),(0,e.Bu)("isCorrectSeparator",(async()=>{await w("seq\n F-W-P-H-E-Y\n Y-N-R-Q-W-Y-V\n M-K-P-S-E-Y-V","seq\n FWPHEY-\n YNRQWYV\n MKPSEYV",c.r2.SEPARATOR,c.r2.FASTA,"PT")})),(0,e.Bu)("isCorrectSeparatorLong",(async()=>{await w("seq\n M-I-E-V-F-L-F-G-I-V-L-G-L-I-P-I-T-L-A-G-L-F-V-T-A-Y-L-Q-Y-R-R-G-D-Q-L-D-L\n M-M-E-L-V-L-K-T-I-I-G-P-I-V-V-G-V-V-L-R-I-V-D-K-W-L-N-K-D-K\n M-D-R-T-D-E-V-S-N-H-T-H-D-K-P-T-L-T-W-F-E-E-I-F-E-E-Y-H-S-P-F-H-N","seq\n MIEV-FLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n MMEL-VLKTII-GPIVVGVVLRIVDKWLNKDK------\n MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN-----",c.r2.SEPARATOR,c.r2.FASTA,"PT")}))}));var S=s(3553),E=s(9416);async function v(t,s){const n=(0,c.kB)(t);console.debug(`Bio: tests: splitters: src=${JSON.stringify(t)}, res=${JSON.stringify(n)} .`),(0,e.f6)(n,s)}async function x(t,s){const n=(0,c.gP)(t);console.debug(`Bio: tests: splitters: src=${JSON.stringify(t)}, res=${JSON.stringify(n)} .`),(0,e.f6)(n,s)}(0,e.W3)("splitters",(async()=>{(0,e.bb)((async()=>{})),(0,e.X5)((async()=>{}));const s=["M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",["M","MeI","Y","K","E","T","L","L","MeF","P","K","T","D","F","P","M","R","G","G","L","MeA"]],n=["[meI][Pip][dK][Thr_PO3H2][L-hArg(Et,Et)][D-Tyr_Et][Tyr_ab-dehydroMe][dV]EN[D-Orn][D-aThr][Phe_4Me]",["meI","Pip","dK","Thr_PO3H2","L-hArg(Et,Et)","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],i=["PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],o=["PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.D-Dap.dV.E.N.pnG.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],r=["PEPTIDE1{[meI].[hHis].[Aca].N.T.[dK].[Thr_PO3H2].[Aca].[D-Tyr_Et].[D-Dap].[dV].E.N.[pnG].[Phe_4Me]}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],c=["RNA1{R(U)P.R(T)P.R(G)P.R(C)P.R(A)}$$$$",["R(U)P","R(T)P","R(G)P","R(C)P","R(A)"]],h=["RNA1{P.R(U)P.R(T)}$$$$",["P","R(U)P","R(T)"]],u=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,e.Bu)("fastaMulti",(async()=>{await v(s[0],s[1])})),(0,e.Bu)("fastaFromHelm",(async()=>{await v(n[0],n[1])})),(0,e.Bu)("helm1",(async()=>{await x(i[0],i[1])})),(0,e.Bu)("helm2",(async()=>{await x(o[0],o[1])})),(0,e.Bu)("helm3-multichar",(async()=>{await x(r[0],r[1])})),(0,e.Bu)("testHelm1",(async()=>{await x(c[0],c[1])})),(0,e.Bu)("testHelm2",(async()=>{await x(h[0],h[1])})),(0,e.Bu)("testHelm3",(async()=>{await x(u[0],u[1])})),(0,e.Bu)("splitToMonomers",(async()=>{const t=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),s=t.getCol("MSA"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),s.setTag("aligned",S.mU);const i=await(0,E.n)(t,s);(0,e.l_)(i.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(i);const o=a.shell.addTableView(i);await(0,e.ow)((()=>o.grid.dataFrame!=t),"View grid has wrong data frame",100)})),(0,e.Bu)("getHelmMonomers",(async()=>{const e=t.DataFrame.fromCsv("HELM,Activity\nPEPTIDE1{hHis.N.T}$$$,5.30751\nPEPTIDE1{hHis.Aca.Cys_SEt}$$$,5.72388\n");await a.data.detectSemanticTypes(e);const s=["hHis","Aca","Cys_SEt","N","T"],n=e.getCol("HELM"),i=(0,l.getHelmMonomers)(n),o=s.filter((t=>!i.includes(t))),r=i.filter((t=>!s.includes(t)));if(o.length>0||r.length){const t=[];throw o.length>0&&t.push(`Missed monomers ${JSON.stringify(o)}.`),r.length>0&&t.push(`Unexpected monomers ${JSON.stringify(r)}.`),new Error(t.join(" "))}}))}));var L=s(7228),M=s(6584),N=s(2918);(0,e.W3)("monomerLibraries",(()=>{let t,s=null;(0,e.bb)((async()=>{t=await(0,L.JN)(),s=(0,M.nW)()})),(0,e.X5)((async()=>{await(0,M.tW)(s)})),(0,e.Bu)("default",(async()=>{await(0,M.tW)({exclude:[],explicit:[]}),await t.loadLibraries(!0);const s=t.getBioLib();(0,e.l_)(s.getPolymerTypes().length>0,!0)})),(0,e.Bu)("forTests",(async()=>{await(0,M.tb)(),await t.loadLibraries(!0);const s=t.getBioLib();(0,e.l_)(s.getPolymerTypes().length,2),(0,e.l_)(s.getMonomerSymbolsByType("PEPTIDE").length,322),(0,e.l_)(s.getMonomerSymbolsByType("RNA").length,383)})),(0,e.Bu)("empty",(async()=>{const s=await(0,M.nW)(),n=await(0,N.P4)();s.exclude=n,s.explicit=[],await(0,M.tW)(s),await t.loadLibraries(!0);const i=t.getBioLib();(0,e.l_)(0===i.getPolymerTypes().length,!0),i.getMonomerMolsByPolymerType("PEPTIDE")}))}));var _=s(4004);function P(){const e=[];return e.push(t.Column.fromList("string","MSA",new Array(10**6).fill("meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"))),e.push(t.Column.fromList("string","Activity",new Array(10**6).fill("5.30751"))),e}function I(){const e=[],s="meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr".repeat(10**5);return e.push(t.Column.fromList("string","MSA",new Array(100).fill(s))),e.push(t.Column.fromList("string","Activity",new Array(100).fill("7.30751"))),e}async function R(s,n){const i=s(),o=t.DataFrame.fromColumns(i);await a.data.detectSemanticTypes(o);const r=Date.now(),l=(o.columns.byName("MSA"),a.shell.addTableView(o));await(0,e.ow)((()=>l.grid.dataFrame!==o),"View grid has wrong data frame ",100);const c=Date.now()-r;console.log(`Performance test: ${n}: ${c}ms`)}(0,e.W3)("renderers",(()=>{(0,e.Bu)("long sequence performance ",(async()=>{await R(I,"Long sequences")})),(0,e.Bu)("many sequence performance",(async()=>{await R(P,"Many sequences")})),(0,e.Bu)("many sequence performance",(async()=>{await R(P,"Many sequences")})),(0,e.Bu)("rendererMacromoleculeFasta",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),n=t.DataFrame.fromCsv(s),i=n.getCol("Sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100);const l=i.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(l,"sequence")}()})),(0,e.Bu)("rendererMacromoleculeSeparator",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_SEPARATOR_PT.csv"),n=t.DataFrame.fromCsv(s),i=n.getCol("sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100);const l=i.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(l,"sequence")}()})),(0,e.Bu)("rendererMacromoleculeDifference",(async()=>{await async function(){const s=t.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(t.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=S.Of.MACROMOLECULE_DIFFERENCE;const n=t.DataFrame.fromColumns([s]),i=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await(0,e.ow)((()=>i.grid.dataFrame!=n),"View grid has wrong data frame",100);const o=s.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(o,S.Of.MACROMOLECULE_DIFFERENCE)}()})),(0,e.Bu)("afterMsa",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA.fasta"),n=(0,l.importFasta)(s)[0],i=n.getCol("sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),console.log("Bio: tests/renderers/afterMsa, table view"),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${i.semType}", units="${i.getTag(t.TAGS.UNITS)}", cell.renderer="${i.getTag(t.TAGS.CELL_RENDERER)}"`),(0,e.l_)(i.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(i.getTag(t.TAGS.UNITS),c.r2.FASTA),(0,e.l_)(i.getTag("aligned"),"SEQ"),(0,e.l_)(i.getTag("alphabet"),"PT"),(0,e.l_)(i.getTag(t.TAGS.CELL_RENDERER),"sequence");const u=await(0,C.K)({col:i});r.grid.invalidate(),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100),(0,e.l_)(u.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(u.getTag(t.TAGS.UNITS),c.r2.FASTA),(0,e.l_)(u.getTag("aligned"),"SEQ.MSA"),(0,e.l_)(u.getTag("alphabet"),"PT"),(0,e.l_)(u.getTag(t.TAGS.CELL_RENDERER),"sequence"),h.Cn.getOrCreate(u)}()})),(0,e.Bu)("afterConvert",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA_PT.csv"),n=t.DataFrame.fromCsv(s),i=n.col("sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const l=await(0,_.o)(i,c.r2.SEPARATOR,"/");await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100);const u=l.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(u,"sequence"),h.Cn.getOrCreate(l)}()})),(0,e.Bu)("selectRendererBySemType",(async()=>{await async function(){const s=t.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(t.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=S.Of.MACROMOLECULE_DIFFERENCE;const n=t.DataFrame.fromColumns([s]);a.shell.addTableView(n),await(0,e.gw)(100);const i=s.getTag(t.TAGS.CELL_RENDERER);if("MacromoleculeDifference"!==i)throw new Error(`Units 'separator', separator '/' and semType 'MacromoleculeDifference' have been manually set on column but after df was added as table, view renderer has set to '${i}' instead of correct 'MacromoleculeDifference'.`)}()}))}));var O=s(6414),G=s.n(O),F=s(9611);(0,e.W3)("renderers: monomerPlacer",(()=>{const s={splitter:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num-MON8-N9\nid3,mon1-M-mon3-mon4-mon5-MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:6},tgt:{pos:0}},{src:{row:1,x:26},tgt:{pos:1}},{src:{row:1,x:160},tgt:{pos:6}},{src:{row:1,x:185},tgt:{pos:7}},{src:{row:2,x:140},tgt:{pos:5}},{src:{row:2,x:145},tgt:{pos:5}}]},splitterMsa:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num--MON8-N9\nid3,\nid4,mon1-M-mon3-mon4-mon5---MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:4},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:37},tgt:{pos:0}},{src:{row:1,x:38},tgt:{pos:1}},{src:{row:1,x:170},tgt:{pos:4}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:4}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:282},tgt:{pos:null}}]},fastaMsa:{csv:"id,seq\nid1,QQYNIYPLT\nid2,QQWSSFPYT\nid3,\nid3,QHIRE--LT\n",testList:[{src:{row:1,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:19},tgt:{pos:0}},{src:{row:1,x:170},tgt:{pos:8}},{src:{row:1,x:171},tgt:{pos:8}},{src:{row:2,x:5},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:8}},{src:{row:3,x:181},tgt:{pos:null}}]}};for(const[n,i]of Object.entries(s))(0,e.Bu)(`getPosition-${n}`,(async()=>{const e=t.DataFrame.fromCsv(i.csv);await a.data.detectSemanticTypes(e);const s=e.getCol("seq"),n=new F.A(null,s,(()=>({unitsHandler:h.Cn.getOrCreate(s),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.GU,monomerLengthLimit:3}))),o=i.testList;for(let t=0;t<s.length;++t)n.getCellMonomerLengths(t);const r=[];for(const[t,e]of G().enumerate(o)){const e={pos:n.getPosition(t.src.row,t.src.x)};t.tgt.pos!=e.pos&&r.push(`Test src ${JSON.stringify(t.src)} expected tgt ${JSON.stringify(t.tgt)}, but get ${JSON.stringify({res:e})}`)}if(r.length>0)throw new Error("Test failed error(s):\n"+r.join(", n"))}))})),(0,e.W3)("converters",(()=>{let s;!function(t){t.fastaPt="fastaPt",t.separatorPt="separatorPt",t.helmPt="helmPt",t.fastaDna="fastaDna",t.separatorDna="separatorDna",t.helmDna="helmDna",t.fastaRna="fastaRna",t.separatorRna="separatorRna",t.helmRna="helmRna",t.fastaGaps="fastaGaps",t.separatorGaps="separatorGaps",t.helmGaps="helmGaps",t.fastaUn="fastaUn",t.separatorUn="separatorUn",t.helmUn="helmUn",t.helmLoneDeoxyribose="helmLoneDeoxyribose",t.helmLoneRibose="helmLoneRibose",t.helmLonePhosphorus="helmLonePhosphorus",t.fastaLoneDeoxyribose="fastaLoneDeoxyribose",t.fastaLoneRibose="fastaLoneRibose",t.fastaLonePhosphorus="fastaLonePhosphorus"}(s||(s={}));const n={[s.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[s.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[s.helmPt]:"seq\nPEPTIDE1{F.W.P.H.E.Y.F.W.P.H.E.Y}$$$$\nPEPTIDE1{Y.N.R.Q.W.Y.V.Y.N.R.Q.W.Y.V}$$$$\nPEPTIDE1{M.K.P.S.E.Y.V.M.K.P.S.E.Y.V}$$$$",[s.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[s.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[s.helmDna]:"seq\nRNA1{d(A)p.d(C)p.d(G)p.d(T)p.d(C)p.d(A)p.d(C)p.d(G)p.d(T)p.d(C)p}$$$$\nRNA1{d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p.d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p}$$$$\nRNA1{d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p.d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p}$$$$",[s.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[s.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[s.helmRna]:"seq\nRNA1{r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p}$$$$",[s.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[s.separatorGaps]:"seq\nF/W//P/H//E/Y/Y/F/W//P/H//E/Y/Y\nF/Y/N/R/Q/W/Y/V//F/Y/N/R/Q/W/Y/V/\nF/K/P//Q//S/E/Y/V/F/K/P//Q//S/E/Y/V",[s.helmGaps]:"seq\nPEPTIDE1{F.W.*.P.H.*.E.Y.Y.F.W.*.P.H.*.E.Y.Y}$$$$\nPEPTIDE1{F.Y.N.R.Q.W.Y.V.*.F.Y.N.R.Q.W.Y.V.*}$$$$\nPEPTIDE1{F.K.P.*.Q.*.S.E.Y.V.F.K.P.*.Q.*.S.E.Y.V}$$$$",[s.fastaUn]:"seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca]",[s.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca",[s.helmUn]:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D.meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca}$$$$",[s.helmLoneDeoxyribose]:"seq\nRNA1{d(A).d(C).d(G).d(T).d(C).d(A).d(C).d(G).d(T).d(C)}$$$$\nRNA1{d(C).d(A).d(G).d(T).d(G).d(T)p.d(C).d(A).d(G).d(T).d(G).d(T)p}$$$$\nRNA1{d(T).d(T).d(C).d(A).d(A).d(C)p.d(T).d(T).d(C).d(A).d(A).d(C)p}$$$$",[s.helmLoneRibose]:"seq\nRNA1{r(A).r(C).r(G).r(U).r(C).r(A).r(C).r(G).r(U).r(C)}$$$$\nRNA1{r(C).r(A).r(G).r(U).r(G).r(U)p.r(C).r(A).r(G).r(U).r(G).r(U)p}$$$$\nRNA1{r(U).r(U).r(C).r(A).r(A).r(C)p.r(U).r(U).r(C).r(A).r(A).r(C)p}$$$$",[s.helmLonePhosphorus]:"seq\nRNA1{p.p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{p.p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.p.p}$$$$"};async function i(e){const s=n[e],i=t.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(i),i}function o(s,n){if(s===c.r2.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${s.toString()}'.`);return function(i){const o=h.Cn.getOrCreate(i).convert(s,n);return(0,e.l_)(o.getTag(t.TAGS.UNITS),s),o}}async function r(t,s,n){const o=s((await i(t)).getCol("seq")),r=(await i(n)).getCol("seq");(0,e.f6)(o.toList(),r.toList()),h.Cn.getOrCreate(o)}(0,e.Bu)("testFastaPtToSeparator",(async()=>{await r(s.fastaPt,o(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,e.Bu)("testFastaDnaToSeparator",(async()=>{await r(s.fastaDna,o(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,e.Bu)("testFastaRnaToSeparator",(async()=>{await r(s.fastaRna,o(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,e.Bu)("testFastaGapsToSeparator",(async()=>{await r(s.fastaGaps,o(c.r2.SEPARATOR,"/"),s.separatorGaps)})),(0,e.Bu)("testFastaUnToSeparator",(async()=>{await r(s.fastaUn,o(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,e.Bu)("testFastaPtToHelm",(async()=>{await r(s.fastaPt,o(c.r2.HELM),s.helmPt)})),(0,e.Bu)("testFastaDnaToHelm",(async()=>{await r(s.fastaDna,o(c.r2.HELM),s.helmDna)})),(0,e.Bu)("testFastaRnaToHelm",(async()=>{await r(s.fastaRna,o(c.r2.HELM),s.helmRna)})),(0,e.Bu)("testFastaGapsToHelm",(async()=>{await r(s.fastaGaps,o(c.r2.HELM),s.helmGaps)})),(0,e.Bu)("testSeparatorPtToFasta",(async()=>{await r(s.separatorPt,o(c.r2.FASTA),s.fastaPt)})),(0,e.Bu)("testSeparatorDnaToFasta",(async()=>{await r(s.separatorDna,o(c.r2.FASTA),s.fastaDna)})),(0,e.Bu)("testSeparatorRnaToFasta",(async()=>{await r(s.separatorRna,o(c.r2.FASTA),s.fastaRna)})),(0,e.Bu)("testSeparatorGapsToFasta",(async()=>{await r(s.separatorGaps,o(c.r2.FASTA),s.fastaGaps)})),(0,e.Bu)("testSeparatorUnToFasta",(async()=>{await r(s.separatorUn,o(c.r2.FASTA),s.fastaUn)})),(0,e.Bu)("testSeparatorPtToHelm",(async()=>{await r(s.separatorPt,o(c.r2.HELM),s.helmPt)})),(0,e.Bu)("testSeparatorDnaToHelm",(async()=>{await r(s.separatorDna,o(c.r2.HELM),s.helmDna)})),(0,e.Bu)("testSeparatorRnaToHelm",(async()=>{await r(s.separatorRna,o(c.r2.HELM),s.helmRna)})),(0,e.Bu)("testSeparatorGapsToHelm",(async()=>{await r(s.separatorGaps,o(c.r2.HELM),s.helmGaps)})),(0,e.Bu)("testHelmDnaToFasta",(async()=>{await r(s.helmDna,o(c.r2.FASTA),s.fastaDna)})),(0,e.Bu)("testHelmRnaToFasta",(async()=>{await r(s.helmRna,o(c.r2.FASTA),s.fastaRna)})),(0,e.Bu)("testHelmPtToFasta",(async()=>{await r(s.helmPt,o(c.r2.FASTA),s.fastaPt)})),(0,e.Bu)("testHelmUnToFasta",(async()=>{await r(s.helmUn,o(c.r2.FASTA),s.fastaUn)})),(0,e.Bu)("testHelmDnaToSeparator",(async()=>{await r(s.helmDna,o(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,e.Bu)("testHelmRnaToSeparator",(async()=>{await r(s.helmRna,o(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,e.Bu)("testHelmPtToSeparator",(async()=>{await r(s.helmPt,o(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,e.Bu)("testHelmUnToSeparator",(async()=>{await r(s.helmUn,o(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,e.Bu)("testHelmLoneRibose",(async()=>{await r(s.helmLoneRibose,o(c.r2.FASTA),s.fastaRna)})),(0,e.Bu)("testHelmLoneDeoxyribose",(async()=>{await r(s.helmLoneDeoxyribose,o(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,e.Bu)("testHelmLonePhosphorus",(async()=>{await r(s.helmLonePhosphorus,o(c.r2.FASTA),s.fastaRna)}))}));var H=s(5226);(0,e.W3)("fastaFileHandler",(()=>{const s=["description:1","description:2","description:3","description:4"],n=(t.Column.fromStrings("description",s),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function i(t){const i=new H.i(t),o=i.descriptionsArray,r=i.sequencesArray;(0,e.f6)([o,r],[s,n])}(0,e.Bu)("testNormalFormatting",(async()=>{i(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,e.Bu)("testExtraSpaces",(async()=>{i(">description:1\n MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMI EVF LFGIVLGLI PITLAGLFVTAY LQYRRGDQLDL\n\n>description:3\nM MELVLKTI IGPI VVGVVLR IVDKWLNKDK\n\n>description:4\nMDR TDEVSNHTHDKP TLTWFEEIFEEYHSPFHN\n ")})),(0,e.Bu)("testExtraNewlines",(async()=>{i(">description:1\n\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVF\nLFGIVLGLI\nPITLAGLFVTA\nYLQYRRGDQLDL\n\n>description:3\nM\nME\n\nLVLKTIIG\n\nPIVVGVVLRI\nVDKWLNKDK\n\n\n>description:4\n\nMDRT\n\nDEVSNHTHDKP\n\nTLTWFEEIFEE\n\n\n\nYHSPFHN\n")}))}));var W=s(9943);(0,e.W3)("fastaExport",(()=>{let s;!function(t){t.single="single",t.multi="multi"}(s||(s={}));const n={[s.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[s.multi]:{src:"M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",tgt:["M[MeI]YKETLL[MeF]P","KTDFPMRGGL","[MeA]"]}};let i;!function(t){t.test1="test1",t.test2="test2"}(i||(i={}));const o={[i.test1]:{srcCsv:"id,seq\n1,MDYKETLLMP\n2,KTDFPMRGGL\n3,P",idCols:["id"],seqCol:"seq",lineWidth:10,tgtFasta:">1\nMDYKETLLMP\n>2\nKTDFPMRGGL\n>3\nP\n"},[i.test2]:{srcCsv:"id,id2,seq\n1,seqA,M[MeI]YKETLL[MeF]P\n2,seqB,KTDFPMRGGL\n3,seqC,[MeA]\n",idCols:["id2","id"],seqCol:"seq",lineWidth:5,tgtFasta:">seqA|1\nM[MeI]YKE\nTLL[MeF]P\n>seqB|2\nKTDFP\nMRGGL\n>seqC|3\n[MeA]\n"}};function r(t,s=10){const i=c.kB,o=n[t].src,r=(0,W.sK)(o,i,s),a=n[t].tgt;(0,e.f6)(r,a)}async function a(s){const n=t.DataFrame.fromCsv(s.srcCsv),i=n.getCol(s.seqCol),o=s.idCols.map((t=>n.getCol(t))),r=(0,W.i$)(o,i,s.lineWidth);(0,e.l_)(r,s.tgtFasta)}(0,e.Bu)("wrapSequenceSingle",(async()=>{r(s.single,10)})),(0,e.Bu)("wrapSequenceMulti",(async()=>{r(s.multi,10)})),(0,e.Bu)("saveAsFastaTest1",(async()=>{a(o[i.test1])})),(0,e.Bu)("saveAsFastaTest2",(async()=>{a(o[i.test2])}))}));var D=s(7331),B=s(8260);(0,e.W3)("bio",(()=>{const s="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,e.Bu)("testGetStatsHelm1",(async()=>{const s=t.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq"),n=(0,B.jY)(s,1,c.gP);(0,e.Wh)(n.freq,{meI:1}),(0,e.l_)(n.sameLength,!0)})),(0,e.Bu)("testGetStatsN1",(async()=>{await async function(s){const n=t.DataFrame.fromCsv(s).col("seq"),i=(0,B.jY)(n,5,c.kB);(0,e.Wh)(i.freq,{A:4,C:5,G:3,T:6}),(0,e.l_)(i.sameLength,!0)}(s)})),(0,e.Bu)("testGetAlphabetSimilarity",(async()=>{await async function(){const t=new Set(Object.keys(r.V.Names)),s=(0,c.KX)({A:2041,C:3015,G:3015,T:2048,"-":1e3},t);(0,e.l_)(s>.6,!0)}()})),(0,e.Bu)("testPickupPaletteN1",(async()=>{await async function(s){const n=t.DataFrame.fromCsv(s).col("seq"),i=(0,c.dQ)(n);(0,e.l_)(i instanceof r.J,!0)}(s)})),(0,e.Bu)("testPickupPaletteN1e",(async()=>{await async function(s){const n=t.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq"),i=(0,c.dQ)(n);(0,e.l_)(i instanceof r.J,!0)}()})),(0,e.Bu)("testPickupPaletteAA1",(async()=>{await async function(s){const n=t.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq"),o=(0,c.dQ)(n);(0,e.l_)(o instanceof i.f,!0)}()})),(0,e.Bu)("testPickupPaletteX",(async()=>{await async function(s){const n=t.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq"),i=(0,c.dQ)(n);(0,e.l_)(i instanceof D.kQ,!0)}()}))})),(0,e.W3)("WebLogo.monomerToShort",(()=>{(0,e.Bu)("longMonomerSingle",(async()=>{(0,e.l_)((0,c.GU)("S",5),"S")})),(0,e.Bu)("longMonomerShort",(async()=>{(0,e.l_)((0,c.GU)("Short",5),"Short")})),(0,e.Bu)("longMonomerLong56",(async()=>{(0,e.l_)((0,c.GU)("Long56",6),"Long56")})),(0,e.Bu)("longMonomerComplexFirstPartShort",(async()=>{(0,e.l_)((0,c.GU)("Long-long",5),"Long…")})),(0,e.Bu)("longMonomerComplexFirstPartLong56",(async()=>{(0,e.l_)((0,c.GU)("Long56-long",6),"Long5…")})),(0,e.Bu)("monomerToShort",(async()=>{const t=[["AbC","AbC"],["AbCd","Ab…"],["ABc","ABc"],["ABcd","AB…"],["A_b","A_b"],["A_bc","A…"],["Ab_c","Ab…"],["A1_b","A1…"],["Abc_d","Ab…"],["Abcd_e","Ab…"],["A-b","A-b"],["A-bc","A…"],["Ab-c","Ab…"],["A1-b","A1…"],["Abc-d","Ab…"],["Abcd-e","Ab…"],["A","A"],["Ab","Ab"],["Abc","Abc"],["Ab…","Ab…"],["Abcd","Ab…"],["Abcde","Ab…"]],s=t.map((t=>t[0])),n=t.map((t=>t[1])),i=s.map((t=>(0,c.GU)(t,3)));(0,e.f6)(i,n)}))}));var k=s(8415);function U(t,s){(0,e.l_)(t.name,s.name),(0,e.f6)(t.getMonomers(),s.getMonomers());for(const n of t.getMonomers())(0,e.l_)(t.getFreq(n).rowCount,s.getFreq(n).rowCount)}(0,e.W3)("WebLogo-positions",(()=>{const s="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,e.Bu)("allPositions",(async()=>{const n=t.DataFrame.fromCsv(s),i=a.shell.addTableView(n),o=n.getCol("seq");o.semType=t.SEMTYPE.MACROMOLECULE,o.setTag(t.TAGS.UNITS,c.r2.FASTA),o.setTag("alphabet","DNA"),o.setTag("aligned","SEQ.MSA");const r=await n.plot.fromType("WebLogo");await(0,e.zg)(r.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(r.root,t.DOCK_TYPE.DOWN)}),500);const l=r.positions,h=[new k.CK(0,"1",{A:new k.yW(2),"-":new k.yW(3)}),new k.CK(1,"2",{T:new k.yW(5)}),new k.CK(2,"3",{C:new k.yW(5)}),new k.CK(3,"4",{"-":new k.yW(5)}),new k.CK(4,"5",{G:new k.yW(5)}),new k.CK(5,"6",{"-":new k.yW(3),C:new k.yW(2)}),new k.CK(6,"7",{T:new k.yW(5)}),new k.CK(7,"8",{T:new k.yW(5)}),new k.CK(8,"9",{G:new k.yW(5)}),new k.CK(9,"10",{C:new k.yW(5)}),new k.CK(10,"11",{"-":new k.yW(5)}),new k.CK(11,"12",{"-":new k.yW(5)})];(0,e.l_)(l.length,h.length);for(let t=0;t<l.length;t++){(0,e.l_)(l[t].name,h[t].name);for(const s of l[t].getMonomers())(0,e.l_)(l[t].getFreq(s).rowCount,h[t].getFreq(s).rowCount)}})),(0,e.Bu)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const s=t.DataFrame.fromCsv("seq\n-TC-G-TTGC--\n-TC-GCTTGC--\n-T--C-GT-\n-T--C-GT-\n-T--C-GT-\n-T--CCGT-"),n=a.shell.addTableView(s),i=s.getCol("seq");i.semType=t.SEMTYPE.MACROMOLECULE,i.setTag(t.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","DNA"),i.setTag("aligned","SEQ"),s.filter.init((t=>t>2)),s.filter.fireChanged();const o=await s.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,e.zg)(o.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(o.root,t.DOCK_TYPE.DOWN)}),500);const r=o.positions,l=[new k.CK(0,"1",{"-":new k.yW(3)}),new k.CK(1,"2",{T:new k.yW(3)}),new k.CK(2,"3",{"-":new k.yW(3)}),new k.CK(3,"4",{"-":new k.yW(3)}),new k.CK(4,"5",{C:new k.yW(3)}),new k.CK(5,"6",{"-":new k.yW(2),C:new k.yW(1)}),new k.CK(6,"7",{G:new k.yW(3)}),new k.CK(7,"8",{T:new k.yW(3)}),new k.CK(8,"9",{"-":new k.yW(3)})];(0,e.l_)(r.length,l.length);for(let t=0;t<r.length;t++){(0,e.l_)(r[t].name,l[t].name);for(const s of r[t].getMonomers())(0,e.l_)(r[t].getFreq(s).rowCount,l[t].getFreq(s).rowCount)}})),(0,e.Bu)("positions with skipEmptyPositions option",(async()=>{const n=t.DataFrame.fromCsv(s),i=a.shell.addTableView(n),o=n.getCol("seq");o.semType=t.SEMTYPE.MACROMOLECULE,o.setTag(t.TAGS.UNITS,c.r2.FASTA),o.setTag("alphabet","DNA"),o.setTag("aligned","SEQ.MSA");const r=await n.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,e.zg)(r.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(r.root,t.DOCK_TYPE.DOWN)}),500);const l=r.positions,h=[new k.CK(0,"1",{A:new k.yW(2),"-":new k.yW(3)}),new k.CK(1,"2",{T:new k.yW(5)}),new k.CK(2,"3",{C:new k.yW(5)}),new k.CK(4,"5",{G:new k.yW(5)}),new k.CK(5,"6",{"-":new k.yW(3),C:new k.yW(2)}),new k.CK(6,"7",{T:new k.yW(5)}),new k.CK(7,"8",{T:new k.yW(5)}),new k.CK(8,"9",{G:new k.yW(5)}),new k.CK(9,"10",{C:new k.yW(5)})];(0,e.l_)(l.length,h.length);for(let t=0;t<l.length;t++)U(l[t],h[t])})),(0,e.Bu)("count sequences for monomer at position",(async()=>{const n=function(e,s,n,i){const o=t.DataFrame.fromCsv(e),r=o.getCol("seq");return r.semType=t.SEMTYPE.MACROMOLECULE,r.setTag(t.TAGS.UNITS,s),r.setTag("alphabet","DNA"),r.setTag("aligned","SEQ.MSA"),o}(s,c.r2.FASTA),i=n.getCol("seq"),o=a.shell.addTableView(n),r=await n.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,e.zg)(r.onLayoutCalculated,(()=>{}),(()=>{o.dockManager.dock(r.root,t.DOCK_TYPE.DOWN)}),500);const l=r.positions,u=[new k.CK(2,"3",{C:new k.yW(5)}),new k.CK(4,"5",{G:new k.yW(5)}),new k.CK(5,"6",{"-":new k.yW(3),C:new k.yW(2)}),new k.CK(6,"7",{T:new k.yW(5)})];(0,e.l_)(l.length,u.length);for(let t=0;t<l.length;t++)U(l[t],u[t]);const d=l[1],m=h.Cn.getOrCreate(i),p=(0,k.eZ)(n,m,n.filter,"G",d);(0,e.l_)(p,5)})),(0,e.Bu)("empty",(async()=>{const s=t.DataFrame.fromColumns([(()=>{const e=t.Column.fromStrings("seq",[]);return e.setTag(t.TAGS.SEMTYPE,t.SEMTYPE.MACROMOLECULE),e.setTag(t.TAGS.UNITS,c.r2.FASTA),e.setTag("alphabet","DNA"),e})()]),n=a.shell.addTableView(s),i=await s.plot.fromType("WebLogo");await(0,e.zg)(i.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(i.root,t.DOCK_TYPE.DOWN)}),500),i.positions}))}));var V=s(2568);function $(t,e){let s=null;for(const n of t.viewers)n.type===e&&(s=n);return s}(0,e.W3)("checkInputColumn",(()=>{const s="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,e.Bu)("testMsaPos",(async()=>{const n=t.DataFrame.fromCsv(s).getCol("seq");n.semType=t.SEMTYPE.MACROMOLECULE,n.setTag(t.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","DNA"),n.setTag("aligned","SEQ");const[i,o]=(0,V.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,e.l_)(i,!0)})),(0,e.Bu)("testMsaNegHelm",(async()=>{const n=t.DataFrame.fromCsv(s).getCol("seq");n.semType=t.SEMTYPE.MACROMOLECULE,n.setTag(t.TAGS.UNITS,c.r2.HELM),n.setTag(".alphabetIsMultichar","true");const[i,o]=(0,V.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,e.l_)(i,!1)})),(0,e.Bu)("testMsaNegUN",(async()=>{const n=t.DataFrame.fromCsv(s).getCol("seq");n.semType=t.SEMTYPE.MACROMOLECULE,n.setTag(t.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","UN"),n.setTag(".alphabetSize","11"),n.setTag(".alphabetIsMultichar","true"),n.setTag("aligned","SEQ");const[i,o]=(0,V.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,e.l_)(i,!1)})),(0,e.Bu)("testGetActionFunctionMeta",(async()=>{t.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((t=>"sequence"==t.name))}))})),(0,e.W3)("similarity/diversity",(async()=>{(0,e.Bu)("similaritySearchViewer",(async()=>{await async function(){const s=await mt.files.readAsText("tests/sample_MSA_data.csv"),n=t.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(n);const i=a.shell.addTableView(n),o=i.dataFrame.getCol("MSA");(0,e.l_)(o.semType,t.SEMTYPE.MACROMOLECULE);const r=await i.dataFrame.plot.fromType("Sequence Similarity Search");let l=!1;if(r.computeCompleted.subscribe((t=>{t&&(l=!0)})),i.dockManager.dock(r,t.DOCK_TYPE.RIGHT,null,"Similarity"),await r.renderPromise,await(0,e.ow)((()=>void 0!==$(i,"Sequence Similarity Search")),"Sequence Similarity Search viewer has not been created",100),!r.initialized)throw new Error("The viewer is not initialized.");if(!r.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!r.beforeRender())throw new Error("The viewer is not able to render.");if(!r.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=r;await(0,e.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,e.l_)(c.fingerprint,"Morgan"),(0,e.l_)(c.distanceMetric,"Tanimoto"),(0,e.l_)(c.scores.get(0),t.FLOAT_NULL),(0,e.l_)(c.idxs.get(0),0),(0,e.l_)(c.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,e.l_)(c.scores.get(1).toFixed(2),"0.73"),(0,e.l_)(c.idxs.get(1),4),(0,e.l_)(c.molCol.get(1),"Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/Chg/N/D-Orn/D-aThr//Phe_4Me"),i.dataFrame.currentRowIdx=1,await(0,e.ow)((()=>1===c.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,e.ow)((()=>"meI/hHis/Aca/Cys_SEt/T/dK/Thr_PO3H2/Aca/Tyr_PO3H2/D-Chg/dV/Phe_ab-dehydro/N/D-Orn/D-aThr//Phe_4Me"===c.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,e.Bu)("diversitySearchViewer",(async()=>{await async function(){const s=await mt.files.readAsText("tests/sample_MSA_data.csv"),n=t.DataFrame.fromCsv(s),i=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const o=i.dataFrame.getCol("MSA");(0,e.l_)(o.semType,t.SEMTYPE.MACROMOLECULE);const r=await i.dataFrame.plot.fromType("Sequence Diversity Search");let l=!1;if(r.computeCompleted.subscribe((t=>{t&&(l=!0)})),i.dockManager.dock(r,t.DOCK_TYPE.DOWN,null,"Diversity"),await r.renderPromise,await(0,e.ow)((()=>void 0!==$(i,"Sequence Diversity Search")),"Sequence Diversity Search viewer has not been created",100),!r.initialized)throw new Error("The viewer is not initialized.");if(!r.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!r.beforeRender())throw new Error("The viewer is not able to render.");if(!r.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=r;await(0,e.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,e.l_)(c.fingerprint,"Morgan"),(0,e.l_)(c.distanceMetric,"Tanimoto"),(0,e.l_)(c.initialized,!0),(0,e.l_)(c.renderMolIds.length>0,!0)}()}))}));var Y=s(6099);(0,e.W3)("substructureFilters",(async()=>{let t,s;(0,e.bb)((async()=>{t=await(0,L.JN)(),s=await(0,M.nW)(),await(0,M.tb)(),await t.loadLibraries(!0)})),(0,e.X5)((async()=>{await(0,M.tW)(s),await t.loadLibraries(!0)})),(0,e.Bu)("fasta",(async()=>{const t=await T("tests/filter_FASTA.csv"),s=new Y.ST;await a.data.detectSemanticTypes(t),s.attach(t),s.bioFilter.substructure="MD",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,3),(0,e.l_)(s.dataFrame.filter.get(0),!0),(0,e.l_)(s.dataFrame.filter.get(3),!0),(0,e.l_)(s.dataFrame.filter.get(8),!0),(0,e.l_)(s.dataFrame.filter.get(1),!1)})),(0,e.Bu)("separator",(async()=>{const t=await T("tests/filter_MSA.csv"),s=new Y.ST;await a.data.detectSemanticTypes(t),s.attach(t),s.bioFilter.substructure="meI",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,7),(0,e.l_)(s.dataFrame.filter.get(2),!1),s.bioFilter.substructure="/meI",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,0),s.bioFilter.substructure="meI-hHis",s.bioFilter.separatorInput.value="-",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,7),(0,e.l_)(s.dataFrame.filter.get(2),!1)})),(0,e.Bu)("helm",(async()=>{const t=await T("tests/filter_HELM.csv"),s=a.shell.addTableView(t),n=new Y.ST;await a.data.detectSemanticTypes(t),mt.logger.debug("Bio/substructureFilters/helm, filter attaching."),n.attach(t),mt.logger.debug("Bio/substructureFilters/helm, filter attached."),mt.logger.debug("Bio/substructureFilters/helm, filter 1 changing."),n.bioFilter.helmSubstructure="PEPTIDE1{C}$$$$V2.0",mt.logger.debug("Bio/substructureFilters/helm, filter 1 change awaiting."),await(0,e.zg)(t.onRowsFiltered,(()=>{}),(()=>{n.bioFilter.onChanged.next()}),2e4),mt.logger.debug("Bio/substructureFilters/helm, filter 1 changed."),(0,e.l_)(n.dataFrame.filter.trueCount,2),(0,e.l_)(n.dataFrame.filter.get(0),!0),(0,e.l_)(n.dataFrame.filter.get(3),!0),mt.logger.debug("Bio/substructureFilters/helm, filter 2 changing."),n.bioFilter.helmSubstructure="PEPTIDE1{A.C}$$$$V2.0",mt.logger.debug("Bio/substructureFilters/helm, filter 2 change awaiting."),await(0,e.zg)(t.onRowsFiltered,(()=>{}),(()=>{n.bioFilter.onChanged.next()}),2e4),await async function(t,s=5e3){await(0,e.gw)(0),await(0,e.zg)(t.onAfterDrawContent,(()=>{}),(()=>{t.invalidate()}),s)}(s.grid),mt.logger.debug("Bio/substructureFilters/helm, filter 2 changed."),(0,e.l_)(n.dataFrame.filter.trueCount,1),(0,e.l_)(n.dataFrame.filter.get(3),!0)}),{timeout:3e4})}));var K=s(8341);(0,e.W3)("PepSeA",(()=>{(0,e.Bu)("Basic alignment",(async()=>{await A();const s=t.DataFrame.fromCsv('HELM,MSA\n "PEPTIDE1{F.L.R.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.R.G.W.MeF.Y..S.N.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.N.C}$$$$","F.L.R.G.Y.MeF.Y.W...N.C"\n "PEPTIDE1{F.G.Y.[MeF].Y.W.S.D.N.C}$$$$","F...G.Y.MeF.Y.W.S.D.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.S.N.D.C}$$$$","F.L.R.G.Y.MeF.Y.W.S.N.D.C"\n "PEPTIDE1{F.V.R.G.Y.[MeF].Y.W.S.N.C}$$$$","F.V.R.G.Y.MeF.Y.W.S..N.C"'),n=await(0,K.f3)(s.getCol("HELM"),"msa(HELM)");(0,e.l_)(null!==n,!0,"PepSeA container has not started");const i=s.getCol("MSA");for(let t=0;t<n.length;++t)(0,e.l_)(n.get(t)==i.get(t),!0)}))})),(0,e.W3)("viewers",(()=>{const s=t.Func.find({package:"Bio",tags:["viewer"]}).map((t=>t.friendlyName));for(const t of s)(0,e.Bu)(t,(async()=>{const s=await T("data/sample_FASTA_DNA.csv");await(0,e.AB)(t,s,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[t]})}));const Z="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",q="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",X="seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3-wert-rut12";var z;(0,e.W3)("UnitsHandler",(()=>{async function s(e){const s=t.DataFrame.fromCsv(e);await a.data.detectSemanticTypes(s);const n=h.Cn.getOrCreate(s.getCol("seq"));return[s,n]}(0,e.Bu)("Seq-Fasta",(async()=>{const[t,n]=await s(Z);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!1)})),(0,e.Bu)("Seq-Fasta-MSA",(async()=>{const[t,n]=await s(q);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!0)})),(0,e.Bu)("Seq-Fasta-units",(async()=>{const[t,n]=await s(Z);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!1)})),(0,e.Bu)("Seq-Fasta-MSA-units",(async()=>{const[t,n]=await s(q);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!0)})),(0,e.Bu)("Seq-Helm",(async()=>{const[t,n]=await s("seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$");(0,e.l_)(n.notation,c.r2.HELM),(0,e.l_)(n.isHelm(),!0)})),(0,e.Bu)("Seq-UN",(async()=>{const[t,n]=await s(X);(0,e.l_)(n.notation,c.r2.SEPARATOR),(0,e.l_)(n.separator,"-"),(0,e.l_)(n.alphabet,"UN")})),(0,e.Bu)("Seq-UN-auto",(async()=>{const[t,n]=await s(X);(0,e.l_)(n.notation,c.r2.SEPARATOR),(0,e.l_)(n.separator,"-"),(0,e.l_)(n.alphabet,"UN")}))})),function(t){t.fasta="fasta",t.fastaMsa="fastaMsa",t.separator="separator",t.separatorMsa="separatorMsa",t.helm="helm"}(z||(z={})),(0,e.W3)("UnitsHandler",(()=>{h._9[c.r2.FASTA],h._9[c.r2.HELM];const s=h._9[c.r2.SEPARATOR],n={[z.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.r2.FASTA,splitted:["ACGTCACGTC","CAGTGTCAGTGT","TTCAACTTCAAC"]}},[z.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.r2.FASTA,splitted:["AC-GT-CTAC-GT-CT","CAC-T-GTCAC-T-GT","ACCGTACTACCGTACT"]}},[z.separator]:{src:{csv:"seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3"},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["abc","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut12","her2","rty","wert","abc","abc1","dfgg","rut12","her2","rty","wert","abc"],["rut12","rty","her2","abc","cfr3","wert","rut12","rut12","rty","her2","abc","cfr3"]]}},[z.separatorMsa]:{src:{csv:'seq\nrut0-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut1-her2-rty--abc1-dfgg-rut12-her2-rty--abc1-dfgg\nrut2-rty-her2---wert-rut12-rty-her2---wert\n"rut3-rty-her2-""-""-""-""-wert-rut12-rty-her2-""-""-""-""-wert"\n"""-""-rut4-her2-wert-rut12-rty-her2-wert"\n"rut5-rty-her2-wert-rut12-rty-her2-wert-""-"""'},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["rut0","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut1","her2","rty",s,"abc1","dfgg","rut12","her2","rty",s,"abc1","dfgg"],["rut2","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],["rut3","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],[s,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",s]]}},[z.helm]:{src:{csv:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Thr_PO3H2.Aca.D-Tyr_Et}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.T.dK.Thr_PO3H2}$$$$"},tgt:{notation:c.r2.HELM,splitted:[["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Thr_PO3H2","Aca","D-Tyr_Et"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["Lys_Boc","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","T","dK","Thr_PO3H2"]]}}};for(const[s,i]of Object.entries(n))(0,e.Bu)(`splitted-${s}`,(async()=>{const s=t.DataFrame.fromCsv(i.src.csv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),(0,e.l_)(s.semType,t.SEMTYPE.MACROMOLECULE);const o=h.Cn.getOrCreate(s);(0,e.l_)(o.notation,i.tgt.notation),(0,e.l_)(o.separator===i.tgt.separator,!0);const r=o.splitted;(0,e.f6)(r,i.tgt.splitted)}),s==z.separatorMsa?{skipReason:"#2468 CSV row starting with the quote character"}:void 0)})),(0,e.W3)("UnitsHandler: getRegion",(()=>{const s={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:c.r2.FASTA,alphabet:"DNA",positionNames:{tag:"a, b, c, d, e, f, g, h",start:"c",end:"e"}},separatorPt:{srcCsv:"seq\nM-D-Y-K-E-T-L\nM-I-E-V-F-L-F-G-I\nM-M-",startIdx:5,endIdx:null,tgtCsv:"seq\nT-L--\nL-F-G-I\n---",units:c.r2.SEPARATOR,alphabet:"PT",positionNames:{tag:"1, 1A, 1B, 2, 3, 4, 4A, 4A, 4C",start:"4",end:null}},helm:{srcCsv:"seq\nPEPTIDE1{[meI].[hHis].[Aca].N.T.[dE].[Thr_PO3H2].[Aca].[D-Tyr_Et].[Tyr_ab-dehydroMe].[dV].E.N.[D-Orn]}$$$$\nPEPTIDE1{[meI].[hHis].[Aca].[Cys_SEt].T.[dK].[Thr_PO3H2].[Aca].[Tyr_PO3H2].[D-Chg].[dV].[Phe_ab-dehydro]}$$$$\nPEPTIDE1{[Lys_Boc].[hHis].[Aca].[Cys_SEt].T}$$$$",startIdx:3,endIdx:6,tgtCsv:"seq\nPEPTIDE1{N.T.[dE].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.[dK].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.*.*}$$$$",units:c.r2.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[n,i]of Object.entries(s))(0,e.Bu)(`${n}-idx`,(async()=>{const s=t.DataFrame.fromCsv(i.srcCsv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const o=h.Cn.getOrCreate(s).getRegion(i.startIdx,i.endIdx,"regSeq"),r=t.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,e.l_)(s.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(o.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(s.getTag("alphabet"),i.alphabet),(0,e.l_)(o.getTag("alphabet"),i.alphabet),(0,e.f6)(o.toList(),r.toList())})),i.positionNames&&(0,e.Bu)(`${n}-positionNames`,(async()=>{const s=t.DataFrame.fromCsv(i.srcCsv).getCol("seq");i.positionNames.tag&&s.setTag(".positionNames",i.positionNames.tag);const n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const o=await a.functions.call("Bio:getRegion",{sequence:s,start:i.positionNames.start,end:i.positionNames.end}),r=t.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,e.l_)(s.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(o.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(s.getTag("alphabet"),i.alphabet),(0,e.l_)(o.getTag("alphabet"),i.alphabet),(0,e.f6)(o.toList(),r.toList())}))}));var j=s(8601);const Q=new t.FileSource("System:AppData/Bio"),J={PT:"peptides-fasta",DNA:"dna-fasta",MSA:"msa-separator"},tt={PT:"tests/to-atomic-level-peptides-fasta-input.csv",DNA:"tests/to-atomic-level-dna-fasta-input.csv",MSA:"tests/to-atomic-level-msa-separator-input.csv"},et={PT:"tests/to-atomic-level-peptides-fasta-output.csv",DNA:"tests/to-atomic-level-dna-fasta-output.csv",MSA:"tests/to-atomic-level-msa-separator-output.csv"},st="molfile(sequence)";async function nt(t,e="seq",s){const n=t.getCol(e),i=s.getBioLib(),o=await(0,j.i0)(t,n,i);return o.warnings.length>0&&mt.logger.warning(`_toAtomicLevel() warnings ${o.warnings.join("\n")}`),o.col}function it(t){return t.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((t=>t.trimEnd())).join("\n")}(0,e.W3)("toAtomicLevel",(async()=>{const s={},n={};let i,o,r;async function u(t,s){const n=t.getCol("sequence");await(0,l.toAtomicLevel)(t,n,!1);const i=t.getCol(st),o=s.getCol(st),r=G()(i.values()).map((t=>it(t))).toArray(),a=G()(o.values()).map((t=>it(t))).toArray();(0,e.f6)(r,a)}(0,e.bb)((async()=>{i=await(0,L.JN)(),o=await(0,M.nW)(),await(0,M.tb)(),await i.loadLibraries(!0);for(const e in J)s[e]=t.DataFrame.fromCsv((await Q.readAsText(tt[e])).replace(/\n$/,"")),await a.data.detectSemanticTypes(s[e]),n[e]=t.DataFrame.fromCsv((await Q.readAsText(et[e])).replace(/\n$/,""))})),(0,e.X5)((async()=>{await(0,M.tW)(o),await i.loadLibraries(!0)}));for(const t in J)(0,e.Bu)(`${J[t]}`,(async()=>{await u(s[t],n[t])}));!function(t){t.fastaDna="fastaDna",t.fastaRna="fastaRna",t.fastaPt="fastaPt",t.separatorDna="separatorDna",t.separatorRna="separatorRna",t.separatorPt="separatorPt",t.separatorUn="separatorUn",t.helm="helm"}(r||(r={}));const d={[r.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[r.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[r.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[r.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[r.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[r.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[r.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2",[r.helm]:"seq\nPEPTIDE1{meI.D-gGlu.Aca.N.T.dE.Thr_PO3H2.Aca.D.Thr_PO3H2.Aca.D}$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$"};async function m(e){const s=d[e],n=t.DataFrame.fromCsv(s.replace(/\n$/,""));return await a.data.detectSemanticTypes(n),n}(0,e.Bu)("fastaDna",(async()=>{await nt(await m(r.fastaDna),"seq",i)})),(0,e.Bu)("fastaRna",(async()=>{await nt(await m(r.fastaRna),"seq",i)})),(0,e.Bu)("fastaPt",(async()=>{await nt(await m(r.fastaPt),"seq",i)})),(0,e.Bu)("separatorDna",(async()=>{await nt(await m(r.separatorDna),"seq",i)})),(0,e.Bu)("separatorDna",(async()=>{await nt(await m(r.separatorRna),"seq",i)})),(0,e.Bu)("separatorPt",(async()=>{await nt(await m(r.separatorPt),"seq",i)})),(0,e.Bu)("separatorUn",(async()=>{await nt(await m(r.separatorUn),"seq",i)})),(0,e.Bu)("helm",(async()=>{await nt(await m(r.helm),"seq",i)})),(0,e.Bu)("ptFasta2",(async()=>{const s=await mt.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),n=t.DataFrame.fromCsv("seq\nAR"),o=n.getCol("seq");o.semType=t.SEMTYPE.MACROMOLECULE,o.setTag(t.TAGS.UNITS,c.r2.FASTA),o.setTag("alphabet","PT"),h.Cn.getOrCreate(o);const r=await nt(n,"seq",i);(0,e.l_)(it(r.get(0)),it(s))}))}));var ot=s(708);async function rt(e){const s=t.DataFrame.fromCsv(e),n=s.col("seq"),i=await a.functions.call("Bio:detectMacromolecule",{col:n});return i&&(n.semType=i),await a.data.detectSemanticTypes(s),h.Cn.getOrCreate(n)}function at(t,s,n,i){const o=n(t,s);(0,e.l_)(Number(o.toFixed(3)),Number(i.toFixed(3)))}(0,e.W3)("Distance",(async()=>{const s=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],n={F:0,W:1,R:2,Y:3},i="FWRWY",o="FWRWW",r="FWY",a="FWRWY",l="FWY",c="FWRRRRY";(0,e.Bu)("protein-distance-function",(async()=>{const t=(await rt("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,e.l_)(t,ot.U.LEVENSHTEIN)})),(0,e.Bu)("DNA-distance-function",(async()=>{const t=(await rt("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,e.l_)(t,ot.U.LEVENSHTEIN)})),(0,e.Bu)("MSA-distance-function",(async()=>{const t=(await rt("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,e.l_)(t,ot.U.HAMMING)})),(0,e.Bu)("levenstein-sub",(async()=>{const t=ot.o[ot.U.LEVENSHTEIN]();at(i,o,t,.2)})),(0,e.Bu)("levenstein-del",(async()=>{const t=ot.o[ot.U.LEVENSHTEIN]();at(r,a,t,.4)})),(0,e.Bu)("hamming",(async()=>{const t=ot.o[ot.U.HAMMING]();at(r,a,t,.6)})),(0,e.Bu)("needleman-blosum62",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});at(i,o,t,-6)})),(0,e.Bu)("needleman-blosum62-del",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});at(r,a,t,-1.8)})),(0,e.Bu)("needleman-custom-sub",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});at(i,o,t,.2)})),(0,e.Bu)("needleman-custom-del",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});at(r,a,t,.8)})),(0,e.Bu)("needleman-custom-zero-extend",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:0});at(l,c,t,.714)})),(0,e.Bu)("needleman-custom-half-extend",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:2,gapExtend:1});at(l,c,t,1.286)})),(0,e.Bu)("needleman-custom-same-extend",(async()=>{const e=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});t.Test.isInBenchmark?at(Array(1e4).fill("FWRY").join(""),Array(1e4).fill("FYWRRY").join(""),e,.667):at(l,c,e,1.143)}))}));var lt=s(3277);async function ct(t,s,n,i,o,r,c,h){await a.data.detectSemanticTypes(t);const u=await(0,l.activityCliffs)(t,t.getCol(n),t.getCol(i),o,s,c,h,{[`${lt.sS}`]:!0});(0,e.l_)(null!=u,!0);const d=Array.from(u.root.children).find((t=>{const e=t.className.split(" ");return["ui-btn","ui-btn-ok"].every((t=>e.includes(t)))}));(0,e.l_)(d.innerText.toLowerCase(),`${r} cliffs`)}var ht=s(6361),ut=s(4628);async function dt(s,n,i){const o=s.getCol(i),r=await a.functions.call("Bio:detectMacromolecule",{col:o});r&&(o.semType=r);const c=t.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!c)throw new Error("Preprocessing function not found");const h=await(0,l.sequenceSpaceTopMenu)(s,s.col(i),n,ot.U.LEVENSHTEIN,!0,c,{[lt.sS]:!0});(0,e.l_)(null!=h,!0)}(0,e.W3)("activityCliffs",(async()=>{let s,n,i=[],o=[];const r=t.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],l=t.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,e.bb)((async()=>{s=await(0,L.JN)(),n=await(0,M.nW)(),await(0,M.tb)(),await s.loadLibraries(!0),i=[],o=[]})),(0,e.X5)((async()=>{await(0,M.tW)(n),await s.loadLibraries(!0)})),(0,e.Bu)("activityCliffsOpens",(async()=>{const e=await T(t.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv");o.push(e);const s=a.shell.addTableView(e);i.push(s);const n=t.Test.isInBenchmark?6:3;await ct(e,ut.A.UMAP,"sequence","Activity",90,n,ot.U.LEVENSHTEIN,r)})),(0,e.Bu)("activityCliffsWithEmptyRows",(async()=>{const t=await T("tests/100_3_clustests_empty_vals.csv");o.push(t);const e=a.shell.addTableView(t);i.push(e),await ct(t,ut.A.UMAP,"sequence","Activity",90,3,ot.U.LEVENSHTEIN,r)})),(0,e.Bu)("Helm",(async()=>{const t=await mt.files.readCsv("data/sample_HELM_50.csv");a.shell.addTableView(t),await ct(t,ut.A.UMAP,"HELM","Activity",65,20,ht.gk.Tanimoto,l)}))})),(0,e.W3)("sequenceSpace",(async()=>{let s,n,i,o;(0,e.Bu)("sequenceSpaceOpens",(async()=>{s=await T(t.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv"),n=a.shell.addTableView(s),await dt(s,ut.A.UMAP,"sequence")})),(0,e.Bu)("sequenceSpaceWithEmptyRows",(async()=>{i=await T("tests/100_3_clustests_empty_vals.csv"),o=a.shell.addTableView(i),await dt(i,ut.A.UMAP,"sequence")}))})),(0,e.W3)("Scoring",(()=>{const s="sequence",n="expected_similarity",i="expected_identity",o=t.DataFrame.fromCsv(`${s},${n},${i}\nPEPTIDE1{Aca.Orn.gGlu.Pqa.D-His_1Bn.dH.hHis.4Abz.D-Tic.D-Dap.Y.Iva.meS.F.P.F.D-1Nal}$$$$,1.0,1.0\nPEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC}$$$$,0.68,0.53\nPEPTIDE1{[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal]}$$$$V2.0,0.34,0.0`),r=o.getCol(s);r.setTag(t.TAGS.UNITS,c.r2.HELM),r.semType=t.SEMTYPE.MACROMOLECULE;const a=r.get(0);let h,u;(0,e.bb)((async()=>{h=await(0,L.JN)(),u=await(0,M.nW)(),await(0,M.tb)(),await h.loadLibraries(!0)})),(0,e.X5)((async()=>{await(0,M.tW)(u),await h.loadLibraries(!0)})),(0,e.Bu)("Identity",(async()=>{const t=await(0,l.sequenceIdentityScoring)(o,r,a);for(let s=0;s<t.length;s++)(0,e.jh)(t.get(s),o.get(i,s),.01,`Wrong identity score for sequence at position ${s}`)})),(0,e.Bu)("Similarity",(async()=>{const t=await(0,l.sequenceSimilarityScoring)(o,r,a);for(let s=0;s<t.length;s++)(0,e.jh)(t.get(s),o.get(n,s),.01,`Wrong similarity score for sequence at position ${s}`)}))}));const mt=new t.Package;async function pt(s,n,i){const o=await(0,e.ci)({category:s,test:n,testContext:i});return t.DataFrame.fromObjects(o)}})(),bio_test=n})();
|
|
1
|
+
var bio_test;(()=>{var t={2012:(t,e,s)=>{"use strict";s.d(e,{f:()=>i});var n=s(9976);class i extends n.B{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,i)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,i)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new i({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in i.aaSynonyms?i.aaSynonyms[t]:t;return super.get(e)}}i.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class o{static getPalette(t="grok"){switch(t){case"grok":return i.GrokGroups;case"lesk":return i.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,s="",n="";for(const i of t)"("==i?e++:")"==i?e--:e?s+=i:n+=i;return isNaN(parseInt(s))?[n,s]:[n,""]}static getColorAAPivot(t="",e="grok"){const s=this.getPalette(e);let[n,i]=this.getInnerOuter(t);if(n=n.length>6?`${n.slice(0,3)}...`:n,i=i.length>6?`${i.slice(0,3)}...`:i,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in s?[s.get(e),e,i,1]:[this.undefinedColor,n,i,1]}if("d"==t[0]&&t[1]in s&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in s?[s.get(e),e,i,2]:[this.undefinedColor,n,i,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in s?[s.get(e),e,i,3]:[this.undefinedColor,n,i,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in s?[s.get(e),e,i,4]:[this.undefinedColor,n,i,4]}return[this.undefinedColor,n,i,0]}}o.SemType="Aminoacids",o.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",o.undefinedColor="rgb(100,100,100)",o.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},o.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},o.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},o.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"}},6584:(t,e,s)=>{"use strict";s.d(e,{BX:()=>o,nW:()=>l,tW:()=>c,tb:()=>h});var n=s(4469);const i="Libraries",o="System:AppData/Bio/libraries/",r={explicit:["HELMCoreLibrary.json"],exclude:[]};let a=Promise.resolve();async function l(){let t;return a=a.then((async()=>{const e=await n.dapi.userDataStorage.getValue(i,"Settings",!0);t=e?JSON.parse(e):{exclude:[],explicit:[]},t.exclude=t.exclude instanceof Array?t.exclude:[],t.explicit=t.explicit instanceof Array?t.explicit:[],console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(t,void 0,2)}`)})),await a,t}async function c(t){a=a.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(t,void 0,2)}`),await n.dapi.userDataStorage.postValue(i,"Settings",JSON.stringify(t),!0)})),await a}async function h(){await c(r)}},7228:(t,e,s)=>{"use strict";s.d(e,{JN:()=>l,Qx:()=>c,Xk:()=>a});var n=s(976),i=s(4469),o=s(1047),r=(s(499),s(8457));function a(t){const e=[];for(let s=0;s<t.rowCount;s++){const n={};Object.keys(o.K4).forEach((e=>{if("symbol"===e){const i=t.get(o.K4[e],s);n[e]="."===i?t.get(o.At,s):i}else if("rgroups"===e){const i=t.get(o.K4[e],s).split("\n"),r=[];i.forEach((t=>{const e={},s=t.substring(t.lastIndexOf("]")+1),n=t.match(/\[R(\d+)\]/)[1];e.capGroupSmiles="H"===s?`[*:${n}][H]`:`O[*:${n}]`,e.alternateId="H"===s?`R${n}-H`:`R${n}-OH`,e.capGroupName="H"===s?"H":"OH",e.label=`R${n}`,r.push(e)})),n[e]=r}else o.K4[e]&&(n[e]=t.get(o.K4[e],s))})),e.push(n)}return e}async function l(){const t=n.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await t[0].prepare().call()).getOutputParamValue()}async function c(t,e){t instanceof n.Column&&(t=(0,r.O)(t).columns.toList());const s=(await l()).getBioLib(),o=new Array(t.length),a=t[0].length,c=new Float32Array(a);for(let r=0;r<t.length;++r){const l=e[r],h=s.getMonomer("PEPTIDE",l)?.smiles??"",u=t[r],d=u.getRawData(),m=u.categories,p=m.indexOf("");if(o[r]={categories:m,data:d,emptyIndex:p},void 0===l)continue;const g=n.Column.fromStrings("smiles",m.map((t=>s.getMonomer("PEPTIDE",t)?.smiles??""))),f=(n.DataFrame.fromColumns([g]),(await i.chem.getSimilarities(g,h)).getRawData());for(let t=0;t<a;++t){const e=d[t];c[t]+=""!==l&&e!==p?f[e]:""===l&&e===p?1:0}}for(let s=0;s<c.length;++s){let i=c[s]/e.length;for(let r=0;r<t.length;++r){const t=o[r];if(r>=e.length&&t.data[s]!==t.emptyIndex||t.data[s]===t.emptyIndex&&r<e.length){i=n.FLOAT_NULL;break}}c[s]=i}return n.Column.fromFloat32Array("Similarity",c)}s(5697)},8601:(t,e,s)=>{"use strict";s.d(e,{i0:()=>d});var n=s(4469),i=s(976),o=s(6414),r=s.n(o),a=s(1821),l=s(499);const c={V2K_RGP_SHIFT:8,V2K_RGP_LINE:"M RGP",V2K_A_LINE:"A ",V3K_COUNTS_SHIFT:14,V3K_IDX_SHIFT:7,V3K_HEADER_FIRST_LINE:"\nDatagrok macromolecule handler\n\n",V3K_HEADER_SECOND_LINE:" 0 0 0 0 0 0 999 V3000\n",V3K_BEGIN_CTAB_BLOCK:"M V30 BEGIN CTAB\n",V3K_END_CTAB_BLOCK:"M V30 END CTAB\n",V3K_BEGIN_COUNTS_LINE:"M V30 COUNTS ",V3K_COUNTS_LINE_ENDING:" 0 0 0\n",V3K_BEGIN_ATOM_BLOCK:"M V30 BEGIN ATOM\n",V3K_END_ATOM_BLOCK:"M V30 END ATOM\n",V3K_BEGIN_BOND_BLOCK:"M V30 BEGIN BOND\n",V3K_END_BOND_BLOCK:"M V30 END BOND\n",V3K_BOND_CONFIG:" CFG=",V3K_BEGIN_DATA_LINE:"M V30 ",V3K_END:"M END",PRECISION_FACTOR:1e4,DEOXYRIBOSE:"d",RIBOSE:"r",PHOSPHATE:"p",OXYGEN:"O",HYDROGEN:"H"};var h=s(1047);function u(t){return Math.round(c.PRECISION_FACTOR*t)/c.PRECISION_FACTOR}async function d(t,e,o){if(0===i.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(e.semType!==i.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${i.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${e.semType}'`]};let u=e;const d=l.Cn.getOrCreate(e);d.isHelm()&&(u=d.convert(a.r2.SEPARATOR,"."),u.name=e.name);const p=l.Cn.getOrCreate(u).alphabet;let g;if("PT"===p||"UN"===p)g="PEPTIDE";else{if("RNA"!==p&&"DNA"!==p)return{col:null,warnings:[`Unexpected column's '${u.name}' alphabet '${p}'.`]};g="RNA"}const f=function(t){const e=t.length,s=new Array(e),n=l.Cn.getOrCreate(t).getSplitter();for(let i=0;i<e;++i){const e=t.get(i);s[i]=e?r()(n(e)).filter((t=>""!==t)).toArray():[]}return s}(u),y=await async function(t,e,s,i){const o=function(t,e,s){const n=new Map;for(const i of t.getMonomerSymbolsByType(e)){const o=t.getMonomer(e,i);if("RNA"===e&&("Branch"===o.monomerType||"DNA"===s&&o.symbol===c.DEOXYRIBOSE||"RNA"===s&&o.symbol===c.RIBOSE||o.symbol===c.PHOSPHATE)||"PEPTIDE"===e&&"Branch"!==o.monomerType){const t={};h.rx.forEach((e=>{t[e]=o[e]})),n.set(o.symbol,t)}}return n}(e,s,i),r=new Map,a=await n.functions.call("Chem:getRdKitModule"),l={value:null};if("RNA"===s){const t="RNA"===i?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const e of t)m(r,e,o,a,s,l)}for(let e=0;e<t.length;++e){const n=t[e];for(const t of n)if(""!==t)try{m(r,t,o,a,s,l)}catch(e){const s=e instanceof Error?e.message:e.toString(),n=e instanceof Error?e.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${t}', error:\n${s}\n${n}`),new Error(`Can't get monomer '${t}' from library: ${s}`)}}return r}(f,o,g,p),C=u.length,{molfileList:T,molfileWarningList:A}=await async function(t,e,n,i,o){const r=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(r).fill(null).map((()=>new Worker(new URL(s.p+s.u(79),s.b)))),l=o/r;let c=[],h=[];const u=new Array(r);for(let s=0;s<r;s++){const c=Math.floor(s*l),h=s===r-1?o:Math.floor((s+1)*l);a[s].postMessage({monomerSequencesArray:t,monomersDict:e,alphabet:n,polymerType:i,start:c,end:h}),u[s]=new Promise((t=>{a[s].onmessage=({data:{molfileList:e,molfileWarningList:s}})=>{t({molfileList:e,molfileWarningList:s})}}))}return(await Promise.all(u)).forEach((t=>{c=c.concat(...t.molfileList),h=h.concat(...t.molfileWarningList)})),setTimeout((()=>{a.forEach((t=>{t.terminate()}))}),0),{molfileList:c,molfileWarningList:h}}(f,y,p,g,C);if(A.length>.05*C)throw new Error("Too many errors getting molfiles.");const b=`molfile(${u.name})`,w=t.columns.getUnusedName(b),S=i.Column.fromStrings(w,T);return S.semType=i.SEMTYPE.MOLECULE,S.setTag(i.TAGS.UNITS,i.UNITS.Molecule.MOLBLOCK),{col:S,warnings:A}}function m(t,e,s,n,i,o){if(!t.has(e)){const r=function(t,e,s,n,i){if(e.has(t)){const o=e.get(t),r=function(t){const e=[];for(const s of t){let t=s.capGroupSmiles;t||(t=s.capGroupSMILES),t=t.replace(/(\[|\]|\*|:|\d)/g,""),e.push(t)}return e}(o.rgroups),a=function(t){const e=new Map;let s=t.indexOf(c.V2K_A_LINE,0),n=s;for(;-1!==s;){n=t.indexOf("\n",s);const i=parseInt(t.substring(s,n).replace(/^A\s+/,""));s=t.indexOf("R",n),n=t.indexOf("\n",s);const o=parseInt(t.substring(s,n).replace(/^R/,""));e.set(i,o),s=t.indexOf(c.V2K_A_LINE,n)}for(s=t.indexOf(c.V2K_RGP_LINE,0),n=t.indexOf("\n",s);-1!==s;){s+=c.V2K_RGP_SHIFT,n=t.indexOf("\n",s);const i=t.substring(s,n).replaceAll(/\s+/g," ").split(" ").map((t=>parseInt(t))).slice(1);for(let t=0;t<i.length;t+=2){if(e.has(i[t])&&e.get(i[t])!==i[t+1])throw new Error(`r-group index ${i[t]} has already been added with a different value`);e.set(i[t],i[t+1])}s=t.indexOf(c.V2K_RGP_LINE,n)}return e}(o.molfile),l=function(t,e){const s=e.get_mol(t),n=s.get_v3Kmolblock();return s.delete(),n}(function(t){let e=t.indexOf(c.V2K_A_LINE,0);-1===e&&(e=t.indexOf(c.V2K_RGP_LINE));const s=t.indexOf(c.V3K_END,e);return t.substring(0,e)+t.substring(s)}(o.molfile),s),h=function(t){let e=(t=t.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,s=t.indexOf(" ",e+1);const n=parseInt(t.substring(e,s));return e=s+1,s=t.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(t.substring(e,s))}}(l),d=function(t,e){const s=new Array(e),n=new Float32Array(e),i=new Float32Array(e),o=new Array(e);let r=t.indexOf(c.V3K_BEGIN_ATOM_BLOCK);r=t.indexOf("\n",r);let a=r;for(let l=0;l<e;l++){r=t.indexOf(c.V3K_BEGIN_DATA_LINE,r)+c.V3K_IDX_SHIFT,a=t.indexOf(" ",r),r=a+1,a=t.indexOf(" ",r),s[l]=t.substring(r,a);const e=new Array(2);for(let s=0;s<2;++s)r=a+1,a=t.indexOf(" ",r),e[s]=parseFloat(t.substring(r,a));n[l]=e[0],i[l]=e[1],r=a,a=t.indexOf("\n",r)+1,o[l]=t.slice(r,a),r=a}return{atomTypes:s,x:n,y:i,kwargs:o}}(l,h.atomCount),m=function(t,e){const s=new Uint32Array(e),n=new Array(e),i=new Map,o=new Map;let r=t.indexOf(c.V3K_BEGIN_BOND_BLOCK);r=t.indexOf("\n",r);let a=r;for(let l=0;l<e;++l){const e=new Array(3);r=t.indexOf(c.V3K_BEGIN_DATA_LINE,a)+c.V3K_IDX_SHIFT,a=t.indexOf(" ",r);for(let s=0;s<3;++s)r=a+1,a=Math.min(t.indexOf("\n",r),t.indexOf(" ",r)),e[s]=parseInt(t.slice(r,a));s[l]=e[0],n[l]=e.slice(1);const h=t.indexOf("\n",r);let u=t.slice(a,h),d=u.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=u.indexOf("=",d)+1;let t=u.indexOf(" ",d);-1===t&&(t=u.length);const e=parseInt(u.slice(d,t));i.set(l,e);const s=c.V3K_BOND_CONFIG+e.toString();u=u.replace(s,"")}u||o.set(l,u)}return{bondTypes:s,atomPairs:n,bondConfiguration:i,kwargs:o}}(l,h.bondCount),y={atoms:d,bonds:m,meta:p(d,m,r,a)};return"PEPTIDE"===n?function(t){const e=t.meta.terminalNodes[0]-1,s=t.meta.rNodes[0]-1,n=t.atoms.x,i=t.atoms.y;S(t,-n[e],-i[e]);const o=A(n[s],i[s]);b(t.atoms,-o),n[t.meta.rNodes[1]-1]<0&&function(t){w(t,!1)}(t);const r=function(t){const e=function(t){const e=new Map;for(const s of t.bonds.atomPairs)for(let t=0;t<2;t++){const n=s[t],i=s[(t+1)%2];e.has(n)?e.get(n)?.push(i):e.set(n,new Array(1).fill(i))}return e}(t);let s=0;const n=t.atoms.atomTypes.length;let i=0;for(;0===s;){const o=e.get(t.meta.terminalNodes[1])[i];if(t.atoms.atomTypes[o-1]===c.OXYGEN&&o!==t.meta.rNodes[1]&&(s=o),i++,i>n)throw new Error(`Search for double-bonded Oxygen in ${t} has exceeded the limit of ${n}`)}return s}(t);!function(t,e){t.atoms.y[t.meta.rNodes[1]-1]<0&&t.atoms.y[e-1]<0&&(function(t){w(t,!0)}(t),b(t.atoms,-function(t,e){return A(t,e)+Math.PI/2}(t.atoms.x[t.meta.terminalNodes[1]-1],t.atoms.y[t.meta.terminalNodes[1]-1])))}(t,r),function(t,e){const s=t.atoms.x;s[t.meta.rNodes[1]-1]>s[e-1]&&function(t,e,s){const n=e-1,i=s-1,o=t.atoms.x,r=t.atoms.y,a=o[n],l=r[n];o[n]=o[i],r[n]=r[i],o[i]=a,r[i]=l}(t,e,t.meta.rNodes[1])}(t,r)}(y):t===c.RIBOSE||t===c.DEOXYRIBOSE?function(t,e){const s=t.atoms.x,n=t.atoms.y;let i=t.meta.terminalNodes[0]-1;const o=t.meta.rNodes[1]-1;S(t,-s[i],-n[i]);const r=A(s[o],n[o]);b(t.atoms,3*Math.PI/2-r),e.value=function(t){const e=t.atoms.x,s=t.atoms.y,n=t.meta.rNodes[2]-1,i=t.meta.terminalNodes[2]-1,o=e[n]-e[i],r=s[n]-s[i];return Math.atan(r/o)+Math.PI/2}(t),i=t.meta.terminalNodes[0]-1,S(t,-s[i],-n[i])}(y,i):t===c.PHOSPHATE?function(t){const e=t.meta.terminalNodes[0]-1,s=t.meta.rNodes[0]-1,n=t.atoms.x,i=t.atoms.y;S(t,-n[e],-i[e]);const o=A(n[s],i[s]);b(t.atoms,Math.PI/2-o)}(y):function(t,e){const s=t.atoms.x,n=t.atoms.y,i=t.meta.terminalNodes[0]-1,o=t.meta.rNodes[0]-1;S(t,-s[i],-n[i]);const r=A(s[o],n[o]),a=e.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");b(t.atoms,Math.PI-r+a);const l=function(t,e){return u(Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2))}({x:s[t.meta.rNodes[0]-1],y:n[t.meta.rNodes[0]-1]},{x:s[t.meta.terminalNodes[0]-1],y:n[t.meta.terminalNodes[0]-1]});if(1!=l)for(let t=0;t<s.length;++t)s[t]=u(s[t]/l),n[t]=u(n[t]/l)}(y,i),function(t,e,s){"PEPTIDE"===t?(f(e,t),C(e,e.meta.rNodes[1])):s===c.RIBOSE||s===c.DEOXYRIBOSE?(C(e,e.meta.rNodes[1]),e.meta.rNodes[1]=e.meta.terminalNodes[1],g(e.bonds,e.meta),f(e,t),C(e,e.meta.rNodes[1]),C(e,e.meta.rNodes[0]),C(e,e.meta.rNodes[2])):s===c.PHOSPHATE&&(e.meta.terminalNodes[0]=e.meta.rNodes[0],S(e,-e.atoms.x[e.meta.terminalNodes[0]-1],-e.atoms.y[e.meta.terminalNodes[0]-1]),f(e,t),C(e,e.meta.rNodes[1]))}(n,y,t),function(t){let e=0;for(;e<t.atoms.atomTypes.length;)t.atoms.atomTypes[e]===c.HYDROGEN&&(C(t,e+1),--e),++e}(y),y}return null}(e,s,n,i,o);if(!r)throw new Error(`Monomer with symbol '${e}' is absent the monomer library`);t.set(e,r)}}function p(t,e,s,n){const i={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(t,e,s){for(const[n,i]of s)t.atomTypes[n-1]=e[i-1]}(t,s,n),function(t,e){e.rNodes=Array.from(t.keys());for(let s=0;s<e.rNodes.length;s++)for(const n of[1,2])if(t.get(e.rNodes[s])===n){const t=e.rNodes[n-1];e.rNodes[n-1]=e.rNodes[s],e.rNodes[s]=t}}(n,i),g(e,i),i}function g(t,e){const s=e.rNodes;e.terminalNodes=new Array(s.length).fill(0);const n=e.terminalNodes,i=t.atomPairs;let o=0,r=0;for(;o<i.length&&r<n.length;){for(let t=0;t<n.length;++t)for(let e=0;e<2;++e)i[o][e]===s[t]&&(n[t]=i[o][(e+1)%2],s.length,++r);++o}}function f(t,e){t.meta.rNodes.length>1&&(t.meta.backboneShift=y(t,t.meta.rNodes[1]-1,t.meta.terminalNodes[0]-1)),"RNA"===e&&t.meta.rNodes.length>2&&(t.meta.branchShift=y(t,t.meta.rNodes[2]-1,t.meta.terminalNodes[0]-1))}function y(t,e,s){return[u(t.atoms.x[e]-t.atoms.x[s]),u(t.atoms.y[e]-t.atoms.y[s])]}function C(t,e){if(void 0!==e){const s=e-1,n=t.atoms,i=t.bonds,o=t.meta;n.atomTypes.splice(s,1),n.x=T(Float32Array,n.x,s,1),n.y=T(Float32Array,n.y,s,1),n.kwargs.splice(s,1);for(let t=0;t<o.terminalNodes.length;++t)o.terminalNodes[t]>e?--o.terminalNodes[t]:o.terminalNodes[t]===e&&(o.terminalNodes[t]=-1);for(let t=0;t<o.rNodes.length;++t)o.rNodes[t]>e?--o.rNodes[t]:o.rNodes[t]===e&&(o.rNodes[t]=-1);let r=0;for(;r<i.atomPairs.length;){const t=i.atomPairs[r][0],s=i.atomPairs[r][1];t===e||s===e?(i.atomPairs.splice(r,1),i.bondTypes=T(Uint32Array,i.bondTypes,r,1),i.bondConfiguration.has(r)&&i.bondConfiguration.delete(r),i.kwargs.has(r)&&i.kwargs.delete(r),--r):(i.atomPairs[r][0]=t>e?t-1:t,i.atomPairs[r][1]=s>e?s-1:s),++r}let a=Array.from(i.bondConfiguration.keys());a.forEach((t=>{if(i.bondConfiguration.has(t)&&t>s){const e=i.bondConfiguration.get(t);i.bondConfiguration.delete(t),i.bondConfiguration.set(t-1,e)}})),a=Array.from(i.kwargs.keys()),a.forEach((t=>{if(i.kwargs.has(t)&&t>s){const e=i.kwargs.get(t);i.kwargs.delete(t),i.kwargs.set(t-1,e)}}))}}function T(t,e,s,n){const i=new t(e.length-n);let o=0,r=0;for(;o<e.length;)o===s&&(o+=n),i[r]=e[o],++r,++o;return i}function A(t,e){let s;if(0===t)s=e>0?0:Math.PI;else if(0===e)s=t>0?-Math.PI/2:Math.PI/2;else{const n=e/t,i=Math.atan(n);s=t<0?Math.PI/2+i:-Math.PI/2+i}return s}function b(t,e){if(0!==e){const s=t.x,n=t.y,i=Math.cos(e),o=Math.sin(e);for(let t=0;t<s.length;++t){const e=s[t];s[t]=u(e*i-n[t]*o),n[t]=u(e*o+n[t]*i)}}}function w(t,e){if(e){const e=t.atoms.y;for(let t=0;t<e.length;t++)e[t]=-e[t]}else{const e=t.atoms.x;for(let t=0;t<e.length;t++)e[t]=-e[t]}const s=t.bonds.bondConfiguration;for(const[t,e]of s){const n=1===e?3:1;s.set(t,n)}}function S(t,e,s){const n=t.atoms.x,i=t.atoms.y;for(let t=0;t<n.length;++t)n[t]=u(n[t]+e),void 0!==s&&(i[t]=u(i[t]+s))}},6137:(t,e,s)=>{"use strict";s.d(e,{J:()=>i,V:()=>o});var n=s(9976);class i extends n.B{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new i({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class o{}o.SemType="Nucleotides",o.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",o.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},9976:(t,e,s)=>{"use strict";s.d(e,{B:()=>n});class n{static makePalette(t,e=!1,s=n){const i={};return t.forEach((t=>{const s=t[0],n=t[1];s.forEach(((t,s)=>{i[t]=this.colourPalette[n][e?0:s]}))})),new s(i)}constructor(t){this._palette=t}get(t){return this._palette[t]}}n.undefinedColor="rgb(100,100,100)",n.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]}},7331:(t,e,s)=>{"use strict";s.d(e,{UE:()=>c,kQ:()=>r});var n=s(976),i=s(9976);class o{static hashCode(t){let e=0;if(0===t.length)return e;for(let s=0;s<t.length;s++)e=(e<<5)-e+t.charCodeAt(s),e|=0;return e}}class r{}class a extends r{get(t){return"#666666"}}class l extends r{static buildPalette(){return[].concat(...Object.values(i.B.colourPalette))}get(t){const e=o.hashCode(t)%l.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=n.Color.fromHtml(t),s=n.Color.g(e),i=n.Color.r(e),o=n.Color.b(e),r=Math.sqrt(Math.pow(0-i,2)+Math.pow(0-s,2)+Math.pow(0-o,2));return r>210?`rgb(${i/r*210},${s/r*210},${o/r*210})`:n.Color.toRgb(e)}(l.palette[e])}}l.palette=l.buildPalette();class c extends i.B{static get Gray(){return void 0===this.gray&&(this.gray=new a),this.gray}static get Color(){return void 0===this.color&&(this.color=new l),this.color}}},9611:(t,e,s)=>{"use strict";s.d(e,{A:()=>c});var n=s(4469),i=s(976),o=s(6414),r=s.n(o),a=s(8447);const l={DNA:"RNA",RNA:"RNA",PT:"PEPTIDE",UN:"PEPTIDE"};class c{get updated(){return this._updated}constructor(t,e,s){this.grid=t,this.col=e,this.propsProvider=s,this._monomerLengthList=null,this.separatorWidth=5,this._updated=!1,this._monomerLengthMap={},this._monomerStructureMap={},this.subs=[],this._splitter=(0,a.Mj)(this.col),this.props=this.propsProvider(),this._rowsProcessed=i.BitSet.create(this.col.length),this.grid&&(this.subs.push(e.dataFrame.onDataChanged.subscribe((()=>{try{this.props=this.propsProvider(),this._monomerLengthList=null,this._rowsProcessed=i.BitSet.create(this.col.length)}catch(t){console.error(t)}}))),this.subs.push(n.events.onViewRemoved.subscribe((t=>{try{this.grid?.view?.id===t.id&&this.destroy()}catch(t){console.error(t)}}))))}destroy(){for(const t of this.subs)t.unsubscribe()}getCellMonomerLengths(t){const e=this.props.unitsHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(t),s=new Array(e.length+1);s[0]=5;for(let t=1;t<s.length;t++)s[t]=s[t-1]+e[t-1];return[e,s]}getCellMonomerLengthsForSeq(t){null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.col.length).fill(null),this._updated=!0);let e=this._monomerLengthList[t];if(null===e){const s=this.getSeqMonList(t);e=this._monomerLengthList[t]=new Array(s.length);for(const[t,n]of r().enumerate(s)){const s=this.props.monomerToShort(t,this.props.monomerLengthLimit),i=(this.props.unitsHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+s.length*this.props.monomerCharWidth;e[n]=i}this._updated=!0}return e}getCellMonomerLengthsForSeqMsa(){var t;null===this._monomerLengthList&&(this._monomerLengthList=new Array(1).fill(null),this._updated=!0),(t=this._monomerLengthList)[0]??(t[0]=new Array(0));const e=this._monomerLengthList[0],{startIdx:s,endIdx:n}=(()=>{try{return this.grid&&this.grid.dart?{startIdx:Math.max(Math.floor((this.grid?.vertScroll.min??0)-10),0),endIdx:Math.min(Math.ceil((this.grid?.vertScroll.max??0)+10),this.col.length)}:{startIdx:0,endIdx:Math.min(this.col.length,10)}}catch(t){return{startIdx:0,endIdx:Math.min(this.col.length,10)}}})();for(let t=s;t<n;t++){if(this._rowsProcessed.get(t))continue;const s=this.getSeqMonList(t);s.length>e.length&&e.push(...new Array(s.length-e.length).fill(0));for(const[t,n]of r().enumerate(s)){const s=this.props.monomerToShort(t,this.props.monomerLengthLimit),i=this.props.separatorWidth+s.length*this.props.monomerCharWidth;e[n]=Math.max(e[n]??0,i)}this._updated=!0}return e}getPosition(t,e){const[s,n]=this.getCellMonomerLengths(t),i=this.col.get(t),o=r()(this._splitter(i)).toArray();if(0===o.length)return null;let a=100,l=null,c=o.length,h=!1,u=0;if(n[0]<=e&&e<n.slice(-1)[0])for(;!h;)if(u=Math.floor((c+(l??0))/2),e>=n[u]&&e<=n[u+1]?(l=u,h=!0):e<n[u]?c=u-1:e>n[u+1]&&(l=u+1),l==c&&(h=!0),--a<=0)throw new Error(`Get position for pointer x = ${e} searching has not converged on ${JSON.stringify(n)}. `);return l}getSeqMonList(t){const e=this.col.get(t);return e?r()(this._splitter(e)).toArray():[]}getMonomer(t){const e=this.props.unitsHandler.alphabet??"UN",s=l[e];return this.props.monomerLib?.getMonomer(s,t)??null}setMonomerLengthLimit(t){this.props.monomerLengthLimit=t,this._updated=!0}setSeparatorWidth(t){this.props.separatorWidth=t,this._updated=!0}isMsa(){return this.props.unitsHandler.isMsa()}}},1047:(t,e,s)=>{"use strict";s.d(e,{$3:()=>c,At:()=>i,K4:()=>a,Wc:()=>o,Z2:()=>l,nJ:()=>r,pU:()=>h,rx:()=>n});const n=["symbol","molfile","rgroups","name"],i="MonomerName",o={symbol:"Short Name",name:"Medium Name",smiles:"SMILES"},r=[{capGroupSmiles:"[*:1][H]",alternateId:"R1-H",capGroupName:"H",label:"R1"},{capGroupSmiles:"O[*:2]",alternateId:"R2-OH",capGroupName:"OH",label:"R2"},{capGroupSmiles:"[*:3][H]",alternateId:"R3-H",capGroupName:"H",label:"R3"}],a={monomerType:null,smiles:null,name:"MonomerName",author:null,molfile:"molecule",naturalAnalog:"MonomerNaturalAnalogCode",rgroups:"MonomerCaps",createDate:null,id:null,polymerType:"MonomerType",symbol:"MonomerCode"},l={monomerType:"Backbone",smiles:"",name:"",author:"Datagrok",molfile:"",naturalAnalog:"",rgroups:[],createDate:null,id:0,polymerType:"PEPTIDE",symbol:""},c="p",h=new RegExp(`[rd]\\((\\w)\\)${c}?`,"g")},7945:(t,e,s)=>{"use strict";function n(t){return"string"==typeof t||t instanceof String?t:"StateError"===t.constructor.name?t.message:"StateError"===t.constructor.name&&"$thrownJsError"in t?n(t.$thrownJsError):t instanceof Error?t.message:t.toString()}function i(t){return t instanceof Error?t.stack:"StateError"===t.constructor.name&&"$thrownJsError"in t?i(t.$thrownJsError):void 0}function o(t){return[n(t),i(t)]}s.d(e,{yf:()=>o})},5226:(t,e,s)=>{"use strict";s.d(e,{i:()=>r});var n=s(976),i=s(499),o=s(1821);class r{get descriptionsArray(){return this._descriptionsArray}get sequencesArray(){return this._sequencesArray}parseMacromolecule(t,e){return this._fileContent.slice(t,e).split(/\s/).join("")}parseColumns(){const t=/^>(.*)$/gm;let e,s=0;for(;e=t.exec(this._fileContent);){const n=this._fileContent.substring(e.index+1,t.lastIndex);this._descriptionsArray.push(n),0!==s&&this._sequencesArray.push(this.parseMacromolecule(s,e.index)),s=t.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(s,-1))}importFasta(){const t=n.Column.fromStrings("description",this.descriptionsArray),e=n.Column.fromStrings("sequence",this.sequencesArray);return e.semType=n.SEMTYPE.MACROMOLECULE,e.setTag(n.TAGS.UNITS,o.r2.FASTA),i.Cn.getOrCreate(e),[n.DataFrame.fromColumns([t,e])]}constructor(t){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=t,this.parseColumns()}}},1821:(t,e,s)=>{"use strict";s.d(e,{BM:()=>r,CI:()=>o,XS:()=>l,r2:()=>n,se:()=>a});var n,i=s(6286);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm"}(n||(n={}));const o=", ",r=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,a=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},l=[new i.L("PT",a.fasta.peptide,.5),new i.L("DNA",a.fasta.dna,.55),new i.L("RNA",a.fasta.rna,.55)]},8447:(t,e,s)=>{"use strict";s.d(e,{CI:()=>n.CI,GU:()=>i.GU,KX:()=>i.KX,Mj:()=>i.Mj,XS:()=>n.XS,dQ:()=>i.dQ,gM:()=>i.gM,gP:()=>i.gP,kB:()=>i.kB,py:()=>i.py,r2:()=>n.r2,up:()=>i.up});var n=s(1821),i=s(8260)},6286:(t,e,s)=>{"use strict";s.d(e,{L:()=>n,d:()=>i});class n{constructor(t,e,s){this.name=t,this.alphabet=e,this.cutoff=s}}class i extends n{constructor(t,e,s){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=s}}},8260:(t,e,s)=>{"use strict";s.d(e,{w4:()=>L,gM:()=>v,KX:()=>x,py:()=>N,vU:()=>b,Mj:()=>w,Ar:()=>y,jY:()=>p,GU:()=>E,dQ:()=>M,up:()=>_,kB:()=>g,FJ:()=>f,gP:()=>A});var n=s(976),i=s(6414),o=s.n(i),r=s(6286),a=s(1821),l=s(499);class c extends Float32Array{}var h=s(850),u=s(2012),d=s(6137),m=s(7331);function p(t,e,s){return t.categories,function(t,e){const s={};let n=!0,i=null;for(const o of t)if(null==i?i=o.length:o.length!==i&&(n=!1),o.length>=e)for(const t of o)t in s||(s[t]=0),s[t]+=1;return{freq:s,sameLength:n}}(o()(t.getRawData()).map((e=>s(t.categories[e]))),e)}function g(t){return o()(t.toString().matchAll(a.BM)).map((t=>t[2]??t[1])).toArray()}function f(t){return t||[]}function y(t,e=undefined){return s=>s?s.replaceAll('"-"',"").replaceAll("'-'","").split(t,e):[]}const C=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,T=/\[([^\[\]]+)]/g;function A(t){C.lastIndex=0;const e=C.exec(t.toString()),s=e?e[2]:null;return(s?s.split("."):[]).map((t=>{T.lastIndex=0;const e=T.exec(t);return e&&e.length>=2?e[1]:t}))}function b(t,e,s=undefined){if(t.toLowerCase().startsWith(a.r2.FASTA))return g;if(t.toLowerCase().startsWith(a.r2.SEPARATOR))return y(e,s);if(t.toLowerCase().startsWith(a.r2.HELM))return A;throw new Error(`Unexpected units ${t} .`)}function w(t){return l.Cn.getOrCreate(t).getSplitter()}const S=/([^\W_]+)/g;function E(t,e){if(t.length<=e)return t;const s=t.match(S),n=t.length>e||(s?.length??0)>1,i=s?.[0]??" ";return n?i.substring(0,e-1)+"…":i}function v(t){switch(t){case"DNA":return a.se.fasta.dna;case"RNA":return a.se.fasta.rna;case"PT":return a.se.fasta.peptide;default:throw new Error(`Unsupported alphabet '${t}'.`)}}function x(t,e,s="-"){const n=new Set([...new Set(Object.keys(t)),...e]);n.delete(s);const i=[],o=[];for(const s of n)i.push(s in t?t[s]:0),o.push(e.has(s)?1:0);const r=new c(i),a=new c(o);return(0,h.MA)(r,a)/((0,h.$G)(r)*(0,h.$G)(a))}function L(t,e,s="-"){const n=e.map((e=>{const n=x(t,e.alphabet,s);return new r.d(e,t,n)}));let i;const o=Math.max(...n.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return i=o>0?n.find((t=>t.similarity===o)).name:"UN",i}function M(t,e=5){let s;return s=t.semType==n.SEMTYPE.MACROMOLECULE?l.Cn.getOrCreate(t).alphabet:L(p(t,e,g).freq,a.XS),N(s)}function N(t){switch(t){case"PT":return u.f.GrokGroups;case"DNA":case"RNA":return d.J.Chromatogram;default:return m.UE.Color}}function _(t){const e=t.columns.bySemTypeAll(n.SEMTYPE.MACROMOLECULE);let s=e.find((t=>{const e=t.getTag(n.TAGS.UNITS);return!!e&&-1!==e.indexOf("MSA")}))??null;return!s&&e.length>0&&(s=e[0]),s}},8457:(t,e,s)=>{"use strict";s.d(e,{O:()=>a});var n=s(976),i=s(6414),o=s.n(i),r=s(8260);function a(t){const e=(0,r.Mj)(t),s=t=>{const e=l.columns.addNewString((t+1).toString());return i.push(e),e},i=[],a=t.length,l=n.DataFrame.create(a);for(let n=0;n<a;++n){const r=t.get(n);if(null==r)continue;const a=e(r);for(const[t,e]of o().enumerate(a))((i[e]??null)||s(e)).set(n,t||"-",!1)}return l}},172:(t,e,s)=>{"use strict";s.d(e,{c:()=>o});var n,i=s(7945);!function(t){t[t.error=0]="error",t[t.warning=1]="warning",t[t.info=2]="info",t[t.debug=3]="debug"}(n||(n={}));class o{constructor(t){this.logger=t,this.promise=Promise.resolve(),this.errors=[],this.syncCounter=0}sync(t,e){const s=++this.syncCounter;this.logger.debug(`${t}, SYNC syncId = ${s}, IN `),this.promise=this.promise.then((async()=>{this.logger.debug(`${t}, SYNC syncId = ${s}, START `),await e(),this.logger.debug(`${t}, SYNC syncId = ${s}, END `)})).catch((e=>{const[n,o]=(0,i.yf)(e);this.logger.error(`${t}, SYNC syncId = ${s}, ERROR:\n${n}`,void 0,o),this.errors.push(e)}))}resetErrors(){const t=this.errors;return this.errors=[],t}}},499:(t,e,s)=>{"use strict";s.d(e,{Cn:()=>m,_9:()=>d});var n=s(976),i=s(6414),o=s.n(i),r=s(8447),a=s(8260),l=s(708),c=s(7228),h=s(1047);const u=new class{constructor(){this.uh=`units-handler.${n.SEMTYPE.MACROMOLECULE}`}},d={[r.r2.FASTA]:"-",[r.r2.SEPARATOR]:"",[r.r2.HELM]:"*"};class m{static setUnitsToFastaColumn(t){if(t.column.semType!==n.SEMTYPE.MACROMOLECULE||t.column.getTag(n.TAGS.UNITS)!==r.r2.FASTA)throw new Error(`The column of notation '${r.r2.FASTA}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);t.column.setTag(n.TAGS.UNITS,r.r2.FASTA),m.setTags(t)}static setUnitsToSeparatorColumn(t,e){if(t.column.semType!==n.SEMTYPE.MACROMOLECULE||t.column.getTag(n.TAGS.UNITS)!==r.r2.SEPARATOR)throw new Error(`The column of notation '${r.r2.SEPARATOR}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error(`The column of notation '${r.r2.SEPARATOR}' must have the separator tag.`);t.column.setTag(n.TAGS.UNITS,r.r2.SEPARATOR),t.column.setTag("separator",e),m.setTags(t)}static setUnitsToHelmColumn(t){if(t.column.semType!==n.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${r.r2.HELM}' must be '${n.SEMTYPE.MACROMOLECULE}'`);t.column.setTag(n.TAGS.UNITS,r.r2.HELM),m.setTags(t)}static setTags(t){const e=t.column.getTag(n.TAGS.UNITS),s=t.stats;if(Object.keys(s.freq).some((t=>t.length>1)),[r.r2.FASTA,r.r2.SEPARATOR].includes(e)){if(!t.column.getTag("alphabet")&&0===Object.keys(s.freq).length)throw new Error("Alphabet is empty and not annotated.");let e=t.column.getTag("aligned");null===e&&(e=s.sameLength?"SEQ.MSA":"SEQ",t.column.setTag("aligned",e));let n=t.column.getTag("alphabet");if(null===n&&(n=(0,a.w4)(s.freq,r.XS),t.column.setTag("alphabet",n)),"UN"===n){const e=Object.keys(s.freq).length,n=Object.keys(s.freq).some((t=>t.length>1));t.column.setTag(".alphabetSize",e.toString()),t.column.setTag(".alphabetIsMultichar",n?"true":"false")}}}get column(){return this._column}get units(){return this._units}get notation(){return this._notation}get defaultGapSymbol(){return this._defaultGapSymbol}get separator(){const t=this.column.getTag("separator")??void 0;if(this.notation===r.r2.SEPARATOR&&void 0===t)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return t}get aligned(){const t=this.column.getTag("aligned");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return t}get alphabet(){const t=this.column.getTag("alphabet");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return t}get helmCompatible(){return this.column.getTag(".isHelmCompatible")}getAlphabetSize(){if(this.notation==r.r2.HELM||"UN"==this.alphabet){const t=this.column.getTag(".alphabetSize");let e;if(t)e=parseInt(t);else{const t=this.stats;e=Object.keys(t.freq).length}return e}switch(this.alphabet){case"PT":return 20;case"DNA":case"RNA":return 4;case"NT":return console.warn("Unexpected alphabet 'NT'."),4;default:throw new Error(`Unexpected alphabet '${this.alphabet}'.`)}}getAlphabetIsMultichar(){return this.notation===r.r2.HELM||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}get splitted(){if(null===this._splitted){const t=this.getSplitter(),e=this._column.length;this._splitted=new Array(e);const s=this._column.getRawData(),n=this._column.categories;for(let i=0;i<e;i++){const e=n[s[i]];this._splitted[i]=t(e)}}return this._splitted}get stats(){if(null===this._stats){const t={};let e=!0,s=null;for(const n of this.splitted){null==s?s=n.length:n.length!==s&&(e=!1);for(const e of n)e in t||(t[e]=0),t[e]+=1}this._stats={freq:t,sameLength:e}}return this._stats}get maxLength(){return null===this._maxLength&&(this._maxLength=0===this.splitted.length?0:Math.max(...this.splitted.map((t=>t.length)))),this._maxLength}get posList(){if(null===this._posList){const t=this.column.getTag(".positionNames");this._posList=t?t.split(r.CI).map((t=>t.trim())):o().count(1).take(this.maxLength).map((t=>t.toString())).toArray()}return this._posList}isFasta(){return this.notation===r.r2.FASTA}isSeparator(){return this.notation===r.r2.SEPARATOR}isHelm(){return this.notation===r.r2.HELM}isRna(){return"RNA"===this.alphabet}isDna(){return"DNA"===this.alphabet}isPeptide(){return"PT"===this.alphabet}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}isGap(t){return!t||this.units===r.r2.FASTA&&t===d[r.r2.FASTA]||this.units===r.r2.HELM&&t===d[r.r2.HELM]}getNotation(){if(this.units.toLowerCase().startsWith(r.r2.FASTA))return r.r2.FASTA;if(this.units.toLowerCase().startsWith(r.r2.SEPARATOR))return r.r2.SEPARATOR;if(this.units.toLowerCase().startsWith(r.r2.HELM))return r.r2.HELM;throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getHelmWrappers(){return[this.isDna()||this.isRna()||this.isHelmCompatible()?"RNA1{":"PEPTIDE1{",this.isDna()?"d(":this.isRna()?"r(":"",this.isDna()||this.isRna()?")p":"","}$$$$"]}getNewColumn(t,e,s,i){const o=this.column,a=t.toLowerCase()+"("+o.name+")",l=s??o.dataFrame.columns.getUnusedName(a),c=n.Column.fromList("string",l,i??new Array(this.column.length).fill(""));if(c.semType=n.SEMTYPE.MACROMOLECULE,c.setTag(n.TAGS.UNITS,t),t===r.r2.SEPARATOR){if(!e)throw new Error(`Notation '${r.r2.SEPARATOR}' requires separator value.`);c.setTag("separator",e)}c.setTag(n.TAGS.CELL_RENDERER,"Macromolecule");const h=o.getTag("aligned");h&&c.setTag("aligned",h);const u=o.getTag("alphabet");null!=u&&c.setTag("alphabet",u);let d=o.getTag(".alphabetSize");null!=u&&d&&c.setTag(".alphabetSize",d);const m=o.getTag(".alphabetIsMultichar");return null!=u&&void 0!==m&&c.setTag(".alphabetIsMultichar",m),t==r.r2.HELM&&(d=this.getAlphabetSize().toString(),c.setTag(".alphabetSize",d)),c}getNewColumnFromList(t,e){return this.getNewColumn(this.notation,this.separator,t,e)}static getNewColumn(t){const e=m.getOrCreate(t),s=e.notation;return e.getNewColumn(s)}static unitsStringIsValid(t){return t=t.toLowerCase(),[r.r2.FASTA,r.r2.SEPARATOR,r.r2.HELM].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,s){if(!m.unitsStringIsValid(s))throw new Error("Invalid format of 'units' parameter");const i=n.Column.fromList("string",e,new Array(t).fill(""));return i.semType=n.SEMTYPE.MACROMOLECULE,i.setTag(n.TAGS.UNITS,s),i}getSplitter(t){if(this.units.toLowerCase().startsWith(r.r2.FASTA))return null===this.column.getTag("alphabet")||this.getAlphabetIsMultichar()?a.kB:a.FJ;if(this.units.toLowerCase().startsWith(r.r2.SEPARATOR))return(0,a.Ar)(this.separator,t);if(this.units.toLowerCase().startsWith(r.r2.HELM))return a.gP;throw new Error(`Unexpected units ${this.units} .`)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");return this.isMsa()?l.U.HAMMING:(this.alphabet,l.U.LEVENSHTEIN)}getDistanceFunction(){return l.o[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const t=(await(0,c.JN)()).getBioLib().getMonomerSymbolsByType("PEPTIDE".toString()),e=new Set(t),s=(0,a.Ar)(this.separator);for(const t of this.column.categories){const n=s(t);for(const t of n)if(!e.has(t))return this.column.setTag(".isHelmCompatible","false"),!1}return this.column.setTag(".isHelmCompatible","true"),!0}get splitter(){return null===this._splitter&&(this._splitter=(0,a.Mj)(this.column)),this._splitter}toFasta(t){return t===r.r2.FASTA}toSeparator(t){return t===r.r2.SEPARATOR}toHelm(t){return t===r.r2.HELM}convertHelmToFastaSeparator(t,e,s,n){n||(n=this.toFasta(e)?d[r.r2.FASTA]:d[r.r2.SEPARATOR]),s||(s=this.toFasta(e)?"":this.separator);const i=t.startsWith("RNA"),o=this.splitter(t),a=[];for(let t=0;t<o.length;t++){let s=o[t];if(i&&(s=s.replace(h.pU,"")),s===d[r.r2.HELM])a.push(n);else if(this.toFasta(e)&&s.length>1){const t="["+s+"]";a.push(t)}else a.push(s)}return a.join(s)}convert(t,e){const s=this.getConverter(t,e),n=this.getNewColumn(t,e);return n.init((t=>s(this.column.get(t)))),n}getRegion(t,e,s){const n=this.getNewColumn(this.notation,this.separator);n.name=s,Math.max(...this.splitted.map((t=>t.length)));const i=t??0,o=e??this.maxLength-1,a=this.getJoiner(),l=o-i+1;n.init((t=>{const e=this.splitted[t],s=new Array(l);for(let t=0;t<l;++t){const n=i+t;s[t]=n<e.length?e[n]:d[this.notation]}return a(s)}));const c=t=>{const e=t.split(",").map((t=>t.trim())),s=new Array(l);for(let t=0;t<l;++t){const n=i+t;s[t]=n<e.length?e[n]:"?"}return s.join(r.CI)},h=this.column.getTag(".positionNames");h&&n.setTag(".positionNames",c(h));const u=this.column.getTag(".positionLabels");return u&&n.setTag(".positionLabels",c(u)),n}getJoiner(){if(void 0===this._joiner){const t=this;if(this.notation===r.r2.FASTA)this._joiner=function(e){return p(t,e)};else if(this.notation===r.r2.SEPARATOR)this._joiner=function(e){return g(t,e,t.separator)};else{if(this.notation!==r.r2.HELM)throw new Error;{const e="DNA"===t.alphabet||"RNA"===t.alphabet;this._joiner=function(s){return f(t,s,e)}}}}return this._joiner}getConverter(t,e=undefined){if(t===r.r2.SEPARATOR&&!e)throw new Error(`Target separator is not specified for target units '${r.r2.SEPARATOR}'.`);const s=this;if(t===r.r2.FASTA)return function(t){return function(t,e){const s=t.isHelm()?y(t,e):t.getSplitter()(e);return p(t,s)}(s,t)};if(t===r.r2.HELM)return function(t){return function(t,e){const s=e.startsWith("DNA")||e.startsWith("RNA"),n=t.getSplitter()(e);return f(t,n,s)}(s,t)};if(t===r.r2.SEPARATOR)return function(t){return function(t,e,s){const n=t.isHelm()?y(t,e):t.getSplitter()(e);return g(t,n,s)}(s,t,e)};throw new Error}constructor(t){if(this._splitter=null,this._splitted=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,t.type!==n.TYPE.STRING)throw new Error(`Unexpected column type '${t.type}', must be '${n.TYPE.STRING}'.`);this._column=t;const e=this._column.getTag(n.TAGS.UNITS);if(null==e)throw new Error("Units are not specified in column");if(this._units=e,this._notation=this.getNotation(),this._defaultGapSymbol=this.isFasta()?d[r.r2.FASTA]:this.isHelm()?d[r.r2.HELM]:d[r.r2.SEPARATOR],!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())m.setUnitsToFastaColumn(this);else if(this.isSeparator()){const e=t.getTag("separator");m.setUnitsToSeparatorColumn(this,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(n.TAGS.UNITS)}'.`);m.setUnitsToHelmColumn(this)}if(!this.column.tags.has(".alphabetIsMultichar"))if(this.isHelm())this.column.setTag(".alphabetIsMultichar","true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '.alphabetIsMultichar' is mandatory.`)}static getOrCreate(t){let e=t.temp[u.uh];return e||(e=t.temp[u.uh]=new m(t)),e}}function p(t,e){const s=new Array(e.length);for(const[n,i]of o().enumerate(e)){let o=n;t.isHelm()&&(o=n.replace(h.pU,"$1")),t.isGap(o)?o=d[r.r2.FASTA]:o.length>1&&(o="["+e[i]+"]"),s[i]=o}return s.join("")}function g(t,e,s){const n=new Array(e.length);for(const[s,i]of o().enumerate(e)){let e=s;t.isGap(e)&&(e=d[r.r2.SEPARATOR]),n[i]=e}return n.map((t=>t??"")).join(s)}function f(t,e,s){const[n,i,a,l]=t.getHelmWrappers();return`${n}${o()(e).map((e=>{let n=e;return n=t.isGap(n)?d[r.r2.HELM]:s?n.replace(h.pU,"$1"):1==e.length?`${i}${e}${a}`:`${i}[${e}]${a}`,n})).toArray().join(".")}${l}`}function y(t,e){const s=t.getSplitter()(e),n=new Array(s.length),i=e.startsWith("DNA"),r=e.startsWith("RNA");for(const[t,e]of o().enumerate(s)){let s=t;(i||r)&&(s=s.replace(h.pU,"$1"),s=s===h.$3?null:s),n[e]=s}return n.filter((t=>null!==t))}},9298:(t,e,s)=>{"use strict";s.d(e,{Ct:()=>l,DX:()=>n,ES:()=>i,dE:()=>a,iD:()=>r,vS:()=>h,vw:()=>o});var n,i,o,r,a,l,c=s(976);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(n||(n={})),function(t){t.Entropy="Entropy",t.full="100%"}(i||(i={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(o||(o={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(r||(r={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(a||(a={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(l||(l={}));const h=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=c.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=i.Entropy,this.positionWidth=16,this.verticalAlignment=o.MIDDLE,this.horizontalAlignment=r.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},922:(t,e,s)=>{"use strict";s.d(e,{_:()=>l});class n{constructor(t){this.init(t)}init(t){this.fileContent=t.replace(/\r/g,""),this._atomCount=void 0,this._atomTypes=void 0,this._bondCount=void 0,this._bondTypes=void 0,this.xyzAtomCoordinates=void 0,this._pairsOfBondedAtoms=void 0}get atomCount(){return void 0===this._atomCount&&this.setAtomAndBondCounts(),this._atomCount}get bondCount(){return void 0===this._bondCount&&this.setAtomAndBondCounts(),this._bondCount}get x(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var t;return null!==(t=this.xyzAtomCoordinates)&&void 0!==t||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var t;return null!==(t=this._atomTypes)&&void 0!==t||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var t;return null!==(t=this._pairsOfBondedAtoms)&&void 0!==t||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var t;return null!==(t=this._bondTypes)&&void 0!==t||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:t,bondCount:e}=this.parseAtomAndBondCounts();this._atomCount=t,this._bondCount=e}getNextColumnIdx(t){for(;!this.isWhitespace(t);)++t;for(;this.isWhitespace(t);)++t;return t}shiftIdxToSpecifiedColumn(t,e){let s=t;const n=this.isWhitespace(s)?e:e-1;for(let t=0;t<n;t++)s=this.getNextColumnIdx(s);return s}parseAtomTypes(){const t=this.atomCount,e=new Array(t);let s=this.getAtomBlockIdx();for(let n=0;n<t;n++)s=this.shiftIdxToAtomType(s),e[n]=this.parseAtomType(s),s=this.getNextLineIdx(s);return e}parseAtomCoordinates(){const t=new Float32Array(this.atomCount),e=new Float32Array(this.atomCount),s=new Float32Array(this.atomCount);let n=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){n=this.shiftIdxToXColumn(n);for(const o of[t,e,s])o[i]=this.parseFloatValue(n),n=this.getNextColumnIdx(n);n=this.getNextLineIdx(n)}return{x:t,y:e,z:s}}parseBondedAtomPairs(){const t=new Array(this.bondCount);let e=this.getBondBlockIdx();for(let s=0;s<this.bondCount;s++){e=this.shiftIdxToBondedAtomsPair(e);const n=new Uint16Array(2);n[0]=this.parseIntValue(e),e=this.getNextColumnIdx(e),n[1]=this.parseIntValue(e),t[s]=n,e=this.getNextLineIdx(e)}return t}parseBondTypes(){const t=this.bondCount,e=new Uint16Array(t);let s=this.getBondBlockIdx();for(let n=0;n<t;n++)s=this.shiftIdxToBondType(s),e[n]=this.parseIntValue(s),s=this.getNextLineIdx(s);return e}isWhitespace(t){const e=this.fileContent[t];return" "===e||"\t"===e}getNextLineIdx(t){return"\n"!==this.fileContent[t]?this.fileContent.indexOf("\n",t)+1:t+1}parseFloatValue(t){return this.parseNumericValue(parseFloat,t)}parseIntValue(t){return this.parseNumericValue(parseInt,t)}parseNumericValue(t,e){let s=e+1;for(;!this.isWhitespace(s);)++s;return t(this.fileContent.substring(e,s))}}class i extends n{constructor(t){super(t),this.init(t)}init(t){super.init(t)}parseAtomType(t){let e=t,s=e;return this.isQuote(e)?(s=this.getNextIdenticalChar(e),e++):s=this.fileContent.indexOf(" ",s),this.fileContent.substring(e,s)}isQuote(t){const e=this.fileContent[t].charCodeAt(0);return 39===e||34===e}getNextIdenticalChar(t){const e=this.fileContent[t];return e?this.fileContent.indexOf(e,t+1):-1}isQuery(){return this.isQueryOrFragment(((t,e)=>{return 39===t||34===t||76===t&&!((s=this.fileContent.charCodeAt(e+1))>64&&s<91||s>96&&s<123);var s}))}isFragment(){return this.isQueryOrFragment((t=>82===t||42===t))}isQueryOrFragment(t){const e=this.atomCount;let s=this.getAtomBlockIdx();for(let n=0;n<e;n++){if(s=this.shiftIdxToAtomType(s),t(this.fileContent.charCodeAt(s),s))return!0;s=this.getNextLineIdx(s)}return!1}}var o;!function(t){t.HEADER="V2000",t[t.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",t[t.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",t[t.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",t[t.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",t[t.BOND_TYPE_COL=3]="BOND_TYPE_COL",t[t.RGP_SHIFT=8]="RGP_SHIFT",t.RGP_LINE="M RGP",t.A_LINE="A ",t.END="M END"}(o||(o={}));class r extends i{constructor(t){super(t)}static validate(t){return-1!==t.indexOf(o.HEADER)&&-1!==t.indexOf(o.END)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,o.ATOM_TYPE_COL)}getCountsLineIdx(){let t=0;for(let e=0;e<o.NUM_OF_HEADER_LINES;++e)t=this.getNextLineIdx(t);return t}getAtomBlockIdx(){let t=this.getCountsLineIdx();return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){return this.getNextColumnIdx(t)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,o.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,o.BOND_TYPE_COL)}getBondBlockIdx(){let t=this.getAtomBlockIdx();for(let e=0;e<this.atomCount;e++)t=this.getNextLineIdx(t);return t}parseAtomAndBondCounts(){let t=this.getCountsLineIdx(),e=t+o.NUM_OF_COUNTS_DIGITS;const s=parseInt(this.fileContent.substring(t,e));return t=e,e+=o.NUM_OF_COUNTS_DIGITS,{atomCount:s,bondCount:parseInt(this.fileContent.substring(t,e))}}}class a extends i{constructor(t){super(t),this.init(t)}shiftIdxToAtomType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let t=this.fileContent.indexOf("M V30 BEGIN ATOM");return t=this.getNextLineIdx(t),t}shiftIdxToXColumn(t){let e=this.shiftIdxToAtomType(t);return this.isQuote(e)?(e=this.getNextIdenticalChar(e),e=this.getNextColumnIdx(e),e):this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondedAtomsPair(t){return this.shiftIdxToSpecifiedColumn(t,5)}shiftIdxToBondType(t){return this.shiftIdxToSpecifiedColumn(t,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static validate(t){return-1!==t.indexOf("V3000")&&-1!==t.indexOf("M END")}parseAtomAndBondCounts(){let t=this.fileContent.indexOf("M V30 COUNTS ")+14,e=this.fileContent.indexOf(" ",t+1);const s=parseInt(this.fileContent.substring(t,e));return t=e+1,e=this.fileContent.indexOf(" ",t+1),{atomCount:s,bondCount:parseInt(this.fileContent.substring(t,e))}}}class l{constructor(){}static getInstance(t){if(r.validate(t))return new r(t);if(a.validate(t))return new a(t);throw new Error("Malformed molfile")}}},7905:(t,e,s)=>{"use strict";t=s.hmd(t);var n,i=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,s,i=void 0!==t?t:{};i.ready=new Promise((function(t,n){e=t,s=n}));var o,r=Object.assign({},i),a="object"==typeof window,l="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),n&&(c=n),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(o=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),i.print||console.log.bind(console);var h,u,d=i.printErr||console.warn.bind(console);Object.assign(i,r),r=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(h=i.wasmBinary),i.noExitRuntime,"object"!=typeof WebAssembly&&E("no native wasm support detected");var m,p,g,f=!1;function y(){var t=u.buffer;i.HEAP8=m=new Int8Array(t),i.HEAP16=new Int16Array(t),i.HEAP32=new Int32Array(t),i.HEAPU8=p=new Uint8Array(t),i.HEAPU16=new Uint16Array(t),i.HEAPU32=g=new Uint32Array(t),i.HEAPF32=new Float32Array(t),i.HEAPF64=new Float64Array(t)}var C=[],T=[],A=[],b=0,w=null,S=null;function E(t){i.onAbort&&i.onAbort(t),d(t="Aborted("+t+")"),f=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw s(e),e}var v,x,L="data:application/octet-stream;base64,";function M(t){return t.startsWith(L)}function N(t){try{if(t==v&&h)return new Uint8Array(h);if(o)return o(t);throw"both async and sync fetching of the wasm failed"}catch(t){E(t)}}function _(t,e,s){return function(t){return h||!a&&!l||"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(s,(function(t){d("failed to asynchronously prepare wasm: "+t),E(t)}))}function P(t){for(;t.length>0;)t.shift()(i)}function I(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){g[this.ptr+4>>2]=t},this.get_type=function(){return g[this.ptr+4>>2]},this.set_destructor=function(t){g[this.ptr+8>>2]=t},this.get_destructor=function(){return g[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){g[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return g[this.ptr+16>>2]},this.get_exception_ptr=function(){if(U(this.get_type()))return g[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function R(t){var e=u.buffer;try{return u.grow(t-e.byteLength+65535>>>16),y(),1}catch(t){}}function O(t){return i["_"+t]}M(v="wasmDbscan.wasm")||(x=v,v=i.locateFile?i.locateFile(x,c):c+x);var G="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function F(t,e,s,n,i){var o={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,s=0;s<t.length;++s){var n=t.charCodeAt(s);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++s):e+=3}return e}(t)+1,s=k(e);return function(t,e,s){!function(t,e,s,n){if(!(n>0))return 0;for(var i=s+n-1,o=0;o<t.length;++o){var r=t.charCodeAt(o);if(r>=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&t.charCodeAt(++o)),r<=127){if(s>=i)break;e[s++]=r}else if(r<=2047){if(s+1>=i)break;e[s++]=192|r>>6,e[s++]=128|63&r}else if(r<=65535){if(s+2>=i)break;e[s++]=224|r>>12,e[s++]=128|r>>6&63,e[s++]=128|63&r}else{if(s+3>=i)break;e[s++]=240|r>>18,e[s++]=128|r>>12&63,e[s++]=128|r>>6&63,e[s++]=128|63&r}}e[s]=0}(t,p,e,s)}(t,s,e),s}(t)),e},array:t=>{var e,s,n=k(t.length);return e=t,s=n,m.set(e,s),n}},r=O(t),a=[],l=0;if(n)for(var c=0;c<n.length;c++){var h=o[s[c]];h?(0===l&&(l=D()),a[c]=h(n[c])):a[c]=n[c]}var u=r.apply(null,a);return function(t){return 0!==l&&B(l),function(t){return"string"===e?(s=t)?function(t,e,s){for(var n=e+s,i=e;t[i]&&!(i>=n);)++i;if(i-e>16&&t.buffer&&G)return G.decode(t.subarray(e,i));for(var o="";e<i;){var r=t[e++];if(128&r){var a=63&t[e++];if(192!=(224&r)){var l=63&t[e++];if((r=224==(240&r)?(15&r)<<12|a<<6|l:(7&r)<<18|a<<12|l<<6|63&t[e++])<65536)o+=String.fromCharCode(r);else{var c=r-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&r)<<6|a)}else o+=String.fromCharCode(r)}return o}(p,s,n):"":"boolean"===e?Boolean(t):t;var s,n}(t)}(u)}var H,W={__cxa_throw:function(t,e,s){throw new I(t).init(e,s),t},abort:function(){E("")},emscripten_memcpy_big:function(t,e,s){p.copyWithin(t,e,e+s)},emscripten_resize_heap:function(t){var e,s=p.length,n=2147483648;if((t>>>=0)>n)return!1;for(var i=1;i<=4;i*=2){var o=s*(1+.2/i);if(o=Math.min(o,t+100663296),R(Math.min(n,(e=Math.max(t,o))+(65536-e%65536)%65536)))return!0}return!1}},D=(function(){var t,e,n,o,r={env:W,wasi_snapshot_preview1:W};function a(t,e){var s,n=t.exports;return i.asm=n,u=i.asm.memory,y(),i.asm.__indirect_function_table,s=i.asm.__wasm_call_ctors,T.unshift(s),function(t){if(b--,i.monitorRunDependencies&&i.monitorRunDependencies(b),0==b&&(null!==w&&(clearInterval(w),w=null),S)){var e=S;S=null,e()}}(),n}if(b++,i.monitorRunDependencies&&i.monitorRunDependencies(b),i.instantiateWasm)try{return i.instantiateWasm(r,a)}catch(t){d("Module.instantiateWasm callback failed with error: "+t),s(t)}(t=h,e=v,n=r,o=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||M(e)||"function"!=typeof fetch?_(e,n,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,n).then(o,(function(t){return d("wasm streaming compile failed: "+t),d("falling back to ArrayBuffer instantiation"),_(e,n,o)}))}))).catch(s)}(),i._dbscan=function(){return(i._dbscan=i.asm.dbscan).apply(null,arguments)},i._malloc=function(){return(i._malloc=i.asm.malloc).apply(null,arguments)},i._free=function(){return(i._free=i.asm.free).apply(null,arguments)},function(){return(D=i.asm.stackSave).apply(null,arguments)}),B=function(){return(B=i.asm.stackRestore).apply(null,arguments)},k=function(){return(k=i.asm.stackAlloc).apply(null,arguments)},U=function(){return(U=i.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function t(){H||(H=!0,i.calledRun=!0,f||(P(T),e(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)t=i.postRun.shift(),A.unshift(t);var t;P(A)}()))}b>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)t=i.preRun.shift(),C.unshift(t);var t;P(C)}(),b>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t()))}if(i.ccall=F,i.cwrap=function(t,e,s,n){var i=!s||s.every((t=>"number"===t||"boolean"===t));return"string"!==e&&i&&!n?O(t):function(){return F(t,e,s,arguments)}},S=function t(){H||V(),H||(S=t)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return V(),t.ready});"object"==typeof exports?t.exports=i:"function"==typeof define&&s.amdO?define([],(function(){return i})):"object"==typeof exports&&(exports.exportCppDbscanLib=i)},5697:(t,e,s)=>{"use strict";s.d(e,{Dz:()=>C,FV:()=>c,KR:()=>l,MI:()=>A,NB:()=>p,Om:()=>b,UX:()=>m,WI:()=>d,Zd:()=>u,_h:()=>h,aW:()=>f,bX:()=>S,eo:()=>w,fX:()=>T,kg:()=>r,s:()=>g,yU:()=>y});var n=s(9657),i=s(1040),o=s(708);i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean;const r=[i.gk.Tanimoto,i.gk.Dice,i.gk.Cosine];function a(t,e){const s=t.trueCount()+e.trueCount();if(0==s)return 1;const n=t.andWithCountBits(e,!0);return n/(s-n)}function l(t,e){return w(a(t,e))}function c(t,e){return w(a(new n.Z(t,32*t.length),new n.Z(e,32*e.length)))}function h(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount();return 0==s?0:2*t.andWithCountBits(e,!0)/s}(t,e))}function u(t,e){return w(function(t,e){const s=t.trueCount()*e.trueCount();return 0==s?0:t.andWithCountBits(e,!0)/Math.sqrt(s)}(t,e))}function d(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}function m(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)}function p(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount(),n=t.andWithCountBits(e,!0);return n/(2*s-3*n)}(t,e))}function g(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount(),n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)*s/(2*n)}(t,e))}function f(t,e){return w(function(t,e){const s=t.trueCount()+e.trueCount(),n=t.trueCount()*e.trueCount();return 0==n?0:(t.andWithCountBits(e,!0)*s-n)/n}(t,e))}function y(t,e){return w(function(t,e){const s=Math.min(t.trueCount(),e.trueCount());return 0==s?0:t.andWithCountBits(e,!0)/s}(t,e))}function C(t,e){return w(function(t,e){const s=Math.max(t.trueCount(),e.trueCount());return 0==s?0:t.andWithCountBits(e,!0)/s}(t,e))}function T(t,e){return w(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))}function A(t,e){return w(function(t,e){const s=t.andWithCountBits(e,!0),n=t.countBits(!0)+e.countBits(!0),i=t.length,o=i-n+s;return s==i||o==i?1:s/n+o/(2*i-n)}(t,e))}function b(t){return 1/(1+t)}function w(t){return 0===t?3402823e32:1/t-1}function S(t,e){return Math.abs(t-e)}i.gk.Tanimoto,i.gk.Asymmetric,i.gk.Cosine,i.gk.Sokal,o.U.HAMMING,o.U.LEVENSHTEIN,o.U.MONOMER_CHEMICAL_DISTANCE,o.U.NEEDLEMANN_WUNSCH},3277:(t,e,s)=>{"use strict";s.d(e,{Ec:()=>i,sS:()=>n});const n="bypassLargeDataWarning",i="show-scatterplot-progress"},708:(t,e,s)=>{"use strict";function n(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,s=t.scoringMatrix,n=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,i=new Float32Array((s.length+n)*(s.length+n));return Object.entries(e).forEach((([t,n])=>{const o=s[n];Object.entries(e).forEach((([e,n])=>{i[t.charCodeAt(0)*s.length+e.charCodeAt(0)]=o[n]}))})),(t,e)=>i[t.charCodeAt(0)*s.length+e.charCodeAt(0)]}(),s=t?.threshold??0;return(t,n)=>{let i=0;const o=t.length,r=n.length,a=Math.max(o,r)*(1-s);o!==r&&(i=Math.abs(o-r));let l=0;for(let s=0;s<Math.min(o,r);s++)if(t[s]!==n[s]&&(l+=e(t[s],n[s]),l>a))return 1;return l+=i,l/=Math.max(o,r),l}}s.d(e,{U:()=>r,o:()=>a});var i=s(1811);const o={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 r;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(r||(r={}));const a={[r.HAMMING]:n,[r.LEVENSHTEIN]:function(){return(t,e)=>(0,i.T)(t,e)/Math.max(t.length,e.length)},[r.NEEDLEMANN_WUNSCH]:function(t){const e=new Uint16Array(65536),{gapOpen:s,gapExtend:n,scoringMatrix:i,alphabetIndexes:r}={...o,...t};Object.entries(r).forEach((([t,s])=>e[t.charCodeAt(0)]=s));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(t,o)=>{const r=new Array(t.length+1).fill(!1),l=new Array(t.length+1).fill(!1);let c=0,h=1;for(let e=1;e<t.length+1;e++)a[0][e]=-s-(e-1)*n,a[1][e]=0;for(let u=1;u<o.length+1;u++){a[h][0]=-s-(u-1)*n;for(let d=1;d<t.length+1;d++){const m=a[c][d-1]+i[e[t.charCodeAt(d-1)]][e[o.charCodeAt(u-1)]],p=a[c][d]-(r[d]?n:s),g=a[h][d-1]-(l[d-1]?n:s);a[h][d]=Math.max(m,g,p),a[h][d]===m?(r[d]=!1,l[d]=!1):a[h][d]===g?(r[d]=!1,l[d]=!0):(r[d]=!0,l[d]=!1)}c=h,h=(h+1)%2}const u=Math.max(t.length,o.length);return(u-a[c][t.length])/u}},[r.MONOMER_CHEMICAL_DISTANCE]:n}},4628:(t,e,s)=>{"use strict";var n;s.d(e,{A:()=>n}),function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(n||(n={}))},1040:(t,e,s)=>{"use strict";var n,i,o,r,a,l;s.d(e,{CF:()=>i,Qe:()=>a,W:()=>n,Yc:()=>l,gd:()=>r,gk:()=>o}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(n||(n={})),function(t){t.Euclidean="Euclidean"}(i||(i={})),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"}(o||(o={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(r||(r={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray"}(a||(a={})),function(t){t.Difference="Difference"}(l||(l={}))},6361:(t,e,s)=>{"use strict";s.d(e,{gk:()=>n.gk});var n=s(1040);s(7861)},7861:(t,e,s)=>{"use strict";s.d(e,{sQ:()=>f});var n=s(1811),i=s(3979),o=s(5697),r=s(850),a=s(708),l=s(1040);const c={[l.CF.Euclidean]:r.dP},h={[l.W.Levenshtein]:n.T,[l.W.JaroWinkler]:i.H$,[l.W.Manhattan]:function(t,e){if(t.length!==e.length)return 1;{let s=0;for(let n=1;n<t.length;n++)s+=t[n]==e[n]?0:1;return s/t.length}},[l.W.Onehot]:function(t,e){return t===e?0:1}},u={[l.gk.Tanimoto]:o.KR,[l.gk.Dice]:o._h,[l.gk.Asymmetric]:o.yU,[l.gk.BraunBlanquet]:o.Dz,[l.gk.Cosine]:o.Zd,[l.gk.Kulczynski]:o.s,[l.gk.McConnaughey]:o.aW,[l.gk.RogotGoldberg]:o.MI,[l.gk.Russel]:o.fX,[l.gk.Sokal]:o.NB,[l.gk.Hamming]:o.UX,[l.gk.Euclidean]:o.WI},d={[l.gd.TanimotoIntArray]:o.FV},m={[l.Yc.Difference]:o.bX},p={[l.Qe.Vector]:{[l.CF.Euclidean]:c[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:h[l.W.Levenshtein],[l.W.JaroWinkler]:h[l.W.JaroWinkler],[l.W.Manhattan]:h[l.W.Manhattan],[l.W.Onehot]:h[l.W.Onehot]},[l.Qe.BitArray]:{[l.gk.Tanimoto]:u[l.gk.Tanimoto],[l.gk.Dice]:u[l.gk.Dice],[l.gk.Asymmetric]:u[l.gk.Asymmetric],[l.gk.BraunBlanquet]:u[l.gk.BraunBlanquet],[l.gk.Cosine]:u[l.gk.Cosine],[l.gk.Kulczynski]:u[l.gk.Kulczynski],[l.gk.McConnaughey]:u[l.gk.McConnaughey],[l.gk.RogotGoldberg]:u[l.gk.RogotGoldberg],[l.gk.Russel]:u[l.gk.Russel],[l.gk.Sokal]:u[l.gk.Sokal]},[l.Qe.MacroMolecule]:{[a.U.HAMMING]:a.o[a.U.HAMMING],[a.U.LEVENSHTEIN]:a.o[a.U.LEVENSHTEIN],[a.U.NEEDLEMANN_WUNSCH]:a.o[a.U.NEEDLEMANN_WUNSCH],[a.U.MONOMER_CHEMICAL_DISTANCE]:a.o[a.U.MONOMER_CHEMICAL_DISTANCE]},[l.Qe.Number]:{[l.Yc.Difference]:m[l.Yc.Difference]},[l.Qe.IntArray]:{[l.gd.TanimotoIntArray]:d[l.gd.TanimotoIntArray]}},g=Object.keys(p).reduce(((t,e)=>{for(const s of Object.keys(p[e]))t[s]=e;return t}),{});function f(t){return"BitArray"==g[t]}},9657:(t,e,s)=>{"use strict";s.d(e,{Z:()=>n});class n{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 s=t,i=n._createBuffer(s);if(e)for(let t=0;t<i.length;t++)i[t]=-1;this._data=i,this._length=s}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,s,n){if(t<e||t>s)throw new Error(`Argument ${n} (${t}) out of range (${e}, ${s})`)}copy(t,e,s){for(let n=0;n<s;n++)e[n]=t[n]}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 s=new n(t._length);s._length=t._length,s._data=n._createBuffer(s._length),s._version=0;const i=t.lengthInInts;for(let n=0;n<i;n++)s._data[n]=t._data[n]&e._data[n];return s}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new n(t.length);e._version=0;for(let s=0;s<e._length;s++)t[s]&&(e._data[Math.floor(s/32)]|=1<<(s%32&31));return e}static fromSeq(t,e){const s=new n(t);for(let n=0;n<t;++n)s.setBit(n,e(n));return s._version=0,s}static fromString(t){return n.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const s=new n(t);return s._data=e,s}static fromBytes(t){const e=t.length,s=new n(8*e);s._data=new Uint32Array(Math.floor((e+3)/4)),s._length=8*e;let i=0,o=0;for(;e-o>=4;)s._data[i++]=255&t[o]|(255&t[o+1])<<8|(255&t[o+2])<<16|(255&t[o+3])<<24,o+=4;return e-o==3&&(s._data[i]=(255&t[o+2])<<16),e-o==2&&(s._data[i]|=(255&t[o+1])<<8),e-o==1&&(s._data[i]|=255&t[o]),s._version=0,s}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 n(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 s=t?-1:0,n=this.lengthInInts;for(let t=0;t<n;t++)this._data[t]=s;this.incrementVersion(e)}setIndexes(t,e=!0,s=!0,n=!0){s&&this.setAll(!e,!1);for(const s of t)this.setFast(s,e);this.incrementVersion(n)}everyIndex(t,e=!0){for(const s of t)if(this.getBit(s)!=e)return!1;return!0}anyIndex(t,e=!0){for(const s of t)if(this.getBit(s)==e)return!0;return!1}setWhere(t,e=!0,s=!0,n=!0,i=!0){if(s&&i&&this.setAll(!e,!1),i)for(let s=0;s<this._length;s++)t(s)&&this.setFast(s,e);else for(let s=0;s<this._length;s++)this.setFast(s,t(s)?e:!e);this.incrementVersion(n)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const s=[];for(let n=t;n<e;++n)s.push(this.getBit(n));return n.fromValues(s)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const s=[];for(let n=t;n<e;++n)s.push(this.getBit(n));return s}setRange(t,e,s,n=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const i=Math.min(t,e),o=Math.max(t,e);if(s)for(let t=i;t<=o;t++)this.setTrue(t);else for(let t=i;t<=o;t++)this.setFalse(t);return this.incrementVersion(n),this}setRandom(t,e,s=!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 s=0;s<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),s++)}this.incrementVersion(s)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,s=this.lengthInInts;e<s;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 s=this.lengthInInts;for(let e=0;e<s;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,s=this.lengthInInts;e<s;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,s=this.lengthInInts;e<s;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,s=this.lengthInInts;e<s;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,s=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const n=this._length;this.setLength(this._length+e);for(let s=n-1;s>=t;s--)this.setBit(s+e,this.getBit(s));for(let n=t;n<t+e;n++)this.setBit(n,s)}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 s=t;s<this._length-e;s++)this.setBit(s,this.getBit(s+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 s=0;for(let n=-1;-1!=(n=t.findNext(n,!e));)this.setFast(s++,this.getBit(n));this._length=s,this._version++}return this}getBit(t){return 0!=(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,s=!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+=n._onBitCount[255&t];let s=this._data[e];const i=31&this._length;for(0!=i&&(s&=~(4294967295<<i));0!=s;s>>>=8)this._selectedCount+=n._onBitCount[255&s];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let s=0;s<this._length;s++)e+=t(s)?1:0;else for(let s=-1;-1!=(s=this.findNext(s,!0));)e+=t(s)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let s=0;const i=this.lengthInInts;let o=0;for(;o<i-1;o++)for(let e=this._data[o]&t._data[o];0!=e;e>>>=8)s+=n._onBitCount[255&e];let r=this._data[o]&t._data[o];const a=31&this._length;for(0!=a&&(r&=~(4294967295<<a));0!=r;r>>>=8)s+=n._onBitCount[255&r];return e?s:this._length-s}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 s=31&(t=t<0?0:t+1);const i=this.lengthInInts;for(let o=Math.floor(t/32);o<i;o++){let i=e?this._data[o]:~this._data[o];if(0!=s)i&=4294967295<<s&4294967295,s=0;else if(!e&&-4294967296==i)continue;for(let e=0;0!=i;e+=8,i>>>=8){const s=n._firstOnBit[255&i];if(s>=0)return(t=s+32*o+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let s=1+(t=t<0?this._length-1:t-1)&31;for(let i=Math.floor(t/32);i>=0;i--){let t=e?this._data[i]:~this._data[i];0!=s&&(t&=~(4294967295<<s),s=0);for(let e=24;0!=t;e-=8,t<<=8){const s=n._lastOnBit[t>>>24];if(s>=0)return s+32*i+e}}return-1}}n._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]),n._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]),n._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])},8467:(t,e,s)=>{"use strict";s.d(e,{X5:()=>x,ow:()=>I,bb:()=>v,W3:()=>E,gw:()=>P,l_:()=>A,f6:()=>S,jh:()=>b,Wh:()=>w,ci:()=>M,Bu:()=>T,zg:()=>C,AB:()=>G,QK:()=>c});var n=s(4469),i=s(976);s(9133);const o=i.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,,,,,,,,,,,,,,,,,,,,,');o.columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var r=function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))};const a=3e4,l=108e5,c={},h="Auto Tests",u="Demo",d="Detectors",m={};let p;var g;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(g||(g={}));class f{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class y{constructor(t,e,s,n){var i;this.category=t,this.name=e,null!=n||(n={}),null!==(i=n.timeout)&&void 0!==i||(n.timeout=a),this.options=n,this.test=()=>r(this,void 0,void 0,(function*(){return new Promise(((t,e)=>r(this,void 0,void 0,(function*(){let n="";try{n=yield s()}catch(t){e(t)}t(n)}))))}))}}function C(t,e,s,n=0){return r(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{const r=t.subscribe((t=>{try{e(t),i("OK")}catch(t){o(t)}r.unsubscribe(),clearTimeout(a)})),a=setTimeout((()=>{r.unsubscribe(),o("timeout")}),n);s()}))}))}function T(t,e,s){null==c[p]&&(c[p]={}),null==c[p].tests&&(c[p].tests=[]),c[p].tests.push(new y(p,t,e,s))}function A(t,e=!0,s){if(s=s?`${s}, `:"",t!==e)throw new Error(`${s}Expected "${e}", got "${t}"`)}function b(t,e,s=.001,n){if(t===Number.POSITIVE_INFINITY&&e===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY&&e===Number.NEGATIVE_INFINITY||t===Number.NaN&&e===Number.NaN||isNaN(t)&&isNaN(e))return;const i=Math.abs(t-e)<s;if(A(i,!0,`${null!=n?n:""} (tolerance = ${s})`),!i)throw new Error(`Expected ${e}, got ${t} (tolerance = ${s})`)}function w(t,e){for(const[s,n]of Object.entries(e)){if(!t.hasOwnProperty(s))throw new Error(`Expected property "${s}" not found`);const e=t[s];if(e instanceof Array&&n instanceof Array)S(e,n);else if(e instanceof Object&&n instanceof Object)w(e,n);else if(Number.isFinite(e)&&Number.isFinite(n))b(e,n);else if(e!=n)throw new Error(`Expected (${n}) for key '${s}', got (${e})`)}}function S(t,e){const s=t.length,n=e.length;if(s!=n)throw new Error(`Arrays are of different length: actual array length is ${s} and expected array length is ${n}`);for(let n=0;n<s;n++)if(t[n]instanceof Array&&e[n]instanceof Array)S(t[n],e[n]);else if(t[n]instanceof Object&&e[n]instanceof Object)w(t[n],e[n]);else if(t[n]!=e[n])throw new Error(`Expected ${e[n]} at position ${n}, got ${t[n]}`)}function E(t,e,s){var n;p=t,e(),c[p]&&(c[p].clear=null===(n=null==s?void 0:s.clear)||void 0===n||n,c[p].timeout=null==s?void 0:s.timeout)}function v(t){null==c[p]&&(c[p]={}),c[p].before=t}function x(t){null==c[p]&&(c[p]={}),c[p].after=t}function L(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function M(t,e){var s,a,l,p,g,C;return r(this,void 0,void 0,(function*(){const T=null===(a=null===(s=n.functions.getCurrentCall())||void 0===s?void 0:s.func)||void 0===a?void 0:a.package;yield function(t,e){return r(this,void 0,void 0,(function*(){if(m[t])return;const e=c;if(void 0!==e[h]||void 0!==e[u]||Object.keys(e).find((t=>t.startsWith(h))))return void(m[t]=!0);const s=[],i=[],a=[],l=yield n.dapi.functions.filter(`package.id = "${t}"`).list(),p=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)/g);for(const t of l){const l=t.options.test,c=t.options.demoPath;if(l&&Array.isArray(l)&&l.length)for(let i=0;i<l.length;i++){const o=l[i].matchAll(p),a={};Array.from(o).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])}));const c=new y(h,1===l.length?t.name:`${t.name} ${i+1}`,(()=>r(this,void 0,void 0,(function*(){const e=yield n.functions.eval(L(l[i],t));if(a.wait&&(yield P(a.wait)),"boolean"==typeof e&&!e)throw`Failed: ${l[i]}, expected true, got ${e}`}))),{skipReason:a.skip});if(a.cat){const t=h+": "+a.cat;c.category=t,void 0===e[t]&&(e[t]={tests:[],clear:!0}),e[t].tests.push(c)}else s.push(c)}if(c){const e=t.options.demoWait?parseInt(t.options.demoWait):void 0,s=new y(u,t.friendlyName,(()=>r(this,void 0,void 0,(function*(){if(n.shell.lastError="",yield t.apply(),yield P(e||2e3),n.shell.lastError)throw new Error(n.shell.lastError)}))),{skipReason:t.options.demoSkip});i.push(s)}if(t.hasTag("semTypeDetector")){const e=new y(d,t.friendlyName,(()=>r(this,void 0,void 0,(function*(){const e=[];for(const s of o.clone().columns){const n=yield t.apply([s]);e.push(n||s.semType)}A(e.filter((t=>t)).length,1)}))),{skipReason:t.options.skipTest});a.push(e)}}m[t]=!0,s.length&&(e[h]={tests:s,clear:!0}),i.length&&(e[u]={tests:i,clear:!0}),a.length&&(e[d]={tests:a,clear:!1})}))}(T.id);const b=[];console.log("Running tests"),null!=t||(t={}),null!==(l=(C=t).testContext)&&void 0!==l||(C.testContext=new f),n.shell.lastError="";const w=[];for(const[s,o]of Object.entries(c)){if((null==t?void 0:t.category)&&!s.toLowerCase().startsWith(null==t?void 0:t.category.toLowerCase())||(null==e?void 0:e.some((t=>s.startsWith(t)))))continue;console.log(`Started ${s} category`),w.push(s);const r=null===(p=o.tests)||void 0===p?void 0:p.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));try{o.before&&!r&&(yield o.before())}catch(t){o.beforeStatus=N(t)}const a=null!==(g=o.tests)&&void 0!==g?g:[],l=[];if(o.clear)for(let e=0;e<a.length;e++)l.push(yield _(a[e],null==t?void 0:t.test,o.timeout,T.name)),n.shell.closeAll(),i.Balloon.closeAll();else for(let e=0;e<a.length;e++)l.push(yield _(a[e],null==t?void 0:t.test,o.timeout,T.name));const c=(yield Promise.all(l)).filter((t=>"skipped"!=t.result));try{o.after&&!r&&(yield o.after())}catch(t){o.afterStatus=N(t)}o.afterStatus&&c.push({category:s,name:"init",result:o.afterStatus,success:!1,ms:0,skipped:!1}),o.beforeStatus&&c.push({category:s,name:"init",result:o.beforeStatus,success:!1,ms:0,skipped:!1}),b.push(...c)}if(t.testContext.catchUnhandled&&(yield P(1e3),n.shell.lastError.length>0&&b.push({category:"Unhandled exceptions",name:"exceptions",result:n.shell.lastError,success:!1,ms:0,skipped:!1})),!t.test&&b.length){const e=b.filter((t=>t.success)).length,s=b.filter((t=>t.skipped)).length,o=b.filter((t=>!t.success)),r=T.name;for(const t of w){const e=b.filter((e=>e.category===t)),s=e.filter((t=>!t.success)).length,i={success:0===s,passed:e.filter((t=>t.success)).length,skipped:e.filter((t=>t.skipped)).length,failed:s,type:"package",packageName:r,category:t};n.log.usage(`${r}: ${t}`,i,`category-package ${r}: ${t}`)}if(!t.category){const t={success:0===o.length,passed:e,skipped:s,failed:o.length,type:"package",packageName:r};n.log.usage(r,t,`package-package ${r}`)}if(t.testContext.report){const t=new i.Logger,n="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",r={successful:e,skipped:s,failed:o.length,package:T};for(const t of o)Object.assign(r,{[`${t.category} | ${t.name}`]:t.result});t.log(n,r,"package-tested")}}return b}))}function N(t){return`${t.toString()}\n${t.stack?i.Logger.translateStackTrace(t.stack):""}`}function _(t,e,s,o){var c,h,u,d,m;return r(this,void 0,void 0,(function*(){let r;const p=null!=e&&t.name.toLowerCase()!==e.toLowerCase(),g=(null===(c=t.options)||void 0===c?void 0:c.skipReason)||p,f=p?"skipped":null===(h=t.options)||void 0===h?void 0:h.skipReason;g||console.log(`Started ${t.category} ${t.name}`);const y=Date.now();try{if(g)r={success:!0,result:f,ms:0,skipped:!0};else{let e=(null===(u=t.options)||void 0===u?void 0:u.timeout)===a&&s?s:null===(d=t.options)||void 0===d?void 0:d.timeout;e=i.Test.isInBenchmark&&e===a?l:e,r={success:!0,result:null!==(m=yield R(t.test,e))&&void 0!==m?m:"OK",ms:0,skipped:!1}}}catch(t){r={success:!1,result:N(t),ms:0,skipped:!1}}if(r.ms=Date.now()-y,g||console.log(`Finished ${t.category} ${t.name} for ${r.ms} ms`),r.category=t.category,r.name=t.name,!p){let e={success:r.success,result:r.result,ms:r.ms,skipped:r.skipped,type:"package",packageName:o,category:t.category,test:t.name};if(r.result.constructor==Object){const t=Object.keys(r.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:r.result[e]})),{});e=Object.assign(Object.assign({},e),t)}n.log.usage(`${o}: ${t.category}: ${t.name}`,e,`test-package ${o}: ${t.category}: ${t.name}`)}return r}))}function P(t){return r(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function I(t,e="Timeout exceeded",s=500,n=50){return r(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{setTimeout((()=>{clearInterval(r),o(new Error(e))}),s);const r=setInterval((()=>{t()&&(clearInterval(r),i())}),n)}))}))}function R(t,e){return r(this,void 0,void 0,(function*(){let s=null;const n=new Promise(((t,n)=>{s=setTimeout((()=>{n("EXECUTION TIMEOUT")}),e)}));try{return yield Promise.race([t(),n])}finally{s&&clearTimeout(s)}}))}const O=i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])]);function G(t,e,s){var o;return r(this,void 0,void 0,(function*(){(null==s?void 0:s.detectSemanticTypes)&&(yield n.data.detectSemanticTypes(e));let r=n.shell.addTableView(e);const a=`[name=viewer-${t.replace(/\s+/g,"-")} i]`,l=`${a} canvas,${a} svg,${a} img,\n ${a} input,${a} h1,${a} a,${a} .d4-viewer-error`,c=[];try{let h=r.addViewer(t);yield I((()=>null!==document.querySelector(l)),"cannot load viewer",3e3);const u=null===(o=document.querySelector(l))||void 0===o?void 0:o.tagName;if(c.push(Array.from(r.viewers).length),!(null==s?void 0:s.readOnly)){Array.from(e.row(0).cells).forEach((t=>t.value=null));const t=e.rowCount<20?Math.floor(e.rowCount/2):10;e.rows.select((e=>e.idx>=0&&e.idx<t)),yield P(50);for(let s=t;s<2*t;s++)e.filter.set(s,!1);yield P(50),e.currentRowIdx=1;const s=e.clone();e.columns.names().slice(0,Math.ceil(e.columns.length/2)).forEach((t=>e.columns.remove(t))),yield P(100),r.dataFrame=s}let d,m;try{d=h.getOptions(!0).look}catch(t){throw new Error("Viewer's .getOptions() error.",{cause:t})}try{m=h.getProperties()}catch(t){throw new Error("Viewer's .getProperties() error.",{cause:t})}const p={};Object.keys(d).filter((t=>"boolean"==typeof d[t])).forEach((t=>p[t]=!d[t])),m.filter((t=>null!==t.choices)).forEach((t=>p[t.name]=t.choices.find((e=>e!==d[t.name])))),h.setOptions(p),yield P(300);const g=r.saveLayout(),f=h.getOptions().look;r.resetLayout(),c.push(Array.from(r.viewers).length),r.loadLayout(g);const y=`${a} ${u}`;if(yield I((()=>null!==document.querySelector(y)),"cannot load viewer from layout",3e3),c.push(Array.from(r.viewers).length),h=Array.from(r.viewers).find((t=>"Grid"!==t.type)),S(c,[2,1,2]),A(JSON.stringify(h.getOptions().look),JSON.stringify(f)),!1!==(null==s?void 0:s.arbitraryDfTest)){n.shell.closeAll(),yield P(100),r=n.shell.addTableView(O);try{h=r.addViewer(t)}catch(t){return n.shell.closeAll(),void i.Balloon.closeAll()}yield I((()=>null!==document.querySelector(l)),"cannot load viewer on arbitrary dataset",3e3)}}finally{}}))}},850:(t,e,s)=>{"use strict";function n(t=!1,e="Assertion error."){if(!t)throw new Error(e)}function i(t){let e=0;for(let s=0;s<t.length;s++)e+=t[s]*t[s];return Math.sqrt(e)}function o(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let s=0;for(let n=0;n<t.length;n++)s+=t[n]*e[n];return s}function r(t,e){let s=0;const n=t.length;if(n!==e.length)throw new Error("The dimensionality of the vectors must match");for(let i=0;i<n;++i)s+=Math.pow(t[i]-e[i],2);return Math.sqrt(s)}function a(t){const e=t.length;let s=0,n=0;for(let i=0;i<e;++i)s+=t[i],n+=Math.pow(t[i],2);const i=s/e,o=1/Math.sqrt(n/e-Math.pow(i,2));for(let s=0;s<e;++s)t[s]=(t[s]-i)*o;return t}s.d(e,{$G:()=>i,Fv:()=>a,MA:()=>o,dP:()=>r,hu:()=>n})},5362:(t,e,s)=>{"use strict";s.d(e,{Z:()=>a});var n=s(7537),i=s.n(n),o=s(3645),r=s.n(o)()(i());r.push([t.id,".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}","",{version:3,sources:["webpack://./css/composition-analysis.css"],names:[],mappings:"AAAA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB",sourcesContent:[".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}"],sourceRoot:""}]);const a=r},9564:(t,e,s)=>{"use strict";s.d(e,{Z:()=>a});var n=s(7537),i=s.n(n),o=s(3645),r=s.n(o)()(i());r.push([t.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB;AACA;IACI,oBAAoB;AACxB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}"],sourceRoot:""}]);const a=r},9414:(t,e,s)=>{"use strict";s.d(e,{Z:()=>a});var n=s(7537),i=s.n(n),o=s(3645),r=s.n(o)()(i());r.push([t.id,".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/ml/css/styles.css"],names:[],mappings:"AAAA;IACI,4BAA4B;IAC5B,WAAW;AACf;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,eAAe;IACf,kBAAkB;IAClB,YAAY;AAChB",sourcesContent:[".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n"],sourceRoot:""}]);const a=r},3645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var s="",n=void 0!==e[5];return e[4]&&(s+="@supports (".concat(e[4],") {")),e[2]&&(s+="@media ".concat(e[2]," {")),n&&(s+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),s+=t(e),n&&(s+="}"),e[2]&&(s+="}"),e[4]&&(s+="}"),s})).join("")},e.i=function(t,s,n,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(r[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);n&&r[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),s&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=s):h[2]=s),i&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=i):h[4]="".concat(i)),e.push(h))}},e}},7537:t=>{"use strict";t.exports=function(t){var e=t[1],s=t[3];if(!s)return e;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),o="/*# ".concat(i," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},9133:function(t,e,s){var n;!function(e,i){var o={};!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 s(t,s,n,i,o){for(var r,a,l,c,h,u,d,m,p,g,f,y,C;o>=64;){for(r=s[0],a=s[1],l=s[2],c=s[3],h=s[4],u=s[5],d=s[6],m=s[7],g=0;g<16;g++)f=i+4*g,t[g]=(255&n[f])<<24|(255&n[f+1])<<16|(255&n[f+2])<<8|255&n[f+3];for(g=16;g<64;g++)y=((p=t[g-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,C=((p=t[g-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,t[g]=(y+t[g-7]|0)+(C+t[g-16]|0);for(g=0;g<64;g++)y=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&u^~h&d)|0)+(m+(e[g]+t[g]|0)|0)|0,C=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&a^r&l^a&l)|0,m=d,d=u,u=h,h=c+y|0,c=l,l=a,a=r,r=y+C|0;s[0]+=r,s[1]+=a,s[2]+=l,s[3]+=c,s[4]+=h,s[5]+=u,s[6]+=d,s[7]+=m,i+=64,o-=64}return i}var n=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 n=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[n++],e--;64===this.bufferLength&&(s(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(n=s(this.temp,this.state,t,n,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[n++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,n=this.bufferLength,i=e/536870912|0,o=e<<3,r=e%64<56?64:128;this.buffer[n]=128;for(var a=n+1;a<r-8;a++)this.buffer[a]=0;this.buffer[r-8]=i>>>24&255,this.buffer[r-7]=i>>>16&255,this.buffer[r-6]=i>>>8&255,this.buffer[r-5]=i>>>0&255,this.buffer[r-4]=o>>>24&255,this.buffer[r-3]=o>>>16&255,this.buffer[r-2]=o>>>8&255,this.buffer[r-1]=o>>>0&255,s(this.temp,this.state,this.buffer,0,r),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 s=0;s<this.state.length;s++)this.state[s]=t[s];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=n;var i=function(){function t(t){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new n).update(t).finish(e).clean();else for(var s=0;s<t.length;s++)e[s]=t[s];for(s=0;s<e.length;s++)e[s]^=54;for(this.inner.update(e),s=0;s<e.length;s++)e[s]^=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),s=0;s<e.length;s++)e[s]=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 o(t){var e=(new n).update(t),s=e.digest();return e.clean(),s}function r(t,e){var s=new i(t).update(e),n=s.digest();return s.clean(),n}function a(t,e,s,n){var i=n[0];if(0===i)throw new Error("hkdf: cannot expand more");e.reset(),i>1&&e.update(t),s&&e.update(s),e.update(n),e.finish(t),n[0]++}t.HMAC=i,t.hash=o,t.default=o,t.hmac=r;var l=new Uint8Array(t.digestLength);t.hkdf=function(t,e,s,n){void 0===e&&(e=l),void 0===n&&(n=32);for(var o=new Uint8Array([1]),c=r(e,t),h=new i(c),u=new Uint8Array(h.digestLength),d=u.length,m=new Uint8Array(n),p=0;p<n;p++)d===u.length&&(a(u,h,s,o),d=0),m[p]=u[d++];return h.clean(),u.fill(0),o.fill(0),m},t.pbkdf2=function(t,e,s,n){for(var o=new i(t),r=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(r),c=new Uint8Array(r),h=new Uint8Array(n),u=0;u*r<n;u++){var d=u+1;a[0]=d>>>24&255,a[1]=d>>>16&255,a[2]=d>>>8&255,a[3]=d>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(c);for(var m=0;m<r;m++)l[m]=c[m];for(m=2;m<=s;m++){o.reset(),o.update(c).finish(c);for(var p=0;p<r;p++)l[p]^=c[p]}for(m=0;m<r&&u*r+m<n;m++)h[u*r+m]=l[m]}for(u=0;u<r;u++)l[u]=c[u]=0;for(u=0;u<4;u++)a[u]=0;return o.clean(),h}}(o);var r=o.default;for(var a in o)r[a]=o[a];"object"==typeof t.exports?t.exports=r:void 0===(n=function(){return r}.call(o,s,o,t))||(t.exports=n)}()},1811:(t,e,s)=>{"use strict";s.d(e,{T:()=>i});const n=new Uint32Array(65536),i=(t,e)=>{if(t.length<e.length){const s=e;e=t,t=s}return 0===e.length?t.length:t.length<=32?((t,e)=>{const s=t.length,i=e.length,o=1<<s-1;let r=-1,a=0,l=s,c=s;for(;c--;)n[t.charCodeAt(c)]|=1<<c;for(c=0;c<i;c++){let t=n[e.charCodeAt(c)];const s=t|a;t|=(t&r)+r^r,a|=~(t|r),r&=t,a&o&&l++,r&o&&l--,a=a<<1|1,r=r<<1|~(s|a),a&=s}for(c=s;c--;)n[t.charCodeAt(c)]=0;return l})(t,e):((t,e)=>{const s=e.length,i=t.length,o=[],r=[],a=Math.ceil(s/32),l=Math.ceil(i/32);for(let t=0;t<a;t++)r[t]=-1,o[t]=0;let c=0;for(;c<l-1;c++){let a=0,l=-1;const h=32*c,u=Math.min(32,i)+h;for(let e=h;e<u;e++)n[t.charCodeAt(e)]|=1<<e;for(let t=0;t<s;t++){const s=n[e.charCodeAt(t)],i=r[t/32|0]>>>t&1,c=o[t/32|0]>>>t&1,h=s|a,u=((s|c)&l)+l^l|s|c;let d=a|~(u|l),m=l&u;d>>>31^i&&(r[t/32|0]^=1<<t),m>>>31^c&&(o[t/32|0]^=1<<t),d=d<<1|i,m=m<<1|c,l=m|~(h|d),a=d&h}for(let e=h;e<u;e++)n[t.charCodeAt(e)]=0}let h=0,u=-1;const d=32*c,m=Math.min(32,i-d)+d;for(let e=d;e<m;e++)n[t.charCodeAt(e)]|=1<<e;let p=i;for(let t=0;t<s;t++){const s=n[e.charCodeAt(t)],a=r[t/32|0]>>>t&1,l=o[t/32|0]>>>t&1,c=s|h,d=((s|l)&u)+u^u|s|l;let m=h|~(d|u),g=u&d;p+=m>>>i-1&1,p-=g>>>i-1&1,m>>>31^a&&(r[t/32|0]^=1<<t),g>>>31^l&&(o[t/32|0]^=1<<t),m=m<<1|a,g=g<<1|l,u=g|~(c|m),h=m&c}for(let e=d;e<m;e++)n[t.charCodeAt(e)]=0;return p})(t,e)}},3979:(t,e)=>{"use strict";e.H$=void 0,e.H$=function(t,e,s){var n=function(t,e,s){if(0===t.length||0===e.length)return 0;if(s&&!s.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var n=0,i=t.length,o=e.length,r=Math.floor(Math.max(i,o)/2)-1,a=new Array(i),l=new Array(o),c=0;c<i;c++)for(var h=Math.max(0,c-r);h<=Math.min(o,c+r+1);h++)if(!a[c]&&!l[h]&&t[c]===e[h]){++n,a[c]=l[h]=!0;break}if(0===n)return 0;var u=0,d=0;for(c=0;c<i;c++)if(a[c]){for(;!l[d];)d++;t.charAt(c)!==e.charAt(d++)&&u++}return(n/i+n/o+(n-(u/=2))/n)/3}(t,e,s),i=0;if(n>.7){for(var o=Math.min(t.length,e.length),r=0;t[r]===e[r]&&r<4&&r<o;)++i,r++;n+=.1*i*(1-n)}return n}},3379:t=>{"use strict";var e=[];function s(t){for(var s=-1,n=0;n<e.length;n++)if(e[n].identifier===t){s=n;break}return s}function n(t,n){for(var o={},r=[],a=0;a<t.length;a++){var l=t[a],c=n.base?l[0]+n.base:l[0],h=o[c]||0,u="".concat(c," ").concat(h);o[c]=h+1;var d=s(u),m={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(m);else{var p=i(m,n);n.byIndex=a,e.splice(a,0,{identifier:u,updater:p,references:1})}r.push(u)}return r}function i(t,e){var s=e.domAPI(e);return s.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;s.update(t=e)}else s.remove()}}t.exports=function(t,i){var o=n(t=t||[],i=i||{});return function(t){t=t||[];for(var r=0;r<o.length;r++){var a=s(o[r]);e[a].references--}for(var l=n(t,i),c=0;c<o.length;c++){var h=s(o[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}o=l}}},569:t=>{"use strict";var e={};t.exports=function(t,s){var n=function(t){if(void 0===e[t]){var s=document.querySelector(t);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(t){s=null}e[t]=s}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(s)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},3565:(t,e,s)=>{"use strict";t.exports=function(t){var e=s.nc;e&&t.setAttribute("nonce",e)}},7795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(s){!function(t,e,s){var n="";s.supports&&(n+="@supports (".concat(s.supports,") {")),s.media&&(n+="@media ".concat(s.media," {"));var i=void 0!==s.layer;i&&(n+="@layer".concat(s.layer.length>0?" ".concat(s.layer):""," {")),n+=s.css,i&&(n+="}"),s.media&&(n+="}"),s.supports&&(n+="}");var o=s.sourceMap;o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,s)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},4589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},7241:(t,e,s)=>{"use strict";s.d(e,{D:()=>h});var n=s(4469),i=s(976),o=s(6414),r=s.n(o),a=s(4955),l=s(499);const c=31;async function h(t,e=!1,s){const o=l.Cn.getOrCreate(t);let h;s??(s=new Map);const d=o.isHelm()?(0,a.getHelmMonomers)(t):Object.keys(o.stats.freq).filter((t=>""!==t));for(let t=0;t<d.length;t++)s.has(d[t])||s.set(d[t],`${s.size+1}`);if(o.isHelm())h=await n.functions.call("HELM:getMolFiles",{col:t}),h=function(t,e,s=!1){const n=new Array(t.length);for(let i=0;i<t.length;i++){let o=0,r=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=t.get(i);o=l.indexOf("\n",o)+1,o=l.indexOf("\n",o)+1,o=l.indexOf("\n",o)+1;const h=parseInt(l.substring(o,o+3)),u=parseInt(l.substring(o+3,o+6));a+=`M V30 COUNTS ${h} ${u} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let t=0;t<h;t++){o=l.indexOf("\n",o)+1+c,r=l.indexOf(" ",o);const n=l.substring(o,r);a+=s?`M V30 ${t+1} R${e.get(n)} 0.000 0.000 0 0\n`:`M V30 ${t+1} At 0.000 0.000 0 0 MASS=${e.get(n)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let t=0;t<u;t++){o=l.indexOf("\n",o)+1;const e=parseInt(l.substring(o,o+3).trim()),s=parseInt(l.substring(o+3,o+6).trim());a+=`M V30 ${t+1} ${parseInt(l.substring(o+6,o+9).trim())} ${e} ${s}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",n[i]=a}return n}(h,s,e);else{h=new Array(t.length);for(let n=0;n<t.length;n++){const t=u(r()(o.splitted[n]).filter((t=>""!==t)).toArray(),s,e);h[n]=t}}return i.Column.fromStrings("monomericMols",h)}function u(t,e,s=!1){let n="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";n+=`M V30 COUNTS ${t.length} ${t.length?t.length-1:0} 0 0 0\n`,n+="M V30 BEGIN ATOM\n";for(let i=0;i<t.length;i++)n+=s?`M V30 ${i+1} R${e.get(t[i])} 0.000 0.000 0 0\n`:`M V30 ${i+1} At 0.000 0.000 0 0 MASS=${e.get(t[i])}\n`;n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n";for(let e=0;e<t.length-1;e++)n+=`M V30 ${e+1} 1 ${e+1} ${e+2}\n`;return n+="M V30 END BOND\n",n+="M V30 END CTAB\n",n+="M END",n}},4955:(t,e,s)=>{"use strict";s.d(e,{_package:()=>ie,activityCliffs:()=>ae,getBioLib:()=>re,getHelmMonomers:()=>ue,getMonomerLibHelper:()=>oe,importFasta:()=>he,sequenceIdentityScoring:()=>de,sequenceSimilarityScoring:()=>me,sequenceSpaceTopMenu:()=>le,toAtomicLevel:()=>ce});var n,i,o=s(4469),r=s(3870),a=s(976),l=s(4628);(i=n||(n={})).EUCLIDEAN="EUCLIDEAN",i.MANHATTAN="MANHATTAN",a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;var c=s(442),h=s(5697),u=s(701),d=s(3379),m=s.n(d),p=s(7795),g=s.n(p),f=s(569),y=s.n(f),C=s(3565),T=s.n(C),A=s(9216),b=s.n(A),w=s(4589),S=s.n(w),E=s(9414),v={};v.styleTagTransform=S(),v.setAttributes=T(),v.insert=y().bind(null,"head"),v.domAPI=g(),v.insertStyleElement=b(),m()(E.Z,v),E.Z&&E.Z.locals&&E.Z.locals;var x=s(7861);const L=t=>null==t;function M(t,e,s,n){if(s>t[t.length-1])return;const i=t.findIndex((t=>s<t));t.pop(),t.splice(i,0,s),e.pop(),e.splice(i,0,n)}var N=s(6361);class _{_workerCount;constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calc(t,e,n,i={}){const o=t.length*(t.length-1)/2,r=Math.floor(o/this._workerCount),a=t.length>2e4?await this.getMinimalThreshold(t,e,i):0;n<a&&(console.log(`using threshold ${a}`),n=a),i.threshold=n;const l=new Array(this._workerCount),c=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(471),s.b))));for(let s=0;s<this._workerCount;s++)l[s]=new Promise(((a,l)=>{const h=s*r,u=s===this._workerCount-1?o:(s+1)*r;u<=h&&a({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:s}),c[s].postMessage({values:t,startIdx:h,endIdx:u,threshold:n,fnName:e,opts:i}),c[s].onmessage=({data:{error:t,i:e,j:n,distance:i}})=>{t?(c[s].terminate(),l(t)):(c[s].terminate(),a({i:e,j:n,distance:i,idx:s}))}}));const h=await Promise.all(l),u=h.reduce(((t,e)=>t+e.i.length),0),d=new Int32Array(u),m=new Int32Array(u),p=new Float32Array(u);let g=0;for(const t of h)d.set(t.i,g),m.set(t.j,g),p.set(t.distance,g),g+=t.i.length;return{i:d,j:m,distance:p}}async getKNN(t,e,s=15,n={}){return await this.multiColumnKNN([t],[e],s,[n],[1])}async multiColumnKNN(t,e,i=15,o,r,a=n.EUCLIDEAN){if(t.length!==e.length||t.length!==o.length||t.length!==r.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(t.some((e=>e.length!==t[0].length)))throw new Error("all values arrays should have the same length");const l=t[0].length*(t[0].length-1)/2,c=Math.floor(l/this._workerCount),h=new Array(this._workerCount),u=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(664),s.b))));for(let s=0;s<this._workerCount;s++)h[s]=new Promise(((n,h)=>{const d=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=d&&n({knnDistances:new Array(0),knnIndexes:new Array(0)}),u[s].postMessage({values:t,startIdx:d,endIdx:m,fnNames:e,opts:o,nNeighbours:i,weights:r,aggregationMethod:a}),u[s].onmessage=({data:{error:t,knnDistances:e,knnIndexes:i}})=>{t?(u[s].terminate(),h(t)):(u[s].terminate(),n({knnDistances:e,knnIndexes:i}))}}));const d=await Promise.all(h),m={knnDistances:new Array(t[0].length).fill(null).map((()=>new Array(i).fill(99999))),knnIndexes:new Array(t[0].length).fill(null).map((()=>new Array(i).fill(-1)))};for(const e of d)for(let s=0;s<t[0].length;++s)for(let t=0;t<e.knnDistances[s]?.length;++t)M(m.knnDistances[s],m.knnIndexes[s],e.knnDistances[s][t],e.knnIndexes[s][t]);return m}async getSampleDistances(t,e,n={}){const i=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(118),s.b)))),o=t.slice();for(let t=o.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[o[t],o[e]]=[o[e],o[t]]}try{const s=t.length*(t.length-1)/2,r=Math.floor(s/this._workerCount),a=1e6,l=Math.max(Math.min(s/1e3,a),Math.min(s,a)),c=Math.floor(l/this._workerCount),h=new Array(this._workerCount);for(let t=0;t<this._workerCount;t++)h[t]=new Promise(((a,l)=>{const h=t*r,u=t===this._workerCount-1?s:(t+1)*r;i[t].postMessage({values:o,startIdx:h,endIdx:u,sampleLength:c,fnName:e,opts:n}),i[t].onmessage=({data:{error:e,distance:s}})=>{i[t].terminate(),e?l(e):a({distance:s})}}));const u=await Promise.all(h),d=u.reduce(((t,e)=>t+e.distance.length),0),m=new Float32Array(d);let p=0;for(const t of u)m.set(t.distance,p),p+=t.distance.length;return m.sort(),m}catch(t){return i?.forEach((t=>t?.terminate())),console.error(t),new Float32Array(1).fill(.5)}}async getMinimalThreshold(t,e,s={}){try{const n=t.length*(t.length-1)/2,i=await this.getSampleDistances(t,e,s);return 1-i[Math.floor(7e7/n*i.length)]}catch(t){return console.error(t),.5}}static calcSync(t,e,s,n){const i=[],o=[],r=[];let a=0,l=0,c=0;const u=t.length*(t.length-1)/2;for(;a<u;){const u=L(t[l])||L(t[c])?1:s(t[l],t[c]);(Object.values(N.gk).some((t=>t===e))?(0,h.Om)(u):1-u)>=n&&(i.push(l),o.push(c),r.push(u)),a++,c++,c===t.length&&(l++,c=l+1)}return{i:new Int32Array(i),j:new Int32Array(o),distance:new Float32Array(r)}}}var P,I=s(9657);!function(t){t.none="none",t.bold="bold",t.dashed="dashed"}(P||(P={}));class R{get currentLineId(){return this._currentLineIdx}set currentLineId(t){t!==this._currentLineIdx&&(this._currentLineIdx=t,this.sp.render(this.ctx))}set linesToRender(t){this.updateLines(t),this.sp.render(this.ctx)}set linesVisibility(t){this.visibility=t,this.sp.render(this.ctx)}constructor(t,e,s,n,i=P.none){var o;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=t,this.xAxisCol=this.sp.dataFrame.columns.byName(e),this.yAxisCol=this.sp.dataFrame.columns.byName(s),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=i,this.updateLines(n),this.visibility=null!==(o=n.visibility)&&void 0!==o?o:new I.Z(this.lines.from.length),n.visibility||this.visibility.setAll(!0,!1),n.arrowSize&&(this.arrowWidth=n.arrowSize),this.canvas.onmousedown=t=>{-1!==this.mouseOverLineId&&this.lineClicked.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},this.canvas.onmousemove=t=>{this.mouseOverLineId=this.checkCoordsOnLine(t.offsetX,t.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},t.onEvent("d4-before-draw-scene").subscribe((t=>{this.renderLines()}))}updateLines(t){this.lines=t,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),this.createMultiLinesIndices()}renderLines(){var t,e,s,n,i,o,r,a,l,c,h,u,d;const m=this.sp.getOptions().look,p=this.lines.colors||this.lines.width||this.lines.opacities||this.lines.drawArrowsArr;p||(this.ctx.lineWidth=null!==(t=this.lines.width)&&void 0!==t?t:1,this.ctx.strokeStyle=`rgba(${null!==(e=this.lines.color)&&void 0!==e?e:"0,128,0"},${null!==(s=this.lines.opacity)&&void 0!==s?s:1})`);const g=m.sizeColumnName?this.sp.dataFrame.col(m.sizeColumnName):null,f=this.sp.dataFrame.filter;for(let t=0;t<this.lines.from.length;t++)if(f.get(this.lines.from[t])&&f.get(this.lines.to[t])&&this.visibility.getBit(t)){let e=0;const{sizeFrom:s,sizeTo:f}=this.getMarkersSizes(m,g,t),y=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[t]),this.yAxisCol.get(this.lines.from[t]));let C=null==y?void 0:y.x,T=null==y?void 0:y.y;const A=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[t]),this.yAxisCol.get(this.lines.to[t]));let b=null==A?void 0:A.x,w=null==A?void 0:A.y;if(this.ctx.beginPath(),C&&T&&b&&w){if(p){const e=(null===(n=this.lines.colors)||void 0===n?void 0:n[t])?null===(i=this.lines.colors)||void 0===i?void 0:i[t]:"0,128,0",s=(null===(o=this.lines.opacities)||void 0===o?void 0:o[t])?null===(r=this.lines.opacities)||void 0===r?void 0:r[t]:1;this.ctx.strokeStyle=`rgba(${e},${s})`,this.ctx.lineWidth=(null===(a=this.lines.widths)||void 0===a?void 0:a[t])?null===(l=this.lines.widths)||void 0===l?void 0:l[t]:1}t===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const m=this.multipleLinesCounts[t];let g=null;if(m){e=this.getLineLength(C,T,b,w);const n=this.getPointOnDistance(C,T,b,w,f,e),i=this.getPointOnDistance(b,w,C,T,s,e);C=n.x,T=n.y,b=i.x,w=i.y,g=this.lines.from[t]>this.lines.to[t]?this.findControlPoint(m,C,T,b,w,t):this.findControlPoint(m,b,w,C,T,t),this.ctx.moveTo(C,T),this.ctx.quadraticCurveTo(g.x,g.y,b,w)}else this.ctx.moveTo(C,T),this.ctx.lineTo(b,w);if((null!==(c=this.lines.drawArrows)&&void 0!==c?c:null===(h=this.lines.drawArrowsArr)||void 0===h?void 0:h.getBit(t))&&(e||(e=this.getLineLength(C,T,b,w)),e>this.arrowWidth)){const t=m?null:this.getPointOnDistance(C,T,b,w,f,e),s=m?g.x:C,n=m?g.y:T;this.canvasArrow(this.ctx,null!==(u=null==t?void 0:t.x)&&void 0!==u?u:C,null!==(d=null==t?void 0:t.y)&&void 0!==d?d:T,s,n)}this.ctx.stroke(),this.ctx.closePath(),t===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(t){switch(this.currentLineStyle){case P.bold:t?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case P.dashed:t?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(t,e,s){let n=3,i=3;return e?(n=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.from[s]))/2,i=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.to[s]))/2):t.markerDefaultSize&&(n=t.markerDefaultSize/2,i=t.markerDefaultSize/2),{sizeFrom:n,sizeTo:i}}fillLeftBottomRect(){const t=new Path2D;t.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(t),this.ctx.closePath()}createMultiLinesIndices(){const t=new I.Z(this.lines.from.length);t.setAll(!0);for(let e=-1;-1!==(e=t.findNext(e));){let s=e,n=this.lines.from[s],i=this.lines.to[s],o=1;for(let s=e;-1!==(s=t.findNext(s));){const e=this.lines.from[s],r=this.lines.to[s];(e===n&&r===i||r===n&&e===i)&&(this.multipleLinesCounts[s]=++o,t.setBit(s,!1,!1))}o>1&&(this.multipleLinesCounts[s]=1),t.setBit(e,!1,!1)}}checkCoordsOnLine(t,e){let s=-1,n=null,i=null;const o=this.sp.getOptions().look,r=o.sizeColumnName?this.sp.dataFrame.col(o.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:c}=this.getMarkersSizes(o,r,l),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const s=this.getLineLength(h.x,h.y,u.x,u.y),n=this.getPointOnDistance(h.x,h.y,u.x,u.y,c,s),o=this.getPointOnDistance(u.x,u.y,null==h?void 0:h.x,null==h?void 0:h.y,a,s),r=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],n.x,n.y,o.x,o.y,l):this.findControlPoint(this.multipleLinesCounts[l],o.x,o.y,n.x,n.y,l);i=this.calculateDistToCurveLine(l,t,e,n,o,r)}else i=this.calculateDistToStraightLine(t,e,h,u);(!n&&null!==i&&i<5||n&&null!==i&&i<n)&&(n=i,s=l)}return s}calculateDistToStraightLine(t,e,s,n){let i=Math.min(s.x,n.x),o=Math.max(s.x,n.x),r=Math.min(s.y,n.y),a=Math.max(s.y,n.y);return t>=i-2&&t<=o+2&&e>=r-2&&e<=a+2?this.distToStraightLineSegment(t,e,s,n):null}distToStraightLineSegment(t,e,s,n){const i=(t,e,s,n)=>Math.pow(t-s,2)+Math.pow(e-n,2),o=i(s.x,s.y,n.x,n.y);if(0==o)return i(t,e,s.x,s.y);let r=((t-s.x)*(n.x-s.x)+(e-s.y)*(n.y-s.y))/o;return r=Math.max(0,Math.min(1,r)),i(t,e,s.x+r*(n.x-s.x),s.y+r*(n.y-s.y))}calculateDistToCurveLine(t,e,s,n,i,o){let r=Math.min(n.x,i.x,o.x),a=Math.max(n.x,i.x,o.x),l=Math.min(n.y,i.y,o.y),c=Math.max(n.y,i.y,o.y);if(e>=r-2&&e<=a+2&&s>=l-2&&s<=c+2){const t=a-r,h=c-l;return this.calculateDistToCurveInRect(e,s,n,o,i,t,h)}return null}calculateDistToCurveInRect(t,e,s,n,i,o,r){const a=Math.floor((o+r)/3),l=1/a,c=new Uint32Array(a),h=new Uint32Array(a);let u=new Uint32Array(a),d=null;const m=new I.Z(a);for(let o=0;o<c.length;o++){const r=o*l,a=Math.pow(1-r,2)*s.x+2*r*(1-r)*n.x+Math.pow(r,2)*i.x,m=Math.pow(1-r,2)*s.y+2*r*(1-r)*n.y+Math.pow(r,2)*i.y,p=Math.abs(t-a),g=Math.abs(e-m),f=p+g;(!d||d>f)&&(d=f),u[o]=Math.max(p,g),c[o]=a,h[o]=m}for(let t=0;t<c.length;t++)u[t]<d&&m.setBit(t,!0,!1);let p=null;for(let s=-1;-1!==(s=m.findNext(s));){const n=Math.hypot(c[s]-t,h[s]-e);(!p||p>n)&&(p=n)}return p}getLineLength(t,e,s,n){return Math.sqrt(Math.pow(s-t,2)+Math.pow(n-e,2))}getPointOnDistance(t,e,s,n,i,o){const r=s-i*((s-t)/o),l=n-i*((n-e)/o);return new a.Point(r,l)}findControlPoint(t,e,s,n,i,o){const r=e+(n-e)/2,l=s+(i-s)/2;let c=r-e,h=l-s;const u=Math.sqrt(c*c+h*h);c/=u,h/=u;const d=50*Math.ceil(t/2);return t%2==0?new a.Point(r+d/2*h,l-d/2*c):new a.Point(r-d/2*h,l+d/2*c)}canvasArrow(t,e,s,n,i){const o=Math.atan2(n-e,i-s)+Math.PI;t.moveTo(e-this.arrowWidth*Math.sin(o-Math.PI/10),s-this.arrowWidth*Math.cos(o-Math.PI/10)),t.lineTo(e,s),t.lineTo(e-this.arrowWidth*Math.sin(o+Math.PI/10),s-this.arrowWidth*Math.cos(o+Math.PI/10))}}const O="dimensionality-reducer-terminate-event";var G=s(850);async function F(t,e,n,i,r,a,l){let c=await async function(t,e,n,i,r,a,l){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(t.length!==e.length||t.length!==a.distanceFnArgs.length||t.length!==i.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(c,h){const u=new Worker(new URL(s.p+s.u(42),s.b));u.postMessage({columnsData:t,distanceMetrics:e,method:n,options:a,weights:i,aggregationMethod:r});const d=o.events.onCustomEvent(O).subscribe((()=>{try{u?.terminate()}finally{d.unsubscribe()}}));u.onmessage=({data:{error:t,embedding:e,epochNum:s,epochsLength:n}})=>{s&&n?l&&l(s,n,e):(d.unsubscribe(),t?h(t):c(e),setTimeout((()=>u.terminate()),0))}}))}(t,n,e,i,r,a,l);return c=c.map((t=>(0,G.Fv)(t))),c}let H=0;const W="cliffsDf",D=new u.Subject,B="act_diff",k="sali",U="sim",V="line_index",$=["1_seq","2_seq"],Y="filterCliffs";var K,Z=s(499),q=s(5226),X=s(7228),z=s(8457),j=s(8260);async function Q(t,e,s,n){const i=(0,z.O)(e),o=(0,j.vU)(e.getTag(a.TAGS.UNITS),e.getTag("separator"))(s),r=n===K.IDENTITY?function(t,e){const s=e.columns.length,n=new Array(s),i=new Array(s),o=new Array(s);for(let r=0;r<s;++r){const s=e.columns.byIndex(r);n[r]=s.getRawData(),i[r]=s.categories.indexOf(""),o[r]=s.categories.indexOf(t[r]??"")}const r=a.Column.float("Identity",e.rowCount),l=r.getRawData();for(let s=0;s<e.rowCount;++s){l[s]=0;for(let e=0;e<t.length;++e)n[e][s]===o[e]&&++l[s];l[s]/=t.length}return r}(o,i):n===K.SIMILARITY?await async function(t,e){const s=e.columns.toList();return await(0,X.Qx)(s,t)}(o,i):null;if(null===r)throw new Error(`In bio library: Unkown sequence scoring method: ${n}`);return r.name=t.columns.getUnusedName(r.name),t.columns.add(r),r}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(K||(K={}));var J=s(7945),tt=(s(4293),s(6414)),et=s.n(tt);const st="rgb(100,100,100)",nt="#808080",it="rgb(0,0,0)",ot=j.GU;var rt,at;function lt(t,e,s,n,i,o,r=st,a=0,l=!1,c=1,h="",u=!1,d=at.classic,m=[],p=0,g=null,f=[],y=null,C={}){i.textAlign="start";let T=o.substring(0),A=u?"":h;d===at.MSA&&(A="");let b=!0,w=!0,S="difference";null!=g&&null!=g.cell.column&&(b=g.cell.column.temp["color-code"]??!0,w=g.cell.column.temp["compare-with-current"]??!0,S=g.cell.column.temp["highlight-difference"]??"difference");const E=f[p];w&&f.length>0&&"difference"===S&&(c=T==E?.3:c),w&&f.length>0&&"equal"===S&&(c=T!=E?.3:c),null!=y&&(T=ot(T,y));const v=T+A;C[v]??(C[v]=i.measureText(v));let x=C[v];C[T]??(C[T]=i.measureText(T));let L=C[T].width;C[A]??(C[A]=i.measureText(A));const M=C[A].width,N=n/2-(x.fontBoundingBoxAscent+x.fontBoundingBoxDescent)/2+1;function _(s,n){const o=b?r:it;i.fillStyle=o,i.globalAlpha=c,d===at.classic&&(i.fillText(T,t+s,e+N),i.fillStyle=nt,i.fillText(A,t+n,e+N)),d===at.MSA&&i.fillText(T,t+s,e+N)}x=x.width,d===at.MSA&&(L=m[p],x=m[p]);const P=(m[p]??0)-(m[0]??0);if(l||x>s)return _(P,P+L),t+P+L+M;{const e=(s-x)/2;return _(e,e+L),t+P+e+L}}!function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(rt||(rt={})),function(t){t.MSA="MSA",t.classic="classic"}(at||(at={})),s(9611);var ct,ht,ut=s(8447),dt=s(7331);function mt(t){const e=!et().enumerate(t).some((([e,s])=>e.length>1&&0!=s&&s!=t.length-1)),s=[],n=e?"":" ";for(const[e,i]of et().enumerate(t)){let o=e;i<t.length&&(o+=`${e?"":"-"}${n}`),s.push(o)}return[s,e]}(ht=ct||(ct={})).long="long",ht.short="short",s(3553),ut.GU;class pt extends a.GridCellRenderer{constructor(){super(...arguments),this.padding=5}get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(t,e){t.cell.column.temp["current-word"]=t.cell.value,t.grid.invalidate()}onMouseMove(t,e){const s=t.cell.column.temp["bio-seqCol"];if(!s)return;const n=t.bounds,i=e.offsetX-t.gridColumn.left+(t.gridColumn.left-n.x),a=s.getPosition(t.tableRowIndex,i),l=s.getSeqMonList(t.tableRowIndex);if(null!==a&&a<l.length){const t=l[a],n=[r.div(t)];if(s._monomerStructureMap[t])n.push(s._monomerStructureMap[t]);else{const e=s.getMonomer(t);if(e){const i={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0},r=o.chem.svgMol(e.smiles,void 0,void 0,i);n.push(r),s._monomerStructureMap[t]=r}}r.tooltip.show(r.divV(n),e.x+16,e.y+16)}else r.tooltip.hide()}render(t,e,s,n,i,o,r){try{o.grid}catch(t){const[e,s]=(0,J.yf)(t);ie.logger.error(e,void 0,s)}o.cell.column}}class gt extends a.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return constants.Of.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(t,e,s,n,i,o,r){const l=window.devicePixelRatio,c=o.grid,h=o.cell,u=o.tableColumn,d=h.value??"",m=u.tags.separator,p=u.tags[a.TAGS.UNITS];getUpdatedWidth(c,t,e,n,l);const[g,f]=d.split("#"),y=(0,j.vU)(p,m);ft(t,e,s,n,i,y(g),y(f),p)}}function ft(t,e,s,n,i,o,r,a,l,c){if(o.length!==r.length){const t=function(t,e){let s=0,n=0;const i=t.length>e.length?t:e,o=t.length>e.length?e:t;for(let t=0;t<o.length;t++)i[t]===o[t]&&s++;const r=i.length-o.length;for(let t=i.length-1;t>r;t--)i[t]===o[t-r]&&n++;const a=new Array(Math.abs(t.length-e.length)).fill("");function l(t){return s>n?t.concat(a):a.concat(t)}return t.length>e.length?e=l(e):t=l(t),{subParts1:t,subParts2:e}}(et()(o).toArray(),et()(r).toArray());o=t.subParts1,r=t.subParts2}const h=t.measureText(mt(o).join("")),u=t.measureText(mt(r).join("")),d=Math.max(h.width,u.width);l&&(n=d+4*o.length,t.canvas.width=d+4*o.length);let m=Math.max(e,e+(n-(d+4*o.length))/2)+5;const p=Math.max(s,s+(i-28)/2);t.save(),t.beginPath(),t.rect(e,s,l?d+4*o.length:n,i),t.clip(),t.font="12px monospace",t.textBaseline="top";let g=dt.UE.Color;"HELM"!=a&&(g=(0,ut.py)(a.substring(a.length-2)));for(let e=0;e<o.length;e++){const s=o[e],a=r[e],l=g.get(s);if(s!=a){const o=g.get(a),r=lt(m,p-7,n,i,t,s,l,0,!0),h=lt(m,p+7,n,i,t,a,o,0,!0);m=Math.max(h,r),c&&(c[e]=yt(s,a,l,o,p,7,i))}else m=lt(m,p,n,i,t,s,l,0,!0,.5);m+=4}t.restore()}function yt(t,e,s,n,i,o,r){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(mt([t]).join("")).width,h=l.measureText(mt([e]).join("")).width,u=Math.max(c,h);return a.height=r,a.width=u+4,l.font="12px monospace",l.textBaseline="top",lt(0,i-o,u,r,l,t,s,0,!0),lt(0,i+o,u,r,l,e,n,0,!0),a}var Ct,Tt=s(8467),At=s(9298);!function(t){t.Unknown="unknown",t.FR="framework",t.CDR="cdr"}(Ct||(Ct={}));const bt=new class{constructor(){this.regionTypes=[Ct.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=At.ES.Entropy,this.filterSource=At.vS.filterSource}};var wt=s(172),St=s(8415);const Et=Ct;var vt,xt;!function(t){t.STYLE="Style",t.BEHAVIOR="Behavior",t.LAYOUT="Layout",t.DATA="Data"}(vt||(vt={})),function(t){t.skipEmptyPositions="skipEmptyPositions",t.regionTypes="regionTypes",t.chains="chains",t.fitWidth="fitWidth",t.positionWidth="positionWidth",t.positionHeight="positionHeight",t.filterSource="filterSource"}(xt||(xt={}));const Lt=bt;class Mt extends a.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewerId=++Mt.viewerCounter,this.setDataInProgress=!1,this.host=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.calcSizeRequested=!1,this._onRendered=new u.Subject,this.skipEmptyPositions=this.bool(xt.skipEmptyPositions,Lt.skipEmptyPositions,{category:vt.DATA}),this.regionTypes=this.stringList(xt.regionTypes,Lt.regionTypes,{category:vt.DATA,choices:Object.values(Et).filter((t=>t!=Et.Unknown))}),this.chains=this.stringList(xt.chains,Lt.chains,{category:vt.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(xt.fitWidth,Lt.fitWidth,{category:vt.LAYOUT}),this.positionWidth=this.float(xt.positionWidth,Lt.positionWidth,{category:vt.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(xt.positionHeight,Lt.positionHeight,{category:vt.LAYOUT,choices:Object.keys(At.ES)}),this.filterSource=this.string(xt.filterSource,Lt.filterSource,{category:vt.BEHAVIOR,choices:Object.values(At.Ct)}),this.viewSyncer=new wt.c(ie.logger)}viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,u.fromEvent)(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}detach(){const t=`${this.viewerToLog()}.detach()`,e=super.detach.bind(this);this.viewSyncer.sync(`${t}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView("detach"),this.viewed=!1),e())}))}onTableAttached(){super.onTableAttached(),this.setData(this.regions)}onPropertyChanged(t){if(super.onPropertyChanged(t),t){switch(t.name){case xt.regionTypes:case xt.chains:this.setData(this.regions)}switch(t.name){case xt.skipEmptyPositions:for(let t=0;t<this.logos.length;++t)for(const e of this.chains)this.logos[t][e].setOptions({[St.bo.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case xt.fitWidth:case xt.positionWidth:this.calcSize();break;case xt.positionHeight:for(let t=0;t<this.logos.length;++t)for(const e of this.chains)this.logos[t][e].setOptions({[St.bo.positionHeight]:this.positionHeight});this.calcSize();break;case xt.filterSource:this.filterSourceInput.value=this.filterSource;break;default:this.setData(this.regions)}}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(t){const e=`${this.viewerToLog()}.setData()`;ie.logger.debug(`${e}, in, regions.length = ${t.length}`),this.viewSyncer.sync(`${e}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(await this.destroyView("setData"),this.viewed=!1),this.regions=t,this.viewed||(await this.buildView("setData"),this.viewed=!0)}finally{this.setDataInProgress=!1}}}))}async destroyView(t){ie.logger.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${t}', this.regions.length = ${this.regions.length}`),this.filterSourceInput&&r.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const t of this.viewSubs)t.unsubscribe()}async buildView(t){ie.logger.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${t}', this.regions.length = ${this.regions.length}`);const e=this.regions.filter((t=>this.regionTypes.includes(t.type))),s=Array.from(new Set(e.map((t=>t.order)))).sort(),n=[];for(let t=0;t<s.length;t++)for(const i of this.chains){const o=e.find((e=>e.order==s[t]&&e.chain==i));n.push((async()=>{const e=await this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:o.sequenceColumnName,startPositionName:o.positionStartName,endPositionName:o.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight,filterSource:this.filterSource});return e.onSizeChanged.subscribe((()=>{this.calcSize()})),[t,i,e]})())}const i=await Promise.all(n);this.logos=new Array(s.length);for(let t=0;t<s.length;++t)this.logos[t]={};for(const[t,e,s]of i)this.logos[t][e]=s,this.viewSubs.push(s.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=r.table(this.chains,(t=>[...s.length>0?[r.div(t,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(s.length).keys()].map((e=>{const s=this.logos[e][t];return s.root.style.height="100%",r.div([s.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(s.length).keys()].map((t=>e.find((e=>e.order==s[t]&&e.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=r.choiceInput("Data source",this.filterSource,Object.values(At.Ct),this.filterSourceInputOnValueChanged.bind(this)),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.right="9px",this.filterSourceInput.root.style.top="-4px",Math.ceil(255*Math.random()).toString(16),this.host=r.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),this.viewSubs.push(r.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),ie.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSize(){ie.logger.debug("Bio: VdRegionsViewer.calcSize(), start");const t=()=>{if(!this.host)return;const t=(this.root.clientHeight-54)/this.chains.length;let e=0;for(let s=0;s<this.logos.length;s++){for(const e of this.chains)this.logos[s][e].root.style.height=`${t}px`;e+=Math.max(...this.chains.map((t=>this.logos[s][t].Length)))}if(this.fitWidth){if(this.logos.length>0&&e>0){const t=22,s=13,n=9,i=(this.root.clientWidth-t-(this.logos.length-1)*n-s)/e;for(let t=0;t<this.logos.length;t++)for(const e of this.chains){const s=this.logos[t][e];s.setOptions({[St.bo.positionWidth]:i-s.positionMarginValue}),s.root.style.width=i*s.Length+"px"}}this.host.style.setProperty("overflow","hidden","important")}else{for(let t=0;t<this.logos.length;t++)for(const e of this.chains)this.logos[t][e].setOptions({[St.bo.positionWidth]:this.positionWidth});this.host.style.removeProperty("overflow")}0===this.positionWidth?this.host.style.setProperty("overflow-x","hidden","important"):this.host.style.removeProperty("overflow-x")};this.calcSizeRequested||(this.calcSizeRequested=!0,window.setTimeout((()=>{t(),this.calcSizeRequested=!1}),0))}rootOnSizeChanged(t){this.calcSize()}rootOnMouseMove(t){}filterSourceInputOnValueChanged(){const t=`${this.viewerToLog()}.filterSourceInputOnValueChanged()`,e=this.filterSourceInput.value;this.viewSyncer.sync(`${t}`,(async()=>{if(this.filterSource!==e){this.props.getProperty(xt.filterSource).set(this,e);for(let t=0;t<this.logos.length;t++)for(let e=0;e<this.chains.length;e++){const s=this.chains[e];this.logos[t][s].setOptions({[St.bo.filterSource]:this.filterSource})}}}))}get onRendered(){return this._onRendered}invalidate(){const t=`${this.viewerToLog()}.invalidate()`;this.viewSyncer.sync(`${t}`,(async()=>{this._onRendered.next()}))}async awaitRendered(t=5e3){await(0,Tt.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),t)}}function Nt(t){const e=r.divH([],{style:{gap:"10px"}}),s=r.divV([r.divText(t.seqCol.name),r.divText(t.activityCol.name)]);return s.style.fontWeight="bold",s.style.display="flex",s.style.justifyContent="space-between",e.append(s),t.points.forEach((s=>{const n=r.divText(t.activityCol.get(s).toFixed(2));n.style.display="flex",n.style.justifyContent="left",n.style.paddingLeft="30px",e.append(r.divV([r.divText(t.seqCol.get(s)),n]))})),e}function _t(t){const e=r.div();e.append(r.divText(t.seqCol.name,{style:{fontWeight:"bold"}}));const s=new Array(2),n=new Array(2);t.points.forEach(((e,i)=>{s[i]=t.seqCol.get(e),n[i]=t.activityCol.get(e)}));const i={},o=Z.Cn.getOrCreate(t.seqCol),a=o.getSplitter(),l=function(t,e,s,n){const i=document.createElement("canvas"),o=i.getContext("2d");return i.height=30,ft(o,0,0,0,30,t,e,s,!0,n),i}(a(s[0]),a(s[1]),o.units,i);return e.append(r.div(l,{style:{width:"300px",overflow:"scroll"}})),e.append(function(t){const e=r.div();if(Object.keys(t).length>0){const s=r.divV([]);s.append(r.divH([r.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),r.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const e of Object.keys(t))t[e].style.borderBottom="1px solid lightgray",s.append(r.divH([r.divText((parseInt(e)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),t[e]]));e.append(s)}return e}(i)),e.append(Pt("Activity delta",Math.abs(n[0]-n[1]))),e.append(Pt("Cliff",t.sali)),e}function Pt(t,e){return r.divH([r.divText(`${t}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),r.divText(e.toFixed(2))],{style:{paddingTop:"10px"}})}function It(t,e){const s=a.Column.string("seq_diff",t.rowCount).init((s=>`${t.get(e[0],s)}#${t.get(e[1],s)}`));s.semType="MacromoleculeDifference",s.setTag(a.TAGS.UNITS,t.col(e[0]).getTag(a.TAGS.UNITS)),s.setTag("separator",t.col(e[0]).getTag("separator")),t.columns.add(s);const n=t.plot.grid();return n.col(e[0]).visible=!1,n.col(e[1]).visible=!1,n}Mt.viewerCounter=-1,s(708),s(7983);class Rt extends a.JsViewer{constructor(t){super(),this.name="",this.metricsProperties=["distanceMetric","fingerprint"],this.fingerprintChoices=["Morgan","Pattern"],this.initialized=!1,this.tags=[a.TAGS.UNITS,"aligned","separator","alphabet"],this.preComputeDistanceMatrix=!1,this.renderPromise=Promise.resolve(),this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",h.kg[0],{choices:h.kg}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=t}init(){this.initialized=!0}detach(){this.subs.forEach((t=>t.unsubscribe()))}async onTableAttached(){if(this.init(),this.dataFrame){this.preComputeDistanceMatrix=this.dataFrame.rowCount<=22e3,this.subs.push(a.debounce(this.dataFrame.onRowsRemoved,50).subscribe((t=>this.render(!0))));const t="diversity"!==this.name;this.subs.push(a.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((e=>this.render(t)))),this.subs.push(a.debounce(this.dataFrame.selection.onChanged,50).subscribe((t=>this.render(!1)))),this.subs.push(a.debounce(r.onSizeChanged(this.root),50).subscribe((t=>this.render(!1)))),this.moleculeColumn=this.dataFrame.columns.bySemType(a.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=this.moleculeColumn?.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}this.render()}onPropertyChanged(t){if(super.onPropertyChanged(t),this.initialized){if("moleculeColumnName"===t.name){const e=this.dataFrame.col(t.get(this));e.semType===a.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=e)}this.render()}}render(t=!0){this.renderPromise=this.renderPromise.then((async()=>{this.computeRequested=this.computeRequested||t,await this.renderInt(t)}))}async renderInt(t){}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==a.SEMTYPE.MACROMOLECULE&&(o.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}s(7241),s(4004),s(9943),s(6099);var Ot,Gt=s(2918),Ft=function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))};class Ht{constructor(t,e,s=!1,n){var i;this.name="",this.description="",this._isAutomatic=!1,this._autoStartFirstStep=!1,this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._isStepProcessed=!1,this._root=r.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=r.panel([],"tutorials-main-header"),this._header=r.h2(""),this._headerDiv=r.divH([],"tutorials-root-header"),this._stopStartBtn=r.button(r.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=r.button(r.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=r.button(r.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=r.panel([],"tutorials-root-description"),this._progressDiv=r.divV([],"tutorials-root-progress"),this._progress=r.element("progress"),this._progressSteps=r.divText(""),this._closeBtn=r.button(r.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=t,this.description=e,this._isAutomatic=s,this._autoStartFirstStep=null!==(i=null==n?void 0:n.autoStartFirstStep)&&void 0!==i&&i,this._progress.max=0,this._progress.value=1,Ht.currentObject=this}get steps(){return this._steps}get stepNumber(){return this._steps.length}_addHeader(){this._createHeaderDiv(),this._createProgressDiv(),this._mainHeader.append(this._headerDiv,this._progressDiv)}_createHeaderDiv(){this._header.innerText=this.name,this._headerDiv.append(this._closeBtn),this._headerDiv.append(this._header),this._nextStepBtn.firstChild.className="grok-icon fas fa-play",this._headerDiv.append(this._isAutomatic?this._stopStartBtn:this._nextStepBtn)}_createProgressDiv(){this._progress.max=this.stepNumber,this._progressDiv.append(this._progress),this._progressSteps=r.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var t;this._activity.append(r.div(this.description,"tutorials-root-description"));for(let e=0;e<this.stepNumber;e++){let s=r.iconFA("clock");this._isAutomatic||0===e&&(s=r.iconFA("play",(()=>this._nextStep()),"Next step"),s.className="grok-icon fas fa-play");const n=r.div(this._steps[e].name,"grok-tutorial-entry-instruction"),i=r.div(null===(t=this._steps[e].options)||void 0===t?void 0:t.description,"grok-tutorial-step-description hidden"),o=r.divH([s,n],"grok-tutorial-entry");this._activity.append(o,i)}}_initRoot(){var t,e,s;o.shell.windows.showContextPanel=!0,o.shell.windows.showHelp=!1;const n=Array.from(o.shell.dockManager.rootNode.children)[0];this._node=o.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,n,""),(null===(e=null===(t=n.parent.container.containerElement.firstElementChild)||void 0===t?void 0:t.lastElementChild)||void 0===e?void 0:e.classList.contains("tab-handle-list-container"))&&(null===(s=n.parent.container.containerElement.firstElementChild)||void 0===s||s.lastElementChild.remove()),this._node.container.containerElement.classList.add("tutorials-demo-script-container"),this._addHeader(),this._root.append(this._mainHeader),this._addDescription(),this._root.append(this._activity)}_nextStep(){var t,e;return Ft(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const s=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],n=this._activity.getElementsByClassName("grok-icon")[this._currentStep],i=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];n.className="grok-icon far fa-spinner-third fa-spin",i.classList.remove("hidden"),i.classList.add("visible");const o=s,a=(null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay)?null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay:2e3;yield this._steps[this._currentStep].func(),this._scrollTo(this._root,o.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(s,n,a),yield(0,Tt.gw)(a));const l=r.iconFA("check");if(n.replaceWith(l),l.className="grok-icon far fa-check",this._progress.value++,this._progressSteps.innerText=`Step: ${this._progress.value} of ${this.stepNumber}`,this._currentStep++,this._isStepProcessed=!1,this._currentStep!==this.stepNumber){if(!this._isAutomatic){const t=this._activity.getElementsByClassName("grok-icon")[this._currentStep],e=r.iconFA("play",(()=>this._nextStep()),"Next step");e.className="grok-icon fas fa-play",t.replaceWith(e),this._nextStepBtn.classList.remove("disabled"),this._nextStepBtn.firstChild.classList.remove("fa-disabled")}}else this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn)}))}_startScript(){return Ft(this,void 0,void 0,(function*(){for(let t=this._currentStep;t<this.stepNumber&&!this._isStopped&&!this._isCancelled;t++)yield this._nextStep()}))}_scrollTo(t,e){t.focus(),t.scrollTop=e}_countdown(t,e,s){return Ft(this,void 0,void 0,(function*(){const n=r.div([],"demo-script-countdown");e.classList.add("hidden");let i=s/1e3;const o=this._createSVGIndicator(i);n.append(o),t.prepend(n);const a=setInterval((()=>{i--,0===i&&(clearInterval(a),n.remove(),e.classList.remove("hidden"),e.classList.add("visible"))}),1e3)}))}_createSVGIndicator(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","circle");return s.setAttributeNS(null,"cx","7"),s.setAttributeNS(null,"cy","7"),s.setAttributeNS(null,"r","6"),s.setAttributeNS(null,"style",`animation: countdown ${t}s linear infinite forwards`),e.append(s),e}_changeStopState(){const t=this._stopStartBtn.getElementsByClassName("grok-icon");t[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(t[0].className="grok-icon fal fa-pause",this._isStepProcessed||this._startScript())}_restartScript(){o.shell.dockManager.close(this._node),o.shell.closeAll(),this._clearRoot(),this._setInitParams(),this.start()}_clearRoot(){this._root=r.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=r.panel([],"tutorials-main-header"),this._header=r.h2(""),this._headerDiv=r.divH([],"tutorials-root-header"),this._activity=r.panel([],"tutorials-root-description"),this._progressDiv=r.divV([],"tutorials-root-progress"),this._progress=r.element("progress"),this._progressSteps=r.divText(""),this._progress.max=0,this._progress.value=1}_setInitParams(){this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._stopStartBtn.getElementsByClassName("grok-icon")[0].className="grok-icon fal fa-pause",this._nextStepBtn.classList.remove("disabled")}_closeDock(){o.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,Ht.currentObject=null}step(t,e,s){return this._steps[this.steps.length]={name:t,func:e,options:s},this}start(){return Ft(this,void 0,void 0,(function*(){this._initRoot(),o.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}Ht.currentObject=null,function(t){t.X="Embed_X",t.Y="Embed_Y"}(Ot||(Ot={}));var Wt=function(t,e,s,n){return new(s||(s=Promise))((function(i,o){function r(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(r,a)}l((n=n.apply(t,e||[])).next())}))};s(7905),s(3336),s(8341);var Dt=s(2568);s(525),s(9416),new class{constructor(){this.tooltipHandlerTemp="tooltip-handler.Monomer"}};class Bt extends a.GridCellRenderer{get name(){return constants.Of.MONOMER}get cellType(){return constants.Of.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 40}render(t,e,s,n,i,o,r){if(o.gridRow<0)return;MonomerTooltipHandler.getOrCreate(o.gridColumn),t.font="12px monospace",t.textBaseline="middle",t.textAlign="center";const a=(0,ut.py)(o.cell.column.getTag("alphabet")),l=o.cell.value;if(!l)return;const c=a.get(l);t.fillStyle=c,t.fillText((0,ut.GU)(l,6),e+n/2,s+i/2,n)}}class kt extends a.Package{constructor(){super(...arguments),this._initialized=!1}get properties(){return this._properties}set properties(t){this._properties=t}get initialized(){return this._initialized}completeInit(){this._initialized=!0}handleErrorUI(t){const[e,s]=(0,J.yf)(t);o.shell.error(e),this.logger.error(e,void 0,s)}}s(8770);class Ut extends a.Widget{constructor(t){super(r.divV([])),this.viewed=!1,this.seqCol=t}async init(){const t=Z.Cn.getOrCreate(this.seqCol),e=ie.properties.TooltipWebLogo,s=this.seqCol.getTag(At.DX.tooltipWebLogo);!1===e||["false","off","disable","disabled"].includes(s)||(this.wlViewer=await this.seqCol.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.seqCol.name,backgroundColor:0,positionHeight:"Entropy",positionWidth:t.getAlphabetIsMultichar()?24:16,fixWidth:!0,fitArea:!1}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer.detach(),super.detach()}}var Vt=s(922);class $t{constructor(t,e){this.helmColumn=t,this.df=e,this.helmColumn=t}async convertToSmiles(){const t=await this.getSmilesList(),e=this.df.columns.getUnusedName(`smiles(${this.helmColumn.name})`);return a.Column.fromStrings(e,t.map((t=>null===t?"":t)))}async getSmilesList(){return(await this.convertToMolfileV2KColumn()).toList().map((t=>a.chem.convert(t,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async convertToRdKitBeautifiedMolfileColumn(){const t=await this.getSmilesList(),e=await o.functions.call("Chem:getRdKitModule"),s=t.map((t=>{if(""===t)return null;const s=e.get_mol(t);return s?(s.normalize_depiction(1),s.straighten_depiction(!0),s):null})),n=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return a.Column.fromStrings(n,s.map((t=>null===t?"":t.get_molblock())))}async convertToMolfileV2KColumn(){const t=(await this.getPolymerGraphColumn()).toList().map(((t,e)=>{const s=this.helmColumn.get(e);if(!s)return"";let n="";try{n=this.getPolymerMolfile(s,t)}catch(t){const[e,s]=(0,J.yf)(t);ie.logger.error(e,void 0,s)}finally{return n}})),e=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",e,t)}async getPolymerGraphColumn(){return await o.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(t,e){const s=new Yt(e),n=new te(t);return s.monomerSymbols.forEach(((t,e)=>{const i=s.getMonomerShifts(e);n.addMonomer(t,e,i)})),n.compileToMolfile()}}class Yt{constructor(t){this.molfileHandler=Vt._.getInstance(t)}get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(t){return{x:this.molfileHandler.x[t],y:this.molfileHandler.y[t]}}}class Kt{constructor(t,e){this.capGroupElements=[];const s=Gt.NT.instance.getBioLib().getMonomer(e,t);if(!s)throw new Error(`Monomer ${t} is not found in the library`);this.molfileWrapper=new zt(s.molfile,t),this.capGroupElements=s.rgroups.map((t=>(t.capGroupSmiles||t.capGroupSMILES).replace(/(\[|\]|\*|:|\d)/g,"")))}shiftCoordinates(t){this.molfileWrapper.shiftCoordinates(t)}getAtomLines(){return this.molfileWrapper.getAtomLines()}getBondLines(){return this.molfileWrapper.getBondLines()}removeBondedRGroups(t){this.molfileWrapper.removeRGroups(t)}capTrailingRGroups(){this.molfileWrapper.capRGroups(this.capGroupElements)}replaceRGroupWithAttachmentAtom(t,e){this.molfileWrapper.replaceRGroupWithAttachmentAtom(t,e)}getAttachmentAtomByRGroupId(t){return this.molfileWrapper.getAttachmentAtomByRGroupId(t)}deleteBondLineWithSpecifiedRGroup(t){this.molfileWrapper.deleteBondLineWithSpecifiedRGroup(t)}shiftBonds(t){this.molfileWrapper.shiftBonds(t)}}class Zt{constructor(t,e,s){this.atoms=e,this.bonds=s,this.rGroupBondPositionMap=new Map,this.rGroupIdToAtomicIndexMap=this.getRGroupIdToAtomicIdxMap(t)}getAtomicIdx(t){const e=this.rGroupIdToAtomicIndexMap.get(t);return void 0===e?null:e}removeRGroupsFromAtomBlock(t){t.forEach((t=>{if(void 0===this.rGroupIdToAtomicIndexMap.get(t))throw new Error(`Cannot find atomic index for R group ${t}`)}));const e=Array.from(this.rGroupIdToAtomicIndexMap.entries()).filter((([e,s])=>t.includes(e))).map((([t,e])=>e));this.atoms.deleteAtoms(e)}removeRGroups(t){this.removeRGroupsFromAtomBlock(t),t.forEach((t=>{const e=this.replaceRGroupInBondsByDummy(t);this.rGroupBondPositionMap.set(t,e)}))}replaceRGroupInBondsByDummy(t){const e=this.rGroupIdToAtomicIndexMap.get(t);if(this.rGroupBondPositionMap.has(t))throw new Error(`R group ${t} is already handled`);const s=this.bonds.getPositionsInBonds(e+1);if(0===s.length)throw new Error(`Cannot find position for R group ${t}`);if(s.length>1)throw new Error(`More than one position for R group ${t}`);const n=s[0];return this.bonds.replacePositionsInBondsByDummy([n]),this.bonds.removeAtomIdFromBonds(e+1),this.removeRGroupFromAtomicIdxMap(t,e),n}removeRGroupFromAtomicIdxMap(t,e){this.rGroupIdToAtomicIndexMap.delete(t);for(const[t,s]of this.rGroupIdToAtomicIndexMap)s>e&&this.rGroupIdToAtomicIndexMap.set(t,s-1)}getRGroupIdToAtomicIdxMap(t){const e=new Map;t.filter((t=>t.startsWith("M RGP"))).forEach((t=>{const s=function(t){const e=t.split(/\s+/).filter((t=>t)).slice(3).map((t=>parseInt(t))),s=new Array(e.length/2);for(let t=0;t<e.length;t+=2)s[t/2]=[e[t+1],e[t]-1];return s}(t);for(const[t,n]of s){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,n)}}));const s=t.map(((t,e)=>{if(t.startsWith("A "))return e})).filter((t=>void 0!==t)),n=s.map((e=>t[e])),i=s.map((e=>t[e+1]));n.forEach(((t,s)=>{const n=parseInt(t.split(/\s+/)[1])-1,o=parseInt(i[s].substring(1));if(e.has(o))throw new Error(`R group ${o} is already in the map`);e.set(o,n)}));const o=this.atoms.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==o.length)throw new Error(`Unaccounted R group indices: ${o}`);return e}deleteBondLineWithSpecifiedRGroup(t){const e=this.rGroupBondPositionMap.get(t);if(!e)throw new Error(`Cannot find position for R group ${t}`);const{bondLineIdx:s}=e;this.bonds.deleteBondLines([s]),this.rGroupBondPositionMap.delete(t),this.rGroupIdToAtomicIndexMap.delete(t),this.rGroupBondPositionMap.forEach((t=>{t.bondLineIdx>s&&(t.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(t,e){const s=this.rGroupBondPositionMap.get(t);if(!s)throw new Error(`Cannot find position for R group ${t}`);const{bondLineIdx:n,nodeIdx:i}=s;this.bonds.bondedAtoms[n][i]=e}getAttachmentAtomIdByRGroupId(t){const e=this.rGroupBondPositionMap.get(t);if(!e)throw new Error(`Cannot find position for R group ${t}`);const{bondLineIdx:s,nodeIdx:n}=e;return this.bonds.bondedAtoms[s][(n+1)%2]}capRGroups(t){this.rGroupIdToAtomicIndexMap.forEach(((e,s)=>{const n=t[s-1];"H"===n?(this.removeRGroups([s]),this.deleteBondLineWithSpecifiedRGroup(s)):this.atoms.replaceElementSymbol(e,n)}))}}class qt{constructor(t){this.bondedPairs=[],this.rawBondLines=[],this.rawBondLines=t,this.bondedPairs=this.rawBondLines.map((t=>[parseInt(t.substring(0,3)),parseInt(t.substring(3,6))]))}getBondLines(){return this.bondedPairs.map(((t,e)=>{if(t.some((t=>-1===t)))throw new Error(`Bonded pair ${t} contains -1`);return`${t[0].toString().padStart(3," ")}${t[1].toString().padStart(3," ")}${this.rawBondLines[e].substring(6)}`}))}get bondedAtoms(){return this.bondedPairs}deleteBondLines(t){this.rawBondLines=this.rawBondLines.filter(((e,s)=>!t.includes(s))),this.bondedPairs=this.bondedPairs.filter(((e,s)=>!t.includes(s)))}getPositionsInBonds(t){const e=[];return this.bondedPairs.forEach(((s,n)=>{s.forEach(((s,i)=>{s===t&&e.push({bondLineIdx:n,nodeIdx:i})}))})),e}replacePositionsInBondsByDummy(t,e){void 0===e&&(e=-1),t.forEach((t=>{const{bondLineIdx:s,nodeIdx:n}=t;this.bondedPairs[s][n]=e}))}removeAtomIdFromBonds(t){this.bondedPairs=this.bondedPairs.map((e=>e.map((e=>e>t?e-1:e))))}shift(t){this.bondedPairs=this.bondedPairs.map((e=>e.map((e=>e+t))))}}class Xt{constructor(t){this.coordinates=[],this.rawAtomLines=[],this.rawAtomLines=t,this.coordinates=this.rawAtomLines.map((t=>({x:parseFloat(t.substring(0,10)),y:parseFloat(t.substring(10,20))})))}get atomCoordinates(){return this.coordinates}get atomLines(){return this.rawAtomLines.map(((t,e)=>{const s=this.coordinates[e];return`${s.x.toFixed(4).padStart(10," ")}${s.y.toFixed(4).padStart(10," ")}${t.substring(20)}`}))}replaceElementSymbol(t,e){this.rawAtomLines[t]=this.rawAtomLines[t].replace("R#",e)}deleteAtoms(t){this.coordinates=this.coordinates.filter(((e,s)=>!t.includes(s))),this.rawAtomLines=this.rawAtomLines.filter(((e,s)=>!t.includes(s)))}shift(t){this.coordinates=this.coordinates.map((e=>{const s=e.x+t.x,n=e.y+t.y;if(isNaN(s)||isNaN(n))throw new Error(`Cannot shift coordinates by ${t.x}, ${t.y}`);return{x:s,y:n}}))}rotate(t){this.coordinates=this.coordinates.map((e=>{const s=e.x,n=e.y,i=s*Math.cos(t)-n*Math.sin(t),o=s*Math.sin(t)+n*Math.cos(t);if(isNaN(i)||isNaN(o))throw new Error(`Cannot rotate coordinates by ${t}`);return{x:i,y:o}}))}getRGroupAtomicIndices(){return this.rawAtomLines.map(((t,e)=>{if(t.includes("R#"))return e})).filter((t=>void 0!==t))}}class zt{constructor(t,e){this.monomerSymbol=e;const s=t.split("\n"),n=parseInt(s[3].substring(0,3)),i=parseInt(s[3].substring(3,6)),o=s.slice(4,4+n);this.atoms=new Xt(o);const r=s.slice(4+n,4+n+i);this.bonds=new qt(r),this.rGroups=new Zt(s,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}deleteBondLineWithSpecifiedRGroup(t){this.rGroups.deleteBondLineWithSpecifiedRGroup(t)}shiftCoordinates(t){this.atoms.shift(t)}rotateCoordinates(t){this.atoms.rotate(t)}getBondLines(){return this.bonds.getBondLines()}getAtomLines(){return this.atoms.atomLines}removeRGroups(t){this.rGroups.removeRGroups(t)}replaceRGroupWithAttachmentAtom(t,e){this.rGroups.replaceRGroupWithAttachmentAtom(t,e)}getAttachmentAtomByRGroupId(t){return this.rGroups.getAttachmentAtomIdByRGroupId(t)}shiftR1GroupToOrigin(){const t=this.rGroups.getAtomicIdx(1);if(null===t)throw new Error(`Cannot find R1 group for monomer ${this.monomerSymbol}`);const{x:e,y:s}=this.atoms.atomCoordinates[t];this.atoms.shift({x:-e,y:-s})}alignR2AlongX(){const t=this.rGroups.getAtomicIdx(2);if(null===t)throw new Error(`Cannot find R2 group for monomer ${this.monomerSymbol}`);const e=this.atoms.atomCoordinates[t],s=e.y/e.x,n=Math.atan(s);if(isNaN(n))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-n)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}shiftBonds(t){this.bonds.shift(t)}capRGroups(t){this.rGroups.capRGroups(t)}}class jt{constructor(t){this.simplePolymer=t,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:e,monomerTypes:s}=this.getMonomerSymbolsAndTypes();this.monomers=e,this.monomerTypes=s}get id(){return this.polymerType+this.idx.toString()}getPolymerType(){const t=new RegExp("(PEPTIDE|RNA)[0-9]+{"),e=this.simplePolymer.match(t);if(!e)throw new Error(`Unsupported polymer type in ${this.simplePolymer}`);return e[1]}getIdx(){const t=new RegExp(`${this.polymerType}([0-9]+){`),e=this.simplePolymer.match(t);if(!e)throw new Error(`Cannot parse simple polymer id from ${this.simplePolymer}`);return parseInt(e[1])}getMonomerSymbolsAndTypes(){const t=new RegExp(`${this.polymerType}${this.idx}{|}`,"g"),e=this.simplePolymer.replace(t,"").split("."),s=[],n=[];return e.forEach((t=>{const e=t.split(/\(|\)/).map((t=>t.replace(/[\[\]]/g,"")));s.push(...e);const i=e.map(((t,e)=>e%2==0?0:1));n.push(...i)})),{monomers:s,monomerTypes:n}}getBondData(){const t=[],e=this.monomerTypes.map(((t,e)=>{if(0===t)return e})).filter((t=>void 0!==t)),s=this.monomerTypes.map(((t,e)=>{if(1===t)return e})).filter((t=>void 0!==t));for(let s=0;s<e.length-1;s++){const n=e[s],i=e[s+1];t.push([{monomerIdx:n,rGroupId:2},{monomerIdx:i,rGroupId:1}])}for(let e=0;e<s.length;e++){const n=s[e],i=n-1;t.push([{monomerIdx:i,rGroupId:3},{monomerIdx:n,rGroupId:1}])}return t}}class Qt{constructor(t){const e=t.split("|");e.forEach((t=>this.validateConnectionItem(t))),this.connectionItems=e}validateConnectionItem(t){const e="(PEPTIDE|RNA)",s=new RegExp(`${e}[0-9]+,${e}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!t.match(s))throw new Error(`Cannot parse connection item from ${t}`)}getConnectionData(){const t=[];return this.connectionItems.forEach((e=>{const s=[],n=e.split(",");n[2].split("-").forEach(((t,e)=>{const i=n[e],o=t.split(":"),r={monomerIdx:parseInt(o[0])-1,rGroupId:parseInt(o[1].slice(1))};s.push({polymerId:i,bond:r})})),t.push(s)})),t}}class Jt{constructor(t){this.helm=t;const e=this.helm.split("$"),s=e[0].split("|");this.simplePolymers=s.map((t=>new jt(t))),""!==e[1]&&(this.connectionList=new Qt(e[1])),this.bondData=this.getBondData()}toString(){return this.helm}getPolymerTypeByMonomerIdx(t){return this.getSimplePolymerByMonomerIdx(t).polymerType}getSimplePolymerByMonomerIdx(t){const e=this.getMonomerIdxShifts(),s=Object.values(e).sort(((t,e)=>t-e)).find((e=>t>=e));if(void 0===s)throw new Error(`Cannot find simple polymer for monomer ${t}`);const n=Object.keys(e).find((t=>e[t]===s));return this.simplePolymers.find((t=>t.id===n))}shiftBondMonomerIds(t,e){e.forEach((e=>{e.forEach((e=>{e.monomerIdx+=t}))}))}getMonomerIdxShifts(){const t={};let e=0;return this.simplePolymers.forEach((s=>{t[s.id]=e,e+=s.monomers.length})),t}getBondData(){const t=this.getMonomerIdxShifts(),e=[];return this.simplePolymers.forEach((s=>{const n=s.getBondData(),i=t[s.id];this.shiftBondMonomerIds(i,n),e.push(...n)})),this.connectionList&&this.connectionList.getConnectionData().forEach((s=>{const n=[];s.forEach((e=>{const s=t[e.polymerId],i=e.bond;i.monomerIdx+=s,n.push(i)})),e.push(n)})),e}}class te{constructor(t){this.monomerWrappers=[],this.helm=new Jt(t),this.bondedRGroupsMap=new Map,this.helm.bondData.forEach((t=>{t.forEach((t=>{const e=t.monomerIdx,s=t.rGroupId;this.bondedRGroupsMap.get(e)||this.bondedRGroupsMap.set(e,[]),this.bondedRGroupsMap.get(e).push(s)}))}))}addMonomer(t,e,s){const n=this.helm.getPolymerTypeByMonomerIdx(e),i=new Kt(t,n);i.shiftCoordinates(s),this.monomerWrappers.push(i)}removeRGroups(){this.monomerWrappers.forEach(((t,e)=>{this.bondedRGroupsMap.has(e)&&t.removeBondedRGroups(this.bondedRGroupsMap.get(e)),t.capTrailingRGroups()}))}getAtomNumberShifts(){const t=[];let e=0;return this.monomerWrappers.forEach((s=>{t.push(e),e+=s.getAtomLines().length})),t}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((t=>{const e=t.map((t=>t.monomerIdx)),s=t.map((t=>t.rGroupId)),n=e.map((t=>this.monomerWrappers[t])),i=n[1].getAttachmentAtomByRGroupId(s[1]);n[0].replaceRGroupWithAttachmentAtom(s[0],i),n[1].deleteBondLineWithSpecifiedRGroup(s[1])}))}compileToMolfile(){const t=[],e=[];this.removeRGroups();const s=this.getAtomNumberShifts();this.monomerWrappers.forEach(((t,e)=>{t.shiftBonds(s[e])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((s=>{t.push(...s.getAtomLines()),e.push(...s.getBondLines())}));const n=t.length;if(n>999)throw new Error(`Atom count in polymer ${this.helm.toString()} is ${n} and exceeds 999`);const i=e.length;return["\nDatagrok\n",`${n.toString().padStart(3," ")}${i.toString().padStart(3," ")} 0 0 1 0 0 V2000`,t.join("\n"),e.join("\n"),"M END\n"].join("\n")}}a.DataFrame.fromCsv("seq,value\nATCCGTCGT,0.5\nTGTTCGTCA,0.4\nATGGTCGTA,0.7\nATCCGTGCA,0.1"),["1","1A","1C","2","4","4A","4B","5","6"].join(ut.CI);var ee=s(8601),se=s(3277);function ne(t){const e=["Embed_X","Embed_Y"],s=t.columns.names().filter((t=>t.includes(e[0]))).length+1;return e.map((t=>`${t}_${s}`))}const ie=new kt;function oe(){return Gt.NT.instance}function re(){return Gt.NT.instance.getBioLib()}async function ae(t,e,s,n,i,u,d,m){if(!(0,Dt.n)(e,"Activity Cliffs"))return;const p=ne(t),g={units:e.getTag(a.TAGS.UNITS),aligned:e.getTag("aligned"),separator:e.getTag("separator"),alphabet:e.getTag("alphabet")},f=u,y=e,C=async()=>await async function(t,e,s,n,i,l,u,d,m,p,g,f,y,C,T,A){H++;const b=l/100;let w,S=!1;const E=f.inputs,v=await f.apply({[E[0].name]:e,[E[1].name]:u,...m.preprocessingFuncArgs??{}}),L=await F([v.entries],d,[u],[1],"MANHATTAN",{...m,distanceFnArgs:[v.options??{}]});if(L.length!==s.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let e=0;e<L.length;++e)t.columns.addNewFloat(s[e]).init((t=>L[e][t]));const M=(0,x.sQ)(u)?1-(0,h.eo)(b):b,N=await(new _).calc(v.entries,u,M,v.options),I=await async function(t,e){const s=t.distance.map(((s,n)=>{const i=Math.abs(e.get(t.i[n])-e.get(t.j[n]));return 0!=s?i/s:1/0})),n=t.distance.map((t=>1-t)),i=t.i,o=t.j,r=new Set;return t.distance.forEach(((e,s)=>{r.add(t.i[s]),r.add(t.j[s])})),{simVals:n,saliVals:s,n1:i,n2:o,cliffsMolIds:r}}(N,i),O=function(t,e,s,n,i,o){const r=new Array(t).fill(0);for(let t=0;t!=s.length;++t)e[t]!=1/0&&(o.get(s[t])>o.get(n[t])?r[s[t]]+=e[t]:r[n[t]]+=e[t]);return a.Column.fromList("double",`sali_${i[0].substring(i[0].lastIndexOf("_"))}`,r)}(e.length,I.saliVals,I.n1,I.n2,s,i);t.columns.add(O);const G=function(t,e){const s=a.BitSet.create(t.rowCount);for(let n=0;n<t.rowCount;n++)s.set(n,e.has(n));return s}(t,I.cliffsMolIds),K=function(t){const e=t.filter((t=>t!==1/0)),s=e.reduce(((t,e)=>Math.min(t,e)),Number.MAX_VALUE),n=e.reduce(((t,e)=>Math.max(t,e)),s);return{max:n,min:s}}(I.saliVals),Z=.8/(K.max-K.min),q=o.shell.getTableView(t.name),X=q.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:s[0],yColumnName:s[1],size:O.name,color:i.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:n}),z=function(t,e,s,n,i,o,r,l){const c={from:new Uint32Array(e.n1.length),to:new Uint32Array(e.n1.length),opacities:new Float32Array(e.n1.length),colors:new Array(e.n1.length),widths:new Float32Array(e.n1.length)};for(let s=0;s<e.n1.length;s++)c.from[s]=e.n1[s],c.to[s]=e.n2[s],c.opacities[s]=e.saliVals[s]===1/0?1:.2+(e.saliVals[s]-r.min)*l,c.colors[s]=t.selection.get(c.from[s])&&t.selection.get(c.to[s])?"255,255,0":"0,128,0",c.widths[s]=1;const h=a.DataFrame.create(c.from.length);return $.forEach(((t,e)=>{h.columns.addNewString(t).init((t=>s.get(0===e?c.from[t]:c.to[t]))),function(t,e){Object.keys(e).forEach((s=>{t.tags[s]=e[s]}))}(h.col(t),o),h.col(t).semType=i})),h.columns.addNewFloat(B).init((t=>Math.abs(n.get(c.from[t])-n.get(c.to[t])))),h.columns.addNewInt(V).init((t=>t)),h.columns.addNewFloat(k).init((t=>e.saliVals[t])),h.columns.addNewFloat(U).init((t=>e.simVals[t])),h.name=`${W}${H}`,{lines:c,linesDf:h}}(t,I,e,i,p,g,K,Z),j=new R(X,s[0],s[1],z.lines,P.none),Q=T?T(z.linesDf,$).sort([k],[!1]):z.linesDf.plot.grid().sort([k],[!1]);t.temp[".cliffsDfGrid"]=Q;const J=r.button(`${z.linesDf.rowCount} cliffs`,(()=>{q.dockManager.dock(Q,"down",null,"Activity cliffs",A??.2)}));J.classList.add("scatter_plot_link","cliffs_grid"),X.root.append(J);const tt=r.switchInput("Show only cliffs",!1,(()=>{tt.value?(X.dataFrame.setTag(Y,s[0]),t.filter.and(G),D.next(s[0])):(X.dataFrame.setTag(Y,""),t.filter.setAll(!0),D.next(""))}));tt.root.classList.add("scatter_plot_link","show_only_cliffs"),X.root.append(tt.root),D.subscribe((t=>{tt.enabled=""===t||t===s[0]}));let et=!1;X.onEvent("d4-before-draw-scene").subscribe((e=>{et?et=!1:tt.value&&(setTimeout((()=>{t.filter.and(G)}),100),et=!0)}));const st=o.events.onViewerClosed.subscribe((t=>{t.args.viewer===X&&(q.dockManager.close(Q.root),st.unsubscribe(),q.subs=q.subs.filter((t=>t!==st)))}));return q.subs.push(st),z.linesDf.onCurrentCellChanged.subscribe((()=>{for(let t=0;t<z.linesDf.rowCount;t++)z.lines.widths[t]=t===z.linesDf.currentRowIdx?3:1;j.linesToRender=z.lines;const n=z.linesDf.currentCol&&z.linesDf.currentCol.name===$[1]?z.lines.to:z.lines.from,a=-1!==z.linesDf.currentRowIdx?z.linesDf.currentRowIdx:null;if(X.dataFrame.currentRowIdx=a?n[a]:-1,null!==a){const n=z.linesDf.currentRowIdx;j.currentLineId=n;const{zoomLeft:l,zoomRight:c,zoomTop:h,zoomBottom:u}=function(t,e,s,n,i,o){const r=Math.abs(s-i),a=Math.abs(n-o),l=t/r,c=e/a,h=Math.min(l,c),u=t/h*5,d=e/h*5,m=(s<i?s:i)+r/2-u/2,p=(n>o?n:o)-a/2+d/2;return{zoomLeft:m,zoomRight:m+u,zoomTop:p,zoomBottom:p-d}}(X.viewport.width,X.viewport.height,X.dataFrame.get(s[0],z.lines.from[n]),X.dataFrame.get(s[1],z.lines.from[n]),X.dataFrame.get(s[0],z.lines.to[n]),X.dataFrame.get(s[1],z.lines.to[n]));X.zoom(l,h,c,u),tt.value?t.filter.and(G):!0===tt.enabled&&t.filter.setAll(!0),setTimeout((()=>{!function(t,e,s,n,i,a,l,c,h){const u=e.getPane("Cliff Details");r.empty(u.root);const d=h({points:[s,n],lineId:i,df:t,seqCol:a,activityCol:l,sali:c});u.root.append(d),setTimeout((()=>{o.shell.o=e.root}),500)}(t,w,z.lines.from[a],z.lines.to[a],a,e,i,z.linesDf.get(k,a),C);const s=X.dataFrame.getSortedOrder(q.grid.sortByColumns,q.grid.sortTypes);q.grid.scrollToCell(e.name,s.indexOf(X.dataFrame.currentRowIdx))}),1e3)}})),z.linesDf.onSelectionChanged.subscribe((e=>{setTimeout((()=>(()=>{const e=a.BitSet.create(t.rowCount);for(let t=0;t<z.linesDf.rowCount;t++){const s=z.linesDf.selection.get(t);s&&(e.set(z.lines.from[t],!0),e.set(z.lines.to[t],!0)),z.lines.colors[t]=s?"255,255,0":"0,128,0"}t.selection.copyFrom(e),j.linesToRender=z.lines})()),100)})),t.onSelectionChanged.subscribe((e=>{!1===t.selection.anyTrue&&"number"==typeof e&&(S?S=!1:(t=>{t.selection.setAll(!1);for(let t=0;t<z.lines.colors.length;t++)z.lines.colors[t]="0,128,0";j.linesToRender=z.lines})(Q.dataFrame))})),j.lineClicked.subscribe((e=>{if(S=!0,j.currentLineId=e.id,-1!==e.id){const s=z.linesDf.selection.clone();setTimeout((()=>{e.event.ctrlKey?(s.set(e.id,!s.get(e.id)),z.linesDf.selection.copyFrom(s)):(z.linesDf.currentRowIdx!==e.id&&(z.linesDf.currentRowIdx=e.id,t.currentRowIdx=z.lines.from[e.id]),z.linesDf.selection.copyFrom(s));const n=z.linesDf.getSortedOrder(Q.sortByColumns,Q.sortTypes);Q.scrollToCell($[0],n.indexOf(e.id))}),500)}})),j.lineHover.pipe((0,c.debounceTime)(500)).subscribe((s=>{-1!==s.id&&-1===t.mouseOverRowIdx&&r.tooltip.show(y({lineId:s.id,points:[z.lines.from[s.id],z.lines.to[s.id]],df:t,seqCol:e,activityCol:i}),s.x,s.y)})),X.addProperty("similarityLimit","double",b),w=function(){const t=r.accordion(),e=r.element("i");return e.className="grok-icon svg-icon svg-view-layout",t.addTitle(r.span([e,r.label("Activity cliffs")])),t.addPane("Cliff Details",(()=>r.divText("Cliff has not been selected")),!0),o.shell.o=t.root,t}(),X}(t,y,p,"Activity cliffs",s,n,f,i,{...m??{}},a.SEMTYPE.MACROMOLECULE,g,d,Nt,_t,It),T=i===l.A.UMAP?2e5:2e4,A=i===l.A.UMAP?5e3:2e3;if(t.rowCount>T)return void o.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${T}`);const b=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((e,s)=>{t.rowCount>A&&!m?.[se.sS]?r.dialog().add(r.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{C().then((t=>e(t))).catch((t=>s(t)))})).onCancel((()=>{e(void 0)})).show():C().then((t=>e(t))).catch((t=>s(t)))})).catch((t=>{const[e,s]=(0,J.yf)(t);throw ie.logger.error(e,void 0,s),t})).finally((()=>{b.close()}))}async function le(t,e,n,i,l,c,h,u){if((0,Dt.n)(e,"Sequence Space"))return c||(c=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),h??(h={}),await async function(t,e,n,i,l,c,h,u=!0,d=!1,m={preprocessingFuncArgs:[]},p={}){const g={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(e.length!==i.length||e.length!==c.length||e.length!==l.length||e.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const f=async()=>{const f=a.TaskBarProgressIndicator.create(`Initializing ${p.scatterPlotName??"dimensionality reduction"} ...`);let y;try{const C=ne(t);function T(e,s,n){let i=null,l=null;t.columns.names().includes(C[0])?(i=t.columns.byName(C[0]),l=t.columns.byName(C[1])):(i=t.columns.add(a.Column.float(C[0],t.rowCount)),l=t.columns.add(a.Column.float(C[1],t.rowCount)),u&&!y&&(y=o.shell.tableView(t.name).scatterPlot({...g,x:C[0],y:C[1],title:p.scatterPlotName??"Embedding space"}))),p[se.Ec]&&(y?.root&&r.setUpdateIndicator(y.root,!1),i.init((t=>n[0]?n[0][t]:void 0)),l.init((t=>n[1]?n[1][t]:void 0)));const c=e/s*100;f.update(c,`Running ${p.scatterPlotName??"dimensionality reduction"}... ${c.toFixed(0)}%`)}async function A(){t.columns.add(a.Column.float(C[0],t.rowCount)),t.columns.add(a.Column.float(C[1],t.rowCount));let s=null;u&&(y=o.shell.tableView(t.name).scatterPlot({...g,x:C[0],y:C[1],title:p.scatterPlotName??"Embedding space"}),r.setUpdateIndicator(y.root,!0));const d=o.events.onViewerClosed.subscribe((t=>{const e=t.args.viewer;e?.getOptions()?.look?.title&&y?.getOptions()?.look?.title&&e?.getOptions()?.look?.title===y?.getOptions()?.look?.title&&(o.events.fireCustomEvent(O,{}),d.unsubscribe(),s?.(),f.close())})),A=new Promise((async(t,o)=>{try{s=t;const o=[];for(let t=0;t<c.length;++t){const s=c[t];if(m.distanceFnArgs||(m.distanceFnArgs=[]),s){const n=s.inputs[0].name,r=s.inputs[1].name,{entries:a,options:l}=await s.apply({[n]:e[t],[r]:i[t],...m.preprocessingFuncArgs[t]??{}});o.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const s=e[t].toList(),n={};o.push({entries:s,options:n}),m.distanceFnArgs.push(n)}}t(await F(o.map((t=>t.entries)),n,i,l,h,m,p[se.sS]?void 0:T))}catch(t){o(t)}})),b=await A;return f.close(),d.unsubscribe(),b}const b=await A();if(d&&b){const w=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const S=await function(t,e,n,i){return Wt(this,void 0,void 0,(function*(){return new Promise((function(o,r){const a=new Worker(new URL(s.p+s.u(796),s.b));a.postMessage({embedX:t,embedY:e,minPts:i,epsilon:n}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?r(t):o(e)}}))}))}(b[0],b[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),E=t.columns.getUnusedName("Cluster");t.columns.addNewString(E).init((t=>S[t].toString())),y&&(y.props.colorColumnName=E)}catch(v){o.shell.error("Clustering embeddings failed"),console.error(v)}finally{w.close()}}if(b&&u&&y){r.setUpdateIndicator(y.root,!1);const x=t.columns.byName(C[0]),L=t.columns.byName(C[1]);return x.init((t=>b[0][t])),L.init((t=>b[1][t])),y}}catch(M){o.shell.error("Dimensionality reduction failed"),console.error(M),f.close(),y&&r.setUpdateIndicator(y.root,!1)}};return new Promise((async(e,s)=>{try{if(p.fastRowCount&&t.rowCount>p.fastRowCount&&!p[se.sS])r.dialog().add(r.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const t=await f();e(t)}catch(t){s(t)}})).onCancel((()=>e(void 0))).show();else{const t=await f();e(t)}}catch(t){s(t)}}))}(t,[e],n,[i],[1],[c],"MANHATTAN",l,u??!1,{...h,preprocessingFuncArgs:[h.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:h?.[se.sS]})}async function ce(t,e,s){const n=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{await async function(t,e,s){if(0===a.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void o.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(s){const s=Z.Cn.getOrCreate(e);return s.isHelm()||(e=s.convert(ut.r2.HELM)),void async function(t,e){const s=await async function(t,e){const s=new $t(e,t),n=await s.convertToRdKitBeautifiedMolfileColumn();return n.semType=a.SEMTYPE.MOLECULE,n}(t,e);t.columns.add(s,!0),await o.data.detectSemanticTypes(t)}(t,e)}if(!(0,Dt.n)(e,"To Atomic Level"))return;const n=oe().getBioLib(),i=await(0,ee.i0)(t,e,n);null!==i.col&&(t.columns.add(i.col,!0),await o.data.detectSemanticTypes(t)),i.warnings&&i.warnings.length>0&&o.shell.warning(r.list(i.warnings))}(t,e,s)}finally{n.close()}}function he(t){return new q.i(t).importFasta()}function ue(t){const e=Z.Cn.getOrCreate(t).stats;return Object.keys(e.freq)}async function de(t,e,s){return Q(t,e,s,K.IDENTITY)}async function me(t,e,s){return Q(t,e,s,K.SIMILARITY)}},7983:(t,e,s)=>{"use strict";s.d(e,{QF:()=>c,pf:()=>l});var n=s(4469),i=(s(3870),s(976)),o=s(7241),r=(s(4293),s(8467)),a=s(8447);function l(t,e,s){const n=s?function(t,e){const s=`${e}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n=t.charAt(0)===e,i=t.charAt(t.length-1)===e,o=t.replace(new RegExp(`^${s}|${s}$`,"g"),"");return n?i?`${s}${o}${s}`:`${s}${o}${s}|${s}${o}$`:i?`^${o}${s}|${s}${o}${s}`:`^${o}${s}|${s}${o}${s}|${s}${o}$`}(t,s):t,o=i.BitSet.create(e.length);for(let s=0;s<e.length;s++){const i=e.get(s);(i.match(n)||i===t)&&o.set(s,!0,!1)}return o}async function c(t,e){e.version!==e.temp["last-invalidated-version"]&&await async function(t,e){const s=i.TaskBarProgressIndicator.create(`Invalidating molfiles for ${t.name}`);try{await(0,r.gw)(10);const e=new Map,s=await(0,o.D)(t,!0,e);t.temp["monomeric-mols"]=s,t.temp["monomers-dict"]=e,t.temp["last-invalidated-version"]=t.version}finally{s.close()}}(e);const s=i.Column.string("helm",1).init((e=>t));s.semType=i.SEMTYPE.MACROMOLECULE,s.setTag(i.TAGS.UNITS,a.r2.HELM);const l=await(0,o.D)(s,!0,e.temp["monomers-dict"]);return(await n.functions.call("Chem:searchSubstructure",{molStringsColumn:e.temp["monomeric-mols"],molString:l.get(0),molBlockFailover:""})).get(0)}},2568:(t,e,s)=>{"use strict";s.d(e,{l:()=>a,n:()=>r});var n=s(4469),i=s(976),o=s(499);function r(t,e,s=[],i=[],o=!0){const[r,l]=a(t,e,s,i);return o&&!r&&n.shell.warning(l),r}function a(t,e,s=[],r=[]){let a=!0,l="";const c=o.Cn.getOrCreate(t);if(t.semType!==i.SEMTYPE.MACROMOLECULE)n.shell.warning(e+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const t=c.notation;if(s.length>0&&!s.some((e=>t.toUpperCase()==e.toUpperCase())))l=`${e} + ' analysis is allowed for Macromolecules with notation ${0==s.length?"any notation":`notation${s.length>1?"s":""} ${s.map((t=>`"${t}"`)).join(", ")} `}.`,a=!1;else if(!c.isHelm()){const t=c.alphabet;r.length>0&&!r.some((e=>t.toUpperCase()==e.toUpperCase()))&&(l=`${e} + ' analysis is allowed for Macromolecules with alphabet ${0==r.length?"any alphabet":`alphabet${r.length>1?"s":""} ${r.map((t=>`"${t}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}},3553:(t,e,s)=>{"use strict";s.d(e,{Of:()=>o,WY:()=>h,jB:()=>u,mU:()=>a,rs:()=>c});var n,i,o,r=s(8341);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="~activity",t.ACTIVITY_SCALED="activity_scaled",t.ALIGNED_SEQUENCE="~aligned_sequence",t.AMINO_ACID_RESIDUE="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference"}(n||(n={})),function(t){t.AAR="AAR",t.POSITION="Pos",t.SELECTION="selection"}(i||(i={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",t.ACTIVITY="activity",t.ACTIVITY_SCALED="activityScaled"}(o||(o={}));const a="MSA";var l,c;!function(t){t.CELL_CHANGING="isCellChanging"}(l||(l={})),function(t){t.SEPARATOR="."}(c||(c={}));const h="3.3.1",u={pepsea:{gapOpen:1.53,gapExtend:0,method:r.Jy[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},4004:(t,e,s)=>{"use strict";s.d(e,{o:()=>o}),s(976),s(3870);var n=s(4469),i=(s(3336),s(8447),s(499));async function o(t,e,s){const o=i.Cn.getOrCreate(t).convert(e,s);t.dataFrame.columns.add(o);const r=await n.functions.call("Bio:detectMacromolecule",{col:o});return r&&(o.semType=r),await n.data.detectSemanticTypes(t.dataFrame),o}},2918:(t,e,s)=>{"use strict";s.d(e,{NT:()=>y,P4:()=>g});var n=s(4469),i=(s(3870),s(976)),o=s(701),r=s(6584),a=s(922),l=s(1047);class c{constructor(t){this.rawLib=t}isValid(){return this.rawLib.every((t=>"object"==typeof t&&Object.values(l.Wc).every((e=>e in t&&"string"==typeof t[e]))))}getJsonMonomerLib(){const t=[];return this.rawLib.forEach((e=>{const s=this.prepareMonomer(e);t.push(s)})),t}prepareMonomer(t){const e={...l.Z2};Object.entries(l.Wc).forEach((([s,n])=>{const i=t[n];e[s]=i}));let s="smiles";const n=t[l.Wc[s]],i=new h(n),o=i.getCappedSmiles();return e[s]=o,s="rgroups",e[s]=u.getRGroups(i.getNumberOfRGroups()),s="molfile",e[s]=new d(i.getSmilesWithRGroups()).getMolfile(),e}}class h{constructor(t){let e=0;this.smilesWithRGroups=t.replace(/\[R(\d+)\]/g,((t,s)=>(++e,`[${s}*]`))),this.numberOfRGroups=e}getSmilesWithRGroups(){return this.smilesWithRGroups}getCappedSmiles(){return this.capRGroups()}getNumberOfRGroups(){return this.numberOfRGroups}capRGroups(){let t=this.smilesWithRGroups.replace("[1*]","[H:1]");return t=t.replace("[2*]","[OH:2]"),t.replace("[3*]","[H:3]")}}class u{constructor(){}static getRGroups(t){return l.nJ.slice(0,t)}}class d{constructor(t){this.smilesWithRGroups=t}getMolfile(){let t=i.chem.convert(this.smilesWithRGroups,i.chem.Notation.Smiles,i.chem.Notation.MolBlock);return t=this.restoreRGPLine(t),t=this.fixRGroupSymbols(t),t}restoreRGPLine(t){return t.replace("M ISO","M RGP")}fixRGroupSymbols(t){return t.replace(/\bR\b/g,"R#")}}var m=s(7228),p=s(4955);async function g(){return await Promise.all((await n.dapi.files.list(r.BX,!0,"")).map((async t=>t.fullPath.substring(r.BX.length))))}class f{constructor(t,e){this._monomers={},this._onChanged=new o.Subject,this._monomers=t,this.error=e}getMonomer(t,e){return t in this._monomers&&e in this._monomers[t]?this._monomers[t][e]:null}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(t){const e={};return Object.keys(this._monomers[t]??{}).forEach((s=>{e[s]=this._monomers[t][s].molfile})),e}getMonomerSymbolsByType(t){return Object.keys(this._monomers[t])}getMonomerSymbolsByRGroup(t,e,s){let n=this.getMonomerSymbolsByType(e).map((t=>this.getMonomer(e,t)));return n=n.filter((t=>null!==t)),0===n.length?[]:(n=n.filter((e=>{if(!e?.rgroups)return!1;let s=e?.rgroups.length>=t;return a._.getInstance(e.molfile).atomTypes.map(((t,e)=>"R#"===t?e:-1)).filter((t=>-1!==t)),s&&(s=!0),s})),n.map((t=>t?.symbol)))}get onChanged(){return this._onChanged}_updateInt(t){const e=t.getPolymerTypes(),s=this.getPolymerTypes();e.forEach((e=>{s.includes(e)||(this._monomers[e]={}),t.getMonomerSymbolsByType(e).forEach((s=>{this._monomers[e][s]=t.getMonomer(e,s)}))}))}update(t){this._updateInt(t),this._onChanged.next()}updateLibs(t,e=!1){e&&(this._monomers={});for(const e of t)e.error||this._updateInt(e);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}}class y{constructor(){this._monomerLib=new f({}),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}async loadLibraries(t=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{try{const[e,s]=await Promise.all([g(),(0,r.nW)()]),n=e.filter((t=>!s.exclude.includes(t))).filter((t=>!(s.explicit.length>0)||s.explicit.includes(t))),i=await Promise.all(n.map((t=>this.readLibrary(r.BX,t).catch((e=>{const s=`Loading monomers from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new f({},s)})))));this._monomerLib.updateLibs(i,t)}catch(t){const e=`Loading monomer libraries error: ${t instanceof Error?t.message:t.toString()}`;n.shell.warning(e);const s=t instanceof Error?t.stack:void 0;p._package.logger.error(e,void 0,s)}}))}async readLibrary(t,e){let s,o,r=[];const a=new i.FileSource(t);if(e.endsWith(".sdf"))1===i.Func.find({package:"Chem",name:"importSdf"}).length?(s=await a.readAsBytes(e),o=await n.functions.call("Chem:importSdf",{bytes:s}),r=(0,m.Xk)(o[0])):n.shell.warning("Chem package is not installed");else if(e.endsWith(".json")){const t=await a.readAsText(e);r=JSON.parse(t)}else{if(!e.endsWith(".csv"))throw new Error("Monomer library of unknown file format, supported formats: SDF, JSON, CSV");{const t=(l=await a.readCsv(e),Array.from({length:l.rowCount},((t,e)=>l.columns.names().reduce(((t,s)=>(t[s]=l.get(s,e),t)),{})))),s=new c(t);if(!s.isValid())throw new Error("Invalid format of CSV monomer lib");r=s.getJsonMonomerLib()}}var l;const h={},u=[];return r.forEach((t=>{u.includes(t.polymerType)||(h[t.polymerType]={},u.push(t.polymerType)),h[t.polymerType][t.symbol]=t})),new f(h)}async selectSpecifiedLibraries(t){const e=await this.getInvalidFileNames(t);if(e.length>0)throw new Error(`Cannot select libraries ${e}: no such library in the list`);const s=await(0,r.nW)();s.exclude=(await g()).filter((e=>!t.includes(e))),await(0,r.tW)(s)}async getInvalidFileNames(t){const e=await g();return t.filter((t=>!e.includes(t)))}static get instance(){return window.$monomerLibHelper||(window.$monomerLibHelper=new y),window.$monomerLibHelper}}},525:(t,e,s)=>{"use strict";s.d(e,{K:()=>M});var n=s(4469),i=s(976),o=s(3870),r=s(8447),a=s(499),l=s(6098),c=s(8341),h=s(2568),u=s(3553),d=s(4955),m=s(3379),p=s.n(m),g=s(7795),f=s.n(g),y=s(569),C=s.n(y),T=s(3565),A=s.n(T),b=s(9216),w=s.n(b),S=s(4589),E=s.n(S),v=s(9564),x={};x.styleTagTransform=E(),x.setAttributes=A(),x.insert=C().bind(null,"head"),x.domAPI=f(),x.insertStyleElement=w(),p()(v.Z,x),v.Z&&v.Z.locals&&v.Z.locals;class L extends Error{constructor(t,e){super(t,e)}}async function M(t={}){return new Promise((async(e,s)=>{var r,a,l;t.clustersCol??(t.clustersCol=null),t.pepsea??(t.pepsea={}),(r=t.pepsea).method??(r.method=u.jB.pepsea.method),(a=t.pepsea).gapOpen??(a.gapOpen=u.jB.pepsea.gapOpen),(l=t.pepsea).gapExtend??(l.gapExtend=u.jB.pepsea.gapExtend);const h=t.col?.dataFrame??n.shell.t,d=t.col??h.columns.bySemType(i.SEMTYPE.MACROMOLECULE);if(null==d){const t="MSAError: dataset doesn't conain any Macromolecule column";n.shell.warning(t),s(new L(t))}const m=o.choiceInput("Method",t.pepsea.method,c.Jy);m.setTooltip("Alignment method");const p=o.floatInput("Terminal gap",t?.kalign?.terminalGap??null);p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const g=o.p(`Kalign version: ${u.WY}`,"kalign-version"),f=o.floatInput("Gap open",t.pepsea.gapOpen);f.setTooltip("Gap opening penalty at group-to-group alignment");const y=o.floatInput("Gap extend",t.pepsea.gapExtend);y.setTooltip("Gap extension penalty to skip the alignment");const C=o.inputs([f,y,p]),T=o.button("Alignment parameters",(()=>{C.hidden=!C.hidden}),"Adjust alignment parameters such as penalties for opening and extending gaps");T.classList.add("msa-params-button"),C.hidden=!0,T.prepend(o.icons.settings((()=>null)));const A=[m.root.style],b=[p.root.style,g.style];let w;const S=o.columnInput("Sequence",h,d,(async()=>{w=await _(S.value,h,A,b,m,E,f,y,p)}),{filter:t=>t.semType===i.SEMTYPE.MACROMOLECULE});S.setTooltip("Sequences column to use for alignment");const E=o.columnInput("Clusters",h,t.clustersCol);if(E.nullable=!0,S.fireChanged(),t.col)return w=await _(t.col,h,A,b,m,E,f,y,p),void await N(S,h,w,e,s);o.dialog("MSA").add(S).add(E).add(m).add(C).add(T).add(g).onOK((async()=>{await N(S,h,w,e,s)})).show()}))}async function N(t,e,s,o,r){let a=null;const l=i.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(t.fireChanged(),t.value.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===s)throw new Error("Invalid column format");if(a=await s(),null==a)return r("PepSeA container has not started");e.columns.add(a),await n.data.detectSemanticTypes(e),o(a)}catch(t){const e=t instanceof Error?t.message:t.toString();n.shell.error(e),r(t)}finally{l.close()}}async function _(t,e,s,o,m,p,g,f,y){try{if(t.semType!==i.SEMTYPE.MACROMOLECULE)return;const n=e.columns.getUnusedName(`msa(${t.name})`);if((0,h.n)(t,t.name,[r.r2.FASTA,r.r2.SEPARATOR],["DNA","RNA","PT"],!1)){P(s,o,"kalign"),g.value=null,f.value=null,y.value=null;const e=a.Cn.getOrCreate(t),i=e.isFasta()?t:e.convert(r.r2.FASTA);return async()=>await(0,l.U)(i,!1,n,p.value)}if((0,h.n)(t,t.name,[r.r2.HELM],[],!1))return P(s,o,"pepsea"),g.value??(g.value=u.jB.pepsea.gapOpen),f.value??(f.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(t,n,m.value,g.value,f.value,p.value);if((0,h.n)(t,t.name,[r.r2.SEPARATOR],["UN"],!1)){const e=a.Cn.getOrCreate(t).convert(r.r2.HELM);return P(s,o,"pepsea"),g.value??(g.value=u.jB.pepsea.gapOpen),f.value??(f.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(e,n,m.value,g.value,f.value,p.value)}return g.value=null,f.value=null,y.value=null,void P(s,o,"kalign")}catch(t){const e=t instanceof Error?t.message:t.toString();n.shell.error(e),d._package.logger.error(e)}}function P(t,e,s){if("kalign"===s){for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}else{for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}}},6098:(t,e,s)=>{"use strict";s.d(e,{U:()=>O});var n=s(976),i=s(5226);const o=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.thrown"),c=t=>"object"==typeof t&&null!==t||"function"==typeof t,h=new Map([["proxy",{canHandle:t=>c(t)&&t[o],serialize(t){const{port1:e,port2:s}=new MessageChannel;return u(t,e),[s,[s]]},deserialize:t=>(t.start(),m(t))}],["throw",{canHandle:t=>c(t)&&l in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}}]]);function u(t,e=self){e.addEventListener("message",(function s(n){if(!n||!n.data)return;const{id:i,type:r,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(A);let h;try{const e=a.slice(0,-1).reduce(((t,e)=>t[e]),t),s=a.reduce(((t,e)=>t[e]),t);switch(r){case"GET":h=s;break;case"SET":e[a.slice(-1)[0]]=A(n.data.value),h=!0;break;case"APPLY":h=s.apply(e,c);break;case"CONSTRUCT":h=function(t){return Object.assign(t,{[o]:!0})}(new s(...c));break;case"ENDPOINT":{const{port1:e,port2:s}=new MessageChannel;u(t,s),h=function(t,e){return C.set(t,e),t}(e,[e])}break;case"RELEASE":h=void 0;break;default:return}}catch(t){h={value:t,[l]:0}}Promise.resolve(h).catch((t=>({value:t,[l]:0}))).then((t=>{const[n,o]=T(t);e.postMessage(Object.assign(Object.assign({},n),{id:i}),o),"RELEASE"===r&&(e.removeEventListener("message",s),d(e))}))})),e.start&&e.start()}function d(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function m(t,e){return g(t,[],e)}function p(t){if(t)throw new Error("Proxy has been released and is not useable")}function g(t,e=[],s=function(){}){let n=!1;const i=new Proxy(s,{get(s,o){if(p(n),o===a)return()=>b(t,{type:"RELEASE",path:e.map((t=>t.toString()))}).then((()=>{d(t),n=!0}));if("then"===o){if(0===e.length)return{then:()=>i};const s=b(t,{type:"GET",path:e.map((t=>t.toString()))}).then(A);return s.then.bind(s)}return g(t,[...e,o])},set(s,i,o){p(n);const[r,a]=T(o);return b(t,{type:"SET",path:[...e,i].map((t=>t.toString())),value:r},a).then(A)},apply(s,i,o){p(n);const a=e[e.length-1];if(a===r)return b(t,{type:"ENDPOINT"}).then(A);if("bind"===a)return g(t,e.slice(0,-1));const[l,c]=y(o);return b(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:l},c).then(A)},construct(s,i){p(n);const[o,r]=y(i);return b(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:o},r).then(A)}});return i}function f(t){return Array.prototype.concat.apply([],t)}function y(t){const e=t.map(T);return[e.map((t=>t[0])),f(e.map((t=>t[1])))]}const C=new WeakMap;function T(t){for(const[e,s]of h)if(s.canHandle(t)){const[n,i]=s.serialize(t);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:t},C.get(t)||[]]}function A(t){switch(t.type){case"HANDLER":return h.get(t.name).deserialize(t.value);case"RAW":return t.value}}function b(t,e,s){return new Promise((n=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(s){!s.data||!s.data.id||s.data.id!==i||(t.removeEventListener("message",e),n(s.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),s)}))}const w="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksdT0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgYz1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxoKT0+ZFtoXSxlKSxmPW4ucmVkdWNlKChkLGgpPT5kW2hdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjpjW24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkoYyx1KTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4udSk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOmh9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUsaCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaChjKXtsPXt2YWx1ZTpjLFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2goYz0+KHt2YWx1ZTpjLFt5XTowfSkpLnRoZW4oYz0+e2NvbnN0W2YsZF09UyhjKTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLEYocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBGKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBwKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYocChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKHU9PnUudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57RihlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCB1PWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiB1LnRoZW4uYmluZCh1KX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbix1KXtwKHMpO2NvbnN0W2wsY109Uyh1KTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sYykudGhlbihtKX0sYXBwbHkoYSxuLHUpe3Aocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W2MsZl09TSh1KTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDpjfSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtwKHMpO2NvbnN0W3UsbF09TShuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAoYz0+Yy50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6dX0sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIE0oZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLHg9ImVhZ2VyIixrPSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgdT1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHt1fWApLHQuZnMuc3ltbGluayh1LGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIHU7bGV0IG49aTtyZXR1cm4oKHU9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOnUuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09ayYmKHMubG9hZGluZz14LGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtpZih0LmNvbmZpZy5wcmludEludGVybGVhdmVkJiYobz1zLnN0ZG91dCkscy5yZWluaXQ9PT0hMCl7Y29uc3QgYT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocyxzLmNvbmZpZykscy5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxzLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoYSl9cmV0dXJuIG99LGNhdChlKXtyZXR1cm4gdC5fZmlsZW9wKCJjYXQiLGUpfSxscyhlKXtyZXR1cm4gdC5fZmlsZW9wKCJscyIsZSl9LGRvd25sb2FkKGUpe3JldHVybiB0Ll9maWxlb3AoImRvd25sb2FkIixlKX0scHdkKCl7cmV0dXJuIHQuZnMuY3dkKCl9LGNkKGUpe2ZvcihsZXQgciBvZiB0LnRvb2xzKSFyLm1vZHVsZXx8ci5tb2R1bGUuRlMuY2hkaXIoZSl9LG1rZGlyKGUpe3JldHVybiB0LmZzLm1rZGlyKGUpLCEwfSxyZWFkKHtwYXRoOmUsbGVuZ3RoOnIsZmxhZzppPSJyIixvZmZzZXQ6cz0wLHBvc2l0aW9uOm89MH0pe2NvbnN0IGE9dC5mcy5vcGVuKGUsaSksbj1uZXcgVWludDhBcnJheShyKTtyZXR1cm4gdC5mcy5yZWFkKGEsbixzLHIsbyksdC5mcy5jbG9zZShhKSxufSx3cml0ZSh7cGF0aDplLGJ1ZmZlcjpyLGZsYWc6aT0idysiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKTt0LmZzLndyaXRlKGEscixzLHIubGVuZ3RoLG8pLHQuZnMuY2xvc2UoYSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz14KSxlLmxvYWRpbmc9PT1rKXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+ZS5zdGRvdXQrPWAke2l9CmAscHJpbnRFcnI6dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD9pPT5lLnN0ZG91dCs9YCR7aX0KYDppPT5lLnN0ZGVycis9YCR7aX0KYH0pO2NvbnN0IHI9ZS5tb2R1bGUuRlM7ZS5pc0Jhc2VNb2R1bGU/KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBiYXNlIG1vZHVsZSBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWAsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJNb3VudGVkfWAsNTExKSxyLmNoZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWApLHQuZnM9cik6KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQpLHIubW91bnQoZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDp0LmNvbmZpZy5kaXJTaGFyZWQsZnM6dC5mc30sdC5jb25maWcuZGlyU2hhcmVkKSxyLmNoZGlyKHQuZnMuY3dkKCkpKSxlLnN0ZG91dD0iIixlLnN0ZGVycj0iIixlLnJlYWR5PSEwfSxhc3luYyBfc2V0dXBGUygpe2NvbnN0IGU9dC5mcztmb3IobGV0IHIgb2YgdC50b29scyl7aWYoIXIucmVhZHkpY29udGludWU7Y29uc3QgaT1yLm1vZHVsZS5GUyxzPWAvJHtyLnRvb2x9YCxvPWAke3QuY29uZmlnLmRpclNoYXJlZH0ke3N9YDshaS5hbmFseXplUGF0aChzKS5leGlzdHN8fGUuYW5hbHl6ZVBhdGgobykuZXhpc3RzfHwodC5fbG9nKGBNb3VudGluZyAke3N9IG9udG8gJHt0LmJhc2UudG9vbH0gZmlsZXN5c3RlbSBhdCAke299YCksZS5ta2RpcihvKSxlLm1vdW50KHQuYmFzZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDpzLGZzOml9LG8pKX19LF9maWxlb3AoZSxyKXt0Ll9sb2coYFJ1bm5pbmcgJHtlfSAke3J9YCk7Y29uc3QgaT10LmZzLmFuYWx5emVQYXRoKHIpO2lmKCFpLmV4aXN0cylyZXR1cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",S=typeof window<"u"&&window.Blob&&new Blob([atob(w)],{type:"text/javascript;charset=utf-8"});function E(){const t=S&&(window.URL||window.webkitURL).createObjectURL(S);try{return t?new Worker(t):new Worker("data:application/javascript;base64,"+w)}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}const v={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,callback:null,debug:!1,env:"prd"};class x{constructor(t,e={}){if(null==t)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(t)||(t=[t]),e=Object.assign({},v,e),t=t.map(this._parseTool),"stg"===e.env&&(e.urlCDN=e.urlCDNStg),this.tools=t,this.config=e,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const t=new E;this.callback&&(t.onmessage=t=>{"biowasm"===t.data.type&&this.callback(t.data.value)});const e=m(t);return e.tools=this.tools,e.config=this.config,await e.init(),e}_parseTool(t){if("string"!=typeof t)return t;const e=t.split("/");if(2!=e.length&&3!=e.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:e[0],program:3==e.length?e[1]:e[0],version:e[e.length-1]}}}var L=s(850);class M{static getAvailableScales(){return Object.entries(this.scales).map((([t,e])=>t))}static getScale(t){return(0,L.hu)(!(void 0===this.scales[t]),`Scale '${t}' was not found.`),this.scales[t]}}M.scales={WimleyWhite:{"-":0,A:.17,C:-.24,D:-.07,E:-.01,F:-1.13,G:.01,H:.17,I:-.31,K:.99,L:-.56,M:-.23,N:.42,P:.45,Q:.58,R:.81,S:.13,T:.14,V:.07,W:-1.85,Y:-.94},categorial:{"-":0,A:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,K:9,L:10,M:11,N:12,P:13,Q:14,R:15,S:16,T:17,V:18,W:19,Y:20}};class N{constructor(t="categorial"){this.aa2num=M.getScale(t),this.num2aa={},Object.entries(this.aa2num).forEach((([t,e])=>this.num2aa[e]=t))}static _truncateSequence(t){let e=0,s=t.length;const n=["NH2","COOH"];if(t.startsWith(n[0])){const s=n[0].length;(0,L.hu)("-"==t[s],`Wrong sequence format: ${n[0]} without following '-' in '${t}'.`),e=s}if(t.endsWith(n[1])){const e=n[1].length+1;(0,L.hu)("-"==t[s-e],`Wrong sequence format: ${n[1]} without '-' precending in '${t}'.`),s-=e}return t.substring(e,s)}static _dropDefises(t){return t.replace(/(-)([^-]+)/g,"$2")}static clean(t){return N._dropDefises(N._truncateSequence(t))}encode(t){const e=t.length,s=new Array(e).fill(0);for(let n=0;n<e;++n){const e=t[n];(0,L.hu)(e in this.aa2num,`Unknown char '${e}' found in sequence '${t}'`),s[n]=this.encodeLettter(e)}return s}encodeLettter(t){return this.aa2num[t]}decode(t){let e="";for(let s=0;s<t.length;++s){const n=t[s];(0,L.hu)(n in this.num2aa,`Unknown code '${n}' found in vector '${t}'`),e+=this.num2aa[n]}return e}}var _=s(3553);const P="input.fa",I="result.fasta";function R(t){return t.reduce(((t,e,s)=>t+`>sample${s+1}\n${e}\n`),"")}async function O(t,e=!1,s="",o=null,r,a,l){let c=t.toList();e&&(c=c.map((t=>N.clean(t).replace(/\-/g,""))));const h=t.length;o??(o=n.Column.string("Clusters",h).init("0")),o.type!=n.COLUMN_TYPE.STRING&&(o=o.convertTo(n.TYPE.STRING)),o.compact();const u=o.categories,d=o.getRawData(),m=new Array(u.length),p=new Array(u.length);for(let t=0;t<h;++t){const e=d[t];(m[e]??(m[e]=[])).push(c[t]),(p[e]??(p[e]=[])).push(t)}const g=await new x(["base/1.0.0",{tool:"kalign",version:_.WY,reinit:!0}]),f=n.Column.string(s,h);for(let t=0;t<u.length;++t){const e=R(m[t]);await g.fs.writeFile(P,e);const s=`${void 0!==r?` --gpo ${r}`:""}${void 0!==a?` --gpe ${a}`:""}${void 0!==l?` --tgpe ${l}`:""}`,n=await g.exec(`kalign ${P} -f fasta -o ${I}${s}`);console.warn(n);const o=await g.cat(I);if(!o)throw new Error("kalign output no result");const c=new i.i(o).sequencesArray,h=p[t];for(let t=0;t<c.length;++t)f.set(h[t],c[t])}const y=t.getTag(n.TAGS.UNITS),C=t.getTag("alphabet");return f.setTag(n.TAGS.UNITS,y),f.setTag("aligned","SEQ.MSA"),f.setTag("alphabet",C),f.semType=n.SEMTYPE.MACROMOLECULE,f}},8341:(t,e,s)=>{"use strict";s.d(e,{Jy:()=>l,f3:()=>h});var n=s(4469),i=s(976),o=s(8447),r=s(3553);const a=new class{constructor(){this.dcName="bio"}async getDockerContainer(){return await n.dapi.docker.dockerContainers.filter(this.dcName).first()}},l=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],c=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(t,e,s="ginsi",l=1.53,h=0,d=null){const m=await a.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)return n.log.warning("PepSeA container has not started yet"),null;const p=t.length;d??(d=i.Column.int("Clusters",p).init(0)),d.type!=i.COLUMN_TYPE.STRING&&(d=d.convertTo(i.TYPE.STRING));const g=d.categories,f=new Array(g.length);for(let e=0;e<p;++e){const s=d.get(e);if(""===s)continue;const n=g.indexOf(s),i=t.get(e);i&&(f[n]??(f[n]=[])).push({ID:e.toString(),HELM:i})}const y=new Array(p);for(const t of f){const e=(await u(m.id,t,s,l,h)).Alignment;for(const t of e)y[parseInt(t.ID)]=Object.entries(t).filter((t=>!c.includes(t[0]))).map((t=>"-"!==t[1]?t[1]:"")).join(r.rs.SEPARATOR)}const C=i.Column.fromStrings(e,y);return C.setTag(i.TAGS.UNITS,o.r2.SEPARATOR),C.setTag("separator",r.rs.SEPARATOR),C.setTag("aligned","SEQ.MSA"),C.setTag("alphabet","UN"),C.setTag(".alphabetIsMultichar","true"),C.semType=i.SEMTYPE.MACROMOLECULE,C}async function u(t,e,s,i,o){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)},a=`/align?method=${s}&gap_open=${i}&gap_extend=${o}`,l=await n.dapi.docker.dockerContainers.request(t,a,r);return JSON.parse(l??"{}")}},9943:(t,e,s)=>{"use strict";s.d(e,{i$:()=>a,sK:()=>l}),s(976),s(3870),s(4469);var n=s(6414),i=s.n(n),o=s(8447);s(499);const r=60;function a(t,e,s=r,n="\n"){const i=o.kB,a=[];for(let o=0;o<e.length;o++){const r=t.map((t=>t.get(o).toString())).join("|"),c=l(e.get(o),i,s);a.push(`>${r}${n}`);for(const t of c)a.push(`${t}${n}`)}return"".concat(...a)}function l(t,e,s=r){const n=e(t);let o=0;const a=n.length,l=[];for(;o<a;){const t=i()(n).slice(o,o+s).toArray(),e=t.map((t=>t.length>1?`[${t}]`:t)).join("");l.push(e),o+=t.length}return l}},9416:(t,e,s)=>{"use strict";s.d(e,{n:()=>c});var n=s(4469),i=s(976),o=s(8467),r=s(2568),a=s(8457),l=s(3553);async function c(t,e){if(await(0,o.gw)(10),!(0,r.n)(e,"Sequence space"))return t;const s=(0,a.O)(e);s.name="splitToMonomers";const c=e.dataFrame;for(const t of s.columns)t.semType=l.Of.MONOMER,t.setTag("alphabet",e.getTag("alphabet"));const h=/(\d+)(?: \((\d+)\))?/,u=t=>{h.lastIndex=0;const e=t.match(h);return e?`${e[1]} (${parseInt(e[2]??0)+1})`:t};for(let t=0;t<s.columns.length;t++){const n=s.columns.byIndex(t);n.semType=l.Of.MONOMER,n.setTag("alphabet",e.getTag("alphabet"));const i=100;let o=0;for(;c.columns.byName(n.name)&&o<i;)n.name=u(n.name),o++;c.columns.add(n)}await n.data.detectSemanticTypes(c);for(let t=0;t<s.columns.length;t++){const e=s.columns.byIndex(t);e.setTag(i.TAGS.CELL_RENDERER,"Monomer"),e.setTag(".use-as-filter","false")}return c}},4293:(t,e,s)=>{"use strict";function n(t,e){t.innerHTML="",t.append(e)}s.d(e,{Y:()=>n}),s(4469),s(976)},8415:(t,e,s)=>{"use strict";s.d(e,{bo:()=>T,CK:()=>S,yW:()=>w,eZ:()=>M});var n=s(4469),i=s(3870),o=s(976),r=s(3336),a=s.n(r),l=s(6414),c=s.n(l),h=s(701),u=s(499),d=s(8447),m=s(9298);function p(t){var e;return"string"==typeof t||t instanceof String?t:("object"==typeof t||t instanceof Object)&&"$thrownJsError"in t?p(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}var g=s(7945),f=s(8467),y=s(172);var C,T,A=s(8770),b=s(4955);HTMLCanvasElement.prototype.getCursorPosition=function(t,e){const s=this.getBoundingClientRect();return new o.Point((t.clientX-s.left)*e,(t.clientY-s.top)*e)},o.Rect.prototype.contains=function(t,e){return this.left<=t&&t<=this.right&&this.top<=e&&e<=this.bottom};class w{constructor(t=0,e){this.valueList=null,this.valueIdx=0,this.value=this.rowCount=t,this.bounds=e}push(t){this.valueList||(this.valueList=new Array(this.rowCount),this.valueIdx=0),this.valueList[this.valueIdx]=t,++this.valueIdx}aggregate(t){this.value=t(this.valueList)??0,this.valueList=null}}class S{get label(){return this._label?this._label:this.name}constructor(t,e,s,n){this.sumRowCount=0,this.pos=t,this.name=e,this._freqs=s??{},n?.sumRowCount&&(this.sumRowCount=n.sumRowCount),n?.sumValueForHeight&&(this.sumPlotValue=n.sumValueForHeight),n?.label&&(this._label=n.label)}getMonomers(){return Object.keys(this._freqs)}hasMonomer(t){return t in this._freqs}getFreq(t){let e=this._freqs[t];return e||(e=this._freqs[t]=new w),e}aggregate(t){const e=function(t){return e=>{const s=function(t){let e;const s="agg";return e=t instanceof Float32Array?o.Column.fromFloat32Array(s,t):t instanceof Int32Array?o.Column.fromInt32Array(s,t):o.Column.fromList(o.COLUMN_TYPE.FLOAT,s,t),e}(e);return s.aggregate(t)}}(t);for(const[t,s]of Object.entries(this._freqs))s.aggregate(e)}getMinValue(){return Math.min(...Object.values(this._freqs).map((t=>t.value)))}calcPlotValue(t){for(const e of Object.values(this._freqs))e.plotValue=e.value-t}calcHeights(t){this.sumPlotValue=0;for(const t of Object.values(this._freqs))this.sumPlotValue+=t.plotValue;if(this.sumPlotValueForHeight=0,t===m.ES.Entropy){const t=Object.keys(this._freqs).length,e=.01*this.sumPlotValue,s=e/t;for(const t of Object.values(this._freqs)){const n=(t.plotValue+s)/(this.sumPlotValue+e);this.sumPlotValueForHeight+=-n*Math.log2(n)}}else if(t===m.ES.full)for(const[t,e]of Object.entries(this._freqs)){const t=e.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=t}}calcScreen(t,e,s,n,i,r,a,l,c,h){const u=i===m.ES.Entropy?n*(r-this.sumPlotValueForHeight)/r:n;let d=h*c+(n-u-1);const p=Object.entries(this._freqs).sort(((e,s)=>t(e[0])||t(s[0])?t(e[0])&&t(s[0])?0:t(e[0])?-1:1:s[1].value-e[1].value));for(const[t,n]of p){const t=u*n.plotValue/this.sumPlotValue;n.bounds=new o.Rect((e-s)*c*a,d,l*c,t),d+=t}}render(t,e,s,n,i,o){for(const[r,a]of Object.entries(this._freqs))if(!e(r)){const e=(0,d.GU)(r,5),l=a.bounds,c=l.left;t.resetTransform(),t.strokeStyle="lightgray",t.lineWidth=1,t.rect(c,l.top,l.width,l.height),t.fillStyle=o.get(r)??o.get("other"),t.textAlign="left",t.font=s;const h=t.measureText(e);t.setTransform(l.width/h.width,0,0,l.height/i,c,l.top),t.fillText(e,0,-n)}}getMonomerAt(t,e){const s=Object.entries(this._freqs).find((([s,n])=>n.bounds.contains(t,e)));return s?s[0]:void 0}buildCompositionTable(t){return(0,A._)(t,Object.assign({},...Object.entries(this._freqs).map((([t,e])=>({[t]:e.rowCount})))))}}!function(t){t.STYLE="Style",t.BEHAVIOR="Behavior",t.LAYOUT="Layout",t.DATA="Data"}(C||(C={})),function(t){t.sequenceColumnName="sequenceColumnName",t.valueAggrType="valueAggrType",t.valueColumnName="valueColumnName",t.startPositionName="startPositionName",t.endPositionName="endPositionName",t.skipEmptySequences="skipEmptySequences",t.skipEmptyPositions="skipEmptyPositions",t.shrinkEmptyTail="shrinkEmptyTail",t.backgroundColor="backgroundColor",t.positionHeight="positionHeight",t.positionWidth="positionWidth",t.verticalAlignment="verticalAlignment",t.horizontalAlignment="horizontalAlignment",t.fixWidth="fixWidth",t.fitArea="fitArea",t.minHeight="minHeight",t.maxHeight="maxHeight",t.showPositionLabels="showPositionLabels",t.positionMarginState="positionMarginState",t.positionMargin="positionMargin",t.filterSource="filterSource"}(T||(T={}));const E=m.vS;var v;!function(t){t[t.None=0]="None",t[t.Render=1]="Render",t[t.Layout=1]="Layout",t[t.Freqs=2]="Freqs"}(v||(v={}));const x=new class{constructor(){this.render=20}};class L extends o.JsViewer{get positionWidthWithMargin(){return this._positionWidthWithMargin}get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionMarginValue(){return this.positionMarginState===m.dE.AUTO&&!0===this.unitsHandler.getAlphabetIsMultichar()||this.positionMarginState===m.dE.ON?this.positionMargin:0}constructor(){super(),this.viewed=!1,this.initialized=!1,this.palette=null,this.seqCol=null,this.positions=[],this.visibleSlider=!1,this.allowResize=!0,this.turnOfResizeForOneSetValue=!1,this.backgroundColor=4294967295,this.positionMargin=0,this.positionNames=[],this.positionLabels=void 0,this.startPosition=-1,this.endPosition=-1,this.error=null,this.viewerId=++L.viewerCounter,this.setDataInProgress=!1,this.viewSubs=[],this._onSizeChanged=new h.Subject,this._onFreqsCalculated=new h.Subject,this._onLayoutCalculated=new h.Subject,this.requestedRenderLevel=v.Freqs,this.renderRequest=new h.Subject,this._onRendered=new h.Subject,this.textBaseline="top",this.unitsHandler=null,this.sequenceColumnName=this.string(T.sequenceColumnName,E.sequenceColumnName,{category:C.DATA});const t=[o.AGG.KEY,o.AGG.PIVOT,o.AGG.MISSING_VALUE_COUNT,o.AGG.SKEW,o.AGG.KURT,o.AGG.SELECTED_ROWS_COUNT],e=Object.values(o.AGG).filter((e=>!t.includes(e)));this.valueAggrType=this.string(T.valueAggrType,E.valueAggrType,{category:C.DATA,choices:e}),this.valueColumnName=this.string(T.valueColumnName,E.valueColumnName,{category:C.DATA}),this.startPositionName=this.string(T.startPositionName,E.startPositionName,{category:C.DATA}),this.endPositionName=this.string(T.endPositionName,E.endPositionName,{category:C.DATA}),this.skipEmptySequences=this.bool(T.skipEmptySequences,E.skipEmptySequences,{category:C.DATA}),this.skipEmptyPositions=this.bool(T.skipEmptyPositions,E.skipEmptyPositions,{category:C.DATA}),this.shrinkEmptyTail=this.bool(T.shrinkEmptyTail,E.shrinkEmptyTail,{category:C.DATA}),this.backgroundColor=this.int(T.backgroundColor,E.backgroundColor,{category:C.STYLE}),this.positionHeight=this.string(T.positionHeight,E.positionHeight,{category:C.STYLE,choices:Object.values(m.ES)}),this._positionWidth=this.positionWidth=this.float(T.positionWidth,E.positionWidth,{category:C.STYLE}),this.verticalAlignment=this.string(T.verticalAlignment,E.verticalAlignment,{category:C.LAYOUT,choices:Object.values(m.vw)}),this.horizontalAlignment=this.string(T.horizontalAlignment,E.horizontalAlignment,{category:C.LAYOUT,choices:Object.values(m.iD)}),this.fixWidth=this.bool(T.fixWidth,E.fixWidth,{category:C.LAYOUT,userEditable:!1}),this.fitArea=this.bool(T.fitArea,E.fitArea,{category:C.LAYOUT}),this.minHeight=this.float(T.minHeight,E.minHeight,{category:C.LAYOUT}),this.maxHeight=this.float(T.maxHeight,E.maxHeight,{category:C.LAYOUT}),this.showPositionLabels=this.bool(T.showPositionLabels,E.showPositionLabels,{category:C.LAYOUT}),this.positionMarginState=this.string(T.positionMarginState,E.positionMarginState,{category:C.LAYOUT,choices:Object.values(m.dE)});let s=0;"auto"===this.positionMarginState&&(s=4),this.positionMargin=this.int(T.positionMargin,s,{category:C.LAYOUT,min:0,max:16}),this.filterSource=this.string(T.filterSource,E.filterSource,{category:C.BEHAVIOR,choices:Object.values(m.Ct)}),this.slider=i.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=i.canvas(),this.canvas.classList.value="bio-wl-canvas",this.canvas.style.width="100%",this.viewSyncer=new y.c(b._package.logger)}viewerToLog(){return`WebLogoViewer<${this.viewerId}>`}setData(){const t=`${this.viewerToLog()}.setData()`;b._package.logger.debug(`${t}, in`),this.viewSyncer.sync(`${t}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(this.renderRequestSub.unsubscribe(),await this.destroyView(),this.viewed=!1),this.updateSeqCol(),this.updateEditors(),this.viewed||(await this.buildView(),this.viewed=!0)}finally{this.setDataInProgress=!1}}})),b._package.logger.debug(`${t}, out`)}async destroyView(){for(const t of this.viewSubs)t.unsubscribe();this.viewSubs=[];const t=this.dataFrame?"data":"null";b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView( dataFrame = ${t} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView() end`)}async buildView(){const t=this.dataFrame?"data":"null";b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView( dataFrame = ${t} ) start`),window.devicePixelRatio,this.viewSubs.push(o.debounce(this.renderRequest,x.render).subscribe(this.renderRequestOnDebounce.bind(this))),this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=i.div("No message",{classes:"bio-wl-msg"}),this.msgHost.style.display="none",this.canvas=i.canvas(),this.canvas.style.width="100%",this.slider.root.style.position="absolute",this.slider.root.style.zIndex="999",this.slider.root.style.display="none",this.slider.root.style.height="0.7em",this.visibleSlider=!1,this.host=i.div([this.msgHost,this.canvas],{classes:"bio-wl-host",style:{display:"flex",flexDirection:"row",flexWrap:"wrap"}}),this.root.append(this.host),this.root.append(this.slider.root),this.error&&(this.msgHost.innerText=this.error.message,i.tooltip.bind(this.msgHost,this.error.stack),this.msgHost.style.setProperty("display",null)),this.dataFrame&&(this.viewSubs.push(this.dataFrame.filter.onChanged.subscribe(this.dataFrameFilterOnChanged.bind(this))),this.viewSubs.push(this.dataFrame.selection.onChanged.subscribe(this.dataFrameSelectionOnChanged.bind(this)))),this.viewSubs.push(i.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.viewSubs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(v.Freqs,"buildView"),b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView() end`)}rootOnSizeChanged(){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.rootOnSizeChanged(), start `),this.render(v.Layout,"rootOnSizeChanged")}updateEditors(){this.props.getProperty(T.valueColumnName).choices=c()(this.dataFrame.columns.numerical).map((t=>t.name)).toArray()}updateSeqCol(){if(this.dataFrame&&(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,d.up)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol)){try{this.unitsHandler=u.Cn.getOrCreate(this.seqCol),this.palette=(0,d.dQ)(this.seqCol),this.render(v.Freqs,"updateSeqCol()"),this.error=null}catch(t){throw this.seqCol=null,this.error=t instanceof Error?t:new Error(t.toString()),t}this.seqCol||(this.unitsHandler=null,this.positionNames=[],this.positionLabels=[],this.startPosition=-1,this.endPosition=-1,this.palette=null)}}getFilter(){let t;switch(this.filterSource){case m.Ct.Filtered:t=this.dataFrame.filter;break;case m.Ct.Selected:t=0===this.dataFrame.selection.trueCount?this.dataFrame.filter:this.dataFrame.selection}return t}setSliderVisibility(t){t?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}calcLayout(t){this.host&&this.canvas&&this.slider&&(this.host.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this.canvas.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this._positionWidth=this.positionWidth,this._positionMargin=this.positionMargin,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue,this.fixWidth?this.calcLayoutFixWidth(t):this.fitArea?this.calcLayoutFitArea(t):this.calcLayoutNoFitArea(t),this.slider.root.style.width=`${this.host.clientWidth}px`)}calcLayoutFixWidth(t){if(!this.host||!this.canvas||!this.slider)return;this.host.classList.add("bio-wl-fixWidth"),this.canvas.classList.add("bio-wl-fitArea");const e=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight);this.host.style.justifyContent=m.iD.LEFT,this.host.style.removeProperty("margin-left"),this.host.style.removeProperty("margin-top"),this.host.style.width=this.canvas.style.width=`${e}px`,this.host.style.height=this.canvas.style.height=`${s}px`,this.host.style.left=this.canvas.style.left="0",this.host.style.top=this.canvas.style.top="0",this.host.style.setProperty("overflow","hidden","important"),this.slider.root.style.display="none",this.slider.setValues(0,Math.max(0,this.Length-1),0,Math.max(0,this.Length-1)),this.canvas.width=e*t,this.canvas.height=s*t}calcLayoutNoFitArea(t){if(!this.host||!this.canvas||!this.slider)return;const e=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=Math.min(this.root.clientWidth,e);this.canvas.style.width=`${n}px`,this.canvas.style.height=`${s}px`,this.host.style.width=`${n}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${n+6}px`),this.host.style.width=`${this.host}px`;const i=e>n;if(this.setSliderVisibility(i),i){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let t=Math.min(Math.max(0,this.slider.min),this.Length-.001),e=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;e=Math.min(Math.max(t,0)+s,this.Length-.001),t=Math.max(0,Math.min(e,this.Length-.001)-s),this.slider.setValues(0,Math.max(this.Length-.001),t,e)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=n*t,this.canvas.height=s*t}calcLayoutFitArea(t){if(!this.host||!this.canvas||!this.slider)return;const e=this._positionWidth*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=e>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/e:0,i=this.root.clientHeight/s,o=Math.max(1,Math.min(n,i));this._positionWidth=this.positionWidth*o,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const r=(this._positionWidth+this.positionMarginValue)*this.Length,a=o*s,l=Math.min(this.root.clientWidth,r);this.canvas.style.width=`${l}px`,this.canvas.style.height=`${a}px`,this.host.style.width=`${l}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${l+6}px`),this.host.style.width=`${this.host}px`;const c=r>l;if(this.setSliderVisibility(c),c){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let t=Math.min(Math.max(0,this.slider.min),this.Length-.001),e=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;e=Math.min(Math.max(t,0)+s,this.Length-.001),t=Math.max(0,Math.min(e,this.Length-.001)-s),this.slider.setValues(0,Math.max(0,this.Length-.001),t,e)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=l*t,this.canvas.height=a*t}onPropertyChanged(t){switch(super.onPropertyChanged(t),t.name){case T.sequenceColumnName:this.updateSeqCol();break;case T.sequenceColumnName:case T.startPositionName:case T.endPositionName:case T.filterSource:case T.shrinkEmptyTail:case T.skipEmptyPositions:case T.positionHeight:case T.valueColumnName:case T.valueAggrType:this.render(v.Freqs,`onPropertyChanged( ${t.name} )`);break;case T.minHeight:case T.maxHeight:case T.positionWidth:case T.showPositionLabels:case T.fixWidth:case T.fitArea:case T.horizontalAlignment:case T.verticalAlignment:case T.positionMargin:case T.positionMarginState:this.render(v.Layout,`onPropertyChanged(${t.name})`);break;case T.backgroundColor:this.render(v.Render,`onPropertyChanged(${t.name})`)}}onTableAttached(){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const t=`${this.viewerToLog()}.detach()`;b._package.logger.debug(`${t}, in`);const e=super.detach.bind(this);this.viewSyncer.sync(`${t}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView(),this.viewed=!1),e())})),b._package.logger.debug(`${t}, out`)}get onSizeChanged(){return this._onSizeChanged}get onFreqsCalculated(){return this._onFreqsCalculated}get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(t,e){const s=t.x,n=Math.floor(t.x/(this._positionWidthWithMargin*e)+Math.floor(this.slider.min)),i=this.positions[n];if(!i)return[null,null,null];const o=i.getMonomerAt(s,t.y);return void 0===o?[i,null,null]:[i,o,i.getFreq(o)]}_nullSequence(t="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(t).join("")}_removeEmptyPositions(){this.skipEmptyPositions&&(this.positions=c()(this.positions).filter((t=>{const e=this.unitsHandler.defaultGapSymbol;return!t.hasMonomer(e)||t.getFreq(e).rowCount!==t.sumRowCount})).toArray())}render(t,e){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render( recalcLevelVal=${t}, reason='${e}' )`),this.requestedRenderLevel=Math.max(this.requestedRenderLevel,t),this.renderRequest.next(this.requestedRenderLevel)}async renderInt(t){if(b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( renderLevel=${t} ), start `),this.msgHost&&(this.seqCol&&!this.palette?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.palette||null==this.host||null==this.slider)return;const e=window.devicePixelRatio,s=this.showPositionLabels?12:0;if(t>=v.Freqs&&(()=>{if(b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const t=this.getFilter(),e=0===t.trueCount?this.unitsHandler.maxLength:c().enumerate(this.unitsHandler.splitted).map((([e,s])=>t.get(s)&&e?e.length:0)).reduce(((t,e)=>Math.max(t,e)),0),s=this.seqCol.getTag(".positionNames"),n=this.seqCol.getTag(".positionLabels");this.positionNames=s?s.split(d.CI).map((t=>t.trim())):[...Array(e).keys()].map((t=>`${t+1}`)),this.positionLabels=n?n.split(d.CI).map((t=>t.trim())):void 0,this.startPosition=this.startPositionName&&this.positionNames&&this.positionNames.includes(this.startPositionName)?this.positionNames.indexOf(this.startPositionName):0,this.endPosition=this.endPositionName&&this.positionNames&&this.positionNames.includes(this.endPositionName)?this.positionNames.indexOf(this.endPositionName):e-1;const i=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.unitsHandler=u.Cn.getOrCreate(this.seqCol);const r=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(r);for(let t=0;t<i;t++){const e=this.positionNames[this.startPosition+t],s=this.positionLabels?this.positionLabels[this.startPosition+t]:void 0;this.positions[t]=new S(this.startPosition+t,e,{},{label:s})}const a=this.dataFrame.rowCount,l=this.unitsHandler.splitted;for(let e=0;e<i;++e){for(let s=0;s<a;++s)if(t.get(s)){const t=l[s][this.startPosition+e]||this.unitsHandler.defaultGapSymbol,n=this.positions[e],i=n.getFreq(t);++n.sumRowCount,i.value=++i.rowCount}if(this.valueAggrType===o.AGG.TOTAL_COUNT)continue;let s=null;try{s=this.dataFrame.getCol(this.valueColumnName),s.matches("numerical")||(s=null)}catch{s=null}if(s){for(let n=0;n<a;++n)if(t.get(n)){const t=l[n][this.startPosition+e]||this.unitsHandler.defaultGapSymbol,i=s.get(n);this.positions[e].getFreq(t).push(i)}this.positions[e].aggregate(this.valueAggrType)}}const h=this.valueAggrType===o.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((t=>t.getMinValue()))));for(let t=0;t<i;++t)this.positions[t].calcPlotValue(h),this.positions[t].calcHeights(this.positionHeight);this._removeEmptyPositions(),this._onFreqsCalculated.next()})(),this.calcLayout(e),-1===this.startPosition)return;const i=Math.max(Math.floor(this.slider.min),0),r=Math.min(this.positions.length-1,Math.floor(this.slider.max));t>=v.Layout&&((t,e,s,i)=>{b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), start `);const r=this.canvas.height-i*s;let a;if(this.valueAggrType===o.AGG.TOTAL_COUNT){const t=this.getAlphabetSize();this.positionHeight==m.ES.Entropy&&null==t&&n.shell.error("WebLogo: alphabet is undefined."),a=Math.log2(t)}else a=Math.max(...c().count(t).takeWhile((t=>t<=e)).map((t=>this.positions[t].sumPlotValueForHeight)));for(let n=t;n<=e;++n)n in this.positions?this.positions[n].calcScreen((t=>this.unitsHandler.isGap(t)),n,this.slider.min,r,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,s,i):b._package.logger.warning(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${n}`);b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(i,r,window.devicePixelRatio,s);const a=this.canvas.getContext("2d");if(a){a.save();try{this.Length,a.resetTransform(),a.fillStyle=function(t){const e=o.Color.a(t);return`#${(16777215&t).toString(16).padStart(6,"0")}`+e.toString(16).padStart(2,"0")}(this.backgroundColor),a.fillRect(0,0,this.canvas.width,this.canvas.height),a.textBaseline=this.textBaseline;const t=10*e;a.resetTransform(),a.fillStyle="black",a.textAlign="center",a.font=`${t.toFixed(1)}px Roboto, Roboto Local, sans-serif`,s>0&&this.positions.length>0&&function(t,e,s,n,i,o,r,a){t.save();try{t.textAlign="center";let l=null,c=null;for(let e=Math.floor(r);e<=Math.floor(a);e++){const s=o[e],n=t.measureText(s.name),i=n.actualBoundingBoxDescent-n.actualBoundingBoxAscent;l=null===l?n.width:Math.max(l,n.width),c=null===c?i:Math.max(c,i)}const h=l<n*e-2?1:(n*e-2)/l;for(let l=Math.floor(r);l<=Math.floor(a);l++){const a=o[l],u=(l-r)*s*e+n*e/2,d=(i*e-c)/2;t.setTransform(h,0,0,1,u,d),t.measureText(a.label),t.fillText(a.label,0,0)}}finally{t.restore()}}(a,e,this._positionWidthWithMargin,this._positionWidth,s,this.positions,this.slider.min,this.slider.max);const n="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let t=i;t<=r;t++)this.positions[t].render(a,(t=>this.unitsHandler.isGap(t)),n,l,c,this.palette)}finally{a.restore()}b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( recalcLevel=${t} ), end`)}}renderRequestOnDebounce(t){const e=`${this.viewerToLog()}.renderRequestOnDebounce()`;"HTML"!==a()(this.root).offsetParent().get()[0]?.tagName?(this.requestedRenderLevel=v.None,this.renderInt(t).catch((t=>{const[e,s]=(0,g.yf)(t);b._package.logger.error(e,void 0,s)}))):b._package.logger.warning(`${e}, $(this.root).offsetParent() is the 'HTML' tag.`)}getAlphabetSize(){return this.unitsHandler?.getAlphabetSize()??0}sliderOnValuesChanged(t){try{const t={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged( ${JSON.stringify(t)} ), start`),this.render(v.Layout,"sliderOnValuesChanged")}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged() error:\n`+e)}}dataFrameFilterOnChanged(t){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterChanged()`);try{this.filterSource===m.Ct.Filtered&&this.render(v.Freqs,"dataFrameFilterOnChanged")}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterOnChanged() error:\n`+e)}}dataFrameSelectionOnChanged(t){b._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged()`);try{this.filterSource===m.Ct.Selected&&this.render(v.Freqs,"dataFrameSelectionOnChanged")}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged() error:\n`+e)}}canvasOnMouseMove(t){const e=window.devicePixelRatio;try{const s=t,n=this.canvas.getCursorPosition(s,e),[r,a]=this.getMonomer(n,e),l=this.showPositionLabels?12*e:0;if(null!==r&&null===a&&0<=n.y&&n.y<=l){const t=[i.divText(`Position ${r.label}`)];this.valueAggrType===o.AGG.TOTAL_COUNT&&t.push(r.buildCompositionTable(this.palette));const e=i.divV(t);i.tooltip.show(e,s.x+16,s.y+16)}else if(null!==r&&a&&this.dataFrame&&this.seqCol&&this.unitsHandler){const t=r.getFreq(a),e=[i.div(`${a}`),i.div(`${t.rowCount} rows`)];this.valueAggrType!==o.AGG.TOTAL_COUNT&&e.push(i.div(`${this.valueAggrType}: ${t.value.toFixed(3)}`));const n=i.divV(e);i.tooltip.show(n,s.x+16,s.y+16)}else i.tooltip.hide()}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseMove() error:\n`+e)}}canvasOnMouseDown(t){try{const e=t,s=window.devicePixelRatio,[n,i]=this.getMonomer(this.canvas.getCursorPosition(e,s),s);if(null!==n&&null!==i&&this.dataFrame&&this.seqCol&&this.unitsHandler){const t=o.BitSet.create(this.dataFrame.selection.length,(t=>function(t,e,s,n,i,o){const r=e.splitted[n],a=o.pos<r.length?r[o.pos]:null;return a===i||""===a&&i===e.defaultGapSymbol}(this.dataFrame,this.unitsHandler,this.getFilter(),t,i,n)));this.dataFrame.selection.init((e=>t.get(e)))}}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseDown() error:\n`+e)}}canvasOnWheel(t){const e=window.devicePixelRatio;try{if(!this.visibleSlider)return;const s=this.canvas.width/(this._positionWidthWithMargin*e),n=t.deltaY/100*Math.max(Math.floor(s/5),1);this.slider.scrollBy(this.slider.min+n)}catch(t){const e=p(t);b._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnWheel() error:\n`+e)}}get onRendered(){return this._onRendered}invalidate(){const t=`${this.viewerToLog()}.invalidate()`;this.viewSyncer.sync(`${t}`,(async()=>{this.invalidate(),this._onRendered.next()}))}async awaitRendered(t=5e3){await(0,f.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),t)}}function M(t,e,s,n,i){let o=0,r=-1;for(;-1!=(r=s.findNext(r,!0));){const t=e.splitted[r],s=i.pos;(s<t.length?t[s]:null)===n&&o++}return o}L.residuesSet="nucleotides",L.viewerCounter=-1},6099:(t,e,s)=>{"use strict";s.d(e,{ST:()=>f});var n=s(3870),i=s(976),o=s(4469),r=s(6414),a=s.n(r),l=s(701),c=s(442),h=s(8447),u=s(7945),d=s(8467),m=s(7983),p=s(4293),g=s(4955);class f extends i.Filter{get calculating(){return"initial"==this.loader.style.display}set calculating(t){this.loader.style.display=t?"initial":"none"}get filterSummary(){return this.bioFilter.substructure}get isFiltering(){return super.isFiltering&&""!==this.bioFilter.substructure}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get _debounceTime(){if(null==this.column)return 1e3;const t=this.column.length;return t<500?0:t>1e4?1e3:Math.floor((t-500)/9500*1e3)}constructor(){super(),this.bioFilter=null,this.bitset=null,this.loader=n.loader(),this.notation=void 0,this.root=n.divV([]),this.calculating=!1}attach(t){super.attach(t),this.column=t.columns.bySemType(i.SEMTYPE.MACROMOLECULE),this.columnName??(this.columnName=this.column?.name),this.notation??(this.notation=this.column?.getTag(i.TAGS.UNITS)),this.bioFilter=this.notation===h.r2.FASTA?new C:this.notation===h.r2.SEPARATOR?new T(this.column.getTag("separator")):new A,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),this.onBioFilterChangedSubs?.unsubscribe();let e=this.bioFilter.onChanged;e=e.pipe((0,c.debounceTime)(this._debounceTime)),this.onBioFilterChangedSubs=e.subscribe((async t=>await this._onInputChanged())),this.subs.push(o.events.onResetFilterRequest.subscribe((t=>{this.bioFilter?.resetFilter()})))}detach(){this.bioFilter&&this.bioFilter.detach(),super.detach()}applyFilter(){this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const t=super.saveState();return t.bioSubstructure=this.bioFilter?.substructure,t}applyState(t){super.applyState(t),t.bioSubstructure&&(this.bioFilter.substructure=t.bioSubstructure);const e=this;t.bioSubstructure&&setTimeout((function(){e._onInputChanged()}),1e3)}async _onInputChanged(){if(g._package.logger.debug("Bio: BioSubstructureFilter._onInputChanged(), start"),this.isFiltering){if(a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`))return;this.calculating=!0;try{this.bitset=await(this.bioFilter?.substructureSearch(this.column)),this.calculating=!1,this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1}}else this.bitset=null,this.dataFrame?.rows.requestFilter()}}class y{constructor(){this.onChanged=new l.Subject}get filterPanel(){return new HTMLElement}async substructureSearch(t){return null}}class C extends y{constructor(){super(),this.substructureInput=n.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Substructure"})}get filterPanel(){return this.substructureInput.root}get substructure(){return this.substructureInput.value}set substructure(t){this.substructureInput.value=t}async substructureSearch(t){return(0,m.pf)(this.substructure,t)}resetFilter(){this.substructureInput.value=""}detach(){}}class T extends C{constructor(t){super(),this.colSeparator="",this.separatorInput=n.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Separator"}),this.colSeparator=t,this.separatorInput.value=t}get filterPanel(){return n.divV([this.substructureInput.root,this.separatorInput.root])}get substructure(){return this.separatorInput.value&&this.separatorInput.value!==this.colSeparator?this.substructureInput.value.replaceAll(this.separatorInput.value,this.colSeparator):this.substructureInput.value}set substructure(t){this.substructureInput.value=t}async substructureSearch(t){return(0,m.pf)(this.substructure,t,this.colSeparator)}detach(){}}class A extends y{constructor(){super(),this._filterPanel=n.div("",{style:{cursor:"pointer"}}),this.helmSubstructure="",this.viewSubs=[],this.init()}async init(){let t,e;this.helmEditor=await o.functions.call("Helm:helmWebEditor"),await n.tools.waitForElementInDom(this._filterPanel),this.updateFilterPanel(),this.viewSubs.push((0,l.fromEvent)(this._filterPanel,"click").subscribe((()=>{({editorDiv:t,webEditor:e}=this.helmEditor.createWebEditor(this.helmSubstructure));const s=n.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{const t=e.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.helmSubstructure=t,this.updateFilterPanel(this.substructure),setTimeout((()=>{this.onChanged.next()}),10)})).show({modal:!0,fullScreen:!0}).onClose.subscribe((()=>{s.unsubscribe(),t=void 0,e=void 0}))}))),this.viewSubs.push(n.onSizeChanged(this._filterPanel).subscribe((t=>{try{if(e){const t=e.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(t)}}catch(t){const[e,s]=(0,u.yf)(t);g._package.logger.error(e,void 0,s)}})))}get filterPanel(){return this._filterPanel}get substructure(){return this.helmSubstructure}set substructure(t){this.helmEditor.editor.setHelm(t)}updateFilterPanel(t){const e=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,s=e/2;if(t)(0,p.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(t),this.helmEditor.resizeEditor(e,s);else{const t=n.divText("Click to edit","helm-substructure-filter");(0,p.Y)(this._filterPanel,t)}}async substructureSearch(t){n.setUpdateIndicator(this._filterPanel,!0),await(0,d.gw)(10);const e=await(0,m.QF)(this.substructure,t);return n.setUpdateIndicator(this._filterPanel,!1),e}resetFilter(){console.debug("Bio: HelmFilter.resetFilter()"),this.helmSubstructure="",this.updateFilterPanel(this.substructure)}detach(){for(const t of this.viewSubs)t.unsubscribe()}}},8770:(t,e,s)=>{"use strict";s.d(e,{_:()=>C});var n=s(3870),i=(s(976),s(6414),s(8447),s(7331),s(3379)),o=s.n(i),r=s(7795),a=s.n(r),l=s(569),c=s.n(l),h=s(3565),u=s.n(h),d=s(9216),m=s.n(d),p=s(4589),g=s.n(p),f=s(5362),y={};function C(t,e){let s=0,i=null;for(const t of Object.values(e))s+=t,i=null===i?t:Math.max(i,t);const o=i/s,r=Object.assign({},...Array.from(Object.entries(e)).sort(((t,e)=>e[1]-t[1])).map((([e,i])=>{const r=i/s,a=t.get(e),l=n.div("",{classes:"macromolecule-cell-comp-analysis-bar"});l.style.width=50*r/o+"px",l.style.backgroundColor=a;const c=n.div(`${(100*r).toFixed(2)}%`);return{[e]:n.div([l,c],{classes:"macromolecule-cell-comp-analysis-value"})}}))),a=n.tableFromMap(r);return Array.from(a.rows).forEach((t=>{const e=t.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;t.cells[0].style.color=e})),a}y.styleTagTransform=g(),y.setAttributes=u(),y.insert=c().bind(null,"head"),y.domAPI=a(),y.insertStyleElement=m(),o()(f.Z,y),f.Z&&f.Z.locals&&f.Z.locals,s(499)},3336:t=>{"use strict";t.exports=$},976:t=>{"use strict";t.exports=DG},4469:t=>{"use strict";t.exports=grok},701:t=>{"use strict";t.exports=rxjs},442:t=>{"use strict";t.exports=rxjs.operators},3870:t=>{"use strict";t.exports=ui},6414:t=>{"use strict";t.exports=wu}},e={};function s(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,s),o.loaded=!0,o.exports}s.m=t,s.amdO={},s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.u=t=>t+".js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.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),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;s.g.importScripts&&(t=s.g.location+"");var e=s.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var i=n.length-1;i>-1&&!t;)t=n[i--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=t})(),s.b=document.baseURI||self.location.href,s.nc=void 0;var n={};(()=>{"use strict";s.r(n),s.d(n,{_package:()=>mt,test:()=>pt,tests:()=>e.QK});var t=s(976),e=s(8467);(0,e.W3)("_first",(()=>{(0,e.Bu)("_first",(async()=>{}))}));var i=s(2012),o=s(9976),r=s(6137);(0,e.W3)("Palettes",(()=>{(0,e.Bu)("testPaletteN",(async()=>{await async function(){const t=r.J.Chromatogram;(0,e.l_)(t instanceof o.B,!0),(0,e.l_)(t instanceof r.J,!0)}()})),(0,e.Bu)("testPaletteAA",(async()=>{await async function(){const t=i.f.Lesk,s=i.f.RasMol,n=i.f.GrokGroups;(0,e.l_)(t instanceof o.B,!0),(0,e.l_)(s instanceof o.B,!0),(0,e.l_)(n instanceof o.B,!0),(0,e.l_)(t instanceof i.f,!0),(0,e.l_)(s instanceof i.f,!0),(0,e.l_)(n instanceof i.f,!0)}()})),(0,e.Bu)("testPalettePtMe",(async()=>{const t=i.f.GrokGroups.get("MeNle"),s=i.f.GrokGroups.get("MeA"),n=i.f.GrokGroups.get("MeG"),o=i.f.GrokGroups.get("MeF"),r=i.f.GrokGroups.get("L"),a=i.f.GrokGroups.get("A"),l=i.f.GrokGroups.get("G"),c=i.f.GrokGroups.get("F");(0,e.l_)(t,r),(0,e.l_)(s,a),(0,e.l_)(n,l),(0,e.l_)(o,c)}))}));var a=s(4469),l=s(4955),c=s(8447),h=s(499);async function u(e){const s=t.Column.fromList(t.TYPE.STRING,"col1",e);if(await a.functions.call("Bio:detectMacromolecule",{col:s}),s.semType===t.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${s.semType}', units='${s.getTag(t.TAGS.UNITS)}'.`;throw new Error(e)}}async function d(e,s){const n=(await e()).getCol(s),i=await a.functions.call("Bio:detectMacromolecule",{col:n});if(i&&(n.semType=i),n.semType===t.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${n.semType}', units='${n.getTag(t.TAGS.UNITS)}'.`;throw new Error(e)}}async function m(s,n,i,o,r,l,c=null){const u=t.Column.fromList(t.TYPE.STRING,"seq",s),d=await a.functions.call("Bio:detectMacromolecule",{col:u});d&&(u.semType=d),(0,e.l_)(u.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(u.getTag(t.TAGS.UNITS),n),(0,e.l_)(u.getTag("aligned"),i),(0,e.l_)(u.getTag("alphabet"),o),c&&(0,e.l_)(u.getTag("separator"),c);const m=h.Cn.getOrCreate(u);(0,e.l_)(m.getAlphabetSize(),r),(0,e.l_)(m.getAlphabetIsMultichar(),l),m.isHelm()||((0,e.l_)(m.aligned,i),(0,e.l_)(m.alphabet,o))}async function p(s,n,i,o,r,l,c,u=null){const d=(await s()).col(n),m=await a.functions.call("Bio:detectMacromolecule",{col:d});m&&(d.semType=m),(0,e.l_)(d.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(d.getTag(t.TAGS.UNITS),i),(0,e.l_)(d.getTag("aligned"),o),(0,e.l_)(d.getTag("alphabet"),r),u&&(0,e.l_)(d.getTag("separator"),u);const p=h.Cn.getOrCreate(d);(0,e.l_)(p.getAlphabetSize(),l),(0,e.l_)(p.getAlphabetIsMultichar(),c),p.isHelm()||((0,e.l_)(p.aligned,o),(0,e.l_)(p.alphabet,r))}(0,e.W3)("detectors",(()=>{var s,n,i,o,r,l,h,y,C,T,A,b,w,S,E,v,x,L,M,N;const _=new(N=class{constructor(){this[s]="id,col1\n1,\n2,\n3,\n4,\n5,",this[n]="col1\n1\n2\n3",this[i]="col1\n4\n5\n6\n7",this[o]="col1\n8\n9\n10\n11\n12",this[r]="col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",this[l]="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",this[h]="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",this[y]="seq\nFWPHEY\nYNRQWYV\nMKPSEYV",this[C]="seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]DN\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]",this[T]="seq\nA*C*G*T*C*A*C*G*T*C\nC*A*G*T*G*T*C*A*G*T*G*T\nT*T*C*A*A*C*T*T*C*A*A*C",this[A]="seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",this[b]="seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",this[w]="seq\nabc-dfgg-abc1-cfr3-rty-wert-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-cfr3-wert-rut12",this[S]="seq\nabc/dfgg/abc1/cfr3/rty/wert/abc/dfgg/abc1/cfr3/rty/wert\nrut12/her2/rty/wert//abc/abc1/dfgg/rut12/her2/rty/wert//abc/abc1/dfgg\nrut12/rty/her2/abc/cfr3//wert/rut12/rut12/rty/her2/abc/cfr3//wert/rut12",this[E]="seq\nA-C--G-T--C-T-A-C--G-T--C-T\nC-A-C--T--G-T-C-A-C--T--G-T\nA-C-C-G-T-A-C-T-A-C-C-G-T-A-C-T",this[v]="seq\nm1-M-m3-mon4-mon5-N-T-MON8-N9-m1-M-m3-mon4-mon5-N-T-MON8-N9\nm1-mon2-m3-mon4-mon5-Num--MON8-N9-m1-mon2-m3-mon4-mon5-Num--MON8-N9\n\nmon1-M-mon3-mon4-mon5---MON8-N9-mon1-M-mon3-mon4-mon5---MON8-N9",this[x]="seq\nAc(1)-F-K(AEEA-AEEA-R-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-ARRA-W-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-AEEA-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2",this[L]="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",this[M]="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"}},s="negEmpty",n="neg1",i="neg2",o="neg3",r="negSmiles",l="csvFastaDna1",h="fastaRna1",y="fastaPt1",C="fastaUn",T="sepDna",A="sepRna",b="sepPt",w="sepUn1",S="sepUn2",E="sepMsaDna1",v="sepMsaUnWEmpty",x="sepComplex",L="fastaMsaDna1",M="fastaMsaPt1",N),P={fastaFasta:"System:AppData/Bio/data/sample_FASTA.fasta",fastaPtCsv:"System:AppData/Bio/data/sample_FASTA_PT.csv",msaComplex:"System:AppData/Bio/samples/MSA.csv",fastaCsv:"System:AppData/Bio/samples/FASTA.csv",helmCsv:"System:AppData/Bio/samples/HELM.csv",peptidesComplex:"System:AppData/Bio/tests/peptides_complex_msa.csv",peptidesSimple:"System:AppData/Bio/tests/peptides_simple_msa.csv",testDemogCsv:"System:AppData/Bio/tests/testDemog.csv",testHelmCsv:"System:AppData/Bio/tests/testHelm.csv",testIdCsv:"System:AppData/Bio/tests/testId.csv",testSmilesCsv:"System:AppData/Bio/tests/testSmiles.csv",testSmiles2Csv:"System:AppData/Bio/tests/testSmiles2.csv",testSmilesShort:"System:AppData/Bio/tests/testSmilesShort.csv",testActivityCliffsCsv:"System:AppData/Bio/tests/testActivityCliffs.csv",testCerealCsv:"System:AppData/Bio/tests/testCereal.csv",testUnichemSources:"System:AppData/Bio/tests/testUnichemSources.csv",testDmvOffices:"System:AppData/Bio/tests/testDmvOffices.csv",testAlertCollection:"System:AppData/Bio/tests/testAlertCollection.csv",testSpgi100:"System:AppData/Bio/tests/testSpgi100.csv",testSpgi:"System:AppData/Bio/tests/SPGI-derived.csv",testUrl:"System:AppData/Bio/tests/testUrl.csv"},I={};function R(t,e=O){return async()=>(t in I||(I[t]=(async()=>await e(P[t]))().catch((e=>{throw delete I[t],e}))),I[t])}async function O(e){const s=await a.dapi.files.readAsText(e);return t.DataFrame.fromCsv(s)}const G=e=>async()=>{const s=_[e],n=t.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(n),n};(0,e.Bu)("NegativeEmpty",(async()=>{await d(G("negEmpty"),"col1")})),(0,e.Bu)("Negative1",(async()=>{await d(G("neg1"),"col1")})),(0,e.Bu)("Negative2",(async()=>{await d(G("neg2"),"col1")})),(0,e.Bu)("Negative3",(async()=>{await d(G("neg3"),"col1")})),(0,e.Bu)("NegativeSmiles",(async()=>{await d(G("negSmiles"),"col1")})),(0,e.Bu)("NegativeStartEnd",(async()=>{await u(["START","END"])})),(0,e.Bu)("NegativeStartEndIntermediate",(async()=>{await u(["START","END","INTERMEDIATE"])})),(0,e.Bu)("FastaDna1",(async()=>{await p(G("csvFastaDna1"),"seq",c.r2.FASTA,"SEQ","DNA",4,!1)})),(0,e.Bu)("FastaRna1",(async()=>{await p(G("fastaRna1"),"seq",c.r2.FASTA,"SEQ","RNA",4,!1)})),(0,e.Bu)("FastaPt1",(async()=>{await p(G("fastaPt1"),"seq",c.r2.FASTA,"SEQ","PT",20,!1)})),(0,e.Bu)("FastaPtGaps",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.r2.FASTA,"SEQ","PT",20,!1))),(0,e.Bu)("FastaPtGapsMsa",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.r2.FASTA,"SEQ.MSA","PT",20,!1))),(0,e.Bu)("FastaUn",(async()=>{await p(G("fastaUn"),"seq",c.r2.FASTA,"SEQ.MSA","UN",12,!0)})),(0,e.Bu)("FastaMsaDna1",(async()=>{await p(G("fastaMsaDna1"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,e.Bu)("FastaMsaPt1",(async()=>{await p(G("fastaMsaPt1"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,e.Bu)("SepDna",(async()=>{await p(G("sepDna"),"seq",c.r2.SEPARATOR,"SEQ","DNA",4,!1,"*")})),(0,e.Bu)("SepRna",(async()=>{await p(G("sepRna"),"seq",c.r2.SEPARATOR,"SEQ","RNA",4,!1,"*")})),(0,e.Bu)("SepPt",(async()=>{await p(G("sepPt"),"seq",c.r2.SEPARATOR,"SEQ","PT",20,!1,"-")})),(0,e.Bu)("SepUn1",(async()=>{await p(G("sepUn1"),"seq",c.r2.SEPARATOR,"SEQ","UN",8,!0,"-")})),(0,e.Bu)("SepUn2",(async()=>{await p(G("sepUn2"),"seq",c.r2.SEPARATOR,"SEQ","UN",9,!0,"/")})),(0,e.Bu)("SepMsaN1",(async()=>{await p(G("sepMsaDna1"),"seq",c.r2.SEPARATOR,"SEQ.MSA","DNA",4,!1,"-")})),(0,e.Bu)("SepMsaUnWEmpty",(async()=>{await p(G("sepMsaUnWEmpty"),"seq",c.r2.SEPARATOR,"SEQ.MSA","UN",14,!0)})),(0,e.Bu)("SepComplex",(async()=>{await p(G("sepComplex"),"seq",c.r2.SEPARATOR,"SEQ","UN",18,!0)})),(0,e.Bu)("samplesFastaCsv",(async()=>{await f(R("fastaCsv"),{Sequence:new g(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,e.Bu)("samplesFastaFasta",(async()=>{await f(R("fastaFasta"),{sequence:new g(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,e.Bu)("samplesPeptidesComplex",(async()=>{await f(R("peptidesComplex"),{})})),(0,e.Bu)("samplesMsaComplex",(async()=>{await f(R("msaComplex"),{MSA:new g(c.r2.SEPARATOR,"SEQ.MSA","UN",161,!0,"/")})})),(0,e.Bu)("samplesIdCsv",(async()=>{await f(R("testIdCsv"),{})})),(0,e.Bu)("samplesSarSmallCsv",(async()=>{await f(R("testSmilesCsv"),{})})),(0,e.Bu)("samplesHelmCsv",(async()=>{await f(R("helmCsv"),{HELM:new g(c.r2.HELM,null,null,160,!0)})})),(0,e.Bu)("samplesTestHelmCsv",(async()=>{await f(R("testHelmCsv"),{"HELM string":new g(c.r2.HELM,null,null,9,!0)})})),(0,e.Bu)("samplesTestDemogCsv",(async()=>{await f(R("testDemogCsv"),{})})),(0,e.Bu)("samplesTestSmiles2Csv",(async()=>{await f(R("testSmiles2Csv"),{})})),(0,e.Bu)("samplesTestSmilesShort",(async()=>{await f(R("testSmilesShort"),{})})),(0,e.Bu)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await f(R("testActivityCliffsCsv"),{})})),(0,e.Bu)("samplesFastaPtCsv",(async()=>{await f(R("fastaPtCsv"),{sequence:new g(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,e.Bu)("samplesTestCerealCsv",(async()=>{await f(R("testCerealCsv"),{})})),(0,e.Bu)("samplesTestUnichemSources",(async()=>{await f(R("testUnichemSources"),{})})),(0,e.Bu)("samplesTestDmvOffices",(async()=>{await f(R("testDmvOffices"),{})})),(0,e.Bu)("samplesTestAlertCollection",(async()=>{await f(R("testAlertCollection"),{})})),(0,e.Bu)("samplesTestSpgi",(async()=>{await f(R("testSpgi"),{})})),(0,e.Bu)("samplesTestSpgi100",(async()=>{await f(R("testSpgi100"),{})})),(0,e.Bu)("samplesTestUrl",(async()=>{await f(R("testUrl"),{})}))}));class g{constructor(t,e,s,n,i,o){this.units=t,this.aligned=e,this.alphabet=s,this.alphabetSize=n,this.alphabetIsMultichar=i,this.separator=o}}async function f(t,e){const s=await t(),n=[];for(const i of s.columns.names())if(i in e){const s=e[i];try{await p(t,i,s.units,s.aligned,s.alphabet,s.alphabetSize,s.alphabetIsMultichar,s.separator)}catch(t){const e=t.toString();n.push(`Positive col '${i}' failed: ${e}`)}}else try{await d(t,i)}catch(t){const e=t.toString();n.push(`Negative col '${i}' failed: ${e}`)}if(n.length>0)throw new Error(n.join("\n"))}(0,e.W3)("detectors:weak-and-likely",(()=>{const s={fastaDnaWeak1:"id,colName\n1,TTTTTTTTTT\n2,TTTTTTTTTT\n3,TTTTTTTTTT\n4,TTTTTTTTTT",fastaDnaWeak1LikelyName:"id,seq\n1,TTTTTTT\n2,TTTTTTT\n3,TTTTTTT\n4,TTTTTTT",fastaRnaWeak1:"id,colName\n1,UUUUUUUUUU\n2,UUUUUUUUUU\n3,UUUUUUUUUU\n4,UUUUUUUUUU",fastaRnaWeak1LikelyName:"id,seq\n1,UUUUUUU\n2,UUUUUUU\n3,UUUUUUU\n4,UUUUUUU",fastaPtWeak1:"id,colName\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaPtWeak1LikelyName:"id,seq\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaUn1:"id,colName\n1,word\n2,other\n3,some\n4,another",fastaUn1LikelyName:"id,seq\n1,word\n2,other\n3,some\n4,another",fastaUn2LikelyName:'protein\nBoombastic\nMegafantastic\n"just-a-random-thought,oy!"',fastaUnMsa1LikelyName:"id,seq\n1,word\n2,male\n3,bare\n4,core"},n=e=>async()=>{const n=s[e],i=t.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i};(0,e.Bu)("fastaDnaWeak1",(async()=>{await d(n("fastaDnaWeak1"),"colName")})),(0,e.Bu)("fastaDnaWeak1LikelyName",(async()=>{await p(n("fastaDnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,e.Bu)("fastaRnaWeak1",(async()=>{await d(n("fastaRnaWeak1"),"colName")})),(0,e.Bu)("fastaRnaWeak1LikelyName",(async()=>{await p(n("fastaRnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","RNA",4,!1)})),(0,e.Bu)("fastaPtWeak1",(async()=>{await d(n("fastaPtWeak1"),"colName")})),(0,e.Bu)("fastaPtWeak1LikelyName",(async()=>{await p(n("fastaPtWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,e.Bu)("fastaUn1",(async()=>{await d(n("fastaUn1"),"colName")})),(0,e.Bu)("fastaUn1LikelyName",(async()=>{await d(n("fastaUn1LikelyName"),"seq")})),(0,e.Bu)("fastaUn2LikelyName",(async()=>{await d(n("fastaUn2LikelyName"),"protein")})),(0,e.Bu)("fastaUnMsa1LikelyName",(async()=>{await d(n("fastaUnMsa1LikelyName"),"seq")}))})),(0,e.W3)("detectorsBenchmark",(()=>{let s;async function n(n,o,r,a,l,u){return await async function(n,d,m,p){const g=(()=>{const e=function(e,s,n,i,o){let r;switch(e){case c.r2.FASTA:r=t=>{let e="";for(let s=0;s<t.length;s++){const n=t[s];e+=1==n.length?n:`[${n}]`}return e};break;case c.r2.SEPARATOR:r=(t,e)=>t.join(e);break;default:throw new Error(`Not supported notation '${e}'.`)}const a=(t,e)=>{const s=new Array(e);for(let n=0;n<e;n++)s[n]=t[Math.floor(Math.random()*t.length)];return r(s,o)},l=Array(i);for(let t=0;t<i;t++)l[t]=a(s,n);return t.Column.fromStrings("seq",l)}(o,[...(0,c.gM)(r)],a,l,u),n=s.prepare({col:e});return i(n),n})(),f=Date.now(),y=await(async t=>i(t))(g),C=Date.now();(function(t,s){const n=h.Cn.getOrCreate(t);(0,e.l_)(t.semType===s.semType,!0),(0,e.l_)(n.notation===s.notation,!0),(0,e.l_)(n.alphabet===s.alphabet,!0),(0,e.l_)(n.separator===s.separator,!0)})(y,{semType:t.SEMTYPE.MACROMOLECULE,notation:o,alphabet:r,separator:u});const T=C-f;if(T>n){const t=`ET ${T} ms is more than max allowed ${n} ms.`;throw console.error(t),new Error(t)}return console.log(`ET ${T} ms is OK.`),T}(n)}function i(t){t.callSync();const e=t.getOutputParamValue(),s=t.inputs.col;return e&&(s.semType=e),s}(0,e.bb)((async()=>{const e=t.Func.find({package:"Bio",name:"detectMacromolecule"});s=e[0];const n=t.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await s.prepare({col:n}).call()})),(0,e.Bu)("fastaDnaShorts50Few50",(async()=>{await n(10,c.r2.FASTA,"DNA",50,50)})),(0,e.Bu)("fastaDnaShorts50Many1E6",(async()=>{await n(20,c.r2.FASTA,"DNA",50,1e6)})),(0,e.Bu)("fastaDnaLong1e6Few50",(async()=>{await n(20,c.r2.FASTA,"DNA",1e6,50)})),(0,e.Bu)("separatorDnaShorts50Few50",(async()=>{await n(10,c.r2.SEPARATOR,"DNA",50,50,"/")})),(0,e.Bu)("separatorDnaShorts50Many1E6",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",50,1e6,"/")})),(0,e.Bu)("separatorDnaLong1e6Few50",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",1e6,50,"/")}))}));var y=s(6098),C=s(525);async function T(e){const s=await async function(t){return await mt.files.readAsText(t)}(e),n=t.DataFrame.fromCsv(s);return n.name=e.replace(".csv",""),n}async function A(t=1e4){const s=await a.dapi.docker.dockerContainers.filter("bio").first();"started"!==s.status&&"checking"!==s.status&&await(0,e.gw)(t)}async function b(s,n){const i=t.DataFrame.fromCsv(s),o=t.DataFrame.fromCsv(n),r=i.getCol("seq"),l=await a.functions.call("Bio:detectMacromolecule",{col:r});l&&(r.semType=l);const c=o.getCol("seq"),h=await(0,y.U)(r,!0);(0,e.f6)(h.toList(),c.toList())}async function w(s,n,i,o,r,l){const c=t.DataFrame.fromCsv(s),h=t.DataFrame.fromCsv(n),u=c.getCol("seq"),d=h.getCol("seq"),m=c.getCol("seq"),p=await a.functions.call("Bio:detectMacromolecule",{col:m});p&&(m.semType=p),await a.data.detectSemanticTypes(c),(0,e.l_)(u.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(u.getTag(t.TAGS.UNITS),i),r&&(0,e.l_)(u.getTag("alphabet"),r);const g=await(0,C.K)({col:u,pepsea:{method:l}});(0,e.l_)(g.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(g.getTag(t.TAGS.UNITS),o),(0,e.l_)(g.getTag("aligned"),"SEQ.MSA"),r&&(0,e.l_)(g.getTag("alphabet"),r),(0,e.f6)(g.toList(),d.toList())}(0,e.W3)("MSA",(async()=>{(0,e.Bu)("isCorrect",(async()=>{await b("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,e.Bu)("isCorrectLong",(async()=>{await b("seq\nFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP","seq\nFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHP\nYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP")})),(0,e.Bu)("isCorrectHelm",(async()=>{await A(),await w("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{meI.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{hHis.Aca.N.T.dE.Thr_PO3H2}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2\n .meI.Aca.N.T.dE.Thr_PO3H2\n .hHis.Aca.N.T.dE.Thr_PO3H2",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")})),(0,e.Bu)("isCorrectHelmLong",(async()=>{await A(),await w("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2}$$$$\n PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\n PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2\n meI.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me.\n Lys_Boc.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me.",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")})),(0,e.Bu)("isCorrectSeparator",(async()=>{await w("seq\n F-W-P-H-E-Y\n Y-N-R-Q-W-Y-V\n M-K-P-S-E-Y-V","seq\n FWPHEY-\n YNRQWYV\n MKPSEYV",c.r2.SEPARATOR,c.r2.FASTA,"PT")})),(0,e.Bu)("isCorrectSeparatorLong",(async()=>{await w("seq\n M-I-E-V-F-L-F-G-I-V-L-G-L-I-P-I-T-L-A-G-L-F-V-T-A-Y-L-Q-Y-R-R-G-D-Q-L-D-L\n M-M-E-L-V-L-K-T-I-I-G-P-I-V-V-G-V-V-L-R-I-V-D-K-W-L-N-K-D-K\n M-D-R-T-D-E-V-S-N-H-T-H-D-K-P-T-L-T-W-F-E-E-I-F-E-E-Y-H-S-P-F-H-N","seq\n MIEV-FLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n MMEL-VLKTII-GPIVVGVVLRIVDKWLNKDK------\n MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN-----",c.r2.SEPARATOR,c.r2.FASTA,"PT")}))}));var S=s(3553),E=s(9416);async function v(t,s){const n=(0,c.kB)(t);console.debug(`Bio: tests: splitters: src=${JSON.stringify(t)}, res=${JSON.stringify(n)} .`),(0,e.f6)(n,s)}async function x(t,s){const n=(0,c.gP)(t);console.debug(`Bio: tests: splitters: src=${JSON.stringify(t)}, res=${JSON.stringify(n)} .`),(0,e.f6)(n,s)}(0,e.W3)("splitters",(async()=>{(0,e.bb)((async()=>{})),(0,e.X5)((async()=>{}));const s=["M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",["M","MeI","Y","K","E","T","L","L","MeF","P","K","T","D","F","P","M","R","G","G","L","MeA"]],n=["[meI][Pip][dK][Thr_PO3H2][L-hArg(Et,Et)][D-Tyr_Et][Tyr_ab-dehydroMe][dV]EN[D-Orn][D-aThr][Phe_4Me]",["meI","Pip","dK","Thr_PO3H2","L-hArg(Et,Et)","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],i=["PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],o=["PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.D-Dap.dV.E.N.pnG.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],r=["PEPTIDE1{[meI].[hHis].[Aca].N.T.[dK].[Thr_PO3H2].[Aca].[D-Tyr_Et].[D-Dap].[dV].E.N.[pnG].[Phe_4Me]}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],c=["RNA1{R(U)P.R(T)P.R(G)P.R(C)P.R(A)}$$$$",["R(U)P","R(T)P","R(G)P","R(C)P","R(A)"]],h=["RNA1{P.R(U)P.R(T)}$$$$",["P","R(U)P","R(T)"]],u=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,e.Bu)("fastaMulti",(async()=>{await v(s[0],s[1])})),(0,e.Bu)("fastaFromHelm",(async()=>{await v(n[0],n[1])})),(0,e.Bu)("helm1",(async()=>{await x(i[0],i[1])})),(0,e.Bu)("helm2",(async()=>{await x(o[0],o[1])})),(0,e.Bu)("helm3-multichar",(async()=>{await x(r[0],r[1])})),(0,e.Bu)("testHelm1",(async()=>{await x(c[0],c[1])})),(0,e.Bu)("testHelm2",(async()=>{await x(h[0],h[1])})),(0,e.Bu)("testHelm3",(async()=>{await x(u[0],u[1])})),(0,e.Bu)("splitToMonomers",(async()=>{const t=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),s=t.getCol("MSA"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),s.setTag("aligned",S.mU);const i=await(0,E.n)(t,s);(0,e.l_)(i.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(i);const o=a.shell.addTableView(i);await(0,e.ow)((()=>o.grid.dataFrame!=t),"View grid has wrong data frame",100)})),(0,e.Bu)("getHelmMonomers",(async()=>{const e=t.DataFrame.fromCsv("HELM,Activity\nPEPTIDE1{hHis.N.T}$$$,5.30751\nPEPTIDE1{hHis.Aca.Cys_SEt}$$$,5.72388\n");await a.data.detectSemanticTypes(e);const s=["hHis","Aca","Cys_SEt","N","T"],n=e.getCol("HELM"),i=(0,l.getHelmMonomers)(n),o=s.filter((t=>!i.includes(t))),r=i.filter((t=>!s.includes(t)));if(o.length>0||r.length){const t=[];throw o.length>0&&t.push(`Missed monomers ${JSON.stringify(o)}.`),r.length>0&&t.push(`Unexpected monomers ${JSON.stringify(r)}.`),new Error(t.join(" "))}}))}));var L=s(7228),M=s(6584),N=s(2918);(0,e.W3)("monomerLibraries",(()=>{let t,s=null;(0,e.bb)((async()=>{t=await(0,L.JN)(),s=(0,M.nW)()})),(0,e.X5)((async()=>{await(0,M.tW)(s)})),(0,e.Bu)("default",(async()=>{await(0,M.tW)({exclude:[],explicit:[]}),await t.loadLibraries(!0);const s=t.getBioLib();(0,e.l_)(s.getPolymerTypes().length>0,!0)})),(0,e.Bu)("forTests",(async()=>{await(0,M.tb)(),await t.loadLibraries(!0);const s=t.getBioLib();(0,e.l_)(s.getPolymerTypes().length,2),(0,e.l_)(s.getMonomerSymbolsByType("PEPTIDE").length,322),(0,e.l_)(s.getMonomerSymbolsByType("RNA").length,383)})),(0,e.Bu)("empty",(async()=>{const s=await(0,M.nW)(),n=await(0,N.P4)();s.exclude=n,s.explicit=[],await(0,M.tW)(s),await t.loadLibraries(!0);const i=t.getBioLib();(0,e.l_)(0===i.getPolymerTypes().length,!0),i.getMonomerMolsByPolymerType("PEPTIDE")}))}));var _=s(4004);function P(){const e=[];return e.push(t.Column.fromList("string","MSA",new Array(10**6).fill("meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"))),e.push(t.Column.fromList("string","Activity",new Array(10**6).fill("5.30751"))),e}function I(){const e=[],s="meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr".repeat(10**5);return e.push(t.Column.fromList("string","MSA",new Array(100).fill(s))),e.push(t.Column.fromList("string","Activity",new Array(100).fill("7.30751"))),e}async function R(s,n){const i=s(),o=t.DataFrame.fromColumns(i);await a.data.detectSemanticTypes(o);const r=Date.now(),l=(o.columns.byName("MSA"),a.shell.addTableView(o));await(0,e.ow)((()=>l.grid.dataFrame!==o),"View grid has wrong data frame ",100);const c=Date.now()-r;console.log(`Performance test: ${n}: ${c}ms`)}(0,e.W3)("renderers",(()=>{(0,e.Bu)("long sequence performance ",(async()=>{await R(I,"Long sequences")})),(0,e.Bu)("many sequence performance",(async()=>{await R(P,"Many sequences")})),(0,e.Bu)("many sequence performance",(async()=>{await R(P,"Many sequences")})),(0,e.Bu)("rendererMacromoleculeFasta",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),n=t.DataFrame.fromCsv(s),i=n.getCol("Sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100);const l=i.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(l,"sequence")}()})),(0,e.Bu)("rendererMacromoleculeSeparator",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_SEPARATOR_PT.csv"),n=t.DataFrame.fromCsv(s),i=n.getCol("sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100);const l=i.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(l,"sequence")}()})),(0,e.Bu)("rendererMacromoleculeDifference",(async()=>{await async function(){const s=t.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(t.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=S.Of.MACROMOLECULE_DIFFERENCE;const n=t.DataFrame.fromColumns([s]),i=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await(0,e.ow)((()=>i.grid.dataFrame!=n),"View grid has wrong data frame",100);const o=s.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(o,S.Of.MACROMOLECULE_DIFFERENCE)}()})),(0,e.Bu)("afterMsa",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA.fasta"),n=(0,l.importFasta)(s)[0],i=n.getCol("sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),console.log("Bio: tests/renderers/afterMsa, table view"),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${i.semType}", units="${i.getTag(t.TAGS.UNITS)}", cell.renderer="${i.getTag(t.TAGS.CELL_RENDERER)}"`),(0,e.l_)(i.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(i.getTag(t.TAGS.UNITS),c.r2.FASTA),(0,e.l_)(i.getTag("aligned"),"SEQ"),(0,e.l_)(i.getTag("alphabet"),"PT"),(0,e.l_)(i.getTag(t.TAGS.CELL_RENDERER),"sequence");const u=await(0,C.K)({col:i});r.grid.invalidate(),await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100),(0,e.l_)(u.semType,t.SEMTYPE.MACROMOLECULE),(0,e.l_)(u.getTag(t.TAGS.UNITS),c.r2.FASTA),(0,e.l_)(u.getTag("aligned"),"SEQ.MSA"),(0,e.l_)(u.getTag("alphabet"),"PT"),(0,e.l_)(u.getTag(t.TAGS.CELL_RENDERER),"sequence"),h.Cn.getOrCreate(u)}()})),(0,e.Bu)("afterConvert",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA_PT.csv"),n=t.DataFrame.fromCsv(s),i=n.col("sequence"),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const l=await(0,_.o)(i,c.r2.SEPARATOR,"/");await(0,e.ow)((()=>r.grid.dataFrame!=n),"View grid has wrong data frame",100);const u=l.getTag(t.TAGS.CELL_RENDERER);(0,e.l_)(u,"sequence"),h.Cn.getOrCreate(l)}()})),(0,e.Bu)("selectRendererBySemType",(async()=>{await async function(){const s=t.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(t.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=S.Of.MACROMOLECULE_DIFFERENCE;const n=t.DataFrame.fromColumns([s]);a.shell.addTableView(n),await(0,e.gw)(100);const i=s.getTag(t.TAGS.CELL_RENDERER);if("MacromoleculeDifference"!==i)throw new Error(`Units 'separator', separator '/' and semType 'MacromoleculeDifference' have been manually set on column but after df was added as table, view renderer has set to '${i}' instead of correct 'MacromoleculeDifference'.`)}()}))}));var O=s(6414),G=s.n(O),F=s(9611);(0,e.W3)("renderers: monomerPlacer",(()=>{const s={splitter:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num-MON8-N9\nid3,mon1-M-mon3-mon4-mon5-MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:6},tgt:{pos:0}},{src:{row:1,x:26},tgt:{pos:1}},{src:{row:1,x:160},tgt:{pos:6}},{src:{row:1,x:185},tgt:{pos:7}},{src:{row:2,x:140},tgt:{pos:5}},{src:{row:2,x:145},tgt:{pos:5}}]},splitterMsa:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num--MON8-N9\nid3,\nid4,mon1-M-mon3-mon4-mon5---MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:4},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:37},tgt:{pos:0}},{src:{row:1,x:38},tgt:{pos:1}},{src:{row:1,x:170},tgt:{pos:4}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:4}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:282},tgt:{pos:null}}]},fastaMsa:{csv:"id,seq\nid1,QQYNIYPLT\nid2,QQWSSFPYT\nid3,\nid3,QHIRE--LT\n",testList:[{src:{row:1,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:19},tgt:{pos:0}},{src:{row:1,x:170},tgt:{pos:8}},{src:{row:1,x:171},tgt:{pos:8}},{src:{row:2,x:5},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:8}},{src:{row:3,x:181},tgt:{pos:null}}]}};for(const[n,i]of Object.entries(s))(0,e.Bu)(`getPosition-${n}`,(async()=>{const e=t.DataFrame.fromCsv(i.csv);await a.data.detectSemanticTypes(e);const s=e.getCol("seq"),n=new F.A(null,s,(()=>({unitsHandler:h.Cn.getOrCreate(s),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.GU,monomerLengthLimit:3}))),o=i.testList;for(let t=0;t<s.length;++t)n.getCellMonomerLengths(t);const r=[];for(const[t,e]of G().enumerate(o)){const e={pos:n.getPosition(t.src.row,t.src.x)};t.tgt.pos!=e.pos&&r.push(`Test src ${JSON.stringify(t.src)} expected tgt ${JSON.stringify(t.tgt)}, but get ${JSON.stringify({res:e})}`)}if(r.length>0)throw new Error("Test failed error(s):\n"+r.join(", n"))}))})),(0,e.W3)("converters",(()=>{let s;!function(t){t.fastaPt="fastaPt",t.separatorPt="separatorPt",t.helmPt="helmPt",t.fastaDna="fastaDna",t.separatorDna="separatorDna",t.helmDna="helmDna",t.fastaRna="fastaRna",t.separatorRna="separatorRna",t.helmRna="helmRna",t.fastaGaps="fastaGaps",t.separatorGaps="separatorGaps",t.helmGaps="helmGaps",t.fastaUn="fastaUn",t.separatorUn="separatorUn",t.helmUn="helmUn",t.helmLoneDeoxyribose="helmLoneDeoxyribose",t.helmLoneRibose="helmLoneRibose",t.helmLonePhosphorus="helmLonePhosphorus",t.fastaLoneDeoxyribose="fastaLoneDeoxyribose",t.fastaLoneRibose="fastaLoneRibose",t.fastaLonePhosphorus="fastaLonePhosphorus"}(s||(s={}));const n={[s.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[s.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[s.helmPt]:"seq\nPEPTIDE1{F.W.P.H.E.Y.F.W.P.H.E.Y}$$$$\nPEPTIDE1{Y.N.R.Q.W.Y.V.Y.N.R.Q.W.Y.V}$$$$\nPEPTIDE1{M.K.P.S.E.Y.V.M.K.P.S.E.Y.V}$$$$",[s.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[s.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[s.helmDna]:"seq\nRNA1{d(A)p.d(C)p.d(G)p.d(T)p.d(C)p.d(A)p.d(C)p.d(G)p.d(T)p.d(C)p}$$$$\nRNA1{d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p.d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p}$$$$\nRNA1{d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p.d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p}$$$$",[s.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[s.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[s.helmRna]:"seq\nRNA1{r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p}$$$$",[s.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[s.separatorGaps]:"seq\nF/W//P/H//E/Y/Y/F/W//P/H//E/Y/Y\nF/Y/N/R/Q/W/Y/V//F/Y/N/R/Q/W/Y/V/\nF/K/P//Q//S/E/Y/V/F/K/P//Q//S/E/Y/V",[s.helmGaps]:"seq\nPEPTIDE1{F.W.*.P.H.*.E.Y.Y.F.W.*.P.H.*.E.Y.Y}$$$$\nPEPTIDE1{F.Y.N.R.Q.W.Y.V.*.F.Y.N.R.Q.W.Y.V.*}$$$$\nPEPTIDE1{F.K.P.*.Q.*.S.E.Y.V.F.K.P.*.Q.*.S.E.Y.V}$$$$",[s.fastaUn]:"seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca]",[s.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca",[s.helmUn]:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D.meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca}$$$$",[s.helmLoneDeoxyribose]:"seq\nRNA1{d(A).d(C).d(G).d(T).d(C).d(A).d(C).d(G).d(T).d(C)}$$$$\nRNA1{d(C).d(A).d(G).d(T).d(G).d(T)p.d(C).d(A).d(G).d(T).d(G).d(T)p}$$$$\nRNA1{d(T).d(T).d(C).d(A).d(A).d(C)p.d(T).d(T).d(C).d(A).d(A).d(C)p}$$$$",[s.helmLoneRibose]:"seq\nRNA1{r(A).r(C).r(G).r(U).r(C).r(A).r(C).r(G).r(U).r(C)}$$$$\nRNA1{r(C).r(A).r(G).r(U).r(G).r(U)p.r(C).r(A).r(G).r(U).r(G).r(U)p}$$$$\nRNA1{r(U).r(U).r(C).r(A).r(A).r(C)p.r(U).r(U).r(C).r(A).r(A).r(C)p}$$$$",[s.helmLonePhosphorus]:"seq\nRNA1{p.p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{p.p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.p.p}$$$$"};async function i(e){const s=n[e],i=t.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(i),i}function o(s,n){if(s===c.r2.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${s.toString()}'.`);return function(i){const o=h.Cn.getOrCreate(i).convert(s,n);return(0,e.l_)(o.getTag(t.TAGS.UNITS),s),o}}async function r(t,s,n){const o=s((await i(t)).getCol("seq")),r=(await i(n)).getCol("seq");(0,e.f6)(o.toList(),r.toList()),h.Cn.getOrCreate(o)}(0,e.Bu)("testFastaPtToSeparator",(async()=>{await r(s.fastaPt,o(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,e.Bu)("testFastaDnaToSeparator",(async()=>{await r(s.fastaDna,o(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,e.Bu)("testFastaRnaToSeparator",(async()=>{await r(s.fastaRna,o(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,e.Bu)("testFastaGapsToSeparator",(async()=>{await r(s.fastaGaps,o(c.r2.SEPARATOR,"/"),s.separatorGaps)})),(0,e.Bu)("testFastaUnToSeparator",(async()=>{await r(s.fastaUn,o(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,e.Bu)("testFastaPtToHelm",(async()=>{await r(s.fastaPt,o(c.r2.HELM),s.helmPt)})),(0,e.Bu)("testFastaDnaToHelm",(async()=>{await r(s.fastaDna,o(c.r2.HELM),s.helmDna)})),(0,e.Bu)("testFastaRnaToHelm",(async()=>{await r(s.fastaRna,o(c.r2.HELM),s.helmRna)})),(0,e.Bu)("testFastaGapsToHelm",(async()=>{await r(s.fastaGaps,o(c.r2.HELM),s.helmGaps)})),(0,e.Bu)("testSeparatorPtToFasta",(async()=>{await r(s.separatorPt,o(c.r2.FASTA),s.fastaPt)})),(0,e.Bu)("testSeparatorDnaToFasta",(async()=>{await r(s.separatorDna,o(c.r2.FASTA),s.fastaDna)})),(0,e.Bu)("testSeparatorRnaToFasta",(async()=>{await r(s.separatorRna,o(c.r2.FASTA),s.fastaRna)})),(0,e.Bu)("testSeparatorGapsToFasta",(async()=>{await r(s.separatorGaps,o(c.r2.FASTA),s.fastaGaps)})),(0,e.Bu)("testSeparatorUnToFasta",(async()=>{await r(s.separatorUn,o(c.r2.FASTA),s.fastaUn)})),(0,e.Bu)("testSeparatorPtToHelm",(async()=>{await r(s.separatorPt,o(c.r2.HELM),s.helmPt)})),(0,e.Bu)("testSeparatorDnaToHelm",(async()=>{await r(s.separatorDna,o(c.r2.HELM),s.helmDna)})),(0,e.Bu)("testSeparatorRnaToHelm",(async()=>{await r(s.separatorRna,o(c.r2.HELM),s.helmRna)})),(0,e.Bu)("testSeparatorGapsToHelm",(async()=>{await r(s.separatorGaps,o(c.r2.HELM),s.helmGaps)})),(0,e.Bu)("testHelmDnaToFasta",(async()=>{await r(s.helmDna,o(c.r2.FASTA),s.fastaDna)})),(0,e.Bu)("testHelmRnaToFasta",(async()=>{await r(s.helmRna,o(c.r2.FASTA),s.fastaRna)})),(0,e.Bu)("testHelmPtToFasta",(async()=>{await r(s.helmPt,o(c.r2.FASTA),s.fastaPt)})),(0,e.Bu)("testHelmUnToFasta",(async()=>{await r(s.helmUn,o(c.r2.FASTA),s.fastaUn)})),(0,e.Bu)("testHelmDnaToSeparator",(async()=>{await r(s.helmDna,o(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,e.Bu)("testHelmRnaToSeparator",(async()=>{await r(s.helmRna,o(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,e.Bu)("testHelmPtToSeparator",(async()=>{await r(s.helmPt,o(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,e.Bu)("testHelmUnToSeparator",(async()=>{await r(s.helmUn,o(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,e.Bu)("testHelmLoneRibose",(async()=>{await r(s.helmLoneRibose,o(c.r2.FASTA),s.fastaRna)})),(0,e.Bu)("testHelmLoneDeoxyribose",(async()=>{await r(s.helmLoneDeoxyribose,o(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,e.Bu)("testHelmLonePhosphorus",(async()=>{await r(s.helmLonePhosphorus,o(c.r2.FASTA),s.fastaRna)}))}));var H=s(5226);(0,e.W3)("fastaFileHandler",(()=>{const s=["description:1","description:2","description:3","description:4"],n=(t.Column.fromStrings("description",s),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function i(t){const i=new H.i(t),o=i.descriptionsArray,r=i.sequencesArray;(0,e.f6)([o,r],[s,n])}(0,e.Bu)("testNormalFormatting",(async()=>{i(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,e.Bu)("testExtraSpaces",(async()=>{i(">description:1\n MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMI EVF LFGIVLGLI PITLAGLFVTAY LQYRRGDQLDL\n\n>description:3\nM MELVLKTI IGPI VVGVVLR IVDKWLNKDK\n\n>description:4\nMDR TDEVSNHTHDKP TLTWFEEIFEEYHSPFHN\n ")})),(0,e.Bu)("testExtraNewlines",(async()=>{i(">description:1\n\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVF\nLFGIVLGLI\nPITLAGLFVTA\nYLQYRRGDQLDL\n\n>description:3\nM\nME\n\nLVLKTIIG\n\nPIVVGVVLRI\nVDKWLNKDK\n\n\n>description:4\n\nMDRT\n\nDEVSNHTHDKP\n\nTLTWFEEIFEE\n\n\n\nYHSPFHN\n")}))}));var W=s(9943);(0,e.W3)("fastaExport",(()=>{let s;!function(t){t.single="single",t.multi="multi"}(s||(s={}));const n={[s.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[s.multi]:{src:"M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",tgt:["M[MeI]YKETLL[MeF]P","KTDFPMRGGL","[MeA]"]}};let i;!function(t){t.test1="test1",t.test2="test2"}(i||(i={}));const o={[i.test1]:{srcCsv:"id,seq\n1,MDYKETLLMP\n2,KTDFPMRGGL\n3,P",idCols:["id"],seqCol:"seq",lineWidth:10,tgtFasta:">1\nMDYKETLLMP\n>2\nKTDFPMRGGL\n>3\nP\n"},[i.test2]:{srcCsv:"id,id2,seq\n1,seqA,M[MeI]YKETLL[MeF]P\n2,seqB,KTDFPMRGGL\n3,seqC,[MeA]\n",idCols:["id2","id"],seqCol:"seq",lineWidth:5,tgtFasta:">seqA|1\nM[MeI]YKE\nTLL[MeF]P\n>seqB|2\nKTDFP\nMRGGL\n>seqC|3\n[MeA]\n"}};function r(t,s=10){const i=c.kB,o=n[t].src,r=(0,W.sK)(o,i,s),a=n[t].tgt;(0,e.f6)(r,a)}async function a(s){const n=t.DataFrame.fromCsv(s.srcCsv),i=n.getCol(s.seqCol),o=s.idCols.map((t=>n.getCol(t))),r=(0,W.i$)(o,i,s.lineWidth);(0,e.l_)(r,s.tgtFasta)}(0,e.Bu)("wrapSequenceSingle",(async()=>{r(s.single,10)})),(0,e.Bu)("wrapSequenceMulti",(async()=>{r(s.multi,10)})),(0,e.Bu)("saveAsFastaTest1",(async()=>{a(o[i.test1])})),(0,e.Bu)("saveAsFastaTest2",(async()=>{a(o[i.test2])}))}));var D=s(7331),B=s(8260);(0,e.W3)("bio",(()=>{const s="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,e.Bu)("testGetStatsHelm1",(async()=>{const s=t.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq"),n=(0,B.jY)(s,1,c.gP);(0,e.Wh)(n.freq,{meI:1}),(0,e.l_)(n.sameLength,!0)})),(0,e.Bu)("testGetStatsN1",(async()=>{await async function(s){const n=t.DataFrame.fromCsv(s).col("seq"),i=(0,B.jY)(n,5,c.kB);(0,e.Wh)(i.freq,{A:4,C:5,G:3,T:6}),(0,e.l_)(i.sameLength,!0)}(s)})),(0,e.Bu)("testGetAlphabetSimilarity",(async()=>{await async function(){const t=new Set(Object.keys(r.V.Names)),s=(0,c.KX)({A:2041,C:3015,G:3015,T:2048,"-":1e3},t);(0,e.l_)(s>.6,!0)}()})),(0,e.Bu)("testPickupPaletteN1",(async()=>{await async function(s){const n=t.DataFrame.fromCsv(s).col("seq"),i=(0,c.dQ)(n);(0,e.l_)(i instanceof r.J,!0)}(s)})),(0,e.Bu)("testPickupPaletteN1e",(async()=>{await async function(s){const n=t.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq"),i=(0,c.dQ)(n);(0,e.l_)(i instanceof r.J,!0)}()})),(0,e.Bu)("testPickupPaletteAA1",(async()=>{await async function(s){const n=t.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq"),o=(0,c.dQ)(n);(0,e.l_)(o instanceof i.f,!0)}()})),(0,e.Bu)("testPickupPaletteX",(async()=>{await async function(s){const n=t.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq"),i=(0,c.dQ)(n);(0,e.l_)(i instanceof D.kQ,!0)}()}))})),(0,e.W3)("WebLogo.monomerToShort",(()=>{(0,e.Bu)("longMonomerSingle",(async()=>{(0,e.l_)((0,c.GU)("S",5),"S")})),(0,e.Bu)("longMonomerShort",(async()=>{(0,e.l_)((0,c.GU)("Short",5),"Short")})),(0,e.Bu)("longMonomerLong56",(async()=>{(0,e.l_)((0,c.GU)("Long56",6),"Long56")})),(0,e.Bu)("longMonomerComplexFirstPartShort",(async()=>{(0,e.l_)((0,c.GU)("Long-long",5),"Long…")})),(0,e.Bu)("longMonomerComplexFirstPartLong56",(async()=>{(0,e.l_)((0,c.GU)("Long56-long",6),"Long5…")})),(0,e.Bu)("monomerToShort",(async()=>{const t=[["AbC","AbC"],["AbCd","Ab…"],["ABc","ABc"],["ABcd","AB…"],["A_b","A_b"],["A_bc","A…"],["Ab_c","Ab…"],["A1_b","A1…"],["Abc_d","Ab…"],["Abcd_e","Ab…"],["A-b","A-b"],["A-bc","A…"],["Ab-c","Ab…"],["A1-b","A1…"],["Abc-d","Ab…"],["Abcd-e","Ab…"],["A","A"],["Ab","Ab"],["Abc","Abc"],["Ab…","Ab…"],["Abcd","Ab…"],["Abcde","Ab…"]],s=t.map((t=>t[0])),n=t.map((t=>t[1])),i=s.map((t=>(0,c.GU)(t,3)));(0,e.f6)(i,n)}))}));var k=s(8415);function U(t,s){(0,e.l_)(t.name,s.name),(0,e.f6)(t.getMonomers(),s.getMonomers());for(const n of t.getMonomers())(0,e.l_)(t.getFreq(n).rowCount,s.getFreq(n).rowCount)}(0,e.W3)("WebLogo-positions",(()=>{const s="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,e.Bu)("allPositions",(async()=>{const n=t.DataFrame.fromCsv(s),i=a.shell.addTableView(n),o=n.getCol("seq");o.semType=t.SEMTYPE.MACROMOLECULE,o.setTag(t.TAGS.UNITS,c.r2.FASTA),o.setTag("alphabet","DNA"),o.setTag("aligned","SEQ.MSA");const r=await n.plot.fromType("WebLogo");await(0,e.zg)(r.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(r.root,t.DOCK_TYPE.DOWN)}),500);const l=r.positions,h=[new k.CK(0,"1",{A:new k.yW(2),"-":new k.yW(3)}),new k.CK(1,"2",{T:new k.yW(5)}),new k.CK(2,"3",{C:new k.yW(5)}),new k.CK(3,"4",{"-":new k.yW(5)}),new k.CK(4,"5",{G:new k.yW(5)}),new k.CK(5,"6",{"-":new k.yW(3),C:new k.yW(2)}),new k.CK(6,"7",{T:new k.yW(5)}),new k.CK(7,"8",{T:new k.yW(5)}),new k.CK(8,"9",{G:new k.yW(5)}),new k.CK(9,"10",{C:new k.yW(5)}),new k.CK(10,"11",{"-":new k.yW(5)}),new k.CK(11,"12",{"-":new k.yW(5)})];(0,e.l_)(l.length,h.length);for(let t=0;t<l.length;t++){(0,e.l_)(l[t].name,h[t].name);for(const s of l[t].getMonomers())(0,e.l_)(l[t].getFreq(s).rowCount,h[t].getFreq(s).rowCount)}})),(0,e.Bu)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const s=t.DataFrame.fromCsv("seq\n-TC-G-TTGC--\n-TC-GCTTGC--\n-T--C-GT-\n-T--C-GT-\n-T--C-GT-\n-T--CCGT-"),n=a.shell.addTableView(s),i=s.getCol("seq");i.semType=t.SEMTYPE.MACROMOLECULE,i.setTag(t.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","DNA"),i.setTag("aligned","SEQ"),s.filter.init((t=>t>2)),s.filter.fireChanged();const o=await s.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,e.zg)(o.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(o.root,t.DOCK_TYPE.DOWN)}),500);const r=o.positions,l=[new k.CK(0,"1",{"-":new k.yW(3)}),new k.CK(1,"2",{T:new k.yW(3)}),new k.CK(2,"3",{"-":new k.yW(3)}),new k.CK(3,"4",{"-":new k.yW(3)}),new k.CK(4,"5",{C:new k.yW(3)}),new k.CK(5,"6",{"-":new k.yW(2),C:new k.yW(1)}),new k.CK(6,"7",{G:new k.yW(3)}),new k.CK(7,"8",{T:new k.yW(3)}),new k.CK(8,"9",{"-":new k.yW(3)})];(0,e.l_)(r.length,l.length);for(let t=0;t<r.length;t++){(0,e.l_)(r[t].name,l[t].name);for(const s of r[t].getMonomers())(0,e.l_)(r[t].getFreq(s).rowCount,l[t].getFreq(s).rowCount)}})),(0,e.Bu)("positions with skipEmptyPositions option",(async()=>{const n=t.DataFrame.fromCsv(s),i=a.shell.addTableView(n),o=n.getCol("seq");o.semType=t.SEMTYPE.MACROMOLECULE,o.setTag(t.TAGS.UNITS,c.r2.FASTA),o.setTag("alphabet","DNA"),o.setTag("aligned","SEQ.MSA");const r=await n.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,e.zg)(r.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(r.root,t.DOCK_TYPE.DOWN)}),500);const l=r.positions,h=[new k.CK(0,"1",{A:new k.yW(2),"-":new k.yW(3)}),new k.CK(1,"2",{T:new k.yW(5)}),new k.CK(2,"3",{C:new k.yW(5)}),new k.CK(4,"5",{G:new k.yW(5)}),new k.CK(5,"6",{"-":new k.yW(3),C:new k.yW(2)}),new k.CK(6,"7",{T:new k.yW(5)}),new k.CK(7,"8",{T:new k.yW(5)}),new k.CK(8,"9",{G:new k.yW(5)}),new k.CK(9,"10",{C:new k.yW(5)})];(0,e.l_)(l.length,h.length);for(let t=0;t<l.length;t++)U(l[t],h[t])})),(0,e.Bu)("count sequences for monomer at position",(async()=>{const n=function(e,s,n,i){const o=t.DataFrame.fromCsv(e),r=o.getCol("seq");return r.semType=t.SEMTYPE.MACROMOLECULE,r.setTag(t.TAGS.UNITS,s),r.setTag("alphabet","DNA"),r.setTag("aligned","SEQ.MSA"),o}(s,c.r2.FASTA),i=n.getCol("seq"),o=a.shell.addTableView(n),r=await n.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,e.zg)(r.onLayoutCalculated,(()=>{}),(()=>{o.dockManager.dock(r.root,t.DOCK_TYPE.DOWN)}),500);const l=r.positions,u=[new k.CK(2,"3",{C:new k.yW(5)}),new k.CK(4,"5",{G:new k.yW(5)}),new k.CK(5,"6",{"-":new k.yW(3),C:new k.yW(2)}),new k.CK(6,"7",{T:new k.yW(5)})];(0,e.l_)(l.length,u.length);for(let t=0;t<l.length;t++)U(l[t],u[t]);const d=l[1],m=h.Cn.getOrCreate(i),p=(0,k.eZ)(n,m,n.filter,"G",d);(0,e.l_)(p,5)})),(0,e.Bu)("empty",(async()=>{const s=t.DataFrame.fromColumns([(()=>{const e=t.Column.fromStrings("seq",[]);return e.setTag(t.TAGS.SEMTYPE,t.SEMTYPE.MACROMOLECULE),e.setTag(t.TAGS.UNITS,c.r2.FASTA),e.setTag("alphabet","DNA"),e})()]),n=a.shell.addTableView(s),i=await s.plot.fromType("WebLogo");await(0,e.zg)(i.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(i.root,t.DOCK_TYPE.DOWN)}),500),i.positions}))}));var V=s(2568);function $(t,e){let s=null;for(const n of t.viewers)n.type===e&&(s=n);return s}(0,e.W3)("checkInputColumn",(()=>{const s="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,e.Bu)("testMsaPos",(async()=>{const n=t.DataFrame.fromCsv(s).getCol("seq");n.semType=t.SEMTYPE.MACROMOLECULE,n.setTag(t.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","DNA"),n.setTag("aligned","SEQ");const[i,o]=(0,V.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,e.l_)(i,!0)})),(0,e.Bu)("testMsaNegHelm",(async()=>{const n=t.DataFrame.fromCsv(s).getCol("seq");n.semType=t.SEMTYPE.MACROMOLECULE,n.setTag(t.TAGS.UNITS,c.r2.HELM),n.setTag(".alphabetIsMultichar","true");const[i,o]=(0,V.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,e.l_)(i,!1)})),(0,e.Bu)("testMsaNegUN",(async()=>{const n=t.DataFrame.fromCsv(s).getCol("seq");n.semType=t.SEMTYPE.MACROMOLECULE,n.setTag(t.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","UN"),n.setTag(".alphabetSize","11"),n.setTag(".alphabetIsMultichar","true"),n.setTag("aligned","SEQ");const[i,o]=(0,V.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,e.l_)(i,!1)})),(0,e.Bu)("testGetActionFunctionMeta",(async()=>{t.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((t=>"sequence"==t.name))}))})),(0,e.W3)("similarity/diversity",(async()=>{(0,e.Bu)("similaritySearchViewer",(async()=>{await async function(){const s=await mt.files.readAsText("tests/sample_MSA_data.csv"),n=t.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(n);const i=a.shell.addTableView(n),o=i.dataFrame.getCol("MSA");(0,e.l_)(o.semType,t.SEMTYPE.MACROMOLECULE);const r=await i.dataFrame.plot.fromType("Sequence Similarity Search");let l=!1;if(r.computeCompleted.subscribe((t=>{t&&(l=!0)})),i.dockManager.dock(r,t.DOCK_TYPE.RIGHT,null,"Similarity"),await r.renderPromise,await(0,e.ow)((()=>void 0!==$(i,"Sequence Similarity Search")),"Sequence Similarity Search viewer has not been created",100),!r.initialized)throw new Error("The viewer is not initialized.");if(!r.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!r.beforeRender())throw new Error("The viewer is not able to render.");if(!r.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=r;await(0,e.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,e.l_)(c.fingerprint,"Morgan"),(0,e.l_)(c.distanceMetric,"Tanimoto"),(0,e.l_)(c.scores.get(0),t.FLOAT_NULL),(0,e.l_)(c.idxs.get(0),0),(0,e.l_)(c.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,e.l_)(c.scores.get(1).toFixed(2),"0.73"),(0,e.l_)(c.idxs.get(1),4),(0,e.l_)(c.molCol.get(1),"Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/Chg/N/D-Orn/D-aThr//Phe_4Me"),i.dataFrame.currentRowIdx=1,await(0,e.ow)((()=>1===c.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,e.ow)((()=>"meI/hHis/Aca/Cys_SEt/T/dK/Thr_PO3H2/Aca/Tyr_PO3H2/D-Chg/dV/Phe_ab-dehydro/N/D-Orn/D-aThr//Phe_4Me"===c.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,e.Bu)("diversitySearchViewer",(async()=>{await async function(){const s=await mt.files.readAsText("tests/sample_MSA_data.csv"),n=t.DataFrame.fromCsv(s),i=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const o=i.dataFrame.getCol("MSA");(0,e.l_)(o.semType,t.SEMTYPE.MACROMOLECULE);const r=await i.dataFrame.plot.fromType("Sequence Diversity Search");let l=!1;if(r.computeCompleted.subscribe((t=>{t&&(l=!0)})),i.dockManager.dock(r,t.DOCK_TYPE.DOWN,null,"Diversity"),await r.renderPromise,await(0,e.ow)((()=>void 0!==$(i,"Sequence Diversity Search")),"Sequence Diversity Search viewer has not been created",100),!r.initialized)throw new Error("The viewer is not initialized.");if(!r.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!r.beforeRender())throw new Error("The viewer is not able to render.");if(!r.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=r;await(0,e.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,e.l_)(c.fingerprint,"Morgan"),(0,e.l_)(c.distanceMetric,"Tanimoto"),(0,e.l_)(c.initialized,!0),(0,e.l_)(c.renderMolIds.length>0,!0)}()}))}));var Y=s(6099);(0,e.W3)("substructureFilters",(async()=>{let t,s;(0,e.bb)((async()=>{t=await(0,L.JN)(),s=await(0,M.nW)(),await(0,M.tb)(),await t.loadLibraries(!0)})),(0,e.X5)((async()=>{await(0,M.tW)(s),await t.loadLibraries(!0)})),(0,e.Bu)("fasta",(async()=>{const t=await T("tests/filter_FASTA.csv"),s=new Y.ST;await a.data.detectSemanticTypes(t),s.attach(t),s.bioFilter.substructure="MD",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,3),(0,e.l_)(s.dataFrame.filter.get(0),!0),(0,e.l_)(s.dataFrame.filter.get(3),!0),(0,e.l_)(s.dataFrame.filter.get(8),!0),(0,e.l_)(s.dataFrame.filter.get(1),!1)})),(0,e.Bu)("separator",(async()=>{const t=await T("tests/filter_MSA.csv"),s=new Y.ST;await a.data.detectSemanticTypes(t),s.attach(t),s.bioFilter.substructure="meI",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,7),(0,e.l_)(s.dataFrame.filter.get(2),!1),s.bioFilter.substructure="/meI",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,0),s.bioFilter.substructure="meI-hHis",s.bioFilter.separatorInput.value="-",await(0,e.gw)(100),(0,e.l_)(s.dataFrame.filter.trueCount,7),(0,e.l_)(s.dataFrame.filter.get(2),!1)})),(0,e.Bu)("helm",(async()=>{const t=await T("tests/filter_HELM.csv"),s=a.shell.addTableView(t),n=new Y.ST;await a.data.detectSemanticTypes(t),mt.logger.debug("Bio/substructureFilters/helm, filter attaching."),n.attach(t),mt.logger.debug("Bio/substructureFilters/helm, filter attached."),mt.logger.debug("Bio/substructureFilters/helm, filter 1 changing."),n.bioFilter.helmSubstructure="PEPTIDE1{C}$$$$V2.0",mt.logger.debug("Bio/substructureFilters/helm, filter 1 change awaiting."),await(0,e.zg)(t.onRowsFiltered,(()=>{}),(()=>{n.bioFilter.onChanged.next()}),2e4),mt.logger.debug("Bio/substructureFilters/helm, filter 1 changed."),(0,e.l_)(n.dataFrame.filter.trueCount,2),(0,e.l_)(n.dataFrame.filter.get(0),!0),(0,e.l_)(n.dataFrame.filter.get(3),!0),mt.logger.debug("Bio/substructureFilters/helm, filter 2 changing."),n.bioFilter.helmSubstructure="PEPTIDE1{A.C}$$$$V2.0",mt.logger.debug("Bio/substructureFilters/helm, filter 2 change awaiting."),await(0,e.zg)(t.onRowsFiltered,(()=>{}),(()=>{n.bioFilter.onChanged.next()}),2e4),await async function(t,s=5e3){await(0,e.gw)(0),await(0,e.zg)(t.onAfterDrawContent,(()=>{}),(()=>{t.invalidate()}),s)}(s.grid),mt.logger.debug("Bio/substructureFilters/helm, filter 2 changed."),(0,e.l_)(n.dataFrame.filter.trueCount,1),(0,e.l_)(n.dataFrame.filter.get(3),!0)}),{timeout:3e4})}));var K=s(8341);(0,e.W3)("PepSeA",(()=>{(0,e.Bu)("Basic alignment",(async()=>{await A();const s=t.DataFrame.fromCsv('HELM,MSA\n "PEPTIDE1{F.L.R.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.R.G.W.MeF.Y..S.N.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.N.C}$$$$","F.L.R.G.Y.MeF.Y.W...N.C"\n "PEPTIDE1{F.G.Y.[MeF].Y.W.S.D.N.C}$$$$","F...G.Y.MeF.Y.W.S.D.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.S.N.D.C}$$$$","F.L.R.G.Y.MeF.Y.W.S.N.D.C"\n "PEPTIDE1{F.V.R.G.Y.[MeF].Y.W.S.N.C}$$$$","F.V.R.G.Y.MeF.Y.W.S..N.C"'),n=await(0,K.f3)(s.getCol("HELM"),"msa(HELM)");(0,e.l_)(null!==n,!0,"PepSeA container has not started");const i=s.getCol("MSA");for(let t=0;t<n.length;++t)(0,e.l_)(n.get(t)==i.get(t),!0)}))})),(0,e.W3)("viewers",(()=>{const s=t.Func.find({package:"Bio",tags:["viewer"]}).map((t=>t.friendlyName));for(const t of s)(0,e.Bu)(t,(async()=>{const s=await T("data/sample_FASTA_DNA.csv");await(0,e.AB)(t,s,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[t]})}));const Z="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",q="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",X="seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3-wert-rut12";var z;(0,e.W3)("UnitsHandler",(()=>{async function s(e){const s=t.DataFrame.fromCsv(e);await a.data.detectSemanticTypes(s);const n=h.Cn.getOrCreate(s.getCol("seq"));return[s,n]}(0,e.Bu)("Seq-Fasta",(async()=>{const[t,n]=await s(Z);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!1)})),(0,e.Bu)("Seq-Fasta-MSA",(async()=>{const[t,n]=await s(q);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!0)})),(0,e.Bu)("Seq-Fasta-units",(async()=>{const[t,n]=await s(Z);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!1)})),(0,e.Bu)("Seq-Fasta-MSA-units",(async()=>{const[t,n]=await s(q);(0,e.l_)(n.notation,c.r2.FASTA),(0,e.l_)(n.isMsa(),!0)})),(0,e.Bu)("Seq-Helm",(async()=>{const[t,n]=await s("seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$");(0,e.l_)(n.notation,c.r2.HELM),(0,e.l_)(n.isHelm(),!0)})),(0,e.Bu)("Seq-UN",(async()=>{const[t,n]=await s(X);(0,e.l_)(n.notation,c.r2.SEPARATOR),(0,e.l_)(n.separator,"-"),(0,e.l_)(n.alphabet,"UN")})),(0,e.Bu)("Seq-UN-auto",(async()=>{const[t,n]=await s(X);(0,e.l_)(n.notation,c.r2.SEPARATOR),(0,e.l_)(n.separator,"-"),(0,e.l_)(n.alphabet,"UN")}))})),function(t){t.fasta="fasta",t.fastaMsa="fastaMsa",t.separator="separator",t.separatorMsa="separatorMsa",t.helm="helm"}(z||(z={})),(0,e.W3)("UnitsHandler",(()=>{h._9[c.r2.FASTA],h._9[c.r2.HELM];const s=h._9[c.r2.SEPARATOR],n={[z.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.r2.FASTA,splitted:["ACGTCACGTC","CAGTGTCAGTGT","TTCAACTTCAAC"]}},[z.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.r2.FASTA,splitted:["AC-GT-CTAC-GT-CT","CAC-T-GTCAC-T-GT","ACCGTACTACCGTACT"]}},[z.separator]:{src:{csv:"seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3"},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["abc","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut12","her2","rty","wert","abc","abc1","dfgg","rut12","her2","rty","wert","abc"],["rut12","rty","her2","abc","cfr3","wert","rut12","rut12","rty","her2","abc","cfr3"]]}},[z.separatorMsa]:{src:{csv:'seq\nrut0-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut1-her2-rty--abc1-dfgg-rut12-her2-rty--abc1-dfgg\nrut2-rty-her2---wert-rut12-rty-her2---wert\n"rut3-rty-her2-""-""-""-""-wert-rut12-rty-her2-""-""-""-""-wert"\n"""-""-rut4-her2-wert-rut12-rty-her2-wert"\n"rut5-rty-her2-wert-rut12-rty-her2-wert-""-"""'},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["rut0","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut1","her2","rty",s,"abc1","dfgg","rut12","her2","rty",s,"abc1","dfgg"],["rut2","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],["rut3","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],[s,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",s]]}},[z.helm]:{src:{csv:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Thr_PO3H2.Aca.D-Tyr_Et}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.T.dK.Thr_PO3H2}$$$$"},tgt:{notation:c.r2.HELM,splitted:[["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Thr_PO3H2","Aca","D-Tyr_Et"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["Lys_Boc","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","T","dK","Thr_PO3H2"]]}}};for(const[s,i]of Object.entries(n))(0,e.Bu)(`splitted-${s}`,(async()=>{const s=t.DataFrame.fromCsv(i.src.csv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),(0,e.l_)(s.semType,t.SEMTYPE.MACROMOLECULE);const o=h.Cn.getOrCreate(s);(0,e.l_)(o.notation,i.tgt.notation),(0,e.l_)(o.separator===i.tgt.separator,!0);const r=o.splitted;(0,e.f6)(r,i.tgt.splitted)}),s==z.separatorMsa?{skipReason:"#2468 CSV row starting with the quote character"}:void 0)})),(0,e.W3)("UnitsHandler: getRegion",(()=>{const s={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:c.r2.FASTA,alphabet:"DNA",positionNames:{tag:"a, b, c, d, e, f, g, h",start:"c",end:"e"}},separatorPt:{srcCsv:"seq\nM-D-Y-K-E-T-L\nM-I-E-V-F-L-F-G-I\nM-M-",startIdx:5,endIdx:null,tgtCsv:"seq\nT-L--\nL-F-G-I\n---",units:c.r2.SEPARATOR,alphabet:"PT",positionNames:{tag:"1, 1A, 1B, 2, 3, 4, 4A, 4A, 4C",start:"4",end:null}},helm:{srcCsv:"seq\nPEPTIDE1{[meI].[hHis].[Aca].N.T.[dE].[Thr_PO3H2].[Aca].[D-Tyr_Et].[Tyr_ab-dehydroMe].[dV].E.N.[D-Orn]}$$$$\nPEPTIDE1{[meI].[hHis].[Aca].[Cys_SEt].T.[dK].[Thr_PO3H2].[Aca].[Tyr_PO3H2].[D-Chg].[dV].[Phe_ab-dehydro]}$$$$\nPEPTIDE1{[Lys_Boc].[hHis].[Aca].[Cys_SEt].T}$$$$",startIdx:3,endIdx:6,tgtCsv:"seq\nPEPTIDE1{N.T.[dE].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.[dK].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.*.*}$$$$",units:c.r2.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[n,i]of Object.entries(s))(0,e.Bu)(`${n}-idx`,(async()=>{const s=t.DataFrame.fromCsv(i.srcCsv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const o=h.Cn.getOrCreate(s).getRegion(i.startIdx,i.endIdx,"regSeq"),r=t.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,e.l_)(s.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(o.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(s.getTag("alphabet"),i.alphabet),(0,e.l_)(o.getTag("alphabet"),i.alphabet),(0,e.f6)(o.toList(),r.toList())})),i.positionNames&&(0,e.Bu)(`${n}-positionNames`,(async()=>{const s=t.DataFrame.fromCsv(i.srcCsv).getCol("seq");i.positionNames.tag&&s.setTag(".positionNames",i.positionNames.tag);const n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const o=await a.functions.call("Bio:getRegion",{sequence:s,start:i.positionNames.start,end:i.positionNames.end}),r=t.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,e.l_)(s.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(o.getTag(t.TAGS.UNITS),i.units),(0,e.l_)(s.getTag("alphabet"),i.alphabet),(0,e.l_)(o.getTag("alphabet"),i.alphabet),(0,e.f6)(o.toList(),r.toList())}))}));var j=s(8601);const Q=new t.FileSource("System:AppData/Bio"),J={PT:"peptides-fasta",DNA:"dna-fasta",MSA:"msa-separator"},tt={PT:"tests/to-atomic-level-peptides-fasta-input.csv",DNA:"tests/to-atomic-level-dna-fasta-input.csv",MSA:"tests/to-atomic-level-msa-separator-input.csv"},et={PT:"tests/to-atomic-level-peptides-fasta-output.csv",DNA:"tests/to-atomic-level-dna-fasta-output.csv",MSA:"tests/to-atomic-level-msa-separator-output.csv"},st="molfile(sequence)";async function nt(t,e="seq",s){const n=t.getCol(e),i=s.getBioLib(),o=await(0,j.i0)(t,n,i);return o.warnings.length>0&&mt.logger.warning(`_toAtomicLevel() warnings ${o.warnings.join("\n")}`),o.col}function it(t){return t.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((t=>t.trimEnd())).join("\n")}(0,e.W3)("toAtomicLevel",(async()=>{const s={},n={};let i,o,r;async function u(t,s){const n=t.getCol("sequence");await(0,l.toAtomicLevel)(t,n,!1);const i=t.getCol(st),o=s.getCol(st),r=G()(i.values()).map((t=>it(t))).toArray(),a=G()(o.values()).map((t=>it(t))).toArray();(0,e.f6)(r,a)}(0,e.bb)((async()=>{i=await(0,L.JN)(),o=await(0,M.nW)(),await(0,M.tb)(),await i.loadLibraries(!0);for(const e in J)s[e]=t.DataFrame.fromCsv((await Q.readAsText(tt[e])).replace(/\n$/,"")),await a.data.detectSemanticTypes(s[e]),n[e]=t.DataFrame.fromCsv((await Q.readAsText(et[e])).replace(/\n$/,""))})),(0,e.X5)((async()=>{await(0,M.tW)(o),await i.loadLibraries(!0)}));for(const t in J)(0,e.Bu)(`${J[t]}`,(async()=>{await u(s[t],n[t])}));!function(t){t.fastaDna="fastaDna",t.fastaRna="fastaRna",t.fastaPt="fastaPt",t.separatorDna="separatorDna",t.separatorRna="separatorRna",t.separatorPt="separatorPt",t.separatorUn="separatorUn",t.helm="helm"}(r||(r={}));const d={[r.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[r.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[r.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[r.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[r.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[r.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[r.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2",[r.helm]:"seq\nPEPTIDE1{meI.D-gGlu.Aca.N.T.dE.Thr_PO3H2.Aca.D.Thr_PO3H2.Aca.D}$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$"};async function m(e){const s=d[e],n=t.DataFrame.fromCsv(s.replace(/\n$/,""));return await a.data.detectSemanticTypes(n),n}(0,e.Bu)("fastaDna",(async()=>{await nt(await m(r.fastaDna),"seq",i)})),(0,e.Bu)("fastaRna",(async()=>{await nt(await m(r.fastaRna),"seq",i)})),(0,e.Bu)("fastaPt",(async()=>{await nt(await m(r.fastaPt),"seq",i)})),(0,e.Bu)("separatorDna",(async()=>{await nt(await m(r.separatorDna),"seq",i)})),(0,e.Bu)("separatorDna",(async()=>{await nt(await m(r.separatorRna),"seq",i)})),(0,e.Bu)("separatorPt",(async()=>{await nt(await m(r.separatorPt),"seq",i)})),(0,e.Bu)("separatorUn",(async()=>{await nt(await m(r.separatorUn),"seq",i)})),(0,e.Bu)("helm",(async()=>{await nt(await m(r.helm),"seq",i)})),(0,e.Bu)("ptFasta2",(async()=>{const s=await mt.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),n=t.DataFrame.fromCsv("seq\nAR"),o=n.getCol("seq");o.semType=t.SEMTYPE.MACROMOLECULE,o.setTag(t.TAGS.UNITS,c.r2.FASTA),o.setTag("alphabet","PT"),h.Cn.getOrCreate(o);const r=await nt(n,"seq",i);(0,e.l_)(it(r.get(0)),it(s))}))}));var ot=s(708);async function rt(e){const s=t.DataFrame.fromCsv(e),n=s.col("seq"),i=await a.functions.call("Bio:detectMacromolecule",{col:n});return i&&(n.semType=i),await a.data.detectSemanticTypes(s),h.Cn.getOrCreate(n)}function at(t,s,n,i){const o=n(t,s);(0,e.l_)(Number(o.toFixed(3)),Number(i.toFixed(3)))}(0,e.W3)("Distance",(async()=>{const s=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],n={F:0,W:1,R:2,Y:3},i="FWRWY",o="FWRWW",r="FWY",a="FWRWY",l="FWY",c="FWRRRRY";(0,e.Bu)("protein-distance-function",(async()=>{const t=(await rt("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,e.l_)(t,ot.U.LEVENSHTEIN)})),(0,e.Bu)("DNA-distance-function",(async()=>{const t=(await rt("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,e.l_)(t,ot.U.LEVENSHTEIN)})),(0,e.Bu)("MSA-distance-function",(async()=>{const t=(await rt("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,e.l_)(t,ot.U.HAMMING)})),(0,e.Bu)("levenstein-sub",(async()=>{const t=ot.o[ot.U.LEVENSHTEIN]();at(i,o,t,.2)})),(0,e.Bu)("levenstein-del",(async()=>{const t=ot.o[ot.U.LEVENSHTEIN]();at(r,a,t,.4)})),(0,e.Bu)("hamming",(async()=>{const t=ot.o[ot.U.HAMMING]();at(r,a,t,.6)})),(0,e.Bu)("needleman-blosum62",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});at(i,o,t,-6)})),(0,e.Bu)("needleman-blosum62-del",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});at(r,a,t,-1.8)})),(0,e.Bu)("needleman-custom-sub",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});at(i,o,t,.2)})),(0,e.Bu)("needleman-custom-del",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});at(r,a,t,.8)})),(0,e.Bu)("needleman-custom-zero-extend",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:0});at(l,c,t,.714)})),(0,e.Bu)("needleman-custom-half-extend",(async()=>{const t=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:2,gapExtend:1});at(l,c,t,1.286)})),(0,e.Bu)("needleman-custom-same-extend",(async()=>{const e=ot.o[ot.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});t.Test.isInBenchmark?at(Array(1e4).fill("FWRY").join(""),Array(1e4).fill("FYWRRY").join(""),e,.667):at(l,c,e,1.143)}))}));var lt=s(3277);async function ct(t,s,n,i,o,r,c,h){await a.data.detectSemanticTypes(t);const u=await(0,l.activityCliffs)(t,t.getCol(n),t.getCol(i),o,s,c,h,{[`${lt.sS}`]:!0});(0,e.l_)(null!=u,!0);const d=Array.from(u.root.children).find((t=>{const e=t.className.split(" ");return["ui-btn","ui-btn-ok"].every((t=>e.includes(t)))}));(0,e.l_)(d.innerText.toLowerCase(),`${r} cliffs`)}var ht=s(6361),ut=s(4628);async function dt(s,n,i){const o=s.getCol(i),r=await a.functions.call("Bio:detectMacromolecule",{col:o});r&&(o.semType=r);const c=t.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!c)throw new Error("Preprocessing function not found");const h=await(0,l.sequenceSpaceTopMenu)(s,s.col(i),n,ot.U.LEVENSHTEIN,!0,c,{[lt.sS]:!0});(0,e.l_)(null!=h,!0)}(0,e.W3)("activityCliffs",(async()=>{let s,n,i=[],o=[];const r=t.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],l=t.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,e.bb)((async()=>{s=await(0,L.JN)(),n=await(0,M.nW)(),await(0,M.tb)(),await s.loadLibraries(!0),i=[],o=[]})),(0,e.X5)((async()=>{await(0,M.tW)(n),await s.loadLibraries(!0)})),(0,e.Bu)("activityCliffsOpens",(async()=>{const e=await T(t.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv");o.push(e);const s=a.shell.addTableView(e);i.push(s);const n=t.Test.isInBenchmark?6:3;await ct(e,ut.A.UMAP,"sequence","Activity",90,n,ot.U.LEVENSHTEIN,r)})),(0,e.Bu)("activityCliffsWithEmptyRows",(async()=>{const t=await T("tests/100_3_clustests_empty_vals.csv");o.push(t);const e=a.shell.addTableView(t);i.push(e),await ct(t,ut.A.UMAP,"sequence","Activity",90,3,ot.U.LEVENSHTEIN,r)})),(0,e.Bu)("Helm",(async()=>{const t=await mt.files.readCsv("data/sample_HELM_50.csv");a.shell.addTableView(t),await ct(t,ut.A.UMAP,"HELM","Activity",65,20,ht.gk.Tanimoto,l)}))})),(0,e.W3)("sequenceSpace",(async()=>{let s,n,i,o;(0,e.Bu)("sequenceSpaceOpens",(async()=>{s=await T(t.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv"),n=a.shell.addTableView(s),await dt(s,ut.A.UMAP,"sequence")})),(0,e.Bu)("sequenceSpaceWithEmptyRows",(async()=>{i=await T("tests/100_3_clustests_empty_vals.csv"),o=a.shell.addTableView(i),await dt(i,ut.A.UMAP,"sequence")}))})),(0,e.W3)("Scoring",(()=>{const s="sequence",n="expected_similarity",i="expected_identity",o=t.DataFrame.fromCsv(`${s},${n},${i}\nPEPTIDE1{Aca.Orn.gGlu.Pqa.D-His_1Bn.dH.hHis.4Abz.D-Tic.D-Dap.Y.Iva.meS.F.P.F.D-1Nal}$$$$,1.0,1.0\nPEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC}$$$$,0.68,0.53\nPEPTIDE1{[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal]}$$$$V2.0,0.34,0.0`),r=o.getCol(s);r.setTag(t.TAGS.UNITS,c.r2.HELM),r.semType=t.SEMTYPE.MACROMOLECULE;const a=r.get(0);let h,u;(0,e.bb)((async()=>{h=await(0,L.JN)(),u=await(0,M.nW)(),await(0,M.tb)(),await h.loadLibraries(!0)})),(0,e.X5)((async()=>{await(0,M.tW)(u),await h.loadLibraries(!0)})),(0,e.Bu)("Identity",(async()=>{const t=await(0,l.sequenceIdentityScoring)(o,r,a);for(let s=0;s<t.length;s++)(0,e.jh)(t.get(s),o.get(i,s),.01,`Wrong identity score for sequence at position ${s}`)})),(0,e.Bu)("Similarity",(async()=>{const t=await(0,l.sequenceSimilarityScoring)(o,r,a);for(let s=0;s<t.length;s++)(0,e.jh)(t.get(s),o.get(n,s),.01,`Wrong similarity score for sequence at position ${s}`)}))}));const mt=new t.Package;async function pt(s,n,i){const o=await(0,e.ci)({category:s,test:n,testContext:i});return t.DataFrame.fromObjects(o)}})(),bio_test=n})();
|
|
2
2
|
//# sourceMappingURL=package-test.js.map
|