");r.appendTo("body");re(r[0]);try{document.execCommand("copy")}catch(e){}r.remove()}var ee=function(){var e=document.createElement("textarea");var n="selectionStart"in e;e=null;if(n){return function(e){var n=e.selectionEnd-e.selectionStart;return e.value.substr(e.selectionStart,n)}}else if(document.selection){return function(){var e=document.selection.createRange();return e.text()}}else{return function(){return""}}}();function ne(e){e.selectionStart=e.selectionEnd=0}var te=function(){if(window.getSelection){var n=window.getSelection();if(n.setBaseAndExtent){return function(e,n){var t=window.getSelection();t.setBaseAndExtent(e,0,n,1)}}else{return function(e,n){var t=window.getSelection();var r=document.createRange();r.setStart(e,0);r.setEnd(n,n.childNodes.length);t.removeAllRanges();t.addRange(r)}}}else{return e.noop}}();function re(e){if(window.getSelection){var n=window.getSelection();if(n.setBaseAndExtent){n.setBaseAndExtent(e,0,e,1)}else if(document.createRange){var t=document.createRange();t.selectNodeContents(e);n.removeAllRanges();n.addRange(t)}}}function ie(n,t){var r=n.match(N)||[];if(r.length){var i=r.shift();var o=e.map(r,function(e){if(e.match(/^["']/)){e=e.replace(/\n/g,"\\u0000\\u0000\\u0000\\u0000");e=t(e);return e.replace(/\x00\x00\x00\x00/g,"\n")}return t(e)});var a=e.map(r,function(e){var n=e.match(/^(['"]).*\1$/);return n&&n[1]||""});var s=n.substring(i.length).trim();return{command:n,name:i,args:o,args_quotes:a,rest:s}}else{return{command:n,name:"",args:[],args_quotes:a,rest:""}}}e.terminal={version:"1.10.1",date:"Thu, 09 Nov 2017 16:40:28 +0000",color_names:["transparent","currentcolor","black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],Cycle:x,History:T,Stack:k,valid_color:function n(t){if(t.match(O)){return true}else{return e.inArray(t.toLowerCase(),e.terminal.color_names)!==-1}},unclosed_strings:function e(n){return!!n.match(M)},escape_regex:function e(n){if(typeof n==="string"){var t=/([-\\^$[\]()+{}?*.|])/g;return n.replace(t,"\\$1")}},have_formatting:function e(n){return typeof n==="string"&&!!n.match(L)},is_formatting:function e(n){return typeof n==="string"&&!!n.match(j)},format_split:function e(n){return n.split(A).filter(Boolean)},iterate_formatting:function e(t,r){function i(e){return t.substring(e-6,e)===" "||t.substring(e-1,e).match(/\s/)}function o(e){return t.substring(e).match(/^(&[^;]+;)/)}var a=false;var s=false;var l=0;var f;var c=-1;var u;var p=0;for(var m=0;m
=4){var i=n.split(/;/);var o=i.slice(0,4).join(";");var a=i.slice(4).join(";");return"[["+o+";"+(a||t)+"]"+t+"]"}else if(r===2){r=";;"}else if(r===3){r=";"}else{r=""}var s=t.replace(/\\\]/g,"]").replace(/\n/g,"\\n").replace(/ /g," ");return"[["+n+r+s+"]"+t+"]"})},split_equal:function n(t,r,i){var o="";var a=[];var s=e.terminal.normalize(t).split(/\n/g);for(var l=0,f=s.length;l=r||s||n.length===r-1&&J(c[n.index+1])===2){var l=false;if(i&&n.space!==-1){var f=e.terminal.strip(c.substring(n.space));f=e(""+f+"").text();var d=f.length;var h=n.index+r+1;f=f.substring(0,h);if(f.match(/\s| /)||h>d){l=true}}if(i&&!t&&n.space!==-1&&n.index!==m-1&&l){p=c.substring(u,n.space);var v=n.space-1}else{p=c.substring(u,n.index+1)}if(i){p=p.replace(/^( |\s)+|( |\s)+$/g,"")}u=(v||n.index)+1;if(o){var g=p.match(/^[^\]]*\]/);p=o+p;if(g){o=""}}if(t){p+="]";o=""}var y=p.match(F);if(y){var w=y[y.length-1];if(w[w.length-1]!=="]"){o=w.match($)[1];p+="]"}else if(p.match(D)){p=p.replace(D,"");o=w.match($)[1]}}p=p.replace(/^(\[\[[^\]]+\])?\]/,"");a.push(p);return{index:v,length:0,space:-1}}})}return a},amp:function(e){return e.replace(/&(?!#[0-9]+;|[a-zA-Z]+;)/g,"&")},encode:function n(t){return e.terminal.amp(t).replace(//g,">").replace(/ /g," ").replace(/\t/g," ")},nested_formatting:function n(t){if(!e.terminal.have_formatting(t)){return t}var r=[];var i=/((?:\[\[(?:[^\]]|\\\])+\])?(?:[^\][]|\\\])*\]?)/;var o=/(\[\[(?:[^\]]|\\\])+\])[\s\S]*/;return t.split(i).filter(Boolean).map(function(n){if(n.match(/^\[\[/)){if(!e.terminal.is_formatting(n)){n+="]";r.push(n.replace(o,"$1"))}}else{var t=false;if(n.match(/\]/)){t=true}if(r.length){n=r[r.length-1]+n}if(t){r.pop()}else if(r.length){n+="]"}}return n}).join("")},escape_formatting:function n(t){return e.terminal.escape_brackets(t)},apply_formatters:function(n){var t=e.terminal.defaults.formatters;var r=0;try{return t.reduce(function(n,t){r++;if(typeof t==="function"&&t.__meta__){var i=t(n);if(typeof i==="string"){return i}}else{return e.terminal.format_split(n).map(function(n){if(e.terminal.is_formatting(n)){return n}else{if(t instanceof Array){return n.replace(t[0],t[1])}else if(typeof t==="function"){var r=t(n);if(typeof r==="string"){return r}}return n}}).join("")}return n},n)}catch(e){throw new Error("Error in formatter ["+(r-1)+"]")}},format:function n(t,r){function i(e){return X(e.replace(/(\\+)]/g,function(e,n){if(n.length%2===1){return"]"}else{return n.replace(/../,"\\")}}))}var o=e.extend({},{linksNoReferrer:false},r||{});if(typeof t==="string"){var a=e.terminal.format_split(t);t=e.map(a,function(n){if(n===""){return n}else if(e.terminal.is_formatting(n)){n=n.replace(/\[\[[^\]]+\]/,function(e){return e.replace(/ /g," ")});return n.replace(S,function(n,t,r,a,s,l,f){if(f===""){return""}f=i(f);var c="";if(t.indexOf("b")!==-1){c+="font-weight:bold;"}var u=[];if(t.indexOf("u")!==-1){u.push("underline")}if(t.indexOf("s")!==-1){u.push("line-through")}if(t.indexOf("o")!==-1){u.push("overline")}if(u.length){c+="text-decoration:"+u.join(" ")+";"}if(t.indexOf("i")!==-1){c+="font-style:italic;"}if(typeof wcwidth!=="undefined"){var p=J(G(f));if(p!==1){c+="--length: "+p+";"}}if(e.terminal.valid_color(r)){c+="color:"+r+";";if(t.indexOf("g")!==-1){c+="text-shadow:0 0 5px "+r+";"}}if(e.terminal.valid_color(a)){c+="background-color:"+a}var m;if(l===""){m=f}else{m=l.replace(/]/g,"]").replace(/>/g,">").replace(/"+f+""}else{d+=' data-text="'+m.replace(/"/g,""e;")+'">'+f+""}return d})}else{n=i(n);if(typeof wcwidth!=="undefined"){var t=J(G(n));var r=t!==1?' style="--length: '+t+'"':""}else{r=""}return""+n+""}}).join("");return t.replace(/
<\/span>/gi,"
")}else{return""}},escape_brackets:function e(n){return n.replace(/\[/g,"[").replace(/\]/g,"]")},length:function(e){return Y(e).length},columns:function(e,n,t){var r=e.map(function(e){return e.length});var i=Math.max.apply(null,r)+t;if(typeof t==="undefined"){t=4}var o=Math.floor(n/i);var a=[];var s;function l(n){var t=new Array(i-e[n].length).join(" ");s.push(e[n]+(n%o===0?"":t))}if(o<2){return e.join("\n")}for(var f=0;f").css(n.pre).appendTo("body");a.html(new Array(n.lines).join("\n"));e("body,html").scrollTop(10);var s;if(i.scrollTop()===10){i.scrollTop(o);s=i[0]}else if(r.scrollTop()===10){r.scrollTop(o);s=r[0]}a.remove();return s}else{return this}})};e.fn.scroll_element.defaults={lines:2e3,pre:{"font-size":"100px","white-space":"pre"}};function oe(){if(!("KeyboardEvent"in window&&"key"in window.KeyboardEvent.prototype)){return false}var e=window.KeyboardEvent.prototype;var n=Object.getOwnPropertyDescriptor(e,"key").get;return n.toString().match(/\[native code\]/)}function ae(e){e="[jQuery Terminal] "+e;if(console&&console.warn){console.warn(e)}else{setTimeout(function(){throw new Error("WARN: "+e)},0)}}var se={};e.jrpc=function(n,t,r,i,o){var a;if(e.isPlainObject(n)){a=n}else{a={url:n,method:t,params:r,success:i,error:o}}function s(n){return e.isNumeric(n.id)&&(typeof n.result!=="undefined"||typeof n.error!=="undefined")}se[a.url]=se[a.url]||0;var l={jsonrpc:"2.0",method:a.method,params:a.params,id:++se[a.url]};return e.ajax({url:a.url,beforeSend:function n(t,r){if(e.isFunction(a.request)){a.request(t,l)}r.data=JSON.stringify(l)},success:function n(t,r,i){var o=i.getResponseHeader("Content-Type");if(!o.match(/(application|text)\/json/)){ae("Response Content-Type is neither application/json"+" nor text/json")}var l;try{l=JSON.parse(t)}catch(e){if(a.error){a.error(i,"Invalid JSON",e)}else{throw new Error("Invalid JSON")}return}if(e.isFunction(a.response)){a.response(i,l)}if(s(l)||a.method==="system.describe"){a.success(l,r,i)}else if(a.error){a.error(i,"Invalid JSON-RPC")}else{throw new Error("Invalid JSON-RPC")}},error:a.error,contentType:"application/json",dataType:"text",async:true,cache:false,type:"POST"})};function le(n){var t=e('').appendTo("body");if(n){t.attr("style",n.attr("style"))}var r=t.find("span")[0].getBoundingClientRect();var i={width:r.width,height:r.height};t.remove();return i}function fe(e,n){var t=e.find(".terminal-fill").width();var r=Math.floor(t/n.width);return r||1e3}function ce(e,n){return Math.floor(e.find(".terminal-fill").height()/n.height)}function ue(e,n){var t=e.filter(function(e){return e[n]()===e});return t.length===e.length}function pe(e){var n=e.split("");if(ue(n,"toLowerCase")){return"lower"}else if(ue(n,"toUpperCase")){return"upper"}else{return"mixed"}}function me(e){return pe(e)!=="mixed"}var de=!e.terminal.version.match(/^\{\{/);var he="Copyright (c) 2011-2017 Jakub Jankiewicz ";var ve=de?" v. "+e.terminal.version:" ";var ge=new RegExp(" {"+ve.length+"}$");var ye="jQuery Terminal Emulator"+(de?ve:"");var we=[["jQuery Terminal","(c) 2011-2017 jcubic"],[ye,he.replace(/^Copyright | *<.*>/g,"")],[ye,he.replace(/^Copyright /,"")],[" _______ ________ __"," / / _ /_ ____________ _/__ ___/______________ _____ / /"," __ / / // / // / _ / _/ // / / / _ / _/ / / \\/ / _ \\/ /","/ / / // / // / ___/ // // / / / ___/ // / / / / /\\ / // / /__","\\___/____ \\\\__/____/_/ \\__ / /_/____/_//_/_/_/ /_/ \\/\\__\\_\\___/"," \\/ /____/ ".replace(ge," ")+ve,he],[" __ _____ ________ "+" __"," / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ "+" / /"," __ / // // // // // _ // _// // / / // _ // _// // // \\/ // _ "+"\\/ /","/ / // // // // // ___// / / // / / // ___// / / / / // // /\\ // // "+"/ /__","\\___//____ \\\\___//____//_/ _\\_ / /_//____//_/ /_/ /_//_//_/ /_/ \\"+"__\\_\\___/",(" \\/ /____/ "+" ").replace(ge,"")+ve,he]];e.terminal.nested_formatting.__meta__=true;e.terminal.defaults={prompt:"> ",history:true,exit:true,clear:true,enabled:true,maskChar:"*",wrap:true,checkArity:true,raw:false,exceptionHandler:null,pauseEvents:true,softPause:false,memory:false,cancelableAjax:true,processArguments:true,linksNoReferrer:false,processRPCResponse:null,completionEscape:true,convertLinks:true,extra:{},tabs:4,historySize:60,historyState:false,importHistory:false,historyFilter:null,echoCommand:true,scrollOnEcho:true,login:null,outputLimit:-1,formatters:[e.terminal.nested_formatting],onAjaxError:null,pasteImage:true,scrollBottomOffset:20,wordAutocomplete:true,caseSensitiveAutocomplete:true,clickTimeout:200,request:e.noop,response:e.noop,describe:"procs",onRPCError:null,completion:false,onInit:e.noop,onClear:e.noop,onBlur:e.noop,onFocus:e.noop,onTerminalChange:e.noop,onExit:e.noop,onPush:e.noop,onPop:e.noop,keypress:e.noop,keydown:e.noop,onAfterRedraw:e.noop,onEchoCommand:e.noop,onFlush:e.noop,strings:{comletionParameters:"From version 1.0.0 completion function need to"+" have two arguments",wrongPasswordTryAgain:"Wrong password try again!",wrongPassword:"Wrong password!",ajaxAbortError:"Error while aborting ajax call!",wrongArity:"Wrong number of arguments. Function '%s' expects %s got"+" %s!",commandNotFound:"Command '%s' Not Found!",oneRPCWithIgnore:"You can use only one rpc with describe == false "+"or rpc without system.describe",oneInterpreterFunction:"You can't use more than one function (rpc "+"without system.describe or with option describe == false count"+"s as one)",loginFunctionMissing:"You didn't specify a login function",noTokenError:"Access denied (no token)",serverResponse:"Server responded",wrongGreetings:"Wrong value of greetings parameter",notWhileLogin:"You can't call `%s' function while in login",loginIsNotAFunction:"Authenticate must be a function",canExitError:"You can't exit from main interpreter",invalidCompletion:"Invalid completion",invalidSelector:'Sorry, but terminal said that "%s" is not valid '+"selector!",invalidTerminalId:"Invalid Terminal ID",login:"login",password:"password",recursiveCall:"Recursive call detected, skip",notAString:"%s function: argument is not a string",redrawError:"Internal error, wrong position in cmd redraw",invalidStrings:"Command %s have unclosed strings"}};var be=[];var _e=new x;var xe=[];var ke;var Te=false;var Ee=true;var Ce=true;e.fn.terminal=function(r,o){function a(n){if(n){this.storage={}}this.set=function(t,r){if(n){this.storage[t]=r}else{e.Storage.set(t,r)}};this.get=function(t){if(n){return this.storage[t]}else{return e.Storage.get(t)}};this.remove=function(t){if(n){delete this.storage[t]}else{e.Storage.remove(t)}}}function s(n){if(e.terminal.unclosed_strings(n)){var t=e.terminal.escape_brackets(n);throw new Error(sprintf(ue().invalidStrings,"`"+t+"`"))}else if(e.isFunction(We.processArguments)){return ie(n,We.processArguments)}else if(We.processArguments){return e.terminal.parse_command(n)}else{return e.terminal.split_command(n)}}function l(n){if(typeof n==="string"){de.echo(n)}else if(n instanceof Array){de.echo(e.map(n,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof n==="object"){de.echo(JSON.stringify(n))}else{de.echo(n)}}function f(n){var t=/(.*):([0-9]+):([0-9]+)$/;var r=n.match(t);if(r){de.pause(We.softPause);e.get(r[1],function(n){var t=location.href.replace(/[^/]+$/,"");var i=r[1].replace(t,"");de.echo("[[b;white;]"+i+"]");var o=n.split("\n");var a=+r[2]-1;de.echo(o.slice(a-2,a+3).map(function(n,t){if(t===2){n="[[;#f00;]"+e.terminal.escape_brackets(n)+"]"}return"["+(a+t)+"]: "+n}).join("\n")).resume()},"text")}}function c(n){if(e.isFunction(We.onRPCError)){We.onRPCError.call(de,n)}else{de.error("[RPC] "+n.message);if(n.error&&n.error.message){n=n.error;var t="\t"+n.message;if(n.file){t+=' in file "'+n.file.replace(/.*\//,"")+'"'}if(n.at){t+=" at line "+n.at}de.error(t)}}}function u(n,t){var r=function(t,r){de.pause(We.softPause);e.jrpc({url:n,method:t,params:r,request:function(e,n){try{We.request.call(de,e,n,de)}catch(e){y(e,"USER")}},response:function(e,n){try{We.response.call(de,e,n,de)}catch(e){y(e,"USER")}},success:function n(t){if(t.error){c(t.error)}else if(e.isFunction(We.processRPCResponse)){We.processRPCResponse.call(de,t.result,de)}else{l(t.result)}de.resume()},error:m})};return function(e,n){if(e===""){return}try{e=s(e)}catch(e){y(e,"TERMINAL (get_processed_command)");return}if(!t||e.name==="help"){r(e.name,e.args)}else{var i=n.token();if(i){r(e.name,[i].concat(e.args))}else{n.error("[AUTH] "+ue().noTokenError)}}}}function p(t,r,i,o){return function(a,l){if(a===""){return}var f;try{f=s(a)}catch(n){if(e.isFunction(We.exception)){We.exception(n,de)}else{de.error(n.toString())}return}var c=t[f.name];var u=e.type(c);if(u==="function"){if(r&&c.length!==f.args.length){de.error("[Arity] "+sprintf(ue().wrongArity,f.name,c.length,f.args.length))}else{return c.apply(de,f.args)}}else if(u==="object"||u==="string"){var m=[];if(u==="object"){m=Object.keys(c);c=p(c,r,i)}l.push(c,{prompt:f.name+"> ",name:f.name,completion:u==="object"?m:n})}else if(e.isFunction(o)){o(a,de)}else if(e.isFunction(We.onCommandNotFound)){We.onCommandNotFound.call(de,a,de)}else{l.error(sprintf(ue().commandNotFound,f.name))}}}function m(n,t,r){de.resume();if(e.isFunction(We.onAjaxError)){We.onAjaxError.call(de,n,t,r)}else if(t!=="abort"){de.error("[AJAX] "+t+" - "+ue().serverResponse+":\n"+e.terminal.escape_brackets(n.responseText))}}function d(n,t,r){function i(n){if(n.error){c(n.error)}else if(e.isFunction(We.processRPCResponse)){We.processRPCResponse.call(de,n.result,de)}else{l(n.result)}de.resume()}function o(e,n){try{We.request.call(de,e,n,de)}catch(e){y(e,"USER")}}function a(e,n){try{We.response.call(de,e,n,de)}catch(e){y(e,"USER")}}function s(s){var l=s;if(We.describe!==""){We.describe.split(".").forEach(function(e){l=l[e]})}if(l&&l.length){var f={};e.each(l,function(r,s){f[s.name]=function(){var r=t&&s.name!=="help";var l=Array.prototype.slice.call(arguments);var f=l.length+(r?1:0);if(We.checkArity&&s.params&&s.params.length!==f){de.error("[Arity] "+sprintf(ue().wrongArity,s.name,s.params.length,f))}else{de.pause(We.softPause);if(r){var c=de.token(true);if(c){l=[c].concat(l)}else{de.error("[AUTH] "+ue().noTokenError)}}e.jrpc({url:n,method:s.name,params:l,request:o,response:a,success:i,error:m})}}});f.help=f.help||function(n){if(typeof n==="undefined"){var t=s.procs.map(function(e){return e.name}).join(", ")+", help";de.echo("Available commands: "+t)}else{var r=false;e.each(l,function(e,t){if(t.name===n){r=true;var i="";i+="[[bu;#fff;]"+t.name+"]";if(t.params){i+=" "+t.params.join(" ")}if(t.help){i+="\n"+t.help}de.echo(i);return false}});if(!r){if(n==="help"){de.echo("[[bu;#fff;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var i="Method `"+n+"' not found ";de.error(i)}}}};r(f)}else{r(null)}}return e.jrpc({url:n,method:"system.describe",params:[],success:s,request:o,response:a,error:function e(){r(null)}})}function h(n,t,r){r=r||e.noop;var i=e.type(n);var o;var a={};var s=0;var l;if(i==="array"){o={};(function n(r,i){if(r.length){var a=r[0];var f=r.slice(1);var c=e.type(a);if(c==="string"){de.pause(We.softPause);if(We.describe===false){if(++s===1){l=u(a,t)}else{de.error(ue().oneRPCWithIgnore)}n(f,i)}else{d(a,t,function(r){if(r){e.extend(o,r)}else if(++s===1){l=u(a,t)}else{de.error(ue().oneRPCWithIgnore)}de.resume();n(f,i)})}}else if(c==="function"){if(l){de.error(ue().oneInterpreterFunction)}else{l=a}n(f,i)}else if(c==="object"){e.extend(o,a);n(f,i)}}else{i()}})(n,function(){r({interpreter:p(o,false,t,l.bind(de)),completion:Object.keys(o)})})}else if(i==="string"){if(We.ignoreSystemDescribe){o={interpreter:u(n,t)};if(e.isArray(We.completion)){o.completion=We.completion}r(o)}else{de.pause(We.softPause);d(n,t,function(e){if(e){a.interpreter=p(e,false,t);a.completion=Object.keys(e)}else{a.interpreter=u(n,t)}r(a);de.resume()})}}else if(i==="object"){r({interpreter:p(n,We.checkArity),completion:Object.keys(n)})}else{if(i==="undefined"){n=e.noop}else if(i!=="function"){throw new Error(i+" is invalid interpreter value")}r({interpreter:n,completion:We.completion})}}function v(n,t){var r=e.type(t)==="boolean"?"login":t;return function(t,i,o){de.pause(We.softPause);e.jrpc({url:n,method:r,params:[t,i],request:function(e,n){try{We.request.call(de,e,n,de)}catch(e){y(e,"USER")}},response:function(e,n){try{We.response.call(de,e,n,de)}catch(e){y(e,"USER")}},success:function e(n){if(!n.error&&n.result){o(n.result)}else{o(null)}de.resume()},error:m})}}function y(n,t,r){if(e.isFunction(We.exceptionHandler)){We.exceptionHandler.call(de,n,t)}else{de.exception(n,t);if(!r){setTimeout(function(){throw n},0)}}}function x(){var e;if(he.prop){e=he.prop("scrollHeight")}else{e=he.attr("scrollHeight")}he.scrollTop(e)}function T(n,t){try{if(e.isFunction(t)){t.call(de,e.noop,de)}else if(typeof t!=="string"){var r=n+" must be string or function";throw r}}catch(e){y(e,n.toUpperCase());return false}return true}var E=[];var C=1;function R(t,r){var i,o;E.push(C);if(!r.raw&&(J(t)>Se||t.match(/\n/))&&(We.wrap===true&&r.wrap===n||We.wrap===false&&r.wrap===true)){var a=r.keepWords;var s=e.terminal.split_equal(t,Se,a);for(i=0,o=s.length;i")}else if(r.raw){E.push(s[i])}else{E.push(e.terminal.format(s[i],{linksNoReferrer:We.linksNoReferrer}))}}}else if(!r.raw){t=e.terminal.normalize(t);t=e.terminal.format(t,{linksNoReferrer:We.linksNoReferrer});t.split(/\n/).forEach(function(e){E.push(e)})}else{E.push(t)}E.push(r.finalize)}function A(n,t){try{var r=e.extend({exec:true,raw:false,finalize:e.noop},t||{});var i;var o=e.type(n)==="function"?n():n;if(e.type(o)!=="string"){if(e.isFunction(We.parseObject)){var a=We.parseObject(o);if(e.type(a)==="string"){i=a}}else if(o instanceof Array){i=e.terminal.columns(o,de.cols(),We.tabs)}else{i=String(o)}}else{i=o}if(i!==""){i=e.map(i.split(q),function(n){if(n&&n.match(q)&&!e.terminal.is_formatting(n)){n=n.replace(/^\[\[|\]\]$/g,"");if(r.exec){if(ve&&ve.command===n){de.error(ue().recursiveCall)}else{e.terminal.extended_command(de,n)}}return""}else{return n}}).join("");if(i!==""){if(We.convertLinks&&!t.raw){i=i.replace(P,"[[!;;]$1]").replace(I,"[[!;;]$1]")}if(!t.raw){if(t.formatters){try{i=e.terminal.apply_formatters(i)}catch(e){y(e,"FORMATTING")}}i=e.terminal.encode(i)}R(i,r)}}}catch(n){E=[];if(e.isFunction(We.exceptionHandler)){We.exceptionHandler.call(de,n,"TERMINAL")}else{w("[Internal Exception(process_line)]",n)}}}function S(){Xe.resize(Se);var n=Re.empty().detach();var t=[];if(We.outputLimit>=0){var r;if(We.outputLimit===0){r=de.rows()}else{r=We.outputLimit}ye.forEach(function(n){var r=e.type(n[0])==="function"?n[0]():n[0];r=e.type(r)==="string"?r:String(r);if(J(r)>Se){var i=n[1];var o=e.terminal.split_equal(r,Se,i.keepWords);t=t.concat(o.map(function(e){return[e,i]}))}else{t.push(n)}});t=t.slice(t.length-r-1)}else{t=ye}try{E=[];e.each(t,function(e,n){A.apply(null,n)});Xe.before(n);de.flush();We.onAfterRedraw.call(de)}catch(n){if(e.isFunction(We.exceptionHandler)){We.exceptionHandler.call(de,n,"TERMINAL (redraw)")}else{w("[redraw]",n)}}}function F(){function e(e){de.echo(e,{finalize:g,formatters:false})}if(We.greetings===n){e(de.signature)}else if(We.greetings){var t=typeof We.greetings;if(t==="string"){e(We.greetings)}else if(t==="function"){We.greetings.call(de,e)}else{de.error(ue().wrongGreetings)}}}function L(n){if(typeof n==="undefined"){n=de.get_command()}var t=Xe.prompt();var r=Xe.mask();switch(typeof r){case"string":n=n.replace(/./g,r);break;case"boolean":if(r){n=n.replace(/./g,We.maskChar)}else{n=e.terminal.escape_formatting(n)}break}var i={finalize:function t(r){g(r.addClass("command"));try{We.onEchoCommand.call(de,r,n)}catch(n){We.onEchoCommand=e.noop;de.exception(n)}}};if(e.isFunction(t)){var o=t(function(e){de.echo(e+n,i)});if(o&&o.then){o.then(function(e){if(typeof e==="string"){de.echo(e+n,i)}})}}else{de.echo(t+n,i)}}function j(e){var n=_e.get()[e[0]];if(!n){throw new Error(ue().invalidTerminalId)}var t=e[1];if(xe[t]){n.import_view(xe[t])}else{Te=false;var r=e[2];if(r){n.exec(r).done(function(){Te=true;xe[t]=n.export_view()})}}}function O(){if(Te){Ee=false;location.hash="#"+JSON.stringify(ke);setTimeout(function(){Ee=true},100)}}var N=true;var $=[];function H(t,r,i){if(N){N=false;if(We.historyState||We.execHash&&i){if(!xe.length){de.save_state()}else{de.save_state(null)}}}function o(){if(!i){Te=true;if(We.historyState){de.save_state(t,false)}Te=c}f.resolve();if(e.isFunction(We.onAfterCommand)){We.onAfterCommand.call(de,de,t)}}function a(e){if(typeof e!=="undefined"){l(e)}o();de.resume()}try{if(e.isFunction(We.onBeforeCommand)){if(We.onBeforeCommand.call(de,de,t)===false){return}}if(!i){ve=e.terminal.split_command(t)}if(!Y()){if(i&&(e.isFunction(We.historyFilter)&&We.historyFilter(t)||t.match(We.historyFilter))){Xe.history().append(t)}}var s=Ye.top();if(!r&&We.echoCommand){L(t)}var f=new e.Deferred;var c=Te;if(t.match(/^\s*login\s*$/)&&de.token(true)){if(de.level()>1){de.logout(true)}else{de.logout()}o()}else if(We.exit&&t.match(/^\s*exit\s*$/)&&!$e){var u=de.level();if(u===1&&de.get_token()||u>1){if(de.get_token(true)){de.set_token(n,true)}de.pop()}o()}else if(We.clear&&t.match(/^\s*clear\s*$/)&&!$e){de.clear();o()}else{var p=s.interpreter.call(de,t,de);if(p){de.pause(We.softPause);if(p.then){p.then(a)}else{return e.when(p).done(a)}}else if(Je){$.push(function(){o()})}else{o()}}return f.promise()}catch(e){y(e,"USER");de.resume()}}function D(){if(e.isFunction(We.onBeforeLogout)){try{if(We.onBeforeLogout.call(de,de)===false){return}}catch(e){y(e,"onBeforeLogout")}}B();if(e.isFunction(We.onAfterLogout)){try{We.onAfterLogout.call(de,de)}catch(e){y(e,"onAfterlogout")}}de.login(We.login,true,G)}function B(){var e=de.prefix_name(true)+"_";Me.remove(e+"token");Me.remove(e+"login")}function W(n){var t=de.prefix_name()+"_interpreters";var r=Me.get(t);if(r){r=JSON.parse(r)}else{r=[]}if(e.inArray(n,r)===-1){r.push(n);Me.set(t,JSON.stringify(r))}}function M(n){var t=Ye.top();var r=de.prefix_name(true);if(!Y()){W(r)}Xe.name(r);if(e.isFunction(t.prompt)){Xe.prompt(function(e){var n=t.prompt.call(de,e,de);if(n&&n.then){n.then(function(n){if(typeof n==="string"){e(n)}})}})}else{Xe.prompt(t.prompt)}if(e.isPlainObject(t.keymap)){Xe.keymap(e.omap(t.keymap,function(e,n){return function(){var e=[].slice.call(arguments);try{return n.apply(de,e)}catch(e){y(e,"USER KEYMAP")}}}))}Xe.set("");ze.resolve();if(!n&&e.isFunction(t.onStart)){t.onStart.call(de,de)}}function U(){if(Ee&&We.execHash){try{if(location.hash){var e=location.hash.replace(/^#/,"");ke=JSON.parse(decodeURIComponent(e))}else{ke=[]}if(ke.length){j(ke[ke.length-1])}else if(xe[0]){de.import_view(xe[0])}}catch(e){y(e,"TERMINAL")}}}function G(){M();F();if(ye.length){S()}var n=false;if(e.isFunction(We.onInit)){He=function(){n=true};try{We.onInit.call(de,de)}catch(e){y(e,"OnInit")}finally{He=e.noop;if(!n&&de.enabled()){de.resume()}}}if(Ce){Ce=false;e(window).on("hashchange",U)}}function Y(){return $e||Xe.mask()!==false}function X(e,n,t){if(!n.length){return""}var r=pe(e);var i=[];for(var o=e.length;o1||We.login!==n){de.pop("")}else{de.resume();de.echo("")}}else{t()}}return false},"CTRL+C":function(){if(Q()===""){L(de.get_command()+"^C");de.set_command("")}},"CTRL+L":function(){de.clear()},TAB:function(t,r){var i=Ye.top(),o,a;if(typeof i.caseSensitiveAutocomplete!=="undefined"){a=i.caseSensitiveAutocomplete}else{a=We.caseSensitiveAutocomplete}if(We.completion&&e.type(We.completion)!=="boolean"&&i.completion===n){o=We.completion}else{o=i.completion}if(o==="settings"){o=We.completion}if(o){switch(e.type(o)){case"function":var s=de.before_cursor(We.wordAutocomplete);if(o.length===3){var l=new Error(ue().comletionParameters);y(l,"USER");return false}o.call(de,s,function(e){de.complete(e,{echo:true,word:We.wordAutocomplete,escape:We.completionEscape,caseSensitive:a})});break;case"array":de.complete(o,{echo:true,word:We.wordAutocomplete,escape:We.completionEscape,caseSensitive:a});break;default:throw new Error(ue().invalidCompletion)}}else{r()}return false},"CTRL+V":function(e,n){n(e);de.oneTime(200,function(){x()});return true},"CTRL+TAB":function(){if(_e.length()>1){de.focus(false);return false}},PAGEDOWN:function(){de.scroll(de.height())},PAGEUP:function(){de.scroll(-de.height())}};function ae(t){var r,i;if(de.enabled()){if(!de.paused()){r=re(t);if(r!==n){return r}if(t.which!==9){ge=0}de.attr({scrollTop:de.attr("scrollHeight")})}else{if(!We.pauseEvents){r=re(t);if(r!==n){return r}}if(t.which===68&&t.ctrlKey){if(We.pauseEvents){r=re(t);if(r!==n){return r}}if(be.length){for(i=be.length;i--;){var o=be[i];if(o.readyState!==4){try{o.abort()}catch(n){if(e.isFunction(We.exceptionHandler)){We.exceptionHandler.call(de,t,"AJAX ABORT")}else{de.error(ue().ajaxAbortError)}}}}be=[]}de.resume()}return false}}}function se(e){return function(n){e.add(n)}}function ue(){return e.extend({},e.terminal.defaults.strings,We&&We.strings||{})}var de=this;if(this.length>1){return this.each(function(){e.fn.terminal.call(e(this),r,e.extend({name:de.selector},o))})}if(de.data("terminal")){return de.data("terminal")}if(de.length===0){throw new Error(sprintf(ue().invalidSelector,de.selector))}var he;var ve;var ge=0;var ye=[];var Re;var Ae=_e.length();var Se;var Fe;var Le;var je=new k;var Oe=new t;var ze=new t;var Ie=se(ze);var Pe=le(de);var Ne=se(Oe);var $e=false;var He=e.noop;var De,qe;var Be=[];var We=e.extend({},e.terminal.defaults,{name:de.selector},o||{});var Me=new a(We.memory);var Ue=We.enabled,Ke=false;var Je=false;var Ge=true;var Ye;var Xe;var Ve;var Qe;var Ze;e.extend(de,e.omap({id:function(){return Ae},clear:function(){Re.html("");ye=[];try{We.onClear.call(de,de)}catch(e){y(e,"onClear")}de.attr({scrollTop:0});return de},export_view:function(){var n={};if(e.isFunction(We.onExport)){try{n=We.onExport.call(de)}catch(e){y(e,"onExport")}}return e.extend({},{focus:Ue,mask:Xe.mask(),prompt:de.get_prompt(),command:de.get_command(),position:Xe.position(),lines:i(ye),interpreters:Ye.clone(),history:Xe.history().data},n)},import_view:function(n){if($e){throw new Error(sprintf(ue().notWhileLogin,"import_view"))}if(e.isFunction(We.onImport)){try{We.onImport.call(de,n)}catch(n){We.onImport=e.noop;y(n,"onImport")}}Ie(function e(){de.set_prompt(n.prompt);de.set_command(n.command);Xe.position(n.position);Xe.mask(n.mask);if(n.focus){de.focus()}ye=i(n.lines);Ye=n.interpreters;if(We.importHistory){Xe.history().set(n.history)}S()});return de},save_state:function(t,r,i){if(typeof i!=="undefined"){xe[i]=de.export_view()}else{xe.push(de.export_view())}if(!e.isArray(ke)){ke=[]}if(t!==n&&!r){var o=[Ae,xe.length-1,t];ke.push(o);O()}},exec:function(n,t,r){var i=r||new e.Deferred;Ne(function r(){if(e.isArray(n)){(function e(){var r=n.shift();if(r){de.exec(r,t).done(e)}else{i.resolve()}})()}else if(Je){Be.push([n,t,i])}else{H(n,t,true).done(function(){i.resolve(de)})}});return i.promise()},autologin:function(e,n,t){de.trigger("terminal.autologin",[e,n,t]);return de},login:function(t,r,i,o){je.push([].slice.call(arguments));if($e){throw new Error(sprintf(ue().notWhileLogin,"login"))}if(!e.isFunction(t)){throw new Error(ue().loginIsNotAFunction)}$e=true;if(de.token()&&de.level()===1&&!Ge){$e=false;de.logout(true)}else if(de.token(true)&&de.login_name(true)){$e=false;if(e.isFunction(i)){i()}return de}if(We.history){Xe.history().disable()}var a=de.level();function s(t,s,l){if(s){while(de.level()>a){de.pop(n,true)}if(We.history){Xe.history().enable()}var f=de.prefix_name(true)+"_";Me.set(f+"token",s);Me.set(f+"login",t);$e=false;if(e.isFunction(i)){i()}}else{if(r){if(!l){de.error(ue().wrongPasswordTryAgain)}de.pop(n,true).set_mask(false)}else{$e=false;if(!l){de.error(ue().wrongPassword)}de.pop(n,true).pop(n,true)}if(e.isFunction(o)){o()}}de.off("terminal.autologin")}de.on("terminal.autologin",function(e,n,t,r){s(n,t,r)});de.push(function(e){de.set_mask(We.maskChar).push(function(n){try{t.call(de,e,n,function(n,t){s(e,n,t)})}catch(e){y(e,"AUTH")}},{prompt:ue().password+": ",name:"password"})},{prompt:ue().login+": ",name:"login"});return de},settings:function(){return We},before_cursor:function(e){var n=Xe.position();var t=Xe.get().substring(0,n);var r=t.split(" ");var i;if(e){if(r.length===1){i=r[0]}else{var o=t.match(/(\\?")/g);var a=o?o.filter(function(e){return!e.match(/^\\/)}).length:0;o=t.match(/'/g);var s=o?o.length:0;if(s%2===1){i=t.match(/('[^']*)$/)[0]}else if(a%2===1){i=t.match(/("(?:[^"]|\\")*)$/)[0]}else{i=r[r.length-1];for(rn=r.length-1;rn>0;rn--){var l=r[rn-1];if(l[l.length-1]==="\\"){i=r[rn-1]+" "+i}else{break}}}}}else{i=t}return i},complete:function(n,t){t=e.extend({word:true,echo:false,escape:true,caseSensitive:true},t||{});var r=t.caseSensitive;var i=de.before_cursor(t.word).replace(/\\"/g,'"');var o=false;if(t.word){if(i.match(/^"/)){o='"'}else if(i.match(/^'/)){o="'"}if(o){i=i.replace(/^["']/,"")}}n=n.slice();if(We.clear&&e.inArray("clear",n)===-1){n.push("clear")}if(We.exit&&e.inArray("exit",n)===-1){n.push("exit")}if(ge%2===0){Le=de.before_cursor(t.word)}else{var a=de.before_cursor(t.word);if(a!==Le){return}}var s=e.terminal.escape_regex(i);if(t.escape){s=s.replace(/(\\+)(["'() ])/g,function(e,n,t){if(t.match(/[()]/)){return n+"\\?\\"+t}else{return n+"?"+t}})}function l(){var e=[];for(var a=n.length;a--;){if(c.test(n[a])){var s=n[a];if(o==='"'){s=s.replace(/"/g,'\\"')}if(!o&&t.escape){s=s.replace(/(["'() ])/g,"\\$1")}if(!r&&me(s)){if(i.toLowerCase()===i){s=s.toLowerCase()}else if(i.toUpperCase()===i){s=s.toUpperCase()}}e.push(s)}}return e}var f=r?"":"i";var c=new RegExp("^"+s,f);var u=l();function p(e,n){var t=de.get_command();var r=de.get_position();var i=new RegExp("^"+e,"i");var a=t.substring(0,r);var s=t.substring(r);var l=n.replace(i,"")+(o||"");de.set_command(a+l+s);de.set_position((a+l).length)}if(u.length===1){if(t.escape){p(s,u[0])}else{de.insert(u[0].replace(c,"")+(o||""))}Le=de.before_cursor(t.word);return true}else if(u.length>1){if(++ge>=2){ge=0;if(t.echo){L();var m=u.reverse().join("\t");de.echo(e.terminal.escape_brackets(m),{keepWords:true,formatters:false});return true}}else{var d=X(i,u,r);if(d){p(i,d);Le=de.before_cursor(t.word);return true}}}},commands:function(){return Ye.top().interpreter},set_interpreter:function(n,t){function r(){de.pause(We.softPause);h(n,!!t,function(n){de.resume();var t=Ye.top();e.extend(t,n);M(true)})}if(e.type(n)==="string"&&t){de.login(v(n,t),true,r)}else{r()}return de},greetings:function(){F();return de},paused:function(){return Je},pause:function(n){Ne(function t(){He();Je=true;Xe.disable(n||K);if(!n){Xe.find(".prompt").hidden()}if(e.isFunction(We.onPause)){We.onPause.call(de)}});return de},resume:function(){Ne(function n(){Je=false;if(Ue&&_e.front()===de){Xe.enable()}Xe.find(".prompt").visible();var t=Be;Be=[];for(var r=0;r1){de.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(n,0)}else{setImmediate(n)}}else{We.historyState=false}return de},clear_history_state:function(){ke=[];xe=[];return de},next:function(){if(_e.length()===1){return de}else{_e.front().disable();var n=_e.rotate().enable();var t=n.offset().top-50;e("html,body").animate({scrollTop:t},500);try{Z(n)}catch(e){y(e,"onTerminalChange")}return n}},focus:function(e,n){Ne(function t(){if(_e.length()===1){if(e===false){de.disable(n)}else{de.enable(n)}}else if(e===false){de.next()}else{var r=_e.front();if(r!==de){_e.forEach(function(e){if(e!==de&&e.enabled()){e.disable(n)}});if(!n){try{Z(de)}catch(e){y(e,"onTerminalChange")}}}_e.set(de)}de.enable(n)});return de},freeze:function(e){Ie(function n(){if(e){de.disable();Ke=true}else{Ke=false;de.enable()}})},frozen:function(){return Ke},enable:function(t){if(!Ue&&!Ke){if(Se===n){de.resize()}Ne(function r(){var i;if(!t&&!Ue){try{i=We.onFocus.call(de,de)}catch(n){We.onFocus=e.noop;y(n,"onFocus")}}if(!t&&i===n||t){Ue=true;if(!de.paused()){Xe.enable()}}})}return de},disable:function(t){Ne(function r(){var i;if(!t&&Ue){try{i=We.onBlur.call(de,de)}catch(n){We.onBlur=e.noop;y(n,"onBlur")}}if(!t&&i===n||t){Ue=false;Xe.disable()}});return de},enabled:function(){return Ue},signature:function(){var e=de.cols();for(var n=we.length;n--;){var t=we[n].map(function(e){return e.length});if(Math.max.apply(null,t)<=e){return we[n].join("\n")+"\n"}}return""},version:function(){return e.terminal.version},cmd:function(){return Xe},get_command:function(){return Xe.get()},set_command:function(e){Ie(function n(){Xe.set(e)});return de},set_position:function(e,n){Ie(function t(){Xe.position(e,n)});return de},get_position:function(){return Xe.position()},insert:function(e,n){if(typeof e==="string"){Ie(function t(){var r=de.is_bottom();Xe.insert(e,n);if(We.scrollOnEcho||r){x()}});return de}else{throw new Error(sprintf(ue().notAString,"insert"))}},set_prompt:function(n){Ie(function t(){if(T("prompt",n)){if(e.isFunction(n)){Xe.prompt(function(e){n(e,de)})}else{Xe.prompt(n)}Ye.top().prompt=n}});return de},get_prompt:function(){return Ye.top().prompt},set_mask:function(e){Ie(function n(){Xe.mask(e===true?We.maskChar:e)});return de},get_output:function(n){if(n){return ye}else{return e.map(ye,function(n){return e.isFunction(n[0])?n[0]():n[0]}).join("\n")}},resize:function(n,t){if(!de.is(":visible")){de.stopTime("resize");de.oneTime(500,"resize",function(){de.resize(n,t)})}else{if(n&&t){de.width(n);de.height(t)}n=de.width();t=de.height();if(typeof We.numChars!=="undefined"||typeof We.numRows!=="undefined"){S();x();return}Pe=le(de);var r=fe(de,Pe);var i=ce(de,Pe);if(r!==Se||i!==Fe){Se=r;Fe=i;Xe.resize(Se);de.refresh();var o=Ye.top();if(e.isFunction(o.resize)){o.resize.call(de,de)}else if(e.isFunction(We.onResize)){We.onResize.call(de,de)}x()}}return de},refresh:function(){de[0].style.setProperty("--char-width",Pe.width);S();return de},flush:function(){try{var n=de.is_bottom();var t;e.each(E,function(n,r){if(r===C){t=e("")}else if(e.isFunction(r)){t.appendTo(Re);r(t)}else{e("").html(r).appendTo(t).width("100%")}});if(We.outputLimit>=0){var r;if(We.outputLimit===0){r=de.rows()}else{r=We.outputLimit}var i=Re.find("div div");if(i.length+1>r){var o=i.length-r+1;var a=i.slice(0,o);var s=a.parent();a.remove();s.each(function(){var n=e(this);if(n.is(":empty")){n.remove()}})}}try{We.onFlush.call(de,de)}catch(n){We.onFlush=e.noop;y(n,"onFlush")}if(We.scrollOnEcho||n){x()}E=[]}catch(n){if(e.isFunction(We.exceptionHandler)){We.exceptionHandler.call(de,n,"TERMINAL (Flush)")}else{w("[Flush]",n)}}return de},update:function(e,n){Ie(function t(){if(e<0){e=ye.length+e}if(!ye[e]){de.error("Invalid line number "+e)}else{if(n===null){ye.splice(e,1)}else{ye[e][0]=n}S()}});return de},last_index:function(){return ye.length-1},echo:function(n,t){function r(n){try{var r=e.extend({flush:true,raw:We.raw,finalize:e.noop,keepWords:false,formatters:true},t||{});if(r.raw){(function(e){r.finalize=function(n){n.addClass("raw");e(n)}})(r.finalize)}if(r.flush){if(E.length){de.flush()}E=[]}if(typeof n==="function"){n=n.bind(de)}A(n,r);ye.push([n,e.extend(r,{exec:false})]);if(r.flush){de.flush()}}catch(n){if(e.isFunction(We.exceptionHandler)){We.exceptionHandler.call(de,n,"TERMINAL (echo)")}else{w("[Terminal.echo]",n)}}}try{if(t&&e.isFunction(t.finalize)){t.finalize(e(""))}if(e.isFunction(n.then)){e.when(n).done(r)}else{r(n)}}catch(e){y(e,"USER:echo(finalize)")}return de},error:function(n,t){t=e.extend({},t,{raw:false,formatters:false});var r=e.terminal.escape_brackets(n).replace(/\\$/,"\").replace(z,"]$1[[;;;error]");return de.echo("[[;;;error]"+r+"]",t)},exception:function(n,t){var r=_(n);if(t){r="["+t+"]: "+r}if(r){de.error(r,{finalize:function(e){e.addClass("exception message")},keepWords:true})}if(typeof n.fileName==="string"){de.pause(We.softPause);e.get(n.fileName,function(e){var t=n.lineNumber-1;var r=e.split("\n")[t];if(r){de.error("["+n.lineNumber+"]: "+r)}de.resume()},"text")}if(n.stack){var i=e.terminal.escape_brackets(n.stack);de.echo(i.split(/\n/g).map(function(e){return"[[;;;error]"+e.replace(z,function(e){return"]"+e+"[[;;;error]"})+"]"}).join("\n"),{finalize:function(e){e.addClass("exception stack-trace")},formatters:false})}},scroll:function(e){var n;e=Math.round(e);if(he.prop){if(e>he.prop("scrollTop")&&e>0){he.prop("scrollTop",0)}n=he.prop("scrollTop");he.scrollTop(n+e)}else{if(e>he.attr("scrollTop")&&e>0){he.attr("scrollTop",0)}n=he.attr("scrollTop");he.scrollTop(n+e)}return de},logout:function(e){if($e){throw new Error(sprintf(ue().notWhileLogin,"logout"))}Ie(function t(){if(e){var r=je.pop();de.set_token(n,true);de.login.apply(de,r)}else if(Ye.size()===1&&de.token()){de.logout(true)}else{while(Ye.size()>1){if(de.token()){de.logout(true).pop().pop()}else{de.pop()}}}});return de},token:function(e){return Me.get(de.prefix_name(e)+"_token")},set_token:function(e,n){var t=de.prefix_name(n)+"_token";if(typeof e==="undefined"){Me.remove(t,e)}else{Me.set(t,e)}return de},get_token:function(e){return de.token(e)},login_name:function(e){return Me.get(de.prefix_name(e)+"_login")},name:function(){return Ye.top().name},prefix_name:function(e){var n=(We.name?We.name+"_":"")+Ae;if(e&&Ye.size()>1){var t=Ye.map(function(e){return e.name||""}).slice(1).join("_");if(t){n+="_"+t}}return n},read:function(n,t){var r=new e.Deferred;de.push(function(n){de.pop();if(e.isFunction(t)){t(n)}r.resolve(n)},{prompt:n});return r.promise()},push:function(t,r){Ne(function i(){r=r||{};var o={infiniteLogin:false};var a=e.extend({},o,r);if(!a.name&&ve){a.name=ve.name}if(a.prompt===n){a.prompt=(a.name||">")+" "}var s=Ye.top();if(s){s.mask=Xe.mask()}var l=Je;function f(){We.onPush.call(de,s,Ye.top(),de);M()}h(t,!!r.login,function(n){Ye.push(e.extend({},n,a));if(a.completion===true){if(e.isArray(n.completion)){Ye.top().completion=n.completion}else if(!n.completion){Ye.top().completion=false}}if(a.login){var r;var i=e.type(a.login);if(i==="function"){r=a.infiniteLogin?e.noop:de.pop;de.login(a.login,a.infiniteLogin,f,r)}else if(e.type(t)==="string"&&i==="string"||i==="boolean"){r=a.infiniteLogin?e.noop:de.pop;de.login(v(t,a.login),a.infiniteLogin,f,r)}}else{f()}if(!l&&de.enabled()){de.resume()}})});return de},pop:function(t,r){if(t!==n){L(t)}var i=de.token(true);var o;if(Ye.size()===1){o=Ye.top();if(We.login){if(!r){We.onPop.call(de,o,null,de)}D();if(e.isFunction(We.onExit)){try{We.onExit.call(de,de)}catch(n){We.onExit=e.noop;y(n,"onExit")}}}else{de.error(ue().canExitError)}}else{if(i){B()}var a=Ye.pop();o=Ye.top();M();if(!r){We.onPop.call(de,a,o)}if($e&&de.get_prompt()!==ue().login+": "){$e=false}if(e.isFunction(a.onExit)){try{a.onExit.call(de,de)}catch(n){a.onExit=e.noop;y(n,"onExit")}}de.set_mask(o.mask)}return de},option:function(n,t){if(typeof t==="undefined"){if(typeof n==="string"){return We[n]}else if(typeof n==="object"){e.each(n,function(e,n){We[e]=n})}}else{We[n]=t;if(n.match(/^num(Chars|Rows)$/)){S()}}return de},level:function(){return Ye.size()},reset:function(){Ie(function e(){de.clear();while(Ye.size()>1){Ye.pop()}G()});return de},purge:function(){Ie(function n(){var t=de.prefix_name()+"_";var r=Me.get(t+"interpreters");if(r){e.each(JSON.parse(r),function(e,n){Me.remove(n+"_commands");Me.remove(n+"_token");Me.remove(n+"_login")})}Xe.purge();Me.remove(t+"interpreters")});return de},destroy:function(){Ie(function n(){Xe.destroy().remove();Re.remove();en.remove();e(document).unbind(".terminal_"+de.id());e(window).unbind(".terminal_"+de.id());de.unbind("click wheel mousewheel mousedown mouseup");de.removeData("terminal").removeClass("terminal").unbind(".terminal");if(We.width){de.css("width","")}if(We.height){de.css("height","")}e(window).off("blur",sn).off("focus",an);de.find(".terminal-fill").remove();de.stopTime();_e.remove(Ae);if(Qe){Qe.unobserve(de[0])}if(Ze){Ze.disconnect()}de.resizer("unbind");nn.resizer("unbind").remove();if(!_e.length()){e(window).off("hashchange")}});return de},scroll_to_bottom:function(){x();return de},is_bottom:function(){if(We.scrollBottomOffset===-1){return false}else{var n,t,r;if(de.is("body")){n=e(document).height();t=e(window).scrollTop();r=window.innerHeight}else{n=he[0].scrollHeight;t=he.scrollTop();r=he.outerHeight()}var i=n-We.scrollBottomOffset;return t+r>i}}},function(e,n){return function(){try{return n.apply(de,[].slice.apply(arguments))}catch(n){if(e!=="exec"&&e!=="resume"){y(n,"TERMINAL",true)}if(!We.exceptionHandler){throw n}}}}));if(We.ignoreSystemDescribe===true){We.describe=false}if(We.width){de.width(We.width)}if(We.height){de.height(We.height)}he=de.scroll_element();e(document).bind("ajaxSend.terminal_"+de.id(),function(e,n){be.push(n)});var en=e('').appendTo(de);var nn=e('').appendTo(de);e('').appendTo(de);Re=e("").addClass("terminal-output").attr("role","log").appendTo(en);de.addClass("terminal");if(We.login&&e.isFunction(We.onBeforeLogin)){try{if(We.onBeforeLogin.call(de,de)===false){Ge=false}}catch(n){We.onBeforeLogin=e.noop;y(n,"onBeforeLogin")}}var tn;if(typeof r==="string"){tn=r}else if(r instanceof Array){for(var rn=0,on=r.length;rn
',{raw:true})}else if(n(t[r],"text/plain")){t[r].getAsString(de.insert)}}}else if(e.clipboardData.getData){var s=e.clipboardData.getData("text/plain");de.insert(s)}return false}}}e(document).on("paste.terminal_"+de.id(),ln);h(r,!!We.login,function(t){if(We.completion&&typeof We.completion!=="boolean"||!We.completion){t.completion="settings"}var r=e.extend({},oe,e.omap(We.keymap||{},function(e,n){if(!oe[e]){return n.bind(de)}return function(t,r){return n.call(de,t,function(){return oe[e](t,r)})}}));Ye=new k(e.extend({},We.extra,{name:We.name,prompt:We.prompt,keypress:We.keypress,keydown:We.keydown,resize:We.onResize,greetings:We.greetings,mousewheel:We.mousewheel,keymap:r},t));Xe=e("
").appendTo(en).cmd({prompt:We.prompt,history:We.memory?"memory":We.history,historyFilter:We.historyFilter,historySize:We.historySize,width:"100%",enabled:false,keydown:ae,keymap:r,clickTimeout:We.clickTimeout,keypress:function(n){var t=Ye.top();if(Ue&&(!Je||!We.pauseEvents)){if(e.isFunction(t.keypress)){return t.keypress.call(de,n,de)}else if(e.isFunction(We.keypress)){return We.keypress.call(de,n,de)}}},onCommandChange:function(n){if(e.isFunction(We.onCommandChange)){try{We.onCommandChange.call(de,n,de)}catch(n){We.onCommandChange=e.noop;y(n,"onCommandChange")}}x()},commands:H});if(Ue&&de.is(":visible")&&!V){de.focus(n,true)}else{de.disable()}function i(n){n=n.originalEvent;if(n){var t=document.elementFromPoint(n.clientX,n.clientY);if(!e(t).closest(".terminal").length&&de.enabled()){de.disable()}}}de.oneTime(100,function(){e(document).bind("click.terminal_"+de.id(),i).bind("contextmenu.terminal_"+de.id(),i)});var o=e(window);document.addEventListener("resume",function(){de.disable()});if(V){de.click(function(){if(!Ke){if(!de.enabled()){de.focus();Xe.enable()}else{de.disable()}}})}else{o.on("focus.terminal_"+de.id(),an).on("blur.terminal_"+de.id(),sn);(function(){var n=0;var t;var r="click_"+de.id();function i(){if(t.is(".terminal")||t.is(".terminal-wrapper")){var e=de.get_command().length;de.set_position(e)}else if(t.closest(".prompt").length){de.set_position(0)}o()}function o(){n=0;t=null}var a=de.find(".terminal-fill");de.mousedown(function(n){if(!b(n,a)){t=e(n.target)}}).mouseup(function(){if(Q()===""&&t){if(++n===1){if(!Ke){if(!Ue){de.focus()}else{var e=We.clickTimeout;de.oneTime(e,r,i);return}}}else{de.stopTime(r)}}o()}).dblclick(function(){o();de.stopTime(r)})})();(function(){var n=de.find("textarea");de.on("contextmenu.terminal",function(t){if(Q()===""){if(!e(t.target).is("img,value,audio,object,canvas,a")){if(!de.enabled()){de.enable()}var r=Xe.offset();n.css({left:t.pageX-r.left-20,top:t.pageY-r.top-20,width:"5em",height:"4em"});if(!n.is(":focus")){n.focus()}de.stopTime("textarea");de.oneTime(100,"textarea",function(){n.css({left:"",top:"",width:"",height:""})});de.stopTime("selection");de.everyTime(20,"selection",function(){if(n[0].selection!==n[0].value){if(ee(n[0])){ne(n[0]);te(de.find(".terminal-output")[0],de.find(".cmd div:last-of-type")[0]);de.stopTime("selection")}}})}}})})()}de.delegate(".exception a","click",function(n){var t=e(this).attr("href");if(t.match(/:[0-9]+$/)){n.preventDefault();f(t)}});if(de.is(":visible")){Se=de.cols();Xe.resize(Se);if(!Pe){Pe=le(de)}Fe=ce(de,Pe)}Oe.resolve();if(We.login){de.login(We.login,true,G)}else{G()}function a(){if(de.is(":visible")){var e=de.width();var n=de.height();if(qe!==n||De!==e){de.resize()}qe=n;De=e}}function s(){de.resizer("unbind").resizer(a);nn.resizer("unbind").resizer(de.resize)}if(de.is(":visible")){s()}function l(){if(Qe){Qe.unobserve(de[0])}var n;Qe=new IntersectionObserver(function(){if(de.is(":visible")){s();a();if(n){de.enabled()}}else{n=e.terminal.active()===de&&de.enabled();de.disable()}},{root:document.body});Qe.observe(de[0])}var c=!!de.closest("body").length;var u=window.MutationObserver||window.WebKitMutationObserver;if(window.IntersectionObserver){if(u){Ze=new u(function(){if(de.closest("body").length){if(!c){de.scroll_to_bottom();l()}c=true}else if(c){c=false}});Ze.observe(document.body,{childList:true})}if(c){l()}}function p(n){var t=_e.get()[n[0]];if(t&&Ae===t.id()){if(n[2]){try{if(Je){var r=e.Deferred();$.push(function(){return t.exec(n[2]).done(function(){t.save_state(n[2],true,n[1]);r.resolve()})});return r.promise()}else{return t.exec(n[2]).done(function(){t.save_state(n[2],true,n[1])})}}catch(n){var i=t.settings();if(e.isFunction(i.exceptionHandler)){i.exceptionHandler.call(de,n,"EXEC HASH")}else{var o=e.terminal.escape_brackets(Le);var a="Error while exec with command "+o;t.error(a).exception(n)}}}}}if(We.execHash){if(location.hash){setTimeout(function(){try{var e=location.hash.replace(/^#/,"");ke=JSON.parse(decodeURIComponent(e));var n=0;(function e(){var t=ke[n++];if(t){p(t).done(e)}else{Te=true}})()}catch(e){}})}else{Te=true}}else{Te=true}var m=false;e(document).bind("keydown.terminal_"+de.id(),function(e){if(e.shiftKey){m=true}}).bind("keyup.terminal_"+de.id(),function(e){if(e.shiftKey||e.which===16){m=false}});function d(n,t){if(!m){var r=Ye.top();var i;if(e.isFunction(r.mousewheel)){i=r.mousewheel(n,t,de);if(i===false){return}}else if(e.isFunction(We.mousewheel)){i=We.mousewheel(n,t,de);if(i===false){return}}if(t>0){de.scroll(-40)}else{de.scroll(40)}}}if(e.event.special.mousewheel){de.on("mousewheel",function(e,n){d(e,n);e.preventDefault()})}else{var h;var v=document.createElement("div");if("onwheel"in v){h="wheel"}else if(document.onmousewheel!==n){h="mousewheel"}else{h="DOMMouseScroll"}v=null;de.on(h,function(e){var n;if(h==="mousewheel"){n=-1/40*e.originalEvent.wheelDelta}else{n=e.originalEvent.deltaY||e.originalEvent.detail}d(e,-n);e.preventDefault()})}});de.data("terminal",de);return de}});
\ No newline at end of file
diff --git a/package.json b/package.json
index df3e66953..be0e64bfe 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery.terminal",
- "version": "1.10.0",
+ "version": "1.10.1",
"description": "jQuery Terminal Emulator is a plugin for creating command line interpreters in your applications.",
"main": "js/jquery.terminal.js",
"keywords": [
diff --git a/terminal.jquery.json b/terminal.jquery.json
index 93ebc8e09..d88e85dac 100644
--- a/terminal.jquery.json
+++ b/terminal.jquery.json
@@ -2,7 +2,7 @@
"name": "terminal",
"title": "jQuery Terminal Emulator",
"description": "jQuery Terminal Emulator is a plugin for creating command line interpreters in your applications.",
- "version": "1.10.0",
+ "version": "1.10.1",
"keywords": [
"terminal", "emulator", "prompt", "console", "keyboard", "type", "rpc", "input", "ui"
],