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