(function(v,w,x,y,z,A,m,B,n,p,q,C,D,r,E,F,G,H,I,s,t,K,u,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,f,k){m("J.console");u(J.console,"GenericTextArea");m("J.console");n(["J.api.JmolAppConsoleInterface","$.JmolCallbackListener","java.util.Hashtable"],"J.console.GenericConsole",["JU.PT","J.c.CBK","J.i18n.GT","JS.T","JV.Viewer"],function(){var b=q(function(){this.label1=this.defaultMessage=this.loadButton=this.clearInButton=this.clearOutButton=this.stateButton=this.historyButton=
this.runButton=this.editButton=this.menuMap=this.vwr=this.output=this.input=null;this.nTab=0;this.pageUpBuffer=this.incompleteCmd=null;p(this,arguments)},J.console,"GenericConsole",null,[J.api.JmolAppConsoleInterface,J.api.JmolCallbackListener]);s(b,function(){this.menuMap=new java.util.Hashtable});f(b,"setViewer",function(a){this.vwr=a;null==J.console.GenericConsole.labels&&(a=new java.util.Hashtable,a.put("title",J.i18n.GT.$("Jmol Script Console")+" "+JV.Viewer.getJmolVersion()),this.setupLabels(a),
J.console.GenericConsole.labels=a)},"JV.Viewer");f(b,"addButton",function(a,c){a.addConsoleListener(this);this.menuMap.put(c,a);return a},"J.api.JmolAbstractButton,~S");f(b,"getLabel1",function(){return null});f(b,"setupLabels",function(a){a.put("saveas",J.i18n.GT.$("&Save As..."));a.put("file",J.i18n.GT.$("&File"));a.put("close",J.i18n.GT.$("&Close"));this.setupLabels0(a)},"java.util.Map");f(b,"setupLabels0",function(a){a.put("help",J.i18n.GT.$("&Help"));a.put("search",J.i18n.GT.$("&Search..."));
a.put("commands",J.i18n.GT.$("&Commands"));a.put("functions",J.i18n.GT.$("Math &Functions"));a.put("parameters",J.i18n.GT.$("Set &Parameters"));a.put("more",J.i18n.GT.$("&More"));a.put("Editor",J.i18n.GT.$("Editor"));a.put("State",J.i18n.GT.$("State"));a.put("Run",J.i18n.GT.$("Run"));a.put("Clear Output",J.i18n.GT.$("Clear Output"));a.put("Clear Input",J.i18n.GT.$("Clear Input"));a.put("History",J.i18n.GT.$("History"));a.put("Load",J.i18n.GT.$("Load"));a.put("label1",J.i18n.GT.$("press CTRL-ENTER for new line or paste model data and press Load"));
a.put("default",J.i18n.GT.$("Messages will appear here. Enter commands in the box below. Click the console Help menu item for on-line help, which will appear in a new browser window."))},"java.util.Map");f(b,"setLabels",function(){var a=J.i18n.GT.setDoTranslate(!0);this.editButton=this.setButton("Editor");this.stateButton=this.setButton("State");this.runButton=this.setButton("Run");this.clearOutButton=this.setButton("Clear Output");this.clearInButton=this.setButton("Clear Input");this.historyButton=
this.setButton("History");this.loadButton=this.setButton("Load");this.defaultMessage=J.console.GenericConsole.getLabel("default");this.setTitle();J.i18n.GT.setDoTranslate(a)});b.getLabel=f(b,"getLabel",function(a){return J.console.GenericConsole.labels.get(a)},"~S");f(b,"displayConsole",function(){this.layoutWindow(null);this.outputMsg(this.defaultMessage)});f(b,"updateLabels",function(){});f(b,"completeCommand",function(a){if(0==a.length)return null;var c=0>=this.nTab||null==this.incompleteCmd?a:
this.incompleteCmd;this.incompleteCmd=c;a=J.console.GenericConsole.splitCommandLine(a);if(null==a)return null;var d=null==a[2],b=null!=a[3],e=a[d?1:2],h=a[1];if(0==e.length)return null;a=JS.T.getTokenFromName(h.trim().toLowerCase());var j=JS.T.tokAttr(null==a?0:a.tok,12288);a=J.console.GenericConsole.splitCommandLine(c);var g=null;if(!d&&('"'==e.charAt(0)||"'"==e.charAt(0)))d=e.charAt(0),JU.PT.trim(e,"\"'"),e=JU.PT.trim(a[2],"\"'"),g=this.nextFileName(e,this.nTab),null!=g&&(g=a[0]+a[1]+d+g+d);else{g=
null;if(!d&&(e=h,b||a[2].startsWith("$")||j))g=new java.util.Hashtable,this.vwr.getObjectMap(g,b||j?"{":a[2].startsWith("$")?"$":"0");g=JS.T.completeCommand(g,h.equalsIgnoreCase("set "),d,d?a[1]:a[2],this.nTab);g=a[0]+(null==g?e:d?g:a[1]+g)}return null==g||g.equals(c)?null:g},"~S");f(b,"doAction",function(a){if(a===this.runButton)this.execute(null);else if(a===this.editButton)this.vwr.getProperty("DATA_API","scriptEditor",null);else if(a===this.historyButton)this.clearContent(this.vwr.getSetHistory(2147483647));
else if(a===this.stateButton)this.clearContent(this.vwr.getStateInfo());else if(a===this.clearInButton){this.input.setText("");return}a===this.clearOutButton?this.output.setText(""):a===this.loadButton?this.vwr.loadInlineAppend(this.input.getText(),!1):this.isMenuItem(a)&&this.execute(a.getName())},"~O");f(b,"execute",function(a){var c=null==a?this.input.getText():a;null==a&&this.input.setText(null);a=this.vwr.script(c+"; ## GUI ##\u0001## EDITOR_IGNORE ##; ## GUI ##");null!=a&&!a.equals("pending")&&
this.outputMsg(a)},"~S");f(b,"destroyConsole",function(){this.vwr.isApplet&&this.vwr.getProperty("DATA_API","getAppConsole",Boolean.FALSE)});b.setAbstractButtonLabels=f(b,"setAbstractButtonLabels",function(a,c){for(var d,b=a.keySet().iterator();b.hasNext()&&((d=b.next())||1);){var e=a.get(d),h=c.get(d);if(d.indexOf("Tip")==d.length-3)e.setToolTipText(c.get(d));else{var j=J.console.GenericConsole.getMnemonic(h);" "!=j&&e.setMnemonic(j);h=J.console.GenericConsole.getLabelWithoutMnemonic(h);e.setText(h)}}},
"java.util.Map,java.util.Map");b.getLabelWithoutMnemonic=f(b,"getLabelWithoutMnemonic",function(a){if(null==a)return null;var c=a.indexOf("&");return-1==c?a:a.substring(0,c)+(c<a.length-1?a.substring(c+1):"")},"~S");b.getMnemonic=f(b,"getMnemonic",function(a){if(null==a)return" ";var c=a.indexOf("&");return-1==c||c==a.length-1?" ":a.charAt(c+1)},"~S");b.map=f(b,"map",function(a,c,d,b){d=J.console.GenericConsole.getMnemonic(d);" "!=d&&a.setMnemonic(d);null!=b&&b.put(c,a)},"~O,~S,~S,java.util.Map");
k(b,"notifyEnabled",function(a){switch(a){case J.c.CBK.ECHO:case J.c.CBK.MEASURE:case J.c.CBK.MESSAGE:case J.c.CBK.PICK:return!0}return!1},"J.c.CBK");k(b,"notifyCallback",function(a,c){var d=null==c||null==c[1]?null:c[1].toString();switch(a){case J.c.CBK.ECHO:this.sendConsoleEcho(d);break;case J.c.CBK.MEASURE:var b=c[3];0<=b.indexOf("Picked")||0<=b.indexOf("Sequence")?this.sendConsoleMessage(d):0<=b.indexOf("Completed")&&this.sendConsoleEcho(d);break;case J.c.CBK.MESSAGE:this.sendConsoleMessage(null==
c?null:d);break;case J.c.CBK.PICK:this.sendConsoleMessage(d)}},"J.c.CBK,~A");k(b,"getText",function(){return this.output.getText()});k(b,"sendConsoleEcho",function(a){null==a?(this.updateLabels(),this.outputMsg(null),a=this.defaultMessage):a.equals("\x00")&&(Clazz_Console.clear(),a=null);this.outputMsg(a)},"~S");f(b,"outputMsg",function(a){var c=null==a?-1:a.length;switch(c){case -1:this.output.setText("");return;default:if("\n"==a.charAt(c-1))break;case 0:a+="\n"}this.output.append(a)},"~S");f(b,
"clearContent",function(a){this.output.setText(a)},"~S");k(b,"sendConsoleMessage",function(a){null!=a&&this.output.getText().startsWith(this.defaultMessage)&&this.outputMsg(null);this.outputMsg(a)},"~S");k(b,"setCallbackFunction",function(){},"~S,~S");k(b,"zap",function(){});f(b,"recallCommand",function(a,c){var d=c?this.vwr.historyFind(null==this.pageUpBuffer?this.pageUpBuffer=this.getCommandString():this.pageUpBuffer,a?-1:1):this.vwr.getSetHistory(a?-1:1);null!=d&&(d=this.trimGUI(d),this.input.setText(JU.PT.escUnicode(d)))},
"~B,~B");f(b,"getCommandString",function(){return this.input.getText()});f(b,"trimGUI",function(a){var c=a.indexOf("\u0001##");0<=c&&(a=a.substring(0,c));c=a.indexOf("; ## GUI ##");0<=c&&(a=a.substring(0,c));return JU.PT.trim(a,"; ")},"~S");f(b,"processKey",function(a,c,d){var b=0;switch(c){case 401:switch(a){case 9:c=this.input.getText();if(c.endsWith("\n")||c.endsWith("\t"))return 0;b=1;if(this.input.getCaretPosition()==c.length)return a=this.completeCommand(c),null!=a&&this.input.setText(JU.PT.escUnicode(a).$replace("\t",
" ")),this.nTab++,b;break;case 27:b=1,this.input.setText("")}this.nTab=0;if(10==a&&!d)return this.execute(null),b;if(38==a||40==a)return this.recallCommand(38==a,d),b;break;case 402:if(10==a&&!d)return b}return b|2},"~N,~N,~B");b.splitCommandLine=f(b,"splitCommandLine",function(a){var c=Array(4),d=!1,b=!1,e=!1;if(0==a.length)return null;for(var h=-1,j=0,g=0,f=0,k,l=0;l<a.length;l++){switch((k=a.charAt(l)).charCodeAt(0)){case 34:!e&&!d&&(b=!b)&&(h=g=l);break;case 39:!e&&!b&&(d=!d)&&(h=g=l);break;case 92:e=
!e;continue;case 32:!e&&(!d&&!b)&&(g=l+1,h=-1);break;case 59:!d&&!b&&(j=g=l+1,h=-1,f=0);break;case 123:case 125:!d&&!b&&(f+="{"==k?1:-1,g=l+1,h=-1);break;default:!d&&!b&&(h=-1)}e=!1}c[0]=a.substring(0,j);c[1]=g==j?a.substring(j):a.substring(j,g>h?g:h);c[2]=g==j?null:a.substring(g);c[3]=0<f?"{":null;return c},"~S");b.labels=null});m("J.consolejs");n(["J.console.GenericConsole"],"J.consolejs.AppletConsole",null,function(){var b=q(function(){this.jsConsole=null;p(this,arguments)},J.consolejs,"AppletConsole",
J.console.GenericConsole);r(b,function(){t(this,J.consolejs.AppletConsole,[])});k(b,"start",function(a){this.setViewer(a);this.setLabels();this.displayConsole()},"JV.Viewer");k(b,"layoutWindow",function(){this.jsConsole=new Jmol.Console.JSConsole(this);this.setTitle()},"~S");k(b,"setTitle",function(){null!=this.jsConsole&&this.jsConsole.setTitle(J.console.GenericConsole.getLabel("title"))});k(b,"setVisible",function(a){this.jsConsole.setVisible(a)},"~B");k(b,"setButton",function(a){return new Jmol.Console.Button(a)},
"~S");k(b,"dispose",function(){this.setVisible(!1)});k(b,"isMenuItem",function(){return!1},"~O");k(b,"getScriptEditor",function(){return null});k(b,"nextFileName",function(){return null},"~S,~N");k(b,"newJMenu",function(){return null},"~S");k(b,"newJMenuItem",function(){return null},"~S");k(b,"regainFocus",function(){});Jmol.Console={buttons:{},buttonWidth:100,click:function(a){Jmol.Console.buttons[a].console.appletConsole.doAction(Jmol.Console.buttons[a])}};Jmol.consoleGetImageDialog=function(a,
c,d){return new Jmol.Console.Image(a,c,d)};Jmol.Console.Image=function(a,c,d){this.vwr=a;this.title=c;this.imageMap=d;this.applet=a.html5Applet;a=this.applet._id+"_Image";this.id=a+"_"+(""==c?"app":c).replace(/\W/g,"_");var b=Jmol._$(this.id+"_holder");if(!b[0]&&(b=Jmol._$(a+"_holder"))[0])this.id=a;b[0]?this.div=b:Jmol.Console.createDOM(this,'<div id="$ID" class="jmolImage" style="display:block;background-color:yellow;position:absolute;z-index:'+ ++Jmol._z.consoleImage+'"><div id="$ID_title"></div><div id="$ID_holder"></div></div>');
System.out.println("image "+this.id+" created");(a=d.get(this.id))&&a.closeMe();d.put(this.id,this);d.put(c,this)};Jmol.Console.Image.setCanvas=function(a,c){Jmol.$append(Jmol._$(a.id+"_holder"),c);Jmol.$html(a.id+"_title","<table style='width:100%'><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:Jmol.Console.buttons['"+a.id+"'].closeMe()\">close</a></td><td align=right>"+a.title+" ["+c.width+" x "+c.height+"]</td></tr></table>")};Jmol.Console.Image.closeImage=function(a){a.imageMap.remove(a.title);
a.imageMap.remove(a.id);a.div?Jmol.$remove(a.cid):(a.dragBind(!1),Jmol.$remove(a.id))};Jmol.Console.Image.prototype.setImage=function(a){this.cid&&Jmol.$remove(this.cid);var c=document.createElement("canvas");c.width=a.width;c.height=a.height;var d=c.getContext("2d");if(a.buf32){var b=d.getImageData(0,0,c.width,c.height),e=b.data;a=a.buf32;for(var h=e.length>>2,j=0,g=0;j<h;j++)e[g++]=a[j]>>16&255,e[g++]=a[j]>>8&255,e[g++]=a[j]&255,e[g++]=255;d.putImageData(b,0,0)}else d.drawImage(a,0,0);this.cid=
c.id=this.id+"_image";Jmol.Console.Image.setCanvas(this,c)};Jmol.Console.Image.prototype.closeMe=function(){Jmol.Console.Image.closeImage(this)};Jmol.Swing.setDraggable(Jmol.Console.Image);Jmol.Console.createDOM=function(a,c,d){var b=a.id;Jmol.Console.buttons[b]=a;c=c.replace(/\$ID/g,b);d&&d[0]?Jmol.$html(d,c):(Jmol.$after("body",c),a.setContainer(Jmol._$(b)),a.setPosition(),a.dragBind(!0))};Jmol.Console.JSConsole=function(a){this.applet=a.vwr.html5Applet;var c=this.id=this.applet._id+"_console",
b=this;b.appletConsole=a;b.input=a.input=new Jmol.Console.Input(b);b.output=a.output=new Jmol.Console.Output(b);var f=Jmol.$("#"+c),e='<div id=$ID_title></div><div id=$ID_label1></div><div id=$ID_outputdiv style="position:relative;left:2px"></div><div id=$ID_inputdiv style="position:relative;left:2px"></div><div id=$ID_buttondiv></div>',h=600,j=362;if(f[0]){var g=Jmol.$getSize(f);0==g[0]&&Jmol.$setSize(f,h,j);h=g[0]||h;j=g[1]||j}else e='<div spellcheck="false" id="$ID" class="jmolConsole" style="display:block;background-color:yellow;width:'+
h+"px;height:"+j+"px;position:absolute;z-index:"+Jmol._z.console+'">'+e+"</div>";Jmol.Console.createDOM(this,e,f);e=function(a,b){b.console=a;b.id=c+"_"+b.label.replace(/\s/g,"_");Jmol.Console.buttons[b.id]=b;return b.html()};e=e(b,a.runButton)+e(b,a.loadButton)+e(b,a.clearInButton)+e(b,a.clearOutButton)+e(b,a.historyButton)+e(b,a.stateButton);Jmol.$html(c+"_buttondiv",e);e="";f[0]||(e+="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:Jmol.Console.buttons['"+c+"'].setVisible(false)\">close</a>");e+=
'&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:Jmol.script('+b.applet._id+",'help')\">help</a>";Jmol.$html(c+"_label1",e);f[0]?(h-=10,j=(j-Jmol.$getSize(c+"_label1")[1]-Jmol.$getSize(c+"_buttondiv")[1]-20)/3):(h-=10,j=(j-62)/3);Jmol.$html(c+"_inputdiv",'<textarea id="'+c+'_input" style="width:'+h+"px;height:"+j+'px"></textarea>');Jmol.$html(c+"_outputdiv",'<textarea id="'+c+'_output" style="width:'+h+"px;height:"+2*j+'px"></textarea>');Jmol.Cache.setDragDrop(this.applet,"console_output");Jmol.Cache.setDragDrop(this.applet,
"console_input");Jmol.$bind("#"+c+"_input","keydown keypress keyup",function(a){b.input.keyEvent(a)});Jmol.$bind("#"+c+"_input","mousedown touchstart",function(){b.ignoreMouse=!0});Jmol.$bind("#"+c+"_output","mousedown touchstart",function(){b.ignoreMouse=!0});b.setButton=function(a){return new Jmol.Console.Button(this,a)};b.setVisible=function(a){a?this.container.show():this.container.hide();this.dragBind(a)};b.setTitle=function(){};b.setVisible(!1)};Jmol.Swing.setDraggable(Jmol.Console.JSConsole);
Jmol.Console.Input=function(a){this.console=a;this.id=a.id+"_input";this.getText=function(){return Jmol.$val(this.id)};this.setText=function(a){null==a&&(a="");Jmol.$val(this.id,a)};this.keyEvent=function(a){var b;b=a.type;var f=a.ctrlKey,e=a.keyCode;13==e&&(e=10);if("keyup"==b)b=38==e||40==e?1:this.console.appletConsole.processKey(e,402,f),1==(b&1)&&a.preventDefault();else{var h="keydown"==b,j=h?a.key||a.originalEvent.keyIdentifier:"";switch(e){case 38:case 40:h||(e=0);break;case 8:case 9:case 10:case 27:break;
default:e=0}b=this.console.appletConsole.processKey(e,401,f);f&&10==e&&this.setText(this.getText()+"\n");if(0==b&&9==a.keyCode){var g=this;setTimeout(function(){g.setText(g.getText()+"\t");Jmol.$focus(g.id)},10)}(1==(b&1)||"Up"==j||"Down"==j||h&&8!=a.keyCode&&32>a.keyCode)&&a.preventDefault()}};this.getCaretPosition=function(){var a=Jmol._$(this.id)[0];if("selectionStart"in a)return a.selectionStart;if(!("selection"in document))return 0;a.focus();var b=document.selection.createRange(),f=document.selection.createRange().text.length;
b.moveStart("character",-a.value.length);return b.text.length-f}};Jmol.Console.Output=function(a){this.id=a.id+"_output";this.getText=function(){return Jmol.$val(this.id)};this.setText=function(a){null==a&&(a="");Jmol.$val(this.id,a)};this.append=function(a){this.setText(this.getText()+a);Jmol.$scrollTo(this.id,-1)}};Jmol.Console.Button=function(a){this.label=a};Jmol.Console.Button.prototype.addConsoleListener=function(a){this.appletConsole=a;Jmol.Console.buttons[this.id]=this};Jmol.Console.Button.prototype.html=
function(){return'<input type="button" id="'+this.id+'" style="width:'+Jmol.Console.buttonWidth+'px" value="'+this.label+'" onClick="Jmol.Console.click(\''+this.id+"')\"/>"}})})(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);
