You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
238 KiB

"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function handler(e){return e.returnValue="Are you sure?",e.returnValue}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};if(void 0!==lib)throw new Error('Global "lib" object already exists.');var lib={};if(lib.runtimeDependencies_={},lib.initCallbacks_=[],lib.rtdep=function(e){var t;try{throw new Error}catch(e){var r=e.stack.split("\n");t=r.length>=3?r[2].replace(/^\s*at\s+/,""):r[1].replace(/^\s*global code@/,"")}for(var o=0;o<arguments.length;o++){var i=arguments[o];if(i instanceof Array)lib.rtdep.apply(lib,i);else{var s=this.runtimeDependencies_[i];s||(s=this.runtimeDependencies_[i]=[]),s.push(t)}}},lib.ensureRuntimeDependencies_=function(){var e=!0;for(var t in lib.runtimeDependencies_)for(var r=lib.runtimeDependencies_[t],o=t.split("."),i=window||self,s=0;s<o.length;s++){if(!(o[s]in i)){console.warn('Missing "'+t+'" is needed by',r),e=!1;break}i=i[o[s]]}if(!e)throw new Error("Failed runtime dependency check")},lib.registerInit=function(e,t){return lib.initCallbacks_.push([e,t]),t},lib.init=function(e,t){var r=lib.initCallbacks_;if("function"!=typeof e)throw new Error("Missing or invalid argument: onInit");lib.ensureRuntimeDependencies_(),setTimeout(function o(){if(r.length){var i=r.shift();t&&t("init: "+i[0]),i[1](lib.f.alarm(o))}else e()},0)},String.prototype.padStart||(String.prototype.padStart=function(e,t){return(e-=this.length)<=0?String(this):(void 0===t&&(t=" "),e>t.length&&(t=t.repeat(e/t.length+1)),t.slice(0,e)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(e,t){return(e-=this.length)<=0?String(this):(void 0===t&&(t=" "),e>t.length&&(t=t.repeat(e/t.length+1)),String(this)+t.slice(0,e))}),!Object.values||!Object.entries){var reduce=Function.bind.call(Function.call,Array.prototype.reduce),isEnumerable=Function.bind.call(Function.call,Object.prototype.propertyIsEnumerable),concat=Function.bind.call(Function.call,Array.prototype.concat);Object.values||(Object.values=function(e){return reduce(Reflect.ownKeys(e),function(t,r){return concat(t,"string"==typeof r&&isEnumerable(e,r)?[e[r]]:[])},[])}),Object.entries||(Object.entries=function(e){return reduce(Reflect.ownKeys(e),function(t,r){return concat(t,"string"==typeof r&&isEnumerable(e,r)?[[r,e[r]]]:[])},[])})}lib.array={},lib.array.arrayBigEndianToUint32=function(e){return(e[0]<<24|e[1]<<16|e[2]<<8|e[3]<<0)>>>0},lib.array.uint32ToArrayBigEndian=function(e){return[e>>>24&255,e>>>16&255,e>>>8&255,e>>>0&255]},lib.array.concatTyped=function(){for(var e=0,t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var i=!0,s=!1,n=void 0;try{for(var a,l=r[Symbol.iterator]();!(i=(a=l.next()).done);i=!0)e+=a.value.length}catch(e){s=!0,n=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw n}}var h=new r[0].constructor(e),c=0,u=!0,d=!1,g=void 0;try{for(var p,m=r[Symbol.iterator]();!(u=(p=m.next()).done);u=!0){var b=p.value;h.set(b,c),c+=b.length}}catch(e){d=!0,g=e}finally{try{!u&&m.return&&m.return()}finally{if(d)throw g}}return h},lib.array.compare=function(e,t){if(null===e||null===t)return null===e&&null===t;if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},lib.colors={},lib.colors.re_={hex16:/#([a-f0-9])([a-f0-9])([a-f0-9])/i,hex24:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/i,rgb:new RegExp("^/s*rgb/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*/)/s*$".replace(/\//g,"\\"),"i"),rgba:new RegExp("^/s*rgba/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)/)/s*$".replace(/\//g,"\\"),"i"),rgbx:new RegExp("^/s*rgba?/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)?/)/s*$".replace(/\//g,"\\"),"i"),x11rgb:/^\s*rgb:([a-f0-9]{1,4})\/([a-f0-9]{1,4})\/([a-f0-9]{1,4})\s*$/i,name:/[a-z][a-z0-9\s]+/},lib.colors.rgbToX11=function(e){function t(e){return e=(257*Math.min(e,255)).toString(16),lib.f.zpad(e,4)}var r=e.match(lib.colors.re_.rgbx);return r?"rgb:"+t(r[1])+"/"+t(r[2])+"/"+t(r[3]):null},lib.colors.x11HexToCSS=function(e){if(!e.startsWith("#"))return null;if(e=e.substr(1),-1==[3,6,9,12].indexOf(e.length))return null;if(e.match(/[^a-f0-9]/i))return null;var t=e.length/3,r=e.substr(0,t),o=e.substr(t,t),i=e.substr(t+t,t);return lib.colors.arrayToRGBA([r,o,i].map(function(e){return e=parseInt(e,16),2==t?e:1==t?e<<4:e>>4*(t-2)}))},lib.colors.x11ToCSS=function(e){var t=e.match(lib.colors.re_.x11rgb);return t?(t.splice(0,1),lib.colors.arrayToRGBA(t.map(function(e){return 1==e.length?parseInt(e+e,16):2==e.length?parseInt(e,16):(3==e.length&&(e+=e.substr(2)),Math.round(parseInt(e,16)/257))}))):e.startsWith("#")?lib.colors.x11HexToCSS(e):lib.colors.nameToRGB(e)},lib.colors.hexToRGB=function(e){function t(e){4==e.length&&(e=e.replace(r,function(e,t,r,o){return"#"+t+t+r+r+o+o}));var t=e.match(o);return t?"rgb("+parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16)+")":null}var r=lib.colors.re_.hex16,o=lib.colors.re_.hex24;if(e instanceof Array)for(var i=0;i<e.length;i++)e[i]=t(e[i]);else e=t(e);return e},lib.colors.rgbToHex=function(e){function t(e){var t=lib.colors.crackRGB(e);return t?"#"+lib.f.zpad((parseInt(t[0])<<16|parseInt(t[1])<<8|parseInt(t[2])<<0).toString(16),6):null}if(e instanceof Array)for(var r=0;r<e.length;r++)e[r]=t(e[r]);else e=t(e);return e},lib.colors.normalizeCSS=function(e){return e.startsWith("#")?lib.colors.hexToRGB(e):lib.colors.re_.rgbx.test(e)?e:lib.colors.nameToRGB(e)},lib.colors.arrayToRGBA=function(e){var t=e.length>3?e[3]:1;return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+t+")"},lib.colors.setAlpha=function(e,t){var r=lib.colors.crackRGB(e);return r[3]=t,lib.colors.arrayToRGBA(r)},lib.colors.mix=function(e,t,r){for(var o=lib.colors.crackRGB(e),i=lib.colors.crackRGB(t),s=0;s<4;++s){var n=i[s]-o[s];o[s]=Math.round(parseInt(o[s])+n*r)}return lib.colors.arrayToRGBA(o)},lib.colors.crackRGB=function(e){if(e.startsWith("rgba")){if(t=e.match(lib.colors.re_.rgba))return t.shift(),t}else{var t=e.match(lib.colors.re_.rgb);if(t)return t.shift(),t.push("1"),t}return console.error("Couldn't crack: "+e),null},lib.colors.nameToRGB=function(e){return e in lib.colors.colorNames?lib.colors.colorNames[e]:(e=e.toLowerCase())in lib.colors.colorNames?lib.colors.colorNames[e]:(e=e.replace(/\s+/g,""))in lib.colors.colorNames?lib.colors.colorNames[e]:null},lib.colors.stockColorPalette=lib.colors.hexToRGB(["#000000","#CC0000","#4E9A06","#C4A000","#3465A4","#75507B","#06989A","#D3D7CF","#555753","#EF2929","#00BA13","#FCE94F","#729FCF","#F200CB","#00B5BD","#EEEEEC","#000000","#00005F","#000087","#0000AF","#0000D7","#0000FF","#005F00","#005F5F","#005F87","#005FAF","#005FD7","#005FFF","#008700","#00875F","#008787","#0087AF","#0087D7","#0087FF","#00AF00","#00AF5F","#00AF87","#00AFAF","#00AFD7","#00AFFF","#00D700","#00D75F","#00D787","#00D7AF","#00D7D7","#00D7FF","#00FF00","#00FF5F","#00FF87","#00FFAF","#00FFD7","#00FFFF","#5F0000","#5F005F","#5F0087","#5F00AF","#5F00D7","#5F00FF","#5F5F00","#5F5F5F","#5F5F87","#5F5FAF","#5F5FD7","#5F5FFF","#5F8700","#5F875F","#5F8787","#5F87AF","#5F87D7","#5F87FF","#5FAF00","#5FAF5F","#5FAF87","#5FAFAF","#5FAFD7","#5FAFFF","#5FD700","#5FD75F","#5FD787","#5FD7AF","#5FD7D7","#5FD7FF","#5FFF00","#5FFF5F","#5FFF87","#5FFFAF","#5FFFD7","#5FFFFF","#870000","#87005F","#870087","#8700AF","#8700D7","#8700FF","#875F00","#875F5F","#875F87","#875FAF","#875FD7","#875FFF","#878700","#87875F","#878787","#8787AF","#8787D7","#8787FF","#87AF00","#87AF5F","#87AF87","#87AFAF","#87AFD7","#87AFFF","#87D700","#87D75F","#87D787","#87D7AF","#87D7D7","#87D7FF","#87FF00","#87FF5F","#87FF87","#87FFAF","#87FFD7","#87FFFF","#AF0000","#AF005F","#AF0087","#AF00AF","#AF00D7","#AF00FF","#AF5F00","#AF5F5F","#AF5F87","#AF5FAF","#AF5FD7","#AF5FFF","#AF8700","#AF875F","#AF8787","#AF87AF","#AF87D7","#AF87FF","#AFAF00","#AFAF5F","#AFAF87","#AFAFAF","#AFAFD7","#AFAFFF","#AFD700","#AFD75F","#AFD787","#AFD7AF","#AFD7D7","#AFD7FF","#AFFF00","#AFFF5F","#AFFF87","#AFFFAF","#AFFFD7","#AFFFFF","#D70000","#D7005F","#D70087","#D700AF","#D700D7","#D700FF","#D75F00","#D75F5F","#D75F87","#D75FAF","#D75FD7","#D75FFF","#D78700","#D7875F","#D78787","#D787AF","#D787D7","#D787FF","#D7AF00","#D7AF5F","#D7AF87","#D7AFAF","#D7AFD7","#D7AFFF","#D7D700","#D7D75F","#D7D787","#D7D7AF","#D7D7D7","#D7D7FF","#D7FF00","#D7FF5F","#D7FF87","#D7FFAF","#D7FFD7","#D7FFFF","#FF0000","#FF005F","#FF0087","#FF00AF","#FF00D7","#FF00FF","#FF5F00","#FF5F5F","#FF5F87","#FF5FAF","#FF5FD7","#FF5FFF","#FF8700","#FF875F","#FF8787","#FF87AF","#FF87D7","#FF87FF","#FFAF00","#FFAF5F","#FFAF87","#FFAFAF","#FFAFD7","#FFAFFF","#FFD700","#FFD75F","#FFD787","#FFD7AF","#FFD7D7","#FFD7FF","#FFFF00","#FFFF5F","#FFFF87","#FFFFAF","#FFFFD7","#FFFFFF","#080808","#121212","#1C1C1C","#262626","#303030","#3A3A3A","#444444","#4E4E4E","#585858","#626262","#6C6C6C","#767676","#808080","#8A8A8A","#949494","#9E9E9E","#A8A8A8","#B2B2B2","#BCBCBC","#C6C6C6","#D0D0D0","#DADADA","#E4E4E4","#EEEEEE"]),lib.colors.colorPalette=lib.colors.stockColorPalette,lib.colors.colorNames={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",antiquewhite1:"rgb(255, 239, 219)",antiquewhite2:"rgb(238, 223, 204)",antiquewhite3:"rgb(205, 192, 176)",antiquewhite4:"rgb(139, 131, 120)",aquamarine:"rgb(127, 255, 212)",aquamarine1:"rgb(127, 255, 212)",aquamarine2:"rgb(118, 238, 198)",aquamarine3:"rgb(102, 205, 170)",aquamarine4:"rgb(69, 139, 116)",azure:"rgb(240, 255, 255)",azure1:"rgb(240, 255, 255)",azure2:"rgb(224, 238, 238)",azure3:"rgb(193, 205, 205)",azure4:"rgb(131, 139, 139)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",bisque1:"rgb(255, 228, 196)",bisque2:"rgb(238, 213, 183)",bisque3:"rgb(205, 183, 158)",bisque4:"rgb(139, 125, 107)",black:"rgb(0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb(0, 0, 255)",blue1:"rgb(0, 0, 255)",blue2:"rgb(0, 0, 238)",blue3:"rgb(0, 0, 205)",blue4:"rgb(0, 0, 139)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",brown1:"rgb(255, 64, 64)",brown2:"rgb(238, 59, 59)",brown3:"rgb(205, 51, 51)",brown4:"rgb(139, 35, 35)",burlywood:"rgb(222, 184, 135)",burlywood1:"rgb(255, 211, 155)",burlywood2:"rgb(238, 197, 145)",burlywood3:"rgb(205, 170, 125)",burlywood4:"rgb(139, 115, 85)",cadetblue:"rgb(95, 158, 160)",cadetblue1:"rgb(152, 245, 255)",cadetblue2:"rgb(142, 229, 238)",cadetblue3:"rgb(122, 197, 205)",cadetblue4:"rgb(83, 134, 139)",chartreuse:"rgb(127, 255, 0)",chartreuse1:"rgb(127, 255, 0)",chartreuse2:"rgb(118, 238, 0)",chartreuse3:"rgb(102, 205, 0)",chartreuse4:"rgb(69, 139, 0)",chocolate:"rgb(210, 105, 30)",chocolate1:"rgb(255, 127, 36)",chocolate2:"rgb(238, 118, 33)",chocolate3:"rgb(205, 102, 29)",chocolate4:"rgb(139, 69, 19)",coral:"rgb(255, 127, 80)",coral1:"rgb(255, 114, 86)",coral2:"rgb(238, 106, 80)",coral3:"rgb(205, 91, 69)",coral4:"rgb(139, 62, 47)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",cornsilk1:"rgb(255, 248, 220)",cornsilk2:"rgb(238, 232, 205)",cornsilk3:"rgb(205, 200, 177)",cornsilk4:"rgb(139, 136, 120)",cyan:"rgb(0, 255, 255)",cyan1:"rgb(0, 255, 255)",cyan2:"rgb(0, 238, 238)",cyan3:"rgb(0, 205, 205)",cyan4:"rgb(0, 139, 139)",darkblue:"rgb(0, 0, 139)",darkcyan:"rgb(0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgoldenrod1:"rgb(255, 185, 15)",darkgoldenrod2:"rgb(238, 173, 14)",darkgoldenrod3:"rgb(205, 149, 12)",darkgoldenrod4:"rgb(139, 101, 8)",darkgray:"rgb(169, 169, 169)",darkgreen:"rgb(0, 100, 0)",darkgrey:"rgb(169, 169, 169)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb(85, 107, 47)",darkolivegreen1:"rgb(202, 255, 112)",darkolivegreen2:"rgb(188, 238, 104)",darkolivegreen3:"rgb(162, 205, 90)",darkolivegreen4:"rgb(110, 139, 61)",darkorange:"rgb(255, 140, 0)",darkorange1:"rgb(255, 127, 0)",darkorange2:"rgb(238, 118, 0)",darkorange3:"rgb(205, 102, 0)",darkorange4:"rgb(139, 69, 0)",darkorchid:"rgb(153, 50, 204)",darkorchid1:"rgb(191, 62, 255)",darkorchid2:"rgb(178, 58, 238)",darkorchid3:"rgb(154, 50, 205)",darkorchid4:"rgb(104, 34, 139)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkseagreen1:"rgb(193, 255, 193)",darkseagreen2:"rgb(180, 238, 180)",darkseagreen3:"rgb(155, 205, 155)",darkseagreen4:"rgb(105, 139, 105)",darkslateblue:"rgb(72, 61, 139)",darkslategray:"rgb(47, 79, 79)",darkslategray1:"rgb(151, 255, 255)",darkslategray2:"rgb(141, 238, 238)",darkslategray3:"rgb(121, 205, 205)",darkslategray4:"rgb(82, 139, 139)",darkslategrey:"rgb(47, 79, 79)",darkturquoise:"rgb(0, 206, 209)",darkviolet:"rgb(148, 0, 211)",debianred:"rgb(215, 7, 81)",deeppink:"rgb(255, 20, 147)",deeppink1:"rgb(255, 20, 147)",deeppink2:"rgb(238, 18, 137)",deeppink3:"rgb(205, 16, 118)",deeppink4:"rgb(139, 10, 80)",deepskyblue:"rgb(0, 191, 255)",deepskyblue1:"rgb(0, 191, 255)",deepskyblue2:"rgb(0, 178, 238)",deepskyblue3:"rgb(0, 154, 205)",deepskyblue4:"rgb(0, 104, 139)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb(30, 144, 255)",dodgerblue1:"rgb(30, 144, 255)",dodgerblue2:"rgb(28, 134, 238)",dodgerblue3:"rgb(24, 116, 205)",dodgerblue4:"rgb(16, 78, 139)",firebrick:"rgb(178, 34, 34)",firebrick1:"rgb(255, 48, 48)",firebrick2:"rgb(238, 44, 44)",firebrick3:"rgb(205, 38, 38)",firebrick4:"rgb(139, 26, 26)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb(34, 139, 34)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",gold1:"rgb(255, 215, 0)",gold2:"rgb(238, 201, 0)",gold3:"rgb(205, 173, 0)",gold4:"rgb(139, 117, 0)",goldenrod:"rgb(218, 165, 32)",goldenrod1:"rgb(255, 193, 37)",goldenrod2:"rgb(238, 180, 34)",goldenrod3:"rgb(205, 155, 29)",goldenrod4:"rgb(139, 105, 20)",gray:"rgb(190, 190, 190)",gray0:"rgb(0, 0, 0)",gray1:"rgb(3, 3, 3)",gray10:"rgb(26, 26, 26)",gray100:"rgb(255, 255, 255)",gray11:"rgb(28, 28, 28)",gray12:"rgb(31, 31, 31)",gray13:"rgb(33, 33, 33)",gray14:"rgb(36, 36, 36)",gray15:"rgb(38, 38, 38)",gray16:"rgb(41, 41, 41)",gray17:"rgb(43, 43, 43)",gray18:"rgb(46, 46, 46)",gray19:"rgb(48, 48, 48)",gray2:"rgb(5, 5, 5)",gray20:"rgb(51, 51, 51)",gray21:"rgb(54, 54, 54)",gray22:"rgb(56, 56, 56)",gray23:"rgb(59, 59, 59)",gray24:"rgb(61, 61, 61)",gray25:"rgb(64, 64, 64)",gray26:"rgb(66, 66, 66)",gray27:"rgb(69, 69, 69)",gray28:"rgb(71, 71, 71)",gray29:"rgb(74, 74, 74)",gray3:"rgb(8, 8, 8)",gray30:"rgb(77, 77, 77)",gray31:"rgb(79, 79, 79)",gray32:"rgb(82, 82, 82)",gray33:"rgb(84, 84, 84)",gray34:"rgb(87, 87, 87)",gray35:"rgb(89, 89, 89)",gray36:"rgb(92, 92, 92)",gray37:"rgb(94, 94, 94)",gray38:"rgb(97, 97, 97)",gray39:"rgb(99, 99, 99)",gray4:"rgb(10, 10, 10)",gray40:"rgb(102, 102, 102)",gray41:"rgb(105, 105, 105)",gray42:"rgb(107, 107, 107)",gray43:"rgb(110, 110, 110)",gray44:"rgb(112, 112, 112)",gray45:"rgb(115, 115, 115)",gray46:"rgb(117, 117, 117)",gray47:"rgb(120, 120, 120)",gray48:"rgb(122, 122, 122)",gray49:"rgb(125, 125, 125)",gray5:"rgb(13, 13, 13)",gray50:"rgb(127, 127, 127)",gray51:"rgb(130, 130, 130)",gray52:"rgb(133, 133, 133)",gray53:"rgb(135, 135, 135)",gray54:"rgb(138, 138, 138)",gray55:"rgb(140, 140, 140)",gray56:"rgb(143, 143, 143)",gray57:"rgb(145, 145, 145)",gray58:"rgb(148, 148, 148)",gray59:"rgb(150, 150, 150)",gray6:"rgb(15, 15, 15)",gray60:"rgb(153, 153, 153)",gray61:"rgb(156, 156, 156)",gray62:"rgb(158, 158, 158)",gray63:"rgb(161, 161, 161)",gray64:"rgb(163, 163, 163)",gray65:"rgb(166, 166, 166)",gray66:"rgb(168, 168, 168)",gray67:"rgb(171, 171, 171)",gray68:"rgb(173, 173, 173)",gray69:"rgb(176, 176, 176)",gray7:"rgb(18, 18, 18)",gray70:"rgb(179, 179, 179)",gray71:"rgb(181, 181, 181)",gray72:"rgb(184, 184, 184)",gray73:"rgb(186, 186, 186)",gray74:"rgb(189, 189, 189)",gray75:"rgb(191, 191, 191)",gray76:"rgb(194, 194, 194)",gray77:"rgb(196, 196, 196)",gray78:"rgb(199, 199, 199)",gray79:"rgb(201, 201, 201)",gray8:"rgb(20, 20, 20)",gray80:"rgb(204, 204, 204)",gray81:"rgb(207, 207, 207)",gray82:"rgb(209, 209, 209)",gray83:"rgb(212, 212, 212)",gray84:"rgb(214, 214, 214)",gray85:"rgb(217, 217, 217)",gray86:"rgb(219, 219, 219)",gray87:"rgb(222, 222, 222)",gray88:"rgb(224, 224, 224)",gray89:"rgb(227, 227, 227)",gray9:"rgb(23, 23, 23)",gray90:"rgb(229, 229, 229)",gray91:"rgb(232, 232, 232)",gray92:"rgb(235, 235, 235)",gray93:"rgb(237, 237, 237)",gray94:"rgb(240, 240, 240)",gray95:"rgb(242, 242, 242)",gray96:"rgb(245, 245, 245)",gray97:"rgb(247, 247, 247)",gray98:"rgb(250, 250, 250)",gray99:"rgb(252, 252, 252)",green:"rgb(0, 255, 0)",green1:"rgb(0, 255, 0)",green2:"rgb(0, 238, 0)",green3:"rgb(0, 205, 0)",green4:"rgb(0, 139, 0)",greenyellow:"rgb(173, 255, 47)",grey:"rgb(190, 190, 190)",grey0:"rgb(0, 0, 0)",grey1:"rgb(3, 3, 3)",grey10:"rgb(26, 26, 26)",grey100:"rgb(255, 255, 255)",grey11:"rgb(28, 28, 28)",grey12:"rgb(31, 31, 31)",grey13:"rgb(33, 33, 33)",grey14:"rgb(36, 36, 36)",grey15:"rgb(38, 38, 38)",grey16:"rgb(41, 41, 41)",grey17:"rgb(43, 43, 43)",grey18:"rgb(46, 46, 46)",grey19:"rgb(48, 48, 48)",grey2:"rgb(5, 5, 5)",grey20:"rgb(51, 51, 51)",grey21:"rgb(54, 54, 54)",grey22:"rgb(56, 56, 56)",grey23:"rgb(59, 59, 59)",grey24:"rgb(61, 61, 61)",grey25:"rgb(64, 64, 64)",grey26:"rgb(66, 66, 66)",grey27:"rgb(69, 69, 69)",grey28:"rgb(71, 71, 71)",grey29:"rgb(74, 74, 74)",grey3:"rgb(8, 8, 8)",grey30:"rgb(77, 77, 77)",grey31:"rgb(79, 79, 79)",grey32:"rgb(82, 82, 82)",grey33:"rgb(84, 84, 84)",grey34:"rgb(87, 87, 87)",grey35:"rgb(89, 89, 89)",grey36:"rgb(92, 92, 92)",grey37:"rgb(94, 94, 94)",grey38:"rgb(97, 97, 97)",grey39:"rgb(99, 99, 99)",grey4:"rgb(10, 10, 10)",grey40:"rgb(102, 102, 102)",grey41:"rgb(105, 105, 105)",grey42:"rgb(107, 107, 107)",grey43:"rgb(110, 110, 110)",grey44:"rgb(112, 112, 112)",grey45:"rgb(115, 115, 115)",grey46:"rgb(117, 117, 117)",grey47:"rgb(120, 120, 120)",grey48:"rgb(122, 122, 122)",grey49:"rgb(125, 125, 125)",grey5:"rgb(13, 13, 13)",grey50:"rgb(127, 127, 127)",grey51:"rgb(130, 130, 130)",grey52:"rgb(133, 133, 133)",grey53:"rgb(135, 135, 135)",grey54:"rgb(138, 138, 138)",grey55:"rgb(140, 140, 140)",grey56:"rgb(143, 143, 143)",grey57:"rgb(145, 145, 145)",grey58:"rgb(148, 148, 148)",grey59:"rgb(150, 150, 150)",grey6:"rgb(15, 15, 15)",grey60:"rgb(153, 153, 153)",grey61:"rgb(156, 156, 156)",grey62:"rgb(158, 158, 158)",grey63:"rgb(161, 161, 161)",grey64:"rgb(163, 163, 163)",grey65:"rgb(166, 166, 166)",grey66:"rgb(168, 168, 168)",grey67:"rgb(171, 171, 171)",grey68:"rgb(173, 173, 173)",grey69:"rgb(176, 176, 176)",grey7:"rgb(18, 18, 18)",grey70:"rgb(179, 179, 179)",grey71:"rgb(181, 181, 181)",grey72:"rgb(184, 184, 184)",grey73:"rgb(186, 186, 186)",grey74:"rgb(189, 189, 189)",grey75:"rgb(191, 191, 191)",grey76:"rgb(194, 194, 194)",grey77:"rgb(196, 196, 196)",grey78:"rgb(199, 199, 199)",grey79:"rgb(201, 201, 201)",grey8:"rgb(20, 20, 20)",grey80:"rgb(204, 204, 204)",grey81:"rgb(207, 207, 207)",grey82:"rgb(209, 209, 209)",grey83:"rgb(212, 212, 212)",grey84:"rgb(214, 214, 214)",grey85:"rgb(217, 217, 217)",grey86:"rgb(219, 219, 219)",grey87:"rgb(222, 222, 222)",grey88:"rgb(224, 224, 224)",grey89:"rgb(227, 227, 227)",grey9:"rgb(23, 23, 23)",grey90:"rgb(229, 229, 229)",grey91:"rgb(232, 232, 232)",grey92:"rgb(235, 235, 235)",grey93:"rgb(237, 237, 237)",grey94:"rgb(240, 240, 240)",grey95:"rgb(242, 242, 242)",grey96:"rgb(245, 245, 245)",grey97:"rgb(247, 247, 247)",grey98:"rgb(250, 250, 250)",grey99:"rgb(252, 252, 252)",honeydew:"rgb(240, 255, 240)",honeydew1:"rgb(240, 255, 240)",honeydew2:"rgb(224, 238, 224)",honeydew3:"rgb(193, 205, 193)",honeydew4:"rgb(131, 139, 131)",hotpink:"rgb(255, 105, 180)",hotpink1:"rgb(255, 110, 180)",hotpink2:"rgb(238, 106, 167)",hotpink3:"rgb(205, 96, 144)",hotpink4:"rgb(139, 58, 98)",indianred:"rgb(205, 92, 92)",indianred1:"rgb(255, 106, 106)",indianred2:"rgb(238, 99, 99)",indianred3:"rgb(205, 85, 85)",indianred4:"rgb(139, 58, 58)",ivory:"rgb(255, 255, 240)",ivory1:"rgb(255, 255, 240)",ivory2:"rgb(238, 238, 224)",ivory3:"rgb(205, 205, 193)",ivory4:"rgb(139, 139, 131)",khaki:"rgb(240, 230, 140)",khaki1:"rgb(255, 246, 143)",khaki2:"rgb(238, 230, 133)",khaki3:"rgb(205, 198, 115)",khaki4:"rgb(139, 134, 78)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lavenderblush1:"rgb(255, 240, 245)",lavenderblush2:"rgb(238, 224, 229)",lavenderblush3:"rgb(205, 193, 197)",lavenderblush4:"rgb(139, 131, 134)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lemonchiffon1:"rgb(255, 250, 205)",lemonchiffon2:"rgb(238, 233, 191)",lemonchiffon3:"rgb(205, 201, 165)",lemonchiffon4:"rgb(139, 137, 112)",lightblue:"rgb(173, 216, 230)",lightblue1:"rgb(191, 239, 255)",lightblue2:"rgb(178, 223, 238)",lightblue3:"rgb(154, 192, 205)",lightblue4:"rgb(104, 131, 139)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightcyan1:"rgb(224, 255, 255)",lightcyan2:"rgb(209, 238, 238)",lightcyan3:"rgb(180, 205, 205)",lightcyan4:"rgb(122, 139, 139)",lightgoldenrod:"rgb(238, 221, 130)",lightgoldenrod1:"rgb(255, 236, 139)",lightgoldenrod2:"rgb(238, 220, 130)",lightgoldenrod3:"rgb(205, 190, 112)",lightgoldenrod4:"rgb(139, 129, 76)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgray:"rgb(211, 211, 211)",lightgreen:"rgb(144, 238, 144)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightpink1:"rgb(255, 174, 185)",lightpink2:"rgb(238, 162, 173)",lightpink3:"rgb(205, 140, 149)",lightpink4:"rgb(139, 95, 101)",lightsalmon:"rgb(255, 160, 122)",lightsalmon1:"rgb(255, 160, 122)",lightsalmon2:"rgb(238, 149, 114)",lightsalmon3:"rgb(205, 129, 98)",lightsalmon4:"rgb(139, 87, 66)",lightseagreen:"rgb(32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightskyblue1:"rgb(176, 226, 255)",lightskyblue2:"rgb(164, 211, 238)",lightskyblue3:"rgb(141, 182, 205)",lightskyblue4:"rgb(96, 123, 139)",lightslateblue:"rgb(132, 112, 255)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightsteelblue1:"rgb(202, 225, 255)",lightsteelblue2:"rgb(188, 210, 238)",lightsteelblue3:"rgb(162, 181, 205)",lightsteelblue4:"rgb(110, 123, 139)",lightyellow:"rgb(255, 255, 224)",lightyellow1:"rgb(255, 255, 224)",lightyellow2:"rgb(238, 238, 209)",lightyellow3:"rgb(205, 205, 180)",lightyellow4:"rgb(139, 139, 122)",limegreen:"rgb(50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",magenta1:"rgb(255, 0, 255)",magenta2:"rgb(238, 0, 238)",magenta3:"rgb(205, 0, 205)",magenta4:"rgb(139, 0, 139)",maroon:"rgb(176, 48, 96)",maroon1:"rgb(255, 52, 179)",maroon2:"rgb(238, 48, 167)",maroon3:"rgb(205, 41, 144)",maroon4:"rgb(139, 28, 98)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb(0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumorchid1:"rgb(224, 102, 255)",mediumorchid2:"rgb(209, 95, 238)",mediumorchid3:"rgb(180, 82, 205)",mediumorchid4:"rgb(122, 55, 139)",mediumpurple:"rgb(147, 112, 219)",mediumpurple1:"rgb(171, 130, 255)",mediumpurple2:"rgb(159, 121, 238)",mediumpurple3:"rgb(137, 104, 205)",mediumpurple4:"rgb(93, 71, 139)",mediumseagreen:"rgb(60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb(0, 250, 154)",mediumturquoise:"rgb(72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb(25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",mistyrose1:"rgb(255, 228, 225)",mistyrose2:"rgb(238, 213, 210)",mistyrose3:"rgb(205, 183, 181)",mistyrose4:"rgb(139, 125, 123)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navajowhite1:"rgb(255, 222, 173)",navajowhite2:"rgb(238, 207, 161)",navajowhite3:"rgb(205, 179, 139)",navajowhite4:"rgb(139, 121, 94)",navy:"rgb(0, 0, 128)",navyblue:"rgb(0, 0, 128)",oldlace:"rgb(253, 245, 230)",olivedrab:"rgb(107, 142, 35)",olivedrab1:"rgb(192, 255, 62)",olivedrab2:"rgb(179, 238, 58)",olivedrab3:"rgb(154, 205, 50)",olivedrab4:"rgb(105, 139, 34)",orange:"rgb(255, 165, 0)",orange1:"rgb(255, 165, 0)",orange2:"rgb(238, 154, 0)",orange3:"rgb(205, 133, 0)",orange4:"rgb(139, 90, 0)",orangered:"rgb(255, 69, 0)",orangered1:"rgb(255, 69, 0)",orangered2:"rgb(238, 64, 0)",orangered3:"rgb(205, 55, 0)",orangered4:"rgb(139, 37, 0)",orchid:"rgb(218, 112, 214)",orchid1:"rgb(255, 131, 250)",orchid2:"rgb(238, 122, 233)",orchid3:"rgb(205, 105, 201)",orchid4:"rgb(139, 71, 137)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",palegreen1:"rgb(154, 255, 154)",palegreen2:"rgb(144, 238, 144)",palegreen3:"rgb(124, 205, 124)",palegreen4:"rgb(84, 139, 84)",paleturquoise:"rgb(175, 238, 238)",paleturquoise1:"rgb(187, 255, 255)",paleturquoise2:"rgb(174, 238, 238)",paleturquoise3:"rgb(150, 205, 205)",paleturquoise4:"rgb(102, 139, 139)",palevioletred:"rgb(219, 112, 147)",palevioletred1:"rgb(255, 130, 171)",palevioletred2:"rgb(238, 121, 159)",palevioletred3:"rgb(205, 104, 137)",palevioletred4:"rgb(139, 71, 93)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peachpuff1:"rgb(255, 218, 185)",peachpuff2:"rgb(238, 203, 173)",peachpuff3:"rgb(205, 175, 149)",peachpuff4:"rgb(139, 119, 101)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",pink1:"rgb(255, 181, 197)",pink2:"rgb(238, 169, 184)",pink3:"rgb(205, 145, 158)",pink4:"rgb(139, 99, 108)",plum:"rgb(221, 160, 221)",plum1:"rgb(255, 187, 255)",plum2:"rgb(238, 174, 238)",plum3:"rgb(205, 150, 205)",plum4:"rgb(139, 102, 139)",powderblue:"rgb(176, 224, 230)",purple:"rgb(160, 32, 240)",purple1:"rgb(155, 48, 255)",purple2:"rgb(145, 44, 238)",purple3:"rgb(125, 38, 205)",purple4:"rgb(85, 26, 139)",red:"rgb(255, 0, 0)",red1:"rgb(255, 0, 0)",red2:"rgb(238, 0, 0)",red3:"rgb(205, 0, 0)",red4:"rgb(139, 0, 0)",rosybrown:"rgb(188, 143, 143)",rosybrown1:"rgb(255, 193, 193)",rosybrown2:"rgb(238, 180, 180)",rosybrown3:"rgb(205, 155, 155)",rosybrown4:"rgb(139, 105, 105)",royalblue:"rgb(65, 105, 225)",royalblue1:"rgb(72, 118, 255)",royalblue2:"rgb(67, 110, 238)",royalblue3:"rgb(58, 95, 205)",royalblue4:"rgb(39, 64, 139)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",salmon1:"rgb(255, 140, 105)",salmon2:"rgb(238, 130, 98)",salmon3:"rgb(205, 112, 84)",salmon4:"rgb(139, 76, 57)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb(46, 139, 87)",seagreen1:"rgb(84, 255, 159)",seagreen2:"rgb(78, 238, 148)",seagreen3:"rgb(67, 205, 128)",seagreen4:"rgb(46, 139, 87)",seashell:"rgb(255, 245, 238)",seashell1:"rgb(255, 245, 238)",seashell2:"rgb(238, 229, 222)",seashell3:"rgb(205, 197, 191)",seashell4:"rgb(139, 134, 130)",sienna:"rgb(160, 82, 45)",sienna1:"rgb(255, 130, 71)",sienna2:"rgb(238, 121, 66)",sienna3:"rgb(205, 104, 57)",sienna4:"rgb(139, 71, 38)",skyblue:"rgb(135, 206, 235)",skyblue1:"rgb(135, 206, 255)",skyblue2:"rgb(126, 192, 238)",skyblue3:"rgb(108, 166, 205)",skyblue4:"rgb(74, 112, 139)",slateblue:"rgb(106, 90, 205)",slateblue1:"rgb(131, 111, 255)",slateblue2:"rgb(122, 103, 238)",slateblue3:"rgb(105, 89, 205)",slateblue4:"rgb(71, 60, 139)",slategray:"rgb(112, 128, 144)",slategray1:"rgb(198, 226, 255)",slategray2:"rgb(185, 211, 238)",slategray3:"rgb(159, 182, 205)",slategray4:"rgb(108, 123, 139)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",snow1:"rgb(255, 250, 250)",snow2:"rgb(238, 233, 233)",snow3:"rgb(205, 201, 201)",snow4:"rgb(139, 137, 137)",springgreen:"rgb(0, 255, 127)",springgreen1:"rgb(0, 255, 127)",springgreen2:"rgb(0, 238, 118)",springgreen3:"rgb(0, 205, 102)",springgreen4:"rgb(0, 139, 69)",steelblue:"rgb(70, 130, 180)",steelblue1:"rgb(99, 184, 255)",steelblue2:"rgb(92, 172, 238)",steelblue3:"rgb(79, 148, 205)",steelblue4:"rgb(54, 100, 139)",tan:"rgb(210, 180, 140)",tan1:"rgb(255, 165, 79)",tan2:"rgb(238, 154, 73)",tan3:"rgb(205, 133, 63)",tan4:"rgb(139, 90, 43)",thistle:"rgb(216, 191, 216)",thistle1:"rgb(255, 225, 255)",thistle2:"rgb(238, 210, 238)",thistle3:"rgb(205, 181, 205)",thistle4:"rgb(139, 123, 139)",tomato:"rgb(255, 99, 71)",tomato1:"rgb(255, 99, 71)",tomato2:"rgb(238, 92, 66)",tomato3:"rgb(205, 79, 57)",tomato4:"rgb(139, 54, 38)",turquoise:"rgb(64, 224, 208)",turquoise1:"rgb(0, 245, 255)",turquoise2:"rgb(0, 229, 238)",turquoise3:"rgb(0, 197, 205)",turquoise4:"rgb(0, 134, 139)",violet:"rgb(238, 130, 238)",violetred:"rgb(208, 32, 144)",violetred1:"rgb(255, 62, 150)",violetred2:"rgb(238, 58, 140)",violetred3:"rgb(205, 50, 120)",violetred4:"rgb(139, 34, 82)",wheat:"rgb(245, 222, 179)",wheat1:"rgb(255, 231, 186)",wheat2:"rgb(238, 216, 174)",wheat3:"rgb(205, 186, 150)",wheat4:"rgb(139, 126, 102)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellow1:"rgb(255, 255, 0)",yellow2:"rgb(238, 238, 0)",yellow3:"rgb(205, 205, 0)",yellow4:"rgb(139, 139, 0)",yellowgreen:"rgb(154, 205, 50)"},lib.f={},lib.f.createEnum=function(e){return new String(e)},lib.f.replaceVars=function(e,t){return e.replace(/%([a-z]*)\(([^\)]+)\)/gi,function(e,r,o){if(void 0===t[o])throw"Unknown variable: "+o;var i=t[o];if(r in lib.f.replaceVars.functions)i=lib.f.replaceVars.functions[r](i);else if(r)throw"Unknown escape function: "+r;return i})},lib.f.replaceVars.functions={encodeURI:encodeURI,encodeURIComponent:encodeURIComponent,escapeHTML:function(e){var t={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#39;"};return e.replace(/[<>&\"\']/g,function(e){return t[e]})}},lib.f.getAcceptLanguages=function(e){lib.f.getAcceptLanguages.chromeSupported()?chrome.i18n.getAcceptLanguages(e):setTimeout(function(){e([navigator.language.replace(/-/g,"_")])},0)},lib.f.getAcceptLanguages.chromeSupported=function(){return window.chrome&&chrome.i18n},lib.f.parseQuery=function(e){e.startsWith("?")&&(e=e.substr(1));for(var t={},r=e.split("&"),o=0;o<r.length;o++){var i=r[o].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t},lib.f.getURL=function(e){return lib.f.getURL.chromeSupported()?chrome.runtime.getURL(e):e},lib.f.getURL.chromeSupported=function(){return window.chrome&&chrome.runtime&&chrome.runtime.getURL},lib.f.clamp=function(e,t,r){return e<t?t:e>r?r:e},lib.f.zpad=function(e,t){return String(e).padStart(t,"0")},lib.f.getWhitespace=function(e){if(e<=0)return"";var t=this.getWhitespace;for(t.whitespace||(t.whitespace=" ");e>t.whitespace.length;)t.whitespace+=t.whitespace;return t.whitespace.substr(0,e)},lib.f.alarm=function(e,t){var r=t||5e3,o=lib.f.getStack(1);return function(){var t=setTimeout(function(){var i="string"==typeof e?i:e.name;i=i?": "+i:"",console.warn("lib.f.alarm: timeout expired: "+r/1e3+"s"+i),console.log(o),t=null},r),i=function(e){return function(){return t&&(clearTimeout(t),t=null),e.apply(null,arguments)}};return"string"==typeof e?i:i(e)}()},lib.f.getStack=function(e){var t,r=e?e+2:2;try{throw new Error}catch(e){t=e.stack.split("\n")}for(var o={},i=r;i<t.length;i++)o[i-r]=t[i].replace(/^\s*at\s+/,"");return o},lib.f.smartFloorDivide=function(e,t){var r=e/t,o=Math.ceil(r);return o-r<1e-4?o:Math.floor(r)},lib.f.randomInt=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},lib.MessageManager=function(e){this.languages_=e.map(function(e){return e.replace(/-/g,"_")}),-1==this.languages_.indexOf("en")&&this.languages_.unshift("en"),this.messages={}},lib.MessageManager.prototype.addMessages=function(e){for(var t in e){var r=e[t];r.placeholders?this.messages[t]=r.message.replace(/\$([a-z][^\s\$]+)\$/gi,function(r,o){return e[t].placeholders[o.toLowerCase()].content}):this.messages[t]=r.message}},lib.MessageManager.prototype.findAndLoadMessages=function(e,t){function r(e){e?i=o.shift():s=o.shift(),o.length?n():t(i,s)}var o=this.languages_.concat(),i=[],s=[],n=function(){this.loadMessages(this.replaceReferences(e,o),r.bind(this,!0),r.bind(this,!1))}.bind(this);n()},lib.MessageManager.prototype.loadMessages=function(e,t,r){var o=new XMLHttpRequest;o.onloadend=function(){200==o.status?(this.addMessages(JSON.parse(o.responseText)),t()):r&&r(o.status)}.bind(this),o.open("GET",e),o.send()},lib.MessageManager.replaceReferences=function(e,t){return e.replace(/\$(\d+)/g,function(e,r){return t[r-1]})},lib.MessageManager.prototype.replaceReferences=lib.MessageManager.replaceReferences,lib.MessageManager.prototype.get=function(e,t,r){var o;if(e in this.messages)o=this.messages[e];else if(window.chrome&&window.chrome.i18n&&(o=chrome.i18n.getMessage(e)),!o)return console.warn("Unknown message: "+e),void 0===r?e:r;return t?(t instanceof Array||(t=[t]),this.replaceReferences(o,t)):o},lib.MessageManager.prototype.processI18nAttributes=function(e){for(var t=e.querySelectorAll("[i18n]"),r=0;r<t.length;r++)this.processI18nAttribute(t[r])},lib.MessageManager.prototype.processI18nAttribute=function(e){var t=e.getAttribute("i18n");if(t){try{t=JSON.parse(t)}catch(r){throw console.error("Can't parse "+e.tagName+"#"+e.id+": "+t),r}for(var r in t){var o=r,i=t[r];i.startsWith("=")&&(i=t[r=i.substr(1)]),i.startsWith("$")&&(i=function(e){return e.replace(/-/g,"_").toUpperCase()}(e.getAttribute(i.substr(1))+"_"+r));var s=this.get(i);"_"==o?e.textContent=s:e.setAttribute(o,s)}}},lib.PreferenceManager=function(e,t){this.storage=e,this.storageObserver_=this.onStorageChange_.bind(this),this.isActive_=!1,this.activate(),this.trace=!1;var r=t||"/";r.endsWith("/")||(r+="/"),this.prefix=r,this.prefRecords_={},this.globalObservers_=[],this.childFactories_={},this.childLists_={}},lib.PreferenceManager.prototype.DEFAULT_VALUE=lib.f.createEnum("DEFAULT"),lib.PreferenceManager.Record=function(e,t){this.name=e,this.defaultValue=t,this.currentValue=this.DEFAULT_VALUE,this.observers=[]},lib.PreferenceManager.Record.prototype.DEFAULT_VALUE=lib.PreferenceManager.prototype.DEFAULT_VALUE,lib.PreferenceManager.Record.prototype.addObserver=function(e){this.observers.push(e)},lib.PreferenceManager.Record.prototype.removeObserver=function(e){var t=this.observers.indexOf(e);t>=0&&this.observers.splice(t,1)},lib.PreferenceManager.Record.prototype.get=function(){return this.currentValue===this.DEFAULT_VALUE?/^(string|number)$/.test(_typeof(this.defaultValue))?this.defaultValue:"object"==_typeof(this.defaultValue)?JSON.parse(JSON.stringify(this.defaultValue)):this.defaultValue:this.currentValue},lib.PreferenceManager.prototype.deactivate=function(){if(!this.isActive_)throw new Error("Not activated");this.isActive_=!1,this.storage.removeObserver(this.storageObserver_)},lib.PreferenceManager.prototype.activate=function(){if(this.isActive_)throw new Error("Already activated");this.isActive_=!0,this.storage.addObserver(this.storageObserver_)},lib.PreferenceManager.prototype.readStorage=function(e){function t(){0==--o&&e&&e()}var r=this,o=0,i=Object.keys(this.prefRecords_).map(function(e){return r.prefix+e});this.trace&&console.log("Preferences read: "+this.prefix),this.storage.getItems(i,function(r){var i=this.prefix.length;for(var s in r){var n=r[s],a=s.substr(i),l=a in this.childLists_&&JSON.stringify(n)!=JSON.stringify(this.prefRecords_[a].currentValue);this.prefRecords_[a].currentValue=n,l&&(o++,this.syncChildList(a,t))}0==o&&e&&setTimeout(e)}.bind(this))},lib.PreferenceManager.prototype.definePreference=function(e,t,r){var o=this.prefRecords_[e];o?this.changeDefault(e,t):o=this.prefRecords_[e]=new lib.PreferenceManager.Record(e,t),r&&o.addObserver(r)},lib.PreferenceManager.prototype.definePreferences=function(e){for(var t=0;t<e.length;t++)this.definePreference(e[t][0],e[t][1],e[t][2])},lib.PreferenceManager.prototype.defineChildren=function(e,t){this.definePreference(e,[],this.onChildListChange_.bind(this,e)),this.childFactories_[e]=t,this.childLists_[e]={}},lib.PreferenceManager.prototype.addObservers=function(e,t){if(e&&"function"!=typeof e)throw new Error("Invalid param: globals");if(e&&this.globalObservers_.push(e),t)for(var r in t){if(!(r in this.prefRecords_))throw new Error("Unknown preference: "+r);this.prefRecords_[r].addObserver(t[r])}},lib.PreferenceManager.prototype.notifyAll=function(){for(var e in this.prefRecords_)this.notifyChange_(e)},lib.PreferenceManager.prototype.notifyChange_=function(e){var t=this.prefRecords_[e];if(!t)throw new Error("Unknown preference: "+e);for(var r=t.get(),o=0;o<this.globalObservers_.length;o++)this.globalObservers_[o](e,r);for(o=0;o<t.observers.length;o++)t.observers[o](r,e,this)},lib.PreferenceManager.prototype.createChild=function(e,t,r){var o,i=this.get(e);if(r){if(o=r,-1!=i.indexOf(o))throw new Error("Duplicate child: "+e+": "+o)}else for(;!o||-1!=i.indexOf(o);)o=lib.f.randomInt(1,65535).toString(16),o=lib.f.zpad(o,4),t&&(o=t+":"+o);var s=this.childFactories_[e](this,o);return s.trace=this.trace,s.resetAll(),this.childLists_[e][o]=s,i.push(o),this.set(e,i),s},lib.PreferenceManager.prototype.removeChild=function(e,t){this.getChild(e,t).resetAll();var r=this.get(e),o=r.indexOf(t);-1!=o&&(r.splice(o,1),this.set(e,r)),delete this.childLists_[e][t]},lib.PreferenceManager.prototype.getChild=function(e,t,r){if(!(e in this.childLists_))throw new Error("Unknown child list: "+e);var o=this.childLists_[e];if(!(t in o)){if(void 0===r)throw new Error('Unknown "'+e+'" child: '+t);return r}return o[t]},lib.PreferenceManager.diffChildLists=function(e,t){for(var r={added:{},removed:{},common:{}},o=0;o<e.length;o++)-1!=t.indexOf(e[o])?r.common[e[o]]=!0:r.added[e[o]]=!0;for(o=0;o<t.length;o++)t[o]in r.added||t[o]in r.common||(r.removed[t[o]]=!0);return r},lib.PreferenceManager.prototype.syncChildList=function(e,t){for(var r=0,o=this.get(e),i=Object.keys(this.childLists_[e]),s=(lib.PreferenceManager.diffChildLists(o,i),0);s<o.length;s++){var n=o[s],a=i.indexOf(n);if(a>=0&&i.splice(a,1),!this.childLists_[e][n]){var l=this.childFactories_[e](this,n);if(!l){console.warn("Unable to restore child: "+e+": "+n);continue}l.trace=this.trace,this.childLists_[e][n]=l,r++,l.readStorage(function(){0==--r&&t&&t()})}}for(s=0;s<i.length;s++)delete this.childLists_[e][i[s]];!r&&t&&setTimeout(t)},lib.PreferenceManager.prototype.reset=function(e){var t=this.prefRecords_[e];if(!t)throw new Error("Unknown preference: "+e);this.storage.removeItem(this.prefix+e),t.currentValue!==this.DEFAULT_VALUE&&(t.currentValue=this.DEFAULT_VALUE,this.notifyChange_(e))},lib.PreferenceManager.prototype.resetAll=function(){var e=[];for(var t in this.childLists_){var r=this.childLists_[t];for(var o in r)r[o].resetAll()}for(var i in this.prefRecords_)this.prefRecords_[i].currentValue!==this.DEFAULT_VALUE&&(this.prefRecords_[i].currentValue=this.DEFAULT_VALUE,e.push(i));var s=Object.keys(this.prefRecords_).map(function(e){return this.prefix+e}.bind(this));this.storage.removeItems(s),e.forEach(this.notifyChange_.bind(this))},lib.PreferenceManager.prototype.diff=function(e,t){return(void 0===e?"undefined":_typeof(e))!==(void 0===t?"undefined":_typeof(t))||!/^(undefined|boolean|number|string)$/.test(void 0===e?"undefined":_typeof(e))||e!==t},lib.PreferenceManager.prototype.changeDefault=function(e,t){var r=this.prefRecords_[e];if(!r)throw new Error("Unknown preference: "+e);this.diff(r.defaultValue,t)&&(r.currentValue===this.DEFAULT_VALUE?(r.defaultValue=t,this.notifyChange_(e)):r.defaultValue=t)},lib.PreferenceManager.prototype.changeDefaults=function(e){for(var t in e)this.changeDefault(t,e[t])},lib.PreferenceManager.prototype.set=function(e,t){var r=this.prefRecords_[e];if(!r)throw new Error("Unknown preference: "+e);var o=r.get();this.diff(o,t)&&(this.diff(r.defaultValue,t)?(r.currentValue=t,this.storage.setItem(this.prefix+e,t)):(r.currentValue=this.DEFAULT_VALUE,this.storage.removeItem(this.prefix+e)),setTimeout(this.notifyChange_.bind(this,e),0))},lib.PreferenceManager.prototype.get=function(e){var t=this.prefRecords_[e];if(!t)throw new Error("Unknown preference: "+e);return t.get()},lib.PreferenceManager.prototype.exportAsJson=function(){var e={};for(var t in this.prefRecords_)if(t in this.childLists_){e[t]=[];for(var r=this.get(t),o=0;o<r.length;o++){var i=r[o];e[t].push({id:i,json:this.getChild(t,i).exportAsJson()})}}else{var s=this.prefRecords_[t];s.currentValue!=this.DEFAULT_VALUE&&(e[t]=s.currentValue)}return e},lib.PreferenceManager.prototype.importFromJson=function(e,t){var r=0,o=function(){--r<1&&t&&t()};for(var i in e)if(i in this.childLists_)for(var s=e[i],n=0;n<s.length;n++){var a=s[n].id,l=this.childLists_[i][a];l||(l=this.createChild(i,null,a)),l.importFromJson(s[n].json,o),r++}else this.set(i,e[i],o),r++},lib.PreferenceManager.prototype.onChildListChange_=function(e){this.syncChildList(e)},lib.PreferenceManager.prototype.onStorageChange_=function(e){for(var t in e)if(!this.prefix||0==t.lastIndexOf(this.prefix,0)){var r=t.substr(this.prefix.length);if(r in this.prefRecords_){var o=this.prefRecords_[r],i=e[t].newValue,s=o.currentValue;s===o.DEFAULT_VALUE&&(s=void 0),this.diff(s,i)&&(o.currentValue=void 0===i||null===i?o.DEFAULT_VALUE:i,this.notifyChange_(r))}}},lib.resource={resources_:{}},lib.resource.add=function(e,t,r){lib.resource.resources_[e]={type:t,name:e,data:r}},lib.resource.get=function(e,t){if(!(e in lib.resource.resources_)){if(void 0===t)throw"Unknown resource: "+e;return t}return lib.resource.resources_[e]},lib.resource.getData=function(e,t){if(!(e in lib.resource.resources_)){if(void 0===t)throw"Unknown resource: "+e;return t}return lib.resource.resources_[e].data},lib.resource.getDataUrl=function(e,t){var r=lib.resource.get(e,t);return"data:"+r.type+","+r.data},lib.Storage=new Object,lib.Storage.Chrome=function(e){this.storage_=e,this.observers_=[],chrome.storage.onChanged.addListener(this.onChanged_.bind(this))},lib.Storage.Chrome.prototype.onChanged_=function(e,t){if(chrome.storage[t]==this.storage_)for(var r=0;r<this.observers_.length;r++)this.observers_[r](e)},lib.Storage.Chrome.prototype.addObserver=function(e){this.observers_.push(e)},lib.Storage.Chrome.prototype.removeObserver=function(e){var t=this.observers_.indexOf(e);-1!=t&&this.observers_.splice(t,1)},lib.Storage.Chrome.prototype.clear=function(e){this.storage_.clear(),e&&setTimeout(e,0)},lib.Storage.Chrome.prototype.getItem=function(e,t){this.storage_.get(e,t)},lib.Storage.Chrome.prototype.getItems=function(e,t){this.storage_.get(e,t)},lib.Storage.Chrome.prototype.setItem=function(e,t,r){var o=this,i={};i[e]=t,this.storage_.set(i,function i(){if(chrome.runtime.lastError){if(chrome.runtime.lastError.message.indexOf("MAX_WRITE_OPERATIONS"))return console.warn("Will retry save of "+e+" after exceeding quota",chrome.runtime.lastError),void setTimeout(function(){return o.setItem(e,t,i)},1e3);console.error("Unknown runtime error",chrome.runtime.lastError)}r&&r()})},lib.Storage.Chrome.prototype.setItems=function(e,t){this.storage_.set(e,t)},lib.Storage.Chrome.prototype.removeItem=function(e,t){this.storage_.remove(e,t)},lib.Storage.Chrome.prototype.removeItems=function(e,t){this.storage_.remove(e,t)},lib.Storage.Local=function(){this.observers_=[],this.storage_=window.localStorage,window.addEventListener("storage",this.onStorage_.bind(this))},lib.Storage.Local.prototype.onStorage_=function(e){if(e.storageArea==this.storage_){var t=e.oldValue?JSON.parse(e.oldValue):e.oldValue,r=e.newValue?JSON.parse(e.newValue):e.newValue,o={};o[e.key]={oldValue:t,newValue:r};for(var i=0;i<this.observers_.length;i++)this.observers_[i](o)}},lib.Storage.Local.prototype.addObserver=function(e){this.observers_.push(e)},lib.Storage.Local.prototype.removeObserver=function(e){var t=this.observers_.indexOf(e);-1!=t&&this.observers_.splice(t,1)},lib.Storage.Local.prototype.clear=function(e){this.storage_.clear(),e&&setTimeout(e,0)},lib.Storage.Local.prototype.getItem=function(e,t){var r=this.storage_.getItem(e);if("string"==typeof r)try{r=JSON.parse(r)}catch(e){}setTimeout(t.bind(null,r),0)},lib.Storage.Local.prototype.getItems=function(e,t){for(var r={},o=e.length-1;o>=0;o--){var i=e[o],s=this.storage_.getItem(i);if("string"==typeof s)try{r[i]=JSON.parse(s)}catch(e){r[i]=s}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},lib.Storage.Local.prototype.setItem=function(e,t,r){this.storage_.setItem(e,JSON.stringify(t)),r&&setTimeout(r,0)},lib.Storage.Local.prototype.setItems=function(e,t){for(var r in e)this.storage_.setItem(r,JSON.stringify(e[r]));t&&setTimeout(t,0)},lib.Storage.Local.prototype.removeItem=function(e,t){this.storage_.removeItem(e),t&&setTimeout(t,0)},lib.Storage.Local.prototype.removeItems=function(e,t){for(var r=0;r<e.length;r++)this.storage_.removeItem(e[r]);t&&setTimeout(t,0)},lib.Storage.Memory=function(){this.observers_=[],this.storage_={}},lib.Storage.Memory.prototype.addObserver=function(e){this.observers_.push(e)},lib.Storage.Memory.prototype.removeObserver=function(e){var t=this.observers_.indexOf(e);-1!=t&&this.observers_.splice(t,1)},lib.Storage.Memory.prototype.clear=function(e){var t={};for(var r in this.storage_)t[r]={oldValue:this.storage_[r],newValue:void 0};this.storage_={},setTimeout(function(){for(var e=0;e<this.observers_.length;e++)this.observers_[e](t)}.bind(this),0),e&&setTimeout(e,0)},lib.Storage.Memory.prototype.getItem=function(e,t){var r=this.storage_[e];if("string"==typeof r)try{r=JSON.parse(r)}catch(e){}setTimeout(t.bind(null,r),0)},lib.Storage.Memory.prototype.getItems=function(e,t){for(var r={},o=e.length-1;o>=0;o--){var i=e[o],s=this.storage_[i];if("string"==typeof s)try{r[i]=JSON.parse(s)}catch(e){r[i]=s}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},lib.Storage.Memory.prototype.setItem=function(e,t,r){var o=this.storage_[e];this.storage_[e]=JSON.stringify(t);var i={};i[e]={oldValue:o,newValue:t},setTimeout(function(){for(var e=0;e<this.observers_.length;e++)this.observers_[e](i)}.bind(this),0),r&&setTimeout(r,0)},lib.Storage.Memory.prototype.setItems=function(e,t){var r={};for(var o in e)r[o]={oldValue:this.storage_[o],newValue:e[o]},this.storage_[o]=JSON.stringify(e[o]);setTimeout(function(){for(var e=0;e<this.observers_.length;e++)this.observers_[e](r)}.bind(this)),t&&setTimeout(t,0)},lib.Storage.Memory.prototype.removeItem=function(e,t){delete this.storage_[e],t&&setTimeout(t,0)},lib.Storage.Memory.prototype.removeItems=function(e,t){for(var r=0;r<e.length;r++)delete this.storage_[e[r]];t&&setTimeout(t,0)},lib.TestManager=function(e){this.log=e||new lib.TestManager.Log},lib.TestManager.prototype.createTestRun=function(e){return new lib.TestManager.TestRun(this,e)},lib.TestManager.prototype.onTestRunComplete=function(e){},lib.TestManager.prototype.testPreamble=function(e,t){},lib.TestManager.prototype.testPostamble=function(e,t){},lib.TestManager.Log=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:console;this.save=!1,this.data="",this.prefix_="",this.prefixStack_=0,this.console_=t,["log","debug","info","warn","error"].forEach(function(t){var r="";switch(t){case"debug":case"warn":case"error":r=t.toUpperCase()+": "}var o=e.console_[t];e[t]=e.console_[t]=function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];e.save&&(e.data+=e.prefix_+r+i.join(" ")+"\n"),o.apply(e.console_,i)}}),["group","groupCollapsed"].forEach(function(t){var r=e.console_[t];e[t]=e.console_[t]=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";r(t),e.save&&(e.data+=e.prefix_+t+"\n"),e.prefix_=" ".repeat(++e.prefixStack_)}});var r=this.console_.groupEnd;this.groupEnd=this.console_.groupEnd=function(){r(),e.prefix_=" ".repeat(--e.prefixStack_)}},lib.TestManager.Suite=function(e){function t(t,r){this.testManager_=t,this.suiteName=e,this.setup(r)}return t.suiteName=e,t.addTest=lib.TestManager.Suite.addTest,t.disableTest=lib.TestManager.Suite.disableTest,t.getTest=lib.TestManager.Suite.getTest,t.getTestList=lib.TestManager.Suite.getTestList,t.testList_=[],t.testMap_={},t.prototype=Object.create(lib.TestManager.Suite.prototype),t.constructor=lib.TestManager.Suite,lib.TestManager.Suite.subclasses.push(t),t},lib.TestManager.Suite.subclasses=[],lib.TestManager.Suite.addTest=function(e,t){if(e in this.testMap_)throw"Duplicate test name: "+e;var r=new lib.TestManager.Test(this,e,t);this.testMap_[e]=r,this.testList_.push(r)},lib.TestManager.Suite.disableTest=function(e,t){if(e in this.testMap_)throw"Duplicate test name: "+e;var r=new lib.TestManager.Test(this,e,t);console.log("Disabled test: "+r.fullName)},lib.TestManager.Suite.getTest=function(e){return this.testMap_[e]},lib.TestManager.Suite.getTestList=function(){return this.testList_},lib.TestManager.Suite.prototype.setDefaults=function(e,t){for(var r in t)this[r]=r in e?e[r]:t[r]},lib.TestManager.Suite.prototype.setup=function(e){},lib.TestManager.Suite.prototype.preamble=function(e,t){},lib.TestManager.Suite.prototype.postamble=function(e,t){},lib.TestManager.Test=function(e,t,r){this.suiteClass=e,this.testName=t,this.fullName=e.suiteName+"["+t+"]",this.testFunction_=r},lib.TestManager.Test.prototype.run=function(e){try{this.testFunction_.apply(e.suite,[e,e.testRun.cx])}catch(t){if(t instanceof lib.TestManager.Result.TestComplete)return;e.println("Test raised an exception: "+t),t.stack&&(t.stack instanceof Array?e.println(t.stack.join("\n")):e.println(t.stack)),e.completeTest_(e.FAILED,!1)}},lib.TestManager.TestRun=function(e,t){this.testManager=e,this.log=e.log,this.cx=t||{},this.failures=[],this.passes=[],this.startDate=null,this.duration=null,this.currentResult=null,this.maxFailures=0,this.panic=!1,this.testQueue_=[]},lib.TestManager.TestRun.prototype.ALL_TESTS=lib.f.createEnum("<all-tests>"),lib.TestManager.TestRun.prototype.selectTest=function(e){this.testQueue_.push(e)},lib.TestManager.TestRun.prototype.selectSuite=function(e,t){for(var r=t||this.ALL_TESTS,o=0,i=e.getTestList(),s=0;s<i.length;s++){var n=i[s];if(r!==this.ALL_TESTS)if(r instanceof RegExp){if(!r.test(n.testName))continue}else if(n.testName!=r)continue;this.selectTest(n),o++}return o},lib.TestManager.TestRun.prototype.selectPattern=function(e){for(var t=0,r=0;r<lib.TestManager.Suite.subclasses.length;r++)t+=this.selectSuite(lib.TestManager.Suite.subclasses[r],e);return t||this.log.warn("No tests matched selection criteria: "+e),t},lib.TestManager.TestRun.prototype.onUncaughtException_=function(e,t,r){if(0==e.indexOf("Uncaught lib.TestManager.Result.TestComplete")||-1!=e.indexOf("status: passed"))return!0;if(this.currentResult&&e!="Uncaught "+this.currentResult.expectedErrorMessage_){var o="during";return this.currentResult.status!=this.currentResult.PENDING&&(o="after"),this.log.error("Uncaught exception "+o+" test case: "+this.currentResult.test.fullName),this.log.error(e+", "+t+":"+r),this.currentResult.completeTest_(this.currentResult.FAILED,!1),!1}},lib.TestManager.TestRun.prototype.onTestRunComplete_=function(e){e?(this.duration=new Date-this.startDate,this.log.groupEnd(),this.log.info(this.passes.length+" passed, "+this.failures.length+" failed, "+this.msToSeconds_(this.duration)),this.summarize(),window.onerror=null,this.testManager.onTestRunComplete(this)):setTimeout(this.onTestRunComplete_.bind(this),0,!0)},lib.TestManager.TestRun.prototype.onResultComplete=function(e){try{this.testManager.testPostamble(e,this.cx),e.suite.postamble(e,this.ctx)}catch(e){this.log.error("Unexpected exception in postamble: "+(e.stack?e.stack:e)),this.panic=!0}if(e.status!=e.PASSED?this.log.error(e.status):e.duration>500&&this.log.warn("Slow test took "+this.msToSeconds_(e.duration)),this.log.groupEnd(),e.status==e.FAILED)this.failures.push(e),this.currentSuite=null;else{if(e.status!=e.PASSED)return this.log.error("Unknown result status: "+e.test.fullName+": "+e.status),void(this.panic=!0);this.passes.push(e)}this.runNextTest_()},lib.TestManager.TestRun.prototype.onResultReComplete=function(e,t){this.log.error("Late complete for test: "+e.test.fullName+": "+t);var r=this.passes.indexOf(e);r>=0&&(this.passes.splice(r,1),this.failures.push(e))},lib.TestManager.TestRun.prototype.runNextTest_=function(){if(!this.panic&&this.testQueue_.length){if(this.maxFailures&&this.failures.length>=this.maxFailures)return this.log.error("Maximum failure count reached, aborting test run."),void this.onTestRunComplete_();var e=this.testQueue_[0],t=this.currentResult?this.currentResult.suite:null;try{t&&t instanceof e.suiteClass||(t&&this.log.groupEnd(),this.log.group(e.suiteClass.suiteName),t=new e.suiteClass(this.testManager,this.cx))}catch(e){return this.log.error("Exception during setup: "+(e.stack?e.stack:e)),this.panic=!0,void this.onTestRunComplete_()}try{this.log.group(e.testName),this.currentResult=new lib.TestManager.Result(this,t,e),this.testManager.testPreamble(this.currentResult,this.cx),t.preamble(this.currentResult,this.cx),this.testQueue_.shift()}catch(e){return this.log.error("Unexpected exception during test preamble: "+(e.stack?e.stack:e)),this.log.groupEnd(),this.panic=!0,void this.onTestRunComplete_()}try{this.currentResult.run()}catch(e){this.log.error("Unexpected exception during test run: "+(e.stack?e.stack:e)),this.panic=!0}}else this.onTestRunComplete_()},lib.TestManager.TestRun.prototype.run=function(){this.log.info("Running "+this.testQueue_.length+" test(s)"),window.onerror=this.onUncaughtException_.bind(this),this.startDate=new Date,this.runNextTest_()},lib.TestManager.TestRun.prototype.msToSeconds_=function(e){return(e/1e3).toFixed(2)+"s"},lib.TestManager.TestRun.prototype.summarize=function(){if(this.failures.length)for(var e=0;e<this.failures.length;e++)this.log.error("FAILED: "+this.failures[e].test.fullName);this.testQueue_.length&&this.log.warn("Test run incomplete: "+this.testQueue_.length+" test(s) were not run.")},lib.TestManager.Result=function(e,t,r){this.testRun=e,this.suite=t,this.test=r,this.startDate=null,this.duration=null,this.status=this.PENDING,this.expectedErrorMessage_=null},lib.TestManager.Result.prototype.PENDING="pending",lib.TestManager.Result.prototype.FAILED="FAILED",lib.TestManager.Result.prototype.PASSED="passed",lib.TestManager.Result.TestComplete=function(e){this.result=e},lib.TestManager.Result.TestComplete.prototype.toString=function(){return"lib.TestManager.Result.TestComplete: "+this.result.test.fullName+", status: "+this.result.status},lib.TestManager.Result.prototype.run=function(){this.startDate=new Date,this.test.run(this),this.status!=this.PENDING||this.timeout_||(this.println("Test did not return a value and did not request more time."),this.completeTest_(this.FAILED,!1))},lib.TestManager.Result.prototype.expectErrorMessage=function(e){this.expectedErrorMessage_=e},lib.TestManager.Result.prototype.onTimeout_=function(){this.timeout_=null,this.status==this.PENDING&&(this.println("Test timed out."),this.completeTest_(this.FAILED,!1))},lib.TestManager.Result.prototype.requestTime=function(e){this.timeout_&&clearTimeout(this.timeout_),this.timeout_=setTimeout(this.onTimeout_.bind(this),e)},lib.TestManager.Result.prototype.completeTest_=function(e,t){if(this.status==this.PENDING?(this.duration=new Date-this.startDate,this.status=e,this.testRun.onResultComplete(this)):this.testRun.onResultReComplete(this,e),arguments.length<2||t)throw new lib.TestManager.Result.TestComplete(this)},lib.TestManager.Result.prototype.assertEQ=function(e,t,r){function o(e){if("number"==typeof e)return e;var t=String(e).split("\n").map(function(e){return JSON.stringify(e)});return t.length>1?"\n"+t.join("\n"):t.join("\n")}if(e!==t&&!(t instanceof Array&&lib.array.compare(e,t))){var i=r?"["+r+"]":"";this.fail("assertEQ"+i+": "+this.getCallerLocation_(1)+": "+o(e)+" !== "+o(t))}},lib.TestManager.Result.prototype.assert=function(e,t){if(!0!==e){var r=t?"["+t+"]":"";this.fail("assert"+r+": "+this.getCallerLocation_(1)+": "+String(e))}},lib.TestManager.Result.prototype.getCallerLocation_=function(e){try{throw new Error}catch(r){var t=r.stack.split("\n")[e+2].match(/([^/]+:\d+):\d+\)?$/);return t?t[1]:"???"}},lib.TestManager.Result.prototype.println=function(e){this.testRun.log.info(e)},lib.TestManager.Result.prototype.fail=function(e){arguments.length&&this.println(e),this.completeTest_(this.FAILED,!0)},lib.TestManager.Result.prototype.pass=function(){this.completeTest_(this.PASSED,!0)},lib.UTF8Decoder=function(){this.bytesLeft=0,this.codePoint=0,this.lowerBound=0},lib.UTF8Decoder.prototype.decode=function(e){for(var t="",r=0;r<e.length;r++){var o=e.charCodeAt(r);if(0==this.bytesLeft)o<=127?t+=e.charAt(r):192<=o&&o<=223?(this.codePoint=o-192,this.bytesLeft=1,this.lowerBound=128):224<=o&&o<=239?(this.codePoint=o-224,this.bytesLeft=2,this.lowerBound=2048):240<=o&&o<=247?(this.codePoint=o-240,this.bytesLeft=3,this.lowerBound=65536):248<=o&&o<=251?(this.codePoint=o-248,this.bytesLeft=4,this.lowerBound=2097152):252<=o&&o<=253?(this.codePoint=o-252,this.bytesLeft=5,this.lowerBound=67108864):t+="�";else if(128<=o&&o<=191){if(this.bytesLeft--,this.codePoint=(this.codePoint<<6)+(o-128),0==this.bytesLeft){var i=this.codePoint;i<this.lowerBound||55296<=i&&i<=57343||i>1114111?t+="�":i<65536?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode(55296+(i>>>10&1023),56320+(1023&i)))}}else t+="�",this.bytesLeft=0,r--}return t},lib.decodeUTF8=function(e){return(new lib.UTF8Decoder).decode(e)},lib.encodeUTF8=function(e){for(var t="",r=0;r<e.length;r++){var o=e.charCodeAt(r);if(56320<=o&&o<=57343)o=65533;else if(55296<=o&&o<=56319)if(r+1<e.length){var i=e.charCodeAt(r+1);56320<=i&&i<=57343?(o=65536+((1023&o)<<10)+(1023&i),r++):o=65533}else o=65533;var s;if(o<=127)t+=e.charAt(r);else for(o<=2047?(t+=String.fromCharCode(192|o>>>6),s=1):o<=65535?(t+=String.fromCharCode(224|o>>>12),s=2):(t+=String.fromCharCode(240|o>>>18),s=3);s>0;)s--,t+=String.fromCharCode(128|o>>>6*s&63)}return t},lib.wc={},lib.wc.nulWidth=0,lib.wc.controlWidth=0,lib.wc.regardCjkAmbiguous=!1,lib.wc.cjkAmbiguousWidth=2,lib.wc.combining=[[173,173],[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1756],[1759,1764],[1767,1768],[1770,1773],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43452],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531],[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70090,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70460,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[72193,72198],[72201,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[92912,92916],[92976,92982],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],lib.wc.ambiguous=[[161,161],[164,164],[167,168],[170,170],[173,174],[176,180],[182,186],[188,191],[198,198],[208,208],[215,216],[222,225],[230,230],[232,234],[236,237],[240,240],[242,243],[247,250],[252,252],[254,254],[257,257],[273,273],[275,275],[283,283],[294,295],[299,299],[305,307],[312,312],[319,322],[324,324],[328,331],[333,333],[338,339],[358,359],[363,363],[462,462],[464,464],[466,466],[468,468],[470,470],[472,472],[474,474],[476,476],[593,593],[609,609],[708,708],[711,711],[713,715],[717,717],[720,720],[728,731],[733,733],[735,735],[768,879],[913,929],[931,937],[945,961],[963,969],[1025,1025],[1040,1103],[1105,1105],[4352,4447],[8208,8208],[8211,8214],[8216,8217],[8220,8221],[8224,8226],[8228,8231],[8240,8240],[8242,8243],[8245,8245],[8251,8251],[8254,8254],[8308,8308],[8319,8319],[8321,8324],[8364,8364],[8451,8451],[8453,8453],[8457,8457],[8467,8467],[8470,8470],[8481,8482],[8486,8486],[8491,8491],[8531,8532],[8539,8542],[8544,8555],[8560,8569],[8585,8585],[8592,8601],[8632,8633],[8658,8658],[8660,8660],[8679,8679],[8704,8704],[8706,8707],[8711,8712],[8715,8715],[8719,8719],[8721,8721],[8725,8725],[8730,8730],[8733,8736],[8739,8739],[8741,8741],[8743,8748],[8750,8750],[8756,8759],[8764,8765],[8776,8776],[8780,8780],[8786,8786],[8800,8801],[8804,8807],[8810,8811],[8814,8815],[8834,8835],[8838,8839],[8853,8853],[8857,8857],[8869,8869],[8895,8895],[8978,8978],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9312,9449],[9451,9547],[9552,9587],[9600,9615],[9618,9621],[9632,9633],[9635,9641],[9650,9651],[9654,9655],[9660,9661],[9664,9665],[9670,9672],[9675,9675],[9678,9681],[9698,9701],[9711,9711],[9725,9726],[9733,9734],[9737,9737],[9742,9743],[9748,9749],[9756,9756],[9758,9758],[9792,9792],[9794,9794],[9800,9811],[9824,9825],[9827,9829],[9831,9834],[9836,9837],[9839,9839],[9855,9855],[9875,9875],[9886,9887],[9889,9889],[9898,9899],[9917,9919],[9924,9953],[9955,9955],[9960,9983],[9989,9989],[9994,9995],[10024,10024],[10045,10045],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10102,10111],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11097],[11904,12255],[12272,12350],[12352,19903],[19968,42191],[43360,43391],[44032,55203],[57344,64255],[65024,65049],[65072,65135],[65281,65376],[65504,65510],[65533,65533],[94176,94177],[94208,101119],[110592,110895],[110960,111359],[126980,126980],[127183,127183],[127232,127242],[127248,127277],[127280,127337],[127344,127404],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128747,128748],[128756,128760],[129296,129342],[129344,129356],[129360,129387],[129408,129431],[129472,129472],[129488,129510],[131072,196605],[196608,262141],[917760,917999],[983040,1048573],[1048576,1114109]],lib.wc.unambiguous=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,12255],[12272,12350],[12352,12871],[12880,19903],[19968,42191],[43360,43391],[44032,55203],[63744,64255],[65040,65049],[65072,65135],[65281,65376],[65504,65510],[94176,94177],[94208,101119],[110592,110895],[110960,111359],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128747,128748],[128756,128760],[129296,129342],[129344,129356],[129360,129387],[129408,129431],[129472,129472],[129488,129510],[131072,196605],[196608,262141]],lib.wc.binaryTableSearch_=function(e,t){var r,o=0,i=t.length-1;if(e<t[o][0]||e>t[i][1])return!1;for(;i>=o;)if(r=Math.floor((o+i)/2),e>t[r][1])o=r+1;else{if(!(e<t[r][0]))return!0;i=r-1}return!1},lib.wc.isSpace=function(e){return lib.wc.binaryTableSearch_(e,lib.wc.combining)},lib.wc.isCjkAmbiguous=function(e){return lib.wc.binaryTableSearch_(e,lib.wc.ambiguous)},lib.wc.charWidth=function(e){return lib.wc.regardCjkAmbiguous?lib.wc.charWidthRegardAmbiguous(e):lib.wc.charWidthDisregardAmbiguous(e)},lib.wc.charWidthDisregardAmbiguous=function(e){return e<127?e>=32?1:0==e?lib.wc.nulWidth:lib.wc.controlWidth:e<160?lib.wc.controlWidth:lib.wc.isSpace(e)?0:lib.wc.binaryTableSearch_(e,lib.wc.unambiguous)?2:1},lib.wc.charWidthRegardAmbiguous=function(e){return lib.wc.isCjkAmbiguous(e)?lib.wc.cjkAmbiguousWidth:lib.wc.charWidthDisregardAmbiguous(e)},lib.wc.strWidth=function(e){for(var t,r=0,o=0;o<e.length;){var i=e.codePointAt(o);if((t=lib.wc.charWidth(i))<0)return-1;r+=t,o+=i<=65535?1:2}return r},lib.wc.substr=function(e,t,r){var o,i,s=0;if(t)for(i=0;s<e.length;){var n=e.codePointAt(s);if((i+=lib.wc.charWidth(n))>t)break;s+=n<=65535?1:2}if(void 0!=r){for(o=s,i=0;o<e.length;){var a=e.codePointAt(o);if((i+=lib.wc.charWidth(a))>r)break;o+=a<=65535?1:2}return e.substring(s,o)}return e.substr(s)},lib.wc.substring=function(e,t,r){return lib.wc.substr(e,t,r-t)},lib.resource.add("libdot/changelog/version","text/plain","1.19"),lib.resource.add("libdot/changelog/date","text/plain","2017-10-16"),lib.rtdep("lib.Storage");var hterm={};hterm.windowType=null,hterm.zoomWarningMessage="ZOOM != 100%",hterm.notifyCopyMessage="✂",hterm.desktopNotificationTitle="♪ %(title) ♪",hterm.testDeps=["hterm.ScrollPort.Tests","hterm.Screen.Tests","hterm.Terminal.Tests","hterm.VT.Tests","hterm.VT.CannedTests"],lib.registerInit("hterm",function(e){function t(t){hterm.windowType=t.type,setTimeout(e,0)}hterm.defaultStorage||(window.chrome&&chrome.storage&&chrome.storage.sync?hterm.defaultStorage=new lib.Storage.Chrome(chrome.storage.sync):hterm.defaultStorage=new lib.Storage.Local);var r=!1;if(window.chrome&&chrome.runtime&&chrome.runtime.getManifest){var o=chrome.runtime.getManifest();r=o.app&&o.app.background}r?setTimeout(t.bind(null,{type:"popup"}),0):window.chrome&&chrome.tabs?chrome.tabs.getCurrent(function(r){r&&window.chrome?chrome.windows.get(r.windowId,null,t):(hterm.windowType="normal",setTimeout(e,0))}):setTimeout(t.bind(null,{type:"normal"}),0)}),hterm.getClientSize=function(e){return e.getBoundingClientRect()},hterm.getClientWidth=function(e){return e.getBoundingClientRect().width},hterm.getClientHeight=function(e){return e.getBoundingClientRect().height},hterm.copySelectionToClipboard=function(e){try{e.execCommand("copy")}catch(e){}},hterm.pasteFromClipboard=function(e){try{return e.execCommand("paste")}catch(e){return!1}},hterm.notify=function(e){var t=function(e,t){return void 0!==e?e:t};void 0!==e&&null!==e||(e={});var r={body:e.body,icon:t(e.icon,lib.resource.getDataUrl("hterm/images/icon-96"))},o=t(e.title,window.document.title);o||(o="hterm"),o=lib.f.replaceVars(hterm.desktopNotificationTitle,{title:o});var i=new Notification(o,r);return i.onclick=function(){window.focus(),this.close()},i},hterm.Size=function(e,t){this.width=e,this.height=t},hterm.Size.prototype.resize=function(e,t){this.width=e,this.height=t},hterm.Size.prototype.clone=function(){return new hterm.Size(this.width,this.height)},hterm.Size.prototype.setTo=function(e){this.width=e.width,this.height=e.height},hterm.Size.prototype.equals=function(e){return this.width==e.width&&this.height==e.height},hterm.Size.prototype.toString=function(){return"[hterm.Size: "+this.width+", "+this.height+"]"},hterm.RowCol=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},hterm.RowCol.prototype.move=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},hterm.RowCol.prototype.clone=function(){return new hterm.RowCol(this.row,this.column,this.overflow)},hterm.RowCol.prototype.setTo=function(e){this.row=e.row,this.column=e.column,this.overflow=e.overflow},hterm.RowCol.prototype.equals=function(e){return this.row==e.row&&this.column==e.column&&this.overflow==e.overflow},hterm.RowCol.prototype.toString=function(){return"[hterm.RowCol: "+this.row+", "+this.column+", "+this.overflow+"]"},lib.rtdep("lib.f"),hterm.Frame=function(e,t,r){this.terminal_=e,this.div_=e.div_,this.url=t,this.options=r||{},this.iframe_=null,this.container_=null,this.messageChannel_=null},hterm.Frame.prototype.onMessage_=function(e){switch(e.data.name){case"ipc-init-ok":return void this.sendTerminalInfo_();case"terminal-info-ok":return this.container_.style.display="flex",this.messageChannel_.port1.onmessage=this.onMessage.bind(this),void this.onLoad();default:return void console.log("Unknown message from frame:",e.data)}},hterm.Frame.prototype.onMessage=function(){},hterm.Frame.prototype.onLoad_=function(){this.messageChannel_=new MessageChannel,this.messageChannel_.port1.onmessage=this.onMessage_.bind(this),this.messageChannel_.port1.start(),this.iframe_.contentWindow.postMessage({name:"ipc-init",argv:[{messagePort:this.messageChannel_.port2}]},this.url,[this.messageChannel_.port2])},hterm.Frame.prototype.onLoad=function(){},hterm.Frame.prototype.sendTerminalInfo_=function(){lib.f.getAcceptLanguages(function(e){this.postMessage("terminal-info",[{acceptLanguages:e,foregroundColor:this.terminal_.getForegroundColor(),backgroundColor:this.terminal_.getBackgroundColor(),cursorColor:this.terminal_.getCursorColor(),fontSize:this.terminal_.getFontSize(),fontFamily:this.terminal_.getFontFamily(),baseURL:lib.f.getURL("/")}])}.bind(this))},hterm.Frame.prototype.onCloseClicked_=function(){this.close()},hterm.Frame.prototype.close=function(){this.container_&&this.container_.parentNode&&(this.container_.parentNode.removeChild(this.container_),this.onClose())},hterm.Frame.prototype.onClose=function(){},hterm.Frame.prototype.postMessage=function(e,t){if(!this.messageChannel_)throw new Error("Message channel is not set up.");this.messageChannel_.port1.postMessage({name:e,argv:t})},hterm.Frame.prototype.show=function(){function e(e,r){return e in t.options?t.options[e]:r}var t=this,t=this;if(this.container_&&this.container_.parentNode)console.error("Frame already visible");else{var r=hterm.getClientSize(this.div_),o=e("width",640),i=e("height",480),s=(r.width,r.height,this.terminal_.document_),n=this.container_=s.createElement("div");n.style.cssText="position: absolute;display: none;flex-direction: column;top: 10%;left: 4%;width: 90%;height: 80%;min-height: 20%;max-height: 80%;box-shadow: 0 0 2px "+this.terminal_.getForegroundColor()+";border: 2px "+this.terminal_.getForegroundColor()+" solid;";var a=this.iframe_=s.createElement("iframe");a.onload=this.onLoad_.bind(this),a.style.cssText="display: flex;flex: 1;width: 100%",a.setAttribute("src",this.url),a.setAttribute("seamless",!0),n.appendChild(a),this.div_.appendChild(n)}},lib.rtdep("hterm.Keyboard.KeyMap"),hterm.Keyboard=function(e){this.terminal=e,this.keyboardElement_=null,this.handlers_=[["focusout",this.onFocusOut_.bind(this)],["keydown",this.onKeyDown_.bind(this)],["keypress",this.onKeyPress_.bind(this)],["keyup",this.onKeyUp_.bind(this)],["textInput",this.onTextInput_.bind(this)]],this.keyMap=new hterm.Keyboard.KeyMap(this),this.bindings=new hterm.Keyboard.Bindings(this),this.altGrMode="none",this.shiftInsertPaste=!0,this.homeKeysScroll=!1,this.pageKeysScroll=!1,this.ctrlPlusMinusZeroZoom=!0,this.ctrlCCopy=!1,this.ctrlVPaste=!1,this.applicationKeypad=!1,this.applicationCursor=!1,this.backspaceSendsBackspace=!1,this.characterEncoding="utf-8",this.metaSendsEscape=!0,this.passMetaV=!0,this.altSendsWhat="escape",this.altIsMeta=!1,this.altBackspaceIsMetaBackspace=!1,this.altKeyPressed=0,this.mediaKeysAreFKeys=!1,this.previousAltSendsWhat_=null},hterm.Keyboard.KeyActions={CANCEL:lib.f.createEnum("CANCEL"),DEFAULT:lib.f.createEnum("DEFAULT"),PASS:lib.f.createEnum("PASS"),STRIP:lib.f.createEnum("STRIP")},hterm.Keyboard.prototype.encode=function(e){return"utf-8"==this.characterEncoding?this.terminal.vt.encodeUTF8(e):e},hterm.Keyboard.prototype.installKeyboard=function(e){if(e!=this.keyboardElement_){e&&this.keyboardElement_&&this.installKeyboard(null);for(var t=0;t<this.handlers_.length;t++){var r=this.handlers_[t];e?e.addEventListener(r[0],r[1]):this.keyboardElement_.removeEventListener(r[0],r[1])}this.keyboardElement_=e}},hterm.Keyboard.prototype.uninstallKeyboard=function(){this.installKeyboard(null)},hterm.Keyboard.prototype.onTextInput_=function(e){e.data&&this.terminal.onVTKeystroke(e.data)},hterm.Keyboard.prototype.onKeyPress_=function(e){var t=String.fromCharCode(e.which).toLowerCase();if(!e.ctrlKey&&!e.metaKey||"c"!=t&&"v"!=t){if(e.altKey&&"browser-key"==this.altSendsWhat&&0==e.charCode){var r=String.fromCharCode(e.keyCode);e.shiftKey||(r=r.toLowerCase()),r.charCodeAt(0)+128}else e.charCode>=32&&(r=e.charCode);r&&this.terminal.onVTKeystroke(String.fromCharCode(r)),e.preventDefault(),e.stopPropagation()}},hterm.Keyboard.prototype.preventChromeAppNonCtrlShiftDefault_=function(e){window.chrome&&window.chrome.app&&window.chrome.app.window&&(e.ctrlKey&&e.shiftKey||e.preventDefault())},hterm.Keyboard.prototype.onFocusOut_=function(e){this.altKeyPressed=0},hterm.Keyboard.prototype.onKeyUp_=function(e){18==e.keyCode&&(this.altKeyPressed=this.altKeyPressed&~(1<<e.location-1)),27==e.keyCode&&this.preventChromeAppNonCtrlShiftDefault_(e)},hterm.Keyboard.prototype.onKeyDown_=function(e){function t(s){o=s;var a=r[s];return"function"==typeof a&&(a=a.apply(i.keyMap,[e,r])),a===n&&"normal"!=s&&(a=t("normal")),a}18==e.keyCode&&(this.altKeyPressed=this.altKeyPressed|1<<e.location-1),27==e.keyCode&&this.preventChromeAppNonCtrlShiftDefault_(e);var r=this.keyMap.keyDefs[e.keyCode];if(r){var o=null,i=this,s=hterm.Keyboard.KeyActions.CANCEL,n=hterm.Keyboard.KeyActions.DEFAULT,a=hterm.Keyboard.KeyActions.PASS,l=hterm.Keyboard.KeyActions.STRIP,h=e.ctrlKey,c=!this.altIsMeta&&e.altKey,u=this.altIsMeta?e.altKey||e.metaKey:e.metaKey,d=!/^\[\w+\]$/.test(r.keyCap);switch(this.altGrMode){case"ctrl-alt":d&&h&&c&&(h=!1,c=!1);break;case"right-alt":d&&2&this.terminal.keyboard.altKeyPressed&&(h=!1,c=!1);break;case"left-alt":d&&1&this.terminal.keyboard.altKeyPressed&&(h=!1,c=!1)}var g;g=t(h?"control":c?"alt":u?"meta":"normal");var p=!e.maskShiftKey&&e.shiftKey,m={keyCode:e.keyCode,shift:e.shiftKey,ctrl:h,alt:c,meta:u},b=this.bindings.getBinding(m);if(b&&(p=h=c=u=!1,o="normal","function"==typeof(g=b.action)&&(g=g.call(this,this.terminal,m))),c&&"browser-key"==this.altSendsWhat&&g==n&&(g=a),g!==a&&(g!==n||h||c||u)&&(g===l&&(c=h=!1,"function"==typeof(g=r.normal)&&(g=g.apply(this.keyMap,[e,r])),g==n&&2==r.keyCap.length&&(g=r.keyCap.substr(p?1:0,1))),e.preventDefault(),e.stopPropagation(),g!==s))if(g===n||"string"==typeof g){if("control"==o?h=!1:"alt"==o?c=!1:"meta"==o&&(u=!1),"["==g.substr(0,2)&&(c||h||p||u)){var f=1;p&&(f+=1),c&&(f+=2),h&&(f+=4),u&&(f+=8);var y=";"+f;g=3==g.length?"[1"+y+g.substr(2,1):g.substr(0,g.length-1)+y+g.substr(g.length-1)}else{if(g===n&&(g=r.keyCap.substr(p?1:0,1),h&&(A=r.keyCap.substr(0,1).charCodeAt(0))>=64&&A<=95&&(g=String.fromCharCode(A-64))),c&&"8-bit"==this.altSendsWhat&&1==g.length){var A=g.charCodeAt(0)+128;g=String.fromCharCode(A)}(c&&"escape"==this.altSendsWhat||u&&this.metaSendsEscape)&&(g=""+g)}this.terminal.onVTKeystroke(g)}else console.warn("Invalid action: "+JSON.stringify(g))}else console.warn("No definition for keyCode: "+e.keyCode)},hterm.Keyboard.Bindings=function(){this.bindings_={}},hterm.Keyboard.Bindings.prototype.clear=function(){this.bindings_={}},hterm.Keyboard.Bindings.prototype.addBinding_=function(e,t){var r=null,o=this.bindings_[e.keyCode];if(o)for(var i=0;i<o.length;i++)if(o[i].keyPattern.matchKeyPattern(e)){r=o[i];break}r?r.action=t:(r={keyPattern:e,action:t},o?(this.bindings_[e.keyCode].push(r),o.sort(function(e,t){return hterm.Keyboard.KeyPattern.sortCompare(e.keyPattern,t.keyPattern)})):this.bindings_[e.keyCode]=[r])},hterm.Keyboard.Bindings.prototype.addBinding=function(e,t){if("string"==typeof e){var r=new hterm.Parser;r.reset(e);var o;try{o=r.parseKeySequence()}catch(e){return void console.error(e)}if(r.isComplete()){if("string"==typeof t){r.reset(t);try{t=r.parseKeyAction()}catch(e){return void console.error(e)}}r.isComplete()?this.addBinding_(new hterm.Keyboard.KeyPattern(o),t):console.error(r.error("Expected end of sequence: "+o))}else console.error(r.error("Expected end of sequence: "+o))}else this.addBinding_(e,t)},hterm.Keyboard.Bindings.prototype.addBindings=function(e){for(var t in e)this.addBinding(t,e[t])},hterm.Keyboard.Bindings.prototype.getBinding=function(e){var t=this.bindings_[e.keyCode];if(!t)return null;for(var r=0;r<t.length;r++){var o=t[r];if(o.keyPattern.matchKeyDown(e))return o}return null},lib.rtdep("hterm.Keyboard.KeyActions"),hterm.Keyboard.KeyMap=function(e){this.keyboard=e,this.keyDefs={},this.reset()},hterm.Keyboard.KeyMap.prototype.addKeyDef=function(e,t){e in this.keyDefs&&console.warn("Duplicate keyCode: "+e),this.keyDefs[e]=t},hterm.Keyboard.KeyMap.prototype.addKeyDefs=function(e){for(var t=0;t<arguments.length;t++)this.addKeyDef(arguments[t][0],{keyCap:arguments[t][1],normal:arguments[t][2],control:arguments[t][3],alt:arguments[t][4],meta:arguments[t][5]})},hterm.Keyboard.KeyMap.prototype.reset=function(){function e(e,t,r){return"function"==typeof e?e.apply(h,[t,r]):e}function t(t,r){return function(o,i){return e(o.shiftKey||o.ctrlKey||o.altKey||o.metaKey||!h.keyboard.applicationCursor?t:r,o,i)}}function r(t,r){return function(o,i){return e(h.keyboard.backspaceSendsBackspace?r:t,o,i)}}function o(t,r){return function(o,i){var s=o.shiftKey?r:t;return o.maskShiftKey=!0,e(s,o,i)}}function i(t,r){return function(o,i){return e(o.altKey?r:t,o,i)}}function s(t,r){return function(o,i){return e(o.shiftKey||o.ctrlKey||o.altKey||o.metaKey?r:t,o,i)}}function n(e){return String.fromCharCode(e.charCodeAt(0)-64)}function a(e){return function(t,r){return this[e](t,r)}}function l(t){return function(r,o){return h.keyboard.mediaKeysAreFKeys?e(t,r,o):166==r.keyCode||167==r.keyCode||168==r.keyCode?hterm.Keyboard.KeyActions.CANCEL:hterm.Keyboard.KeyActions.PASS}}this.keyDefs={};var h=this,c=hterm.Keyboard.KeyActions.CANCEL,u=hterm.Keyboard.KeyActions.DEFAULT,d=hterm.Keyboard.KeyActions.PASS,g=hterm.Keyboard.KeyActions.STRIP;this.addKeyDefs([0,"[UNKNOWN]",d,d,d,d],[27,"[ESC]","",u,u,u],[112,"[F1]",s("OP",""),u,"[23~",u],[113,"[F2]",s("OQ",""),u,"[24~",u],[114,"[F3]",s("OR",""),u,"[25~",u],[115,"[F4]",s("OS",""),u,"[26~",u],[116,"[F5]","[15~",u,"[28~",u],[117,"[F6]","[17~",u,"[29~",u],[118,"[F7]","[18~",u,"[31~",u],[119,"[F8]","[19~",u,"[32~",u],[120,"[F9]","[20~",u,"[33~",u],[121,"[F10]","[21~",u,"[34~",u],[122,"[F11]","[23~",u,"[42~",u],[123,"[F12]","[24~",u,"[43~",u],[192,"`~",u,o(n("@"),n("^")),u,d],[49,"1!",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[50,"2@",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[51,"3#",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[52,"4$",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[53,"5%",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[54,"6^",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[55,"7&",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[56,"8*",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[57,"9(",u,a("onCtrlNum_"),a("onAltNum_"),a("onMetaNum_")],[48,"0)",u,a("onPlusMinusZero_"),a("onAltNum_"),a("onPlusMinusZero_")],[189,"-_",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[187,"=+",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[173,"-_",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[61,"=+",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[171,"+*",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[8,"[BKSP]",r("","\b"),r("\b",""),u,u],[9,"[TAB]",o("\t",""),g,d,u],[81,"qQ",u,n("Q"),u,u],[87,"wW",u,n("W"),u,u],[69,"eE",u,n("E"),u,u],[82,"rR",u,n("R"),u,u],[84,"tT",u,n("T"),u,u],[89,"yY",u,n("Y"),u,u],[85,"uU",u,n("U"),u,u],[73,"iI",u,n("I"),u,u],[79,"oO",u,n("O"),u,u],[80,"pP",u,n("P"),u,u],[219,"[{",u,n("["),u,u],[221,"]}",u,n("]"),u,u],[220,"\\|",u,n("\\"),u,u],[20,"[CAPS]",d,d,d,u],[65,"aA",u,n("A"),u,u],[83,"sS",u,n("S"),u,u],[68,"dD",u,n("D"),u,u],[70,"fF",u,n("F"),u,u],[71,"gG",u,n("G"),u,u],[72,"hH",u,n("H"),u,u],[74,"jJ",u,o(n("J"),d),u,u],[75,"kK",u,o(n("K"),a("onClear_")),u,u],[76,"lL",u,o(n("L"),d),u,u],[186,";:",u,g,u,u],[222,"'\"",u,g,u,u],[13,"[ENTER]","\r",c,c,u],[16,"[SHIFT]",d,d,d,u],[90,"zZ",u,n("Z"),u,u],[88,"xX",u,n("X"),u,u],[67,"cC",u,a("onCtrlC_"),u,a("onMetaC_")],[86,"vV",u,a("onCtrlV_"),u,a("onMetaV_")],[66,"bB",u,o(n("B"),d),u,o(u,d)],[78,"nN",u,a("onCtrlN_"),u,a("onMetaN_")],[77,"mM",u,n("M"),u,u],[188,",<",u,i(g,d),u,u],[190,".>",u,i(g,d),u,u],[191,"/?",u,o(n("_"),n("?")),u,u],[17,"[CTRL]",d,d,d,d],[18,"[ALT]",d,d,d,d],[91,"[LAPL]",d,d,d,d],[32," ",u,n("@"),u,u],[92,"[RAPL]",d,d,d,d],[93,"[RMENU]",d,d,d,d],[42,"[PRTSCR]",d,d,d,d],[145,"[SCRLK]",d,d,d,d],[19,"[BREAK]",d,d,d,d],[45,"[INSERT]",a("onKeyInsert_"),u,u,u],[36,"[HOME]",a("onKeyHome_"),u,u,u],[33,"[PGUP]",a("onKeyPageUp_"),u,u,u],[46,"[DEL]",a("onKeyDel_"),u,u,u],[35,"[END]",a("onKeyEnd_"),u,u,u],[34,"[PGDOWN]",a("onKeyPageDown_"),u,u,u],[38,"[UP]",a("onKeyArrowUp_"),u,u,u],[40,"[DOWN]",a("onKeyArrowDown_"),u,u,u],[39,"[RIGHT]",t("","OC"),u,u,u],[37,"[LEFT]",t("","OD"),u,u,u],[144,"[NUMLOCK]",d,d,d,d],[96,"[KP0]",u,u,u,u],[97,"[KP1]",u,u,u,u],[98,"[KP2]",u,u,u,u],[99,"[KP3]",u,u,u,u],[100,"[KP4]",u,u,u,u],[101,"[KP5]",u,u,u,u],[102,"[KP6]",u,u,u,u],[103,"[KP7]",u,u,u,u],[104,"[KP8]",u,u,u,u],[105,"[KP9]",u,u,u,u],[107,"[KP+]",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[109,"[KP-]",u,a("onPlusMinusZero_"),u,a("onPlusMinusZero_")],[106,"[KP*]",u,u,u,u],[111,"[KP/]",u,u,u,u],[110,"[KP.]",u,u,u,u],[166,"[BACK]",l(s("OP","")),u,"[23~",u],[167,"[FWD]",l(s("OQ","")),u,"[24~",u],[168,"[RELOAD]",l(s("OR","")),u,"[25~",u],[183,"[FSCR]",l(s("OS","")),u,"[26~",u],[182,"[WINS]",l("[15~"),u,"[28~",u],[216,"[BRIT-]",l("[17~"),u,"[29~",u],[217,"[BRIT+]",l("[18~"),u,"[31~",u])},hterm.Keyboard.KeyMap.prototype.onKeyInsert_=function(e){return this.keyboard.shiftInsertPaste&&e.shiftKey?hterm.Keyboard.KeyActions.PASS:"[2~"},hterm.Keyboard.KeyMap.prototype.onKeyHome_=function(e){return!this.keyboard.homeKeysScroll^e.shiftKey?e.altey||e.ctrlKey||e.shiftKey||!this.keyboard.applicationCursor?"":"OH":(this.keyboard.terminal.scrollHome(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onKeyEnd_=function(e){return!this.keyboard.homeKeysScroll^e.shiftKey?e.altKey||e.ctrlKey||e.shiftKey||!this.keyboard.applicationCursor?"":"OF":(this.keyboard.terminal.scrollEnd(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onKeyPageUp_=function(e){return!this.keyboard.pageKeysScroll^e.shiftKey?"[5~":(this.keyboard.terminal.scrollPageUp(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onKeyDel_=function(e){return this.keyboard.altBackspaceIsMetaBackspace&&this.keyboard.altKeyPressed&&!e.altKey?"":"[3~"},hterm.Keyboard.KeyMap.prototype.onKeyPageDown_=function(e){return!this.keyboard.pageKeysScroll^e.shiftKey?"[6~":(this.keyboard.terminal.scrollPageDown(),hterm.Keyboard.KeyActions.CANCEL)},hterm.Keyboard.KeyMap.prototype.onKeyArrowUp_=function(e){return!this.keyboard.applicationCursor&&e.shiftKey?(this.keyboard.terminal.scrollLineUp(),hterm.Keyboard.KeyActions.CANCEL):e.shiftKey||e.ctrlKey||e.altKey||e.metaKey||!this.keyboard.applicationCursor?"":"OA"},hterm.Keyboard.KeyMap.prototype.onKeyArrowDown_=function(e){return!this.keyboard.applicationCursor&&e.shiftKey?(this.keyboard.terminal.scrollLineDown(),hterm.Keyboard.KeyActions.CANCEL):e.shiftKey||e.ctrlKey||e.altKey||e.metaKey||!this.keyboard.applicationCursor?"":"OB"},hterm.Keyboard.KeyMap.prototype.onClear_=function(e,t){return this.keyboard.terminal.wipeContents(),hterm.Keyboard.KeyActions.CANCEL},hterm.Keyboard.KeyMap.prototype.onCtrlNum_=function(e,t){function r(e){return String.fromCharCode(e.charCodeAt(0)-64)}if(this.keyboard.terminal.passCtrlNumber&&!e.shiftKey)return hterm.Keyboard.KeyActions.PASS;switch(t.keyCap.substr(0,1)){case"1":return"1";case"2":return r("@");case"3":return r("[");case"4":return r("\\");case"5":return r("]");case"6":return r("^");case"7":return r("_");case"8":return"";case"9":return"9"}},hterm.Keyboard.KeyMap.prototype.onAltNum_=function(e,t){return this.keyboard.terminal.passAltNumber&&!e.shiftKey?hterm.Keyboard.KeyActions.PASS:hterm.Keyboard.KeyActions.DEFAULT},hterm.Keyboard.KeyMap.prototype.onMetaNum_=function(e,t){return this.keyboard.terminal.passMetaNumber&&!e.shiftKey?hterm.Keyboard.KeyActions.PASS:hterm.Keyboard.KeyActions.DEFAULT},hterm.Keyboard.KeyMap.prototype.onCtrlC_=function(e,t){var r=this.keyboard.terminal.getDocument().getSelection();if(!r.isCollapsed){if(this.keyboard.ctrlCCopy&&!e.shiftKey)return this.keyboard.terminal.clearSelectionAfterCopy&&setTimeout(r.collapseToEnd.bind(r),50),hterm.Keyboard.KeyActions.PASS;if(!this.keyboard.ctrlCCopy&&e.shiftKey)return this.keyboard.terminal.clearSelectionAfterCopy&&setTimeout(r.collapseToEnd.bind(r),50),this.keyboard.terminal.copySelectionToClipboard(),hterm.Keyboard.KeyActions.CANCEL}return""},hterm.Keyboard.KeyMap.prototype.onCtrlN_=function(e,t){return e.shiftKey?(window.open(document.location.href,"","chrome=no,close=yes,resize=yes,scrollbars=yes,minimizable=yes,width="+window.innerWidth+",height="+window.innerHeight),hterm.Keyboard.KeyActions.CANCEL):""},hterm.Keyboard.KeyMap.prototype.onCtrlV_=function(e,t){return!e.shiftKey&&this.keyboard.ctrlVPaste||e.shiftKey&&!this.keyboard.ctrlVPaste?this.keyboard.terminal.paste()?hterm.Keyboard.KeyActions.CANCEL:hterm.Keyboard.KeyActions.PASS:""},hterm.Keyboard.KeyMap.prototype.onMetaN_=function(e,t){return e.shiftKey?(window.open(document.location.href,"","chrome=no,close=yes,resize=yes,scrollbars=yes,minimizable=yes,width="+window.outerWidth+",height="+window.outerHeight),hterm.Keyboard.KeyActions.CANCEL):hterm.Keyboard.KeyActions.DEFAULT},hterm.Keyboard.KeyMap.prototype.onMetaC_=function(e,t){var r=this.keyboard.terminal.getDocument();return e.shiftKey||r.getSelection().isCollapsed?t.keyCap.substr(e.shiftKey?1:0,1):(this.keyboard.terminal.clearSelectionAfterCopy&&setTimeout(function(){r.getSelection().collapseToEnd()},50),hterm.Keyboard.KeyActions.PASS)},hterm.Keyboard.KeyMap.prototype.onMetaV_=function(e,t){return e.shiftKey?hterm.Keyboard.KeyActions.PASS:this.keyboard.passMetaV?hterm.Keyboard.KeyActions.PASS:hterm.Keyboard.KeyActions.DEFAULT},hterm.Keyboard.KeyMap.prototype.onPlusMinusZero_=function(e,t){if(!(this.keyboard.ctrlPlusMinusZeroZoom^e.shiftKey))return"-_"==t.keyCap?"":hterm.Keyboard.KeyActions.CANCEL;if(1!=this.keyboard.terminal.getZoomFactor())return hterm.Keyboard.KeyActions.PASS;var r=t.keyCap.substr(0,1);if("0"==r)this.keyboard.terminal.setFontSize(0);else{var o=this.keyboard.terminal.getFontSize();"-"==r||"[KP-]"==t.keyCap?o-=1:o+=1,this.keyboard.terminal.setFontSize(o)}return hterm.Keyboard.KeyActions.CANCEL},hterm.Keyboard.KeyPattern=function(e){this.wildcardCount=0,this.keyCode=e.keyCode,hterm.Keyboard.KeyPattern.modifiers.forEach(function(t){this[t]=e[t]||!1,"*"==this[t]&&this.wildcardCount++}.bind(this))},hterm.Keyboard.KeyPattern.modifiers=["shift","ctrl","alt","meta"],hterm.Keyboard.KeyPattern.sortCompare=function(e,t){return e.wildcardCount<t.wildcardCount?-1:e.wildcardCount>t.wildcardCount?1:0},hterm.Keyboard.KeyPattern.prototype.match_=function(e,t){if(this.keyCode!=e.keyCode)return!1;var r=!0;return hterm.Keyboard.KeyPattern.modifiers.forEach(function(o){var i=o in e&&e[o];r&&(t||"*"!=this[o])&&this[o]!=i&&(r=!1)}.bind(this)),r},hterm.Keyboard.KeyPattern.prototype.matchKeyDown=function(e){return this.match_(e,!1)},hterm.Keyboard.KeyPattern.prototype.matchKeyPattern=function(e){return this.match_(e,!0)},hterm.Options=function(e){this.wraparound=!e||e.wraparound,this.reverseWraparound=!!e&&e.reverseWraparound,this.originMode=!!e&&e.originMode,this.autoCarriageReturn=!!e&&e.autoCarriageReturn,this.cursorVisible=!!e&&e.cursorVisible,this.cursorBlink=!!e&&e.cursorBlink,this.insertMode=!!e&&e.insertMode,this.reverseVideo=!!e&&e.reverseVideo,this.bracketedPaste=!!e&&e.bracketedPaste},lib.rtdep("hterm.Keyboard.KeyActions"),hterm.Parser=function(){this.source="",this.pos=0,this.ch=null},hterm.Parser.prototype.error=function(e){return new Error("Parse error at "+this.pos+": "+e)},hterm.Parser.prototype.isComplete=function(){return this.pos==this.source.length},hterm.Parser.prototype.reset=function(e,t){this.source=e,this.pos=t||0,this.ch=e.substr(0,1)},hterm.Parser.prototype.parseKeySequence=function(){var e={keyCode:null};for(var t in hterm.Parser.identifiers.modifierKeys)e[hterm.Parser.identifiers.modifierKeys[t]]=!1;for(;this.pos<this.source.length;){this.skipSpace();var r=this.parseToken();if("integer"==r.type)e.keyCode=r.value;else if("identifier"==r.type){var o=r.value.toUpperCase();if(o in hterm.Parser.identifiers.modifierKeys&&hterm.Parser.identifiers.modifierKeys.hasOwnProperty(o)){var i=hterm.Parser.identifiers.modifierKeys[o];if(e[i]&&"*"!=e[i])throw this.error("Duplicate modifier: "+r.value);e[i]=!0}else{if(!(o in hterm.Parser.identifiers.keyCodes&&hterm.Parser.identifiers.keyCodes.hasOwnProperty(o)))throw this.error("Unknown key: "+r.value);e.keyCode=hterm.Parser.identifiers.keyCodes[o]}}else{if("symbol"!=r.type)throw this.error("Expected integer or identifier");if("*"!=r.value)throw this.error("Unexpected symbol: "+r.value);for(var s in hterm.Parser.identifiers.modifierKeys){var n=hterm.Parser.identifiers.modifierKeys[s];e[n]||(e[n]="*")}}if(this.skipSpace(),"-"!=this.ch)break;if(null!=e.keyCode)throw this.error("Extra definition after target key");this.advance(1)}if(null==e.keyCode)throw this.error("Missing target key");return e},hterm.Parser.prototype.parseKeyAction=function(){this.skipSpace();var e=this.parseToken();if("string"==e.type)return e.value;if("identifier"==e.type){if(e.value in hterm.Parser.identifiers.actions&&hterm.Parser.identifiers.actions.hasOwnProperty(e.value))return hterm.Parser.identifiers.actions[e.value];throw this.error("Unknown key action: "+e.value)}throw this.error("Expected string or identifier")},hterm.Parser.prototype.peekString=function(){return"'"==this.ch||'"'==this.ch},hterm.Parser.prototype.peekIdentifier=function(){return this.ch.match(/[a-z_]/i)},hterm.Parser.prototype.peekInteger=function(){return this.ch.match(/[0-9]/)},hterm.Parser.prototype.parseToken=function(){if("*"==this.ch){var e={type:"symbol",value:this.ch};return this.advance(1),e}if(this.peekIdentifier())return{type:"identifier",value:this.parseIdentifier()};if(this.peekString())return{type:"string",value:this.parseString()};if(this.peekInteger())return{type:"integer",value:this.parseInteger()};throw this.error("Unexpected token")},hterm.Parser.prototype.parseIdentifier=function(){if(!this.peekIdentifier())throw this.error("Expected identifier");return this.parsePattern(/[a-z0-9_]+/gi)},hterm.Parser.prototype.parseInteger=function(){return"0"==this.ch&&this.pos<this.source.length-1&&"x"==this.source.substr(this.pos+1,1)?parseInt(this.parsePattern(/0x[0-9a-f]+/gi)):parseInt(this.parsePattern(/\d+/g))},hterm.Parser.prototype.parseString=function(){var e="",t=this.ch;if('"'!=t&&"'"!=t)throw this.error("String expected");this.advance(1);for(var r=new RegExp("[\\\\"+t+"]","g");this.pos<this.source.length;){if(r.lastIndex=this.pos,!r.exec(this.source))throw this.error("Unterminated string literal");if(e+=this.source.substring(this.pos,r.lastIndex-1),this.advance(r.lastIndex-this.pos-1),'"'!=t||"\\"!=this.ch)if("'"!=t||"\\"!=this.ch){if(this.ch==t)return this.advance(1),e}else e+=this.ch,this.advance(1);else this.advance(1),e+=this.parseEscape()}throw this.error("Unterminated string literal")},hterm.Parser.prototype.parseEscape=function(){var e={'"':'"',"'":"'","\\":"\\",a:"",b:"\b",e:"",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",x:function(){var e=this.parsePattern(/[a-z0-9]{2}/gi);return String.fromCharCode(parseInt(e,16))},u:function(){var e=this.parsePattern(/[a-z0-9]{4}/gi);return String.fromCharCode(parseInt(e,16))}};if(!(this.ch in e&&e.hasOwnProperty(this.ch)))throw this.error("Unknown escape: "+this.ch);var t=e[this.ch];return this.advance(1),"function"==typeof t&&(t=t.call(this)),t},hterm.Parser.prototype.parsePattern=function(e){if(!e.global)throw this.error("Internal error: Span patterns must be global");e.lastIndex=this.pos;var t=e.exec(this.source);if(!t||e.lastIndex-t[0].length!=this.pos)throw this.error("Expected match for: "+e);return this.pos=e.lastIndex-1,this.advance(1),t[0]},hterm.Parser.prototype.advance=function(e){this.pos+=e,this.ch=this.source.substr(this.pos,1)},hterm.Parser.prototype.skipSpace=function(e){if(/\s/.test(this.ch)){var t=/\s+/gm;t.lastIndex=this.pos;var r=this.source;if(t.exec(r)&&(this.pos=t.lastIndex),this.ch=this.source.substr(this.pos,1),e&&-1==this.ch.indexOf(e))throw this.error("Expected one of "+e+", found: "+this.ch)}},hterm.Parser.identifiers={},hterm.Parser.identifiers.modifierKeys={SHIFT:"shift",CTRL:"ctrl",CONTROL:"ctrl",ALT:"alt",META:"meta"},hterm.Parser.identifiers.keyCodes={ESCAPE:27,ESC:27,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,ZERO:48,BACKSPACE:8,BKSP:8,BS:8,TAB:9,Q:81,W:87,E:69,R:82,T:84,Y:89,U:85,I:73,O:79,P:80,CAPS_LOCK:20,CAPSLOCK:20,CAPS:20,A:65,S:83,D:68,F:70,G:71,H:72,J:74,K:75,L:76,ENTER:13,ENT:13,RETURN:13,RET:13,Z:90,X:88,C:67,V:86,B:66,N:78,M:77,SPACE:32,SP:32,PRINT_SCREEN:42,PRTSC:42,SCROLL_LOCK:145,SCRLK:145,BREAK:19,BRK:19,INSERT:45,INS:45,HOME:36,PAGE_UP:33,PGUP:33,DELETE:46,DEL:46,END:35,PAGE_DOWN:34,PGDOWN:34,PGDN:34,UP:38,DOWN:40,RIGHT:39,LEFT:37,NUMLOCK:144,KP0:96,KP1:97,KP2:98,KP3:99,KP4:100,KP5:101,KP6:102,KP7:103,KP8:104,KP9:105,KP_PLUS:107,KP_ADD:107,KP_MINUS:109,KP_SUBTRACT:109,KP_STAR:106,KP_MULTIPLY:106,KP_DIVIDE:111,KP_DECIMAL:110,KP_PERIOD:110,NAVIGATE_BACK:166,NAVIGATE_FORWARD:167,RELOAD:168,FULL_SCREEN:183,WINDOW_OVERVIEW:182,BRIGHTNESS_UP:216,BRIGHTNESS_DOWN:217},hterm.Parser.identifiers.actions={CANCEL:hterm.Keyboard.KeyActions.CANCEL,DEFAULT:hterm.Keyboard.KeyActions.DEFAULT,PASS:hterm.Keyboard.KeyActions.PASS,scrollPageUp:function(e){return e.scrollPageUp(),hterm.Keyboard.KeyActions.CANCEL},scrollPageDown:function(e){return e.scrollPageDown(),hterm.Keyboard.KeyActions.CANCEL},scrollToTop:function(e){return e.scrollEnd(),hterm.Keyboard.KeyActions.CANCEL},scrollToBottom:function(e){return e.scrollEnd(),hterm.Keyboard.KeyActions.CANCEL},clearScrollback:function(e){return e.wipeContents(),hterm.Keyboard.KeyActions.CANCEL}},lib.rtdep("lib.f","lib.Storage"),hterm.PreferenceManager=function(e){lib.PreferenceManager.call(this,hterm.defaultStorage,"/hterm/profiles/"+e);var t=hterm.PreferenceManager.defaultPreferences;Object.keys(t).forEach(function(e){this.definePreference(e,t[e][1])}.bind(this))},hterm.PreferenceManager.categories={},hterm.PreferenceManager.categories.Keyboard="Keyboard",hterm.PreferenceManager.categories.Appearance="Appearance",hterm.PreferenceManager.categories.CopyPaste="CopyPaste",hterm.PreferenceManager.categories.Sounds="Sounds",hterm.PreferenceManager.categories.Scrolling="Scrolling",hterm.PreferenceManager.categories.Encoding="Encoding",hterm.PreferenceManager.categories.Miscellaneous="Miscellaneous",hterm.PreferenceManager.categoryDefinitions=[{id:hterm.PreferenceManager.categories.Appearance,text:"Appearance (fonts, colors, images)"},{id:hterm.PreferenceManager.categories.CopyPaste,text:"Copy & Paste"},{id:hterm.PreferenceManager.categories.Encoding,text:"Encoding"},{id:hterm.PreferenceManager.categories.Keyboard,text:"Keyboard"},{id:hterm.PreferenceManager.categories.Scrolling,text:"Scrolling"},{id:hterm.PreferenceManager.categories.Sounds,text:"Sounds"},{id:hterm.PreferenceManager.categories.Miscellaneous,text:"Misc."}],hterm.PreferenceManager.defaultPreferences={"alt-gr-mode":[hterm.PreferenceManager.categories.Keyboard,null,[null,"none","ctrl-alt","left-alt","right-alt"],"Select an AltGr detection hack^Wheuristic.\n\n'null': Autodetect based on navigator.language:\n 'en-us' => 'none', else => 'right-alt'\n'none': Disable any AltGr related munging.\n'ctrl-alt': Assume Ctrl+Alt means AltGr.\n'left-alt': Assume left Alt means AltGr.\n'right-alt': Assume right Alt means AltGr.\n"],"alt-backspace-is-meta-backspace":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If set, undoes the Chrome OS Alt-Backspace->DEL remap, so that alt-backspace indeed is alt-backspace."],"alt-is-meta":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Set whether the alt key acts as a meta key or as a distinct alt key."],"alt-sends-what":[hterm.PreferenceManager.categories.Keyboard,"escape",["escape","8-bit","browser-key"],"Controls how the alt key is handled.\n\n escape....... Send an ESC prefix.\n 8-bit........ Add 128 to the unshifted character as in xterm.\n browser-key.. Wait for the keypress event and see what the browser \n says. (This won't work well on platforms where the \n browser performs a default action for some alt sequences.)"],"audible-bell-sound":[hterm.PreferenceManager.categories.Sounds,"lib-resource:hterm/audio/bell","url","URL of the terminal bell sound. Empty string for no audible bell."],"desktop-notification-bell":[hterm.PreferenceManager.categories.Sounds,!1,"bool",'If true, terminal bells in the background will create a Web Notification. https://www.w3.org/TR/notifications/\n\nDisplaying notifications requires permission from the user. When this option is set to true, hterm will attempt to ask the user for permission if necessary. Note browsers may not show this permission request if it did not originate from a user action.\n\nChrome extensions with the "notifications" permission have permission to display notifications.'],"background-color":[hterm.PreferenceManager.categories.Appearance,"rgb(16, 16, 16)","color","The background color for text with no other color attributes."],"background-image":[hterm.PreferenceManager.categories.Appearance,"","string","CSS value of the background image. Empty string for no image.\n\nFor example:\n url(https://goo.gl/anedTK)\n linear-gradient(top bottom, blue, red)"],"background-size":[hterm.PreferenceManager.categories.Appearance,"","string","CSS value of the background image size. Defaults to none."],"background-position":[hterm.PreferenceManager.categories.Appearance,"","string","CSS value of the background image position.\n\nFor example:\n 10% 10%\n center"],"backspace-sends-backspace":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, the backspace should send BS ('\\x08', aka ^H). Otherwise the backspace key should send '\\x7f'."],"character-map-overrides":[hterm.PreferenceManager.categories.Appearance,null,"value",'This is specified as an object. It is a sparse array, where each property is the character set code and the value is an object that is a sparse array itself. In that sparse array, each property is the received character and the value is the displayed character.\n\nFor example:\n {"0":{"+":"\\u2192",",":"\\u2190","-":"\\u2191",".":"\\u2193", "0":"\\u2588"}}'],"close-on-exit":[hterm.PreferenceManager.categories.Miscellaneous,!0,"bool","Whether or not to close the window when the command exits."],"cursor-blink":[hterm.PreferenceManager.categories.Appearance,!1,"bool","Whether or not to blink the cursor by default."],"cursor-blink-cycle":[hterm.PreferenceManager.categories.Appearance,[1e3,500],"value","The cursor blink rate in milliseconds.\n\nA two element array, the first of which is how long the cursor should be on, second is how long it should be off."],"cursor-color":[hterm.PreferenceManager.categories.Appearance,"rgba(255, 0, 0, 0.5)","color","The color of the visible cursor."],"color-palette-overrides":[hterm.PreferenceManager.categories.Appearance,null,"value","Override colors in the default palette.\n\nThis can be specified as an array or an object. If specified as an object it is assumed to be a sparse array, where each property is a numeric index into the color palette.\n\nValues can be specified as almost any css color value. This includes #RGB, #RRGGBB, rgb(...), rgba(...), and any color names that are also part of the stock X11 rgb.txt file.\n\nYou can use 'null' to specify that the default value should be not be changed. This is useful for skipping a small number of indices when the value is specified as an array."],"copy-on-select":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Automatically copy mouse selection to the clipboard."],"use-default-window-copy":[hterm.PreferenceManager.categories.CopyPaste,!1,"bool","Whether to use the default window copy behavior"],"clear-selection-after-copy":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Whether to clear the selection after copying."],"ctrl-plus-minus-zero-zoom":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","If true, Ctrl-Plus/Minus/Zero controls zoom.\nIf false, Ctrl-Shift-Plus/Minus/Zero controls zoom, Ctrl-Minus sends ^_, Ctrl-Plus/Zero do nothing."],"ctrl-c-copy":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Ctrl+C copies if true, send ^C to host if false.\nCtrl+Shift+C sends ^C to host if true, copies if false."],"ctrl-v-paste":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Ctrl+V pastes if true, send ^V to host if false.\nCtrl+Shift+V sends ^V to host if true, pastes if false."],"east-asian-ambiguous-as-two-column":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","Set whether East Asian Ambiguous characters have two column width."],"enable-8-bit-control":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","True to enable 8-bit control characters, false to ignore them.\n\nWe'll respect the two-byte versions of these control characters regardless of this setting."],"enable-bold":[hterm.PreferenceManager.categories.Appearance,null,"tristate","True if we should use bold weight font for text with the bold/bright attribute. False to use the normal weight font. Null to autodetect."],"enable-bold-as-bright":[hterm.PreferenceManager.categories.Appearance,!0,"bool","True if we should use bright colors (8-15 on a 16 color palette) for any text with the bold attribute. False otherwise."],"enable-blink":[hterm.PreferenceManager.categories.Appearance,!0,"bool","True if we should respect the blink attribute. False to ignore it. "],"enable-clipboard-notice":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Show a message in the terminal when the host writes to the clipboard."],"enable-clipboard-write":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool","Allow the host to write directly to the system clipboard."],"enable-dec12":[hterm.PreferenceManager.categories.Miscellaneous,!1,"bool","Respect the host's attempt to change the cursor blink status using DEC Private Mode 12."],environment:[hterm.PreferenceManager.categories.Miscellaneous,{TERM:"xterm-256color"},"value","The default environment variables, as an object."],"font-family":[hterm.PreferenceManager.categories.Appearance,'"DejaVu Sans Mono", "Everson Mono", FreeMono, "Menlo", "Terminal", monospace',"string","Default font family for the terminal text."],"font-size":[hterm.PreferenceManager.categories.Appearance,15,"int","The default font size in pixels."],"font-smoothing":[hterm.PreferenceManager.categories.Appearance,"antialiased","string","CSS font-smoothing property."],"foreground-color":[hterm.PreferenceManager.categories.Appearance,"rgb(240, 240, 240)","color","The foreground color for text with no other color attributes."],"home-keys-scroll":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, home/end will control the terminal scrollbar and shift home/end will send the VT keycodes. If false then home/end sends VT codes and shift home/end scrolls."],keybindings:[hterm.PreferenceManager.categories.Keyboard,null,"value",'A map of key sequence to key actions. Key sequences include zero or more modifier keys followed by a key code. Key codes can be decimal or hexadecimal numbers, or a key identifier. Key actions can be specified a string to send to the host, or an action identifier. For a full explanation of the format, see https://goo.gl/LWRndr.\n\nSample keybindings:\n{\n "Ctrl-Alt-K": "clearScrollback",\n "Ctrl-Shift-L": "PASS",\n "Ctrl-H": "\'HELLO\\n\'"\n}'],"max-string-sequence":[hterm.PreferenceManager.categories.Encoding,1e5,"int","Max length of a DCS, OSC, PM, or APS sequence before we give up and ignore the code."],"media-keys-are-fkeys":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, convert media keys to their Fkey equivalent. If false, let the browser handle the keys."],"meta-sends-escape":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","Set whether the meta key sends a leading escape or not."],"mouse-right-click-paste":[hterm.PreferenceManager.categories.CopyPaste,!0,"bool",'Paste on right mouse button clicks.\n\nThis option is activate independent of the "mouse-paste-button" setting.\n\nNote: This will handle left & right handed mice correctly.'],"mouse-paste-button":[hterm.PreferenceManager.categories.CopyPaste,null,[null,0,1,2,3,4,5,6],"Mouse paste button, or null to autodetect.\n\nFor autodetect, we'll use the middle mouse button for non-X11 platforms (including Chrome OS). On X11, we'll use the right mouse button (since the native window manager should paste via the middle mouse button).\n\n0 == left (primary) button.\n1 == middle (auxiliary) button.\n2 == right (secondary) button.\n\nThis option is activate independent of the \"mouse-right-click-paste\" setting.\n\nNote: This will handle left & right handed mice correctly."],"word-break-match-left":[hterm.PreferenceManager.categories.CopyPaste,"[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:`]","string",'Regular expression to halt matching to the left (start) of a selection.\n\nNormally this is a character class to reject specific characters.\nWe allow "~" and "." by default as paths frequently start with those.'],"word-break-match-right":[hterm.PreferenceManager.categories.CopyPaste,"[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:~.`]","string","Regular expression to halt matching to the right (end) of a selection.\n\nNormally this is a character class to reject specific characters."],"word-break-match-middle":[hterm.PreferenceManager.categories.CopyPaste,"[^\\s\\[\\](){}<>\"'\\^]*","string","Regular expression to match all the characters in the middle.\n\nNormally this is a character class to reject specific characters.\n\nUsed to expand the selection surrounding the starting point."],"page-keys-scroll":[hterm.PreferenceManager.categories.Keyboard,!1,"bool","If true, page up/down will control the terminal scrollbar and shift page up/down will send the VT keycodes. If false then page up/down sends VT codes and shift page up/down scrolls."],"pass-alt-number":[hterm.PreferenceManager.categories.Keyboard,null,"tristate","Set whether we should pass Alt-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Alt-1..9 will be handled by the browser. If false, Alt-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],"pass-ctrl-number":[hterm.PreferenceManager.categories.Keyboard,null,"tristate","Set whether we should pass Ctrl-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Ctrl-1..9 will be handled by the browser. If false, Ctrl-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],"pass-meta-number":[hterm.PreferenceManager.categories.Keyboard,null,"tristate","Set whether we should pass Meta-1..9 to the browser.\n\nThis is handy when running hterm in a browser tab, so that you don't lose Chrome's \"switch to tab\" keyboard accelerators. When not running in a tab it's better to send these keys to the host so they can be used in vim or emacs.\n\nIf true, Meta-1..9 will be handled by the browser. If false, Meta-1..9 will be sent to the host. If null, autodetect based on browser platform and window type."],"pass-meta-v":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","Set whether meta-V gets passed to host."],"receive-encoding":[hterm.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the expected encoding for data received from the host.\n\nValid values are 'utf-8' and 'raw'."],"scroll-on-keystroke":[hterm.PreferenceManager.categories.Scrolling,!0,"bool","If true, scroll to the bottom on any keystroke."],"scroll-on-output":[hterm.PreferenceManager.categories.Scrolling,!1,"bool","If true, scroll to the bottom on terminal output."],"scrollbar-visible":[hterm.PreferenceManager.categories.Scrolling,!0,"bool","The vertical scrollbar mode."],"scroll-wheel-may-send-arrow-keys":[hterm.PreferenceManager.categories.Scrolling,!1,"bool","When using the alternative screen buffer, and DECCKM (Application Cursor Keys) is active, mouse wheel scroll events will emulate arrow keys.\n\nIt can be temporarily disabled by holding the shift key.\n\nThis frequently comes up when using pagers (less) or reading man pages or text editors (vi/nano) or using screen/tmux."],"scroll-wheel-move-multiplier":[hterm.PreferenceManager.categories.Scrolling,1,"int","The multiplier for the pixel delta in wheel events caused by the scroll wheel. Alters how fast the page scrolls."],"send-encoding":[hterm.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the encoding for data sent to host."],"terminal-encoding":[hterm.PreferenceManager.categories.Encoding,"iso-2022",["iso-2022","utf-8","utf-8-locked"],"The default terminal encoding (DOCS).\n\nISO-2022 enables character map translations (like graphics maps).\nUTF-8 disables support for those.\n\nThe locked variant means the encoding cannot be changed at runtime via terminal escape sequences.\n\nYou should stick with UTF-8 unless you notice broken rendering with legacy applications."],"shift-insert-paste":[hterm.PreferenceManager.categories.Keyboard,!0,"bool","Shift + Insert pastes if true, sent to host if false."],"user-css":[hterm.PreferenceManager.categories.Appearance,"","url","URL of user stylesheet to include in the terminal document."],"user-css-text":[hterm.PreferenceManager.categories.Appearance,"","multiline-string","Custom CSS text for styling the terminal."]},hterm.PreferenceManager.prototype=Object.create(lib.PreferenceManager.prototype),hterm.PreferenceManager.constructor=hterm.PreferenceManager,hterm.PubSub=function(){this.observers_={}},hterm.PubSub.addBehavior=function(e){var t=new hterm.PubSub;for(var r in hterm.PubSub.prototype)e[r]=hterm.PubSub.prototype[r].bind(t)},hterm.PubSub.prototype.subscribe=function(e,t){e in this.observers_||(this.observers_[e]=[]),this.observers_[e].push(t)},hterm.PubSub.prototype.unsubscribe=function(e,t){var r=this.observers_[e];if(!r)throw"Invalid subject: "+e;var o=r.indexOf(t);if(o<0)throw"Not subscribed: "+e;r.splice(o,1)},hterm.PubSub.prototype.publish=function(e,t,r){function o(e){e<i.length-1&&setTimeout(o,0,e+1),i[e](t)}var i=this.observers_[e];i&&(i=[].concat(i)),r&&(i?i.push(r):i=[r]),i&&setTimeout(o,0,0)},lib.rtdep("lib.f","lib.wc","hterm.RowCol","hterm.Size","hterm.TextAttributes"),hterm.Screen=function(e){this.rowsArray=[],this.columnCount_=e||80,this.textAttributes=new hterm.TextAttributes(window.document),this.cursorPosition=new hterm.RowCol(0,0),this.cursorRowNode_=null,this.cursorNode_=null,this.cursorOffset_=null,this.wordBreakMatchLeft=null,this.wordBreakMatchRight=null,this.wordBreakMatchMiddle=null},hterm.Screen.prototype.getSize=function(){return new hterm.Size(this.columnCount_,this.rowsArray.length)},hterm.Screen.prototype.getHeight=function(){return this.rowsArray.length},hterm.Screen.prototype.getWidth=function(){return this.columnCount_},hterm.Screen.prototype.setColumnCount=function(e){this.columnCount_=e,this.cursorPosition.column>=e&&this.setCursorPosition(this.cursorPosition.row,e-1)},hterm.Screen.prototype.shiftRow=function(){return this.shiftRows(1)[0]},hterm.Screen.prototype.shiftRows=function(e){return this.rowsArray.splice(0,e)},hterm.Screen.prototype.unshiftRow=function(e){this.rowsArray.splice(0,0,e)},hterm.Screen.prototype.unshiftRows=function(e){this.rowsArray.unshift.apply(this.rowsArray,e)},hterm.Screen.prototype.popRow=function(){return this.popRows(1)[0]},hterm.Screen.prototype.popRows=function(e){return this.rowsArray.splice(this.rowsArray.length-e,e)},hterm.Screen.prototype.pushRow=function(e){this.rowsArray.push(e)},hterm.Screen.prototype.pushRows=function(e){e.push.apply(this.rowsArray,e)},hterm.Screen.prototype.insertRow=function(e,t){this.rowsArray.splice(e,0,t)},hterm.Screen.prototype.insertRows=function(e,t){for(var r=0;r<t.length;r++)this.rowsArray.splice(e+r,0,t[r])},hterm.Screen.prototype.removeRow=function(e){return this.rowsArray.splice(e,1)[0]},hterm.Screen.prototype.removeRows=function(e,t){return this.rowsArray.splice(e,t)},hterm.Screen.prototype.invalidateCursorPosition=function(){this.cursorPosition.move(0,0),this.cursorRowNode_=null,this.cursorNode_=null,this.cursorOffset_=null},hterm.Screen.prototype.clearCursorRow=function(){this.cursorRowNode_.innerHTML="",this.cursorRowNode_.removeAttribute("line-overflow"),this.cursorOffset_=0,this.cursorPosition.column=0,this.cursorPosition.overflow=!1;var e;e=this.textAttributes.isDefault()?"":lib.f.getWhitespace(this.columnCount_);var t=this.textAttributes.inverse;this.textAttributes.inverse=!1,this.textAttributes.syncColors();var r=this.textAttributes.createContainer(e);this.cursorRowNode_.appendChild(r),this.cursorNode_=r,this.textAttributes.inverse=t,this.textAttributes.syncColors()},hterm.Screen.prototype.commitLineOverflow=function(){this.cursorRowNode_.setAttribute("line-overflow",!0)},hterm.Screen.prototype.setCursorPosition=function(e,t){if(this.rowsArray.length){e>=this.rowsArray.length?(console.error("Row out of bounds: "+e),e=this.rowsArray.length-1):e<0&&(console.error("Row out of bounds: "+e),e=0),t>=this.columnCount_?(console.error("Column out of bounds: "+t),t=this.columnCount_-1):t<0&&(console.error("Column out of bounds: "+t),t=0),this.cursorPosition.overflow=!1;var r=this.rowsArray[e],o=r.firstChild;o||(o=r.ownerDocument.createTextNode(""),r.appendChild(o));var i=0;for(r==this.cursorRowNode_?t>=this.cursorPosition.column-this.cursorOffset_&&(o=this.cursorNode_,i=this.cursorPosition.column-this.cursorOffset_):this.cursorRowNode_=r,this.cursorPosition.move(e,t);o;){var s=t-i,n=hterm.TextAttributes.nodeWidth(o);if(!o.nextSibling||n>s)return this.cursorNode_=o,void(this.cursorOffset_=s);i+=n,o=o.nextSibling}}else console.warn("Attempt to set cursor position on empty screen.")},hterm.Screen.prototype.syncSelectionCaret=function(e){try{e.collapse(this.cursorNode_,this.cursorOffset_)}catch(e){}},hterm.Screen.prototype.splitNode_=function(e,t){var r=e.cloneNode(!1),o=e.textContent;e.textContent=hterm.TextAttributes.nodeSubstr(e,0,t),r.textContent=lib.wc.substr(o,t),r.textContent&&e.parentNode.insertBefore(r,e.nextSibling),e.textContent||e.parentNode.removeChild(e)},hterm.Screen.prototype.maybeClipCurrentRow=function(){var e=hterm.TextAttributes.nodeWidth(this.cursorRowNode_);if(e<=this.columnCount_)this.cursorPosition.column>=this.columnCount_&&(this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1),this.cursorPosition.overflow=!0);else{var t=this.cursorPosition.column;this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1),e=hterm.TextAttributes.nodeWidth(this.cursorNode_),this.cursorOffset_<e-1&&(this.cursorNode_.textContent=hterm.TextAttributes.nodeSubstr(this.cursorNode_,0,this.cursorOffset_+1));for(var r=this.cursorRowNode_,o=this.cursorNode_.nextSibling;o;)r.removeChild(o),o=this.cursorNode_.nextSibling;t<this.columnCount_?this.setCursorPosition(this.cursorPosition.row,t):this.cursorPosition.overflow=!0}},hterm.Screen.prototype.insertString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=this.cursorNode_,o=r.textContent;this.cursorRowNode_.removeAttribute("line-overflow"),void 0===t&&(t=lib.wc.strWidth(e)),this.cursorPosition.column+=t;var i=this.cursorOffset_,s=hterm.TextAttributes.nodeWidth(r)-i;if(s<0){var n=lib.f.getWhitespace(-s);if(this.textAttributes.underline||this.textAttributes.strikethrough||this.textAttributes.background||this.textAttributes.wcNode||!this.textAttributes.asciiNode||null!=this.textAttributes.tileData)if(r.nodeType!=Node.TEXT_NODE&&(r.wcNode||!r.asciiNode||r.tileNode||r.style.textDecoration||r.style.backgroundColor)){var a=r.ownerDocument.createTextNode(n);this.cursorRowNode_.insertBefore(a,r.nextSibling),this.cursorNode_=r=a,this.cursorOffset_=i=-s,o=n}else r.textContent=o+=n;else e=n+e;s=0}if(this.textAttributes.matchesContainer(r))return r.textContent=0==s?o+e:0==i?e+o:hterm.TextAttributes.nodeSubstr(r,0,i)+e+hterm.TextAttributes.nodeSubstr(r,i),void(this.cursorOffset_+=t);if(0==i){var l=r.previousSibling;if(l&&this.textAttributes.matchesContainer(l))return l.textContent+=e,this.cursorNode_=l,void(this.cursorOffset_=lib.wc.strWidth(l.textContent));c=this.textAttributes.createContainer(e);return this.cursorRowNode_.insertBefore(c,r),this.cursorNode_=c,void(this.cursorOffset_=t)}if(0==s){var h=r.nextSibling;if(h&&this.textAttributes.matchesContainer(h))return h.textContent=e+h.textContent,this.cursorNode_=h,void(this.cursorOffset_=lib.wc.strWidth(e));c=this.textAttributes.createContainer(e);return this.cursorRowNode_.insertBefore(c,h),this.cursorNode_=c,void(this.cursorOffset_=hterm.TextAttributes.nodeWidth(c))}this.splitNode_(r,i);var c=this.textAttributes.createContainer(e);this.cursorRowNode_.insertBefore(c,r.nextSibling),this.cursorNode_=c,this.cursorOffset_=t},hterm.Screen.prototype.overwriteString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=this.columnCount_-this.cursorPosition.column;return r?(void 0===t&&(t=lib.wc.strWidth(e)),this.textAttributes.matchesContainer(this.cursorNode_)&&this.cursorNode_.textContent.substr(this.cursorOffset_)==e?(this.cursorOffset_+=t,void(this.cursorPosition.column+=t)):(this.deleteChars(Math.min(t,r)),void this.insertString(e,t))):[e]},hterm.Screen.prototype.deleteChars=function(e){var t=this.cursorNode_,r=this.cursorOffset_,o=this.cursorPosition.column;if(!(e=Math.min(e,this.columnCount_-o)))return 0;for(var i,s,n=e;t&&e;){if(e<0){console.error("Deleting "+n+" chars went negative: "+e);break}if(i=hterm.TextAttributes.nodeWidth(t),t.textContent=hterm.TextAttributes.nodeSubstr(t,0,r)+hterm.TextAttributes.nodeSubstr(t,r+e),s=hterm.TextAttributes.nodeWidth(t),t.wcNode&&r<i&&(s&&i==s||!s&&1==r)){var a=this.textAttributes.createContainer(" ");t.parentNode.insertBefore(a,r?t:t.nextSibling),t.textContent="",s=0,e-=1}else e-=i-s;var l=t.nextSibling;0==s&&t!=this.cursorNode_&&t.parentNode.removeChild(t),t=l,r=0}if(this.cursorNode_.nodeType!=Node.TEXT_NODE&&!this.cursorNode_.textContent){var h=this.cursorNode_;if(h.previousSibling)this.cursorNode_=h.previousSibling,this.cursorOffset_=hterm.TextAttributes.nodeWidth(h.previousSibling);else if(h.nextSibling)this.cursorNode_=h.nextSibling,this.cursorOffset_=0;else{var c=this.cursorRowNode_.ownerDocument.createTextNode("");this.cursorRowNode_.appendChild(c),this.cursorNode_=c,this.cursorOffset_=0}this.cursorRowNode_.removeChild(h)}return n},hterm.Screen.prototype.getLineStartRow_=function(e){for(;e.previousSibling&&e.previousSibling.hasAttribute("line-overflow");)e=e.previousSibling;return e},hterm.Screen.prototype.getLineText_=function(e){for(var t="";e&&(t+=e.textContent,e.hasAttribute("line-overflow"));)e=e.nextSibling;return t},hterm.Screen.prototype.getXRowAncestor_=function(e){for(;e&&"X-ROW"!==e.nodeName;)e=e.parentNode;return e},hterm.Screen.prototype.getPositionWithOverflow_=function(e,t,r){if(!t)return-1;var o=this.getXRowAncestor_(t);if(!o)return-1;for(var i=0;o!=e;){if(i+=hterm.TextAttributes.nodeWidth(e),!e.hasAttribute("line-overflow")||!e.nextSibling)return-1;e=e.nextSibling}return i+this.getPositionWithinRow_(e,t,r)},hterm.Screen.prototype.getPositionWithinRow_=function(e,t,r){if(t.parentNode!=e)return null==t.parentNode?-1:this.getPositionWithinRow_(t.parentNode,t,r)+this.getPositionWithinRow_(e,t.parentNode,0);for(var o=0,i=0;i<e.childNodes.length;i++){var s=e.childNodes[i];if(s==t)return o+r;o+=hterm.TextAttributes.nodeWidth(s)}return-1},hterm.Screen.prototype.getNodeAndOffsetWithOverflow_=function(e,t){for(;e&&t>hterm.TextAttributes.nodeWidth(e);){if(!e.hasAttribute("line-overflow")||!e.nextSibling)return-1;t-=hterm.TextAttributes.nodeWidth(e),e=e.nextSibling}return this.getNodeAndOffsetWithinRow_(e,t)},hterm.Screen.prototype.getNodeAndOffsetWithinRow_=function(e,t){for(var r=0;r<e.childNodes.length;r++){var o=e.childNodes[r],i=hterm.TextAttributes.nodeWidth(o);if(t<=i)return"SPAN"===o.nodeName?this.getNodeAndOffsetWithinRow_(o,t):[o,t];t-=i}return null},hterm.Screen.prototype.setRange_=function(e,t,r,o){var i=this.getNodeAndOffsetWithOverflow_(e,t);if(null!=i){var s=this.getNodeAndOffsetWithOverflow_(e,r);null!=s&&(o.setStart(i[0],i[1]),o.setEnd(s[0],s[1]))}},hterm.Screen.prototype.expandSelection=function(e){if(e){var t=e.getRangeAt(0);if(t&&!t.toString().match(/\s/)){var r=this.getLineStartRow_(this.getXRowAncestor_(t.startContainer));if(r){var o=this.getPositionWithOverflow_(r,t.startContainer,t.startOffset);if(-1!=o){var i=this.getPositionWithOverflow_(r,t.endContainer,t.endOffset);if(-1!=i){var s=this.wordBreakMatchLeft,n=this.wordBreakMatchRight,a=this.wordBreakMatchMiddle,l=this.getLineText_(r),h=lib.wc.substring(l,0,i),c=new RegExp(s+a+"$"),u=h.search(c);if(!(-1==u||u>o)){var d=lib.wc.substring(l,o,lib.wc.strWidth(l)),g=new RegExp("^"+a+n),p=d.match(g);if(p){var m=o+lib.wc.strWidth(p[0]);-1==m||m<i||(this.setRange_(r,u,m,t),e.addRange(t))}}}}}}}},lib.rtdep("lib.f","hterm.PubSub","hterm.Size"),hterm.ScrollPort=function(e){hterm.PubSub.addBehavior(this),this.rowProvider_=e,this.characterSize=new hterm.Size(10,10),this.ruler_=null,this.selection=new hterm.ScrollPort.Selection(this),this.currentRowNodeCache_=null,this.previousRowNodeCache_={},this.lastScreenWidth_=null,this.lastScreenHeight_=null,this.selectionEnabled_=!0,this.lastRowCount_=0,this.scrollWheelMultiplier_=1,this.lastTouch_={},this.isScrolledEnd=!0,this.currentScrollbarWidthPx=16,this.ctrlVPaste=!1,this.div_=null,this.document_=null,this.timeouts_={},this.observers_={},this.DEBUG_=!1},hterm.ScrollPort.Selection=function(e){this.scrollPort_=e,this.startRow=null,this.endRow=null,this.isMultiline=null,this.isCollapsed=null},hterm.ScrollPort.Selection.prototype.findFirstChild=function(e,t){for(var r=e.firstChild;r;){if(-1!=t.indexOf(r))return r;if(r.childNodes.length){var o=this.findFirstChild(r,t);if(o)return o}r=r.nextSibling}return null},hterm.ScrollPort.Selection.prototype.sync=function(){function e(){r.startRow=i,r.startNode=o.anchorNode,r.startOffset=o.anchorOffset,r.endRow=s,r.endNode=o.focusNode,r.endOffset=o.focusOffset}function t(){r.startRow=s,r.startNode=o.focusNode,r.startOffset=o.focusOffset,r.endRow=i,r.endNode=o.anchorNode,r.endOffset=o.anchorOffset}var r=this,o=this.scrollPort_.getDocument().getSelection();if(this.startRow=null,this.endRow=null,this.isMultiline=null,this.isCollapsed=!o||o.isCollapsed,!this.isCollapsed){for(var i=o.anchorNode;i&&!("rowIndex"in i);)i=i.parentNode;if(i){for(var s=o.focusNode;s&&!("rowIndex"in s);)s=s.parentNode;if(s){if(i.rowIndex<s.rowIndex)e();else if(i.rowIndex>s.rowIndex)t();else if(o.focusNode==o.anchorNode)o.anchorOffset<o.focusOffset?e():t();else{var n=this.findFirstChild(i,[o.anchorNode,o.focusNode]);if(!n)throw new Error("Unexpected error syncing selection.");n==o.anchorNode?e():t()}this.isMultiline=i.rowIndex!=s.rowIndex}else console.error("Selection focus is not rooted in a row node: "+o.focusNode.nodeName)}else console.error("Selection anchor is not rooted in a row node: "+o.anchorNode.nodeName)}},hterm.ScrollPort.prototype.decorate=function(e){this.div_=e,this.iframe_=e.ownerDocument.createElement("iframe"),this.iframe_.style.cssText="border: 0;height: 100%;position: absolute;width: 100%","mozInnerScreenX"in window&&(this.iframe_.src="#"),e.appendChild(this.iframe_),this.iframe_.contentWindow.addEventListener("resize",this.onResize_.bind(this));var t=this.document_=this.iframe_.contentDocument;t.body.style.cssText="margin: 0px;padding: 0px;height: 100%;width: 100%;overflow: hidden;cursor: var(--hterm-mouse-cursor-style);-webkit-user-select: none;-moz-user-select: none;",this.DEBUG_&&(this.document_.body.style.paddingTop=this.document_.body.style.paddingBottom="calc(var(--hterm-charsize-height) * 3)");var r=t.createElement("style");r.textContent="x-row { display: block; height: var(--hterm-charsize-height); line-height: var(--hterm-charsize-height);}",t.head.appendChild(r),this.userCssLink_=t.createElement("link"),this.userCssLink_.setAttribute("rel","stylesheet"),this.userCssText_=t.createElement("style"),t.head.appendChild(this.userCssText_),this.screen_=t.createElement("x-screen"),this.screen_.setAttribute("contenteditable","true"),this.screen_.setAttribute("spellcheck","false"),this.screen_.setAttribute("autocomplete","off"),this.screen_.setAttribute("autocorrect","off"),this.screen_.setAttribute("autocaptalize","none"),this.screen_.setAttribute("role","textbox"),this.screen_.setAttribute("tabindex","-1"),this.screen_.style.cssText="caret-color: transparent;display: block;font-family: monospace;font-size: 15px;font-variant-ligatures: none;height: 100%;overflow-y: scroll; overflow-x: hidden;white-space: pre;width: 100%;outline: none !important",t.body.appendChild(this.screen_),this.screen_.addEventListener("scroll",this.onScroll_.bind(this)),this.screen_.addEventListener("wheel",this.onScrollWheel_.bind(this)),this.screen_.addEventListener("touchstart",this.onTouch_.bind(this)),this.screen_.addEventListener("touchmove",this.onTouch_.bind(this)),this.screen_.addEventListener("touchend",this.onTouch_.bind(this)),this.screen_.addEventListener("touchcancel",this.onTouch_.bind(this)),this.screen_.addEventListener("copy",this.onCopy_.bind(this)),this.screen_.addEventListener("paste",this.onPaste_.bind(this)),this.screen_.addEventListener("drop",this.onDragAndDrop_.bind(this)),t.body.addEventListener("keydown",this.onBodyKeyDown_.bind(this)),this.rowNodes_=t.createElement("div"),this.rowNodes_.id="hterm:row-nodes",this.rowNodes_.style.cssText="display: block;position: fixed;overflow: hidden;-webkit-user-select: text;-moz-user-select: text;",this.screen_.appendChild(this.rowNodes_),this.topSelectBag_=t.createElement("x-select-bag"),this.topSelectBag_.style.cssText="display: block;overflow: hidden;height: var(--hterm-charsize-height);white-space: pre;",this.bottomSelectBag_=this.topSelectBag_.cloneNode(),this.topFold_=t.createElement("x-fold"),this.topFold_.id="hterm:top-fold-for-row-selection",this.topFold_.style.cssText="display: block;",this.rowNodes_.appendChild(this.topFold_),this.bottomFold_=this.topFold_.cloneNode(),this.bottomFold_.id="hterm:bottom-fold-for-row-selection",this.rowNodes_.appendChild(this.bottomFold_),this.scrollArea_=t.createElement("div"),this.scrollArea_.id="hterm:scrollarea",this.scrollArea_.style.cssText="visibility: hidden",this.screen_.appendChild(this.scrollArea_);var o="http://www.w3.org/2000/svg";this.svg_=this.div_.ownerDocument.createElementNS(o,"svg"),this.svg_.id="hterm:zoom-detector",this.svg_.setAttribute("xmlns",o),this.svg_.setAttribute("version","1.1"),this.svg_.style.cssText="position: absolute;top: 0;left: 0;visibility: hidden",this.pasteTarget_=t.createElement("textarea"),this.pasteTarget_.id="hterm:ctrl-v-paste-target",this.pasteTarget_.setAttribute("tabindex","-1"),this.pasteTarget_.style.cssText="position: absolute;height: 1px;width: 1px;left: 0px; bottom: 0px;opacity: 0",this.pasteTarget_.contentEditable=!0,this.screen_.appendChild(this.pasteTarget_),this.pasteTarget_.addEventListener("textInput",this.handlePasteTargetTextInput_.bind(this)),this.resize()},hterm.ScrollPort.prototype.setFontFamily=function(e,t){this.screen_.style.fontFamily=e,this.screen_.style.webkitFontSmoothing=t||"",this.syncCharacterSize()},hterm.ScrollPort.prototype.getFontFamily=function(){return this.screen_.style.fontFamily},hterm.ScrollPort.prototype.setUserCssUrl=function(e){e?(this.userCssLink_.setAttribute("href",e),this.userCssLink_.parentNode||this.document_.head.appendChild(this.userCssLink_)):this.userCssLink_.parentNode&&this.document_.head.removeChild(this.userCssLink_)},hterm.ScrollPort.prototype.setUserCssText=function(e){this.userCssText_.textContent=e},hterm.ScrollPort.prototype.focus=function(){this.iframe_.focus(),this.screen_.focus()},hterm.ScrollPort.prototype.getForegroundColor=function(){return this.screen_.style.color},hterm.ScrollPort.prototype.setForegroundColor=function(e){this.screen_.style.color=e},hterm.ScrollPort.prototype.getBackgroundColor=function(){return this.screen_.style.backgroundColor},hterm.ScrollPort.prototype.setBackgroundColor=function(e){this.screen_.style.backgroundColor=e},hterm.ScrollPort.prototype.setBackgroundImage=function(e){this.screen_.style.backgroundImage=e},hterm.ScrollPort.prototype.setBackgroundSize=function(e){this.screen_.style.backgroundSize=e},hterm.ScrollPort.prototype.setBackgroundPosition=function(e){this.screen_.style.backgroundPosition=e},hterm.ScrollPort.prototype.setCtrlVPaste=function(e){this.ctrlVPaste=e},hterm.ScrollPort.prototype.getScreenSize=function(){var e=hterm.getClientSize(this.screen_);return{height:e.height,width:e.width-this.currentScrollbarWidthPx}},hterm.ScrollPort.prototype.getScreenWidth=function(){return this.getScreenSize().width},hterm.ScrollPort.prototype.getScreenHeight=function(){return this.getScreenSize().height},hterm.ScrollPort.prototype.getDocument=function(){return this.document_},hterm.ScrollPort.prototype.getScreenNode=function(){return this.screen_},hterm.ScrollPort.prototype.resetCache=function(){this.currentRowNodeCache_=null,this.previousRowNodeCache_={}},hterm.ScrollPort.prototype.setRowProvider=function(e){this.resetCache(),this.rowProvider_=e,this.scheduleRedraw()},hterm.ScrollPort.prototype.invalidate=function(){for(var e=this.topFold_.nextSibling;e!=this.bottomFold_;){var t=e.nextSibling;e.parentElement.removeChild(e),e=t}this.previousRowNodeCache_=null;var r=this.getTopRowIndex(),o=this.getBottomRowIndex(r);this.drawVisibleRows_(r,o)},hterm.ScrollPort.prototype.scheduleInvalidate=function(){if(!this.timeouts_.invalidate){var e=this;this.timeouts_.invalidate=setTimeout(function(){delete e.timeouts_.invalidate,e.invalidate()},0)}},hterm.ScrollPort.prototype.setFontSize=function(e){this.screen_.style.fontSize=e+"px",this.syncCharacterSize()},hterm.ScrollPort.prototype.getFontSize=function(){return parseInt(this.screen_.style.fontSize)},hterm.ScrollPort.prototype.measureCharacterSize=function(e){this.ruler_||(this.ruler_=this.document_.createElement("div"),this.ruler_.id="hterm:ruler-character-size",this.ruler_.style.cssText="position: absolute;top: 0;left: 0;visibility: hidden;height: auto !important;width: auto !important;",this.rulerSpan_=this.document_.createElement("span"),this.rulerSpan_.id="hterm:ruler-span-workaround",this.rulerSpan_.innerHTML=("X".repeat(100)+"\r").repeat(100),this.ruler_.appendChild(this.rulerSpan_),this.rulerBaseline_=this.document_.createElement("span"),this.rulerSpan_.id="hterm:ruler-baseline",this.rulerBaseline_.style.fontSize="0px",this.rulerBaseline_.textContent="X"),this.rulerSpan_.style.fontWeight=e||"",this.rowNodes_.appendChild(this.ruler_);var t=hterm.getClientSize(this.rulerSpan_),r=new hterm.Size(t.width/100,t.height/100);return this.ruler_.appendChild(this.rulerBaseline_),r.baseline=this.rulerBaseline_.offsetTop,this.ruler_.removeChild(this.rulerBaseline_),this.rowNodes_.removeChild(this.ruler_),this.div_.ownerDocument.body.appendChild(this.svg_),r.zoomFactor=this.svg_.currentScale,this.div_.ownerDocument.body.removeChild(this.svg_),r},hterm.ScrollPort.prototype.syncCharacterSize=function(){this.characterSize=this.measureCharacterSize(),this.resize()},hterm.ScrollPort.prototype.resize=function(){this.currentScrollbarWidthPx=hterm.getClientWidth(this.screen_)-this.screen_.clientWidth,this.syncScrollHeight(),this.syncRowNodesDimensions_();var e=this;this.publish("resize",{scrollPort:this},function(){e.scrollRowToBottom(e.rowProvider_.getRowCount()),e.scheduleRedraw()})},hterm.ScrollPort.prototype.syncRowNodesDimensions_=function(){var e=this.getScreenSize();this.lastScreenWidth_=e.width,this.lastScreenHeight_=e.height,this.visibleRowCount=lib.f.smartFloorDivide(e.height,this.characterSize.height);var t=this.visibleRowCount*this.characterSize.height;this.visibleRowTopMargin=0,this.visibleRowBottomMargin=e.height-t,this.topFold_.style.marginBottom=this.visibleRowTopMargin+"px";for(var r=0,o=this.topFold_.previousSibling;o;)r+=hterm.getClientHeight(o),o=o.previousSibling;this.rowNodes_.style.width=e.width+"px",this.rowNodes_.style.height=t+r+"px",this.rowNodes_.style.left=this.screen_.offsetLeft+"px",this.rowNodes_.style.top=this.screen_.offsetTop-r+"px"},hterm.ScrollPort.prototype.syncScrollHeight=function(){this.lastRowCount_=this.rowProvider_.getRowCount(),this.scrollArea_.style.height=this.characterSize.height*this.lastRowCount_+this.visibleRowTopMargin+this.visibleRowBottomMargin+"px"},hterm.ScrollPort.prototype.scheduleRedraw=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout(function(){delete e.timeouts_.redraw,e.redraw_()},0)}},hterm.ScrollPort.prototype.redraw_=function(){this.resetSelectBags_(),this.selection.sync(),this.syncScrollHeight(),this.currentRowNodeCache_={};var e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);this.drawTopFold_(e),this.drawBottomFold_(t),this.drawVisibleRows_(e,t),this.syncRowNodesDimensions_(),this.previousRowNodeCache_=this.currentRowNodeCache_,this.currentRowNodeCache_=null,this.isScrolledEnd=this.getTopRowIndex()+this.visibleRowCount>=this.lastRowCount_},hterm.ScrollPort.prototype.drawTopFold_=function(e){if(!this.selection.startRow||this.selection.startRow.rowIndex>=e)this.rowNodes_.firstChild!=this.topFold_&&this.rowNodes_.insertBefore(this.topFold_,this.rowNodes_.firstChild);else{if(!this.selection.isMultiline||this.selection.endRow.rowIndex>=e)this.selection.startRow.nextSibling!=this.topFold_&&this.rowNodes_.insertBefore(this.topFold_,this.selection.startRow.nextSibling);else for(this.selection.endRow.nextSibling!=this.topFold_&&this.rowNodes_.insertBefore(this.topFold_,this.selection.endRow.nextSibling);this.selection.startRow.nextSibling!=this.selection.endRow;)this.rowNodes_.removeChild(this.selection.startRow.nextSibling);for(;this.rowNodes_.firstChild!=this.selection.startRow;)this.rowNodes_.removeChild(this.rowNodes_.firstChild)}},hterm.ScrollPort.prototype.drawBottomFold_=function(e){if(!this.selection.endRow||this.selection.endRow.rowIndex<=e)this.rowNodes_.lastChild!=this.bottomFold_&&this.rowNodes_.appendChild(this.bottomFold_);else{if(!this.selection.isMultiline||this.selection.startRow.rowIndex<=e)this.bottomFold_.nextSibling!=this.selection.endRow&&this.rowNodes_.insertBefore(this.bottomFold_,this.selection.endRow);else for(this.bottomFold_.nextSibling!=this.selection.startRow&&this.rowNodes_.insertBefore(this.bottomFold_,this.selection.startRow);this.selection.startRow.nextSibling!=this.selection.endRow;)this.rowNodes_.removeChild(this.selection.startRow.nextSibling);for(;this.rowNodes_.lastChild!=this.selection.endRow;)this.rowNodes_.removeChild(this.rowNodes_.lastChild)}},hterm.ScrollPort.prototype.drawVisibleRows_=function(e,t){function r(e,t){for(;e!=t;){if(!e)throw"Did not encounter target node";if(e==o.bottomFold_)throw"Encountered bottom fold before target node";var r=e;e=e.nextSibling,r.parentNode.removeChild(r)}}for(var o=this,i=this.selection.startRow,s=this.selection.endRow,n=this.bottomFold_,a=this.topFold_.nextSibling,l=Math.min(this.visibleRowCount,this.rowProvider_.getRowCount()),h=0;h<l;h++){var c=e+h;if(a!=n)if(a.rowIndex!=c)if(i&&i.rowIndex==c)r(a,i),a=i.nextSibling;else if(s&&s.rowIndex==c)r(a,s),a=s.nextSibling;else if(a!=i&&a!=s){var u=this.fetchRowNode_(c);if(!u){console.log("Couldn't fetch row index: "+c);break}a!=u?(this.rowNodes_.insertBefore(u,a),u.nextSibling,this.rowNodes_.removeChild(a),a=u.nextSibling):a=a.nextSibling}else{if(!(u=this.fetchRowNode_(c))){console.log("Couldn't fetch row index: "+c);break}this.rowNodes_.insertBefore(u,a)}else a=a.nextSibling;else{if(!(u=this.fetchRowNode_(c))){console.log("Couldn't fetch row index: "+c);break}this.rowNodes_.insertBefore(u,a)}}a!=this.bottomFold_&&r(a,n)},hterm.ScrollPort.prototype.resetSelectBags_=function(){this.topSelectBag_.parentNode&&(this.topSelectBag_.textContent="",this.topSelectBag_.parentNode.removeChild(this.topSelectBag_)),this.bottomSelectBag_.parentNode&&(this.bottomSelectBag_.textContent="",this.bottomSelectBag_.parentNode.removeChild(this.bottomSelectBag_))},hterm.ScrollPort.prototype.cacheRowNode_=function(e){this.currentRowNodeCache_[e.rowIndex]=e},hterm.ScrollPort.prototype.fetchRowNode_=function(e){var t;return t=this.previousRowNodeCache_&&e in this.previousRowNodeCache_?this.previousRowNodeCache_[e]:this.rowProvider_.getRowNode(e),this.currentRowNodeCache_&&this.cacheRowNode_(t),t},hterm.ScrollPort.prototype.selectAll=function(){var e;if(0!=this.topFold_.nextSibling.rowIndex){for(;this.topFold_.previousSibling;)this.rowNodes_.removeChild(this.topFold_.previousSibling);e=this.fetchRowNode_(0),this.rowNodes_.insertBefore(e,this.topFold_),this.syncRowNodesDimensions_()}else e=this.topFold_.nextSibling;var t,r=this.rowProvider_.getRowCount()-1;if(this.bottomFold_.previousSibling.rowIndex!=r){for(;this.bottomFold_.nextSibling;)this.rowNodes_.removeChild(this.bottomFold_.nextSibling);t=this.fetchRowNode_(r),this.rowNodes_.appendChild(t)}else t=this.bottomFold_.previousSibling.rowIndex;var o=this.document_.getSelection();o.collapse(e,0),o.extend(t,t.childNodes.length),this.selection.sync()},hterm.ScrollPort.prototype.getScrollMax_=function(e){return hterm.getClientHeight(this.scrollArea_)+this.visibleRowTopMargin+this.visibleRowBottomMargin-hterm.getClientHeight(this.screen_)},hterm.ScrollPort.prototype.scrollRowToTop=function(e){this.syncScrollHeight(),this.isScrolledEnd=e+this.visibleRowCount>=this.lastRowCount_;var t=e*this.characterSize.height+this.visibleRowTopMargin,r=this.getScrollMax_();t>r&&(t=r),this.screen_.scrollTop!=t&&(this.screen_.scrollTop=t,this.scheduleRedraw())},hterm.ScrollPort.prototype.scrollRowToBottom=function(e){this.syncScrollHeight(),this.isScrolledEnd=e+this.visibleRowCount>=this.lastRowCount_;var t=e*this.characterSize.height+this.visibleRowTopMargin+this.visibleRowBottomMargin;(t-=this.visibleRowCount*this.characterSize.height)<0&&(t=0),this.screen_.scrollTop!=t&&(this.screen_.scrollTop=t)},hterm.ScrollPort.prototype.getTopRowIndex=function(){return Math.round(this.screen_.scrollTop/this.characterSize.height)},hterm.ScrollPort.prototype.getBottomRowIndex=function(e){return e+this.visibleRowCount-1},hterm.ScrollPort.prototype.onScroll_=function(e){var t=this.getScreenSize();t.width==this.lastScreenWidth_&&t.height==this.lastScreenHeight_?(this.redraw_(),this.publish("scroll",{scrollPort:this})):this.resize()},hterm.ScrollPort.prototype.onScrollWheel=function(e){},hterm.ScrollPort.prototype.onScrollWheel_=function(e){if(this.onScrollWheel(e),!e.defaultPrevented){var t=this.scrollWheelDelta(e),r=this.screen_.scrollTop-t;r<0&&(r=0);var o=this.getScrollMax_();r>o&&(r=o),r!=this.screen_.scrollTop&&(this.screen_.scrollTop=r,e.preventDefault())}},hterm.ScrollPort.prototype.scrollWheelDelta=function(e){var t;switch(e.deltaMode){case WheelEvent.DOM_DELTA_PIXEL:t=e.deltaY*this.scrollWheelMultiplier_;break;case WheelEvent.DOM_DELTA_LINE:t=e.deltaY*this.characterSize.height;break;case WheelEvent.DOM_DELTA_PAGE:t=e.deltaY*this.characterSize.height*this.screen_.getHeight()}return-1*t},hterm.ScrollPort.prototype.onTouch=function(e){},hterm.ScrollPort.prototype.onTouch_=function(e){if(this.onTouch(e),!e.defaultPrevented){var t,r,o=function(e){return{id:e.identifier,y:e.clientY,x:e.clientX}};switch(e.type){case"touchstart":for(t=0;t<e.changedTouches.length;++t)r=o(e.changedTouches[t]),this.lastTouch_[r.id]=r;break;case"touchcancel":case"touchend":for(t=0;t<e.changedTouches.length;++t)delete this.lastTouch_[e.changedTouches[t].identifier];break;case"touchmove":var i=0;for(t=0;t<e.changedTouches.length;++t)r=o(e.changedTouches[t]),i+=this.lastTouch_[r.id].y-r.y,this.lastTouch_[r.id]=r;i*=-1;var s=this.screen_.scrollTop-i;s<0&&(s=0);var n=this.getScrollMax_();s>n&&(s=n),s!=this.screen_.scrollTop&&(this.screen_.scrollTop=s)}e.preventDefault()}},hterm.ScrollPort.prototype.onResize_=function(e){this.syncCharacterSize()},hterm.ScrollPort.prototype.onCopy=function(e){},hterm.ScrollPort.prototype.onCopy_=function(e){if(this.onCopy(e),!e.defaultPrevented&&(this.resetSelectBags_(),this.selection.sync(),this.selection.startRow&&!(this.selection.endRow.rowIndex-this.selection.startRow.rowIndex<2))){var t=this.getTopRowIndex(),r=this.getBottomRowIndex(t);if(this.selection.startRow.rowIndex<t){var o;o=this.selection.endRow.rowIndex<t?this.selection.endRow.rowIndex:this.topFold_.nextSibling.rowIndex,this.topSelectBag_.textContent=this.rowProvider_.getRowsText(this.selection.startRow.rowIndex+1,o),this.rowNodes_.insertBefore(this.topSelectBag_,this.selection.startRow.nextSibling),this.syncRowNodesDimensions_()}if(this.selection.endRow.rowIndex>r){var i;i=this.selection.startRow.rowIndex>r?this.selection.startRow.rowIndex+1:this.bottomFold_.previousSibling.rowIndex+1,this.bottomSelectBag_.textContent=this.rowProvider_.getRowsText(i,this.selection.endRow.rowIndex),this.rowNodes_.insertBefore(this.bottomSelectBag_,this.selection.endRow)}}},hterm.ScrollPort.prototype.onBodyKeyDown_=function(e){if(this.ctrlVPaste){var t=String.fromCharCode(e.which).toLowerCase();(e.ctrlKey||e.metaKey)&&"v"==t&&this.pasteTarget_.focus()}},hterm.ScrollPort.prototype.onPaste_=function(e){this.pasteTarget_.focus();var t=this;setTimeout(function(){t.publish("paste",{text:t.pasteTarget_.value}),t.pasteTarget_.value="",t.screen_.focus()},0)},hterm.ScrollPort.prototype.handlePasteTargetTextInput_=function(e){e.stopPropagation()},hterm.ScrollPort.prototype.onDragAndDrop_=function(e){e.preventDefault();var t=void 0,r=void 0;e.shiftKey||(e.dataTransfer.types.forEach(function(e){!r&&"text/plain"!=e&&e.startsWith("text/")&&(r=e)}),r&&(t=e.dataTransfer.getData(r))),t||(t=e.dataTransfer.getData("text/plain")),t&&this.publish("paste",{text:t})},hterm.ScrollPort.prototype.setScrollbarVisible=function(e){this.screen_.style.overflowY=e?"scroll":"hidden"},hterm.ScrollPort.prototype.setScrollWheelMoveMultipler=function(e){this.scrollWheelMultiplier_=e},lib.rtdep("lib.colors","lib.PreferenceManager","lib.resource","lib.wc","lib.f","hterm.Keyboard","hterm.Options","hterm.PreferenceManager","hterm.Screen","hterm.ScrollPort","hterm.Size","hterm.TextAttributes","hterm.VT"),hterm.Terminal=function(e){this.profileId_=null,this.primaryScreen_=new hterm.Screen,this.alternateScreen_=new hterm.Screen,this.screen_=this.primaryScreen_,this.screenSize=new hterm.Size(0,0),this.scrollPort_=new hterm.ScrollPort(this),this.scrollPort_.subscribe("resize",this.onResize_.bind(this)),this.scrollPort_.subscribe("scroll",this.onScroll_.bind(this)),this.scrollPort_.subscribe("paste",this.onPaste_.bind(this)),this.scrollPort_.onCopy=this.onCopy_.bind(this),this.div_=null,this.document_=window.document,this.scrollbackRows_=[],this.tabStops_=[],this.defaultTabStops=!0,this.vtScrollTop_=null,this.vtScrollBottom_=null,this.cursorNode_=null,this.cursorShape_=hterm.Terminal.cursorShape.BLOCK,this.cursorColor_=null,this.cursorBlinkCycle_=[100,100],this.myOnCursorBlink_=this.onCursorBlink_.bind(this),this.backgroundColor_=null,this.foregroundColor_=null,this.scrollOnOutput_=null,this.scrollOnKeystroke_=null,this.scrollWheelArrowKeys_=null,this.defeatMouseReports_=!1,this.bellAudio_=this.document_.createElement("audio"),this.bellAudio_.id="hterm:bell-audio",this.bellAudio_.setAttribute("preload","auto"),this.bellNotificationList_=[],this.desktopNotificationBell_=!1,this.savedOptions_={},this.options_=new hterm.Options,this.timeouts_={},this.vt=new hterm.VT(this),this.keyboard=new hterm.Keyboard(this),this.io=new hterm.Terminal.IO(this),this.enableMouseDragScroll=!0,this.copyOnSelect=null,this.mouseRightClickPaste=null,this.mousePasteButton=null,this.useDefaultWindowCopy=!1,this.clearSelectionAfterCopy=!0,this.realizeSize_(80,24),this.setDefaultTabStops(),this.reportFocus=!1,this.setProfile(e||"default",function(){this.onTerminalReady()}.bind(this))},hterm.Terminal.cursorShape={BLOCK:"BLOCK",BEAM:"BEAM",UNDERLINE:"UNDERLINE"},hterm.Terminal.prototype.onTerminalReady=function(){},hterm.Terminal.prototype.tabWidth=8,hterm.Terminal.prototype.setProfile=function(e,t){this.profileId_=e.replace(/\//g,"");var r=this;this.prefs_&&this.prefs_.deactivate(),this.prefs_=new hterm.PreferenceManager(this.profileId_),this.prefs_.addObservers(null,{"alt-gr-mode":function(e){e=null==e?"en-us"==navigator.language.toLowerCase()?"none":"right-alt":"string"==typeof e?e.toLowerCase():"none",/^(none|ctrl-alt|left-alt|right-alt)$/.test(e)||(e="none"),r.keyboard.altGrMode=e},"alt-backspace-is-meta-backspace":function(e){r.keyboard.altBackspaceIsMetaBackspace=e},"alt-is-meta":function(e){r.keyboard.altIsMeta=e},"alt-sends-what":function(e){/^(escape|8-bit|browser-key)$/.test(e)||(e="escape"),r.keyboard.altSendsWhat=e},"audible-bell-sound":function(e){var t=e.match(/^lib-resource:(\S+)/);t?r.bellAudio_.setAttribute("src",lib.resource.getDataUrl(t[1])):r.bellAudio_.setAttribute("src",e)},"desktop-notification-bell":function(e){e&&Notification?(r.desktopNotificationBell_="granted"===Notification.permission,r.desktopNotificationBell_||console.warn("desktop-notification-bell is true but we do not have permission to display notifications.")):r.desktopNotificationBell_=!1},"background-color":function(e){r.setBackgroundColor(e)},"background-image":function(e){r.scrollPort_.setBackgroundImage(e)},"background-size":function(e){r.scrollPort_.setBackgroundSize(e)},"background-position":function(e){r.scrollPort_.setBackgroundPosition(e)},"backspace-sends-backspace":function(e){r.keyboard.backspaceSendsBackspace=e},"character-map-overrides":function(e){null==e||e instanceof Object?(r.vt.characterMaps.reset(),r.vt.characterMaps.setOverrides(e)):console.warn("Preference character-map-modifications is not an object: "+e)},"cursor-blink":function(e){r.setCursorBlink(!!e)},"cursor-blink-cycle":function(e){e instanceof Array&&"number"==typeof e[0]&&"number"==typeof e[1]?r.cursorBlinkCycle_=e:r.cursorBlinkCycle_="number"==typeof e?[e,e]:[100,100]},"cursor-color":function(e){r.setCursorColor(e)},"color-palette-overrides":function(e){if(null==e||e instanceof Object||e instanceof Array){if(lib.colors.colorPalette=lib.colors.stockColorPalette.concat(),e)for(var t in e){var o=parseInt(t);if(isNaN(o)||o<0||o>255)console.log("Invalid value in palette: "+t+": "+e[t]);else if(e[o]){var i=lib.colors.normalizeCSS(e[o]);i&&(lib.colors.colorPalette[o]=i)}}r.primaryScreen_.textAttributes.resetColorPalette(),r.alternateScreen_.textAttributes.resetColorPalette()}else console.warn("Preference color-palette-overrides is not an array or object: "+e)},"copy-on-select":function(e){r.copyOnSelect=!!e},"use-default-window-copy":function(e){r.useDefaultWindowCopy=!!e},"clear-selection-after-copy":function(e){r.clearSelectionAfterCopy=!!e},"ctrl-plus-minus-zero-zoom":function(e){r.keyboard.ctrlPlusMinusZeroZoom=e},"ctrl-c-copy":function(e){r.keyboard.ctrlCCopy=e},"ctrl-v-paste":function(e){r.keyboard.ctrlVPaste=e,r.scrollPort_.setCtrlVPaste(e)},"east-asian-ambiguous-as-two-column":function(e){lib.wc.regardCjkAmbiguous=e},"enable-8-bit-control":function(e){r.vt.enable8BitControl=!!e},"enable-bold":function(e){r.syncBoldSafeState()},"enable-bold-as-bright":function(e){r.primaryScreen_.textAttributes.enableBoldAsBright=!!e,r.alternateScreen_.textAttributes.enableBoldAsBright=!!e},"enable-blink":function(e){r.syncBlinkState()},"enable-clipboard-write":function(e){r.vt.enableClipboardWrite=!!e},"enable-dec12":function(e){r.vt.enableDec12=!!e},"font-family":function(e){r.syncFontFamily()},"font-size":function(e){r.setFontSize(e)},"font-smoothing":function(e){r.syncFontFamily()},"foreground-color":function(e){r.setForegroundColor(e)},"home-keys-scroll":function(e){r.keyboard.homeKeysScroll=e},keybindings:function(e){if(r.keyboard.bindings.clear(),e)if(e instanceof Object)try{r.keyboard.bindings.addBindings(e)}catch(e){console.error("Error in keybindings preference: "+e)}else console.error("Error in keybindings preference: Expected object")},"max-string-sequence":function(e){r.vt.maxStringSequence=e},"media-keys-are-fkeys":function(e){r.keyboard.mediaKeysAreFKeys=e},"meta-sends-escape":function(e){r.keyboard.metaSendsEscape=e},"mouse-right-click-paste":function(e){r.mouseRightClickPaste=e},"mouse-paste-button":function(e){r.syncMousePasteButton()},"page-keys-scroll":function(e){r.keyboard.pageKeysScroll=e},"pass-alt-number":function(e){null==e&&(e=!window.navigator.userAgent.match(/Mac OS X/)&&"popup"!=hterm.windowType),r.passAltNumber=e},"pass-ctrl-number":function(e){null==e&&(e=!window.navigator.userAgent.match(/Mac OS X/)&&"popup"!=hterm.windowType),r.passCtrlNumber=e},"pass-meta-number":function(e){null==e&&(e=window.navigator.userAgent.match(/Mac OS X/)&&"popup"!=hterm.windowType),r.passMetaNumber=e},"pass-meta-v":function(e){r.keyboard.passMetaV=e},"receive-encoding":function(e){/^(utf-8|raw)$/.test(e)||(console.warn('Invalid value for "receive-encoding": '+e),e="utf-8"),r.vt.characterEncoding=e},"scroll-on-keystroke":function(e){r.scrollOnKeystroke_=e},"scroll-on-output":function(e){r.scrollOnOutput_=e},"scrollbar-visible":function(e){r.setScrollbarVisible(e)},"scroll-wheel-may-send-arrow-keys":function(e){r.scrollWheelArrowKeys_=e},"scroll-wheel-move-multiplier":function(e){r.setScrollWheelMoveMultipler(e)},"send-encoding":function(e){/^(utf-8|raw)$/.test(e)||(console.warn('Invalid value for "send-encoding": '+e),e="utf-8"),r.keyboard.characterEncoding=e},"shift-insert-paste":function(e){r.keyboard.shiftInsertPaste=e},"terminal-encoding":function(e){r.vt.setEncoding(e)},"user-css":function(e){r.scrollPort_.setUserCssUrl(e)},"user-css-text":function(e){r.scrollPort_.setUserCssText(e)},"word-break-match-left":function(e){r.primaryScreen_.wordBreakMatchLeft=e,r.alternateScreen_.wordBreakMatchLeft=e},"word-break-match-right":function(e){r.primaryScreen_.wordBreakMatchRight=e,r.alternateScreen_.wordBreakMatchRight=e},"word-break-match-middle":function(e){r.primaryScreen_.wordBreakMatchMiddle=e,r.alternateScreen_.wordBreakMatchMiddle=e}}),this.prefs_.readStorage(function(){this.prefs_.notifyAll(),t&&t()}.bind(this))},hterm.Terminal.prototype.getPrefs=function(){return this.prefs_},hterm.Terminal.prototype.setBracketedPaste=function(e){this.options_.bracketedPaste=e},hterm.Terminal.prototype.setCursorColor=function(e){this.cursorColor_=e,this.cursorNode_.style.backgroundColor=e,this.cursorNode_.style.borderColor=e},hterm.Terminal.prototype.getCursorColor=function(){return this.cursorColor_},hterm.Terminal.prototype.setSelectionEnabled=function(e){this.enableMouseDragScroll=e},hterm.Terminal.prototype.setBackgroundColor=function(e){this.backgroundColor_=lib.colors.normalizeCSS(e),this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.scrollPort_.setBackgroundColor(e)},hterm.Terminal.prototype.getBackgroundColor=function(){return this.backgroundColor_},hterm.Terminal.prototype.setForegroundColor=function(e){this.foregroundColor_=lib.colors.normalizeCSS(e),this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.scrollPort_.setForegroundColor(e)},hterm.Terminal.prototype.getForegroundColor=function(){return this.foregroundColor_},hterm.Terminal.prototype.runCommandClass=function(e,t){var r=this.prefs_.get("environment");"object"==(void 0===r?"undefined":_typeof(r))&&null!=r||(r={});var o=this;this.command=new e({argString:t||"",io:this.io.push(),environment:r,onExit:function(e){o.io.pop(),o.uninstallKeyboard(),o.prefs_.get("close-on-exit")&&window.close()}}),this.installKeyboard(),this.command.run()},hterm.Terminal.prototype.isPrimaryScreen=function(){return this.screen_==this.primaryScreen_},hterm.Terminal.prototype.installKeyboard=function(){this.keyboard.installKeyboard(this.scrollPort_.getDocument().body)},hterm.Terminal.prototype.uninstallKeyboard=function(){this.keyboard.installKeyboard(null)},hterm.Terminal.prototype.setCssVar=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"--hterm-";this.document_.documentElement.style.setProperty(""+r+e,t)},hterm.Terminal.prototype.setFontSize=function(e){0===e&&(e=this.prefs_.get("font-size")),this.scrollPort_.setFontSize(e),this.setCssVar("charsize-width",this.scrollPort_.characterSize.width+"px"),this.setCssVar("charsize-height",this.scrollPort_.characterSize.height+"px")},hterm.Terminal.prototype.getFontSize=function(){return this.scrollPort_.getFontSize()},hterm.Terminal.prototype.getFontFamily=function(){return this.scrollPort_.getFontFamily()},hterm.Terminal.prototype.syncFontFamily=function(){this.scrollPort_.setFontFamily(this.prefs_.get("font-family"),this.prefs_.get("font-smoothing")),this.syncBoldSafeState()},hterm.Terminal.prototype.syncMousePasteButton=function(){var e=this.prefs_.get("mouse-paste-button");if("number"!=typeof e){var t=navigator.userAgent.match(/\(X11;\s+(\S+)/);t&&"CrOS"!=t[1]?this.mousePasteButton=2:this.mousePasteButton=1}else this.mousePasteButton=e},hterm.Terminal.prototype.syncBoldSafeState=function(){var e=this.prefs_.get("enable-bold");if(null!==e)return this.primaryScreen_.textAttributes.enableBold=e,void(this.alternateScreen_.textAttributes.enableBold=e);var t=this.scrollPort_.measureCharacterSize(),r=this.scrollPort_.measureCharacterSize("bold"),o=t.equals(r);o||console.warn("Bold characters disabled: Size of bold weight differs from normal. Font family is: "+this.scrollPort_.getFontFamily()),this.primaryScreen_.textAttributes.enableBold=o,this.alternateScreen_.textAttributes.enableBold=o},hterm.Terminal.prototype.syncBlinkState=function(){this.setCssVar("node-duration",this.prefs_.get("enable-blink")?"0.7s":"0")},hterm.Terminal.prototype.syncMouseStyle=function(){this.setCssVar("mouse-cursor-style",this.vt.mouseReport==this.vt.MOUSE_REPORT_DISABLED?"var(--hterm-mouse-cursor-text)":"var(--hterm-mouse-cursor-pointer)")},hterm.Terminal.prototype.saveCursor=function(){return this.screen_.cursorPosition.clone()},hterm.Terminal.prototype.getTextAttributes=function(){return this.screen_.textAttributes},hterm.Terminal.prototype.setTextAttributes=function(e){this.screen_.textAttributes=e},hterm.Terminal.prototype.getZoomFactor=function(){return this.scrollPort_.characterSize.zoomFactor},hterm.Terminal.prototype.setWindowTitle=function(e){window.document.title=e},hterm.Terminal.prototype.restoreCursor=function(e){var t=lib.f.clamp(e.row,0,this.screenSize.height-1),r=lib.f.clamp(e.column,0,this.screenSize.width-1);this.screen_.setCursorPosition(t,r),(e.column>r||e.column==r&&e.overflow)&&(this.screen_.cursorPosition.overflow=!0)},hterm.Terminal.prototype.clearCursorOverflow=function(){this.screen_.cursorPosition.overflow=!1},hterm.Terminal.prototype.setCursorShape=function(e){this.cursorShape_=e,this.restyleCursor_()},hterm.Terminal.prototype.getCursorShape=function(){return this.cursorShape_},hterm.Terminal.prototype.setWidth=function(e){null!=e?(this.div_.style.width=Math.ceil(this.scrollPort_.characterSize.width*e+this.scrollPort_.currentScrollbarWidthPx)+"px",this.realizeSize_(e,this.screenSize.height),this.scheduleSyncCursorPosition_()):this.div_.style.width="100%"},hterm.Terminal.prototype.setHeight=function(e){null!=e?(this.div_.style.height=this.scrollPort_.characterSize.height*e+"px",this.realizeSize_(this.screenSize.width,e),this.scheduleSyncCursorPosition_()):this.div_.style.height="100%"},hterm.Terminal.prototype.realizeSize_=function(e,t){e!=this.screenSize.width&&this.realizeWidth_(e),t!=this.screenSize.height&&this.realizeHeight_(t),this.io.onTerminalResize_(e,t)},hterm.Terminal.prototype.realizeWidth_=function(e){if(e<=0)throw new Error("Attempt to realize bad width: "+e);var t=e-this.screen_.getWidth();if(this.screenSize.width=e,this.screen_.setColumnCount(e),t>0)this.defaultTabStops&&this.setDefaultTabStops(this.screenSize.width-t);else for(var r=this.tabStops_.length-1;r>=0&&!(this.tabStops_[r]<e);r--)this.tabStops_.pop();this.screen_.setColumnCount(this.screenSize.width)},hterm.Terminal.prototype.realizeHeight_=function(e){if(e<=0)throw new Error("Attempt to realize bad height: "+e);var t=e-this.screen_.getHeight();this.screenSize.height=e;var r=this.saveCursor();if(t<0){for(t*=-1;t;){var o=this.getRowCount()-1;if(o-this.scrollbackRows_.length==r.row)break;if(this.getRowText(o))break;this.screen_.popRow(),t--}var i=this.screen_.shiftRows(t);this.scrollbackRows_.push.apply(this.scrollbackRows_,i),r.row=Math.max(r.row-t,0)}else if(t>0){if(t<=this.scrollbackRows_.length){var s=Math.min(t,this.scrollbackRows_.length),n=this.scrollbackRows_.splice(this.scrollbackRows_.length-s,s);this.screen_.unshiftRows(n),t-=s,r.row+=s}t&&this.appendRows_(t)}this.setVTScrollRegion(null,null),this.restoreCursor(r)},hterm.Terminal.prototype.scrollHome=function(){this.scrollPort_.scrollRowToTop(0)},hterm.Terminal.prototype.scrollEnd=function(){this.scrollPort_.scrollRowToBottom(this.getRowCount())},hterm.Terminal.prototype.scrollPageUp=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e-this.screenSize.height+1)},hterm.Terminal.prototype.scrollPageDown=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e+this.screenSize.height-1)},hterm.Terminal.prototype.scrollLineUp=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e-1)},hterm.Terminal.prototype.scrollLineDown=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e+1)},hterm.Terminal.prototype.wipeContents=function(){this.scrollbackRows_.length=0,this.scrollPort_.resetCache(),[this.primaryScreen_,this.alternateScreen_].forEach(function(e){var t=e.getHeight();t>0&&(this.renumberRows_(0,t),this.clearHome(e))}.bind(this)),this.syncCursorPosition_(),this.scrollPort_.invalidate()},hterm.Terminal.prototype.reset=function(){this.clearAllTabStops(),this.setDefaultTabStops(),this.clearHome(this.primaryScreen_),this.primaryScreen_.textAttributes.reset(),this.clearHome(this.alternateScreen_),this.alternateScreen_.textAttributes.reset(),this.setCursorBlink(!!this.prefs_.get("cursor-blink")),this.vt.reset(),this.softReset()},hterm.Terminal.prototype.softReset=function(){this.options_=new hterm.Options,this.options_.cursorBlink=!!this.timeouts_.cursorBlink,this.primaryScreen_.textAttributes.resetColorPalette(),this.alternateScreen_.textAttributes.resetColorPalette(),this.setVTScrollRegion(null,null),this.setCursorVisible(!0)},hterm.Terminal.prototype.forwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=0;t<this.tabStops_.length;t++)if(this.tabStops_[t]>e)return void this.setCursorColumn(this.tabStops_[t]);var r=this.screen_.cursorPosition.overflow;this.setCursorColumn(this.screenSize.width-1),this.screen_.cursorPosition.overflow=r},hterm.Terminal.prototype.backwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=this.tabStops_.length-1;t>=0;t--)if(this.tabStops_[t]<e)return void this.setCursorColumn(this.tabStops_[t]);this.setCursorColumn(1)},hterm.Terminal.prototype.setTabStop=function(e){for(var t=this.tabStops_.length-1;t>=0;t--){if(this.tabStops_[t]==e)return;if(this.tabStops_[t]<e)return void this.tabStops_.splice(t+1,0,e)}this.tabStops_.splice(0,0,e)},hterm.Terminal.prototype.clearTabStopAtCursor=function(){var e=this.screen_.cursorPosition.column,t=this.tabStops_.indexOf(e);-1!=t&&this.tabStops_.splice(t,1)},hterm.Terminal.prototype.clearAllTabStops=function(){this.tabStops_.length=0,this.defaultTabStops=!1},hterm.Terminal.prototype.setDefaultTabStops=function(e){for(var t=e||0,r=this.tabWidth,o=t=t-1-(t-1)%r+r;o<this.screenSize.width;o+=r)this.setTabStop(o);this.defaultTabStops=!0},hterm.Terminal.prototype.interpret=function(e){this.vt.interpret(e),this.scheduleSyncCursorPosition_()},hterm.Terminal.prototype.decorate=function(e){this.div_=e,this.scrollPort_.decorate(e),this.scrollPort_.setBackgroundImage(this.prefs_.get("background-image")),this.scrollPort_.setBackgroundSize(this.prefs_.get("background-size")),this.scrollPort_.setBackgroundPosition(this.prefs_.get("background-position")),this.scrollPort_.setUserCssUrl(this.prefs_.get("user-css")),this.scrollPort_.setUserCssText(this.prefs_.get("user-css-text")),this.div_.focus=this.focus.bind(this),this.setFontSize(this.prefs_.get("font-size")),this.syncFontFamily(),this.setScrollbarVisible(this.prefs_.get("scrollbar-visible")),this.setScrollWheelMoveMultipler(this.prefs_.get("scroll-wheel-move-multiplier")),this.document_=this.scrollPort_.getDocument(),this.document_.body.oncontextmenu=function(){return!1};var t=this.onMouse_.bind(this),r=this.scrollPort_.getScreenNode();r.addEventListener("mousedown",t),r.addEventListener("mouseup",t),r.addEventListener("mousemove",t),this.scrollPort_.onScrollWheel=t,r.addEventListener("focus",this.onFocusChange_.bind(this,!0)),r.addEventListener("mousedown",function(){setTimeout(this.onFocusChange_.bind(this,!0))}.bind(this)),r.addEventListener("blur",this.onFocusChange_.bind(this,!1));var o=this.document_.createElement("style");o.textContent='.cursor-node[focus="false"] { box-sizing: border-box; background-color: transparent !important; border-width: 2px; border-style: solid;}.wc-node { display: inline-block; text-align: center; width: calc(var(--hterm-charsize-width) * 2); line-height: var(--hterm-charsize-height);}:root { --hterm-charsize-width: '+this.scrollPort_.characterSize.width+"px; --hterm-charsize-height: "+this.scrollPort_.characterSize.height+"px; --hterm-cursor-offset-col: -1; --hterm-cursor-offset-row: -1; --hterm-blink-node-duration: 0.7s; --hterm-mouse-cursor-text: text; --hterm-mouse-cursor-pointer: default; --hterm-mouse-cursor-style: var(--hterm-mouse-cursor-text);}@keyframes blink { from { opacity: 1.0; } to { opacity: 0.0; }}.blink-node { animation-name: blink; animation-duration: var(--hterm-blink-node-duration); animation-iteration-count: infinite; animation-timing-function: ease-in-out; animation-direction: alternate;}",this.document_.head.appendChild(o),this.cursorNode_=this.document_.createElement("div"),this.cursorNode_.id="hterm:terminal-cursor",this.cursorNode_.className="cursor-node",this.cursorNode_.style.cssText="position: absolute;left: calc(var(--hterm-charsize-width) * var(--hterm-cursor-offset-col));top: calc(var(--hterm-charsize-height) * var(--hterm-cursor-offset-row));display: block;width: var(--hterm-charsize-width);height: var(--hterm-charsize-height);-webkit-transition: opacity, background-color 100ms linear;-moz-transition: opacity, background-color 100ms linear;",this.setCursorColor(this.prefs_.get("cursor-color")),this.setCursorBlink(!!this.prefs_.get("cursor-blink")),this.restyleCursor_(),this.document_.body.appendChild(this.cursorNode_),this.scrollBlockerNode_=this.document_.createElement("div"),this.scrollBlockerNode_.id="hterm:mouse-drag-scroll-blocker",this.scrollBlockerNode_.style.cssText="position: absolute;top: -99px;display: block;width: 10px;height: 10px;",this.document_.body.appendChild(this.scrollBlockerNode_),this.scrollPort_.onScrollWheel=t,["mousedown","mouseup","mousemove","click","dblclick"].forEach(function(e){this.scrollBlockerNode_.addEventListener(e,t),this.cursorNode_.addEventListener(e,t),this.document_.addEventListener(e,t)}.bind(this)),this.cursorNode_.addEventListener("mousedown",function(){setTimeout(this.focus.bind(this))}.bind(this)),this.setReverseVideo(!1),this.scrollPort_.focus(),this.scrollPort_.scheduleRedraw()},hterm.Terminal.prototype.getDocument=function(){return this.document_},hterm.Terminal.prototype.focus=function(){this.scrollPort_.focus()},hterm.Terminal.prototype.getRowNode=function(e){if(e<this.scrollbackRows_.length)return this.scrollbackRows_[e];var t=e-this.scrollbackRows_.length;return this.screen_.rowsArray[t]},hterm.Terminal.prototype.getRowsText=function(e,t){for(var r=[],o=e;o<t;o++){var i=this.getRowNode(o);r.push(i.textContent),o<t-1&&!i.getAttribute("line-overflow")&&r.push("\n")}return r.join("")},hterm.Terminal.prototype.getRowText=function(e){return this.getRowNode(e).textContent},hterm.Terminal.prototype.getRowCount=function(){return this.scrollbackRows_.length+this.screen_.rowsArray.length},hterm.Terminal.prototype.appendRows_=function(e){for(var t=this.screen_.rowsArray.length,r=this.scrollbackRows_.length+t,o=0;o<e;o++){var i=this.document_.createElement("x-row");i.appendChild(this.document_.createTextNode("")),i.rowIndex=r+o,this.screen_.pushRow(i)}var s=this.screen_.rowsArray.length-this.screenSize.height;if(s>0){var n=this.screen_.shiftRows(s);Array.prototype.push.apply(this.scrollbackRows_,n),this.scrollPort_.isScrolledEnd&&this.scheduleScrollDown_()}t>=this.screen_.rowsArray.length&&(t=this.screen_.rowsArray.length-1),this.setAbsoluteCursorPosition(t,0)},hterm.Terminal.prototype.moveRows_=function(e,t,r){var o=this.screen_.removeRows(e,t);this.screen_.insertRows(r,o);var i,s;e<r?(i=e,s=r+t):(i=r,s=e+t),this.renumberRows_(i,s),this.scrollPort_.scheduleInvalidate()},hterm.Terminal.prototype.renumberRows_=function(e,t,r){for(var o=r||this.screen_,i=this.scrollbackRows_.length,s=e;s<t;s++)o.rowsArray[s].rowIndex=i+s},hterm.Terminal.prototype.print=function(e){var t=0,r=lib.wc.strWidth(e);for(0==r&&e&&(r=1);t<r;){this.options_.wraparound&&this.screen_.cursorPosition.overflow&&(this.screen_.commitLineOverflow(),this.newLine());var o,i=r-t,s=!1;this.screen_.cursorPosition.column+i>=this.screenSize.width&&(s=!0,i=this.screenSize.width-this.screen_.cursorPosition.column),s&&!this.options_.wraparound?(o=lib.wc.substr(e,t,i-1)+lib.wc.substr(e,r-1),i=r):o=lib.wc.substr(e,t,i);for(var n=hterm.TextAttributes.splitWidecharString(o),a=0;a<n.length;a++)this.screen_.textAttributes.wcNode=n[a].wcNode,this.screen_.textAttributes.asciiNode=n[a].asciiNode,this.options_.insertMode?this.screen_.insertString(n[a].str,n[a].wcStrWidth):this.screen_.overwriteString(n[a].str,n[a].wcStrWidth),this.screen_.textAttributes.wcNode=!1,this.screen_.textAttributes.asciiNode=!0;this.screen_.maybeClipCurrentRow(),t+=i}this.scheduleSyncCursorPosition_(),this.scrollOnOutput_&&this.scrollPort_.scrollRowToBottom(this.getRowCount())},hterm.Terminal.prototype.setVTScrollRegion=function(e,t){0==e&&t==this.screenSize.height-1?(this.vtScrollTop_=null,this.vtScrollBottom_=null):(this.vtScrollTop_=e,this.vtScrollBottom_=t)},hterm.Terminal.prototype.getVTScrollTop=function(){return null!=this.vtScrollTop_?this.vtScrollTop_:0},hterm.Terminal.prototype.getVTScrollBottom=function(){return null!=this.vtScrollBottom_?this.vtScrollBottom_:this.screenSize.height-1},hterm.Terminal.prototype.newLine=function(){var e=this.screen_.cursorPosition.row==this.screen_.rowsArray.length-1;null!=this.vtScrollBottom_?this.screen_.cursorPosition.row==this.vtScrollBottom_?(this.vtScrollUp(1),this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row,0)):e?this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row,0):this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row+1,0):e?this.appendRows_(1):this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row+1,0)},hterm.Terminal.prototype.lineFeed=function(){var e=this.screen_.cursorPosition.column;this.newLine(),this.setCursorColumn(e)},hterm.Terminal.prototype.formFeed=function(){this.options_.autoCarriageReturn?this.newLine():this.lineFeed()},hterm.Terminal.prototype.reverseLineFeed=function(){var e=this.getVTScrollTop(),t=this.screen_.cursorPosition.row;t==e?this.insertLines(1):this.setAbsoluteCursorRow(t-1)},hterm.Terminal.prototype.eraseToLeft=function(){var e=this.saveCursor();this.setCursorColumn(0);var t=e.column+1;this.screen_.overwriteString(lib.f.getWhitespace(t),t),this.restoreCursor(e)},hterm.Terminal.prototype.eraseToRight=function(e){if(!this.screen_.cursorPosition.overflow){var t=this.screenSize.width-this.screen_.cursorPosition.column,r=e?Math.min(e,t):t;if(this.screen_.textAttributes.background===this.screen_.textAttributes.DEFAULT_COLOR){var o=this.screen_.rowsArray[this.screen_.cursorPosition.row];if(hterm.TextAttributes.nodeWidth(o)<=this.screen_.cursorPosition.column+r)return this.screen_.deleteChars(r),void this.clearCursorOverflow()}var i=this.saveCursor();this.screen_.overwriteString(lib.f.getWhitespace(r),r),this.restoreCursor(i),this.clearCursorOverflow()}},hterm.Terminal.prototype.eraseLine=function(){var e=this.saveCursor();this.screen_.clearCursorRow(),this.restoreCursor(e),this.clearCursorOverflow()},hterm.Terminal.prototype.eraseAbove=function(){var e=this.saveCursor();this.eraseToLeft();for(var t=0;t<e.row;t++)this.setAbsoluteCursorPosition(t,0),this.screen_.clearCursorRow();this.restoreCursor(e),this.clearCursorOverflow()},hterm.Terminal.prototype.eraseBelow=function(){var e=this.saveCursor();this.eraseToRight();for(var t=this.screenSize.height-1,r=e.row+1;r<=t;r++)this.setAbsoluteCursorPosition(r,0),this.screen_.clearCursorRow();this.restoreCursor(e),this.clearCursorOverflow()},hterm.Terminal.prototype.fill=function(e){var t=this.saveCursor();this.setAbsoluteCursorPosition(0,0);for(var r=0;r<this.screenSize.height;r++)for(var o=0;o<this.screenSize.width;o++)this.setAbsoluteCursorPosition(r,o),this.screen_.overwriteString(e,1);this.restoreCursor(t)},hterm.Terminal.prototype.clearHome=function(e){var t=e||this.screen_,r=t.getHeight();if(0!=r){for(var o=0;o<r;o++)t.setCursorPosition(o,0),t.clearCursorRow();t.setCursorPosition(0,0)}},hterm.Terminal.prototype.clear=function(e){var t=e||this.screen_,r=t.cursorPosition.clone();this.clearHome(t),t.setCursorPosition(r.row,r.column)},hterm.Terminal.prototype.insertLines=function(e){var t=this.screen_.cursorPosition.row,r=this.getVTScrollBottom(),o=r-t-(e=Math.min(e,r-t))+1;o&&this.moveRows_(t,o,t+e);for(var i=e-1;i>=0;i--)this.setAbsoluteCursorPosition(t+i,0),this.screen_.clearCursorRow()},hterm.Terminal.prototype.deleteLines=function(e){var t=this.saveCursor(),r=t.row,o=this.getVTScrollBottom(),i=o-r+1,s=o-(e=Math.min(e,i))+1;e!=i&&this.moveRows_(r,e,s);for(var n=0;n<e;n++)this.setAbsoluteCursorPosition(s+n,0),this.screen_.clearCursorRow();this.restoreCursor(t),this.clearCursorOverflow()},hterm.Terminal.prototype.insertSpace=function(e){var t=this.saveCursor(),r=lib.f.getWhitespace(e||1);this.screen_.insertString(r,r.length),this.screen_.maybeClipCurrentRow(),this.restoreCursor(t),this.clearCursorOverflow()},hterm.Terminal.prototype.deleteChars=function(e){var t=this.screen_.deleteChars(e);if(t&&!this.screen_.textAttributes.isDefault()){var r=this.saveCursor();this.setCursorColumn(this.screenSize.width-t),this.screen_.insertString(lib.f.getWhitespace(t)),this.restoreCursor(r)}this.clearCursorOverflow()},hterm.Terminal.prototype.vtScrollUp=function(e){var t=this.saveCursor();this.setAbsoluteCursorRow(this.getVTScrollTop()),this.deleteLines(e),this.restoreCursor(t)},hterm.Terminal.prototype.vtScrollDown=function(e){var t=this.saveCursor();this.setAbsoluteCursorPosition(this.getVTScrollTop(),0),this.insertLines(e),this.restoreCursor(t)},hterm.Terminal.prototype.setCursorPosition=function(e,t){this.options_.originMode?this.setRelativeCursorPosition(e,t):this.setAbsoluteCursorPosition(e,t)},hterm.Terminal.prototype.setRelativeCursorPosition=function(e,t){var r=this.getVTScrollTop();e=lib.f.clamp(e+r,r,this.getVTScrollBottom()),t=lib.f.clamp(t,0,this.screenSize.width-1),this.screen_.setCursorPosition(e,t)},hterm.Terminal.prototype.setAbsoluteCursorPosition=function(e,t){e=lib.f.clamp(e,0,this.screenSize.height-1),t=lib.f.clamp(t,0,this.screenSize.width-1),this.screen_.setCursorPosition(e,t)},hterm.Terminal.prototype.setCursorColumn=function(e){this.setAbsoluteCursorPosition(this.screen_.cursorPosition.row,e)},hterm.Terminal.prototype.getCursorColumn=function(){return this.screen_.cursorPosition.column},hterm.Terminal.prototype.setAbsoluteCursorRow=function(e){this.setAbsoluteCursorPosition(e,this.screen_.cursorPosition.column)},hterm.Terminal.prototype.getCursorRow=function(){return this.screen_.cursorPosition.row},hterm.Terminal.prototype.scheduleRedraw_=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout(function(){delete e.timeouts_.redraw,e.scrollPort_.redraw_()},0)}},hterm.Terminal.prototype.scheduleScrollDown_=function(){if(!this.timeouts_.scrollDown){var e=this;this.timeouts_.scrollDown=setTimeout(function(){delete e.timeouts_.scrollDown,e.scrollPort_.scrollRowToBottom(e.getRowCount())},10)}},hterm.Terminal.prototype.cursorUp=function(e){return this.cursorDown(-(e||1))},hterm.Terminal.prototype.cursorDown=function(e){e=e||1;var t=this.options_.originMode?this.getVTScrollTop():0,r=this.options_.originMode?this.getVTScrollBottom():this.screenSize.height-1,o=lib.f.clamp(this.screen_.cursorPosition.row+e,t,r);this.setAbsoluteCursorRow(o)},hterm.Terminal.prototype.cursorLeft=function(e){if(!((e=e||1)<1)){var t=this.screen_.cursorPosition.column;if(this.options_.reverseWraparound){if(this.screen_.cursorPosition.overflow&&(e--,this.clearCursorOverflow(),!e))return;var r=this.screen_.cursorPosition.row;(o=t-e)<0&&((r=r-Math.floor(e/this.screenSize.width)-1)<0&&(r=this.screenSize.height+r%this.screenSize.height),o=this.screenSize.width+o%this.screenSize.width),this.setCursorPosition(Math.max(r,0),o)}else{var o=Math.max(t-e,0);this.setCursorColumn(o)}}},hterm.Terminal.prototype.cursorRight=function(e){if(!((e=e||1)<1)){var t=lib.f.clamp(this.screen_.cursorPosition.column+e,0,this.screenSize.width-1);this.setCursorColumn(t)}},hterm.Terminal.prototype.setReverseVideo=function(e){this.options_.reverseVideo=e,e?(this.scrollPort_.setForegroundColor(this.prefs_.get("background-color")),this.scrollPort_.setBackgroundColor(this.prefs_.get("foreground-color"))):(this.scrollPort_.setForegroundColor(this.prefs_.get("foreground-color")),this.scrollPort_.setBackgroundColor(this.prefs_.get("background-color")))},hterm.Terminal.prototype.ringBell=function(){this.cursorNode_.style.backgroundColor=this.scrollPort_.getForegroundColor();var e=this;if(setTimeout(function(){e.restyleCursor_()},200),!this.bellSquelchTimeout_&&(this.bellAudio_.getAttribute("src")?(this.bellAudio_.play(),this.bellSequelchTimeout_=setTimeout(function(){delete this.bellSquelchTimeout_}.bind(this),500)):delete this.bellSquelchTimeout_,this.desktopNotificationBell_&&!this.document_.hasFocus())){var t=hterm.notify();this.bellNotificationList_.push(t),t.onclick=function(){e.closeBellNotifications_()}}},hterm.Terminal.prototype.setOriginMode=function(e){this.options_.originMode=e,this.setCursorPosition(0,0)},hterm.Terminal.prototype.setInsertMode=function(e){this.options_.insertMode=e},hterm.Terminal.prototype.setAutoCarriageReturn=function(e){this.options_.autoCarriageReturn=e},hterm.Terminal.prototype.setWraparound=function(e){this.options_.wraparound=e},hterm.Terminal.prototype.setReverseWraparound=function(e){this.options_.reverseWraparound=e},hterm.Terminal.prototype.setAlternateMode=function(e){var t=this.saveCursor();if(this.screen_=e?this.alternateScreen_:this.primaryScreen_,this.screen_.rowsArray.length&&this.screen_.rowsArray[0].rowIndex!=this.scrollbackRows_.length)for(var r=this.scrollbackRows_.length,o=this.screen_.rowsArray,i=0;i<o.length;i++)o[i].rowIndex=r+i;this.realizeWidth_(this.screenSize.width),this.realizeHeight_(this.screenSize.height),this.scrollPort_.syncScrollHeight(),this.scrollPort_.invalidate(),this.restoreCursor(t),this.scrollPort_.resize()},hterm.Terminal.prototype.setCursorBlink=function(e){this.options_.cursorBlink=e,!e&&this.timeouts_.cursorBlink&&(clearTimeout(this.timeouts_.cursorBlink),delete this.timeouts_.cursorBlink),this.options_.cursorVisible&&this.setCursorVisible(!0)},hterm.Terminal.prototype.setCursorVisible=function(e){if(this.options_.cursorVisible=e,!e)return this.timeouts_.cursorBlink&&(clearTimeout(this.timeouts_.cursorBlink),delete this.timeouts_.cursorBlink),void(this.cursorNode_.style.opacity="0");if(this.syncCursorPosition_(),this.cursorNode_.style.opacity="1",this.options_.cursorBlink){if(this.timeouts_.cursorBlink)return;this.onCursorBlink_()}else this.timeouts_.cursorBlink&&(clearTimeout(this.timeouts_.cursorBlink),delete this.timeouts_.cursorBlink)},hterm.Terminal.prototype.syncCursorPosition_=function(){var e=this.scrollPort_.getTopRowIndex(),t=this.scrollPort_.getBottomRowIndex(e),r=this.scrollbackRows_.length+this.screen_.cursorPosition.row;if(r>t)this.setCssVar("cursor-offset-row","-1");else{this.options_.cursorVisible&&"none"==this.cursorNode_.style.display&&(this.cursorNode_.style.display=""),this.setCssVar("cursor-offset-row",r-e+" + "+this.scrollPort_.visibleRowTopMargin+"px"),this.setCssVar("cursor-offset-col",this.screen_.cursorPosition.column),this.cursorNode_.setAttribute("title","("+this.screen_.cursorPosition.column+", "+this.screen_.cursorPosition.row+")");var o=this.document_.getSelection();o&&o.isCollapsed&&this.screen_.syncSelectionCaret(o)}},hterm.Terminal.prototype.restyleCursor_=function(){var e=this.cursorShape_;"false"==this.cursorNode_.getAttribute("focus")&&(e=hterm.Terminal.cursorShape.BLOCK);var t=this.cursorNode_.style;switch(e){case hterm.Terminal.cursorShape.BEAM:t.height="var(--hterm-charsize-height)",t.backgroundColor="transparent",t.borderBottomStyle=null,t.borderLeftStyle="solid";break;case hterm.Terminal.cursorShape.UNDERLINE:t.height=this.scrollPort_.characterSize.baseline+"px",t.backgroundColor="transparent",t.borderBottomStyle="solid",t.borderLeftStyle=null;break;default:t.height="var(--hterm-charsize-height)",t.backgroundColor=this.cursorColor_,t.borderBottomStyle=null,t.borderLeftStyle=null}},hterm.Terminal.prototype.scheduleSyncCursorPosition_=function(){if(!this.timeouts_.syncCursor){var e=this;this.timeouts_.syncCursor=setTimeout(function(){e.syncCursorPosition_(),delete e.timeouts_.syncCursor},0)}},hterm.Terminal.prototype.showZoomWarning_=function(e){if(!this.zoomWarningNode_){if(!e)return;this.zoomWarningNode_=this.document_.createElement("div"),this.zoomWarningNode_.id="hterm:zoom-warning",this.zoomWarningNode_.style.cssText="color: black;background-color: #ff2222;font-size: large;border-radius: 8px;opacity: 0.75;padding: 0.2em 0.5em 0.2em 0.5em;top: 0.5em;right: 1.2em;position: absolute;-webkit-text-size-adjust: none;-webkit-user-select: none;-moz-text-size-adjust: none;-moz-user-select: none;",this.zoomWarningNode_.addEventListener("click",function(e){this.parentNode.removeChild(this)})}this.zoomWarningNode_.textContent=lib.MessageManager.replaceReferences(hterm.zoomWarningMessage,[parseInt(100*this.scrollPort_.characterSize.zoomFactor)]),this.zoomWarningNode_.style.fontFamily=this.prefs_.get("font-family"),e?this.zoomWarningNode_.parentNode||this.div_.parentNode.appendChild(this.zoomWarningNode_):this.zoomWarningNode_.parentNode&&this.zoomWarningNode_.parentNode.removeChild(this.zoomWarningNode_)},hterm.Terminal.prototype.showOverlay=function(e,t){var r=this;if(!this.overlayNode_){if(!this.div_)return;this.overlayNode_=this.document_.createElement("div"),this.overlayNode_.style.cssText="border-radius: 15px;font-size: xx-large;opacity: 0.75;padding: 0.2em 0.5em 0.2em 0.5em;position: absolute;-webkit-user-select: none;-webkit-transition: opacity 180ms ease-in;-moz-user-select: none;-moz-transition: opacity 180ms ease-in;",this.overlayNode_.addEventListener("mousedown",function(e){e.preventDefault(),e.stopPropagation()},!0)}this.overlayNode_.style.color=this.prefs_.get("background-color"),this.overlayNode_.style.backgroundColor=this.prefs_.get("foreground-color"),this.overlayNode_.style.fontFamily=this.prefs_.get("font-family"),this.overlayNode_.textContent=e,this.overlayNode_.style.opacity="0.75",this.overlayNode_.parentNode||this.div_.appendChild(this.overlayNode_);var o=hterm.getClientSize(this.div_),i=hterm.getClientSize(this.overlayNode_);this.overlayNode_.style.top=(o.height-i.height)/2+"px",this.overlayNode_.style.left=(o.width-i.width-this.scrollPort_.currentScrollbarWidthPx)/2+"px",this.overlayTimeout_&&clearTimeout(this.overlayTimeout_),null!==t&&(this.overlayTimeout_=setTimeout(function(){r.overlayNode_.style.opacity="0",r.overlayTimeout_=setTimeout(function(){return r.hideOverlay()},200)},t||1500))},hterm.Terminal.prototype.hideOverlay=function(){this.overlayTimeout_&&clearTimeout(this.overlayTimeout_),this.overlayTimeout_=null,this.overlayNode_.parentNode&&this.overlayNode_.parentNode.removeChild(this.overlayNode_),this.overlayNode_.style.opacity="0.75"},hterm.Terminal.prototype.paste=function(){return hterm.pasteFromClipboard(this.document_)},hterm.Terminal.prototype.copyStringToClipboard=function(e){this.prefs_.get("enable-clipboard-notice")&&setTimeout(this.showOverlay.bind(this,hterm.notifyCopyMessage,500),200);var t=this.document_.createElement("pre");t.id="hterm:copy-to-clipboard-source",t.textContent=e,t.style.cssText="-webkit-user-select: text;-moz-user-select: text;position: absolute;top: -99px",this.document_.body.appendChild(t);var r=this.document_.getSelection(),o=r.anchorNode,i=r.anchorOffset,s=r.focusNode,n=r.focusOffset;r.selectAllChildren(t),hterm.copySelectionToClipboard(this.document_),r.extend&&(r.collapse(o,i),r.extend(s,n)),t.parentNode.removeChild(t)},hterm.Terminal.prototype.getSelectionText=function(){var e=this.scrollPort_.selection;if(e.sync(),e.isCollapsed)return null;var t=e.startOffset,r=e.startNode;if("X-ROW"!=r.nodeName)for("#text"==r.nodeName&&"SPAN"==r.parentNode.nodeName&&(r=r.parentNode);r.previousSibling;)r=r.previousSibling,t+=hterm.TextAttributes.nodeWidth(r);var o=hterm.TextAttributes.nodeWidth(e.endNode)-e.endOffset;if("X-ROW"!=(r=e.endNode).nodeName)for("#text"==r.nodeName&&"SPAN"==r.parentNode.nodeName&&(r=r.parentNode);r.nextSibling;)r=r.nextSibling,o+=hterm.TextAttributes.nodeWidth(r);var i=this.getRowsText(e.startRow.rowIndex,e.endRow.rowIndex+1);return lib.wc.substring(i,t,lib.wc.strWidth(i)-o)},hterm.Terminal.prototype.copySelectionToClipboard=function(){var e=this.getSelectionText();null!=e&&this.copyStringToClipboard(e)},hterm.Terminal.prototype.overlaySize=function(){this.showOverlay(this.screenSize.width+"x"+this.screenSize.height)},hterm.Terminal.prototype.onVTKeystroke=function(e){this.scrollOnKeystroke_&&this.scrollPort_.scrollRowToBottom(this.getRowCount()),this.io.onVTKeystroke(this.keyboard.encode(e))},hterm.Terminal.prototype.openUrl=function(e){window.chrome&&window.chrome.browser?chrome.browser.openTab({url:e}):window.open(e,"_blank").focus()},hterm.Terminal.prototype.openSelectedUrl_=function(){var e=this.getSelectionText();if((null!=e||(this.screen_.expandSelection(this.document_.getSelection()),null!=(e=this.getSelectionText())))&&!(e.length>2048||e.search(/[\s\[\](){}<>"'\\^`]/)>=0)){if(e.search("^[a-zA-Z][a-zA-Z0-9+.-]*://")<0)switch(e.split(":",1)[0]){case"mailto":break;default:e="http://"+e}this.openUrl(e)}},hterm.Terminal.prototype.onMouse_=function(e){if(!e.processedByTerminalHandler_){var t=!this.defeatMouseReports_&&this.vt.mouseReport!=this.vt.MOUSE_REPORT_DISABLED;if(e.processedByTerminalHandler_=!0,e.terminalRow=parseInt((e.clientY-this.scrollPort_.visibleRowTopMargin)/this.scrollPort_.characterSize.height)+1,e.terminalColumn=parseInt(e.clientX/this.scrollPort_.characterSize.width)+1,!("mousedown"==e.type&&e.terminalColumn>this.screenSize.width)){if(this.options_.cursorVisible&&!t&&(e.terminalRow-1==this.screen_.cursorPosition.row&&e.terminalColumn-1==this.screen_.cursorPosition.column?this.cursorNode_.style.display="none":"none"==this.cursorNode_.style.display&&(this.cursorNode_.style.display="")),"mousedown"==e.type&&(e.altKey||!t?(this.defeatMouseReports_=!0,this.setSelectionEnabled(!0)):(this.defeatMouseReports_=!1,this.document_.getSelection().collapseToEnd(),this.setSelectionEnabled(!1),e.preventDefault())),t)this.scrollBlockerNode_.engaged||("mousedown"==e.type?(this.scrollBlockerNode_.engaged=!0,this.scrollBlockerNode_.style.top=e.clientY-5+"px",this.scrollBlockerNode_.style.left=e.clientX-5+"px"):"mousemove"==e.type&&(this.document_.getSelection().collapseToEnd(),e.preventDefault())),this.onMouse(e);else{if("dblclick"==e.type&&this.copyOnSelect&&(this.screen_.expandSelection(this.document_.getSelection()),this.copySelectionToClipboard(this.document_)),"click"==e.type&&!e.shiftKey&&(e.ctrlKey||e.metaKey))return clearTimeout(this.timeouts_.openUrl),void(this.timeouts_.openUrl=setTimeout(this.openSelectedUrl_.bind(this),500));if("mousedown"==e.type&&(this.mouseRightClickPaste&&2==e.button||e.button==this.mousePasteButton)&&(this.paste()||console.warn("Could not paste manually due to web restrictions")),"mouseup"==e.type&&0==e.button&&this.copyOnSelect&&!this.document_.getSelection().isCollapsed&&this.copySelectionToClipboard(this.document_),"mousemove"!=e.type&&"mouseup"!=e.type||!this.scrollBlockerNode_.engaged||(this.scrollBlockerNode_.engaged=!1,this.scrollBlockerNode_.style.top="-99px"),this.scrollWheelArrowKeys_&&!e.shiftKey&&this.keyboard.applicationCursor&&!this.isPrimaryScreen()&&"wheel"==e.type){var r=this.scrollPort_.scrollWheelDelta(e),o=lib.f.smartFloorDivide(Math.abs(r),this.scrollPort_.characterSize.height),i="O"+(r<0?"B":"A");this.io.sendString(i.repeat(o)),e.preventDefault()}}"mouseup"==e.type&&this.document_.getSelection().isCollapsed&&(this.defeatMouseReports_=!1)}}},hterm.Terminal.prototype.onMouse=function(e){},hterm.Terminal.prototype.onFocusChange_=function(e){this.cursorNode_.setAttribute("focus",e),this.restyleCursor_(),this.reportFocus&&this.io.sendString(!0===e?"":""),!0===e&&this.closeBellNotifications_()},hterm.Terminal.prototype.onScroll_=function(){this.scheduleSyncCursorPosition_()},hterm.Terminal.prototype.onPaste_=function(e){var t=e.text.replace(/\n/gm,"\r");t=this.keyboard.encode(t),this.options_.bracketedPaste&&(t="[200~"+t+"[201~"),this.io.sendString(t)},hterm.Terminal.prototype.onCopy_=function(e){this.useDefaultWindowCopy||(e.preventDefault(),setTimeout(this.copySelectionToClipboard.bind(this),0))},hterm.Terminal.prototype.onResize_=function(){var e=Math.floor(this.scrollPort_.getScreenWidth()/this.scrollPort_.characterSize.width)||0,t=lib.f.smartFloorDivide(this.scrollPort_.getScreenHeight(),this.scrollPort_.characterSize.height)||0;if(!(e<=0||t<=0)){var r=e!=this.screenSize.width||t!=this.screenSize.height;this.realizeSize_(e,t),this.showZoomWarning_(1!=this.scrollPort_.characterSize.zoomFactor),r&&this.overlaySize(),this.restyleCursor_(),this.scheduleSyncCursorPosition_()}},hterm.Terminal.prototype.onCursorBlink_=function(){this.options_.cursorBlink?"false"==this.cursorNode_.getAttribute("focus")||"0"==this.cursorNode_.style.opacity?(this.cursorNode_.style.opacity="1",this.timeouts_.cursorBlink=setTimeout(this.myOnCursorBlink_,this.cursorBlinkCycle_[0])):(this.cursorNode_.style.opacity="0",this.timeouts_.cursorBlink=setTimeout(this.myOnCursorBlink_,this.cursorBlinkCycle_[1])):delete this.timeouts_.cursorBlink},hterm.Terminal.prototype.setScrollbarVisible=function(e){this.scrollPort_.setScrollbarVisible(e)},hterm.Terminal.prototype.setScrollWheelMoveMultipler=function(e){this.scrollPort_.setScrollWheelMoveMultipler(e)},hterm.Terminal.prototype.closeBellNotifications_=function(){this.bellNotificationList_.forEach(function(e){e.close()}),this.bellNotificationList_.length=0},lib.rtdep("lib.encodeUTF8"),hterm.Terminal.IO=function(e){this.terminal_=e,this.previousIO_=null,this.buffered_=""},hterm.Terminal.IO.prototype.showOverlay=function(e,t){this.terminal_.showOverlay(e,t)},hterm.Terminal.IO.prototype.hideOverlay=function(){this.terminal_.hideOverlay()},hterm.Terminal.IO.prototype.createFrame=function(e,t){return new hterm.Frame(this.terminal_,e,t)},hterm.Terminal.IO.prototype.setTerminalProfile=function(e){this.terminal_.setProfile(e)},hterm.Terminal.IO.prototype.push=function(){var e=new hterm.Terminal.IO(this.terminal_);return e.keyboardCaptured_=this.keyboardCaptured_,e.columnCount=this.columnCount,e.rowCount=this.rowCount,e.previousIO_=this.terminal_.io,this.terminal_.io=e,e},hterm.Terminal.IO.prototype.pop=function(){this.terminal_.io=this.previousIO_,this.previousIO_.flush()},hterm.Terminal.IO.prototype.flush=function(){this.buffered_&&(this.terminal_.interpret(this.buffered_),this.buffered_="")},hterm.Terminal.IO.prototype.sendString=function(e){console.log("Unhandled sendString: "+e)},hterm.Terminal.IO.prototype.onVTKeystroke=function(e){console.log("Unobserverd VT keystroke: "+JSON.stringify(e))},hterm.Terminal.IO.prototype.onTerminalResize_=function(e,t){for(var r=this;r;)r.columnCount=e,r.rowCount=t,r=r.previousIO_;this.onTerminalResize(e,t)},hterm.Terminal.IO.prototype.onTerminalResize=function(e,t){},hterm.Terminal.IO.prototype.writeUTF8=function(e){this.terminal_.io==this?this.terminal_.interpret(e):this.buffered_+=e},hterm.Terminal.IO.prototype.writelnUTF8=function(e){this.writeUTF8(e+"\r\n")},hterm.Terminal.IO.prototype.print=hterm.Terminal.IO.prototype.writeUTF16=function(e){this.writeUTF8(lib.encodeUTF8(e))},hterm.Terminal.IO.prototype.println=hterm.Terminal.IO.prototype.writelnUTF16=function(e){this.writelnUTF8(lib.encodeUTF8(e))},lib.rtdep("lib.colors"),hterm.TextAttributes=function(e){this.document_=e,this.foregroundSource=this.SRC_DEFAULT,this.backgroundSource=this.SRC_DEFAULT,this.foreground=this.DEFAULT_COLOR,this.background=this.DEFAULT_COLOR,this.defaultForeground="rgb(255, 255, 255)",this.defaultBackground="rgb(0, 0, 0)",this.bold=!1,this.faint=!1,this.italic=!1,this.blink=!1,this.underline=!1,this.strikethrough=!1,this.inverse=!1,this.invisible=!1,this.wcNode=!1,this.asciiNode=!0,this.tileData=null,this.colorPalette=null,this.resetColorPalette()},hterm.TextAttributes.prototype.enableBold=!0,hterm.TextAttributes.prototype.enableBoldAsBright=!0,hterm.TextAttributes.prototype.DEFAULT_COLOR=lib.f.createEnum(""),hterm.TextAttributes.prototype.SRC_DEFAULT="default",hterm.TextAttributes.prototype.SRC_RGB="rgb",hterm.TextAttributes.prototype.setDocument=function(e){this.document_=e},hterm.TextAttributes.prototype.clone=function(){var e=new hterm.TextAttributes(null);for(var t in this)e[t]=this[t];return e.colorPalette=this.colorPalette.concat(),e},hterm.TextAttributes.prototype.reset=function(){this.foregroundSource=this.SRC_DEFAULT,this.backgroundSource=this.SRC_DEFAULT,this.foreground=this.DEFAULT_COLOR,this.background=this.DEFAULT_COLOR,this.bold=!1,this.faint=!1,this.italic=!1,this.blink=!1,this.underline=!1,this.strikethrough=!1,this.inverse=!1,this.invisible=!1,this.wcNode=!1,this.asciiNode=!0},hterm.TextAttributes.prototype.resetColorPalette=function(){this.colorPalette=lib.colors.colorPalette.concat(),this.syncColors()},hterm.TextAttributes.prototype.isDefault=function(){return this.foregroundSource==this.SRC_DEFAULT&&this.backgroundSource==this.SRC_DEFAULT&&!this.bold&&!this.faint&&!this.italic&&!this.blink&&!this.underline&&!this.strikethrough&&!this.inverse&&!this.invisible&&!this.wcNode&&this.asciiNode&&null==this.tileData},hterm.TextAttributes.prototype.createContainer=function(e){if(this.isDefault()){var t=this.document_.createTextNode(e);return t.asciiNode=!0,t}var r=this.document_.createElement("span"),o=r.style,i=[];this.foreground!=this.DEFAULT_COLOR&&(o.color=this.foreground),this.background!=this.DEFAULT_COLOR&&(o.backgroundColor=this.background),this.enableBold&&this.bold&&(o.fontWeight="bold"),this.faint&&(r.faint=!0),this.italic&&(o.fontStyle="italic"),this.blink&&(i.push("blink-node"),r.blinkNode=!0);var s="";return this.underline&&(s+=" underline",r.underline=!0),this.strikethrough&&(s+=" line-through",r.strikethrough=!0),s&&(o.textDecoration=s),this.wcNode&&(i.push("wc-node"),r.wcNode=!0),r.asciiNode=this.asciiNode,null!=this.tileData&&(i.push("tile"),i.push("tile_"+this.tileData),r.tileNode=!0),e&&(r.textContent=e),i.length&&(r.className=i.join(" ")),r},hterm.TextAttributes.prototype.matchesContainer=function(e){if("string"==typeof e||e.nodeType==Node.TEXT_NODE)return this.isDefault();var t=e.style;return!(this.wcNode||e.wcNode||this.asciiNode!=e.asciiNode||null!=this.tileData||e.tileNode||this.foreground!=t.color||this.background!=t.backgroundColor||(this.enableBold&&this.bold)!=!!t.fontWeight||this.blink!=!!e.blinkNode||this.italic!=!!t.fontStyle||!!this.underline!=!!e.underline||!!this.strikethrough!=!!e.strikethrough)},hterm.TextAttributes.prototype.setDefaults=function(e,t){this.defaultForeground=e,this.defaultBackground=t,this.syncColors()},hterm.TextAttributes.prototype.syncColors=function(){var e=this.foregroundSource,t=this.backgroundSource,r=this.DEFAULT_COLOR,o=this.DEFAULT_COLOR;if(this.inverse&&(e=this.backgroundSource,t=this.foregroundSource,r=this.defaultBackground,o=this.defaultForeground),this.enableBoldAsBright&&this.bold&&e!=this.SRC_DEFAULT&&e!=this.SRC_RGB&&(e=function(e){return e<8?e+8:e}(e)),this.invisible&&(e=t,r=this.defaultBackground),e!=this.SRC_RGB&&(this.foreground=e==this.SRC_DEFAULT?r:this.colorPalette[e]),this.faint&&!this.invisible){var i=this.foreground==this.DEFAULT_COLOR?this.defaultForeground:this.foreground;this.foreground=lib.colors.mix(i,"rgb(0, 0, 0)",.3333)}t!=this.SRC_RGB&&(this.background=t==this.SRC_DEFAULT?o:this.colorPalette[t])},hterm.TextAttributes.containersMatch=function(e,t){if("string"==typeof e)return hterm.TextAttributes.containerIsDefault(t);if(e.nodeType!=t.nodeType)return!1;if(e.nodeType==Node.TEXT_NODE)return!0;var r=e.style,o=t.style;return r.color==o.color&&r.backgroundColor==o.backgroundColor&&r.fontWeight==o.fontWeight&&r.fontStyle==o.fontStyle&&r.textDecoration==o.textDecoration},hterm.TextAttributes.containerIsDefault=function(e){return"string"==typeof e||e.nodeType==Node.TEXT_NODE},hterm.TextAttributes.nodeWidth=function(e){return e.asciiNode?e.textContent.length:lib.wc.strWidth(e.textContent)},hterm.TextAttributes.nodeSubstr=function(e,t,r){return e.asciiNode?e.textContent.substr(t,r):lib.wc.substr(e.textContent,t,r)},hterm.TextAttributes.nodeSubstring=function(e,t,r){return e.asciiNode?e.textContent.substring(t,r):lib.wc.substring(e.textContent,t,r)},hterm.TextAttributes.splitWidecharString=function(e){for(var t,r=[],o=0,i=0,s=0,n=!0,a=0;a<e.length;){var l,h=e.codePointAt(a);h<128?(s+=1,i+=1,l=1):(l=h<=65535?1:2,(t=lib.wc.charWidth(h))<=1?(s+=t,i+=l,n=!1):(i&&(r.push({str:e.substr(o,i),asciiNode:n,wcStrWidth:s}),n=!0,s=0),r.push({str:e.substr(a,l),wcNode:!0,asciiNode:!1,wcStrWidth:2}),o=a+l,i=0)),a+=l}return i&&r.push({str:e.substr(o,i),asciiNode:n,wcStrWidth:s}),r},lib.rtdep("lib.colors","lib.f","lib.UTF8Decoder","hterm.VT.CharacterMap"),hterm.VT=function(e){this.terminal=e,e.onMouse=this.onTerminalMouse_.bind(this),this.mouseReport=this.MOUSE_REPORT_DISABLED,this.parseState_=new hterm.VT.ParseState(this.parseUnknown_),this.leadingModifier_="",this.trailingModifier_="",this.allowColumnWidthChanges_=!1,this.oscTimeLimit_=2e4,this.utf8Decoder_=new lib.UTF8Decoder,this.enable8BitControl=!1,this.enableClipboardWrite=!0,this.enableDec12=!1,this.characterEncoding="utf-8",this.maxStringSequence=1024,this.warnUnimplemented=!1,this.characterMaps=new hterm.VT.CharacterMaps,this.G0=this.G1=this.G2=this.G3=this.characterMaps.getMap("B"),this.GL="G0",this.GR="G0",this.codingSystemUtf8_=!1,this.codingSystemLocked_=!1,this.cc1Pattern_=null,this.updateEncodingState_(),this.savedState_=new hterm.VT.CursorState(this)},hterm.VT.prototype.MOUSE_REPORT_DISABLED=0,hterm.VT.prototype.MOUSE_REPORT_CLICK=1,hterm.VT.prototype.MOUSE_REPORT_DRAG=3,hterm.VT.ParseState=function(e,t){this.defaultFunction=e,this.buf=t||null,this.pos=0,this.func=e,this.args=[]},hterm.VT.ParseState.prototype.reset=function(e){this.resetParseFunction(),this.resetBuf(e||""),this.resetArguments()},hterm.VT.ParseState.prototype.resetParseFunction=function(){this.func=this.defaultFunction},hterm.VT.ParseState.prototype.resetBuf=function(e){this.buf="string"==typeof e?e:null,this.pos=0},hterm.VT.ParseState.prototype.resetArguments=function(e){this.args.length=0,void 0!==e&&(this.args[0]=e)},hterm.VT.ParseState.prototype.iarg=function(e,t){var r=this.args[e];if(r){var o=parseInt(r,10);return 0==o&&(o=t),o}return t},hterm.VT.ParseState.prototype.advance=function(e){this.pos+=e},hterm.VT.ParseState.prototype.peekRemainingBuf=function(){return this.buf.substr(this.pos)},hterm.VT.ParseState.prototype.peekChar=function(){return this.buf.substr(this.pos,1)},hterm.VT.ParseState.prototype.consumeChar=function(){return this.buf.substr(this.pos++,1)},hterm.VT.ParseState.prototype.isComplete=function(){return null==this.buf||this.buf.length<=this.pos},hterm.VT.CursorState=function(e){this.vt_=e,this.save()},hterm.VT.CursorState.prototype.save=function(){this.cursor=this.vt_.terminal.saveCursor(),this.textAttributes=this.vt_.terminal.getTextAttributes().clone(),this.GL=this.vt_.GL,this.GR=this.vt_.GR,this.G0=this.vt_.G0,this.G1=this.vt_.G1,this.G2=this.vt_.G2,this.G3=this.vt_.G3},hterm.VT.CursorState.prototype.restore=function(){this.vt_.terminal.restoreCursor(this.cursor),this.vt_.terminal.setTextAttributes(this.textAttributes.clone()),this.vt_.GL=this.GL,this.vt_.GR=this.GR,this.vt_.G0=this.G0,this.vt_.G1=this.G1,this.vt_.G2=this.G2,this.vt_.G3=this.G3},hterm.VT.prototype.reset=function(){this.G0=this.characterMaps.getMap("B"),this.G1=this.characterMaps.getMap("0"),this.G2=this.characterMaps.getMap("B"),this.G3=this.characterMaps.getMap("B"),this.GL="G0",this.GR="G0",this.savedState_=new hterm.VT.CursorState(this),this.mouseReport=this.MOUSE_REPORT_DISABLED},hterm.VT.prototype.onTerminalMouse_=function(e){if(this.mouseReport!=this.MOUSE_REPORT_DISABLED){var t,r=0;e.shiftKey&&(r|=4),(e.metaKey||this.terminal.keyboard.altIsMeta&&e.altKey)&&(r|=8),e.ctrlKey&&(r|=16);var o=String.fromCharCode(lib.f.clamp(e.terminalColumn+32,32,255)),i=String.fromCharCode(lib.f.clamp(e.terminalRow+32,32,255));switch(e.type){case"wheel":s=96+(-1*e.deltaY>0?0:1),s|=r,t=""+String.fromCharCode(s)+o+i,e.preventDefault();break;case"mousedown":var s=Math.min(e.button,2)+32;s|=r,t=""+String.fromCharCode(s)+o+i;break;case"mouseup":t="#"+o+i;break;case"mousemove":this.mouseReport==this.MOUSE_REPORT_DRAG&&e.buttons&&(s=32,1&e.buttons?s+=0:4&e.buttons?s+=1:2&e.buttons?s+=2:s+=3,s+=32,s|=r,t=""+String.fromCharCode(s)+o+i);break;case"click":case"dblclick":break;default:console.error("Unknown mouse event: "+e.type,e)}t&&this.terminal.io.sendString(t)}},hterm.VT.prototype.interpret=function(e){for(this.parseState_.resetBuf(this.decode(e));!this.parseState_.isComplete();){var t=this.parseState_.func,r=this.parseState_.pos,e=this.parseState_.buf;if(this.parseState_.func.call(this,this.parseState_),this.parseState_.func==t&&this.parseState_.pos==r&&this.parseState_.buf==e)throw"Parser did not alter the state!"}},hterm.VT.prototype.decode=function(e){return"utf-8"==this.characterEncoding?this.decodeUTF8(e):e},hterm.VT.prototype.encodeUTF8=function(e){return lib.encodeUTF8(e)},hterm.VT.prototype.decodeUTF8=function(e){return this.utf8Decoder_.decode(e)},hterm.VT.prototype.setEncoding=function(e){switch(e){default:console.warn('Invalid value for "terminal-encoding": '+e);case"iso-2022":this.codingSystemUtf8_=!1,this.codingSystemLocked_=!1;break;case"utf-8-locked":this.codingSystemUtf8_=!0,this.codingSystemLocked_=!0;break;case"utf-8":this.codingSystemUtf8_=!0,this.codingSystemLocked_=!1}this.updateEncodingState_()},hterm.VT.prototype.updateEncodingState_=function(){var e=this,t=Object.keys(hterm.VT.CC1).filter(function(t){return!e.codingSystemUtf8_||t.charCodeAt()<128}).map(function(e){return"\\x"+lib.f.zpad(e.charCodeAt().toString(16),2)}).join("");this.cc1Pattern_=new RegExp("["+t+"]")},hterm.VT.prototype.parseUnknown_=function(e){function t(e){!r.codingSystemUtf8_&&r[r.GL].GL&&(e=r[r.GL].GL(e)),r.terminal.print(e)}var r=this,o=e.peekRemainingBuf(),i=o.search(this.cc1Pattern_);return 0==i?(this.dispatch("CC1",o.substr(0,1),e),void e.advance(1)):-1==i?(t(o),void e.reset()):(t(o.substr(0,i)),this.dispatch("CC1",o.substr(i,1),e),void e.advance(i+1))},hterm.VT.prototype.parseCSI_=function(e){var t=e.peekChar(),r=e.args;t>="@"&&t<="~"?(this.dispatch("CSI",this.leadingModifier_+this.trailingModifier_+t,e),e.resetParseFunction()):";"==t?this.trailingModifier_?e.resetParseFunction():(r.length||r.push(""),r.push("")):t>="0"&&t<="9"?this.trailingModifier_?e.resetParseFunction():r.length?r[r.length-1]+=t:r[0]=t:t>=" "&&t<="?"&&":"!=t?r.length?this.trailingModifier_+=t:this.leadingModifier_+=t:this.cc1Pattern_.test(t)?this.dispatch("CC1",t,e):e.resetParseFunction(),e.advance(1)},hterm.VT.prototype.parseUntilStringTerminator_=function(e){var t=e.peekRemainingBuf(),r=e.args,o=0;r.length?""==r[0].slice(-1)&&(r[0]=r[0].slice(0,-1),t=""+t,o=1):(r[0]="",r[1]=new Date);var i=t.search(/[\x1b\x07]/),s=t[i];if(!((""!=s||"\\"==t[i+1])&&-1!=i)){r[0]+=t;var n;return r[0].length>this.maxStringSequence&&(n="too long: "+r[0].length),""==s&&i!=t.length-1&&(n="embedded escape: "+i),new Date-r[1]>this.oscTimeLimit_&&(n="timeout expired: "+(new Date-r[1])),n?(this.warnUnimplemented&&console.log("parseUntilStringTerminator_: aborting: "+n,r[0]),e.reset(r[0]),!1):(e.advance(t.length-o),!0)}return r[0].length+i>this.maxStringSequence?(e.reset(r[0]+t),!1):(r[0]+=t.substr(0,i),e.resetParseFunction(),e.advance(i+(""==s?2:1)-o),!0)},hterm.VT.prototype.dispatch=function(e,t,r){var o=hterm.VT[e][t];o?o!=hterm.VT.ignore?"CC1"==e&&t>""&&!this.enable8BitControl?console.warn("Ignoring 8-bit control code: 0x"+t.charCodeAt(0).toString(16)):o.apply(this,[r,t]):this.warnUnimplemented&&console.warn("Ignored "+e+" code: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Unknown "+e+" code: "+JSON.stringify(t))},hterm.VT.prototype.setANSIMode=function(e,t){4==e?this.terminal.setInsertMode(t):20==e?this.terminal.setAutoCarriageReturn(t):this.warnUnimplemented&&console.warn("Unimplemented ANSI Mode: "+e)},hterm.VT.prototype.setDECMode=function(e,t){switch(parseInt(e,10)){case 1:this.terminal.keyboard.applicationCursor=t;break;case 3:this.allowColumnWidthChanges_&&(this.terminal.setWidth(t?132:80),this.terminal.clearHome(),this.terminal.setVTScrollRegion(null,null));break;case 5:this.terminal.setReverseVideo(t);break;case 6:this.terminal.setOriginMode(t);break;case 7:this.terminal.setWraparound(t);break;case 12:this.enableDec12&&this.terminal.setCursorBlink(t);break;case 25:this.terminal.setCursorVisible(t);break;case 30:this.terminal.setScrollbarVisible(t);break;case 40:this.terminal.allowColumnWidthChanges_=t;break;case 45:this.terminal.setReverseWraparound(t);break;case 67:this.terminal.keyboard.backspaceSendsBackspace=t;break;case 1e3:this.mouseReport=t?this.MOUSE_REPORT_CLICK:this.MOUSE_REPORT_DISABLED,this.terminal.syncMouseStyle();break;case 1002:this.mouseReport=t?this.MOUSE_REPORT_DRAG:this.MOUSE_REPORT_DISABLED,this.terminal.syncMouseStyle();break;case 1004:this.terminal.reportFocus=t;break;case 1010:this.terminal.scrollOnOutput=t;break;case 1011:this.terminal.scrollOnKeystroke=t;break;case 1036:this.terminal.keyboard.metaSendsEscape=t;break;case 1039:t?this.terminal.keyboard.previousAltSendsWhat_||(this.terminal.keyboard.previousAltSendsWhat_=this.terminal.keyboard.altSendsWhat,this.terminal.keyboard.altSendsWhat="escape"):this.terminal.keyboard.previousAltSendsWhat_&&(this.terminal.keyboard.altSendsWhat=this.terminal.keyboard.previousAltSendsWhat_,this.terminal.keyboard.previousAltSendsWhat_=null);break;case 47:case 1047:this.terminal.setAlternateMode(t);break;case 1048:this.savedState_.save();case 1049:t?(this.savedState_.save(),this.terminal.setAlternateMode(t),this.terminal.clear()):(this.terminal.setAlternateMode(t),this.savedState_.restore());break;case 2004:this.terminal.setBracketedPaste(t);break;default:this.warnUnimplemented&&console.warn("Unimplemented DEC Private Mode: "+e)}},hterm.VT.ignore=function(){},hterm.VT.CC1={},hterm.VT.ESC={},hterm.VT.CSI={},hterm.VT.OSC={},hterm.VT.VT52={},hterm.VT.CC1["\0"]=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1[""]=function(){this.terminal.ringBell()},hterm.VT.CC1["\b"]=function(){this.terminal.cursorLeft(1)},hterm.VT.CC1["\t"]=function(){this.terminal.forwardTabStop()},hterm.VT.CC1["\n"]=function(){this.terminal.formFeed()},hterm.VT.CC1["\v"]=hterm.VT.CC1["\n"],hterm.VT.CC1["\f"]=hterm.VT.CC1["\n"],hterm.VT.CC1["\r"]=function(){this.terminal.setCursorColumn(0)},hterm.VT.CC1[""]=function(){this.GL="G1"},hterm.VT.CC1[""]=function(){this.GL="G0"},hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1[""]=function(e){"G1"==this.GL&&(this.GL="G0"),e.resetParseFunction(),this.terminal.print("?")},hterm.VT.CC1[""]=hterm.VT.CC1[""],hterm.VT.CC1[""]=function(e){function t(e){var r=e.consumeChar();""!=r&&(this.dispatch("ESC",r,e),e.func==t&&e.resetParseFunction())}e.func=t},hterm.VT.CC1[""]=hterm.VT.ignore,hterm.VT.CC1["„"]=hterm.VT.ESC.D=function(){this.terminal.lineFeed()},hterm.VT.CC1["…"]=hterm.VT.ESC.E=function(){this.terminal.setCursorColumn(0),this.terminal.cursorDown(1)},hterm.VT.CC1["ˆ"]=hterm.VT.ESC.H=function(){this.terminal.setTabStop(this.terminal.getCursorColumn())},hterm.VT.CC1[""]=hterm.VT.ESC.M=function(){this.terminal.reverseLineFeed()},hterm.VT.CC1["Ž"]=hterm.VT.ESC.N=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ESC.O=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ESC.P=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},hterm.VT.CC1["–"]=hterm.VT.ESC.V=hterm.VT.ignore,hterm.VT.CC1["—"]=hterm.VT.ESC.W=hterm.VT.ignore,hterm.VT.CC1["˜"]=hterm.VT.ESC.X=hterm.VT.ignore,hterm.VT.CC1["š"]=hterm.VT.ESC.Z=function(){this.terminal.io.sendString("[?1;2c")},hterm.VT.CC1["›"]=hterm.VT.ESC["["]=function(e){e.resetArguments(),this.leadingModifier_="",this.trailingModifier_="",e.func=this.parseCSI_},hterm.VT.CC1["œ"]=hterm.VT.ESC["\\"]=hterm.VT.ignore,hterm.VT.CC1[""]=hterm.VT.ESC["]"]=function(e){function t(e){if(this.parseUntilStringTerminator_(e)&&e.func!=t){var r=e.args[0].match(/^(\d+);(.*)$/);r?(e.args[0]=r[2],this.dispatch("OSC",r[1],e)):console.warn("Invalid OSC: "+JSON.stringify(e.args[0]))}}e.resetArguments(),e.func=t},hterm.VT.CC1["ž"]=hterm.VT.ESC["^"]=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},hterm.VT.CC1["Ÿ"]=hterm.VT.ESC._=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},hterm.VT.ESC[" "]=function(e){e.func=function(e){var t=e.consumeChar();this.warnUnimplemented&&console.warn("Unimplemented sequence: ESC 0x20 "+t),e.resetParseFunction()}},hterm.VT.ESC["#"]=function(e){e.func=function(e){"8"==e.consumeChar()&&this.terminal.fill("E"),e.resetParseFunction()}},hterm.VT.ESC["%"]=function(e){e.func=function(e){var t=e.consumeChar();if(this.codingSystemLocked_)return"/"==t&&e.consumeChar(),void e.resetParseFunction();switch(t){case"@":this.setEncoding("iso-2022");break;case"G":this.setEncoding("utf-8");break;case"/":switch(t=e.consumeChar()){case"G":case"H":case"I":this.setEncoding("utf-8-locked");break;default:this.warnUnimplemented&&console.warn("Unknown ESC % / argument: "+JSON.stringify(t))}break;default:this.warnUnimplemented&&console.warn("Unknown ESC % argument: "+JSON.stringify(t))}e.resetParseFunction()}},hterm.VT.ESC["("]=hterm.VT.ESC[")"]=hterm.VT.ESC["*"]=hterm.VT.ESC["+"]=hterm.VT.ESC["-"]=hterm.VT.ESC["."]=hterm.VT.ESC["/"]=function(e,t){e.func=function(e){var r=e.consumeChar();if(""==r)return e.resetParseFunction(),void e.func();var o=this.characterMaps.getMap(r);void 0!==o?"("==t?this.G0=o:")"==t||"-"==t?this.G1=o:"*"==t||"."==t?this.G2=o:"+"!=t&&"/"!=t||(this.G3=o):this.warnUnimplemented&&console.log('Invalid character set for "'+t+'": '+r),e.resetParseFunction()}},hterm.VT.ESC[6]=hterm.VT.ignore,hterm.VT.ESC[7]=function(){this.savedState_.save()},hterm.VT.ESC[8]=function(){this.savedState_.restore()},hterm.VT.ESC[9]=hterm.VT.ignore,hterm.VT.ESC["="]=function(){this.terminal.keyboard.applicationKeypad=!0},hterm.VT.ESC[">"]=function(){this.terminal.keyboard.applicationKeypad=!1},hterm.VT.ESC.F=hterm.VT.ignore,hterm.VT.ESC.c=function(){this.reset(),this.terminal.reset()},hterm.VT.ESC.l=hterm.VT.ESC.m=hterm.VT.ignore,hterm.VT.ESC.n=function(){this.GL="G2"},hterm.VT.ESC.o=function(){this.GL="G3"},hterm.VT.ESC["|"]=function(){this.GR="G3"},hterm.VT.ESC["}"]=function(){this.GR="G2"},hterm.VT.ESC["~"]=function(){this.GR="G1"},hterm.VT.OSC[0]=function(e){this.terminal.setWindowTitle(e.args[0])},hterm.VT.OSC[2]=hterm.VT.OSC[0],hterm.VT.OSC[4]=function(e){for(var t=e.args[0].split(";"),r=parseInt(t.length/2),o=this.terminal.getTextAttributes().colorPalette,i=[],s=0;s<r;++s){var n=parseInt(t[2*s]),a=t[2*s+1];n>=o.length||("?"!=a?(a=lib.colors.x11ToCSS(a))&&(o[n]=a):(a=lib.colors.rgbToX11(o[n]))&&i.push(n+";"+a))}i.length&&this.terminal.io.sendString("]4;"+i.join(";")+"")},hterm.VT.OSC[9]=function(e){hterm.notify({body:e.args[0]})},hterm.VT.OSC[10]=function(e){var t=e.args[0].split(";");if(t){var r=lib.colors.x11ToCSS(t.shift());r&&this.terminal.setForegroundColor(r),t.length>0&&(e.args[0]=t.join(";"),hterm.VT.OSC[11].apply(this,[e]))}},hterm.VT.OSC[11]=function(e){var t=e.args[0].split(";");if(t){var r=lib.colors.x11ToCSS(t.shift());r&&this.terminal.setBackgroundColor(r),t.length>0&&(e.args[0]=t.join(";"),hterm.VT.OSC[12].apply(this,[e]))}},hterm.VT.OSC[12]=function(e){var t=e.args[0].split(";");if(t){var r=lib.colors.x11ToCSS(t.shift());r&&this.terminal.setCursorColor(r)}},hterm.VT.OSC[50]=function(e){var t=e.args[0].match(/CursorShape=(.)/i);if(t)switch(t[1]){case"1":this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM);break;case"2":this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE);break;default:this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK)}else console.warn("Could not parse OSC 50 args: "+e.args[0])},hterm.VT.OSC[52]=function(e){var t=e.args[0].match(/^[cps01234567]*;(.*)/);if(t){var r=window.atob(t[1]);r&&this.terminal.copyStringToClipboard(this.decode(r))}},hterm.VT.OSC[777]=function(e){var t;switch(e.args[0].split(";",1)[0]){case"notify":var r,o;(t=e.args[0].match(/^[^;]+;([^;]*)(;([\s\S]*))?$/))&&(r=t[1],o=t[3]),hterm.notify({title:r,body:o});break;default:console.warn("Unknown urxvt module: "+e.args[0])}},hterm.VT.CSI["@"]=function(e){this.terminal.insertSpace(e.iarg(0,1))},hterm.VT.CSI.A=function(e){this.terminal.cursorUp(e.iarg(0,1))},hterm.VT.CSI.B=function(e){this.terminal.cursorDown(e.iarg(0,1))},hterm.VT.CSI.C=function(e){this.terminal.cursorRight(e.iarg(0,1))},hterm.VT.CSI.D=function(e){this.terminal.cursorLeft(e.iarg(0,1))},hterm.VT.CSI.E=function(e){this.terminal.cursorDown(e.iarg(0,1)),this.terminal.setCursorColumn(0)},hterm.VT.CSI.F=function(e){this.terminal.cursorUp(e.iarg(0,1)),this.terminal.setCursorColumn(0)},hterm.VT.CSI.G=function(e){this.terminal.setCursorColumn(e.iarg(0,1)-1)},hterm.VT.CSI.H=function(e){this.terminal.setCursorPosition(e.iarg(0,1)-1,e.iarg(1,1)-1)},hterm.VT.CSI.I=function(e){var t=e.iarg(0,1);t=lib.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;r<t;r++)this.terminal.forwardTabStop()},hterm.VT.CSI.J=hterm.VT.CSI["?J"]=function(e,t){var r=e.args[0];r&&0!=r?1==r?this.terminal.eraseAbove():2==r?this.terminal.clear():3==r&&this.terminal.clear():this.terminal.eraseBelow()},hterm.VT.CSI.K=hterm.VT.CSI["?K"]=function(e,t){var r=e.args[0];r&&0!=r?1==r?this.terminal.eraseToLeft():2==r&&this.terminal.eraseLine():this.terminal.eraseToRight()},hterm.VT.CSI.L=function(e){this.terminal.insertLines(e.iarg(0,1))},hterm.VT.CSI.M=function(e){this.terminal.deleteLines(e.iarg(0,1))},hterm.VT.CSI.P=function(e){this.terminal.deleteChars(e.iarg(0,1))},hterm.VT.CSI.S=function(e){this.terminal.vtScrollUp(e.iarg(0,1))},hterm.VT.CSI.T=function(e){e.args.length<=1&&this.terminal.vtScrollDown(e.iarg(0,1))},hterm.VT.CSI[">T"]=hterm.VT.ignore,hterm.VT.CSI.X=function(e){this.terminal.eraseToRight(e.iarg(0,1))},hterm.VT.CSI.Z=function(e){var t=e.iarg(0,1);t=lib.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;r<t;r++)this.terminal.backwardTabStop()},hterm.VT.CSI["`"]=hterm.VT.CSI.G,hterm.VT.CSI.a=function(e){this.terminal.setCursorColumn(this.terminal.getCursorColumn()+e.iarg(0,1))},hterm.VT.CSI.b=hterm.VT.ignore,hterm.VT.CSI.c=function(e){e.args[0]&&0!=e.args[0]||this.terminal.io.sendString("[?1;2c")},hterm.VT.CSI[">c"]=function(e){this.terminal.io.sendString("[>0;256;0c")},hterm.VT.CSI.d=function(e){this.terminal.setAbsoluteCursorRow(e.iarg(0,1)-1)},hterm.VT.CSI.f=hterm.VT.CSI.H,hterm.VT.CSI.g=function(e){e.args[0]&&0!=e.args[0]?3==e.args[0]&&this.terminal.clearAllTabStops():this.terminal.clearTabStopAtCursor(!1)},hterm.VT.CSI.h=function(e){for(var t=0;t<e.args.length;t++)this.setANSIMode(e.args[t],!0)},hterm.VT.CSI["?h"]=function(e){for(var t=0;t<e.args.length;t++)this.setDECMode(e.args[t],!0)},hterm.VT.CSI.i=hterm.VT.CSI["?i"]=hterm.VT.ignore,hterm.VT.CSI.l=function(e){for(var t=0;t<e.args.length;t++)this.setANSIMode(e.args[t],!1)},hterm.VT.CSI["?l"]=function(e){for(var t=0;t<e.args.length;t++)this.setDECMode(e.args[t],!1)},hterm.VT.CSI.m=function(e){function t(t){return e.args.length<t+2||5!=e.args[t+1]?null:e.iarg(t+2,0)}function r(t){return e.args.length<t+5||2!=e.args[t+1]?null:"rgb("+e.iarg(t+2,0)+" ,"+e.iarg(t+3,0)+" ,"+e.iarg(t+4,0)+")"}var o=this.terminal.getTextAttributes();if(e.args.length){for(var i=0;i<e.args.length;i++){var s=e.iarg(i,0);if(s<30)0==s?o.reset():1==s?o.bold=!0:2==s?o.faint=!0:3==s?o.italic=!0:4==s?o.underline=!0:5==s?o.blink=!0:7==s?o.inverse=!0:8==s?o.invisible=!0:9==s?o.strikethrough=!0:22==s?(o.bold=!1,o.faint=!1):23==s?o.italic=!1:24==s?o.underline=!1:25==s?o.blink=!1:27==s?o.inverse=!1:28==s?o.invisible=!1:29==s&&(o.strikethrough=!1);else if(s<50)if(s<38)o.foregroundSource=s-30;else if(38==s)if(null!=(n=r(i)))o.foregroundSource=o.SRC_RGB,o.foreground=n,i+=5;else{if(null==(a=t(i)))break;if(i+=2,a>=o.colorPalette.length)continue;o.foregroundSource=a}else if(39==s)o.foregroundSource=o.SRC_DEFAULT;else if(s<48)o.backgroundSource=s-40;else if(48==s){var n=r(i);if(null!=n)o.backgroundSource=o.SRC_RGB,o.background=n,i+=5;else{var a=t(i);if(null==a)break;if(i+=2,a>=o.colorPalette.length)continue;o.backgroundSource=a}}else o.backgroundSource=o.SRC_DEFAULT;else s>=90&&s<=97?o.foregroundSource=s-90+8:s>=100&&s<=107&&(o.backgroundSource=s-100+8)}o.setDefaults(this.terminal.getForegroundColor(),this.terminal.getBackgroundColor())}else o.reset()},hterm.VT.CSI[">m"]=hterm.VT.ignore,hterm.VT.CSI.n=function(e){if(5==e.args[0])this.terminal.io.sendString("0n");else if(6==e.args[0]){var t=this.terminal.getCursorRow()+1,r=this.terminal.getCursorColumn()+1;this.terminal.io.sendString("["+t+";"+r+"R")}},hterm.VT.CSI[">n"]=hterm.VT.ignore,hterm.VT.CSI["?n"]=function(e){if(6==e.args[0]){var t=this.terminal.getCursorRow()+1,r=this.terminal.getCursorColumn()+1;this.terminal.io.sendString("["+t+";"+r+"R")}else 15==e.args[0]?this.terminal.io.sendString("[?11n"):25==e.args[0]?this.terminal.io.sendString("[?21n"):26==e.args[0]?this.terminal.io.sendString("[?12;1;0;0n"):53==e.args[0]&&this.terminal.io.sendString("[?50n")},hterm.VT.CSI[">p"]=hterm.VT.ignore,hterm.VT.CSI["!p"]=function(){this.reset(),this.terminal.softReset()},hterm.VT.CSI.$p=hterm.VT.ignore,hterm.VT.CSI["?$p"]=hterm.VT.ignore,hterm.VT.CSI['"p']=hterm.VT.ignore,hterm.VT.CSI.q=hterm.VT.ignore,hterm.VT.CSI[" q"]=function(e){var t=e.args[0];0==t||1==t?(this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK),this.terminal.setCursorBlink(!0)):2==t?(this.terminal.setCursorShape(hterm.Terminal.cursorShape.BLOCK),this.terminal.setCursorBlink(!1)):3==t?(this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE),this.terminal.setCursorBlink(!0)):4==t?(this.terminal.setCursorShape(hterm.Terminal.cursorShape.UNDERLINE),this.terminal.setCursorBlink(!1)):5==t?(this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM),this.terminal.setCursorBlink(!0)):6==t?(this.terminal.setCursorShape(hterm.Terminal.cursorShape.BEAM),this.terminal.setCursorBlink(!1)):console.warn("Unknown cursor style: "+t)},hterm.VT.CSI['"q']=hterm.VT.ignore,hterm.VT.CSI.r=function(e){var t=e.args,r=t[0]?parseInt(t[0],10)-1:null,o=t[1]?parseInt(t[1],10)-1:null;this.terminal.setVTScrollRegion(r,o),this.terminal.setCursorPosition(0,0)},hterm.VT.CSI["?r"]=hterm.VT.ignore,hterm.VT.CSI.$r=hterm.VT.ignore,hterm.VT.CSI.s=function(){this.savedState_.save()},hterm.VT.CSI["?s"]=hterm.VT.ignore,hterm.VT.CSI.t=hterm.VT.ignore,hterm.VT.CSI.$t=hterm.VT.ignore,hterm.VT.CSI[">t"]=hterm.VT.ignore,hterm.VT.CSI[" t"]=hterm.VT.ignore,hterm.VT.CSI.u=function(){this.savedState_.restore()},hterm.VT.CSI[" u"]=hterm.VT.ignore,hterm.VT.CSI.$v=hterm.VT.ignore,hterm.VT.CSI["'w"]=hterm.VT.ignore,hterm.VT.CSI.x=hterm.VT.ignore,hterm.VT.CSI["*x"]=hterm.VT.ignore,hterm.VT.CSI.$x=hterm.VT.ignore,hterm.VT.CSI.z=function(e){if(!(e.args.length<1)){var t=e.args[0];if(0==t){if(e.args.length<2)return;this.terminal.getTextAttributes().tileData=e.args[1]}else 1==t&&(this.terminal.getTextAttributes().tileData=null)}},hterm.VT.CSI["'z"]=hterm.VT.ignore,hterm.VT.CSI.$z=hterm.VT.ignore,hterm.VT.CSI["'{"]=hterm.VT.ignore,hterm.VT.CSI["'|"]=hterm.VT.ignore,hterm.VT.CSI["'}"]=hterm.VT.ignore,hterm.VT.CSI["'~"]=hterm.VT.ignore,lib.rtdep("lib.f"),hterm.VT.CharacterMap=function(e,t){this.description=e,this.GL=null,this.glmapBase_=t,this.sync_()},hterm.VT.CharacterMap.prototype.sync_=function(e){var t=this;if(!this.glmapBase_&&!e)return this.GL=null,delete this.glmap_,void delete this.glre_;this.glmap_=e?Object.assign({},this.glmapBase_,e):this.glmapBase_;var r=Object.keys(this.glmap_).map(function(e){return"\\x"+lib.f.zpad(e.charCodeAt(0).toString(16))});this.glre_=new RegExp("["+r.join("")+"]","g"),this.GL=function(e){return e.replace(t.glre_,function(e){return t.glmap_[e]})}},hterm.VT.CharacterMap.prototype.reset=function(){this.glmap_!==this.glmapBase_&&this.sync_()},hterm.VT.CharacterMap.prototype.setOverrides=function(e){this.sync_(e)},hterm.VT.CharacterMap.prototype.clone=function(){var e=new hterm.VT.CharacterMap(this.description,this.glmapBase_);return this.glmap_!==this.glmapBase_&&e.setOverrides(this.glmap_),e},hterm.VT.CharacterMaps=function(){this.maps_=hterm.VT.CharacterMaps.DefaultMaps,this.mapsBase_=this.maps_},hterm.VT.CharacterMaps.prototype.getMap=function(e){return this.maps_.hasOwnProperty(e)?this.maps_[e]:void 0},hterm.VT.CharacterMaps.prototype.addMap=function(e,t){this.maps_===this.mapsBase_&&(this.maps_=Object.assign({},this.mapsBase_)),this.maps_[e]=t},hterm.VT.CharacterMaps.prototype.reset=function(){this.maps_!==hterm.VT.CharacterMaps.DefaultMaps&&(this.maps_=hterm.VT.CharacterMaps.DefaultMaps)},hterm.VT.CharacterMaps.prototype.setOverrides=function(e){this.maps_===this.mapsBase_&&(this.maps_=Object.assign({},this.mapsBase_));for(var t in e){var r=this.getMap(t);void 0!==r?(this.maps_[t]=r.clone(),this.maps_[t].setOverrides(e[t])):this.addMap(t,new hterm.VT.CharacterMap("user "+t,e[t]))}},hterm.VT.CharacterMaps.DefaultMaps={},hterm.VT.CharacterMaps.DefaultMaps[0]=new hterm.VT.CharacterMap("graphic",{"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"}),hterm.VT.CharacterMaps.DefaultMaps.A=new hterm.VT.CharacterMap("british",{"#":"£"}),hterm.VT.CharacterMaps.DefaultMaps.B=new hterm.VT.CharacterMap("us",null),hterm.VT.CharacterMaps.DefaultMaps[4]=new hterm.VT.CharacterMap("dutch",{"#":"£","@":"¾","[":"IJ","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"}),hterm.VT.CharacterMaps.DefaultMaps.C=hterm.VT.CharacterMaps.DefaultMaps[5]=new hterm.VT.CharacterMap("finnish",{"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),hterm.VT.CharacterMaps.DefaultMaps.R=new hterm.VT.CharacterMap("french",{"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"}),hterm.VT.CharacterMaps.DefaultMaps.Q=new hterm.VT.CharacterMap("french canadian",{"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"}),hterm.VT.CharacterMaps.DefaultMaps.K=new hterm.VT.CharacterMap("german",{"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"}),hterm.VT.CharacterMaps.DefaultMaps.Y=new hterm.VT.CharacterMap("italian",{"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"}),hterm.VT.CharacterMaps.DefaultMaps.E=hterm.VT.CharacterMaps.DefaultMaps[6]=new hterm.VT.CharacterMap("norwegian/danish",{"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"}),hterm.VT.CharacterMaps.DefaultMaps.Z=new hterm.VT.CharacterMap("spanish",{"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"}),hterm.VT.CharacterMaps.DefaultMaps[7]=hterm.VT.CharacterMaps.DefaultMaps.H=new hterm.VT.CharacterMap("swedish",{"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),hterm.VT.CharacterMaps.DefaultMaps["="]=new hterm.VT.CharacterMap("swiss",{"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}),lib.resource.add("hterm/audio/bell","audio/ogg;base64","T2dnUwACAAAAAAAAAADhqW5KAAAAAMFvEjYBHgF2b3JiaXMAAAAAAYC7AAAAAAA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CwAAApbUAQCK22MmE3O78VAbHQT9PIPNoT9zNc3l2Oe7TAVLANBufT8MAQAAAGzT4PS8AQAAoELGHb2uaCwwEv1EWhFriUkbAaAZ27/fVZnTZXbWz3BwWpjUaMZKRj7dZ0J//gUeTdpVEwAAZOFsNxKAjQSgA+ABPoY8Jj5y2wje81jsXc/1TOQWTDYZBmAkNDiqVwuA2NJ9AQAAEBKAt9Vrsfs/2N19MO91S9rd8EHTZHnzC5MYmfQEACy/FBcAAADA5c4gi4z8RANs/m6FNXVo9DV46JG1BBDukqlw/Va5G7QbuGVSI+2aZaoLXJrdVj2zlC9Z5QEAEFz/5QzgVZwAAAAA/oXcxyC6WfTu+09Ve/c766J4VTAGUFmA51+VANKi/QPoPwYgYAkA715OH4S0s5KDHvj99MMq8TPFc3roKZnGOoT1bmIhVgc7XAMBAAAAAMAW1VbQw3gapzOpJd+Kd2fc4iSO62fJv9+movui1wUNPAj059N3OVxzk4gV73PmE8FIA2F5mRq37Evc76vLXfF4rD5UJJAw46hW6LZCb5sNLdx+kzMCAAB+hfy95+965ZCLP7B3/VlTHCvDEKtQhTm4KiCgAEAbrfbWTPssAAAAXpee1tVrozYYn41wD1aeYtkKfswN5/SXPO0JDnhO/4laUortv/s412fybe/nONdncoCHnBVliu0CQGBWlPY/5Kwom2L/kruPM6Q7oz4tvDQy+bZ3HzOi+gNHA4DZEgA="),lib.resource.add("hterm/images/icon-96","image/png;base64","iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAFKhJREFUeNrtXXlsXMd5/30z8649uDzEmxRFibIsOXZ8VInTJFYSW3actE1ctWkctEF6I0VRFEWAoihQoAjQFmiBogWaIEADFCmQXklto04TO0ndWI4bxZ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5qJZ7okVKCHYd8V27/RRcM9gAAewc/2bsLH+GnCf+Xp/PmFsFtEBumLqss8oTIX9lzUFCQJ9rAijRV92VtjTxHyquqpKzLjn+Fu+xsKyULzLzyxhuXnkSNL66WnYRB+KnCDNydHP/dZzpCU7WWUuAGzxwjvlYZ9cLWm4cbxMUpD2vkqQzzkVwEUIC7Gb/iXQvez3fSYlWR0YZLuUUvkYHw453+JGK9EKdTrdT0Db2TW9CO6DeGSyhHetWXVqOfvXAq7m0vY9xvBW+28RvJ3ygP4ca3KcpJUU7wER/VAQBqK2H/DRZ+hspDe81EYKsQsZV1Vg7oKNKjyGegsXNuFOE302Ywr/G8Fe2pq4fqIfZmQvjbHbZ6AGzDNmzDNmzD2xT+H+5UT7Tyxc2HAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE2LTA2LTMwVDExOjUwOjAyLTA0OjAwOaSkCgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMy0xMS0wMVQxMDozODoyNC0wNDowMNba8BsAAAAASUVORK5CYII="),lib.resource.add("hterm/concat/date","text/plain","Sun, 22 Oct 2017 11:00:51 +0000"),lib.resource.add("hterm/changelog/version","text/plain","1.73"),lib.resource.add("hterm/changelog/date","text/plain","2017-10-16"),lib.resource.add("hterm/git/HEAD","text/plain","git rev-parse HEAD");var socket=io(location.origin,{path:"/wetty/socket.io"}),term=void 0,buf="",Wetty=function(){function e(t){_classCallCheck(this,e),this.argv_=t,this.io=null,this.pid_=-1}return _createClass(e,[{key:"run",value:function(){this.io=this.argv_.io.push(),this.io.onVTKeystroke=this.sendString_.bind(this),this.io.sendString=this.sendString_.bind(this),this.io.onTerminalResize=this.onTerminalResize.bind(this)}},{key:"sendString_",value:function(e){socket.emit("input",e)}},{key:"onTerminalResize",value:function(e,t){socket.emit("resize",{col:e,row:t})}}]),e}();socket.on("connect",function(){document.getElementById("overlay").style.display="none",window.addEventListener("beforeunload",handler,!1),lib.init(function(){hterm.defaultStorage=new lib.Storage.Local,term=new hterm.Terminal,window.term=term,term.decorate(document.getElementById("terminal")),term.setCursorPosition(0,0),term.setCursorVisible(!0),term.prefs_.set("ctrl-c-copy",!0),term.prefs_.set("ctrl-v-paste",!0),term.prefs_.set("use-default-window-copy",!0),term.prefs_.set("send-encoding","raw"),term.prefs_.set("receive-encoding","raw"),term.prefs_.set("font-size",14),term.scrollPort_.screen_.setAttribute("spellcheck","false"),term.scrollPort_.screen_.setAttribute("autocorrect","false"),term.scrollPort_.screen_.setAttribute("autocomplete","false"),term.scrollPort_.screen_.setAttribute("contenteditable","false"),term.runCommandClass(Wetty,document.location.hash.substr(1)),socket.emit("resize",{col:term.screenSize.width,row:term.screenSize.height}),buf&&""!==buf&&(term.io.writeUTF8(buf),buf="")})}),socket.on("output",function(e){term?term.io.writeUTF8(e):buf+=e}),socket.on("logout",function(){document.getElementById("overlay").style.display="block",window.removeEventListener("beforeunload",handler,!1)}),socket.on("disconnect",function(){document.getElementById("overlay").style.display="block",window.removeEventListener("beforeunload",handler,!1)});