(function(la,ma,na,oa,U,pa,V,A,W,Z,$,aa,qa,ka,ra,M,N,x,ja,sa,ta,ua,va,wa,xa,ya,za,D,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia,Ja,Ka,La,Ma,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,$a,q){V("JS");W(null,"JS.MathExt","java.util.Date $.Hashtable $.Random JU.AU $.BArray $.BS $.CU $.Lst $.M3 $.M4 $.Measure $.OC $.P3 $.P4 $.PT $.Quat $.Rdr $.SB $.V3 J.api.Interface J.atomdata.RadiusData J.bspt.PointIterator J.c.VDW J.i18n.GT JM.BondSet $.Measurement JS.SV $.T JU.BSUtil $.BoxInfo $.Edge $.Escape $.JmolMolecule $.Logger $.Parser $.Point3fi $.SimpleUnitCell JV.FileManager $.JC $.Viewer".split(" "),
function(){var n=$(function(){this.pm=this.rand=this.e=this.vwr=null;Z(this,arguments)},JS,"MathExt",null);q(n,"init",function(e){this.e=e;this.vwr=this.e.vwr;return this},"~O");q(n,"evaluate",function(e,a,b,c){switch(c){case 134218760:return 1<=b.length&&4==b[0].tok?e.addXStr((1==b.length?(new java.util.Date).toString():this.vwr.apiPlatform.getDateFormat(JS.SV.sValue(b[1])))+"\t"+JS.SV.sValue(b[0]).trim()):e.addXInt(System.currentTimeMillis()-JS.MathExt.t0-(0==b.length?0:b[0].asInt()));case 134218250:return 1==
b.length&&2==b[0].tok?e.addXInt(b[0].intValue):e.addXFloat(Math.abs(b[0].asFloat()));case 134218241:case 134218245:case 134218244:case 134218246:return 1==b.length&&this.evaluateMath(e,b,c);case 1275069441:case 1275068928:case 1275068929:case 1275068930:case 1275068931:case 1275335685:case 1275334681:return this.evaluateList(e,a.intValue,b);case 268437504:0==b.length&&(e.wasX=!1);case 1275068418:return this.evaluateArray(e,b,1275068418==c&&268442113==a.tok);case 134217766:return this.evaluateMatrix(e,
b);case 134217765:return this.evaluateCallbackParam(e,b);case 134217731:case 134221850:return this.evaluateQuaternion(e,b,c);case 1275068420:return this.evaluateBin(e,b);case 134221829:return this.evaluateCache(e,b);case 1275068934:case 1275068935:return this.evaluateRowCol(e,b,c);case 1765808134:return this.evaluateColor(e,b);case 134221831:return this.evaluateCompare(e,b);case 1228931586:case 134217736:case 1275203608:return this.evaluateConnected(e,b,c,a.intValue);case 1812599299:case 1814695966:return this.evaluateUnitCell(e,
b,268442113==a.tok,268442113==a.tok?a.intValue:a.tok);case 134353926:return this.evaluateContact(e,b);case 134221834:return this.evaluateData(e,b);case 1275069444:case 1275069442:return this.evaluateDotDist(e,b,c,a.intValue);case 1275069443:if(268442113==a.tok)return this.evaluateDotDist(e,b,c,a.intValue);case 134217729:case 1745489939:return this.evaluateMeasure(e,b,a.tok);case 1228935687:case 134223363:return this.evaluateLoad(e,b,1228935687==c);case 1275068427:return this.evaluateFind(e,b);case 1275068433:return this.evaluateInChI(e,
b);case 1287653388:case 1825200146:return this.evaluateFormat(e,a.intValue,b,1825200146==c);case 134320141:return this.evaluateUserFunction(e,a.value,b,a.intValue,268442113==a.tok);case 1275068437:c=1275068725;case 1275068446:case 1275068725:case 1275082241:case 1275072526:return this.evaluateGetProperty(e,b,c,268442113==a.tok);case 136314895:return this.evaluateHelix(e,b);case 134219777:case 134217750:case 134217763:return this.evaluatePlane(e,b,c);case 134218759:case 134238732:case 134222850:case 134222350:return this.evaluateScript(e,
b,c);case 1275069446:case 1275069447:case 1275068932:return this.evaluateString(e,a.intValue,b);case 134217751:return this.evaluatePoint(e,b);case 1275068447:return this.evaluatePointGroup(e,b,268442113==a.tok);case 134256129:return this.evaluatePrompt(e,b);case 134219266:return this.evaluateRandom(e,b);case 1275068432:return this.evaluateIn(e,b);case 1275072532:return this.evaluateModulation(e,b);case 1275068443:return this.evaluateReplace(e,b);case 134218753:case 134218756:case 134218757:case 1237320707:return this.evaluateSubstructure(e,
b,c,268442113==a.tok);case 1275068444:case 1275068425:return this.evaluateSort(e,b,c);case 134217764:return this.evaluateSpacegroup(e,b);case 1296041985:return this.evaluateSymop(e,b,268442113==a.tok);case 1275068445:return this.evaluateTensor(e,b);case 134217759:return this.evaluateWithin(e,b,268442113==a.tok);case 134221856:return this.evaluateWrite(e,b)}return!1},"JS.ScriptMathProcessor,JS.T,~A,~N");q(n,"evaluateMatrix",function(e,a){var b=a.length,c=null,d=0<b&&4==a[b-1].tok?a[b-1].value:null,
f="abc".equalsIgnoreCase(d),d="xyz".equalsIgnoreCase(d),h=null;(f||d)&&b--;switch(b){case 0:c=new JU.M4;c.setIdentity();break;case 1:switch(a[0].tok){case 12:c=a[0].value;break;case 4:c=this.vwr.getSymTemp().convertTransform(a[0].value,null);break;case 7:h=JS.SV.flistValue(a[0],0)}break;case 3:case 4:if(7==a[0].tok)for(var h=x(3==b?9:16,0),g=0,j=0;j<b;j++)for(var k=JS.SV.flistValue(a[j],0),l=0;l<b;l++)h[g++]=k[l]}if(null!=h)switch(h.length){case 9:return e.addXObj(JU.M3.newA9(h));case 16:c=JU.M4.newA16(h);
break;default:return!1}return null!=c?f?e.addXStr(this.vwr.getSymStatic().staticGetTransformABC(c,!1)):d?e.addXStr(this.vwr.getSymStatic().staticConvertOperation("",c)):e.addXM4(c):!1},"JS.ScriptMathProcessor,~A");q(n,"evaluateCallbackParam",function(e,a){return e.addX(this.e.getCallbackParameter(0==a.length?-2147483648:a[0].asInt()))},"JS.ScriptMathProcessor,~A");q(n,"evaluateSpacegroup",function(e,a){var b=null,c=a.length;if(0==c)return e.addXObj(this.vwr.getSymTemp().getSpaceGroupInfo(this.vwr.ms,
null,this.vwr.am.cmi,!0,null));for(var d=1<c,f=c;d&&0<=--f;)2!=a[f].tok&&(d=!1);var f=a[0].asString(),h=4==a[a.length-1].tok?a[a.length-1].value:null;if(d||"subgroups".equals(h)){var g=h=f=b=-2147483648;switch(d?c+1:c){case 5:if(g=a[3].intValue,0>g)return!1;case 4:if(h=a[2].intValue,0>h)return!1;case 3:if(f=a[1].intValue,0>f)return!1;case 2:if(b=a[0].intValue,0>b)return!1;default:if(-2147483648==b){if(c=this.vwr.getCurrentUnitCell(),b=JU.PT.parseInt(c.getIntTableNumber()),1>b)return!1}else c=this.vwr.getSymTemp()}return e.addXObj(c.getSubgroupJSON(this.vwr,
b,f,h,g))}switch(c){default:return!1;case 2:if(4==a[1].tok)h=a[1].value;else{b=JS.SV.flistValue(a[1],0);if(null==b||6!=b.length)return!1;b=JU.SimpleUnitCell.newParams(b,NaN)}case 1:c=2==a[0].tok?a[0].intValue:1==c?-2147483648:0;if("settings".equalsIgnoreCase(h))return 0==c?!1:e.addXObj((-2147483648==c?this.vwr.getCurrentUnitCell():this.vwr.getSymTemp()).getSpaceGroupJSON(this.vwr,h.toLowerCase(),null,c));if(0<c||4==a[0].tok){if(f.toUpperCase().startsWith("AFLOW/"))return e.addXObj(this.vwr.getSymTemp().getSpaceGroupJSON(this.vwr,
"AFLOW",f.substring(6),0));if(f.startsWith("Hall:")||0<=f.indexOf("x")||null!=b)return e.addXObj(this.vwr.findSpaceGroup(null,null,f,b,null,null,1));if(0<c||!f.endsWith(":")&&!Double.isNaN(JU.PT.parseFloat(f)))f="ITA/"+f;if("setting".equalsIgnoreCase(f))return c=this.vwr.getOperativeSymmetry(),e.addXObj(null==c?null:c.getSpaceGroupJSON(this.vwr,"settings",null,-2147483648));if(f.toUpperCase().startsWith("ITA/"))return e.addXObj(this.vwr.getSymTemp().getSpaceGroupJSON(this.vwr,"ITA",f.substring(4),
0))}else if(c=JS.SV.getBitSet(a[0],!0),null!=c)return e.addXObj(this.vwr.findSpaceGroup(null,c,null,b,null,null,1))}return e.addXObj(this.vwr.getSymTemp().getSpaceGroupInfoObj(f,b,!0,!1))},"JS.ScriptMathProcessor,~A");q(n,"evaluatePointGroup",function(e,a,b){var c=null,d=null,f=-1,h=-1,g=null,j=!1;switch(a.length){case 4:h=a[3].asFloat();case 3:f=a[2].asFloat();case 2:switch(a[1].tok){case 8:d=JS.SV.ptValue(a[1]);break;case 10:g=JS.SV.getBitSet(a[1],!1),a[0].asString().equalsIgnoreCase("spaceGroup")&&
(j=!0,2==a.length&&(f=0))}if(j)break;case 1:switch(a[0].tok){case 7:b=a[0].getList();c=Array(b.size());for(a=c.length;0<=--a;)c[a]=JS.SV.ptValue(b.get(a));break;case 10:g=JS.SV.getBitSet(a[0],!1);c=this.vwr.ms.at;break;case 4:if(b){g=JS.SV.getBitSet(e.getX(),!0);if(null==g||g.isEmpty())return!1;j=a[0].asString();if("spacegroup".equals(j)){j=!0;break}}default:return!1}break;case 0:if(!b)return e.addXObj(this.vwr.ms.getPointGroupInfo(null));g=JS.SV.getBitSet(e.getX(),!1);break;default:return!1}if(null!=
g){a=g.nextSetBit(0);if(0>a||a>=this.vwr.ms.ac||j&&1!=g.cardinality())return!1;if(j){d=this.vwr.ms.generateCrystalClass(a,JU.P3.new3(NaN,NaN,NaN));c=Array(d.size());for(a=c.length;0<=--a;)c[a]=d.get(a);d=new JU.P3}}c=this.vwr.getSymTemp().setPointGroup(this.vwr,null,d,null==c?this.vwr.ms.at:c,g,!1,0>f?this.vwr.getFloat(570425382):f,0>h?this.vwr.getFloat(570425384):h,null==g?c.length:g.cardinality(),!0);return e.addXMap(c.getPointGroupInfo(-1,null,!0,null,0,1))},"JS.ScriptMathProcessor,~A,~B");q(n,
"evaluateUnitCell",function(e,a,b,c){var d=b?JS.SV.getBitSet(e.getX(),!0):1812599299==c?this.vwr.getAllAtoms():null,f=(null==d?this.vwr.getAllAtoms():d).nextSetBit(0),h=a.length-1;b=1;switch(0>h?0:a[h].tok){case 2:case 3:b=a[h].asFloat(),h--}var g=!1,j=0>h?0:a[0].tok,k=null,l=null,u=null;switch(j){case 7:l=a[0].getList();break;case 12:switch(1<h?1073741936:1>h?0:a[1].tok){default:case 1073741936:return!1;case 0:case 1073742334:break;case 1073742335:g=!0}return e.addXStr(this.vwr.getSymStatic().staticGetTransformABC(a[0].value,
g));case 4:if(u=a[0].asString(),1814695966==c)if(0==u.indexOf("a=")){k=Array(4);for(g=0;4>g;g++)k[g]=new JU.P3;JU.SimpleUnitCell.setAbc(u,null,k)}else if(0<=u.indexOf(",")||u.equals("r"))return b=2==a.length&&JS.SV.bValue(a[1])?this.vwr.getSymTemp().convertTransform(u,null):this.vwr.getV0abc(-1,u),e.addXObj(b)}if(1812599299==c)return b=this.vwr.ms.getBoxInfo(d,1),e.addXObj(b.getInfo(u));c=null;g=null!=l;if(null==k&&g&&4>l.size())return!1;u=g?1:0;null==k&&(!g&&8!=j)&&(c=0>f?this.vwr.getCurrentUnitCell():
this.vwr.ms.getUnitCell(this.vwr.ms.at[f].mi),k=null==c?D(-1,[JU.P3.new3(0,0,0),JU.P3.new3(1,0,0),JU.P3.new3(0,1,0),JU.P3.new3(0,0,1)]):c.getUnitCellVectors());if(null==k)if(k=Array(4),g)switch(l.size()){case 3:k[0]=new JU.P3;for(g=0;3>g;g++)k[g+1]=JU.P3.newP(JS.SV.ptValue(l.get(g)));break;case 4:for(g=0;4>g;g++)k[g]=JU.P3.newP(JS.SV.ptValue(l.get(g)));break;case 6:j=x(6,0);for(g=0;6>g;g++)j[g]=l.get(g).asFloat();JU.SimpleUnitCell.setAbc(null,j,k);break;default:return!1}else switch(k[0]=JU.P3.newP(JS.SV.ptValue(a[0])),
h){case 3:for(g=1;4>g;g++)(k[g]=JU.P3.newP(JS.SV.ptValue(a[g]))).sub(k[0]);break;case 1:if(l=a[1].getList(),null!=l&&3==l.size()){for(g=0;3>g;g++)k[g+1]=JU.P3.newP(JS.SV.ptValue(l.get(g)));break}default:return!1}j=u<=h?a[u].asString():null;if((l="primitive".equalsIgnoreCase(j))||"conventional".equalsIgnoreCase(j)){a=++u>h?"":a[u].asString().toUpperCase();a.equals("BCC")?a="I":0==a.length&&(a=this.vwr.getSymmetryInfo(f,null,0,null,null,null,1073741994,null,0,-1,0,null));if(null==a||0==a.length)return!1;
null==c&&(c=this.vwr.getSymTemp());f=this.vwr.getModelForAtomIndex(f).auxiliaryInfo.get("primitiveToCrystal");if(!c.toFromPrimitive(l,a.charAt(0),k,f))return!1}else if("reciprocal".equalsIgnoreCase(j))k=JU.SimpleUnitCell.getReciprocal(k,null,b),b=1;else if("vertices".equalsIgnoreCase(j))return e.addXObj(JU.BoxInfo.getVerticesFromOABC(k));if(1!=b)for(g=1;4>g;g++)k[g].scale(b);return e.addXObj(k)},"JS.ScriptMathProcessor,~A,~B,~N");q(n,"evaluateArray",function(e,a,b){if(b){b=e.getX();switch(1==a.length?
b.tok:0){case 6:var c=new JU.Lst,d=a[0].asString(),f=b.getMap(),h=b.getKeys(!1);b=0;for(a=h.length;b<a;b++)if(null==f.get(h[b]).getMap())return!1;b=0;for(a=h.length;b<a;b++){var g=f.get(h[b]),g=g.getMap(),g=JS.SV.deepCopy(g,!0,!1);g.put(d,JS.SV.newS(h[b]));c.addLast(JS.SV.newV(6,g))}return e.addXList(c);case 7:c=new java.util.Hashtable;d=b.getList();f=a[0].asString();b=0;for(a=d.size();b<a;b++)if(g=d.get(b).getMap(),null==g||null==g.get(f))return!1;b=0;for(a=d.size();b<a;b++)g=d.get(b),g=JS.SV.deepCopy(g.getMap(),
!0,!1),h=g.remove(f),c.put(h.asString(),JS.SV.newV(6,g));return e.addXObj(c)}return!1}c=Array(a.length);for(b=c.length;0<=--b;)c[b]=JS.SV.newT(a[b]);return e.addXAV(c)},"JS.ScriptMathProcessor,~A,~B");q(n,"evaluateBin",function(e,a){var b=a.length;if(3>b||5<b)return!1;var c=e.getX(),d=13==c.tok;if(!d&&7!=c.tok)return e.addX(c);var f=JS.SV.fValue(a[0]),h=JS.SV.fValue(a[1]),g=JS.SV.fValue(a[2]),j=4<=b&&1073742335==a[b-1].tok,b=(5==b||4==b&&!j)&&1073742334!=a[3].tok?JS.SV.sValue(a[3]):null,k=null;if(d)c=
c.value;else{d=c.getList();c=x(d.size(),0);null!=b&&(k=JU.AU.createArrayOfHashtable(d.size()));try{for(var l=d.size();0<=--l;)c[l]=JS.SV.fValue(null==b?d.get(l):(k[l]=d.get(l).getMap()).get(b))}catch(u){if(M(u,Exception))return!1;throw u;}}for(var h=Math.max(U(Math.floor((h-f)/g+0.01)),1),d=N(h,0),m=c.length,l=0;l<m;l++){var w=U(Math.floor((c[l]-f)/g));if(!(0>w||w>=h))if(d[w]++,null!=b){var p=k[l];if(null!=p){p.put("_bin",JS.SV.newI(w));var r=f+g*w,n=r+g;p.put("_binMin",JS.SV.newF(0==w?-3.4028235E38:
r));p.put("_binMax",JS.SV.newF(w==h-1?3.4028235E38:n))}}}if(j){j=new JU.Lst;for(l=0;l<h;l++)j.addLast(x(-1,[f+g*l,d[l]]));return e.addXList(j)}return e.addXAI(d)},"JS.ScriptMathProcessor,~A");q(n,"evaluateCache",function(e,a){return 0<a.length?!1:e.addXMap(this.vwr.fm.cacheList())},"JS.ScriptMathProcessor,~A");q(n,"evaluateColor",function(e,a){var b=0<a.length?JS.SV.sValue(a[0]):"",c=b.startsWith("$");if(2==a.length&&b.equalsIgnoreCase("TOHSL"))return e.addXPt(JU.CU.rgbToHSL(JU.P3.newP(8==a[1].tok?
JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString())),!0));if(2==a.length&&b.equalsIgnoreCase("TORGB")){var d=JU.P3.newP(8==a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString()));return e.addXPt(8==a[1].tok?JU.CU.hslToRGB(d):d)}if(4==a.length&&(1073742335==a[3].tok||1073742334==a[3].tok)){var d=JU.P3.newP(8==a[0].tok?JS.SV.ptValue(a[0]):JU.CU.colorPtFromString(a[0].asString())),f=JU.P3.newP(8==a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString())),h=1073742335==
a[3].tok;h&&(d=JU.CU.rgbToHSL(d,!1),f=JU.CU.rgbToHSL(f,!1));var g=new JU.SB,f=JU.V3.newVsub(f,d),j=a[2].asInt();2>j&&(j=20);f.scale(1/(j-1));for(b=0;b<j;b++)g.append(JU.Escape.escapeColor(JU.CU.colorPtToFFRGB(h?JU.CU.hslToRGB(d):d))),d.add(f);return e.addXStr(g.toString())}j=c?null:this.vwr.cm.getColorEncoder(b);if(!c&&null==j)return e.addXStr("");d=1<a.length?JS.SV.fValue(a[1]):3.4028235E38;f=2<a.length?JS.SV.fValue(a[2]):3.4028235E38;h=3<a.length?JS.SV.fValue(a[3]):3.4028235E38;g=3.4028235E38!=
h||3.4028235E38!=d&&3.4028235E38==f;3.4028235E38==f&&0==b.length&&(h=d,f=this.vwr.getCurrentColorRange(),d=f[0],f=f[1]);if(c){j=b.substring(1);j=D(-1,[j,null]);if(!this.vwr.shm.getShapePropertyData(24,"colorEncoder",j))return e.addXStr("");j=j[1]}else j.setRange(d,f,d>f);b=j.getColorKey();return g?e.addXPt(JU.CU.colorPtFromInt(j.getArgb(3.4028235E38==f?d:h),null)):e.addX(JS.SV.getVariableMap(b))},"JS.ScriptMathProcessor,~A");q(n,"evaluateCompare",function(e,a){var b=a.length;if(2>b||5<b)return!1;
var c,d=1073742335==a[b-1].tok;(d||1073742334==a[b-1].tok)&&b--;var f=JS.SV.sValue(a[b-1]),h=f.equalsIgnoreCase("stddev"),g=f.equalsIgnoreCase("ISOMER"),j=g&&d,k=f.equalsIgnoreCase("BONDS"),d=7==a[0].tok&&7==a[1].tok,l=3<=b?a[2].getList():null,u=null==l&&!d&&!g&&b>(h?3:2),d=10==a[0].tok?a[0].value:null,m=10==a[1].tok?a[1].value:null,w=null==d?JS.SV.sValue(a[0]):"",p=null==m?JS.SV.sValue(a[1]):"";c=NaN;try{if(k){if(4!=b)return!1;w=JS.SV.sValue(a[2]);u=w.equalsIgnoreCase("SMILES");try{u&&(w=this.vwr.getSmiles(d))}catch(r){if(M(r,
Exception))this.e.evalError(r.getMessage(),null);else throw r;}var n=this.e.getSmilesExt().getFlexFitList(d,m,w,!u);return null==n?e.addXStr(""):e.addXAF(n)}if(g){if(3!=b)return!1;if(null==d&&null==m){var s=this.vwr.getSmilesMatcher().getRelationship(w,p).toUpperCase();return e.addXStr(s)}var q=null==d?this.vwr.getSmilesMatcher().getMolecularFormula(w,!1,!1):JU.JmolMolecule.getMolecularFormulaAtoms(this.vwr.ms.at,d,null,!1),x=null==m?this.vwr.getSmilesMatcher().getMolecularFormula(p,!1,!1):JU.JmolMolecule.getMolecularFormulaAtoms(this.vwr.ms.at,
m,null,!1);if(!q.equals(x))return e.addXStr("NONE");null!=d&&(w=this.e.getSmilesExt().getSmilesMatches("/strict///",null,d,null,1,!0,!1));var B;null==m?B=0<this.vwr.getSmilesMatcher().areEqual(p,w):(p=this.e.getSmilesExt().getSmilesMatches("/strict///",null,m,null,1,!0,!1),B=0<=this.e.getSmilesExt().getSmilesMatches("/strict///"+w,null,m,null,1,!0,!1).nextSetBit(0));if(!B){var C=w+p;if(0<=C.indexOf("/")||0<=C.indexOf("\\")||0<=C.indexOf("@")){if(0<=w.indexOf("@")&&(null!=m||0<=p.indexOf("@"))&&0>
w.indexOf("@SP")){var E=w.toLowerCase().indexOf("invertstereo"),w=0<=E?"/strict/"+w.substring(0,E)+w.substring(E+12):"/invertstereo strict/"+w;if(B=null==m?0<this.vwr.getSmilesMatcher().areEqual(w,p):0<=this.e.getSmilesExt().getSmilesMatches(w,null,m,null,1,!0,!1).nextSetBit(0))return e.addXStr("ENANTIOMERS")}null==m?B=0<this.vwr.getSmilesMatcher().areEqual("/nostereo/"+p,w):(s=this.e.getSmilesExt().getSmilesMatches("/nostereo/"+w,null,m,null,1,!0,!1),B=0<=s.nextSetBit(0));if(B)return e.addXStr("DIASTEREOMERS")}s=
"CONSTITUTIONAL ISOMERS";if(j){var v=this.vwr.getInchi(d,null,null);null!=v&&v.equals(this.vwr.getInchi(m,null,null))&&(s="TAUTOMERS")}return e.addXStr(s)}if(null==d||null==m)return e.addXStr("IDENTICAL");c=this.e.getSmilesExt().getSmilesCorrelation(d,m,w,null,null,null,null,!1,null,null,!1,1);return e.addXStr(0.2>c?"IDENTICAL":"IDENTICAL or CONFORMATIONAL ISOMERS (RMSD="+c+")")}var I=new JU.M4,v=B=null;if(u){if(null==d||null==m)return!1;var f=JS.SV.sValue(a[2]),A=f.equalsIgnoreCase("MAP"),u=f.equalsIgnoreCase("SMILES"),
t=A||f.equalsIgnoreCase("SMARTS");if(u||t)f=b>(h?4:3)?JS.SV.sValue(a[3]):null;var z="H".equalsIgnoreCase(f)||"allH".equalsIgnoreCase(f)||"bestH".equalsIgnoreCase(f),D=!z&&("polyhedra".equalsIgnoreCase(f)||"polyhedron".equalsIgnoreCase(f));if(D)c=this.e.getSmilesExt().mapPolyhedra(d.nextSetBit(0),m.nextSetBit(0),u,I);else{B=new JU.Lst;var v=new JU.Lst,C="all".equalsIgnoreCase(f)||"allH".equalsIgnoreCase(f),F="best".equalsIgnoreCase(f)||"bestH".equalsIgnoreCase(f);"stddev".equals(f)&&(f=null);var G=
f;if(null==f||z||C||F){if(!A&&!u||z&&D)return!1;G="/noaromatic"+(C||F?"/":" nostereo/")+this.e.getSmilesExt().getSmilesMatches(z?"H":"",null,d,null,32769,!0,!1)}else C=!0;c=this.e.getSmilesExt().getSmilesCorrelation(d,m,G,B,v,I,null,A,null,null,F,(u?1:2)|(!C&&!F?8:0));if(A){var H=B.size();if(0==H)return e.addXStr("");for(var da=U(v.size()/H),s=new JU.Lst,E=G=0;G<da;G++){var y=JU.AU.newInt2(H);s.addLast(y);for(f=0;f<H;f++,E++)y[f]=N(-1,[B.get(f).i,v.get(E).i])}return C?e.addXList(s):0<s.size()?e.addXAII(s.get(0)):
e.addXStr("")}}}else{B=this.e.getPointVector(a[0],0);v=this.e.getPointVector(a[1],0);if(null==B||null==v)return!1;if(null!=l){b--;var Q=l.size();if(Q>B.size()||Q!=v.size())return!1;for(var X=new JU.Lst,G=0;G<Q;G++)X.addLast(B.get(l.get(G).intValue-1));B=X}switch(b){case 2:break;case 3:if(h)break;default:return!1}B.size()==v.size()&&(J.api.Interface.getInterface("JU.Eigen",this.vwr,"script"),c=JU.Measure.getTransformMatrix4(B,v,I,null))}return h||Float.isNaN(c)?e.addXFloat(c):e.addXM4(I.round(1E-7))}catch(O){if(M(O,
Exception))return this.e.evalError(null==O.getMessage()?O.toString():O.getMessage(),null),!1;throw O;}},"JS.ScriptMathProcessor,~A");q(n,"evaluateConnected",function(e,a,b,c){if(5<a.length)return!1;var d=-2147483648,f=2147483647,h=0,g=3.4028235E38,j=65535,k=null,l=null,u=!1,m=!1;switch(b){case 1275203608:l=-2147483648;h=null;if(0<a.length)switch(a[0].tok){case 2:l=a[0].intValue;break;case 4:h=JS.SV.sValue(a[0])}1275203608==c&&(k=JS.SV.getBitSet(e.getX(),!0));k=D(-1,[Integer.$valueOf(l),h,k]);this.vwr.shm.getShapePropertyData(21,
"getCenters",k)||(k[1]=null);return e.addXBs(null==k[1]?new JU.BS:k[1]);case 1228931586:k=e.getX();if(10!=k.tok||1!=a.length||10!=a[0].tok)return!1;k=k.value;l=a[0].value;a=new JU.Lst;h=this.vwr.ms.at;for(c=k.nextSetBit(0);0<=c;c=k.nextSetBit(c+1)){b=0;g=h[c].bonds;for(m=g.length;0<=--m;)l.get(g[m].getOtherAtom(h[c]).i)&&b++;a.addLast(Integer.$valueOf(b))}return e.addXList(a)}for(c=0;c<a.length;c++){var w=a[c];switch(w.tok){case 10:if((m=A(w.value,"JM.BondSet"))&&null!=k)return!1;if(null==k)k=w.value;
else if(null==l)l=w.value;else return!1;break;case 4:b=JS.SV.sValue(w);j=b.equalsIgnoreCase("hbond")?30720:JU.Edge.getBondOrderFromString(b);if(131071==j)return!1;break;case 3:u=!0;default:b=w.asInt();w=w.asFloat();if(2147483647!=f)return!1;-2147483648==d?(d=Math.max(b,0),h=w):(f=b,g=w)}}-2147483648==d?(d=1,f=100,h=0.1,g=1E8):2147483647==f&&(f=d,g=h,h=0.1);null==k&&(k=this.vwr.getAllAtoms());u&&null==l&&(l=k);return null!=l?(a=new JU.BS,this.vwr.makeConnections(h,g,j,1086324745,k,l,a,m,!1,0),e.addX(JS.SV.newV(10,
JM.BondSet.newBS(a)))):e.addXBs(this.vwr.ms.getAtomsConnected(d,f,j,k))},"JS.ScriptMathProcessor,~A,~N,~N");q(n,"evaluateContact",function(e,a){if(1>a.length||3<a.length)return!1;var b=0,c=100;switch(a[0].tok){case 3:case 2:c=JS.SV.fValue(a[b++]);break;case 10:break;default:return!1}if(b==a.length||!A(a[b].value,"JU.BS"))return!1;var d=JU.BSUtil.copy(a[b++].value),b=b<a.length?JU.BSUtil.copy(a[b].value):null,c=new J.atomdata.RadiusData(null,10<c?c/100:c,10<c?J.atomdata.RadiusData.EnumType.FACTOR:
J.atomdata.RadiusData.EnumType.OFFSET,J.c.VDW.AUTO),b=this.setContactBitSets(d,b,!0,NaN,c,!1);b.or(d);return e.addXBs(b)},"JS.ScriptMathProcessor,~A");q(n,"evaluateData",function(e,a){var b=0==a.length?"":JS.SV.sValue(a[0]);switch(a.length){case 0:case 1:break;case 2:case 3:if(10==a[0].tok)return e.addXStr(this.vwr.getModelFileData(b,JS.SV.sValue(a[1]),3==a.length&&JS.SV.bValue(a[2])));break;case 4:var b=a[1].asInt(),c=a[2].asInt(),d=a[3].asInt(),b=JU.Parser.parseFloatArrayFromMatchAndField(JS.SV.sValue(a[0]),
null,0,0,null,b,c,null,d);return e.addXStr(JU.Escape.escapeFloatA(b,!1));default:return!1}if(0==b.indexOf("data2d_"))return b=this.vwr.getDataObj(b,null,2),null==b?e.addXStr(""):2==a.length&&2==a[1].tok?(c=a[1].intValue,0>c&&(c+=b.length),0<=c&&c<b.length?e.addXStr(JU.Escape.escapeFloatA(b[c],!1)):e.addXStr("")):e.addXStr(JU.Escape.escapeFloatAA(b,!1));if(b.endsWith("*"))return e.addXList(this.vwr.getDataObj(b,null,0));if(0==b.indexOf("property_"))return b=this.vwr.getDataObj(b,null,1),null==b?e.addXStr(""):
e.addXStr(JU.Escape.escapeFloatA(b,!1));b=this.vwr.getDataObj(b,null,-1);return e.addXStr(null==b||2>b.length?"":""+b[1])},"JS.ScriptMathProcessor,~A");q(n,"evaluateDotDist",function(e,a,b,c){var d=1275069443==b,f,h,g=null;switch(a.length){case 2:if(2147483647==c){f=a[0];h=a[1];break}g=a[1];case 1:f=e.getX();h=a[0];break;case 0:if(d){f=e.getX();h=JS.SV.getVariable(new JU.P3);break}default:return!1}a=NaN;try{if(1275069442==b){var j=JU.P3.newP(e.ptValue(f,null));j.cross(j,e.ptValue(h,null));return e.addXPt(j)}var k=
7==h.tok?null:e.ptValue(h,null),l=this.e.planeValue(h);if(d){b=-2147483648==c?0:c&480;var j=32==b||64==b,u=480==b;switch(f.tok){case 7:case 10:var m=10==f.tok,w=10==h.tok,p=8==h.tok,r=m?f.value:null,n=w?h.value:null,s=m?null:f.getList(),q=w?null:h.getList(),A=j&&null!=g&&g.asBoolean();switch(h.tok){case 10:case 7:case 8:var B=this.vwr.ms.at;if(A){var C=NaN,E=2147483647;if(m){for(var v=r.nextSetBit(0);0<=v;v=r.nextSetBit(v+1)){var I=p?B[v].distanceSquared(k):this.e.getBitsetProperty(n,q,c,B[v],l,f.value,
null,!1,f.index,!1).floatValue();if(!(32==b?I>=C:I<=C))C=I,E=v}return e.addXBs(2147483647==E?new JU.BS:JU.BSUtil.newAndSetBit(E))}for(v=s.size();0<=--v;){var D=JS.SV.ptValue(s.get(v)),I=p?D.distanceSquared(k):this.e.getBitsetProperty(n,q,c,D,l,f.value,null,!1,2147483647,!1).floatValue();if(!(32==b?I>=C:I<=C))C=I,E=v}return e.addXInt(E)}if(u){if(null==n){for(var t=x(r.cardinality(),0),C=0,v=r.nextSetBit(0);0<=v;v=r.nextSetBit(v+1),C++)t[C]=B[v].distance(k);return e.addXAF(t)}E=x(r.cardinality(),n.cardinality(),
0);C=0;for(v=r.nextSetBit(0);0<=v;v=r.nextSetBit(v+1),C++){c=0;for(var z=n.nextSetBit(0);0<=z;z=n.nextSetBit(z+1),c++)E[C][c]=B[v].distance(B[z])}return e.addXAFF(E)}if(j){t=x(m?r.cardinality():s.size(),0);if(m){v=r.nextSetBit(0);for(C=0;0<=v;v=r.nextSetBit(v+1))t[C++]=this.e.getBitsetProperty(n,q,c,B[v],l,f.value,null,!1,f.index,!1).floatValue();return e.addXAF(t)}for(v=t.length;0<=--v;)t[v]=this.e.getBitsetProperty(n,q,c,JS.SV.ptValue(s.get(v)),l,null,null,!1,2147483647,!1).floatValue();return e.addXAF(t)}return e.addXObj(this.e.getBitsetProperty(r,
s,c,k,l,f.value,null,!1,f.index,!1))}}}var N=e.ptValue(f,null),F=this.e.planeValue(f);d?a=null!=l&&null!=g?JU.Measure.directedDistanceToPlane(N,l,JS.SV.ptValue(g)):null==F?null==l?k.distance(N):JU.Measure.distanceToPlane(l,N):JU.Measure.distanceToPlane(F,k):null!=F&&null!=l?a=F.x*l.x+F.y*l.y+F.z*l.z+F.w*l.w:(null!=F?N=JU.P3.new3(F.x,F.y,F.z):null!=l&&(k=JU.P3.new3(l.x,l.y,l.z)),a=N.dot(k))}catch(G){if(!M(G,Exception))throw G;}return e.addXFloat(a)},"JS.ScriptMathProcessor,~A,~N,~N");q(n,"evaluateHelix",
function(e,a){if(1>a.length||5<a.length)return!1;var b=2<a.length?3:1,c=b>=a.length?"array":JS.SV.sValue(a[b]),b=JS.T.getTokFromName(c);if(2<a.length){var d=e.ptValue(a[0],null),f=e.ptValue(a[1],null);if(0==b||9!=a[2].tok||null==d||null==f)return!1;var h=JU.Quat.newP4(a[2].value),h=JU.Measure.computeHelicalAxis(d,f,h);return null==h?!1:e.addXObj(JU.Escape.escapeHelical(c,b,d,f,h))}c=A(a[0].value,"JU.BS")?a[0].value:this.vwr.ms.getAtoms(1094715412,Integer.$valueOf(a[0].asInt()));switch(b){case 134217751:case 1073741854:case 1665140738:return e.addXObj(this.getHelixData(c,
b));case 134217729:return e.addXFloat(this.getHelixData(c,134217729).floatValue());case 135176:case 1745489939:return e.addXObj(this.getHelixData(c,b));case 1275068418:h=this.getHelixData(c,1073742001);if(null==h)break;return e.addXAS(h)}return!1},"JS.ScriptMathProcessor,~A");q(n,"getHelixData",function(e,a){var b=e.nextSetBit(0);return 0>b?"null":this.vwr.ms.at[b].group.getHelixData(a,this.vwr.getQuaternionFrame(),this.vwr.getInt(553648142))},"JU.BS,~N");q(n,"evaluateInChI",function(e,a){var b=e.getX(),
c=0<a.length?JS.SV.sValue(a[0]):"fixedh?";c.toLowerCase().equals("standard")&&(c="");var d=JS.SV.getBitSet(b,!0),b=null==d?JS.SV.sValue(b):null;return e.addXStr(this.vwr.getInchi(d,b,c))},"JS.ScriptMathProcessor,~A");q(n,"evaluateFind",function(e,a){var b=e.getX(),c=7==b.tok,d=10==b.tok,f=0==a.length,h=0==a.length?0:a[0].tok,g=f||4!=h?"":JS.SV.sValue(a[0]),j=1<a.length&&1073742334==a[1].tok,k=0==h?0:a[a.length-1].tok,l=0==k?JS.SV.vF:a[a.length-1],u=!c&&1073742335==k,m=1<a.length&&1073742335!=a[1].tok&&
1073742334!=a[1].tok&&10!=a[1].tok?JS.SV.sValue(a[1]):"",k=!c&&!j&&g.equalsIgnoreCase("SEQUENCE"),n=!c&&!j&&g.equalsIgnoreCase("SEQ");if(g.toUpperCase().startsWith("SMILES/")){g.endsWith("/")||(g+="/");var p=g.substring(6)+"//";JV.JC.isSmilesCanonical(p)?(m="SMILES",g="CHEMICAL"):(g="SMILES",m=p+m)}else g.toUpperCase().startsWith("SMARTS/")&&(g.endsWith("/")||(g+="/"),m=g.substring(6)+(0==m.length?"//":m),g="SMARTS");var r=null,p=!1;if(4==b.tok)switch(a.length){case 1:if(b.value.startsWith("InChI=")&&
g.equalsIgnoreCase("SMILES"))return e.addXStr(this.vwr.getInchi(null,b.value,"SMILES"+m));p=!0;break;case 2:j||u?p=!0:b.value.startsWith("InChI=")?g.equals("SMARTS")?r=this.vwr.getInchi(null,b.value,"SMILES"):p=!0:3>=m.length&&0==m.$replace("m"," ").$replace("i"," ").$replace("v"," ").trim().length&&(p=!0)}var q=!p&&g.equalsIgnoreCase("SMILES"),s=!p&&g.equalsIgnoreCase("SMARTS"),A=!c&&!p&&g.equalsIgnoreCase("CHEMICAL"),x=!c&&!p&&g.equalsIgnoreCase("MF"),B=!c&&!p&&g.equalsIgnoreCase("CELLFORMULA"),
C=d&&!c&&g.equalsIgnoreCase("INCHI"),E=d&&!c&&g.equalsIgnoreCase("INCHIKEY"),v=!q&&!s&&10==h&&0<=m.toLowerCase().indexOf("map"),p=!q&&!s&&(10==b.tok||8==b.tok||7==b.tok)&&g.toLowerCase().startsWith("equivalent");try{if(p)switch(b.tok){case 10:return e.addXBs(this.vwr.ms.getSymmetryEquivAtoms(b.value,null,null));case 8:return e.addXList(this.vwr.getSymmetryEquivPoints(b.value,g+m));case 7:for(var I=new JU.Lst,U=b.getList(),t=0,z=U.size();t<z;t++){var V=JS.SV.ptValue(U.get(t));if(null==V)return!1;I.addLast(V)}return e.addXList(this.vwr.getSymmetryEquivPointList(I,
g+m))}else if(C||E)return E&&(m+=" key"),e.addXStr(this.vwr.getInchi(JS.SV.getBitSet(b,!0),null,m));if(A){var F=d?b.value:null,G=null==F?JS.SV.sValue(b):this.vwr.getOpenSmiles(F),G=(0==G.length?"":this.vwr.getChemicalInfo(G,m.toLowerCase(),F)).trim();G.startsWith("InChI")&&(G=JU.PT.rep(JU.PT.rep(G,"InChI=",""),"InChIKey=",""));return e.addXStr(G)}if(q||s||d){var d=v?0:q||s?2:1,H=d<a.length&&10==a[d].tok?a[d++].value:null,da="bonds".equalsIgnoreCase(JS.SV.sValue(l)),I=da||u,d=null;switch(b.tok){case 7:case 4:null==
r&&!c&&(r=JS.SV.sValue(b));if((q||s)&&1==a.length||null!=H)return!1;if(m.equalsIgnoreCase("mf"))d=this.vwr.getSmilesMatcher().getMolecularFormula(r,s,u);else{var H=m,y=!0,t=!1;switch(a.length){case 4:y=JS.SV.bValue(a[3]);case 3:t=JS.SV.bValue(a[2])}var Q=H.equals("chirality"),z=!t&&(!y||!s&&!Q);try{if(d=this.e.getSmilesExt().getSmilesMatches(H,c?JS.SV.strListValue(b):r,null,null,s?2:1,!t,!y),c)return e.addXObj(d)}catch(X){if(M(X,Exception))return System.out.println(X.getMessage()),e.addXInt(-1);throw X;
}var O=Q?1:(JU.AU.isAI(d),d.length);0==O&&("MF_FAILED"!==this.vwr.getSmilesMatcher().getLastException()&&0>r.toLowerCase().indexOf("noaromatic")&&0>r.toLowerCase().indexOf("strict"))&&(d=this.e.getSmilesExt().getSmilesMatches(H,r,null,null,16|(s?2:1),!t,!y));if(z)return e.addXInt(!y&&0<O?1:O)}break;case 10:y=b.value;if(g.equalsIgnoreCase("spacegroup"))return e.addXObj(this.vwr.findSpaceGroup(null,y,null,null,null,null,"parent".equals(m.toLowerCase())?8:0));if(g.equalsIgnoreCase("crystalClass"))return z=
y.nextSetBit(0),y=null,2!=a.length&&(y=new JU.BS,y.set(z)),e.addXList(this.vwr.ms.generateCrystalClass(z,null!=y?this.vwr.ms.getAtomSetCenter(y):10==l.tok?this.vwr.ms.getAtomSetCenter(l.value):JS.SV.ptValue(l)));if(x&&0!=m.length)return e.addXBs(JU.JmolMolecule.getBitSetForMF(this.vwr.ms.at,y,m));if(x||B)return e.addXStr(this.vwr.getFormulaForAtoms(y,x?"MF":"CELLFORMULA",u));if(k||n){var W=l.asString().equalsIgnoreCase("H"),I=(new Boolean(I|W)).valueOf();return e.addXStr(this.vwr.getSmilesOpt(y,-1,
-1,(I?7340032|(W?9437184:0):0)|(n?34603008:1048576),null))}if(v){var K=null,O=Q=z=null,P=3==a.length?JS.SV.sValue(l):null,R=null==P||P.equals("%i")||P.equals("number")?"i":P.equals("%a")||P.equals("name")?"a":P.equals("%D")||P.equals("index")?"D":"?";null==P&&(P="number");l=null;m=m.$replace("map","").trim();g=this.vwr.getSmilesOpt(y,0,0,0,m);if(y.cardinality()!=H.cardinality())l="atom sets are not the same size";else try{0<m.length&&(g="/"+m+"/"+g);var z=this.vwr.getSmilesMatcher().getCorrelationMaps(g,
this.vwr.ms.at,this.vwr.ms.ac,y,137)[0],Y=this.vwr.getSmilesMatcher().getCorrelationMaps(g,this.vwr.ms.at,this.vwr.ms.ac,H,137);if(0<Y.length){K=N(y.length(),0);for(t=K.length;0<=--t;)K[t]=-1;Q=Y[0];for(t=z.length;0<=--t;)K[z[t]]=Q[t];var O=D(z.length,2,null),ea=JU.BS.copy(y);ea.or(H);var S="?"==R?Array(ea.length()):null;null!=S&&(S=this.e.getCmdExt().getBitsetIdentFull(ea,P,!1,2147483647,!1,S));for(var L=this.vwr.ms.at,Y=0,t=y.nextSetBit(0);0<=t;t=y.nextSetBit(t+1)){var ba=K[t];if(-1!=ba){var ca;
switch(R.charCodeAt(0)){case 97:ca=D(-1,[L[t].getAtomName(),L[ba].getAtomName()]);break;case 105:ca=D(-1,[Integer.$valueOf(L[t].getAtomNumber()),Integer.$valueOf(L[ba].getAtomNumber())]);break;case 68:ca=D(-1,[Integer.$valueOf(t),Integer.$valueOf(ba)]);break;default:ca=D(-1,[S[t],S[ba]])}O[Y++]=ca}}}}catch(fa){if(M(fa,Exception))l=fa.getMessage();else throw fa;}var T=new java.util.Hashtable;T.put("BS1",y);T.put("BS2",H);T.put("SMILES",g);null==l?(T.put("SMILEStoBS1",z),T.put("SMILEStoBS2",Q),T.put("BS1toBS2",
K),T.put("MAP1to2",O),T.put("key",P)):T.put("error",l);return e.addXMap(T)}if(q||s)g=1<a.length&&10==a[1].tok?this.vwr.getSmilesOpt(a[1].value,0,0,0,m):m;m=m.toUpperCase();if(0<=m.indexOf("INCHI"))return e.addXStr(this.vwr.getInchi(y,null,"SMILES/"+m));if(m.equals("MF"))r=this.e.getSmilesExt().getSmilesMatches("",null,y,H,1,!0,!1),d=this.vwr.getSmilesMatcher().getMolecularFormula(r,!1,u);else if(da)K=this.vwr.getSmilesMatcher().getCorrelationMaps(g,this.vwr.ms.at,this.vwr.ms.ac,y,(q?1:2)|8),d=0<K.length?
this.vwr.ms.getDihedralMap(K[0]):N(0,0);else if(m.equals("MAP"))d=K=this.vwr.getSmilesMatcher().getCorrelationMaps(g,this.vwr.ms.at,this.vwr.ms.ac,y,(q?1:2)|144);else{var Z=(q?0<=m.indexOf("OPEN")?5:1:2)|(u&&0==g.length?22020096:0);if(0<=m.indexOf("/MOLECULE/")){for(var ga=this.vwr.ms.getMolecules(),$=new JU.Lst,t=0;t<ga.length;t++)if(ga[t].atomList.intersects(y)){var aa=this.e.getSmilesExt().getSmilesMatches(g,null,ga[t].atomList,H,Z,!u,!1);aa.isEmpty()||$.addLast(aa)}d=$}else d=this.e.getSmilesExt().getSmilesMatches(g,
null,y,H,Z,!u,!1)}}null==d&&this.e.invArg();return e.addXObj(d)}}catch(ha){if(M(ha,Exception))this.e.evalError(ha.getMessage(),null);else throw ha;}y=new JU.BS;K=c?b.getList():null;if(c&&4!=h&&0!=h){b=a[0];t=0;for(z=K.size();t<z;t++)JS.SV.areEqual(K.get(t),b)&&y.set(t);d=N(y.cardinality(),0);Y=0;for(t=y.nextSetBit(0);0<=t;t=y.nextSetBit(t+1))d[Y++]=t+1;return e.addXAI(d)}h=0<=m.indexOf("v");t=0<=m.indexOf("i")||j;j=0<=m.indexOf("m");m=0==g.length;p=!m&&!p&&2==a.length;if(c||p){k=p?this.getPatternMatcher():
null;H=null;if(p)try{H=k.compile(g,t)}catch(ia){if(M(ia,Exception))this.e.evalError(ia.toString(),null);else throw ia;}k=m?null:JS.SV.strListValue(b);P=m?K.size():k.length;JU.Logger.debugging&&JU.Logger.debug("finding "+g);z=0;R=null;b=j?new JU.Lst:null;S="";for(t=0;t<P;t++){if(m)switch(L=K.get(t),L.tok){case 6:L=L.getMap().isEmpty()!=f;break;case 7:L=0==L.getList().size()!=f;break;case 4:L=0==L.asString().length!=f;break;default:L=!0}else p?(S=k[t],R=H.matcher(S),L=R.find()):L=0<=JS.SV.sValue(K.get(t)).indexOf(g);
if(j&&L||!j&&L==!h)z++,y.set(t),j&&b.addLast(h?S.substring(0,R.start())+S.substring(R.end()):R.group())}if(!c)return j?e.addXStr(1==b.size()?b.get(0):""):h?e.addXBool(1==z):j?e.addXStr(0==z?"":R.group()):e.addXInt(0==z?0:R.start()+1);if(j){c=Array(z);if(0<z)for(t=k.length;0<=--t;)y.get(t)&&(--z,c[z]=j?b.get(z):k[t]);return e.addXAS(c)}c=new JU.Lst;for(t=y.nextSetBit(0);0<=t;t=y.nextSetBit(t+1))c.addLast(K.get(t));return e.addXList(c)}return k?e.addXStr(this.vwr.getJBR().toStdAmino3(JS.SV.sValue(b))):
e.addXInt(JS.SV.sValue(b).indexOf(g)+1)},"JS.ScriptMathProcessor,~A");q(n,"evaluateGetProperty",function(e,a,b,c){var d=a.length,f=c&&1275082241==b,h=c&&1275068725==b,g=1275068446==b,j=0,k=0==d?0:a[0].tok;if(2==d&&(7==k||6==k||14==k))return e.addXObj(this.vwr.extractProperty(a[0].value,a[1].value.toString(),-1));var l=c&&1==d&&10==a[0].tok?a[0].value:null,u=null==l&&0<d?JS.SV.sValue(a[j++]):"",k=u,m=k.toLowerCase();!f&&0>m.indexOf("[select ")&&(k=m);var n=!1;k.equals("json")&&d>j&&(n=!0,k=JS.SV.sValue(a[j++]));
var p=null;if(c){p=e.getX();switch(p.tok){case 10:break;case 4:var r=p.value,d=Array(3);r.startsWith("$")?(r=r.substring(1),a=this.vwr.shm.getShapeIdFromObjectName(r),0<=a&&(d[0]=r,this.vwr.shm.getShapePropertyData(a,"index",d),null!=d[1]&&!u.equals("index")&&(r=d[1].intValue(),d[1]=this.vwr.shm.getShapePropertyIndex(a,u.intern(),r)))):(a=JV.JC.shapeTokenIndex(JS.T.getTokFromName(r)),0<=a&&(d[0]=u,d[1]=Integer.$valueOf(-1),this.vwr.shm.getShapePropertyData(a,u.intern(),d)));return null==d[1]?e.addXStr(""):
e.addXObj(d[1]);case 7:if(h){g=p.getList();if(0==d)return e.addXObj(this.getMinMax(g,1275068725,!0));c=new java.util.Hashtable;k=1<d?JS.SV.sValue(a[d-1]):null;null!=k&&d--;m=Array(d);for(r=0;r<d;r++)m[r]=JS.SV.sValue(a[r]);r=0;for(n=g.size();r<n;r++)if(j=g.get(r),6==j.tok){u=j.getMap();a="";for(p=0;p<d;p++)l=u.get(m[p]),a+=(0==p?"":k)+JS.SV.sValue(l);u=c.get(a);null==u&&c.put(a,u=JS.SV.newV(7,new JU.Lst));u.getList().addLast(j)}return e.addXMap(c)}if(null!=l){d=p.getList();a=new JU.Lst;for(r=l.nextSetBit(0);0<=
r;r=l.nextSetBit(r+1))a.addLast(d.get(r));return e.addXList(a)}default:if(1275068725==b&&6==p.tok){c=new java.util.Hashtable;for(d=p.getMap().entrySet().iterator();d.hasNext()&&((r=d.next())||1);)a=r.getKey(),j=r.getValue().asString(),g=c.get(j),null==g&&c.put(j,g=new JU.Lst),g.addLast(a);if("count".equals(m))for(d=c.entrySet().iterator();d.hasNext()&&((r=d.next())||1);)r.setValue(Integer.$valueOf(r.getValue().size()));return e.addXMap(c)}f&&(k="[SELECT "+k+"]");return e.addXObj(this.vwr.extractProperty(p,
k,-1))}!m.startsWith("bondinfo")&&(!m.startsWith("atominfo")&&!m.startsWith("modelkitinfo"))&&(k="atomInfo."+k)}r="";if(k.equalsIgnoreCase("fileContents")&&2<=d){j=JS.SV.sValue(a[1]);for(r=2;r<d;r++)j+="|"+JS.SV.sValue(a[r]);r=j;j=d}else if(d>j)switch(a[j].tok){case 10:r=a[j++].value;k.equalsIgnoreCase("bondInfo")&&(d>j&&10==a[j].tok)&&(r=D(-1,[r,a[j].value]));break;case 6:case 4:this.vwr.checkPropertyParameter(k)&&(r=a[j++].value)}if(c&&(r=p.value,0>r.nextSetBit(0)))return e.addXStr("");g&&!c&&(k=
"auxiliaryInfo.models."+k);k=JU.PT.rep(k,".[","[");r=this.vwr.getProperty(null,k,r);j<d&&(r=this.vwr.extractProperty(r,a,j));return e.addXObj(n?JS.SV.safeJSON("value",r):JS.SV.isVariableType(r)?r:JU.Escape.toReadable(k,r))},"JS.ScriptMathProcessor,~A,~N,~B");q(n,"evaluateFormat",function(e,a,b,c){var d=2>b.length||1287653388==a?e.getX():null,f=0==b.length?"%U":7==b[0].tok?null:JS.SV.sValue(b[0]);if(!c&&0<b.length&&null!=d&&10!=d.tok&&null!=f){if(2==b.length){var d=d.getList(),h=b[1].getList();if(null==
d||null==h)return!1;d=JS.SV.getVariableList(this.getSublist(d,h))}b=D(-1,[b[0],d]);d=null}if(null==d){if(null==f)return!1;a=c?-1:JS.SV.getFormatType(f);if(0<=a&&2!=b.length)return!1;if(0<=a||2>b.length||7!=b[1].tok)return b=JS.SV.format(b,a),f.equalsIgnoreCase("json")?e.addXStr(b):e.addXObj(b);f=b[1].getList();b=D(-1,[b[0],null]);c=Array(f.size());for(d=c.length;0<=--d;)b[1]=f.get(d),c[d]=JS.SV.format(b,a).toString();return e.addXAS(c)}if(7==d.tok&&null==f)return d=d.getList(),h=b[0].getList(),f=
this.getSublist(d,h),e.addXList(f);b=10==d.tok?d.value:null;a=JS.T.tokAttr(a,480);return e.addXObj(null==f?"":null==b?JS.SV.sprintf(JU.PT.formatCheck(f),d):this.e.getCmdExt().getBitsetIdent(b,f,d.value,!0,d.index,a))},"JS.ScriptMathProcessor,~N,~A,~B");q(n,"getSublist",function(e,a){for(var b=new JU.Lst,c,d,f,h=0,g=e.size();h<g;h++)switch(d=e.get(h),d.tok){case 6:c=d.getMap();f=new JU.Lst;for(var j=0,k=a.size();j<k;j++)d=c.get(JS.SV.sValue(a.get(j))),f.addLast(null==d?JS.SV.newS(""):d);b.addLast(JS.SV.getVariableList(f));
break;case 7:c=new java.util.Hashtable;f=d.getList();j=0;for(k=Math.min(f.size(),a.size());j<k;j++)c.put(JS.SV.sValue(a.get(j)),f.get(j));b.addLast(JS.SV.getVariable(c))}return b},"JU.Lst,JU.Lst");q(n,"evaluateList",function(e,a,b){var c=b.length,d=e.getX(),f=7==d.tok,h;switch(a){case 1275335685:return 2==c&&e.addX(d.pushPop(b[0],b[1]))||1==c&&e.addX(d.pushPop(null,b[0]));case 1275334681:return 1==c&&e.addX(d.pushPop(b[0],null))||0==c&&e.addX(d.pushPop(null,null));case 1275069441:if(1!=c&&2!=c)return!1;
break;case 1275069447:case 1275069446:break;default:if(1!=c)return!1}var g=null,j=null,k=null;if(2==c){var l=JS.SV.sValue(b[0]);h=b[1];if(1275069441==a){g=f?JS.SV.strListValue(d):JU.PT.split(JS.SV.sValue(d),"\n");j=7==h.tok?JS.SV.strListValue(h):JU.PT.split(JS.SV.sValue(h),"\n");k=Array(c=Math.max(g.length,j.length));for(d=0;d<c;d++)k[d]=(d>=g.length?"":g[d])+l+(d>=j.length?"":j[d]);return e.addXAS(k)}if(1073742335!=h.tok)return!1;k=d.getList();(c=0==l.length)&&(l=",");if(1275069446==a){j=Array(k.size());
for(d=k.size();0<=--d;)if(b=k.get(d).getList(),null==b)j[d]=k.get(d);else{a=new JU.SB;f=0;for(g=b.size();f<g;f++)0<f&&a.append(l),h=b.get(f),a.append(c&&4==h.tok?'"'+JU.PT.rep(h.value,'"','""')+'"':""+h.asString());j[d]=JS.SV.newS(a.toString())}return e.addXAV(j)}a=new JU.Lst;c&&(l="\x00");j=N(2,0);d=0;for(h=k.size();d<h;d++){f=k.get(d).asString();if(c){j[1]=0;for(g=j[0]=0;;){b=JU.PT.getCSVString(f,j);if(null==b){if(-1==j[1]){f+=++d<h?"\n"+k.get(d).asString():'"';j[1]=g;continue}f=f.substring(0,g)+
f.substring(g).$replace(",","\x00");break}f=f.substring(0,g)+f.substring(g,j[0]).$replace(",","\x00")+b+f.substring(j[1]);j[1]=g=j[0]+b.length}}for(var u=f.$plit(l),m=new JU.Lst,f=0,g=u.length;f<g;f++){b=u[f];if(0>b.indexOf("."))try{m.addLast(JS.SV.newI(Integer.parseInt(b)));continue}catch(n){if(!M(n,Exception))throw n;}else try{m.addLast(JS.SV.getVariable(Float.$valueOf(Float.parseFloat(b))));continue}catch(p){if(!M(p,Exception))throw p;}m.addLast(JS.SV.newS(b))}a.addLast(JS.SV.getVariableList(m))}return e.addXObj(JS.SV.getVariableList(a))}h=
0==c?JS.SV.newV(1073742327,"all"):b[0];k=1073742327==h.tok;if(!f&&4!=d.tok)return e.binaryOp(this.opTokenFor(a),d,h);var u=JS.SV.isScalar(d),r=JS.SV.isScalar(h),q=m=null,l=d.getList(),s=h.getList();f?c=l.size():u?c=2147483647:(g=JU.PT.split(JS.SV.sValue(d),"\n"),m=x(c=g.length,0),JU.PT.parseFloatArrayData(g,m));if(k&&1275069446!=a){k=0;if(f)for(d=c;0<=--d;)k+=JS.SV.fValue(l.get(d));else if(!u)for(d=c;0<=--d;)k+=m[d];return e.addXFloat(k)}if(1275069446==a&&4==h.tok){a=new JU.SB;if(u)a.append(JS.SV.sValue(d));
else{b=k?"":h.value.toString();for(d=0;d<c;d++)a.append(0<d?b:"").append(JS.SV.sValue(l.get(d)))}return e.addXStr(a.toString())}var A=null;r?A=h:7==h.tok?c=Math.min(c,s.size()):(j=JU.PT.split(JS.SV.sValue(h),"\n"),q=x(j.length,0),JU.PT.parseFloatArrayData(j,q),c=Math.min(c,q.length));var D=this.opTokenFor(a);if(f&&k)return k=new JU.Lst,e.addXList(this.addAllLists(d.getList(),k));b=u?d:null;var B,C=2147483647==c;C&&(c=1);for(var E=Array(c),d=0;d<c;d++){B=r?A:7==h.tok?s.get(d):Float.isNaN(q[d])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(j[d])):
JS.SV.newF(q[d]);u||(b=f?l.get(d):Float.isNaN(m[d])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(g[d])):JS.SV.newF(m[d]));1275069446==a&&7!=b.tok&&(k=new JU.Lst,k.addLast(b),b=JS.SV.getVariableList(k));if(!e.binaryOp(D,b,B))return!1;E[d]=e.getX()}return C?e.addXObj(E[0]):e.addXAV(E)},"JS.ScriptMathProcessor,~N,~A");q(n,"addAllLists",function(e,a){for(var b=e.size(),c=0;c<b;c++){var d=e.get(c);7==d.tok?this.addAllLists(d.getList(),a):a.addLast(d)}return a},"JU.Lst,JU.Lst");q(n,"evaluateLoad",
function(e,a,b){if(1>a.length||3<a.length)return!1;var c=JV.FileManager.fixDOSName(JS.SV.sValue(a[0])),d=1<a.length&&1073742335==a[1].tok,f=this.vwr.async||2<a.length&&1073742335==a[a.length-1].tok,h=1<a.length&&2==a[1].tok?a[1].asInt():-1;a=1<a.length&&a[1].asString().equalsIgnoreCase("JSON");if(d)return e.addXMap(this.vwr.fm.getFileAsMap(c,null,!1));d=c.startsWith("?");if(JV.Viewer.isJS&&(d||f)){if(b&&d)return e.addXStr("");c=this.e.loadFileAsync("load()_",c,e.oPt,!0)}b=b?this.vwr.fm.getFilePath(c,
!1,!1):this.vwr.getFileAsString4(c,h,!1,!1,!0,"script");try{return a?e.addXObj(this.vwr.parseJSON(b)):e.addXStr(b)}catch(g){if(M(g,Exception))return!1;throw g;}},"JS.ScriptMathProcessor,~A,~B");q(n,"evaluateMath",function(e,a,b){a=JS.SV.fValue(a[0]);switch(b){case 134218246:a=Math.sqrt(a);break;case 134218244:a=Math.sin(3.141592653589793*a/180);break;case 134218245:a=Math.cos(3.141592653589793*a/180);break;case 134218241:a=180*Math.acos(a)/3.141592653589793}return e.addXFloat(a)},"JS.ScriptMathProcessor,~A,~N");
q(n,"evaluateMeasure",function(e,a,b){var c=0;switch(b){case 1745489939:b=null;for(var d=new JU.Lst,f=x(-1,[3.4028235E38,3.4028235E38]),h=null,g=null,j=!1,k=!1,l=0,n=!1,m=null,q=0,p=3.4028235E38,r=!1,A=!1,m=0;m<a.length;m++)switch(a[m].tok){case 10:var s=a[m].value;0==s.length()&&(n=!0);d.addLast(s);c++;q++;break;case 8:s=new JU.Point3fi;s.setT(a[m].value);d.addLast(s);c++;break;case 2:case 3:f[l++%2]=JS.SV.fValue(a[m]);break;case 4:s=JS.SV.sValue(a[m]);if(s.startsWith("property_")){b=s;break}s.equalsIgnoreCase("vdw")||
s.equalsIgnoreCase("vanderwaals")?p=(m+1<a.length&&2==a[m+1].tok?a[++m].asInt():100)/100:s.equalsIgnoreCase("notConnected")?k=!0:s.equalsIgnoreCase("connected")?j=!0:s.equalsIgnoreCase("minArray")?r=1<=q:s.equalsIgnoreCase("asArray")||0==s.length?A=1<=q:JM.Measurement.isUnits(s)?g=s.toLowerCase():h=c+":"+s;break;default:return!1}if(2>c||4<c||2<l||k&&j)return!1;if(n||3.4028235E38!=p&&(2!=q||2!=c))return e.addXStr("");m=3.4028235E38==p?new J.atomdata.RadiusData(f,0,null,null):new J.atomdata.RadiusData(null,
p,J.atomdata.RadiusData.EnumType.FACTOR,J.c.VDW.AUTO);a=this.vwr.newMeasurementData(null,d).set(0,null,m,b,h,g,null,j,k,null,!0,0,0,null,NaN,null).getMeasurements(A,r);return e.addXObj(a);case 134217729:if(3!=(c=a.length)&&4!=c)return!1;break;default:if(2!=(c=a.length))return!1}b=Array(c);for(m=0;m<c;m++)if(null==(b[m]=e.ptValue(a[m],null)))return!1;switch(c){case 2:return e.addXFloat(b[0].distance(b[1]));case 3:return e.addXFloat(JU.Measure.computeAngleABC(b[0],b[1],b[2],!0));case 4:return e.addXFloat(JU.Measure.computeTorsion(b[0],
b[1],b[2],b[3],!0))}return!1},"JS.ScriptMathProcessor,~A,~N");q(n,"evaluateModulation",function(e,a){var b="",c=NaN,d=null;switch(a.length){case 0:break;case 1:switch(a[0].tok){case 8:d=a[0].value;break;case 4:b=a[0].asString();break;default:c=JS.SV.fValue(a[0])}break;case 2:b=JS.SV.sValue(a[0]);c=JS.SV.fValue(a[1]);break;default:return!1}null==d&&1E6>c&&(d=JU.P3.new3(c,c,c));c=e.getX();c=10==c.tok?c.value:new JU.BS;return e.addXList(this.vwr.ms.getModulationList(c,(b+"D").toUpperCase().charAt(0),
d))},"JS.ScriptMathProcessor,~A");q(n,"evaluatePlane",function(e,a,b){if(134219777==b&&3!=a.length&&4!=a.length||134217763==b&&2!=a.length&&3!=a.length&&4!=a.length||0==a.length||4<a.length)return!1;var c,d,f=this.e.planeValue(a[0]),h,g;switch(a.length){case 1:return 10==a[0].tok&&(a=a[0].value,3==a.cardinality())?(a=this.vwr.ms.getAtomPointVector(a),e.addXPt4(JU.Measure.getPlaneThroughPoints(a.get(0),a.get(1),a.get(2),new JU.V3,new JU.V3,new JU.P4))):null!=f&&e.addXPt4(f);case 2:if(134217763==b){c=
this.e.planeValue(a[1]);if(null==c)return!1;b=new JU.P3;h=new JU.V3;g=new JU.V3;if(null!=f)return a=JU.Measure.getIntersectionPP(f,c),null==a?e.addXStr(""):e.addXList(a);d=e.ptValue(a[0],null);return null==d?e.addXStr(""):e.addXPt(JU.Measure.getIntersection(d,null,c,b,h,g))}case 3:case 4:switch(b){case 134219777:return b=4==a.length?JS.SV.fValue(a[3]):NaN,f=this.e.getHklPlane(JU.P3.new3(JS.SV.fValue(a[0]),JS.SV.fValue(a[1]),JS.SV.fValue(a[2])),b,null),null!=f&&e.addXPt4(f);case 134217763:c=e.ptValue(a[0],
null);d=e.ptValue(a[1],null);if(null==c||null==d)return e.addXStr("");d=JU.V3.newV(d);d.normalize();f=this.e.planeValue(a[2]);if(null!=f)return b=new JU.P3,h=new JU.V3,g=new JU.V3,c=JU.Measure.getIntersection(c,d,f,b,h,g),null==c?e.addXStr(""):e.addXPt(c);b=e.ptValue(a[2],null);if(null==b)return e.addXStr("");h=new JU.V3;b=JU.P3.newP(b);if(3==a.length)return JU.Measure.projectOntoAxis(b,c,d,h),e.addXPt(b);f=JS.SV.fValue(a[3]);a=JU.P3.newP(b);JU.Measure.projectOntoAxis(b,c,d,h);a=a.distance(b);c=new JU.Lst;
a==f?c.addLast(b):a<f&&(a=Math.sqrt(f*f-a*a),h.scaleAdd2(a,d,b),c.addLast(JU.P3.newP(h)),h.scaleAdd2(-a,d,b),c.addLast(JU.P3.newP(h)));return e.addXList(c)}switch(a[0].tok){case 2:case 3:if(3==a.length)return f=JS.SV.fValue(a[0]),b=JS.SV.fValue(a[1]),a=JS.SV.fValue(a[2]),h=JU.V3.new3(0,0,1),d=JU.P3.new3(0,1,0),a=JU.Quat.newVA(d,a),a.getMatrix().rotate(h),d.set(0,0,1),a=JU.Quat.newVA(d,b),a.getMatrix().rotate(h),d.setT(h),d.scale(f),f=new JU.P4,JU.Measure.getPlaneThroughPoint(d,h,f),e.addXPt4(f);break;
case 10:case 8:c=e.ptValue(a[0],null);d=e.ptValue(a[1],null);if(null==d)return!1;b=2<a.length&&(10==a[2].tok||8==a[2].tok)?e.ptValue(a[2],null):null;h=JU.V3.newV(d);if(null==b)return f=new JU.P4,2==a.length||2!=a[2].tok&&3!=a[2].tok&&!a[2].asBoolean()?(b=JU.P3.newP(c),b.add(d),b.scale(0.5),h.sub(c),h.normalize()):1073742335==a[2].tok?b=c:(h.sub(c),b=new JU.P3,b.scaleAdd2(a[2].asFloat(),h,c)),JU.Measure.getPlaneThroughPoint(b,h,f),e.addXPt4(f);f=new JU.V3;a=4==a.length?e.ptValue(a[3],null):null;a=
JU.Measure.getDirectedNormalThroughPoints(c,d,b,a,h,f);return e.addXPt4(JU.P4.new4(h.x,h.y,h.z,a))}}if(4!=a.length)return!1;b=JS.SV.fValue(a[0]);h=JS.SV.fValue(a[1]);c=JS.SV.fValue(a[2]);a=JS.SV.fValue(a[3]);return e.addXPt4(JU.P4.new4(b,h,c,a))},"JS.ScriptMathProcessor,~A,~N");q(n,"evaluatePoint",function(e,a){switch(a.length){default:return!1;case 1:if(3==a[0].tok||2==a[0].tok)return e.addXInt(a[0].asInt());var b=null;if(7==a[0].tok){var c=a[0].getList(),d=c.size();if(0==d)return!1;switch(c.get(0).tok){case 4:b=
c.get(0).value;if(!b.startsWith("{")||"string"==typeof JU.Escape.uP(b))break;for(var b=new JU.Lst,f=0;f<d;f++)b.addLast(JS.SV.getVariable(JU.Escape.uP(JS.SV.sValue(c.get(f)))));return e.addXList(b)}b="{"+JS.SV.sValue(a[0])+"}"}null==b&&(b=JS.SV.sValue(a[0]));c=JU.Escape.uP(b);return A(c,"JU.P3")?e.addXPt(c):e.addXStr(""+c);case 2:switch(a[1].tok){case 1073742334:case 1073742335:switch(a[0].tok){case 8:c=JU.P3.newP(a[0].value);break;case 10:c=this.vwr.ms.getAtomSetCenter(a[0].value);break;default:return!1}1073742335==
a[1].tok?(this.vwr.tm.transformPt3f(c,c),c.y=this.vwr.tm.height-c.y,this.vwr.antialiased&&c.scale(0.5)):(this.vwr.antialiased&&c.scale(2),c.y=this.vwr.tm.height-c.y,this.vwr.tm.unTransformPoint(c,c));break;case 8:d=a[0].getList();if(null==d||4!=d.size())return!1;b=JS.SV.ptValue(a[1]);c=JU.P3.newP(JS.SV.ptValue(d.get(0)));c.scaleAdd2(b.x,JS.SV.ptValue(d.get(1)),c);c.scaleAdd2(b.y,JS.SV.ptValue(d.get(2)),c);c.scaleAdd2(b.z,JS.SV.ptValue(d.get(3)),c);break;default:return!1}return e.addXPt(c);case 3:return e.addXPt(JU.P3.new3(a[0].asFloat(),
a[1].asFloat(),a[2].asFloat()));case 4:return e.addXPt4(JU.P4.new4(a[0].asFloat(),a[1].asFloat(),a[2].asFloat(),a[3].asFloat()))}},"JS.ScriptMathProcessor,~A");q(n,"evaluatePrompt",function(e,a){if(1!=a.length&&2!=a.length&&3!=a.length)return!1;var b=JS.SV.sValue(a[0]),c=1<a.length&&7==a[1].tok?JS.SV.strListValue(a[1]):null,d=null!=c||1==a.length||3==a.length&&a[2].asBoolean(),f=null!=c?null:2<=a.length?JS.SV.sValue(a[1]):"OK",b=""+this.vwr.prompt(b,f,c,d);return d&&null!=c?e.addXInt(Integer.parseInt(b)+
1):e.addXStr(b)},"JS.ScriptMathProcessor,~A");q(n,"evaluateQuaternion",function(e,a,b){var c=null,d=a.length,f=2147483647,h=!1;134221850==b&&(1<d&&(4==a[d-1].tok&&a[d-1].value.equalsIgnoreCase("relative"))&&(d--,h=!0),1<d&&(2==a[d-1].tok&&10==a[0].tok)&&(f=a[d-1].asInt(),0>=f&&(f=2147483646),d--));switch(d){case 0:case 1:case 4:break;case 2:if(134221850==b){if(7==a[0].tok&&(7==a[1].tok||1073742335==a[1].tok))break;if(10==a[0].tok&&(2==a[1].tok||10==a[1].tok))break}if(null==(c=e.ptValue(a[0],null))||
134221850!=b&&8==a[1].tok)return!1;break;case 3:if(134221850!=b)return!1;if(9==a[0].tok){if(8!=a[2].tok&&10!=a[2].tok)return!1;break}for(var g=0;3>g;g++)if(8!=a[g].tok&&10!=a[g].tok)return!1;break;default:return!1}var j=g=null,k=null;switch(d){case 0:return e.addXPt4(this.vwr.tm.getRotationQ().toPoint4f());default:if(134221850==b&&7==a[0].tok){b=this.e.getQuaternionArray(a[0].getList(),1073742001);a=JU.Quat.sphereMean(b,null,1E-4);g=A(a,"JU.Quat")?a:null;break}else if(134221850==b&&10==a[0].tok)j=
this.vwr.getAtomGroupQuaternions(a[0].value,f);else if(11==a[0].tok)g=JU.Quat.newM(a[0].value);else if(9==a[0].tok)k=a[0].value;else if(k=JS.SV.sValue(a[0]),k=JU.Escape.uP(k.equalsIgnoreCase("best")?this.vwr.getOrientation(1073741864,"best",null,null).toString():k),!A(k,"JU.P4"))return!1;134217731==b&&(g=JU.Quat.newVA(JU.P3.new3(k.x,k.y,k.z),k.w));break;case 2:if(134221850==b){if(7==a[0].tok&&7==a[1].tok){b=this.e.getQuaternionArray(a[0].getList(),1073742001);j=this.e.getQuaternionArray(a[1].getList(),
1073742001);j=JU.Quat.arrayDiv(j,b,f,h);break}if(7==a[0].tok&&1073742335==a[1].tok)return b=this.e.getQuaternionArray(a[0].getList(),1073742001),f=x(1,0),JU.Quat.sphereMean(b,f,1E-4),e.addXFloat(f[0]);if(10==a[0].tok&&10==a[1].tok){b=this.vwr.getAtomGroupQuaternions(a[0].value,2147483647);j=this.vwr.getAtomGroupQuaternions(a[1].value,2147483647);j=JU.Quat.arrayDiv(j,b,f,h);break}}g=e.ptValue(a[1],null);k=this.e.planeValue(a[0]);g=null!=g?JU.Quat.getQuaternionFrame(JU.P3.new3(0,0,0),c,g):JU.Quat.newVA(c,
JS.SV.fValue(a[1]));break;case 3:if(9==a[0].tok)return f=8==a[2].tok?a[2].value:this.vwr.ms.getAtomSetCenter(a[2].value),e.addXStr(JU.Escape.drawQuat(JU.Quat.newP4(a[0].value),"q",JS.SV.sValue(a[1]),f,1));b=Array(3);for(g=0;3>g;g++)b[g]=8==a[g].tok?a[g].value:this.vwr.ms.getAtomSetCenter(a[g].value);g=JU.Quat.getQuaternionFrame(b[0],b[1],b[2]);break;case 4:134221850==b?k=JU.P4.new4(JS.SV.fValue(a[1]),JS.SV.fValue(a[2]),JS.SV.fValue(a[3]),JS.SV.fValue(a[0])):g=JU.Quat.newVA(JU.P3.new3(JS.SV.fValue(a[0]),
JS.SV.fValue(a[1]),JS.SV.fValue(a[2])),JS.SV.fValue(a[3]))}if(null!=j){if(2147483647!=f){f=new JU.Lst;for(g=0;g<j.length;g++)f.addLast(j[g].toPoint4f());return e.addXList(f)}g=0<j.length?j[0]:null}return e.addXPt4((null==g?JU.Quat.newP4(k):g).toPoint4f())},"JS.ScriptMathProcessor,~A,~N");q(n,"evaluateRandom",function(e,a){if(3<a.length)return!1;null==this.rand&&(this.rand=new java.util.Random);var b=0,c=1;switch(a.length){case 3:this.rand.setSeed(aa(JS.SV.fValue(a[2])));case 2:c=JS.SV.fValue(a[1]);
case 1:b=JS.SV.fValue(a[0]);case 0:break;default:return!1}return e.addXFloat(this.rand.nextFloat()*(c-b)+b)},"JS.ScriptMathProcessor,~A");q(n,"evaluateRowCol",function(e,a,b){if(1!=a.length)return!1;a=a[0].asInt()-1;var c=e.getX();switch(c.tok){case 11:if(0>a||2<a)break;c=c.value;switch(b){case 1275068935:return b=x(3,0),c.getRow(a,b),e.addXAF(b);default:return b=x(3,0),c.getColumn(a,b),e.addXAF(b)}case 12:if(0>a||2<a)break;c=c.value;switch(b){case 1275068935:return b=x(4,0),c.getRow(a,b),e.addXAF(b);
default:return b=x(4,0),c.getColumn(a,b),e.addXAF(b)}case 7:b=c.getList();for(var c=new JU.Lst,d=0,f=b.size();d<f;d++){var h=b.get(d).getList();if(null==h)return e.addXStr("");c.addLast(a<h.size()?h.get(a):JS.SV.newS(""))}return e.addXList(c)}return!1},"JS.ScriptMathProcessor,~A,~N");q(n,"evaluateIn",function(e,a){var b=e.getX();switch(a.length){case 1:var c=a[0].getList();if(null!=c)for(var d=0,f=c.size();d<f;d++)if(JS.SV.areEqual(b,c.get(d)))return e.addXInt(d+1);break;default:for(d=0;d<a.length;d++)if(JS.SV.areEqual(b,
a[d]))return e.addXInt(d+1)}return e.addXInt(0)},"JS.ScriptMathProcessor,~A");q(n,"evaluateReplace",function(e,a){var b=!1,c,d;switch(a.length){case 0:b=!0;c=d=null;break;case 3:b=JS.SV.bValue(a[2]);case 2:c=JS.SV.sValue(a[0]);d=JS.SV.sValue(a[1]);break;default:return!1}var f=e.getX();if(7==f.tok){for(var f=JS.SV.strListValue(f),h=Array(f.length),g=f.length;0<=--g;)h[g]=null==c?JU.PT.clean(f[g]):b?JU.PT.replaceAllCharacters(f[g],c,d):JU.PT.rep(f[g],c,d);return e.addXAS(h)}f=JS.SV.sValue(f);return e.addXStr(null==
c?JU.PT.clean(f):b?JU.PT.replaceAllCharacters(f,c,d):JU.PT.rep(f,c,d))},"JS.ScriptMathProcessor,~A");q(n,"evaluateScript",function(e,a,b){if((134222350==b||134238732==b)&&1!=a.length||0==a.length)return!1;var c=JS.SV.sValue(a[0]),d=new JU.SB;switch(b){case 134218759:return 2==a.length?c.equalsIgnoreCase("JSON")&&e.addXObj(this.vwr.parseJSON(JS.SV.sValue(a[1]))):e.addXObj(this.vwr.evaluateExpressionAsVariable(c));case 134222850:a=2==a.length?JS.SV.sValue(a[1]):".";a.equals(".")||d.append(this.vwr.jsEval(a+
"\u0001"+c));(a.equals(".")||a.equals("*"))&&this.e.runScriptBuffer(c,d,!0);break;case 134222350:this.e.runScriptBuffer("show "+c,d,!0);break;case 134238732:return e.addX(this.vwr.jsEvalSV(c))}var c=d.toString(),f;return Float.isNaN(f=JU.PT.parseFloatStrict(c))?e.addXStr(c):0<=c.indexOf(".")?e.addXFloat(f):e.addXInt(JU.PT.parseInt(c))},"JS.ScriptMathProcessor,~A,~N");q(n,"evaluateSort",function(e,a,b){if(1<a.length)return!1;if(1275068444==b){if(1==a.length&&4==a[0].tok)return e.addX(e.getX().sortMapArray(a[0].asString()));
var c=0==a.length?0:a[0].asInt();return e.addX(e.getX().sortOrReverse(c))}b=e.getX();a=0==a.length?null:a[0];if(4==b.tok){var c=0,d=JS.SV.sValue(b);if(null==a)return e.addXInt(0);a=JS.SV.sValue(a);for(b=0;b<d.length;b++){b=d.indexOf(a,b);if(0>b)break;c++}return e.addXInt(c)}var c=new JU.Lst,f=d=null,h=JS.SV.getVariable(b.value).sortOrReverse(0).getList();if(null==h)return null==a?e.addXStr(""):e.addXInt(0);b=0;for(var g=h.size();b<=g;b++){var j=b==g?null:h.get(b);if(!(null!=a&&null!=j&&!JS.SV.areEqual(j,
a)))if(JS.SV.areEqual(j,d))f.intValue++;else{if(null!=d){var k=new JU.Lst;k.addLast(d);k.addLast(f);c.addLast(JS.SV.getVariableList(k))}f=JS.SV.newI(1);d=j}}return null==a?e.addX(JS.SV.getVariableList(c)):c.isEmpty()?e.addXInt(0):e.addX(c.get(0).getList().get(1))},"JS.ScriptMathProcessor,~A,~N");q(n,"evaluateString",function(e,a,b){var c=e.getX(),d=0<b.length?JS.SV.sValue(b[0]):1275068932==a?"":"\n";switch(b.length){case 0:break;case 1:if(1073742335==b[0].tok)return e.addX(JS.SV.getVariable(JU.PT.getTokens(c.asString())));
break;case 2:if(7==c.tok)break;if(1275069447==a){c=JS.SV.getVariable(JU.PT.split(JU.PT.rep(c.value,"\n\r","\n").$replace("\r","\n"),"\n"));break}default:return!1}if(7==c.tok&&1275068932!=a&&(1275069447!=a||2==b.length))return e.addX(c),this.evaluateList(e,a,b);b=1275069447==a&&10==c.tok||1275068932==a&&7==c.tok?null:JS.SV.sValue(c);switch(a){case 1275069447:if(10==c.tok){d=c.value;c=this.vwr.ms.mc;b=new JU.Lst;for(a=0;a<c;a++){var f=this.vwr.getModelUndeletedAtomsBitSet(a);f.and(d);b.addLast(JS.SV.getVariable(f))}return e.addXList(b)}return e.addXAS(JU.PT.split(b,
d));case 1275069446:return 0<b.length&&"\n"==b.charAt(b.length-1)&&(b=b.substring(0,b.length-1)),e.addXStr(JU.PT.rep(b,"\n",d));case 1275068932:if(null!=b)return e.addXStr(JU.PT.trim(b,d));c=JS.SV.strListValue(c);for(a=c.length;0<=--a;)c[a]=JU.PT.trim(c[a],d);return e.addXAS(c)}return e.addXStr("")},"JS.ScriptMathProcessor,~N,~A");q(n,"evaluateSubstructure",function(e,a,b,c){if(0==a.length||c&&(134218753==b||1<a.length))return!1;var d=134218756==b&&!c&&134218756==a[0].tok?a[0].value:null;if(null!=
d&&2>a.length)return!1;var f=134218756==b&&!c&&10==a[0].tok,h=134218753==a[0].tok?a[0].value:null!=d&&134218753==a[1].tok?a[1].value:null;if(null!=d&&null==h)return!1;var g=f?null:JS.SV.sValue(a[0]),j=new JU.BS;if(f||0<g.length)try{if(f)return e.addX(JS.SV.newV(134218756,this.vwr.getSmilesMatcher().compileSearchTarget(this.vwr.ms.at,this.vwr.ms.ac,JS.SV.getBitSet(a[0],!1))));if(null!=d)return e.addXBs(this.vwr.getSmilesMatcher().getSubstructureSet(h,d,0,null,2));if(134218753==b)return e.addX(JS.SV.newV(134218753,
this.vwr.getSmilesMatcher().compileSmartsPattern(g)));var k=c?e.getX().value:2==a.length&&10==a[1].tok?a[1].value:this.vwr.getModelUndeletedAtomsBitSet(-1),j=this.vwr.getSmilesMatcher().getSubstructureSet(null==h?g:h,this.vwr.ms.at,this.vwr.ms.ac,k,134218757==b?1:2)}catch(l){if(M(l,Exception))this.e.evalError(l.getMessage(),null);else throw l;}return 134218753!=b&&e.addXBs(j)},"JS.ScriptMathProcessor,~A,~N,~B");q(n,"evaluateSymop",function(e,a,b){var c=a.length,d=null;if(2==a.length&&4==a[0].tok&&
4==a[1].tok&&a[1].value.equalsIgnoreCase("matrix"))return d=this.vwr.getSymStatic().staticConvertOperation(a[0].value,null),null!=d&&e.addXObj(d);if(2==a.length&&12==a[0].tok&&4==a[1].tok&&a[1].value.equalsIgnoreCase("xyz"))return d=this.vwr.getSymStatic().staticConvertOperation("",a[0].value),null!=d&&e.addXObj(d);var f=b?e.getX():null,h=!1;if(null!=f&&10!=f.tok&&!(h=8==f.tok))return!1;d=null==f||h?null:f.value;f=h?JS.SV.ptValue(f):null;!h&&null==d&&(d=this.vwr.getThisModelAtoms());if(0==c){for(var f=
JU.PT.split(JU.PT.trim(this.vwr.getSymTemp().getSpaceGroupInfo(this.vwr.ms,null,null==d||d.isEmpty()?Math.max(0,this.vwr.am.cmi):this.vwr.ms.at[d.nextSetBit(0)].mi,!1,null).get("symmetryInfo"),"\n"),"\n"),g=new JU.Lst,j=0,k=f.length;j<k;j++)g.addLast(JU.PT.split(f[j],"\t"));return e.addXList(g)}var l=null,n=0,k=-2147483648,m=0,q=null,p=null,r=!1;switch(a[0].tok){case 4:l=JS.SV.sValue(a[0]);switch(null==l?"":l.toLowerCase()){case "count":return j=this.vwr.getOperativeSymmetry(),1!=c?!1:e.addXInt(null==
j?0:j.getSpaceGroupOperationCount());case "":n=0;break;case "invariant":n=36868;break;case "wyckoff":n=1086324754;r=!0;break;case "wyckoffm":n=1086324755,r=!0}m++;break;case 12:l=a[0].escape();m++;break;case 2:k=a[0].asInt();m++;break;case 10:h||(p=1==a.length||10!=a[1].tok?d:null,d=this.vwr.getModelUndeletedAtomsBitSet(this.vwr.getModelIndexForAtom(d.nextSetBit(0))))}null==d&&(m<c&&10==a[m].tok&&(d=new JU.BS).or(a[m].value),m+1<c&&10==a[m+1].tok&&(null==d?d=new JU.BS:d).or(a[m+1].value));h=null;
if(c>m&&7==a[m].tok){q=a[m++].getList();if(3!=q.size())return!1;h=JU.P3.new3(JS.SV.fValue(q.get(0)),JS.SV.fValue(q.get(1)),JS.SV.fValue(q.get(2)))}else c>m&&2==a[m].tok&&JU.SimpleUnitCell.ijkToPoint3f(JS.SV.iValue(a[m++]),h=new JU.P3,0,0);null==f&&null!=(f=c>m?e.ptValue(a[m],d):null)&&m++;null!=(q=c>m?e.ptValue(a[m],d):null)&&m++;null!=f&&(null==q&&null!=p&&!p.isEmpty())&&(q=f,f=JU.P3.newP(this.vwr.ms.at[p.nextSetBit(0)]));p=null!=q&&a.length>m&&-2147483648==k&&2==a[m].tok?a[m].intValue:-1;0<=p&&
m++;-2147483648==k&&36868!=n&&(k=0);var x=null;0==n&&(null!=l&&0>l.indexOf(","))&&(m==c?x=this.vwr.ms.getPointGroupInfo(null):6==a[m].tok&&(x=a[m].getMap()));if(null!=x){d=l.indexOf(".");n=l.indexOf("^");0<n?p=JU.PT.parseInt(l.substring(n+1)):(n=l.length,p=1);0<d&&n>d+1?(k=JU.PT.parseInt(l.substring(d+1,n)),1>k&&(k=1),n=d):k=1;l=l.substring(0,n);d=x.get(l+"_m");if(null==d)return d=x.get(l),null==d?e.addXStr(""):e.addXObj(d);var s;try{if(A(d,"JS.SV"))if(s=x.get("center").value,11==d.tok)g=d.value;
else if(7==d.tok)g=d.getList().get(k-1).value;else return!1;else s=x.get("center"),g=A(d,"JU.M3")?d:d.get(k-1);k=g;g=JU.M3.newM3(g);if(1<p)for(j=1;j<p;j++)g.mul(k);if(null==f)return e.addXObj(g);f=JU.P3.newP(f);f.sub(s);g.rotate(f);f.add(s);return e.addXPt(f)}catch(D){if(!M(D,Exception))throw D;}return!1}s=c==m?r?"":36868==n?"id":null!=q?"all":null!=f?"point":"matrix":JS.SV.sValue(a[m++]);c=(j=(!r||b)&&null!=d&&!d.isEmpty())?d.nextSetBit(0):-1;if(r){for(;0<s.length&&JU.PT.isDigit(s.charAt(0));)s=
s.substring(1);d=j?this.vwr.ms.getAtom(c):f;if(null==d)switch(s){case "":case "*":s="*";break;default:if(1==s.length)s+="*";else return!1}if(0==s.length||s.equalsIgnoreCase("label"))s=null;f=null==s?1086324755==n?"":null:s.endsWith("*")||s.equalsIgnoreCase("coord")||s.equalsIgnoreCase("coords")?s:s.substring(0,1);j=this.vwr.getOperativeSymmetry();return e.addXObj(null==j?null:j.getWyckoffPosition(this.vwr,d,null==f?1086324755==n?"M":null:(1086324755==n?"M":"")+f))}s=s.toLowerCase();if(36868==n||s.equals("invariant")&&
b)j&&null==f&&(f=this.vwr.ms.at[c]),0>c&&(c=this.vwr.getThisModelAtoms().nextSetBit(0));if(36868==n&&-2147483648==k){l=null;j=this.vwr.getCurrentUnitCell();null!=f?l=null==j?N(0,0):j.getInvariantSymops(f,null):null!=d&&!d.isEmpty()&&(j=d.nextSetBit(0),f=this.vwr.ms.at[j],l=this.vwr.ms.getSymmetryInvariant(j));if(null!=l&&0<l.length){g=Array(l.length);for(j=0;j<g.length;j++)k=l[j],g[j]=this.vwr.getSymmetryInfo(c,null,k,null,f,f,1275068418,s,0,-1,0,null);return e.addXObj(g)}return null!=l&&e.addXAI(l)}return m==
a.length&&e.addXObj(this.vwr.getSymmetryInfo(c,l,k,h,f,q,1275068418,s,0,p,0,null))},"JS.ScriptMathProcessor,~A,~B");q(n,"evaluateTensor",function(e,a){var b=2==a.length&&1275068445==a[1].tok,c=b?null:e.getX();if(2<a.length||!b&&10!=c.tok)return!1;var c=c.value,d=b||0==a.length?null:JS.SV.sValue(a[0]).toLowerCase(),f=this.vwr.getNMRCalculation();if("unique".equals(d))return e.addXBs(f.getUniqueTensorSet(c));var h=2>a.length?null:JS.SV.sValue(a[1]).toLowerCase();return b?e.addXObj(a[0].value.getInfo(h)):
e.addXList(f.getTensorInfo(d,h,c))},"JS.ScriptMathProcessor,~A");q(n,"evaluateUserFunction",function(e,a,b,c,d){var f=null;if(d)switch(f=e.getX(),f.tok){case 10:break;case 6:if(0<b.length)return!1;f=f.getMap().get(a);return null==f?e.addXStr(""):e.addX(f);default:return!1}a=a.toLowerCase();e.wasX=!1;for(var h=new JU.Lst,g=0;g<b.length;g++)h.addLast(b[g]);if(d)return e.addXObj(this.e.getBitsetProperty(f.value,null,c,null,null,f.value,D(-1,[a,h]),!1,f.index,!1));a=this.e.getUserFunctionResult(a,h,null);
return null==a?!1:e.addX(a)},"JS.ScriptMathProcessor,~S,~A,~N,~B");q(n,"evaluateWithin",function(e,a,b){var c=a.length;if(1>c||5<c)return!1;if(1==c&&10==a[0].tok)return e.addX(a[0]);var d=b?JS.SV.getBitSet(e.getX(),!1):null,f=0,h=a[0].value,g=""+h,j=this.vwr.ms,k=!1,l=!1,n=!1,m=!1,q=null,p=a[0].tok;switch(4==p?p=JS.T.getTokFromName(g):p){case 1648363544:k=!0,h=null;case 3:case 2:m=!0;if(2>c||3==c&&7==a[1].tok&&7!=a[2].tok)return!1;f=k?100:JS.SV.fValue(a[0]);switch(p=a[1].tok){case 1073742335:case 1073742334:l=
a[1].asBoolean();if(2<c&&JS.SV.sValue(a[2]).equalsIgnoreCase("unitcell"))p=1814695966;else if(2<c&&10!=a[2].tok)return!1;c=0;break;case 4:p=JS.SV.sValue(a[1]);if(p.startsWith("$"))return e.addXBs(this.getAtomsNearSurface(f,p.substring(1)));if(p.equalsIgnoreCase("group"))n=!0,p=1086324742;else if(p.equalsIgnoreCase("vanderwaals")||p.equalsIgnoreCase("vdw"))h=null,k=!0,p=1648363544;else if(p=JS.T.getTokFromName(p),0==p)return!1}break;case 7:1==c&&(h=a[0].asString(),p=0);break;case 1073742328:return 3==
c&&A(a[1].value,"JU.BS")&&A(a[2].value,"JU.BS")&&e.addXBs(this.vwr.getBranchBitSet(a[2].value.nextSetBit(0),a[1].value.nextSetBit(0),!0));case 134218757:case 1237320707:case 134218756:f=null;b=!0;switch(c){case 2:f=d;break;case 3:if(b=10==a[2].tok)f=a[2].value;break;default:b=!1}return b&&e.addXObj(this.e.getSmilesExt().getSmilesMatches(JS.SV.sValue(a[1]),null,f,null,134218756==p?2:1,e.asBitSet,!1))}if("string"==typeof h){if(0==p){p=1073742362;if(2<c)return!1;c=2}}else if(!m)return!1;switch(c){case 1:switch(p){case 136314895:case 2097184:case 1812599299:case 1814695966:return e.addXBs(j.getAtoms(p,
null));case 1073741863:return e.addXBs(j.getAtoms(p,""));case 1073742362:return e.addXBs(j.getAtoms(1086324744,g))}return!1;case 2:switch(p){case 1073742362:p=1086324744;break;case 1073741824:case 1086326786:case 1086326785:case 1073741863:case 1086324744:case 1111490587:case 1073742128:case 1073741925:case 1073742189:return e.addXBs(this.vwr.ms.getAtoms(p,JS.SV.sValue(a[1])));case 1094713349:case 1094713350:return e.addXBs(this.vwr.ms.getAtoms(p,JS.SV.ptValue(a[1])));case 1814695966:d=a[1].getList();
if(null==d)return!1;f=f=null;if(4!=d.size())return!1;f=Array(4);for(a=0;4>a;a++)if(null==(f[a]=JS.SV.ptValue(d.get(a))))return!1;f=this.vwr.getSymTemp().getUnitCell(f,!1,null);return e.addXBs(this.vwr.ms.getAtoms(p,f))}break;case 3:switch(p){case 1073742335:case 1073742334:case 1086324742:case 1648363544:case 1814695966:case 134217750:case 134219777:case 1073742329:case 8:case 7:break;case 1086324744:g=JS.SV.sValue(a[2]);break;default:return!1}}var r=null,h=c=null,x=a.length-1;switch(a[x].tok){case 9:r=
a[x].value;break;case 8:c=a[x].value;JS.SV.sValue(a[1]).equalsIgnoreCase("hkl")&&(r=this.e.getHklPlane(c,NaN,null));break;case 7:h=2==x&&7==a[1].tok?a[1].getList():null,c=2==x?JS.SV.ptValue(a[1]):1==x?JU.P3.new3(NaN,0,0):null}if(null!=r)return e.addXBs(j.getAtomsNearPlane(f,r));j=10==a[x].tok?a[x].value:null;null==d&&(d=j);if(0<x&&null==c&&null==h&&null==d)return!1;if(1814695966==p)return(null!=d||null!=c)&&e.addXObj(this.vwr.ms.getUnitCellPointsWithin(f,d,c,l));if(null!=c||null!=h){if(7==a[x].tok){b=
a[x].getList();p=Array(b.size());for(a=p.length;0<=--a;)p[a]=JS.SV.ptValue(b.get(a));b=null;if(null!=h){b=Array(h.size());for(a=b.length;0<=--a;)b[a]=JS.SV.ptValue(h.get(a))}a=Array(1);null!=d&&(d.and(this.vwr.getAllAtoms()),b=this.vwr.ms.at);switch(J.bspt.PointIterator.withinDistPoints(f,c,p,b,d,a)){case 10:return e.addXBs(a[0]);case 134217751:return e.addXPt(a[0]);case 1073742001:return e.addXList(a[0]);case 1275068418:return e.addXAI(a[0]);case 4:return e.addXStr(a[0]);default:return!1}}return e.addXBs(this.vwr.getAtomsNearPt(f,
c,null))}if(1086324744==p)return e.addXBs(this.vwr.ms.getSequenceBits(g,d,new JU.BS));null==d&&(d=new JU.BS);if(!m)try{return e.addXBs(this.vwr.ms.getAtoms(p,d))}catch(s){if(M(s,Exception))return!1;throw s;}if(n)return e.addXBs(this.vwr.getGroupsWithin(aa(f),d));k&&(q=new J.atomdata.RadiusData(null,10<f?f/100:f,10<f?J.atomdata.RadiusData.EnumType.FACTOR:J.atomdata.RadiusData.EnumType.OFFSET,J.c.VDW.AUTO),0>f&&(f=0));d=this.vwr.ms.getAtomsWithinRadius(f,b?j:d,l,q,b?d:null);b&&d.andNot(j);return e.addXBs(d)},
"JS.ScriptMathProcessor,~A,~B");q(n,"evaluateWrite",function(e,a){var b=a.length,c=!1;2==b&&1073742335==a[1].tok&&(b=1,c=!0);switch(b){case 0:return!1;case 1:var d=a[0].asString().toUpperCase();if(d.equals("PNGJ"))return b=this.vwr.fm.getFileAsMap(null,"PNGJ",c),c?e.addX(JS.SV.newV(15,new JU.BArray(b))):e.addXMap(b);if(JU.PT.isOneOf(d,";ZIP;ZIPALL;JMOL;")){var b=new java.util.Hashtable,f=new JU.OC;b.put("outputChannel",f);this.vwr.createZip(null,d,b);d=f.toByteArray();if(c)return e.addX(JS.SV.newV(15,
new JU.BArray(d)));b=new java.util.Hashtable;this.vwr.readFileAsMap(JU.Rdr.getBIS(d),b,null);return e.addXMap(b)}}return e.addXStr(this.e.getCmdExt().dispatch(134221856,!0,a))},"JS.ScriptMathProcessor,~A");q(n,"getAtomsNearSurface",function(e,a){var b=D(-1,[a,null,null]);if(this.e.getShapePropertyData(24,"getVertices",b))return this.getAtomsNearPts(e,b[1],b[2]);b[1]=Integer.$valueOf(0);b[2]=Integer.$valueOf(-1);if(this.e.getShapePropertyData(22,"getCenter",b))return this.vwr.getAtomsNearPt(e,b[2],
null);b[1]=Float.$valueOf(e);return this.e.getShapePropertyData(21,"getAtomsWithin",b)?b[2]:new JU.BS},"~N,~S");q(n,"getAtomsNearPts",function(e,a,b){var c=new JU.BS;if(0==a.length||null!=b&&b.isEmpty())return c;null==b&&(b=JU.BSUtil.setAll(a.length));for(var d=this.vwr.ms.at,f=this.vwr.ms.ac;0<=--f;){var h=d[f];if(null!=h)for(var g=b.nextSetBit(0);0<=g;g=b.nextSetBit(g+1))if(h.distance(a[g])<e){c.set(f);break}}return c},"~N,~A,JU.BS");q(n,"getMinMax",function(e,a,b){for(var c=null,d=null,f=0,h=null;;){if(JU.AU.isAF(e)){if(1275068725==
a)return Float.$valueOf(NaN);c=e;f=c.length;if(0==f)break}else if(A(e,"JU.Lst"))if(d=e,f=d.size(),0==f){if(1275068725!=a)break}else{if(1275068725!=a){e=d.get(0);if(8==e.tok)return this.getMinMaxPoint(d,a);if(4==e.tok&&e.value.startsWith("{")){b=JS.SV.ptValue(e);if(A(b,"JU.P3"))return this.getMinMaxPoint(d,a);if(A(b,"JU.P4"))return this.getMinMaxQuaternion(d,a);break}}}else break;var g,j=!1;switch(a){case 1275068725:h=new java.util.Hashtable;e=g=0;break;case 32:j=!0;e=3.4028235E38;g=2147483647;break;
case 64:e=-3.4028235E38;g=-2147483647;break;default:e=g=0}for(var k=0,l=0,n=!0,m=1275068725==a;0<=--f;){var q=null==d?null:d.get(f),p=!b?null:null==q?JS.SV.vF:q,r=m?1:null==c?JS.SV.fValue(p):c[f];if(!Float.isNaN(r))switch(l++,a){case 160:case 192:k+=r*r;case 128:case 96:e+=r;break;case 1275068725:q=null==p?q.toString():p.asString();p=h.get(q);h.put(q,null==p?Integer.$valueOf(1):Integer.$valueOf(p.intValue()+1));break;case 32:case 64:n=(new Boolean(n&2==p.tok)).valueOf(),j==r<e&&(e=r,n&&(g=p.intValue))}}if(1275068725==
a)return h;if(0==l)break;switch(a){case 96:e/=l;break;case 192:if(1==l)break;e=Math.sqrt((k-e*e/l)/(l-1));break;case 32:case 64:if(n)return Integer.$valueOf(g);break;case 160:e=k}return Float.$valueOf(e)}return JS.MathExt.nan},"~O,~N,~B");q(n,"getMinMaxPoint",function(e,a){var b=null,c=null,d=0;A(e,Array)?(b=e,d=b.length):A(e,"JU.Lst")&&(c=e,d=c.size());if(null==c&&null==b)return JS.MathExt.nan;for(var f=new JU.P3,h=x(d,0),g=0;3>g;g++){for(var j=0;j<d;j++){var k=null==b?JS.SV.ptValue(c.get(j)):b[j];
if(null==k)return JS.MathExt.nan;switch(g){case 0:h[j]=k.x;break;case 1:h[j]=k.y;break;case 2:h[j]=k.z}}j=this.getMinMax(h,a,!0);if(!A(j,Number))return JS.MathExt.nan;j=j.floatValue();switch(g){case 0:f.x=j;break;case 1:f.y=j;break;case 2:f.z=j}}return f},"~O,~N");q(n,"getMinMaxQuaternion",function(e,a){var b;switch(a){case 32:case 64:case 128:case 160:return JS.MathExt.nan}for(;;){b=this.e.getQuaternionArray(e,1073742001);if(null==b)break;var c=x(1,0);b=JU.Quat.sphereMean(b,c,1E-4);switch(a){case 96:return b;
case 192:return Float.$valueOf(c[0])}break}return JS.MathExt.nan},"JU.Lst,~N");q(n,"getPatternMatcher",function(){return null==this.pm?this.pm=J.api.Interface.getUtil("PatternMatcher",this.e.vwr,"script"):this.pm});q(n,"opTokenFor",function(e){switch(e){case 1275069441:case 1275069446:return JS.T.tokenPlus;case 1275068931:return JS.T.tokenMinus;case 1275068929:return JS.T.tokenTimes;case 1275068930:return JS.T.tokenMul3;case 1275068928:return JS.T.tokenDivide}return null},"~N");q(n,"setContactBitSets",
function(e,a,b,c,d,f){var h,g;null==a?(a=JU.BSUtil.setAll(this.vwr.ms.ac),JU.BSUtil.andNot(a,this.vwr.slm.bsDeleted),a.andNot(e),h=!1):(g=JU.BSUtil.copy(e),g.or(a),g=this.vwr.ms.getModelBS(g,!1).cardinality(),h=1<g,f&&(1<g&&!this.e.tQuiet)&&this.e.showString(J.i18n.GT.$("Note: More than one model is involved in this contact!")));if(!e.equals(a)){if(f=!b||e.cardinality()<a.cardinality())g=this.vwr.ms.getAtomsWithinRadius(c,e,h,Float.isNaN(c)?d:null,null),a.and(g);b&&(g=this.vwr.ms.getAtomsWithinRadius(c,
a,h,Float.isNaN(c)?d:null,null),e.and(g),f||(g=this.vwr.ms.getAtomsWithinRadius(c,e,h,Float.isNaN(c)?d:null,null),a.and(g)),g=JU.BSUtil.copy(a),g.and(e),g.equals(e)?a.andNot(e):g.equals(a)&&e.andNot(a))}return a},"JU.BS,JU.BS,~B,~N,J.atomdata.RadiusData,~B");n.nan=Float.$valueOf(NaN);n.t0=System.currentTimeMillis()});V("J.bspt");W(null,"J.bspt.PointIterator","JU.BS $.Lst $.P3 J.bspt.Bspt JU.BSUtil $.Point3fi".split(" "),function(){var n=ja(J.bspt,"PointIterator",null);n.withinDistPoints=q(n,"withinDistPoints",
function(e,a,b,c,d,f){var h=new JU.Lst,g=new J.bspt.Bspt(3,0),j;if(null!=a&&Float.isNaN(a.x)){for(var k=Array(b.length),l=k.length;0<=--l;){j=b[l];if(null==j)return 0;null==d?(a=new JU.Point3fi,a.setT(j),a.i=l,k[l]=a,g.addTuple(a)):g.addTuple(j)}j=g.allocateCubeIterator();if(null!=d){b=JU.BS.newN(c.length);for(l=d.nextSetBit(0);0<=l;l=d.nextSetBit(l+1)){j.initialize(c[l],e,!1);for(g=e*e;j.hasMoreElements();)if(j.nextElement().distanceSquared(c[l])<=g){b.set(l);break}}f[0]=b;return 10}b=JU.BSUtil.newBitSet2(0,
b.length);for(l=k.length;0<=--l;){j.initialize(a=k[l],e,!1);g=e*e;for(d=0;j.hasMoreElements();)c=j.nextElement(),b.get(c.i)&&(c.distanceSquared(a)<=g&&1<++d)&&b.clear(c.i)}for(l=b.nextSetBit(0);0<=l;l=b.nextSetBit(l+1))h.addLast(JU.P3.newP(k[l]));f[0]=h;return 1073742001}if(0==e){if(null==c){g=3.4028235E38;k=null;for(l=b.length;0<=--l;)h=b[l],e=h.distanceSquared(a),e<g&&(k=h,g=e);f[0]=null==k?"":k;return null==k?4:134217751}k=N(c.length,0);for(l=k.length;0<=--l;){g=3.4028235E38;d=-1;a=c[l];for(j=
b.length;0<=--j;)h=b[j],e=h.distanceSquared(a),e<g&&(d=j,g=e);k[l]=d}f[0]=k;return 1275068418}for(l=b.length;0<=--l;)g.addTuple(b[l]);j=g.allocateCubeIterator();j.initialize(a,e,!1);for(g=e*e;j.hasMoreElements();)c=j.nextElement(),c.distanceSquared(a)<=g&&h.addLast(c);j.release();f[0]=h;return 1073742001},"~N,JU.P3,~A,~A,JU.BS,~A")});V("JU");W(null,"JU.PatternMatcher",["JV.Viewer"],function(){var n=ja(JU,"PatternMatcher",null);q(n,"compile",function(e,a){if(JV.Viewer.isJS&&!JV.Viewer.isSwingJS)return new JU.PatternMatcher.JSPattern(e,
a)},"~S,~B");n=$(function(){this.strString=this.regexp=null;this.rightBound=this.leftBound=-1;this.results=null;Z(this,arguments)},JU.PatternMatcher,"JSPattern",null);ka(n,function(e,a){this.regexp=RegExp(e,a?"gi":"g")},"~S,~B");q(n,"find",function(){var e=this.rightBound==this.strString.length?this.strString:this.strString.substring(0,this.rightBound);this.regexp.lastIndex=this.leftBound;this.results=this.regexp.exec(e);this.leftBound=this.regexp.lastIndex;return null!=this.results});q(n,"start",
function(){return this.regexp.lastIndex-this.results[0].length});q(n,"end",function(){return this.regexp.lastIndex});q(n,"group",function(){return null==this.results||0==this.results.length?null:this.results[0]});q(n,"matcher",function(e){this.strString=e;this.leftBound=0;this.rightBound=e.length;return this},"~S")})})(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);
