/
jquery.terminal.min.js
47 lines (47 loc) · 131 KB
/
jquery.terminal.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**@license
* __ _____ ________ __
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version DEV
*
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
*
* Copyright (c) 2010-2019 Jakub T. Jankiewicz <https://jcubic.pl/me>
* Released under the MIT license
*
* Contains:
*
* Storage plugin Distributed under the MIT License
* modified to work from Data URIs that block storage and cookies in Chrome
* Copyright (c) 2010 Dave Schindler
*
* jQuery Timers licenced with the WTFPL
* <http://jquery.offput.ca/timers/>
*
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* Available under the MIT License
*
* jQuery Caret
* Copyright (c) 2009, Gideon Sireling
* 3 clause BSD License
*
* sprintf.js
* Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro>
* licensed under 3 clause BSD license
*
* debounce function from Lodash
* Copyright JS Foundation and other contributors <https://js.foundation/>
* The MIT License
*
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Wed, 18 Dec 2019 12:22:00 +0000
*/
(function(e){var m=function(){if(!m.cache.hasOwnProperty(arguments[0])){m.cache[arguments[0]]=m.parse(arguments[0])}return m.format.call(null,m.cache[arguments[0]],arguments)};m.format=function(e,t){var n=1,r=e.length,i="",a,o=[],u,s,l,f,c,p;for(u=0;u<r;u++){i=d(e[u]);if(i==="string"){o.push(e[u])}else if(i==="array"){l=e[u];if(l[2]){a=t[n];for(s=0;s<l[2].length;s++){if(!a.hasOwnProperty(l[2][s])){throw m('[sprintf] property "%s" does not exist',l[2][s])}a=a[l[2][s]]}}else if(l[1]){a=t[l[1]]}else{a=t[n++]}if(/[^s]/.test(l[8])&&d(a)!=="number"){throw m("[sprintf] expecting number but found %s",d(a))}switch(l[8]){case"b":a=a.toString(2);break;case"c":a=String.fromCharCode(a);break;case"d":a=parseInt(a,10);break;case"e":a=l[7]?a.toExponential(l[7]):a.toExponential();break;case"f":a=l[7]?parseFloat(a).toFixed(l[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=String(a))&&l[7]?a.slice(0,l[7]):a;break;case"u":a=a>>>0;break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase();break}a=/[def]/.test(l[8])&&l[3]&&a>=0?" +"+a:a;c=l[4]?l[4]==="0"?"0":l[4].charAt(1):" ";p=l[6]-String(a).length;f=l[6]?h(c,p):"";o.push(l[5]?a+f:f+a)}}return o.join("")};m.cache={};m.parse=function(e){var t=e,n=[],r=[],i=0;while(t){if((n=/^[^\x25]+/.exec(t))!==null){r.push(n[0])}else if((n=/^\x25{2}/.exec(t))!==null){r.push("%")}else if((n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))!==null){if(n[2]){i|=1;var a=[],o=n[2],u=[];if((u=/^([a-z_][a-z_\d]*)/i.exec(o))!==null){a.push(u[1]);while((o=o.slice(u[0].length))!==""){if((u=/^\.([a-z_][a-z_\d]*)/i.exec(o))!==null){a.push(u[1])}else if((u=/^\[(\d+)\]/.exec(o))!==null){a.push(u[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}n[2]=a}else{i|=2}if(i===3){throw"[sprintf] mixing positional and named placeholders is not (yet) supported"}r.push(n)}else{throw"[sprintf] huh?"}t=t.slice(n[0].length)}return r};var t=function(e,t,n){n=t.slice(0);n.splice(0,0,e);return m.apply(null,n)};function d(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function h(e,t){for(var n=[];t>0;n[--t]=e){}return n.join("")}e.sprintf=m;e.vsprintf=t})(typeof global!=="undefined"?global:window);(function(r,i){var e=typeof window!=="undefined"?window:global;if(typeof define==="function"&&define.amd){define(["jquery","wcwidth"],r)}else if(typeof module==="object"&&module.exports){module.exports=function(e,t,n){if(t===i){if(window!==i){t=require("jquery")}else{t=require("jquery")(e)}}if(n===i){n=require("wcwidth")}r(t,n);return t}}else{r(e.jQuery,e.wcwidth)}})(function($,wcwidth,undefined){"use strict";function debug(e){if(false){console.log(e)}}function DelayQueue(){var t=$.Callbacks();var n=false;this.resolve=function(){t.fire();n=true};this.add=function(e){if(n){e()}else{t.add(e)}}}$.omap=function(n,r){var i={};$.each(n,function(e,t){i[e]=r.call(n,e,t)});return i};$.fn.text_length=function(){return this.map(function(){return $(this).text().length}).get().reduce(function(e,t){return e+t},0)};var Clone={clone_object:function(e){var t={};if(typeof e==="object"){if($.isArray(e)){return this.clone_array(e)}else if(e===null){return e}else{for(var n in e){if($.isArray(e[n])){t[n]=this.clone_array(e[n])}else if(typeof e[n]==="object"){t[n]=this.clone_object(e[n])}else{t[n]=e[n]}}}}return t},clone_array:function(e){if(!is_function(Array.prototype.map)){throw new Error("Your browser don't support ES5 array map "+"use es5-shim")}return e.slice(0).map(function(e){if(typeof e==="object"){return this.clone_object(e)}else{return e}}.bind(this))}};var clone=function(e){return Clone.clone_object(e)};var localStorage;(function(){var e=function(){try{var e="test",t=window.localStorage;t.setItem(e,"1");t.removeItem(e);return true}catch(e){return false}};var t=function(){try{document.cookie.split(";");return true}catch(e){return false}};var n=e();function r(e,t){var n;if(typeof e==="string"&&typeof t==="string"){localStorage[e]=t;return true}else if(typeof e==="object"&&typeof t==="undefined"){for(n in e){if(e.hasOwnProperty(n)){localStorage[n]=e[n]}}return true}return false}function i(e,t){var n,r,i;n=new Date;n.setTime(n.getTime()+31536e6);r="; expires="+n.toGMTString();if(typeof e==="string"&&typeof t==="string"){document.cookie=e+"="+t+r+"; path=/";return true}else if(typeof e==="object"&&typeof t==="undefined"){for(i in e){if(e.hasOwnProperty(i)){document.cookie=i+"="+e[i]+r+"; path=/"}}return true}return false}function a(e){return localStorage[e]}function o(e){var t,n,r,i;t=e+"=";n=document.cookie.split(";");for(r=0;r<n.length;r++){i=n[r];while(i.charAt(0)===" "){i=i.slice(1,i.length)}if(i.indexOf(t)===0){return i.slice(t.length,i.length)}}return null}function u(e){return delete localStorage[e]}function s(e){return i(e,"",-1)}if(!t()&&!n){localStorage={};$.extend({Storage:{set:r,get:a,remove:u}})}else{if(n){localStorage=window.localStorage}$.extend({Storage:{set:n?r:i,get:n?a:o,remove:n?u:s}})}})();var debounce=function(){var x="Expected a function";function F(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function $(){return Date.now()}return function e(r,i,t){var n=Math.max,a=Math.min;var o,u,s,l,f,c,p=0,m=false,d=false,h=true;if(typeof r!="function"){throw new TypeError(x)}i=i||0;if(F(t)){m=!!t.leading;d="maxWait"in t;s=d?n(t.maxWait||0,i):s;h="trailing"in t?!!t.trailing:h}function D(e){var t=o,n=u;o=u=undefined;p=e;l=r.apply(n,t);return l}function v(e){p=e;f=setTimeout(y,i);return m?D(e):l}function g(e){var t=e-c,n=e-p,r=i-t;return d?a(r,s-n):r}function _(e){var t=e-c,n=e-p;return c===undefined||t>=i||t<0||d&&n>=s}function y(){var e=$();if(_(e)){return b(e)}f=setTimeout(y,g(e))}function b(e){f=undefined;if(h&&o){return D(e)}o=u=undefined;return l}function w(){if(f!==undefined){clearTimeout(f)}p=0;o=c=u=f=undefined}function C(){return f===undefined?l:b($())}function E(){var e=$(),t=_(e);o=arguments;u=this;c=e;if(t){if(f===undefined){return v(c)}if(d){f=setTimeout(y,i);return D(c)}}if(f===undefined){f=setTimeout(y,i)}return l}E.cancel=w;E.flush=C;return E}}();var jQuery=$;(function(e){jQuery.fn.extend({everyTime:function(e,t,n,r,i){return this.each(function(){jQuery.timer.add(this,e,t,n,r,i)})},oneTime:function(e,t,n){return this.each(function(){jQuery.timer.add(this,e,t,n,1)})},stopTime:function(e,t){return this.each(function(){jQuery.timer.remove(this,e,t)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1e3,das:1e4,hs:1e5,ks:1e6},timeParse:function(e){if(e===undefined||e===null){return null}var t=this.regex.exec(jQuery.trim(e.toString()));if(t[2]){var n=parseInt(t[1],10);var r=this.powers[t[2]]||1;return n*r}else{return e}},add:function(e,t,n,r,i,a){var o=0;if(jQuery.isFunction(n)){if(!i){i=r}r=n;n=t}t=jQuery.timer.timeParse(t);if(typeof t!=="number"||isNaN(t)||t<=0){return}if(i&&i.constructor!==Number){a=!!i;i=0}i=i||0;a=a||false;if(!e.$timers){e.$timers={}}if(!e.$timers[n]){e.$timers[n]={}}r.$timerID=r.$timerID||this.guid++;var u=function(){if(a&&u.inProgress){return}u.inProgress=true;if(++o>i&&i!==0||r.call(e,o)===false){jQuery.timer.remove(e,n,r)}u.inProgress=false};u.$timerID=r.$timerID;if(!e.$timers[n][r.$timerID]){e.$timers[n][r.$timerID]=window.setInterval(u,t)}if(!this.global[n]){this.global[n]=[]}this.global[n].push(e)},remove:function(e,t,n){var r=e.$timers,i;if(r){if(!t){for(var a in r){if(r.hasOwnProperty(a)){this.remove(e,a,n)}}}else if(r[t]){if(n){if(n.$timerID){window.clearInterval(r[t][n.$timerID]);delete r[t][n.$timerID]}}else{for(var o in r[t]){if(r[t].hasOwnProperty(o)){window.clearInterval(r[t][o]);delete r[t][o]}}}for(i in r[t]){if(r[t].hasOwnProperty(i)){break}}if(!i){i=null;delete r[t]}}for(i in r){if(r.hasOwnProperty(i)){break}}if(!i){e.$timers=null}}}}});if(/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())){e(window).one("unload",function(){var e=jQuery.timer.global;for(var t in e){if(e.hasOwnProperty(t)){var n=e[t],r=n.length;while(--r){jQuery.timer.remove(n[r],t)}}}})}})(jQuery);(function(f){if(!String.prototype.split.toString().match(/\[native/)){return}var c=String.prototype.split,p=/()??/.exec("")[1]===f,n;n=function(e,t,n){if(Object.prototype.toString.call(t)!=="[object RegExp]"){return c.call(e,t,n)}var r=[],i=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),a=0,o,u,s,l;t=new RegExp(t.source,i+"g");e+="";if(!p){o=new RegExp("^"+t.source+"$(?!\\s)",i)}n=n===f?-1>>>0:n>>>0;while(u=t.exec(e)){s=u.index+u[0].length;if(s>a){r.push(e.slice(a,u.index));if(!p&&u.length>1){u[0].replace(o,function(){for(var e=1;e<arguments.length-2;e++){if(arguments[e]===f){u[e]=f}}})}if(u.length>1&&u.index<e.length){Array.prototype.push.apply(r,u.slice(1))}l=u[0].length;a=s;if(r.length>=n){break}}if(t.lastIndex===u.index){t.lastIndex++}}if(a===e.length){if(l||!t.test("")){r.push("")}}else{r.push(e.slice(a))}return r.length>n?r.slice(0,n):r};String.prototype.split=function(e,t){return n(this,e,t)};return n})();$.fn.caret=function(e){var t=this[0];var n=t.contentEditable==="true";if(arguments.length===0){if(window.getSelection){if(n){t.focus();var r=window.getSelection().getRangeAt(0),i=r.cloneRange();i.selectNodeContents(t);i.setEnd(r.endContainer,r.endOffset);return i.toString().length}return t.selectionStart}if(document.selection){t.focus();if(n){var r=document.selection.createRange(),i=document.body.createTextRange();i.moveToElementText(t);i.setEndPoint("EndToEnd",r);return i.text.length}var e=0,a=t.createTextRange(),i=document.selection.createRange().duplicate(),o=i.getBookmark();a.moveToBookmark(o);while(a.moveStart("character",-1)!==0)e++;return e}return 0}if(e===-1)e=this[n?"text":"val"]().length;if(window.getSelection){if(n){t.focus();window.getSelection().collapse(t.firstChild,e)}else t.setSelectionRange(e,e)}else if(document.body.createTextRange){var a=document.body.createTextRange();a.moveToElementText(t);a.moveStart("character",e);a.collapse(true);a.select()}if(!n&&!this.is(":focus")){t.focus()}return e};$.fn.resizer=function(u,e){var s=$.extend({},{prefix:""},e);var l=arguments.length===0;var f=arguments[0]==="unbind";if(!l&&!f&&!is_function(u)){throw new Error("Invalid argument, it need to a function or string "+'"unbind" or no arguments.')}if(f){u=is_function(arguments[1])?arguments[1]:null}return this.each(function(){var e=$(this);var t;var n;function r(){n.fire()}if(l||f){n=e.data("callbacks");if(l){n&&n.fire()}else{if(u&&n){n.remove(u);if(!n.has()){n=null}}else{n=null}if(!n){e.removeData("callbacks");if(window.ResizeObserver){var i=e.data("observer");if(i){i.unobserve(this);e.removeData("observer")}}else{t=e.find("> iframe");if(t.length){$(t[0].contentWindow).off("resize").remove();t.remove()}else if(e.is("body")){$(window).off("resize.resizer")}}}}}else if(e.data("callbacks")){$(this).data("callbacks").add(u)}else{n=$.Callbacks();n.add(u);e.data("callbacks",n);var a;var o=true;if(window.ResizeObserver){a=new ResizeObserver(function(){if(!o){r()}o=false});a.observe(this);e.data("observer",a)}else if(e.is("body")){$(window).on("resize.resizer",r)}else{t=$("<iframe/>").addClass(s.prefix+"resizer").appendTo(this)[0];$(t.contentWindow).on("resize",r)}}})};function jquery_resolve(e){var t=jQuery.Deferred();t.resolve(e);return t.promise()}function unpromise(e,t,n){if(e){if(is_function(e.catch)){e.catch(n)}if(is_function(e.done)){return e.done(t)}else if(is_function(e.then)){return e.then(t)}else{return t(e)}}}$.fn.is_fully_in_viewport=function(){function t(e,t){var n=e.getBoundingClientRect();var r=t[0].getBoundingClientRect();var i=n.top-r.top;var a=n.bottom-r.top;var o=t.height();return a>0&&i<=o}if(window.IntersectionObserver){return function(e){var t=this[0];var n=jQuery.Deferred();var r=new window.IntersectionObserver(function(e){n.resolve(e[0].isIntersecting&&e[0].ratio===1);r.unobserve(t)},{root:e[0]});r.observe(t);return n.promise()}}else{return function(e){return jquery_resolve(t(this[0],e))}}}();var combine_chr_re=/^(.(?:[\u0300-\u036F]|[\u1AB0-\u1abE]|[\u1DC0-\u1DF9]|[\u1DFB-\u1DFF]|[\u20D0-\u20F0]|[\uFE20-\uFE2F])+)/;var astral_symbols_re=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;var emoji_re=/^(\uD83C\uDFF4(?:\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74)\uDB40\uDC7F|\u200D\u2620\uFE0F)|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3]))|\uD83D\uDC69\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83D\uDC69\u200D[\u2695\u2696\u2708])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC68(?:\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDD1-\uDDDD]))/;var entity_re=/^(&(?:[a-z\d]+|#\d+|#x[a-f\d]+);)/i;var mobile_re=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;var tablet_re=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;var format_split_re=/(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\](?:[^\]\\]*(?:\\\\)*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?)/i;var format_parts_re=/\[\[((?:-?[@!gbiuso])*);([^;]*);([^;\]]*);?([^;\]]*);?([^\]]*)\]([^\]\\]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]+)\]?/gi;var format_re=/\[\[((?:-?[@!gbiuso])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]?/gi;var format_exist_re=/\[\[((?:-?[@!gbiuso])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\]([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)\]/gi;var format_full_re=/^(\[\[(?:(?:-?[@!gbiuso])*;[^;\]]*;[^;\]]*(?:;|[^\]()]*);?[^\]]*)\])([^\]]*\\\][^\]]*|[^\]]*|[^[]*\[[^\]]*)(\])$/i;var format_begin_re=/(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\])/i;var format_start_re=/^(\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\])/i;var format_end_re=/\[\[(?:-?[@!gbiuso])*;[^;]*;[^\]]*\]?$/i;var self_closing_re=/^(?:\[\[)?[^;]*@[^;]*;/;var color_hex_re=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;var url_re=/(\bhttps?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'<>\][)])+)/gi;var url_nf_re=/\b(?![^\s[\]]*])(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'<>\][)])+)/gi;var email_re=/((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g;var url_full_re=/^(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&))[^\s"'<>\][)])+)$/gi;var email_full_re=/^((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/g;var command_re=/((?:"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|\/[^\/\\]*(?:\\[\S\s][^\/\\]*)*\/[gimsuy]*(?=\s|$)|(?:\\\s|\S))+)(?=\s|$)/gi;var extended_command_re=/^\s*((terminal|cmd)::([a-z_]+)\(([\s\S]*)\))\s*$/;var format_exec_re=/(\[\[(?:[^\][]|\\\])+\]\])/;var float_re=/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;var re_re=/^\/((?:\\\/|[^/]|\[[^\]]*\/[^\]]*\])+)\/([gimsuy]*)$/;var string_re=/("(?:[^"\\]|\\(?:\\\\)*"|\\\\)*"|'(?:[^'\\]|\\(?:\\\\)*'|\\\\)*')/;var unclosed_strings_re=/^(?=((?:[^"']+|"[^"\\]*(?:\\[^][^"\\]*)*"|'[^'\\]*(?:\\[^][^'\\]*)*')*))\1./;var broken_image='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14"><title id="title2">rounded</title><path id="terminal-broken-image" d="m 14,10 h 2 v 1 a 3,3 0 0 1 -3,3 H 3 A 3,3 0 0 1 0,11 H 4.5 A 1.00012,1.00012 0 0 0 5.207,10.707 L 6.5,9.414 7.793,10.707 a 0.99963,0.99963 0 0 0 1.41406,0 l 2.36719,-2.36719 1.80127,1.44092 A 0.99807,0.99807 0 0 0 14,10 Z M 16,3 V 8 H 14.35059 L 12.12451,6.21924 A 0.99846,0.99846 0 0 0 10.793,6.293 L 8.5,8.586 7.207,7.293 a 0.99962,0.99962 0 0 0 -1.41406,0 L 4.08594,9 H 0 V 3 A 3,3 0 0 1 3,0 h 10 a 3,3 0 0 1 3,3 z M 6,4.5 A 1.5,1.5 0 1 0 4.5,6 1.5,1.5 0 0 0 6,4.5 Z" /></svg>';var use_broken_image='<svg class="terminal-broken-image" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 14" xmlns:xlink="http://www.w3.org/1999/xlink"><use xlink:href="#terminal-broken-image"/></svg>';var animation_supported=function(){var e=false,t="Webkit Moz O ms Khtml".split(" "),n=document.createElement("div");if(n.style.animationName){e=true}if(e===false){for(var r=0;r<t.length;r++){var i=t[r]+"AnimationName";if(n.style[i]!==undefined){e=true;break}}}n=null;return e}();var agent=window.navigator.userAgent;var is_IE=/MSIE|Trident/.test(agent)||/rv:11.0/i.test(agent);var is_IEMobile=/IEMobile/.test(agent);var is_ch_unit_supported=function(){if(is_IE&&!is_IEMobile){return false}var e=document.createElement("div");e.style.width="1ch";return e.style.width==="1ch"}();var is_css_variables_supported=window.CSS&&window.CSS.supports&&window.CSS.supports("--fake-var",0);var is_android=navigator.userAgent.toLowerCase().indexOf("android")!==-1;var is_key_native=function e(){if(!("KeyboardEvent"in window&&"key"in window.KeyboardEvent.prototype)){return false}var t=window.KeyboardEvent.prototype;var n=Object.getOwnPropertyDescriptor(t,"key").get;return!!n.toString().match(/\[native code\]/)}();var is_mobile=function(e){var t=false;if(mobile_re.test(e)||tablet_re.test(e.substr(0,4))){t=true}return t}(navigator.userAgent||navigator.vendor||window.opera);var ch_unit_bug=false;$(function(){function e(e){return e[0].getBoundingClientRect().width}var t='<span style="font-family: monospace;visibility:hidden;';var n=$(t+'width:1ch;overflow: hidden"> </span>').appendTo("body");var r=$(t+'"> </span>').appendTo("body");ch_unit_bug=e(n)!==e(r);n.remove();r.remove()});function a11y_hide(e){e.attr({role:"presentation","aria-hidden":"true"})}var excepctions=[];function alert_exception(e,t){if(arguments[0]instanceof $.terminal.Exception){e=arguments[0].type;t=arguments[0]}var n=(e?e+": ":"")+exception_message(t);if(excepctions.indexOf(n)===-1){excepctions.push(n);setTimeout(function(){throw t},0)}}function scrollbar_event(e,t){var n=t.offset().left;return t.outerWidth()<=e.clientX-n}function exception_message(e){if(typeof e==="string"){return e}else if(typeof e.fileName==="string"){return e.fileName+": "+e.message}else{return e.message}}function Cycle(){var r=[].slice.call(arguments);var i=0;$.extend(this,{get:function(){return r},index:function(){return i},rotate:function(e,t){if(t===undefined){t=i}else if(t===i){return}if(!e){var n=r.filter(function(e){return typeof e!=="undefined"});if(!n.length){return}}if(!r.length){return}if(r.length===1){return r[0]}else{if(i===r.length-1){i=0}else{++i}if(typeof r[i]!=="undefined"){return r[i]}else{return this.rotate(true,t)}}},length:function(){return r.length},remove:function(e){delete r[e]},set:function(e){for(var t=r.length;t--;){if(r[t]===e){i=t;return}}this.append(e);i=r.length-1},front:function(){if(r.length){var e=i;var t=false;while(!r[e]){e++;if(e>r.length){if(t){break}e=0;t=true}}return r[e]}},map:function(n){return r.map(function(e,t){if(typeof e!=="undefined"){return n(e,t)}return null}).filter(Boolean)},forEach:function(n){return r.forEach(function(e,t){if(typeof e!=="undefined"){n(e,t)}})},append:function(e){r.push(e)}})}function Stack(e){var t=is_array(e)?e:e?[e]:[];$.extend(this,{data:function(){return t},map:function(e){return $.map(t,e)},size:function(){return t.length},pop:function(){if(t.length===0){return null}else{var e=t[t.length-1];t=t.slice(0,t.length-1);return e}},push:function(e){t=t.concat([e]);return e},top:function(){return t.length>0?t[t.length-1]:null},clone:function(){return new Stack(t.slice(0))}})}function WorkerCache(e){var t=$.extend({validation:$.noop,action:$.noop,onCache:$.noop},e);this._onCache=t.onCache;this._action=t.action;this._validation=t.validation;this._cache=new Map}WorkerCache.prototype.validate=function(){var e=this._validation();var t=e===undefined||e===true;if(!t){this._cache.clear()}return t};WorkerCache.prototype.get=function(e){var t;if(this.validate()&&this._cache.has(e)){t=this._cache.get(e);this._onCache({cahce:t});return t}t=this._action(e);this._cache.set(e,t);return t};function History(e,t,n){var r=true;var i="";if(typeof e==="string"&&e!==""){i=e+"_"}i+="commands";var a;if(n){a=[]}else{a=$.Storage.get(i);a=a?JSON.parse(a):[]}var o=a.length-1;$.extend(this,{append:function(e){if(r){if(a[a.length-1]!==e){a.push(e);if(t&&a.length>t){a=a.slice(-t)}o=a.length-1;if(!n){$.Storage.set(i,JSON.stringify(a))}}}},set:function(e){if(is_array(e)){a=e;if(!n){$.Storage.set(i,JSON.stringify(a))}}},data:function(){return a},reset:function(){o=a.length-1},last:function(){return a[a.length-1]},end:function(){return o===a.length-1},position:function(){return o},current:function(){return a[o]},next:function(){var e=o;if(o<a.length-1){++o}if(e!==o){return a[o]}},previous:function(){var e=o;if(o>0){--o}if(e!==o){return a[o]}},clear:function(){a=[];this.purge()},enabled:function(){return r},enable:function(){r=true},purge:function(){if(!n){$.Storage.remove(i)}},disable:function(){r=false},toggle:function(e){if(typeof e==="undefined"){r=!r}else{r=e}}})}var cmd_index=0;$.cmd={defaults:{mask:false,caseSensitiveSearch:true,historySize:60,prompt:"> ",enabled:true,history:true,onPositionChange:$.noop,onCommandChange:$.noop,inputStyle:"textarea",mobileDelete:is_mobile,onPaste:$.noop,clickTimeout:200,holdTimeout:400,holdRepeatTimeout:200,mobileIngoreAutoSpace:[],repeatTimeoutKeys:[],tabindex:1,tabs:4}};$.fn.cmd=function(e){var x=$.extend({},$.cmd.defaults,e);function o(e){return x.mobileIngoreAutoSpace.length&&x.mobileIngoreAutoSpace.indexOf(e)!==-1&&is_android}var F=this;var t=F.data("cmd");if(t){return t}var u=cmd_index++;F.addClass("cmd");var k=$('<div class="cmd-wrapper"/>').appendTo(F);k.append('<span class="cmd-prompt"></span>');k.append('<div class="cmd-cursor-line">'+"<span></span>"+'<span class="cmd-cursor"><span>'+"<span> </span></span></span>"+"<span></span>"+"</div>");a11y_hide(k.find(".cmd-cursor-line"));var A=$("<textarea>").attr({autocapitalize:"off",spellcheck:"false",tabindex:x.tabindex}).addClass("cmd-clipboard").appendTo(F);if(!is_mobile){A.val(" ")}if(x.width){F.width(x.width)}var T;var m;var s;var S;var R;var c=F.find(".cmd-prompt");var l=false;var f="";var p=null;var n;var B="";var r;var a="";var j=0;var i;var d;var L=0;var h,D;var O=F.find(".cmd-cursor");var v;var I;var g=0;var _="";var P=/\uFFFF$/;function y(e){var t=$(e.target);if(t.is("span,img,a")){t=t.closest("[data-text]");return t.index()+t.parent("span").prevAll().find("[data-text]").length+t.closest('[role="presentation"]').prevUntil(".cmd-prompt").find("[data-text]").length}else if(t.is('div[role="presentation"]')){var n=!t.next().length;return t.find("[data-text]").length+t.prevUntil(".cmd-prompt").find("[data-text]").length-(n?0:1)}}var b={SPACEBAR:" ",UP:"ArrowUP",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight",DEL:"Delete",MULTIPLY:"*",DIVIDE:"/",SUBTRACT:"-",ADD:"+"};function w(e){var t=e.key.toUpperCase();if(b[t]){return b[t]}return t}function C(e){if(e.key){var t=w(e).toUpperCase();if(t==="CONTROL"){return"CTRL"}else{var n=[];if(e.ctrlKey){n.push("CTRL")}if(e.metaKey&&t!=="META"){n.push("META")}if(e.shiftKey&&t!=="SHIFT"){n.push("SHIFT")}if(e.altKey&&t!=="ALT"){n.push("ALT")}if(n.length&&t===" "){t="SPACEBAR"}if(e.key){n.push(t)}return n.join("+")}}}var E={3:"Cancel",6:"Help",8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",28:"Convert",29:"NonConvert",30:"Accept",31:"ModeChange",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",42:"Print",43:"Execute",44:"PrintScreen",45:"Insert",46:"Delete",48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],91:"OS",93:"ContextMenu",144:"NumLock",145:"ScrollLock",181:"VolumeMute",182:"VolumeDown",183:"VolumeUp",186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"'],224:"Meta",225:"AltGraph",246:"Attn",247:"CrSel",248:"ExSel",249:"EraseEof",250:"Play",251:"ZoomOut"};var z;for(z=1;z<25;z++){E[111+z]="F"+z}var N="";for(z=65;z<91;z++){N=String.fromCharCode(z);E[z]=[N.toLowerCase(),N.toUpperCase()]}var H={};Object.keys(E).forEach(function(t){if(is_array(E[t])){E[t].forEach(function(e){H[e.toUpperCase()]=t})}else{H[E[t].toUpperCase()]=t}});var M;var U={"ALT+D":q({clipboard:true}),"HOLD+ALT+D":q({clipboard:true,hold:true}),"HOLD+DELETE":q({clipboard:false,hold:true}),"HOLD+SHIFT+DELETE":q({clipboard:false,hold:true}),ENTER:function(){if(D&&B&&!x.mask&&(is_function(x.historyFilter)&&x.historyFilter(B)||x.historyFilter instanceof RegExp&&B.match(x.historyFilter)||!x.historyFilter)){D.append(B)}var e=B;D.reset();Ne="";je=true;F.set("");var t;if(x.commands){t=x.commands.call(F,e)}if(is_function(i)){if(t&&is_function(t.then)){t.then(xe)}else{xe()}}A.val("");return false},"SHIFT+ENTER":function(){F.insert("\n");return true},BACKSPACE:te,"SHIFT+BACKSPACE":te,TAB:function(){F.insert("\t")},"CTRL+D":function(){F["delete"](1);return false},DELETE:function(){F["delete"](1);return true},"HOLD+ARROWUP":Z,ARROWUP:Z,"CTRL+P":Y,ARROWDOWN:ee,"HOLD+ARROWDOWN":ee,"CTRL+N":G,ARROWLEFT:ne,"HOLD+ARROWLEFT":debounce(ne,10),"CTRL+B":ne,"CTRL+ARROWLEFT":function(){var e=j-1;var t=0;if(B[e]===" "){--e}for(var n=e;n>0;--n){if(B[n]===" "&&B[n+1]!==" "){t=n+1;break}else if(B[n]==="\n"&&B[n+1]!=="\n"){t=n;break}}F.position(t)},"CTRL+R":function(){if(l){me(true)}else{n=i;ce();r=B;F.set("");we();l=true}return false},"CTRL+G":function(){if(l){i=n;xe();F.set(r);we();l=false;f="";return false}},ARROWRIGHT:re,"HOLD+ARROWRIGHT":debounce(re,10),"CTRL+F":re,"CTRL+ARROWRIGHT":function(){if(B[j]===" "){++j}var e=/\S[\n\s]{2,}|[\n\s]+\S?/;var t=B.slice(j).match(e);if(!t||t[0].match(/^\s+$/)){F.position(text(B).length)}else if(t[0][0]!==" "){j+=t.index+1}else{j+=t.index+t[0].length-1;if(t[0][t[0].length-1]!==" "){--j}}we()},F12:K,END:ae(true),"CTRL+END":ae(),"CTRL+E":ae(),HOME:ie(true),"CTRL+HOME":ie(),"CTRL+A":ie(),"SHIFT+INSERT":J,"CTRL+SHIFT+T":K,"CTRL+W":W({clipboard:true,hold:false}),"HOLD+BACKSPACE":W({clipboard:false,hold:true}),"HOLD+SHIFT+BACKSPACE":W({clipboard:false,hold:true}),"CTRL+H":function(){if(B!==""&&j>0){F["delete"](-1)}return false},"CTRL+X":K,"CTRL+C":K,"CTRL+T":K,"CTRL+Y":function(){if(a!==""){F.insert(a)}},"CTRL+V":J,"META+V":J,"CTRL+K":function(){var e=text(B).length;if(e>j){a=F["delete"](e-j);text_to_clipboard(A,a)}return false},"CTRL+U":function(){if(B!==""&&j!==0){a=F["delete"](-j);text_to_clipboard(A,a)}return false},"CTRL+TAB":function(){return false},"META+`":K,"META+R":K,"META+L":K};function q(i){i=i||{};if(i.hold&&!x.mobileDelete){return function e(){F["delete"](1);return false}}return function e(){var t=/ *[^ ]+ *(?= )|[^ ]+$/;var n=B.slice(j);var r=n.match(t);if(r){a=r[0];if(i.clipboard){text_to_clipboard(A,a)}}F.set(B.slice(0,j)+B.slice(j).replace(t,""),true);return false}}function W(n){n=n||{};if(n.hold&&!x.mobileDelete){return function e(){F["delete"](-1)}}return function e(){if(B!==""&&j!==0){var t=B.slice(0,j).match(/([^ ]* *$)/);if(t[0].length){a=F["delete"](-t[0].length);if(n.clipboard){text_to_clipboard(A,a)}}}return false}}function K(){return true}function J(){A.val("");g=0;if(F.isenabled()&&!A.is(":focus")){A.trigger("focus",[true])}A.one("input",Q);return true}function Q(){if(g++>0){return}function n(){A.val(B);se()}function r(e){F.insert(e);n()}if(F.isenabled()){F.oneTime(100,function(){var e=A.val();if(is_function(x.onPaste)){var t=x.onPaste.call(F,{target:F,text:e});if(t!==undefined){if(t&&is_function(t.then||t.done)){(t.then||t.done).call(t,r)}else if(typeof t==="string"){r(t)}else if(t===false){n()}return}}r(e)})}}function Y(){if(ke){r=B;F.set(D.current())}else{F.set(D.previous())}ke=false;return false}function G(){F.set(D.end()?r:D.next());return false}function V(e){return e.match(/\n/)}function X(e,t,n){var r=t.match(e);if(V(t)){return r&&r[1].length<=n}else{return r&&r[1].length<=n-R}}function Z(){var e=B.substring(0,j);var t=/\n?([^\n]+)$/;var n=F.column();if(V(e)){for(var r=e.length-n-1;r--;){if(e[r]==="\n"){break}var i=e.substring(0,r);if(X(t,i,n)){break}}F.position(r);return false}else{return Y()}}function ee(){var e=B.substring(j);var t=F.column();if(V(e)){var n=B.substring(0,j);var r=e.match(/^[^\n]*\n/);if(r){var i=t+r[0].length;if(!V(n)){i+=R}F.position(i,true)}return false}else{return G()}}function te(){if(l){f=f.slice(0,-1);ce()}else if(B!==""&&j>0){F["delete"](-1)}F.oneTime(1,function(){je=true})}function ne(){if(j>0){F.position(-1,true)}}function re(){if(j<bare_text(B).length){F.position(1,true)}return false}function ie(e){function t(){F.position(0)}if(e){return function(){if(B.match(/\n/)){var e=B.substring(0,F.position());F.position(e.lastIndexOf("\n")+1)}else{t()}}}else{return t}}function ae(e){function i(){F.position(text(B).length)}if(e){return function(){if(B.match(/\n/)){var e=B.split("\n");var t=F.position();var n=0;for(var r=0;r<e.length;++r){n+=e[r].length;if(n>t){F.position(n+r);return}}}i()}}else{return i}}function oe(){var e=A.is(":focus");if(d){if(!e){}F.oneTime(10,function(){if(!A.is(":focus")&&d){A.trigger("focus",[true])}})}else if(e&&(is_mobile||!d)){A.trigger("blur",[true])}}function ue(){if(animation_supported){var e=window.getComputedStyle(O[0]);var t=e.getPropertyValue("--animation");t=t.replace(/^\s*|\s*$/g,"");var n=F.attr("class");if(n.match(/-animation/)){n=n.replace(/[a-z]+-animation/g,"")}if(t&&!t.match(/blink/)){var r=t.replace(/terminal-/,"")+"-animation";if(!n.match(r)){n+=" "+r}}n=n.replace(/\s+/g," ");if(n!==F.attr("class").replace(/\s+/g," ")){F.attr("class",n)}}}function se(e){if(!F.isenabled()){return}F.oneTime(10,function(){if(!is_mobile&&A.val()!==B&&!e){A.val(" "+B)}if(d){F.oneTime(10,function(){try{if(!is_mobile&&A.caret()!==j+1){A.caret(j+1)}}catch(e){}})}})}if(animation_supported&&!is_android){v=function(e){if(e){O.addClass("cmd-blink")}else{O.removeClass("cmd-blink")}};I=function(){var e=O.clone();e.insertBefore(O);O.remove();O=e}}else{var le=false;v=function(e){if(e&&!le){le=true;O.addClass("cmd-inverted cmd-blink");F.everyTime(500,"blink",fe)}else if(le&&!e){le=false;F.stopTime("blink",fe);O.removeClass("cmd-inverted cmd-blink")}};I=function(){v(false);v(true)}}function fe(){O.toggleClass("cmd-inverted")}function ce(){i="(reverse-i-search)`"+f+"': ";xe()}function pe(){i=n;l=false;p=null;f=""}function me(e){var t=D.data();var n,r;var i=t.length;if(e&&p>0){i-=p}if(f.length>0){for(var a=f.length;a>0;a--){r=$.terminal.escape_regex(f.slice(0,a));if(x.caseSensitiveSearch){n=new RegExp(r)}else{n=new RegExp(r,"i")}for(var o=i;o--;){if(n.test(t[o])){p=t.length-o;F.position(t[o].indexOf(r));F.set(t[o],true);we();if(f.length!==a){f=f.slice(0,a);ce()}return}}}}f=""}function de(){var e=F.find(".cmd-prompt");var t=e.html();e.html("<span> </span>");var n=e.find("span")[0].getBoundingClientRect().width;e.html(t);return n}function he(e){var t=F.width();return Math.floor(t/e)}function De(e){function t(e){return $.terminal.split_equal(e,T)}function n(e){return e.filter(function(e){return!$.terminal.strip(e).match(/^ $/)})}var r=c.find(".cmd-line");var i;if(r.length){i=r.nextUntil(".cmd-line").text()}else{i=c.text()}i=$.terminal.escape_brackets(i);var a=new RegExp("^"+$.terminal.escape_regex(i));var o;if(e.match(/\n/)){var u=e.split("\n");var s=T-R-1;for(var l=0;l<u.length-1;++l){u[l]+=_}if(strlen(u[0])>s){o=t(i+u[0]);o[0]=o[0].replace(a,"");o=n(o)}else{o=[u[0]]}for(l=1;l<u.length;++l){if(strlen(u[l])>T){var f=t(u[l]);if(l<u.length-1){f=n(f)}o=o.concat(f)}else{o.push(u[l])}}}else{o=t(i+e,T);o[0]=o[0].replace(a,"")}if(o.length>1&&o[o.length-1].length===T){o.push("")}return o}function ve(t,e){try{t=$.terminal.escape_formatting(t);var n=$.extend({},x,{unixFormattingEscapeBrackets:true,position:j});var r=$.terminal.apply_formatters(t,n);var i=r[0];var a=$.terminal.length(i);if(!e){L=r[1];if(L>a){L=a}}i=$.terminal.normalize(i);return i}catch(e){alert_exception("[Formatting]",e.stack);return t}}function ge(e,t){var n=$.terminal.encode(_e(e),{tabs:x.tabs,before:t});e=$.terminal.format(n,{char_width:x.char_width});var r=/(<span[^>]+data-text[^>]+>)(.*?)(<\/span>)/g;return e.replace(r,"$1<span>$2</span>$3")}function _e(e){return $.terminal.partition(e).join("")}function ye(e,t){return $.terminal.length(e,t)}function be(e,t,n){return $.terminal.substring(e,t,n)}var we=function(){var g=O.prev();var _=O.next();var y=O.parent();function b(e,t){var n=e.match(P);if(n){e=e.replace(P," ")}var r=false;var i=$.extend({prompt:"",last:false},t);var a=i.position;var o=ye(e);var u=i.prompt;if(ch_unit_bug){O.width(m)}var s;if(a===o){g.html(ge(e));O.html("<span><span> </span></span>");_.html("")}else if(a===0){g.html("");s=be(e,0,1);O.html(ge(s));_.html(ge(be(e,1),u+s))}else{var l=$.terminal.substring(e,0,a);g.html(ge(l,u));s=be(e,a,a+1);var f=(u+l).replace(/^.*\t/,"");O.html(ge(s,f));if(a===o-1){r=true;_.html("")}else{if(s.match(/\t/)){f=""}else{f+=s}_.html(ge(be(e,a+1),f))}}O.toggleClass("cmd-end-line",r);ue();var c=$.terminal.length(O.text());if(c>1){var p=O.find("[data-text]")[0];p.style.setProperty("--length",c)}I()}function w(e,t){var n=e.match(P);var r='<div role="presentation" aria-hidden="true"';if(n){e=e.replace(P," ");r+=' class="cmd-end-line"'}r+=">"+ge(e,t||"")+"</div>";return r}function C(e){var n=y;$.each(e,function(e,t){n=$(w(t)).insertAfter(n)})}function E(e){$.each(e,function(e,t){y.before(w(t,e===0?S:""))})}return function(){var e;switch(typeof x.mask){case"boolean":e=x.mask?B.replace(/./g,"*"):B;break;case"string":e=B.replace(/./g,x.mask);break}var t=ve(e);var n;if(ye(t)===text(e).length){n=j}else{n=L}var r;k.css("visibility","hidden");k.find("div:not(.cmd-cursor-line)").remove();g.html("");if(strlen(text(t))>T-R-1||t.match(/\n/)){var i=t.match(/\t/g);var a=t;if(i){t=t.replace(/\t/g,"\0\0\0\0")}var o=De(t);if(i){o=$.map(o,function(e){return e.replace(/\x00\x00\x00\x00/g,"\t")})}var u=ye(o[0]);if(u===0&&o.length===1){}else if(n<u){b(o[0],{length:o.length,position:n,prompt:S});C(o.slice(1))}else if(n===u){y.before(w(o[0],S));b(o[1]||"",{length:o.length,position:0,last:o.length<=2});if(o.length>2){C(o.slice(2))}}else{var s=o.slice(-1)[0];var l=ye(a);var f=l-n;var c=ye(s);var p=0;if(f===-1){f=0}if(f<=c){E(o.slice(0,-1));if(c===f){p=0}else{p=c-f}b(s,{length:o.length,position:p,last:true})}else{var m;var d;p=n;for(r=0;r<o.length;++r){var h=$.terminal.length(o[r]);if(p>h){p-=h}else{break}}d=o[r];m=r;if(p===ye(d)){p=0;d=o[++m];if(d===undefined){var D=$.terminal.defaults.strings.redrawError;throw new Error(D)}}b(d,{length:o.length,position:p});E(o.slice(0,m));C(o.slice(m+1))}}F.find(".cmd-cursor-line ~ div:last-of-type").append("<span></span>")}else if(t===""){g.html("");O.html("<span><span> </span></span>");_.html("")}else{b(t,{length:1,position:n})}var v=y.prevUntil(".cmd-prompt").length;if(is_css_variables_supported){F[0].style.setProperty("--cursor-line",v)}else{A.css("top",v*14+"px")}k.css("visibility","")}}();var Ce=function(){function u(e,t){var n=$.extend({},x,{position:t});var r=$.terminal.escape_brackets(B);var i=$.terminal.apply_formatters(r,n)[1];if(i===e){return 0}else if(i<e){return 1}else{return-1}}return function(e,t){if(t===0){return 0}e=bare_text(e);var n=e.length;var r=binary_search(0,n,t,u);var i=$.terminal.split_characters(e);if(n>i.length){var a=0;for(var o=0;o<i.length;++o){a+=i[o].length;if(a>=r){return a}}}return r}}();var Ee;var xe=function(){function t(e){e=$.terminal.apply_formatters(e,{});e=$.terminal.normalize(e);e=crlf(e);s=e;var t=$.terminal.split_equal(e,T);var n={char_width:x.char_width};S=t[t.length-1];var r=$.terminal.encode(t[t.length-1],{tabs:x.tabs});var i=$.terminal.format(r,n);var a=t.slice(0,-1).map(function(e){e=$.terminal.encode(e,{tabs:x.tabs});return'<span class="cmd-line">'+$.terminal.format(e,n)+"</span>"}).concat([i]).join("\n");if(c.html()!==a){c.html(a);R=strlen(text(r))}}return function(){if(Ee&&Ee.set){Ee.set=$.noop;Ee=null}switch(typeof i){case"string":t(i);break;case"function":var n=Ee={set:t};var e=i.call(F,function(e){n.set(e)});if(e&&e.then){e.then(n.set).catch(function(e){var t=$.terminal.escape_brackets("[ERR]> ");n.set("[[;red;]"+t+"]");alert_exception("Prompt",e)})}break}}}();function Fe(){if(is_function(x.onCommandChange)){x.onCommandChange.call(F,B)}}function $e(e){return e.replace(/((?!\\).)\\(?:]|])/g,"$1]")}$.extend(F,{option:function(e,t){if(typeof t==="undefined"){return x[e]}else{x[e]=t}return F},name:function(e){if(e!==undefined){h=e;var t=D&&D.enabled()||!D;D=new History(h,x.historySize,x.history==="memory");if(!t){D.disable()}return F}else{return h}},purge:function(){D.clear();return F},history:function(){return D},delete:function(e,t){var n,r;if(e===0){return""}else if(e<0){if(j>0){n=B.slice(0,j).slice(e);r=bare_text(B);r=r.slice(0,j+e)+r.slice(j,r.length);if(!t){F.position(j+e)}}}else if(B!==""){r=text(B);if(j<r.length){n=r.slice(j).slice(0,e);r=r.slice(0,j)+r.slice(j+e,r.length)}}if(n){B=$e(r)}we();se();Fe();return n},set:function(e,t,n){if(e!==undefined){B=$e(e);if(!t){F.position(bare_text(B).length)}we();se();if(!n){Fe()}}return F},keymap:function(e,t){function n(e,t){var n=U[e];if(is_function(n)){n=n.bind(F)}return function(e){return t.call(F,e,n)}}if(typeof e==="undefined"){return M}else if(typeof e==="string"){if(typeof t==="undefined"){if(M[e]){return M[e]}else if(U[e]){return U[e]}}else{M[e]=n(e,t)}}else{M=$.extend({},M?M:U,$.omap(e||{},n));return F}},insert:function(e,t){var n=bare_text(B);var r=bare_text(e).length;if(j===n.length){e=n+e}else if(j===0){e=e+n}else{e=n.slice(0,j)+e+n.slice(j)}B=$e(e);if(!t){F.position(r,true,true)}se();we();Fe();return F},get:function(){return B},commands:function(e){if(e){x.commands=e;return F}else{return e}},destroy:function(){Ye.unbind("keypress.cmd",Ge);Ye.unbind("keydown.cmd",Je);Ye.unbind("input.cmd",Ze);F.stopTime("blink",fe);F.find(".cmd-wrapper").remove();F.find(".cmd-prompt, .cmd-clipboard").remove();F.removeClass("cmd").removeData("cmd").off(".cmd");return F},column:function(e){var t=B.substring(0,j);if(j===0||!B.length){return 0}var n=/\n?([^\n]*)$/;var r=t.match(n);var i=r[1].length;if(!V(t)&&e){i+=R}return i},prompt:function(e){if(e===true){return s}else if(e===undefined){return i}else{if(typeof e==="string"||typeof e==="function"){i=e}else{throw new Error("prompt must be a function or string")}xe();we();return F}},kill_text:function(){return a},position:function(e,t,n){if(typeof e==="number"){var r=j;var i=bare_text(B).length;if(t){j+=e}else if(e<0){j=0}else if(e>i){j=i}else{j=e}if(r!==j&&!n){we();if(is_function(x.onPositionChange)){x.onPositionChange(j,L)}se(true)}return F}else{return j}},refresh:function(){xe();we();se(true);return F},display_position:function(e,t){if(e===undefined){return L}else{var n=ve($.terminal.escape_formatting(B),true);var r=ye(n);var i=bare_text(B).length;var a;if(t){a=L+e}else if(e>r){a=r}else{a=e}if(text(n).length===ye(B,true)){L=a;return F.position(a)}if(r===a){L=a;return F.position(i)}var o=Ce(B,a);if(o!==-1){L=a;F.position(o)}return F}},visible:function(){var e=F.visible;return function(){e.apply(F,[]);we();xe();return F}}(),show:function(){var e=F.show;return function(){e.apply(F,[]);we();xe();return F}}(),resize:function(e){m=de();var t;if(typeof e==="number"){t=e}else{t=he(m)}if(T!==t||arguments[0]===true){T=t;we();xe()}return F},invoke_key:function(e){var t=e.toUpperCase().split("+");var n=t.pop();var r=t.indexOf("CTRL")!==-1;var i=t.indexOf("SHIFT")!==-1;var a=t.indexOf("ALT")!==-1;var o=t.indexOf("META")!==-1;var u=$.Event("keydown",{ctrlKey:r,shiftKey:i,altKey:a,metaKey:o,which:H[n],key:n});var s=$(document.documentElement||window);s.trigger(u);u=$.Event("keypress");u.key=n;u.which=u.keyCode=0;s.trigger(u);return F},enable:function(e){if(!d){d=true;F.addClass("enabled");try{if(A.is(":not(:focus)")){A.focus()}A.caret(j)}catch(e){}v(true);if(!e&&is_function(i)){xe()}ue();se()}oe();return F},isenabled:function(){return d},disable:function(e){d=false;F.removeClass("enabled");v(false);if(!e){oe()}return F},mask:function(e){if(typeof e==="undefined"){return x.mask}else{x.mask=e;we();return F}}});F.name(x.name||x.prompt||"");if(x.prompt!==false){i=x.prompt;xe()}if(x.enabled===true){F.enable()}m=de();T=he(m);if(!x.history){D.disable()}var ke=true;var Ae=false;var Te=false;var Se=false;var Re=false;var Be=false;var je=true;var Le=false;var Oe=false;var Ie=false;var Pe=false;var ze;var Ne="";var He;function Me(e){return e.key.toUpperCase()==="BACKSPACE"||e.which===8}function Ue(e){return e.key&&e.key.length===1&&!e.ctrlKey}function qe(e){var t=["HOLD+SHIFT+BACKSPACE","HOLD+BACKSPACE"];return t.indexOf(e)!==-1&&x.mobileDelete||x.repeatTimeoutKeys.indexOf(e)!==-1}function We(e){return e.which===35||e.which===36||e.which===37||e.which===38||e.which===39||e.which===40||e.which===13||e.which===27}var Ke=false;function Je(e){debug('keydown "'+e.key+'" '+e.fake+" "+e.which);var t;Oe=(e.key||"").toLowerCase()==="process"||e.which===0;Te=Re&&Se&&!Me(e);try{if(!e.fake){Se=Ue(e);Be=String(e.key).toLowerCase()==="unidentified";Le=Me(e)}}catch(e){}if(e.key==="Unidentified"){je=true;return}if(!e.fake){je=false}Re=true;A.off("input",Q);var n=C(e);if(is_function(x.keydown)){e.key=w(e);t=x.keydown.call(F,e);if(t!==undefined){if(!t){ze=true}return t}}if(n!==He){Qe()}if(d||n==="CTRL+C"&&is_terminal_selected(F)){if(Ie){He=n;n="HOLD+"+n;if(Pe){return}if(x.holdRepeatTimeout>0&&qe(n)){Pe=true;F.oneTime(x.holdRepeatTimeout,"delay",function(){Pe=false})}}else{F.oneTime(x.holdTimeout,"hold",function(){Ie=true});He=n}if(!e.fake&&is_android){if(Ke){Qe();Ke=false;return false}if(o(n)){Ke=true}else if(o(He)){Ke=false}}I();ze=["CTRL+V","META+V"].indexOf(n)!==-1;if(e.which!==38&&!(e.which===80&&e.ctrlKey)){ke=true}if(l&&We(e)){pe();xe();if(e.which===27){F.set("")}we();if(e.which===13){Je.call(this,e)}}else if(is_function(M[n])){t=M[n](e);if(t===true){return}if(t!==undefined){return t}}else if(e.altKey){return}else{Ae=false;return}}}function Qe(){F.stopTime("hold");F.stopTime("delay");Pe=Ie=false}var Ye=$(document.documentElement||window);F.keymap(x.keymap||{});function Ge(e){debug('keypress "'+e.key+'" '+e.fake);Qe();var t;if(!e.fake){Re=false}if((e.ctrlKey||e.metaKey)&&!e.altKey){return}if(Ae){return}if(is_function(x.keypress)){t=x.keypress.call(F,e);if(t!==undefined){if(!t){ze=true}return t}}if(d){if(e.fake){return}var n;if(is_key_native){n=e.key;var r=n.toUpperCase();if(b[r]){n=b[r]}}if(!n||Be){n=String.fromCharCode(e.which)}if($.inArray(e.which,[13,0,8])>-1){if(e.keyCode===123){return}return false}else if(n&&(!e.ctrlKey||e.ctrlKey&&e.ctrlKey)&&(!(e.altKey&&e.which===100)||e.altKey)&&!Te){if(l){f+=n;me();ce()}else if(n.length===1){F.insert(n)}}}}function Ve(e,t,n){var r=$.Event(e);r.which=n;r.key=t;r.fake=true;Ye.trigger(r)}var Xe=false;function Ze(){debug("input "+je+" || "+Oe+" (("+Re+" || "+Te+") && !"+ze+" && ("+Se+" || "+Be+") && !"+Le+")");var e=A.val();if(!is_mobile){e=e.replace(/^ /,"")}if((je||Oe||(Re||Te)&&!ze&&(Se||Be)&&!Le)&&e!==B){var t=j;if(je){var n=Ne;Le=n.slice(0,n.length-1).length===e.length}if(Xe){Xe=false;A.val(B);return}if(l){f=e;me();ce()}else{var r=e.slice(j);if(r.length===1||Le){var i=get_next_character(r);if(o(i)){Xe=true}if(je){var a;if(Le){a=8}else{a=r.toUpperCase().charCodeAt(0)}Ve("keydown",Le?"Backspace":r,a)}if(Re&&!Le){Ve("keypress",i,r.charCodeAt(0))}}if(Le){Ne=B;return}if(ze){ze=false;return}F.set(e)}if(Le){F.position(t-1)}else{F.position(t+Math.abs(e.length-Ne.length))}}Ne=B;ze=false;je=true}Ye.bind("keypress.cmd",Ge);Ye.bind("keydown.cmd",Je);Ye.bind("keyup.cmd",Qe);Ye.bind("input.cmd",Ze);(function(){var a=false;var o=0;F.on("mousedown.cmd",function(){a=true}).on("mouseup.cmd",function(t){function e(){var e=$(t.target);if(!e.is(".cmd-prompt")&&i){if(d){if(e.is(".cmd")){F.position(text(B).length)}else{F.display_position(y(t))}}}o=0}var n;if(t.originalEvent===undefined){n=t.button}else{n=t.originalEvent.button}if(n===0&&get_selected_html()===""){var r="click_"+u;if(++o===1){var i=a;if(d){if(x.clickTimeout===0){e()}else{F.oneTime(x.clickTimeout,r,e)}}else{o=0}}else{F.stopTime(r);o=0}}a=false})})();F.data("cmd",F);if(!("KeyboardEvent"in window&&"key"in window.KeyboardEvent.prototype)){setTimeout(function(){throw new Error("key event property not supported try https://github."+"com/inexorabletash/polyfill/blob/master/keyboard.js")},0)}return F};var strlen=function(){if(typeof wcwidth==="undefined"){return function(e){return $.terminal.length(e)}}else{return wcwidth}}();function bare_text(e){if(!e.match(/&/)){return e}return $("<span>"+safe(e)+"</span>").text()}function text(e){return bare_text($.terminal.strip(e))}function safe(e){if(!e.match(/[<>&]/)){return e}return e.replace(/&(?![^;]+;)/g,"&").replace(/>/g,">").replace(/</g,"<")}function crlf(e){return e.replace(/\r/g,"")}function char_len(e){return entity_re.test(e)?1:e.length}function get_next_character(e){var t=e.match(entity_re);if(t){return t[1]}var n=e.match(emoji_re);if(n){return n[1]}else if(e.slice(0,2).replace(astral_symbols_re,"_")===1){if(e.slice(1).match(combine_chr_re)){return e.slice(0,3)}return e.slice(0,2)}else{var r=e.match(combine_chr_re);if(r){return r[1]}return e[0]}}function normalize_position(e,r){if(r===0){return r}e=$.terminal.strip(e);var t=$.terminal.split_characters(e).reduce(function(e,t){if(typeof e==="number"){return e}var n=e.length+char_len(t);if(n>=r){return e.position+1}return{position:e.position+1,length:n}},{position:0,length:0});if(typeof t==="number"){return t}else{return t.position}}function char_width_prop(e,t){if(is_ch_unit_supported){return"width: "+e+"ch"}else if(!is_css_variables_supported){if(t.char_width){return"width: "+t.char_width*e+"px"}}else{return"--length: "+e}return""}function extra_css(e,t){if(typeof wcwidth!=="undefined"){var n=bare_text(e);var r=strlen(n);if(r!==$.terminal.length(n)){return char_width_prop(r,t)}}return""}function wide_characters(e,n){if(typeof wcwidth!=="undefined"){var t=bare_text(e);var r=$.terminal.split_characters(t);if(r.length===1){return e}var i=r.map(function(e){return{len:strlen(e),chr:e}}).reduce(function(e,t){var n=e[e.length-1];if(n){if(n.len!==t.len){return e.concat([{sum:t.len,len:t.len,specs:[t]}])}else{e.pop();return e.concat([{sum:n.sum+t.len,len:n.len,specs:n.specs.concat(t)}])}}return[{sum:t.len,specs:[t],len:t.len}]},[]);return i.map(function(e){if(e.len===1){return e.str.join("")}var t=char_width_prop(e.sum,n);if(e.sum===r.length||!t.length){return"<span>"+a(e)+"</span>"}else if(e.specs.length>1){return o(t,e.specs.map(function(e){return o(char_width_prop(e.len),e.chr)}).join(""))}else{return o(t,a(e))}}).join("")}function a(e){return e.specs.map(function(e){return e.chr}).join("")}function o(e,t){return'<span style="'+e+'">'+t+"</span>"}return e}function binary_search(e,t,n,r){var i=t-e;var a=e+Math.floor(i/2);var o=r(n,a);if(o===0){return a}else if(o>0&&i>1){return binary_search(a,t,n,r)}else if(o<0&&i>1){return binary_search(e,a,n,r)}else{return-1}}function is_terminal_selected(e){if(is_function(window.getSelection)){var t=window.getSelection();if(t.toString()){var n=t.getRangeAt(0).startContainer.parentNode;var r=$(n).closest(".terminal");return r.length&&(e&&r.find(".cmd").is(e)||!e)}}}function get_selected_html(){var e="";if(is_function(window.getSelection)){var t=window.getSelection();if(t.rangeCount){var n=document.createElement("div");for(var r=0,i=t.rangeCount;r<i;++r){n.appendChild(t.getRangeAt(r).cloneContents())}e=n.innerHTML}}return e}function with_selection(e){var t="";var n=[];if(is_function(window.getSelection)){var r=window.getSelection();if(r.rangeCount){var i=document.createElement("div");for(var a=0,o=r.rangeCount;a<o;++a){var u=r.getRangeAt(a).cloneRange();n.push(u);i.appendChild(u.cloneContents())}t=i.innerHTML}}e(t);if(n.length){r.removeAllRanges();n.forEach(function(e){r.addRange(e)})}return t!==""}function process_selected_line(){var e=$(this);var t=e.text();if(e.hasClass("cmd-end-line")){t+="\n"}return t}function process_div(e){return $(e).find("> div, > span").map(process_selected_line).get().join("\n").replace(/\n$/,"")}function process_selected_html(e){var t;var n="";var r=$("<div>"+e+"</div>");if(e.match(/<\/div>/)){t=r.find("div[data-index]").map(function(){return process_div(this)}).get().join("\n");if(!t&&e.match(/style="width: 100%;?"/)){t=process_div(r)}n=t}var i=r.find(".cmd-prompt");if(i.length){if(n.length){n+="\n"}n+=i.text()}var a=r.find('[role="presentation"]');if(a.length){n+=a.map(process_selected_line).get().join("")}if(!n.length&&e){n=r.text()}return n.replace(/\xA0/g," ")}var text_to_clipboard;if(is_function(document.queryCommandSupported)&&document.queryCommandSupported("copy")){text_to_clipboard=function e(t,n){var r=t.val();var i=t.is(":focus");var a=t.caret();t.val(n).focus();t[0].select();document.execCommand("copy");t.val(r);if(i){t.caret(a)}return true}}else{text_to_clipboard=$.noop}var get_textarea_selection=function(){var e=document.createElement("textarea");var t="selectionStart"in e;e=null;if(t){return function(e){var t=e.selectionEnd-e.selectionStart;return e.value.substr(e.selectionStart,t)}}else if(document.selection){return function(){var e=document.selection.createRange();return e.text()}}else{return function(){return""}}}();function clear_textarea_selection(e){e.selectionStart=e.selectionEnd=0}function common_string(e,t,n){if(!t.length){return""}var r=string_case(e);var i=[];for(var a=e.length;a<t[0].length;++a){var o=false;var u=t[0].charAt(a),s=u.toLowerCase();for(var l=1;l<t.length;++l){o=true;var f=t[l].charAt(a),c=f.toLowerCase();if(u!==f){if(n||r==="mixed"){o=false;break}else if(s===c){if(r==="lower"){u=u.toLowerCase()}else if(r==="upper"){u=u.toUpperCase()}else{o=false;break}}else{o=false;break}}}if(o){i.push(u)}else{break}}return e+i.join("")}function trigger_terminal_change(t){terminals.forEach(function(e){e.settings().onTerminalChange.call(e,t)})}var select=function(){if(window.getSelection){var e=window.getSelection();if(e.setBaseAndExtent){return function(e,t){var n=window.getSelection();n.setBaseAndExtent(e,0,t,1)}}else{return function(e,t){var n=window.getSelection();var r=document.createRange();r.setStart(e,0);r.setEnd(t,t.childNodes.length);n.removeAllRanges();n.addRange(r)}}}else{return $.noop}}();function process_command(e,t){var n=e.match(command_re)||[];if(n.length){var r=n.shift();var i=$.map(n,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=$.map(n,function(e){var t=e.match(/^(['"]).*\1$/);return t&&t[1]||""});var o=e.slice(r.length).trim();return{command:e,name:r,args:i,args_quotes:a,rest:o}}else{return{command:e,name:"",args:[],args_quotes:a,rest:""}}}$.terminal={version:"DEV",date:"Wed, 18 Dec 2019 12:22:00 +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","rebeccapurple"],Cycle:Cycle,History:History,Stack:Stack,valid_color:function e(t){if(t.match(color_hex_re)){return true}else{return $.inArray(t.toLowerCase(),$.terminal.color_names)!==-1}},unclosed_strings:function e(t){return!!t.match(unclosed_strings_re)},escape_regex:function e(t){if(typeof t==="string"){var n=/([-\\^$[\]()+{}?*.|])/g;return t.replace(n,"\\$1")}},have_formatting:function e(t){return typeof t==="string"&&!!t.match(format_exist_re)},is_formatting:function e(t){return typeof t==="string"&&!!t.match(format_full_re)},format_split:function e(t){return t.split(format_split_re).filter(Boolean)},tracking_replace:function e(t,n,r,i){if(!(n instanceof RegExp)){throw new Error("tracking_replace: Second argument need to be RegExp")}function a(e,t,n){return e.slice(t,n)}function o(e){return $.terminal.strip(e).length}var u="";var s;var l=0;var f;var c=i;var p;n.lastIndex=0;while(s=n.exec(t)){if(n.global){var m=o(a(t,0,n.lastIndex));p=m-o(s[0])}else{p=s.index;m=p+o(s[0])}if(l<p){u+=a(t,l,p)}l=m;if(typeof r==="function"){f=r.apply(null,s)}else{f=r.replace(/\$(\$|\d)/g,function(e,t){if(t==="$"){return"$"}return s[t]})}u+=f;if(p<i){if(m<i){c=Math.max(0,c+o(f)-o(s[0]))}else{c+=o(f)-(i-p)}}if(!n.global){break}}if(l<o(t)){u+=a(t,l)}if(t===u){return[t,i]}return[u,c]},iterate_formatting:function e(t,n){function r(e){return t.slice(e-6,e)===" "||t.slice(e-1,e).match(/\s/)}function i(e){return t.slice(e).match(entity_re)}function a(e){return t[e]==="["&&t[e+1]==="["}function o(e){return t[e-1]!=="\\"&&t[e]==="\\"&&t[e+1]==="]"}function u(e){return C&&(t[e]!=="]"||!f)&&!E}function s(){var e=get_next_character(w);if($.terminal.length(w)>1){if(e.length>1){return e.length-1}}return 0}function l(){return r(b)&&(C||E)&&(h===-1&&v!==b||h!==-1)}var f=$.terminal.have_formatting(t);var c="";var p=false;var m=0;var d;var h=-1;var D=-1;var v;var g=0;var _=0;var y=/(&[^;]+);$/;for(var b=0;b<t.length;b++){var w=t.slice(b);d=w.match(format_start_re);if(d){c=d[1];p=false}else if(c){if(t[b]==="]"){if(p){c="";p=false}else{p=true}}}else{p=true}var C=c&&p||!c;var E=a(b);if(l()){h=b;D=m}var x=t[b].match(/[[\]]/);_=0;if(C){if(t[b]==="&"){d=i(b);if(d){b+=d[1].length-2;continue}++m;++g}else if(o(b)){++m;++g;_=1;b+=1}else if(!x||!f){++m;++g}}if(u(b)){if(strlen(t[b])===2){g++}var F=get_next_character(w);var k=F.length;if(F===";"){d=t.slice(0,b+1).match(y);if(d){_=d[1].length;k=_+1}}var A=w.match(/^.]$/)||b===t.length-1;var T={last:A,count:m,index:b-_,formatting:c,length:g,text:p,size:k,space:h,space_count:D};var S=n(T);if(S===false){break}else if(S){if(S.count!==undefined){m=S.count}if(S.length!==undefined){g=S.length}if(S.space!==undefined){v=h;h=S.space}if(S.index!==undefined){b=S.index;continue}}}else if(b===t.length-1){n({count:m+1,index:b,formatting:c,length:0,text:p,space:h})}if(p){b+=s()}}},partition:function e(n){if(!$.terminal.have_formatting(n)){var t=$.terminal.split_characters(n);return t.map(i)}var r=[];function i(e){if(e.match(/\\$/)){e+="\\"}return"[[;;]"+e+"]"}function a(e){if($.terminal.is_formatting(e)){if(e.match(/\\]$/)){e=e.replace(/\\]/g,"\\\\]")}}else{e=i(e)}return e}$.terminal.iterate_formatting(n,function(e){if(e.text){var t=[];if(e.formatting){t.push(e.formatting)}t.push(n.substring(e.index,e.index+e.size));if(e.formatting){t.push("]")}r.push(a(t.join("")))}});return r},substring:function e(t,n,r){var i=$.terminal.split_characters(t);if(!i.slice(n,r).length){return""}if(!$.terminal.have_formatting(t)){return i.slice(n,r).join("")}var a=0;var o;var u="";var s="";var l;var f=1;$.terminal.iterate_formatting(t,function(e){if(n&&e.count===n+1){a=e.index;if(e.formatting){u=e.formatting}}if(r&&e.count===r){s=e.formatting;l=e.index;f=e.size}if(e.count===r+1){o=e.index;if(e.formatting){o=l+f}}});if(n&&!a){return""}if(o===undefined){o=t.length}t=u+t.slice(a,o);if(s){t=t.replace(/(\[\[^\]]+)?\]$/,"");t+="]"}return t},normalize:function e(t){t=t.replace(format_re,function(e,t,n){if(t.match(self_closing_re)&&n===""){return"[["+t+"] ]"}if(n===""){return""}function r(e){return e.replace(/\\\]/g,"]").replace(/\n/g,"\\n").replace(/ /g," ")}t=r(t);var i=t.match(/;/g).length;if(i>=4){var a=t.split(/;/);var o=a.slice(0,4).join(";");var u=a.slice(4).join(";");return"[["+o+";"+(u||n)+"]"+n+"]"}else if(i===2){i=";;"}else if(i===3){i=";"}return"[["+t+i+r(n)+"]"+n+"]"});return $.terminal.amp(t)},split_equal:function e(t,f,c){var p="";var m=[];var n=$.terminal.normalize(t).split(/\n/g);for(var r=0,i=n.length;r<i;++r){if(n[r]===""){m.push("");continue}var d=n[r];var h=0;var D;var v=d.length;var g=!!d.match(/\[\[[^\]]+\](?:[^\][]|\\\])+\]$/);$.terminal.iterate_formatting(d,function(e){var t,n;if(e.length>=f||e.last||e.length===f-1&&strlen(d[e.index+1])===2){var r=false;if(c&&e.space!==-1){var i=text(d).substring(e.space_count);i=i.slice(0,f).trim();var a=strlen(i);if(i.match(/\s/)||a<f){r=true}}var o;if(c&&e.space!==-1&&e.index!==v-1&&r){D=d.slice(h,e.space);o=e.space-1}else{n=d.slice(e.index);t=get_next_character(n);D=d.slice(h,e.index)+t;if(e.last&&g&&t!=="]"){D+="]"}o=e.index+t.length-1}if(c){D=D.replace(/^( |\s)+|( |\s)+$/g,"")}h=(o||e.index)+1;if(p){var u=D.match(/^[^\]]*\]/);D=p+D;if(u){p=""}}var s=D.match(format_re);if(s){var l=s[s.length-1];if(l[l.length-1]!=="]"){p=l.match(format_begin_re)[1];D+="]"}else if(D.match(format_end_re)){D=D.replace(format_end_re,"");p=l.match(format_begin_re)[1]}}m.push(D);return{index:o,length:0,space:-1}}})}return m},amp:function e(t){return t.replace(/&(?!#[0-9]+;|#x[0-9a-f]+;|[a-z]+;)/gi,"&")},encode:function e(t,n){var s=$.extend({tabs:4,before:""},n);return $.terminal.amp(t).replace(/</g,"<").replace(/>/g,">").replace(/ /g," ").split("\n").map(function(e){var u=e.split(/((?:\[\[[^\]]+\])?\t(?:\])?)/);u=u.filter(Boolean);return u.map(function(e,o){if(e.match(/\t/)){return e.replace(/\t([^\t]*)$/,function(e,t){if(o!==0&&u[o-1].match(/\t\]?$/)){var n=new Array(s.tabs+1).join(" ");return n+t}else{var r=u.slice(o-1,o).join("");if(s.before&&o<=1){r=s.before+r}var i=$.terminal.length(r);var a=s.tabs-i%s.tabs;if(a===0){a=4}return new Array(a+1).join(" ")+t}})}return e}).join("")}).join("\n")},nested_formatting:function e(t){if(!$.terminal.have_formatting(t)){return t}var a=[];var n=/((?:\[\[(?:[^\][]|\\\])+\])?(?:[^\][]|\\\])*\]?)/;var o=/\[\[([^\][]+)\][\s\S]*/;var u=/^\[\[([^;]*);([^;]*);([^\]]*)\]/;function s(e){var t=[[],"",""];if(!e.length){return t}for(var n=e.length;n--;){var r=e[n].split(";");var i=r[0].split(/(-?[@!gbiuso])/g).filter(Boolean);i.forEach(function(e){if(t[0].indexOf(e)===-1){t[0].push(e)}});for(var a=1;a<t.length;++a){var o=r[a].trim();if(o&&!t[a]){t[a]=o}}}var u=t[0].filter(function(e){return e[0]==="-"}).map(function(e){return e[1]});t[0]=t[0].filter(function(e){return u.indexOf(e)===-1&&u.indexOf(e[1])===-1}).join("");return t.join(";")}return t.split(n).filter(Boolean).map(function(e){var t;if(e.match(/^\[\[/)){var n=e.replace(o,"$1");var r=$.terminal.is_formatting(e);e=e.replace(u,"");a.push(n);if($.terminal.nested_formatting.__inherit__){t=s(a)}else{t=n}if(!r){e+="]"}else{a.pop()}e="[["+t+"]"+e}else{var i=false;if(e.match(/\]/)){i=true}if(a.length){if($.terminal.nested_formatting.__inherit__){t=s(a)}else{t=a[a.length-1]}e="[["+t+"]"+e}if(i){a.pop()}else if(a.length){e+="]"}}return e}).join("")},escape_formatting:function e(t){return $.terminal.escape_brackets(t)},apply_formatters:function e(t,i){if(t===""){if(typeof i.position==="number"){return["",i.position]}else{return""}}function a(e,t,n,r){if(!e.__no_warn__&&$.terminal.length(n)!==$.terminal.length(r)){warn("Your formatter["+t+"] change length of the string, "+"you should use [regex, replacement] formatter or function "+" that return [replacement, position] instead")}}var n=$.terminal.defaults.formatters;i=i||{};var f=0;function c(e,t){var n=$.extend({},i,{position:t[1]});var r=e(t[0],n);if(typeof r==="string"){a(e,f-1,r,t[0]);if(typeof r==="string"){return[r,n.position]}return t}else if(is_array(r)&&r.length===2){return r}else{return t}}var r;if(typeof i.position==="number"){r=[t,i.position]}else{r=[t,0]}try{var o=n.reduce(function(o,u){f++;if(typeof u==="function"&&u.__meta__){return c(u,o)}else{var s=0;var l=false;var e=$.terminal.format_split(o[0]);var t=e.map(function(e){var t;var n=text(e).length;if(o[1]<=s+n&&!l){t=o[1]-s;l=true}else{t=-1}var r=s;var i;s+=n;if($.terminal.is_formatting(e)){return[e,-1]}else{if(is_array(u)){var a=u[2]||{};i=[e,t<0?0:t];if(i[0].match(u[0])){if(a.loop){while(i[0].match(u[0])){i=$.terminal.tracking_replace(i[0],u[0],u[1],i[1])}}else{i=$.terminal.tracking_replace(i[0],u[0],u[1],i[1])}}if(t<0){return[i[0],-1]}}else if(typeof u==="function"){i=c(u,[e,t])}if(typeof i!=="undefined"){if(i[1]!==-1){i[1]+=r}return i}return[e,-1]}});var n=t.filter(function(e){return e[1]!==-1})[0];var r=t.map(function(e){return e[0]}).join("");var i;if(typeof n==="undefined"){i=o[1]}else{i=n[1]}var a=text(r).length;if(i>a){i=a}if(r===o[0]){return o}return[r,i]}},r);if(typeof i.position==="number"){var u=$.terminal.strip(o[0]).length;if($.terminal.length(o[0])<u){var s=o[1];s=normalize_position(o[0],s);var l=$.terminal.length(o[0]);if(s>l){s=l}o[1]=s}return o}else{return o[0]}}catch(e){var p="Error in formatter ["+(f-1)+"]";n.splice(f-1);throw new $.terminal.Exception("formatting",p,e.stack)}},format:function n(e,h){var D=$.extend({},{linksNoReferrer:false,linksNoFollow:false,allowedAttributes:[],char_width:undefined,escape:true,anyLinks:false},h||{});function t(e){if(e.length&&D.allowedAttributes.length){return e.filter(function(e){if(e==="data-text"){return false}var t=false;var n=D.allowedAttributes;for(var r=0;r<n.length;++r){if(n[r]instanceof RegExp){if(n[r].test(e)){t=true;break}}else if(n[r]===e){t=true;break}}return t})}return[]}function v(e,t){if(e===""){return t}else{return e.replace(/]/g,"]").replace(/>/g,">").replace(/</g,"<")}}function g(n){if(n){var e=t(Object.keys(n));if(e.length){return" "+e.map(function(e){var t=n[e].replace(/"/g,""");return e+'="'+t+'"'}).join(" ")}}return""}function _(){var e=["noopener"];if(D.linksNoReferrer){e.unshift("noreferrer")}if(D.linksNoFollow){e.unshift("nofollow")}return e}function r(e){return e.match(/^\.{1,2}\//)||e.match(/^\//)||!(e.match(/\//)||e.match(/^[^:]+:/))}function i(n){return function(e){if(D.anyLinks){return true}var t=n(e);if(!t){warn("Invalid URL "+e+" only https ftp and Path "+"are allowed")}return t}}var y=i(function(e){return e.match(/^((https?|ftp):\/\/|\.{0,2}\/)/)||r(e)});var b=i(function(e){return e.match(/^(https?:|blob:|data:)/)||r(e)});function n(e,t,n,r,i,a,o){var u;if(a.match(/;/)){try{var s=a.split(";");var l=s.slice(1).join(";");if(l.match(/^\s*\{[^}]*\}\s*$/)){u=JSON.parse(l);a=s[0]}}catch(e){}}if(o===""&&!t.match(/@/)){return""}o=safe(o);o=o.replace(/\\\]/g,"]");if(D.escape){o=o.replace(/\\\\/g,"\\")}var f="";if(t.indexOf("b")!==-1){f+="font-weight:bold;"}var c=[];if(t.indexOf("u")!==-1){c.push("underline")}if(t.indexOf("s")!==-1){c.push("line-through")}if(t.indexOf("o")!==-1){c.push("overline")}if(c.length){f+="text-decoration:"+c.join(" ")+";"}if(t.indexOf("i")!==-1){f+="font-style:italic;"}if($.terminal.valid_color(n)){f+="color:"+n+";"+"--color:"+n+";";if(t.indexOf("!")!==-1){f+="--link-color:"+n+";"}if(t.indexOf("g")!==-1){f+="text-shadow:0 0 5px "+n+";"}}if($.terminal.valid_color(r)){f+="background-color:"+r+";"}var p=v(a,o);var m=extra_css(o,h);if(m){o=wide_characters(o,h);f+=m}var d;if(t.indexOf("!")!==-1){if(p.match(email_re)){d='<a href="mailto:'+p+'"'}else{if(!y(p)){p=""}d='<a target="_blank"';if(p){d+=' href="'+p+'"'}d+=' rel="'+_().join(" ")+'"'}d+=' tabindex="1000"'}else if(t.indexOf("@")!==-1){d="<img";if(b(p)){d+=' src="'+p+'"'}}else{d="<span"}d+=g(u);if(f!==""){d+=' style="'+f+'"'}if(i!==""){d+=' class="'+i+'"'}if(t.indexOf("!")!==-1){d+=" data-text>"+o+"</a>"}else if(t.indexOf("@")!==-1){d+=" data-text/>"}else{d+=' data-text="'+p.replace(/"/g,""")+'">'+o+"</span>"}return d}if(typeof e==="string"){var a=$.terminal.format_split(e);e=$.map(a,function(e){if(e===""){return e}else if($.terminal.is_formatting(e)){e=e.replace(/\[\[[^\]]+\]/,function(e){return e.replace(/ /g," ")});return e.replace(format_parts_re,n)}else{e=safe(e);e=e.replace(/\\\]/,"]");var t=extra_css(e,h);if(t.length){e=wide_characters(e,h);return'<span style="'+t+'">'+e+"</span>"}else{return"<span>"+e+"</span>"}}}).join("");return e.replace(/<span><br\s*\/?><\/span>/gi,"<br/>")}else{return""}},escape_brackets:function e(t){return t.replace(/\[/g,"[").replace(/\]/g,"]")},unescape_brackets:function e(t){return t.replace(/[/g,"[").replace(/]/g,"]")},length:function(e,t){return $.terminal.split_characters(t?e:text(e)).length},split_characters:function e(t){var n=[];while(t.length){var r=get_next_character(t);t=t.slice(r.length);n.push(r)}return n},columns:function(e,t,n){var r=e.map(function(e){return $.terminal.strip(e)});var i=r.map(function(e){return strlen(e)});if(typeof n==="undefined"){n=4}var a=Math.max.apply(null,i)+n;var o=Math.floor(t/a)-1;if(o<1){return e.join("\n")}var u=[];for(var s=0,l=e.length;s<l;s+=o){var f=e.slice(s,s+o);var c=f.pop();u.push(f.reduce(function(e,t){var n=$.terminal.strip(t);var r=new Array(a-n.length+1).join(" ");e.push(t+r);return e},[]).join("")+c)}return u.join("\n")},strip:function e(t){t=t.replace(format_parts_re,"$6");return t.replace(/\\([[\]])/g,function(e,t){return t})},active:function e(){return terminals.front()},last_id:function e(){var t=terminals.length();return t-1},parse_argument:function e(t,n){function r(e){return e.split(string_re).map(function(e){if(e.match(/^['"]/)){if(e==='""'||e==="''"){return""}var t=e[0];var n=new RegExp("(^|(?:\\\\(?:\\\\)*)?)"+t,"g");e=e.replace(n,"$1")}e='"'+e+'"';return JSON.parse(e)}).join("")}if(n===false){if(t[0]==="'"&&t[t.length-1]==="'"){return t.replace(/^'|'$/g,"")}else if(t[0]==='"'&&t[t.length-1]==='"'){return t.replace(/^"|"$/g,"").replace(/\\([" ])/g,"$1")}else if(t.match(/\/.*\/[gimy]*$/)){return t}else if(t.match(/['"]]/)){return r(t)}else{return t.replace(/\\ /g," ")}}var i=t.match(re_re);if(i){return new RegExp(i[1],i[2])}else if(t.match(/['"]/)){return r(t)}else if(t.match(/^-?[0-9]+$/)){return parseInt(t,10)}else if(t.match(float_re)){return parseFloat(t)}else{return t.replace(/\\(['"() ])/g,"$1")}},parse_arguments:function e(t){return $.map(t.match(command_re)||[],$.terminal.parse_argument)},split_arguments:function e(t){return $.map(t.match(command_re)||[],function(e){return $.terminal.parse_argument(e,false)})},parse_command:function e(t){return process_command(t,$.terminal.parse_argument)},split_command:function e(t){return process_command(t,function(e){return $.terminal.parse_argument(e,false)})},parse_options:function e(t,n){var a=$.extend({},{boolean:[]},n);if(typeof t==="string"){return e($.terminal.split_arguments(t),n)}var o={_:[]};function u(e){this.value=e}var r=t.reduce(function(e,t){if(typeof t!=="string"){t=String(t)}if(t.match(/^-/)&&e instanceof u){o[e.value]=true}if(t.match(/^--/)){var n=t.replace(/^--/,"");if(a.boolean.indexOf(n)===-1){return new u(n)}else{o[n]=true}}else if(t.match(/^-/)){var r=t.replace(/^-/,"").split("");if(a.boolean.indexOf(r.slice(-1)[0])===-1){var i=r.pop()}r.forEach(function(e){o[e]=true});if(i){return new u(i)}}else if(e instanceof u){o[e.value]=t}else if(t){o._.push(t)}return null},null);if(r instanceof u){o[r.value]=true}return o},extended_command:function extended_command(term,string,options){var settings=$.extend({invokeMethods:false},options);try{change_hash=false;var m=string.match(extended_command_re);if(m){if(!settings.invokeMethods){warn("To invoke terminal or cmd methods you need to enable "+"invokeMethods option");return}string=m[1];var obj=m[2]==="terminal"?term:term.cmd();var fn=m[3];try{var args=eval("["+m[4]+"]");if(!obj[fn]){term.error("Unknow function "+fn)}else{obj[fn].apply(term,args)}}catch(e){term.error("Invalid invocation in "+$.terminal.escape_brackets(string))}}else{term.exec(string,true).done(function(){change_hash=true})}}catch(e){}},iterator:function(t){function n(e){if($.terminal.is_formatting(e)){if(e.match(/\]\\\]/)){e=e.replace(/\]\\\]/g,"]\\\\]")}}return e}if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){var r=$.terminal.length(t);var i=0;var e={};e[Symbol.iterator]=function(){return{next:function(){if(i<r){var e=$.terminal.substring(t,i,i+1);i++;return{value:n(e)}}else{return{done:true}}}}};return e}},formatter:new function(){try{this[Symbol.split]=function(e){return $.terminal.format_split(e)};this[Symbol.match]=function(e){return e.match(format_re)};this[Symbol.replace]=function(e,t){return e.replace(format_parts_re,t)};this[Symbol.search]=function(e){return e.search(format_re)}}catch(e){}},new_formatter:function(e){var t=$.terminal.defaults.formatters;for(var n=0;n<t.length;++n){if(t[n]===$.terminal.nested_formatting){t.splice(n,0,e);return}}t.push(e)}};$.terminal.Exception=function e(t,n,r){if(arguments.length===1){this.message=arguments[0];this.type="TERMINAL"}else{this.type=t;this.message=n;if(r){this.stack=r}}};$.terminal.Exception.prototype=new Error;$.terminal.Exception.prototype.toString=function(){return this.message+"\n"+this.stack};$.fn.visible=function(){return this.css("visibility","visible")};$.fn.hidden=function(){return this.css("visibility","hidden")};var warnings=[];function warn(e){e="[jQuery Terminal] "+e;if(warnings.indexOf(e)===-1){warnings.push(e);if(console){if(console.warn){console.warn(e)}else if(console.log){console.log(e)}}else{setTimeout(function(){throw new Error("WARN: "+e)},0)}}}var ids={};$.jrpc=function(e,t,n,r,i){var o=new $.Deferred;var u;if($.isPlainObject(e)){u=e}else{u={url:e,method:t,params:n,success:r,error:i}}function s(e){return $.isNumeric(e.id)&&(typeof e.result!=="undefined"||typeof e.error!=="undefined")}ids[u.url]=ids[u.url]||0;var a={jsonrpc:"2.0",method:u.method,params:u.params,id:++ids[u.url]};$.ajax({url:u.url,beforeSend:function e(t,n){if(is_function(u.request)){u.request(t,a)}n.data=JSON.stringify(a)},success:function e(t,n,r){var i=r.getResponseHeader("Content-Type");if(!i.match(/(application|text)\/json/)){warn("Response Content-Type is neither application/json"+" nor text/json")}var a;try{a=JSON.parse(t)}catch(e){if(u.error){u.error(r,"Invalid JSON",e)}else{throw new $.terminal.Exception("JSON","Invalid JSON",e.stack)}o.reject({message:"Invalid JSON",response:t});return}if(is_function(u.response)){u.response(r,a)}if(s(a)||u.method==="system.describe"){if(u.success){u.success(a,n,r)}o.resolve(a)}else{if(u.error){u.error(r,"Invalid JSON-RPC")}o.reject({message:"Invalid JSON-RPC",response:t})}},error:u.error,contentType:"application/json",dataType:"text",async:true,cache:false,type:"POST"});return o.promise()};function terminal_ready(e){return!!(e.closest("body").length&&e.is(":visible")&&e.find(".cmd-prompt").length)}function get_char_size(e){var t;if(terminal_ready(e)){var n=e.find(".cmd-prompt").clone().css({visiblity:"hidden",position:"absolute"});n.appendTo(e.find(".cmd")).html(" ");t=n[0].getBoundingClientRect();n.remove()}else{var r=$('<div class="terminal terminal-temp"><div class="terminal-'+'wrapper"><div class="terminal-output"><div><div class="te'+'rminal-line" style="float: left"><span> </span></div'+"></div></div></div>").appendTo("body");r.addClass(e.attr("class")).attr("id",e.attr("id"));if(e){var i=e.attr("style");if(i){i=i.split(/\s*;\s*/).filter(function(e){return!e.match(/display\s*:\s*none/i)}).join(";");r.attr("style",i)}}t=r.find(".terminal-line")[0].getBoundingClientRect()}var a={width:t.width,height:t.height};if(r){r.remove()}return a}function get_num_chars(e,t){var n=e.find(".terminal-fill").width();var r=Math.floor(n/t.width);return r||1e3}function get_num_rows(e,t){return Math.floor(e.find(".terminal-fill").height()/t.height)}function all(e,t){var n=e.filter(function(e){return e[t]()===e});return n.length===e.length}function string_case(e){var t=e.split("");if(all(t,"toLowerCase")){return"lower"}else if(all(t,"toUpperCase")){return"upper"}else{return"mixed"}}function same_case(e){return string_case(e)!=="mixed"}function is_function(e){return get_type(e)==="function"}function is_array(e){return get_type(e)==="array"}function get_type(e){return typeof e==="function"?"function":$.type(e)}var version_set=!$.terminal.version.match(/^\{\{/);var copyright="Copyright (c) 2011-2019 Jakub T. Jankiewicz "+"<https://jcubic.pl/me>";var version_string=version_set?" v. "+$.terminal.version:" ";var reg=new RegExp(" {"+version_string.length+"}$");var name_ver="jQuery Terminal Emulator"+(version_set?version_string:"");var signatures=[["jQuery Terminal","(c) 2011-2019 jcubic"],[name_ver,copyright.replace(/^Copyright | *<.*>/g,"")],[name_ver,copyright.replace(/^Copyright /,"")],[" _______ ________ __"," / / _ /_ ____________ _/__ ___/______________ _____ / /"," __ / / // / // / _ / _/ // / / / _ / _/ / / \\/ / _ \\/ /","/ / / // / // / ___/ // // / / / ___/ // / / / / /\\ / // / /__","\\___/____ \\\\__/____/_/ \\__ / /_/____/_//_/_/_/_/_/ \\/\\__\\_\\___/"," \\/ /____/ ".replace(reg," ")+version_string,copyright],[" __ _____ ________ "+" __"," / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ "+" / /"," __ / // // // // // _ // _// // / / // _ // _// // // \\/ // _ "+"\\/ /","/ / // // // // // ___// / / // / / // ___// / / / / // // /\\ // // "+"/ /__","\\___//____ \\\\___//____//_/ _\\_ / /_//____//_/ /_/ /_//_//_/ /_/ \\"+"__\\_\\___/",(" \\/ /____/ "+" ").replace(reg,"")+version_string,copyright]];$.terminal.nested_formatting.__meta__=true;$.terminal.nested_formatting.__inherit__=false;$.terminal.nested_formatting.__no_warn__=true;$.terminal.defaults={prompt:"> ",history:true,exit:true,clear:true,enabled:true,maskChar:"*",wrap:true,checkArity:true,raw:false,tabindex:1,invokeMethods:false,exceptionHandler:null,pauseEvents:true,softPause:false,memory:false,cancelableAjax:true,processArguments:true,linksNoReferrer:false,anyLinks:false,linksNoFollow:false,processRPCResponse:null,completionEscape:true,onCommandChange:null,mobileDelete:is_mobile,onPositionChange:null,convertLinks:true,extra:{},tabs:4,historySize:60,scrollObject:null,historyState:false,importHistory:false,historyFilter:null,echoCommand:true,scrollOnEcho:true,login:null,outputLimit:-1,formatters:[$.terminal.nested_formatting],onAjaxError:null,pasteImage:true,scrollBottomOffset:20,wordAutocomplete:true,caseSensitiveAutocomplete:true,caseSensitiveSearch:true,clickTimeout:200,holdTimeout:400,holdRepeatTimeout:200,repeatTimeoutKeys:[],mobileIngoreAutoSpace:[],request:$.noop,response:$.noop,describe:"procs",onRPCError:null,doubleTab:null,doubleTabEchoCommand:false,completion:false,onInit:$.noop,onClear:$.noop,onBlur:$.noop,onFocus:$.noop,onTerminalChange:$.noop,onExit:$.noop,onPush:$.noop,onPop:$.noop,keypress:$.noop,keydown:$.noop,renderHandler:null,onAfterRedraw:$.noop,onEchoCommand:$.noop,onPaste:$.noop,onFlush:$.noop,onBeforeCommand:null,onAfterCommand:null,onBeforeEcho:null,onAfterEcho:null,onBeforeLogin:null,onAfterLogout:null,onBeforeLogout:null,allowedAttributes:["title",/^aria-/,"id",/^data-/],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 you use invalid "+"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",defunctTerminal:"You can't call method on terminal that was destroyed"}};var requests=[];var terminals=new Cycle;var save_state=[];var hash_commands;var change_hash=false;var fire_hash_change=true;var first_instance=true;$.fn.terminal=function(e,t){function n(n){if(n){this.storage={}}this.set=function(e,t){if(n){this.storage[e]=t}else{$.Storage.set(e,t)}};this.get=function(e){if(n){return this.storage[e]}else{return $.Storage.get(e)}};this.remove=function(e){if(n){delete this.storage[e]}else{$.Storage.remove(e)}}}function f(e){if($.terminal.unclosed_strings(e)){var t=$.terminal.escape_brackets(e);var n=sprintf(Z().invalidStrings,"`"+t+"`");throw new $.terminal.Exception(n)}else if(is_function(ye.processArguments)){return process_command(e,ye.processArguments)}else if(ye.processArguments){return $.terminal.parse_command(e)}else{return $.terminal.split_command(e)}}function o(e){if(is_function(ye.renderHandler)){var t=ye.renderHandler.call(ee,e,ee);if(t===false){return false}if(typeof t==="string"||i(t)){return t}else{return e}}return e}function a(e){var t=e.data("index");var n=Ce[t];var r=n[1];if(is_function(r.unmount)){r.unmount.call(ee,e)}}function u(n,r){if(i(n)){var e=$.extend({},r,{raw:true,finalize:function(e){var t;if(n instanceof $.fn.init){t=n.clone(true,true)}else{t=n}e.find(".terminal-render-item").replaceWith(t);if(r&&is_function(r.finalize)){r.finalize(e,ee)}}});return['<div class="terminal-render-item"/>',e]}}function s(e,t){var n=u(e,t);if(n){ee.echo.apply(ee,n);return true}}function r(e){return ie.find("[data-index="+e+"]")}function i(e){return e instanceof $.fn.init||e instanceof Element}function p(e){e=o(e);if(e===false){return}if(s(e)){return}if(typeof e==="string"){ee.echo(e)}else if(is_array(e)){ee.echo($.map(e,function(e){return JSON.stringify(e)}).join(" "))}else if(typeof e==="object"){ee.echo(JSON.stringify(e))}else{ee.echo(e)}}function c(e,o){var t=/(.*):([0-9]+):([0-9]+)$/;var u=e.match(t);if(u){ee.pause(ye.softPause);$.get(u[1],function(e){var t=u[1];var n=e.split("\n");var i=+u[2]-1;var r=i>2?i-2:0;var a=n.slice(r,i+3).map(function(e,t){var n="["+(i+t-1)+"]: ";var r=o-n.length-4;if(e.length>r){e=e.substring(0,r)+"..."}if(i>2?t===2:t===i){e="[[;#f00;]"+$.terminal.escape_brackets(e)+"]"}return n+e}).filter(Boolean).join("\n");if(a.length){ee.echo("[[b;white;]"+t+"]");ee.echo(a).resume()}},"text")}}function m(e){if(is_function(ye.onRPCError)){ye.onRPCError.call(ee,e)}else{ee.error("[RPC] "+e.message);if(e.error&&e.error.message){e=e.error;var t="\t"+e.message;if(e.file){t+=' in file "'+e.file.replace(/.*\//,"")+'"'}if(e.at){t+=" at line "+e.at}ee.error(t)}}}function d(n,r){var i=function(e,t){ee.pause(ye.softPause);$.jrpc({url:n,method:e,params:t,request:function(e,t){try{ye.request.call(ee,e,t,ee)}catch(e){_(e,"USER")}},response:function(e,t){try{ye.response.call(ee,e,t,ee)}catch(e){_(e,"USER")}},success:function e(t){if(t.error){m(t.error)}else if(is_function(ye.processRPCResponse)){ye.processRPCResponse.call(ee,t.result,ee)}else{p(t.result)}ee.resume()},error:D})};return function(e,t){if(e===""){return}try{e=f(e)}catch(e){_(e,"TERMINAL (get_processed_command)");return}if(!r||e.name==="help"){i(e.name,e.args)}else{var n=t.token();if(n){i(e.name,[n].concat(e.args))}else{t.error("[AUTH] "+Z().noTokenError)}}}}function h(o,u,s,l){return function(e,t){if(e===""){return}var n;try{n=f(e)}catch(e){if(is_function(ye.exception)){ye.exception(e,ee)}else{ee.error("Error: "+(e.message||e))}return}var r=o[n.name];var i=get_type(r);if(i==="function"){if(u&&r.length!==n.args.length){ee.error("[Arity] "+sprintf(Z().wrongArity,n.name,r.length,n.args.length))}else{return r.apply(ee,n.args)}}else if(i==="object"||i==="string"){var a=[];if(i==="object"){a=Object.keys(r);r=h(r,u,s)}t.push(r,{prompt:n.name+"> ",name:n.name,completion:i==="object"?a:undefined})}else if(is_function(l)){l(e,ee)}else if(is_function(ye.onCommandNotFound)){ye.onCommandNotFound.call(ee,e,ee)}else{t.error(sprintf(Z().commandNotFound,n.name))}}}function D(e,t,n){ee.resume();if(is_function(ye.onAjaxError)){ye.onAjaxError.call(ee,e,t,n)}else if(t!=="abort"){ee.error("[AJAX] "+t+" - "+Z().serverResponse+":\n"+$.terminal.escape_brackets(e.responseText))}}function v(a,u,r){function s(e){if(e.error){m(e.error)}else if(is_function(ye.processRPCResponse)){ye.processRPCResponse.call(ee,e.result,ee)}else{p(e.result)}ee.resume()}function l(e,t){try{ye.request.call(ee,e,t,ee)}catch(e){_(e,"USER")}}function f(e,t){try{ye.response.call(ee,e,t,ee)}catch(e){_(e,"USER")}}function e(e){var n=e;if(ye.describe!==false&&ye.describe!==""){ye.describe.split(".").forEach(function(e){n=n[e]})}if(n&&n.length){var t={};$.each(n,function(e,i){if($.isPlainObject(i)&&typeof i.name==="string"){t[i.name]=function(){var e=u&&i.name!=="help";var t=Array.prototype.slice.call(arguments);var n=t.length+(e?1:0);if(ye.checkArity&&i.params&&i.params.length!==n){ee.error("[Arity] "+sprintf(Z().wrongArity,i.name,i.params.length,n))}else{ee.pause(ye.softPause);if(e){var r=ee.token(true);if(r){t=[r].concat(t)}else{ee.error("[AUTH] "+Z().noTokenError)}}$.jrpc({url:a,method:i.name,params:t,request:l,response:f,success:s,error:D})}}}});var o=typeof u==="string"?u:"login";t.help=t.help||function(i){if(typeof i==="undefined"){var e=n.map(function(e){return e.name}).join(", ")+", help";ee.echo("Available commands: "+e)}else{var a=false;$.each(n,function(e,t){if(t.name===i){a=true;var n="";n+="[[bu;;]"+t.name+"]";if(t.params){var r=t.params;if(u&&t.name!==o){r=r.slice(1)}n+=" "+r.join(" ")}if(t.help){n+="\n"+t.help}ee.echo(n);return false}});if(!a){if(i==="help"){ee.echo("[[bu;;]help] [method]\ndisplay help "+"for the method or list of methods if not"+" specified")}else{var t="Method `"+i+"' not found ";ee.error(t)}}}};r(t)}else{r(null)}}return $.jrpc({url:a,method:"system.describe",params:[],success:e,request:l,response:f,error:function e(){r(null)}})}function l(t,o,n){n=n||$.noop;var e=get_type(t);var u;var r={};var s=0;var l;if(e==="array"){u={};(function t(e,n){if(e.length){var r=e[0];var i=e.slice(1);var a=get_type(r);if(a==="string"){ee.pause(ye.softPause);if(ye.describe===false){if(++s===1){l=d(r,o)}else{ee.error(Z().oneRPCWithIgnore)}t(i,n)}else{v(r,o,function(e){if(e){$.extend(u,e)}else if(++s===1){l=d(r,o)}else{ee.error(Z().oneRPCWithIgnore)}ee.resume();t(i,n)})}}else if(a==="function"){if(l){ee.error(Z().oneInterpreterFunction)}else{l=r}t(i,n)}else if(a==="object"){$.extend(u,r);t(i,n)}}else{n()}})(t,function(){n({interpreter:h(u,false,o,l&&l.bind(ee)),completion:Object.keys(u)})})}else if(e==="string"){if(ye.describe===false){u={interpreter:d(t,o)};if($.isArray(ye.completion)){u.completion=ye.completion}n(u)}else{ee.pause(ye.softPause);v(t,o,function(e){if(e){r.interpreter=h(e,false,o);r.completion=Object.keys(e)}else{r.interpreter=d(t,o)}n(r);ee.resume()})}}else if(e==="object"){n({interpreter:h(t,ye.checkArity,o),completion:Object.keys(t)})}else{if(e==="undefined"){t=$.noop}else if(e!=="function"){var i=e+" is invalid interpreter value";throw new $.terminal.Exception(i)}n({interpreter:t,completion:ye.completion})}}function g(r,e){var i=get_type(e)==="boolean"?"login":e;return function(e,t,n){ee.pause(ye.softPause);$.jrpc({url:r,method:i,params:[e,t],request:function(e,t){try{ye.request.call(ee,e,t,ee)}catch(e){_(e,"USER")}},response:function(e,t){try{ye.response.call(ee,e,t,ee)}catch(e){_(e,"USER")}},success:function e(t){if(!t.error&&t.result){n(t.result)}else{n(null)}ee.resume()},error:D})}}function _(e,t,n){if(is_function(ye.exceptionHandler)){ye.exceptionHandler.call(ee,e,t)}else{ee.exception(e,t);if(!n){setTimeout(function(){throw e},0)}}}function y(e){b.push({line:e})}var b=[];var w=1;function C(e,t,n){var r,i;b.push(w);if(!n.raw){var a={linksNoReferrer:ye.linksNoReferrer,linksNoFollow:ye.linksNoFollow,anyLinks:ye.anyLinks,char_width:be.width,escape:false,allowedAttributes:n.allowedAttributes||[]};var o=ee.cols();if((strlen(text(e))>o||e.match(/\n/))&&(ye.wrap===true&&n.wrap===undefined||ye.wrap===false&&n.wrap===true)){var u=n.keepWords;var s=$.terminal.split_equal(e,o,u);for(r=0,i=s.length;r<i;++r){if(s[r]===""||s[r]==="\r"){b.push({line:"<span></span>"})}else{var l={line:$.terminal.format(s[r],a)};if(r===i-1){l.newline=true}b.push(l)}}}else{e=$.terminal.format(e,a);e.split(/\n/).forEach(y)}}else{y(e)}b.push({finalize:n.finalize,index:t})}function E(e){function t(e,n,r,i,a,o,t){function u(e,t){return"[["+[n+(e||""),r,i,a,o||t].join(";")+"]"}function s(e){return"]"+u("!",e)+e+"]"+u()}if(!n.match(/!/)){if(t.match(email_full_re)||t.match(url_full_re)){return u("!",t)+t+"]"}else if(t.match(email_re)||t.match(url_nf_re)){var l=t.replace(email_re,s).replace(url_nf_re,s);return u("",o)+l+"]"}}return e}if(!(e.match(email_re)||e.match(url_nf_re))){return e}if(!$.terminal.have_formatting(e)){return e.replace(email_re,"[[!;;]$1]").replace(url_nf_re,"[[!;;]$1]")}return $.terminal.format_split(e).map(function(e){if($.terminal.is_formatting(e)){return e.replace(format_parts_re,t)}else{return e.replace(email_re,"[[!;;]$1]").replace(url_nf_re,"[[!;;]$1]")}}).join("")}function x(e){try{var n=$.extend({exec:true,raw:false,finalize:$.noop,invokeMethods:false,formatters:true,convertLinks:ye.convertLinks},e.options||{});var t;t=Ue(e.value);if(t!==""){if(!n.raw){if(n.formatters){try{t=$.terminal.apply_formatters(t,ye)}catch(e){_(e,"FORMATTING")}}if(n.exec){var r=t.split(format_exec_re);t=$.map(r,function(e){if(e&&e.match(format_exec_re)&&!$.terminal.is_formatting(e)){e=e.replace(/^\[\[|\]\]$/g,"");if(n.exec){var t;if(ne){ne=ne.command.trim()}if(t===e.trim()){ee.error(Z().recursiveCall)}else{$.terminal.extended_command(ee,e,{invokeMethods:n.invokeMethods})}}return""}else{return e}}).join("")}if(t===""){return}if(n.convertLinks){t=E(t)}t=crlf($.terminal.normalize(t));t=$.terminal.encode(t,{tabs:ye.tabs})}}C(t,e.index,n)}catch(e){b=[];if(is_function(ye.exceptionHandler)){ye.exceptionHandler.call(ee,e,"TERMINAL")}else{alert_exception("[Internal Exception(process_line)]",e)}}}function F(e){e=$.extend({},{update:false,scroll:true},e||{});if(!e.update){Te.resize(ue);var t=ie.empty().detach()}var i=[];if(ye.outputLimit>=0){var n;if(ye.outputLimit===0){n=ee.rows()}else{n=ye.outputLimit}Ce.forEach(function(e,t){var n=e[0];var r=e[1];i.push({value:n,index:t,options:r})});var r=i.length-n-1;i=i.slice(r)}else{i=Ce.map(function(e,t){return{value:e[0],index:t,options:e[1]}})}try{b=[];$.each(i,function(e,t){x(t)});if(!e.update){Te.before(t)}ee.flush(e);M("onAfterRedraw")}catch(e){if(is_function(ye.exceptionHandler)){ye.exceptionHandler.call(ee,e,"TERMINAL (redraw)")}else{alert_exception("[redraw]",e)}}}function k(){if(ye.outputLimit>=0){var e;if(ye.outputLimit===0){e=ee.rows()}else{e=ye.outputLimit}var t=ie.find("> div > div");if(t.length+1>e){var n=t.length-e+1;var r=t.slice(0,n);var i=r.parent();r.remove();i.each(function(){var e=$(this);if(e.is(":empty")){a(e);e.remove()}})}}}function A(){if(ye.greetings===undefined){ee.echo(ee.signature,{finalize:a11y_hide,formatters:false})}else if(ye.greetings){var e=typeof ye.greetings;if(e==="string"){ee.echo(ye.greetings)}else if(e==="function"){try{var t=ye.greetings.call(ee,ee.echo);var n=B("Greetings");unpromise(t,ee.echo,function(e){n(e);ye.greetings=null})}catch(e){ye.greetings=null;_(e,"greetings")}}else{ee.error(Z().wrongGreetings)}}}function T(n){if(typeof n==="undefined"){n=ee.get_command()}var e=Te.prompt(true);var t=Te.mask();switch(typeof t){case"string":n=n.replace(/./g,t);break;case"boolean":if(t){n=n.replace(/./g,ye.maskChar)}else{n=$.terminal.escape_formatting(n)}break}var r={convertLinks:false,exec:false,finalize:function e(t){a11y_hide(t.addClass("terminal-command"));M("onEchoCommand",[t,n])}};ee.echo(e+n,r)}function S(){if(ee.is("body")){return window.innerWidth-document.documentElement.clientWidth>0}return Oe.outerWidth()!==ee.outerWidth()}function R(e){var t=terminals.get()[e[0]];if(!t){throw new $.terminal.Exception(Z().invalidTerminalId)}var n=e[1];if(save_state[n]){t.import_view(save_state[n])}else{change_hash=false;var r=e[2];if(r){t.exec(r).done(function(){change_hash=true;save_state[n]=t.export_view()})}}}function B(t){return function(e){ee.error("["+t+"] "+(e.message||e)).resume()}}function j(){if(change_hash){fire_hash_change=false;location.hash="#"+JSON.stringify(hash_commands);setTimeout(function(){fire_hash_change=true},100)}}var L=true;var O=[];function I(n,e,t){function r(){if(ye.historyState||ye.execHash&&t){if(!save_state.length){ee.save_state()}else{ee.save_state(null)}}}function i(){if(!t){change_hash=true;if(ye.historyState){ee.save_state(n,false)}change_hash=l}s.resolve();M("onAfterCommand",[n])}function a(e){if(typeof e!=="undefined"){p(e)}i();ee.resume()}function o(){var e=u.interpreter.call(ee,n,ee);if(e){if(!oe){ee.pause(ye.softPause)}oe=false;var t=B("Command");if(is_function(e.done||e.then)){return unpromise(e,a,t)}else{return $.when(e).done(a).catch(t)}}else if($e){O.push(function(){i()})}else{i()}}if(L){L=false;r()}try{if(M("onBeforeCommand",[n])===false){return}if(!t){ne=$.terminal.split_command(n)}if(!J()){if(t&&(is_function(ye.historyFilter)&&ye.historyFilter(n)||n.match(ye.historyFilter))){Te.history().append(n)}}var u=Ae.top();if(!e&&ye.echoCommand){T(n)}var s=new $.Deferred;var l=change_hash;if(n.match(/^\s*login\s*$/)&&ee.token(true)){if(ee.level()>1){ee.logout(true)}else{ee.logout()}i()}else if(ye.exit&&n.match(/^\s*exit\s*$/)&&!he){var f=ee.level();if(f===1&&ee.get_token()||f>1){if(ee.get_token(true)){ee.set_token(undefined,true)}ee.pop()}i()}else if(ye.clear&&n.match(/^\s*clear\s*$/)&&!he){ee.clear();i()}else{var c=o();if(c){return c}}return s.promise()}catch(e){_(e,"USER",t);ee.resume();if(t){throw e}}}function P(){if(M("onBeforeLogout",[],true)===false){return}z();M("onAfterlogout",[],true);ee.login(Ne,true,K)}function z(){var e=ee.prefix_name(true)+"_";Ee.remove(e+"token");Ee.remove(e+"login")}function N(e){var t=ee.prefix_name()+"_interpreters";var n=Ee.get(t);if(n){n=JSON.parse(n)}else{n=[]}if($.inArray(e,n)===-1){n.push(e);Ee.set(t,JSON.stringify(n))}}function H(e){var t=Ae.top();var n=ee.prefix_name(true);if(!J()){N(n)}var r=ee.login_name(true);Te.name(n+(r?"_"+r:""));var i=t.prompt;if(is_function(i)){i=qe(i)}if(i!==Te.prompt()){if(is_function(t.prompt)){Te.prompt("")}Te.prompt(t.prompt)}if(typeof t.history!=="undefined"){ee.history().toggle(t.history)}if($.isPlainObject(t.keymap)){Te.keymap($.omap(t.keymap,function(e,t){return function(){var e=[].slice.call(arguments);try{return t.apply(ee,e)}catch(e){_(e,"USER KEYMAP")}}}))}Te.set("");pe.resolve();if(!e&&is_function(t.onStart)){t.onStart.call(ee,ee)}}function M(t,e,n){e=(e||[]).concat([ee]);var r=Ae&&Ae.top();if(r&&is_function(r[t])&&!n){try{return r[t].apply(ee,e)}catch(e){delete r[t];_(e,t)}}else if(is_function(ye[t])){try{return ye[t].apply(ee,e)}catch(e){ye[t]=null;_(e,t)}}}var U=function(){function e(e){if(!e){try{ee.scroll_to(ee.find(".cmd-cursor"));return true}catch(e){return true}}}if(typeof global!=="undefined"&&typeof global.it==="function"){return e}return debounce(e,100,{leading:true,trailing:false})}();function q(){var e=ee.find(".cmd-cursor-line");return e.is_fully_in_viewport(ee).then(U)}function W(){if(fire_hash_change&&ye.execHash){try{if(location.hash){var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e))}else{hash_commands=[]}if(hash_commands.length){R(hash_commands[hash_commands.length-1])}else if(save_state[0]){ee.import_view(save_state[0])}}catch(e){_(e,"TERMINAL")}}}function K(){H();A();if(Ce.length){ee.refresh()}var e=false;if(is_function(ye.onInit)){De=function(){e=true};try{ye.onInit.call(ee,ee)}catch(e){_(e,"OnInit")}finally{De=$.noop;if(!e&&ee.enabled()){ee.resume(true)}}}if(first_instance){first_instance=false;$(window).on("hashchange",W)}}function J(){return he||Te.mask()!==false}function Q(e){var t,n=Ae.top();if(is_function(n.keydown)){t=n.keydown.call(ee,e,ee);if(t!==undefined){return t}}else if(is_function(ye.keydown)){t=ye.keydown.call(ee,e,ee);if(t!==undefined){return t}}}var Y={"CTRL+D":function(e,t){if(!he){if(Te.get()===""){if(Ae.size()>1||is_function(Ne)){ee.pop("")}else{ee.resume();ee.echo("")}}else{t()}}return false},"CTRL+C":function(){with_selection(function(e){if(e===""){var t=ee.get_command();var n=ee.get_position();t=t.slice(0,n)+"^C"+t.slice(n+2);T(t);ee.set_command("")}else{var r=ee.find("textarea");text_to_clipboard(r,process_selected_html(e))}});return false},"CTRL+L":function(){ee.clear()},TAB:function(e,t){var n=Ae.top(),r,i;if(typeof n.caseSensitiveAutocomplete!=="undefined"){i=n.caseSensitiveAutocomplete}else{i=ye.caseSensitiveAutocomplete}if(ye.completion&&get_type(ye.completion)!=="boolean"&&n.completion===undefined){r=ye.completion}else{r=n.completion}if(r==="settings"){r=ye.completion}function a(e){e=e.slice();if(!ee.before_cursor(false).match(/\s/)){if(ye.clear&&$.inArray("clear",e)===-1){e.push("clear")}if(ye.exit&&$.inArray("exit",e)===-1){e.push("exit")}}ee.complete(e,{echo:true,word:ye.wordAutocomplete,escape:ye.completionEscape,caseSensitive:i,echoCommand:ye.doubleTabEchoCommand,doubleTab:ye.doubleTab})}if(r){switch(get_type(r)){case"function":var o=ee.before_cursor(ye.wordAutocomplete);if(r.length===3){var u=new Error(Z().comletionParameters);_(u,"USER");return false}var s=r.call(ee,o,a);unpromise(s,a,B("Completion"));break;case"array":a(r);break;default:throw new $.terminal.Exception(Z().invalidCompletion)}}else{t()}return false},"CTRL+V":function(e,t){t(e);ee.oneTime(200,function(){ee.scroll_to_bottom()});return true},"CTRL+TAB":function(){if(terminals.length()>1){ee.focus(false);return false}},PAGEDOWN:function(){ee.scroll(ee.height())},PAGEUP:function(){ee.scroll(-ee.height())}};function G(t){var e,n;if(ee.enabled()){if(!ee.paused()){e=Q(t);if(e!==undefined){return e}if(t.which!==9){re=0}}else{if(!ye.pauseEvents){e=Q(t);if(e!==undefined){return e}}if(t.which===68&&t.ctrlKey){if(ye.pauseEvents){e=Q(t);if(e!==undefined){return e}}if(requests.length){for(n=requests.length;n--;){var r=requests[n];if(r.readyState!==4){try{r.abort()}catch(e){if(is_function(ye.exceptionHandler)){ye.exceptionHandler.call(ee,t,"AJAX ABORT")}else{ee.error(Z().ajaxAbortError)}}}}requests=[]}ee.resume()}return false}}}function V(e){var t=Ae.top();if(xe&&(!$e||!ye.pauseEvents)){if(is_function(t.keypress)){return t.keypress.call(ee,e,ee)}else if(is_function(ye.keypress)){return ye.keypress.call(ee,e,ee)}}}function X(t){return function(e){t.add(e)}}function Z(){return $.extend({},$.terminal.defaults.strings,ye&&ye.strings||{})}var ee=this;if(ee.is("body,html")){ee=$("<div/>").appendTo("body");$("body").addClass("full-screen-terminal")}if(this.length>1){return this.each(function(){$.fn.terminal.call($(this),e,$.extend({name:ee.selector},t))})}if(ee.data("terminal")){return ee.data("terminal")}$.extend(ee,$.omap({id:function(){return ae},clear:function(){if(M("onClear")!==false){Ce.forEach(function(e,t){var n=e[1];n.onClear.call(ee,r(t))});Ce=[];ie.html("");ee.attr({scrollTop:0})}return ee},export_view:function(){var e=M("onExport");e=e||{};return $.extend({},{focus:xe,mask:Te.mask(),prompt:ee.get_prompt(),command:ee.get_command(),position:Te.position(),lines:clone(Ce),interpreters:Ae.clone(),history:Te.history().data},e)},import_view:function(t){if(he){throw new Error(sprintf(Z().notWhileLogin,"import_view"))}M("onImport",[t]);me(function e(){ee.set_prompt(t.prompt);ee.set_command(t.command);Te.position(t.position);Te.mask(t.mask);if(t.focus){ee.focus()}Ce=clone(t.lines).filter(function(e){return e[0]});if(t.interpreters instanceof Stack){Ae=t.interpreters}if(ye.importHistory){Te.history().set(t.history)}F()});return ee},save_state:function(e,t,n){if(typeof n!=="undefined"){save_state[n]=ee.export_view()}else{save_state.push(ee.export_view())}if(!$.isArray(hash_commands)){hash_commands=[]}if(e!==undefined&&!t){var r=[ae,save_state.length-1,e];hash_commands.push(r);j()}return ee},exec:function(n,r,e){var i=e||new $.Deferred;de(function e(){if($.isArray(n)){(function e(){var t=n.shift();if(t){ee.exec(t,r).done(e)}else{i.resolve()}})()}else if($e){_e.push([n,r,i])}else{var t=I(n,r,true);unpromise(t,function(){i.resolve()},function(){i.reject()})}});return i.promise()},autologin:function(e,t,n){ee.trigger("terminal.autologin",[e,t,n]);return ee},login:function(r,i,a,o){fe.push([].slice.call(arguments));if(he){throw new Error(sprintf(Z().notWhileLogin,"login"))}if(!is_function(r)){throw new Error(Z().loginIsNotAFunction)}he=true;if(ee.token()&&ee.level()===1&&!ke){he=false;ee.logout(true)}else if(ee.token(true)&&ee.login_name(true)){he=false;if(is_function(a)){a()}return ee}if(ye.history){Te.history().disable()}function u(){while(ee.level()>e){ee.pop(undefined,true)}if(ye.history){Te.history().enable()}}var e=ee.level();function s(e,t,n){if(ee.paused()){ee.resume()}if(t){u();var r=ee.prefix_name(true)+"_";Ee.set(r+"token",t);Ee.set(r+"login",e);he=false;M("onAfterLogin",[e,t]);if(is_function(a)){a()}}else{if(i){if(!n){ee.error(Z().wrongPasswordTryAgain)}ee.pop(undefined,true).set_mask(false)}else{he=false;if(!n){ee.error(Z().wrongPassword)}ee.pop(undefined,true).pop(undefined,true)}if(is_function(o)){o()}}ee.off("terminal.autologin")}ee.on("terminal.autologin",function(e,t,n,r){if(M("onBeforeLogin",[t,n])===false){return}s(t,n,r)});ee.push(function(n){ee.set_mask(ye.maskChar).push(function(e){try{if(M("onBeforeLogin",[n,e])===false){u();return}ee.pause();var t=r.call(ee,n,e,function(e,t){s(n,e,t)});if(t&&is_function(t.then||t.done)){(t.then||t.done).call(t,function(e){s(n,e)})}}catch(e){_(e,"AUTH")}},{prompt:Z().password+": ",name:"password"})},{prompt:Z().login+": ",name:"login"});return ee},settings:function(){return ye},before_cursor:function(e){var t=Te.position();var n=Te.get().slice(0,t);var r=n.split(" ");var i;if(e){if(r.length===1){i=r[0]}else{var a=n.match(/(\\?")/g);var o=a?a.filter(function(e){return!e.match(/^\\/)}).length:0;a=n.match(/'/g);var u=a?a.length:0;if(u%2===1){i=n.match(/('[^']*)$/)[0]}else if(o%2===1){i=n.match(/("(?:[^"]|\\")*)$/)[0]}else{i=r[r.length-1];for(Pe=r.length-1;Pe>0;Pe--){var s=r[Pe-1];if(s[s.length-1]==="\\"){i=r[Pe-1]+" "+i}else{break}}}}}else{i=n}return i},complete:function(r,i){i=$.extend({word:true,echo:false,escape:true,echoCommand:false,caseSensitive:true,doubleTab:null},i||{});var a=i.caseSensitive;var o=ee.before_cursor(i.word).replace(/\\"/g,'"');var s=false;if(i.word){if(o.match(/^"/)){s='"'}else if(o.match(/^'/)){s="'"}if(s){o=o.replace(/^["']/,"")}}if(re%2===0){le=ee.before_cursor(i.word)}else{var e=ee.before_cursor(i.word);if(e!==le){return}}var t=$.terminal.escape_regex(o);if(i.escape){t=t.replace(/(\\+)(["'() ])/g,function(e,t,n){if(n.match(/[()]/)){return t+"\\?\\"+n}else{return t+"?"+n}})}function u(e){if(s==='"'){e=e.replace(/"/g,'\\"')}if(!s&&i.escape){e=e.replace(/(["'() ])/g,"\\$1")}return e}function n(){var e=[];for(var t=r.length;t--;){if(r[t].match(/\n/)&&i.word){warn("If you use commands with newlines you "+"should use word option for complete or"+" wordAutocomplete terminal option")}if(f.test(r[t])){var n=u(r[t]);if(!a&&same_case(n)){if(o.toLowerCase()===o){n=n.toLowerCase()}else if(o.toUpperCase()===o){n=n.toUpperCase()}}e.push(n)}}return e}var l=a?"":"i";var f=new RegExp("^"+t,l);var c=n();function p(e,t){var n=ee.get_command();var r=ee.get_position();var i=new RegExp("^"+e,"i");var a=n.slice(0,r);var o=n.slice(r);var u=t.replace(i,"")+(s||"");ee.set_command(a+u+o);ee.set_position((a+u).length)}if(c.length===1){if(i.escape){p(t,c[0])}else{ee.insert(c[0].replace(f,"")+(s||""))}le=ee.before_cursor(i.word);return true}else if(c.length>1){if(++re>=2){re=0;if(i.echo){if(is_function(i.doubleTab)){if(i.echoCommand){T()}var m=i.doubleTab.call(ee,o,c,T);if(typeof m==="undefined"){return true}else{return m}}else if(i.doubleTab!==false){T();var d=c.slice().reverse().join("\t\t");ee.echo($.terminal.escape_brackets(d),{keepWords:true,formatters:false})}return true}}else{var h=common_string(u(o),c,a);if(h){p(t,h);le=ee.before_cursor(i.word);return true}}}},commands:function(){return Ae.top().interpreter},set_interpreter:function(e,t){function n(){ee.pause(ye.softPause);l(e,t,function(e){ee.resume();var t=Ae.top();$.extend(t,e);H(true)})}if(is_function(t)){ee.login(t,true,n)}else if(get_type(e)==="string"&&t){ee.login(g(e,t),true,n)}else{n()}return ee},greetings:function(){A();return ee},paused:function(){return $e},pause:function(t){de(function e(){De();$e=true;Te.disable(t||is_android);if(!t){Te.find(".cmd-prompt").hidden()}M("onPause")});return ee},resume:function(i){de(function e(){$e=false;if(xe&&terminals.front()===ee){Te.enable(i)}Te.find(".cmd-prompt").visible();var t=_e;_e=[];for(var n=0;n<t.length;++n){ee.exec.apply(ee,t[n])}ee.trigger("resume");var r=O.shift();if(r){r()}ee.scroll_to_bottom();M("onResume")});return ee},cols:function(){if(ye.numChars){return ye.numChars}if(typeof ue==="undefined"||ue===1e3){ue=get_num_chars(ee,be)}return ue},rows:function(){if(ye.numRows){return ye.numRows}if(typeof se==="undefined"){se=get_num_rows(ee,be)}return se},history:function(){return Te.history()},history_state:function(e){function t(){ye.historyState=true;if(!save_state.length){ee.save_state()}else if(terminals.length()>1){ee.save_state(null)}}if(e){if(typeof window.setImmediate==="undefined"){setTimeout(t,0)}else{setImmediate(t)}}else{ye.historyState=false}return ee},clear_history_state:function(){hash_commands=[];save_state=[];return ee},next:function(){if(terminals.length()===1){return ee}else{terminals.front().disable();var e=terminals.rotate().enable();var t=e.offset().top-50;$("html,body").animate({scrollTop:t},500);try{trigger_terminal_change(e)}catch(e){_(e,"onTerminalChange")}return e}},focus:function(n,r){de(function e(){if(terminals.length()===1){if(n===false){ee.disable(r)}else{ee.enable(r)}}else if(n===false){ee.next()}else{var t=terminals.front();if(t!==ee){terminals.forEach(function(e){if(e!==ee&&e.enabled()){e.disable(r)}});if(!r){try{trigger_terminal_change(ee)}catch(e){_(e,"onTerminalChange")}}}terminals.set(ee);ee.enable(r)}});return ee},freeze:function(t){me(function e(){if(t){ee.disable();Fe=true}else{Fe=false;ee.enable()}});return ee},frozen:function(){return Fe},enable:function(n){if(!xe&&!Fe){if(ue===undefined){ee.resize()}de(function e(){var t;if(!n&&!xe){M("onFocus")}if(!n&&t===undefined||n){xe=true;if(!ee.paused()){Te.enable(true)}}})}return ee},disable:function(n){de(function e(){var t;if(!n&&xe){t=M("onBlur")}if(!n&&t===undefined||n){xe=false;Te.disable()}});return ee},enabled:function(){return xe},signature:function(){var e=ee.cols();for(var t=signatures.length;t--;){var n=signatures[t].map(function(e){return e.length});if(Math.max.apply(null,n)<=e){return signatures[t].join("\n")+"\n"}}return""},version:function(){return $.terminal.version},cmd:function(){return Te},get_command:function(){return Te.get()},echo_command:function(e){return T(e)},set_command:function(t,n){me(function e(){if(typeof t!=="string"){t=JSON.stringify(t)}Te.set(t,undefined,n)});return ee},set_position:function(t,n){me(function e(){Te.position(t,n)});return ee},get_position:function(){return Te.position()},insert:function(n,r){if(typeof n==="string"){me(function e(){var t=ee.is_bottom();Te.insert(n,r);if(ye.scrollOnEcho||t){ee.scroll_to_bottom()}});return ee}else{throw new Error(sprintf(Z().notAString,"insert"))}},set_prompt:function(t){me(function e(){if(is_function(t)){Te.prompt(function(e){t.call(ee,e,ee)})}else{Te.prompt(t)}Ae.top().prompt=t});return ee},get_prompt:function(){return Ae.top().prompt},set_mask:function(t){me(function e(){Te.mask(t===true?ye.maskChar:t)});return ee},get_output:function(e){if(e){return Ce}else{return $.map(Ce,function(e){return is_function(e[0])?e[0]():e[0]}).join("\n")}},resize:function(e,t){if(!ee.is(":visible")){ee.stopTime("resize");ee.oneTime(500,"resize",function(){ee.resize(e,t)})}else{if(e&&t){ee.width(e);ee.height(t)}e=ee.width();t=ee.height();if(typeof ye.numChars!=="undefined"||typeof ye.numRows!=="undefined"){Te.resize(ye.numChars);ee.refresh();M("onResize");return}var n=get_num_chars(ee,be);var r=get_num_rows(ee,be);if(n!==ue||r!==se){ue=n;se=r;Te.resize(ue);ee.refresh();M("onResize")}}return ee},refresh:function(){if(be.width!==0){ee[0].style.setProperty("--char-width",be.width)}F({scroll:false,update:true});return ee},flush:function(e){e=$.extend({},{update:false,scroll:true},e||{});try{var t=ee.is_bottom();var n;while(b.length){var r=b.shift();if(r===w){n=$("<div></div>")}else if($.isPlainObject(r)&&is_function(r.finalize)){if(e.update){var i="> div[data-index="+r.index+"]";var a=ie.find(i);if(a.html()!==n.html()){a.replaceWith(n)}}else{n.appendTo(ie)}n.attr("data-index",r.index);r.finalize(n)}else{var o=r.line;var u=$("<div/>").html(o).appendTo(n).width("100%");if(r.newline){u.addClass("cmd-end-line")}}}k();M("onFlush");if(ye.scrollOnEcho&&e.scroll||t){ee.scroll_to_bottom()}}catch(e){if(is_function(ye.exceptionHandler)){try{ye.exceptionHandler.call(ee,e,"TERMINAL (Flush)")}catch(e){ye.exceptionHandler=$.noop;alert_exception("[exceptionHandler]",e)}}else{alert_exception("[Flush]",e)}}finally{b=[]}return ee},update:function(n,r,i){me(function e(){if(n<0){n=Ce.length+n}if(!Ce[n]){ee.error("Invalid line number "+n)}else if(r===null){Ce.splice(n,1);ie.find("[data-index="+n+"]").remove()}else{var t=u(r,i);if(t){r=t[0];i=t[1]}Ce[n][0]=r;if(i){Ce[n][1]=i}x({value:r,index:n,options:i});ee.flush({scroll:false,update:true})}});return ee},remove_line:function(e){return ee.update(e,null)},last_index:function(){return Ce.length-1},echo:function(e,i){var a=arguments.length>0;function t(e){try{var n=$.extend({flush:true,exec:true,raw:ye.raw,finalize:$.noop,unmount:$.noop,keepWords:false,invokeMethods:ye.invokeMethods,onClear:$.noop,formatters:true,allowedAttributes:ye.allowedAttributes},i||{});(function(t){n.finalize=function(e){if(n.raw){e.addClass("raw")}try{if(is_function(t)){t.call(ee,e)}e.find("img").each(function(){var e=$(this);var t=new Image;t.onerror=function(){e.replaceWith(use_broken_image)};t.src=this.src})}catch(e){_(e,"USER:echo(finalize)");t=null}}})(n.finalize);if(n.flush){if(b.length){ee.flush()}}if(M("onBeforeEcho",[e])===false){return}var t;if(typeof e==="function"){t=e.bind(ee)}else if(typeof e==="undefined"){if(a){t=String(e)}else{t=""}}else{var r=o(e);if(r===false){return ee}t=r}if(s(t,n)){return ee}x({value:t,options:n,index:Ce.length});n.exec=false;Ce.push([t,n]);if(n.flush){ee.flush();M("onAfterEcho",[e])}}catch(e){if(is_function(ye.exceptionHandler)){ye.exceptionHandler.call(ee,e,"TERMINAL (echo)")}else{alert_exception("[Terminal.echo]",e)}}}if(e!==undefined&&is_function(e.then)){$.when(e).done(t).catch(B("Echo"))}else{t(e)}return ee},error:function(e,t){t=$.extend({},t,{raw:false,formatters:false});function n(e){if(typeof e!=="string"){e=String(e)}var t=$.terminal.escape_brackets(e).replace(/\\$/,"\").replace(url_re,"]$1[[;;;terminal-error]");return"[[;;;terminal-error]"+t+"]"}if(typeof e==="function"){return ee.echo(function(){return n(e.call(ee))},t)}if(e&&e.then){e.then(function(e){ee.echo(n(e))}).catch(B("Echo Error"));return ee}return ee.echo(n(e),t)},exception:function(r,e){var t=exception_message(r);if(e){t="["+e+"]: "+t}if(t){ee.error(t,{finalize:function(e){e.addClass("terminal-exception terminal-message")},keepWords:true})}if(typeof r.fileName==="string"){ee.pause(ye.softPause);$.get(r.fileName,function(e){var t=r.lineNumber-1;var n=e.split("\n")[t];if(n){ee.error("["+r.lineNumber+"]: "+n)}ee.resume()},"text")}if(r.stack){var n=$.terminal.escape_brackets(r.stack);ee.echo(n.split(/\n/g).map(function(e){return"[[;;;terminal-error]"+e.replace(url_re,function(e){return"]"+e+"[[;;;terminal-error]"})+"]"}).join("\n"),{finalize:function(e){e.addClass("terminal-exception terminal-stack-trace")},formatters:false})}return ee},scroll:function(e){var t;e=Math.round(e);if(ee.prop){if(e>ee.prop("scrollTop")&&e>0){ee.prop("scrollTop",0)}t=ee.prop("scrollTop");ee.scrollTop(t+e)}else{if(e>ee.attr("scrollTop")&&e>0){ee.attr("scrollTop",0)}t=ee.attr("scrollTop");ee.scrollTop(t+e)}return ee},logout:function(n){if(he){throw new Error(sprintf(Z().notWhileLogin,"logout"))}me(function e(){if(n){var t=fe.pop();ee.set_token(undefined,true);ee.login.apply(ee,t)}else if(Ae.size()===1&&ee.token()){ee.logout(true)}else{while(Ae.size()>1){if(ee.token()){ee.logout(true).pop().pop()}else{ee.pop()}}}});return ee},token:function(e){return Ee.get(ee.prefix_name(e)+"_token")},set_token:function(e,t){var n=ee.prefix_name(t)+"_token";if(typeof e==="undefined"){Ee.remove(n)}else{Ee.set(n,e)}return ee},get_token:function(e){return ee.token(e)},login_name:function(e){return Ee.get(ee.prefix_name(e)+"_login")},name:function(){return Ae.top().name},prefix_name:function(e){var t=(ye.name?ye.name+"_":"")+ae;if(e&&Ae.size()>1){var n=Ae.map(function(e){return e.name||""}).slice(1).join("_");if(n){t+="_"+n}}return t},read:function(e,t,n){oe=true;var r=jQuery.Deferred();var i=false;ee.push(function(e){i=true;r.resolve(e);if(is_function(t)){t(e)}ee.pop();if(ye.history){Te.history().enable()}},{name:"read",history:false,prompt:e||"",onExit:function(){if(!i){r.reject();if(is_function(n)){n()}}}});if(ye.history){Te.history().disable()}return r.promise()},push:function(o,u){de(function e(){u=u||{};var t={infiniteLogin:false};var r=$.extend({},t,u);if(!r.name&&ne){r.name=ne.name}if(r.prompt===undefined){r.prompt=(r.name||">")+" "}var n=Ae.top();if(n){n.mask=Te.mask()}var i=$e;function a(){M("onPush",[n,Ae.top()]);H()}l(o,u.login,function(e){Ae.push($.extend({},e,r));if(r.completion===true){if($.isArray(e.completion)){Ae.top().completion=e.completion}else if(!e.completion){Ae.top().completion=false}}if(r.login){var t;var n=get_type(r.login);if(n==="function"){t=r.infiniteLogin?$.noop:ee.pop;ee.login(r.login,r.infiniteLogin,a,t)}else if(get_type(o)==="string"&&n==="string"||n==="boolean"){t=r.infiniteLogin?$.noop:ee.pop;ee.login(g(o,r.login),r.infiniteLogin,a,t)}}else{a()}if(!i&&ee.enabled()){ee.resume()}})});return ee},pop:function(e,t){if(e!==undefined){T(e)}var n=ee.token(true);var r;if(Ae.size()===1){r=Ae.top();if(ye.login){if(!t){M("onPop",[r,null])}P();M("onExit")}else{ee.error(Z().canExitError)}}else{if(n){z()}var i=Ae.pop();r=Ae.top();H();ee.set_mask(r.mask);if(!t){M("onPop",[i,r])}if(he&&ee.get_prompt()!==Z().login+": "){he=false}if(is_function(i.onExit)){try{i.onExit.call(ee,ee)}catch(e){i.onExit=$.noop;_(e,"onExit")}}}return ee},option:function(e,t){if(typeof t==="undefined"){if(typeof e==="string"){return ye[e]}else if(typeof e==="object"){$.each(e,function(e,t){ye[e]=t})}}else{ye[e]=t;if(e.match(/^num(Chars|Rows)$/)){F()}}return ee},invoke_key:function(e){Te.invoke_key(e);return ee},keymap:function(e,n){if(arguments.length===0){return Te.keymap()}if(typeof n==="undefined"){if(typeof e==="string"){return Te.keymap(e)}else if($.isPlainObject(e)){e=$.omap(e||{},function(n,r){if(!Ke[n]){return r.bind(ee)}return function(e,t){return r.call(ee,e,function(){return Ke[n](e,t)})}});Te.keymap(e)}}else if(typeof n==="function"){var r=e;if(!Ke[r]){Te.keymap(r,n.bind(ee))}else{Te.keymap(r,function(e,t){return n.call(ee,e,function(){return Ke[r](e,t)})})}}},level:function(){return Ae.size()},reset:function(){me(function e(){ee.clear();while(Ae.size()>1){Ae.pop()}K()});return ee},purge:function(){me(function e(){var t=ee.prefix_name()+"_";var n=Ee.get(t+"interpreters");if(n){$.each(JSON.parse(n),function(e,t){Ee.remove(t+"_commands");Ee.remove(t+"_token");Ee.remove(t+"_login")})}Te.purge();Ee.remove(t+"interpreters")});return ee},destroy:function(){me(function e(){Te.destroy().remove();ee.resizer("unbind");Le.resizer("unbind").remove();$(document).unbind(".terminal_"+ee.id());$(window).unbind(".terminal_"+ee.id());ee.unbind("click wheel mousewheel mousedown mouseup");ee.removeData("terminal").removeClass("terminal").unbind(".terminal");if(ye.width){ee.css("width","")}if(ye.height){ee.css("height","")}$(window).off("blur",Me).off("focus",He);ee.find(".terminal-fill, .terminal-font").remove();ee.stopTime();terminals.remove(ae);if(Re){if(Re.unobserve){Re.unobserve(ee[0])}else{clearInterval(Re)}}if(Be){Be.disconnect()}if(!terminals.length()){$(window).off("hashchange")}ie.remove();je.remove();we=true});return ee},scroll_to:function(e){var t=ee.scrollTop()-ee.offset().top+$(e).offset().top;ee.scrollTop(t);return ee},scroll_to_bottom:function(){var e;if(ee.prop){e=ee.prop("scrollHeight")}else{e=ee.attr("scrollHeight")}ee.scrollTop(e);return ee},is_bottom:function(){if(ye.scrollBottomOffset===-1){return false}else{var e,t,n;e=ee[0].scrollHeight;t=ee.scrollTop();n=ee.outerHeight();var r=e-ye.scrollBottomOffset;return t+n>r}}},function(t,e){return function(){if(we){if(!ye.exceptionHandler){throw new $.terminal.Exception(Z().defunctTerminal)}}try{return e.apply(ee,[].slice.apply(arguments))}catch(e){if(t!=="exec"&&t!=="resume"){_(e,e.type||"TERMINAL",true)}if(!ye.exceptionHandler){throw e}}}}));if(ee.length===0){var te=sprintf(Z().invalidSelector);throw new $.terminal.Exception(te)}ee.data("terminal",ee);var ne;var re=0;var ie;var ae=terminals.length();var oe=false;var ue;var se;var le;var fe=new Stack;var ce=new DelayQueue;var pe=new DelayQueue;var me=X(pe);var de=X(ce);var he=false;var De=$.noop;var ve,ge;var _e=[];var ye=$.extend({},$.terminal.defaults,{name:ee.selector,exit:!!(t&&t.login||!t)},t||{});if(typeof ye.width==="number"){ee.width(ye.width)}if(typeof ye.height==="number"){ee.height(ye.height)}var be=get_char_size(ee);delete ye.formatters;var we=false;var Ce=[];var Ee=new n(ye.memory);var xe=ye.enabled;var Fe=false;var $e=false;var ke=true;var Ae;var Te;var Se;var Re;var Be;if(ye.ignoreSystemDescribe===true){ye.describe=false}$(document).bind("ajaxSend.terminal_"+ee.id(),function(e,t){requests.push(t)});var je=$('<div class="terminal-wrapper"/>').appendTo(ee);$(broken_image).hide().appendTo(je);var Le=$('<div class="terminal-font"> </div>').appendTo(ee);var Oe=$('<div class="terminal-fill"/>').appendTo(ee);ie=$("<div>").addClass("terminal-output").attr("role","log").appendTo(je);ee.addClass("terminal");if(ye.login&&M("onBeforeLogin")===false){ke=false}var Ie;if(typeof e==="string"){Ie=e}else if(is_array(e)){for(var Pe=0,ze=e.length;Pe<ze;++Pe){if(typeof e[Pe]==="string"){Ie=e[Pe];break}}}var Ne;if(is_function(ye.login)){Ne=ye.login}else if(Ie&&(typeof ye.login==="string"||ye.login===true)){Ne=g(Ie,ye.login)}terminals.append(ee);function He(){if(Se){ee.focus()}}function Me(){Se=xe;ee.disable().find(".cmd textarea").trigger("blur",[true])}function Ue(e){if(is_function(e)){e=e()}if(get_type(e)!=="string"){if(is_function(ye.parseObject)){var t=ye.parseObject(e);if(get_type(t)==="string"){e=t}}else if(is_array(e)){e=$.terminal.columns(e,ee.cols(),ye.tabs)}else{e=String(e)}}return e}function qe(t){if(t.proxy){return t}var e=function(e){return t.call(ee,e,ee)};e.proxy=true;return e}function We(e){e=e.originalEvent;function t(e,t){return e.type.indexOf(t)!==-1}function i(e){ee.echo('<img src="'+e+'"/>',{raw:true})}function a(e){var t=window.URL||window.webkitURL;return t.createObjectURL(e)}function o(e,t){if(!t&&is_function(ye.onPaste)){var n={target:ee};if(typeof e==="string"){n["text"]=e}else if(e instanceof Blob){n["image"]=a(e)}var r=M("onPaste",[n]);if(r){if(is_function(r.then||r.done)){return(r.then||r.done).call(r,function(e){o(e,true)})}else{o(r,true)}}else{o(n.image||n.text,true)}}else if(e instanceof Blob){i(a(e))}else if(typeof e==="string"){if(e.match(/^(data:|blob:)/)){i(e)}else{ee.insert(e)}}}if(e.clipboardData){if(ee.enabled()){var n=e.clipboardData.items;if(n){for(var r=0;r<n.length;r++){if(t(n[r],"image")&&ye.pasteImage){var u=n[r].getAsFile();o(u)}else if(t(n[r],"text/plain")){n[r].getAsString(o)}}}else if(e.clipboardData.getData){var s=e.clipboardData.getData("text/plain");o(s)}return false}}}$(document).on("paste.terminal_"+ee.id(),We);var Ke=$.extend({},Y,$.omap(ye.keymap||{},function(n,r){if(!Y[n]){return r.bind(ee)}return function(e,t){return r.call(ee,e,function(){return Y[n](e,t)})}}));l(e,ye.login,function(e){if(ye.completion&&typeof ye.completion!=="boolean"||!ye.completion){e.completion="settings"}var t=ye.prompt;if(is_function(t)){t=qe(t)}Ae=new Stack($.extend({},ye.extra,{name:ye.name,prompt:t,keypress:ye.keypress,keydown:ye.keydown,resize:ye.onResize,greetings:ye.greetings,mousewheel:ye.mousewheel,history:ye.history,keymap:Ke},e));Te=$("<div/>").appendTo(je).cmd({tabindex:ye.tabindex,mobileDelete:ye.mobileDelete,mobileIngoreAutoSpace:ye.mobileIngoreAutoSpace,prompt:Ne?false:t,history:ye.memory?"memory":ye.history,historyFilter:ye.historyFilter,historySize:ye.historySize,caseSensitiveSearch:ye.caseSensitiveSearch,onPaste:ye.onPaste,width:"100%",enabled:false,char_width:be.width,keydown:G,keymap:Ke,clickTimeout:ye.clickTimeout,holdTimeout:ye.holdTimeout,holdRepeatTimeout:ye.holdRepeatTimeout,repeatTimeoutKeys:ye.repeatTimeoutKeys,keypress:V,tabs:ye.tabs,onPositionChange:function(){var e=[].slice.call(arguments);q();M("onPositionChange",e)},onCommandChange:function(e){if(ve!==Oe.width()){ee.resizer()}M("onCommandChange",[e]);q()},commands:I});function n(e){e=e.originalEvent;if(e){var t=document.elementFromPoint(e.clientX,e.clientY);if(!$(t).closest(".terminal").length&&ee.enabled()){ee.disable()}}}ee.oneTime(100,function(){$(document).bind("click.terminal_"+ee.id(),n).bind("contextmenu.terminal_"+ee.id(),n)});var r=$(window);document.addEventListener("resume",function(){ee.disable()});if(is_mobile){ee.click(function(){if(!Fe){if(!ee.enabled()){ee.focus();Te.enable()}else{ee.disable()}}})}else{r.on("focus.terminal_"+ee.id(),He).on("blur.terminal_"+ee.id(),Me);(function(){var t=0;var n;var r="click_"+ee.id();var i=ee.find(".cmd textarea");function a(){if(n.is(".terminal")||n.is(".terminal-wrapper")){var e=ee.get_command().length;ee.set_position(e)}else if(n.closest(".cmd-prompt").length){ee.set_position(0)}if(!i.is(":focus")){i.focus()}o()}function o(){t=0;n=null}var u=".terminal-output textarea,"+".terminal-output input";ee.mousedown(function(e){if(!scrollbar_event(e,Oe)){n=$(e.target)}}).mouseup(function(){if(n&&n.closest(u).length){if(xe){ee.disable()}}else if(get_selected_html()===""&&n){if(++t===1){if(!Fe){if(!xe){ee.focus()}else{var e=ye.clickTimeout;ee.oneTime(e,r,a);return}}}else{ee.stopTime(r)}}o()}).dblclick(function(){o();ee.stopTime(r)})})();(function(){var n=ee.find(".cmd textarea");function r(e){return e.type==="mousedown"&&e.buttons===2||e.type==="contextmenu"}ee.on("contextmenu.terminal mousedown.terminal",function(e){if(get_selected_html()===""&&r(e)){if(!$(e.target).is("img,value,audio,object,canvas,a")){if(!ee.enabled()){ee.enable()}var t=Te.offset();je.css("overflow","hidden");n.css({left:e.pageX-t.left-20,top:e.pageY-t.top-20,width:"5em",height:"4em"});if(!n.is(":focus")){n.focus()}ee.stopTime("textarea");ee.oneTime(100,"textarea",function(){var e={left:"",top:"",width:"",height:""};if(!is_css_variables_supported){var t=ee.find(".cmd .cmd-cursor-line").prevUntil(".cmd-prompt").length;e.top=t*14+"px"}n.css(e);je.css("overflow","")});ee.stopTime("selection");ee.everyTime(20,"selection",function(){if(n[0].selection!==n[0].value){if(get_textarea_selection(n[0])){clear_textarea_selection(n[0]);select(ee.find(".terminal-output")[0],ee.find(".cmd div:last-of-type")[0]);ee.stopTime("selection")}}})}}})})()}ee.on("click","a",function(e){var t=$(this);if(t.closest(".terminal-exception").length){var n=t.attr("href");if(n.match(/:[0-9]+$/)){e.preventDefault();c(n,ee.cols())}}if(xe){ee.find(".cmd textarea").focus()}});function i(){var e=be.width;be=get_char_size(ee);if(e!==be.width){Te.option("char_width",be.width).refresh()}}a();function a(){if(ee.is(":visible")){var e=Oe.width();var t=Oe.height();if(ge!==t||ve!==e){ee.resize()}ge=t;ve=e}}function o(){var e={prefix:"terminal-"};ee.resizer("unbind").resizer(a,e);Le.resizer("unbind").resizer(function(){i();ee.resize()},e)}if(ee.is(":visible")){o()}function u(){if(Re){if(Re.unobserve){Re.unobserve(ee[0])}else{clearInterval(Re)}}var e=ee.enabled();var t=ee.is(":visible");if(e&&!t){ee.disable()}if(t){o()}else{je.css("visibility","hidden")}function n(){if(ee.is(":visible")&&!t){t=true;o();i();a();if(e){ee.enable()}je.css("visibility","")}else if(t&&!ee.is(":visible")){t=false;e=$.terminal.active()===ee&&ee.enabled();ee.disable();je.css("visibility","hidden")}}if(window.IntersectionObserver&&ee.css("position")!=="fixed"){Re=new IntersectionObserver(n,{root:null});Re.observe(ee[0])}else{Re=setInterval(n,100)}}var s=!!ee.closest("body").length;var l=window.MutationObserver||window.WebKitMutationObserver;if(l){Be=new l(function(){if(ee.closest("body").length){if(!s){ee.scroll_to_bottom();if(window.IntersectionObserver){u()}a()}s=true}else if(s){s=false}});Be.observe(document.body,{childList:true})}if(s){u()}ce.resolve();if(xe&&ee.is(":visible")&&!is_mobile){ee.focus(undefined,true)}else{ee.disable()}if(is_function(Ne)){ee.login(Ne,true,K)}else{K()}function f(e){var t=terminals.get()[e[0]];if(t&&ae===t.id()){if(!e[2]){n.resolve();return n.promise()}else if($e){var n=$.Deferred();O.push(function(){return t.exec(e[2]).done(function(){t.save_state(e[2],true,e[1]);n.resolve()})});return n.promise()}else{return t.exec(e[2]).done(function(){t.save_state(e[2],true,e[1])})}}}if(ye.execHash){if(location.hash){setTimeout(function(){try{var e=location.hash.replace(/^#/,"");hash_commands=JSON.parse(decodeURIComponent(e));var n=0;(function e(){var t=hash_commands[n++];if(t){f(t).done(e)}else{change_hash=true}})()}catch(e){}})}else{change_hash=true}}else{change_hash=true}(function(){var i=false;$(document).bind("keydown.terminal_"+ee.id(),function(e){if(e.shiftKey){i=true}}).bind("keyup.terminal_"+ee.id(),function(e){if(e.shiftKey||e.which===16){i=false}});function n(e,t){if(!i){var n=Ae.top();var r;if(is_function(n.mousewheel)){r=n.mousewheel(e,t,ee)}else if(is_function(ye.mousewheel)){r=ye.mousewheel(e,t,ee)}if(r===true){return}if((S()||r===false)&&!e.ctrlKey){e.stopPropagation();e.preventDefault()}if(r===false){return false}if(t>0){ee.scroll(-40)}else{ee.scroll(40)}}}if($.event.special.mousewheel){ee.on("mousewheel",n)}else{var r;var e=document.createElement("div");if("onwheel"in e){r="wheel"}else if(document.onmousewheel!==undefined){r="mousewheel"}else{r="DOMMouseScroll"}e=null;ee.on(r,function(e){var t;if(r==="mousewheel"){t=-1/40*e.originalEvent.wheelDelta}else{t=e.originalEvent.deltaY||e.originalEvent.detail}n(e,-t)})}})()});return ee}});
//# sourceMappingURL=jquery.terminal.min.js.map