");h=c.length-1+" matches";break;case "$":case ":":break;default:return}a._infoHeader=h;a._info=e.join("");a._showInfo(!0)};a._loadSuccess=function(b,c){c&&(a._ajaxDone(),c(b))};a._loadError=
function(b){a._ajaxDone();a.say("Error connecting to server: "+a._ajaxCall);null!=b&&b()};a._isDatabaseCall=function(b){return 0<=a.db._databasePrefixes.indexOf(b.substring(0,1))};a._getDirectDatabaseCall=function(b,c){if(c&&!a.featureDetection.supportsXhr2())return b;var d=2,e=b.substring(0,d),h=a.db._DirectDatabaseCalls[e]||a.db._DirectDatabaseCalls[e=b.substring(0,--d)];h&&(":"==e?(e=b.toLowerCase(),isNaN(parseInt(b.substring(1)))?0==e.indexOf(":smiles:")?(h+="?POST?smiles="+b.substring(8),b="smiles"):
0==e.indexOf(":cid:")?b="cid/"+b.substring(5):(0==e.indexOf(":name:")?b=b.substring(5):0==e.indexOf(":cas:")&&(b=b.substring(4)),b="name/"+encodeURIComponent(b.substring(d))):b="cid/"+b.substring(1)):b=encodeURIComponent(b.substring(d)),0<=h.indexOf("FILENCI")?(b=b.replace(/\%2F/g,"/"),b=h.replace(/\%FILENCI/,b)):b=h.replace(/\%FILE/,b));return b};a._getRawDataFromServer=function(b,c,d,e,h,l){b="?call=getRawDataFromDatabase&database="+b+(0<=c.indexOf("?POST?")?"?POST?":"")+"&query="+encodeURIComponent(c)+
(h?"&encoding=base64":"")+(l?"":"&script="+encodeURIComponent(a._getScriptForDatabase(b)));return a._contactServer(b,d,e)};a._checkFileName=function(b,c,d){a._isDatabaseCall(c)&&(d&&a._setQueryTerm(b,c),c=a._getDirectDatabaseCall(c,!0),a._isDatabaseCall(c)&&(c=a._getDirectDatabaseCall(c,!1),d&&(d[0]=!0)));return c};a._checkCache=function(b,c,d){if(b._cacheFiles&&a._fileCache&&!c.endsWith(".js")){if(b=a._fileCache[c])return System.out.println("using "+b.length+" bytes of cached data for "+c),d(b),
null;d=function(b,c){d(a._fileCache[b]=c)}}return d};a._loadFileData=function(b,c,d,e){var h=[];c=a._checkFileName(b,c,h);d=a._checkCache(b,c,d);h[0]?a._getRawDataFromServer("_",c,d,e):(b={type:"GET",dataType:"text",url:c,async:a._asynchronous,success:function(b){a._loadSuccess(b,d)},error:function(){a._loadError(e)}},a._checkAjaxPost(b),a._ajax(b))};a._getInfoFromDatabase=function(b,c,d){if("===="==c){var e=a.db._restQueryXml.replace(/QUERY/,d),e={dataType:"text",type:"POST",contentType:"application/x-www-form-urlencoded",
url:a.db._restQueryUrl,data:encodeURIComponent(e)+"&req=browser",success:function(e){a._ajaxDone();a._extractInfoFromRCSB(b,c,d,e)},error:function(){a._loadError(null)},async:a._asynchronous};return a._ajax(e)}d="?call=getInfoFromDatabase&database="+c+"&query="+encodeURIComponent(d);return a._contactServer(d,function(d){a._setInfo(b,c,d)})};a._extractInfoFromRCSB=function(b,c,d,e){var h=e.length/5;if(0!=h&&4==d.length&&1!=h){d=d.toUpperCase();var l=e.indexOf(d);0l.indexOf("?")&&l==b._thisJmolModel)){b._thisJmolModel=l;var j;e&&null!=b._viewSet&&null!=(j=a.View.__findView(b._viewSet,{chemID:l}))?a.View.__setView(j,
b,!1):("$"==h||":"==h?b._jmolFileType="MOL":"="==h&&(b._jmolFileType="PDB"),b._searchDatabase(c,h,d))}};a._searchDatabase=function(b,c,d,e){b._showInfo(!1);return 0<=c.indexOf("?")?(a._getInfoFromDatabase(b,d,c.split("?")[0]),!0):a.db._DirectDatabaseCalls[d]?(b._loadFile(d+c,e),!0):!1};a._syncBinaryOK="?";a._canSyncBinary=function(b){if(a._isAsync)return!0;if(self.VBArray)return a._syncBinaryOK=!1;if("?"!=a._syncBinaryOK)return a._syncBinaryOK;a._syncBinaryOK=!0;try{var c=new window.XMLHttpRequest;
c.open("text",a._ajaxTestSite,!1);c.hasOwnProperty("responseType")?c.responseType="arraybuffer":c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined")}catch(d){return System.out.println("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._alertNoBinary&&!b&&alert("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._syncBinaryOK=!1}return!0};a._binaryTypes=".gz .jpg .gif .png .zip .jmol .bin .smol .spartan .mrc .map .ccp4 .dn6 .delphi .omap .pse .dcd".split(" ");
a._isBinaryUrl=function(b){for(var c=a._binaryTypes.length;0<=--c;)if(0<=b.indexOf(a._binaryTypes[c]))return!0;return!1};a._getFileData=function(b,c,d){var e=a._isBinaryUrl(b),h=0<=b.indexOf("pdb.gz")&&0==b.indexOf("http://www.rcsb.org/pdb/files/"),l=e&&!a._canSyncBinary(h);l&&h&&(b=b.replace(/pdb\.gz/,"pdb"),l=e=!1);h=0<=b.indexOf("?POST?");0==b.indexOf("file:/")&&0!=b.indexOf("file:///")&&(b="file://"+b.substring(5));var j=0>b.indexOf("://")||0==b.indexOf(document.location.protocol)&&0<=b.indexOf(document.location.host),
t="https://"==a._httpProto&&0==b.indexOf("http://"),m=a._isDirectCall(b);!m&&0<=b.indexOf("?ALLOWSORIGIN?")&&(m=!0,b=b.replace(/\?ALLOWSORIGIN\?/,""));var s=!j&&a.$supportsIECrossDomainScripting(),w=null;if(t||l||!j&&!m||!c&&s)w=a._getRawDataFromServer("_",b,c,c,l,!0);else{b=b.replace(/file:\/\/\/\//,"file://");var P={dataType:e?"binary":"text",async:!!c};h?(P.type="POST",P.url=b.split("?POST?")[0],P.data=b.split("?POST?")[1]):(P.type="GET",P.url=b);c&&(P.success=function(){c(a._xhrReturn(P.xhr))},
P.error=function(){c(P.xhr.statusText)});P.xhr=a.$ajax(P);c||(w=a._xhrReturn(P.xhr))}if(!d)return w;null==w&&(w="",e=!1);e&&(e=a._canSyncBinary(!0));return e?a._strToBytes(w):JU.SB.newS(w)};a._xhrReturn=function(a){return!a.responseText||self.Clazz&&Clazz.instanceOf(a.response,self.ArrayBuffer)?a.response||a.statusText:a.responseText};a._isDirectCall=function(b){if(0<=b.indexOf("?ALLOWSORIGIN?"))return!0;for(var c in a.db._DirectDatabaseCalls)if(0<=c.indexOf(".")&&0<=b.indexOf(c))return!0;return!1};
a._cleanFileData=function(a){return 0<=a.indexOf("\r")&&0<=a.indexOf("\n")?a.replace(/\r\n/g,"\n"):0<=a.indexOf("\r")?a.replace(/\r/g,"\n"):a};a._getFileType=function(a){var c=a.substring(0,1);if("$"==c||":"==c)return"MOL";if("="==c)return"="==a.substring(1,2)?"LCIF":"PDB";a=a.split(".").pop().toUpperCase();return a.substring(0,Math.min(a.length,3))};a._getZ=function(b,c){return b&&b._z&&b._z[c]||a._z[c]};a._incrZ=function(b,c){return b&&b._z&&++b._z[c]||++a._z[c]};a._hideLocalFileReader=function(b,
c){b._localReader&&a.$setVisible(b._localReader,!1);b._readingLocal=!1;a._setCursor(b,c||0)};a._loadFileAsynchronously=function(b,c,d,e){if(0!=d.indexOf("?")){var h=d;d=a._checkFileName(c,d);var l=function(c){a._setData(b,d,h,c,e)},l=a._checkCache(c,d,l);0<=d.indexOf("|")&&(d=d.split("|")[0]);return null==l?null:a._getFileData(d,l)}if(!a.featureDetection.hasFileReader)return b.setData("Local file reading is not enabled in your browser",null,null,e);c._localReader||(l='
',a.$after("#"+c._id+"_appletdiv",l.replace(/ID/g,c._id+"_localReader")),c._localReader=a.$(c,"localReader"));a.$appEvent(c,"localReader_loadfile","click");a.$appEvent(c,"localReader_loadfile","click",function(){var d=a.$(c,"localReader_files")[0].files[0],h=
new FileReader;h.onloadend=function(h){h.target.readyState==FileReader.DONE&&(a._hideLocalFileReader(c,3),a._setData(b,d.name,d.name,h.target.result,e))};try{h.readAsArrayBuffer(d)}catch(l){alert("You must select a file first.")}});a.$appEvent(c,"localReader_cancel","click");a.$appEvent(c,"localReader_cancel","click",function(){a._hideLocalFileReader(c);b.setData("#CANCELED#",null,null,e)});a.$setVisible(c._localReader,!0);c._readingLocal=!0};a._setData=function(b,c,d,e,h){e=a._strToBytes(e);0<=c.indexOf(".jdx")&&
a.Cache.put("cache://"+c,e);b.setData(c,d,e,h)};a._doAjax=function(b,c,d){b=b.toString();if(null!=d)return a._saveFile(b,d);c&&(b+="?POST?"+c);return a._getFileData(b,null,!0)};a._saveFile=function(b,c,d,e){if(a._localFileSaveFunction&&a._localFileSaveFunction(b,c))return"OK";b=b.substring(b.lastIndexOf("/")+1);d||(d=0<=b.indexOf(".pdf")?"application/pdf":0<=b.indexOf(".png")?"image/png":0<=b.indexOf(".gif")?"image/gif":0<=b.indexOf(".jpg")?"image/jpg":"");var h="string"==typeof c;h||(c=(JU?JU:J.util).Base64.getBase64(c).toString());
e||(e=h?"":"base64");(h=a._serverUrl)&&0<=h.indexOf("your.server")&&(h="");a._useDataURI||!h?(e||(c=btoa(c)),e=document.createElement("a"),e.href="data:"+d+";base64,"+c,e.type=d||"text/plain",e.download=b,e.target="_blank",m("body").append(e),e.click(),e.remove()):(a._formdiv||(a.$after("body",'