@datagrok/bio 2.15.11 → 2.15.13

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.
@@ -4,5 +4,5 @@ var bio_test;(()=>{var e={8924:(e,t,n)=>{"use strict";n.d(t,{X:()=>i});var r=n(7
4
4
  || ${a} === "boolean" || ${i} === null`).assign(c,o._`[${i}]`)}}r.else(),m(e),r.endIf(),r.if(o._`${c} !== undefined`,(()=>{r.assign(i,c),function({gen:e,parentData:t,parentDataProperty:n},r){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,r)))}(e,c)}))}(e,t,a):m(e)}))}return l};const u=new Set(["string","number","integer","boolean","null"]);function d(e,t,n,r=c.Correct){const i=r===c.Correct?o.operators.EQ:o.operators.NEQ;let s;switch(e){case"null":return o._`${t} ${i} null`;case"array":s=o._`Array.isArray(${t})`;break;case"object":s=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=a();break;default:return o._`typeof ${t} ${i} ${e}`}return r===c.Correct?s:(0,o.not)(s);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function h(e,t,n,r){if(1===e.length)return d(e[0],t,n,r);let i;const s=(0,a.toHash)(e);if(s.array&&s.object){const e=o._`typeof ${t} != "object"`;i=s.null?e:o._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else i=o.nil;s.number&&delete s.integer;for(const e in s)i=(0,o.and)(i,d(e,t,n,r));return i}t.checkDataType=d,t.checkDataTypes=h;const p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}(e);(0,s.reportError)(t,p)}t.reportTypeError=m},7870:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const r=n(9029),i=n(4227);function s(e,t,n){const{gen:s,compositeRule:o,data:a,opts:c}=e;if(void 0===n)return;const l=r._`${a}${(0,r.getProperty)(t)}`;if(o)return void(0,i.checkStrictMode)(e,`default is ignored for: ${l}`);let u=r._`${l} === undefined`;"empty"===c.useDefaults&&(u=r._`${u} || ${l} === null || ${l} === ""`),s.if(u,r._`${l} = ${(0,r.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:r}=e.schema;if("object"===t&&n)for(const t in n)s(e,t,n[t].default);else"array"===t&&Array.isArray(r)&&r.forEach(((t,n)=>s(e,n,t.default)))}},2586:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const r=n(8727),i=n(208),s=n(7887),o=n(208),a=n(7870),c=n(3673),l=n(4495),u=n(9029),d=n(2023),h=n(6939),p=n(4227),m=n(8708);function f({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},s){i.code.es5?e.func(t,u._`${d.default.data}, ${d.default.valCxt}`,r.$async,(()=>{e.code(u._`"use strict"; ${g(n,i)}`),function(e,t){e.if(d.default.valCxt,(()=>{e.var(d.default.instancePath,u._`${d.default.valCxt}.${d.default.instancePath}`),e.var(d.default.parentData,u._`${d.default.valCxt}.${d.default.parentData}`),e.var(d.default.parentDataProperty,u._`${d.default.valCxt}.${d.default.parentDataProperty}`),e.var(d.default.rootData,u._`${d.default.valCxt}.${d.default.rootData}`),t.dynamicRef&&e.var(d.default.dynamicAnchors,u._`${d.default.valCxt}.${d.default.dynamicAnchors}`)}),(()=>{e.var(d.default.instancePath,u._`""`),e.var(d.default.parentData,u._`undefined`),e.var(d.default.parentDataProperty,u._`undefined`),e.var(d.default.rootData,d.default.data),t.dynamicRef&&e.var(d.default.dynamicAnchors,u._`{}`)}))}(e,i),e.code(s)})):e.func(t,u._`${d.default.data}, ${function(e){return u._`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?u._`, ${d.default.dynamicAnchors}={}`:u.nil}}={}`}(i)}`,r.$async,(()=>e.code(g(n,i)).code(s)))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?u._`/*# sourceURL=${n} */`:u.nil}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function b(e){return"boolean"!=typeof e.schema}function w(e){(0,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function v(e,t){if(e.opts.jtd)return C(e,[],!1,t);const n=(0,i.getSchemaTypes)(e.schema);C(e,n,!(0,i.coerceAndCheckDataType)(e,n),t)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){const s=n.$comment;if(!0===i.$comment)e.code(u._`${d.default.self}.logger.log(${s})`);else if("function"==typeof i.$comment){const n=u.str`${r}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(u._`${d.default.self}.opts.$comment(${s}, ${n}, ${i}.schema)`)}}function C(e,t,n,r){const{gen:i,schema:a,data:c,allErrors:l,opts:h,self:m}=e,{RULES:f}=m;function g(p){(0,s.shouldUseGroup)(a,p)&&(p.type?(i.if((0,o.checkDataType)(p.type,c,h.strictNumbers)),E(e,p),1===t.length&&t[0]===p.type&&n&&(i.else(),(0,o.reportTypeError)(e)),i.endIf()):E(e,p),l||i.if(u._`${d.default.errors} === ${r||0}`))}!a.$ref||!h.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(h.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{T(e.dataTypes,t)||S(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const n=[];for(const r of e.dataTypes)T(t,r)?n.push(r):t.includes("integer")&&"number"===r&&n.push("integer");e.dataTypes=n}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&S(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const r in n){const i=n[r];if("object"==typeof i&&(0,s.shouldUseRule)(e.schema,i)){const{type:n}=i.definition;n.length&&!n.some((e=>{return r=e,(n=t).includes(r)||"number"===r&&n.includes("integer");var n,r}))&&S(e,`missing type "${n.join(",")}" for keyword "${r}"`)}}}(e,e.dataTypes))}(e,t),i.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):i.block((()=>x(e,"$ref",f.all.$ref.definition)))}function E(e,t){const{gen:n,schema:r,opts:{useDefaults:i}}=e;i&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,s.shouldUseRule)(r,n)&&x(e,n.keyword,n.definition,t.type)}))}function T(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){b(e)&&(w(e),y(e))?function(e){const{schema:t,opts:n,gen:r}=e;f(e,(()=>{n.$comment&&t.$comment&&A(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),r.let(d.default.vErrors,null),r.let(d.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",u._`${n}.evaluated`),t.if(u._`${e.evaluated}.dynamicProps`,(()=>t.assign(u._`${e.evaluated}.props`,u._`undefined`))),t.if(u._`${e.evaluated}.dynamicItems`,(()=>t.assign(u._`${e.evaluated}.items`,u._`undefined`)))}(e),v(e),function(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:s}=e;n.$async?t.if(u._`${d.default.errors} === 0`,(()=>t.return(d.default.data)),(()=>t.throw(u._`new ${i}(${d.default.vErrors})`))):(t.assign(u._`${r}.errors`,d.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:n,items:r}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),r instanceof u.Name&&e.assign(u._`${t}.items`,r)}(e),t.return(u._`${d.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,r.topBoolOrEmptySchema)(e)))};class _{constructor(e,t,n){if((0,c.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",L(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,n){this.failResult((0,u.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,u.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(u._`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_error(e,t){(e?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=u.nil){this.gen.block((()=>{this.check$data(e,n),t()}))}check$data(e=u.nil,t=u.nil){if(!this.$data)return;const{gen:n,schemaCode:r,schemaType:i,def:s}=this;n.if((0,u.or)(u._`${r} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:n,def:r,it:i}=this;return(0,u.or)(function(){if(n.length){if(!(t instanceof u.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return u._`${(0,o.checkDataTypes)(e,t,i.opts.strictNumbers,o.DataType.Wrong)}`}return u.nil}(),function(){if(r.validateSchema){const n=e.scopeValue("validate$data",{ref:r.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t){const n=(0,l.getSubschema)(this.it,e);(0,l.extendSubschemaData)(n,this.it,e),(0,l.extendSubschemaMode)(n,e);const i={...this.it,...n,items:void 0,props:void 0};return function(e,t){b(e)&&(w(e),y(e))?function(e,t){const{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&A(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,h.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=r.const("_errs",d.default.errors);v(e,s),r.var(t,u._`${s} === ${d.default.errors}`)}(e,t):(0,r.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){const{it:n,gen:r}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(r,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:r}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return r.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function x(e,t,n,r){const i=new _(e,n,t);"code"in n?n.code(i,r):i.$data&&n.validate?(0,c.funcKeywordCode)(i,n):"macro"in n?(0,c.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,c.funcKeywordCode)(i,n)}t.KeywordCxt=_;const M=/^\/(?:[^~]|~0|~1)*$/,P=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function L(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,s;if(""===e)return d.default.rootData;if("/"===e[0]){if(!M.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,s=d.default.rootData}else{const o=P.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(i=o[2],"#"===i){if(a>=t)throw new Error(c("property/index",a));return r[t-a]}if(a>t)throw new Error(c("data",a));if(s=n[t-a],!i)return s}let o=s;const a=i.split("/");for(const e of a)e&&(s=u._`${s}${(0,u.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=u._`${o} && ${s}`);return o;function c(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=L},3673:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const r=n(9029),i=n(2023),s=n(5765),o=n(8708);function a(e){const{gen:t,data:n,it:i}=e;t.if(i.parentData,(()=>t.assign(n,r._`${i.parentData}[${i.parentDataProperty}]`)))}function c(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,r.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:i,schema:s,parentSchema:o,it:a}=e,l=t.macro.call(a.self,s,o,a),u=c(n,i,l);!1!==a.opts.validateSchema&&a.self.validateSchema(l,!0);const d=n.name("valid");e.subschema({schema:l,schemaPath:r.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:l,keyword:u,schema:d,parentSchema:h,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const f=!p&&t.compile?t.compile.call(m.self,d,h,m):t.validate,g=c(l,u,f),y=l.let("valid");function b(n=(t.async?r._`await `:r.nil)){const o=m.opts.passContext?i.default.this:i.default.self,a=!("compile"in t&&!p||!1===t.schema);l.assign(y,r._`${n}${(0,s.callValidateCode)(e,g,o,a)}`,t.modifying)}function w(e){var n;l.if((0,r.not)(null!==(n=t.valid)&&void 0!==n?n:y),e)}e.block$data(y,(function(){if(!1===t.errors)b(),t.modifying&&a(e),w((()=>e.error()));else{const n=t.async?function(){const e=l.let("ruleErrs",null);return l.try((()=>b(r._`await `)),(t=>l.assign(y,!1).if(r._`${t} instanceof ${m.ValidationError}`,(()=>l.assign(e,r._`${t}.errors`)),(()=>l.throw(t))))),e}():function(){const e=r._`${g}.errors`;return l.assign(e,null),b(r.nil),e}();t.modifying&&a(e),w((()=>function(e,t){const{gen:n}=e;n.if(r._`Array.isArray(${t})`,(()=>{n.assign(i.default.vErrors,r._`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,r._`${i.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:y)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:r},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");const o=i.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}},4495:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const r=n(9029),i=n(4227);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:s,schemaPath:o,errSchemaPath:a,topSchemaRef:c}){if(void 0!==t&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const s=e.schema[t];return void 0===n?{schema:s,schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[n],schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}${(0,r.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(n)}`}}if(void 0!==s){if(void 0===o||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:o,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:s,data:o,dataTypes:a,propertyName:c}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:c}=t;u(l.let("data",r._`${t.data}${(0,r.getProperty)(n)}`,!0)),e.errorPath=r.str`${o}${(0,i.getErrorPath)(n,s,c.jsPropertySyntax)}`,e.parentDataProperty=r._`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}function u(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}void 0!==o&&(u(o instanceof r.Name?o:l.let("data",o,!0)),void 0!==c&&(e.propertyName=c)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:s}){void 0!==r&&(e.compositeRule=r),void 0!==i&&(e.createErrors=i),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=n}},4042:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var r=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var i=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});const s=n(3558),o=n(4551),a=n(396),c=n(3835),l=n(9029),u=n(6939),d=n(208),h=n(4227),p=n(3837),m=n(5944),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const g=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),b={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},w={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,n,r,i,s,o,a,c,l,u,d,h,p,g,y,b,w,v,A,C,E,T,S,_,x;const M=e.strict,P=null===(t=e.code)||void 0===t?void 0:t.optimize,L=!0===P||void 0===P?1:P||0,N=null!==(r=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==r?r:f,$=null!==(i=e.uriResolver)&&void 0!==i?i:m.default;return{strictSchema:null===(o=null!==(s=e.strictSchema)&&void 0!==s?s:M)||void 0===o||o,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:M)||void 0===c||c,strictTypes:null!==(u=null!==(l=e.strictTypes)&&void 0!==l?l:M)&&void 0!==u?u:"log",strictTuples:null!==(h=null!==(d=e.strictTuples)&&void 0!==d?d:M)&&void 0!==h?h:"log",strictRequired:null!==(g=null!==(p=e.strictRequired)&&void 0!==p?p:M)&&void 0!==g&&g,code:e.code?{...e.code,optimize:L,regExp:N}:{optimize:L,regExp:N},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(b=e.loopEnum)&&void 0!==b?b:200,meta:null===(w=e.meta)||void 0===w||w,messages:null===(v=e.messages)||void 0===v||v,inlineRefs:null===(A=e.inlineRefs)||void 0===A||A,schemaId:null!==(C=e.schemaId)&&void 0!==C?C:"$id",addUsedSchema:null===(E=e.addUsedSchema)||void 0===E||E,validateSchema:null===(T=e.validateSchema)||void 0===T||T,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(x=e.int32range)||void 0===x||x,uriResolver:$}}class A{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:t,lines:n}),this.logger=function(e){if(!1===e)return M;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),C.call(this,b,e,"NOT SUPPORTED"),C.call(this,w,e,"DEPRECATED","warn"),this._metaOpts=x.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&_.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),T.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let r=p;"id"===n&&(r={...p},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let n;if("string"==typeof e){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);const r=n(t);return"$async"in n||(this.errors=n.errors),r}compile(e,t){const n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await i.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||s.call(this,n)}async function i(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),s.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const n=await l.call(this,e);this.refs[e]||await i.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,r);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,u.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let n;if(n=e.$schema,void 0!==n&&"string"!=typeof n)throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const r=this.validate(n,e);if(!r&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return r}getSchema(e){let t;for(;"string"==typeof(t=E.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,r=new c.SchemaEnv({schema:{},schemaId:n});if(t=c.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=E.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(L.call(this,n,t),!t)return(0,h.eachItem)(n,(e=>N.call(this,e))),this;I.call(this,t);const r={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,h.eachItem)(n,0===r.type.length?e=>N.call(this,e,r):e=>r.type.forEach((t=>N.call(this,e,r,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const n of t.rules){const t=n.rules.findIndex((t=>t.keyword===e));t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){return e&&0!==e.length?e.map((e=>`${n}${e.instancePath} ${e.message}`)).reduce(((e,n)=>e+t+n)):"No errors"}$dataMetaSchema(e,t){const n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const r of t){const t=r.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:r}=t.definition,s=i[e];r&&s&&(i[e]=O(s))}}return e}_removeAllSchemas(e,t){for(const n in e){const r=e[n];t&&!t.test(n)||("string"==typeof r?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let s;const{schemaId:o}=this.opts;if("object"==typeof e)s=e[o];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;n=(0,u.normalizeId)(s||n);const l=u.getSchemaRefs.call(this,e,n);return a=new c.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:l}),this._cache.set(a.schema,a),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),r&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):c.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,e)}finally{this.opts=t}}}function C(e,t,n,r="error"){for(const i in e){const s=i;s in t&&this.logger[r](`${n}: option ${i}. ${e[s]}`)}}function E(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function T(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function _(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}}function x(){const e={...this.opts};for(const t of g)delete e[t];return e}A.ValidationError=s.default,A.MissingRefError=o.default,t.default=A;const M={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function L(e,t){const{RULES:n}=this;if((0,h.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!P.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function N(e,t,n){var r;const i=null==t?void 0:t.post;if(n&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let o=i?s.post:s.rules.find((({type:e})=>e===n));if(o||(o={type:n,rules:[]},s.rules.push(o)),s.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?$.call(this,o,a,t.before):o.rules.push(a),s.all[e]=a,null===(r=t.implements)||void 0===r||r.forEach((e=>this.addKeyword(e)))}function $(e,t,n){const r=e.rules.findIndex((e=>e.keyword===n));r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function I(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}const R={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,R]}}},9572:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1678),i=n(7216),s=n(9547),o=n(8226),a=n(518),c=n(4588),l=n(5707),u=n(7082),d=["/properties"];t.default=function(e){return[r,i,s,o,a,t(this,c),l,t(this,u)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,n){return e?t.$dataMetaSchema(n,d):n}}},6250:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2017);r.code='require("ajv/dist/runtime/equal").default',t.default=r},3853:(e,t)=>{"use strict";function n(e){const t=e.length;let n,r=0,i=0;for(;i<t;)r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t&&(n=e.charCodeAt(i),56320==(64512&n)&&i++);return r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.code='require("ajv/dist/runtime/ucs2length").default'},5944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8343);r.code='require("ajv/dist/runtime/uri").default',t.default=r},3558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=n},5457:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const r=n(9029),i=n(4227),s={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:r}=t;Array.isArray(r)?o(e,r):(0,i.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:s,data:o,keyword:a,it:c}=e;c.items=!0;const l=n.const("len",r._`${o}.length`);if(!1===s)e.setParams({len:t.length}),e.pass(r._`${l} <= ${t.length}`);else if("object"==typeof s&&!(0,i.alwaysValidSchema)(c,s)){const s=n.var("valid",r._`${l} <= ${t.length}`);n.if((0,r.not)(s),(()=>function(s){n.forRange("i",t.length,l,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:i.Type.Num},s),c.allErrors||n.if((0,r.not)(s),(()=>n.break()))}))}(s))),e.ok(s)}}t.validateAdditionalItems=o,t.default=s},8660:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(2023),o=n(4227),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>i._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:c,errsCount:l,it:u}=e;if(!l)throw new Error("ajv implementation error");const{allErrors:d,opts:h}=u;if(u.props=!0,"all"!==h.removeAdditional&&(0,o.alwaysValidSchema)(u,n))return;const p=(0,r.allSchemaProperties)(a.properties),m=(0,r.allSchemaProperties)(a.patternProperties);function f(e){t.code(i._`delete ${c}[${e}]`)}function g(r){if("all"===h.removeAdditional||h.removeAdditional&&!1===n)f(r);else{if(!1===n)return e.setParams({additionalProperty:r}),e.error(),void(d||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(u,n)){const n=t.name("valid");"failing"===h.removeAdditional?(y(r,n,!1),t.if((0,i.not)(n),(()=>{e.reset(),f(r)}))):(y(r,n),d||t.if((0,i.not)(n),(()=>t.break())))}}}function y(t,n,r){const i={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===r&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,n)}t.forIn("key",c,(n=>{p.length||m.length?t.if(function(n){let s;if(p.length>8){const e=(0,o.schemaRefOrVal)(u,a.properties,"properties");s=(0,r.isOwnProperty)(t,e,n)}else s=p.length?(0,i.or)(...p.map((e=>i._`${n} === ${e}`))):i.nil;return m.length&&(s=(0,i.or)(s,...m.map((t=>i._`${(0,r.usePattern)(e,t)}.test(${n})`)))),(0,i.not)(s)}(n),(()=>g(n))):g(n)})),e.ok(i._`${l} === ${s.default.errors}`)}};t.default=a},5844:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:i}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=t.name("valid");n.forEach(((t,n)=>{if((0,r.alwaysValidSchema)(i,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},s);e.ok(s),e.mergeEvaluated(o)}))}};t.default=i},6505:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(5765).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=r},2661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?r.str`must contain at least ${e} valid item(s)`:r.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?r._`{minContains: ${e}}`:r._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:s,data:o,it:a}=e;let c,l;const{minContains:u,maxContains:d}=s;a.opts.next?(c=void 0===u?1:u,l=d):c=1;const h=t.const("len",r._`${o}.length`);if(e.setParams({min:c,max:l}),void 0===l&&0===c)return void(0,i.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==l&&c>l)return(0,i.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,i.alwaysValidSchema)(a,n)){let t=r._`${h} >= ${c}`;return void 0!==l&&(t=r._`${t} && ${h} <= ${l}`),void e.pass(t)}a.items=!0;const p=t.name("valid");function m(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(r._`${e}++`),void 0===l?t.if(r._`${e} >= ${c}`,(()=>t.assign(p,!0).break())):(t.if(r._`${e} > ${l}`,(()=>t.assign(p,!1).break())),1===c?t.assign(p,!0):t.if(r._`${e} >= ${c}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,r){t.forRange("i",0,h,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:i.Type.Num,compositeRule:!0},n),r()}))}void 0===l&&1===c?f(p,(()=>t.if(p,(()=>t.break())))):0===c?(t.let(p,!0),void 0!==l&&t.if(r._`${o}.length > 0`,m)):(t.let(p,!1),m()),e.result(p,(()=>e.reset()))}};t.default=s},3025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const r=n(9029),i=n(4227),s=n(5765);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const i=1===t?"property":"properties";return r.str`must have ${i} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:i}})=>r._`{property: ${e},
5
5
  missingProperty: ${i},
6
6
  depsCount: ${t},
7
- deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const r in e)"__proto__"!==r&&((Array.isArray(e[r])?t:n)[r]=e[r]);return[t,n]}(e);a(e,t),c(e,n)}};function a(e,t=e.schema){const{gen:n,data:i,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const c in t){const l=t[c];if(0===l.length)continue;const u=(0,s.propertyInData)(n,i,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of l)(0,s.checkReportMissingProp)(e,t)})):(n.if(r._`${u} && (${(0,s.checkMissingProp)(e,l,a)})`),(0,s.reportMissingProp)(e,a),n.else())}}function c(e,t=e.schema){const{gen:n,data:r,keyword:o,it:a}=e,c=n.name("valid");for(const l in t)(0,i.alwaysValidSchema)(a,t[l])||(n.if((0,s.propertyInData)(n,r,l,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)}),(()=>n.var(c,!0))),e.ok(c))}t.validatePropertyDeps=a,t.validateSchemaDeps=c,t.default=o},4845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,r.validateSchemaDeps)(e)};t.default=i},1239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>r.str`must match "${e.ifClause}" schema`,params:({params:e})=>r._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:s}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=o(s,"then"),c=o(s,"else");if(!a&&!c)return;const l=t.let("valid",!0),u=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}(),e.reset(),a&&c){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,d("then",n),d("else",n))}else a?t.if(u,d("then")):t.if((0,r.not)(u),d("else"));function d(n,i){return()=>{const s=e.subschema({keyword:n},u);t.assign(l,u),e.mergeValidEvaluated(s,l),i?t.assign(i,r._`${n}`):e.setParams({ifClause:n})}}e.pass(l,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,i.alwaysValidSchema)(e,n)}t.default=s},6378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5457),i=n(5354),s=n(494),o=n(3966),a=n(2661),c=n(3025),l=n(9713),u=n(8660),d=n(117),h=n(5333),p=n(7923),m=n(6505),f=n(6163),g=n(5844),y=n(1239),b=n(4426);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,y.default,b.default,l.default,u.default,c.default,d.default,h.default];return e?t.push(i.default,o.default):t.push(r.default,s.default),t.push(a.default),t}},494:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const r=n(9029),i=n(4227),s=n(5765),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,i.alwaysValidSchema)(n,t)||e.ok((0,s.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:s,parentSchema:o,data:a,keyword:c,it:l}=e;!function(e){const{opts:r,errSchemaPath:s}=l,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(r.strictTuples&&!a){const e=`"${c}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${s}"`;(0,i.checkStrictMode)(l,e,r.strictTuples)}}(o),l.opts.unevaluated&&n.length&&!0!==l.items&&(l.items=i.mergeEvaluated.items(s,n.length,l.items));const u=s.name("valid"),d=s.const("len",r._`${a}.length`);n.forEach(((t,n)=>{(0,i.alwaysValidSchema)(l,t)||(s.if(r._`${d} > ${n}`,(()=>e.subschema({keyword:c,schemaProp:n,dataProp:n},u))),e.ok(u))}))}t.validateTuple=a,t.default=o},3966:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(5765),o=n(5457),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:a}=n;r.items=!0,(0,i.alwaysValidSchema)(r,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,s.validateArray)(e)))}};t.default=a},7923:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:i}=e;if((0,r.alwaysValidSchema)(i,n))return void e.fail();const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=i},6163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>r._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&s.discriminator)return;const a=n,c=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block((function(){a.forEach(((n,s)=>{let a;(0,i.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&t.if(r._`${u} && ${c}`).assign(c,!1).assign(l,r._`[${l}, ${s}]`).else(),t.if(u,(()=>{t.assign(c,!0),t.assign(l,s),a&&e.mergeEvaluated(a,r.Name)}))}))})),e.result(c,(()=>e.reset()),(()=>e.error(!0)))}};t.default=s},5333:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o=n(4227),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,r.allSchemaProperties)(n),h=d.filter((e=>(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length||h.length===d.length&&(!l.opts.unevaluated||!0===l.props))return;const p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=t.name("valid");!0===l.props||l.props instanceof i.Name||(l.props=(0,o.evaluatedPropsToName)(t,l.props));const{props:f}=l;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,s.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(n){t.forIn("key",a,(s=>{t.if(i._`${(0,r.usePattern)(e,n)}.test(${s})`,(()=>{const r=h.includes(n);r||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:o.Type.Str},m),l.opts.unevaluated&&!0!==f?t.assign(i._`${f}[${s}]`,!0):r||l.allErrors||t.if((0,i.not)(m),(()=>t.break()))}))}))}!function(){for(const e of d)p&&g(e),l.allErrors?y(e):(t.var(m,!0),y(e),t.if(m))}()}};t.default=a},5354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(494),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,r.validateTuple)(e,"items")};t.default=i},117:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2586),i=n(5765),s=n(4227),o=n(8660),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:c,it:l}=e;"all"===l.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new r.KeywordCxt(l,o.default,"additionalProperties"));const u=(0,i.allSchemaProperties)(n);for(const e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&!0!==l.props&&(l.props=s.mergeEvaluated.props(t,(0,s.toHash)(u),l.props));const d=u.filter((e=>!(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length)return;const h=t.name("valid");for(const n of d)p(n)?m(n):(t.if((0,i.propertyInData)(t,c,n,l.opts.ownProperties)),m(n),l.allErrors||t.else().var(h,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(h);function p(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},h)}}};t.default=a},9713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>r._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e;if((0,i.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",s,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,r.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=s},4426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,r.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=i},5765:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const r=n(9029),i=n(4227),s=n(2023),o=n(4227);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r._`Object.prototype.hasOwnProperty`})}function c(e,t,n){return r._`${a(e)}.call(${t}, ${n})`}function l(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} === undefined`;return i?(0,r.or)(s,(0,r.not)(c(e,t,n))):s}function u(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:i,it:s}=e;n.if(l(n,i,t,s.opts.ownProperties),(()=>{e.setParams({missingProperty:r._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},i,s){return(0,r.or)(...i.map((i=>(0,r.and)(l(e,t,i,n.ownProperties),r._`${s} = ${i}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=c,t.propertyInData=function(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} !== undefined`;return i?r._`${s} && ${c(e,t,n)}`:s},t.noPropertyInData=l,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,i.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:i,schemaPath:o,errorPath:a},it:c},l,u,d){const h=d?r._`${e}, ${t}, ${i}${o}`:t,p=[[s.default.instancePath,(0,r.strConcat)(s.default.instancePath,a)],[s.default.parentData,c.parentData],[s.default.parentDataProperty,c.parentDataProperty],[s.default.rootData,s.default.rootData]];c.opts.dynamicRef&&p.push([s.default.dynamicAnchors,s.default.dynamicAnchors]);const m=r._`${h}, ${n.object(...p)}`;return u!==r.nil?r._`${l}.call(${u}, ${m})`:r._`${l}(${m})`};const d=r._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const i=t.unicodeRegExp?"u":"",{regExp:s}=t.code,a=s(n,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:r._`${"new RegExp"===s.code?d:(0,o.useFunc)(e,s)}(${n}, ${i})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:s,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return c((()=>t.assign(e,!1))),e}return t.var(a,!0),c((()=>t.break())),a;function c(o){const c=t.const("len",r._`${n}.length`);t.forRange("i",0,c,(n=>{e.subschema({keyword:s,dataProp:n,dataPropType:i.Type.Num},a),t.if((0,r.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,i.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),c=t.name("_valid");t.block((()=>n.forEach(((n,i)=>{const o=e.subschema({keyword:s,schemaProp:i,compositeRule:!0},c);t.assign(a,r._`${a} || ${c}`),e.mergeValidEvaluated(o,c)||t.if((0,r.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},3463:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},2128:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3463),i=n(3693),s=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,i.default];t.default=s},3693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const r=n(4551),i=n(5765),s=n(9029),o=n(2023),a=n(3835),c=n(4227),l={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:i}=e,{baseId:o,schemaEnv:c,validateName:l,opts:h,self:p}=i,{root:m}=c;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(c===m)return d(e,l,c,c.$async);const n=t.scopeValue("root",{ref:m});return d(e,s._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new r.default(i.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);d(e,n,t,t.$async)}(f):function(r){const i=t.scopeValue("schema",!0===h.code.source?{ref:r,code:(0,s.stringify)(r)}:{ref:r}),o=t.name("valid"),a=e.subschema({schema:r,dataTypes:[],schemaPath:s.nil,topSchemaRef:i,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function u(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):s._`${n.scopeValue("wrapper",{ref:t})}.validate`}function d(e,t,n,r){const{gen:a,it:l}=e,{allErrors:u,schemaEnv:d,opts:h}=l,p=h.passContext?o.default.this:s.nil;function m(e){const t=s._`${e}.errors`;a.assign(o.default.vErrors,s._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,s._`${o.default.vErrors}.length`)}function f(e){var t;if(!l.opts.unevaluated)return;const r=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(r&&!r.dynamicProps)void 0!==r.props&&(l.props=c.mergeEvaluated.props(a,r.props,l.props));else{const t=a.var("props",s._`${e}.evaluated.props`);l.props=c.mergeEvaluated.props(a,t,l.props,s.Name)}if(!0!==l.items)if(r&&!r.dynamicItems)void 0!==r.items&&(l.items=c.mergeEvaluated.items(a,r.items,l.items));else{const t=a.var("items",s._`${e}.evaluated.items`);l.items=c.mergeEvaluated.items(a,t,l.items,s.Name)}}r?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(s._`await ${(0,i.callValidateCode)(e,t,p)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(s._`!(${e} instanceof ${l.ValidationError})`,(()=>a.throw(e))),m(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,i.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=u,t.callRef=d,t.default=l},6653:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(7652),s=n(3835),o=n(4551),a=n(4227),c={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>r._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=c.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),m=t.const("tag",r._`${n}${(0,r.getProperty)(h)}`);function f(n){const i=t.name("valid"),s=e.subschema({keyword:"oneOf",schemaProp:n},i);return e.mergeEvaluated(s,r.Name),i}t.if(r._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=i(l);let r=!0;for(let t=0;t<d.length;t++){let l=d[t];if((null==l?void 0:l.$ref)&&!(0,a.schemaHasRulesButRef)(l,u.self.RULES)){const e=l.$ref;if(l=s.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),l instanceof s.SchemaEnv&&(l=l.schema),void 0===l)throw new o.default(u.opts.uriResolver,u.baseId,e)}const p=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[h];if("object"!=typeof p)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);r=r&&(n||i(l)),c(p,t)}if(!r)throw new Error(`discriminator: "${h}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(h)}function c(e,t){if(e.const)p(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const n of e.enum)p(n,t)}}function p(e,n){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=n}}();t.if(!1);for(const e in n)t.elseIf(r._`${m} === ${e}`),t.assign(p,f(n[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:m,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:m,tagName:h}))),e.ok(p)}};t.default=c},7652:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(n||(t.DiscrError=n={}))},6105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(5520),a=n(5413),c=n(3265),l=n(7532),u=n(9857),d=[o.default,r.default,i.default,(0,s.default)(!0),l.default,u.metadataVocabulary,u.contentVocabulary,a.default,c.default];t.default=d},6144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(7532),a=n(9857),c=[r.default,i.default,(0,s.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=c},2476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const r=n(9029),i=n(2023),s=n(3835),o=n(3693),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>c(e,e.schema)};function c(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const c=r._`${i.default.dynamicAnchors}${(0,r.getProperty)(t)}`,l="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:r}=e.it,{root:i,baseId:a,localRefs:c,meta:l}=t.root,{schemaId:u}=r.opts,d=new s.SchemaEnv({schema:n,schemaId:u,root:i,baseId:a,localRefs:c,meta:l});return s.compileSchema.call(r,d),(0,o.getValidate)(e,d)}(e);n.if(r._`!${c}`,(()=>n.assign(c,l)))}t.dynamicAnchor=c,t.default=a},3252:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const r=n(9029),i=n(2023),s=n(3693),o={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)};function a(e,t){const{gen:n,keyword:o,it:a}=e;if("#"!==t[0])throw new Error(`"${o}" only supports hash fragment reference`);const c=t.slice(1);if(a.allErrors)l();else{const t=n.let("valid",!1);l(t),e.ok(t)}function l(e){if(a.schemaEnv.root.dynamicAnchors[c]){const t=n.let("_v",r._`${i.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,r){return r?()=>n.block((()=>{(0,s.callRef)(e,t),n.let(r,!0)})):()=>(0,s.callRef)(e,t)}}t.dynamicRef=a,t.default=o},5520:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(3252),s=n(2721),o=n(3799),a=[r.default,i.default,s.default,o.default];t.default=a},2721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(4227),s={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,r.dynamicAnchor)(e,""):(0,i.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=s},3799:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3252),i={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,r.dynamicRef)(e,e.schema)};t.default=i},4737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match format "${e}"`,params:({schemaCode:e})=>r._`{format: ${e}}`},code(e,t){const{gen:n,data:i,$data:s,schema:o,schemaCode:a,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:h}=c;l.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:h.formats,code:l.code.formats}),o=n.const("fDef",r._`${s}[${a}]`),c=n.let("fType"),u=n.let("format");n.if(r._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(c,r._`${o}.type || "string"`).assign(u,r._`${o}.validate`)),(()=>n.assign(c,r._`"string"`).assign(u,o))),e.fail$data((0,r.or)(!1===l.strictSchema?r.nil:r._`${a} && !${u}`,function(){const e=d.$async?r._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:r._`${u}(${i})`,n=r._`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return r._`${u} && ${u} !== true && ${c} === ${t} && !${n}`}()))}():function(){const s=h.formats[o];if(!s)return void function(){if(!1!==l.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}h.logger.warn(e())}();if(!0===s)return;const[a,c,p]=function(e){const t=e instanceof RegExp?(0,r.regexpCode)(e):l.code.formats?r._`${l.code.formats}${(0,r.getProperty)(o)}`:void 0,i=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,r._`${i}.validate`]}(s);a===t&&e.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!d.$async)throw new Error("async format in sync schema");return r._`await ${p}(${i})`}return"function"==typeof c?r._`${p}(${i})`:r._`${p}.test(${i})`}())}())}};t.default=i},7532:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=[n(4737).default];t.default=r},9857:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},5413:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1846),i=n(4845),s=n(2626),o=[r.default,i.default,s.default];t.default=o},3265:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(392),i=n(3445),s=[r.default,i.default];t.default=s},3445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e,a=o.items||0;if(!0===a)return;const c=t.const("len",r._`${s}.length`);if(!1===n)e.setParams({len:a}),e.fail(r._`${c} > ${a}`);else if("object"==typeof n&&!(0,i.alwaysValidSchema)(o,n)){const n=t.var("valid",r._`${c} <= ${a}`);t.if((0,r.not)(n),(()=>function(n,s){t.forRange("i",s,c,(s=>{e.subschema({keyword:"unevaluatedItems",dataProp:s,dataPropType:i.Type.Num},n),o.allErrors||t.if((0,r.not)(n),(()=>t.break()))}))}(n,a))),e.ok(n)}o.items=!0}};t.default=s},392:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(2023),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>r._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:c}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:l,props:u}=c;function d(s){if(!1===n)return e.setParams({unevaluatedProperty:s}),e.error(),void(l||t.break());if(!(0,i.alwaysValidSchema)(c,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:s,dataPropType:i.Type.Str},n),l||t.if((0,r.not)(n),(()=>t.break()))}}u instanceof r.Name?t.if(r._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return r._`!${e} || !${e}[${t}]`}(u,e),(()=>d(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?d(e):t.if(function(e,t){const n=[];for(const i in e)!0===e[i]&&n.push(r._`${t} !== ${i}`);return(0,r.and)(...n)}(u,e),(()=>d(e))))),c.props=!0,e.ok(r._`${a} === ${s.default.errors}`)}};t.default=o},7935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>r._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:c}=e;o||c&&"object"==typeof c?e.fail$data(r._`!${(0,i.useFunc)(t,s.default)}(${n}, ${a})`):e.fail(r._`${c} !== ${n}`)}};t.default=o},1846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:e=>(0,r.validatePropertyDeps)(e)};t.default=i},8643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>r._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:c,it:l}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=l.opts.loopEnum;let d;const h=()=>null!=d?d:d=(0,i.useFunc)(t,s.default);let p;if(u||o)p=t.let("valid"),e.block$data(p,(function(){t.assign(p,!1),t.forOf("v",c,(e=>t.if(r._`${h()}(${n}, ${e})`,(()=>t.assign(p,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",c);p=(0,r.or)(...a.map(((t,i)=>function(e,t){const i=a[t];return"object"==typeof i&&null!==i?r._`${h()}(${n}, ${e}[${t}])`:r._`${n} === ${i}`}(e,i))))}e.pass(p)}};t.default=o},7060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5882),i=n(3439),s=n(7307),o=n(422),a=n(4486),c=n(4003),l=n(1163),u=n(617),d=n(7935),h=n(8643),p=[r.default,i.default,s.default,o.default,a.default,c.default,l.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,h.default];t.default=p},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,r.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=i},1163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxItems"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`${n}.length ${s} ${i}`)}};t.default=i},7307:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(3853),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,c="maxLength"===t?r.operators.GT:r.operators.LT,l=!1===a.opts.unicode?r._`${n}.length`:r._`${(0,i.useFunc)(e.gen,s.default)}(${n})`;e.fail$data(r._`${l} ${c} ${o}`)}};t.default=o},5882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=r.operators,s={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:e,schemaCode:t})=>r.str`must be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${s[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(s),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:n,schemaCode:i}=e;e.fail$data(r._`${n} ${s[t].fail} ${i} || isNaN(${n})`)}};t.default=a},4486:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxProperties"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`Object.keys(${n}).length ${s} ${i}`)}};t.default=i},3439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>r.str`must be multiple of ${e}`,params:({schemaCode:e})=>r._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:i,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),c=o?r._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:r._`${a} !== parseInt(${a})`;e.fail$data(r._`(${i} === 0 || (${a} = ${n}/${i}, ${c}))`)}};t.default=i},422:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match pattern "${e}"`,params:({schemaCode:e})=>i._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:s,schemaCode:o,it:a}=e,c=a.opts.unicodeRegExp?"u":"",l=n?i._`(new RegExp(${o}, ${c}))`:(0,r.usePattern)(e,s);e.fail$data(i._`!${l}.test(${t})`)}};t.default=s},4003:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:c,it:l}=e,{opts:u}=l;if(!c&&0===n.length)return;const d=n.length>=u.loopRequired;if(l.allErrors?function(){if(d||c)e.block$data(i.nil,h);else for(const t of n)(0,r.checkReportMissingProp)(e,t)}():function(){const s=t.let("missing");if(d||c){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,s){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(s,(0,r.propertyInData)(t,a,n,u.ownProperties)),t.if((0,i.not)(s),(()=>{e.error(),t.break()}))}),i.nil)}(s,n))),e.ok(n)}else t.if((0,r.checkMissingProp)(e,n,s)),(0,r.reportMissingProp)(e,s),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:r}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!r.has(e)){const t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,s.checkStrictMode)(l,t,l.opts.strictRequired)}}function h(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,r.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(208),i=n(9029),s=n(4227),o=n(6250),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!a&&!c)return;const h=t.let("valid"),p=l.items?(0,r.getSchemaTypes)(l.items):[];function m(s,o){const a=t.name("item"),c=(0,r.checkDataTypes)(p,a,d.opts.strictNumbers,r.DataType.Wrong),l=t.const("indices",i._`{}`);t.for(i._`;${s}--;`,(()=>{t.let(a,i._`${n}[${s}]`),t.if(c,i._`continue`),p.length>1&&t.if(i._`typeof ${a} == "string"`,i._`${a} += "_"`),t.if(i._`typeof ${l}[${a}] == "number"`,(()=>{t.assign(o,i._`${l}[${a}]`),e.error(),t.assign(h,!1).break()})).code(i._`${l}[${a}] = ${s}`)}))}function f(r,a){const c=(0,s.useFunc)(t,o.default),l=t.name("outer");t.label(l).for(i._`;${r}--;`,(()=>t.for(i._`${a} = ${r}; ${a}--;`,(()=>t.if(i._`${c}(${n}[${r}], ${n}[${a}])`,(()=>{e.error(),t.assign(h,!1).break(l)}))))))}e.block$data(h,(function(){const r=t.let("i",i._`${n}.length`),s=t.let("j");e.setParams({i:r,j:s}),t.assign(h,!0),t.if(i._`${r} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(r,s)))}),i._`${u} === false`),e.ok(h)}};t.default=a},5488:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,"\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}","",{version:3,sources:["webpack://./css/cell-renderer.css"],names:[],mappings:";AACA;IACI,8CAA8C;AAClD;;AAEA;IACI,eAAe;AACnB",sourcesContent:["\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}"],sourceRoot:""}]);const a=o},5999:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.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=o},857:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}\n\n.monomer-manager-form-tab-control input.d4-invalid {\n background: #ff000030;\n}","",{version:3,sources:["webpack://./css/monomer-manager.css"],names:[],mappings:"AAAA;IACI,2BAA2B;AAC/B;;AAEA;IACI,sBAAsB;IACtB,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;AAC3B;;AAEA;IACI,0BAA0B;AAC9B;AACA;IACI,0BAA0B;AAC9B;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,WAAW;IACX,gBAAgB;IAChB,uBAAuB;IACvB,mBAAmB;AACvB;;AAEA;IACI,mBAAmB;IACnB,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;AACrB;;AAEA;IACI,8BAA8B;AAClC;;AAEA;IACI,+BAA+B;IAC/B,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,iBAAiB;AACrB;;AAEA;IACI,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;AACpB;;AAEA;IACI,qBAAqB;AACzB",sourcesContent:[".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}\n\n.monomer-manager-form-tab-control input.d4-invalid {\n background: #ff000030;\n}"],sourceRoot:""}]);const a=o},6369:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.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=o},7939:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.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}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 700px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\n}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\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;;AAEhB;;AAEA;IACI,WAAW;AACf;AACA;IACI,gBAAgB;AACpB;;AAEA;IACI,wBAAwB;AAC5B;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,4BAA4B;AAChC;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,8BAA8B;IAC9B,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;IACvB,gBAAgB;AACpB;;AAEA;IACI,4BAA4B;AAChC;;AAEA;IACI,kBAAkB;AACtB",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}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 700px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\n}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\n}"],sourceRoot:""}]);const a=o},3017:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n","",{version:3,sources:["webpack://./src/utils/monomer-lib/library-file-manager/style.css"],names:[],mappings:"AAAA;EACE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;AACb",sourcesContent:[".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n"],sourceRoot:""}]);const a=o},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(o[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&o[u[0]]||(void 0!==s&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},1354:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),s="/*# ".concat(i," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},2017:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;0!=i--;){var o=s[i];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9982:function(e,t,n){var r;!function(){var t={};!function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(e,n,r,i,s){for(var o,a,c,l,u,d,h,p,m,f,g,y,b;s>=64;){for(o=n[0],a=n[1],c=n[2],l=n[3],u=n[4],d=n[5],h=n[6],p=n[7],f=0;f<16;f++)g=i+4*f,e[f]=(255&r[g])<<24|(255&r[g+1])<<16|(255&r[g+2])<<8|255&r[g+3];for(f=16;f<64;f++)y=((m=e[f-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,b=((m=e[f-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,e[f]=(y+e[f-7]|0)+(b+e[f-16]|0);for(f=0;f<64;f++)y=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&d^~u&h)|0)+(p+(t[f]+e[f]|0)|0)|0,b=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&c^a&c)|0,p=h,h=d,d=u,u=l+y|0,l=c,c=a,a=o,o=y+b|0;n[0]+=o,n[1]+=a,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=d,n[6]+=h,n[7]+=p,i+=64,s-=64}return i}var r=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.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 t.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},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=n(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,i=t/536870912|0,s=t<<3,o=t%64<56?64:128;this.buffer[r]=128;for(var a=r+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=i>>>24&255,this.buffer[o-7]=i>>>16&255,this.buffer[o-6]=i>>>8&255,this.buffer[o-5]=i>>>0&255,this.buffer[o-4]=s>>>24&255,this.buffer[o-3]=s>>>16&255,this.buffer[o-2]=s>>>8&255,this.buffer[o-1]=s>>>0&255,n(this.temp,this.state,this.buffer,0,o),this.finished=!0}for(a=0;a<8;a++)e[4*a+0]=this.state[a]>>>24&255,e[4*a+1]=this.state[a]>>>16&255,e[4*a+2]=this.state[a]>>>8&255,e[4*a+3]=this.state[a]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var n=0;n<this.state.length;n++)this.state[n]=e[n];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=r;var i=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new r).update(e).finish(t).clean();else for(var n=0;n<e.length;n++)t[n]=e[n];for(n=0;n<t.length;n++)t[n]^=54;for(this.inner.update(t),n=0;n<t.length;n++)t[n]^=106;for(this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<t.length;n++)t[n]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();function s(e){var t=(new r).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new i(e).update(t),r=n.digest();return n.clean(),r}function a(e,t,n,r){var i=r[0];if(0===i)throw new Error("hkdf: cannot expand more");t.reset(),i>1&&t.update(e),n&&t.update(n),t.update(r),t.finish(e),r[0]++}e.HMAC=i,e.hash=s,e.default=s,e.hmac=o;var c=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,r){void 0===t&&(t=c),void 0===r&&(r=32);for(var s=new Uint8Array([1]),l=o(t,e),u=new i(l),d=new Uint8Array(u.digestLength),h=d.length,p=new Uint8Array(r),m=0;m<r;m++)h===d.length&&(a(d,u,n,s),h=0),p[m]=d[h++];return u.clean(),d.fill(0),s.fill(0),p},e.pbkdf2=function(e,t,n,r){for(var s=new i(e),o=s.digestLength,a=new Uint8Array(4),c=new Uint8Array(o),l=new Uint8Array(o),u=new Uint8Array(r),d=0;d*o<r;d++){var h=d+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,s.reset(),s.update(t),s.update(a),s.finish(l);for(var p=0;p<o;p++)c[p]=l[p];for(p=2;p<=n;p++){s.reset(),s.update(l).finish(l);for(var m=0;m<o;m++)c[m]^=l[m]}for(p=0;p<o&&d*o+p<r;p++)u[d*o+p]=c[p]}for(d=0;d<o;d++)c[d]=l[d]=0;for(d=0;d<4;d++)a[d]=0;return s.clean(),u}}(t);var i=t.default;for(var s in t)i[s]=t[s];"object"==typeof e.exports?e.exports=i:void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r)}()},2787:(e,t,n)=>{"use strict";n.d(t,{I:()=>i});const r=new Uint32Array(65536),i=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return 0===t.length?e.length:e.length<=32?((e,t)=>{const n=e.length,i=t.length,s=1<<n-1;let o=-1,a=0,c=n,l=n;for(;l--;)r[e.charCodeAt(l)]|=1<<l;for(l=0;l<i;l++){let e=r[t.charCodeAt(l)];const n=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&s&&c++,o&s&&c--,a=a<<1|1,o=o<<1|~(n|a),a&=n}for(l=n;l--;)r[e.charCodeAt(l)]=0;return c})(e,t):((e,t)=>{const n=t.length,i=e.length,s=[],o=[],a=Math.ceil(n/32),c=Math.ceil(i/32);for(let e=0;e<a;e++)o[e]=-1,s[e]=0;let l=0;for(;l<c-1;l++){let a=0,c=-1;const u=32*l,d=Math.min(32,i)+u;for(let t=u;t<d;t++)r[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],i=o[e/32|0]>>>e&1,l=s[e/32|0]>>>e&1,u=n|a,d=((n|l)&c)+c^c|n|l;let h=a|~(d|c),p=c&d;h>>>31^i&&(o[e/32|0]^=1<<e),p>>>31^l&&(s[e/32|0]^=1<<e),h=h<<1|i,p=p<<1|l,c=p|~(u|h),a=h&u}for(let t=u;t<d;t++)r[e.charCodeAt(t)]=0}let u=0,d=-1;const h=32*l,p=Math.min(32,i-h)+h;for(let t=h;t<p;t++)r[e.charCodeAt(t)]|=1<<t;let m=i;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,c=s[e/32|0]>>>e&1,l=n|u,h=((n|c)&d)+d^d|n|c;let p=u|~(h|d),f=d&h;m+=p>>>i-1&1,m-=f>>>i-1&1,p>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^c&&(s[e/32|0]^=1<<e),p=p<<1|a,f=f<<1|c,d=f|~(l|p),u=p&l}for(let t=h;t<p;t++)r[e.charCodeAt(t)]=0;return m})(e,t)}},9937:e=>{e.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(e,t)=>{t.assign=function(e){e=e||{};var t,n,r,i=Array.prototype.slice.call(arguments).slice(1);for(t=0,r=i.length;t<r;t++)if(i[t])for(n in i[t])e[n]=i[t][n];return e},t.validateSettings=function(e){return"linLogMode"in e&&"boolean"!=typeof e.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in e&&"boolean"!=typeof e.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in e&&"boolean"!=typeof e.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in e&&"number"!=typeof e.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in e)||"number"==typeof e.scalingRatio&&e.scalingRatio>=0?"strongGravityMode"in e&&"boolean"!=typeof e.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in e)||"number"==typeof e.gravity&&e.gravity>=0?"slowDown"in e&&!("number"==typeof e.slowDown||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in e&&"boolean"!=typeof e.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in e)||"number"==typeof e.barnesHutTheta&&e.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},t.graphToByteArrays=function(e,t){var n,r=e.order,i=e.size,s={},o=new Float32Array(10*r),a=new Float32Array(3*i);return n=0,e.forEachNode((function(e,t){s[e]=n,o[n]=t.x,o[n+1]=t.y,o[n+2]=0,o[n+3]=0,o[n+4]=0,o[n+5]=0,o[n+6]=1,o[n+7]=1,o[n+8]=t.size||1,o[n+9]=t.fixed?1:0,n+=10})),n=0,e.forEachEdge((function(e,r,i,c,l,u,d){var h=s[i],p=s[c],m=t(e,r,i,c,l,u,d);o[h+6]+=m,o[p+6]+=m,a[n]=h,a[n+1]=p,a[n+2]=m,n+=3})),{nodes:o,edges:a}},t.assignLayoutChanges=function(e,t,n){var r=0;e.updateEachNodeAttributes((function(e,i){return i.x=t[r],i.y=t[r+1],r+=10,n?n(e,i):i}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,r){t[n]=r.x,t[n+1]=r.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var r=e.nodes(),i={},s=0,o=0,a=t.length;s<a;s+=10){if(n){var c=Object.assign({},e.getNodeAttributes(r[o]));c.x=t[s],c.y=t[s+1],c=n(r[o],c),i[r[o]]={x:c.x,y:c.y}}else i[r[o]]={x:t[s],y:t[s+1]};o++}return i},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),i=new Worker(r);return t.revokeObjectURL(r),i}},8903:(e,t,n)=>{var r=n(1736),i=n(8153).Fd,s=n(2561),o=n(1782),a=n(9937);function c(e,t,n){if(!r(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var c=n.iterations;if("number"!=typeof c)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(c<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var l=i("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,d=o.assign({},a,n.settings),h=o.validateSettings(d);if(h)throw new Error("graphology-layout-forceatlas2: "+h.message);var p,m=o.graphToByteArrays(t,l);for(p=0;p<c;p++)s(d,m.nodes,m.edges);if(!e)return o.collectLayoutChanges(t,m.nodes);o.assignLayoutChanges(t,m.nodes,u)}var l=c.bind(null,!1);l.assign=c.bind(null,!0),l.inferSettings=function(e){var t="number"==typeof e?e:e.order;return{barnesHutOptimize:t>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(t)}},e.exports=l},2561:e=>{var t=10;e.exports=function(e,n,r){var i,s,o,a,c,l,u,d,h,p,m,f,g,y,b,w,v,A,C,E,T,S,_,x=n.length,M=r.length,P=e.adjustSizes,L=e.barnesHutTheta*e.barnesHutTheta,N=[];for(o=0;o<x;o+=t)n[o+4]=n[o+2],n[o+5]=n[o+3],n[o+2]=0,n[o+3]=0;if(e.outboundAttractionDistribution){for(m=0,o=0;o<x;o+=t)m+=n[o+6];m/=x/t}if(e.barnesHutOptimize){var $,I,R,O=1/0,k=-1/0,D=1/0,G=-1/0;for(o=0;o<x;o+=t)O=Math.min(O,n[o+0]),k=Math.max(k,n[o+0]),D=Math.min(D,n[o+1]),G=Math.max(G,n[o+1]);var H=k-O,F=G-D;for(H>F?G=(D-=(H-F)/2)+H:k=(O-=(F-H)/2)+F,N[0]=-1,N[1]=(O+k)/2,N[2]=(D+G)/2,N[3]=Math.max(k-O,G-D),N[4]=-1,N[5]=-1,N[6]=0,N[7]=0,N[8]=0,i=1,o=0;o<x;o+=t)for(s=0,R=3;;){if(!(N[s+5]>=0)){if(N[s+0]<0){N[s+0]=o;break}if(N[s+5]=9*i,d=N[s+3]/2,N[(h=N[s+5])+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=N[s+4],N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,i+=4,$=n[N[s+0]+0]<N[s+1]?n[N[s+0]+1]<N[s+2]?N[s+5]:N[s+5]+9:n[N[s+0]+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+6]=n[N[s+0]+6],N[s+7]=n[N[s+0]+0],N[s+8]=n[N[s+0]+1],N[$+0]=N[s+0],N[s+0]=-1,$===(I=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27)){if(R--){s=$;continue}R=3;break}N[I+0]=o;break}$=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+7]=(N[s+7]*N[s+6]+n[o+0]*n[o+6])/(N[s+6]+n[o+6]),N[s+8]=(N[s+8]*N[s+6]+n[o+1]*n[o+6])/(N[s+6]+n[o+6]),N[s+6]+=n[o+6],s=$}}if(e.barnesHutOptimize){for(f=e.scalingRatio,o=0;o<x;o+=t)for(s=0;;)if(N[s+5]>=0){if(w=Math.pow(n[o+0]-N[s+7],2)+Math.pow(n[o+1]-N[s+8],2),4*(p=N[s+3])*p/w<L){if(g=n[o+0]-N[s+7],y=n[o+1]-N[s+8],!0===P?w>0?(v=f*n[o+6]*N[s+6]/w,n[o+2]+=g*v,n[o+3]+=y*v):w<0&&(v=-f*n[o+6]*N[s+6]/Math.sqrt(w),n[o+2]+=g*v,n[o+3]+=y*v):w>0&&(v=f*n[o+6]*N[s+6]/w,n[o+2]+=g*v,n[o+3]+=y*v),(s=N[s+4])<0)break;continue}s=N[s+5]}else if((l=N[s+0])>=0&&l!==o&&(w=(g=n[o+0]-n[l+0])*g+(y=n[o+1]-n[l+1])*y,!0===P?w>0?(v=f*n[o+6]*n[l+6]/w,n[o+2]+=g*v,n[o+3]+=y*v):w<0&&(v=-f*n[o+6]*n[l+6]/Math.sqrt(w),n[o+2]+=g*v,n[o+3]+=y*v):w>0&&(v=f*n[o+6]*n[l+6]/w,n[o+2]+=g*v,n[o+3]+=y*v)),(s=N[s+4])<0)break}else for(f=e.scalingRatio,a=0;a<x;a+=t)for(c=0;c<a;c+=t)g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===P?(w=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8])>0?(v=f*n[a+6]*n[c+6]/w/w,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):w<0&&(v=100*f*n[a+6]*n[c+6],n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):(w=Math.sqrt(g*g+y*y))>0&&(v=f*n[a+6]*n[c+6]/w/w,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);for(h=e.gravity/e.scalingRatio,f=e.scalingRatio,o=0;o<x;o+=t)v=0,g=n[o+0],y=n[o+1],w=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.strongGravityMode?w>0&&(v=f*n[o+6]*h):w>0&&(v=f*n[o+6]*h/w),n[o+2]-=g*v,n[o+3]-=y*v;for(f=1*(e.outboundAttractionDistribution?m:1),u=0;u<M;u+=3)a=r[u+0],c=r[u+1],d=r[u+2],b=Math.pow(d,e.edgeWeightInfluence),g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===P?(w=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8],e.linLogMode?e.outboundAttractionDistribution?w>0&&(v=-f*b*Math.log(1+w)/w/n[a+6]):w>0&&(v=-f*b*Math.log(1+w)/w):e.outboundAttractionDistribution?w>0&&(v=-f*b/n[a+6]):w>0&&(v=-f*b)):(w=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.linLogMode?e.outboundAttractionDistribution?w>0&&(v=-f*b*Math.log(1+w)/w/n[a+6]):w>0&&(v=-f*b*Math.log(1+w)/w):e.outboundAttractionDistribution?(w=1,v=-f*b/n[a+6]):(w=1,v=-f*b)),w>0&&(n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);if(!0===P)for(o=0;o<x;o+=t)1!==n[o+9]&&((A=Math.sqrt(Math.pow(n[o+2],2)+Math.pow(n[o+3],2)))>10&&(n[o+2]=10*n[o+2]/A,n[o+3]=10*n[o+3]/A),C=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),E=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=.1*Math.log(1+E)/(1+Math.sqrt(C)),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);else for(o=0;o<x;o+=t)1!==n[o+9]&&(C=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),E=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=n[o+7]*Math.log(1+E)/(1+Math.sqrt(C)),n[o+7]=Math.min(1,Math.sqrt(T*(Math.pow(n[o+2],2)+Math.pow(n[o+3],2))/(1+Math.sqrt(C)))),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);return{}}},8153:(e,t)=>{function n(e){return"number"!=typeof e||isNaN(e)?1:e}t.Fd=function(e){return function(e,t){var n={},r=function(e){return void 0===e?t:e};"function"==typeof t&&(r=t);var i=function(t){return r(t[e])},s=function(){return r(void 0)};return"string"==typeof e?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return i(t)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof e?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(t,n){var i=t.extremities(n);return r(e(n,t.getEdgeAttributes(n),i[0],i[1],t.getNodeAttributes(i[0]),t.getNodeAttributes(i[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,i,s,o,a,c){return r(e(t,n,i,s,o,a,c))},n.fromPartialEntry=function(t,n,i,s){return r(e(t,n,i,s))},n.fromMinimalEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=s,n.fromGraph=s,n.fromEntry=s,n.fromMinimalEntry=s),n}(e,n)}},1736:e=>{e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},934:function(e){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function i(e,t,n){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var s=new(Function.bind.apply(e,i));return n&&r(s,n.prototype),s},i.apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||(s=e,-1===Function.toString.call(s).indexOf("[native code]")))return e;var s;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,e)},s(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var a=function(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++)if(arguments[t])for(var r in arguments[t])e[r]=arguments[t][r];return e};function c(e,t,n,r){var i=e._nodes.get(t),s=null;return i?s="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n]:s}function l(t){return"object"===e(t)&&null!==t}function u(e){var t;for(t in e)return!1;return!0}function d(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function h(e,t,n){var r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function p(e){return!(!l(e)||e.attributes&&!Array.isArray(e.attributes))}"function"==typeof Object.assign&&(a=Object.assign);var m,f={exports:{}},g="object"==typeof Reflect?Reflect:null,y=g&&"function"==typeof g.apply?g.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};m=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var b=Number.isNaN||function(e){return e!=e};function w(){w.init.call(this)}f.exports=w,f.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,s),r(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}P(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&P(e,"error",t,{once:!0})}(e,i)}))},w.EventEmitter=w,w.prototype._events=void 0,w.prototype._eventsCount=0,w.prototype._maxListeners=void 0;var v=10;function A(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function C(e){return void 0===e._maxListeners?w.defaultMaxListeners:e._maxListeners}function E(e,t,n,r){var i,s,o,a;if(A(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=C(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function T(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=T.bind(r);return i.listener=n,r.wrapFn=i,i}function _(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):M(i,i.length)}function x(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function M(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function P(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){r.once&&e.removeEventListener(t,i),n(s)}))}}function L(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(w,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");v=e}}),w.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},w.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},w.prototype.getMaxListeners=function(){return C(this)},w.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)y(a,this,t);else{var c=a.length,l=M(a,c);for(n=0;n<c;++n)y(l[n],this,t)}return!0},w.prototype.addListener=function(e,t){return E(this,e,t,!1)},w.prototype.on=w.prototype.addListener,w.prototype.prependListener=function(e,t){return E(this,e,t,!0)},w.prototype.once=function(e,t){return A(t),this.on(e,S(this,e,t)),this},w.prototype.prependOnceListener=function(e,t){return A(t),this.prependListener(e,S(this,e,t)),this},w.prototype.removeListener=function(e,t){var n,r,i,s,o;if(A(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},w.prototype.off=w.prototype.removeListener,w.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},w.prototype.listeners=function(e){return _(this,e,!0)},w.prototype.rawListeners=function(e){return _(this,e,!1)},w.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):x.call(e,t)},w.prototype.listenerCount=x,w.prototype.eventNames=function(){return this._eventsCount>0?m(this._events):[]},"undefined"!=typeof Symbol&&(L.prototype[Symbol.iterator]=function(){return this}),L.of=function(){var e=arguments,t=e.length,n=0;return new L((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},L.empty=function(){return new L((function(){return{done:!0}}))},L.fromSequence=function(e){var t=0,n=e.length;return new L((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},L.is=function(e){return e instanceof L||"object"==typeof e&&null!==e&&"function"==typeof e.next};var N=L,$={};$.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,$.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var I=N,R=$,O=R.ARRAY_BUFFER_SUPPORT,k=R.SYMBOL_SUPPORT,D=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||O&&ArrayBuffer.isView(e)?I.fromSequence(e):"object"!=typeof e||null===e?null:k&&"function"==typeof e[Symbol.iterator]?e[Symbol.iterator]():"function"==typeof e.next?e:null}(e);if(!t)throw new Error("obliterator: target is not iterable nor a valid iterator.");return t},G=D,H=function(e,t){for(var n,r=arguments.length>1?t:1/0,i=r!==1/0?new Array(r):[],s=0,o=G(e);;){if(s===r)return i;if((n=o.next()).done)return s!==t&&(i.length=s),i;i[s++]=n.value}},F=function(e){function n(t){var n;return(n=e.call(this)||this).name="GraphError",n.message=t,n}return t(n,e),n}(s(Error)),U=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),V=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),B=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F);function Y(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function j(e,t){this.key=e,this.attributes=t,this.clear()}function K(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}function z(e,t,n,r,i,s,o){var a,c,l,u;if(r=""+r,0===n){if(!(a=e._nodes.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" node in the graph.'));l=i,u=s}else if(3===n){if(i=""+i,!(c=e._edges.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));var d=c.source.key,h=c.target.key;if(r===d)a=c.target;else{if(r!==h)throw new V("Graph.".concat(t,': the "').concat(r,'" node is not attached to the "').concat(i,'" edge (').concat(d,", ").concat(h,")."));a=c.source}l=s,u=o}else{if(!(c=e._edges.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));a=1===n?c.source:c.target,l=i,u=s}return[a,l,u]}Y.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},W.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},j.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},K.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,r=this.target.key;this.source[e][r]=this,this.undirected&&n===r||(this.target[t][n]=this)},K.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,r=this.target.key;this.undirected&&(e=t="undirected");var i=this.source[e],s=i[r];if(void 0===s)return i[r]=this,void(this.undirected&&n===r||(this.target[t][n]=this));s.previous=this,this.next=s,i[r]=this,this.target[t][n]=this},K.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][t],delete this.target[r][e]},K.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var q=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes[a]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){return z(this,t,n,e,r)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes.hasOwnProperty(a)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=z(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];return a.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=z(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];if("function"!=typeof l)throw new U("Graph.".concat(t,": updater should be a function."));var u=a.attributes,d=l(u[c]);return u[c]=d,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];if(!l(a))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],c=s[1];if(!l(c))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(o.attributes,c),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:c}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];if("function"!=typeof a)throw new U("Graph.".concat(t,": provided updater is not a function."));return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}],Z=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes[r]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+e,s=""+arguments[1];if(!(r=c(this,i,s,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(i,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes.hasOwnProperty(r)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return s.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof i)throw new U("Graph.".concat(t,": updater should be a function."));return s.attributes[r]=i(s.attributes[r]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof r)throw new U("Graph.".concat(t,": provided updater is not a function."));return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}],X=N,J=D,Q=function(){var e=arguments,t=null,n=-1;return new X((function(){for(var r=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=J(e[n])}if(!0!==(r=t.next()).done)break;t=null}return r}))},ee=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function te(e,t,n,r){var i=!1;for(var s in t)if(s!==r){var o=t[s];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function ne(e,t,n,r){var i,s,o,a=!1;for(var c in t)if(c!==r){i=t[c];do{if(s=i.source,o=i.target,a=n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),e&&a)return i.key;i=i.next}while(void 0!==i)}}function re(e,t){var n,r=Object.keys(e),i=r.length,s=0;return new N((function(){do{if(n)n=n.next;else{if(s>=i)return{done:!0};var o=r[s++];if(o===t){n=void 0;continue}n=e[o]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function ie(e,t,n,r){var i=t[n];if(i){var s=i.source,o=i.target;return r(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&e?i.key:void 0}}function se(e,t,n,r){var i=t[n];if(i){var s=!1;do{if(s=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&s)return i.key;i=i.next}while(void 0!==i)}}function oe(e,t){var n=e[t];return void 0!==n.next?new N((function(){if(!n)return{done:!0};var e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}})):N.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function ae(e,t,n,r){if(0!==t.size)for(var i,s,o="mixed"!==n&&n!==t.type,a="undirected"===n,c=!1,l=t._edges.values();!0!==(i=l.next()).done;)if(s=i.value,!o||s.undirected===a){var u=s,d=u.key,h=u.attributes,p=u.source,m=u.target;if(c=r(d,h,p.key,m.key,p.attributes,m.attributes,s.undirected),e&&c)return d}}function ce(e,t,n,r,i,s){var o,a=t?ne:te;if("undirected"!==n){if("out"!==r&&(o=a(e,i.in,s),e&&o))return o;if("in"!==r&&(o=a(e,i.out,s,r?void 0:i.key),e&&o))return o}if("directed"!==n&&(o=a(e,i.undirected,s),e&&o))return o}function le(e,t,n,r,i,s,o){var a,c=n?se:ie;if("undirected"!==t){if(void 0!==i.in&&"out"!==r&&(a=c(e,i.in,s,o),e&&a))return a;if(void 0!==i.out&&"in"!==r&&(r||i.key!==s)&&(a=c(e,i.out,s,o),e&&a))return a}if("directed"!==t&&void 0!==i.undirected&&(a=c(e,i.undirected,s,o),e&&a))return a}var ue=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function de(){this.A=null,this.B=null}function he(e,t,n,r,i){for(var s in r){var o=r[s],a=o.source,c=o.target,l=a===n?c:a;if(!t||!t.has(l.key)){var u=i(l.key,l.attributes);if(e&&u)return l.key}}}function pe(e,t,n,r,i){if("mixed"!==t){if("undirected"===t)return he(e,null,r,r.undirected,i);if("string"==typeof n)return he(e,null,r,r[n],i)}var s,o=new de;if("undirected"!==t){if("out"!==n){if(s=he(e,null,r,r.in,i),e&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=he(e,o,r,r.out,i),e&&s)return s;o.wrap(r.out)}}if("directed"!==t&&(s=he(e,o,r,r.undirected,i),e&&s))return s}function me(e,t,n){var r=Object.keys(n),i=r.length,s=0;return new N((function(){var o=null;do{if(s>=i)return e&&e.wrap(n),{done:!0};var a=n[r[s++]],c=a.source,l=a.target;o=c===t?l:c,e&&e.has(o.key)&&(o=null)}while(null===o);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}))}function fe(e,t,n,r,i){for(var s,o,a,c,l,u,d,h=r._nodes.values(),p=r.type;!0!==(s=h.next()).done;){var m=!1;if(o=s.value,"undirected"!==p)for(a in c=o.out){l=c[a];do{if(u=l.target,m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if("directed"!==p)for(a in c=o.undirected)if(!(t&&o.key>a)){l=c[a];do{if((u=l.target).key!==a&&(u=l.source),m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if(n&&!m&&(d=i(o.key,null,o.attributes,null,null,null,null),e&&d))return null}}function ge(e){if(!l(e))throw new U('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new U("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ye(e){if(!l(e))throw new U('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new U("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new U("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new U("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}de.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},de.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var be,we=(be=255&Math.floor(256*Math.random()),function(){return be++}),ve=new Set(["directed","undirected","mixed"]),Ae=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ce={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ee(e,t,n){var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function Te(e,t,n,r,i,s,o,a){if(!r&&"undirected"===e.type)throw new B("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new B("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!l(a))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(a,'"'));if(s=""+s,o=""+o,a=a||{},!e.allowSelfLoops&&s===o)throw new B("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var c=e._nodes.get(s),u=e._nodes.get(o);if(!c)throw new V("Graph.".concat(t,': source node "').concat(s,'" not found.'));if(!u)throw new V("Graph.".concat(t,': target node "').concat(o,'" not found.'));var d={key:null,undirected:r,source:s,target:o,attributes:a};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new B("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));if(!e.multi&&(r?void 0!==c.undirected[o]:void 0!==c.out[o]))throw new B("Graph.".concat(t,': an edge linking "').concat(s,'" to "').concat(o,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var h=new K(r,i,c,u,a);e._edges.set(i,h);var p=s===o;return r?(c.undirectedDegree++,u.undirectedDegree++,p&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,u.inDegree++,p&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,d.key=i,e.emit("edgeAdded",d),i}function Se(e,t,n,r,i,s,o,c,u){if(!r&&"undirected"===e.type)throw new B("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new B("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(c)if(u){if("function"!=typeof c)throw new U("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(c,'"'))}else if(!l(c))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(c,'"'));var d;if(s=""+s,o=""+o,u&&(d=c,c=void 0),!e.allowSelfLoops&&s===o)throw new B("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h,p,m=e._nodes.get(s),f=e._nodes.get(o);if(!n&&(h=e._edges.get(i))){if(!(h.source.key===s&&h.target.key===o||r&&h.source.key===o&&h.target.key===s))throw new B("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(i,'" edge with "').concat(s,'" source & "').concat(o,'" target vs. ("').concat(h.source.key,'", "').concat(h.target.key,'").'));p=h}if(p||e.multi||!m||(p=r?m.undirected[o]:m.out[o]),p){var g=[p.key,!1,!1,!1];if(u?!d:!c)return g;if(u){var y=p.attributes;p.attributes=d(y),e.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else a(p.attributes,c),e.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:c});return g}c=c||{},u&&d&&(c=d(c));var b={key:null,undirected:r,source:s,target:o,attributes:c};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new B("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));var w=!1,v=!1;m||(m=Ee(e,s,{}),w=!0,s===o&&(f=m,v=!0)),f||(f=Ee(e,o,{}),v=!0),h=new K(r,i,m,f,c),e._edges.set(i,h);var A=s===o;return r?(m.undirectedDegree++,f.undirectedDegree++,A&&(m.undirectedLoops++,e._undirectedSelfLoopCount++)):(m.outDegree++,f.inDegree++,A&&(m.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,b.key=i,e.emit("edgeAdded",b),[i,!0,w,v]}function _e(e,t){e._edges.delete(t.key);var n=t.source,r=t.target,i=t.attributes,s=t.undirected,o=n===r;s?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),s?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:i,source:n.key,target:r.key,undirected:s})}var xe=function(n){function r(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=a({},Ce,e)).multi)throw new U("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!ve.has(e.type))throw new U('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(e.type,'".'));if("boolean"!=typeof e.allowSelfLoops)throw new U("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var r="mixed"===e.type?Y:"directed"===e.type?W:j;d(o(t),"NodeDataClass",r);var i="geid_"+we()+"_",s=0;return d(o(t),"_attributes",{}),d(o(t),"_nodes",new Map),d(o(t),"_edges",new Map),d(o(t),"_directedSize",0),d(o(t),"_undirectedSize",0),d(o(t),"_directedSelfLoopCount",0),d(o(t),"_undirectedSelfLoopCount",0),d(o(t),"_edgeKeyGenerator",(function(){var e;do{e=i+s++}while(t._edges.has(e));return e})),d(o(t),"_options",e),Ae.forEach((function(e){return d(o(t),e,t[e])})),h(o(t),"order",(function(){return t._nodes.size})),h(o(t),"size",(function(){return t._edges.size})),h(o(t),"directedSize",(function(){return t._directedSize})),h(o(t),"undirectedSize",(function(){return t._undirectedSize})),h(o(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),h(o(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),h(o(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),h(o(t),"multi",t._options.multi),h(o(t),"type",t._options.type),h(o(t),"allowSelfLoops",t._options.allowSelfLoops),h(o(t),"implementation",(function(){return"graphology"})),t}t(r,n);var i=r.prototype;return i._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},i.hasNode=function(e){return this._nodes.has(""+e)},i.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.out.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.undirected.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasEdge=function(e,t){if(1===arguments.length){var n=""+e;return this._edges.has(n)}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&(void 0!==r.out&&r.out.hasOwnProperty(t)||void 0!==r.undirected&&r.undirected.hasOwnProperty(t))}throw new U("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new B("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.directedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.directedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||void 0;return r?r.key:void 0}},i.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new B("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.undirectedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.undirectedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.undirected&&n.undirected[t]||void 0;return r?r.key:void 0}},i.edge=function(e,t){if(this.multi)throw new B("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.edge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.edge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key},i.areDirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areDirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)},i.areOutNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out},i.areInNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in},i.areUndirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areUndirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"directed"!==this.type&&t in n.undirected},i.areNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)||"directed"!==this.type&&t in n.undirected},i.areInboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in||"directed"!==this.type&&t in n.undirected},i.areOutboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out||"directed"!==this.type&&t in n.undirected},i.inDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree},i.outDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree},i.directedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree},i.undirectedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegree: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree},i.inboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree),n},i.outboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.outDegree),n},i.degree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree),n},i.inDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree-t.directedLoops},i.outDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree-t.directedLoops},i.directedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops},i.undirectedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops},i.inboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,r+=t.directedLoops),n-r},i.outboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,r+=t.directedLoops),n-r},i.degreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,r+=2*t.directedLoops),n-r},i.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.source: could not find the "'.concat(e,'" edge in the graph.'));return t.source.key},i.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.target: could not find the "'.concat(e,'" edge in the graph.'));return t.target.key},i.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.extremities: could not find the "'.concat(e,'" edge in the graph.'));return[t.source.key,t.target.key]},i.opposite=function(e,t){e=""+e,t=""+t;var n=this._edges.get(t);if(!n)throw new V('Graph.opposite: could not find the "'.concat(t,'" edge in the graph.'));var r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new V('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(r,", ").concat(i,")."))},i.hasExtremity=function(e,t){e=""+e,t=""+t;var n=this._edges.get(e);if(!n)throw new V('Graph.hasExtremity: could not find the "'.concat(e,'" edge in the graph.'));return n.source.key===t||n.target.key===t},i.isUndirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isUndirected: could not find the "'.concat(e,'" edge in the graph.'));return t.undirected},i.isDirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isDirected: could not find the "'.concat(e,'" edge in the graph.'));return!t.undirected},i.isSelfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isSelfLoop: could not find the "'.concat(e,'" edge in the graph.'));return t.source===t.target},i.addNode=function(e,t){var n=function(e,t,n){if(n&&!l(n))throw new U('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new B('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}(this,e,t);return n.key},i.mergeNode=function(e,t){if(t&&!l(t))throw new U('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(t,'"'));e=""+e,t=t||{};var n=this._nodes.get(e);return n?(t&&(a(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])},i.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new U('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(t,'"'));e=""+e;var n=this._nodes.get(e);if(n){if(t){var r=n.attributes;n.attributes=t(r),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]},i.dropNode=function(e){e=""+e;var t,n=this._nodes.get(e);if(!n)throw new V('Graph.dropNode: could not find the "'.concat(e,'" node in the graph.'));if("undirected"!==this.type){for(var r in n.out){t=n.out[r];do{_e(this,t),t=t.next}while(t)}for(var i in n.in){t=n.in[i];do{_e(this,t),t=t.next}while(t)}}if("directed"!==this.type)for(var s in n.undirected){t=n.undirected[s];do{_e(this,t),t=t.next}while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})},i.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],r=""+arguments[1];if(!(t=c(this,n,r,this.type)))throw new V('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(r,'" edge in the graph.'))}else if(e=""+e,!(t=this._edges.get(e)))throw new V('Graph.dropEdge: could not find the "'.concat(e,'" edge in the graph.'));return _e(this,t),this},i.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new B("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new B("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e=""+e,t=""+t,"directed");if(!n)throw new V('Graph.dropDirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new B("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new B("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e,t,"undirected");if(!n)throw new V('Graph.dropUndirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},i.clearEdges=function(){for(var e,t=this._nodes.values();!0!==(e=t.next()).done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},i.getAttribute=function(e){return this._attributes[e]},i.getAttributes=function(){return this._attributes},i.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},i.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.updateAttribute=function(e,t){if("function"!=typeof t)throw new U("Graph.updateAttribute: updater should be a function.");var n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},i.replaceAttributes=function(e){if(!l(e))throw new U("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},i.mergeAttributes=function(e){if(!l(e))throw new U("Graph.mergeAttributes: provided attributes are not a plain object.");return a(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this},i.updateAttributes=function(e){if("function"!=typeof e)throw new U("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},i.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i=this._nodes.values();!0!==(n=i.next()).done;)(r=n.value).attributes=e(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},i.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i,s,o=this._edges.values();!0!==(n=o.next()).done;)i=(r=n.value).source,s=r.target,r.attributes=e(r.key,r.attributes,i.key,s.key,i.attributes,s.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},i.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntry: expecting a callback.");fe(!1,!1,!1,this,e)},i.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!1,!0,this,e)},i.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");fe(!1,!0,!1,this,e)},i.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!0,!0,this,e)},i.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):H(this._nodes.keys(),this._nodes.size)},i.forEachNode=function(e){if("function"!=typeof e)throw new U("Graph.forEachNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)},i.findNode=function(e){if("function"!=typeof e)throw new U("Graph.findNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},i.mapNodes=function(e){if("function"!=typeof e)throw new U("Graph.mapNode: expecting a callback.");for(var t,n,r=this._nodes.values(),i=new Array(this.order),s=0;!0!==(t=r.next()).done;)n=t.value,i[s++]=e(n.key,n.attributes);return i},i.someNode=function(e){if("function"!=typeof e)throw new U("Graph.someNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},i.everyNode=function(e){if("function"!=typeof e)throw new U("Graph.everyNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},i.filterNodes=function(e){if("function"!=typeof e)throw new U("Graph.filterNodes: expecting a callback.");for(var t,n,r=this._nodes.values(),i=[];!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)&&i.push(n.key);return i},i.reduceNodes=function(e,t){if("function"!=typeof e)throw new U("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new U("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,r,i=t,s=this._nodes.values();!0!==(n=s.next()).done;)i=e(i,(r=n.value).key,r.attributes);return i},i.nodeEntries=function(){var e=this._nodes.values();return new N((function(){var t=e.next();if(t.done)return t;var n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},i.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,r){t[n++]=function(e,t){var n={key:e};return u(t.attributes)||(n.attributes=a({},t.attributes)),n}(r,e)}));var r=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,i){r[n++]=function(e,t,n){var r={key:t,source:n.source.key,target:n.target.key};return u(n.attributes)||(r.attributes=a({},n.attributes)),"mixed"===e&&n.undirected&&(r.undirected=!0),r}(e.type,i,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:r}},i.import=function(e){var t,n,i,s,o,a=this,c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof r)return e.forEachNode((function(e,t){c?a.mergeNode(e,t):a.addNode(e,t)})),e.forEachEdge((function(e,t,n,r,i,s,o){c?o?a.mergeUndirectedEdgeWithKey(e,n,r,t):a.mergeDirectedEdgeWithKey(e,n,r,t):o?a.addUndirectedEdgeWithKey(e,n,r,t):a.addDirectedEdgeWithKey(e,n,r,t)})),this;if(!l(e))throw new U("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!l(e.attributes))throw new U("Graph.import: invalid attributes. Expecting a plain object.");c?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(i=e.nodes,!Array.isArray(i))throw new U("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=i.length;t<n;t++){ge(s=i[t]);var u=s,d=u.key,h=u.attributes;c?this.mergeNode(d,h):this.addNode(d,h)}}if(e.edges){var p=!1;if("undirected"===this.type&&(p=!0),i=e.edges,!Array.isArray(i))throw new U("Graph.import: invalid edges. Expecting an array.");for(t=0,n=i.length;t<n;t++){ye(o=i[t]);var m=o,f=m.source,g=m.target,y=m.attributes,b=m.undirected,w=void 0===b?p:b;"key"in o?(c?w?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:w?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,o.key,f,g,y):(c?w?this.mergeUndirectedEdge:this.mergeDirectedEdge:w?this.addUndirectedEdge:this.addDirectedEdge).call(this,f,g,y)}}return this},i.nullCopy=function(e){var t=new r(a({},this._options,e));return t.replaceAttributes(a({},this.getAttributes())),t},i.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var r=a({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)})),t},i.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new B('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(e.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new B("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new B("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var t,n,r=this.emptyCopy(e),i=this._edges.values();!0!==(t=i.next()).done;)Te(r,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return r},i.toJSON=function(){return this.export()},i.toString=function(){return"[object Graph]"},i.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var r={},i={};this._edges.forEach((function(e,n){var s,o=e.undirected?"--":"->",a="",c=e.source.key,l=e.target.key;e.undirected&&c>l&&(s=c,c=l,l=s);var u="(".concat(c,")").concat(o,"(").concat(l,")");n.startsWith("geid_")?t.multi&&(void 0===i[u]?i[u]=0:i[u]++,a+="".concat(i[u],". ")):a+="[".concat(n,"]: "),r[a+=u]=e.attributes}));var s={};for(var o in this)this.hasOwnProperty(o)&&!Ae.has(o)&&"function"!=typeof this[o]&&"symbol"!==e(o)&&(s[o]=this[o]);return s.attributes=this._attributes,s.nodes=n,s.edges=r,d(s,"constructor",this.constructor),s},r}(f.exports.EventEmitter);"undefined"!=typeof Symbol&&(xe.prototype[Symbol.for("nodejs.util.inspect.custom")]=xe.prototype.inspect),[{name:function(e){return"".concat(e,"Edge")},generateKey:!0},{name:function(e){return"".concat(e,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(e){return"".concat(e,"EdgeWithKey")}},{name:function(e){return"".concat(e,"DirectedEdgeWithKey")},type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(e){["add","merge","update"].forEach((function(t){var n=e.name(t),r="add"===t?Te:Se;e.generateKey?xe.prototype[n]=function(i,s,o){return r(this,n,!0,"undirected"===(e.type||this.type),null,i,s,o,"update"===t)}:xe.prototype[n]=function(i,s,o,a){return r(this,n,!1,"undirected"===(e.type||this.type),i,s,o,a,"update"===t)}}))})),function(e){q.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Node"),0),r(e,n("Source"),1),r(e,n("Target"),2),r(e,n("Opposite"),3)}))}(xe),function(e){Z.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Edge"),"mixed"),r(e,n("DirectedEdge"),"directed"),r(e,n("UndirectedEdge"),"undirected")}))}(xe),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return"function"==typeof Array.from?Array.from(e._edges.keys()):H(e._edges.keys(),e._edges.size);for(var n,r,i="undirected"===t?e.undirectedSize:e.directedSize,s=new Array(i),o="undirected"===t,a=e._edges.values(),c=0;!0!==(n=a.next()).done;)(r=n.value).undirected===o&&(s[c++]=r.key);return s}(this,r);if(1===arguments.length){e=""+e;var s=this._nodes.get(e);if(void 0===s)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n,r){var i=[];return ce(!1,e,t,n,r,(function(e){i.push(e)})),i}(this.multi,"mixed"===r?this.type:r,i,s)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(n,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r,i){var s=[];return le(!1,e,t,n,r,i,(function(e){s.push(e)})),s}(r,this.multi,i,o,t)}throw new U("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return ae(!1,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!1,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!1,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){var e,t=Array.prototype.slice.call(arguments),n=t.pop();if(0===t.length){var i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),e=new Array(i);var o=0;t.push((function(t,r,i,s,a,c,l){e[o++]=n(t,r,i,s,a,c,l)}))}else e=[],t.push((function(t,r,i,s,o,a,c){e.push(n(t,r,i,s,o,a,c))}));return this[s].apply(this,t),e};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((function(e,r,i,s,o,a,c){t(e,r,i,s,o,a,c)&&n.push(e)})),this[s].apply(this,e),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new U("Graph.".concat(c,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(e=n[0],t=n[1],n=[]):3===n.length?(e=n[1],t=n[2],n=[n[0]]):4===n.length&&(e=n[2],t=n[3],n=[n[0],n[1]]);var r=t;return n.push((function(t,n,i,s,o,a,c){r=e(r,t,n,i,s,o,a,c)})),this[s].apply(this,n),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return ae(!0,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!0,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!0,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var o="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return t(e,n,r,i,s,o,a)})),!!this[s].apply(this,e)};var a="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return!t(e,n,r,i,s,o,a)})),!this[s].apply(this,e)}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();if(!arguments.length)return function(e,t){if(0===e.size)return N.empty();var n="mixed"!==t&&t!==e.type,r="undirected"===t,i=e._edges.values();return new N((function(){for(var e,t;;){if((e=i.next()).done)return e;if(t=e.value,!n||t.undirected===r)break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}))}(this,r);if(1===arguments.length){e=""+e;var n=this._nodes.get(e);if(!n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){var r=N.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(r=Q(r,re(n.in))),"in"!==t&&void 0!==n.out&&(r=Q(r,re(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(r=Q(r,re(n.undirected))),r}(r,i,n)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r){var i=N.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&r in n.in&&(i=Q(i,oe(n.in,r))),void 0!==n.out&&"in"!==t&&r in n.out&&(t||n.key!==r)&&(i=Q(i,oe(n.out,r)))),"directed"!==e&&void 0!==n.undirected&&r in n.undirected&&(i=Q(i,oe(n.undirected,r))),i}(r,i,o,t)}throw new U("Graph.".concat(s,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(xe),function(e){ue.forEach((function(t){(function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return Object.keys(n.undirected);if("string"==typeof t)return Object.keys(n[t])}var r=[];return pe(!1,e,t,n,(function(e){r.push(e)})),r}("mixed"===r?this.type:r,i,t)}})(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));pe(!1,"mixed"===r?this.type:r,i,n,t)}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){var n=[];return this[s](e,(function(e,r){n.push(t(e,r))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[s](e,(function(e,r){t(e,r)&&n.push(e)})),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var r=n;return this[s](e,(function(e,n){r=t(r,e,n)})),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n[0].toUpperCase()+n.slice(1,-1),o="find"+s;e.prototype[o]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return pe(!0,"mixed"===r?this.type:r,i,n,t)}};var a="some"+s;e.prototype[a]=function(e,t){return!!this[o](e,t)};var c="every"+s;e.prototype[c]=function(e,t){return!this[o](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return me(null,n,n.undirected);if("string"==typeof t)return me(null,n,n[t])}var r=N.empty(),i=new de;return"undirected"!==e&&("out"!==t&&(r=Q(r,me(i,n,n.in))),"in"!==t&&(r=Q(r,me(i,n,n.out)))),"directed"!==e&&(r=Q(r,me(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,t)}}(e,t)}))}(xe);var Me=function(e){function n(t){var n=a({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new U("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new U('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),Pe=function(e){function n(t){var n=a({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new U("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new U('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),Le=function(e){function n(t){var n=a({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(xe),Ne=function(e){function n(t){var n=a({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new U('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),$e=function(e){function n(t){var n=a({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new U('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe);function Ie(e){e.from=function(t,n){var r=a({},t.options,n),i=new e(r);return i.import(t),i}}return Ie(xe),Ie(Me),Ie(Pe),Ie(Le),Ie(Ne),Ie($e),xe.Graph=xe,xe.DirectedGraph=Me,xe.UndirectedGraph=Pe,xe.MultiGraph=Le,xe.MultiDirectedGraph=Ne,xe.MultiUndirectedGraph=$e,xe.InvalidArgumentsGraphError=U,xe.NotFoundGraphError=V,xe.UsageGraphError=B,xe}()},944:(e,t)=>{"use strict";t.Vb=void 0,t.Vb=function(e,t,n){var r=function(e,t,n){if(0===e.length||0===t.length)return 0;if(n&&!n.caseSensitive&&(e=e.toUpperCase(),t=t.toUpperCase()),e===t)return 1;for(var r=0,i=e.length,s=t.length,o=Math.floor(Math.max(i,s)/2)-1,a=new Array(i),c=new Array(s),l=0;l<i;l++)for(var u=Math.max(0,l-o);u<=Math.min(s,l+o+1);u++)if(!a[l]&&!c[u]&&e[l]===t[u]){++r,a[l]=c[u]=!0;break}if(0===r)return 0;var d=0,h=0;for(l=0;l<i;l++)if(a[l]){for(;!c[h];)h++;e.charAt(l)!==t.charAt(h++)&&d++}return(r/i+r/s+(r-(d/=2))/r)/3}(e,t,n),i=0;if(r>.7){for(var s=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<s;)++i,o++;r+=.1*i*(1-r)}return r}},7106:e=>{"use strict";var t=e.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),n(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function n(e,r,i,s,o,a,c,l,u,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in r(s,o,a,c,l,u,d),s){var p=s[h];if(Array.isArray(p)){if(h in t.arrayKeywords)for(var m=0;m<p.length;m++)n(e,r,i,p[m],o+"/"+h+"/"+m,a,o,h,s,m)}else if(h in t.propsKeywords){if(p&&"object"==typeof p)for(var f in p)n(e,r,i,p[f],o+"/"+h+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,h,s,f)}else(h in t.keywords||e.allKeys&&!(h in t.skipKeywords))&&n(e,r,i,p,o+"/"+h,a,o,h,s)}i(s,o,a,c,l,u,d)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var s={},o=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=s[l]||0,d="".concat(l," ").concat(u);s[l]=u+1;var h=n(d),p={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var m=i(p,r);r.byIndex=a,t.splice(a,0,{identifier:d,updater:m,references:1})}o.push(d)}return o}function i(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,i){var s=r(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var c=r(e,i),l=0;l<s.length;l++){var u=n(s[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}s=c}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},1407:(e,t,n)=>{"use strict";n.d(t,{R:()=>l});var r=n(4328),i=n(6082),s=n(3572),o=n(826),a=n(439);const c=31;async function l(e,t=!1,n){const a=o.G.forColumn(e);let l;n??=new Map;const d=a.isHelm()?(0,s.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<d.length;e++)n.has(d[e])||n.set(d[e],`${n.size+1}`);if(a.isHelm())l=await r.functions.call("HELM:getMolFiles",{col:e}),l=function(e,t,n=!1){const r=new Array(e.length);for(let i=0;i<e.length;i++){let s=0,o=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=e.get(i);s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1;const u=parseInt(l.substring(s,s+3)),d=parseInt(l.substring(s+3,s+6));a+=`M V30 COUNTS ${u} ${d} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){s=l.indexOf("\n",s)+1+c,o=l.indexOf(" ",s);const r=l.substring(s,o);a+=n?`M V30 ${e+1} R${t.get(r)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(r)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<d;e++){s=l.indexOf("\n",s)+1;const t=parseInt(l.substring(s,s+3).trim()),n=parseInt(l.substring(s+3,s+6).trim());a+=`M V30 ${e+1} ${parseInt(l.substring(s+6,s+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",r[i]=a}return r}(l,n,t);else{l=new Array(e.length);for(let r=0;r<e.length;r++){const e=u(a.getSplitted(r),n,t);l[r]=e}}return i.Column.fromStrings("monomericMols",l)}function u(e,t,n=!1){let r="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";r+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,r+="M V30 BEGIN ATOM\n";for(let i=0;i<e.length;i++){const s=e.getCanonical(i);s!==a._S&&(r+=n?`M V30 ${i+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${i+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`)}r+="M V30 END ATOM\n",r+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)r+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return r+="M V30 END BOND\n",r+="M V30 END CTAB\n",r+="M END",r}},3572:(e,t,n)=>{"use strict";n.d(t,{_package:()=>Ot,activityCliffs:()=>Ht,getHelmMonomers:()=>Vt,getMonomerLib:()=>Gt,getMonomerLibHelper:()=>kt,importFasta:()=>Ut,sequenceIdentityScoring:()=>Bt,sequenceSimilarityScoring:()=>Yt,sequenceSpaceTopMenu:()=>Ft});var r,i,s=n(4328),o=n(7389),a=n(6082),c=n(684),l=n(9039);(i=r||(r={})).EUCLIDEAN="EUCLIDEAN",i.MANHATTAN="MANHATTAN";var u=n(1858),d=n(5072),h=n.n(d),p=n(7825),m=n.n(p),f=n(7659),g=n.n(f),y=n(5056),b=n.n(y),w=n(540),v=n.n(w),A=n(1113),C=n.n(A),E=n(7939),T={};T.styleTagTransform=C(),T.setAttributes=b(),T.insert=g().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=v(),h()(E.A,T),E.A&&E.A.locals&&E.A.locals;var S=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};let _=null,x=null;Promise.resolve(),n(934),n(8903);const M="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;const P=rxjs.operators;n(6295);const L=e=>null==e;function N(e,t,n,r){if(n>e[e.length-1])return;const i=e.findIndex((e=>n<e));e.pop(),e.splice(i,0,n),t.pop(),t.splice(i,0,r)}class ${constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,i,s=[{}],o=[1],a=r.EUCLIDEAN){const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,s,o,a):0;i<u&&(console.log(`using threshold ${u}`),i=u),s.forEach(((e,t)=>s[t].threshold=i));const d=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(111),n.b))));for(let n=0;n<this._workerCount;n++)d[n]=new Promise(((r,u)=>{const d=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=d&&r({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),h[n].postMessage({values:e,startIdx:d,endIdx:p,threshold:i,fnNames:t,opts:s,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,i:t,j:i,distance:s}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),r({i:t,j:i,distance:s,idx:n}))}}));const p=await Promise.all(d),m=p.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(m),g=new Int32Array(m),y=new Float32Array(m);let b=0;for(const e of p)f.set(e.i,b),g.set(e.j,b),y.set(e.distance,b),b+=e.i.length;return{i:f,j:g,distance:y}}async calc(e,t,n,r={}){return await this.calcMultiColumn([e],[t],n,[r],[1])}async getKNN(e,t,n=15,r={}){return await this.multiColumnKNN([e],[t],n,[r],[1])}async getThresholdKNN(e,t,n=.8,r={}){return await this.multiColumnThresholdKnn([e],[t],n,[r],[1])}async multiColumnThresholdKnn(e,t,i=.8,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(603),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,threshold:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p=new Int32Array(e[0].length);for(const t of h)for(let n=0;n<e[0].length;++n)p[n]+=t.knnIndexes[n]?.length??0;const m={knnDistances:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t]))),knnIndexes:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t])))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<(t.knnDistances[n]?.length??0);++e)m.knnDistances[n][p[n]-1]=t.knnDistances[n][e],m.knnIndexes[n][p[n]-1]=t.knnIndexes[n][e],p[n]-=1;return m}async multiColumnKNN(e,t,i=15,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(950),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,nNeighbours:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(-1)))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<(t.knnDistances[n]?.length??0);++e)N(p.knnDistances[n],p.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return p}async getSampleDistances(e,t,i=[],s,o=r.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(778),n.b))));try{const n=e[0].length*(e[0].length-1)/2,r=Math.floor(n/this._workerCount),c=1e6,l=Math.max(Math.min(n/1e3,c),Math.min(n,c)),u=Math.floor(l/this._workerCount),d=new Array(this._workerCount);for(let c=0;c<this._workerCount;c++)d[c]=new Promise(((l,d)=>{const h=c*r,p=c===this._workerCount-1?n:(c+1)*r;a[c].postMessage({values:e,startIdx:h,endIdx:p,sampleLength:u,fnNames:t,opts:i,weights:s,aggregationMethod:o}),a[c].onmessage=({data:{error:e,distance:t}})=>{a[c].terminate(),e?d(e):l({distance:t})}}));const h=await Promise.all(d),p=h.reduce(((e,t)=>e+t.distance.length),0),m=new Float32Array(p);let f=0;for(const e of h)m.set(e.distance,f),f+=e.distance.length;return m.sort(),m}catch(e){return a?.forEach((e=>e?.terminate())),console.error(e),new Float32Array(1).fill(.5)}}async getMinimalThreshold(e,t,n=[],i,s=r.EUCLIDEAN){try{const r=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,i,s);return 1-o[Math.floor(7e7/r*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,r){const i=[],s=[],o=[];let a=0,c=0,l=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=L(e[c])||L(e[l])?1:n(e[c],e[l]);1-t>=r&&(i.push(c),s.push(l),o.push(t)),a++,l++,l===e.length&&(c++,l=c+1)}return{i:new Int32Array(i),j:new Int32Array(s),distance:new Float32Array(o)}}}var I,R,O=n(8774);(R=I||(I={})).none="none",R.bold="bold",R.dashed="dashed";class k{get currentLineId(){return this._currentLineIdx}set currentLineId(e){e!==this._currentLineIdx&&(this._currentLineIdx=e,this.sp.render(this.ctx))}set linesToRender(e){this.updateLines(e),this.sp.render(this.ctx)}set linesVisibility(e){this.visibility=e,this.sp.render(this.ctx)}constructor(e,t,n,r,i=I.none){var s;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=e,this.xAxisCol=this.sp.dataFrame.columns.byName(t),this.yAxisCol=this.sp.dataFrame.columns.byName(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=i,this.updateLines(r),this.visibility=null!==(s=r.visibility)&&void 0!==s?s:new O.A(this.lines.from.length),r.visibility||this.visibility.setAll(!0,!1),r.arrowSize&&(this.arrowWidth=r.arrowSize),this.canvas.onmousedown=e=>{var t;(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)&&(this.mouseOverLineId=this.checkCoordsOnLine(e.offsetX,e.offsetY)),-1!==this.mouseOverLineId&&this.lineClicked.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},this.canvas.onmousemove=e=>{var t;this.mouseOverLineId=(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)?-1:this.checkCoordsOnLine(e.offsetX,e.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},e.onEvent("d4-before-draw-scene").subscribe((e=>{this.renderLines()}))}updateLines(e){this.lines=e,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),e.skipMultiLineCalculation?this.multipleLinesCounts.fill(0):this.createMultiLinesIndices()}renderLines(){var e,t,n,r,i,s,o,a,c,l,u,d,h,p,m,f,g;const y=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;y||(this.ctx.lineWidth=null!==(e=this.lines.width)&&void 0!==e?e:1,this.ctx.strokeStyle=`rgba(${null!==(t=this.lines.color)&&void 0!==t?t:"0,128,0"},${null!==(n=this.lines.opacity)&&void 0!==n?n:1})`);const b=this.sp.dataFrame.filter,w=Math.pow(null!==(r=this.lines.shortLineThreshold)&&void 0!==r?r:5,2);for(let e=0;e<this.lines.from.length;e++)if(b.get(this.lines.from[e])&&b.get(this.lines.to[e])&&this.visibility.getBit(e)){let t=0;const n=this.sp.getMarkerSize(this.lines.from[e])/2,r=this.sp.getMarkerSize(this.lines.to[e])/2,b=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let v=null==b?void 0:b.x,A=null==b?void 0:b.y;const C=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let E=null==C?void 0:C.x,T=null==C?void 0:C.y;const S=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),v&&A&&E&&T&&Math.hypot(E-v,T-A)/S>.01){if(y){const t=(null===(i=this.lines.colors)||void 0===i?void 0:i[e])?null===(s=this.lines.colors)||void 0===s?void 0:s[e]:null!==(o=this.lines.color)&&void 0!==o?o:"0,128,0",n=(null===(a=this.lines.opacities)||void 0===a?void 0:a[e])?null===(c=this.lines.opacities)||void 0===c?void 0:c[e]:null!==(l=this.lines.opacity)&&void 0!==l?l:1;this.ctx.strokeStyle=`rgba(${t},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[e])?null===(d=this.lines.widths)||void 0===d?void 0:d[e]:null!==(h=this.lines.width)&&void 0!==h?h:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const b=this.multipleLinesCounts[e];let C=null;if(b){t=this.getLineLength(v,A,E,T);const i=this.getPointOnDistance(v,A,E,T,r,t),s=this.getPointOnDistance(E,T,v,A,n,t);v=i.x,A=i.y,E=s.x,T=s.y,C=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(b,v,A,E,T,e):this.findControlPoint(b,E,T,v,A,e),this.ctx.moveTo(v,A),this.ctx.quadraticCurveTo(C.x,C.y,E,T)}else(!this.lines.skipShortLines||Math.pow(E-v,2)+Math.pow(T-A,2)>w)&&(this.ctx.moveTo(v,A),this.ctx.lineTo(E,T));if((null!==(p=this.lines.drawArrows)&&void 0!==p?p:null===(m=this.lines.drawArrowsArr)||void 0===m?void 0:m.getBit(e))&&(t||(t=this.getLineLength(v,A,E,T)),t>this.arrowWidth)){const e=b?null:this.getPointOnDistance(v,A,E,T,r,t),n=b?C.x:v,i=b?C.y:A;this.canvasArrow(this.ctx,null!==(f=null==e?void 0:e.x)&&void 0!==f?f:v,null!==(g=null==e?void 0:e.y)&&void 0!==g?g:A,n,i)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case I.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case I.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}fillLeftBottomRect(){const e=new Path2D;e.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(e),this.ctx.closePath()}createMultiLinesIndices(){const e={};for(let t=0;t<this.lines.from.length;t++){let n=0,r=0;this.lines.from[t]<this.lines.to[t]?(n=this.lines.from[t],r=this.lines.to[t]):(n=this.lines.to[t],r=this.lines.from[t]),e[`${n}|${r}`]?(1===e[`${n}|${r}`].length&&(this.multipleLinesCounts[e[`${n}|${r}`][0]]=1,e[`${n}|${r}`].push(1)),this.multipleLinesCounts[t]=++e[`${n}|${r}`][1]):e[`${n}|${r}`]=[t]}}checkCoordsOnLine(e,t){let n=-1,r=null,i=null;const s=this.sp.dataFrame.filter;for(let o=0;o<this.lines.from.length;o++)if(s.get(this.lines.from[o])&&s.get(this.lines.to[o])&&this.visibility.getBit(o)){const s=this.sp.getMarkerSize(this.lines.from[o])/2,a=this.sp.getMarkerSize(this.lines.to[o])/2,c=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[o]),this.yAxisCol.get(this.lines.from[o])),l=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[o]),this.yAxisCol.get(this.lines.to[o]));if(this.multipleLinesCounts[o]){const n=this.getLineLength(c.x,c.y,l.x,l.y),r=this.getPointOnDistance(c.x,c.y,l.x,l.y,a,n),u=this.getPointOnDistance(l.x,l.y,null==c?void 0:c.x,null==c?void 0:c.y,s,n),d=this.lines.from[o]>this.lines.to[o]?this.findControlPoint(this.multipleLinesCounts[o],r.x,r.y,u.x,u.y,o):this.findControlPoint(this.multipleLinesCounts[o],u.x,u.y,r.x,r.y,o);i=this.calculateDistToCurveLine(o,e,t,r,u,d)}else i=this.calculateDistToStraightLine(e,t,c,l);(!r&&null!==i&&i<5||r&&null!==i&&i<r)&&(r=i,n=o)}return n}calculateDistToStraightLine(e,t,n,r){const i=Math.min(n.x,r.x),s=Math.max(n.x,r.x),o=Math.min(n.y,r.y),a=Math.max(n.y,r.y);return e>=i-2&&e<=s+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,r):null}distToStraightLineSegment(e,t,n,r){const i=(e,t,n,r)=>Math.pow(e-n,2)+Math.pow(t-r,2),s=i(n.x,n.y,r.x,r.y);if(0==s)return i(e,t,n.x,n.y);let o=((e-n.x)*(r.x-n.x)+(t-n.y)*(r.y-n.y))/s;return o=Math.max(0,Math.min(1,o)),i(e,t,n.x+o*(r.x-n.x),n.y+o*(r.y-n.y))}calculateDistToCurveLine(e,t,n,r,i,s){const o=Math.min(r.x,i.x,s.x),a=Math.max(r.x,i.x,s.x),c=Math.min(r.y,i.y,s.y),l=Math.max(r.y,i.y,s.y);if(t>=o-2&&t<=a+2&&n>=c-2&&n<=l+2){const e=a-o,u=l-c;return this.calculateDistToCurveInRect(t,n,r,s,i,e,u)}return null}calculateDistToCurveInRect(e,t,n,r,i,s,o){const a=Math.floor((s+o)/3),c=1/a,l=new Uint32Array(a),u=new Uint32Array(a),d=new Uint32Array(a);let h=null;const p=new O.A(a);for(let s=0;s<l.length;s++){const o=s*c,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*r.x+Math.pow(o,2)*i.x,p=Math.pow(1-o,2)*n.y+2*o*(1-o)*r.y+Math.pow(o,2)*i.y,m=Math.abs(e-a),f=Math.abs(t-p),g=m+f;(!h||h>g)&&(h=g),d[s]=Math.max(m,f),l[s]=a,u[s]=p}for(let e=0;e<l.length;e++)d[e]<h&&p.setBit(e,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const r=Math.hypot(l[n]-e,u[n]-t);(!m||m>r)&&(m=r)}return m}getLineLength(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}getPointOnDistance(e,t,n,r,i,s){const o=n-i*((n-e)/s),c=r-i*((r-t)/s);return new a.Point(o,c)}findControlPoint(e,t,n,r,i,s){const o=t+(r-t)/2,c=n+(i-n)/2;let l=o-t,u=c-n;const d=Math.sqrt(l*l+u*u);l/=d,u/=d;const h=50*Math.ceil(e/2);return e%2==0?new a.Point(o+h/2*u,c-h/2*l):new a.Point(o-h/2*u,c+h/2*l)}canvasArrow(e,t,n,r,i){const s=Math.atan2(r-t,i-n)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(s-Math.PI/10),n-this.arrowWidth*Math.cos(s-Math.PI/10)),e.lineTo(t,n),e.lineTo(t-this.arrowWidth*Math.sin(s+Math.PI/10),n-this.arrowWidth*Math.cos(s+Math.PI/10))}}const D="dimensionality-reducer-terminate-event";var G,H,F=n(3629);async function U(e,t,r,i,o,a,c){let l=await async function(e,t,r,i,o,a,c){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==i.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(l,u){const d=new Worker(new URL(n.p+n.u(234),n.b));d.postMessage({columnsData:e,distanceMetrics:t,method:r,options:a,weights:i,aggregationMethod:o});const h=s.events.onCustomEvent(D).subscribe((()=>{try{d?.terminate()}finally{h.unsubscribe()}}));d.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:r}})=>{L(n)||L(r)?(h.unsubscribe(),e?u(e):l(t),setTimeout((()=>d.terminate()),100)):c&&c(n,r,t)}}))}(e,r,t,i,o,a,c);return l=l.map((e=>(0,F.S8)(e))),l}(H=G||(G={})).EUCLIDEAN="EUCLIDEAN",H.MANHATTAN="MANHATTAN";const V={[G.EUCLIDEAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + distances[i] * distances[i] * computeInfo.weights[i] * computeInfo.weights[i];\n }\n return sqrt(sum);\n `},[G.MANHATTAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + abs(distances[i]) * computeInfo.weights[i];\n }\n return sum;\n `}};var B,Y;(Y=B||(B={})).HAMMING="Hamming",Y.EUCLIDEAN="Euclidean",Y.MANHATTAN="Manhattan",Y.TANIMOTO="Tanimoto",Y.LEVENSTEIN="Levenshtein",Y.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",Y.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",Y.SOKAL="Sokal",Y.COSINE="Cosine",Y.ASYMMETRIC="Asymmetric",Y.Difference="Difference",Y.OneHot="One-Hot";const W={[B.HAMMING]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + f32(a[i] != b[i]);\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[B.EUCLIDEAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + f32(a[i] - b[i]) * f32(a[i] - b[i]);\n }\n return sqrt(dist);\n `},[B.MANHATTAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + abs(f32(a[i] - b[i]));\n }\n return dist;\n `},[B.TANIMOTO]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n\n if (onBitsa == 0u && onBitsb == 0u) {\n return 0.0;\n }\n\n let totalOnBits = onBitsa + onBitsb;\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n\n return 1.0 - f32(commonBits) / f32(totalOnBits - commonBits);\n `},[B.LEVENSTEIN]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n\n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = f32(i);\n }\n\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n dynamicPassMat[curIndex][0] = f32(i);\n var minEntry: f32 = f32(maxLength);\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n let bMon = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n var cost: f32 = f32(a[j - 1] != bMon);\n var res: f32 = min(\n min(\n (*prevRow)[j] + 1.0, // deletion\n (*curRow)[j - 1] + 1.0, // insertion\n ),\n (*prevRow)[j - 1] + cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n `},[B.NEEDLEMAN_WUNSCH]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n // we need to keep track of which operation led to the current cell\n // i.e. whether we came from the left, top or diagonal to assign gap open/gap extend penalty\n var verticalGaps: array<u32, ${e+1}u>;\n var horizontalGaps: array<u32, ${e+1}u>;\n\n let gapOpenPenalty: f32 = suppInfo.gapOpenPenalty${t};\n let gapExtensionPenalty: f32 = suppInfo.gapExtensionPenalty${t};\n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty; // accounting for the fact that left and right gaps are less costly\n dynamicPassMat[curIndex][i] = 0.0;\n }\n dynamicPassMat[0][0] = 0.0;\n\n let simMatrix = &suppInfo.similarityMatrix${t}; // using pointers make things faster\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n (*curRow)[0] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty;\n var minEntry: f32 = f32(maxLength);\n let monB = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n let monA = u32(a[j - 1]);\n \n let cost: f32 = (*prevRow)[j - 1] + 1f - (*simMatrix)[monA][monB];\n var top = (*prevRow)[j]; // deletion\n if (verticalGaps[j] > 0 || i == 1 || i == bLength) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0 || j == 1 || j == aLength) {\n left = left + gapExtensionPenalty;\n } else {\n left = left + gapOpenPenalty;\n }\n var res: f32 = min(\n min(\n top, // deletion\n left, // insertion\n ),\n cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n // update the horizontal and vertical gaps\n if (res == cost) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 0;\n } else if (res == left) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 1;\n } else {\n verticalGaps[j] = 1;\n horizontalGaps[j] = 0;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n return dynamicPassMat[prevIndex][aLength] / f32(minLength);\n\n `},[B.MONOMER_CHEMICAL_DISTANCE]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n let simMatrix = &(suppInfo.similarityMatrix${t}); // using pointers make things faster\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + 1.0 - (*simMatrix)[u32(a[i])][u32(b[i])];\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[B.SOKAL]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa + onBitsb;\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(total * 2 - commonBits * 3);\n `},[B.COSINE]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa * onBitsb; // p.s. here total is taken by multiplying\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / sqrt(f32(total));\n `},[B.ASYMMETRIC]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let min = min(onBitsa, onBitsb);\n if (min == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(min);\n `},[B.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[B.OneHot]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n if (aLength != bLength) {\n return 1.0;\n }\n for (var i = 0u; i < aLength; i = i + 1u) {\n if(a[i] != b[i]) {\n return 1.0;\n }\n }\n return 0.0;\n `}},j={[B.HAMMING]:e=>Math.ceil(e/30),[B.EUCLIDEAN]:e=>Math.ceil(e/30),[B.MANHATTAN]:e=>Math.ceil(e/30),[B.TANIMOTO]:e=>Math.ceil(e/60),[B.SOKAL]:e=>Math.ceil(e/60),[B.COSINE]:e=>Math.ceil(e/60),[B.ASYMMETRIC]:e=>Math.ceil(e/60),[B.LEVENSTEIN]:e=>Math.ceil(e*e/60),[B.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[B.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[B.Difference]:e=>1,[B.OneHot]:e=>Math.ceil(e/40)},K={STRING:new Set([B.HAMMING,B.LEVENSTEIN,B.NEEDLEMAN_WUNSCH,B.MONOMER_CHEMICAL_DISTANCE,B.OneHot]),UINT32ARRAY:new Set([B.HAMMING,B.EUCLIDEAN,B.MANHATTAN,B.MONOMER_CHEMICAL_DISTANCE,B.LEVENSTEIN,B.NEEDLEMAN_WUNSCH,B.TANIMOTO,B.COSINE,B.SOKAL,B.ASYMMETRIC,B.OneHot,B.Difference]),INT32ARRAY:new Set([B.EUCLIDEAN,B.MANHATTAN,B.OneHot,B.Difference]),FLOAT32ARRAY:new Set([B.EUCLIDEAN,B.MANHATTAN,B.Difference]),NUMBER:new Set([B.EUCLIDEAN,B.MANHATTAN,B.Difference]),BITARRAY:new Set([B.TANIMOTO,B.COSINE,B.SOKAL,B.ASYMMETRIC])};var z=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function q(e,t,n,r){return e.map(((e,r)=>`\n fn distanceScript${r}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${r}[aIndex];\n let b = computeInfo.data${r}[bIndex];\n let maxDistance: f32 = ${n};\n ${W[e](t[r],r)}\n }\n `)).join("\n")+"\n"+`\n fn combinedDistance(aIndex: u32, bIndex: u32) -> f32 {\n var distances: array<f32, ${e.length}>;\n ${e.map(((e,t)=>`distances[${t}] = distanceScript${t}(aIndex, bIndex);`)).join("\n")}\n ${V[r](e.length)}\n }\n \n `}var Z=n(1991),X=n.n(Z);let J=0;const Q="cliffsDf",ee=new u.Subject,te="activity_difference",ne="SALI_index",re="similarity",ie="line_index",se=["1_molecule","2_molecule"],oe="filterCliffs";async function ae(e,t,r,i,c,l,u,d,h,p,m,f,g,y,b,w,v){J++;const A=l/100;let C,E=!1;const T=f.inputs,L=await f.apply({[T[0].name]:t,[T[1].name]:u,...h.preprocessingFuncArgs??{}});let N=[];if(d===M){const t=await function(e,t,r,i,s,o,a=10,c=!1,l=2){const u=new Worker(new URL(n.p+n.u(980),n.b));let d;return u.postMessage({data:e,threshold:t,weights:r,aggregationMethod:i,distanceFns:s,distanceFnArgs:o,maxIterations:a,useWebGPU:c,inflate:l}),{promise:new Promise(((e,t)=>{d=e,u.onmessage=t=>{setTimeout((()=>u.terminate()),100),e(t.data.res)},u.onerror=e=>{setTimeout((()=>u.terminate()),100),t(e)}})),terminate:()=>{try{d(null),u.terminate()}catch(e){console.error(e)}}}}([L.entries],l,[1],"MANHATTAN",[u],[L.options??{}],h?.maxIterations??5,h.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),N=[t.embedX,t.embedY]}else N=await U([L.entries],d,[u],[1],"MANHATTAN",{...h,distanceFnArgs:[L.options??{}]});if(N.length!==r.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<N.length;++t)e.columns.addNewFloat(r[t]).init((e=>N[t][e]));let R=null;if(h.useWebGPU)try{R=await function(e,t=.8,n,r,i,s){return z(this,void 0,void 0,(function*(){const o=yield function(){return S(this,void 0,void 0,(function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!_&&(_=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==_))return null;let e=!1;if(x&&(x.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!x||e){const e=1e9,t=_.limits,n=t.maxBufferSize,r=t.maxStorageBufferBindingSize;try{return x=yield _.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(r,e)}}),x}catch(e){return console.error("Failed to create device with required limits",e),x=yield _.requestDevice(),x}}return x}))}();if(!o)return null;const a=Object.values(B);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(G).includes(r))throw new Error("Invalid aggregation function provided: "+r);const c=1-t;if(s.length!==e.length||s.length!==n.length||s.length!==i.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(e.some((t=>t.length!==e[0].length)))throw new Error("All entry lists must be the same length");const l=e.length,u=e[0].length,d=e.map(((e,t)=>function(e,t=B.HAMMING,n,r={gapOpenPenalty:1,gapExtensionPenalty:.6}){var i,s;let o=null;const a=e.some((e=>"string"==typeof e))?(o="STRING",e.map((e=>new Uint32Array(e.split("").map((e=>e.charCodeAt(0))))))):e.some((e=>"number"==typeof e))?(o="NUMBER",e.map((e=>new Float32Array([e])))):"object"==typeof e[0]&&e.some((e=>"_data"in e&&"_length"in e))?(o="BITARRAY",e.map((e=>e._data))):e.some((e=>e instanceof Float32Array))?(o="FLOAT32ARRAY",e):e.some((e=>e instanceof Uint32Array))?(o="UINT32ARRAY",e):e.some((e=>e instanceof Int32Array))?(o="INT32ARRAY",e):void 0;if(!a||!o)throw new Error("Invalid entry type, could not determine entry type from input list");const c=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",l=new Uint32Array(a.map((e=>e.length)));if(!K[o]||!K[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=l.reduce(((e,t)=>Math.max(e,t)),0),d=j[t](u),h="INT32ARRAY"===c?Int32Array:"FLOAT32ARRAY"===c?Float32Array:Uint32Array,p=new h(a.length*u);a.forEach(((e,t)=>{p.set(e,t*u)}));let m="",f=0,g="FLOAT32ARRAY",y=null;if(t===B.NEEDLEMAN_WUNSCH||t===B.MONOMER_CHEMICAL_DISTANCE){let e=r.scoringMatrix&&r.alphabetIndexes?Object.keys(r.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!r.alphabetIndexes||!r.scoringMatrix){for(let t=0;t<p.length;t++)p[t]>e&&(e=p[t]);r.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),r.alphabetIndexes={};for(let e=0;e<r.scoringMatrix.length;e++)r.scoringMatrix[e][e]=1,r.alphabetIndexes[String.fromCharCode(e)]=e}const t=(e+1)*(e+1),o=new Array(e+1).fill(null).map((()=>new Float32Array(e+1)));for(let t=0;t<e+1;t++)o[t][t]=1;const a=r.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=r.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(i=r.gapOpenPenalty)&&void 0!==i?i:1,y[1]=null!==(s=r.gapExtensionPenalty)&&void 0!==s?s:.6;let c=2;for(let e=0;e<o.length;e++)y.set(o[e],c),c+=o[e].length;m=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${e+1}>, ${e+1}>`}else if(t===B.Difference){if(!r.range||"number"!=typeof r.range||r.range<=0){const e=p.reduce(((e,t)=>Math.min(e,t)),p[0]),t=p.reduce(((e,t)=>Math.max(e,t)),p[0]);r.range=t-e}r.range<=0&&(r.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([r.range]),m=`\n range${n}: f32`}const b=p instanceof Int32Array?"i32":p instanceof Float32Array?"f32":"u32",w=`data${n}: array<array<${b}, ${u}>, ${a.length}>`;return{flatSourceArray:p,sourceArraySize:p.length,maxEntryLen:u,arraySizes:l,complexity:d,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:m,entryType:o,dataTypeWGSL:b,dataStructWgsl:w,EncodedArrayConstructor:h}}(e,n[t],t,s[t])));if(0===l)throw new Error("No columns provided. Please provide at least one column of data.");1===l&&(r=G.MANHATTAN);let h=d.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),p=!1;h&&""!=h.trim()||(p=!0,h="\ndummy: f32\n");const m=d.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(l*u);d.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,b=d.reduce(((e,t)=>e+t.complexity),0),w=Math.ceil(6e3/b),v=Math.ceil(Math.sqrt(Math.ceil(100))),A=10*v,C=u*(u-1)/2,E=Math.ceil(C/g),T=o.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${E} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${u}>, ${l}>,\n // the weights for each entry\n weights: array<f32, ${l}>,\n // the data for each entry\n ${m} // an example of the dataWgsl would be:\n //data0: array<array<u32,20>,100>,\n //data1: array<array<u32,20>,100>\n }\n\n // struct for the supplementary information\n struct SuppInfo {\n // struct containing all the supplementary info, like scoring matrix, alphabet indexes, range, etc.\n ${h}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${p?"let otherDummy = suppInfo.dummy * 2;":""} // just to make sure that the suppInfo is not optimized out\n let threadCol = id.x;\n let threadRow = id.y;\n let linearIndex = threadRow * ${A} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${u}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${u}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${w}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${c}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${u}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${q(n,d.map((e=>e.maxEntryLen)),c,r)}\n\n\n `}),M=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:T,entryPoint:"calcSparseMatrix"}}),P=new Uint32Array(g),L=new Uint32Array(g),N=new Uint32Array(g),$=new Uint32Array(g),I=Math.floor(C/g);let R=0,O=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?C-1:(e+1)*I,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),r=t-u*n+Math.floor((n+1)*(n+2)/2);P[e]=O,L[e]=R,N[e]=r,$[e]=n,R=n,O=r}console.timeEnd("GPUthreadStarts");const k=4e4+u*l+l+d.reduce(((e,t)=>e+t.sourceArraySize),0),D=d.reduce(((e,t)=>e+t.suppInfoSize),0),H=1e6,F=k*Uint32Array.BYTES_PER_ELEMENT;let U=F;const V=15&F;0!==V&&(U+=16-V);const Y=o.createBuffer({label:"compute info buffer",size:U,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),W=Y.getMappedRange();let z=0;new Uint32Array(W,z,g).set(P),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,g).set(L),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,g).set(N),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,g).set($),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,f.length).set(f),z+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(W,z,l).set(i),z+=l*Float32Array.BYTES_PER_ELEMENT;for(const e of d){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(W,z,n).set(e.flatSourceArray),z+=n*t.BYTES_PER_ELEMENT}Y.unmap();const Z=D*Uint32Array.BYTES_PER_ELEMENT;let X=Z;const J=15&Z;0!==J&&(X+=16-J),X=Math.max(X,16);const Q=o.createBuffer({label:"supp info buffer",size:X,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),ee=Q.getMappedRange();let te=0;for(const e of d)e.suppInfoBuffer&&e.suppInfoBuffer.byteLength>0&&e.suppInfoSize>0&&(new("UINT32ARRAY"===e.suppInfoType?Uint32Array:Float32Array)(ee,te,e.suppInfoBuffer.length).set(e.suppInfoBuffer),te+=e.suppInfoBuffer.byteLength);0===te&&new Uint32Array(ee,0,4).set([1,1,1,1]),Q.unmap();const ne=302e4*Uint32Array.BYTES_PER_ELEMENT;let re=ne;const ie=15&ne;0!==ie&&(re+=16-ie);const se=o.createBuffer({label:"results buffer",size:re,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:M.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:Y}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:se}}]}),ae=o.createBuffer({label:"results out buffer",size:se.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),ce=[],le=[],ue=[];let de=!1;for(;!de;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(M),t.setBindGroup(0,oe),t.dispatchWorkgroups(v,v),t.end(),e.copyBufferToBuffer(se,0,ae,0,ae.size);const n=e.finish();o.queue.submit([n]),yield o.queue.onSubmittedWorkDone(),yield ae.mapAsync(GPUMapMode.READ);const r=ae.getMappedRange();let i=0;const s=new Uint32Array(r,i,H);i+=H*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(r,i,H);i+=H*Uint32Array.BYTES_PER_ELEMENT;const c=new Float32Array(r,i,H);i+=H*Float32Array.BYTES_PER_ELEMENT;const l=new Uint32Array(r,i,g);i+=g*Uint32Array.BYTES_PER_ELEMENT,de=new Uint32Array(r,i,g).every((e=>1===e));const u=l.reduce(((e,t)=>e+t),0),d=new Uint32Array(u),h=new Uint32Array(u),p=new Float32Array(u);let m=0;for(let e=0;e<l.length;e++){const t=l[e];0!==t&&(d.set(s.subarray(e*y,e*y+t),m),h.set(a.subarray(e*y,e*y+t),m),p.set(c.subarray(e*y,e*y+t),m),m+=t)}ce.push(d),le.push(h),ue.push(p),ae.unmap()}const he=ce.reduce(((e,t)=>e+t.length),0),pe=new Uint32Array(he),me=new Uint32Array(he),fe=new Float32Array(he);let ge=0;for(let e=0;e<ce.length;e++)pe.set(ce[e],ge),me.set(le[e],ge),fe.set(ue[e],ge),ge+=ce[e].length;return Y.destroy(),Q.destroy(),se.destroy(),ae.destroy(),{i:pe,j:me,distance:fe}}))}([L.entries],A,[u],G.MANHATTAN,[1],[L.options??{}])}catch(e){console.error(e)}R||(h.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),R=await(new $).calc(L.entries,u,A,L.options));const O=await async function(e,t){const n=e.distance.map(((n,r)=>{const i=Math.abs(t.get(e.i[r])-t.get(e.j[r]));return 0!=n?i/n:1/0})),r=e.distance.map((e=>1-e)),i=e.i,s=e.j,o=a.BitSet.create(t.length);return e.distance.forEach(((t,n)=>{o.set(e.i[n],!0),o.set(e.j[n],!0)})),{simVals:r,saliVals:n,n1:i,n2:s,cliffsBitSet:o}}(R,c),D=function(e,t,n,r,i,s,o){const c=new Array(e).fill(0);for(let e=0;e!=r.length;++e)n[e]!=1/0&&(o.get(r[e])>o.get(i[e])?c[r[e]]+=n[e]:c[i[e]]+=n[e]);return a.Column.fromList("double",t,c)}(t.length,`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,O.saliVals,O.n1,O.n2,0,c);e.columns.add(D);const H=O.cliffsBitSet,F=function(e){const t=e.filter((e=>e!==1/0)),n=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE);return{max:t.reduce(((e,t)=>Math.max(e,t)),n),min:n}}(O.saliVals),V=.8/(F.max-F.min),Y=v?s.shell.view("Browse").preview:s.shell.getTableView(e.name),W=Y.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:r[0],yColumnName:r[1],size:D.name,color:c.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:i}),Z=function(e,t,n,r,i,s,o,c){const l={from:new Uint32Array(t.n1.length),to:new Uint32Array(t.n1.length),opacities:new Float32Array(t.n1.length),colors:new Array(t.n1.length),widths:new Float32Array(t.n1.length)};for(let n=0;n<t.n1.length;n++)l.from[n]=t.n1[n],l.to[n]=t.n2[n],l.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*c,l.colors[n]=e.selection.get(l.from[n])&&e.selection.get(l.to[n])?"255,255,0":"0,128,0",l.widths[n]=1;const u=a.DataFrame.create(l.from.length);return se.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?l.from[e]:l.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),s),u.col(e).semType=i})),u.columns.addNewFloat(te).init((e=>Math.abs(r.get(l.from[e])-r.get(l.to[e])))),u.columns.addNewInt(ie).init((e=>e)),u.columns.addNewFloat(ne).init((e=>t.saliVals[e])),u.columns.addNewFloat(re).init((e=>t.simVals[e])),u.name=`${Q}${J}`,{lines:l,linesDf:u}}(e,O,t,c,p,m,F,V);Z.lines.skipMultiLineCalculation=!0,Z.linesDf.col(ne).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const ae=new k(W,r[0],r[1],Z.lines,I.none),ce=b?b(Z.linesDf,se).sort([ne],[!1]):Z.linesDf.plot.grid().sort([ne],[!1]);ce.col(ie)&&(ce.col(ie).visible=!1),e.temp[".cliffsDfGrid"]=ce;const le=o.button(`${Z.linesDf.rowCount} cliffs`,(()=>{const e=X()(Y.viewers).some((e=>e.dataFrame.name===`${Q}${J}`));v&&!e&&Y.addViewer(ce),Y.dockManager.dock(ce,"down",null,"Activity cliffs",w??.2)}));le.classList.add("scatter_plot_link","cliffs_grid"),W.root.append(le);const ue=o.input.toggle("Show only cliffs",{value:!1,onValueChanged:t=>{t?(W.dataFrame.setTag(oe,r[0]),e.filter.and(H),ee.next(r[0])):(W.dataFrame.setTag(oe,""),e.filter.setAll(!0),ee.next(""))}});ue.root.classList.add("scatter_plot_link","show_only_cliffs"),W.root.append(ue.root),ee.subscribe((e=>{ue.enabled=""===e||e===r[0]}));let de=!1;W.onEvent("d4-before-draw-scene").subscribe((t=>{de?de=!1:ue.value&&(setTimeout((()=>{e.filter.and(H)}),100),de=!0)}));const he=s.events.onViewerClosed.subscribe((e=>{e.args.viewer===W&&(Y.dockManager.close(ce.root),he.unsubscribe(),Y.subs=Y.subs.filter((e=>e!==he)))}));return Y.subs.push(he),Z.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<Z.linesDf.rowCount;e++)Z.lines.widths[e]=e===Z.linesDf.currentRowIdx?3:1;ae.linesToRender=Z.lines;const n=Z.linesDf.currentCol&&Z.linesDf.currentCol.name===se[1]?Z.lines.to:Z.lines.from,i=-1!==Z.linesDf.currentRowIdx?Z.linesDf.currentRowIdx:null;if(W.dataFrame.currentRowIdx=i?n[i]:-1,null!==i){const n=Z.linesDf.currentRowIdx;ae.currentLineId=n;const{zoomLeft:a,zoomRight:l,zoomTop:u,zoomBottom:d}=function(e,t,n,r,i,s){const o=Math.abs(n-i),a=Math.abs(r-s),c=e/o,l=t/a,u=Math.min(c,l),d=e/u*5,h=t/u*5,p=(n<i?n:i)+o/2-d/2,m=(r>s?r:s)-a/2+h/2;return{zoomLeft:p,zoomRight:p+d,zoomTop:m,zoomBottom:m-h}}(W.viewport.width,W.viewport.height,W.dataFrame.get(r[0],Z.lines.from[n]),W.dataFrame.get(r[1],Z.lines.from[n]),W.dataFrame.get(r[0],Z.lines.to[n]),W.dataFrame.get(r[1],Z.lines.to[n]));W.zoom(a,u,l,d),ue.value?e.filter.and(H):!0===ue.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,r,i,a,c,l,u){const d=t.getPane("Cliff Details");o.empty(d.root);const h=u({points:[n,r],lineId:i,df:e,seqCol:a,activityCol:c,sali:l});d.root.append(h),setTimeout((()=>{s.shell.o=t.root}),500)}(e,C,Z.lines.from[i],Z.lines.to[i],i,t,c,Z.linesDf.get(ne,i),y);const n=W.dataFrame.getSortedOrder(Y.grid.sortByColumns,Y.grid.sortTypes);Y.grid.scrollToCell(t.name,n.indexOf(W.dataFrame.currentRowIdx))}),1e3)}})),Z.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<Z.linesDf.rowCount;e++){const n=Z.linesDf.selection.get(e);n&&(t.set(Z.lines.from[e],!0),t.set(Z.lines.to[e],!0)),Z.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),ae.linesToRender=Z.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(E?E=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<Z.lines.colors.length;e++)Z.lines.colors[e]="0,128,0";ae.linesToRender=Z.lines})(ce.dataFrame))})),ae.lineClicked.subscribe((t=>{if(E=!0,ae.currentLineId=t.id,-1!==t.id){const n=Z.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),Z.linesDf.selection.copyFrom(n)):(Z.linesDf.currentRowIdx!==t.id&&(Z.linesDf.currentRowIdx=t.id,e.currentRowIdx=Z.lines.from[t.id]),Z.linesDf.selection.copyFrom(n));const r=Z.linesDf.getSortedOrder(ce.sortByColumns,ce.sortTypes);ce.scrollToCell(se[0],r.indexOf(t.id))}),500)}})),ae.lineHover.pipe((0,P.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[Z.lines.from[n.id],Z.lines.to[n.id]],df:e,seqCol:t,activityCol:c}),n.x,n.y)})),W.addProperty("similarityLimit","double",A),C=function(){const e=o.accordion(),t=o.element("i");return t.className="grok-icon svg-icon svg-view-layout",e.addTitle(o.span([t,o.label("Activity cliffs")])),e.addPane("Cliff Details",(()=>o.divText("Cliff has not been selected")),!0),s.shell.o=e.root,e}(),W}var ce,le,ue=n(2003),de=n(826),he=n(3516),pe=n(6718),me=n(3077),fe=n(439);(le=ce||(ce={})).IDENTITY="identity",le.SIMILARITY="similarity";var ge,ye,be,we=n(9192),ve=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function Ae(e){const t=["Embed_X","Embed_Y"],n=e.columns.names().filter((e=>e.includes(t[0]))).length+1;return t.map((e=>`${e}_${n}`))}function Ce(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}n(5540),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(ge||(ge={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(ye||(ye={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(be||(be={})),Object.prototype.toString,n(6873);var Ee=n(4356),Te=(n(6717),n(4870),n(3856)),Se=n(6882),_e=n(7278),xe=(n(310),n(6642)),Me=n(3599);function Pe(e){const t=!X().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],r=t?"":" ";for(const[t,i]of X().enumerate(e)){let s=t;i<e.length&&(s+=`${t?"":"-"}${r}`),n.push(s)}return[n,t]}function Le(e,t,n,r,i,s,o){const a=document.createElement("canvas"),c=a.getContext("2d");c.font="12px monospace";const l=c.measureText(Pe([e]).join("")).width,u=c.measureText(Pe([t]).join("")).width,d=Math.max(l,u);return a.height=o,a.width=d+4,c.font="12px monospace",c.textBaseline="top",(0,Te.oZ)(c,e,0,i-s,d,o,{color:n,pivot:0,left:!0}),(0,Te.oZ)(c,t,0,i+s,d,o,{color:r,pivot:0,left:!0}),a}n(673),n(4139),xe.sD,ue.zS,a.GridCellRenderer,a.GridCellRenderer,a.GridCellRenderer;var Ne,$e,Ie,Re,Oe=n(8070),ke=n(4326);function De(e){const t=o.divH([],{style:{gap:"10px"}}),n=o.divV([o.divText(e.seqCol.name),o.divText(e.activityCol.name)]);return n.style.fontWeight="bold",n.style.display="flex",n.style.justifyContent="space-between",t.append(n),e.points.forEach((n=>{const r=o.divText(e.activityCol.get(n).toFixed(2));r.style.display="flex",r.style.justifyContent="left",r.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),r]))})),t}function Ge(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,r)=>{n[r]=e.activityCol.get(t)}));const r={},i=de.G.forColumn(e.seqCol),s=i.defaultBiotype,a=function(e,t,n,r){const i=document.createElement("canvas"),s=i.getContext("2d");i.height=30;const o=Gt();return function(e,t,n,r,i,s,o,a,c,l,u){if(s.length!==o.length){const e=function(e,t){let n=0,r=0;const i=e.length>t.length?e:t,s=e.length>t.length?t:e;for(let e=0;e<s.length;e++)i[e]===s[e]&&n++;const o=i.length-s.length;for(let e=i.length-1;e>o;e--)i[e]===s[e-o]&&r++;const a=new Array(Math.abs(e.length-t.length)).fill(fe.b9[ue.Hi.FASTA]);function c(e){return n>r?e.concat(a):a.concat(e)}return e.length>t.length?t=c(X()(t).toArray()):e=c(X()(e).toArray()),{subParts1:e,subParts2:t}}(s,o);s=e.subParts1,o=e.subParts2}const d=e.measureText(Pe(s).join("")),h=e.measureText(Pe(o).join("")),p=Math.max(d.width,h.width);l&&(r=p+4*s.length,e.canvas.width=p+4*s.length);let m=Math.max(t,t+(r-(p+4*s.length))/2)+5;const f=Math.max(n,n+(i-28)/2);e.save();try{e.beginPath(),e.rect(t,n,l?p+4*s.length:r,i),e.clip(),e.font="12px monospace",e.textBaseline="top";const d=7;for(let t=0;t<s.length;t++){const n=s[t],l=o[t];let h=Se.S$;if(c&&(h=c.getMonomerTextColor(a,n)),n!=l){let s=Se.S$;c&&(s=c.getMonomerTextColor(a,l));const o=(0,Te.oZ)(e,n,m,f-d,r,i,{color:h,pivot:0,left:!0}),p=(0,Te.oZ)(e,l,m,f+d,r,i,{color:s,pivot:0,left:!0});m=Math.max(p,o),u&&(u[t]=Le(n,l,h,s,f,d,i))}else m=(0,Te.oZ)(e,n,m,f,r,i,{color:h,pivot:0,left:!0,transparencyRate:.5});m+=4}}finally{e.restore()}}(s,0,0,0,30,X().count(0).take(e.length).map((t=>e.getCanonical(t))).toArray(),X().count(0).take(t.length).map((e=>t.getCanonical(e))).toArray(),n,o,!0,r),i}(i.getSplitted(e.points[0]),i.getSplitted(e.points[1]),s,r);return t.append(o.div(a,{style:{width:"300px",overflow:"scroll"}})),t.append(function(e){const t=o.div();if(Object.keys(e).length>0){const n=o.divV([]);n.append(o.divH([o.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),o.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const t of Object.keys(e))e[t].style.borderBottom="1px solid lightgray",n.append(o.divH([o.divText((parseInt(t)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),e[t]]));t.append(n)}return t}(r)),t.append(He("Activity delta",Math.abs(n[0]-n[1]))),t.append(He("Cliff",e.sali)),t}function He(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Fe(e,t){const n=a.Column.string("seq_diff",e.rowCount).init((n=>`${e.get(t[0],n)}#${e.get(t[1],n)}`));n.semType="MacromoleculeDifference",n.meta.units=e.col(t[0]).meta.units,n.setTag(ue.gp.separator,e.col(t[0]).getTag(ue.gp.separator)),e.columns.add(n);const r=e.plot.grid();return r.col(t[0]).visible=!1,r.col(t[1]).visible=!1,r}!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(Ne||(Ne={})),new class{constructor(){this.regionTypes=[Ne.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=ke.fH.Entropy,this.filterSource=ke.Fo.filterSource}},n(7602),n(8047),function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}($e||($e={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(Ie||(Ie={})),a.JsViewer,n(6863),n(2780),n(8115),a.JsViewer,n(1407),fe.b9[fe.Hi.FASTA],n(5433),n(3890),n(1687),function(e){e.TYPE="V2000",e[e.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",e[e.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",e[e.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",e[e.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",e[e.BOND_TYPE_COL=3]="BOND_TYPE_COL",e[e.RGP_SHIFT=8]="RGP_SHIFT",e[e.MAX_ATOM_COUNT=999]="MAX_ATOM_COUNT",e.RGP_LINE_START="M RGP",e.ATOM_ALIAS_LINE_START="A ",e.END="M END"}(Re||(Re={}));class Ue{constructor(e){this.init(e)}init(e){this.fileContent=e.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 e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var e;return null!==(e=this._atomTypes)&&void 0!==e||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var e;return null!==(e=this._pairsOfBondedAtoms)&&void 0!==e||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var e;return null!==(e=this._bondTypes)&&void 0!==e||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:e,bondCount:t}=this.parseAtomAndBondCounts();this._atomCount=e,this._bondCount=t}getNextColumnIdx(e){for(;!this.isWhitespace(e);)++e;for(;this.isWhitespace(e);)++e;return e}shiftIdxToSpecifiedColumn(e,t){let n=e;const r=this.isWhitespace(n)?t:t-1;for(let e=0;e<r;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToAtomType(n),t[r]=this.parseAtomType(n),n=this.getNextLineIdx(n);return t}parseAtomCoordinates(){const e=new Float32Array(this.atomCount),t=new Float32Array(this.atomCount),n=new Float32Array(this.atomCount);let r=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){r=this.shiftIdxToXColumn(r);for(const s of[e,t,n])s[i]=this.parseFloatValue(r),r=this.getNextColumnIdx(r);r=this.getNextLineIdx(r)}return{x:e,y:t,z:n}}parseBondedAtomPairs(){const e=new Array(this.bondCount);let t=this.getBondBlockIdx();for(let n=0;n<this.bondCount;n++){t=this.shiftIdxToBondedAtomsPair(t);const r=new Uint16Array(2);r[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),r[1]=this.parseIntValue(t),e[n]=r,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToBondType(n),t[r]=this.parseIntValue(n),n=this.getNextLineIdx(n);return t}isWhitespace(e){const t=this.fileContent[e];return" "===t||"\t"===t}getNextLineIdx(e){return"\n"!==this.fileContent[e]?this.fileContent.indexOf("\n",e)+1:e+1}parseFloatValue(e){return this.parseNumericValue(parseFloat,e)}parseIntValue(e){return this.parseNumericValue(parseInt,e)}parseNumericValue(e,t){let n=t+1;for(;!this.isWhitespace(n);)++n;return e(this.fileContent.substring(t,n))}}class Ve extends Ue{constructor(e){super(e),this.init(e)}init(e){super.init(e)}parseAtomType(e){let t=e,n=t;return this.isQuote(t)?(n=this.getNextIdenticalChar(t),t++):n=this.fileContent.indexOf(" ",n),this.fileContent.substring(t,n)}isQuote(e){const t=this.fileContent[e].charCodeAt(0);return 39===t||34===t}getNextIdenticalChar(e){const t=this.fileContent[e];return t?this.fileContent.indexOf(t,e+1):-1}isQuery(){return this.isQueryOrFragment(((e,t)=>{return 39===e||34===e||76===e&&!((n=this.fileContent.charCodeAt(t+1))>64&&n<91||n>96&&n<123);var n}))}isFragment(){return this.isQueryOrFragment((e=>82===e||42===e))}isQueryOrFragment(e){const t=this.atomCount;let n=this.getAtomBlockIdx();for(let r=0;r<t;r++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class Be extends Ve{constructor(e){super(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map,t=this.fileContent.split("\n");t.filter((e=>e.startsWith(Re.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,r]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,r)}}));const n=t.map(((e,t)=>{if(e.startsWith(Re.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),r=n.map((e=>t[e])),i=n.map((e=>t[e+1]));r.forEach(((t,n)=>{const r=parseInt(t.split(/\s+/)[1])-1,s=parseInt(i[n].substring(1));if(e.has(s))throw new Error(`R group ${s} is already in the map`);e.set(s,r)}));const s=this.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==s.length)throw new Error(`Unaccounted R group indices: ${s}`);return e}getAtomIdxToRgpIdxList(e){const t=e.split(/\s+/).filter((e=>e)).slice(3).map((e=>parseInt(e))),n=new Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=[t[e+1],t[e]-1];return n}getRGroupAtomicIndices(){return this.atomTypes.map(((e,t)=>{if(e.includes("R#"))return t})).filter((e=>void 0!==e))}static isValidMolfile(e){return-1!==e.indexOf(Re.TYPE)&&-1!==e.indexOf(Re.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,Re.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<Re.NUM_OF_HEADER_LINES;++t)e=this.getNextLineIdx(e);return e}getAtomBlockIdx(){let e=this.getCountsLineIdx();return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){return this.getNextColumnIdx(e)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,Re.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,Re.BOND_TYPE_COL)}getBondBlockIdx(){let e=this.getAtomBlockIdx();for(let t=0;t<this.atomCount;t++)e=this.getNextLineIdx(e);return e}parseAtomAndBondCounts(){let e=this.getCountsLineIdx(),t=e+Re.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=Re.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Ye extends Ve{constructor(e){super(e),this.init(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map;return this.getAtomLines().forEach(((t,n)=>{const r=t.match(/RGROUPS=\(([\d\s]+)\)/);if(r){const t=r[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const i=t[1];if(e.has(i))throw new Error(`R group ${i} is already in the map`);e.set(i,n)}})),e}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let e=this.fileContent.indexOf("M V30 BEGIN ATOM");return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){let t=this.shiftIdxToAtomType(e);return this.isQuote(t)?(t=this.getNextIdenticalChar(t),t=this.getNextColumnIdx(t),t):this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static isValidMolfile(e){return-1!==e.indexOf("V3000")&&-1!==e.indexOf("M END")}parseAtomAndBondCounts(){let e=this.fileContent.indexOf("M V30 COUNTS ")+14,t=this.fileContent.indexOf(" ",e+1);const n=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class We{constructor(){}static getInstance(e){if(We.isMolfileV2K(e))return new Be(e);if(We.isMolfileV3K(e))return new Ye(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return Be.isValidMolfile(e)}static isMolfileV3K(e){return Ye.isValidMolfile(e)}}var je=n(6197),Ke=n(9124),ze=n(3527);class qe{biotype;id;n;m;type;mt;smiles;get issmiles(){return!!this.smiles}at={R1:"H",R2:"H",R3:"H",R4:"H",R5:"H",R6:"H",R7:"H",R8:"H",R9:"H"};get rs(){return Object.keys(this.at).length}constructor(e,t,n="missing",r=void 0,i=void 0,s=void 0,o){if(this.biotype=e,this.id=t,this.n=n,this.m=r,this.type=i,this.mt=s,this.smiles=o,!this.id)throw new Error("Invalid arg undefined [id].")}static objCounter=-1;objId=++qe.objCounter;className="WebEditorMonomerDummy";toLog(){return`Helm: ${this.className}<${this.objId}>`}}class Ze extends qe{backgroundcolor="#FFFFFF";linecolor="#808080";textcolor="#808080";constructor(e){super(e,"*","gap")}}class Xe extends qe{backgroundcolor="#808080";linecolor="#000000";textcolor="#000000";constructor(e,t){super(e,t,"ambiguous")}}class Je extends qe{backgroundcolor="#FF4444";linecolor="#800000";textcolor="#FFFFFF";constructor(e,t,n){super(e,t,"missing"),n&&(this.backgroundcolor="#C0C0C0",this.linecolor="#404040",this.textcolor="#404040")}}class Qe extends qe{backgroundcolor="#FFFF44";linecolor="#800000";textcolor="#000000";constructor(e,t){super(e,t,"broken")}}class et{id;m;n;na;type;mt;at;smiles;get rs(){return Object.keys(this.at).length}get issmiles(){return!!this.smiles}linecolor;backgroundcolor;textcolor;constructor(e,t,n,r,i,s,o,a){this.id=e,this.m=t,this.n=n,this.na=r,this.type=i,this.mt=s,this.at=o,this.smiles=a}static fromMonomer(e,t,n){let r={};const i=t.symbol,s=t.smiles;if(t.rgroups.length>0)t.rgroups.forEach((e=>{r[e.label]=e.capGroupName}));else{if(!s){if(t.lib)return new Qe(e,i);throw new Error("Unexpected missing monomer without .lib")}r=n.getRS(s)}const o=new et(t.symbol,t.molfile,t.name,t.naturalAnalog,t.polymerType,t.monomerType,r),a=n.getMonomerColors(e,t.symbol);return a&&(o.textcolor=a?.textcolor,o.linecolor=a?.linecolor,o.backgroundcolor=a?.backgroundcolor),o}}const tt={[Me.o.BASE]:{A:"green",G:"black",T:"red",C:"blue",U:"red"},[Me.o.NUCLEOTIDE]:{A:"green",G:"black",T:"red",C:"blue",U:"red"},[Me.o.LINKER]:{P:"#9aa5e1",p:"#9aa5e1"},[Me.o.SUGAR]:{R:"#7a85c1",r:"#7a85c1"},[Me.o.AA]:{A:"rgb(44,160,44)",R:"rgb(23,190,207)",N:"rgb(235,137,70)",D:"rgb(31,119,180)",C:"rgb(188,189,34)",E:"rgb(31, 120, 150)",Q:"rgb(205, 111, 71)",G:"rgb(214,39,40)",H:"rgb(158,218,229)",I:"rgb(23,103,57)",L:"rgb(30,110,96)",K:"rgb(108, 218, 229)",M:"rgb(60,131,95)",F:"rgb(24,110,79)",P:"rgb(255,152,150)",S:"rgb(255,187,120)",T:"rgb(245,167,100)",W:"rgb(182, 223, 138)",Y:"rgb(152,223,138)",V:"rgb(74,160,74)"},[Me.o.CHEM]:{R:"#eeeeee"},[Me.o.BLOB]:{B:"#999999",G:"#e2e2e2"}},nt=/[\w()]+/,rt=RegExp(String.raw`\(${nt}(,${nt})+\)`),it=new ze.Mi([255,255,255]),st=new ze.Mi([0,0,0]),ot=.7*(0,F.wQ)(it);class at{_monomers;_isEmpty;get isEmpty(){return this._isEmpty}_onChanged=new u.Subject;get onChanged(){return this._onChanged}constructor(e){this._monomers=e,this._isEmpty=!this._monomers||0===Object.keys(this._monomers).length||Object.entries(this._monomers).every((([e,t])=>0===Object.keys(t).length))}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let r=t;return t==fe._S||t===fe.b9[fe.Hi.HELM]?r="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(r="Any"),n[t]={symbol:t,name:r,molfile:"",author:"MISSING",id:-1,rgroups:X().count(1).take(9).map((e=>({capGroupSmiles:"",alternateId:"",capGroupName:"",label:`R${e.toString()}`}))).toArray(),smiles:"",polymerType:e,monomerType:void 0,createDate:null}}getMonomer(e,t){let n=t;"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p");let r=null;if(e){const t=this._monomers[e];r=t?t[n]:null}else{Ot.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(r=t[n],r)break}return r}getWebEditorMonomer(e,t){const[n,r]=(0,Ke.fA)(e,t),i=(0,je.Y)(n);let s=this.getMonomer(i,r);if(s&&n==Me.o.LINKER&&2!=s.rgroups.length)return null;if(s&&n==Me.o.SUGAR&&3!=s.rgroups.length)return null;s||(s=this.addMissingMonomer(i,r));let o=s.wem??null;return o||(r===fe._S||"*"==r?o=s.wem=new Ze(n):n===Me.o.NUCLEOTIDE&&"N"===r||n===Me.o.AA&&"X"===r||(Me.o.CHEM,0)||rt.test(r)?o=s.wem=new Xe(n,r):s.lib||(o=s.wem=new Je(n,r,this.isEmpty)),o||(o=s.wem=et.fromMonomer(n,s,this))),o}getTooltip(e,t){const n=(0,je.Y)(e),r=o.div([],{classes:"ui-form ui-tooltip"}),i=this.getMonomer(n,t);if(i){const n=i.symbol,a=(i.name,this.getWebEditorMonomer(e,t));a.backgroundcolor,r.append(o.divH([o.div([n],{style:{textWrap:"nowrap",marginLeft:"4px",marginRight:"4px",color:a.textcolor,backgroundColor:a.backgroundcolor,borderColor:a.linecolor,borderWidth:"1px",borderStyle:"solid",borderRadius:"2px",padding:"3px",minWidth:"24px",textAlign:"center"}}),o.div([i.name],{style:{padding:"4px"}})],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const c={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let l;l=i.molfile?s.chem.svgMol(i.molfile,void 0,void 0,c):i.smiles?o.divV([s.chem.svgMol(i.smiles,void 0,void 0,c),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),r.append(o.div(l,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),i.symbol!=fe._S&&r.append(o.divText(i.lib?.source??"Missed in libraries"))}else r.append(o.divV([o.divText(`Monomer '${t}' of type '${n}' not found.`),o.divText("Open the Context Panel, then expand Manage Libraries")]));return r}getMonomerTextColor(e,t){const n=this.getMonomerColors(e,t),r=e=>{const t=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e);if(t)return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])];const r=a.Color.fromHtml(n.textcolor);return[a.Color.r(r),a.Color.g(r),a.Color.b(r)]},i=r(n.textcolor),s=new ze.Mi([...i.map((e=>e+1))]),o=(0,F.KE)(s,it)/((0,F.wQ)(s)*(0,F.wQ)(it)),c=r(n.backgroundcolor),l=new ze.Mi([...c.map((e=>e+.01))]);let u;u=(0,F.KE)(l,it)/((0,F.wQ)(l)*(0,F.wQ)(it))<o?c:i;let d=new ze.Mi(u);const h=(0,F.wQ)(d);return h>ot&&(d=(0,F.dC)(st,d,ot/h)),`rgb(${d[0]}, ${d[1]}, ${d[2]})`}getMonomerColors(e,t){const n="default";let r=n;const i=(0,je.Y)(e),s=this.getMonomer(i,t);let o;if(s){if(s.meta&&s.meta.colors){const e=s.meta.colors;n in e||(r="default"),o=e[r]}if(!o){const t=tt[e],n=t?.[s.symbol];n&&(o={textColor:a.Color.toHtml(a.Color.getContrastColor(a.Color.fromHtml(n))),lineColor:"#202020",backgroundColor:n})}const t=s.naturalAnalog;if(!o&&t)return this.getMonomerColors(e,t)}return o||(o={textColor:"#202020",lineColor:"#202020",backgroundColor:"#A0A0A0"}),{textcolor:o.text??o.textColor,linecolor:o.line??o.lineColor,backgroundcolor:o.background??o.backgroundColor}}getRS(e){const t=e.match(/(?<=\[)[^\][]*(?=])/gm),n={};let r,i="";if(t)for(let e=0;e<t.length;e++)if(null!=t[e]&&/\d/.test(t[e])){r=t[e][t[e].length-1],t[e]=t[e].replace(/[0-9]/g,"");for(let n=0;n<t[e].length;n++)":"!=t[e][n]&&(i+=t[e][n]);n["R"+r]=i,i=""}return n}}var ct=n(5488),lt={};lt.styleTagTransform=C(),lt.setAttributes=b(),lt.insert=g().bind(null,"head"),lt.domAPI=m(),lt.insertStyleElement=v(),h()(ct.A,lt),ct.A&&ct.A.locals&&ct.A.locals;class ut extends at{source;error;_duplicateMonomers={};get duplicateMonomers(){return this._duplicateMonomers}_duplicatesHandled=!0;get duplicatesHandled(){return this._duplicatesHandled}duplicatesNotified=!1;constructor(e,t=void 0,n=void 0){super(e),this.source=t,this.error=n;for(const[e,t]of Object.entries(this._monomers))for(const[e,n]of Object.entries(t))n.lib=this}toJSON(){const e=[];for(const t of Object.values(this._monomers))for(const n of Object.values(t))e.push({...n,lib:void 0,wem:void 0});return e}getMonomer(e,t){let n=t;"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p");let r=null;if(e){const t=this._monomers[e];r=t?.[n]??null}else{Ot.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(r=t[n],r)break}return r}_monomerSets=null;getMonomerSet(e){const t=(0,je.Y)(e);if(this._monomerSets||(this._monomerSets={}),!(e in this._monomerSets))for(const[e,n]of Object.entries(this._monomers[t]));return this._monomerSets[e]}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(e){const t={};return Object.keys(this._monomers[e]??{}).forEach((n=>{t[n]=this._monomers[e][n].molfile})),t}getMonomerSymbolsByType(e){return Object.keys(this._monomers[e])}getMonomerSymbolsByRGroup(e,t,n){let r=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return r=r.filter((e=>null!==e)),0===r.length?[]:(r=r.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;var r;return r=We.getInstance(t.molfile).atomTypes,r.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&=!0,n})),r.map((e=>e?.symbol)))}_updateLibInt(e){const t=e.getPolymerTypes(),n=this.getPolymerTypes();t.forEach((t=>{n.includes(t)||(this._monomers[t]={}),e.getMonomerSymbolsByType(t).forEach((n=>{this._monomers[t][n]&&(this._duplicateMonomers[t]??={},this._duplicateMonomers[t][n]??=[this._monomers[t][n]],this._duplicateMonomers[t][n].push(e.getMonomer(t,n))),this._monomers[t][n]=e.getMonomer(t,n)}))})),this._isEmpty=this.isEmpty&&e.isEmpty}updateLibs(e,t=!1){t&&(this._monomers={},this._isEmpty=!0),this._duplicateMonomers={};for(const t of e)t.error||this._updateLibInt(t);Object.entries(this.duplicateMonomers).length>0?(0,Ee.ub)().then((e=>{this.assignDuplicatePreferences(e)})):this._duplicatesHandled=!0,this._onChanged.next()}assignDuplicatePreferences(e){let t=!0;for(const n in this.duplicateMonomers)for(const r in this.duplicateMonomers[n])if(e.duplicateMonomerPreferences?.[n]?.[r]){const i=e.duplicateMonomerPreferences[n][r],s=this.duplicateMonomers[n][r].find((e=>e.lib?.source===i));s?this._monomers[n][r]=s:t=!1}else t=!1;return this._duplicatesHandled=t,t}clear(){this._monomers={},this._onChanged.next()}getSummaryObj(){const e={},t=this.getPolymerTypes();for(const n of t)e[n]=this.getMonomerSymbolsByType(n).length;return e}getSummaryDf(){const e=this.getPolymerTypes(),t=new Array(e.length);for(const[n,r]of X().enumerate(e))t[r]=this.getMonomerSymbolsByType(n).length;return a.DataFrame.fromColumns([a.Column.fromStrings("polymerType",e),a.Column.fromList(a.COLUMN_TYPE.INT,"count",t)])}getSummary(){const e=this.getPolymerTypes();return 0==e.length?"empty":e.map((e=>`${e} ${this.getMonomerSymbolsByType(e).length}`)).join("\n")}override(e){return new dt(e,this)}}class dt extends at{data;base;constructor(e,t){super(e),this.data=e,this.base=t}get onChanged(){return this.base.onChanged}addMissingMonomer(e,t){return this.base.addMissingMonomer(e,t)}getMonomer(e,t){const n=this.data[e]?.[t];return n??this.base.getMonomer(e,t)}}class ht{monomerLib;symbol;polymerType;monomerType;monomerLinks;monomers;error=null;constructor(e,t,n,r,i){this.monomerLib=e,this.symbol=t,this.polymerType=n,this.monomerType=r,this.monomerLinks=i;try{this.monomers=this.monomerLinks.map((e=>{const n=this.monomerLib.getMonomer(this.polymerType,e.symbol);if(!n)throw new Error("Monomer not found: ");if(n.lib?.source!=e.source)throw new Error(`Monomer '${t}' found in different library.`);return n}))}catch(e){const[t,n]=(0,we.AP)(e);this.error=t,this.monomers=[]}}}class pt{description;placeholders;source;error;constructor(e,t,n=void 0,r=void 0){this.description=e,this.placeholders=t,this.source=n,this.error=r}updateSets(e,t=!1){t&&(this.placeholders=[]);for(const t of e)t.error||this._updateSetInt(t)}_updateSetInt(e){for(const t of e.placeholders)this.placeholders.push(t)}}var mt=n(7433),ft=n.n(mt),gt=n(1913),yt=n.n(gt);class bt{helmMonomerSchema;validateMonomerSchema;constructor(e){this.helmMonomerSchema=e;const t=new(ft())({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});yt()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const n=this.parseJson(e,t);return null!==n&&(Array.isArray(n)?this.validateJsonContent(n,t):(console.warn(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format: The file must contain an array of monomers.`),!1))}parseJson(e,t){try{return JSON.parse(e)}catch(e){return console.error(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format:`,e),null}}validateJsonContent(e,t){let n=!0;const r=new Set;for(const i of e){const e=i.symbol??i.id??i.name??"#N/A";if(n=this.validateMonomerSchema(i),!n){console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' violating JSON schema:`,i,"\nError reason: ",this.validateMonomerSchema.errors,`\nThere may be other errors in ${t} since the validation is stopped after the first error.`," Please, verify that the monomer library file satisfies the JSON schema");break}const s=`${i.polymerType??""}-${e}`;r.has(s)&&console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' is duplicated.`,"Please, verify that the monomer library file does not contain duplicated monomer symbols."),r.add(s)}return n}}var wt=n(8604);class vt{fileValidator;libHelper;eventManager;logger;filesPromise=Promise.resolve();constructor(e,t,n,r){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.logger=r,this.eventManager.updateValidLibraryFileListRequested$.subscribe((()=>{this.updateValidLibList().then((()=>{}))})),this.eventManager.updateValidSetFileListRequested$.subscribe((()=>{this.updateValidSetList().then((()=>{}))}))}static objCounter=-1;objId=++vt.objCounter;toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t,n){const r=await s.dapi.files.readAsText(wt.gt),i=JSON.parse(r),o=new bt(i);return new vt(o,e,t,n)}async addLibraryFile(e,t,n=!0){try{if(await s.dapi.files.exists(wt.so+`${t}`))return void s.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await s.dapi.files.writeAsText(wt.so+`${t}`,e),await this.updateValidLibList(),await s.dapi.files.exists(wt.so+`${t}`)?s.shell.info(`Added ${t} HELM library`):s.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),s.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await s.dapi.files.delete(wt.so+`${e}`),await this.updateValidLibList(),s.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await s.dapi.files.exists(wt.so+`${e}`)?s.shell.error(`Failed to delete ${e} library`):s.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let n=[];const r=new a.FileSource(e),i=await r.readAsText(t);n=JSON.parse(i);const s={},o=[];return n.forEach((e=>{const t=e.polymerType,n=e.symbol;o.includes(t)||(s[t]={},o.push(t)),s[t][n]=e})),new ut(s,t)}async loadSetFromFile(e,t,n){let r={};const i=new a.FileSource(t),s=await i.readAsText(n);r=JSON.parse(s);const o=r.description,c=Object.entries(r.placeholders).map((([t,n])=>{const r=t,i=n.polymerType,s=n.monomerType,o=n.set;return new ht(e,r,i,s,o)}));return new pt(o,c)}getValidLibraryPaths(){return this.eventManager.getValidLibPathList()}getValidSetPaths(){return this.eventManager.getValidSetPathList()}async getValidLibraryPathsAsynchronously(){return await this.eventManager.getValidLibraryPathsAsynchronously()}async updateValidLibList(){const e=`${this.toLog()}.updateValidLibList()`;return this.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{this.logger.debug(`${e}, IN`);const t=[],n=await this.getLibFileListAtLocation();if(!this.libListHasChanged(n))return void this.logger.debug(`${e}, end, not changed`);for(const e of n){if(!e.endsWith(".json")){t.push(e);continue}const n=await s.dapi.files.readAsText(wt.so+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const r=n.filter((e=>!t.includes(e)));if(this.libListHasChanged(r)&&(this.eventManager.changeValidLibPathList(r),this.libHelper.loadMonomerLib(!0)),r.some((e=>!e.endsWith(".json")))&&this.logger.warning(`Wrong validation: ${r}`),t.length>0){const e=`Invalid monomer library files in ${wt.so}, consider fixing or removing them: ${t.join(", ")}`;this.logger.warning(e)}this.logger.debug(`${e}, OUT`)})),this.logger.debug(`${e}, end`),this.filesPromise}async updateValidSetList(){const e=`${this.toLog()}.updateValidSetList()`;return Ot.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{Ot.logger.debug(`${e}, IN`);const t=[],n=await this.getSetFileListAtLocation();if(!this.setListHasChanged(n))return void Ot.logger.debug(`${e}, end, not changed`);for(const e of n)e.endsWith(".json")?await s.dapi.files.readAsText(wt.Es+`${e}`):t.push(e);const r=n.filter((e=>!t.includes(e)));this.setListHasChanged(r)&&(this.eventManager.changeValidSetPathList(r),this.libHelper.loadMonomerSets(!0)),Ot.logger.debug(`${e}, OUT`)})),Ot.logger.debug(`${e}, end`),this.filesPromise}libListHasChanged(e){const t=this.eventManager.getValidLibPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}setListHasChanged(e){const t=this.eventManager.getValidSetPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}async validateAgainstHELM(e,t){if(!this.isValidHELMLibrary(e,t))throw new Error(`File ${t} does not satisfy HELM standard`)}isValidHELMLibrary(e,t){return this.fileValidator.validateFile(e,t)}async getLibFileListAtLocation(){const e=`${this.toLog()}.getLibFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(wt.so).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(wt.so.length)))}async getSetFileListAtLocation(){const e=`${this.toLog()}.getSetFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(wt.Es).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(wt.Es.length)))}}class At{constructor(){}static _instance;static getInstance(){return At._instance||(At._instance=new At),At._instance}_libFilesUpdateSubject$=new u.BehaviorSubject([]);_setFilesUpdateSubject$=new u.BehaviorSubject([]);_addLibraryFilesSubject$=new u.Subject;_librarySelectionSubject$=new u.Subject;getValidLibPathList(){return this._libFilesUpdateSubject$.getValue()}getValidSetPathList(){return this._setFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{const t=this._libFilesUpdateSubject$.pipe((0,P.skip)(1)).subscribe((n=>{e(n),t.unsubscribe()}))}))}changeValidLibPathList(e){this._libFilesUpdateSubject$.next(e)}changeValidSetPathList(e){this._setFilesUpdateSubject$.next(e)}get updateUIControlsRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidLibraryFileListRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidSetFileListRequested$(){return this._setFilesUpdateSubject$.pipe()}get addLibraryFileRequested$(){return this._addLibraryFilesSubject$.pipe()}addLibraryFile(){this._addLibraryFilesSubject$.next()}get librarySelectionRequested$(){return this._librarySelectionSubject$}updateLibrarySelectionStatus(e,t){this._librarySelectionSubject$.next([e,t])}}class Ct{logger;_monomerLib=new ut({},"MAIN");_monomerSets=new pt("MAIN",[]);_eventManager;get eventManager(){return this._eventManager}async awaitLoaded(e=5e3){return await Promise.race([(async()=>{const e=await this.getFileManager();return await e.filesPromise,!0})(),(async()=>(await(0,Oe.cb)(e),!1))()]).then((t=>{if(!t)throw new Error(`Loading monomer libraries timeout ${e} ms.`)}))}constructor(e){this.logger=e}static objCounter=-1;objId=(()=>{if(++Ct.objCounter>0)throw new Error("MonomerLibManager MUST be a singleton.");return Ct.objCounter})();toLog(){return`MonomerLibManager<${this.objId}>`}getMonomerLib(){return this._monomerLib}getBioLib(){return this.getMonomerLib()}getMonomerSets(){return this._monomerSets}get duplicateMonomers(){return this._monomerLib.duplicateMonomers}get duplicatesHandled(){return this._monomerLib.duplicatesHandled}assignDuplicatePreferances(e){this._monomerLib.assignDuplicatePreferences(e)}_fileManagerPromise;async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await vt.create(this,this._eventManager,this.logger))()),this._fileManagerPromise}loadLibrariesPromise=Promise.resolve();async loadMonomerLib(e=!1){const t=`${this.toLog()}.loadMonomerLib()`;return this.logger.debug(`${t}, start`),this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{this.logger.debug(`${t}, IN`);const n=a.TaskBarProgressIndicator.create("Loading monomers ...");try{const[[t],r]=await Promise.all([await this.getFileManager().then((e=>[e.getValidLibraryPaths()])),(0,Ee.ub)()]),i=t.filter((e=>{const t=!r.exclude.includes(e),n=0===r.explicit.length||r.explicit.includes(e);return t&&n}));let s=0;const o=i.length,[a]=await Promise.all([Promise.all(i.map((e=>this.readLibrary(wt.so,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new ut({},e,n)})).finally((()=>{n.update(Math.round(100*++s/o),`Loading monomers ${s}/${o}`)})))))]);this._monomerLib.updateLibs(a,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{n.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadLibrariesPromise}async loadLibraries(e){return this.loadMonomerLib(e)}loadSetsPromise=Promise.resolve();async loadMonomerSets(e=!1){const t=`${this.toLog()}.loadMonomerSets()`;return this.logger.debug(`${t}, start`),this.loadSetsPromise=this.loadSetsPromise.then((async()=>{this.logger.debug(`${t}, IN`);const e=a.TaskBarProgressIndicator.create("Loading monomer sets ...");try{const[[t]]=await Promise.all([await this.getFileManager().then((e=>[e.getValidSetPaths()]))]),n=t.filter((e=>!0));let r=0;const i=n.length,[s]=await Promise.all([Promise.all(n.map((t=>this.readSet(wt.Es,t).catch((e=>{const n=`Loading monomer sets from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new pt("Broken monomer set",[],t,n)})).finally((()=>{e.update(Math.round(100*++r/i),`Loading monomers ${r}/${i}`)})))))]);this._monomerSets.updateSets(s)}catch(e){const t=`Loading monomer sets error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{e.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadSetsPromise}async readLibrary(e,t){const n=await this.getFileManager();return await n.loadLibraryFromFile(e,t)}async readSet(e,t){const n=await this.getFileManager();return await n.loadSetFromFile(this._monomerLib,e,t)}async selectSpecifiedLibraries(e){const t=await this.getInvalidFileNames(e);if(t.length>0)throw new Error(`Cannot select libraries ${t}: no such library in the list`);const n=await(0,Ee.ub)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,Ee.Eu)(n)}async getInvalidFileNames(e){const t=(await this.getFileManager()).getValidLibraryPaths();return e.filter((e=>!t.includes(e)))}async loadMonomerLibForTests(){await(0,Ee.Eu)(wt.G3),await this.awaitLoaded(),await this.loadMonomerLib(!0)}static async getInstance(){let e=window.$monomerLibHelperPromise;return null==e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new Ct(Ot.logger);return e._eventManager=At.getInstance(),e})()),e}}n(1757);var Et=n(3017),Tt={};Tt.styleTagTransform=C(),Tt.setAttributes=b(),Tt.insert=g().bind(null,"head"),Tt.domAPI=m(),Tt.insertStyleElement=v(),h()(Et.A,Tt),Et.A&&Et.A.locals&&Et.A.locals,n(3151);new O.A(new Uint32Array([2,0,0,0,16,0,0,0,134217728,0,0,0,32,0,33554432,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,32,0,0,2,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,65536,0,0,524288,0,0,0,0,0,0,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536870912,64,0,0,0]),2048),new O.A(new Uint32Array([2,0,65600,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,2097152,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,512,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,16,134217728,0,0,0,0,0,0,524288,0,0,0,128,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,512,2147483648,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,33554432,0,0,0,0,33554432,0,1024,1,0,524288,32768,32,0,0,0,0,16,524288,0,0,0,0,0,0,0,0,0,71303168,0,0,34603008,131072,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([134217728,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,0,128,0,0,0,0,2097216,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,1073840128,0,0,0,0,0,0,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,512,0,262144,192,0,268435456,0,0,8200,0,0,0,67108864,0,524296,0,32,0,0,0,0,16,524288,0,0,2147483648,0,0,8,0,0,0,0,0,0,34603008,131072,536870920,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,150994944,64,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,327680,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,8388608,0,33554432,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,268435488,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,2097152,0,0,67108864,0,0,524288,0,0,0,8,0,0,0,524288,0,0,8192,0,0,0,0,0,0,0,2147483648,0,34668544,0,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,134217728,0,0,0,32,512,0,0,0,0,0,0,1024,256,0,8388608,262400,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,42991616,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2050,0,65536,1048576,0,0,0,0,0,0,0,0,1056,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,0,536870912,0,2,0,0,1074266112,0,0,0,0,0,0,0,524288,0,0,0,4194304,0,0,0,0,0,0,2147483648,0,34603008,0,536870912,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,16777216,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536871936,67108864,0,0,0]),2048),new O.A(new Uint32Array([0,0,1024,0,0,0,0,0,0,131072,0,1024,32,0,0,0,0,512,0,0,1024,0,0,64,0,128,0,0,1073741824,0,0,138412032,16,0,67108864,0,0,0,0,0,0,8192,0,0,8388608,0,0,8,0,0,0,0,0,0,256,0,0,0,0,553648128,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,0,32,0,0,0,0,2,0,0,1024,0,0,8,262144,128,0,0,16,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,16777216,2147483648,0,34603008,0,536871936,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,32,0,0,0,0,0,268435488,0,0,0,0,0,0,32768,134218752,0,16,8,262144,128,0,1073741824,0,0,8388608,0,0,0,65536,0,524289,0,0,0,0,0,0,0,524288,2048,0,0,0,0,0,0,0,0,0,2147483648,0,34603008,1048576,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,1073741824,0,0,0,0,0,32,0,0,4,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,1048576,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,8388608,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,8,134217728,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,536870912,0,0,0,0,1048576,67108864,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,0,134217728,0,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,1073741824,128,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,8388608,0,0,0,0,0,0,256,4096,32,0,0,0,0,0,0,0,1024,0,0,0,262144,192,0,0,0,0,0,0,0,0,67108865,0,524288,32768,32,0,0,0,8224,16,524288,0,0,0,0,32,128,0,2097152,0,4194304,8388608,0,34603008,8519680,536870912,131072,262144,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,4194304,0,0,32,0,0,0,0,0,0,0,1024,0,0,512,262144,128,33554432,0,0,0,0,33554432,0,0,0,0,524288,0,32,0,0,2,0,16,524288,0,0,0,0,0,4,0,0,0,71303168,262144,0,34603008,131072,536870912,0,0,0,0]),2048);new O.A(new Uint32Array([0,0,0,0,0,0,0,0,0,1024,0,67108864,0,0,0,512,0,0,0,8388608,0,0,512,0,0,64,4,0,0,0,4,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,659456,0,256,0,16,0,0,0,268435456,0,0,262144,0,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([0,1073741824,0,0,0,0,0,2147483648,4,67108864,0,67108864,0,256,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,0,67108864,0,524289,0,65536,0,0,0,0,16,0,131072,0,4,0,0,0,0,0,0,4194304,0,0,2147483648,131072,0,4096,0,0,0]),2048),new O.A(new Uint32Array([0,0,0,0,1024,0,0,0,0,67109888,16384,67108864,0,0,0,0,0,0,0,33562624,1024,33554432,512,16384,0,64,4,0,0,33554432,0,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,135168,0,268435456,0,0,0,0,0,268435456,131072,0,0,2147483648,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([8388608,0,0,0,0,0,0,0,0,67108864,0,0,0,4,0,0,0,0,0,0,1024,0,0,16384,0,64,0,0,0,0,0,0,0,2,67108864,0,0,0,0,0,0,0,0,40976,0,0,0,0,0,0,0,0,0,67108864,131072,524288,0,0,8519680,0,1,33554432,1048576,0]),2048),new O.A(new Uint32Array([0,0,131072,1073741824,0,0,0,0,0,67108864,0,0,0,0,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,32768,67108864,0,0,0,0,0,0,0,0,16,0,0,0,4,0,0,2048,0,0,0,4341760,0,0,0,131072,0,0,33554432,1048576,0]),2048);var St,_t=n(857),xt={};xt.styleTagTransform=C(),xt.setAttributes=b(),xt.insert=g().bind(null,"head"),xt.domAPI=m(),xt.insertStyleElement=v(),h()(_t.A,xt),_t.A&&_t.A.locals&&_t.A.locals,function(e){e.MONOMER="Monomer",e.SYMBOL="Symbol",e.NAME="Name",e.R_GROUPS="~R-Groups",e.MONOMER_TYPE="Monomer Type",e.POLYMER_TYPE="Polymer Type",e.NATURAL_ANALOG="Natural Analog",e.AUTHOR="Author",e.CREATE_DATE="Create Date",e.ID="ID",e.META="Meta",e.SOURCE="Source"}(St||(St={})),St.MONOMER,a.COLUMN_TYPE.STRING,St.SYMBOL,a.COLUMN_TYPE.STRING,St.NAME,a.COLUMN_TYPE.STRING,St.R_GROUPS,a.COLUMN_TYPE.STRING,St.MONOMER_TYPE,a.COLUMN_TYPE.STRING,St.POLYMER_TYPE,a.COLUMN_TYPE.STRING,St.NATURAL_ANALOG,a.COLUMN_TYPE.STRING,St.AUTHOR,a.COLUMN_TYPE.STRING,St.CREATE_DATE,a.COLUMN_TYPE.DATE_TIME,St.ID,a.COLUMN_TYPE.INT,St.META,a.COLUMN_TYPE.STRING,St.SOURCE,a.COLUMN_TYPE.STRING;var Mt,Pt=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class Lt{constructor(e,t,n=!1,r){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=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._stopStartBtn=o.button(o.iconFA("pause"),(()=>Pt(this,void 0,void 0,(function*(){return yield this._changeStopState()}))),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>Pt(this,void 0,void 0,(function*(){return yield this._restartScript()}))),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>Pt(this,void 0,void 0,(function*(){this._isStepProcessed||(yield this._nextStep())}))),"Next step"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._closeBtn=o.button(o.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=e,this.description=t,this._isAutomatic=n,this._autoStartFirstStep=null!==(i=null==r?void 0:r.autoStartFirstStep)&&void 0!==i&&i,this._progress.max=0,this._progress.value=1,Lt.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=o.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var e;this._activity.append(o.div(this.description,"tutorials-root-description"));for(let t=0;t<this.stepNumber;t++){let n=o.iconFA("clock");this._isAutomatic||0===t&&(n=o.iconFA("play",(()=>this._nextStep()),"Next step"),n.className="grok-icon fas fa-play");const r=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),i=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),s=o.divH([n,r],"grok-tutorial-entry");this._activity.append(s,i)}}_initRoot(){var e,t,n;s.shell.windows.showContextPanel=!0,s.shell.windows.showHelp=!1;const r=s.shell.isInDemo?Array.from(s.shell.view("Browse").dockManager.rootNode.children)[0]:Array.from(s.shell.dockManager.rootNode.children)[0];this._node=s.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,r,""),(null===(t=null===(e=r.parent.container.containerElement.firstElementChild)||void 0===e?void 0:e.lastElementChild)||void 0===t?void 0:t.classList.contains("tab-handle-list-container"))&&(null===(n=r.parent.container.containerElement.firstElementChild)||void 0===n||n.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 e,t;return Pt(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],r=this._activity.getElementsByClassName("grok-icon")[this._currentStep],i=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];r.className="grok-icon far fa-spinner-third fa-spin",i.classList.remove("hidden"),i.classList.add("visible");const c=n,l=(null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay)?null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay:2e3;try{s.shell.isInDemo=!0,yield this._steps[this._currentStep].func()}catch(e){s.shell.isInDemo=!1,console.error(e)}this._scrollTo(this._root,c.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(n,r,l),yield(0,Oe.cb)(l));const u=o.iconFA("check");if(r.replaceWith(u),u.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)return this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn),void(s.shell.isInDemo=!1);if(!this._isAutomatic){const e=this._activity.getElementsByClassName("grok-icon")[this._currentStep],t=o.iconFA("play",(()=>this._nextStep()),"Next step");t.className="grok-icon fas fa-play",e.replaceWith(t),this._nextStepBtn.classList.remove("disabled"),this._nextStepBtn.firstChild.classList.remove("fa-disabled")}if(s.shell.isInDemo){const e=s.shell.view("Browse");(null==e?void 0:e.preview)instanceof a.TableView&&(yield s.data.detectSemanticTypes(e.preview.dataFrame)),s.shell.isInDemo=!1}}))}_startScript(){return Pt(this,void 0,void 0,(function*(){for(let e=this._currentStep;e<this.stepNumber&&!this._isStopped&&!this._isCancelled;e++)yield this._nextStep()}))}_scrollTo(e,t){e.focus(),e.scrollTop=t}_countdown(e,t,n){return Pt(this,void 0,void 0,(function*(){const r=o.div([],"demo-script-countdown");t.classList.add("hidden");let i=n/1e3;const s=this._createSVGIndicator(i);r.append(s),e.prepend(r);const a=setInterval((()=>{i--,0===i&&(clearInterval(a),r.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(n),t}_changeStopState(){return Pt(this,void 0,void 0,(function*(){const e=this._stopStartBtn.getElementsByClassName("grok-icon");e[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(e[0].className="grok-icon fal fa-pause",this._isStepProcessed||(yield this._startScript()))}))}_restartScript(){return Pt(this,void 0,void 0,(function*(){s.shell.dockManager.close(this._node),this._clearRoot(),this._setInitParams(),yield this.start()}))}_clearRoot(){this._root=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.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(){s.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,Lt.currentObject=null,s.shell.isInDemo=!1}step(e,t,n){return this._steps[this.steps.length]={name:e,func:t,options:n},this}start(){return Pt(this,void 0,void 0,(function*(){s.shell.isInDemo=!0,this._initRoot(),s.shell.newView(this.name),this._isAutomatic?yield this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}Lt.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(Mt||(Mt={})),n(8152);var Nt=n(966);n(608),n(1619),n(5785),n(6869),new class{tooltipHandlerTemp="tooltip-handler.Monomer"},a.GridCellRenderer;class $t{constructor(e,t,n=""){this.target=e,this.debugEnabled=t,this.prefix=n}error(e,t,n){return this.target.error(this.prefix+e,t,n)}warning(e,t){return this.target.warning(this.prefix+e,t)}info(e,t){return this.target.info(this.prefix+e,t)}debug(e,t){if(this.debugEnabled)return this.target.debug(this.prefix+e,t)}}Map;class It extends a.Package{_properties;_rdKitModule;get rdKitModule(){return this._rdKitModule}get properties(){return this._properties}set properties(e){this._properties=e}_initialized=!1;get initialized(){return this._initialized}constructor(e={debug:!1}){super(),super._logger=new $t(super.logger,e.debug)}completeInit(e){this._rdKitModule=e,this._initialized=!0}handleErrorUI(e){const[t,n]=(0,we.AP)(e);s.shell.error(t),this.logger.error(t,void 0,n)}}async function Rt(e,t,n,r){const i=await async function(e,t,n,r){const i=(0,me.R)(t),s=de.G.forColumn(t).getNewColumnFromList("ref",[n]),o=de.G.forColumn(s).getSplitted(0),c=r===ce.IDENTITY?function(e,t){const n=t.columns.length,r=new Array(n),i=new Array(n),s=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);r[o]=n.getRawData(),i[o]=n.categories.indexOf("");const a=o<e.length?e.getOriginal(o):fe._S;s[o]=n.categories.indexOf(a)}const o=a.Column.float("Identity",t.rowCount),c=o.getRawData();for(let n=0;n<t.rowCount;++n){c[n]=0;for(let t=0;t<e.length;++t)(r[t]?r[t][n]:0)===s[t]&&++c[n];c[n]/=e.length}return o}(o,i):r===ce.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,pe.uL)(n,e)}(o,i):null;if(null===c)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return c.name=e.columns.getUnusedName(c.name),e.columns.add(c),c}(e,t,n,r);for(let e=0;e<i.length;e++)t.isNone(e)&&i.set(e,null,!1);return i}n(2174),a.Widget,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(ue.z1),n(7456),_e.Mu,n(330),n(9235),OCL,n(294),n(6956);const Ot=new It;async function kt(){return await Ct.getInstance()}let Dt=null;function Gt(){return Dt}async function Ht(e,t,n,r,i,u,d,h,p){if(!(0,Nt.V)(t,"Activity Cliffs"))return;const m=Ae(e),f={units:t.meta.units,aligned:t.getTag(ue.gp.aligned),separator:t.getTag(ue.gp.separator),alphabet:t.getTag(ue.gp.alphabet)},g=u,y=t,b=async()=>await ae(e,y,m,"Activity cliffs",n,r,g,i,{...h??{}},a.SEMTYPE.MACROMOLECULE,f,d,De,Ge,Fe,void 0,p),w=i===l.c.UMAP?2e5:2e4,v=i===l.c.UMAP?5e3:2e3;if(e.rowCount>w)return void s.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${w}`);const A=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>v&&!h?.[c.vb]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{b().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():b().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,we.AP)(e);throw Ot.logger.error(t,void 0,n),e})).finally((()=>{A.close()}))}async function Ft(e,t,r,i,l,u,d,h,p){const m=p?s.shell.view("Browse").preview:s.shell.tv.dataFrame==e?s.shell.tv:void 0;if((0,Nt.V)(t,"Sequence Space"))return u||(u=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),d??={},await async function(e,t,r,i,l,u,d,h=!0,p=!1,m={preprocessingFuncArgs:[]},f={},g=null,y={}){const b={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==i.length||t.length!==u.length||t.length!==l.length||t.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const w=h?f.tableView??s.shell.tableView(e.name)??s.shell.addTableView(e):null,v=async()=>{const v=a.TaskBarProgressIndicator.create(`Initializing ${f.scatterPlotName??"dimensionality reduction"} ...`);let A;try{const C=Ae(e);function E(n,i,s){let l=null,u=null;e.columns.names().includes(C[0])?(l=e.columns.byName(C[0]),u=e.columns.byName(C[1])):(l=e.columns.add(a.Column.float(C[0],e.rowCount)),u=e.columns.add(a.Column.float(C[1],e.rowCount)),h&&!A&&(A=w.scatterPlot({...b,x:C[0],y:C[1],title:f.scatterPlotName??Ce(t,r)}))),f[c.YP]&&(A?.root&&o.setUpdateIndicator(A.root,!1),l.init((e=>s[0]?s[0][e]:void 0)),u.init((e=>s[1]?s[1][e]:void 0)));const d=n/i*100;v.update(d,`Running ${f.scatterPlotName??"dimensionality reduction"}... ${d.toFixed(0)}%`)}async function T(){e.columns.add(a.Column.float(C[0],e.rowCount)),e.columns.add(a.Column.float(C[1],e.rowCount));let n=null;h&&(A=w.scatterPlot({...b,x:C[0],y:C[1],title:f.scatterPlotName??Ce(t,r)}),o.setUpdateIndicator(A.root,!0));const p=s.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&A?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===A?.getOptions()?.look?.title&&(s.events.fireCustomEvent(D,{}),p.unsubscribe(),n?.(),v.close())})),g=new Promise((async(e,s)=>{try{n=e;const s=[];for(let e=0;e<u.length;++e){const n=u[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),n){const r=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:c}=await n.apply({[r]:t[e],[o]:i[e],...m.preprocessingFuncArgs[e]??{}});s.push({entries:a,options:c}),m.distanceFnArgs.push(c)}else{const n=t[e].toList(),r={};s.push({entries:n,options:r}),m.distanceFnArgs.push(r)}}e(await U(s.map((e=>e.entries)),r,i,l,d,m,f[c.vb]?void 0:E))}catch(e){s(e)}})),y=await g;return v.close(),p.unsubscribe(),y}const S=await T();if(p&&S){const _=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const x=await function(e,t,r,i){return ve(this,void 0,void 0,(function*(){return new Promise((function(s,o){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:e,embedY:t,minPts:i,epsilon:r}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):s(t)}}))}))}(S[0],S[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),M=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(M).init((e=>x[e].toString())),A&&(A.props.colorColumnName=M)}catch(P){s.shell.error("Clustering embeddings failed"),console.error(P)}finally{_.close()}}if(S){const L=e.columns.byName(C[0]),N=e.columns.byName(C[1]);if(L.init((e=>S[0][e])),N.init((e=>S[1][e])),g)try{const $=g.inputs[0].name,I=g.inputs[1].name;await g.prepare({[$]:L,[I]:N,...y}).call(!0)}catch(R){s.shell.error("Post-processing failed"),console.error(R)}if(A)return o.setUpdateIndicator(A.root,!1),A.helpUrl="/help/compute/sequence-space",A}}catch(O){s.shell.error("Dimensionality reduction failed"),console.error(O),v.close(),A&&o.setUpdateIndicator(A.root,!1)}};return new Promise((async(t,n)=>{try{if(f.fastRowCount&&e.rowCount>f.fastRowCount&&!f[c.vb])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await v();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await v();t(e)}}catch(e){n(e)}}))}(e,[t],r,[i],[1],[u],"MANHATTAN",l,h??!1,{...d,preprocessingFuncArgs:[d.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:d?.[c.vb],tableView:m})}function Ut(e){return new he.m(e).importFasta()}function Vt(e){const t=de.G.forColumn(e).stats;return Object.keys(t.freq)}async function Bt(e,t,n){return Rt(e,t,n,ce.IDENTITY)}async function Yt(e,t,n){return Rt(e,t,n,ce.SIMILARITY)}},8115:(e,t,n)=>{"use strict";n.d(t,{if:()=>l,nI:()=>c});var r=n(4328),i=(n(7389),n(6082)),s=n(1407),o=(n(4870),n(8070)),a=n(2003);function c(e,t,n){const r=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),r=e.charAt(0)===t,i=e.charAt(e.length-1)===t,s=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return r?i?`${n}${s}${n}`:`${n}${s}${n}|${n}${s}$`:i?`^${s}${n}|${n}${s}${n}`:`^${s}${n}|${n}${s}${n}|${n}${s}$`}(e,n):e,s=i.BitSet.create(t.length);for(let n=0;n<t.length;n++){const i=t.get(n);(i.match(r)||i===e)&&s.set(n,!0,!1)}return s}async function l(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e){const t=i.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.cb)(10);const t=new Map,n=await(0,s.R)(e,!0,t);e.temp["monomeric-mols"]=n,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{t.close()}}(t);const n=i.Column.string("helm",1).init((t=>e));n.semType=i.SEMTYPE.MACROMOLECULE,n.meta.units=a.Hi.HELM;const c=await(0,s.R)(n,!0,t.temp["monomers-dict"]);return(await r.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:c.get(0),molBlockFailover:""})).get(0)}},966:(e,t,n)=>{"use strict";n.d(t,{V:()=>o,l:()=>a});var r=n(4328),i=n(6082),s=n(826);function o(e,t,n=[],i=[],s=!0){const[o,c]=a(e,t,n,i);return s&&!o&&r.shell.warning(c),o}function a(e,t,n=[],o=[]){let a=!0,c="";const l=s.G.forColumn(e);if(e.semType!==i.SEMTYPE.MACROMOLECULE)r.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=l.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))c=`${t} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.map((e=>`"${e}"`)).join(", ")} `}.`,a=!1;else if(!l.isHelm()){const e=l.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(c=`${t} + ' analysis is allowed for Macromolecules with alphabet ${0==o.length?"any alphabet":`alphabet${o.length>1?"s":""} ${o.map((e=>`"${e}"`)).join(", ")}.`}.`,a=!1)}}return[a,c]}},4139:(e,t,n)=>{"use strict";n.d(t,{HX:()=>d,J:()=>l,b9:()=>u,gN:()=>a,uF:()=>s});var r,i,s,o=n(8152);!function(e){e.SPLIT_COL="~split",e.ACTIVITY="~activity",e.ACTIVITY_SCALED="activity_scaled",e.ALIGNED_SEQUENCE="~aligned_sequence",e.AMINO_ACID_RESIDUE="AAR",e.POSITION="Pos",e.P_VALUE="pValue",e.MEAN_DIFFERENCE="Mean difference"}(r||(r={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(i||(i={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(s||(s={}));const a="MSA";var c,l;!function(e){e.CELL_CHANGING="isCellChanging"}(c||(c={})),function(e){e.SEPARATOR="."}(l||(l={}));const u="3.3.1",d={pepsea:{gapOpen:1.53,gapExtend:0,method:o.ZY[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},5433:(e,t,n)=>{"use strict";n.d(t,{r:()=>s}),n(6082),n(7389);var r=n(4328),i=(n(1757),n(2003),n(826));async function s(e,t,n){const s=i.G.forColumn(e).convert(t,n);e.dataFrame.columns.add(s);const o=await r.functions.call("Bio:detectMacromolecule",{col:s});return o&&(s.semType=o),await r.data.detectSemanticTypes(e.dataFrame),s}},6740:(e,t,n)=>{"use strict";n.d(t,{m8:()=>o});var r=n(4328),i=n(8070),s=n(8152);async function o(e=6e4){const t=await s.Nk.getDockerContainer();await async function(e,t=6e4){let n=e,s=!1;for(let o=0;o<t/200;++o){if(null===n&&(n=await r.dapi.docker.dockerContainers.find(e.id)),a(n)){s=!0;break}switch(n.status){case"stopped":await r.dapi.docker.dockerContainers.run(n.id);break;case"pending change":case"changing":break;case"error":throw new Error("Docker container error state.")}n=null,await(0,i.cb)(200)}if(!s)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},6956:(e,t,n)=>{"use strict";n.d(t,{mP:()=>r});const r="H"},8604:(e,t,n)=>{"use strict";n.d(t,{Es:()=>i,G3:()=>o,VV:()=>a,gt:()=>s,so:()=>r});const r="System:AppData/Bio/monomer-libraries/",i="System:AppData/Bio/monomer-sets/",s="System:AppData/Bio/tests/libraries/HELMmonomerSchema.json",o={explicit:["HELMCoreLibrary.json","polytool-lib.json"],exclude:[],duplicateMonomerPreferences:{}},a={PEPTIDE:326,RNA:383,CHEM:0}},1619:(e,t,n)=>{"use strict";n.d(t,{D:()=>P});var r=n(4328),i=n(6082),s=n(7389),o=n(8070),a=n(2003),c=n(826),l=n(608),u=n(8152),d=n(966),h=n(4139),p=n(6740),m=n(3572),f=n(5072),g=n.n(f),y=n(7825),b=n.n(y),w=n(7659),v=n.n(w),A=n(5056),C=n.n(A),E=n(540),T=n.n(E),S=n(1113),_=n.n(S),x=n(6369),M={};async function P(e={}){return new Promise((async(t,n)=>{e.clustersCol??=null,e.pepsea??={},e.pepsea.method??=h.HX.pepsea.method,e.pepsea.gapOpen??=h.HX.pepsea.gapOpen,e.pepsea.gapExtend??=h.HX.pepsea.gapExtend;const a=e.col?.dataFrame??r.shell.t,c=e.col??a.columns.bySemType(i.SEMTYPE.MACROMOLECULE);if(null==c){const e="Multiple Sequence Alignment analysis requires a dataset with a macromolecule column.";return r.shell.warning(e),void n(new l.Ap(s.divText(e)))}const d=s.input.choice("Method",{value:e.pepsea.method,items:u.ZY});d.setTooltip("Alignment method");const p=s.input.float("Terminal gap",{value:e?.kalign?.terminalGap});p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const m=s.p(`Kalign version: ${h.b9}`,"kalign-version"),f=s.input.float("Gap open",{value:e.pepsea.gapOpen});f.setTooltip("Gap opening penalty at group-to-group alignment");const g=s.input.float("Gap extend",{value:e.pepsea.gapExtend});g.setTooltip("Gap extension penalty to skip the alignment");const y=s.inputs([f,g,p]),b=s.button("Alignment parameters",(()=>{y.hidden=!y.hidden,[f,g,p].forEach((e=>{e.root.style.removeProperty("max-width"),e.captionLabel.style.removeProperty("max-width")}))}),"Adjust alignment parameters such as penalties for opening and extending gaps");b.classList.add("msa-params-button"),y.hidden=!0,b.prepend(s.icons.settings((()=>null)));const w=[d.root.style],v=[p.root.style,m.style];let A,C=c;const E=s.input.column("Sequence",{table:a,value:c,onValueChanged:async e=>{if(!e||e.semType!==i.SEMTYPE.MACROMOLECULE)return _.disabled=!0,await(0,o.cb)(0),void(E.value=C);C=e,_.disabled=!1,A=await N(E.value,a,w,v,d,T,f,g,p)},filter:e=>e.semType===i.SEMTYPE.MACROMOLECULE});E.setTooltip("Sequences column to use for alignment");const T=s.input.column("Clusters",{table:a,value:e.clustersCol});T.nullable=!0;const S=s.dialog("MSA").add(E).add(T).add(d).add(y).add(b).add(m).onOK((async()=>{await L(E,a,A,t,n)})),_=S.getButton("OK");if(E.fireChanged(),e.col)return A=await N(e.col,a,w,v,d,T,f,g,p),void await L(E,a,A,t,n);S.show()}))}async function L(e,t,n,s,o){let a=null;const c=i.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===n)throw new Error("Invalid column format");if(a=await n(),null==a)return o("PepSeA container has not started");t.columns.add(a),await r.data.detectSemanticTypes(t),s(a)}catch(e){o(e)}finally{c.close()}}async function N(e,t,n,s,o,f,g,y,b){try{if(e.semType!==i.SEMTYPE.MACROMOLECULE)return;const r=t.columns.getUnusedName(`msa(${e.name})`);if((0,d.V)(e,e.name,[a.Hi.FASTA,a.Hi.SEPARATOR],[a.YI.DNA,a.YI.RNA,a.YI.PT],!1)){$(n,s,"kalign"),g.value=null,y.value=null,b.value=null;const t=c.G.forColumn(e),i=t.isFasta()?e:t.convert(a.Hi.FASTA);return async()=>await(0,l.eE)(i,!1,r,f.value)}if((0,d.V)(e,e.name,[a.Hi.HELM],[],!1))return $(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(e,r,o.value,g.value,y.value,f.value));if((0,d.V)(e,e.name,[a.Hi.SEPARATOR],[a.YI.UN],!1)){const t=c.G.forColumn(e).convert(a.Hi.HELM);return $(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(t,r,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,b.value=null,void $(n,s,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();r.shell.error(t),m._package.logger.error(t)}}function $(e,t,n){if("kalign"===n){for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}else{for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}}M.styleTagTransform=_(),M.setAttributes=C(),M.insert=v().bind(null,"head"),M.domAPI=b(),M.insertStyleElement=T(),g()(x.A,M),x.A&&x.A.locals&&x.A.locals},608:(e,t,n)=>{"use strict";n.d(t,{Ap:()=>D,aZ:()=>U,eE:()=>H});var r=n(7389),i=n(6082),s=n(1991),o=n.n(s),a=n(3516),c=n(2003);const l=Symbol("Comlink.proxy"),u=Symbol("Comlink.endpoint"),d=Symbol("Comlink.releaseProxy"),h=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[l],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&h in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function f(e,t=self){t.addEventListener("message",(function n(r){if(!r||!r.data)return;const{id:i,type:s,path:o}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(T);let c;try{const t=o.slice(0,-1).reduce(((e,t)=>e[t]),e),n=o.reduce(((e,t)=>e[t]),e);switch(s){case"GET":c=n;break;case"SET":t[o.slice(-1)[0]]=T(r.data.value),c=!0;break;case"APPLY":c=n.apply(t,a);break;case"CONSTRUCT":c=function(e){return Object.assign(e,{[l]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),c=function(e,t){return C.set(e,t),e}(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[h]:0}}Promise.resolve(c).catch((e=>({value:e,[h]:0}))).then((e=>{const[r,o]=E(e);t.postMessage(Object.assign(Object.assign({},r),{id:i}),o),"RELEASE"===s&&(t.removeEventListener("message",n),g(t))}))})),t.start&&t.start()}function g(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function y(e,t){return w(e,[],t)}function b(e){if(e)throw new Error("Proxy has been released and is not useable")}function w(e,t=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(n,s){if(b(r),s===d)return()=>S(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{g(e),r=!0}));if("then"===s){if(0===t.length)return{then:()=>i};const n=S(e,{type:"GET",path:t.map((e=>e.toString()))}).then(T);return n.then.bind(n)}return w(e,[...t,s])},set(n,i,s){b(r);const[o,a]=E(s);return S(e,{type:"SET",path:[...t,i].map((e=>e.toString())),value:o},a).then(T)},apply(n,i,s){b(r);const o=t[t.length-1];if(o===u)return S(e,{type:"ENDPOINT"}).then(T);if("bind"===o)return w(e,t.slice(0,-1));const[a,c]=A(s);return S(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(T)},construct(n,i){b(r);const[s,o]=A(i);return S(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},o).then(T)}});return i}function v(e){return Array.prototype.concat.apply([],e)}function A(e){const t=e.map(E);return[t.map((e=>e[0])),v(t.map((e=>e[1])))]}const C=new WeakMap;function E(e){for(const[t,n]of m)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},C.get(e)||[]]}function T(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function S(e,t,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){!n.data||!n.data.id||n.data.id!==i||(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}const _="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksYz0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgdT1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxwKT0+ZFtwXSxlKSxmPW4ucmVkdWNlKChkLHApPT5kW3BdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjp1W24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkodSxjKTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4uYyk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOnB9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUscCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaCh1KXtsPXt2YWx1ZTp1LFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2godT0+KHt2YWx1ZTp1LFt5XTowfSkpLnRoZW4odT0+e2NvbnN0W2YsZF09Uyh1KTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLE0ocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBNKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBoKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYoaChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKGM9PmMudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57TShlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCBjPWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiBjLnRoZW4uYmluZChjKX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbixjKXtoKHMpO2NvbnN0W2wsdV09UyhjKTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sdSkudGhlbihtKX0sYXBwbHkoYSxuLGMpe2gocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W3UsZl09RihjKTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDp1fSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtoKHMpO2NvbnN0W2MsbF09RihuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAodT0+dS50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6Y30sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIEYoZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLGs9ImVhZ2VyIix4PSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgYz1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHtjfWApLHQuZnMuc3ltbGluayhjLGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIGM7bGV0IG49aTtyZXR1cm4oKGM9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOmMuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09eCYmKHMubG9hZGluZz1rLGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtyZXR1cm4gdC5jb25maWcucHJpbnRJbnRlcmxlYXZlZCYmKG89cy5zdGRvdXQpLHMucmVpbml0PT09ITAmJmF3YWl0IHRoaXMucmVpbml0KHMudG9vbCksb30sY2F0KGUpe3JldHVybiB0Ll9maWxlb3AoImNhdCIsZSl9LGxzKGUpe3JldHVybiB0Ll9maWxlb3AoImxzIixlKX0sZG93bmxvYWQoZSl7cmV0dXJuIHQuX2ZpbGVvcCgiZG93bmxvYWQiLGUpfSxwd2QoKXtyZXR1cm4gdC5mcy5jd2QoKX0sY2QoZSl7Zm9yKGxldCByIG9mIHQudG9vbHMpIXIubW9kdWxlfHxyLm1vZHVsZS5GUy5jaGRpcihlKX0sbWtkaXIoZSl7cmV0dXJuIHQuZnMubWtkaXIoZSksITB9LHJlYWQoe3BhdGg6ZSxsZW5ndGg6cixmbGFnOmk9InIiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKSxuPW5ldyBVaW50OEFycmF5KHIpO3JldHVybiB0LmZzLnJlYWQoYSxuLHMscixvKSx0LmZzLmNsb3NlKGEpLG59LHdyaXRlKHtwYXRoOmUsYnVmZmVyOnIsZmxhZzppPSJ3KyIsb2Zmc2V0OnM9MCxwb3NpdGlvbjpvPTB9KXtjb25zdCBhPXQuZnMub3BlbihlLGkpO3QuZnMud3JpdGUoYSxyLHMsci5sZW5ndGgsbyksdC5mcy5jbG9zZShhKX0sYXN5bmMgcmVpbml0KGUpe2NvbnN0IHI9dC50b29scy5maW5kKHM9PnMudG9vbD09ZSksaT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocixyLmNvbmZpZyksci5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxyLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoaSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz1rKSxlLmxvYWRpbmc9PT14KXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+e2Uuc3Rkb3V0Kz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntzdGRvdXQ6aX19KX0scHJpbnRFcnI6aT0+e2NvbnN0IHM9dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD8ic3Rkb3V0Ijoic3RkZXJyIjtlW3NdKz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntbc106aX19KX19KTtjb25zdCByPWUubW9kdWxlLkZTO2UuaXNCYXNlTW9kdWxlPyh0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggYmFzZSBtb2R1bGUgZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyTW91bnRlZH1gLDUxMSksci5jaGRpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gKSx0LmZzPXIpOih0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkKSxyLm1vdW50KGUubW9kdWxlLlBST1hZRlMse3Jvb3Q6dC5jb25maWcuZGlyU2hhcmVkLGZzOnQuZnN9LHQuY29uZmlnLmRpclNoYXJlZCksci5jaGRpcih0LmZzLmN3ZCgpKSksZS5zdGRvdXQ9IiIsZS5zdGRlcnI9IiIsZS5yZWFkeT0hMH0sYXN5bmMgX3NldHVwRlMoKXtjb25zdCBlPXQuZnM7Zm9yKGxldCByIG9mIHQudG9vbHMpe2lmKCFyLnJlYWR5KWNvbnRpbnVlO2NvbnN0IGk9ci5tb2R1bGUuRlMscz1gLyR7ci50b29sfWAsbz1gJHt0LmNvbmZpZy5kaXJTaGFyZWR9JHtzfWA7IWkuYW5hbHl6ZVBhdGgocykuZXhpc3RzfHxlLmFuYWx5emVQYXRoKG8pLmV4aXN0c3x8KHQuX2xvZyhgTW91bnRpbmcgJHtzfSBvbnRvICR7dC5iYXNlLnRvb2x9IGZpbGVzeXN0ZW0gYXQgJHtvfWApLGUubWtkaXIobyksZS5tb3VudCh0LmJhc2UubW9kdWxlLlBST1hZRlMse3Jvb3Q6cyxmczppfSxvKSl9fSxfZmlsZW9wKGUscil7dC5fbG9nKGBSdW5uaW5nICR7ZX0gJHtyfWApO2NvbnN0IGk9dC5mcy5hbmFseXplUGF0aChyKTtpZighaS5leGlzdHMpcmV0dXJuIHQuX2xvZyhgRmlsZSAke3J9IG5vdCBmb3VuZC5gKSwhMTtzd2l0Y2goZSl7Y2FzZSJjYXQiOnJldHVybiB0LmZzLnJlYWRGaWxlKHIse2VuY29kaW5nOiJ1dGY4In0pO2Nhc2UibHMiOnJldHVybiB0LmZzLmlzRmlsZShpLm9iamVjdC5tb2RlKT90LmZzLnN0YXQocik6dC5mcy5yZWFkZGlyKHIpO2Nhc2UiZG93bmxvYWQiOmNvbnN0IHM9bmV3IEJsb2IoW3RoaXMuY2F0KHIpXSk7cmV0dXJuIFVSTC5jcmVhdGVPYmplY3RVUkwocyl9cmV0dXJuITF9LF9sb2coZSl7aWYoIXQuY29uZmlnLmRlYnVnKXJldHVybjtsZXQgcj1bLi4uYXJndW1lbnRzXTtyLnNoaWZ0KCksY29uc29sZS5sb2coYCVjW1dlYldvcmtlcl0lYyAke2V9YCwiZm9udC13ZWlnaHQ6Ym9sZCIsIiIsLi4ucil9fTt3KHQpfSkoKTsK",x=typeof window<"u"&&window.Blob&&new Blob([atob(_)],{type:"text/javascript;charset=utf-8"});function M(){const e=x&&(window.URL||window.webkitURL).createObjectURL(x);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+_)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const P={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,printStream:!1,callback:null,debug:!1,env:"prd"};class L{constructor(e,t={}){if(null==e)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(e)||(e=[e]),t=Object.assign({},P,t),e=e.map(this._parseTool),"stg"===t.env&&(t.urlCDN=t.urlCDNStg),this.tools=e,this.config=t,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const e=new M;this.callback&&(e.onmessage=e=>{"biowasm"===e.data.type&&this.callback(e.data.value)});const t=y(e);return t.tools=this.tools,t.config=this.config,await t.init(),t}_parseTool(e){if("string"!=typeof e)return e;const t=e.split("/");if(2!=t.length&&3!=t.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:t[0],program:3==t.length?t[1]:t[0],version:t[t.length-1]}}}var N=n(3629);class ${static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,N.vA)(!(void 0===this.scales[e]),`Scale '${e}' was not found.`),this.scales[e]}}$.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 I{constructor(e="categorial"){this.aa2num=$.getScale(e),this.num2aa={},Object.entries(this.aa2num).forEach((([e,t])=>this.num2aa[t]=e))}static _truncateSequence(e){let t=0,n=e.length;const r=["NH2","COOH"];if(e.startsWith(r[0])){const n=r[0].length;(0,N.vA)("-"==e[n],`Wrong sequence format: ${r[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(r[1])){const t=r[1].length+1;(0,N.vA)("-"==e[n-t],`Wrong sequence format: ${r[1]} without '-' precending in '${e}'.`),n-=t}return e.substring(t,n)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return I._dropDefises(I._truncateSequence(e))}encode(e){const t=e.length,n=new Array(t).fill(0);for(let r=0;r<t;++r){const t=e[r];(0,N.vA)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[r]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const r=e[n];(0,N.vA)(r in this.num2aa,`Unknown code '${r}' found in vector '${e}'`),t+=this.num2aa[r]}return t}}var R=n(4139);const O="input.fa",k="result.fasta";class D extends Error{element;constructor(e,t){super(e.innerText,t),this.element=e}}function G(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function H(e,t=!1,n="",r=null,s,o,l){let u=e.toList();t&&(u=u.map((e=>I.clean(e).replace(/\-/g,""))));const d=e.length;r??=i.Column.string("Clusters",d).init("0"),r.type!=i.COLUMN_TYPE.STRING&&(r=r.convertTo(i.TYPE.STRING)),r.compact();const h=r.categories,p=r.getRawData(),m=new Array(h.length),f=new Array(h.length);for(let e=0;e<d;++e){const t=p[e];(m[t]??=[]).push(u[e]),(f[t]??=[]).push(e)}U(f,h);const g=await new L(["base/1.0.0",{tool:"kalign",version:R.b9,reinit:!0}]),y=i.Column.string(n,d);for(let e=0;e<h.length;++e){const t=G(m[e]);await g.fs.writeFile(O,t);const n=`${void 0!==s?` --gpo ${s}`:""}${void 0!==o?` --gpe ${o}`:""}${void 0!==l?` --tgpe ${l}`:""}`,r=await g.exec(`kalign ${O} -f fasta -o ${k}${n}`);console.warn(r);const i=await g.cat(k);if(!i){const e=F(r,1);throw new Error(e)}const c=new a.m(i).sequencesArray,u=f[e];for(let e=0;e<c.length;++e)y.set(u[e],c[e])}const b=e.meta.units,w=e.getTag(c.gp.alphabet);return y.meta.units=b,y.setTag(c.gp.aligned,"SEQ.MSA"),y.setTag(c.gp.alphabet,w),y.semType=i.SEMTYPE.MACROMOLECULE,y}function F(e,t){const n=[],r=/^.+ERROR : (.+)$/gm;let i;for(;null!=(i=r.exec(e))&&(void 0===t||n.length<t);)n.push(i[1]);return n.join("\n")}function U(e,t){const n=e.map(((e,t)=>[e,t])).filter((([e,t])=>1==e.length)).map((([e,t])=>t));if(n.length>0){const e=r.div([r.divText(`MSA analysis is not available on single sequence clusters #${n.length}:`),...o()(n).take(3).map((e=>{let i=t[e];return i.length>25&&(i=i.slice(0,25)+"..."),r.divText(`"${i}"${e<n.length-1?", ":"."}`)})).toArray(),...n.length>3?[r.divText("...")]:[]]);throw new D(e)}}},8152:(e,t,n)=>{"use strict";n.d(t,{GD:()=>h,Nk:()=>l,ZY:()=>u});var r=n(4328),i=n(6082),s=n(2003),o=n(608),a=n(4139),c=n(3572);const l=new class{dcName="bio";async getDockerContainer(){return await r.dapi.docker.dockerContainers.filter(this.dcName).first()}},u=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],d=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(e,t,n="ginsi",r=1.53,c=0,u=null,h){const m=await l.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)throw new Error("PepSeA container has not started yet");const f=e.length;u??=i.Column.int("Clusters",f).init(0),u.type!=i.COLUMN_TYPE.STRING&&(u=u.convertTo(i.TYPE.STRING));const g=u.categories,y=u.getRawData(),b=new Array(g.length),w=new Array(g.length);for(let t=0;t<f;++t){const n=y[t],r=g[n];if(""===r)continue;const i=g.indexOf(r),s=e.get(t);s&&((b[i]??=[]).push({ID:t.toString(),HELM:s}),(w[n]??=[]).push(t))}(0,o.aZ)(w,g);const v=new Array(f);for(const e of b){const t=(await p(m.id,e,n,r,c,h)).Alignment;for(const e of t)v[parseInt(e.ID)]=Object.entries(e).filter((e=>!d.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(a.J.SEPARATOR)}const A=i.Column.fromStrings(t,v);return A.meta.units=s.Hi.SEPARATOR,A.setTag(s.gp.separator,a.J.SEPARATOR),A.setTag(s.gp.aligned,"SEQ.MSA"),A.setTag(s.gp.alphabet,s.YI.UN),A.setTag(s.gp.alphabetIsMultichar,"true"),A.semType=i.SEMTYPE.MACROMOLECULE,A}async function p(e,t,n,i,s,o){const a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},l=`/align?method=${n}&gap_open=${i}&gap_extend=${s}`;let u;if("fetchProxy"in r.dapi.docker.dockerContainers){const t=window.performance.now(),n=await r.dapi.docker.dockerContainers.fetchProxy(e,l,a),i=window.performance.now();c._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${i-t} ms`);const s="application/json"===n.headers.get("content-type");if(!n.ok&&s){const e=await n.json(),t=e["pepsea-error"];if(t)throw new Error(`PepSeA error: ${t}`);const r=e["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`);throw new Error(n.statusText)}if(!n.ok&&!s){const e=await n.text();throw new Error(`Error: ${e}`)}if(!s){const e=await n.text();throw new Error(`Error: PepSeA expected JSON response, got '${e}'.`)}u=await n.json()}else{const t=await r.dapi.docker.dockerContainers.request(e,l,a);if(!t)throw new Error("Empty response");u=JSON.parse(t);const n=u["pepsea-error"];if(n)throw new Error(`PepSeA error: ${n}`);const i=u["datagrok-error"];if(i)throw new Error(`Datagrok error: ${i}`)}if("pepsea-stderr"in u){const e=u["pepsea-stderr"];o?.warning(e)}return u}},3890:(e,t,n)=>{"use strict";n.d(t,{aS:()=>c,wz:()=>a}),n(6082),n(7389),n(4328);var r=n(1991),i=n.n(r),s=n(826);const o=60;function a(e,t,n=o,r="\n"){const i=s.G.forColumn(t),a=[];for(let s=0;s<t.length;s++){const t=e.map((e=>e.get(s).toString())).join("|"),o=c(i.getSplitted(s),n);a.push(`>${t}${r}`);for(const e of o)a.push(`${e}${r}`)}return"".concat(...a)}function c(e,t=o){let n=0;const r=e.length,s=[];for(;n<r;){const r=i().count(n).take(Math.min(e.length-n,t)).map((t=>e.getOriginal(t))).toArray(),o=r.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");s.push(o),n+=r.length}return s}},7456:(e,t,n)=>{"use strict";n.d(t,{V:()=>d});var r=n(4328),i=n(6077),s=n(826),o=n(2003),a=n(6082),c=n(310),l=n(966),u=n(330);async function d(e,t,n,d,h,p){let m;if(n){const n=await async function(){const e=a.Func.find({package:"Bio",name:"getSeqHelper"});if(0===e.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await e[0].prepare().call()).getOutputParamValue()}(),r=s.G.forColumn(t);let i,c;r.isHelm()?i=t:(c=t.name,t.name=`__${c}`,i=r.convert(o.Hi.HELM),i.name=c,e.columns.add(i,!1));try{m=await n.helmToAtomicLevel(i,!0,!0)}finally{i!==t&&(e.columns.remove(i.name),t.name=c)}}else{if(!(0,l.V)(t,"To Atomic Level"))return{molCol:null,warnings:["Column is not suitable"]};m=await(0,i.C4)(e,t,h,p)}if(m.molCol){const n=(0,u.qj)(e,t.name);m.molCol.name=n,e.columns.add(m.molCol,!0),(0,c.Qc)(t,m.molCol,h,p),m.molCol.setTag(".sequence-src-highlight-monomers",String(d)),await r.data.detectSemanticTypes(e)}return m}},5785:(e,t,n)=>{"use strict";n.d(t,{k:()=>u});var r=n(4328),i=n(6082),s=n(8070),o=n(966),a=n(3077),c=n(4139),l=n(439);async function u(e,t){if(await(0,s.cb)(10),!(0,o.V)(t,"Sequence space"))return e;const n=(0,a.R)(t);n.name="splitToMonomers";const u=t.dataFrame;for(const e of n.columns)e.semType=c.uF.MONOMER,e.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const d=/(\d+)(?: \((\d+)\))?/,h=e=>{d.lastIndex=0;const t=e.match(d);return t?`${t[1]} (${parseInt(t[2]??"0")+1})`:e};for(let e=0;e<n.columns.length;e++){const r=n.columns.byIndex(e);r.semType=c.uF.MONOMER,r.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const i=100;let s=0;for(;u.columns.byName(r.name)&&s<i;)r.name=h(r.name),s++;u.columns.add(r)}await r.data.detectSemanticTypes(u);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(i.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return u}},4870:(e,t,n)=>{"use strict";function r(e,t){e.innerHTML="",e.append(t)}n.d(t,{K:()=>r}),n(4328),n(6082)},8047:(e,t,n)=>{"use strict";n.d(t,{VN:()=>m,n5:()=>l,Ue:()=>p,Tc:()=>h,eN:()=>f}),n(4328),n(7389);var r=n(6082),i=(n(1757),n(1991),n(1858),n(826),n(2003)),s=n(4326);n(8070),n(7602);var o=n(439),a=n(6882);var c,l,u,d=n(2174);n(3572),HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new r.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},r.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class h{rowCount;value;plotValue;valueList=null;valueIdx=0;bounds;constructor(e=0,t){this.value=this.rowCount=e,this.bounds=t}push(e){this.valueList||(this.valueList=new Array(this.rowCount),this.valueIdx=0),this.valueList[this.valueIdx]=e,++this.valueIdx}aggregate(e){this.value=e(this.valueList)??0,this.valueList=null}}class p{pos;name;_label;get label(){return this._label?this._label:this.name}_freqs;sumRowCount=0;sumPlotValue;sumPlotValueForHeight;constructor(e,t,n,r){this.pos=e,this.name=t,this._freqs=n??{},r?.sumRowCount&&(this.sumRowCount=r.sumRowCount),r?.sumValueForHeight&&(this.sumPlotValue=r.sumValueForHeight),r?.label&&(this._label=r.label)}getMonomers(){return Object.keys(this._freqs)}hasMonomer(e){return e in this._freqs}getFreq(e){let t=this._freqs[e];return t||(t=this._freqs[e]=new h),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?r.Column.fromFloat32Array(n,e):e instanceof Int32Array?r.Column.fromInt32Array(n,e):r.Column.fromList(r.COLUMN_TYPE.FLOAT,n,e),t}(t);return n.aggregate(e)}}(e);for(const[e,n]of Object.entries(this._freqs))n.aggregate(t)}getMinValue(){return Math.min(...Object.values(this._freqs).map((e=>e.value)))}calcPlotValue(e){for(const t of Object.values(this._freqs))t.plotValue=t.value-e}calcHeights(e){this.sumPlotValue=0;for(const e of Object.values(this._freqs))this.sumPlotValue+=e.plotValue;if(this.sumPlotValueForHeight=0,e===s.fH.Entropy){const e=Object.keys(this._freqs).length,t=.01*this.sumPlotValue,n=t/e;for(const e of Object.values(this._freqs)){const r=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-r*Math.log2(r)}}else if(e===s.fH.full)for(const[e,t]of Object.entries(this._freqs)){const e=t.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=e}}calcScreen(e,t,n,i,a,c,l,u,d){const h=i===s.fH.Entropy?n*(a-this.sumPlotValueForHeight)/a:n;let p=d*u+(n-h-1);const m=Object.entries(this._freqs).sort(((e,t)=>e[0]!==o._S&&t[0]!==o._S?t[1].value-e[1].value:e[0]===o._S&&t[0]===o._S?0:e[0]===o._S?-1:1));for(const[n,i]of m){const n=h*i.plotValue/this.sumPlotValue;i.bounds=new r.Rect((e-t)*u*c,p,l*u,n),p+=n}}render(e,t,n,r,s,c){for(const[l,u]of Object.entries(this._freqs))if(l!==o._S){const o=(0,i.zS)(l,5),d=u.bounds,h=d.left;let p=a.S$;c&&(p=c.getWebEditorMonomer(s,l).backgroundcolor),e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(h,d.top,d.width,d.height),e.fillStyle=p,e.textAlign="left",e.font=t;const m=e.measureText(o);e.setTransform(d.width/m.width,0,0,d.height/r,h,d.top),e.fillText(o,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,r])=>r.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e,t){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,d.F)(Object.assign({},...Object.entries(this._freqs).map((([e,t])=>({[e]:t.rowCount})))),e,t)}}!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(c||(c={})),function(e){e.sequenceColumnName="sequenceColumnName",e.valueAggrType="valueAggrType",e.valueColumnName="valueColumnName",e.startPositionName="startPositionName",e.endPositionName="endPositionName",e.skipEmptySequences="skipEmptySequences",e.skipEmptyPositions="skipEmptyPositions",e.shrinkEmptyTail="shrinkEmptyTail",e.backgroundColor="backgroundColor",e.positionHeight="positionHeight",e.positionWidth="positionWidth",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.fixWidth="fixWidth",e.fitArea="fitArea",e.minHeight="minHeight",e.maxHeight="maxHeight",e.showPositionLabels="showPositionLabels",e.positionMarginState="positionMarginState",e.positionMargin="positionMargin",e.filterSource="filterSource"}(l||(l={})),s.Fo,function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(u||(u={}));const m=new class{render=20};function f(e,t,n,r,i){let s=0,o=-1;for(;-1!=(o=n.findNext(o,!0));){const e=t.getSplitted(o),n=i.pos,a=n<e.length?e.getCanonical(n):null;null!==a&&a===r&&s++}return s}r.JsViewer},4577:(e,t,n)=>{"use strict";n.d(t,{O:()=>o,n:()=>s});var r=n(1858),i=n(3572);class s{substructure;readOnly;constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(i._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{onChanged=new r.Subject;_props;_propsChanging=!1;get props(){return this._props||(this._props=this.emptyProps),this._props}set props(e){this._propsChanging=!0;try{this._props=e,this.applyProps(),this.onChanged.next()}finally{this._propsChanging=!1}}saveProps(){const e={};for(const[t,n]of Object.entries(this.props))"_onChanged"!==t&&(e[t]=this.props[t]);return e}async detach(){}get filterSummary(){return this.props.substructure}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=this.emptyProps,this.onChanged.next()}}},1687:(e,t,n)=>{"use strict";n.d(t,{_i:()=>S,AR:()=>T});var r=n(7389),i=n(6082),s=n(4328),o=n(1991),a=n.n(o),c=n(1858),l=n(2003),u=n(8070),d=n(826),h=n(7602),p=n(8115),m=n(4577),f=n(1757),g=n.n(f),y=n(9124),b=n(9192),w=n(4870),v=n(3572);class A extends m.O{emptyProps=new m.n("");helmEditor;_filterPanel=r.div("",{style:{cursor:"pointer"}});logger;static viewerCounter=-1;viewerId=++A.viewerCounter;viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.logger=v._package.logger}viewSubs=[];async detach(){await super.detach();for(const e of this.viewSubs)e.unsubscribe()}async attach(){this.viewerToLog();try{const e=await(0,y.b2)();let t,n;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await r.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,c.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=r.div(),n=e.createWebEditorApp(t,this.props.substructure),r.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{try{const e=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.props=new m.n(e)}catch(e){this.logger.error(e)}finally{g()(t).empty(),t=null,n=null}})).onCancel((()=>{g()(t).empty(),t=null,n=null})).show({modal:!0,fullScreen:!0})}))),this.viewSubs.push(r.onSizeChanged(this._filterPanel).subscribe((e=>{try{if(n){const e=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}}catch(e){const[t,n]=(0,b.AP)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,b.AP)(e),i=this._filterPanel;i.innerText="error",i.classList.add("d4-error"),r.tooltip.bind(i,t)}}applyProps(){this.helmEditor&&this.updateFilterPanel(this.props.substructure)}get filterPanel(){return this._filterPanel}updateFilterPanel(e){if(!this.helmEditor)throw new Error("helmEditor is not created, the filter is not in dom yet");const t=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,n=t/2;if(e)(0,w.K)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=r.divText("Click to edit","helm-substructure-filter");(0,w.K)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;v._package.logger.debug(`${t}, start`);try{return await(0,u.cb)(10),await(0,p.if)(this.props.substructure,e)}finally{v._package.logger.debug(`${t}, end`)}}}const C="bio-substructure-filter";class E{props;filterId;dataFrameId;columnName;bitset;constructor(e,t,n,r,i){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=r,this.bitset=i}}class T extends m.n{separator;constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}class S extends i.Filter{bioFilter=null;bitset=null;loader;notation=void 0;logger;filterSyncer;get calculating(){return"initial"==this.loader.style.display}set calculating(e){this.loader.style.display=e?"initial":"none"}get filterSummary(){return this.bioFilter.filterSummary}get isFiltering(){return super.isFiltering&&(this.bioFilter?.isFiltering??!1)}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get debounceTime(){if(null==this.column)return 1e3;const e=this.column.length;return e<500?0:e>1e4?1e3:Math.floor((e-500)/9500*1e3)}constructor(){return super(),this.root=r.divV([]),this.loader=r.loader(),this.calculating=!1,this.filterSyncer=new h.g(this.logger=v._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}static filterCounter=-1;filterId=++S.filterCounter;filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}viewSubs=[];attach(e){const t=super.attach.bind(this),n=`${this.filterToLog()}.attach()`;this.filterSyncer.sync(n,(async()=>{t(e),this.column||(this.columnName?this.column=this.dataFrame.getCol(this.columnName):this.column=e.columns.bySemType(i.SEMTYPE.MACROMOLECULE)),d.G.forColumn(this.column),this.columnName??=this.column?.name,this.notation??=this.column?.meta.units,this.bioFilter=this.notation===l.Hi.FASTA?new _:this.notation===l.Hi.SEPARATOR?new x(this.column.getTag(l.gp.separator)):new A,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(i.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(s.events.onResetFilterRequest.subscribe(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(s.events.onCustomEvent(C).subscribe(this.filterOnSync.bind(this)))}))}detach(){const e=super.detach.bind(this),t=`${this.filterToLog()}.detach()`;this.filterSyncer.sync(t,(async()=>{for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[],e(),this.bioFilter&&this.bioFilter.detach(),this.bioFilter=null}))}filterOnSync(e){e.filterId!==this.filterId&&e.dataFrameId===this.dataFrame.id&&e.columnName===this.columnName&&(this.bioFilter.props=e.props)}applyFilter(){const e=`${this.filterToLog()}.applyFilter()`;this.logger.debug(`${e}, IN`),this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=`${this.filterToLog()}.saveState()`,t=super.saveState();return this.logger.debug(`${e}, super.state = ${JSON.stringify(t)}`),t.props=this.bioFilter.saveProps(),t}applyState(e){const t=`${this.filterToLog()}.applyState()`;super.applyState(e),this.filterSyncer.sync(t,(async()=>{e.props&&this.bioFilter&&(this.bioFilter.props=i.toJs(e.props??{}))}))}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;v._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.saveProps())}`:"")),s.events.fireCustomEvent(C,new E(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(v._package.logger.debug(`${e}, start, isFiltering = ${this.isFiltering}, props = ${JSON.stringify(this.bioFilter.saveProps())}`),!this.isFiltering)return this.bitset=null,void this.dataFrame.rows.requestFilter();a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`)||this.filterSyncer.sync(e,(async()=>{this.calculating=!0;try{v._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),v._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,v._package.logger.debug(`${e}, end`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;v._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}_onRendered=new c.Subject;get onRendered(){return this._onRendered}invalidate(e){const t=`${this.filterToLog()}.invalidate(${e?` <- ${e} `:""})`;this.filterSyncer.sync(t,(async()=>{this._onRendered.next()}))}async awaitRendered(e=1e4){const t=`awaitRendered( ${e} )`,n=`${this.filterToLog()}.${t}`;await(0,u.cb)(10),await(0,u.PE)(this.onRendered,(()=>{this.logger.debug(`${n}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${n} timeout`);const r=this.filterSyncer.resetErrors();if(r.length>0)throw r[0]}}class _ extends m.O{emptyProps=new m.n("");substructureInput;get type(){return"FastaBioFilter"}constructor(){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{window.setTimeout((()=>{this.props=new m.n(e),this._propsChanging||this.onChanged.next()}),0)},placeholder:"Substructure"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure)}get filterPanel(){return this.substructureInput.root}get isFiltering(){return""!==this.substructureInput.value}async substructureSearch(e){return(0,p.nI)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class x extends m.O{emptyProps=new T("",void 0);substructureInput;separatorInput;colSeparator="";get type(){return"SeparatorBioFilter"}constructor(e){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{this.props=new T(e,this.props.separator),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"}),this.separatorInput=r.input.string("",{value:this.colSeparator=e,onValueChanged:e=>{const t=e||void 0;this.props=new T(this.props.substructure,t),this._propsChanging||this.onChanged.next()},placeholder:"Separator"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure);const e=this.props.separator??this.colSeparator;this.separatorInput.value!==e&&(this.separatorInput.value=e)}get filterSummary(){return this.props.separator?this.props.separator:this.colSeparator,`${this.props.substructure}, {sep}`}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=new T("")}get filterPanel(){return r.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(e){this.substructureInput.value=e}async substructureSearch(e){return(0,p.nI)(this.substructure,e,this.colSeparator)}async attach(){}async detach(){await super.detach()}}},2174:(e,t,n)=>{"use strict";n.d(t,{F:()=>v});var r=n(7389),i=n(6082),s=(n(1991),n(2003),n(826),n(439)),o=(n(3599),n(5072)),a=n.n(o),c=n(7825),l=n.n(c),u=n(7659),d=n.n(u),h=n(5056),p=n.n(h),m=n(540),f=n.n(m),g=n(1113),y=n.n(g),b=n(5999),w={};function v(e,t,n){let o=0,a=null;for(const t of Object.values(e))o+=t,a=null===a?t:Math.max(a,t);const c=a/o,l=Object.assign({},...Array.from(Object.entries(e)).sort(((e,t)=>t[1]-e[1])).map((([e,a])=>{const l=a/o,u=n.getWebEditorMonomer(t,e).backgroundcolor,d=r.div("",{classes:"macromolecule-cell-comp-analysis-bar"});d.style.width=50*l/c+"px",d.style.backgroundColor=u,s._S===e&&(d.style.borderWidth="1px",d.style.borderStyle="solid",d.style.borderColor=i.Color.toHtml(i.Color.lightGray));const h=s._S===e?"-":e,p=r.div(`${(100*l).toFixed(2)}%`),m=r.div([d,p],{classes:"macromolecule-cell-comp-analysis-value"});return{[h]:m}}))),u=r.tableFromMap(l);return Array.from(u.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),u}w.styleTagTransform=y(),w.setAttributes=p(),w.insert=d().bind(null,"head"),w.domAPI=l(),w.insertStyleElement=f(),a()(b.A,w),b.A&&b.A.locals&&b.A.locals},1757:e=>{"use strict";e.exports=$},6082:e=>{"use strict";e.exports=DG},4328:e=>{"use strict";e.exports=grok},1858:e=>{"use strict";e.exports=rxjs},7389:e=>{"use strict";e.exports=ui},1991:e=>{"use strict";e.exports=wu},8343:(e,t,n)=>{"use strict";const{normalizeIPv6:r,normalizeIPv4:i,removeDotSegments:s,recomposeAuthority:o,normalizeComponentEncoding:a}=n(4834),c=n(343);function l(e,t,n,r){const i={};return r||(e=p(u(e,n),n),t=p(u(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=s(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=s(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function u(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),i=[],a=c[(r.scheme||n.scheme||"").toLowerCase()];a&&a.serialize&&a.serialize(n,r),void 0!==n.path&&(r.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==r.reference&&n.scheme&&(i.push(n.scheme),i.push(":"));const l=o(n,r);if(void 0!==l&&("suffix"!==r.reference&&i.push("//"),i.push(l),n.path&&"/"!==n.path.charAt(0)&&i.push("/")),void 0!==n.path){let e=n.path;r.absolutePath||a&&a.absolutePath||(e=s(e)),void 0===l&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==n.query&&(i.push("?"),i.push(n.query)),void 0!==n.fragment&&(i.push("#"),i.push(n.fragment)),i.join("")}const d=Array.from({length:127},((e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)))),h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(e,t){const n=Object.assign({},t),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=-1!==e.indexOf("%");let a=!1;"suffix"===n.reference&&(e=(n.scheme?n.scheme+":":"")+"//"+e);const l=e.match(h);if(l){if(s.scheme=l[1],s.userinfo=l[3],s.host=l[4],s.port=parseInt(l[5],10),s.path=l[6]||"",s.query=l[7],s.fragment=l[8],isNaN(s.port)&&(s.port=l[5]),s.host){const e=i(s.host);if(!1===e.isIPV4){const t=r(e.host,{isIPV4:!1});s.host=t.host.toLowerCase(),a=t.isIPV6}else s.host=e.host,a=!0}void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||s.path||void 0!==s.query?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==s.reference&&(s.error=s.error||"URI is not a "+n.reference+" reference.");const e=c[(n.scheme||s.scheme||"").toLowerCase()];if(!(n.unicodeSupport||e&&e.unicodeSupport)&&s.host&&(n.domainHost||e&&e.domainHost)&&!1===a&&function(e){let t=0;for(let n=0,r=e.length;n<r;++n)if(t=e.charCodeAt(n),t>126||d[t])return!0;return!1}(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII: "+e}(!e||e&&!e.skipNormalize)&&(o&&void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),o&&void 0!==s.userinfo&&(s.userinfo=unescape(s.userinfo)),o&&void 0!==s.host&&(s.host=unescape(s.host)),void 0!==s.path&&s.path.length&&(s.path=escape(unescape(s.path))),void 0!==s.fragment&&s.fragment.length&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),e&&e.parse&&e.parse(s,n)}else s.error=s.error||"URI can not be parsed.";return s}const m={SCHEMES:c,normalize:function(e,t){return"string"==typeof e?e=u(p(e,t),t):"object"==typeof e&&(e=p(u(e,t),t)),e},resolve:function(e,t,n){const r=Object.assign({scheme:"null"},n);return u(l(p(e,r),p(t,r),r,!0),{...r,skipEscape:!0})},resolveComponents:l,equal:function(e,t,n){return"string"==typeof e?(e=unescape(e),e=u(a(p(e,n),!0),{...n,skipEscape:!0})):"object"==typeof e&&(e=u(a(e,!0),{...n,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=u(a(p(t,n),!0),{...n,skipEscape:!0})):"object"==typeof t&&(t=u(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:u,parse:p};e.exports=m,e.exports.default=m,e.exports.fastUri=m},343:e=>{"use strict";const t=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const o={scheme:"http",domainHost:!0,parse:i,serialize:s},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,n]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}},c={http:o,https:{scheme:"https",domainHost:o.domainHost,parse:i,serialize:s},ws:a,wss:{scheme:"wss",domainHost:a.domainHost,parse:a.parse,serialize:a.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(n);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const i=`${n}:${t.nid||e.nid}`,s=c[i];e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),i=`${n}:${t.nid||r}`,s=c[i];s&&(e=s.serialize(e,t));const o=e,a=e.nss;return o.path=`${r||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,n){const r=e;return r.uuid=r.nss,r.nss=void 0,n.tolerant||r.uuid&&t.test(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};e.exports=c},4914:e=>{"use strict";e.exports={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}},4834:(e,t,n)=>{"use strict";const{HEX:r}=n(4914);function i(e){if(c(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u)||[],[n]=t;return n?{host:a(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function s(e,t=!1){let n="",i=!0;for(const t of e){if(void 0===r[t])return;"0"!==t&&!0===i&&(i=!1),i||(n+=t)}return t&&0===n.length&&(n="0"),n}function o(e,t={}){if(c(e,":")<2)return{host:e,isIPV6:!1};const n=function(e){let t=0;const n={error:!1,address:"",zone:""},r=[],i=[];let o=!1,a=!1,c=!1;function l(){if(i.length){if(!1===o){const e=s(i);if(void 0===e)return n.error=!0,!1;r.push(e)}i.length=0}return!0}for(let s=0;s<e.length;s++){const u=e[s];if("["!==u&&"]"!==u)if(":"!==u)if("%"===u){if(!l())break;o=!0}else i.push(u);else{if(!0===a&&(c=!0),!l())break;if(t++,r.push(":"),t>7){n.error=!0;break}s-1>=0&&":"===e[s-1]&&(a=!0)}}return i.length&&(o?n.zone=i.join(""):c?r.push(i.join("")):r.push(s(i))),n.address=r.join(""),n}(e);if(n.error)return{host:e,isIPV6:!1};{let e=n.address,t=n.address;return n.zone&&(e+="%"+n.zone,t+="%25"+n.zone),{host:e,escapedHost:t,isIPV6:!0}}}function a(e,t){let n="",r=!0;const i=e.length;for(let s=0;s<i;s++){const o=e[s];"0"===o&&r?(s+1<=i&&e[s+1]===t||s+1===i)&&(n+=o,r=!1):(r=o===t,n+=o)}return n}function c(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}const l=/^\.\.?\//u,u=/^\/\.(?:\/|$)/u,d=/^\/\.\.(?:\/|$)/u,h=/^\/?(?:.|\n)*?(?=\/|$)/u;e.exports={recomposeAuthority:function(e,t){const n=[];if(void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host){let t=unescape(e.host);const r=i(t);if(r.isIPV4)t=r.host;else{const n=o(r.host,{isIPV4:!1});t=!0===n.isIPV6?`[${n.escapedHost}]`:e.host}n.push(t)}return"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0},normalizeComponentEncoding:function(e,t){const n=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=n(e.scheme)),void 0!==e.userinfo&&(e.userinfo=n(e.userinfo)),void 0!==e.host&&(e.host=n(e.host)),void 0!==e.path&&(e.path=n(e.path)),void 0!==e.query&&(e.query=n(e.query)),void 0!==e.fragment&&(e.fragment=n(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(l))e=e.replace(l,"");else if(e.match(u))e=e.replace(u,"/");else if(e.match(d))e=e.replace(d,"/"),t.pop();else if("."===e||".."===e)e="";else{const n=e.match(h);if(!n)throw new Error("Unexpected dot segment condition");{const r=n[0];e=e.slice(r.length),t.push(r)}}return t.join("")},normalizeIPv4:i,normalizeIPv6:o,stringArrayToHexStripped:s}},3837:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},7216:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},8226:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},518:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},4588:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},5707:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},9547:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},7082:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},1678:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},2079:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}n.m=e,n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var r={};(()=>{"use strict";n.r(r),n.d(r,{_package:()=>Se,initAutoTests:()=>xe,test:()=>_e,tests:()=>t.CN});var e=n(6082),t=n(8070);(0,t.L1)("_first",(()=>{(0,t.t6)("_first",(async()=>{}))}));var i=n(8924),s=n(7362),o=n(1093);(0,t.L1)("Palettes",(()=>{(0,t.t6)("testPaletteN",(async()=>{await async function(){const e=o.A.Chromatogram;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(e instanceof o.A,!0)}()})),(0,t.t6)("testPaletteAA",(async()=>{await async function(){const e=i.X.Lesk,n=i.X.RasMol,r=i.X.GrokGroups;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(n instanceof s.e,!0),(0,t.E3)(r instanceof s.e,!0),(0,t.E3)(e instanceof i.X,!0),(0,t.E3)(n instanceof i.X,!0),(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPalettePtMe",(async()=>{const e=i.X.GrokGroups.get("MeNle"),n=i.X.GrokGroups.get("MeA"),r=i.X.GrokGroups.get("MeG"),s=i.X.GrokGroups.get("MeF"),o=i.X.GrokGroups.get("L"),a=i.X.GrokGroups.get("A"),c=i.X.GrokGroups.get("G"),l=i.X.GrokGroups.get("F");(0,t.E3)(e,o),(0,t.E3)(n,a),(0,t.E3)(r,c),(0,t.E3)(s,l)}))}));var a=n(4328),c=n(2003),l=n(826);class u{units;aligned;alphabet;alphabetSize;alphabetIsMultichar;separator;constructor(e,t,n,r,i,s){this.units=e,this.aligned=t,this.alphabet=n,this.alphabetSize=r,this.alphabetIsMultichar=i,this.separator=s}}async function d(t,n){const r=(await t()).getCol(n),i=await a.functions.call("Bio:detectMacromolecule",{col:r});if(i&&(r.semType=i),r.semType===e.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${r.semType}', units='${r.meta.units}'.`;throw new Error(e)}}async function h(n,r,i,s,o,u,d,h=null){const p=(await n()).col(r),m=await a.functions.call("Bio:detectMacromolecule",{col:p});m&&(p.semType=m),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,i),(0,t.E3)(p.getTag(c.gp.aligned),s),(0,t.E3)(p.getTag(c.gp.alphabet),o),h&&(0,t.E3)(p.getTag(c.gp.separator),h);const f=l.G.forColumn(p);(0,t.E3)(f.getAlphabetSize(),u),(0,t.E3)(f.getAlphabetIsMultichar(),d),f.isHelm()||((0,t.E3)(f.aligned,s),(0,t.E3)(f.alphabet,o))}var p=n(3572);async function m(t){const n=e.Column.fromList(e.TYPE.STRING,"col1",t);if(await a.functions.call("Bio:detectMacromolecule",{col:n}),n.semType===e.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${n.semType}', units='${n.meta.units}'.`;throw new Error(e)}}async function f(n,r,i,s,o,u,d=null){const h=e.Column.fromList(e.TYPE.STRING,"seq",n),p=await a.functions.call("Bio:detectMacromolecule",{col:h});p&&(h.semType=p),(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,r),(0,t.E3)(h.getTag(c.gp.aligned),i),(0,t.E3)(h.getTag(c.gp.alphabet),s),d&&(0,t.E3)(h.getTag(c.gp.separator),d);const m=l.G.forColumn(h);(0,t.E3)(m.getAlphabetSize(),o),(0,t.E3)(m.getAlphabetIsMultichar(),u),m.isHelm()||((0,t.E3)(m.aligned,i),(0,t.E3)(m.alphabet,s))}async function g(e,t){const n=await e(),r=[];for(const i of n.columns.names())if(i in t){const n=t[i];try{await h(e,i,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}catch(e){const t=e.toString();r.push(`Positive col '${i}' failed: ${t}`)}}else try{await d(e,i)}catch(e){const t=e.toString();r.push(`Negative col '${i}' failed: ${t}`)}if(r.length>0)throw new Error(r.join("\n"))}(0,t.L1)("detectors",(()=>{const n={negEmpty:{csv:"id,col1\n1,\n2,\n3,\n4,\n5,",neg:["col1"]},negNum1:{csv:"col1\n1\n2\n3",neg:["col1"]},negNum2:{csv:"col1\n4\n5\n6\n7",neg:["col1"]},negNum3:{csv:"col1\n8\n9\n10\n11\n12",neg:["col1"]},negSmiles:{csv:"col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",neg:["col1"]},negSmilesWithSquareBrackets:{csv:"col1\nCl.c1ccc2nc3ccccc3cc2c1\nOc1cccc2cc3ccccc3cc12\n[SeH]c1ccc2ccccc2c1",neg:["col1"]},negFastaUnSingleChar:{csv:"col1\nAlanine\nCysteine\nAspartic acid\nGlutamic acid\nPhenylalanine",neg:["col1"]},fastaMsaSameLength:{csv:"seq\nFWPHEYFWPHEYYV\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",pos:{seq:new u(c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1,void 0)}},fastaExtSameLength:{csv:"seq\nFW[Ac]PHEYFWPH\nYN[Re]VYNRQWYV\n[Me]EYVMPS[Et]",pos:{seq:new u(c.Hi.FASTA,"SEQ",c.YI.UN,16,!0,void 0)}},fastaMsaExtSameLength:{csv:"seq\nFW[Ac]PHEY[Re]WPH\nYN[Re]VYNR[Ac]WYV\n[Me]EYVMPSFW[Me]H",pos:{seq:new u(c.Hi.FASTA,"SEQ.MSA",c.YI.UN,14,!0,void 0)}},fastaMsaExtManyMinus:{csv:"seq\n[D-Tic]-------[D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]N[D-Orn][D-aThr]-[Phe_4Me]\n[Phe_2F]--------[Tyr_ab-dehydroMe][dV][Aca]N[D-Orn][D-aThr]-[Phe_4Me]\n[D-Tic]-[Hcy]QTWQ[Phe_4NH2][D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]----[Phe_4Me]",pos:{seq:new u(c.Hi.FASTA,"SEQ.MSA",c.YI.UN,17,!0,void 0)}},sepSameLength:{csv:"seq\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-C-G-NH2\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-C-G-NH2\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-C-G-NH2",pos:{seq:new u(c.Hi.SEPARATOR,"SEQ.MSA",c.YI.UN,5,!0,"-")}},sepMsaSameLength:{csv:"seq\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-Aca-G-NH2\nAca-A-Aca-A-A-A-meI-A-A-A-A-A-Aca-G-NH2\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-Aca-G-NH2",pos:{seq:new u(c.Hi.SEPARATOR,"SEQ",c.YI.UN,5,!0,"-")}},helmSameLength:{csv:"seq\nPEPTIDE1{Ac(1).A.A.A.A.A.A.A.A.A.A.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ab(1).Y.V.K.H.P.F.W.R.W.Y.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ad(1).S.W.Y.C.K.H.P.M.W.A.A.A.A.C(1)-G-NH2}$$$$",pos:{seq:new u(c.Hi.HELM,null,null,19,void 0,void 0)}},fastaNonDigitAlphabet:{csv:'flagC\n"NMe-pyridazineH"\n"Pyrrolo[2,3-c]pyridazineH"',neg:["flagC"]}};for(const[r,i]of Object.entries(n))(0,t.t6)(`csvData2-${r}`,(async()=>{const t=(s=r,async()=>{const t=n[s].csv,r=e.DataFrame.fromCsv(t);return await a.data.detectSemanticTypes(r),r});var s;for(const e of i.neg??[])await d(t,e);for(const[e,n]of Object.entries(i.pos??{}))await h(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}));const r=new class{csvFastaDna1="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC";fastaRna1="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC";fastaPt1="seq\nFWPHEY\nYNRQWYV\nMKPSEYV";fastaUn="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]";sepDna="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";sepRna="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";sepPt="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";sepUn1="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";sepUn2="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";sepMsaDna1="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";sepMsaUnWEmpty="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";sepComplex="seq\nAca-F-K(AEEA-AEEA-R-Ac)-L-mF-V-Y-mNle-D-W-N-mF-Aca-G-NH2\nAca-F-K(AEEA-ARRA-W-Ac)-L-mF-V-Y-mNle-D-W-N-mF-Aca-G-NH2\nAca-F-K(AEEA-AEEA-Ac)-L-mF-V-Y-mNle-D-W-N-mF-Aca-G-NH2";fastaMsaDna1="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT";fastaMsaPt1="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"},i={fastaPtCsv:"System:AppData/Bio/samples/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"},s={};function o(e,t=l){return async()=>(e in s||(s[e]=(async()=>await t(i[e]))().catch((t=>{throw delete s[e],t}))),s[e])}async function l(t){const n=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(n)}const p=t=>async()=>{const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("NegativeStartEnd",(async()=>{await m(["START","END"])})),(0,t.t6)("NegativeStartEndIntermediate",(async()=>{await m(["START","END","INTERMEDIATE"])})),(0,t.t6)("FastaDna1",(async()=>{await h(p("csvFastaDna1"),"seq",c.Hi.FASTA,"SEQ",c.YI.DNA,4,!1)})),(0,t.t6)("FastaRna1",(async()=>{await h(p("fastaRna1"),"seq",c.Hi.FASTA,"SEQ",c.YI.RNA,4,!1)})),(0,t.t6)("FastaPt1",(async()=>{await h(p("fastaPt1"),"seq",c.Hi.FASTA,"SEQ",c.YI.PT,20,!1)})),(0,t.t6)("FastaPtGaps",(()=>f(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.Hi.FASTA,"SEQ",c.YI.PT,20,!1))),(0,t.t6)("FastaPtGapsMsa",(()=>f(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1))),(0,t.t6)("FastaUn",(async()=>{await h(p("fastaUn"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.UN,12,!0)})),(0,t.t6)("FastaMsaDna1",(async()=>{await h(p("fastaMsaDna1"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.DNA,4,!1)})),(0,t.t6)("FastaMsaPt1",(async()=>{await h(p("fastaMsaPt1"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1)})),(0,t.t6)("SepDna",(async()=>{await h(p("sepDna"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.DNA,4,!1,"*")})),(0,t.t6)("SepRna",(async()=>{await h(p("sepRna"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.RNA,4,!1,"*")})),(0,t.t6)("SepPt",(async()=>{await h(p("sepPt"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.PT,20,!1,"-")})),(0,t.t6)("SepUn1",(async()=>{await h(p("sepUn1"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.UN,8,!0,"-")})),(0,t.t6)("SepUn2",(async()=>{await h(p("sepUn2"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.UN,9,!0,"/")})),(0,t.t6)("SepMsaN1",(async()=>{await h(p("sepMsaDna1"),"seq",c.Hi.SEPARATOR,"SEQ.MSA",c.YI.DNA,4,!1,"-")})),(0,t.t6)("SepMsaUnWEmpty",(async()=>{await h(p("sepMsaUnWEmpty"),"seq",c.Hi.SEPARATOR,"SEQ.MSA",c.YI.UN,14,!0)})),(0,t.t6)("SepComplex",(async()=>{await h(p("sepComplex"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.UN,17,!0)})),(0,t.t6)("samplesFastaCsv",(async()=>{await g(o("fastaCsv"),{Sequence:new u(c.Hi.FASTA,"SEQ",c.YI.PT,20,!1)})})),(0,t.t6)("samplesPeptidesComplex",(async()=>{await g(o("peptidesComplex"),{})})),(0,t.t6)("samplesMsaComplex",(async()=>{await g(o("msaComplex"),{MSA:new u(c.Hi.SEPARATOR,"SEQ.MSA",c.YI.UN,161,!0,"/")})})),(0,t.t6)("samplesIdCsv",(async()=>{await g(o("testIdCsv"),{})})),(0,t.t6)("samplesSarSmallCsv",(async()=>{await g(o("testSmilesCsv"),{})})),(0,t.t6)("samplesHelmCsv",(async()=>{await g(o("helmCsv"),{HELM:new u(c.Hi.HELM,null,null,160,!0)})})),(0,t.t6)("samplesTestHelmCsv",(async()=>{await g(o("testHelmCsv"),{"HELM string":new u(c.Hi.HELM,null,null,9,!0)})})),(0,t.t6)("samplesTestDemogCsv",(async()=>{await g(o("testDemogCsv"),{})})),(0,t.t6)("samplesTestSmiles2Csv",(async()=>{await g(o("testSmiles2Csv"),{})})),(0,t.t6)("samplesTestSmilesShort",(async()=>{await g(o("testSmilesShort"),{})})),(0,t.t6)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g(o("testActivityCliffsCsv"),{})})),(0,t.t6)("samplesFastaPtCsv",(async()=>{await g(o("fastaPtCsv"),{sequence:new u(c.Hi.FASTA,"SEQ",c.YI.PT,20,!1)})})),(0,t.t6)("samplesTestCerealCsv",(async()=>{await g(o("testCerealCsv"),{})})),(0,t.t6)("samplesTestUnichemSources",(async()=>{await g(o("testUnichemSources"),{})})),(0,t.t6)("samplesTestDmvOffices",(async()=>{await g(o("testDmvOffices"),{})})),(0,t.t6)("samplesTestAlertCollection",(async()=>{await g(o("testAlertCollection"),{})})),(0,t.t6)("samplesTestSpgi",(async()=>{await g(o("testSpgi"),{})})),(0,t.t6)("samplesTestSpgi100",(async()=>{await g(o("testSpgi100"),{})})),(0,t.t6)("samplesTestUrl",(async()=>{await g(o("testUrl"),{})}))})),(0,t.L1)("detectors:weak-and-likely",(()=>{const n={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"},r=t=>async()=>{const r=n[t],i=e.DataFrame.fromCsv(r);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("fastaDnaWeak1",(async()=>{await d(r("fastaDnaWeak1"),"colName")})),(0,t.t6)("fastaDnaWeak1LikelyName",(async()=>{await h(r("fastaDnaWeak1LikelyName"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.DNA,4,!1)})),(0,t.t6)("fastaRnaWeak1",(async()=>{await d(r("fastaRnaWeak1"),"colName")})),(0,t.t6)("fastaRnaWeak1LikelyName",(async()=>{await h(r("fastaRnaWeak1LikelyName"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.RNA,4,!1)})),(0,t.t6)("fastaPtWeak1",(async()=>{await d(r("fastaPtWeak1"),"colName")})),(0,t.t6)("fastaPtWeak1LikelyName",(async()=>{await h(r("fastaPtWeak1LikelyName"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1)})),(0,t.t6)("fastaUn1",(async()=>{await d(r("fastaUn1"),"colName")})),(0,t.t6)("fastaUn1LikelyName",(async()=>{await d(r("fastaUn1LikelyName"),"seq")})),(0,t.t6)("fastaUn2LikelyName",(async()=>{await d(r("fastaUn2LikelyName"),"protein")})),(0,t.t6)("fastaUnMsa1LikelyName",(async()=>{await d(r("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.L1)("detectors: custom",(()=>{const n={cyclized1:{csv:"n,seq\n1,R-F-C(1)-T-G-H-F-Y-G-H-F-Y-G-H-F-Y-P-C(1)-meI\n2,C(1)-T-G-H-F-Y-P-C(1)-meI\n3,R-F-C(1)-T-G-H-F-Y-P-C(1)\n4,C(1)-T-G-H-F-H-P-C(1)\n5,R-F-D(2)-T-G-H-F-Y-P-NH2(2)\n6,R-F-aG(3)-T-G-H-F-Y-P-azG(3)-meI",pos:{seq:new u(c.Hi.CUSTOM,"SEQ",c.YI.UN,13,!0,"-")}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`${r}`,(async()=>{const t=async()=>e.DataFrame.fromCsv(i.csv);for(const e of i.neg??[])await d(t,e);for(const[e,n]of Object.entries(i.pos??{}))await h(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}))})),(0,t.L1)("detectorsBenchmark",(()=>{let n;async function r(r,s,o,a,u,d){return await async function(r){const h=await(async()=>{const t=function(t,n,r,i,s){let o;switch(t){case c.Hi.FASTA:o=e=>{let t="";for(let n=0;n<e.length;n++){const r=e[n];t+=1==r.length?r:`[${r}]`}return t};break;case c.Hi.SEPARATOR:o=(e,t)=>e.join(t);break;default:throw new Error(`Not supported notation '${t}'.`)}const a=(e,t)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e[Math.floor(Math.random()*e.length)];return o(n,s)},l=Array(i);for(let e=0;e<i;e++)l[e]=a(n,r);return e.Column.fromStrings("seq",l)}(s,[...(0,c.Qf)(o)],a,u,d),r=n.prepare({col:t});return i(r),r})(),p=Date.now(),m=i(h),f=Date.now();(function(e,n){const r=l.G.forColumn(e);(0,t.E3)(e.semType===n.semType,!0),(0,t.E3)(r.notation===n.notation,!0),(0,t.E3)(r.alphabet===n.alphabet,!0),(0,t.E3)(r.separator===n.separator,!0)})(m,{semType:e.SEMTYPE.MACROMOLECULE,notation:s,alphabet:o,separator:d});const g=f-p;if(g>r){const e=`ET ${g} ms is more than max allowed ${r} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${g} ms is OK.`),g}(r)}function i(e){e.callSync();const t=e.getOutputParamValue(),n=e.inputs.col;return t&&(n.semType=t),n}(0,t.gM)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});n=t[0];const r=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await n.prepare({col:r}).call()})),(0,t.t6)("fastaDnaShorts50Few50",(async()=>{await r(10,c.Hi.FASTA,c.YI.DNA,50,50)})),(0,t.t6)("fastaDnaShorts50Many1E6",(async()=>{await r(20,c.Hi.FASTA,c.YI.DNA,50,1e6)})),(0,t.t6)("fastaDnaLong1e6Few50",(async()=>{await r(20,c.Hi.FASTA,c.YI.DNA,1e6,50)})),(0,t.t6)("separatorDnaShorts50Few50",(async()=>{await r(10,c.Hi.SEPARATOR,c.YI.DNA,50,50,"/")})),(0,t.t6)("separatorDnaShorts50Many1E6",(async()=>{await r(20,c.Hi.SEPARATOR,c.YI.DNA,50,1e6,"/")})),(0,t.t6)("separatorDnaLong1e6Few50",(async()=>{await r(20,c.Hi.SEPARATOR,c.YI.DNA,1e6,50,"/")}))}));var y=n(608),b=n(1619),w=n(6740);async function v(n,r){const i=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(i);const s=e.DataFrame.fromCsv(r),o=i.getCol("seq");(0,t.E3)(o.semType,e.SEMTYPE.MACROMOLECULE);const c=s.getCol("seq"),l=await(0,y.eE)(o,!0);(0,t.J6)(l.toList(),c.toList())}async function A(n,r,i,s,o,l){const u=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(u);const d=e.DataFrame.fromCsv(r).getCol("seq"),h=u.getCol("seq");(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,i),o&&(0,t.E3)(h.getTag(c.gp.alphabet),o);const p=await(0,b.D)({col:h,pepsea:{method:l}});(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,s),(0,t.E3)(p.getTag(c.gp.aligned),"SEQ.MSA"),o&&(0,t.E3)(p.getTag(c.gp.alphabet),o),(0,t.J6)(p.toList(),d.toList())}(0,t.L1)("MSA",(async()=>{(0,t.t6)("isCorrect",(async()=>{await v("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.t6)("isCorrectLong",(async()=>{await v("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,t.t6)("isCorrectHelm",(async()=>{await(0,w.m8)(),await A("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.Hi.HELM,c.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectHelmLong",(async()=>{await(0,w.m8)(),await A("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.Hi.HELM,c.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectSeparator",(async()=>{await A("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.Hi.SEPARATOR,c.Hi.FASTA,c.YI.PT)})),(0,t.t6)("isCorrectSeparatorLong",(async()=>{await A("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.Hi.SEPARATOR,c.Hi.FASTA,c.YI.PT)}))}));var C=n(1991),E=n.n(C),T=n(7278),S=n(6718),_=n(5785),x=n(6642);async function M(t){const n=await async function(e){return await Se.files.readAsText(e)}(t),r=e.DataFrame.fromCsv(n);return r.name=t.replace(".csv",""),r}async function P(e,n=5e3){await(0,t.cb)(0),await(0,t.PE)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),n);const r=e.columns.length;for(let t=0;t<r;++t){const n=e.columns.byIndex(t);if(n){const t=e.cell(n.name,0),[r,o,a]=(0,x.BG)(t),c=(void 0,(s=i=a.rendererBack)&&void 0!==s.onRendered&&void 0!==s.invalidate&&void 0!==s.awaitRendered?i:null);c&&await c.awaitRendered()}}var i,s}var L=n(4139),N=n(4356);async function $(e,n){const r=(0,c.J9)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(E().count(0).take(r.length).map((e=>r.getOriginal(e))).toArray(),n)}async function I(e,n){const r=(0,T.qp)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(E().count(0).take(r.length).map((e=>r.getOriginal(e))).toArray(),n)}(0,t.L1)("splitters",(async()=>{(0,t.gM)((async()=>{})),(0,t.Pl)((async()=>{}));const e=["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"]],r=["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"]],i=["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"]],s=["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"]],o=["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)"]],a=["RNA1{P.R(U)P.R(T)}$$$$",["P","R(U)P","R(T)"]],c=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,t.t6)("fastaMulti",(async()=>{await $(e[0],e[1])})),(0,t.t6)("fastaFromHelm",(async()=>{await $(n[0],n[1])})),(0,t.t6)("helm1",(async()=>{await I(r[0],r[1])})),(0,t.t6)("helm2",(async()=>{await I(i[0],i[1])})),(0,t.t6)("helm3-multichar",(async()=>{await I(s[0],s[1])})),(0,t.t6)("testHelm1",(async()=>{await I(o[0],o[1])})),(0,t.t6)("testHelm2",(async()=>{await I(a[0],a[1])})),(0,t.t6)("testHelm3",(async()=>{await I(c[0],c[1])}))})),(0,t.L1)("splitters",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)})),(0,t.t6)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),n=e.getCol("MSA"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),n.setTag(c.gp.aligned,L.gN);const i=await(0,_.k)(e,n);(0,t.E3)(i.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(i);const s=a.shell.addTableView(i);await P(s.grid),(0,t.E3)(s.grid.dataFrame.id,e.id)})),(0,t.t6)("getHelmMonomers",(async()=>{const t=e.DataFrame.fromCsv("HELM,Activity\nPEPTIDE1{hHis.N.T}$$$,5.30751\nPEPTIDE1{hHis.Aca.Cys_SEt}$$$,5.72388\n");await a.data.detectSemanticTypes(t);const n=["hHis","Aca","Cys_SEt","N","T"],r=t.getCol("HELM"),i=(0,p.getHelmMonomers)(r),s=n.filter((e=>!i.includes(e))),o=i.filter((e=>!n.includes(e)));if(s.length>0||o.length){const e=[];throw s.length>0&&e.push(`Missed monomers ${JSON.stringify(s)}.`),o.length>0&&e.push(`Unexpected monomers ${JSON.stringify(o)}.`),new Error(e.join(" "))}}))}));var R=n(8604);(0,t.L1)("monomerLibraries",(()=>{let e,n=null;(0,t.gM)((async()=>{e=await(0,S.pj)(),n=(0,N.ub)()})),(0,t.Pl)((async()=>{await(0,N.Eu)(n)})),(0,t.t6)("default",(async()=>{await(0,N.Eu)({exclude:[],explicit:[],duplicateMonomerPreferences:{}}),await e.loadMonomerLib(!0);const n=e.getMonomerLib();(0,t.E3)(n.getPolymerTypes().length>0,!0)})),(0,t.t6)("forTests",(async()=>{await e.loadMonomerLibForTests(),function(e,n){const r=n,i=e.getSummaryObj();for(const e in r)r[e]||delete r[e];for(const e in i)i[e]||delete i[e];if(0==Object.keys(r).length&&0!=Object.keys(i).length)throw new Error("Expected empty monomer lib, actual is not.");if(0!=Object.keys(r).length&&0==Object.keys(i).length)throw new Error("Expected non-empty monomer lib, actual is empty.");try{(0,t.Xk)(i,r),(0,t.Xk)(r,i)}catch(e){throw new Error(`Expected monomer lib ${JSON.stringify(r)} does not match actual ${JSON.stringify(i)}.`)}}(e.getMonomerLib(),R.VV)})),(0,t.t6)("empty",(async()=>{const n=await(0,N.ub)(),r=await e.getFileManager();let i=r.getValidLibraryPaths();0===i.length&&(i=await r.getValidLibraryPathsAsynchronously()),n.exclude=i,n.explicit=[],await(0,N.Eu)(n),await e.loadMonomerLib(!0);const s=e.getMonomerLib().getPolymerTypes();(0,t.E3)(0===s.length,!0)})),(0,t.t6)("override",(async()=>{const n={symbol:"over1",name:"Test override monomer 1",molfile:"",author:"Test Author",id:0,rgroups:[],smiles:"",polymerType:"PEPTIDE",monomerType:"Backbone",createDate:null},r=e.getMonomerLib(),i=r.getMonomer(n.polymerType,n.symbol);(0,t.E3)(null===i,!0,`Unexpectedly found monomer '${n.symbol}' `);const s=r.override({[n.polymerType]:{[n.symbol]:n}}).getMonomer(n.polymerType,n.symbol);(0,t.Xk)(s,n)}))}));var O=n(7389),k=n(1757),D=n.n(k),G=n(1858),H=n(6873),F=n(5433);async function U(n,r){const i=n(),s=e.DataFrame.fromColumns(i);await a.data.detectSemanticTypes(s);const o=Date.now(),c=(s.columns.byName("MSA"),a.shell.addTableView(s));await P(c.grid),(0,t.E3)(c.grid.dataFrame.id,s.id);const l=Date.now()-o;console.log(`Performance test: ${r}: ${l}ms`)}(0,t.L1)("renderers",(()=>{(0,t.t6)("long sequence performance ",(async()=>{await U(H.dW,"Long sequences")})),(0,t.t6)("many sequence performance",(async()=>{await U(H.fD,"Many sequences")})),(0,t.t6)("rendererMacromoleculeFasta",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("Sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("rendererMacromoleculeSeparator",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/SEPARATOR_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("rendererMacromoleculeDifference",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.meta.units=c.Hi.SEPARATOR,n.setTag(c.gp.separator,"/"),n.setTag(c.gp.aligned,"SEQ"),n.setTag(c.gp.alphabet,"UN"),n.setTag(c.gp.alphabetIsMultichar,"true"),n.semType=L.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(i.grid),(0,t.E3)(i.grid.dataFrame.id,r.id);const s=n.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(s,L.uF.MACROMOLECULE_DIFFERENCE)}()})),(0,t.t6)("afterMsa",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.fasta"),r=(0,p.importFasta)(n)[0],i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),console.log("Bio: tests/renderers/afterMsa, table view"),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${i.semType}", units="${i.meta.units}", cell.renderer="${i.getTag(e.TAGS.CELL_RENDERER)}"`),(0,t.E3)(i.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(i.meta.units,c.Hi.FASTA),(0,t.E3)(i.getTag(c.gp.aligned),"SEQ"),(0,t.E3)(i.getTag(c.gp.alphabet),c.YI.PT),(0,t.E3)(i.getTag(e.TAGS.CELL_RENDERER),"sequence");const u=await(0,b.D)({col:i});await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),(0,t.E3)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(u.meta.units,c.Hi.FASTA),(0,t.E3)(u.getTag(c.gp.aligned),"SEQ.MSA"),(0,t.E3)(u.getTag(c.gp.alphabet),c.YI.PT),(0,t.E3)(u.getTag(e.TAGS.CELL_RENDERER),"sequence"),l.G.forColumn(u)}()})),(0,t.t6)("afterConvert",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const u=await(0,F.r)(i,c.Hi.SEPARATOR,"/");await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const d=u.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(d,"sequence"),l.G.forColumn(u)}()})),(0,t.t6)("afterConvertToHelm",(async()=>{await async function(){const n=await a.dapi.files.readCsv("System:AppData/Bio/samples/FASTA_PT.csv"),r=a.shell.addTableView(n);await P(r.grid);const i=n.getCol("sequence"),s=l.G.forColumn(i).convert(c.Hi.HELM);n.columns.add(s),await P(r.grid),(0,t.E3)(s.getTag(e.TAGS.CELL_RENDERER),"helm")}()})),(0,t.t6)("selectRendererBySemType",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.meta.units=c.Hi.SEPARATOR,n.setTag(c.gp.separator,"/"),n.setTag(c.gp.aligned,"SEQ"),n.setTag(c.gp.alphabet,"UN"),n.setTag(c.gp.alphabetIsMultichar,"true"),n.semType=L.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]);a.shell.addTableView(r),await(0,t.cb)(100);const i=n.getTag(e.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'.`)}()})),(0,t.t6)("scatterPlotTooltip",(async()=>{await async function(){const r=e.DataFrame.fromCsv(n);r.currentRowIdx=0;const i=a.shell.addTableView(r),s=r.plot.scatter({x:"x",y:"y"});i.dockManager.dock(s,e.DOCK_TYPE.RIGHT,null),await Promise.all([(0,t.PE)(s.onAfterDrawScene,(()=>{}),(()=>{s.invalidateCanvas()}),1e3),P(i.grid,500)]);const o=s.root.getBoundingClientRect(),c=s.worldToScreen(1,0),l=new MouseEvent("mousemove",{cancelable:!0,bubbles:!0,view:window,button:0,clientX:o.left+c.x,clientY:o.top+c.y}),u=D()(s.root).find("canvas").get()[0];await(0,t.PE)((0,G.fromEvent)(u,"mousemove"),(()=>{Se.logger.debug(`Test: event, currentRowIdx=${r.currentRowIdx}`),(0,t.E3)(D()(O.tooltip.root).find("div table.d4-row-tooltip-table tr td canvas").length,1),(0,t.E3)(s.hitTest(c.x,c.y),1)}),(()=>{u.dispatchEvent(l)}),500),await P(i.grid,500)}()}));const n="seq,x,y\nACGGTGTCGT,0,0\nCGGTATCCCT,1,0\nCTCGGCATGC,2,0\n"}));var V=n(6882);(0,t.L1)("renderers: monomerPlacer",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)}));const i={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:5}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:5}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:297},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,r]of Object.entries(i))(0,t.t6)(`getPosition-${n}`,(async()=>{const t=e.DataFrame.fromCsv(r.csv);await a.data.detectSemanticTypes(t);const n=t.getCol("seq"),i=new V.Jy(null,n,Se.logger,3,(()=>({seqHandler:l.G.forColumn(n),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.zS}))),s=r.testList;for(let e=0;e<n.length;++e)i.getCellMonomerLengths(e,1e4);const o=[];for(const[e,t]of E().enumerate(s)){const t={pos:i.getPosition(e.src.row,e.src.x,1e4)};e.tgt.pos!=t.pos&&o.push(`Test src ${JSON.stringify(e.src)} expected tgt ${JSON.stringify(e.tgt)}, but get ${JSON.stringify({res:t})}`)}if(o.length>0)throw new Error("Test failed error(s):\n"+o.join(", \n"))}))})),(0,t.L1)("renderers: monomerPlacer",(()=>{const e=[10,20,30,40,50,60],n={left:{x:3,tgt:null},c0left:{x:10,tgt:0},c0mid:{x:12,tgt:0},c0right:{x:19,tgt:0},c1left:{x:20,tgt:1},c2right:{x:39,tgt:2},c4left:{x:50,tgt:4},c4right:{x:59,tgt:4},max:{x:60,tgt:null},right:{x:65,tgt:null}};for(const[r,i]of Object.entries(n))(0,t.t6)("hitBounds-"+r,(async()=>{const n=(0,V.Bb)(e,i.x);(0,t.E3)(n,i.tgt)}))})),(0,t.L1)("converters",(()=>{let n;!function(e){e.fastaPt="fastaPt",e.separatorPt="separatorPt",e.helmPt="helmPt",e.fastaDna="fastaDna",e.separatorDna="separatorDna",e.helmDna="helmDna",e.fastaRna="fastaRna",e.separatorRna="separatorRna",e.helmRna="helmRna",e.fastaGaps="fastaGaps",e.separatorGaps="separatorGaps",e.helmGaps="helmGaps",e.fastaUn="fastaUn",e.separatorUn="separatorUn",e.helmUn="helmUn",e.helmLoneDeoxyribose="helmLoneDeoxyribose",e.helmLoneRibose="helmLoneRibose",e.helmLonePhosphorus="helmLonePhosphorus",e.fastaLoneDeoxyribose="fastaLoneDeoxyribose",e.fastaLoneRibose="fastaLoneRibose",e.fastaLonePhosphorus="fastaLonePhosphorus"}(n||(n={}));const r={[n.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[n.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",[n.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}$$$$",[n.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[n.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",[n.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}$$$$",[n.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[n.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",[n.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}$$$$",[n.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[n.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",[n.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}$$$$",[n.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]",[n.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",[n.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}$$$$",[n.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}$$$$",[n.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}$$$$",[n.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}$$$$"},i=new Set(Object.values(c.gp));async function s(t){const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i}function o(e,n){if(e===c.Hi.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${e.toString()}'.`);return function(r){const i=l.G.forColumn(r).convert(e,n);return(0,t.E3)(i.meta.units,e),i}}async function u(e,n,r){const o=(await s(e)).getCol("seq"),a=n(o),u=(await s(r)).getCol("seq");(0,t.J6)(a.toList(),u.toList());const d=l.G.forColumn(o),h=l.G.forColumn(a);for(const[e,n]of Object.entries(u.tags)){if(!i.has(e)||d.notation===c.Hi.HELM&&[c.gp.alphabet,c.gp.alphabetIsMultichar].includes(e)||h.notation===c.Hi.HELM&&[c.gp.alphabet,c.gp.alphabetIsMultichar].includes(e))continue;const r=a.getTag(e);(0,t.E3)(r,n,`Tag '${e}' expected value '${n}' is not equal to actual '${r}'.`)}}(0,t.t6)("testFastaPtToSeparator",(async()=>{await u(n.fastaPt,o(c.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testFastaDnaToSeparator",(async()=>{await u(n.fastaDna,o(c.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testFastaRnaToSeparator",(async()=>{await u(n.fastaRna,o(c.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testFastaGapsToSeparator",(async()=>{await u(n.fastaGaps,o(c.Hi.SEPARATOR,"/"),n.separatorGaps)})),(0,t.t6)("testFastaUnToSeparator",(async()=>{await u(n.fastaUn,o(c.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testFastaPtToHelm",(async()=>{await u(n.fastaPt,o(c.Hi.HELM),n.helmPt)})),(0,t.t6)("testFastaDnaToHelm",(async()=>{await u(n.fastaDna,o(c.Hi.HELM),n.helmDna)})),(0,t.t6)("testFastaRnaToHelm",(async()=>{await u(n.fastaRna,o(c.Hi.HELM),n.helmRna)})),(0,t.t6)("testFastaGapsToHelm",(async()=>{await u(n.fastaGaps,o(c.Hi.HELM),n.helmGaps)})),(0,t.t6)("testSeparatorPtToFasta",(async()=>{await u(n.separatorPt,o(c.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testSeparatorDnaToFasta",(async()=>{await u(n.separatorDna,o(c.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testSeparatorRnaToFasta",(async()=>{await u(n.separatorRna,o(c.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testSeparatorGapsToFasta",(async()=>{await u(n.separatorGaps,o(c.Hi.FASTA),n.fastaGaps)})),(0,t.t6)("testSeparatorUnToFasta",(async()=>{await u(n.separatorUn,o(c.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testSeparatorPtToHelm",(async()=>{await u(n.separatorPt,o(c.Hi.HELM),n.helmPt)})),(0,t.t6)("testSeparatorDnaToHelm",(async()=>{await u(n.separatorDna,o(c.Hi.HELM),n.helmDna)})),(0,t.t6)("testSeparatorRnaToHelm",(async()=>{await u(n.separatorRna,o(c.Hi.HELM),n.helmRna)})),(0,t.t6)("testSeparatorGapsToHelm",(async()=>{await u(n.separatorGaps,o(c.Hi.HELM),n.helmGaps)})),(0,t.t6)("testHelmDnaToFasta",(async()=>{await u(n.helmDna,o(c.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testHelmRnaToFasta",(async()=>{await u(n.helmRna,o(c.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmPtToFasta",(async()=>{await u(n.helmPt,o(c.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testHelmUnToFasta",(async()=>{await u(n.helmUn,o(c.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testHelmDnaToSeparator",(async()=>{await u(n.helmDna,o(c.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmRnaToSeparator",(async()=>{await u(n.helmRna,o(c.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testHelmPtToSeparator",(async()=>{await u(n.helmPt,o(c.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testHelmUnToSeparator",(async()=>{await u(n.helmUn,o(c.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testHelmLoneRibose",(async()=>{await u(n.helmLoneRibose,o(c.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmLoneDeoxyribose",(async()=>{await u(n.helmLoneDeoxyribose,o(c.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmLonePhosphorus",(async()=>{await u(n.helmLonePhosphorus,o(c.Hi.FASTA),n.fastaRna)}))}));var B=n(3516);(0,t.L1)("fastaFileHandler",(()=>{const n=["description:1","description:2","description:3","description:4"],r=(e.Column.fromStrings("description",n),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function i(e){const i=new B.m(e),s=i.descriptionsArray,o=i.sequencesArray;(0,t.J6)([s,o],[n,r])}(0,t.t6)("testNormalFormatting",(async()=>{i(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,t.t6)("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,t.t6)("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 Y=n(3890);(0,t.L1)("fastaExport",(()=>{let n;!function(e){e.single="single",e.multi="multi"}(n||(n={}));const r={[n.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[n.multi]:{src:"M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",tgt:["M[MeI]YKETLL[MeF]P","KTDFPMRGGL","[MeA]"]}};let i;!function(e){e.test1="test1",e.test2="test2"}(i||(i={}));const s={[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 o(n,i=10){const s=r[n].src,o=e.Column.fromStrings("src",[s]);o.semType=e.SEMTYPE.MACROMOLECULE,o.meta.units=c.Hi.FASTA;const a=l.G.forColumn(o).getSplitted(0),u=(0,Y.aS)(a,i),d=r[n].tgt;(0,t.J6)(u,d)}async function a(n){const r=e.DataFrame.fromCsv(n.srcCsv),i=r.getCol(n.seqCol);i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=c.Hi.FASTA;const s=n.idCols.map((e=>r.getCol(e))),o=(0,Y.wz)(s,i,n.lineWidth);(0,t.E3)(o,n.tgtFasta)}(0,t.t6)("wrapSequenceSingle",(async()=>{o(n.single,10)})),(0,t.t6)("wrapSequenceMulti",(async()=>{o(n.multi,10)})),(0,t.t6)("saveAsFastaTest1",(async()=>{a(s[i.test1])})),(0,t.t6)("saveAsFastaTest2",(async()=>{a(s[i.test2])}))}));var W=n(4152),j=n(439);const K=j._S;(0,t.L1)("bio",(()=>{const n="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.t6)("testGetStatsHelm1",(async()=>{const n=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.HELM;const r=(0,T.vZ)(n,1,c.qp);(0,t.Xk)(r.freq,{meI:1}),(0,t.E3)(r.sameLength,!0)})),(0,t.t6)("testGetStatsN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA;const i=(0,T.vZ)(r,5,c.J9);(0,t.Xk)(i.freq,{A:4,C:5,G:3,T:6}),(0,t.E3)(i.sameLength,!0)}(n)})),(0,t.t6)("testGetAlphabetSimilarity",(async()=>{await async function(){const e={A:2041,C:3015,G:3015,T:2048,[K]:1e3},n=new Set(Object.keys(o.Q.Names)),r=(0,c.nq)(e,n);(0,t.E3)(r>.6,!0)}()})),(0,t.t6)("testPickupPaletteN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA;const i=(0,c.SM)(r);(0,t.E3)(i instanceof o.A,!0)}(n)})),(0,t.t6)("testPickupPaletteN1e",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.FASTA;const r=(0,c.SM)(n);(0,t.E3)(r instanceof o.A,!0)}()})),(0,t.t6)("testPickupPaletteAA1",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.FASTA;const r=(0,c.SM)(n);(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPickupPaletteX",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.FASTA;const r=(0,c.SM)(n);(0,t.E3)(r instanceof W.$u,!0)}()}))})),(0,t.L1)("WebLogo.monomerToShort",(()=>{(0,t.t6)("longMonomerSingle",(async()=>{(0,t.E3)((0,c.zS)("S",5),"S")})),(0,t.t6)("longMonomerShort",(async()=>{(0,t.E3)((0,c.zS)("Short",5),"Short")})),(0,t.t6)("longMonomerLong56",(async()=>{(0,t.E3)((0,c.zS)("Long56",6),"Long56")})),(0,t.t6)("longMonomerComplexFirstPartShort",(async()=>{(0,t.E3)((0,c.zS)("Long-long",5),"Long…")})),(0,t.t6)("longMonomerComplexFirstPartLong56",(async()=>{(0,t.E3)((0,c.zS)("Long56-long",6),"Long5…")})),(0,t.t6)("monomerToShort",(async()=>{const e=[["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…"]],n=e.map((e=>e[0])),r=e.map((e=>e[1])),i=n.map((e=>(0,c.zS)(e,3)));(0,t.J6)(i,r)}))}));var z=n(8047);const q=j._S;function Z(e,n){(0,t.E3)(e.name,n.name),(0,t.J6)(e.getMonomers(),n.getMonomers());for(const r of e.getMonomers())(0,t.E3)(e.getFreq(r).rowCount,n.getFreq(r).rowCount)}(0,t.L1)("WebLogo-positions",(()=>{const n="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.t6)("allPositions",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=c.Hi.FASTA,s.setTag(c.gp.alphabet,c.YI.DNA),s.setTag(c.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo");await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500,"Layout calculate timeout");const l=o.positions,u=[new z.Ue(0,"1",{A:new z.Tc(2),[q]:new z.Tc(3)}),new z.Ue(1,"2",{T:new z.Tc(5)}),new z.Ue(2,"3",{C:new z.Tc(5)}),new z.Ue(3,"4",{[q]:new z.Tc(5)}),new z.Ue(4,"5",{G:new z.Tc(5)}),new z.Ue(5,"6",{[q]:new z.Tc(3),C:new z.Tc(2)}),new z.Ue(6,"7",{T:new z.Tc(5)}),new z.Ue(7,"8",{T:new z.Tc(5)}),new z.Ue(8,"9",{G:new z.Tc(5)}),new z.Ue(9,"10",{C:new z.Tc(5)}),new z.Ue(10,"11",{[q]:new z.Tc(5)}),new z.Ue(11,"12",{[q]:new z.Tc(5)})];(0,t.E3)(l.length,u.length);for(let e=0;e<l.length;e++){(0,t.E3)(l[e].name,u[e].name);for(const n of l[e].getMonomers())(0,t.E3)(l[e].getFreq(n).rowCount,u[e].getFreq(n).rowCount)}await o.awaitRendered()})),(0,t.t6)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const n=e.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-"),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=c.Hi.FASTA,i.setTag(c.gp.alphabet,c.YI.DNA),i.setTag(c.gp.aligned,"SEQ"),n.filter.init((e=>e>2)),n.filter.fireChanged();const s=await n.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.PE)(s.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(s.root,e.DOCK_TYPE.DOWN)}),500);const o=s.positions,l=[new z.Ue(0,"1",{[q]:new z.Tc(3)}),new z.Ue(1,"2",{T:new z.Tc(3)}),new z.Ue(2,"3",{[q]:new z.Tc(3)}),new z.Ue(3,"4",{[q]:new z.Tc(3)}),new z.Ue(4,"5",{C:new z.Tc(3)}),new z.Ue(5,"6",{[q]:new z.Tc(2),C:new z.Tc(1)}),new z.Ue(6,"7",{G:new z.Tc(3)}),new z.Ue(7,"8",{T:new z.Tc(3)}),new z.Ue(8,"9",{[q]:new z.Tc(3)})];(0,t.E3)(o.length,l.length);for(let e=0;e<o.length;e++){(0,t.E3)(o[e].name,l[e].name);for(const n of o[e].getMonomers())(0,t.E3)(o[e].getFreq(n).rowCount,l[e].getFreq(n).rowCount)}await s.awaitRendered()})),(0,t.t6)("positions with skipEmptyPositions option",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=c.Hi.FASTA,s.setTag(c.gp.alphabet,c.YI.DNA),s.setTag(c.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,u=[new z.Ue(0,"1",{A:new z.Tc(2),[q]:new z.Tc(3)}),new z.Ue(1,"2",{T:new z.Tc(5)}),new z.Ue(2,"3",{C:new z.Tc(5)}),new z.Ue(4,"5",{G:new z.Tc(5)}),new z.Ue(5,"6",{[q]:new z.Tc(3),C:new z.Tc(2)}),new z.Ue(6,"7",{T:new z.Tc(5)}),new z.Ue(7,"8",{T:new z.Tc(5)}),new z.Ue(8,"9",{G:new z.Tc(5)}),new z.Ue(9,"10",{C:new z.Tc(5)})];(0,t.E3)(l.length,u.length);for(let e=0;e<l.length;e++)Z(l[e],u[e]);await o.awaitRendered()})),(0,t.t6)("count sequences for monomer at position",(async()=>{const r=function(t,n,r){const i=e.DataFrame.fromCsv(t),s=i.getCol("seq");return s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=n,s.setTag(c.gp.alphabet,r),s.setTag(c.gp.aligned,"SEQ.MSA"),i}(n,c.Hi.FASTA,c.YI.DNA),i=r.getCol("seq"),s=a.shell.addTableView(r),o=await r.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{s.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const u=o.positions,d=[new z.Ue(2,"3",{C:new z.Tc(5)}),new z.Ue(4,"5",{G:new z.Tc(5)}),new z.Ue(5,"6",{[q]:new z.Tc(3),C:new z.Tc(2)}),new z.Ue(6,"7",{T:new z.Tc(5)})];(0,t.E3)(u.length,d.length);for(let e=0;e<u.length;e++)Z(u[e],d[e]);const h=u[1],p=l.G.forColumn(i),m=(0,z.eN)(r,p,r.filter,"G",h);(0,t.E3)(m,5),await o.awaitRendered()})),(0,t.t6)("empty",(async()=>{const n=e.DataFrame.fromColumns([(()=>{const t=e.Column.fromStrings("seq",[]);return t.semType=e.SEMTYPE.MACROMOLECULE,t.meta.units=c.Hi.FASTA,t.setTag(c.gp.alphabet,c.YI.DNA),t})()]),r=a.shell.addTableView(n),i=await n.plot.fromType("WebLogo");await(0,t.PE)(i.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500),i.positions,await i.awaitRendered()}))})),(0,t.L1)("WebLogo-project",(()=>{(0,t.t6)("fasta",(async()=>{const n="Tests.Bio.WebLogo-project.fasta",r=await Se.files.readCsv("tests/filter_FASTA.csv"),i=r.name,s=r.getCol("fasta");await a.data.detectSemanticTypes(r);const o=a.shell.addTableView(r),c=await r.plot.fromType("WebLogo",{sequenceColumnName:s.name});o.dockManager.dock(c),await c.awaitRendered(),await P(o.grid),await async function(t,n,r,i){const s=e.Project.create(),o=r.saveLayout();s.name=t,s.addChild(n),s.addChild(o),await a.dapi.layouts.save(r.saveLayout()),await a.dapi.tables.uploadDataFrame(i),await a.dapi.tables.save(n),await a.dapi.projects.save(s)}(n,r.getTableInfo(),o,r),a.shell.closeAll(),await(0,t.cb)(500),await a.dapi.projects.open(n);const l=a.shell.getTableView(i),u=E()(l.viewers).toArray();(0,t.E3)(u.length,2),(0,t.E3)(u.filter((e=>"Grid"===e.type)).length,1);const d=u.find((e=>"WebLogo"===e.type));(0,t.E3)(!!d,!0),await P(o.grid),await d.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.L1)("WebLogo-layout",(()=>{(0,t.t6)("fasta",(async()=>{const e=await Se.files.readCsv("tests/filter_FASTA.csv"),n=e.getCol("fasta");await a.data.detectSemanticTypes(e);const r=a.shell.addTableView(e),i=await e.plot.fromType("WebLogo",{sequenceColumnName:n.name});r.dockManager.dock(i),await(0,t.cb)(2*z.VN.render),await i.awaitRendered(),await P(r.grid);const s=r.saveLayout();s.toJson(),r.loadLayout(s),await(0,t.cb)(2*z.VN.render),await i.awaitRendered(),await P(r.grid);const o=E()(r.viewers).toArray();(0,t.E3)(o.length,2),(0,t.E3)(o.filter((e=>"Grid"===e.type)).length,1),(0,t.E3)(o.filter((e=>"WebLogo"===e.type)).length,1)}))}));var X=n(966);function J(e,t){let n=null;for(const r of e.viewers)r.type===t&&(n=r);return n}(0,t.L1)("checkInputColumn",(()=>{const n="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.t6)("testMsaPos",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA,r.setTag(c.gp.alphabet,c.YI.DNA),r.setTag(c.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[c.Hi.FASTA],[c.YI.DNA,c.YI.RNA,c.YI.PT]);(0,t.E3)(i,!0)})),(0,t.t6)("testMsaNegHelm",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.HELM,r.setTag(c.gp.alphabetIsMultichar,"true");const[i,s]=(0,X.l)(r,"Test",[c.Hi.FASTA],[c.YI.DNA,c.YI.RNA,c.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testMsaNegUN",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA,r.setTag(c.gp.alphabet,"UN"),r.setTag(c.gp.alphabetSize,"11"),r.setTag(c.gp.alphabetIsMultichar,"true"),r.setTag(c.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[c.Hi.FASTA],[c.YI.DNA,c.YI.RNA,c.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testGetActionFunctionMeta",(async()=>{e.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((e=>"sequence"==e.name))}))})),(0,t.L1)("similarity/diversity",(async()=>{(0,t.t6)("similaritySearchViewer",(async()=>{await async function(){const n=await Se.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r),s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Similarity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.RIGHT,null,"Similarity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"Sequence Similarity Search")),"Sequence Similarity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.scores.get(0),e.FLOAT_NULL),(0,t.E3)(l.idxs.get(0),0),(0,t.E3)(l.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,t.E3)(l.scores.get(1).toFixed(2),"0.73"),(0,t.E3)(l.idxs.get(1),4),(0,t.E3)(l.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,t.bk)((()=>1===l.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,t.bk)((()=>"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"===l.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,t.t6)("diversitySearchViewer",(async()=>{await async function(){const n=await Se.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Diversity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.DOWN,null,"Diversity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"Sequence Diversity Search")),"Sequence Diversity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.initialized,!0),(0,t.E3)(l.renderMolIds.length>0,!0)}()}))}));var Q=n(9124),ee=n(1687),te=n(4577);async function ne(e,t){if(!t.columns.names().includes(e))throw new Error(`The column '${e}' not found. Available in data frame are ${JSON.stringify(t.columns.names())}`);const n=new ee._i;return n.attach(t),n.applyState({columnName:e}),n.column=t.col(e),n.columnName=e,n}(0,t.L1)("bio-substructure-filters",(async()=>{let n,r,i;(0,t.gM)((async()=>{n=await(0,Q.b2)(),r=await(0,S.pj)(),i=await(0,N.ub)(),await r.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("fasta",(async()=>{const e=await M("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=new ee._i;n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new te.n("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,3),(0,t.E3)(n.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("separator",(async()=>{const e=await M("tests/filter_MSA.csv"),n=new ee._i;await a.data.detectSemanticTypes(e),n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"SeparatorBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,0),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1)}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",n=await M("tests/filter_HELM.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n);Se.logger.debug(`${e}, filter attaching.`);const i=new ee._i;i.attach(n);const s=O.dialog("Test filters").add(i.root).show();await i.awaitRendered();try{const s=i.bioFilter;(0,t.E3)(null!==i.bioFilter,!0,"bioFilter is not created"),Se.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{A.C}$$$$V2.0")}),2e4),Se.logger.debug(`${e}, filter 1 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,1),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"0001"),Se.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{C}$$$$V2.0")}),2e4),await P(r.grid),Se.logger.debug(`${e}, filter 2 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,2),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"1001")}finally{s.close()}await i.awaitRendered(),await(0,t.cb)(3e3)})),(0,t.t6)("helm-view",(async()=>{const e=await M("tests/filter_HELM.csv");e.getCol("HELM string"),await a.data.detectSemanticTypes(e);const t=a.shell.addTableView(e);t.getFiltersGroup(),await P(t.grid)})),(0,t.t6)("sync-fasta",(async()=>{const e=await Se.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=await ne("fasta",e),r=await ne("fasta",e);await Promise.all([n.awaitRendered(),r.awaitRendered()]);try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter"),(0,t.E3)(r.bioFilter.type,"FastaBioFilter");const i=n.bioFilter,s=r.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new te.n("MD")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,3),await n.awaitRendered(),(0,t.E3)(s.props.substructure,"MD")}finally{n.detach(),r.detach()}await Promise.all([n.awaitRendered(),r.awaitRendered()])})),(0,t.t6)("sync-msa",(async()=>{const e=await Se.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const n="hHis-Aca",r=await ne("MSA",e),i=await ne("MSA",e);await Promise.all([r.awaitRendered(),i.awaitRendered()]);try{(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(r.bioFilter.type,"SeparatorBioFilter"),(0,t.E3)(i.bioFilter.type,"SeparatorBioFilter");const s=r.bioFilter,o=i.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new ee.AR(n,"-")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,8),(0,t.E3)(o.props.substructure,n),(0,t.E3)(o.props.separator,"-")}finally{r.detach(),i.detach()}await Promise.all([r.awaitRendered(),i.awaitRendered()])})),(0,t.t6)("sync-helm",(async()=>{const e=await Se.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),r="PEPTIDE1{A.C}$$$$V2.0",i=await ne("HELM string",e),s=await ne("HELM string",e),o=O.dialog("Test filters").add(i.root).add(s.root).show();await Promise.all([i.awaitRendered(),s.awaitRendered()]);try{(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(!!s.bioFilter,!0),(0,t.E3)(i.bioFilter.type,"HelmBioFilter"),(0,t.E3)(s.bioFilter.type,"HelmBioFilter");const o=i.bioFilter,a=s.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(r)}),6e4,"await onRowsFiltered"),await P(n.grid),Se.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.cb)(2*i.debounceTime),Se.logger.debug("Bio tests: substructureFilters/sync-helm, after changed event"),(0,t.E3)(e.filter.trueCount,1),await i.awaitRendered(),(0,t.E3)(a.props.substructure,r)}finally{i.detach(),s.detach(),o.close()}await Promise.all([i.awaitRendered(),s.awaitRendered()]),await P(n.grid),await(0,t.cb)(3e3)})),(0,t.t6)("two-columns-fasta",(async()=>{const n=e.DataFrame.fromCsv("id,seq1,seq2,trueSeq1,trueSeq2\n0,CGGCTACGGC,ATTGCATTCG,0,1,\n1,CGGCTGCCGC,ATAGCATTCG,1,1,\n2,CGGCTGCGCC,AATGCATACG,1,0,\n3,CGGCTGCATT,TTTGCATTCG,1,1,\n4,CGGCTGCATT,AAAGCATACG,1,0,\n");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i="seq1",s="CGGCTG",o=n.getCol("trueSeq1").toList(),c="seq2",l="GCATT",u=n.getCol("trueSeq2").toList(),d=[{type:"Bio:bioSubstructureFilter",columnName:i},{type:"Bio:bioSubstructureFilter",columnName:c}],h=await n.plot.fromType(e.VIEWER.FILTERS,{filters:d});r.dockManager.dock(h,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid);const p=h.filters[0],m=h.filters[1];(0,t.E3)(p.column.name,i),(0,t.E3)(m.column.name,c);const f=p.bioFilter,g=m.bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on seq1"),(0,t.E3)(n.filter.trueCount,o.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),o.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),1e3,"testEvent onRowsFiltered on seq2"),(0,t.E3)(n.filter.trueCount,u.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),u.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on neither"),(0,t.E3)(n.filter.trueCount,n.rowCount),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),5e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),5e3,"testEvent onRowsFiltered on both");const y=E().count(0).take(n.rowCount).map((e=>o[e]*u[e])).toArray();(0,t.E3)(n.filter.trueCount,y.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),y.map((e=>e.toString())).join("")),await Promise.all([p.awaitRendered(),m.awaitRendered(),P(r.grid)])})),(0,t.t6)("reset-fasta",(async()=>{const n=await M("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i="MD",s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}]});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid);const o=s.filters[0].bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(i)}),1e3,"testEvent onRowsFiltered"),(0,t.E3)(n.filter.trueCount,3),(0,t.E3)(o.props.substructure,i),(0,t.E3)(o.substructureInput.value,i),D()(s.root).find('i[name="icon-arrow-rotate-left"]')[0].click(),await(0,t.cb)(100),await P(r.grid),(0,t.E3)(o.props.substructure,""),(0,t.E3)(o.substructureInput.value,"")})),(0,t.t6)("reopen",(async()=>{const n=await Se.files.readCsv("tests/filter_FASTA.csv"),r=a.shell.addTableView(n),i=[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}],s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid),s.close(),await P(r.grid);const o=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(o,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid)}))}));var re=n(8152);class ie{errorList=[];warningList=[];infoList=[];debugList=[];error(e,t,n){this.errorList.push({message:e,params:t,stackTrace:n})}warning(e,t){this.warningList.push({message:e,params:t})}info(e,t){this.infoList.push({message:e,params:t})}debug(e,t){this.debugList.push({message:e,params:t})}}var se=n(9192);(0,t.L1)("PepSeA",(()=>{(0,t.gM)((async()=>{await(0,w.m8)()})),(0,t.t6)("Basic alignment",(async()=>{const n=e.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'),r=await(0,re.GD)(n.getCol("HELM"),"msa(HELM)"),i=n.getCol("MSA");for(let e=0;e<r.length;++e)(0,t.E3)(r.get(e)==i.get(e),!0)}),{timeout:6e4,stressTest:!0}),(0,t.t6)("stderr",(async()=>{const n=new ie,r=e.DataFrame.fromCsv('HELM,MSA\n"PEPTIDE1{F.L.Mis.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.Mis.G.W.MeF.Y..S.N.N.C"\n"PEPTIDE1{F.L.Mis.G.Y.[MeF].Y.W.N.C}$$$$","F.L.Mis.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'),i=await(0,re.GD)(r.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n),s=r.getCol("MSA");(0,t.J6)(i.toList(),s.toList()),(0,t.E3)(n.warningList[0].message,"Mis not found in Monomer Map\nMeF not found in Monomer Map\n")}),{timeout:6e4,stressTest:!0}),(0,t.t6)("error",(async()=>{const n=new ie;try{const t=e.DataFrame.fromCsv('HELM\n"PEPTIDE1{[NH2].*.A.Q.T.T.Y.K.N.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].M.A.N.T.T.Y.K.N.Y.R.N.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.C.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.F.Y.R.R.N.L.L.*.[COOH]}$$$$"\n');await(0,re.GD)(t.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n)}catch(e){const[t,r]=(0,se.AP)(e);n.error(t,void 0,r)}(0,t.E3)(n.errorList[0].message,"PepSeA error: The pair (*,M) couldn't be found in the substitution matrix")}))})),(0,t.L1)("viewers",(()=>{const n=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of n)(0,t.t6)(e,(async()=>{const n=await M("samples/FASTA_DNA.csv");await(0,t.Bl)(e,n,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const oe="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",ae="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",ce="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 le;(0,t.L1)("SeqHandler",(()=>{async function n(t){const n=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(n);const r=l.G.forColumn(n.getCol("seq"));return[n,r]}(0,t.t6)("Seq-Fasta",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Fasta-units",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA-units",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Helm",(async()=>{const[e,r]=await n("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,t.E3)(r.notation,c.Hi.HELM),(0,t.E3)(r.isHelm(),!0)})),(0,t.t6)("Seq-UN",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,c.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,c.YI.UN)})),(0,t.t6)("Seq-UN-auto",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,c.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,c.YI.UN)})),(0,t.t6)("column-version",(async()=>{const n=e.DataFrame.fromCsv(oe);await a.data.detectSemanticTypes(n);const r=n.getCol("seq"),i=l.G.forColumn(r),s=r.version,o=l.G.forColumn(r),c=r.version;(0,t.E3)(s,c,"Unexpected column version changed"),(0,t.E3)(i,o,"Unexpected SeqHandler object changed"),n.rows.addNew(["TACCCCTTCAAC"]);const u=l.G.forColumn(r),d=r.version;(0,t.E3)(c<d,!0,"Stalled column version on add row"),(0,t.E3)(o!==u,!0,"Stalled SeqHandler object on add row"),r.set(1,"CAGTGTCCCCGT");const h=l.G.forColumn(r),p=r.version;(0,t.E3)(d<p,!0,"Stalled column version on change data"),(0,t.E3)(u!==h,!0,"Stalled SeqHandler object on change data"),r.setTag("testTag","testValue");const m=l.G.forColumn(r),f=r.version;(0,t.E3)(p<f,!0,"Stalled column version on set tag"),(0,t.E3)(h!==m,!0,"Stalled SeqHandler object on set tag")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(le||(le={})),(0,t.L1)("SeqHandler",(()=>{j.b9[c.Hi.FASTA],j.b9[c.Hi.HELM];const n=j.b9[c.Hi.SEPARATOR],r={[le.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.Hi.FASTA,splitted:[["A","C","G","T","C","A","C","G","T","C"],["C","A","G","T","G","T","C","A","G","T","G","T"],["T","T","C","A","A","C","T","T","C","A","A","C"]]}},[le.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.Hi.FASTA,splitted:[["A","C","-","G","T","-","C","T","A","C","-","G","T","-","C","T"],["C","A","C","-","T","-","G","T","C","A","C","-","T","-","G","T"],["A","C","C","G","T","A","C","T","A","C","C","G","T","A","C","T"]]}},[le.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.Hi.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"]]}},[le.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.Hi.SEPARATOR,separator:"-",splitted:[["rut0","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut1","her2","rty",n,"abc1","dfgg","rut12","her2","rty",n,"abc1","dfgg"],["rut2","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],["rut3","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],[n,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",n]]}},[le.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.Hi.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[n,i]of Object.entries(r))(0,t.t6)(`splitted-${n}`,(async()=>{const n=e.DataFrame.fromCsv(i.src.csv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),(0,t.E3)(n.semType,e.SEMTYPE.MACROMOLECULE);const s=l.G.forColumn(n);(0,t.E3)(s.notation,i.tgt.notation),(0,t.E3)(s.separator===i.tgt.separator,!0);const o=E().count(0).take(s.length).map((e=>{const t=s.getSplitted(e);return E().count(0).take(t.length).map((e=>t.getOriginal(e))).toArray()})).toArray();(0,t.J6)(o,i.tgt.splitted)}))})),(0,t.L1)("SeqHandler: getRegion",(()=>{const n={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:c.Hi.FASTA,alphabet:c.YI.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.Hi.SEPARATOR,alphabet:c.YI.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.Hi.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`${r}-idx`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=l.G.forColumn(n).getRegion(i.startIdx,i.endIdx,"regSeq"),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(c.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(c.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())})),i.positionNames&&(0,t.t6)(`${r}-positionNames`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq");i.positionNames.tag&&n.setTag(c.gp.positionNames,i.positionNames.tag);const r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=await a.functions.call("Bio:getRegion",{sequence:n,start:i.positionNames.start,end:i.positionNames.end}),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(c.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(c.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())}))})),(0,t.L1)("SeqHandler: getHelm",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)}));const i={fasta:{src:{seq:"MDYKETMDYKET",notation:c.Hi.FASTA},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},separator:{src:{seq:"M-D-Y-K-E-T-M-D-Y-K-E-T",notation:c.Hi.SEPARATOR,separator:"-"},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},helm:{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$$$$",notation:c.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$$$$"}},"helm-cyclic":{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0",notation:c.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0"}}};for(const[e,n]of Object.entries(i))(0,t.t6)(e,(async()=>{await s(n.src.seq,n.src.notation,n.src.separator,n.tgt.helm)}));async function s(n,r,i,s){const o=e.Column.fromStrings("seq",[n]),c=e.DataFrame.fromColumns([o]);await a.data.detectSemanticTypes(c);const u=l.G.forColumn(o),d=await u.getHelm(0,!1);(0,t.E3)(d,s)}}));var ue=n(6077),de=n(6717);const he=new e.FileSource("System:AppData/Bio"),pe={"peptides-fasta":{inPath:"tests/to-atomic-level-peptides-fasta-input.csv",outPath:"tests/to-atomic-level-peptides-fasta-output.csv"},"dna-fasta":{inPath:"tests/to-atomic-level-dna-fasta-input.csv",outPath:"tests/to-atomic-level-dna-fasta-output.csv"},"msa-separator":{inPath:"tests/to-atomic-level-msa-separator-input.csv",outPath:"tests/to-atomic-level-msa-separator-output.csv"},"msa-fasta":{inPath:"tests/to-atomic-level-msa-fasta-input.csv",outPath:"tests/to-atomic-level-msa-fasta-output.csv"}},me="molfile(sequence)";function fe(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.L1)("toAtomicLevel",(async()=>{const n={},r={};let i,s,o,u,d;async function h(e,n){const r=e.getCol("sequence");await a.functions.call("Bio:toAtomicLevel",{table:e,seqCol:r,nonlinear:!1});const i=e.getCol(me),s=n.getCol(me),o=E()(i.values()).map((e=>fe(e))).toArray(),c=E()(s.values()).map((e=>fe(e))).toArray();(0,t.J6)(o,c)}(0,t.gM)((async()=>{u=await(0,de.j)(),i=await(0,S.pj)(),s=await(0,N.ub)(),await i.loadMonomerLibForTests(),o=i.getMonomerLib();for(const[t,i]of Object.entries(pe))i.inPath,n[t]=e.DataFrame.fromCsv((await he.readAsText(i.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(n[t]),r[t]=e.DataFrame.fromCsv((await he.readAsText(i.outPath)).replace(/\n$/,""))})),(0,t.Pl)((async()=>{await(0,N.Eu)(s),await i.loadMonomerLib(!0)}));for(const[e,i]of Object.entries(pe))(0,t.t6)(`${e}`,(async()=>{await h(n[e],r[e])}));!function(e){e.fastaDna="fastaDna",e.fastaRna="fastaRna",e.fastaPt="fastaPt",e.fastaUn="fastaUn",e.separatorDna="separatorDna",e.separatorRna="separatorRna",e.separatorPt="separatorPt",e.separatorUn="separatorUn",e.helm="helm"}(d||(d={}));const p={[d.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[d.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[d.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[d.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][Tyr_PO3H2]",[d.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",[d.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",[d.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",[d.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",[d.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(t){const n=p[t],r=e.DataFrame.fromCsv(n.replace(/\n$/,""));return await a.data.detectSemanticTypes(r),r}async function f(e,t="seq",n){const r=e.getCol(t),i=await(0,ue.C4)(e,r,o,u);return i.warnings.length>0&&Se.logger.warning(`_toAtomicLevel() warnings ${i.warnings.join("\n")}`),i.molCol}(0,t.t6)("fastaDna",(async()=>{await f(await m(d.fastaDna),"seq")})),(0,t.t6)("fastaRna",(async()=>{await f(await m(d.fastaRna),"seq")})),(0,t.t6)("fastaPt",(async()=>{await f(await m(d.fastaPt),"seq")})),(0,t.t6)("fastaUn",(async()=>{await f(await m(d.fastaUn),"seq")})),(0,t.t6)("separatorDna",(async()=>{await f(await m(d.separatorDna),"seq")})),(0,t.t6)("separatorDna",(async()=>{await f(await m(d.separatorRna),"seq")})),(0,t.t6)("separatorPt",(async()=>{await f(await m(d.separatorPt),"seq")})),(0,t.t6)("separatorUn",(async()=>{await f(await m(d.separatorUn),"seq")})),(0,t.t6)("helm",(async()=>{await f(await m(d.helm),"seq")})),(0,t.t6)("ptFasta2",(async()=>{const n=await Se.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),r=e.DataFrame.fromCsv("seq\nAR"),i=r.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=c.Hi.FASTA,i.setTag(c.gp.alphabet,c.YI.PT),l.G.forColumn(i);const s=await f(r,"seq");(0,t.E3)(fe(s.get(0)),fe(n))}))}));var ge=n(7456);(0,t.L1)("toAtomicLevel-ui",(()=>{let n,r,i,s;(0,t.gM)((async()=>{s=await(0,de.j)(),n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests(),i=n.getMonomerLib()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)}));const o={fasta:{src:{seq:"MDYKETLLMPK",units:c.Hi.FASTA},tgt:{atomCount:94,bondCount:95}},"fasta-with-gap":{src:{seq:"MD-YKETLLMPK",units:c.Hi.FASTA},tgt:{atomCount:94,bondCount:95}},helm:{src:{seq:"PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2}$$$$",units:c.Hi.HELM},tgt:{atomCount:68,bondCount:68}},"helm-with-gap":{src:{seq:"PEPTIDE1{meI.hHis.*.Aca.N.T.dK.Thr_PO3H2}$$$$",units:c.Hi.HELM},tgt:{atomCount:68,bondCount:68}}},l=async t=>{const n=t.src.seq,r=e.DataFrame.fromColumns([e.Column.fromList(e.COLUMN_TYPE.STRING,"seq",[n])]);return await a.data.detectSemanticTypes(r),r.getCol("seq")};for(const[e,n]of Object.entries(o))(0,t.t6)(`${e}-linear`,(async()=>{const e=await l(n);await u(e,!1,n.tgt)}));for(const[e,n]of Object.entries(o))(0,t.t6)(`${e}-nonlinear`,(async()=>{const e=await l(n);await u(e,!0,n.tgt)}));async function u(n,r,o){const a=await(0,ge.V)(n.dataFrame,n,r,!1,i,s);(0,t.E3)(a.molCol.semType,e.SEMTYPE.MOLECULE);const c=a.molCol.get(0),l=s.get_mol(c);(0,t.E3)(null!=l,!0,"No molecule generated");try{const e=l.get_num_atoms(),n=l.get_num_bonds();(0,t.E3)(e,o.atomCount),(0,t.E3)(n,o.bondCount)}finally{l.delete()}}}));var ye=n(6863);async function be(t){const n=e.DataFrame.fromCsv(t),r=n.col("seq"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});return i&&(r.semType=i),await a.data.detectSemanticTypes(n),l.G.forColumn(r)}function we(e,n,r,i){const s=r(e,n);(0,t.E3)(Number(s.toFixed(3)),Number(i.toFixed(3)))}(0,t.L1)("Distance",(async()=>{const n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],r={F:0,W:1,R:2,Y:3},i="FWRWY",s="FWRWW",o="FWY",a="FWRWY",c="FWY",l="FWRRRRY";(0,t.t6)("protein-distance-function",(async()=>{const e=(await be("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.E3)(e,ye.Z.LEVENSHTEIN)})),(0,t.t6)("DNA-distance-function",(async()=>{const e=(await be("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,ye.Z.LEVENSHTEIN)})),(0,t.t6)("MSA-distance-function",(async()=>{const e=(await be("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,ye.Z.HAMMING)})),(0,t.t6)("levenstein-sub",(async()=>{const e=ye.V[ye.Z.LEVENSHTEIN]();we(i,s,e,.2)})),(0,t.t6)("levenstein-del",(async()=>{const e=ye.V[ye.Z.LEVENSHTEIN]();we(o,a,e,.4)})),(0,t.t6)("hamming",(async()=>{const e=ye.V[ye.Z.HAMMING]();we(o,a,e,.6)})),(0,t.t6)("needleman-blosum62",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});we(i,s,e,-6)})),(0,t.t6)("needleman-blosum62-del",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});we(o,a,e,-3.667)})),(0,t.t6)("needleman-custom-sub",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});we(i,s,e,.2)})),(0,t.t6)("needleman-custom-del",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});we(o,a,e,.667)})),(0,t.t6)("needleman-custom-zero-extend",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:0});we(c,l,e,.333)})),(0,t.t6)("needleman-custom-half-extend",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:2,gapExtend:1});we(c,l,e,1.667)})),(0,t.t6)("needleman-custom-same-extend",(async()=>{const t=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?we(Array(1e3).fill(c).join(""),Array(1e3).fill(l).join(""),t,1.333):we(c,l,t,1.333)}),{benchmark:!0})}));var ve=n(684);async function Ae(e,n,r,i,s,o,c,l){await a.data.detectSemanticTypes(e);const u=await(0,p.activityCliffs)(e,e.getCol(r),e.getCol(i),s,n,c,l,{[`${ve.vb}`]:!0});(0,t.E3)(null!=u,!0);const d=Array.from(u.root.children).find((e=>{const t=e.className.split(" ");return["ui-btn","ui-btn-ok"].every((e=>t.includes(e)))}));(0,t.E3)(d.innerText.toLowerCase(),`${o} cliffs`)}var Ce=n(2780),Ee=n(9039);async function Te(n,r,i){const s=n.getCol(i),o=await a.functions.call("Bio:detectMacromolecule",{col:s});o&&(s.semType=o);const c=e.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!c)throw new Error("Preprocessing function not found");const l=await(0,p.sequenceSpaceTopMenu)(n,n.col(i),r,ye.Z.LEVENSHTEIN,!0,c,{[ve.vb]:!0});(0,t.E3)(null!=l,!0)}(0,t.L1)("activityCliffs",(async()=>{let n,r,i;const s=e.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],o=e.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,t.gM)((async()=>{n=await(0,Q.b2)(),r=await(0,S.pj)(),i=await(0,N.ub)(),await r.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("activityCliffsOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv",tgt:{cliffCount:53}}:{fileName:"tests/100_3_clustests.csv",tgt:{cliffCount:3}},n=await M(t.fileName);a.shell.addTableView(n),await Ae(n,Ee.c.UMAP,"sequence","Activity",90,t.tgt.cliffCount,ye.Z.LEVENSHTEIN,s)}),{benchmark:!0}),(0,t.t6)("activityCliffsWithEmptyRows",(async()=>{const e=await M("tests/100_3_clustests_empty_vals.csv");a.shell.addTableView(e),await Ae(e,Ee.c.UMAP,"sequence","Activity",90,3,ye.Z.LEVENSHTEIN,s)})),(0,t.t6)("Helm",(async()=>{const e=await Se.files.readCsv("samples/HELM_50.csv");a.shell.addTableView(e),await Ae(e,Ee.c.UMAP,"HELM","Activity",65,20,Ce.aT.Tanimoto,o)}))})),(0,t.L1)("sequenceSpace",(async()=>{let n,r,i,s;(0,t.t6)("sequenceSpaceOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv"}:{fileName:"tests/100_3_clustests.csv"};n=await M(t.fileName),r=a.shell.addTableView(n),await Te(n,Ee.c.UMAP,"sequence")}),{benchmark:!0}),(0,t.t6)("sequenceSpaceWithEmptyRows",(async()=>{i=await M("tests/100_3_clustests_empty_vals.csv"),s=a.shell.addTableView(i),await Te(i,Ee.c.UMAP,"sequence")}))})),(0,t.L1)("Scoring",(()=>{const n="sequence",r="expected_similarity",i="expected_identity",s=e.DataFrame.fromCsv(`${n},${r},${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`),o=s.getCol(n);o.meta.units=c.Hi.HELM,o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let l,u;(0,t.gM)((async()=>{l=await(0,p.getMonomerLibHelper)(),u=await(0,N.ub)(),await l.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(u),await l.loadMonomerLib(!0)})),(0,t.t6)("Identity",(async()=>{const e=await(0,p.sequenceIdentityScoring)(s,o,a);for(let n=0;n<e.length;n++){const r=e.get(n),o=s.get(i,n);(0,t.Wj)(r,o,.01,`Wrong identity score for sequence at position ${n}`)}})),(0,t.t6)("Identity-shortReference",(async()=>{const e=await(0,p.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva}$$$$");(0,t.E3)(E().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Identity-longReference",(async()=>{const e=await(0,p.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC.I.Tyr_26diMe.P.Asu.meC}$$$$");(0,t.E3)(E().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Similarity",(async()=>{const e=await(0,p.sequenceSimilarityScoring)(s,o,a);for(let n=0;n<e.length;n++){const i=e.get(n),o=s.get(r,n);(0,t.Wj)(i,o,.01,`Wrong similarity score for sequence at position ${n}`)}}))}));const Se=new e.Package;async function _e(n,r,i,s){const o=await(0,t.N$)({category:n,test:r,testContext:i,stressTest:s});return e.DataFrame.fromObjects(o)}async function xe(){await(0,t.Xb)(Se,Se.getModule("package-test.js"))}})(),bio_test=r})();
7
+ deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const r in e)"__proto__"!==r&&((Array.isArray(e[r])?t:n)[r]=e[r]);return[t,n]}(e);a(e,t),c(e,n)}};function a(e,t=e.schema){const{gen:n,data:i,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const c in t){const l=t[c];if(0===l.length)continue;const u=(0,s.propertyInData)(n,i,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of l)(0,s.checkReportMissingProp)(e,t)})):(n.if(r._`${u} && (${(0,s.checkMissingProp)(e,l,a)})`),(0,s.reportMissingProp)(e,a),n.else())}}function c(e,t=e.schema){const{gen:n,data:r,keyword:o,it:a}=e,c=n.name("valid");for(const l in t)(0,i.alwaysValidSchema)(a,t[l])||(n.if((0,s.propertyInData)(n,r,l,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)}),(()=>n.var(c,!0))),e.ok(c))}t.validatePropertyDeps=a,t.validateSchemaDeps=c,t.default=o},4845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,r.validateSchemaDeps)(e)};t.default=i},1239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>r.str`must match "${e.ifClause}" schema`,params:({params:e})=>r._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:s}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=o(s,"then"),c=o(s,"else");if(!a&&!c)return;const l=t.let("valid",!0),u=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}(),e.reset(),a&&c){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,d("then",n),d("else",n))}else a?t.if(u,d("then")):t.if((0,r.not)(u),d("else"));function d(n,i){return()=>{const s=e.subschema({keyword:n},u);t.assign(l,u),e.mergeValidEvaluated(s,l),i?t.assign(i,r._`${n}`):e.setParams({ifClause:n})}}e.pass(l,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,i.alwaysValidSchema)(e,n)}t.default=s},6378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5457),i=n(5354),s=n(494),o=n(3966),a=n(2661),c=n(3025),l=n(9713),u=n(8660),d=n(117),h=n(5333),p=n(7923),m=n(6505),f=n(6163),g=n(5844),y=n(1239),b=n(4426);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,y.default,b.default,l.default,u.default,c.default,d.default,h.default];return e?t.push(i.default,o.default):t.push(r.default,s.default),t.push(a.default),t}},494:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const r=n(9029),i=n(4227),s=n(5765),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,i.alwaysValidSchema)(n,t)||e.ok((0,s.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:s,parentSchema:o,data:a,keyword:c,it:l}=e;!function(e){const{opts:r,errSchemaPath:s}=l,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(r.strictTuples&&!a){const e=`"${c}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${s}"`;(0,i.checkStrictMode)(l,e,r.strictTuples)}}(o),l.opts.unevaluated&&n.length&&!0!==l.items&&(l.items=i.mergeEvaluated.items(s,n.length,l.items));const u=s.name("valid"),d=s.const("len",r._`${a}.length`);n.forEach(((t,n)=>{(0,i.alwaysValidSchema)(l,t)||(s.if(r._`${d} > ${n}`,(()=>e.subschema({keyword:c,schemaProp:n,dataProp:n},u))),e.ok(u))}))}t.validateTuple=a,t.default=o},3966:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(5765),o=n(5457),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:a}=n;r.items=!0,(0,i.alwaysValidSchema)(r,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,s.validateArray)(e)))}};t.default=a},7923:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:i}=e;if((0,r.alwaysValidSchema)(i,n))return void e.fail();const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=i},6163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>r._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&s.discriminator)return;const a=n,c=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block((function(){a.forEach(((n,s)=>{let a;(0,i.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&t.if(r._`${u} && ${c}`).assign(c,!1).assign(l,r._`[${l}, ${s}]`).else(),t.if(u,(()=>{t.assign(c,!0),t.assign(l,s),a&&e.mergeEvaluated(a,r.Name)}))}))})),e.result(c,(()=>e.reset()),(()=>e.error(!0)))}};t.default=s},5333:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o=n(4227),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,r.allSchemaProperties)(n),h=d.filter((e=>(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length||h.length===d.length&&(!l.opts.unevaluated||!0===l.props))return;const p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=t.name("valid");!0===l.props||l.props instanceof i.Name||(l.props=(0,o.evaluatedPropsToName)(t,l.props));const{props:f}=l;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,s.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(n){t.forIn("key",a,(s=>{t.if(i._`${(0,r.usePattern)(e,n)}.test(${s})`,(()=>{const r=h.includes(n);r||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:o.Type.Str},m),l.opts.unevaluated&&!0!==f?t.assign(i._`${f}[${s}]`,!0):r||l.allErrors||t.if((0,i.not)(m),(()=>t.break()))}))}))}!function(){for(const e of d)p&&g(e),l.allErrors?y(e):(t.var(m,!0),y(e),t.if(m))}()}};t.default=a},5354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(494),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,r.validateTuple)(e,"items")};t.default=i},117:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2586),i=n(5765),s=n(4227),o=n(8660),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:c,it:l}=e;"all"===l.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new r.KeywordCxt(l,o.default,"additionalProperties"));const u=(0,i.allSchemaProperties)(n);for(const e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&!0!==l.props&&(l.props=s.mergeEvaluated.props(t,(0,s.toHash)(u),l.props));const d=u.filter((e=>!(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length)return;const h=t.name("valid");for(const n of d)p(n)?m(n):(t.if((0,i.propertyInData)(t,c,n,l.opts.ownProperties)),m(n),l.allErrors||t.else().var(h,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(h);function p(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},h)}}};t.default=a},9713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>r._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e;if((0,i.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",s,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,r.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=s},4426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,r.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=i},5765:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const r=n(9029),i=n(4227),s=n(2023),o=n(4227);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r._`Object.prototype.hasOwnProperty`})}function c(e,t,n){return r._`${a(e)}.call(${t}, ${n})`}function l(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} === undefined`;return i?(0,r.or)(s,(0,r.not)(c(e,t,n))):s}function u(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:i,it:s}=e;n.if(l(n,i,t,s.opts.ownProperties),(()=>{e.setParams({missingProperty:r._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},i,s){return(0,r.or)(...i.map((i=>(0,r.and)(l(e,t,i,n.ownProperties),r._`${s} = ${i}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=c,t.propertyInData=function(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} !== undefined`;return i?r._`${s} && ${c(e,t,n)}`:s},t.noPropertyInData=l,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,i.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:i,schemaPath:o,errorPath:a},it:c},l,u,d){const h=d?r._`${e}, ${t}, ${i}${o}`:t,p=[[s.default.instancePath,(0,r.strConcat)(s.default.instancePath,a)],[s.default.parentData,c.parentData],[s.default.parentDataProperty,c.parentDataProperty],[s.default.rootData,s.default.rootData]];c.opts.dynamicRef&&p.push([s.default.dynamicAnchors,s.default.dynamicAnchors]);const m=r._`${h}, ${n.object(...p)}`;return u!==r.nil?r._`${l}.call(${u}, ${m})`:r._`${l}(${m})`};const d=r._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const i=t.unicodeRegExp?"u":"",{regExp:s}=t.code,a=s(n,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:r._`${"new RegExp"===s.code?d:(0,o.useFunc)(e,s)}(${n}, ${i})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:s,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return c((()=>t.assign(e,!1))),e}return t.var(a,!0),c((()=>t.break())),a;function c(o){const c=t.const("len",r._`${n}.length`);t.forRange("i",0,c,(n=>{e.subschema({keyword:s,dataProp:n,dataPropType:i.Type.Num},a),t.if((0,r.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,i.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),c=t.name("_valid");t.block((()=>n.forEach(((n,i)=>{const o=e.subschema({keyword:s,schemaProp:i,compositeRule:!0},c);t.assign(a,r._`${a} || ${c}`),e.mergeValidEvaluated(o,c)||t.if((0,r.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},3463:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},2128:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3463),i=n(3693),s=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,i.default];t.default=s},3693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const r=n(4551),i=n(5765),s=n(9029),o=n(2023),a=n(3835),c=n(4227),l={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:i}=e,{baseId:o,schemaEnv:c,validateName:l,opts:h,self:p}=i,{root:m}=c;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(c===m)return d(e,l,c,c.$async);const n=t.scopeValue("root",{ref:m});return d(e,s._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new r.default(i.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);d(e,n,t,t.$async)}(f):function(r){const i=t.scopeValue("schema",!0===h.code.source?{ref:r,code:(0,s.stringify)(r)}:{ref:r}),o=t.name("valid"),a=e.subschema({schema:r,dataTypes:[],schemaPath:s.nil,topSchemaRef:i,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function u(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):s._`${n.scopeValue("wrapper",{ref:t})}.validate`}function d(e,t,n,r){const{gen:a,it:l}=e,{allErrors:u,schemaEnv:d,opts:h}=l,p=h.passContext?o.default.this:s.nil;function m(e){const t=s._`${e}.errors`;a.assign(o.default.vErrors,s._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,s._`${o.default.vErrors}.length`)}function f(e){var t;if(!l.opts.unevaluated)return;const r=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(r&&!r.dynamicProps)void 0!==r.props&&(l.props=c.mergeEvaluated.props(a,r.props,l.props));else{const t=a.var("props",s._`${e}.evaluated.props`);l.props=c.mergeEvaluated.props(a,t,l.props,s.Name)}if(!0!==l.items)if(r&&!r.dynamicItems)void 0!==r.items&&(l.items=c.mergeEvaluated.items(a,r.items,l.items));else{const t=a.var("items",s._`${e}.evaluated.items`);l.items=c.mergeEvaluated.items(a,t,l.items,s.Name)}}r?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(s._`await ${(0,i.callValidateCode)(e,t,p)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(s._`!(${e} instanceof ${l.ValidationError})`,(()=>a.throw(e))),m(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,i.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=u,t.callRef=d,t.default=l},6653:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(7652),s=n(3835),o=n(4551),a=n(4227),c={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>r._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=c.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),m=t.const("tag",r._`${n}${(0,r.getProperty)(h)}`);function f(n){const i=t.name("valid"),s=e.subschema({keyword:"oneOf",schemaProp:n},i);return e.mergeEvaluated(s,r.Name),i}t.if(r._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=i(l);let r=!0;for(let t=0;t<d.length;t++){let l=d[t];if((null==l?void 0:l.$ref)&&!(0,a.schemaHasRulesButRef)(l,u.self.RULES)){const e=l.$ref;if(l=s.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),l instanceof s.SchemaEnv&&(l=l.schema),void 0===l)throw new o.default(u.opts.uriResolver,u.baseId,e)}const p=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[h];if("object"!=typeof p)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);r=r&&(n||i(l)),c(p,t)}if(!r)throw new Error(`discriminator: "${h}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(h)}function c(e,t){if(e.const)p(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const n of e.enum)p(n,t)}}function p(e,n){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=n}}();t.if(!1);for(const e in n)t.elseIf(r._`${m} === ${e}`),t.assign(p,f(n[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:m,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:m,tagName:h}))),e.ok(p)}};t.default=c},7652:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(n||(t.DiscrError=n={}))},6105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(5520),a=n(5413),c=n(3265),l=n(7532),u=n(9857),d=[o.default,r.default,i.default,(0,s.default)(!0),l.default,u.metadataVocabulary,u.contentVocabulary,a.default,c.default];t.default=d},6144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(7532),a=n(9857),c=[r.default,i.default,(0,s.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=c},2476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const r=n(9029),i=n(2023),s=n(3835),o=n(3693),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>c(e,e.schema)};function c(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const c=r._`${i.default.dynamicAnchors}${(0,r.getProperty)(t)}`,l="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:r}=e.it,{root:i,baseId:a,localRefs:c,meta:l}=t.root,{schemaId:u}=r.opts,d=new s.SchemaEnv({schema:n,schemaId:u,root:i,baseId:a,localRefs:c,meta:l});return s.compileSchema.call(r,d),(0,o.getValidate)(e,d)}(e);n.if(r._`!${c}`,(()=>n.assign(c,l)))}t.dynamicAnchor=c,t.default=a},3252:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const r=n(9029),i=n(2023),s=n(3693),o={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)};function a(e,t){const{gen:n,keyword:o,it:a}=e;if("#"!==t[0])throw new Error(`"${o}" only supports hash fragment reference`);const c=t.slice(1);if(a.allErrors)l();else{const t=n.let("valid",!1);l(t),e.ok(t)}function l(e){if(a.schemaEnv.root.dynamicAnchors[c]){const t=n.let("_v",r._`${i.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,r){return r?()=>n.block((()=>{(0,s.callRef)(e,t),n.let(r,!0)})):()=>(0,s.callRef)(e,t)}}t.dynamicRef=a,t.default=o},5520:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(3252),s=n(2721),o=n(3799),a=[r.default,i.default,s.default,o.default];t.default=a},2721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(4227),s={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,r.dynamicAnchor)(e,""):(0,i.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=s},3799:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3252),i={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,r.dynamicRef)(e,e.schema)};t.default=i},4737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match format "${e}"`,params:({schemaCode:e})=>r._`{format: ${e}}`},code(e,t){const{gen:n,data:i,$data:s,schema:o,schemaCode:a,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:h}=c;l.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:h.formats,code:l.code.formats}),o=n.const("fDef",r._`${s}[${a}]`),c=n.let("fType"),u=n.let("format");n.if(r._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(c,r._`${o}.type || "string"`).assign(u,r._`${o}.validate`)),(()=>n.assign(c,r._`"string"`).assign(u,o))),e.fail$data((0,r.or)(!1===l.strictSchema?r.nil:r._`${a} && !${u}`,function(){const e=d.$async?r._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:r._`${u}(${i})`,n=r._`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return r._`${u} && ${u} !== true && ${c} === ${t} && !${n}`}()))}():function(){const s=h.formats[o];if(!s)return void function(){if(!1!==l.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}h.logger.warn(e())}();if(!0===s)return;const[a,c,p]=function(e){const t=e instanceof RegExp?(0,r.regexpCode)(e):l.code.formats?r._`${l.code.formats}${(0,r.getProperty)(o)}`:void 0,i=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,r._`${i}.validate`]}(s);a===t&&e.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!d.$async)throw new Error("async format in sync schema");return r._`await ${p}(${i})`}return"function"==typeof c?r._`${p}(${i})`:r._`${p}.test(${i})`}())}())}};t.default=i},7532:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=[n(4737).default];t.default=r},9857:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},5413:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1846),i=n(4845),s=n(2626),o=[r.default,i.default,s.default];t.default=o},3265:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(392),i=n(3445),s=[r.default,i.default];t.default=s},3445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e,a=o.items||0;if(!0===a)return;const c=t.const("len",r._`${s}.length`);if(!1===n)e.setParams({len:a}),e.fail(r._`${c} > ${a}`);else if("object"==typeof n&&!(0,i.alwaysValidSchema)(o,n)){const n=t.var("valid",r._`${c} <= ${a}`);t.if((0,r.not)(n),(()=>function(n,s){t.forRange("i",s,c,(s=>{e.subschema({keyword:"unevaluatedItems",dataProp:s,dataPropType:i.Type.Num},n),o.allErrors||t.if((0,r.not)(n),(()=>t.break()))}))}(n,a))),e.ok(n)}o.items=!0}};t.default=s},392:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(2023),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>r._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:c}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:l,props:u}=c;function d(s){if(!1===n)return e.setParams({unevaluatedProperty:s}),e.error(),void(l||t.break());if(!(0,i.alwaysValidSchema)(c,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:s,dataPropType:i.Type.Str},n),l||t.if((0,r.not)(n),(()=>t.break()))}}u instanceof r.Name?t.if(r._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return r._`!${e} || !${e}[${t}]`}(u,e),(()=>d(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?d(e):t.if(function(e,t){const n=[];for(const i in e)!0===e[i]&&n.push(r._`${t} !== ${i}`);return(0,r.and)(...n)}(u,e),(()=>d(e))))),c.props=!0,e.ok(r._`${a} === ${s.default.errors}`)}};t.default=o},7935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>r._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:c}=e;o||c&&"object"==typeof c?e.fail$data(r._`!${(0,i.useFunc)(t,s.default)}(${n}, ${a})`):e.fail(r._`${c} !== ${n}`)}};t.default=o},1846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:e=>(0,r.validatePropertyDeps)(e)};t.default=i},8643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>r._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:c,it:l}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=l.opts.loopEnum;let d;const h=()=>null!=d?d:d=(0,i.useFunc)(t,s.default);let p;if(u||o)p=t.let("valid"),e.block$data(p,(function(){t.assign(p,!1),t.forOf("v",c,(e=>t.if(r._`${h()}(${n}, ${e})`,(()=>t.assign(p,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",c);p=(0,r.or)(...a.map(((t,i)=>function(e,t){const i=a[t];return"object"==typeof i&&null!==i?r._`${h()}(${n}, ${e}[${t}])`:r._`${n} === ${i}`}(e,i))))}e.pass(p)}};t.default=o},7060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5882),i=n(3439),s=n(7307),o=n(422),a=n(4486),c=n(4003),l=n(1163),u=n(617),d=n(7935),h=n(8643),p=[r.default,i.default,s.default,o.default,a.default,c.default,l.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,h.default];t.default=p},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,r.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=i},1163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxItems"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`${n}.length ${s} ${i}`)}};t.default=i},7307:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(3853),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,c="maxLength"===t?r.operators.GT:r.operators.LT,l=!1===a.opts.unicode?r._`${n}.length`:r._`${(0,i.useFunc)(e.gen,s.default)}(${n})`;e.fail$data(r._`${l} ${c} ${o}`)}};t.default=o},5882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=r.operators,s={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:e,schemaCode:t})=>r.str`must be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${s[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(s),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:n,schemaCode:i}=e;e.fail$data(r._`${n} ${s[t].fail} ${i} || isNaN(${n})`)}};t.default=a},4486:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxProperties"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`Object.keys(${n}).length ${s} ${i}`)}};t.default=i},3439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>r.str`must be multiple of ${e}`,params:({schemaCode:e})=>r._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:i,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),c=o?r._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:r._`${a} !== parseInt(${a})`;e.fail$data(r._`(${i} === 0 || (${a} = ${n}/${i}, ${c}))`)}};t.default=i},422:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match pattern "${e}"`,params:({schemaCode:e})=>i._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:s,schemaCode:o,it:a}=e,c=a.opts.unicodeRegExp?"u":"",l=n?i._`(new RegExp(${o}, ${c}))`:(0,r.usePattern)(e,s);e.fail$data(i._`!${l}.test(${t})`)}};t.default=s},4003:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:c,it:l}=e,{opts:u}=l;if(!c&&0===n.length)return;const d=n.length>=u.loopRequired;if(l.allErrors?function(){if(d||c)e.block$data(i.nil,h);else for(const t of n)(0,r.checkReportMissingProp)(e,t)}():function(){const s=t.let("missing");if(d||c){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,s){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(s,(0,r.propertyInData)(t,a,n,u.ownProperties)),t.if((0,i.not)(s),(()=>{e.error(),t.break()}))}),i.nil)}(s,n))),e.ok(n)}else t.if((0,r.checkMissingProp)(e,n,s)),(0,r.reportMissingProp)(e,s),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:r}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!r.has(e)){const t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,s.checkStrictMode)(l,t,l.opts.strictRequired)}}function h(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,r.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(208),i=n(9029),s=n(4227),o=n(6250),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!a&&!c)return;const h=t.let("valid"),p=l.items?(0,r.getSchemaTypes)(l.items):[];function m(s,o){const a=t.name("item"),c=(0,r.checkDataTypes)(p,a,d.opts.strictNumbers,r.DataType.Wrong),l=t.const("indices",i._`{}`);t.for(i._`;${s}--;`,(()=>{t.let(a,i._`${n}[${s}]`),t.if(c,i._`continue`),p.length>1&&t.if(i._`typeof ${a} == "string"`,i._`${a} += "_"`),t.if(i._`typeof ${l}[${a}] == "number"`,(()=>{t.assign(o,i._`${l}[${a}]`),e.error(),t.assign(h,!1).break()})).code(i._`${l}[${a}] = ${s}`)}))}function f(r,a){const c=(0,s.useFunc)(t,o.default),l=t.name("outer");t.label(l).for(i._`;${r}--;`,(()=>t.for(i._`${a} = ${r}; ${a}--;`,(()=>t.if(i._`${c}(${n}[${r}], ${n}[${a}])`,(()=>{e.error(),t.assign(h,!1).break(l)}))))))}e.block$data(h,(function(){const r=t.let("i",i._`${n}.length`),s=t.let("j");e.setParams({i:r,j:s}),t.assign(h,!0),t.if(i._`${r} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(r,s)))}),i._`${u} === false`),e.ok(h)}};t.default=a},5488:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,"\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}","",{version:3,sources:["webpack://./css/cell-renderer.css"],names:[],mappings:";AACA;IACI,8CAA8C;AAClD;;AAEA;IACI,eAAe;AACnB",sourcesContent:["\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}"],sourceRoot:""}]);const a=o},5999:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.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=o},857:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}\n\n.monomer-manager-form-tab-control input.d4-invalid {\n background: #ff000030;\n}","",{version:3,sources:["webpack://./css/monomer-manager.css"],names:[],mappings:"AAAA;IACI,2BAA2B;AAC/B;;AAEA;IACI,sBAAsB;IACtB,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;AAC3B;;AAEA;IACI,0BAA0B;AAC9B;AACA;IACI,0BAA0B;AAC9B;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,WAAW;IACX,gBAAgB;IAChB,uBAAuB;IACvB,mBAAmB;AACvB;;AAEA;IACI,mBAAmB;IACnB,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;AACrB;;AAEA;IACI,8BAA8B;AAClC;;AAEA;IACI,+BAA+B;IAC/B,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,iBAAiB;AACrB;;AAEA;IACI,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;AACpB;;AAEA;IACI,qBAAqB;AACzB",sourcesContent:[".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}\n\n.monomer-manager-form-tab-control input.d4-invalid {\n background: #ff000030;\n}"],sourceRoot:""}]);const a=o},6369:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.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=o},7939:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.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}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 700px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\n}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\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;;AAEhB;;AAEA;IACI,WAAW;AACf;AACA;IACI,gBAAgB;AACpB;;AAEA;IACI,wBAAwB;AAC5B;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,4BAA4B;AAChC;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,8BAA8B;IAC9B,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;IACvB,gBAAgB;AACpB;;AAEA;IACI,4BAA4B;AAChC;;AAEA;IACI,kBAAkB;AACtB",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}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 700px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\n}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\n}"],sourceRoot:""}]);const a=o},3017:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n","",{version:3,sources:["webpack://./src/utils/monomer-lib/library-file-manager/style.css"],names:[],mappings:"AAAA;EACE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;AACb",sourcesContent:[".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n"],sourceRoot:""}]);const a=o},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(o[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&o[u[0]]||(void 0!==s&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},1354:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),s="/*# ".concat(i," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},2017:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;0!=i--;){var o=s[i];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9982:function(e,t,n){var r;!function(){var t={};!function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(e,n,r,i,s){for(var o,a,c,l,u,d,h,p,m,f,g,y,b;s>=64;){for(o=n[0],a=n[1],c=n[2],l=n[3],u=n[4],d=n[5],h=n[6],p=n[7],f=0;f<16;f++)g=i+4*f,e[f]=(255&r[g])<<24|(255&r[g+1])<<16|(255&r[g+2])<<8|255&r[g+3];for(f=16;f<64;f++)y=((m=e[f-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,b=((m=e[f-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,e[f]=(y+e[f-7]|0)+(b+e[f-16]|0);for(f=0;f<64;f++)y=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&d^~u&h)|0)+(p+(t[f]+e[f]|0)|0)|0,b=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&c^a&c)|0,p=h,h=d,d=u,u=l+y|0,l=c,c=a,a=o,o=y+b|0;n[0]+=o,n[1]+=a,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=d,n[6]+=h,n[7]+=p,i+=64,s-=64}return i}var r=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.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 t.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},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=n(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,i=t/536870912|0,s=t<<3,o=t%64<56?64:128;this.buffer[r]=128;for(var a=r+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=i>>>24&255,this.buffer[o-7]=i>>>16&255,this.buffer[o-6]=i>>>8&255,this.buffer[o-5]=i>>>0&255,this.buffer[o-4]=s>>>24&255,this.buffer[o-3]=s>>>16&255,this.buffer[o-2]=s>>>8&255,this.buffer[o-1]=s>>>0&255,n(this.temp,this.state,this.buffer,0,o),this.finished=!0}for(a=0;a<8;a++)e[4*a+0]=this.state[a]>>>24&255,e[4*a+1]=this.state[a]>>>16&255,e[4*a+2]=this.state[a]>>>8&255,e[4*a+3]=this.state[a]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var n=0;n<this.state.length;n++)this.state[n]=e[n];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=r;var i=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new r).update(e).finish(t).clean();else for(var n=0;n<e.length;n++)t[n]=e[n];for(n=0;n<t.length;n++)t[n]^=54;for(this.inner.update(t),n=0;n<t.length;n++)t[n]^=106;for(this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<t.length;n++)t[n]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();function s(e){var t=(new r).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new i(e).update(t),r=n.digest();return n.clean(),r}function a(e,t,n,r){var i=r[0];if(0===i)throw new Error("hkdf: cannot expand more");t.reset(),i>1&&t.update(e),n&&t.update(n),t.update(r),t.finish(e),r[0]++}e.HMAC=i,e.hash=s,e.default=s,e.hmac=o;var c=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,r){void 0===t&&(t=c),void 0===r&&(r=32);for(var s=new Uint8Array([1]),l=o(t,e),u=new i(l),d=new Uint8Array(u.digestLength),h=d.length,p=new Uint8Array(r),m=0;m<r;m++)h===d.length&&(a(d,u,n,s),h=0),p[m]=d[h++];return u.clean(),d.fill(0),s.fill(0),p},e.pbkdf2=function(e,t,n,r){for(var s=new i(e),o=s.digestLength,a=new Uint8Array(4),c=new Uint8Array(o),l=new Uint8Array(o),u=new Uint8Array(r),d=0;d*o<r;d++){var h=d+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,s.reset(),s.update(t),s.update(a),s.finish(l);for(var p=0;p<o;p++)c[p]=l[p];for(p=2;p<=n;p++){s.reset(),s.update(l).finish(l);for(var m=0;m<o;m++)c[m]^=l[m]}for(p=0;p<o&&d*o+p<r;p++)u[d*o+p]=c[p]}for(d=0;d<o;d++)c[d]=l[d]=0;for(d=0;d<4;d++)a[d]=0;return s.clean(),u}}(t);var i=t.default;for(var s in t)i[s]=t[s];"object"==typeof e.exports?e.exports=i:void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r)}()},2787:(e,t,n)=>{"use strict";n.d(t,{I:()=>i});const r=new Uint32Array(65536),i=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return 0===t.length?e.length:e.length<=32?((e,t)=>{const n=e.length,i=t.length,s=1<<n-1;let o=-1,a=0,c=n,l=n;for(;l--;)r[e.charCodeAt(l)]|=1<<l;for(l=0;l<i;l++){let e=r[t.charCodeAt(l)];const n=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&s&&c++,o&s&&c--,a=a<<1|1,o=o<<1|~(n|a),a&=n}for(l=n;l--;)r[e.charCodeAt(l)]=0;return c})(e,t):((e,t)=>{const n=t.length,i=e.length,s=[],o=[],a=Math.ceil(n/32),c=Math.ceil(i/32);for(let e=0;e<a;e++)o[e]=-1,s[e]=0;let l=0;for(;l<c-1;l++){let a=0,c=-1;const u=32*l,d=Math.min(32,i)+u;for(let t=u;t<d;t++)r[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],i=o[e/32|0]>>>e&1,l=s[e/32|0]>>>e&1,u=n|a,d=((n|l)&c)+c^c|n|l;let h=a|~(d|c),p=c&d;h>>>31^i&&(o[e/32|0]^=1<<e),p>>>31^l&&(s[e/32|0]^=1<<e),h=h<<1|i,p=p<<1|l,c=p|~(u|h),a=h&u}for(let t=u;t<d;t++)r[e.charCodeAt(t)]=0}let u=0,d=-1;const h=32*l,p=Math.min(32,i-h)+h;for(let t=h;t<p;t++)r[e.charCodeAt(t)]|=1<<t;let m=i;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,c=s[e/32|0]>>>e&1,l=n|u,h=((n|c)&d)+d^d|n|c;let p=u|~(h|d),f=d&h;m+=p>>>i-1&1,m-=f>>>i-1&1,p>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^c&&(s[e/32|0]^=1<<e),p=p<<1|a,f=f<<1|c,d=f|~(l|p),u=p&l}for(let t=h;t<p;t++)r[e.charCodeAt(t)]=0;return m})(e,t)}},9937:e=>{e.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(e,t)=>{t.assign=function(e){e=e||{};var t,n,r,i=Array.prototype.slice.call(arguments).slice(1);for(t=0,r=i.length;t<r;t++)if(i[t])for(n in i[t])e[n]=i[t][n];return e},t.validateSettings=function(e){return"linLogMode"in e&&"boolean"!=typeof e.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in e&&"boolean"!=typeof e.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in e&&"boolean"!=typeof e.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in e&&"number"!=typeof e.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in e)||"number"==typeof e.scalingRatio&&e.scalingRatio>=0?"strongGravityMode"in e&&"boolean"!=typeof e.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in e)||"number"==typeof e.gravity&&e.gravity>=0?"slowDown"in e&&!("number"==typeof e.slowDown||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in e&&"boolean"!=typeof e.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in e)||"number"==typeof e.barnesHutTheta&&e.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},t.graphToByteArrays=function(e,t){var n,r=e.order,i=e.size,s={},o=new Float32Array(10*r),a=new Float32Array(3*i);return n=0,e.forEachNode((function(e,t){s[e]=n,o[n]=t.x,o[n+1]=t.y,o[n+2]=0,o[n+3]=0,o[n+4]=0,o[n+5]=0,o[n+6]=1,o[n+7]=1,o[n+8]=t.size||1,o[n+9]=t.fixed?1:0,n+=10})),n=0,e.forEachEdge((function(e,r,i,c,l,u,d){var h=s[i],p=s[c],m=t(e,r,i,c,l,u,d);o[h+6]+=m,o[p+6]+=m,a[n]=h,a[n+1]=p,a[n+2]=m,n+=3})),{nodes:o,edges:a}},t.assignLayoutChanges=function(e,t,n){var r=0;e.updateEachNodeAttributes((function(e,i){return i.x=t[r],i.y=t[r+1],r+=10,n?n(e,i):i}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,r){t[n]=r.x,t[n+1]=r.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var r=e.nodes(),i={},s=0,o=0,a=t.length;s<a;s+=10){if(n){var c=Object.assign({},e.getNodeAttributes(r[o]));c.x=t[s],c.y=t[s+1],c=n(r[o],c),i[r[o]]={x:c.x,y:c.y}}else i[r[o]]={x:t[s],y:t[s+1]};o++}return i},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),i=new Worker(r);return t.revokeObjectURL(r),i}},8903:(e,t,n)=>{var r=n(1736),i=n(8153).Fd,s=n(2561),o=n(1782),a=n(9937);function c(e,t,n){if(!r(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var c=n.iterations;if("number"!=typeof c)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(c<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var l=i("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,d=o.assign({},a,n.settings),h=o.validateSettings(d);if(h)throw new Error("graphology-layout-forceatlas2: "+h.message);var p,m=o.graphToByteArrays(t,l);for(p=0;p<c;p++)s(d,m.nodes,m.edges);if(!e)return o.collectLayoutChanges(t,m.nodes);o.assignLayoutChanges(t,m.nodes,u)}var l=c.bind(null,!1);l.assign=c.bind(null,!0),l.inferSettings=function(e){var t="number"==typeof e?e:e.order;return{barnesHutOptimize:t>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(t)}},e.exports=l},2561:e=>{var t=10;e.exports=function(e,n,r){var i,s,o,a,c,l,u,d,h,p,m,f,g,y,b,w,v,A,C,E,T,S,_,x=n.length,M=r.length,P=e.adjustSizes,L=e.barnesHutTheta*e.barnesHutTheta,N=[];for(o=0;o<x;o+=t)n[o+4]=n[o+2],n[o+5]=n[o+3],n[o+2]=0,n[o+3]=0;if(e.outboundAttractionDistribution){for(m=0,o=0;o<x;o+=t)m+=n[o+6];m/=x/t}if(e.barnesHutOptimize){var $,I,R,O=1/0,k=-1/0,D=1/0,G=-1/0;for(o=0;o<x;o+=t)O=Math.min(O,n[o+0]),k=Math.max(k,n[o+0]),D=Math.min(D,n[o+1]),G=Math.max(G,n[o+1]);var H=k-O,F=G-D;for(H>F?G=(D-=(H-F)/2)+H:k=(O-=(F-H)/2)+F,N[0]=-1,N[1]=(O+k)/2,N[2]=(D+G)/2,N[3]=Math.max(k-O,G-D),N[4]=-1,N[5]=-1,N[6]=0,N[7]=0,N[8]=0,i=1,o=0;o<x;o+=t)for(s=0,R=3;;){if(!(N[s+5]>=0)){if(N[s+0]<0){N[s+0]=o;break}if(N[s+5]=9*i,d=N[s+3]/2,N[(h=N[s+5])+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=N[s+4],N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,i+=4,$=n[N[s+0]+0]<N[s+1]?n[N[s+0]+1]<N[s+2]?N[s+5]:N[s+5]+9:n[N[s+0]+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+6]=n[N[s+0]+6],N[s+7]=n[N[s+0]+0],N[s+8]=n[N[s+0]+1],N[$+0]=N[s+0],N[s+0]=-1,$===(I=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27)){if(R--){s=$;continue}R=3;break}N[I+0]=o;break}$=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+7]=(N[s+7]*N[s+6]+n[o+0]*n[o+6])/(N[s+6]+n[o+6]),N[s+8]=(N[s+8]*N[s+6]+n[o+1]*n[o+6])/(N[s+6]+n[o+6]),N[s+6]+=n[o+6],s=$}}if(e.barnesHutOptimize){for(f=e.scalingRatio,o=0;o<x;o+=t)for(s=0;;)if(N[s+5]>=0){if(w=Math.pow(n[o+0]-N[s+7],2)+Math.pow(n[o+1]-N[s+8],2),4*(p=N[s+3])*p/w<L){if(g=n[o+0]-N[s+7],y=n[o+1]-N[s+8],!0===P?w>0?(v=f*n[o+6]*N[s+6]/w,n[o+2]+=g*v,n[o+3]+=y*v):w<0&&(v=-f*n[o+6]*N[s+6]/Math.sqrt(w),n[o+2]+=g*v,n[o+3]+=y*v):w>0&&(v=f*n[o+6]*N[s+6]/w,n[o+2]+=g*v,n[o+3]+=y*v),(s=N[s+4])<0)break;continue}s=N[s+5]}else if((l=N[s+0])>=0&&l!==o&&(w=(g=n[o+0]-n[l+0])*g+(y=n[o+1]-n[l+1])*y,!0===P?w>0?(v=f*n[o+6]*n[l+6]/w,n[o+2]+=g*v,n[o+3]+=y*v):w<0&&(v=-f*n[o+6]*n[l+6]/Math.sqrt(w),n[o+2]+=g*v,n[o+3]+=y*v):w>0&&(v=f*n[o+6]*n[l+6]/w,n[o+2]+=g*v,n[o+3]+=y*v)),(s=N[s+4])<0)break}else for(f=e.scalingRatio,a=0;a<x;a+=t)for(c=0;c<a;c+=t)g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===P?(w=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8])>0?(v=f*n[a+6]*n[c+6]/w/w,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):w<0&&(v=100*f*n[a+6]*n[c+6],n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):(w=Math.sqrt(g*g+y*y))>0&&(v=f*n[a+6]*n[c+6]/w/w,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);for(h=e.gravity/e.scalingRatio,f=e.scalingRatio,o=0;o<x;o+=t)v=0,g=n[o+0],y=n[o+1],w=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.strongGravityMode?w>0&&(v=f*n[o+6]*h):w>0&&(v=f*n[o+6]*h/w),n[o+2]-=g*v,n[o+3]-=y*v;for(f=1*(e.outboundAttractionDistribution?m:1),u=0;u<M;u+=3)a=r[u+0],c=r[u+1],d=r[u+2],b=Math.pow(d,e.edgeWeightInfluence),g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===P?(w=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8],e.linLogMode?e.outboundAttractionDistribution?w>0&&(v=-f*b*Math.log(1+w)/w/n[a+6]):w>0&&(v=-f*b*Math.log(1+w)/w):e.outboundAttractionDistribution?w>0&&(v=-f*b/n[a+6]):w>0&&(v=-f*b)):(w=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.linLogMode?e.outboundAttractionDistribution?w>0&&(v=-f*b*Math.log(1+w)/w/n[a+6]):w>0&&(v=-f*b*Math.log(1+w)/w):e.outboundAttractionDistribution?(w=1,v=-f*b/n[a+6]):(w=1,v=-f*b)),w>0&&(n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);if(!0===P)for(o=0;o<x;o+=t)1!==n[o+9]&&((A=Math.sqrt(Math.pow(n[o+2],2)+Math.pow(n[o+3],2)))>10&&(n[o+2]=10*n[o+2]/A,n[o+3]=10*n[o+3]/A),C=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),E=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=.1*Math.log(1+E)/(1+Math.sqrt(C)),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);else for(o=0;o<x;o+=t)1!==n[o+9]&&(C=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),E=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=n[o+7]*Math.log(1+E)/(1+Math.sqrt(C)),n[o+7]=Math.min(1,Math.sqrt(T*(Math.pow(n[o+2],2)+Math.pow(n[o+3],2))/(1+Math.sqrt(C)))),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);return{}}},8153:(e,t)=>{function n(e){return"number"!=typeof e||isNaN(e)?1:e}t.Fd=function(e){return function(e,t){var n={},r=function(e){return void 0===e?t:e};"function"==typeof t&&(r=t);var i=function(t){return r(t[e])},s=function(){return r(void 0)};return"string"==typeof e?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return i(t)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof e?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(t,n){var i=t.extremities(n);return r(e(n,t.getEdgeAttributes(n),i[0],i[1],t.getNodeAttributes(i[0]),t.getNodeAttributes(i[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,i,s,o,a,c){return r(e(t,n,i,s,o,a,c))},n.fromPartialEntry=function(t,n,i,s){return r(e(t,n,i,s))},n.fromMinimalEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=s,n.fromGraph=s,n.fromEntry=s,n.fromMinimalEntry=s),n}(e,n)}},1736:e=>{e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},934:function(e){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function i(e,t,n){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var s=new(Function.bind.apply(e,i));return n&&r(s,n.prototype),s},i.apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||(s=e,-1===Function.toString.call(s).indexOf("[native code]")))return e;var s;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,e)},s(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var a=function(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++)if(arguments[t])for(var r in arguments[t])e[r]=arguments[t][r];return e};function c(e,t,n,r){var i=e._nodes.get(t),s=null;return i?s="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n]:s}function l(t){return"object"===e(t)&&null!==t}function u(e){var t;for(t in e)return!1;return!0}function d(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function h(e,t,n){var r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function p(e){return!(!l(e)||e.attributes&&!Array.isArray(e.attributes))}"function"==typeof Object.assign&&(a=Object.assign);var m,f={exports:{}},g="object"==typeof Reflect?Reflect:null,y=g&&"function"==typeof g.apply?g.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};m=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var b=Number.isNaN||function(e){return e!=e};function w(){w.init.call(this)}f.exports=w,f.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,s),r(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}P(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&P(e,"error",t,{once:!0})}(e,i)}))},w.EventEmitter=w,w.prototype._events=void 0,w.prototype._eventsCount=0,w.prototype._maxListeners=void 0;var v=10;function A(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function C(e){return void 0===e._maxListeners?w.defaultMaxListeners:e._maxListeners}function E(e,t,n,r){var i,s,o,a;if(A(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=C(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function T(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=T.bind(r);return i.listener=n,r.wrapFn=i,i}function _(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):M(i,i.length)}function x(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function M(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function P(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){r.once&&e.removeEventListener(t,i),n(s)}))}}function L(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(w,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");v=e}}),w.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},w.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},w.prototype.getMaxListeners=function(){return C(this)},w.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)y(a,this,t);else{var c=a.length,l=M(a,c);for(n=0;n<c;++n)y(l[n],this,t)}return!0},w.prototype.addListener=function(e,t){return E(this,e,t,!1)},w.prototype.on=w.prototype.addListener,w.prototype.prependListener=function(e,t){return E(this,e,t,!0)},w.prototype.once=function(e,t){return A(t),this.on(e,S(this,e,t)),this},w.prototype.prependOnceListener=function(e,t){return A(t),this.prependListener(e,S(this,e,t)),this},w.prototype.removeListener=function(e,t){var n,r,i,s,o;if(A(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},w.prototype.off=w.prototype.removeListener,w.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},w.prototype.listeners=function(e){return _(this,e,!0)},w.prototype.rawListeners=function(e){return _(this,e,!1)},w.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):x.call(e,t)},w.prototype.listenerCount=x,w.prototype.eventNames=function(){return this._eventsCount>0?m(this._events):[]},"undefined"!=typeof Symbol&&(L.prototype[Symbol.iterator]=function(){return this}),L.of=function(){var e=arguments,t=e.length,n=0;return new L((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},L.empty=function(){return new L((function(){return{done:!0}}))},L.fromSequence=function(e){var t=0,n=e.length;return new L((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},L.is=function(e){return e instanceof L||"object"==typeof e&&null!==e&&"function"==typeof e.next};var N=L,$={};$.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,$.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var I=N,R=$,O=R.ARRAY_BUFFER_SUPPORT,k=R.SYMBOL_SUPPORT,D=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||O&&ArrayBuffer.isView(e)?I.fromSequence(e):"object"!=typeof e||null===e?null:k&&"function"==typeof e[Symbol.iterator]?e[Symbol.iterator]():"function"==typeof e.next?e:null}(e);if(!t)throw new Error("obliterator: target is not iterable nor a valid iterator.");return t},G=D,H=function(e,t){for(var n,r=arguments.length>1?t:1/0,i=r!==1/0?new Array(r):[],s=0,o=G(e);;){if(s===r)return i;if((n=o.next()).done)return s!==t&&(i.length=s),i;i[s++]=n.value}},F=function(e){function n(t){var n;return(n=e.call(this)||this).name="GraphError",n.message=t,n}return t(n,e),n}(s(Error)),U=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),V=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),B=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F);function Y(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function j(e,t){this.key=e,this.attributes=t,this.clear()}function K(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}function z(e,t,n,r,i,s,o){var a,c,l,u;if(r=""+r,0===n){if(!(a=e._nodes.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" node in the graph.'));l=i,u=s}else if(3===n){if(i=""+i,!(c=e._edges.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));var d=c.source.key,h=c.target.key;if(r===d)a=c.target;else{if(r!==h)throw new V("Graph.".concat(t,': the "').concat(r,'" node is not attached to the "').concat(i,'" edge (').concat(d,", ").concat(h,")."));a=c.source}l=s,u=o}else{if(!(c=e._edges.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));a=1===n?c.source:c.target,l=i,u=s}return[a,l,u]}Y.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},W.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},j.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},K.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,r=this.target.key;this.source[e][r]=this,this.undirected&&n===r||(this.target[t][n]=this)},K.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,r=this.target.key;this.undirected&&(e=t="undirected");var i=this.source[e],s=i[r];if(void 0===s)return i[r]=this,void(this.undirected&&n===r||(this.target[t][n]=this));s.previous=this,this.next=s,i[r]=this,this.target[t][n]=this},K.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][t],delete this.target[r][e]},K.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var q=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes[a]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){return z(this,t,n,e,r)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes.hasOwnProperty(a)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=z(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];return a.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=z(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];if("function"!=typeof l)throw new U("Graph.".concat(t,": updater should be a function."));var u=a.attributes,d=l(u[c]);return u[c]=d,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];if(!l(a))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],c=s[1];if(!l(c))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(o.attributes,c),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:c}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=z(this,t,n,e,r,i),o=s[0],a=s[1];if("function"!=typeof a)throw new U("Graph.".concat(t,": provided updater is not a function."));return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}],Z=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes[r]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+e,s=""+arguments[1];if(!(r=c(this,i,s,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(i,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes.hasOwnProperty(r)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return s.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof i)throw new U("Graph.".concat(t,": updater should be a function."));return s.attributes[r]=i(s.attributes[r]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof r)throw new U("Graph.".concat(t,": provided updater is not a function."));return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}],X=N,J=D,Q=function(){var e=arguments,t=null,n=-1;return new X((function(){for(var r=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=J(e[n])}if(!0!==(r=t.next()).done)break;t=null}return r}))},ee=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function te(e,t,n,r){var i=!1;for(var s in t)if(s!==r){var o=t[s];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function ne(e,t,n,r){var i,s,o,a=!1;for(var c in t)if(c!==r){i=t[c];do{if(s=i.source,o=i.target,a=n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),e&&a)return i.key;i=i.next}while(void 0!==i)}}function re(e,t){var n,r=Object.keys(e),i=r.length,s=0;return new N((function(){do{if(n)n=n.next;else{if(s>=i)return{done:!0};var o=r[s++];if(o===t){n=void 0;continue}n=e[o]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function ie(e,t,n,r){var i=t[n];if(i){var s=i.source,o=i.target;return r(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&e?i.key:void 0}}function se(e,t,n,r){var i=t[n];if(i){var s=!1;do{if(s=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&s)return i.key;i=i.next}while(void 0!==i)}}function oe(e,t){var n=e[t];return void 0!==n.next?new N((function(){if(!n)return{done:!0};var e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}})):N.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function ae(e,t,n,r){if(0!==t.size)for(var i,s,o="mixed"!==n&&n!==t.type,a="undirected"===n,c=!1,l=t._edges.values();!0!==(i=l.next()).done;)if(s=i.value,!o||s.undirected===a){var u=s,d=u.key,h=u.attributes,p=u.source,m=u.target;if(c=r(d,h,p.key,m.key,p.attributes,m.attributes,s.undirected),e&&c)return d}}function ce(e,t,n,r,i,s){var o,a=t?ne:te;if("undirected"!==n){if("out"!==r&&(o=a(e,i.in,s),e&&o))return o;if("in"!==r&&(o=a(e,i.out,s,r?void 0:i.key),e&&o))return o}if("directed"!==n&&(o=a(e,i.undirected,s),e&&o))return o}function le(e,t,n,r,i,s,o){var a,c=n?se:ie;if("undirected"!==t){if(void 0!==i.in&&"out"!==r&&(a=c(e,i.in,s,o),e&&a))return a;if(void 0!==i.out&&"in"!==r&&(r||i.key!==s)&&(a=c(e,i.out,s,o),e&&a))return a}if("directed"!==t&&void 0!==i.undirected&&(a=c(e,i.undirected,s,o),e&&a))return a}var ue=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function de(){this.A=null,this.B=null}function he(e,t,n,r,i){for(var s in r){var o=r[s],a=o.source,c=o.target,l=a===n?c:a;if(!t||!t.has(l.key)){var u=i(l.key,l.attributes);if(e&&u)return l.key}}}function pe(e,t,n,r,i){if("mixed"!==t){if("undirected"===t)return he(e,null,r,r.undirected,i);if("string"==typeof n)return he(e,null,r,r[n],i)}var s,o=new de;if("undirected"!==t){if("out"!==n){if(s=he(e,null,r,r.in,i),e&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=he(e,o,r,r.out,i),e&&s)return s;o.wrap(r.out)}}if("directed"!==t&&(s=he(e,o,r,r.undirected,i),e&&s))return s}function me(e,t,n){var r=Object.keys(n),i=r.length,s=0;return new N((function(){var o=null;do{if(s>=i)return e&&e.wrap(n),{done:!0};var a=n[r[s++]],c=a.source,l=a.target;o=c===t?l:c,e&&e.has(o.key)&&(o=null)}while(null===o);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}))}function fe(e,t,n,r,i){for(var s,o,a,c,l,u,d,h=r._nodes.values(),p=r.type;!0!==(s=h.next()).done;){var m=!1;if(o=s.value,"undirected"!==p)for(a in c=o.out){l=c[a];do{if(u=l.target,m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if("directed"!==p)for(a in c=o.undirected)if(!(t&&o.key>a)){l=c[a];do{if((u=l.target).key!==a&&(u=l.source),m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if(n&&!m&&(d=i(o.key,null,o.attributes,null,null,null,null),e&&d))return null}}function ge(e){if(!l(e))throw new U('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new U("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ye(e){if(!l(e))throw new U('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new U("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new U("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new U("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}de.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},de.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var be,we=(be=255&Math.floor(256*Math.random()),function(){return be++}),ve=new Set(["directed","undirected","mixed"]),Ae=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ce={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ee(e,t,n){var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function Te(e,t,n,r,i,s,o,a){if(!r&&"undirected"===e.type)throw new B("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new B("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!l(a))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(a,'"'));if(s=""+s,o=""+o,a=a||{},!e.allowSelfLoops&&s===o)throw new B("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var c=e._nodes.get(s),u=e._nodes.get(o);if(!c)throw new V("Graph.".concat(t,': source node "').concat(s,'" not found.'));if(!u)throw new V("Graph.".concat(t,': target node "').concat(o,'" not found.'));var d={key:null,undirected:r,source:s,target:o,attributes:a};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new B("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));if(!e.multi&&(r?void 0!==c.undirected[o]:void 0!==c.out[o]))throw new B("Graph.".concat(t,': an edge linking "').concat(s,'" to "').concat(o,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var h=new K(r,i,c,u,a);e._edges.set(i,h);var p=s===o;return r?(c.undirectedDegree++,u.undirectedDegree++,p&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,u.inDegree++,p&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,d.key=i,e.emit("edgeAdded",d),i}function Se(e,t,n,r,i,s,o,c,u){if(!r&&"undirected"===e.type)throw new B("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new B("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(c)if(u){if("function"!=typeof c)throw new U("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(c,'"'))}else if(!l(c))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(c,'"'));var d;if(s=""+s,o=""+o,u&&(d=c,c=void 0),!e.allowSelfLoops&&s===o)throw new B("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h,p,m=e._nodes.get(s),f=e._nodes.get(o);if(!n&&(h=e._edges.get(i))){if(!(h.source.key===s&&h.target.key===o||r&&h.source.key===o&&h.target.key===s))throw new B("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(i,'" edge with "').concat(s,'" source & "').concat(o,'" target vs. ("').concat(h.source.key,'", "').concat(h.target.key,'").'));p=h}if(p||e.multi||!m||(p=r?m.undirected[o]:m.out[o]),p){var g=[p.key,!1,!1,!1];if(u?!d:!c)return g;if(u){var y=p.attributes;p.attributes=d(y),e.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else a(p.attributes,c),e.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:c});return g}c=c||{},u&&d&&(c=d(c));var b={key:null,undirected:r,source:s,target:o,attributes:c};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new B("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));var w=!1,v=!1;m||(m=Ee(e,s,{}),w=!0,s===o&&(f=m,v=!0)),f||(f=Ee(e,o,{}),v=!0),h=new K(r,i,m,f,c),e._edges.set(i,h);var A=s===o;return r?(m.undirectedDegree++,f.undirectedDegree++,A&&(m.undirectedLoops++,e._undirectedSelfLoopCount++)):(m.outDegree++,f.inDegree++,A&&(m.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,b.key=i,e.emit("edgeAdded",b),[i,!0,w,v]}function _e(e,t){e._edges.delete(t.key);var n=t.source,r=t.target,i=t.attributes,s=t.undirected,o=n===r;s?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),s?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:i,source:n.key,target:r.key,undirected:s})}var xe=function(n){function r(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=a({},Ce,e)).multi)throw new U("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!ve.has(e.type))throw new U('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(e.type,'".'));if("boolean"!=typeof e.allowSelfLoops)throw new U("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var r="mixed"===e.type?Y:"directed"===e.type?W:j;d(o(t),"NodeDataClass",r);var i="geid_"+we()+"_",s=0;return d(o(t),"_attributes",{}),d(o(t),"_nodes",new Map),d(o(t),"_edges",new Map),d(o(t),"_directedSize",0),d(o(t),"_undirectedSize",0),d(o(t),"_directedSelfLoopCount",0),d(o(t),"_undirectedSelfLoopCount",0),d(o(t),"_edgeKeyGenerator",(function(){var e;do{e=i+s++}while(t._edges.has(e));return e})),d(o(t),"_options",e),Ae.forEach((function(e){return d(o(t),e,t[e])})),h(o(t),"order",(function(){return t._nodes.size})),h(o(t),"size",(function(){return t._edges.size})),h(o(t),"directedSize",(function(){return t._directedSize})),h(o(t),"undirectedSize",(function(){return t._undirectedSize})),h(o(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),h(o(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),h(o(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),h(o(t),"multi",t._options.multi),h(o(t),"type",t._options.type),h(o(t),"allowSelfLoops",t._options.allowSelfLoops),h(o(t),"implementation",(function(){return"graphology"})),t}t(r,n);var i=r.prototype;return i._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},i.hasNode=function(e){return this._nodes.has(""+e)},i.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.out.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.undirected.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasEdge=function(e,t){if(1===arguments.length){var n=""+e;return this._edges.has(n)}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&(void 0!==r.out&&r.out.hasOwnProperty(t)||void 0!==r.undirected&&r.undirected.hasOwnProperty(t))}throw new U("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new B("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.directedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.directedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||void 0;return r?r.key:void 0}},i.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new B("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.undirectedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.undirectedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.undirected&&n.undirected[t]||void 0;return r?r.key:void 0}},i.edge=function(e,t){if(this.multi)throw new B("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.edge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.edge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key},i.areDirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areDirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)},i.areOutNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out},i.areInNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in},i.areUndirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areUndirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"directed"!==this.type&&t in n.undirected},i.areNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)||"directed"!==this.type&&t in n.undirected},i.areInboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in||"directed"!==this.type&&t in n.undirected},i.areOutboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out||"directed"!==this.type&&t in n.undirected},i.inDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree},i.outDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree},i.directedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree},i.undirectedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegree: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree},i.inboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree),n},i.outboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.outDegree),n},i.degree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree),n},i.inDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree-t.directedLoops},i.outDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree-t.directedLoops},i.directedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops},i.undirectedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops},i.inboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,r+=t.directedLoops),n-r},i.outboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,r+=t.directedLoops),n-r},i.degreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,r+=2*t.directedLoops),n-r},i.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.source: could not find the "'.concat(e,'" edge in the graph.'));return t.source.key},i.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.target: could not find the "'.concat(e,'" edge in the graph.'));return t.target.key},i.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.extremities: could not find the "'.concat(e,'" edge in the graph.'));return[t.source.key,t.target.key]},i.opposite=function(e,t){e=""+e,t=""+t;var n=this._edges.get(t);if(!n)throw new V('Graph.opposite: could not find the "'.concat(t,'" edge in the graph.'));var r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new V('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(r,", ").concat(i,")."))},i.hasExtremity=function(e,t){e=""+e,t=""+t;var n=this._edges.get(e);if(!n)throw new V('Graph.hasExtremity: could not find the "'.concat(e,'" edge in the graph.'));return n.source.key===t||n.target.key===t},i.isUndirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isUndirected: could not find the "'.concat(e,'" edge in the graph.'));return t.undirected},i.isDirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isDirected: could not find the "'.concat(e,'" edge in the graph.'));return!t.undirected},i.isSelfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isSelfLoop: could not find the "'.concat(e,'" edge in the graph.'));return t.source===t.target},i.addNode=function(e,t){var n=function(e,t,n){if(n&&!l(n))throw new U('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new B('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}(this,e,t);return n.key},i.mergeNode=function(e,t){if(t&&!l(t))throw new U('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(t,'"'));e=""+e,t=t||{};var n=this._nodes.get(e);return n?(t&&(a(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])},i.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new U('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(t,'"'));e=""+e;var n=this._nodes.get(e);if(n){if(t){var r=n.attributes;n.attributes=t(r),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]},i.dropNode=function(e){e=""+e;var t,n=this._nodes.get(e);if(!n)throw new V('Graph.dropNode: could not find the "'.concat(e,'" node in the graph.'));if("undirected"!==this.type){for(var r in n.out){t=n.out[r];do{_e(this,t),t=t.next}while(t)}for(var i in n.in){t=n.in[i];do{_e(this,t),t=t.next}while(t)}}if("directed"!==this.type)for(var s in n.undirected){t=n.undirected[s];do{_e(this,t),t=t.next}while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})},i.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],r=""+arguments[1];if(!(t=c(this,n,r,this.type)))throw new V('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(r,'" edge in the graph.'))}else if(e=""+e,!(t=this._edges.get(e)))throw new V('Graph.dropEdge: could not find the "'.concat(e,'" edge in the graph.'));return _e(this,t),this},i.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new B("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new B("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e=""+e,t=""+t,"directed");if(!n)throw new V('Graph.dropDirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new B("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new B("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e,t,"undirected");if(!n)throw new V('Graph.dropUndirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},i.clearEdges=function(){for(var e,t=this._nodes.values();!0!==(e=t.next()).done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},i.getAttribute=function(e){return this._attributes[e]},i.getAttributes=function(){return this._attributes},i.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},i.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.updateAttribute=function(e,t){if("function"!=typeof t)throw new U("Graph.updateAttribute: updater should be a function.");var n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},i.replaceAttributes=function(e){if(!l(e))throw new U("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},i.mergeAttributes=function(e){if(!l(e))throw new U("Graph.mergeAttributes: provided attributes are not a plain object.");return a(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this},i.updateAttributes=function(e){if("function"!=typeof e)throw new U("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},i.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i=this._nodes.values();!0!==(n=i.next()).done;)(r=n.value).attributes=e(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},i.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i,s,o=this._edges.values();!0!==(n=o.next()).done;)i=(r=n.value).source,s=r.target,r.attributes=e(r.key,r.attributes,i.key,s.key,i.attributes,s.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},i.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntry: expecting a callback.");fe(!1,!1,!1,this,e)},i.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!1,!0,this,e)},i.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");fe(!1,!0,!1,this,e)},i.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!0,!0,this,e)},i.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):H(this._nodes.keys(),this._nodes.size)},i.forEachNode=function(e){if("function"!=typeof e)throw new U("Graph.forEachNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)},i.findNode=function(e){if("function"!=typeof e)throw new U("Graph.findNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},i.mapNodes=function(e){if("function"!=typeof e)throw new U("Graph.mapNode: expecting a callback.");for(var t,n,r=this._nodes.values(),i=new Array(this.order),s=0;!0!==(t=r.next()).done;)n=t.value,i[s++]=e(n.key,n.attributes);return i},i.someNode=function(e){if("function"!=typeof e)throw new U("Graph.someNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},i.everyNode=function(e){if("function"!=typeof e)throw new U("Graph.everyNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},i.filterNodes=function(e){if("function"!=typeof e)throw new U("Graph.filterNodes: expecting a callback.");for(var t,n,r=this._nodes.values(),i=[];!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)&&i.push(n.key);return i},i.reduceNodes=function(e,t){if("function"!=typeof e)throw new U("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new U("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,r,i=t,s=this._nodes.values();!0!==(n=s.next()).done;)i=e(i,(r=n.value).key,r.attributes);return i},i.nodeEntries=function(){var e=this._nodes.values();return new N((function(){var t=e.next();if(t.done)return t;var n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},i.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,r){t[n++]=function(e,t){var n={key:e};return u(t.attributes)||(n.attributes=a({},t.attributes)),n}(r,e)}));var r=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,i){r[n++]=function(e,t,n){var r={key:t,source:n.source.key,target:n.target.key};return u(n.attributes)||(r.attributes=a({},n.attributes)),"mixed"===e&&n.undirected&&(r.undirected=!0),r}(e.type,i,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:r}},i.import=function(e){var t,n,i,s,o,a=this,c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof r)return e.forEachNode((function(e,t){c?a.mergeNode(e,t):a.addNode(e,t)})),e.forEachEdge((function(e,t,n,r,i,s,o){c?o?a.mergeUndirectedEdgeWithKey(e,n,r,t):a.mergeDirectedEdgeWithKey(e,n,r,t):o?a.addUndirectedEdgeWithKey(e,n,r,t):a.addDirectedEdgeWithKey(e,n,r,t)})),this;if(!l(e))throw new U("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!l(e.attributes))throw new U("Graph.import: invalid attributes. Expecting a plain object.");c?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(i=e.nodes,!Array.isArray(i))throw new U("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=i.length;t<n;t++){ge(s=i[t]);var u=s,d=u.key,h=u.attributes;c?this.mergeNode(d,h):this.addNode(d,h)}}if(e.edges){var p=!1;if("undirected"===this.type&&(p=!0),i=e.edges,!Array.isArray(i))throw new U("Graph.import: invalid edges. Expecting an array.");for(t=0,n=i.length;t<n;t++){ye(o=i[t]);var m=o,f=m.source,g=m.target,y=m.attributes,b=m.undirected,w=void 0===b?p:b;"key"in o?(c?w?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:w?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,o.key,f,g,y):(c?w?this.mergeUndirectedEdge:this.mergeDirectedEdge:w?this.addUndirectedEdge:this.addDirectedEdge).call(this,f,g,y)}}return this},i.nullCopy=function(e){var t=new r(a({},this._options,e));return t.replaceAttributes(a({},this.getAttributes())),t},i.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var r=a({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)})),t},i.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new B('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(e.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new B("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new B("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var t,n,r=this.emptyCopy(e),i=this._edges.values();!0!==(t=i.next()).done;)Te(r,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return r},i.toJSON=function(){return this.export()},i.toString=function(){return"[object Graph]"},i.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var r={},i={};this._edges.forEach((function(e,n){var s,o=e.undirected?"--":"->",a="",c=e.source.key,l=e.target.key;e.undirected&&c>l&&(s=c,c=l,l=s);var u="(".concat(c,")").concat(o,"(").concat(l,")");n.startsWith("geid_")?t.multi&&(void 0===i[u]?i[u]=0:i[u]++,a+="".concat(i[u],". ")):a+="[".concat(n,"]: "),r[a+=u]=e.attributes}));var s={};for(var o in this)this.hasOwnProperty(o)&&!Ae.has(o)&&"function"!=typeof this[o]&&"symbol"!==e(o)&&(s[o]=this[o]);return s.attributes=this._attributes,s.nodes=n,s.edges=r,d(s,"constructor",this.constructor),s},r}(f.exports.EventEmitter);"undefined"!=typeof Symbol&&(xe.prototype[Symbol.for("nodejs.util.inspect.custom")]=xe.prototype.inspect),[{name:function(e){return"".concat(e,"Edge")},generateKey:!0},{name:function(e){return"".concat(e,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(e){return"".concat(e,"EdgeWithKey")}},{name:function(e){return"".concat(e,"DirectedEdgeWithKey")},type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(e){["add","merge","update"].forEach((function(t){var n=e.name(t),r="add"===t?Te:Se;e.generateKey?xe.prototype[n]=function(i,s,o){return r(this,n,!0,"undirected"===(e.type||this.type),null,i,s,o,"update"===t)}:xe.prototype[n]=function(i,s,o,a){return r(this,n,!1,"undirected"===(e.type||this.type),i,s,o,a,"update"===t)}}))})),function(e){q.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Node"),0),r(e,n("Source"),1),r(e,n("Target"),2),r(e,n("Opposite"),3)}))}(xe),function(e){Z.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Edge"),"mixed"),r(e,n("DirectedEdge"),"directed"),r(e,n("UndirectedEdge"),"undirected")}))}(xe),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return"function"==typeof Array.from?Array.from(e._edges.keys()):H(e._edges.keys(),e._edges.size);for(var n,r,i="undirected"===t?e.undirectedSize:e.directedSize,s=new Array(i),o="undirected"===t,a=e._edges.values(),c=0;!0!==(n=a.next()).done;)(r=n.value).undirected===o&&(s[c++]=r.key);return s}(this,r);if(1===arguments.length){e=""+e;var s=this._nodes.get(e);if(void 0===s)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n,r){var i=[];return ce(!1,e,t,n,r,(function(e){i.push(e)})),i}(this.multi,"mixed"===r?this.type:r,i,s)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(n,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r,i){var s=[];return le(!1,e,t,n,r,i,(function(e){s.push(e)})),s}(r,this.multi,i,o,t)}throw new U("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return ae(!1,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!1,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!1,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){var e,t=Array.prototype.slice.call(arguments),n=t.pop();if(0===t.length){var i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),e=new Array(i);var o=0;t.push((function(t,r,i,s,a,c,l){e[o++]=n(t,r,i,s,a,c,l)}))}else e=[],t.push((function(t,r,i,s,o,a,c){e.push(n(t,r,i,s,o,a,c))}));return this[s].apply(this,t),e};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((function(e,r,i,s,o,a,c){t(e,r,i,s,o,a,c)&&n.push(e)})),this[s].apply(this,e),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new U("Graph.".concat(c,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(e=n[0],t=n[1],n=[]):3===n.length?(e=n[1],t=n[2],n=[n[0]]):4===n.length&&(e=n[2],t=n[3],n=[n[0],n[1]]);var r=t;return n.push((function(t,n,i,s,o,a,c){r=e(r,t,n,i,s,o,a,c)})),this[s].apply(this,n),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return ae(!0,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!0,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!0,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var o="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return t(e,n,r,i,s,o,a)})),!!this[s].apply(this,e)};var a="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return!t(e,n,r,i,s,o,a)})),!this[s].apply(this,e)}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();if(!arguments.length)return function(e,t){if(0===e.size)return N.empty();var n="mixed"!==t&&t!==e.type,r="undirected"===t,i=e._edges.values();return new N((function(){for(var e,t;;){if((e=i.next()).done)return e;if(t=e.value,!n||t.undirected===r)break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}))}(this,r);if(1===arguments.length){e=""+e;var n=this._nodes.get(e);if(!n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){var r=N.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(r=Q(r,re(n.in))),"in"!==t&&void 0!==n.out&&(r=Q(r,re(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(r=Q(r,re(n.undirected))),r}(r,i,n)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r){var i=N.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&r in n.in&&(i=Q(i,oe(n.in,r))),void 0!==n.out&&"in"!==t&&r in n.out&&(t||n.key!==r)&&(i=Q(i,oe(n.out,r)))),"directed"!==e&&void 0!==n.undirected&&r in n.undirected&&(i=Q(i,oe(n.undirected,r))),i}(r,i,o,t)}throw new U("Graph.".concat(s,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(xe),function(e){ue.forEach((function(t){(function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return Object.keys(n.undirected);if("string"==typeof t)return Object.keys(n[t])}var r=[];return pe(!1,e,t,n,(function(e){r.push(e)})),r}("mixed"===r?this.type:r,i,t)}})(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));pe(!1,"mixed"===r?this.type:r,i,n,t)}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){var n=[];return this[s](e,(function(e,r){n.push(t(e,r))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[s](e,(function(e,r){t(e,r)&&n.push(e)})),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var r=n;return this[s](e,(function(e,n){r=t(r,e,n)})),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n[0].toUpperCase()+n.slice(1,-1),o="find"+s;e.prototype[o]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return pe(!0,"mixed"===r?this.type:r,i,n,t)}};var a="some"+s;e.prototype[a]=function(e,t){return!!this[o](e,t)};var c="every"+s;e.prototype[c]=function(e,t){return!this[o](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return me(null,n,n.undirected);if("string"==typeof t)return me(null,n,n[t])}var r=N.empty(),i=new de;return"undirected"!==e&&("out"!==t&&(r=Q(r,me(i,n,n.in))),"in"!==t&&(r=Q(r,me(i,n,n.out)))),"directed"!==e&&(r=Q(r,me(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,t)}}(e,t)}))}(xe);var Me=function(e){function n(t){var n=a({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new U("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new U('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),Pe=function(e){function n(t){var n=a({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new U("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new U('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),Le=function(e){function n(t){var n=a({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(xe),Ne=function(e){function n(t){var n=a({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new U('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),$e=function(e){function n(t){var n=a({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new U('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe);function Ie(e){e.from=function(t,n){var r=a({},t.options,n),i=new e(r);return i.import(t),i}}return Ie(xe),Ie(Me),Ie(Pe),Ie(Le),Ie(Ne),Ie($e),xe.Graph=xe,xe.DirectedGraph=Me,xe.UndirectedGraph=Pe,xe.MultiGraph=Le,xe.MultiDirectedGraph=Ne,xe.MultiUndirectedGraph=$e,xe.InvalidArgumentsGraphError=U,xe.NotFoundGraphError=V,xe.UsageGraphError=B,xe}()},944:(e,t)=>{"use strict";t.Vb=void 0,t.Vb=function(e,t,n){var r=function(e,t,n){if(0===e.length||0===t.length)return 0;if(n&&!n.caseSensitive&&(e=e.toUpperCase(),t=t.toUpperCase()),e===t)return 1;for(var r=0,i=e.length,s=t.length,o=Math.floor(Math.max(i,s)/2)-1,a=new Array(i),c=new Array(s),l=0;l<i;l++)for(var u=Math.max(0,l-o);u<=Math.min(s,l+o+1);u++)if(!a[l]&&!c[u]&&e[l]===t[u]){++r,a[l]=c[u]=!0;break}if(0===r)return 0;var d=0,h=0;for(l=0;l<i;l++)if(a[l]){for(;!c[h];)h++;e.charAt(l)!==t.charAt(h++)&&d++}return(r/i+r/s+(r-(d/=2))/r)/3}(e,t,n),i=0;if(r>.7){for(var s=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<s;)++i,o++;r+=.1*i*(1-r)}return r}},7106:e=>{"use strict";var t=e.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),n(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function n(e,r,i,s,o,a,c,l,u,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in r(s,o,a,c,l,u,d),s){var p=s[h];if(Array.isArray(p)){if(h in t.arrayKeywords)for(var m=0;m<p.length;m++)n(e,r,i,p[m],o+"/"+h+"/"+m,a,o,h,s,m)}else if(h in t.propsKeywords){if(p&&"object"==typeof p)for(var f in p)n(e,r,i,p[f],o+"/"+h+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,h,s,f)}else(h in t.keywords||e.allKeys&&!(h in t.skipKeywords))&&n(e,r,i,p,o+"/"+h,a,o,h,s)}i(s,o,a,c,l,u,d)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var s={},o=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=s[l]||0,d="".concat(l," ").concat(u);s[l]=u+1;var h=n(d),p={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var m=i(p,r);r.byIndex=a,t.splice(a,0,{identifier:d,updater:m,references:1})}o.push(d)}return o}function i(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,i){var s=r(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var c=r(e,i),l=0;l<s.length;l++){var u=n(s[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}s=c}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},1407:(e,t,n)=>{"use strict";n.d(t,{R:()=>l});var r=n(4328),i=n(6082),s=n(3572),o=n(826),a=n(439);const c=31;async function l(e,t=!1,n){const a=o.G.forColumn(e);let l;n??=new Map;const d=a.isHelm()?(0,s.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<d.length;e++)n.has(d[e])||n.set(d[e],`${n.size+1}`);if(a.isHelm())l=await r.functions.call("HELM:getMolFiles",{col:e}),l=function(e,t,n=!1){const r=new Array(e.length);for(let i=0;i<e.length;i++){let s=0,o=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=e.get(i);s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1;const u=parseInt(l.substring(s,s+3)),d=parseInt(l.substring(s+3,s+6));a+=`M V30 COUNTS ${u} ${d} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){s=l.indexOf("\n",s)+1+c,o=l.indexOf(" ",s);const r=l.substring(s,o);a+=n?`M V30 ${e+1} R${t.get(r)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(r)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<d;e++){s=l.indexOf("\n",s)+1;const t=parseInt(l.substring(s,s+3).trim()),n=parseInt(l.substring(s+3,s+6).trim());a+=`M V30 ${e+1} ${parseInt(l.substring(s+6,s+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",r[i]=a}return r}(l,n,t);else{l=new Array(e.length);for(let r=0;r<e.length;r++){const e=u(a.getSplitted(r),n,t);l[r]=e}}return i.Column.fromStrings("monomericMols",l)}function u(e,t,n=!1){let r="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";r+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,r+="M V30 BEGIN ATOM\n";for(let i=0;i<e.length;i++){const s=e.getCanonical(i);s!==a._S&&(r+=n?`M V30 ${i+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${i+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`)}r+="M V30 END ATOM\n",r+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)r+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return r+="M V30 END BOND\n",r+="M V30 END CTAB\n",r+="M END",r}},3572:(e,t,n)=>{"use strict";n.d(t,{_package:()=>Ot,activityCliffs:()=>Ht,getHelmMonomers:()=>Vt,getMonomerLib:()=>Gt,getMonomerLibHelper:()=>kt,importFasta:()=>Ut,sequenceIdentityScoring:()=>Bt,sequenceSimilarityScoring:()=>Yt,sequenceSpaceTopMenu:()=>Ft});var r,i,s=n(4328),o=n(7389),a=n(6082),c=n(684),l=n(9039);(i=r||(r={})).EUCLIDEAN="EUCLIDEAN",i.MANHATTAN="MANHATTAN";var u=n(1858),d=n(5072),h=n.n(d),p=n(7825),m=n.n(p),f=n(7659),g=n.n(f),y=n(5056),b=n.n(y),w=n(540),v=n.n(w),A=n(1113),C=n.n(A),E=n(7939),T={};T.styleTagTransform=C(),T.setAttributes=b(),T.insert=g().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=v(),h()(E.A,T),E.A&&E.A.locals&&E.A.locals;var S=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};let _=null,x=null;Promise.resolve(),n(934),n(8903);const M="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;const P=rxjs.operators;n(6295);const L=e=>null==e;function N(e,t,n,r){if(n>e[e.length-1])return;const i=e.findIndex((e=>n<e));e.pop(),e.splice(i,0,n),t.pop(),t.splice(i,0,r)}class ${constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,i,s=[{}],o=[1],a=r.EUCLIDEAN){const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,s,o,a):0;i<u&&(console.log(`using threshold ${u}`),i=u),s.forEach(((e,t)=>s[t].threshold=i));const d=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(111),n.b))));for(let n=0;n<this._workerCount;n++)d[n]=new Promise(((r,u)=>{const d=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=d&&r({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),h[n].postMessage({values:e,startIdx:d,endIdx:p,threshold:i,fnNames:t,opts:s,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,i:t,j:i,distance:s}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),r({i:t,j:i,distance:s,idx:n}))}}));const p=await Promise.all(d),m=p.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(m),g=new Int32Array(m),y=new Float32Array(m);let b=0;for(const e of p)f.set(e.i,b),g.set(e.j,b),y.set(e.distance,b),b+=e.i.length;return{i:f,j:g,distance:y}}async calc(e,t,n,r={}){return await this.calcMultiColumn([e],[t],n,[r],[1])}async getKNN(e,t,n=15,r={}){return await this.multiColumnKNN([e],[t],n,[r],[1])}async getThresholdKNN(e,t,n=.8,r={}){return await this.multiColumnThresholdKnn([e],[t],n,[r],[1])}async multiColumnThresholdKnn(e,t,i=.8,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(603),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,threshold:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p=new Int32Array(e[0].length);for(const t of h)for(let n=0;n<e[0].length;++n)p[n]+=t.knnIndexes[n]?.length??0;const m={knnDistances:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t]))),knnIndexes:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t])))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<(t.knnDistances[n]?.length??0);++e)m.knnDistances[n][p[n]-1]=t.knnDistances[n][e],m.knnIndexes[n][p[n]-1]=t.knnIndexes[n][e],p[n]-=1;return m}async multiColumnKNN(e,t,i=15,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(950),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,nNeighbours:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(-1)))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<(t.knnDistances[n]?.length??0);++e)N(p.knnDistances[n],p.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return p}async getSampleDistances(e,t,i=[],s,o=r.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(778),n.b))));try{const n=e[0].length*(e[0].length-1)/2,r=Math.floor(n/this._workerCount),c=1e6,l=Math.max(Math.min(n/1e3,c),Math.min(n,c)),u=Math.floor(l/this._workerCount),d=new Array(this._workerCount);for(let c=0;c<this._workerCount;c++)d[c]=new Promise(((l,d)=>{const h=c*r,p=c===this._workerCount-1?n:(c+1)*r;a[c].postMessage({values:e,startIdx:h,endIdx:p,sampleLength:u,fnNames:t,opts:i,weights:s,aggregationMethod:o}),a[c].onmessage=({data:{error:e,distance:t}})=>{a[c].terminate(),e?d(e):l({distance:t})}}));const h=await Promise.all(d),p=h.reduce(((e,t)=>e+t.distance.length),0),m=new Float32Array(p);let f=0;for(const e of h)m.set(e.distance,f),f+=e.distance.length;return m.sort(),m}catch(e){return a?.forEach((e=>e?.terminate())),console.error(e),new Float32Array(1).fill(.5)}}async getMinimalThreshold(e,t,n=[],i,s=r.EUCLIDEAN){try{const r=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,i,s);return 1-o[Math.floor(7e7/r*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,r){const i=[],s=[],o=[];let a=0,c=0,l=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=L(e[c])||L(e[l])?1:n(e[c],e[l]);1-t>=r&&(i.push(c),s.push(l),o.push(t)),a++,l++,l===e.length&&(c++,l=c+1)}return{i:new Int32Array(i),j:new Int32Array(s),distance:new Float32Array(o)}}}var I,R,O=n(8774);(R=I||(I={})).none="none",R.bold="bold",R.dashed="dashed";class k{get currentLineId(){return this._currentLineIdx}set currentLineId(e){e!==this._currentLineIdx&&(this._currentLineIdx=e,this.sp.render(this.ctx))}set linesToRender(e){this.updateLines(e),this.sp.render(this.ctx)}set linesVisibility(e){this.visibility=e,this.sp.render(this.ctx)}constructor(e,t,n,r,i=I.none){var s;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=e,this.xAxisCol=this.sp.dataFrame.columns.byName(t),this.yAxisCol=this.sp.dataFrame.columns.byName(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=i,this.updateLines(r),this.visibility=null!==(s=r.visibility)&&void 0!==s?s:new O.A(this.lines.from.length),r.visibility||this.visibility.setAll(!0,!1),r.arrowSize&&(this.arrowWidth=r.arrowSize),this.canvas.onmousedown=e=>{var t;(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)&&(this.mouseOverLineId=this.checkCoordsOnLine(e.offsetX,e.offsetY)),-1!==this.mouseOverLineId&&this.lineClicked.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},this.canvas.onmousemove=e=>{var t;this.mouseOverLineId=(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)?-1:this.checkCoordsOnLine(e.offsetX,e.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},e.onEvent("d4-before-draw-scene").subscribe((e=>{this.renderLines()}))}updateLines(e){this.lines=e,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),e.skipMultiLineCalculation?this.multipleLinesCounts.fill(0):this.createMultiLinesIndices()}renderLines(){var e,t,n,r,i,s,o,a,c,l,u,d,h,p,m,f,g;const y=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;y||(this.ctx.lineWidth=null!==(e=this.lines.width)&&void 0!==e?e:1,this.ctx.strokeStyle=`rgba(${null!==(t=this.lines.color)&&void 0!==t?t:"0,128,0"},${null!==(n=this.lines.opacity)&&void 0!==n?n:1})`);const b=this.sp.dataFrame.filter,w=Math.pow(null!==(r=this.lines.shortLineThreshold)&&void 0!==r?r:5,2);for(let e=0;e<this.lines.from.length;e++)if(b.get(this.lines.from[e])&&b.get(this.lines.to[e])&&this.visibility.getBit(e)){let t=0;const n=this.sp.getMarkerSize(this.lines.from[e])/2,r=this.sp.getMarkerSize(this.lines.to[e])/2,b=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let v=null==b?void 0:b.x,A=null==b?void 0:b.y;const C=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let E=null==C?void 0:C.x,T=null==C?void 0:C.y;const S=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),v&&A&&E&&T&&Math.hypot(E-v,T-A)/S>.01){if(y){const t=(null===(i=this.lines.colors)||void 0===i?void 0:i[e])?null===(s=this.lines.colors)||void 0===s?void 0:s[e]:null!==(o=this.lines.color)&&void 0!==o?o:"0,128,0",n=(null===(a=this.lines.opacities)||void 0===a?void 0:a[e])?null===(c=this.lines.opacities)||void 0===c?void 0:c[e]:null!==(l=this.lines.opacity)&&void 0!==l?l:1;this.ctx.strokeStyle=`rgba(${t},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[e])?null===(d=this.lines.widths)||void 0===d?void 0:d[e]:null!==(h=this.lines.width)&&void 0!==h?h:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const b=this.multipleLinesCounts[e];let C=null;if(b){t=this.getLineLength(v,A,E,T);const i=this.getPointOnDistance(v,A,E,T,r,t),s=this.getPointOnDistance(E,T,v,A,n,t);v=i.x,A=i.y,E=s.x,T=s.y,C=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(b,v,A,E,T,e):this.findControlPoint(b,E,T,v,A,e),this.ctx.moveTo(v,A),this.ctx.quadraticCurveTo(C.x,C.y,E,T)}else(!this.lines.skipShortLines||Math.pow(E-v,2)+Math.pow(T-A,2)>w)&&(this.ctx.moveTo(v,A),this.ctx.lineTo(E,T));if((null!==(p=this.lines.drawArrows)&&void 0!==p?p:null===(m=this.lines.drawArrowsArr)||void 0===m?void 0:m.getBit(e))&&(t||(t=this.getLineLength(v,A,E,T)),t>this.arrowWidth)){const e=b?null:this.getPointOnDistance(v,A,E,T,r,t),n=b?C.x:v,i=b?C.y:A;this.canvasArrow(this.ctx,null!==(f=null==e?void 0:e.x)&&void 0!==f?f:v,null!==(g=null==e?void 0:e.y)&&void 0!==g?g:A,n,i)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case I.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case I.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}fillLeftBottomRect(){const e=new Path2D;e.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(e),this.ctx.closePath()}createMultiLinesIndices(){const e={};for(let t=0;t<this.lines.from.length;t++){let n=0,r=0;this.lines.from[t]<this.lines.to[t]?(n=this.lines.from[t],r=this.lines.to[t]):(n=this.lines.to[t],r=this.lines.from[t]),e[`${n}|${r}`]?(1===e[`${n}|${r}`].length&&(this.multipleLinesCounts[e[`${n}|${r}`][0]]=1,e[`${n}|${r}`].push(1)),this.multipleLinesCounts[t]=++e[`${n}|${r}`][1]):e[`${n}|${r}`]=[t]}}checkCoordsOnLine(e,t){let n=-1,r=null,i=null;const s=this.sp.dataFrame.filter;for(let o=0;o<this.lines.from.length;o++)if(s.get(this.lines.from[o])&&s.get(this.lines.to[o])&&this.visibility.getBit(o)){const s=this.sp.getMarkerSize(this.lines.from[o])/2,a=this.sp.getMarkerSize(this.lines.to[o])/2,c=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[o]),this.yAxisCol.get(this.lines.from[o])),l=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[o]),this.yAxisCol.get(this.lines.to[o]));if(this.multipleLinesCounts[o]){const n=this.getLineLength(c.x,c.y,l.x,l.y),r=this.getPointOnDistance(c.x,c.y,l.x,l.y,a,n),u=this.getPointOnDistance(l.x,l.y,null==c?void 0:c.x,null==c?void 0:c.y,s,n),d=this.lines.from[o]>this.lines.to[o]?this.findControlPoint(this.multipleLinesCounts[o],r.x,r.y,u.x,u.y,o):this.findControlPoint(this.multipleLinesCounts[o],u.x,u.y,r.x,r.y,o);i=this.calculateDistToCurveLine(o,e,t,r,u,d)}else i=this.calculateDistToStraightLine(e,t,c,l);(!r&&null!==i&&i<5||r&&null!==i&&i<r)&&(r=i,n=o)}return n}calculateDistToStraightLine(e,t,n,r){const i=Math.min(n.x,r.x),s=Math.max(n.x,r.x),o=Math.min(n.y,r.y),a=Math.max(n.y,r.y);return e>=i-2&&e<=s+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,r):null}distToStraightLineSegment(e,t,n,r){const i=(e,t,n,r)=>Math.pow(e-n,2)+Math.pow(t-r,2),s=i(n.x,n.y,r.x,r.y);if(0==s)return i(e,t,n.x,n.y);let o=((e-n.x)*(r.x-n.x)+(t-n.y)*(r.y-n.y))/s;return o=Math.max(0,Math.min(1,o)),i(e,t,n.x+o*(r.x-n.x),n.y+o*(r.y-n.y))}calculateDistToCurveLine(e,t,n,r,i,s){const o=Math.min(r.x,i.x,s.x),a=Math.max(r.x,i.x,s.x),c=Math.min(r.y,i.y,s.y),l=Math.max(r.y,i.y,s.y);if(t>=o-2&&t<=a+2&&n>=c-2&&n<=l+2){const e=a-o,u=l-c;return this.calculateDistToCurveInRect(t,n,r,s,i,e,u)}return null}calculateDistToCurveInRect(e,t,n,r,i,s,o){const a=Math.floor((s+o)/3),c=1/a,l=new Uint32Array(a),u=new Uint32Array(a),d=new Uint32Array(a);let h=null;const p=new O.A(a);for(let s=0;s<l.length;s++){const o=s*c,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*r.x+Math.pow(o,2)*i.x,p=Math.pow(1-o,2)*n.y+2*o*(1-o)*r.y+Math.pow(o,2)*i.y,m=Math.abs(e-a),f=Math.abs(t-p),g=m+f;(!h||h>g)&&(h=g),d[s]=Math.max(m,f),l[s]=a,u[s]=p}for(let e=0;e<l.length;e++)d[e]<h&&p.setBit(e,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const r=Math.hypot(l[n]-e,u[n]-t);(!m||m>r)&&(m=r)}return m}getLineLength(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}getPointOnDistance(e,t,n,r,i,s){const o=n-i*((n-e)/s),c=r-i*((r-t)/s);return new a.Point(o,c)}findControlPoint(e,t,n,r,i,s){const o=t+(r-t)/2,c=n+(i-n)/2;let l=o-t,u=c-n;const d=Math.sqrt(l*l+u*u);l/=d,u/=d;const h=50*Math.ceil(e/2);return e%2==0?new a.Point(o+h/2*u,c-h/2*l):new a.Point(o-h/2*u,c+h/2*l)}canvasArrow(e,t,n,r,i){const s=Math.atan2(r-t,i-n)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(s-Math.PI/10),n-this.arrowWidth*Math.cos(s-Math.PI/10)),e.lineTo(t,n),e.lineTo(t-this.arrowWidth*Math.sin(s+Math.PI/10),n-this.arrowWidth*Math.cos(s+Math.PI/10))}}const D="dimensionality-reducer-terminate-event";var G,H,F=n(3629);async function U(e,t,r,i,o,a,c){let l=await async function(e,t,r,i,o,a,c){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==i.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(l,u){const d=new Worker(new URL(n.p+n.u(234),n.b));d.postMessage({columnsData:e,distanceMetrics:t,method:r,options:a,weights:i,aggregationMethod:o});const h=s.events.onCustomEvent(D).subscribe((()=>{try{d?.terminate()}finally{h.unsubscribe()}}));d.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:r}})=>{L(n)||L(r)?(h.unsubscribe(),e?u(e):l(t),setTimeout((()=>d.terminate()),100)):c&&c(n,r,t)}}))}(e,r,t,i,o,a,c);return l=l.map((e=>(0,F.S8)(e))),l}(H=G||(G={})).EUCLIDEAN="EUCLIDEAN",H.MANHATTAN="MANHATTAN";const V={[G.EUCLIDEAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + distances[i] * distances[i] * computeInfo.weights[i] * computeInfo.weights[i];\n }\n return sqrt(sum);\n `},[G.MANHATTAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + abs(distances[i]) * computeInfo.weights[i];\n }\n return sum;\n `}};var B,Y;(Y=B||(B={})).HAMMING="Hamming",Y.EUCLIDEAN="Euclidean",Y.MANHATTAN="Manhattan",Y.TANIMOTO="Tanimoto",Y.LEVENSTEIN="Levenshtein",Y.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",Y.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",Y.SOKAL="Sokal",Y.COSINE="Cosine",Y.ASYMMETRIC="Asymmetric",Y.Difference="Difference",Y.OneHot="One-Hot";const W={[B.HAMMING]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + f32(a[i] != b[i]);\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[B.EUCLIDEAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + f32(a[i] - b[i]) * f32(a[i] - b[i]);\n }\n return sqrt(dist);\n `},[B.MANHATTAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + abs(f32(a[i] - b[i]));\n }\n return dist;\n `},[B.TANIMOTO]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n\n if (onBitsa == 0u && onBitsb == 0u) {\n return 0.0;\n }\n\n let totalOnBits = onBitsa + onBitsb;\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n\n return 1.0 - f32(commonBits) / f32(totalOnBits - commonBits);\n `},[B.LEVENSTEIN]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n\n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = f32(i);\n }\n\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n dynamicPassMat[curIndex][0] = f32(i);\n var minEntry: f32 = f32(maxLength);\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n let bMon = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n var cost: f32 = f32(a[j - 1] != bMon);\n var res: f32 = min(\n min(\n (*prevRow)[j] + 1.0, // deletion\n (*curRow)[j - 1] + 1.0, // insertion\n ),\n (*prevRow)[j - 1] + cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n `},[B.NEEDLEMAN_WUNSCH]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n // we need to keep track of which operation led to the current cell\n // i.e. whether we came from the left, top or diagonal to assign gap open/gap extend penalty\n var verticalGaps: array<u32, ${e+1}u>;\n var horizontalGaps: array<u32, ${e+1}u>;\n\n let gapOpenPenalty: f32 = suppInfo.gapOpenPenalty${t};\n let gapExtensionPenalty: f32 = suppInfo.gapExtensionPenalty${t};\n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty; // accounting for the fact that left and right gaps are less costly\n dynamicPassMat[curIndex][i] = 0.0;\n }\n dynamicPassMat[0][0] = 0.0;\n\n let simMatrix = &suppInfo.similarityMatrix${t}; // using pointers make things faster\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n (*curRow)[0] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty;\n var minEntry: f32 = f32(maxLength);\n let monB = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n let monA = u32(a[j - 1]);\n \n let cost: f32 = (*prevRow)[j - 1] + 1f - (*simMatrix)[monA][monB];\n var top = (*prevRow)[j]; // deletion\n if (verticalGaps[j] > 0 || i == 1 || i == bLength) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0 || j == 1 || j == aLength) {\n left = left + gapExtensionPenalty;\n } else {\n left = left + gapOpenPenalty;\n }\n var res: f32 = min(\n min(\n top, // deletion\n left, // insertion\n ),\n cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n // update the horizontal and vertical gaps\n if (res == cost) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 0;\n } else if (res == left) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 1;\n } else {\n verticalGaps[j] = 1;\n horizontalGaps[j] = 0;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n return dynamicPassMat[prevIndex][aLength] / f32(minLength);\n\n `},[B.MONOMER_CHEMICAL_DISTANCE]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n let simMatrix = &(suppInfo.similarityMatrix${t}); // using pointers make things faster\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + 1.0 - (*simMatrix)[u32(a[i])][u32(b[i])];\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[B.SOKAL]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa + onBitsb;\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(total * 2 - commonBits * 3);\n `},[B.COSINE]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa * onBitsb; // p.s. here total is taken by multiplying\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / sqrt(f32(total));\n `},[B.ASYMMETRIC]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let min = min(onBitsa, onBitsb);\n if (min == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(min);\n `},[B.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[B.OneHot]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n if (aLength != bLength) {\n return 1.0;\n }\n for (var i = 0u; i < aLength; i = i + 1u) {\n if(a[i] != b[i]) {\n return 1.0;\n }\n }\n return 0.0;\n `}},j={[B.HAMMING]:e=>Math.ceil(e/30),[B.EUCLIDEAN]:e=>Math.ceil(e/30),[B.MANHATTAN]:e=>Math.ceil(e/30),[B.TANIMOTO]:e=>Math.ceil(e/60),[B.SOKAL]:e=>Math.ceil(e/60),[B.COSINE]:e=>Math.ceil(e/60),[B.ASYMMETRIC]:e=>Math.ceil(e/60),[B.LEVENSTEIN]:e=>Math.ceil(e*e/60),[B.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[B.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[B.Difference]:e=>1,[B.OneHot]:e=>Math.ceil(e/40)},K={STRING:new Set([B.HAMMING,B.LEVENSTEIN,B.NEEDLEMAN_WUNSCH,B.MONOMER_CHEMICAL_DISTANCE,B.OneHot]),UINT32ARRAY:new Set([B.HAMMING,B.EUCLIDEAN,B.MANHATTAN,B.MONOMER_CHEMICAL_DISTANCE,B.LEVENSTEIN,B.NEEDLEMAN_WUNSCH,B.TANIMOTO,B.COSINE,B.SOKAL,B.ASYMMETRIC,B.OneHot,B.Difference]),INT32ARRAY:new Set([B.EUCLIDEAN,B.MANHATTAN,B.OneHot,B.Difference]),FLOAT32ARRAY:new Set([B.EUCLIDEAN,B.MANHATTAN,B.Difference]),NUMBER:new Set([B.EUCLIDEAN,B.MANHATTAN,B.Difference]),BITARRAY:new Set([B.TANIMOTO,B.COSINE,B.SOKAL,B.ASYMMETRIC])};var z=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function q(e,t,n,r){return e.map(((e,r)=>`\n fn distanceScript${r}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${r}[aIndex];\n let b = computeInfo.data${r}[bIndex];\n let maxDistance: f32 = ${n};\n ${W[e](t[r],r)}\n }\n `)).join("\n")+"\n"+`\n fn combinedDistance(aIndex: u32, bIndex: u32) -> f32 {\n var distances: array<f32, ${e.length}>;\n ${e.map(((e,t)=>`distances[${t}] = distanceScript${t}(aIndex, bIndex);`)).join("\n")}\n ${V[r](e.length)}\n }\n \n `}var Z=n(1991),X=n.n(Z);let J=0;const Q="cliffsDf",ee=new u.Subject,te="activity_difference",ne="SALI_index",re="similarity",ie="line_index",se=["1_molecule","2_molecule"],oe="filterCliffs";async function ae(e,t,r,i,c,l,u,d,h,p,m,f,g,y,b,w,v){J++;const A=l/100;let C,E=!1;const T=f.inputs,L=await f.apply({[T[0].name]:t,[T[1].name]:u,...h.preprocessingFuncArgs??{}});let N=[];if(d===M){const t=await function(e,t,r,i,s,o,a=10,c=!1,l=2){const u=new Worker(new URL(n.p+n.u(980),n.b));let d;return u.postMessage({data:e,threshold:t,weights:r,aggregationMethod:i,distanceFns:s,distanceFnArgs:o,maxIterations:a,useWebGPU:c,inflate:l}),{promise:new Promise(((e,t)=>{d=e,u.onmessage=t=>{setTimeout((()=>u.terminate()),100),e(t.data.res)},u.onerror=e=>{setTimeout((()=>u.terminate()),100),t(e)}})),terminate:()=>{try{d(null),u.terminate()}catch(e){console.error(e)}}}}([L.entries],l,[1],"MANHATTAN",[u],[L.options??{}],h?.maxIterations??5,h.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),N=[t.embedX,t.embedY]}else N=await U([L.entries],d,[u],[1],"MANHATTAN",{...h,distanceFnArgs:[L.options??{}]});if(N.length!==r.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<N.length;++t)e.columns.addNewFloat(r[t]).init((e=>N[t][e]));let R=null;if(h.useWebGPU)try{R=await function(e,t=.8,n,r,i,s){return z(this,void 0,void 0,(function*(){const o=yield function(){return S(this,void 0,void 0,(function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!_&&(_=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==_))return null;let e=!1;if(x&&(x.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!x||e){const e=1e9,t=_.limits,n=t.maxBufferSize,r=t.maxStorageBufferBindingSize;try{return x=yield _.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(r,e)}}),x}catch(e){return console.error("Failed to create device with required limits",e),x=yield _.requestDevice(),x}}return x}))}();if(!o)return null;const a=Object.values(B);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(G).includes(r))throw new Error("Invalid aggregation function provided: "+r);const c=1-t;if(s.length!==e.length||s.length!==n.length||s.length!==i.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(e.some((t=>t.length!==e[0].length)))throw new Error("All entry lists must be the same length");const l=e.length,u=e[0].length,d=e.map(((e,t)=>function(e,t=B.HAMMING,n,r={gapOpenPenalty:1,gapExtensionPenalty:.6}){var i,s;let o=null;const a=e.some((e=>"string"==typeof e))?(o="STRING",e.map((e=>new Uint32Array(e.split("").map((e=>e.charCodeAt(0))))))):e.some((e=>"number"==typeof e))?(o="NUMBER",e.map((e=>new Float32Array([e])))):"object"==typeof e[0]&&e.some((e=>"_data"in e&&"_length"in e))?(o="BITARRAY",e.map((e=>e._data))):e.some((e=>e instanceof Float32Array))?(o="FLOAT32ARRAY",e):e.some((e=>e instanceof Uint32Array))?(o="UINT32ARRAY",e):e.some((e=>e instanceof Int32Array))?(o="INT32ARRAY",e):void 0;if(!a||!o)throw new Error("Invalid entry type, could not determine entry type from input list");const c=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",l=new Uint32Array(a.map((e=>e.length)));if(!K[o]||!K[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=l.reduce(((e,t)=>Math.max(e,t)),0),d=j[t](u),h="INT32ARRAY"===c?Int32Array:"FLOAT32ARRAY"===c?Float32Array:Uint32Array,p=new h(a.length*u);a.forEach(((e,t)=>{p.set(e,t*u)}));let m="",f=0,g="FLOAT32ARRAY",y=null;if(t===B.NEEDLEMAN_WUNSCH||t===B.MONOMER_CHEMICAL_DISTANCE){let e=r.scoringMatrix&&r.alphabetIndexes?Object.keys(r.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!r.alphabetIndexes||!r.scoringMatrix){for(let t=0;t<p.length;t++)p[t]>e&&(e=p[t]);r.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),r.alphabetIndexes={};for(let e=0;e<r.scoringMatrix.length;e++)r.scoringMatrix[e][e]=1,r.alphabetIndexes[String.fromCharCode(e)]=e}const t=(e+1)*(e+1),o=new Array(e+1).fill(null).map((()=>new Float32Array(e+1)));for(let t=0;t<e+1;t++)o[t][t]=1;const a=r.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=r.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(i=r.gapOpenPenalty)&&void 0!==i?i:1,y[1]=null!==(s=r.gapExtensionPenalty)&&void 0!==s?s:.6;let c=2;for(let e=0;e<o.length;e++)y.set(o[e],c),c+=o[e].length;m=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${e+1}>, ${e+1}>`}else if(t===B.Difference){if(!r.range||"number"!=typeof r.range||r.range<=0){const e=p.reduce(((e,t)=>Math.min(e,t)),p[0]),t=p.reduce(((e,t)=>Math.max(e,t)),p[0]);r.range=t-e}r.range<=0&&(r.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([r.range]),m=`\n range${n}: f32`}const b=p instanceof Int32Array?"i32":p instanceof Float32Array?"f32":"u32",w=`data${n}: array<array<${b}, ${u}>, ${a.length}>`;return{flatSourceArray:p,sourceArraySize:p.length,maxEntryLen:u,arraySizes:l,complexity:d,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:m,entryType:o,dataTypeWGSL:b,dataStructWgsl:w,EncodedArrayConstructor:h}}(e,n[t],t,s[t])));if(0===l)throw new Error("No columns provided. Please provide at least one column of data.");1===l&&(r=G.MANHATTAN);let h=d.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),p=!1;h&&""!=h.trim()||(p=!0,h="\ndummy: f32\n");const m=d.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(l*u);d.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,b=d.reduce(((e,t)=>e+t.complexity),0),w=Math.ceil(6e3/b),v=Math.ceil(Math.sqrt(Math.ceil(100))),A=10*v,C=u*(u-1)/2,E=Math.ceil(C/g),T=o.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${E} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${u}>, ${l}>,\n // the weights for each entry\n weights: array<f32, ${l}>,\n // the data for each entry\n ${m} // an example of the dataWgsl would be:\n //data0: array<array<u32,20>,100>,\n //data1: array<array<u32,20>,100>\n }\n\n // struct for the supplementary information\n struct SuppInfo {\n // struct containing all the supplementary info, like scoring matrix, alphabet indexes, range, etc.\n ${h}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${p?"let otherDummy = suppInfo.dummy * 2;":""} // just to make sure that the suppInfo is not optimized out\n let threadCol = id.x;\n let threadRow = id.y;\n let linearIndex = threadRow * ${A} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${u}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${u}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${w}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${c}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${u}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${q(n,d.map((e=>e.maxEntryLen)),c,r)}\n\n\n `}),M=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:T,entryPoint:"calcSparseMatrix"}}),P=new Uint32Array(g),L=new Uint32Array(g),N=new Uint32Array(g),$=new Uint32Array(g),I=Math.floor(C/g);let R=0,O=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?C-1:(e+1)*I,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),r=t-u*n+Math.floor((n+1)*(n+2)/2);P[e]=O,L[e]=R,N[e]=r,$[e]=n,R=n,O=r}console.timeEnd("GPUthreadStarts");const k=4e4+u*l+l+d.reduce(((e,t)=>e+t.sourceArraySize),0),D=d.reduce(((e,t)=>e+t.suppInfoSize),0),H=1e6,F=k*Uint32Array.BYTES_PER_ELEMENT;let U=F;const V=15&F;0!==V&&(U+=16-V);const Y=o.createBuffer({label:"compute info buffer",size:U,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),W=Y.getMappedRange();let z=0;new Uint32Array(W,z,g).set(P),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,g).set(L),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,g).set(N),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,g).set($),z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,z,f.length).set(f),z+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(W,z,l).set(i),z+=l*Float32Array.BYTES_PER_ELEMENT;for(const e of d){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(W,z,n).set(e.flatSourceArray),z+=n*t.BYTES_PER_ELEMENT}Y.unmap();const Z=D*Uint32Array.BYTES_PER_ELEMENT;let X=Z;const J=15&Z;0!==J&&(X+=16-J),X=Math.max(X,16);const Q=o.createBuffer({label:"supp info buffer",size:X,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),ee=Q.getMappedRange();let te=0;for(const e of d)e.suppInfoBuffer&&e.suppInfoBuffer.byteLength>0&&e.suppInfoSize>0&&(new("UINT32ARRAY"===e.suppInfoType?Uint32Array:Float32Array)(ee,te,e.suppInfoBuffer.length).set(e.suppInfoBuffer),te+=e.suppInfoBuffer.byteLength);0===te&&new Uint32Array(ee,0,4).set([1,1,1,1]),Q.unmap();const ne=302e4*Uint32Array.BYTES_PER_ELEMENT;let re=ne;const ie=15&ne;0!==ie&&(re+=16-ie);const se=o.createBuffer({label:"results buffer",size:re,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:M.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:Y}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:se}}]}),ae=o.createBuffer({label:"results out buffer",size:se.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),ce=[],le=[],ue=[];let de=!1;for(;!de;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(M),t.setBindGroup(0,oe),t.dispatchWorkgroups(v,v),t.end(),e.copyBufferToBuffer(se,0,ae,0,ae.size);const n=e.finish();o.queue.submit([n]),yield o.queue.onSubmittedWorkDone(),yield ae.mapAsync(GPUMapMode.READ);const r=ae.getMappedRange();let i=0;const s=new Uint32Array(r,i,H);i+=H*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(r,i,H);i+=H*Uint32Array.BYTES_PER_ELEMENT;const c=new Float32Array(r,i,H);i+=H*Float32Array.BYTES_PER_ELEMENT;const l=new Uint32Array(r,i,g);i+=g*Uint32Array.BYTES_PER_ELEMENT,de=new Uint32Array(r,i,g).every((e=>1===e));const u=l.reduce(((e,t)=>e+t),0),d=new Uint32Array(u),h=new Uint32Array(u),p=new Float32Array(u);let m=0;for(let e=0;e<l.length;e++){const t=l[e];0!==t&&(d.set(s.subarray(e*y,e*y+t),m),h.set(a.subarray(e*y,e*y+t),m),p.set(c.subarray(e*y,e*y+t),m),m+=t)}ce.push(d),le.push(h),ue.push(p),ae.unmap()}const he=ce.reduce(((e,t)=>e+t.length),0),pe=new Uint32Array(he),me=new Uint32Array(he),fe=new Float32Array(he);let ge=0;for(let e=0;e<ce.length;e++)pe.set(ce[e],ge),me.set(le[e],ge),fe.set(ue[e],ge),ge+=ce[e].length;return Y.destroy(),Q.destroy(),se.destroy(),ae.destroy(),{i:pe,j:me,distance:fe}}))}([L.entries],A,[u],G.MANHATTAN,[1],[L.options??{}])}catch(e){console.error(e)}R||(h.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),R=await(new $).calc(L.entries,u,A,L.options));const O=await async function(e,t){const n=e.distance.map(((n,r)=>{const i=Math.abs(t.get(e.i[r])-t.get(e.j[r]));return 0!=n?i/n:1/0})),r=e.distance.map((e=>1-e)),i=e.i,s=e.j,o=a.BitSet.create(t.length);return e.distance.forEach(((t,n)=>{o.set(e.i[n],!0),o.set(e.j[n],!0)})),{simVals:r,saliVals:n,n1:i,n2:s,cliffsBitSet:o}}(R,c),D=function(e,t,n,r,i,s,o){const c=new Array(e).fill(0);for(let e=0;e!=r.length;++e)n[e]!=1/0&&(o.get(r[e])>o.get(i[e])?c[r[e]]+=n[e]:c[i[e]]+=n[e]);return a.Column.fromList("double",t,c)}(t.length,`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,O.saliVals,O.n1,O.n2,0,c);e.columns.add(D);const H=O.cliffsBitSet,F=function(e){const t=e.filter((e=>e!==1/0)),n=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE);return{max:t.reduce(((e,t)=>Math.max(e,t)),n),min:n}}(O.saliVals),V=.8/(F.max-F.min),Y=v?s.shell.view("Browse").preview:s.shell.getTableView(e.name),W=Y.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:r[0],yColumnName:r[1],size:D.name,color:c.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:i}),Z=function(e,t,n,r,i,s,o,c){const l={from:new Uint32Array(t.n1.length),to:new Uint32Array(t.n1.length),opacities:new Float32Array(t.n1.length),colors:new Array(t.n1.length),widths:new Float32Array(t.n1.length)};for(let n=0;n<t.n1.length;n++)l.from[n]=t.n1[n],l.to[n]=t.n2[n],l.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*c,l.colors[n]=e.selection.get(l.from[n])&&e.selection.get(l.to[n])?"255,255,0":"0,128,0",l.widths[n]=1;const u=a.DataFrame.create(l.from.length);return se.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?l.from[e]:l.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),s),u.col(e).semType=i})),u.columns.addNewFloat(te).init((e=>Math.abs(r.get(l.from[e])-r.get(l.to[e])))),u.columns.addNewInt(ie).init((e=>e)),u.columns.addNewFloat(ne).init((e=>t.saliVals[e])),u.columns.addNewFloat(re).init((e=>t.simVals[e])),u.name=`${Q}${J}`,{lines:l,linesDf:u}}(e,O,t,c,p,m,F,V);Z.lines.skipMultiLineCalculation=!0,Z.linesDf.col(ne).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const ae=new k(W,r[0],r[1],Z.lines,I.none),ce=b?b(Z.linesDf,se).sort([ne],[!1]):Z.linesDf.plot.grid().sort([ne],[!1]);ce.col(ie)&&(ce.col(ie).visible=!1),e.temp[".cliffsDfGrid"]=ce;const le=o.button(`${Z.linesDf.rowCount} cliffs`,(()=>{const e=X()(Y.viewers).some((e=>e.dataFrame.name===`${Q}${J}`));v&&!e&&Y.addViewer(ce),Y.dockManager.dock(ce,"down",null,"Activity cliffs",w??.2)}));le.classList.add("scatter_plot_link","cliffs_grid"),W.root.append(le);const ue=o.input.toggle("Show only cliffs",{value:!1,onValueChanged:t=>{t?(W.dataFrame.setTag(oe,r[0]),e.filter.and(H),ee.next(r[0])):(W.dataFrame.setTag(oe,""),e.filter.setAll(!0),ee.next(""))}});ue.root.classList.add("scatter_plot_link","show_only_cliffs"),W.root.append(ue.root),ee.subscribe((e=>{ue.enabled=""===e||e===r[0]}));let de=!1;W.onEvent("d4-before-draw-scene").subscribe((t=>{de?de=!1:ue.value&&(setTimeout((()=>{e.filter.and(H)}),100),de=!0)}));const he=s.events.onViewerClosed.subscribe((e=>{e.args.viewer===W&&(Y.dockManager.close(ce.root),he.unsubscribe(),Y.subs=Y.subs.filter((e=>e!==he)))}));return Y.subs.push(he),Z.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<Z.linesDf.rowCount;e++)Z.lines.widths[e]=e===Z.linesDf.currentRowIdx?3:1;ae.linesToRender=Z.lines;const n=Z.linesDf.currentCol&&Z.linesDf.currentCol.name===se[1]?Z.lines.to:Z.lines.from,i=-1!==Z.linesDf.currentRowIdx?Z.linesDf.currentRowIdx:null;if(W.dataFrame.currentRowIdx=i?n[i]:-1,null!==i){const n=Z.linesDf.currentRowIdx;ae.currentLineId=n;const{zoomLeft:a,zoomRight:l,zoomTop:u,zoomBottom:d}=function(e,t,n,r,i,s){const o=Math.abs(n-i),a=Math.abs(r-s),c=e/o,l=t/a,u=Math.min(c,l),d=e/u*5,h=t/u*5,p=(n<i?n:i)+o/2-d/2,m=(r>s?r:s)-a/2+h/2;return{zoomLeft:p,zoomRight:p+d,zoomTop:m,zoomBottom:m-h}}(W.viewport.width,W.viewport.height,W.dataFrame.get(r[0],Z.lines.from[n]),W.dataFrame.get(r[1],Z.lines.from[n]),W.dataFrame.get(r[0],Z.lines.to[n]),W.dataFrame.get(r[1],Z.lines.to[n]));W.zoom(a,u,l,d),ue.value?e.filter.and(H):!0===ue.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,r,i,a,c,l,u){const d=t.getPane("Cliff Details");o.empty(d.root);const h=u({points:[n,r],lineId:i,df:e,seqCol:a,activityCol:c,sali:l});d.root.append(h),setTimeout((()=>{s.shell.o=t.root}),500)}(e,C,Z.lines.from[i],Z.lines.to[i],i,t,c,Z.linesDf.get(ne,i),y);const n=W.dataFrame.getSortedOrder(Y.grid.sortByColumns,Y.grid.sortTypes);Y.grid.scrollToCell(t.name,n.indexOf(W.dataFrame.currentRowIdx))}),1e3)}})),Z.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<Z.linesDf.rowCount;e++){const n=Z.linesDf.selection.get(e);n&&(t.set(Z.lines.from[e],!0),t.set(Z.lines.to[e],!0)),Z.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),ae.linesToRender=Z.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(E?E=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<Z.lines.colors.length;e++)Z.lines.colors[e]="0,128,0";ae.linesToRender=Z.lines})(ce.dataFrame))})),ae.lineClicked.subscribe((t=>{if(E=!0,ae.currentLineId=t.id,-1!==t.id){const n=Z.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),Z.linesDf.selection.copyFrom(n)):(Z.linesDf.currentRowIdx!==t.id&&(Z.linesDf.currentRowIdx=t.id,e.currentRowIdx=Z.lines.from[t.id]),Z.linesDf.selection.copyFrom(n));const r=Z.linesDf.getSortedOrder(ce.sortByColumns,ce.sortTypes);ce.scrollToCell(se[0],r.indexOf(t.id))}),500)}})),ae.lineHover.pipe((0,P.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[Z.lines.from[n.id],Z.lines.to[n.id]],df:e,seqCol:t,activityCol:c}),n.x,n.y)})),W.addProperty("similarityLimit","double",A),C=function(){const e=o.accordion(),t=o.element("i");return t.className="grok-icon svg-icon svg-view-layout",e.addTitle(o.span([t,o.label("Activity cliffs")])),e.addPane("Cliff Details",(()=>o.divText("Cliff has not been selected")),!0),s.shell.o=e.root,e}(),W}var ce,le,ue=n(2003),de=n(826),he=n(3516),pe=n(6718),me=n(3077),fe=n(439);(le=ce||(ce={})).IDENTITY="identity",le.SIMILARITY="similarity";var ge,ye,be,we=n(9192),ve=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function Ae(e){const t=["Embed_X","Embed_Y"],n=e.columns.names().filter((e=>e.includes(t[0]))).length+1;return t.map((e=>`${e}_${n}`))}function Ce(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}n(5540),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(ge||(ge={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(ye||(ye={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(be||(be={})),Object.prototype.toString,n(6873);var Ee=n(4356),Te=(n(6717),n(4870),n(3856)),Se=n(6882),_e=n(7278),xe=(n(310),n(6642)),Me=n(3599);function Pe(e){const t=!X().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],r=t?"":" ";for(const[t,i]of X().enumerate(e)){let s=t;i<e.length&&(s+=`${t?"":"-"}${r}`),n.push(s)}return[n,t]}function Le(e,t,n,r,i,s,o){const a=document.createElement("canvas"),c=a.getContext("2d");c.font="12px monospace";const l=c.measureText(Pe([e]).join("")).width,u=c.measureText(Pe([t]).join("")).width,d=Math.max(l,u);return a.height=o,a.width=d+4,c.font="12px monospace",c.textBaseline="top",(0,Te.oZ)(c,e,0,i-s,d,o,{color:n,pivot:0,left:!0}),(0,Te.oZ)(c,t,0,i+s,d,o,{color:r,pivot:0,left:!0}),a}n(673),n(4139),xe.sD,ue.zS,a.GridCellRenderer,a.GridCellRenderer,a.GridCellRenderer;var Ne,$e,Ie,Re,Oe=n(8070),ke=n(4326);function De(e){const t=o.divH([],{style:{gap:"10px"}}),n=o.divV([o.divText(e.seqCol.name),o.divText(e.activityCol.name)]);return n.style.fontWeight="bold",n.style.display="flex",n.style.justifyContent="space-between",t.append(n),e.points.forEach((n=>{const r=o.divText(e.activityCol.get(n).toFixed(2));r.style.display="flex",r.style.justifyContent="left",r.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),r]))})),t}function Ge(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,r)=>{n[r]=e.activityCol.get(t)}));const r={},i=de.G.forColumn(e.seqCol),s=i.defaultBiotype,a=function(e,t,n,r){const i=document.createElement("canvas"),s=i.getContext("2d");i.height=30;const o=Gt();return function(e,t,n,r,i,s,o,a,c,l,u){if(s.length!==o.length){const e=function(e,t){let n=0,r=0;const i=e.length>t.length?e:t,s=e.length>t.length?t:e;for(let e=0;e<s.length;e++)i[e]===s[e]&&n++;const o=i.length-s.length;for(let e=i.length-1;e>o;e--)i[e]===s[e-o]&&r++;const a=new Array(Math.abs(e.length-t.length)).fill(fe.b9[ue.Hi.FASTA]);function c(e){return n>r?e.concat(a):a.concat(e)}return e.length>t.length?t=c(X()(t).toArray()):e=c(X()(e).toArray()),{subParts1:e,subParts2:t}}(s,o);s=e.subParts1,o=e.subParts2}const d=e.measureText(Pe(s).join("")),h=e.measureText(Pe(o).join("")),p=Math.max(d.width,h.width);l&&(r=p+4*s.length,e.canvas.width=p+4*s.length);let m=Math.max(t,t+(r-(p+4*s.length))/2)+5;const f=Math.max(n,n+(i-28)/2);e.save();try{e.beginPath(),e.rect(t,n,l?p+4*s.length:r,i),e.clip(),e.font="12px monospace",e.textBaseline="top";const d=7;for(let t=0;t<s.length;t++){const n=s[t],l=o[t];let h=Se.S$;if(c&&(h=c.getMonomerTextColor(a,n)),n!=l){let s=Se.S$;c&&(s=c.getMonomerTextColor(a,l));const o=(0,Te.oZ)(e,n,m,f-d,r,i,{color:h,pivot:0,left:!0}),p=(0,Te.oZ)(e,l,m,f+d,r,i,{color:s,pivot:0,left:!0});m=Math.max(p,o),u&&(u[t]=Le(n,l,h,s,f,d,i))}else m=(0,Te.oZ)(e,n,m,f,r,i,{color:h,pivot:0,left:!0,transparencyRate:.5});m+=4}}finally{e.restore()}}(s,0,0,0,30,X().count(0).take(e.length).map((t=>e.getCanonical(t))).toArray(),X().count(0).take(t.length).map((e=>t.getCanonical(e))).toArray(),n,o,!0,r),i}(i.getSplitted(e.points[0]),i.getSplitted(e.points[1]),s,r);return t.append(o.div(a,{style:{width:"300px",overflow:"scroll"}})),t.append(function(e){const t=o.div();if(Object.keys(e).length>0){const n=o.divV([]);n.append(o.divH([o.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),o.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const t of Object.keys(e))e[t].style.borderBottom="1px solid lightgray",n.append(o.divH([o.divText((parseInt(t)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),e[t]]));t.append(n)}return t}(r)),t.append(He("Activity delta",Math.abs(n[0]-n[1]))),t.append(He("Cliff",e.sali)),t}function He(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Fe(e,t){const n=a.Column.string("seq_diff",e.rowCount).init((n=>`${e.get(t[0],n)}#${e.get(t[1],n)}`));n.semType="MacromoleculeDifference",n.meta.units=e.col(t[0]).meta.units,n.setTag(ue.gp.separator,e.col(t[0]).getTag(ue.gp.separator)),e.columns.add(n);const r=e.plot.grid();return r.col(t[0]).visible=!1,r.col(t[1]).visible=!1,r}!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(Ne||(Ne={})),new class{constructor(){this.regionTypes=[Ne.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=ke.fH.Entropy,this.filterSource=ke.Fo.filterSource}},n(7602),n(8047),function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}($e||($e={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(Ie||(Ie={})),a.JsViewer,n(6863),n(2780),n(8115),a.JsViewer,n(1407),fe.b9[fe.Hi.FASTA],n(5433),n(3890),n(1687),function(e){e.TYPE="V2000",e[e.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",e[e.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",e[e.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",e[e.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",e[e.BOND_TYPE_COL=3]="BOND_TYPE_COL",e[e.RGP_SHIFT=8]="RGP_SHIFT",e[e.MAX_ATOM_COUNT=999]="MAX_ATOM_COUNT",e.RGP_LINE_START="M RGP",e.ATOM_ALIAS_LINE_START="A ",e.END="M END"}(Re||(Re={}));class Ue{constructor(e){this.init(e)}init(e){this.fileContent=e.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 e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var e;return null!==(e=this._atomTypes)&&void 0!==e||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var e;return null!==(e=this._pairsOfBondedAtoms)&&void 0!==e||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var e;return null!==(e=this._bondTypes)&&void 0!==e||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:e,bondCount:t}=this.parseAtomAndBondCounts();this._atomCount=e,this._bondCount=t}getNextColumnIdx(e){for(;!this.isWhitespace(e);)++e;for(;this.isWhitespace(e);)++e;return e}shiftIdxToSpecifiedColumn(e,t){let n=e;const r=this.isWhitespace(n)?t:t-1;for(let e=0;e<r;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToAtomType(n),t[r]=this.parseAtomType(n),n=this.getNextLineIdx(n);return t}parseAtomCoordinates(){const e=new Float32Array(this.atomCount),t=new Float32Array(this.atomCount),n=new Float32Array(this.atomCount);let r=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){r=this.shiftIdxToXColumn(r);for(const s of[e,t,n])s[i]=this.parseFloatValue(r),r=this.getNextColumnIdx(r);r=this.getNextLineIdx(r)}return{x:e,y:t,z:n}}parseBondedAtomPairs(){const e=new Array(this.bondCount);let t=this.getBondBlockIdx();for(let n=0;n<this.bondCount;n++){t=this.shiftIdxToBondedAtomsPair(t);const r=new Uint16Array(2);r[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),r[1]=this.parseIntValue(t),e[n]=r,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToBondType(n),t[r]=this.parseIntValue(n),n=this.getNextLineIdx(n);return t}isWhitespace(e){const t=this.fileContent[e];return" "===t||"\t"===t}getNextLineIdx(e){return"\n"!==this.fileContent[e]?this.fileContent.indexOf("\n",e)+1:e+1}parseFloatValue(e){return this.parseNumericValue(parseFloat,e)}parseIntValue(e){return this.parseNumericValue(parseInt,e)}parseNumericValue(e,t){let n=t+1;for(;!this.isWhitespace(n);)++n;return e(this.fileContent.substring(t,n))}}class Ve extends Ue{constructor(e){super(e),this.init(e)}init(e){super.init(e)}parseAtomType(e){let t=e,n=t;return this.isQuote(t)?(n=this.getNextIdenticalChar(t),t++):n=this.fileContent.indexOf(" ",n),this.fileContent.substring(t,n)}isQuote(e){const t=this.fileContent[e].charCodeAt(0);return 39===t||34===t}getNextIdenticalChar(e){const t=this.fileContent[e];return t?this.fileContent.indexOf(t,e+1):-1}isQuery(){return this.isQueryOrFragment(((e,t)=>{return 39===e||34===e||76===e&&!((n=this.fileContent.charCodeAt(t+1))>64&&n<91||n>96&&n<123);var n}))}isFragment(){return this.isQueryOrFragment((e=>82===e||42===e))}isQueryOrFragment(e){const t=this.atomCount;let n=this.getAtomBlockIdx();for(let r=0;r<t;r++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class Be extends Ve{constructor(e){super(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map,t=this.fileContent.split("\n");t.filter((e=>e.startsWith(Re.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,r]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,r)}}));const n=t.map(((e,t)=>{if(e.startsWith(Re.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),r=n.map((e=>t[e])),i=n.map((e=>t[e+1]));r.forEach(((t,n)=>{const r=parseInt(t.split(/\s+/)[1])-1,s=parseInt(i[n].substring(1));if(e.has(s))throw new Error(`R group ${s} is already in the map`);e.set(s,r)}));const s=this.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==s.length)throw new Error(`Unaccounted R group indices: ${s}`);return e}getAtomIdxToRgpIdxList(e){const t=e.split(/\s+/).filter((e=>e)).slice(3).map((e=>parseInt(e))),n=new Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=[t[e+1],t[e]-1];return n}getRGroupAtomicIndices(){return this.atomTypes.map(((e,t)=>{if(e.includes("R#"))return t})).filter((e=>void 0!==e))}static isValidMolfile(e){return-1!==e.indexOf(Re.TYPE)&&-1!==e.indexOf(Re.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,Re.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<Re.NUM_OF_HEADER_LINES;++t)e=this.getNextLineIdx(e);return e}getAtomBlockIdx(){let e=this.getCountsLineIdx();return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){return this.getNextColumnIdx(e)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,Re.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,Re.BOND_TYPE_COL)}getBondBlockIdx(){let e=this.getAtomBlockIdx();for(let t=0;t<this.atomCount;t++)e=this.getNextLineIdx(e);return e}parseAtomAndBondCounts(){let e=this.getCountsLineIdx(),t=e+Re.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=Re.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Ye extends Ve{constructor(e){super(e),this.init(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map;return this.getAtomLines().forEach(((t,n)=>{const r=t.match(/RGROUPS=\(([\d\s]+)\)/);if(r){const t=r[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const i=t[1];if(e.has(i))throw new Error(`R group ${i} is already in the map`);e.set(i,n)}})),e}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let e=this.fileContent.indexOf("M V30 BEGIN ATOM");return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){let t=this.shiftIdxToAtomType(e);return this.isQuote(t)?(t=this.getNextIdenticalChar(t),t=this.getNextColumnIdx(t),t):this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static isValidMolfile(e){return-1!==e.indexOf("V3000")&&-1!==e.indexOf("M END")}parseAtomAndBondCounts(){let e=this.fileContent.indexOf("M V30 COUNTS ")+14,t=this.fileContent.indexOf(" ",e+1);const n=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class We{constructor(){}static getInstance(e){if(We.isMolfileV2K(e))return new Be(e);if(We.isMolfileV3K(e))return new Ye(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return Be.isValidMolfile(e)}static isMolfileV3K(e){return Ye.isValidMolfile(e)}}var je=n(6197),Ke=n(9124),ze=n(3527);class qe{biotype;id;n;m;type;mt;smiles;get issmiles(){return!!this.smiles}at={R1:"H",R2:"H",R3:"H",R4:"H",R5:"H",R6:"H",R7:"H",R8:"H",R9:"H"};get rs(){return Object.keys(this.at).length}constructor(e,t,n="missing",r=void 0,i=void 0,s=void 0,o){if(this.biotype=e,this.id=t,this.n=n,this.m=r,this.type=i,this.mt=s,this.smiles=o,!this.id)throw new Error("Invalid arg undefined [id].")}static objCounter=-1;objId=++qe.objCounter;className="WebEditorMonomerDummy";toLog(){return`Helm: ${this.className}<${this.objId}>`}}class Ze extends qe{backgroundcolor="#FFFFFF";linecolor="#808080";textcolor="#808080";constructor(e){super(e,"*","gap")}}class Xe extends qe{backgroundcolor="#808080";linecolor="#000000";textcolor="#000000";constructor(e,t){super(e,t,"ambiguous")}}class Je extends qe{backgroundcolor="#FF4444";linecolor="#800000";textcolor="#FFFFFF";constructor(e,t,n){super(e,t,"missing"),n&&(this.backgroundcolor="#C0C0C0",this.linecolor="#404040",this.textcolor="#404040")}}class Qe extends qe{backgroundcolor="#FFFF44";linecolor="#800000";textcolor="#000000";constructor(e,t){super(e,t,"broken")}}class et{id;m;n;na;type;mt;at;smiles;get rs(){return Object.keys(this.at).length}get issmiles(){return!!this.smiles}linecolor;backgroundcolor;textcolor;constructor(e,t,n,r,i,s,o,a){this.id=e,this.m=t,this.n=n,this.na=r,this.type=i,this.mt=s,this.at=o,this.smiles=a}static fromMonomer(e,t,n){let r={};const i=t.symbol,s=t.smiles;if(t.rgroups.length>0)t.rgroups.forEach((e=>{r[e.label]=e.capGroupName}));else{if(!s){if(t.lib)return new Qe(e,i);throw new Error("Unexpected missing monomer without .lib")}r=n.getRS(s)}const o=new et(t.symbol,t.molfile,t.name,t.naturalAnalog,t.polymerType,t.monomerType,r),a=n.getMonomerColors(e,t.symbol);return a&&(o.textcolor=a?.textcolor,o.linecolor=a?.linecolor,o.backgroundcolor=a?.backgroundcolor),o}}const tt={[Me.o.BASE]:{A:"green",G:"black",T:"red",C:"blue",U:"red"},[Me.o.NUCLEOTIDE]:{A:"green",G:"black",T:"red",C:"blue",U:"red"},[Me.o.LINKER]:{P:"#9aa5e1",p:"#9aa5e1"},[Me.o.SUGAR]:{R:"#7a85c1",r:"#7a85c1"},[Me.o.AA]:{A:"rgb(44,160,44)",R:"rgb(23,190,207)",N:"rgb(235,137,70)",D:"rgb(31,119,180)",C:"rgb(188,189,34)",E:"rgb(31, 120, 150)",Q:"rgb(205, 111, 71)",G:"rgb(214,39,40)",H:"rgb(158,218,229)",I:"rgb(23,103,57)",L:"rgb(30,110,96)",K:"rgb(108, 218, 229)",M:"rgb(60,131,95)",F:"rgb(24,110,79)",P:"rgb(255,152,150)",S:"rgb(255,187,120)",T:"rgb(245,167,100)",W:"rgb(182, 223, 138)",Y:"rgb(152,223,138)",V:"rgb(74,160,74)"},[Me.o.CHEM]:{R:"#eeeeee"},[Me.o.BLOB]:{B:"#999999",G:"#e2e2e2"}},nt=/[\w()]+/,rt=RegExp(String.raw`\(${nt}(,${nt})+\)`),it=new ze.Mi([255,255,255]),st=new ze.Mi([0,0,0]),ot=.7*(0,F.wQ)(it);class at{_monomers;_isEmpty;get isEmpty(){return this._isEmpty}_onChanged=new u.Subject;get onChanged(){return this._onChanged}constructor(e){this._monomers=e,this._isEmpty=!this._monomers||0===Object.keys(this._monomers).length||Object.entries(this._monomers).every((([e,t])=>0===Object.keys(t).length))}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let r=t;return t==fe._S||t===fe.b9[fe.Hi.HELM]?r="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(r="Any"),n[t]={symbol:t,name:r,molfile:"",author:"MISSING",id:-1,rgroups:X().count(1).take(9).map((e=>({capGroupSmiles:"",alternateId:"",capGroupName:"",label:`R${e.toString()}`}))).toArray(),smiles:"",polymerType:e,monomerType:void 0,createDate:null}}getMonomer(e,t){let n=t;"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p");let r=null;if(e){const t=this._monomers[e];r=t?t[n]:null}else{Ot.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(r=t[n],r)break}return r}getWebEditorMonomer(e,t){const[n,r]=(0,Ke.fA)(e,t),i=(0,je.Y)(n);let s=this.getMonomer(i,r);if(s&&n==Me.o.LINKER&&2!=s.rgroups.length)return null;if(s&&n==Me.o.SUGAR&&3!=s.rgroups.length)return null;s||(s=this.addMissingMonomer(i,r));let o=s.wem??null;return o||(r===fe._S||"*"==r?o=s.wem=new Ze(n):n===Me.o.NUCLEOTIDE&&"N"===r||n===Me.o.AA&&"X"===r||(Me.o.CHEM,0)||rt.test(r)?o=s.wem=new Xe(n,r):s.lib||(o=s.wem=new Je(n,r,this.isEmpty)),o||(o=s.wem=et.fromMonomer(n,s,this))),o}getTooltip(e,t){const n=(0,je.Y)(e),r=o.div([],{classes:"ui-form ui-tooltip"}),i=this.getMonomer(n,t);if(i){const n=i.symbol,a=(i.name,this.getWebEditorMonomer(e,t));a.backgroundcolor,r.append(o.divH([o.div([n],{style:{textWrap:"nowrap",marginLeft:"4px",marginRight:"4px",color:a.textcolor,backgroundColor:a.backgroundcolor,borderColor:a.linecolor,borderWidth:"1px",borderStyle:"solid",borderRadius:"2px",padding:"3px",minWidth:"24px",textAlign:"center"}}),o.div([i.name],{style:{padding:"4px"}})],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const c={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let l;l=i.molfile?s.chem.svgMol(i.molfile,void 0,void 0,c):i.smiles?o.divV([s.chem.svgMol(i.smiles,void 0,void 0,c),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),r.append(o.div(l,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),i.symbol!=fe._S&&r.append(o.divText(i.lib?.source??"Missed in libraries"))}else r.append(o.divV([o.divText(`Monomer '${t}' of type '${n}' not found.`),o.divText("Open the Context Panel, then expand Manage Libraries")]));return r}getMonomerTextColor(e,t){const n=this.getMonomerColors(e,t),r=e=>{const t=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e);if(t)return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])];const r=a.Color.fromHtml(n.textcolor);return[a.Color.r(r),a.Color.g(r),a.Color.b(r)]},i=r(n.textcolor),s=new ze.Mi([...i.map((e=>e+1))]),o=(0,F.KE)(s,it)/((0,F.wQ)(s)*(0,F.wQ)(it)),c=r(n.backgroundcolor),l=new ze.Mi([...c.map((e=>e+.01))]);let u;u=(0,F.KE)(l,it)/((0,F.wQ)(l)*(0,F.wQ)(it))<o?c:i;let d=new ze.Mi(u);const h=(0,F.wQ)(d);return h>ot&&(d=(0,F.dC)(st,d,ot/h)),`rgb(${d[0]}, ${d[1]}, ${d[2]})`}getMonomerColors(e,t){const n="default";let r=n;const i=(0,je.Y)(e),s=this.getMonomer(i,t);let o;if(s){if(s.meta&&s.meta.colors){const e=s.meta.colors;n in e||(r="default"),o=e[r]}if(!o){const t=tt[e],n=t?.[s.symbol];n&&(o={textColor:a.Color.toHtml(a.Color.getContrastColor(a.Color.fromHtml(n))),lineColor:"#202020",backgroundColor:n})}const t=s.naturalAnalog;if(!o&&t)return this.getMonomerColors(e,t)}return o||(o={textColor:"#202020",lineColor:"#202020",backgroundColor:"#A0A0A0"}),{textcolor:o.text??o.textColor,linecolor:o.line??o.lineColor,backgroundcolor:o.background??o.backgroundColor}}getRS(e){const t=e.match(/(?<=\[)[^\][]*(?=])/gm),n={};let r,i="";if(t)for(let e=0;e<t.length;e++)if(null!=t[e]&&/\d/.test(t[e])){r=t[e][t[e].length-1],t[e]=t[e].replace(/[0-9]/g,"");for(let n=0;n<t[e].length;n++)":"!=t[e][n]&&(i+=t[e][n]);n["R"+r]=i,i=""}return n}}var ct=n(5488),lt={};lt.styleTagTransform=C(),lt.setAttributes=b(),lt.insert=g().bind(null,"head"),lt.domAPI=m(),lt.insertStyleElement=v(),h()(ct.A,lt),ct.A&&ct.A.locals&&ct.A.locals;class ut extends at{source;error;_duplicateMonomers={};get duplicateMonomers(){return this._duplicateMonomers}_duplicatesHandled=!0;get duplicatesHandled(){return this._duplicatesHandled}duplicatesNotified=!1;constructor(e,t=void 0,n=void 0){super(e),this.source=t,this.error=n;for(const[e,t]of Object.entries(this._monomers))for(const[e,n]of Object.entries(t))n.lib=this}toJSON(){const e=[];for(const t of Object.values(this._monomers))for(const n of Object.values(t))e.push({...n,lib:void 0,wem:void 0});return e}getMonomer(e,t){let n=t;"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p");let r=null;if(e){const t=this._monomers[e];r=t?.[n]??null}else{Ot.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(r=t[n],r)break}return r}_monomerSets=null;getMonomerSet(e){const t=(0,je.Y)(e);if(this._monomerSets||(this._monomerSets={}),!(e in this._monomerSets))for(const[e,n]of Object.entries(this._monomers[t]));return this._monomerSets[e]}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(e){const t={};return Object.keys(this._monomers[e]??{}).forEach((n=>{t[n]=this._monomers[e][n].molfile})),t}getMonomerSymbolsByType(e){return Object.keys(this._monomers[e])}getMonomerSymbolsByRGroup(e,t,n){let r=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return r=r.filter((e=>null!==e)),0===r.length?[]:(r=r.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;var r;return r=We.getInstance(t.molfile).atomTypes,r.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&=!0,n})),r.map((e=>e?.symbol)))}_updateLibInt(e){const t=e.getPolymerTypes(),n=this.getPolymerTypes();t.forEach((t=>{n.includes(t)||(this._monomers[t]={}),e.getMonomerSymbolsByType(t).forEach((n=>{this._monomers[t][n]&&(this._duplicateMonomers[t]??={},this._duplicateMonomers[t][n]??=[this._monomers[t][n]],this._duplicateMonomers[t][n].push(e.getMonomer(t,n))),this._monomers[t][n]=e.getMonomer(t,n)}))})),this._isEmpty=this.isEmpty&&e.isEmpty}updateLibs(e,t=!1){t&&(this._monomers={},this._isEmpty=!0),this._duplicateMonomers={};for(const t of e)t.error||this._updateLibInt(t);Object.entries(this.duplicateMonomers).length>0?(0,Ee.ub)().then((e=>{this.assignDuplicatePreferences(e)})):this._duplicatesHandled=!0,this._onChanged.next()}assignDuplicatePreferences(e){let t=!0;for(const n in this.duplicateMonomers)for(const r in this.duplicateMonomers[n])if(e.duplicateMonomerPreferences?.[n]?.[r]){const i=e.duplicateMonomerPreferences[n][r],s=this.duplicateMonomers[n][r].find((e=>e.lib?.source===i));s?this._monomers[n][r]=s:t=!1}else t=!1;return this._duplicatesHandled=t,t}clear(){this._monomers={},this._onChanged.next()}getSummaryObj(){const e={},t=this.getPolymerTypes();for(const n of t)e[n]=this.getMonomerSymbolsByType(n).length;return e}getSummaryDf(){const e=this.getPolymerTypes(),t=new Array(e.length);for(const[n,r]of X().enumerate(e))t[r]=this.getMonomerSymbolsByType(n).length;return a.DataFrame.fromColumns([a.Column.fromStrings("polymerType",e),a.Column.fromList(a.COLUMN_TYPE.INT,"count",t)])}getSummary(){const e=this.getPolymerTypes();return 0==e.length?"empty":e.map((e=>`${e} ${this.getMonomerSymbolsByType(e).length}`)).join("\n")}override(e){return new dt(e,this)}}class dt extends at{data;base;constructor(e,t){super(e),this.data=e,this.base=t}get onChanged(){return this.base.onChanged}addMissingMonomer(e,t){return this.base.addMissingMonomer(e,t)}getMonomer(e,t){const n=this.data[e]?.[t];return n??this.base.getMonomer(e,t)}}class ht{monomerLib;symbol;polymerType;monomerType;monomerLinks;monomers;error=null;constructor(e,t,n,r,i){this.monomerLib=e,this.symbol=t,this.polymerType=n,this.monomerType=r,this.monomerLinks=i;try{this.monomers=this.monomerLinks.map((e=>{const n=this.monomerLib.getMonomer(this.polymerType,e.symbol);if(!n)throw new Error("Monomer not found: ");if(n.lib?.source!=e.source)throw new Error(`Monomer '${t}' found in different library.`);return n}))}catch(e){const[t,n]=(0,we.AP)(e);this.error=t,this.monomers=[]}}}class pt{description;placeholders;source;error;constructor(e,t,n=void 0,r=void 0){this.description=e,this.placeholders=t,this.source=n,this.error=r}updateSets(e,t=!1){t&&(this.placeholders=[]);for(const t of e)t.error||this._updateSetInt(t)}_updateSetInt(e){for(const t of e.placeholders)this.placeholders.push(t)}}var mt=n(7433),ft=n.n(mt),gt=n(1913),yt=n.n(gt);class bt{helmMonomerSchema;validateMonomerSchema;constructor(e){this.helmMonomerSchema=e;const t=new(ft())({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});yt()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const n=this.parseJson(e,t);return null!==n&&(Array.isArray(n)?this.validateJsonContent(n,t):(console.warn(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format: The file must contain an array of monomers.`),!1))}parseJson(e,t){try{return JSON.parse(e)}catch(e){return console.error(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format:`,e),null}}validateJsonContent(e,t){let n=!0;const r=new Set;for(const i of e){const e=i.symbol??i.id??i.name??"#N/A";if(n=this.validateMonomerSchema(i),!n){console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' violating JSON schema:`,i,"\nError reason: ",this.validateMonomerSchema.errors,`\nThere may be other errors in ${t} since the validation is stopped after the first error.`," Please, verify that the monomer library file satisfies the JSON schema");break}const s=`${i.polymerType??""}-${e}`;r.has(s)&&console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' is duplicated.`,"Please, verify that the monomer library file does not contain duplicated monomer symbols."),r.add(s)}return n}}var wt=n(8604);class vt{fileValidator;libHelper;eventManager;logger;filesPromise=Promise.resolve();constructor(e,t,n,r){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.logger=r,this.eventManager.updateValidLibraryFileListRequested$.subscribe((()=>{this.updateValidLibList().then((()=>{}))})),this.eventManager.updateValidSetFileListRequested$.subscribe((()=>{this.updateValidSetList().then((()=>{}))}))}static objCounter=-1;objId=++vt.objCounter;toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t,n){const r=await s.dapi.files.readAsText(wt.gt),i=JSON.parse(r),o=new bt(i);return new vt(o,e,t,n)}async addLibraryFile(e,t,n=!0){try{if(await s.dapi.files.exists(wt.so+`${t}`))return void s.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await s.dapi.files.writeAsText(wt.so+`${t}`,e),await this.updateValidLibList(),await s.dapi.files.exists(wt.so+`${t}`)?s.shell.info(`Added ${t} HELM library`):s.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),s.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await s.dapi.files.delete(wt.so+`${e}`),await this.updateValidLibList(),s.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await s.dapi.files.exists(wt.so+`${e}`)?s.shell.error(`Failed to delete ${e} library`):s.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let n=[];const r=new a.FileSource(e),i=await r.readAsText(t);n=JSON.parse(i);const s={},o=[];return n.forEach((e=>{const t=e.polymerType,n=e.symbol;o.includes(t)||(s[t]={},o.push(t)),s[t][n]=e})),new ut(s,t)}async loadSetFromFile(e,t,n){let r={};const i=new a.FileSource(t),s=await i.readAsText(n);r=JSON.parse(s);const o=r.description,c=Object.entries(r.placeholders).map((([t,n])=>{const r=t,i=n.polymerType,s=n.monomerType,o=n.set;return new ht(e,r,i,s,o)}));return new pt(o,c)}getValidLibraryPaths(){return this.eventManager.getValidLibPathList()}getValidSetPaths(){return this.eventManager.getValidSetPathList()}async getValidLibraryPathsAsynchronously(){return await this.eventManager.getValidLibraryPathsAsynchronously()}async updateValidLibList(){const e=`${this.toLog()}.updateValidLibList()`;return this.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{this.logger.debug(`${e}, IN`);const t=[],n=await this.getLibFileListAtLocation();if(!this.libListHasChanged(n))return void this.logger.debug(`${e}, end, not changed`);for(const e of n){if(!e.endsWith(".json")){t.push(e);continue}const n=await s.dapi.files.readAsText(wt.so+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const r=n.filter((e=>!t.includes(e)));if(this.libListHasChanged(r)&&(this.eventManager.changeValidLibPathList(r),this.libHelper.loadMonomerLib(!0)),r.some((e=>!e.endsWith(".json")))&&this.logger.warning(`Wrong validation: ${r}`),t.length>0){const e=`Invalid monomer library files in ${wt.so}, consider fixing or removing them: ${t.join(", ")}`;this.logger.warning(e)}this.logger.debug(`${e}, OUT`)})),this.logger.debug(`${e}, end`),this.filesPromise}async updateValidSetList(){const e=`${this.toLog()}.updateValidSetList()`;return Ot.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{Ot.logger.debug(`${e}, IN`);const t=[],n=await this.getSetFileListAtLocation();if(!this.setListHasChanged(n))return void Ot.logger.debug(`${e}, end, not changed`);for(const e of n)e.endsWith(".json")?await s.dapi.files.readAsText(wt.Es+`${e}`):t.push(e);const r=n.filter((e=>!t.includes(e)));this.setListHasChanged(r)&&(this.eventManager.changeValidSetPathList(r),this.libHelper.loadMonomerSets(!0)),Ot.logger.debug(`${e}, OUT`)})),Ot.logger.debug(`${e}, end`),this.filesPromise}libListHasChanged(e){const t=this.eventManager.getValidLibPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}setListHasChanged(e){const t=this.eventManager.getValidSetPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}async validateAgainstHELM(e,t){if(!this.isValidHELMLibrary(e,t))throw new Error(`File ${t} does not satisfy HELM standard`)}isValidHELMLibrary(e,t){return this.fileValidator.validateFile(e,t)}async getLibFileListAtLocation(){const e=`${this.toLog()}.getLibFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(wt.so).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(wt.so.length)))}async getSetFileListAtLocation(){const e=`${this.toLog()}.getSetFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(wt.Es).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(wt.Es.length)))}}class At{constructor(){}static _instance;static getInstance(){return At._instance||(At._instance=new At),At._instance}_libFilesUpdateSubject$=new u.BehaviorSubject([]);_setFilesUpdateSubject$=new u.BehaviorSubject([]);_addLibraryFilesSubject$=new u.Subject;_librarySelectionSubject$=new u.Subject;getValidLibPathList(){return this._libFilesUpdateSubject$.getValue()}getValidSetPathList(){return this._setFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{const t=this._libFilesUpdateSubject$.pipe((0,P.skip)(1)).subscribe((n=>{e(n),t.unsubscribe()}))}))}changeValidLibPathList(e){this._libFilesUpdateSubject$.next(e)}changeValidSetPathList(e){this._setFilesUpdateSubject$.next(e)}get updateUIControlsRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidLibraryFileListRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidSetFileListRequested$(){return this._setFilesUpdateSubject$.pipe()}get addLibraryFileRequested$(){return this._addLibraryFilesSubject$.pipe()}addLibraryFile(){this._addLibraryFilesSubject$.next()}get librarySelectionRequested$(){return this._librarySelectionSubject$}updateLibrarySelectionStatus(e,t){this._librarySelectionSubject$.next([e,t])}}class Ct{logger;_monomerLib=new ut({},"MAIN");_monomerSets=new pt("MAIN",[]);_eventManager;get eventManager(){return this._eventManager}async awaitLoaded(e=5e3){return await Promise.race([(async()=>{const e=await this.getFileManager();return await e.filesPromise,!0})(),(async()=>(await(0,Oe.cb)(e),!1))()]).then((t=>{if(!t)throw new Error(`Loading monomer libraries timeout ${e} ms.`)}))}constructor(e){this.logger=e}static objCounter=-1;objId=(()=>{if(++Ct.objCounter>0)throw new Error("MonomerLibManager MUST be a singleton.");return Ct.objCounter})();toLog(){return`MonomerLibManager<${this.objId}>`}getMonomerLib(){return this._monomerLib}getBioLib(){return this.getMonomerLib()}getMonomerSets(){return this._monomerSets}get duplicateMonomers(){return this._monomerLib.duplicateMonomers}get duplicatesHandled(){return this._monomerLib.duplicatesHandled}assignDuplicatePreferances(e){this._monomerLib.assignDuplicatePreferences(e)}_fileManagerPromise;async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await vt.create(this,this._eventManager,this.logger))()),this._fileManagerPromise}loadLibrariesPromise=Promise.resolve();async loadMonomerLib(e=!1){const t=`${this.toLog()}.loadMonomerLib()`;return this.logger.debug(`${t}, start`),this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{this.logger.debug(`${t}, IN`);const n=a.TaskBarProgressIndicator.create("Loading monomers ...");try{const[[t],r]=await Promise.all([await this.getFileManager().then((e=>[e.getValidLibraryPaths()])),(0,Ee.ub)()]),i=t.filter((e=>{const t=!r.exclude.includes(e),n=0===r.explicit.length||r.explicit.includes(e);return t&&n}));let s=0;const o=i.length,[a]=await Promise.all([Promise.all(i.map((e=>this.readLibrary(wt.so,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new ut({},e,n)})).finally((()=>{n.update(Math.round(100*++s/o),`Loading monomers ${s}/${o}`)})))))]);this._monomerLib.updateLibs(a,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{n.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadLibrariesPromise}async loadLibraries(e){return this.loadMonomerLib(e)}loadSetsPromise=Promise.resolve();async loadMonomerSets(e=!1){const t=`${this.toLog()}.loadMonomerSets()`;return this.logger.debug(`${t}, start`),this.loadSetsPromise=this.loadSetsPromise.then((async()=>{this.logger.debug(`${t}, IN`);const e=a.TaskBarProgressIndicator.create("Loading monomer sets ...");try{const[[t]]=await Promise.all([await this.getFileManager().then((e=>[e.getValidSetPaths()]))]),n=t.filter((e=>!0));let r=0;const i=n.length,[s]=await Promise.all([Promise.all(n.map((t=>this.readSet(wt.Es,t).catch((e=>{const n=`Loading monomer sets from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new pt("Broken monomer set",[],t,n)})).finally((()=>{e.update(Math.round(100*++r/i),`Loading monomers ${r}/${i}`)})))))]);this._monomerSets.updateSets(s)}catch(e){const t=`Loading monomer sets error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{e.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadSetsPromise}async readLibrary(e,t){const n=await this.getFileManager();return await n.loadLibraryFromFile(e,t)}async readSet(e,t){const n=await this.getFileManager();return await n.loadSetFromFile(this._monomerLib,e,t)}async selectSpecifiedLibraries(e){const t=await this.getInvalidFileNames(e);if(t.length>0)throw new Error(`Cannot select libraries ${t}: no such library in the list`);const n=await(0,Ee.ub)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,Ee.Eu)(n)}async getInvalidFileNames(e){const t=(await this.getFileManager()).getValidLibraryPaths();return e.filter((e=>!t.includes(e)))}async loadMonomerLibForTests(){await(0,Ee.Eu)(wt.G3),await this.awaitLoaded(),await this.loadMonomerLib(!0)}static async getInstance(){let e=window.$monomerLibHelperPromise;return null==e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new Ct(Ot.logger);return e._eventManager=At.getInstance(),e})()),e}}n(1757);var Et=n(3017),Tt={};Tt.styleTagTransform=C(),Tt.setAttributes=b(),Tt.insert=g().bind(null,"head"),Tt.domAPI=m(),Tt.insertStyleElement=v(),h()(Et.A,Tt),Et.A&&Et.A.locals&&Et.A.locals,n(3151);new O.A(new Uint32Array([2,0,0,0,16,0,0,0,134217728,0,0,0,32,0,33554432,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,32,0,0,2,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,65536,0,0,524288,0,0,0,0,0,0,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536870912,64,0,0,0]),2048),new O.A(new Uint32Array([2,0,65600,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,2097152,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,512,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,16,134217728,0,0,0,0,0,0,524288,0,0,0,128,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,512,2147483648,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,33554432,0,0,0,0,33554432,0,1024,1,0,524288,32768,32,0,0,0,0,16,524288,0,0,0,0,0,0,0,0,0,71303168,0,0,34603008,131072,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([134217728,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,0,128,0,0,0,0,2097216,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,1073840128,0,0,0,0,0,0,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,512,0,262144,192,0,268435456,0,0,8200,0,0,0,67108864,0,524296,0,32,0,0,0,0,16,524288,0,0,2147483648,0,0,8,0,0,0,0,0,0,34603008,131072,536870920,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,150994944,64,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,327680,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,8388608,0,33554432,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,268435488,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,2097152,0,0,67108864,0,0,524288,0,0,0,8,0,0,0,524288,0,0,8192,0,0,0,0,0,0,0,2147483648,0,34668544,0,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,134217728,0,0,0,32,512,0,0,0,0,0,0,1024,256,0,8388608,262400,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,42991616,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2050,0,65536,1048576,0,0,0,0,0,0,0,0,1056,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,0,536870912,0,2,0,0,1074266112,0,0,0,0,0,0,0,524288,0,0,0,4194304,0,0,0,0,0,0,2147483648,0,34603008,0,536870912,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,16777216,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536871936,67108864,0,0,0]),2048),new O.A(new Uint32Array([0,0,1024,0,0,0,0,0,0,131072,0,1024,32,0,0,0,0,512,0,0,1024,0,0,64,0,128,0,0,1073741824,0,0,138412032,16,0,67108864,0,0,0,0,0,0,8192,0,0,8388608,0,0,8,0,0,0,0,0,0,256,0,0,0,0,553648128,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,0,32,0,0,0,0,2,0,0,1024,0,0,8,262144,128,0,0,16,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,16777216,2147483648,0,34603008,0,536871936,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,32,0,0,0,0,0,268435488,0,0,0,0,0,0,32768,134218752,0,16,8,262144,128,0,1073741824,0,0,8388608,0,0,0,65536,0,524289,0,0,0,0,0,0,0,524288,2048,0,0,0,0,0,0,0,0,0,2147483648,0,34603008,1048576,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,1073741824,0,0,0,0,0,32,0,0,4,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,1048576,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,8388608,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,8,134217728,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,536870912,0,0,0,0,1048576,67108864,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,0,134217728,0,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,1073741824,128,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,8388608,0,0,0,0,0,0,256,4096,32,0,0,0,0,0,0,0,1024,0,0,0,262144,192,0,0,0,0,0,0,0,0,67108865,0,524288,32768,32,0,0,0,8224,16,524288,0,0,0,0,32,128,0,2097152,0,4194304,8388608,0,34603008,8519680,536870912,131072,262144,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,4194304,0,0,32,0,0,0,0,0,0,0,1024,0,0,512,262144,128,33554432,0,0,0,0,33554432,0,0,0,0,524288,0,32,0,0,2,0,16,524288,0,0,0,0,0,4,0,0,0,71303168,262144,0,34603008,131072,536870912,0,0,0,0]),2048);new O.A(new Uint32Array([0,0,0,0,0,0,0,0,0,1024,0,67108864,0,0,0,512,0,0,0,8388608,0,0,512,0,0,64,4,0,0,0,4,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,659456,0,256,0,16,0,0,0,268435456,0,0,262144,0,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([0,1073741824,0,0,0,0,0,2147483648,4,67108864,0,67108864,0,256,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,0,67108864,0,524289,0,65536,0,0,0,0,16,0,131072,0,4,0,0,0,0,0,0,4194304,0,0,2147483648,131072,0,4096,0,0,0]),2048),new O.A(new Uint32Array([0,0,0,0,1024,0,0,0,0,67109888,16384,67108864,0,0,0,0,0,0,0,33562624,1024,33554432,512,16384,0,64,4,0,0,33554432,0,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,135168,0,268435456,0,0,0,0,0,268435456,131072,0,0,2147483648,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([8388608,0,0,0,0,0,0,0,0,67108864,0,0,0,4,0,0,0,0,0,0,1024,0,0,16384,0,64,0,0,0,0,0,0,0,2,67108864,0,0,0,0,0,0,0,0,40976,0,0,0,0,0,0,0,0,0,67108864,131072,524288,0,0,8519680,0,1,33554432,1048576,0]),2048),new O.A(new Uint32Array([0,0,131072,1073741824,0,0,0,0,0,67108864,0,0,0,0,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,32768,67108864,0,0,0,0,0,0,0,0,16,0,0,0,4,0,0,2048,0,0,0,4341760,0,0,0,131072,0,0,33554432,1048576,0]),2048);var St,_t=n(857),xt={};xt.styleTagTransform=C(),xt.setAttributes=b(),xt.insert=g().bind(null,"head"),xt.domAPI=m(),xt.insertStyleElement=v(),h()(_t.A,xt),_t.A&&_t.A.locals&&_t.A.locals,function(e){e.MONOMER="Monomer",e.SYMBOL="Symbol",e.NAME="Name",e.R_GROUPS="~R-Groups",e.MONOMER_TYPE="Monomer Type",e.POLYMER_TYPE="Polymer Type",e.NATURAL_ANALOG="Natural Analog",e.AUTHOR="Author",e.CREATE_DATE="Create Date",e.ID="ID",e.META="Meta",e.SOURCE="Source"}(St||(St={})),St.MONOMER,a.COLUMN_TYPE.STRING,St.SYMBOL,a.COLUMN_TYPE.STRING,St.NAME,a.COLUMN_TYPE.STRING,St.R_GROUPS,a.COLUMN_TYPE.STRING,St.MONOMER_TYPE,a.COLUMN_TYPE.STRING,St.POLYMER_TYPE,a.COLUMN_TYPE.STRING,St.NATURAL_ANALOG,a.COLUMN_TYPE.STRING,St.AUTHOR,a.COLUMN_TYPE.STRING,St.CREATE_DATE,a.COLUMN_TYPE.DATE_TIME,St.ID,a.COLUMN_TYPE.INT,St.META,a.COLUMN_TYPE.STRING,St.SOURCE,a.COLUMN_TYPE.STRING;var Mt,Pt=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class Lt{constructor(e,t,n=!1,r){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=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._stopStartBtn=o.button(o.iconFA("pause"),(()=>Pt(this,void 0,void 0,(function*(){return yield this._changeStopState()}))),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>Pt(this,void 0,void 0,(function*(){return yield this._restartScript()}))),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>Pt(this,void 0,void 0,(function*(){this._isStepProcessed||(yield this._nextStep())}))),"Next step"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._closeBtn=o.button(o.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=e,this.description=t,this._isAutomatic=n,this._autoStartFirstStep=null!==(i=null==r?void 0:r.autoStartFirstStep)&&void 0!==i&&i,this._progress.max=0,this._progress.value=1,Lt.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=o.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var e;this._activity.append(o.div(this.description,"tutorials-root-description"));for(let t=0;t<this.stepNumber;t++){let n=o.iconFA("clock");this._isAutomatic||0===t&&(n=o.iconFA("play",(()=>this._nextStep()),"Next step"),n.className="grok-icon fas fa-play");const r=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),i=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),s=o.divH([n,r],"grok-tutorial-entry");this._activity.append(s,i)}}_initRoot(){var e,t,n;s.shell.windows.showContextPanel=!0,s.shell.windows.showHelp=!1;const r=s.shell.isInDemo?Array.from(s.shell.view("Browse").dockManager.rootNode.children)[0]:Array.from(s.shell.dockManager.rootNode.children)[0];this._node=s.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,r,""),(null===(t=null===(e=r.parent.container.containerElement.firstElementChild)||void 0===e?void 0:e.lastElementChild)||void 0===t?void 0:t.classList.contains("tab-handle-list-container"))&&(null===(n=r.parent.container.containerElement.firstElementChild)||void 0===n||n.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 e,t;return Pt(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],r=this._activity.getElementsByClassName("grok-icon")[this._currentStep],i=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];r.className="grok-icon far fa-spinner-third fa-spin",i.classList.remove("hidden"),i.classList.add("visible");const c=n,l=(null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay)?null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay:2e3;try{s.shell.isInDemo=!0,yield this._steps[this._currentStep].func()}catch(e){s.shell.isInDemo=!1,console.error(e)}this._scrollTo(this._root,c.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(n,r,l),yield(0,Oe.cb)(l));const u=o.iconFA("check");if(r.replaceWith(u),u.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)return this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn),void(s.shell.isInDemo=!1);if(!this._isAutomatic){const e=this._activity.getElementsByClassName("grok-icon")[this._currentStep],t=o.iconFA("play",(()=>this._nextStep()),"Next step");t.className="grok-icon fas fa-play",e.replaceWith(t),this._nextStepBtn.classList.remove("disabled"),this._nextStepBtn.firstChild.classList.remove("fa-disabled")}if(s.shell.isInDemo){const e=s.shell.view("Browse");(null==e?void 0:e.preview)instanceof a.TableView&&(yield s.data.detectSemanticTypes(e.preview.dataFrame)),s.shell.isInDemo=!1}}))}_startScript(){return Pt(this,void 0,void 0,(function*(){for(let e=this._currentStep;e<this.stepNumber&&!this._isStopped&&!this._isCancelled;e++)yield this._nextStep()}))}_scrollTo(e,t){e.focus(),e.scrollTop=t}_countdown(e,t,n){return Pt(this,void 0,void 0,(function*(){const r=o.div([],"demo-script-countdown");t.classList.add("hidden");let i=n/1e3;const s=this._createSVGIndicator(i);r.append(s),e.prepend(r);const a=setInterval((()=>{i--,0===i&&(clearInterval(a),r.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(n),t}_changeStopState(){return Pt(this,void 0,void 0,(function*(){const e=this._stopStartBtn.getElementsByClassName("grok-icon");e[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(e[0].className="grok-icon fal fa-pause",this._isStepProcessed||(yield this._startScript()))}))}_restartScript(){return Pt(this,void 0,void 0,(function*(){s.shell.dockManager.close(this._node),this._clearRoot(),this._setInitParams(),yield this.start()}))}_clearRoot(){this._root=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.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(){s.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,Lt.currentObject=null,s.shell.isInDemo=!1}step(e,t,n){return this._steps[this.steps.length]={name:e,func:t,options:n},this}start(){return Pt(this,void 0,void 0,(function*(){s.shell.isInDemo=!0,this._initRoot(),s.shell.newView(this.name),this._isAutomatic?yield this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}Lt.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(Mt||(Mt={})),n(8152);var Nt=n(966);n(608),n(1619),n(5785),n(6869),new class{tooltipHandlerTemp="tooltip-handler.Monomer"},a.GridCellRenderer;class $t{constructor(e,t,n=""){this.target=e,this.debugEnabled=t,this.prefix=n}error(e,t,n){return this.target.error(this.prefix+e,t,n)}warning(e,t){return this.target.warning(this.prefix+e,t)}info(e,t){return this.target.info(this.prefix+e,t)}debug(e,t){if(this.debugEnabled)return this.target.debug(this.prefix+e,t)}}Map;class It extends a.Package{_properties;_rdKitModule;get rdKitModule(){return this._rdKitModule}get properties(){return this._properties}set properties(e){this._properties=e}_initialized=!1;get initialized(){return this._initialized}constructor(e={debug:!1}){super(),super._logger=new $t(super.logger,e.debug)}completeInit(e){this._rdKitModule=e,this._initialized=!0}handleErrorUI(e){const[t,n]=(0,we.AP)(e);s.shell.error(t),this.logger.error(t,void 0,n)}}async function Rt(e,t,n,r){const i=await async function(e,t,n,r){const i=(0,me.R)(t),s=de.G.forColumn(t).getNewColumnFromList("ref",[n]),o=de.G.forColumn(s).getSplitted(0),c=r===ce.IDENTITY?function(e,t){const n=t.columns.length,r=new Array(n),i=new Array(n),s=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);r[o]=n.getRawData(),i[o]=n.categories.indexOf("");const a=o<e.length?e.getOriginal(o):fe._S;s[o]=n.categories.indexOf(a)}const o=a.Column.float("Identity",t.rowCount),c=o.getRawData();for(let n=0;n<t.rowCount;++n){c[n]=0;for(let t=0;t<e.length;++t)(r[t]?r[t][n]:0)===s[t]&&++c[n];c[n]/=e.length}return o}(o,i):r===ce.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,pe.uL)(n,e)}(o,i):null;if(null===c)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return c.name=e.columns.getUnusedName(c.name),e.columns.add(c),c}(e,t,n,r);for(let e=0;e<i.length;e++)t.isNone(e)&&i.set(e,null,!1);return i}n(2174),a.Widget,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(ue.z1),n(7456),_e.Mu,n(330),n(9235),OCL,n(294),n(6956);const Ot=new It;async function kt(){return await Ct.getInstance()}let Dt=null;function Gt(){return Dt}async function Ht(e,t,n,r,i,u,d,h,p){if(!(0,Nt.V)(t,"Activity Cliffs"))return;const m=Ae(e),f={units:t.meta.units,aligned:t.getTag(ue.gp.aligned),separator:t.getTag(ue.gp.separator),alphabet:t.getTag(ue.gp.alphabet)},g=u,y=t,b=async()=>await ae(e,y,m,"Activity cliffs",n,r,g,i,{...h??{}},a.SEMTYPE.MACROMOLECULE,f,d,De,Ge,Fe,void 0,p),w=i===l.c.UMAP?2e5:2e4,v=i===l.c.UMAP?5e3:2e3;if(e.rowCount>w)return void s.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${w}`);const A=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>v&&!h?.[c.vb]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{b().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():b().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,we.AP)(e);throw Ot.logger.error(t,void 0,n),e})).finally((()=>{A.close()}))}async function Ft(e,t,r,i,l,u,d,h,p){const m=p?s.shell.view("Browse").preview:s.shell.tv.dataFrame==e?s.shell.tv:void 0;if((0,Nt.V)(t,"Sequence Space"))return u||(u=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),d??={},await async function(e,t,r,i,l,u,d,h=!0,p=!1,m={preprocessingFuncArgs:[]},f={},g=null,y={}){const b={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==i.length||t.length!==u.length||t.length!==l.length||t.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const w=h?f.tableView??s.shell.tableView(e.name)??s.shell.addTableView(e):null,v=async()=>{const v=a.TaskBarProgressIndicator.create(`Initializing ${f.scatterPlotName??"dimensionality reduction"} ...`);let A;try{const C=Ae(e);function E(n,i,s){let l=null,u=null;e.columns.names().includes(C[0])?(l=e.columns.byName(C[0]),u=e.columns.byName(C[1])):(l=e.columns.add(a.Column.float(C[0],e.rowCount)),u=e.columns.add(a.Column.float(C[1],e.rowCount)),h&&!A&&(A=w.scatterPlot({...b,x:C[0],y:C[1],title:f.scatterPlotName??Ce(t,r)}))),f[c.YP]&&(A?.root&&o.setUpdateIndicator(A.root,!1),l.init((e=>s[0]?s[0][e]:void 0)),u.init((e=>s[1]?s[1][e]:void 0)));const d=n/i*100;v.update(d,`Running ${f.scatterPlotName??"dimensionality reduction"}... ${d.toFixed(0)}%`)}async function T(){e.columns.add(a.Column.float(C[0],e.rowCount)),e.columns.add(a.Column.float(C[1],e.rowCount));let n=null;h&&(A=w.scatterPlot({...b,x:C[0],y:C[1],title:f.scatterPlotName??Ce(t,r)}),o.setUpdateIndicator(A.root,!0));const p=s.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&A?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===A?.getOptions()?.look?.title&&(s.events.fireCustomEvent(D,{}),p.unsubscribe(),n?.(),v.close())})),g=new Promise((async(e,s)=>{try{n=e;const s=[];for(let e=0;e<u.length;++e){const n=u[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),n){const r=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:c}=await n.apply({[r]:t[e],[o]:i[e],...m.preprocessingFuncArgs[e]??{}});s.push({entries:a,options:c}),m.distanceFnArgs.push(c)}else{const n=t[e].toList(),r={};s.push({entries:n,options:r}),m.distanceFnArgs.push(r)}}e(await U(s.map((e=>e.entries)),r,i,l,d,m,f[c.vb]?void 0:E))}catch(e){s(e)}})),y=await g;return v.close(),p.unsubscribe(),y}const S=await T();if(p&&S){const _=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const x=await function(e,t,r,i){return ve(this,void 0,void 0,(function*(){return new Promise((function(s,o){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:e,embedY:t,minPts:i,epsilon:r}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):s(t)}}))}))}(S[0],S[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),M=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(M).init((e=>x[e].toString())),A&&(A.props.colorColumnName=M)}catch(P){s.shell.error("Clustering embeddings failed"),console.error(P)}finally{_.close()}}if(S){const L=e.columns.byName(C[0]),N=e.columns.byName(C[1]);if(L.init((e=>S[0][e])),N.init((e=>S[1][e])),g)try{const $=g.inputs[0].name,I=g.inputs[1].name;await g.prepare({[$]:L,[I]:N,...y}).call(!0)}catch(R){s.shell.error("Post-processing failed"),console.error(R)}if(A)return o.setUpdateIndicator(A.root,!1),A.helpUrl="/help/compute/sequence-space",A}}catch(O){s.shell.error("Dimensionality reduction failed"),console.error(O),v.close(),A&&o.setUpdateIndicator(A.root,!1)}};return new Promise((async(t,n)=>{try{if(f.fastRowCount&&e.rowCount>f.fastRowCount&&!f[c.vb])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await v();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await v();t(e)}}catch(e){n(e)}}))}(e,[t],r,[i],[1],[u],"MANHATTAN",l,h??!1,{...d,preprocessingFuncArgs:[d.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:d?.[c.vb],tableView:m})}function Ut(e){return new he.m(e).importFasta()}function Vt(e){const t=de.G.forColumn(e).stats;return Object.keys(t.freq)}async function Bt(e,t,n){return Rt(e,t,n,ce.IDENTITY)}async function Yt(e,t,n){return Rt(e,t,n,ce.SIMILARITY)}},8115:(e,t,n)=>{"use strict";n.d(t,{if:()=>l,nI:()=>c});var r=n(4328),i=(n(7389),n(6082)),s=n(1407),o=(n(4870),n(8070)),a=n(2003);function c(e,t,n){const r=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),r=e.charAt(0)===t,i=e.charAt(e.length-1)===t,s=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return r?i?`${n}${s}${n}`:`${n}${s}${n}|${n}${s}$`:i?`^${s}${n}|${n}${s}${n}`:`^${s}${n}|${n}${s}${n}|${n}${s}$`}(e,n):e,s=i.BitSet.create(t.length);for(let n=0;n<t.length;n++){const i=t.get(n);(i.match(r)||i===e)&&s.set(n,!0,!1)}return s}async function l(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e){const t=i.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.cb)(10);const t=new Map,n=await(0,s.R)(e,!0,t);e.temp["monomeric-mols"]=n,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{t.close()}}(t);const n=i.Column.string("helm",1).init((t=>e));n.semType=i.SEMTYPE.MACROMOLECULE,n.meta.units=a.Hi.HELM;const c=await(0,s.R)(n,!0,t.temp["monomers-dict"]);return(await r.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:c.get(0),molBlockFailover:""})).get(0)}},966:(e,t,n)=>{"use strict";n.d(t,{V:()=>o,l:()=>a});var r=n(4328),i=n(6082),s=n(826);function o(e,t,n=[],i=[],s=!0){const[o,c]=a(e,t,n,i);return s&&!o&&r.shell.warning(c),o}function a(e,t,n=[],o=[]){let a=!0,c="";const l=s.G.forColumn(e);if(e.semType!==i.SEMTYPE.MACROMOLECULE)r.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=l.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))c=`${t} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.map((e=>`"${e}"`)).join(", ")} `}.`,a=!1;else if(!l.isHelm()){const e=l.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(c=`${t} + ' analysis is allowed for Macromolecules with alphabet ${0==o.length?"any alphabet":`alphabet${o.length>1?"s":""} ${o.map((e=>`"${e}"`)).join(", ")}.`}.`,a=!1)}}return[a,c]}},4139:(e,t,n)=>{"use strict";n.d(t,{HX:()=>d,J:()=>l,b9:()=>u,gN:()=>a,uF:()=>s});var r,i,s,o=n(8152);!function(e){e.SPLIT_COL="~split",e.ACTIVITY="~activity",e.ACTIVITY_SCALED="activity_scaled",e.ALIGNED_SEQUENCE="~aligned_sequence",e.AMINO_ACID_RESIDUE="AAR",e.POSITION="Pos",e.P_VALUE="pValue",e.MEAN_DIFFERENCE="Mean difference"}(r||(r={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(i||(i={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(s||(s={}));const a="MSA";var c,l;!function(e){e.CELL_CHANGING="isCellChanging"}(c||(c={})),function(e){e.SEPARATOR="."}(l||(l={}));const u="3.3.1",d={pepsea:{gapOpen:1.53,gapExtend:0,method:o.ZY[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},5433:(e,t,n)=>{"use strict";n.d(t,{r:()=>s}),n(6082),n(7389);var r=n(4328),i=(n(1757),n(2003),n(826));async function s(e,t,n){const s=i.G.forColumn(e).convert(t,n);e.dataFrame.columns.add(s);const o=await r.functions.call("Bio:detectMacromolecule",{col:s});return o&&(s.semType=o),await r.data.detectSemanticTypes(e.dataFrame),s}},6740:(e,t,n)=>{"use strict";n.d(t,{m8:()=>o});var r=n(4328),i=n(8070),s=n(8152);async function o(e=6e4){const t=await s.Nk.getDockerContainer();await async function(e,t=6e4){let n=e,s=!1;for(let o=0;o<t/200;++o){if(null===n&&(n=await r.dapi.docker.dockerContainers.find(e.id)),a(n)){s=!0;break}switch(n.status){case"stopped":await r.dapi.docker.dockerContainers.run(n.id);break;case"pending change":case"changing":break;case"error":throw new Error("Docker container error state.")}n=null,await(0,i.cb)(200)}if(!s)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},6956:(e,t,n)=>{"use strict";n.d(t,{mP:()=>r});const r="H"},8604:(e,t,n)=>{"use strict";n.d(t,{Es:()=>i,G3:()=>o,VV:()=>a,gt:()=>s,so:()=>r});const r="System:AppData/Bio/monomer-libraries/",i="System:AppData/Bio/monomer-sets/",s="System:AppData/Bio/tests/libraries/HELMmonomerSchema.json",o={explicit:["HELMCoreLibrary.json","polytool-lib.json"],exclude:[],duplicateMonomerPreferences:{}},a={PEPTIDE:326,RNA:383,CHEM:0}},1619:(e,t,n)=>{"use strict";n.d(t,{D:()=>P});var r=n(4328),i=n(6082),s=n(7389),o=n(8070),a=n(2003),c=n(826),l=n(608),u=n(8152),d=n(966),h=n(4139),p=n(6740),m=n(3572),f=n(5072),g=n.n(f),y=n(7825),b=n.n(y),w=n(7659),v=n.n(w),A=n(5056),C=n.n(A),E=n(540),T=n.n(E),S=n(1113),_=n.n(S),x=n(6369),M={};async function P(e={}){return new Promise((async(t,n)=>{e.clustersCol??=null,e.pepsea??={},e.pepsea.method??=h.HX.pepsea.method,e.pepsea.gapOpen??=h.HX.pepsea.gapOpen,e.pepsea.gapExtend??=h.HX.pepsea.gapExtend;const a=e.col?.dataFrame??r.shell.t,c=e.col??a.columns.bySemType(i.SEMTYPE.MACROMOLECULE);if(null==c){const e="Multiple Sequence Alignment analysis requires a dataset with a macromolecule column.";return r.shell.warning(e),void n(new l.Ap(s.divText(e)))}const d=s.input.choice("Method",{value:e.pepsea.method,items:u.ZY});d.setTooltip("Alignment method");const p=s.input.float("Terminal gap",{value:e?.kalign?.terminalGap});p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const m=s.p(`Kalign version: ${h.b9}`,"kalign-version"),f=s.input.float("Gap open",{value:e.pepsea.gapOpen});f.setTooltip("Gap opening penalty at group-to-group alignment");const g=s.input.float("Gap extend",{value:e.pepsea.gapExtend});g.setTooltip("Gap extension penalty to skip the alignment");const y=s.inputs([f,g,p]),b=s.button("Alignment parameters",(()=>{y.hidden=!y.hidden,[f,g,p].forEach((e=>{e.root.style.removeProperty("max-width"),e.captionLabel.style.removeProperty("max-width")}))}),"Adjust alignment parameters such as penalties for opening and extending gaps");b.classList.add("msa-params-button"),y.hidden=!0,b.prepend(s.icons.settings((()=>null)));const w=[d.root.style],v=[p.root.style,m.style];let A,C=c;const E=s.input.column("Sequence",{table:a,value:c,onValueChanged:async e=>{if(!e||e.semType!==i.SEMTYPE.MACROMOLECULE)return _.disabled=!0,await(0,o.cb)(0),void(E.value=C);C=e,_.disabled=!1,A=await N(E.value,a,w,v,d,T,f,g,p)},filter:e=>e.semType===i.SEMTYPE.MACROMOLECULE});E.setTooltip("Sequences column to use for alignment");const T=s.input.column("Clusters",{table:a,value:e.clustersCol});T.nullable=!0;const S=s.dialog("MSA").add(E).add(T).add(d).add(y).add(b).add(m).onOK((async()=>{await L(E,a,A,t,n)})),_=S.getButton("OK");if(E.fireChanged(),e.col)return A=await N(e.col,a,w,v,d,T,f,g,p),void await L(E,a,A,t,n);S.show()}))}async function L(e,t,n,s,o){let a=null;const c=i.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===n)throw new Error("Invalid column format");if(a=await n(),null==a)return o("PepSeA container has not started");t.columns.add(a),await r.data.detectSemanticTypes(t),s(a)}catch(e){o(e)}finally{c.close()}}async function N(e,t,n,s,o,f,g,y,b){try{if(e.semType!==i.SEMTYPE.MACROMOLECULE)return;const r=t.columns.getUnusedName(`msa(${e.name})`);if((0,d.V)(e,e.name,[a.Hi.FASTA,a.Hi.SEPARATOR],[a.YI.DNA,a.YI.RNA,a.YI.PT],!1)){$(n,s,"kalign"),g.value=null,y.value=null,b.value=null;const t=c.G.forColumn(e),i=t.isFasta()?e:t.convert(a.Hi.FASTA);return async()=>await(0,l.eE)(i,!1,r,f.value)}if((0,d.V)(e,e.name,[a.Hi.HELM],[],!1))return $(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(e,r,o.value,g.value,y.value,f.value));if((0,d.V)(e,e.name,[a.Hi.SEPARATOR],[a.YI.UN],!1)){const t=c.G.forColumn(e).convert(a.Hi.HELM);return $(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(t,r,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,b.value=null,void $(n,s,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();r.shell.error(t),m._package.logger.error(t)}}function $(e,t,n){if("kalign"===n){for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}else{for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}}M.styleTagTransform=_(),M.setAttributes=C(),M.insert=v().bind(null,"head"),M.domAPI=b(),M.insertStyleElement=T(),g()(x.A,M),x.A&&x.A.locals&&x.A.locals},608:(e,t,n)=>{"use strict";n.d(t,{Ap:()=>D,aZ:()=>U,eE:()=>H});var r=n(7389),i=n(6082),s=n(1991),o=n.n(s),a=n(3516),c=n(2003);const l=Symbol("Comlink.proxy"),u=Symbol("Comlink.endpoint"),d=Symbol("Comlink.releaseProxy"),h=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[l],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&h in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function f(e,t=self){t.addEventListener("message",(function n(r){if(!r||!r.data)return;const{id:i,type:s,path:o}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(T);let c;try{const t=o.slice(0,-1).reduce(((e,t)=>e[t]),e),n=o.reduce(((e,t)=>e[t]),e);switch(s){case"GET":c=n;break;case"SET":t[o.slice(-1)[0]]=T(r.data.value),c=!0;break;case"APPLY":c=n.apply(t,a);break;case"CONSTRUCT":c=function(e){return Object.assign(e,{[l]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),c=function(e,t){return C.set(e,t),e}(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[h]:0}}Promise.resolve(c).catch((e=>({value:e,[h]:0}))).then((e=>{const[r,o]=E(e);t.postMessage(Object.assign(Object.assign({},r),{id:i}),o),"RELEASE"===s&&(t.removeEventListener("message",n),g(t))}))})),t.start&&t.start()}function g(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function y(e,t){return w(e,[],t)}function b(e){if(e)throw new Error("Proxy has been released and is not useable")}function w(e,t=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(n,s){if(b(r),s===d)return()=>S(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{g(e),r=!0}));if("then"===s){if(0===t.length)return{then:()=>i};const n=S(e,{type:"GET",path:t.map((e=>e.toString()))}).then(T);return n.then.bind(n)}return w(e,[...t,s])},set(n,i,s){b(r);const[o,a]=E(s);return S(e,{type:"SET",path:[...t,i].map((e=>e.toString())),value:o},a).then(T)},apply(n,i,s){b(r);const o=t[t.length-1];if(o===u)return S(e,{type:"ENDPOINT"}).then(T);if("bind"===o)return w(e,t.slice(0,-1));const[a,c]=A(s);return S(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(T)},construct(n,i){b(r);const[s,o]=A(i);return S(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},o).then(T)}});return i}function v(e){return Array.prototype.concat.apply([],e)}function A(e){const t=e.map(E);return[t.map((e=>e[0])),v(t.map((e=>e[1])))]}const C=new WeakMap;function E(e){for(const[t,n]of m)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},C.get(e)||[]]}function T(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function S(e,t,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){!n.data||!n.data.id||n.data.id!==i||(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}const _="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksYz0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgdT1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxwKT0+ZFtwXSxlKSxmPW4ucmVkdWNlKChkLHApPT5kW3BdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjp1W24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkodSxjKTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4uYyk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOnB9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUscCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaCh1KXtsPXt2YWx1ZTp1LFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2godT0+KHt2YWx1ZTp1LFt5XTowfSkpLnRoZW4odT0+e2NvbnN0W2YsZF09Uyh1KTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLE0ocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBNKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBoKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYoaChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKGM9PmMudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57TShlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCBjPWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiBjLnRoZW4uYmluZChjKX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbixjKXtoKHMpO2NvbnN0W2wsdV09UyhjKTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sdSkudGhlbihtKX0sYXBwbHkoYSxuLGMpe2gocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W3UsZl09RihjKTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDp1fSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtoKHMpO2NvbnN0W2MsbF09RihuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAodT0+dS50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6Y30sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIEYoZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLGs9ImVhZ2VyIix4PSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgYz1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHtjfWApLHQuZnMuc3ltbGluayhjLGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIGM7bGV0IG49aTtyZXR1cm4oKGM9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOmMuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09eCYmKHMubG9hZGluZz1rLGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtyZXR1cm4gdC5jb25maWcucHJpbnRJbnRlcmxlYXZlZCYmKG89cy5zdGRvdXQpLHMucmVpbml0PT09ITAmJmF3YWl0IHRoaXMucmVpbml0KHMudG9vbCksb30sY2F0KGUpe3JldHVybiB0Ll9maWxlb3AoImNhdCIsZSl9LGxzKGUpe3JldHVybiB0Ll9maWxlb3AoImxzIixlKX0sZG93bmxvYWQoZSl7cmV0dXJuIHQuX2ZpbGVvcCgiZG93bmxvYWQiLGUpfSxwd2QoKXtyZXR1cm4gdC5mcy5jd2QoKX0sY2QoZSl7Zm9yKGxldCByIG9mIHQudG9vbHMpIXIubW9kdWxlfHxyLm1vZHVsZS5GUy5jaGRpcihlKX0sbWtkaXIoZSl7cmV0dXJuIHQuZnMubWtkaXIoZSksITB9LHJlYWQoe3BhdGg6ZSxsZW5ndGg6cixmbGFnOmk9InIiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKSxuPW5ldyBVaW50OEFycmF5KHIpO3JldHVybiB0LmZzLnJlYWQoYSxuLHMscixvKSx0LmZzLmNsb3NlKGEpLG59LHdyaXRlKHtwYXRoOmUsYnVmZmVyOnIsZmxhZzppPSJ3KyIsb2Zmc2V0OnM9MCxwb3NpdGlvbjpvPTB9KXtjb25zdCBhPXQuZnMub3BlbihlLGkpO3QuZnMud3JpdGUoYSxyLHMsci5sZW5ndGgsbyksdC5mcy5jbG9zZShhKX0sYXN5bmMgcmVpbml0KGUpe2NvbnN0IHI9dC50b29scy5maW5kKHM9PnMudG9vbD09ZSksaT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocixyLmNvbmZpZyksci5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxyLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoaSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz1rKSxlLmxvYWRpbmc9PT14KXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+e2Uuc3Rkb3V0Kz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntzdGRvdXQ6aX19KX0scHJpbnRFcnI6aT0+e2NvbnN0IHM9dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD8ic3Rkb3V0Ijoic3RkZXJyIjtlW3NdKz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntbc106aX19KX19KTtjb25zdCByPWUubW9kdWxlLkZTO2UuaXNCYXNlTW9kdWxlPyh0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggYmFzZSBtb2R1bGUgZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyTW91bnRlZH1gLDUxMSksci5jaGRpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gKSx0LmZzPXIpOih0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkKSxyLm1vdW50KGUubW9kdWxlLlBST1hZRlMse3Jvb3Q6dC5jb25maWcuZGlyU2hhcmVkLGZzOnQuZnN9LHQuY29uZmlnLmRpclNoYXJlZCksci5jaGRpcih0LmZzLmN3ZCgpKSksZS5zdGRvdXQ9IiIsZS5zdGRlcnI9IiIsZS5yZWFkeT0hMH0sYXN5bmMgX3NldHVwRlMoKXtjb25zdCBlPXQuZnM7Zm9yKGxldCByIG9mIHQudG9vbHMpe2lmKCFyLnJlYWR5KWNvbnRpbnVlO2NvbnN0IGk9ci5tb2R1bGUuRlMscz1gLyR7ci50b29sfWAsbz1gJHt0LmNvbmZpZy5kaXJTaGFyZWR9JHtzfWA7IWkuYW5hbHl6ZVBhdGgocykuZXhpc3RzfHxlLmFuYWx5emVQYXRoKG8pLmV4aXN0c3x8KHQuX2xvZyhgTW91bnRpbmcgJHtzfSBvbnRvICR7dC5iYXNlLnRvb2x9IGZpbGVzeXN0ZW0gYXQgJHtvfWApLGUubWtkaXIobyksZS5tb3VudCh0LmJhc2UubW9kdWxlLlBST1hZRlMse3Jvb3Q6cyxmczppfSxvKSl9fSxfZmlsZW9wKGUscil7dC5fbG9nKGBSdW5uaW5nICR7ZX0gJHtyfWApO2NvbnN0IGk9dC5mcy5hbmFseXplUGF0aChyKTtpZighaS5leGlzdHMpcmV0dXJuIHQuX2xvZyhgRmlsZSAke3J9IG5vdCBmb3VuZC5gKSwhMTtzd2l0Y2goZSl7Y2FzZSJjYXQiOnJldHVybiB0LmZzLnJlYWRGaWxlKHIse2VuY29kaW5nOiJ1dGY4In0pO2Nhc2UibHMiOnJldHVybiB0LmZzLmlzRmlsZShpLm9iamVjdC5tb2RlKT90LmZzLnN0YXQocik6dC5mcy5yZWFkZGlyKHIpO2Nhc2UiZG93bmxvYWQiOmNvbnN0IHM9bmV3IEJsb2IoW3RoaXMuY2F0KHIpXSk7cmV0dXJuIFVSTC5jcmVhdGVPYmplY3RVUkwocyl9cmV0dXJuITF9LF9sb2coZSl7aWYoIXQuY29uZmlnLmRlYnVnKXJldHVybjtsZXQgcj1bLi4uYXJndW1lbnRzXTtyLnNoaWZ0KCksY29uc29sZS5sb2coYCVjW1dlYldvcmtlcl0lYyAke2V9YCwiZm9udC13ZWlnaHQ6Ym9sZCIsIiIsLi4ucil9fTt3KHQpfSkoKTsK",x=typeof window<"u"&&window.Blob&&new Blob([atob(_)],{type:"text/javascript;charset=utf-8"});function M(){const e=x&&(window.URL||window.webkitURL).createObjectURL(x);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+_)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const P={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,printStream:!1,callback:null,debug:!1,env:"prd"};class L{constructor(e,t={}){if(null==e)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(e)||(e=[e]),t=Object.assign({},P,t),e=e.map(this._parseTool),"stg"===t.env&&(t.urlCDN=t.urlCDNStg),this.tools=e,this.config=t,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const e=new M;this.callback&&(e.onmessage=e=>{"biowasm"===e.data.type&&this.callback(e.data.value)});const t=y(e);return t.tools=this.tools,t.config=this.config,await t.init(),t}_parseTool(e){if("string"!=typeof e)return e;const t=e.split("/");if(2!=t.length&&3!=t.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:t[0],program:3==t.length?t[1]:t[0],version:t[t.length-1]}}}var N=n(3629);class ${static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,N.vA)(!(void 0===this.scales[e]),`Scale '${e}' was not found.`),this.scales[e]}}$.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 I{constructor(e="categorial"){this.aa2num=$.getScale(e),this.num2aa={},Object.entries(this.aa2num).forEach((([e,t])=>this.num2aa[t]=e))}static _truncateSequence(e){let t=0,n=e.length;const r=["NH2","COOH"];if(e.startsWith(r[0])){const n=r[0].length;(0,N.vA)("-"==e[n],`Wrong sequence format: ${r[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(r[1])){const t=r[1].length+1;(0,N.vA)("-"==e[n-t],`Wrong sequence format: ${r[1]} without '-' precending in '${e}'.`),n-=t}return e.substring(t,n)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return I._dropDefises(I._truncateSequence(e))}encode(e){const t=e.length,n=new Array(t).fill(0);for(let r=0;r<t;++r){const t=e[r];(0,N.vA)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[r]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const r=e[n];(0,N.vA)(r in this.num2aa,`Unknown code '${r}' found in vector '${e}'`),t+=this.num2aa[r]}return t}}var R=n(4139);const O="input.fa",k="result.fasta";class D extends Error{element;constructor(e,t){super(e.innerText,t),this.element=e}}function G(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function H(e,t=!1,n="",r=null,s,o,l){let u=e.toList();t&&(u=u.map((e=>I.clean(e).replace(/\-/g,""))));const d=e.length;r??=i.Column.string("Clusters",d).init("0"),r.type!=i.COLUMN_TYPE.STRING&&(r=r.convertTo(i.TYPE.STRING)),r.compact();const h=r.categories,p=r.getRawData(),m=new Array(h.length),f=new Array(h.length);for(let e=0;e<d;++e){const t=p[e];(m[t]??=[]).push(u[e]),(f[t]??=[]).push(e)}U(f,h);const g=await new L(["base/1.0.0",{tool:"kalign",version:R.b9,reinit:!0}]),y=i.Column.string(n,d);for(let e=0;e<h.length;++e){const t=G(m[e]);await g.fs.writeFile(O,t);const n=`${void 0!==s?` --gpo ${s}`:""}${void 0!==o?` --gpe ${o}`:""}${void 0!==l?` --tgpe ${l}`:""}`,r=await g.exec(`kalign ${O} -f fasta -o ${k}${n}`);console.warn(r);const i=await g.cat(k);if(!i){const e=F(r,1);throw new Error(e)}const c=new a.m(i).sequencesArray,u=f[e];for(let e=0;e<c.length;++e)y.set(u[e],c[e])}const b=e.meta.units,w=e.getTag(c.gp.alphabet);return y.meta.units=b,y.setTag(c.gp.aligned,"SEQ.MSA"),y.setTag(c.gp.alphabet,w),y.semType=i.SEMTYPE.MACROMOLECULE,y}function F(e,t){const n=[],r=/^.+ERROR : (.+)$/gm;let i;for(;null!=(i=r.exec(e))&&(void 0===t||n.length<t);)n.push(i[1]);return n.join("\n")}function U(e,t){const n=e.map(((e,t)=>[e,t])).filter((([e,t])=>1==e.length)).map((([e,t])=>t));if(n.length>0){const e=r.div([r.divText(`MSA analysis is not available on single sequence clusters #${n.length}:`),...o()(n).take(3).map((e=>{let i=t[e];return i.length>25&&(i=i.slice(0,25)+"..."),r.divText(`"${i}"${e<n.length-1?", ":"."}`)})).toArray(),...n.length>3?[r.divText("...")]:[]]);throw new D(e)}}},8152:(e,t,n)=>{"use strict";n.d(t,{GD:()=>h,Nk:()=>l,ZY:()=>u});var r=n(4328),i=n(6082),s=n(2003),o=n(608),a=n(4139),c=n(3572);const l=new class{dcName="bio";async getDockerContainer(){return await r.dapi.docker.dockerContainers.filter(this.dcName).first()}},u=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],d=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(e,t,n="ginsi",r=1.53,c=0,u=null,h){const m=await l.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)throw new Error("PepSeA container has not started yet");const f=e.length;u??=i.Column.int("Clusters",f).init(0),u.type!=i.COLUMN_TYPE.STRING&&(u=u.convertTo(i.TYPE.STRING));const g=u.categories,y=u.getRawData(),b=new Array(g.length),w=new Array(g.length);for(let t=0;t<f;++t){const n=y[t],r=g[n];if(""===r)continue;const i=g.indexOf(r),s=e.get(t);s&&((b[i]??=[]).push({ID:t.toString(),HELM:s}),(w[n]??=[]).push(t))}(0,o.aZ)(w,g);const v=new Array(f);for(const e of b){const t=(await p(m.id,e,n,r,c,h)).Alignment;for(const e of t)v[parseInt(e.ID)]=Object.entries(e).filter((e=>!d.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(a.J.SEPARATOR)}const A=i.Column.fromStrings(t,v);return A.meta.units=s.Hi.SEPARATOR,A.setTag(s.gp.separator,a.J.SEPARATOR),A.setTag(s.gp.aligned,"SEQ.MSA"),A.setTag(s.gp.alphabet,s.YI.UN),A.setTag(s.gp.alphabetIsMultichar,"true"),A.semType=i.SEMTYPE.MACROMOLECULE,A}async function p(e,t,n,i,s,o){const a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},l=`/align?method=${n}&gap_open=${i}&gap_extend=${s}`;let u;if("fetchProxy"in r.dapi.docker.dockerContainers){const t=window.performance.now(),n=await r.dapi.docker.dockerContainers.fetchProxy(e,l,a),i=window.performance.now();c._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${i-t} ms`);const s="application/json"===n.headers.get("content-type");if(!n.ok&&s){const e=await n.json(),t=e["pepsea-error"];if(t)throw new Error(`PepSeA error: ${t}`);const r=e["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`);throw new Error(n.statusText)}if(!n.ok&&!s){const e=await n.text();throw new Error(`Error: ${e}`)}if(!s){const e=await n.text();throw new Error(`Error: PepSeA expected JSON response, got '${e}'.`)}u=await n.json()}else{const t=await r.dapi.docker.dockerContainers.request(e,l,a);if(!t)throw new Error("Empty response");u=JSON.parse(t);const n=u["pepsea-error"];if(n)throw new Error(`PepSeA error: ${n}`);const i=u["datagrok-error"];if(i)throw new Error(`Datagrok error: ${i}`)}if("pepsea-stderr"in u){const e=u["pepsea-stderr"];o?.warning(e)}return u}},3890:(e,t,n)=>{"use strict";n.d(t,{aS:()=>c,wz:()=>a}),n(6082),n(7389),n(4328);var r=n(1991),i=n.n(r),s=n(826);const o=60;function a(e,t,n=o,r="\n"){const i=s.G.forColumn(t),a=[];for(let s=0;s<t.length;s++){const t=e.map((e=>e.get(s).toString())).join("|"),o=c(i.getSplitted(s),n);a.push(`>${t}${r}`);for(const e of o)a.push(`${e}${r}`)}return"".concat(...a)}function c(e,t=o){let n=0;const r=e.length,s=[];for(;n<r;){const r=i().count(n).take(Math.min(e.length-n,t)).map((t=>e.getOriginal(t))).toArray(),o=r.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");s.push(o),n+=r.length}return s}},7456:(e,t,n)=>{"use strict";n.d(t,{V:()=>d});var r=n(4328),i=n(6077),s=n(826),o=n(2003),a=n(6082),c=n(310),l=n(966),u=n(330);async function d(e,t,n,d,h,p){let m;if(n){const n=await async function(){const e=a.Func.find({package:"Bio",name:"getSeqHelper"});if(0===e.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await e[0].prepare().call()).getOutputParamValue()}(),r=s.G.forColumn(t);let i,c;r.isHelm()?i=t:(c=t.name,t.name=`__${c}`,i=r.convert(o.Hi.HELM),i.name=c,e.columns.add(i,!1));try{m=await n.helmToAtomicLevel(i,!0,!0)}finally{i!==t&&(e.columns.remove(i.name),t.name=c)}}else{if(!(0,l.V)(t,"To Atomic Level"))return{molCol:null,warnings:["Column is not suitable"]};m=await(0,i.C4)(e,t,h,p)}if(m.molCol){const n=(0,u.qj)(e,t.name);m.molCol.name=n,e.columns.add(m.molCol,!0),(0,c.Qc)(t,m.molCol,h,p),m.molCol.setTag(".sequence-src-highlight-monomers",String(d)),await r.data.detectSemanticTypes(e)}return m}},5785:(e,t,n)=>{"use strict";n.d(t,{k:()=>u});var r=n(4328),i=n(6082),s=n(8070),o=n(966),a=n(3077),c=n(4139),l=n(439);async function u(e,t){if(await(0,s.cb)(10),!(0,o.V)(t,"Sequence space"))return e;const n=(0,a.R)(t);n.name="splitToMonomers";const u=t.dataFrame;for(const e of n.columns)e.semType=c.uF.MONOMER,e.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const d=/(\d+)(?: \((\d+)\))?/,h=e=>{d.lastIndex=0;const t=e.match(d);return t?`${t[1]} (${parseInt(t[2]??"0")+1})`:e};for(let e=0;e<n.columns.length;e++){const r=n.columns.byIndex(e);r.semType=c.uF.MONOMER,r.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const i=100;let s=0;for(;u.columns.byName(r.name)&&s<i;)r.name=h(r.name),s++;u.columns.add(r)}await r.data.detectSemanticTypes(u);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(i.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return u}},4870:(e,t,n)=>{"use strict";function r(e,t){e.innerHTML="",e.append(t)}n.d(t,{K:()=>r}),n(4328),n(6082)},8047:(e,t,n)=>{"use strict";n.d(t,{VN:()=>m,n5:()=>l,Ue:()=>p,Tc:()=>h,eN:()=>f}),n(4328),n(7389);var r=n(6082),i=(n(1757),n(1991),n(1858),n(826),n(2003)),s=n(4326);n(8070),n(7602);var o=n(439),a=n(6882);var c,l,u,d=n(2174);n(3572),HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new r.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},r.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class h{rowCount;value;plotValue;valueList=null;valueIdx=0;bounds;constructor(e=0,t){this.value=this.rowCount=e,this.bounds=t}push(e){this.valueList||(this.valueList=new Array(this.rowCount),this.valueIdx=0),this.valueList[this.valueIdx]=e,++this.valueIdx}aggregate(e){this.value=e(this.valueList)??0,this.valueList=null}}class p{pos;name;_label;get label(){return this._label?this._label:this.name}_freqs;sumRowCount=0;sumPlotValue;sumPlotValueForHeight;constructor(e,t,n,r){this.pos=e,this.name=t,this._freqs=n??{},r?.sumRowCount&&(this.sumRowCount=r.sumRowCount),r?.sumValueForHeight&&(this.sumPlotValue=r.sumValueForHeight),r?.label&&(this._label=r.label)}getMonomers(){return Object.keys(this._freqs)}hasMonomer(e){return e in this._freqs}getFreq(e){let t=this._freqs[e];return t||(t=this._freqs[e]=new h),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?r.Column.fromFloat32Array(n,e):e instanceof Int32Array?r.Column.fromInt32Array(n,e):r.Column.fromList(r.COLUMN_TYPE.FLOAT,n,e),t}(t);return n.aggregate(e)}}(e);for(const[e,n]of Object.entries(this._freqs))n.aggregate(t)}getMinValue(){return Math.min(...Object.values(this._freqs).map((e=>e.value)))}calcPlotValue(e){for(const t of Object.values(this._freqs))t.plotValue=t.value-e}calcHeights(e){this.sumPlotValue=0;for(const e of Object.values(this._freqs))this.sumPlotValue+=e.plotValue;if(this.sumPlotValueForHeight=0,e===s.fH.Entropy){const e=Object.keys(this._freqs).length,t=.01*this.sumPlotValue,n=t/e;for(const e of Object.values(this._freqs)){const r=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-r*Math.log2(r)}}else if(e===s.fH.full)for(const[e,t]of Object.entries(this._freqs)){const e=t.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=e}}calcScreen(e,t,n,i,a,c,l,u,d){const h=i===s.fH.Entropy?n*(a-this.sumPlotValueForHeight)/a:n;let p=d*u+(n-h-1);const m=Object.entries(this._freqs).sort(((e,t)=>e[0]!==o._S&&t[0]!==o._S?t[1].value-e[1].value:e[0]===o._S&&t[0]===o._S?0:e[0]===o._S?-1:1));for(const[n,i]of m){const n=h*i.plotValue/this.sumPlotValue;i.bounds=new r.Rect((e-t)*u*c,p,l*u,n),p+=n}}render(e,t,n,r,s,c){for(const[l,u]of Object.entries(this._freqs))if(l!==o._S){const o=(0,i.zS)(l,5),d=u.bounds,h=d.left;let p=a.S$;c&&(p=c.getMonomerTextColor(s,l)),e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(h,d.top,d.width,d.height),e.fillStyle=p,e.textAlign="left",e.font=t;const m=e.measureText(o);e.setTransform(d.width/m.width,0,0,d.height/r,h,d.top),e.fillText(o,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,r])=>r.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e,t){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,d.F)(Object.assign({},...Object.entries(this._freqs).map((([e,t])=>({[e]:t.rowCount})))),e,t)}}!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(c||(c={})),function(e){e.sequenceColumnName="sequenceColumnName",e.valueAggrType="valueAggrType",e.valueColumnName="valueColumnName",e.startPositionName="startPositionName",e.endPositionName="endPositionName",e.skipEmptySequences="skipEmptySequences",e.skipEmptyPositions="skipEmptyPositions",e.shrinkEmptyTail="shrinkEmptyTail",e.backgroundColor="backgroundColor",e.positionHeight="positionHeight",e.positionWidth="positionWidth",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.fixWidth="fixWidth",e.fitArea="fitArea",e.minHeight="minHeight",e.maxHeight="maxHeight",e.showPositionLabels="showPositionLabels",e.positionMarginState="positionMarginState",e.positionMargin="positionMargin",e.filterSource="filterSource"}(l||(l={})),s.Fo,function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(u||(u={}));const m=new class{render=20};function f(e,t,n,r,i){let s=0,o=-1;for(;-1!=(o=n.findNext(o,!0));){const e=t.getSplitted(o),n=i.pos,a=n<e.length?e.getCanonical(n):null;null!==a&&a===r&&s++}return s}r.JsViewer},4577:(e,t,n)=>{"use strict";n.d(t,{O:()=>o,n:()=>s});var r=n(1858),i=n(3572);class s{substructure;readOnly;constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(i._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{onChanged=new r.Subject;_props;_propsChanging=!1;get props(){return this._props||(this._props=this.emptyProps),this._props}set props(e){this._propsChanging=!0;try{this._props=e,this.applyProps(),this.onChanged.next()}finally{this._propsChanging=!1}}saveProps(){const e={};for(const[t,n]of Object.entries(this.props))"_onChanged"!==t&&(e[t]=this.props[t]);return e}async detach(){}get filterSummary(){return this.props.substructure}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=this.emptyProps,this.onChanged.next()}}},1687:(e,t,n)=>{"use strict";n.d(t,{_i:()=>S,AR:()=>T});var r=n(7389),i=n(6082),s=n(4328),o=n(1991),a=n.n(o),c=n(1858),l=n(2003),u=n(8070),d=n(826),h=n(7602),p=n(8115),m=n(4577),f=n(1757),g=n.n(f),y=n(9124),b=n(9192),w=n(4870),v=n(3572);class A extends m.O{emptyProps=new m.n("");helmEditor;_filterPanel=r.div("",{style:{cursor:"pointer"}});logger;static viewerCounter=-1;viewerId=++A.viewerCounter;viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.logger=v._package.logger}viewSubs=[];async detach(){await super.detach();for(const e of this.viewSubs)e.unsubscribe()}async attach(){this.viewerToLog();try{const e=await(0,y.b2)();let t,n;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await r.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,c.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=r.div(),n=e.createWebEditorApp(t,this.props.substructure),r.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{try{const e=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.props=new m.n(e)}catch(e){this.logger.error(e)}finally{g()(t).empty(),t=null,n=null}})).onCancel((()=>{g()(t).empty(),t=null,n=null})).show({modal:!0,fullScreen:!0})}))),this.viewSubs.push(r.onSizeChanged(this._filterPanel).subscribe((e=>{try{if(n){const e=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}}catch(e){const[t,n]=(0,b.AP)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,b.AP)(e),i=this._filterPanel;i.innerText="error",i.classList.add("d4-error"),r.tooltip.bind(i,t)}}applyProps(){this.helmEditor&&this.updateFilterPanel(this.props.substructure)}get filterPanel(){return this._filterPanel}updateFilterPanel(e){if(!this.helmEditor)throw new Error("helmEditor is not created, the filter is not in dom yet");const t=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,n=t/2;if(e)(0,w.K)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=r.divText("Click to edit","helm-substructure-filter");(0,w.K)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;v._package.logger.debug(`${t}, start`);try{return await(0,u.cb)(10),await(0,p.if)(this.props.substructure,e)}finally{v._package.logger.debug(`${t}, end`)}}}const C="bio-substructure-filter";class E{props;filterId;dataFrameId;columnName;bitset;constructor(e,t,n,r,i){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=r,this.bitset=i}}class T extends m.n{separator;constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}class S extends i.Filter{bioFilter=null;bitset=null;loader;notation=void 0;logger;filterSyncer;get calculating(){return"initial"==this.loader.style.display}set calculating(e){this.loader.style.display=e?"initial":"none"}get filterSummary(){return this.bioFilter.filterSummary}get isFiltering(){return super.isFiltering&&(this.bioFilter?.isFiltering??!1)}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get debounceTime(){if(null==this.column)return 1e3;const e=this.column.length;return e<500?0:e>1e4?1e3:Math.floor((e-500)/9500*1e3)}constructor(){return super(),this.root=r.divV([]),this.loader=r.loader(),this.calculating=!1,this.filterSyncer=new h.g(this.logger=v._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}static filterCounter=-1;filterId=++S.filterCounter;filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}viewSubs=[];attach(e){const t=super.attach.bind(this),n=`${this.filterToLog()}.attach()`;this.filterSyncer.sync(n,(async()=>{t(e),this.column||(this.columnName?this.column=this.dataFrame.getCol(this.columnName):this.column=e.columns.bySemType(i.SEMTYPE.MACROMOLECULE)),d.G.forColumn(this.column),this.columnName??=this.column?.name,this.notation??=this.column?.meta.units,this.bioFilter=this.notation===l.Hi.FASTA?new _:this.notation===l.Hi.SEPARATOR?new x(this.column.getTag(l.gp.separator)):new A,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(i.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(s.events.onResetFilterRequest.subscribe(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(s.events.onCustomEvent(C).subscribe(this.filterOnSync.bind(this)))}))}detach(){const e=super.detach.bind(this),t=`${this.filterToLog()}.detach()`;this.filterSyncer.sync(t,(async()=>{for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[],e(),this.bioFilter&&this.bioFilter.detach(),this.bioFilter=null}))}filterOnSync(e){e.filterId!==this.filterId&&e.dataFrameId===this.dataFrame.id&&e.columnName===this.columnName&&(this.bioFilter.props=e.props)}applyFilter(){const e=`${this.filterToLog()}.applyFilter()`;this.logger.debug(`${e}, IN`),this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=`${this.filterToLog()}.saveState()`,t=super.saveState();return this.logger.debug(`${e}, super.state = ${JSON.stringify(t)}`),t.props=this.bioFilter.saveProps(),t}applyState(e){const t=`${this.filterToLog()}.applyState()`;super.applyState(e),this.filterSyncer.sync(t,(async()=>{e.props&&this.bioFilter&&(this.bioFilter.props=i.toJs(e.props??{}))}))}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;v._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.saveProps())}`:"")),s.events.fireCustomEvent(C,new E(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(v._package.logger.debug(`${e}, start, isFiltering = ${this.isFiltering}, props = ${JSON.stringify(this.bioFilter.saveProps())}`),!this.isFiltering)return this.bitset=null,void this.dataFrame.rows.requestFilter();a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`)||this.filterSyncer.sync(e,(async()=>{this.calculating=!0;try{v._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),v._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,v._package.logger.debug(`${e}, end`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;v._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}_onRendered=new c.Subject;get onRendered(){return this._onRendered}invalidate(e){const t=`${this.filterToLog()}.invalidate(${e?` <- ${e} `:""})`;this.filterSyncer.sync(t,(async()=>{this._onRendered.next()}))}async awaitRendered(e=1e4){const t=`awaitRendered( ${e} )`,n=`${this.filterToLog()}.${t}`;await(0,u.cb)(10),await(0,u.PE)(this.onRendered,(()=>{this.logger.debug(`${n}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${n} timeout`);const r=this.filterSyncer.resetErrors();if(r.length>0)throw r[0]}}class _ extends m.O{emptyProps=new m.n("");substructureInput;get type(){return"FastaBioFilter"}constructor(){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{window.setTimeout((()=>{this.props=new m.n(e),this._propsChanging||this.onChanged.next()}),0)},placeholder:"Substructure"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure)}get filterPanel(){return this.substructureInput.root}get isFiltering(){return""!==this.substructureInput.value}async substructureSearch(e){return(0,p.nI)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class x extends m.O{emptyProps=new T("",void 0);substructureInput;separatorInput;colSeparator="";get type(){return"SeparatorBioFilter"}constructor(e){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{this.props=new T(e,this.props.separator),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"}),this.separatorInput=r.input.string("",{value:this.colSeparator=e,onValueChanged:e=>{const t=e||void 0;this.props=new T(this.props.substructure,t),this._propsChanging||this.onChanged.next()},placeholder:"Separator"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure);const e=this.props.separator??this.colSeparator;this.separatorInput.value!==e&&(this.separatorInput.value=e)}get filterSummary(){return this.props.separator?this.props.separator:this.colSeparator,`${this.props.substructure}, {sep}`}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=new T("")}get filterPanel(){return r.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(e){this.substructureInput.value=e}async substructureSearch(e){return(0,p.nI)(this.substructure,e,this.colSeparator)}async attach(){}async detach(){await super.detach()}}},2174:(e,t,n)=>{"use strict";n.d(t,{F:()=>v});var r=n(7389),i=n(6082),s=(n(1991),n(2003),n(826),n(439)),o=(n(3599),n(5072)),a=n.n(o),c=n(7825),l=n.n(c),u=n(7659),d=n.n(u),h=n(5056),p=n.n(h),m=n(540),f=n.n(m),g=n(1113),y=n.n(g),b=n(5999),w={};function v(e,t,n){let o=0,a=null;for(const t of Object.values(e))o+=t,a=null===a?t:Math.max(a,t);const c=a/o,l=Object.assign({},...Array.from(Object.entries(e)).sort(((e,t)=>t[1]-e[1])).map((([e,a])=>{const l=a/o,u=n.getWebEditorMonomer(t,e).backgroundcolor,d=r.div("",{classes:"macromolecule-cell-comp-analysis-bar"});d.style.width=50*l/c+"px",d.style.backgroundColor=u,s._S===e&&(d.style.borderWidth="1px",d.style.borderStyle="solid",d.style.borderColor=i.Color.toHtml(i.Color.lightGray));const h=s._S===e?"-":e,p=r.div(`${(100*l).toFixed(2)}%`),m=r.div([d,p],{classes:"macromolecule-cell-comp-analysis-value"});return{[h]:m}}))),u=r.tableFromMap(l);return Array.from(u.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),u}w.styleTagTransform=y(),w.setAttributes=p(),w.insert=d().bind(null,"head"),w.domAPI=l(),w.insertStyleElement=f(),a()(b.A,w),b.A&&b.A.locals&&b.A.locals},1757:e=>{"use strict";e.exports=$},6082:e=>{"use strict";e.exports=DG},4328:e=>{"use strict";e.exports=grok},1858:e=>{"use strict";e.exports=rxjs},7389:e=>{"use strict";e.exports=ui},1991:e=>{"use strict";e.exports=wu},8343:(e,t,n)=>{"use strict";const{normalizeIPv6:r,normalizeIPv4:i,removeDotSegments:s,recomposeAuthority:o,normalizeComponentEncoding:a}=n(4834),c=n(343);function l(e,t,n,r){const i={};return r||(e=p(u(e,n),n),t=p(u(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=s(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=s(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function u(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),i=[],a=c[(r.scheme||n.scheme||"").toLowerCase()];a&&a.serialize&&a.serialize(n,r),void 0!==n.path&&(r.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==r.reference&&n.scheme&&(i.push(n.scheme),i.push(":"));const l=o(n,r);if(void 0!==l&&("suffix"!==r.reference&&i.push("//"),i.push(l),n.path&&"/"!==n.path.charAt(0)&&i.push("/")),void 0!==n.path){let e=n.path;r.absolutePath||a&&a.absolutePath||(e=s(e)),void 0===l&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==n.query&&(i.push("?"),i.push(n.query)),void 0!==n.fragment&&(i.push("#"),i.push(n.fragment)),i.join("")}const d=Array.from({length:127},((e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)))),h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(e,t){const n=Object.assign({},t),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=-1!==e.indexOf("%");let a=!1;"suffix"===n.reference&&(e=(n.scheme?n.scheme+":":"")+"//"+e);const l=e.match(h);if(l){if(s.scheme=l[1],s.userinfo=l[3],s.host=l[4],s.port=parseInt(l[5],10),s.path=l[6]||"",s.query=l[7],s.fragment=l[8],isNaN(s.port)&&(s.port=l[5]),s.host){const e=i(s.host);if(!1===e.isIPV4){const t=r(e.host,{isIPV4:!1});s.host=t.host.toLowerCase(),a=t.isIPV6}else s.host=e.host,a=!0}void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||s.path||void 0!==s.query?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==s.reference&&(s.error=s.error||"URI is not a "+n.reference+" reference.");const e=c[(n.scheme||s.scheme||"").toLowerCase()];if(!(n.unicodeSupport||e&&e.unicodeSupport)&&s.host&&(n.domainHost||e&&e.domainHost)&&!1===a&&function(e){let t=0;for(let n=0,r=e.length;n<r;++n)if(t=e.charCodeAt(n),t>126||d[t])return!0;return!1}(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII: "+e}(!e||e&&!e.skipNormalize)&&(o&&void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),o&&void 0!==s.userinfo&&(s.userinfo=unescape(s.userinfo)),o&&void 0!==s.host&&(s.host=unescape(s.host)),void 0!==s.path&&s.path.length&&(s.path=escape(unescape(s.path))),void 0!==s.fragment&&s.fragment.length&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),e&&e.parse&&e.parse(s,n)}else s.error=s.error||"URI can not be parsed.";return s}const m={SCHEMES:c,normalize:function(e,t){return"string"==typeof e?e=u(p(e,t),t):"object"==typeof e&&(e=p(u(e,t),t)),e},resolve:function(e,t,n){const r=Object.assign({scheme:"null"},n);return u(l(p(e,r),p(t,r),r,!0),{...r,skipEscape:!0})},resolveComponents:l,equal:function(e,t,n){return"string"==typeof e?(e=unescape(e),e=u(a(p(e,n),!0),{...n,skipEscape:!0})):"object"==typeof e&&(e=u(a(e,!0),{...n,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=u(a(p(t,n),!0),{...n,skipEscape:!0})):"object"==typeof t&&(t=u(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:u,parse:p};e.exports=m,e.exports.default=m,e.exports.fastUri=m},343:e=>{"use strict";const t=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const o={scheme:"http",domainHost:!0,parse:i,serialize:s},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,n]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}},c={http:o,https:{scheme:"https",domainHost:o.domainHost,parse:i,serialize:s},ws:a,wss:{scheme:"wss",domainHost:a.domainHost,parse:a.parse,serialize:a.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(n);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const i=`${n}:${t.nid||e.nid}`,s=c[i];e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),i=`${n}:${t.nid||r}`,s=c[i];s&&(e=s.serialize(e,t));const o=e,a=e.nss;return o.path=`${r||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,n){const r=e;return r.uuid=r.nss,r.nss=void 0,n.tolerant||r.uuid&&t.test(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};e.exports=c},4914:e=>{"use strict";e.exports={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}},4834:(e,t,n)=>{"use strict";const{HEX:r}=n(4914);function i(e){if(c(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u)||[],[n]=t;return n?{host:a(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function s(e,t=!1){let n="",i=!0;for(const t of e){if(void 0===r[t])return;"0"!==t&&!0===i&&(i=!1),i||(n+=t)}return t&&0===n.length&&(n="0"),n}function o(e,t={}){if(c(e,":")<2)return{host:e,isIPV6:!1};const n=function(e){let t=0;const n={error:!1,address:"",zone:""},r=[],i=[];let o=!1,a=!1,c=!1;function l(){if(i.length){if(!1===o){const e=s(i);if(void 0===e)return n.error=!0,!1;r.push(e)}i.length=0}return!0}for(let s=0;s<e.length;s++){const u=e[s];if("["!==u&&"]"!==u)if(":"!==u)if("%"===u){if(!l())break;o=!0}else i.push(u);else{if(!0===a&&(c=!0),!l())break;if(t++,r.push(":"),t>7){n.error=!0;break}s-1>=0&&":"===e[s-1]&&(a=!0)}}return i.length&&(o?n.zone=i.join(""):c?r.push(i.join("")):r.push(s(i))),n.address=r.join(""),n}(e);if(n.error)return{host:e,isIPV6:!1};{let e=n.address,t=n.address;return n.zone&&(e+="%"+n.zone,t+="%25"+n.zone),{host:e,escapedHost:t,isIPV6:!0}}}function a(e,t){let n="",r=!0;const i=e.length;for(let s=0;s<i;s++){const o=e[s];"0"===o&&r?(s+1<=i&&e[s+1]===t||s+1===i)&&(n+=o,r=!1):(r=o===t,n+=o)}return n}function c(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}const l=/^\.\.?\//u,u=/^\/\.(?:\/|$)/u,d=/^\/\.\.(?:\/|$)/u,h=/^\/?(?:.|\n)*?(?=\/|$)/u;e.exports={recomposeAuthority:function(e,t){const n=[];if(void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host){let t=unescape(e.host);const r=i(t);if(r.isIPV4)t=r.host;else{const n=o(r.host,{isIPV4:!1});t=!0===n.isIPV6?`[${n.escapedHost}]`:e.host}n.push(t)}return"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0},normalizeComponentEncoding:function(e,t){const n=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=n(e.scheme)),void 0!==e.userinfo&&(e.userinfo=n(e.userinfo)),void 0!==e.host&&(e.host=n(e.host)),void 0!==e.path&&(e.path=n(e.path)),void 0!==e.query&&(e.query=n(e.query)),void 0!==e.fragment&&(e.fragment=n(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(l))e=e.replace(l,"");else if(e.match(u))e=e.replace(u,"/");else if(e.match(d))e=e.replace(d,"/"),t.pop();else if("."===e||".."===e)e="";else{const n=e.match(h);if(!n)throw new Error("Unexpected dot segment condition");{const r=n[0];e=e.slice(r.length),t.push(r)}}return t.join("")},normalizeIPv4:i,normalizeIPv6:o,stringArrayToHexStripped:s}},3837:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},7216:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},8226:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},518:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},4588:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},5707:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},9547:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},7082:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},1678:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},2079:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}n.m=e,n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var r={};(()=>{"use strict";n.r(r),n.d(r,{_package:()=>Se,initAutoTests:()=>xe,test:()=>_e,tests:()=>t.CN});var e=n(6082),t=n(8070);(0,t.L1)("_first",(()=>{(0,t.t6)("_first",(async()=>{}))}));var i=n(8924),s=n(7362),o=n(1093);(0,t.L1)("Palettes",(()=>{(0,t.t6)("testPaletteN",(async()=>{await async function(){const e=o.A.Chromatogram;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(e instanceof o.A,!0)}()})),(0,t.t6)("testPaletteAA",(async()=>{await async function(){const e=i.X.Lesk,n=i.X.RasMol,r=i.X.GrokGroups;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(n instanceof s.e,!0),(0,t.E3)(r instanceof s.e,!0),(0,t.E3)(e instanceof i.X,!0),(0,t.E3)(n instanceof i.X,!0),(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPalettePtMe",(async()=>{const e=i.X.GrokGroups.get("MeNle"),n=i.X.GrokGroups.get("MeA"),r=i.X.GrokGroups.get("MeG"),s=i.X.GrokGroups.get("MeF"),o=i.X.GrokGroups.get("L"),a=i.X.GrokGroups.get("A"),c=i.X.GrokGroups.get("G"),l=i.X.GrokGroups.get("F");(0,t.E3)(e,o),(0,t.E3)(n,a),(0,t.E3)(r,c),(0,t.E3)(s,l)}))}));var a=n(4328),c=n(2003),l=n(826);class u{units;aligned;alphabet;alphabetSize;alphabetIsMultichar;separator;constructor(e,t,n,r,i,s){this.units=e,this.aligned=t,this.alphabet=n,this.alphabetSize=r,this.alphabetIsMultichar=i,this.separator=s}}async function d(t,n){const r=(await t()).getCol(n),i=await a.functions.call("Bio:detectMacromolecule",{col:r});if(i&&(r.semType=i),r.semType===e.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${r.semType}', units='${r.meta.units}'.`;throw new Error(e)}}async function h(n,r,i,s,o,u,d,h=null){const p=(await n()).col(r),m=await a.functions.call("Bio:detectMacromolecule",{col:p});m&&(p.semType=m),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,i),(0,t.E3)(p.getTag(c.gp.aligned),s),(0,t.E3)(p.getTag(c.gp.alphabet),o),h&&(0,t.E3)(p.getTag(c.gp.separator),h);const f=l.G.forColumn(p);(0,t.E3)(f.getAlphabetSize(),u),(0,t.E3)(f.getAlphabetIsMultichar(),d),f.isHelm()||((0,t.E3)(f.aligned,s),(0,t.E3)(f.alphabet,o))}var p=n(3572);async function m(t){const n=e.Column.fromList(e.TYPE.STRING,"col1",t);if(await a.functions.call("Bio:detectMacromolecule",{col:n}),n.semType===e.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${n.semType}', units='${n.meta.units}'.`;throw new Error(e)}}async function f(n,r,i,s,o,u,d=null){const h=e.Column.fromList(e.TYPE.STRING,"seq",n),p=await a.functions.call("Bio:detectMacromolecule",{col:h});p&&(h.semType=p),(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,r),(0,t.E3)(h.getTag(c.gp.aligned),i),(0,t.E3)(h.getTag(c.gp.alphabet),s),d&&(0,t.E3)(h.getTag(c.gp.separator),d);const m=l.G.forColumn(h);(0,t.E3)(m.getAlphabetSize(),o),(0,t.E3)(m.getAlphabetIsMultichar(),u),m.isHelm()||((0,t.E3)(m.aligned,i),(0,t.E3)(m.alphabet,s))}async function g(e,t){const n=await e(),r=[];for(const i of n.columns.names())if(i in t){const n=t[i];try{await h(e,i,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}catch(e){const t=e.toString();r.push(`Positive col '${i}' failed: ${t}`)}}else try{await d(e,i)}catch(e){const t=e.toString();r.push(`Negative col '${i}' failed: ${t}`)}if(r.length>0)throw new Error(r.join("\n"))}(0,t.L1)("detectors",(()=>{const n={negEmpty:{csv:"id,col1\n1,\n2,\n3,\n4,\n5,",neg:["col1"]},negNum1:{csv:"col1\n1\n2\n3",neg:["col1"]},negNum2:{csv:"col1\n4\n5\n6\n7",neg:["col1"]},negNum3:{csv:"col1\n8\n9\n10\n11\n12",neg:["col1"]},negSmiles:{csv:"col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",neg:["col1"]},negSmilesWithSquareBrackets:{csv:"col1\nCl.c1ccc2nc3ccccc3cc2c1\nOc1cccc2cc3ccccc3cc12\n[SeH]c1ccc2ccccc2c1",neg:["col1"]},negFastaUnSingleChar:{csv:"col1\nAlanine\nCysteine\nAspartic acid\nGlutamic acid\nPhenylalanine",neg:["col1"]},fastaMsaSameLength:{csv:"seq\nFWPHEYFWPHEYYV\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",pos:{seq:new u(c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1,void 0)}},fastaExtSameLength:{csv:"seq\nFW[Ac]PHEYFWPH\nYN[Re]VYNRQWYV\n[Me]EYVMPS[Et]",pos:{seq:new u(c.Hi.FASTA,"SEQ",c.YI.UN,16,!0,void 0)}},fastaMsaExtSameLength:{csv:"seq\nFW[Ac]PHEY[Re]WPH\nYN[Re]VYNR[Ac]WYV\n[Me]EYVMPSFW[Me]H",pos:{seq:new u(c.Hi.FASTA,"SEQ.MSA",c.YI.UN,14,!0,void 0)}},fastaMsaExtManyMinus:{csv:"seq\n[D-Tic]-------[D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]N[D-Orn][D-aThr]-[Phe_4Me]\n[Phe_2F]--------[Tyr_ab-dehydroMe][dV][Aca]N[D-Orn][D-aThr]-[Phe_4Me]\n[D-Tic]-[Hcy]QTWQ[Phe_4NH2][D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]----[Phe_4Me]",pos:{seq:new u(c.Hi.FASTA,"SEQ.MSA",c.YI.UN,17,!0,void 0)}},sepSameLength:{csv:"seq\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-C-G-NH2\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-C-G-NH2\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-C-G-NH2",pos:{seq:new u(c.Hi.SEPARATOR,"SEQ.MSA",c.YI.UN,5,!0,"-")}},sepMsaSameLength:{csv:"seq\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-Aca-G-NH2\nAca-A-Aca-A-A-A-meI-A-A-A-A-A-Aca-G-NH2\nAca-A-A-A-A-A-A-A-A-A-A-A-A-A-Aca-G-NH2",pos:{seq:new u(c.Hi.SEPARATOR,"SEQ",c.YI.UN,5,!0,"-")}},helmSameLength:{csv:"seq\nPEPTIDE1{Ac(1).A.A.A.A.A.A.A.A.A.A.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ab(1).Y.V.K.H.P.F.W.R.W.Y.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ad(1).S.W.Y.C.K.H.P.M.W.A.A.A.A.C(1)-G-NH2}$$$$",pos:{seq:new u(c.Hi.HELM,null,null,19,void 0,void 0)}},fastaNonDigitAlphabet:{csv:'flagC\n"NMe-pyridazineH"\n"Pyrrolo[2,3-c]pyridazineH"',neg:["flagC"]}};for(const[r,i]of Object.entries(n))(0,t.t6)(`csvData2-${r}`,(async()=>{const t=(s=r,async()=>{const t=n[s].csv,r=e.DataFrame.fromCsv(t);return await a.data.detectSemanticTypes(r),r});var s;for(const e of i.neg??[])await d(t,e);for(const[e,n]of Object.entries(i.pos??{}))await h(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}));const r=new class{csvFastaDna1="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC";fastaRna1="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC";fastaPt1="seq\nFWPHEY\nYNRQWYV\nMKPSEYV";fastaUn="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]";sepDna="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";sepRna="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";sepPt="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";sepUn1="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";sepUn2="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";sepMsaDna1="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";sepMsaUnWEmpty="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";sepComplex="seq\nAca-F-K(AEEA-AEEA-R-Ac)-L-mF-V-Y-mNle-D-W-N-mF-Aca-G-NH2\nAca-F-K(AEEA-ARRA-W-Ac)-L-mF-V-Y-mNle-D-W-N-mF-Aca-G-NH2\nAca-F-K(AEEA-AEEA-Ac)-L-mF-V-Y-mNle-D-W-N-mF-Aca-G-NH2";fastaMsaDna1="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT";fastaMsaPt1="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"},i={fastaPtCsv:"System:AppData/Bio/samples/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"},s={};function o(e,t=l){return async()=>(e in s||(s[e]=(async()=>await t(i[e]))().catch((t=>{throw delete s[e],t}))),s[e])}async function l(t){const n=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(n)}const p=t=>async()=>{const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("NegativeStartEnd",(async()=>{await m(["START","END"])})),(0,t.t6)("NegativeStartEndIntermediate",(async()=>{await m(["START","END","INTERMEDIATE"])})),(0,t.t6)("FastaDna1",(async()=>{await h(p("csvFastaDna1"),"seq",c.Hi.FASTA,"SEQ",c.YI.DNA,4,!1)})),(0,t.t6)("FastaRna1",(async()=>{await h(p("fastaRna1"),"seq",c.Hi.FASTA,"SEQ",c.YI.RNA,4,!1)})),(0,t.t6)("FastaPt1",(async()=>{await h(p("fastaPt1"),"seq",c.Hi.FASTA,"SEQ",c.YI.PT,20,!1)})),(0,t.t6)("FastaPtGaps",(()=>f(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.Hi.FASTA,"SEQ",c.YI.PT,20,!1))),(0,t.t6)("FastaPtGapsMsa",(()=>f(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1))),(0,t.t6)("FastaUn",(async()=>{await h(p("fastaUn"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.UN,12,!0)})),(0,t.t6)("FastaMsaDna1",(async()=>{await h(p("fastaMsaDna1"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.DNA,4,!1)})),(0,t.t6)("FastaMsaPt1",(async()=>{await h(p("fastaMsaPt1"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1)})),(0,t.t6)("SepDna",(async()=>{await h(p("sepDna"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.DNA,4,!1,"*")})),(0,t.t6)("SepRna",(async()=>{await h(p("sepRna"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.RNA,4,!1,"*")})),(0,t.t6)("SepPt",(async()=>{await h(p("sepPt"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.PT,20,!1,"-")})),(0,t.t6)("SepUn1",(async()=>{await h(p("sepUn1"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.UN,8,!0,"-")})),(0,t.t6)("SepUn2",(async()=>{await h(p("sepUn2"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.UN,9,!0,"/")})),(0,t.t6)("SepMsaN1",(async()=>{await h(p("sepMsaDna1"),"seq",c.Hi.SEPARATOR,"SEQ.MSA",c.YI.DNA,4,!1,"-")})),(0,t.t6)("SepMsaUnWEmpty",(async()=>{await h(p("sepMsaUnWEmpty"),"seq",c.Hi.SEPARATOR,"SEQ.MSA",c.YI.UN,14,!0)})),(0,t.t6)("SepComplex",(async()=>{await h(p("sepComplex"),"seq",c.Hi.SEPARATOR,"SEQ",c.YI.UN,17,!0)})),(0,t.t6)("samplesFastaCsv",(async()=>{await g(o("fastaCsv"),{Sequence:new u(c.Hi.FASTA,"SEQ",c.YI.PT,20,!1)})})),(0,t.t6)("samplesPeptidesComplex",(async()=>{await g(o("peptidesComplex"),{})})),(0,t.t6)("samplesMsaComplex",(async()=>{await g(o("msaComplex"),{MSA:new u(c.Hi.SEPARATOR,"SEQ.MSA",c.YI.UN,161,!0,"/")})})),(0,t.t6)("samplesIdCsv",(async()=>{await g(o("testIdCsv"),{})})),(0,t.t6)("samplesSarSmallCsv",(async()=>{await g(o("testSmilesCsv"),{})})),(0,t.t6)("samplesHelmCsv",(async()=>{await g(o("helmCsv"),{HELM:new u(c.Hi.HELM,null,null,160,!0)})})),(0,t.t6)("samplesTestHelmCsv",(async()=>{await g(o("testHelmCsv"),{"HELM string":new u(c.Hi.HELM,null,null,9,!0)})})),(0,t.t6)("samplesTestDemogCsv",(async()=>{await g(o("testDemogCsv"),{})})),(0,t.t6)("samplesTestSmiles2Csv",(async()=>{await g(o("testSmiles2Csv"),{})})),(0,t.t6)("samplesTestSmilesShort",(async()=>{await g(o("testSmilesShort"),{})})),(0,t.t6)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g(o("testActivityCliffsCsv"),{})})),(0,t.t6)("samplesFastaPtCsv",(async()=>{await g(o("fastaPtCsv"),{sequence:new u(c.Hi.FASTA,"SEQ",c.YI.PT,20,!1)})})),(0,t.t6)("samplesTestCerealCsv",(async()=>{await g(o("testCerealCsv"),{})})),(0,t.t6)("samplesTestUnichemSources",(async()=>{await g(o("testUnichemSources"),{})})),(0,t.t6)("samplesTestDmvOffices",(async()=>{await g(o("testDmvOffices"),{})})),(0,t.t6)("samplesTestAlertCollection",(async()=>{await g(o("testAlertCollection"),{})})),(0,t.t6)("samplesTestSpgi",(async()=>{await g(o("testSpgi"),{})})),(0,t.t6)("samplesTestSpgi100",(async()=>{await g(o("testSpgi100"),{})})),(0,t.t6)("samplesTestUrl",(async()=>{await g(o("testUrl"),{})}))})),(0,t.L1)("detectors:weak-and-likely",(()=>{const n={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"},r=t=>async()=>{const r=n[t],i=e.DataFrame.fromCsv(r);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("fastaDnaWeak1",(async()=>{await d(r("fastaDnaWeak1"),"colName")})),(0,t.t6)("fastaDnaWeak1LikelyName",(async()=>{await h(r("fastaDnaWeak1LikelyName"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.DNA,4,!1)})),(0,t.t6)("fastaRnaWeak1",(async()=>{await d(r("fastaRnaWeak1"),"colName")})),(0,t.t6)("fastaRnaWeak1LikelyName",(async()=>{await h(r("fastaRnaWeak1LikelyName"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.RNA,4,!1)})),(0,t.t6)("fastaPtWeak1",(async()=>{await d(r("fastaPtWeak1"),"colName")})),(0,t.t6)("fastaPtWeak1LikelyName",(async()=>{await h(r("fastaPtWeak1LikelyName"),"seq",c.Hi.FASTA,"SEQ.MSA",c.YI.PT,20,!1)})),(0,t.t6)("fastaUn1",(async()=>{await d(r("fastaUn1"),"colName")})),(0,t.t6)("fastaUn1LikelyName",(async()=>{await d(r("fastaUn1LikelyName"),"seq")})),(0,t.t6)("fastaUn2LikelyName",(async()=>{await d(r("fastaUn2LikelyName"),"protein")})),(0,t.t6)("fastaUnMsa1LikelyName",(async()=>{await d(r("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.L1)("detectors: custom",(()=>{const n={cyclized1:{csv:"n,seq\n1,R-F-C(1)-T-G-H-F-Y-G-H-F-Y-G-H-F-Y-P-C(1)-meI\n2,C(1)-T-G-H-F-Y-P-C(1)-meI\n3,R-F-C(1)-T-G-H-F-Y-P-C(1)\n4,C(1)-T-G-H-F-H-P-C(1)\n5,R-F-D(2)-T-G-H-F-Y-P-NH2(2)\n6,R-F-aG(3)-T-G-H-F-Y-P-azG(3)-meI",pos:{seq:new u(c.Hi.CUSTOM,"SEQ",c.YI.UN,13,!0,"-")}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`${r}`,(async()=>{const t=async()=>e.DataFrame.fromCsv(i.csv);for(const e of i.neg??[])await d(t,e);for(const[e,n]of Object.entries(i.pos??{}))await h(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}))})),(0,t.L1)("detectorsBenchmark",(()=>{let n;async function r(r,s,o,a,u,d){return await async function(r){const h=await(async()=>{const t=function(t,n,r,i,s){let o;switch(t){case c.Hi.FASTA:o=e=>{let t="";for(let n=0;n<e.length;n++){const r=e[n];t+=1==r.length?r:`[${r}]`}return t};break;case c.Hi.SEPARATOR:o=(e,t)=>e.join(t);break;default:throw new Error(`Not supported notation '${t}'.`)}const a=(e,t)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e[Math.floor(Math.random()*e.length)];return o(n,s)},l=Array(i);for(let e=0;e<i;e++)l[e]=a(n,r);return e.Column.fromStrings("seq",l)}(s,[...(0,c.Qf)(o)],a,u,d),r=n.prepare({col:t});return i(r),r})(),p=Date.now(),m=i(h),f=Date.now();(function(e,n){const r=l.G.forColumn(e);(0,t.E3)(e.semType===n.semType,!0),(0,t.E3)(r.notation===n.notation,!0),(0,t.E3)(r.alphabet===n.alphabet,!0),(0,t.E3)(r.separator===n.separator,!0)})(m,{semType:e.SEMTYPE.MACROMOLECULE,notation:s,alphabet:o,separator:d});const g=f-p;if(g>r){const e=`ET ${g} ms is more than max allowed ${r} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${g} ms is OK.`),g}(r)}function i(e){e.callSync();const t=e.getOutputParamValue(),n=e.inputs.col;return t&&(n.semType=t),n}(0,t.gM)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});n=t[0];const r=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await n.prepare({col:r}).call()})),(0,t.t6)("fastaDnaShorts50Few50",(async()=>{await r(10,c.Hi.FASTA,c.YI.DNA,50,50)})),(0,t.t6)("fastaDnaShorts50Many1E6",(async()=>{await r(20,c.Hi.FASTA,c.YI.DNA,50,1e6)})),(0,t.t6)("fastaDnaLong1e6Few50",(async()=>{await r(20,c.Hi.FASTA,c.YI.DNA,1e6,50)})),(0,t.t6)("separatorDnaShorts50Few50",(async()=>{await r(10,c.Hi.SEPARATOR,c.YI.DNA,50,50,"/")})),(0,t.t6)("separatorDnaShorts50Many1E6",(async()=>{await r(20,c.Hi.SEPARATOR,c.YI.DNA,50,1e6,"/")})),(0,t.t6)("separatorDnaLong1e6Few50",(async()=>{await r(20,c.Hi.SEPARATOR,c.YI.DNA,1e6,50,"/")}))}));var y=n(608),b=n(1619),w=n(6740);async function v(n,r){const i=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(i);const s=e.DataFrame.fromCsv(r),o=i.getCol("seq");(0,t.E3)(o.semType,e.SEMTYPE.MACROMOLECULE);const c=s.getCol("seq"),l=await(0,y.eE)(o,!0);(0,t.J6)(l.toList(),c.toList())}async function A(n,r,i,s,o,l){const u=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(u);const d=e.DataFrame.fromCsv(r).getCol("seq"),h=u.getCol("seq");(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,i),o&&(0,t.E3)(h.getTag(c.gp.alphabet),o);const p=await(0,b.D)({col:h,pepsea:{method:l}});(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,s),(0,t.E3)(p.getTag(c.gp.aligned),"SEQ.MSA"),o&&(0,t.E3)(p.getTag(c.gp.alphabet),o),(0,t.J6)(p.toList(),d.toList())}(0,t.L1)("MSA",(async()=>{(0,t.t6)("isCorrect",(async()=>{await v("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.t6)("isCorrectLong",(async()=>{await v("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,t.t6)("isCorrectHelm",(async()=>{await(0,w.m8)(),await A("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.Hi.HELM,c.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectHelmLong",(async()=>{await(0,w.m8)(),await A("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.Hi.HELM,c.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectSeparator",(async()=>{await A("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.Hi.SEPARATOR,c.Hi.FASTA,c.YI.PT)})),(0,t.t6)("isCorrectSeparatorLong",(async()=>{await A("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.Hi.SEPARATOR,c.Hi.FASTA,c.YI.PT)}))}));var C=n(1991),E=n.n(C),T=n(7278),S=n(6718),_=n(5785),x=n(6642);async function M(t){const n=await async function(e){return await Se.files.readAsText(e)}(t),r=e.DataFrame.fromCsv(n);return r.name=t.replace(".csv",""),r}async function P(e,n=5e3){await(0,t.cb)(0),await(0,t.PE)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),n);const r=e.columns.length;for(let t=0;t<r;++t){const n=e.columns.byIndex(t);if(n){const t=e.cell(n.name,0),[r,o,a]=(0,x.BG)(t),c=(void 0,(s=i=a.rendererBack)&&void 0!==s.onRendered&&void 0!==s.invalidate&&void 0!==s.awaitRendered?i:null);c&&await c.awaitRendered()}}var i,s}var L=n(4139),N=n(4356);async function $(e,n){const r=(0,c.J9)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(E().count(0).take(r.length).map((e=>r.getOriginal(e))).toArray(),n)}async function I(e,n){const r=(0,T.qp)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(E().count(0).take(r.length).map((e=>r.getOriginal(e))).toArray(),n)}(0,t.L1)("splitters",(async()=>{(0,t.gM)((async()=>{})),(0,t.Pl)((async()=>{}));const e=["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"]],r=["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"]],i=["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"]],s=["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"]],o=["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)"]],a=["RNA1{P.R(U)P.R(T)}$$$$",["P","R(U)P","R(T)"]],c=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,t.t6)("fastaMulti",(async()=>{await $(e[0],e[1])})),(0,t.t6)("fastaFromHelm",(async()=>{await $(n[0],n[1])})),(0,t.t6)("helm1",(async()=>{await I(r[0],r[1])})),(0,t.t6)("helm2",(async()=>{await I(i[0],i[1])})),(0,t.t6)("helm3-multichar",(async()=>{await I(s[0],s[1])})),(0,t.t6)("testHelm1",(async()=>{await I(o[0],o[1])})),(0,t.t6)("testHelm2",(async()=>{await I(a[0],a[1])})),(0,t.t6)("testHelm3",(async()=>{await I(c[0],c[1])}))})),(0,t.L1)("splitters",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)})),(0,t.t6)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),n=e.getCol("MSA"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),n.setTag(c.gp.aligned,L.gN);const i=await(0,_.k)(e,n);(0,t.E3)(i.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(i);const s=a.shell.addTableView(i);await P(s.grid),(0,t.E3)(s.grid.dataFrame.id,e.id)})),(0,t.t6)("getHelmMonomers",(async()=>{const t=e.DataFrame.fromCsv("HELM,Activity\nPEPTIDE1{hHis.N.T}$$$,5.30751\nPEPTIDE1{hHis.Aca.Cys_SEt}$$$,5.72388\n");await a.data.detectSemanticTypes(t);const n=["hHis","Aca","Cys_SEt","N","T"],r=t.getCol("HELM"),i=(0,p.getHelmMonomers)(r),s=n.filter((e=>!i.includes(e))),o=i.filter((e=>!n.includes(e)));if(s.length>0||o.length){const e=[];throw s.length>0&&e.push(`Missed monomers ${JSON.stringify(s)}.`),o.length>0&&e.push(`Unexpected monomers ${JSON.stringify(o)}.`),new Error(e.join(" "))}}))}));var R=n(8604);(0,t.L1)("monomerLibraries",(()=>{let e,n=null;(0,t.gM)((async()=>{e=await(0,S.pj)(),n=(0,N.ub)()})),(0,t.Pl)((async()=>{await(0,N.Eu)(n)})),(0,t.t6)("default",(async()=>{await(0,N.Eu)({exclude:[],explicit:[],duplicateMonomerPreferences:{}}),await e.loadMonomerLib(!0);const n=e.getMonomerLib();(0,t.E3)(n.getPolymerTypes().length>0,!0)})),(0,t.t6)("forTests",(async()=>{await e.loadMonomerLibForTests(),function(e,n){const r=n,i=e.getSummaryObj();for(const e in r)r[e]||delete r[e];for(const e in i)i[e]||delete i[e];if(0==Object.keys(r).length&&0!=Object.keys(i).length)throw new Error("Expected empty monomer lib, actual is not.");if(0!=Object.keys(r).length&&0==Object.keys(i).length)throw new Error("Expected non-empty monomer lib, actual is empty.");try{(0,t.Xk)(i,r),(0,t.Xk)(r,i)}catch(e){throw new Error(`Expected monomer lib ${JSON.stringify(r)} does not match actual ${JSON.stringify(i)}.`)}}(e.getMonomerLib(),R.VV)})),(0,t.t6)("empty",(async()=>{const n=await(0,N.ub)(),r=await e.getFileManager();let i=r.getValidLibraryPaths();0===i.length&&(i=await r.getValidLibraryPathsAsynchronously()),n.exclude=i,n.explicit=[],await(0,N.Eu)(n),await e.loadMonomerLib(!0);const s=e.getMonomerLib().getPolymerTypes();(0,t.E3)(0===s.length,!0)})),(0,t.t6)("override",(async()=>{const n={symbol:"over1",name:"Test override monomer 1",molfile:"",author:"Test Author",id:0,rgroups:[],smiles:"",polymerType:"PEPTIDE",monomerType:"Backbone",createDate:null},r=e.getMonomerLib(),i=r.getMonomer(n.polymerType,n.symbol);(0,t.E3)(null===i,!0,`Unexpectedly found monomer '${n.symbol}' `);const s=r.override({[n.polymerType]:{[n.symbol]:n}}).getMonomer(n.polymerType,n.symbol);(0,t.Xk)(s,n)}))}));var O=n(7389),k=n(1757),D=n.n(k),G=n(1858),H=n(6873),F=n(5433);async function U(n,r){const i=n(),s=e.DataFrame.fromColumns(i);await a.data.detectSemanticTypes(s);const o=Date.now(),c=(s.columns.byName("MSA"),a.shell.addTableView(s));await P(c.grid),(0,t.E3)(c.grid.dataFrame.id,s.id);const l=Date.now()-o;console.log(`Performance test: ${r}: ${l}ms`)}(0,t.L1)("renderers",(()=>{(0,t.t6)("long sequence performance ",(async()=>{await U(H.dW,"Long sequences")})),(0,t.t6)("many sequence performance",(async()=>{await U(H.fD,"Many sequences")})),(0,t.t6)("rendererMacromoleculeFasta",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("Sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("rendererMacromoleculeSeparator",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/SEPARATOR_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("rendererMacromoleculeDifference",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.meta.units=c.Hi.SEPARATOR,n.setTag(c.gp.separator,"/"),n.setTag(c.gp.aligned,"SEQ"),n.setTag(c.gp.alphabet,"UN"),n.setTag(c.gp.alphabetIsMultichar,"true"),n.semType=L.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(i.grid),(0,t.E3)(i.grid.dataFrame.id,r.id);const s=n.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(s,L.uF.MACROMOLECULE_DIFFERENCE)}()})),(0,t.t6)("afterMsa",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.fasta"),r=(0,p.importFasta)(n)[0],i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),console.log("Bio: tests/renderers/afterMsa, table view"),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${i.semType}", units="${i.meta.units}", cell.renderer="${i.getTag(e.TAGS.CELL_RENDERER)}"`),(0,t.E3)(i.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(i.meta.units,c.Hi.FASTA),(0,t.E3)(i.getTag(c.gp.aligned),"SEQ"),(0,t.E3)(i.getTag(c.gp.alphabet),c.YI.PT),(0,t.E3)(i.getTag(e.TAGS.CELL_RENDERER),"sequence");const u=await(0,b.D)({col:i});await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),(0,t.E3)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(u.meta.units,c.Hi.FASTA),(0,t.E3)(u.getTag(c.gp.aligned),"SEQ.MSA"),(0,t.E3)(u.getTag(c.gp.alphabet),c.YI.PT),(0,t.E3)(u.getTag(e.TAGS.CELL_RENDERER),"sequence"),l.G.forColumn(u)}()})),(0,t.t6)("afterConvert",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const u=await(0,F.r)(i,c.Hi.SEPARATOR,"/");await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const d=u.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(d,"sequence"),l.G.forColumn(u)}()})),(0,t.t6)("afterConvertToHelm",(async()=>{await async function(){const n=await a.dapi.files.readCsv("System:AppData/Bio/samples/FASTA_PT.csv"),r=a.shell.addTableView(n);await P(r.grid);const i=n.getCol("sequence"),s=l.G.forColumn(i).convert(c.Hi.HELM);n.columns.add(s),await P(r.grid),(0,t.E3)(s.getTag(e.TAGS.CELL_RENDERER),"helm")}()})),(0,t.t6)("selectRendererBySemType",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.meta.units=c.Hi.SEPARATOR,n.setTag(c.gp.separator,"/"),n.setTag(c.gp.aligned,"SEQ"),n.setTag(c.gp.alphabet,"UN"),n.setTag(c.gp.alphabetIsMultichar,"true"),n.semType=L.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]);a.shell.addTableView(r),await(0,t.cb)(100);const i=n.getTag(e.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'.`)}()})),(0,t.t6)("scatterPlotTooltip",(async()=>{await async function(){const r=e.DataFrame.fromCsv(n);r.currentRowIdx=0;const i=a.shell.addTableView(r),s=r.plot.scatter({x:"x",y:"y"});i.dockManager.dock(s,e.DOCK_TYPE.RIGHT,null),await Promise.all([(0,t.PE)(s.onAfterDrawScene,(()=>{}),(()=>{s.invalidateCanvas()}),1e3),P(i.grid,500)]);const o=s.root.getBoundingClientRect(),c=s.worldToScreen(1,0),l=new MouseEvent("mousemove",{cancelable:!0,bubbles:!0,view:window,button:0,clientX:o.left+c.x,clientY:o.top+c.y}),u=D()(s.root).find("canvas").get()[0];await(0,t.PE)((0,G.fromEvent)(u,"mousemove"),(()=>{Se.logger.debug(`Test: event, currentRowIdx=${r.currentRowIdx}`),(0,t.E3)(D()(O.tooltip.root).find("div table.d4-row-tooltip-table tr td canvas").length,1),(0,t.E3)(s.hitTest(c.x,c.y),1)}),(()=>{u.dispatchEvent(l)}),500),await P(i.grid,500)}()}));const n="seq,x,y\nACGGTGTCGT,0,0\nCGGTATCCCT,1,0\nCTCGGCATGC,2,0\n"}));var V=n(6882);(0,t.L1)("renderers: monomerPlacer",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)}));const i={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:5}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:5}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:297},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,r]of Object.entries(i))(0,t.t6)(`getPosition-${n}`,(async()=>{const t=e.DataFrame.fromCsv(r.csv);await a.data.detectSemanticTypes(t);const n=t.getCol("seq"),i=new V.Jy(null,n,Se.logger,3,(()=>({seqHandler:l.G.forColumn(n),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.zS}))),s=r.testList;for(let e=0;e<n.length;++e)i.getCellMonomerLengths(e,1e4);const o=[];for(const[e,t]of E().enumerate(s)){const t={pos:i.getPosition(e.src.row,e.src.x,1e4)};e.tgt.pos!=t.pos&&o.push(`Test src ${JSON.stringify(e.src)} expected tgt ${JSON.stringify(e.tgt)}, but get ${JSON.stringify({res:t})}`)}if(o.length>0)throw new Error("Test failed error(s):\n"+o.join(", \n"))}))})),(0,t.L1)("renderers: monomerPlacer",(()=>{const e=[10,20,30,40,50,60],n={left:{x:3,tgt:null},c0left:{x:10,tgt:0},c0mid:{x:12,tgt:0},c0right:{x:19,tgt:0},c1left:{x:20,tgt:1},c2right:{x:39,tgt:2},c4left:{x:50,tgt:4},c4right:{x:59,tgt:4},max:{x:60,tgt:null},right:{x:65,tgt:null}};for(const[r,i]of Object.entries(n))(0,t.t6)("hitBounds-"+r,(async()=>{const n=(0,V.Bb)(e,i.x);(0,t.E3)(n,i.tgt)}))})),(0,t.L1)("converters",(()=>{let n;!function(e){e.fastaPt="fastaPt",e.separatorPt="separatorPt",e.helmPt="helmPt",e.fastaDna="fastaDna",e.separatorDna="separatorDna",e.helmDna="helmDna",e.fastaRna="fastaRna",e.separatorRna="separatorRna",e.helmRna="helmRna",e.fastaGaps="fastaGaps",e.separatorGaps="separatorGaps",e.helmGaps="helmGaps",e.fastaUn="fastaUn",e.separatorUn="separatorUn",e.helmUn="helmUn",e.helmLoneDeoxyribose="helmLoneDeoxyribose",e.helmLoneRibose="helmLoneRibose",e.helmLonePhosphorus="helmLonePhosphorus",e.fastaLoneDeoxyribose="fastaLoneDeoxyribose",e.fastaLoneRibose="fastaLoneRibose",e.fastaLonePhosphorus="fastaLonePhosphorus"}(n||(n={}));const r={[n.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[n.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",[n.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}$$$$",[n.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[n.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",[n.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}$$$$",[n.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[n.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",[n.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}$$$$",[n.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[n.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",[n.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}$$$$",[n.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]",[n.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",[n.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}$$$$",[n.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}$$$$",[n.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}$$$$",[n.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}$$$$"},i=new Set(Object.values(c.gp));async function s(t){const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i}function o(e,n){if(e===c.Hi.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${e.toString()}'.`);return function(r){const i=l.G.forColumn(r).convert(e,n);return(0,t.E3)(i.meta.units,e),i}}async function u(e,n,r){const o=(await s(e)).getCol("seq"),a=n(o),u=(await s(r)).getCol("seq");(0,t.J6)(a.toList(),u.toList());const d=l.G.forColumn(o),h=l.G.forColumn(a);for(const[e,n]of Object.entries(u.tags)){if(!i.has(e)||d.notation===c.Hi.HELM&&[c.gp.alphabet,c.gp.alphabetIsMultichar].includes(e)||h.notation===c.Hi.HELM&&[c.gp.alphabet,c.gp.alphabetIsMultichar].includes(e))continue;const r=a.getTag(e);(0,t.E3)(r,n,`Tag '${e}' expected value '${n}' is not equal to actual '${r}'.`)}}(0,t.t6)("testFastaPtToSeparator",(async()=>{await u(n.fastaPt,o(c.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testFastaDnaToSeparator",(async()=>{await u(n.fastaDna,o(c.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testFastaRnaToSeparator",(async()=>{await u(n.fastaRna,o(c.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testFastaGapsToSeparator",(async()=>{await u(n.fastaGaps,o(c.Hi.SEPARATOR,"/"),n.separatorGaps)})),(0,t.t6)("testFastaUnToSeparator",(async()=>{await u(n.fastaUn,o(c.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testFastaPtToHelm",(async()=>{await u(n.fastaPt,o(c.Hi.HELM),n.helmPt)})),(0,t.t6)("testFastaDnaToHelm",(async()=>{await u(n.fastaDna,o(c.Hi.HELM),n.helmDna)})),(0,t.t6)("testFastaRnaToHelm",(async()=>{await u(n.fastaRna,o(c.Hi.HELM),n.helmRna)})),(0,t.t6)("testFastaGapsToHelm",(async()=>{await u(n.fastaGaps,o(c.Hi.HELM),n.helmGaps)})),(0,t.t6)("testSeparatorPtToFasta",(async()=>{await u(n.separatorPt,o(c.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testSeparatorDnaToFasta",(async()=>{await u(n.separatorDna,o(c.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testSeparatorRnaToFasta",(async()=>{await u(n.separatorRna,o(c.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testSeparatorGapsToFasta",(async()=>{await u(n.separatorGaps,o(c.Hi.FASTA),n.fastaGaps)})),(0,t.t6)("testSeparatorUnToFasta",(async()=>{await u(n.separatorUn,o(c.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testSeparatorPtToHelm",(async()=>{await u(n.separatorPt,o(c.Hi.HELM),n.helmPt)})),(0,t.t6)("testSeparatorDnaToHelm",(async()=>{await u(n.separatorDna,o(c.Hi.HELM),n.helmDna)})),(0,t.t6)("testSeparatorRnaToHelm",(async()=>{await u(n.separatorRna,o(c.Hi.HELM),n.helmRna)})),(0,t.t6)("testSeparatorGapsToHelm",(async()=>{await u(n.separatorGaps,o(c.Hi.HELM),n.helmGaps)})),(0,t.t6)("testHelmDnaToFasta",(async()=>{await u(n.helmDna,o(c.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testHelmRnaToFasta",(async()=>{await u(n.helmRna,o(c.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmPtToFasta",(async()=>{await u(n.helmPt,o(c.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testHelmUnToFasta",(async()=>{await u(n.helmUn,o(c.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testHelmDnaToSeparator",(async()=>{await u(n.helmDna,o(c.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmRnaToSeparator",(async()=>{await u(n.helmRna,o(c.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testHelmPtToSeparator",(async()=>{await u(n.helmPt,o(c.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testHelmUnToSeparator",(async()=>{await u(n.helmUn,o(c.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testHelmLoneRibose",(async()=>{await u(n.helmLoneRibose,o(c.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmLoneDeoxyribose",(async()=>{await u(n.helmLoneDeoxyribose,o(c.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmLonePhosphorus",(async()=>{await u(n.helmLonePhosphorus,o(c.Hi.FASTA),n.fastaRna)}))}));var B=n(3516);(0,t.L1)("fastaFileHandler",(()=>{const n=["description:1","description:2","description:3","description:4"],r=(e.Column.fromStrings("description",n),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function i(e){const i=new B.m(e),s=i.descriptionsArray,o=i.sequencesArray;(0,t.J6)([s,o],[n,r])}(0,t.t6)("testNormalFormatting",(async()=>{i(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,t.t6)("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,t.t6)("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 Y=n(3890);(0,t.L1)("fastaExport",(()=>{let n;!function(e){e.single="single",e.multi="multi"}(n||(n={}));const r={[n.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[n.multi]:{src:"M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",tgt:["M[MeI]YKETLL[MeF]P","KTDFPMRGGL","[MeA]"]}};let i;!function(e){e.test1="test1",e.test2="test2"}(i||(i={}));const s={[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 o(n,i=10){const s=r[n].src,o=e.Column.fromStrings("src",[s]);o.semType=e.SEMTYPE.MACROMOLECULE,o.meta.units=c.Hi.FASTA;const a=l.G.forColumn(o).getSplitted(0),u=(0,Y.aS)(a,i),d=r[n].tgt;(0,t.J6)(u,d)}async function a(n){const r=e.DataFrame.fromCsv(n.srcCsv),i=r.getCol(n.seqCol);i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=c.Hi.FASTA;const s=n.idCols.map((e=>r.getCol(e))),o=(0,Y.wz)(s,i,n.lineWidth);(0,t.E3)(o,n.tgtFasta)}(0,t.t6)("wrapSequenceSingle",(async()=>{o(n.single,10)})),(0,t.t6)("wrapSequenceMulti",(async()=>{o(n.multi,10)})),(0,t.t6)("saveAsFastaTest1",(async()=>{a(s[i.test1])})),(0,t.t6)("saveAsFastaTest2",(async()=>{a(s[i.test2])}))}));var W=n(4152),j=n(439);const K=j._S;(0,t.L1)("bio",(()=>{const n="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.t6)("testGetStatsHelm1",(async()=>{const n=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.HELM;const r=(0,T.vZ)(n,1,c.qp);(0,t.Xk)(r.freq,{meI:1}),(0,t.E3)(r.sameLength,!0)})),(0,t.t6)("testGetStatsN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA;const i=(0,T.vZ)(r,5,c.J9);(0,t.Xk)(i.freq,{A:4,C:5,G:3,T:6}),(0,t.E3)(i.sameLength,!0)}(n)})),(0,t.t6)("testGetAlphabetSimilarity",(async()=>{await async function(){const e={A:2041,C:3015,G:3015,T:2048,[K]:1e3},n=new Set(Object.keys(o.Q.Names)),r=(0,c.nq)(e,n);(0,t.E3)(r>.6,!0)}()})),(0,t.t6)("testPickupPaletteN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA;const i=(0,c.SM)(r);(0,t.E3)(i instanceof o.A,!0)}(n)})),(0,t.t6)("testPickupPaletteN1e",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.FASTA;const r=(0,c.SM)(n);(0,t.E3)(r instanceof o.A,!0)}()})),(0,t.t6)("testPickupPaletteAA1",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.FASTA;const r=(0,c.SM)(n);(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPickupPaletteX",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=c.Hi.FASTA;const r=(0,c.SM)(n);(0,t.E3)(r instanceof W.$u,!0)}()}))})),(0,t.L1)("WebLogo.monomerToShort",(()=>{(0,t.t6)("longMonomerSingle",(async()=>{(0,t.E3)((0,c.zS)("S",5),"S")})),(0,t.t6)("longMonomerShort",(async()=>{(0,t.E3)((0,c.zS)("Short",5),"Short")})),(0,t.t6)("longMonomerLong56",(async()=>{(0,t.E3)((0,c.zS)("Long56",6),"Long56")})),(0,t.t6)("longMonomerComplexFirstPartShort",(async()=>{(0,t.E3)((0,c.zS)("Long-long",5),"Long…")})),(0,t.t6)("longMonomerComplexFirstPartLong56",(async()=>{(0,t.E3)((0,c.zS)("Long56-long",6),"Long5…")})),(0,t.t6)("monomerToShort",(async()=>{const e=[["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…"]],n=e.map((e=>e[0])),r=e.map((e=>e[1])),i=n.map((e=>(0,c.zS)(e,3)));(0,t.J6)(i,r)}))}));var z=n(8047);const q=j._S;function Z(e,n){(0,t.E3)(e.name,n.name),(0,t.J6)(e.getMonomers(),n.getMonomers());for(const r of e.getMonomers())(0,t.E3)(e.getFreq(r).rowCount,n.getFreq(r).rowCount)}(0,t.L1)("WebLogo-positions",(()=>{const n="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.t6)("allPositions",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=c.Hi.FASTA,s.setTag(c.gp.alphabet,c.YI.DNA),s.setTag(c.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo");await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500,"Layout calculate timeout");const l=o.positions,u=[new z.Ue(0,"1",{A:new z.Tc(2),[q]:new z.Tc(3)}),new z.Ue(1,"2",{T:new z.Tc(5)}),new z.Ue(2,"3",{C:new z.Tc(5)}),new z.Ue(3,"4",{[q]:new z.Tc(5)}),new z.Ue(4,"5",{G:new z.Tc(5)}),new z.Ue(5,"6",{[q]:new z.Tc(3),C:new z.Tc(2)}),new z.Ue(6,"7",{T:new z.Tc(5)}),new z.Ue(7,"8",{T:new z.Tc(5)}),new z.Ue(8,"9",{G:new z.Tc(5)}),new z.Ue(9,"10",{C:new z.Tc(5)}),new z.Ue(10,"11",{[q]:new z.Tc(5)}),new z.Ue(11,"12",{[q]:new z.Tc(5)})];(0,t.E3)(l.length,u.length);for(let e=0;e<l.length;e++){(0,t.E3)(l[e].name,u[e].name);for(const n of l[e].getMonomers())(0,t.E3)(l[e].getFreq(n).rowCount,u[e].getFreq(n).rowCount)}await o.awaitRendered()})),(0,t.t6)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const n=e.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-"),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=c.Hi.FASTA,i.setTag(c.gp.alphabet,c.YI.DNA),i.setTag(c.gp.aligned,"SEQ"),n.filter.init((e=>e>2)),n.filter.fireChanged();const s=await n.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.PE)(s.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(s.root,e.DOCK_TYPE.DOWN)}),500);const o=s.positions,l=[new z.Ue(0,"1",{[q]:new z.Tc(3)}),new z.Ue(1,"2",{T:new z.Tc(3)}),new z.Ue(2,"3",{[q]:new z.Tc(3)}),new z.Ue(3,"4",{[q]:new z.Tc(3)}),new z.Ue(4,"5",{C:new z.Tc(3)}),new z.Ue(5,"6",{[q]:new z.Tc(2),C:new z.Tc(1)}),new z.Ue(6,"7",{G:new z.Tc(3)}),new z.Ue(7,"8",{T:new z.Tc(3)}),new z.Ue(8,"9",{[q]:new z.Tc(3)})];(0,t.E3)(o.length,l.length);for(let e=0;e<o.length;e++){(0,t.E3)(o[e].name,l[e].name);for(const n of o[e].getMonomers())(0,t.E3)(o[e].getFreq(n).rowCount,l[e].getFreq(n).rowCount)}await s.awaitRendered()})),(0,t.t6)("positions with skipEmptyPositions option",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=c.Hi.FASTA,s.setTag(c.gp.alphabet,c.YI.DNA),s.setTag(c.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,u=[new z.Ue(0,"1",{A:new z.Tc(2),[q]:new z.Tc(3)}),new z.Ue(1,"2",{T:new z.Tc(5)}),new z.Ue(2,"3",{C:new z.Tc(5)}),new z.Ue(4,"5",{G:new z.Tc(5)}),new z.Ue(5,"6",{[q]:new z.Tc(3),C:new z.Tc(2)}),new z.Ue(6,"7",{T:new z.Tc(5)}),new z.Ue(7,"8",{T:new z.Tc(5)}),new z.Ue(8,"9",{G:new z.Tc(5)}),new z.Ue(9,"10",{C:new z.Tc(5)})];(0,t.E3)(l.length,u.length);for(let e=0;e<l.length;e++)Z(l[e],u[e]);await o.awaitRendered()})),(0,t.t6)("count sequences for monomer at position",(async()=>{const r=function(t,n,r){const i=e.DataFrame.fromCsv(t),s=i.getCol("seq");return s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=n,s.setTag(c.gp.alphabet,r),s.setTag(c.gp.aligned,"SEQ.MSA"),i}(n,c.Hi.FASTA,c.YI.DNA),i=r.getCol("seq"),s=a.shell.addTableView(r),o=await r.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{s.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const u=o.positions,d=[new z.Ue(2,"3",{C:new z.Tc(5)}),new z.Ue(4,"5",{G:new z.Tc(5)}),new z.Ue(5,"6",{[q]:new z.Tc(3),C:new z.Tc(2)}),new z.Ue(6,"7",{T:new z.Tc(5)})];(0,t.E3)(u.length,d.length);for(let e=0;e<u.length;e++)Z(u[e],d[e]);const h=u[1],p=l.G.forColumn(i),m=(0,z.eN)(r,p,r.filter,"G",h);(0,t.E3)(m,5),await o.awaitRendered()})),(0,t.t6)("empty",(async()=>{const n=e.DataFrame.fromColumns([(()=>{const t=e.Column.fromStrings("seq",[]);return t.semType=e.SEMTYPE.MACROMOLECULE,t.meta.units=c.Hi.FASTA,t.setTag(c.gp.alphabet,c.YI.DNA),t})()]),r=a.shell.addTableView(n),i=await n.plot.fromType("WebLogo");await(0,t.PE)(i.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500),i.positions,await i.awaitRendered()}))})),(0,t.L1)("WebLogo-project",(()=>{(0,t.t6)("fasta",(async()=>{const n="Tests.Bio.WebLogo-project.fasta",r=await Se.files.readCsv("tests/filter_FASTA.csv"),i=r.name,s=r.getCol("fasta");await a.data.detectSemanticTypes(r);const o=a.shell.addTableView(r),c=await r.plot.fromType("WebLogo",{sequenceColumnName:s.name});o.dockManager.dock(c),await c.awaitRendered(),await P(o.grid),await async function(t,n,r,i){const s=e.Project.create(),o=r.saveLayout();s.name=t,s.addChild(n),s.addChild(o),await a.dapi.layouts.save(r.saveLayout()),await a.dapi.tables.uploadDataFrame(i),await a.dapi.tables.save(n),await a.dapi.projects.save(s)}(n,r.getTableInfo(),o,r),a.shell.closeAll(),await(0,t.cb)(500),await a.dapi.projects.open(n);const l=a.shell.getTableView(i),u=E()(l.viewers).toArray();(0,t.E3)(u.length,2),(0,t.E3)(u.filter((e=>"Grid"===e.type)).length,1);const d=u.find((e=>"WebLogo"===e.type));(0,t.E3)(!!d,!0),await P(o.grid),await d.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.L1)("WebLogo-layout",(()=>{(0,t.t6)("fasta",(async()=>{const e=await Se.files.readCsv("tests/filter_FASTA.csv"),n=e.getCol("fasta");await a.data.detectSemanticTypes(e);const r=a.shell.addTableView(e),i=await e.plot.fromType("WebLogo",{sequenceColumnName:n.name});r.dockManager.dock(i),await(0,t.cb)(2*z.VN.render),await i.awaitRendered(),await P(r.grid);const s=r.saveLayout();s.toJson(),r.loadLayout(s),await(0,t.cb)(2*z.VN.render),await i.awaitRendered(),await P(r.grid);const o=E()(r.viewers).toArray();(0,t.E3)(o.length,2),(0,t.E3)(o.filter((e=>"Grid"===e.type)).length,1),(0,t.E3)(o.filter((e=>"WebLogo"===e.type)).length,1)}))}));var X=n(966);function J(e,t){let n=null;for(const r of e.viewers)r.type===t&&(n=r);return n}(0,t.L1)("checkInputColumn",(()=>{const n="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.t6)("testMsaPos",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA,r.setTag(c.gp.alphabet,c.YI.DNA),r.setTag(c.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[c.Hi.FASTA],[c.YI.DNA,c.YI.RNA,c.YI.PT]);(0,t.E3)(i,!0)})),(0,t.t6)("testMsaNegHelm",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.HELM,r.setTag(c.gp.alphabetIsMultichar,"true");const[i,s]=(0,X.l)(r,"Test",[c.Hi.FASTA],[c.YI.DNA,c.YI.RNA,c.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testMsaNegUN",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=c.Hi.FASTA,r.setTag(c.gp.alphabet,"UN"),r.setTag(c.gp.alphabetSize,"11"),r.setTag(c.gp.alphabetIsMultichar,"true"),r.setTag(c.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[c.Hi.FASTA],[c.YI.DNA,c.YI.RNA,c.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testGetActionFunctionMeta",(async()=>{e.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((e=>"sequence"==e.name))}))})),(0,t.L1)("similarity/diversity",(async()=>{(0,t.t6)("similaritySearchViewer",(async()=>{await async function(){const n=await Se.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r),s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Similarity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.RIGHT,null,"Similarity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"Sequence Similarity Search")),"Sequence Similarity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.scores.get(0),e.FLOAT_NULL),(0,t.E3)(l.idxs.get(0),0),(0,t.E3)(l.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,t.E3)(l.scores.get(1).toFixed(2),"0.73"),(0,t.E3)(l.idxs.get(1),4),(0,t.E3)(l.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,t.bk)((()=>1===l.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,t.bk)((()=>"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"===l.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,t.t6)("diversitySearchViewer",(async()=>{await async function(){const n=await Se.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Diversity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.DOWN,null,"Diversity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"Sequence Diversity Search")),"Sequence Diversity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.initialized,!0),(0,t.E3)(l.renderMolIds.length>0,!0)}()}))}));var Q=n(9124),ee=n(1687),te=n(4577);async function ne(e,t){if(!t.columns.names().includes(e))throw new Error(`The column '${e}' not found. Available in data frame are ${JSON.stringify(t.columns.names())}`);const n=new ee._i;return n.attach(t),n.applyState({columnName:e}),n.column=t.col(e),n.columnName=e,n}(0,t.L1)("bio-substructure-filters",(async()=>{let n,r,i;(0,t.gM)((async()=>{n=await(0,Q.b2)(),r=await(0,S.pj)(),i=await(0,N.ub)(),await r.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("fasta",(async()=>{const e=await M("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=new ee._i;n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new te.n("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,3),(0,t.E3)(n.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("separator",(async()=>{const e=await M("tests/filter_MSA.csv"),n=new ee._i;await a.data.detectSemanticTypes(e),n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"SeparatorBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,0),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1)}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",n=await M("tests/filter_HELM.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n);Se.logger.debug(`${e}, filter attaching.`);const i=new ee._i;i.attach(n);const s=O.dialog("Test filters").add(i.root).show();await i.awaitRendered();try{const s=i.bioFilter;(0,t.E3)(null!==i.bioFilter,!0,"bioFilter is not created"),Se.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{A.C}$$$$V2.0")}),2e4),Se.logger.debug(`${e}, filter 1 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,1),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"0001"),Se.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{C}$$$$V2.0")}),2e4),await P(r.grid),Se.logger.debug(`${e}, filter 2 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,2),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"1001")}finally{s.close()}await i.awaitRendered(),await(0,t.cb)(3e3)})),(0,t.t6)("helm-view",(async()=>{const e=await M("tests/filter_HELM.csv");e.getCol("HELM string"),await a.data.detectSemanticTypes(e);const t=a.shell.addTableView(e);t.getFiltersGroup(),await P(t.grid)})),(0,t.t6)("sync-fasta",(async()=>{const e=await Se.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=await ne("fasta",e),r=await ne("fasta",e);await Promise.all([n.awaitRendered(),r.awaitRendered()]);try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter"),(0,t.E3)(r.bioFilter.type,"FastaBioFilter");const i=n.bioFilter,s=r.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new te.n("MD")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,3),await n.awaitRendered(),(0,t.E3)(s.props.substructure,"MD")}finally{n.detach(),r.detach()}await Promise.all([n.awaitRendered(),r.awaitRendered()])})),(0,t.t6)("sync-msa",(async()=>{const e=await Se.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const n="hHis-Aca",r=await ne("MSA",e),i=await ne("MSA",e);await Promise.all([r.awaitRendered(),i.awaitRendered()]);try{(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(r.bioFilter.type,"SeparatorBioFilter"),(0,t.E3)(i.bioFilter.type,"SeparatorBioFilter");const s=r.bioFilter,o=i.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new ee.AR(n,"-")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,8),(0,t.E3)(o.props.substructure,n),(0,t.E3)(o.props.separator,"-")}finally{r.detach(),i.detach()}await Promise.all([r.awaitRendered(),i.awaitRendered()])})),(0,t.t6)("sync-helm",(async()=>{const e=await Se.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),r="PEPTIDE1{A.C}$$$$V2.0",i=await ne("HELM string",e),s=await ne("HELM string",e),o=O.dialog("Test filters").add(i.root).add(s.root).show();await Promise.all([i.awaitRendered(),s.awaitRendered()]);try{(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(!!s.bioFilter,!0),(0,t.E3)(i.bioFilter.type,"HelmBioFilter"),(0,t.E3)(s.bioFilter.type,"HelmBioFilter");const o=i.bioFilter,a=s.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(r)}),6e4,"await onRowsFiltered"),await P(n.grid),Se.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.cb)(2*i.debounceTime),Se.logger.debug("Bio tests: substructureFilters/sync-helm, after changed event"),(0,t.E3)(e.filter.trueCount,1),await i.awaitRendered(),(0,t.E3)(a.props.substructure,r)}finally{i.detach(),s.detach(),o.close()}await Promise.all([i.awaitRendered(),s.awaitRendered()]),await P(n.grid),await(0,t.cb)(3e3)})),(0,t.t6)("two-columns-fasta",(async()=>{const n=e.DataFrame.fromCsv("id,seq1,seq2,trueSeq1,trueSeq2\n0,CGGCTACGGC,ATTGCATTCG,0,1,\n1,CGGCTGCCGC,ATAGCATTCG,1,1,\n2,CGGCTGCGCC,AATGCATACG,1,0,\n3,CGGCTGCATT,TTTGCATTCG,1,1,\n4,CGGCTGCATT,AAAGCATACG,1,0,\n");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i="seq1",s="CGGCTG",o=n.getCol("trueSeq1").toList(),c="seq2",l="GCATT",u=n.getCol("trueSeq2").toList(),d=[{type:"Bio:bioSubstructureFilter",columnName:i},{type:"Bio:bioSubstructureFilter",columnName:c}],h=await n.plot.fromType(e.VIEWER.FILTERS,{filters:d});r.dockManager.dock(h,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid);const p=h.filters[0],m=h.filters[1];(0,t.E3)(p.column.name,i),(0,t.E3)(m.column.name,c);const f=p.bioFilter,g=m.bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on seq1"),(0,t.E3)(n.filter.trueCount,o.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),o.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),1e3,"testEvent onRowsFiltered on seq2"),(0,t.E3)(n.filter.trueCount,u.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),u.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on neither"),(0,t.E3)(n.filter.trueCount,n.rowCount),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),5e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),5e3,"testEvent onRowsFiltered on both");const y=E().count(0).take(n.rowCount).map((e=>o[e]*u[e])).toArray();(0,t.E3)(n.filter.trueCount,y.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),y.map((e=>e.toString())).join("")),await Promise.all([p.awaitRendered(),m.awaitRendered(),P(r.grid)])})),(0,t.t6)("reset-fasta",(async()=>{const n=await M("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i="MD",s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}]});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid);const o=s.filters[0].bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(i)}),1e3,"testEvent onRowsFiltered"),(0,t.E3)(n.filter.trueCount,3),(0,t.E3)(o.props.substructure,i),(0,t.E3)(o.substructureInput.value,i),D()(s.root).find('i[name="icon-arrow-rotate-left"]')[0].click(),await(0,t.cb)(100),await P(r.grid),(0,t.E3)(o.props.substructure,""),(0,t.E3)(o.substructureInput.value,"")})),(0,t.t6)("reopen",(async()=>{const n=await Se.files.readCsv("tests/filter_FASTA.csv"),r=a.shell.addTableView(n),i=[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}],s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid),s.close(),await P(r.grid);const o=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(o,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid)}))}));var re=n(8152);class ie{errorList=[];warningList=[];infoList=[];debugList=[];error(e,t,n){this.errorList.push({message:e,params:t,stackTrace:n})}warning(e,t){this.warningList.push({message:e,params:t})}info(e,t){this.infoList.push({message:e,params:t})}debug(e,t){this.debugList.push({message:e,params:t})}}var se=n(9192);(0,t.L1)("PepSeA",(()=>{(0,t.gM)((async()=>{await(0,w.m8)()})),(0,t.t6)("Basic alignment",(async()=>{const n=e.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'),r=await(0,re.GD)(n.getCol("HELM"),"msa(HELM)"),i=n.getCol("MSA");for(let e=0;e<r.length;++e)(0,t.E3)(r.get(e)==i.get(e),!0)}),{timeout:6e4,stressTest:!0}),(0,t.t6)("stderr",(async()=>{const n=new ie,r=e.DataFrame.fromCsv('HELM,MSA\n"PEPTIDE1{F.L.Mis.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.Mis.G.W.MeF.Y..S.N.N.C"\n"PEPTIDE1{F.L.Mis.G.Y.[MeF].Y.W.N.C}$$$$","F.L.Mis.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'),i=await(0,re.GD)(r.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n),s=r.getCol("MSA");(0,t.J6)(i.toList(),s.toList()),(0,t.E3)(n.warningList[0].message,"Mis not found in Monomer Map\nMeF not found in Monomer Map\n")}),{timeout:6e4,stressTest:!0}),(0,t.t6)("error",(async()=>{const n=new ie;try{const t=e.DataFrame.fromCsv('HELM\n"PEPTIDE1{[NH2].*.A.Q.T.T.Y.K.N.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].M.A.N.T.T.Y.K.N.Y.R.N.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.C.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.F.Y.R.R.N.L.L.*.[COOH]}$$$$"\n');await(0,re.GD)(t.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n)}catch(e){const[t,r]=(0,se.AP)(e);n.error(t,void 0,r)}(0,t.E3)(n.errorList[0].message,"PepSeA error: The pair (*,M) couldn't be found in the substitution matrix")}))})),(0,t.L1)("viewers",(()=>{const n=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of n)(0,t.t6)(e,(async()=>{const n=await M("samples/FASTA_DNA.csv");await(0,t.Bl)(e,n,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const oe="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",ae="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",ce="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 le;(0,t.L1)("SeqHandler",(()=>{async function n(t){const n=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(n);const r=l.G.forColumn(n.getCol("seq"));return[n,r]}(0,t.t6)("Seq-Fasta",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Fasta-units",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA-units",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,c.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Helm",(async()=>{const[e,r]=await n("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,t.E3)(r.notation,c.Hi.HELM),(0,t.E3)(r.isHelm(),!0)})),(0,t.t6)("Seq-UN",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,c.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,c.YI.UN)})),(0,t.t6)("Seq-UN-auto",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,c.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,c.YI.UN)})),(0,t.t6)("column-version",(async()=>{const n=e.DataFrame.fromCsv(oe);await a.data.detectSemanticTypes(n);const r=n.getCol("seq"),i=l.G.forColumn(r),s=r.version,o=l.G.forColumn(r),c=r.version;(0,t.E3)(s,c,"Unexpected column version changed"),(0,t.E3)(i,o,"Unexpected SeqHandler object changed"),n.rows.addNew(["TACCCCTTCAAC"]);const u=l.G.forColumn(r),d=r.version;(0,t.E3)(c<d,!0,"Stalled column version on add row"),(0,t.E3)(o!==u,!0,"Stalled SeqHandler object on add row"),r.set(1,"CAGTGTCCCCGT");const h=l.G.forColumn(r),p=r.version;(0,t.E3)(d<p,!0,"Stalled column version on change data"),(0,t.E3)(u!==h,!0,"Stalled SeqHandler object on change data"),r.setTag("testTag","testValue");const m=l.G.forColumn(r),f=r.version;(0,t.E3)(p<f,!0,"Stalled column version on set tag"),(0,t.E3)(h!==m,!0,"Stalled SeqHandler object on set tag")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(le||(le={})),(0,t.L1)("SeqHandler",(()=>{j.b9[c.Hi.FASTA],j.b9[c.Hi.HELM];const n=j.b9[c.Hi.SEPARATOR],r={[le.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.Hi.FASTA,splitted:[["A","C","G","T","C","A","C","G","T","C"],["C","A","G","T","G","T","C","A","G","T","G","T"],["T","T","C","A","A","C","T","T","C","A","A","C"]]}},[le.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.Hi.FASTA,splitted:[["A","C","-","G","T","-","C","T","A","C","-","G","T","-","C","T"],["C","A","C","-","T","-","G","T","C","A","C","-","T","-","G","T"],["A","C","C","G","T","A","C","T","A","C","C","G","T","A","C","T"]]}},[le.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.Hi.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"]]}},[le.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.Hi.SEPARATOR,separator:"-",splitted:[["rut0","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut1","her2","rty",n,"abc1","dfgg","rut12","her2","rty",n,"abc1","dfgg"],["rut2","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],["rut3","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],[n,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",n]]}},[le.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.Hi.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[n,i]of Object.entries(r))(0,t.t6)(`splitted-${n}`,(async()=>{const n=e.DataFrame.fromCsv(i.src.csv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),(0,t.E3)(n.semType,e.SEMTYPE.MACROMOLECULE);const s=l.G.forColumn(n);(0,t.E3)(s.notation,i.tgt.notation),(0,t.E3)(s.separator===i.tgt.separator,!0);const o=E().count(0).take(s.length).map((e=>{const t=s.getSplitted(e);return E().count(0).take(t.length).map((e=>t.getOriginal(e))).toArray()})).toArray();(0,t.J6)(o,i.tgt.splitted)}))})),(0,t.L1)("SeqHandler: getRegion",(()=>{const n={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:c.Hi.FASTA,alphabet:c.YI.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.Hi.SEPARATOR,alphabet:c.YI.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.Hi.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`${r}-idx`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=l.G.forColumn(n).getRegion(i.startIdx,i.endIdx,"regSeq"),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(c.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(c.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())})),i.positionNames&&(0,t.t6)(`${r}-positionNames`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq");i.positionNames.tag&&n.setTag(c.gp.positionNames,i.positionNames.tag);const r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=await a.functions.call("Bio:getRegion",{sequence:n,start:i.positionNames.start,end:i.positionNames.end}),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(c.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(c.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())}))})),(0,t.L1)("SeqHandler: getHelm",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)}));const i={fasta:{src:{seq:"MDYKETMDYKET",notation:c.Hi.FASTA},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},separator:{src:{seq:"M-D-Y-K-E-T-M-D-Y-K-E-T",notation:c.Hi.SEPARATOR,separator:"-"},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},helm:{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$$$$",notation:c.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$$$$"}},"helm-cyclic":{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0",notation:c.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0"}}};for(const[e,n]of Object.entries(i))(0,t.t6)(e,(async()=>{await s(n.src.seq,n.src.notation,n.src.separator,n.tgt.helm)}));async function s(n,r,i,s){const o=e.Column.fromStrings("seq",[n]),c=e.DataFrame.fromColumns([o]);await a.data.detectSemanticTypes(c);const u=l.G.forColumn(o),d=await u.getHelm(0,!1);(0,t.E3)(d,s)}}));var ue=n(6077),de=n(6717);const he=new e.FileSource("System:AppData/Bio"),pe={"peptides-fasta":{inPath:"tests/to-atomic-level-peptides-fasta-input.csv",outPath:"tests/to-atomic-level-peptides-fasta-output.csv"},"dna-fasta":{inPath:"tests/to-atomic-level-dna-fasta-input.csv",outPath:"tests/to-atomic-level-dna-fasta-output.csv"},"msa-separator":{inPath:"tests/to-atomic-level-msa-separator-input.csv",outPath:"tests/to-atomic-level-msa-separator-output.csv"},"msa-fasta":{inPath:"tests/to-atomic-level-msa-fasta-input.csv",outPath:"tests/to-atomic-level-msa-fasta-output.csv"}},me="molfile(sequence)";function fe(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.L1)("toAtomicLevel",(async()=>{const n={},r={};let i,s,o,u,d;async function h(e,n){const r=e.getCol("sequence");await a.functions.call("Bio:toAtomicLevel",{table:e,seqCol:r,nonlinear:!1});const i=e.getCol(me),s=n.getCol(me),o=E()(i.values()).map((e=>fe(e))).toArray(),c=E()(s.values()).map((e=>fe(e))).toArray();(0,t.J6)(o,c)}(0,t.gM)((async()=>{u=await(0,de.j)(),i=await(0,S.pj)(),s=await(0,N.ub)(),await i.loadMonomerLibForTests(),o=i.getMonomerLib();for(const[t,i]of Object.entries(pe))i.inPath,n[t]=e.DataFrame.fromCsv((await he.readAsText(i.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(n[t]),r[t]=e.DataFrame.fromCsv((await he.readAsText(i.outPath)).replace(/\n$/,""))})),(0,t.Pl)((async()=>{await(0,N.Eu)(s),await i.loadMonomerLib(!0)}));for(const[e,i]of Object.entries(pe))(0,t.t6)(`${e}`,(async()=>{await h(n[e],r[e])}));!function(e){e.fastaDna="fastaDna",e.fastaRna="fastaRna",e.fastaPt="fastaPt",e.fastaUn="fastaUn",e.separatorDna="separatorDna",e.separatorRna="separatorRna",e.separatorPt="separatorPt",e.separatorUn="separatorUn",e.helm="helm"}(d||(d={}));const p={[d.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[d.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[d.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[d.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][Tyr_PO3H2]",[d.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",[d.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",[d.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",[d.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",[d.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(t){const n=p[t],r=e.DataFrame.fromCsv(n.replace(/\n$/,""));return await a.data.detectSemanticTypes(r),r}async function f(e,t="seq",n){const r=e.getCol(t),i=await(0,ue.C4)(e,r,o,u);return i.warnings.length>0&&Se.logger.warning(`_toAtomicLevel() warnings ${i.warnings.join("\n")}`),i.molCol}(0,t.t6)("fastaDna",(async()=>{await f(await m(d.fastaDna),"seq")})),(0,t.t6)("fastaRna",(async()=>{await f(await m(d.fastaRna),"seq")})),(0,t.t6)("fastaPt",(async()=>{await f(await m(d.fastaPt),"seq")})),(0,t.t6)("fastaUn",(async()=>{await f(await m(d.fastaUn),"seq")})),(0,t.t6)("separatorDna",(async()=>{await f(await m(d.separatorDna),"seq")})),(0,t.t6)("separatorDna",(async()=>{await f(await m(d.separatorRna),"seq")})),(0,t.t6)("separatorPt",(async()=>{await f(await m(d.separatorPt),"seq")})),(0,t.t6)("separatorUn",(async()=>{await f(await m(d.separatorUn),"seq")})),(0,t.t6)("helm",(async()=>{await f(await m(d.helm),"seq")})),(0,t.t6)("ptFasta2",(async()=>{const n=await Se.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),r=e.DataFrame.fromCsv("seq\nAR"),i=r.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=c.Hi.FASTA,i.setTag(c.gp.alphabet,c.YI.PT),l.G.forColumn(i);const s=await f(r,"seq");(0,t.E3)(fe(s.get(0)),fe(n))}))}));var ge=n(7456);(0,t.L1)("toAtomicLevel-ui",(()=>{let n,r,i,s;(0,t.gM)((async()=>{s=await(0,de.j)(),n=await(0,S.pj)(),r=await(0,N.ub)(),await n.loadMonomerLibForTests(),i=n.getMonomerLib()})),(0,t.Pl)((async()=>{await(0,N.Eu)(r),await n.loadMonomerLib(!0)}));const o={fasta:{src:{seq:"MDYKETLLMPK",units:c.Hi.FASTA},tgt:{atomCount:94,bondCount:95}},"fasta-with-gap":{src:{seq:"MD-YKETLLMPK",units:c.Hi.FASTA},tgt:{atomCount:94,bondCount:95}},helm:{src:{seq:"PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2}$$$$",units:c.Hi.HELM},tgt:{atomCount:68,bondCount:68}},"helm-with-gap":{src:{seq:"PEPTIDE1{meI.hHis.*.Aca.N.T.dK.Thr_PO3H2}$$$$",units:c.Hi.HELM},tgt:{atomCount:68,bondCount:68}}},l=async t=>{const n=t.src.seq,r=e.DataFrame.fromColumns([e.Column.fromList(e.COLUMN_TYPE.STRING,"seq",[n])]);return await a.data.detectSemanticTypes(r),r.getCol("seq")};for(const[e,n]of Object.entries(o))(0,t.t6)(`${e}-linear`,(async()=>{const e=await l(n);await u(e,!1,n.tgt)}));for(const[e,n]of Object.entries(o))(0,t.t6)(`${e}-nonlinear`,(async()=>{const e=await l(n);await u(e,!0,n.tgt)}));async function u(n,r,o){const a=await(0,ge.V)(n.dataFrame,n,r,!1,i,s);(0,t.E3)(a.molCol.semType,e.SEMTYPE.MOLECULE);const c=a.molCol.get(0),l=s.get_mol(c);(0,t.E3)(null!=l,!0,"No molecule generated");try{const e=l.get_num_atoms(),n=l.get_num_bonds();(0,t.E3)(e,o.atomCount),(0,t.E3)(n,o.bondCount)}finally{l.delete()}}}));var ye=n(6863);async function be(t){const n=e.DataFrame.fromCsv(t),r=n.col("seq"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});return i&&(r.semType=i),await a.data.detectSemanticTypes(n),l.G.forColumn(r)}function we(e,n,r,i){const s=r(e,n);(0,t.E3)(Number(s.toFixed(3)),Number(i.toFixed(3)))}(0,t.L1)("Distance",(async()=>{const n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],r={F:0,W:1,R:2,Y:3},i="FWRWY",s="FWRWW",o="FWY",a="FWRWY",c="FWY",l="FWRRRRY";(0,t.t6)("protein-distance-function",(async()=>{const e=(await be("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.E3)(e,ye.Z.LEVENSHTEIN)})),(0,t.t6)("DNA-distance-function",(async()=>{const e=(await be("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,ye.Z.LEVENSHTEIN)})),(0,t.t6)("MSA-distance-function",(async()=>{const e=(await be("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,ye.Z.HAMMING)})),(0,t.t6)("levenstein-sub",(async()=>{const e=ye.V[ye.Z.LEVENSHTEIN]();we(i,s,e,.2)})),(0,t.t6)("levenstein-del",(async()=>{const e=ye.V[ye.Z.LEVENSHTEIN]();we(o,a,e,.4)})),(0,t.t6)("hamming",(async()=>{const e=ye.V[ye.Z.HAMMING]();we(o,a,e,.6)})),(0,t.t6)("needleman-blosum62",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});we(i,s,e,-6)})),(0,t.t6)("needleman-blosum62-del",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});we(o,a,e,-3.667)})),(0,t.t6)("needleman-custom-sub",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});we(i,s,e,.2)})),(0,t.t6)("needleman-custom-del",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});we(o,a,e,.667)})),(0,t.t6)("needleman-custom-zero-extend",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:0});we(c,l,e,.333)})),(0,t.t6)("needleman-custom-half-extend",(async()=>{const e=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:2,gapExtend:1});we(c,l,e,1.667)})),(0,t.t6)("needleman-custom-same-extend",(async()=>{const t=ye.V[ye.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?we(Array(1e3).fill(c).join(""),Array(1e3).fill(l).join(""),t,1.333):we(c,l,t,1.333)}),{benchmark:!0})}));var ve=n(684);async function Ae(e,n,r,i,s,o,c,l){await a.data.detectSemanticTypes(e);const u=await(0,p.activityCliffs)(e,e.getCol(r),e.getCol(i),s,n,c,l,{[`${ve.vb}`]:!0});(0,t.E3)(null!=u,!0);const d=Array.from(u.root.children).find((e=>{const t=e.className.split(" ");return["ui-btn","ui-btn-ok"].every((e=>t.includes(e)))}));(0,t.E3)(d.innerText.toLowerCase(),`${o} cliffs`)}var Ce=n(2780),Ee=n(9039);async function Te(n,r,i){const s=n.getCol(i),o=await a.functions.call("Bio:detectMacromolecule",{col:s});o&&(s.semType=o);const c=e.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!c)throw new Error("Preprocessing function not found");const l=await(0,p.sequenceSpaceTopMenu)(n,n.col(i),r,ye.Z.LEVENSHTEIN,!0,c,{[ve.vb]:!0});(0,t.E3)(null!=l,!0)}(0,t.L1)("activityCliffs",(async()=>{let n,r,i;const s=e.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],o=e.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,t.gM)((async()=>{n=await(0,Q.b2)(),r=await(0,S.pj)(),i=await(0,N.ub)(),await r.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("activityCliffsOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv",tgt:{cliffCount:53}}:{fileName:"tests/100_3_clustests.csv",tgt:{cliffCount:3}},n=await M(t.fileName);a.shell.addTableView(n),await Ae(n,Ee.c.UMAP,"sequence","Activity",90,t.tgt.cliffCount,ye.Z.LEVENSHTEIN,s)}),{benchmark:!0}),(0,t.t6)("activityCliffsWithEmptyRows",(async()=>{const e=await M("tests/100_3_clustests_empty_vals.csv");a.shell.addTableView(e),await Ae(e,Ee.c.UMAP,"sequence","Activity",90,3,ye.Z.LEVENSHTEIN,s)})),(0,t.t6)("Helm",(async()=>{const e=await Se.files.readCsv("samples/HELM_50.csv");a.shell.addTableView(e),await Ae(e,Ee.c.UMAP,"HELM","Activity",65,20,Ce.aT.Tanimoto,o)}))})),(0,t.L1)("sequenceSpace",(async()=>{let n,r,i,s;(0,t.t6)("sequenceSpaceOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv"}:{fileName:"tests/100_3_clustests.csv"};n=await M(t.fileName),r=a.shell.addTableView(n),await Te(n,Ee.c.UMAP,"sequence")}),{benchmark:!0}),(0,t.t6)("sequenceSpaceWithEmptyRows",(async()=>{i=await M("tests/100_3_clustests_empty_vals.csv"),s=a.shell.addTableView(i),await Te(i,Ee.c.UMAP,"sequence")}))})),(0,t.L1)("Scoring",(()=>{const n="sequence",r="expected_similarity",i="expected_identity",s=e.DataFrame.fromCsv(`${n},${r},${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`),o=s.getCol(n);o.meta.units=c.Hi.HELM,o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let l,u;(0,t.gM)((async()=>{l=await(0,p.getMonomerLibHelper)(),u=await(0,N.ub)(),await l.loadMonomerLibForTests()})),(0,t.Pl)((async()=>{await(0,N.Eu)(u),await l.loadMonomerLib(!0)})),(0,t.t6)("Identity",(async()=>{const e=await(0,p.sequenceIdentityScoring)(s,o,a);for(let n=0;n<e.length;n++){const r=e.get(n),o=s.get(i,n);(0,t.Wj)(r,o,.01,`Wrong identity score for sequence at position ${n}`)}})),(0,t.t6)("Identity-shortReference",(async()=>{const e=await(0,p.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva}$$$$");(0,t.E3)(E().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Identity-longReference",(async()=>{const e=await(0,p.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC.I.Tyr_26diMe.P.Asu.meC}$$$$");(0,t.E3)(E().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Similarity",(async()=>{const e=await(0,p.sequenceSimilarityScoring)(s,o,a);for(let n=0;n<e.length;n++){const i=e.get(n),o=s.get(r,n);(0,t.Wj)(i,o,.01,`Wrong similarity score for sequence at position ${n}`)}}))}));const Se=new e.Package;async function _e(n,r,i,s){const o=await(0,t.N$)({category:n,test:r,testContext:i,stressTest:s});return e.DataFrame.fromObjects(o)}async function xe(){await(0,t.Xb)(Se,Se.getModule("package-test.js"))}})(),bio_test=r})();
8
8
  //# sourceMappingURL=package-test.js.map