");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:"DEV",date:"Sun, 07 Jan 2018 08:28:38 +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(U)},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 b=y[y.length-1];if(b[b.length-1]!=="]"){o=b.match($)[1];p+="]"}else if(p.match(H)){p=p.replace(H,"");o=b.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){if(e.match(/\\]/)){e=e.replace(/(\\+)]/g,function(e,n){if(n.length%2===1){return"]"}else{return n.replace(/../,"\\")}})}return X(e)}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=Y(f);var m=J(p);if(m!==p.length){c+="--length: "+m+";"}}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 d;if(l===""){d=f}else{d=l.replace(/]/g,"]").replace(/>/g,">").replace(/"+f+""}else{h+=' data-text="'+d.replace(/"/g,""e;")+'">'+f+""}return h})}else{n=i(n);var t="";if(typeof wcwidth!=="undefined"){var r=Y(n);var a=J(r);if(r.length!==a){t=' style="--length: '+a+'"'}}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 G(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");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();e.fn.scroll_element.cache=s;return s}else{return this}})};e.fn.scroll_element.defaults={lines:2e3,pre:{height:"99999em"}};e.fn.scroll_element.cache;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");t.addClass(n.attr("class"));if(n){var r=n.attr("style");if(r){r=r.split(/\s*;\s*/).filter(function(e){return!e.match(/display\s*:\s*none/i)}).join(";");t.attr("style",r)}}var i=t.find("span")[0].getBoundingClientRect();var o={width:i.width,height:i.height};t.remove();return o}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 be=[["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 we=[];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(he().invalidStrings,"`"+t+"`"))}else if(e.isFunction(Me.processArguments)){return ie(n,Me.processArguments)}else if(Me.processArguments){return e.terminal.parse_command(n)}else{return e.terminal.split_command(n)}}function l(n){if(typeof n==="string"){ve.echo(n)}else if(n instanceof Array){ve.echo(e.map(n,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof n==="object"){ve.echo(JSON.stringify(n))}else{ve.echo(n)}}function f(n){var t=/(.*):([0-9]+):([0-9]+)$/;var r=n.match(t);if(r){ve.pause(Me.softPause);e.get(r[1],function(n){var t=location.href.replace(/[^/]+$/,"");var i=r[1].replace(t,"");ve.echo("[[b;white;]"+i+"]");var o=n.split("\n");var a=+r[2]-1;ve.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(Me.onRPCError)){Me.onRPCError.call(ve,n)}else{ve.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}ve.error(t)}}}function u(n,t){var r=function(t,r){ve.pause(Me.softPause);e.jrpc({url:n,method:t,params:r,request:function(e,n){try{Me.request.call(ve,e,n,ve)}catch(e){y(e,"USER")}},response:function(e,n){try{Me.response.call(ve,e,n,ve)}catch(e){y(e,"USER")}},success:function n(t){if(t.error){c(t.error)}else if(e.isFunction(Me.processRPCResponse)){Me.processRPCResponse.call(ve,t.result,ve)}else{l(t.result)}ve.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] "+he().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(Me.exception)){Me.exception(n,ve)}else{ve.error(n.toString())}return}var c=t[f.name];var u=e.type(c);if(u==="function"){if(r&&c.length!==f.args.length){ve.error("[Arity] "+sprintf(he().wrongArity,f.name,c.length,f.args.length))}else{return c.apply(ve,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,ve)}else if(e.isFunction(Me.onCommandNotFound)){Me.onCommandNotFound.call(ve,a,ve)}else{l.error(sprintf(he().commandNotFound,f.name))}}}function m(n,t,r){ve.resume();if(e.isFunction(Me.onAjaxError)){Me.onAjaxError.call(ve,n,t,r)}else if(t!=="abort"){ve.error("[AJAX] "+t+" - "+he().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(Me.processRPCResponse)){Me.processRPCResponse.call(ve,n.result,ve)}else{l(n.result)}ve.resume()}function o(e,n){try{Me.request.call(ve,e,n,ve)}catch(e){y(e,"USER")}}function a(e,n){try{Me.response.call(ve,e,n,ve)}catch(e){y(e,"USER")}}function s(s){var l=s;if(Me.describe!==""){Me.describe.split(".").forEach(function(e){l=l[e]})}if(l&&l.length){var f={};e.each(l,function(r,s){if(e.isPlainObject(s)&&typeof s.name==="string"){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(Me.checkArity&&s.params&&s.params.length!==f){ve.error("[Arity] "+sprintf(he().wrongArity,s.name,s.params.length,f))}else{ve.pause(Me.softPause);if(r){var c=ve.token(true);if(c){l=[c].concat(l)}else{ve.error("[AUTH] "+he().noTokenError)}}e.jrpc({url:n,method:s.name,params:l,request:o,response:a,success:i,error:m})}}}});var c=typeof t==="string"?t:"login";f.help=f.help||function(n){if(typeof n==="undefined"){var r=s.procs.map(function(e){return e.name}).join(", ")+", help";ve.echo("Available commands: "+r)}else{var i=false;e.each(l,function(e,r){if(r.name===n){i=true;var o="";o+="[[bu;;]"+r.name+"]";if(r.params){var a=r.params;if(t&&r.name!==c){a=a.slice(1)}o+=" "+a.join(" ")}if(r.help){o+="\n"+r.help}ve.echo(o);return false}});if(!i){if(n==="help"){ve.echo("[[bu;;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var o="Method `"+n+"' not found ";ve.error(o)}}}};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"){ve.pause(Me.softPause);if(Me.describe===false){if(++s===1){l=u(a,t)}else{ve.error(he().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{ve.error(he().oneRPCWithIgnore)}ve.resume();n(f,i)})}}else if(c==="function"){if(l){ve.error(he().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(ve)),completion:Object.keys(o)})})}else if(i==="string"){if(Me.ignoreSystemDescribe){o={interpreter:u(n,t)};if(e.isArray(Me.completion)){o.completion=Me.completion}r(o)}else{ve.pause(Me.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);ve.resume()})}}else if(i==="object"){r({interpreter:p(n,Me.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:Me.completion})}}function v(n,t){var r=e.type(t)==="boolean"?"login":t;return function(t,i,o){ve.pause(Me.softPause);e.jrpc({url:n,method:r,params:[t,i],request:function(e,n){try{Me.request.call(ve,e,n,ve)}catch(e){y(e,"USER")}},response:function(e,n){try{Me.response.call(ve,e,n,ve)}catch(e){y(e,"USER")}},success:function e(n){if(!n.error&&n.result){o(n.result)}else{o(null)}ve.resume()},error:m})}}function y(n,t,r){if(e.isFunction(Me.exceptionHandler)){Me.exceptionHandler.call(ve,n,t)}else{ve.exception(n,t);if(!r){setTimeout(function(){throw n},0)}}}function x(){var e;if(ge.prop){e=ge.prop("scrollHeight")}else{e=ge.attr("scrollHeight")}ge.scrollTop(e)}function T(n,t){try{if(e.isFunction(t)){t.call(ve,e.noop,ve)}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,i){var o,a;E.push(C);if(t===""){}else if(!i.raw){if((J(t)>Le||t.match(/\n/))&&(Me.wrap===true&&i.wrap===n||Me.wrap===false&&i.wrap===true)){var s=i.keepWords;var l=e.terminal.split_equal(t,Le,s);for(o=0,a=l.length;o")}else{E.push(e.terminal.format(l[o],{linksNoReferrer:Me.linksNoReferrer}))}}}else{t=e.terminal.normalize(t);t=e.terminal.format(t,{linksNoReferrer:Me.linksNoReferrer});t.split(/\n/).forEach(function(e){E.push(e)})}}else{E.push(t)}E.push({finalize:i.finalize,index:r})}function A(n){try{var t=e.extend({exec:true,raw:false,finalize:e.noop},n.options||{});var r;var i=n.string;var o=e.type(i)==="function";if(o){i=i()}if(e.type(i)!=="string"){if(e.isFunction(Me.parseObject)){var a=Me.parseObject(i);if(e.type(a)==="string"){r=a}}else if(i instanceof Array){r=e.terminal.columns(i,ve.cols(),Me.tabs)}else{r=String(i)}}else{r=i}if(r!==""){r=e.map(r.split(B),function(n){if(n&&n.match(B)&&!e.terminal.is_formatting(n)){n=n.replace(/^\[\[|\]\]$/g,"");if(t.exec){if(ye&&ye.command===n){ve.error(he().recursiveCall)}else{e.terminal.extended_command(ve,n)}}return""}else{return n}}).join("");if(r!==""){if(!t.raw){if(Me.convertLinks){r=r.replace(P,"[[!;;]$1]").replace(I,"[[!;;]$1]")}if(t.formatters){try{r=e.terminal.apply_formatters(r)}catch(e){y(e,"FORMATTING")}}r=e.terminal.encode(r)}R(r,n.index,t)}}if(r===""&&o){R(r,n.index,t)}}catch(n){E=[];if(e.isFunction(Me.exceptionHandler)){Me.exceptionHandler.call(ve,n,"TERMINAL")}else{b("[Internal Exception(process_line)]",n)}}}function S(n){n=e.extend({},{update:false,scroll:true},n||{});if(!n.update){Qe.resize(Le);var t=Se.empty().detach()}var r=[];if(Me.outputLimit>=0){var i;if(Me.outputLimit===0){i=ve.rows()}else{i=Me.outputLimit}Ae.forEach(function(n,t){var i=n[0];var o=n[1];if(e.type(i)==="function"){i=i()}if(e.type(i)!=="string"){i=String(i)}r.push({string:i,index:t,options:o})});r=r.slice(r.length-i-1)}else{r=Ae.map(function(e,n){return{string:e[0],index:n,options:e[1]}})}try{E=[];e.each(r,function(e,n){A(n)});if(!n.update){Qe.before(t)}ve.flush(n);try{Me.onAfterRedraw.call(ve)}catch(n){Me.onAfterRedraw=e.noop;y(n,"onAfterRedraw")}}catch(n){if(e.isFunction(Me.exceptionHandler)){Me.exceptionHandler.call(ve,n,"TERMINAL (redraw)")}else{b("[redraw]",n)}}}function F(){if(Me.outputLimit>=0){var n;if(Me.outputLimit===0){n=ve.rows()}else{n=Me.outputLimit}var t=Se.find("> div > div");if(t.length+1>n){var r=t.length-n+1;var i=t.slice(0,r);var o=i.parent();i.remove();o.each(function(){var n=e(this);if(n.is(":empty")){n.remove()}})}}}function L(){if(Me.greetings===n){ve.echo(ve.signature,{finalize:g,formatters:false})}else if(Me.greetings){var e=typeof Me.greetings;if(e==="string"){ve.echo(Me.greetings)}else if(e==="function"){try{Me.greetings.call(ve,ve.echo)}catch(e){Me.greetings=null;y(e,"greetings")}}else{ve.error(he().wrongGreetings)}}}function j(n){if(typeof n==="undefined"){n=ve.get_command()}var t=Qe.prompt();var r=Qe.mask();switch(typeof r){case"string":n=n.replace(/./g,r);break;case"boolean":if(r){n=n.replace(/./g,Me.maskChar)}else{n=e.terminal.escape_formatting(n)}break}var i={finalize:function t(r){g(r.addClass("command"));try{Me.onEchoCommand.call(ve,r,n)}catch(n){Me.onEchoCommand=e.noop;ve.exception(n)}}};if(e.isFunction(t)){var o=t(function(e){ve.echo(e+n,i)});if(o&&o.then){o.then(function(e){if(typeof e==="string"){ve.echo(e+n,i)}})}}else{ve.echo(t+n,i)}}function O(){return on.outerWidth()!==ve.outerWidth()}function N(e){var n=_e.get()[e[0]];if(!n){throw new Error(he().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 $(){if(Te){Ee=false;location.hash="#"+JSON.stringify(ke);setTimeout(function(){Ee=true},100)}}var D=true;var H=[];function q(t,r,i){if(D){D=false;if(Me.historyState||Me.execHash&&i){if(!xe.length){ve.save_state()}else{ve.save_state(null)}}}function o(){if(!i){Te=true;if(Me.historyState){ve.save_state(t,false)}Te=c}f.resolve();if(e.isFunction(Me.onAfterCommand)){Me.onAfterCommand.call(ve,ve,t)}}function a(e){if(typeof e!=="undefined"){l(e)}o();ve.resume()}try{if(e.isFunction(Me.onBeforeCommand)){if(Me.onBeforeCommand.call(ve,ve,t)===false){return}}if(!i){ye=e.terminal.split_command(t)}if(!Z()){if(i&&(e.isFunction(Me.historyFilter)&&Me.historyFilter(t)||t.match(Me.historyFilter))){Qe.history().append(t)}}var s=Ve.top();if(!r&&Me.echoCommand){j(t)}var f=new e.Deferred;var c=Te;if(t.match(/^\s*login\s*$/)&&ve.token(true)){if(ve.level()>1){ve.logout(true)}else{ve.logout()}o()}else if(Me.exit&&t.match(/^\s*exit\s*$/)&&!He){var u=ve.level();if(u===1&&ve.get_token()||u>1){if(ve.get_token(true)){ve.set_token(n,true)}ve.pop()}o()}else if(Me.clear&&t.match(/^\s*clear\s*$/)&&!He){ve.clear();o()}else{var p=s.interpreter.call(ve,t,ve);if(p){ve.pause(Me.softPause);if(p.then){p.then(a)}else{return e.when(p).done(a)}}else if(Ge){H.push(function(){o()})}else{o()}}return f.promise()}catch(e){y(e,"USER");ve.resume()}}function W(){if(e.isFunction(Me.onBeforeLogout)){try{if(Me.onBeforeLogout.call(ve,ve)===false){return}}catch(e){y(e,"onBeforeLogout")}}U();if(e.isFunction(Me.onAfterLogout)){try{Me.onAfterLogout.call(ve,ve)}catch(e){y(e,"onAfterlogout")}}ve.login(fn,true,X)}function U(){var e=ve.prefix_name(true)+"_";Ke.remove(e+"token");Ke.remove(e+"login")}function M(n){var t=ve.prefix_name()+"_interpreters";var r=Ke.get(t);if(r){r=JSON.parse(r)}else{r=[]}if(e.inArray(n,r)===-1){r.push(n);Ke.set(t,JSON.stringify(r))}}function Y(n){var t=Ve.top();var r=ve.prefix_name(true);if(!Z()){M(r)}Qe.name(r);if(e.isFunction(t.prompt)){Qe.prompt(function(e){var n=t.prompt.call(ve,e,ve);if(n&&n.then){n.then(function(n){if(typeof n==="string"){e(n)}})}})}else{Qe.prompt(t.prompt)}if(e.isPlainObject(t.keymap)){Qe.keymap(e.omap(t.keymap,function(e,n){return function(){var e=[].slice.call(arguments);try{return n.apply(ve,e)}catch(e){y(e,"USER KEYMAP")}}}))}Qe.set("");Pe.resolve();if(!n&&e.isFunction(t.onStart)){t.onStart.call(ve,ve)}}function G(){if(Ee&&Me.execHash){try{if(location.hash){var e=location.hash.replace(/^#/,"");ke=JSON.parse(decodeURIComponent(e))}else{ke=[]}if(ke.length){N(ke[ke.length-1])}else if(xe[0]){ve.import_view(xe[0])}}catch(e){y(e,"TERMINAL")}}}function X(){Y();L();if(Ae.length){ve.refresh()}var n=false;if(e.isFunction(Me.onInit)){Be=function(){n=true};try{Me.onInit.call(ve,ve)}catch(e){y(e,"OnInit")}finally{Be=e.noop;if(!n&&ve.enabled()){ve.resume()}}}if(Ce){Ce=false;e(window).on("hashchange",G)}}function Z(){return He||Qe.mask()!==false}function re(e,n,t){if(!n.length){return""}var r=pe(e);var i=[];for(var o=e.length;o1||e.isFunction(fn)){ve.pop("")}else{ve.resume();ve.echo("")}}else{t()}}return false},"CTRL+C":function(){if(Q()===""){j(ve.get_command()+"^C");ve.set_command("")}},"CTRL+L":function(){ve.clear()},TAB:function(t,r){var i=Ve.top(),o,a;if(typeof i.caseSensitiveAutocomplete!=="undefined"){a=i.caseSensitiveAutocomplete}else{a=Me.caseSensitiveAutocomplete}if(Me.completion&&e.type(Me.completion)!=="boolean"&&i.completion===n){o=Me.completion}else{o=i.completion}if(o==="settings"){o=Me.completion}if(o){switch(e.type(o)){case"function":var s=ve.before_cursor(Me.wordAutocomplete);if(o.length===3){var l=new Error(he().comletionParameters);y(l,"USER");return false}o.call(ve,s,function(e){ve.complete(e,{echo:true,word:Me.wordAutocomplete,escape:Me.completionEscape,caseSensitive:a})});break;case"array":ve.complete(o,{echo:true,word:Me.wordAutocomplete,escape:Me.completionEscape,caseSensitive:a});break;default:throw new Error(he().invalidCompletion)}}else{r()}return false},"CTRL+V":function(e,n){n(e);ve.oneTime(200,function(){x()});return true},"CTRL+TAB":function(){if(_e.length()>1){ve.focus(false);return false}},PAGEDOWN:function(){ve.scroll(ve.height())},PAGEUP:function(){ve.scroll(-ve.height())}};function ue(t){var r,i;if(ve.enabled()){if(!ve.paused()){r=ae(t);if(r!==n){return r}if(t.which!==9){Re=0}ve.attr({scrollTop:ve.attr("scrollHeight")})}else{if(!Me.pauseEvents){r=ae(t);if(r!==n){return r}}if(t.which===68&&t.ctrlKey){if(Me.pauseEvents){r=ae(t);if(r!==n){return r}}if(we.length){for(i=we.length;i--;){var o=we[i];if(o.readyState!==4){try{o.abort()}catch(n){if(e.isFunction(Me.exceptionHandler)){Me.exceptionHandler.call(ve,t,"AJAX ABORT")}else{ve.error(he().ajaxAbortError)}}}}we=[]}ve.resume()}return false}}}function de(e){return function(n){e.add(n)}}function he(){return e.extend({},e.terminal.defaults.strings,Me&&Me.strings||{})}var ve=this;if(this.length>1){return this.each(function(){e.fn.terminal.call(e(this),r,e.extend({name:ve.selector},o))})}if(ve.data("terminal")){return ve.data("terminal")}if(ve.length===0){throw new Error(sprintf(he().invalidSelector,ve.selector))}var ge;var ye;var Re=0;var Ae=[];var Se;var Fe=_e.length();var Le;var je;var Oe;var ze=new k;var Ie=new t;var Pe=new t;var Ne=de(Pe);var $e=le(ve);var De=de(Ie);var He=false;var Be=e.noop;var qe,We;var Ue=[];var Me=e.extend({},e.terminal.defaults,{name:ve.selector},o||{});var Ke=new a(Me.memory);var Je=Me.enabled,Ye=false;var Ge=false;var Xe=true;var Ve;var Qe;var Ze;var en;var nn;e.extend(ve,e.omap({id:function(){return Fe},clear:function(){Se.html("");Ae=[];try{Me.onClear.call(ve,ve)}catch(e){y(e,"onClear")}ve.attr({scrollTop:0});return ve},export_view:function(){var n={};if(e.isFunction(Me.onExport)){try{n=Me.onExport.call(ve)}catch(e){y(e,"onExport")}}return e.extend({},{focus:Je,mask:Qe.mask(),prompt:ve.get_prompt(),command:ve.get_command(),position:Qe.position(),lines:i(Ae),interpreters:Ve.clone(),history:Qe.history().data},n)},import_view:function(n){if(He){throw new Error(sprintf(he().notWhileLogin,"import_view"))}if(e.isFunction(Me.onImport)){try{Me.onImport.call(ve,n)}catch(n){Me.onImport=e.noop;y(n,"onImport")}}Ne(function e(){ve.set_prompt(n.prompt);ve.set_command(n.command);Qe.position(n.position);Qe.mask(n.mask);if(n.focus){ve.focus()}Ae=i(n.lines);Ve=n.interpreters;if(Me.importHistory){Qe.history().set(n.history)}S()});return ve},save_state:function(t,r,i){if(typeof i!=="undefined"){xe[i]=ve.export_view()}else{xe.push(ve.export_view())}if(!e.isArray(ke)){ke=[]}if(t!==n&&!r){var o=[Fe,xe.length-1,t];ke.push(o);$()}},exec:function(n,t,r){var i=r||new e.Deferred;De(function r(){if(e.isArray(n)){(function e(){var r=n.shift();if(r){ve.exec(r,t).done(e)}else{i.resolve()}})()}else if(Ge){Ue.push([n,t,i])}else{q(n,t,true).done(function(){i.resolve(ve)})}});return i.promise()},autologin:function(e,n,t){ve.trigger("terminal.autologin",[e,n,t]);return ve},login:function(t,r,i,o){ze.push([].slice.call(arguments));if(He){throw new Error(sprintf(he().notWhileLogin,"login"))}if(!e.isFunction(t)){throw new Error(he().loginIsNotAFunction)}He=true;if(ve.token()&&ve.level()===1&&!Xe){He=false;ve.logout(true)}else if(ve.token(true)&&ve.login_name(true)){He=false;if(e.isFunction(i)){i()}return ve}if(Me.history){Qe.history().disable()}var a=ve.level();function s(t,s,l){if(s){while(ve.level()>a){ve.pop(n,true)}if(Me.history){Qe.history().enable()}var f=ve.prefix_name(true)+"_";Ke.set(f+"token",s);Ke.set(f+"login",t);He=false;if(e.isFunction(i)){i()}}else{if(r){if(!l){ve.error(he().wrongPasswordTryAgain)}ve.pop(n,true).set_mask(false)}else{He=false;if(!l){ve.error(he().wrongPassword)}ve.pop(n,true).pop(n,true)}if(e.isFunction(o)){o()}}ve.off("terminal.autologin")}ve.on("terminal.autologin",function(e,n,t,r){s(n,t,r)});ve.push(function(e){ve.set_mask(Me.maskChar).push(function(n){try{t.call(ve,e,n,function(n,t){s(e,n,t)})}catch(e){y(e,"AUTH")}},{prompt:he().password+": ",name:"password"})},{prompt:he().login+": ",name:"login"});return ve},settings:function(){return Me},before_cursor:function(e){var n=Qe.position();var t=Qe.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(sn=r.length-1;sn>0;sn--){var l=r[sn-1];if(l[l.length-1]==="\\"){i=r[sn-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=ve.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(Me.clear&&e.inArray("clear",n)===-1){n.push("clear")}if(Me.exit&&e.inArray("exit",n)===-1){n.push("exit")}if(Re%2===0){Oe=ve.before_cursor(t.word)}else{var a=ve.before_cursor(t.word);if(a!==Oe){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=ve.get_command();var r=ve.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||"");ve.set_command(a+l+s);ve.set_position((a+l).length)}if(u.length===1){if(t.escape){p(s,u[0])}else{ve.insert(u[0].replace(c,"")+(o||""))}Oe=ve.before_cursor(t.word);return true}else if(u.length>1){if(++Re>=2){Re=0;if(t.echo){j();var m=u.reverse().join("\t");ve.echo(e.terminal.escape_brackets(m),{keepWords:true,formatters:false});return true}}else{var d=re(i,u,r);if(d){p(i,d);Oe=ve.before_cursor(t.word);return true}}}},commands:function(){return Ve.top().interpreter},set_interpreter:function(n,t){function r(){ve.pause(Me.softPause);h(n,t,function(n){ve.resume();var t=Ve.top();e.extend(t,n);Y(true)})}if(e.type(n)==="string"&&t){ve.login(v(n,t),true,r)}else{r()}return ve},greetings:function(){L();return ve},paused:function(){return Ge},pause:function(n){De(function t(){Be();Ge=true;Qe.disable(n||K);if(!n){Qe.find(".prompt").hidden()}if(e.isFunction(Me.onPause)){Me.onPause.call(ve)}});return ve},resume:function(){De(function n(){Ge=false;if(Je&&_e.front()===ve){Qe.enable()}Qe.find(".prompt").visible();var t=Ue;Ue=[];for(var r=0;r1){ve.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(n,0)}else{setImmediate(n)}}else{Me.historyState=false}return ve},clear_history_state:function(){ke=[];xe=[];return ve},next:function(){if(_e.length()===1){return ve}else{_e.front().disable();var n=_e.rotate().enable();var t=n.offset().top-50;e("html,body").animate({scrollTop:t},500);try{oe(n)}catch(e){y(e,"onTerminalChange")}return n}},focus:function(e,n){De(function t(){if(_e.length()===1){if(e===false){ve.disable(n)}else{ve.enable(n)}}else if(e===false){ve.next()}else{var r=_e.front();if(r!==ve){_e.forEach(function(e){if(e!==ve&&e.enabled()){e.disable(n)}});if(!n){try{oe(ve)}catch(e){y(e,"onTerminalChange")}}}_e.set(ve);ve.enable(n)}});return ve},freeze:function(e){Ne(function n(){if(e){ve.disable();Ye=true}else{Ye=false;ve.enable()}})},frozen:function(){return Ye},enable:function(t){if(!Je&&!Ye){if(Le===n){ve.resize()}De(function r(){var i;if(!t&&!Je){try{i=Me.onFocus.call(ve,ve)}catch(n){Me.onFocus=e.noop;y(n,"onFocus")}}if(!t&&i===n||t){Je=true;if(!ve.paused()){Qe.enable()}}})}return ve},disable:function(t){De(function r(){var i;if(!t&&Je){try{i=Me.onBlur.call(ve,ve)}catch(n){Me.onBlur=e.noop;y(n,"onBlur")}}if(!t&&i===n||t){Je=false;Qe.disable()}});return ve},enabled:function(){return Je},signature:function(){var e=ve.cols();for(var n=be.length;n--;){var t=be[n].map(function(e){return e.length});if(Math.max.apply(null,t)<=e){return be[n].join("\n")+"\n"}}return""},version:function(){return e.terminal.version},cmd:function(){return Qe},get_command:function(){return Qe.get()},set_command:function(e,t){Ne(function r(){Qe.set(e,n,t)});return ve},set_position:function(e,n){Ne(function t(){Qe.position(e,n)});return ve},get_position:function(){return Qe.position()},insert:function(e,n){if(typeof e==="string"){Ne(function t(){var r=ve.is_bottom();Qe.insert(e,n);if(Me.scrollOnEcho||r){x()}});return ve}else{throw new Error(sprintf(he().notAString,"insert"))}},set_prompt:function(n){Ne(function t(){if(T("prompt",n)){if(e.isFunction(n)){Qe.prompt(function(e){n(e,ve)})}else{Qe.prompt(n)}Ve.top().prompt=n}});return ve},get_prompt:function(){return Ve.top().prompt},set_mask:function(e){Ne(function n(){Qe.mask(e===true?Me.maskChar:e)});return ve},get_output:function(n){if(n){return Ae}else{return e.map(Ae,function(n){return e.isFunction(n[0])?n[0]():n[0]}).join("\n")}},resize:function(n,t){if(!ve.is(":visible")){ve.stopTime("resize");ve.oneTime(500,"resize",function(){ve.resize(n,t)})}else{if(n&&t){ve.width(n);ve.height(t)}n=ve.width();t=ve.height();if(typeof Me.numChars!=="undefined"||typeof Me.numRows!=="undefined"){Qe.resize(Me.numChars);ve.refresh();return}var r=fe(ve,$e);var i=ce(ve,$e);if(r!==Le||i!==je){Le=r;je=i;Qe.resize(Le);ve.refresh();var o=Ve.top();if(e.isFunction(o.resize)){o.resize.call(ve,ve)}else if(e.isFunction(Me.onResize)){Me.onResize.call(ve,ve)}}}return ve},refresh:function(){if($e.width!==0){ve[0].style.setProperty("--char-width",$e.width)}S({scroll:false,update:true});return ve},flush:function(n){n=e.extend({},{update:false,scroll:true},n||{});try{var t=ve.is_bottom();var r;e.each(E,function(t,i){if(i===C){r=e("")}else if(e.isPlainObject(i)&&e.isFunction(i.finalize)){if(n.update){var o="> div[data-index="+i.index+"]";var a=Se.find(o);if(a.html()!==r.html()){a.replaceWith(r)}}else{r.appendTo(Se)}i.finalize(r.attr("data-index",i.index))}else{e("").html(i).appendTo(r).width("100%")}});F();try{Me.onFlush.call(ve,ve)}catch(n){Me.onFlush=e.noop;y(n,"onFlush")}if(Me.scrollOnEcho&&n.scroll||t){x()}E=[]}catch(n){if(e.isFunction(Me.exceptionHandler)){Me.exceptionHandler.call(ve,n,"TERMINAL (Flush)")}else{b("[Flush]",n)}}return ve},update:function(e,n,t){Ne(function r(){if(e<0){e=Ae.length+e}if(!Ae[e]){ve.error("Invalid line number "+e)}else if(n===null){Ae.splice(e,1);Se.find("[data-index="+e+"]").remove()}else{Ae[e][0]=n;if(t){Ae[e][1]=t}A({string:n,index:e,options:t});ve.flush({scroll:false,update:true})}});return ve},remove:function(e,n){return ve.update(e,null,n)},last_index:function(){return Ae.length-1},echo:function(n,t){function r(n){try{var r=e.extend({flush:true,raw:Me.raw,finalize:e.noop,keepWords:false,formatters:true},t||{});(function(n){r.finalize=function(t){if(r.raw){t.addClass("raw")}try{if(e.isFunction(n)){n(t)}}catch(e){y(e,"USER:echo(finalize)");n=null}}})(r.finalize);if(r.flush){if(E.length){ve.flush()}E=[]}if(typeof n==="function"){n=n.bind(ve)}A({string:n,options:r,index:Ae.length});Ae.push([n,e.extend(r,{exec:false})]);if(r.flush){ve.flush()}}catch(n){if(e.isFunction(Me.exceptionHandler)){Me.exceptionHandler.call(ve,n,"TERMINAL (echo)")}else{b("[Terminal.echo]",n)}}}if(e.isFunction(n.then)){e.when(n).done(r)}else{r(n)}return ve},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 ve.echo("[[;;;error]"+r+"]",t)},exception:function(n,t){var r=_(n);if(t){r="["+t+"]: "+r}if(r){ve.error(r,{finalize:function(e){e.addClass("exception message")},keepWords:true})}if(typeof n.fileName==="string"){ve.pause(Me.softPause);e.get(n.fileName,function(e){var t=n.lineNumber-1;var r=e.split("\n")[t];if(r){ve.error("["+n.lineNumber+"]: "+r)}ve.resume()},"text")}if(n.stack){var i=e.terminal.escape_brackets(n.stack);ve.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(ge.prop){if(e>ge.prop("scrollTop")&&e>0){ge.prop("scrollTop",0)}n=ge.prop("scrollTop");ge.scrollTop(n+e)}else{if(e>ge.attr("scrollTop")&&e>0){ge.attr("scrollTop",0)}n=ge.attr("scrollTop");ge.scrollTop(n+e)}return ve},logout:function(e){if(He){throw new Error(sprintf(he().notWhileLogin,"logout"))}Ne(function t(){if(e){var r=ze.pop();ve.set_token(n,true);ve.login.apply(ve,r)}else if(Ve.size()===1&&ve.token()){ve.logout(true)}else{while(Ve.size()>1){if(ve.token()){ve.logout(true).pop().pop()}else{ve.pop()}}}});return ve},token:function(e){return Ke.get(ve.prefix_name(e)+"_token")},set_token:function(e,n){var t=ve.prefix_name(n)+"_token";if(typeof e==="undefined"){Ke.remove(t,e)}else{Ke.set(t,e)}return ve},get_token:function(e){return ve.token(e)},login_name:function(e){return Ke.get(ve.prefix_name(e)+"_login")},name:function(){return Ve.top().name},prefix_name:function(e){var n=(Me.name?Me.name+"_":"")+Fe;if(e&&Ve.size()>1){var t=Ve.map(function(e){return e.name||""}).slice(1).join("_");if(t){n+="_"+t}}return n},read:function(n,t){var r=new e.Deferred;ve.push(function(n){ve.pop();if(e.isFunction(t)){t(n)}r.resolve(n)},{prompt:n});return r.promise()},push:function(t,r){De(function i(){r=r||{};var o={infiniteLogin:false};var a=e.extend({},o,r);if(!a.name&&ye){a.name=ye.name}if(a.prompt===n){a.prompt=(a.name||">")+" "}var s=Ve.top();if(s){s.mask=Qe.mask()}var l=Ge;function f(){Me.onPush.call(ve,s,Ve.top(),ve);Y()}h(t,r.login,function(n){Ve.push(e.extend({},n,a));if(a.completion===true){if(e.isArray(n.completion)){Ve.top().completion=n.completion}else if(!n.completion){Ve.top().completion=false}}if(a.login){var r;var i=e.type(a.login);if(i==="function"){r=a.infiniteLogin?e.noop:ve.pop;ve.login(a.login,a.infiniteLogin,f,r)}else if(e.type(t)==="string"&&i==="string"||i==="boolean"){r=a.infiniteLogin?e.noop:ve.pop;ve.login(v(t,a.login),a.infiniteLogin,f,r)}}else{f()}if(!l&&ve.enabled()){ve.resume()}})});return ve},pop:function(t,r){if(t!==n){j(t)}var i=ve.token(true);var o;if(Ve.size()===1){o=Ve.top();if(Me.login){if(!r){Me.onPop.call(ve,o,null,ve)}W();if(e.isFunction(Me.onExit)){try{Me.onExit.call(ve,ve)}catch(n){Me.onExit=e.noop;y(n,"onExit")}}}else{ve.error(he().canExitError)}}else{if(i){U()}var a=Ve.pop();o=Ve.top();Y();if(!r){Me.onPop.call(ve,a,o)}if(He&&ve.get_prompt()!==he().login+": "){He=false}if(e.isFunction(a.onExit)){try{a.onExit.call(ve,ve)}catch(n){a.onExit=e.noop;y(n,"onExit")}}ve.set_mask(o.mask)}return ve},option:function(n,t){if(typeof t==="undefined"){if(typeof n==="string"){return Me[n]}else if(typeof n==="object"){e.each(n,function(e,n){Me[e]=n})}}else{Me[n]=t;if(n.match(/^num(Chars|Rows)$/)){S()}}return ve},level:function(){return Ve.size()},reset:function(){Ne(function e(){ve.clear();while(Ve.size()>1){Ve.pop()}X()});return ve},purge:function(){Ne(function n(){var t=ve.prefix_name()+"_";var r=Ke.get(t+"interpreters");if(r){e.each(JSON.parse(r),function(e,n){Ke.remove(n+"_commands");Ke.remove(n+"_token");Ke.remove(n+"_login")})}Qe.purge();Ke.remove(t+"interpreters")});return ve},destroy:function(){Ne(function n(){Qe.destroy().remove();Se.remove();tn.remove();e(document).unbind(".terminal_"+ve.id());e(window).unbind(".terminal_"+ve.id());ve.unbind("click wheel mousewheel mousedown mouseup");ve.removeData("terminal").removeClass("terminal").unbind(".terminal");if(Me.width){ve.css("width","")}if(Me.height){ve.css("height","")}e(window).off("blur",un).off("focus",cn);ve.find(".terminal-fill").remove();ve.stopTime();_e.remove(Fe);if(en){en.unobserve(ve[0])}if(nn){nn.disconnect()}ve.resizer("unbind");rn.resizer("unbind").remove();if(!_e.length()){e(window).off("hashchange")}});return ve},scroll_to_bottom:function(){x();return ve},is_bottom:function(){if(Me.scrollBottomOffset===-1){return false}else{var n,t,r;if(ve.is("body")){n=e(document).height();t=e(window).scrollTop();r=window.innerHeight}else{n=ge[0].scrollHeight;t=ge.scrollTop();r=ge.outerHeight()}var i=n-Me.scrollBottomOffset;return t+r>i}}},function(e,n){return function(){try{return n.apply(ve,[].slice.apply(arguments))}catch(n){if(e!=="exec"&&e!=="resume"){y(n,"TERMINAL",true)}if(!Me.exceptionHandler){throw n}}}}));if(Me.ignoreSystemDescribe===true){Me.describe=false}if(Me.width){ve.width(Me.width)}if(Me.height){ve.height(Me.height)}ge=ve.scroll_element();e(document).bind("ajaxSend.terminal_"+ve.id(),function(e,n){we.push(n)});var tn=e('').appendTo(ve);var rn=e('').appendTo(ve);var on=e('').appendTo(ve);Se=e("").addClass("terminal-output").attr("role","log").appendTo(tn);ve.addClass("terminal");if(Me.login&&e.isFunction(Me.onBeforeLogin)){try{if(Me.onBeforeLogin.call(ve,ve)===false){Xe=false}}catch(n){Me.onBeforeLogin=e.noop;y(n,"onBeforeLogin")}}var an;if(typeof r==="string"){an=r}else if(r instanceof Array){for(var sn=0,ln=r.length;sn
',{raw:true})}else if(n(t[r],"text/plain")){t[r].getAsString(ve.insert)}}}else if(e.clipboardData.getData){var s=e.clipboardData.getData("text/plain");ve.insert(s)}return false}}}e(document).on("paste.terminal_"+ve.id(),pn);h(r,Me.login,function(t){if(Me.completion&&typeof Me.completion!=="boolean"||!Me.completion){t.completion="settings"}var r=e.extend({},se,e.omap(Me.keymap||{},function(e,n){if(!se[e]){return n.bind(ve)}return function(t,r){return n.call(ve,t,function(){return se[e](t,r)})}}));Ve=new k(e.extend({},Me.extra,{name:Me.name,prompt:Me.prompt,keypress:Me.keypress,keydown:Me.keydown,resize:Me.onResize,greetings:Me.greetings,mousewheel:Me.mousewheel,keymap:r},t));Qe=e("
").appendTo(tn).cmd({prompt:Me.prompt,history:Me.memory?"memory":Me.history,historyFilter:Me.historyFilter,historySize:Me.historySize,width:"100%",enabled:false,keydown:ue,keymap:r,clickTimeout:Me.clickTimeout,keypress:function(n){var t=Ve.top();if(Je&&(!Ge||!Me.pauseEvents)){if(e.isFunction(t.keypress)){return t.keypress.call(ve,n,ve)}else if(e.isFunction(Me.keypress)){return Me.keypress.call(ve,n,ve)}}},onCommandChange:function(n){if(e.isFunction(Me.onCommandChange)){try{Me.onCommandChange.call(ve,n,ve)}catch(n){Me.onCommandChange=e.noop;y(n,"onCommandChange")}}x()},commands:q});function i(n){n=n.originalEvent;if(n){var t=document.elementFromPoint(n.clientX,n.clientY);if(!e(t).closest(".terminal").length&&ve.enabled()){ve.disable()}}}ve.oneTime(100,function(){e(document).bind("click.terminal_"+ve.id(),i).bind("contextmenu.terminal_"+ve.id(),i)});var o=e(window);document.addEventListener("resume",function(){ve.disable()});if(V){ve.click(function(){if(!Ye){if(!ve.enabled()){ve.focus();Qe.enable()}else{ve.disable()}}})}else{o.on("focus.terminal_"+ve.id(),cn).on("blur.terminal_"+ve.id(),un);(function(){var n=0;var t;var r="click_"+ve.id();function i(){if(t.is(".terminal")||t.is(".terminal-wrapper")){var e=ve.get_command().length;ve.set_position(e)}else if(t.closest(".prompt").length){ve.set_position(0)}o()}function o(){n=0;t=null}ve.mousedown(function(n){if(!w(n,on)){t=e(n.target)}}).mouseup(function(){if(Q()===""&&t){if(++n===1){if(!Ye){if(!Je){ve.focus()}else{var e=Me.clickTimeout;ve.oneTime(e,r,i);return}}}else{ve.stopTime(r)}}o()}).dblclick(function(){o();ve.stopTime(r)})})();(function(){var n=ve.find("textarea");ve.on("contextmenu.terminal",function(t){if(Q()===""){if(!e(t.target).is("img,value,audio,object,canvas,a")){if(!ve.enabled()){ve.enable()}var r=Qe.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()}ve.stopTime("textarea");ve.oneTime(100,"textarea",function(){n.css({left:"",top:"",width:"",height:""})});ve.stopTime("selection");ve.everyTime(20,"selection",function(){if(n[0].selection!==n[0].value){if(ee(n[0])){ne(n[0]);te(ve.find(".terminal-output")[0],ve.find(".cmd div:last-of-type")[0]);ve.stopTime("selection")}}})}}})})()}ve.delegate(".exception a","click",function(n){var t=e(this).attr("href");if(t.match(/:[0-9]+$/)){n.preventDefault();f(t)}});if(ve.is(":visible")){Le=ve.cols();Qe.resize(Le);if(!$e){$e=le(ve)}je=ce(ve,$e)}function a(){if(ve.is(":visible")){var e=ve.width();var n=ve.height();if(We!==n||qe!==e){ve.resize()}We=n;qe=e}}function s(){ve.resizer("unbind").resizer(a);rn.resizer("unbind").resizer(function(){$e=le(ve);ve.resize()})}if(ve.is(":visible")){s()}function l(){if(en){en.unobserve(ve[0])}var n=ve.enabled();var t=ve.is(":visible");if(t){s()}en=new IntersectionObserver(function(){if(ve.is(":visible")&&!t){t=true;s();$e=le(ve);a();if(n){ve.enable()}}else if(t&&!ve.is(":visible")){t=false;n=e.terminal.active()===ve&&ve.enabled();ve.disable()}},{root:document.body});en.observe(ve[0])}var c=!!ve.closest("body").length;var u=window.MutationObserver||window.WebKitMutationObserver;if(window.IntersectionObserver){if(u){nn=new u(function(){if(ve.closest("body").length){if(!c){ve.scroll_to_bottom();l()}c=true}else if(c){c=false}});nn.observe(document.body,{childList:true})}if(c){l()}}Ie.resolve();if(Je&&ve.is(":visible")&&!V){ve.focus(n,true)}else{ve.disable()}if(e.isFunction(fn)){ve.login(fn,true,X)}else{X()}function p(n){var t=_e.get()[n[0]];if(t&&Fe===t.id()){if(n[2]){try{if(Ge){var r=e.Deferred();H.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(ve,n,"EXEC HASH")}else{var o=e.terminal.escape_brackets(Oe);var a="Error while exec with command "+o;t.error(a).exception(n)}}}}}if(Me.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_"+ve.id(),function(e){if(e.shiftKey){m=true}}).bind("keyup.terminal_"+ve.id(),function(e){if(e.shiftKey||e.which===16){m=false}});function d(n,t){if(!m){var r=Ve.top();var i;if(e.isFunction(r.mousewheel)){i=r.mousewheel(n,t,ve)}else if(e.isFunction(Me.mousewheel)){i=Me.mousewheel(n,t,ve)}if(O()||i===false){n.preventDefault()}if(i===false){return}if(t>0){ve.scroll(-40)}else{ve.scroll(40)}}}if(e.event.special.mousewheel){ve.on("mousewheel",d)}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;ve.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)})}});ve.data("terminal",ve);return ve}});
\ No newline at end of file
diff --git a/js/unix_formatting.js b/js/unix_formatting.js
index 980cdd8aa..da0ead3d5 100644
--- a/js/unix_formatting.js
+++ b/js/unix_formatting.js
@@ -9,7 +9,7 @@
*
* This is example of how to create custom formatter for jQuery Terminal
*
- * Copyright (c) 2014-2016 Jakub Jankiewicz
+ * Copyright (c) 2014-2018 Jakub Jankiewicz
* Released under the MIT license
*
*/
diff --git a/js/xml_formatting.js b/js/xml_formatting.js
index 3caddbefb..3d305a70f 100644
--- a/js/xml_formatting.js
+++ b/js/xml_formatting.js
@@ -9,7 +9,7 @@
*
* This is example of how to create custom formatter for jQuery Terminal
*
- * Copyright (c) 2014-2017 Jakub Jankiewicz
+ * Copyright (c) 2014-2018 Jakub Jankiewicz
* Released under the MIT license
*
*/
diff --git a/spec/terminalSpec.js b/spec/terminalSpec.js
index fc401bc7b..add280396 100644
--- a/spec/terminalSpec.js
+++ b/spec/terminalSpec.js
@@ -2736,7 +2736,7 @@ function tests_on_ready() {
return line.length;
}));
}
- it('should return empty string', function() {
+ it('should return space', function() {
expect(term.signature()).toEqual('');
});
it('should return proper max length of signature', function() {