Clazz.declarePackage("J.api");Clazz.declareInterface(J.api,"SmilesMatcherInterface");Clazz.declarePackage("J.smiles");
Clazz.load(["J.api.SmilesMatcherInterface"],"J.smiles.SmilesMatcher","JU.ArrayUtil $.BS J.smiles.InvalidSmilesException $.SmilesGenerator $.SmilesParser J.util.BSUtil $.Txt".split(" "),function(){c$=Clazz.declareType(J.smiles,"SmilesMatcher",null,J.api.SmilesMatcherInterface);Clazz.overrideMethod(c$,"getLastException",function(){return J.smiles.InvalidSmilesException.getLastError()});Clazz.overrideMethod(c$,"getMolecularFormula",function(a,b){J.smiles.InvalidSmilesException.setLastError(null);try{var c=
J.smiles.SmilesParser.getMolecule(a,b);c.createTopoMap(null);c.nodes=c.jmolAtoms;return c.getMolecularFormula(!b)}catch(d){if(Clazz.exceptionOf(d,J.smiles.InvalidSmilesException))return null==J.smiles.InvalidSmilesException.getLastError()&&J.smiles.InvalidSmilesException.setLastError(d.toString()),null;throw d;}},"~S,~B");Clazz.overrideMethod(c$,"getSmiles",function(a,b,c,d,e,f,h){J.smiles.InvalidSmilesException.setLastError(null);try{return d?(new J.smiles.SmilesGenerator).getBioSmiles(a,b,c,e,f,
h):(new J.smiles.SmilesGenerator).getSmiles(a,b,c)}catch(j){if(Clazz.exceptionOf(j,J.smiles.InvalidSmilesException))return null==J.smiles.InvalidSmilesException.getLastError()&&J.smiles.InvalidSmilesException.setLastError(j.toString()),null;throw j;}},"~A,~N,JU.BS,~B,~B,~B,~S");$_M(c$,"areEqual",function(a,b){var c=this.find(a,b,!1,!1);return null==c?-1:c.length},"~S,~S");$_M(c$,"areEqual",function(a,b){var c=this.find(a,b,!1,!0,!0);return null!=c&&1==c.length},"~S,J.smiles.SmilesSearch");$_M(c$,
"find",function(a,b,c,d){J.smiles.InvalidSmilesException.setLastError(null);try{var e=J.smiles.SmilesParser.getMolecule(b,!1);return this.find(a,e,c,!c,d)}catch(f){if(Clazz.exceptionOf(f,Exception))return null==J.smiles.InvalidSmilesException.getLastError()&&J.smiles.InvalidSmilesException.setLastError(f.toString()),System.out.println(f.toString()),null;throw f;}},"~S,~S,~B,~B");Clazz.overrideMethod(c$,"getRelationship",function(a,b){if(null==a||null==b||0==a.length||0==b.length)return"";var c=this.getMolecularFormula(a,
!1),d=this.getMolecularFormula(b,!1);if(!c.equals(d))return"none";var e,c=this.countStereo(a),d=this.countStereo(b);e=c==d&&0<this.areEqual(b,a);if(!e){e=a+b;if(0<=e.indexOf("/")||0<=e.indexOf("\\")||0<=e.indexOf("@")){if(c==d&&0<c&&(a=this.reverseChirality(a),e=0<this.areEqual(a,b)))return"enantiomers";if(e=0<this.areEqual("/nostereo/"+b,a))return c==d?"diastereomers":"ambiguous stereochemistry!"}return"constitutional isomers"}return"identical"},"~S,~S");Clazz.overrideMethod(c$,"reverseChirality",
function(a){a=J.util.Txt.simpleReplace(a,"@@","!@");a=J.util.Txt.simpleReplace(a,"@","@@");a=J.util.Txt.simpleReplace(a,"!@@","@");a=J.util.Txt.simpleReplace(a,"@@SP","@SP");a=J.util.Txt.simpleReplace(a,"@@OH","@OH");return a=J.util.Txt.simpleReplace(a,"@@TB","@TB")},"~S");Clazz.overrideMethod(c$,"getSubstructureSet",function(a,b,c,d,e,f){return this.match(a,b,c,d,null,e,!1,f,1)},"~S,~A,~N,JU.BS,~B,~B");Clazz.overrideMethod(c$,"getSubstructureSets",function(a,b,c,d,e,f,h){J.smiles.InvalidSmilesException.setLastError(null);
var j=new J.smiles.SmilesParser(!0),g=null;try{g=j.parse(""),g.firstMatchOnly=!1,g.matchAllAtoms=!1,g.jmolAtoms=b,g.jmolAtomCount=Math.abs(c),g.setSelected(e),g.getRingData(!0,d,h),g.asVector=!1,g.subSearches=Array(1),g.getSelections()}catch(l){if(!Clazz.exceptionOf(l,J.smiles.InvalidSmilesException))throw l;}b=new JU.BS;for(e=0;e<a.length;e++)if(null==a[e]||0==a[e].length||a[e].startsWith("#"))f.addLast(null);else try{g.clear();var k=j.getSearch(g,J.smiles.SmilesParser.cleanPattern(a[e]),d);g.subSearches[0]=
k;var m=J.util.BSUtil.copy(g.search(!1));f.addLast(m);b.or(m);if(b.cardinality()==c)break}catch(n){if(Clazz.exceptionOf(n,Exception))null==J.smiles.InvalidSmilesException.getLastError()&&J.smiles.InvalidSmilesException.setLastError(n.toString()),System.out.println(n.toString());else throw n;}},"~A,~A,~N,~N,JU.BS,JU.List,~A");Clazz.overrideMethod(c$,"getSubstructureSetArray",function(a,b,c,d,e,f,h){return this.match(a,b,c,d,e,f,!1,h,2)},"~S,~A,~N,JU.BS,JU.BS,~B,~B");Clazz.overrideMethod(c$,"getCorrelationMaps",
function(a,b,c,d,e,f){return this.match(a,b,c,d,null,e,!1,f,3)},"~S,~A,~N,JU.BS,~B,~B");$_M(c$,"find",($fz=function(a,b,c,d,e){var f=new JU.BS;b.createTopoMap(f);return this.match(a,b.jmolAtoms,-b.jmolAtoms.length,null,f,c,d,e,2)},$fz.isPrivate=!0,$fz),"~S,J.smiles.SmilesSearch,~B,~B,~B");$_M(c$,"match",($fz=function(a,b,c,d,e,f,h,j,g){J.smiles.InvalidSmilesException.setLastError(null);try{var l=J.smiles.SmilesParser.getMolecule(a,f);l.jmolAtoms=b;l.jmolAtomCount=Math.abs(c);0>c&&(l.isSmilesFind=
!0);l.setSelected(d);l.getSelections();l.bsRequired=null;l.setRingData(e);l.firstMatchOnly=j;l.matchAllAtoms=h;switch(g){case 1:return l.asVector=!1,l.search(!1);case 2:l.asVector=!0;var k=l.search(!1);return k.toArray(Array(k.size()));case 3:l.getMaps=!0;var m=l.search(!1);return m.toArray(JU.ArrayUtil.newInt2(m.size()))}}catch(n){if(Clazz.exceptionOf(n,Exception))null==J.smiles.InvalidSmilesException.getLastError()&&J.smiles.InvalidSmilesException.setLastError(n.toString()),System.out.println(n.toString());
else throw n;}return null},$fz.isPrivate=!0,$fz),"~S,~A,~N,JU.BS,JU.BS,~B,~B,~B,~N");$_M(c$,"countStereo",($fz=function(a){a=J.util.Txt.simpleReplace(a,"@@","@");for(var b=a.lastIndexOf("@")+1,c=0;0<=--b;)"@"==a.charAt(b)&&c++;return c},$fz.isPrivate=!0,$fz),"~S");Clazz.defineStatics(c$,"MODE_BITSET",1,"MODE_ARRAY",2,"MODE_MAP",3)});Clazz.declarePackage("J.smiles");
Clazz.load(["java.lang.Exception"],"J.smiles.InvalidSmilesException",null,function(){c$=Clazz.declareType(J.smiles,"InvalidSmilesException",Exception);c$.getLastError=$_M(c$,"getLastError",function(){return J.smiles.InvalidSmilesException.lastError});c$.setLastError=$_M(c$,"setLastError",function(a){$t$=J.smiles.InvalidSmilesException.lastError=a;J.smiles.InvalidSmilesException.prototype.lastError=J.smiles.InvalidSmilesException.lastError;$t$},"~S");Clazz.makeConstructor(c$,function(a){Clazz.superConstructor(this,
J.smiles.InvalidSmilesException,[a]);$t$=J.smiles.InvalidSmilesException.lastError=a;J.smiles.InvalidSmilesException.prototype.lastError=J.smiles.InvalidSmilesException.lastError;$t$},"~S");Clazz.makeConstructor(c$,function(a){Clazz.superConstructor(this,J.smiles.InvalidSmilesException,[a]);$t$=J.smiles.InvalidSmilesException.lastError=a.toString();J.smiles.InvalidSmilesException.prototype.lastError=J.smiles.InvalidSmilesException.lastError;$t$},"Throwable");Clazz.makeConstructor(c$,function(a,b){Clazz.superConstructor(this,
J.smiles.InvalidSmilesException,[a,b]);$t$=J.smiles.InvalidSmilesException.lastError=a+"\n"+b.getCause();J.smiles.InvalidSmilesException.prototype.lastError=J.smiles.InvalidSmilesException.lastError;$t$},"~S,Throwable");Clazz.defineStatics(c$,"lastError",null)});Clazz.declarePackage("J.smiles");
Clazz.load(["J.util.JmolMolecule","JU.BS","$.List","$.V3"],"J.smiles.SmilesSearch","java.util.Arrays $.Hashtable JU.ArrayUtil $.SB J.smiles.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesParser J.util.BSUtil $.Logger".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.jmolAtoms=this.pattern=this.patternAtoms=null;this.jmolAtomCount=0;this.bsRequired=this.bsSelected=null;this.isSmilesFind=this.isSmarts=this.matchAllAtoms=this.firstMatchOnly=!1;this.subSearches=null;this.needRingData=
this.haveAtomStereochemistry=this.haveBondStereochemistry=this.haveSelected=!1;this.needAromatic=!0;this.needRingMemberships=!1;this.ringDataMax=-2147483648;this.measures=null;this.flags=0;this.lastChainAtom=this.bsAromatic6=this.bsAromatic5=this.bsAromatic=this.ringSets=null;this.getMaps=this.asVector=!1;this.top=null;this.isRingCheck=this.isSilent=!1;this.selectedAtomCount=0;this.htNested=this.bsFound=this.ringConnections=this.ringCounts=this.ringData=null;this.nNested=0;this.bsReturn=this.vReturn=
this.nestedBond=null;this.aromaticDouble=this.noAromatic=this.ignoreStereochemistry=!1;this.v=this.bsCheck=null;Clazz.instantialize(this,arguments)},J.smiles,"SmilesSearch",J.util.JmolMolecule);Clazz.prepareFields(c$,function(){this.patternAtoms=Array(16);this.measures=new JU.List;this.bsAromatic=new JU.BS;this.bsAromatic5=new JU.BS;this.bsAromatic6=new JU.BS;this.top=this;this.bsFound=new JU.BS;this.bsReturn=new JU.BS;this.v=new J.smiles.SmilesSearch.VTemp});$_M(c$,"toString",function(){var a=(new JU.SB).append(this.pattern);
a.append("\nmolecular formula: "+this.getMolecularFormula(!0));return a.toString()});$_M(c$,"setSelected",function(a){null==a&&(a=J.util.BSUtil.newBitSet(this.jmolAtomCount),a.setBits(0,this.jmolAtomCount));this.bsSelected=a},"JU.BS");$_M(c$,"setAtomArray",function(){this.patternAtoms.length>this.atomCount&&(this.patternAtoms=JU.ArrayUtil.arrayCopyObject(this.patternAtoms,this.atomCount));this.nodes=this.patternAtoms});$_M(c$,"addAtom",function(){this.atomCount>=this.patternAtoms.length&&(this.patternAtoms=
JU.ArrayUtil.doubleLength(this.patternAtoms));var a=(new J.smiles.SmilesAtom).setIndex(this.atomCount);this.patternAtoms[this.atomCount]=a;this.atomCount++;return a});$_M(c$,"addNested",function(a){null==this.top.htNested&&(this.top.htNested=new java.util.Hashtable);this.setNested(++this.top.nNested,a);return this.top.nNested},"~S");$_M(c$,"clear",function(){this.bsReturn.clearAll();this.nNested=0;this.nestedBond=this.htNested=null;this.clearBsFound(-1)});$_M(c$,"setNested",function(a,b){this.top.htNested.put("_"+
a,b)},"~N,~O");$_M(c$,"getNested",function(a){return this.top.htNested.get("_"+a)},"~N");$_M(c$,"getMissingHydrogenCount",function(){for(var a=0,b,c=0;c<this.atomCount;c++)if(0<=(b=this.patternAtoms[c].missingHydrogenCount))a+=b;return a});$_M(c$,"setRingData",function(a){this.needAromatic&&(this.needRingData=!0);this.needAromatic=(new Boolean(this.needAromatic&(new Boolean(null==a&0==(this.flags&1))).valueOf())).valueOf();if(!this.needAromatic&&(this.bsAromatic.clearAll(),null!=a&&this.bsAromatic.or(a),
!this.needRingMemberships&&!this.needRingData))return;this.getRingData(this.needRingData,this.flags,null)},"JU.BS");$_M(c$,"getRingData",function(a,b,c){var d=0!=(b&4),e=0!=(b&8);d&&null==c&&(c=JU.ArrayUtil.createArrayOfArrayList(4));e&&this.needAromatic&&(this.bsAromatic=J.smiles.SmilesAromatic.checkAromaticDefined(this.jmolAtoms,this.bsSelected),d=!1);0>this.ringDataMax&&(this.ringDataMax=8);d&&6>this.ringDataMax&&(this.ringDataMax=6);a&&(this.ringCounts=Clazz.newIntArray(this.jmolAtomCount,0),
this.ringConnections=Clazz.newIntArray(this.jmolAtomCount,0),this.ringData=Array(this.ringDataMax+1));this.ringSets=new JU.SB;for(var f="****";f.length<this.ringDataMax;)f+=f;var h=null;for(b=3;b<=this.ringDataMax;b++)if(!(b>this.jmolAtomCount)){var j="*1"+f.substring(0,b-2)+"*1",j=J.smiles.SmilesParser.getMolecule(j,!0),j=this.subsearch(j,!1,!0);if(null!=c&&5>=b){for(var g=new JU.List,l=j.size();0<=--l;)g.addLast(j.get(l));c[b-3]=g}if(this.needAromatic){if(!e&&(!d||5==b||6==b))for(g=j.size();0<=
--g;)l=j.get(g),(e||J.smiles.SmilesAromatic.isFlatSp2Ring(this.jmolAtoms,this.bsSelected,l,d?0.1:0.01))&&this.bsAromatic.or(l);if(d)switch(b){case 5:h=j;break;case 6:e?this.bsAromatic=J.smiles.SmilesAromatic.checkAromaticDefined(this.jmolAtoms,this.bsAromatic):J.smiles.SmilesAromatic.checkAromaticStrict(this.jmolAtoms,this.bsAromatic,h,j),c[3]=new JU.List,this.setAromatic56(h,this.bsAromatic5,5,c[3]),this.setAromatic56(j,this.bsAromatic6,6,c[3])}}if(a){this.ringData[b]=new JU.BS;for(var k=0;k<j.size();k++){g=
j.get(k);this.ringData[b].or(g);for(l=g.nextSetBit(0);0<=l;l=g.nextSetBit(l+1))this.ringCounts[l]++}}}if(a)for(b=this.bsSelected.nextSetBit(0);0<=b;b=this.bsSelected.nextSetBit(b+1))if(a=this.jmolAtoms[b],c=a.getEdges(),null!=c)for(k=c.length;0<=--k;)0<this.ringCounts[a.getBondedAtomIndex(k)]&&this.ringConnections[b]++},"~B,~N,~A");$_M(c$,"setAromatic56",($fz=function(a,b,c,d){for(var e=0;e<a.size();e++){var f=a.get(e);this.v.bsTemp.clearAll();this.v.bsTemp.or(f);this.v.bsTemp.and(this.bsAromatic);
this.v.bsTemp.cardinality()==c&&(b.or(f),null!=d&&d.addLast(f))}},$fz.isPrivate=!0,$fz),"JU.List,JU.BS,~N,JU.List");$_M(c$,"subsearch",function(a,b,c){a.ringSets=this.ringSets;a.jmolAtoms=this.jmolAtoms;a.jmolAtomCount=this.jmolAtomCount;a.bsSelected=this.bsSelected;a.htNested=this.htNested;a.isSmilesFind=this.isSmilesFind;a.bsCheck=this.bsCheck;a.isSmarts=!0;a.bsAromatic=this.bsAromatic;a.bsAromatic5=this.bsAromatic5;a.bsAromatic6=this.bsAromatic6;a.ringData=this.ringData;a.ringCounts=this.ringCounts;
a.ringConnections=this.ringConnections;b?(a.bsRequired=null,a.firstMatchOnly=!1,a.matchAllAtoms=!1):c?(a.bsRequired=null,a.isSilent=!0,a.isRingCheck=!0,a.asVector=!0,a.matchAllAtoms=!1):(a.haveSelected=this.haveSelected,a.bsRequired=this.bsRequired,a.firstMatchOnly=this.firstMatchOnly,a.matchAllAtoms=this.matchAllAtoms,a.getMaps=this.getMaps,a.asVector=this.asVector,a.vReturn=this.vReturn,a.bsReturn=this.bsReturn);return a.search(b)},"J.smiles.SmilesSearch,~B,~B");$_M(c$,"search",function(a){this.ignoreStereochemistry=
0!=(this.flags&2);this.noAromatic=0!=(this.flags&1);this.aromaticDouble=0!=(this.flags&16);J.util.Logger.debugging&&!this.isSilent&&J.util.Logger.debug("SmilesSearch processing "+this.pattern);if(null==this.vReturn&&(this.asVector||this.getMaps))this.vReturn=new JU.List;null==this.bsSelected&&(this.bsSelected=J.util.BSUtil.newBitSet(this.jmolAtomCount),this.bsSelected.setBits(0,this.jmolAtomCount));this.selectedAtomCount=this.bsSelected.cardinality();if(null!=this.subSearches)for(a=0;a<this.subSearches.length&&
!(null!=this.subSearches[a]&&(this.subsearch(this.subSearches[a],!1,!1),this.firstMatchOnly&&(null==this.vReturn?0<=this.bsReturn.nextSetBit(0):0<this.vReturn.size())));a++);else 0<this.atomCount&&this.checkMatch(null,-1,-1,a);return this.asVector||this.getMaps?this.vReturn:this.bsReturn},"~B");$_M(c$,"checkMatch",($fz=function(a,b,c,d){var e;if(null==a)null==this.nestedBond?this.clearBsFound(-1):this.bsReturn.clearAll();else{if(this.bsFound.get(c)||!this.bsSelected.get(c))return!0;e=this.jmolAtoms[c];
if(!this.isRingCheck){if(null!=a.atomsOr){for(var f=0;f<a.nAtomsOr;f++)if(!this.checkMatch(a.atomsOr[f],b,c,d))return!1;return!0}if(null==a.primitives){if(!this.checkPrimitiveAtom(a,c))return!0}else for(f=0;f<a.nPrimitives;f++)if(!this.checkPrimitiveAtom(a.primitives[f],c))return!0}e=e.getEdges();for(f=a.getBondCount();0<=--f;){var h=a.getBond(f);if(h.getAtomIndex2()==a.index){var j=h.getAtom1(),g=j.getMatchingAtom();switch(h.order){case 96:case 112:if(!this.checkMatchBond(a,j,h,c,g,null))return!0;
break;default:for(var l=0;l<e.length&&(!(e[l].getAtomIndex1()==g||e[l].getAtomIndex2()==g)||!e[l].isCovalent());l++);if(l==e.length||!this.checkMatchBond(a,j,h,c,g,e[l]))return!0}}}this.patternAtoms[a.index].setMatchingAtom(c);J.util.Logger.debugging&&!this.isSilent&&J.util.Logger.debug("pattern atom "+b+" "+a);this.bsFound.set(c)}if(!this.continueMatch(b,c,d))return!1;0<=c&&this.clearBsFound(c);return!0},$fz.isPrivate=!0,$fz),"J.smiles.SmilesAtom,~N,~N,~B");$_M(c$,"continueMatch",($fz=function(a,
b,c){var d,e;if(++a<this.atomCount){var f=this.patternAtoms[a],h=0<=b?f.getBondTo(null):0==a?this.nestedBond:null;if(null==h){h=J.util.BSUtil.copy(this.bsFound);if(0<=f.notBondedIndex){d=this.patternAtoms[f.notBondedIndex];var j=this.jmolAtoms[d.getMatchingAtom()];if("\x00"==d.bioType){e=j.getEdges();for(d=0;d<e.length;d++)h.set(e[d].getOtherAtomNode(j).getIndex())}else d=j.getOffsetResidueAtom("0",1),0<=d&&h.set(d),d=j.getOffsetResidueAtom("0",-1),0<=d&&h.set(d)}b=0<=b&&f.isBioAtom&&(null==f.atomName||
null!=f.residueChar);for(j=this.bsSelected.nextSetBit(0);0<=j;j=this.bsSelected.nextSetBit(j+1)){if(!h.get(j)&&!this.checkMatch(f,a,j,c))return!1;b&&(d=this.jmolAtoms[j].getOffsetResidueAtom(f.atomName,1),0<=d&&(j=d-1))}this.bsFound=h;return!0}d=this.jmolAtoms[h.getAtom1().getMatchingAtom()];switch(h.order){case 96:j=d.getOffsetResidueAtom(f.atomName,1);if(0<=j){h=J.util.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);if(!this.checkMatch(f,a,j,c))return!1;this.bsFound=h}return!0;case 112:b=
new JU.List;d.getCrossLinkLeadAtomIndexes(b);h=J.util.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);for(j=0;j<b.size();j++)if(!this.checkMatch(f,a,b.get(j).intValue(),c))return!1;this.bsFound=h;return!0}e=d.getEdges();if(null!=e)for(j=0;j<e.length;j++)if(!this.checkMatch(f,a,d.getBondedAtomIndex(j),c))return!1;this.clearBsFound(b);return!0}if(!this.ignoreStereochemistry&&!this.checkStereochemistry())return!0;h=new JU.BS;for(j=f=0;j<this.atomCount;j++)if(b=this.patternAtoms[j].getMatchingAtom(),
c||!this.top.haveSelected||this.patternAtoms[j].selected){f++;h.set(b);this.patternAtoms[j].isBioAtom&&null==this.patternAtoms[j].atomName&&this.jmolAtoms[b].getGroupBits(h);if(c)break;!this.isSmarts&&0<this.patternAtoms[j].missingHydrogenCount&&this.getHydrogens(this.jmolAtoms[b],h)}if(null!=this.bsRequired&&!this.bsRequired.intersects(h)||this.matchAllAtoms&&h.cardinality()!=this.selectedAtomCount)return!0;if(null!=this.bsCheck)if(c){this.bsCheck.clearAll();for(j=0;j<this.atomCount;j++)this.bsCheck.set(this.patternAtoms[j].getMatchingAtom());
if(this.bsCheck.cardinality()!=this.atomCount)return!0}else if(h.cardinality()!=this.atomCount)return!0;this.bsReturn.or(h);if(this.getMaps){a=Clazz.newIntArray(f,0);for(h=j=0;j<this.atomCount;j++)if(c||!this.top.haveSelected||this.patternAtoms[j].selected)a[h++]=this.patternAtoms[j].getMatchingAtom();this.vReturn.addLast(a);return!this.firstMatchOnly}if(this.asVector){c=!0;for(j=this.vReturn.size();0<=--j&&c;)c=!this.vReturn.get(j).equals(h);if(!c)return!0;this.vReturn.addLast(h)}if(this.isRingCheck){this.ringSets.append(" ");
for(d=3*a+2;--d>a;)this.ringSets.append("-").appendI(this.patternAtoms[(d<=2*a?2*a-d+1:d-1)%a].getMatchingAtom());this.ringSets.append("- ");return!0}return this.firstMatchOnly?!1:h.cardinality()!=this.selectedAtomCount},$fz.isPrivate=!0,$fz),"~N,~N,~B");$_M(c$,"clearBsFound",($fz=function(a){0>a?null==this.bsCheck&&this.bsFound.clearAll():this.bsFound.clear(a)},$fz.isPrivate=!0,$fz),"~N");$_M(c$,"getHydrogens",($fz=function(a,b){for(var c=a.getEdges(),d=-1,e=0;e<c.length;e++)if(1==this.jmolAtoms[a.getBondedAtomIndex(e)].getElementNumber()){d=
a.getBondedAtomIndex(e);if(null==b)break;b.set(d)}return 0<=d?this.jmolAtoms[d]:null},$fz.isPrivate=!0,$fz),"J.util.JmolNode,JU.BS");$_M(c$,"checkPrimitiveAtom",($fz=function(a,b){for(var c=this.jmolAtoms[b],d=a.not;;){var e;if(0<a.iNested){d=this.getNested(a.iNested);Clazz.instanceOf(d,J.smiles.SmilesSearch)&&(a.isBioAtom&&(d.nestedBond=a.getBondTo(null)),d=this.subsearch(d,!0,!1),null==d&&(d=new JU.BS),a.isBioAtom||this.setNested(a.iNested,d));d=a.not!=d.get(b);break}if(a.isBioAtom){if(null!=a.atomName&&
(a.isLeadAtom()?!c.isLeadAtom():!a.atomName.equals(c.getAtomName().toUpperCase())))break;if(null!=a.residueName&&!a.residueName.equals(c.getGroup3(!1).toUpperCase()))break;if(null!=a.residueChar){if(a.isDna()&&!c.isDna()||a.isRna()&&!c.isRna()||a.isProtein()&&!c.isProtein()||a.isNucleic()&&!c.isNucleic())break;e=c.getGroup1("\x00").toUpperCase();e=a.residueChar.equals(e);switch(a.residueChar.charAt(0)){case "N":e=a.isNucleic()?c.isNucleic():e;break;case "R":e=a.isNucleic()?c.isPurine():e;break;case "Y":e=
a.isNucleic()?c.isPyrimidine():e}if(!e)break}if(0<=a.elementNumber&&a.elementNumber!=c.getElementNumber())break;if(a.notCrossLinked&&c.getCrossLinkLeadAtomIndexes(null))break}else{if(0<=a.jmolIndex&&c.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(c.getAtomType()))break;if(0<=a.elementNumber&&a.elementNumber!=c.getElementNumber())break;e=a.isAromatic();if(!this.noAromatic&&!a.aromaticAmbiguous&&e!=this.bsAromatic.get(b))break;if(-2147483648!=(e=a.getAtomicMass())){var f=c.getIsotopeNumber();
if(0<=e&&e!=f||0>e&&0!=f&&-e!=f)break}if(-2147483648!=(e=a.getCharge())&&e!=c.getFormalCharge())break;e=a.getCovalentHydrogenCount()+a.missingHydrogenCount;if(0<=e&&e!=c.getCovalentHydrogenCount())break;e=a.implicitHydrogenCount;if(-2147483648!=e&&(f=c.getImplicitHydrogenCount(),-1==e?0==f:e!=f))break;if(0<a.degree&&a.degree!=c.getCovalentBondCount())break;if(0<a.nonhydrogenDegree&&a.nonhydrogenDegree!=c.getCovalentBondCount()-c.getCovalentHydrogenCount())break;if(0<a.valence&&a.valence!=c.getValence())break;
if(0<a.connectivity&&a.connectivity!=c.getCovalentBondCount()+c.getImplicitHydrogenCount())break;if(null!=this.ringData&&-1<=a.ringSize)if(0>=a.ringSize){if(0==this.ringCounts[b]!=(0==a.ringSize))break}else{c=this.ringData[500==a.ringSize?5:600==a.ringSize?6:a.ringSize];if(null==c||!c.get(b))break;if(!this.noAromatic)if(500==a.ringSize){if(!this.bsAromatic5.get(b))break}else if(600==a.ringSize&&!this.bsAromatic6.get(b))break}if(null!=this.ringData&&-1<=a.ringMembership&&(-1==a.ringMembership?0==this.ringCounts[b]:
this.ringCounts[b]!=a.ringMembership))break;if(0<=a.ringConnectivity&&(e=this.ringConnections[b],-1==a.ringConnectivity&&0==e||-1!=a.ringConnectivity&&e!=a.ringConnectivity))break}d=!d;break}return d},$fz.isPrivate=!0,$fz),"J.smiles.SmilesAtom,~N");$_M(c$,"checkMatchBond",($fz=function(a,b,c,d,e,f){if(null!=c.bondsOr){for(var h=0;h<c.nBondsOr;h++)if(this.checkMatchBond(a,b,c.bondsOr[h],d,e,f))return!0;return!1}if(null==c.primitives){if(!this.checkPrimitiveBond(c,d,e,f))return!1}else for(a=0;a<c.nPrimitives;a++)if(!this.checkPrimitiveBond(c.primitives[a],
d,e,f))return!1;c.matchingBond=f;return!0},$fz.isPrivate=!0,$fz),"J.smiles.SmilesAtom,J.smiles.SmilesAtom,J.smiles.SmilesBond,~N,~N,J.util.JmolEdge");$_M(c$,"checkPrimitiveBond",($fz=function(a,b,c,d){var e=!1;switch(a.order){case 96:return a.isNot!=(this.jmolAtoms[c].getOffsetResidueAtom("0",1)==this.jmolAtoms[b].getOffsetResidueAtom("0",0));case 112:return a.isNot!=this.jmolAtoms[b].isCrossLinked(this.jmolAtoms[c])}var f=!this.noAromatic&&this.bsAromatic.get(b),h=!this.noAromatic&&this.bsAromatic.get(c);
d=d.getCovalentOrder();if(f&&h)switch(a.order){case 17:case 65:e=J.smiles.SmilesSearch.isRingBond(this.ringSets,b,c);break;case 1:e=!this.isSmarts||!J.smiles.SmilesSearch.isRingBond(this.ringSets,b,c);break;case 2:e=!this.isSmarts||this.aromaticDouble&&(2==d||514==d);break;case 769:case 1025:case 81:case -1:e=!0}else switch(a.order){case 81:case -1:e=!0;break;case 1:case 257:case 513:e=1==d||1041==d||1025==d;break;case 769:e=d==(this.isSmilesFind?33:1);break;case 1025:e=d==(this.isSmilesFind?97:1);
break;case 2:e=2==d;break;case 3:e=3==d;break;case 65:e=J.smiles.SmilesSearch.isRingBond(this.ringSets,b,c)}return e!=a.isNot},$fz.isPrivate=!0,$fz),"J.smiles.SmilesBond,~N,~N,J.util.JmolEdge");c$.isRingBond=$_M(c$,"isRingBond",function(a,b,c){return null!=a&&0<=a.indexOf("-"+b+"-"+c+"-")},"JU.SB,~N,~N");$_M(c$,"checkStereochemistry",($fz=function(){for(var a=0;a<this.measures.size();a++)if(!this.measures.get(a).check())return!1;if(this.haveAtomStereochemistry){J.util.Logger.debugging&&J.util.Logger.debug("checking stereochemistry...");
for(var b=null,c=null,d=null,e=null,f=null,h=null,j=c=null,a=0;a<this.atomCount;a++){var g=this.patternAtoms[a],l=this.jmolAtoms[g.getMatchingAtom()],h=g.missingHydrogenCount;0>h&&(h=0);var k=g.getChiralClass();if(-2147483648!=k){var m=g.getChiralOrder();if(this.isSmilesFind&&l.getAtomSite()>>8!=k)return!1;J.util.Logger.debugging&&J.util.Logger.debug("...type "+k+" for pattern atom "+g+" "+l);switch(k){case 2:c=g.getBond(0).getOtherAtom(g);j=g.getBond(1).getOtherAtom(g);if(null==c||null==j)continue;
for(d=b=g;2==c.getBondCount()&&2==j.getBondCount()&&4==c.getValence()&&4==j.getValence();)g=c.getBondNotTo(b,!0),b=c,c=g.getOtherAtom(c),g=j.getBondNotTo(d,!0),d=j,j=g.getOtherAtom(j);g=c;e=Array(6);e[4]=(new J.smiles.SmilesAtom).setIndex(604);d=g.getBondCount();for(b=0;b<d;b++)c=g.bonds[b].getOtherAtom(g),2==g.bonds[b].matchingBond.getCovalentOrder()?null==j&&(j=c):null==e[0]?e[0]=this.getJmolAtom(c.getMatchingAtom()):e[1]=this.getJmolAtom(c.getMatchingAtom());if(null==j)continue;d=j.getBondCount();
if(2>d||3<d)continue;for(b=0;b<d;b++)c=j.bonds[b].getOtherAtom(j),2!=j.bonds[b].matchingBond.getCovalentOrder()&&(null==e[2]?e[2]=this.getJmolAtom(c.getMatchingAtom()):e[3]=this.getJmolAtom(c.getMatchingAtom()));if(this.isSmilesFind&&(null==e[1]&&this.getX(g,e,1,!1,!0),null==e[3]&&this.getX(j,e,3,!1,!1),!this.setSmilesCoordinates(l,g,j,e)))return!1;null==e[1]&&this.getX(g,e,1,!0,!1);null==e[3]&&this.getX(j,e,3,!0,!1);if(!J.smiles.SmilesSearch.checkStereochemistryAll(g.not,l,k,m,e[0],e[1],e[2],e[3],
null,null,this.v))return!1;continue;case 4:case 8:case 5:case 6:b=this.getJmolAtom(g.getMatchingBondedAtom(0));switch(h){case 0:c=this.getJmolAtom(g.getMatchingBondedAtom(1));break;case 1:c=this.getHydrogens(this.getJmolAtom(g.getMatchingAtom()),null);g.isFirst&&(d=c,c=b,b=d);break;default:continue}d=this.getJmolAtom(g.getMatchingBondedAtom(2-h));e=this.getJmolAtom(g.getMatchingBondedAtom(3-h));f=this.getJmolAtom(g.getMatchingBondedAtom(4-h));h=this.getJmolAtom(g.getMatchingBondedAtom(5-h));if(this.isSmilesFind&&
!this.setSmilesCoordinates(l,g,j,[b,c,d,e,f,h])||!J.smiles.SmilesSearch.checkStereochemistryAll(g.not,l,k,m,b,c,d,e,f,h,this.v))return!1}}}}if(this.haveBondStereochemistry)for(b=0;b<this.atomCount;b++){c=this.patternAtoms[b];e=f=j=null;k=l=a=0;d=c.getBondCount();m=!1;for(h=0;h<d;h++){var g=c.getBond(h),n=g.getAtom2()===c,q=g.order;switch(q){case 769:case 1025:case 2:if(n)continue;j=g.getAtom2();k=q;(m=2!=q)&&(a=g.isNot?-1:1);break;case 257:case 513:f=n?g.getAtom1():g.getAtom2(),a=n!=(257==q)?1:-1}}if(m){g=
c.getBondNotTo(j,!1);if(null==g)return!1;f=g.getOtherAtom(c);g=j.getBondNotTo(c,!1);if(null==g)return!1;e=g.getOtherAtom(j)}else{if(null==j||0==a)continue;d=j.getBondCount();for(h=0;h<d&&0==l;h++)switch(g=j.getBond(h),n=g.getAtom2()===j,q=g.order,q){case 257:case 513:e=n?g.getAtom1():g.getAtom2(),l=n!=(257==q)?1:-1}if(0==l)continue}this.isSmilesFind&&this.setSmilesBondCoordinates(c,j,k);c=this.getJmolAtom(c.getMatchingAtom());j=this.getJmolAtom(j.getMatchingAtom());g=this.getJmolAtom(f.getMatchingAtom());
d=this.getJmolAtom(e.getMatchingAtom());if(null==g||null==d)return!1;J.smiles.SmilesMeasure.setTorsionData(g,c,j,d,this.v,m);if(m){if(l=769==k?1:-1,j=this.v.vTemp1.dot(this.v.vTemp2),0.05>j||0.95<j||0<this.v.vNorm1.dot(this.v.vNorm2)*a*l)return!1}else if(0>this.v.vTemp1.dot(this.v.vTemp2)*a*l)return!1}return!0},$fz.isPrivate=!0,$fz));$_M(c$,"getX",($fz=function(a,b,c,d,e){var f=this.getJmolAtom(a.getMatchingAtom()),h=a.isFirst||3==c;if(d){if(this.isSmarts){var j=f.getEdges();for(d=0;d<j.length;d++)if(2!=
j[d].getCovalentOrder()){var g=this.jmolAtoms[f.getBondedAtomIndex(d)];if(g!==b[c-1]){b[c]=g;break}}}if(null==b[c]){j=new JU.V3;for(d=g=0;4>d;d++)null!=b[d]&&(g++,j.sub(b[d]));0==j.length()?(j.setT(b[4]),h=!1):(j.scaleAdd2(g+1,this.getJmolAtom(a.getMatchingAtom()),j),h=this.isSmilesFind||h);b[c]=(new J.smiles.SmilesAtom).setIndex(-1);b[c].setT(j)}}null==b[c]&&(b[c]=this.getHydrogens(f,null),e&&(h=!0));null!=b[c]&&h&&(g=b[c],b[c]=b[c-1],b[c-1]=g)},$fz.isPrivate=!0,$fz),"J.smiles.SmilesAtom,~A,~N,~B,~B");
c$.checkStereochemistryAll=$_M(c$,"checkStereochemistryAll",function(a,b,c,d,e,f,h,j,g,l,k){switch(c){default:case 2:case 4:return a==(J.smiles.SmilesSearch.getHandedness(f,h,j,e,k)!=d);case 5:return a==(!J.smiles.SmilesSearch.isDiaxial(b,b,g,e,k,-0.95)||J.smiles.SmilesSearch.getHandedness(f,h,j,e,k)!=d);case 6:if(a!=!J.smiles.SmilesSearch.isDiaxial(b,b,l,e,k,-0.95))return!1;J.smiles.SmilesSearch.getPlaneNormals(f,h,j,g,k);if(a!=(0>k.vNorm1.dot(k.vNorm2)||0>k.vNorm2.dot(k.vNorm3)))return!1;k.vNorm2.setT(b);
k.vNorm2.sub(e);return a==((0>k.vNorm1.dot(k.vNorm2)?2:1)==d);case 8:return J.smiles.SmilesSearch.getPlaneNormals(e,f,h,j,k),0>k.vNorm1.dot(k.vNorm2)?a==(3!=d):0>k.vNorm2.dot(k.vNorm3)?a==(2!=d):a==(1!=d)}},"~B,J.util.JmolNode,~N,~N,J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.smiles.SmilesSearch.VTemp");$_M(c$,"getJmolAtom",($fz=function(a){return 0>a||a>=this.jmolAtoms.length?null:this.jmolAtoms[a]},$fz.isPrivate=!0,$fz),"~N");$_M(c$,"setSmilesBondCoordinates",
($fz=function(a,b,c){a=this.jmolAtoms[a.getMatchingAtom()];b=this.jmolAtoms[b.getMatchingAtom()];a.set(-1,0,0);b.set(1,0,0);if(2==c){var d=0,e=0;c=a.getEdges();for(var f=c.length;0<=--f;){var h=c[f],j=h.getOtherAtomNode(a);if(j!==b)switch(j.set(-1,0==d++?-1:1,0),j=h.getAtomIndex2()==a.getIndex()?d:-d,h.order){case 1025:e=j;break;case 1041:e=-j}}var g=0,d=0,l=Array(2);c=b.getEdges();for(f=c.length;0<=--f;)if(h=c[f],j=h.getOtherAtomNode(b),j!==a)switch(l[d]=j,j.set(1,0==d++?1:-1,0),j=h.getAtomIndex2()==
b.getIndex()?d:-d,h.order){case 1025:g=j;break;case 1041:g=-j}0<e*g==(Math.abs(e)%2==Math.abs(g)%2)&&(a=l[0].y,l[0].y=l[1].y,l[1].y=a)}else{c=a.getEdges();l=0;for(f=c.length;0<=--f;)if(h=c[f],h.getOtherAtomNode(a)===b){l=33==h.order?1:-1;break}for(f=c.length;0<=--f;)h=c[f],j=h.getOtherAtomNode(a),j!==b&&j.set(-1,1,0);c=b.getEdges();for(f=c.length;0<=--f;)h=c[f],j=h.getOtherAtomNode(b),j!==a&&j.set(1,1,-l/2)}},$fz.isPrivate=!0,$fz),"J.smiles.SmilesAtom,J.smiles.SmilesAtom,~N");$_M(c$,"setSmilesCoordinates",
($fz=function(a,b,c,d){var e=a.getAtomSite();if(-2147483648==e)return!1;var f=e>>8,e=e&255;c=2==f||3==f?c=this.jmolAtoms[c.getMatchingAtom()]:null;a.set(0,0,0);a=this.jmolAtoms[b.getMatchingAtom()];a.set(0,0,0);a=this.getMappedAtoms(a,c,d);switch(f){case 2:case 4:2==e&&(e=a[0],a[0]=a[1],a[1]=e);d[a[0]].set(0,0,1);d[a[1]].set(1,0,-1);d[a[2]].set(0,1,-1);d[a[3]].set(-1,-1,-1);break;case 8:switch(e){case 1:d[a[0]].set(1,0,0);d[a[1]].set(0,1,0);d[a[2]].set(-1,0,0);d[a[3]].set(0,-1,0);break;case 2:d[a[0]].set(1,
0,0);d[a[1]].set(-1,0,0);d[a[2]].set(0,1,0);d[a[3]].set(0,-1,0);break;case 3:d[a[0]].set(1,0,0),d[a[1]].set(0,1,0),d[a[2]].set(0,-1,0),d[a[3]].set(-1,0,0)}break;case 5:case 6:f=a.length,2==e&&(e=a[0],a[0]=a[f-1],a[f-1]=e),d[a[0]].set(0,0,1),d[a[f-1]].set(0,0,-1),d[a[1]].set(1,0,0),d[a[2]].set(0,1,0),d[a[3]].set(-1,0,0),6==f&&d[a[4]].set(0,-1,0)}return!0},$fz.isPrivate=!0,$fz),"J.util.JmolNode,J.smiles.SmilesAtom,J.smiles.SmilesAtom,~A");$_M(c$,"getMappedAtoms",function(a,b,c){for(var d=Clazz.newIntArray(null==
c[4]?4:null==c[5]?5:6,0),e=0;e<d.length;e++)d[e]=null==c[e]?104+100*e:c[e].getIndex();for(var f,h=a.getEdges(),j=null==b?null:b.getEdges(),e=0;e<d.length;e++){for(f=0;f<h.length&&h[f].getOtherAtomNode(a)!==c[e];f++);if(f<h.length)d[e]=10*f+100+e;else if(null!=b){for(f=0;f<j.length&&j[f].getOtherAtomNode(b)!==c[e];f++);f<j.length&&(d[e]=10*f+300+e)}}java.util.Arrays.sort(d);for(e=0;e<d.length;e++)d[e]%=10;return d},"J.util.JmolNode,J.util.JmolNode,~A");c$.isDiaxial=$_M(c$,"isDiaxial",function(a,b,
c,d,e,f){e.vA.setT(a);e.vB.setT(b);e.vA.sub(c);e.vB.sub(d);e.vA.normalize();e.vB.normalize();return e.vA.dot(e.vB)<f},"J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.smiles.SmilesSearch.VTemp,~N");c$.getHandedness=$_M(c$,"getHandedness",($fz=function(a,b,c,d,e){a=J.smiles.SmilesAromatic.getNormalThroughPoints(a,b,c,e.vTemp,e.vA,e.vB);return 0<J.smiles.SmilesSearch.distanceToPlane(e.vTemp,a,d)?1:2},$fz.isPrivate=!0,$fz),"J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.smiles.SmilesSearch.VTemp");
c$.getPlaneNormals=$_M(c$,"getPlaneNormals",($fz=function(a,b,c,d,e){J.smiles.SmilesAromatic.getNormalThroughPoints(a,b,c,e.vNorm1,e.vTemp1,e.vTemp2);J.smiles.SmilesAromatic.getNormalThroughPoints(b,c,d,e.vNorm2,e.vTemp1,e.vTemp2);J.smiles.SmilesAromatic.getNormalThroughPoints(c,d,a,e.vNorm3,e.vTemp1,e.vTemp2)},$fz.isPrivate=!0,$fz),"J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,J.smiles.SmilesSearch.VTemp");c$.distanceToPlane=$_M(c$,"distanceToPlane",function(a,b,c){return null==
a?NaN:(a.x*c.x+a.y*c.y+a.z*c.z+b)/Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},"JU.V3,~N,JU.P3");$_M(c$,"createTopoMap",function(a){null==a&&(a=new JU.BS);var b=this.getMissingHydrogenCount();this.jmolAtoms=b=Array(this.atomCount+b);for(var c=0,d=new JU.BS,e=0;e<this.atomCount;e++){var f=this.patternAtoms[e],h=f.getChiralClass(),j=f.missingHydrogenCount;0>j&&(j=0);var g=b[c]=(new J.smiles.SmilesAtom).setAll(0,c,-2147483648==h?h:(h<<8)+f.getChiralOrder(),f.elementNumber,f.getCharge());g.atomName=f.atomName;
g.residueName=f.residueName;g.residueChar=f.residueChar;g.isBioAtom=f.isBioAtom;g.$isLeadAtom=f.$isLeadAtom;g.setAtomicMass(f.getAtomicMass());f.isAromatic()&&a.set(c);!f.isFirst&&(1==j&&0<h)&&d.set(c);f.setMatchingAtom(c++);f=Array(f.getBondCount()+j);for(g.setBonds(f);0<=--j;)f=b[c]=(new J.smiles.SmilesAtom).setAll(0,c,0,1,0),c++,f.setBonds(Array(1)),h=new J.smiles.SmilesBond(g,f,1,!1),J.util.Logger.info(""+h)}for(e=0;e<this.atomCount;e++){f=this.patternAtoms[e];j=f.getMatchingAtom();a=b[j];j=f.getBondCount();
for(c=0;c<j;c++)if(g=f.getBond(c),g.getAtom1()===f){h=1;switch(g.order){case 769:h=33;break;case 1025:h=97;break;case 257:h=1025;break;case 513:h=1041;break;case 112:case 96:h=g.order;break;case 1:h=1;break;case 17:h=514;break;case 2:h=2;break;case 3:h=3}g=b[g.getAtom2().getMatchingAtom()];h=new J.smiles.SmilesBond(a,g,h,!1);g.bondCount--;J.util.Logger.info(""+h)}else g=b[g.getAtom1().getMatchingAtom()],h=g.getBondTo(a),a.addBond(h)}for(e=d.nextSetBit(0);0<=e;e=d.nextSetBit(e+1))f=b[e].getEdges(),
h=f[0],f[0]=f[1],f[1]=h},"JU.BS");$_M(c$,"setTop",function(a){this.top=null==a?this:a.getTop()},"J.smiles.SmilesSearch");$_M(c$,"getTop",function(){return this.top===this?this:this.top.getTop()});$_M(c$,"getSelections",function(){var a=this.top.htNested;if(!(null==a||0==this.jmolAtoms.length))for(var b=new java.util.Hashtable,c,a=a.entrySet().iterator();a.hasNext()&&((c=a.next())||1);){var d=c.getValue().toString();if(d.startsWith("select")){var e=b.containsKey(d)?b.get(d):this.jmolAtoms[0].findAtomsLike(d.substring(6));
null==e&&(e=new JU.BS);b.put(d,e);c.setValue(e)}}});Clazz.pu$h();c$=Clazz.decorateAsClass(function(){this.bsTemp=this.vNorm3=this.vNorm2=this.vNorm1=this.vTemp2=this.vTemp1=this.vB=this.vA=this.vTemp=null;Clazz.instantialize(this,arguments)},J.smiles.SmilesSearch,"VTemp");Clazz.prepareFields(c$,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.vNorm1=new JU.V3;this.vNorm2=new JU.V3;this.vNorm3=new JU.V3;this.bsTemp=new JU.BS});c$=
Clazz.p0p();Clazz.defineStatics(c$,"INITIAL_ATOMS",16)});Clazz.declarePackage("J.smiles");
Clazz.load(["java.util.Hashtable","JU.BS","J.smiles.SmilesSearch"],"J.smiles.SmilesGenerator","JU.List $.SB J.smiles.InvalidSmilesException $.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesParser J.util.BSUtil $.Elements $.JmolMolecule $.Logger".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.atoms=null;this.atomCount=0;this.vTemp=this.ringSets=this.bsAromatic=this.bsSelected=null;this.nPairs=0;this.bsIncludingH=this.htRings=this.htRingsSequence=this.prevSp2Atoms=this.prevAtom=this.bsToDo=
this.bsBondsDn=this.bsBondsUp=null;Clazz.instantialize(this,arguments)},J.smiles,"SmilesGenerator");Clazz.prepareFields(c$,function(){this.vTemp=new J.smiles.SmilesSearch.VTemp;this.bsBondsUp=new JU.BS;this.bsBondsDn=new JU.BS;this.htRingsSequence=new java.util.Hashtable;this.htRings=new java.util.Hashtable});$_M(c$,"getSmiles",function(a,b,c){var d=c.nextSetBit(0);if(0>d)return"";this.atoms=a;this.atomCount=b;this.bsSelected=c=J.util.BSUtil.copy(c);return this.getSmilesComponent(a[d],c,!1)},"~A,~N,JU.BS");
$_M(c$,"getBioSmiles",function(a,b,c,d,e,f){this.atoms=a;this.atomCount=b;b=new JU.SB;c=J.util.BSUtil.copy(c);null!=f&&b.append("//* Jmol bioSMILES ").append(f.$replace("*","_")).append(" *//");f="\n";var h=new JU.BS,j=null,g,l=new JU.List;try{for(var k=0,m=c.nextSetBit(0);0<=m;m=c.nextSetBit(m+1)){var n=a[m],q=n.getGroup1("?"),p=n.getBioStructureTypeName(),s=q.equals("?");if(null!=f)if(0<b.length()&&b.append(f),f=null,k=0,0<p.length)0!=n.getChainID()&&(g="//* chain "+n.getChainIDStr()+" "+p+" "+
n.getResno()+" *// ",k=g.length,b.append(g)),b.append("~").appendC(p.charAt(0)).append("~"),k++;else{g=this.getSmilesComponent(n,c,!0);if(g.equals(j))f="";else{var j=g,r=n.getGroup3(!0);null!=r&&b.append("//* ").append(r).append(" *//");b.append(g);f=".\n"}continue}75<=k&&(b.append("\n  "),k=2);s?this.addBracketedBioName(b,n,0<p.length?".0":null):b.append(q);k++;var u=n.getOffsetResidueAtom("0",0);if(e){n.getCrossLinkLeadAtomIndexes(l);for(var w=0;w<l.size();w++)b.append(":"),g=this.getRingCache(u,
l.get(w).intValue(),this.htRingsSequence),b.append(g),k+=1+g.length;l.clear()}n.getGroupBits(h);c.andNot(h);var x=n.getOffsetResidueAtom("0",1);if(0>x||!c.get(x)){b.append(" //* ").appendI(n.getResno()).append(" *//");if(0>x&&0>(x=c.nextSetBit(m+1)))break;0<k&&(f=".\n")}m=x-1}}catch(t){if(Clazz.exceptionOf(t,Exception))return System.out.println(t.toString()),"";throw t;}if(!d&&!this.htRingsSequence.isEmpty())throw this.dumpRingKeys(b,this.htRingsSequence),new J.smiles.InvalidSmilesException("//* ?ring error? *//");
g=b.toString();g.endsWith(".\n")&&(g=g.substring(0,g.length-2));return g},"~A,~N,JU.BS,~B,~B,~S");$_M(c$,"addBracketedBioName",($fz=function(a,b,c){a.append("[");if(null!=c){var d=b.getChainIDStr();a.append(b.getGroup3(!1));c.equals(".0")||a.append(c).append("#").appendI(b.getElementNumber());a.append("//* ").appendI(b.getResno());0<d.length&&a.append(":").append(d);a.append(" *//")}else a.append(J.util.Elements.elementNameFromNumber(b.getElementNumber()));a.append("]")},$fz.isPrivate=!0,$fz),"JU.SB,J.util.JmolNode,~S");
$_M(c$,"getSmilesComponent",($fz=function(a,b,c){1==a.getElementNumber()&&0<a.getEdges().length&&(a=this.atoms[a.getBondedAtomIndex(0)]);this.bsSelected=J.util.JmolMolecule.getBranchBitSet(this.atoms,a.getIndex(),J.util.BSUtil.copy(b),null,-1,!0,!1);b.andNot(this.bsSelected);this.bsIncludingH=J.util.BSUtil.copy(this.bsSelected);for(b=this.bsSelected.nextSetBit(0);0<=b;b=this.bsSelected.nextSetBit(b+1)){var d=this.atoms[b];1==d.getElementNumber()&&0==d.getIsotopeNumber()&&this.bsSelected.clear(b)}2<
this.bsSelected.cardinality()?(b=null,b=J.smiles.SmilesParser.getMolecule("A[=&@]A",!0),b.jmolAtoms=this.atoms,b.setSelected(this.bsSelected),b.jmolAtomCount=this.atomCount,b.ringDataMax=7,b.setRingData(null),this.bsAromatic=b.bsAromatic,this.ringSets=b.ringSets,this.setBondDirections()):this.bsAromatic=new JU.BS;this.bsToDo=J.util.BSUtil.copy(this.bsSelected);b=new JU.SB;for(d=this.bsToDo.nextSetBit(0);0<=d;d=this.bsToDo.nextSetBit(d+1))4<this.atoms[d].getCovalentBondCount()&&(this.getSmiles(b,this.atoms[d],
c,!1),a=null);if(null!=a)for(;null!=(a=this.getSmiles(b,a,c,!0)););for(;0<this.bsToDo.cardinality()||!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)];b.append(".");for(this.prevAtom=this.prevSp2Atoms=null;null!=(a=this.getSmiles(b,a,c,!0)););}if(!this.htRings.isEmpty())throw this.dumpRingKeys(b,this.htRings),new J.smiles.InvalidSmilesException("//* ?ring error? *//\n"+
b);return b.toString()},$fz.isPrivate=!0,$fz),"J.util.JmolNode,JU.BS,~B");$_M(c$,"getBondStereochemistry",($fz=function(a,b){if(null==a)return"\x00";var c=a.index,d=null==b||a.getAtomIndex1()==b.getIndex();return this.bsBondsUp.get(c)?d?"/":"\\":this.bsBondsDn.get(c)?d?"\\":"/":"\x00"},$fz.isPrivate=!0,$fz),"J.util.JmolEdge,J.util.JmolNode");$_M(c$,"setBondDirections",($fz=function(){for(var a=new JU.BS,b=Clazz.newArray(2,3,null),c=this.bsSelected.nextSetBit(0);0<=c;c=this.bsSelected.nextSetBit(c+
1))for(var d=this.atoms[c],e=d.getEdges(),f=0;f<e.length;f++){var h=e[f],j=h.index;if(!a.get(j)){var g=h.getOtherAtomNode(d);if(!(2!=h.getCovalentOrder()||J.smiles.SmilesSearch.isRingBond(this.ringSets,c,g.getIndex()))){a.set(j);var l=h=null,j=0,k=[d,g];J.util.Logger.debugging&&J.util.Logger.debug(d+" == "+g);l=1;for(g=0;2>g&&0<l&&3>l;g++)for(var l=0,m=k[g],n=m.getEdges(),q=0;q<n.length;q++)1==n[q].getCovalentOrder()&&(b[g][l++]=n[q],"\x00"!=this.getBondStereochemistry(n[q],m)&&(h=n[q],j=g));if(!(3==
l||0==l))if(null==h&&(j=0,h=b[j][0],this.bsBondsUp.set(h.index)),m=this.getBondStereochemistry(h,k[j]),l=h.getOtherAtomNode(k[j]),null!=l)for(g=0;2>g;g++)for(n=0;2>n;n++)if(q=b[g][n],!(null==q||q===h)){var p=q.index,s=q.getOtherAtomNode(k[g]);if(null!=s){var r=this.getBondStereochemistry(q,k[g]),u=J.smiles.SmilesSearch.isDiaxial(k[j],k[g],l,s,this.vTemp,0);"\x00"==r||r!=m==u?("\\"==m&&u||"/"==m&&!u)==(q.getAtomIndex1()!=s.getIndex())?this.bsBondsUp.set(p):this.bsBondsDn.set(p):J.util.Logger.error("BOND STEREOCHEMISTRY ERROR");
J.util.Logger.debugging&&J.util.Logger.debug(this.getBondStereochemistry(h,k[0])+" "+l.getIndex()+" "+s.getIndex()+" "+this.getBondStereochemistry(q,k[g]))}}}}}},$fz.isPrivate=!0,$fz));$_M(c$,"getSmiles",($fz=function(a,b,c,d){var e=b.getIndex();if(!this.bsToDo.get(e))return null;this.bsToDo.clear(e);var f=!this.bsSelected.get(e),h=null==this.prevAtom?-1:this.prevAtom.getIndex(),j=this.bsAromatic.get(e),g=null!=this.prevSp2Atoms,l=this.prevSp2Atoms,k=0,m=b.getElementNumber(),n=0,q=new JU.List,p=null,
s=null,r=b.getEdges(),u=null,w=j?10:0,x=Array(7);J.util.Logger.debugging&&J.util.Logger.debug(a.toString());if(null!=r)for(var t=r.length;0<=--t;){var v=r[t];if(v.isCovalent()){var y=r[t].getOtherAtomNode(b),v=y.getIndex();if(v==h)s=r[t];else{var z=1==y.getElementNumber()&&0==y.getIsotopeNumber();if(!this.bsIncludingH.get(v))if(!z&&c&&this.bsSelected.get(e))this.bsToDo.set(v);else continue;z?(u=y,n++,1<n&&(w=10)):q.addLast(r[t])}}}r=null;null==l&&(l=Array(5));null!=s&&(r=J.smiles.SmilesBond.getBondOrderString(s.getCovalentOrder()),
null==this.prevSp2Atoms?l[k++]=this.prevAtom:k=2);var k=k+n,h=0,B=new JU.BS;if(d)for(t=0;t<q.size();t++){var v=q.get(t),z=v.getOtherAtomNode(b),y=z.getCovalentBondCount()-z.getCovalentHydrogenCount(),A=v.getCovalentOrder();if(1==A&&1==y&&t<q.size()-(null==p?1:0))B.set(v.index);else if((1<A||y>h)&&!this.htRings.containsKey(J.smiles.SmilesGenerator.getRingKey(z.getIndex(),e)))h=1<A?1E3+A:y,p=v}h=null==p?null:p.getOtherAtomNode(b);y=null==p?0:p.getCovalentOrder();7>w&&null!=s&&(2==s.getCovalentOrder()&&
2==y&&null!=this.prevSp2Atoms&&null!=this.prevSp2Atoms[1]?(x[w++]=this.prevSp2Atoms[0],x[w++]=this.prevSp2Atoms[1]):x[w++]=this.prevAtom);7>w&&1==n&&(x[w++]=u);u=1==y&&null==this.prevSp2Atoms;A=this.getBondStereochemistry(s,this.prevAtom);s=new JU.SB;for(t=0;t<q.size();t++)v=q.get(t),B.get(v.index)&&(z=v.getOtherAtomNode(b),v=new JU.SB,v.append("("),this.prevAtom=b,this.prevSp2Atoms=null,this.getSmiles(v,z,c,d),v.append(")"),0<=s.indexOf(v.toString())&&(w=10),s.appendSB(v),q.remove(t--),7>w&&(x[w++]=
z),5>k&&(l[k++]=z));t=2==y?h.getIndex():-1;if(1<n||j||0>t||J.smiles.SmilesSearch.isRingBond(this.ringSets,e,t))k=-1;0>k&&(l=null);if(null!=r||"\x00"!=A)"\x00"!=A&&(r=""+A),a.append(r);c=null;if(!d&&(5==q.size()||6==q.size()))c=this.sortInorganic(b,q);for(t=0;t<q.size();t++)v=q.get(t),v!==p&&(z=v.getOtherAtomNode(b),d=this.getRingCache(e,z.getIndex(),this.htRings),r=J.smiles.SmilesBond.getBondOrderString(v.order),u||(A=this.getBondStereochemistry(v,b),"\x00"!=A&&(r=""+A)),s.append(r),s.append(d),7>
w&&(x[w++]=z),null!=l&&5>k&&(l[k++]=z));if(g&&2==w&&2==y&&3==h.getCovalentBondCount()){r=h.getEdges();for(k=0;k<r.length;k++)r[k].isCovalent()&&h.getBondedAtomIndex(k)!=e&&(x[w++]=this.atoms[h.getBondedAtomIndex(k)]);k=0}else null!=h&&7>w&&(x[w++]=h);g=b.getValence();q=b.getFormalCharge();d=b.getIsotopeNumber();t=b.getAtomName();r=b.getBioStructureTypeName();J.util.Logger.debugging&&a.append("\n//* "+b+" *//\t");f&&0!=r.length&&0!=t.length?this.addBracketedBioName(a,b,"."+t):a.append(J.smiles.SmilesAtom.getAtomLabel(m,
d,g,q,n,j,null!=c?c:this.checkStereoPairs(b,e,x,w)));a.appendSB(s);if(null==p)return null;2==y&&(1==k||2==k)?(null==l[0]&&(l[0]=b),null==l[1]&&(l[1]=b)):l=null;this.prevSp2Atoms=l;this.prevAtom=b;return h},$fz.isPrivate=!0,$fz),"JU.SB,J.util.JmolNode,~B,~B");$_M(c$,"sortInorganic",($fz=function(a,b){for(var c=a.getIndex(),d=b.size(),e=new JU.List,f=new JU.List,h,j,g,l,k=new JU.BS,m=null,n=Array(6),m=!0,q="",p=0;p<d;p++)if(g=b.get(p),n[0]=h=g.getOtherAtomNode(a),0==p?q=this.addStereoCheck(c,n,0,""):
m&&null!=this.addStereoCheck(c,n,0,q)&&(m=!1),!k.get(p)){k.set(p);for(var s=!1,r=p+1;r<d;r++)if(!k.get(r)&&(l=b.get(r),j=l.getOtherAtomNode(a),J.smiles.SmilesSearch.isDiaxial(a,a,h,j,this.vTemp,-0.95))){e.addLast([g,l]);s=!0;k.set(r);break}s||f.addLast(g)}c=e.size();if(m||6==d&&3!=c||5==d&&0==c)return"";m=e.get(0);g=m[0];n[0]=g.getOtherAtomNode(a);b.clear();b.addLast(g);1<c&&f.addLast(e.get(1)[0]);3==c&&f.addLast(e.get(2)[0]);1<c&&f.addLast(e.get(1)[1]);3==c&&f.addLast(e.get(2)[1]);for(p=0;p<f.size();p++)g=
f.get(p),b.addLast(g),n[p+1]=g.getOtherAtomNode(a);b.addLast(m[1]);return J.smiles.SmilesGenerator.getStereoFlag(a,n,d,this.vTemp)},$fz.isPrivate=!0,$fz),"J.util.JmolNode,JU.List");$_M(c$,"checkStereoPairs",($fz=function(a,b,c,d){if(4>d)return"";if(4==d&&6==a.getElementNumber())for(var e="",f=0;4>f;f++)if(null==(e=this.addStereoCheck(b,c,f,e))){d=10;break}return 6<d?"":J.smiles.SmilesGenerator.getStereoFlag(a,c,d,this.vTemp)},$fz.isPrivate=!0,$fz),"J.util.JmolNode,~N,~A,~N");c$.getStereoFlag=$_M(c$,
"getStereoFlag",($fz=function(a,b,c,d){var e=b[0],f=b[1],h=b[2],j=b[3],g=b[4];b=b[5];var l=4;switch(c){default:case 5:case 6:return J.smiles.SmilesSearch.checkStereochemistryAll(!1,a,l,1,e,f,h,j,g,b,d)?"@":"@@";case 2:case 4:if(null==h||null==j)break;c=J.smiles.SmilesAromatic.getNormalThroughPoints(e,f,h,d.vTemp,d.vA,d.vB);if(0.2>Math.abs(J.smiles.SmilesSearch.distanceToPlane(d.vTemp,c,j))){l=8;if(J.smiles.SmilesSearch.checkStereochemistryAll(!1,a,l,1,e,f,h,j,g,b,d))return"@SP1";if(J.smiles.SmilesSearch.checkStereochemistryAll(!1,
a,l,2,e,f,h,j,g,b,d))return"@SP2";if(J.smiles.SmilesSearch.checkStereochemistryAll(!1,a,l,3,e,f,h,j,g,b,d))return"@SP3"}else return J.smiles.SmilesSearch.checkStereochemistryAll(!1,a,l,1,e,f,h,j,g,b,d)?"@":"@@"}return""},$fz.isPrivate=!0,$fz),"J.util.JmolNode,~A,~N,J.smiles.SmilesSearch.VTemp");$_M(c$,"addStereoCheck",($fz=function(a,b,c,d){var e=b[c].getAtomicAndIsotopeNumber(),f=b[c].getCovalentBondCount(),h=6==e?b[c].getCovalentHydrogenCount():0;if(6==e?4!=f||3!=h:1<f)return d;e=";"+e+"/"+h+"/"+
f+",";if(0<=d.indexOf(e)){if(3==h){for(e=h=0;e<f&&3>h;e++){var j=b[c].getBondedAtomIndex(e);j!=a&&(h+=this.atoms[j].getAtomicAndIsotopeNumber())}if(3<h)return d}return null}return d+e},$fz.isPrivate=!0,$fz),"~N,~A,~N,~S");$_M(c$,"getRingCache",($fz=function(a,b,c){var d=J.smiles.SmilesGenerator.getRingKey(a,b),e=c.get(d),e=null==e?null:e[0];null==e?(c.put(d,[e=J.smiles.SmilesParser.getRingPointer(++this.nPairs),Integer.$valueOf(b)]),J.util.Logger.debugging&&J.util.Logger.debug("adding for "+a+" ring key "+
this.nPairs+": "+d)):(c.remove(d),J.util.Logger.debugging&&J.util.Logger.debug("using ring key "+d));return e},$fz.isPrivate=!0,$fz),"~N,~N,java.util.Map");$_M(c$,"dumpRingKeys",($fz=function(a,b){J.util.Logger.info(a.toString()+"\n\n");for(var c,d=b.keySet().iterator();d.hasNext()&&((c=d.next())||1);)J.util.Logger.info("unmatched ring key: "+c)},$fz.isPrivate=!0,$fz),"JU.SB,java.util.Map");c$.getRingKey=$_M(c$,"getRingKey",function(a,b){return Math.min(a,b)+"_"+Math.max(a,b)},"~N,~N")});Clazz.declarePackage("J.smiles");
Clazz.load(null,"J.smiles.SmilesAromatic",["JU.BS","$.V3"],function(){c$=Clazz.declareType(J.smiles,"SmilesAromatic");c$.isFlatSp2Ring=$_M(c$,"isFlatSp2Ring",function(a,b,c,d){for(var e=c.nextSetBit(0);0<=e;e=c.nextSetBit(e+1)){var f=a[e],h=f.getEdges();if(!(3>h.length)&&3<h.length)return!1}if(3.4028235E38==d)return!0;0>=d&&(d=0.01);for(var j=new JU.V3,g=new JU.V3,l=new JU.V3,k=null,e=c.cardinality(),m=Array(2*e),n=0,q=1-5*d,e=c.nextSetBit(0);0<=e;e=c.nextSetBit(e+1)){for(var f=a[e],h=f.getEdges(),
p=-1,s=-1,r=-1,h=h.length;0<=--h;){var u=f.getBondedAtomIndex(h);b.get(u)&&(c.get(u)?0>s?s=u:r=u:p=u)}J.smiles.SmilesAromatic.getNormalThroughPoints(a[s],a[e],a[r],j,g,l);null==k&&(k=new JU.V3);if(!J.smiles.SmilesAromatic.addNormal(j,k,q))return!1;m[n++]=JU.V3.newV(j);if(0<=p){J.smiles.SmilesAromatic.getNormalThroughPoints(a[s],a[p],a[r],j,g,l);if(!J.smiles.SmilesAromatic.addNormal(j,k,q))return!1;m[n++]=JU.V3.newV(j)}}return J.smiles.SmilesAromatic.checkStandardDeviation(m,k,n,d)},"~A,JU.BS,JU.BS,~N");
c$.addNormal=$_M(c$,"addNormal",($fz=function(a,b,c){var d=b.dot(a);if(0!=d&&Math.abs(d)<c)return!1;0>d&&a.scale(-1);b.add(a);b.normalize();return!0},$fz.isPrivate=!0,$fz),"JU.V3,JU.V3,~N");c$.checkStandardDeviation=$_M(c$,"checkStandardDeviation",($fz=function(a,b,c,d){for(var e=0,f=0,h=0;h<c;h++)var j=a[h].dot(b),e=e+j,f=f+j*j;e=Math.sqrt((f-e*e/c)/(c-1));return e<d},$fz.isPrivate=!0,$fz),"~A,JU.V3,~N,~N");c$.getNormalThroughPoints=$_M(c$,"getNormalThroughPoints",function(a,b,c,d,e,f){e.sub2(b,
a);f.sub2(c,a);d.cross(e,f);d.normalize();e.setT(a);return-e.dot(d)},"J.util.JmolNode,J.util.JmolNode,J.util.JmolNode,JU.V3,JU.V3,JU.V3");c$.checkAromaticDefined=$_M(c$,"checkAromaticDefined",function(a,b){for(var c=new JU.BS,d=b.nextSetBit(0);0<=d;d=b.nextSetBit(d+1))for(var e=a[d].getEdges(),f=0;f<e.length;f++)switch(e[f].order){case 515:case 514:case 513:c.set(e[f].getAtomIndex1()),c.set(e[f].getAtomIndex2())}return c},"~A,JU.BS");c$.checkAromaticStrict=$_M(c$,"checkAromaticStrict",function(a,
b,c,d){for(var e=new JU.BS,f=new JU.BS,h=c.size();0<=--h;){var j=c.get(h);J.smiles.SmilesAromatic.isAromaticRing(b,f,j,5)&&J.smiles.SmilesAromatic.checkAromaticStrict2(a,e,c,d,j,!0)}for(h=d.size();0<=--h;)j=d.get(h),J.smiles.SmilesAromatic.isAromaticRing(b,f,j,6)&&J.smiles.SmilesAromatic.checkAromaticStrict2(a,e,c,d,j,!1);b.clearAll();b.or(e)},"~A,JU.BS,JU.List,JU.List");c$.isAromaticRing=$_M(c$,"isAromaticRing",($fz=function(a,b,c,d){b.clearAll();b.or(c);b.and(a);return b.cardinality()==d},$fz.isPrivate=
!0,$fz),"JU.BS,JU.BS,JU.BS,~N");c$.checkAromaticStrict2=$_M(c$,"checkAromaticStrict2",($fz=function(a,b,c,d,e,f){f=J.smiles.SmilesAromatic.countInternalPairs(a,e,f)<<1;switch(f){case -3:break;default:for(var h=e.nextSetBit(0);0<=h;h=e.nextSetBit(h+1))for(var j=a[h].getEdges(),g=0;g<j.length;g++)if(2==j[g].order){var l=j[g].getOtherAtomNode(a[h]).getIndex();if(!e.get(l)){for(var k=!1,m=c.size();0<=--m&&!k;){var n=c.get(m);if(n.get(l)&&(b.get(l)||3==Math.abs(J.smiles.SmilesAromatic.countInternalPairs(a,
n,!0))))k=!0}for(m=d.size();0<=--m&&!k;)if(n=d.get(m),n.get(l)&&(b.get(l)||3==Math.abs(J.smiles.SmilesAromatic.countInternalPairs(a,n,!1))))k=!0;if(!k)return;f++}}}6==f&&b.or(e)},$fz.isPrivate=!0,$fz),"~A,JU.BS,JU.List,JU.List,JU.BS,~B");c$.countInternalPairs=$_M(c$,"countInternalPairs",($fz=function(a,b,c){for(var d=0,e=0,f=0,h=b.nextSetBit(0);0<=h;h=b.nextSetBit(h+1)){for(var j=a[h],g=j.getEdges(),l=!1,k=0;k<g.length;k++){var m=g[k].getOtherAtomNode(j).getIndex();if(b.get(m))switch(g[k].order){case 514:case 513:case 515:e++;
break;case 2:d++,l=!0}}if(c&&0==e)switch(j.getElementNumber()){case 7:case 8:case 16:l||f++}}return 0==e?Clazz.doubleToInt(d/2)+f:e==(c?5:6)?-3:0},$fz.isPrivate=!0,$fz),"~A,JU.BS,~B")});Clazz.declarePackage("J.smiles");
Clazz.load(["JU.P3","J.util.JmolNode"],"J.smiles.SmilesAtom",["JU.ArrayUtil","J.util.Elements","$.Logger"],function(){c$=Clazz.decorateAsClass(function(){this.atomsOr=null;this.nAtomsOr=0;this.primitives=null;this.index=this.nPrimitives=0;this.residueChar=this.residueName=this.atomName=null;this.isBioAtom=!1;this.bioType="\x00";this.$isLeadAtom=!1;this.notBondedIndex=-1;this.notCrossLinked=!1;this.aromaticAmbiguous=!0;this.atomType=null;this.covalentHydrogenCount=-1;this.hasSymbol=this.selected=this.not=
!1;this.isFirst=!0;this.jmolIndex=-1;this.elementNumber=-2;this.implicitHydrogenCount=this.missingHydrogenCount=-2147483648;this.bonds=this.parent=null;this.iNested=this.bondCount=0;this.charge=this.atomicMass=-2147483648;this.matchingAtom=-1;this.chiralOrder=this.chiralClass=-2147483648;this.$isAromatic=!1;this.atomSite=this.component=0;this.nonhydrogenDegree=this.degree=-1;this.valence=0;this.connectivity=-1;this.ringSize=this.ringMembership=-2147483648;this.ringConnectivity=-1;Clazz.instantialize(this,
arguments)},J.smiles,"SmilesAtom",JU.P3,J.util.JmolNode);Clazz.prepareFields(c$,function(){this.bonds=Array(4)});c$.getChiralityClass=$_M(c$,"getChiralityClass",function(a){return Clazz.doubleToInt(("0;11;AL;33;TH;TP;OH;77;SP;".indexOf(a)+1)/3)},"~S");c$.allowSmilesUnbracketed=$_M(c$,"allowSmilesUnbracketed",function(a){return 0<="B, C, N, O, P, S, F, Cl, Br, I,".indexOf(a+",")},"~S");$_M(c$,"setBioAtom",function(a){this.isBioAtom="\x00"!=a;this.bioType=a;null!=this.parent&&(this.parent.bioType=a,
this.parent.isBioAtom=this.isBioAtom)},"~S");$_M(c$,"setAtomName",function(a){null!=a&&(0<a.length&&(this.atomName=a),a.equals("0")&&(this.$isLeadAtom=!0),null!=this.parent&&(this.parent.atomName=a))},"~S");$_M(c$,"setBonds",function(a){this.bonds=a},"~A");$_M(c$,"addAtomOr",function(){null==this.atomsOr&&(this.atomsOr=Array(2));this.nAtomsOr>=this.atomsOr.length&&(this.atomsOr=JU.ArrayUtil.doubleLength(this.atomsOr));var a=(new J.smiles.SmilesAtom).setIndex(this.index);a.parent=this;this.atomsOr[this.nAtomsOr]=
a;this.nAtomsOr++;return a});$_M(c$,"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 J.smiles.SmilesAtom).setIndex(this.index);a.parent=this;this.primitives[this.nPrimitives]=a;this.setSymbol("*");this.hasSymbol=!1;this.nPrimitives++;return a});Clazz.overrideMethod(c$,"toString",function(){var a=null!=
this.residueChar||null!=this.residueName?(null==this.residueChar?this.residueName:this.residueChar)+"."+this.atomName:-1==this.elementNumber?"A":-2==this.elementNumber?"*":J.util.Elements.elementSymbolFromNumber(this.elementNumber);this.$isAromatic&&(a=a.toLowerCase());return"["+a+"."+this.index+(0<=this.matchingAtom?"("+this.matchingAtom+")":"")+"]"});$_M(c$,"setIndex",function(a){this.index=a;return this},"~N");$_M(c$,"setAll",function(a,b,c,d,e){this.component=a;this.index=b;this.atomSite=c;this.elementNumber=
d;this.charge=e;return this},"~N,~N,~N,~N,~N");$_M(c$,"setHydrogenCount",function(){if(-2147483648!=this.missingHydrogenCount)return!0;var a=J.smiles.SmilesAtom.getDefaultCount(this.elementNumber,this.$isAromatic);if(-2==a)return!1;if(-1==a)return!0;7==this.elementNumber&&this.$isAromatic&&2==this.bondCount&&1==this.bonds[0].order&&1==this.bonds[1].order&&a++;for(var b=0;b<this.bondCount;b++)switch(this.bonds[b].order){case 81:7==this.elementNumber&&J.util.Logger.info("Ambiguous bonding to aromatic N found -- MF may be in error");
a-=1;break;case 1:case 257:case 513:a-=1;break;case 2:a-=this.$isAromatic&&6==this.elementNumber?1:2;break;case 3:a-=3}0<a&&(this.missingHydrogenCount=a);return!0},"J.smiles.SmilesSearch");c$.getDefaultCount=$_M(c$,"getDefaultCount",function(a,b){switch(a){case 0:case -1:return-1;case 6:return b?3:4;case 8:case 16:return 2;case 7:return b?2:3;case 5:case 15:return 3;case 9:case 17:case 35:case 53:return 1}return-2},"~N,~B");Clazz.overrideMethod(c$,"getIndex",function(){return this.index});$_M(c$,
"isAromatic",function(){return this.$isAromatic});$_M(c$,"setSymbol",function(a){this.$isAromatic=a.equals(a.toLowerCase());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=J.util.Elements.elementNumberFromSymbol(a,
!0);return 0!=this.elementNumber},"~S");Clazz.overrideMethod(c$,"getElementNumber",function(){return this.elementNumber});$_M(c$,"getAtomicMass",function(){return this.atomicMass});$_M(c$,"setAtomicMass",function(a){this.atomicMass=a},"~N");$_M(c$,"getCharge",function(){return this.charge});$_M(c$,"setCharge",function(a){this.charge=a},"~N");$_M(c$,"getMatchingAtom",function(){return this.matchingAtom});$_M(c$,"setMatchingAtom",function(a){this.matchingAtom=a},"~N");$_M(c$,"getChiralClass",function(){return this.chiralClass});
$_M(c$,"setChiralClass",function(a){this.chiralClass=a},"~N");$_M(c$,"getChiralOrder",function(){return this.chiralOrder});$_M(c$,"setChiralOrder",function(a){this.chiralOrder=a},"~N");$_M(c$,"setExplicitHydrogenCount",function(a){this.missingHydrogenCount=a},"~N");$_M(c$,"setImplicitHydrogenCount",function(a){this.implicitHydrogenCount=a},"~N");$_M(c$,"setDegree",function(a){this.degree=a},"~N");$_M(c$,"setNonhydrogenDegree",function(a){this.nonhydrogenDegree=a},"~N");$_M(c$,"setValence",function(a){this.valence=
a},"~N");$_M(c$,"setConnectivity",function(a){this.connectivity=a},"~N");$_M(c$,"setRingMembership",function(a){this.ringMembership=a},"~N");$_M(c$,"setRingSize",function(a){this.ringSize=a},"~N");$_M(c$,"setRingConnectivity",function(a){this.ringConnectivity=a},"~N");Clazz.overrideMethod(c$,"getModelIndex",function(){return this.component});Clazz.overrideMethod(c$,"getAtomSite",function(){return this.atomSite});Clazz.overrideMethod(c$,"getImplicitHydrogenCount",function(){return 0});$_M(c$,"getExplicitHydrogenCount",
function(){return this.missingHydrogenCount});Clazz.overrideMethod(c$,"getFormalCharge",function(){return this.charge});Clazz.overrideMethod(c$,"getIsotopeNumber",function(){return this.atomicMass});Clazz.overrideMethod(c$,"getAtomicAndIsotopeNumber",function(){return J.util.Elements.getAtomicAndIsotopeNumber(this.elementNumber,this.atomicMass)});Clazz.overrideMethod(c$,"getAtomName",function(){return null==this.atomName?"":this.atomName});Clazz.overrideMethod(c$,"getGroup3",function(){return null==
this.residueName?"":this.residueName},"~B");Clazz.overrideMethod(c$,"getGroup1",function(){return null==this.residueChar?"":this.residueChar},"~S");$_M(c$,"addBond",function(a){this.bondCount>=this.bonds.length&&(this.bonds=JU.ArrayUtil.doubleLength(this.bonds));this.bonds[this.bondCount]=a;this.bondCount++},"J.smiles.SmilesBond");$_M(c$,"setBondArray",function(){this.bonds.length>this.bondCount&&(this.bonds=JU.ArrayUtil.arrayCopyObject(this.bonds,this.bondCount));null!=this.atomsOr&&this.atomsOr.length>
this.nAtomsOr&&(this.atomsOr=JU.ArrayUtil.arrayCopyObject(this.atomsOr,this.atomsOr.length));null!=this.primitives&&this.primitives.length>this.nPrimitives&&(this.primitives=JU.ArrayUtil.arrayCopyObject(this.primitives,this.primitives.length));for(var a=0;a<this.bonds.length;a++)this.isBioAtom&&17==this.bonds[a].order&&(this.bonds[a].order=112),this.bonds[a].getAtom1().index>this.bonds[a].getAtom2().index&&this.bonds[a].switchAtoms()});Clazz.overrideMethod(c$,"getEdges",function(){return null!=this.parent?
this.parent.getEdges():this.bonds});$_M(c$,"getBond",function(a){return null!=this.parent?this.parent.getBond(a):0<=a&&a<this.bondCount?this.bonds[a]:null},"~N");Clazz.overrideMethod(c$,"getCovalentBondCount",function(){return this.getBondCount()});$_M(c$,"getBondCount",function(){return null!=this.parent?this.parent.getCovalentBondCount():this.bondCount});$_M(c$,"getMatchingBondedAtom",function(a){if(null!=this.parent)return this.parent.getMatchingBondedAtom(a);if(a>=this.bondCount)return-1;a=this.bonds[a];
return(a.getAtom1()===this?a.getAtom2():a.getAtom1()).matchingAtom},"~N");Clazz.overrideMethod(c$,"getBondedAtomIndex",function(a){return null!=this.parent?this.parent.getBondedAtomIndex(a):this.bonds[a].getOtherAtom(this).index},"~N");Clazz.overrideMethod(c$,"getCovalentHydrogenCount",function(){if(0<=this.covalentHydrogenCount)return this.covalentHydrogenCount;if(null!=this.parent)return 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});Clazz.overrideMethod(c$,"getValence",function(){if(null!=this.parent)return this.parent.getValence();var a=this.valence;if(0>=a&&null!=this.bonds)for(var b=this.bonds.length;0<=--b;)a+=this.bonds[b].getValence();return this.valence=a});$_M(c$,"getBondTo",function(a){if(null!=this.parent)return this.parent.getBondTo(a);for(var b,c=0;c<this.bonds.length;c++)if(null!=(b=this.bonds[c]))if(null==a?b.getAtom2()===this:b.getOtherAtom(this)===
a)return b;return null},"J.smiles.SmilesAtom");$_M(c$,"getBondNotTo",function(a,b){for(var c,d=0;d<this.bonds.length;d++)if(null!=(c=this.bonds[d])){var e=c.getOtherAtom(this);if(a!==e&&(b||1!=e.elementNumber))return c}return null},"J.smiles.SmilesAtom,~B");Clazz.overrideMethod(c$,"isLeadAtom",function(){return this.$isLeadAtom});Clazz.overrideMethod(c$,"getOffsetResidueAtom",function(){if(this.isBioAtom)for(var a=0;a<this.bonds.length;a++)if(this.bonds[a].getAtomIndex1()==this.index&&96==this.bonds[a].order)return this.bonds[a].getOtherAtom(this).index;
return-1},"~S,~N");Clazz.overrideMethod(c$,"getGroupBits",function(a){a.set(this.index)},"JU.BS");Clazz.overrideMethod(c$,"isCrossLinked",function(a){return this.getBondTo(a).isHydrogen()},"J.util.JmolNode");Clazz.overrideMethod(c$,"getCrossLinkLeadAtomIndexes",function(a){for(var b=0;b<this.bonds.length;b++)112==this.bonds[b].order&&a.addLast(Integer.$valueOf(this.bonds[b].getOtherAtom(this).index));return!0},"JU.List");Clazz.overrideMethod(c$,"getBioStructureTypeName",function(){return null});Clazz.overrideMethod(c$,
"getResno",function(){return 0});Clazz.overrideMethod(c$,"getChainID",function(){return 0});Clazz.overrideMethod(c$,"getChainIDStr",function(){return""});c$.getAtomLabel=$_M(c$,"getAtomLabel",function(a,b,c,d,e,f,h){var j=J.util.Elements.elementSymbolFromNumber(a);f&&(j=j.toLowerCase(),6!=a&&(c=2147483647));return(0<h.length||0!=b||0!=d?-1:J.smiles.SmilesAtom.getDefaultCount(a,!1))==c?j:"["+(0>=b?"":""+b)+j+(0>d?""+d:0<d?"+"+d:"")+h+(1<e?"H"+e:1==e?"H":"")+"]"},"~N,~N,~N,~N,~N,~B,~S");Clazz.overrideMethod(c$,
"isDna",function(){return"d"==this.bioType});Clazz.overrideMethod(c$,"isRna",function(){return"r"==this.bioType});Clazz.overrideMethod(c$,"isNucleic",function(){return"n"==this.bioType||"r"==this.bioType||"d"==this.bioType});Clazz.overrideMethod(c$,"isProtein",function(){return"p"==this.bioType});Clazz.overrideMethod(c$,"isPurine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="AG".indexOf(this.residueChar)});Clazz.overrideMethod(c$,"isPyrimidine",function(){return null!=this.residueChar&&
this.isNucleic()&&0<="CTUI".indexOf(this.residueChar)});Clazz.overrideMethod(c$,"isDeleted",function(){return!1});$_M(c$,"setAtomType",function(a){this.atomType=a},"~S");Clazz.overrideMethod(c$,"getAtomType",function(){return null==this.atomType?this.atomName:this.atomType});Clazz.overrideMethod(c$,"findAtomsLike",function(){return null},"~S");Clazz.defineStatics(c$,"STEREOCHEMISTRY_DEFAULT",0,"STEREOCHEMISTRY_ALLENE",2,"STEREOCHEMISTRY_TETRAHEDRAL",4,"STEREOCHEMISTRY_TRIGONAL_BIPYRAMIDAL",5,"STEREOCHEMISTRY_OCTAHEDRAL",
6,"STEREOCHEMISTRY_SQUARE_PLANAR",8,"UNBRACKETED_SET","B, C, N, O, P, S, F, Cl, Br, I,")});Clazz.declarePackage("J.smiles");
Clazz.load(["J.util.JmolEdge"],"J.smiles.SmilesBond",["J.smiles.InvalidSmilesException"],function(){c$=Clazz.decorateAsClass(function(){this.atom2=this.atom1=null;this.isNot=!1;this.primitives=this.matchingBond=null;this.nPrimitives=0;this.bondsOr=null;this.nBondsOr=0;Clazz.instantialize(this,arguments)},J.smiles,"SmilesBond",J.util.JmolEdge);c$.getBondOrderString=$_M(c$,"getBondOrderString",function(a){switch(a){case 1:return"";case 2:return"=";case 3:return"#";default:return""}},"~N");$_M(c$,"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},"J.smiles.SmilesBond");$_M(c$,"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 J.smiles.SmilesBond(null,null,-1,!1);this.bondsOr[this.nBondsOr]=a;this.nBondsOr++;return a});
$_M(c$,"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 J.smiles.SmilesBond(null,null,-1,!1);this.primitives[this.nPrimitives]=a;this.nPrimitives++;return a});Clazz.overrideMethod(c$,"toString",function(){return this.atom1+" -"+(this.isNot?"!":"")+this.order+"- "+this.atom2});Clazz.makeConstructor(c$,function(a,
b,c,d){Clazz.superConstructor(this,J.smiles.SmilesBond,[]);this.set2(c,d);this.set2a(a,b)},"J.smiles.SmilesAtom,J.smiles.SmilesAtom,~N,~B");$_M(c$,"set2",function(a,b){this.order=a;this.isNot=b},"~N,~B");$_M(c$,"set2a",function(a,b){null!=a&&(this.atom1=a,a.addBond(this));null!=b&&(this.atom2=b,b.isFirst=!1,b.addBond(this))},"J.smiles.SmilesAtom,J.smiles.SmilesAtom");c$.isBondType=$_M(c$,"isBondType",function(a,b,c){if(0>"-=#:/\\.+!,&;@~^'".indexOf(a))return!1;if(!b&&0>"-=#:/\\.~^'".indexOf(a))throw new J.smiles.InvalidSmilesException("SMARTS bond type "+
a+" not allowed in SMILES");return c&&"~"==a?!1:!0},"~S,~B,~B");c$.getBondTypeFromCode=$_M(c$,"getBondTypeFromCode",function(a){switch(a){case ".":return 0;case "-":return 1;case "=":return 2;case "#":return 3;case ":":return 17;case "/":return 257;case "\\":return 513;case "^":return 769;case "'":return 1025;case "@":return 65;case "~":return 81;case "+":return 96}return-1},"~S");$_M(c$,"getAtom1",function(){return this.atom1});$_M(c$,"getAtom2",function(){return this.atom2});$_M(c$,"setAtom2",function(a){this.atom2=
a;null!=this.atom2&&a.addBond(this)},"J.smiles.SmilesAtom");$_M(c$,"getBondType",function(){return this.order});$_M(c$,"getOtherAtom",function(a){return this.atom1===a?this.atom2:this.atom1},"J.smiles.SmilesAtom");Clazz.overrideMethod(c$,"getAtomIndex1",function(){return this.atom1.index});Clazz.overrideMethod(c$,"getAtomIndex2",function(){return this.atom2.index});Clazz.overrideMethod(c$,"getCovalentOrder",function(){return this.order});Clazz.overrideMethod(c$,"getOtherAtomNode",function(a){return a===
this.atom1?this.atom2:a===this.atom2?this.atom1:null},"J.util.JmolNode");Clazz.overrideMethod(c$,"isCovalent",function(){return 112!=this.order});$_M(c$,"getValence",function(){return this.order&7});Clazz.overrideMethod(c$,"isHydrogen",function(){return 112==this.order});$_M(c$,"switchAtoms",function(){var a=this.atom1;this.atom1=this.atom2;this.atom2=a;switch(this.order){case 769:this.order=1025;break;case 1025:this.order=769;break;case 257:this.order=513;break;case 513:this.order=257}});Clazz.defineStatics(c$,
"TYPE_UNKNOWN",-1,"TYPE_NONE",0,"TYPE_SINGLE",1,"TYPE_DOUBLE",2,"TYPE_TRIPLE",3,"TYPE_AROMATIC",17,"TYPE_DIRECTIONAL_1",257,"TYPE_DIRECTIONAL_2",513,"TYPE_ATROPISOMER_1",769,"TYPE_ATROPISOMER_2",1025,"TYPE_RING",65,"TYPE_ANY",81,"TYPE_BIO_SEQUENCE",96,"TYPE_BIO_PAIR",112,"TYPE_MULTIPLE",999)});Clazz.declarePackage("J.smiles");
c$=Clazz.decorateAsClass(function(){this.search=null;this.index=this.type=this.nPoints=0;this.isNot=!1;this.indices=null;this.max=this.min=0;this.points=null;Clazz.instantialize(this,arguments)},J.smiles,"SmilesMeasure");Clazz.prepareFields(c$,function(){this.indices=Clazz.newIntArray(4,0);this.points=Array(4)});Clazz.makeConstructor(c$,function(a,b,c,d,e,f){this.search=a;this.type=Math.min(4,Math.max(c,2));this.index=b;this.min=Math.min(d,e);this.max=Math.max(d,e);this.isNot=f},"J.smiles.SmilesSearch,~N,~N,~N,~N,~B");
Clazz.overrideMethod(c$,"toString",function(){for(var a="(."+"__dat".charAt(this.type)+this.index+":"+this.min+","+this.max+") for",b=0;b<this.type;b++)a+=" "+(b>=this.nPoints?"?":""+this.indices[b]);return a});$_M(c$,"addPoint",function(a){if(this.nPoints==this.type)return!1;if(0==this.nPoints)for(var b=1;b<this.type;b++)this.indices[b]=a+b;this.indices[this.nPoints++]=a;return!0},"~N");
$_M(c$,"check",function(){for(var a=0;a<this.type;a++){var b=this.search.patternAtoms[this.indices[a]].getMatchingAtom();this.points[a]=this.search.jmolAtoms[b]}a=0;switch(this.type){case 2:a=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]);a=this.search.v.vA.angle(this.search.v.vB)/0.017453292;break;case 4:J.smiles.SmilesMeasure.setTorsionData(this.points[0],this.points[1],this.points[2],
this.points[3],this.search.v,!0),a=this.search.v.vTemp1.angle(this.search.v.vTemp2)/0.017453292*(0>this.search.v.vNorm1.dot(this.search.v.vNorm2)?1:-1)}return(a<this.min||a>this.max)==this.isNot});
c$.setTorsionData=$_M(c$,"setTorsionData",function(a,b,c,d,e,f){e.vTemp1.setT(a);e.vTemp1.sub(b);e.vTemp2.setT(d);e.vTemp2.sub(c);f&&(e.vNorm1.setT(b),e.vNorm1.sub(c),e.vNorm1.normalize(),e.vTemp1.cross(e.vTemp1,e.vNorm1),e.vTemp1.normalize(),e.vTemp2.cross(e.vTemp2,e.vNorm1),e.vTemp2.normalize(),e.vNorm2.cross(e.vTemp1,e.vTemp2))},"JU.P3,JU.P3,JU.P3,JU.P3,J.smiles.SmilesSearch.VTemp,~B");Clazz.defineStatics(c$,"TYPES","__dat","radiansPerDegree",0.017453292519943295);Clazz.declarePackage("J.smiles");
Clazz.load(["java.util.Hashtable"],"J.smiles.SmilesParser","java.lang.Character JU.List $.ParserJS $.SB J.smiles.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesSearch J.util.Elements $.Logger $.Parser $.Txt".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.isBioSequence=this.isSmarts=!1;this.bioType="\x00";this.ringBonds=null;this.flags=this.branchLevel=this.braceCount=0;this.htMeasures=null;Clazz.instantialize(this,arguments)},J.smiles,"SmilesParser");Clazz.prepareFields(c$,
function(){this.ringBonds=new java.util.Hashtable;this.htMeasures=new java.util.Hashtable});c$.getMolecule=$_M(c$,"getMolecule",function(a,b){return(new J.smiles.SmilesParser(b)).parse(a)},"~S,~B");Clazz.makeConstructor(c$,function(a){this.isSmarts=a},"~B");$_M(c$,"reset",function(){this.branchLevel=this.braceCount=0});$_M(c$,"parse",function(a){if(null==a)throw new J.smiles.InvalidSmilesException("SMILES expressions must not be null");var b=new J.smiles.SmilesSearch;0<=a.indexOf("$(select")&&(a=
this.parseNested(b,a,"select"));for(a=J.smiles.SmilesParser.cleanPattern(a);a.startsWith("/");){var c=J.smiles.SmilesParser.getSubPattern(a,0,"/").toUpperCase();a=a.substring(c.length);this.flags=0;0<=c.indexOf("NOAROMATIC")&&(this.flags|=1);0<=c.indexOf("AROMATICSTRICT")&&(this.flags|=4);0<=c.indexOf("AROMATICDEFINED")&&(this.flags|=8);0<=c.indexOf("AROMATICDOUBLE")&&(this.flags|=16);0<=c.indexOf("NOSTEREO")&&(this.flags|=2)}0<=a.indexOf("$")&&(a=this.parseVariables(a));this.isSmarts&&0<=a.indexOf("[$")&&
(a=this.parseVariableLength(a));if(0<=a.indexOf("||")){a=J.util.Txt.split(a,"||");c="";b.subSearches=Array(a.length);for(var d=0;d<a.length;d++){var e="|"+a[d]+"|";0>c.indexOf(e)&&(b.subSearches[d]=this.getSearch(b,a[d],this.flags),c+=e)}J.util.Logger.info(c);return b}return this.getSearch(b,a,this.flags)},"~S");$_M(c$,"parseVariableLength",($fz=function(a){for(var b=new JU.SB,c=a.length-1,d=0,e=!1,f=0;f<c;f++)switch(a.charAt(f)){case "(":d++;break;case ")":d--;break;case "|":0<d&&(e=!0,"|"==a.charAt(f+
1)&&(a=a.substring(0,f)+a.substring(f+1),c--))}if(0<=a.indexOf("||")){c=J.util.Txt.split(a,"||");for(f=0;f<c.length;f++)b.append("||").append(this.parseVariableLength(c[f]))}else{c=-1;d=Clazz.newIntArray(1,0);for(f=null;0<=(c=a.indexOf("[$",c+1));){var h=c,j=-2147483648,g=-2147483648,c=J.smiles.SmilesParser.getDigits(a,c+2,d),j=d[0];-2147483648!=j&&"-"==J.smiles.SmilesParser.getChar(a,c)&&(c=J.smiles.SmilesParser.getDigits(a,c+1,d),g=d[0]);if("("==J.smiles.SmilesParser.getChar(a,c)&&(f=J.smiles.SmilesParser.getSubPattern(a,
h,"["),f.endsWith(")"))){var l=h+f.length+2,k=J.smiles.SmilesParser.getSubPattern(a,c,"("),m=c;J.smiles.SmilesParser.getSubPattern(a,c,"[");c+=1+k.length;if(0<=k.indexOf(":")&&0>k.indexOf("|")){for(var n=0,q=k.length,p=-1,f=0;f<q;f++)switch(k.charAt(f)){case "[":case "(":n++;break;case ")":case "]":n--;break;case ".":0<=p&&0==n&&(q=f);break;case ":":0>p&&0==n&&(p=f)}0<p&&(k=k.substring(0,p)+"("+k.substring(p,q)+")"+k.substring(q))}if(-2147483648==j){if(f=k.indexOf("|"),0<=f)return this.parseVariableLength(a.substring(0,
h)+"[$1"+a.substring(m,m+f+1)+")]"+a.substring(l)+"||"+a.substring(0,h)+"[$1("+a.substring(m+f+2)+a.substring(l))}else{-2147483648==g&&(g=j);0<=k.indexOf("|")&&(k="[$("+k+")]");for(f=j;f<=g;f++){j=new JU.SB;j.append("||").append(a.substring(0,h));for(m=0;m<f;m++)j.append(k);j.append(a.substring(l));b.appendSB(j)}}}}}return e?this.parseVariableLength(b.substring(2)):2>b.length()?a:b.substring(2)},$fz.isPrivate=!0,$fz),"~S");$_M(c$,"getSearch",function(a,b,c){this.htMeasures=new java.util.Hashtable;
var d=new J.smiles.SmilesSearch;d.setTop(a);d.isSmarts=this.isSmarts;d.pattern=b;d.flags=c;0<=b.indexOf("$(")&&(b=this.parseNested(d,b,""));this.parseSmiles(d,b,null,!1);if(0!=this.braceCount)throw new J.smiles.InvalidSmilesException("unmatched '{'");if(!this.ringBonds.isEmpty())throw new J.smiles.InvalidSmilesException("Open ring");d.setAtomArray();for(a=d.atomCount;0<=--a;)if(b=d.patternAtoms[a],b.setBondArray(),!this.isSmarts&&"\x00"==b.bioType&&!b.setHydrogenCount(d))throw new J.smiles.InvalidSmilesException("unbracketed atoms must be one of: B, C, N, O, P, S, F, Cl, Br, I,");
if(this.isSmarts)for(a=d.atomCount;0<=--a;){b=d.patternAtoms[a];this.checkNested(d,b,c);for(var e=0;e<b.nAtomsOr;e++)this.checkNested(d,b.atomsOr[e],c);for(e=0;e<b.nPrimitives;e++)this.checkNested(d,b.primitives[e],c)}!this.isSmarts&&!this.isBioSequence&&(d.elementCounts[1]=d.getMissingHydrogenCount());this.fixChirality(d);return d},"J.smiles.SmilesSearch,~S,~N");$_M(c$,"checkNested",($fz=function(a,b,c){if(0<b.iNested){var d=a.getNested(b.iNested);Clazz.instanceOf(d,String)&&!d.startsWith("select")&&
("~"!=d.charAt(0)&&"\x00"!=b.bioType&&(d="~"+b.bioType+"~"+d),c=this.getSearch(a,d,c),0<c.atomCount&&c.patternAtoms[0].selected&&(b.selected=!0),a.setNested(b.iNested,c))}},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,J.smiles.SmilesAtom,~N");$_M(c$,"fixChirality",($fz=function(a){for(var b=a.atomCount;0<=--b;){var c=a.patternAtoms[b],d=c.getChiralClass();if(-2147483648!=d){var e=c.missingHydrogenCount;0>e&&(e=0);e+=c.getBondCount();switch(d){case 0:switch(e){case 2:d=3==c.getValence()?3:2;break;
case 3:case 4:case 5:case 6:d=e}break;case 8:4!=e&&(d=0);break;case 2:case 6:case 4:case 5:e!=d&&(d=0)}if(0==d)throw new J.smiles.InvalidSmilesException("Incorrect number of bonds for stereochemistry descriptor");c.setChiralClass(d)}}},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch");$_M(c$,"parseSmiles",($fz=function(a,b,c,d){for(var e=Clazz.newIntArray(1,0),f=0,h,j=null;null!=b&&0!=b.length;){var g=0;if(null==c||null!=j&&0==j.order)this.isBioSequence&&(a.top.needAromatic=!1),g=this.checkBioType(b,
0);h=J.smiles.SmilesParser.getChar(b,g);var l=this.checkBrace(a,h,"{");l&&(h=J.smiles.SmilesParser.getChar(b,++g));if("("==h){d="."==J.smiles.SmilesParser.getChar(b,g+1);if(null==c)throw new J.smiles.InvalidSmilesException("No previous atom for "+(d?"measure":"branch"));g=J.smiles.SmilesParser.getSubPattern(b,g,"(");g.startsWith(".")?this.parseMeasure(a,g.substring(1),c):0==g.length&&this.isBioSequence?c.notCrossLinked=!0:(this.branchLevel++,this.parseSmiles(a,g,c,!0),this.branchLevel--);g=g.length+
2}else{for(f=g;J.smiles.SmilesBond.isBondType(h,this.isSmarts,this.isBioSequence);)h=J.smiles.SmilesParser.getChar(b,++g);j=this.parseBond(a,null,b.substring(f,g),null,c,!1,d);l&&-1!=j.order&&(g=f);h=J.smiles.SmilesParser.getChar(b,g);this.checkBrace(a,h,"{")&&(h=J.smiles.SmilesParser.getChar(b,++g));"~"==h&&0==j.order&&(g=this.checkBioType(b,g),h=J.smiles.SmilesParser.getChar(b,g));if("\x00"==h&&0==j.order)break;f=Character.isDigit(h)||"%"==h;l=!f&&("_"==h||"["==h||"*"==h||Character.isLetter(h));
if(f){switch(h){case "%":if("("==J.smiles.SmilesParser.getChar(b,g+1)){if(f=J.smiles.SmilesParser.getSubPattern(b,g+1,"("),J.smiles.SmilesParser.getDigits(f,0,e),g+=f.length+3,0>e[0])throw new J.smiles.InvalidSmilesException("Invalid ring designation: "+f);}else if(g+3<=b.length&&(g=J.smiles.SmilesParser.getDigits(b.substring(0,g+3),g+1,e)),10>e[0])throw new J.smiles.InvalidSmilesException("Two digits must follow the % sign");d=e[0];break;default:d=h.charCodeAt(0)-48,g++}this.parseRing(a,d,c,j)}else if(l)switch(h){case "[":case "_":f=
J.smiles.SmilesParser.getSubPattern(b,g,h);g+=f.length+("["==h?2:0);this.isBioSequence&&("["==h&&0>f.indexOf(".")&&0>f.indexOf("_"))&&(f+=".0");c=this.parseAtom(a,null,f,c,j,"["==h,!1,d);-1!=j.order&&0!=j.order&&j.set2a(null,c);break;default:f=!this.isBioSequence&&Character.isUpperCase(h)?J.smiles.SmilesParser.getChar(b,g+1):"\x00";if("X"!=h||"x"!=f)if(!Character.isLowerCase(f)||0==J.util.Elements.elementNumberFromSymbol(b.substring(g,g+2),!0))f="\x00";"\x00"!=f&&0<="NA CA BA PA SC AC".indexOf(b.substring(g,
g+2))&&(f="\x00");h=Character.isUpperCase(h)&&Character.isLowerCase(f)?2:1;c=this.parseAtom(a,null,b.substring(g,g+h),c,j,!1,!1,d);g+=h}else throw new J.smiles.InvalidSmilesException("Unexpected character: "+J.smiles.SmilesParser.getChar(b,g));}h=J.smiles.SmilesParser.getChar(b,g);"}"==h&&this.checkBrace(a,h,"}")&&g++;b=b.substring(g);d=!1}},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,~S,J.smiles.SmilesAtom,~B");$_M(c$,"checkBioType",($fz=function(a,b){if(this.isBioSequence="~"==a.charAt(b)){b++;
this.bioType="*";var c=J.smiles.SmilesParser.getChar(a,2);if("~"==c&&("*"==(c=a.charAt(1))||Character.isLowerCase(c)))this.bioType=c,b=3}return b},$fz.isPrivate=!0,$fz),"~S,~N");$_M(c$,"parseMeasure",($fz=function(a,b,c){for(var d=b.indexOf(":"),e=!1,f=0>d?b:b.substring(0,d);0!=d;){1==f.length&&(f+="0");var h=this.htMeasures.get(f);if(null==h==0>d)break;try{if(0<d){var j="__dat".indexOf(f.charAt(0));if(2>j)break;var g=Clazz.newIntArray(1,0),l=J.smiles.SmilesParser.getDigits(f,1,g),k=b.indexOf(",",
d);0>k&&(k=b.indexOf("-",d+1));if(0>k)break;var m=b.substring(d+1,k);m.startsWith("!")&&(e=!0,m=m.substring(1));var n=d+1==k?0:JU.ParserJS.fVal(m),m=b.substring(k+1),q=0==m.length?3.4028235E38:JU.ParserJS.fVal(m),h=new J.smiles.SmilesMeasure(a,l,j,n,q,e);a.measures.addLast(h);0<l?this.htMeasures.put(f,h):0==l&&J.util.Logger.debugging&&J.util.Logger.debug("measure created: "+h)}else{if(!h.addPoint(c.index))break;h.nPoints==h.type&&(this.htMeasures.remove(f),J.util.Logger.debugging&&J.util.Logger.debug("measure created: "+
h));return}if(!h.addPoint(c.index))break}catch(p){if(Clazz.exceptionOf(p,NumberFormatException))break;else throw p;}return}throw new J.smiles.InvalidSmilesException("invalid measure: "+b);},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,~S,J.smiles.SmilesAtom");$_M(c$,"checkBrace",($fz=function(a,b,c){switch(b){case "{":if(b!=c)break;this.braceCount++;return a.top.haveSelected=!0;case "}":if(b!=c)break;if(0<this.braceCount)return this.braceCount--,!0;break;default:return!1}throw new J.smiles.InvalidSmilesException("Unmatched '}'");
},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,~S,~S");$_M(c$,"parseNested",($fz=function(a,b,c){var d;for(c="$("+c;0<=(d=b.lastIndexOf(c));){var e=J.smiles.SmilesParser.getSubPattern(b,d+1,"("),f=d+e.length+3;b=b.substring(0,d)+"_"+a.addNested(e)+"_"+b.substring(f)}return b},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,~S,~S");$_M(c$,"parseVariables",($fz=function(a){for(var b=new JU.List,c=new JU.List,d,e=0,f=-1;0<=(d=a.indexOf("$",e))&&"("!=J.smiles.SmilesParser.getChar(a,e+1);){e=J.smiles.SmilesParser.skipTo(a,
d,"=");if(e<=d+1||'"'!=J.smiles.SmilesParser.getChar(a,e+1))break;d=a.substring(d,e);if(0<d.lastIndexOf("$")||0<d.indexOf("]"))throw new J.smiles.InvalidSmilesException("Invalid variable name: "+d);f=J.smiles.SmilesParser.getSubPattern(a,e+1,'"');b.addLast("["+d+"]");c.addLast(f);e+=f.length+2;e=J.smiles.SmilesParser.skipTo(a,e,";");f=++e}return 0>f?a:J.util.Txt.replaceStrings(a.substring(f),b,c)},$fz.isPrivate=!0,$fz),"~S");$_M(c$,"parseAtom",($fz=function(a,b,c,d,e,f,h,j){if(null==c||0==c.length)throw new J.smiles.InvalidSmilesException("Empty atom definition");
var g=null==b?a.addAtom():h?b.addPrimitive():b.addAtomOr();0<this.braceCount&&(g.selected=!0);if(!this.checkLogic(a,c,g,null,d,h,j)){var l=Clazz.newIntArray(1,0);this.isBioSequence&&1==c.length&&(c+=".0");var k=c.charAt(0),m=0,n=!1;if(this.isSmarts&&"!"==k){k=J.smiles.SmilesParser.getChar(c,++m);if("\x00"==k)throw new J.smiles.InvalidSmilesException("invalid '!'");g.not=n=!0}var q=-2147483648,p=c.indexOf(".");if(0<=p){k=c.substring(m,p);0==k.length&&(k="*");1<k.length?g.residueName=k.toUpperCase():
k.equals("*")||(g.residueChar=k);k=c.substring(p+1).toUpperCase();if(0<=(p=k.indexOf("#")))J.smiles.SmilesParser.getDigits(k,p+1,l),g.elementNumber=l[0],k=k.substring(0,p);0==k.length&&(k="*");k.equals("*")||g.setAtomName(k);k="\x00"}for(g.setBioAtom(this.bioType);"\x00"!=k;){g.setAtomName(this.isBioSequence?"0":"");if(Character.isDigit(k)){m=J.smiles.SmilesParser.getDigits(c,m,l);k=l[0];if(-2147483648==k)throw new J.smiles.InvalidSmilesException("Non numeric atomic mass");"?"==J.smiles.SmilesParser.getChar(c,
m)&&(m++,k=-k);g.setAtomicMass(k)}else switch(k){case '"':k=J.util.Parser.getQuotedStringAt(c,m);m+=k.length+2;g.setAtomType(k);break;case "_":m=J.smiles.SmilesParser.getDigits(c,m+1,l)+1;if(-2147483648==l[0])throw new J.smiles.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(m));g.iNested=l[0];if(this.isBioSequence&&f&&m!=c.length)throw new J.smiles.InvalidSmilesException("invalid characters: "+c.substring(m));break;case "=":m=J.smiles.SmilesParser.getDigits(c,m+1,l);g.jmolIndex=l[0];
break;case "#":m=J.smiles.SmilesParser.getDigits(c,m+1,l);g.elementNumber=l[0];break;case "-":case "+":m=this.checkCharge(c,m,g);break;case "@":a.haveAtomStereochemistry=!0;m=this.checkChirality(c,m,a.patternAtoms[g.index]);break;default:var p=J.smiles.SmilesParser.getChar(c,m+1),s=c.substring(m+1,m+(Character.isLowerCase(p)&&(!f||!Character.isDigit(J.smiles.SmilesParser.getChar(c,m+2)))?2:1)),r=Character.toUpperCase(k)+s,u=!0;f&&Character.isLetter(k)&&(!n&&(h?b:g).hasSymbol?u=!1:"H"==k?u=!Character.isDigit(p)||
"?"==J.smiles.SmilesParser.getChar(c,m+2):0<="DdhRrvXx".indexOf(k)&&Character.isDigit(p)?u=!1:!r.equals("A")&&!r.equals("Xx")&&(u=0<J.util.Elements.elementNumberFromSymbol(r,!0),!u&&""!==s&&(s="",r=r.substring(0,1),u=0<J.util.Elements.elementNumberFromSymbol(r,!0))));if(u){if(!f&&!this.isSmarts&&!this.isBioSequence&&!J.smiles.SmilesAtom.allowSmilesUnbracketed(r)||!g.setSymbol(r=k+s))throw new J.smiles.InvalidSmilesException("Invalid atom symbol: "+r);h&&(b.hasSymbol=!0);m+=r.length}else switch(m=
J.smiles.SmilesParser.getDigits(c,m+1,l),p=l[0],k){default:throw new J.smiles.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(m));case "D":g.setDegree(-2147483648==p?1:p);break;case "d":g.setNonhydrogenDegree(-2147483648==p?1:p);break;case "H":q=-2147483648==p?1:p;break;case "h":g.setImplicitHydrogenCount(-2147483648==p?-1:p);break;case "R":-2147483648==p&&(p=-1);g.setRingMembership(p);a.top.needRingData=!0;break;case "r":if(-2147483648==p)p=-1,g.setRingMembership(p);else{g.setRingSize(p);
switch(p){case 500:p=5;break;case 600:p=6}p>a.ringDataMax&&(a.ringDataMax=p)}a.top.needRingData=!0;break;case "v":g.setValence(-2147483648==p?1:p);break;case "X":g.setConnectivity(-2147483648==p?1:p);break;case "x":g.setRingConnectivity(-2147483648==p?-1:p),a.top.needRingData=!0}}k=J.smiles.SmilesParser.getChar(c,m);if(n&&"\x00"!=k)throw new J.smiles.InvalidSmilesException("'!' may only involve one primitive.");}-2147483648==q&&f&&(q=-2147483647);g.setExplicitHydrogenCount(q);a.patternAtoms[g.index].setExplicitHydrogenCount(q)}null!=
d&&0==e.order&&(g.notBondedIndex=d.index);null!=d&&0!=e.order&&(-1==e.order&&(e.order=this.isBioSequence&&j?112:this.isSmarts||d.isAromatic()&&g.isAromatic()?81:1),f||e.set2a(null,g),0==this.branchLevel&&(17==e.order||112==e.order)&&this.branchLevel++);0==this.branchLevel&&(a.lastChainAtom=g);return g},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,J.smiles.SmilesAtom,~S,J.smiles.SmilesAtom,J.smiles.SmilesBond,~B,~B,~B");$_M(c$,"parseRing",($fz=function(a,b,c,d){a=Integer.$valueOf(b);b=this.ringBonds.get(a);
if(null==b)this.ringBonds.put(a,d);else{this.ringBonds.remove(a);switch(d.order){case -1:d.order=-1!=b.order?b.order:this.isSmarts||c.isAromatic()&&b.getAtom1().isAromatic()?81:1;break;case 257:d.order=513;break;case 513:d.order=257}if(-1!=b.order&&b.order!=d.order)throw new J.smiles.InvalidSmilesException("Incoherent bond type for ring");b.set(d);c.bondCount--;b.setAtom2(c)}},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,~N,J.smiles.SmilesAtom,J.smiles.SmilesBond");$_M(c$,"checkCharge",($fz=function(a,
b,c){var d=a.length,e=a.charAt(b),f=1;++b;if(b<d){var h=a.charAt(b);if(Character.isDigit(h)){if(d=Clazz.newIntArray(1,0),b=J.smiles.SmilesParser.getDigits(a,b,d),f=d[0],-2147483648==f)throw new J.smiles.InvalidSmilesException("Non numeric charge");}else for(;b<d&&a.charAt(b)==e;)b++,f++}c.setCharge("+"==e?f:-f);return b},$fz.isPrivate=!0,$fz),"~S,~N,J.smiles.SmilesAtom");$_M(c$,"checkChirality",($fz=function(a,b,c){var d=0,e=-2147483648,f=a.length,h,d=0,e=1;if(++b<f){switch(h=a.charAt(b)){case "@":e=
2;b++;break;case "H":break;case "A":case "D":case "E":case "O":case "S":case "T":d=b+1<f?J.smiles.SmilesAtom.getChiralityClass(a.substring(b,b+2)):-1;b+=2;break;default:e=Character.isDigit(h)?1:-1}h=b;if(1==e){for(;h<f&&Character.isDigit(a.charAt(h));)h++;if(h>b){try{e=Integer.parseInt(a.substring(b,h))}catch(j){if(Clazz.exceptionOf(j,NumberFormatException))e=-1;else throw j;}b=h}}if(1>e||0>d)throw new J.smiles.InvalidSmilesException("Invalid stereochemistry descriptor");}c.setChiralClass(d);c.setChiralOrder(e);
"?"==J.smiles.SmilesParser.getChar(a,b)&&(J.util.Logger.info("Ignoring '?' in stereochemistry"),b++);return b},$fz.isPrivate=!0,$fz),"~S,~N,J.smiles.SmilesAtom");$_M(c$,"parseBond",($fz=function(a,b,c,d,e,f,h){var j=J.smiles.SmilesParser.getChar(c,0);if("."==j){if(null!=d||null!=b)throw new J.smiles.InvalidSmilesException("invalid '.'");this.isBioSequence="~"==J.smiles.SmilesParser.getChar(c,1);return new J.smiles.SmilesBond(null,null,0,!1)}if("+"==j&&null!=b)throw new J.smiles.InvalidSmilesException("invalid '+'");
d=null==b?null==d?new J.smiles.SmilesBond(e,null,this.isBioSequence&&null!=e?h?112:96:-1,!1):d:f?b.addPrimitive():b.addBondOr();if("\x00"!=j&&!this.checkLogic(a,c,null,d,e,f,!1)){if(f="!"==j)if(j=J.smiles.SmilesParser.getChar(c,1),"\x00"==j||"!"==j)throw new J.smiles.InvalidSmilesException("invalid '!'");c=J.smiles.SmilesBond.getBondTypeFromCode(j);65==c&&(a.top.needRingMemberships=!0);if(null==e&&0!=c)throw new J.smiles.InvalidSmilesException("Bond without a previous atom");switch(c){case 769:case 1025:f&&
(f=!1,c=769==c?1025:769);a.haveBondStereochemistry=!0;break;case 257:case 513:a.haveBondStereochemistry=!0;break;case 2:case 1:e.isAromatic()&&(a.top.needRingData=!0)}d.set2(c,f);this.isBioSequence&&null!=b&&b.set2(c,f)}return d},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,J.smiles.SmilesBond,~S,J.smiles.SmilesBond,J.smiles.SmilesAtom,~B,~B");$_M(c$,"checkLogic",($fz=function(a,b,c,d,e,f,h){for(var j=b.indexOf(","),g=b.length;;){var l=0<j;if(l&&!this.isSmarts||0==j)break;var k="",j=b.indexOf(";");
if(0<=j){if(!this.isSmarts||0==j)break;k="&"+b.substring(j+1);b=b.substring(0,j);l||(b+=k,k="")}var m=0;if(l)for(b+=",";0<(j=b.indexOf(",",m))&&j<=g;){m=b.substring(m,j)+k;if(0==m.length)throw new J.smiles.InvalidSmilesException("missing "+(null==d?"atom":"bond")+" token");null==d?this.parseAtom(a,c,m,null,null,!0,!1,h):this.parseBond(a,d,m,null,e,!1,!1);m=j+1}else if(0<=(j=b.indexOf("&"))||null!=d&&1<g&&!f){if(!this.isSmarts||0==j)break;if(null!=d&&0>j&&1<g){f=new JU.SB;for(l=0;l<g;){var n=b.charAt(l++);
f.appendC(n);"!"!=n&&l<g&&f.appendC("&")}b=f.toString();g=b.length}for(b+="&";0<(j=b.indexOf("&",m))&&j<=g;)m=b.substring(m,j)+k,null==d?this.parseAtom(a,c,m,null,null,!0,!0,h):this.parseBond(a,d,m,null,e,!0,!1),m=j+1}else return!1;return!0}n=b.charAt(j);throw new J.smiles.InvalidSmilesException((this.isSmarts?"invalid placement for '"+n+"'":"["+n+"] notation only valid with SMARTS, not SMILES,")+" in "+b);},$fz.isPrivate=!0,$fz),"J.smiles.SmilesSearch,~S,J.smiles.SmilesAtom,J.smiles.SmilesBond,J.smiles.SmilesAtom,~B,~B");
c$.getSubPattern=$_M(c$,"getSubPattern",($fz=function(a,b,c){var d,e=1;switch(c){case "[":d="]";break;case '"':case "%":d=c;break;case "(":d=")";break;default:d=c,e=0}for(var f=a.length,h=1,j=b+1;j<f;j++){var g=a.charAt(j);if(g==d){if(h--,0==h)return a.substring(b+e,j+1-e)}else g==c&&h++}throw new J.smiles.InvalidSmilesException("Unmatched "+c);},$fz.isPrivate=!0,$fz),"~S,~N,~S");c$.getChar=$_M(c$,"getChar",($fz=function(a,b){return b<a.length?a.charAt(b):"\x00"},$fz.isPrivate=!0,$fz),"~S,~N");c$.getDigits=
$_M(c$,"getDigits",($fz=function(a,b,c){for(var d=b,e=a.length;d<e&&Character.isDigit(a.charAt(d));)d++;try{c[0]=Integer.parseInt(a.substring(b,d))}catch(f){if(Clazz.exceptionOf(f,NumberFormatException))c[0]=-2147483648;else throw f;}return d},$fz.isPrivate=!0,$fz),"~S,~N,~A");c$.skipTo=$_M(c$,"skipTo",($fz=function(a,b,c){for(var d;(d=J.smiles.SmilesParser.getChar(a,++b))!=c&&"\x00"!=d;);return"\x00"==d?-1:b},$fz.isPrivate=!0,$fz),"~S,~N,~S");c$.getRingPointer=$_M(c$,"getRingPointer",function(a){return 10>
a?""+a:100>a?"%"+a:"%("+a+")"},"~N");c$.cleanPattern=$_M(c$,"cleanPattern",function(a){a=J.util.Txt.replaceAllCharacters(a," \t\n\r","");a=J.util.Txt.simpleReplace(a,"^^","'");for(var b=0,c=0;0<=(b=a.indexOf("//*"))&&(c=a.indexOf("*//"))>=b;)a=a.substring(0,b)+a.substring(c+3);return a=J.util.Txt.simpleReplace(a,"//","")},"~S")});
