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