(function(W,X,Y,Z,T,$,G,M,A,I,K,U,aa,N,ba,H,y,R,S,O,Q,ca,V,da,ea,fa,ga,P,ha,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,j,p){G("JS");A(["JU.BS","$.V3"],"JS.VTemp",null,function(){var b=K(function(){this.bsTemp=this.vNorm4=this.vNorm3=this.vNorm2=this.vTemp2=this.vTemp1=this.vB=this.vA=this.vTemp=null;I(this,arguments)},JS,"VTemp",null);O(b,function(){this.vTemp=new JU.V3;this.vA=new JU.V3;this.vB=new JU.V3;this.vTemp1=new JU.V3;this.vTemp2=new JU.V3;this.vNorm2=new JU.V3;
this.vNorm3=new JU.V3;this.vNorm4=new JU.V3;this.bsTemp=new JU.BS})});G("J.api");V(J.api,"SmilesMatcherInterface");G("JS");A(["J.api.SmilesMatcherInterface"],"JS.SmilesMatcher","JU.AU $.BS $.PT JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesGenerator $.SmilesParser $.SmilesSearch JU.BSUtil $.Elements $.Logger".split(" "),function(){var b=K(function(){this.okMF=!0;I(this,arguments)},JS,"SmilesMatcher",null,J.api.SmilesMatcherInterface);p(b,"getLastException",function(){return!0==this.okMF?
JS.InvalidSmilesException.getLastError():"MF_FAILED"});p(b,"getMolecularFormula",function(a,c,h){this.clearExceptions();a=JS.SmilesParser.newSearch("/nostereo/"+a,c,!0);a.createTopoMap(null);a.nodes=a.target.nodes;return a.getMolecularFormula(!c,null,h)},"~S,~B,~B");j(b,"clearExceptions",function(){JS.InvalidSmilesException.clear()});p(b,"getSmiles",function(a,c,h,e,d){this.clearExceptions();return(new JS.SmilesGenerator).getSmiles(this,a,c,h,e,d)},"~A,~N,JU.BS,~S,~N");p(b,"areEqual",function(a,c){this.clearExceptions();
var h=0<=a.indexOf("*");if(!h&&a.equals(c))return 1;h=this.matchPriv(a,null,0,null,null,!1,(h?2:1)|8,2,JS.SmilesParser.newSearch(c,!1,!0));return null==h?-1:h.length},"~S,~S");j(b,"areEqualTest",function(a,c){c.set();var h=this.matchPriv(a,null,0,null,null,!1,9,2,c);return null!=h&&1==h.length},"~S,JS.SmilesSearch");p(b,"find",function(a,c,h){this.clearExceptions();c=JS.SmilesParser.cleanPattern(c);a=JS.SmilesParser.cleanPattern(a);c=JS.SmilesParser.newSearch(c,!1,!0);a=this.matchPriv(a,null,0,null,
null,!1,h,3,c);for(h=a.length;0<=--h;)for(var e=a[h],d=e.length;0<=--d;)e[d]=c.target.nodes[e[d]].mapIndex;return a},"~S,~S,~N");p(b,"getAtoms",function(a){this.clearExceptions();a=JS.SmilesParser.cleanPattern(a);a=JS.SmilesParser.newSearch(a,!1,!0);a.createTopoMap(new JU.BS);return a.target.nodes},"~S");p(b,"getRelationship",function(a,c){if(null==a||null==c||0==a.length||0==c.length)return"";var h=this.getMolecularFormula(a,!1,!1),e=this.getMolecularFormula(c,!1,!1);if(!h.equals(e))return"none";
var d,h=JU.PT.countChar(JU.PT.rep(a,"@@","@"),"@"),e=JU.PT.countChar(JU.PT.rep(c,"@@","@"),"@");d=h==e&&0<this.areEqual(c,a);if(!d){d=a+c;if(0<=d.indexOf("/")||0<=d.indexOf("\\")||0<=d.indexOf("@")){if(h==e&&(0<h&&0>d.indexOf("@SP"))&&(d=0<this.areEqual("/invertstereo/"+c,a)))return"enantiomers";if(d=0<this.areEqual("/nostereo/"+c,a))return h==e?"diastereomers":"ambiguous stereochemistry!"}return"constitutional isomers"}return"identical"},"~S,~S");p(b,"reverseChirality",function(a){a=JU.PT.rep(a,
"@@","!@");a=JU.PT.rep(a,"@","@@");return a=JU.PT.rep(a,"!@@","@")},"~S");p(b,"getSubstructureSet",function(a,c,h,e,d){var f=M(c,"JS.SmilesSearch")?null:c;return this.matchPriv(a,f,h,e,null,!0,d|JS.SmilesParser.getFlags(a.toString()),1,null==f?c:null)},"~O,~O,~N,JU.BS,~N");p(b,"getMMFF94AtomTypes",function(a,c,h,e,d,f){this.clearExceptions();var g=new JS.SmilesParser(!0,!0),l=null,l=g.parse("");l.exitFirstMatch=!1;l.target.setAtoms(c,Math.abs(h),e);l.flags=770;l.getRingData(f,!0,!0);l.asVector=!1;
l.subSearches=Array(1);l.getSelections();c=new JU.BS;for(e=0;e<a.length;e++)if(null==a[e]||0==a[e].length||a[e].startsWith("#"))d.addLast(null);else if(l.clear(),l.subSearches[0]=g.getSubsearch(l,JS.SmilesParser.cleanPattern(a[e]),770),f=JU.BSUtil.copy(l.search()),d.addLast(f),c.or(f),c.cardinality()==h)break},"~A,~A,~N,JU.BS,JU.Lst,~A");p(b,"getSubstructureSetArray",function(a,c,h,e,d,f){return this.matchPriv(a,c,h,e,d,!0,f,2,null)},"~S,~A,~N,JU.BS,JU.BS,~N");j(b,"getAtropisomerKeys",function(a,
c,h,e,d,f){return this.matchPriv(a,c,h,e,d,!1,f,4,null)},"~S,~A,~N,JU.BS,JU.BS,~N");p(b,"polyhedronToSmiles",function(a,c,h,e,d,f){for(var g=Array(h),l=0;l<h;l++){g[l]=new JS.SmilesAtom;var b=null==e?null:e[l];M(b,"JU.Node")?(g[l].elementNumber=b.getElementNumber(),g[l].bioAtomName=b.getAtomName(),g[l].atomNumber=b.getAtomNumber(),g[l].setT(b)):(g[l].elementNumber=M(b,"JU.Point3fi")?b.sD:-2,null!=b&&g[l].setT(b));g[l].index=l}b=0;for(l=c.length;0<=--l;)for(var m=c[l],q=m.length,n,j,r=q;0<=--r;)if(!((n=
m[r])>=h||(j=m[(r+1)%q])>=h)&&null==g[n].getBondTo(g[j]))(new JS.SmilesBond(g[n],g[j],1,!1)).index=b++;for(l=0;l<h;l++)if(q=g[l].bondCount,0==q||q!=g[l].bonds.length)g[l].bonds=JU.AU.arrayCopyObject(g[l].bonds,q);c=null;c=new JS.SmilesGenerator;null!=e&&(c.polySmilesCenter=a);this.clearExceptions();c=c.getSmiles(this,g,h,JU.BSUtil.newBitSet2(0,h),null,d|4144);65536==(d&65536)&&(c=(0==(d&131072)?"":"//* "+a+" *//\t")+"["+JU.Elements.elementSymbolFromNumber(a.getElementNumber())+"@PH"+h+(null==f?"":
"/"+f+"/")+"]."+c);return c},"JU.Node,~A,~N,~A,~N,~S");p(b,"getCorrelationMaps",function(a,c,h,e,d){return this.matchPriv(a,c,h,e,null,!0,d,3,null)},"~S,~A,~N,JU.BS,~N");j(b,"matchPriv",function(a,c,h,e,d,f,g,l,b){this.clearExceptions();try{var m=M(a,"JS.SmilesSearch");m&&(g|=2);var q=m?a:JS.SmilesParser.newSearch(null==a?null:a.toString(),2==(g&2),!1);null!=b&&b.setFlags(b.flags|JS.SmilesParser.getFlags(a.toString()));return this.matchPattern(q,c,h,e,d,f,g,l,b)}catch(j){if(H(j,Exception))throw JU.Logger.debugging&&
j.printStackTrace(),null==JS.InvalidSmilesException.getLastError()&&this.clearExceptions(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw j;}},"~O,~A,~N,JU.BS,JU.BS,~B,~N,~N,JS.SmilesSearch");j(b,"matchPattern",function(a,c,h,e,d,f,g,l,b){var m=2==(g&2);this.okMF=!0;if(null!=b)if(b.targetSet)a.setTarget(b);else if(a.haveSmilesTarget=!0,d=new JU.BS,b.createTopoMap(d),c=b.target.nodes,h=b.target.nodes.length,m){var q=b.elementCounts,j=a.elementCounts,t=a.elementNumberMax;
if(t<=b.elementNumberMax)for(b=1;b<=t;b++){if(q[b]<j[b]){this.okMF=!1;break}}else this.okMF=!1}else if(q=a.getMFArray(!0,null,!1),j=b.getMFArray(!0,null,!1),t=b.elementNumberMax,t==a.elementNumberMax)for(b=2;b<=t;b++){if(q[b]!=j[b]){this.okMF=!1;break}}else this.okMF=!1;if(this.okMF&&(!m&&!a.patternAromatic&&(null==d&&(d=new JU.BS),a.normalizeAromaticity(d),a.isNormalized=!0),a.targetSet||a.target.setAtoms(c,h,e),a.targetSet||0!=h&&(null==e||!e.isEmpty())))c=a.targetSet||!M(c[0],"JS.SmilesAtom"),
a.getSelections(),f||(a.target.bsAromatic=d),a.target.hasRingData(g)||a.setRingData(null,null,c||f||a.patternAromatic),a.exitFirstMatch=8==(g&8),a.mapUnique=128==(g&128);switch(l){case 1:return a.asVector=!1,this.okMF?a.search():new JU.BS;case 2:if(!this.okMF)return[];a.asVector=!0;a=a.search();return a.toArray(Array(a.size()));case 4:if(!this.okMF)return"";a.exitFirstMatch=!0;a.setAtropicity=!0;a.search();return a.atropKeys;case 3:if(!this.okMF)return y(0,0,0);a.getMaps=!0;a.setFlags(g|a.flags);
a=a.search();return a.toArray(JU.AU.newInt2(a.size()));case 5:if(!this.okMF)return Boolean.FALSE;a.retBoolean=!0;a.setFlags(g|a.flags);return a.search()}return null},"JS.SmilesSearch,~A,~N,JU.BS,JU.BS,~B,~N,~N,JS.SmilesSearch");p(b,"cleanSmiles",function(a){return JS.SmilesParser.cleanPattern(a)},"~S");p(b,"getMapForJME",function(a,c,h){try{var e=JS.SmilesMatcher.jmeToMolecule(a),d=JU.BSUtil.newBitSet2(0,e.ac),f=this.getSmiles(e.patternAtoms,e.ac,d,null,34),g=this.getCorrelationMaps(f,e.patternAtoms,
e.ac,d,42),b=this.getCorrelationMaps(f,c,h.cardinality(),h,42);return P(-1,[g[0],b[0]])}catch(k){if(H(k,Exception))k.printStackTrace();else throw k;}return null},"~S,~A,JU.BS");b.jmeToMolecule=j(b,"jmeToMolecule",function(a){var c=new JS.SmilesSearch;a=JU.PT.getTokens(a);for(var h=JU.PT.parseInt(a[0]),e=JU.PT.parseInt(a[1]),d=2,f=0;f<h;f++,d+=3){var g=a[d],b=c.addAtom(),k=g.indexOf("+"),m=0;if(0<=k)m=k==g.length-1?1:JU.PT.parseInt(g.substring(k+1));else if(0<=(k=g.indexOf("-")))m=JU.PT.parseInt(g.substring(k));
b.setCharge(m);b.setSymbol(0>k?g:g.substring(0,k))}for(f=0;f<e;f++){g=JU.PT.parseInt(a[d++])-1;b=JU.PT.parseInt(a[d++])-1;h=JU.PT.parseInt(a[d++]);g=c.patternAtoms[g];b=c.patternAtoms[b];k=1;switch(h){case 2:k=2;break;case 3:k=3}(new JS.SmilesBond(g,b,k,!1)).index=f}c.isSmarts=!0;c.set();return c},"~S");p(b,"getSmilesFromJME",function(a){try{var c=JS.SmilesMatcher.jmeToMolecule(a),h=JU.BSUtil.newBitSet2(0,c.ac);return this.getSmiles(c.patternAtoms,c.ac,h,null,1)}catch(e){if(H(e,Exception))return null;
throw e;}},"~S");p(b,"compileSmartsPattern",function(a){a=JS.SmilesParser.cleanPattern(a);return JS.SmilesParser.newSearch(a,!0,!1)},"~S");p(b,"compileSearchTarget",function(a,c,h){var e=new JS.SmilesSearch;e.target.setAtoms(a,c,h);e.targetSet=!0;return e},"~A,~N,JU.BS");p(b,"hasStructure",function(a,c,h){var e=y(c.length,0);1!=(h&1)&&(h|=2);this.clearExceptions();a=JS.SmilesParser.cleanPattern(a);try{for(var d=JS.SmilesParser.newSearch(a,!0,!1),f=0;f<c.length;f++){var g=JS.SmilesParser.cleanPattern(c[f]),
b=JS.SmilesParser.newSearch(g,!1,!0);b.setFlags(b.flags|JS.SmilesParser.getFlags(a));try{this.clearExceptions(),e[f]=this.matchPattern(d,null,0,null,null,!1,h|8,5,b)===Boolean.TRUE?1:0}catch(k){if(H(k,Exception))e[f]=-1,k.printStackTrace();else throw k;}}}catch(m){if(H(m,Exception))throw JU.Logger.debugging&&m.printStackTrace(),null==JS.InvalidSmilesException.getLastError()&&this.clearExceptions(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw m;}return e},"~S,~A,~N")});
G("JS");A(["java.lang.Exception"],"JS.InvalidSmilesException",null,function(){var b=S(JS,"InvalidSmilesException",Exception);N(b,function(a){Q(this,JS.InvalidSmilesException,[a]);JS.InvalidSmilesException.lastError=a.startsWith("Jmol SMILES")?a:"Jmol SMILES Exception: "+a},"~S");b.getLastError=j(b,"getLastError",function(){return JS.InvalidSmilesException.lastError});b.clear=j(b,"clear",function(){JS.InvalidSmilesException.lastError=null});p(b,"getMessage",function(){return JS.InvalidSmilesException.lastError});
b.lastError=null});G("JS");A(["JU.JmolMolecule","JU.BS","$.Lst"],"JS.SmilesSearch","java.util.Hashtable JU.AU $.SB JS.InvalidSmilesException $.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesParser $.SmilesStereo $.VTemp JU.BSUtil $.Logger".split(" "),function(){var b=K(function(){this.isSmarts=!1;this.v=this.patternAtoms=this.pattern=this.target=this.top=null;this.patternBioSequence=this.isTopology=this.haveSmilesTarget=this.patternAromatic=this.setAtropicity=this.groupByModel=this.exitFirstMatch=
this.invertStereochemistry=this.ignoreStereochemistry=this.ignoreElement=this.ignoreAtomClass=this.noAromatic=this.aromaticUnknown=this.aromaticDefined=this.aromaticMMFF94=this.aromaticDouble=this.aromaticPlanar=this.aromaticStrict=this.aromaticOpen=this.targetSet=!1;this.subSearches=null;this.haveBondStereochemistry=this.haveSelected=!1;this.stereo=null;this.needRingData=!1;this.needAromatic=!0;this.needRingMemberships=!1;this.nDouble=0;this.ringDataMax=-2147483648;this.measures=null;this.flags=
0;this.lastChainAtom=this.atropKeys=null;this.isRingCheck=this.isSilent=this.haveComponents=this.isNormalized=this.retBoolean=this.getMaps=this.asVector=!1;this.htNested=this.bsFound=null;this.nNested=0;this.bsCheck=this.bsReturn=this.uniqueList=this.vReturn=this.nestedBond=null;this.mapUnique=!1;this.polyAtom=this.polyhedronStereo=null;this.autoAddImplicitH=!0;this.pattern0=null;I(this,arguments)},JS,"SmilesSearch",JU.JmolMolecule);O(b,function(){this.patternAtoms=Array(16);this.measures=new JU.Lst;
this.bsFound=new JU.BS;this.bsReturn=new JU.BS});N(b,function(){Q(this,JS.SmilesSearch,[]);this.top=this;this.target=new JS.SmilesSearch.SmilesTarget;this.v=new JS.VTemp});b.isRingBond=j(b,"isRingBond",function(a,c,h,e){if(null!=a)for(var d=a.size();0<=--d;){var f=a.get(d);if(f.get(h)&&f.get(e)&&(null==c||c.get(d)))return!0}return!1},"JU.Lst,JU.BS,~N,~N");j(b,"setTarget",function(a){this.target=a.target;this.targetSet=!0},"JS.SmilesSearch");j(b,"setTop",function(a){for(;a.top!==a;)a=a.top;this.top=
a},"JS.SmilesSearch");b.addFlags=j(b,"addFlags",function(a,c){0<=c.indexOf("OPEN")&&(a|=5);0<=c.indexOf("BIO")&&(a|=1048576);0<=c.indexOf("HYDROGEN2")?a|=8192:0<=c.indexOf("HYDROGEN")&&(a|=4096);0<=c.indexOf("FIRSTMATCHONLY")&&(a|=8);0<=c.indexOf("STRICT")&&(a|=256);0<=c.indexOf("PLANAR")&&(a|=1024);if(0<=c.indexOf("NOAROMATIC")||0<=c.indexOf("NONAROMATIC"))a|=16;0<=c.indexOf("AROMATICDOUBLE")&&(a|=512);0<=c.indexOf("AROMATICDEFINED")&&(a|=128);0<=c.indexOf("MMFF94")&&(a|=768);0<=c.indexOf("ALLCOMPONENTS")&&
(a|=32768);0<=c.indexOf("TOPOLOGY")&&(a|=16384);0<=c.indexOf("NOATOMCLASS")&&(a|=2048);0<=c.indexOf("NOSTEREO")?a|=32:0<=c.indexOf("INVERTSTEREO")&&(a=0!=(a&64)?a&-65:a|64);0<=c.indexOf("ATOMCOMMENT")&&(a|=131072);0<=c.indexOf("GROUPBYMODEL")&&(a|=67108864);1048576==(a&1048576)&&(0<=c.indexOf("NOCOMMENT")&&(a|=34603008),0<=c.indexOf("UNMATCHED")&&(a|=3145728),0<=c.indexOf("COVALENT")&&(a|=5242880),0<=c.indexOf("HBOND")&&(a|=9437184));return a},"~N,~S");j(b,"setFlags",function(a){this.flags=a;this.exitFirstMatch=
(new Boolean(this.exitFirstMatch|8==(a&8))).valueOf();this.aromaticOpen=5==(a&5);this.aromaticStrict=256==(a&256);this.aromaticPlanar=1024==(a&1024);this.aromaticMMFF94=768==(a&768);this.aromaticDouble=512==(a&512);this.aromaticDefined=128==(a&128);this.noAromatic=(new Boolean(this.noAromatic|16==(a&16))).valueOf();this.aromaticUnknown=!this.noAromatic&&!this.aromaticOpen&&!this.aromaticDouble&&!this.aromaticStrict&&!this.aromaticPlanar&&!this.aromaticMMFF94&&!this.aromaticDefined;this.groupByModel=
67108864==(a&67108864);this.ignoreAtomClass=2048==(a&2048);this.ignoreStereochemistry=32==(a&32);this.invertStereochemistry=!this.ignoreStereochemistry&&64==(a&64);this.ignoreElement=16384==(a&16384)},"~N");j(b,"set",function(){this.patternAtoms.length>this.ac&&(this.patternAtoms=JU.AU.arrayCopyObject(this.patternAtoms,this.ac));this.nodes=this.patternAtoms;this.isTopology=!0;this.patternAromatic=!1;this.patternBioSequence=!0;for(var a=this.ac;0<=--a;){var c=this.patternAtoms[a];this.isTopology&&
c.isDefined()&&(this.isTopology=!1);c.isBioResidue||(this.patternBioSequence=!1);c.isAromatic&&(this.patternAromatic=!0);c.setBondArray();if(this.autoAddImplicitH&&!this.isSmarts&&"\x00"==c.bioType&&!c.setHydrogenCount())throw new JS.InvalidSmilesException("unbracketed atoms must be one of: B, C, N, O, P, S, F, Cl, Br, I, *,");}if(this.haveComponents)for(a=this.ac;0<=--a;)for(var c=this.patternAtoms[a],h=c.bonds,e=c.component,d=c.bondCount;0<=--d;){var f=h[d],g;if(f.isConnection&&f.atom2===c&&(g=
f.atom1.component)!=e)for(f=this.ac;0<=--f;)this.patternAtoms[f].component==e&&(this.patternAtoms[f].component=g)}});j(b,"addAtom",function(){return this.appendAtom(new JS.SmilesAtom)});j(b,"appendAtom",function(a){this.ac>=this.patternAtoms.length&&(this.patternAtoms=JU.AU.doubleLength(this.patternAtoms));return this.patternAtoms[this.ac]=a.setIndex(this.ac++)},"JS.SmilesAtom");j(b,"addNested",function(a){null==this.htNested&&(this.htNested=new java.util.Hashtable);this.setNested(++this.nNested,
a);return this.nNested},"~S");j(b,"clear",function(){this.bsReturn.clearAll();this.nNested=0;this.nestedBond=this.htNested=null;this.clearBsFound(-1)});j(b,"clearBsFound",function(a){0>a?null==this.bsCheck&&this.bsFound.clearAll():this.bsFound.clear(a)},"~N");j(b,"setNested",function(a,c){this.top.htNested.put("_"+a,c)},"~N,~O");j(b,"getNested",function(a){return this.top.htNested.get("_"+a)},"~N");j(b,"getMissingHydrogenCount",function(){for(var a=0,c,h=0;h<this.ac;h++)if(0<=(c=this.patternAtoms[h].explicitHydrogenCount))a+=
c;return a});j(b,"setRingData",function(a,c,h){if(this.isTopology||this.patternBioSequence)this.needAromatic=!1;if(this.needAromatic=(new Boolean(this.needAromatic&(new Boolean(null==a&!this.noAromatic)).valueOf())).valueOf())this.needRingData=!0;if(!this.needAromatic&&(this.target.bsAromatic.clearAll(),null!=a&&this.target.bsAromatic.or(a),!this.needRingMemberships&&!this.needRingData))return;this.getRingData(c,this.needRingData,h)},"JU.BS,~A,~B");j(b,"getRingData",function(a,c,h){var e=this.needAromatic&&
(this.aromaticStrict||!this.aromaticOpen&&!this.aromaticPlanar);e&&this.aromaticUnknown&&0<this.target.ac&&this.target.nodes[this.target.bsSelected.nextSetBit(0)].modelIsRawPDB()&&(e=!1);var d=this.needAromatic&&this.aromaticOpen&&!this.aromaticStrict,f=this.needAromatic&&!e,g=this.needAromatic&&h&&(e||d),b=this.needAromatic&&!this.aromaticDefined,k=null==a?new JU.Lst:a[3]=new JU.Lst,m=g?new JU.Lst:null,j=!e?0:this.aromaticMMFF94?2:1;this.needAromatic&&this.aromaticDefined&&(this.target.checkAromaticDefined(),
j=0);this.ringDataMax=this.target.setRingData(j,c,this.ringDataMax);if(!(3>this.target.selectedAtomCount)){for(var n="****",t=this.ringDataMax;n.length<t;)n+=n;for(var r=g&&b?y(this.target.ac,0):null,u=b&&M(this.target.nodes[0],"JS.SmilesAtom"),s=3;s<=t&&!(s>this.target.ac);s++){var p="*1"+n.substring(0,s-2)+"*1",p=JS.SmilesParser.newSearch(p,!0,!0),p=this.subsearch(p,2);if(null!=a&&5>=s){for(var x=new JU.Lst,v=p.size();0<=--v;)x.addLast(p.get(v));a[s-3]=x}if(0!=p.size()&&(b&&(4<=s&&7>=s)&&JS.SmilesAromatic.setAromatic(s,
this.target.nodes,this.target.bsSelected,p,this.target.bsAromatic,j,d,u,f,this.v,k,m,r,h),c)){this.target.ringData[s]=new JU.BS;for(x=p.size();0<=--x;){var F=p.get(x);this.target.ringData[s].or(F);for(v=F.nextSetBit(0);0<=v;v=F.nextSetBit(v+1))this.target.ringCounts[v]++}}}this.needAromatic&&(g&&JS.SmilesAromatic.finalizeAromatic(this.target.nodes,this.target.bsAromatic,k,m,r,d,e),this.target.finalizeAromatic(k));c&&this.target.finalizeRingData()}},"~A,~B,~B");j(b,"subsearch",function(a,c){a.mapUnique=
this.mapUnique;a.target=this.target;a.htNested=this.htNested;a.haveSmilesTarget=this.haveSmilesTarget;a.bsCheck=this.bsCheck;a.isSmarts=!0;switch(c){case 1:a.exitFirstMatch=!1;break;case 2:a.isRingCheck=!0;a.isSilent=!0;a.asVector=!0;break;case 3:a.ignoreAtomClass=this.ignoreAtomClass,a.aromaticDouble=this.aromaticDouble,a.haveSelected=this.haveSelected,a.exitFirstMatch=this.exitFirstMatch,a.getMaps=this.getMaps,a.retBoolean=this.retBoolean,a.asVector=this.asVector,a.vReturn=this.vReturn,a.bsReturn=
this.bsReturn,a.haveBondStereochemistry=this.haveBondStereochemistry}return a.search2(1==c)},"JS.SmilesSearch,~N");j(b,"search",function(){this.bsReturn.clearAll();return this.search2(!1)});j(b,"search2",function(a){this.setFlags(this.flags);!this.isRingCheck&&(JU.Logger.debuggingHigh&&!this.isSilent)&&JU.Logger.debug("SmilesSearch processing "+this.pattern);if(null==this.vReturn&&(this.asVector||this.getMaps))this.vReturn=new JU.Lst;if(null!=this.subSearches)for(a=0;a<this.subSearches.length&&!(null!=
this.subSearches[a]&&(this.subsearch(this.subSearches[a],3),this.exitFirstMatch&&(null==this.vReturn?0<=this.bsReturn.nextSetBit(0):0<this.vReturn.size())));a++);else 0<this.ac&&this.ac<=this.target.selectedAtomCount&&(null==this.nestedBond?this.clearBsFound(-1):this.bsReturn.clearAll(),this.nextPatternAtom(-1,-1,a,-1));return this.asVector||this.getMaps?this.vReturn:!this.retBoolean?this.bsReturn:Boolean.$valueOf(!this.bsReturn.isEmpty())},"~B");j(b,"nextPatternAtom",function(a,c,h,e){var d,f;if(++a<
this.ac){var g=this.patternAtoms[a],b=0<=c?g.getBondTo(null):0==a?this.nestedBond:null;if(null==b){c=JU.BSUtil.copy(this.bsFound);var k=JU.BSUtil.copy(this.bsFound);if(0<=g.notBondedIndex)if(d=this.patternAtoms[g.notBondedIndex],b=d.getMatchingAtom(),d.isBioAtom)d=b.getOffsetResidueAtom("\x00",1),0<=d&&c.set(d),d=b.getOffsetResidueAtom("\x00",-1),0<=d&&c.set(d);else if(d===this.polyAtom)c.set(d.getMatchingAtomIndex());else{f=b.getEdges();for(d=0;d<f.length;d++)c.set(f[d].getOtherNode(b).getIndex())}f=
g.isBioAtomWild;d=this.target.bsSelected.nextSetBit(0);d=f&&0<=d?this.target.nodes[d].getOffsetResidueAtom("\x00",d):d;for(var m,j=(0<a?this.patternAtoms[a-1]:g).component,n=g.component,t=this.haveComponents&&-2147483648!=n,b=d;0<=b;b=this.target.bsSelected.nextSetBit(b+1)){if(!c.get(b)&&!this.bsFound.get(b)){d=this.target.nodes[b];if(t&&!this.isRingCheck&&(e=this.groupByModel?d.getModelIndex():d.getMoleculeNumber(!1),m=0<a?this.patternAtoms[a-1].matchingComponent:e,j==n!=(m==e)))continue;if(!this.nextTargetAtom(g,
d,a,b,h,e))return!1}f&&(d=this.target.nodes[b].getOffsetResidueAtom(g.bioAtomName,1),0<=d&&(b=d-1))}this.bsFound=k;return!0}d=b.atom1.getMatchingAtom();switch(b.order){case 96:b=d.getOffsetResidueAtom(g.bioAtomName,1);if(0<=b){c=JU.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);if(this.doCheckAtom(b)&&!this.nextTargetAtom(g,this.target.nodes[b],a,b,h,e))return!1;this.bsFound=c}return!0;case 112:f=new JU.Lst;d.getCrossLinkVector(f,!0,!0);c=JU.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);
for(b=2;b<f.size();b+=3)if(k=f.get(b).intValue(),this.doCheckAtom(k)&&!this.nextTargetAtom(g,this.target.nodes[k],a,k,h,e))return!1;this.bsFound=c;return!0}f=d.getEdges();if(null!=f)for(b=0;b<f.length;b++)if(k=d.getBondedAtomIndex(b),this.doCheckAtom(k)&&!this.nextTargetAtom(g,this.target.nodes[k],a,k,h,e))return!1;this.clearBsFound(c);return!0}if(!this.ignoreStereochemistry&&!this.isRingCheck){if(JU.Logger.debuggingHigh){for(g=0;g<a;g++)JU.Logger.debug("pattern atoms "+this.patternAtoms[g]+" "+this.patternAtoms[g].matchingComponent);
JU.Logger.debug("--ss-- "+this.bsFound.cardinality())}if(!this.checkStereochemistry())return!0}c=new JU.BS;for(b=e=0;b<this.ac;b++)if(g=this.patternAtoms[b].getMatchingAtomIndex(),h||!this.top.haveSelected||this.patternAtoms[b].selected){e++;c.set(g);this.patternAtoms[b].isBioAtomWild&&this.target.nodes[g].getGroupBits(c);if(h)break;if(!this.isSmarts&&!this.setAtropicity&&0<this.patternAtoms[b].explicitHydrogenCount){g=this.target.nodes[g];d=0;for(f=g.getEdges().length;d<f;d++)k=g.getBondedAtomIndex(d),
1==this.target.nodes[k].getElementNumber()&&c.set(k)}}if(!this.isSmarts&&c.cardinality()!=this.target.selectedAtomCount)return!0;if(null!=this.bsCheck)if(h){this.bsCheck.clearAll();for(b=0;b<this.ac;b++)this.bsCheck.set(this.patternAtoms[b].getMatchingAtomIndex());if(this.bsCheck.cardinality()!=this.ac)return!0}else if(c.cardinality()!=this.ac)return!0;this.bsReturn.or(c);if(this.getMaps){if(this.mapUnique){null==this.uniqueList&&(this.uniqueList=new JU.Lst);for(b=this.uniqueList.size();0<=--b;)if(this.uniqueList.get(b).equals(c))return!0;
this.uniqueList.addLast(c)}a=y(e,0);for(c=b=0;b<this.ac;b++)if(h||!this.top.haveSelected||this.patternAtoms[b].selected)a[c++]=this.patternAtoms[b].getMatchingAtomIndex();this.vReturn.addLast(a);return!this.exitFirstMatch}if(this.asVector){h=!0;for(b=this.vReturn.size();0<=--b&&h;)h=!this.vReturn.get(b).equals(c);if(!h)return!0;this.vReturn.addLast(c)}if(this.isRingCheck){h=new JU.BS;for(d=3*a+2;--d>a;)h.set(this.patternAtoms[(d<=2*a?2*a-d+1:d-1)%a].getMatchingAtomIndex());this.target.ringSets.addLast(h);
return!0}return this.exitFirstMatch?!1:c.cardinality()!=this.target.selectedAtomCount},"~N,~N,~B,~N");j(b,"doCheckAtom",function(a){return this.target.bsSelected.get(a)&&!this.bsFound.get(a)},"~N");j(b,"nextTargetAtom",function(a,c,h,e,d,f){if(!this.isRingCheck&&!this.isTopology)if(null==a.subAtoms){if(!this.checkPrimitiveAtom(a,e))return!0}else if(a.isAND)for(var b=0;b<a.nSubAtoms;b++){if(!this.checkPrimitiveAtom(a.subAtoms[b],e))return!0}else{for(b=0;b<a.nSubAtoms;b++)if(!this.nextTargetAtom(a.subAtoms[b],
c,h,e,d,f))return!1;return!0}c=c.getEdges();for(b=a.getBondCount();0<=--b;){var l=a.getBond(b);if(l.getAtomIndex2()==a.index){var k=l.atom1,m=k.getMatchingAtomIndex();switch(l.order){case 96:case 112:if(!this.checkMatchBond(a,k,l,e,m,null))return!0;break;default:for(var j=0,n=null;j<c.length&&(!(n=c[j]).isCovalent()||!(n.getAtomIndex1()==m||n.getAtomIndex2()==m));j++);if(j==c.length||!this.checkMatchBond(a,k,l,e,m,n))return!0}}}a=this.patternAtoms[a.index];a.setMatchingAtom(this.target.nodes[e],e);
a.matchingComponent=f;this.bsFound.set(e);if(!this.nextPatternAtom(h,e,d,f))return!1;0<=e&&this.clearBsFound(e);return!0},"JS.SmilesAtom,JU.Node,~N,~N,~B,~N");j(b,"checkPrimitiveAtom",function(a,c){if(0<a.nSubAtoms){for(var h=0;h<a.nSubAtoms;h++)if(this.checkPrimitiveAtom(a.subAtoms[h],c))return!0;return!1}for(var e=this.target.nodes[c],h=a.not;;){if(0<a.iNested){h=this.getNested(a.iNested);M(h,"JS.SmilesSearch")&&(a.isBioAtom&&(h.nestedBond=a.getBondTo(null)),h=this.subsearch(h,1),null==h&&(h=new JU.BS),
a.isBioAtom||this.setNested(a.iNested,h));h=a.not!=h.get(c);break}var d=e.getElementNumber(),b=a.elementNumber;if(0<=d&&0<=b&&b!=d&&!this.ignoreElement)break;if(a.isBioResidue){if(null!=a.bioAtomName&&(a.isLeadAtom()?!e.isLeadAtom():!a.bioAtomName.equals(e.getAtomName().toUpperCase())))break;if(null!=a.residueName&&!a.residueName.equals(e.getGroup3(!1).toUpperCase()))break;if(-2147483648!=a.residueNumber&&a.residueNumber!=e.getResno())break;if("\x00"!=a.insCode&&a.insCode!=e.getInsertionCode())break;
if(null!=a.residueChar||-2==a.elementNumber){var d=e.getBioSmilesType(),g=a.getBioSmilesType(),l=!0,b=!1;switch(g.charCodeAt(0)){case 0:case 42:l=!0;break;case 110:l="r"==d||"c"==d;b=!0;break;case 114:case 99:b=!0;default:l=d==g}if(!l)break;l=e.getGroup1("\x00").toUpperCase();g=null==a.residueChar?"*":a.residueChar.charAt(0);l=g==l.charAt(0);switch(g.charCodeAt(0)){case 42:l=!0;break;case 78:l=b?"r"==d||"c"==d:l;break;case 82:l=b?e.isPurine():l;break;case 89:l=b?e.isPyrimidine():l}if(!l)break}if(a.isBioAtom&&
a.notCrossLinked&&e.getCrossLinkVector(null,!0,!0))break}else{if(-2147483648!=a.atomNumber&&a.atomNumber!=e.getAtomNumber())break;if(0<=a.jmolIndex&&e.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(e.getAtomType()))break;if(-2147483648!=(b=a.getAtomicMass())&&(0<=b&&b!=(d=e.getIsotopeNumber())||0>b&&0!=d&&-b!=d))break;if(!this.noAromatic&&!a.aromaticAmbiguous&&a.isAromatic!=this.target.bsAromatic.get(c))break;if(-2147483648!=(b=a.getCharge())&&b!=e.getFormalCharge())break;b=
a.getCovalentHydrogenCount()+a.explicitHydrogenCount;if(0<=b&&b!=e.getTotalHydrogenCount())break;if(-2147483648!=(b=a.implicitHydrogenCount))if(d=e.getImplicitHydrogenCount(),-1==b?0==d:b!=d)break;if(0<a.degree&&a.degree!=e.getCovalentBondCount())break;if(0<a.nonhydrogenDegree&&a.nonhydrogenDegree!=e.getCovalentBondCount()-e.getCovalentHydrogenCount())break;if(this.isSmarts&&0<a.valence&&a.valence!=e.getTotalValence())break;if(0<a.connectivity&&a.connectivity!=e.getCovalentBondCountPlusMissingH())break;
if(-2147483648!=a.atomNumber&&a.atomNumber!=e.getAtomNumber())break;if(0<=a.jmolIndex&&e.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(e.getAtomType()))break;if((!this.ignoreAtomClass||this.isSmarts)&&!Float.isNaN(a.atomClass)&&a.atomClass!=e.getFloatProperty("property_atomclass"))break;if(null!=this.target.ringData){if(-1<=a.ringSize)if(0>=a.ringSize){if(0==this.target.ringCounts[c]!=(0==a.ringSize))break}else{e=this.target.ringData[500==a.ringSize?5:600==a.ringSize?6:a.ringSize];
if(null==e||!e.get(c))break;if(!this.noAromatic)if(500==a.ringSize){if(!this.target.bsAromatic5.get(c))break}else if(600==a.ringSize&&!this.target.bsAromatic6.get(c))break}if(-1<=a.ringMembership&&(-1==a.ringMembership?0==this.target.ringCounts[c]:this.target.ringCounts[c]!=a.ringMembership))break;if(0<=a.ringConnectivity&&(b=this.target.ringConnections[c],-1==a.ringConnectivity&&0==b||-1!=a.ringConnectivity&&b!=a.ringConnectivity))break}}h=!h;break}return h},"JS.SmilesAtom,~N");j(b,"checkMatchBond",
function(a,c,h,e,d,b){if(null!=h.bondsOr){for(var g=0;g<h.nBondsOr;g++)if(this.checkMatchBond(a,c,h.bondsOr[g],e,d,b))return!0;return!1}if(!this.isRingCheck&&!this.isTopology)if(0==h.nPrimitives){if(!this.checkPrimitiveBond(h,e,d,b))return!1}else for(a=0;a<h.nPrimitives;a++)if(c=h.setPrimitive(a),!this.checkPrimitiveBond(c,e,d,b))return!1;h.matchingBond=b;return!0},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesBond,~N,~N,JU.Edge");j(b,"checkPrimitiveBond",function(a,c,h,e){var d=!1;switch(a.order){case 96:return a.isNot!=
(this.target.nodes[h].getOffsetResidueAtom("\x00",1)==this.target.nodes[c].getOffsetResidueAtom("\x00",0));case 112:return a.isNot!=this.target.nodes[c].isCrossLinked(this.target.nodes[h])}var b=!this.noAromatic&&this.target.bsAromatic.get(c),g=!this.noAromatic&&this.target.bsAromatic.get(h);e=e.getCovalentOrder();var l=a.order;if(b&&g)switch(l){case 17:case 65:d=JS.SmilesSearch.isRingBond(this.target.ringSets,null,c,h);break;case 1:d=!this.isSmarts||!JS.SmilesSearch.isRingBond(this.target.ringSets,
this.target.getBSAromaticRings(),c,h);break;case 2:d=this.isNormalized||81==e||this.aromaticDouble&&(2==e||514==e);break;case 65537:case 65538:d=!a.isNot;break;case 81:case -1:d=!0}else switch(l){case 17:if(!this.noAromatic)break;case 81:case -1:d=!0;break;case 1:case 1025:case 1041:switch(e){case 1:case 1025:case 1041:d=!0}break;case 65537:case 65538:switch(e){case 1:case 65537:case 65538:d=!a.isNot}break;case 2:case 3:case 4:d=e==l;break;case 65:d=JS.SmilesSearch.isRingBond(this.target.ringSets,
null,c,h)}return d!=a.isNot},"JS.SmilesBond,~N,~N,JU.Edge");j(b,"checkStereochemistry",function(){for(var a=0;a<this.measures.size();a++)if(!this.measures.get(a).check())return!1;if(null!=this.stereo&&!this.stereo.checkStereoChemistry(this,this.v))return!1;if(!this.haveBondStereochemistry)return!0;for(var c=null,a=null,h=0;h<this.ac;h++){for(var e=this.patternAtoms[h],d=null,b=null,g=null,l=0,k=0,m=0,j=e.getBondCount(),n=!1,t=!0,r=0;r<j;r++){var a=e.getBond(r),u=a.atom2===e,t=a.atom1.index<a.atom2.index,
s=a.getBondType();switch(s){case 65537:case 65538:if(!t)continue;case 2:if(u)continue;d=a.atom2;m=s;(n=2!=s)&&(l=a.isNot?-1:1);break;case 1025:case 1041:b=u?a.atom1:a.atom2,l=u!=(1025==s)?1:-1}}if(n){if(this.setAtropicity){null==c&&(c=new JU.Lst);c.addLast(a);continue}g=e.getBond(a.atropType[0]);if(null==g)return!1;b=g.getOtherAtom(e);g=d.getBond(a.atropType[1]);if(null==g)return!1;g=g.getOtherAtom(d);JU.Logger.debugging&&JU.Logger.info("atropisomer check for atoms "+b+e+" "+d+g)}else{if(null==d||
0==l)continue;j=e;for(r=0;2==d.getBondCount()&&4==d.getValence();)r++,u=d.getEdges(),u=u[u[0].getOtherNode(d)===j?1:0],j=d,d=u.getOtherNode(d);if(1==r%2)continue;j=d.getBondCount();for(r=0;r<j&&0==k;r++)switch(a=d.getBond(r),s=a.getBondType(),s){case 1025:case 1041:g=(u=a.atom2===d)?a.atom1:a.atom2,k=u!=(1025==s)?1:-1}if(0==k)continue}j=e.getMatchingAtom();r=d.getMatchingAtom();b=b.getMatchingAtom();g=g.getMatchingAtom();if(null==b||null==g)return!1;this.haveSmilesTarget&&JS.SmilesSearch.setTopoCoordinates(j,
r,b,g,m);b=JS.SmilesMeasure.setTorsionData(b,j,r,g,this.v,n);if(n){if(b*=-1*l*(65537==m?1:-1)*(t?1:-1),JU.Logger.debugging&&JU.Logger.info("atrop dihedral "+b+" "+e+" "+d+" "+a),1>b)return!1}else if(0>this.v.vTemp1.dot(this.v.vTemp2)*l*k)return!1}if(this.setAtropicity){this.atropKeys="";for(a=0;a<c.size();a++)this.atropKeys+=","+this.getAtropIndex(c.get(a))}return!0});j(b,"getAtropIndex",function(a){var c=Array(4),h="";c[1]=a.atom1.getMatchingAtom();c[2]=a.atom2.getMatchingAtom();for(var e=a.atom1.bonds,
b,f=a.atom1.getBondCount();0<=--f;)if((b=e[f].getOtherNode(a.atom1))!==a.atom2){h+=f+1;c[0]=b.getMatchingAtom();break}e=a.atom2.bonds;for(f=0;f<=a.atom2.getBondCount();f++)if((b=e[f].getOtherNode(a.atom2))!==a.atom1){h+=f+1;c[3]=b.getMatchingAtom();break}h.equals("22")&&(h="");h=(1==JS.SmilesStereo.getAtropicStereoFlag(c)?"":"^")+h;return(h+"   ").substring(0,3)},"JS.SmilesBond");b.setTopoCoordinates=j(b,"setTopoCoordinates",function(a,c,h,e,b){a.set(-1,0,0);c.set(1,0,0);if(2!=b)b=a.getBondTo(c),
a=a.getBondedAtomIndex(b.atropType[0])==h.index,c=c.getBondedAtomIndex(b.atropType[1])==e.index,c=(65537==b.order?1:-1)*(a==c?1:-1),h.set(-1,1,0),e.set(1,1,-1*(c/2));else{e=h=0;for(var f=a.getEdges(),g=f.length;0<=--g;)if(b=f[g],2!=b.order){var l=b.getOtherNode(a);l.set(-1,0==h++?-1:1,0);l=b.getAtomIndex2()==a.getIndex()?h:-h;switch(b.order){case 1025:e=l;break;case 1041:e=-l}}var k=0;h=0;a=Array(2);f=c.getEdges();for(g=f.length;0<=--g;)if(b=f[g],2!=b.order)switch(l=b.getOtherNode(c),a[h]=l,l.set(1,
0==h++?1:-1,0),l=b.getAtomIndex2()==c.getIndex()?h:-h,b.order){case 1025:k=l;break;case 1041:k=-l}0<e*k==(Math.abs(e)%2==Math.abs(k)%2)&&(c=a[0].y,a[0].y=a[1].y,a[1].y=c)}},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,~N");j(b,"createTopoMap",function(a){var c=null==a,h=this.autoAddImplicitH?this.getMissingHydrogenCount():0,h=this.ac+h,b=Array(h);this.target.nodes=b;for(var d=0,f=0;d<this.ac;d++,f++){var g=this.patternAtoms[d],l=g.explicitHydrogenCount;if(0>l||!this.autoAddImplicitH)l=
0;var k=b[f]=(new JS.SmilesAtom).setTopoAtom(g.component,f,g.symbol,g.getCharge(),d);k.implicitHydrogenCount=l;if(!c){k.mapIndex=d;k.stereo=g.stereo;k.setAtomicMass(g.getAtomicMass());k.bioAtomName=g.bioAtomName;k.residueName=g.residueName;k.residueChar=g.residueChar;k.residueNumber=g.residueNumber;k.atomNumber=g.residueNumber;k.insCode=g.insCode;k.hasDoubleBond=g.hasDoubleBond;k.isAromatic=g.isAromatic;k.atomClass=g.atomClass;k.explicitHydrogenCount=0;k.isBioAtom=g.isBioAtom;k.bioType=g.bioType;
k.$isLeadAtom=g.$isLeadAtom;!c&&g.isAromatic&&a.set(f);g.setMatchingAtom(null,f);g=Array(g.getBondCount()+l);for(k.setBonds(g);0<=--l;){g=b[++f]=(new JS.SmilesAtom).setTopoAtom(k.component,f,"H",0,-1);g.mapIndex=-d-1;g.setBonds(Array(1));var m=new JS.SmilesBond(k,g,1,!1);JU.Logger.debugging&&JU.Logger.info(""+m)}}}if(!c){for(d=0;d<this.ac;d++){g=this.patternAtoms[d];l=g.getMatchingAtomIndex();a=b[l];l=g.getBondCount();for(c=0;c<l;c++)if(f=g.getBond(c),f.atom1===g){m=1;switch(f.order){case 1:case 2:case 3:case 4:case 1025:case 1041:case 65537:case 65538:case 112:case 96:m=
f.order;break;case 17:m=514}k=b[f.atom2.getMatchingAtomIndex()];m=new JS.SmilesBond(a,k,m,!1);m.isConnection=f.isConnection;m.atropType=f.atropType;m.isNot=f.isNot;k.bondCount--;JU.Logger.debugging&&JU.Logger.info(""+m)}else k=b[f.atom1.getMatchingAtomIndex()],m=k.getBondTo(a),a.addBond(m)}for(d=0;d<h;d++)if(m=b[d],g=m.bonds,!(2>g.length||g[0].isFromPreviousTo(m)))for(l=g.length;1<=--l;)if(g[l].isFromPreviousTo(m)){m=g[l];g[l]=g[0];g[0]=m;break}if(!this.ignoreStereochemistry)for(d=this.ac;0<=--d;)g=
this.patternAtoms[d],null!=g.stereo&&g.stereo.fixStereo(g)}},"JU.BS");j(b,"normalizeAromaticity",function(a){var c=this.patternAtoms,h=new JS.SmilesSearch;h.noAromatic=this.noAromatic;h.setFlags(this.flags);h.target.nodes=c;h.target.ac=c.length;h.target.bsSelected=JU.BSUtil.newBitSet2(0,c.length);var b=JU.AU.createArrayOfArrayList(4);h.setRingData(null,b,!0);a.or(h.target.bsAromatic);if(!a.isEmpty()&&(a=b[3],null!=a))for(h=a.size();0<=--h;)for(var b=a.get(h),d=b.nextSetBit(0);0<=d;d=b.nextSetBit(d+
1)){var f=c[d];!f.isAromatic&&!(-2==f.elementNumber||0==f.elementNumber)&&f.setSymbol(f.symbol.toLowerCase())}},"JU.BS");j(b,"getSelections",function(){var a=this.top.htNested;if(!(null==a||0==this.target.nodes.length))for(var c=new java.util.Hashtable,h,a=a.entrySet().iterator();a.hasNext()&&((h=a.next())||1);){var b=h.getValue().toString();if(b.startsWith("select")){var d=c.containsKey(b)?c.get(b):this.target.nodes[0].findAtomsLike(b.substring(6));null==d&&(d=new JU.BS);c.put(b,d);h.setValue(d)}}});
j(b,"findImplicitHydrogen",function(a){for(var c=a.getEdges().length;0<=--c;){var h=a.getBondedAtomIndex(c);if(1==this.target.nodes[h].getElementNumber()&&!this.bsFound.get(h))return this.target.nodes[h]}return null},"JU.Node");j(b,"toString",function(){if(null!=this.pattern0)return this.pattern0;if(this.targetSet)return"molecular formula: "+this.target.getMolecularFormula(!0,null,!1);var a=(new JU.SB).append(this.pattern);a.append("\nmolecular formula: "+this.getMolecularFormula(!0,null,!1));return a.toString()});
b=K(function(){this.bsSelected=null;this.selectedAtomCount=0;this.ringSets=null;this.ringCount=0;this.ringData=null;this.ringDataMax=0;this.bsAromaticRings=this.bsAromatic6=this.bsAromatic5=this.bsAromatic=this.ringConnections=this.ringCounts=null;this.$hasRingData=!1;this.flags=-1;I(this,arguments)},JS.SmilesSearch,"SmilesTarget",JU.JmolMolecule);O(b,function(){this.bsAromatic=new JU.BS;this.bsAromatic5=new JU.BS;this.bsAromatic6=new JU.BS});j(b,"hasRingData",function(a){a!=this.flags&&(this.flags=
a,this.$hasRingData=!1);a=this.$hasRingData;this.$hasRingData=!0;return a},"~N");j(b,"setAtoms",function(a,c,h){this.$hasRingData=!1;this.nodes=a;this.ac=c;this.selectedAtomCount=null==h?c:h.cardinality();null==h&&(h=JU.BS.newN(c),h.setBits(0,c));this.bsSelected=h},"~A,~N,JU.BS");j(b,"checkAromaticDefined",function(){JS.SmilesAromatic.checkAromaticDefined(this.nodes,this.bsSelected,this.bsAromatic)});j(b,"getBSAromaticRings",function(){if(null==this.bsAromaticRings&&(this.bsAromaticRings=new JU.BS,
null!=this.ringSets&&null!=this.bsAromatic))for(var a=this.ringSets.size();0<=--a;){var c=this.ringSets.get(a).clone();c.andNot(this.bsAromatic);c.isEmpty()&&this.bsAromaticRings.set(a)}return this.bsAromaticRings});j(b,"setRingData",function(a,c,h){0>h&&(h=8);0<a&&6>h&&(h=6);c&&(this.ringCounts=y(this.ac,0),this.ringConnections=y(this.ac,0),this.ringData=Array(h+1));this.ringSets=new JU.Lst;return this.ringDataMax=h},"~N,~B,~N");j(b,"finalizeAromatic",function(a){this.bsAromatic5.clearAll();this.bsAromatic6.clearAll();
for(var c=a.size();0<=--c;){var h=a.get(c);h.and(this.bsAromatic);switch(h.cardinality()){case 5:this.bsAromatic5.or(h);break;case 6:this.bsAromatic6.or(h)}}},"JU.Lst");j(b,"finalizeRingData",function(){for(var a=this.bsSelected.nextSetBit(0);0<=a;a=this.bsSelected.nextSetBit(a+1))for(var c=this.nodes[a],h=c.getBondCount();0<=--h;)0<this.ringCounts[c.getBondedAtomIndex(h)]&&this.ringConnections[a]++});j(b,"hasDoubleBonds",function(){for(var a=0;a<this.nodes.length;a++)if(null==this.bsSelected||this.bsSelected.get(a)){var c=
this.nodes[a];if(1!=c.getElementNumber())for(var h=c.getBondCount(),c=c.getEdges(),b=0;b<h;b++)if(c[b].isCovalent()&&1!=c[b].getBondType())return!0}return!1})});G("JS");A(["java.util.Hashtable","JU.BS","JS.VTemp"],"JS.SmilesGenerator","JU.AU $.Lst $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesParser $.SmilesSearch $.SmilesStereo JU.BSUtil $.Elements $.JmolMolecule $.Logger".split(" "),function(){var b=K(function(){this.atoms=null;this.ac=0;this.bsAromatic=this.bsSelected=null;this.explicitHydrogen=
this.flags=0;this.vTemp=this.ringSets=null;this.nPairsMax=this.nPairs=0;this.bsToDo=this.bsBondsDn=this.bsBondsUp=null;this.bsIgnoreHydrogen=new JU.BS;this.bsIncludingH=this.bsRingKeys=this.htRings=this.htRingsSequence=this.alleneStereo=this.prevSp2Atoms=this.prevAtom=null;this.topologyOnly=!1;this.getAromatic=!0;this.openSMILES=this.noStereo=this.aromaticDouble=this.noBioComment=this.addAtomComment=!1;this.smilesStereo=this.polySmilesCenter=null;this.isPolyhedral=!1;this.sm=this.aromaticRings=null;
this.iHypervalent=0;this.allComponents=this.noBranches=this.haveSmilesAtoms=this.is2D=!1;this.ptSp2Atom0=this.ptAtom=0;this.atemp=null;this.chainCheck=0;I(this,arguments)},JS,"SmilesGenerator",null);O(b,function(){this.vTemp=new JS.VTemp;this.bsBondsUp=new JU.BS;this.bsBondsDn=new JU.BS;this.htRingsSequence=new java.util.Hashtable;this.htRings=new java.util.Hashtable;this.bsRingKeys=new JU.BS});j(b,"getSmiles",function(a,c,h,b,d,f){var g=b.nextSetBit(0);if(0>g)return"";this.haveSmilesAtoms=M(c[g],
"JS.SmilesAtom")&&c[g].definesStereo();this.sm=a;this.flags=f;this.atoms=c;this.ac=h;b=JU.BSUtil.copy(b);this.bsSelected=JU.BS.copy(b);this.flags=f=JS.SmilesSearch.addFlags(f,null==d?"":d.toUpperCase());if(1048576==(f&1048576))return this.getBioSmiles(b,d,f);this.openSMILES=5==(f&5);this.addAtomComment=131072==(f&131072);this.aromaticDouble=512==(f&512);this.explicitHydrogen=8192==(f&8192)?8192:4096==(f&4096)?4096:0;if(8192==this.explicitHydrogen){a=new JU.BS;for(h=b.nextSetBit(0);0<=h;h=b.nextSetBit(h+
1))if(d=c[h],3==d.getCovalentHydrogenCount()&&4==d.getCovalentBondCount()){var l=!0;a.clearAll();for(var k=d.getBondCount();0<=--k;){var m=d.getBondedAtomIndex(k);if(1==c[m].getElementNumber())if(l=1==c[m].getElementNumber())a.set(m);else break;l&&(this.bsIgnoreHydrogen.set(h),b.andNot(a))}}}this.topologyOnly=16384==(f&16384);this.getAromatic=16!=(f&16);this.noStereo=32==(f&32);this.isPolyhedral=65536==(f&65536);this.is2D=134217728==(f&134217728);this.noBranches=!1;this.allComponents=32768==(f&32768);
return this.getSmilesComponent(c[g],b,!0,!1,!1)},"JS.SmilesMatcher,~A,~N,JU.BS,~S,~N");j(b,"getBioSmiles",function(a,c,h){this.addAtomComment=131072==(h&131072);var b=3145728==(h&3145728),d=34603008==(h&34603008),f=5242880==(h&5242880);h=9437184==(h&9437184);var g=f||h,l=new JU.SB;null!=c&&!this.noBioComment&&l.append("//* Jmol bioSMILES ").append(c.$replace("*","_")).append(" *//");c=this.noBioComment?"":"\n";var k=new JU.BS,m=null,j="",n,t=new JU.Lst;try{for(var r=0,u=a.nextSetBit(0);0<=u;u=a.nextSetBit(u+
1)){var s=this.atoms[u],p=s.getGroup1("?"),x=s.getBioStructureTypeName(),v=p===p.toLowerCase();if(null!=c)if(0<l.length()&&l.append(c),c=null,r=0,0<x.length)0!=s.getChainID()&&!d&&(n="//* chain "+s.getChainIDStr()+" "+x+" "+s.getResno()+" *// ",r=n.length,l.append(n)),r++,l.append("~").appendC(x.toLowerCase().charAt(0)).append("~");else{n=this.getSmilesComponent(s,a,!1,!0,!0);if(n.equals(m)){c="";continue}var m=n,F=s.getGroup3(!0),w;d?w="/"+n+"/":(null!=F&&(n="//* "+F+" *//"+n),w=n+"//");if(0<=j.indexOf(w)){c=
"";continue}j+=w;l.append(n);c=d?".":".\n";continue}75<=r&&!d&&(l.append("\n  "),r=2);this.addAtomComment&&l.append("\n//* ["+s.getGroup3(!1)+"#"+s.getResno()+"] *//\t");v?this.addBracketedBioName(l,s,0<x.length?".0":null,!1):l.append(p);r++;if(g){s.getCrossLinkVector(t,f,h);for(var B=0;B<t.size();B+=3)l.append(":"),n=this.getRingCache(t.get(B).intValue(),t.get(B+1).intValue(),this.htRingsSequence),l.append(n),r+=1+n.length;t.clear()}s.getGroupBits(k);a.andNot(k);var z=s.getOffsetResidueAtom("\x00",
1);if(0>z||!a.get(z)){d||l.append(" //* ").appendI(s.getResno()).append(" *//");if(0>z&&0>(z=a.nextSetBit(u+1)))break;0<r&&(c=d?".":".\n")}u=z-1}}catch(D){if(H(D,Exception))throw new JS.InvalidSmilesException("//* error: "+D.getMessage()+" *//");throw D;}if(!b&&!this.htRingsSequence.isEmpty())throw this.dumpRingKeys(l,this.htRingsSequence),new JS.InvalidSmilesException("//* ?ring error? *//");n=l.toString();n.endsWith(".\n")?n=n.substring(0,n.length-2):d&&n.endsWith(".")&&(n=n.substring(0,n.length-
1));return n},"JU.BS,~S,~N");j(b,"addBracketedBioName",function(a,c,h,b){a.append("[");if(null!=h){var d=c.getChainIDStr();a.append(c.getGroup3(!1));h.equals(".0")||a.append(h).append("#").appendI(c.getElementNumber());b&&(a.append("//* ").appendI(c.getResno()),0<d.length&&a.append(":").append(d),a.append(" *//"))}else a.append(JU.Elements.elementNameFromNumber(c.getElementNumber()));a.append("]")},"JU.SB,JU.Node,~S,~B");j(b,"getSmilesComponent",function(a,c,h,b,d){for(var f="";;){null==a&&(a=this.atoms[c.nextSetBit(0)]);
a=this.checkFirstAtom(a);this.bsSelected=JU.JmolMolecule.getBranchBitSet(this.atoms,a.getIndex(),JU.BSUtil.copy(c),null,-1,!0,h);c.andNot(this.bsSelected);this.iHypervalent=-1;for(var g=this.bsSelected.nextSetBit(0);0<=g&&0>this.iHypervalent;g=this.bsSelected.nextSetBit(g+1))if(4<this.atoms[g].getCovalentBondCount()||this.isPolyhedral)this.iHypervalent=g;this.bsIncludingH=JU.BSUtil.copy(this.bsSelected);if(0==this.explicitHydrogen)for(g=this.bsSelected.nextSetBit(0);0<=g;g=this.bsSelected.nextSetBit(g+
1)){var l=this.atoms[g];1==l.getAtomicAndIsotopeNumber()&&(0<l.getBondCount()&&l.getBondedAtomIndex(0)!=this.iHypervalent&&!this.isExplicitOnly(this.atoms[l.getBondedAtomIndex(0)]))&&this.bsSelected.clear(g)}this.bsAromatic=new JU.BS;!this.topologyOnly&&2<this.bsSelected.cardinality()&&(this.generateRingData(),this.setBondDirections());this.bsToDo=JU.BSUtil.copy(this.bsSelected);l=new JU.SB;for(g=this.bsToDo.nextSetBit(0);0<=g;g=this.bsToDo.nextSetBit(g+1))if(4<this.atoms[g].getCovalentBondCount()||
this.isPolyhedral||this.noBranches)null==a&&l.append("."),this.getSmilesAt(l,this.atoms[g],b,!1,d,!1),a=null;if(null!=a)for(;null!=(a=this.getSmilesAt(l,a,b,!0,d,!1)););for(;!this.bsToDo.isEmpty()||!this.htRings.isEmpty();){a=this.htRings.values().iterator();if(a.hasNext()){if(a=this.atoms[a.next()[1].intValue()],!this.bsToDo.get(a.getIndex()))break}else a=this.atoms[this.bsToDo.nextSetBit(0)];l.append(".");for(this.prevAtom=this.prevSp2Atoms=this.alleneStereo=null;null!=(a=this.getSmilesAt(l,a,b,
!0,d,!1)););}if(!this.htRings.isEmpty())throw this.dumpRingKeys(l,this.htRings),new JS.InvalidSmilesException("//* ?ring error? *//\n"+l);a=l.toString();if(0<=a.indexOf("^-")){l=a;try{for(var k=this.sm.getAtropisomerKeys(a,this.atoms,this.ac,this.bsSelected,this.bsAromatic,this.flags),g=1;g<k.length;){var m=a.indexOf("^-");if(0>m)break;a=a.substring(0,m+1)+k.substring(g,g+3).trim()+a.substring(m+1);g+=3}}catch(j){if(H(j,Exception))j.printStackTrace(),a=l;else throw j;}}f+=a;if(0>c.nextSetBit(0)||
!this.allComponents)break;f+=".";a=null}return f},"JU.Node,JU.BS,~B,~B,~B");j(b,"checkFirstAtom",function(a){0==this.explicitHydrogen&&(1==a.getAtomicAndIsotopeNumber()&&0<a.getEdges().length)&&(a=this.atoms[a.getBondedAtomIndex(0)]);for(var c=a,h=null;2==c.getCovalentBondCount();){var b=c.getEdges();if(2!=b[0].getBondType()||2!=b[1].getBondType())break;var d=b[0].getOtherNode(c);d===h&&(d=b[1].getOtherNode(c));h=c;c=d}return null==c?a:c},"JU.Node");j(b,"generateRingData",function(){var a=JS.SmilesParser.newSearch("[r500]",
!0,!0);a.target.setAtoms(this.atoms,this.ac,this.bsSelected);a.setFlags(this.flags);!a.needRingData&&a.target.hasDoubleBonds()&&(a.needRingData=!0);a.ringDataMax=7;a.flags=this.flags;var c=JU.AU.createArrayOfArrayList(4);a.setRingData(null,c,!0);this.bsAromatic=a.target.bsAromatic;this.ringSets=a.target.ringSets;this.aromaticRings=c[3]});j(b,"getBondStereochemistry",function(a,c){if(null==a)return"\x00";var h=a.index,b=null==c||a.getAtomIndex1()==c.getIndex();return this.bsBondsUp.get(h)?b?"/":"\\":
this.bsBondsDn.get(h)?b?"\\":"/":"\x00"},"JU.Edge,JU.SimpleNode");j(b,"setBondDirections",function(){for(var a=new JU.BS,c=P(2,3,null),h=this.bsSelected.nextSetBit(0);0<=h;h=this.bsSelected.nextSetBit(h+1))for(var b=this.atoms[h],d=b.getEdges(),f=0;f<d.length;f++){var g=d[f],l=g.index,k;if(!a.get(l)&&!(2!=g.getCovalentOrder()||JS.SmilesSearch.isRingBond(this.ringSets,null,h,(k=g.getOtherNode(b)).getIndex()))){a.set(l);g=0;for(l=b;2==k.getCovalentBondCount()&&4==k.getValence();){var m=k.getEdges(),
m=m[m[0].getOtherNode(k)===l?1:0];a.set(m.index);l=k;k=m.getOtherNode(k);g++}if(1!=g%2){for(var j=g=null,j=0,l=P(-1,[b,k]),n=1,m=0;2>m&&0<n&&3>n;m++)for(var n=0,t=l[m],r=t.getEdges(),u=0<this.explicitHydrogen||this.isExplicitOnly(t),s=0;s<r.length;s++){var p;if(!(1!=r[s].getCovalentOrder()||!u&&1==(p=r[s].getOtherNode(t)).getElementNumber()&&0==p.getIsotopeNumber()))c[m][n++]=r[s],"\x00"!=this.getBondStereochemistry(r[s],t)&&(g=r[s],j=m)}if(!(3==n||0==n))if(null==g&&(j=0,g=c[j][0],this.bsBondsUp.set(g.index)),
n=l[j],t=this.getBondStereochemistry(g,n),j=g.getOtherNode(n),null!=j)for(m=0;2>m;m++){r=l[m];for(u=0;2>u;u++)if(s=c[m][u],!(null==s||s===g)){var x=s.index,v=s.getOtherNode(r);if(null!=v){var F=this.getBondStereochemistry(s,r),w;if(this.haveSmilesAtoms){w=j.isStereoOpposite(v.getIndex(),n.getIndex(),r.getIndex());if(null==w){JU.Logger.debugging&&JU.Logger.debug("SmilesGenerator could not find stereo for "+j+"/"+v);continue}w=w.booleanValue()}else w=JS.SmilesStereo.isDiaxial(n,r,j,v,this.vTemp,0);
"\x00"==F||F!=t==w?("\\"==t&&w||"/"==t&&!w)==(s.getAtomIndex1()!=v.getIndex())?this.bsBondsUp.set(x):this.bsBondsDn.set(x):(this.bsBondsUp.clear(x),this.bsBondsDn.clear(x),JU.Logger.error("BOND STEREOCHEMISTRY PARITY ERROR-stereochemistry for bond "+x+""));JU.Logger.debugging&&JU.Logger.debug(this.getBondStereochemistry(g,n)+" "+j.getIndex()+" "+v.getIndex()+" "+this.getBondStereochemistry(s,r))}}}}}}});j(b,"getSmilesAt",function(a,c,h,b,d,f){var g=c.getIndex();if(!this.bsToDo.get(g))return null;
this.ptAtom++;this.bsToDo.clear(g);var l=g==this.iHypervalent||0!=this.explicitHydrogen&&!this.bsIgnoreHydrogen.get(g),k=this.isExplicitOnly(c),j=this.bsAromatic.get(g),q=!this.bsSelected.get(g),n=null==this.prevAtom?-1:this.prevAtom.getIndex(),t=this.prevSp2Atoms,r=null!=t,p=c.getElementNumber(),s=0,L=this.alleneStereo;this.alleneStereo=null;var x=new JU.Lst,v=null,F=null,w=c.getEdges();!f&&null!=this.polySmilesCenter&&(b=!1,this.sortPolyBonds(c,this.prevAtom,this.polySmilesCenter));var B=null;f=
j?10:0;JU.Logger.debugging&&JU.Logger.debug(a.toString());if(null!=w)for(var z=0,D=w.length;z<D;z++){var C=w[z];if(C.isCovalent()){var E=w[z].getOtherNode(c),y=E.getIndex();if(y==n)F=w[z];else{C=!l&&!k&&1==E.getElementNumber()&&0>=E.getIsotopeNumber();if(!this.bsIncludingH.get(y)){if(C||!h||!this.bsSelected.get(g))continue;this.bsToDo.set(y)}C?(B=E,s++,1<s&&(f=10)):x.addLast(w[z])}}}1<s&&(t=null);D=null!=t?2:0;null==t&&(!j&&1>=s)&&(t=Array(5));var G=null;null!=F&&(G=this.getBondOrder(F,g,n,j),null!=
t&&!r&&(t[D++]=this.prevAtom));null!=t&&!r&&(this.ptSp2Atom0=this.ptAtom);null!=t&&1==s&&(t[D++]=B);k=0;y=new JU.BS;E=x.size();if(b)for(z=0;z<E;z++){var C=x.get(z),w=C.getOtherNode(c),A=w.getCovalentBondCount()-(l||this.isExplicitOnly(w)?0:w.getCovalentHydrogenCount()),H=C.getCovalentOrder();if(!this.htRings.containsKey(JS.SmilesGenerator.getRingKey(w.getIndex(),g)))if(w=null!=v||z<E-1,1==A&&w)y.set(C.index);else if(1<H||A>k)k=1<H?1E3+H:A,v=C}l=null==v?null:v.getOtherNode(c);k=null==v?0:v.getCovalentOrder();
E=Array(7);7>f&&null!=F&&(r&&2==F.getCovalentOrder()&&2==k&&null!=t[1]?(E[f++]=t[0],E[f++]=t[1]):E[f++]=this.prevAtom);7>f&&1==s&&(E[f++]=B);C=this.getBondStereochemistry(F,this.prevAtom);if(null!=G||"\x00"!=C)"\x00"!=C&&(G=""+C),a.append(G);A=f;H=D;F=new JU.SB;B=new JU.Lst;for(z=0;z<x.size();z++)if(C=x.get(z),y.get(C.index)){w=C.getOtherNode(c);C=new JU.SB;this.prevAtom=c;this.prevSp2Atoms=this.alleneStereo=null;var G=this.ptSp2Atom0,I=this.ptAtom;this.getSmilesAt(C,w,h,b,d,!0);this.ptAtom=I;this.ptSp2Atom0=
G;C=C.toString();x.removeItemAt(z--);null==v?B.addLast(C):F.append("(").append(C).append(")");7>f&&(E[f++]=w);null!=t&&5>D&&(t[D++]=w)}h=new JU.SB;var I=f,K=D,y=null;if(!b&&!this.noStereo&&null==this.polySmilesCenter&&(5==x.size()||6==x.size()))y=this.sortInorganic(c,x,this.vTemp);for(z=0;z<x.size();z++)C=x.get(z),C!==v&&(w=C.getOtherNode(c),b=w.getIndex(),G=this.getBondOrder(C,g,b,j),C=this.getBondStereochemistry(C,c),"\x00"!=C&&(G=""+C),h.append(G),h.append(this.getRingCache(g,b,this.htRings)),
7>f&&(E[f++]=w),null!=t&&5>D&&(t[D++]=w));A!=I&&I!=f&&this.swapArray(E,A,I,f);H!=K&&K!=D&&this.swapArray(t,H,K,D);if(r&&2==f&&2==k){r=this.ptAtom-this.ptSp2Atom0;D=l.getCovalentBondCount();x=7==l.getElementNumber();if(0==r%2)f=8;else if(3==D||2==D&&x){w=l.getEdges();for(r=0;r<w.length;r++)x=l.getBondedAtomIndex(r),w[r].isCovalent()&&x!=g&&(E[f++]=this.atoms[x]);2==D&&(E[f++]=l);4==f&&(this.alleneStereo=E,1==E[3].getAtomicAndIsotopeNumber()&&(A=E[3],E[3]=E[2],E[2]=A))}D=0}else null!=l&&7>f&&(E[f++]=
l);null!=L&&L[3]!==E[2]&&(L=a.lastIndexOf("@]="),0<L&&(r=a.substring(L),a.setLength("@"==a.charAt(L-1)?L-1:L+1),a.append(r)));this.haveSmilesAtoms&&(null==y&&4==f)&&(y=c.getStereoAtAt(E));L=c.getFormalCharge();r=c.getIsotopeNumber();x=c.getValence();b=this.openSMILES?c.getFloatProperty("property_atomclass"):NaN;z=c.getAtomName();w=c.getBioStructureTypeName();this.addAtomComment&&a.append("\n//* "+c.toString()+" *//\t");this.topologyOnly?a.append("*"):q&&0!=w.length&&0!=z.length?this.addBracketedBioName(a,
c,"."+z,!1):a.append(JS.SmilesAtom.getAtomLabel(p,r,d?-1:x,L,b,s,j,null!=y?y:this.noStereo?null:this.checkStereoPairs(c,null==this.alleneStereo?g:-1,E,f,-1==n),this.is2D));a.appendSB(h);if(null!=v)a.appendSB(F);else{A=B.size()-1;if(0<=A){for(z=0;z<A;z++)a.append("(").append(B.get(z)).append(")");a.append(B.get(A))}return null}null!=t&&2==k&&(1==D||2==D)?(null==t[0]&&(t[0]=c),null==t[1]&&(t[1]=c)):t=null;this.prevSp2Atoms=t;this.prevAtom=c;return l},"JU.SB,JU.SimpleNode,~B,~B,~B,~B");j(b,"isExplicitOnly",
function(a){return 7==a.getElementNumber()&&2==a.getCovalentBondCount()||6==a.getElementNumber()&&17==a.getIsotopeNumber()},"JU.SimpleNode");j(b,"swapArray",function(a,c,b,e){c=b-c;if(null==this.atemp||this.atemp.length<c)this.atemp=Array(c);for(var d=c,f=b;0<d;)this.atemp[--d]=a[--f];for(f=b;f<e;f++)a[f-c]=a[f];d=c;for(f=e;0<d;)a[--f]=this.atemp[--d]},"~A,~N,~N,~N");j(b,"getBondOrder",function(a,c,b,e){if(this.topologyOnly)return"";if(65537==(a.order&65537))return"^-";a=Math.max(a.isPartial()?1:
0,a.getCovalentOrder());return!e||!this.bsAromatic.get(b)?JS.SmilesBond.getBondOrderString(a):1==a&&!this.isSameAromaticRing(c,b)?"-":this.aromaticDouble&&(2==a||514==a)?"=":""},"JU.Edge,~N,~N,~B");j(b,"isSameAromaticRing",function(a,c){for(var b,e=this.aromaticRings.size();0<=--e;)if((b=this.aromaticRings.get(e)).get(a)&&b.get(c))return!0;return!1},"~N,~N");j(b,"sortPolyBonds",function(a,c,b){if(null==this.smilesStereo)try{this.smilesStereo=JS.SmilesStereo.newStereo(null)}catch(e){if(!H(e,"JS.InvalidSmilesException"))throw e;
}this.smilesStereo.sortPolyBondsByStereo(a,c,b,a.getEdges(),this.vTemp.vA)},"JU.SimpleNode,JU.SimpleNode,JU.P3");j(b,"sortInorganic",function(a,c,b){for(var e=a.getIndex(),d=c.size(),f=new JU.Lst,g=new JU.Lst,l,k,j=null,q=null,n,t,r=new JU.BS,p=null,s=Array(6),p=!0,y="",x=0,v=0;v<d;v++)if(n=c.get(v),s[0]=l=n.getOtherNode(a),0==v?y=this.addStereoCheck(0,e,l,"",null):p&&null!=this.addStereoCheck(0,e,l,y,null)&&(p=!1),!r.get(v)){r.set(v);for(var F=!1,w=v+1;w<d;w++)if(!r.get(w)&&(t=c.get(w),k=t.getOtherNode(a),
JS.SmilesStereo.isDiaxial(a,a,l,k,b,-0.95))){switch(++x){case 1:j=l;break;case 2:q=l;break;case 3:2==JS.SmilesStereo.getHandedness(q,j,l,a,b)&&(l=n,n=t,t=l)}f.addLast(P(-1,[n,t]));F=!0;r.set(w);break}F||g.addLast(n)}e=f.size();if(p||6==d&&3!=e||5==d&&0==e)return"";p=f.get(0);n=p[0];s[0]=n.getOtherNode(a);c.clear();c.addLast(n);1<e&&g.addLast(f.get(1)[0]);3==e&&g.addLast(f.get(2)[0]);1<e&&g.addLast(f.get(1)[1]);3==e&&g.addLast(f.get(2)[1]);for(v=0;v<g.size();v++)n=g.get(v),c.addLast(n),s[v+1]=n.getOtherNode(a);
c.addLast(p[1]);s[d-1]=p[1].getOtherNode(a);return JS.SmilesStereo.getStereoFlag(a,s,d,b,this.is2D)},"JU.SimpleNode,JU.Lst,JS.VTemp");j(b,"checkStereoPairs",function(a,c,b,e,d){if(10==e||e<(this.is2D?3:4))return"";if(0==this.explicitHydrogen&&(0<=c&&4==e)&&17>=a.getElementNumber())for(var f="",g=0;4>g;g++)if(null==(f=this.addStereoCheck(0,c,b[g],f,JU.BSUtil.newAndSetBit(c))))return"";if(this.is2D){c=4==e||!d?1:-1;d=a.getEdges();f=null;for(g=a.getBondCount();0<=--g;){var l=d[g];if(a===l.getAtom(0))switch(l.getBondType()){case 1025:f=
JS.SmilesGenerator.setStereoTemp(null,b,l.getAtom(1),c);break;case 1041:f=JS.SmilesGenerator.setStereoTemp(null,b,l.getAtom(1),-c)}}if(null==f)return"";3==e&&(b[e++]=JS.SmilesGenerator.setStereoTemp(a,b,f,0))}return JS.SmilesStereo.getStereoFlag(a,b,e,this.vTemp,this.is2D)},"JU.SimpleNode,~N,~A,~N,~B");b.setStereoTemp=j(b,"setStereoTemp",function(a,c,b,e){for(var d=new JS.SmilesAtom,f=0;4>f;f++){var g=c[f]===b;if(null==a){if(g)return a=b.getXYZ(),d.set(a.x,a.y,e),c[f]=d}else 3>f&&d.add(c[f])}if(null==
a)return null;d.scale(-0.33333334);d.scaleAdd2(2,a,d);return d},"JU.SimpleNode,~A,JU.SimpleNode,~N");j(b,"addStereoCheck",function(a,c,b,e,d){null!=d&&d.set(c);var f=b.getAtomicAndIsotopeNumber();if(1==f&&0==this.explicitHydrogen)return"H";var g=b.getCovalentBondCount(),l=b.getCovalentHydrogenCount(),k=6==f&&0!=this.explicitHydrogen?l:0;if(6==f||16==f?4!=g:1==f||1<g)return e+ ++this.chainCheck;var j=";"+a+"/"+f+"/"+k+"/"+g+(0==a?",":"_");if(6==f||16==f)switch(k){case 1:return e+j+ ++this.chainCheck;
case 0:case 2:if(null==d)return e;for(var f=b.getEdges(),q="",n="",t=2==k?0:3,k=b.getBondCount();0<=--k;){var n=f[k].getOtherNode(b),r=n.getIndex();!d.get(r)&&f[k].isCovalent()&&(d.set(r),n=this.addStereoCheck(a+1,b.getIndex(),n,"",d.clone()),0<=q.indexOf(n)&&t--,q+=n)}if(3==t)return e+j+ ++this.chainCheck;j=(j+q).$replace(",","_");if(0<a)return e+j}if(0<=e.indexOf(j)){if(3==l){for(k=a=0;k<g&&3>a;k++)d=b.getBondedAtomIndex(k),d!=c&&(a+=this.atoms[d].getAtomicAndIsotopeNumber());if(3<a)return e}return null}return e+
j},"~N,~N,JU.SimpleNode,~S,JU.BS");j(b,"getRingCache",function(a,c,b){var e=JS.SmilesGenerator.getRingKey(a,c),d=b.get(e),f=null==d?null:d[0];if(null==f)this.bsRingKeys.set(++this.nPairs),this.nPairsMax=Math.max(this.nPairs,this.nPairsMax),b.put(e,P(-1,[f=this.getRingPointer(this.nPairs),Integer.$valueOf(c),Integer.$valueOf(this.nPairs)])),JU.Logger.debugging&&JU.Logger.debug("adding for "+a+" ring key "+this.nPairs+": "+e);else{b.remove(e);a=d[2].intValue();this.bsRingKeys.clear(a);if(0>this.bsRingKeys.nextSetBit(0)&&
(2==this.nPairsMax||99==this.nPairsMax))this.nPairsMax=this.nPairs=99==this.nPairsMax?10:0;JU.Logger.debugging&&JU.Logger.debug("using ring key "+e)}return f},"~N,~N,java.util.Map");j(b,"getRingPointer",function(a){return 10>a?""+a:100>a?"%"+a:"%("+a+")"},"~N");j(b,"dumpRingKeys",function(a,c){JU.Logger.info(a.toString()+"\n\n");for(var b,e=c.keySet().iterator();e.hasNext()&&((b=e.next())||1);)JU.Logger.info("unmatched connection: "+b)},"JU.SB,java.util.Map");b.getRingKey=j(b,"getRingKey",function(a,
c){return Math.min(a,c)+"_"+Math.max(a,c)},"~N,~N")});G("JS");A(null,"JS.SmilesAromatic","java.util.Hashtable JU.BS $.Lst $.Measure $.V3 JS.SmilesRing $.SmilesRingSet JU.BSUtil $.Logger".split(" "),function(){var b=S(JS,"SmilesAromatic",null);b.setAromatic=j(b,"setAromatic",function(a,c,b,e,d,f,g,l,k,j,q,n,t,r){g=g||0<f;if(r)for(w=e.size();0<=--w;){if(B=e.get(w),r=JS.SmilesAromatic.isSp2Ring(a,c,b,B,l?3.4028235E38:0<f?0.1:0.01,k,0==f)){d.or(B);if(g){j=new JU.Lst;for(var p=B.nextSetBit(0);0<=p;p=B.nextSetBit(p+
1))for(var s=c[p],y=s.getEdges(),x=s.getIndex(),v=y.length;0<=--v;){var F=y[v].getOtherNode(s).getIndex();F>x&&B.get(F)&&j.addLast(y[v])}switch(JS.SmilesAromatic.checkHueckelAromatic(a,c,d,B,f,t)){case -1:continue;case 0:r=!1;case 1:if(null!=n&&n.addLast(new JS.SmilesRing(a,B,j,r)),!r)continue}}q.addLast(B)}}else for(var w=e.size();0<=--w;){var B=JU.BSUtil.copy(e.get(w));B.and(d);B.cardinality()==a&&q.addLast(B)}},"~N,~A,JU.BS,JU.Lst,JU.BS,~N,~B,~B,~B,JS.VTemp,JU.Lst,JU.Lst,~A,~B");b.checkAromaticDefined=
j(b,"checkAromaticDefined",function(a,c,b){for(var e=c.nextSetBit(0);0<=e;e=c.nextSetBit(e+1))for(var d=a[e].getEdges(),f=0;f<d.length;f++)switch(d[f].getBondType()){case 515:case 514:case 513:b.set(d[f].getAtomIndex1()),b.set(d[f].getAtomIndex2())}},"~A,JU.BS,JU.BS");b.isSp2Ring=j(b,"isSp2Ring",function(a,c,b,e,d,f,g){if(f)for(var l=e.nextSetBit(0);0<=l;l=e.nextSetBit(l+1)){if(3<c[l].getCovalentBondCount())return!1}else for(l=e.nextSetBit(0);0<=l;l=e.nextSetBit(l+1))if(3<c[l].getCovalentBondCountPlusMissingH())return!1;
if(3.4028235E38==d)return!0;0>=d&&(d=0.01);for(var k=f=a=null,l=e.cardinality(),j=Array(2*l),q=0,n=1-5*d,l=e.nextSetBit(0);0<=l;l=e.nextSetBit(l+1)){for(var t=c[l],r=-1,p=-1,s=-1,y=t.getEdges().length;0<=--y;){var x=t.getBondedAtomIndex(y);if(b.get(x))if(e.get(x))0>p?p=x:s=x;else{if(16==t.getElementNumber()){if(!g)return!1;x=-1}r=x}}null==k&&(k=new JU.V3,a=new JU.V3,f=new JU.V3);y=0;for(t=l;2>y;y++){JU.Measure.getNormalThroughPoints(c[p],c[t],c[s],a,f);if(!JS.SmilesAromatic.addNormal(a,k,n))return!1;
j[q++]=JU.V3.newV(a);if(0>(t=r))break}}return JS.SmilesAromatic.checkStandardDeviation(j,k,q,d)},"~N,~A,JU.BS,JU.BS,~N,~B,~B");b.addNormal=j(b,"addNormal",function(a,c,b){var e=c.dot(a);if(0!=e&&Math.abs(e)<b)return!1;0>e&&a.scale(-1);c.add(a);c.normalize();return!0},"JU.V3,JU.V3,~N");b.checkStandardDeviation=j(b,"checkStandardDeviation",function(a,c,b,e){for(var d=0,f=0,g=0;g<b;g++)var l=a[g].dot(c),d=d+l,f=f+l*l;d=Math.sqrt((f-d*d/b)/(b-1));return d<e},"~A,JU.V3,~N,~N");b.checkHueckelAromatic=j(b,
"checkHueckelAromatic",function(a,c,b,e,d,f){for(var g=0,l=0,j=e.nextSetBit(0);0<=j&&0<=g;j=e.nextSetBit(j+1)){var m=c[j],q=m.getElementNumber(),n=m.getCovalentBondCountPlusMissingH(),n=n+m.getValence(),n=n-4;if(6==q){var t=m.getFormalCharge();-2147483648!=t&&(n+=t)}q=5<=q&&8>=q?q-5:15==q?2:34==q?3:33==q?4:16==q?5:-1;if(0<=q){q=JS.SmilesAromatic.OS_PI_COUNTS[q];if(0>n||n>=q.length)return-1;switch(n=q[n]){case -2:return-1;case -1:q=m.getEdges();n=0;for(t=q.length;0<=--t;){var r=q[t];if(2==r.getCovalentOrder()){n=
r.getOtherNode(m);n=6==n.getElementNumber()||b.get(n.getIndex())?1:0<d?-100:0;break}}default:if(0>n)return-1;null!=f&&(f[j]=n);g+=n;1==n&&l++;JU.Logger.debuggingHigh&&JU.Logger.info("atom "+m+" pi="+n+" npi="+g)}}}return 0==(g-2)%4&&(2>d||5==a||6==l)?1:0},"~N,~A,JU.BS,JU.BS,~N,~A");b.finalizeAromatic=j(b,"finalizeAromatic",function(a,c,b,e,d,f,g){g&&JS.SmilesAromatic.removeBridgingRings(b,e);JS.SmilesAromatic.checkFusedRings(e,d,b);c.clearAll();for(d=b.size();0<=--d;)c.or(b.get(d));if(g||f)for(d=
c.nextSetBit(0);0<=d;d=c.nextSetBit(d+1)){b=a[d].getEdges();f=0;for(var l=b.length;0<=--l;){var j=b[l].getOtherNode(a[d]),m=b[l].getCovalentOrder(),q=j.getIndex();if(c.get(q)){if(2==m){j=!1;for(m=e.size();0<=--m;){var n=e.get(m);if(n.get(d)&&n.get(q)){j=!0;break}}if(!j){f=-1;break}}f++}else if(g&&6==j.getElementNumber()&&2==m){f=-1;break}}2>f&&(c.clear(d),d=-1)}},"~A,JU.BS,JU.Lst,JU.Lst,~A,~B,~B");b.removeBridgingRings=j(b,"removeBridgingRings",function(a,c){var b=new JU.BS,e=new JU.BS,d=new JU.BS;
JS.SmilesAromatic.checkBridges(a,e,a,e,b);JS.SmilesAromatic.checkBridges(c,d,c,d,b);JS.SmilesAromatic.checkBridges(a,e,c,d,b);for(b=a.size();0<=--b;)e.get(b)&&a.removeItemAt(b);for(b=c.size();0<=--b;)d.get(b)&&c.removeItemAt(b)},"JU.Lst,JU.Lst");b.checkBridges=j(b,"checkBridges",function(a,c,b,e,d){for(var f=a===b,g=a.size();0<=--g;)for(var l=a.get(g),j=f?g+1:0,m=b.size();--m>=j;){var q=b.get(m);q.equals(l)||(d.clearAll(),d.or(l),d.and(q),2<d.cardinality()&&(c.set(g),e.set(m)))}},"JU.Lst,JU.BS,JU.Lst,JU.BS,JU.BS");
b.checkFusedRings=j(b,"checkFusedRings",function(a,c,b){for(var e=new java.util.Hashtable,d=a.size();0<=--d;){for(var f=a.get(d),g=f.edges,l=g.size();0<=--l;){var j=JS.SmilesRing.getSetByEdge(g.get(l),e);null==j||j===f.$set||(null!=f.$set?j.addSet(f.$set,e):j.addRing(f))}(null==f.$set?f.$set=new JS.SmilesRingSet:f.$set).addRing(f);f.addEdges(e)}for(d=a.size();0<=--d;)if(!(f=a.get(d)).isOK&&!(null==(j=f.$set)||j.isEmpty())){if(2==j.getElectronCount(c)%4)for(l=j.size();0<=--l;)(f=j.get(l)).isOK||b.addLast(f);
j.clear()}},"JU.Lst,~A,JU.Lst");b.OS_PI_COUNTS=P(-1,[y(-1,[-2,1,0]),y(-1,[1,2,1,-1]),y(-1,[2,1,2,1,1]),y(-1,[2,1]),y(-1,[-2,1,2,1,-2]),y(-1,[2,1,2,2])])});G("JS");A(["JU.BS"],"JS.SmilesRing",null,function(){var b=K(function(){this.bsEdgesToCheck=this.edges=this.$set=null;this.isOK=!1;this.n=0;I(this,arguments)},JS,"SmilesRing",JU.BS);N(b,function(a,c,b,e){Q(this,JS.SmilesRing,[]);this.or(c);this.edges=b;this.isOK=e;this.n=a},"~N,JU.BS,JU.Lst,~B");j(b,"addEdges",function(a){for(var c=this.edges.size();0<=
--c;)a.put(JS.SmilesRing.getKey(this.edges.get(c)),this.$set)},"java.util.Hashtable");b.getSetByEdge=j(b,"getSetByEdge",function(a,c){return c.get(JS.SmilesRing.getKey(a))},"JU.Edge,java.util.Hashtable");b.getKey=j(b,"getKey",function(a){var c=a.getAtomIndex1();a=a.getAtomIndex2();return c<a?c+"_"+a:a+"_"+c},"JU.Edge")});G("JS");A(["JU.Lst","$.BS"],"JS.SmilesRingSet",null,function(){var b=K(function(){this.bs=null;I(this,arguments)},JS,"SmilesRingSet",JU.Lst);O(b,function(){this.bs=new JU.BS});N(b,
function(){Q(this,JS.SmilesRingSet,[])});j(b,"addSet",function(a,c){for(var b=a.size();0<=--b;){var e=a.get(b);this.addRing(e);e.addEdges(c)}},"JS.SmilesRingSet,java.util.Hashtable");j(b,"addRing",function(a){this.addLast(a);a.$set=this;this.bs.or(a)},"JS.SmilesRing");j(b,"getElectronCount",function(a){for(var c=0,b=this.bs.nextSetBit(0);0<=b;b=this.bs.nextSetBit(b+1))c+=a[b];return c},"~A")});G("JS");A(["JU.P3","JU.Node"],"JS.SmilesAtom",["JU.AU","JU.Elements","$.Logger","JV.JC"],function(){var b=
K(function(){this.patternIndex=-1;this.pattern=null;this.primitiveType=0;this.isAND=!1;this.subAtoms=null;this.index=this.nSubAtoms=0;this.residueChar=this.residueName=this.referance=null;this.insCode="\x00";this.isBioAtomWild=this.isBioResidue=this.isBioAtom=!1;this.bioType="\x00";this.$isLeadAtom=!1;this.notBondedIndex=-1;this.notCrossLinked=!1;this.aromaticAmbiguous=!0;this.covalentHydrogenCount=-1;this.elementDefined=this.hasSymbol=this.selected=this.not=!1;this.bioAtomName=this.atomType=null;
this.isFirst=!0;this.jmolIndex=-1;this.elementNumber=-2;this.implicitHydrogenCount=this.explicitHydrogenCount=this.residueNumber=this.atomNumber=-2147483648;this.bonds=this.parent=null;this.iNested=this.bondCount=0;this.isAromatic=!1;this.charge=this.atomicMass=-2147483648;this.matchingIndex=-1;this.stereo=null;this.component=-2147483648;this.atomSite=this.matchingComponent=0;this.nonhydrogenDegree=this.degree=-1;this.valence=0;this.connectivity=-1;this.ringSize=this.ringMembership=-2147483648;this.ringConnectivity=
-1;this.matchingNode=null;this.hasSubpattern=!1;this.mapIndex=-1;this.atomClass=NaN;this.symbol=null;this.isTopoAtom=!1;this.cipChirality=this.missingHydrogenCount=0;this.hasDoubleBond=!1;I(this,arguments)},JS,"SmilesAtom",JU.P3,JU.Node);O(b,function(){this.bonds=Array(4)});N(b,function(){Q(this,JS.SmilesAtom,[])});b.allowSmilesUnbracketed=j(b,"allowSmilesUnbracketed",function(a){return 0<="B, C, N, O, P, S, F, Cl, Br, I, *,".indexOf(a+",")},"~S");p(b,"getAtomType",function(){return null==this.atomType?
this.bioAtomName:this.atomType});j(b,"getChiralClass",function(){return null==this.stereo?-2147483648:this.stereo.getChiralClass(this)});j(b,"isDefined",function(){return this.hasSubpattern||0!=this.iNested||this.isBioAtom||-2147483648!=this.component||-2!=this.elementNumber||0<this.nSubAtoms});j(b,"setBioAtom",function(a){this.isBioAtom="\x00"!=a;this.bioType=a;null!=this.parent&&(this.parent.bioType=a,this.parent.isBioAtom=this.isBioAtom,this.parent.isBioAtomWild=this.isBioAtomWild)},"~S");j(b,
"setAtomName",function(a){null!=a&&(0<a.length&&(this.bioAtomName=a),a.equals("\x00")&&(this.$isLeadAtom=!0),null!=this.parent&&(this.parent.bioAtomName=a))},"~S");j(b,"setBonds",function(a){this.bonds=a},"~A");j(b,"addSubAtom",function(a,c){this.isAND=c;null==this.subAtoms&&(this.subAtoms=Array(2));this.nSubAtoms>=this.subAtoms.length&&(this.subAtoms=JU.AU.doubleLength(this.subAtoms));a.setIndex(this.index);a.parent=this;this.subAtoms[this.nSubAtoms++]=a;this.setSymbol("*");this.hasSymbol=!1;return a},
"JS.SmilesAtom,~B");j(b,"setIndex",function(a){this.index=a;return this},"~N");j(b,"setTopoAtom",function(a,c,b,e,d){this.component=a;this.index=c;this.patternIndex=d;this.setSymbol(b);this.charge=e;this.isTopoAtom=!0;return this},"~N,~N,~S,~N,~N");j(b,"setHydrogenCount",function(){this.missingHydrogenCount=this.explicitHydrogenCount;if(-2147483648!=this.explicitHydrogenCount)return!0;var a=this.getFormalCharge(),a=JS.SmilesAtom.getDefaultHCount(this.elementNumber,this.isAromatic,-2147483648==a?0:
a);if(0>a)return this.missingHydrogenCount=0,-1==a;7==this.elementNumber&&this.isAromatic&&2==this.bondCount&&1==this.bonds[0].getBondType()&&1==this.bonds[1].getBondType()&&a++;for(var c=0;c<this.bondCount;c++){var b=this.bonds[c];switch(b.getBondType()){case 81:7==this.elementNumber&&JU.Logger.info("Ambiguous bonding to aromatic N found -- MF may be in error");a-=1;break;case 1025:case 1041:case 65537:case 65538:a-=1;break;case 2:a-=this.isAromatic&&6==this.elementNumber?1:2;break;case 1:case 3:case 4:a-=
b.getBondType()}}0<=a&&(this.missingHydrogenCount=this.explicitHydrogenCount=a);return!0});b.getDefaultHCount=j(b,"getDefaultHCount",function(a,c,b){switch(a){case 0:case -1:case -2:return-1;case 1:return 1;case 6:return(c?3:4)+(0==b?0:1);case 8:case 16:return 2+b;case 7:return(c?2:3)+b;case 5:case 15:return 3;case 9:case 17:case 35:case 53:return 1+b;default:return 0}},"~N,~B,~N");p(b,"getIndex",function(){return this.index});j(b,"setSymbol",function(a){this.symbol=a;this.isAromatic=a.equals(a.toLowerCase());
this.elementDefined=this.hasSymbol=!0;if(a.equals("*"))return this.isAromatic=!1,this.elementNumber=-2,!0;if(a.equals("Xx"))return this.elementNumber=0,!0;this.aromaticAmbiguous=!1;if(a.equals("a")||a.equals("A"))return 0>this.elementNumber&&(this.elementNumber=-1),!0;this.isAromatic&&(a=a.substring(0,1).toUpperCase()+(1==a.length?"":a.substring(1)));this.elementNumber=JU.Elements.elementNumberFromSymbol(a,!0);return 0!=this.elementNumber},"~S");p(b,"getElementNumber",function(){return this.elementNumber});
j(b,"getAtomicMass",function(){return this.atomicMass});p(b,"getAtomNumber",function(){return this.atomNumber});j(b,"setAtomicMass",function(a){this.atomicMass=a},"~N");j(b,"getCharge",function(){return this.charge});j(b,"setCharge",function(a){this.charge=a},"~N");j(b,"getMatchingAtomIndex",function(){return this.matchingIndex});j(b,"getMatchingAtom",function(){return null==this.matchingNode?this:this.matchingNode});j(b,"setMatchingAtom",function(a,c){this.matchingNode=a;this.matchingIndex=c},"JU.Node,~N");
j(b,"setExplicitHydrogenCount",function(a){this.explicitHydrogenCount=a},"~N");j(b,"setImplicitHydrogenCount",function(a){this.implicitHydrogenCount=a},"~N");j(b,"setDegree",function(a){this.degree=a},"~N");j(b,"setNonhydrogenDegree",function(a){this.nonhydrogenDegree=a},"~N");j(b,"setValence",function(a){this.valence=a},"~N");j(b,"setConnectivity",function(a){this.connectivity=a},"~N");j(b,"setRingMembership",function(a){this.ringMembership=a},"~N");j(b,"setRingSize",function(a){this.ringSize=a;
if(500==this.ringSize||600==this.ringSize)this.isAromatic=!0},"~N");j(b,"setRingConnectivity",function(a){this.ringConnectivity=a},"~N");p(b,"getModelIndex",function(){return this.component});p(b,"getMoleculeNumber",function(){return this.component},"~B");p(b,"getAtomSite",function(){return this.atomSite});p(b,"getFormalCharge",function(){return this.charge});p(b,"getIsotopeNumber",function(){return this.atomicMass});p(b,"getAtomicAndIsotopeNumber",function(){return JU.Elements.getAtomicAndIsotopeNumber(this.elementNumber,
this.atomicMass)});p(b,"getAtomName",function(){return null==this.bioAtomName?"":this.bioAtomName});p(b,"getGroup3",function(){return null==this.residueName?"":this.residueName},"~B");p(b,"getGroup1",function(){return null==this.residueChar?"":this.residueChar},"~S");j(b,"addBond",function(a){this.bondCount>=this.bonds.length&&(this.bonds=JU.AU.doubleLength(this.bonds));this.bonds[this.bondCount]=a;2==a.order&&(this.hasDoubleBond=!0);this.bondCount++},"JS.SmilesBond");j(b,"setBondArray",function(){this.bonds.length>
this.bondCount&&(this.bonds=JU.AU.arrayCopyObject(this.bonds,this.bondCount));null!=this.subAtoms&&this.subAtoms.length>this.nSubAtoms&&(this.subAtoms=JU.AU.arrayCopyObject(this.subAtoms,this.subAtoms.length));for(var a=0;a<this.bonds.length;a++){var c=this.bonds[a];this.isBioAtom&&17==c.getBondType()?c.order=112:2==c.order&&(c.atom1.hasDoubleBond=c.atom2.hasDoubleBond=!0);c.atom1.index>c.atom2.index&&c.switchAtoms()}});p(b,"getEdges",function(){return null!=this.parent?this.parent.getEdges():this.bonds});
j(b,"getBond",function(a){return null!=this.parent?this.parent.getBond(a):0<=a&&a<this.bondCount?this.bonds[a]:null},"~N");p(b,"getCovalentBondCount",function(){return this.getBondCount()});p(b,"getBondCount",function(){return null!=this.parent?this.parent.getBondCount():this.bondCount});p(b,"getCovalentBondCountPlusMissingH",function(){return this.getBondCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});p(b,"getTotalHydrogenCount",function(){return this.getCovalentHydrogenCount()+(this.isTopoAtom?
0:this.missingHydrogenCount)});p(b,"getImplicitHydrogenCount",function(){return this.implicitHydrogenCount});p(b,"getExplicitHydrogenCount",function(){return this.explicitHydrogenCount});j(b,"getMatchingBondedAtom",function(a){if(null!=this.parent)return this.parent.getMatchingBondedAtom(a);if(a>=this.bondCount)return-1;a=this.bonds[a];return(a.atom1===this?a.atom2:a.atom1).matchingIndex},"~N");p(b,"getBondedAtomIndex",function(a){return null!=this.parent?this.parent.getBondedAtomIndex(a):this.bonds[a].getOtherAtom(this).index},
"~N");p(b,"getCovalentHydrogenCount",function(){if(0<=this.covalentHydrogenCount)return this.covalentHydrogenCount;if(null!=this.parent)return this.covalentHydrogenCount=this.parent.getCovalentHydrogenCount();for(var a=this.covalentHydrogenCount=0;a<this.bonds.length;a++)1==this.bonds[a].getOtherAtom(this).elementNumber&&this.covalentHydrogenCount++;return this.covalentHydrogenCount});p(b,"getValence",function(){if(null!=this.parent)return this.parent.getValence();var a=this.valence;if(0>=a&&null!=
this.bonds)for(var c=this.bondCount;0<=--c;)a+=this.bonds[c].getValence();return this.valence=a});p(b,"getTotalValence",function(){return this.getValence()+(this.isTopoAtom?0:this.missingHydrogenCount)});j(b,"getBondTo",function(a){if(null!=this.parent)return this.parent.getBondTo(a);for(var c,b=0;b<this.bonds.length;b++)if(null!=(c=this.bonds[b]))if(null==a?c.atom2===this:c.getOtherAtom(this)===a)return c;return null},"JS.SmilesAtom");j(b,"getBondNotTo",function(a,c){for(var b,e=0;e<this.bonds.length;e++)if(null!=
(b=this.bonds[e])){var d=b.getOtherAtom(this);if(a!==d&&(c||1!=d.elementNumber))return b}return null},"JS.SmilesAtom,~B");p(b,"isLeadAtom",function(){return this.$isLeadAtom});p(b,"getOffsetResidueAtom",function(a,c){if(this.isBioAtom){if(0==c)return this.index;for(var b=0;b<this.bonds.length;b++)if(this.bonds[b].getAtomIndex1()==this.index&&96==this.bonds[b].getBondType())return this.bonds[b].getOtherAtom(this).index}return-1},"~S,~N");p(b,"getGroupBits",function(a){a.set(this.index)},"JU.BS");p(b,
"isCrossLinked",function(a){return this.getBondTo(a).isHydrogen()},"JU.Node");p(b,"getCrossLinkVector",function(a){for(var c=!1,b=0;b<this.bonds.length;b++)if(112==this.bonds[b].order){if(null==a)return!0;a.addLast(Integer.$valueOf(this.index));a.addLast(Integer.$valueOf(this.bonds[b].getOtherAtom(this).index));a.addLast(Integer.$valueOf(this.bonds[b].getOtherAtom(this).index));c=!0}return c},"JU.Lst,~B,~B");p(b,"getBioStructureTypeName",function(){return null});p(b,"getInsertionCode",function(){return this.insCode});
p(b,"getResno",function(){return this.residueNumber});p(b,"getChainID",function(){return 0});p(b,"getChainIDStr",function(){return""});b.getAtomLabel=j(b,"getAtomLabel",function(a,c,b,e,d,f,g,l,j){var m=JU.Elements.elementSymbolFromNumber(a);if(1==a||g&&!(m=m.toLowerCase()).equals("c")&&!m.equals("o")&&!m.equals("s"))b=2147483647;g=2147483647!=b&&0>=c&&0==e&&Float.isNaN(d)&&(null==l||0==l.length);var q=JS.SmilesAtom.getDefaultHCount(a,!1,-2147483648==e?0:e);if(j&&0==f){if(g&&6==a)return m;f=q-b}return g&&
q==b?m:"["+(0>=c?"":""+c)+m+(null==l?"":l)+(1<f?"H"+f:1==f?"H":"")+(-2147483648==e||0==e?"":0>e?""+e:"+"+e)+(Float.isNaN(d)?"":":"+U(d))+"]"},"~N,~N,~N,~N,~N,~N,~B,~S,~B");p(b,"getBioSmilesType",function(){return this.bioType});j(b,"isNucleic",function(){return"n"==this.bioType||"r"==this.bioType||"d"==this.bioType});p(b,"isPurine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="AG".indexOf(this.residueChar)});p(b,"isPyrimidine",function(){return null!=this.residueChar&&this.isNucleic()&&
0<="CTUI".indexOf(this.residueChar)});p(b,"isDeleted",function(){return!1});p(b,"findAtomsLike",function(){return null},"~S");p(b,"toString",function(){var a=null!=this.residueChar||null!=this.residueName?(null==this.residueChar?this.residueName:this.residueChar)+"."+this.bioAtomName:null!=this.bioAtomName&&-2147483648!=this.atomNumber?null:-1==this.elementNumber?"A":-2==this.elementNumber?"*":JU.Elements.elementSymbolFromNumber(this.elementNumber);if(null==a)return this.bioAtomName+" #"+this.atomNumber;
this.isAromatic&&(a=a.toLowerCase());for(var c="",b=0;b<this.bondCount;b++)c+=this.bonds[b].getOtherAtom(this).index+", ";return"["+a+"."+this.index+(0<=this.matchingIndex?"("+this.matchingNode+")":"")+"]->"+c+"("+this.x+","+this.y+","+this.z+")"});p(b,"getFloatProperty",function(a){return"property_atomclass"===a?this.atomClass:NaN},"~S");p(b,"getMass",function(){return this.atomicMass});p(b,"getCIPChirality",function(){return JV.JC.getCIPChiralityName(this.cipChirality&-225)},"~B");p(b,"setCIPChirality",
function(a){this.cipChirality=a},"~N");p(b,"getCIPChiralityCode",function(){return this.cipChirality});p(b,"getXYZ",function(){return this});j(b,"getStereo",function(){return this.stereo});j(b,"getPatternIndex",function(){return this.patternIndex});p(b,"modelIsRawPDB",function(){return!1});j(b,"definesStereo",function(){return!1});j(b,"getStereoAtAt",function(){return null},"~A");j(b,"isStereoOpposite",function(){return null},"~N,~N,~N")});G("JS");A(["JU.Edge"],"JS.SmilesBond",["JS.InvalidSmilesException"],
function(){var b=K(function(){this.atom2=this.atom1=null;this.isNot=!1;this.primitives=this.matchingBond=null;this.nPrimitives=0;this.bondsOr=null;this.nBondsOr=0;this.isConnection=!1;this.atropType=null;this.isChain=!1;I(this,arguments)},JS,"SmilesBond",JU.Edge);N(b,function(a,c,b,e){Q(this,JS.SmilesBond,[]);this.set2(b,e);this.set2a(a,c)},"JS.SmilesAtom,JS.SmilesAtom,~N,~B");b.getBondOrderString=j(b,"getBondOrderString",function(a){switch(a){case 2:return"=";case 3:return"#";case 4:return"$";default:return""}},
"~N");b.getBondTypeFromCode=j(b,"getBondTypeFromCode",function(a){switch(a.charCodeAt(0)){case 46:return 0;case 45:return 1;case 61:return 2;case 35:return 3;case 36:return 4;case 58:return 17;case 47:return 1025;case 92:return 1041;case 94:return 65537;case 96:return 65538;case 64:return 65;case 126:return 81;case 43:return 96}return-1},"~S");j(b,"getAtom1",function(){return this.atom1});j(b,"set",function(a){this.order=a.order;this.isNot=a.isNot;this.primitives=a.primitives;this.nPrimitives=a.nPrimitives;
this.bondsOr=a.bondsOr;this.nBondsOr=a.nBondsOr;this.atropType=a.atropType},"JS.SmilesBond");j(b,"setAtropType",function(a){this.atropType=y(-1,[T(a/10)-1,a%10-1])},"~N");j(b,"setPrimitive",function(a){a=this.primitives[a];this.order=a.order;this.isNot=a.isNot;this.atropType=a.atropType;return a},"~N");j(b,"addBondOr",function(){null==this.bondsOr&&(this.bondsOr=Array(2));if(this.nBondsOr>=this.bondsOr.length){var a=Array(2*this.bondsOr.length);System.arraycopy(this.bondsOr,0,a,0,this.bondsOr.length);
this.bondsOr=a}a=new JS.SmilesBond(null,null,-1,!1);this.bondsOr[this.nBondsOr]=a;this.nBondsOr++;return a});j(b,"addPrimitive",function(){null==this.primitives&&(this.primitives=Array(2));if(this.nPrimitives>=this.primitives.length){var a=Array(2*this.primitives.length);System.arraycopy(this.primitives,0,a,0,this.primitives.length);this.primitives=a}a=new JS.SmilesBond(null,null,-1,!1);this.primitives[this.nPrimitives]=a;this.nPrimitives++;return a});p(b,"toString",function(){return this.atom1+" -"+
(this.isNot?"!":"")+this.order+"- "+this.atom2});j(b,"set2",function(a,c){this.order=a;this.isNot=c},"~N,~B");j(b,"set2a",function(a,c){null!=a&&(this.atom1=a,a.addBond(this));null!=c&&(this.atom2=c,c.isBioAtomWild&&this.atom1.isBioAtomWild&&(this.order=96),c.isFirst=!1,c.addBond(this))},"JS.SmilesAtom,JS.SmilesAtom");j(b,"setAtom2",function(a){this.atom2=a;null!=this.atom2&&(a.addBond(this),this.isConnection=!0)},"JS.SmilesAtom,JS.SmilesSearch");j(b,"isFromPreviousTo",function(a){return!this.isConnection&&
this.atom2===a},"JS.SmilesAtom");b.isBondType=j(b,"isBondType",function(a,c,b){if(">"==a)return 1;if(0>"-=#$:/\\.~^`+!,&;@".indexOf(a))return 0;if(!c&&0>"-=#$:/\\.~^`".indexOf(a))throw new JS.InvalidSmilesException("SMARTS bond type "+a+" not allowed in SMILES");switch(a.charCodeAt(0)){case 126:return b?0:1;case 94:case 96:return-1;default:return 1}},"~S,~B,~B");j(b,"getValence",function(){return this.order&7});j(b,"getOtherAtom",function(a){return this.atom1===a?this.atom2:this.atom1},"JS.SmilesAtom");
p(b,"getAtomIndex1",function(){return this.atom1.index});p(b,"getAtomIndex2",function(){return this.atom2.index});p(b,"getCovalentOrder",function(){return this.order&131071});p(b,"getOtherNode",function(a){return a===this.atom1?this.atom2:a===this.atom2||null==a?this.atom1:null},"JU.SimpleNode");p(b,"isCovalent",function(){return 112!=this.order});p(b,"isPartial",function(){return!1});p(b,"isHydrogen",function(){return 112==this.order});j(b,"switchAtoms",function(){var a=this.atom1;this.atom1=this.atom2;
this.atom2=a;switch(this.order&131071){case 65537:this.order=65538;break;case 65538:this.order=65537;break;case 1025:this.order=1041;break;case 1041:this.order=1025}});j(b,"getRealCovalentOrder",function(){switch(this.order&131071){case 65537:case 65538:case 1025:case 1041:return 1}return this.order&131071});j(b,"getMatchingBond",function(){return null==this.matchingBond?this:this.matchingBond});p(b,"getAtom",function(a){return 1==a?this.atom2:this.atom1},"~N")});G("JS");A(null,"JS.SmilesMeasure",
["JU.PT"],function(){var b=K(function(){this.search=null;this.index=this.type=this.nPoints=0;this.isNot=!1;this.points=this.minmax=this.indices=null;I(this,arguments)},JS,"SmilesMeasure",null);O(b,function(){this.indices=y(4,0);this.points=Array(4)});N(b,function(a,c,b,e,d){this.search=a;this.type=Math.min(4,Math.max(b,2));this.index=c;this.isNot=e;this.minmax=d;for(a=d.length-2;0<=a;a-=2)d[a]>d[a+1]&&(c=d[a+1],d[a+1]=d[a],d[a]=c)},"JS.SmilesSearch,~N,~N,~B,~A");j(b,"addPoint",function(a){if(this.nPoints==
this.type)return!1;if(0==this.nPoints)for(var c=1;c<this.type;c++)this.indices[c]=a+c;this.indices[this.nPoints++]=a;return!0},"~N");j(b,"check",function(){for(var a=0;a<this.type;a++){var c=this.search.patternAtoms[this.indices[a]].getMatchingAtomIndex();this.points[a]=this.search.target.nodes[c]}c=0;switch(this.type){case 2:c=this.points[0].distance(this.points[1]);break;case 3:this.search.v.vA.sub2(this.points[0],this.points[1]);this.search.v.vB.sub2(this.points[2],this.points[1]);c=this.search.v.vA.angle(this.search.v.vB)/
0.017453292;break;case 4:c=JS.SmilesMeasure.setTorsionData(this.points[0],this.points[1],this.points[2],this.points[3],this.search.v,!0)}for(a=this.minmax.length-2;0<=a;a-=2)if(c>=this.minmax[a]&&c<=this.minmax[a+1])return!this.isNot;return this.isNot});b.setTorsionData=j(b,"setTorsionData",function(a,c,b,e,d,f){d.vTemp1.sub2(a,c);d.vTemp2.sub2(e,b);if(!f)return 0;d.vNorm2.sub2(c,b);d.vNorm2.normalize();d.vTemp1.cross(d.vTemp1,d.vNorm2);d.vTemp1.normalize();d.vTemp2.cross(d.vTemp2,d.vNorm2);d.vTemp2.normalize();
d.vNorm3.cross(d.vTemp1,d.vTemp2);return d.vTemp1.angle(d.vTemp2)/0.017453292*(0>d.vNorm2.dot(d.vNorm3)?1:-1)},"JU.T3,JU.T3,JU.T3,JU.T3,JS.VTemp,~B");p(b,"toString",function(){for(var a="(."+"__dat".charAt(this.type)+this.index+":"+JU.PT.toJSON(null,this.minmax)+") for",c=0;c<this.type;c++)a+=" "+(c>=this.nPoints?"?":""+this.indices[c]);return a})});G("JS");A(["java.util.Hashtable"],"JS.SmilesParser","JU.Lst $.PT $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesSearch $.SmilesStereo JU.Elements $.Logger".split(" "),
function(){var b=K(function(){this.htMeasures=this.connections=null;this.flags=0;this.isBioSequence=this.isSmarts=!1;this.bioType="\x00";this.componentParenCount=this.componentCount=this.branchLevel=this.braceCount=0;this.ignoreStereochemistry=!1;this.bondDirectionPaired=!0;this.isTarget=!1;I(this,arguments)},JS,"SmilesParser",null);O(b,function(){this.connections=new java.util.Hashtable;this.htMeasures=new java.util.Hashtable});N(b,function(a,c){this.isSmarts=a;this.isTarget=c},"~B,~B");b.newSearch=
j(b,"newSearch",function(a,c,b){return(new JS.SmilesParser(c,b)).parse(a)},"~S,~B,~B");j(b,"parse",function(a){if(null==a)throw new JS.InvalidSmilesException("expression must not be null");var c=new JS.SmilesSearch;this.isSmarts&&!this.isTarget&&(c.pattern0=a);0<=a.indexOf("$(select")&&(a=this.parseNested(c,a,"select"));var b=y(1,0);a=JS.SmilesParser.extractFlags(a,b);this.flags=b[0];c.setFlags(this.flags);0<=a.indexOf("$")&&(a=this.parseVariables(a));this.isSmarts&&0<=a.indexOf("[$")&&(a=this.parseVariableLength(a));
if(0>a.indexOf("||"))return this.getSubsearch(c,a,this.flags);a=JU.PT.split(a,"||");b="";c.subSearches=Array(a.length);for(var e=0;e<a.length;e++){var d="|"+a[e]+"|";0>b.indexOf(d)&&(c.subSearches[e]=this.getSubsearch(c,a[e],this.flags),b+=d)}return c},"~S");j(b,"parseVariableLength",function(a){for(var c=new JU.SB,b=a.length-1,e=0,d=!1,f=0;f<b;f++)switch(a.charAt(f).charCodeAt(0)){case 40:e++;break;case 41:e--;break;case 124:0<e&&(d=!0,"|"==a.charAt(f+1)&&(a=a.substring(0,f)+a.substring(f+1),b--))}if(0<=
a.indexOf("||")){b=JU.PT.split(a,"||");for(f=0;f<b.length;f++)c.append("||").append(this.parseVariableLength(b[f]))}else{b=-1;e=y(1,0);for(f=null;0<=(b=a.indexOf("[$",b+1));){var g=b,j=-2147483648,k=-2147483648,b=JS.SmilesParser.getDigits(a,b+2,e),j=e[0];-2147483648!=j&&"-"==JS.SmilesParser.getChar(a,b)&&(b=JS.SmilesParser.getDigits(a,b+1,e),k=e[0]);if("("==JS.SmilesParser.getChar(a,b)&&(f=JS.SmilesParser.getSubPattern(a,g,"["),f.endsWith(")"))){var m=g+f.length+2,q=JS.SmilesParser.getSubPattern(a,
b,"("),n=b;JS.SmilesParser.getSubPattern(a,b,"[");b+=1+q.length;if(0<=q.indexOf(":")&&0>q.indexOf("|")){for(var t=0,r=q.length,p=-1,f=0;f<r;f++)switch(q.charAt(f).charCodeAt(0)){case 91:case 40:t++;break;case 41:case 93:t--;break;case 46:0<=p&&0==t&&(r=f);break;case 58:0>p&&0==t&&(p=f)}0<p&&(q=q.substring(0,p)+"("+q.substring(p,r)+")"+q.substring(r))}if(-2147483648==j){if(f=q.indexOf("|"),0<=f)return this.parseVariableLength(a.substring(0,g)+"[$1"+a.substring(n,n+f+1)+")]"+a.substring(m)+"||"+a.substring(0,
g)+"[$1("+a.substring(n+f+2)+a.substring(m))}else{-2147483648==k&&(k=j);0<=q.indexOf("|")&&(q="[$("+q+")]");for(f=j;f<=k;f++){j=new JU.SB;j.append("||").append(a.substring(0,g));for(n=0;n<f;n++)j.append(q);j.append(a.substring(m));c.appendSB(j)}}}}}return d?this.parseVariableLength(c.substring(2)):2>c.length()?a:c.substring(2)},"~S");j(b,"getSubsearch",function(a,c,b){this.htMeasures=new java.util.Hashtable;var e=new JS.SmilesSearch;e.setTop(a);e.isSmarts=this.isSmarts;e.pattern=c;e.pattern0=a.pattern0;
e.setFlags(b);0<=c.indexOf("$(")&&(c=this.parseNested(e,c,""));this.parseSmiles(e,c,null,!1);if(0!=this.braceCount)throw new JS.InvalidSmilesException("unmatched '{'");if(!this.connections.isEmpty())throw new JS.InvalidSmilesException("Open connection");e.set();if(this.isSmarts)for(a=e.ac;0<=--a;)this.checkNested(e,e.patternAtoms[a],b);else this.isBioSequence||(e.elementCounts[1]=e.getMissingHydrogenCount());!this.ignoreStereochemistry&&!this.isTarget&&this.fixChirality(e);return e},"JS.SmilesSearch,~S,~N");
j(b,"checkNested",function(a,c,b){if(0<c.iNested){var e=a.getNested(c.iNested);if("string"==typeof e){if(e.startsWith("select"))return;"~"!=e.charAt(0)&&"\x00"!=c.bioType&&(e="~"+c.bioType+"~"+e);e=this.getSubsearch(a,e,b);0<e.ac&&e.patternAtoms[0].selected&&(c.selected=!0);a.setNested(c.iNested,e)}}for(e=0;e<c.nSubAtoms;e++)this.checkNested(a,c.subAtoms[e],b)},"JS.SmilesSearch,JS.SmilesAtom,~N");j(b,"fixChirality",function(a){for(var c=a.ac;0<=--c;){var b=a.patternAtoms[c];null!=b.stereo&&b.stereo.fixStereo(b)}},
"JS.SmilesSearch");j(b,"parseSmiles",function(a,c,b,e){var d=y(1,0),f=0,g,j=null,k=!1;a:for(;null!=c&&0!=c.length;){var m=0;null==b&&(m=this.checkBioType(c,0),m==c.length&&(c+="*"),this.isBioSequence&&(a.needAromatic=a.top.needAromatic=!1));g=JS.SmilesParser.getChar(c,m);var q=this.checkBrace(a,g,"{");q&&(g=JS.SmilesParser.getChar(c,++m));if("("==g)if(j=JS.SmilesParser.getSubPattern(c,m,"("),g="."==JS.SmilesParser.getChar(c,m+1),null==b){if(g||!this.isSmarts)throw new JS.InvalidSmilesException("No previous atom for measure");
a.haveComponents=!0;do this.componentCount++,this.componentParenCount++,g=JS.SmilesParser.getChar(c=c.substring(1),0);while("("==g);if(!q&&!0==(q=this.checkBrace(a,g,"{")))g=JS.SmilesParser.getChar(c=c.substring(1),0)}else k=!1,j.startsWith(".")?(this.parseMeasure(a,j.substring(1),b),k=!0):0==j.length&&this.isBioSequence?b.notCrossLinked=!0:(this.branchLevel++,this.parseSmiles(a,j,b,!0),this.branchLevel--),m=j.length+2,g=JS.SmilesParser.getChar(c,m),"}"==g&&this.checkBrace(a,g,"}")&&m++,g="\x00";
if("\x00"!=g){f=m;b:for(;"\x00"!=g;){switch(JS.SmilesBond.isBondType(g,this.isSmarts,this.isBioSequence)){case 0:break b;case -1:if(!((JU.PT.isDigit(JS.SmilesParser.getChar(c,++m))&&0<m++?JU.PT.isDigit(JS.SmilesParser.getChar(c,m++)):1)&&"-"==(g=JS.SmilesParser.getChar(c,m))))throw new JS.InvalidSmilesException("malformed atropisomerism bond ^nn-  or ^^nn-");continue}g=JS.SmilesParser.getChar(c,++m)}g=JS.SmilesParser.getChar(c,m);if(")"==g){switch(JS.SmilesParser.getChar(c,++m).charCodeAt(0)){case 0:case 41:case 46:if(c=
c.substring(m),this.componentParenCount--,0<=this.componentParenCount)continue a}throw new JS.InvalidSmilesException("invalid continuation after component grouping (SMARTS).(SMARTS)");}j=this.parseBond(a,null,c.substring(f,m),null,b,!1,e,m-f,d);q&&-1!=j.order&&(g=JS.SmilesParser.getChar(c,m=f));this.checkBrace(a,g,"{")&&(g=JS.SmilesParser.getChar(c,++m));switch(g.charCodeAt(0)){case 126:0==j.order&&(m=this.checkBioType(c,m),m==c.length&&(c+="*"));break;case 40:do this.componentCount++,this.componentParenCount++,
g=JS.SmilesParser.getChar(c,++m);while("("==g);break;case 0:if(0==j.order)return}q=JU.PT.isDigit(g)||"%"==g;f=!q&&("_"==g||"["==g||"*"==g||JU.PT.isLetter(g));if(q){if(k)throw new JS.InvalidSmilesException("connection number must immediately follow its connecting atom");m=JS.SmilesParser.getRingNumber(c,m,g,d);this.parseConnection(a,d[0],b,j)}else if(f)switch(k=!1,g.charCodeAt(0)){case 91:case 95:q=JS.SmilesParser.getSubPattern(c,m,g);m+=q.length+("["==g?2:0);this.isBioSequence&&("["==g&&0>q.indexOf(".")&&
0>q.indexOf("_"))&&(q+=".0");b=this.parseAtom(a,null,q,b,j,"["==g,!1,e);b.hasSubpattern=!0;-1!=j.order&&0!=j.order&&this.setBondAtom(j,null,b,a);break;default:q=!this.isBioSequence&&JU.PT.isUpperCase(g)?JS.SmilesParser.getChar(c,m+1):"\x00";if("X"!=g||"x"!=q)if(!JU.PT.isLowerCase(q)||0==JU.Elements.elementNumberFromSymbol(c.substring(m,m+2),!0))q="\x00";"\x00"!=q&&0<="NA CA BA PA SC AC Na Ca Ba Pa Sc Ac".indexOf(c.substring(m,m+2))&&(q="\x00");g=JU.PT.isUpperCase(g)&&JU.PT.isLowerCase(q)?2:1;b=this.parseAtom(a,
null,c.substring(m,m+g),b,j,!1,!1,e);m+=g}else throw new JS.InvalidSmilesException("Unexpected character: "+JS.SmilesParser.getChar(c,m));g=JS.SmilesParser.getChar(c,m);"}"==g&&this.checkBrace(a,g,"}")&&m++}c=c.substring(m);e=!1}},"JS.SmilesSearch,~S,JS.SmilesAtom,~B");j(b,"parseConnection",function(a,b,h,e){b=Integer.$valueOf(b);var d=this.connections.get(b);if(null==d)this.connections.put(b,e),a.target.ringCount++;else{this.connections.remove(b);switch(e.order){case -1:e.order=-1!=d.order?d.order:
this.isSmarts||h.isAromatic&&d.atom1.isAromatic?81:1;break;case 1025:e.order=1041;break;case 1041:e.order=1025}if(-1!=d.order&&d.order!=e.order||h===d.atom1||null!=d.atom1.getBondTo(h))throw new JS.InvalidSmilesException("Bad connection type or atom");d.set(e);h.bondCount--;d.setAtom2(h,a)}},"JS.SmilesSearch,~N,JS.SmilesAtom,JS.SmilesBond");j(b,"setBondAtom",function(a,b,h,e){a.set2a(b,h);null!=e&&(2==a.order&&null!=a.atom1&&null!=a.atom2&&a.atom1.isAromatic&&a.atom2.isAromatic&&0==(this.flags&512))&&
e.setFlags(this.flags|=512)},"JS.SmilesBond,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesSearch");b.getRingNumber=j(b,"getRingNumber",function(a,b,h,e){switch(h.charCodeAt(0)){case 37:if("("==JS.SmilesParser.getChar(a,b+1)){if(a=JS.SmilesParser.getSubPattern(a,b+1,"("),JS.SmilesParser.getDigits(a,0,e),b+=a.length+3,0>e[0])throw new JS.InvalidSmilesException("Invalid number designation: "+a);}else if(b+3<=a.length&&(b=JS.SmilesParser.getDigits(a.substring(0,b+3),b+1,e)),10>e[0])throw new JS.InvalidSmilesException("Two digits must follow the % sign");
a=e[0];break;default:a=h.charCodeAt(0)-48,b++}e[0]=a;return b},"~S,~N,~S,~A");j(b,"checkBioType",function(a,b){if(this.isBioSequence="~"==a.charAt(b)){b++;this.bioType="*";var h=JS.SmilesParser.getChar(a,2);if("~"==h&&("*"==(h=a.charAt(1))||JU.PT.isLowerCase(h)))this.bioType=h,b=3}return b},"~S,~N");j(b,"parseMeasure",function(a,b,h){for(var e=b.indexOf(":"),d=0>e?b:b.substring(0,e);0!=e;){var f=d.length;1==f&&(d+="0");var g=this.htMeasures.get(d);if(null==g==0>e||0==f)break;try{if(0<e){var j="__dat".indexOf(d.charAt(0));
if(2>j)break;var k=y(1,0);JS.SmilesParser.getDigits(d,1,k);var m=k[0];b=b.substring(e+1);var q=b.startsWith("!");q&&(b=b.substring(1));var n=b.startsWith("-");n&&(b=b.substring(1));b=JU.PT.rep(b,"-",",");b=JU.PT.rep(b,",,",",-");n&&(b="-"+b);var p=JU.PT.split(b,",");if(1==p.length%2||q&&2!=p.length)break;for(var r=R(p.length,0),u=p.length;0<=--u&&!Float.isNaN(r[u]=Float.parseFloat(p[u])););if(0<=u)break;g=new JS.SmilesMeasure(a,m,j,q,r);a.measures.addLast(g);0<m?this.htMeasures.put(d,g):0==m&&JU.Logger.debugging&&
JU.Logger.debug("measure created: "+g)}else{if(!g.addPoint(h.index))break;g.nPoints==g.type&&(this.htMeasures.remove(d),JU.Logger.debugging&&JU.Logger.debug("measure created: "+g));return}if(!g.addPoint(h.index))break}catch(s){if(H(s,"NumberFormatException"))break;else throw s;}return}throw new JS.InvalidSmilesException("invalid measure: "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom");j(b,"checkBrace",function(a,b,h){switch(b.charCodeAt(0)){case 123:if(b!=h)break;this.braceCount++;return a.top.haveSelected=
!0;case 125:if(b!=h)break;if(0<this.braceCount)return this.braceCount--,!0;break;default:return!1}throw new JS.InvalidSmilesException("Unmatched '}'");},"JS.SmilesSearch,~S,~S");j(b,"parseNested",function(a,b,h){var e;for(h="$("+h;0<=(e=b.lastIndexOf(h));){var d=JS.SmilesParser.getSubPattern(b,e+1,"("),f=e+d.length+3,g=b.substring(f);b=b.substring(0,e);var j="";if(b.endsWith("]"))throw new JS.InvalidSmilesException("$(...) must be enclosed in brackets: "+b+"$("+d+")");if(1<e&&2==h.length&&1<(f=b.length)&&
0>",;&![".indexOf(b.substring(f-1)))j="&";1<g.length&&0>",;&!)]".indexOf(g.charAt(0))&&(g="&"+g);b=b+j+"_"+a.top.addNested(d)+"_"+g}return b},"JS.SmilesSearch,~S,~S");j(b,"parseVariables",function(a){var b=new JU.Lst,h=new JU.Lst,e,d=0,f=-1;for(JU.Logger.debugging&&JU.Logger.info(a);0<=(e=a.indexOf("$",d))&&"("!=JS.SmilesParser.getChar(a,e+1);){d=JS.SmilesParser.skipTo(a,e,"=");if(d<=e+1||'"'!=JS.SmilesParser.getChar(a,d+1))break;e=a.substring(e,d);if(0<e.lastIndexOf("$")||0<e.indexOf("]"))throw new JS.InvalidSmilesException("Invalid variable name: "+
e);f=JS.SmilesParser.getSubPattern(a,d+1,'"');b.addLast("["+e+"]");h.addLast(f);d+=f.length+2;d=JS.SmilesParser.skipTo(a,d,";");f=++d}if(0>f)return a;a=a.substring(f);for(d=b.size();0<=--d;)e=b.get(d),f=h.get(d),f.equals(e)||(a=JU.PT.rep(a,e,f));JU.Logger.debugging&&JU.Logger.info(a);return a},"~S");j(b,"parseAtom",function(a,b,h,e,d,f,g,j){if(null==h||0==h.length)throw new JS.InvalidSmilesException("Empty atom definition");var k=new JS.SmilesAtom;0<this.componentParenCount&&(k.component=this.componentCount);
null==b&&a.appendAtom(k);if(!this.checkLogic(a,h,k,null,e,g,j,null)){var m=y(1,0);this.isBioSequence&&1==h.length&&(h+=".0");var q=h.charAt(0),n=0,p=!1;if(this.isSmarts&&"!"==q){q=JS.SmilesParser.getChar(h,++n);if("\x00"==q)throw new JS.InvalidSmilesException("invalid '!'");k.not=p=!0}var r=0<=h.indexOf("@PH")?-1:h.indexOf(".");if(0<=r){k.isBioResidue=!0;var u=h.substring(n,r);h=h.substring(r+1).toUpperCase();var s=u.length;if(0<=(r=u.indexOf("^")))r==s-2&&(q=u.charAt(s-1),"*"!=q&&(k.insCode=q)),
u=u.substring(0,r);if(0<=(r=u.indexOf("#")))JS.SmilesParser.getDigits(u,r+1,m),k.residueNumber=m[0],u=u.substring(0,r);0==u.length&&(u="*");1<u.length?k.residueName=u.toUpperCase():u.equals("*")||(k.residueChar=u);u=h;if(0<=(r=u.indexOf("#")))JS.SmilesParser.getDigits(u,r+1,m),k.elementNumber=m[0],u=u.substring(0,r);0==u.length?u="*":u.equals("0")&&(u="\x00");u.equals("*")?k.isBioAtomWild=!0:k.setAtomName(u);q="\x00"}k.setBioAtom(this.bioType);for(r=-2147483648;"\x00"!=q;){k.setAtomName(this.isBioSequence?
"\x00":"");if(JU.PT.isDigit(q)){n=JS.SmilesParser.getDigits(h,n,m);q=m[0];if(-2147483648==q)throw new JS.InvalidSmilesException("Non numeric atomic mass");"?"==JS.SmilesParser.getChar(h,n)&&(n++,q=-q);if(k.elementDefined)throw new JS.InvalidSmilesException('atom mass must precede atom symbol or be separated from it with ";"');k.setAtomicMass(q)}else switch(q.charCodeAt(0)){case 34:q=JU.PT.getQuotedStringAt(h,n);n+=q.length+2;k.atomType=q;break;case 95:n=JS.SmilesParser.getDigits(h,n+1,m)+1;if(-2147483648==
m[0])throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+h.substring(n));k.iNested=m[0];if(!f)throw new JS.InvalidSmilesException("nesting must appear in [...]: $("+a.getNested(m[0])+")");if(this.isBioSequence&&n!=h.length)throw new JS.InvalidSmilesException("invalid characters: "+h.substring(n));break;case 61:n=JS.SmilesParser.getDigits(h,n+1,m);k.jmolIndex=m[0];break;case 35:q="-"==h.charAt(n+1);n=JS.SmilesParser.getDigits(h,n+(q?2:1),m);q?k.atomNumber=m[0]:k.elementNumber=m[0];break;
case 45:case 43:n=this.checkCharge(h,n,k);break;case 64:null==a.stereo&&(a.stereo=JS.SmilesStereo.newStereo(a));n=JS.SmilesStereo.checkChirality(a,h,n,a.patternAtoms[k.index]);break;case 58:n=JS.SmilesParser.getDigits(h,++n,m);if(-2147483648==m[0])throw new JS.InvalidSmilesException("Invalid atom class");k.atomClass=m[0];break;default:var u=JS.SmilesParser.getChar(h,n+1),s=n+(JU.PT.isLowerCase(u)&&(!f||!JU.PT.isDigit(JS.SmilesParser.getChar(h,n+2)))?2:1),A=h.substring(n+1,s),x=Character.toUpperCase(q)+
A,v=!0;f&&JU.PT.isLetter(q)&&(!p&&(g?b:k).hasSymbol?v=!1:"H"==q?v=1==h.length||!JU.PT.isDigit(u):JU.PT.isDigit(u)?v=!1:!x.equals("A")&&!x.equals("Xx")&&(v=("h"==q?2==s:!0)&&0<JU.Elements.elementNumberFromSymbol(x,!0),!v&&2==s&&(A="",x=x.substring(0,1),v=0<JU.Elements.elementNumberFromSymbol(x,!0))));if(v){if(!f&&!this.isSmarts&&!this.isBioSequence&&!JS.SmilesAtom.allowSmilesUnbracketed(x)||!k.setSymbol(x=q+A))throw new JS.InvalidSmilesException("Invalid atom symbol: "+x);g&&(b.hasSymbol=!0);n+=x.length}else switch(n=
JS.SmilesParser.getDigits(h,n+1,m),s=m[0],q.charCodeAt(0)){default:throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+h.substring(n));case 68:k.setDegree(-2147483648==s?1:s);break;case 100:k.setNonhydrogenDegree(-2147483648==s?1:s);break;case 72:r=-2147483648==s?1:s;break;case 104:k.setImplicitHydrogenCount(-2147483648==s?-1:s);break;case 82:-2147483648==s&&(s=-1);k.setRingMembership(s);a.top.needRingData=!0;break;case 114:if(-2147483648==s)s=-1,k.setRingMembership(s);else{k.setRingSize(s);
switch(s){case 500:s=5;break;case 600:s=6}s>a.ringDataMax&&(a.ringDataMax=s)}a.top.needRingData=!0;break;case 118:k.setValence(-2147483648==s?1:s);break;case 88:k.setConnectivity(-2147483648==s?1:s);break;case 120:k.setRingConnectivity(-2147483648==s?-1:s),a.top.needRingData=!0}}q=JS.SmilesParser.getChar(h,n);if(p&&"\x00"!=q)throw new JS.InvalidSmilesException("'!' may only involve one primitive.");}-2147483648==r&&f&&(r=-2147483647);k.setExplicitHydrogenCount(r);a.patternAtoms[k.index].setExplicitHydrogenCount(r)}0<
this.braceCount&&(k.selected=!0);null!=b&&b.addSubAtom(k,g);null!=e&&0==d.order&&(k.notBondedIndex=e.index);null!=e&&0!=d.order&&(-1==d.order&&(d.order=this.isBioSequence&&j?112:this.isSmarts||e.isAromatic&&k.isAromatic?81:1),f||this.setBondAtom(d,null,k,a),0==this.branchLevel&&(17==d.getBondType()||112==d.order)&&this.branchLevel++);0==this.branchLevel&&(a.lastChainAtom=k);return k},"JS.SmilesSearch,JS.SmilesAtom,~S,JS.SmilesAtom,JS.SmilesBond,~B,~B,~B");j(b,"checkCharge",function(a,b,h){var e=a.length,
d=a.charAt(b),f=1;++b;if(b<e){var g=a.charAt(b);if(JU.PT.isDigit(g)){if(e=y(1,0),b=JS.SmilesParser.getDigits(a,b,e),f=e[0],-2147483648==f)throw new JS.InvalidSmilesException("Non numeric charge");}else for(;b<e&&a.charAt(b)==d;)b++,f++}h.setCharge("+"==d?f:-f);return b},"~S,~N,JS.SmilesAtom");j(b,"parseBond",function(a,b,h,e,d,f,g,j,k){var m;if(0<j)switch((m=h.charAt(0)).charCodeAt(0)){case 62:if(!h.equals(">>")){j=-1;break}case 46:if(null==e&&null==b)return this.isBioSequence="~"==JS.SmilesParser.getChar(h,
1),new JS.SmilesBond(null,null,0,!1);j=-1;break;case 43:null!=b&&(j=-1)}else m="\x00";e=null==b?null==e?new JS.SmilesBond(d,null,this.isBioSequence&&null!=d?g?112:96:-1,!1):e:f?b.addPrimitive():b.addBondOr();if(0<j&&!this.checkLogic(a,h,null,e,d,f,!1,k)){if(f="!"==m)if(m=JS.SmilesParser.getChar(h,1),"\x00"==m||"!"==m)throw new JS.InvalidSmilesException("invalid '!'");g=JS.SmilesBond.getBondTypeFromCode(m);65==g&&(a.top.needRingMemberships=!0);if(null==d&&0!=g)throw new JS.InvalidSmilesException("Bond without a previous atom");
switch(g){case 65537:case 65538:(j=h.length)<(f?3:2)||"-"!=h.charAt(j-1)?j=0:j==(f?3:2)?e.setAtropType(22):(JS.SmilesParser.getDigits(h,f?2:1,k),e.setAtropType(k[0]));a.haveBondStereochemistry=!0;break;case 1025:case 1041:this.bondDirectionPaired=!this.bondDirectionPaired;a.haveBondStereochemistry=!0;break;case 2:a.top.nDouble++;case 1:d.isAromatic&&(a.top.needRingData=!0)}e.set2(g,f);this.isBioSequence&&null!=b&&b.set2(g,f)}if(-1==j)throw new JS.InvalidSmilesException("invalid bond:"+m);return e},
"JS.SmilesSearch,JS.SmilesBond,~S,JS.SmilesBond,JS.SmilesAtom,~B,~B,~N,~A");j(b,"checkLogic",function(a,b,h,e,d,f,g,j){var k=b.lastIndexOf("!");null!=h&&(h.pattern=b);for(;0<k;)0>",;&!(".indexOf(b.charAt(k-1))&&(b=b.substring(0,k)+"&"+b.substring(k)),k=b.lastIndexOf("!",k-1);var k=b.indexOf(","),m=b.length,q="&";a:for(;;){var n=0<k;if(n&&!this.isSmarts||0==k)break;k=b.indexOf(";");if(0<=k){if(!this.isSmarts||0==k)break;n?(q=";",n=!1):b=b.$replace(";","&")}var p=0;if(n)for(b+=",";0<(k=b.indexOf(",",
p))&&k<=m;){p=b.substring(p,k);if(0==p.length)throw new JS.InvalidSmilesException("missing "+(null==e?"atom":"bond")+" token");null==e?this.parseAtom(a,h,p,null,null,!0,!1,g):this.parseBond(a,e,p,null,d,!1,!1,p.length,j);p=k+1}else if(0<=(k=b.indexOf(q))||null!=e&&1<m&&!f){if(0==k||null==e&&!this.isSmarts)break;if(null!=e&&0>k&&1<m){f=new JU.SB;for(n=0;n<m;){var r=b.charAt(n++);f.appendC(r);switch(r.charCodeAt(0)){case 33:if(!this.isSmarts)break a;continue;case 94:case 96:for(;"-"!=(r=b.charAt(n++))&&
"\x00"!=r;)f.appendC(r);f.appendC("-")}if(n<m){if(!this.isSmarts)break a;f.append(q)}}b=f.toString();m=b.length}for(b+=q;0<(k=b.indexOf(q,p))&&k<=m;)p=b.substring(p,k),null==e?this.parseAtom(a,h,p,null,null,!0,!0,g):this.parseBond(a,this.isSmarts?e:null,p,this.isSmarts?null:e,d,!0,!1,p.length,j),p=k+1}else return!1;return!0}r=b.charAt(k);throw new JS.InvalidSmilesException((this.isSmarts?"invalid placement for '"+r+"'":"["+r+"] notation only valid with SMARTS, not SMILES,")+" in "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom,JS.SmilesBond,JS.SmilesAtom,~B,~B,~A");
b.getSubPattern=j(b,"getSubPattern",function(a,b,h){var e,d=1;switch(h.charCodeAt(0)){case 91:e="]";break;case 34:case 37:case 47:e=h;break;case 40:e=")";break;default:e=h,d=0}for(var f=a.length,g=1,j=b+1;j<f;j++){var k=a.charAt(j);if(k==e){if(g--,0==g)return a.substring(b+d,j+1-d)}else k==h&&g++}throw new JS.InvalidSmilesException("Unmatched "+h);},"~S,~N,~S");b.getChar=j(b,"getChar",function(a,b){return b<a.length?a.charAt(b):"\x00"},"~S,~N");b.getDigits=j(b,"getDigits",function(a,b,h){for(var e=
b,d=a.length;e<d&&JU.PT.isDigit(a.charAt(e));)e++;if(e>b)try{return h[0]=Integer.parseInt(a.substring(b,e)),e}catch(f){if(!H(f,"NumberFormatException"))throw f;}h[0]=-2147483648;return e},"~S,~N,~A");b.skipTo=j(b,"skipTo",function(a,b,h){for(var e;(e=JS.SmilesParser.getChar(a,++b))!=h&&"\x00"!=e;);return"\x00"==e?-1:b},"~S,~N,~S");b.cleanPattern=j(b,"cleanPattern",function(a){a=JU.PT.replaceAllCharacters(a," \t\n\r","");a=JU.PT.rep(a,"^^","`");for(var b=0,h=0;0<=(b=a.indexOf("//*"))&&(h=a.indexOf("*//"))>=
b;)a=a.substring(0,b)+a.substring(h+3);return a=JU.PT.rep(a,"//","")},"~S");b.extractFlags=j(b,"extractFlags",function(a,b){a=JS.SmilesParser.cleanPattern(a);for(var h=0;a.startsWith("/");){var e=JS.SmilesParser.getSubPattern(a,0,"/").toUpperCase();a=a.substring(e.length+2);h=JS.SmilesSearch.addFlags(h,e)}b[0]=h;return a},"~S,~A");b.getFlags=j(b,"getFlags",function(a){var b=y(1,0);JS.SmilesParser.extractFlags(a,b);return b[0]},"~S")});G("JS");A(null,"JS.SmilesExt","JU.AU $.BS $.Lst $.M4 $.Measure $.P3 J.api.Interface JU.Logger".split(" "),
function(){var b=K(function(){this.e=null;I(this,arguments)},JS,"SmilesExt",null);j(b,"init",function(a){this.e=a;return this},"~O");j(b,"getSmilesCorrelation",function(a,b,h,e,d,f,g,j,k,m,q,n){var p=null==k?0.1:3.4028235E38;try{null==e&&(e=new JU.Lst,d=new JU.Lst);var r=new JU.M4,u=new JU.P3,s=this.e.vwr.ms.at,y=this.e.vwr.ms.ac,x=this.e.vwr.getSmilesMatcher(),v=x.getCorrelationMaps(h,s,y,a,n|8);null==v&&this.e.evalError(x.getLastException(),null);if(0==v.length)return NaN;var A=v[0];for(a=0;a<A.length;a++)e.addLast(s[A[a]]);
v=x.getCorrelationMaps(h,s,y,b,n);null==v&&this.e.evalError(x.getLastException(),null);if(0==v.length)return NaN;JU.Logger.info(v.length+" mappings found");if(q||!j){b=3.4028235E38;h=null;for(a=0;a<v.length;a++){d.clear();for(var w=0;w<v[a].length;w++)d.addLast(s[v[a][w]]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");var B=1==d.size()?0:JU.Measure.getTransformMatrix4(e,d,r,null);JU.Logger.info("getSmilesCorrelation stddev="+B);if(null!=g&&B<p){for(var z=new JU.BS,w=0;w<v[a].length;w++)z.set(v[a][w]);
g.addLast(z)}B<b&&(h=v[a],null!=f&&f.setM4(r),null!=m&&m.setT(u),b=B)}null!=k&&(k[0]=A,k[1]=h);d.clear();for(a=0;a<h.length;a++)d.addLast(s[h[a]]);return b}for(a=0;a<v.length;a++)for(w=0;w<v[a].length;w++)d.addLast(s[v[a][w]])}catch(D){if(H(D,Exception))this.e.evalError(D.getMessage(),null);else throw D;}return 0},"JU.BS,JU.BS,~S,JU.Lst,JU.Lst,JU.M4,JU.Lst,~B,~A,JU.P3,~B,~N");j(b,"getSmilesMatches",function(a,b,h,e,d,f,g){if(0==a.length||a.endsWith("///")||a.equals("H")||a.equals("H2")||a.equals("top")||
a.equalsIgnoreCase("NOAROMATIC"))try{return this.e.vwr.getSmilesOpt(h,0,0,d|(a.equals("H2")?8192:0)|(a.equals("H")?4096:0)|(a.equals("top")?16384:0)|(a.equalsIgnoreCase("NOAROMATIC")?16:0),a.endsWith("///")?a:null)}catch(j){if(H(j,Exception))this.e.evalError(j.getMessage(),null);else throw j;}var k;if(null==e)try{if(null==b)k=this.e.vwr.getSubstructureSetArray(a,h,d);else{if(a.equals("chirality"))return this.e.vwr.calculateChiralityForSmiles(b);k=2==(d&2);d=(k?2:1)|(g?8:0)|(16384==(d&16384)?16384:
0);if("string"!=typeof b)return this.e.vwr.getSmilesMatcher().hasStructure(a,b,d);var m=this.e.vwr.getSmilesMatcher().find(a,b,d);if(!f)return!g?m:0==m.length?y(0,0):m[0];var p=new JU.BS;for(f=0;f<m.length;f++)for(var n=m[f],t=n.length;0<=--t;)0<=n[t]&&p.set(n[t]);if(!k)return y(p.cardinality(),0);var r=y(p.cardinality(),0);f=0;for(var u=p.nextSetBit(0);0<=u;u=p.nextSetBit(u+1))r[f++]=u;return r}}catch(s){if(H(s,Exception))return this.e.evalError(s.getMessage(),null),null;throw s;}else{p=new JU.Lst;
r=this.getSmilesCorrelation(e,h,a,null,null,null,p,!1,null,null,!1,d);if(Float.isNaN(r))return f?new JU.BS:P(-1,[]);this.e.showString("RMSD "+r+" Angstroms");k=p.toArray(Array(p.size()))}if(f){p=new JU.BS;for(f=0;f<k.length;f++)p.or(k[f]);return p}p=new JU.Lst;for(f=0;f<k.length;f++)p.addLast(k[f]);return p},"~S,~O,JU.BS,JU.BS,~N,~B,~B");j(b,"getFlexFitList",function(a,b,h,e){var d=JU.AU.newInt2(2);this.getSmilesCorrelation(a,b,h,null,null,null,null,!1,d,null,!1,e?2:1);if(null==d[0])return null;a=
this.e.vwr.ms.getDihedralMap(d[0]);b=null==a?null:this.e.vwr.ms.getDihedralMap(d[1]);if(null==b||b.length!=a.length)return null;d=R(a.length,3,0);h=this.e.vwr.ms.at;JS.SmilesExt.getTorsions(h,b,d,0);JS.SmilesExt.getTorsions(h,a,d,1);b=R(6*a.length,0);for(e=h=0;h<a.length;h++){var f=a[h];b[e++]=f[0];b[e++]=f[1];b[e++]=f[2];b[e++]=f[3];b[e++]=d[h][0];b[e++]=d[h][1]}return b},"JU.BS,JU.BS,~S,~B");b.getTorsions=j(b,"getTorsions",function(a,b,h,e){for(var d=b.length;0<=--d;){var f=b[d],f=JU.Measure.computeTorsion(a[f[0]],
a[f[1]],a[f[2]],a[f[3]],!0);1==e&&(180<f-h[d][0]?f-=360:-180>=f-h[d][0]&&(f+=360));h[d][e]=f}},"~A,~A,~A,~N");j(b,"mapPolyhedra",function(a,b,h,e){var d=new JU.Lst,f=new JU.Lst,g;g=P(-1,[Integer.$valueOf(a),null]);this.e.getShapePropertyData(21,"syminfo",g);a=g[1];g[0]=Integer.$valueOf(b);g[1]=null;this.e.getShapePropertyData(21,"syminfo",g);b=g[1];if(null==a||null==b)return NaN;g=a.get("polySmiles");var j=b.get("polySmiles");h=this.getSmilesMatches(j,g,null,null,h?1:16385,!1,!0);if(0==h.length)return NaN;
d.addLast(a.get("center"));a=a.get("vertices");g=0;for(j=a.length;g<j;g++)d.addLast(a[h[g+1]-1]);f.addLast(b.get("center"));a=b.get("vertices");g=0;for(j=a.length;g<j;g++)f.addLast(a[g]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");return JU.Measure.getTransformMatrix4(d,f,e,null)},"~N,~N,~B,JU.M4")})})(Clazz,Clazz.getClassName,Clazz.newLongArray,Clazz.doubleToByte,Clazz.doubleToInt,Clazz.doubleToLong,Clazz.declarePackage,Clazz.instanceOf,Clazz.load,Clazz.instantialize,Clazz.decorateAsClass,
Clazz.floatToInt,Clazz.floatToLong,Clazz.makeConstructor,Clazz.defineEnumConstant,Clazz.exceptionOf,Clazz.newIntArray,Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,Clazz.newByteArray,Clazz.declareInterface,Clazz.newShortArray,Clazz.innerTypeInstance,Clazz.isClassDefined,Clazz.prepareCallback,Clazz.newArray,Clazz.castNullAs,Clazz.floatToShort,Clazz.superCall,Clazz.decorateAsType,Clazz.newBooleanArray,Clazz.newCharArray,Clazz.implementOf,Clazz.newDoubleArray,Clazz.overrideConstructor,
Clazz.clone,Clazz.doubleToShort,Clazz.getInheritedLevel,Clazz.getParamsType,Clazz.isAF,Clazz.isAB,Clazz.isAI,Clazz.isAS,Clazz.isASS,Clazz.isAP,Clazz.isAFloat,Clazz.isAII,Clazz.isAFF,Clazz.isAFFF,Clazz.tryToSearchAndExecute,Clazz.getStackTrace,Clazz.inheritArgs,Clazz.alert,Clazz.defineMethod,Clazz.overrideMethod,Clazz.declareAnonymous,Clazz.cloneFinals);
